[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [PATCH v2 10/22] vfio/pci: set host iommu context to vIOMMU
From: |
Liu, Yi L |
Subject: |
RE: [PATCH v2 10/22] vfio/pci: set host iommu context to vIOMMU |
Date: |
Wed, 1 Apr 2020 03:20:40 +0000 |
Hi Eric,
> From: Auger Eric <address@hidden>
> Sent: Tuesday, March 31, 2020 10:30 PM
> To: Liu, Yi L <address@hidden>; address@hidden;
> Subject: Re: [PATCH v2 10/22] vfio/pci: set host iommu context to vIOMMU
>
> Yi,
>
> On 3/30/20 6:24 AM, Liu Yi L wrote:
> > For vfio-pci devices, it could use pci_device_set/unset_iommu() to
> > expose host iommu context to vIOMMU emulators. vIOMMU emulators could
> > make use the methods provided by host iommu context. e.g.
> > propagate requests to host iommu.
> I think I would squash this patch into the previous one.
sure, I can make it. :-)
> >
> > Cc: Kevin Tian <address@hidden>
> > Cc: Jacob Pan <address@hidden>
> > Cc: Peter Xu <address@hidden>
> > Cc: Eric Auger <address@hidden>
> > Cc: Yi Sun <address@hidden>
> > Cc: David Gibson <address@hidden>
> > Cc: Alex Williamson <address@hidden>
> > Signed-off-by: Liu Yi L <address@hidden>
> > ---
> > hw/vfio/pci.c | 13 +++++++++++++
> > 1 file changed, 13 insertions(+)
> >
> > diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 5e75a95..c140c88
> > 100644
> > --- a/hw/vfio/pci.c
> > +++ b/hw/vfio/pci.c
> > @@ -2717,6 +2717,7 @@ static void vfio_realize(PCIDevice *pdev, Error
> > **errp)
> > VFIOPCIDevice *vdev = PCI_VFIO(pdev);
> > VFIODevice *vbasedev_iter;
> > VFIOGroup *group;
> > + VFIOContainer *container;
> > char *tmp, *subsys, group_path[PATH_MAX], *group_name;
> > Error *err = NULL;
> > ssize_t len;
> > @@ -3028,6 +3029,11 @@ static void vfio_realize(PCIDevice *pdev, Error
> > **errp)
> > vfio_register_req_notifier(vdev);
> > vfio_setup_resetfn_quirk(vdev);
> >
> > + container = vdev->vbasedev.group->container;
> > + if (container->iommu_ctx.initialized) {
> Sin't it possible to dynamically allocate the iommu_ctx so that you can
> simply check
> container->iommu_ctx and discard the initialized field?
iommu_ctx is allocated along with container as it is not a pointer in
VFIOContainer.
The only way to check it is to have flag. :-)
Regards,
Yi Liu
- [PATCH v2 04/22] hw/iommu: introduce HostIOMMUContext, (continued)
- [PATCH v2 04/22] hw/iommu: introduce HostIOMMUContext, Liu Yi L, 2020/03/30
- [PATCH v2 06/22] hw/pci: introduce pci_device_set/unset_iommu_context(), Liu Yi L, 2020/03/30
- [PATCH v2 10/22] vfio/pci: set host iommu context to vIOMMU, Liu Yi L, 2020/03/30
- [PATCH v2 07/22] intel_iommu: add set/unset_iommu_context callback, Liu Yi L, 2020/03/30
- [PATCH v2 22/22] intel_iommu: modify x-scalable-mode to be string option, Liu Yi L, 2020/03/30
- [PATCH v2 09/22] vfio/common: init HostIOMMUContext per-container, Liu Yi L, 2020/03/30
- [PATCH v2 02/22] header file update VFIO/IOMMU vSVA APIs, Liu Yi L, 2020/03/30
- [PATCH v2 08/22] vfio/common: provide PASID alloc/free hooks, Liu Yi L, 2020/03/30