1 | ARM queue: nothing particularly exciting here, but no | 1 | Handful of bugfixes for rc2. None of these are particularly critical |
---|---|---|---|
2 | reason to sit on them for another week. | 2 | or exciting. |
3 | 3 | ||
4 | thanks | ||
5 | -- PMM | 4 | -- PMM |
6 | 5 | ||
7 | The following changes since commit 61eedf7aec0e2395aabd628cc055096909a3ea15: | 6 | The following changes since commit 45a150aa2b3492acf6691c7bdbeb25a8545d8345: |
8 | 7 | ||
9 | tests/prom-env: Ease time-out problems on slow hosts (2017-02-10 15:44:53 +0000) | 8 | Merge remote-tracking branch 'remotes/ericb/tags/pull-bitmaps-2020-08-03' into staging (2020-08-03 15:13:49 +0100) |
10 | 9 | ||
11 | are available in the git repository at: | 10 | are available in the Git repository at: |
12 | 11 | ||
13 | git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20170210 | 12 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20200803 |
14 | 13 | ||
15 | for you to fetch changes up to b4cc583f0285a2e1e78621dfba142f00ca47414a: | 14 | for you to fetch changes up to 13557fd392890cbd985bceba7f717e01efd674b8: |
16 | 15 | ||
17 | aspeed/smc: use a modulo to check segment limits (2017-02-10 17:40:30 +0000) | 16 | hw/timer/imx_epit: Avoid assertion when CR.SWR is written (2020-08-03 17:56:11 +0100) |
18 | 17 | ||
19 | ---------------------------------------------------------------- | 18 | ---------------------------------------------------------------- |
20 | target-arm queue: | 19 | target-arm queue: |
21 | * aspeed: minor fixes | 20 | * hw/timer/imx_epit: Avoid assertion when CR.SWR is written |
22 | * virt: declare fwcfg and virtio-mmio as DMA coherent in DT & ACPI | 21 | * netduino2, netduinoplus2, microbit: set system_clock_scale so that |
23 | * arm: enable basic TCG emulation of PMU for AArch64 | 22 | SysTick running on the CPU clock works |
23 | * target/arm: Avoid maybe-uninitialized warning with gcc 4.9 | ||
24 | * target/arm: Fix AddPAC error indication | ||
25 | * Make AIRCR.SYSRESETREQ actually reset the system for the | ||
26 | microbit, mps2-*, musca-*, netduino* boards | ||
24 | 27 | ||
25 | ---------------------------------------------------------------- | 28 | ---------------------------------------------------------------- |
26 | Alexander Graf (4): | 29 | Kaige Li (1): |
27 | target-arm: Declare virtio-mmio as dma-coherent in dt | 30 | target/arm: Avoid maybe-uninitialized warning with gcc 4.9 |
28 | hw/arm/virt: Declare virtio-mmio as dma cache coherent in ACPI | ||
29 | hw/arm/virt: Declare fwcfg as dma cache coherent in ACPI | ||
30 | hw/arm/virt: Declare fwcfg as dma cache coherent in dt | ||
31 | 31 | ||
32 | Cédric Le Goater (4): | 32 | Peter Maydell (6): |
33 | aspeed: check for negative values returned by blk_getlength() | 33 | hw/arm/netduino2, netduinoplus2: Set system_clock_scale |
34 | aspeed: remove useless comment on controller segment size | 34 | include/hw/irq.h: New function qemu_irq_is_connected() |
35 | aspeed/smc: handle dummies only in fast read mode | 35 | hw/intc/armv7m_nvic: Provide default "reset the system" behaviour for SYSRESETREQ |
36 | aspeed/smc: use a modulo to check segment limits | 36 | msf2-soc, stellaris: Don't wire up SYSRESETREQ |
37 | hw/arm/nrf51_soc: Set system_clock_scale | ||
38 | hw/timer/imx_epit: Avoid assertion when CR.SWR is written | ||
37 | 39 | ||
38 | Wei Huang (4): | 40 | Richard Henderson (1): |
39 | target-arm: Add support for PMU register PMSELR_EL0 | 41 | target/arm: Fix AddPAC error indication |
40 | target-arm: Add support for AArch64 PMU register PMXEVTYPER_EL0 | ||
41 | target-arm: Add support for PMU register PMINTENSET_EL1 | ||
42 | target-arm: Enable vPMU support under TCG mode | ||
43 | 42 | ||
44 | target/arm/cpu.h | 4 +-- | 43 | include/hw/arm/armv7m.h | 4 +++- |
45 | hw/arm/aspeed.c | 22 +++++++++----- | 44 | include/hw/irq.h | 18 ++++++++++++++++++ |
46 | hw/arm/vexpress.c | 1 + | 45 | hw/arm/msf2-soc.c | 11 ----------- |
47 | hw/arm/virt-acpi-build.c | 2 ++ | 46 | hw/arm/netduino2.c | 10 ++++++++++ |
48 | hw/arm/virt.c | 4 ++- | 47 | hw/arm/netduinoplus2.c | 10 ++++++++++ |
49 | hw/ssi/aspeed_smc.c | 13 +++++---- | 48 | hw/arm/nrf51_soc.c | 5 +++++ |
50 | target/arm/cpu.c | 2 +- | 49 | hw/arm/stellaris.c | 12 ------------ |
51 | target/arm/helper.c | 74 ++++++++++++++++++++++++++++++++++++------------ | 50 | hw/intc/armv7m_nvic.c | 17 ++++++++++++++++- |
52 | 8 files changed, 88 insertions(+), 34 deletions(-) | 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 | ||
53 | 58 | diff view generated by jsdifflib |
1 | From: Cédric Le Goater <clg@kaod.org> | 1 | The netduino2 and netduinoplus2 boards forgot to set the system_clock_scale |
---|---|---|---|
2 | global, which meant that if guest code used the systick timer in "use | ||
3 | the processor clock" mode it would hang because time never advances. | ||
2 | 4 | ||
3 | The flash devices used for the FMC controller (BMC firmware) are well | 5 | Set the global to match the documented CPU clock speed of these boards. |
4 | defined for each Aspeed machine and are all smaller than the default | 6 | Judging by the data sheet this is slightly simplistic because the |
5 | mapping window size, at least for CE0 which is the chip the SoC boots | 7 | SoC allows configuration of the SYSCLK source and frequency via the |
6 | from. | 8 | RCC (reset and clock control) module, but we don't model that. |
7 | 9 | ||
8 | Signed-off-by: Cédric Le Goater <clg@kaod.org> | 10 | Fixes: https://bugs.launchpad.net/qemu/+bug/1876187 |
9 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
10 | Message-id: 1486648058-520-3-git-send-email-clg@kaod.org | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
13 | Message-id: 20200727162617.26227-1-peter.maydell@linaro.org | ||
12 | --- | 14 | --- |
13 | hw/arm/aspeed.c | 8 +++----- | 15 | hw/arm/netduino2.c | 10 ++++++++++ |
14 | 1 file changed, 3 insertions(+), 5 deletions(-) | 16 | hw/arm/netduinoplus2.c | 10 ++++++++++ |
17 | 2 files changed, 20 insertions(+) | ||
15 | 18 | ||
16 | diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c | 19 | diff --git a/hw/arm/netduino2.c b/hw/arm/netduino2.c |
17 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/hw/arm/aspeed.c | 21 | --- a/hw/arm/netduino2.c |
19 | +++ b/hw/arm/aspeed.c | 22 | +++ b/hw/arm/netduino2.c |
20 | @@ -XXX,XX +XXX,XX @@ static void aspeed_board_init_flashes(AspeedSMCState *s, const char *flashtype, | 23 | @@ -XXX,XX +XXX,XX @@ |
21 | DriveInfo *dinfo = drive_get_next(IF_MTD); | 24 | #include "hw/arm/stm32f205_soc.h" |
22 | qemu_irq cs_line; | 25 | #include "hw/arm/boot.h" |
23 | 26 | ||
24 | - /* | 27 | +/* Main SYSCLK frequency in Hz (120MHz) */ |
25 | - * FIXME: check that we are not using a flash module exceeding | 28 | +#define SYSCLK_FRQ 120000000ULL |
26 | - * the controller segment size | 29 | + |
27 | - */ | 30 | static void netduino2_init(MachineState *machine) |
28 | fl->flash = ssi_create_slave_no_init(s->spi, flashtype); | 31 | { |
29 | if (dinfo) { | 32 | DeviceState *dev; |
30 | qdev_prop_set_drive(fl->flash, "drive", blk_by_legacy_dinfo(dinfo), | 33 | |
31 | @@ -XXX,XX +XXX,XX @@ static void aspeed_board_init(MachineState *machine, | 34 | + /* |
32 | 35 | + * TODO: ideally we would model the SoC RCC and let it handle | |
33 | /* | 36 | + * system_clock_scale, including its ability to define different |
34 | * create a ROM region using the default mapping window size of | 37 | + * possible SYSCLK sources. |
35 | - * the flash module. | 38 | + */ |
36 | + * the flash module. The window size is 64MB for the AST2400 | 39 | + system_clock_scale = NANOSECONDS_PER_SECOND / SYSCLK_FRQ; |
37 | + * SoC and 128MB for the AST2500 SoC, which is twice as big as | 40 | + |
38 | + * needed by the flash modules of the Aspeed machines. | 41 | dev = qdev_new(TYPE_STM32F205_SOC); |
39 | */ | 42 | qdev_prop_set_string(dev, "cpu-type", ARM_CPU_TYPE_NAME("cortex-m3")); |
40 | memory_region_init_rom(boot_rom, OBJECT(bmc), "aspeed.boot_rom", | 43 | sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); |
41 | fl->size, &error_abort); | 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); | ||
42 | -- | 69 | -- |
43 | 2.7.4 | 70 | 2.20.1 |
44 | 71 | ||
45 | 72 | diff view generated by jsdifflib |
1 | From: Wei Huang <wei@redhat.com> | 1 | Mostly devices don't need to care whether one of their output |
---|---|---|---|
2 | qemu_irq lines is connected, because functions like qemu_set_irq() | ||
3 | silently do nothing if there is nothing on the other end. However | ||
4 | sometimes a device might want to implement default behaviour for the | ||
5 | case where the machine hasn't wired the line up to anywhere. | ||
2 | 6 | ||
3 | This patch adds support for AArch64 register PMSELR_EL0. The existing | 7 | Provide a function qemu_irq_is_connected() that devices can use for |
4 | PMSELR definition is revised accordingly. | 8 | this purpose. (The test is trivial but encapsulating it in a |
9 | function makes it easier to see where we're doing it in case we need | ||
10 | to change the implementation later.) | ||
5 | 11 | ||
6 | Signed-off-by: Wei Huang <wei@redhat.com> | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | [PMM: Moved #ifndef CONFIG_USER_ONLY to cover new regdefs] | ||
9 | Message-id: 1486504171-26807-2-git-send-email-wei@redhat.com | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
14 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
15 | Message-id: 20200728103744.6909-2-peter.maydell@linaro.org | ||
11 | --- | 16 | --- |
12 | target/arm/cpu.h | 1 + | 17 | include/hw/irq.h | 18 ++++++++++++++++++ |
13 | target/arm/helper.c | 27 +++++++++++++++++++++------ | 18 | 1 file changed, 18 insertions(+) |
14 | 2 files changed, 22 insertions(+), 6 deletions(-) | ||
15 | 19 | ||
16 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 20 | diff --git a/include/hw/irq.h b/include/hw/irq.h |
17 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/cpu.h | 22 | --- a/include/hw/irq.h |
19 | +++ b/target/arm/cpu.h | 23 | +++ b/include/hw/irq.h |
20 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState { | 24 | @@ -XXX,XX +XXX,XX @@ qemu_irq qemu_irq_split(qemu_irq irq1, qemu_irq irq2); |
21 | uint32_t c9_pmovsr; /* perf monitor overflow status */ | 25 | on an existing vector of qemu_irq. */ |
22 | uint32_t c9_pmxevtyper; /* perf monitor event type */ | 26 | void qemu_irq_intercept_in(qemu_irq *gpio_in, qemu_irq_handler handler, int n); |
23 | uint32_t c9_pmuserenr; /* perf monitor user enable */ | 27 | |
24 | + uint64_t c9_pmselr; /* perf monitor counter selection register */ | 28 | +/** |
25 | uint32_t c9_pminten; /* perf monitor interrupt enables */ | 29 | + * qemu_irq_is_connected: Return true if IRQ line is wired up |
26 | union { /* Memory attribute redirection */ | 30 | + * |
27 | struct { | 31 | + * If a qemu_irq has a device on the other (receiving) end of it, |
28 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 32 | + * return true; otherwise return false. |
29 | index XXXXXXX..XXXXXXX 100644 | 33 | + * |
30 | --- a/target/arm/helper.c | 34 | + * Usually device models don't need to care whether the machine model |
31 | +++ b/target/arm/helper.c | 35 | + * has wired up their outbound qemu_irq lines, because functions like |
32 | @@ -XXX,XX +XXX,XX @@ static uint64_t pmccntr_read(CPUARMState *env, const ARMCPRegInfo *ri) | 36 | + * qemu_set_irq() silently do nothing if there is nothing on the other |
33 | return total_ticks - env->cp15.c15_ccnt; | 37 | + * end of the line. However occasionally a device model will want to |
34 | } | 38 | + * provide default behaviour if its output is left floating, and |
35 | 39 | + * it can use this function to identify when that is the case. | |
36 | +static void pmselr_write(CPUARMState *env, const ARMCPRegInfo *ri, | 40 | + */ |
37 | + uint64_t value) | 41 | +static inline bool qemu_irq_is_connected(qemu_irq irq) |
38 | +{ | 42 | +{ |
39 | + /* The value of PMSELR.SEL affects the behavior of PMXEVTYPER and | 43 | + return irq != NULL; |
40 | + * PMXEVCNTR. We allow [0..31] to be written to PMSELR here; in the | ||
41 | + * meanwhile, we check PMSELR.SEL when PMXEVTYPER and PMXEVCNTR are | ||
42 | + * accessed. | ||
43 | + */ | ||
44 | + env->cp15.c9_pmselr = value & 0x1f; | ||
45 | +} | 44 | +} |
46 | + | 45 | + |
47 | static void pmccntr_write(CPUARMState *env, const ARMCPRegInfo *ri, | 46 | #endif |
48 | uint64_t value) | ||
49 | { | ||
50 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = { | ||
51 | /* Unimplemented so WI. */ | ||
52 | { .name = "PMSWINC", .cp = 15, .crn = 9, .crm = 12, .opc1 = 0, .opc2 = 4, | ||
53 | .access = PL0_W, .accessfn = pmreg_access, .type = ARM_CP_NOP }, | ||
54 | - /* Since we don't implement any events, writing to PMSELR is UNPREDICTABLE. | ||
55 | - * We choose to RAZ/WI. | ||
56 | - */ | ||
57 | - { .name = "PMSELR", .cp = 15, .crn = 9, .crm = 12, .opc1 = 0, .opc2 = 5, | ||
58 | - .access = PL0_RW, .type = ARM_CP_CONST, .resetvalue = 0, | ||
59 | - .accessfn = pmreg_access }, | ||
60 | #ifndef CONFIG_USER_ONLY | ||
61 | + { .name = "PMSELR", .cp = 15, .crn = 9, .crm = 12, .opc1 = 0, .opc2 = 5, | ||
62 | + .access = PL0_RW, .type = ARM_CP_ALIAS, | ||
63 | + .fieldoffset = offsetoflow32(CPUARMState, cp15.c9_pmselr), | ||
64 | + .accessfn = pmreg_access, .writefn = pmselr_write, | ||
65 | + .raw_writefn = raw_write}, | ||
66 | + { .name = "PMSELR_EL0", .state = ARM_CP_STATE_AA64, | ||
67 | + .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 12, .opc2 = 5, | ||
68 | + .access = PL0_RW, .accessfn = pmreg_access, | ||
69 | + .fieldoffset = offsetof(CPUARMState, cp15.c9_pmselr), | ||
70 | + .writefn = pmselr_write, .raw_writefn = raw_write, }, | ||
71 | { .name = "PMCCNTR", .cp = 15, .crn = 9, .crm = 13, .opc1 = 0, .opc2 = 0, | ||
72 | .access = PL0_RW, .resetvalue = 0, .type = ARM_CP_IO, | ||
73 | .readfn = pmccntr_read, .writefn = pmccntr_write32, | ||
74 | -- | 47 | -- |
75 | 2.7.4 | 48 | 2.20.1 |
76 | 49 | ||
77 | 50 | diff view generated by jsdifflib |
1 | From: Wei Huang <wei@redhat.com> | 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 | In order to support Linux perf, which uses PMXEVTYPER register, | 9 | Provide a default behaviour for the case where SYSRESETREQ is not |
4 | this patch adds read/write access support for PMXEVTYPER. The access | 10 | actually connected to anything: use qemu_system_reset_request() to |
5 | is CONSTRAINED UNPREDICTABLE when PMSELR is not 0x1f. Additionally | 11 | perform a system reset. This will allow us to remove the |
6 | this patch adds support for PMXEVTYPER_EL0. | 12 | implementations of SYSRESETREQ handling from the boards where that's |
13 | exactly what it does, and also fixes the bugs in the board models | ||
14 | which forgot to wire up the signal: | ||
7 | 15 | ||
8 | Signed-off-by: Wei Huang <wei@redhat.com> | 16 | * microbit |
9 | Message-id: 1486504171-26807-3-git-send-email-wei@redhat.com | 17 | * mps2-an385 |
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 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 | |||
11 | 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 | ||
12 | --- | 36 | --- |
13 | target/arm/cpu.h | 1 - | 37 | include/hw/arm/armv7m.h | 4 +++- |
14 | target/arm/helper.c | 30 +++++++++++++++++++++++++----- | 38 | hw/intc/armv7m_nvic.c | 17 ++++++++++++++++- |
15 | 2 files changed, 25 insertions(+), 6 deletions(-) | 39 | 2 files changed, 19 insertions(+), 2 deletions(-) |
16 | 40 | ||
17 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 41 | diff --git a/include/hw/arm/armv7m.h b/include/hw/arm/armv7m.h |
18 | index XXXXXXX..XXXXXXX 100644 | 42 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/target/arm/cpu.h | 43 | --- a/include/hw/arm/armv7m.h |
20 | +++ b/target/arm/cpu.h | 44 | +++ b/include/hw/arm/armv7m.h |
21 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState { | 45 | @@ -XXX,XX +XXX,XX @@ typedef struct { |
22 | uint64_t c9_pmcr; /* performance monitor control register */ | 46 | |
23 | uint64_t c9_pmcnten; /* perf monitor counter enables */ | 47 | /* ARMv7M container object. |
24 | uint32_t c9_pmovsr; /* perf monitor overflow status */ | 48 | * + Unnamed GPIO input lines: external IRQ lines for the NVIC |
25 | - uint32_t c9_pmxevtyper; /* perf monitor event type */ | 49 | - * + Named GPIO output SYSRESETREQ: signalled for guest AIRCR.SYSRESETREQ |
26 | uint32_t c9_pmuserenr; /* perf monitor user enable */ | 50 | + * + Named GPIO output SYSRESETREQ: signalled for guest AIRCR.SYSRESETREQ. |
27 | uint64_t c9_pmselr; /* perf monitor counter selection register */ | 51 | + * If this GPIO is not wired up then the NVIC will default to performing |
28 | uint32_t c9_pminten; /* perf monitor interrupt enables */ | 52 | + * a qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET). |
29 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 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 | ||
30 | index XXXXXXX..XXXXXXX 100644 | 57 | index XXXXXXX..XXXXXXX 100644 |
31 | --- a/target/arm/helper.c | 58 | --- a/hw/intc/armv7m_nvic.c |
32 | +++ b/target/arm/helper.c | 59 | +++ b/hw/intc/armv7m_nvic.c |
33 | @@ -XXX,XX +XXX,XX @@ static void pmovsr_write(CPUARMState *env, const ARMCPRegInfo *ri, | 60 | @@ -XXX,XX +XXX,XX @@ |
34 | static void pmxevtyper_write(CPUARMState *env, const ARMCPRegInfo *ri, | 61 | #include "hw/intc/armv7m_nvic.h" |
35 | uint64_t value) | 62 | #include "hw/irq.h" |
36 | { | 63 | #include "hw/qdev-properties.h" |
37 | - env->cp15.c9_pmxevtyper = value & 0xff; | 64 | +#include "sysemu/runstate.h" |
38 | + /* Attempts to access PMXEVTYPER are CONSTRAINED UNPREDICTABLE when | 65 | #include "target/arm/cpu.h" |
39 | + * PMSELR value is equal to or greater than the number of implemented | 66 | #include "exec/exec-all.h" |
40 | + * counters, but not equal to 0x1f. We opt to behave as a RAZ/WI. | 67 | #include "exec/memop.h" |
41 | + */ | 68 | @@ -XXX,XX +XXX,XX @@ static const uint8_t nvic_id[] = { |
42 | + if (env->cp15.c9_pmselr == 0x1f) { | 69 | 0x00, 0xb0, 0x1b, 0x00, 0x0d, 0xe0, 0x05, 0xb1 |
43 | + pmccfiltr_write(env, ri, value); | 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); | ||
44 | + } | 83 | + } |
45 | +} | 84 | +} |
46 | + | 85 | + |
47 | +static uint64_t pmxevtyper_read(CPUARMState *env, const ARMCPRegInfo *ri) | 86 | static int nvic_pending_prio(NVICState *s) |
48 | +{ | 87 | { |
49 | + /* We opt to behave as a RAZ/WI when attempts to access PMXEVTYPER | 88 | /* return the group priority of the current pending interrupt, |
50 | + * are CONSTRAINED UNPREDICTABLE. See comments in pmxevtyper_write(). | 89 | @@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value, |
51 | + */ | 90 | if (value & R_V7M_AIRCR_SYSRESETREQ_MASK) { |
52 | + if (env->cp15.c9_pmselr == 0x1f) { | 91 | if (attrs.secure || |
53 | + return env->cp15.pmccfiltr_el0; | 92 | !(cpu->env.v7m.aircr & R_V7M_AIRCR_SYSRESETREQS_MASK)) { |
54 | + } else { | 93 | - qemu_irq_pulse(s->sysresetreq); |
55 | + return 0; | 94 | + signal_sysresetreq(s); |
56 | + } | 95 | } |
57 | } | 96 | } |
58 | 97 | if (value & R_V7M_AIRCR_VECTCLRACTIVE_MASK) { | |
59 | static void pmuserenr_write(CPUARMState *env, const ARMCPRegInfo *ri, | ||
60 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = { | ||
61 | .fieldoffset = offsetof(CPUARMState, cp15.pmccfiltr_el0), | ||
62 | .resetvalue = 0, }, | ||
63 | { .name = "PMXEVTYPER", .cp = 15, .crn = 9, .crm = 13, .opc1 = 0, .opc2 = 1, | ||
64 | - .access = PL0_RW, | ||
65 | - .fieldoffset = offsetof(CPUARMState, cp15.c9_pmxevtyper), | ||
66 | - .accessfn = pmreg_access, .writefn = pmxevtyper_write, | ||
67 | - .raw_writefn = raw_write }, | ||
68 | + .access = PL0_RW, .type = ARM_CP_NO_RAW, .accessfn = pmreg_access, | ||
69 | + .writefn = pmxevtyper_write, .readfn = pmxevtyper_read }, | ||
70 | + { .name = "PMXEVTYPER_EL0", .state = ARM_CP_STATE_AA64, | ||
71 | + .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 13, .opc2 = 1, | ||
72 | + .access = PL0_RW, .type = ARM_CP_NO_RAW, .accessfn = pmreg_access, | ||
73 | + .writefn = pmxevtyper_write, .readfn = pmxevtyper_read }, | ||
74 | /* Unimplemented, RAZ/WI. */ | ||
75 | { .name = "PMXEVCNTR", .cp = 15, .crn = 9, .crm = 13, .opc1 = 0, .opc2 = 2, | ||
76 | .access = PL0_RW, .type = ARM_CP_CONST, .resetvalue = 0, | ||
77 | -- | 98 | -- |
78 | 2.7.4 | 99 | 2.20.1 |
79 | 100 | ||
80 | 101 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Wei Huang <wei@redhat.com> | ||
2 | 1 | ||
3 | This patch adds access support for PMINTENSET_EL1. | ||
4 | |||
5 | Signed-off-by: Wei Huang <wei@redhat.com> | ||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | Message-id: 1486504171-26807-4-git-send-email-wei@redhat.com | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | target/arm/cpu.h | 2 +- | ||
11 | target/arm/helper.c | 10 +++++++++- | ||
12 | 2 files changed, 10 insertions(+), 2 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/cpu.h | ||
17 | +++ b/target/arm/cpu.h | ||
18 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState { | ||
19 | uint32_t c9_pmovsr; /* perf monitor overflow status */ | ||
20 | uint32_t c9_pmuserenr; /* perf monitor user enable */ | ||
21 | uint64_t c9_pmselr; /* perf monitor counter selection register */ | ||
22 | - uint32_t c9_pminten; /* perf monitor interrupt enables */ | ||
23 | + uint64_t c9_pminten; /* perf monitor interrupt enables */ | ||
24 | union { /* Memory attribute redirection */ | ||
25 | struct { | ||
26 | #ifdef HOST_WORDS_BIGENDIAN | ||
27 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
28 | index XXXXXXX..XXXXXXX 100644 | ||
29 | --- a/target/arm/helper.c | ||
30 | +++ b/target/arm/helper.c | ||
31 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = { | ||
32 | .writefn = pmuserenr_write, .raw_writefn = raw_write }, | ||
33 | { .name = "PMINTENSET", .cp = 15, .crn = 9, .crm = 14, .opc1 = 0, .opc2 = 1, | ||
34 | .access = PL1_RW, .accessfn = access_tpm, | ||
35 | - .fieldoffset = offsetof(CPUARMState, cp15.c9_pminten), | ||
36 | + .type = ARM_CP_ALIAS, | ||
37 | + .fieldoffset = offsetoflow32(CPUARMState, cp15.c9_pminten), | ||
38 | .resetvalue = 0, | ||
39 | .writefn = pmintenset_write, .raw_writefn = raw_write }, | ||
40 | + { .name = "PMINTENSET_EL1", .state = ARM_CP_STATE_AA64, | ||
41 | + .opc0 = 3, .opc1 = 0, .crn = 9, .crm = 14, .opc2 = 1, | ||
42 | + .access = PL1_RW, .accessfn = access_tpm, | ||
43 | + .type = ARM_CP_IO, | ||
44 | + .fieldoffset = offsetof(CPUARMState, cp15.c9_pminten), | ||
45 | + .writefn = pmintenset_write, .raw_writefn = raw_write, | ||
46 | + .resetvalue = 0x0 }, | ||
47 | { .name = "PMINTENCLR", .cp = 15, .crn = 9, .crm = 14, .opc1 = 0, .opc2 = 2, | ||
48 | .access = PL1_RW, .accessfn = access_tpm, .type = ARM_CP_ALIAS, | ||
49 | .fieldoffset = offsetof(CPUARMState, cp15.c9_pminten), | ||
50 | -- | ||
51 | 2.7.4 | ||
52 | |||
53 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Wei Huang <wei@redhat.com> | ||
2 | 1 | ||
3 | This patch contains several fixes to enable vPMU under TCG mode. It | ||
4 | first removes the checking of kvm_enabled() while unsetting | ||
5 | ARM_FEATURE_PMU. With it, the .pmu option can be used to turn on/off vPMU | ||
6 | under TCG mode. Secondly the PMU node of DT table is now created under TCG. | ||
7 | The last fix is to disable the masking of PMUver field of ID_AA64DFR0_EL1. | ||
8 | |||
9 | Signed-off-by: Wei Huang <wei@redhat.com> | ||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | Message-id: 1486504171-26807-5-git-send-email-wei@redhat.com | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | --- | ||
14 | hw/arm/virt.c | 2 +- | ||
15 | target/arm/cpu.c | 2 +- | ||
16 | target/arm/helper.c | 7 +------ | ||
17 | 3 files changed, 3 insertions(+), 8 deletions(-) | ||
18 | |||
19 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | ||
20 | index XXXXXXX..XXXXXXX 100644 | ||
21 | --- a/hw/arm/virt.c | ||
22 | +++ b/hw/arm/virt.c | ||
23 | @@ -XXX,XX +XXX,XX @@ static void fdt_add_pmu_nodes(const VirtMachineState *vms) | ||
24 | CPU_FOREACH(cpu) { | ||
25 | armcpu = ARM_CPU(cpu); | ||
26 | if (!arm_feature(&armcpu->env, ARM_FEATURE_PMU) || | ||
27 | - !kvm_arm_pmu_create(cpu, PPI(VIRTUAL_PMU_IRQ))) { | ||
28 | + (kvm_enabled() && !kvm_arm_pmu_create(cpu, PPI(VIRTUAL_PMU_IRQ)))) { | ||
29 | return; | ||
30 | } | ||
31 | } | ||
32 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | ||
33 | index XXXXXXX..XXXXXXX 100644 | ||
34 | --- a/target/arm/cpu.c | ||
35 | +++ b/target/arm/cpu.c | ||
36 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) | ||
37 | unset_feature(env, ARM_FEATURE_EL2); | ||
38 | } | ||
39 | |||
40 | - if (!cpu->has_pmu || !kvm_enabled()) { | ||
41 | + if (!cpu->has_pmu) { | ||
42 | cpu->has_pmu = false; | ||
43 | unset_feature(env, ARM_FEATURE_PMU); | ||
44 | } | ||
45 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
46 | index XXXXXXX..XXXXXXX 100644 | ||
47 | --- a/target/arm/helper.c | ||
48 | +++ b/target/arm/helper.c | ||
49 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | ||
50 | { .name = "ID_AA64DFR0_EL1", .state = ARM_CP_STATE_AA64, | ||
51 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 0, | ||
52 | .access = PL1_R, .type = ARM_CP_CONST, | ||
53 | - /* We mask out the PMUVer field, because we don't currently | ||
54 | - * implement the PMU. Not advertising it prevents the guest | ||
55 | - * from trying to use it and getting UNDEFs on registers we | ||
56 | - * don't implement. | ||
57 | - */ | ||
58 | - .resetvalue = cpu->id_aa64dfr0 & ~0xf00 }, | ||
59 | + .resetvalue = cpu->id_aa64dfr0 }, | ||
60 | { .name = "ID_AA64DFR1_EL1", .state = ARM_CP_STATE_AA64, | ||
61 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 1, | ||
62 | .access = PL1_R, .type = ARM_CP_CONST, | ||
63 | -- | ||
64 | 2.7.4 | ||
65 | |||
66 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Alexander Graf <agraf@suse.de> | ||
2 | 1 | ||
3 | QEMU emulated hardware is always dma coherent with its guest. We do | ||
4 | annotate that correctly on the PCI host controller, but left out | ||
5 | virtio-mmio. | ||
6 | |||
7 | Recent kernels have started to interpret that flag rather than take | ||
8 | dma coherency as granted with virtio-mmio. While that is considered | ||
9 | a kernel bug, as it breaks previously working systems, it showed that | ||
10 | our dt description is incomplete. | ||
11 | |||
12 | This patch adds the respective marker that allows guest OSs to evaluate | ||
13 | that our virtio-mmio devices are indeed cache coherent. | ||
14 | |||
15 | Signed-off-by: Alexander Graf <agraf@suse.de> | ||
16 | Reviewed-by: Laszlo Ersek <lersek@redhat.com> | ||
17 | Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> | ||
18 | Message-id: 1486644810-33181-2-git-send-email-agraf@suse.de | ||
19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
20 | --- | ||
21 | hw/arm/vexpress.c | 1 + | ||
22 | hw/arm/virt.c | 1 + | ||
23 | 2 files changed, 2 insertions(+) | ||
24 | |||
25 | diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c | ||
26 | index XXXXXXX..XXXXXXX 100644 | ||
27 | --- a/hw/arm/vexpress.c | ||
28 | +++ b/hw/arm/vexpress.c | ||
29 | @@ -XXX,XX +XXX,XX @@ static int add_virtio_mmio_node(void *fdt, uint32_t acells, uint32_t scells, | ||
30 | acells, addr, scells, size); | ||
31 | qemu_fdt_setprop_cells(fdt, nodename, "interrupt-parent", intc); | ||
32 | qemu_fdt_setprop_cells(fdt, nodename, "interrupts", 0, irq, 1); | ||
33 | + qemu_fdt_setprop(fdt, nodename, "dma-coherent", NULL, 0); | ||
34 | g_free(nodename); | ||
35 | if (rc) { | ||
36 | return -1; | ||
37 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | ||
38 | index XXXXXXX..XXXXXXX 100644 | ||
39 | --- a/hw/arm/virt.c | ||
40 | +++ b/hw/arm/virt.c | ||
41 | @@ -XXX,XX +XXX,XX @@ static void create_virtio_devices(const VirtMachineState *vms, qemu_irq *pic) | ||
42 | qemu_fdt_setprop_cells(vms->fdt, nodename, "interrupts", | ||
43 | GIC_FDT_IRQ_TYPE_SPI, irq, | ||
44 | GIC_FDT_IRQ_FLAGS_EDGE_LO_HI); | ||
45 | + qemu_fdt_setprop(vms->fdt, nodename, "dma-coherent", NULL, 0); | ||
46 | g_free(nodename); | ||
47 | } | ||
48 | } | ||
49 | -- | ||
50 | 2.7.4 | ||
51 | |||
52 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Alexander Graf <agraf@suse.de> | ||
2 | 1 | ||
3 | Virtio-mmio devices can directly access guest memory and do so in cache | ||
4 | coherent fashion. Tell the guest about that fact when it's using ACPI. | ||
5 | |||
6 | Signed-off-by: Alexander Graf <agraf@suse.de> | ||
7 | Reviewed-by: Laszlo Ersek <lersek@redhat.com> | ||
8 | Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> | ||
9 | Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org> | ||
10 | Message-id: 1486644810-33181-3-git-send-email-agraf@suse.de | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | --- | ||
13 | hw/arm/virt-acpi-build.c | 1 + | ||
14 | 1 file changed, 1 insertion(+) | ||
15 | |||
16 | diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/hw/arm/virt-acpi-build.c | ||
19 | +++ b/hw/arm/virt-acpi-build.c | ||
20 | @@ -XXX,XX +XXX,XX @@ static void acpi_dsdt_add_virtio(Aml *scope, | ||
21 | Aml *dev = aml_device("VR%02u", i); | ||
22 | aml_append(dev, aml_name_decl("_HID", aml_string("LNRO0005"))); | ||
23 | aml_append(dev, aml_name_decl("_UID", aml_int(i))); | ||
24 | + aml_append(dev, aml_name_decl("_CCA", aml_int(1))); | ||
25 | |||
26 | Aml *crs = aml_resource_template(); | ||
27 | aml_append(crs, aml_memory32_fixed(base, size, AML_READ_WRITE)); | ||
28 | -- | ||
29 | 2.7.4 | ||
30 | |||
31 | diff view generated by jsdifflib |
1 | From: Cédric Le Goater <clg@kaod.org> | 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 | The size of a segment is not necessarily a power of 2. | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
9 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
10 | Message-id: 20200728103744.6909-4-peter.maydell@linaro.org | ||
11 | --- | ||
12 | hw/arm/msf2-soc.c | 11 ----------- | ||
13 | hw/arm/stellaris.c | 12 ------------ | ||
14 | 2 files changed, 23 deletions(-) | ||
4 | 15 | ||
5 | Signed-off-by: Cédric Le Goater <clg@kaod.org> | 16 | diff --git a/hw/arm/msf2-soc.c b/hw/arm/msf2-soc.c |
6 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
7 | Message-id: 1486648058-520-5-git-send-email-clg@kaod.org | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | hw/ssi/aspeed_smc.c | 4 ++-- | ||
11 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
12 | |||
13 | diff --git a/hw/ssi/aspeed_smc.c b/hw/ssi/aspeed_smc.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/hw/ssi/aspeed_smc.c | 18 | --- a/hw/arm/msf2-soc.c |
16 | +++ b/hw/ssi/aspeed_smc.c | 19 | +++ b/hw/arm/msf2-soc.c |
17 | @@ -XXX,XX +XXX,XX @@ static uint32_t aspeed_smc_check_segment_addr(const AspeedSMCFlash *fl, | 20 | @@ -XXX,XX +XXX,XX @@ |
18 | AspeedSegments seg; | 21 | #include "hw/irq.h" |
19 | 22 | #include "hw/arm/msf2-soc.h" | |
20 | aspeed_smc_reg_to_segment(s->regs[R_SEG_ADDR0 + fl->id], &seg); | 23 | #include "hw/misc/unimp.h" |
21 | - if ((addr & (seg.size - 1)) != addr) { | 24 | -#include "sysemu/runstate.h" |
22 | + if ((addr % seg.size) != addr) { | 25 | #include "sysemu/sysemu.h" |
23 | qemu_log_mask(LOG_GUEST_ERROR, | 26 | |
24 | "%s: invalid address 0x%08x for CS%d segment : " | 27 | #define MSF2_TIMER_BASE 0x40004000 |
25 | "[ 0x%"HWADDR_PRIx" - 0x%"HWADDR_PRIx" ]\n", | 28 | @@ -XXX,XX +XXX,XX @@ static const int spi_irq[MSF2_NUM_SPIS] = { 2, 3 }; |
26 | s->ctrl->name, addr, fl->id, seg.addr, | 29 | static const int uart_irq[MSF2_NUM_UARTS] = { 10, 11 }; |
27 | seg.addr + seg.size); | 30 | static const int timer_irq[MSF2_NUM_TIMERS] = { 14, 15 }; |
28 | + addr %= seg.size; | 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; | ||
29 | } | 44 | } |
30 | 45 | ||
31 | - addr &= seg.size - 1; | 46 | - qdev_connect_gpio_out_named(DEVICE(&s->armv7m.nvic), "SYSRESETREQ", 0, |
32 | return addr; | 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); | ||
33 | } | 66 | } |
34 | 67 | ||
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), | ||
35 | -- | 89 | -- |
36 | 2.7.4 | 90 | 2.20.1 |
37 | 91 | ||
38 | 92 | diff view generated by jsdifflib |
1 | From: Cédric Le Goater <clg@kaod.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | write_boot_rom() does not check for negative values. This is more a | 3 | The definition of top_bit used in this function is one higher |
4 | problem for coverity than the actual code as the size of the flash | 4 | than that used in the Arm ARM psuedo-code, which put the error |
5 | device is checked when the m25p80 object is created. If there is | 5 | indication at top_bit - 1 at the wrong place, which meant that |
6 | anything wrong with the backing file, we should not even reach that | 6 | it wasn't visible to Auth. |
7 | path. | ||
8 | 7 | ||
9 | Signed-off-by: Cédric Le Goater <clg@kaod.org> | 8 | Fixing the definition of top_bit requires more changes, because |
10 | Message-id: 1486648058-520-2-git-send-email-clg@kaod.org | 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> | ||
16 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
17 | Message-id: 20200728195706.11087-1-richard.henderson@linaro.org | ||
11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 18 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
19 | [PMM: added comment about the divergence from the pseudocode] | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 20 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | --- | 21 | --- |
14 | hw/arm/aspeed.c | 14 ++++++++++++-- | 22 | target/arm/pauth_helper.c | 6 +++++- |
15 | 1 file changed, 12 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 | ||
16 | 27 | ||
17 | diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c | 28 | diff --git a/target/arm/pauth_helper.c b/target/arm/pauth_helper.c |
18 | index XXXXXXX..XXXXXXX 100644 | 29 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/hw/arm/aspeed.c | 30 | --- a/target/arm/pauth_helper.c |
20 | +++ b/hw/arm/aspeed.c | 31 | +++ b/target/arm/pauth_helper.c |
21 | @@ -XXX,XX +XXX,XX @@ static void write_boot_rom(DriveInfo *dinfo, hwaddr addr, size_t rom_size, | 32 | @@ -XXX,XX +XXX,XX @@ static uint64_t pauth_addpac(CPUARMState *env, uint64_t ptr, uint64_t modifier, |
22 | { | 33 | */ |
23 | BlockBackend *blk = blk_by_legacy_dinfo(dinfo); | 34 | test = sextract64(ptr, bot_bit, top_bit - bot_bit); |
24 | uint8_t *storage; | 35 | if (test != 0 && test != -1) { |
25 | + int64_t size; | 36 | - pac ^= MAKE_64BIT_MASK(top_bit - 1, 1); |
26 | 37 | + /* | |
27 | - if (rom_size > blk_getlength(blk)) { | 38 | + * Note that our top_bit is one greater than the pseudocode's |
28 | - rom_size = blk_getlength(blk); | 39 | + * version, hence "- 2" here. |
29 | + /* The block backend size should have already been 'validated' by | 40 | + */ |
30 | + * the creation of the m25p80 object. | 41 | + pac ^= MAKE_64BIT_MASK(top_bit - 2, 1); |
42 | } | ||
43 | |||
44 | /* | ||
45 | diff --git a/tests/tcg/aarch64/pauth-5.c b/tests/tcg/aarch64/pauth-5.c | ||
46 | new file mode 100644 | ||
47 | index XXXXXXX..XXXXXXX | ||
48 | --- /dev/null | ||
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. | ||
31 | + */ | 64 | + */ |
32 | + size = blk_getlength(blk); | 65 | + do { |
33 | + if (size <= 0) { | 66 | + salt++; |
34 | + error_setg(errp, "failed to get flash size"); | 67 | + asm("pacda %0, %1" : "=r"(p1) : "r"(salt), "0"(p0)); |
35 | + return; | 68 | + } while (p0 == p1); |
36 | + } | ||
37 | + | 69 | + |
38 | + if (rom_size > size) { | 70 | + /* |
39 | + rom_size = size; | 71 | + * This pac must fail, because the input pointer bears an encryption, |
40 | } | 72 | + * and so is not properly extended within bits [55:47]. This will |
41 | 73 | + * toggle bit 54 in the output... | |
42 | storage = g_new0(uint8_t, rom_size); | 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 | ||
43 | -- | 97 | -- |
44 | 2.7.4 | 98 | 2.20.1 |
45 | 99 | ||
46 | 100 | diff view generated by jsdifflib |
1 | From: Alexander Graf <agraf@suse.de> | 1 | From: Kaige Li <likaige@loongson.cn> |
---|---|---|---|
2 | 2 | ||
3 | Fw-cfg recently learned how to directly access guest memory and does so in | 3 | GCC version 4.9.4 isn't clever enough to figure out that all |
4 | cache coherent fashion. Tell the guest about that fact when it's using DT. | 4 | execution paths in disas_ldst() that use 'fn' will have initialized |
5 | it first, and so it warns: | ||
5 | 6 | ||
6 | Signed-off-by: Alexander Graf <agraf@suse.de> | 7 | /home/LiKaige/qemu/target/arm/translate-a64.c: In function ‘disas_ldst’: |
7 | Reviewed-by: Laszlo Ersek <lersek@redhat.com> | 8 | /home/LiKaige/qemu/target/arm/translate-a64.c:3392:5: error: ‘fn’ may be used uninitialized in this function [-Werror=maybe-uninitialized] |
8 | Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> | 9 | fn(cpu_reg(s, rt), clean_addr, tcg_rs, get_mem_index(s), |
9 | Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org> | 10 | ^ |
10 | Message-id: 1486644810-33181-5-git-send-email-agraf@suse.de | 11 | /home/LiKaige/qemu/target/arm/translate-a64.c:3318:22: note: ‘fn’ was declared here |
12 | AtomicThreeOpFn *fn; | ||
13 | ^ | ||
14 | |||
15 | Make it happy by initializing the variable to NULL. | ||
16 | |||
17 | Signed-off-by: Kaige Li <likaige@loongson.cn> | ||
18 | Message-id: 1596110248-7366-2-git-send-email-likaige@loongson.cn | ||
19 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
20 | [PMM: Clean up commit message and note which gcc version this was] | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 21 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 22 | --- |
13 | hw/arm/virt.c | 1 + | 23 | target/arm/translate-a64.c | 2 +- |
14 | 1 file changed, 1 insertion(+) | 24 | 1 file changed, 1 insertion(+), 1 deletion(-) |
15 | 25 | ||
16 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | 26 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
17 | index XXXXXXX..XXXXXXX 100644 | 27 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/hw/arm/virt.c | 28 | --- a/target/arm/translate-a64.c |
19 | +++ b/hw/arm/virt.c | 29 | +++ b/target/arm/translate-a64.c |
20 | @@ -XXX,XX +XXX,XX @@ static FWCfgState *create_fw_cfg(const VirtMachineState *vms, AddressSpace *as) | 30 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_atomic(DisasContext *s, uint32_t insn, |
21 | "compatible", "qemu,fw-cfg-mmio"); | 31 | bool r = extract32(insn, 22, 1); |
22 | qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "reg", | 32 | bool a = extract32(insn, 23, 1); |
23 | 2, base, 2, size); | 33 | TCGv_i64 tcg_rs, clean_addr; |
24 | + qemu_fdt_setprop(vms->fdt, nodename, "dma-coherent", NULL, 0); | 34 | - AtomicThreeOpFn *fn; |
25 | g_free(nodename); | 35 | + AtomicThreeOpFn *fn = NULL; |
26 | return fw_cfg; | 36 | |
27 | } | 37 | if (is_vector || !dc_isar_feature(aa64_atomics, s)) { |
38 | unallocated_encoding(s); | ||
28 | -- | 39 | -- |
29 | 2.7.4 | 40 | 2.20.1 |
30 | 41 | ||
31 | 42 | diff view generated by jsdifflib |
1 | From: Alexander Graf <agraf@suse.de> | 1 | The nrf51 SoC model wasn't setting the system_clock_scale |
---|---|---|---|
2 | global.which meant that if guest code used the systick timer in "use | ||
3 | the processor clock" mode it would hang because time never advances. | ||
2 | 4 | ||
3 | Fw-cfg recently learned how to directly access guest memory and does so in | 5 | Set the global to match the documented CPU clock speed for this SoC. |
4 | cache coherent fashion. Tell the guest about that fact when it's using ACPI. | ||
5 | 6 | ||
6 | Signed-off-by: Alexander Graf <agraf@suse.de> | 7 | This SoC in fact doesn't have a SysTick timer (which is the only thing |
7 | Reviewed-by: Laszlo Ersek <lersek@redhat.com> | 8 | currently that cares about the system_clock_scale), because it's |
8 | Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> | 9 | a configurable option in the Cortex-M0. However our Cortex-M0 and |
9 | Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org> | 10 | thus our nrf51 and our micro:bit board do provide a SysTick, so |
10 | Message-id: 1486644810-33181-4-git-send-email-agraf@suse.de | 11 | we ought to provide a functional one rather than a broken one. |
12 | |||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
15 | Message-id: 20200727193458.31250-1-peter.maydell@linaro.org | ||
12 | --- | 16 | --- |
13 | hw/arm/virt-acpi-build.c | 1 + | 17 | hw/arm/nrf51_soc.c | 5 +++++ |
14 | 1 file changed, 1 insertion(+) | 18 | 1 file changed, 5 insertions(+) |
15 | 19 | ||
16 | diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c | 20 | diff --git a/hw/arm/nrf51_soc.c b/hw/arm/nrf51_soc.c |
17 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/hw/arm/virt-acpi-build.c | 22 | --- a/hw/arm/nrf51_soc.c |
19 | +++ b/hw/arm/virt-acpi-build.c | 23 | +++ b/hw/arm/nrf51_soc.c |
20 | @@ -XXX,XX +XXX,XX @@ static void acpi_dsdt_add_fw_cfg(Aml *scope, const MemMapEntry *fw_cfg_memmap) | 24 | @@ -XXX,XX +XXX,XX @@ |
21 | aml_append(dev, aml_name_decl("_HID", aml_string("QEMU0002"))); | 25 | |
22 | /* device present, functioning, decoding, not shown in UI */ | 26 | #define BASE_TO_IRQ(base) ((base >> 12) & 0x1F) |
23 | aml_append(dev, aml_name_decl("_STA", aml_int(0xB))); | 27 | |
24 | + aml_append(dev, aml_name_decl("_CCA", aml_int(1))); | 28 | +/* HCLK (the main CPU clock) on this SoC is always 16MHz */ |
25 | 29 | +#define HCLK_FRQ 16000000 | |
26 | Aml *crs = aml_resource_template(); | 30 | + |
27 | aml_append(crs, aml_memory32_fixed(fw_cfg_memmap->base, | 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; | ||
36 | } | ||
37 | |||
38 | + system_clock_scale = NANOSECONDS_PER_SECOND / HCLK_FRQ; | ||
39 | + | ||
40 | object_property_set_link(OBJECT(&s->cpu), "memory", OBJECT(&s->container), | ||
41 | &error_abort); | ||
42 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->cpu), errp)) { | ||
28 | -- | 43 | -- |
29 | 2.7.4 | 44 | 2.20.1 |
30 | 45 | ||
31 | 46 | diff view generated by jsdifflib |
1 | From: Cédric Le Goater <clg@kaod.org> | 1 | The imx_epit device has a software-controllable reset triggered by |
---|---|---|---|
2 | setting the SWR bit in the CR register. An error in commit cc2722ec83ad9 | ||
3 | means that we will end up assert()ing if the guest does this, because | ||
4 | the code in imx_epit_write() starts ptimer transactions, and then | ||
5 | imx_epit_reset() also starts ptimer transactions, triggering | ||
6 | "ptimer_transaction_begin: Assertion `!s->in_transaction' failed". | ||
2 | 7 | ||
3 | HW works fine in normal read mode with dummy bytes being set. So let's | 8 | The cleanest way to avoid this double-transaction is to move the |
4 | check this case to not transfer bytes. | 9 | start-transaction for the CR write handling down below the check of |
10 | the SWR bit. | ||
5 | 11 | ||
6 | Signed-off-by: Cédric Le Goater <clg@kaod.org> | 12 | Fixes: https://bugs.launchpad.net/qemu/+bug/1880424 |
7 | Message-id: 1486648058-520-4-git-send-email-clg@kaod.org | 13 | Fixes: cc2722ec83ad944505fe |
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
15 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
16 | Message-id: 20200727154550.3409-1-peter.maydell@linaro.org | ||
9 | --- | 17 | --- |
10 | hw/ssi/aspeed_smc.c | 9 ++++++--- | 18 | hw/timer/imx_epit.c | 13 ++++++++++--- |
11 | 1 file changed, 6 insertions(+), 3 deletions(-) | 19 | 1 file changed, 10 insertions(+), 3 deletions(-) |
12 | 20 | ||
13 | diff --git a/hw/ssi/aspeed_smc.c b/hw/ssi/aspeed_smc.c | 21 | diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c |
14 | index XXXXXXX..XXXXXXX 100644 | 22 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/hw/ssi/aspeed_smc.c | 23 | --- a/hw/timer/imx_epit.c |
16 | +++ b/hw/ssi/aspeed_smc.c | 24 | +++ b/hw/timer/imx_epit.c |
17 | @@ -XXX,XX +XXX,XX @@ static uint64_t aspeed_smc_flash_read(void *opaque, hwaddr addr, unsigned size) | 25 | @@ -XXX,XX +XXX,XX @@ static void imx_epit_write(void *opaque, hwaddr offset, uint64_t value, |
18 | /* | 26 | |
19 | * Use fake transfers to model dummy bytes. The value should | 27 | switch (offset >> 2) { |
20 | * be configured to some non-zero value in fast read mode and | 28 | case 0: /* CR */ |
21 | - * zero in read mode. | 29 | - ptimer_transaction_begin(s->timer_cmp); |
22 | + * zero in read mode. But, as the HW allows inconsistent | 30 | - ptimer_transaction_begin(s->timer_reload); |
23 | + * settings, let's check for fast read mode. | 31 | |
24 | */ | 32 | oldcr = s->cr; |
25 | - for (i = 0; i < aspeed_smc_flash_dummies(fl); i++) { | 33 | s->cr = value & 0x03ffffff; |
26 | - ssi_transfer(fl->controller->spi, 0xFF); | 34 | if (s->cr & CR_SWR) { |
27 | + if (aspeed_smc_flash_mode(fl) == CTRL_FREADMODE) { | 35 | /* handle the reset */ |
28 | + for (i = 0; i < aspeed_smc_flash_dummies(fl); i++) { | 36 | imx_epit_reset(DEVICE(s)); |
29 | + ssi_transfer(fl->controller->spi, 0xFF); | 37 | - } else { |
30 | + } | 38 | + /* |
39 | + * TODO: could we 'break' here? following operations appear | ||
40 | + * to duplicate the work imx_epit_reset() already did. | ||
41 | + */ | ||
42 | + } | ||
43 | + | ||
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); | ||
31 | } | 49 | } |
32 | 50 | ||
33 | for (i = 0; i < size; i++) { | ||
34 | -- | 51 | -- |
35 | 2.7.4 | 52 | 2.20.1 |
36 | 53 | ||
37 | 54 | diff view generated by jsdifflib |