1 | Just some bugfixes this time around. | 1 | Only thing for Arm for rc1 is RTH's fix for the KVM SVE probe code. |
---|---|---|---|
2 | 2 | ||
3 | -- PMM | 3 | -- PMM |
4 | 4 | ||
5 | The following changes since commit 4215d3413272ad6d1c6c9d0234450b602e46a74c: | 5 | The following changes since commit 4e06b3fc1b5e1ec03f22190eabe56891dc9c2236: |
6 | 6 | ||
7 | Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-5.1-20200727' into staging (2020-07-27 09:33:04 +0100) | 7 | Merge tag 'pull-hex-20220731' of https://github.com/quic/qemu into staging (2022-07-31 21:38:54 -0700) |
8 | 8 | ||
9 | are available in the Git repository at: | 9 | are available in the Git repository at: |
10 | 10 | ||
11 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20200727 | 11 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20220801 |
12 | 12 | ||
13 | for you to fetch changes up to d4f6dda182e19afa75706936805e18397cb95f07: | 13 | for you to fetch changes up to 5265d24c981dfdda8d29b44f7e84a514da75eedc: |
14 | 14 | ||
15 | target/arm: Improve IMPDEF algorithm for IRG (2020-07-27 16:12:11 +0100) | 15 | target/arm: Move sve probe inside kvm >= 4.15 branch (2022-08-01 16:21:18 +0100) |
16 | 16 | ||
17 | ---------------------------------------------------------------- | 17 | ---------------------------------------------------------------- |
18 | target-arm queue: | 18 | target-arm queue: |
19 | * ACPI: Assert that we don't run out of the preallocated memory | 19 | * Fix KVM SVE ID register probe code |
20 | * hw/misc/aspeed_sdmc: Fix incorrect memory size | ||
21 | * target/arm: Always pass cacheattr in S1_ptw_translate | ||
22 | * docs/system/arm/virt: Document 'mte' machine option | ||
23 | * hw/arm/boot: Fix PAUTH, MTE for EL3 direct kernel boot | ||
24 | * target/arm: Improve IMPDEF algorithm for IRG | ||
25 | 20 | ||
26 | ---------------------------------------------------------------- | 21 | ---------------------------------------------------------------- |
27 | Dongjiu Geng (1): | 22 | Richard Henderson (3): |
28 | ACPI: Assert that we don't run out of the preallocated memory | 23 | target/arm: Use kvm_arm_sve_supported in kvm_arm_get_host_cpu_features |
24 | target/arm: Set KVM_ARM_VCPU_SVE while probing the host | ||
25 | target/arm: Move sve probe inside kvm >= 4.15 branch | ||
29 | 26 | ||
30 | Peter Maydell (1): | 27 | target/arm/kvm64.c | 45 ++++++++++++++++++++++----------------------- |
31 | docs/system/arm/virt: Document 'mte' machine option | 28 | 1 file changed, 22 insertions(+), 23 deletions(-) |
32 | |||
33 | Philippe Mathieu-Daudé (1): | ||
34 | hw/misc/aspeed_sdmc: Fix incorrect memory size | ||
35 | |||
36 | Richard Henderson (4): | ||
37 | target/arm: Always pass cacheattr in S1_ptw_translate | ||
38 | hw/arm/boot: Fix PAUTH for EL3 direct kernel boot | ||
39 | hw/arm/boot: Fix MTE for EL3 direct kernel boot | ||
40 | target/arm: Improve IMPDEF algorithm for IRG | ||
41 | |||
42 | docs/system/arm/virt.rst | 4 ++++ | ||
43 | hw/acpi/ghes.c | 12 ++++-------- | ||
44 | hw/arm/boot.c | 6 ++++++ | ||
45 | hw/misc/aspeed_sdmc.c | 7 ++++--- | ||
46 | target/arm/helper.c | 19 ++++++------------- | ||
47 | target/arm/mte_helper.c | 37 ++++++++++++++++++++++++++++++------- | ||
48 | 6 files changed, 54 insertions(+), 31 deletions(-) | ||
49 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Dongjiu Geng <gengdongjiu@huawei.com> | ||
2 | 1 | ||
3 | data_length is a constant value, so we use assert instead of | ||
4 | condition check. | ||
5 | |||
6 | Signed-off-by: Dongjiu Geng <gengdongjiu@huawei.com> | ||
7 | Message-id: 20200622113146.33421-1-gengdongjiu@huawei.com | ||
8 | Reviewed-by: Michael S. Tsirkin <mst@redhat.com> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | hw/acpi/ghes.c | 12 ++++-------- | ||
12 | 1 file changed, 4 insertions(+), 8 deletions(-) | ||
13 | |||
14 | diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/hw/acpi/ghes.c | ||
17 | +++ b/hw/acpi/ghes.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static int acpi_ghes_record_mem_error(uint64_t error_block_address, | ||
19 | |||
20 | /* This is the length if adding a new generic error data entry*/ | ||
21 | data_length = ACPI_GHES_DATA_LENGTH + ACPI_GHES_MEM_CPER_LENGTH; | ||
22 | - | ||
23 | /* | ||
24 | - * Check whether it will run out of the preallocated memory if adding a new | ||
25 | - * generic error data entry | ||
26 | + * It should not run out of the preallocated memory if adding a new generic | ||
27 | + * error data entry | ||
28 | */ | ||
29 | - if ((data_length + ACPI_GHES_GESB_SIZE) > ACPI_GHES_MAX_RAW_DATA_LENGTH) { | ||
30 | - error_report("Not enough memory to record new CPER!!!"); | ||
31 | - g_array_free(block, true); | ||
32 | - return -1; | ||
33 | - } | ||
34 | + assert((data_length + ACPI_GHES_GESB_SIZE) <= | ||
35 | + ACPI_GHES_MAX_RAW_DATA_LENGTH); | ||
36 | |||
37 | /* Build the new generic error status block header */ | ||
38 | acpi_ghes_generic_error_status(block, ACPI_GEBS_UNCORRECTABLE, | ||
39 | -- | ||
40 | 2.20.1 | ||
41 | |||
42 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
2 | 1 | ||
3 | The SDRAM Memory Controller has a 32-bit address bus, thus | ||
4 | supports up to 4 GiB of DRAM. There is a signed to unsigned | ||
5 | conversion error with the AST2600 maximum memory size: | ||
6 | |||
7 | (uint64_t)(2048 << 20) = (uint64_t)(-2147483648) | ||
8 | = 0xffffffff40000000 | ||
9 | = 16 EiB - 2 GiB | ||
10 | |||
11 | Fix by using the IEC suffixes which are usually safer, and add | ||
12 | an assertion check to verify the memory is valid. This would have | ||
13 | caught this bug: | ||
14 | |||
15 | $ qemu-system-arm -M ast2600-evb | ||
16 | qemu-system-arm: hw/misc/aspeed_sdmc.c:258: aspeed_sdmc_realize: Assertion `asc->max_ram_size < 4 * GiB' failed. | ||
17 | Aborted (core dumped) | ||
18 | |||
19 | Fixes: 1550d72679 ("aspeed/sdmc: Add AST2600 support") | ||
20 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | ||
21 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
22 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
23 | --- | ||
24 | hw/misc/aspeed_sdmc.c | 7 ++++--- | ||
25 | 1 file changed, 4 insertions(+), 3 deletions(-) | ||
26 | |||
27 | diff --git a/hw/misc/aspeed_sdmc.c b/hw/misc/aspeed_sdmc.c | ||
28 | index XXXXXXX..XXXXXXX 100644 | ||
29 | --- a/hw/misc/aspeed_sdmc.c | ||
30 | +++ b/hw/misc/aspeed_sdmc.c | ||
31 | @@ -XXX,XX +XXX,XX @@ static void aspeed_sdmc_realize(DeviceState *dev, Error **errp) | ||
32 | AspeedSDMCState *s = ASPEED_SDMC(dev); | ||
33 | AspeedSDMCClass *asc = ASPEED_SDMC_GET_CLASS(s); | ||
34 | |||
35 | + assert(asc->max_ram_size < 4 * GiB); /* 32-bit address bus */ | ||
36 | s->max_ram_size = asc->max_ram_size; | ||
37 | |||
38 | memory_region_init_io(&s->iomem, OBJECT(s), &aspeed_sdmc_ops, s, | ||
39 | @@ -XXX,XX +XXX,XX @@ static void aspeed_2400_sdmc_class_init(ObjectClass *klass, void *data) | ||
40 | AspeedSDMCClass *asc = ASPEED_SDMC_CLASS(klass); | ||
41 | |||
42 | dc->desc = "ASPEED 2400 SDRAM Memory Controller"; | ||
43 | - asc->max_ram_size = 512 << 20; | ||
44 | + asc->max_ram_size = 512 * MiB; | ||
45 | asc->compute_conf = aspeed_2400_sdmc_compute_conf; | ||
46 | asc->write = aspeed_2400_sdmc_write; | ||
47 | asc->valid_ram_sizes = aspeed_2400_ram_sizes; | ||
48 | @@ -XXX,XX +XXX,XX @@ static void aspeed_2500_sdmc_class_init(ObjectClass *klass, void *data) | ||
49 | AspeedSDMCClass *asc = ASPEED_SDMC_CLASS(klass); | ||
50 | |||
51 | dc->desc = "ASPEED 2500 SDRAM Memory Controller"; | ||
52 | - asc->max_ram_size = 1024 << 20; | ||
53 | + asc->max_ram_size = 1 * GiB; | ||
54 | asc->compute_conf = aspeed_2500_sdmc_compute_conf; | ||
55 | asc->write = aspeed_2500_sdmc_write; | ||
56 | asc->valid_ram_sizes = aspeed_2500_ram_sizes; | ||
57 | @@ -XXX,XX +XXX,XX @@ static void aspeed_2600_sdmc_class_init(ObjectClass *klass, void *data) | ||
58 | AspeedSDMCClass *asc = ASPEED_SDMC_CLASS(klass); | ||
59 | |||
60 | dc->desc = "ASPEED 2600 SDRAM Memory Controller"; | ||
61 | - asc->max_ram_size = 2048 << 20; | ||
62 | + asc->max_ram_size = 2 * GiB; | ||
63 | asc->compute_conf = aspeed_2600_sdmc_compute_conf; | ||
64 | asc->write = aspeed_2600_sdmc_write; | ||
65 | asc->valid_ram_sizes = aspeed_2600_ram_sizes; | ||
66 | -- | ||
67 | 2.20.1 | ||
68 | |||
69 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
2 | 1 | ||
3 | When we changed the interface of get_phys_addr_lpae to require | ||
4 | the cacheattr parameter, this spot was missed. The compiler is | ||
5 | unable to detect the use of NULL vs the nonnull attribute here. | ||
6 | |||
7 | Fixes: 7e98e21c098 | ||
8 | Reported-by: Jan Kiszka <jan.kiszka@siemens.com> | ||
9 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | Tested-by: Jan Kiszka <jan.kiskza@siemens.com> | ||
11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | --- | ||
14 | target/arm/helper.c | 19 ++++++------------- | ||
15 | 1 file changed, 6 insertions(+), 13 deletions(-) | ||
16 | |||
17 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/target/arm/helper.c | ||
20 | +++ b/target/arm/helper.c | ||
21 | @@ -XXX,XX +XXX,XX @@ static hwaddr S1_ptw_translate(CPUARMState *env, ARMMMUIdx mmu_idx, | ||
22 | int s2prot; | ||
23 | int ret; | ||
24 | ARMCacheAttrs cacheattrs = {}; | ||
25 | - ARMCacheAttrs *pcacheattrs = NULL; | ||
26 | - | ||
27 | - if (env->cp15.hcr_el2 & HCR_PTW) { | ||
28 | - /* | ||
29 | - * PTW means we must fault if this S1 walk touches S2 Device | ||
30 | - * memory; otherwise we don't care about the attributes and can | ||
31 | - * save the S2 translation the effort of computing them. | ||
32 | - */ | ||
33 | - pcacheattrs = &cacheattrs; | ||
34 | - } | ||
35 | |||
36 | ret = get_phys_addr_lpae(env, addr, MMU_DATA_LOAD, ARMMMUIdx_Stage2, | ||
37 | false, | ||
38 | &s2pa, &txattrs, &s2prot, &s2size, fi, | ||
39 | - pcacheattrs); | ||
40 | + &cacheattrs); | ||
41 | if (ret) { | ||
42 | assert(fi->type != ARMFault_None); | ||
43 | fi->s2addr = addr; | ||
44 | @@ -XXX,XX +XXX,XX @@ static hwaddr S1_ptw_translate(CPUARMState *env, ARMMMUIdx mmu_idx, | ||
45 | fi->s1ptw = true; | ||
46 | return ~0; | ||
47 | } | ||
48 | - if (pcacheattrs && (pcacheattrs->attrs & 0xf0) == 0) { | ||
49 | - /* Access was to Device memory: generate Permission fault */ | ||
50 | + if ((env->cp15.hcr_el2 & HCR_PTW) && (cacheattrs.attrs & 0xf0) == 0) { | ||
51 | + /* | ||
52 | + * PTW set and S1 walk touched S2 Device memory: | ||
53 | + * generate Permission fault. | ||
54 | + */ | ||
55 | fi->type = ARMFault_Permission; | ||
56 | fi->s2addr = addr; | ||
57 | fi->stage2 = true; | ||
58 | -- | ||
59 | 2.20.1 | ||
60 | |||
61 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Commit 6a0b7505f1fd6769c which added documentation of the virt board | ||
2 | crossed in the post with commit 6f4e1405b91da0d0 which added a new | ||
3 | 'mte' machine option. Update the docs to include the new option. | ||
4 | 1 | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | --- | ||
9 | docs/system/arm/virt.rst | 4 ++++ | ||
10 | 1 file changed, 4 insertions(+) | ||
11 | |||
12 | diff --git a/docs/system/arm/virt.rst b/docs/system/arm/virt.rst | ||
13 | index XXXXXXX..XXXXXXX 100644 | ||
14 | --- a/docs/system/arm/virt.rst | ||
15 | +++ b/docs/system/arm/virt.rst | ||
16 | @@ -XXX,XX +XXX,XX @@ virtualization | ||
17 | Set ``on``/``off`` to enable/disable emulating a guest CPU which implements the | ||
18 | Arm Virtualization Extensions. The default is ``off``. | ||
19 | |||
20 | +mte | ||
21 | + Set ``on``/``off`` to enable/disable emulating a guest CPU which implements the | ||
22 | + Arm Memory Tagging Extensions. The default is ``off``. | ||
23 | + | ||
24 | highmem | ||
25 | Set ``on``/``off`` to enable/disable placing devices and RAM in physical | ||
26 | address space above 32 bits. The default is ``on`` for machine types | ||
27 | -- | ||
28 | 2.20.1 | ||
29 | |||
30 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | When booting an EL3 cpu with -kernel, we set up EL3 and then | 3 | Indication for support for SVE will not depend on whether we |
4 | drop down to EL2. We need to enable access to v8.5-MemTag | 4 | perform the query on the main kvm_state or the temp vcpu. |
5 | tag allocation at EL3 before doing so. | ||
6 | 5 | ||
7 | Reported-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Message-id: 20200724163853.504655-3-richard.henderson@linaro.org | 7 | Message-id: 20220726045828.53697-2-richard.henderson@linaro.org |
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 10 | --- |
13 | hw/arm/boot.c | 3 +++ | 11 | target/arm/kvm64.c | 2 +- |
14 | 1 file changed, 3 insertions(+) | 12 | 1 file changed, 1 insertion(+), 1 deletion(-) |
15 | 13 | ||
16 | diff --git a/hw/arm/boot.c b/hw/arm/boot.c | 14 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c |
17 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/hw/arm/boot.c | 16 | --- a/target/arm/kvm64.c |
19 | +++ b/hw/arm/boot.c | 17 | +++ b/target/arm/kvm64.c |
20 | @@ -XXX,XX +XXX,XX @@ static void do_cpu_reset(void *opaque) | 18 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) |
21 | if (cpu_isar_feature(aa64_pauth, cpu)) { | 19 | } |
22 | env->cp15.scr_el3 |= SCR_API | SCR_APK; | 20 | } |
23 | } | 21 | |
24 | + if (cpu_isar_feature(aa64_mte, cpu)) { | 22 | - sve_supported = ioctl(fdarray[0], KVM_CHECK_EXTENSION, KVM_CAP_ARM_SVE) > 0; |
25 | + env->cp15.scr_el3 |= SCR_ATA; | 23 | + sve_supported = kvm_arm_sve_supported(); |
26 | + } | 24 | |
27 | /* AArch64 kernels never boot in secure mode */ | 25 | /* Add feature bits that can't appear until after VCPU init. */ |
28 | assert(!info->secure_boot); | 26 | if (sve_supported) { |
29 | /* This hook is only supported for AArch32 currently: | ||
30 | -- | 27 | -- |
31 | 2.20.1 | 28 | 2.25.1 |
32 | |||
33 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | When GCR_EL1.RRND==1, the choosing of the random value is IMPDEF, | 3 | Because we weren't setting this flag, our probe of ID_AA64ZFR0 |
4 | and the kernel is not expected to have set RGSR_EL1. Force a | 4 | was always returning zero. This also obviates the adjustment |
5 | non-zero value into SEED, so that we do not continually return | 5 | of ID_AA64PFR0, which had sanitized the SVE field. |
6 | the same tag. | ||
7 | 6 | ||
8 | Reported-by: Vincenzo Frascino <vincenzo.frascino@arm.com> | 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> | ||
9 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 12 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
10 | Message-id: 20200724163853.504655-4-richard.henderson@linaro.org | 13 | Message-id: 20220726045828.53697-3-richard.henderson@linaro.org |
11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 14 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | --- | 16 | --- |
14 | target/arm/mte_helper.c | 37 ++++++++++++++++++++++++++++++------- | 17 | target/arm/kvm64.c | 27 +++++++++++++-------------- |
15 | 1 file changed, 30 insertions(+), 7 deletions(-) | 18 | 1 file changed, 13 insertions(+), 14 deletions(-) |
16 | 19 | ||
17 | diff --git a/target/arm/mte_helper.c b/target/arm/mte_helper.c | 20 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c |
18 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/target/arm/mte_helper.c | 22 | --- a/target/arm/kvm64.c |
20 | +++ b/target/arm/mte_helper.c | 23 | +++ b/target/arm/kvm64.c |
21 | @@ -XXX,XX +XXX,XX @@ | 24 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) |
22 | #include "exec/ram_addr.h" | 25 | bool sve_supported; |
23 | #include "exec/cpu_ldst.h" | 26 | bool pmu_supported = false; |
24 | #include "exec/helper-proto.h" | 27 | uint64_t features = 0; |
25 | +#include "qapi/error.h" | 28 | - uint64_t t; |
26 | +#include "qemu/guest-random.h" | 29 | int err; |
27 | 30 | ||
28 | 31 | /* Old kernels may not know about the PREFERRED_TARGET ioctl: however | |
29 | static int choose_nonexcluded_tag(int tag, int offset, uint16_t exclude) | 32 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) |
30 | @@ -XXX,XX +XXX,XX @@ static uint8_t *allocation_tag_mem(CPUARMState *env, int ptr_mmu_idx, | 33 | struct kvm_vcpu_init init = { .target = -1, }; |
31 | 34 | ||
32 | uint64_t HELPER(irg)(CPUARMState *env, uint64_t rn, uint64_t rm) | 35 | /* |
33 | { | 36 | - * Ask for Pointer Authentication if supported. We can't play the |
34 | - int rtag; | 37 | - * SVE trick of synthesising the ID reg as KVM won't tell us |
35 | - | 38 | - * whether we have the architected or IMPDEF version of PAuth, so |
36 | - /* | 39 | - * we have to use the actual ID regs. |
37 | - * Our IMPDEF choice for GCR_EL1.RRND==1 is to behave as if | 40 | + * Ask for SVE if supported, so that we can query ID_AA64ZFR0, |
38 | - * GCR_EL1.RRND==0, always producing deterministic results. | 41 | + * which is otherwise RAZ. |
39 | - */ | 42 | + */ |
40 | uint16_t exclude = extract32(rm | env->cp15.gcr_el1, 0, 16); | 43 | + sve_supported = kvm_arm_sve_supported(); |
41 | + int rrnd = extract32(env->cp15.gcr_el1, 16, 1); | 44 | + if (sve_supported) { |
42 | int start = extract32(env->cp15.rgsr_el1, 0, 4); | 45 | + init.features[0] |= 1 << KVM_ARM_VCPU_SVE; |
43 | int seed = extract32(env->cp15.rgsr_el1, 8, 16); | 46 | + } |
44 | - int offset, i; | ||
45 | + int offset, i, rtag; | ||
46 | + | 47 | + |
47 | + /* | 48 | + /* |
48 | + * Our IMPDEF choice for GCR_EL1.RRND==1 is to continue to use the | 49 | + * Ask for Pointer Authentication if supported, so that we get |
49 | + * deterministic algorithm. Except that with RRND==1 the kernel is | 50 | + * the unsanitized field values for AA64ISAR1_EL1. |
50 | + * not required to have set RGSR_EL1.SEED != 0, which is required for | 51 | */ |
51 | + * the deterministic algorithm to function. So we force a non-zero | 52 | if (kvm_arm_pauth_supported()) { |
52 | + * SEED for that case. | 53 | init.features[0] |= (1 << KVM_ARM_VCPU_PTRAUTH_ADDRESS | |
53 | + */ | 54 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) |
54 | + if (unlikely(seed == 0) && rrnd) { | 55 | } |
55 | + do { | 56 | } |
56 | + Error *err = NULL; | 57 | |
57 | + uint16_t two; | 58 | - sve_supported = kvm_arm_sve_supported(); |
58 | + | 59 | - |
59 | + if (qemu_guest_getrandom(&two, sizeof(two), &err) < 0) { | 60 | - /* Add feature bits that can't appear until after VCPU init. */ |
60 | + /* | 61 | if (sve_supported) { |
61 | + * Failed, for unknown reasons in the crypto subsystem. | 62 | - t = ahcf->isar.id_aa64pfr0; |
62 | + * Best we can do is log the reason and use a constant seed. | 63 | - t = FIELD_DP64(t, ID_AA64PFR0, SVE, 1); |
63 | + */ | 64 | - ahcf->isar.id_aa64pfr0 = t; |
64 | + qemu_log_mask(LOG_UNIMP, "IRG: Crypto failure: %s\n", | 65 | - |
65 | + error_get_pretty(err)); | 66 | /* |
66 | + error_free(err); | 67 | * There is a range of kernels between kernel commit 73433762fcae |
67 | + two = 1; | 68 | * and f81cb2c3ad41 which have a bug where the kernel doesn't expose |
68 | + } | 69 | * SYS_ID_AA64ZFR0_EL1 via the ONE_REG API unless the VM has enabled |
69 | + seed = two; | 70 | - * SVE support, so we only read it here, rather than together with all |
70 | + } while (seed == 0); | 71 | - * the other ID registers earlier. |
71 | + } | 72 | + * SVE support, which resulted in an error rather than RAZ. |
72 | 73 | + * So only read the register if we set KVM_ARM_VCPU_SVE above. | |
73 | /* RandomTag */ | 74 | */ |
74 | for (i = offset = 0; i < 4; ++i) { | 75 | err |= read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64zfr0, |
76 | ARM64_SYS_REG(3, 0, 0, 4, 4)); | ||
75 | -- | 77 | -- |
76 | 2.20.1 | 78 | 2.25.1 |
77 | |||
78 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | When booting an EL3 cpu with -kernel, we set up EL3 and then | 3 | The test for the IF block indicates no ID registers are exposed, much |
4 | drop down to EL2. We need to enable access to v8.3-PAuth | 4 | less host support for SVE. Move the SVE probe into the ELSE block. |
5 | keys and instructions at EL3 before doing so. | ||
6 | 5 | ||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Message-id: 20200724163853.504655-2-richard.henderson@linaro.org | 7 | Message-id: 20220726045828.53697-4-richard.henderson@linaro.org |
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 10 | --- |
12 | hw/arm/boot.c | 3 +++ | 11 | target/arm/kvm64.c | 22 +++++++++++----------- |
13 | 1 file changed, 3 insertions(+) | 12 | 1 file changed, 11 insertions(+), 11 deletions(-) |
14 | 13 | ||
15 | diff --git a/hw/arm/boot.c b/hw/arm/boot.c | 14 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c |
16 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/arm/boot.c | 16 | --- a/target/arm/kvm64.c |
18 | +++ b/hw/arm/boot.c | 17 | +++ b/target/arm/kvm64.c |
19 | @@ -XXX,XX +XXX,XX @@ static void do_cpu_reset(void *opaque) | 18 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) |
20 | } else { | 19 | err |= read_sys_reg64(fdarray[2], &ahcf->isar.reset_pmcr_el0, |
21 | env->pstate = PSTATE_MODE_EL1h; | 20 | ARM64_SYS_REG(3, 3, 9, 12, 0)); |
22 | } | 21 | } |
23 | + if (cpu_isar_feature(aa64_pauth, cpu)) { | 22 | - } |
24 | + env->cp15.scr_el3 |= SCR_API | SCR_APK; | 23 | |
25 | + } | 24 | - if (sve_supported) { |
26 | /* AArch64 kernels never boot in secure mode */ | 25 | - /* |
27 | assert(!info->secure_boot); | 26 | - * There is a range of kernels between kernel commit 73433762fcae |
28 | /* This hook is only supported for AArch32 currently: | 27 | - * and f81cb2c3ad41 which have a bug where the kernel doesn't expose |
28 | - * SYS_ID_AA64ZFR0_EL1 via the ONE_REG API unless the VM has enabled | ||
29 | - * SVE support, which resulted in an error rather than RAZ. | ||
30 | - * So only read the register if we set KVM_ARM_VCPU_SVE above. | ||
31 | - */ | ||
32 | - err |= read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64zfr0, | ||
33 | - ARM64_SYS_REG(3, 0, 0, 4, 4)); | ||
34 | + if (sve_supported) { | ||
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 | + } | ||
45 | } | ||
46 | |||
47 | kvm_arm_destroy_scratch_host_vcpu(fdarray); | ||
29 | -- | 48 | -- |
30 | 2.20.1 | 49 | 2.25.1 |
31 | |||
32 | diff view generated by jsdifflib |