qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/14] hw/arm/smmuv3: Add initial support for Secure State
@ 2025-09-25 16:26 Tao Tang
  2025-09-25 16:26 ` [PATCH v2 01/14] hw/arm/smmuv3: Fix incorrect reserved mask for SMMU CR0 register Tao Tang
                   ` (15 more replies)
  0 siblings, 16 replies; 48+ messages in thread
From: Tao Tang @ 2025-09-25 16:26 UTC (permalink / raw)
  To: Eric Auger, Peter Maydell
  Cc: qemu-devel, qemu-arm, Chen Baozi, pierrick.bouvier, philmd,
	jean-philippe, smostafa, Tao Tang

Hi all,

This is the second version of the patch series to introduce initial
support for Secure SMMUv3 emulation in QEMU.

This version has been significantly restructured based on the excellent
feedback received on the RFC.

This version addresses the major points raised during the RFC review.
Nearly all issues identified in v1 have been resolved. The most
significant changes include:

  - The entire series has been refactored to use a "banked register"
  architecture. This new design serves as a solid base for all secure
  functionality and significantly reduces code duplication.

  - The large refactoring patch from v1 has been split into smaller, more
  focused commits (e.g., STE parsing, page table handling, and TLB
  management) to make the review process easier.

  - Support for the complex SEL2 feature (Secure Stage 2) has been
  deferred to a future series to reduce the scope of this RFC.

  - The mechanism for propagating the security context now correctly uses
  the ARMSecuritySpace attribute from the incoming transaction. This
  ensures the SMMU's handling of security is aligned with the rest of the
  QEMU ARM architecture.


The series now begins with two preparatory patches that fix pre-existing
bugs in the SMMUv3 model. The first of these, which corrects the CR0
reserved mask, has already been reviewed by Eric.

  - hw/arm/smmuv3: Fix incorrect reserved mask for SMMU CR0 register
  - hw/arm/smmuv3: Correct SMMUEN field name in CR0

The subsequent patches implement the Secure SMMUv3 feature, refactored
to address the feedback from the v1 RFC.


Changes from v1 RFC:

  - The entire feature implementation has been refactored to use a "banked
  register" approach. This significantly reduces code duplication.

  - Support for the SEL2 feature (Secure Stage 2) has been deferred. As
  Mostafa pointed out, a correct implementation is complex and depends on
  FEAT_TTST. This will be addressed in a separate, future patch series.
  As a result, this series now supports the following flows:

    - Non-secure Stage 1, Stage 2, and nested translations.

    - Secure Stage 1-only translations.

    - Nested translations (Secure Stage 1 + Non-secure Stage 2), with a
  fault generated if a Secure Stage 2 translation is required.

  - Writability checks for various registers (both secure and non-secure)
  have been hardened to ensure that enable bits are correctly checked.

The series has been successfully validated with several test setups:

  - An environment using OP-TEE, Hafnium, and a custom platform
  device as V1 series described.

  - A new, self-contained test device (smmu-testdev) built upon the
  QTest framework, which will be submitted as a separate series as
  discussed here:
    https://lists.nongnu.org/archive/html/qemu-devel/2025-09/msg05365.html

  - The existing non-secure functionality was regression-tested using
  PCIe passthrough to a KVM guest running inside a TCG guest.

Signed-off-by: Tao Tang <tangtao1634@phytium.com.cn>

Tao Tang (14):
  hw/arm/smmuv3: Fix incorrect reserved mask for SMMU CR0 register
  hw/arm/smmuv3: Correct SMMUEN field name in CR0
  hw/arm/smmuv3: Introduce secure registers and commands
  refactor: Move ARMSecuritySpace to a common header
  hw/arm/smmuv3: Introduce banked registers for SMMUv3 state
  hw/arm/smmuv3: Add separate address space for secure SMMU accesses
  hw/arm/smmuv3: Make Configuration Cache security-state aware
  hw/arm/smmuv3: Add security-state handling for page table walks
  hw/arm/smmuv3: Add secure TLB entry management
  hw/arm/smmuv3: Add banked support for queues and error handling
  hw/arm/smmuv3: Harden security checks in MMIO handlers
  hw/arm/smmuv3: Use iommu_index to represent the security context
  hw/arm/smmuv3: Add property to enable Secure SMMU support
  hw/arm/smmuv3: Optional Secure bank migration via subsections

 hw/arm/smmu-common.c          |  151 ++++-
 hw/arm/smmu-internal.h        |    7 +
 hw/arm/smmuv3-internal.h      |  114 +++-
 hw/arm/smmuv3.c               | 1130 +++++++++++++++++++++++++--------
 hw/arm/trace-events           |    9 +-
 hw/arm/virt.c                 |    5 +
 include/hw/arm/arm-security.h |   54 ++
 include/hw/arm/smmu-common.h  |   60 +-
 include/hw/arm/smmuv3.h       |   35 +-
 target/arm/cpu.h              |   25 +-
 10 files changed, 1257 insertions(+), 333 deletions(-)
 create mode 100644 include/hw/arm/arm-security.h

--
2.34.1



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

end of thread, other threads:[~2025-10-11  0:33 UTC | newest]

Thread overview: 48+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-25 16:26 [PATCH v2 00/14] hw/arm/smmuv3: Add initial support for Secure State Tao Tang
2025-09-25 16:26 ` [PATCH v2 01/14] hw/arm/smmuv3: Fix incorrect reserved mask for SMMU CR0 register Tao Tang
2025-09-25 16:26 ` [PATCH v2 02/14] hw/arm/smmuv3: Correct SMMUEN field name in CR0 Tao Tang
2025-09-26 12:27   ` Eric Auger
2025-09-25 16:26 ` [PATCH v2 03/14] hw/arm/smmuv3: Introduce secure registers and commands Tao Tang
2025-09-27 10:29   ` Eric Auger
2025-09-28  4:46     ` Tao Tang
2025-09-25 16:26 ` [PATCH v2 04/14] refactor: Move ARMSecuritySpace to a common header Tao Tang
2025-09-28 13:19   ` Eric Auger
2025-09-25 16:26 ` [PATCH v2 05/14] hw/arm/smmuv3: Introduce banked registers for SMMUv3 state Tao Tang
2025-09-28 14:26   ` Eric Auger
2025-09-29  7:22     ` Tao Tang
2025-09-25 16:26 ` [PATCH v2 06/14] hw/arm/smmuv3: Add separate address space for secure SMMU accesses Tao Tang
2025-09-29  7:44   ` Eric Auger
2025-09-29  8:33     ` Tao Tang
2025-09-29  8:54       ` Eric Auger
2025-09-25 16:26 ` [PATCH v2 07/14] hw/arm/smmuv3: Make Configuration Cache security-state aware Tao Tang
2025-09-29  9:55   ` Eric Auger
2025-09-29 10:38     ` Tao Tang
2025-09-25 16:26 ` [PATCH v2 08/14] hw/arm/smmuv3: Add security-state handling for page table walks Tao Tang
2025-09-29 14:21   ` Eric Auger
2025-09-29 15:22     ` Tao Tang
2025-09-25 16:26 ` [PATCH v2 09/14] hw/arm/smmuv3: Add secure TLB entry management Tao Tang
2025-09-29 14:57   ` Eric Auger
2025-09-29 15:29     ` Tao Tang
2025-09-25 16:26 ` [PATCH v2 10/14] hw/arm/smmuv3: Add banked support for queues and error handling Tao Tang
2025-09-29 15:07   ` Eric Auger
2025-09-29 15:45     ` Tao Tang
2025-09-29 15:09   ` Eric Auger
2025-09-25 16:26 ` [PATCH v2 11/14] hw/arm/smmuv3: Harden security checks in MMIO handlers Tao Tang
2025-09-29 15:30   ` Eric Auger
2025-09-29 15:56     ` Tao Tang
2025-09-30 13:13       ` Eric Auger
2025-09-26  3:08 ` [PATCH v2 12/14] hw/arm/smmuv3: Use iommu_index to represent the security context Tao Tang
2025-09-26  3:08   ` [PATCH v2 13/14] hw/arm/smmuv3: Add property to enable Secure SMMU support Tao Tang
2025-09-26  3:08   ` [PATCH v2 14/14] hw/arm/smmuv3: Optional Secure bank migration via subsections Tao Tang
2025-09-29 15:33   ` [PATCH v2 12/14] hw/arm/smmuv3: Use iommu_index to represent the security context Eric Auger
2025-09-29 16:02     ` Tao Tang
2025-09-26  3:23 ` [PATCH v2 13/14] hw/arm/smmuv3: Add property to enable Secure SMMU support Tao Tang
2025-09-29 15:42   ` Eric Auger
2025-09-29 16:15     ` Tao Tang
2025-09-26  3:30 ` [PATCH v2 14/14] hw/arm/smmuv3: Optional Secure bank migration via subsections Tao Tang
2025-09-29 15:47   ` Eric Auger
2025-09-30  3:35     ` Tao Tang
2025-09-26 12:24 ` [PATCH v2 00/14] hw/arm/smmuv3: Add initial support for Secure State Eric Auger
2025-09-26 14:54   ` Tao Tang
2025-09-26 16:12     ` Eric Auger
2025-10-11  0:31 ` Pierrick Bouvier

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).