[RFC PATCH v3 14/15] Read and validate host SMMUv3 feature bits

2025-07-14 Thread Shameer Kolothum via
From: Nicolin Chen Not all fields in the SMMU IDR registers are meaningful for userspace. Only the following fields can be used:   - IDR0: ST_LEVEL, TERM_MODEL, STALL_MODEL, TTENDIAN, CD2L, ASID16, TTF     - IDR1: SIDSIZE, SSIDSIZE     - IDR3: BBML, RIL     - IDR5: VAX, GRAN64K, GRAN16K, GRAN4K

[RFC PATCH v3 11/15] hw/pci/pci: Introduce optional get_msi_address_space() callback.

2025-07-14 Thread Shameer Kolothum via
On ARM, when a device is behind an IOMMU, its MSI doorbell address is subject to translation by the IOMMU. This behavior affects vfio-pci passthrough devices assigned to guests using an accelerated SMMUv3. In this setup, we configure the host SMMUv3 in nested mode, where VFIO sets up the Stage-2 (

[RFC PATCH v3 13/15] hw/arm/smmuv3: Forward invalidation commands to hw

2025-07-14 Thread Shameer Kolothum via
From: Nicolin Chen Use the provided smmuv3-accel helper functions to issue the invalidation commands to host SMMUv3. Signed-off-by: Nicolin Chen Signed-off-by: Shameer Kolothum --- hw/arm/smmuv3-internal.h | 11 +++ hw/arm/smmuv3.c | 28 2 files c

[RFC PATCH v3 05/15] hw/arm/smmuv3-accel: Introduce smmuv3 accel device

2025-07-14 Thread Shameer Kolothum via
Also setup specific PCIIOMMUOps for accel SMMUv3 as accel SMMUv3 will have different handling for those ops callbacks in subsequent patches. The "accel" property is not yet added, so users cannot set it at this point. It will be introduced in a subsequent patch once the necessary support is in pla

[RFC PATCH v3 04/15] hw/arm/smmu-common: Introduce smmu_iommu_ops_by_type() helper

2025-07-14 Thread Shameer Kolothum via
Allows to retrieve the PCIIOMMUOps based on the SMMU type. This will be useful when we add support for accelerated SMMUV3 in subsequent patches as that requires a different set of callbacks for iommu ops. No special handling is required for now and returns the default ops in base SMMU Class. No f

[RFC PATCH v3 03/15] hw/arm/smmu-common: Factor out common helper functions and export

2025-07-14 Thread Shameer Kolothum via
Subsequent patches for smmuv3 accel support will make use of this. Signed-off-by: Nicolin Chen Reviewed-by: Eric Auger Signed-off-by: Shameer Kolothum --- hw/arm/smmu-common.c | 48 ++-- include/hw/arm/smmu-common.h | 6 + 2 files changed, 36 insert

[RFC PATCH v3 00/15] hw/arm/virt: Add support for user-creatable accelerated SMMUv3

2025-07-14 Thread Shameer Kolothum via
Hi All, This patch series introduces initial support for a user-creatable, accelerated SMMUv3 device (-device arm-smmuv3,accel=on) in QEMU. This is based on the user-creatable SMMUv3 device series [0]. Why this is needed: On ARM, to enable vfio-pci pass-through devices in a VM, the host SMMUv3

[RFC PATCH v3 12/15] hw/arm/smmuv3-accel: Introduce helpers to batch and issue cache invalidations

2025-07-14 Thread Shameer Kolothum via
From: Nicolin Chen Helpers will batch the commands and issue at once to host SMMUv3. Signed-off-by: Nicolin Chen Signed-off-by: Shameer Kolothum --- hw/arm/smmuv3-accel.c| 65 hw/arm/smmuv3-accel.h| 16 ++ hw/arm/smmuv3-internal.h | 12

[RFC PATCH v3 15/15] hw/arm/smmu-common: Add accel property for SMMU dev

2025-07-14 Thread Shameer Kolothum via
Now user can set "accel=on". Have fun! Signed-off-by: Shameer Kolothum --- hw/arm/smmu-common.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c index 6a58f574d3..3e8783670a 100644 --- a/hw/arm/smmu-common.c +++ b/hw/arm/smmu-common.c @@ -1022,6 +10

[RFC PATCH v3 08/15] hw/arm/smmuv3-accel: Add set/unset_iommu_device callback

2025-07-14 Thread Shameer Kolothum via
From: Nicolin Chen Implement a set_iommu_device callback: -If found an existing viommu reuse that. (Devices behind the same physical SMMU should share an S2 HWPT) -Else, Allocate a viommu with the nested parent S2 hwpt allocated by VFIO. Allocate bypass and abort hwpt. -And add the

[RFC PATCH v3 09/15] hw/arm/smmuv3-accel: Support nested STE install/uninstall support

2025-07-14 Thread Shameer Kolothum via
From: Nicolin Chen Allocates a s1 HWPT for the Guest s1 stage and attaches that to the dev. This will be invoked when Guest issues SMMU_CMD_CFGI_STE/STE_RANGE. While at it, we are also exporting both smmu_find_ste() and smmuv3_flush_config() from smmuv3.c for use here. Signed-off-by: Nicolin Ch

[RFC PATCH v3 07/15] hw/arm/smmuv3: Implement get_viommu_cap() callback

2025-07-14 Thread Shameer Kolothum via
For accelerated SMMUv3, we need nested parent domain creation. Add the callback support so that VFIO can create a nested parent. Since 'accel=on' for SMMUv3 requires the guest SMMUv3 to be configured in Stage 1 mode, ensure that the 'stage' property is explicitly set to Stage 1. Signed-off-by: Sh

[RFC PATCH v3 10/15] hw/arm/smmuv3-accel: Allocate a vDEVICE object for device

2025-07-14 Thread Shameer Kolothum via
From: Nicolin Chen Allocate and associate a vDEVICE object for the Guest device with the vIOMMU. This will help the kernel to do the vSID --> sid translation whenever required (eg: device specific invalidations). Signed-off-by: Nicolin Chen Signed-off-by: Shameer Kolothum --- hw/arm/smmuv3-ac

[RFC PATCH v3 01/15] backends/iommufd: Introduce iommufd_backend_alloc_viommu

2025-07-14 Thread Shameer Kolothum via
From: Nicolin Chen Add a helper to allocate a viommu object. Signed-off-by: Nicolin Chen Reviewed-by: Eric Auger Signed-off-by: Shameer Kolothum --- backends/iommufd.c | 25 + backends/trace-events| 1 + include/system/iommufd.h | 4 3 files changed,

[RFC PATCH v3 06/15] hw/arm/smmuv3-accel: Restrict accelerated SMMUv3 to vfio-pci endpoints with iommufd

2025-07-14 Thread Shameer Kolothum via
Accelerated SMMUv3 is only useful when the device can take advantage of the host's SMMUv3 in nested mode. To keep things simple and correct, we only allow this feature for vfio-pci endpoint devices that use the iommufd backend. We also allow non-endpoint emulated devices like PCI bridges and root p

[RFC PATCH v3 02/15] backends/iommufd: Introduce iommufd_vdev_alloc

2025-07-14 Thread Shameer Kolothum via
From: Nicolin Chen Add a helper to allocate an iommufd device's virtual device (in the user space) per a viommu instance. Signed-off-by: Nicolin Chen Reviewed-by: Eric Auger Signed-off-by: Shameer Kolothum --- backends/iommufd.c | 26 ++ backends/trace-events

[PATCH v8 12/12] qtest/bios-tables-test: Update tables for smmuv3 tests

2025-07-11 Thread Shameer Kolothum via
For the legacy smmuv3 test case, generated IORT has a single SMMUv3 node, a Root Complex(RC) node and 1 ITS node. RC node features 4 ID mappings, of which 2 points to SMMU node and the remaining ones points to ITS. pcie.0 -> {SMMU0} -> {ITS} {RC} pcie.1 -> {SMMU0} -> {ITS} pcie.2

[PATCH v8 09/12] qemu-options.hx: Document the arm-smmuv3 device

2025-07-11 Thread Shameer Kolothum via
Now that arm,virt can have user-creatable smmuv3 devices, document it. Reviewed-by: Jonathan Cameron Reviewed-by: Eric Auger Tested-by: Eric Auger Signed-off-by: Shameer Kolothum --- qemu-options.hx | 7 +++ 1 file changed, 7 insertions(+) diff --git a/qemu-options.hx b/qemu-options.hx i

[PATCH v8 06/12] hw/arm/virt: Add an SMMU_IO_LEN macro

2025-07-11 Thread Shameer Kolothum via
From: Nicolin Chen This is useful as the subsequent support for new SMMUv3 dev will also use the same. Signed-off-by: Nicolin Chen Reviewed-by: Donald Dutile Reviewed-by: Eric Auger Tested-by: Nathan Chen Reviewed-by: Jonathan Cameron Tested-by: Eric Auger Signed-off-by: Shameer Kolothum

[PATCH v8 05/12] hw/arm/virt: Factor out common SMMUV3 dt bindings code

2025-07-11 Thread Shameer Kolothum via
No functional changes intended. This will be useful when we add support for user-creatable smmuv3 device. Reviewed-by: Nicolin Chen Reviewed-by: Eric Auger Tested-by: Nathan Chen Reviewed-by: Jonathan Cameron Tested-by: Eric Auger Signed-off-by: Shameer Kolothum --- hw/arm/virt.c | 54 +

[PATCH v8 11/12] qtest/bios-tables-test: Add tests for legacy smmuv3 and smmuv3 device

2025-07-11 Thread Shameer Kolothum via
For the legacy SMMUv3 test, the setup includes three PCIe Root Complexes, one of which has bypass_iommu enabled. The generated IORT table contains a single SMMUv3 node, a Root Complex(RC) node and 1 ITS node. RC node features 4 ID mappings, of which 2 points to SMMU node and the remaining ones poin

[PATCH v8 03/12] hw/arm/virt-acpi-build: Re-arrange SMMUv3 IORT build

2025-07-11 Thread Shameer Kolothum via
Introduce a new struct AcpiIortSMMUv3Dev to hold all the information required for SMMUv3 IORT node and use that for populating the node. The current machine wide SMMUv3 is named as legacy SMMUv3 as we will soon add support for user-creatable SMMUv3 devices. These changes will be useful to have com

[PATCH v8 10/12] bios-tables-test: Allow for smmuv3 test data.

2025-07-11 Thread Shameer Kolothum via
The tests to be added exercise both legacy(iommu=smmuv3) and new -device arm-smmuv3,.. cases. Reviewed-by: Jonathan Cameron Reviewed-by: Eric Auger Tested-by: Eric Auger Signed-off-by: Shameer Kolothum --- tests/data/acpi/aarch64/virt/DSDT.smmuv3-dev| 0 tests/data/acpi/aarch64/virt/DSDT.

[PATCH v8 00/12] hw/arm/virt: Add support for user creatable SMMUv3 device

2025-07-11 Thread Shameer Kolothum via
Changes from v7: https://lore.kernel.org/qemu-devel/20250708154055.101012-1-shameerali.kolothum.th...@huawei.com/ 1. Rebased to latest target-arm.next(I have included patch#1 as I can't find that after a git pull of latest) 2. Addressed comments from Nicolin and added R-by tags. Thanks! Hi Pet

[PATCH v8 08/12] hw/arm/virt: Allow user-creatable SMMUv3 dev instantiation

2025-07-11 Thread Shameer Kolothum via
Allow cold-plugging of an SMMUv3 device on the virt machine when no global (legacy) SMMUv3 is present or when a virtio-iommu is specified. This user-created SMMUv3 device is tied to a specific PCI bus provided by the user, so ensure the IOMMU ops are configured accordingly. Due to current limitat

[PATCH v8 07/12] hw/pci: Introduce pci_setup_iommu_per_bus() for per-bus IOMMU ops retrieval

2025-07-11 Thread Shameer Kolothum via
Currently, pci_setup_iommu() registers IOMMU ops for a given PCIBus. However, when retrieving IOMMU ops for a device using pci_device_get_iommu_bus_devfn(), the function checks the parent_dev and fetches IOMMU ops from the parent device, even if the current bus does not have any associated IOMMU op

[PATCH v8 02/12] hw/arm/smmu-common: Check SMMU has PCIe Root Complex association

2025-07-11 Thread Shameer Kolothum via
We only allow default PCIe Root Complex(pcie.0) or pxb-pcie based extra root complexes to be associated with SMMU. Although this change does not affect functionality at present, it is required when we add support for user-creatable SMMUv3 devices in future patches. Note: Added a specific check to

[PATCH v8 04/12] hw/arm/virt-acpi-build: Update IORT for multiple smmuv3 devices

2025-07-11 Thread Shameer Kolothum via
With the soon to be introduced user-creatable SMMUv3 devices for virt, it is possible to have multiple SMMUv3 devices associated with different PCIe root complexes. Update IORT nodes accordingly. An example IORT Id mappings for a Qemu virt machine with two PCIe Root Complexes each assocaited with

[PATCH v8 01/12] hw/arm/virt-acpi-build: Don't create ITS id mappings by default

2025-07-11 Thread Shameer Kolothum via
Commit d6afe18b7242 ("hw/arm/virt-acpi-build: Fix ACPI IORT and MADT tables when its=off") moved ITS group node generation under the its=on condition. However, it still creates rc_its_idmaps unconditionally, which results in duplicate ID mappings in the IORT table. Fixes:d6afe18b7242 ("hw/arm/virt

[PATCH v7 08/12] hw/arm/virt: Allow user-creatable SMMUv3 dev instantiation

2025-07-08 Thread Shameer Kolothum via
Allow cold-plugging of an SMMUv3 device on the virt machine when no global (legacy) SMMUv3 is present or when a virtio-iommu is specified. This user-created SMMUv3 device is tied to a specific PCI bus provided by the user, so ensure the IOMMU ops are configured accordingly. Due to current limitat

[PATCH v7 10/12] bios-tables-test: Allow for smmuv3 test data.

2025-07-08 Thread Shameer Kolothum via
The tests to be added exercise both legacy(iommu=smmuv3) and new -device arm-smmuv3,.. cases. Reviewed-by: Jonathan Cameron Reviewed-by: Eric Auger Tested-by: Eric Auger Signed-off-by: Shameer Kolothum --- tests/data/acpi/aarch64/virt/DSDT.smmuv3-dev| 0 tests/data/acpi/aarch64/virt/DSDT.

[PATCH v7 02/12] hw/arm/smmu-common: Check SMMU has PCIe Root Complex association

2025-07-08 Thread Shameer Kolothum via
We only allow default PCIe Root Complex(pcie.0) or pxb-pcie based extra root complexes to be associated with SMMU. Although this change does not affect functionality at present, it is required when we add support for user-creatable SMMUv3 devices in future patches. Note: Added a specific check to

[PATCH v7 09/12] qemu-options.hx: Document the arm-smmuv3 device

2025-07-08 Thread Shameer Kolothum via
Now that arm,virt can have user-creatable smmuv3 devices, document it. Reviewed-by: Jonathan Cameron Reviewed-by: Eric Auger Tested-by: Eric Auger Signed-off-by: Shameer Kolothum --- qemu-options.hx | 7 +++ 1 file changed, 7 insertions(+) diff --git a/qemu-options.hx b/qemu-options.hx i

[PATCH v7 03/12] hw/arm/virt-acpi-build: Re-arrange SMMUv3 IORT build

2025-07-08 Thread Shameer Kolothum via
Introduce a new struct AcpiIortSMMUv3Dev to hold all the information required for SMMUv3 IORT node and use that for populating the node. The current machine wide SMMUv3 is named as legacy SMMUv3 as we will soon add support for user-creatable SMMUv3 devices. These changes will be useful to have com

[PATCH v7 11/12] qtest/bios-tables-test: Add tests for legacy smmuv3 and smmuv3 device

2025-07-08 Thread Shameer Kolothum via
For the legacy SMMUv3 test, the setup includes three PCIe Root Complexes, one of which has bypass_iommu enabled. The generated IORT table contains a single SMMUv3 node, a Root Complex(RC) node and 1 ITS node. RC node features 4 ID mappings, of which 2 points to SMMU node and the remaining ones poin

[PATCH v7 12/12] qtest/bios-tables-test: Update tables for smmuv3 tests

2025-07-08 Thread Shameer Kolothum via
For the legacy smmuv3 test case, generated IORT has a single SMMUv3 node, a Root Complex(RC) node and 1 ITS node. RC node features 4 ID mappings, of which 2 points to SMMU node and the remaining ones points to ITS. pcie.0 -> {SMMU0} -> {ITS} {RC} pcie.1 -> {SMMU0} -> {ITS} pcie.2

[PATCH v7 01/12] hw/arm/virt-acpi-build: Don't create ITS id mappings by default

2025-07-08 Thread Shameer Kolothum via
Commit d6afe18b7242 ("hw/arm/virt-acpi-build: Fix ACPI IORT and MADT tables when its=off") moved ITS group node generation under the its=on condition. However, it still creates rc_its_idmaps unconditionally, which results in duplicate ID mappings in the IORT table. Fixes:d6afe18b7242 ("hw/arm/virt

[PATCH v7 07/12] hw/pci: Introduce pci_setup_iommu_per_bus() for per-bus IOMMU ops retrieval

2025-07-08 Thread Shameer Kolothum via
Currently, pci_setup_iommu() registers IOMMU ops for a given PCIBus. However, when retrieving IOMMU ops for a device using pci_device_get_iommu_bus_devfn(), the function checks the parent_dev and fetches IOMMU ops from the parent device, even if the current bus does not have any associated IOMMU op

[PATCH v7 05/12] hw/arm/virt: Factor out common SMMUV3 dt bindings code

2025-07-08 Thread Shameer Kolothum via
No functional changes intended. This will be useful when we add support for user-creatable smmuv3 device. Reviewed-by: Nicolin Chen Reviewed-by: Eric Auger Tested-by: Nathan Chen Reviewed-by: Jonathan Cameron Tested-by: Eric Auger Signed-off-by: Shameer Kolothum --- hw/arm/virt.c | 54 +

[PATCH v7 06/12] hw/arm/virt: Add an SMMU_IO_LEN macro

2025-07-08 Thread Shameer Kolothum via
From: Nicolin Chen This is useful as the subsequent support for new SMMUv3 dev will also use the same. Signed-off-by: Nicolin Chen Reviewed-by: Donald Dutile Reviewed-by: Eric Auger Tested-by: Nathan Chen Reviewed-by: Jonathan Cameron Tested-by: Eric Auger Signed-off-by: Shameer Kolothum

[PATCH v7 00/12] hw/arm/virt: Add support for user creatable SMMUv3 device

2025-07-08 Thread Shameer Kolothum via
Hi All, Changes from v6: https://lore.kernel.org/qemu-devel/20250703084643.85740-1-shameerali.kolothum.th...@huawei.com/ 1. Fixed the warning case for DT support, reported by Eric(patch #8). 2. Picked up R-by's and T-by's. Thanks! Please take a look and let me know. I think this is in a good sha

[PATCH v7 04/12] hw/arm/virt-acpi-build: Update IORT for multiple smmuv3 devices

2025-07-08 Thread Shameer Kolothum via
With the soon to be introduced user-creatable SMMUv3 devices for virt, it is possible to have multiple SMMUv3 devices associated with different PCIe root complexes. Update IORT nodes accordingly. An example IORT Id mappings for a Qemu virt machine with two PCIe Root Complexes each assocaited with

[PATCH v6 04/12] hw/arm/virt-acpi-build: Update IORT for multiple smmuv3 devices

2025-07-03 Thread Shameer Kolothum via
With the soon to be introduced user-creatable SMMUv3 devices for virt, it is possible to have multiple SMMUv3 devices associated with different PCIe root complexes. Update IORT nodes accordingly. An example IORT Id mappings for a Qemu virt machine with two PCIe Root Complexes each assocaited with

[PATCH v6 09/12] qemu-options.hx: Document the arm-smmuv3 device

2025-07-03 Thread Shameer Kolothum via
Now that arm,virt can have user-creatable smmuv3 devices, document it. Reviewed-by: Jonathan Cameron Reviewed-by: Eric Auger Signed-off-by: Shameer Kolothum --- qemu-options.hx | 7 +++ 1 file changed, 7 insertions(+) diff --git a/qemu-options.hx b/qemu-options.hx index 1f862b19a6..17d517

[PATCH v6 12/12] qtest/bios-tables-test: Update tables for smmuv3 tests

2025-07-03 Thread Shameer Kolothum via
For the legacy smmuv3 test case, generated IORT has a single SMMUv3 node, a Root Complex(RC) node and 1 ITS node. RC node features 4 ID mappings, of which 2 points to SMMU node and the remaining ones points to ITS. pcie.0 -> {SMMU0} -> {ITS} {RC} pcie.1 -> {SMMU0} -> {ITS} pcie.2

[PATCH v6 06/12] hw/arm/virt: Add an SMMU_IO_LEN macro

2025-07-03 Thread Shameer Kolothum via
From: Nicolin Chen This is useful as the subsequent support for new SMMUv3 dev will also use the same. Signed-off-by: Nicolin Chen Reviewed-by: Donald Dutile Reviewed-by: Eric Auger Tested-by: Nathan Chen Reviewed-by: Jonathan Cameron Signed-off-by: Shameer Kolothum --- hw/arm/virt.c | 5

[PATCH v6 11/12] qtest/bios-tables-test: Add tests for legacy smmuv3 and smmuv3 device

2025-07-03 Thread Shameer Kolothum via
For the legacy SMMUv3 test, the setup includes three PCIe Root Complexes, one of which has bypass_iommu enabled. The generated IORT table contains a single SMMUv3 node, a Root Complex(RC) node and 1 ITS node. RC node features 4 ID mappings, of which 2 points to SMMU node and the remaining ones poin

[PATCH v6 03/12] hw/arm/virt-acpi-build: Re-arrange SMMUv3 IORT build

2025-07-03 Thread Shameer Kolothum via
Introduce a new struct AcpiIortSMMUv3Dev to hold all the information required for SMMUv3 IORT node and use that for populating the node. The current machine wide SMMUv3 is named as legacy SMMUv3 as we will soon add support for user-creatable SMMUv3 devices. These changes will be useful to have com

[PATCH v6 07/12] hw/pci: Introduce pci_setup_iommu_per_bus() for per-bus IOMMU ops retrieval

2025-07-03 Thread Shameer Kolothum via
Currently, pci_setup_iommu() registers IOMMU ops for a given PCIBus. However, when retrieving IOMMU ops for a device using pci_device_get_iommu_bus_devfn(), the function checks the parent_dev and fetches IOMMU ops from the parent device, even if the current bus does not have any associated IOMMU op

[PATCH v6 08/12] hw/arm/virt: Allow user-creatable SMMUv3 dev instantiation

2025-07-03 Thread Shameer Kolothum via
Allow cold-plugging of an SMMUv3 device on the virt machine when no global (legacy) SMMUv3 is present or when a virtio-iommu is specified. This user-created SMMUv3 device is tied to a specific PCI bus provided by the user, so ensure the IOMMU ops are configured accordingly. Due to current limitat

[PATCH v6 10/12] bios-tables-test: Allow for smmuv3 test data.

2025-07-03 Thread Shameer Kolothum via
The tests to be added exercise both legacy(iommu=smmuv3) and new -device arm-smmuv3,.. cases. Reviewed-by: Jonathan Cameron Reviewed-by: Eric Auger Signed-off-by: Shameer Kolothum --- tests/data/acpi/aarch64/virt/DSDT.smmuv3-dev| 0 tests/data/acpi/aarch64/virt/DSDT.smmuv3-legacy | 0 test

[PATCH v6 05/12] hw/arm/virt: Factor out common SMMUV3 dt bindings code

2025-07-03 Thread Shameer Kolothum via
No functional changes intended. This will be useful when we add support for user-creatable smmuv3 device. Reviewed-by: Nicolin Chen Reviewed-by: Eric Auger Tested-by: Nathan Chen Reviewed-by: Jonathan Cameron Signed-off-by: Shameer Kolothum --- hw/arm/virt.c | 54 +++-

[PATCH v6 02/12] hw/arm/smmu-common: Check SMMU has PCIe Root Complex association

2025-07-03 Thread Shameer Kolothum via
We only allow default PCIe Root Complex(pcie.0) or pxb-pcie based extra root complexes to be associated with SMMU. Although this change does not affect functionality at present, it is required when we add support for user-creatable SMMUv3 devices in future patches. Note: Added a specific check to

[PATCH v6 00/12] hw/arm/virt: Add support for user creatable SMMUv3 device

2025-07-03 Thread Shameer Kolothum via
Hi All, Changes from v5: https://lore.kernel.org/qemu-devel/20250623094230.76084-1-shameerali.kolothum.th...@huawei.com/ 1. Rebased to target-arm.next and resolved conflicts with the series [PATCH-for-10.1 v6 0/9] hw/arm: GIC 'its=off'. 2. While at it, noticed an issue with RC id mappings cre

[PATCH v6 01/12] hw/arm/virt-acpi-build: Don't create ITS id mappings by default

2025-07-03 Thread Shameer Kolothum via
Commit d6afe18b7242 ("hw/arm/virt-acpi-build: Fix ACPI IORT and MADT tables when its=off") moved ITS group node generation under the its=on condition. However, it still creates rc_its_idmaps unconditionally, which results in duplicate ID mappings in the IORT table. Fixes:d6afe18b7242 ("hw/arm/virt

[PATCH v5 03/11] hw/arm/virt-acpi-build: Update IORT for multiple smmuv3 devices

2025-06-23 Thread Shameer Kolothum via
With the soon to be introduced user-creatable SMMUv3 devices for virt, it is possible to have multiple SMMUv3 devices associated with different PCIe root complexes. Update IORT nodes accordingly. An example IORT Id mappings for a Qemu virt machine with two PCIe Root Complexes each assocaited with

[PATCH v5 01/11] hw/arm/smmu-common: Check SMMU has PCIe Root Complex association

2025-06-23 Thread Shameer Kolothum via
We only allow default PCIe Root Complex(pcie.0) or pxb-pcie based extra root complexes to be associated with SMMU. Although this change does not affect functionality at present, it is required when we add support for user-creatable SMMUv3 devices in future patches. Signed-off-by: Shameer Kolothum

[PATCH v5 02/11] hw/arm/virt-acpi-build: Re-arrange SMMUv3 IORT build

2025-06-23 Thread Shameer Kolothum via
Introduce a new struct AcpiIortSMMUv3Dev to hold all the information required for SMMUv3 IORT node and use that for populating the node. The current machine wide SMMUv3 is named as legacy SMMUv3 as we will soon add support for user-creatable SMMUv3 devices. These changes will be useful to have com

[PATCH v5 11/11] qtest/bios-tables-test: Update tables for smmuv3 tests

2025-06-23 Thread Shameer Kolothum via
For the legacy smmuv3 test case, IORT has a single SMMUV3 node and a Root Complex node with three ID mappings of which two points to the SMMUv3 node and the remaining one points to ITS. ... [030h 0048 1] Type : 00 [031h 0049 2] Length : 0018 [033h

[PATCH v5 04/11] hw/arm/virt: Factor out common SMMUV3 dt bindings code

2025-06-23 Thread Shameer Kolothum via
No functional changes intended. This will be useful when we add support for user-creatable smmuv3 device. Reviewed-by: Nicolin Chen Reviewed-by: Eric Auger Tested-by: Nathan Chen Reviewed-by: Jonathan Cameron Signed-off-by: Shameer Kolothum --- hw/arm/virt.c | 54 +++-

[PATCH v5 10/11] qtest/bios-tables-test: Add tests for legacy smmuv3 and smmuv3 device

2025-06-23 Thread Shameer Kolothum via
For the legacy SMMUv3 test, the setup includes three PCIe Root Complexes, one of which has bypass_iommu enabled. The generated IORT table contains a single SMMUv3 node and a Root Complex node with three ID mappings. Two of these ID mappings have output references pointing to the SMMUv3 node and the

[PATCH v5 09/11] bios-tables-test: Allow for smmuv3 test data.

2025-06-23 Thread Shameer Kolothum via
The tests to be added exercises both legacy(iommu=smmuv3) and new -device arm-smmuv3,.. cases. Signed-off-by: Shameer Kolothum --- tests/data/acpi/aarch64/virt/DSDT.smmuv3-dev| 0 tests/data/acpi/aarch64/virt/DSDT.smmuv3-legacy | 0 tests/data/acpi/aarch64/virt/IORT.smmuv3-dev| 0 tests/

[PATCH v5 08/11] qemu-options.hx: Document the arm-smmuv3 device

2025-06-23 Thread Shameer Kolothum via
Now that arm,virt can have user-creatable smmuv3 devices, document it. Signed-off-by: Shameer Kolothum --- qemu-options.hx | 7 +++ 1 file changed, 7 insertions(+) diff --git a/qemu-options.hx b/qemu-options.hx index 7eb8e02b4b..7d1a12f7ef 100644 --- a/qemu-options.hx +++ b/qemu-options.hx

[PATCH v5 06/11] hw/pci: Introduce pci_setup_iommu_per_bus() for per-bus IOMMU ops retrieval

2025-06-23 Thread Shameer Kolothum via
Currently, pci_setup_iommu() registers IOMMU ops for a given PCIBus. However, when retrieving IOMMU ops for a device using pci_device_get_iommu_bus_devfn(), the function checks the parent_dev and fetches IOMMU ops from the parent device, even if the current bus does not have any associated IOMMU op

[PATCH v5 05/11] hw/arm/virt: Add an SMMU_IO_LEN macro

2025-06-23 Thread Shameer Kolothum via
From: Nicolin Chen This is useful as the subsequent support for new SMMUv3 dev will also use the same. Signed-off-by: Nicolin Chen Reviewed-by: Donald Dutile Reviewed-by: Eric Auger Tested-by: Nathan Chen Signed-off-by: Shameer Kolothum --- hw/arm/virt.c | 5 - 1 file changed, 4 insert

[PATCH v5 07/11] hw/arm/virt: Allow user-creatable SMMUv3 dev instantiation

2025-06-23 Thread Shameer Kolothum via
Allow cold-plugging of an SMMUv3 device on the virt machine when no global (legacy) SMMUv3 is present or when a virtio-iommu is specified. This user-created SMMUv3 device is tied to a specific PCI bus provided by the user, so ensure the IOMMU ops are configured accordingly. Due to current limitat

[PATCH v5 00/11] hw/arm/virt: Add support for user creatable SMMUv3 device

2025-06-23 Thread Shameer Kolothum via
Hi All, Changes from v4: https://lore.kernel.org/qemu-devel/2025061319.60156-1-shameerali.kolothum.th...@huawei.com/ Major changes from v4: 1. Added stricter validation for PCI buses associated with the SMMU. Only the default PCIe Root Complex (pcie.0) and additional root complexes cre

[PATCH v4 7/7] qemu-options.hx: Document the arm-smmuv3 device

2025-06-13 Thread Shameer Kolothum via
Now that arm,virt can have user-creatable smmuv3 devices, document it. Signed-off-by: Shameer Kolothum --- qemu-options.hx | 6 ++ 1 file changed, 6 insertions(+) diff --git a/qemu-options.hx b/qemu-options.hx index 7eb8e02b4b..3edbde45bb 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @

[PATCH v4 0/7] hw/arm/virt: Add support for user creatable SMMUv3 device

2025-06-13 Thread Shameer Kolothum via
Hi All, Changes from v3: https://lore.kernel.org/qemu-devel/20250602154110.48392-1-shameerali.kolothum.th...@huawei.com/ Addressed feedback on v3. Thanks to all. Major changes: 1. Based on Igor's suggestion, moved the associated primary-bus is of type TYPE_PCI_HOST_BRIDGE check to smmu-common.

[PATCH v4 6/7] hw/arm/virt: Allow user-creatable SMMUv3 dev instantiation

2025-06-13 Thread Shameer Kolothum via
Allow cold-plug of smmuv3 device to virt if there is no machine wide legacy smmuv3 or a virtio-iommu is specified. Device tree support for new smmuv3 dev is limited to the case where it is associated with the default pcie.0 RC. Tested-by: Nathan Chen Signed-off-by: Shameer Kolothum --- hw/arm/

[PATCH v4 1/7] hw/arm/smmu-common: Check SMMU has PCIe Root Complex association

2025-06-13 Thread Shameer Kolothum via
Although this change does not affect functionality at present, it is required when we add support for user-creatable SMMUv3 devices in future patches. Tested-by: Nathan Chen Signed-off-by: Shameer Kolothum --- hw/arm/smmu-common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff -

[PATCH v4 3/7] hw/arm/virt-acpi-build: Update IORT for multiple smmuv3 devices

2025-06-13 Thread Shameer Kolothum via
With the soon to be introduced user-creatable SMMUv3 devices for virt, it is possible to have multiple SMMUv3 devices associated with different PCIe root complexes. Update IORT nodes accordingly. An example IORT Id mappings for a Qemu virt machine with two PCIe Root Complexes each assocaited with

[PATCH v4 2/7] hw/arm/virt-acpi-build: Re-arrange SMMUv3 IORT build

2025-06-13 Thread Shameer Kolothum via
Introduces a new struct AcpiIortSMMUv3Dev to hold all the information required for SMMUv3 IORT node and use that for populating the node. The current machine wide SMMUv3 is named as legacy SMMUv3 as we will soon add support for user-creatable SMMUv3 devices. These changes will be useful to have co

[PATCH v4 4/7] hw/arm/virt: Factor out common SMMUV3 dt bindings code

2025-06-13 Thread Shameer Kolothum via
No functional changes intended. This will be useful when we add support for user-creatable smmuv3 device. Reviewed-by: Nicolin Chen Reviewed-by: Eric Auger Tested-by: Nathan Chen Signed-off-by: Shameer Kolothum --- hw/arm/virt.c | 54 +++ 1 file

[PATCH v4 5/7] hw/arm/virt: Add an SMMU_IO_LEN macro

2025-06-13 Thread Shameer Kolothum via
From: Nicolin Chen This is useful as the subsequent support for new SMMUv3 dev will also use the same. Signed-off-by: Nicolin Chen Reviewed-by: Donald Dutile Reviewed-by: Eric Auger Tested-by: Nathan Chen Signed-off-by: Shameer Kolothum --- hw/arm/virt.c | 8 +--- 1 file changed, 5 ins

[PATCH v3 6/6] hw/arm/virt: Allow user-creatable SMMUv3 dev instantiation

2025-06-02 Thread Shameer Kolothum via
Allow cold-plug of smmuv3 device to virt if there is no machine wide legacy smmuv3 or a virtio-iommu is specified. Device tree support for new smmuv3 dev is limited to the case where it is associated with the default pcie.0 RC. Signed-off-by: Shameer Kolothum --- hw/arm/smmuv3.c | 2 ++ h

[PATCH v3 1/6] hw/arm/smmuv3: Check SMMUv3 has PCIe Root Complex association

2025-06-02 Thread Shameer Kolothum via
Although this change does not affect functionality at present, it is required when we add support for user-creatable SMMUv3 devices in future patches. Signed-off-by: Shameer Kolothum --- hw/arm/smmuv3.c | 8 1 file changed, 8 insertions(+) diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c

[PATCH v3 2/6] hw/arm/virt-acpi-build: Re-arrange SMMUv3 IORT build

2025-06-02 Thread Shameer Kolothum via
Introduces a new struct AcpiIortSMMUv3Dev to hold all the information required for SMMUv3 IORT node and use that for populating the node. The current machine wide SMMUv3 is named as legacy SMMUv3 as we will soon add support for user-creatable SMMUv3 devices. These changes will be useful to have co

[PATCH v3 4/6] hw/arm/virt: Factor out common SMMUV3 dt bindings code

2025-06-02 Thread Shameer Kolothum via
No functional changes intended. This will be useful when we add support for user-creatable smmuv3 device. Reviewed-by: Nicolin Chen Reviewed-by: Eric Auger Signed-off-by: Shameer Kolothum --- hw/arm/virt.c | 54 +++ 1 file changed, 29 insertions(

[PATCH v3 5/6] hw/arm/virt: Add an SMMU_IO_LEN macro

2025-06-02 Thread Shameer Kolothum via
From: Nicolin Chen This is useful as the subsequent support for new SMMUv3 dev will also use the same. Signed-off-by: Nicolin Chen Reviewed-by: Donald Dutile Reviewed-by: Eric Auger Signed-off-by: Shameer Kolothum --- hw/arm/virt.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(

[PATCH v3 3/6] hw/arm/virt-acpi-build: Update IORT for multiple smmuv3 devices

2025-06-02 Thread Shameer Kolothum via
With the soon to be introduced user-creatable SMMUv3 devices for virt, it is possible to have multiple SMMUv3 devices associated with different PCIe root complexes. Update IORT nodes accordingly. Signed-off-by: Shameer Kolothum --- hw/arm/virt-acpi-build.c | 54 +

[PATCH v3 0/6] hw/arm/virt: Add support for user creatable SMMUv3 device

2025-06-02 Thread Shameer Kolothum via
Hi All, Changes from v2: https://lore.kernel.org/qemu-devel/20250502102707.110516-1-shameerali.kolothum.th...@huawei.com/ Addressed feedback on v2. Thanks to all. Major changes: 1. Not use the default "bus" property for associated PCIe RC. Instead use "primary-bus". 2. Split of IORT ACPI chang

[PATCH] hw/arm/virt: Check bypass iommu is not set for iommu-map DT property

2025-06-02 Thread Shameer Kolothum via
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 Signed-off-by: Shameer Kolo

[PATCH v2 3/6] hw/arm/virt: Factor out common SMMUV3 dt bindings code

2025-05-02 Thread Shameer Kolothum via
No functional changes intended. This will be useful when we add support for user-creatable smmuv3 device. Signed-off-by: Shameer Kolothum --- hw/arm/virt.c | 54 +++ 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/hw/arm/virt.c b/hw

[PATCH v2 2/6] hw/arm/virt-acpi-build: Update IORT for multiple smmuv3 devices

2025-05-02 Thread Shameer Kolothum via
With the soon to be introduced user-creatable SMMUv3 devices for virt, it is possible to have multiple SMMUv3 devices associated with different PCIe root complexes. Update IORT nodes accordingly. Signed-off-by: Shameer Kolothum --- hw/arm/virt-acpi-build.c | 162 +++-

[PATCH v2 6/6] hw/arm/smmuv3: Enable smmuv3 device creation

2025-05-02 Thread Shameer Kolothum via
Signed-off-by: Shameer Kolothum --- hw/arm/smmuv3.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c index 605de9b721..e13950b7c5 100644 --- a/hw/arm/smmuv3.c +++ b/hw/arm/smmuv3.c @@ -2022,6 +2022,7 @@ static void smmuv3_class_init(ObjectClass *klass, const

[PATCH v2 1/6] hw/arm/smmuv3: Add support to associate a PCIe RC

2025-05-02 Thread Shameer Kolothum via
Although this change does not affect functionality at present, it lays the groundwork for enabling user-created SMMUv3 devices in future patches Signed-off-by: Shameer Kolothum --- hw/arm/smmuv3.c | 26 ++ hw/arm/virt.c | 3 ++- 2 files changed, 28 insertions(+), 1 del

[PATCH v2 4/6] hw/arm/virt: Add an SMMU_IO_LEN macro

2025-05-02 Thread Shameer Kolothum via
From: Nicolin Chen This is useful as the subsequent support for new SMMUv3 dev will also use the same. Signed-off-by: Nicolin Chen Signed-off-by: Shameer Kolothum --- hw/arm/virt.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index

[PATCH v2 5/6] hw/arm/virt: Add support for smmuv3 device

2025-05-02 Thread Shameer Kolothum via
Allow cold-plug of smmuv3 device to virt if there is no machine wide legacy smmuv3 or a virtio-iommu is specified. Device tree support for new smmuv3 dev is limited to the case where it is associated with the default pcie.0 RC. Signed-off-by: Shameer Kolothum --- hw/arm/virt.c| 48 +

[PATCH v2 0/6] Add support for user creatable SMMUv3 device

2025-05-02 Thread Shameer Kolothum via
Hi All, Changes from v1: https://lore.kernel.org/qemu-devel/20250415081104.71708-1-shameerali.kolothum.th...@huawei.com/ Addressed feedback on v1. Thanks to all. 1. Retained the same name as the legacy SMMUv3(arm-smmuv3) for new device type as well (instead of arm-smmuv3-dev type usage in v1).

[PATCH 4/5] hw/arm/virt: Add support for smmuv3 device

2025-04-15 Thread Shameer Kolothum via
Allow cold-plug of smmuv3 device to virt If the machine wide smmuv3 or a virtio-iommu is not specified. Also restrict the usage if virt <= 9.2. This will prevent accidently creating a SMMUv3 device on machines prior to 9.2 and cause failure on migrating to machines with same version but has a lega

[PATCH 5/5] hw/arm/smmuv3: Enable smmuv3 device creation

2025-04-15 Thread Shameer Kolothum via
Signed-off-by: Shameer Kolothum --- hw/arm/smmuv3.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c index e3b8e13ca3..572119e472 100644 --- a/hw/arm/smmuv3.c +++ b/hw/arm/smmuv3.c @@ -2026,6 +2026,7 @@ static void smmuv3_dev_class_init(ObjectClass *klass, vo

[PATCH 2/5] hw/arm/virt-acpi-build: Update IORT for multiple smmuv3 devices

2025-04-15 Thread Shameer Kolothum via
With the soon to be introduced user-creatable SMMUv3 devices for virt, it is possible to have multiple SMMUv3 devices associated with different PCIe root complexes. Update IORT nodes accordingly. Signed-off-by: Shameer Kolothum --- hw/arm/virt-acpi-build.c | 119

[PATCH 0/5] Add support for user creatable SMMUv3 device

2025-04-15 Thread Shameer Kolothum via
Hi All, This patch series introduces support for a user-creatable SMMUv3 device (-device arm-smmuv3-dev) in QEMU. The implementation is based on feedback received from the RFCv2[0]: "hw/arm/virt: Add support for user-creatable accelerated SMMUv3" Currently, QEMU's SMMUv3 emulation (iommu=smmuv3)

[PATCH 1/5] hw/arm/smmuv3: Introduce SMMUv3 device

2025-04-15 Thread Shameer Kolothum via
Initial support to have a user-creatable SMMUv3 device associated with a PCIe root complex, -device arm-smmuv3-dev,bus=pcie.x Signed-off-by: Shameer Kolothum --- hw/arm/smmuv3.c | 54 + include/hw/arm/smmuv3.h | 16 2 files changed, 7

[PATCH 3/5] hw/arm/virt: Factor out common SMMUV3 dt bindings code

2025-04-15 Thread Shameer Kolothum via
No functional changes intended. This will be useful when we add support for user-creatable smmuv3 device. Signed-off-by: Shameer Kolothum --- hw/arm/virt.c | 55 +++ 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/hw/arm/virt.c b/hw

[RFC PATCH v2 03/20] hw/arm/smmuv3-accel: Add initial infrastructure for smmuv3-accel device

2025-03-11 Thread Shameer Kolothum via
Based on SMMUv3 as a parent device, add a user-creatable smmuv3-accel device. In order to support vfio-pci dev assignment with a Guest SMMUv3, the physical SMMUv3 has to be configured in nested(S1+s2) mode, with Guest owning the S1 page tables. Subsequent patches will add support for smmuv3-accel t

[RFC PATCH v2 20/20] hw/arm/smmuv3-accel: Enable smmuv3-accel creation

2025-03-11 Thread Shameer Kolothum via
Signed-off-by: Shameer Kolothum --- hw/arm/smmuv3-accel.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c index fb08e1d66b..812f8e358f 100644 --- a/hw/arm/smmuv3-accel.c +++ b/hw/arm/smmuv3-accel.c @@ -595,6 +595,7 @@ static void smmuv3_accel_clas

[RFC PATCH v2 14/20] hw/arm/smmuv3: Install nested ste for CFGI_STE

2025-03-11 Thread Shameer Kolothum via
Make use of smmuv3_accel provided _install_nested_ste() for CFGI_STE. Signed-off-by: Shameer Kolothum --- hw/arm/smmuv3.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c index ea63731d61..83159db1d4 100644 --- a/hw/arm/smmuv3.c +++ b/hw/arm/smmuv3.c @@ -12

[RFC PATCH v2 18/20] hw/arm/smmu-common: Bypass emulated IOTLB for a accel SMMUv3

2025-03-11 Thread Shameer Kolothum via
From: Nicolin Chen If a vSMMU is configured as a accelerated one, HW IOTLB will be used and all cache invalidation should be done to the HW IOTLB too, v.s. the emulated iotlb. In this case, an iommu notifier isn't registered, as the devices behind a SMMUv3-accel would stay in the system address s

  1   2   >