1 | Arm patch queue for 2.12 -- a miscellaneous collection | 1 | arm pullreq for rc1. All minor bugfixes, except for the sve-default-vector-length |
---|---|---|---|
2 | of bug fixes. | 2 | patches, which are somewhere between a bugfix and a new feature. |
3 | 3 | ||
4 | thanks | 4 | thanks |
5 | -- PMM | 5 | -- PMM |
6 | 6 | ||
7 | The following changes since commit c08ccd1b53f488ac86c1f65cf7623dc91acc249a: | ||
7 | 8 | ||
8 | The following changes since commit fb4fe32d5b6290deabe752b51cc1cc2a9e8573db: | 9 | Merge remote-tracking branch 'remotes/rth-gitlab/tags/pull-tcg-20210726' into staging (2021-07-27 08:35:01 +0100) |
9 | |||
10 | Merge remote-tracking branch 'remotes/xtensa/tags/20180409-xtensa' into staging (2018-04-10 10:22:45 +0100) | ||
11 | 10 | ||
12 | are available in the Git repository at: | 11 | are available in the Git repository at: |
13 | 12 | ||
14 | git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20180410 | 13 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20210727 |
15 | 14 | ||
16 | for you to fetch changes up to bd49e6027cbc207c87633c7add3ebd7d3474cd35: | 15 | for you to fetch changes up to e229a179a503f2aee43a76888cf12fbdfe8a3749: |
17 | 16 | ||
18 | fpu: Fix rounding mode for floatN_to_uintM_round_to_zero (2018-04-10 13:02:26 +0100) | 17 | hw: aspeed_gpio: Fix memory size (2021-07-27 11:00:00 +0100) |
19 | 18 | ||
20 | ---------------------------------------------------------------- | 19 | ---------------------------------------------------------------- |
21 | target-arm queue: | 20 | target-arm queue: |
22 | * fpu: Fix rounding mode for floatN_to_uintM_round_to_zero | 21 | * hw/arm/smmuv3: Check 31st bit to see if CD is valid |
23 | * tcg: Fix guest state corruption when running 64-bit Arm | 22 | * qemu-options.hx: Fix formatting of -machine memory-backend option |
24 | guests on a 32-bit host (especially when using icount) | 23 | * hw: aspeed_gpio: Fix memory size |
25 | * linux-user/signal.c: Ensure AArch64 signal frame isn't too small | 24 | * hw/arm/nseries: Display hexadecimal value with '0x' prefix |
26 | * cpus.c: ensure running CPU recalculates icount deadlines on timer expiry | 25 | * Add sve-default-vector-length cpu property |
27 | * target/arm: Report unsupported MPU region sizes more clearly | 26 | * docs: Update path that mentions deprecated.rst |
28 | * hw/arm/fsl-imx: Fix introspection problem with fsl-imx6 and fsl-imx7 | 27 | * hw/intc/armv7m_nvic: for v8.1M VECTPENDING hides S exceptions from NS |
29 | * hw/arm/allwinner-a10: Do not use nd_table in instance_init function | 28 | * hw/intc/armv7m_nvic: Correct size of ICSR.VECTPENDING |
30 | * hw/sd/bcm2835_sdhost: Don't raise spurious interrupts | 29 | * hw/intc/armv7m_nvic: ISCR.ISRPENDING is set for non-enabled pending interrupts |
31 | * hw/sd/bcm2835_sdhost: Add tracepoints | 30 | * target/arm: Report M-profile alignment faults correctly to the guest |
32 | * target-arm: Check undefined opcodes for SWP in A32 decoder | 31 | * target/arm: Add missing 'return's after calling v7m_exception_taken() |
33 | * hw/arm/integratorcp: Don't do things that could be fatal in the instance_init | 32 | * target/arm: Enforce that M-profile SP low 2 bits are always zero |
34 | * hw/arm: Allow manually specified /psci node | ||
35 | 33 | ||
36 | ---------------------------------------------------------------- | 34 | ---------------------------------------------------------------- |
37 | Andrey Smirnov (1): | 35 | Joe Komlodi (1): |
38 | hw/arm: Allow manually specified /psci node | 36 | hw/arm/smmuv3: Check 31st bit to see if CD is valid |
39 | 37 | ||
40 | Onur Sahin (1): | 38 | Joel Stanley (1): |
41 | target-arm: Check undefined opcodes for SWP in A32 decoder | 39 | hw: aspeed_gpio: Fix memory size |
42 | 40 | ||
43 | Peter Maydell (5): | 41 | Mao Zhongyi (1): |
44 | hw/sd/bcm2835_sdhost: Add tracepoints | 42 | docs: Update path that mentions deprecated.rst |
45 | hw/sd/bcm2835_sdhost: Don't raise spurious interrupts | ||
46 | target/arm: Report unsupported MPU region sizes more clearly | ||
47 | cpus.c: ensure running CPU recalculates icount deadlines on timer expiry | ||
48 | linux-user/signal.c: Ensure AArch64 signal frame isn't too small | ||
49 | 43 | ||
50 | Richard Henderson (2): | 44 | Peter Maydell (7): |
51 | tcg: Introduce tcg_set_insn_start_param | 45 | qemu-options.hx: Fix formatting of -machine memory-backend option |
52 | fpu: Fix rounding mode for floatN_to_uintM_round_to_zero | 46 | target/arm: Enforce that M-profile SP low 2 bits are always zero |
47 | target/arm: Add missing 'return's after calling v7m_exception_taken() | ||
48 | target/arm: Report M-profile alignment faults correctly to the guest | ||
49 | hw/intc/armv7m_nvic: ISCR.ISRPENDING is set for non-enabled pending interrupts | ||
50 | hw/intc/armv7m_nvic: Correct size of ICSR.VECTPENDING | ||
51 | hw/intc/armv7m_nvic: for v8.1M VECTPENDING hides S exceptions from NS | ||
53 | 52 | ||
54 | Thomas Huth (3): | 53 | Philippe Mathieu-Daudé (1): |
55 | hw/arm/integratorcp: Don't do things that could be fatal in the instance_init | 54 | hw/arm/nseries: Display hexadecimal value with '0x' prefix |
56 | hw/arm/allwinner-a10: Do not use nd_table in instance_init function | ||
57 | hw/arm/fsl-imx: Fix introspection problem with fsl-imx6 and fsl-imx7 | ||
58 | 55 | ||
59 | target/arm/translate.h | 2 +- | 56 | Richard Henderson (3): |
60 | tcg/tcg.h | 10 ++++++++++ | 57 | target/arm: Correctly bound length in sve_zcr_get_valid_len |
61 | cpus.c | 10 +++++++++- | 58 | target/arm: Export aarch64_sve_zcr_get_valid_len |
62 | fpu/softfloat.c | 4 ++-- | 59 | target/arm: Add sve-default-vector-length cpu property |
63 | hw/arm/allwinner-a10.c | 12 +++++------ | ||
64 | hw/arm/boot.c | 10 ++++++++++ | ||
65 | hw/arm/fsl-imx6.c | 14 ++++++------- | ||
66 | hw/arm/fsl-imx7.c | 13 ++++++------ | ||
67 | hw/arm/integratorcp.c | 23 +++++++++++++-------- | ||
68 | hw/sd/bcm2835_sdhost.c | 54 ++++++++++++++++++++++++++++++++------------------ | ||
69 | linux-user/signal.c | 6 ++++++ | ||
70 | target/arm/helper.c | 6 +++--- | ||
71 | target/arm/translate.c | 9 +++++++-- | ||
72 | hw/sd/trace-events | 6 ++++++ | ||
73 | 14 files changed, 124 insertions(+), 55 deletions(-) | ||
74 | 60 | ||
61 | docs/system/arm/cpu-features.rst | 15 ++++++++++ | ||
62 | configure | 2 +- | ||
63 | hw/arm/smmuv3-internal.h | 2 +- | ||
64 | target/arm/cpu.h | 5 ++++ | ||
65 | target/arm/internals.h | 10 +++++++ | ||
66 | hw/arm/nseries.c | 2 +- | ||
67 | hw/gpio/aspeed_gpio.c | 3 +- | ||
68 | hw/intc/armv7m_nvic.c | 40 +++++++++++++++++++-------- | ||
69 | target/arm/cpu.c | 14 ++++++++-- | ||
70 | target/arm/cpu64.c | 60 ++++++++++++++++++++++++++++++++++++++++ | ||
71 | target/arm/gdbstub.c | 4 +++ | ||
72 | target/arm/helper.c | 8 ++++-- | ||
73 | target/arm/m_helper.c | 24 ++++++++++++---- | ||
74 | target/arm/translate.c | 3 ++ | ||
75 | target/i386/cpu.c | 2 +- | ||
76 | MAINTAINERS | 2 +- | ||
77 | qemu-options.hx | 30 +++++++++++--------- | ||
78 | 17 files changed, 183 insertions(+), 43 deletions(-) | ||
79 | diff view generated by jsdifflib |
1 | The AArch64 signal frame design was extended for SVE in commit | 1 | From: Joe Komlodi <joe.komlodi@xilinx.com> |
---|---|---|---|
2 | 8c5931de0ac77388096d79ceb, so that instead of having a fixed setup we | ||
3 | now add various records to the frame, with some of them possibly | ||
4 | overflowing into an extra space outside the original 4K reserved | ||
5 | block in the target_sigcontext. However, we failed to ensure that we | ||
6 | always at least allocate the 4K reserved block. This is ABI, and | ||
7 | some userspace programs rely on it. In particular the dash shell | ||
8 | would segfault if the frame wasn't as big enough. | ||
9 | 2 | ||
10 | (Compare the kernel's sigframe_size() function in | 3 | The bit to see if a CD is valid is the last bit of the first word of the CD. |
11 | arch/arm64/kernel/signal.c.) | ||
12 | 4 | ||
13 | Reported-by: Richard Henwood <richard.henwood@arm.com> | 5 | Signed-off-by: Joe Komlodi <joe.komlodi@xilinx.com> |
14 | Reviewed-by: Laurent Vivier <laurent@vivier.eu> | 6 | Message-id: 1626728232-134665-2-git-send-email-joe.komlodi@xilinx.com |
15 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
16 | Message-id: 20180409140714.26841-1-peter.maydell@linaro.org | ||
17 | Fixes: https://bugs.launchpad.net/bugs/1761535 | ||
18 | Fixes: 8c5931de0ac77388096d79ceb | ||
19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
20 | --- | 9 | --- |
21 | linux-user/signal.c | 6 ++++++ | 10 | hw/arm/smmuv3-internal.h | 2 +- |
22 | 1 file changed, 6 insertions(+) | 11 | 1 file changed, 1 insertion(+), 1 deletion(-) |
23 | 12 | ||
24 | diff --git a/linux-user/signal.c b/linux-user/signal.c | 13 | diff --git a/hw/arm/smmuv3-internal.h b/hw/arm/smmuv3-internal.h |
25 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
26 | --- a/linux-user/signal.c | 15 | --- a/hw/arm/smmuv3-internal.h |
27 | +++ b/linux-user/signal.c | 16 | +++ b/hw/arm/smmuv3-internal.h |
28 | @@ -XXX,XX +XXX,XX @@ static void target_setup_frame(int usig, struct target_sigaction *ka, | 17 | @@ -XXX,XX +XXX,XX @@ static inline int pa_range(STE *ste) |
29 | fr_ofs = layout.total_size; | 18 | |
30 | layout.total_size += sizeof(struct target_rt_frame_record); | 19 | /* CD fields */ |
31 | 20 | ||
32 | + /* We must always provide at least the standard 4K reserved space, | 21 | -#define CD_VALID(x) extract32((x)->word[0], 30, 1) |
33 | + * even if we don't use all of it (this is part of the ABI) | 22 | +#define CD_VALID(x) extract32((x)->word[0], 31, 1) |
34 | + */ | 23 | #define CD_ASID(x) extract32((x)->word[1], 16, 16) |
35 | + layout.total_size = MAX(layout.total_size, | 24 | #define CD_TTB(x, sel) \ |
36 | + sizeof(struct target_rt_sigframe)); | 25 | ({ \ |
37 | + | ||
38 | frame_addr = get_sigframe(ka, env, layout.total_size); | ||
39 | trace_user_setup_frame(env, frame_addr); | ||
40 | if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) { | ||
41 | -- | 26 | -- |
42 | 2.16.2 | 27 | 2.20.1 |
43 | 28 | ||
44 | 29 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | The documentation of the -machine memory-backend has some minor | ||
2 | formatting errors: | ||
3 | * Misindentation of the initial line meant that the whole option | ||
4 | section is incorrectly indented in the HTML output compared to | ||
5 | the other -machine options | ||
6 | * The examples weren't indented, which meant that they were formatted | ||
7 | as plain run-on text including outputting the "::" as text. | ||
8 | * The a) b) list has no rst-format markup so it is rendered as | ||
9 | a single run-on paragraph | ||
1 | 10 | ||
11 | Fix the formatting. | ||
12 | |||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> | ||
15 | Message-id: 20210719105257.3599-1-peter.maydell@linaro.org | ||
16 | --- | ||
17 | qemu-options.hx | 30 +++++++++++++++++------------- | ||
18 | 1 file changed, 17 insertions(+), 13 deletions(-) | ||
19 | |||
20 | diff --git a/qemu-options.hx b/qemu-options.hx | ||
21 | index XXXXXXX..XXXXXXX 100644 | ||
22 | --- a/qemu-options.hx | ||
23 | +++ b/qemu-options.hx | ||
24 | @@ -XXX,XX +XXX,XX @@ SRST | ||
25 | Enables or disables ACPI Heterogeneous Memory Attribute Table | ||
26 | (HMAT) support. The default is off. | ||
27 | |||
28 | - ``memory-backend='id'`` | ||
29 | + ``memory-backend='id'`` | ||
30 | An alternative to legacy ``-mem-path`` and ``mem-prealloc`` options. | ||
31 | Allows to use a memory backend as main RAM. | ||
32 | |||
33 | For example: | ||
34 | :: | ||
35 | - -object memory-backend-file,id=pc.ram,size=512M,mem-path=/hugetlbfs,prealloc=on,share=on | ||
36 | - -machine memory-backend=pc.ram | ||
37 | - -m 512M | ||
38 | + | ||
39 | + -object memory-backend-file,id=pc.ram,size=512M,mem-path=/hugetlbfs,prealloc=on,share=on | ||
40 | + -machine memory-backend=pc.ram | ||
41 | + -m 512M | ||
42 | |||
43 | Migration compatibility note: | ||
44 | - a) as backend id one shall use value of 'default-ram-id', advertised by | ||
45 | - machine type (available via ``query-machines`` QMP command), if migration | ||
46 | - to/from old QEMU (<5.0) is expected. | ||
47 | - b) for machine types 4.0 and older, user shall | ||
48 | - use ``x-use-canonical-path-for-ramblock-id=off`` backend option | ||
49 | - if migration to/from old QEMU (<5.0) is expected. | ||
50 | + | ||
51 | + * as backend id one shall use value of 'default-ram-id', advertised by | ||
52 | + machine type (available via ``query-machines`` QMP command), if migration | ||
53 | + to/from old QEMU (<5.0) is expected. | ||
54 | + * for machine types 4.0 and older, user shall | ||
55 | + use ``x-use-canonical-path-for-ramblock-id=off`` backend option | ||
56 | + if migration to/from old QEMU (<5.0) is expected. | ||
57 | + | ||
58 | For example: | ||
59 | :: | ||
60 | - -object memory-backend-ram,id=pc.ram,size=512M,x-use-canonical-path-for-ramblock-id=off | ||
61 | - -machine memory-backend=pc.ram | ||
62 | - -m 512M | ||
63 | + | ||
64 | + -object memory-backend-ram,id=pc.ram,size=512M,x-use-canonical-path-for-ramblock-id=off | ||
65 | + -machine memory-backend=pc.ram | ||
66 | + -m 512M | ||
67 | ERST | ||
68 | |||
69 | HXCOMM Deprecated by -machine | ||
70 | -- | ||
71 | 2.20.1 | ||
72 | |||
73 | diff view generated by jsdifflib |
1 | From: Onur Sahin <onursahin08@gmail.com> | 1 | For M-profile, unlike A-profile, the low 2 bits of SP are defined to be |
---|---|---|---|
2 | RES0H, which is to say that they must be hardwired to zero so that | ||
3 | guest attempts to write non-zero values to them are ignored. | ||
2 | 4 | ||
3 | Make sure we are not treating architecturally Undefined instructions | 5 | Implement this behaviour by masking out the low bits: |
4 | as a SWP, by verifying the opcodes as per section A8.8.229 of ARMv7-A | 6 | * for writes to r13 by the gdbstub |
5 | specification. Bits [21:20] must be zero for this to be a SWP or SWPB. | 7 | * for writes to any of the various flavours of SP via MSR |
6 | We also choose to UNDEF for the architecturally UNPREDICTABLE case of | 8 | * for writes to r13 via store_reg() in generated code |
7 | bits [11:8] not being zero. | ||
8 | 9 | ||
9 | Signed-off-by: Onur Sahin <onursahin08@gmail.com> | 10 | Note that all the direct uses of cpu_R[] in translate.c are in places |
10 | [PMM: tweaked commit message] | 11 | where the register is definitely not r13 (usually because that has |
11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 12 | been checked for as an UNDEFINED or UNPREDICTABLE case and handled as |
13 | UNDEF). | ||
14 | |||
15 | All the other writes to regs[13] in C code are either: | ||
16 | * A-profile only code | ||
17 | * writes of values we can guarantee to be aligned, such as | ||
18 | - writes of previous-SP-value plus or minus a 4-aligned constant | ||
19 | - writes of the value in an SP limit register (which we already | ||
20 | enforce to be aligned) | ||
21 | |||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 22 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
23 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
24 | Message-id: 20210723162146.5167-2-peter.maydell@linaro.org | ||
13 | --- | 25 | --- |
14 | target/arm/translate.c | 9 +++++++-- | 26 | target/arm/gdbstub.c | 4 ++++ |
15 | 1 file changed, 7 insertions(+), 2 deletions(-) | 27 | target/arm/m_helper.c | 14 ++++++++------ |
28 | target/arm/translate.c | 3 +++ | ||
29 | 3 files changed, 15 insertions(+), 6 deletions(-) | ||
16 | 30 | ||
31 | diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c | ||
32 | index XXXXXXX..XXXXXXX 100644 | ||
33 | --- a/target/arm/gdbstub.c | ||
34 | +++ b/target/arm/gdbstub.c | ||
35 | @@ -XXX,XX +XXX,XX @@ int arm_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) | ||
36 | |||
37 | if (n < 16) { | ||
38 | /* Core integer register. */ | ||
39 | + if (n == 13 && arm_feature(env, ARM_FEATURE_M)) { | ||
40 | + /* M profile SP low bits are always 0 */ | ||
41 | + tmp &= ~3; | ||
42 | + } | ||
43 | env->regs[n] = tmp; | ||
44 | return 4; | ||
45 | } | ||
46 | diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c | ||
47 | index XXXXXXX..XXXXXXX 100644 | ||
48 | --- a/target/arm/m_helper.c | ||
49 | +++ b/target/arm/m_helper.c | ||
50 | @@ -XXX,XX +XXX,XX @@ void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val) | ||
51 | if (!env->v7m.secure) { | ||
52 | return; | ||
53 | } | ||
54 | - env->v7m.other_ss_msp = val; | ||
55 | + env->v7m.other_ss_msp = val & ~3; | ||
56 | return; | ||
57 | case 0x89: /* PSP_NS */ | ||
58 | if (!env->v7m.secure) { | ||
59 | return; | ||
60 | } | ||
61 | - env->v7m.other_ss_psp = val; | ||
62 | + env->v7m.other_ss_psp = val & ~3; | ||
63 | return; | ||
64 | case 0x8a: /* MSPLIM_NS */ | ||
65 | if (!env->v7m.secure) { | ||
66 | @@ -XXX,XX +XXX,XX @@ void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val) | ||
67 | |||
68 | limit = is_psp ? env->v7m.psplim[false] : env->v7m.msplim[false]; | ||
69 | |||
70 | + val &= ~0x3; | ||
71 | + | ||
72 | if (val < limit) { | ||
73 | raise_exception_ra(env, EXCP_STKOF, 0, 1, GETPC()); | ||
74 | } | ||
75 | @@ -XXX,XX +XXX,XX @@ void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val) | ||
76 | break; | ||
77 | case 8: /* MSP */ | ||
78 | if (v7m_using_psp(env)) { | ||
79 | - env->v7m.other_sp = val; | ||
80 | + env->v7m.other_sp = val & ~3; | ||
81 | } else { | ||
82 | - env->regs[13] = val; | ||
83 | + env->regs[13] = val & ~3; | ||
84 | } | ||
85 | break; | ||
86 | case 9: /* PSP */ | ||
87 | if (v7m_using_psp(env)) { | ||
88 | - env->regs[13] = val; | ||
89 | + env->regs[13] = val & ~3; | ||
90 | } else { | ||
91 | - env->v7m.other_sp = val; | ||
92 | + env->v7m.other_sp = val & ~3; | ||
93 | } | ||
94 | break; | ||
95 | case 10: /* MSPLIM */ | ||
17 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 96 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
18 | index XXXXXXX..XXXXXXX 100644 | 97 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/target/arm/translate.c | 98 | --- a/target/arm/translate.c |
20 | +++ b/target/arm/translate.c | 99 | +++ b/target/arm/translate.c |
21 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | 100 | @@ -XXX,XX +XXX,XX @@ void store_reg(DisasContext *s, int reg, TCGv_i32 var) |
22 | } | 101 | */ |
23 | } | 102 | tcg_gen_andi_i32(var, var, s->thumb ? ~1 : ~3); |
24 | tcg_temp_free_i32(addr); | 103 | s->base.is_jmp = DISAS_JUMP; |
25 | - } else { | 104 | + } else if (reg == 13 && arm_dc_feature(s, ARM_FEATURE_M)) { |
26 | + } else if ((insn & 0x00300f00) == 0) { | 105 | + /* For M-profile SP bits [1:0] are always zero */ |
27 | + /* 0bcccc_0001_0x00_xxxx_xxxx_0000_1001_xxxx | 106 | + tcg_gen_andi_i32(var, var, ~3); |
28 | + * - SWP, SWPB | 107 | } |
29 | + */ | 108 | tcg_gen_mov_i32(cpu_R[reg], var); |
30 | + | 109 | tcg_temp_free_i32(var); |
31 | TCGv taddr; | ||
32 | TCGMemOp opc = s->be_data; | ||
33 | |||
34 | - /* SWP instruction */ | ||
35 | rm = (insn) & 0xf; | ||
36 | |||
37 | if (insn & (1 << 22)) { | ||
38 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | ||
39 | get_mem_index(s), opc); | ||
40 | tcg_temp_free(taddr); | ||
41 | store_reg(s, rd, tmp); | ||
42 | + } else { | ||
43 | + goto illegal_op; | ||
44 | } | ||
45 | } | ||
46 | } else { | ||
47 | -- | 110 | -- |
48 | 2.16.2 | 111 | 2.20.1 |
49 | 112 | ||
50 | 113 | diff view generated by jsdifflib |
1 | The Linux bcm2835_sdhost driver doesn't work on QEMU, because our | 1 | In do_v7m_exception_exit(), we perform various checks as part of |
---|---|---|---|
2 | model raises spurious data interrupts. Our function | 2 | performing the exception return. If one of these checks fails, the |
3 | bcm2835_sdhost_fifo_run() will flag an interrupt any time it is | 3 | architecture requires that we take an appropriate exception on the |
4 | called with s->datacnt == 0, even if the host hasn't actually issued | 4 | existing stackframe. We implement this by calling |
5 | a data read or write command yet. This means that the driver gets a | 5 | v7m_exception_taken() to set up to take the new exception, and then |
6 | spurious data interrupt as soon as it enables IRQs and then does | 6 | immediately returning from do_v7m_exception_exit() without proceeding |
7 | something else that causes us to call the fifo_run routine, like | 7 | any further with the unstack-and-exception-return process. |
8 | writing to SDHCFG, and before it does the write to SDCMD to issue the | ||
9 | read. The driver's IRQ handler then spins forever complaining that | ||
10 | there's no data and the SD controller isn't in a state where there's | ||
11 | going to be any data: | ||
12 | 8 | ||
13 | [ 41.040738] sdhost-bcm2835 3f202000.mmc: fsm 1, hsts 00000000 | 9 | In a couple of checks that are new in v8.1M, we forgot the "return" |
14 | [ 41.042059] sdhost-bcm2835 3f202000.mmc: fsm 1, hsts 00000000 | 10 | statement, with the effect that if bad code in the guest tripped over |
15 | (continues forever). | 11 | these checks we would set up to take a UsageFault exception but then |
12 | blunder on trying to also unstack and return from the original | ||
13 | exception, with the probable result that the guest would crash. | ||
16 | 14 | ||
17 | Move the interrupt flag setting to more plausible places: | 15 | Add the missing return statements. |
18 | * for BUSY, raise this as soon as a BUSYWAIT command has executed | ||
19 | * for DATA, raise this when the FIFO has any space free (for a write) | ||
20 | or any data in it (for a read) | ||
21 | * for BLOCK, raise this when the data count is 0 and we've | ||
22 | actually done some reading or writing | ||
23 | |||
24 | This is pure guesswork since the documentation for this hardware is | ||
25 | not public, but it is sufficient to get the Linux bcm2835_sdhost | ||
26 | driver to work. | ||
27 | 16 | ||
28 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
29 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 18 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
30 | Tested-by: Gerd Hoffmann <kraxel@redhat.com> | 19 | Message-id: 20210723162146.5167-3-peter.maydell@linaro.org |
31 | Message-id: 20180319161556.16446-3-peter.maydell@linaro.org | ||
32 | --- | 20 | --- |
33 | hw/sd/bcm2835_sdhost.c | 46 ++++++++++++++++++++++++++-------------------- | 21 | target/arm/m_helper.c | 2 ++ |
34 | 1 file changed, 26 insertions(+), 20 deletions(-) | 22 | 1 file changed, 2 insertions(+) |
35 | 23 | ||
36 | diff --git a/hw/sd/bcm2835_sdhost.c b/hw/sd/bcm2835_sdhost.c | 24 | diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c |
37 | index XXXXXXX..XXXXXXX 100644 | 25 | index XXXXXXX..XXXXXXX 100644 |
38 | --- a/hw/sd/bcm2835_sdhost.c | 26 | --- a/target/arm/m_helper.c |
39 | +++ b/hw/sd/bcm2835_sdhost.c | 27 | +++ b/target/arm/m_helper.c |
40 | @@ -XXX,XX +XXX,XX @@ static void bcm2835_sdhost_send_command(BCM2835SDHostState *s) | 28 | @@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu) |
41 | } | 29 | qemu_log_mask(CPU_LOG_INT, "...taking UsageFault on existing " |
42 | #undef RWORD | 30 | "stackframe: NSACR prevents clearing FPU registers\n"); |
43 | } | 31 | v7m_exception_taken(cpu, excret, true, false); |
44 | + /* We never really delay commands, so if this was a 'busywait' command | 32 | + return; |
45 | + * then we've completed it now and can raise the interrupt. | 33 | } else if (!cpacr_pass) { |
46 | + */ | 34 | armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE, |
47 | + if ((s->cmd & SDCMD_BUSYWAIT) && (s->config & SDHCFG_BUSY_IRPT_EN)) { | 35 | exc_secure); |
48 | + s->status |= SDHSTS_BUSY_IRPT; | 36 | @@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu) |
49 | + } | 37 | qemu_log_mask(CPU_LOG_INT, "...taking UsageFault on existing " |
50 | return; | 38 | "stackframe: CPACR prevents clearing FPU registers\n"); |
51 | 39 | v7m_exception_taken(cpu, excret, true, false); | |
52 | error: | 40 | + return; |
53 | @@ -XXX,XX +XXX,XX @@ static void bcm2835_sdhost_fifo_run(BCM2835SDHostState *s) | ||
54 | n++; | ||
55 | if (n == 4) { | ||
56 | bcm2835_sdhost_fifo_push(s, value); | ||
57 | + s->status |= SDHSTS_DATA_FLAG; | ||
58 | + if (s->config & SDHCFG_DATA_IRPT_EN) { | ||
59 | + s->status |= SDHSTS_SDIO_IRPT; | ||
60 | + } | ||
61 | n = 0; | ||
62 | value = 0; | ||
63 | } | 41 | } |
64 | } | 42 | } |
65 | if (n != 0) { | 43 | /* Clear s0..s15, FPSCR and VPR */ |
66 | bcm2835_sdhost_fifo_push(s, value); | ||
67 | + s->status |= SDHSTS_DATA_FLAG; | ||
68 | } | ||
69 | } else { /* write */ | ||
70 | n = 0; | ||
71 | while (s->datacnt > 0 && (s->fifo_len > 0 || n > 0)) { | ||
72 | if (n == 0) { | ||
73 | value = bcm2835_sdhost_fifo_pop(s); | ||
74 | + s->status |= SDHSTS_DATA_FLAG; | ||
75 | + if (s->config & SDHCFG_DATA_IRPT_EN) { | ||
76 | + s->status |= SDHSTS_SDIO_IRPT; | ||
77 | + } | ||
78 | n = 4; | ||
79 | } | ||
80 | n--; | ||
81 | @@ -XXX,XX +XXX,XX @@ static void bcm2835_sdhost_fifo_run(BCM2835SDHostState *s) | ||
82 | value >>= 8; | ||
83 | } | ||
84 | } | ||
85 | + if (s->datacnt == 0) { | ||
86 | + s->edm &= ~SDEDM_FSM_MASK; | ||
87 | + s->edm |= SDEDM_FSM_DATAMODE; | ||
88 | + trace_bcm2835_sdhost_edm_change("datacnt 0", s->edm); | ||
89 | + | ||
90 | + if ((s->cmd & SDCMD_WRITE_CMD) && | ||
91 | + (s->config & SDHCFG_BLOCK_IRPT_EN)) { | ||
92 | + s->status |= SDHSTS_BLOCK_IRPT; | ||
93 | + } | ||
94 | + } | ||
95 | } | ||
96 | - if (s->datacnt == 0) { | ||
97 | - s->status |= SDHSTS_DATA_FLAG; | ||
98 | |||
99 | - s->edm &= ~0xf; | ||
100 | - s->edm |= SDEDM_FSM_DATAMODE; | ||
101 | - trace_bcm2835_sdhost_edm_change("datacnt 0", s->edm); | ||
102 | - | ||
103 | - if (s->config & SDHCFG_DATA_IRPT_EN) { | ||
104 | - s->status |= SDHSTS_SDIO_IRPT; | ||
105 | - } | ||
106 | - | ||
107 | - if ((s->cmd & SDCMD_BUSYWAIT) && (s->config & SDHCFG_BUSY_IRPT_EN)) { | ||
108 | - s->status |= SDHSTS_BUSY_IRPT; | ||
109 | - } | ||
110 | - | ||
111 | - if ((s->cmd & SDCMD_WRITE_CMD) && (s->config & SDHCFG_BLOCK_IRPT_EN)) { | ||
112 | - s->status |= SDHSTS_BLOCK_IRPT; | ||
113 | - } | ||
114 | - | ||
115 | - bcm2835_sdhost_update_irq(s); | ||
116 | - } | ||
117 | + bcm2835_sdhost_update_irq(s); | ||
118 | |||
119 | s->edm &= ~(0x1f << 4); | ||
120 | s->edm |= ((s->fifo_len & 0x1f) << 4); | ||
121 | -- | 44 | -- |
122 | 2.16.2 | 45 | 2.20.1 |
123 | 46 | ||
124 | 47 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | For M-profile, we weren't reporting alignment faults triggered by the | ||
2 | generic TCG code correctly to the guest. These get passed into | ||
3 | arm_v7m_cpu_do_interrupt() as an EXCP_DATA_ABORT with an A-profile | ||
4 | style exception.fsr value of 1. We didn't check for this, and so | ||
5 | they fell through into the default of "assume this is an MPU fault" | ||
6 | and were reported to the guest as a data access violation MPU fault. | ||
1 | 7 | ||
8 | Report these alignment faults as UsageFaults which set the UNALIGNED | ||
9 | bit in the UFSR. | ||
10 | |||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
13 | Message-id: 20210723162146.5167-4-peter.maydell@linaro.org | ||
14 | --- | ||
15 | target/arm/m_helper.c | 8 ++++++++ | ||
16 | 1 file changed, 8 insertions(+) | ||
17 | |||
18 | diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c | ||
19 | index XXXXXXX..XXXXXXX 100644 | ||
20 | --- a/target/arm/m_helper.c | ||
21 | +++ b/target/arm/m_helper.c | ||
22 | @@ -XXX,XX +XXX,XX @@ void arm_v7m_cpu_do_interrupt(CPUState *cs) | ||
23 | env->v7m.sfsr |= R_V7M_SFSR_LSERR_MASK; | ||
24 | break; | ||
25 | case EXCP_UNALIGNED: | ||
26 | + /* Unaligned faults reported by M-profile aware code */ | ||
27 | armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE, env->v7m.secure); | ||
28 | env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_UNALIGNED_MASK; | ||
29 | break; | ||
30 | @@ -XXX,XX +XXX,XX @@ void arm_v7m_cpu_do_interrupt(CPUState *cs) | ||
31 | } | ||
32 | armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_BUS, false); | ||
33 | break; | ||
34 | + case 0x1: /* Alignment fault reported by generic code */ | ||
35 | + qemu_log_mask(CPU_LOG_INT, | ||
36 | + "...really UsageFault with UFSR.UNALIGNED\n"); | ||
37 | + env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_UNALIGNED_MASK; | ||
38 | + armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE, | ||
39 | + env->v7m.secure); | ||
40 | + break; | ||
41 | default: | ||
42 | /* | ||
43 | * All other FSR values are either MPU faults or "can't happen | ||
44 | -- | ||
45 | 2.20.1 | ||
46 | |||
47 | diff view generated by jsdifflib |
1 | From: Thomas Huth <thuth@redhat.com> | 1 | The ISCR.ISRPENDING bit is set when an external interrupt is pending. |
---|---|---|---|
2 | This is true whether that external interrupt is enabled or not. | ||
3 | This means that we can't use 's->vectpending == 0' as a shortcut to | ||
4 | "ISRPENDING is zero", because s->vectpending indicates only the | ||
5 | highest priority pending enabled interrupt. | ||
2 | 6 | ||
3 | The instance_init function of a device can be called at any time, even | 7 | Remove the incorrect optimization so that if there is no pending |
4 | if the device is not going to be used (i.e. not going to be realized). | 8 | enabled interrupt we fall through to scanning through the whole |
5 | So a instance_init function must not do things that could cause QEMU | 9 | interrupt array. |
6 | to exit, like calling qemu_check_nic_model(&nd_table[0], ...) for example. | ||
7 | But this is what the instance_init function of the allwinner-a10 device | ||
8 | is currently doing - and this causes QEMU to quit unexpectedly when | ||
9 | you run the 'device-list-properties' QMP command for example: | ||
10 | 10 | ||
11 | $ echo "{'execute':'qmp_capabilities'}"\ | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | "{'execute':'device-list-properties',"\ | 12 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
13 | " 'arguments':{'typename':'allwinner-a10'}}" \ | 13 | Message-id: 20210723162146.5167-5-peter.maydell@linaro.org |
14 | | arm-softmmu/qemu-system-arm -M mps2-an505,accel=qtest -qmp stdio | 14 | --- |
15 | {"QMP": {"version": {"qemu": {"micro": 91, "minor": 11, "major": 2}, | 15 | hw/intc/armv7m_nvic.c | 9 ++++----- |
16 | "package": "build-all"}, "capabilities": []}} | 16 | 1 file changed, 4 insertions(+), 5 deletions(-) |
17 | {"return": {}} | ||
18 | Unsupported NIC model: lan9118 | ||
19 | 17 | ||
20 | ... and QEMU quits after printing the last line (which should not happen | 18 | diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c |
21 | just because of running 'device-list-properties' here). | ||
22 | |||
23 | And with the cubieboard, this even causes QEMU to abort(): | ||
24 | |||
25 | $ echo "{'execute':'qmp_capabilities'}"\ | ||
26 | "{'execute':'device-list-properties',"\ | ||
27 | " 'arguments':{'typename':'allwinner-a10'}}" \ | ||
28 | | arm-softmmu/qemu-system-arm -M cubieboard,accel=qtest -qmp stdio | ||
29 | {"QMP": {"version": {"qemu": {"micro": 91, "minor": 11, "major": 2}, | ||
30 | "package": "build-all"}, "capabilities": []}} | ||
31 | {"return": {}} | ||
32 | Unexpected error in error_set_from_qdev_prop_error() at hw/core/qdev-properties.c:1095: | ||
33 | Property 'allwinner-emac.netdev' can't take value 'hub0port0', it's in use | ||
34 | Aborted (core dumped) | ||
35 | |||
36 | To fix the problem we've got to move the offending code to the realize | ||
37 | function instead. | ||
38 | |||
39 | Signed-off-by: Thomas Huth <thuth@redhat.com> | ||
40 | Message-id: 1522862420-7484-1-git-send-email-thuth@redhat.com | ||
41 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
42 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
43 | --- | ||
44 | hw/arm/allwinner-a10.c | 12 ++++++------ | ||
45 | 1 file changed, 6 insertions(+), 6 deletions(-) | ||
46 | |||
47 | diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c | ||
48 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
49 | --- a/hw/arm/allwinner-a10.c | 20 | --- a/hw/intc/armv7m_nvic.c |
50 | +++ b/hw/arm/allwinner-a10.c | 21 | +++ b/hw/intc/armv7m_nvic.c |
51 | @@ -XXX,XX +XXX,XX @@ static void aw_a10_init(Object *obj) | 22 | @@ -XXX,XX +XXX,XX @@ static bool nvic_isrpending(NVICState *s) |
52 | 23 | { | |
53 | object_initialize(&s->emac, sizeof(s->emac), TYPE_AW_EMAC); | 24 | int irq; |
54 | qdev_set_parent_bus(DEVICE(&s->emac), sysbus_get_default()); | 25 | |
55 | - /* FIXME use qdev NIC properties instead of nd_table[] */ | 26 | - /* We can shortcut if the highest priority pending interrupt |
56 | - if (nd_table[0].used) { | 27 | - * happens to be external or if there is nothing pending. |
57 | - qemu_check_nic_model(&nd_table[0], TYPE_AW_EMAC); | 28 | + /* |
58 | - qdev_set_nic_properties(DEVICE(&s->emac), &nd_table[0]); | 29 | + * We can shortcut if the highest priority pending interrupt |
30 | + * happens to be external; if not we need to check the whole | ||
31 | + * vectors[] array. | ||
32 | */ | ||
33 | if (s->vectpending > NVIC_FIRST_IRQ) { | ||
34 | return true; | ||
35 | } | ||
36 | - if (s->vectpending == 0) { | ||
37 | - return false; | ||
59 | - } | 38 | - } |
60 | 39 | ||
61 | object_initialize(&s->sata, sizeof(s->sata), TYPE_ALLWINNER_AHCI); | 40 | for (irq = NVIC_FIRST_IRQ; irq < s->num_irq; irq++) { |
62 | qdev_set_parent_bus(DEVICE(&s->sata), sysbus_get_default()); | 41 | if (s->vectors[irq].pending) { |
63 | @@ -XXX,XX +XXX,XX @@ static void aw_a10_realize(DeviceState *dev, Error **errp) | ||
64 | sysbus_connect_irq(sysbusdev, 4, s->irq[67]); | ||
65 | sysbus_connect_irq(sysbusdev, 5, s->irq[68]); | ||
66 | |||
67 | + /* FIXME use qdev NIC properties instead of nd_table[] */ | ||
68 | + if (nd_table[0].used) { | ||
69 | + qemu_check_nic_model(&nd_table[0], TYPE_AW_EMAC); | ||
70 | + qdev_set_nic_properties(DEVICE(&s->emac), &nd_table[0]); | ||
71 | + } | ||
72 | object_property_set_bool(OBJECT(&s->emac), true, "realized", &err); | ||
73 | if (err != NULL) { | ||
74 | error_propagate(errp, err); | ||
75 | @@ -XXX,XX +XXX,XX @@ static void aw_a10_class_init(ObjectClass *oc, void *data) | ||
76 | DeviceClass *dc = DEVICE_CLASS(oc); | ||
77 | |||
78 | dc->realize = aw_a10_realize; | ||
79 | - /* Reason: Uses serial_hds in realize and nd_table in instance_init */ | ||
80 | + /* Reason: Uses serial_hds and nd_table in realize function */ | ||
81 | dc->user_creatable = false; | ||
82 | } | ||
83 | |||
84 | -- | 42 | -- |
85 | 2.16.2 | 43 | 2.20.1 |
86 | 44 | ||
87 | 45 | diff view generated by jsdifflib |
1 | When we run in TCG icount mode, we calculate the number of instructions | 1 | The VECTPENDING field in the ICSR is 9 bits wide, in bits [20:12] of |
---|---|---|---|
2 | to execute using tcg_get_icount_limit(), which ensures that we stop | 2 | the register. We were incorrectly masking it to 8 bits, so it would |
3 | execution at the next timer deadline. However there is a bug where | 3 | report the wrong value if the pending exception was greater than 256. |
4 | currently we do not recalculate that limit if the guest reprograms | 4 | Fix the bug. |
5 | a timer so that the next deadline moves closer, and so we will | ||
6 | continue execution until the original limit and fire the timer | ||
7 | later than we should. | ||
8 | 5 | ||
9 | Fix this bug in qemu_timer_notify_cb(): if we are currently running | ||
10 | a VCPU in icount mode, we simply need to kick it out of the main | ||
11 | loop and back to tcg_cpu_exec(), where it will recalculate the | ||
12 | icount limit. If we are not currently running a VCPU, then we | ||
13 | retain the existing logic for waking up a halted CPU. | ||
14 | |||
15 | Cc: qemu-stable@nongnu.org | ||
16 | Fixes: https://bugs.launchpad.net/qemu/+bug/1754038 | ||
17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
18 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
19 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | 8 | Message-id: 20210723162146.5167-6-peter.maydell@linaro.org |
20 | Message-id: 20180406123838.21249-1-peter.maydell@linaro.org | ||
21 | --- | 9 | --- |
22 | cpus.c | 10 +++++++++- | 10 | hw/intc/armv7m_nvic.c | 2 +- |
23 | 1 file changed, 9 insertions(+), 1 deletion(-) | 11 | 1 file changed, 1 insertion(+), 1 deletion(-) |
24 | 12 | ||
25 | diff --git a/cpus.c b/cpus.c | 13 | diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c |
26 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
27 | --- a/cpus.c | 15 | --- a/hw/intc/armv7m_nvic.c |
28 | +++ b/cpus.c | 16 | +++ b/hw/intc/armv7m_nvic.c |
29 | @@ -XXX,XX +XXX,XX @@ void qemu_timer_notify_cb(void *opaque, QEMUClockType type) | 17 | @@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs) |
30 | return; | 18 | /* VECTACTIVE */ |
31 | } | 19 | val = cpu->env.v7m.exception; |
32 | 20 | /* VECTPENDING */ | |
33 | - if (!qemu_in_vcpu_thread() && first_cpu) { | 21 | - val |= (s->vectpending & 0xff) << 12; |
34 | + if (qemu_in_vcpu_thread()) { | 22 | + val |= (s->vectpending & 0x1ff) << 12; |
35 | + /* A CPU is currently running; kick it back out to the | 23 | /* ISRPENDING - set if any external IRQ is pending */ |
36 | + * tcg_cpu_exec() loop so it will recalculate its | 24 | if (nvic_isrpending(s)) { |
37 | + * icount deadline immediately. | 25 | val |= (1 << 22); |
38 | + */ | ||
39 | + qemu_cpu_kick(current_cpu); | ||
40 | + } else if (first_cpu) { | ||
41 | /* qemu_cpu_kick is not enough to kick a halted CPU out of | ||
42 | * qemu_tcg_wait_io_event. async_run_on_cpu, instead, | ||
43 | * causes cpu_thread_is_idle to return false. This way, | ||
44 | * handle_icount_deadline can run. | ||
45 | + * If we have no CPUs at all for some reason, we don't | ||
46 | + * need to do anything. | ||
47 | */ | ||
48 | async_run_on_cpu(first_cpu, do_nothing, RUN_ON_CPU_NULL); | ||
49 | } | ||
50 | -- | 26 | -- |
51 | 2.16.2 | 27 | 2.20.1 |
52 | 28 | ||
53 | 29 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | In Arm v8.1M the VECTPENDING field in the ICSR has new behaviour: if |
---|---|---|---|
2 | the register is accessed NonSecure and the highest priority pending | ||
3 | enabled exception (that would be returned in the VECTPENDING field) | ||
4 | targets Secure, then the VECTPENDING field must read 1 rather than | ||
5 | the exception number of the pending exception. Implement this. | ||
2 | 6 | ||
3 | The parameters for tcg_gen_insn_start are target_ulong, which may be split | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | into two TCGArg parameters for storage in the opcode on 32-bit hosts. | 8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Message-id: 20210723162146.5167-7-peter.maydell@linaro.org | ||
10 | --- | ||
11 | hw/intc/armv7m_nvic.c | 31 ++++++++++++++++++++++++------- | ||
12 | 1 file changed, 24 insertions(+), 7 deletions(-) | ||
5 | 13 | ||
6 | Fixes the ARM target and its direct use of tcg_set_insn_param, which would | 14 | diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c |
7 | set the wrong argument in the 64-on-32 case. | ||
8 | |||
9 | Cc: qemu-stable@nongnu.org | ||
10 | Reported-by: alarson@ddci.com | ||
11 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
12 | Message-id: 20180410003558.2470-1-richard.henderson@linaro.org | ||
13 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
15 | --- | ||
16 | target/arm/translate.h | 2 +- | ||
17 | tcg/tcg.h | 10 ++++++++++ | ||
18 | 2 files changed, 11 insertions(+), 1 deletion(-) | ||
19 | |||
20 | diff --git a/target/arm/translate.h b/target/arm/translate.h | ||
21 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/target/arm/translate.h | 16 | --- a/hw/intc/armv7m_nvic.c |
23 | +++ b/target/arm/translate.h | 17 | +++ b/hw/intc/armv7m_nvic.c |
24 | @@ -XXX,XX +XXX,XX @@ static inline void disas_set_insn_syndrome(DisasContext *s, uint32_t syn) | 18 | @@ -XXX,XX +XXX,XX @@ void armv7m_nvic_acknowledge_irq(void *opaque) |
25 | 19 | nvic_irq_update(s); | |
26 | /* We check and clear insn_start_idx to catch multiple updates. */ | ||
27 | assert(s->insn_start != NULL); | ||
28 | - tcg_set_insn_param(s->insn_start, 2, syn); | ||
29 | + tcg_set_insn_start_param(s->insn_start, 2, syn); | ||
30 | s->insn_start = NULL; | ||
31 | } | 20 | } |
32 | 21 | ||
33 | diff --git a/tcg/tcg.h b/tcg/tcg.h | 22 | +static bool vectpending_targets_secure(NVICState *s) |
34 | index XXXXXXX..XXXXXXX 100644 | ||
35 | --- a/tcg/tcg.h | ||
36 | +++ b/tcg/tcg.h | ||
37 | @@ -XXX,XX +XXX,XX @@ static inline void tcg_set_insn_param(TCGOp *op, int arg, TCGArg v) | ||
38 | op->args[arg] = v; | ||
39 | } | ||
40 | |||
41 | +static inline void tcg_set_insn_start_param(TCGOp *op, int arg, target_ulong v) | ||
42 | +{ | 23 | +{ |
43 | +#if TARGET_LONG_BITS <= TCG_TARGET_REG_BITS | 24 | + /* Return true if s->vectpending targets Secure state */ |
44 | + tcg_set_insn_param(op, arg, v); | 25 | + if (s->vectpending_is_s_banked) { |
45 | +#else | 26 | + return true; |
46 | + tcg_set_insn_param(op, arg * 2, v); | 27 | + } |
47 | + tcg_set_insn_param(op, arg * 2 + 1, v >> 32); | 28 | + return !exc_is_banked(s->vectpending) && |
48 | +#endif | 29 | + exc_targets_secure(s, s->vectpending); |
49 | +} | 30 | +} |
50 | + | 31 | + |
51 | /* The last op that was emitted. */ | 32 | void armv7m_nvic_get_pending_irq_info(void *opaque, |
52 | static inline TCGOp *tcg_last_op(void) | 33 | int *pirq, bool *ptargets_secure) |
53 | { | 34 | { |
35 | @@ -XXX,XX +XXX,XX @@ void armv7m_nvic_get_pending_irq_info(void *opaque, | ||
36 | |||
37 | assert(pending > ARMV7M_EXCP_RESET && pending < s->num_irq); | ||
38 | |||
39 | - if (s->vectpending_is_s_banked) { | ||
40 | - targets_secure = true; | ||
41 | - } else { | ||
42 | - targets_secure = !exc_is_banked(pending) && | ||
43 | - exc_targets_secure(s, pending); | ||
44 | - } | ||
45 | + targets_secure = vectpending_targets_secure(s); | ||
46 | |||
47 | trace_nvic_get_pending_irq_info(pending, targets_secure); | ||
48 | |||
49 | @@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs) | ||
50 | /* VECTACTIVE */ | ||
51 | val = cpu->env.v7m.exception; | ||
52 | /* VECTPENDING */ | ||
53 | - val |= (s->vectpending & 0x1ff) << 12; | ||
54 | + if (s->vectpending) { | ||
55 | + /* | ||
56 | + * From v8.1M VECTPENDING must read as 1 if accessed as | ||
57 | + * NonSecure and the highest priority pending and enabled | ||
58 | + * exception targets Secure. | ||
59 | + */ | ||
60 | + int vp = s->vectpending; | ||
61 | + if (!attrs.secure && arm_feature(&cpu->env, ARM_FEATURE_V8_1M) && | ||
62 | + vectpending_targets_secure(s)) { | ||
63 | + vp = 1; | ||
64 | + } | ||
65 | + val |= (vp & 0x1ff) << 12; | ||
66 | + } | ||
67 | /* ISRPENDING - set if any external IRQ is pending */ | ||
68 | if (nvic_isrpending(s)) { | ||
69 | val |= (1 << 22); | ||
54 | -- | 70 | -- |
55 | 2.16.2 | 71 | 2.20.1 |
56 | 72 | ||
57 | 73 | diff view generated by jsdifflib |
1 | From: Thomas Huth <thuth@redhat.com> | 1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> |
---|---|---|---|
2 | 2 | ||
3 | An instance_init function must not fail - and might be called multiple times, | 3 | Missed in commit f3478392 "docs: Move deprecation, build |
4 | e.g. during device introspection with the 'device-list-properties' QMP | 4 | and license info out of system/" |
5 | command. Since the integratorcm device ignores this rule, QEMU currently | ||
6 | aborts in this case (though it really should not): | ||
7 | 5 | ||
8 | echo "{'execute':'qmp_capabilities'}"\ | 6 | Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> |
9 | "{'execute':'device-list-properties',"\ | 7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
10 | "'arguments':{'typename':'integrator_core'}}" \ | 8 | Message-id: 20210723065828.1336760-1-maozhongyi@cmss.chinamobile.com |
11 | | arm-softmmu/qemu-system-arm -M integratorcp,accel=qtest -qmp stdio | ||
12 | {"QMP": {"version": {"qemu": {"micro": 91, "minor": 11, "major": 2}, | ||
13 | "package": "build-all"}, "capabilities": []}} | ||
14 | {"return": {}} | ||
15 | RAMBlock "integrator.flash" already registered, abort! | ||
16 | Aborted (core dumped) | ||
17 | |||
18 | Move the problematic code to the realize() function instead to fix this | ||
19 | problem. | ||
20 | |||
21 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
22 | Signed-off-by: Thomas Huth <thuth@redhat.com> | ||
23 | Message-id: 1522906473-11252-1-git-send-email-thuth@redhat.com | ||
24 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
25 | --- | 10 | --- |
26 | hw/arm/integratorcp.c | 23 +++++++++++++++-------- | 11 | configure | 2 +- |
27 | 1 file changed, 15 insertions(+), 8 deletions(-) | 12 | target/i386/cpu.c | 2 +- |
13 | MAINTAINERS | 2 +- | ||
14 | 3 files changed, 3 insertions(+), 3 deletions(-) | ||
28 | 15 | ||
29 | diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c | 16 | diff --git a/configure b/configure |
17 | index XXXXXXX..XXXXXXX 100755 | ||
18 | --- a/configure | ||
19 | +++ b/configure | ||
20 | @@ -XXX,XX +XXX,XX @@ fi | ||
21 | |||
22 | if test -n "${deprecated_features}"; then | ||
23 | echo "Warning, deprecated features enabled." | ||
24 | - echo "Please see docs/system/deprecated.rst" | ||
25 | + echo "Please see docs/about/deprecated.rst" | ||
26 | echo " features: ${deprecated_features}" | ||
27 | fi | ||
28 | |||
29 | diff --git a/target/i386/cpu.c b/target/i386/cpu.c | ||
30 | index XXXXXXX..XXXXXXX 100644 | 30 | index XXXXXXX..XXXXXXX 100644 |
31 | --- a/hw/arm/integratorcp.c | 31 | --- a/target/i386/cpu.c |
32 | +++ b/hw/arm/integratorcp.c | 32 | +++ b/target/i386/cpu.c |
33 | @@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps integratorcm_ops = { | 33 | @@ -XXX,XX +XXX,XX @@ static const X86CPUDefinition builtin_x86_defs[] = { |
34 | static void integratorcm_init(Object *obj) | 34 | * none", but this is just for compatibility while libvirt isn't |
35 | { | 35 | * adapted to resolve CPU model versions before creating VMs. |
36 | IntegratorCMState *s = INTEGRATOR_CM(obj); | 36 | * See "Runnability guarantee of CPU models" at |
37 | - SysBusDevice *dev = SYS_BUS_DEVICE(obj); | 37 | - * docs/system/deprecated.rst. |
38 | 38 | + * docs/about/deprecated.rst. | |
39 | s->cm_osc = 0x01000048; | 39 | */ |
40 | /* ??? What should the high bits of this value be? */ | 40 | X86CPUVersion default_cpu_version = 1; |
41 | @@ -XXX,XX +XXX,XX @@ static void integratorcm_init(Object *obj) | 41 | |
42 | s->cm_init = 0x00000112; | 42 | diff --git a/MAINTAINERS b/MAINTAINERS |
43 | s->cm_refcnt_offset = muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL), 24, | 43 | index XXXXXXX..XXXXXXX 100644 |
44 | 1000); | 44 | --- a/MAINTAINERS |
45 | - memory_region_init_ram(&s->flash, obj, "integrator.flash", 0x100000, | 45 | +++ b/MAINTAINERS |
46 | - &error_fatal); | 46 | @@ -XXX,XX +XXX,XX @@ F: contrib/gitdm/* |
47 | 47 | ||
48 | - memory_region_init_io(&s->iomem, obj, &integratorcm_ops, s, | 48 | Incompatible changes |
49 | - "integratorcm", 0x00800000); | 49 | R: libvir-list@redhat.com |
50 | - sysbus_init_mmio(dev, &s->iomem); | 50 | -F: docs/system/deprecated.rst |
51 | - | 51 | +F: docs/about/deprecated.rst |
52 | - integratorcm_do_remap(s); | 52 | |
53 | /* ??? Save/restore. */ | 53 | Build System |
54 | } | 54 | ------------ |
55 | |||
56 | static void integratorcm_realize(DeviceState *d, Error **errp) | ||
57 | { | ||
58 | IntegratorCMState *s = INTEGRATOR_CM(d); | ||
59 | + SysBusDevice *dev = SYS_BUS_DEVICE(d); | ||
60 | + Error *local_err = NULL; | ||
61 | + | ||
62 | + memory_region_init_ram(&s->flash, OBJECT(d), "integrator.flash", 0x100000, | ||
63 | + &local_err); | ||
64 | + if (local_err) { | ||
65 | + error_propagate(errp, local_err); | ||
66 | + return; | ||
67 | + } | ||
68 | + | ||
69 | + memory_region_init_io(&s->iomem, OBJECT(d), &integratorcm_ops, s, | ||
70 | + "integratorcm", 0x00800000); | ||
71 | + sysbus_init_mmio(dev, &s->iomem); | ||
72 | + | ||
73 | + integratorcm_do_remap(s); | ||
74 | |||
75 | if (s->memsz >= 256) { | ||
76 | integrator_spd[31] = 64; | ||
77 | -- | 55 | -- |
78 | 2.16.2 | 56 | 2.20.1 |
79 | 57 | ||
80 | 58 | diff view generated by jsdifflib |
1 | Currently our PMSAv7 and ARMv7M MPU implementation cannot handle | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | MPU region sizes smaller than our TARGET_PAGE_SIZE. However we | ||
3 | report that in a slightly confusing way: | ||
4 | 2 | ||
5 | DRSR[3]: No support for MPU (sub)region alignment of 9 bits. Minimum is 10 | 3 | Currently, our only caller is sve_zcr_len_for_el, which has |
4 | already masked the length extracted from ZCR_ELx, so the | ||
5 | masking done here is a nop. But we will shortly have uses | ||
6 | from other locations, where the length will be unmasked. | ||
6 | 7 | ||
7 | The problem is not the alignment of the region, but its size; | 8 | Saturate the length to ARM_MAX_VQ instead of truncating to |
8 | tweak the error message to say so: | 9 | the low 4 bits. |
9 | DRSR[3]: No support for MPU (sub)region size of 512 bytes. Minimum is 1024. | ||
10 | 10 | ||
11 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
12 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | Message-id: 20210723203344.968563-2-richard.henderson@linaro.org | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
13 | Message-id: 20180405172554.27401-1-peter.maydell@linaro.org | ||
14 | --- | 15 | --- |
15 | target/arm/helper.c | 6 +++--- | 16 | target/arm/helper.c | 4 +++- |
16 | 1 file changed, 3 insertions(+), 3 deletions(-) | 17 | 1 file changed, 3 insertions(+), 1 deletion(-) |
17 | 18 | ||
18 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 19 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
19 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/target/arm/helper.c | 21 | --- a/target/arm/helper.c |
21 | +++ b/target/arm/helper.c | 22 | +++ b/target/arm/helper.c |
22 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address, | 23 | @@ -XXX,XX +XXX,XX @@ static uint32_t sve_zcr_get_valid_len(ARMCPU *cpu, uint32_t start_len) |
23 | } | 24 | { |
24 | if (rsize < TARGET_PAGE_BITS) { | 25 | uint32_t end_len; |
25 | qemu_log_mask(LOG_UNIMP, | 26 | |
26 | - "DRSR[%d]: No support for MPU (sub)region " | 27 | - end_len = start_len &= 0xf; |
27 | - "alignment of %" PRIu32 " bits. Minimum is %d\n", | 28 | + start_len = MIN(start_len, ARM_MAX_VQ - 1); |
28 | - n, rsize, TARGET_PAGE_BITS); | 29 | + end_len = start_len; |
29 | + "DRSR[%d]: No support for MPU (sub)region size of" | 30 | + |
30 | + " %" PRIu32 " bytes. Minimum is %d.\n", | 31 | if (!test_bit(start_len, cpu->sve_vq_map)) { |
31 | + n, (1 << rsize), TARGET_PAGE_SIZE); | 32 | end_len = find_last_bit(cpu->sve_vq_map, start_len); |
32 | continue; | 33 | assert(end_len < start_len); |
33 | } | ||
34 | if (srdis) { | ||
35 | -- | 34 | -- |
36 | 2.16.2 | 35 | 2.20.1 |
37 | 36 | ||
38 | 37 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | We incorrectly passed in the current rounding mode | 3 | Rename from sve_zcr_get_valid_len and make accessible |
4 | instead of float_round_to_zero. | 4 | from outside of helper.c. |
5 | 5 | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Message-id: 20180410055912.934-1-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Message-id: 20210723203344.968563-3-richard.henderson@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 10 | --- |
11 | fpu/softfloat.c | 4 ++-- | 11 | target/arm/internals.h | 10 ++++++++++ |
12 | 1 file changed, 2 insertions(+), 2 deletions(-) | 12 | target/arm/helper.c | 4 ++-- |
13 | 2 files changed, 12 insertions(+), 2 deletions(-) | ||
13 | 14 | ||
14 | diff --git a/fpu/softfloat.c b/fpu/softfloat.c | 15 | diff --git a/target/arm/internals.h b/target/arm/internals.h |
15 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/fpu/softfloat.c | 17 | --- a/target/arm/internals.h |
17 | +++ b/fpu/softfloat.c | 18 | +++ b/target/arm/internals.h |
18 | @@ -XXX,XX +XXX,XX @@ uint ## isz ## _t float ## fsz ## _to_uint ## isz ## _round_to_zero \ | 19 | @@ -XXX,XX +XXX,XX @@ void arm_translate_init(void); |
19 | (float ## fsz a, float_status *s) \ | 20 | void arm_cpu_synchronize_from_tb(CPUState *cs, const TranslationBlock *tb); |
20 | { \ | 21 | #endif /* CONFIG_TCG */ |
21 | FloatParts p = float ## fsz ## _unpack_canonical(a, s); \ | 22 | |
22 | - return round_to_uint_and_pack(p, s->float_rounding_mode, \ | 23 | +/** |
23 | - UINT ## isz ## _MAX, s); \ | 24 | + * aarch64_sve_zcr_get_valid_len: |
24 | + return round_to_uint_and_pack(p, float_round_to_zero, \ | 25 | + * @cpu: cpu context |
25 | + UINT ## isz ## _MAX, s); \ | 26 | + * @start_len: maximum len to consider |
27 | + * | ||
28 | + * Return the maximum supported sve vector length <= @start_len. | ||
29 | + * Note that both @start_len and the return value are in units | ||
30 | + * of ZCR_ELx.LEN, so the vector bit length is (x + 1) * 128. | ||
31 | + */ | ||
32 | +uint32_t aarch64_sve_zcr_get_valid_len(ARMCPU *cpu, uint32_t start_len); | ||
33 | |||
34 | enum arm_fprounding { | ||
35 | FPROUNDING_TIEEVEN, | ||
36 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
37 | index XXXXXXX..XXXXXXX 100644 | ||
38 | --- a/target/arm/helper.c | ||
39 | +++ b/target/arm/helper.c | ||
40 | @@ -XXX,XX +XXX,XX @@ int sve_exception_el(CPUARMState *env, int el) | ||
41 | return 0; | ||
26 | } | 42 | } |
27 | 43 | ||
28 | FLOAT_TO_UINT(16, 16) | 44 | -static uint32_t sve_zcr_get_valid_len(ARMCPU *cpu, uint32_t start_len) |
45 | +uint32_t aarch64_sve_zcr_get_valid_len(ARMCPU *cpu, uint32_t start_len) | ||
46 | { | ||
47 | uint32_t end_len; | ||
48 | |||
49 | @@ -XXX,XX +XXX,XX @@ uint32_t sve_zcr_len_for_el(CPUARMState *env, int el) | ||
50 | zcr_len = MIN(zcr_len, 0xf & (uint32_t)env->vfp.zcr_el[3]); | ||
51 | } | ||
52 | |||
53 | - return sve_zcr_get_valid_len(cpu, zcr_len); | ||
54 | + return aarch64_sve_zcr_get_valid_len(cpu, zcr_len); | ||
55 | } | ||
56 | |||
57 | static void zcr_write(CPUARMState *env, const ARMCPRegInfo *ri, | ||
29 | -- | 58 | -- |
30 | 2.16.2 | 59 | 2.20.1 |
31 | 60 | ||
32 | 61 | diff view generated by jsdifflib |
1 | From: Thomas Huth <thuth@redhat.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | QEMU currently exits unexpectedly when trying to introspect the fsl-imx6 | 3 | Mirror the behavour of /proc/sys/abi/sve_default_vector_length |
4 | and fsl-imx7 devices on systems with many SMP CPUs: | 4 | under the real linux kernel. We have no way of passing along |
5 | a real default across exec like the kernel can, but this is a | ||
6 | decent way of adjusting the startup vector length of a process. | ||
5 | 7 | ||
6 | $ echo "{'execute':'qmp_capabilities'}"\ | 8 | Resolves: https://gitlab.com/qemu-project/qemu/-/issues/482 |
7 | "{'execute':'device-list-properties',"\ | 9 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | " 'arguments':{'typename':'fsl,imx6'}}" \ | ||
9 | | arm-softmmu/qemu-system-arm -M virt,accel=qtest -qmp stdio -smp 8 | ||
10 | {"QMP": {"version": {"qemu": {"micro": 91, "minor": 11, "major": 2}, | ||
11 | "package": "build-all"}, "capabilities": []}} | ||
12 | {"return": {}} | ||
13 | fsl,imx6: Only 4 CPUs are supported (8 requested) | ||
14 | |||
15 | And: | ||
16 | |||
17 | $ echo "{'execute':'qmp_capabilities'}"\ | ||
18 | "{'execute':'device-list-properties',"\ | ||
19 | " 'arguments':{'typename':'fsl,imx7'}}" \ | ||
20 | | arm-softmmu/qemu-system-arm -M raspi2,accel=qtest -qmp stdio | ||
21 | {"QMP": {"version": {"qemu": {"micro": 91, "minor": 11, "major": 2}, | ||
22 | "package": "build-all"}, "capabilities": []}} | ||
23 | {"return": {}} | ||
24 | fsl,imx7: Only 2 CPUs are supported (4 requested) | ||
25 | |||
26 | This happens because these devices are doing an exit() from their | ||
27 | instance_init function - which should never be done since instance_init | ||
28 | can be called at any time for device introspection! Fix it by moving | ||
29 | the deadly check into the realize() function instead. | ||
30 | |||
31 | Signed-off-by: Thomas Huth <thuth@redhat.com> | ||
32 | Message-id: 1522908551-14885-1-git-send-email-thuth@redhat.com | ||
33 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Message-id: 20210723203344.968563-4-richard.henderson@linaro.org | ||
12 | [PMM: tweaked docs formatting, document -1 special-case, | ||
13 | added fixup patch from RTH mentioning QEMU's maximum veclen.] | ||
34 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
35 | --- | 15 | --- |
36 | hw/arm/fsl-imx6.c | 14 +++++++------- | 16 | docs/system/arm/cpu-features.rst | 15 ++++++++ |
37 | hw/arm/fsl-imx7.c | 13 +++++++------ | 17 | target/arm/cpu.h | 5 +++ |
38 | 2 files changed, 14 insertions(+), 13 deletions(-) | 18 | target/arm/cpu.c | 14 ++++++-- |
19 | target/arm/cpu64.c | 60 ++++++++++++++++++++++++++++++++ | ||
20 | 4 files changed, 92 insertions(+), 2 deletions(-) | ||
39 | 21 | ||
40 | diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c | 22 | diff --git a/docs/system/arm/cpu-features.rst b/docs/system/arm/cpu-features.rst |
41 | index XXXXXXX..XXXXXXX 100644 | 23 | index XXXXXXX..XXXXXXX 100644 |
42 | --- a/hw/arm/fsl-imx6.c | 24 | --- a/docs/system/arm/cpu-features.rst |
43 | +++ b/hw/arm/fsl-imx6.c | 25 | +++ b/docs/system/arm/cpu-features.rst |
44 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6_init(Object *obj) | 26 | @@ -XXX,XX +XXX,XX @@ verbose command lines. However, the recommended way to select vector |
45 | char name[NAME_SIZE]; | 27 | lengths is to explicitly enable each desired length. Therefore only |
46 | int i; | 28 | example's (1), (4), and (6) exhibit recommended uses of the properties. |
47 | 29 | ||
48 | - if (smp_cpus > FSL_IMX6_NUM_CPUS) { | 30 | +SVE User-mode Default Vector Length Property |
49 | - error_report("%s: Only %d CPUs are supported (%d requested)", | 31 | +-------------------------------------------- |
50 | - TYPE_FSL_IMX6, FSL_IMX6_NUM_CPUS, smp_cpus); | 32 | + |
51 | - exit(1); | 33 | +For qemu-aarch64, the cpu property ``sve-default-vector-length=N`` is |
52 | - } | 34 | +defined to mirror the Linux kernel parameter file |
53 | - | 35 | +``/proc/sys/abi/sve_default_vector_length``. The default length, ``N``, |
54 | - for (i = 0; i < smp_cpus; i++) { | 36 | +is in units of bytes and must be between 16 and 8192. |
55 | + for (i = 0; i < MIN(smp_cpus, FSL_IMX6_NUM_CPUS); i++) { | 37 | +If not specified, the default vector length is 64. |
56 | object_initialize(&s->cpu[i], sizeof(s->cpu[i]), | 38 | + |
57 | "cortex-a9-" TYPE_ARM_CPU); | 39 | +If the default length is larger than the maximum vector length enabled, |
58 | snprintf(name, NAME_SIZE, "cpu%d", i); | 40 | +the actual vector length will be reduced. Note that the maximum vector |
59 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) | 41 | +length supported by QEMU is 256. |
60 | uint16_t i; | 42 | + |
61 | Error *err = NULL; | 43 | +If this property is set to ``-1`` then the default vector length |
62 | 44 | +is set to the maximum possible length. | |
63 | + if (smp_cpus > FSL_IMX6_NUM_CPUS) { | 45 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h |
64 | + error_setg(errp, "%s: Only %d CPUs are supported (%d requested)", | 46 | index XXXXXXX..XXXXXXX 100644 |
65 | + TYPE_FSL_IMX6, FSL_IMX6_NUM_CPUS, smp_cpus); | 47 | --- a/target/arm/cpu.h |
48 | +++ b/target/arm/cpu.h | ||
49 | @@ -XXX,XX +XXX,XX @@ struct ARMCPU { | ||
50 | /* Used to set the maximum vector length the cpu will support. */ | ||
51 | uint32_t sve_max_vq; | ||
52 | |||
53 | +#ifdef CONFIG_USER_ONLY | ||
54 | + /* Used to set the default vector length at process start. */ | ||
55 | + uint32_t sve_default_vq; | ||
56 | +#endif | ||
57 | + | ||
58 | /* | ||
59 | * In sve_vq_map each set bit is a supported vector length of | ||
60 | * (bit-number + 1) * 16 bytes, i.e. each bit number + 1 is the vector | ||
61 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | ||
62 | index XXXXXXX..XXXXXXX 100644 | ||
63 | --- a/target/arm/cpu.c | ||
64 | +++ b/target/arm/cpu.c | ||
65 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset(DeviceState *dev) | ||
66 | env->cp15.cpacr_el1 = deposit64(env->cp15.cpacr_el1, 16, 2, 3); | ||
67 | /* with reasonable vector length */ | ||
68 | if (cpu_isar_feature(aa64_sve, cpu)) { | ||
69 | - env->vfp.zcr_el[1] = MIN(cpu->sve_max_vq - 1, 3); | ||
70 | + env->vfp.zcr_el[1] = | ||
71 | + aarch64_sve_zcr_get_valid_len(cpu, cpu->sve_default_vq - 1); | ||
72 | } | ||
73 | /* | ||
74 | * Enable TBI0 but not TBI1. | ||
75 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_initfn(Object *obj) | ||
76 | QLIST_INIT(&cpu->pre_el_change_hooks); | ||
77 | QLIST_INIT(&cpu->el_change_hooks); | ||
78 | |||
79 | -#ifndef CONFIG_USER_ONLY | ||
80 | +#ifdef CONFIG_USER_ONLY | ||
81 | +# ifdef TARGET_AARCH64 | ||
82 | + /* | ||
83 | + * The linux kernel defaults to 512-bit vectors, when sve is supported. | ||
84 | + * See documentation for /proc/sys/abi/sve_default_vector_length, and | ||
85 | + * our corresponding sve-default-vector-length cpu property. | ||
86 | + */ | ||
87 | + cpu->sve_default_vq = 4; | ||
88 | +# endif | ||
89 | +#else | ||
90 | /* Our inbound IRQ and FIQ lines */ | ||
91 | if (kvm_enabled()) { | ||
92 | /* VIRQ and VFIQ are unused with KVM but we add them to maintain | ||
93 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | ||
94 | index XXXXXXX..XXXXXXX 100644 | ||
95 | --- a/target/arm/cpu64.c | ||
96 | +++ b/target/arm/cpu64.c | ||
97 | @@ -XXX,XX +XXX,XX @@ static void cpu_arm_set_sve(Object *obj, bool value, Error **errp) | ||
98 | cpu->isar.id_aa64pfr0 = t; | ||
99 | } | ||
100 | |||
101 | +#ifdef CONFIG_USER_ONLY | ||
102 | +/* Mirror linux /proc/sys/abi/sve_default_vector_length. */ | ||
103 | +static void cpu_arm_set_sve_default_vec_len(Object *obj, Visitor *v, | ||
104 | + const char *name, void *opaque, | ||
105 | + Error **errp) | ||
106 | +{ | ||
107 | + ARMCPU *cpu = ARM_CPU(obj); | ||
108 | + int32_t default_len, default_vq, remainder; | ||
109 | + | ||
110 | + if (!visit_type_int32(v, name, &default_len, errp)) { | ||
66 | + return; | 111 | + return; |
67 | + } | 112 | + } |
68 | + | 113 | + |
69 | for (i = 0; i < smp_cpus; i++) { | 114 | + /* Undocumented, but the kernel allows -1 to indicate "maximum". */ |
70 | 115 | + if (default_len == -1) { | |
71 | /* On uniprocessor, the CBAR is set to 0 */ | 116 | + cpu->sve_default_vq = ARM_MAX_VQ; |
72 | diff --git a/hw/arm/fsl-imx7.c b/hw/arm/fsl-imx7.c | ||
73 | index XXXXXXX..XXXXXXX 100644 | ||
74 | --- a/hw/arm/fsl-imx7.c | ||
75 | +++ b/hw/arm/fsl-imx7.c | ||
76 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx7_init(Object *obj) | ||
77 | char name[NAME_SIZE]; | ||
78 | int i; | ||
79 | |||
80 | - if (smp_cpus > FSL_IMX7_NUM_CPUS) { | ||
81 | - error_report("%s: Only %d CPUs are supported (%d requested)", | ||
82 | - TYPE_FSL_IMX7, FSL_IMX7_NUM_CPUS, smp_cpus); | ||
83 | - exit(1); | ||
84 | - } | ||
85 | |||
86 | - for (i = 0; i < smp_cpus; i++) { | ||
87 | + for (i = 0; i < MIN(smp_cpus, FSL_IMX7_NUM_CPUS); i++) { | ||
88 | object_initialize(&s->cpu[i], sizeof(s->cpu[i]), | ||
89 | ARM_CPU_TYPE_NAME("cortex-a7")); | ||
90 | snprintf(name, NAME_SIZE, "cpu%d", i); | ||
91 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp) | ||
92 | qemu_irq irq; | ||
93 | char name[NAME_SIZE]; | ||
94 | |||
95 | + if (smp_cpus > FSL_IMX7_NUM_CPUS) { | ||
96 | + error_setg(errp, "%s: Only %d CPUs are supported (%d requested)", | ||
97 | + TYPE_FSL_IMX7, FSL_IMX7_NUM_CPUS, smp_cpus); | ||
98 | + return; | 117 | + return; |
99 | + } | 118 | + } |
100 | + | 119 | + |
101 | for (i = 0; i < smp_cpus; i++) { | 120 | + default_vq = default_len / 16; |
102 | o = OBJECT(&s->cpu[i]); | 121 | + remainder = default_len % 16; |
103 | 122 | + | |
123 | + /* | ||
124 | + * Note that the 512 max comes from include/uapi/asm/sve_context.h | ||
125 | + * and is the maximum architectural width of ZCR_ELx.LEN. | ||
126 | + */ | ||
127 | + if (remainder || default_vq < 1 || default_vq > 512) { | ||
128 | + error_setg(errp, "cannot set sve-default-vector-length"); | ||
129 | + if (remainder) { | ||
130 | + error_append_hint(errp, "Vector length not a multiple of 16\n"); | ||
131 | + } else if (default_vq < 1) { | ||
132 | + error_append_hint(errp, "Vector length smaller than 16\n"); | ||
133 | + } else { | ||
134 | + error_append_hint(errp, "Vector length larger than %d\n", | ||
135 | + 512 * 16); | ||
136 | + } | ||
137 | + return; | ||
138 | + } | ||
139 | + | ||
140 | + cpu->sve_default_vq = default_vq; | ||
141 | +} | ||
142 | + | ||
143 | +static void cpu_arm_get_sve_default_vec_len(Object *obj, Visitor *v, | ||
144 | + const char *name, void *opaque, | ||
145 | + Error **errp) | ||
146 | +{ | ||
147 | + ARMCPU *cpu = ARM_CPU(obj); | ||
148 | + int32_t value = cpu->sve_default_vq * 16; | ||
149 | + | ||
150 | + visit_type_int32(v, name, &value, errp); | ||
151 | +} | ||
152 | +#endif | ||
153 | + | ||
154 | void aarch64_add_sve_properties(Object *obj) | ||
155 | { | ||
156 | uint32_t vq; | ||
157 | @@ -XXX,XX +XXX,XX @@ void aarch64_add_sve_properties(Object *obj) | ||
158 | object_property_add(obj, name, "bool", cpu_arm_get_sve_vq, | ||
159 | cpu_arm_set_sve_vq, NULL, NULL); | ||
160 | } | ||
161 | + | ||
162 | +#ifdef CONFIG_USER_ONLY | ||
163 | + /* Mirror linux /proc/sys/abi/sve_default_vector_length. */ | ||
164 | + object_property_add(obj, "sve-default-vector-length", "int32", | ||
165 | + cpu_arm_get_sve_default_vec_len, | ||
166 | + cpu_arm_set_sve_default_vec_len, NULL, NULL); | ||
167 | +#endif | ||
168 | } | ||
169 | |||
170 | void arm_cpu_pauth_finalize(ARMCPU *cpu, Error **errp) | ||
104 | -- | 171 | -- |
105 | 2.16.2 | 172 | 2.20.1 |
106 | 173 | ||
107 | 174 | diff view generated by jsdifflib |
1 | Add some tracepoints to the bcm2835_sdhost driver, to assist | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | debugging. | ||
3 | 2 | ||
3 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
5 | Message-id: 20210726150953.1218690-1-f4bug@amsat.org | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
6 | Tested-by: Gerd Hoffmann <kraxel@redhat.com> | ||
7 | Message-id: 20180319161556.16446-2-peter.maydell@linaro.org | ||
8 | --- | 7 | --- |
9 | hw/sd/bcm2835_sdhost.c | 10 ++++++++++ | 8 | hw/arm/nseries.c | 2 +- |
10 | hw/sd/trace-events | 6 ++++++ | 9 | 1 file changed, 1 insertion(+), 1 deletion(-) |
11 | 2 files changed, 16 insertions(+) | ||
12 | 10 | ||
13 | diff --git a/hw/sd/bcm2835_sdhost.c b/hw/sd/bcm2835_sdhost.c | 11 | diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c |
14 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/hw/sd/bcm2835_sdhost.c | 13 | --- a/hw/arm/nseries.c |
16 | +++ b/hw/sd/bcm2835_sdhost.c | 14 | +++ b/hw/arm/nseries.c |
17 | @@ -XXX,XX +XXX,XX @@ | 15 | @@ -XXX,XX +XXX,XX @@ static uint32_t mipid_txrx(void *opaque, uint32_t cmd, int len) |
18 | #include "qemu/log.h" | 16 | default: |
19 | #include "sysemu/blockdev.h" | 17 | bad_cmd: |
20 | #include "hw/sd/bcm2835_sdhost.h" | 18 | qemu_log_mask(LOG_GUEST_ERROR, |
21 | +#include "trace.h" | 19 | - "%s: unknown command %02x\n", __func__, s->cmd); |
22 | 20 | + "%s: unknown command 0x%02x\n", __func__, s->cmd); | |
23 | #define TYPE_BCM2835_SDHOST_BUS "bcm2835-sdhost-bus" | ||
24 | #define BCM2835_SDHOST_BUS(obj) \ | ||
25 | @@ -XXX,XX +XXX,XX @@ static void bcm2835_sdhost_update_irq(BCM2835SDHostState *s) | ||
26 | { | ||
27 | uint32_t irq = s->status & | ||
28 | (SDHSTS_BUSY_IRPT | SDHSTS_BLOCK_IRPT | SDHSTS_SDIO_IRPT); | ||
29 | + trace_bcm2835_sdhost_update_irq(irq); | ||
30 | qemu_set_irq(s->irq, !!irq); | ||
31 | } | ||
32 | |||
33 | @@ -XXX,XX +XXX,XX @@ static void bcm2835_sdhost_fifo_run(BCM2835SDHostState *s) | ||
34 | |||
35 | s->edm &= ~0xf; | ||
36 | s->edm |= SDEDM_FSM_DATAMODE; | ||
37 | + trace_bcm2835_sdhost_edm_change("datacnt 0", s->edm); | ||
38 | |||
39 | if (s->config & SDHCFG_DATA_IRPT_EN) { | ||
40 | s->status |= SDHSTS_SDIO_IRPT; | ||
41 | @@ -XXX,XX +XXX,XX @@ static void bcm2835_sdhost_fifo_run(BCM2835SDHostState *s) | ||
42 | |||
43 | s->edm &= ~(0x1f << 4); | ||
44 | s->edm |= ((s->fifo_len & 0x1f) << 4); | ||
45 | + trace_bcm2835_sdhost_edm_change("fifo run", s->edm); | ||
46 | } | ||
47 | |||
48 | static uint64_t bcm2835_sdhost_read(void *opaque, hwaddr offset, | ||
49 | @@ -XXX,XX +XXX,XX @@ static uint64_t bcm2835_sdhost_read(void *opaque, hwaddr offset, | ||
50 | break; | 21 | break; |
51 | } | 22 | } |
52 | 23 | ||
53 | + trace_bcm2835_sdhost_read(offset, res, size); | ||
54 | + | ||
55 | return res; | ||
56 | } | ||
57 | |||
58 | @@ -XXX,XX +XXX,XX @@ static void bcm2835_sdhost_write(void *opaque, hwaddr offset, | ||
59 | { | ||
60 | BCM2835SDHostState *s = (BCM2835SDHostState *)opaque; | ||
61 | |||
62 | + trace_bcm2835_sdhost_write(offset, value, size); | ||
63 | + | ||
64 | switch (offset) { | ||
65 | case SDCMD: | ||
66 | s->cmd = value; | ||
67 | @@ -XXX,XX +XXX,XX @@ static void bcm2835_sdhost_write(void *opaque, hwaddr offset, | ||
68 | value &= ~0xf; | ||
69 | } | ||
70 | s->edm = value; | ||
71 | + trace_bcm2835_sdhost_edm_change("guest register write", s->edm); | ||
72 | break; | ||
73 | case SDHCFG: | ||
74 | s->config = value; | ||
75 | @@ -XXX,XX +XXX,XX @@ static void bcm2835_sdhost_reset(DeviceState *dev) | ||
76 | s->cmd = 0; | ||
77 | s->cmdarg = 0; | ||
78 | s->edm = 0x0000c60f; | ||
79 | + trace_bcm2835_sdhost_edm_change("device reset", s->edm); | ||
80 | s->config = 0; | ||
81 | s->hbct = 0; | ||
82 | s->hblc = 0; | ||
83 | diff --git a/hw/sd/trace-events b/hw/sd/trace-events | ||
84 | index XXXXXXX..XXXXXXX 100644 | ||
85 | --- a/hw/sd/trace-events | ||
86 | +++ b/hw/sd/trace-events | ||
87 | @@ -XXX,XX +XXX,XX @@ | ||
88 | # See docs/devel/tracing.txt for syntax documentation. | ||
89 | |||
90 | +# hw/sd/bcm2835_sdhost.c | ||
91 | +bcm2835_sdhost_read(uint64_t offset, uint64_t data, unsigned size) "offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u" | ||
92 | +bcm2835_sdhost_write(uint64_t offset, uint64_t data, unsigned size) "offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u" | ||
93 | +bcm2835_sdhost_edm_change(const char *why, uint32_t edm) "(%s) EDM now 0x%x" | ||
94 | +bcm2835_sdhost_update_irq(uint32_t irq) "IRQ bits 0x%x\n" | ||
95 | + | ||
96 | # hw/sd/core.c | ||
97 | sdbus_command(const char *bus_name, uint8_t cmd, uint32_t arg, uint8_t crc) "@%s CMD%02d arg 0x%08x crc 0x%02x" | ||
98 | sdbus_read(const char *bus_name, uint8_t value) "@%s value 0x%02x" | ||
99 | -- | 24 | -- |
100 | 2.16.2 | 25 | 2.20.1 |
101 | 26 | ||
102 | 27 | diff view generated by jsdifflib |
1 | From: Andrey Smirnov <andrew.smirnov@gmail.com> | 1 | From: Joel Stanley <joel@jms.id.au> |
---|---|---|---|
2 | 2 | ||
3 | Change the code to avoid exiting QEMU if user provided DTB contains | 3 | The macro used to calculate the maximum memory size of the MMIO region |
4 | manually specified /psci node and skip any /psci related fixups | 4 | had a mistake, causing all GPIO models to create a mapping of 0x9D8. |
5 | instead. | 5 | The intent was to have it be 0x9D8 - 0x800. |
6 | 6 | ||
7 | Fixes: 4cbca7d9b4 ("hw/arm: Move virt's PSCI DT fixup code to | 7 | This extra size doesn't matter on ast2400 and ast2500, which have a 4KB |
8 | arm/boot.c") | 8 | region set aside for the GPIO controller. |
9 | 9 | ||
10 | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> | 10 | On the ast2600 the 3.3V and 1.8V GPIO controllers are 2KB apart, so the |
11 | Reported-by: Marc Zyngier <marc.zyngier@arm.com> | 11 | regions would overlap. Worse was the 1.8V controller would map over the |
12 | Tested-by: Marc Zyngier <marc.zyngier@arm.com> | 12 | top of the following peripheral, which happens to be the RTC. |
13 | Message-id: 20180402205654.14572-1-andrew.smirnov@gmail.com | 13 | |
14 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 14 | The mmio region used by each device is a maximum of 2KB, so avoid the |
15 | calculations and hard code this as the maximum. | ||
16 | |||
17 | Fixes: 36d737ee82b2 ("hw/gpio: Add in AST2600 specific implementation") | ||
18 | Signed-off-by: Joel Stanley <joel@jms.id.au> | ||
19 | Reviewed-by: Rashmica Gupta <rashmica.g@gmail.com> | ||
20 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | ||
21 | Message-id: 20210713065854.134634-2-joel@jms.id.au | ||
22 | [PMM: fix autocorrect error in commit message] | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 23 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
16 | --- | 24 | --- |
17 | hw/arm/boot.c | 10 ++++++++++ | 25 | hw/gpio/aspeed_gpio.c | 3 +-- |
18 | 1 file changed, 10 insertions(+) | 26 | 1 file changed, 1 insertion(+), 2 deletions(-) |
19 | 27 | ||
20 | diff --git a/hw/arm/boot.c b/hw/arm/boot.c | 28 | diff --git a/hw/gpio/aspeed_gpio.c b/hw/gpio/aspeed_gpio.c |
21 | index XXXXXXX..XXXXXXX 100644 | 29 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/hw/arm/boot.c | 30 | --- a/hw/gpio/aspeed_gpio.c |
23 | +++ b/hw/arm/boot.c | 31 | +++ b/hw/gpio/aspeed_gpio.c |
24 | @@ -XXX,XX +XXX,XX @@ static void fdt_add_psci_node(void *fdt) | 32 | @@ -XXX,XX +XXX,XX @@ |
25 | ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(0)); | 33 | #define GPIO_1_8V_MEM_SIZE 0x9D8 |
26 | const char *psci_method; | 34 | #define GPIO_1_8V_REG_ARRAY_SIZE ((GPIO_1_8V_MEM_SIZE - \ |
27 | int64_t psci_conduit; | 35 | GPIO_1_8V_REG_OFFSET) >> 2) |
28 | + int rc; | 36 | -#define GPIO_MAX_MEM_SIZE MAX(GPIO_3_6V_MEM_SIZE, GPIO_1_8V_MEM_SIZE) |
29 | 37 | ||
30 | psci_conduit = object_property_get_int(OBJECT(armcpu), | 38 | static int aspeed_evaluate_irq(GPIOSets *regs, int gpio_prev_high, int gpio) |
31 | "psci-conduit", | 39 | { |
32 | @@ -XXX,XX +XXX,XX @@ static void fdt_add_psci_node(void *fdt) | 40 | @@ -XXX,XX +XXX,XX @@ static void aspeed_gpio_realize(DeviceState *dev, Error **errp) |
33 | g_assert_not_reached(); | ||
34 | } | 41 | } |
35 | 42 | ||
36 | + /* | 43 | memory_region_init_io(&s->iomem, OBJECT(s), &aspeed_gpio_ops, s, |
37 | + * If /psci node is present in provided DTB, assume that no fixup | 44 | - TYPE_ASPEED_GPIO, GPIO_MAX_MEM_SIZE); |
38 | + * is necessary and all PSCI configuration should be taken as-is | 45 | + TYPE_ASPEED_GPIO, 0x800); |
39 | + */ | 46 | |
40 | + rc = fdt_path_offset(fdt, "/psci"); | 47 | sysbus_init_mmio(sbd, &s->iomem); |
41 | + if (rc >= 0) { | 48 | } |
42 | + return; | ||
43 | + } | ||
44 | + | ||
45 | qemu_fdt_add_subnode(fdt, "/psci"); | ||
46 | if (armcpu->psci_version == 2) { | ||
47 | const char comp[] = "arm,psci-0.2\0arm,psci"; | ||
48 | -- | 49 | -- |
49 | 2.16.2 | 50 | 2.20.1 |
50 | 51 | ||
51 | 52 | diff view generated by jsdifflib |