1
The following changes since commit 003ba52a8b327180e284630b289c6ece5a3e08b9:
1
Hi; here's the latest batch of arm changes. The big thing
2
in here is the SMMUv3 changes to add stage-2 translation support.
2
3
3
Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging (2023-02-16 11:16:39 +0000)
4
thanks
5
-- PMM
6
7
The following changes since commit aa9bbd865502ed517624ab6fe7d4b5d89ca95e43:
8
9
Merge tag 'pull-ppc-20230528' of https://gitlab.com/danielhb/qemu into staging (2023-05-29 14:31:52 -0700)
4
10
5
are available in the Git repository at:
11
are available in the Git repository at:
6
12
7
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20230216
13
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20230530
8
14
9
for you to fetch changes up to caf01d6a435d9f4a95aeae2f9fc6cb8b889b1fb8:
15
for you to fetch changes up to b03d0d4f531a8b867e0aac1fab0b876903015680:
10
16
11
tests/qtest: Restrict tpm-tis-devices-{swtpm}-test to CONFIG_TCG (2023-02-16 16:28:53 +0000)
17
docs: sbsa: correct graphics card name (2023-05-30 13:32:46 +0100)
12
18
13
----------------------------------------------------------------
19
----------------------------------------------------------------
14
target-arm queue:
20
target-arm queue:
15
* Some mostly M-profile-related code cleanups
21
* fsl-imx6: Add SNVS support for i.MX6 boards
16
* avocado: Retire the boot_linux.py AArch64 TCG tests
22
* smmuv3: Add support for stage 2 translations
17
* hw/arm/smmuv3: Add GBPA register
23
* hw/dma/xilinx_axidma: Check DMASR.HALTED to prevent infinite loop
18
* arm/virt: don't try to spell out the accelerator
24
* hw/arm/xlnx-zynqmp: fix unsigned error when checking the RPUs number
19
* hw/arm: Attach PSPI module to NPCM7XX SoC
25
* cleanups for recent Kconfig changes
20
* Some cleanup/refactoring patches aiming towards
26
* target/arm: Explicitly select short-format FSR for M-profile
21
allowing building Arm targets without CONFIG_TCG
27
* tests/qtest: Run arm-specific tests only if the required machine is available
28
* hw/arm/sbsa-ref: add GIC node into DT
29
* docs: sbsa: correct graphics card name
30
* Update copyright dates to 2023
22
31
23
----------------------------------------------------------------
32
----------------------------------------------------------------
24
Alex Bennée (1):
33
Clément Chigot (1):
25
tests/avocado: retire the Aarch64 TCG tests from boot_linux.py
34
hw/arm/xlnx-zynqmp: fix unsigned error when checking the RPUs number
26
35
27
Claudio Fontana (3):
36
Enze Li (1):
28
target/arm: rename handle_semihosting to tcg_handle_semihosting
37
Update copyright dates to 2023
29
target/arm: wrap psci call with tcg_enabled
30
target/arm: wrap call to aarch64_sve_change_el in tcg_enabled()
31
38
32
Cornelia Huck (1):
39
Fabiano Rosas (3):
33
arm/virt: don't try to spell out the accelerator
40
target/arm: Explain why we need to select ARM_V7M
41
arm/Kconfig: Keep Kconfig default entries in default.mak as documentation
42
arm/Kconfig: Make TCG dependence explicit
34
43
35
Fabiano Rosas (7):
44
Marcin Juszkiewicz (2):
36
target/arm: Move PC alignment check
45
hw/arm/sbsa-ref: add GIC node into DT
37
target/arm: Move cpregs code out of cpu.h
46
docs: sbsa: correct graphics card name
38
tests/avocado: Skip tests that require a missing accelerator
39
tests/avocado: Tag TCG tests with accel:tcg
40
target/arm: Use "max" as default cpu for the virt machine with KVM
41
tests/qtest: arm-cpu-features: Match tests to required accelerators
42
tests/qtest: Restrict tpm-tis-devices-{swtpm}-test to CONFIG_TCG
43
47
44
Hao Wu (3):
48
Mostafa Saleh (10):
45
MAINTAINERS: Add myself to maintainers and remove Havard
49
hw/arm/smmuv3: Add missing fields for IDR0
46
hw/ssi: Add Nuvoton PSPI Module
50
hw/arm/smmuv3: Update translation config to hold stage-2
47
hw/arm: Attach PSPI module to NPCM7XX SoC
51
hw/arm/smmuv3: Refactor stage-1 PTW
52
hw/arm/smmuv3: Add page table walk for stage-2
53
hw/arm/smmuv3: Parse STE config for stage-2
54
hw/arm/smmuv3: Make TLB lookup work for stage-2
55
hw/arm/smmuv3: Add VMID to TLB tagging
56
hw/arm/smmuv3: Add CMDs related to stage-2
57
hw/arm/smmuv3: Add stage-2 support in iova notifier
58
hw/arm/smmuv3: Add knob to choose translation stage and enable stage-2
48
59
49
Jean-Philippe Brucker (2):
60
Peter Maydell (1):
50
hw/arm/smmu-common: Support 64-bit addresses
61
target/arm: Explicitly select short-format FSR for M-profile
51
hw/arm/smmu-common: Fix TTB1 handling
52
62
53
Mostafa Saleh (1):
63
Thomas Huth (1):
54
hw/arm/smmuv3: Add GBPA register
64
tests/qtest: Run arm-specific tests only if the required machine is available
55
65
56
Philippe Mathieu-Daudé (12):
66
Tommy Wu (1):
57
hw/intc/armv7m_nvic: Use OBJECT_DECLARE_SIMPLE_TYPE() macro
67
hw/dma/xilinx_axidma: Check DMASR.HALTED to prevent infinite loop.
58
target/arm: Simplify arm_v7m_mmu_idx_for_secstate() for user emulation
59
target/arm: Reduce arm_v7m_mmu_idx_[all/for_secstate_and_priv]() scope
60
target/arm: Constify ID_PFR1 on user emulation
61
target/arm: Convert CPUARMState::eabi to boolean
62
target/arm: Avoid resetting CPUARMState::eabi field
63
target/arm: Restrict CPUARMState::gicv3state to sysemu
64
target/arm: Restrict CPUARMState::arm_boot_info to sysemu
65
target/arm: Restrict CPUARMState::nvic to sysemu
66
target/arm: Store CPUARMState::nvic as NVICState*
67
target/arm: Declare CPU <-> NVIC helpers in 'hw/intc/armv7m_nvic.h'
68
hw/arm: Add missing XLNX_ZYNQMP_ARM -> USB_DWC3 Kconfig dependency
69
68
70
MAINTAINERS | 8 +-
69
Vitaly Cheptsov (1):
71
docs/system/arm/nuvoton.rst | 2 +-
70
fsl-imx6: Add SNVS support for i.MX6 boards
72
hw/arm/smmuv3-internal.h | 7 +
73
include/hw/arm/npcm7xx.h | 2 +
74
include/hw/arm/smmu-common.h | 2 -
75
include/hw/arm/smmuv3.h | 1 +
76
include/hw/intc/armv7m_nvic.h | 128 +++++++++++++++++-
77
include/hw/ssi/npcm_pspi.h | 53 ++++++++
78
linux-user/user-internals.h | 2 +-
79
target/arm/cpregs.h | 98 ++++++++++++++
80
target/arm/cpu.h | 228 ++-------------------------------
81
target/arm/internals.h | 14 --
82
hw/arm/npcm7xx.c | 25 +++-
83
hw/arm/smmu-common.c | 4 +-
84
hw/arm/smmuv3.c | 43 ++++++-
85
hw/arm/virt.c | 10 +-
86
hw/intc/armv7m_nvic.c | 38 ++----
87
hw/ssi/npcm_pspi.c | 221 ++++++++++++++++++++++++++++++++
88
linux-user/arm/cpu_loop.c | 4 +-
89
target/arm/cpu.c | 5 +-
90
target/arm/cpu_tcg.c | 3 +
91
target/arm/helper.c | 31 +++--
92
target/arm/m_helper.c | 86 +++++++------
93
target/arm/machine.c | 18 +--
94
tests/qtest/arm-cpu-features.c | 28 ++--
95
hw/arm/Kconfig | 1 +
96
hw/ssi/meson.build | 2 +-
97
hw/ssi/trace-events | 5 +
98
tests/avocado/avocado_qemu/__init__.py | 4 +
99
tests/avocado/boot_linux.py | 48 ++-----
100
tests/avocado/boot_linux_console.py | 1 +
101
tests/avocado/machine_aarch64_virt.py | 63 ++++++++-
102
tests/avocado/reverse_debugging.py | 8 ++
103
tests/qtest/meson.build | 4 +-
104
34 files changed, 798 insertions(+), 399 deletions(-)
105
create mode 100644 include/hw/ssi/npcm_pspi.h
106
create mode 100644 hw/ssi/npcm_pspi.c
107
71
72
docs/conf.py | 2 +-
73
docs/system/arm/sbsa.rst | 2 +-
74
configs/devices/aarch64-softmmu/default.mak | 6 +
75
configs/devices/arm-softmmu/default.mak | 40 ++++
76
hw/arm/smmu-internal.h | 37 +++
77
hw/arm/smmuv3-internal.h | 12 +-
78
include/hw/arm/fsl-imx6.h | 2 +
79
include/hw/arm/smmu-common.h | 45 +++-
80
include/hw/arm/smmuv3.h | 4 +
81
include/qemu/help-texts.h | 2 +-
82
hw/arm/fsl-imx6.c | 8 +
83
hw/arm/sbsa-ref.c | 19 +-
84
hw/arm/smmu-common.c | 209 ++++++++++++++--
85
hw/arm/smmuv3.c | 357 ++++++++++++++++++++++++----
86
hw/arm/xlnx-zynqmp.c | 2 +-
87
hw/dma/xilinx_axidma.c | 11 +-
88
target/arm/tcg/tlb_helper.c | 13 +-
89
hw/arm/Kconfig | 123 ++++++----
90
hw/arm/trace-events | 14 +-
91
target/arm/Kconfig | 3 +
92
tests/qtest/meson.build | 7 +-
93
21 files changed, 773 insertions(+), 145 deletions(-)
94
diff view generated by jsdifflib
Deleted patch
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
1
3
Manually convert to OBJECT_DECLARE_SIMPLE_TYPE() macro,
4
similarly to automatic conversion from commit 8063396bf3
5
("Use OBJECT_DECLARE_SIMPLE_TYPE when possible").
6
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20230206223502.25122-2-philmd@linaro.org
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
12
include/hw/intc/armv7m_nvic.h | 5 +----
13
1 file changed, 1 insertion(+), 4 deletions(-)
14
15
diff --git a/include/hw/intc/armv7m_nvic.h b/include/hw/intc/armv7m_nvic.h
16
index XXXXXXX..XXXXXXX 100644
17
--- a/include/hw/intc/armv7m_nvic.h
18
+++ b/include/hw/intc/armv7m_nvic.h
19
@@ -XXX,XX +XXX,XX @@
20
#include "qom/object.h"
21
22
#define TYPE_NVIC "armv7m_nvic"
23
-
24
-typedef struct NVICState NVICState;
25
-DECLARE_INSTANCE_CHECKER(NVICState, NVIC,
26
- TYPE_NVIC)
27
+OBJECT_DECLARE_SIMPLE_TYPE(NVICState, NVIC)
28
29
/* Highest permitted number of exceptions (architectural limit) */
30
#define NVIC_MAX_VECTORS 512
31
--
32
2.34.1
33
34
diff view generated by jsdifflib
1
From: Fabiano Rosas <farosas@suse.de>
1
From: Vitaly Cheptsov <cheptsov@ispras.ru>
2
2
3
Move this earlier to make the next patch diff cleaner. While here
3
SNVS is supported on both i.MX6 and i.MX6UL and is needed
4
update the comment slightly to not give the impression that the
4
to support shutdown on the board.
5
misalignment affects only TCG.
6
5
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Cc: Peter Maydell <peter.maydell@linaro.org> (odd fixer:SABRELITE / i.MX6)
8
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7
Cc: Jean-Christophe Dubois <jcd@tribudubois.net> (reviewer:SABRELITE / i.MX6)
9
Signed-off-by: Fabiano Rosas <farosas@suse.de>
8
Cc: qemu-arm@nongnu.org (open list:SABRELITE / i.MX6)
10
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
9
Cc: qemu-devel@nongnu.org (open list:All patches CC here)
10
Signed-off-by: Vitaly Cheptsov <cheptsov@ispras.ru>
11
Message-id: 20230515095015.66860-1-cheptsov@ispras.ru
12
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
14
---
13
target/arm/machine.c | 18 +++++++++---------
15
include/hw/arm/fsl-imx6.h | 2 ++
14
1 file changed, 9 insertions(+), 9 deletions(-)
16
hw/arm/fsl-imx6.c | 8 ++++++++
17
2 files changed, 10 insertions(+)
15
18
16
diff --git a/target/arm/machine.c b/target/arm/machine.c
19
diff --git a/include/hw/arm/fsl-imx6.h b/include/hw/arm/fsl-imx6.h
17
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/machine.c
21
--- a/include/hw/arm/fsl-imx6.h
19
+++ b/target/arm/machine.c
22
+++ b/include/hw/arm/fsl-imx6.h
20
@@ -XXX,XX +XXX,XX @@ static int cpu_post_load(void *opaque, int version_id)
23
@@ -XXX,XX +XXX,XX @@
21
}
24
#include "hw/cpu/a9mpcore.h"
22
}
25
#include "hw/misc/imx6_ccm.h"
26
#include "hw/misc/imx6_src.h"
27
+#include "hw/misc/imx7_snvs.h"
28
#include "hw/watchdog/wdt_imx2.h"
29
#include "hw/char/imx_serial.h"
30
#include "hw/timer/imx_gpt.h"
31
@@ -XXX,XX +XXX,XX @@ struct FslIMX6State {
32
A9MPPrivState a9mpcore;
33
IMX6CCMState ccm;
34
IMX6SRCState src;
35
+ IMX7SNVSState snvs;
36
IMXSerialState uart[FSL_IMX6_NUM_UARTS];
37
IMXGPTState gpt;
38
IMXEPITState epit[FSL_IMX6_NUM_EPITS];
39
diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c
40
index XXXXXXX..XXXXXXX 100644
41
--- a/hw/arm/fsl-imx6.c
42
+++ b/hw/arm/fsl-imx6.c
43
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6_init(Object *obj)
44
45
object_initialize_child(obj, "src", &s->src, TYPE_IMX6_SRC);
46
47
+ object_initialize_child(obj, "snvs", &s->snvs, TYPE_IMX7_SNVS);
48
+
49
for (i = 0; i < FSL_IMX6_NUM_UARTS; i++) {
50
snprintf(name, NAME_SIZE, "uart%d", i + 1);
51
object_initialize_child(obj, name, &s->uart[i], TYPE_IMX_SERIAL);
52
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)
53
qdev_get_gpio_in(DEVICE(&s->a9mpcore),
54
FSL_IMX6_ENET_MAC_1588_IRQ));
23
55
24
+ /*
56
+ /*
25
+ * Misaligned thumb pc is architecturally impossible. Fail the
57
+ * SNVS
26
+ * incoming migration. For TCG it would trigger the assert in
27
+ * thumb_tr_translate_insn().
28
+ */
58
+ */
29
+ if (!is_a64(env) && env->thumb && (env->regs[15] & 1)) {
59
+ sysbus_realize(SYS_BUS_DEVICE(&s->snvs), &error_abort);
30
+ return -1;
60
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->snvs), 0, FSL_IMX6_SNVSHP_ADDR);
31
+ }
32
+
61
+
33
hw_breakpoint_update_all(cpu);
62
/*
34
hw_watchpoint_update_all(cpu);
63
* Watchdog
35
64
*/
36
@@ -XXX,XX +XXX,XX @@ static int cpu_post_load(void *opaque, int version_id)
37
}
38
}
39
40
- /*
41
- * Misaligned thumb pc is architecturally impossible.
42
- * We have an assert in thumb_tr_translate_insn to verify this.
43
- * Fail an incoming migrate to avoid this assert.
44
- */
45
- if (!is_a64(env) && env->thumb && (env->regs[15] & 1)) {
46
- return -1;
47
- }
48
-
49
if (!kvm_enabled()) {
50
pmu_op_finish(&cpu->env);
51
}
52
--
65
--
53
2.34.1
66
2.34.1
54
55
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
From: Mostafa Saleh <smostafa@google.com>
2
2
3
While dozens of files include "cpu.h", only 3 files require
3
In preparation for adding stage-2 support.
4
these NVIC helper declarations.
4
Add IDR0 fields related to stage-2.
5
6
VMID16: 16-bit VMID supported.
7
S2P: Stage-2 translation supported.
8
9
They are described in 6.3.1 SMMU_IDR0.
10
11
No functional change intended.
5
12
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
14
Reviewed-by: Eric Auger <eric.auger@redhat.com>
8
Message-id: 20230206223502.25122-12-philmd@linaro.org
15
Signed-off-by: Mostafa Saleh <smostafa@google.com>
16
Tested-by: Eric Auger <eric.auger@redhat.com>
17
Tested-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
18
Message-id: 20230516203327.2051088-2-smostafa@google.com
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
20
---
11
include/hw/intc/armv7m_nvic.h | 123 ++++++++++++++++++++++++++++++++++
21
hw/arm/smmuv3-internal.h | 2 ++
12
target/arm/cpu.h | 123 ----------------------------------
22
1 file changed, 2 insertions(+)
13
target/arm/cpu.c | 4 +-
14
target/arm/cpu_tcg.c | 3 +
15
target/arm/m_helper.c | 3 +
16
5 files changed, 132 insertions(+), 124 deletions(-)
17
23
18
diff --git a/include/hw/intc/armv7m_nvic.h b/include/hw/intc/armv7m_nvic.h
24
diff --git a/hw/arm/smmuv3-internal.h b/hw/arm/smmuv3-internal.h
19
index XXXXXXX..XXXXXXX 100644
25
index XXXXXXX..XXXXXXX 100644
20
--- a/include/hw/intc/armv7m_nvic.h
26
--- a/hw/arm/smmuv3-internal.h
21
+++ b/include/hw/intc/armv7m_nvic.h
27
+++ b/hw/arm/smmuv3-internal.h
22
@@ -XXX,XX +XXX,XX @@ struct NVICState {
28
@@ -XXX,XX +XXX,XX @@ typedef enum SMMUTranslationStatus {
23
qemu_irq sysresetreq;
29
/* MMIO Registers */
24
};
30
25
31
REG32(IDR0, 0x0)
26
+/* Interface between CPU and Interrupt controller. */
32
+ FIELD(IDR0, S2P, 0 , 1)
27
+/**
33
FIELD(IDR0, S1P, 1 , 1)
28
+ * armv7m_nvic_set_pending: mark the specified exception as pending
34
FIELD(IDR0, TTF, 2 , 2)
29
+ * @s: the NVIC
35
FIELD(IDR0, COHACC, 4 , 1)
30
+ * @irq: the exception number to mark pending
36
FIELD(IDR0, ASID16, 12, 1)
31
+ * @secure: false for non-banked exceptions or for the nonsecure
37
+ FIELD(IDR0, VMID16, 18, 1)
32
+ * version of a banked exception, true for the secure version of a banked
38
FIELD(IDR0, TTENDIAN, 21, 2)
33
+ * exception.
39
FIELD(IDR0, STALL_MODEL, 24, 2)
34
+ *
40
FIELD(IDR0, TERM_MODEL, 26, 1)
35
+ * Marks the specified exception as pending. Note that we will assert()
36
+ * if @secure is true and @irq does not specify one of the fixed set
37
+ * of architecturally banked exceptions.
38
+ */
39
+void armv7m_nvic_set_pending(NVICState *s, int irq, bool secure);
40
+/**
41
+ * armv7m_nvic_set_pending_derived: mark this derived exception as pending
42
+ * @s: the NVIC
43
+ * @irq: the exception number to mark pending
44
+ * @secure: false for non-banked exceptions or for the nonsecure
45
+ * version of a banked exception, true for the secure version of a banked
46
+ * exception.
47
+ *
48
+ * Similar to armv7m_nvic_set_pending(), but specifically for derived
49
+ * exceptions (exceptions generated in the course of trying to take
50
+ * a different exception).
51
+ */
52
+void armv7m_nvic_set_pending_derived(NVICState *s, int irq, bool secure);
53
+/**
54
+ * armv7m_nvic_set_pending_lazyfp: mark this lazy FP exception as pending
55
+ * @s: the NVIC
56
+ * @irq: the exception number to mark pending
57
+ * @secure: false for non-banked exceptions or for the nonsecure
58
+ * version of a banked exception, true for the secure version of a banked
59
+ * exception.
60
+ *
61
+ * Similar to armv7m_nvic_set_pending(), but specifically for exceptions
62
+ * generated in the course of lazy stacking of FP registers.
63
+ */
64
+void armv7m_nvic_set_pending_lazyfp(NVICState *s, int irq, bool secure);
65
+/**
66
+ * armv7m_nvic_get_pending_irq_info: return highest priority pending
67
+ * exception, and whether it targets Secure state
68
+ * @s: the NVIC
69
+ * @pirq: set to pending exception number
70
+ * @ptargets_secure: set to whether pending exception targets Secure
71
+ *
72
+ * This function writes the number of the highest priority pending
73
+ * exception (the one which would be made active by
74
+ * armv7m_nvic_acknowledge_irq()) to @pirq, and sets @ptargets_secure
75
+ * to true if the current highest priority pending exception should
76
+ * be taken to Secure state, false for NS.
77
+ */
78
+void armv7m_nvic_get_pending_irq_info(NVICState *s, int *pirq,
79
+ bool *ptargets_secure);
80
+/**
81
+ * armv7m_nvic_acknowledge_irq: make highest priority pending exception active
82
+ * @s: the NVIC
83
+ *
84
+ * Move the current highest priority pending exception from the pending
85
+ * state to the active state, and update v7m.exception to indicate that
86
+ * it is the exception currently being handled.
87
+ */
88
+void armv7m_nvic_acknowledge_irq(NVICState *s);
89
+/**
90
+ * armv7m_nvic_complete_irq: complete specified interrupt or exception
91
+ * @s: the NVIC
92
+ * @irq: the exception number to complete
93
+ * @secure: true if this exception was secure
94
+ *
95
+ * Returns: -1 if the irq was not active
96
+ * 1 if completing this irq brought us back to base (no active irqs)
97
+ * 0 if there is still an irq active after this one was completed
98
+ * (Ignoring -1, this is the same as the RETTOBASE value before completion.)
99
+ */
100
+int armv7m_nvic_complete_irq(NVICState *s, int irq, bool secure);
101
+/**
102
+ * armv7m_nvic_get_ready_status(void *opaque, int irq, bool secure)
103
+ * @s: the NVIC
104
+ * @irq: the exception number to mark pending
105
+ * @secure: false for non-banked exceptions or for the nonsecure
106
+ * version of a banked exception, true for the secure version of a banked
107
+ * exception.
108
+ *
109
+ * Return whether an exception is "ready", i.e. whether the exception is
110
+ * enabled and is configured at a priority which would allow it to
111
+ * interrupt the current execution priority. This controls whether the
112
+ * RDY bit for it in the FPCCR is set.
113
+ */
114
+bool armv7m_nvic_get_ready_status(NVICState *s, int irq, bool secure);
115
+/**
116
+ * armv7m_nvic_raw_execution_priority: return the raw execution priority
117
+ * @s: the NVIC
118
+ *
119
+ * Returns: the raw execution priority as defined by the v8M architecture.
120
+ * This is the execution priority minus the effects of AIRCR.PRIS,
121
+ * and minus any PRIMASK/FAULTMASK/BASEPRI priority boosting.
122
+ * (v8M ARM ARM I_PKLD.)
123
+ */
124
+int armv7m_nvic_raw_execution_priority(NVICState *s);
125
+/**
126
+ * armv7m_nvic_neg_prio_requested: return true if the requested execution
127
+ * priority is negative for the specified security state.
128
+ * @s: the NVIC
129
+ * @secure: the security state to test
130
+ * This corresponds to the pseudocode IsReqExecPriNeg().
131
+ */
132
+#ifndef CONFIG_USER_ONLY
133
+bool armv7m_nvic_neg_prio_requested(NVICState *s, bool secure);
134
+#else
135
+static inline bool armv7m_nvic_neg_prio_requested(NVICState *s, bool secure)
136
+{
137
+ return false;
138
+}
139
+#endif
140
+#ifndef CONFIG_USER_ONLY
141
+bool armv7m_nvic_can_take_pending_exception(NVICState *s);
142
+#else
143
+static inline bool armv7m_nvic_can_take_pending_exception(NVICState *s)
144
+{
145
+ return true;
146
+}
147
+#endif
148
+
149
#endif
150
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
151
index XXXXXXX..XXXXXXX 100644
152
--- a/target/arm/cpu.h
153
+++ b/target/arm/cpu.h
154
@@ -XXX,XX +XXX,XX @@ void arm_cpu_list(void);
155
uint32_t arm_phys_excp_target_el(CPUState *cs, uint32_t excp_idx,
156
uint32_t cur_el, bool secure);
157
158
-/* Interface between CPU and Interrupt controller. */
159
-#ifndef CONFIG_USER_ONLY
160
-bool armv7m_nvic_can_take_pending_exception(NVICState *s);
161
-#else
162
-static inline bool armv7m_nvic_can_take_pending_exception(NVICState *s)
163
-{
164
- return true;
165
-}
166
-#endif
167
-/**
168
- * armv7m_nvic_set_pending: mark the specified exception as pending
169
- * @s: the NVIC
170
- * @irq: the exception number to mark pending
171
- * @secure: false for non-banked exceptions or for the nonsecure
172
- * version of a banked exception, true for the secure version of a banked
173
- * exception.
174
- *
175
- * Marks the specified exception as pending. Note that we will assert()
176
- * if @secure is true and @irq does not specify one of the fixed set
177
- * of architecturally banked exceptions.
178
- */
179
-void armv7m_nvic_set_pending(NVICState *s, int irq, bool secure);
180
-/**
181
- * armv7m_nvic_set_pending_derived: mark this derived exception as pending
182
- * @s: the NVIC
183
- * @irq: the exception number to mark pending
184
- * @secure: false for non-banked exceptions or for the nonsecure
185
- * version of a banked exception, true for the secure version of a banked
186
- * exception.
187
- *
188
- * Similar to armv7m_nvic_set_pending(), but specifically for derived
189
- * exceptions (exceptions generated in the course of trying to take
190
- * a different exception).
191
- */
192
-void armv7m_nvic_set_pending_derived(NVICState *s, int irq, bool secure);
193
-/**
194
- * armv7m_nvic_set_pending_lazyfp: mark this lazy FP exception as pending
195
- * @s: the NVIC
196
- * @irq: the exception number to mark pending
197
- * @secure: false for non-banked exceptions or for the nonsecure
198
- * version of a banked exception, true for the secure version of a banked
199
- * exception.
200
- *
201
- * Similar to armv7m_nvic_set_pending(), but specifically for exceptions
202
- * generated in the course of lazy stacking of FP registers.
203
- */
204
-void armv7m_nvic_set_pending_lazyfp(NVICState *s, int irq, bool secure);
205
-/**
206
- * armv7m_nvic_get_pending_irq_info: return highest priority pending
207
- * exception, and whether it targets Secure state
208
- * @s: the NVIC
209
- * @pirq: set to pending exception number
210
- * @ptargets_secure: set to whether pending exception targets Secure
211
- *
212
- * This function writes the number of the highest priority pending
213
- * exception (the one which would be made active by
214
- * armv7m_nvic_acknowledge_irq()) to @pirq, and sets @ptargets_secure
215
- * to true if the current highest priority pending exception should
216
- * be taken to Secure state, false for NS.
217
- */
218
-void armv7m_nvic_get_pending_irq_info(NVICState *s, int *pirq,
219
- bool *ptargets_secure);
220
-/**
221
- * armv7m_nvic_acknowledge_irq: make highest priority pending exception active
222
- * @s: the NVIC
223
- *
224
- * Move the current highest priority pending exception from the pending
225
- * state to the active state, and update v7m.exception to indicate that
226
- * it is the exception currently being handled.
227
- */
228
-void armv7m_nvic_acknowledge_irq(NVICState *s);
229
-/**
230
- * armv7m_nvic_complete_irq: complete specified interrupt or exception
231
- * @s: the NVIC
232
- * @irq: the exception number to complete
233
- * @secure: true if this exception was secure
234
- *
235
- * Returns: -1 if the irq was not active
236
- * 1 if completing this irq brought us back to base (no active irqs)
237
- * 0 if there is still an irq active after this one was completed
238
- * (Ignoring -1, this is the same as the RETTOBASE value before completion.)
239
- */
240
-int armv7m_nvic_complete_irq(NVICState *s, int irq, bool secure);
241
-/**
242
- * armv7m_nvic_get_ready_status(void *opaque, int irq, bool secure)
243
- * @s: the NVIC
244
- * @irq: the exception number to mark pending
245
- * @secure: false for non-banked exceptions or for the nonsecure
246
- * version of a banked exception, true for the secure version of a banked
247
- * exception.
248
- *
249
- * Return whether an exception is "ready", i.e. whether the exception is
250
- * enabled and is configured at a priority which would allow it to
251
- * interrupt the current execution priority. This controls whether the
252
- * RDY bit for it in the FPCCR is set.
253
- */
254
-bool armv7m_nvic_get_ready_status(NVICState *s, int irq, bool secure);
255
-/**
256
- * armv7m_nvic_raw_execution_priority: return the raw execution priority
257
- * @s: the NVIC
258
- *
259
- * Returns: the raw execution priority as defined by the v8M architecture.
260
- * This is the execution priority minus the effects of AIRCR.PRIS,
261
- * and minus any PRIMASK/FAULTMASK/BASEPRI priority boosting.
262
- * (v8M ARM ARM I_PKLD.)
263
- */
264
-int armv7m_nvic_raw_execution_priority(NVICState *s);
265
-/**
266
- * armv7m_nvic_neg_prio_requested: return true if the requested execution
267
- * priority is negative for the specified security state.
268
- * @s: the NVIC
269
- * @secure: the security state to test
270
- * This corresponds to the pseudocode IsReqExecPriNeg().
271
- */
272
-#ifndef CONFIG_USER_ONLY
273
-bool armv7m_nvic_neg_prio_requested(NVICState *s, bool secure);
274
-#else
275
-static inline bool armv7m_nvic_neg_prio_requested(NVICState *s, bool secure)
276
-{
277
- return false;
278
-}
279
-#endif
280
-
281
/* Interface for defining coprocessor registers.
282
* Registers are defined in tables of arm_cp_reginfo structs
283
* which are passed to define_arm_cp_regs().
284
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
285
index XXXXXXX..XXXXXXX 100644
286
--- a/target/arm/cpu.c
287
+++ b/target/arm/cpu.c
288
@@ -XXX,XX +XXX,XX @@
289
#if !defined(CONFIG_USER_ONLY)
290
#include "hw/loader.h"
291
#include "hw/boards.h"
292
+#ifdef CONFIG_TCG
293
#include "hw/intc/armv7m_nvic.h"
294
-#endif
295
+#endif /* CONFIG_TCG */
296
+#endif /* !CONFIG_USER_ONLY */
297
#include "sysemu/tcg.h"
298
#include "sysemu/qtest.h"
299
#include "sysemu/hw_accel.h"
300
diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c
301
index XXXXXXX..XXXXXXX 100644
302
--- a/target/arm/cpu_tcg.c
303
+++ b/target/arm/cpu_tcg.c
304
@@ -XXX,XX +XXX,XX @@
305
#include "hw/boards.h"
306
#endif
307
#include "cpregs.h"
308
+#if !defined(CONFIG_USER_ONLY) && defined(CONFIG_TCG)
309
+#include "hw/intc/armv7m_nvic.h"
310
+#endif
311
312
313
/* Share AArch32 -cpu max features with AArch64. */
314
diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c
315
index XXXXXXX..XXXXXXX 100644
316
--- a/target/arm/m_helper.c
317
+++ b/target/arm/m_helper.c
318
@@ -XXX,XX +XXX,XX @@
319
#include "exec/cpu_ldst.h"
320
#include "semihosting/common-semi.h"
321
#endif
322
+#if !defined(CONFIG_USER_ONLY)
323
+#include "hw/intc/armv7m_nvic.h"
324
+#endif
325
326
static void v7m_msr_xpsr(CPUARMState *env, uint32_t mask,
327
uint32_t reg, uint32_t val)
328
--
41
--
329
2.34.1
42
2.34.1
330
331
diff view generated by jsdifflib
1
From: Fabiano Rosas <farosas@suse.de>
1
From: Mostafa Saleh <smostafa@google.com>
2
2
3
This allows the test to be skipped when TCG is not present in the QEMU
3
In preparation for adding stage-2 support, add a S2 config
4
binary.
4
struct(SMMUS2Cfg), composed of the following fields and embedded in
5
the main SMMUTransCfg:
6
-tsz: Size of IPA input region (S2T0SZ)
7
-sl0: Start level of translation (S2SL0)
8
-affd: AF Fault Disable (S2AFFD)
9
-record_faults: Record fault events (S2R)
10
-granule_sz: Granule page shift (based on S2TG)
11
-vmid: Virtual Machine ID (S2VMID)
12
-vttb: Address of translation table base (S2TTB)
13
-eff_ps: Effective PA output range (based on S2PS)
5
14
6
Signed-off-by: Fabiano Rosas <farosas@suse.de>
15
They will be used in the next patches in stage-2 address translation.
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
16
8
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
17
The fields in SMMUS2Cfg, are reordered to make the shared and stage-1
18
fields next to each other, this reordering didn't change the struct
19
size (104 bytes before and after).
20
21
Stage-1 only fields: aa64, asid, tt, ttb, tbi, record_faults, oas.
22
oas is stage-1 output address size. However, it is used to check
23
input address in case stage-1 is unimplemented or bypassed according
24
to SMMUv3 manual IHI0070.E "3.4. Address sizes"
25
26
Shared fields: stage, disabled, bypassed, aborted, iotlb_*.
27
28
No functional change intended.
29
30
Reviewed-by: Eric Auger <eric.auger@redhat.com>
31
Signed-off-by: Mostafa Saleh <smostafa@google.com>
32
Tested-by: Eric Auger <eric.auger@redhat.com>
33
Tested-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
34
Message-id: 20230516203327.2051088-3-smostafa@google.com
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
35
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
36
---
11
tests/avocado/boot_linux_console.py | 1 +
37
include/hw/arm/smmu-common.h | 22 +++++++++++++++++++---
12
tests/avocado/reverse_debugging.py | 8 ++++++++
38
1 file changed, 19 insertions(+), 3 deletions(-)
13
2 files changed, 9 insertions(+)
14
39
15
diff --git a/tests/avocado/boot_linux_console.py b/tests/avocado/boot_linux_console.py
40
diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h
16
index XXXXXXX..XXXXXXX 100644
41
index XXXXXXX..XXXXXXX 100644
17
--- a/tests/avocado/boot_linux_console.py
42
--- a/include/hw/arm/smmu-common.h
18
+++ b/tests/avocado/boot_linux_console.py
43
+++ b/include/hw/arm/smmu-common.h
19
@@ -XXX,XX +XXX,XX @@ def test_arm_orangepi_uboot_netbsd9(self):
44
@@ -XXX,XX +XXX,XX @@ typedef struct SMMUTLBEntry {
20
45
uint8_t granule;
21
def test_aarch64_raspi3_atf(self):
46
} SMMUTLBEntry;
22
"""
47
23
+ :avocado: tags=accel:tcg
48
+/* Stage-2 configuration. */
24
:avocado: tags=arch:aarch64
49
+typedef struct SMMUS2Cfg {
25
:avocado: tags=machine:raspi3b
50
+ uint8_t tsz; /* Size of IPA input region (S2T0SZ) */
26
:avocado: tags=cpu:cortex-a53
51
+ uint8_t sl0; /* Start level of translation (S2SL0) */
27
diff --git a/tests/avocado/reverse_debugging.py b/tests/avocado/reverse_debugging.py
52
+ bool affd; /* AF Fault Disable (S2AFFD) */
28
index XXXXXXX..XXXXXXX 100644
53
+ bool record_faults; /* Record fault events (S2R) */
29
--- a/tests/avocado/reverse_debugging.py
54
+ uint8_t granule_sz; /* Granule page shift (based on S2TG) */
30
+++ b/tests/avocado/reverse_debugging.py
55
+ uint8_t eff_ps; /* Effective PA output range (based on S2PS) */
31
@@ -XXX,XX +XXX,XX @@ def reverse_debugging(self, shift=7, args=None):
56
+ uint16_t vmid; /* Virtual Machine ID (S2VMID) */
32
vm.shutdown()
57
+ uint64_t vttb; /* Address of translation table base (S2TTB) */
33
58
+} SMMUS2Cfg;
34
class ReverseDebugging_X86_64(ReverseDebugging):
35
+ """
36
+ :avocado: tags=accel:tcg
37
+ """
38
+
59
+
39
REG_PC = 0x10
60
/*
40
REG_CS = 0x12
61
* Generic structure populated by derived SMMU devices
41
def get_pc(self, g):
62
* after decoding the configuration information and used as
42
@@ -XXX,XX +XXX,XX @@ def test_x86_64_pc(self):
63
* input to the page table walk
43
self.reverse_debugging()
64
*/
44
65
typedef struct SMMUTransCfg {
45
class ReverseDebugging_AArch64(ReverseDebugging):
66
+ /* Shared fields between stage-1 and stage-2. */
46
+ """
67
int stage; /* translation stage */
47
+ :avocado: tags=accel:tcg
68
- bool aa64; /* arch64 or aarch32 translation table */
48
+ """
69
bool disabled; /* smmu is disabled */
49
+
70
bool bypassed; /* translation is bypassed */
50
REG_PC = 32
71
bool aborted; /* translation is aborted */
51
72
+ uint32_t iotlb_hits; /* counts IOTLB hits */
52
# unidentified gitlab timeout problem
73
+ uint32_t iotlb_misses; /* counts IOTLB misses*/
74
+ /* Used by stage-1 only. */
75
+ bool aa64; /* arch64 or aarch32 translation table */
76
bool record_faults; /* record fault events */
77
uint64_t ttb; /* TT base address */
78
uint8_t oas; /* output address width */
79
uint8_t tbi; /* Top Byte Ignore */
80
uint16_t asid;
81
SMMUTransTableInfo tt[2];
82
- uint32_t iotlb_hits; /* counts IOTLB hits for this asid */
83
- uint32_t iotlb_misses; /* counts IOTLB misses for this asid */
84
+ /* Used by stage-2 only. */
85
+ struct SMMUS2Cfg s2cfg;
86
} SMMUTransCfg;
87
88
typedef struct SMMUDevice {
53
--
89
--
54
2.34.1
90
2.34.1
55
56
diff view generated by jsdifflib
1
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
1
From: Mostafa Saleh <smostafa@google.com>
2
2
3
Addresses targeting the second translation table (TTB1) in the SMMU have
3
In preparation for adding stage-2 support, rename smmu_ptw_64 to
4
all upper bits set. Ensure the IOMMU region covers all 64 bits.
4
smmu_ptw_64_s1 and refactor some of the code so it can be reused in
5
stage-2 page table walk.
5
6
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Remove AA64 check from PTW as decode_cd already ensures that AA64 is
7
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
8
used, otherwise it faults with C_BAD_CD.
9
10
A stage member is added to SMMUPTWEventInfo to differentiate
11
between stage-1 and stage-2 ptw faults.
12
13
Add stage argument to trace_smmu_ptw_level be consistent with other
14
trace events.
15
16
Signed-off-by: Mostafa Saleh <smostafa@google.com>
8
Reviewed-by: Eric Auger <eric.auger@redhat.com>
17
Reviewed-by: Eric Auger <eric.auger@redhat.com>
9
Message-id: 20230214171921.1917916-2-jean-philippe@linaro.org
18
Tested-by: Eric Auger <eric.auger@redhat.com>
19
Tested-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
20
Message-id: 20230516203327.2051088-4-smostafa@google.com
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
21
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
22
---
12
include/hw/arm/smmu-common.h | 2 --
23
include/hw/arm/smmu-common.h | 16 +++++++++++++---
13
hw/arm/smmu-common.c | 2 +-
24
hw/arm/smmu-common.c | 27 ++++++++++-----------------
14
2 files changed, 1 insertion(+), 3 deletions(-)
25
hw/arm/smmuv3.c | 2 ++
26
hw/arm/trace-events | 2 +-
27
4 files changed, 26 insertions(+), 21 deletions(-)
15
28
16
diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h
29
diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h
17
index XXXXXXX..XXXXXXX 100644
30
index XXXXXXX..XXXXXXX 100644
18
--- a/include/hw/arm/smmu-common.h
31
--- a/include/hw/arm/smmu-common.h
19
+++ b/include/hw/arm/smmu-common.h
32
+++ b/include/hw/arm/smmu-common.h
20
@@ -XXX,XX +XXX,XX @@
33
@@ -XXX,XX +XXX,XX @@
21
#define SMMU_PCI_DEVFN_MAX 256
34
#include "hw/pci/pci.h"
22
#define SMMU_PCI_DEVFN(sid) (sid & 0xFF)
35
#include "qom/object.h"
23
36
24
-#define SMMU_MAX_VA_BITS 48
37
-#define SMMU_PCI_BUS_MAX 256
25
-
38
-#define SMMU_PCI_DEVFN_MAX 256
39
-#define SMMU_PCI_DEVFN(sid) (sid & 0xFF)
40
+#define SMMU_PCI_BUS_MAX 256
41
+#define SMMU_PCI_DEVFN_MAX 256
42
+#define SMMU_PCI_DEVFN(sid) (sid & 0xFF)
43
+
44
+/* VMSAv8-64 Translation constants and functions */
45
+#define VMSA_LEVELS 4
46
+
47
+#define VMSA_STRIDE(gran) ((gran) - VMSA_LEVELS + 1)
48
+#define VMSA_BIT_LVL(isz, strd, lvl) ((isz) - (strd) * \
49
+ (VMSA_LEVELS - (lvl)))
50
+#define VMSA_IDXMSK(isz, strd, lvl) ((1ULL << \
51
+ VMSA_BIT_LVL(isz, strd, lvl)) - 1)
52
26
/*
53
/*
27
* Page table walk error types
54
* Page table walk error types
28
*/
55
@@ -XXX,XX +XXX,XX @@ typedef enum {
56
} SMMUPTWEventType;
57
58
typedef struct SMMUPTWEventInfo {
59
+ int stage;
60
SMMUPTWEventType type;
61
dma_addr_t addr; /* fetched address that induced an abort, if any */
62
} SMMUPTWEventInfo;
29
diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
63
diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
30
index XXXXXXX..XXXXXXX 100644
64
index XXXXXXX..XXXXXXX 100644
31
--- a/hw/arm/smmu-common.c
65
--- a/hw/arm/smmu-common.c
32
+++ b/hw/arm/smmu-common.c
66
+++ b/hw/arm/smmu-common.c
33
@@ -XXX,XX +XXX,XX @@ static AddressSpace *smmu_find_add_as(PCIBus *bus, void *opaque, int devfn)
67
@@ -XXX,XX +XXX,XX @@ SMMUTransTableInfo *select_tt(SMMUTransCfg *cfg, dma_addr_t iova)
34
68
}
35
memory_region_init_iommu(&sdev->iommu, sizeof(sdev->iommu),
69
36
s->mrtypename,
70
/**
37
- OBJECT(s), name, 1ULL << SMMU_MAX_VA_BITS);
71
- * smmu_ptw_64 - VMSAv8-64 Walk of the page tables for a given IOVA
38
+ OBJECT(s), name, UINT64_MAX);
72
+ * smmu_ptw_64_s1 - VMSAv8-64 Walk of the page tables for a given IOVA
39
address_space_init(&sdev->as,
73
* @cfg: translation config
40
MEMORY_REGION(&sdev->iommu), name);
74
* @iova: iova to translate
41
trace_smmu_add_mr(name);
75
* @perm: access type
76
@@ -XXX,XX +XXX,XX @@ SMMUTransTableInfo *select_tt(SMMUTransCfg *cfg, dma_addr_t iova)
77
* Upon success, @tlbe is filled with translated_addr and entry
78
* permission rights.
79
*/
80
-static int smmu_ptw_64(SMMUTransCfg *cfg,
81
- dma_addr_t iova, IOMMUAccessFlags perm,
82
- SMMUTLBEntry *tlbe, SMMUPTWEventInfo *info)
83
+static int smmu_ptw_64_s1(SMMUTransCfg *cfg,
84
+ dma_addr_t iova, IOMMUAccessFlags perm,
85
+ SMMUTLBEntry *tlbe, SMMUPTWEventInfo *info)
86
{
87
dma_addr_t baseaddr, indexmask;
88
int stage = cfg->stage;
89
@@ -XXX,XX +XXX,XX @@ static int smmu_ptw_64(SMMUTransCfg *cfg,
90
}
91
92
granule_sz = tt->granule_sz;
93
- stride = granule_sz - 3;
94
+ stride = VMSA_STRIDE(granule_sz);
95
inputsize = 64 - tt->tsz;
96
level = 4 - (inputsize - 4) / stride;
97
- indexmask = (1ULL << (inputsize - (stride * (4 - level)))) - 1;
98
+ indexmask = VMSA_IDXMSK(inputsize, stride, level);
99
baseaddr = extract64(tt->ttb, 0, 48);
100
baseaddr &= ~indexmask;
101
102
- while (level <= 3) {
103
+ while (level < VMSA_LEVELS) {
104
uint64_t subpage_size = 1ULL << level_shift(level, granule_sz);
105
uint64_t mask = subpage_size - 1;
106
uint32_t offset = iova_level_offset(iova, inputsize, level, granule_sz);
107
@@ -XXX,XX +XXX,XX @@ static int smmu_ptw_64(SMMUTransCfg *cfg,
108
if (get_pte(baseaddr, offset, &pte, info)) {
109
goto error;
110
}
111
- trace_smmu_ptw_level(level, iova, subpage_size,
112
+ trace_smmu_ptw_level(stage, level, iova, subpage_size,
113
baseaddr, offset, pte);
114
115
if (is_invalid_pte(pte) || is_reserved_pte(pte, level)) {
116
@@ -XXX,XX +XXX,XX @@ static int smmu_ptw_64(SMMUTransCfg *cfg,
117
info->type = SMMU_PTW_ERR_TRANSLATION;
118
119
error:
120
+ info->stage = 1;
121
tlbe->entry.perm = IOMMU_NONE;
122
return -EINVAL;
123
}
124
@@ -XXX,XX +XXX,XX @@ error:
125
int smmu_ptw(SMMUTransCfg *cfg, dma_addr_t iova, IOMMUAccessFlags perm,
126
SMMUTLBEntry *tlbe, SMMUPTWEventInfo *info)
127
{
128
- if (!cfg->aa64) {
129
- /*
130
- * This code path is not entered as we check this while decoding
131
- * the configuration data in the derived SMMU model.
132
- */
133
- g_assert_not_reached();
134
- }
135
-
136
- return smmu_ptw_64(cfg, iova, perm, tlbe, info);
137
+ return smmu_ptw_64_s1(cfg, iova, perm, tlbe, info);
138
}
139
140
/**
141
diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
142
index XXXXXXX..XXXXXXX 100644
143
--- a/hw/arm/smmuv3.c
144
+++ b/hw/arm/smmuv3.c
145
@@ -XXX,XX +XXX,XX @@ static IOMMUTLBEntry smmuv3_translate(IOMMUMemoryRegion *mr, hwaddr addr,
146
cached_entry = g_new0(SMMUTLBEntry, 1);
147
148
if (smmu_ptw(cfg, aligned_addr, flag, cached_entry, &ptw_info)) {
149
+ /* All faults from PTW has S2 field. */
150
+ event.u.f_walk_eabt.s2 = (ptw_info.stage == 2);
151
g_free(cached_entry);
152
switch (ptw_info.type) {
153
case SMMU_PTW_ERR_WALK_EABT:
154
diff --git a/hw/arm/trace-events b/hw/arm/trace-events
155
index XXXXXXX..XXXXXXX 100644
156
--- a/hw/arm/trace-events
157
+++ b/hw/arm/trace-events
158
@@ -XXX,XX +XXX,XX @@ virt_acpi_setup(void) "No fw cfg or ACPI disabled. Bailing out."
159
160
# smmu-common.c
161
smmu_add_mr(const char *name) "%s"
162
-smmu_ptw_level(int level, uint64_t iova, size_t subpage_size, uint64_t baseaddr, uint32_t offset, uint64_t pte) "level=%d iova=0x%"PRIx64" subpage_sz=0x%zx baseaddr=0x%"PRIx64" offset=%d => pte=0x%"PRIx64
163
+smmu_ptw_level(int stage, int level, uint64_t iova, size_t subpage_size, uint64_t baseaddr, uint32_t offset, uint64_t pte) "stage=%d level=%d iova=0x%"PRIx64" subpage_sz=0x%zx baseaddr=0x%"PRIx64" offset=%d => pte=0x%"PRIx64
164
smmu_ptw_invalid_pte(int stage, int level, uint64_t baseaddr, uint64_t pteaddr, uint32_t offset, uint64_t pte) "stage=%d level=%d base@=0x%"PRIx64" pte@=0x%"PRIx64" offset=%d pte=0x%"PRIx64
165
smmu_ptw_page_pte(int stage, int level, uint64_t iova, uint64_t baseaddr, uint64_t pteaddr, uint64_t pte, uint64_t address) "stage=%d level=%d iova=0x%"PRIx64" base@=0x%"PRIx64" pte@=0x%"PRIx64" pte=0x%"PRIx64" page address = 0x%"PRIx64
166
smmu_ptw_block_pte(int stage, int level, uint64_t baseaddr, uint64_t pteaddr, uint64_t pte, uint64_t iova, uint64_t gpa, int bsize_mb) "stage=%d level=%d base@=0x%"PRIx64" pte@=0x%"PRIx64" pte=0x%"PRIx64" iova=0x%"PRIx64" block address = 0x%"PRIx64" block size = %d MiB"
42
--
167
--
43
2.34.1
168
2.34.1
diff view generated by jsdifflib
1
From: Fabiano Rosas <farosas@suse.de>
1
From: Mostafa Saleh <smostafa@google.com>
2
2
3
Since commit cf7c6d1004 ("target/arm: Split out cpregs.h") we now have
3
In preparation for adding stage-2 support, add Stage-2 PTW code.
4
a cpregs.h header which is more suitable for this code.
4
Only Aarch64 format is supported as stage-1.
5
5
6
Code moved verbatim.
6
Nesting stage-1 and stage-2 is not supported right now.
7
7
8
Signed-off-by: Fabiano Rosas <farosas@suse.de>
8
HTTU is not supported, SW is expected to maintain the Access flag.
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
This is described in the SMMUv3 manual(IHI 0070.E.a)
10
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
10
"5.2. Stream Table Entry" in "[181] S2AFFD".
11
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
11
This flag determines the behavior on access of a stage-2 page whose
12
descriptor has AF == 0:
13
- 0b0: An Access flag fault occurs (stall not supported).
14
- 0b1: An Access flag fault never occurs.
15
An Access fault takes priority over a Permission fault.
16
17
There are 3 address size checks for stage-2 according to
18
(IHI 0070.E.a) in "3.4. Address sizes".
19
- As nesting is not supported, input address is passed directly to
20
stage-2, and is checked against IAS.
21
We use cfg->oas to hold the OAS when stage-1 is not used, this is set
22
in the next patch.
23
This check is done outside of smmu_ptw_64_s2 as it is not part of
24
stage-2(it throws stage-1 fault), and the stage-2 function shouldn't
25
change it's behavior when nesting is supported.
26
When nesting is supported and we figure out how to combine TLB for
27
stage-1 and stage-2 we can move this check into the stage-1 function
28
as described in ARM DDI0487I.a in pseudocode
29
aarch64/translation/vmsa_translation/AArch64.S1Translate
30
aarch64/translation/vmsa_translation/AArch64.S1DisabledOutput
31
32
- Input to stage-2 is checked against s2t0sz, and throws stage-2
33
transaltion fault if exceeds it.
34
35
- Output of stage-2 is checked against effective PA output range.
36
37
Reviewed-by: Eric Auger <eric.auger@redhat.com>
38
Signed-off-by: Mostafa Saleh <smostafa@google.com>
39
Tested-by: Eric Auger <eric.auger@redhat.com>
40
Tested-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
41
Message-id: 20230516203327.2051088-5-smostafa@google.com
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
42
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
43
---
14
target/arm/cpregs.h | 98 +++++++++++++++++++++++++++++++++++++++++++++
44
hw/arm/smmu-internal.h | 35 ++++++++++
15
target/arm/cpu.h | 91 -----------------------------------------
45
hw/arm/smmu-common.c | 142 ++++++++++++++++++++++++++++++++++++++++-
16
2 files changed, 98 insertions(+), 91 deletions(-)
46
2 files changed, 176 insertions(+), 1 deletion(-)
17
47
18
diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h
48
diff --git a/hw/arm/smmu-internal.h b/hw/arm/smmu-internal.h
19
index XXXXXXX..XXXXXXX 100644
49
index XXXXXXX..XXXXXXX 100644
20
--- a/target/arm/cpregs.h
50
--- a/hw/arm/smmu-internal.h
21
+++ b/target/arm/cpregs.h
51
+++ b/hw/arm/smmu-internal.h
22
@@ -XXX,XX +XXX,XX @@ enum {
52
@@ -XXX,XX +XXX,XX @@
23
ARM_CP_SME = 1 << 19,
53
#define PTE_APTABLE(pte) \
24
};
54
(extract64(pte, 61, 2))
25
55
56
+#define PTE_AF(pte) \
57
+ (extract64(pte, 10, 1))
58
/*
59
* TODO: At the moment all transactions are considered as privileged (EL1)
60
* as IOMMU translation callback does not pass user/priv attributes.
61
@@ -XXX,XX +XXX,XX @@
62
#define is_permission_fault(ap, perm) \
63
(((perm) & IOMMU_WO) && ((ap) & 0x2))
64
65
+#define is_permission_fault_s2(s2ap, perm) \
66
+ (!(((s2ap) & (perm)) == (perm)))
67
+
68
#define PTE_AP_TO_PERM(ap) \
69
(IOMMU_ACCESS_FLAG(true, !((ap) & 0x2)))
70
71
@@ -XXX,XX +XXX,XX @@ uint64_t iova_level_offset(uint64_t iova, int inputsize,
72
MAKE_64BIT_MASK(0, gsz - 3);
73
}
74
75
+/* FEAT_LPA2 and FEAT_TTST are not implemented. */
76
+static inline int get_start_level(int sl0 , int granule_sz)
77
+{
78
+ /* ARM DDI0487I.a: Table D8-12. */
79
+ if (granule_sz == 12) {
80
+ return 2 - sl0;
81
+ }
82
+ /* ARM DDI0487I.a: Table D8-22 and Table D8-31. */
83
+ return 3 - sl0;
84
+}
85
+
26
+/*
86
+/*
27
+ * Interface for defining coprocessor registers.
87
+ * Index in a concatenated first level stage-2 page table.
28
+ * Registers are defined in tables of arm_cp_reginfo structs
88
+ * ARM DDI0487I.a: D8.2.2 Concatenated translation tables.
29
+ * which are passed to define_arm_cp_regs().
30
+ */
89
+ */
31
+
90
+static inline int pgd_concat_idx(int start_level, int granule_sz,
32
+/*
91
+ dma_addr_t ipa)
33
+ * When looking up a coprocessor register we look for it
92
+{
34
+ * via an integer which encodes all of:
93
+ uint64_t ret;
35
+ * coprocessor number
94
+ /*
36
+ * Crn, Crm, opc1, opc2 fields
95
+ * Get the number of bits handled by next levels, then any extra bits in
37
+ * 32 or 64 bit register (ie is it accessed via MRC/MCR
96
+ * the address should index the concatenated tables. This relation can be
38
+ * or via MRRC/MCRR?)
97
+ * deduced from tables in ARM DDI0487I.a: D8.2.7-9
39
+ * non-secure/secure bank (AArch32 only)
98
+ */
40
+ * We allow 4 bits for opc1 because MRRC/MCRR have a 4 bit field.
99
+ int shift = level_shift(start_level - 1, granule_sz);
41
+ * (In this case crn and opc2 should be zero.)
100
+
42
+ * For AArch64, there is no 32/64 bit size distinction;
101
+ ret = ipa >> shift;
43
+ * instead all registers have a 2 bit op0, 3 bit op1 and op2,
102
+ return ret;
44
+ * and 4 bit CRn and CRm. The encoding patterns are chosen
103
+}
45
+ * to be easy to convert to and from the KVM encodings, and also
104
+
46
+ * so that the hashtable can contain both AArch32 and AArch64
105
#define SMMU_IOTLB_ASID(key) ((key).asid)
47
+ * registers (to allow for interprocessing where we might run
106
48
+ * 32 bit code on a 64 bit core).
107
typedef struct SMMUIOTLBPageInvInfo {
108
diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
109
index XXXXXXX..XXXXXXX 100644
110
--- a/hw/arm/smmu-common.c
111
+++ b/hw/arm/smmu-common.c
112
@@ -XXX,XX +XXX,XX @@ error:
113
return -EINVAL;
114
}
115
116
+/**
117
+ * smmu_ptw_64_s2 - VMSAv8-64 Walk of the page tables for a given ipa
118
+ * for stage-2.
119
+ * @cfg: translation config
120
+ * @ipa: ipa to translate
121
+ * @perm: access type
122
+ * @tlbe: SMMUTLBEntry (out)
123
+ * @info: handle to an error info
124
+ *
125
+ * Return 0 on success, < 0 on error. In case of error, @info is filled
126
+ * and tlbe->perm is set to IOMMU_NONE.
127
+ * Upon success, @tlbe is filled with translated_addr and entry
128
+ * permission rights.
49
+ */
129
+ */
50
+/*
130
+static int smmu_ptw_64_s2(SMMUTransCfg *cfg,
51
+ * This bit is private to our hashtable cpreg; in KVM register
131
+ dma_addr_t ipa, IOMMUAccessFlags perm,
52
+ * IDs the AArch64/32 distinction is the KVM_REG_ARM/ARM64
132
+ SMMUTLBEntry *tlbe, SMMUPTWEventInfo *info)
53
+ * in the upper bits of the 64 bit ID.
54
+ */
55
+#define CP_REG_AA64_SHIFT 28
56
+#define CP_REG_AA64_MASK (1 << CP_REG_AA64_SHIFT)
57
+
58
+/*
59
+ * To enable banking of coprocessor registers depending on ns-bit we
60
+ * add a bit to distinguish between secure and non-secure cpregs in the
61
+ * hashtable.
62
+ */
63
+#define CP_REG_NS_SHIFT 29
64
+#define CP_REG_NS_MASK (1 << CP_REG_NS_SHIFT)
65
+
66
+#define ENCODE_CP_REG(cp, is64, ns, crn, crm, opc1, opc2) \
67
+ ((ns) << CP_REG_NS_SHIFT | ((cp) << 16) | ((is64) << 15) | \
68
+ ((crn) << 11) | ((crm) << 7) | ((opc1) << 3) | (opc2))
69
+
70
+#define ENCODE_AA64_CP_REG(cp, crn, crm, op0, op1, op2) \
71
+ (CP_REG_AA64_MASK | \
72
+ ((cp) << CP_REG_ARM_COPROC_SHIFT) | \
73
+ ((op0) << CP_REG_ARM64_SYSREG_OP0_SHIFT) | \
74
+ ((op1) << CP_REG_ARM64_SYSREG_OP1_SHIFT) | \
75
+ ((crn) << CP_REG_ARM64_SYSREG_CRN_SHIFT) | \
76
+ ((crm) << CP_REG_ARM64_SYSREG_CRM_SHIFT) | \
77
+ ((op2) << CP_REG_ARM64_SYSREG_OP2_SHIFT))
78
+
79
+/*
80
+ * Convert a full 64 bit KVM register ID to the truncated 32 bit
81
+ * version used as a key for the coprocessor register hashtable
82
+ */
83
+static inline uint32_t kvm_to_cpreg_id(uint64_t kvmid)
84
+{
133
+{
85
+ uint32_t cpregid = kvmid;
134
+ const int stage = 2;
86
+ if ((kvmid & CP_REG_ARCH_MASK) == CP_REG_ARM64) {
135
+ int granule_sz = cfg->s2cfg.granule_sz;
87
+ cpregid |= CP_REG_AA64_MASK;
136
+ /* ARM DDI0487I.a: Table D8-7. */
88
+ } else {
137
+ int inputsize = 64 - cfg->s2cfg.tsz;
89
+ if ((kvmid & CP_REG_SIZE_MASK) == CP_REG_SIZE_U64) {
138
+ int level = get_start_level(cfg->s2cfg.sl0, granule_sz);
90
+ cpregid |= (1 << 15);
139
+ int stride = VMSA_STRIDE(granule_sz);
140
+ int idx = pgd_concat_idx(level, granule_sz, ipa);
141
+ /*
142
+ * Get the ttb from concatenated structure.
143
+ * The offset is the idx * size of each ttb(number of ptes * (sizeof(pte))
144
+ */
145
+ uint64_t baseaddr = extract64(cfg->s2cfg.vttb, 0, 48) + (1 << stride) *
146
+ idx * sizeof(uint64_t);
147
+ dma_addr_t indexmask = VMSA_IDXMSK(inputsize, stride, level);
148
+
149
+ baseaddr &= ~indexmask;
150
+
151
+ /*
152
+ * On input, a stage 2 Translation fault occurs if the IPA is outside the
153
+ * range configured by the relevant S2T0SZ field of the STE.
154
+ */
155
+ if (ipa >= (1ULL << inputsize)) {
156
+ info->type = SMMU_PTW_ERR_TRANSLATION;
157
+ goto error;
158
+ }
159
+
160
+ while (level < VMSA_LEVELS) {
161
+ uint64_t subpage_size = 1ULL << level_shift(level, granule_sz);
162
+ uint64_t mask = subpage_size - 1;
163
+ uint32_t offset = iova_level_offset(ipa, inputsize, level, granule_sz);
164
+ uint64_t pte, gpa;
165
+ dma_addr_t pte_addr = baseaddr + offset * sizeof(pte);
166
+ uint8_t s2ap;
167
+
168
+ if (get_pte(baseaddr, offset, &pte, info)) {
169
+ goto error;
170
+ }
171
+ trace_smmu_ptw_level(stage, level, ipa, subpage_size,
172
+ baseaddr, offset, pte);
173
+ if (is_invalid_pte(pte) || is_reserved_pte(pte, level)) {
174
+ trace_smmu_ptw_invalid_pte(stage, level, baseaddr,
175
+ pte_addr, offset, pte);
176
+ break;
177
+ }
178
+
179
+ if (is_table_pte(pte, level)) {
180
+ baseaddr = get_table_pte_address(pte, granule_sz);
181
+ level++;
182
+ continue;
183
+ } else if (is_page_pte(pte, level)) {
184
+ gpa = get_page_pte_address(pte, granule_sz);
185
+ trace_smmu_ptw_page_pte(stage, level, ipa,
186
+ baseaddr, pte_addr, pte, gpa);
187
+ } else {
188
+ uint64_t block_size;
189
+
190
+ gpa = get_block_pte_address(pte, level, granule_sz,
191
+ &block_size);
192
+ trace_smmu_ptw_block_pte(stage, level, baseaddr,
193
+ pte_addr, pte, ipa, gpa,
194
+ block_size >> 20);
91
+ }
195
+ }
92
+
196
+
93
+ /*
197
+ /*
94
+ * KVM is always non-secure so add the NS flag on AArch32 register
198
+ * If S2AFFD and PTE.AF are 0 => fault. (5.2. Stream Table Entry)
95
+ * entries.
199
+ * An Access fault takes priority over a Permission fault.
96
+ */
200
+ */
97
+ cpregid |= 1 << CP_REG_NS_SHIFT;
201
+ if (!PTE_AF(pte) && !cfg->s2cfg.affd) {
98
+ }
202
+ info->type = SMMU_PTW_ERR_ACCESS;
99
+ return cpregid;
203
+ goto error;
204
+ }
205
+
206
+ s2ap = PTE_AP(pte);
207
+ if (is_permission_fault_s2(s2ap, perm)) {
208
+ info->type = SMMU_PTW_ERR_PERMISSION;
209
+ goto error;
210
+ }
211
+
212
+ /*
213
+ * The address output from the translation causes a stage 2 Address
214
+ * Size fault if it exceeds the effective PA output range.
215
+ */
216
+ if (gpa >= (1ULL << cfg->s2cfg.eff_ps)) {
217
+ info->type = SMMU_PTW_ERR_ADDR_SIZE;
218
+ goto error;
219
+ }
220
+
221
+ tlbe->entry.translated_addr = gpa;
222
+ tlbe->entry.iova = ipa & ~mask;
223
+ tlbe->entry.addr_mask = mask;
224
+ tlbe->entry.perm = s2ap;
225
+ tlbe->level = level;
226
+ tlbe->granule = granule_sz;
227
+ return 0;
228
+ }
229
+ info->type = SMMU_PTW_ERR_TRANSLATION;
230
+
231
+error:
232
+ info->stage = 2;
233
+ tlbe->entry.perm = IOMMU_NONE;
234
+ return -EINVAL;
100
+}
235
+}
101
+
236
+
102
+/*
237
/**
103
+ * Convert a truncated 32 bit hashtable key into the full
238
* smmu_ptw - Walk the page tables for an IOVA, according to @cfg
104
+ * 64 bit KVM register ID.
239
*
105
+ */
240
@@ -XXX,XX +XXX,XX @@ error:
106
+static inline uint64_t cpreg_to_kvm_id(uint32_t cpregid)
241
int smmu_ptw(SMMUTransCfg *cfg, dma_addr_t iova, IOMMUAccessFlags perm,
107
+{
242
SMMUTLBEntry *tlbe, SMMUPTWEventInfo *info)
108
+ uint64_t kvmid;
109
+
110
+ if (cpregid & CP_REG_AA64_MASK) {
111
+ kvmid = cpregid & ~CP_REG_AA64_MASK;
112
+ kvmid |= CP_REG_SIZE_U64 | CP_REG_ARM64;
113
+ } else {
114
+ kvmid = cpregid & ~(1 << 15);
115
+ if (cpregid & (1 << 15)) {
116
+ kvmid |= CP_REG_SIZE_U64 | CP_REG_ARM;
117
+ } else {
118
+ kvmid |= CP_REG_SIZE_U32 | CP_REG_ARM;
119
+ }
120
+ }
121
+ return kvmid;
122
+}
123
+
124
/*
125
* Valid values for ARMCPRegInfo state field, indicating which of
126
* the AArch32 and AArch64 execution states this register is visible in.
127
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
128
index XXXXXXX..XXXXXXX 100644
129
--- a/target/arm/cpu.h
130
+++ b/target/arm/cpu.h
131
@@ -XXX,XX +XXX,XX @@ void arm_cpu_list(void);
132
uint32_t arm_phys_excp_target_el(CPUState *cs, uint32_t excp_idx,
133
uint32_t cur_el, bool secure);
134
135
-/* Interface for defining coprocessor registers.
136
- * Registers are defined in tables of arm_cp_reginfo structs
137
- * which are passed to define_arm_cp_regs().
138
- */
139
-
140
-/* When looking up a coprocessor register we look for it
141
- * via an integer which encodes all of:
142
- * coprocessor number
143
- * Crn, Crm, opc1, opc2 fields
144
- * 32 or 64 bit register (ie is it accessed via MRC/MCR
145
- * or via MRRC/MCRR?)
146
- * non-secure/secure bank (AArch32 only)
147
- * We allow 4 bits for opc1 because MRRC/MCRR have a 4 bit field.
148
- * (In this case crn and opc2 should be zero.)
149
- * For AArch64, there is no 32/64 bit size distinction;
150
- * instead all registers have a 2 bit op0, 3 bit op1 and op2,
151
- * and 4 bit CRn and CRm. The encoding patterns are chosen
152
- * to be easy to convert to and from the KVM encodings, and also
153
- * so that the hashtable can contain both AArch32 and AArch64
154
- * registers (to allow for interprocessing where we might run
155
- * 32 bit code on a 64 bit core).
156
- */
157
-/* This bit is private to our hashtable cpreg; in KVM register
158
- * IDs the AArch64/32 distinction is the KVM_REG_ARM/ARM64
159
- * in the upper bits of the 64 bit ID.
160
- */
161
-#define CP_REG_AA64_SHIFT 28
162
-#define CP_REG_AA64_MASK (1 << CP_REG_AA64_SHIFT)
163
-
164
-/* To enable banking of coprocessor registers depending on ns-bit we
165
- * add a bit to distinguish between secure and non-secure cpregs in the
166
- * hashtable.
167
- */
168
-#define CP_REG_NS_SHIFT 29
169
-#define CP_REG_NS_MASK (1 << CP_REG_NS_SHIFT)
170
-
171
-#define ENCODE_CP_REG(cp, is64, ns, crn, crm, opc1, opc2) \
172
- ((ns) << CP_REG_NS_SHIFT | ((cp) << 16) | ((is64) << 15) | \
173
- ((crn) << 11) | ((crm) << 7) | ((opc1) << 3) | (opc2))
174
-
175
-#define ENCODE_AA64_CP_REG(cp, crn, crm, op0, op1, op2) \
176
- (CP_REG_AA64_MASK | \
177
- ((cp) << CP_REG_ARM_COPROC_SHIFT) | \
178
- ((op0) << CP_REG_ARM64_SYSREG_OP0_SHIFT) | \
179
- ((op1) << CP_REG_ARM64_SYSREG_OP1_SHIFT) | \
180
- ((crn) << CP_REG_ARM64_SYSREG_CRN_SHIFT) | \
181
- ((crm) << CP_REG_ARM64_SYSREG_CRM_SHIFT) | \
182
- ((op2) << CP_REG_ARM64_SYSREG_OP2_SHIFT))
183
-
184
-/* Convert a full 64 bit KVM register ID to the truncated 32 bit
185
- * version used as a key for the coprocessor register hashtable
186
- */
187
-static inline uint32_t kvm_to_cpreg_id(uint64_t kvmid)
188
-{
189
- uint32_t cpregid = kvmid;
190
- if ((kvmid & CP_REG_ARCH_MASK) == CP_REG_ARM64) {
191
- cpregid |= CP_REG_AA64_MASK;
192
- } else {
193
- if ((kvmid & CP_REG_SIZE_MASK) == CP_REG_SIZE_U64) {
194
- cpregid |= (1 << 15);
195
- }
196
-
197
- /* KVM is always non-secure so add the NS flag on AArch32 register
198
- * entries.
199
- */
200
- cpregid |= 1 << CP_REG_NS_SHIFT;
201
- }
202
- return cpregid;
203
-}
204
-
205
-/* Convert a truncated 32 bit hashtable key into the full
206
- * 64 bit KVM register ID.
207
- */
208
-static inline uint64_t cpreg_to_kvm_id(uint32_t cpregid)
209
-{
210
- uint64_t kvmid;
211
-
212
- if (cpregid & CP_REG_AA64_MASK) {
213
- kvmid = cpregid & ~CP_REG_AA64_MASK;
214
- kvmid |= CP_REG_SIZE_U64 | CP_REG_ARM64;
215
- } else {
216
- kvmid = cpregid & ~(1 << 15);
217
- if (cpregid & (1 << 15)) {
218
- kvmid |= CP_REG_SIZE_U64 | CP_REG_ARM;
219
- } else {
220
- kvmid |= CP_REG_SIZE_U32 | CP_REG_ARM;
221
- }
222
- }
223
- return kvmid;
224
-}
225
-
226
/* Return the highest implemented Exception Level */
227
static inline int arm_highest_el(CPUARMState *env)
228
{
243
{
244
- return smmu_ptw_64_s1(cfg, iova, perm, tlbe, info);
245
+ if (cfg->stage == 1) {
246
+ return smmu_ptw_64_s1(cfg, iova, perm, tlbe, info);
247
+ } else if (cfg->stage == 2) {
248
+ /*
249
+ * If bypassing stage 1(or unimplemented), the input address is passed
250
+ * directly to stage 2 as IPA. If the input address of a transaction
251
+ * exceeds the size of the IAS, a stage 1 Address Size fault occurs.
252
+ * For AA64, IAS = OAS according to (IHI 0070.E.a) "3.4 Address sizes"
253
+ */
254
+ if (iova >= (1ULL << cfg->oas)) {
255
+ info->type = SMMU_PTW_ERR_ADDR_SIZE;
256
+ info->stage = 1;
257
+ tlbe->entry.perm = IOMMU_NONE;
258
+ return -EINVAL;
259
+ }
260
+
261
+ return smmu_ptw_64_s2(cfg, iova, perm, tlbe, info);
262
+ }
263
+
264
+ g_assert_not_reached();
265
}
266
267
/**
229
--
268
--
230
2.34.1
269
2.34.1
231
232
diff view generated by jsdifflib
1
From: Mostafa Saleh <smostafa@google.com>
1
From: Mostafa Saleh <smostafa@google.com>
2
2
3
GBPA register can be used to globally abort all
3
Parse stage-2 configuration from STE and populate it in SMMUS2Cfg.
4
transactions.
4
Validity of field values are checked when possible.
5
5
6
It is described in the SMMU manual in "6.3.14 SMMU_GBPA".
6
Only AA64 tables are supported and Small Translation Tables (STT) are
7
ABORT reset value is IMPLEMENTATION DEFINED, it is chosen to
7
not supported.
8
be zero(Do not abort incoming transactions).
8
9
9
According to SMMUv3 UM(IHI0070E) "5.2 Stream Table Entry": All fields
10
Other fields have default values of Use Incoming.
10
with an S2 prefix (with the exception of S2VMID) are IGNORED when
11
11
stage-2 bypasses translation (Config[1] == 0).
12
If UPDATE is not set, the write is ignored. This is the only permitted
12
13
behavior in SMMUv3.2 and later.(6.3.14.1 Update procedure)
13
Which means that VMID can be used(for TLB tagging) even if stage-2 is
14
14
bypassed, so we parse it unconditionally when S2P exists. Otherwise
15
As this patch adds a new state to the SMMU (GBPA), it is added
15
it is set to -1.(only S1P)
16
in a new subsection for forward migration compatibility.
16
17
GBPA is only migrated if its value is different from the reset value.
17
As stall is not supported, if S2S is set the translation would abort.
18
It does this to be backward migration compatible if SW didn't write
18
For S2R, we reuse the same code used for stage-1 with flag
19
the register.
19
record_faults. However when nested translation is supported we would
20
need to separate stage-1 and stage-2 faults.
21
22
Fix wrong shift in STE_S2HD, STE_S2HA, STE_S2S.
20
23
21
Signed-off-by: Mostafa Saleh <smostafa@google.com>
24
Signed-off-by: Mostafa Saleh <smostafa@google.com>
22
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
25
Tested-by: Eric Auger <eric.auger@redhat.com>
26
Tested-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
23
Reviewed-by: Eric Auger <eric.auger@redhat.com>
27
Reviewed-by: Eric Auger <eric.auger@redhat.com>
24
Message-id: 20230214094009.2445653-1-smostafa@google.com
28
Message-id: 20230516203327.2051088-6-smostafa@google.com
25
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
26
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
29
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
27
---
30
---
28
hw/arm/smmuv3-internal.h | 7 +++++++
31
hw/arm/smmuv3-internal.h | 10 +-
29
include/hw/arm/smmuv3.h | 1 +
32
include/hw/arm/smmu-common.h | 1 +
30
hw/arm/smmuv3.c | 43 +++++++++++++++++++++++++++++++++++++++-
33
include/hw/arm/smmuv3.h | 3 +
31
3 files changed, 50 insertions(+), 1 deletion(-)
34
hw/arm/smmuv3.c | 181 +++++++++++++++++++++++++++++++++--
35
4 files changed, 185 insertions(+), 10 deletions(-)
32
36
33
diff --git a/hw/arm/smmuv3-internal.h b/hw/arm/smmuv3-internal.h
37
diff --git a/hw/arm/smmuv3-internal.h b/hw/arm/smmuv3-internal.h
34
index XXXXXXX..XXXXXXX 100644
38
index XXXXXXX..XXXXXXX 100644
35
--- a/hw/arm/smmuv3-internal.h
39
--- a/hw/arm/smmuv3-internal.h
36
+++ b/hw/arm/smmuv3-internal.h
40
+++ b/hw/arm/smmuv3-internal.h
37
@@ -XXX,XX +XXX,XX @@ REG32(CR0ACK, 0x24)
41
@@ -XXX,XX +XXX,XX @@ typedef struct CD {
38
REG32(CR1, 0x28)
42
#define STE_S2TG(x) extract32((x)->word[5], 14, 2)
39
REG32(CR2, 0x2c)
43
#define STE_S2PS(x) extract32((x)->word[5], 16, 3)
40
REG32(STATUSR, 0x40)
44
#define STE_S2AA64(x) extract32((x)->word[5], 19, 1)
41
+REG32(GBPA, 0x44)
45
-#define STE_S2HD(x) extract32((x)->word[5], 24, 1)
42
+ FIELD(GBPA, ABORT, 20, 1)
46
-#define STE_S2HA(x) extract32((x)->word[5], 25, 1)
43
+ FIELD(GBPA, UPDATE, 31, 1)
47
-#define STE_S2S(x) extract32((x)->word[5], 26, 1)
44
+
48
+#define STE_S2ENDI(x) extract32((x)->word[5], 20, 1)
45
+/* Use incoming. */
49
+#define STE_S2AFFD(x) extract32((x)->word[5], 21, 1)
46
+#define SMMU_GBPA_RESET_VAL 0x1000
50
+#define STE_S2HD(x) extract32((x)->word[5], 23, 1)
47
+
51
+#define STE_S2HA(x) extract32((x)->word[5], 24, 1)
48
REG32(IRQ_CTRL, 0x50)
52
+#define STE_S2S(x) extract32((x)->word[5], 25, 1)
49
FIELD(IRQ_CTRL, GERROR_IRQEN, 0, 1)
53
+#define STE_S2R(x) extract32((x)->word[5], 26, 1)
50
FIELD(IRQ_CTRL, PRI_IRQEN, 1, 1)
54
+
55
#define STE_CTXPTR(x) \
56
({ \
57
unsigned long addr; \
58
diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h
59
index XXXXXXX..XXXXXXX 100644
60
--- a/include/hw/arm/smmu-common.h
61
+++ b/include/hw/arm/smmu-common.h
62
@@ -XXX,XX +XXX,XX @@
63
64
/* VMSAv8-64 Translation constants and functions */
65
#define VMSA_LEVELS 4
66
+#define VMSA_MAX_S2_CONCAT 16
67
68
#define VMSA_STRIDE(gran) ((gran) - VMSA_LEVELS + 1)
69
#define VMSA_BIT_LVL(isz, strd, lvl) ((isz) - (strd) * \
51
diff --git a/include/hw/arm/smmuv3.h b/include/hw/arm/smmuv3.h
70
diff --git a/include/hw/arm/smmuv3.h b/include/hw/arm/smmuv3.h
52
index XXXXXXX..XXXXXXX 100644
71
index XXXXXXX..XXXXXXX 100644
53
--- a/include/hw/arm/smmuv3.h
72
--- a/include/hw/arm/smmuv3.h
54
+++ b/include/hw/arm/smmuv3.h
73
+++ b/include/hw/arm/smmuv3.h
55
@@ -XXX,XX +XXX,XX @@ struct SMMUv3State {
74
@@ -XXX,XX +XXX,XX @@ struct SMMUv3Class {
56
uint32_t cr[3];
75
#define TYPE_ARM_SMMUV3 "arm-smmuv3"
57
uint32_t cr0ack;
76
OBJECT_DECLARE_TYPE(SMMUv3State, SMMUv3Class, ARM_SMMUV3)
58
uint32_t statusr;
77
59
+ uint32_t gbpa;
78
+#define STAGE1_SUPPORTED(s) FIELD_EX32(s->idr[0], IDR0, S1P)
60
uint32_t irq_ctrl;
79
+#define STAGE2_SUPPORTED(s) FIELD_EX32(s->idr[0], IDR0, S2P)
61
uint32_t gerror;
80
+
62
uint32_t gerrorn;
81
#endif
63
diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
82
diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
64
index XXXXXXX..XXXXXXX 100644
83
index XXXXXXX..XXXXXXX 100644
65
--- a/hw/arm/smmuv3.c
84
--- a/hw/arm/smmuv3.c
66
+++ b/hw/arm/smmuv3.c
85
+++ b/hw/arm/smmuv3.c
67
@@ -XXX,XX +XXX,XX @@ static void smmuv3_init_regs(SMMUv3State *s)
86
@@ -XXX,XX +XXX,XX @@
68
s->gerror = 0;
87
#include "smmuv3-internal.h"
69
s->gerrorn = 0;
88
#include "smmu-internal.h"
70
s->statusr = 0;
89
71
+ s->gbpa = SMMU_GBPA_RESET_VAL;
90
+#define PTW_RECORD_FAULT(cfg) (((cfg)->stage == 1) ? (cfg)->record_faults : \
91
+ (cfg)->s2cfg.record_faults)
92
+
93
/**
94
* smmuv3_trigger_irq - pulse @irq if enabled and update
95
* GERROR register in case of GERROR interrupt
96
@@ -XXX,XX +XXX,XX @@ static int smmu_get_cd(SMMUv3State *s, STE *ste, uint32_t ssid,
97
return 0;
72
}
98
}
73
99
74
static int smmu_get_ste(SMMUv3State *s, dma_addr_t addr, STE *buf,
100
+/*
101
+ * Max valid value is 39 when SMMU_IDR3.STT == 0.
102
+ * In architectures after SMMUv3.0:
103
+ * - If STE.S2TG selects a 4KB or 16KB granule, the minimum valid value for this
104
+ * field is MAX(16, 64-IAS)
105
+ * - If STE.S2TG selects a 64KB granule, the minimum valid value for this field
106
+ * is (64-IAS).
107
+ * As we only support AA64, IAS = OAS.
108
+ */
109
+static bool s2t0sz_valid(SMMUTransCfg *cfg)
110
+{
111
+ if (cfg->s2cfg.tsz > 39) {
112
+ return false;
113
+ }
114
+
115
+ if (cfg->s2cfg.granule_sz == 16) {
116
+ return (cfg->s2cfg.tsz >= 64 - oas2bits(SMMU_IDR5_OAS));
117
+ }
118
+
119
+ return (cfg->s2cfg.tsz >= MAX(64 - oas2bits(SMMU_IDR5_OAS), 16));
120
+}
121
+
122
+/*
123
+ * Return true if s2 page table config is valid.
124
+ * This checks with the configured start level, ias_bits and granularity we can
125
+ * have a valid page table as described in ARM ARM D8.2 Translation process.
126
+ * The idea here is to see for the highest possible number of IPA bits, how
127
+ * many concatenated tables we would need, if it is more than 16, then this is
128
+ * not possible.
129
+ */
130
+static bool s2_pgtable_config_valid(uint8_t sl0, uint8_t t0sz, uint8_t gran)
131
+{
132
+ int level = get_start_level(sl0, gran);
133
+ uint64_t ipa_bits = 64 - t0sz;
134
+ uint64_t max_ipa = (1ULL << ipa_bits) - 1;
135
+ int nr_concat = pgd_concat_idx(level, gran, max_ipa) + 1;
136
+
137
+ return nr_concat <= VMSA_MAX_S2_CONCAT;
138
+}
139
+
140
+static int decode_ste_s2_cfg(SMMUTransCfg *cfg, STE *ste)
141
+{
142
+ cfg->stage = 2;
143
+
144
+ if (STE_S2AA64(ste) == 0x0) {
145
+ qemu_log_mask(LOG_UNIMP,
146
+ "SMMUv3 AArch32 tables not supported\n");
147
+ g_assert_not_reached();
148
+ }
149
+
150
+ switch (STE_S2TG(ste)) {
151
+ case 0x0: /* 4KB */
152
+ cfg->s2cfg.granule_sz = 12;
153
+ break;
154
+ case 0x1: /* 64KB */
155
+ cfg->s2cfg.granule_sz = 16;
156
+ break;
157
+ case 0x2: /* 16KB */
158
+ cfg->s2cfg.granule_sz = 14;
159
+ break;
160
+ default:
161
+ qemu_log_mask(LOG_GUEST_ERROR,
162
+ "SMMUv3 bad STE S2TG: %x\n", STE_S2TG(ste));
163
+ goto bad_ste;
164
+ }
165
+
166
+ cfg->s2cfg.vttb = STE_S2TTB(ste);
167
+
168
+ cfg->s2cfg.sl0 = STE_S2SL0(ste);
169
+ /* FEAT_TTST not supported. */
170
+ if (cfg->s2cfg.sl0 == 0x3) {
171
+ qemu_log_mask(LOG_UNIMP, "SMMUv3 S2SL0 = 0x3 has no meaning!\n");
172
+ goto bad_ste;
173
+ }
174
+
175
+ /* For AA64, The effective S2PS size is capped to the OAS. */
176
+ cfg->s2cfg.eff_ps = oas2bits(MIN(STE_S2PS(ste), SMMU_IDR5_OAS));
177
+ /*
178
+ * It is ILLEGAL for the address in S2TTB to be outside the range
179
+ * described by the effective S2PS value.
180
+ */
181
+ if (cfg->s2cfg.vttb & ~(MAKE_64BIT_MASK(0, cfg->s2cfg.eff_ps))) {
182
+ qemu_log_mask(LOG_GUEST_ERROR,
183
+ "SMMUv3 S2TTB too large 0x%lx, effective PS %d bits\n",
184
+ cfg->s2cfg.vttb, cfg->s2cfg.eff_ps);
185
+ goto bad_ste;
186
+ }
187
+
188
+ cfg->s2cfg.tsz = STE_S2T0SZ(ste);
189
+
190
+ if (!s2t0sz_valid(cfg)) {
191
+ qemu_log_mask(LOG_GUEST_ERROR, "SMMUv3 bad STE S2T0SZ = %d\n",
192
+ cfg->s2cfg.tsz);
193
+ goto bad_ste;
194
+ }
195
+
196
+ if (!s2_pgtable_config_valid(cfg->s2cfg.sl0, cfg->s2cfg.tsz,
197
+ cfg->s2cfg.granule_sz)) {
198
+ qemu_log_mask(LOG_GUEST_ERROR,
199
+ "SMMUv3 STE stage 2 config not valid!\n");
200
+ goto bad_ste;
201
+ }
202
+
203
+ /* Only LE supported(IDR0.TTENDIAN). */
204
+ if (STE_S2ENDI(ste)) {
205
+ qemu_log_mask(LOG_GUEST_ERROR,
206
+ "SMMUv3 STE_S2ENDI only supports LE!\n");
207
+ goto bad_ste;
208
+ }
209
+
210
+ cfg->s2cfg.affd = STE_S2AFFD(ste);
211
+
212
+ cfg->s2cfg.record_faults = STE_S2R(ste);
213
+ /* As stall is not supported. */
214
+ if (STE_S2S(ste)) {
215
+ qemu_log_mask(LOG_UNIMP, "SMMUv3 Stall not implemented!\n");
216
+ goto bad_ste;
217
+ }
218
+
219
+ /* This is still here as stage 2 has not been fully enabled yet. */
220
+ qemu_log_mask(LOG_UNIMP, "SMMUv3 does not support stage 2 yet\n");
221
+ goto bad_ste;
222
+
223
+ return 0;
224
+
225
+bad_ste:
226
+ return -EINVAL;
227
+}
228
+
229
/* Returns < 0 in case of invalid STE, 0 otherwise */
230
static int decode_ste(SMMUv3State *s, SMMUTransCfg *cfg,
231
STE *ste, SMMUEventInfo *event)
232
{
233
uint32_t config;
234
+ int ret;
235
236
if (!STE_VALID(ste)) {
237
if (!event->inval_ste_allowed) {
238
@@ -XXX,XX +XXX,XX @@ static int decode_ste(SMMUv3State *s, SMMUTransCfg *cfg,
239
return 0;
240
}
241
242
- if (STE_CFG_S2_ENABLED(config)) {
243
- qemu_log_mask(LOG_UNIMP, "SMMUv3 does not support stage 2 yet\n");
244
+ /*
245
+ * If a stage is enabled in SW while not advertised, throw bad ste
246
+ * according to user manual(IHI0070E) "5.2 Stream Table Entry".
247
+ */
248
+ if (!STAGE1_SUPPORTED(s) && STE_CFG_S1_ENABLED(config)) {
249
+ qemu_log_mask(LOG_GUEST_ERROR, "SMMUv3 S1 used but not supported.\n");
250
goto bad_ste;
251
}
252
+ if (!STAGE2_SUPPORTED(s) && STE_CFG_S2_ENABLED(config)) {
253
+ qemu_log_mask(LOG_GUEST_ERROR, "SMMUv3 S2 used but not supported.\n");
254
+ goto bad_ste;
255
+ }
256
+
257
+ if (STAGE2_SUPPORTED(s)) {
258
+ /* VMID is considered even if s2 is disabled. */
259
+ cfg->s2cfg.vmid = STE_S2VMID(ste);
260
+ } else {
261
+ /* Default to -1 */
262
+ cfg->s2cfg.vmid = -1;
263
+ }
264
+
265
+ if (STE_CFG_S2_ENABLED(config)) {
266
+ /*
267
+ * Stage-1 OAS defaults to OAS even if not enabled as it would be used
268
+ * in input address check for stage-2.
269
+ */
270
+ cfg->oas = oas2bits(SMMU_IDR5_OAS);
271
+ ret = decode_ste_s2_cfg(cfg, ste);
272
+ if (ret) {
273
+ goto bad_ste;
274
+ }
275
+ }
276
277
if (STE_S1CDMAX(ste) != 0) {
278
qemu_log_mask(LOG_UNIMP,
75
@@ -XXX,XX +XXX,XX @@ static IOMMUTLBEntry smmuv3_translate(IOMMUMemoryRegion *mr, hwaddr addr,
279
@@ -XXX,XX +XXX,XX @@ static IOMMUTLBEntry smmuv3_translate(IOMMUMemoryRegion *mr, hwaddr addr,
76
qemu_mutex_lock(&s->mutex);
280
if (cached_entry) {
77
281
if ((flag & IOMMU_WO) && !(cached_entry->entry.perm & IOMMU_WO)) {
78
if (!smmu_enabled(s)) {
282
status = SMMU_TRANS_ERROR;
79
- status = SMMU_TRANS_DISABLE;
283
- if (cfg->record_faults) {
80
+ if (FIELD_EX32(s->gbpa, GBPA, ABORT)) {
284
+ /*
81
+ status = SMMU_TRANS_ABORT;
285
+ * We know that the TLB only contains either stage-1 or stage-2 as
82
+ } else {
286
+ * nesting is not supported. So it is sufficient to check the
83
+ status = SMMU_TRANS_DISABLE;
287
+ * translation stage to know the TLB stage for now.
84
+ }
288
+ */
85
goto epilogue;
289
+ event.u.f_walk_eabt.s2 = (cfg->stage == 2);
86
}
290
+ if (PTW_RECORD_FAULT(cfg)) {
87
291
event.type = SMMU_EVT_F_PERMISSION;
88
@@ -XXX,XX +XXX,XX @@ static MemTxResult smmu_writel(SMMUv3State *s, hwaddr offset,
292
event.u.f_permission.addr = addr;
89
case A_GERROR_IRQ_CFG2:
293
event.u.f_permission.rnw = flag & 0x1;
90
s->gerror_irq_cfg2 = data;
294
@@ -XXX,XX +XXX,XX @@ static IOMMUTLBEntry smmuv3_translate(IOMMUMemoryRegion *mr, hwaddr addr,
91
return MEMTX_OK;
295
event.u.f_walk_eabt.addr2 = ptw_info.addr;
92
+ case A_GBPA:
296
break;
93
+ /*
297
case SMMU_PTW_ERR_TRANSLATION:
94
+ * If UPDATE is not set, the write is ignored. This is the only
298
- if (cfg->record_faults) {
95
+ * permitted behavior in SMMUv3.2 and later.
299
+ if (PTW_RECORD_FAULT(cfg)) {
96
+ */
300
event.type = SMMU_EVT_F_TRANSLATION;
97
+ if (data & R_GBPA_UPDATE_MASK) {
301
event.u.f_translation.addr = addr;
98
+ /* Ignore update bit as write is synchronous. */
302
event.u.f_translation.rnw = flag & 0x1;
99
+ s->gbpa = data & ~R_GBPA_UPDATE_MASK;
303
}
100
+ }
304
break;
101
+ return MEMTX_OK;
305
case SMMU_PTW_ERR_ADDR_SIZE:
102
case A_STRTAB_BASE: /* 64b */
306
- if (cfg->record_faults) {
103
s->strtab_base = deposit64(s->strtab_base, 0, 32, data);
307
+ if (PTW_RECORD_FAULT(cfg)) {
104
return MEMTX_OK;
308
event.type = SMMU_EVT_F_ADDR_SIZE;
105
@@ -XXX,XX +XXX,XX @@ static MemTxResult smmu_readl(SMMUv3State *s, hwaddr offset,
309
event.u.f_addr_size.addr = addr;
106
case A_STATUSR:
310
event.u.f_addr_size.rnw = flag & 0x1;
107
*data = s->statusr;
311
}
108
return MEMTX_OK;
312
break;
109
+ case A_GBPA:
313
case SMMU_PTW_ERR_ACCESS:
110
+ *data = s->gbpa;
314
- if (cfg->record_faults) {
111
+ return MEMTX_OK;
315
+ if (PTW_RECORD_FAULT(cfg)) {
112
case A_IRQ_CTRL:
316
event.type = SMMU_EVT_F_ACCESS;
113
case A_IRQ_CTRL_ACK:
317
event.u.f_access.addr = addr;
114
*data = s->irq_ctrl;
318
event.u.f_access.rnw = flag & 0x1;
115
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_smmuv3_queue = {
319
}
116
},
320
break;
117
};
321
case SMMU_PTW_ERR_PERMISSION:
118
322
- if (cfg->record_faults) {
119
+static bool smmuv3_gbpa_needed(void *opaque)
323
+ if (PTW_RECORD_FAULT(cfg)) {
120
+{
324
event.type = SMMU_EVT_F_PERMISSION;
121
+ SMMUv3State *s = opaque;
325
event.u.f_permission.addr = addr;
122
+
326
event.u.f_permission.rnw = flag & 0x1;
123
+ /* Only migrate GBPA if it has different reset value. */
124
+ return s->gbpa != SMMU_GBPA_RESET_VAL;
125
+}
126
+
127
+static const VMStateDescription vmstate_gbpa = {
128
+ .name = "smmuv3/gbpa",
129
+ .version_id = 1,
130
+ .minimum_version_id = 1,
131
+ .needed = smmuv3_gbpa_needed,
132
+ .fields = (VMStateField[]) {
133
+ VMSTATE_UINT32(gbpa, SMMUv3State),
134
+ VMSTATE_END_OF_LIST()
135
+ }
136
+};
137
+
138
static const VMStateDescription vmstate_smmuv3 = {
139
.name = "smmuv3",
140
.version_id = 1,
141
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_smmuv3 = {
142
143
VMSTATE_END_OF_LIST(),
144
},
145
+ .subsections = (const VMStateDescription * []) {
146
+ &vmstate_gbpa,
147
+ NULL
148
+ }
149
};
150
151
static void smmuv3_instance_init(Object *obj)
152
--
327
--
153
2.34.1
328
2.34.1
diff view generated by jsdifflib
1
From: Claudio Fontana <cfontana@suse.de>
1
From: Mostafa Saleh <smostafa@google.com>
2
2
3
for "all" builds (tcg + kvm), we want to avoid doing
3
Right now, either stage-1 or stage-2 are supported, this simplifies
4
the psci check if tcg is built-in, but not enabled.
4
how we can deal with TLBs.
5
This patch makes TLB lookup work if stage-2 is enabled instead of
6
stage-1.
7
TLB lookup is done before a PTW, if a valid entry is found we won't
8
do the PTW.
9
To be able to do TLB lookup, we need the correct tagging info, as
10
granularity and input size, so we get this based on the supported
11
translation stage. The TLB entries are added correctly from each
12
stage PTW.
5
13
6
Signed-off-by: Claudio Fontana <cfontana@suse.de>
14
When nested translation is supported, this would need to change, for
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
15
example if we go with a combined TLB implementation, we would need to
8
Signed-off-by: Fabiano Rosas <farosas@suse.de>
16
use the min of the granularities in TLB.
9
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
17
18
As stage-2 shouldn't be tagged by ASID, it will be set to -1 if S1P
19
is not enabled.
20
21
Signed-off-by: Mostafa Saleh <smostafa@google.com>
22
Reviewed-by: Eric Auger <eric.auger@redhat.com>
23
Tested-by: Eric Auger <eric.auger@redhat.com>
24
Tested-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
25
Message-id: 20230516203327.2051088-7-smostafa@google.com
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
26
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
27
---
12
target/arm/helper.c | 3 ++-
28
hw/arm/smmuv3.c | 44 +++++++++++++++++++++++++++++++++-----------
13
1 file changed, 2 insertions(+), 1 deletion(-)
29
1 file changed, 33 insertions(+), 11 deletions(-)
14
30
15
diff --git a/target/arm/helper.c b/target/arm/helper.c
31
diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
16
index XXXXXXX..XXXXXXX 100644
32
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/helper.c
33
--- a/hw/arm/smmuv3.c
18
+++ b/target/arm/helper.c
34
+++ b/hw/arm/smmuv3.c
19
@@ -XXX,XX +XXX,XX @@
35
@@ -XXX,XX +XXX,XX @@ static int smmuv3_decode_config(IOMMUMemoryRegion *mr, SMMUTransCfg *cfg,
20
#include "hw/irq.h"
36
STE ste;
21
#include "sysemu/cpu-timers.h"
37
CD cd;
22
#include "sysemu/kvm.h"
38
23
+#include "sysemu/tcg.h"
39
+ /* ASID defaults to -1 (if s1 is not supported). */
24
#include "qapi/qapi-commands-machine-target.h"
40
+ cfg->asid = -1;
25
#include "qapi/error.h"
41
+
26
#include "qemu/guest-random.h"
42
ret = smmu_find_ste(s, sid, &ste, event);
27
@@ -XXX,XX +XXX,XX @@ void arm_cpu_do_interrupt(CPUState *cs)
43
if (ret) {
28
env->exception.syndrome);
44
return ret;
45
@@ -XXX,XX +XXX,XX @@ static IOMMUTLBEntry smmuv3_translate(IOMMUMemoryRegion *mr, hwaddr addr,
46
.addr_mask = ~(hwaddr)0,
47
.perm = IOMMU_NONE,
48
};
49
+ /*
50
+ * Combined attributes used for TLB lookup, as only one stage is supported,
51
+ * it will hold attributes based on the enabled stage.
52
+ */
53
+ SMMUTransTableInfo tt_combined;
54
55
qemu_mutex_lock(&s->mutex);
56
57
@@ -XXX,XX +XXX,XX @@ static IOMMUTLBEntry smmuv3_translate(IOMMUMemoryRegion *mr, hwaddr addr,
58
goto epilogue;
29
}
59
}
30
60
31
- if (arm_is_psci_call(cpu, cs->exception_index)) {
61
- tt = select_tt(cfg, addr);
32
+ if (tcg_enabled() && arm_is_psci_call(cpu, cs->exception_index)) {
62
- if (!tt) {
33
arm_handle_psci_call(cpu);
63
- if (cfg->record_faults) {
34
qemu_log_mask(CPU_LOG_INT, "...handled as PSCI call\n");
64
- event.type = SMMU_EVT_F_TRANSLATION;
35
return;
65
- event.u.f_translation.addr = addr;
66
- event.u.f_translation.rnw = flag & 0x1;
67
+ if (cfg->stage == 1) {
68
+ /* Select stage1 translation table. */
69
+ tt = select_tt(cfg, addr);
70
+ if (!tt) {
71
+ if (cfg->record_faults) {
72
+ event.type = SMMU_EVT_F_TRANSLATION;
73
+ event.u.f_translation.addr = addr;
74
+ event.u.f_translation.rnw = flag & 0x1;
75
+ }
76
+ status = SMMU_TRANS_ERROR;
77
+ goto epilogue;
78
}
79
- status = SMMU_TRANS_ERROR;
80
- goto epilogue;
81
- }
82
+ tt_combined.granule_sz = tt->granule_sz;
83
+ tt_combined.tsz = tt->tsz;
84
85
- page_mask = (1ULL << (tt->granule_sz)) - 1;
86
+ } else {
87
+ /* Stage2. */
88
+ tt_combined.granule_sz = cfg->s2cfg.granule_sz;
89
+ tt_combined.tsz = cfg->s2cfg.tsz;
90
+ }
91
+ /*
92
+ * TLB lookup looks for granule and input size for a translation stage,
93
+ * as only one stage is supported right now, choose the right values
94
+ * from the configuration.
95
+ */
96
+ page_mask = (1ULL << tt_combined.granule_sz) - 1;
97
aligned_addr = addr & ~page_mask;
98
99
- cached_entry = smmu_iotlb_lookup(bs, cfg, tt, aligned_addr);
100
+ cached_entry = smmu_iotlb_lookup(bs, cfg, &tt_combined, aligned_addr);
101
if (cached_entry) {
102
if ((flag & IOMMU_WO) && !(cached_entry->entry.perm & IOMMU_WO)) {
103
status = SMMU_TRANS_ERROR;
36
--
104
--
37
2.34.1
105
2.34.1
38
39
diff view generated by jsdifflib
1
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
1
From: Mostafa Saleh <smostafa@google.com>
2
2
3
Addresses targeting the second translation table (TTB1) in the SMMU have
3
Allow TLB to be tagged with VMID.
4
all upper bits set (except for the top byte when TBI is enabled). Fix
4
5
the TTB1 check.
5
If stage-1 is only supported, VMID is set to -1 and ignored from STE
6
6
and CMD_TLBI_NH* cmds.
7
Reported-by: Ola Hugosson <ola.hugosson@arm.com>
7
8
Update smmu_iotlb_insert trace event to have vmid.
9
10
Signed-off-by: Mostafa Saleh <smostafa@google.com>
8
Reviewed-by: Eric Auger <eric.auger@redhat.com>
11
Reviewed-by: Eric Auger <eric.auger@redhat.com>
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
12
Tested-by: Eric Auger <eric.auger@redhat.com>
10
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
13
Tested-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
11
Message-id: 20230214171921.1917916-3-jean-philippe@linaro.org
14
Message-id: 20230516203327.2051088-8-smostafa@google.com
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
16
---
14
hw/arm/smmu-common.c | 2 +-
17
hw/arm/smmu-internal.h | 2 ++
15
1 file changed, 1 insertion(+), 1 deletion(-)
18
include/hw/arm/smmu-common.h | 5 +++--
16
19
hw/arm/smmu-common.c | 36 ++++++++++++++++++++++--------------
20
hw/arm/smmuv3.c | 12 +++++++++---
21
hw/arm/trace-events | 6 +++---
22
5 files changed, 39 insertions(+), 22 deletions(-)
23
24
diff --git a/hw/arm/smmu-internal.h b/hw/arm/smmu-internal.h
25
index XXXXXXX..XXXXXXX 100644
26
--- a/hw/arm/smmu-internal.h
27
+++ b/hw/arm/smmu-internal.h
28
@@ -XXX,XX +XXX,XX @@ static inline int pgd_concat_idx(int start_level, int granule_sz,
29
}
30
31
#define SMMU_IOTLB_ASID(key) ((key).asid)
32
+#define SMMU_IOTLB_VMID(key) ((key).vmid)
33
34
typedef struct SMMUIOTLBPageInvInfo {
35
int asid;
36
+ int vmid;
37
uint64_t iova;
38
uint64_t mask;
39
} SMMUIOTLBPageInvInfo;
40
diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h
41
index XXXXXXX..XXXXXXX 100644
42
--- a/include/hw/arm/smmu-common.h
43
+++ b/include/hw/arm/smmu-common.h
44
@@ -XXX,XX +XXX,XX @@ typedef struct SMMUPciBus {
45
typedef struct SMMUIOTLBKey {
46
uint64_t iova;
47
uint16_t asid;
48
+ uint16_t vmid;
49
uint8_t tg;
50
uint8_t level;
51
} SMMUIOTLBKey;
52
@@ -XXX,XX +XXX,XX @@ IOMMUMemoryRegion *smmu_iommu_mr(SMMUState *s, uint32_t sid);
53
SMMUTLBEntry *smmu_iotlb_lookup(SMMUState *bs, SMMUTransCfg *cfg,
54
SMMUTransTableInfo *tt, hwaddr iova);
55
void smmu_iotlb_insert(SMMUState *bs, SMMUTransCfg *cfg, SMMUTLBEntry *entry);
56
-SMMUIOTLBKey smmu_get_iotlb_key(uint16_t asid, uint64_t iova,
57
+SMMUIOTLBKey smmu_get_iotlb_key(uint16_t asid, uint16_t vmid, uint64_t iova,
58
uint8_t tg, uint8_t level);
59
void smmu_iotlb_inv_all(SMMUState *s);
60
void smmu_iotlb_inv_asid(SMMUState *s, uint16_t asid);
61
-void smmu_iotlb_inv_iova(SMMUState *s, int asid, dma_addr_t iova,
62
+void smmu_iotlb_inv_iova(SMMUState *s, int asid, int vmid, dma_addr_t iova,
63
uint8_t tg, uint64_t num_pages, uint8_t ttl);
64
65
/* Unmap the range of all the notifiers registered to any IOMMU mr */
17
diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
66
diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
18
index XXXXXXX..XXXXXXX 100644
67
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/arm/smmu-common.c
68
--- a/hw/arm/smmu-common.c
20
+++ b/hw/arm/smmu-common.c
69
+++ b/hw/arm/smmu-common.c
21
@@ -XXX,XX +XXX,XX @@ SMMUTransTableInfo *select_tt(SMMUTransCfg *cfg, dma_addr_t iova)
70
@@ -XXX,XX +XXX,XX @@ static guint smmu_iotlb_key_hash(gconstpointer v)
22
/* there is a ttbr0 region and we are in it (high bits all zero) */
71
23
return &cfg->tt[0];
72
/* Jenkins hash */
24
} else if (cfg->tt[1].tsz &&
73
a = b = c = JHASH_INITVAL + sizeof(*key);
25
- !extract64(iova, 64 - cfg->tt[1].tsz, cfg->tt[1].tsz - tbi_byte)) {
74
- a += key->asid + key->level + key->tg;
26
+ sextract64(iova, 64 - cfg->tt[1].tsz, cfg->tt[1].tsz - tbi_byte) == -1) {
75
+ a += key->asid + key->vmid + key->level + key->tg;
27
/* there is a ttbr1 region and we are in it (high bits all one) */
76
b += extract64(key->iova, 0, 32);
28
return &cfg->tt[1];
77
c += extract64(key->iova, 32, 32);
29
} else if (!cfg->tt[0].tsz) {
78
79
@@ -XXX,XX +XXX,XX @@ static gboolean smmu_iotlb_key_equal(gconstpointer v1, gconstpointer v2)
80
SMMUIOTLBKey *k1 = (SMMUIOTLBKey *)v1, *k2 = (SMMUIOTLBKey *)v2;
81
82
return (k1->asid == k2->asid) && (k1->iova == k2->iova) &&
83
- (k1->level == k2->level) && (k1->tg == k2->tg);
84
+ (k1->level == k2->level) && (k1->tg == k2->tg) &&
85
+ (k1->vmid == k2->vmid);
86
}
87
88
-SMMUIOTLBKey smmu_get_iotlb_key(uint16_t asid, uint64_t iova,
89
+SMMUIOTLBKey smmu_get_iotlb_key(uint16_t asid, uint16_t vmid, uint64_t iova,
90
uint8_t tg, uint8_t level)
91
{
92
- SMMUIOTLBKey key = {.asid = asid, .iova = iova, .tg = tg, .level = level};
93
+ SMMUIOTLBKey key = {.asid = asid, .vmid = vmid, .iova = iova,
94
+ .tg = tg, .level = level};
95
96
return key;
97
}
98
@@ -XXX,XX +XXX,XX @@ SMMUTLBEntry *smmu_iotlb_lookup(SMMUState *bs, SMMUTransCfg *cfg,
99
uint64_t mask = subpage_size - 1;
100
SMMUIOTLBKey key;
101
102
- key = smmu_get_iotlb_key(cfg->asid, iova & ~mask, tg, level);
103
+ key = smmu_get_iotlb_key(cfg->asid, cfg->s2cfg.vmid,
104
+ iova & ~mask, tg, level);
105
entry = g_hash_table_lookup(bs->iotlb, &key);
106
if (entry) {
107
break;
108
@@ -XXX,XX +XXX,XX @@ SMMUTLBEntry *smmu_iotlb_lookup(SMMUState *bs, SMMUTransCfg *cfg,
109
110
if (entry) {
111
cfg->iotlb_hits++;
112
- trace_smmu_iotlb_lookup_hit(cfg->asid, iova,
113
+ trace_smmu_iotlb_lookup_hit(cfg->asid, cfg->s2cfg.vmid, iova,
114
cfg->iotlb_hits, cfg->iotlb_misses,
115
100 * cfg->iotlb_hits /
116
(cfg->iotlb_hits + cfg->iotlb_misses));
117
} else {
118
cfg->iotlb_misses++;
119
- trace_smmu_iotlb_lookup_miss(cfg->asid, iova,
120
+ trace_smmu_iotlb_lookup_miss(cfg->asid, cfg->s2cfg.vmid, iova,
121
cfg->iotlb_hits, cfg->iotlb_misses,
122
100 * cfg->iotlb_hits /
123
(cfg->iotlb_hits + cfg->iotlb_misses));
124
@@ -XXX,XX +XXX,XX @@ void smmu_iotlb_insert(SMMUState *bs, SMMUTransCfg *cfg, SMMUTLBEntry *new)
125
smmu_iotlb_inv_all(bs);
126
}
127
128
- *key = smmu_get_iotlb_key(cfg->asid, new->entry.iova, tg, new->level);
129
- trace_smmu_iotlb_insert(cfg->asid, new->entry.iova, tg, new->level);
130
+ *key = smmu_get_iotlb_key(cfg->asid, cfg->s2cfg.vmid, new->entry.iova,
131
+ tg, new->level);
132
+ trace_smmu_iotlb_insert(cfg->asid, cfg->s2cfg.vmid, new->entry.iova,
133
+ tg, new->level);
134
g_hash_table_insert(bs->iotlb, key, new);
135
}
136
137
@@ -XXX,XX +XXX,XX @@ static gboolean smmu_hash_remove_by_asid(gpointer key, gpointer value,
138
139
return SMMU_IOTLB_ASID(*iotlb_key) == asid;
140
}
141
-
142
-static gboolean smmu_hash_remove_by_asid_iova(gpointer key, gpointer value,
143
+static gboolean smmu_hash_remove_by_asid_vmid_iova(gpointer key, gpointer value,
144
gpointer user_data)
145
{
146
SMMUTLBEntry *iter = (SMMUTLBEntry *)value;
147
@@ -XXX,XX +XXX,XX @@ static gboolean smmu_hash_remove_by_asid_iova(gpointer key, gpointer value,
148
if (info->asid >= 0 && info->asid != SMMU_IOTLB_ASID(iotlb_key)) {
149
return false;
150
}
151
+ if (info->vmid >= 0 && info->vmid != SMMU_IOTLB_VMID(iotlb_key)) {
152
+ return false;
153
+ }
154
return ((info->iova & ~entry->addr_mask) == entry->iova) ||
155
((entry->iova & ~info->mask) == info->iova);
156
}
157
158
-void smmu_iotlb_inv_iova(SMMUState *s, int asid, dma_addr_t iova,
159
+void smmu_iotlb_inv_iova(SMMUState *s, int asid, int vmid, dma_addr_t iova,
160
uint8_t tg, uint64_t num_pages, uint8_t ttl)
161
{
162
/* if tg is not set we use 4KB range invalidation */
163
uint8_t granule = tg ? tg * 2 + 10 : 12;
164
165
if (ttl && (num_pages == 1) && (asid >= 0)) {
166
- SMMUIOTLBKey key = smmu_get_iotlb_key(asid, iova, tg, ttl);
167
+ SMMUIOTLBKey key = smmu_get_iotlb_key(asid, vmid, iova, tg, ttl);
168
169
if (g_hash_table_remove(s->iotlb, &key)) {
170
return;
171
@@ -XXX,XX +XXX,XX @@ void smmu_iotlb_inv_iova(SMMUState *s, int asid, dma_addr_t iova,
172
173
SMMUIOTLBPageInvInfo info = {
174
.asid = asid, .iova = iova,
175
+ .vmid = vmid,
176
.mask = (num_pages * 1 << granule) - 1};
177
178
g_hash_table_foreach_remove(s->iotlb,
179
- smmu_hash_remove_by_asid_iova,
180
+ smmu_hash_remove_by_asid_vmid_iova,
181
&info);
182
}
183
184
diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
185
index XXXXXXX..XXXXXXX 100644
186
--- a/hw/arm/smmuv3.c
187
+++ b/hw/arm/smmuv3.c
188
@@ -XXX,XX +XXX,XX @@ static void smmuv3_s1_range_inval(SMMUState *s, Cmd *cmd)
189
{
190
dma_addr_t end, addr = CMD_ADDR(cmd);
191
uint8_t type = CMD_TYPE(cmd);
192
- uint16_t vmid = CMD_VMID(cmd);
193
+ int vmid = -1;
194
uint8_t scale = CMD_SCALE(cmd);
195
uint8_t num = CMD_NUM(cmd);
196
uint8_t ttl = CMD_TTL(cmd);
197
@@ -XXX,XX +XXX,XX @@ static void smmuv3_s1_range_inval(SMMUState *s, Cmd *cmd)
198
uint64_t num_pages;
199
uint8_t granule;
200
int asid = -1;
201
+ SMMUv3State *smmuv3 = ARM_SMMUV3(s);
202
+
203
+ /* Only consider VMID if stage-2 is supported. */
204
+ if (STAGE2_SUPPORTED(smmuv3)) {
205
+ vmid = CMD_VMID(cmd);
206
+ }
207
208
if (type == SMMU_CMD_TLBI_NH_VA) {
209
asid = CMD_ASID(cmd);
210
@@ -XXX,XX +XXX,XX @@ static void smmuv3_s1_range_inval(SMMUState *s, Cmd *cmd)
211
if (!tg) {
212
trace_smmuv3_s1_range_inval(vmid, asid, addr, tg, 1, ttl, leaf);
213
smmuv3_inv_notifiers_iova(s, asid, addr, tg, 1);
214
- smmu_iotlb_inv_iova(s, asid, addr, tg, 1, ttl);
215
+ smmu_iotlb_inv_iova(s, asid, vmid, addr, tg, 1, ttl);
216
return;
217
}
218
219
@@ -XXX,XX +XXX,XX @@ static void smmuv3_s1_range_inval(SMMUState *s, Cmd *cmd)
220
num_pages = (mask + 1) >> granule;
221
trace_smmuv3_s1_range_inval(vmid, asid, addr, tg, num_pages, ttl, leaf);
222
smmuv3_inv_notifiers_iova(s, asid, addr, tg, num_pages);
223
- smmu_iotlb_inv_iova(s, asid, addr, tg, num_pages, ttl);
224
+ smmu_iotlb_inv_iova(s, asid, vmid, addr, tg, num_pages, ttl);
225
addr += mask + 1;
226
}
227
}
228
diff --git a/hw/arm/trace-events b/hw/arm/trace-events
229
index XXXXXXX..XXXXXXX 100644
230
--- a/hw/arm/trace-events
231
+++ b/hw/arm/trace-events
232
@@ -XXX,XX +XXX,XX @@ smmu_iotlb_inv_all(void) "IOTLB invalidate all"
233
smmu_iotlb_inv_asid(uint16_t asid) "IOTLB invalidate asid=%d"
234
smmu_iotlb_inv_iova(uint16_t asid, uint64_t addr) "IOTLB invalidate asid=%d addr=0x%"PRIx64
235
smmu_inv_notifiers_mr(const char *name) "iommu mr=%s"
236
-smmu_iotlb_lookup_hit(uint16_t asid, uint64_t addr, uint32_t hit, uint32_t miss, uint32_t p) "IOTLB cache HIT asid=%d addr=0x%"PRIx64" hit=%d miss=%d hit rate=%d"
237
-smmu_iotlb_lookup_miss(uint16_t asid, uint64_t addr, uint32_t hit, uint32_t miss, uint32_t p) "IOTLB cache MISS asid=%d addr=0x%"PRIx64" hit=%d miss=%d hit rate=%d"
238
-smmu_iotlb_insert(uint16_t asid, uint64_t addr, uint8_t tg, uint8_t level) "IOTLB ++ asid=%d addr=0x%"PRIx64" tg=%d level=%d"
239
+smmu_iotlb_lookup_hit(uint16_t asid, uint16_t vmid, uint64_t addr, uint32_t hit, uint32_t miss, uint32_t p) "IOTLB cache HIT asid=%d vmid=%d addr=0x%"PRIx64" hit=%d miss=%d hit rate=%d"
240
+smmu_iotlb_lookup_miss(uint16_t asid, uint16_t vmid, uint64_t addr, uint32_t hit, uint32_t miss, uint32_t p) "IOTLB cache MISS asid=%d vmid=%d addr=0x%"PRIx64" hit=%d miss=%d hit rate=%d"
241
+smmu_iotlb_insert(uint16_t asid, uint16_t vmid, uint64_t addr, uint8_t tg, uint8_t level) "IOTLB ++ asid=%d vmid=%d addr=0x%"PRIx64" tg=%d level=%d"
242
243
# smmuv3.c
244
smmuv3_read_mmio(uint64_t addr, uint64_t val, unsigned size, uint32_t r) "addr: 0x%"PRIx64" val:0x%"PRIx64" size: 0x%x(%d)"
30
--
245
--
31
2.34.1
246
2.34.1
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
From: Mostafa Saleh <smostafa@google.com>
2
2
3
arm_v7m_mmu_idx_all() and arm_v7m_mmu_idx_for_secstate_and_priv()
3
CMD_TLBI_S2_IPA: As S1+S2 is not enabled, for now this can be the
4
are only used for system emulation in m_helper.c.
4
same as CMD_TLBI_NH_VAA.
5
Move the definitions to avoid prototype forward declarations.
5
6
6
CMD_TLBI_S12_VMALL: Added new function to invalidate TLB by VMID.
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
For stage-1 only commands, add a check to throw CERROR_ILL if used
9
Message-id: 20230206223502.25122-4-philmd@linaro.org
9
when stage-1 is not supported.
10
11
Reviewed-by: Eric Auger <eric.auger@redhat.com>
12
Signed-off-by: Mostafa Saleh <smostafa@google.com>
13
Tested-by: Eric Auger <eric.auger@redhat.com>
14
Tested-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
15
Message-id: 20230516203327.2051088-9-smostafa@google.com
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
17
---
12
target/arm/internals.h | 14 --------
18
include/hw/arm/smmu-common.h | 1 +
13
target/arm/m_helper.c | 74 +++++++++++++++++++++---------------------
19
hw/arm/smmu-common.c | 16 +++++++++++
14
2 files changed, 37 insertions(+), 51 deletions(-)
20
hw/arm/smmuv3.c | 55 ++++++++++++++++++++++++++++++------
15
21
hw/arm/trace-events | 4 ++-
16
diff --git a/target/arm/internals.h b/target/arm/internals.h
22
4 files changed, 67 insertions(+), 9 deletions(-)
17
index XXXXXXX..XXXXXXX 100644
23
18
--- a/target/arm/internals.h
24
diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h
19
+++ b/target/arm/internals.h
25
index XXXXXXX..XXXXXXX 100644
20
@@ -XXX,XX +XXX,XX @@ static inline ARMMMUIdx core_to_aa64_mmu_idx(int mmu_idx)
26
--- a/include/hw/arm/smmu-common.h
21
27
+++ b/include/hw/arm/smmu-common.h
22
int arm_mmu_idx_to_el(ARMMMUIdx mmu_idx);
28
@@ -XXX,XX +XXX,XX @@ SMMUIOTLBKey smmu_get_iotlb_key(uint16_t asid, uint16_t vmid, uint64_t iova,
23
29
uint8_t tg, uint8_t level);
24
-/*
30
void smmu_iotlb_inv_all(SMMUState *s);
25
- * Return the MMU index for a v7M CPU with all relevant information
31
void smmu_iotlb_inv_asid(SMMUState *s, uint16_t asid);
26
- * manually specified.
32
+void smmu_iotlb_inv_vmid(SMMUState *s, uint16_t vmid);
27
- */
33
void smmu_iotlb_inv_iova(SMMUState *s, int asid, int vmid, dma_addr_t iova,
28
-ARMMMUIdx arm_v7m_mmu_idx_all(CPUARMState *env,
34
uint8_t tg, uint64_t num_pages, uint8_t ttl);
29
- bool secstate, bool priv, bool negpri);
35
30
-
36
diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
31
-/*
37
index XXXXXXX..XXXXXXX 100644
32
- * Return the MMU index for a v7M CPU in the specified security and
38
--- a/hw/arm/smmu-common.c
33
- * privilege state.
39
+++ b/hw/arm/smmu-common.c
34
- */
40
@@ -XXX,XX +XXX,XX @@ static gboolean smmu_hash_remove_by_asid(gpointer key, gpointer value,
35
-ARMMMUIdx arm_v7m_mmu_idx_for_secstate_and_priv(CPUARMState *env,
41
36
- bool secstate, bool priv);
42
return SMMU_IOTLB_ASID(*iotlb_key) == asid;
37
-
43
}
38
/* Return the MMU index for a v7M CPU in the specified security state */
44
+
39
ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate);
45
+static gboolean smmu_hash_remove_by_vmid(gpointer key, gpointer value,
40
46
+ gpointer user_data)
41
diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c
42
index XXXXXXX..XXXXXXX 100644
43
--- a/target/arm/m_helper.c
44
+++ b/target/arm/m_helper.c
45
@@ -XXX,XX +XXX,XX @@ ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate)
46
47
#else /* !CONFIG_USER_ONLY */
48
49
+static ARMMMUIdx arm_v7m_mmu_idx_all(CPUARMState *env,
50
+ bool secstate, bool priv, bool negpri)
51
+{
47
+{
52
+ ARMMMUIdx mmu_idx = ARM_MMU_IDX_M;
48
+ uint16_t vmid = *(uint16_t *)user_data;
53
+
49
+ SMMUIOTLBKey *iotlb_key = (SMMUIOTLBKey *)key;
54
+ if (priv) {
50
+
55
+ mmu_idx |= ARM_MMU_IDX_M_PRIV;
51
+ return SMMU_IOTLB_VMID(*iotlb_key) == vmid;
56
+ }
57
+
58
+ if (negpri) {
59
+ mmu_idx |= ARM_MMU_IDX_M_NEGPRI;
60
+ }
61
+
62
+ if (secstate) {
63
+ mmu_idx |= ARM_MMU_IDX_M_S;
64
+ }
65
+
66
+ return mmu_idx;
67
+}
52
+}
68
+
53
+
69
+static ARMMMUIdx arm_v7m_mmu_idx_for_secstate_and_priv(CPUARMState *env,
54
static gboolean smmu_hash_remove_by_asid_vmid_iova(gpointer key, gpointer value,
70
+ bool secstate, bool priv)
55
gpointer user_data)
56
{
57
@@ -XXX,XX +XXX,XX @@ void smmu_iotlb_inv_asid(SMMUState *s, uint16_t asid)
58
g_hash_table_foreach_remove(s->iotlb, smmu_hash_remove_by_asid, &asid);
59
}
60
61
+inline void smmu_iotlb_inv_vmid(SMMUState *s, uint16_t vmid)
71
+{
62
+{
72
+ bool negpri = armv7m_nvic_neg_prio_requested(env->nvic, secstate);
63
+ trace_smmu_iotlb_inv_vmid(vmid);
73
+
64
+ g_hash_table_foreach_remove(s->iotlb, smmu_hash_remove_by_vmid, &vmid);
74
+ return arm_v7m_mmu_idx_all(env, secstate, priv, negpri);
75
+}
65
+}
76
+
66
+
77
+/* Return the MMU index for a v7M CPU in the specified security state */
67
/* VMSAv8-64 Translation */
78
+ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate)
68
79
+{
69
/**
80
+ bool priv = arm_v7m_is_handler_mode(env) ||
70
diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
81
+ !(env->v7m.control[secstate] & 1);
71
index XXXXXXX..XXXXXXX 100644
82
+
72
--- a/hw/arm/smmuv3.c
83
+ return arm_v7m_mmu_idx_for_secstate_and_priv(env, secstate, priv);
73
+++ b/hw/arm/smmuv3.c
84
+}
74
@@ -XXX,XX +XXX,XX @@ static void smmuv3_inv_notifiers_iova(SMMUState *s, int asid, dma_addr_t iova,
85
+
75
}
86
/*
87
* What kind of stack write are we doing? This affects how exceptions
88
* generated during the stacking are treated.
89
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(v7m_tt)(CPUARMState *env, uint32_t addr, uint32_t op)
90
return tt_resp;
91
}
76
}
92
77
93
-ARMMMUIdx arm_v7m_mmu_idx_all(CPUARMState *env,
78
-static void smmuv3_s1_range_inval(SMMUState *s, Cmd *cmd)
94
- bool secstate, bool priv, bool negpri)
79
+static void smmuv3_range_inval(SMMUState *s, Cmd *cmd)
95
-{
80
{
96
- ARMMMUIdx mmu_idx = ARM_MMU_IDX_M;
81
dma_addr_t end, addr = CMD_ADDR(cmd);
97
-
82
uint8_t type = CMD_TYPE(cmd);
98
- if (priv) {
83
@@ -XXX,XX +XXX,XX @@ static void smmuv3_s1_range_inval(SMMUState *s, Cmd *cmd)
99
- mmu_idx |= ARM_MMU_IDX_M_PRIV;
84
}
100
- }
85
101
-
86
if (!tg) {
102
- if (negpri) {
87
- trace_smmuv3_s1_range_inval(vmid, asid, addr, tg, 1, ttl, leaf);
103
- mmu_idx |= ARM_MMU_IDX_M_NEGPRI;
88
+ trace_smmuv3_range_inval(vmid, asid, addr, tg, 1, ttl, leaf);
104
- }
89
smmuv3_inv_notifiers_iova(s, asid, addr, tg, 1);
105
-
90
smmu_iotlb_inv_iova(s, asid, vmid, addr, tg, 1, ttl);
106
- if (secstate) {
91
return;
107
- mmu_idx |= ARM_MMU_IDX_M_S;
92
@@ -XXX,XX +XXX,XX @@ static void smmuv3_s1_range_inval(SMMUState *s, Cmd *cmd)
108
- }
93
uint64_t mask = dma_aligned_pow2_mask(addr, end, 64);
109
-
94
110
- return mmu_idx;
95
num_pages = (mask + 1) >> granule;
111
-}
96
- trace_smmuv3_s1_range_inval(vmid, asid, addr, tg, num_pages, ttl, leaf);
112
-
97
+ trace_smmuv3_range_inval(vmid, asid, addr, tg, num_pages, ttl, leaf);
113
-ARMMMUIdx arm_v7m_mmu_idx_for_secstate_and_priv(CPUARMState *env,
98
smmuv3_inv_notifiers_iova(s, asid, addr, tg, num_pages);
114
- bool secstate, bool priv)
99
smmu_iotlb_inv_iova(s, asid, vmid, addr, tg, num_pages, ttl);
115
-{
100
addr += mask + 1;
116
- bool negpri = armv7m_nvic_neg_prio_requested(env->nvic, secstate);
101
@@ -XXX,XX +XXX,XX @@ static int smmuv3_cmdq_consume(SMMUv3State *s)
117
-
102
{
118
- return arm_v7m_mmu_idx_all(env, secstate, priv, negpri);
103
uint16_t asid = CMD_ASID(&cmd);
119
-}
104
120
-
105
+ if (!STAGE1_SUPPORTED(s)) {
121
-/* Return the MMU index for a v7M CPU in the specified security state */
106
+ cmd_error = SMMU_CERROR_ILL;
122
-ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate)
107
+ break;
123
-{
108
+ }
124
- bool priv = arm_v7m_is_handler_mode(env) ||
109
+
125
- !(env->v7m.control[secstate] & 1);
110
trace_smmuv3_cmdq_tlbi_nh_asid(asid);
126
-
111
smmu_inv_notifiers_all(&s->smmu_state);
127
- return arm_v7m_mmu_idx_for_secstate_and_priv(env, secstate, priv);
112
smmu_iotlb_inv_asid(bs, asid);
128
-}
113
break;
129
-
114
}
130
#endif /* !CONFIG_USER_ONLY */
115
case SMMU_CMD_TLBI_NH_ALL:
116
+ if (!STAGE1_SUPPORTED(s)) {
117
+ cmd_error = SMMU_CERROR_ILL;
118
+ break;
119
+ }
120
+ QEMU_FALLTHROUGH;
121
case SMMU_CMD_TLBI_NSNH_ALL:
122
trace_smmuv3_cmdq_tlbi_nh();
123
smmu_inv_notifiers_all(&s->smmu_state);
124
@@ -XXX,XX +XXX,XX @@ static int smmuv3_cmdq_consume(SMMUv3State *s)
125
break;
126
case SMMU_CMD_TLBI_NH_VAA:
127
case SMMU_CMD_TLBI_NH_VA:
128
- smmuv3_s1_range_inval(bs, &cmd);
129
+ if (!STAGE1_SUPPORTED(s)) {
130
+ cmd_error = SMMU_CERROR_ILL;
131
+ break;
132
+ }
133
+ smmuv3_range_inval(bs, &cmd);
134
+ break;
135
+ case SMMU_CMD_TLBI_S12_VMALL:
136
+ {
137
+ uint16_t vmid = CMD_VMID(&cmd);
138
+
139
+ if (!STAGE2_SUPPORTED(s)) {
140
+ cmd_error = SMMU_CERROR_ILL;
141
+ break;
142
+ }
143
+
144
+ trace_smmuv3_cmdq_tlbi_s12_vmid(vmid);
145
+ smmu_inv_notifiers_all(&s->smmu_state);
146
+ smmu_iotlb_inv_vmid(bs, vmid);
147
+ break;
148
+ }
149
+ case SMMU_CMD_TLBI_S2_IPA:
150
+ if (!STAGE2_SUPPORTED(s)) {
151
+ cmd_error = SMMU_CERROR_ILL;
152
+ break;
153
+ }
154
+ /*
155
+ * As currently only either s1 or s2 are supported
156
+ * we can reuse same function for s2.
157
+ */
158
+ smmuv3_range_inval(bs, &cmd);
159
break;
160
case SMMU_CMD_TLBI_EL3_ALL:
161
case SMMU_CMD_TLBI_EL3_VA:
162
@@ -XXX,XX +XXX,XX @@ static int smmuv3_cmdq_consume(SMMUv3State *s)
163
case SMMU_CMD_TLBI_EL2_ASID:
164
case SMMU_CMD_TLBI_EL2_VA:
165
case SMMU_CMD_TLBI_EL2_VAA:
166
- case SMMU_CMD_TLBI_S12_VMALL:
167
- case SMMU_CMD_TLBI_S2_IPA:
168
case SMMU_CMD_ATC_INV:
169
case SMMU_CMD_PRI_RESP:
170
case SMMU_CMD_RESUME:
171
@@ -XXX,XX +XXX,XX @@ static int smmuv3_cmdq_consume(SMMUv3State *s)
172
break;
173
default:
174
cmd_error = SMMU_CERROR_ILL;
175
- qemu_log_mask(LOG_GUEST_ERROR,
176
- "Illegal command type: %d\n", CMD_TYPE(&cmd));
177
break;
178
}
179
qemu_mutex_unlock(&s->mutex);
180
if (cmd_error) {
181
+ if (cmd_error == SMMU_CERROR_ILL) {
182
+ qemu_log_mask(LOG_GUEST_ERROR,
183
+ "Illegal command type: %d\n", CMD_TYPE(&cmd));
184
+ }
185
break;
186
}
187
/*
188
diff --git a/hw/arm/trace-events b/hw/arm/trace-events
189
index XXXXXXX..XXXXXXX 100644
190
--- a/hw/arm/trace-events
191
+++ b/hw/arm/trace-events
192
@@ -XXX,XX +XXX,XX @@ smmu_ptw_block_pte(int stage, int level, uint64_t baseaddr, uint64_t pteaddr, ui
193
smmu_get_pte(uint64_t baseaddr, int index, uint64_t pteaddr, uint64_t pte) "baseaddr=0x%"PRIx64" index=0x%x, pteaddr=0x%"PRIx64", pte=0x%"PRIx64
194
smmu_iotlb_inv_all(void) "IOTLB invalidate all"
195
smmu_iotlb_inv_asid(uint16_t asid) "IOTLB invalidate asid=%d"
196
+smmu_iotlb_inv_vmid(uint16_t vmid) "IOTLB invalidate vmid=%d"
197
smmu_iotlb_inv_iova(uint16_t asid, uint64_t addr) "IOTLB invalidate asid=%d addr=0x%"PRIx64
198
smmu_inv_notifiers_mr(const char *name) "iommu mr=%s"
199
smmu_iotlb_lookup_hit(uint16_t asid, uint16_t vmid, uint64_t addr, uint32_t hit, uint32_t miss, uint32_t p) "IOTLB cache HIT asid=%d vmid=%d addr=0x%"PRIx64" hit=%d miss=%d hit rate=%d"
200
@@ -XXX,XX +XXX,XX @@ smmuv3_cmdq_cfgi_ste_range(int start, int end) "start=0x%x - end=0x%x"
201
smmuv3_cmdq_cfgi_cd(uint32_t sid) "sid=0x%x"
202
smmuv3_config_cache_hit(uint32_t sid, uint32_t hits, uint32_t misses, uint32_t perc) "Config cache HIT for sid=0x%x (hits=%d, misses=%d, hit rate=%d)"
203
smmuv3_config_cache_miss(uint32_t sid, uint32_t hits, uint32_t misses, uint32_t perc) "Config cache MISS for sid=0x%x (hits=%d, misses=%d, hit rate=%d)"
204
-smmuv3_s1_range_inval(int vmid, int asid, uint64_t addr, uint8_t tg, uint64_t num_pages, uint8_t ttl, bool leaf) "vmid=%d asid=%d addr=0x%"PRIx64" tg=%d num_pages=0x%"PRIx64" ttl=%d leaf=%d"
205
+smmuv3_range_inval(int vmid, int asid, uint64_t addr, uint8_t tg, uint64_t num_pages, uint8_t ttl, bool leaf) "vmid=%d asid=%d addr=0x%"PRIx64" tg=%d num_pages=0x%"PRIx64" ttl=%d leaf=%d"
206
smmuv3_cmdq_tlbi_nh(void) ""
207
smmuv3_cmdq_tlbi_nh_asid(uint16_t asid) "asid=%d"
208
+smmuv3_cmdq_tlbi_s12_vmid(uint16_t vmid) "vmid=%d"
209
smmuv3_config_cache_inv(uint32_t sid) "Config cache INV for sid=0x%x"
210
smmuv3_notify_flag_add(const char *iommu) "ADD SMMUNotifier node for iommu mr=%s"
211
smmuv3_notify_flag_del(const char *iommu) "DEL SMMUNotifier node for iommu mr=%s"
131
--
212
--
132
2.34.1
213
2.34.1
133
134
diff view generated by jsdifflib
1
From: Hao Wu <wuhaotsh@google.com>
1
From: Mostafa Saleh <smostafa@google.com>
2
2
3
Nuvoton's PSPI is a general purpose SPI module which enables
3
In smmuv3_notify_iova, read the granule based on translation stage
4
connections to SPI-based peripheral devices.
4
and use VMID if valid value is sent.
5
5
6
Signed-off-by: Hao Wu <wuhaotsh@google.com>
6
Signed-off-by: Mostafa Saleh <smostafa@google.com>
7
Reviewed-by: Chris Rauer <crauer@google.com>
7
Reviewed-by: Eric Auger <eric.auger@redhat.com>
8
Reviewed-by: Philippe Mathieu-Daude <philmd@linaro.org>
8
Tested-by: Eric Auger <eric.auger@redhat.com>
9
Message-id: 20230208235433.3989937-3-wuhaotsh@google.com
9
Tested-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
10
Message-id: 20230516203327.2051088-10-smostafa@google.com
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
12
---
12
MAINTAINERS | 6 +-
13
hw/arm/smmuv3.c | 39 ++++++++++++++++++++++++++-------------
13
include/hw/ssi/npcm_pspi.h | 53 +++++++++
14
hw/arm/trace-events | 2 +-
14
hw/ssi/npcm_pspi.c | 221 +++++++++++++++++++++++++++++++++++++
15
2 files changed, 27 insertions(+), 14 deletions(-)
15
hw/ssi/meson.build | 2 +-
16
hw/ssi/trace-events | 5 +
17
5 files changed, 283 insertions(+), 4 deletions(-)
18
create mode 100644 include/hw/ssi/npcm_pspi.h
19
create mode 100644 hw/ssi/npcm_pspi.c
20
16
21
diff --git a/MAINTAINERS b/MAINTAINERS
17
diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
22
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
23
--- a/MAINTAINERS
19
--- a/hw/arm/smmuv3.c
24
+++ b/MAINTAINERS
20
+++ b/hw/arm/smmuv3.c
25
@@ -XXX,XX +XXX,XX @@ M: Tyrone Ting <kfting@nuvoton.com>
21
@@ -XXX,XX +XXX,XX @@ epilogue:
26
M: Hao Wu <wuhaotsh@google.com>
22
* @mr: IOMMU mr region handle
27
L: qemu-arm@nongnu.org
23
* @n: notifier to be called
28
S: Supported
24
* @asid: address space ID or negative value if we don't care
29
-F: hw/*/npcm7xx*
25
+ * @vmid: virtual machine ID or negative value if we don't care
30
-F: include/hw/*/npcm7xx*
26
* @iova: iova
31
-F: tests/qtest/npcm7xx*
27
* @tg: translation granule (if communicated through range invalidation)
32
+F: hw/*/npcm*
28
* @num_pages: number of @granule sized pages (if tg != 0), otherwise 1
33
+F: include/hw/*/npcm*
29
*/
34
+F: tests/qtest/npcm*
30
static void smmuv3_notify_iova(IOMMUMemoryRegion *mr,
35
F: pc-bios/npcm7xx_bootrom.bin
31
IOMMUNotifier *n,
36
F: roms/vbootrom
32
- int asid, dma_addr_t iova,
37
F: docs/system/arm/nuvoton.rst
33
- uint8_t tg, uint64_t num_pages)
38
diff --git a/include/hw/ssi/npcm_pspi.h b/include/hw/ssi/npcm_pspi.h
34
+ int asid, int vmid,
39
new file mode 100644
35
+ dma_addr_t iova, uint8_t tg,
40
index XXXXXXX..XXXXXXX
36
+ uint64_t num_pages)
41
--- /dev/null
37
{
42
+++ b/include/hw/ssi/npcm_pspi.h
38
SMMUDevice *sdev = container_of(mr, SMMUDevice, iommu);
43
@@ -XXX,XX +XXX,XX @@
39
IOMMUTLBEvent event;
44
+/*
40
uint8_t granule;
45
+ * Nuvoton Peripheral SPI Module
41
+ SMMUv3State *s = sdev->smmu;
46
+ *
42
47
+ * Copyright 2023 Google LLC
43
if (!tg) {
48
+ *
44
SMMUEventInfo event = {.inval_ste_allowed = true};
49
+ * This program is free software; you can redistribute it and/or modify it
45
@@ -XXX,XX +XXX,XX @@ static void smmuv3_notify_iova(IOMMUMemoryRegion *mr,
50
+ * under the terms of the GNU General Public License as published by the
46
return;
51
+ * Free Software Foundation; either version 2 of the License, or
47
}
52
+ * (at your option) any later version.
48
53
+ *
49
- tt = select_tt(cfg, iova);
54
+ * This program is distributed in the hope that it will be useful, but WITHOUT
50
- if (!tt) {
55
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
51
+ if (vmid >= 0 && cfg->s2cfg.vmid != vmid) {
56
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
52
return;
57
+ * for more details.
53
}
58
+ */
54
- granule = tt->granule_sz;
59
+#ifndef NPCM_PSPI_H
60
+#define NPCM_PSPI_H
61
+
55
+
62
+#include "hw/ssi/ssi.h"
56
+ if (STAGE1_SUPPORTED(s)) {
63
+#include "hw/sysbus.h"
57
+ tt = select_tt(cfg, iova);
64
+
58
+ if (!tt) {
65
+/*
59
+ return;
66
+ * Number of registers in our device state structure. Don't change this without
60
+ }
67
+ * incrementing the version_id in the vmstate.
61
+ granule = tt->granule_sz;
68
+ */
62
+ } else {
69
+#define NPCM_PSPI_NR_REGS 3
63
+ granule = cfg->s2cfg.granule_sz;
70
+
71
+/**
72
+ * NPCMPSPIState - Device state for one Flash Interface Unit.
73
+ * @parent: System bus device.
74
+ * @mmio: Memory region for register access.
75
+ * @spi: The SPI bus mastered by this controller.
76
+ * @regs: Register contents.
77
+ * @irq: The interrupt request queue for this module.
78
+ *
79
+ * Each PSPI has a shared bank of registers, and controls up to four chip
80
+ * selects. Each chip select has a dedicated memory region which may be used to
81
+ * read and write the flash connected to that chip select as if it were memory.
82
+ */
83
+typedef struct NPCMPSPIState {
84
+ SysBusDevice parent;
85
+
86
+ MemoryRegion mmio;
87
+
88
+ SSIBus *spi;
89
+ uint16_t regs[NPCM_PSPI_NR_REGS];
90
+ qemu_irq irq;
91
+} NPCMPSPIState;
92
+
93
+#define TYPE_NPCM_PSPI "npcm-pspi"
94
+OBJECT_DECLARE_SIMPLE_TYPE(NPCMPSPIState, NPCM_PSPI)
95
+
96
+#endif /* NPCM_PSPI_H */
97
diff --git a/hw/ssi/npcm_pspi.c b/hw/ssi/npcm_pspi.c
98
new file mode 100644
99
index XXXXXXX..XXXXXXX
100
--- /dev/null
101
+++ b/hw/ssi/npcm_pspi.c
102
@@ -XXX,XX +XXX,XX @@
103
+/*
104
+ * Nuvoton NPCM Peripheral SPI Module (PSPI)
105
+ *
106
+ * Copyright 2023 Google LLC
107
+ *
108
+ * This program is free software; you can redistribute it and/or modify it
109
+ * under the terms of the GNU General Public License as published by the
110
+ * Free Software Foundation; either version 2 of the License, or
111
+ * (at your option) any later version.
112
+ *
113
+ * This program is distributed in the hope that it will be useful, but WITHOUT
114
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
115
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
116
+ * for more details.
117
+ */
118
+
119
+#include "qemu/osdep.h"
120
+
121
+#include "hw/irq.h"
122
+#include "hw/registerfields.h"
123
+#include "hw/ssi/npcm_pspi.h"
124
+#include "migration/vmstate.h"
125
+#include "qapi/error.h"
126
+#include "qemu/error-report.h"
127
+#include "qemu/log.h"
128
+#include "qemu/module.h"
129
+#include "qemu/units.h"
130
+
131
+#include "trace.h"
132
+
133
+REG16(PSPI_DATA, 0x0)
134
+REG16(PSPI_CTL1, 0x2)
135
+ FIELD(PSPI_CTL1, SPIEN, 0, 1)
136
+ FIELD(PSPI_CTL1, MOD, 2, 1)
137
+ FIELD(PSPI_CTL1, EIR, 5, 1)
138
+ FIELD(PSPI_CTL1, EIW, 6, 1)
139
+ FIELD(PSPI_CTL1, SCM, 7, 1)
140
+ FIELD(PSPI_CTL1, SCIDL, 8, 1)
141
+ FIELD(PSPI_CTL1, SCDV, 9, 7)
142
+REG16(PSPI_STAT, 0x4)
143
+ FIELD(PSPI_STAT, BSY, 0, 1)
144
+ FIELD(PSPI_STAT, RBF, 1, 1)
145
+
146
+static void npcm_pspi_update_irq(NPCMPSPIState *s)
147
+{
148
+ int level = 0;
149
+
150
+ /* Only fire IRQ when the module is enabled. */
151
+ if (FIELD_EX16(s->regs[R_PSPI_CTL1], PSPI_CTL1, SPIEN)) {
152
+ /* Update interrupt as BSY is cleared. */
153
+ if ((!FIELD_EX16(s->regs[R_PSPI_STAT], PSPI_STAT, BSY)) &&
154
+ FIELD_EX16(s->regs[R_PSPI_CTL1], PSPI_CTL1, EIW)) {
155
+ level = 1;
156
+ }
64
+ }
157
+
65
+
158
+ /* Update interrupt as RBF is set. */
66
} else {
159
+ if (FIELD_EX16(s->regs[R_PSPI_STAT], PSPI_STAT, RBF) &&
67
granule = tg * 2 + 10;
160
+ FIELD_EX16(s->regs[R_PSPI_CTL1], PSPI_CTL1, EIR)) {
68
}
161
+ level = 1;
69
@@ -XXX,XX +XXX,XX @@ static void smmuv3_notify_iova(IOMMUMemoryRegion *mr,
162
+ }
70
memory_region_notify_iommu_one(n, &event);
163
+ }
71
}
164
+ qemu_set_irq(s->irq, level);
72
165
+}
73
-/* invalidate an asid/iova range tuple in all mr's */
166
+
74
-static void smmuv3_inv_notifiers_iova(SMMUState *s, int asid, dma_addr_t iova,
167
+static uint16_t npcm_pspi_read_data(NPCMPSPIState *s)
75
- uint8_t tg, uint64_t num_pages)
168
+{
76
+/* invalidate an asid/vmid/iova range tuple in all mr's */
169
+ uint16_t value = s->regs[R_PSPI_DATA];
77
+static void smmuv3_inv_notifiers_iova(SMMUState *s, int asid, int vmid,
170
+
78
+ dma_addr_t iova, uint8_t tg,
171
+ /* Clear stat bits as the value are read out. */
79
+ uint64_t num_pages)
172
+ s->regs[R_PSPI_STAT] = 0;
80
{
173
+
81
SMMUDevice *sdev;
174
+ return value;
82
175
+}
83
@@ -XXX,XX +XXX,XX @@ static void smmuv3_inv_notifiers_iova(SMMUState *s, int asid, dma_addr_t iova,
176
+
84
IOMMUMemoryRegion *mr = &sdev->iommu;
177
+static void npcm_pspi_write_data(NPCMPSPIState *s, uint16_t data)
85
IOMMUNotifier *n;
178
+{
86
179
+ uint16_t value = 0;
87
- trace_smmuv3_inv_notifiers_iova(mr->parent_obj.name, asid, iova,
180
+
88
- tg, num_pages);
181
+ if (FIELD_EX16(s->regs[R_PSPI_CTL1], PSPI_CTL1, MOD)) {
89
+ trace_smmuv3_inv_notifiers_iova(mr->parent_obj.name, asid, vmid,
182
+ value = ssi_transfer(s->spi, extract16(data, 8, 8)) << 8;
90
+ iova, tg, num_pages);
183
+ }
91
184
+ value |= ssi_transfer(s->spi, extract16(data, 0, 8));
92
IOMMU_NOTIFIER_FOREACH(n, mr) {
185
+ s->regs[R_PSPI_DATA] = value;
93
- smmuv3_notify_iova(mr, n, asid, iova, tg, num_pages);
186
+
94
+ smmuv3_notify_iova(mr, n, asid, vmid, iova, tg, num_pages);
187
+ /* Mark data as available */
95
}
188
+ s->regs[R_PSPI_STAT] = R_PSPI_STAT_BSY_MASK | R_PSPI_STAT_RBF_MASK;
96
}
189
+}
97
}
190
+
98
@@ -XXX,XX +XXX,XX @@ static void smmuv3_range_inval(SMMUState *s, Cmd *cmd)
191
+/* Control register read handler. */
99
192
+static uint64_t npcm_pspi_ctrl_read(void *opaque, hwaddr addr,
100
if (!tg) {
193
+ unsigned int size)
101
trace_smmuv3_range_inval(vmid, asid, addr, tg, 1, ttl, leaf);
194
+{
102
- smmuv3_inv_notifiers_iova(s, asid, addr, tg, 1);
195
+ NPCMPSPIState *s = opaque;
103
+ smmuv3_inv_notifiers_iova(s, asid, vmid, addr, tg, 1);
196
+ uint16_t value;
104
smmu_iotlb_inv_iova(s, asid, vmid, addr, tg, 1, ttl);
197
+
105
return;
198
+ switch (addr) {
106
}
199
+ case A_PSPI_DATA:
107
@@ -XXX,XX +XXX,XX @@ static void smmuv3_range_inval(SMMUState *s, Cmd *cmd)
200
+ value = npcm_pspi_read_data(s);
108
201
+ break;
109
num_pages = (mask + 1) >> granule;
202
+
110
trace_smmuv3_range_inval(vmid, asid, addr, tg, num_pages, ttl, leaf);
203
+ case A_PSPI_CTL1:
111
- smmuv3_inv_notifiers_iova(s, asid, addr, tg, num_pages);
204
+ value = s->regs[R_PSPI_CTL1];
112
+ smmuv3_inv_notifiers_iova(s, asid, vmid, addr, tg, num_pages);
205
+ break;
113
smmu_iotlb_inv_iova(s, asid, vmid, addr, tg, num_pages, ttl);
206
+
114
addr += mask + 1;
207
+ case A_PSPI_STAT:
115
}
208
+ value = s->regs[R_PSPI_STAT];
116
diff --git a/hw/arm/trace-events b/hw/arm/trace-events
209
+ break;
210
+
211
+ default:
212
+ qemu_log_mask(LOG_GUEST_ERROR,
213
+ "%s: write to invalid offset 0x%" PRIx64 "\n",
214
+ DEVICE(s)->canonical_path, addr);
215
+ return 0;
216
+ }
217
+ trace_npcm_pspi_ctrl_read(DEVICE(s)->canonical_path, addr, value);
218
+ npcm_pspi_update_irq(s);
219
+
220
+ return value;
221
+}
222
+
223
+/* Control register write handler. */
224
+static void npcm_pspi_ctrl_write(void *opaque, hwaddr addr, uint64_t v,
225
+ unsigned int size)
226
+{
227
+ NPCMPSPIState *s = opaque;
228
+ uint16_t value = v;
229
+
230
+ trace_npcm_pspi_ctrl_write(DEVICE(s)->canonical_path, addr, value);
231
+
232
+ switch (addr) {
233
+ case A_PSPI_DATA:
234
+ npcm_pspi_write_data(s, value);
235
+ break;
236
+
237
+ case A_PSPI_CTL1:
238
+ s->regs[R_PSPI_CTL1] = value;
239
+ break;
240
+
241
+ case A_PSPI_STAT:
242
+ qemu_log_mask(LOG_GUEST_ERROR,
243
+ "%s: write to read-only register PSPI_STAT: 0x%08"
244
+ PRIx64 "\n", DEVICE(s)->canonical_path, v);
245
+ break;
246
+
247
+ default:
248
+ qemu_log_mask(LOG_GUEST_ERROR,
249
+ "%s: write to invalid offset 0x%" PRIx64 "\n",
250
+ DEVICE(s)->canonical_path, addr);
251
+ return;
252
+ }
253
+ npcm_pspi_update_irq(s);
254
+}
255
+
256
+static const MemoryRegionOps npcm_pspi_ctrl_ops = {
257
+ .read = npcm_pspi_ctrl_read,
258
+ .write = npcm_pspi_ctrl_write,
259
+ .endianness = DEVICE_LITTLE_ENDIAN,
260
+ .valid = {
261
+ .min_access_size = 1,
262
+ .max_access_size = 2,
263
+ .unaligned = false,
264
+ },
265
+ .impl = {
266
+ .min_access_size = 2,
267
+ .max_access_size = 2,
268
+ .unaligned = false,
269
+ },
270
+};
271
+
272
+static void npcm_pspi_enter_reset(Object *obj, ResetType type)
273
+{
274
+ NPCMPSPIState *s = NPCM_PSPI(obj);
275
+
276
+ trace_npcm_pspi_enter_reset(DEVICE(obj)->canonical_path, type);
277
+ memset(s->regs, 0, sizeof(s->regs));
278
+}
279
+
280
+static void npcm_pspi_realize(DeviceState *dev, Error **errp)
281
+{
282
+ NPCMPSPIState *s = NPCM_PSPI(dev);
283
+ SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
284
+ Object *obj = OBJECT(dev);
285
+
286
+ s->spi = ssi_create_bus(dev, "pspi");
287
+ memory_region_init_io(&s->mmio, obj, &npcm_pspi_ctrl_ops, s,
288
+ "mmio", 4 * KiB);
289
+ sysbus_init_mmio(sbd, &s->mmio);
290
+ sysbus_init_irq(sbd, &s->irq);
291
+}
292
+
293
+static const VMStateDescription vmstate_npcm_pspi = {
294
+ .name = "npcm-pspi",
295
+ .version_id = 0,
296
+ .minimum_version_id = 0,
297
+ .fields = (VMStateField[]) {
298
+ VMSTATE_UINT16_ARRAY(regs, NPCMPSPIState, NPCM_PSPI_NR_REGS),
299
+ VMSTATE_END_OF_LIST(),
300
+ },
301
+};
302
+
303
+
304
+static void npcm_pspi_class_init(ObjectClass *klass, void *data)
305
+{
306
+ ResettableClass *rc = RESETTABLE_CLASS(klass);
307
+ DeviceClass *dc = DEVICE_CLASS(klass);
308
+
309
+ dc->desc = "NPCM Peripheral SPI Module";
310
+ dc->realize = npcm_pspi_realize;
311
+ dc->vmsd = &vmstate_npcm_pspi;
312
+ rc->phases.enter = npcm_pspi_enter_reset;
313
+}
314
+
315
+static const TypeInfo npcm_pspi_types[] = {
316
+ {
317
+ .name = TYPE_NPCM_PSPI,
318
+ .parent = TYPE_SYS_BUS_DEVICE,
319
+ .instance_size = sizeof(NPCMPSPIState),
320
+ .class_init = npcm_pspi_class_init,
321
+ },
322
+};
323
+DEFINE_TYPES(npcm_pspi_types);
324
diff --git a/hw/ssi/meson.build b/hw/ssi/meson.build
325
index XXXXXXX..XXXXXXX 100644
117
index XXXXXXX..XXXXXXX 100644
326
--- a/hw/ssi/meson.build
118
--- a/hw/arm/trace-events
327
+++ b/hw/ssi/meson.build
119
+++ b/hw/arm/trace-events
328
@@ -XXX,XX +XXX,XX @@
120
@@ -XXX,XX +XXX,XX @@ smmuv3_cmdq_tlbi_s12_vmid(uint16_t vmid) "vmid=%d"
329
softmmu_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files('aspeed_smc.c'))
121
smmuv3_config_cache_inv(uint32_t sid) "Config cache INV for sid=0x%x"
330
softmmu_ss.add(when: 'CONFIG_MSF2', if_true: files('mss-spi.c'))
122
smmuv3_notify_flag_add(const char *iommu) "ADD SMMUNotifier node for iommu mr=%s"
331
-softmmu_ss.add(when: 'CONFIG_NPCM7XX', if_true: files('npcm7xx_fiu.c'))
123
smmuv3_notify_flag_del(const char *iommu) "DEL SMMUNotifier node for iommu mr=%s"
332
+softmmu_ss.add(when: 'CONFIG_NPCM7XX', if_true: files('npcm7xx_fiu.c', 'npcm_pspi.c'))
124
-smmuv3_inv_notifiers_iova(const char *name, uint16_t asid, uint64_t iova, uint8_t tg, uint64_t num_pages) "iommu mr=%s asid=%d iova=0x%"PRIx64" tg=%d num_pages=0x%"PRIx64
333
softmmu_ss.add(when: 'CONFIG_PL022', if_true: files('pl022.c'))
125
+smmuv3_inv_notifiers_iova(const char *name, uint16_t asid, uint16_t vmid, uint64_t iova, uint8_t tg, uint64_t num_pages) "iommu mr=%s asid=%d vmid=%d iova=0x%"PRIx64" tg=%d num_pages=0x%"PRIx64
334
softmmu_ss.add(when: 'CONFIG_SIFIVE_SPI', if_true: files('sifive_spi.c'))
126
335
softmmu_ss.add(when: 'CONFIG_SSI', if_true: files('ssi.c'))
336
diff --git a/hw/ssi/trace-events b/hw/ssi/trace-events
337
index XXXXXXX..XXXXXXX 100644
338
--- a/hw/ssi/trace-events
339
+++ b/hw/ssi/trace-events
340
@@ -XXX,XX +XXX,XX @@ npcm7xx_fiu_ctrl_write(const char *id, uint64_t addr, uint32_t data) "%s offset:
341
npcm7xx_fiu_flash_read(const char *id, int cs, uint64_t addr, unsigned int size, uint64_t value) "%s[%d] offset: 0x%08" PRIx64 " size: %u value: 0x%" PRIx64
342
npcm7xx_fiu_flash_write(const char *id, unsigned cs, uint64_t addr, unsigned int size, uint64_t value) "%s[%d] offset: 0x%08" PRIx64 " size: %u value: 0x%" PRIx64
343
344
+# npcm_pspi.c
345
+npcm_pspi_enter_reset(const char *id, int reset_type) "%s reset type: %d"
346
+npcm_pspi_ctrl_read(const char *id, uint64_t addr, uint16_t data) "%s offset: 0x%03" PRIx64 " value: 0x%04" PRIx16
347
+npcm_pspi_ctrl_write(const char *id, uint64_t addr, uint16_t data) "%s offset: 0x%03" PRIx64 " value: 0x%04" PRIx16
348
+
349
# ibex_spi_host.c
350
351
ibex_spi_host_reset(const char *msg) "%s"
352
--
127
--
353
2.34.1
128
2.34.1
diff view generated by jsdifflib
1
From: Cornelia Huck <cohuck@redhat.com>
1
From: Mostafa Saleh <smostafa@google.com>
2
2
3
Just use current_accel_name() directly.
3
As everything is in place, we can use a new system property to
4
advertise which stage is supported and remove bad_ste from STE
5
stage2 config.
4
6
5
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
7
The property added arm-smmuv3.stage can have 3 values:
8
- "1": Stage-1 only is advertised.
9
- "2": Stage-2 only is advertised.
10
11
If not passed or an unsupported value is passed, it will default to
12
stage-1.
13
14
Advertise VMID16.
15
16
Don't try to decode CD, if stage-2 is configured.
17
6
Reviewed-by: Eric Auger <eric.auger@redhat.com>
18
Reviewed-by: Eric Auger <eric.auger@redhat.com>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
19
Signed-off-by: Mostafa Saleh <smostafa@google.com>
20
Tested-by: Eric Auger <eric.auger@redhat.com>
21
Tested-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
22
Message-id: 20230516203327.2051088-11-smostafa@google.com
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
23
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
24
---
10
hw/arm/virt.c | 6 +++---
25
include/hw/arm/smmuv3.h | 1 +
11
1 file changed, 3 insertions(+), 3 deletions(-)
26
hw/arm/smmuv3.c | 32 ++++++++++++++++++++++----------
27
2 files changed, 23 insertions(+), 10 deletions(-)
12
28
13
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
29
diff --git a/include/hw/arm/smmuv3.h b/include/hw/arm/smmuv3.h
14
index XXXXXXX..XXXXXXX 100644
30
index XXXXXXX..XXXXXXX 100644
15
--- a/hw/arm/virt.c
31
--- a/include/hw/arm/smmuv3.h
16
+++ b/hw/arm/virt.c
32
+++ b/include/hw/arm/smmuv3.h
17
@@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine)
33
@@ -XXX,XX +XXX,XX @@ struct SMMUv3State {
18
if (vms->secure && (kvm_enabled() || hvf_enabled())) {
34
19
error_report("mach-virt: %s does not support providing "
35
qemu_irq irq[4];
20
"Security extensions (TrustZone) to the guest CPU",
36
QemuMutex mutex;
21
- kvm_enabled() ? "KVM" : "HVF");
37
+ char *stage;
22
+ current_accel_name());
38
};
23
exit(1);
39
40
typedef enum {
41
diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
42
index XXXXXXX..XXXXXXX 100644
43
--- a/hw/arm/smmuv3.c
44
+++ b/hw/arm/smmuv3.c
45
@@ -XXX,XX +XXX,XX @@
46
#include "hw/irq.h"
47
#include "hw/sysbus.h"
48
#include "migration/vmstate.h"
49
+#include "hw/qdev-properties.h"
50
#include "hw/qdev-core.h"
51
#include "hw/pci/pci.h"
52
#include "cpu.h"
53
@@ -XXX,XX +XXX,XX @@ void smmuv3_record_event(SMMUv3State *s, SMMUEventInfo *info)
54
55
static void smmuv3_init_regs(SMMUv3State *s)
56
{
57
- /**
58
- * IDR0: stage1 only, AArch64 only, coherent access, 16b ASID,
59
- * multi-level stream table
60
- */
61
- s->idr[0] = FIELD_DP32(s->idr[0], IDR0, S1P, 1); /* stage 1 supported */
62
+ /* Based on sys property, the stages supported in smmu will be advertised.*/
63
+ if (s->stage && !strcmp("2", s->stage)) {
64
+ s->idr[0] = FIELD_DP32(s->idr[0], IDR0, S2P, 1);
65
+ } else {
66
+ s->idr[0] = FIELD_DP32(s->idr[0], IDR0, S1P, 1);
67
+ }
68
+
69
s->idr[0] = FIELD_DP32(s->idr[0], IDR0, TTF, 2); /* AArch64 PTW only */
70
s->idr[0] = FIELD_DP32(s->idr[0], IDR0, COHACC, 1); /* IO coherent */
71
s->idr[0] = FIELD_DP32(s->idr[0], IDR0, ASID16, 1); /* 16-bit ASID */
72
+ s->idr[0] = FIELD_DP32(s->idr[0], IDR0, VMID16, 1); /* 16-bit VMID */
73
s->idr[0] = FIELD_DP32(s->idr[0], IDR0, TTENDIAN, 2); /* little endian */
74
s->idr[0] = FIELD_DP32(s->idr[0], IDR0, STALL_MODEL, 1); /* No stall */
75
/* terminated transaction will always be aborted/error returned */
76
@@ -XXX,XX +XXX,XX @@ static int decode_ste_s2_cfg(SMMUTransCfg *cfg, STE *ste)
77
goto bad_ste;
24
}
78
}
25
79
26
if (vms->virt && (kvm_enabled() || hvf_enabled())) {
80
- /* This is still here as stage 2 has not been fully enabled yet. */
27
error_report("mach-virt: %s does not support providing "
81
- qemu_log_mask(LOG_UNIMP, "SMMUv3 does not support stage 2 yet\n");
28
"Virtualization extensions to the guest CPU",
82
- goto bad_ste;
29
- kvm_enabled() ? "KVM" : "HVF");
83
-
30
+ current_accel_name());
84
return 0;
31
exit(1);
85
86
bad_ste:
87
@@ -XXX,XX +XXX,XX @@ static int smmuv3_decode_config(IOMMUMemoryRegion *mr, SMMUTransCfg *cfg,
88
return ret;
32
}
89
}
33
90
34
if (vms->mte && (kvm_enabled() || hvf_enabled())) {
91
- if (cfg->aborted || cfg->bypassed) {
35
error_report("mach-virt: %s does not support providing "
92
+ if (cfg->aborted || cfg->bypassed || (cfg->stage == 2)) {
36
"MTE to the guest CPU",
93
return 0;
37
- kvm_enabled() ? "KVM" : "HVF");
38
+ current_accel_name());
39
exit(1);
40
}
94
}
41
95
96
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_smmuv3 = {
97
}
98
};
99
100
+static Property smmuv3_properties[] = {
101
+ /*
102
+ * Stages of translation advertised.
103
+ * "1": Stage 1
104
+ * "2": Stage 2
105
+ * Defaults to stage 1
106
+ */
107
+ DEFINE_PROP_STRING("stage", SMMUv3State, stage),
108
+ DEFINE_PROP_END_OF_LIST()
109
+};
110
+
111
static void smmuv3_instance_init(Object *obj)
112
{
113
/* Nothing much to do here as of now */
114
@@ -XXX,XX +XXX,XX @@ static void smmuv3_class_init(ObjectClass *klass, void *data)
115
&c->parent_phases);
116
c->parent_realize = dc->realize;
117
dc->realize = smmu_realize;
118
+ device_class_set_props(dc, smmuv3_properties);
119
}
120
121
static int smmuv3_notify_flag_changed(IOMMUMemoryRegion *iommu,
42
--
122
--
43
2.34.1
123
2.34.1
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
From: Tommy Wu <tommy.wu@sifive.com>
2
2
3
Suggested-by: Richard Henderson <richard.henderson@linaro.org>
3
When we receive a packet from the xilinx_axienet and then try to s2mem
4
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
4
through the xilinx_axidma, if the descriptor ring buffer is full in the
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
xilinx axidma driver, we’ll assert the DMASR.HALTED in the
6
Message-id: 20230206223502.25122-3-philmd@linaro.org
6
function : stream_process_s2mem and return 0. In the end, we’ll be stuck in
7
an infinite loop in axienet_eth_rx_notify.
8
9
This patch checks the DMASR.HALTED state when we try to push data
10
from xilinx axi-enet to xilinx axi-dma. When the DMASR.HALTED is asserted,
11
we will not keep pushing the data and then prevent the infinte loop.
12
13
Signed-off-by: Tommy Wu <tommy.wu@sifive.com>
14
Reviewed-by: Edgar E. Iglesias <edgar@zeroasic.com>
15
Reviewed-by: Frank Chang <frank.chang@sifive.com>
16
Message-id: 20230519062137.1251741-1-tommy.wu@sifive.com
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
---
18
---
9
target/arm/m_helper.c | 11 ++++++++---
19
hw/dma/xilinx_axidma.c | 11 ++++++++---
10
1 file changed, 8 insertions(+), 3 deletions(-)
20
1 file changed, 8 insertions(+), 3 deletions(-)
11
21
12
diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c
22
diff --git a/hw/dma/xilinx_axidma.c b/hw/dma/xilinx_axidma.c
13
index XXXXXXX..XXXXXXX 100644
23
index XXXXXXX..XXXXXXX 100644
14
--- a/target/arm/m_helper.c
24
--- a/hw/dma/xilinx_axidma.c
15
+++ b/target/arm/m_helper.c
25
+++ b/hw/dma/xilinx_axidma.c
16
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(v7m_tt)(CPUARMState *env, uint32_t addr, uint32_t op)
26
@@ -XXX,XX +XXX,XX @@ static inline int stream_idle(struct Stream *s)
17
return 0;
27
return !!(s->regs[R_DMASR] & DMASR_IDLE);
18
}
28
}
19
29
20
-#else
30
+static inline int stream_halted(struct Stream *s)
21
+ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate)
22
+{
31
+{
23
+ return ARMMMUIdx_MUser;
32
+ return !!(s->regs[R_DMASR] & DMASR_HALTED);
24
+}
33
+}
25
+
34
+
26
+#else /* !CONFIG_USER_ONLY */
35
static void stream_reset(struct Stream *s)
27
28
/*
29
* What kind of stack write are we doing? This affects how exceptions
30
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(v7m_tt)(CPUARMState *env, uint32_t addr, uint32_t op)
31
return tt_resp;
32
}
33
34
-#endif /* !CONFIG_USER_ONLY */
35
-
36
ARMMMUIdx arm_v7m_mmu_idx_all(CPUARMState *env,
37
bool secstate, bool priv, bool negpri)
38
{
36
{
39
@@ -XXX,XX +XXX,XX @@ ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate)
37
s->regs[R_DMASR] = DMASR_HALTED; /* starts up halted. */
40
38
@@ -XXX,XX +XXX,XX @@ static void stream_process_mem2s(struct Stream *s, StreamSink *tx_data_dev,
41
return arm_v7m_mmu_idx_for_secstate_and_priv(env, secstate, priv);
39
uint64_t addr;
42
}
40
bool eop;
43
+
41
44
+#endif /* !CONFIG_USER_ONLY */
42
- if (!stream_running(s) || stream_idle(s)) {
43
+ if (!stream_running(s) || stream_idle(s) || stream_halted(s)) {
44
return;
45
}
46
47
@@ -XXX,XX +XXX,XX @@ static size_t stream_process_s2mem(struct Stream *s, unsigned char *buf,
48
unsigned int rxlen;
49
size_t pos = 0;
50
51
- if (!stream_running(s) || stream_idle(s)) {
52
+ if (!stream_running(s) || stream_idle(s) || stream_halted(s)) {
53
return 0;
54
}
55
56
@@ -XXX,XX +XXX,XX @@ xilinx_axidma_data_stream_can_push(StreamSink *obj,
57
XilinxAXIDMAStreamSink *ds = XILINX_AXI_DMA_DATA_STREAM(obj);
58
struct Stream *s = &ds->dma->streams[1];
59
60
- if (!stream_running(s) || stream_idle(s)) {
61
+ if (!stream_running(s) || stream_idle(s) || stream_halted(s)) {
62
ds->dma->notify = notify;
63
ds->dma->notify_opaque = notify_opaque;
64
return false;
45
--
65
--
46
2.34.1
66
2.34.1
47
67
48
68
diff view generated by jsdifflib
Deleted patch
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
1
3
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
4
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
5
Message-id: 20230206223502.25122-5-philmd@linaro.org
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
---
8
target/arm/helper.c | 12 ++++++++++--
9
1 file changed, 10 insertions(+), 2 deletions(-)
10
11
diff --git a/target/arm/helper.c b/target/arm/helper.c
12
index XXXXXXX..XXXXXXX 100644
13
--- a/target/arm/helper.c
14
+++ b/target/arm/helper.c
15
@@ -XXX,XX +XXX,XX @@ static void define_pmu_regs(ARMCPU *cpu)
16
}
17
}
18
19
+#ifndef CONFIG_USER_ONLY
20
/*
21
* We don't know until after realize whether there's a GICv3
22
* attached, and that is what registers the gicv3 sysregs.
23
@@ -XXX,XX +XXX,XX @@ static uint64_t id_pfr1_read(CPUARMState *env, const ARMCPRegInfo *ri)
24
return pfr1;
25
}
26
27
-#ifndef CONFIG_USER_ONLY
28
static uint64_t id_aa64pfr0_read(CPUARMState *env, const ARMCPRegInfo *ri)
29
{
30
ARMCPU *cpu = env_archcpu(env);
31
@@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu)
32
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 1,
33
.access = PL1_R, .type = ARM_CP_NO_RAW,
34
.accessfn = access_aa32_tid3,
35
+#ifdef CONFIG_USER_ONLY
36
+ .type = ARM_CP_CONST,
37
+ .resetvalue = cpu->isar.id_pfr1,
38
+#else
39
+ .type = ARM_CP_NO_RAW,
40
+ .accessfn = access_aa32_tid3,
41
.readfn = id_pfr1_read,
42
- .writefn = arm_cp_write_ignore },
43
+ .writefn = arm_cp_write_ignore
44
+#endif
45
+ },
46
{ .name = "ID_DFR0", .state = ARM_CP_STATE_BOTH,
47
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 2,
48
.access = PL1_R, .type = ARM_CP_CONST,
49
--
50
2.34.1
51
52
diff view generated by jsdifflib
Deleted patch
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
1
3
Suggested-by: Richard Henderson <richard.henderson@linaro.org>
4
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20230206223502.25122-6-philmd@linaro.org
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
---
9
linux-user/user-internals.h | 2 +-
10
target/arm/cpu.h | 2 +-
11
linux-user/arm/cpu_loop.c | 4 ++--
12
3 files changed, 4 insertions(+), 4 deletions(-)
13
14
diff --git a/linux-user/user-internals.h b/linux-user/user-internals.h
15
index XXXXXXX..XXXXXXX 100644
16
--- a/linux-user/user-internals.h
17
+++ b/linux-user/user-internals.h
18
@@ -XXX,XX +XXX,XX @@ void print_termios(void *arg);
19
#ifdef TARGET_ARM
20
static inline int regpairs_aligned(CPUArchState *cpu_env, int num)
21
{
22
- return cpu_env->eabi == 1;
23
+ return cpu_env->eabi;
24
}
25
#elif defined(TARGET_MIPS) && defined(TARGET_ABI_MIPSO32)
26
static inline int regpairs_aligned(CPUArchState *cpu_env, int num) { return 1; }
27
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
28
index XXXXXXX..XXXXXXX 100644
29
--- a/target/arm/cpu.h
30
+++ b/target/arm/cpu.h
31
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
32
33
#if defined(CONFIG_USER_ONLY)
34
/* For usermode syscall translation. */
35
- int eabi;
36
+ bool eabi;
37
#endif
38
39
struct CPUBreakpoint *cpu_breakpoint[16];
40
diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c
41
index XXXXXXX..XXXXXXX 100644
42
--- a/linux-user/arm/cpu_loop.c
43
+++ b/linux-user/arm/cpu_loop.c
44
@@ -XXX,XX +XXX,XX @@ void cpu_loop(CPUARMState *env)
45
break;
46
case EXCP_SWI:
47
{
48
- env->eabi = 1;
49
+ env->eabi = true;
50
/* system call */
51
if (env->thumb) {
52
/* Thumb is always EABI style with syscall number in r7 */
53
@@ -XXX,XX +XXX,XX @@ void cpu_loop(CPUARMState *env)
54
* > 0xfffff and are handled below as out-of-range.
55
*/
56
n ^= ARM_SYSCALL_BASE;
57
- env->eabi = 0;
58
+ env->eabi = false;
59
}
60
}
61
62
--
63
2.34.1
64
65
diff view generated by jsdifflib
Deleted patch
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
1
3
Although the 'eabi' field is only used in user emulation where
4
CPU reset doesn't occur, it doesn't belong to the area to reset.
5
Move it after the 'end_reset_fields' for consistency.
6
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
9
Message-id: 20230206223502.25122-7-philmd@linaro.org
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
12
target/arm/cpu.h | 9 ++++-----
13
1 file changed, 4 insertions(+), 5 deletions(-)
14
15
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
16
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/cpu.h
18
+++ b/target/arm/cpu.h
19
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
20
ARMVectorReg zarray[ARM_MAX_VQ * 16];
21
#endif
22
23
-#if defined(CONFIG_USER_ONLY)
24
- /* For usermode syscall translation. */
25
- bool eabi;
26
-#endif
27
-
28
struct CPUBreakpoint *cpu_breakpoint[16];
29
struct CPUWatchpoint *cpu_watchpoint[16];
30
31
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
32
const struct arm_boot_info *boot_info;
33
/* Store GICv3CPUState to access from this struct */
34
void *gicv3state;
35
+#if defined(CONFIG_USER_ONLY)
36
+ /* For usermode syscall translation. */
37
+ bool eabi;
38
+#endif /* CONFIG_USER_ONLY */
39
40
#ifdef TARGET_TAGGED_ADDRESSES
41
/* Linux syscall tagged address support */
42
--
43
2.34.1
44
45
diff view generated by jsdifflib
Deleted patch
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
1
3
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
4
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
5
Message-id: 20230206223502.25122-8-philmd@linaro.org
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
---
8
target/arm/cpu.h | 3 ++-
9
1 file changed, 2 insertions(+), 1 deletion(-)
10
11
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
12
index XXXXXXX..XXXXXXX 100644
13
--- a/target/arm/cpu.h
14
+++ b/target/arm/cpu.h
15
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
16
17
void *nvic;
18
const struct arm_boot_info *boot_info;
19
+#if !defined(CONFIG_USER_ONLY)
20
/* Store GICv3CPUState to access from this struct */
21
void *gicv3state;
22
-#if defined(CONFIG_USER_ONLY)
23
+#else /* CONFIG_USER_ONLY */
24
/* For usermode syscall translation. */
25
bool eabi;
26
#endif /* CONFIG_USER_ONLY */
27
--
28
2.34.1
29
30
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
From: Clément Chigot <chigot@adacore.com>
2
2
3
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
3
When passing --smp with a number lower than XLNX_ZYNQMP_NUM_APU_CPUS,
4
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
4
the expression (ms->smp.cpus - XLNX_ZYNQMP_NUM_APU_CPUS) will result
5
Message-id: 20230206223502.25122-9-philmd@linaro.org
5
in a positive number as ms->smp.cpus is a unsigned int.
6
This will raise the following error afterwards, as Qemu will try to
7
instantiate some additional RPUs.
8
| $ qemu-system-aarch64 --smp 1 -M xlnx-zcu102
9
| **
10
| ERROR:../src/tcg/tcg.c:777:tcg_register_thread:
11
| assertion failed: (n < tcg_max_ctxs)
12
13
Signed-off-by: Clément Chigot <chigot@adacore.com>
14
Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com>
15
Tested-by: Francisco Iglesias <frasse.iglesias@gmail.com>
16
Message-id: 20230524143714.565792-1-chigot@adacore.com
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
---
18
---
8
target/arm/cpu.h | 2 +-
19
hw/arm/xlnx-zynqmp.c | 2 +-
9
1 file changed, 1 insertion(+), 1 deletion(-)
20
1 file changed, 1 insertion(+), 1 deletion(-)
10
21
11
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
22
diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c
12
index XXXXXXX..XXXXXXX 100644
23
index XXXXXXX..XXXXXXX 100644
13
--- a/target/arm/cpu.h
24
--- a/hw/arm/xlnx-zynqmp.c
14
+++ b/target/arm/cpu.h
25
+++ b/hw/arm/xlnx-zynqmp.c
15
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
26
@@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_create_rpu(MachineState *ms, XlnxZynqMPState *s,
16
} sau;
27
const char *boot_cpu, Error **errp)
17
28
{
18
void *nvic;
29
int i;
19
- const struct arm_boot_info *boot_info;
30
- int num_rpus = MIN(ms->smp.cpus - XLNX_ZYNQMP_NUM_APU_CPUS,
20
#if !defined(CONFIG_USER_ONLY)
31
+ int num_rpus = MIN((int)(ms->smp.cpus - XLNX_ZYNQMP_NUM_APU_CPUS),
21
+ const struct arm_boot_info *boot_info;
32
XLNX_ZYNQMP_NUM_RPU_CPUS);
22
/* Store GICv3CPUState to access from this struct */
33
23
void *gicv3state;
34
if (num_rpus <= 0) {
24
#else /* CONFIG_USER_ONLY */
25
--
35
--
26
2.34.1
36
2.34.1
27
37
28
38
diff view generated by jsdifflib
Deleted patch
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
1
3
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Message-id: 20230206223502.25122-10-philmd@linaro.org
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
---
8
target/arm/cpu.h | 2 +-
9
1 file changed, 1 insertion(+), 1 deletion(-)
10
11
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
12
index XXXXXXX..XXXXXXX 100644
13
--- a/target/arm/cpu.h
14
+++ b/target/arm/cpu.h
15
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
16
uint32_t ctrl;
17
} sau;
18
19
- void *nvic;
20
#if !defined(CONFIG_USER_ONLY)
21
+ void *nvic;
22
const struct arm_boot_info *boot_info;
23
/* Store GICv3CPUState to access from this struct */
24
void *gicv3state;
25
--
26
2.34.1
27
28
diff view generated by jsdifflib
Deleted patch
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
1
3
There is no point in using a void pointer to access the NVIC.
4
Use the real type to avoid casting it while debugging.
5
6
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20230206223502.25122-11-philmd@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
target/arm/cpu.h | 46 ++++++++++++++++++++++---------------------
12
hw/intc/armv7m_nvic.c | 38 ++++++++++++-----------------------
13
target/arm/cpu.c | 1 +
14
target/arm/m_helper.c | 2 +-
15
4 files changed, 39 insertions(+), 48 deletions(-)
16
17
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
18
index XXXXXXX..XXXXXXX 100644
19
--- a/target/arm/cpu.h
20
+++ b/target/arm/cpu.h
21
@@ -XXX,XX +XXX,XX @@ typedef struct CPUARMTBFlags {
22
23
typedef struct ARMMMUFaultInfo ARMMMUFaultInfo;
24
25
+typedef struct NVICState NVICState;
26
+
27
typedef struct CPUArchState {
28
/* Regs for current mode. */
29
uint32_t regs[16];
30
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
31
} sau;
32
33
#if !defined(CONFIG_USER_ONLY)
34
- void *nvic;
35
+ NVICState *nvic;
36
const struct arm_boot_info *boot_info;
37
/* Store GICv3CPUState to access from this struct */
38
void *gicv3state;
39
@@ -XXX,XX +XXX,XX @@ uint32_t arm_phys_excp_target_el(CPUState *cs, uint32_t excp_idx,
40
41
/* Interface between CPU and Interrupt controller. */
42
#ifndef CONFIG_USER_ONLY
43
-bool armv7m_nvic_can_take_pending_exception(void *opaque);
44
+bool armv7m_nvic_can_take_pending_exception(NVICState *s);
45
#else
46
-static inline bool armv7m_nvic_can_take_pending_exception(void *opaque)
47
+static inline bool armv7m_nvic_can_take_pending_exception(NVICState *s)
48
{
49
return true;
50
}
51
#endif
52
/**
53
* armv7m_nvic_set_pending: mark the specified exception as pending
54
- * @opaque: the NVIC
55
+ * @s: the NVIC
56
* @irq: the exception number to mark pending
57
* @secure: false for non-banked exceptions or for the nonsecure
58
* version of a banked exception, true for the secure version of a banked
59
@@ -XXX,XX +XXX,XX @@ static inline bool armv7m_nvic_can_take_pending_exception(void *opaque)
60
* if @secure is true and @irq does not specify one of the fixed set
61
* of architecturally banked exceptions.
62
*/
63
-void armv7m_nvic_set_pending(void *opaque, int irq, bool secure);
64
+void armv7m_nvic_set_pending(NVICState *s, int irq, bool secure);
65
/**
66
* armv7m_nvic_set_pending_derived: mark this derived exception as pending
67
- * @opaque: the NVIC
68
+ * @s: the NVIC
69
* @irq: the exception number to mark pending
70
* @secure: false for non-banked exceptions or for the nonsecure
71
* version of a banked exception, true for the secure version of a banked
72
@@ -XXX,XX +XXX,XX @@ void armv7m_nvic_set_pending(void *opaque, int irq, bool secure);
73
* exceptions (exceptions generated in the course of trying to take
74
* a different exception).
75
*/
76
-void armv7m_nvic_set_pending_derived(void *opaque, int irq, bool secure);
77
+void armv7m_nvic_set_pending_derived(NVICState *s, int irq, bool secure);
78
/**
79
* armv7m_nvic_set_pending_lazyfp: mark this lazy FP exception as pending
80
- * @opaque: the NVIC
81
+ * @s: the NVIC
82
* @irq: the exception number to mark pending
83
* @secure: false for non-banked exceptions or for the nonsecure
84
* version of a banked exception, true for the secure version of a banked
85
@@ -XXX,XX +XXX,XX @@ void armv7m_nvic_set_pending_derived(void *opaque, int irq, bool secure);
86
* Similar to armv7m_nvic_set_pending(), but specifically for exceptions
87
* generated in the course of lazy stacking of FP registers.
88
*/
89
-void armv7m_nvic_set_pending_lazyfp(void *opaque, int irq, bool secure);
90
+void armv7m_nvic_set_pending_lazyfp(NVICState *s, int irq, bool secure);
91
/**
92
* armv7m_nvic_get_pending_irq_info: return highest priority pending
93
* exception, and whether it targets Secure state
94
- * @opaque: the NVIC
95
+ * @s: the NVIC
96
* @pirq: set to pending exception number
97
* @ptargets_secure: set to whether pending exception targets Secure
98
*
99
@@ -XXX,XX +XXX,XX @@ void armv7m_nvic_set_pending_lazyfp(void *opaque, int irq, bool secure);
100
* to true if the current highest priority pending exception should
101
* be taken to Secure state, false for NS.
102
*/
103
-void armv7m_nvic_get_pending_irq_info(void *opaque, int *pirq,
104
+void armv7m_nvic_get_pending_irq_info(NVICState *s, int *pirq,
105
bool *ptargets_secure);
106
/**
107
* armv7m_nvic_acknowledge_irq: make highest priority pending exception active
108
- * @opaque: the NVIC
109
+ * @s: the NVIC
110
*
111
* Move the current highest priority pending exception from the pending
112
* state to the active state, and update v7m.exception to indicate that
113
* it is the exception currently being handled.
114
*/
115
-void armv7m_nvic_acknowledge_irq(void *opaque);
116
+void armv7m_nvic_acknowledge_irq(NVICState *s);
117
/**
118
* armv7m_nvic_complete_irq: complete specified interrupt or exception
119
- * @opaque: the NVIC
120
+ * @s: the NVIC
121
* @irq: the exception number to complete
122
* @secure: true if this exception was secure
123
*
124
@@ -XXX,XX +XXX,XX @@ void armv7m_nvic_acknowledge_irq(void *opaque);
125
* 0 if there is still an irq active after this one was completed
126
* (Ignoring -1, this is the same as the RETTOBASE value before completion.)
127
*/
128
-int armv7m_nvic_complete_irq(void *opaque, int irq, bool secure);
129
+int armv7m_nvic_complete_irq(NVICState *s, int irq, bool secure);
130
/**
131
* armv7m_nvic_get_ready_status(void *opaque, int irq, bool secure)
132
- * @opaque: the NVIC
133
+ * @s: the NVIC
134
* @irq: the exception number to mark pending
135
* @secure: false for non-banked exceptions or for the nonsecure
136
* version of a banked exception, true for the secure version of a banked
137
@@ -XXX,XX +XXX,XX @@ int armv7m_nvic_complete_irq(void *opaque, int irq, bool secure);
138
* interrupt the current execution priority. This controls whether the
139
* RDY bit for it in the FPCCR is set.
140
*/
141
-bool armv7m_nvic_get_ready_status(void *opaque, int irq, bool secure);
142
+bool armv7m_nvic_get_ready_status(NVICState *s, int irq, bool secure);
143
/**
144
* armv7m_nvic_raw_execution_priority: return the raw execution priority
145
- * @opaque: the NVIC
146
+ * @s: the NVIC
147
*
148
* Returns: the raw execution priority as defined by the v8M architecture.
149
* This is the execution priority minus the effects of AIRCR.PRIS,
150
* and minus any PRIMASK/FAULTMASK/BASEPRI priority boosting.
151
* (v8M ARM ARM I_PKLD.)
152
*/
153
-int armv7m_nvic_raw_execution_priority(void *opaque);
154
+int armv7m_nvic_raw_execution_priority(NVICState *s);
155
/**
156
* armv7m_nvic_neg_prio_requested: return true if the requested execution
157
* priority is negative for the specified security state.
158
- * @opaque: the NVIC
159
+ * @s: the NVIC
160
* @secure: the security state to test
161
* This corresponds to the pseudocode IsReqExecPriNeg().
162
*/
163
#ifndef CONFIG_USER_ONLY
164
-bool armv7m_nvic_neg_prio_requested(void *opaque, bool secure);
165
+bool armv7m_nvic_neg_prio_requested(NVICState *s, bool secure);
166
#else
167
-static inline bool armv7m_nvic_neg_prio_requested(void *opaque, bool secure)
168
+static inline bool armv7m_nvic_neg_prio_requested(NVICState *s, bool secure)
169
{
170
return false;
171
}
172
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
173
index XXXXXXX..XXXXXXX 100644
174
--- a/hw/intc/armv7m_nvic.c
175
+++ b/hw/intc/armv7m_nvic.c
176
@@ -XXX,XX +XXX,XX @@ static inline int nvic_exec_prio(NVICState *s)
177
return MIN(running, s->exception_prio);
178
}
179
180
-bool armv7m_nvic_neg_prio_requested(void *opaque, bool secure)
181
+bool armv7m_nvic_neg_prio_requested(NVICState *s, bool secure)
182
{
183
/* Return true if the requested execution priority is negative
184
* for the specified security state, ie that security state
185
@@ -XXX,XX +XXX,XX @@ bool armv7m_nvic_neg_prio_requested(void *opaque, bool secure)
186
* mean we don't allow FAULTMASK_NS to actually make the execution
187
* priority negative). Compare pseudocode IsReqExcPriNeg().
188
*/
189
- NVICState *s = opaque;
190
-
191
if (s->cpu->env.v7m.faultmask[secure]) {
192
return true;
193
}
194
@@ -XXX,XX +XXX,XX @@ bool armv7m_nvic_neg_prio_requested(void *opaque, bool secure)
195
return false;
196
}
197
198
-bool armv7m_nvic_can_take_pending_exception(void *opaque)
199
+bool armv7m_nvic_can_take_pending_exception(NVICState *s)
200
{
201
- NVICState *s = opaque;
202
-
203
return nvic_exec_prio(s) > nvic_pending_prio(s);
204
}
205
206
-int armv7m_nvic_raw_execution_priority(void *opaque)
207
+int armv7m_nvic_raw_execution_priority(NVICState *s)
208
{
209
- NVICState *s = opaque;
210
-
211
return s->exception_prio;
212
}
213
214
@@ -XXX,XX +XXX,XX @@ static void nvic_irq_update(NVICState *s)
215
* if @secure is true and @irq does not specify one of the fixed set
216
* of architecturally banked exceptions.
217
*/
218
-static void armv7m_nvic_clear_pending(void *opaque, int irq, bool secure)
219
+static void armv7m_nvic_clear_pending(NVICState *s, int irq, bool secure)
220
{
221
- NVICState *s = (NVICState *)opaque;
222
VecInfo *vec;
223
224
assert(irq > ARMV7M_EXCP_RESET && irq < s->num_irq);
225
@@ -XXX,XX +XXX,XX @@ static void do_armv7m_nvic_set_pending(void *opaque, int irq, bool secure,
226
}
227
}
228
229
-void armv7m_nvic_set_pending(void *opaque, int irq, bool secure)
230
+void armv7m_nvic_set_pending(NVICState *s, int irq, bool secure)
231
{
232
- do_armv7m_nvic_set_pending(opaque, irq, secure, false);
233
+ do_armv7m_nvic_set_pending(s, irq, secure, false);
234
}
235
236
-void armv7m_nvic_set_pending_derived(void *opaque, int irq, bool secure)
237
+void armv7m_nvic_set_pending_derived(NVICState *s, int irq, bool secure)
238
{
239
- do_armv7m_nvic_set_pending(opaque, irq, secure, true);
240
+ do_armv7m_nvic_set_pending(s, irq, secure, true);
241
}
242
243
-void armv7m_nvic_set_pending_lazyfp(void *opaque, int irq, bool secure)
244
+void armv7m_nvic_set_pending_lazyfp(NVICState *s, int irq, bool secure)
245
{
246
/*
247
* Pend an exception during lazy FP stacking. This differs
248
@@ -XXX,XX +XXX,XX @@ void armv7m_nvic_set_pending_lazyfp(void *opaque, int irq, bool secure)
249
* whether we should escalate depends on the saved context
250
* in the FPCCR register, not on the current state of the CPU/NVIC.
251
*/
252
- NVICState *s = (NVICState *)opaque;
253
bool banked = exc_is_banked(irq);
254
VecInfo *vec;
255
bool targets_secure;
256
@@ -XXX,XX +XXX,XX @@ void armv7m_nvic_set_pending_lazyfp(void *opaque, int irq, bool secure)
257
}
258
259
/* Make pending IRQ active. */
260
-void armv7m_nvic_acknowledge_irq(void *opaque)
261
+void armv7m_nvic_acknowledge_irq(NVICState *s)
262
{
263
- NVICState *s = (NVICState *)opaque;
264
CPUARMState *env = &s->cpu->env;
265
const int pending = s->vectpending;
266
const int running = nvic_exec_prio(s);
267
@@ -XXX,XX +XXX,XX @@ static bool vectpending_targets_secure(NVICState *s)
268
exc_targets_secure(s, s->vectpending);
269
}
270
271
-void armv7m_nvic_get_pending_irq_info(void *opaque,
272
+void armv7m_nvic_get_pending_irq_info(NVICState *s,
273
int *pirq, bool *ptargets_secure)
274
{
275
- NVICState *s = (NVICState *)opaque;
276
const int pending = s->vectpending;
277
bool targets_secure;
278
279
@@ -XXX,XX +XXX,XX @@ void armv7m_nvic_get_pending_irq_info(void *opaque,
280
*pirq = pending;
281
}
282
283
-int armv7m_nvic_complete_irq(void *opaque, int irq, bool secure)
284
+int armv7m_nvic_complete_irq(NVICState *s, int irq, bool secure)
285
{
286
- NVICState *s = (NVICState *)opaque;
287
VecInfo *vec = NULL;
288
int ret = 0;
289
290
@@ -XXX,XX +XXX,XX @@ int armv7m_nvic_complete_irq(void *opaque, int irq, bool secure)
291
return ret;
292
}
293
294
-bool armv7m_nvic_get_ready_status(void *opaque, int irq, bool secure)
295
+bool armv7m_nvic_get_ready_status(NVICState *s, int irq, bool secure)
296
{
297
/*
298
* Return whether an exception is "ready", i.e. it is enabled and is
299
@@ -XXX,XX +XXX,XX @@ bool armv7m_nvic_get_ready_status(void *opaque, int irq, bool secure)
300
* for non-banked exceptions secure is always false; for banked exceptions
301
* it indicates which of the exceptions is required.
302
*/
303
- NVICState *s = (NVICState *)opaque;
304
bool banked = exc_is_banked(irq);
305
VecInfo *vec;
306
int running = nvic_exec_prio(s);
307
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
308
index XXXXXXX..XXXXXXX 100644
309
--- a/target/arm/cpu.c
310
+++ b/target/arm/cpu.c
311
@@ -XXX,XX +XXX,XX @@
312
#if !defined(CONFIG_USER_ONLY)
313
#include "hw/loader.h"
314
#include "hw/boards.h"
315
+#include "hw/intc/armv7m_nvic.h"
316
#endif
317
#include "sysemu/tcg.h"
318
#include "sysemu/qtest.h"
319
diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c
320
index XXXXXXX..XXXXXXX 100644
321
--- a/target/arm/m_helper.c
322
+++ b/target/arm/m_helper.c
323
@@ -XXX,XX +XXX,XX @@ static void v7m_update_fpccr(CPUARMState *env, uint32_t frameptr,
324
* that we will need later in order to do lazy FP reg stacking.
325
*/
326
bool is_secure = env->v7m.secure;
327
- void *nvic = env->nvic;
328
+ NVICState *nvic = env->nvic;
329
/*
330
* Some bits are unbanked and live always in fpccr[M_REG_S]; some bits
331
* are banked and we want to update the bit in the bank for the
332
--
333
2.34.1
334
335
diff view generated by jsdifflib
Deleted patch
1
From: Alex Bennée <alex.bennee@linaro.org>
2
1
3
The two TCG tests for GICv2 and GICv3 are very heavy weight distros
4
that take a long time to boot up, especially for an --enable-debug
5
build. The total code coverage they give is:
6
7
Overall coverage rate:
8
lines......: 11.2% (59584 of 530123 lines)
9
functions..: 15.0% (7436 of 49443 functions)
10
branches...: 6.3% (19273 of 303933 branches)
11
12
We already get pretty close to that with the machine_aarch64_virt
13
tests which only does one full boot (~120s vs ~600s) of alpine. We
14
expand the kernel+initrd boot (~8s) to test both GICs and also add an
15
RNG device and a block device to generate a few IRQs and exercise the
16
storage layer. With that we get to a coverage of:
17
18
Overall coverage rate:
19
lines......: 11.0% (58121 of 530123 lines)
20
functions..: 14.9% (7343 of 49443 functions)
21
branches...: 6.0% (18269 of 303933 branches)
22
23
which I feel is close enough given the massive time saving. If we want
24
to target any more sub-systems we can use lighter weight more directed
25
tests.
26
27
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
28
Reviewed-by: Fabiano Rosas <farosas@suse.de>
29
Acked-by: Richard Henderson <richard.henderson@linaro.org>
30
Message-id: 20230203181632.2919715-1-alex.bennee@linaro.org
31
Cc: Peter Maydell <peter.maydell@linaro.org>
32
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
33
---
34
tests/avocado/boot_linux.py | 48 ++++----------------
35
tests/avocado/machine_aarch64_virt.py | 63 ++++++++++++++++++++++++---
36
2 files changed, 65 insertions(+), 46 deletions(-)
37
38
diff --git a/tests/avocado/boot_linux.py b/tests/avocado/boot_linux.py
39
index XXXXXXX..XXXXXXX 100644
40
--- a/tests/avocado/boot_linux.py
41
+++ b/tests/avocado/boot_linux.py
42
@@ -XXX,XX +XXX,XX @@ def test_pc_q35_kvm(self):
43
self.launch_and_wait(set_up_ssh_connection=False)
44
45
46
-# For Aarch64 we only boot KVM tests in CI as the TCG tests are very
47
-# heavyweight. There are lighter weight distros which we use in the
48
-# machine_aarch64_virt.py tests.
49
+# For Aarch64 we only boot KVM tests in CI as booting the current
50
+# Fedora OS in TCG tests is very heavyweight. There are lighter weight
51
+# distros which we use in the machine_aarch64_virt.py tests.
52
class BootLinuxAarch64(LinuxTest):
53
"""
54
:avocado: tags=arch:aarch64
55
:avocado: tags=machine:virt
56
- :avocado: tags=machine:gic-version=2
57
"""
58
timeout = 720
59
60
- def add_common_args(self):
61
- self.vm.add_args('-bios',
62
- os.path.join(BUILD_DIR, 'pc-bios',
63
- 'edk2-aarch64-code.fd'))
64
- self.vm.add_args('-device', 'virtio-rng-pci,rng=rng0')
65
- self.vm.add_args('-object', 'rng-random,id=rng0,filename=/dev/urandom')
66
-
67
- @skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
68
- def test_fedora_cloud_tcg_gicv2(self):
69
- """
70
- :avocado: tags=accel:tcg
71
- :avocado: tags=cpu:max
72
- :avocado: tags=device:gicv2
73
- """
74
- self.require_accelerator("tcg")
75
- self.vm.add_args("-accel", "tcg")
76
- self.vm.add_args("-cpu", "max,lpa2=off")
77
- self.vm.add_args("-machine", "virt,gic-version=2")
78
- self.add_common_args()
79
- self.launch_and_wait(set_up_ssh_connection=False)
80
-
81
- @skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
82
- def test_fedora_cloud_tcg_gicv3(self):
83
- """
84
- :avocado: tags=accel:tcg
85
- :avocado: tags=cpu:max
86
- :avocado: tags=device:gicv3
87
- """
88
- self.require_accelerator("tcg")
89
- self.vm.add_args("-accel", "tcg")
90
- self.vm.add_args("-cpu", "max,lpa2=off")
91
- self.vm.add_args("-machine", "virt,gic-version=3")
92
- self.add_common_args()
93
- self.launch_and_wait(set_up_ssh_connection=False)
94
-
95
def test_virt_kvm(self):
96
"""
97
:avocado: tags=accel:kvm
98
@@ -XXX,XX +XXX,XX @@ def test_virt_kvm(self):
99
self.require_accelerator("kvm")
100
self.vm.add_args("-accel", "kvm")
101
self.vm.add_args("-machine", "virt,gic-version=host")
102
- self.add_common_args()
103
+ self.vm.add_args('-bios',
104
+ os.path.join(BUILD_DIR, 'pc-bios',
105
+ 'edk2-aarch64-code.fd'))
106
+ self.vm.add_args('-device', 'virtio-rng-pci,rng=rng0')
107
+ self.vm.add_args('-object', 'rng-random,id=rng0,filename=/dev/urandom')
108
self.launch_and_wait(set_up_ssh_connection=False)
109
110
111
diff --git a/tests/avocado/machine_aarch64_virt.py b/tests/avocado/machine_aarch64_virt.py
112
index XXXXXXX..XXXXXXX 100644
113
--- a/tests/avocado/machine_aarch64_virt.py
114
+++ b/tests/avocado/machine_aarch64_virt.py
115
@@ -XXX,XX +XXX,XX @@
116
117
import time
118
import os
119
+import logging
120
121
from avocado_qemu import QemuSystemTest
122
from avocado_qemu import wait_for_console_pattern
123
from avocado_qemu import exec_command
124
from avocado_qemu import BUILD_DIR
125
+from avocado.utils import process
126
+from avocado.utils.path import find_command
127
128
class Aarch64VirtMachine(QemuSystemTest):
129
KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
130
@@ -XXX,XX +XXX,XX @@ def test_alpine_virt_tcg_gic_max(self):
131
self.wait_for_console_pattern('Welcome to Alpine Linux 3.16')
132
133
134
- def test_aarch64_virt(self):
135
+ def common_aarch64_virt(self, machine):
136
"""
137
- :avocado: tags=arch:aarch64
138
- :avocado: tags=machine:virt
139
- :avocado: tags=accel:tcg
140
- :avocado: tags=cpu:max
141
+ Common code to launch basic virt machine with kernel+initrd
142
+ and a scratch disk.
143
"""
144
+ logger = logging.getLogger('aarch64_virt')
145
+
146
kernel_url = ('https://fileserver.linaro.org/s/'
147
'z6B2ARM7DQT3HWN/download')
148
-
149
kernel_hash = 'ed11daab50c151dde0e1e9c9cb8b2d9bd3215347'
150
kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
151
152
@@ -XXX,XX +XXX,XX @@ def test_aarch64_virt(self):
153
'console=ttyAMA0')
154
self.require_accelerator("tcg")
155
self.vm.add_args('-cpu', 'max,pauth-impdef=on',
156
+ '-machine', machine,
157
'-accel', 'tcg',
158
'-kernel', kernel_path,
159
'-append', kernel_command_line)
160
+
161
+ # A RNG offers an easy way to generate a few IRQs
162
+ self.vm.add_args('-device', 'virtio-rng-pci,rng=rng0')
163
+ self.vm.add_args('-object',
164
+ 'rng-random,id=rng0,filename=/dev/urandom')
165
+
166
+ # Also add a scratch block device
167
+ logger.info('creating scratch qcow2 image')
168
+ image_path = os.path.join(self.workdir, 'scratch.qcow2')
169
+ qemu_img = os.path.join(BUILD_DIR, 'qemu-img')
170
+ if not os.path.exists(qemu_img):
171
+ qemu_img = find_command('qemu-img', False)
172
+ if qemu_img is False:
173
+ self.cancel('Could not find "qemu-img", which is required to '
174
+ 'create the temporary qcow2 image')
175
+ cmd = '%s create -f qcow2 %s 8M' % (qemu_img, image_path)
176
+ process.run(cmd)
177
+
178
+ # Add the device
179
+ self.vm.add_args('-blockdev',
180
+ f"driver=qcow2,file.driver=file,file.filename={image_path},node-name=scratch")
181
+ self.vm.add_args('-device',
182
+ 'virtio-blk-device,drive=scratch')
183
+
184
self.vm.launch()
185
self.wait_for_console_pattern('Welcome to Buildroot')
186
time.sleep(0.1)
187
exec_command(self, 'root')
188
time.sleep(0.1)
189
+ exec_command(self, 'dd if=/dev/hwrng of=/dev/vda bs=512 count=4')
190
+ time.sleep(0.1)
191
+ exec_command(self, 'md5sum /dev/vda')
192
+ time.sleep(0.1)
193
+ exec_command(self, 'cat /proc/interrupts')
194
+ time.sleep(0.1)
195
exec_command(self, 'cat /proc/self/maps')
196
time.sleep(0.1)
197
+
198
+ def test_aarch64_virt_gicv3(self):
199
+ """
200
+ :avocado: tags=arch:aarch64
201
+ :avocado: tags=machine:virt
202
+ :avocado: tags=accel:tcg
203
+ :avocado: tags=cpu:max
204
+ """
205
+ self.common_aarch64_virt("virt,gic_version=3")
206
+
207
+ def test_aarch64_virt_gicv2(self):
208
+ """
209
+ :avocado: tags=arch:aarch64
210
+ :avocado: tags=machine:virt
211
+ :avocado: tags=accel:tcg
212
+ :avocado: tags=cpu:max
213
+ """
214
+ self.common_aarch64_virt("virt,gic-version=2")
215
--
216
2.34.1
217
218
diff view generated by jsdifflib
1
From: Fabiano Rosas <farosas@suse.de>
1
From: Thomas Huth <thuth@redhat.com>
2
2
3
These tests set -accel tcg, so restrict them to when TCG is present.
3
pflash-cfi02-test.c always uses the "musicpal" machine for testing,
4
test-arm-mptimer.c always uses the "vexpress-a9" machine, and
5
microbit-test.c requires the "microbit" machine, so we should only
6
run these tests if the machines have been enabled in the configuration.
4
7
5
Signed-off-by: Fabiano Rosas <farosas@suse.de>
8
Signed-off-by: Thomas Huth <thuth@redhat.com>
6
Acked-by: Richard Henderson <richard.henderson@linaro.org>
9
Reviewed-by: Fabiano Rosas <farosas@suse.de>
7
Reviewed-by: Thomas Huth <thuth@redhat.com>
10
Message-id: 20230524080600.1618137-1-thuth@redhat.com
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
12
---
10
tests/qtest/meson.build | 4 ++--
13
tests/qtest/meson.build | 7 ++++---
11
1 file changed, 2 insertions(+), 2 deletions(-)
14
1 file changed, 4 insertions(+), 3 deletions(-)
12
15
13
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
16
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
14
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
15
--- a/tests/qtest/meson.build
18
--- a/tests/qtest/meson.build
16
+++ b/tests/qtest/meson.build
19
+++ b/tests/qtest/meson.build
17
@@ -XXX,XX +XXX,XX @@ qtests_arm = \
20
@@ -XXX,XX +XXX,XX @@ qtests_arm = \
21
(config_all_devices.has_key('CONFIG_CMSDK_APB_DUALTIMER') ? ['cmsdk-apb-dualtimer-test'] : []) + \
22
(config_all_devices.has_key('CONFIG_CMSDK_APB_TIMER') ? ['cmsdk-apb-timer-test'] : []) + \
23
(config_all_devices.has_key('CONFIG_CMSDK_APB_WATCHDOG') ? ['cmsdk-apb-watchdog-test'] : []) + \
24
- (config_all_devices.has_key('CONFIG_PFLASH_CFI02') ? ['pflash-cfi02-test'] : []) + \
25
+ (config_all_devices.has_key('CONFIG_PFLASH_CFI02') and
26
+ config_all_devices.has_key('CONFIG_MUSICPAL') ? ['pflash-cfi02-test'] : []) + \
27
(config_all_devices.has_key('CONFIG_ASPEED_SOC') ? qtests_aspeed : []) + \
28
(config_all_devices.has_key('CONFIG_NPCM7XX') ? qtests_npcm7xx : []) + \
29
(config_all_devices.has_key('CONFIG_GENERIC_LOADER') ? ['hexloader-test'] : []) + \
30
(config_all_devices.has_key('CONFIG_TPM_TIS_I2C') ? ['tpm-tis-i2c-test'] : []) + \
31
+ (config_all_devices.has_key('CONFIG_VEXPRESS') ? ['test-arm-mptimer'] : []) + \
32
+ (config_all_devices.has_key('CONFIG_MICROBIT') ? ['microbit-test'] : []) + \
33
['arm-cpu-features',
34
- 'microbit-test',
35
- 'test-arm-mptimer',
36
'boot-serial-test']
37
18
# TODO: once aarch64 TCG is fixed on ARM 32 bit host, make bios-tables-test unconditional
38
# TODO: once aarch64 TCG is fixed on ARM 32 bit host, make bios-tables-test unconditional
19
qtests_aarch64 = \
20
(cpu != 'arm' and unpack_edk2_blobs ? ['bios-tables-test'] : []) + \
21
- (config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? ['tpm-tis-device-test'] : []) + \
22
- (config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? ['tpm-tis-device-swtpm-test'] : []) + \
23
+ (config_all.has_key('CONFIG_TCG') and config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? \
24
+ ['tpm-tis-device-test', 'tpm-tis-device-swtpm-test'] : []) + \
25
(config_all_devices.has_key('CONFIG_XLNX_ZYNQMP_ARM') ? ['xlnx-can-test', 'fuzz-xlnx-dp-test'] : []) + \
26
(config_all_devices.has_key('CONFIG_RASPI') ? ['bcm2835-dma-test'] : []) + \
27
['arm-cpu-features',
28
--
39
--
29
2.34.1
40
2.34.1
diff view generated by jsdifflib
1
From: Fabiano Rosas <farosas@suse.de>
1
For M-profile, there is no guest-facing A-profile format FSR, but we
2
still use the env->exception.fsr field to pass fault information from
3
the point where a fault is raised to the code in
4
arm_v7m_cpu_do_interrupt() which interprets it and sets the M-profile
5
specific fault status registers. So it doesn't matter whether we
6
fill in env->exception.fsr in the short format or the LPAE format, as
7
long as both sides agree. As it happens arm_v7m_cpu_do_interrupt()
8
assumes short-form.
2
9
3
Signed-off-by: Fabiano Rosas <farosas@suse.de>
10
In compute_fsr_fsc() we weren't explicitly choosing short-form for
11
M-profile, but instead relied on it falling out in the wash because
12
arm_s1_regime_using_lpae_format() would be false. This was broken in
13
commit 452c67a4 when we added v8R support, because we said "PMSAv8 is
14
always LPAE format" (as it is for v8R), forgetting that we were
15
implicitly using this code path on M-profile. At that point we would
16
hit a g_assert_not_reached():
17
ERROR:../../target/arm/internals.h:549:arm_fi_to_lfsc: code should not be reached
18
19
#7 0x0000555555e055f7 in arm_fi_to_lfsc (fi=0x7fffecff9a90) at ../../target/arm/internals.h:549
20
#8 0x0000555555e05a27 in compute_fsr_fsc (env=0x555557356670, fi=0x7fffecff9a90, target_el=1, mmu_idx=1, ret_fsc=0x7fffecff9a1c)
21
at ../../target/arm/tlb_helper.c:95
22
#9 0x0000555555e05b62 in arm_deliver_fault (cpu=0x555557354800, addr=268961344, access_type=MMU_INST_FETCH, mmu_idx=1, fi=0x7fffecff9a90)
23
at ../../target/arm/tlb_helper.c:132
24
#10 0x0000555555e06095 in arm_cpu_tlb_fill (cs=0x555557354800, address=268961344, size=1, access_type=MMU_INST_FETCH, mmu_idx=1, probe=false, retaddr=0)
25
at ../../target/arm/tlb_helper.c:260
26
27
The specific assertion changed when commit fcc7404eff24b4c added
28
"assert not M-profile" to arm_is_secure_below_el3(), because the
29
conditions being checked in compute_fsr_fsc() include
30
arm_el_is_aa64(), which will end up calling arm_is_secure_below_el3()
31
and asserting before we try to call arm_fi_to_lfsc():
32
33
#7 0x0000555555efaf43 in arm_is_secure_below_el3 (env=0x5555574665a0) at ../../target/arm/cpu.h:2396
34
#8 0x0000555555efb103 in arm_is_el2_enabled (env=0x5555574665a0) at ../../target/arm/cpu.h:2448
35
#9 0x0000555555efb204 in arm_el_is_aa64 (env=0x5555574665a0, el=1) at ../../target/arm/cpu.h:2509
36
#10 0x0000555555efbdfd in compute_fsr_fsc (env=0x5555574665a0, fi=0x7fffecff99e0, target_el=1, mmu_idx=1, ret_fsc=0x7fffecff996c)
37
38
Avoid the assertion and the incorrect FSR format selection by
39
explicitly making M-profile use the short-format in this function.
40
41
Fixes: 452c67a42704 ("target/arm: Enable TTBCR_EAE for ARMv8-R AArch32")a
42
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1658
43
Cc: qemu-stable@nongnu.org
44
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
45
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Acked-by: Thomas Huth <thuth@redhat.com>
46
Message-id: 20230523131726.866635-1-peter.maydell@linaro.org
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
---
47
---
8
tests/qtest/arm-cpu-features.c | 28 ++++++++++++++++++----------
48
target/arm/tcg/tlb_helper.c | 13 +++++++++++--
9
1 file changed, 18 insertions(+), 10 deletions(-)
49
1 file changed, 11 insertions(+), 2 deletions(-)
10
50
11
diff --git a/tests/qtest/arm-cpu-features.c b/tests/qtest/arm-cpu-features.c
51
diff --git a/target/arm/tcg/tlb_helper.c b/target/arm/tcg/tlb_helper.c
12
index XXXXXXX..XXXXXXX 100644
52
index XXXXXXX..XXXXXXX 100644
13
--- a/tests/qtest/arm-cpu-features.c
53
--- a/target/arm/tcg/tlb_helper.c
14
+++ b/tests/qtest/arm-cpu-features.c
54
+++ b/target/arm/tcg/tlb_helper.c
15
@@ -XXX,XX +XXX,XX @@
55
@@ -XXX,XX +XXX,XX @@ static uint32_t compute_fsr_fsc(CPUARMState *env, ARMMMUFaultInfo *fi,
16
#define SVE_MAX_VQ 16
56
ARMMMUIdx arm_mmu_idx = core_to_arm_mmu_idx(env, mmu_idx);
17
57
uint32_t fsr, fsc;
18
#define MACHINE "-machine virt,gic-version=max -accel tcg "
58
19
-#define MACHINE_KVM "-machine virt,gic-version=max -accel kvm -accel tcg "
59
- if (target_el == 2 || arm_el_is_aa64(env, target_el) ||
20
+#define MACHINE_KVM "-machine virt,gic-version=max -accel kvm "
60
- arm_s1_regime_using_lpae_format(env, arm_mmu_idx)) {
21
#define QUERY_HEAD "{ 'execute': 'query-cpu-model-expansion', " \
61
+ /*
22
" 'arguments': { 'type': 'full', "
62
+ * For M-profile there is no guest-facing FSR. We compute a
23
#define QUERY_TAIL "}}"
63
+ * short-form value for env->exception.fsr which we will then
24
@@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv)
64
+ * examine in arm_v7m_cpu_do_interrupt(). In theory we could
25
{
65
+ * use the LPAE format instead as long as both bits of code agree
26
g_test_init(&argc, &argv, NULL);
66
+ * (and arm_fi_to_lfsc() handled the M-profile specific
27
67
+ * ARMFault_QEMU_NSCExec and ARMFault_QEMU_SFault cases).
28
- qtest_add_data_func("/arm/query-cpu-model-expansion",
68
+ */
29
- NULL, test_query_cpu_model_expansion);
69
+ if (!arm_feature(env, ARM_FEATURE_M) &&
30
+ if (qtest_has_accel("tcg")) {
70
+ (target_el == 2 || arm_el_is_aa64(env, target_el) ||
31
+ qtest_add_data_func("/arm/query-cpu-model-expansion",
71
+ arm_s1_regime_using_lpae_format(env, arm_mmu_idx))) {
32
+ NULL, test_query_cpu_model_expansion);
33
+ }
34
+
35
+ if (!g_str_equal(qtest_get_arch(), "aarch64")) {
36
+ goto out;
37
+ }
38
39
/*
40
* For now we only run KVM specific tests with AArch64 QEMU in
41
* order avoid attempting to run an AArch32 QEMU with KVM on
42
* AArch64 hosts. That won't work and isn't easy to detect.
43
*/
44
- if (g_str_equal(qtest_get_arch(), "aarch64") && qtest_has_accel("kvm")) {
45
+ if (qtest_has_accel("kvm")) {
46
/*
72
/*
47
* This tests target the 'host' CPU type, so register it only if
73
* LPAE format fault status register : bottom 6 bits are
48
* KVM is available.
74
* status code in the same form as needed for syndrome
49
*/
50
qtest_add_data_func("/arm/kvm/query-cpu-model-expansion",
51
NULL, test_query_cpu_model_expansion_kvm);
52
- }
53
54
- if (g_str_equal(qtest_get_arch(), "aarch64")) {
55
- qtest_add_data_func("/arm/max/query-cpu-model-expansion/sve-max-vq-8",
56
- NULL, sve_tests_sve_max_vq_8);
57
- qtest_add_data_func("/arm/max/query-cpu-model-expansion/sve-off",
58
- NULL, sve_tests_sve_off);
59
qtest_add_data_func("/arm/kvm/query-cpu-model-expansion/sve-off",
60
NULL, sve_tests_sve_off_kvm);
61
}
62
63
+ if (qtest_has_accel("tcg")) {
64
+ qtest_add_data_func("/arm/max/query-cpu-model-expansion/sve-max-vq-8",
65
+ NULL, sve_tests_sve_max_vq_8);
66
+ qtest_add_data_func("/arm/max/query-cpu-model-expansion/sve-off",
67
+ NULL, sve_tests_sve_off);
68
+ }
69
+
70
+out:
71
return g_test_run();
72
}
73
--
75
--
74
2.34.1
76
2.34.1
diff view generated by jsdifflib
1
From: Fabiano Rosas <farosas@suse.de>
1
From: Fabiano Rosas <farosas@suse.de>
2
2
3
If a test was tagged with the "accel" tag and the specified
3
We currently need to select ARM_V7M unconditionally when TCG is
4
accelerator it not present in the qemu binary, cancel the test.
4
present in the build because some translate.c helpers and the whole of
5
m_helpers.c are not yet under CONFIG_ARM_V7M.
5
6
6
We can now write tests without explicit calls to require_accelerator,
7
Suggested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7
just the tag is enough.
8
9
Signed-off-by: Fabiano Rosas <farosas@suse.de>
8
Signed-off-by: Fabiano Rosas <farosas@suse.de>
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
11
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
10
Message-id: 20230523180525.29994-2-farosas@suse.de
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
12
---
14
tests/avocado/avocado_qemu/__init__.py | 4 ++++
13
target/arm/Kconfig | 3 +++
15
1 file changed, 4 insertions(+)
14
1 file changed, 3 insertions(+)
16
15
17
diff --git a/tests/avocado/avocado_qemu/__init__.py b/tests/avocado/avocado_qemu/__init__.py
16
diff --git a/target/arm/Kconfig b/target/arm/Kconfig
18
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
19
--- a/tests/avocado/avocado_qemu/__init__.py
18
--- a/target/arm/Kconfig
20
+++ b/tests/avocado/avocado_qemu/__init__.py
19
+++ b/target/arm/Kconfig
21
@@ -XXX,XX +XXX,XX @@ def setUp(self):
20
@@ -XXX,XX +XXX,XX @@
22
21
config ARM
23
super().setUp('qemu-system-')
22
bool
24
23
select ARM_COMPATIBLE_SEMIHOSTING if TCG
25
+ accel_required = self._get_unique_tag_val('accel')
26
+ if accel_required:
27
+ self.require_accelerator(accel_required)
28
+
24
+
29
self.machine = self.params.get('machine',
25
+ # We need to select this until we move m_helper.c and the
30
default=self._get_unique_tag_val('machine'))
26
+ # translate.c v7m helpers under ARM_V7M.
31
27
select ARM_V7M if TCG
28
29
config AARCH64
32
--
30
--
33
2.34.1
31
2.34.1
34
32
35
33
diff view generated by jsdifflib
1
From: Fabiano Rosas <farosas@suse.de>
1
From: Fabiano Rosas <farosas@suse.de>
2
2
3
Now that the cortex-a15 is under CONFIG_TCG, use as default CPU for a
3
When we moved the arm default CONFIGs into Kconfig and removed them
4
KVM-only build the 'max' cpu.
4
from default.mak, we made it harder to identify which CONFIGs are
5
selected by default in case users want to disable them.
5
6
6
Note that we cannot use 'host' here because the qtests can run without
7
Bring back the default entries into default.mak, but keep them
7
any other accelerator (than qtest) and 'host' depends on KVM being
8
commented out. This way users can keep their workflows of editing
8
enabled.
9
default.mak to remove build options without needing to search through
10
Kconfig.
9
11
12
Reported-by: Thomas Huth <thuth@redhat.com>
10
Signed-off-by: Fabiano Rosas <farosas@suse.de>
13
Signed-off-by: Fabiano Rosas <farosas@suse.de>
11
Acked-by: Richard Henderson <richard.henderson@linaro.org>
12
Reviewed-by: Thomas Huth <thuth@redhat.com>
14
Reviewed-by: Thomas Huth <thuth@redhat.com>
15
Message-id: 20230523180525.29994-3-farosas@suse.de
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
---
17
---
15
hw/arm/virt.c | 4 ++++
18
configs/devices/aarch64-softmmu/default.mak | 6 ++++
16
1 file changed, 4 insertions(+)
19
configs/devices/arm-softmmu/default.mak | 40 +++++++++++++++++++++
20
2 files changed, 46 insertions(+)
17
21
18
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
22
diff --git a/configs/devices/aarch64-softmmu/default.mak b/configs/devices/aarch64-softmmu/default.mak
19
index XXXXXXX..XXXXXXX 100644
23
index XXXXXXX..XXXXXXX 100644
20
--- a/hw/arm/virt.c
24
--- a/configs/devices/aarch64-softmmu/default.mak
21
+++ b/hw/arm/virt.c
25
+++ b/configs/devices/aarch64-softmmu/default.mak
22
@@ -XXX,XX +XXX,XX @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
26
@@ -XXX,XX +XXX,XX @@
23
mc->minimum_page_bits = 12;
27
24
mc->possible_cpu_arch_ids = virt_possible_cpu_arch_ids;
28
# We support all the 32 bit boards so need all their config
25
mc->cpu_index_to_instance_props = virt_cpu_index_to_props;
29
include ../arm-softmmu/default.mak
26
+#ifdef CONFIG_TCG
30
+
27
mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a15");
31
+# These are selected by default when TCG is enabled, uncomment them to
28
+#else
32
+# keep out of the build.
29
+ mc->default_cpu_type = ARM_CPU_TYPE_NAME("max");
33
+# CONFIG_XLNX_ZYNQMP_ARM=n
30
+#endif
34
+# CONFIG_XLNX_VERSAL=n
31
mc->get_default_cpu_node_id = virt_get_default_cpu_node_id;
35
+# CONFIG_SBSA_REF=n
32
mc->kvm_type = virt_kvm_type;
36
diff --git a/configs/devices/arm-softmmu/default.mak b/configs/devices/arm-softmmu/default.mak
33
assert(!mc->get_hotplug_handler);
37
index XXXXXXX..XXXXXXX 100644
38
--- a/configs/devices/arm-softmmu/default.mak
39
+++ b/configs/devices/arm-softmmu/default.mak
40
@@ -XXX,XX +XXX,XX @@
41
# CONFIG_TEST_DEVICES=n
42
43
CONFIG_ARM_VIRT=y
44
+
45
+# These are selected by default when TCG is enabled, uncomment them to
46
+# keep out of the build.
47
+# CONFIG_CUBIEBOARD=n
48
+# CONFIG_EXYNOS4=n
49
+# CONFIG_HIGHBANK=n
50
+# CONFIG_INTEGRATOR=n
51
+# CONFIG_FSL_IMX31=n
52
+# CONFIG_MUSICPAL=n
53
+# CONFIG_MUSCA=n
54
+# CONFIG_CHEETAH=n
55
+# CONFIG_SX1=n
56
+# CONFIG_NSERIES=n
57
+# CONFIG_STELLARIS=n
58
+# CONFIG_STM32VLDISCOVERY=n
59
+# CONFIG_REALVIEW=n
60
+# CONFIG_VERSATILE=n
61
+# CONFIG_VEXPRESS=n
62
+# CONFIG_ZYNQ=n
63
+# CONFIG_MAINSTONE=n
64
+# CONFIG_GUMSTIX=n
65
+# CONFIG_SPITZ=n
66
+# CONFIG_TOSA=n
67
+# CONFIG_Z2=n
68
+# CONFIG_NPCM7XX=n
69
+# CONFIG_COLLIE=n
70
+# CONFIG_ASPEED_SOC=n
71
+# CONFIG_NETDUINO2=n
72
+# CONFIG_NETDUINOPLUS2=n
73
+# CONFIG_OLIMEX_STM32_H405=n
74
+# CONFIG_MPS2=n
75
+# CONFIG_RASPI=n
76
+# CONFIG_DIGIC=n
77
+# CONFIG_SABRELITE=n
78
+# CONFIG_EMCRAFT_SF2=n
79
+# CONFIG_MICROBIT=n
80
+# CONFIG_FSL_IMX25=n
81
+# CONFIG_FSL_IMX7=n
82
+# CONFIG_FSL_IMX6UL=n
83
+# CONFIG_ALLWINNER_H3=n
34
--
84
--
35
2.34.1
85
2.34.1
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
From: Fabiano Rosas <farosas@suse.de>
2
2
3
Since commit acc0b8b05a when running the ZynqMP ZCU102 board with
3
Replace the 'default y if TCG' pattern with 'default y; depends on
4
a QEMU configured using --without-default-devices, we get:
4
TCG'.
5
5
6
$ qemu-system-aarch64 -M xlnx-zcu102
6
That makes explict that there is a dependence on TCG and enabling
7
qemu-system-aarch64: missing object type 'usb_dwc3'
7
these CONFIGs via .mak files without TCG present will fail earlier.
8
Abort trap: 6
8
9
9
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
10
Fix by adding the missing Kconfig dependency.
10
Signed-off-by: Fabiano Rosas <farosas@suse.de>
11
11
Reviewed-by: Thomas Huth <thuth@redhat.com>
12
Fixes: acc0b8b05a ("hw/arm/xlnx-zynqmp: Connect ZynqMP's USB controllers")
12
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
13
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
13
Message-id: 20230523180525.29994-4-farosas@suse.de
14
Message-id: 20230216092327.2203-1-philmd@linaro.org
15
Reviewed-by: Francisco Iglesias <francisco.iglesias@amd.com>
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
---
15
---
18
hw/arm/Kconfig | 1 +
16
hw/arm/Kconfig | 123 ++++++++++++++++++++++++++++++++-----------------
19
1 file changed, 1 insertion(+)
17
1 file changed, 82 insertions(+), 41 deletions(-)
20
18
21
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
19
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
22
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
23
--- a/hw/arm/Kconfig
21
--- a/hw/arm/Kconfig
24
+++ b/hw/arm/Kconfig
22
+++ b/hw/arm/Kconfig
23
@@ -XXX,XX +XXX,XX @@ config ARM_VIRT
24
25
config CHEETAH
26
bool
27
- default y if TCG && ARM
28
+ default y
29
+ depends on TCG && ARM
30
select OMAP
31
select TSC210X
32
33
config CUBIEBOARD
34
bool
35
- default y if TCG && ARM
36
+ default y
37
+ depends on TCG && ARM
38
select ALLWINNER_A10
39
40
config DIGIC
41
bool
42
- default y if TCG && ARM
43
+ default y
44
+ depends on TCG && ARM
45
select PTIMER
46
select PFLASH_CFI02
47
48
config EXYNOS4
49
bool
50
- default y if TCG && ARM
51
+ default y
52
+ depends on TCG && ARM
53
imply I2C_DEVICES
54
select A9MPCORE
55
select I2C
56
@@ -XXX,XX +XXX,XX @@ config EXYNOS4
57
58
config HIGHBANK
59
bool
60
- default y if TCG && ARM
61
+ default y
62
+ depends on TCG && ARM
63
select A9MPCORE
64
select A15MPCORE
65
select AHCI
66
@@ -XXX,XX +XXX,XX @@ config HIGHBANK
67
68
config INTEGRATOR
69
bool
70
- default y if TCG && ARM
71
+ default y
72
+ depends on TCG && ARM
73
select ARM_TIMER
74
select INTEGRATOR_DEBUG
75
select PL011 # UART
76
@@ -XXX,XX +XXX,XX @@ config INTEGRATOR
77
78
config MAINSTONE
79
bool
80
- default y if TCG && ARM
81
+ default y
82
+ depends on TCG && ARM
83
select PXA2XX
84
select PFLASH_CFI01
85
select SMC91C111
86
87
config MUSCA
88
bool
89
- default y if TCG && ARM
90
+ default y
91
+ depends on TCG && ARM
92
select ARMSSE
93
select PL011
94
select PL031
95
@@ -XXX,XX +XXX,XX @@ config MARVELL_88W8618
96
97
config MUSICPAL
98
bool
99
- default y if TCG && ARM
100
+ default y
101
+ depends on TCG && ARM
102
select OR_IRQ
103
select BITBANG_I2C
104
select MARVELL_88W8618
105
@@ -XXX,XX +XXX,XX @@ config MUSICPAL
106
107
config NETDUINO2
108
bool
109
- default y if TCG && ARM
110
+ default y
111
+ depends on TCG && ARM
112
select STM32F205_SOC
113
114
config NETDUINOPLUS2
115
bool
116
- default y if TCG && ARM
117
+ default y
118
+ depends on TCG && ARM
119
select STM32F405_SOC
120
121
config OLIMEX_STM32_H405
122
bool
123
- default y if TCG && ARM
124
+ default y
125
+ depends on TCG && ARM
126
select STM32F405_SOC
127
128
config NSERIES
129
bool
130
- default y if TCG && ARM
131
+ default y
132
+ depends on TCG && ARM
133
select OMAP
134
select TMP105 # temperature sensor
135
select BLIZZARD # LCD/TV controller
136
@@ -XXX,XX +XXX,XX @@ config PXA2XX
137
138
config GUMSTIX
139
bool
140
- default y if TCG && ARM
141
+ default y
142
+ depends on TCG && ARM
143
select PFLASH_CFI01
144
select SMC91C111
145
select PXA2XX
146
147
config TOSA
148
bool
149
- default y if TCG && ARM
150
+ default y
151
+ depends on TCG && ARM
152
select ZAURUS # scoop
153
select MICRODRIVE
154
select PXA2XX
155
@@ -XXX,XX +XXX,XX @@ config TOSA
156
157
config SPITZ
158
bool
159
- default y if TCG && ARM
160
+ default y
161
+ depends on TCG && ARM
162
select ADS7846 # touch-screen controller
163
select MAX111X # A/D converter
164
select WM8750 # audio codec
165
@@ -XXX,XX +XXX,XX @@ config SPITZ
166
167
config Z2
168
bool
169
- default y if TCG && ARM
170
+ default y
171
+ depends on TCG && ARM
172
select PFLASH_CFI01
173
select WM8750
174
select PL011 # UART
175
@@ -XXX,XX +XXX,XX @@ config Z2
176
177
config REALVIEW
178
bool
179
- default y if TCG && ARM
180
+ default y
181
+ depends on TCG && ARM
182
imply PCI_DEVICES
183
imply PCI_TESTDEV
184
imply I2C_DEVICES
185
@@ -XXX,XX +XXX,XX @@ config REALVIEW
186
187
config SBSA_REF
188
bool
189
- default y if TCG && AARCH64
190
+ default y
191
+ depends on TCG && AARCH64
192
imply PCI_DEVICES
193
select AHCI
194
select ARM_SMMUV3
195
@@ -XXX,XX +XXX,XX @@ config SBSA_REF
196
197
config SABRELITE
198
bool
199
- default y if TCG && ARM
200
+ default y
201
+ depends on TCG && ARM
202
select FSL_IMX6
203
select SSI_M25P80
204
205
config STELLARIS
206
bool
207
- default y if TCG && ARM
208
+ default y
209
+ depends on TCG && ARM
210
imply I2C_DEVICES
211
select ARM_V7M
212
select CMSDK_APB_WATCHDOG
213
@@ -XXX,XX +XXX,XX @@ config STELLARIS
214
215
config STM32VLDISCOVERY
216
bool
217
- default y if TCG && ARM
218
+ default y
219
+ depends on TCG && ARM
220
select STM32F100_SOC
221
222
config STRONGARM
223
@@ -XXX,XX +XXX,XX @@ config STRONGARM
224
225
config COLLIE
226
bool
227
- default y if TCG && ARM
228
+ default y
229
+ depends on TCG && ARM
230
select PFLASH_CFI01
231
select ZAURUS # scoop
232
select STRONGARM
233
234
config SX1
235
bool
236
- default y if TCG && ARM
237
+ default y
238
+ depends on TCG && ARM
239
select OMAP
240
241
config VERSATILE
242
bool
243
- default y if TCG && ARM
244
+ default y
245
+ depends on TCG && ARM
246
select ARM_TIMER # sp804
247
select PFLASH_CFI01
248
select LSI_SCSI_PCI
249
@@ -XXX,XX +XXX,XX @@ config VERSATILE
250
251
config VEXPRESS
252
bool
253
- default y if TCG && ARM
254
+ default y
255
+ depends on TCG && ARM
256
select A9MPCORE
257
select A15MPCORE
258
select ARM_MPTIMER
259
@@ -XXX,XX +XXX,XX @@ config VEXPRESS
260
261
config ZYNQ
262
bool
263
- default y if TCG && ARM
264
+ default y
265
+ depends on TCG && ARM
266
select A9MPCORE
267
select CADENCE # UART
268
select PFLASH_CFI02
269
@@ -XXX,XX +XXX,XX @@ config ZYNQ
270
config ARM_V7M
271
bool
272
# currently v7M must be included in a TCG build due to translate.c
273
- default y if TCG && ARM
274
+ default y
275
+ depends on TCG && ARM
276
select PTIMER
277
278
config ALLWINNER_A10
279
@@ -XXX,XX +XXX,XX @@ config ALLWINNER_A10
280
281
config ALLWINNER_H3
282
bool
283
- default y if TCG && ARM
284
+ default y
285
+ depends on TCG && ARM
286
select ALLWINNER_A10_PIT
287
select ALLWINNER_SUN8I_EMAC
288
select ALLWINNER_I2C
289
@@ -XXX,XX +XXX,XX @@ config ALLWINNER_H3
290
291
config RASPI
292
bool
293
- default y if TCG && ARM
294
+ default y
295
+ depends on TCG && ARM
296
select FRAMEBUFFER
297
select PL011 # UART
298
select SDHCI
299
@@ -XXX,XX +XXX,XX @@ config STM32F405_SOC
300
301
config XLNX_ZYNQMP_ARM
302
bool
303
- default y if TCG && AARCH64
304
+ default y
305
+ depends on TCG && AARCH64
306
select AHCI
307
select ARM_GIC
308
select CADENCE
25
@@ -XXX,XX +XXX,XX @@ config XLNX_ZYNQMP_ARM
309
@@ -XXX,XX +XXX,XX @@ config XLNX_ZYNQMP_ARM
26
select XLNX_CSU_DMA
27
select XLNX_ZYNQMP
28
select XLNX_ZDMA
29
+ select USB_DWC3
30
310
31
config XLNX_VERSAL
311
config XLNX_VERSAL
32
bool
312
bool
313
- default y if TCG && AARCH64
314
+ default y
315
+ depends on TCG && AARCH64
316
select ARM_GIC
317
select PL011
318
select CADENCE
319
@@ -XXX,XX +XXX,XX @@ config XLNX_VERSAL
320
321
config NPCM7XX
322
bool
323
- default y if TCG && ARM
324
+ default y
325
+ depends on TCG && ARM
326
select A9MPCORE
327
select ADM1272
328
select ARM_GIC
329
@@ -XXX,XX +XXX,XX @@ config NPCM7XX
330
331
config FSL_IMX25
332
bool
333
- default y if TCG && ARM
334
+ default y
335
+ depends on TCG && ARM
336
imply I2C_DEVICES
337
select IMX
338
select IMX_FEC
339
@@ -XXX,XX +XXX,XX @@ config FSL_IMX25
340
341
config FSL_IMX31
342
bool
343
- default y if TCG && ARM
344
+ default y
345
+ depends on TCG && ARM
346
imply I2C_DEVICES
347
select SERIAL
348
select IMX
349
@@ -XXX,XX +XXX,XX @@ config FSL_IMX6
350
351
config ASPEED_SOC
352
bool
353
- default y if TCG && ARM
354
+ default y
355
+ depends on TCG && ARM
356
select DS1338
357
select FTGMAC100
358
select I2C
359
@@ -XXX,XX +XXX,XX @@ config ASPEED_SOC
360
361
config MPS2
362
bool
363
- default y if TCG && ARM
364
+ default y
365
+ depends on TCG && ARM
366
imply I2C_DEVICES
367
select ARMSSE
368
select LAN9118
369
@@ -XXX,XX +XXX,XX @@ config MPS2
370
371
config FSL_IMX7
372
bool
373
- default y if TCG && ARM
374
+ default y
375
+ depends on TCG && ARM
376
imply PCI_DEVICES
377
imply TEST_DEVICES
378
imply I2C_DEVICES
379
@@ -XXX,XX +XXX,XX @@ config ARM_SMMUV3
380
381
config FSL_IMX6UL
382
bool
383
- default y if TCG && ARM
384
+ default y
385
+ depends on TCG && ARM
386
imply I2C_DEVICES
387
select A15MPCORE
388
select IMX
389
@@ -XXX,XX +XXX,XX @@ config FSL_IMX6UL
390
391
config MICROBIT
392
bool
393
- default y if TCG && ARM
394
+ default y
395
+ depends on TCG && ARM
396
select NRF51_SOC
397
398
config NRF51_SOC
399
@@ -XXX,XX +XXX,XX @@ config NRF51_SOC
400
401
config EMCRAFT_SF2
402
bool
403
- default y if TCG && ARM
404
+ default y
405
+ depends on TCG && ARM
406
select MSF2
407
select SSI_M25P80
408
33
--
409
--
34
2.34.1
410
2.34.1
35
411
36
412
diff view generated by jsdifflib
1
From: Claudio Fontana <cfontana@suse.de>
1
From: Enze Li <lienze@kylinos.cn>
2
2
3
Signed-off-by: Claudio Fontana <cfontana@suse.de>
3
I noticed that in the latest version, the copyright string is still
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
4
2022, even though 2023 is halfway through. This patch fixes that and
5
Signed-off-by: Fabiano Rosas <farosas@suse.de>
5
fixes the documentation along with it.
6
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
6
7
Signed-off-by: Enze Li <lienze@kylinos.cn>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Message-id: 20230525064345.1152801-1-lienze@kylinos.cn
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
---
11
---
9
target/arm/helper.c | 12 +++++++-----
12
docs/conf.py | 2 +-
10
1 file changed, 7 insertions(+), 5 deletions(-)
13
include/qemu/help-texts.h | 2 +-
14
2 files changed, 2 insertions(+), 2 deletions(-)
11
15
12
diff --git a/target/arm/helper.c b/target/arm/helper.c
16
diff --git a/docs/conf.py b/docs/conf.py
13
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
14
--- a/target/arm/helper.c
18
--- a/docs/conf.py
15
+++ b/target/arm/helper.c
19
+++ b/docs/conf.py
16
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_do_interrupt_aarch64(CPUState *cs)
20
@@ -XXX,XX +XXX,XX @@
17
unsigned int cur_el = arm_current_el(env);
21
18
int rt;
22
# General information about the project.
19
23
project = u'QEMU'
20
- /*
24
-copyright = u'2022, The QEMU Project Developers'
21
- * Note that new_el can never be 0. If cur_el is 0, then
25
+copyright = u'2023, The QEMU Project Developers'
22
- * el0_a64 is is_a64(), else el0_a64 is ignored.
26
author = u'The QEMU Project Developers'
23
- */
27
24
- aarch64_sve_change_el(env, cur_el, new_el, is_a64(env));
28
# The version info for the project you're documenting, acts as replacement for
25
+ if (tcg_enabled()) {
29
diff --git a/include/qemu/help-texts.h b/include/qemu/help-texts.h
26
+ /*
30
index XXXXXXX..XXXXXXX 100644
27
+ * Note that new_el can never be 0. If cur_el is 0, then
31
--- a/include/qemu/help-texts.h
28
+ * el0_a64 is is_a64(), else el0_a64 is ignored.
32
+++ b/include/qemu/help-texts.h
29
+ */
33
@@ -XXX,XX +XXX,XX @@
30
+ aarch64_sve_change_el(env, cur_el, new_el, is_a64(env));
34
#define QEMU_HELP_TEXTS_H
31
+ }
35
32
36
/* Copyright string for -version arguments, About dialogs, etc */
33
if (cur_el < new_el) {
37
-#define QEMU_COPYRIGHT "Copyright (c) 2003-2022 " \
34
/*
38
+#define QEMU_COPYRIGHT "Copyright (c) 2003-2023 " \
39
"Fabrice Bellard and the QEMU Project developers"
40
41
/* Bug reporting information for --help arguments, About dialogs, etc */
35
--
42
--
36
2.34.1
43
2.34.1
37
38
diff view generated by jsdifflib
1
From: Hao Wu <wuhaotsh@google.com>
1
From: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
2
2
3
Signed-off-by: Hao Wu <wuhaotsh@google.com>
3
Let add GIC information into DeviceTree as part of SBSA-REF versioning.
4
Reviewed-by: Titus Rwantare <titusr@google.com>
4
5
Reviewed-by: Philippe Mathieu-Daude <philmd@linaro.org>
5
Trusted Firmware will read it and provide to next firmware level.
6
Message-id: 20230208235433.3989937-4-wuhaotsh@google.com
6
7
Bumps platform version to 0.1 one so we can check is node is present.
8
9
Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
---
12
---
9
docs/system/arm/nuvoton.rst | 2 +-
13
hw/arm/sbsa-ref.c | 19 ++++++++++++++++++-
10
include/hw/arm/npcm7xx.h | 2 ++
14
1 file changed, 18 insertions(+), 1 deletion(-)
11
hw/arm/npcm7xx.c | 25 +++++++++++++++++++++++--
12
3 files changed, 26 insertions(+), 3 deletions(-)
13
15
14
diff --git a/docs/system/arm/nuvoton.rst b/docs/system/arm/nuvoton.rst
16
diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
15
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
16
--- a/docs/system/arm/nuvoton.rst
18
--- a/hw/arm/sbsa-ref.c
17
+++ b/docs/system/arm/nuvoton.rst
19
+++ b/hw/arm/sbsa-ref.c
18
@@ -XXX,XX +XXX,XX @@ Supported devices
19
* SMBus controller (SMBF)
20
* Ethernet controller (EMC)
21
* Tachometer
22
+ * Peripheral SPI controller (PSPI)
23
24
Missing devices
25
---------------
26
@@ -XXX,XX +XXX,XX @@ Missing devices
27
28
* Ethernet controller (GMAC)
29
* USB device (USBD)
30
- * Peripheral SPI controller (PSPI)
31
* SD/MMC host
32
* PECI interface
33
* PCI and PCIe root complex and bridges
34
diff --git a/include/hw/arm/npcm7xx.h b/include/hw/arm/npcm7xx.h
35
index XXXXXXX..XXXXXXX 100644
36
--- a/include/hw/arm/npcm7xx.h
37
+++ b/include/hw/arm/npcm7xx.h
38
@@ -XXX,XX +XXX,XX @@
20
@@ -XXX,XX +XXX,XX @@
39
#include "hw/nvram/npcm7xx_otp.h"
21
#include "exec/hwaddr.h"
40
#include "hw/timer/npcm7xx_timer.h"
22
#include "kvm_arm.h"
41
#include "hw/ssi/npcm7xx_fiu.h"
23
#include "hw/arm/boot.h"
42
+#include "hw/ssi/npcm_pspi.h"
24
+#include "hw/arm/fdt.h"
43
#include "hw/usb/hcd-ehci.h"
25
#include "hw/arm/smmuv3.h"
44
#include "hw/usb/hcd-ohci.h"
26
#include "hw/block/flash.h"
45
#include "target/arm/cpu.h"
27
#include "hw/boards.h"
46
@@ -XXX,XX +XXX,XX @@ struct NPCM7xxState {
28
@@ -XXX,XX +XXX,XX @@ static uint64_t sbsa_ref_cpu_mp_affinity(SBSAMachineState *sms, int idx)
47
NPCM7xxFIUState fiu[2];
29
return arm_cpu_mp_affinity(idx, clustersz);
48
NPCM7xxEMCState emc[2];
30
}
49
NPCM7xxSDHCIState mmc;
31
50
+ NPCMPSPIState pspi[2];
32
+static void sbsa_fdt_add_gic_node(SBSAMachineState *sms)
51
};
33
+{
52
34
+ char *nodename;
53
#define TYPE_NPCM7XX "npcm7xx"
54
diff --git a/hw/arm/npcm7xx.c b/hw/arm/npcm7xx.c
55
index XXXXXXX..XXXXXXX 100644
56
--- a/hw/arm/npcm7xx.c
57
+++ b/hw/arm/npcm7xx.c
58
@@ -XXX,XX +XXX,XX @@ enum NPCM7xxInterrupt {
59
NPCM7XX_EMC1RX_IRQ = 15,
60
NPCM7XX_EMC1TX_IRQ,
61
NPCM7XX_MMC_IRQ = 26,
62
+ NPCM7XX_PSPI2_IRQ = 28,
63
+ NPCM7XX_PSPI1_IRQ = 31,
64
NPCM7XX_TIMER0_IRQ = 32, /* Timer Module 0 */
65
NPCM7XX_TIMER1_IRQ,
66
NPCM7XX_TIMER2_IRQ,
67
@@ -XXX,XX +XXX,XX @@ static const hwaddr npcm7xx_emc_addr[] = {
68
0xf0826000,
69
};
70
71
+/* Register base address for each PSPI Module */
72
+static const hwaddr npcm7xx_pspi_addr[] = {
73
+ 0xf0200000,
74
+ 0xf0201000,
75
+};
76
+
35
+
77
static const struct {
36
+ nodename = g_strdup_printf("/intc");
78
hwaddr regs_addr;
37
+ qemu_fdt_add_subnode(sms->fdt, nodename);
79
uint32_t unconnected_pins;
38
+ qemu_fdt_setprop_sized_cells(sms->fdt, nodename, "reg",
80
@@ -XXX,XX +XXX,XX @@ static void npcm7xx_init(Object *obj)
39
+ 2, sbsa_ref_memmap[SBSA_GIC_DIST].base,
81
object_initialize_child(obj, "emc[*]", &s->emc[i], TYPE_NPCM7XX_EMC);
40
+ 2, sbsa_ref_memmap[SBSA_GIC_DIST].size,
41
+ 2, sbsa_ref_memmap[SBSA_GIC_REDIST].base,
42
+ 2, sbsa_ref_memmap[SBSA_GIC_REDIST].size);
43
+
44
+ g_free(nodename);
45
+}
46
/*
47
* Firmware on this machine only uses ACPI table to load OS, these limited
48
* device tree nodes are just to let firmware know the info which varies from
49
@@ -XXX,XX +XXX,XX @@ static void create_fdt(SBSAMachineState *sms)
50
* fw compatibility.
51
*/
52
qemu_fdt_setprop_cell(fdt, "/", "machine-version-major", 0);
53
- qemu_fdt_setprop_cell(fdt, "/", "machine-version-minor", 0);
54
+ qemu_fdt_setprop_cell(fdt, "/", "machine-version-minor", 1);
55
56
if (ms->numa_state->have_numa_distance) {
57
int size = nb_numa_nodes * nb_numa_nodes * 3 * sizeof(uint32_t);
58
@@ -XXX,XX +XXX,XX @@ static void create_fdt(SBSAMachineState *sms)
59
60
g_free(nodename);
82
}
61
}
83
84
+ for (i = 0; i < ARRAY_SIZE(s->pspi); i++) {
85
+ object_initialize_child(obj, "pspi[*]", &s->pspi[i], TYPE_NPCM_PSPI);
86
+ }
87
+
62
+
88
object_initialize_child(obj, "mmc", &s->mmc, TYPE_NPCM7XX_SDHCI);
63
+ sbsa_fdt_add_gic_node(sms);
89
}
64
}
90
65
91
@@ -XXX,XX +XXX,XX @@ static void npcm7xx_realize(DeviceState *dev, Error **errp)
66
#define SBSA_FLASH_SECTOR_SIZE (256 * KiB)
92
sysbus_connect_irq(SYS_BUS_DEVICE(&s->mmc), 0,
93
npcm7xx_irq(s, NPCM7XX_MMC_IRQ));
94
95
+ /* PSPI */
96
+ QEMU_BUILD_BUG_ON(ARRAY_SIZE(npcm7xx_pspi_addr) != ARRAY_SIZE(s->pspi));
97
+ for (i = 0; i < ARRAY_SIZE(s->pspi); i++) {
98
+ SysBusDevice *sbd = SYS_BUS_DEVICE(&s->pspi[i]);
99
+ int irq = (i == 0) ? NPCM7XX_PSPI1_IRQ : NPCM7XX_PSPI2_IRQ;
100
+
101
+ sysbus_realize(sbd, &error_abort);
102
+ sysbus_mmio_map(sbd, 0, npcm7xx_pspi_addr[i]);
103
+ sysbus_connect_irq(sbd, 0, npcm7xx_irq(s, irq));
104
+ }
105
+
106
create_unimplemented_device("npcm7xx.shm", 0xc0001000, 4 * KiB);
107
create_unimplemented_device("npcm7xx.vdmx", 0xe0800000, 4 * KiB);
108
create_unimplemented_device("npcm7xx.pcierc", 0xe1000000, 64 * KiB);
109
@@ -XXX,XX +XXX,XX @@ static void npcm7xx_realize(DeviceState *dev, Error **errp)
110
create_unimplemented_device("npcm7xx.peci", 0xf0100000, 4 * KiB);
111
create_unimplemented_device("npcm7xx.siox[1]", 0xf0101000, 4 * KiB);
112
create_unimplemented_device("npcm7xx.siox[2]", 0xf0102000, 4 * KiB);
113
- create_unimplemented_device("npcm7xx.pspi1", 0xf0200000, 4 * KiB);
114
- create_unimplemented_device("npcm7xx.pspi2", 0xf0201000, 4 * KiB);
115
create_unimplemented_device("npcm7xx.ahbpci", 0xf0400000, 1 * MiB);
116
create_unimplemented_device("npcm7xx.mcphy", 0xf05f0000, 64 * KiB);
117
create_unimplemented_device("npcm7xx.gmac1", 0xf0802000, 8 * KiB);
118
--
67
--
119
2.34.1
68
2.34.1
diff view generated by jsdifflib
1
From: Hao Wu <wuhaotsh@google.com>
1
From: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
2
2
3
Havard is no longer working on the Nuvoton systems for a while
3
We moved from VGA to Bochs to have PCIe card.
4
and won't be able to do any work on it in the future. So I'll
5
take over maintaining the Nuvoton system from him.
6
4
7
Signed-off-by: Hao Wu <wuhaotsh@google.com>
5
Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
8
Acked-by: Havard Skinnemoen <hskinnemoen@google.com>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Philippe Mathieu-Daude <philmd@linaro.org>
10
Message-id: 20230208235433.3989937-2-wuhaotsh@google.com
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
8
---
13
MAINTAINERS | 2 +-
9
docs/system/arm/sbsa.rst | 2 +-
14
1 file changed, 1 insertion(+), 1 deletion(-)
10
1 file changed, 1 insertion(+), 1 deletion(-)
15
11
16
diff --git a/MAINTAINERS b/MAINTAINERS
12
diff --git a/docs/system/arm/sbsa.rst b/docs/system/arm/sbsa.rst
17
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
18
--- a/MAINTAINERS
14
--- a/docs/system/arm/sbsa.rst
19
+++ b/MAINTAINERS
15
+++ b/docs/system/arm/sbsa.rst
20
@@ -XXX,XX +XXX,XX @@ F: include/hw/net/mv88w8618_eth.h
16
@@ -XXX,XX +XXX,XX @@ The sbsa-ref board supports:
21
F: docs/system/arm/musicpal.rst
17
- System bus EHCI controller
22
18
- CDROM and hard disc on AHCI bus
23
Nuvoton NPCM7xx
19
- E1000E ethernet card on PCIe bus
24
-M: Havard Skinnemoen <hskinnemoen@google.com>
20
- - VGA display adaptor on PCIe bus
25
M: Tyrone Ting <kfting@nuvoton.com>
21
+ - Bochs display adapter on PCIe bus
26
+M: Hao Wu <wuhaotsh@google.com>
22
- A generic SBSA watchdog device
27
L: qemu-arm@nongnu.org
23
28
S: Supported
29
F: hw/*/npcm7xx*
30
--
24
--
31
2.34.1
25
2.34.1
diff view generated by jsdifflib
Deleted patch
1
From: Claudio Fontana <cfontana@suse.de>
2
1
3
make it clearer from the name that this is a tcg-only function.
4
5
Signed-off-by: Claudio Fontana <cfontana@suse.de>
6
Signed-off-by: Fabiano Rosas <farosas@suse.de>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
9
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
12
target/arm/helper.c | 4 ++--
13
1 file changed, 2 insertions(+), 2 deletions(-)
14
15
diff --git a/target/arm/helper.c b/target/arm/helper.c
16
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/helper.c
18
+++ b/target/arm/helper.c
19
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_do_interrupt_aarch64(CPUState *cs)
20
* trapped to the hypervisor in KVM.
21
*/
22
#ifdef CONFIG_TCG
23
-static void handle_semihosting(CPUState *cs)
24
+static void tcg_handle_semihosting(CPUState *cs)
25
{
26
ARMCPU *cpu = ARM_CPU(cs);
27
CPUARMState *env = &cpu->env;
28
@@ -XXX,XX +XXX,XX @@ void arm_cpu_do_interrupt(CPUState *cs)
29
*/
30
#ifdef CONFIG_TCG
31
if (cs->exception_index == EXCP_SEMIHOST) {
32
- handle_semihosting(cs);
33
+ tcg_handle_semihosting(cs);
34
return;
35
}
36
#endif
37
--
38
2.34.1
39
40
diff view generated by jsdifflib