[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v12 04/13] virtio-iommu: Add the iommu regions
From: |
Peter Xu |
Subject: |
Re: [PATCH v12 04/13] virtio-iommu: Add the iommu regions |
Date: |
Mon, 13 Jan 2020 15:06:49 -0500 |
On Thu, Jan 09, 2020 at 03:43:10PM +0100, Eric Auger wrote:
> +/**
> + * The bus number is used for lookup when SID based operations occur.
> + * In that case we lazily populate the IOMMUPciBus array from the bus hash
> + * table. At the time the IOMMUPciBus is created (iommu_find_add_as), the bus
> + * numbers may not be always initialized yet.
> + */
> +static IOMMUPciBus *iommu_find_iommu_pcibus(VirtIOIOMMU *s, uint8_t bus_num)
> +{
> + IOMMUPciBus *iommu_pci_bus = s->iommu_pcibus_by_bus_num[bus_num];
> +
> + if (!iommu_pci_bus) {
> + GHashTableIter iter;
> +
> + g_hash_table_iter_init(&iter, s->as_by_busptr);
> + while (g_hash_table_iter_next(&iter, NULL, (void **)&iommu_pci_bus))
> {
> + if (pci_bus_num(iommu_pci_bus->bus) == bus_num) {
> + s->iommu_pcibus_by_bus_num[bus_num] = iommu_pci_bus;
> + return iommu_pci_bus;
> + }
> + }
Btw, we may need to:
return NULL;
here.
> + }
> + return iommu_pci_bus;
> +}
--
Peter Xu
- [PATCH v12 00/13] VIRTIO-IOMMU device, Eric Auger, 2020/01/09
- [PATCH v12 05/13] virtio-iommu: Endpoint and domains structs and helpers, Eric Auger, 2020/01/09
- Re: [PATCH v12 05/13] virtio-iommu: Endpoint and domains structs and helpers, Peter Xu, 2020/01/13
- Re: [PATCH v12 05/13] virtio-iommu: Endpoint and domains structs and helpers, Auger Eric, 2020/01/14
- Re: [PATCH v12 05/13] virtio-iommu: Endpoint and domains structs and helpers, Peter Xu, 2020/01/14
- Re: [PATCH v12 05/13] virtio-iommu: Endpoint and domains structs and helpers, Auger Eric, 2020/01/15
- Re: [PATCH v12 05/13] virtio-iommu: Endpoint and domains structs and helpers, Peter Xu, 2020/01/15
- Re: [PATCH v12 05/13] virtio-iommu: Endpoint and domains structs and helpers, Auger Eric, 2020/01/15
- Re: [PATCH v12 05/13] virtio-iommu: Endpoint and domains structs and helpers, Auger Eric, 2020/01/15
[PATCH v12 06/13] virtio-iommu: Implement attach/detach command, Eric Auger, 2020/01/09