1 | A collection of bug fixes for rc2... | 1 | Only thing for Arm for rc1 is RTH's fix for the KVM SVE probe code. |
---|---|---|---|
2 | 2 | ||
3 | The following changes since commit 146aa0f104bb3bf88e43c4082a0bfc4bbda4fbd8: | 3 | -- PMM |
4 | 4 | ||
5 | Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging (2020-04-03 15:30:11 +0100) | 5 | The following changes since commit 4e06b3fc1b5e1ec03f22190eabe56891dc9c2236: |
6 | |||
7 | Merge tag 'pull-hex-20220731' of https://github.com/quic/qemu into staging (2022-07-31 21:38:54 -0700) | ||
6 | 8 | ||
7 | are available in the Git repository at: | 9 | are available in the Git repository at: |
8 | 10 | ||
9 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20200406 | 11 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20220801 |
10 | 12 | ||
11 | for you to fetch changes up to 8893790966d9c964557ad01be4a68ef50696ace8: | 13 | for you to fetch changes up to 5265d24c981dfdda8d29b44f7e84a514da75eedc: |
12 | 14 | ||
13 | dma/xlnx-zdma: Reorg to fix CUR_DSCR (2020-04-06 10:59:56 +0100) | 15 | target/arm: Move sve probe inside kvm >= 4.15 branch (2022-08-01 16:21:18 +0100) |
14 | 16 | ||
15 | ---------------------------------------------------------------- | 17 | ---------------------------------------------------------------- |
16 | target-arm queue: | 18 | target-arm queue: |
17 | * don't expose "ieee_half" via gdbstub (prevents gdb crashes or errors | 19 | * Fix KVM SVE ID register probe code |
18 | with older GDB versions) | ||
19 | * hw/arm/collie: Put StrongARMState* into a CollieMachineState struct | ||
20 | * PSTATE.PAN should not clear exec bits | ||
21 | * hw/gpio/aspeed_gpio.c: Don't directly include assert.h | ||
22 | (fixes compilation on some Windows build scenarios) | ||
23 | * dump: Fix writing of ELF section | ||
24 | * dma/xlnx-zdma: various bug fixes | ||
25 | * target/arm/helperc. delete obsolete TODO comment | ||
26 | 20 | ||
27 | ---------------------------------------------------------------- | 21 | ---------------------------------------------------------------- |
28 | Alex Bennée (1): | 22 | Richard Henderson (3): |
29 | target/arm: don't expose "ieee_half" via gdbstub | 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 | ||
30 | 26 | ||
31 | Edgar E. Iglesias (5): | 27 | target/arm/kvm64.c | 45 ++++++++++++++++++++++----------------------- |
32 | dma/xlnx-zdma: Remove comment | 28 | 1 file changed, 22 insertions(+), 23 deletions(-) |
33 | dma/xlnx-zdma: Populate DBG0.CMN_BUF_FREE | ||
34 | dma/xlnx-zdma: Clear DMA_DONE when halting | ||
35 | dma/xlnx-zdma: Advance the descriptor address when stopping | ||
36 | dma/xlnx-zdma: Reorg to fix CUR_DSCR | ||
37 | |||
38 | Peter Maydell (5): | ||
39 | hw/arm/collie: Put StrongARMState* into a CollieMachineState struct | ||
40 | target/arm: PSTATE.PAN should not clear exec bits | ||
41 | target/arm: Remove obsolete TODO note from get_phys_addr_lpae() | ||
42 | hw/gpio/aspeed_gpio.c: Don't directly include assert.h | ||
43 | dump: Fix writing of ELF section | ||
44 | |||
45 | dump/dump.c | 2 +- | ||
46 | hw/arm/collie.c | 33 +++++++++++++++++++++++++----- | ||
47 | hw/dma/xlnx-zdma.c | 56 ++++++++++++++++++++++++++------------------------- | ||
48 | hw/gpio/aspeed_gpio.c | 2 -- | ||
49 | target/arm/gdbstub.c | 7 ++++++- | ||
50 | target/arm/helper.c | 13 +++++------- | ||
51 | 6 files changed, 69 insertions(+), 44 deletions(-) | ||
52 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Alex Bennée <alex.bennee@linaro.org> | ||
2 | 1 | ||
3 | While support for parsing ieee_half in the XML description was added | ||
4 | to gdb in 2019 (a6d0f249) there is no easy way for the gdbstub to know | ||
5 | if the gdb end will understand it. Disable it for now and allow older | ||
6 | gdbs to successfully connect to the default -cpu max SVE enabled | ||
7 | QEMUs. | ||
8 | |||
9 | Signed-off-by: Alex Bennée <alex.bennee@linaro.org> | ||
10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
11 | Message-id: 20200402143913.24005-1-alex.bennee@linaro.org | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | --- | ||
14 | target/arm/gdbstub.c | 7 ++++++- | ||
15 | 1 file changed, 6 insertions(+), 1 deletion(-) | ||
16 | |||
17 | diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/target/arm/gdbstub.c | ||
20 | +++ b/target/arm/gdbstub.c | ||
21 | @@ -XXX,XX +XXX,XX @@ static const struct TypeSize vec_lanes[] = { | ||
22 | /* 16 bit */ | ||
23 | { "uint16", 16, 'h', 'u' }, | ||
24 | { "int16", 16, 'h', 's' }, | ||
25 | - { "ieee_half", 16, 'h', 'f' }, | ||
26 | + /* | ||
27 | + * TODO: currently there is no reliable way of telling | ||
28 | + * if the remote gdb actually understands ieee_half so | ||
29 | + * we don't expose it in the target description for now. | ||
30 | + * { "ieee_half", 16, 'h', 'f' }, | ||
31 | + */ | ||
32 | /* bytes */ | ||
33 | { "uint8", 8, 'b', 'u' }, | ||
34 | { "int8", 8, 'b', 's' }, | ||
35 | -- | ||
36 | 2.20.1 | ||
37 | |||
38 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Coverity complains that the collie_init() function leaks the memory | ||
2 | allocated in sa1110_init(). This is true but not significant since | ||
3 | the function is called only once on machine init and the memory must | ||
4 | remain in existence until QEMU exits anyway. | ||
5 | 1 | ||
6 | Still, we can avoid the technical memory leak by keeping the pointer | ||
7 | to the StrongARMState inside the machine state struct. Switch from | ||
8 | the simple DEFINE_MACHINE() style to defining a subclass of | ||
9 | TYPE_MACHINE which extends the MachineState struct, and keep the | ||
10 | pointer there. | ||
11 | |||
12 | Fixes: CID 1421921 | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
15 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
16 | Message-id: 20200326204919.22006-1-peter.maydell@linaro.org | ||
17 | --- | ||
18 | hw/arm/collie.c | 33 ++++++++++++++++++++++++++++----- | ||
19 | 1 file changed, 28 insertions(+), 5 deletions(-) | ||
20 | |||
21 | diff --git a/hw/arm/collie.c b/hw/arm/collie.c | ||
22 | index XXXXXXX..XXXXXXX 100644 | ||
23 | --- a/hw/arm/collie.c | ||
24 | +++ b/hw/arm/collie.c | ||
25 | @@ -XXX,XX +XXX,XX @@ | ||
26 | #include "exec/address-spaces.h" | ||
27 | #include "cpu.h" | ||
28 | |||
29 | +typedef struct { | ||
30 | + MachineState parent; | ||
31 | + | ||
32 | + StrongARMState *sa1110; | ||
33 | +} CollieMachineState; | ||
34 | + | ||
35 | +#define TYPE_COLLIE_MACHINE MACHINE_TYPE_NAME("collie") | ||
36 | +#define COLLIE_MACHINE(obj) \ | ||
37 | + OBJECT_CHECK(CollieMachineState, obj, TYPE_COLLIE_MACHINE) | ||
38 | + | ||
39 | static struct arm_boot_info collie_binfo = { | ||
40 | .loader_start = SA_SDCS0, | ||
41 | .ram_size = 0x20000000, | ||
42 | @@ -XXX,XX +XXX,XX @@ static struct arm_boot_info collie_binfo = { | ||
43 | |||
44 | static void collie_init(MachineState *machine) | ||
45 | { | ||
46 | - StrongARMState *s; | ||
47 | DriveInfo *dinfo; | ||
48 | MachineClass *mc = MACHINE_GET_CLASS(machine); | ||
49 | + CollieMachineState *cms = COLLIE_MACHINE(machine); | ||
50 | |||
51 | if (machine->ram_size != mc->default_ram_size) { | ||
52 | char *sz = size_to_str(mc->default_ram_size); | ||
53 | @@ -XXX,XX +XXX,XX @@ static void collie_init(MachineState *machine) | ||
54 | exit(EXIT_FAILURE); | ||
55 | } | ||
56 | |||
57 | - s = sa1110_init(machine->cpu_type); | ||
58 | + cms->sa1110 = sa1110_init(machine->cpu_type); | ||
59 | |||
60 | memory_region_add_subregion(get_system_memory(), SA_SDCS0, machine->ram); | ||
61 | |||
62 | @@ -XXX,XX +XXX,XX @@ static void collie_init(MachineState *machine) | ||
63 | sysbus_create_simple("scoop", 0x40800000, NULL); | ||
64 | |||
65 | collie_binfo.board_id = 0x208; | ||
66 | - arm_load_kernel(s->cpu, machine, &collie_binfo); | ||
67 | + arm_load_kernel(cms->sa1110->cpu, machine, &collie_binfo); | ||
68 | } | ||
69 | |||
70 | -static void collie_machine_init(MachineClass *mc) | ||
71 | +static void collie_machine_class_init(ObjectClass *oc, void *data) | ||
72 | { | ||
73 | + MachineClass *mc = MACHINE_CLASS(oc); | ||
74 | + | ||
75 | mc->desc = "Sharp SL-5500 (Collie) PDA (SA-1110)"; | ||
76 | mc->init = collie_init; | ||
77 | mc->ignore_memory_transaction_failures = true; | ||
78 | @@ -XXX,XX +XXX,XX @@ static void collie_machine_init(MachineClass *mc) | ||
79 | mc->default_ram_id = "strongarm.sdram"; | ||
80 | } | ||
81 | |||
82 | -DEFINE_MACHINE("collie", collie_machine_init) | ||
83 | +static const TypeInfo collie_machine_typeinfo = { | ||
84 | + .name = TYPE_COLLIE_MACHINE, | ||
85 | + .parent = TYPE_MACHINE, | ||
86 | + .class_init = collie_machine_class_init, | ||
87 | + .instance_size = sizeof(CollieMachineState), | ||
88 | +}; | ||
89 | + | ||
90 | +static void collie_machine_register_types(void) | ||
91 | +{ | ||
92 | + type_register_static(&collie_machine_typeinfo); | ||
93 | +} | ||
94 | +type_init(collie_machine_register_types); | ||
95 | -- | ||
96 | 2.20.1 | ||
97 | |||
98 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Our implementation of the PSTATE.PAN bit incorrectly cleared all | ||
2 | access permission bits for privileged access to memory which is | ||
3 | user-accessible. It should only affect the privileged read and write | ||
4 | permissions; execute permission is dealt with via XN/PXN instead. | ||
5 | 1 | ||
6 | Fixes: 81636b70c226dc27d7ebc8d | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 20200330170651.20901-1-peter.maydell@linaro.org | ||
10 | --- | ||
11 | target/arm/helper.c | 6 ++++-- | ||
12 | 1 file changed, 4 insertions(+), 2 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/helper.c | ||
17 | +++ b/target/arm/helper.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static int get_S1prot(CPUARMState *env, ARMMMUIdx mmu_idx, bool is_aa64, | ||
19 | prot_rw = user_rw; | ||
20 | } else { | ||
21 | if (user_rw && regime_is_pan(env, mmu_idx)) { | ||
22 | - return 0; | ||
23 | + /* PAN forbids data accesses but doesn't affect insn fetch */ | ||
24 | + prot_rw = 0; | ||
25 | + } else { | ||
26 | + prot_rw = simple_ap_to_rw_prot_is_user(ap, false); | ||
27 | } | ||
28 | - prot_rw = simple_ap_to_rw_prot_is_user(ap, false); | ||
29 | } | ||
30 | |||
31 | if (ns && arm_is_secure(env) && (env->cp15.scr_el3 & SCR_SIF)) { | ||
32 | -- | ||
33 | 2.20.1 | ||
34 | |||
35 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | An old comment in get_phys_addr_lpae() claims that the code does not | ||
2 | support the different format TCR for VTCR_EL2. This used to be true | ||
3 | but it is not true now (in particular the aa64_va_parameters() and | ||
4 | aa32_va_parameters() functions correctly handle the different | ||
5 | register format by checking whether the mmu_idx is Stage2). | ||
6 | Remove the out of date parts of the comment. | ||
7 | 1 | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | Message-id: 20200331143407.3186-1-peter.maydell@linaro.org | ||
11 | --- | ||
12 | target/arm/helper.c | 7 +------ | ||
13 | 1 file changed, 1 insertion(+), 6 deletions(-) | ||
14 | |||
15 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/target/arm/helper.c | ||
18 | +++ b/target/arm/helper.c | ||
19 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, | ||
20 | bool aarch64 = arm_el_is_aa64(env, el); | ||
21 | bool guarded = false; | ||
22 | |||
23 | - /* TODO: | ||
24 | - * This code does not handle the different format TCR for VTCR_EL2. | ||
25 | - * This code also does not support shareability levels. | ||
26 | - * Attribute and permission bit handling should also be checked when adding | ||
27 | - * support for those page table walks. | ||
28 | - */ | ||
29 | + /* TODO: This code does not support shareability levels. */ | ||
30 | if (aarch64) { | ||
31 | param = aa64_va_parameters(env, address, mmu_idx, | ||
32 | access_type != MMU_INST_FETCH); | ||
33 | -- | ||
34 | 2.20.1 | ||
35 | |||
36 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Remove a direct include of assert.h -- this is already | ||
2 | provided by qemu/osdep.h, and it breaks our rule that the | ||
3 | first include must always be osdep.h. | ||
4 | 1 | ||
5 | In particular we must get the assert() macro via osdep.h | ||
6 | to avoid compile failures on mingw (see the comment in | ||
7 | osdep.h where we redefine assert() for that platform). | ||
8 | |||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
11 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | ||
12 | Message-id: 20200403124712.24826-1-peter.maydell@linaro.org | ||
13 | --- | ||
14 | hw/gpio/aspeed_gpio.c | 2 -- | ||
15 | 1 file changed, 2 deletions(-) | ||
16 | |||
17 | diff --git a/hw/gpio/aspeed_gpio.c b/hw/gpio/aspeed_gpio.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/hw/gpio/aspeed_gpio.c | ||
20 | +++ b/hw/gpio/aspeed_gpio.c | ||
21 | @@ -XXX,XX +XXX,XX @@ | ||
22 | * SPDX-License-Identifier: GPL-2.0-or-later | ||
23 | */ | ||
24 | |||
25 | -#include <assert.h> | ||
26 | - | ||
27 | #include "qemu/osdep.h" | ||
28 | #include "qemu/host-utils.h" | ||
29 | #include "qemu/log.h" | ||
30 | -- | ||
31 | 2.20.1 | ||
32 | |||
33 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | In write_elf_section() we set the 'shdr' pointer to point to local | ||
2 | structures shdr32 or shdr64, which we fill in to be written out to | ||
3 | the ELF dump. Unfortunately the address we pass to fd_write_vmcore() | ||
4 | has a spurious '&' operator, so instead of writing out the section | ||
5 | header we write out the literal pointer value followed by whatever is | ||
6 | on the stack after the 'shdr' local variable. | ||
7 | 1 | ||
8 | Pass the correct address into fd_write_vmcore(). | ||
9 | |||
10 | Spotted by Coverity: CID 1421970. | ||
11 | |||
12 | Cc: qemu-stable@nongnu.org | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> | ||
15 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
16 | Message-id: 20200324173630.12221-1-peter.maydell@linaro.org | ||
17 | --- | ||
18 | dump/dump.c | 2 +- | ||
19 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
20 | |||
21 | diff --git a/dump/dump.c b/dump/dump.c | ||
22 | index XXXXXXX..XXXXXXX 100644 | ||
23 | --- a/dump/dump.c | ||
24 | +++ b/dump/dump.c | ||
25 | @@ -XXX,XX +XXX,XX @@ static void write_elf_section(DumpState *s, int type, Error **errp) | ||
26 | shdr = &shdr64; | ||
27 | } | ||
28 | |||
29 | - ret = fd_write_vmcore(&shdr, shdr_size, s); | ||
30 | + ret = fd_write_vmcore(shdr, shdr_size, s); | ||
31 | if (ret < 0) { | ||
32 | error_setg_errno(errp, -ret, | ||
33 | "dump: failed to write section header table"); | ||
34 | -- | ||
35 | 2.20.1 | ||
36 | |||
37 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Advance the descriptor address when stopping the channel. | 3 | Indication for support for SVE will not depend on whether we |
4 | perform the query on the main kvm_state or the temp vcpu. | ||
4 | 5 | ||
5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
6 | Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com> | 7 | Message-id: 20220726045828.53697-2-richard.henderson@linaro.org |
7 | Acked-by: Alistair Francis <alistair.francis@wdc.com> | 8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Message-id: 20200402134721.27863-5-edgar.iglesias@gmail.com | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 10 | --- |
11 | hw/dma/xlnx-zdma.c | 1 - | 11 | target/arm/kvm64.c | 2 +- |
12 | 1 file changed, 1 deletion(-) | 12 | 1 file changed, 1 insertion(+), 1 deletion(-) |
13 | 13 | ||
14 | diff --git a/hw/dma/xlnx-zdma.c b/hw/dma/xlnx-zdma.c | 14 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c |
15 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/dma/xlnx-zdma.c | 16 | --- a/target/arm/kvm64.c |
17 | +++ b/hw/dma/xlnx-zdma.c | 17 | +++ b/target/arm/kvm64.c |
18 | @@ -XXX,XX +XXX,XX @@ static void zdma_process_descr(XlnxZDMA *s) | 18 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) |
19 | if (ptype == PT_REG || src_cmd == CMD_STOP) { | 19 | } |
20 | ARRAY_FIELD_DP32(s->regs, ZDMA_CH_CTRL2, EN, 0); | ||
21 | zdma_set_state(s, DISABLED); | ||
22 | - return; | ||
23 | } | 20 | } |
24 | 21 | ||
25 | if (src_cmd == CMD_HALT) { | 22 | - sve_supported = ioctl(fdarray[0], KVM_CHECK_EXTENSION, KVM_CAP_ARM_SVE) > 0; |
23 | + sve_supported = kvm_arm_sve_supported(); | ||
24 | |||
25 | /* Add feature bits that can't appear until after VCPU init. */ | ||
26 | if (sve_supported) { | ||
26 | -- | 27 | -- |
27 | 2.20.1 | 28 | 2.25.1 |
28 | |||
29 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Reorganize the descriptor handling so that CUR_DSCR always | 3 | Because we weren't setting this flag, our probe of ID_AA64ZFR0 |
4 | points to the next descriptor to be processed. | 4 | was always returning zero. This also obviates the adjustment |
5 | of ID_AA64PFR0, which had sanitized the SVE field. | ||
5 | 6 | ||
6 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 7 | The effects of the bug are not visible, because the only thing that |
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 8 | ID_AA64ZFR0 is used for within qemu at present is tcg translation. |
8 | Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com> | 9 | The other tests for SVE within KVM are via ID_AA64PFR0.SVE. |
9 | Message-id: 20200402134721.27863-6-edgar.iglesias@gmail.com | 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 | --- | 16 | --- |
12 | hw/dma/xlnx-zdma.c | 47 ++++++++++++++++++++++------------------------ | 17 | target/arm/kvm64.c | 27 +++++++++++++-------------- |
13 | 1 file changed, 22 insertions(+), 25 deletions(-) | 18 | 1 file changed, 13 insertions(+), 14 deletions(-) |
14 | 19 | ||
15 | diff --git a/hw/dma/xlnx-zdma.c b/hw/dma/xlnx-zdma.c | 20 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c |
16 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/dma/xlnx-zdma.c | 22 | --- a/target/arm/kvm64.c |
18 | +++ b/hw/dma/xlnx-zdma.c | 23 | +++ b/target/arm/kvm64.c |
19 | @@ -XXX,XX +XXX,XX @@ static void zdma_load_src_descriptor(XlnxZDMA *s) | 24 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) |
20 | } | 25 | bool sve_supported; |
21 | } | 26 | bool pmu_supported = false; |
22 | 27 | uint64_t features = 0; | |
23 | +static void zdma_update_descr_addr(XlnxZDMA *s, bool type, | 28 | - uint64_t t; |
24 | + unsigned int basereg) | 29 | int err; |
25 | +{ | 30 | |
26 | + uint64_t addr, next; | 31 | /* Old kernels may not know about the PREFERRED_TARGET ioctl: however |
27 | + | 32 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) |
28 | + if (type == DTYPE_LINEAR) { | 33 | struct kvm_vcpu_init init = { .target = -1, }; |
29 | + addr = zdma_get_regaddr64(s, basereg); | 34 | |
30 | + next = addr + sizeof(s->dsc_dst); | 35 | /* |
31 | + } else { | 36 | - * Ask for Pointer Authentication if supported. We can't play the |
32 | + addr = zdma_get_regaddr64(s, basereg); | 37 | - * SVE trick of synthesising the ID reg as KVM won't tell us |
33 | + addr += sizeof(s->dsc_dst); | 38 | - * whether we have the architected or IMPDEF version of PAuth, so |
34 | + address_space_read(s->dma_as, addr, s->attr, (void *) &next, 8); | 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; | ||
35 | + } | 46 | + } |
36 | + | 47 | + |
37 | + zdma_put_regaddr64(s, basereg, next); | 48 | + /* |
38 | +} | 49 | + * Ask for Pointer Authentication if supported, so that we get |
39 | + | 50 | + * the unsanitized field values for AA64ISAR1_EL1. |
40 | static void zdma_load_dst_descriptor(XlnxZDMA *s) | 51 | */ |
41 | { | 52 | if (kvm_arm_pauth_supported()) { |
42 | uint64_t dst_addr; | 53 | init.features[0] |= (1 << KVM_ARM_VCPU_PTRAUTH_ADDRESS | |
43 | unsigned int ptype = ARRAY_FIELD_EX32(s->regs, ZDMA_CH_CTRL0, POINT_TYPE); | 54 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) |
44 | + bool dst_type; | 55 | } |
45 | |||
46 | if (ptype == PT_REG) { | ||
47 | memcpy(&s->dsc_dst, &s->regs[R_ZDMA_CH_DST_DSCR_WORD0], | ||
48 | @@ -XXX,XX +XXX,XX @@ static void zdma_load_dst_descriptor(XlnxZDMA *s) | ||
49 | if (!zdma_load_descriptor(s, dst_addr, &s->dsc_dst)) { | ||
50 | ARRAY_FIELD_DP32(s->regs, ZDMA_CH_ISR, AXI_RD_DST_DSCR, true); | ||
51 | } | 56 | } |
52 | -} | 57 | |
53 | 58 | - sve_supported = kvm_arm_sve_supported(); | |
54 | -static uint64_t zdma_update_descr_addr(XlnxZDMA *s, bool type, | ||
55 | - unsigned int basereg) | ||
56 | -{ | ||
57 | - uint64_t addr, next; | ||
58 | - | 59 | - |
59 | - if (type == DTYPE_LINEAR) { | 60 | - /* Add feature bits that can't appear until after VCPU init. */ |
60 | - next = zdma_get_regaddr64(s, basereg); | 61 | if (sve_supported) { |
61 | - next += sizeof(s->dsc_dst); | 62 | - t = ahcf->isar.id_aa64pfr0; |
62 | - zdma_put_regaddr64(s, basereg, next); | 63 | - t = FIELD_DP64(t, ID_AA64PFR0, SVE, 1); |
63 | - } else { | 64 | - ahcf->isar.id_aa64pfr0 = t; |
64 | - addr = zdma_get_regaddr64(s, basereg); | ||
65 | - addr += sizeof(s->dsc_dst); | ||
66 | - address_space_read(s->dma_as, addr, s->attr, &next, 8); | ||
67 | - zdma_put_regaddr64(s, basereg, next); | ||
68 | - } | ||
69 | - return next; | ||
70 | + /* Advance the descriptor pointer. */ | ||
71 | + dst_type = FIELD_EX32(s->dsc_dst.words[3], ZDMA_CH_DST_DSCR_WORD3, TYPE); | ||
72 | + zdma_update_descr_addr(s, dst_type, R_ZDMA_CH_DST_CUR_DSCR_LSB); | ||
73 | } | ||
74 | |||
75 | static void zdma_write_dst(XlnxZDMA *s, uint8_t *buf, uint32_t len) | ||
76 | @@ -XXX,XX +XXX,XX @@ static void zdma_write_dst(XlnxZDMA *s, uint8_t *buf, uint32_t len) | ||
77 | dst_size = FIELD_EX32(s->dsc_dst.words[2], ZDMA_CH_DST_DSCR_WORD2, | ||
78 | SIZE); | ||
79 | if (dst_size == 0 && ptype == PT_MEM) { | ||
80 | - uint64_t next; | ||
81 | - bool dst_type = FIELD_EX32(s->dsc_dst.words[3], | ||
82 | - ZDMA_CH_DST_DSCR_WORD3, | ||
83 | - TYPE); | ||
84 | - | 65 | - |
85 | - next = zdma_update_descr_addr(s, dst_type, | 66 | /* |
86 | - R_ZDMA_CH_DST_CUR_DSCR_LSB); | 67 | * There is a range of kernels between kernel commit 73433762fcae |
87 | - zdma_load_descriptor(s, next, &s->dsc_dst); | 68 | * and f81cb2c3ad41 which have a bug where the kernel doesn't expose |
88 | + zdma_load_dst_descriptor(s); | 69 | * SYS_ID_AA64ZFR0_EL1 via the ONE_REG API unless the VM has enabled |
89 | dst_size = FIELD_EX32(s->dsc_dst.words[2], ZDMA_CH_DST_DSCR_WORD2, | 70 | - * SVE support, so we only read it here, rather than together with all |
90 | SIZE); | 71 | - * the other ID registers earlier. |
91 | } | 72 | + * SVE support, which resulted in an error rather than RAZ. |
73 | + * So only read the register if we set KVM_ARM_VCPU_SVE above. | ||
74 | */ | ||
75 | err |= read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64zfr0, | ||
76 | ARM64_SYS_REG(3, 0, 0, 4, 4)); | ||
92 | -- | 77 | -- |
93 | 2.20.1 | 78 | 2.25.1 |
94 | |||
95 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Remove comment. | 3 | The test for the IF block indicates no ID registers are exposed, much |
4 | less host support for SVE. Move the SVE probe into the ELSE block. | ||
4 | 5 | ||
5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
6 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 7 | Message-id: 20220726045828.53697-4-richard.henderson@linaro.org |
7 | Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com> | 8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Message-id: 20200402134721.27863-2-edgar.iglesias@gmail.com | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 10 | --- |
11 | hw/dma/xlnx-zdma.c | 1 - | 11 | target/arm/kvm64.c | 22 +++++++++++----------- |
12 | 1 file changed, 1 deletion(-) | 12 | 1 file changed, 11 insertions(+), 11 deletions(-) |
13 | 13 | ||
14 | diff --git a/hw/dma/xlnx-zdma.c b/hw/dma/xlnx-zdma.c | 14 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c |
15 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/dma/xlnx-zdma.c | 16 | --- a/target/arm/kvm64.c |
17 | +++ b/hw/dma/xlnx-zdma.c | 17 | +++ b/target/arm/kvm64.c |
18 | @@ -XXX,XX +XXX,XX @@ static void zdma_process_descr(XlnxZDMA *s) | 18 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) |
19 | zdma_src_done(s); | 19 | err |= read_sys_reg64(fdarray[2], &ahcf->isar.reset_pmcr_el0, |
20 | ARM64_SYS_REG(3, 3, 9, 12, 0)); | ||
21 | } | ||
22 | - } | ||
23 | |||
24 | - if (sve_supported) { | ||
25 | - /* | ||
26 | - * There is a range of kernels between kernel commit 73433762fcae | ||
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 | + } | ||
20 | } | 45 | } |
21 | 46 | ||
22 | - /* Load next descriptor. */ | 47 | kvm_arm_destroy_scratch_host_vcpu(fdarray); |
23 | if (ptype == PT_REG || src_cmd == CMD_STOP) { | ||
24 | ARRAY_FIELD_DP32(s->regs, ZDMA_CH_CTRL2, EN, 0); | ||
25 | zdma_set_state(s, DISABLED); | ||
26 | -- | 48 | -- |
27 | 2.20.1 | 49 | 2.25.1 |
28 | |||
29 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | ||
2 | 1 | ||
3 | Populate DBG0.CMN_BUF_FREE so that SW can see some free space. | ||
4 | |||
5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
6 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
7 | Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com> | ||
8 | Message-id: 20200402134721.27863-3-edgar.iglesias@gmail.com | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | hw/dma/xlnx-zdma.c | 6 ++++++ | ||
12 | 1 file changed, 6 insertions(+) | ||
13 | |||
14 | diff --git a/hw/dma/xlnx-zdma.c b/hw/dma/xlnx-zdma.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/hw/dma/xlnx-zdma.c | ||
17 | +++ b/hw/dma/xlnx-zdma.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static RegisterAccessInfo zdma_regs_info[] = { | ||
19 | },{ .name = "ZDMA_CH_DBG0", .addr = A_ZDMA_CH_DBG0, | ||
20 | .rsvd = 0xfffffe00, | ||
21 | .ro = 0x1ff, | ||
22 | + | ||
23 | + /* | ||
24 | + * There's SW out there that will check the debug regs for free space. | ||
25 | + * Claim that we always have 0x100 free. | ||
26 | + */ | ||
27 | + .reset = 0x100 | ||
28 | },{ .name = "ZDMA_CH_DBG1", .addr = A_ZDMA_CH_DBG1, | ||
29 | .rsvd = 0xfffffe00, | ||
30 | .ro = 0x1ff, | ||
31 | -- | ||
32 | 2.20.1 | ||
33 | |||
34 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | ||
2 | 1 | ||
3 | Clear DMA_DONE when halting the DMA channel. | ||
4 | |||
5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
6 | Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com> | ||
7 | Acked-by: Alistair Francis <alistair.francis@wdc.com> | ||
8 | Message-id: 20200402134721.27863-4-edgar.iglesias@gmail.com | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | hw/dma/xlnx-zdma.c | 1 + | ||
12 | 1 file changed, 1 insertion(+) | ||
13 | |||
14 | diff --git a/hw/dma/xlnx-zdma.c b/hw/dma/xlnx-zdma.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/hw/dma/xlnx-zdma.c | ||
17 | +++ b/hw/dma/xlnx-zdma.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static void zdma_process_descr(XlnxZDMA *s) | ||
19 | if (src_cmd == CMD_HALT) { | ||
20 | zdma_set_state(s, PAUSED); | ||
21 | ARRAY_FIELD_DP32(s->regs, ZDMA_CH_ISR, DMA_PAUSE, 1); | ||
22 | + ARRAY_FIELD_DP32(s->regs, ZDMA_CH_ISR, DMA_DONE, false); | ||
23 | zdma_ch_imr_update_irq(s); | ||
24 | return; | ||
25 | } | ||
26 | -- | ||
27 | 2.20.1 | ||
28 | |||
29 | diff view generated by jsdifflib |