qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Shameerali Kolothum Thodi via <qemu-devel@nongnu.org>
To: "eric.auger@redhat.com" <eric.auger@redhat.com>,
	"qemu-arm@nongnu.org" <qemu-arm@nongnu.org>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: "peter.maydell@linaro.org" <peter.maydell@linaro.org>,
	"jgg@nvidia.com" <jgg@nvidia.com>,
	"nicolinc@nvidia.com" <nicolinc@nvidia.com>,
	"ddutile@redhat.com" <ddutile@redhat.com>,
	"berrange@redhat.com" <berrange@redhat.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: [PATCH v2 3/6] hw/arm/virt: Factor out common SMMUV3 dt bindings code
Date: Tue, 6 May 2025 09:19:36 +0000	[thread overview]
Message-ID: <e2e43104047e4294b3feab4726512e0a@huawei.com> (raw)
In-Reply-To: <fd53570b-7e2c-47db-9d31-93a9d2327f2f@redhat.com>



> -----Original Message-----
> From: Eric Auger <eric.auger@redhat.com>
> Sent: Monday, May 5, 2025 10:02 AM
> To: Shameerali Kolothum Thodi
> <shameerali.kolothum.thodi@huawei.com>; qemu-arm@nongnu.org;
> qemu-devel@nongnu.org
> Cc: peter.maydell@linaro.org; jgg@nvidia.com; nicolinc@nvidia.com;
> ddutile@redhat.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: [PATCH v2 3/6] hw/arm/virt: Factor out common SMMUV3 dt
> bindings code
> 
> Hi Shameer,
> 
> On 5/2/25 12:27 PM, Shameer Kolothum wrote:
> > No functional changes intended. This will be useful when we
> > add support for user-creatable smmuv3 device.
> >
> > Signed-off-by: Shameer Kolothum
> <shameerali.kolothum.thodi@huawei.com>
> > ---
> >  hw/arm/virt.c | 54 +++++++++++++++++++++++++++------------------------
> >  1 file changed, 29 insertions(+), 25 deletions(-)
> >
> > diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> > index dd355f4454..464e84ae67 100644
> > --- a/hw/arm/virt.c
> > +++ b/hw/arm/virt.c
> > @@ -1418,19 +1418,43 @@ static void create_pcie_irq_map(const
> MachineState *ms,
> >                             0x7           /* PCI irq */);
> >  }
> >
> > +static void create_smmuv3_dt_bindings(const VirtMachineState *vms,
> hwaddr base,
> > +                                      hwaddr size, int irq)
> > +{
> > +    char *node;
> > +    const char compat[] = "arm,smmu-v3";
> > +    const char irq_names[] = "eventq\0priq\0cmdq-sync\0gerror";
> > +    MachineState *ms = MACHINE(vms);
> > +
> > +    node = g_strdup_printf("/smmuv3@%" PRIx64, base);
> > +    qemu_fdt_add_subnode(ms->fdt, node);
> > +    qemu_fdt_setprop(ms->fdt, node, "compatible", compat,
> sizeof(compat));
> > +    qemu_fdt_setprop_sized_cells(ms->fdt, node, "reg", 2, base, 2, size);
> > +
> > +    qemu_fdt_setprop_cells(ms->fdt, node, "interrupts",
> > +            GIC_FDT_IRQ_TYPE_SPI, irq    , GIC_FDT_IRQ_FLAGS_EDGE_LO_HI,
> > +            GIC_FDT_IRQ_TYPE_SPI, irq + 1,
> GIC_FDT_IRQ_FLAGS_EDGE_LO_HI,
> > +            GIC_FDT_IRQ_TYPE_SPI, irq + 2,
> GIC_FDT_IRQ_FLAGS_EDGE_LO_HI,
> > +            GIC_FDT_IRQ_TYPE_SPI, irq + 3,
> GIC_FDT_IRQ_FLAGS_EDGE_LO_HI);
> > +
> > +    qemu_fdt_setprop(ms->fdt, node, "interrupt-names", irq_names,
> > +                     sizeof(irq_names));
> > +
> > +    qemu_fdt_setprop(ms->fdt, node, "dma-coherent", NULL, 0);
> > +    qemu_fdt_setprop_cell(ms->fdt, node, "#iommu-cells", 1);
> > +    qemu_fdt_setprop_cell(ms->fdt, node, "phandle", vms-
> >iommu_phandle);
> > +    g_free(node);
> > +}
> > +
> >  static void create_smmu(const VirtMachineState *vms,
> >                          PCIBus *bus)
> >  {
> >      VirtMachineClass *vmc = VIRT_MACHINE_GET_CLASS(vms);
> > -    char *node;
> > -    const char compat[] = "arm,smmu-v3";
> >      int irq =  vms->irqmap[VIRT_SMMU];
> >      int i;
> >      hwaddr base = vms->memmap[VIRT_SMMU].base;
> >      hwaddr size = vms->memmap[VIRT_SMMU].size;
> > -    const char irq_names[] = "eventq\0priq\0cmdq-sync\0gerror";
> >      DeviceState *dev;
> > -    MachineState *ms = MACHINE(vms);
> >
> >      if (vms->iommu != VIRT_IOMMU_SMMUV3 || !vms->iommu_phandle) {
> >          return;
> > @@ -1449,27 +1473,7 @@ static void create_smmu(const
> VirtMachineState *vms,
> >          sysbus_connect_irq(SYS_BUS_DEVICE(dev), i,
> >                             qdev_get_gpio_in(vms->gic, irq + i));
> >      }
> > -
> > -    node = g_strdup_printf("/smmuv3@%" PRIx64, base);
> > -    qemu_fdt_add_subnode(ms->fdt, node);
> > -    qemu_fdt_setprop(ms->fdt, node, "compatible", compat,
> sizeof(compat));
> > -    qemu_fdt_setprop_sized_cells(ms->fdt, node, "reg", 2, base, 2, size);
> > -
> > -    qemu_fdt_setprop_cells(ms->fdt, node, "interrupts",
> > -            GIC_FDT_IRQ_TYPE_SPI, irq    , GIC_FDT_IRQ_FLAGS_EDGE_LO_HI,
> > -            GIC_FDT_IRQ_TYPE_SPI, irq + 1, GIC_FDT_IRQ_FLAGS_EDGE_LO_HI,
> > -            GIC_FDT_IRQ_TYPE_SPI, irq + 2, GIC_FDT_IRQ_FLAGS_EDGE_LO_HI,
> > -            GIC_FDT_IRQ_TYPE_SPI, irq + 3,
> GIC_FDT_IRQ_FLAGS_EDGE_LO_HI);
> > -
> > -    qemu_fdt_setprop(ms->fdt, node, "interrupt-names", irq_names,
> > -                     sizeof(irq_names));
> > -
> > -    qemu_fdt_setprop(ms->fdt, node, "dma-coherent", NULL, 0);
> > -
> > -    qemu_fdt_setprop_cell(ms->fdt, node, "#iommu-cells", 1);
> > -
> > -    qemu_fdt_setprop_cell(ms->fdt, node, "phandle", vms-
> >iommu_phandle);
> > -    g_free(node);
> > +    create_smmuv3_dt_bindings(vms, base, size, irq);
> >  }
> >
> >  static void create_virtio_iommu_dt_bindings(VirtMachineState *vms)
> Reviewed-by: Eric Auger <eric.auger@redhat.com>
> 
> nothing to do with that patch but I just noticed we omitted to support the
> 
> bypass_iommu=true along with DT mode. I don't see the iommu-map
> property set accordingly.
> 
> Something to further consolidate?

Yes. It looks like currently the virt SMMUv3 DT code doesn't take care of
bypass_iommu=true case. I will add that check.

Thanks,
Shameer

  reply	other threads:[~2025-05-06  9:20 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-02 10:27 [PATCH v2 0/6] Add support for user creatable SMMUv3 device Shameer Kolothum via
2025-05-02 10:27 ` [PATCH v2 1/6] hw/arm/smmuv3: Add support to associate a PCIe RC Shameer Kolothum via
2025-05-02 17:22   ` Nicolin Chen
2025-05-06  8:14     ` Shameerali Kolothum Thodi via
2025-05-02 18:16   ` Donald Dutile
2025-05-05  8:19     ` Eric Auger
2025-05-06  9:07       ` Shameerali Kolothum Thodi via
2025-05-06  9:35         ` Eric Auger
2025-05-06  8:42     ` Shameerali Kolothum Thodi via
2025-05-06 11:47   ` Markus Armbruster
2025-05-06 12:20     ` Shameerali Kolothum Thodi via
2025-05-06 20:48     ` Donald Dutile
2025-05-07  7:17       ` Markus Armbruster
2025-05-07  8:50         ` Shameerali Kolothum Thodi via
2025-05-08 13:45           ` Donald Dutile
2025-05-08 13:57             ` Peter Maydell
2025-05-09  7:57               ` Markus Armbruster
2025-05-09  8:00               ` Shameerali Kolothum Thodi via
2025-05-09 10:37                 ` Peter Maydell
2025-05-09 10:46                   ` Daniel P. Berrangé
2025-05-09 11:43                     ` Peter Maydell
2025-05-22  7:39                       ` Shameerali Kolothum Thodi via
2025-05-16 20:53               ` Donald Dutile
2025-05-09  7:29             ` Shameerali Kolothum Thodi via
2025-05-09  8:14               ` Daniel P. Berrangé
2025-05-09  8:18                 ` Shameerali Kolothum Thodi via
2025-05-09  8:44                   ` Eric Auger
2025-05-02 10:27 ` [PATCH v2 2/6] hw/arm/virt-acpi-build: Update IORT for multiple smmuv3 devices Shameer Kolothum via
2025-05-02 17:13   ` Nicolin Chen
2025-05-02 18:18     ` Donald Dutile
2025-05-06  8:43       ` Shameerali Kolothum Thodi via
2025-05-06  8:00     ` Shameerali Kolothum Thodi via
2025-05-05  8:39   ` Eric Auger
2025-05-06  9:12     ` Shameerali Kolothum Thodi via
2025-05-02 10:27 ` [PATCH v2 3/6] hw/arm/virt: Factor out common SMMUV3 dt bindings code Shameer Kolothum via
2025-05-02 17:15   ` Nicolin Chen
2025-05-05  9:01   ` Eric Auger
2025-05-06  9:19     ` Shameerali Kolothum Thodi via [this message]
2025-05-02 10:27 ` [PATCH v2 4/6] hw/arm/virt: Add an SMMU_IO_LEN macro Shameer Kolothum via
2025-05-02 18:20   ` Donald Dutile
2025-05-05  9:03   ` Eric Auger
2025-05-02 10:27 ` [PATCH v2 5/6] hw/arm/virt: Add support for smmuv3 device Shameer Kolothum via
2025-05-02 17:54   ` Nicolin Chen
2025-05-06  8:36     ` Shameerali Kolothum Thodi via
2025-05-05 10:12   ` Eric Auger
2025-05-06  9:29     ` Shameerali Kolothum Thodi via
2025-05-02 10:27 ` [PATCH v2 6/6] hw/arm/smmuv3: Enable smmuv3 device creation Shameer Kolothum via
2025-05-02 18:00   ` Nicolin Chen
2025-05-05 10:13   ` Eric Auger
2025-05-02 18:11 ` [PATCH v2 0/6] Add support for user creatable SMMUv3 device Donald Dutile

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=e2e43104047e4294b3feab4726512e0a@huawei.com \
    --to=qemu-devel@nongnu.org \
    --cc=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=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).