qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [PATCH v5 3/4] hw/arm/virt: Update SMMU v3 creation to support non P


From: Li, Chunming
Subject: RE: [PATCH v5 3/4] hw/arm/virt: Update SMMU v3 creation to support non PCI/PCIe device connection
Date: Wed, 1 Sep 2021 06:51:27 +0000


> -----Original Message-----
> From: Eric Auger [mailto:eric.auger@redhat.com]
> Sent: Tuesday, August 31, 2021 10:13 PM
> To: chunming; peter.maydell@linaro.org
> Cc: qemu-arm@nongnu.org; qemu-devel@nongnu.org; Wen, Jianxian; Liu,
> Renwei; Li, Chunming
> Subject: Re: [PATCH v5 3/4] hw/arm/virt: Update SMMU v3 creation to
> support non PCI/PCIe device connection
> 
> Hi Chunming,
> 
> On 8/25/21 10:08 AM, chunming wrote:
> > From: chunming <chunming.li@verisilicon.com>
> >
> >   . Add "smmuv3_sidmap" to set non PCI/PCIe devices SID value
> >   . Pass non PCI/PCIe devices SID value to SMMU v3 model creation
> >   . Store SMMU v3 device in virtual machine then non PCI/PCIe can get
> its memory region later
> >
> > Signed-off-by: chunming <chunming.li@verisilicon.com>
> > ---
> >  hw/arm/virt.c         | 18 +++++++++++++++++-
> >  include/hw/arm/virt.h |  2 ++
> >  2 files changed, 19 insertions(+), 1 deletion(-)
> >
> > diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> > index 81eda46b0b..c3fd30e071 100644
> > --- a/hw/arm/virt.c
> > +++ b/hw/arm/virt.c
> > @@ -204,6 +204,10 @@ static const char *valid_cpus[] = {
> >      ARM_CPU_TYPE_NAME("max"),
> >  };
> >
> > +static const uint16_t smmuv3_sidmap[] = {
> > +
> > +};
> > +
> >  static bool cpu_type_valid(const char *cpu)
> >  {
> >      int i;
> > @@ -1223,7 +1227,7 @@ static void create_pcie_irq_map(const
> MachineState *ms,
> >                             0x7           /* PCI irq */);
> >  }
> >
> > -static void create_smmu(const VirtMachineState *vms,
> > +static void create_smmu(VirtMachineState *vms,
> >                          PCIBus *bus)
> >  {
> >      char *node;
> > @@ -1244,6 +1248,16 @@ static void create_smmu(const VirtMachineState
> *vms,
> >
> >      object_property_set_link(OBJECT(dev), "primary-bus",
> OBJECT(bus),
> >                               &error_abort);
> > +
> > +    vms->smmuv3 = dev;
> > +
> > +    qdev_prop_set_uint32(dev, "len-sid-map",
> ARRAY_SIZE(smmuv3_sidmap));
> > +
> > +    for (i = 0; i < ARRAY_SIZE(smmuv3_sidmap); i++) {
> > +        g_autofree char *propname = g_strdup_printf("sid-map[%d]",
> i);
> > +        qdev_prop_set_uint16(dev, propname, smmuv3_sidmap[i]);
> > +    }
> > +
> >      sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
> >      sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
> >      for (i = 0; i < NUM_SMMU_IRQS; i++) {
> > @@ -2762,6 +2776,8 @@ static void virt_instance_init(Object *obj)
> >
> >      vms->irqmap = a15irqmap;
> >
> > +    vms->sidmap = smmuv3_sidmap;
> > +
> >      virt_flash_create(vms);
> >
> >      vms->oem_id = g_strndup(ACPI_BUILD_APPNAME6, 6);
> > diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
> > index 9661c46699..d3402a43dd 100644
> > --- a/include/hw/arm/virt.h
> > +++ b/include/hw/arm/virt.h
> > @@ -167,6 +167,8 @@ struct VirtMachineState {
> >      PCIBus *bus;
> >      char *oem_id;
> >      char *oem_table_id;
> > +    DeviceState *smmuv3;
> at this stage it is not obvious why you need the smmuv3 DeviceState in
> the VirtMachineState (there is no user). You may squash this change in
> subsequent patch instead

Got it. Move this change in subsequent patch instead in next version.

> 
> Thanks
> 
> Eric
> > +    const uint16_t *sidmap;
> >  };
> >
> >  #define VIRT_ECAM_ID(high) (high ? VIRT_HIGH_PCIE_ECAM :
> VIRT_PCIE_ECAM)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]