1 | Only thing for Arm for rc1 is RTH's fix for the KVM SVE probe code. | 1 | Nothing exciting here: two minor bug fixes, some fixes for |
---|---|---|---|
2 | running on a 32-bit host, and a docs tweak. | ||
2 | 3 | ||
4 | thanks | ||
3 | -- PMM | 5 | -- PMM |
4 | 6 | ||
5 | The following changes since commit 4e06b3fc1b5e1ec03f22190eabe56891dc9c2236: | 7 | The following changes since commit 6af9d12c88b9720f209912f6e4b01fefe5906d59: |
6 | 8 | ||
7 | Merge tag 'pull-hex-20220731' of https://github.com/quic/qemu into staging (2022-07-31 21:38:54 -0700) | 9 | Merge tag 'migration-20240331-pull-request' of https://gitlab.com/peterx/qemu into staging (2024-04-01 13:12:40 +0100) |
8 | 10 | ||
9 | are available in the Git repository at: | 11 | are available in the Git repository at: |
10 | 12 | ||
11 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20220801 | 13 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20240402 |
12 | 14 | ||
13 | for you to fetch changes up to 5265d24c981dfdda8d29b44f7e84a514da75eedc: | 15 | for you to fetch changes up to 393770d7a02135e7468018f52da610712f151ec0: |
14 | 16 | ||
15 | target/arm: Move sve probe inside kvm >= 4.15 branch (2022-08-01 16:21:18 +0100) | 17 | raspi4b: Reduce RAM to 1Gb on 32-bit hosts (2024-04-02 10:13:48 +0100) |
16 | 18 | ||
17 | ---------------------------------------------------------------- | 19 | ---------------------------------------------------------------- |
18 | target-arm queue: | 20 | target-arm queue: |
19 | * Fix KVM SVE ID register probe code | 21 | * take HSTR traps of cp15 accesses to EL2, not EL1 |
22 | * docs: sbsa: update specs, add dt note | ||
23 | * hw/intc/arm_gicv3: ICC_HPPIR* return SPURIOUS if int group is disabled | ||
24 | * tests/qtest: Fix STM32L4x5 GPIO test on 32-bit | ||
25 | * raspi4b: Reduce RAM to 1Gb on 32-bit hosts | ||
20 | 26 | ||
21 | ---------------------------------------------------------------- | 27 | ---------------------------------------------------------------- |
22 | Richard Henderson (3): | 28 | Cédric Le Goater (2): |
23 | target/arm: Use kvm_arm_sve_supported in kvm_arm_get_host_cpu_features | 29 | tests/qtest: Fix STM32L4x5 GPIO test on 32-bit |
24 | target/arm: Set KVM_ARM_VCPU_SVE while probing the host | 30 | raspi4b: Reduce RAM to 1Gb on 32-bit hosts |
25 | target/arm: Move sve probe inside kvm >= 4.15 branch | ||
26 | 31 | ||
27 | target/arm/kvm64.c | 45 ++++++++++++++++++++++----------------------- | 32 | Marcin Juszkiewicz (1): |
28 | 1 file changed, 22 insertions(+), 23 deletions(-) | 33 | docs: sbsa: update specs, add dt note |
34 | |||
35 | Peter Maydell (2): | ||
36 | target/arm: take HSTR traps of cp15 accesses to EL2, not EL1 | ||
37 | hw/intc/arm_gicv3: ICC_HPPIR* return SPURIOUS if int group is disabled | ||
38 | |||
39 | docs/system/arm/sbsa.rst | 35 +++++++++++++++++------ | ||
40 | hw/arm/raspi4b.c | 4 +++ | ||
41 | hw/intc/arm_gicv3_cpuif.c | 4 +-- | ||
42 | target/arm/tcg/translate.c | 2 +- | ||
43 | tests/qtest/stm32l4x5_gpio-test.c | 59 +++++++++++++++++++++++---------------- | ||
44 | 5 files changed, 68 insertions(+), 36 deletions(-) | ||
45 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | The HSTR_EL2 register allows the hypervisor to trap AArch32 EL1 and | ||
2 | EL0 accesses to cp15 registers. We incorrectly implemented this so | ||
3 | they trap to EL1 when we detect the need for a HSTR trap at code | ||
4 | generation time. (The check in access_check_cp_reg() which we do at | ||
5 | runtime to catch traps from EL0 is correctly routing them to EL2.) | ||
1 | 6 | ||
7 | Use the correct target EL when generating the code to take the trap. | ||
8 | |||
9 | Cc: qemu-stable@nongnu.org | ||
10 | Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2226 | ||
11 | Fixes: 049edada5e93df ("target/arm: Make HSTR_EL2 traps take priority over UNDEF-at-EL1") | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
14 | Message-id: 20240325133116.2075362-1-peter.maydell@linaro.org | ||
15 | --- | ||
16 | target/arm/tcg/translate.c | 2 +- | ||
17 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
18 | |||
19 | diff --git a/target/arm/tcg/translate.c b/target/arm/tcg/translate.c | ||
20 | index XXXXXXX..XXXXXXX 100644 | ||
21 | --- a/target/arm/tcg/translate.c | ||
22 | +++ b/target/arm/tcg/translate.c | ||
23 | @@ -XXX,XX +XXX,XX @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64, | ||
24 | tcg_gen_andi_i32(t, t, 1u << maskbit); | ||
25 | tcg_gen_brcondi_i32(TCG_COND_EQ, t, 0, over.label); | ||
26 | |||
27 | - gen_exception_insn(s, 0, EXCP_UDEF, syndrome); | ||
28 | + gen_exception_insn_el(s, 0, EXCP_UDEF, syndrome, 2); | ||
29 | /* | ||
30 | * gen_exception_insn() will set is_jmp to DISAS_NORETURN, | ||
31 | * but since we're conditionally branching over it, we want | ||
32 | -- | ||
33 | 2.34.1 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | The test for the IF block indicates no ID registers are exposed, much | 3 | Hardware of sbsa-ref board is nowadays defined by both BSA and SBSA |
4 | less host support for SVE. Move the SVE probe into the ELSE block. | 4 | specifications. Then BBR defines firmware interface. |
5 | 5 | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Added note about DeviceTree data passed from QEMU to firmware. It is |
7 | Message-id: 20220726045828.53697-4-richard.henderson@linaro.org | 7 | very minimal and provides only data we use in firmware. |
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 8 | |
9 | Added NUMA information to list of things reported by DeviceTree. | ||
10 | |||
11 | Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org> | ||
12 | Message-id: 20240328163851.1386176-1-marcin.juszkiewicz@linaro.org | ||
13 | Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 15 | --- |
11 | target/arm/kvm64.c | 22 +++++++++++----------- | 16 | docs/system/arm/sbsa.rst | 35 ++++++++++++++++++++++++++--------- |
12 | 1 file changed, 11 insertions(+), 11 deletions(-) | 17 | 1 file changed, 26 insertions(+), 9 deletions(-) |
13 | 18 | ||
14 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c | 19 | diff --git a/docs/system/arm/sbsa.rst b/docs/system/arm/sbsa.rst |
15 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/kvm64.c | 21 | --- a/docs/system/arm/sbsa.rst |
17 | +++ b/target/arm/kvm64.c | 22 | +++ b/docs/system/arm/sbsa.rst |
18 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) | 23 | @@ -XXX,XX +XXX,XX @@ |
19 | err |= read_sys_reg64(fdarray[2], &ahcf->isar.reset_pmcr_el0, | 24 | Arm Server Base System Architecture Reference board (``sbsa-ref``) |
20 | ARM64_SYS_REG(3, 3, 9, 12, 0)); | 25 | ================================================================== |
21 | } | 26 | |
22 | - } | 27 | -While the ``virt`` board is a generic board platform that doesn't match |
23 | 28 | -any real hardware the ``sbsa-ref`` board intends to look like real | |
24 | - if (sve_supported) { | 29 | -hardware. The `Server Base System Architecture |
25 | - /* | 30 | -<https://developer.arm.com/documentation/den0029/latest>`_ defines a |
26 | - * There is a range of kernels between kernel commit 73433762fcae | 31 | -minimum base line of hardware support and importantly how the firmware |
27 | - * and f81cb2c3ad41 which have a bug where the kernel doesn't expose | 32 | -reports that to any operating system. |
28 | - * SYS_ID_AA64ZFR0_EL1 via the ONE_REG API unless the VM has enabled | 33 | +The ``sbsa-ref`` board intends to look like real hardware (while the ``virt`` |
29 | - * SVE support, which resulted in an error rather than RAZ. | 34 | +board is a generic board platform that doesn't match any real hardware). |
30 | - * So only read the register if we set KVM_ARM_VCPU_SVE above. | 35 | + |
31 | - */ | 36 | +The hardware part is defined by two specifications: |
32 | - err |= read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64zfr0, | 37 | + |
33 | - ARM64_SYS_REG(3, 0, 0, 4, 4)); | 38 | + - `Base System Architecture <https://developer.arm.com/documentation/den0094/>`__ (BSA) |
34 | + if (sve_supported) { | 39 | + - `Server Base System Architecture <https://developer.arm.com/documentation/den0029/>`__ (SBSA) |
35 | + /* | 40 | + |
36 | + * There is a range of kernels between kernel commit 73433762fcae | 41 | +The `Arm Base Boot Requirements <https://developer.arm.com/documentation/den0044/>`__ (BBR) |
37 | + * and f81cb2c3ad41 which have a bug where the kernel doesn't | 42 | +specification defines how the firmware reports that to any operating system. |
38 | + * expose SYS_ID_AA64ZFR0_EL1 via the ONE_REG API unless the VM has | 43 | |
39 | + * enabled SVE support, which resulted in an error rather than RAZ. | 44 | It is intended to be a machine for developing firmware and testing |
40 | + * So only read the register if we set KVM_ARM_VCPU_SVE above. | 45 | standards compliance with operating systems. |
41 | + */ | 46 | @@ -XXX,XX +XXX,XX @@ includes both internal hardware and parts affected by the qemu command line |
42 | + err |= read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64zfr0, | 47 | (i.e. CPUs and memory). As a result it must have a firmware specifically built |
43 | + ARM64_SYS_REG(3, 0, 0, 4, 4)); | 48 | to expect a certain hardware layout (as you would in a real machine). |
44 | + } | 49 | |
45 | } | 50 | +Note |
46 | 51 | +'''' | |
47 | kvm_arm_destroy_scratch_host_vcpu(fdarray); | 52 | + |
53 | +QEMU provides the guest EL3 firmware with minimal information about hardware | ||
54 | +platform using minimalistic devicetree. This is not a Linux devicetree. It is | ||
55 | +not even a firmware devicetree. | ||
56 | + | ||
57 | +It is information passed from QEMU to describe the information a hardware | ||
58 | +platform would have other mechanisms to discover at runtime, that are affected | ||
59 | +by the QEMU command line. | ||
60 | + | ||
61 | +Ultimately this devicetree may be replaced by IPC calls to an emulated SCP. | ||
62 | + | ||
63 | DeviceTree information | ||
64 | '''''''''''''''''''''' | ||
65 | |||
66 | -The devicetree provided by the board model to the firmware is not intended | ||
67 | -to be a complete compliant DT. It currently reports: | ||
68 | +The devicetree reports: | ||
69 | |||
70 | - CPUs | ||
71 | - memory | ||
72 | - platform version | ||
73 | - GIC addresses | ||
74 | + - NUMA node id for CPUs and memory | ||
75 | |||
76 | Platform version | ||
77 | '''''''''''''''' | ||
78 | @@ -XXX,XX +XXX,XX @@ Platform version changes: | ||
79 | GIC ITS information is present in devicetree. | ||
80 | |||
81 | 0.3 | ||
82 | - The USB controller is an XHCI device, not EHCI | ||
83 | + The USB controller is an XHCI device, not EHCI. | ||
48 | -- | 84 | -- |
49 | 2.25.1 | 85 | 2.34.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | If the group of the highest priority pending interrupt is disabled | ||
2 | via ICC_IGRPEN*, the ICC_HPPIR* registers should return | ||
3 | INTID_SPURIOUS, not the interrupt ID. (See the GIC architecture | ||
4 | specification pseudocode functions ICC_HPPIR1_EL1[] and | ||
5 | HighestPriorityPendingInterrupt().) | ||
1 | 6 | ||
7 | Make HPPIR reads honour the group disable, the way we already do | ||
8 | when determining whether to preempt in icc_hppi_can_preempt(). | ||
9 | |||
10 | Cc: qemu-stable@nongnu.org | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
13 | Message-id: 20240328153333.2522667-1-peter.maydell@linaro.org | ||
14 | --- | ||
15 | hw/intc/arm_gicv3_cpuif.c | 4 ++-- | ||
16 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
17 | |||
18 | diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c | ||
19 | index XXXXXXX..XXXXXXX 100644 | ||
20 | --- a/hw/intc/arm_gicv3_cpuif.c | ||
21 | +++ b/hw/intc/arm_gicv3_cpuif.c | ||
22 | @@ -XXX,XX +XXX,XX @@ static uint64_t icc_hppir0_value(GICv3CPUState *cs, CPUARMState *env) | ||
23 | */ | ||
24 | bool irq_is_secure; | ||
25 | |||
26 | - if (cs->hppi.prio == 0xff) { | ||
27 | + if (icc_no_enabled_hppi(cs)) { | ||
28 | return INTID_SPURIOUS; | ||
29 | } | ||
30 | |||
31 | @@ -XXX,XX +XXX,XX @@ static uint64_t icc_hppir1_value(GICv3CPUState *cs, CPUARMState *env) | ||
32 | */ | ||
33 | bool irq_is_secure; | ||
34 | |||
35 | - if (cs->hppi.prio == 0xff) { | ||
36 | + if (icc_no_enabled_hppi(cs)) { | ||
37 | return INTID_SPURIOUS; | ||
38 | } | ||
39 | |||
40 | -- | ||
41 | 2.34.1 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Cédric Le Goater <clg@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | Because we weren't setting this flag, our probe of ID_AA64ZFR0 | 3 | The test mangles the GPIO address and the pin number in the |
4 | was always returning zero. This also obviates the adjustment | 4 | qtest_add_data_func data parameter. Doing so, it assumes that the host |
5 | of ID_AA64PFR0, which had sanitized the SVE field. | 5 | pointer size is always 64-bit, which breaks on 32-bit : |
6 | 6 | ||
7 | The effects of the bug are not visible, because the only thing that | 7 | ../tests/qtest/stm32l4x5_gpio-test.c: In function ‘test_gpio_output_mode’: |
8 | ID_AA64ZFR0 is used for within qemu at present is tcg translation. | 8 | ../tests/qtest/stm32l4x5_gpio-test.c:272:25: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] |
9 | The other tests for SVE within KVM are via ID_AA64PFR0.SVE. | 9 | 272 | unsigned int pin = ((uint64_t)data) & 0xF; |
10 | | ^ | ||
11 | ../tests/qtest/stm32l4x5_gpio-test.c:273:22: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] | ||
12 | 273 | uint32_t gpio = ((uint64_t)data) >> 32; | ||
13 | | ^ | ||
10 | 14 | ||
11 | Reported-by: Zenghui Yu <yuzenghui@huawei.com> | 15 | To fix, improve the mangling of the GPIO address and pin number fields |
12 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 16 | by using GPIO_SIZE so that the resulting value fits in a 32-bit pointer. |
13 | Message-id: 20220726045828.53697-3-richard.henderson@linaro.org | 17 | While at it, include some helpers to hide the details. |
18 | |||
19 | Cc: Arnaud Minier <arnaud.minier@telecom-paris.fr> | ||
20 | Cc: Inès Varhol <ines.varhol@telecom-paris.fr> | ||
21 | Signed-off-by: Cédric Le Goater <clg@redhat.com> | ||
22 | Message-id: 20240329092747.298259-1-clg@redhat.com | ||
14 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 23 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 24 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
16 | --- | 25 | --- |
17 | target/arm/kvm64.c | 27 +++++++++++++-------------- | 26 | tests/qtest/stm32l4x5_gpio-test.c | 59 ++++++++++++++++++------------- |
18 | 1 file changed, 13 insertions(+), 14 deletions(-) | 27 | 1 file changed, 35 insertions(+), 24 deletions(-) |
19 | 28 | ||
20 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c | 29 | diff --git a/tests/qtest/stm32l4x5_gpio-test.c b/tests/qtest/stm32l4x5_gpio-test.c |
21 | index XXXXXXX..XXXXXXX 100644 | 30 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/target/arm/kvm64.c | 31 | --- a/tests/qtest/stm32l4x5_gpio-test.c |
23 | +++ b/target/arm/kvm64.c | 32 | +++ b/tests/qtest/stm32l4x5_gpio-test.c |
24 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) | 33 | @@ -XXX,XX +XXX,XX @@ const uint32_t idr_reset[NUM_GPIOS] = { |
25 | bool sve_supported; | 34 | 0x00000000 |
26 | bool pmu_supported = false; | 35 | }; |
27 | uint64_t features = 0; | 36 | |
28 | - uint64_t t; | 37 | +#define PIN_MASK 0xF |
29 | int err; | 38 | +#define GPIO_ADDR_MASK (~(GPIO_SIZE - 1)) |
30 | |||
31 | /* Old kernels may not know about the PREFERRED_TARGET ioctl: however | ||
32 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) | ||
33 | struct kvm_vcpu_init init = { .target = -1, }; | ||
34 | |||
35 | /* | ||
36 | - * Ask for Pointer Authentication if supported. We can't play the | ||
37 | - * SVE trick of synthesising the ID reg as KVM won't tell us | ||
38 | - * whether we have the architected or IMPDEF version of PAuth, so | ||
39 | - * we have to use the actual ID regs. | ||
40 | + * Ask for SVE if supported, so that we can query ID_AA64ZFR0, | ||
41 | + * which is otherwise RAZ. | ||
42 | + */ | ||
43 | + sve_supported = kvm_arm_sve_supported(); | ||
44 | + if (sve_supported) { | ||
45 | + init.features[0] |= 1 << KVM_ARM_VCPU_SVE; | ||
46 | + } | ||
47 | + | 39 | + |
48 | + /* | 40 | +static inline void *test_data(uint32_t gpio_addr, uint8_t pin) |
49 | + * Ask for Pointer Authentication if supported, so that we get | 41 | +{ |
50 | + * the unsanitized field values for AA64ISAR1_EL1. | 42 | + return (void *)(uintptr_t)((gpio_addr & GPIO_ADDR_MASK) | (pin & PIN_MASK)); |
43 | +} | ||
44 | + | ||
45 | +#define test_gpio_addr(data) ((uintptr_t)(data) & GPIO_ADDR_MASK) | ||
46 | +#define test_pin(data) ((uintptr_t)(data) & PIN_MASK) | ||
47 | + | ||
48 | static uint32_t gpio_readl(unsigned int gpio, unsigned int offset) | ||
49 | { | ||
50 | return readl(gpio + offset); | ||
51 | @@ -XXX,XX +XXX,XX @@ static void test_gpio_output_mode(const void *data) | ||
52 | * Additionally, it checks that values written to ODR | ||
53 | * when not in output mode are stored and not discarded. | ||
51 | */ | 54 | */ |
52 | if (kvm_arm_pauth_supported()) { | 55 | - unsigned int pin = ((uint64_t)data) & 0xF; |
53 | init.features[0] |= (1 << KVM_ARM_VCPU_PTRAUTH_ADDRESS | | 56 | - uint32_t gpio = ((uint64_t)data) >> 32; |
54 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) | 57 | + unsigned int pin = test_pin(data); |
55 | } | 58 | + uint32_t gpio = test_gpio_addr(data); |
56 | } | 59 | unsigned int gpio_id = get_gpio_id(gpio); |
57 | 60 | ||
58 | - sve_supported = kvm_arm_sve_supported(); | 61 | qtest_irq_intercept_in(global_qtest, "/machine/soc/syscfg"); |
59 | - | 62 | @@ -XXX,XX +XXX,XX @@ static void test_gpio_input_mode(const void *data) |
60 | - /* Add feature bits that can't appear until after VCPU init. */ | 63 | * corresponding GPIO line high/low : it should set the |
61 | if (sve_supported) { | 64 | * right bit in IDR and send an irq to syscfg. |
62 | - t = ahcf->isar.id_aa64pfr0; | 65 | */ |
63 | - t = FIELD_DP64(t, ID_AA64PFR0, SVE, 1); | 66 | - unsigned int pin = ((uint64_t)data) & 0xF; |
64 | - ahcf->isar.id_aa64pfr0 = t; | 67 | - uint32_t gpio = ((uint64_t)data) >> 32; |
65 | - | 68 | + unsigned int pin = test_pin(data); |
66 | /* | 69 | + uint32_t gpio = test_gpio_addr(data); |
67 | * There is a range of kernels between kernel commit 73433762fcae | 70 | unsigned int gpio_id = get_gpio_id(gpio); |
68 | * and f81cb2c3ad41 which have a bug where the kernel doesn't expose | 71 | |
69 | * SYS_ID_AA64ZFR0_EL1 via the ONE_REG API unless the VM has enabled | 72 | qtest_irq_intercept_in(global_qtest, "/machine/soc/syscfg"); |
70 | - * SVE support, so we only read it here, rather than together with all | 73 | @@ -XXX,XX +XXX,XX @@ static void test_pull_up_pull_down(const void *data) |
71 | - * the other ID registers earlier. | 74 | * Test that a floating pin with pull-up sets the pin |
72 | + * SVE support, which resulted in an error rather than RAZ. | 75 | * high and vice-versa. |
73 | + * So only read the register if we set KVM_ARM_VCPU_SVE above. | 76 | */ |
74 | */ | 77 | - unsigned int pin = ((uint64_t)data) & 0xF; |
75 | err |= read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64zfr0, | 78 | - uint32_t gpio = ((uint64_t)data) >> 32; |
76 | ARM64_SYS_REG(3, 0, 0, 4, 4)); | 79 | + unsigned int pin = test_pin(data); |
80 | + uint32_t gpio = test_gpio_addr(data); | ||
81 | unsigned int gpio_id = get_gpio_id(gpio); | ||
82 | |||
83 | qtest_irq_intercept_in(global_qtest, "/machine/soc/syscfg"); | ||
84 | @@ -XXX,XX +XXX,XX @@ static void test_push_pull(const void *data) | ||
85 | * disconnects the pin, that the pin can't be set or reset | ||
86 | * externally afterwards. | ||
87 | */ | ||
88 | - unsigned int pin = ((uint64_t)data) & 0xF; | ||
89 | - uint32_t gpio = ((uint64_t)data) >> 32; | ||
90 | + unsigned int pin = test_pin(data); | ||
91 | + uint32_t gpio = test_gpio_addr(data); | ||
92 | uint32_t gpio2 = GPIO_BASE_ADDR + (GPIO_H - gpio); | ||
93 | |||
94 | qtest_irq_intercept_in(global_qtest, "/machine/soc/syscfg"); | ||
95 | @@ -XXX,XX +XXX,XX @@ static void test_open_drain(const void *data) | ||
96 | * However a pin set low externally shouldn't be disconnected, | ||
97 | * and it can be set low externally when in open-drain mode. | ||
98 | */ | ||
99 | - unsigned int pin = ((uint64_t)data) & 0xF; | ||
100 | - uint32_t gpio = ((uint64_t)data) >> 32; | ||
101 | + unsigned int pin = test_pin(data); | ||
102 | + uint32_t gpio = test_gpio_addr(data); | ||
103 | uint32_t gpio2 = GPIO_BASE_ADDR + (GPIO_H - gpio); | ||
104 | |||
105 | qtest_irq_intercept_in(global_qtest, "/machine/soc/syscfg"); | ||
106 | @@ -XXX,XX +XXX,XX @@ static void test_bsrr_brr(const void *data) | ||
107 | * has the desired effect on ODR. | ||
108 | * In BSRR, BSx has priority over BRx. | ||
109 | */ | ||
110 | - unsigned int pin = ((uint64_t)data) & 0xF; | ||
111 | - uint32_t gpio = ((uint64_t)data) >> 32; | ||
112 | + unsigned int pin = test_pin(data); | ||
113 | + uint32_t gpio = test_gpio_addr(data); | ||
114 | |||
115 | gpio_writel(gpio, BSRR, (1 << pin)); | ||
116 | g_assert_cmphex(gpio_readl(gpio, ODR), ==, reset(gpio, ODR) | (1 << pin)); | ||
117 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv) | ||
118 | * is problematic since the pin was already high. | ||
119 | */ | ||
120 | qtest_add_data_func("stm32l4x5/gpio/test_gpioc5_output_mode", | ||
121 | - (void *)((uint64_t)GPIO_C << 32 | 5), | ||
122 | + test_data(GPIO_C, 5), | ||
123 | test_gpio_output_mode); | ||
124 | qtest_add_data_func("stm32l4x5/gpio/test_gpioh3_output_mode", | ||
125 | - (void *)((uint64_t)GPIO_H << 32 | 3), | ||
126 | + test_data(GPIO_H, 3), | ||
127 | test_gpio_output_mode); | ||
128 | qtest_add_data_func("stm32l4x5/gpio/test_gpio_input_mode1", | ||
129 | - (void *)((uint64_t)GPIO_D << 32 | 6), | ||
130 | + test_data(GPIO_D, 6), | ||
131 | test_gpio_input_mode); | ||
132 | qtest_add_data_func("stm32l4x5/gpio/test_gpio_input_mode2", | ||
133 | - (void *)((uint64_t)GPIO_C << 32 | 10), | ||
134 | + test_data(GPIO_C, 10), | ||
135 | test_gpio_input_mode); | ||
136 | qtest_add_data_func("stm32l4x5/gpio/test_gpio_pull_up_pull_down1", | ||
137 | - (void *)((uint64_t)GPIO_B << 32 | 5), | ||
138 | + test_data(GPIO_B, 5), | ||
139 | test_pull_up_pull_down); | ||
140 | qtest_add_data_func("stm32l4x5/gpio/test_gpio_pull_up_pull_down2", | ||
141 | - (void *)((uint64_t)GPIO_F << 32 | 1), | ||
142 | + test_data(GPIO_F, 1), | ||
143 | test_pull_up_pull_down); | ||
144 | qtest_add_data_func("stm32l4x5/gpio/test_gpio_push_pull1", | ||
145 | - (void *)((uint64_t)GPIO_G << 32 | 6), | ||
146 | + test_data(GPIO_G, 6), | ||
147 | test_push_pull); | ||
148 | qtest_add_data_func("stm32l4x5/gpio/test_gpio_push_pull2", | ||
149 | - (void *)((uint64_t)GPIO_H << 32 | 3), | ||
150 | + test_data(GPIO_H, 3), | ||
151 | test_push_pull); | ||
152 | qtest_add_data_func("stm32l4x5/gpio/test_gpio_open_drain1", | ||
153 | - (void *)((uint64_t)GPIO_C << 32 | 4), | ||
154 | + test_data(GPIO_C, 4), | ||
155 | test_open_drain); | ||
156 | qtest_add_data_func("stm32l4x5/gpio/test_gpio_open_drain2", | ||
157 | - (void *)((uint64_t)GPIO_E << 32 | 11), | ||
158 | + test_data(GPIO_E, 11), | ||
159 | test_open_drain); | ||
160 | qtest_add_data_func("stm32l4x5/gpio/test_bsrr_brr1", | ||
161 | - (void *)((uint64_t)GPIO_A << 32 | 12), | ||
162 | + test_data(GPIO_A, 12), | ||
163 | test_bsrr_brr); | ||
164 | qtest_add_data_func("stm32l4x5/gpio/test_bsrr_brr2", | ||
165 | - (void *)((uint64_t)GPIO_D << 32 | 0), | ||
166 | + test_data(GPIO_D, 0), | ||
167 | test_bsrr_brr); | ||
168 | |||
169 | qtest_start("-machine b-l475e-iot01a"); | ||
77 | -- | 170 | -- |
78 | 2.25.1 | 171 | 2.34.1 |
172 | |||
173 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Cédric Le Goater <clg@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | Indication for support for SVE will not depend on whether we | 3 | Change the board revision number and RAM size to 1Gb on 32-bit hosts. |
4 | perform the query on the main kvm_state or the temp vcpu. | 4 | On these systems, RAM has a 2047 MB limit and this breaks the tests. |
5 | 5 | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Fixes: 7785e8ea2204 ("hw/arm: Introduce Raspberry PI 4 machine") |
7 | Message-id: 20220726045828.53697-2-richard.henderson@linaro.org | 7 | Signed-off-by: Cédric Le Goater <clg@redhat.com> |
8 | Message-id: 20240329150155.357043-1-clg@redhat.com | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 11 | --- |
11 | target/arm/kvm64.c | 2 +- | 12 | hw/arm/raspi4b.c | 4 ++++ |
12 | 1 file changed, 1 insertion(+), 1 deletion(-) | 13 | 1 file changed, 4 insertions(+) |
13 | 14 | ||
14 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c | 15 | diff --git a/hw/arm/raspi4b.c b/hw/arm/raspi4b.c |
15 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/kvm64.c | 17 | --- a/hw/arm/raspi4b.c |
17 | +++ b/target/arm/kvm64.c | 18 | +++ b/hw/arm/raspi4b.c |
18 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) | 19 | @@ -XXX,XX +XXX,XX @@ static void raspi4b_machine_class_init(ObjectClass *oc, void *data) |
19 | } | 20 | MachineClass *mc = MACHINE_CLASS(oc); |
20 | } | 21 | RaspiBaseMachineClass *rmc = RASPI_BASE_MACHINE_CLASS(oc); |
21 | 22 | ||
22 | - sve_supported = ioctl(fdarray[0], KVM_CHECK_EXTENSION, KVM_CAP_ARM_SVE) > 0; | 23 | +#if HOST_LONG_BITS == 32 |
23 | + sve_supported = kvm_arm_sve_supported(); | 24 | + rmc->board_rev = 0xa03111; /* Revision 1.1, 1 Gb RAM */ |
24 | 25 | +#else | |
25 | /* Add feature bits that can't appear until after VCPU init. */ | 26 | rmc->board_rev = 0xb03115; /* Revision 1.5, 2 Gb RAM */ |
26 | if (sve_supported) { | 27 | +#endif |
28 | raspi_machine_class_common_init(mc, rmc->board_rev); | ||
29 | mc->init = raspi4b_machine_init; | ||
30 | } | ||
27 | -- | 31 | -- |
28 | 2.25.1 | 32 | 2.34.1 |
33 | |||
34 | diff view generated by jsdifflib |