1
Hi; here's the first arm pullreq for the 8.2 cycle. These are
1
v1->v2 changes: fix a clang warning about bitfields;
2
pretty much all bug fixes (mostly for the experimental FEAT_RME),
2
drop a patch from Julia that I accidentally included
3
rather than any major features.
3
(it will likely be in a future series).
4
4
5
-- PMM
5
The following changes since commit a8d2b0685681e2f291faaa501efbbd76875f8ec8:
6
6
7
The following changes since commit b0dd9a7d6dd15a6898e9c585b521e6bec79b25aa:
7
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20190118' into staging (2019-01-18 16:56:15 +0000)
8
9
Open 8.2 development tree (2023-08-22 07:14:07 -0700)
10
8
11
are available in the Git repository at:
9
are available in the Git repository at:
12
10
13
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20230824
11
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20190121
14
12
15
for you to fetch changes up to cd1e4db73646006039f25879af3bff55b2295ff3:
13
for you to fetch changes up to 0d4bfd7df809863b1f45fad35229fb9419527d06:
16
14
17
target/arm: Fix 64-bit SSRA (2023-08-22 17:31:14 +0100)
15
target/arm: Implement PMSWINC (2019-01-21 10:38:56 +0000)
18
16
19
----------------------------------------------------------------
17
----------------------------------------------------------------
20
target-arm queue:
18
target-arm queue:
21
* hw/gpio/nrf51: implement DETECT signal
19
* hw/char/stm32f2xx_usart: Do not update data register when device is disabled
22
* accel/kvm: Specify default IPA size for arm64
20
* hw/arm/virt-acpi-build: Set COHACC override flag in IORT SMMUv3 node
23
* ptw: refactor, fix some FEAT_RME bugs
21
* target/arm: Allow Aarch32 exception return to switch from Mon->Hyp
24
* target/arm: Adjust PAR_EL1.SH for Device and Normal-NC memory types
22
* ftgmac100: implement the new MDIO interface on Aspeed SoC
25
* target/arm/helper: Implement CNTHCTL_EL2.CNT[VP]MASK
23
* implement the ARMv8.3-PAuth extension
26
* Fix SME ST1Q
24
* improve emulation of the ARM PMU
27
* Fix 64-bit SSRA
28
25
29
----------------------------------------------------------------
26
----------------------------------------------------------------
30
Akihiko Odaki (6):
27
Aaron Lindsay (13):
31
kvm: Introduce kvm_arch_get_default_type hook
28
migration: Add post_save function to VMStateDescription
32
accel/kvm: Specify default IPA size for arm64
29
target/arm: Reorganize PMCCNTR accesses
33
mips: Report an error when KVM_VM_MIPS_VZ is unavailable
30
target/arm: Swap PMU values before/after migrations
34
accel/kvm: Use negative KVM type for error propagation
31
target/arm: Filter cycle counter based on PMCCFILTR_EL0
35
accel/kvm: Free as when an error occurred
32
target/arm: Allow AArch32 access for PMCCFILTR
36
accel/kvm: Make kvm_dirty_ring_reaper_init() void
33
target/arm: Implement PMOVSSET
34
target/arm: Define FIELDs for ID_DFR0
35
target/arm: Make PMCEID[01]_EL0 64 bit registers, add PMCEID[23]
36
target/arm: Add array for supported PMU events, generate PMCEID[01]_EL0
37
target/arm: Finish implementation of PM[X]EVCNTR and PM[X]EVTYPER
38
target/arm: PMU: Add instruction and cycle events
39
target/arm: PMU: Set PMCR.N to 4
40
target/arm: Implement PMSWINC
37
41
38
Chris Laplante (6):
42
Alexander Graf (1):
39
hw/gpio/nrf51: implement DETECT signal
43
target/arm: Allow Aarch32 exception return to switch from Mon->Hyp
40
qtest: factor out qtest_install_gpio_out_intercept
41
qtest: implement named interception of out-GPIO
42
qtest: bail from irq_intercept_in if name is specified
43
qtest: irq_intercept_[out/in]: return FAIL if no intercepts are installed
44
qtest: microbit-test: add tests for nRF51 DETECT
45
44
46
Jean-Philippe Brucker (6):
45
Cédric Le Goater (1):
47
target/arm/ptw: Load stage-2 tables from realm physical space
46
ftgmac100: implement the new MDIO interface on Aspeed SoC
48
target/arm/helper: Fix tlbmask and tlbbits for TLBI VAE2*
49
target/arm: Skip granule protection checks for AT instructions
50
target/arm: Pass security space rather than flag for AT instructions
51
target/arm/helper: Check SCR_EL3.{NSE, NS} encoding for AT instructions
52
target/arm/helper: Implement CNTHCTL_EL2.CNT[VP]MASK
53
47
54
Peter Maydell (15):
48
Eric Auger (1):
55
target/arm/ptw: Don't set fi->s1ptw for UnsuppAtomicUpdate fault
49
hw/arm/virt-acpi-build: Set COHACC override flag in IORT SMMUv3 node
56
target/arm/ptw: Don't report GPC faults on stage 1 ptw as stage2 faults
57
target/arm/ptw: Set s1ns bit in fault info more consistently
58
target/arm/ptw: Pass ptw into get_phys_addr_pmsa*() and get_phys_addr_disabled()
59
target/arm/ptw: Pass ARMSecurityState to regime_translation_disabled()
60
target/arm/ptw: Pass an ARMSecuritySpace to arm_hcr_el2_eff_secstate()
61
target/arm: Pass an ARMSecuritySpace to arm_is_el2_enabled_secstate()
62
target/arm/ptw: Only fold in NSTable bit effects in Secure state
63
target/arm/ptw: Remove last uses of ptw->in_secure
64
target/arm/ptw: Remove S1Translate::in_secure
65
target/arm/ptw: Drop S1Translate::out_secure
66
target/arm/ptw: Set attributes correctly for MMU disabled data accesses
67
target/arm/ptw: Check for block descriptors at invalid levels
68
target/arm/ptw: Report stage 2 fault level for stage 2 faults on stage 1 ptw
69
target/arm: Adjust PAR_EL1.SH for Device and Normal-NC memory types
70
50
71
Richard Henderson (2):
51
Philippe Mathieu-Daudé (1):
72
target/arm: Fix SME ST1Q
52
hw/char/stm32f2xx_usart: Do not update data register when device is disabled
73
target/arm: Fix 64-bit SSRA
74
53
75
include/hw/gpio/nrf51_gpio.h | 1 +
54
Richard Henderson (31):
76
include/sysemu/kvm.h | 2 +
55
target/arm: Add state for the ARMv8.3-PAuth extension
77
target/arm/cpu.h | 19 ++--
56
target/arm: Add SCTLR bits through ARMv8.5
78
target/arm/internals.h | 25 ++---
57
target/arm: Add PAuth active bit to tbflags
79
target/mips/kvm_mips.h | 9 --
58
target/arm: Introduce raise_exception_ra
80
tests/qtest/libqtest.h | 11 +++
59
target/arm: Add PAuth helpers
81
accel/kvm/kvm-all.c | 19 ++--
60
target/arm: Decode PAuth within system hint space
82
hw/arm/virt.c | 2 +-
61
target/arm: Rearrange decode in disas_data_proc_1src
83
hw/gpio/nrf51_gpio.c | 14 ++-
62
target/arm: Decode PAuth within disas_data_proc_1src
84
hw/mips/loongson3_virt.c | 2 -
63
target/arm: Decode PAuth within disas_data_proc_2src
85
hw/ppc/spapr.c | 2 +-
64
target/arm: Move helper_exception_return to helper-a64.c
86
softmmu/qtest.c | 52 +++++++---
65
target/arm: Add new_pc argument to helper_exception_return
87
target/arm/cpu.c | 6 ++
66
target/arm: Rearrange decode in disas_uncond_b_reg
88
target/arm/helper.c | 207 ++++++++++++++++++++++++++++----------
67
target/arm: Decode PAuth within disas_uncond_b_reg
89
target/arm/kvm.c | 7 ++
68
target/arm: Decode Load/store register (pac)
90
target/arm/ptw.c | 231 ++++++++++++++++++++++++++-----------------
69
target/arm: Move cpu_mmu_index out of line
91
target/arm/tcg/sme_helper.c | 2 +-
70
target/arm: Introduce arm_mmu_idx
92
target/arm/tcg/translate.c | 2 +-
71
target/arm: Introduce arm_stage1_mmu_idx
93
target/i386/kvm/kvm.c | 5 +
72
target/arm: Create ARMVAParameters and helpers
94
target/mips/kvm.c | 3 +-
73
target/arm: Merge TBFLAG_AA_TB{0, 1} to TBII
95
target/ppc/kvm.c | 5 +
74
target/arm: Export aa64_va_parameters to internals.h
96
target/riscv/kvm.c | 5 +
75
target/arm: Add aa64_va_parameters_both
97
target/s390x/kvm/kvm.c | 5 +
76
target/arm: Decode TBID from TCR
98
tests/qtest/libqtest.c | 6 ++
77
target/arm: Reuse aa64_va_parameters for setting tbflags
99
tests/qtest/microbit-test.c | 44 +++++++++
78
target/arm: Implement pauth_strip
100
target/arm/trace-events | 7 +-
79
target/arm: Implement pauth_auth
101
26 files changed, 494 insertions(+), 199 deletions(-)
80
target/arm: Implement pauth_addpac
81
target/arm: Implement pauth_computepac
82
target/arm: Add PAuth system registers
83
target/arm: Enable PAuth for -cpu max
84
target/arm: Enable PAuth for user-only
85
target/arm: Tidy TBI handling in gen_a64_set_pc
86
87
target/arm/Makefile.objs | 1 +
88
include/hw/acpi/acpi-defs.h | 2 +
89
include/migration/vmstate.h | 1 +
90
target/arm/cpu.h | 244 +++++----
91
target/arm/helper-a64.h | 14 +
92
target/arm/helper.h | 1 -
93
target/arm/internals.h | 77 +++
94
target/arm/translate.h | 5 +-
95
hw/arm/virt-acpi-build.c | 1 +
96
hw/char/stm32f2xx_usart.c | 3 +-
97
hw/net/ftgmac100.c | 80 ++-
98
migration/vmstate.c | 13 +-
99
target/arm/cpu.c | 19 +-
100
target/arm/cpu64.c | 68 ++-
101
target/arm/helper-a64.c | 155 ++++++
102
target/arm/helper.c | 1222 +++++++++++++++++++++++++++++++++----------
103
target/arm/machine.c | 24 +
104
target/arm/op_helper.c | 174 +-----
105
target/arm/pauth_helper.c | 497 ++++++++++++++++++
106
target/arm/translate-a64.c | 537 ++++++++++++++++---
107
docs/devel/migration.rst | 9 +-
108
21 files changed, 2515 insertions(+), 632 deletions(-)
109
create mode 100644 target/arm/pauth_helper.c
110
diff view generated by jsdifflib
Deleted patch
1
From: Chris Laplante <chris@laplante.io>
2
1
3
Implement nRF51 DETECT signal in the GPIO peripheral.
4
5
The reference manual makes mention of a per-pin DETECT signal, but these
6
are not exposed to the user. See https://devzone.nordicsemi.com/f/nordic-q-a/39858/gpio-per-pin-detect-signal-available
7
for more information. Currently, I don't see a reason to model these.
8
9
Signed-off-by: Chris Laplante <chris@laplante.io>
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
Message-id: 20230728160324.1159090-2-chris@laplante.io
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
14
include/hw/gpio/nrf51_gpio.h | 1 +
15
hw/gpio/nrf51_gpio.c | 14 +++++++++++++-
16
2 files changed, 14 insertions(+), 1 deletion(-)
17
18
diff --git a/include/hw/gpio/nrf51_gpio.h b/include/hw/gpio/nrf51_gpio.h
19
index XXXXXXX..XXXXXXX 100644
20
--- a/include/hw/gpio/nrf51_gpio.h
21
+++ b/include/hw/gpio/nrf51_gpio.h
22
@@ -XXX,XX +XXX,XX @@ struct NRF51GPIOState {
23
uint32_t old_out_connected;
24
25
qemu_irq output[NRF51_GPIO_PINS];
26
+ qemu_irq detect;
27
};
28
29
30
diff --git a/hw/gpio/nrf51_gpio.c b/hw/gpio/nrf51_gpio.c
31
index XXXXXXX..XXXXXXX 100644
32
--- a/hw/gpio/nrf51_gpio.c
33
+++ b/hw/gpio/nrf51_gpio.c
34
@@ -XXX,XX +XXX,XX @@ static void update_state(NRF51GPIOState *s)
35
int pull;
36
size_t i;
37
bool connected_out, dir, connected_in, out, in, input;
38
+ bool assert_detect = false;
39
40
for (i = 0; i < NRF51_GPIO_PINS; i++) {
41
pull = pull_value(s->cnf[i]);
42
@@ -XXX,XX +XXX,XX @@ static void update_state(NRF51GPIOState *s)
43
qemu_log_mask(LOG_GUEST_ERROR,
44
"GPIO pin %zu short circuited\n", i);
45
}
46
- if (!connected_in) {
47
+ if (connected_in) {
48
+ uint32_t detect_config = extract32(s->cnf[i], 16, 2);
49
+ if ((detect_config == 2) && (in == 1)) {
50
+ assert_detect = true;
51
+ }
52
+ if ((detect_config == 3) && (in == 0)) {
53
+ assert_detect = true;
54
+ }
55
+ } else {
56
/*
57
* Floating input: the output stimulates IN if connected,
58
* otherwise pull-up/pull-down resistors put a value on both
59
@@ -XXX,XX +XXX,XX @@ static void update_state(NRF51GPIOState *s)
60
}
61
update_output_irq(s, i, connected_out, out);
62
}
63
+
64
+ qemu_set_irq(s->detect, assert_detect);
65
}
66
67
/*
68
@@ -XXX,XX +XXX,XX @@ static void nrf51_gpio_init(Object *obj)
69
70
qdev_init_gpio_in(DEVICE(s), nrf51_gpio_set, NRF51_GPIO_PINS);
71
qdev_init_gpio_out(DEVICE(s), s->output, NRF51_GPIO_PINS);
72
+ qdev_init_gpio_out_named(DEVICE(s), &s->detect, "detect", 1);
73
}
74
75
static void nrf51_gpio_class_init(ObjectClass *klass, void *data)
76
--
77
2.34.1
diff view generated by jsdifflib
Deleted patch
1
From: Chris Laplante <chris@laplante.io>
2
1
3
Signed-off-by: Chris Laplante <chris@laplante.io>
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5
Message-id: 20230728160324.1159090-3-chris@laplante.io
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
---
8
softmmu/qtest.c | 16 ++++++++++------
9
1 file changed, 10 insertions(+), 6 deletions(-)
10
11
diff --git a/softmmu/qtest.c b/softmmu/qtest.c
12
index XXXXXXX..XXXXXXX 100644
13
--- a/softmmu/qtest.c
14
+++ b/softmmu/qtest.c
15
@@ -XXX,XX +XXX,XX @@ void qtest_set_command_cb(bool (*pc_cb)(CharBackend *chr, gchar **words))
16
process_command_cb = pc_cb;
17
}
18
19
+static void qtest_install_gpio_out_intercept(DeviceState *dev, const char *name, int n)
20
+{
21
+ qemu_irq *disconnected = g_new0(qemu_irq, 1);
22
+ qemu_irq icpt = qemu_allocate_irq(qtest_irq_handler,
23
+ disconnected, n);
24
+
25
+ *disconnected = qdev_intercept_gpio_out(dev, icpt, name, n);
26
+}
27
+
28
static void qtest_process_command(CharBackend *chr, gchar **words)
29
{
30
const gchar *command;
31
@@ -XXX,XX +XXX,XX @@ static void qtest_process_command(CharBackend *chr, gchar **words)
32
if (words[0][14] == 'o') {
33
int i;
34
for (i = 0; i < ngl->num_out; ++i) {
35
- qemu_irq *disconnected = g_new0(qemu_irq, 1);
36
- qemu_irq icpt = qemu_allocate_irq(qtest_irq_handler,
37
- disconnected, i);
38
-
39
- *disconnected = qdev_intercept_gpio_out(dev, icpt,
40
- ngl->name, i);
41
+ qtest_install_gpio_out_intercept(dev, ngl->name, i);
42
}
43
} else {
44
qemu_irq_intercept_in(ngl->in, qtest_irq_handler,
45
--
46
2.34.1
diff view generated by jsdifflib
Deleted patch
1
From: Chris Laplante <chris@laplante.io>
2
1
3
Adds qtest_irq_intercept_out_named method, which utilizes a new optional
4
name parameter to the irq_intercept_out qtest command.
5
6
Signed-off-by: Chris Laplante <chris@laplante.io>
7
Message-id: 20230728160324.1159090-4-chris@laplante.io
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
tests/qtest/libqtest.h | 11 +++++++++++
12
softmmu/qtest.c | 18 ++++++++++--------
13
tests/qtest/libqtest.c | 6 ++++++
14
3 files changed, 27 insertions(+), 8 deletions(-)
15
16
diff --git a/tests/qtest/libqtest.h b/tests/qtest/libqtest.h
17
index XXXXXXX..XXXXXXX 100644
18
--- a/tests/qtest/libqtest.h
19
+++ b/tests/qtest/libqtest.h
20
@@ -XXX,XX +XXX,XX @@ void qtest_irq_intercept_in(QTestState *s, const char *string);
21
*/
22
void qtest_irq_intercept_out(QTestState *s, const char *string);
23
24
+/**
25
+ * qtest_irq_intercept_out_named:
26
+ * @s: #QTestState instance to operate on.
27
+ * @qom_path: QOM path of a device.
28
+ * @name: Name of the GPIO out pin
29
+ *
30
+ * Associate a qtest irq with the named GPIO-out pin of the device
31
+ * whose path is specified by @string and whose name is @name.
32
+ */
33
+void qtest_irq_intercept_out_named(QTestState *s, const char *qom_path, const char *name);
34
+
35
/**
36
* qtest_set_irq_in:
37
* @s: QTestState instance to operate on.
38
diff --git a/softmmu/qtest.c b/softmmu/qtest.c
39
index XXXXXXX..XXXXXXX 100644
40
--- a/softmmu/qtest.c
41
+++ b/softmmu/qtest.c
42
@@ -XXX,XX +XXX,XX @@ static void qtest_process_command(CharBackend *chr, gchar **words)
43
|| strcmp(words[0], "irq_intercept_in") == 0) {
44
DeviceState *dev;
45
NamedGPIOList *ngl;
46
+ bool is_outbound;
47
48
g_assert(words[1]);
49
+ is_outbound = words[0][14] == 'o';
50
dev = DEVICE(object_resolve_path(words[1], NULL));
51
if (!dev) {
52
qtest_send_prefix(chr);
53
@@ -XXX,XX +XXX,XX @@ static void qtest_process_command(CharBackend *chr, gchar **words)
54
}
55
56
QLIST_FOREACH(ngl, &dev->gpios, node) {
57
- /* We don't support intercept of named GPIOs yet */
58
- if (ngl->name) {
59
- continue;
60
- }
61
- if (words[0][14] == 'o') {
62
- int i;
63
- for (i = 0; i < ngl->num_out; ++i) {
64
- qtest_install_gpio_out_intercept(dev, ngl->name, i);
65
+ /* We don't support inbound interception of named GPIOs yet */
66
+ if (is_outbound) {
67
+ /* NULL is valid and matchable, for "unnamed GPIO" */
68
+ if (g_strcmp0(ngl->name, words[2]) == 0) {
69
+ int i;
70
+ for (i = 0; i < ngl->num_out; ++i) {
71
+ qtest_install_gpio_out_intercept(dev, ngl->name, i);
72
+ }
73
}
74
} else {
75
qemu_irq_intercept_in(ngl->in, qtest_irq_handler,
76
diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
77
index XXXXXXX..XXXXXXX 100644
78
--- a/tests/qtest/libqtest.c
79
+++ b/tests/qtest/libqtest.c
80
@@ -XXX,XX +XXX,XX @@ void qtest_irq_intercept_out(QTestState *s, const char *qom_path)
81
qtest_rsp(s);
82
}
83
84
+void qtest_irq_intercept_out_named(QTestState *s, const char *qom_path, const char *name)
85
+{
86
+ qtest_sendf(s, "irq_intercept_out %s %s\n", qom_path, name);
87
+ qtest_rsp(s);
88
+}
89
+
90
void qtest_irq_intercept_in(QTestState *s, const char *qom_path)
91
{
92
qtest_sendf(s, "irq_intercept_in %s\n", qom_path);
93
--
94
2.34.1
diff view generated by jsdifflib
Deleted patch
1
From: Chris Laplante <chris@laplante.io>
2
1
3
Named interception of in-GPIOs is not supported yet.
4
5
Signed-off-by: Chris Laplante <chris@laplante.io>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Message-id: 20230728160324.1159090-5-chris@laplante.io
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
10
softmmu/qtest.c | 8 ++++++++
11
1 file changed, 8 insertions(+)
12
13
diff --git a/softmmu/qtest.c b/softmmu/qtest.c
14
index XXXXXXX..XXXXXXX 100644
15
--- a/softmmu/qtest.c
16
+++ b/softmmu/qtest.c
17
@@ -XXX,XX +XXX,XX @@ static void qtest_process_command(CharBackend *chr, gchar **words)
18
|| strcmp(words[0], "irq_intercept_in") == 0) {
19
DeviceState *dev;
20
NamedGPIOList *ngl;
21
+ bool is_named;
22
bool is_outbound;
23
24
g_assert(words[1]);
25
+ is_named = words[2] != NULL;
26
is_outbound = words[0][14] == 'o';
27
dev = DEVICE(object_resolve_path(words[1], NULL));
28
if (!dev) {
29
@@ -XXX,XX +XXX,XX @@ static void qtest_process_command(CharBackend *chr, gchar **words)
30
return;
31
}
32
33
+ if (is_named && !is_outbound) {
34
+ qtest_send_prefix(chr);
35
+ qtest_send(chr, "FAIL Interception of named in-GPIOs not yet supported\n");
36
+ return;
37
+ }
38
+
39
if (irq_intercept_dev) {
40
qtest_send_prefix(chr);
41
if (irq_intercept_dev != dev) {
42
--
43
2.34.1
diff view generated by jsdifflib
Deleted patch
1
From: Chris Laplante <chris@laplante.io>
2
1
3
This is much better than just silently failing with OK.
4
5
Signed-off-by: Chris Laplante <chris@laplante.io>
6
Message-id: 20230728160324.1159090-6-chris@laplante.io
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
10
softmmu/qtest.c | 12 ++++++++++--
11
1 file changed, 10 insertions(+), 2 deletions(-)
12
13
diff --git a/softmmu/qtest.c b/softmmu/qtest.c
14
index XXXXXXX..XXXXXXX 100644
15
--- a/softmmu/qtest.c
16
+++ b/softmmu/qtest.c
17
@@ -XXX,XX +XXX,XX @@ static void qtest_process_command(CharBackend *chr, gchar **words)
18
NamedGPIOList *ngl;
19
bool is_named;
20
bool is_outbound;
21
+ bool interception_succeeded = false;
22
23
g_assert(words[1]);
24
is_named = words[2] != NULL;
25
@@ -XXX,XX +XXX,XX @@ static void qtest_process_command(CharBackend *chr, gchar **words)
26
for (i = 0; i < ngl->num_out; ++i) {
27
qtest_install_gpio_out_intercept(dev, ngl->name, i);
28
}
29
+ interception_succeeded = true;
30
}
31
} else {
32
qemu_irq_intercept_in(ngl->in, qtest_irq_handler,
33
ngl->num_in);
34
+ interception_succeeded = true;
35
}
36
}
37
- irq_intercept_dev = dev;
38
+
39
qtest_send_prefix(chr);
40
- qtest_send(chr, "OK\n");
41
+ if (interception_succeeded) {
42
+ irq_intercept_dev = dev;
43
+ qtest_send(chr, "OK\n");
44
+ } else {
45
+ qtest_send(chr, "FAIL No intercepts installed\n");
46
+ }
47
} else if (strcmp(words[0], "set_irq_in") == 0) {
48
DeviceState *dev;
49
qemu_irq irq;
50
--
51
2.34.1
diff view generated by jsdifflib
Deleted patch
1
From: Chris Laplante <chris@laplante.io>
2
1
3
Exercise the DETECT mechanism of the GPIO peripheral.
4
5
Signed-off-by: Chris Laplante <chris@laplante.io>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Message-id: 20230728160324.1159090-7-chris@laplante.io
8
[PMM: fixed coding style nits]
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
tests/qtest/microbit-test.c | 44 +++++++++++++++++++++++++++++++++++++
12
1 file changed, 44 insertions(+)
13
14
diff --git a/tests/qtest/microbit-test.c b/tests/qtest/microbit-test.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/tests/qtest/microbit-test.c
17
+++ b/tests/qtest/microbit-test.c
18
@@ -XXX,XX +XXX,XX @@ static void test_nrf51_gpio(void)
19
qtest_quit(qts);
20
}
21
22
+static void test_nrf51_gpio_detect(void)
23
+{
24
+ QTestState *qts = qtest_init("-M microbit");
25
+ int i;
26
+
27
+ /* Connect input buffer on pins 1-7, configure SENSE for high level */
28
+ for (i = 1; i <= 7; i++) {
29
+ qtest_writel(qts, NRF51_GPIO_BASE + NRF51_GPIO_REG_CNF_START + i * 4,
30
+ deposit32(0, 16, 2, 2));
31
+ }
32
+
33
+ qtest_irq_intercept_out_named(qts, "/machine/nrf51/gpio", "detect");
34
+
35
+ for (i = 1; i <= 7; i++) {
36
+ /* Set pin high */
37
+ qtest_set_irq_in(qts, "/machine/nrf51", "unnamed-gpio-in", i, 1);
38
+ uint32_t actual = qtest_readl(qts, NRF51_GPIO_BASE + NRF51_GPIO_REG_IN);
39
+ g_assert_cmpuint(actual, ==, 1 << i);
40
+
41
+ /* Check that DETECT is high */
42
+ g_assert_true(qtest_get_irq(qts, 0));
43
+
44
+ /* Set pin low, check that DETECT goes low. */
45
+ qtest_set_irq_in(qts, "/machine/nrf51", "unnamed-gpio-in", i, 0);
46
+ actual = qtest_readl(qts, NRF51_GPIO_BASE + NRF51_GPIO_REG_IN);
47
+ g_assert_cmpuint(actual, ==, 0x0);
48
+ g_assert_false(qtest_get_irq(qts, 0));
49
+ }
50
+
51
+ /* Set pin 0 high, check that DETECT doesn't fire */
52
+ qtest_set_irq_in(qts, "/machine/nrf51", "unnamed-gpio-in", 0, 1);
53
+ g_assert_false(qtest_get_irq(qts, 0));
54
+ qtest_set_irq_in(qts, "/machine/nrf51", "unnamed-gpio-in", 0, 0);
55
+
56
+ /* Set pins 1, 2, and 3 high, then set 3 low. Check DETECT is still high */
57
+ for (i = 1; i <= 3; i++) {
58
+ qtest_set_irq_in(qts, "/machine/nrf51", "unnamed-gpio-in", i, 1);
59
+ }
60
+ g_assert_true(qtest_get_irq(qts, 0));
61
+ qtest_set_irq_in(qts, "/machine/nrf51", "unnamed-gpio-in", 3, 0);
62
+ g_assert_true(qtest_get_irq(qts, 0));
63
+}
64
+
65
static void timer_task(QTestState *qts, hwaddr task)
66
{
67
qtest_writel(qts, NRF51_TIMER_BASE + task, NRF51_TRIGGER_TASK);
68
@@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv)
69
70
qtest_add_func("/microbit/nrf51/uart", test_nrf51_uart);
71
qtest_add_func("/microbit/nrf51/gpio", test_nrf51_gpio);
72
+ qtest_add_func("/microbit/nrf51/gpio_detect", test_nrf51_gpio_detect);
73
qtest_add_func("/microbit/nrf51/nvmc", test_nrf51_nvmc);
74
qtest_add_func("/microbit/nrf51/timer", test_nrf51_timer);
75
qtest_add_func("/microbit/microbit/i2c", test_microbit_i2c);
76
--
77
2.34.1
diff view generated by jsdifflib
Deleted patch
1
From: Akihiko Odaki <akihiko.odaki@daynix.com>
2
1
3
kvm_arch_get_default_type() returns the default KVM type. This hook is
4
particularly useful to derive a KVM type that is valid for "none"
5
machine model, which is used by libvirt to probe the availability of
6
KVM.
7
8
For MIPS, the existing mips_kvm_type() is reused. This function ensures
9
the availability of VZ which is mandatory to use KVM on the current
10
QEMU.
11
12
Cc: qemu-stable@nongnu.org
13
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
14
Message-id: 20230727073134.134102-2-akihiko.odaki@daynix.com
15
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
16
[PMM: added doc comment for new function]
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
19
---
20
include/sysemu/kvm.h | 2 ++
21
target/mips/kvm_mips.h | 9 ---------
22
accel/kvm/kvm-all.c | 4 +++-
23
hw/mips/loongson3_virt.c | 2 --
24
target/arm/kvm.c | 5 +++++
25
target/i386/kvm/kvm.c | 5 +++++
26
target/mips/kvm.c | 2 +-
27
target/ppc/kvm.c | 5 +++++
28
target/riscv/kvm.c | 5 +++++
29
target/s390x/kvm/kvm.c | 5 +++++
30
10 files changed, 31 insertions(+), 13 deletions(-)
31
32
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
33
index XXXXXXX..XXXXXXX 100644
34
--- a/include/sysemu/kvm.h
35
+++ b/include/sysemu/kvm.h
36
@@ -XXX,XX +XXX,XX @@ int kvm_arch_get_registers(CPUState *cpu);
37
38
int kvm_arch_put_registers(CPUState *cpu, int level);
39
40
+int kvm_arch_get_default_type(MachineState *ms);
41
+
42
int kvm_arch_init(MachineState *ms, KVMState *s);
43
44
int kvm_arch_init_vcpu(CPUState *cpu);
45
diff --git a/target/mips/kvm_mips.h b/target/mips/kvm_mips.h
46
index XXXXXXX..XXXXXXX 100644
47
--- a/target/mips/kvm_mips.h
48
+++ b/target/mips/kvm_mips.h
49
@@ -XXX,XX +XXX,XX @@ void kvm_mips_reset_vcpu(MIPSCPU *cpu);
50
int kvm_mips_set_interrupt(MIPSCPU *cpu, int irq, int level);
51
int kvm_mips_set_ipi_interrupt(MIPSCPU *cpu, int irq, int level);
52
53
-#ifdef CONFIG_KVM
54
-int mips_kvm_type(MachineState *machine, const char *vm_type);
55
-#else
56
-static inline int mips_kvm_type(MachineState *machine, const char *vm_type)
57
-{
58
- return 0;
59
-}
60
-#endif
61
-
62
#endif /* KVM_MIPS_H */
63
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
64
index XXXXXXX..XXXXXXX 100644
65
--- a/accel/kvm/kvm-all.c
66
+++ b/accel/kvm/kvm-all.c
67
@@ -XXX,XX +XXX,XX @@ static int kvm_init(MachineState *ms)
68
KVMState *s;
69
const KVMCapabilityInfo *missing_cap;
70
int ret;
71
- int type = 0;
72
+ int type;
73
uint64_t dirty_log_manual_caps;
74
75
qemu_mutex_init(&kml_slots_lock);
76
@@ -XXX,XX +XXX,XX @@ static int kvm_init(MachineState *ms)
77
type = mc->kvm_type(ms, kvm_type);
78
} else if (mc->kvm_type) {
79
type = mc->kvm_type(ms, NULL);
80
+ } else {
81
+ type = kvm_arch_get_default_type(ms);
82
}
83
84
do {
85
diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c
86
index XXXXXXX..XXXXXXX 100644
87
--- a/hw/mips/loongson3_virt.c
88
+++ b/hw/mips/loongson3_virt.c
89
@@ -XXX,XX +XXX,XX @@
90
#include "qemu/datadir.h"
91
#include "qapi/error.h"
92
#include "elf.h"
93
-#include "kvm_mips.h"
94
#include "hw/char/serial.h"
95
#include "hw/intc/loongson_liointc.h"
96
#include "hw/mips/mips.h"
97
@@ -XXX,XX +XXX,XX @@ static void loongson3v_machine_class_init(ObjectClass *oc, void *data)
98
mc->max_cpus = LOONGSON_MAX_VCPUS;
99
mc->default_ram_id = "loongson3.highram";
100
mc->default_ram_size = 1600 * MiB;
101
- mc->kvm_type = mips_kvm_type;
102
mc->minimum_page_bits = 14;
103
mc->default_nic = "virtio-net-pci";
104
}
105
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
106
index XXXXXXX..XXXXXXX 100644
107
--- a/target/arm/kvm.c
108
+++ b/target/arm/kvm.c
109
@@ -XXX,XX +XXX,XX @@ int kvm_arm_get_max_vm_ipa_size(MachineState *ms, bool *fixed_ipa)
110
return ret > 0 ? ret : 40;
111
}
112
113
+int kvm_arch_get_default_type(MachineState *ms)
114
+{
115
+ return 0;
116
+}
117
+
118
int kvm_arch_init(MachineState *ms, KVMState *s)
119
{
120
int ret = 0;
121
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
122
index XXXXXXX..XXXXXXX 100644
123
--- a/target/i386/kvm/kvm.c
124
+++ b/target/i386/kvm/kvm.c
125
@@ -XXX,XX +XXX,XX @@ static void register_smram_listener(Notifier *n, void *unused)
126
&smram_address_space, 1, "kvm-smram");
127
}
128
129
+int kvm_arch_get_default_type(MachineState *ms)
130
+{
131
+ return 0;
132
+}
133
+
134
int kvm_arch_init(MachineState *ms, KVMState *s)
135
{
136
uint64_t identity_base = 0xfffbc000;
137
diff --git a/target/mips/kvm.c b/target/mips/kvm.c
138
index XXXXXXX..XXXXXXX 100644
139
--- a/target/mips/kvm.c
140
+++ b/target/mips/kvm.c
141
@@ -XXX,XX +XXX,XX @@ int kvm_arch_msi_data_to_gsi(uint32_t data)
142
abort();
143
}
144
145
-int mips_kvm_type(MachineState *machine, const char *vm_type)
146
+int kvm_arch_get_default_type(MachineState *machine)
147
{
148
#if defined(KVM_CAP_MIPS_VZ)
149
int r;
150
diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
151
index XXXXXXX..XXXXXXX 100644
152
--- a/target/ppc/kvm.c
153
+++ b/target/ppc/kvm.c
154
@@ -XXX,XX +XXX,XX @@ static int kvm_ppc_register_host_cpu_type(void);
155
static void kvmppc_get_cpu_characteristics(KVMState *s);
156
static int kvmppc_get_dec_bits(void);
157
158
+int kvm_arch_get_default_type(MachineState *ms)
159
+{
160
+ return 0;
161
+}
162
+
163
int kvm_arch_init(MachineState *ms, KVMState *s)
164
{
165
cap_interrupt_unset = kvm_check_extension(s, KVM_CAP_PPC_UNSET_IRQ);
166
diff --git a/target/riscv/kvm.c b/target/riscv/kvm.c
167
index XXXXXXX..XXXXXXX 100644
168
--- a/target/riscv/kvm.c
169
+++ b/target/riscv/kvm.c
170
@@ -XXX,XX +XXX,XX @@ int kvm_arch_add_msi_route_post(struct kvm_irq_routing_entry *route,
171
return 0;
172
}
173
174
+int kvm_arch_get_default_type(MachineState *ms)
175
+{
176
+ return 0;
177
+}
178
+
179
int kvm_arch_init(MachineState *ms, KVMState *s)
180
{
181
return 0;
182
diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c
183
index XXXXXXX..XXXXXXX 100644
184
--- a/target/s390x/kvm/kvm.c
185
+++ b/target/s390x/kvm/kvm.c
186
@@ -XXX,XX +XXX,XX @@ static void ccw_machine_class_foreach(ObjectClass *oc, void *opaque)
187
mc->default_cpu_type = S390_CPU_TYPE_NAME("host");
188
}
189
190
+int kvm_arch_get_default_type(MachineState *ms)
191
+{
192
+ return 0;
193
+}
194
+
195
int kvm_arch_init(MachineState *ms, KVMState *s)
196
{
197
object_class_foreach(ccw_machine_class_foreach, TYPE_S390_CCW_MACHINE,
198
--
199
2.34.1
200
201
diff view generated by jsdifflib
Deleted patch
1
From: Akihiko Odaki <akihiko.odaki@daynix.com>
2
1
3
Before this change, the default KVM type, which is used for non-virt
4
machine models, was 0.
5
6
The kernel documentation says:
7
> On arm64, the physical address size for a VM (IPA Size limit) is
8
> limited to 40bits by default. The limit can be configured if the host
9
> supports the extension KVM_CAP_ARM_VM_IPA_SIZE. When supported, use
10
> KVM_VM_TYPE_ARM_IPA_SIZE(IPA_Bits) to set the size in the machine type
11
> identifier, where IPA_Bits is the maximum width of any physical
12
> address used by the VM. The IPA_Bits is encoded in bits[7-0] of the
13
> machine type identifier.
14
>
15
> e.g, to configure a guest to use 48bit physical address size::
16
>
17
> vm_fd = ioctl(dev_fd, KVM_CREATE_VM, KVM_VM_TYPE_ARM_IPA_SIZE(48));
18
>
19
> The requested size (IPA_Bits) must be:
20
>
21
> == =========================================================
22
> 0 Implies default size, 40bits (for backward compatibility)
23
> N Implies N bits, where N is a positive integer such that,
24
> 32 <= N <= Host_IPA_Limit
25
> == =========================================================
26
27
> Host_IPA_Limit is the maximum possible value for IPA_Bits on the host
28
> and is dependent on the CPU capability and the kernel configuration.
29
> The limit can be retrieved using KVM_CAP_ARM_VM_IPA_SIZE of the
30
> KVM_CHECK_EXTENSION ioctl() at run-time.
31
>
32
> Creation of the VM will fail if the requested IPA size (whether it is
33
> implicit or explicit) is unsupported on the host.
34
https://docs.kernel.org/virt/kvm/api.html#kvm-create-vm
35
36
So if Host_IPA_Limit < 40, specifying 0 as the type will fail. This
37
actually confused libvirt, which uses "none" machine model to probe the
38
KVM availability, on M2 MacBook Air.
39
40
Fix this by using Host_IPA_Limit as the default type when
41
KVM_CAP_ARM_VM_IPA_SIZE is available.
42
43
Cc: qemu-stable@nongnu.org
44
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
45
Message-id: 20230727073134.134102-3-akihiko.odaki@daynix.com
46
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
47
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
48
---
49
target/arm/kvm.c | 4 +++-
50
1 file changed, 3 insertions(+), 1 deletion(-)
51
52
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
53
index XXXXXXX..XXXXXXX 100644
54
--- a/target/arm/kvm.c
55
+++ b/target/arm/kvm.c
56
@@ -XXX,XX +XXX,XX @@ int kvm_arm_get_max_vm_ipa_size(MachineState *ms, bool *fixed_ipa)
57
58
int kvm_arch_get_default_type(MachineState *ms)
59
{
60
- return 0;
61
+ bool fixed_ipa;
62
+ int size = kvm_arm_get_max_vm_ipa_size(ms, &fixed_ipa);
63
+ return fixed_ipa ? 0 : size;
64
}
65
66
int kvm_arch_init(MachineState *ms, KVMState *s)
67
--
68
2.34.1
diff view generated by jsdifflib
Deleted patch
1
From: Akihiko Odaki <akihiko.odaki@daynix.com>
2
1
3
On MIPS, QEMU requires KVM_VM_MIPS_VZ type for KVM. Report an error in
4
such a case as other architectures do when an error occurred during KVM
5
type decision.
6
7
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
8
Message-id: 20230727073134.134102-4-akihiko.odaki@daynix.com
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
12
---
13
target/mips/kvm.c | 1 +
14
1 file changed, 1 insertion(+)
15
16
diff --git a/target/mips/kvm.c b/target/mips/kvm.c
17
index XXXXXXX..XXXXXXX 100644
18
--- a/target/mips/kvm.c
19
+++ b/target/mips/kvm.c
20
@@ -XXX,XX +XXX,XX @@ int kvm_arch_get_default_type(MachineState *machine)
21
}
22
#endif
23
24
+ error_report("KVM_VM_MIPS_VZ type is not available");
25
return -1;
26
}
27
28
--
29
2.34.1
30
31
diff view generated by jsdifflib
Deleted patch
1
From: Akihiko Odaki <akihiko.odaki@daynix.com>
2
1
3
On MIPS, kvm_arch_get_default_type() returns a negative value when an
4
error occurred so handle the case. Also, let other machines return
5
negative values when errors occur and declare returning a negative
6
value as the correct way to propagate an error that happened when
7
determining KVM type.
8
9
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
10
Message-id: 20230727073134.134102-5-akihiko.odaki@daynix.com
11
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
14
---
15
accel/kvm/kvm-all.c | 5 +++++
16
hw/arm/virt.c | 2 +-
17
hw/ppc/spapr.c | 2 +-
18
3 files changed, 7 insertions(+), 2 deletions(-)
19
20
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
21
index XXXXXXX..XXXXXXX 100644
22
--- a/accel/kvm/kvm-all.c
23
+++ b/accel/kvm/kvm-all.c
24
@@ -XXX,XX +XXX,XX @@ static int kvm_init(MachineState *ms)
25
type = kvm_arch_get_default_type(ms);
26
}
27
28
+ if (type < 0) {
29
+ ret = -EINVAL;
30
+ goto err;
31
+ }
32
+
33
do {
34
ret = kvm_ioctl(s, KVM_CREATE_VM, type);
35
} while (ret == -EINTR);
36
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
37
index XXXXXXX..XXXXXXX 100644
38
--- a/hw/arm/virt.c
39
+++ b/hw/arm/virt.c
40
@@ -XXX,XX +XXX,XX @@ static int virt_kvm_type(MachineState *ms, const char *type_str)
41
"require an IPA range (%d bits) larger than "
42
"the one supported by the host (%d bits)",
43
requested_pa_size, max_vm_pa_size);
44
- exit(1);
45
+ return -1;
46
}
47
/*
48
* We return the requested PA log size, unless KVM only supports
49
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
50
index XXXXXXX..XXXXXXX 100644
51
--- a/hw/ppc/spapr.c
52
+++ b/hw/ppc/spapr.c
53
@@ -XXX,XX +XXX,XX @@ static int spapr_kvm_type(MachineState *machine, const char *vm_type)
54
}
55
56
error_report("Unknown kvm-type specified '%s'", vm_type);
57
- exit(1);
58
+ return -1;
59
}
60
61
/*
62
--
63
2.34.1
64
65
diff view generated by jsdifflib
Deleted patch
1
From: Akihiko Odaki <akihiko.odaki@daynix.com>
2
1
3
An error may occur after s->as is allocated, for example if the
4
KVM_CREATE_VM ioctl call fails.
5
6
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
7
Message-id: 20230727073134.134102-6-akihiko.odaki@daynix.com
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
[PMM: tweaked commit message]
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
12
accel/kvm/kvm-all.c | 1 +
13
1 file changed, 1 insertion(+)
14
15
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
16
index XXXXXXX..XXXXXXX 100644
17
--- a/accel/kvm/kvm-all.c
18
+++ b/accel/kvm/kvm-all.c
19
@@ -XXX,XX +XXX,XX @@ err:
20
if (s->fd != -1) {
21
close(s->fd);
22
}
23
+ g_free(s->as);
24
g_free(s->memory_listener.slots);
25
26
return ret;
27
--
28
2.34.1
diff view generated by jsdifflib
Deleted patch
1
From: Akihiko Odaki <akihiko.odaki@daynix.com>
2
1
3
The returned value was always zero and had no meaning.
4
5
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
6
Message-id: 20230727073134.134102-7-akihiko.odaki@daynix.com
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
10
---
11
accel/kvm/kvm-all.c | 9 ++-------
12
1 file changed, 2 insertions(+), 7 deletions(-)
13
14
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/accel/kvm/kvm-all.c
17
+++ b/accel/kvm/kvm-all.c
18
@@ -XXX,XX +XXX,XX @@ static void *kvm_dirty_ring_reaper_thread(void *data)
19
return NULL;
20
}
21
22
-static int kvm_dirty_ring_reaper_init(KVMState *s)
23
+static void kvm_dirty_ring_reaper_init(KVMState *s)
24
{
25
struct KVMDirtyRingReaper *r = &s->reaper;
26
27
qemu_thread_create(&r->reaper_thr, "kvm-reaper",
28
kvm_dirty_ring_reaper_thread,
29
s, QEMU_THREAD_JOINABLE);
30
-
31
- return 0;
32
}
33
34
static int kvm_dirty_ring_init(KVMState *s)
35
@@ -XXX,XX +XXX,XX @@ static int kvm_init(MachineState *ms)
36
}
37
38
if (s->kvm_dirty_ring_size) {
39
- ret = kvm_dirty_ring_reaper_init(s);
40
- if (ret) {
41
- goto err;
42
- }
43
+ kvm_dirty_ring_reaper_init(s);
44
}
45
46
if (kvm_check_extension(kvm_state, KVM_CAP_BINARY_STATS_FD)) {
47
--
48
2.34.1
49
50
diff view generated by jsdifflib
Deleted patch
1
For an Unsupported Atomic Update fault where the stage 1 translation
2
table descriptor update can't be done because it's to an unsupported
3
memory type, this is a stage 1 abort (per the Arm ARM R_VSXXT). This
4
means we should not set fi->s1ptw, because this will cause the code
5
in the get_phys_addr_lpae() error-exit path to mark it as stage 2.
6
1
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20230807141514.19075-2-peter.maydell@linaro.org
10
---
11
target/arm/ptw.c | 1 -
12
1 file changed, 1 deletion(-)
13
14
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/ptw.c
17
+++ b/target/arm/ptw.c
18
@@ -XXX,XX +XXX,XX @@ static uint64_t arm_casq_ptw(CPUARMState *env, uint64_t old_val,
19
20
if (unlikely(!host)) {
21
fi->type = ARMFault_UnsuppAtomicUpdate;
22
- fi->s1ptw = true;
23
return 0;
24
}
25
26
--
27
2.34.1
diff view generated by jsdifflib
Deleted patch
1
In S1_ptw_translate() we set up the ARMMMUFaultInfo if the attempt to
2
translate the page descriptor address into a physical address fails.
3
This used to only be possible if we are doing a stage 2 ptw for that
4
descriptor address, and so the code always sets fi->stage2 and
5
fi->s1ptw to true. However, with FEAT_RME it is also possible for
6
the lookup of the page descriptor address to fail because of a
7
Granule Protection Check fault. These should not be reported as
8
stage 2, otherwise arm_deliver_fault() will incorrectly set
9
HPFAR_EL2. Similarly the s1ptw bit should only be set for stage 2
10
faults on stage 1 translation table walks, i.e. not for GPC faults.
11
1
12
Add a comment to the the other place where we might detect a
13
stage2-fault-on-stage-1-ptw, in arm_casq_ptw(), noting why we know in
14
that case that it must really be a stage 2 fault and not a GPC fault.
15
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
18
Message-id: 20230807141514.19075-3-peter.maydell@linaro.org
19
---
20
target/arm/ptw.c | 10 ++++++++--
21
1 file changed, 8 insertions(+), 2 deletions(-)
22
23
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
24
index XXXXXXX..XXXXXXX 100644
25
--- a/target/arm/ptw.c
26
+++ b/target/arm/ptw.c
27
@@ -XXX,XX +XXX,XX @@ static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw,
28
fi->type = ARMFault_GPCFOnWalk;
29
}
30
fi->s2addr = addr;
31
- fi->stage2 = true;
32
- fi->s1ptw = true;
33
+ fi->stage2 = regime_is_stage2(s2_mmu_idx);
34
+ fi->s1ptw = fi->stage2;
35
fi->s1ns = !is_secure;
36
return false;
37
}
38
@@ -XXX,XX +XXX,XX @@ static uint64_t arm_casq_ptw(CPUARMState *env, uint64_t old_val,
39
env->tlb_fi = NULL;
40
41
if (unlikely(flags & TLB_INVALID_MASK)) {
42
+ /*
43
+ * We know this must be a stage 2 fault because the granule
44
+ * protection table does not separately track read and write
45
+ * permission, so all GPC faults are caught in S1_ptw_translate():
46
+ * we only get here for "readable but not writeable".
47
+ */
48
assert(fi->type != ARMFault_None);
49
fi->s2addr = ptw->out_virt;
50
fi->stage2 = true;
51
--
52
2.34.1
diff view generated by jsdifflib
Deleted patch
1
The s1ns bit in ARMMMUFaultInfo is documented as "true if
2
we faulted on a non-secure IPA while in secure state". Both the
3
places which look at this bit only do so after having confirmed
4
that this is a stage 2 fault and we're dealing with Secure EL2,
5
which leaves the ptw.c code free to set the bit to any random
6
value in the other cases.
7
1
8
Instead of taking advantage of that freedom, consistently
9
make the bit be set to false for the "not a stage 2 fault
10
for Secure EL2" cases. This removes some cases where we
11
were using an 'is_secure' boolean and leaving the reader
12
guessing about whether that was the right thing for Realm
13
and Root cases.
14
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
17
Message-id: 20230807141514.19075-4-peter.maydell@linaro.org
18
---
19
target/arm/ptw.c | 19 +++++++++++++++----
20
1 file changed, 15 insertions(+), 4 deletions(-)
21
22
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
23
index XXXXXXX..XXXXXXX 100644
24
--- a/target/arm/ptw.c
25
+++ b/target/arm/ptw.c
26
@@ -XXX,XX +XXX,XX @@ static ARMSecuritySpace S2_security_space(ARMSecuritySpace s1_space,
27
}
28
}
29
30
+static bool fault_s1ns(ARMSecuritySpace space, ARMMMUIdx s2_mmu_idx)
31
+{
32
+ /*
33
+ * For stage 2 faults in Secure EL22, S1NS indicates
34
+ * whether the faulting IPA is in the Secure or NonSecure
35
+ * IPA space. For all other kinds of fault, it is false.
36
+ */
37
+ return space == ARMSS_Secure && regime_is_stage2(s2_mmu_idx)
38
+ && s2_mmu_idx == ARMMMUIdx_Stage2_S;
39
+}
40
+
41
/* Translate a S1 pagetable walk through S2 if needed. */
42
static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw,
43
hwaddr addr, ARMMMUFaultInfo *fi)
44
@@ -XXX,XX +XXX,XX @@ static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw,
45
fi->s2addr = addr;
46
fi->stage2 = true;
47
fi->s1ptw = true;
48
- fi->s1ns = !is_secure;
49
+ fi->s1ns = fault_s1ns(ptw->in_space, s2_mmu_idx);
50
return false;
51
}
52
}
53
@@ -XXX,XX +XXX,XX @@ static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw,
54
fi->s2addr = addr;
55
fi->stage2 = regime_is_stage2(s2_mmu_idx);
56
fi->s1ptw = fi->stage2;
57
- fi->s1ns = !is_secure;
58
+ fi->s1ns = fault_s1ns(ptw->in_space, s2_mmu_idx);
59
return false;
60
}
61
62
@@ -XXX,XX +XXX,XX @@ static uint64_t arm_casq_ptw(CPUARMState *env, uint64_t old_val,
63
fi->s2addr = ptw->out_virt;
64
fi->stage2 = true;
65
fi->s1ptw = true;
66
- fi->s1ns = !ptw->in_secure;
67
+ fi->s1ns = fault_s1ns(ptw->in_space, ptw->in_ptw_idx);
68
return 0;
69
}
70
71
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
72
fi->level = level;
73
/* Tag the error as S2 for failed S1 PTW at S2 or ordinary S2. */
74
fi->stage2 = fi->s1ptw || regime_is_stage2(mmu_idx);
75
- fi->s1ns = mmu_idx == ARMMMUIdx_Stage2;
76
+ fi->s1ns = fault_s1ns(ptw->in_space, mmu_idx);
77
return true;
78
}
79
80
--
81
2.34.1
diff view generated by jsdifflib
Deleted patch
1
In commit 6d2654ffacea813916176 we created the S1Translate struct and
2
used it to plumb through various arguments that we were previously
3
passing one-at-a-time to get_phys_addr_v5(), get_phys_addr_v6(), and
4
get_phys_addr_lpae(). Extend that pattern to get_phys_addr_pmsav5(),
5
get_phys_addr_pmsav7(), get_phys_addr_pmsav8() and
6
get_phys_addr_disabled(), so that all the get_phys_addr_* functions
7
we call from get_phys_addr_nogpc() take the S1Translate struct rather
8
than the mmu_idx and is_secure bool.
9
1
10
(This refactoring is a prelude to having the called functions look
11
at ptw->is_space rather than using an is_secure boolean.)
12
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
15
Message-id: 20230807141514.19075-5-peter.maydell@linaro.org
16
---
17
target/arm/ptw.c | 57 ++++++++++++++++++++++++++++++------------------
18
1 file changed, 36 insertions(+), 21 deletions(-)
19
20
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
21
index XXXXXXX..XXXXXXX 100644
22
--- a/target/arm/ptw.c
23
+++ b/target/arm/ptw.c
24
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
25
return true;
26
}
27
28
-static bool get_phys_addr_pmsav5(CPUARMState *env, uint32_t address,
29
- MMUAccessType access_type, ARMMMUIdx mmu_idx,
30
- bool is_secure, GetPhysAddrResult *result,
31
+static bool get_phys_addr_pmsav5(CPUARMState *env,
32
+ S1Translate *ptw,
33
+ uint32_t address,
34
+ MMUAccessType access_type,
35
+ GetPhysAddrResult *result,
36
ARMMMUFaultInfo *fi)
37
{
38
int n;
39
uint32_t mask;
40
uint32_t base;
41
+ ARMMMUIdx mmu_idx = ptw->in_mmu_idx;
42
bool is_user = regime_is_user(env, mmu_idx);
43
+ bool is_secure = arm_space_is_secure(ptw->in_space);
44
45
if (regime_translation_disabled(env, mmu_idx, is_secure)) {
46
/* MPU disabled. */
47
@@ -XXX,XX +XXX,XX @@ static bool pmsav7_use_background_region(ARMCPU *cpu, ARMMMUIdx mmu_idx,
48
return regime_sctlr(env, mmu_idx) & SCTLR_BR;
49
}
50
51
-static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address,
52
- MMUAccessType access_type, ARMMMUIdx mmu_idx,
53
- bool secure, GetPhysAddrResult *result,
54
+static bool get_phys_addr_pmsav7(CPUARMState *env,
55
+ S1Translate *ptw,
56
+ uint32_t address,
57
+ MMUAccessType access_type,
58
+ GetPhysAddrResult *result,
59
ARMMMUFaultInfo *fi)
60
{
61
ARMCPU *cpu = env_archcpu(env);
62
int n;
63
+ ARMMMUIdx mmu_idx = ptw->in_mmu_idx;
64
bool is_user = regime_is_user(env, mmu_idx);
65
+ bool secure = arm_space_is_secure(ptw->in_space);
66
67
result->f.phys_addr = address;
68
result->f.lg_page_size = TARGET_PAGE_BITS;
69
@@ -XXX,XX +XXX,XX @@ void v8m_security_lookup(CPUARMState *env, uint32_t address,
70
}
71
}
72
73
-static bool get_phys_addr_pmsav8(CPUARMState *env, uint32_t address,
74
- MMUAccessType access_type, ARMMMUIdx mmu_idx,
75
- bool secure, GetPhysAddrResult *result,
76
+static bool get_phys_addr_pmsav8(CPUARMState *env,
77
+ S1Translate *ptw,
78
+ uint32_t address,
79
+ MMUAccessType access_type,
80
+ GetPhysAddrResult *result,
81
ARMMMUFaultInfo *fi)
82
{
83
V8M_SAttributes sattrs = {};
84
+ ARMMMUIdx mmu_idx = ptw->in_mmu_idx;
85
+ bool secure = arm_space_is_secure(ptw->in_space);
86
bool ret;
87
88
if (arm_feature(env, ARM_FEATURE_M_SECURITY)) {
89
@@ -XXX,XX +XXX,XX @@ static ARMCacheAttrs combine_cacheattrs(uint64_t hcr,
90
* MMU disabled. S1 addresses within aa64 translation regimes are
91
* still checked for bounds -- see AArch64.S1DisabledOutput().
92
*/
93
-static bool get_phys_addr_disabled(CPUARMState *env, target_ulong address,
94
+static bool get_phys_addr_disabled(CPUARMState *env,
95
+ S1Translate *ptw,
96
+ target_ulong address,
97
MMUAccessType access_type,
98
- ARMMMUIdx mmu_idx, bool is_secure,
99
GetPhysAddrResult *result,
100
ARMMMUFaultInfo *fi)
101
{
102
+ ARMMMUIdx mmu_idx = ptw->in_mmu_idx;
103
+ bool is_secure = arm_space_is_secure(ptw->in_space);
104
uint8_t memattr = 0x00; /* Device nGnRnE */
105
uint8_t shareability = 0; /* non-shareable */
106
int r_el;
107
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_nogpc(CPUARMState *env, S1Translate *ptw,
108
case ARMMMUIdx_Phys_Root:
109
case ARMMMUIdx_Phys_Realm:
110
/* Checking Phys early avoids special casing later vs regime_el. */
111
- return get_phys_addr_disabled(env, address, access_type, mmu_idx,
112
- is_secure, result, fi);
113
+ return get_phys_addr_disabled(env, ptw, address, access_type,
114
+ result, fi);
115
116
case ARMMMUIdx_Stage1_E0:
117
case ARMMMUIdx_Stage1_E1:
118
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_nogpc(CPUARMState *env, S1Translate *ptw,
119
120
if (arm_feature(env, ARM_FEATURE_V8)) {
121
/* PMSAv8 */
122
- ret = get_phys_addr_pmsav8(env, address, access_type, mmu_idx,
123
- is_secure, result, fi);
124
+ ret = get_phys_addr_pmsav8(env, ptw, address, access_type,
125
+ result, fi);
126
} else if (arm_feature(env, ARM_FEATURE_V7)) {
127
/* PMSAv7 */
128
- ret = get_phys_addr_pmsav7(env, address, access_type, mmu_idx,
129
- is_secure, result, fi);
130
+ ret = get_phys_addr_pmsav7(env, ptw, address, access_type,
131
+ result, fi);
132
} else {
133
/* Pre-v7 MPU */
134
- ret = get_phys_addr_pmsav5(env, address, access_type, mmu_idx,
135
- is_secure, result, fi);
136
+ ret = get_phys_addr_pmsav5(env, ptw, address, access_type,
137
+ result, fi);
138
}
139
qemu_log_mask(CPU_LOG_MMU, "PMSA MPU lookup for %s at 0x%08" PRIx32
140
" mmu_idx %u -> %s (prot %c%c%c)\n",
141
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_nogpc(CPUARMState *env, S1Translate *ptw,
142
/* Definitely a real MMU, not an MPU */
143
144
if (regime_translation_disabled(env, mmu_idx, is_secure)) {
145
- return get_phys_addr_disabled(env, address, access_type, mmu_idx,
146
- is_secure, result, fi);
147
+ return get_phys_addr_disabled(env, ptw, address, access_type,
148
+ result, fi);
149
}
150
151
if (regime_using_lpae_format(env, mmu_idx)) {
152
--
153
2.34.1
diff view generated by jsdifflib
Deleted patch
1
Plumb the ARMSecurityState through to regime_translation_disabled()
2
rather than just a bool is_secure.
3
1
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20230807141514.19075-6-peter.maydell@linaro.org
7
---
8
target/arm/ptw.c | 15 ++++++++-------
9
1 file changed, 8 insertions(+), 7 deletions(-)
10
11
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
12
index XXXXXXX..XXXXXXX 100644
13
--- a/target/arm/ptw.c
14
+++ b/target/arm/ptw.c
15
@@ -XXX,XX +XXX,XX @@ static uint64_t regime_ttbr(CPUARMState *env, ARMMMUIdx mmu_idx, int ttbrn)
16
17
/* Return true if the specified stage of address translation is disabled */
18
static bool regime_translation_disabled(CPUARMState *env, ARMMMUIdx mmu_idx,
19
- bool is_secure)
20
+ ARMSecuritySpace space)
21
{
22
uint64_t hcr_el2;
23
+ bool is_secure = arm_space_is_secure(space);
24
25
if (arm_feature(env, ARM_FEATURE_M)) {
26
switch (env->v7m.mpu_ctrl[is_secure] &
27
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav5(CPUARMState *env,
28
uint32_t base;
29
ARMMMUIdx mmu_idx = ptw->in_mmu_idx;
30
bool is_user = regime_is_user(env, mmu_idx);
31
- bool is_secure = arm_space_is_secure(ptw->in_space);
32
33
- if (regime_translation_disabled(env, mmu_idx, is_secure)) {
34
+ if (regime_translation_disabled(env, mmu_idx, ptw->in_space)) {
35
/* MPU disabled. */
36
result->f.phys_addr = address;
37
result->f.prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
38
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav7(CPUARMState *env,
39
result->f.lg_page_size = TARGET_PAGE_BITS;
40
result->f.prot = 0;
41
42
- if (regime_translation_disabled(env, mmu_idx, secure) ||
43
+ if (regime_translation_disabled(env, mmu_idx, ptw->in_space) ||
44
m_is_ppb_region(env, address)) {
45
/*
46
* MPU disabled or M profile PPB access: use default memory map.
47
@@ -XXX,XX +XXX,XX @@ bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address,
48
* are done in arm_v7m_load_vector(), which always does a direct
49
* read using address_space_ldl(), rather than going via this function.
50
*/
51
- if (regime_translation_disabled(env, mmu_idx, secure)) { /* MPU disabled */
52
+ if (regime_translation_disabled(env, mmu_idx, arm_secure_to_space(secure))) {
53
+ /* MPU disabled */
54
hit = true;
55
} else if (m_is_ppb_region(env, address)) {
56
hit = true;
57
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_nogpc(CPUARMState *env, S1Translate *ptw,
58
*/
59
ptw->in_mmu_idx = mmu_idx = s1_mmu_idx;
60
if (arm_feature(env, ARM_FEATURE_EL2) &&
61
- !regime_translation_disabled(env, ARMMMUIdx_Stage2, is_secure)) {
62
+ !regime_translation_disabled(env, ARMMMUIdx_Stage2, ptw->in_space)) {
63
return get_phys_addr_twostage(env, ptw, address, access_type,
64
result, fi);
65
}
66
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_nogpc(CPUARMState *env, S1Translate *ptw,
67
68
/* Definitely a real MMU, not an MPU */
69
70
- if (regime_translation_disabled(env, mmu_idx, is_secure)) {
71
+ if (regime_translation_disabled(env, mmu_idx, ptw->in_space)) {
72
return get_phys_addr_disabled(env, ptw, address, access_type,
73
result, fi);
74
}
75
--
76
2.34.1
diff view generated by jsdifflib
Deleted patch
1
arm_hcr_el2_eff_secstate() takes a bool secure, which it uses to
2
determine whether EL2 is enabled in the current security state.
3
With the advent of FEAT_RME this is no longer sufficient, because
4
EL2 can be enabled for Secure state but not for Root, and both
5
of those will pass 'secure == true' in the callsites in ptw.c.
6
1
7
As it happens in all of our callsites in ptw.c we either avoid making
8
the call or else avoid using the returned value if we're doing a
9
translation for Root, so this is not a behaviour change even if the
10
experimental FEAT_RME is enabled. But it is less confusing in the
11
ptw.c code if we avoid the use of a bool secure that duplicates some
12
of the information in the ArmSecuritySpace argument.
13
14
Make arm_hcr_el2_eff_secstate() take an ARMSecuritySpace argument
15
instead. Because we always want to know the HCR_EL2 for the
16
security state defined by the current effective value of
17
SCR_EL3.{NSE,NS}, it makes no sense to pass ARMSS_Root here,
18
and we assert that callers don't do that.
19
20
To avoid the assert(), we thus push the call to
21
arm_hcr_el2_eff_secstate() down into the cases in
22
regime_translation_disabled() that need it, rather than calling the
23
function and ignoring the result for the Root space translations.
24
All other calls to this function in ptw.c are already in places
25
where we have confirmed that the mmu_idx is a stage 2 translation
26
or that the regime EL is not 3.
27
28
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
29
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
30
Message-id: 20230807141514.19075-7-peter.maydell@linaro.org
31
---
32
target/arm/cpu.h | 2 +-
33
target/arm/helper.c | 8 +++++---
34
target/arm/ptw.c | 15 +++++++--------
35
3 files changed, 13 insertions(+), 12 deletions(-)
36
37
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
38
index XXXXXXX..XXXXXXX 100644
39
--- a/target/arm/cpu.h
40
+++ b/target/arm/cpu.h
41
@@ -XXX,XX +XXX,XX @@ static inline bool arm_is_el2_enabled(CPUARMState *env)
42
* "for all purposes other than a direct read or write access of HCR_EL2."
43
* Not included here is HCR_RW.
44
*/
45
-uint64_t arm_hcr_el2_eff_secstate(CPUARMState *env, bool secure);
46
+uint64_t arm_hcr_el2_eff_secstate(CPUARMState *env, ARMSecuritySpace space);
47
uint64_t arm_hcr_el2_eff(CPUARMState *env);
48
uint64_t arm_hcrx_el2_eff(CPUARMState *env);
49
50
diff --git a/target/arm/helper.c b/target/arm/helper.c
51
index XXXXXXX..XXXXXXX 100644
52
--- a/target/arm/helper.c
53
+++ b/target/arm/helper.c
54
@@ -XXX,XX +XXX,XX @@ static void hcr_writelow(CPUARMState *env, const ARMCPRegInfo *ri,
55
* Bits that are not included here:
56
* RW (read from SCR_EL3.RW as needed)
57
*/
58
-uint64_t arm_hcr_el2_eff_secstate(CPUARMState *env, bool secure)
59
+uint64_t arm_hcr_el2_eff_secstate(CPUARMState *env, ARMSecuritySpace space)
60
{
61
uint64_t ret = env->cp15.hcr_el2;
62
63
- if (!arm_is_el2_enabled_secstate(env, secure)) {
64
+ assert(space != ARMSS_Root);
65
+
66
+ if (!arm_is_el2_enabled_secstate(env, arm_space_is_secure(space))) {
67
/*
68
* "This register has no effect if EL2 is not enabled in the
69
* current Security state". This is ARMv8.4-SecEL2 speak for
70
@@ -XXX,XX +XXX,XX @@ uint64_t arm_hcr_el2_eff(CPUARMState *env)
71
if (arm_feature(env, ARM_FEATURE_M)) {
72
return 0;
73
}
74
- return arm_hcr_el2_eff_secstate(env, arm_is_secure_below_el3(env));
75
+ return arm_hcr_el2_eff_secstate(env, arm_security_space_below_el3(env));
76
}
77
78
/*
79
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
80
index XXXXXXX..XXXXXXX 100644
81
--- a/target/arm/ptw.c
82
+++ b/target/arm/ptw.c
83
@@ -XXX,XX +XXX,XX @@ static bool regime_translation_disabled(CPUARMState *env, ARMMMUIdx mmu_idx,
84
ARMSecuritySpace space)
85
{
86
uint64_t hcr_el2;
87
- bool is_secure = arm_space_is_secure(space);
88
89
if (arm_feature(env, ARM_FEATURE_M)) {
90
+ bool is_secure = arm_space_is_secure(space);
91
switch (env->v7m.mpu_ctrl[is_secure] &
92
(R_V7M_MPU_CTRL_ENABLE_MASK | R_V7M_MPU_CTRL_HFNMIENA_MASK)) {
93
case R_V7M_MPU_CTRL_ENABLE_MASK:
94
@@ -XXX,XX +XXX,XX @@ static bool regime_translation_disabled(CPUARMState *env, ARMMMUIdx mmu_idx,
95
}
96
}
97
98
- hcr_el2 = arm_hcr_el2_eff_secstate(env, is_secure);
99
100
switch (mmu_idx) {
101
case ARMMMUIdx_Stage2:
102
case ARMMMUIdx_Stage2_S:
103
/* HCR.DC means HCR.VM behaves as 1 */
104
+ hcr_el2 = arm_hcr_el2_eff_secstate(env, space);
105
return (hcr_el2 & (HCR_DC | HCR_VM)) == 0;
106
107
case ARMMMUIdx_E10_0:
108
case ARMMMUIdx_E10_1:
109
case ARMMMUIdx_E10_1_PAN:
110
/* TGE means that EL0/1 act as if SCTLR_EL1.M is zero */
111
+ hcr_el2 = arm_hcr_el2_eff_secstate(env, space);
112
if (hcr_el2 & HCR_TGE) {
113
return true;
114
}
115
@@ -XXX,XX +XXX,XX @@ static bool regime_translation_disabled(CPUARMState *env, ARMMMUIdx mmu_idx,
116
case ARMMMUIdx_Stage1_E1:
117
case ARMMMUIdx_Stage1_E1_PAN:
118
/* HCR.DC means SCTLR_EL1.M behaves as 0 */
119
+ hcr_el2 = arm_hcr_el2_eff_secstate(env, space);
120
if (hcr_el2 & HCR_DC) {
121
return true;
122
}
123
@@ -XXX,XX +XXX,XX @@ static bool fault_s1ns(ARMSecuritySpace space, ARMMMUIdx s2_mmu_idx)
124
static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw,
125
hwaddr addr, ARMMMUFaultInfo *fi)
126
{
127
- bool is_secure = ptw->in_secure;
128
ARMMMUIdx mmu_idx = ptw->in_mmu_idx;
129
ARMMMUIdx s2_mmu_idx = ptw->in_ptw_idx;
130
uint8_t pte_attrs;
131
@@ -XXX,XX +XXX,XX @@ static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw,
132
}
133
134
if (regime_is_stage2(s2_mmu_idx)) {
135
- uint64_t hcr = arm_hcr_el2_eff_secstate(env, is_secure);
136
+ uint64_t hcr = arm_hcr_el2_eff_secstate(env, ptw->in_space);
137
138
if ((hcr & HCR_PTW) && S2_attrs_are_device(hcr, pte_attrs)) {
139
/*
140
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_disabled(CPUARMState *env,
141
ARMMMUFaultInfo *fi)
142
{
143
ARMMMUIdx mmu_idx = ptw->in_mmu_idx;
144
- bool is_secure = arm_space_is_secure(ptw->in_space);
145
uint8_t memattr = 0x00; /* Device nGnRnE */
146
uint8_t shareability = 0; /* non-shareable */
147
int r_el;
148
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_disabled(CPUARMState *env,
149
150
/* Fill in cacheattr a-la AArch64.TranslateAddressS1Off. */
151
if (r_el == 1) {
152
- uint64_t hcr = arm_hcr_el2_eff_secstate(env, is_secure);
153
+ uint64_t hcr = arm_hcr_el2_eff_secstate(env, ptw->in_space);
154
if (hcr & HCR_DC) {
155
if (hcr & HCR_DCT) {
156
memattr = 0xf0; /* Tagged, Normal, WB, RWA */
157
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw,
158
{
159
hwaddr ipa;
160
int s1_prot, s1_lgpgsz;
161
- bool is_secure = ptw->in_secure;
162
ARMSecuritySpace in_space = ptw->in_space;
163
bool ret, ipa_secure;
164
ARMCacheAttrs cacheattrs1;
165
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw,
166
}
167
168
/* Combine the S1 and S2 cache attributes. */
169
- hcr = arm_hcr_el2_eff_secstate(env, is_secure);
170
+ hcr = arm_hcr_el2_eff_secstate(env, in_space);
171
if (hcr & HCR_DC) {
172
/*
173
* HCR.DC forces the first stage attributes to
174
--
175
2.34.1
diff view generated by jsdifflib
Deleted patch
1
Pass an ARMSecuritySpace instead of a bool secure to
2
arm_is_el2_enabled_secstate(). This doesn't change behaviour.
3
1
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20230807141514.19075-8-peter.maydell@linaro.org
7
---
8
target/arm/cpu.h | 13 ++++++++-----
9
target/arm/helper.c | 2 +-
10
2 files changed, 9 insertions(+), 6 deletions(-)
11
12
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
13
index XXXXXXX..XXXXXXX 100644
14
--- a/target/arm/cpu.h
15
+++ b/target/arm/cpu.h
16
@@ -XXX,XX +XXX,XX @@ static inline bool arm_is_secure(CPUARMState *env)
17
18
/*
19
* Return true if the current security state has AArch64 EL2 or AArch32 Hyp.
20
- * This corresponds to the pseudocode EL2Enabled()
21
+ * This corresponds to the pseudocode EL2Enabled().
22
*/
23
-static inline bool arm_is_el2_enabled_secstate(CPUARMState *env, bool secure)
24
+static inline bool arm_is_el2_enabled_secstate(CPUARMState *env,
25
+ ARMSecuritySpace space)
26
{
27
+ assert(space != ARMSS_Root);
28
return arm_feature(env, ARM_FEATURE_EL2)
29
- && (!secure || (env->cp15.scr_el3 & SCR_EEL2));
30
+ && (space != ARMSS_Secure || (env->cp15.scr_el3 & SCR_EEL2));
31
}
32
33
static inline bool arm_is_el2_enabled(CPUARMState *env)
34
{
35
- return arm_is_el2_enabled_secstate(env, arm_is_secure_below_el3(env));
36
+ return arm_is_el2_enabled_secstate(env, arm_security_space_below_el3(env));
37
}
38
39
#else
40
@@ -XXX,XX +XXX,XX @@ static inline bool arm_is_secure(CPUARMState *env)
41
return false;
42
}
43
44
-static inline bool arm_is_el2_enabled_secstate(CPUARMState *env, bool secure)
45
+static inline bool arm_is_el2_enabled_secstate(CPUARMState *env,
46
+ ARMSecuritySpace space)
47
{
48
return false;
49
}
50
diff --git a/target/arm/helper.c b/target/arm/helper.c
51
index XXXXXXX..XXXXXXX 100644
52
--- a/target/arm/helper.c
53
+++ b/target/arm/helper.c
54
@@ -XXX,XX +XXX,XX @@ uint64_t arm_hcr_el2_eff_secstate(CPUARMState *env, ARMSecuritySpace space)
55
56
assert(space != ARMSS_Root);
57
58
- if (!arm_is_el2_enabled_secstate(env, arm_space_is_secure(space))) {
59
+ if (!arm_is_el2_enabled_secstate(env, space)) {
60
/*
61
* "This register has no effect if EL2 is not enabled in the
62
* current Security state". This is ARMv8.4-SecEL2 speak for
63
--
64
2.34.1
diff view generated by jsdifflib
Deleted patch
1
When we do a translation in Secure state, the NSTable bits in table
2
descriptors may downgrade us to NonSecure; we update ptw->in_secure
3
and ptw->in_space accordingly. We guard that check correctly with a
4
conditional that means it's only applied for Secure stage 1
5
translations. However, later on in get_phys_addr_lpae() we fold the
6
effects of the NSTable bits into the final descriptor attributes
7
bits, and there we do it unconditionally regardless of the CPU state.
8
That means that in Realm state (where in_secure is false) we will set
9
bit 5 in attrs, and later use it to decide to output to non-secure
10
space.
11
1
12
We don't in fact need to do this folding in at all any more (since
13
commit 2f1ff4e7b9f30c): if an NSTable bit was set then we have
14
already set ptw->in_space to ARMSS_NonSecure, and in that situation
15
we don't look at attrs bit 5. The only thing we still need to deal
16
with is the real NS bit in the final descriptor word, so we can just
17
drop the code that ORed in the NSTable bit.
18
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
21
Message-id: 20230807141514.19075-9-peter.maydell@linaro.org
22
---
23
target/arm/ptw.c | 3 +--
24
1 file changed, 1 insertion(+), 2 deletions(-)
25
26
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
27
index XXXXXXX..XXXXXXX 100644
28
--- a/target/arm/ptw.c
29
+++ b/target/arm/ptw.c
30
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
31
* Extract attributes from the (modified) descriptor, and apply
32
* table descriptors. Stage 2 table descriptors do not include
33
* any attribute fields. HPD disables all the table attributes
34
- * except NSTable.
35
+ * except NSTable (which we have already handled).
36
*/
37
attrs = new_descriptor & (MAKE_64BIT_MASK(2, 10) | MAKE_64BIT_MASK(50, 14));
38
if (!regime_is_stage2(mmu_idx)) {
39
- attrs |= !ptw->in_secure << 5; /* NS */
40
if (!param.hpd) {
41
attrs |= extract64(tableattrs, 0, 2) << 53; /* XN, PXN */
42
/*
43
--
44
2.34.1
diff view generated by jsdifflib
Deleted patch
1
Replace the last uses of ptw->in_secure with appropriate
2
checks on ptw->in_space.
3
1
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20230807141514.19075-10-peter.maydell@linaro.org
7
---
8
target/arm/ptw.c | 11 +++++++----
9
1 file changed, 7 insertions(+), 4 deletions(-)
10
11
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
12
index XXXXXXX..XXXXXXX 100644
13
--- a/target/arm/ptw.c
14
+++ b/target/arm/ptw.c
15
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_nogpc(CPUARMState *env, S1Translate *ptw,
16
ARMMMUFaultInfo *fi)
17
{
18
ARMMMUIdx mmu_idx = ptw->in_mmu_idx;
19
- bool is_secure = ptw->in_secure;
20
ARMMMUIdx s1_mmu_idx;
21
22
/*
23
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_nogpc(CPUARMState *env, S1Translate *ptw,
24
* cannot upgrade a NonSecure translation regime's attributes
25
* to Secure or Realm.
26
*/
27
- result->f.attrs.secure = is_secure;
28
result->f.attrs.space = ptw->in_space;
29
+ result->f.attrs.secure = arm_space_is_secure(ptw->in_space);
30
31
switch (mmu_idx) {
32
case ARMMMUIdx_Phys_S:
33
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_nogpc(CPUARMState *env, S1Translate *ptw,
34
case ARMMMUIdx_Stage1_E0:
35
case ARMMMUIdx_Stage1_E1:
36
case ARMMMUIdx_Stage1_E1_PAN:
37
- /* First stage lookup uses second stage for ptw. */
38
- ptw->in_ptw_idx = is_secure ? ARMMMUIdx_Stage2_S : ARMMMUIdx_Stage2;
39
+ /*
40
+ * First stage lookup uses second stage for ptw; only
41
+ * Secure has both S and NS IPA and starts with Stage2_S.
42
+ */
43
+ ptw->in_ptw_idx = (ptw->in_space == ARMSS_Secure) ?
44
+ ARMMMUIdx_Stage2_S : ARMMMUIdx_Stage2;
45
break;
46
47
case ARMMMUIdx_Stage2:
48
--
49
2.34.1
diff view generated by jsdifflib
Deleted patch
1
We no longer look at the in_secure field of the S1Translate struct
2
anyway, so we can remove it and all the code which sets it.
3
1
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20230807141514.19075-11-peter.maydell@linaro.org
7
---
8
target/arm/ptw.c | 13 -------------
9
1 file changed, 13 deletions(-)
10
11
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
12
index XXXXXXX..XXXXXXX 100644
13
--- a/target/arm/ptw.c
14
+++ b/target/arm/ptw.c
15
@@ -XXX,XX +XXX,XX @@ typedef struct S1Translate {
16
* value being Stage2 vs Stage2_S distinguishes those.
17
*/
18
ARMSecuritySpace in_space;
19
- /*
20
- * in_secure: whether the translation regime is a Secure one.
21
- * This is always equal to arm_space_is_secure(in_space).
22
- * If a Secure ptw is "downgraded" to NonSecure by an NSTable bit,
23
- * this field is updated accordingly.
24
- */
25
- bool in_secure;
26
/*
27
* in_debug: is this a QEMU debug access (gdbstub, etc)? Debug
28
* accesses will not update the guest page table access flags
29
@@ -XXX,XX +XXX,XX @@ static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw,
30
S1Translate s2ptw = {
31
.in_mmu_idx = s2_mmu_idx,
32
.in_ptw_idx = ptw_idx_for_stage_2(env, s2_mmu_idx),
33
- .in_secure = arm_space_is_secure(s2_space),
34
.in_space = s2_space,
35
.in_debug = true,
36
};
37
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
38
QEMU_BUILD_BUG_ON(ARMMMUIdx_Phys_S + 1 != ARMMMUIdx_Phys_NS);
39
QEMU_BUILD_BUG_ON(ARMMMUIdx_Stage2_S + 1 != ARMMMUIdx_Stage2);
40
ptw->in_ptw_idx += 1;
41
- ptw->in_secure = false;
42
ptw->in_space = ARMSS_NonSecure;
43
}
44
45
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw,
46
47
ptw->in_s1_is_el0 = ptw->in_mmu_idx == ARMMMUIdx_Stage1_E0;
48
ptw->in_mmu_idx = ipa_secure ? ARMMMUIdx_Stage2_S : ARMMMUIdx_Stage2;
49
- ptw->in_secure = ipa_secure;
50
ptw->in_space = ipa_space;
51
ptw->in_ptw_idx = ptw_idx_for_stage_2(env, ptw->in_mmu_idx);
52
53
@@ -XXX,XX +XXX,XX @@ bool get_phys_addr_with_secure(CPUARMState *env, target_ulong address,
54
{
55
S1Translate ptw = {
56
.in_mmu_idx = mmu_idx,
57
- .in_secure = is_secure,
58
.in_space = arm_secure_to_space(is_secure),
59
};
60
return get_phys_addr_gpc(env, &ptw, address, access_type, result, fi);
61
@@ -XXX,XX +XXX,XX @@ bool get_phys_addr(CPUARMState *env, target_ulong address,
62
}
63
64
ptw.in_space = ss;
65
- ptw.in_secure = arm_space_is_secure(ss);
66
return get_phys_addr_gpc(env, &ptw, address, access_type, result, fi);
67
}
68
69
@@ -XXX,XX +XXX,XX @@ hwaddr arm_cpu_get_phys_page_attrs_debug(CPUState *cs, vaddr addr,
70
S1Translate ptw = {
71
.in_mmu_idx = mmu_idx,
72
.in_space = ss,
73
- .in_secure = arm_space_is_secure(ss),
74
.in_debug = true,
75
};
76
GetPhysAddrResult res = {};
77
--
78
2.34.1
diff view generated by jsdifflib
Deleted patch
1
We only use S1Translate::out_secure in two places, where we are
2
setting up MemTxAttrs for a page table load. We can use
3
arm_space_is_secure(ptw->out_space) instead, which guarantees
4
that we're setting the MemTxAttrs secure and space fields
5
consistently, and allows us to drop the out_secure field in
6
S1Translate entirely.
7
1
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Message-id: 20230807141514.19075-12-peter.maydell@linaro.org
11
---
12
target/arm/ptw.c | 7 ++-----
13
1 file changed, 2 insertions(+), 5 deletions(-)
14
15
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
16
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/ptw.c
18
+++ b/target/arm/ptw.c
19
@@ -XXX,XX +XXX,XX @@ typedef struct S1Translate {
20
* Stage 2 is indicated by in_mmu_idx set to ARMMMUIdx_Stage2{,_S}.
21
*/
22
bool in_s1_is_el0;
23
- bool out_secure;
24
bool out_rw;
25
bool out_be;
26
ARMSecuritySpace out_space;
27
@@ -XXX,XX +XXX,XX @@ static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw,
28
pte_attrs = s2.cacheattrs.attrs;
29
ptw->out_host = NULL;
30
ptw->out_rw = false;
31
- ptw->out_secure = s2.f.attrs.secure;
32
ptw->out_space = s2.f.attrs.space;
33
} else {
34
#ifdef CONFIG_TCG
35
@@ -XXX,XX +XXX,XX @@ static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw,
36
ptw->out_phys = full->phys_addr | (addr & ~TARGET_PAGE_MASK);
37
ptw->out_rw = full->prot & PAGE_WRITE;
38
pte_attrs = full->pte_attrs;
39
- ptw->out_secure = full->attrs.secure;
40
ptw->out_space = full->attrs.space;
41
#else
42
g_assert_not_reached();
43
@@ -XXX,XX +XXX,XX @@ static uint32_t arm_ldl_ptw(CPUARMState *env, S1Translate *ptw,
44
} else {
45
/* Page tables are in MMIO. */
46
MemTxAttrs attrs = {
47
- .secure = ptw->out_secure,
48
.space = ptw->out_space,
49
+ .secure = arm_space_is_secure(ptw->out_space),
50
};
51
AddressSpace *as = arm_addressspace(cs, attrs);
52
MemTxResult result = MEMTX_OK;
53
@@ -XXX,XX +XXX,XX @@ static uint64_t arm_ldq_ptw(CPUARMState *env, S1Translate *ptw,
54
} else {
55
/* Page tables are in MMIO. */
56
MemTxAttrs attrs = {
57
- .secure = ptw->out_secure,
58
.space = ptw->out_space,
59
+ .secure = arm_space_is_secure(ptw->out_space),
60
};
61
AddressSpace *as = arm_addressspace(cs, attrs);
62
MemTxResult result = MEMTX_OK;
63
--
64
2.34.1
diff view generated by jsdifflib
Deleted patch
1
When the MMU is disabled, data accesses should be Device nGnRnE,
2
Outer Shareable, Untagged. We handle the other cases from
3
AArch64.S1DisabledOutput() correctly but missed this one.
4
Device nGnRnE is memattr == 0, so the only part we were missing
5
was that shareability should be set to 2 for both insn fetches
6
and data accesses.
7
1
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Message-id: 20230807141514.19075-13-peter.maydell@linaro.org
11
---
12
target/arm/ptw.c | 12 +++++++-----
13
1 file changed, 7 insertions(+), 5 deletions(-)
14
15
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
16
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/ptw.c
18
+++ b/target/arm/ptw.c
19
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_disabled(CPUARMState *env,
20
}
21
}
22
}
23
- if (memattr == 0 && access_type == MMU_INST_FETCH) {
24
- if (regime_sctlr(env, mmu_idx) & SCTLR_I) {
25
- memattr = 0xee; /* Normal, WT, RA, NT */
26
- } else {
27
- memattr = 0x44; /* Normal, NC, No */
28
+ if (memattr == 0) {
29
+ if (access_type == MMU_INST_FETCH) {
30
+ if (regime_sctlr(env, mmu_idx) & SCTLR_I) {
31
+ memattr = 0xee; /* Normal, WT, RA, NT */
32
+ } else {
33
+ memattr = 0x44; /* Normal, NC, No */
34
+ }
35
}
36
shareability = 2; /* outer shareable */
37
}
38
--
39
2.34.1
diff view generated by jsdifflib
Deleted patch
1
The architecture doesn't permit block descriptors at any arbitrary
2
level of the page table walk; it depends on the granule size which
3
levels are permitted. We implemented only a partial version of this
4
check which assumes that block descriptors are valid at all levels
5
except level 3, which meant that we wouldn't deliver the Translation
6
fault for all cases of this sort of guest page table error.
7
1
8
Implement the logic corresponding to the pseudocode
9
AArch64.DecodeDescriptorType() and AArch64.BlockDescSupported().
10
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
13
Message-id: 20230807141514.19075-14-peter.maydell@linaro.org
14
---
15
target/arm/ptw.c | 25 +++++++++++++++++++++++--
16
1 file changed, 23 insertions(+), 2 deletions(-)
17
18
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
19
index XXXXXXX..XXXXXXX 100644
20
--- a/target/arm/ptw.c
21
+++ b/target/arm/ptw.c
22
@@ -XXX,XX +XXX,XX @@ static int check_s2_mmu_setup(ARMCPU *cpu, bool is_aa64, uint64_t tcr,
23
return INT_MIN;
24
}
25
26
+static bool lpae_block_desc_valid(ARMCPU *cpu, bool ds,
27
+ ARMGranuleSize gran, int level)
28
+{
29
+ /*
30
+ * See pseudocode AArch46.BlockDescSupported(): block descriptors
31
+ * are not valid at all levels, depending on the page size.
32
+ */
33
+ switch (gran) {
34
+ case Gran4K:
35
+ return (level == 0 && ds) || level == 1 || level == 2;
36
+ case Gran16K:
37
+ return (level == 1 && ds) || level == 2;
38
+ case Gran64K:
39
+ return (level == 1 && arm_pamax(cpu) == 52) || level == 2;
40
+ default:
41
+ g_assert_not_reached();
42
+ }
43
+}
44
+
45
/**
46
* get_phys_addr_lpae: perform one stage of page table walk, LPAE format
47
*
48
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
49
new_descriptor = descriptor;
50
51
restart_atomic_update:
52
- if (!(descriptor & 1) || (!(descriptor & 2) && (level == 3))) {
53
- /* Invalid, or the Reserved level 3 encoding */
54
+ if (!(descriptor & 1) ||
55
+ (!(descriptor & 2) &&
56
+ !lpae_block_desc_valid(cpu, param.ds, param.gran, level))) {
57
+ /* Invalid, or a block descriptor at an invalid level */
58
goto do_translation_fault;
59
}
60
61
--
62
2.34.1
diff view generated by jsdifflib
Deleted patch
1
When we report faults due to stage 2 faults during a stage 1
2
page table walk, the 'level' parameter should be the level
3
of the walk in stage 2 that faulted, not the level of the
4
walk in stage 1. Correct the reporting of these faults.
5
1
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20230807141514.19075-15-peter.maydell@linaro.org
9
---
10
target/arm/ptw.c | 10 +++++++---
11
1 file changed, 7 insertions(+), 3 deletions(-)
12
13
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
14
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/ptw.c
16
+++ b/target/arm/ptw.c
17
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
18
do_translation_fault:
19
fi->type = ARMFault_Translation;
20
do_fault:
21
- fi->level = level;
22
- /* Tag the error as S2 for failed S1 PTW at S2 or ordinary S2. */
23
- fi->stage2 = fi->s1ptw || regime_is_stage2(mmu_idx);
24
+ if (fi->s1ptw) {
25
+ /* Retain the existing stage 2 fi->level */
26
+ assert(fi->stage2);
27
+ } else {
28
+ fi->level = level;
29
+ fi->stage2 = regime_is_stage2(mmu_idx);
30
+ }
31
fi->s1ns = fault_s1ns(ptw->in_space, mmu_idx);
32
return true;
33
}
34
--
35
2.34.1
diff view generated by jsdifflib
Deleted patch
1
The PAR_EL1.SH field documents that for the cases of:
2
* Device memory
3
* Normal memory with both Inner and Outer Non-Cacheable
4
the field should be 0b10 rather than whatever was in the
5
translation table descriptor field. (In the pseudocode this
6
is handled by PAREncodeShareability().) Perform this
7
adjustment when assembling a PAR value.
8
1
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11
Message-id: 20230807141514.19075-16-peter.maydell@linaro.org
12
---
13
target/arm/helper.c | 15 ++++++++++++++-
14
1 file changed, 14 insertions(+), 1 deletion(-)
15
16
diff --git a/target/arm/helper.c b/target/arm/helper.c
17
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/helper.c
19
+++ b/target/arm/helper.c
20
@@ -XXX,XX +XXX,XX @@ static CPAccessResult ats_access(CPUARMState *env, const ARMCPRegInfo *ri,
21
}
22
23
#ifdef CONFIG_TCG
24
+static int par_el1_shareability(GetPhysAddrResult *res)
25
+{
26
+ /*
27
+ * The PAR_EL1.SH field must be 0b10 for Device or Normal-NC
28
+ * memory -- see pseudocode PAREncodeShareability().
29
+ */
30
+ if (((res->cacheattrs.attrs & 0xf0) == 0) ||
31
+ res->cacheattrs.attrs == 0x44 || res->cacheattrs.attrs == 0x40) {
32
+ return 2;
33
+ }
34
+ return res->cacheattrs.shareability;
35
+}
36
+
37
static uint64_t do_ats_write(CPUARMState *env, uint64_t value,
38
MMUAccessType access_type, ARMMMUIdx mmu_idx,
39
bool is_secure)
40
@@ -XXX,XX +XXX,XX @@ static uint64_t do_ats_write(CPUARMState *env, uint64_t value,
41
par64 |= (1 << 9); /* NS */
42
}
43
par64 |= (uint64_t)res.cacheattrs.attrs << 56; /* ATTR */
44
- par64 |= res.cacheattrs.shareability << 7; /* SH */
45
+ par64 |= par_el1_shareability(&res) << 7; /* SH */
46
} else {
47
uint32_t fsr = arm_fi_to_lfsc(&fi);
48
49
--
50
2.34.1
diff view generated by jsdifflib
Deleted patch
1
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
2
1
3
In realm state, stage-2 translation tables are fetched from the realm
4
physical address space (R_PGRQD).
5
6
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Message-id: 20230809123706.1842548-2-jean-philippe@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
target/arm/ptw.c | 26 ++++++++++++++++++--------
12
1 file changed, 18 insertions(+), 8 deletions(-)
13
14
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/ptw.c
17
+++ b/target/arm/ptw.c
18
@@ -XXX,XX +XXX,XX @@ static ARMMMUIdx ptw_idx_for_stage_2(CPUARMState *env, ARMMMUIdx stage2idx)
19
20
/*
21
* We're OK to check the current state of the CPU here because
22
- * (1) we always invalidate all TLBs when the SCR_EL3.NS bit changes
23
+ * (1) we always invalidate all TLBs when the SCR_EL3.NS or SCR_EL3.NSE bit
24
+ * changes.
25
* (2) there's no way to do a lookup that cares about Stage 2 for a
26
* different security state to the current one for AArch64, and AArch32
27
* never has a secure EL2. (AArch32 ATS12NSO[UP][RW] allow EL3 to do
28
* an NS stage 1+2 lookup while the NS bit is 0.)
29
*/
30
- if (!arm_is_secure_below_el3(env) || !arm_el_is_aa64(env, 3)) {
31
+ if (!arm_el_is_aa64(env, 3)) {
32
return ARMMMUIdx_Phys_NS;
33
}
34
- if (stage2idx == ARMMMUIdx_Stage2_S) {
35
- s2walk_secure = !(env->cp15.vstcr_el2 & VSTCR_SW);
36
- } else {
37
- s2walk_secure = !(env->cp15.vtcr_el2 & VTCR_NSW);
38
- }
39
- return s2walk_secure ? ARMMMUIdx_Phys_S : ARMMMUIdx_Phys_NS;
40
41
+ switch (arm_security_space_below_el3(env)) {
42
+ case ARMSS_NonSecure:
43
+ return ARMMMUIdx_Phys_NS;
44
+ case ARMSS_Realm:
45
+ return ARMMMUIdx_Phys_Realm;
46
+ case ARMSS_Secure:
47
+ if (stage2idx == ARMMMUIdx_Stage2_S) {
48
+ s2walk_secure = !(env->cp15.vstcr_el2 & VSTCR_SW);
49
+ } else {
50
+ s2walk_secure = !(env->cp15.vtcr_el2 & VTCR_NSW);
51
+ }
52
+ return s2walk_secure ? ARMMMUIdx_Phys_S : ARMMMUIdx_Phys_NS;
53
+ default:
54
+ g_assert_not_reached();
55
+ }
56
}
57
58
static bool regime_translation_big_endian(CPUARMState *env, ARMMMUIdx mmu_idx)
59
--
60
2.34.1
diff view generated by jsdifflib
Deleted patch
1
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
2
1
3
When HCR_EL2.E2H is enabled, TLB entries are formed using the EL2&0
4
translation regime, instead of the EL2 translation regime. The TLB VAE2*
5
instructions invalidate the regime that corresponds to the current value
6
of HCR_EL2.E2H.
7
8
At the moment we only invalidate the EL2 translation regime. This causes
9
problems with RMM, which issues TLBI VAE2IS instructions with
10
HCR_EL2.E2H enabled. Update vae2_tlbmask() to take HCR_EL2.E2H into
11
account.
12
13
Add vae2_tlbbits() as well, since the top-byte-ignore configuration is
14
different between the EL2&0 and EL2 regime.
15
16
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
17
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
18
Message-id: 20230809123706.1842548-3-jean-philippe@linaro.org
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
---
21
target/arm/helper.c | 50 ++++++++++++++++++++++++++++++++++++---------
22
1 file changed, 40 insertions(+), 10 deletions(-)
23
24
diff --git a/target/arm/helper.c b/target/arm/helper.c
25
index XXXXXXX..XXXXXXX 100644
26
--- a/target/arm/helper.c
27
+++ b/target/arm/helper.c
28
@@ -XXX,XX +XXX,XX @@ static int vae1_tlbmask(CPUARMState *env)
29
return mask;
30
}
31
32
+static int vae2_tlbmask(CPUARMState *env)
33
+{
34
+ uint64_t hcr = arm_hcr_el2_eff(env);
35
+ uint16_t mask;
36
+
37
+ if (hcr & HCR_E2H) {
38
+ mask = ARMMMUIdxBit_E20_2 |
39
+ ARMMMUIdxBit_E20_2_PAN |
40
+ ARMMMUIdxBit_E20_0;
41
+ } else {
42
+ mask = ARMMMUIdxBit_E2;
43
+ }
44
+ return mask;
45
+}
46
+
47
/* Return 56 if TBI is enabled, 64 otherwise. */
48
static int tlbbits_for_regime(CPUARMState *env, ARMMMUIdx mmu_idx,
49
uint64_t addr)
50
@@ -XXX,XX +XXX,XX @@ static int vae1_tlbbits(CPUARMState *env, uint64_t addr)
51
return tlbbits_for_regime(env, mmu_idx, addr);
52
}
53
54
+static int vae2_tlbbits(CPUARMState *env, uint64_t addr)
55
+{
56
+ uint64_t hcr = arm_hcr_el2_eff(env);
57
+ ARMMMUIdx mmu_idx;
58
+
59
+ /*
60
+ * Only the regime of the mmu_idx below is significant.
61
+ * Regime EL2&0 has two ranges with separate TBI configuration, while EL2
62
+ * only has one.
63
+ */
64
+ if (hcr & HCR_E2H) {
65
+ mmu_idx = ARMMMUIdx_E20_2;
66
+ } else {
67
+ mmu_idx = ARMMMUIdx_E2;
68
+ }
69
+
70
+ return tlbbits_for_regime(env, mmu_idx, addr);
71
+}
72
+
73
static void tlbi_aa64_vmalle1is_write(CPUARMState *env, const ARMCPRegInfo *ri,
74
uint64_t value)
75
{
76
@@ -XXX,XX +XXX,XX @@ static void tlbi_aa64_vae2_write(CPUARMState *env, const ARMCPRegInfo *ri,
77
* flush-last-level-only.
78
*/
79
CPUState *cs = env_cpu(env);
80
- int mask = e2_tlbmask(env);
81
+ int mask = vae2_tlbmask(env);
82
uint64_t pageaddr = sextract64(value << 12, 0, 56);
83
+ int bits = vae2_tlbbits(env, pageaddr);
84
85
- tlb_flush_page_by_mmuidx(cs, pageaddr, mask);
86
+ tlb_flush_page_bits_by_mmuidx(cs, pageaddr, mask, bits);
87
}
88
89
static void tlbi_aa64_vae3_write(CPUARMState *env, const ARMCPRegInfo *ri,
90
@@ -XXX,XX +XXX,XX @@ static void tlbi_aa64_vae2is_write(CPUARMState *env, const ARMCPRegInfo *ri,
91
uint64_t value)
92
{
93
CPUState *cs = env_cpu(env);
94
+ int mask = vae2_tlbmask(env);
95
uint64_t pageaddr = sextract64(value << 12, 0, 56);
96
- int bits = tlbbits_for_regime(env, ARMMMUIdx_E2, pageaddr);
97
+ int bits = vae2_tlbbits(env, pageaddr);
98
99
- tlb_flush_page_bits_by_mmuidx_all_cpus_synced(cs, pageaddr,
100
- ARMMMUIdxBit_E2, bits);
101
+ tlb_flush_page_bits_by_mmuidx_all_cpus_synced(cs, pageaddr, mask, bits);
102
}
103
104
static void tlbi_aa64_vae3is_write(CPUARMState *env, const ARMCPRegInfo *ri,
105
@@ -XXX,XX +XXX,XX @@ static void tlbi_aa64_rvae1is_write(CPUARMState *env,
106
do_rvae_write(env, value, vae1_tlbmask(env), true);
107
}
108
109
-static int vae2_tlbmask(CPUARMState *env)
110
-{
111
- return ARMMMUIdxBit_E2;
112
-}
113
-
114
static void tlbi_aa64_rvae2_write(CPUARMState *env,
115
const ARMCPRegInfo *ri,
116
uint64_t value)
117
--
118
2.34.1
diff view generated by jsdifflib
Deleted patch
1
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
2
1
3
GPC checks are not performed on the output address for AT instructions,
4
as stated by ARM DDI 0487J in D8.12.2:
5
6
When populating PAR_EL1 with the result of an address translation
7
instruction, granule protection checks are not performed on the final
8
output address of a successful translation.
9
10
Rename get_phys_addr_with_secure(), since it's only used to handle AT
11
instructions.
12
13
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
14
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
15
Message-id: 20230809123706.1842548-4-jean-philippe@linaro.org
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
---
18
target/arm/internals.h | 25 ++++++++++++++-----------
19
target/arm/helper.c | 8 ++++++--
20
target/arm/ptw.c | 11 ++++++-----
21
3 files changed, 26 insertions(+), 18 deletions(-)
22
23
diff --git a/target/arm/internals.h b/target/arm/internals.h
24
index XXXXXXX..XXXXXXX 100644
25
--- a/target/arm/internals.h
26
+++ b/target/arm/internals.h
27
@@ -XXX,XX +XXX,XX @@ typedef struct GetPhysAddrResult {
28
} GetPhysAddrResult;
29
30
/**
31
- * get_phys_addr_with_secure: get the physical address for a virtual address
32
+ * get_phys_addr: get the physical address for a virtual address
33
* @env: CPUARMState
34
* @address: virtual address to get physical address for
35
* @access_type: 0 for read, 1 for write, 2 for execute
36
* @mmu_idx: MMU index indicating required translation regime
37
- * @is_secure: security state for the access
38
* @result: set on translation success.
39
* @fi: set to fault info if the translation fails
40
*
41
@@ -XXX,XX +XXX,XX @@ typedef struct GetPhysAddrResult {
42
* * for PSMAv5 based systems we don't bother to return a full FSR format
43
* value.
44
*/
45
-bool get_phys_addr_with_secure(CPUARMState *env, target_ulong address,
46
- MMUAccessType access_type,
47
- ARMMMUIdx mmu_idx, bool is_secure,
48
- GetPhysAddrResult *result, ARMMMUFaultInfo *fi)
49
+bool get_phys_addr(CPUARMState *env, target_ulong address,
50
+ MMUAccessType access_type, ARMMMUIdx mmu_idx,
51
+ GetPhysAddrResult *result, ARMMMUFaultInfo *fi)
52
__attribute__((nonnull));
53
54
/**
55
- * get_phys_addr: get the physical address for a virtual address
56
+ * get_phys_addr_with_secure_nogpc: get the physical address for a virtual
57
+ * address
58
* @env: CPUARMState
59
* @address: virtual address to get physical address for
60
* @access_type: 0 for read, 1 for write, 2 for execute
61
* @mmu_idx: MMU index indicating required translation regime
62
+ * @is_secure: security state for the access
63
* @result: set on translation success.
64
* @fi: set to fault info if the translation fails
65
*
66
- * Similarly, but use the security regime of @mmu_idx.
67
+ * Similar to get_phys_addr, but use the given security regime and don't perform
68
+ * a Granule Protection Check on the resulting address.
69
*/
70
-bool get_phys_addr(CPUARMState *env, target_ulong address,
71
- MMUAccessType access_type, ARMMMUIdx mmu_idx,
72
- GetPhysAddrResult *result, ARMMMUFaultInfo *fi)
73
+bool get_phys_addr_with_secure_nogpc(CPUARMState *env, target_ulong address,
74
+ MMUAccessType access_type,
75
+ ARMMMUIdx mmu_idx, bool is_secure,
76
+ GetPhysAddrResult *result,
77
+ ARMMMUFaultInfo *fi)
78
__attribute__((nonnull));
79
80
bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address,
81
diff --git a/target/arm/helper.c b/target/arm/helper.c
82
index XXXXXXX..XXXXXXX 100644
83
--- a/target/arm/helper.c
84
+++ b/target/arm/helper.c
85
@@ -XXX,XX +XXX,XX @@ static uint64_t do_ats_write(CPUARMState *env, uint64_t value,
86
ARMMMUFaultInfo fi = {};
87
GetPhysAddrResult res = {};
88
89
- ret = get_phys_addr_with_secure(env, value, access_type, mmu_idx,
90
- is_secure, &res, &fi);
91
+ /*
92
+ * I_MXTJT: Granule protection checks are not performed on the final address
93
+ * of a successful translation.
94
+ */
95
+ ret = get_phys_addr_with_secure_nogpc(env, value, access_type, mmu_idx,
96
+ is_secure, &res, &fi);
97
98
/*
99
* ATS operations only do S1 or S1+S2 translations, so we never
100
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
101
index XXXXXXX..XXXXXXX 100644
102
--- a/target/arm/ptw.c
103
+++ b/target/arm/ptw.c
104
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_gpc(CPUARMState *env, S1Translate *ptw,
105
return false;
106
}
107
108
-bool get_phys_addr_with_secure(CPUARMState *env, target_ulong address,
109
- MMUAccessType access_type, ARMMMUIdx mmu_idx,
110
- bool is_secure, GetPhysAddrResult *result,
111
- ARMMMUFaultInfo *fi)
112
+bool get_phys_addr_with_secure_nogpc(CPUARMState *env, target_ulong address,
113
+ MMUAccessType access_type,
114
+ ARMMMUIdx mmu_idx, bool is_secure,
115
+ GetPhysAddrResult *result,
116
+ ARMMMUFaultInfo *fi)
117
{
118
S1Translate ptw = {
119
.in_mmu_idx = mmu_idx,
120
.in_space = arm_secure_to_space(is_secure),
121
};
122
- return get_phys_addr_gpc(env, &ptw, address, access_type, result, fi);
123
+ return get_phys_addr_nogpc(env, &ptw, address, access_type, result, fi);
124
}
125
126
bool get_phys_addr(CPUARMState *env, target_ulong address,
127
--
128
2.34.1
diff view generated by jsdifflib
Deleted patch
1
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
2
1
3
At the moment we only handle Secure and Nonsecure security spaces for
4
the AT instructions. Add support for Realm and Root.
5
6
For AArch64, arm_security_space() gives the desired space. ARM DDI0487J
7
says (R_NYXTL):
8
9
If EL3 is implemented, then when an address translation instruction
10
that applies to an Exception level lower than EL3 is executed, the
11
Effective value of SCR_EL3.{NSE, NS} determines the target Security
12
state that the instruction applies to.
13
14
For AArch32, some instructions can access NonSecure space from Secure,
15
so we still need to pass the state explicitly to do_ats_write().
16
17
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
18
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
19
Message-id: 20230809123706.1842548-5-jean-philippe@linaro.org
20
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
21
---
22
target/arm/internals.h | 18 +++++++++---------
23
target/arm/helper.c | 27 ++++++++++++---------------
24
target/arm/ptw.c | 12 ++++++------
25
3 files changed, 27 insertions(+), 30 deletions(-)
26
27
diff --git a/target/arm/internals.h b/target/arm/internals.h
28
index XXXXXXX..XXXXXXX 100644
29
--- a/target/arm/internals.h
30
+++ b/target/arm/internals.h
31
@@ -XXX,XX +XXX,XX @@ bool get_phys_addr(CPUARMState *env, target_ulong address,
32
__attribute__((nonnull));
33
34
/**
35
- * get_phys_addr_with_secure_nogpc: get the physical address for a virtual
36
- * address
37
+ * get_phys_addr_with_space_nogpc: get the physical address for a virtual
38
+ * address
39
* @env: CPUARMState
40
* @address: virtual address to get physical address for
41
* @access_type: 0 for read, 1 for write, 2 for execute
42
* @mmu_idx: MMU index indicating required translation regime
43
- * @is_secure: security state for the access
44
+ * @space: security space for the access
45
* @result: set on translation success.
46
* @fi: set to fault info if the translation fails
47
*
48
- * Similar to get_phys_addr, but use the given security regime and don't perform
49
+ * Similar to get_phys_addr, but use the given security space and don't perform
50
* a Granule Protection Check on the resulting address.
51
*/
52
-bool get_phys_addr_with_secure_nogpc(CPUARMState *env, target_ulong address,
53
- MMUAccessType access_type,
54
- ARMMMUIdx mmu_idx, bool is_secure,
55
- GetPhysAddrResult *result,
56
- ARMMMUFaultInfo *fi)
57
+bool get_phys_addr_with_space_nogpc(CPUARMState *env, target_ulong address,
58
+ MMUAccessType access_type,
59
+ ARMMMUIdx mmu_idx, ARMSecuritySpace space,
60
+ GetPhysAddrResult *result,
61
+ ARMMMUFaultInfo *fi)
62
__attribute__((nonnull));
63
64
bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address,
65
diff --git a/target/arm/helper.c b/target/arm/helper.c
66
index XXXXXXX..XXXXXXX 100644
67
--- a/target/arm/helper.c
68
+++ b/target/arm/helper.c
69
@@ -XXX,XX +XXX,XX @@ static int par_el1_shareability(GetPhysAddrResult *res)
70
71
static uint64_t do_ats_write(CPUARMState *env, uint64_t value,
72
MMUAccessType access_type, ARMMMUIdx mmu_idx,
73
- bool is_secure)
74
+ ARMSecuritySpace ss)
75
{
76
bool ret;
77
uint64_t par64;
78
@@ -XXX,XX +XXX,XX @@ static uint64_t do_ats_write(CPUARMState *env, uint64_t value,
79
* I_MXTJT: Granule protection checks are not performed on the final address
80
* of a successful translation.
81
*/
82
- ret = get_phys_addr_with_secure_nogpc(env, value, access_type, mmu_idx,
83
- is_secure, &res, &fi);
84
+ ret = get_phys_addr_with_space_nogpc(env, value, access_type, mmu_idx, ss,
85
+ &res, &fi);
86
87
/*
88
* ATS operations only do S1 or S1+S2 translations, so we never
89
@@ -XXX,XX +XXX,XX @@ static void ats_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value)
90
uint64_t par64;
91
ARMMMUIdx mmu_idx;
92
int el = arm_current_el(env);
93
- bool secure = arm_is_secure_below_el3(env);
94
+ ARMSecuritySpace ss = arm_security_space(env);
95
96
switch (ri->opc2 & 6) {
97
case 0:
98
@@ -XXX,XX +XXX,XX @@ static void ats_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value)
99
switch (el) {
100
case 3:
101
mmu_idx = ARMMMUIdx_E3;
102
- secure = true;
103
break;
104
case 2:
105
- g_assert(!secure); /* ARMv8.4-SecEL2 is 64-bit only */
106
+ g_assert(ss != ARMSS_Secure); /* ARMv8.4-SecEL2 is 64-bit only */
107
/* fall through */
108
case 1:
109
if (ri->crm == 9 && (env->uncached_cpsr & CPSR_PAN)) {
110
@@ -XXX,XX +XXX,XX @@ static void ats_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value)
111
switch (el) {
112
case 3:
113
mmu_idx = ARMMMUIdx_E10_0;
114
- secure = true;
115
break;
116
case 2:
117
- g_assert(!secure); /* ARMv8.4-SecEL2 is 64-bit only */
118
+ g_assert(ss != ARMSS_Secure); /* ARMv8.4-SecEL2 is 64-bit only */
119
mmu_idx = ARMMMUIdx_Stage1_E0;
120
break;
121
case 1:
122
@@ -XXX,XX +XXX,XX @@ static void ats_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value)
123
case 4:
124
/* stage 1+2 NonSecure PL1: ATS12NSOPR, ATS12NSOPW */
125
mmu_idx = ARMMMUIdx_E10_1;
126
- secure = false;
127
+ ss = ARMSS_NonSecure;
128
break;
129
case 6:
130
/* stage 1+2 NonSecure PL0: ATS12NSOUR, ATS12NSOUW */
131
mmu_idx = ARMMMUIdx_E10_0;
132
- secure = false;
133
+ ss = ARMSS_NonSecure;
134
break;
135
default:
136
g_assert_not_reached();
137
}
138
139
- par64 = do_ats_write(env, value, access_type, mmu_idx, secure);
140
+ par64 = do_ats_write(env, value, access_type, mmu_idx, ss);
141
142
A32_BANKED_CURRENT_REG_SET(env, par, par64);
143
#else
144
@@ -XXX,XX +XXX,XX @@ static void ats1h_write(CPUARMState *env, const ARMCPRegInfo *ri,
145
uint64_t par64;
146
147
/* There is no SecureEL2 for AArch32. */
148
- par64 = do_ats_write(env, value, access_type, ARMMMUIdx_E2, false);
149
+ par64 = do_ats_write(env, value, access_type, ARMMMUIdx_E2,
150
+ ARMSS_NonSecure);
151
152
A32_BANKED_CURRENT_REG_SET(env, par, par64);
153
#else
154
@@ -XXX,XX +XXX,XX @@ static void ats_write64(CPUARMState *env, const ARMCPRegInfo *ri,
155
#ifdef CONFIG_TCG
156
MMUAccessType access_type = ri->opc2 & 1 ? MMU_DATA_STORE : MMU_DATA_LOAD;
157
ARMMMUIdx mmu_idx;
158
- int secure = arm_is_secure_below_el3(env);
159
uint64_t hcr_el2 = arm_hcr_el2_eff(env);
160
bool regime_e20 = (hcr_el2 & (HCR_E2H | HCR_TGE)) == (HCR_E2H | HCR_TGE);
161
162
@@ -XXX,XX +XXX,XX @@ static void ats_write64(CPUARMState *env, const ARMCPRegInfo *ri,
163
break;
164
case 6: /* AT S1E3R, AT S1E3W */
165
mmu_idx = ARMMMUIdx_E3;
166
- secure = true;
167
break;
168
default:
169
g_assert_not_reached();
170
@@ -XXX,XX +XXX,XX @@ static void ats_write64(CPUARMState *env, const ARMCPRegInfo *ri,
171
}
172
173
env->cp15.par_el[1] = do_ats_write(env, value, access_type,
174
- mmu_idx, secure);
175
+ mmu_idx, arm_security_space(env));
176
#else
177
/* Handled by hardware accelerator. */
178
g_assert_not_reached();
179
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
180
index XXXXXXX..XXXXXXX 100644
181
--- a/target/arm/ptw.c
182
+++ b/target/arm/ptw.c
183
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_gpc(CPUARMState *env, S1Translate *ptw,
184
return false;
185
}
186
187
-bool get_phys_addr_with_secure_nogpc(CPUARMState *env, target_ulong address,
188
- MMUAccessType access_type,
189
- ARMMMUIdx mmu_idx, bool is_secure,
190
- GetPhysAddrResult *result,
191
- ARMMMUFaultInfo *fi)
192
+bool get_phys_addr_with_space_nogpc(CPUARMState *env, target_ulong address,
193
+ MMUAccessType access_type,
194
+ ARMMMUIdx mmu_idx, ARMSecuritySpace space,
195
+ GetPhysAddrResult *result,
196
+ ARMMMUFaultInfo *fi)
197
{
198
S1Translate ptw = {
199
.in_mmu_idx = mmu_idx,
200
- .in_space = arm_secure_to_space(is_secure),
201
+ .in_space = space,
202
};
203
return get_phys_addr_nogpc(env, &ptw, address, access_type, result, fi);
204
}
205
--
206
2.34.1
diff view generated by jsdifflib
Deleted patch
1
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
2
1
3
The AT instruction is UNDEFINED if the {NSE,NS} configuration is
4
invalid. Add a function to check this on all AT instructions that apply
5
to an EL lower than 3.
6
7
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
9
Message-id: 20230809123706.1842548-6-jean-philippe@linaro.org
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12
---
13
target/arm/helper.c | 38 +++++++++++++++++++++++++++-----------
14
1 file changed, 27 insertions(+), 11 deletions(-)
15
16
diff --git a/target/arm/helper.c b/target/arm/helper.c
17
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/helper.c
19
+++ b/target/arm/helper.c
20
@@ -XXX,XX +XXX,XX @@ static void ats1h_write(CPUARMState *env, const ARMCPRegInfo *ri,
21
#endif /* CONFIG_TCG */
22
}
23
24
+static CPAccessResult at_e012_access(CPUARMState *env, const ARMCPRegInfo *ri,
25
+ bool isread)
26
+{
27
+ /*
28
+ * R_NYXTL: instruction is UNDEFINED if it applies to an Exception level
29
+ * lower than EL3 and the combination SCR_EL3.{NSE,NS} is reserved. This can
30
+ * only happen when executing at EL3 because that combination also causes an
31
+ * illegal exception return. We don't need to check FEAT_RME either, because
32
+ * scr_write() ensures that the NSE bit is not set otherwise.
33
+ */
34
+ if ((env->cp15.scr_el3 & (SCR_NSE | SCR_NS)) == SCR_NSE) {
35
+ return CP_ACCESS_TRAP;
36
+ }
37
+ return CP_ACCESS_OK;
38
+}
39
+
40
static CPAccessResult at_s1e2_access(CPUARMState *env, const ARMCPRegInfo *ri,
41
bool isread)
42
{
43
@@ -XXX,XX +XXX,XX @@ static CPAccessResult at_s1e2_access(CPUARMState *env, const ARMCPRegInfo *ri,
44
!(env->cp15.scr_el3 & (SCR_NS | SCR_EEL2))) {
45
return CP_ACCESS_TRAP;
46
}
47
- return CP_ACCESS_OK;
48
+ return at_e012_access(env, ri, isread);
49
}
50
51
static void ats_write64(CPUARMState *env, const ARMCPRegInfo *ri,
52
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = {
53
.opc0 = 1, .opc1 = 0, .crn = 7, .crm = 8, .opc2 = 0,
54
.access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC,
55
.fgt = FGT_ATS1E1R,
56
- .writefn = ats_write64 },
57
+ .accessfn = at_e012_access, .writefn = ats_write64 },
58
{ .name = "AT_S1E1W", .state = ARM_CP_STATE_AA64,
59
.opc0 = 1, .opc1 = 0, .crn = 7, .crm = 8, .opc2 = 1,
60
.access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC,
61
.fgt = FGT_ATS1E1W,
62
- .writefn = ats_write64 },
63
+ .accessfn = at_e012_access, .writefn = ats_write64 },
64
{ .name = "AT_S1E0R", .state = ARM_CP_STATE_AA64,
65
.opc0 = 1, .opc1 = 0, .crn = 7, .crm = 8, .opc2 = 2,
66
.access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC,
67
.fgt = FGT_ATS1E0R,
68
- .writefn = ats_write64 },
69
+ .accessfn = at_e012_access, .writefn = ats_write64 },
70
{ .name = "AT_S1E0W", .state = ARM_CP_STATE_AA64,
71
.opc0 = 1, .opc1 = 0, .crn = 7, .crm = 8, .opc2 = 3,
72
.access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC,
73
.fgt = FGT_ATS1E0W,
74
- .writefn = ats_write64 },
75
+ .accessfn = at_e012_access, .writefn = ats_write64 },
76
{ .name = "AT_S12E1R", .state = ARM_CP_STATE_AA64,
77
.opc0 = 1, .opc1 = 4, .crn = 7, .crm = 8, .opc2 = 4,
78
.access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC,
79
- .writefn = ats_write64 },
80
+ .accessfn = at_e012_access, .writefn = ats_write64 },
81
{ .name = "AT_S12E1W", .state = ARM_CP_STATE_AA64,
82
.opc0 = 1, .opc1 = 4, .crn = 7, .crm = 8, .opc2 = 5,
83
.access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC,
84
- .writefn = ats_write64 },
85
+ .accessfn = at_e012_access, .writefn = ats_write64 },
86
{ .name = "AT_S12E0R", .state = ARM_CP_STATE_AA64,
87
.opc0 = 1, .opc1 = 4, .crn = 7, .crm = 8, .opc2 = 6,
88
.access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC,
89
- .writefn = ats_write64 },
90
+ .accessfn = at_e012_access, .writefn = ats_write64 },
91
{ .name = "AT_S12E0W", .state = ARM_CP_STATE_AA64,
92
.opc0 = 1, .opc1 = 4, .crn = 7, .crm = 8, .opc2 = 7,
93
.access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC,
94
- .writefn = ats_write64 },
95
+ .accessfn = at_e012_access, .writefn = ats_write64 },
96
/* AT S1E2* are elsewhere as they UNDEF from EL3 if EL2 is not present */
97
{ .name = "AT_S1E3R", .state = ARM_CP_STATE_AA64,
98
.opc0 = 1, .opc1 = 6, .crn = 7, .crm = 8, .opc2 = 0,
99
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo ats1e1_reginfo[] = {
100
.opc0 = 1, .opc1 = 0, .crn = 7, .crm = 9, .opc2 = 0,
101
.access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC,
102
.fgt = FGT_ATS1E1RP,
103
- .writefn = ats_write64 },
104
+ .accessfn = at_e012_access, .writefn = ats_write64 },
105
{ .name = "AT_S1E1WP", .state = ARM_CP_STATE_AA64,
106
.opc0 = 1, .opc1 = 0, .crn = 7, .crm = 9, .opc2 = 1,
107
.access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC,
108
.fgt = FGT_ATS1E1WP,
109
- .writefn = ats_write64 },
110
+ .accessfn = at_e012_access, .writefn = ats_write64 },
111
};
112
113
static const ARMCPRegInfo ats1cp_reginfo[] = {
114
--
115
2.34.1
diff view generated by jsdifflib
Deleted patch
1
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
2
1
3
When FEAT_RME is implemented, these bits override the value of
4
CNT[VP]_CTL_EL0.IMASK in Realm and Root state. Move the IRQ state update
5
into a new gt_update_irq() function and test those bits every time we
6
recompute the IRQ state.
7
8
Since we're removing the IRQ state from some trace events, add a new
9
trace event for gt_update_irq().
10
11
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
12
Message-id: 20230809123706.1842548-7-jean-philippe@linaro.org
13
[PMM: only register change hook if not USER_ONLY and if TCG]
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
16
---
17
target/arm/cpu.h | 4 +++
18
target/arm/cpu.c | 6 ++++
19
target/arm/helper.c | 65 ++++++++++++++++++++++++++++++++++-------
20
target/arm/trace-events | 7 +++--
21
4 files changed, 68 insertions(+), 14 deletions(-)
22
23
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
24
index XXXXXXX..XXXXXXX 100644
25
--- a/target/arm/cpu.h
26
+++ b/target/arm/cpu.h
27
@@ -XXX,XX +XXX,XX @@ struct ArchCPU {
28
};
29
30
unsigned int gt_cntfrq_period_ns(ARMCPU *cpu);
31
+void gt_rme_post_el_change(ARMCPU *cpu, void *opaque);
32
33
void arm_cpu_post_init(Object *obj);
34
35
@@ -XXX,XX +XXX,XX @@ static inline void xpsr_write(CPUARMState *env, uint32_t val, uint32_t mask)
36
#define HSTR_TTEE (1 << 16)
37
#define HSTR_TJDBX (1 << 17)
38
39
+#define CNTHCTL_CNTVMASK (1 << 18)
40
+#define CNTHCTL_CNTPMASK (1 << 19)
41
+
42
/* Return the current FPSCR value. */
43
uint32_t vfp_get_fpscr(CPUARMState *env);
44
void vfp_set_fpscr(CPUARMState *env, uint32_t val);
45
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
46
index XXXXXXX..XXXXXXX 100644
47
--- a/target/arm/cpu.c
48
+++ b/target/arm/cpu.c
49
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
50
set_feature(env, ARM_FEATURE_VBAR);
51
}
52
53
+#ifndef CONFIG_USER_ONLY
54
+ if (tcg_enabled() && cpu_isar_feature(aa64_rme, cpu)) {
55
+ arm_register_el_change_hook(cpu, &gt_rme_post_el_change, 0);
56
+ }
57
+#endif
58
+
59
register_cp_regs_for_features(cpu);
60
arm_cpu_register_gdb_regs_for_features(cpu);
61
62
diff --git a/target/arm/helper.c b/target/arm/helper.c
63
index XXXXXXX..XXXXXXX 100644
64
--- a/target/arm/helper.c
65
+++ b/target/arm/helper.c
66
@@ -XXX,XX +XXX,XX @@ static uint64_t gt_get_countervalue(CPUARMState *env)
67
return qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) / gt_cntfrq_period_ns(cpu);
68
}
69
70
+static void gt_update_irq(ARMCPU *cpu, int timeridx)
71
+{
72
+ CPUARMState *env = &cpu->env;
73
+ uint64_t cnthctl = env->cp15.cnthctl_el2;
74
+ ARMSecuritySpace ss = arm_security_space(env);
75
+ /* ISTATUS && !IMASK */
76
+ int irqstate = (env->cp15.c14_timer[timeridx].ctl & 6) == 4;
77
+
78
+ /*
79
+ * If bit CNTHCTL_EL2.CNT[VP]MASK is set, it overrides IMASK.
80
+ * It is RES0 in Secure and NonSecure state.
81
+ */
82
+ if ((ss == ARMSS_Root || ss == ARMSS_Realm) &&
83
+ ((timeridx == GTIMER_VIRT && (cnthctl & CNTHCTL_CNTVMASK)) ||
84
+ (timeridx == GTIMER_PHYS && (cnthctl & CNTHCTL_CNTPMASK)))) {
85
+ irqstate = 0;
86
+ }
87
+
88
+ qemu_set_irq(cpu->gt_timer_outputs[timeridx], irqstate);
89
+ trace_arm_gt_update_irq(timeridx, irqstate);
90
+}
91
+
92
+void gt_rme_post_el_change(ARMCPU *cpu, void *ignored)
93
+{
94
+ /*
95
+ * Changing security state between Root and Secure/NonSecure, which may
96
+ * happen when switching EL, can change the effective value of CNTHCTL_EL2
97
+ * mask bits. Update the IRQ state accordingly.
98
+ */
99
+ gt_update_irq(cpu, GTIMER_VIRT);
100
+ gt_update_irq(cpu, GTIMER_PHYS);
101
+}
102
+
103
static void gt_recalc_timer(ARMCPU *cpu, int timeridx)
104
{
105
ARMGenericTimer *gt = &cpu->env.cp15.c14_timer[timeridx];
106
@@ -XXX,XX +XXX,XX @@ static void gt_recalc_timer(ARMCPU *cpu, int timeridx)
107
/* Note that this must be unsigned 64 bit arithmetic: */
108
int istatus = count - offset >= gt->cval;
109
uint64_t nexttick;
110
- int irqstate;
111
112
gt->ctl = deposit32(gt->ctl, 2, 1, istatus);
113
114
- irqstate = (istatus && !(gt->ctl & 2));
115
- qemu_set_irq(cpu->gt_timer_outputs[timeridx], irqstate);
116
-
117
if (istatus) {
118
/* Next transition is when count rolls back over to zero */
119
nexttick = UINT64_MAX;
120
@@ -XXX,XX +XXX,XX @@ static void gt_recalc_timer(ARMCPU *cpu, int timeridx)
121
} else {
122
timer_mod(cpu->gt_timer[timeridx], nexttick);
123
}
124
- trace_arm_gt_recalc(timeridx, irqstate, nexttick);
125
+ trace_arm_gt_recalc(timeridx, nexttick);
126
} else {
127
/* Timer disabled: ISTATUS and timer output always clear */
128
gt->ctl &= ~4;
129
- qemu_set_irq(cpu->gt_timer_outputs[timeridx], 0);
130
timer_del(cpu->gt_timer[timeridx]);
131
trace_arm_gt_recalc_disabled(timeridx);
132
}
133
+ gt_update_irq(cpu, timeridx);
134
}
135
136
static void gt_timer_reset(CPUARMState *env, const ARMCPRegInfo *ri,
137
@@ -XXX,XX +XXX,XX @@ static void gt_ctl_write(CPUARMState *env, const ARMCPRegInfo *ri,
138
* IMASK toggled: don't need to recalculate,
139
* just set the interrupt line based on ISTATUS
140
*/
141
- int irqstate = (oldval & 4) && !(value & 2);
142
-
143
- trace_arm_gt_imask_toggle(timeridx, irqstate);
144
- qemu_set_irq(cpu->gt_timer_outputs[timeridx], irqstate);
145
+ trace_arm_gt_imask_toggle(timeridx);
146
+ gt_update_irq(cpu, timeridx);
147
}
148
}
149
150
@@ -XXX,XX +XXX,XX @@ static void gt_virt_ctl_write(CPUARMState *env, const ARMCPRegInfo *ri,
151
gt_ctl_write(env, ri, GTIMER_VIRT, value);
152
}
153
154
+static void gt_cnthctl_write(CPUARMState *env, const ARMCPRegInfo *ri,
155
+ uint64_t value)
156
+{
157
+ ARMCPU *cpu = env_archcpu(env);
158
+ uint32_t oldval = env->cp15.cnthctl_el2;
159
+
160
+ raw_write(env, ri, value);
161
+
162
+ if ((oldval ^ value) & CNTHCTL_CNTVMASK) {
163
+ gt_update_irq(cpu, GTIMER_VIRT);
164
+ } else if ((oldval ^ value) & CNTHCTL_CNTPMASK) {
165
+ gt_update_irq(cpu, GTIMER_PHYS);
166
+ }
167
+}
168
+
169
static void gt_cntvoff_write(CPUARMState *env, const ARMCPRegInfo *ri,
170
uint64_t value)
171
{
172
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el2_cp_reginfo[] = {
173
* reset values as IMPDEF. We choose to reset to 3 to comply with
174
* both ARMv7 and ARMv8.
175
*/
176
- .access = PL2_RW, .resetvalue = 3,
177
+ .access = PL2_RW, .type = ARM_CP_IO, .resetvalue = 3,
178
+ .writefn = gt_cnthctl_write, .raw_writefn = raw_write,
179
.fieldoffset = offsetof(CPUARMState, cp15.cnthctl_el2) },
180
{ .name = "CNTVOFF_EL2", .state = ARM_CP_STATE_AA64,
181
.opc0 = 3, .opc1 = 4, .crn = 14, .crm = 0, .opc2 = 3,
182
diff --git a/target/arm/trace-events b/target/arm/trace-events
183
index XXXXXXX..XXXXXXX 100644
184
--- a/target/arm/trace-events
185
+++ b/target/arm/trace-events
186
@@ -XXX,XX +XXX,XX @@
187
# See docs/devel/tracing.rst for syntax documentation.
188
189
# helper.c
190
-arm_gt_recalc(int timer, int irqstate, uint64_t nexttick) "gt recalc: timer %d irqstate %d next tick 0x%" PRIx64
191
-arm_gt_recalc_disabled(int timer) "gt recalc: timer %d irqstate 0 timer disabled"
192
+arm_gt_recalc(int timer, uint64_t nexttick) "gt recalc: timer %d next tick 0x%" PRIx64
193
+arm_gt_recalc_disabled(int timer) "gt recalc: timer %d timer disabled"
194
arm_gt_cval_write(int timer, uint64_t value) "gt_cval_write: timer %d value 0x%" PRIx64
195
arm_gt_tval_write(int timer, uint64_t value) "gt_tval_write: timer %d value 0x%" PRIx64
196
arm_gt_ctl_write(int timer, uint64_t value) "gt_ctl_write: timer %d value 0x%" PRIx64
197
-arm_gt_imask_toggle(int timer, int irqstate) "gt_ctl_write: timer %d IMASK toggle, new irqstate %d"
198
+arm_gt_imask_toggle(int timer) "gt_ctl_write: timer %d IMASK toggle"
199
arm_gt_cntvoff_write(uint64_t value) "gt_cntvoff_write: value 0x%" PRIx64
200
+arm_gt_update_irq(int timer, int irqstate) "gt_update_irq: timer %d irqstate %d"
201
202
# kvm.c
203
kvm_arm_fixup_msi_route(uint64_t iova, uint64_t gpa) "MSI iova = 0x%"PRIx64" is translated into 0x%"PRIx64
204
--
205
2.34.1
diff view generated by jsdifflib
Deleted patch
1
From: Richard Henderson <richard.henderson@linaro.org>
2
1
3
A typo, noted in the bug report, resulting in an
4
incorrect write offset.
5
6
Cc: qemu-stable@nongnu.org
7
Fixes: 7390e0e9ab8 ("target/arm: Implement SME LD1, ST1")
8
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1833
9
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
10
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
11
Message-id: 20230818214255.146905-1-richard.henderson@linaro.org
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
14
target/arm/tcg/sme_helper.c | 2 +-
15
1 file changed, 1 insertion(+), 1 deletion(-)
16
17
diff --git a/target/arm/tcg/sme_helper.c b/target/arm/tcg/sme_helper.c
18
index XXXXXXX..XXXXXXX 100644
19
--- a/target/arm/tcg/sme_helper.c
20
+++ b/target/arm/tcg/sme_helper.c
21
@@ -XXX,XX +XXX,XX @@ static inline void HNAME##_host(void *za, intptr_t off, void *host) \
22
{ \
23
uint64_t *ptr = za + off; \
24
HOST(host, ptr[BE]); \
25
- HOST(host + 1, ptr[!BE]); \
26
+ HOST(host + 8, ptr[!BE]); \
27
} \
28
static inline void VNAME##_v_host(void *za, intptr_t off, void *host) \
29
{ \
30
--
31
2.34.1
32
33
diff view generated by jsdifflib
Deleted patch
1
From: Richard Henderson <richard.henderson@linaro.org>
2
1
3
Typo applied byte-wise shift instead of double-word shift.
4
5
Cc: qemu-stable@nongnu.org
6
Fixes: 631e565450c ("target/arm: Create gen_gvec_[us]sra")
7
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1737
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
10
Message-id: 20230821022025.397682-1-richard.henderson@linaro.org
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
13
target/arm/tcg/translate.c | 2 +-
14
1 file changed, 1 insertion(+), 1 deletion(-)
15
16
diff --git a/target/arm/tcg/translate.c b/target/arm/tcg/translate.c
17
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/tcg/translate.c
19
+++ b/target/arm/tcg/translate.c
20
@@ -XXX,XX +XXX,XX @@ void gen_gvec_ssra(unsigned vece, uint32_t rd_ofs, uint32_t rm_ofs,
21
.vece = MO_32 },
22
{ .fni8 = gen_ssra64_i64,
23
.fniv = gen_ssra_vec,
24
- .fno = gen_helper_gvec_ssra_b,
25
+ .fno = gen_helper_gvec_ssra_d,
26
.prefer_i64 = TCG_TARGET_REG_BITS == 64,
27
.opt_opc = vecop_list,
28
.load_dest = true,
29
--
30
2.34.1
31
32
diff view generated by jsdifflib