1 | A handful of bugfixes before rc1 tomorrow... | 1 | Hi; some minor changes for 6.2, which I think can be classified |
---|---|---|---|
2 | as bug fixes and are OK for this point in the release cycle. | ||
3 | (Wouldn't be the end of the world if they slipped to 7.0.) | ||
2 | 4 | ||
3 | thanks | ||
4 | -- PMM | 5 | -- PMM |
5 | 6 | ||
6 | The following changes since commit f9fe8450fa7cdc6268e05c93fa258f583f4514b7: | 7 | The following changes since commit 42f6c9179be4401974dd3a75ee72defd16b5092d: |
7 | 8 | ||
8 | Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-5.0-pull-request' into staging (2020-03-30 11:32:01 +0100) | 9 | Merge tag 'pull-ppc-20211112' of https://github.com/legoater/qemu into staging (2021-11-12 12:28:25 +0100) |
9 | 10 | ||
10 | are available in the Git repository at: | 11 | are available in the Git repository at: |
11 | 12 | ||
12 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20200330 | 13 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20211115-1 |
13 | 14 | ||
14 | for you to fetch changes up to 88828bf133b64b7a860c166af3423ef1a47c5d3b: | 15 | for you to fetch changes up to 1adf528ec3bdf62ea3b580b7ad562534a3676ff5: |
15 | 16 | ||
16 | target/arm: fix incorrect current EL bug in aarch32 exception emulation (2020-03-30 13:55:32 +0100) | 17 | hw/rtc/pl031: Send RTC_CHANGE QMP event (2021-11-15 18:53:00 +0000) |
17 | 18 | ||
18 | ---------------------------------------------------------------- | 19 | ---------------------------------------------------------------- |
19 | target-arm queue: | 20 | target-arm queue: |
20 | * hw/arm/orangepi: check for potential NULL pointer when calling blk_is_available | 21 | * Support multiple redistributor regions for TCG GICv3 |
21 | * hw/misc/allwinner-h3-dramc: enforce 64-bit multiply when calculating row mirror address | 22 | * Send RTC_CHANGE QMP event from pl031 |
22 | * docs/conf.py: Raise ConfigError for bad Sphinx Python version | ||
23 | * hw/arm/xlnx-zynqmp.c: Avoid memory leak in error-return path | ||
24 | * hw/arm/xlnx-zynqmp.c: Add missing error-propagation code | ||
25 | * target/arm: fix incorrect current EL bug in aarch32 exception emulation | ||
26 | 23 | ||
27 | ---------------------------------------------------------------- | 24 | ---------------------------------------------------------------- |
28 | Changbin Du (1): | 25 | Eric Auger (1): |
29 | target/arm: fix incorrect current EL bug in aarch32 exception emulation | 26 | hw/rtc/pl031: Send RTC_CHANGE QMP event |
30 | |||
31 | Niek Linnenbank (2): | ||
32 | hw/arm/orangepi: check for potential NULL pointer when calling blk_is_available | ||
33 | hw/misc/allwinner-h3-dramc: enforce 64-bit multiply when calculating row mirror address | ||
34 | 27 | ||
35 | Peter Maydell (3): | 28 | Peter Maydell (3): |
36 | docs/conf.py: Raise ConfigError for bad Sphinx Python version | 29 | hw/intc/arm_gicv3: Move checking of redist-region-count to arm_gicv3_common_realize |
37 | hw/arm/xlnx-zynqmp.c: Avoid memory leak in error-return path | 30 | hw/intc/arm_gicv3: Set GICR_TYPER.Last correctly when nb_redist_regions > 1 |
38 | hw/arm/xlnx-zynqmp.c: Add missing error-propagation code | 31 | hw/intc/arm_gicv3: Support multiple redistributor regions |
39 | 32 | ||
40 | hw/arm/orangepi.c | 2 +- | 33 | include/hw/intc/arm_gicv3_common.h | 14 ++++++++-- |
41 | hw/arm/xlnx-zynqmp.c | 27 ++++++++++++++++++++++++++- | 34 | hw/intc/arm_gicv3.c | 12 +------- |
42 | hw/misc/allwinner-h3-dramc.c | 4 ++-- | 35 | hw/intc/arm_gicv3_common.c | 56 ++++++++++++++++++++++++-------------- |
43 | target/arm/helper.c | 5 ++++- | 36 | hw/intc/arm_gicv3_kvm.c | 10 ++----- |
44 | docs/conf.py | 9 +++++---- | 37 | hw/intc/arm_gicv3_redist.c | 40 +++++++++++++++------------ |
45 | 5 files changed, 38 insertions(+), 9 deletions(-) | 38 | hw/rtc/pl031.c | 10 ++++++- |
39 | hw/rtc/meson.build | 2 +- | ||
40 | 7 files changed, 83 insertions(+), 61 deletions(-) | ||
46 | 41 | diff view generated by jsdifflib |
1 | In some places in xlnx_zynqmp_realize() we were putting an | 1 | The GICv3 devices have an array property redist-region-count. |
---|---|---|---|
2 | error into our local Error*, but forgetting to check for | 2 | Currently we check this for errors (bad values) in |
3 | failure and pass it back to the caller. Add the missing code. | 3 | gicv3_init_irqs_and_mmio(), just before we use it. Move this error |
4 | checking to the arm_gicv3_common_realize() function, where we | ||
5 | sanity-check all of the other base-class properties. (This will | ||
6 | always be before gicv3_init_irqs_and_mmio() is called, because | ||
7 | that function is called in the subclass realize methods, after | ||
8 | they have called the parent-class realize.) | ||
9 | |||
10 | The motivation for this refactor is: | ||
11 | * we would like to use the redist_region_count[] values in | ||
12 | arm_gicv3_common_realize() in a subsequent patch, so we need | ||
13 | to have already done the sanity-checking first | ||
14 | * this removes the only use of the Error** argument to | ||
15 | gicv3_init_irqs_and_mmio(), so we can remove some error-handling | ||
16 | boilerplate | ||
4 | 17 | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 19 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
8 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
9 | Message-id: 20200324134947.15384-3-peter.maydell@linaro.org | ||
10 | --- | 20 | --- |
11 | hw/arm/xlnx-zynqmp.c | 24 ++++++++++++++++++++++++ | 21 | include/hw/intc/arm_gicv3_common.h | 2 +- |
12 | 1 file changed, 24 insertions(+) | 22 | hw/intc/arm_gicv3.c | 6 +----- |
23 | hw/intc/arm_gicv3_common.c | 26 +++++++++++++------------- | ||
24 | hw/intc/arm_gicv3_kvm.c | 6 +----- | ||
25 | 4 files changed, 16 insertions(+), 24 deletions(-) | ||
13 | 26 | ||
14 | diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c | 27 | diff --git a/include/hw/intc/arm_gicv3_common.h b/include/hw/intc/arm_gicv3_common.h |
15 | index XXXXXXX..XXXXXXX 100644 | 28 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/arm/xlnx-zynqmp.c | 29 | --- a/include/hw/intc/arm_gicv3_common.h |
17 | +++ b/hw/arm/xlnx-zynqmp.c | 30 | +++ b/include/hw/intc/arm_gicv3_common.h |
18 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) | 31 | @@ -XXX,XX +XXX,XX @@ struct ARMGICv3CommonClass { |
19 | * - eMMC Specification Version 4.51 | 32 | }; |
20 | */ | 33 | |
21 | object_property_set_uint(sdhci, 3, "sd-spec-version", &err); | 34 | void gicv3_init_irqs_and_mmio(GICv3State *s, qemu_irq_handler handler, |
22 | + if (err) { | 35 | - const MemoryRegionOps *ops, Error **errp); |
23 | + error_propagate(errp, err); | 36 | + const MemoryRegionOps *ops); |
24 | + return; | 37 | |
25 | + } | 38 | #endif |
26 | object_property_set_uint(sdhci, SDHCI_CAPABILITIES, "capareg", &err); | 39 | diff --git a/hw/intc/arm_gicv3.c b/hw/intc/arm_gicv3.c |
27 | + if (err) { | 40 | index XXXXXXX..XXXXXXX 100644 |
28 | + error_propagate(errp, err); | 41 | --- a/hw/intc/arm_gicv3.c |
29 | + return; | 42 | +++ b/hw/intc/arm_gicv3.c |
30 | + } | 43 | @@ -XXX,XX +XXX,XX @@ static void arm_gic_realize(DeviceState *dev, Error **errp) |
31 | object_property_set_uint(sdhci, UHS_I, "uhs", &err); | 44 | return; |
32 | + if (err) { | ||
33 | + error_propagate(errp, err); | ||
34 | + return; | ||
35 | + } | ||
36 | object_property_set_bool(sdhci, true, "realized", &err); | ||
37 | if (err) { | ||
38 | error_propagate(errp, err); | ||
39 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) | ||
40 | gchar *bus_name; | ||
41 | |||
42 | object_property_set_bool(OBJECT(&s->spi[i]), true, "realized", &err); | ||
43 | + if (err) { | ||
44 | + error_propagate(errp, err); | ||
45 | + return; | ||
46 | + } | ||
47 | |||
48 | sysbus_mmio_map(SYS_BUS_DEVICE(&s->spi[i]), 0, spi_addr[i]); | ||
49 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->spi[i]), 0, | ||
50 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) | ||
51 | } | 45 | } |
52 | 46 | ||
53 | object_property_set_bool(OBJECT(&s->qspi), true, "realized", &err); | 47 | - gicv3_init_irqs_and_mmio(s, gicv3_set_irq, gic_ops, &local_err); |
54 | + if (err) { | 48 | - if (local_err) { |
55 | + error_propagate(errp, err); | 49 | - error_propagate(errp, local_err); |
50 | - return; | ||
51 | - } | ||
52 | + gicv3_init_irqs_and_mmio(s, gicv3_set_irq, gic_ops); | ||
53 | |||
54 | gicv3_init_cpuif(s); | ||
55 | } | ||
56 | diff --git a/hw/intc/arm_gicv3_common.c b/hw/intc/arm_gicv3_common.c | ||
57 | index XXXXXXX..XXXXXXX 100644 | ||
58 | --- a/hw/intc/arm_gicv3_common.c | ||
59 | +++ b/hw/intc/arm_gicv3_common.c | ||
60 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_gicv3 = { | ||
61 | }; | ||
62 | |||
63 | void gicv3_init_irqs_and_mmio(GICv3State *s, qemu_irq_handler handler, | ||
64 | - const MemoryRegionOps *ops, Error **errp) | ||
65 | + const MemoryRegionOps *ops) | ||
66 | { | ||
67 | SysBusDevice *sbd = SYS_BUS_DEVICE(s); | ||
68 | - int rdist_capacity = 0; | ||
69 | int i; | ||
70 | |||
71 | - for (i = 0; i < s->nb_redist_regions; i++) { | ||
72 | - rdist_capacity += s->redist_region_count[i]; | ||
73 | - } | ||
74 | - if (rdist_capacity < s->num_cpu) { | ||
75 | - error_setg(errp, "Capacity of the redist regions(%d) " | ||
76 | - "is less than number of vcpus(%d)", | ||
77 | - rdist_capacity, s->num_cpu); | ||
78 | - return; | ||
79 | - } | ||
80 | - | ||
81 | /* For the GIC, also expose incoming GPIO lines for PPIs for each CPU. | ||
82 | * GPIO array layout is thus: | ||
83 | * [0..N-1] spi | ||
84 | @@ -XXX,XX +XXX,XX @@ void gicv3_init_irqs_and_mmio(GICv3State *s, qemu_irq_handler handler, | ||
85 | static void arm_gicv3_common_realize(DeviceState *dev, Error **errp) | ||
86 | { | ||
87 | GICv3State *s = ARM_GICV3_COMMON(dev); | ||
88 | - int i; | ||
89 | + int i, rdist_capacity; | ||
90 | |||
91 | /* revision property is actually reserved and currently used only in order | ||
92 | * to keep the interface compatible with GICv2 code, avoiding extra | ||
93 | @@ -XXX,XX +XXX,XX @@ static void arm_gicv3_common_realize(DeviceState *dev, Error **errp) | ||
94 | return; | ||
95 | } | ||
96 | |||
97 | + rdist_capacity = 0; | ||
98 | + for (i = 0; i < s->nb_redist_regions; i++) { | ||
99 | + rdist_capacity += s->redist_region_count[i]; | ||
100 | + } | ||
101 | + if (rdist_capacity < s->num_cpu) { | ||
102 | + error_setg(errp, "Capacity of the redist regions(%d) " | ||
103 | + "is less than number of vcpus(%d)", | ||
104 | + rdist_capacity, s->num_cpu); | ||
56 | + return; | 105 | + return; |
57 | + } | 106 | + } |
58 | sysbus_mmio_map(SYS_BUS_DEVICE(&s->qspi), 0, QSPI_ADDR); | 107 | + |
59 | sysbus_mmio_map(SYS_BUS_DEVICE(&s->qspi), 1, LQSPI_ADDR); | 108 | s->cpu = g_new0(GICv3CPUState, s->num_cpu); |
60 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->qspi), 0, gic_spi[QSPI_IRQ]); | 109 | |
61 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) | 110 | for (i = 0; i < s->num_cpu; i++) { |
62 | 111 | diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c | |
63 | for (i = 0; i < XLNX_ZYNQMP_NUM_GDMA_CH; i++) { | 112 | index XXXXXXX..XXXXXXX 100644 |
64 | object_property_set_uint(OBJECT(&s->gdma[i]), 128, "bus-width", &err); | 113 | --- a/hw/intc/arm_gicv3_kvm.c |
65 | + if (err) { | 114 | +++ b/hw/intc/arm_gicv3_kvm.c |
66 | + error_propagate(errp, err); | 115 | @@ -XXX,XX +XXX,XX @@ static void kvm_arm_gicv3_realize(DeviceState *dev, Error **errp) |
67 | + return; | 116 | return; |
68 | + } | 117 | } |
69 | object_property_set_bool(OBJECT(&s->gdma[i]), true, "realized", &err); | 118 | |
70 | if (err) { | 119 | - gicv3_init_irqs_and_mmio(s, kvm_arm_gicv3_set_irq, NULL, &local_err); |
71 | error_propagate(errp, err); | 120 | - if (local_err) { |
121 | - error_propagate(errp, local_err); | ||
122 | - return; | ||
123 | - } | ||
124 | + gicv3_init_irqs_and_mmio(s, kvm_arm_gicv3_set_irq, NULL); | ||
125 | |||
126 | for (i = 0; i < s->num_cpu; i++) { | ||
127 | ARMCPU *cpu = ARM_CPU(qemu_get_cpu(i)); | ||
72 | -- | 128 | -- |
73 | 2.20.1 | 129 | 2.25.1 |
74 | 130 | ||
75 | 131 | diff view generated by jsdifflib |
1 | From: Changbin Du <changbin.du@gmail.com> | 1 | The 'Last' bit in the GICR_TYPER GICv3 redistributor register is |
---|---|---|---|
2 | supposed to be set to 1 if this is the last redistributor in a series | ||
3 | of contiguous redistributor pages. Currently we set Last only for | ||
4 | the redistributor for CPU (num_cpu - 1). This only works if there is | ||
5 | a single redistributor region; if there are multiple redistributor | ||
6 | regions then we need to set the Last bit for the last redistributor | ||
7 | in each region. | ||
2 | 8 | ||
3 | The arm_current_el() should be invoked after mode switching. Otherwise, we | 9 | This doesn't cause any problems currently because only the KVM GICv3 |
4 | get a wrong current EL value, since current EL is also determined by | 10 | supports multiple redistributor regions, and it ignores the value in |
5 | current mode. | 11 | GICv3State::gicr_typer. But we need to fix this before we can enable |
12 | support for multiple regions in the emulated GICv3. | ||
6 | 13 | ||
7 | Fixes: 4a2696c0d4 ("target/arm: Set PAN bit as required on exception entry") | 14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Signed-off-by: Changbin Du <changbin.du@gmail.com> | ||
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 15 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
10 | Message-id: 20200328140232.17278-1-changbin.du@gmail.com | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | --- | 16 | --- |
13 | target/arm/helper.c | 5 ++++- | 17 | hw/intc/arm_gicv3_common.c | 17 ++++++++++++----- |
14 | 1 file changed, 4 insertions(+), 1 deletion(-) | 18 | 1 file changed, 12 insertions(+), 5 deletions(-) |
15 | 19 | ||
16 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 20 | diff --git a/hw/intc/arm_gicv3_common.c b/hw/intc/arm_gicv3_common.c |
17 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/helper.c | 22 | --- a/hw/intc/arm_gicv3_common.c |
19 | +++ b/target/arm/helper.c | 23 | +++ b/hw/intc/arm_gicv3_common.c |
20 | @@ -XXX,XX +XXX,XX @@ static void take_aarch32_exception(CPUARMState *env, int new_mode, | 24 | @@ -XXX,XX +XXX,XX @@ void gicv3_init_irqs_and_mmio(GICv3State *s, qemu_irq_handler handler, |
21 | 25 | static void arm_gicv3_common_realize(DeviceState *dev, Error **errp) | |
22 | /* Change the CPU state so as to actually take the exception. */ | 26 | { |
23 | switch_mode(env, new_mode); | 27 | GICv3State *s = ARM_GICV3_COMMON(dev); |
24 | - new_el = arm_current_el(env); | 28 | - int i, rdist_capacity; |
25 | 29 | + int i, rdist_capacity, cpuidx; | |
26 | /* | 30 | |
27 | * For exceptions taken to AArch32 we must clear the SS bit in both | 31 | /* revision property is actually reserved and currently used only in order |
28 | @@ -XXX,XX +XXX,XX @@ static void take_aarch32_exception(CPUARMState *env, int new_mode, | 32 | * to keep the interface compatible with GICv2 code, avoiding extra |
29 | env->condexec_bits = 0; | 33 | @@ -XXX,XX +XXX,XX @@ static void arm_gicv3_common_realize(DeviceState *dev, Error **errp) |
30 | /* Switch to the new mode, and to the correct instruction set. */ | 34 | for (i = 0; i < s->num_cpu; i++) { |
31 | env->uncached_cpsr = (env->uncached_cpsr & ~CPSR_M) | new_mode; | 35 | CPUState *cpu = qemu_get_cpu(i); |
36 | uint64_t cpu_affid; | ||
37 | - int last; | ||
38 | |||
39 | s->cpu[i].cpu = cpu; | ||
40 | s->cpu[i].gic = s; | ||
41 | @@ -XXX,XX +XXX,XX @@ static void arm_gicv3_common_realize(DeviceState *dev, Error **errp) | ||
42 | * PLPIS == 0 (physical LPIs not supported) | ||
43 | */ | ||
44 | cpu_affid = object_property_get_uint(OBJECT(cpu), "mp-affinity", NULL); | ||
45 | - last = (i == s->num_cpu - 1); | ||
46 | |||
47 | /* The CPU mp-affinity property is in MPIDR register format; squash | ||
48 | * the affinity bytes into 32 bits as the GICR_TYPER has them. | ||
49 | @@ -XXX,XX +XXX,XX @@ static void arm_gicv3_common_realize(DeviceState *dev, Error **errp) | ||
50 | (cpu_affid & 0xFFFFFF); | ||
51 | s->cpu[i].gicr_typer = (cpu_affid << 32) | | ||
52 | (1 << 24) | | ||
53 | - (i << 8) | | ||
54 | - (last << 4); | ||
55 | + (i << 8); | ||
56 | |||
57 | if (s->lpi_enable) { | ||
58 | s->cpu[i].gicr_typer |= GICR_TYPER_PLPIS; | ||
59 | } | ||
60 | } | ||
32 | + | 61 | + |
33 | + /* This must be after mode switching. */ | 62 | + /* |
34 | + new_el = arm_current_el(env); | 63 | + * Now go through and set GICR_TYPER.Last for the final |
35 | + | 64 | + * redistributor in each region. |
36 | /* Set new mode endianness */ | 65 | + */ |
37 | env->uncached_cpsr &= ~CPSR_E; | 66 | + cpuidx = 0; |
38 | if (env->cp15.sctlr_el[new_el] & SCTLR_EE) { | 67 | + for (i = 0; i < s->nb_redist_regions; i++) { |
68 | + cpuidx += s->redist_region_count[i]; | ||
69 | + s->cpu[cpuidx - 1].gicr_typer |= GICR_TYPER_LAST; | ||
70 | + } | ||
71 | } | ||
72 | |||
73 | static void arm_gicv3_finalize(Object *obj) | ||
39 | -- | 74 | -- |
40 | 2.20.1 | 75 | 2.25.1 |
41 | 76 | ||
42 | 77 | diff view generated by jsdifflib |
1 | Raise ConfigError rather than VersionRequirementError when we detect | 1 | Our GICv3 QOM interface includes an array property |
---|---|---|---|
2 | that the Python being used by Sphinx is too old. | 2 | redist-region-count which allows board models to specify that the |
3 | 3 | registributor registers are not in a single contiguous range, but | |
4 | Currently the way we flag the Python version problem up to the user | 4 | split into multiple pieces. We implemented this for KVM, but |
5 | causes Sphinx to print an unnecessary Python stack trace as well as | 5 | currently the TCG GICv3 model insists that there is only one region. |
6 | the information about the problem; in most versions of Sphinx this is | 6 | You can see the limit being hit with a setup like: |
7 | unavoidable. | 7 | qemu-system-aarch64 -machine virt,gic-version=3 -smp 124 |
8 | 8 | ||
9 | The upstream Sphinx developers kindly added a feature to allow | 9 | Add support for split regions to the TCG GICv3. To do this we switch |
10 | conf.py to report errors to the user without the backtrace: | 10 | from allocating a simple array of MemoryRegions to an array of |
11 | https://github.com/sphinx-doc/sphinx/commit/be608ca2313fc08eb842f3dc19d0f5d2d8227d08 | 11 | GICv3RedistRegion structs so that we can use the GICv3RedistRegion as |
12 | but the exception type they chose for this was ConfigError. | 12 | the opaque pointer in the MemoryRegion read/write callbacks. Each |
13 | 13 | GICv3RedistRegion contains the MemoryRegion, a backpointer allowing | |
14 | Switch to ConfigError, which won't make any difference with currently | 14 | the read/write callback to get hold of the GICv3State, and an index |
15 | deployed Sphinx versions, but will be prettier one day when the user | 15 | which allows us to calculate which CPU's redistributor is being |
16 | is using a Sphinx version with the new feature. | 16 | accessed. |
17 | |||
18 | Note that arm_gicv3_kvm always passes in NULL as the ops argument | ||
19 | to gicv3_init_irqs_and_mmio(), so the only MemoryRegion read/write | ||
20 | callbacks we need to update to handle this new scheme are the | ||
21 | gicv3_redist_read/write functions used by the emulated GICv3. | ||
17 | 22 | ||
18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 23 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
19 | Reviewed-by: John Snow <jsnow@redhat.com> | 24 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
20 | Message-id: 20200313163616.30674-1-peter.maydell@linaro.org | ||
21 | --- | 25 | --- |
22 | docs/conf.py | 9 +++++---- | 26 | include/hw/intc/arm_gicv3_common.h | 12 ++++++++- |
23 | 1 file changed, 5 insertions(+), 4 deletions(-) | 27 | hw/intc/arm_gicv3.c | 6 ----- |
24 | 28 | hw/intc/arm_gicv3_common.c | 15 ++++++++--- | |
25 | diff --git a/docs/conf.py b/docs/conf.py | 29 | hw/intc/arm_gicv3_kvm.c | 4 +-- |
26 | index XXXXXXX..XXXXXXX 100644 | 30 | hw/intc/arm_gicv3_redist.c | 40 ++++++++++++++++-------------- |
27 | --- a/docs/conf.py | 31 | 5 files changed, 46 insertions(+), 31 deletions(-) |
28 | +++ b/docs/conf.py | 32 | |
29 | @@ -XXX,XX +XXX,XX @@ | 33 | diff --git a/include/hw/intc/arm_gicv3_common.h b/include/hw/intc/arm_gicv3_common.h |
30 | import os | 34 | index XXXXXXX..XXXXXXX 100644 |
31 | import sys | 35 | --- a/include/hw/intc/arm_gicv3_common.h |
32 | import sphinx | 36 | +++ b/include/hw/intc/arm_gicv3_common.h |
33 | -from sphinx.errors import VersionRequirementError | 37 | @@ -XXX,XX +XXX,XX @@ struct GICv3CPUState { |
34 | +from sphinx.errors import ConfigError | 38 | bool seenbetter; |
35 | 39 | }; | |
36 | # Make Sphinx fail cleanly if using an old Python, rather than obscurely | 40 | |
37 | # failing because some code in one of our extensions doesn't work there. | 41 | +/* |
38 | -# Unfortunately this doesn't display very neatly (there's an unavoidable | 42 | + * The redistributor pages might be split into more than one region |
39 | -# Python backtrace) but at least the information gets printed... | 43 | + * on some machine types if there are many CPUs. |
40 | +# In newer versions of Sphinx this will display nicely; in older versions | 44 | + */ |
41 | +# Sphinx will also produce a Python backtrace but at least the information | 45 | +typedef struct GICv3RedistRegion { |
42 | +# gets printed... | 46 | + GICv3State *gic; |
43 | if sys.version_info < (3,5): | 47 | + MemoryRegion iomem; |
44 | - raise VersionRequirementError( | 48 | + uint32_t cpuidx; /* index of first CPU this region covers */ |
45 | + raise ConfigError( | 49 | +} GICv3RedistRegion; |
46 | "QEMU requires a Sphinx that uses Python 3.5 or better\n") | 50 | + |
47 | 51 | struct GICv3State { | |
48 | # The per-manual conf.py will set qemu_docdir for a single-manual build; | 52 | /*< private >*/ |
53 | SysBusDevice parent_obj; | ||
54 | /*< public >*/ | ||
55 | |||
56 | MemoryRegion iomem_dist; /* Distributor */ | ||
57 | - MemoryRegion *iomem_redist; /* Redistributor Regions */ | ||
58 | + GICv3RedistRegion *redist_regions; /* Redistributor Regions */ | ||
59 | uint32_t *redist_region_count; /* redistributor count within each region */ | ||
60 | uint32_t nb_redist_regions; /* number of redist regions */ | ||
61 | |||
62 | diff --git a/hw/intc/arm_gicv3.c b/hw/intc/arm_gicv3.c | ||
63 | index XXXXXXX..XXXXXXX 100644 | ||
64 | --- a/hw/intc/arm_gicv3.c | ||
65 | +++ b/hw/intc/arm_gicv3.c | ||
66 | @@ -XXX,XX +XXX,XX @@ static void arm_gic_realize(DeviceState *dev, Error **errp) | ||
67 | return; | ||
68 | } | ||
69 | |||
70 | - if (s->nb_redist_regions != 1) { | ||
71 | - error_setg(errp, "VGICv3 redist region number(%d) not equal to 1", | ||
72 | - s->nb_redist_regions); | ||
73 | - return; | ||
74 | - } | ||
75 | - | ||
76 | gicv3_init_irqs_and_mmio(s, gicv3_set_irq, gic_ops); | ||
77 | |||
78 | gicv3_init_cpuif(s); | ||
79 | diff --git a/hw/intc/arm_gicv3_common.c b/hw/intc/arm_gicv3_common.c | ||
80 | index XXXXXXX..XXXXXXX 100644 | ||
81 | --- a/hw/intc/arm_gicv3_common.c | ||
82 | +++ b/hw/intc/arm_gicv3_common.c | ||
83 | @@ -XXX,XX +XXX,XX @@ void gicv3_init_irqs_and_mmio(GICv3State *s, qemu_irq_handler handler, | ||
84 | { | ||
85 | SysBusDevice *sbd = SYS_BUS_DEVICE(s); | ||
86 | int i; | ||
87 | + int cpuidx; | ||
88 | |||
89 | /* For the GIC, also expose incoming GPIO lines for PPIs for each CPU. | ||
90 | * GPIO array layout is thus: | ||
91 | @@ -XXX,XX +XXX,XX @@ void gicv3_init_irqs_and_mmio(GICv3State *s, qemu_irq_handler handler, | ||
92 | "gicv3_dist", 0x10000); | ||
93 | sysbus_init_mmio(sbd, &s->iomem_dist); | ||
94 | |||
95 | - s->iomem_redist = g_new0(MemoryRegion, s->nb_redist_regions); | ||
96 | + s->redist_regions = g_new0(GICv3RedistRegion, s->nb_redist_regions); | ||
97 | + cpuidx = 0; | ||
98 | for (i = 0; i < s->nb_redist_regions; i++) { | ||
99 | char *name = g_strdup_printf("gicv3_redist_region[%d]", i); | ||
100 | + GICv3RedistRegion *region = &s->redist_regions[i]; | ||
101 | |||
102 | - memory_region_init_io(&s->iomem_redist[i], OBJECT(s), | ||
103 | - ops ? &ops[1] : NULL, s, name, | ||
104 | + region->gic = s; | ||
105 | + region->cpuidx = cpuidx; | ||
106 | + cpuidx += s->redist_region_count[i]; | ||
107 | + | ||
108 | + memory_region_init_io(®ion->iomem, OBJECT(s), | ||
109 | + ops ? &ops[1] : NULL, region, name, | ||
110 | s->redist_region_count[i] * GICV3_REDIST_SIZE); | ||
111 | - sysbus_init_mmio(sbd, &s->iomem_redist[i]); | ||
112 | + sysbus_init_mmio(sbd, ®ion->iomem); | ||
113 | g_free(name); | ||
114 | } | ||
115 | } | ||
116 | diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c | ||
117 | index XXXXXXX..XXXXXXX 100644 | ||
118 | --- a/hw/intc/arm_gicv3_kvm.c | ||
119 | +++ b/hw/intc/arm_gicv3_kvm.c | ||
120 | @@ -XXX,XX +XXX,XX @@ static void kvm_arm_gicv3_realize(DeviceState *dev, Error **errp) | ||
121 | KVM_VGIC_V3_ADDR_TYPE_DIST, s->dev_fd, 0); | ||
122 | |||
123 | if (!multiple_redist_region_allowed) { | ||
124 | - kvm_arm_register_device(&s->iomem_redist[0], -1, | ||
125 | + kvm_arm_register_device(&s->redist_regions[0].iomem, -1, | ||
126 | KVM_DEV_ARM_VGIC_GRP_ADDR, | ||
127 | KVM_VGIC_V3_ADDR_TYPE_REDIST, s->dev_fd, 0); | ||
128 | } else { | ||
129 | @@ -XXX,XX +XXX,XX @@ static void kvm_arm_gicv3_realize(DeviceState *dev, Error **errp) | ||
130 | uint64_t addr_ormask = | ||
131 | i | ((uint64_t)s->redist_region_count[i] << 52); | ||
132 | |||
133 | - kvm_arm_register_device(&s->iomem_redist[i], -1, | ||
134 | + kvm_arm_register_device(&s->redist_regions[i].iomem, -1, | ||
135 | KVM_DEV_ARM_VGIC_GRP_ADDR, | ||
136 | KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION, | ||
137 | s->dev_fd, addr_ormask); | ||
138 | diff --git a/hw/intc/arm_gicv3_redist.c b/hw/intc/arm_gicv3_redist.c | ||
139 | index XXXXXXX..XXXXXXX 100644 | ||
140 | --- a/hw/intc/arm_gicv3_redist.c | ||
141 | +++ b/hw/intc/arm_gicv3_redist.c | ||
142 | @@ -XXX,XX +XXX,XX @@ static MemTxResult gicr_writell(GICv3CPUState *cs, hwaddr offset, | ||
143 | MemTxResult gicv3_redist_read(void *opaque, hwaddr offset, uint64_t *data, | ||
144 | unsigned size, MemTxAttrs attrs) | ||
145 | { | ||
146 | - GICv3State *s = opaque; | ||
147 | + GICv3RedistRegion *region = opaque; | ||
148 | + GICv3State *s = region->gic; | ||
149 | GICv3CPUState *cs; | ||
150 | MemTxResult r; | ||
151 | int cpuidx; | ||
152 | |||
153 | assert((offset & (size - 1)) == 0); | ||
154 | |||
155 | - /* This region covers all the redistributor pages; there are | ||
156 | - * (for GICv3) two 64K pages per CPU. At the moment they are | ||
157 | - * all contiguous (ie in this one region), though we might later | ||
158 | - * want to allow splitting of redistributor pages into several | ||
159 | - * blocks so we can support more CPUs. | ||
160 | + /* | ||
161 | + * There are (for GICv3) two 64K redistributor pages per CPU. | ||
162 | + * In some cases the redistributor pages for all CPUs are not | ||
163 | + * contiguous (eg on the virt board they are split into two | ||
164 | + * parts if there are too many CPUs to all fit in the same place | ||
165 | + * in the memory map); if so then the GIC has multiple MemoryRegions | ||
166 | + * for the redistributors. | ||
167 | */ | ||
168 | - cpuidx = offset / 0x20000; | ||
169 | - offset %= 0x20000; | ||
170 | - assert(cpuidx < s->num_cpu); | ||
171 | + cpuidx = region->cpuidx + offset / GICV3_REDIST_SIZE; | ||
172 | + offset %= GICV3_REDIST_SIZE; | ||
173 | |||
174 | cs = &s->cpu[cpuidx]; | ||
175 | |||
176 | @@ -XXX,XX +XXX,XX @@ MemTxResult gicv3_redist_read(void *opaque, hwaddr offset, uint64_t *data, | ||
177 | MemTxResult gicv3_redist_write(void *opaque, hwaddr offset, uint64_t data, | ||
178 | unsigned size, MemTxAttrs attrs) | ||
179 | { | ||
180 | - GICv3State *s = opaque; | ||
181 | + GICv3RedistRegion *region = opaque; | ||
182 | + GICv3State *s = region->gic; | ||
183 | GICv3CPUState *cs; | ||
184 | MemTxResult r; | ||
185 | int cpuidx; | ||
186 | |||
187 | assert((offset & (size - 1)) == 0); | ||
188 | |||
189 | - /* This region covers all the redistributor pages; there are | ||
190 | - * (for GICv3) two 64K pages per CPU. At the moment they are | ||
191 | - * all contiguous (ie in this one region), though we might later | ||
192 | - * want to allow splitting of redistributor pages into several | ||
193 | - * blocks so we can support more CPUs. | ||
194 | + /* | ||
195 | + * There are (for GICv3) two 64K redistributor pages per CPU. | ||
196 | + * In some cases the redistributor pages for all CPUs are not | ||
197 | + * contiguous (eg on the virt board they are split into two | ||
198 | + * parts if there are too many CPUs to all fit in the same place | ||
199 | + * in the memory map); if so then the GIC has multiple MemoryRegions | ||
200 | + * for the redistributors. | ||
201 | */ | ||
202 | - cpuidx = offset / 0x20000; | ||
203 | - offset %= 0x20000; | ||
204 | - assert(cpuidx < s->num_cpu); | ||
205 | + cpuidx = region->cpuidx + offset / GICV3_REDIST_SIZE; | ||
206 | + offset %= GICV3_REDIST_SIZE; | ||
207 | |||
208 | cs = &s->cpu[cpuidx]; | ||
209 | |||
49 | -- | 210 | -- |
50 | 2.20.1 | 211 | 2.25.1 |
51 | 212 | ||
52 | 213 | diff view generated by jsdifflib |
1 | From: Niek Linnenbank <nieklinnenbank@gmail.com> | 1 | From: Eric Auger <eric.auger@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | The Orange Pi PC initialization function needs to verify that the SD card | 3 | The PL031 currently is not able to report guest RTC change to the QMP |
4 | block backend is usable before calling the Boot ROM setup routine. When | 4 | monitor as opposed to mc146818 or spapr RTCs. This patch adds the call |
5 | calling blk_is_available() the input parameter should not be NULL. | 5 | to qapi_event_send_rtc_change() when the Load Register is written. The |
6 | This commit ensures that blk_is_available is only called with non-NULL input. | 6 | value which is reported corresponds to the difference between the guest |
7 | reference time and the reference time kept in softmmu/rtc.c. | ||
7 | 8 | ||
8 | Reported-by: Peter Maydell <peter.maydell@linaro.org> | 9 | For instance adding 20s to the guest RTC value will report 20. Adding |
9 | Signed-off-by: Niek Linnenbank <nieklinnenbank@gmail.com> | 10 | an extra 20s to the guest RTC value will report 20 + 20 = 40. |
10 | Message-id: 20200322205439.15231-1-nieklinnenbank@gmail.com | 11 | |
12 | The inclusion of qapi/qapi-types-misc-target.h in hw/rtl/pl031.c | ||
13 | require to compile the PL031 with specific_ss.add() to avoid | ||
14 | ./qapi/qapi-types-misc-target.h:18:13: error: attempt to use poisoned | ||
15 | "TARGET_<ARCH>". | ||
16 | |||
17 | Signed-off-by: Eric Auger <eric.auger@redhat.com> | ||
11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 18 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
19 | Message-id: 20210920122535.269988-1-eric.auger@redhat.com | ||
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/orangepi.c | 2 +- | 22 | hw/rtc/pl031.c | 10 +++++++++- |
15 | 1 file changed, 1 insertion(+), 1 deletion(-) | 23 | hw/rtc/meson.build | 2 +- |
24 | 2 files changed, 10 insertions(+), 2 deletions(-) | ||
16 | 25 | ||
17 | diff --git a/hw/arm/orangepi.c b/hw/arm/orangepi.c | 26 | diff --git a/hw/rtc/pl031.c b/hw/rtc/pl031.c |
18 | index XXXXXXX..XXXXXXX 100644 | 27 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/hw/arm/orangepi.c | 28 | --- a/hw/rtc/pl031.c |
20 | +++ b/hw/arm/orangepi.c | 29 | +++ b/hw/rtc/pl031.c |
21 | @@ -XXX,XX +XXX,XX @@ static void orangepi_init(MachineState *machine) | 30 | @@ -XXX,XX +XXX,XX @@ |
22 | machine->ram); | 31 | #include "qemu/log.h" |
23 | 32 | #include "qemu/module.h" | |
24 | /* Load target kernel or start using BootROM */ | 33 | #include "trace.h" |
25 | - if (!machine->kernel_filename && blk_is_available(blk)) { | 34 | +#include "qapi/qapi-events-misc-target.h" |
26 | + if (!machine->kernel_filename && blk && blk_is_available(blk)) { | 35 | |
27 | /* Use Boot ROM to copy data from SD card to SRAM */ | 36 | #define RTC_DR 0x00 /* Data read register */ |
28 | allwinner_h3_bootrom_setup(h3, blk); | 37 | #define RTC_MR 0x04 /* Match register */ |
29 | } | 38 | @@ -XXX,XX +XXX,XX @@ static void pl031_write(void * opaque, hwaddr offset, |
39 | trace_pl031_write(offset, value); | ||
40 | |||
41 | switch (offset) { | ||
42 | - case RTC_LR: | ||
43 | + case RTC_LR: { | ||
44 | + struct tm tm; | ||
45 | + | ||
46 | s->tick_offset += value - pl031_get_count(s); | ||
47 | + | ||
48 | + qemu_get_timedate(&tm, s->tick_offset); | ||
49 | + qapi_event_send_rtc_change(qemu_timedate_diff(&tm)); | ||
50 | + | ||
51 | pl031_set_alarm(s); | ||
52 | break; | ||
53 | + } | ||
54 | case RTC_MR: | ||
55 | s->mr = value; | ||
56 | pl031_set_alarm(s); | ||
57 | diff --git a/hw/rtc/meson.build b/hw/rtc/meson.build | ||
58 | index XXXXXXX..XXXXXXX 100644 | ||
59 | --- a/hw/rtc/meson.build | ||
60 | +++ b/hw/rtc/meson.build | ||
61 | @@ -XXX,XX +XXX,XX @@ | ||
62 | softmmu_ss.add(when: 'CONFIG_DS1338', if_true: files('ds1338.c')) | ||
63 | softmmu_ss.add(when: 'CONFIG_M41T80', if_true: files('m41t80.c')) | ||
64 | softmmu_ss.add(when: 'CONFIG_M48T59', if_true: files('m48t59.c')) | ||
65 | -softmmu_ss.add(when: 'CONFIG_PL031', if_true: files('pl031.c')) | ||
66 | +specific_ss.add(when: 'CONFIG_PL031', if_true: files('pl031.c')) | ||
67 | softmmu_ss.add(when: 'CONFIG_TWL92230', if_true: files('twl92230.c')) | ||
68 | softmmu_ss.add(when: ['CONFIG_ISA_BUS', 'CONFIG_M48T59'], if_true: files('m48t59-isa.c')) | ||
69 | softmmu_ss.add(when: 'CONFIG_XLNX_ZYNQMP', if_true: files('xlnx-zynqmp-rtc.c')) | ||
30 | -- | 70 | -- |
31 | 2.20.1 | 71 | 2.25.1 |
32 | 72 | ||
33 | 73 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Niek Linnenbank <nieklinnenbank@gmail.com> | ||
2 | 1 | ||
3 | The allwinner_h3_dramc_map_rows function simulates row addressing behavior | ||
4 | when bootloader software attempts to detect the amount of available SDRAM. | ||
5 | |||
6 | Currently the line that calculates the 64-bit address of the mirrored row | ||
7 | uses a signed 32-bit multiply operation that in theory could result in the | ||
8 | upper 32-bit be all 1s. This commit ensures that the row mirror address | ||
9 | is calculated using only 64-bit operations. | ||
10 | |||
11 | Reported-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | Signed-off-by: Niek Linnenbank <nieklinnenbank@gmail.com> | ||
13 | Message-id: 20200323192944.5967-1-nieklinnenbank@gmail.com | ||
14 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
16 | --- | ||
17 | hw/misc/allwinner-h3-dramc.c | 4 ++-- | ||
18 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
19 | |||
20 | diff --git a/hw/misc/allwinner-h3-dramc.c b/hw/misc/allwinner-h3-dramc.c | ||
21 | index XXXXXXX..XXXXXXX 100644 | ||
22 | --- a/hw/misc/allwinner-h3-dramc.c | ||
23 | +++ b/hw/misc/allwinner-h3-dramc.c | ||
24 | @@ -XXX,XX +XXX,XX @@ static void allwinner_h3_dramc_map_rows(AwH3DramCtlState *s, uint8_t row_bits, | ||
25 | |||
26 | } else if (row_bits_actual) { | ||
27 | /* Row bits not matching ram_size, install the rows mirror */ | ||
28 | - hwaddr row_mirror = s->ram_addr + ((1 << (row_bits_actual + | ||
29 | - bank_bits)) * page_size); | ||
30 | + hwaddr row_mirror = s->ram_addr + ((1ULL << (row_bits_actual + | ||
31 | + bank_bits)) * page_size); | ||
32 | |||
33 | memory_region_set_enabled(&s->row_mirror_alias, true); | ||
34 | memory_region_set_address(&s->row_mirror_alias, row_mirror); | ||
35 | -- | ||
36 | 2.20.1 | ||
37 | |||
38 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | In xlnx_zynqmp_realize() if the attempt to realize the SD | ||
2 | controller object fails then the error-return path will leak | ||
3 | the 'bus_name' string. Fix this by deferring the allocation | ||
4 | until after the realize has succeeded. | ||
5 | 1 | ||
6 | Fixes: Coverity CID 1421911 | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
9 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
10 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
11 | Message-id: 20200324134947.15384-2-peter.maydell@linaro.org | ||
12 | --- | ||
13 | hw/arm/xlnx-zynqmp.c | 3 ++- | ||
14 | 1 file changed, 2 insertions(+), 1 deletion(-) | ||
15 | |||
16 | diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/hw/arm/xlnx-zynqmp.c | ||
19 | +++ b/hw/arm/xlnx-zynqmp.c | ||
20 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) | ||
21 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->sata), 0, gic_spi[SATA_INTR]); | ||
22 | |||
23 | for (i = 0; i < XLNX_ZYNQMP_NUM_SDHCI; i++) { | ||
24 | - char *bus_name = g_strdup_printf("sd-bus%d", i); | ||
25 | + char *bus_name; | ||
26 | SysBusDevice *sbd = SYS_BUS_DEVICE(&s->sdhci[i]); | ||
27 | Object *sdhci = OBJECT(&s->sdhci[i]); | ||
28 | |||
29 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) | ||
30 | sysbus_connect_irq(sbd, 0, gic_spi[sdhci_intr[i]]); | ||
31 | |||
32 | /* Alias controller SD bus to the SoC itself */ | ||
33 | + bus_name = g_strdup_printf("sd-bus%d", i); | ||
34 | object_property_add_alias(OBJECT(s), bus_name, sdhci, "sd-bus", | ||
35 | &error_abort); | ||
36 | g_free(bus_name); | ||
37 | -- | ||
38 | 2.20.1 | ||
39 | |||
40 | diff view generated by jsdifflib |