> -----Original Message-----
> From: Nicolin Chen <nicol...@nvidia.com>
> Sent: Friday, July 18, 2025 9:12 AM
> To: Shameerali Kolothum Thodi <shameerali.kolothum.th...@huawei.com>
> Cc: qemu-...@nongnu.org; qemu-devel@nongnu.org;
> eric.au...@redhat.com; peter.mayd...@linaro.org; j...@nvidia.com;
> ddut...@redhat.com; berra...@redhat.com; imamm...@redhat.com;
> nath...@nvidia.com; mo...@nvidia.com; smost...@google.com;
> gustavo.rom...@linaro.org; m...@redhat.com;
> marcel.apfelb...@gmail.com; Linuxarm <linux...@huawei.com>;
> Wangzhou (B) <wangzh...@hisilicon.com>; jiangkunkun
> <jiangkun...@huawei.com>; Jonathan Cameron
> <jonathan.came...@huawei.com>; zhangfei....@linaro.org
> Subject: Re: [PATCH v8 08/12] hw/arm/virt: Allow user-creatable SMMUv3
> dev instantiation
> 
> On Fri, Jul 18, 2025 at 08:01:22AM +0000, Shameerali Kolothum Thodi
> wrote:
> > > > +    int irq = platform_bus_get_irqn(pbus, sbdev, 0);
> > > > +    hwaddr base = platform_bus_get_mmio_addr(pbus, sbdev, 0);
> > > > +    MachineState *ms = MACHINE(vms);
> > > > +
> > > > +    if (!(vms->bootinfo.firmware_loaded &&
> virt_is_acpi_enabled(vms))
> > > &&
> > > > +        strcmp("pcie.0", bus->qbus.name)) {
> > > > +        warn_report("SMMUv3 device only supported with pcie.0 for
> DT");
> > > > +        return;
> > > > +    }
> > > > +    base += vms->memmap[VIRT_PLATFORM_BUS].base;
> > > > +    irq += vms->irqmap[VIRT_PLATFORM_BUS];
> > >
> > > The code is fine.
> > >
> > > Just a related question here:
> > >
> > > Do you know where we define the number of IRQs and the range of
> > > MMIO for the SysBusDevice?
> > >
> > > SMMU has four IRQs. And I see multiple vSMMU instances do have
> > > correct intervals to their IRQ numbers, but I cannot find where
> > > the magic is done.
> >
> > Look for,
> > #define PLATFORM_BUS_NUM_IRQS 64
> >
> > So in theory we could have around 16 vSMMU per VM. It depends on
> > other platform devices specified as well. Do you see a need for more
> > on a per VM basis? I know there are host systems with large number of
> > SMMUv3s, but how many a VM will get assigned realistically?
> 
> Hmm, I was asking how platform bus knows that SMMU only has four
> IRQs. But I think number of 16 might not be enough in some cases.
> 
> So, my question was: where do we set the number of 4 to the sbdev?
> As platform_bus_get_irqn() returned very correctly with 0, 4, 8,
> and so on..

See smmu_realize() --> smmu_init_irq()

And then in virt_machine_plug_cb() --> platform_bus_link_device()

Thanks,
Shameer

Reply via email to