1 | target-arm queue for rc2. This has 3 Arm related bug fixes, | 1 | Only thing for Arm for rc1 is RTH's fix for the KVM SVE probe code. |
---|---|---|---|
2 | and a couple of non-arm patches which don't have an obviously | ||
3 | better route into the tree. | ||
4 | 2 | ||
5 | thanks | ||
6 | -- PMM | 3 | -- PMM |
7 | 4 | ||
8 | The following changes since commit b9e02bb3f98174209dbd5c96858e65a31723221b: | 5 | The following changes since commit 4e06b3fc1b5e1ec03f22190eabe56891dc9c2236: |
9 | 6 | ||
10 | Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2019-07-19' into staging (2019-07-22 10:11:28 +0100) | 7 | Merge tag 'pull-hex-20220731' of https://github.com/quic/qemu into staging (2022-07-31 21:38:54 -0700) |
11 | 8 | ||
12 | are available in the Git repository at: | 9 | are available in the Git repository at: |
13 | 10 | ||
14 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20190722 | 11 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20220801 |
15 | 12 | ||
16 | for you to fetch changes up to ddb45afbfbc639365d6c934e4e29f6de5e5e2a0e: | 13 | for you to fetch changes up to 5265d24c981dfdda8d29b44f7e84a514da75eedc: |
17 | 14 | ||
18 | contrib/elf2dmp: Build download.o with CURL_CFLAGS (2019-07-22 14:07:39 +0100) | 15 | target/arm: Move sve probe inside kvm >= 4.15 branch (2022-08-01 16:21:18 +0100) |
19 | 16 | ||
20 | ---------------------------------------------------------------- | 17 | ---------------------------------------------------------------- |
21 | target-arm queue: | 18 | target-arm queue: |
22 | * target/arm: Add missing break statement for Hypervisor Trap Exception | 19 | * Fix KVM SVE ID register probe code |
23 | (fixes handling of SMC insn taken to AArch32 Hyp mode via HCR.TSC) | ||
24 | * hw/arm/fsl-imx6ul.c: Remove dead SMP-related code | ||
25 | * target/arm: Limit ID register assertions to TCG | ||
26 | * configure: Clarify URL to source downloads | ||
27 | * contrib/elf2dmp: Build download.o with CURL_CFLAGS | ||
28 | 20 | ||
29 | ---------------------------------------------------------------- | 21 | ---------------------------------------------------------------- |
30 | Peter Maydell (4): | 22 | Richard Henderson (3): |
31 | hw/arm/fsl-imx6ul.c: Remove dead SMP-related code | 23 | target/arm: Use kvm_arm_sve_supported in kvm_arm_get_host_cpu_features |
32 | target/arm: Limit ID register assertions to TCG | 24 | target/arm: Set KVM_ARM_VCPU_SVE while probing the host |
33 | configure: Clarify URL to source downloads | 25 | target/arm: Move sve probe inside kvm >= 4.15 branch |
34 | contrib/elf2dmp: Build download.o with CURL_CFLAGS | ||
35 | 26 | ||
36 | Philippe Mathieu-Daudé (1): | 27 | target/arm/kvm64.c | 45 ++++++++++++++++++++++----------------------- |
37 | target/arm: Add missing break statement for Hypervisor Trap Exception | 28 | 1 file changed, 22 insertions(+), 23 deletions(-) |
38 | |||
39 | configure | 2 +- | ||
40 | Makefile | 1 - | ||
41 | contrib/elf2dmp/Makefile.objs | 3 +++ | ||
42 | include/hw/arm/fsl-imx6ul.h | 2 +- | ||
43 | hw/arm/fsl-imx6ul.c | 62 +++++++++++++------------------------------ | ||
44 | hw/arm/mcimx6ul-evk.c | 2 +- | ||
45 | target/arm/cpu.c | 7 +++-- | ||
46 | target/arm/helper.c | 1 + | ||
47 | 8 files changed, 30 insertions(+), 50 deletions(-) | ||
48 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
2 | 1 | ||
3 | Reported by GCC9 when building with -Wimplicit-fallthrough=2: | ||
4 | |||
5 | target/arm/helper.c: In function ‘arm_cpu_do_interrupt_aarch32_hyp’: | ||
6 | target/arm/helper.c:7958:14: error: this statement may fall through [-Werror=implicit-fallthrough=] | ||
7 | 7958 | addr = 0x14; | ||
8 | | ~~~~~^~~~~~ | ||
9 | target/arm/helper.c:7959:5: note: here | ||
10 | 7959 | default: | ||
11 | | ^~~~~~~ | ||
12 | cc1: all warnings being treated as errors | ||
13 | |||
14 | Fixes: b9bc21ff9f9 | ||
15 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
16 | Reported-by: Stefan Weil <sw@weilnetz.de> | ||
17 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
18 | Message-id: 20190719111451.12406-1-philmd@redhat.com | ||
19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
20 | --- | ||
21 | target/arm/helper.c | 1 + | ||
22 | 1 file changed, 1 insertion(+) | ||
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 void arm_cpu_do_interrupt_aarch32_hyp(CPUState *cs) | ||
29 | break; | ||
30 | case EXCP_HYP_TRAP: | ||
31 | addr = 0x14; | ||
32 | + break; | ||
33 | default: | ||
34 | cpu_abort(cs, "Unhandled exception 0x%x\n", cs->exception_index); | ||
35 | } | ||
36 | -- | ||
37 | 2.20.1 | ||
38 | |||
39 | diff view generated by jsdifflib |
1 | If configure detects that it's being run on a source tree which | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | is missing git modules, it prints an error messages suggesting | ||
3 | that the user downloads a correct source archive from the project | ||
4 | website. However https://www.qemu.org/download/ is a link to a | ||
5 | page with multiple tabs, with the default being the one telling | ||
6 | users how to get binaries from their distro. Clarify the URL | ||
7 | we print to include the #source anchor, so that the browser will | ||
8 | go directly to the source-tarball instructions. | ||
9 | 2 | ||
10 | Reported-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 3 | Indication for support for SVE will not depend on whether we |
11 | Reviewed-by: Thomas Huth <thuth@redhat.com> | 4 | perform the query on the main kvm_state or the temp vcpu. |
12 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 5 | |
13 | Reviewed-by: Stefan Weil <sw@weilnetz.de> | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
14 | Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 7 | Message-id: 20220726045828.53697-2-richard.henderson@linaro.org |
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
16 | Message-id: 20190718131659.20783-1-peter.maydell@linaro.org | ||
17 | Suggested-by: Stefan Weil <sw@weilnetz.de> | ||
18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
19 | --- | 10 | --- |
20 | configure | 2 +- | 11 | target/arm/kvm64.c | 2 +- |
21 | 1 file changed, 1 insertion(+), 1 deletion(-) | 12 | 1 file changed, 1 insertion(+), 1 deletion(-) |
22 | 13 | ||
23 | diff --git a/configure b/configure | 14 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c |
24 | index XXXXXXX..XXXXXXX 100755 | 15 | index XXXXXXX..XXXXXXX 100644 |
25 | --- a/configure | 16 | --- a/target/arm/kvm64.c |
26 | +++ b/configure | 17 | +++ b/target/arm/kvm64.c |
27 | @@ -XXX,XX +XXX,XX @@ else | 18 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) |
28 | echo "to acquire QEMU source archives. Non-GIT builds are only" | 19 | } |
29 | echo "supported with source archives linked from:" | 20 | } |
30 | echo | 21 | |
31 | - echo " https://www.qemu.org/download/" | 22 | - sve_supported = ioctl(fdarray[0], KVM_CHECK_EXTENSION, KVM_CAP_ARM_SVE) > 0; |
32 | + echo " https://www.qemu.org/download/#source" | 23 | + sve_supported = kvm_arm_sve_supported(); |
33 | echo | 24 | |
34 | echo "Developers working with GIT can use scripts/archive-source.sh" | 25 | /* Add feature bits that can't appear until after VCPU init. */ |
35 | echo "if they need to create valid source archives." | 26 | if (sve_supported) { |
36 | -- | 27 | -- |
37 | 2.20.1 | 28 | 2.25.1 |
38 | |||
39 | diff view generated by jsdifflib |
1 | The i.MX6UL always has a single Cortex-A7 CPU (we set FSL_IMX6UL_NUM_CPUS | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | to 1 in line with this). This means that all the code in fsl-imx6ul.c to | ||
3 | handle multiple CPUs is dead code, and Coverity is now complaining that | ||
4 | it is unreachable (CID 1403008, 1403011). | ||
5 | 2 | ||
6 | Remove the unreachable code and the only-executes-once loops, | 3 | Because we weren't setting this flag, our probe of ID_AA64ZFR0 |
7 | and replace the single-entry cpu[] array in the FSLIMX6ULState | 4 | was always returning zero. This also obviates the adjustment |
8 | with a simple cpu member. | 5 | of ID_AA64PFR0, which had sanitized the SVE field. |
9 | 6 | ||
7 | The effects of the bug are not visible, because the only thing that | ||
8 | ID_AA64ZFR0 is used for within qemu at present is tcg translation. | ||
9 | The other tests for SVE within KVM are via ID_AA64PFR0.SVE. | ||
10 | |||
11 | Reported-by: Zenghui Yu <yuzenghui@huawei.com> | ||
12 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
13 | Message-id: 20220726045828.53697-3-richard.henderson@linaro.org | ||
14 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
12 | Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
13 | Message-id: 20190712115030.26895-1-peter.maydell@linaro.org | ||
14 | --- | 16 | --- |
15 | include/hw/arm/fsl-imx6ul.h | 2 +- | 17 | target/arm/kvm64.c | 27 +++++++++++++-------------- |
16 | hw/arm/fsl-imx6ul.c | 62 +++++++++++-------------------------- | 18 | 1 file changed, 13 insertions(+), 14 deletions(-) |
17 | hw/arm/mcimx6ul-evk.c | 2 +- | ||
18 | 3 files changed, 20 insertions(+), 46 deletions(-) | ||
19 | 19 | ||
20 | diff --git a/include/hw/arm/fsl-imx6ul.h b/include/hw/arm/fsl-imx6ul.h | 20 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c |
21 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/include/hw/arm/fsl-imx6ul.h | 22 | --- a/target/arm/kvm64.c |
23 | +++ b/include/hw/arm/fsl-imx6ul.h | 23 | +++ b/target/arm/kvm64.c |
24 | @@ -XXX,XX +XXX,XX @@ typedef struct FslIMX6ULState { | 24 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) |
25 | DeviceState parent_obj; | 25 | bool sve_supported; |
26 | 26 | bool pmu_supported = false; | |
27 | /*< public >*/ | 27 | uint64_t features = 0; |
28 | - ARMCPU cpu[FSL_IMX6UL_NUM_CPUS]; | 28 | - uint64_t t; |
29 | + ARMCPU cpu; | 29 | int err; |
30 | A15MPPrivState a7mpcore; | 30 | |
31 | IMXGPTState gpt[FSL_IMX6UL_NUM_GPTS]; | 31 | /* Old kernels may not know about the PREFERRED_TARGET ioctl: however |
32 | IMXEPITState epit[FSL_IMX6UL_NUM_EPITS]; | 32 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) |
33 | diff --git a/hw/arm/fsl-imx6ul.c b/hw/arm/fsl-imx6ul.c | 33 | struct kvm_vcpu_init init = { .target = -1, }; |
34 | index XXXXXXX..XXXXXXX 100644 | ||
35 | --- a/hw/arm/fsl-imx6ul.c | ||
36 | +++ b/hw/arm/fsl-imx6ul.c | ||
37 | @@ -XXX,XX +XXX,XX @@ | ||
38 | |||
39 | static void fsl_imx6ul_init(Object *obj) | ||
40 | { | ||
41 | - MachineState *ms = MACHINE(qdev_get_machine()); | ||
42 | FslIMX6ULState *s = FSL_IMX6UL(obj); | ||
43 | char name[NAME_SIZE]; | ||
44 | int i; | ||
45 | |||
46 | - for (i = 0; i < MIN(ms->smp.cpus, FSL_IMX6UL_NUM_CPUS); i++) { | ||
47 | - snprintf(name, NAME_SIZE, "cpu%d", i); | ||
48 | - object_initialize_child(obj, name, &s->cpu[i], sizeof(s->cpu[i]), | ||
49 | - "cortex-a7-" TYPE_ARM_CPU, &error_abort, NULL); | ||
50 | - } | ||
51 | + object_initialize_child(obj, "cpu0", &s->cpu, sizeof(s->cpu), | ||
52 | + "cortex-a7-" TYPE_ARM_CPU, &error_abort, NULL); | ||
53 | 34 | ||
54 | /* | 35 | /* |
55 | * A7MPCORE | 36 | - * Ask for Pointer Authentication if supported. We can't play the |
56 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp) | 37 | - * SVE trick of synthesising the ID reg as KVM won't tell us |
57 | MachineState *ms = MACHINE(qdev_get_machine()); | 38 | - * whether we have the architected or IMPDEF version of PAuth, so |
58 | FslIMX6ULState *s = FSL_IMX6UL(dev); | 39 | - * we have to use the actual ID regs. |
59 | int i; | 40 | + * Ask for SVE if supported, so that we can query ID_AA64ZFR0, |
60 | - qemu_irq irq; | 41 | + * which is otherwise RAZ. |
61 | char name[NAME_SIZE]; | 42 | + */ |
62 | - unsigned int smp_cpus = ms->smp.cpus; | 43 | + sve_supported = kvm_arm_sve_supported(); |
63 | + SysBusDevice *sbd; | 44 | + if (sve_supported) { |
64 | + DeviceState *d; | 45 | + init.features[0] |= 1 << KVM_ARM_VCPU_SVE; |
65 | 46 | + } | |
66 | - if (smp_cpus > FSL_IMX6UL_NUM_CPUS) { | 47 | + |
67 | - error_setg(errp, "%s: Only %d CPUs are supported (%d requested)", | 48 | + /* |
68 | - TYPE_FSL_IMX6UL, FSL_IMX6UL_NUM_CPUS, smp_cpus); | 49 | + * Ask for Pointer Authentication if supported, so that we get |
69 | + if (ms->smp.cpus > 1) { | 50 | + * the unsanitized field values for AA64ISAR1_EL1. |
70 | + error_setg(errp, "%s: Only a single CPU is supported (%d requested)", | 51 | */ |
71 | + TYPE_FSL_IMX6UL, ms->smp.cpus); | 52 | if (kvm_arm_pauth_supported()) { |
72 | return; | 53 | init.features[0] |= (1 << KVM_ARM_VCPU_PTRAUTH_ADDRESS | |
54 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) | ||
55 | } | ||
73 | } | 56 | } |
74 | 57 | ||
75 | - for (i = 0; i < smp_cpus; i++) { | 58 | - sve_supported = kvm_arm_sve_supported(); |
76 | - Object *o = OBJECT(&s->cpu[i]); | ||
77 | - | 59 | - |
78 | - object_property_set_int(o, QEMU_PSCI_CONDUIT_SMC, | 60 | - /* Add feature bits that can't appear until after VCPU init. */ |
79 | - "psci-conduit", &error_abort); | 61 | if (sve_supported) { |
62 | - t = ahcf->isar.id_aa64pfr0; | ||
63 | - t = FIELD_DP64(t, ID_AA64PFR0, SVE, 1); | ||
64 | - ahcf->isar.id_aa64pfr0 = t; | ||
80 | - | 65 | - |
81 | - /* On uniprocessor, the CBAR is set to 0 */ | 66 | /* |
82 | - if (smp_cpus > 1) { | 67 | * There is a range of kernels between kernel commit 73433762fcae |
83 | - object_property_set_int(o, FSL_IMX6UL_A7MPCORE_ADDR, | 68 | * and f81cb2c3ad41 which have a bug where the kernel doesn't expose |
84 | - "reset-cbar", &error_abort); | 69 | * SYS_ID_AA64ZFR0_EL1 via the ONE_REG API unless the VM has enabled |
85 | - } | 70 | - * SVE support, so we only read it here, rather than together with all |
86 | - | 71 | - * the other ID registers earlier. |
87 | - if (i) { | 72 | + * SVE support, which resulted in an error rather than RAZ. |
88 | - /* Secondary CPUs start in PSCI powered-down state */ | 73 | + * So only read the register if we set KVM_ARM_VCPU_SVE above. |
89 | - object_property_set_bool(o, true, | 74 | */ |
90 | - "start-powered-off", &error_abort); | 75 | err |= read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64zfr0, |
91 | - } | 76 | ARM64_SYS_REG(3, 0, 0, 4, 4)); |
92 | - | ||
93 | - object_property_set_bool(o, true, "realized", &error_abort); | ||
94 | - } | ||
95 | + object_property_set_int(OBJECT(&s->cpu), QEMU_PSCI_CONDUIT_SMC, | ||
96 | + "psci-conduit", &error_abort); | ||
97 | + object_property_set_bool(OBJECT(&s->cpu), true, | ||
98 | + "realized", &error_abort); | ||
99 | |||
100 | /* | ||
101 | * A7MPCORE | ||
102 | */ | ||
103 | - object_property_set_int(OBJECT(&s->a7mpcore), smp_cpus, "num-cpu", | ||
104 | - &error_abort); | ||
105 | + object_property_set_int(OBJECT(&s->a7mpcore), 1, "num-cpu", &error_abort); | ||
106 | object_property_set_int(OBJECT(&s->a7mpcore), | ||
107 | FSL_IMX6UL_MAX_IRQ + GIC_INTERNAL, | ||
108 | "num-irq", &error_abort); | ||
109 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp) | ||
110 | &error_abort); | ||
111 | sysbus_mmio_map(SYS_BUS_DEVICE(&s->a7mpcore), 0, FSL_IMX6UL_A7MPCORE_ADDR); | ||
112 | |||
113 | - for (i = 0; i < smp_cpus; i++) { | ||
114 | - SysBusDevice *sbd = SYS_BUS_DEVICE(&s->a7mpcore); | ||
115 | - DeviceState *d = DEVICE(qemu_get_cpu(i)); | ||
116 | + sbd = SYS_BUS_DEVICE(&s->a7mpcore); | ||
117 | + d = DEVICE(&s->cpu); | ||
118 | |||
119 | - irq = qdev_get_gpio_in(d, ARM_CPU_IRQ); | ||
120 | - sysbus_connect_irq(sbd, i, irq); | ||
121 | - sysbus_connect_irq(sbd, i + smp_cpus, qdev_get_gpio_in(d, ARM_CPU_FIQ)); | ||
122 | - sysbus_connect_irq(sbd, i + 2 * smp_cpus, | ||
123 | - qdev_get_gpio_in(d, ARM_CPU_VIRQ)); | ||
124 | - sysbus_connect_irq(sbd, i + 3 * smp_cpus, | ||
125 | - qdev_get_gpio_in(d, ARM_CPU_VFIQ)); | ||
126 | - } | ||
127 | + sysbus_connect_irq(sbd, 0, qdev_get_gpio_in(d, ARM_CPU_IRQ)); | ||
128 | + sysbus_connect_irq(sbd, 1, qdev_get_gpio_in(d, ARM_CPU_FIQ)); | ||
129 | + sysbus_connect_irq(sbd, 2, qdev_get_gpio_in(d, ARM_CPU_VIRQ)); | ||
130 | + sysbus_connect_irq(sbd, 3, qdev_get_gpio_in(d, ARM_CPU_VFIQ)); | ||
131 | |||
132 | /* | ||
133 | * A7MPCORE DAP | ||
134 | diff --git a/hw/arm/mcimx6ul-evk.c b/hw/arm/mcimx6ul-evk.c | ||
135 | index XXXXXXX..XXXXXXX 100644 | ||
136 | --- a/hw/arm/mcimx6ul-evk.c | ||
137 | +++ b/hw/arm/mcimx6ul-evk.c | ||
138 | @@ -XXX,XX +XXX,XX @@ static void mcimx6ul_evk_init(MachineState *machine) | ||
139 | } | ||
140 | |||
141 | if (!qtest_enabled()) { | ||
142 | - arm_load_kernel(&s->soc.cpu[0], &boot_info); | ||
143 | + arm_load_kernel(&s->soc.cpu, &boot_info); | ||
144 | } | ||
145 | } | ||
146 | |||
147 | -- | 77 | -- |
148 | 2.20.1 | 78 | 2.25.1 |
149 | |||
150 | diff view generated by jsdifflib |
1 | In arm_cpu_realizefn() we make several assertions about the values of | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | guest ID registers: | ||
3 | * if the CPU provides AArch32 v7VE or better it must advertise the | ||
4 | ARM_DIV feature | ||
5 | * if the CPU provides AArch32 A-profile v6 or better it must | ||
6 | advertise the Jazelle feature | ||
7 | 2 | ||
8 | These are essentially consistency checks that our ID register | 3 | The test for the IF block indicates no ID registers are exposed, much |
9 | specifications in cpu.c didn't accidentally miss out a feature, | 4 | less host support for SVE. Move the SVE probe into the ELSE block. |
10 | because increasingly the TCG emulation gates features on the values | ||
11 | in ID registers rather than using old-style checks of ARM_FEATURE_FOO | ||
12 | bits. | ||
13 | 5 | ||
14 | Unfortunately, these asserts can cause problems if we're running KVM, | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
15 | because in that case we don't control the values of the ID registers | 7 | Message-id: 20220726045828.53697-4-richard.henderson@linaro.org |
16 | -- we read them from the host kernel. In particular, if the host | 8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
17 | kernel is older than 4.15 then it doesn't expose the ID registers via | ||
18 | the KVM_GET_ONE_REG ioctl, and we set up dummy values for some | ||
19 | registers and leave the rest at zero. (See the comment in | ||
20 | target/arm/kvm64.c kvm_arm_get_host_cpu_features().) This set of | ||
21 | dummy values is not sufficient to pass our assertions, and so on | ||
22 | those kernels running an AArch32 guest on AArch64 will assert. | ||
23 | |||
24 | We could provide a more sophisticated set of dummy ID registers in | ||
25 | this case, but that still leaves the possibility of a host CPU which | ||
26 | reports bogus ID register values that would cause us to assert. It's | ||
27 | more robust to only do these ID register checks if we're using TCG, | ||
28 | as that is the only case where this is truly a QEMU code bug. | ||
29 | |||
30 | Reported-by: Laszlo Ersek <lersek@redhat.com> | ||
31 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
32 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
33 | Tested-by: Laszlo Ersek <lersek@redhat.com> | ||
34 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
35 | Message-id: 20190718125928.20147-1-peter.maydell@linaro.org | ||
36 | Fixes: https://bugs.launchpad.net/qemu/+bug/1830864 | ||
37 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
38 | --- | 10 | --- |
39 | target/arm/cpu.c | 7 +++++-- | 11 | target/arm/kvm64.c | 22 +++++++++++----------- |
40 | 1 file changed, 5 insertions(+), 2 deletions(-) | 12 | 1 file changed, 11 insertions(+), 11 deletions(-) |
41 | 13 | ||
42 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | 14 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c |
43 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
44 | --- a/target/arm/cpu.c | 16 | --- a/target/arm/kvm64.c |
45 | +++ b/target/arm/cpu.c | 17 | +++ b/target/arm/kvm64.c |
46 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) | 18 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) |
47 | * There exist AArch64 cpus without AArch32 support. When KVM | 19 | err |= read_sys_reg64(fdarray[2], &ahcf->isar.reset_pmcr_el0, |
48 | * queries ID_ISAR0_EL1 on such a host, the value is UNKNOWN. | 20 | ARM64_SYS_REG(3, 3, 9, 12, 0)); |
49 | * Similarly, we cannot check ID_AA64PFR0 without AArch64 support. | 21 | } |
50 | + * As a general principle, we also do not make ID register | 22 | - } |
51 | + * consistency checks anywhere unless using TCG, because only | 23 | |
52 | + * for TCG would a consistency-check failure be a QEMU bug. | 24 | - if (sve_supported) { |
53 | */ | 25 | - /* |
54 | if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64)) { | 26 | - * There is a range of kernels between kernel commit 73433762fcae |
55 | no_aa32 = !cpu_isar_feature(aa64_aa32, cpu); | 27 | - * and f81cb2c3ad41 which have a bug where the kernel doesn't expose |
56 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) | 28 | - * SYS_ID_AA64ZFR0_EL1 via the ONE_REG API unless the VM has enabled |
57 | * Presence of EL2 itself is ARM_FEATURE_EL2, and of the | 29 | - * SVE support, which resulted in an error rather than RAZ. |
58 | * Security Extensions is ARM_FEATURE_EL3. | 30 | - * So only read the register if we set KVM_ARM_VCPU_SVE above. |
59 | */ | 31 | - */ |
60 | - assert(no_aa32 || cpu_isar_feature(arm_div, cpu)); | 32 | - err |= read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64zfr0, |
61 | + assert(!tcg_enabled() || no_aa32 || cpu_isar_feature(arm_div, cpu)); | 33 | - ARM64_SYS_REG(3, 0, 0, 4, 4)); |
62 | set_feature(env, ARM_FEATURE_LPAE); | 34 | + if (sve_supported) { |
63 | set_feature(env, ARM_FEATURE_V7); | 35 | + /* |
36 | + * There is a range of kernels between kernel commit 73433762fcae | ||
37 | + * and f81cb2c3ad41 which have a bug where the kernel doesn't | ||
38 | + * expose SYS_ID_AA64ZFR0_EL1 via the ONE_REG API unless the VM has | ||
39 | + * enabled SVE support, which resulted in an error rather than RAZ. | ||
40 | + * So only read the register if we set KVM_ARM_VCPU_SVE above. | ||
41 | + */ | ||
42 | + err |= read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64zfr0, | ||
43 | + ARM64_SYS_REG(3, 0, 0, 4, 4)); | ||
44 | + } | ||
64 | } | 45 | } |
65 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) | 46 | |
66 | if (arm_feature(env, ARM_FEATURE_V6)) { | 47 | kvm_arm_destroy_scratch_host_vcpu(fdarray); |
67 | set_feature(env, ARM_FEATURE_V5); | ||
68 | if (!arm_feature(env, ARM_FEATURE_M)) { | ||
69 | - assert(no_aa32 || cpu_isar_feature(jazelle, cpu)); | ||
70 | + assert(!tcg_enabled() || no_aa32 || cpu_isar_feature(jazelle, cpu)); | ||
71 | set_feature(env, ARM_FEATURE_AUXCR); | ||
72 | } | ||
73 | } | ||
74 | -- | 48 | -- |
75 | 2.20.1 | 49 | 2.25.1 |
76 | |||
77 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | contrib/elf2dmp has a source file which uses curl/curl.h; | ||
2 | although we link the final executable with CURL_LIBS, we | ||
3 | forgot to build this source file with CURL_CFLAGS, so if | ||
4 | the curl header is in a place that's not already on the | ||
5 | system include path then it will fail to build. | ||
6 | 1 | ||
7 | Add a line specifying the cflags needed for download.o; | ||
8 | while we are here, bring the specification of the libs | ||
9 | into line with this, since using a per-object variable | ||
10 | setting is preferred over adding them to the final | ||
11 | executable link line. | ||
12 | |||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> | ||
15 | Message-id: 20190719100955.17180-1-peter.maydell@linaro.org | ||
16 | --- | ||
17 | Makefile | 1 - | ||
18 | contrib/elf2dmp/Makefile.objs | 3 +++ | ||
19 | 2 files changed, 3 insertions(+), 1 deletion(-) | ||
20 | |||
21 | diff --git a/Makefile b/Makefile | ||
22 | index XXXXXXX..XXXXXXX 100644 | ||
23 | --- a/Makefile | ||
24 | +++ b/Makefile | ||
25 | @@ -XXX,XX +XXX,XX @@ ifneq ($(EXESUF),) | ||
26 | qemu-ga: qemu-ga$(EXESUF) $(QGA_VSS_PROVIDER) $(QEMU_GA_MSI) | ||
27 | endif | ||
28 | |||
29 | -elf2dmp$(EXESUF): LIBS += $(CURL_LIBS) | ||
30 | elf2dmp$(EXESUF): $(elf2dmp-obj-y) | ||
31 | $(call LINK, $^) | ||
32 | |||
33 | diff --git a/contrib/elf2dmp/Makefile.objs b/contrib/elf2dmp/Makefile.objs | ||
34 | index XXXXXXX..XXXXXXX 100644 | ||
35 | --- a/contrib/elf2dmp/Makefile.objs | ||
36 | +++ b/contrib/elf2dmp/Makefile.objs | ||
37 | @@ -1 +1,4 @@ | ||
38 | elf2dmp-obj-y = main.o addrspace.o download.o pdb.o qemu_elf.o | ||
39 | + | ||
40 | +download.o-cflags := $(CURL_CFLAGS) | ||
41 | +download.o-libs := $(CURL_LIBS) | ||
42 | -- | ||
43 | 2.20.1 | ||
44 | |||
45 | diff view generated by jsdifflib |