qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Eric Auger <eric.auger@redhat.com>
Cc: Donald Dutile <ddutile@redhat.com>,
	Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>,
	"qemu-arm@nongnu.org" <qemu-arm@nongnu.org>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"peter.maydell@linaro.org" <peter.maydell@linaro.org>,
	"jgg@nvidia.com" <jgg@nvidia.com>,
	"nicolinc@nvidia.com" <nicolinc@nvidia.com>,
	"nathanc@nvidia.com" <nathanc@nvidia.com>,
	"mochs@nvidia.com" <mochs@nvidia.com>,
	"smostafa@google.com" <smostafa@google.com>,
	Linuxarm <linuxarm@huawei.com>,
	"Wangzhou (B)" <wangzhou1@hisilicon.com>,
	jiangkunkun <jiangkunkun@huawei.com>,
	Jonathan Cameron <jonathan.cameron@huawei.com>,
	"zhangfei.gao@linaro.org" <zhangfei.gao@linaro.org>
Subject: Re: [RFC PATCH v2 05/20] hw/arm/smmuv3-accel: Associate a pxb-pcie bus
Date: Mon, 24 Mar 2025 15:02:47 +0000	[thread overview]
Message-ID: <Z-F0F1-zpI4kvO-j@redhat.com> (raw)
In-Reply-To: <b7201a78-f2ea-4aee-a973-b02e4dc78652@redhat.com>

On Mon, Mar 24, 2025 at 03:56:12PM +0100, Eric Auger wrote:
> 
> 
> On 3/21/25 1:59 AM, Donald Dutile wrote:
> >
> >
> > On 3/19/25 2:21 PM, Eric Auger wrote:
> >> Hi Don,
> >>
> >>
> >> On 3/19/25 5:21 PM, Donald Dutile wrote:
> >>>
> >>>
> >>> On 3/19/25 5:26 AM, Shameerali Kolothum Thodi wrote:
> >>>> Hi Don,
> >>>>
> >>> Hey!
> >>>
> >>>>> -----Original Message-----
> >>>>> From: Donald Dutile <ddutile@redhat.com>
> >>>>> Sent: Tuesday, March 18, 2025 10:12 PM
> >>>>> To: Shameerali Kolothum Thodi
> >>>>> <shameerali.kolothum.thodi@huawei.com>; qemu-arm@nongnu.org;
> >>>>> qemu-devel@nongnu.org
> >>>>> Cc: eric.auger@redhat.com; peter.maydell@linaro.org; jgg@nvidia.com;
> >>>>> nicolinc@nvidia.com; berrange@redhat.com; nathanc@nvidia.com;
> >>>>> mochs@nvidia.com; smostafa@google.com; Linuxarm
> >>>>> <linuxarm@huawei.com>; Wangzhou (B) <wangzhou1@hisilicon.com>;
> >>>>> jiangkunkun <jiangkunkun@huawei.com>; Jonathan Cameron
> >>>>> <jonathan.cameron@huawei.com>; zhangfei.gao@linaro.org
> >>>>> Subject: Re: [RFC PATCH v2 05/20] hw/arm/smmuv3-accel: Associate a
> >>>>> pxb-
> >>>>> pcie bus
> >>>>>
> >>>>> Shameer,
> >>>>>
> >>>>> Hi!
> >>>>>
> >>>>> On 3/11/25 10:10 AM, Shameer Kolothum wrote:
> >>>>>> User must associate a pxb-pcie root bus to smmuv3-accel
> >>>>>> and that is set as the primary-bus for the smmu dev.
> >>>>>>
> >>>>>> Signed-off-by: Shameer Kolothum
> >>>>> <shameerali.kolothum.thodi@huawei.com>
> >>>>>> ---
> >>>>>>     hw/arm/smmuv3-accel.c | 19 +++++++++++++++++++
> >>>>>>     1 file changed, 19 insertions(+)
> >>>>>>
> >>>>>> diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
> >>>>>> index c327661636..1471b65374 100644
> >>>>>> --- a/hw/arm/smmuv3-accel.c
> >>>>>> +++ b/hw/arm/smmuv3-accel.c
> >>>>>> @@ -9,6 +9,21 @@
> >>>>>>     #include "qemu/osdep.h"
> >>>>>>
> >>>>>>     #include "hw/arm/smmuv3-accel.h"
> >>>>>> +#include "hw/pci/pci_bridge.h"
> >>>>>> +
> >>>>>> +static int smmuv3_accel_pxb_pcie_bus(Object *obj, void *opaque)
> >>>>>> +{
> >>>>>> +    DeviceState *d = opaque;
> >>>>>> +
> >>>>>> +    if (object_dynamic_cast(obj, "pxb-pcie-bus")) {
> >>>>>> +        PCIBus *bus = PCI_HOST_BRIDGE(obj->parent)->bus;
> >>>>>> +        if (d->parent_bus && !strcmp(bus->qbus.name, d->parent_bus-
> >>>>>> name)) {
> >>>>>> +            object_property_set_link(OBJECT(d), "primary-bus",
> >>>>>> OBJECT(bus),
> >>>>>> +                                     &error_abort);
> >>>>>> +        }
> >>>>>> +    }
> >>>>>> +    return 0;
> >>>>>> +}
> >>>>>>
> >>>>>>     static void smmu_accel_realize(DeviceState *d, Error **errp)
> >>>>>>     {
> >>>>>> @@ -17,6 +32,9 @@ static void smmu_accel_realize(DeviceState *d,
> >>>>>> Error
> >>>>> **errp)
> >>>>>>         SysBusDevice *dev = SYS_BUS_DEVICE(d);
> >>>>>>         Error *local_err = NULL;
> >>>>>>
> >>>>>> +    object_child_foreach_recursive(object_get_root(),
> >>>>>> +                                   smmuv3_accel_pxb_pcie_bus, d);
> >>>>>> +
> >>>>>>         object_property_set_bool(OBJECT(dev), "accel", true,
> >>>>>> &error_abort);
> >>>>>>         c->parent_realize(d, &local_err);
> >>>>>>         if (local_err) {
> >>>>>> @@ -33,6 +51,7 @@ static void smmuv3_accel_class_init(ObjectClass
> >>>>> *klass, void *data)
> >>>>>>         device_class_set_parent_realize(dc, smmu_accel_realize,
> >>>>>>                                         &c->parent_realize);
> >>>>>>         dc->hotpluggable = false;
> >>>>>> +    dc->bus_type = TYPE_PCIE_BUS;
> >>>>>>     }
> >>>>>>
> >>>>>>     static const TypeInfo smmuv3_accel_type_info = {
> >>>>>
> >>>>> I am not seeing the need for a pxb-pcie bus(switch) introduced for
> >>>>> each
> >>>>> 'accel'.
> >>>>> Isn't the IORT able to define different SMMUs for different RIDs?
> >>>>> if so,
> >>>>> itsn't that sufficient
> >>>>> to associate (define) an SMMU<->RID association without introducing a
> >>>>> pxb-pcie?
> >>>>> and again, I'm not sure how that improves/enables the device<->SMMU
> >>>>> associativity?
> >>>>
> >>>> Thanks for taking a look at the series. As discussed elsewhere in
> >>>> this thread(with
> >>>> Eric), normally in physical world (or atleast in the most common
> >>>> cases) SMMUv3
> >>>> is attached to PCIe Root Complex and if you take a look at the IORT
> >>>> spec, it describes
> >>>> association of ID mappings between a RC node and SMMUV3 node.
> >>>>
> >>>> And if my understanding is correct, in Qemu, only pxb-pcie allows you
> >>>> to add
> >>>> extra root complexes even though it is still plugged to
> >>>> parent(pcie.0). ie, for all
> >>>> devices downstream it acts as a root complex but still plugged into a
> >>>> parent pcie.0.
> >>>> This allows us to add/describe multiple "smmuv3-accel" each
> >>>> associated with a RC.
> >>>>
> >>> I find the qemu statements a bit unclear here as well.
> >>> I looked at the hot plug statement(s) in docs/pcie.txt, as I figured
> >>> that's where dynamic
> >>> IORT changes would be needed as well.  There, it says you can hot-add
> >>> PCIe devices to RPs,
> >>> one has to define/add RP's to the machine model for that plug-in.
> >>>
> >>> Using libvirt, it could auto-add the needed RPs to do dynmaic smmuv3
> >>> additions,
> >> I am not sure I understand your statement here. we don't want "dynamic"
> >> SMMUv3 instantiation. SMMUv3 is a platform device which is supposed to
> >> be coldplugged on a pre-existing PCIe hierarchy. The SMMUv3 device is
> >> not something that is meant to be hotplugged or hotunplugged.
> >> To me we hijack the bus= property to provide information about the IORT
> >> IDMAP
> >>
> > Dynamic in the sense that if one adds smmuv3 for multiple devices,
> > libvirt will dynamically figure out how to instantiate one, two,
> > three... smmu's
> > in the machine at cold boot.
> > If you want a machine to be able to hot-plug a device that would
> > require another smmu,
> > than the config, and smmu, would have to be explicilty stated; as is
> > done today for
> > hot-plug PCIe if the simple machine that libvirt would make is not
> > sufficient to
> > hot-add a PCIe device.
> 
> Hum this will need to be discussed with libvirt guys but I am not sure
> they will be inclined to support such kind of policy, esp because vIOMMU
> is a pretty marginal use case as of now. They do automatic instantiation
> for pcie, usb controllers but I am not sure they will take care of the
> vIOMMU tbh

Honestly I've lost track of what's going on this thread design-wise.

As general precedence though, the PCI(e) hierarchies libvirt auto-creates
are very flat - no PXBs for example, no association of host/guest NUMA,
etc. Libvirt does as little as possible in order to get PCI devices
working and anything even slightly "fancy" is left upto the mgmt app
to define. IIRC we have a few scenarios where IOMMUs get auto-added,
but mostly we expect the mgmt app to define them.


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



  reply	other threads:[~2025-03-24 15:03 UTC|newest]

Thread overview: 145+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-11 14:10 [RFC PATCH v2 00/20] hw/arm/virt: Add support for user-creatable accelerated SMMUv3 Shameer Kolothum via
2025-03-11 14:10 ` [RFC PATCH v2 01/20] backends/iommufd: Introduce iommufd_backend_alloc_viommu Shameer Kolothum via
2025-03-12 15:20   ` Eric Auger
2025-03-11 14:10 ` [RFC PATCH v2 02/20] backends/iommufd: Introduce iommufd_vdev_alloc Shameer Kolothum via
2025-03-12 15:25   ` Eric Auger
2025-03-11 14:10 ` [RFC PATCH v2 03/20] hw/arm/smmuv3-accel: Add initial infrastructure for smmuv3-accel device Shameer Kolothum via
2025-03-11 20:13   ` Nicolin Chen
2025-03-12 15:15   ` Eric Auger
2025-03-17 17:54     ` Nicolin Chen
2025-03-17 18:07       ` Eric Auger
2025-03-17 19:10         ` Nicolin Chen
2025-03-17 19:24           ` Jason Gunthorpe
2025-03-17 20:19             ` Nicolin Chen
2025-03-18  9:50               ` Shameerali Kolothum Thodi via
2025-03-18 18:31               ` Eric Auger
2025-03-18 19:13                 ` Nicolin Chen
2025-03-18 21:22                   ` Donald Dutile
2025-03-19  0:23                     ` Jason Gunthorpe
2025-03-19  2:15                       ` Donald Dutile
2025-03-19 17:00                       ` Eric Auger
2025-03-19 17:12                         ` Shameerali Kolothum Thodi via
2025-03-19 17:38                           ` Eric Auger
2025-03-21  0:55                         ` Donald Dutile
2025-03-19 17:04                     ` Eric Auger
2025-03-21  0:54                       ` Donald Dutile
2025-03-24 14:52                         ` Eric Auger
2025-03-19  0:31                 ` Jason Gunthorpe
2025-03-19  5:27                   ` Nicolin Chen
2025-03-24 14:08                   ` Eric Auger
2025-03-18 21:42             ` Donald Dutile
2025-03-19 16:45           ` Eric Auger
2025-03-19 16:53             ` Shameerali Kolothum Thodi via
2025-03-19 17:26               ` Eric Auger
2025-03-19 17:34                 ` Jason Gunthorpe
2025-03-19 17:41                   ` Eric Auger
2025-03-19 17:14             ` Nicolin Chen
2025-03-19 18:09               ` Eric Auger
2025-03-19 18:34                 ` Nicolin Chen
2025-03-24 14:46                   ` Eric Auger
2025-03-21  1:26                 ` Donald Dutile
2025-03-24 14:59                   ` Eric Auger
2025-03-11 14:10 ` [RFC PATCH v2 04/20] hw/arm/virt: Add support for smmuv3-accel Shameer Kolothum via
2025-03-11 20:22   ` Nicolin Chen
2025-03-12  9:44     ` Shameerali Kolothum Thodi via
2025-03-12 15:36   ` Eric Auger
2025-03-12 15:46     ` Shameerali Kolothum Thodi via
2025-03-12 16:13       ` Eric Auger
2025-03-12 16:22         ` Shameerali Kolothum Thodi via
2025-03-12 16:27           ` Eric Auger
2025-03-12 17:34             ` Shameerali Kolothum Thodi via
2025-03-12 18:30               ` Eric Auger
2025-03-13  8:26                 ` Shameerali Kolothum Thodi via
2025-03-13 15:22                   ` Eric Auger
2025-03-18 22:49   ` Donald Dutile
2025-03-19  9:28     ` Shameerali Kolothum Thodi via
2025-03-11 14:10 ` [RFC PATCH v2 05/20] hw/arm/smmuv3-accel: Associate a pxb-pcie bus Shameer Kolothum via
2025-03-12 16:07   ` Eric Auger
2025-03-12 16:34     ` Shameerali Kolothum Thodi via
2025-03-12 16:39       ` Daniel P. Berrangé
2025-03-12 17:28         ` Shameerali Kolothum Thodi via
2025-03-13 15:21           ` Eric Auger
2025-03-12 16:42       ` Eric Auger
2025-03-13  8:22         ` Shameerali Kolothum Thodi via
2025-03-17 16:57           ` Eric Auger
2025-03-18 22:12   ` Donald Dutile
2025-03-19  9:26     ` Shameerali Kolothum Thodi via
2025-03-19 16:21       ` Donald Dutile
2025-03-19 18:21         ` Eric Auger
2025-03-21  0:59           ` Donald Dutile
2025-03-24 14:56             ` Eric Auger
2025-03-24 15:02               ` Daniel P. Berrangé [this message]
2025-03-24 21:43               ` Donald Dutile
2025-03-20 17:02       ` Nicolin Chen
2025-03-24  8:19         ` Shameerali Kolothum Thodi via
2025-03-24 13:13           ` Eric Auger
2025-03-24 13:55             ` Shameerali Kolothum Thodi via
2025-03-24 15:34               ` Eric Auger
2025-03-24 16:01             ` Nicolin Chen
2025-03-24 16:06               ` Shameerali Kolothum Thodi via
2025-03-24 15:50           ` Nicolin Chen
2025-03-11 14:10 ` [RFC PATCH v2 06/20] hw/arm/smmu-common: Factor out common helper functions and export Shameer Kolothum via
2025-03-12 16:12   ` Eric Auger
2025-03-11 14:10 ` [RFC PATCH v2 07/20] hw/arm/smmu-common: Introduce callbacks for PCIIOMMUOps Shameer Kolothum via
2025-03-12 16:23   ` Eric Auger
2025-03-13  8:09     ` Shameerali Kolothum Thodi via
2025-03-17 16:52       ` Eric Auger
2025-03-18  9:47         ` Shameerali Kolothum Thodi via
2025-03-12 17:10   ` Eric Auger
2025-03-11 14:10 ` [RFC PATCH v2 08/20] hw/arm/smmuv3-accel: Provide get_address_space callback Shameer Kolothum via
2025-03-11 20:50   ` Nicolin Chen
2025-03-12 17:14   ` Eric Auger
2025-03-11 14:10 ` [RFC PATCH v2 09/20] hw/arm/smmuv3-accel: Add set/unset_iommu_device callback Shameer Kolothum via
2025-03-11 21:07   ` Nicolin Chen
2025-03-17  8:38     ` Shameerali Kolothum Thodi via
2025-03-17 18:19       ` Nicolin Chen
2025-03-12 12:52   ` Eric Auger
2025-03-11 14:10 ` [RFC PATCH v2 10/20] hw/arm/smmuv3-accel: Support nested STE install/uninstall support Shameer Kolothum via
2025-03-25 18:08   ` Eric Auger
2025-03-25 19:33     ` Nicolin Chen
2025-03-11 14:10 ` [RFC PATCH v2 11/20] hw/arm/smmuv3-accel: Allocate a vDEVICE object for device Shameer Kolothum via
2025-03-18 23:30   ` Donald Dutile
2025-03-25 18:13   ` Eric Auger
2025-03-11 14:10 ` [RFC PATCH v2 12/20] hw/arm/smmuv3-accel: Return sysmem if stage-1 is bypassed Shameer Kolothum via
2025-03-25 18:47   ` Eric Auger
2025-03-11 14:10 ` [RFC PATCH v2 13/20] hw/arm/smmuv3-accel: Introduce helpers to batch and issue cache invalidations Shameer Kolothum via
2025-03-19  1:31   ` Donald Dutile
2025-03-19  9:48     ` Shameerali Kolothum Thodi via
2025-03-19 16:24       ` Donald Dutile
2025-03-19 16:48         ` Nicolin Chen
2025-03-26 13:38   ` Eric Auger
2025-03-26 19:16     ` Nicolin Chen
2025-03-27  7:46       ` Shameerali Kolothum Thodi via
2025-03-27  8:00       ` Eric Auger
2025-03-26 13:59   ` Eric Auger
2025-03-11 14:10 ` [RFC PATCH v2 14/20] hw/arm/smmuv3: Install nested ste for CFGI_STE Shameer Kolothum via
2025-03-26 13:39   ` Eric Auger
2025-03-11 14:10 ` [RFC PATCH v2 15/20] hw/arm/smmuv3: Forward invalidation commands to hw Shameer Kolothum via
2025-03-26 14:16   ` Eric Auger
2025-03-26 19:27     ` Nicolin Chen
2025-03-27  8:03       ` Eric Auger
2025-03-26 14:18   ` Eric Auger
2025-03-11 14:10 ` [RFC PATCH v2 16/20] hw/arm/smmuv3-accel: Read host SMMUv3 device info Shameer Kolothum via
2025-03-19  2:45   ` Donald Dutile
2025-03-26 14:57   ` Eric Auger
2025-03-11 14:10 ` [RFC PATCH v2 17/20] hw/arm/smmuv3: Check idr registers for STE_S1CDMAX and STE_S1STALLD Shameer Kolothum via
2025-03-26 17:18   ` Eric Auger
2025-03-26 19:46     ` Nicolin Chen
2025-03-27  7:54       ` Shameerali Kolothum Thodi via
2025-03-27  9:11         ` Eric Auger
2025-03-27 13:05     ` Jason Gunthorpe
2025-03-11 14:10 ` [RFC PATCH v2 18/20] hw/arm/smmu-common: Bypass emulated IOTLB for a accel SMMUv3 Shameer Kolothum via
2025-03-19  2:52   ` Donald Dutile
2025-03-26 17:40   ` Eric Auger
2025-03-26 19:57     ` Nicolin Chen
2025-03-11 14:10 ` [RFC PATCH v2 19/20] hw/arm/virt-acpi-build: Update IORT with multiple smmuv3-accel nodes Shameer Kolothum via
2025-03-26 18:14   ` Eric Auger
2025-03-26 18:50     ` Nicolin Chen
2025-03-27  9:26       ` Shameerali Kolothum Thodi via
2025-03-11 14:10 ` [RFC PATCH v2 20/20] hw/arm/smmuv3-accel: Enable smmuv3-accel creation Shameer Kolothum via
2025-03-19 16:40 ` [RFC PATCH v2 00/20] hw/arm/virt: Add support for user-creatable accelerated SMMUv3 Philippe Mathieu-Daudé
2025-03-19 17:13   ` Eric Auger
2025-03-25 14:42 ` Eric Auger
2025-03-25 15:43   ` Shameerali Kolothum Thodi via
2025-03-25 18:26     ` Nicolin Chen via
2025-03-25 18:52       ` Eric Auger

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=Z-F0F1-zpI4kvO-j@redhat.com \
    --to=berrange@redhat.com \
    --cc=ddutile@redhat.com \
    --cc=eric.auger@redhat.com \
    --cc=jgg@nvidia.com \
    --cc=jiangkunkun@huawei.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=linuxarm@huawei.com \
    --cc=mochs@nvidia.com \
    --cc=nathanc@nvidia.com \
    --cc=nicolinc@nvidia.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=shameerali.kolothum.thodi@huawei.com \
    --cc=smostafa@google.com \
    --cc=wangzhou1@hisilicon.com \
    --cc=zhangfei.gao@linaro.org \
    /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).