[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 12/25] hw/arm/virt: Default to two-stage SMMU from virt-9.2
From: |
Peter Maydell |
Subject: |
[PULL 12/25] hw/arm/virt: Default to two-stage SMMU from virt-9.2 |
Date: |
Thu, 5 Sep 2024 14:00:47 +0100 |
Now that our SMMU model supports enabling both stages of translation
at once, we can enable this in the virt board. This is no change in
behaviour for guests, because if they simply ignore stage 2 and never
configure it then it has no effect. For the usual backwards
compatibility reasons we enable this only for machine types starting
with 9.2.
(Note that the SMMU is disabled by default on the virt board and is
only created if the user passes the 'iommu=smmuv3' machine option.)
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-id: 20240816161350.3706332-4-peter.maydell@linaro.org
---
include/hw/arm/virt.h | 1 +
hw/arm/virt.c | 8 ++++++++
2 files changed, 9 insertions(+)
diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
index a4d937ed45a..aca4f8061b1 100644
--- a/include/hw/arm/virt.h
+++ b/include/hw/arm/virt.h
@@ -134,6 +134,7 @@ struct VirtMachineClass {
bool no_cpu_topology;
bool no_tcg_lpa2;
bool no_ns_el2_virt_timer_irq;
+ bool no_nested_smmu;
};
struct VirtMachineState {
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index a5d3ad9bf9e..7934b236516 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -1408,6 +1408,7 @@ static void create_pcie_irq_map(const MachineState *ms,
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];
@@ -1424,6 +1425,9 @@ static void create_smmu(const VirtMachineState *vms,
dev = qdev_new(TYPE_ARM_SMMUV3);
+ if (!vmc->no_nested_smmu) {
+ object_property_set_str(OBJECT(dev), "stage", "nested", &error_fatal);
+ }
object_property_set_link(OBJECT(dev), "primary-bus", OBJECT(bus),
&error_abort);
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
@@ -3308,8 +3312,12 @@ DEFINE_VIRT_MACHINE_AS_LATEST(9, 2)
static void virt_machine_9_1_options(MachineClass *mc)
{
+ VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc));
+
virt_machine_9_2_options(mc);
compat_props_add(mc->compat_props, hw_compat_9_1, hw_compat_9_1_len);
+ /* 9.1 and earlier have only a stage-1 SMMU, not a nested s1+2 one */
+ vmc->no_nested_smmu = true;
}
DEFINE_VIRT_MACHINE(9, 1)
--
2.34.1
- [PULL 00/25] target-arm queue, Peter Maydell, 2024/09/05
- [PULL 03/25] target/arm: Pass env pointer through to gvec_bfdot helper, Peter Maydell, 2024/09/05
- [PULL 12/25] hw/arm/virt: Default to two-stage SMMU from virt-9.2,
Peter Maydell <=
- [PULL 05/25] target/arm: Pass env pointer through to gvec_bfmmla helper, Peter Maydell, 2024/09/05
- [PULL 06/25] target/arm: Prepare bfdotadd() callers for FEAT_EBF support, Peter Maydell, 2024/09/05
- [PULL 01/25] target/arm: Allow setting the FPCR.EBF bit for FEAT_EBF16, Peter Maydell, 2024/09/05
- [PULL 09/25] accel/tcg: Remove dead code from rr_cpu_thread_fn(), Peter Maydell, 2024/09/05
- [PULL 07/25] target/arm: Implement FPCR.EBF=1 semantics for bfdotadd(), Peter Maydell, 2024/09/05
- [PULL 11/25] hw/arm/smmuv3: Update comment documenting "stage" property, Peter Maydell, 2024/09/05
- [PULL 14/25] hw/misc/xlnx-versal-cfu: destroy fifo in finalize, Peter Maydell, 2024/09/05
- [PULL 10/25] hw: add compat machines for 9.2, Peter Maydell, 2024/09/05
- [PULL 13/25] hw/arm/sbsa-ref: Use two-stage SMMU, Peter Maydell, 2024/09/05
- [PULL 04/25] target/arm: Pass env pointer through to gvec_bfdot_idx helper, Peter Maydell, 2024/09/05