[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v6 12/19] vfio-user: IOMMU support for remote device
From: |
Stefan Hajnoczi |
Subject: |
Re: [PATCH v6 12/19] vfio-user: IOMMU support for remote device |
Date: |
Tue, 22 Feb 2022 10:40:02 +0000 |
On Thu, Feb 17, 2022 at 02:48:59AM -0500, Jagannathan Raman wrote:
> +struct RemoteIommuElem {
> + AddressSpace as;
> + MemoryRegion mr;
> +};
> +
> +GHashTable *remote_iommu_elem_by_bdf;
A mutable global hash table requires synchronization when device
emulation runs in multiple threads.
I suggest using pci_setup_iommu()'s iommu_opaque argument to avoid the
global. If there is only 1 device per remote PCI bus, then there are no
further synchronization concerns.
> +
> +#define INT2VOIDP(i) (void *)(uintptr_t)(i)
> +
> +static AddressSpace *remote_iommu_find_add_as(PCIBus *pci_bus,
> + void *opaque, int devfn)
> +{
> + struct RemoteIommuElem *elem = NULL;
> + int pci_bdf = PCI_BUILD_BDF(pci_bus_num(pci_bus), devfn);
> +
> + if (!remote_iommu_elem_by_bdf) {
> + return &address_space_memory;
> + }
When can this happen? remote_configure_iommu() allocates
remote_iommu_elem_by_bdf so it should always be non-NULL.
signature.asc
Description: PGP signature
- Re: [PATCH v6 04/19] remote/machine: add HotplugHandler for remote machine, (continued)
- [PATCH v6 06/19] vfio-user: build library, Jagannathan Raman, 2022/02/17
- [PATCH v6 10/19] vfio-user: run vfio-user context, Jagannathan Raman, 2022/02/17
- [PATCH v6 08/19] vfio-user: instantiate vfio-user context, Jagannathan Raman, 2022/02/17
- [PATCH v6 12/19] vfio-user: IOMMU support for remote device, Jagannathan Raman, 2022/02/17
- Re: [PATCH v6 12/19] vfio-user: IOMMU support for remote device,
Stefan Hajnoczi <=
- [PATCH v6 09/19] vfio-user: find and init PCI device, Jagannathan Raman, 2022/02/17
- [PATCH v6 01/19] configure, meson: override C compiler for cmake, Jagannathan Raman, 2022/02/17
- Re: [PATCH v6 01/19] configure, meson: override C compiler for cmake, Peter Maydell, 2022/02/17
- Re: [PATCH v6 01/19] configure, meson: override C compiler for cmake, Jag Raman, 2022/02/17
- Re: [PATCH v6 01/19] configure, meson: override C compiler for cmake, Jag Raman, 2022/02/17
- Re: [PATCH v6 01/19] configure, meson: override C compiler for cmake, Paolo Bonzini, 2022/02/18
- Re: [PATCH v6 01/19] configure, meson: override C compiler for cmake, Jag Raman, 2022/02/18