[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v1 6/6] xen/arm: dom0less: Add a background PCI ECAM mmio region



On Tue, 24 Sep 2024, Edgar E. Iglesias wrote:
> From: "Edgar E. Iglesias" <edgar.iglesias@xxxxxxx>
> 
> Add a background PCI ECAM mmio region always reading as all ones.
> This indicates to the OS that there are no PCI devices on the bus.
> Once the device-model's IOREQ client connects, the OS can rescan
> the bus and find PV and emulated devices.
> 
> This avoids a race where domU's come up before the device models,
> causing domU to crash into a data-abort when accessing ECAM.
> 
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xxxxxxx>
> ---
>  xen/arch/arm/dom0less-build.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
> index dab24fa9e2..bc5285e7fa 100644
> --- a/xen/arch/arm/dom0less-build.c
> +++ b/xen/arch/arm/dom0less-build.c
> @@ -1015,6 +1015,16 @@ static int __init construct_domU(struct domain *d,
>              kinfo.virtio_pci.mem.base = GUEST_VIRTIO_PCI_MEM_BASE;
>              kinfo.virtio_pci.pf_mem.base = 
> GUEST_VIRTIO_PCI_PREFETCH_MEM_BASE;
>          }
> +
> +        /*
> +         * Register a background PCI ECAM region returning ~0. This indicates
> +         * to the OS that there are no PCI devices on the bus. Once an IOREQ
> +         * client connects, the OS can rescan the bus and find devices.
> +         */
> +        register_mmio_bg_handler(d, true, &mmio_read_const_writes_ignored,
> +                                 kinfo.virtio_pci.ecam.base,
> +                                 GUEST_VIRTIO_PCI_ECAM_SIZE,
> +                                 (void *) ULONG_MAX);
>      }

I think GUEST_VIRTIO_PCI_ECAM_SIZE should be added to the description of
virtio-pci-ranges in patch #3  to make it clear. Also any other "size"
too.

The ULONG_MAX -> void* -> uintptr_t -> register_t conversion works OK on
both Xen 64-bit and 32-bit as far as I can tell, so:

Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.