1 | target-arm queue: a smallish set of patches for rc1 tomorrow. | 1 | Handful of bugfixes for rc2. None of these are particularly critical |
---|---|---|---|
2 | I've included the tcg patches because RTH has no others that | 2 | or exciting. |
3 | would merit a pullreq. | ||
4 | 3 | ||
5 | I haven't included Thomas Huth's 17-patch set to deal with | ||
6 | the introspection crashes, to give that a little more time | ||
7 | on-list for review. | ||
8 | |||
9 | thanks | ||
10 | -- PMM | 4 | -- PMM |
11 | 5 | ||
12 | The following changes since commit 102ad0a80f5110483efd06877c29c4236be267f9: | 6 | The following changes since commit 45a150aa2b3492acf6691c7bdbeb25a8545d8345: |
13 | 7 | ||
14 | Merge remote-tracking branch 'remotes/armbru/tags/pull-misc-2018-07-16' into staging (2018-07-16 15:34:38 +0100) | 8 | Merge remote-tracking branch 'remotes/ericb/tags/pull-bitmaps-2020-08-03' into staging (2020-08-03 15:13:49 +0100) |
15 | 9 | ||
16 | are available in the Git repository at: | 10 | are available in the Git repository at: |
17 | 11 | ||
18 | git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20180716 | 12 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20200803 |
19 | 13 | ||
20 | for you to fetch changes up to 3474c98a2a2afcefa7c665f02ad2bed2a43ab0f7: | 14 | for you to fetch changes up to 13557fd392890cbd985bceba7f717e01efd674b8: |
21 | 15 | ||
22 | accel/tcg: Assert that tlb fill gave us a valid TLB entry (2018-07-16 17:26:01 +0100) | 16 | hw/timer/imx_epit: Avoid assertion when CR.SWR is written (2020-08-03 17:56:11 +0100) |
23 | 17 | ||
24 | ---------------------------------------------------------------- | 18 | ---------------------------------------------------------------- |
25 | target-arm queue: | 19 | target-arm queue: |
26 | * accel/tcg: Use correct test when looking in victim TLB for code | 20 | * hw/timer/imx_epit: Avoid assertion when CR.SWR is written |
27 | * bcm2835_aux: Swap RX and TX interrupt assignments | 21 | * netduino2, netduinoplus2, microbit: set system_clock_scale so that |
28 | * hw/arm/bcm2836: Mark the bcm2836 / bcm2837 devices with user_creatable = false | 22 | SysTick running on the CPU clock works |
29 | * hw/intc/arm_gic: Fix handling of GICD_ITARGETSR | 23 | * target/arm: Avoid maybe-uninitialized warning with gcc 4.9 |
30 | * hw/intc/arm_gic: Check interrupt number in gic_deactivate_irq() | 24 | * target/arm: Fix AddPAC error indication |
31 | * aspeed: Implement write-1-{set, clear} for AST2500 strapping | 25 | * Make AIRCR.SYSRESETREQ actually reset the system for the |
32 | * target/arm: Fix LD1W and LDFF1W (scalar plus vector) | 26 | microbit, mps2-*, musca-*, netduino* boards |
33 | 27 | ||
34 | ---------------------------------------------------------------- | 28 | ---------------------------------------------------------------- |
35 | Andrew Jeffery (1): | 29 | Kaige Li (1): |
36 | aspeed: Implement write-1-{set, clear} for AST2500 strapping | 30 | target/arm: Avoid maybe-uninitialized warning with gcc 4.9 |
37 | 31 | ||
38 | Guenter Roeck (1): | 32 | Peter Maydell (6): |
39 | bcm2835_aux: Swap RX and TX interrupt assignments | 33 | hw/arm/netduino2, netduinoplus2: Set system_clock_scale |
40 | 34 | include/hw/irq.h: New function qemu_irq_is_connected() | |
41 | Peter Maydell (4): | 35 | hw/intc/armv7m_nvic: Provide default "reset the system" behaviour for SYSRESETREQ |
42 | hw/intc/arm_gic: Check interrupt number in gic_deactivate_irq() | 36 | msf2-soc, stellaris: Don't wire up SYSRESETREQ |
43 | hw/intc/arm_gic: Fix handling of GICD_ITARGETSR | 37 | hw/arm/nrf51_soc: Set system_clock_scale |
44 | accel/tcg: Use correct test when looking in victim TLB for code | 38 | hw/timer/imx_epit: Avoid assertion when CR.SWR is written |
45 | accel/tcg: Assert that tlb fill gave us a valid TLB entry | ||
46 | 39 | ||
47 | Richard Henderson (1): | 40 | Richard Henderson (1): |
48 | target/arm: Fix LD1W and LDFF1W (scalar plus vector) | 41 | target/arm: Fix AddPAC error indication |
49 | 42 | ||
50 | Thomas Huth (1): | 43 | include/hw/arm/armv7m.h | 4 +++- |
51 | hw/arm/bcm2836: Mark the bcm2836 / bcm2837 devices with user_creatable = false | 44 | include/hw/irq.h | 18 ++++++++++++++++++ |
45 | hw/arm/msf2-soc.c | 11 ----------- | ||
46 | hw/arm/netduino2.c | 10 ++++++++++ | ||
47 | hw/arm/netduinoplus2.c | 10 ++++++++++ | ||
48 | hw/arm/nrf51_soc.c | 5 +++++ | ||
49 | hw/arm/stellaris.c | 12 ------------ | ||
50 | hw/intc/armv7m_nvic.c | 17 ++++++++++++++++- | ||
51 | hw/timer/imx_epit.c | 13 ++++++++++--- | ||
52 | target/arm/pauth_helper.c | 6 +++++- | ||
53 | target/arm/translate-a64.c | 2 +- | ||
54 | tests/tcg/aarch64/pauth-5.c | 33 +++++++++++++++++++++++++++++++++ | ||
55 | tests/tcg/aarch64/Makefile.target | 2 +- | ||
56 | 13 files changed, 112 insertions(+), 31 deletions(-) | ||
57 | create mode 100644 tests/tcg/aarch64/pauth-5.c | ||
52 | 58 | ||
53 | include/hw/misc/aspeed_scu.h | 2 ++ | ||
54 | accel/tcg/cputlb.c | 6 +++--- | ||
55 | hw/arm/bcm2836.c | 2 ++ | ||
56 | hw/char/bcm2835_aux.c | 4 ++-- | ||
57 | hw/intc/arm_gic.c | 22 +++++++++++++++++++--- | ||
58 | hw/misc/aspeed_scu.c | 19 +++++++++++++++++-- | ||
59 | target/arm/sve_helper.c | 4 ++-- | ||
60 | 7 files changed, 47 insertions(+), 12 deletions(-) | ||
61 | diff view generated by jsdifflib |
1 | In get_page_addr_code(), we were incorrectly looking in the victim | 1 | The netduino2 and netduinoplus2 boards forgot to set the system_clock_scale |
---|---|---|---|
2 | TLB for an entry which matched the target address for reads, not | 2 | global, which meant that if guest code used the systick timer in "use |
3 | for code accesses. This meant that we could hit on a victim TLB | 3 | the processor clock" mode it would hang because time never advances. |
4 | entry that indicated that the address was readable but not | ||
5 | executable, and incorrectly bypass the call to tlb_fill() which | ||
6 | should generate the guest MMU exception. Fix this bug. | ||
7 | 4 | ||
5 | Set the global to match the documented CPU clock speed of these boards. | ||
6 | Judging by the data sheet this is slightly simplistic because the | ||
7 | SoC allows configuration of the SYSCLK source and frequency via the | ||
8 | RCC (reset and clock control) module, but we don't model that. | ||
9 | |||
10 | Fixes: https://bugs.launchpad.net/qemu/+bug/1876187 | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 12 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> |
10 | Message-id: 20180713141636.18665-2-peter.maydell@linaro.org | 13 | Message-id: 20200727162617.26227-1-peter.maydell@linaro.org |
11 | --- | 14 | --- |
12 | accel/tcg/cputlb.c | 2 +- | 15 | hw/arm/netduino2.c | 10 ++++++++++ |
13 | 1 file changed, 1 insertion(+), 1 deletion(-) | 16 | hw/arm/netduinoplus2.c | 10 ++++++++++ |
17 | 2 files changed, 20 insertions(+) | ||
14 | 18 | ||
15 | diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c | 19 | diff --git a/hw/arm/netduino2.c b/hw/arm/netduino2.c |
16 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/accel/tcg/cputlb.c | 21 | --- a/hw/arm/netduino2.c |
18 | +++ b/accel/tcg/cputlb.c | 22 | +++ b/hw/arm/netduino2.c |
19 | @@ -XXX,XX +XXX,XX @@ tb_page_addr_t get_page_addr_code(CPUArchState *env, target_ulong addr) | 23 | @@ -XXX,XX +XXX,XX @@ |
20 | index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1); | 24 | #include "hw/arm/stm32f205_soc.h" |
21 | mmu_idx = cpu_mmu_index(env, true); | 25 | #include "hw/arm/boot.h" |
22 | if (unlikely(!tlb_hit(env->tlb_table[mmu_idx][index].addr_code, addr))) { | 26 | |
23 | - if (!VICTIM_TLB_HIT(addr_read, addr)) { | 27 | +/* Main SYSCLK frequency in Hz (120MHz) */ |
24 | + if (!VICTIM_TLB_HIT(addr_code, addr)) { | 28 | +#define SYSCLK_FRQ 120000000ULL |
25 | tlb_fill(ENV_GET_CPU(env), addr, 0, MMU_INST_FETCH, mmu_idx, 0); | 29 | + |
26 | } | 30 | static void netduino2_init(MachineState *machine) |
27 | } | 31 | { |
32 | DeviceState *dev; | ||
33 | |||
34 | + /* | ||
35 | + * TODO: ideally we would model the SoC RCC and let it handle | ||
36 | + * system_clock_scale, including its ability to define different | ||
37 | + * possible SYSCLK sources. | ||
38 | + */ | ||
39 | + system_clock_scale = NANOSECONDS_PER_SECOND / SYSCLK_FRQ; | ||
40 | + | ||
41 | dev = qdev_new(TYPE_STM32F205_SOC); | ||
42 | qdev_prop_set_string(dev, "cpu-type", ARM_CPU_TYPE_NAME("cortex-m3")); | ||
43 | sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); | ||
44 | diff --git a/hw/arm/netduinoplus2.c b/hw/arm/netduinoplus2.c | ||
45 | index XXXXXXX..XXXXXXX 100644 | ||
46 | --- a/hw/arm/netduinoplus2.c | ||
47 | +++ b/hw/arm/netduinoplus2.c | ||
48 | @@ -XXX,XX +XXX,XX @@ | ||
49 | #include "hw/arm/stm32f405_soc.h" | ||
50 | #include "hw/arm/boot.h" | ||
51 | |||
52 | +/* Main SYSCLK frequency in Hz (168MHz) */ | ||
53 | +#define SYSCLK_FRQ 168000000ULL | ||
54 | + | ||
55 | static void netduinoplus2_init(MachineState *machine) | ||
56 | { | ||
57 | DeviceState *dev; | ||
58 | |||
59 | + /* | ||
60 | + * TODO: ideally we would model the SoC RCC and let it handle | ||
61 | + * system_clock_scale, including its ability to define different | ||
62 | + * possible SYSCLK sources. | ||
63 | + */ | ||
64 | + system_clock_scale = NANOSECONDS_PER_SECOND / SYSCLK_FRQ; | ||
65 | + | ||
66 | dev = qdev_new(TYPE_STM32F405_SOC); | ||
67 | qdev_prop_set_string(dev, "cpu-type", ARM_CPU_TYPE_NAME("cortex-m4")); | ||
68 | sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); | ||
28 | -- | 69 | -- |
29 | 2.17.1 | 70 | 2.20.1 |
30 | 71 | ||
31 | 72 | diff view generated by jsdifflib |
1 | In gic_deactivate_irq() the interrupt number comes from the guest | 1 | Mostly devices don't need to care whether one of their output |
---|---|---|---|
2 | (on a write to the GICC_DIR register), so we need to sanity check | 2 | qemu_irq lines is connected, because functions like qemu_set_irq() |
3 | that it isn't out of range before we use it as an array index. | 3 | silently do nothing if there is nothing on the other end. However |
4 | Handle this in a similar manner to the check we do in | 4 | sometimes a device might want to implement default behaviour for the |
5 | gic_complete_irq() for the GICC_EOI register. | 5 | case where the machine hasn't wired the line up to anywhere. |
6 | 6 | ||
7 | The array overrun is not disastrous because the calling code | 7 | Provide a function qemu_irq_is_connected() that devices can use for |
8 | uses (value & 0x3ff) to extract the interrupt field, so the | 8 | this purpose. (The test is trivial but encapsulating it in a |
9 | only out-of-range values possible are 1020..1023, which allow | 9 | function makes it easier to see where we're doing it in case we need |
10 | overrunning only from irq_state[] into the following | 10 | to change the implementation later.) |
11 | irq_target[] array which the guest can already manipulate. | ||
12 | 11 | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 13 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
15 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | 14 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> |
16 | Message-id: 20180712154152.32183-2-peter.maydell@linaro.org | 15 | Message-id: 20200728103744.6909-2-peter.maydell@linaro.org |
17 | --- | 16 | --- |
18 | hw/intc/arm_gic.c | 16 +++++++++++++++- | 17 | include/hw/irq.h | 18 ++++++++++++++++++ |
19 | 1 file changed, 15 insertions(+), 1 deletion(-) | 18 | 1 file changed, 18 insertions(+) |
20 | 19 | ||
21 | diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c | 20 | diff --git a/include/hw/irq.h b/include/hw/irq.h |
22 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
23 | --- a/hw/intc/arm_gic.c | 22 | --- a/include/hw/irq.h |
24 | +++ b/hw/intc/arm_gic.c | 23 | +++ b/include/hw/irq.h |
25 | @@ -XXX,XX +XXX,XX @@ static bool gic_eoi_split(GICState *s, int cpu, MemTxAttrs attrs) | 24 | @@ -XXX,XX +XXX,XX @@ qemu_irq qemu_irq_split(qemu_irq irq1, qemu_irq irq2); |
26 | static void gic_deactivate_irq(GICState *s, int cpu, int irq, MemTxAttrs attrs) | 25 | on an existing vector of qemu_irq. */ |
27 | { | 26 | void qemu_irq_intercept_in(qemu_irq *gpio_in, qemu_irq_handler handler, int n); |
28 | int cm = 1 << cpu; | 27 | |
29 | - int group = gic_has_groups(s) && GIC_TEST_GROUP(irq, cm); | 28 | +/** |
30 | + int group; | 29 | + * qemu_irq_is_connected: Return true if IRQ line is wired up |
30 | + * | ||
31 | + * If a qemu_irq has a device on the other (receiving) end of it, | ||
32 | + * return true; otherwise return false. | ||
33 | + * | ||
34 | + * Usually device models don't need to care whether the machine model | ||
35 | + * has wired up their outbound qemu_irq lines, because functions like | ||
36 | + * qemu_set_irq() silently do nothing if there is nothing on the other | ||
37 | + * end of the line. However occasionally a device model will want to | ||
38 | + * provide default behaviour if its output is left floating, and | ||
39 | + * it can use this function to identify when that is the case. | ||
40 | + */ | ||
41 | +static inline bool qemu_irq_is_connected(qemu_irq irq) | ||
42 | +{ | ||
43 | + return irq != NULL; | ||
44 | +} | ||
31 | + | 45 | + |
32 | + if (irq >= s->num_irq) { | 46 | #endif |
33 | + /* | ||
34 | + * This handles two cases: | ||
35 | + * 1. If software writes the ID of a spurious interrupt [ie 1023] | ||
36 | + * to the GICC_DIR, the GIC ignores that write. | ||
37 | + * 2. If software writes the number of a non-existent interrupt | ||
38 | + * this must be a subcase of "value written is not an active interrupt" | ||
39 | + * and so this is UNPREDICTABLE. We choose to ignore it. | ||
40 | + */ | ||
41 | + return; | ||
42 | + } | ||
43 | + | ||
44 | + group = gic_has_groups(s) && GIC_TEST_GROUP(irq, cm); | ||
45 | |||
46 | if (!gic_eoi_split(s, cpu, attrs)) { | ||
47 | /* This is UNPREDICTABLE; we choose to ignore it */ | ||
48 | -- | 47 | -- |
49 | 2.17.1 | 48 | 2.20.1 |
50 | 49 | ||
51 | 50 | diff view generated by jsdifflib |
1 | From: Andrew Jeffery <andrew@aj.id.au> | 1 | The NVIC provides an outbound qemu_irq "SYSRESETREQ" which it signals |
---|---|---|---|
2 | when the guest sets the SYSRESETREQ bit in the AIRCR register. This | ||
3 | matches the hardware design (where the CPU has a signal of this name | ||
4 | and it is up to the SoC to connect that up to an actual reset | ||
5 | mechanism), but in QEMU it mostly results in duplicated code in SoC | ||
6 | objects and bugs where SoC model implementors forget to wire up the | ||
7 | SYSRESETREQ line. | ||
2 | 8 | ||
3 | The AST2500 SoC family changes the runtime behaviour of the hardware | 9 | Provide a default behaviour for the case where SYSRESETREQ is not |
4 | strapping register (SCU70) to write-1-set/write-1-clear, with | 10 | actually connected to anything: use qemu_system_reset_request() to |
5 | write-1-clear implemented on the "read-only" SoC revision register | 11 | perform a system reset. This will allow us to remove the |
6 | (SCU7C). For the the AST2400, the hardware strapping is | 12 | implementations of SYSRESETREQ handling from the boards where that's |
7 | runtime-configured with read-modify-write semantics. | 13 | exactly what it does, and also fixes the bugs in the board models |
14 | which forgot to wire up the signal: | ||
8 | 15 | ||
9 | Signed-off-by: Andrew Jeffery <andrew@aj.id.au> | 16 | * microbit |
10 | Reviewed-by: Joel Stanley <joel@jms.id.au> | 17 | * mps2-an385 |
11 | Message-id: 20180709143524.17480-1-andrew@aj.id.au | 18 | * mps2-an505 |
19 | * mps2-an511 | ||
20 | * mps2-an521 | ||
21 | * musca-a | ||
22 | * musca-b1 | ||
23 | * netduino | ||
24 | * netduinoplus2 | ||
25 | |||
26 | We still allow the board to wire up the signal if it needs to, in case | ||
27 | we need to model more complicated reset controller logic or to model | ||
28 | buggy SoC hardware which forgot to wire up the line itself. But | ||
29 | defaulting to "reset the system" is more often going to be correct | ||
30 | than defaulting to "do nothing". | ||
31 | |||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 32 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
33 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
34 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
35 | Message-id: 20200728103744.6909-3-peter.maydell@linaro.org | ||
13 | --- | 36 | --- |
14 | include/hw/misc/aspeed_scu.h | 2 ++ | 37 | include/hw/arm/armv7m.h | 4 +++- |
15 | hw/misc/aspeed_scu.c | 19 +++++++++++++++++-- | 38 | hw/intc/armv7m_nvic.c | 17 ++++++++++++++++- |
16 | 2 files changed, 19 insertions(+), 2 deletions(-) | 39 | 2 files changed, 19 insertions(+), 2 deletions(-) |
17 | 40 | ||
18 | diff --git a/include/hw/misc/aspeed_scu.h b/include/hw/misc/aspeed_scu.h | 41 | diff --git a/include/hw/arm/armv7m.h b/include/hw/arm/armv7m.h |
19 | index XXXXXXX..XXXXXXX 100644 | 42 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/include/hw/misc/aspeed_scu.h | 43 | --- a/include/hw/arm/armv7m.h |
21 | +++ b/include/hw/misc/aspeed_scu.h | 44 | +++ b/include/hw/arm/armv7m.h |
22 | @@ -XXX,XX +XXX,XX @@ typedef struct AspeedSCUState { | 45 | @@ -XXX,XX +XXX,XX @@ typedef struct { |
23 | #define AST2500_A0_SILICON_REV 0x04000303U | 46 | |
24 | #define AST2500_A1_SILICON_REV 0x04010303U | 47 | /* ARMv7M container object. |
25 | 48 | * + Unnamed GPIO input lines: external IRQ lines for the NVIC | |
26 | +#define ASPEED_IS_AST2500(si_rev) ((((si_rev) >> 24) & 0xff) == 0x04) | 49 | - * + Named GPIO output SYSRESETREQ: signalled for guest AIRCR.SYSRESETREQ |
50 | + * + Named GPIO output SYSRESETREQ: signalled for guest AIRCR.SYSRESETREQ. | ||
51 | + * If this GPIO is not wired up then the NVIC will default to performing | ||
52 | + * a qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET). | ||
53 | * + Property "cpu-type": CPU type to instantiate | ||
54 | * + Property "num-irq": number of external IRQ lines | ||
55 | * + Property "memory": MemoryRegion defining the physical address space | ||
56 | diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c | ||
57 | index XXXXXXX..XXXXXXX 100644 | ||
58 | --- a/hw/intc/armv7m_nvic.c | ||
59 | +++ b/hw/intc/armv7m_nvic.c | ||
60 | @@ -XXX,XX +XXX,XX @@ | ||
61 | #include "hw/intc/armv7m_nvic.h" | ||
62 | #include "hw/irq.h" | ||
63 | #include "hw/qdev-properties.h" | ||
64 | +#include "sysemu/runstate.h" | ||
65 | #include "target/arm/cpu.h" | ||
66 | #include "exec/exec-all.h" | ||
67 | #include "exec/memop.h" | ||
68 | @@ -XXX,XX +XXX,XX @@ static const uint8_t nvic_id[] = { | ||
69 | 0x00, 0xb0, 0x1b, 0x00, 0x0d, 0xe0, 0x05, 0xb1 | ||
70 | }; | ||
71 | |||
72 | +static void signal_sysresetreq(NVICState *s) | ||
73 | +{ | ||
74 | + if (qemu_irq_is_connected(s->sysresetreq)) { | ||
75 | + qemu_irq_pulse(s->sysresetreq); | ||
76 | + } else { | ||
77 | + /* | ||
78 | + * Default behaviour if the SoC doesn't need to wire up | ||
79 | + * SYSRESETREQ (eg to a system reset controller of some kind): | ||
80 | + * perform a system reset via the usual QEMU API. | ||
81 | + */ | ||
82 | + qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); | ||
83 | + } | ||
84 | +} | ||
27 | + | 85 | + |
28 | extern bool is_supported_silicon_rev(uint32_t silicon_rev); | 86 | static int nvic_pending_prio(NVICState *s) |
29 | 87 | { | |
30 | #define ASPEED_SCU_PROT_KEY 0x1688A8A8 | 88 | /* return the group priority of the current pending interrupt, |
31 | diff --git a/hw/misc/aspeed_scu.c b/hw/misc/aspeed_scu.c | 89 | @@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value, |
32 | index XXXXXXX..XXXXXXX 100644 | 90 | if (value & R_V7M_AIRCR_SYSRESETREQ_MASK) { |
33 | --- a/hw/misc/aspeed_scu.c | 91 | if (attrs.secure || |
34 | +++ b/hw/misc/aspeed_scu.c | 92 | !(cpu->env.v7m.aircr & R_V7M_AIRCR_SYSRESETREQS_MASK)) { |
35 | @@ -XXX,XX +XXX,XX @@ static void aspeed_scu_write(void *opaque, hwaddr offset, uint64_t data, | 93 | - qemu_irq_pulse(s->sysresetreq); |
36 | s->regs[reg] = data; | 94 | + signal_sysresetreq(s); |
37 | aspeed_scu_set_apb_freq(s); | 95 | } |
38 | break; | 96 | } |
39 | - | 97 | if (value & R_V7M_AIRCR_VECTCLRACTIVE_MASK) { |
40 | + case HW_STRAP1: | ||
41 | + if (ASPEED_IS_AST2500(s->regs[SILICON_REV])) { | ||
42 | + s->regs[HW_STRAP1] |= data; | ||
43 | + return; | ||
44 | + } | ||
45 | + /* Jump to assignment below */ | ||
46 | + break; | ||
47 | + case SILICON_REV: | ||
48 | + if (ASPEED_IS_AST2500(s->regs[SILICON_REV])) { | ||
49 | + s->regs[HW_STRAP1] &= ~data; | ||
50 | + } else { | ||
51 | + qemu_log_mask(LOG_GUEST_ERROR, | ||
52 | + "%s: Write to read-only offset 0x%" HWADDR_PRIx "\n", | ||
53 | + __func__, offset); | ||
54 | + } | ||
55 | + /* Avoid assignment below, we've handled everything */ | ||
56 | + return; | ||
57 | case FREQ_CNTR_EVAL: | ||
58 | case VGA_SCRATCH1 ... VGA_SCRATCH8: | ||
59 | case RNG_DATA: | ||
60 | - case SILICON_REV: | ||
61 | case FREE_CNTR4: | ||
62 | case FREE_CNTR4_EXT: | ||
63 | qemu_log_mask(LOG_GUEST_ERROR, | ||
64 | -- | 98 | -- |
65 | 2.17.1 | 99 | 2.20.1 |
66 | 100 | ||
67 | 101 | diff view generated by jsdifflib |
1 | From: Thomas Huth <thuth@redhat.com> | 1 | The MSF2 SoC model and the Stellaris board code both wire |
---|---|---|---|
2 | SYSRESETREQ up to a function that just invokes | ||
3 | qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); | ||
4 | This is now the default action that the NVIC does if the line is | ||
5 | not connected, so we can delete the handling code. | ||
2 | 6 | ||
3 | These devices are currently causing some problems when a user is trying | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | to hot-plug or introspect them during runtime. Since these devices can | 8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
5 | not be instantiated by the user at all (they need to be wired up in code | 9 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> |
6 | instead), we should mark them with user_creatable = false anyway, then we | 10 | Message-id: 20200728103744.6909-4-peter.maydell@linaro.org |
7 | avoid at least the crashes with the hot-plugging. The introspection problem | 11 | --- |
8 | will be handled by a separate patch. | 12 | hw/arm/msf2-soc.c | 11 ----------- |
13 | hw/arm/stellaris.c | 12 ------------ | ||
14 | 2 files changed, 23 deletions(-) | ||
9 | 15 | ||
10 | Signed-off-by: Thomas Huth <thuth@redhat.com> | 16 | diff --git a/hw/arm/msf2-soc.c b/hw/arm/msf2-soc.c |
11 | Message-id: 1531415537-26037-1-git-send-email-thuth@redhat.com | ||
12 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | Reviewed-by: Markus Armbruster <armbru@redhat.com> | ||
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
15 | --- | ||
16 | hw/arm/bcm2836.c | 2 ++ | ||
17 | 1 file changed, 2 insertions(+) | ||
18 | |||
19 | diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c | ||
20 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/hw/arm/bcm2836.c | 18 | --- a/hw/arm/msf2-soc.c |
22 | +++ b/hw/arm/bcm2836.c | 19 | +++ b/hw/arm/msf2-soc.c |
23 | @@ -XXX,XX +XXX,XX @@ static void bcm283x_class_init(ObjectClass *oc, void *data) | 20 | @@ -XXX,XX +XXX,XX @@ |
24 | bc->info = data; | 21 | #include "hw/irq.h" |
25 | dc->realize = bcm2836_realize; | 22 | #include "hw/arm/msf2-soc.h" |
26 | dc->props = bcm2836_props; | 23 | #include "hw/misc/unimp.h" |
27 | + /* Reason: Must be wired up in code (see raspi_init() function) */ | 24 | -#include "sysemu/runstate.h" |
28 | + dc->user_creatable = false; | 25 | #include "sysemu/sysemu.h" |
26 | |||
27 | #define MSF2_TIMER_BASE 0x40004000 | ||
28 | @@ -XXX,XX +XXX,XX @@ static const int spi_irq[MSF2_NUM_SPIS] = { 2, 3 }; | ||
29 | static const int uart_irq[MSF2_NUM_UARTS] = { 10, 11 }; | ||
30 | static const int timer_irq[MSF2_NUM_TIMERS] = { 14, 15 }; | ||
31 | |||
32 | -static void do_sys_reset(void *opaque, int n, int level) | ||
33 | -{ | ||
34 | - if (level) { | ||
35 | - qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); | ||
36 | - } | ||
37 | -} | ||
38 | - | ||
39 | static void m2sxxx_soc_initfn(Object *obj) | ||
40 | { | ||
41 | MSF2State *s = MSF2_SOC(obj); | ||
42 | @@ -XXX,XX +XXX,XX @@ static void m2sxxx_soc_realize(DeviceState *dev_soc, Error **errp) | ||
43 | return; | ||
44 | } | ||
45 | |||
46 | - qdev_connect_gpio_out_named(DEVICE(&s->armv7m.nvic), "SYSRESETREQ", 0, | ||
47 | - qemu_allocate_irq(&do_sys_reset, NULL, 0)); | ||
48 | - | ||
49 | system_clock_scale = NANOSECONDS_PER_SECOND / s->m3clk; | ||
50 | |||
51 | for (i = 0; i < MSF2_NUM_UARTS; i++) { | ||
52 | diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c | ||
53 | index XXXXXXX..XXXXXXX 100644 | ||
54 | --- a/hw/arm/stellaris.c | ||
55 | +++ b/hw/arm/stellaris.c | ||
56 | @@ -XXX,XX +XXX,XX @@ | ||
57 | #include "hw/boards.h" | ||
58 | #include "qemu/log.h" | ||
59 | #include "exec/address-spaces.h" | ||
60 | -#include "sysemu/runstate.h" | ||
61 | #include "sysemu/sysemu.h" | ||
62 | #include "hw/arm/armv7m.h" | ||
63 | #include "hw/char/pl011.h" | ||
64 | @@ -XXX,XX +XXX,XX @@ static void stellaris_adc_init(Object *obj) | ||
65 | qdev_init_gpio_in(dev, stellaris_adc_trigger, 1); | ||
29 | } | 66 | } |
30 | 67 | ||
31 | static const TypeInfo bcm283x_type_info = { | 68 | -static |
69 | -void do_sys_reset(void *opaque, int n, int level) | ||
70 | -{ | ||
71 | - if (level) { | ||
72 | - qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); | ||
73 | - } | ||
74 | -} | ||
75 | - | ||
76 | /* Board init. */ | ||
77 | static stellaris_board_info stellaris_boards[] = { | ||
78 | { "LM3S811EVB", | ||
79 | @@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board) | ||
80 | /* This will exit with an error if the user passed us a bad cpu_type */ | ||
81 | sysbus_realize_and_unref(SYS_BUS_DEVICE(nvic), &error_fatal); | ||
82 | |||
83 | - qdev_connect_gpio_out_named(nvic, "SYSRESETREQ", 0, | ||
84 | - qemu_allocate_irq(&do_sys_reset, NULL, 0)); | ||
85 | - | ||
86 | if (board->dc1 & (1 << 16)) { | ||
87 | dev = sysbus_create_varargs(TYPE_STELLARIS_ADC, 0x40038000, | ||
88 | qdev_get_gpio_in(nvic, 14), | ||
32 | -- | 89 | -- |
33 | 2.17.1 | 90 | 2.20.1 |
34 | 91 | ||
35 | 92 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | 'I' was being double-incremented; correctly within the inner loop | 3 | The definition of top_bit used in this function is one higher |
4 | and incorrectly within the outer loop. | 4 | than that used in the Arm ARM psuedo-code, which put the error |
5 | indication at top_bit - 1 at the wrong place, which meant that | ||
6 | it wasn't visible to Auth. | ||
5 | 7 | ||
8 | Fixing the definition of top_bit requires more changes, because | ||
9 | its most common use is for the count of bits in top_bit:bot_bit, | ||
10 | which would then need to be computed as top_bit - bot_bit + 1. | ||
11 | |||
12 | For now, prefer the minimal fix to the error indication alone. | ||
13 | |||
14 | Fixes: 63ff0ca94cb | ||
15 | Reported-by: Derrick McKee <derrick.mckee@gmail.com> | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 16 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Reviewed-by: Laurent Desnogues <laurent.desnogues@gmail.com> | 17 | Message-id: 20200728195706.11087-1-richard.henderson@linaro.org |
8 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | 18 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Tested-by: Alex Bennée <alex.bennee@linaro.org> | 19 | [PMM: added comment about the divergence from the pseudocode] |
10 | Message-id: 20180711103957.3040-1-richard.henderson@linaro.org | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 20 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 21 | --- |
13 | target/arm/sve_helper.c | 4 ++-- | 22 | target/arm/pauth_helper.c | 6 +++++- |
14 | 1 file changed, 2 insertions(+), 2 deletions(-) | 23 | tests/tcg/aarch64/pauth-5.c | 33 +++++++++++++++++++++++++++++++ |
24 | tests/tcg/aarch64/Makefile.target | 2 +- | ||
25 | 3 files changed, 39 insertions(+), 2 deletions(-) | ||
26 | create mode 100644 tests/tcg/aarch64/pauth-5.c | ||
15 | 27 | ||
16 | diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c | 28 | diff --git a/target/arm/pauth_helper.c b/target/arm/pauth_helper.c |
17 | index XXXXXXX..XXXXXXX 100644 | 29 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/sve_helper.c | 30 | --- a/target/arm/pauth_helper.c |
19 | +++ b/target/arm/sve_helper.c | 31 | +++ b/target/arm/pauth_helper.c |
20 | @@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(CPUARMState *env, void *vd, void *vg, void *vm, \ | 32 | @@ -XXX,XX +XXX,XX @@ static uint64_t pauth_addpac(CPUARMState *env, uint64_t ptr, uint64_t modifier, |
21 | intptr_t i, oprsz = simd_oprsz(desc); \ | 33 | */ |
22 | unsigned scale = simd_data(desc); \ | 34 | test = sextract64(ptr, bot_bit, top_bit - bot_bit); |
23 | uintptr_t ra = GETPC(); \ | 35 | if (test != 0 && test != -1) { |
24 | - for (i = 0; i < oprsz; i++) { \ | 36 | - pac ^= MAKE_64BIT_MASK(top_bit - 1, 1); |
25 | + for (i = 0; i < oprsz; ) { \ | 37 | + /* |
26 | uint16_t pg = *(uint16_t *)(vg + H1_2(i >> 3)); \ | 38 | + * Note that our top_bit is one greater than the pseudocode's |
27 | do { \ | 39 | + * version, hence "- 2" here. |
28 | TYPEM m = 0; \ | 40 | + */ |
29 | @@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(CPUARMState *env, void *vd, void *vg, void *vm, \ | 41 | + pac ^= MAKE_64BIT_MASK(top_bit - 2, 1); |
30 | uintptr_t ra = GETPC(); \ | 42 | } |
31 | bool first = true; \ | 43 | |
32 | mmap_lock(); \ | 44 | /* |
33 | - for (i = 0; i < oprsz; i++) { \ | 45 | diff --git a/tests/tcg/aarch64/pauth-5.c b/tests/tcg/aarch64/pauth-5.c |
34 | + for (i = 0; i < oprsz; ) { \ | 46 | new file mode 100644 |
35 | uint16_t pg = *(uint16_t *)(vg + H1_2(i >> 3)); \ | 47 | index XXXXXXX..XXXXXXX |
36 | do { \ | 48 | --- /dev/null |
37 | TYPEM m = 0; \ | 49 | +++ b/tests/tcg/aarch64/pauth-5.c |
50 | @@ -XXX,XX +XXX,XX @@ | ||
51 | +#include <assert.h> | ||
52 | + | ||
53 | +static int x; | ||
54 | + | ||
55 | +int main() | ||
56 | +{ | ||
57 | + int *p0 = &x, *p1, *p2, *p3; | ||
58 | + unsigned long salt = 0; | ||
59 | + | ||
60 | + /* | ||
61 | + * With TBI enabled and a 48-bit VA, there are 7 bits of auth, and so | ||
62 | + * a 1/128 chance of auth = pac(ptr,key,salt) producing zero. | ||
63 | + * Find a salt that creates auth != 0. | ||
64 | + */ | ||
65 | + do { | ||
66 | + salt++; | ||
67 | + asm("pacda %0, %1" : "=r"(p1) : "r"(salt), "0"(p0)); | ||
68 | + } while (p0 == p1); | ||
69 | + | ||
70 | + /* | ||
71 | + * This pac must fail, because the input pointer bears an encryption, | ||
72 | + * and so is not properly extended within bits [55:47]. This will | ||
73 | + * toggle bit 54 in the output... | ||
74 | + */ | ||
75 | + asm("pacda %0, %1" : "=r"(p2) : "r"(salt), "0"(p1)); | ||
76 | + | ||
77 | + /* ... so that the aut must fail, setting bit 53 in the output ... */ | ||
78 | + asm("autda %0, %1" : "=r"(p3) : "r"(salt), "0"(p2)); | ||
79 | + | ||
80 | + /* ... which means this equality must not hold. */ | ||
81 | + assert(p3 != p0); | ||
82 | + return 0; | ||
83 | +} | ||
84 | diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile.target | ||
85 | index XXXXXXX..XXXXXXX 100644 | ||
86 | --- a/tests/tcg/aarch64/Makefile.target | ||
87 | +++ b/tests/tcg/aarch64/Makefile.target | ||
88 | @@ -XXX,XX +XXX,XX @@ run-fcvt: fcvt | ||
89 | |||
90 | # Pauth Tests | ||
91 | ifneq ($(DOCKER_IMAGE)$(CROSS_CC_HAS_ARMV8_3),) | ||
92 | -AARCH64_TESTS += pauth-1 pauth-2 pauth-4 | ||
93 | +AARCH64_TESTS += pauth-1 pauth-2 pauth-4 pauth-5 | ||
94 | pauth-%: CFLAGS += -march=armv8.3-a | ||
95 | run-pauth-%: QEMU_OPTS += -cpu max | ||
96 | run-plugin-pauth-%: QEMU_OPTS += -cpu max | ||
38 | -- | 97 | -- |
39 | 2.17.1 | 98 | 2.20.1 |
40 | 99 | ||
41 | 100 | diff view generated by jsdifflib |
1 | From: Guenter Roeck <linux@roeck-us.net> | 1 | From: Kaige Li <likaige@loongson.cn> |
---|---|---|---|
2 | 2 | ||
3 | RX and TX interrupt bits were reversed, resulting in an endless sequence | 3 | GCC version 4.9.4 isn't clever enough to figure out that all |
4 | of serial interupts in the emulated system and the following repeated | 4 | execution paths in disas_ldst() that use 'fn' will have initialized |
5 | error message when booting Linux. | 5 | it first, and so it warns: |
6 | 6 | ||
7 | serial8250: too much work for irq61 | 7 | /home/LiKaige/qemu/target/arm/translate-a64.c: In function ‘disas_ldst’: |
8 | /home/LiKaige/qemu/target/arm/translate-a64.c:3392:5: error: ‘fn’ may be used uninitialized in this function [-Werror=maybe-uninitialized] | ||
9 | fn(cpu_reg(s, rt), clean_addr, tcg_rs, get_mem_index(s), | ||
10 | ^ | ||
11 | /home/LiKaige/qemu/target/arm/translate-a64.c:3318:22: note: ‘fn’ was declared here | ||
12 | AtomicThreeOpFn *fn; | ||
13 | ^ | ||
8 | 14 | ||
9 | This results in a boot failure most of the time. | 15 | Make it happy by initializing the variable to NULL. |
10 | 16 | ||
11 | Qemu command line used to reproduce the problem: | 17 | Signed-off-by: Kaige Li <likaige@loongson.cn> |
12 | 18 | Message-id: 1596110248-7366-2-git-send-email-likaige@loongson.cn | |
13 | qemu-system-aarch64 -M raspi3 -m 1024 \ | ||
14 | -kernel arch/arm64/boot/Image \ | ||
15 | --append "rdinit=/sbin/init console=ttyS1,115200" | ||
16 | -initrd rootfs.cpio \ | ||
17 | -dtb arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dtb \ | ||
18 | -nographic -monitor null -serial null -serial stdio | ||
19 | |||
20 | This is with arm64:defconfig. The root file system was generated using | ||
21 | buildroot. | ||
22 | |||
23 | NB that this error likely arises from an erratum in the | ||
24 | BCM2835 datasheet where the TX and RX bits were swapped | ||
25 | in the AU_MU_IER_REG description (but correct for IIR): | ||
26 | https://elinux.org/BCM2835_datasheet_errata#p12 | ||
27 | |||
28 | Signed-off-by: Guenter Roeck <linux@roeck-us.net> | ||
29 | Message-id: 1529355846-25102-1-git-send-email-linux@roeck-us.net | ||
30 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 19 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
31 | [PMM: added NB about datasheet] | 20 | [PMM: Clean up commit message and note which gcc version this was] |
32 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 21 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
33 | --- | 22 | --- |
34 | hw/char/bcm2835_aux.c | 4 ++-- | 23 | target/arm/translate-a64.c | 2 +- |
35 | 1 file changed, 2 insertions(+), 2 deletions(-) | 24 | 1 file changed, 1 insertion(+), 1 deletion(-) |
36 | 25 | ||
37 | diff --git a/hw/char/bcm2835_aux.c b/hw/char/bcm2835_aux.c | 26 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
38 | index XXXXXXX..XXXXXXX 100644 | 27 | index XXXXXXX..XXXXXXX 100644 |
39 | --- a/hw/char/bcm2835_aux.c | 28 | --- a/target/arm/translate-a64.c |
40 | +++ b/hw/char/bcm2835_aux.c | 29 | +++ b/target/arm/translate-a64.c |
41 | @@ -XXX,XX +XXX,XX @@ | 30 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_atomic(DisasContext *s, uint32_t insn, |
42 | #define AUX_MU_BAUD_REG 0x68 | 31 | bool r = extract32(insn, 22, 1); |
43 | 32 | bool a = extract32(insn, 23, 1); | |
44 | /* bits in IER/IIR registers */ | 33 | TCGv_i64 tcg_rs, clean_addr; |
45 | -#define TX_INT 0x1 | 34 | - AtomicThreeOpFn *fn; |
46 | -#define RX_INT 0x2 | 35 | + AtomicThreeOpFn *fn = NULL; |
47 | +#define RX_INT 0x1 | 36 | |
48 | +#define TX_INT 0x2 | 37 | if (is_vector || !dc_isar_feature(aa64_atomics, s)) { |
49 | 38 | unallocated_encoding(s); | |
50 | static void bcm2835_aux_update(BCM2835AuxState *s) | ||
51 | { | ||
52 | -- | 39 | -- |
53 | 2.17.1 | 40 | 2.20.1 |
54 | 41 | ||
55 | 42 | diff view generated by jsdifflib |
1 | In commit 4b1a3e1e34ad97 we added a check for whether the TLB entry | 1 | The nrf51 SoC model wasn't setting the system_clock_scale |
---|---|---|---|
2 | we had following a tlb_fill had the INVALID bit set. This could | 2 | global.which meant that if guest code used the systick timer in "use |
3 | happen in some circumstances because a stale or wrong TLB entry was | 3 | the processor clock" mode it would hang because time never advances. |
4 | pulled out of the victim cache. However, after commit | ||
5 | 68fea038553039e (which prevents stale entries being in the victim | ||
6 | cache) and the previous commit (which ensures we don't incorrectly | ||
7 | hit in the victim cache)) this should never be possible. | ||
8 | 4 | ||
9 | Drop the check on TLB_INVALID_MASK from the "is this a TLB_RECHECK?" | 5 | Set the global to match the documented CPU clock speed for this SoC. |
10 | condition, and instead assert that the tlb fill procedure has given | 6 | |
11 | us a valid TLB entry (or longjumped out with a guest exception). | 7 | This SoC in fact doesn't have a SysTick timer (which is the only thing |
8 | currently that cares about the system_clock_scale), because it's | ||
9 | a configurable option in the Cortex-M0. However our Cortex-M0 and | ||
10 | thus our nrf51 and our micro:bit board do provide a SysTick, so | ||
11 | we ought to provide a functional one rather than a broken one. | ||
12 | 12 | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 14 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
15 | Message-id: 20180713141636.18665-3-peter.maydell@linaro.org | 15 | Message-id: 20200727193458.31250-1-peter.maydell@linaro.org |
16 | --- | 16 | --- |
17 | accel/tcg/cputlb.c | 4 ++-- | 17 | hw/arm/nrf51_soc.c | 5 +++++ |
18 | 1 file changed, 2 insertions(+), 2 deletions(-) | 18 | 1 file changed, 5 insertions(+) |
19 | 19 | ||
20 | diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c | 20 | diff --git a/hw/arm/nrf51_soc.c b/hw/arm/nrf51_soc.c |
21 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/accel/tcg/cputlb.c | 22 | --- a/hw/arm/nrf51_soc.c |
23 | +++ b/accel/tcg/cputlb.c | 23 | +++ b/hw/arm/nrf51_soc.c |
24 | @@ -XXX,XX +XXX,XX @@ tb_page_addr_t get_page_addr_code(CPUArchState *env, target_ulong addr) | 24 | @@ -XXX,XX +XXX,XX @@ |
25 | if (!VICTIM_TLB_HIT(addr_code, addr)) { | 25 | |
26 | tlb_fill(ENV_GET_CPU(env), addr, 0, MMU_INST_FETCH, mmu_idx, 0); | 26 | #define BASE_TO_IRQ(base) ((base >> 12) & 0x1F) |
27 | } | 27 | |
28 | + assert(tlb_hit(env->tlb_table[mmu_idx][index].addr_code, addr)); | 28 | +/* HCLK (the main CPU clock) on this SoC is always 16MHz */ |
29 | +#define HCLK_FRQ 16000000 | ||
30 | + | ||
31 | static uint64_t clock_read(void *opaque, hwaddr addr, unsigned int size) | ||
32 | { | ||
33 | qemu_log_mask(LOG_UNIMP, "%s: 0x%" HWADDR_PRIx " [%u]\n", | ||
34 | @@ -XXX,XX +XXX,XX @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp) | ||
35 | return; | ||
29 | } | 36 | } |
30 | 37 | ||
31 | - if (unlikely((env->tlb_table[mmu_idx][index].addr_code & | 38 | + system_clock_scale = NANOSECONDS_PER_SECOND / HCLK_FRQ; |
32 | - (TLB_RECHECK | TLB_INVALID_MASK)) == TLB_RECHECK)) { | 39 | + |
33 | + if (unlikely(env->tlb_table[mmu_idx][index].addr_code & TLB_RECHECK)) { | 40 | object_property_set_link(OBJECT(&s->cpu), "memory", OBJECT(&s->container), |
34 | /* | 41 | &error_abort); |
35 | * This is a TLB_RECHECK access, where the MMU protection | 42 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->cpu), errp)) { |
36 | * covers a smaller range than a target page, and we must | ||
37 | -- | 43 | -- |
38 | 2.17.1 | 44 | 2.20.1 |
39 | 45 | ||
40 | 46 | diff view generated by jsdifflib |
1 | The GICD_ITARGETSR implementation still has some 11MPCore behaviour | 1 | The imx_epit device has a software-controllable reset triggered by |
---|---|---|---|
2 | that we were incorrectly using in our GICv1 and GICv2 implementations | 2 | setting the SWR bit in the CR register. An error in commit cc2722ec83ad9 |
3 | for the case where the interrupt number is less than GIC_INTERNAL. | 3 | means that we will end up assert()ing if the guest does this, because |
4 | The desired behaviour here is: | 4 | the code in imx_epit_write() starts ptimer transactions, and then |
5 | * for 11MPCore: RAZ/WI for irqs 0..28; read a number matching the | 5 | imx_epit_reset() also starts ptimer transactions, triggering |
6 | CPU doing the read for irqs 29..31 | 6 | "ptimer_transaction_begin: Assertion `!s->in_transaction' failed". |
7 | * for GICv1 and v2: RAZ/WI if uniprocessor; otherwise read a | ||
8 | number matching the CPU doing the read for all irqs < 32 | ||
9 | 7 | ||
10 | Stop squashing GICD_ITARGETSR to 0 for IRQs 0..28 unless this | 8 | The cleanest way to avoid this double-transaction is to move the |
11 | is an 11MPCore GIC. | 9 | start-transaction for the CR write handling down below the check of |
10 | the SWR bit. | ||
12 | 11 | ||
13 | Reported-by: Jan Kiszka <jan.kiszka@web.de> | 12 | Fixes: https://bugs.launchpad.net/qemu/+bug/1880424 |
13 | Fixes: cc2722ec83ad944505fe | ||
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
15 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 15 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
16 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | 16 | Message-id: 20200727154550.3409-1-peter.maydell@linaro.org |
17 | Message-id: 20180712154152.32183-3-peter.maydell@linaro.org | ||
18 | --- | 17 | --- |
19 | hw/intc/arm_gic.c | 6 ++++-- | 18 | hw/timer/imx_epit.c | 13 ++++++++++--- |
20 | 1 file changed, 4 insertions(+), 2 deletions(-) | 19 | 1 file changed, 10 insertions(+), 3 deletions(-) |
21 | 20 | ||
22 | diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c | 21 | diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c |
23 | index XXXXXXX..XXXXXXX 100644 | 22 | index XXXXXXX..XXXXXXX 100644 |
24 | --- a/hw/intc/arm_gic.c | 23 | --- a/hw/timer/imx_epit.c |
25 | +++ b/hw/intc/arm_gic.c | 24 | +++ b/hw/timer/imx_epit.c |
26 | @@ -XXX,XX +XXX,XX @@ static uint32_t gic_dist_readb(void *opaque, hwaddr offset, MemTxAttrs attrs) | 25 | @@ -XXX,XX +XXX,XX @@ static void imx_epit_write(void *opaque, hwaddr offset, uint64_t value, |
27 | if (irq >= s->num_irq) { | 26 | |
28 | goto bad_reg; | 27 | switch (offset >> 2) { |
29 | } | 28 | case 0: /* CR */ |
30 | - if (irq >= 29 && irq <= 31) { | 29 | - ptimer_transaction_begin(s->timer_cmp); |
31 | + if (irq < 29 && s->revision == REV_11MPCORE) { | 30 | - ptimer_transaction_begin(s->timer_reload); |
32 | + res = 0; | 31 | |
33 | + } else if (irq < GIC_INTERNAL) { | 32 | oldcr = s->cr; |
34 | res = cm; | 33 | s->cr = value & 0x03ffffff; |
35 | } else { | 34 | if (s->cr & CR_SWR) { |
36 | res = GIC_TARGET(irq); | 35 | /* handle the reset */ |
37 | @@ -XXX,XX +XXX,XX @@ static void gic_dist_writeb(void *opaque, hwaddr offset, | 36 | imx_epit_reset(DEVICE(s)); |
38 | if (irq >= s->num_irq) { | 37 | - } else { |
39 | goto bad_reg; | 38 | + /* |
40 | } | 39 | + * TODO: could we 'break' here? following operations appear |
41 | - if (irq < 29) { | 40 | + * to duplicate the work imx_epit_reset() already did. |
42 | + if (irq < 29 && s->revision == REV_11MPCORE) { | 41 | + */ |
43 | value = 0; | 42 | + } |
44 | } else if (irq < GIC_INTERNAL) { | 43 | + |
45 | value = ALL_CPU_MASK; | 44 | + ptimer_transaction_begin(s->timer_cmp); |
45 | + ptimer_transaction_begin(s->timer_reload); | ||
46 | + | ||
47 | + if (!(s->cr & CR_SWR)) { | ||
48 | imx_epit_set_freq(s); | ||
49 | } | ||
50 | |||
46 | -- | 51 | -- |
47 | 2.17.1 | 52 | 2.20.1 |
48 | 53 | ||
49 | 54 | diff view generated by jsdifflib |