* [PATCH] hw/arm/virt: Check bypass iommu is not set for iommu-map DT property
@ 2025-06-02 11:46 Shameer Kolothum via
2025-06-02 21:05 ` Donald Dutile
2025-06-03 9:50 ` Eric Auger
0 siblings, 2 replies; 4+ messages in thread
From: Shameer Kolothum via @ 2025-06-02 11:46 UTC (permalink / raw)
To: qemu-arm, qemu-devel
Cc: eric.auger, peter.maydell, nicolinc, ddutile, linuxarm
default_bus_bypass_iommu tells us whether the bypass_iommu is set
for the default PCIe root bus. Make sure we check that before adding
the "iommu-map" DT property.
Fixes: 6d7a85483a06 ("hw/arm/virt: Add default_bus_bypass_iommu machine option")
Suggested-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
---
hw/arm/virt.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 9a6cd085a3..99fde5836c 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -1487,9 +1487,12 @@ static void create_virtio_iommu_dt_bindings(VirtMachineState *vms)
qemu_fdt_setprop_cell(ms->fdt, node, "phandle", vms->iommu_phandle);
g_free(node);
- qemu_fdt_setprop_cells(ms->fdt, vms->pciehb_nodename, "iommu-map",
- 0x0, vms->iommu_phandle, 0x0, bdf,
- bdf + 1, vms->iommu_phandle, bdf + 1, 0xffff - bdf);
+ if (!vms->default_bus_bypass_iommu) {
+ qemu_fdt_setprop_cells(ms->fdt, vms->pciehb_nodename, "iommu-map",
+ 0x0, vms->iommu_phandle, 0x0, bdf,
+ bdf + 1, vms->iommu_phandle, bdf + 1,
+ 0xffff - bdf);
+ }
}
static void create_pcie(VirtMachineState *vms)
@@ -1612,8 +1615,10 @@ static void create_pcie(VirtMachineState *vms)
switch (vms->iommu) {
case VIRT_IOMMU_SMMUV3:
create_smmu(vms, vms->bus);
- qemu_fdt_setprop_cells(ms->fdt, nodename, "iommu-map",
- 0x0, vms->iommu_phandle, 0x0, 0x10000);
+ if (!vms->default_bus_bypass_iommu) {
+ qemu_fdt_setprop_cells(ms->fdt, nodename, "iommu-map",
+ 0x0, vms->iommu_phandle, 0x0, 0x10000);
+ }
break;
default:
g_assert_not_reached();
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] hw/arm/virt: Check bypass iommu is not set for iommu-map DT property
2025-06-02 11:46 [PATCH] hw/arm/virt: Check bypass iommu is not set for iommu-map DT property Shameer Kolothum via
@ 2025-06-02 21:05 ` Donald Dutile
2025-06-03 9:50 ` Eric Auger
1 sibling, 0 replies; 4+ messages in thread
From: Donald Dutile @ 2025-06-02 21:05 UTC (permalink / raw)
To: Shameer Kolothum, qemu-arm, qemu-devel
Cc: eric.auger, peter.maydell, nicolinc, linuxarm
On 6/2/25 7:46 AM, Shameer Kolothum wrote:
> default_bus_bypass_iommu tells us whether the bypass_iommu is set
> for the default PCIe root bus. Make sure we check that before adding
> the "iommu-map" DT property.
>
> Fixes: 6d7a85483a06 ("hw/arm/virt: Add default_bus_bypass_iommu machine option")
> Suggested-by: Eric Auger <eric.auger@redhat.com>
> Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
> ---
> hw/arm/virt.c | 15 ++++++++++-----
> 1 file changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index 9a6cd085a3..99fde5836c 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -1487,9 +1487,12 @@ static void create_virtio_iommu_dt_bindings(VirtMachineState *vms)
> qemu_fdt_setprop_cell(ms->fdt, node, "phandle", vms->iommu_phandle);
> g_free(node);
>
> - qemu_fdt_setprop_cells(ms->fdt, vms->pciehb_nodename, "iommu-map",
> - 0x0, vms->iommu_phandle, 0x0, bdf,
> - bdf + 1, vms->iommu_phandle, bdf + 1, 0xffff - bdf);
> + if (!vms->default_bus_bypass_iommu) {
> + qemu_fdt_setprop_cells(ms->fdt, vms->pciehb_nodename, "iommu-map",
> + 0x0, vms->iommu_phandle, 0x0, bdf,
> + bdf + 1, vms->iommu_phandle, bdf + 1,
> + 0xffff - bdf);
> + }
> }
>
> static void create_pcie(VirtMachineState *vms)
> @@ -1612,8 +1615,10 @@ static void create_pcie(VirtMachineState *vms)
> switch (vms->iommu) {
> case VIRT_IOMMU_SMMUV3:
> create_smmu(vms, vms->bus);
> - qemu_fdt_setprop_cells(ms->fdt, nodename, "iommu-map",
> - 0x0, vms->iommu_phandle, 0x0, 0x10000);
> + if (!vms->default_bus_bypass_iommu) {
> + qemu_fdt_setprop_cells(ms->fdt, nodename, "iommu-map",
> + 0x0, vms->iommu_phandle, 0x0, 0x10000);
> + }
> break;
> default:
> g_assert_not_reached();
Reviewed-by: Donald Dutile <ddutile@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] hw/arm/virt: Check bypass iommu is not set for iommu-map DT property
2025-06-02 11:46 [PATCH] hw/arm/virt: Check bypass iommu is not set for iommu-map DT property Shameer Kolothum via
2025-06-02 21:05 ` Donald Dutile
@ 2025-06-03 9:50 ` Eric Auger
2025-06-09 13:47 ` Peter Maydell
1 sibling, 1 reply; 4+ messages in thread
From: Eric Auger @ 2025-06-03 9:50 UTC (permalink / raw)
To: Shameer Kolothum, qemu-arm, qemu-devel
Cc: peter.maydell, nicolinc, ddutile, linuxarm
Hi Shameer,
On 6/2/25 1:46 PM, Shameer Kolothum wrote:
> default_bus_bypass_iommu tells us whether the bypass_iommu is set
> for the default PCIe root bus. Make sure we check that before adding
> the "iommu-map" DT property.
>
> Fixes: 6d7a85483a06 ("hw/arm/virt: Add default_bus_bypass_iommu machine option")
> Suggested-by: Eric Auger <eric.auger@redhat.com>
> Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Thanks!
Eric
> ---
> hw/arm/virt.c | 15 ++++++++++-----
> 1 file changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index 9a6cd085a3..99fde5836c 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -1487,9 +1487,12 @@ static void create_virtio_iommu_dt_bindings(VirtMachineState *vms)
> qemu_fdt_setprop_cell(ms->fdt, node, "phandle", vms->iommu_phandle);
> g_free(node);
>
> - qemu_fdt_setprop_cells(ms->fdt, vms->pciehb_nodename, "iommu-map",
> - 0x0, vms->iommu_phandle, 0x0, bdf,
> - bdf + 1, vms->iommu_phandle, bdf + 1, 0xffff - bdf);
> + if (!vms->default_bus_bypass_iommu) {
> + qemu_fdt_setprop_cells(ms->fdt, vms->pciehb_nodename, "iommu-map",
> + 0x0, vms->iommu_phandle, 0x0, bdf,
> + bdf + 1, vms->iommu_phandle, bdf + 1,
> + 0xffff - bdf);
> + }
> }
>
> static void create_pcie(VirtMachineState *vms)
> @@ -1612,8 +1615,10 @@ static void create_pcie(VirtMachineState *vms)
> switch (vms->iommu) {
> case VIRT_IOMMU_SMMUV3:
> create_smmu(vms, vms->bus);
> - qemu_fdt_setprop_cells(ms->fdt, nodename, "iommu-map",
> - 0x0, vms->iommu_phandle, 0x0, 0x10000);
> + if (!vms->default_bus_bypass_iommu) {
> + qemu_fdt_setprop_cells(ms->fdt, nodename, "iommu-map",
> + 0x0, vms->iommu_phandle, 0x0, 0x10000);
> + }
> break;
> default:
> g_assert_not_reached();
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] hw/arm/virt: Check bypass iommu is not set for iommu-map DT property
2025-06-03 9:50 ` Eric Auger
@ 2025-06-09 13:47 ` Peter Maydell
0 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2025-06-09 13:47 UTC (permalink / raw)
To: eric.auger
Cc: Shameer Kolothum, qemu-arm, qemu-devel, nicolinc, ddutile,
linuxarm
On Tue, 3 Jun 2025 at 10:50, Eric Auger <eric.auger@redhat.com> wrote:
>
> Hi Shameer,
>
> On 6/2/25 1:46 PM, Shameer Kolothum wrote:
> > default_bus_bypass_iommu tells us whether the bypass_iommu is set
> > for the default PCIe root bus. Make sure we check that before adding
> > the "iommu-map" DT property.
> >
> > Fixes: 6d7a85483a06 ("hw/arm/virt: Add default_bus_bypass_iommu machine option")
> > Suggested-by: Eric Auger <eric.auger@redhat.com>
> > Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
> Reviewed-by: Eric Auger <eric.auger@redhat.com>
>
I guess we should cc stable as a bugfix?
Applied to target-arm.next, thanks.
-- PMM
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-06-09 13:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-02 11:46 [PATCH] hw/arm/virt: Check bypass iommu is not set for iommu-map DT property Shameer Kolothum via
2025-06-02 21:05 ` Donald Dutile
2025-06-03 9:50 ` Eric Auger
2025-06-09 13:47 ` Peter Maydell
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).