All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v6 00/35] hw/arm/smmuv3: Support Secure state for SMMUv3
@ 2026-11-14 15:46 Tao Tang
  2026-11-14 16:05 ` [PATCH v6 27/35] hw/arm/smmuv3: Route IRQ and GERROR handling by SEC_SID Tao Tang
                   ` (34 more replies)
  0 siblings, 35 replies; 42+ messages in thread
From: Tao Tang @ 2026-11-14 15:46 UTC (permalink / raw)
  To: Peter Maydell, Leif Lindholm, Eric Auger, Michael S . Tsirkin,
	Igor Mammedov, Ani Sinha, Philippe Mathieu-Daudé, Zhao Liu
  Cc: Pierrick Bouvier, qemu-devel, qemu-arm, Mostafa Saleh, Chao Liu,
	Chen Baozi, Jim MacArthur, Tao Tang

Hi all,

This is v6 of the Secure SMMUv3 series.

Many thanks to everyone who reviewed the earlier versions. This version contains
35 commits in total. Most of them are confined to the Arm SMMU model. But a few
commits also touch the PCI device model, and the virt machine model.

Secure Stage 2 is not implemented. Secure STEs which enable Stage 2 are
rejected with C_BAD_STE. Realm and Root programming interfaces are outside the
scope of this series.


Commits layout:
---------------
The commits are roughly grouped as follows:

1. (#30, hw/pci only) Add a PCIDevice "sec-sid" property so boards can mark a
   device's SEC_SID (system integration knob).
2. (#1-2, #31-35) Core data-structure and plumbing refactors.
3. (#3-8) Introduce SEC_SID through caches, notifiers, and helpers.
4. (#9-12) Page table walk related updates (e.g. NSCFG/PTE helpers).
5. (#13-20) EVTQ/CMDQ handling and invalidation paths.
6. (#21-29) MMIO/register access checks and architectural corner cases.


Changes since v5:
----------------
- Split the invalidation and register-check patches, separate secure-impl
  from migration, and move S2 walker changes into the page-table walk patch.
- Add fixes for Secure S1 VMID tagging (#18) and ATC_INV checks (#20).
- Validate sec-sid in the PCI setter, reject incompatible devices through
  the PCI IOMMU check, and refresh SEC_SID on device reuse.
- Wire Secure IRQs on virt and sbsa-ref, and update CMDQV IRQ indexing.
- Document secure-impl and preserve the previous default for older
  machine types.
- Drop the temporary [NOT-MERGE] Hafnium bring-up patch.


Testing notes:
--------------
- Testing MMIO accesses
I also tested Secure-bank register reads and writes using Hafnium
firmware as described in [1].

- Testing DMA translation
I integrated this series with the latest RFCing QTest memory-attribute
extensions from [2]. The test integration also includes the iommu-testdev DMA
readback fix and the SMMUv3 security-space tests. It is available in [3].

All five SMMUv3 test cases passed:
-- Non-secure Stage 1.
-- Non-secure Stage 2.
-- Non-secure nested translation.
-- Secure Stage 1.
-- Secure Stage 2 rejection with C_BAD_STE.

The first three cases has upstreamed. For the last two cases:

    QTEST_QEMU_BINARY=./build/qemu-system-aarch64 \
      ./build/tests/qtest/iommu-smmuv3-test --tap -k \
      -p /aarch64/iommu-testdev/translation/secure-s1-only

    QTEST_QEMU_BINARY=./build/qemu-system-aarch64 \
      ./build/tests/qtest/iommu-smmuv3-test --tap -k \
      -p /aarch64/iommu-testdev/translation/secure-s2-only-bad-ste


The patches also available at [4]. The CI [5] passed with warnings from two jobs,
which also occured in upstream CI.

Best regards,
Tao

[1] https://hnusdr.github.io/2025/08/09/Test-Secure-SMMU-with-Hafnium-ENG/
[2] https://gitlab.com/TaoTang/qemu/-/tree/series/qtest-secure-v6
[3] https://gitlab.com/TaoTang/qemu/-/tree/integration/secure-smmu-v6-qtest
[4] https://gitlab.com/TaoTang/qemu/-/tree/series/secure-smmu-v6
[5] https://gitlab.com/TaoTang/qemu/-/pipelines/3065596056

Tao Tang (35):
  hw/arm/smmuv3: Introduce Secure registers
  hw/arm/smmuv3: Introduce banked registers for SMMUv3 state
  hw/arm/smmuv3: Thread SEC_SID through helper APIs
  hw/arm/smmuv3: Track SEC_SID in configs and events
  hw/arm/smmu-common: Add security-aware address space selector
  hw/arm/smmuv3: Plumb transaction attributes into config helpers
  hw/arm/smmuv3: Reject Secure STEs with stage-2 enabled
  hw/arm/smmu-common: Key configuration cache on SMMUDevice and SEC_SID
  hw/arm/smmu: Add PTE NS/NSTable helpers
  hw/arm/smmuv3: Store CD NSCFG in TT info
  hw/arm/smmu-common: Implement Secure state handling in ptw
  hw/arm/smmuv3: Tag IOTLB cache keys with SEC_SID
  hw/arm/smmuv3: Pass sec_sid into cmdq consume path
  hw/arm/smmuv3: Make evtq producer use SEC_SID
  hw/arm/smmuv3: Limit IOMMU notifications to Non-secure targets
  hw/arm/smmuv3: Scope configuration invalidation by SEC_SID
  hw/arm/smmuv3: Scope IOTLB invalidation by SEC_SID
  hw/arm/smmuv3: Fix VMID tagging for Secure stage 1
  hw/arm/smmuv3: Keep accelerated invalidation Non-secure-only
  hw/arm/smmuv3: Fix ATC invalidation command checks
  hw/arm/smmuv3: Make GERROR_IRQ_CFG registers RES0 without MSI
  hw/arm/smmuv3: Ignore CR2 writes while the SMMU is enabled
  hw/arm/smmuv3: Guard stream table register writes
  hw/arm/smmuv3: Guard command queue register writes
  hw/arm/smmuv3: Guard event queue register writes
  hw/arm/smmuv3: Determine register bank from MMIO offset
  hw/arm/smmuv3: Route IRQ and GERROR handling by SEC_SID
  hw/arm/smmuv3: Implement SMMU_S_INIT register
  hw/arm/smmuv3: Harden security checks in MMIO handlers
  hw/pci: Add sec-sid property to PCIDevice
  hw/arm/smmuv3: Select sec-sid from PCI property and validate
    SECURE_IMPL
  hw/arm/smmuv3: Reject IOMMU notifiers for non-NS devices
  hw/arm/smmuv3: Initialize the Secure register bank
  hw/arm/smmuv3: Add the secure-impl property
  hw/arm/smmuv3: Migrate the Secure register bank

 docs/system/arm/virt.rst       |   11 +
 hw/arm/smmu-internal.h         |   13 +
 hw/arm/smmuv3-internal.h       |   39 +-
 include/hw/arm/smmu-common.h   |   80 ++-
 include/hw/arm/smmuv3-common.h |   71 +-
 include/hw/arm/smmuv3.h        |   44 +-
 include/hw/arm/virt.h          |    1 +
 include/hw/pci/pci_device.h    |    3 +
 hw/arm/sbsa-ref.c              |    8 +
 hw/arm/smmu-common.c           |  426 ++++++++++--
 hw/arm/smmuv3-accel.c          |   77 ++-
 hw/arm/smmuv3.c                | 1184 +++++++++++++++++++++++---------
 hw/arm/tegra241-cmdqv.c        |    6 +-
 hw/arm/virt-acpi-build.c       |    3 +-
 hw/arm/virt.c                  |    7 +
 hw/core/machine.c              |    1 +
 hw/pci/pci.c                   |   48 ++
 hw/arm/trace-events            |   37 +-
 18 files changed, 1597 insertions(+), 462 deletions(-)

--
2.34.1



^ permalink raw reply	[flat|nested] 42+ messages in thread

end of thread, other threads:[~2026-12-01 18:30 UTC | newest]

Thread overview: 42+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-14 15:46 [PATCH v6 00/35] hw/arm/smmuv3: Support Secure state for SMMUv3 Tao Tang
2026-11-14 16:05 ` [PATCH v6 27/35] hw/arm/smmuv3: Route IRQ and GERROR handling by SEC_SID Tao Tang
2026-11-14 16:07 ` [PATCH v6 30/35] hw/pci: Add sec-sid property to PCIDevice Tao Tang
2026-11-14 16:07 ` [PATCH v6 31/35] hw/arm/smmuv3: Select sec-sid from PCI property and validate SECURE_IMPL Tao Tang
2026-11-14 16:07 ` [PATCH v6 34/35] hw/arm/smmuv3: Add the secure-impl property Tao Tang
2026-11-14 16:13 ` [PATCH v6 01/35] hw/arm/smmuv3: Introduce Secure registers Tao Tang
2026-11-14 16:13 ` [PATCH v6 02/35] hw/arm/smmuv3: Introduce banked registers for SMMUv3 state Tao Tang
2026-11-14 16:13 ` [PATCH v6 03/35] hw/arm/smmuv3: Thread SEC_SID through helper APIs Tao Tang
2026-11-14 16:13 ` [PATCH v6 04/35] hw/arm/smmuv3: Track SEC_SID in configs and events Tao Tang
2026-11-14 16:13 ` [PATCH v6 05/35] hw/arm/smmu-common: Add security-aware address space selector Tao Tang
2026-11-14 16:16 ` [PATCH v6 06/35] hw/arm/smmuv3: Plumb transaction attributes into config helpers Tao Tang
2026-11-14 16:16 ` [PATCH v6 07/35] hw/arm/smmuv3: Reject Secure STEs with stage-2 enabled Tao Tang
2026-11-14 16:16 ` [PATCH v6 08/35] hw/arm/smmu-common: Key configuration cache on SMMUDevice and SEC_SID Tao Tang
2026-11-14 16:16 ` [PATCH v6 09/35] hw/arm/smmu: Add PTE NS/NSTable helpers Tao Tang
2026-11-14 16:17 ` [PATCH v6 10/35] hw/arm/smmuv3: Store CD NSCFG in TT info Tao Tang
2026-11-14 16:17 ` [PATCH v6 11/35] hw/arm/smmu-common: Implement Secure state handling in ptw Tao Tang
2026-11-14 16:17 ` [PATCH v6 12/35] hw/arm/smmuv3: Tag IOTLB cache keys with SEC_SID Tao Tang
2026-11-14 16:17 ` [PATCH v6 13/35] hw/arm/smmuv3: Pass sec_sid into cmdq consume path Tao Tang
2026-11-14 16:17 ` [PATCH v6 14/35] hw/arm/smmuv3: Make evtq producer use SEC_SID Tao Tang
2026-11-14 16:17 ` [PATCH v6 15/35] hw/arm/smmuv3: Limit IOMMU notifications to Non-secure targets Tao Tang
2026-12-01 10:46   ` Jim MacArthur
2026-11-14 16:17 ` [PATCH v6 16/35] hw/arm/smmuv3: Scope configuration invalidation by SEC_SID Tao Tang
2026-12-01 12:32   ` Jim MacArthur
2026-11-14 16:17 ` [PATCH v6 17/35] hw/arm/smmuv3: Scope IOTLB " Tao Tang
2026-12-01 13:15   ` Jim MacArthur
2026-11-14 16:17 ` [PATCH v6 18/35] hw/arm/smmuv3: Fix VMID tagging for Secure stage 1 Tao Tang
2026-12-01 13:20   ` Jim MacArthur
2026-11-14 16:17 ` [PATCH v6 19/35] hw/arm/smmuv3: Keep accelerated invalidation Non-secure-only Tao Tang
2026-12-01 14:14   ` Jim MacArthur
2026-11-14 16:19 ` [PATCH v6 20/35] hw/arm/smmuv3: Fix ATC invalidation command checks Tao Tang
2026-12-01 18:30   ` Jim MacArthur
2026-11-14 16:19 ` [PATCH v6 21/35] hw/arm/smmuv3: Make GERROR_IRQ_CFG registers RES0 without MSI Tao Tang
2026-11-14 16:19 ` [PATCH v6 22/35] hw/arm/smmuv3: Ignore CR2 writes while the SMMU is enabled Tao Tang
2026-11-14 16:19 ` [PATCH v6 23/35] hw/arm/smmuv3: Guard stream table register writes Tao Tang
2026-11-14 16:19 ` [PATCH v6 24/35] hw/arm/smmuv3: Guard command queue " Tao Tang
2026-11-14 16:19 ` [PATCH v6 25/35] hw/arm/smmuv3: Guard event " Tao Tang
2026-11-14 16:19 ` [PATCH v6 26/35] hw/arm/smmuv3: Determine register bank from MMIO offset Tao Tang
2026-11-14 16:19 ` [PATCH v6 28/35] hw/arm/smmuv3: Implement SMMU_S_INIT register Tao Tang
2026-11-14 16:19 ` [PATCH v6 29/35] hw/arm/smmuv3: Harden security checks in MMIO handlers Tao Tang
2026-11-14 16:20 ` [PATCH v6 32/35] hw/arm/smmuv3: Reject IOMMU notifiers for non-NS devices Tao Tang
2026-11-14 16:20 ` [PATCH v6 33/35] hw/arm/smmuv3: Initialize the Secure register bank Tao Tang
2026-11-14 16:20 ` [PATCH v6 35/35] hw/arm/smmuv3: Migrate " Tao Tang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.