From: "Cédric Le Goater" <clg@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>, qemu-devel@nongnu.org
Cc: "Joao Martins" <joao.m.martins@oracle.com>,
"Liu Yi L" <yi.l.liu@intel.com>,
"Kevin Tian" <kevin.tian@intel.com>,
"Jacob Pan" <jacob.jun.pan@linux.intel.com>,
"Peter Xu" <peterx@redhat.com>,
"Eric Auger" <eric.auger@redhat.com>,
"Yi Sun" <yi.y.sun@linux.intel.com>,
"David Gibson" <david@gibson.dropbear.id.au>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Jason Wang" <jasowang@redhat.com>,
"Andrey Smirnov" <andrew.smirnov@gmail.com>,
"Helge Deller" <deller@gmx.de>,
"Hervé Poussineau" <hpoussin@reactos.org>,
"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
"BALATON Zoltan" <balaton@eik.bme.hu>,
"Elena Ufimtseva" <elena.ufimtseva@oracle.com>,
"Jagannathan Raman" <jag.raman@oracle.com>,
"Matthew Rosato" <mjrosato@linux.ibm.com>,
"Eric Farman" <farman@linux.ibm.com>,
"Halil Pasic" <pasic@linux.ibm.com>,
"Christian Borntraeger" <borntraeger@linux.ibm.com>,
"Thomas Huth" <thuth@redhat.com>
Subject: Re: [PATCH] hw/pci: modify pci_setup_iommu() to set PCIIOMMUOps
Date: Mon, 16 Oct 2023 11:33:33 +0200 [thread overview]
Message-ID: <40388501-a79c-4abd-96b6-5804cddbed76@redhat.com> (raw)
In-Reply-To: <4aa32a57-97e7-37c5-2873-4699629f4199@linaro.org>
On 10/16/23 07:03, Philippe Mathieu-Daudé wrote:
> Hi Cédric, Liu, Joao,
>
> On 13/10/23 16:56, Cédric Le Goater wrote:
>> From: Liu Yi L <yi.l.liu@intel.com>
>>
>> This patch modifies pci_setup_iommu() to set PCIIOMMUOps
>> instead of setting PCIIOMMUFunc. PCIIOMMUFunc is used to
>> get an address space for a PCI device in vendor specific
>> way. The PCIIOMMUOps still offers this functionality. But
>> using PCIIOMMUOps leaves space to add more iommu related
>> vendor specific operations.
>>
>> Cc: Kevin Tian <kevin.tian@intel.com>
>> Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>
>> Cc: Peter Xu <peterx@redhat.com>
>> Cc: Eric Auger <eric.auger@redhat.com>
>> Cc: Yi Sun <yi.y.sun@linux.intel.com>
>> Cc: David Gibson <david@gibson.dropbear.id.au>
>> Cc: "Michael S. Tsirkin" <mst@redhat.com>
>> Cc: Eric Auger <eric.auger@redhat.com>
>> Cc: Peter Maydell <peter.maydell@linaro.org>
>> Cc: Paolo Bonzini <pbonzini@redhat.com>
>> Cc: Peter Xu <peterx@redhat.com>
>> Cc: Jason Wang <jasowang@redhat.com>
>> Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
>> Cc: Helge Deller <deller@gmx.de>
>> Cc: "Hervé Poussineau" <hpoussin@reactos.org>
>> Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
>> Cc: BALATON Zoltan <balaton@eik.bme.hu>
>> Cc: Elena Ufimtseva <elena.ufimtseva@oracle.com>
>> Cc: Jagannathan Raman <jag.raman@oracle.com>
>> Cc: Matthew Rosato <mjrosato@linux.ibm.com>
>> Cc: Eric Farman <farman@linux.ibm.com>
>> Cc: Halil Pasic <pasic@linux.ibm.com>
>> Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
>> Cc: Thomas Huth <thuth@redhat.com>
>> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
>> Reviewed-by: Peter Xu <peterx@redhat.com>
>> Signed-off-by: Liu Yi L <yi.l.liu@intel.com>
>> [ clg: - refreshed on latest QEMU
>> - included hw/remote/iommu.c ]
>> Signed-off-by: Cédric Le Goater <clg@redhat.com>
>> ---
>>
>>
>> Hello,
>>
>> Initially sent by Yi Liu as part of series "intel_iommu: expose
>> Shared Virtual Addressing to VMs" [1], this patch would also simplify
>> the changes Joao wants to introduce in "vfio: VFIO migration support
>> with vIOMMU" [2].
>>
>> Has anyone objections ?
>>
>> Thanks,
>>
>> C.
>>
>> [1] https://lore.kernel.org/qemu-devel/20210302203827.437645-5-yi.l.liu@intel.com/
>> [2] https://lore.kernel.org/qemu-devel/20230622214845.3980-1-joao.m.martins@oracle.com/
>>
>>
>>
>> include/hw/pci/pci.h | 8 ++++++--
>> include/hw/pci/pci_bus.h | 2 +-
>> hw/alpha/typhoon.c | 6 +++++-
>> hw/arm/smmu-common.c | 6 +++++-
>> hw/i386/amd_iommu.c | 6 +++++-
>> hw/i386/intel_iommu.c | 6 +++++-
>> hw/pci-host/designware.c | 6 +++++-
>> hw/pci-host/dino.c | 6 +++++-
>> hw/pci-host/pnv_phb3.c | 6 +++++-
>> hw/pci-host/pnv_phb4.c | 6 +++++-
>> hw/pci-host/ppce500.c | 6 +++++-
>> hw/pci-host/raven.c | 6 +++++-
>> hw/pci-host/sabre.c | 6 +++++-
>> hw/pci/pci.c | 18 +++++++++++++-----
>> hw/ppc/ppc440_pcix.c | 6 +++++-
>> hw/ppc/spapr_pci.c | 6 +++++-
>> hw/remote/iommu.c | 6 +++++-
>> hw/s390x/s390-pci-bus.c | 8 ++++++--
>> hw/virtio/virtio-iommu.c | 6 +++++-
>> 19 files changed, 101 insertions(+), 25 deletions(-)
>>
>> diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
>> index b70a0b95ff5ae367ed7f98483ec8d1d1b6274530..486e54174b1755995328f2352fd4571d01e107dc 100644
>> --- a/include/hw/pci/pci.h
>> +++ b/include/hw/pci/pci.h
>> @@ -366,10 +366,14 @@ void pci_bus_get_w64_range(PCIBus *bus, Range *range);
>> void pci_device_deassert_intx(PCIDevice *dev);
>> -typedef AddressSpace *(*PCIIOMMUFunc)(PCIBus *, void *, int);
>> +typedef struct PCIIOMMUOps PCIIOMMUOps;
>
> Preferably:
>
> typedef ...
>
>> +struct PCIIOMMUOps {
yes.
> /* documentation ... */
>
>> + AddressSpace * (*get_address_space)(PCIBus *bus,
>> + void *opaque, int32_t devfn);
>> +};
>
> ... PCIIOMMUOps;
>
> Should this be PciIommuOps?
I think this is one of the exceptions to the QEMU coding style and
the other PCI types keep a capital PCI, PCIIORegion, PCIINTxRoute,
PCIEAERErr, etc.
Let's be consistent with the existing naming scheme, PCIIOMMUOps.
> Do we need 'int32_t' for devfn or 'int' is enough?
int is enough.
> Would "lookup_address_space" be clearer?
The calling routing is pci_device_iommu_address_space(). Let's keep
get_address_space() for now.
>> AddressSpace *pci_device_iommu_address_space(PCIDevice *dev);
>> -void pci_setup_iommu(PCIBus *bus, PCIIOMMUFunc fn, void *opaque);
>
> Since the prototype is modified, we can take the opportunity to
> document it :)
OK. That would be the first documentation entry in pci.h. I guess it
won't do any harm but will it be collected in the documentation under
"Internal QEMU APIs" ?
>> +void pci_setup_iommu(PCIBus *bus, const PCIIOMMUOps *iommu_ops, void *opaque);
>
> Otherwise the change makes sense.
Thanks,
C.
prev parent reply other threads:[~2023-10-16 9:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-13 14:56 [PATCH] hw/pci: modify pci_setup_iommu() to set PCIIOMMUOps Cédric Le Goater
2023-10-16 5:03 ` Philippe Mathieu-Daudé
2023-10-16 9:33 ` Cédric Le Goater [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=40388501-a79c-4abd-96b6-5804cddbed76@redhat.com \
--to=clg@redhat.com \
--cc=andrew.smirnov@gmail.com \
--cc=balaton@eik.bme.hu \
--cc=borntraeger@linux.ibm.com \
--cc=david@gibson.dropbear.id.au \
--cc=deller@gmx.de \
--cc=elena.ufimtseva@oracle.com \
--cc=eric.auger@redhat.com \
--cc=farman@linux.ibm.com \
--cc=hpoussin@reactos.org \
--cc=jacob.jun.pan@linux.intel.com \
--cc=jag.raman@oracle.com \
--cc=jasowang@redhat.com \
--cc=joao.m.martins@oracle.com \
--cc=kevin.tian@intel.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=mjrosato@linux.ibm.com \
--cc=mst@redhat.com \
--cc=pasic@linux.ibm.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.com \
--cc=yi.l.liu@intel.com \
--cc=yi.y.sun@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).