1 | ARM bugfixes for rc1... | 1 | v2: dropped patches that add the microbit nRF51 non-volatile memories |
---|---|---|---|
2 | and the test case for them. | ||
3 | |||
4 | thanks | ||
5 | -- PMM | ||
2 | 6 | ||
3 | 7 | ||
4 | The following changes since commit f291910db61b5812e68f1e76afb3ade41d567bea: | 8 | The following changes since commit 3a183e330dbd7dbcac3841737ac874979552cca2: |
5 | 9 | ||
6 | Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2017-11-09' into staging (2017-11-13 13:13:12 +0000) | 10 | Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20190128' into staging (2019-01-28 16:26:47 +0000) |
7 | 11 | ||
8 | are available in the git repository at: | 12 | are available in the Git repository at: |
9 | 13 | ||
10 | git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20171113 | 14 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20190129 |
11 | 15 | ||
12 | for you to fetch changes up to d25f2a72272b9ffe0d06710d6217d1169bc2cc7d: | 16 | for you to fetch changes up to 46f5abc0a2566ac3dc954eeb62fd625f0eaca120: |
13 | 17 | ||
14 | accel/tcg/translate-all: expand cpu_restore_state addr check (2017-11-13 13:55:27 +0000) | 18 | gdbstub: Simplify gdb_get_cpu_pid() to use cpu->cluster_index (2019-01-29 11:46:06 +0000) |
15 | 19 | ||
16 | ---------------------------------------------------------------- | 20 | ---------------------------------------------------------------- |
17 | target-arm queue: | 21 | target-arm queue: |
18 | * translate-a64.c: silence gcc5 warning | 22 | * Fix validation of 32-bit address spaces for aa32 (fixes an assert introduced in ba97be9f4a4) |
19 | * highbank: validate register offset before access | 23 | * v8m: Ensure IDAU is respected if SAU is disabled |
20 | * MAINTAINERS: Add entries for Smartfusion2 | 24 | * gdbstub: fix gdb_get_cpu(s, pid, tid) when pid and/or tid are 0 |
21 | * accel/tcg/translate-all: expand cpu_restore_state addr check | 25 | * exec.c: Use correct attrs in cpu_memory_rw_debug() |
22 | (so usermode insn aborts don't crash with an assertion failure) | 26 | * accel/tcg/user-exec: Don't parse aarch64 insns to test for read vs write |
23 | * fix TCG initialization of some Arm boards by allowing them | 27 | * target/arm: Don't clear supported PMU events when initializing PMCEID1 |
24 | to specify min/default number of CPUs to create | 28 | * memory: add memory_region_flush_rom_device() |
29 | * microbit: Add stub NRF51 TWI magnetometer/accelerometer detection | ||
30 | * tests/microbit-test: extend testing of microbit devices | ||
31 | * checkpatch: Don't emit spurious warnings about block comments | ||
32 | * aspeed/smc: misc bug fixes | ||
33 | * xlnx-zynqmp: Don't create rpu-cluster if there are no RPUs | ||
34 | * xlnx-zynqmp: Realize cluster after putting RPUs in it | ||
35 | * accel/tcg: Add cluster number to TCG TB hash so differently configured | ||
36 | CPUs don't pick up cached TBs for the wrong kind of CPU | ||
25 | 37 | ||
26 | ---------------------------------------------------------------- | 38 | ---------------------------------------------------------------- |
27 | Alex Bennée (1): | 39 | Aaron Lindsay OS (1): |
28 | accel/tcg/translate-all: expand cpu_restore_state addr check | 40 | target/arm: Don't clear supported PMU events when initializing PMCEID1 |
29 | 41 | ||
30 | Alistair Francis (2): | 42 | Cédric Le Goater (4): |
31 | xlnx-zynqmp: Properly support the smp command line option | 43 | aspeed/smc: fix default read value |
32 | xlnx-zcu102: Add an info message deprecating the EP108 | 44 | aspeed/smc: define registers for all possible CS |
45 | aspeed/smc: Add dummy data register | ||
46 | aspeed/smc: snoop SPI transfers to fake dummy cycles | ||
33 | 47 | ||
34 | Emilio G. Cota (4): | 48 | Julia Suvorova (3): |
35 | arm/translate-a64: mark path as unreachable to eliminate warning | 49 | tests/libqtest: Introduce qtest_init_with_serial() |
36 | qom: move CPUClass.tcg_initialize to a global | 50 | tests/microbit-test: Make test independent of global_qtest |
37 | xlnx-zcu102: Specify the max number of CPUs for the EP108 | 51 | tests/microbit-test: Check nRF51 UART functionality |
38 | hw: add .min_cpus and .default_cpus fields to machine_class | ||
39 | 52 | ||
40 | Prasad J Pandit (1): | 53 | Luc Michel (1): |
41 | highbank: validate register offset before access | 54 | gdbstub: fix gdb_get_cpu(s, pid, tid) when pid and/or tid are 0 |
42 | 55 | ||
43 | Subbaraya Sundeep (1): | 56 | Peter Maydell (8): |
44 | MAINTAINERS: Add entries for Smartfusion2 | 57 | exec.c: Use correct attrs in cpu_memory_rw_debug() |
58 | accel/tcg/user-exec: Don't parse aarch64 insns to test for read vs write | ||
59 | checkpatch: Don't emit spurious warnings about block comments | ||
60 | xlnx-zynqmp: Don't create rpu-cluster if there are no RPUs | ||
61 | hw/arm/xlnx-zynqmp: Realize cluster after putting RPUs in it | ||
62 | qom/cpu: Add cluster_index to CPUState | ||
63 | accel/tcg: Add cluster number to TCG TB hash | ||
64 | gdbstub: Simplify gdb_get_cpu_pid() to use cpu->cluster_index | ||
45 | 65 | ||
46 | include/exec/exec-all.h | 11 ++++++++++ | 66 | Richard Henderson (1): |
47 | include/hw/boards.h | 5 +++++ | 67 | target/arm: Fix validation of 32-bit address spaces for aa32 |
48 | include/qom/cpu.h | 1 - | ||
49 | accel/tcg/translate-all.c | 52 ++++++++++++++++++++++++++-------------------- | ||
50 | exec.c | 5 +++-- | ||
51 | hw/arm/exynos4_boards.c | 12 ++++------- | ||
52 | hw/arm/highbank.c | 17 +++++++++++++-- | ||
53 | hw/arm/raspi.c | 2 ++ | ||
54 | hw/arm/xlnx-zcu102.c | 9 +++++++- | ||
55 | hw/arm/xlnx-zynqmp.c | 26 ++++++++++++++--------- | ||
56 | target/arm/translate-a64.c | 2 ++ | ||
57 | vl.c | 21 ++++++++++++++++--- | ||
58 | MAINTAINERS | 17 +++++++++++++++ | ||
59 | qemu-doc.texi | 7 +++++++ | ||
60 | 14 files changed, 137 insertions(+), 50 deletions(-) | ||
61 | 68 | ||
69 | Stefan Hajnoczi (3): | ||
70 | tests/microbit-test: add TWI stub device test | ||
71 | MAINTAINERS: update microbit ARM board files | ||
72 | memory: add memory_region_flush_rom_device() | ||
73 | |||
74 | Steffen Görtz (1): | ||
75 | arm: Stub out NRF51 TWI magnetometer/accelerometer detection | ||
76 | |||
77 | Thomas Roth (1): | ||
78 | target/arm: v8m: Ensure IDAU is respected if SAU is disabled | ||
79 | |||
80 | hw/i2c/Makefile.objs | 1 + | ||
81 | include/exec/exec-all.h | 4 +- | ||
82 | include/exec/memory.h | 18 +++ | ||
83 | include/hw/arm/nrf51.h | 2 + | ||
84 | include/hw/arm/nrf51_soc.h | 1 + | ||
85 | include/hw/cpu/cluster.h | 24 +++ | ||
86 | include/hw/i2c/microbit_i2c.h | 42 +++++ | ||
87 | include/hw/ssi/aspeed_smc.h | 3 + | ||
88 | include/qom/cpu.h | 7 + | ||
89 | target/arm/cpu.h | 11 +- | ||
90 | tests/libqtest.h | 11 ++ | ||
91 | accel/tcg/cpu-exec.c | 3 + | ||
92 | accel/tcg/translate-all.c | 3 + | ||
93 | accel/tcg/user-exec.c | 66 ++++++-- | ||
94 | exec.c | 19 ++- | ||
95 | gdbstub.c | 120 ++++++--------- | ||
96 | hw/arm/microbit.c | 16 ++ | ||
97 | hw/arm/xlnx-zynqmp.c | 9 +- | ||
98 | hw/cpu/cluster.c | 46 ++++++ | ||
99 | hw/i2c/microbit_i2c.c | 127 +++++++++++++++ | ||
100 | hw/ssi/aspeed_smc.c | 128 ++++++++++++++- | ||
101 | qom/cpu.c | 1 + | ||
102 | target/arm/cpu.c | 3 +- | ||
103 | target/arm/helper.c | 67 ++++---- | ||
104 | tests/libqtest.c | 25 +++ | ||
105 | tests/microbit-test.c | 350 +++++++++++++++++++++++++++++------------- | ||
106 | MAINTAINERS | 8 +- | ||
107 | scripts/checkpatch.pl | 2 +- | ||
108 | 28 files changed, 874 insertions(+), 243 deletions(-) | ||
109 | create mode 100644 include/hw/i2c/microbit_i2c.h | ||
110 | create mode 100644 hw/i2c/microbit_i2c.c | ||
111 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: "Emilio G. Cota" <cota@braap.org> | ||
2 | 1 | ||
3 | Fixes the following warning when compiling with gcc 5.4.0 with -O1 | ||
4 | optimizations and --enable-debug: | ||
5 | |||
6 | target/arm/translate-a64.c: In function ‘aarch64_tr_translate_insn’: | ||
7 | target/arm/translate-a64.c:2361:8: error: ‘post_index’ may be used uninitialized in this function [-Werror=maybe-uninitialized] | ||
8 | if (!post_index) { | ||
9 | ^ | ||
10 | target/arm/translate-a64.c:2307:10: note: ‘post_index’ was declared here | ||
11 | bool post_index; | ||
12 | ^ | ||
13 | target/arm/translate-a64.c:2386:8: error: ‘writeback’ may be used uninitialized in this function [-Werror=maybe-uninitialized] | ||
14 | if (writeback) { | ||
15 | ^ | ||
16 | target/arm/translate-a64.c:2308:10: note: ‘writeback’ was declared here | ||
17 | bool writeback; | ||
18 | ^ | ||
19 | |||
20 | Note that idx comes from selecting 2 bits, and therefore its value | ||
21 | can be at most 3. | ||
22 | |||
23 | Signed-off-by: Emilio G. Cota <cota@braap.org> | ||
24 | Acked-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
25 | Message-id: 1510087611-1851-1-git-send-email-cota@braap.org | ||
26 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
27 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
28 | --- | ||
29 | target/arm/translate-a64.c | 2 ++ | ||
30 | 1 file changed, 2 insertions(+) | ||
31 | |||
32 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
33 | index XXXXXXX..XXXXXXX 100644 | ||
34 | --- a/target/arm/translate-a64.c | ||
35 | +++ b/target/arm/translate-a64.c | ||
36 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_reg_imm9(DisasContext *s, uint32_t insn, | ||
37 | post_index = false; | ||
38 | writeback = true; | ||
39 | break; | ||
40 | + default: | ||
41 | + g_assert_not_reached(); | ||
42 | } | ||
43 | |||
44 | if (rn == 31) { | ||
45 | -- | ||
46 | 2.7.4 | ||
47 | |||
48 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Prasad J Pandit <pjp@fedoraproject.org> | ||
2 | 1 | ||
3 | An 'offset' parameter sent to highbank register r/w functions | ||
4 | could be greater than number(NUM_REGS=0x200) of hb registers, | ||
5 | leading to an OOB access issue. Add check to avoid it. | ||
6 | |||
7 | Reported-by: Moguofang (Dennis mo) <moguofang@huawei.com> | ||
8 | Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org> | ||
9 | Message-id: 20171113062658.9697-1-ppandit@redhat.com | ||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | --- | ||
13 | hw/arm/highbank.c | 17 +++++++++++++++-- | ||
14 | 1 file changed, 15 insertions(+), 2 deletions(-) | ||
15 | |||
16 | diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/hw/arm/highbank.c | ||
19 | +++ b/hw/arm/highbank.c | ||
20 | @@ -XXX,XX +XXX,XX @@ | ||
21 | #include "hw/ide/ahci.h" | ||
22 | #include "hw/cpu/a9mpcore.h" | ||
23 | #include "hw/cpu/a15mpcore.h" | ||
24 | +#include "qemu/log.h" | ||
25 | |||
26 | #define SMP_BOOT_ADDR 0x100 | ||
27 | #define SMP_BOOT_REG 0x40 | ||
28 | @@ -XXX,XX +XXX,XX @@ static void hb_regs_write(void *opaque, hwaddr offset, | ||
29 | } | ||
30 | } | ||
31 | |||
32 | - regs[offset/4] = value; | ||
33 | + if (offset / 4 >= NUM_REGS) { | ||
34 | + qemu_log_mask(LOG_GUEST_ERROR, | ||
35 | + "highbank: bad write offset 0x%" HWADDR_PRIx "\n", offset); | ||
36 | + return; | ||
37 | + } | ||
38 | + regs[offset / 4] = value; | ||
39 | } | ||
40 | |||
41 | static uint64_t hb_regs_read(void *opaque, hwaddr offset, | ||
42 | unsigned size) | ||
43 | { | ||
44 | + uint32_t value; | ||
45 | uint32_t *regs = opaque; | ||
46 | - uint32_t value = regs[offset/4]; | ||
47 | + | ||
48 | + if (offset / 4 >= NUM_REGS) { | ||
49 | + qemu_log_mask(LOG_GUEST_ERROR, | ||
50 | + "highbank: bad read offset 0x%" HWADDR_PRIx "\n", offset); | ||
51 | + return 0; | ||
52 | + } | ||
53 | + value = regs[offset / 4]; | ||
54 | |||
55 | if ((offset == 0x100) || (offset == 0x108) || (offset == 0x10C)) { | ||
56 | value |= 0x30000000; | ||
57 | -- | ||
58 | 2.7.4 | ||
59 | |||
60 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Subbaraya Sundeep <sundeep.lkml@gmail.com> | ||
2 | 1 | ||
3 | Voluntarily add myself as maintainer for Smartfusion2 | ||
4 | |||
5 | Signed-off-by: Subbaraya Sundeep <sundeep.lkml@gmail.com> | ||
6 | Reviewed-by: Alistair Francis <alistair.francis@xilinx.com> | ||
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Message-id: 1510552520-3566-1-git-send-email-sundeep.lkml@gmail.com | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | MAINTAINERS | 17 +++++++++++++++++ | ||
12 | 1 file changed, 17 insertions(+) | ||
13 | |||
14 | diff --git a/MAINTAINERS b/MAINTAINERS | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/MAINTAINERS | ||
17 | +++ b/MAINTAINERS | ||
18 | @@ -XXX,XX +XXX,XX @@ M: Alistair Francis <alistair@alistair23.me> | ||
19 | S: Maintained | ||
20 | F: hw/arm/netduino2.c | ||
21 | |||
22 | +SmartFusion2 | ||
23 | +M: Subbaraya Sundeep <sundeep.lkml@gmail.com> | ||
24 | +S: Maintained | ||
25 | +F: hw/arm/msf2-soc.c | ||
26 | +F: hw/misc/msf2-sysreg.c | ||
27 | +F: hw/timer/mss-timer.c | ||
28 | +F: hw/ssi/mss-spi.c | ||
29 | +F: include/hw/arm/msf2-soc.h | ||
30 | +F: include/hw/misc/msf2-sysreg.h | ||
31 | +F: include/hw/timer/mss-timer.h | ||
32 | +F: include/hw/ssi/mss-spi.h | ||
33 | + | ||
34 | +Emcraft M2S-FG484 | ||
35 | +M: Subbaraya Sundeep <sundeep.lkml@gmail.com> | ||
36 | +S: Maintained | ||
37 | +F: hw/arm/msf2-som.c | ||
38 | + | ||
39 | CRIS Machines | ||
40 | ------------- | ||
41 | Axis Dev88 | ||
42 | -- | ||
43 | 2.7.4 | ||
44 | |||
45 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: "Emilio G. Cota" <cota@braap.org> | ||
2 | 1 | ||
3 | 55c3cee ("qom: Introduce CPUClass.tcg_initialize", 2017-10-24) | ||
4 | introduces a per-CPUClass bool that we check so that the target CPU | ||
5 | is initialized for TCG only once. This works well except when | ||
6 | we end up creating more than one CPUClass, in which case we end | ||
7 | up incorrectly initializing TCG more than once, i.e. once for | ||
8 | each CPUClass. | ||
9 | |||
10 | This can be replicated with: | ||
11 | $ aarch64-softmmu/qemu-system-aarch64 -machine xlnx-zcu102 -smp 6 \ | ||
12 | -global driver=xlnx,,zynqmp,property=has_rpu,value=on | ||
13 | In this case the class name of the "RPUs" is prefixed by "cortex-r5-", | ||
14 | whereas the "regular" CPUs are prefixed by "cortex-a53-". This | ||
15 | results in two CPUClass instances being created. | ||
16 | |||
17 | Fix it by introducing a static variable, so that only the first | ||
18 | target CPU being initialized will initialize the target-dependent | ||
19 | part of TCG, regardless of CPUClass instances. | ||
20 | |||
21 | Fixes: 55c3ceef61fcf06fc98ddc752b7cce788ce7680b | ||
22 | Signed-off-by: Emilio G. Cota <cota@braap.org> | ||
23 | Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> | ||
24 | Reviewed-by: Alistair Francis <alistair.francis@xilinx.com> | ||
25 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
26 | Tested-by: Alistair Francis <alistair.francis@xilinx.com> | ||
27 | Message-id: 1510343626-25861-2-git-send-email-cota@braap.org | ||
28 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
29 | --- | ||
30 | include/qom/cpu.h | 1 - | ||
31 | exec.c | 5 +++-- | ||
32 | 2 files changed, 3 insertions(+), 3 deletions(-) | ||
33 | |||
34 | diff --git a/include/qom/cpu.h b/include/qom/cpu.h | ||
35 | index XXXXXXX..XXXXXXX 100644 | ||
36 | --- a/include/qom/cpu.h | ||
37 | +++ b/include/qom/cpu.h | ||
38 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUClass { | ||
39 | /* Keep non-pointer data at the end to minimize holes. */ | ||
40 | int gdb_num_core_regs; | ||
41 | bool gdb_stop_before_watchpoint; | ||
42 | - bool tcg_initialized; | ||
43 | } CPUClass; | ||
44 | |||
45 | #ifdef HOST_WORDS_BIGENDIAN | ||
46 | diff --git a/exec.c b/exec.c | ||
47 | index XXXXXXX..XXXXXXX 100644 | ||
48 | --- a/exec.c | ||
49 | +++ b/exec.c | ||
50 | @@ -XXX,XX +XXX,XX @@ void cpu_exec_initfn(CPUState *cpu) | ||
51 | void cpu_exec_realizefn(CPUState *cpu, Error **errp) | ||
52 | { | ||
53 | CPUClass *cc = CPU_GET_CLASS(cpu); | ||
54 | + static bool tcg_target_initialized; | ||
55 | |||
56 | cpu_list_add(cpu); | ||
57 | |||
58 | - if (tcg_enabled() && !cc->tcg_initialized) { | ||
59 | - cc->tcg_initialized = true; | ||
60 | + if (tcg_enabled() && !tcg_target_initialized) { | ||
61 | + tcg_target_initialized = true; | ||
62 | cc->tcg_initialize(); | ||
63 | } | ||
64 | |||
65 | -- | ||
66 | 2.7.4 | ||
67 | |||
68 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Alistair Francis <alistair.francis@xilinx.com> | ||
2 | 1 | ||
3 | Allow the -smp command line option to control the number of CPUs we | ||
4 | create. | ||
5 | |||
6 | Signed-off-by: Alistair Francis <alistair.francis@xilinx.com> | ||
7 | Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> | ||
8 | Reviewed-by: Emilio G. Cota <cota@braap.org> | ||
9 | Tested-by: Emilio G. Cota <cota@braap.org> | ||
10 | Message-id: 1510343626-25861-3-git-send-email-cota@braap.org | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | --- | ||
13 | hw/arm/xlnx-zcu102.c | 3 ++- | ||
14 | hw/arm/xlnx-zynqmp.c | 26 ++++++++++++++++---------- | ||
15 | 2 files changed, 18 insertions(+), 11 deletions(-) | ||
16 | |||
17 | diff --git a/hw/arm/xlnx-zcu102.c b/hw/arm/xlnx-zcu102.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/hw/arm/xlnx-zcu102.c | ||
20 | +++ b/hw/arm/xlnx-zcu102.c | ||
21 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zcu102_machine_class_init(ObjectClass *oc, void *data) | ||
22 | { | ||
23 | MachineClass *mc = MACHINE_CLASS(oc); | ||
24 | |||
25 | - mc->desc = "Xilinx ZynqMP ZCU102 board"; | ||
26 | + mc->desc = "Xilinx ZynqMP ZCU102 board with 4xA53s and 2xR5s based on " \ | ||
27 | + "the value of smp"; | ||
28 | mc->init = xlnx_zcu102_init; | ||
29 | mc->block_default_type = IF_IDE; | ||
30 | mc->units_per_default_bus = 1; | ||
31 | diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c | ||
32 | index XXXXXXX..XXXXXXX 100644 | ||
33 | --- a/hw/arm/xlnx-zynqmp.c | ||
34 | +++ b/hw/arm/xlnx-zynqmp.c | ||
35 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_create_rpu(XlnxZynqMPState *s, const char *boot_cpu, | ||
36 | { | ||
37 | Error *err = NULL; | ||
38 | int i; | ||
39 | + int num_rpus = MIN(smp_cpus - XLNX_ZYNQMP_NUM_APU_CPUS, XLNX_ZYNQMP_NUM_RPU_CPUS); | ||
40 | |||
41 | - for (i = 0; i < XLNX_ZYNQMP_NUM_RPU_CPUS; i++) { | ||
42 | + for (i = 0; i < num_rpus; i++) { | ||
43 | char *name; | ||
44 | |||
45 | object_initialize(&s->rpu_cpu[i], sizeof(s->rpu_cpu[i]), | ||
46 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_init(Object *obj) | ||
47 | { | ||
48 | XlnxZynqMPState *s = XLNX_ZYNQMP(obj); | ||
49 | int i; | ||
50 | + int num_apus = MIN(smp_cpus, XLNX_ZYNQMP_NUM_APU_CPUS); | ||
51 | |||
52 | - for (i = 0; i < XLNX_ZYNQMP_NUM_APU_CPUS; i++) { | ||
53 | + for (i = 0; i < num_apus; i++) { | ||
54 | object_initialize(&s->apu_cpu[i], sizeof(s->apu_cpu[i]), | ||
55 | "cortex-a53-" TYPE_ARM_CPU); | ||
56 | object_property_add_child(obj, "apu-cpu[*]", OBJECT(&s->apu_cpu[i]), | ||
57 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) | ||
58 | MemoryRegion *system_memory = get_system_memory(); | ||
59 | uint8_t i; | ||
60 | uint64_t ram_size; | ||
61 | + int num_apus = MIN(smp_cpus, XLNX_ZYNQMP_NUM_APU_CPUS); | ||
62 | const char *boot_cpu = s->boot_cpu ? s->boot_cpu : "apu-cpu[0]"; | ||
63 | ram_addr_t ddr_low_size, ddr_high_size; | ||
64 | qemu_irq gic_spi[GIC_NUM_SPI_INTR]; | ||
65 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) | ||
66 | |||
67 | qdev_prop_set_uint32(DEVICE(&s->gic), "num-irq", GIC_NUM_SPI_INTR + 32); | ||
68 | qdev_prop_set_uint32(DEVICE(&s->gic), "revision", 2); | ||
69 | - qdev_prop_set_uint32(DEVICE(&s->gic), "num-cpu", XLNX_ZYNQMP_NUM_APU_CPUS); | ||
70 | + qdev_prop_set_uint32(DEVICE(&s->gic), "num-cpu", num_apus); | ||
71 | |||
72 | /* Realize APUs before realizing the GIC. KVM requires this. */ | ||
73 | - for (i = 0; i < XLNX_ZYNQMP_NUM_APU_CPUS; i++) { | ||
74 | + for (i = 0; i < num_apus; i++) { | ||
75 | char *name; | ||
76 | |||
77 | object_property_set_int(OBJECT(&s->apu_cpu[i]), QEMU_PSCI_CONDUIT_SMC, | ||
78 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) | ||
79 | } | ||
80 | } | ||
81 | |||
82 | - for (i = 0; i < XLNX_ZYNQMP_NUM_APU_CPUS; i++) { | ||
83 | + for (i = 0; i < num_apus; i++) { | ||
84 | qemu_irq irq; | ||
85 | |||
86 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->gic), i, | ||
87 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) | ||
88 | } | ||
89 | |||
90 | if (s->has_rpu) { | ||
91 | - xlnx_zynqmp_create_rpu(s, boot_cpu, &err); | ||
92 | - if (err) { | ||
93 | - error_propagate(errp, err); | ||
94 | - return; | ||
95 | - } | ||
96 | + info_report("The 'has_rpu' property is no longer required, to use the " | ||
97 | + "RPUs just use -smp 6."); | ||
98 | + } | ||
99 | + | ||
100 | + xlnx_zynqmp_create_rpu(s, boot_cpu, &err); | ||
101 | + if (err) { | ||
102 | + error_propagate(errp, err); | ||
103 | + return; | ||
104 | } | ||
105 | |||
106 | if (!s->boot_cpu_ptr) { | ||
107 | -- | ||
108 | 2.7.4 | ||
109 | |||
110 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Alistair Francis <alistair.francis@xilinx.com> | ||
2 | 1 | ||
3 | The EP108 was an early access development board that is no longer used. | ||
4 | Add an info message to convert any users to the ZCU102 instead. On QEMU | ||
5 | they are both identical. | ||
6 | |||
7 | This patch also updated the qemu-doc.texi file to indicate that the | ||
8 | EP108 has been deprecated. | ||
9 | |||
10 | Signed-off-by: Alistair Francis <alistair.francis@xilinx.com> | ||
11 | Reviewed-by: Emilio G. Cota <cota@braap.org> | ||
12 | Message-id: 1510343626-25861-4-git-send-email-cota@braap.org | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | --- | ||
15 | hw/arm/xlnx-zcu102.c | 3 +++ | ||
16 | qemu-doc.texi | 7 +++++++ | ||
17 | 2 files changed, 10 insertions(+) | ||
18 | |||
19 | diff --git a/hw/arm/xlnx-zcu102.c b/hw/arm/xlnx-zcu102.c | ||
20 | index XXXXXXX..XXXXXXX 100644 | ||
21 | --- a/hw/arm/xlnx-zcu102.c | ||
22 | +++ b/hw/arm/xlnx-zcu102.c | ||
23 | @@ -XXX,XX +XXX,XX @@ static void xlnx_ep108_init(MachineState *machine) | ||
24 | { | ||
25 | XlnxZCU102 *s = EP108_MACHINE(machine); | ||
26 | |||
27 | + info_report("The Xilinx EP108 machine is deprecated, please use the " | ||
28 | + "ZCU102 machine instead. It has the same features supported."); | ||
29 | + | ||
30 | xlnx_zynqmp_init(s, machine); | ||
31 | } | ||
32 | |||
33 | diff --git a/qemu-doc.texi b/qemu-doc.texi | ||
34 | index XXXXXXX..XXXXXXX 100644 | ||
35 | --- a/qemu-doc.texi | ||
36 | +++ b/qemu-doc.texi | ||
37 | @@ -XXX,XX +XXX,XX @@ or ``ivshmem-doorbell`` device types. | ||
38 | The ``spapr-pci-vfio-host-bridge'' device type is replaced by | ||
39 | the ``spapr-pci-host-bridge'' device type. | ||
40 | |||
41 | +@section System emulator machines | ||
42 | + | ||
43 | +@subsection Xilinx EP108 (since 2.11.0) | ||
44 | + | ||
45 | +The ``xlnx-ep108'' machine has been replaced by the ``xlnx-zcu102'' machine. | ||
46 | +The ``xlnx-zcu102'' machine has the same features and capabilites in QEMU. | ||
47 | + | ||
48 | @node License | ||
49 | @appendix License | ||
50 | |||
51 | -- | ||
52 | 2.7.4 | ||
53 | |||
54 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: "Emilio G. Cota" <cota@braap.org> | ||
2 | 1 | ||
3 | Just like the zcu102, the ep108 can instantiate several CPUs. | ||
4 | |||
5 | Signed-off-by: Emilio G. Cota <cota@braap.org> | ||
6 | Reviewed-by: Alistair Francis <alistair.francis@xilinx.com> | ||
7 | Message-id: 1510343626-25861-5-git-send-email-cota@braap.org | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | hw/arm/xlnx-zcu102.c | 1 + | ||
11 | 1 file changed, 1 insertion(+) | ||
12 | |||
13 | diff --git a/hw/arm/xlnx-zcu102.c b/hw/arm/xlnx-zcu102.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/hw/arm/xlnx-zcu102.c | ||
16 | +++ b/hw/arm/xlnx-zcu102.c | ||
17 | @@ -XXX,XX +XXX,XX @@ static void xlnx_ep108_machine_class_init(ObjectClass *oc, void *data) | ||
18 | mc->block_default_type = IF_IDE; | ||
19 | mc->units_per_default_bus = 1; | ||
20 | mc->ignore_memory_transaction_failures = true; | ||
21 | + mc->max_cpus = XLNX_ZYNQMP_NUM_APU_CPUS + XLNX_ZYNQMP_NUM_RPU_CPUS; | ||
22 | } | ||
23 | |||
24 | static const TypeInfo xlnx_ep108_machine_init_typeinfo = { | ||
25 | -- | ||
26 | 2.7.4 | ||
27 | |||
28 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: "Emilio G. Cota" <cota@braap.org> | ||
2 | 1 | ||
3 | max_cpus needs to be an upper bound on the number of vCPUs | ||
4 | initialized; otherwise TCG region initialization breaks. | ||
5 | |||
6 | Some boards initialize a hard-coded number of vCPUs, which is not | ||
7 | captured by the global max_cpus and therefore breaks TCG initialization. | ||
8 | Fix it by adding the .min_cpus field to machine_class. | ||
9 | |||
10 | This commit also changes some user-facing behaviour: we now die if | ||
11 | -smp is below this hard-coded vCPU minimum instead of silently | ||
12 | ignoring the passed -smp value (sometimes announcing this by printing | ||
13 | a warning). However, the introduction of .default_cpus lessens the | ||
14 | likelihood that users will notice this: if -smp isn't set, we now | ||
15 | assign the value in .default_cpus to both smp_cpus and max_cpus. IOW, | ||
16 | if a user does not set -smp, they always get a correct number of vCPUs. | ||
17 | |||
18 | This change fixes 3468b59 ("tcg: enable multiple TCG contexts in | ||
19 | softmmu", 2017-10-24), which broke TCG initialization for some | ||
20 | ARM boards. | ||
21 | |||
22 | Fixes: 3468b59e18b179bc63c7ce934de912dfa9596122 | ||
23 | Reported-by: Thomas Huth <thuth@redhat.com> | ||
24 | Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> | ||
25 | Reviewed-by: Alistair Francis <alistair.francis@xilinx.com> | ||
26 | Signed-off-by: Emilio G. Cota <cota@braap.org> | ||
27 | Message-id: 1510343626-25861-6-git-send-email-cota@braap.org | ||
28 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> | ||
29 | Signed-off-by: Emilio G. Cota <cota@braap.org> | ||
30 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
31 | --- | ||
32 | include/hw/boards.h | 5 +++++ | ||
33 | hw/arm/exynos4_boards.c | 12 ++++-------- | ||
34 | hw/arm/raspi.c | 2 ++ | ||
35 | hw/arm/xlnx-zcu102.c | 2 ++ | ||
36 | vl.c | 21 ++++++++++++++++++--- | ||
37 | 5 files changed, 31 insertions(+), 11 deletions(-) | ||
38 | |||
39 | diff --git a/include/hw/boards.h b/include/hw/boards.h | ||
40 | index XXXXXXX..XXXXXXX 100644 | ||
41 | --- a/include/hw/boards.h | ||
42 | +++ b/include/hw/boards.h | ||
43 | @@ -XXX,XX +XXX,XX @@ typedef struct { | ||
44 | |||
45 | /** | ||
46 | * MachineClass: | ||
47 | + * @max_cpus: maximum number of CPUs supported. Default: 1 | ||
48 | + * @min_cpus: minimum number of CPUs supported. Default: 1 | ||
49 | + * @default_cpus: number of CPUs instantiated if none are specified. Default: 1 | ||
50 | * @get_hotplug_handler: this function is called during bus-less | ||
51 | * device hotplug. If defined it returns pointer to an instance | ||
52 | * of HotplugHandler object, which handles hotplug operation | ||
53 | @@ -XXX,XX +XXX,XX @@ struct MachineClass { | ||
54 | BlockInterfaceType block_default_type; | ||
55 | int units_per_default_bus; | ||
56 | int max_cpus; | ||
57 | + int min_cpus; | ||
58 | + int default_cpus; | ||
59 | unsigned int no_serial:1, | ||
60 | no_parallel:1, | ||
61 | use_virtcon:1, | ||
62 | diff --git a/hw/arm/exynos4_boards.c b/hw/arm/exynos4_boards.c | ||
63 | index XXXXXXX..XXXXXXX 100644 | ||
64 | --- a/hw/arm/exynos4_boards.c | ||
65 | +++ b/hw/arm/exynos4_boards.c | ||
66 | @@ -XXX,XX +XXX,XX @@ | ||
67 | #include "qemu-common.h" | ||
68 | #include "cpu.h" | ||
69 | #include "sysemu/sysemu.h" | ||
70 | -#include "sysemu/qtest.h" | ||
71 | #include "hw/sysbus.h" | ||
72 | #include "net/net.h" | ||
73 | #include "hw/arm/arm.h" | ||
74 | @@ -XXX,XX +XXX,XX @@ exynos4_boards_init_common(MachineState *machine, | ||
75 | Exynos4BoardType board_type) | ||
76 | { | ||
77 | Exynos4BoardState *s = g_new(Exynos4BoardState, 1); | ||
78 | - MachineClass *mc = MACHINE_GET_CLASS(machine); | ||
79 | - | ||
80 | - if (smp_cpus != EXYNOS4210_NCPUS && !qtest_enabled()) { | ||
81 | - error_report("%s board supports only %d CPU cores, ignoring smp_cpus" | ||
82 | - " value", | ||
83 | - mc->name, EXYNOS4210_NCPUS); | ||
84 | - } | ||
85 | |||
86 | exynos4_board_binfo.ram_size = exynos4_board_ram_size[board_type]; | ||
87 | exynos4_board_binfo.board_id = exynos4_board_id[board_type]; | ||
88 | @@ -XXX,XX +XXX,XX @@ static void nuri_class_init(ObjectClass *oc, void *data) | ||
89 | mc->desc = "Samsung NURI board (Exynos4210)"; | ||
90 | mc->init = nuri_init; | ||
91 | mc->max_cpus = EXYNOS4210_NCPUS; | ||
92 | + mc->min_cpus = EXYNOS4210_NCPUS; | ||
93 | + mc->default_cpus = EXYNOS4210_NCPUS; | ||
94 | mc->ignore_memory_transaction_failures = true; | ||
95 | } | ||
96 | |||
97 | @@ -XXX,XX +XXX,XX @@ static void smdkc210_class_init(ObjectClass *oc, void *data) | ||
98 | mc->desc = "Samsung SMDKC210 board (Exynos4210)"; | ||
99 | mc->init = smdkc210_init; | ||
100 | mc->max_cpus = EXYNOS4210_NCPUS; | ||
101 | + mc->min_cpus = EXYNOS4210_NCPUS; | ||
102 | + mc->default_cpus = EXYNOS4210_NCPUS; | ||
103 | mc->ignore_memory_transaction_failures = true; | ||
104 | } | ||
105 | |||
106 | diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c | ||
107 | index XXXXXXX..XXXXXXX 100644 | ||
108 | --- a/hw/arm/raspi.c | ||
109 | +++ b/hw/arm/raspi.c | ||
110 | @@ -XXX,XX +XXX,XX @@ static void raspi2_machine_init(MachineClass *mc) | ||
111 | mc->no_floppy = 1; | ||
112 | mc->no_cdrom = 1; | ||
113 | mc->max_cpus = BCM2836_NCPUS; | ||
114 | + mc->min_cpus = BCM2836_NCPUS; | ||
115 | + mc->default_cpus = BCM2836_NCPUS; | ||
116 | mc->default_ram_size = 1024 * 1024 * 1024; | ||
117 | mc->ignore_memory_transaction_failures = true; | ||
118 | }; | ||
119 | diff --git a/hw/arm/xlnx-zcu102.c b/hw/arm/xlnx-zcu102.c | ||
120 | index XXXXXXX..XXXXXXX 100644 | ||
121 | --- a/hw/arm/xlnx-zcu102.c | ||
122 | +++ b/hw/arm/xlnx-zcu102.c | ||
123 | @@ -XXX,XX +XXX,XX @@ static void xlnx_ep108_machine_class_init(ObjectClass *oc, void *data) | ||
124 | mc->units_per_default_bus = 1; | ||
125 | mc->ignore_memory_transaction_failures = true; | ||
126 | mc->max_cpus = XLNX_ZYNQMP_NUM_APU_CPUS + XLNX_ZYNQMP_NUM_RPU_CPUS; | ||
127 | + mc->default_cpus = XLNX_ZYNQMP_NUM_APU_CPUS; | ||
128 | } | ||
129 | |||
130 | static const TypeInfo xlnx_ep108_machine_init_typeinfo = { | ||
131 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zcu102_machine_class_init(ObjectClass *oc, void *data) | ||
132 | mc->units_per_default_bus = 1; | ||
133 | mc->ignore_memory_transaction_failures = true; | ||
134 | mc->max_cpus = XLNX_ZYNQMP_NUM_APU_CPUS + XLNX_ZYNQMP_NUM_RPU_CPUS; | ||
135 | + mc->default_cpus = XLNX_ZYNQMP_NUM_APU_CPUS; | ||
136 | } | ||
137 | |||
138 | static const TypeInfo xlnx_zcu102_machine_init_typeinfo = { | ||
139 | diff --git a/vl.c b/vl.c | ||
140 | index XXXXXXX..XXXXXXX 100644 | ||
141 | --- a/vl.c | ||
142 | +++ b/vl.c | ||
143 | @@ -XXX,XX +XXX,XX @@ Chardev *virtcon_hds[MAX_VIRTIO_CONSOLES]; | ||
144 | Chardev *sclp_hds[MAX_SCLP_CONSOLES]; | ||
145 | int win2k_install_hack = 0; | ||
146 | int singlestep = 0; | ||
147 | -int smp_cpus = 1; | ||
148 | -unsigned int max_cpus = 1; | ||
149 | +int smp_cpus; | ||
150 | +unsigned int max_cpus; | ||
151 | int smp_cores = 1; | ||
152 | int smp_threads = 1; | ||
153 | int acpi_enabled = 1; | ||
154 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv, char **envp) | ||
155 | exit(0); | ||
156 | } | ||
157 | |||
158 | + /* machine_class: default to UP */ | ||
159 | + machine_class->max_cpus = machine_class->max_cpus ?: 1; | ||
160 | + machine_class->min_cpus = machine_class->min_cpus ?: 1; | ||
161 | + machine_class->default_cpus = machine_class->default_cpus ?: 1; | ||
162 | + | ||
163 | + /* default to machine_class->default_cpus */ | ||
164 | + smp_cpus = machine_class->default_cpus; | ||
165 | + max_cpus = machine_class->default_cpus; | ||
166 | + | ||
167 | smp_parse(qemu_opts_find(qemu_find_opts("smp-opts"), NULL)); | ||
168 | |||
169 | - machine_class->max_cpus = machine_class->max_cpus ?: 1; /* Default to UP */ | ||
170 | + /* sanity-check smp_cpus and max_cpus against machine_class */ | ||
171 | + if (smp_cpus < machine_class->min_cpus) { | ||
172 | + error_report("Invalid SMP CPUs %d. The min CPUs " | ||
173 | + "supported by machine '%s' is %d", smp_cpus, | ||
174 | + machine_class->name, machine_class->min_cpus); | ||
175 | + exit(1); | ||
176 | + } | ||
177 | if (max_cpus > machine_class->max_cpus) { | ||
178 | error_report("Invalid SMP CPUs %d. The max CPUs " | ||
179 | "supported by machine '%s' is %d", max_cpus, | ||
180 | -- | ||
181 | 2.7.4 | ||
182 | |||
183 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Alex Bennée <alex.bennee@linaro.org> | ||
2 | 1 | ||
3 | We are still seeing signals during translation time when we walk over | ||
4 | a page protection boundary. This expands the check to ensure the host | ||
5 | PC is inside the code generation buffer. The original suggestion was | ||
6 | to check versus tcg_ctx.code_gen_ptr but as we now segment the | ||
7 | translation buffer we have to settle for just a general check for | ||
8 | being inside. | ||
9 | |||
10 | I've also fixed up the declaration to make it clear it can deal with | ||
11 | invalid addresses. A later patch will fix up the call sites. | ||
12 | |||
13 | Signed-off-by: Alex Bennée <alex.bennee@linaro.org> | ||
14 | Reported-by: Peter Maydell <peter.maydell@linaro.org> | ||
15 | Reviewed-by: Laurent Vivier <laurent@vivier.eu> | ||
16 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
17 | Message-id: 20171108153245.20740-2-alex.bennee@linaro.org | ||
18 | Suggested-by: Paolo Bonzini <pbonzini@redhat.com> | ||
19 | Cc: Richard Henderson <rth@twiddle.net> | ||
20 | Tested-by: Peter Maydell <peter.maydell@linaro.org> | ||
21 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
22 | --- | ||
23 | include/exec/exec-all.h | 11 ++++++++++ | ||
24 | accel/tcg/translate-all.c | 52 ++++++++++++++++++++++++++--------------------- | ||
25 | 2 files changed, 40 insertions(+), 23 deletions(-) | ||
26 | |||
27 | diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h | ||
28 | index XXXXXXX..XXXXXXX 100644 | ||
29 | --- a/include/exec/exec-all.h | ||
30 | +++ b/include/exec/exec-all.h | ||
31 | @@ -XXX,XX +XXX,XX @@ void restore_state_to_opc(CPUArchState *env, struct TranslationBlock *tb, | ||
32 | target_ulong *data); | ||
33 | |||
34 | void cpu_gen_init(void); | ||
35 | + | ||
36 | +/** | ||
37 | + * cpu_restore_state: | ||
38 | + * @cpu: the vCPU state is to be restore to | ||
39 | + * @searched_pc: the host PC the fault occurred at | ||
40 | + * @return: true if state was restored, false otherwise | ||
41 | + * | ||
42 | + * Attempt to restore the state for a fault occurring in translated | ||
43 | + * code. If the searched_pc is not in translated code no state is | ||
44 | + * restored and the function returns false. | ||
45 | + */ | ||
46 | bool cpu_restore_state(CPUState *cpu, uintptr_t searched_pc); | ||
47 | |||
48 | void QEMU_NORETURN cpu_loop_exit_noexc(CPUState *cpu); | ||
49 | diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c | ||
50 | index XXXXXXX..XXXXXXX 100644 | ||
51 | --- a/accel/tcg/translate-all.c | ||
52 | +++ b/accel/tcg/translate-all.c | ||
53 | @@ -XXX,XX +XXX,XX @@ static int cpu_restore_state_from_tb(CPUState *cpu, TranslationBlock *tb, | ||
54 | return 0; | ||
55 | } | ||
56 | |||
57 | -bool cpu_restore_state(CPUState *cpu, uintptr_t retaddr) | ||
58 | +bool cpu_restore_state(CPUState *cpu, uintptr_t host_pc) | ||
59 | { | ||
60 | TranslationBlock *tb; | ||
61 | bool r = false; | ||
62 | + uintptr_t check_offset; | ||
63 | |||
64 | - /* A retaddr of zero is invalid so we really shouldn't have ended | ||
65 | - * up here. The target code has likely forgotten to check retaddr | ||
66 | - * != 0 before attempting to restore state. We return early to | ||
67 | - * avoid blowing up on a recursive tb_lock(). The target must have | ||
68 | - * previously survived a failed cpu_restore_state because | ||
69 | - * tb_find_pc(0) would have failed anyway. It still should be | ||
70 | - * fixed though. | ||
71 | + /* The host_pc has to be in the region of current code buffer. If | ||
72 | + * it is not we will not be able to resolve it here. The two cases | ||
73 | + * where host_pc will not be correct are: | ||
74 | + * | ||
75 | + * - fault during translation (instruction fetch) | ||
76 | + * - fault from helper (not using GETPC() macro) | ||
77 | + * | ||
78 | + * Either way we need return early to avoid blowing up on a | ||
79 | + * recursive tb_lock() as we can't resolve it here. | ||
80 | + * | ||
81 | + * We are using unsigned arithmetic so if host_pc < | ||
82 | + * tcg_init_ctx.code_gen_buffer check_offset will wrap to way | ||
83 | + * above the code_gen_buffer_size | ||
84 | */ | ||
85 | - | ||
86 | - if (!retaddr) { | ||
87 | - return r; | ||
88 | - } | ||
89 | - | ||
90 | - tb_lock(); | ||
91 | - tb = tb_find_pc(retaddr); | ||
92 | - if (tb) { | ||
93 | - cpu_restore_state_from_tb(cpu, tb, retaddr); | ||
94 | - if (tb->cflags & CF_NOCACHE) { | ||
95 | - /* one-shot translation, invalidate it immediately */ | ||
96 | - tb_phys_invalidate(tb, -1); | ||
97 | - tb_remove(tb); | ||
98 | + check_offset = host_pc - (uintptr_t) tcg_init_ctx.code_gen_buffer; | ||
99 | + | ||
100 | + if (check_offset < tcg_init_ctx.code_gen_buffer_size) { | ||
101 | + tb_lock(); | ||
102 | + tb = tb_find_pc(host_pc); | ||
103 | + if (tb) { | ||
104 | + cpu_restore_state_from_tb(cpu, tb, host_pc); | ||
105 | + if (tb->cflags & CF_NOCACHE) { | ||
106 | + /* one-shot translation, invalidate it immediately */ | ||
107 | + tb_phys_invalidate(tb, -1); | ||
108 | + tb_remove(tb); | ||
109 | + } | ||
110 | + r = true; | ||
111 | } | ||
112 | - r = true; | ||
113 | + tb_unlock(); | ||
114 | } | ||
115 | - tb_unlock(); | ||
116 | |||
117 | return r; | ||
118 | } | ||
119 | -- | ||
120 | 2.7.4 | ||
121 | |||
122 | diff view generated by jsdifflib |