1 | ARM queue: nothing particularly exciting, but 18 patches | 1 | arm pullreq for rc1. All minor bugfixes, except for the sve-default-vector-length |
---|---|---|---|
2 | is enough to send out. | 2 | patches, which are somewhere between a bugfix and a new feature. |
3 | 3 | ||
4 | thanks | 4 | thanks |
5 | -- PMM | 5 | -- PMM |
6 | 6 | ||
7 | The following changes since commit 3dabde1128b671f36ac6cb36b97b273139964420: | 7 | The following changes since commit c08ccd1b53f488ac86c1f65cf7623dc91acc249a: |
8 | 8 | ||
9 | Merge remote-tracking branch 'remotes/dgilbert/tags/pull-hmp-20170914' into staging (2017-09-14 16:33:02 +0100) | 9 | Merge remote-tracking branch 'remotes/rth-gitlab/tags/pull-tcg-20210726' into staging (2021-07-27 08:35:01 +0100) |
10 | 10 | ||
11 | are available in the git repository at: | 11 | are available in the Git repository at: |
12 | 12 | ||
13 | git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20170914 | 13 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20210727 |
14 | 14 | ||
15 | for you to fetch changes up to ce3bc112cdb1d462e2d52eaa17a7314e7f3af504: | 15 | for you to fetch changes up to e229a179a503f2aee43a76888cf12fbdfe8a3749: |
16 | 16 | ||
17 | mps2-an511: Fix wiring of UART overflow interrupt lines (2017-09-14 18:43:19 +0100) | 17 | hw: aspeed_gpio: Fix memory size (2021-07-27 11:00:00 +0100) |
18 | 18 | ||
19 | ---------------------------------------------------------------- | 19 | ---------------------------------------------------------------- |
20 | target-arm queue: | 20 | target-arm queue: |
21 | * v7M: various code cleanups | 21 | * hw/arm/smmuv3: Check 31st bit to see if CD is valid |
22 | * v7M: set correct BFSR bits on bus fault | 22 | * qemu-options.hx: Fix formatting of -machine memory-backend option |
23 | * v7M: clear exclusive monitor on reset and exception entry/exit | 23 | * hw: aspeed_gpio: Fix memory size |
24 | * v7M: don't apply priority mask to negative priorities | 24 | * hw/arm/nseries: Display hexadecimal value with '0x' prefix |
25 | * zcu102: support 'secure' and 'virtualization' machine properties | 25 | * Add sve-default-vector-length cpu property |
26 | * aarch64: fix ERET single stepping | 26 | * docs: Update path that mentions deprecated.rst |
27 | * gpex: implement PCI INTx routing | 27 | * hw/intc/armv7m_nvic: for v8.1M VECTPENDING hides S exceptions from NS |
28 | * mps2-an511: fix UART overflow interrupt line wiring | 28 | * hw/intc/armv7m_nvic: Correct size of ICSR.VECTPENDING |
29 | * hw/intc/armv7m_nvic: ISCR.ISRPENDING is set for non-enabled pending interrupts | ||
30 | * target/arm: Report M-profile alignment faults correctly to the guest | ||
31 | * target/arm: Add missing 'return's after calling v7m_exception_taken() | ||
32 | * target/arm: Enforce that M-profile SP low 2 bits are always zero | ||
29 | 33 | ||
30 | ---------------------------------------------------------------- | 34 | ---------------------------------------------------------------- |
31 | Alistair Francis (5): | 35 | Joe Komlodi (1): |
32 | xlnx-ep108: Rename to ZCU102 | 36 | hw/arm/smmuv3: Check 31st bit to see if CD is valid |
33 | xlnx-zcu102: Manually create the machines | ||
34 | xlnx-zcu102: Add a machine level secure property | ||
35 | xlnx-zcu102: Add a machine level virtualization property | ||
36 | xlnx-zcu102: Mark the EP108 machine as deprecated | ||
37 | 37 | ||
38 | Jaroslaw Pelczar (1): | 38 | Joel Stanley (1): |
39 | AArch64: Fix single stepping of ERET instruction | 39 | hw: aspeed_gpio: Fix memory size |
40 | 40 | ||
41 | Peter Maydell (8): | 41 | Mao Zhongyi (1): |
42 | target/arm: Use M_REG_NUM_BANKS rather than hardcoding 2 | 42 | docs: Update path that mentions deprecated.rst |
43 | target/arm: Clear exclusive monitor on v7M reset, exception entry/exit | ||
44 | target/arm: Get PRECISERR and IBUSERR the right way round | ||
45 | nvic: Don't apply group priority mask to negative priorities | ||
46 | target/arm: Remove unnecessary '| 0xf0000000' from do_v7m_exception_exit() | ||
47 | target/arm: Add and use defines for EXCRET constants | ||
48 | target/arm: Rename 'type' to 'excret' in do_v7m_exception_exit() | ||
49 | mps2-an511: Fix wiring of UART overflow interrupt lines | ||
50 | 43 | ||
51 | Pranavkumar Sawargaonkar (3): | 44 | Peter Maydell (7): |
52 | hw/pci-host/gpex: Set INTx index/gsi mapping | 45 | qemu-options.hx: Fix formatting of -machine memory-backend option |
53 | hw/arm/virt: Set INTx/gsi mapping | 46 | target/arm: Enforce that M-profile SP low 2 bits are always zero |
54 | hw/pci-host/gpex: Implement PCI INTx routing | 47 | target/arm: Add missing 'return's after calling v7m_exception_taken() |
48 | target/arm: Report M-profile alignment faults correctly to the guest | ||
49 | hw/intc/armv7m_nvic: ISCR.ISRPENDING is set for non-enabled pending interrupts | ||
50 | hw/intc/armv7m_nvic: Correct size of ICSR.VECTPENDING | ||
51 | hw/intc/armv7m_nvic: for v8.1M VECTPENDING hides S exceptions from NS | ||
55 | 52 | ||
56 | Richard Henderson (1): | 53 | Philippe Mathieu-Daudé (1): |
57 | target/arm: Avoid an extra temporary for store_exclusive | 54 | hw/arm/nseries: Display hexadecimal value with '0x' prefix |
58 | 55 | ||
59 | hw/arm/Makefile.objs | 2 +- | 56 | Richard Henderson (3): |
60 | include/hw/arm/xlnx-zynqmp.h | 2 + | 57 | target/arm: Correctly bound length in sve_zcr_get_valid_len |
61 | include/hw/pci-host/gpex.h | 3 + | 58 | target/arm: Export aarch64_sve_zcr_get_valid_len |
62 | target/arm/cpu.h | 35 +++--- | 59 | target/arm: Add sve-default-vector-length cpu property |
63 | target/arm/internals.h | 20 ++++ | ||
64 | hw/arm/mps2.c | 4 +- | ||
65 | hw/arm/virt.c | 1 + | ||
66 | hw/arm/xlnx-ep108.c | 139 ----------------------- | ||
67 | hw/arm/xlnx-zcu102.c | 259 +++++++++++++++++++++++++++++++++++++++++++ | ||
68 | hw/arm/xlnx-zynqmp.c | 3 +- | ||
69 | hw/intc/armv7m_nvic.c | 11 +- | ||
70 | hw/pci-host/gpex.c | 22 ++++ | ||
71 | target/arm/cpu.c | 6 + | ||
72 | target/arm/helper.c | 43 ++++--- | ||
73 | target/arm/op_helper.c | 2 +- | ||
74 | target/arm/translate-a64.c | 27 ++--- | ||
75 | 16 files changed, 382 insertions(+), 197 deletions(-) | ||
76 | delete mode 100644 hw/arm/xlnx-ep108.c | ||
77 | create mode 100644 hw/arm/xlnx-zcu102.c | ||
78 | 60 | ||
61 | docs/system/arm/cpu-features.rst | 15 ++++++++++ | ||
62 | configure | 2 +- | ||
63 | hw/arm/smmuv3-internal.h | 2 +- | ||
64 | target/arm/cpu.h | 5 ++++ | ||
65 | target/arm/internals.h | 10 +++++++ | ||
66 | hw/arm/nseries.c | 2 +- | ||
67 | hw/gpio/aspeed_gpio.c | 3 +- | ||
68 | hw/intc/armv7m_nvic.c | 40 +++++++++++++++++++-------- | ||
69 | target/arm/cpu.c | 14 ++++++++-- | ||
70 | target/arm/cpu64.c | 60 ++++++++++++++++++++++++++++++++++++++++ | ||
71 | target/arm/gdbstub.c | 4 +++ | ||
72 | target/arm/helper.c | 8 ++++-- | ||
73 | target/arm/m_helper.c | 24 ++++++++++++---- | ||
74 | target/arm/translate.c | 3 ++ | ||
75 | target/i386/cpu.c | 2 +- | ||
76 | MAINTAINERS | 2 +- | ||
77 | qemu-options.hx | 30 +++++++++++--------- | ||
78 | 17 files changed, 183 insertions(+), 43 deletions(-) | ||
79 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Use a symbolic constant M_REG_NUM_BANKS for the array size for | ||
2 | registers which are banked by M profile security state, rather | ||
3 | than hardcoding lots of 2s. | ||
4 | 1 | ||
5 | Suggested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Reviewed-by: Alistair Francis <alistair.francis@xilinx.com> | ||
9 | Message-id: 1505137930-13255-2-git-send-email-peter.maydell@linaro.org | ||
10 | --- | ||
11 | target/arm/cpu.h | 35 +++++++++++++++++++---------------- | ||
12 | 1 file changed, 19 insertions(+), 16 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 @@ | ||
19 | * accessed via env->registerfield[env->v7m.secure] (whether the security | ||
20 | * extension is implemented or not). | ||
21 | */ | ||
22 | -#define M_REG_NS 0 | ||
23 | -#define M_REG_S 1 | ||
24 | +enum { | ||
25 | + M_REG_NS = 0, | ||
26 | + M_REG_S = 1, | ||
27 | + M_REG_NUM_BANKS = 2, | ||
28 | +}; | ||
29 | |||
30 | /* ARM-specific interrupt pending bits. */ | ||
31 | #define CPU_INTERRUPT_FIQ CPU_INTERRUPT_TGT_EXT_1 | ||
32 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState { | ||
33 | uint32_t other_sp; | ||
34 | uint32_t other_ss_msp; | ||
35 | uint32_t other_ss_psp; | ||
36 | - uint32_t vecbase[2]; | ||
37 | - uint32_t basepri[2]; | ||
38 | - uint32_t control[2]; | ||
39 | - uint32_t ccr[2]; /* Configuration and Control */ | ||
40 | - uint32_t cfsr[2]; /* Configurable Fault Status */ | ||
41 | + uint32_t vecbase[M_REG_NUM_BANKS]; | ||
42 | + uint32_t basepri[M_REG_NUM_BANKS]; | ||
43 | + uint32_t control[M_REG_NUM_BANKS]; | ||
44 | + uint32_t ccr[M_REG_NUM_BANKS]; /* Configuration and Control */ | ||
45 | + uint32_t cfsr[M_REG_NUM_BANKS]; /* Configurable Fault Status */ | ||
46 | uint32_t hfsr; /* HardFault Status */ | ||
47 | uint32_t dfsr; /* Debug Fault Status Register */ | ||
48 | - uint32_t mmfar[2]; /* MemManage Fault Address */ | ||
49 | + uint32_t mmfar[M_REG_NUM_BANKS]; /* MemManage Fault Address */ | ||
50 | uint32_t bfar; /* BusFault Address */ | ||
51 | - unsigned mpu_ctrl[2]; /* MPU_CTRL */ | ||
52 | + unsigned mpu_ctrl[M_REG_NUM_BANKS]; /* MPU_CTRL */ | ||
53 | int exception; | ||
54 | - uint32_t primask[2]; | ||
55 | - uint32_t faultmask[2]; | ||
56 | + uint32_t primask[M_REG_NUM_BANKS]; | ||
57 | + uint32_t faultmask[M_REG_NUM_BANKS]; | ||
58 | uint32_t secure; /* Is CPU in Secure state? (not guest visible) */ | ||
59 | } v7m; | ||
60 | |||
61 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState { | ||
62 | uint32_t *drbar; | ||
63 | uint32_t *drsr; | ||
64 | uint32_t *dracr; | ||
65 | - uint32_t rnr[2]; | ||
66 | + uint32_t rnr[M_REG_NUM_BANKS]; | ||
67 | } pmsav7; | ||
68 | |||
69 | /* PMSAv8 MPU */ | ||
70 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState { | ||
71 | * pmsav7.rnr (region number register) | ||
72 | * pmsav7_dregion (number of configured regions) | ||
73 | */ | ||
74 | - uint32_t *rbar[2]; | ||
75 | - uint32_t *rlar[2]; | ||
76 | - uint32_t mair0[2]; | ||
77 | - uint32_t mair1[2]; | ||
78 | + uint32_t *rbar[M_REG_NUM_BANKS]; | ||
79 | + uint32_t *rlar[M_REG_NUM_BANKS]; | ||
80 | + uint32_t mair0[M_REG_NUM_BANKS]; | ||
81 | + uint32_t mair1[M_REG_NUM_BANKS]; | ||
82 | } pmsav8; | ||
83 | |||
84 | void *nvic; | ||
85 | -- | ||
86 | 2.7.4 | ||
87 | |||
88 | diff view generated by jsdifflib |
1 | From: Alistair Francis <alistair.francis@xilinx.com> | 1 | From: Joe Komlodi <joe.komlodi@xilinx.com> |
---|---|---|---|
2 | 2 | ||
3 | The EP108 is the same as the ZCU102, mark it as deprecated as we don't | 3 | The bit to see if a CD is valid is the last bit of the first word of the CD. |
4 | need two machines. | ||
5 | 4 | ||
6 | Signed-off-by: Alistair Francis <alistair.francis@xilinx.com> | 5 | Signed-off-by: Joe Komlodi <joe.komlodi@xilinx.com> |
7 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 6 | Message-id: 1626728232-134665-2-git-send-email-joe.komlodi@xilinx.com |
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | --- | 9 | --- |
10 | hw/arm/xlnx-zcu102.c | 2 +- | 10 | hw/arm/smmuv3-internal.h | 2 +- |
11 | 1 file changed, 1 insertion(+), 1 deletion(-) | 11 | 1 file changed, 1 insertion(+), 1 deletion(-) |
12 | 12 | ||
13 | diff --git a/hw/arm/xlnx-zcu102.c b/hw/arm/xlnx-zcu102.c | 13 | diff --git a/hw/arm/smmuv3-internal.h b/hw/arm/smmuv3-internal.h |
14 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/hw/arm/xlnx-zcu102.c | 15 | --- a/hw/arm/smmuv3-internal.h |
16 | +++ b/hw/arm/xlnx-zcu102.c | 16 | +++ b/hw/arm/smmuv3-internal.h |
17 | @@ -XXX,XX +XXX,XX @@ static void xlnx_ep108_machine_class_init(ObjectClass *oc, void *data) | 17 | @@ -XXX,XX +XXX,XX @@ static inline int pa_range(STE *ste) |
18 | { | 18 | |
19 | MachineClass *mc = MACHINE_CLASS(oc); | 19 | /* CD fields */ |
20 | 20 | ||
21 | - mc->desc = "Xilinx ZynqMP EP108 board"; | 21 | -#define CD_VALID(x) extract32((x)->word[0], 30, 1) |
22 | + mc->desc = "Xilinx ZynqMP EP108 board (Deprecated, please use xlnx-zcu102)"; | 22 | +#define CD_VALID(x) extract32((x)->word[0], 31, 1) |
23 | mc->init = xlnx_ep108_init; | 23 | #define CD_ASID(x) extract32((x)->word[1], 16, 16) |
24 | mc->block_default_type = IF_IDE; | 24 | #define CD_TTB(x, sel) \ |
25 | mc->units_per_default_bus = 1; | 25 | ({ \ |
26 | -- | 26 | -- |
27 | 2.7.4 | 27 | 2.20.1 |
28 | 28 | ||
29 | 29 | diff view generated by jsdifflib |
1 | Fix an error that meant we were wiring every UART's overflow | 1 | The documentation of the -machine memory-backend has some minor |
---|---|---|---|
2 | interrupts into the same inputs 0 and 1 of the OR gate, | 2 | formatting errors: |
3 | rather than giving each its own input. | 3 | * Misindentation of the initial line meant that the whole option |
4 | section is incorrectly indented in the HTML output compared to | ||
5 | the other -machine options | ||
6 | * The examples weren't indented, which meant that they were formatted | ||
7 | as plain run-on text including outputting the "::" as text. | ||
8 | * The a) b) list has no rst-format markup so it is rendered as | ||
9 | a single run-on paragraph | ||
4 | 10 | ||
5 | Cc: qemu-stable@nongnu.org | 11 | Fix the formatting. |
12 | |||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 14 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> |
8 | Reviewed-by: Alistair Francis <alistair.francis@xilinx.com> | 15 | Message-id: 20210719105257.3599-1-peter.maydell@linaro.org |
9 | Message-id: 1505232834-20890-1-git-send-email-peter.maydell@linaro.org | ||
10 | --- | 16 | --- |
11 | hw/arm/mps2.c | 4 ++-- | 17 | qemu-options.hx | 30 +++++++++++++++++------------- |
12 | 1 file changed, 2 insertions(+), 2 deletions(-) | 18 | 1 file changed, 17 insertions(+), 13 deletions(-) |
13 | 19 | ||
14 | diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c | 20 | diff --git a/qemu-options.hx b/qemu-options.hx |
15 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/arm/mps2.c | 22 | --- a/qemu-options.hx |
17 | +++ b/hw/arm/mps2.c | 23 | +++ b/qemu-options.hx |
18 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) | 24 | @@ -XXX,XX +XXX,XX @@ SRST |
19 | cmsdk_apb_uart_create(uartbase[i], | 25 | Enables or disables ACPI Heterogeneous Memory Attribute Table |
20 | qdev_get_gpio_in(txrx_orgate_dev, 0), | 26 | (HMAT) support. The default is off. |
21 | qdev_get_gpio_in(txrx_orgate_dev, 1), | 27 | |
22 | - qdev_get_gpio_in(orgate_dev, 0), | 28 | - ``memory-backend='id'`` |
23 | - qdev_get_gpio_in(orgate_dev, 1), | 29 | + ``memory-backend='id'`` |
24 | + qdev_get_gpio_in(orgate_dev, i * 2), | 30 | An alternative to legacy ``-mem-path`` and ``mem-prealloc`` options. |
25 | + qdev_get_gpio_in(orgate_dev, i * 2 + 1), | 31 | Allows to use a memory backend as main RAM. |
26 | NULL, | 32 | |
27 | uartchr, SYSCLK_FRQ); | 33 | For example: |
28 | } | 34 | :: |
35 | - -object memory-backend-file,id=pc.ram,size=512M,mem-path=/hugetlbfs,prealloc=on,share=on | ||
36 | - -machine memory-backend=pc.ram | ||
37 | - -m 512M | ||
38 | + | ||
39 | + -object memory-backend-file,id=pc.ram,size=512M,mem-path=/hugetlbfs,prealloc=on,share=on | ||
40 | + -machine memory-backend=pc.ram | ||
41 | + -m 512M | ||
42 | |||
43 | Migration compatibility note: | ||
44 | - a) as backend id one shall use value of 'default-ram-id', advertised by | ||
45 | - machine type (available via ``query-machines`` QMP command), if migration | ||
46 | - to/from old QEMU (<5.0) is expected. | ||
47 | - b) for machine types 4.0 and older, user shall | ||
48 | - use ``x-use-canonical-path-for-ramblock-id=off`` backend option | ||
49 | - if migration to/from old QEMU (<5.0) is expected. | ||
50 | + | ||
51 | + * as backend id one shall use value of 'default-ram-id', advertised by | ||
52 | + machine type (available via ``query-machines`` QMP command), if migration | ||
53 | + to/from old QEMU (<5.0) is expected. | ||
54 | + * for machine types 4.0 and older, user shall | ||
55 | + use ``x-use-canonical-path-for-ramblock-id=off`` backend option | ||
56 | + if migration to/from old QEMU (<5.0) is expected. | ||
57 | + | ||
58 | For example: | ||
59 | :: | ||
60 | - -object memory-backend-ram,id=pc.ram,size=512M,x-use-canonical-path-for-ramblock-id=off | ||
61 | - -machine memory-backend=pc.ram | ||
62 | - -m 512M | ||
63 | + | ||
64 | + -object memory-backend-ram,id=pc.ram,size=512M,x-use-canonical-path-for-ramblock-id=off | ||
65 | + -machine memory-backend=pc.ram | ||
66 | + -m 512M | ||
67 | ERST | ||
68 | |||
69 | HXCOMM Deprecated by -machine | ||
29 | -- | 70 | -- |
30 | 2.7.4 | 71 | 2.20.1 |
31 | 72 | ||
32 | 73 | diff view generated by jsdifflib |
1 | In the v7M and v8M ARM ARM, the magic exception return values are | 1 | For M-profile, unlike A-profile, the low 2 bits of SP are defined to be |
---|---|---|---|
2 | referred to as EXC_RETURN values, and in QEMU we use V7M_EXCRET_* | 2 | RES0H, which is to say that they must be hardwired to zero so that |
3 | constants to define bits within them. Rename the 'type' variable | 3 | guest attempts to write non-zero values to them are ignored. |
4 | which holds the exception return value in do_v7m_exception_exit() | 4 | |
5 | to excret, making it clearer that it does hold an EXC_RETURN value. | 5 | Implement this behaviour by masking out the low bits: |
6 | * for writes to r13 by the gdbstub | ||
7 | * for writes to any of the various flavours of SP via MSR | ||
8 | * for writes to r13 via store_reg() in generated code | ||
9 | |||
10 | Note that all the direct uses of cpu_R[] in translate.c are in places | ||
11 | where the register is definitely not r13 (usually because that has | ||
12 | been checked for as an UNDEFINED or UNPREDICTABLE case and handled as | ||
13 | UNDEF). | ||
14 | |||
15 | All the other writes to regs[13] in C code are either: | ||
16 | * A-profile only code | ||
17 | * writes of values we can guarantee to be aligned, such as | ||
18 | - writes of previous-SP-value plus or minus a 4-aligned constant | ||
19 | - writes of the value in an SP limit register (which we already | ||
20 | enforce to be aligned) | ||
6 | 21 | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 22 | 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@xilinx.com> | ||
10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 23 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
11 | Message-id: 1505137930-13255-8-git-send-email-peter.maydell@linaro.org | 24 | Message-id: 20210723162146.5167-2-peter.maydell@linaro.org |
12 | --- | 25 | --- |
13 | target/arm/helper.c | 23 ++++++++++++----------- | 26 | target/arm/gdbstub.c | 4 ++++ |
14 | 1 file changed, 12 insertions(+), 11 deletions(-) | 27 | target/arm/m_helper.c | 14 ++++++++------ |
28 | target/arm/translate.c | 3 +++ | ||
29 | 3 files changed, 15 insertions(+), 6 deletions(-) | ||
15 | 30 | ||
16 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 31 | diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c |
17 | index XXXXXXX..XXXXXXX 100644 | 32 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/helper.c | 33 | --- a/target/arm/gdbstub.c |
19 | +++ b/target/arm/helper.c | 34 | +++ b/target/arm/gdbstub.c |
20 | @@ -XXX,XX +XXX,XX @@ static void v7m_push_stack(ARMCPU *cpu) | 35 | @@ -XXX,XX +XXX,XX @@ int arm_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) |
21 | static void do_v7m_exception_exit(ARMCPU *cpu) | 36 | |
22 | { | 37 | if (n < 16) { |
23 | CPUARMState *env = &cpu->env; | 38 | /* Core integer register. */ |
24 | - uint32_t type; | 39 | + if (n == 13 && arm_feature(env, ARM_FEATURE_M)) { |
25 | + uint32_t excret; | 40 | + /* M profile SP low bits are always 0 */ |
26 | uint32_t xpsr; | 41 | + tmp &= ~3; |
27 | bool ufault = false; | 42 | + } |
28 | bool return_to_sp_process = false; | 43 | env->regs[n] = tmp; |
29 | @@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu) | 44 | return 4; |
30 | * the target value up between env->regs[15] and env->thumb in | ||
31 | * gen_bx(). Reconstitute it. | ||
32 | */ | ||
33 | - type = env->regs[15]; | ||
34 | + excret = env->regs[15]; | ||
35 | if (env->thumb) { | ||
36 | - type |= 1; | ||
37 | + excret |= 1; | ||
38 | } | 45 | } |
39 | 46 | diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c | |
40 | qemu_log_mask(CPU_LOG_INT, "Exception return: magic PC %" PRIx32 | 47 | index XXXXXXX..XXXXXXX 100644 |
41 | " previous exception %d\n", | 48 | --- a/target/arm/m_helper.c |
42 | - type, env->v7m.exception); | 49 | +++ b/target/arm/m_helper.c |
43 | + excret, env->v7m.exception); | 50 | @@ -XXX,XX +XXX,XX @@ void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val) |
44 | 51 | if (!env->v7m.secure) { | |
45 | - if ((type & R_V7M_EXCRET_RES1_MASK) != R_V7M_EXCRET_RES1_MASK) { | 52 | return; |
46 | + if ((excret & R_V7M_EXCRET_RES1_MASK) != R_V7M_EXCRET_RES1_MASK) { | 53 | } |
47 | qemu_log_mask(LOG_GUEST_ERROR, "M profile: zero high bits in exception " | 54 | - env->v7m.other_ss_msp = val; |
48 | - "exit PC value 0x%" PRIx32 " are UNPREDICTABLE\n", type); | 55 | + env->v7m.other_ss_msp = val & ~3; |
49 | + "exit PC value 0x%" PRIx32 " are UNPREDICTABLE\n", | 56 | return; |
50 | + excret); | 57 | case 0x89: /* PSP_NS */ |
58 | if (!env->v7m.secure) { | ||
59 | return; | ||
60 | } | ||
61 | - env->v7m.other_ss_psp = val; | ||
62 | + env->v7m.other_ss_psp = val & ~3; | ||
63 | return; | ||
64 | case 0x8a: /* MSPLIM_NS */ | ||
65 | if (!env->v7m.secure) { | ||
66 | @@ -XXX,XX +XXX,XX @@ void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val) | ||
67 | |||
68 | limit = is_psp ? env->v7m.psplim[false] : env->v7m.msplim[false]; | ||
69 | |||
70 | + val &= ~0x3; | ||
71 | + | ||
72 | if (val < limit) { | ||
73 | raise_exception_ra(env, EXCP_STKOF, 0, 1, GETPC()); | ||
74 | } | ||
75 | @@ -XXX,XX +XXX,XX @@ void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val) | ||
76 | break; | ||
77 | case 8: /* MSP */ | ||
78 | if (v7m_using_psp(env)) { | ||
79 | - env->v7m.other_sp = val; | ||
80 | + env->v7m.other_sp = val & ~3; | ||
81 | } else { | ||
82 | - env->regs[13] = val; | ||
83 | + env->regs[13] = val & ~3; | ||
84 | } | ||
85 | break; | ||
86 | case 9: /* PSP */ | ||
87 | if (v7m_using_psp(env)) { | ||
88 | - env->regs[13] = val; | ||
89 | + env->regs[13] = val & ~3; | ||
90 | } else { | ||
91 | - env->v7m.other_sp = val; | ||
92 | + env->v7m.other_sp = val & ~3; | ||
93 | } | ||
94 | break; | ||
95 | case 10: /* MSPLIM */ | ||
96 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
97 | index XXXXXXX..XXXXXXX 100644 | ||
98 | --- a/target/arm/translate.c | ||
99 | +++ b/target/arm/translate.c | ||
100 | @@ -XXX,XX +XXX,XX @@ void store_reg(DisasContext *s, int reg, TCGv_i32 var) | ||
101 | */ | ||
102 | tcg_gen_andi_i32(var, var, s->thumb ? ~1 : ~3); | ||
103 | s->base.is_jmp = DISAS_JUMP; | ||
104 | + } else if (reg == 13 && arm_dc_feature(s, ARM_FEATURE_M)) { | ||
105 | + /* For M-profile SP bits [1:0] are always zero */ | ||
106 | + tcg_gen_andi_i32(var, var, ~3); | ||
51 | } | 107 | } |
52 | 108 | tcg_gen_mov_i32(cpu_R[reg], var); | |
53 | if (env->v7m.exception != ARMV7M_EXCP_NMI) { | 109 | tcg_temp_free_i32(var); |
54 | @@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu) | ||
55 | * which security state's faultmask to clear. (v8M ARM ARM R_KBNF.) | ||
56 | */ | ||
57 | if (arm_feature(env, ARM_FEATURE_M_SECURITY)) { | ||
58 | - int es = type & R_V7M_EXCRET_ES_MASK; | ||
59 | + int es = excret & R_V7M_EXCRET_ES_MASK; | ||
60 | if (armv7m_nvic_raw_execution_priority(env->nvic) >= 0) { | ||
61 | env->v7m.faultmask[es] = 0; | ||
62 | } | ||
63 | @@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu) | ||
64 | g_assert_not_reached(); | ||
65 | } | ||
66 | |||
67 | - switch (type & 0xf) { | ||
68 | + switch (excret & 0xf) { | ||
69 | case 1: /* Return to Handler */ | ||
70 | return_to_handler = true; | ||
71 | break; | ||
72 | @@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu) | ||
73 | */ | ||
74 | env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_INVPC_MASK; | ||
75 | armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE); | ||
76 | - v7m_exception_taken(cpu, type); | ||
77 | + v7m_exception_taken(cpu, excret); | ||
78 | qemu_log_mask(CPU_LOG_INT, "...taking UsageFault on existing " | ||
79 | "stackframe: failed exception return integrity check\n"); | ||
80 | return; | ||
81 | @@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu) | ||
82 | |||
83 | /* The restored xPSR exception field will be zero if we're | ||
84 | * resuming in Thread mode. If that doesn't match what the | ||
85 | - * exception return type specified then this is a UsageFault. | ||
86 | + * exception return excret specified then this is a UsageFault. | ||
87 | */ | ||
88 | if (return_to_handler != arm_v7m_is_handler_mode(env)) { | ||
89 | /* Take an INVPC UsageFault by pushing the stack again. */ | ||
90 | armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE); | ||
91 | env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_INVPC_MASK; | ||
92 | v7m_push_stack(cpu); | ||
93 | - v7m_exception_taken(cpu, type); | ||
94 | + v7m_exception_taken(cpu, excret); | ||
95 | qemu_log_mask(CPU_LOG_INT, "...taking UsageFault on new stackframe: " | ||
96 | "failed exception return integrity check\n"); | ||
97 | return; | ||
98 | -- | 110 | -- |
99 | 2.7.4 | 111 | 2.20.1 |
100 | 112 | ||
101 | 113 | diff view generated by jsdifflib |
1 | The exception-return magic values get some new bits in v8M, which | 1 | In do_v7m_exception_exit(), we perform various checks as part of |
---|---|---|---|
2 | makes some bit definitions for them worthwhile. | 2 | performing the exception return. If one of these checks fails, the |
3 | architecture requires that we take an appropriate exception on the | ||
4 | existing stackframe. We implement this by calling | ||
5 | v7m_exception_taken() to set up to take the new exception, and then | ||
6 | immediately returning from do_v7m_exception_exit() without proceeding | ||
7 | any further with the unstack-and-exception-return process. | ||
3 | 8 | ||
4 | We don't use the bit definitions for the switch on the low bits | 9 | In a couple of checks that are new in v8.1M, we forgot the "return" |
5 | which checks the return type for v7M, because this is defined | 10 | statement, with the effect that if bad code in the guest tripped over |
6 | in the v7M ARM ARM as a set of valid values rather than via | 11 | these checks we would set up to take a UsageFault exception but then |
7 | per-bit checks. | 12 | blunder on trying to also unstack and return from the original |
13 | exception, with the probable result that the guest would crash. | ||
14 | |||
15 | Add the missing return statements. | ||
8 | 16 | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Reviewed-by: Alistair Francis <alistair.francis@xilinx.com> | 18 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
11 | Message-id: 1505137930-13255-7-git-send-email-peter.maydell@linaro.org | 19 | Message-id: 20210723162146.5167-3-peter.maydell@linaro.org |
12 | --- | 20 | --- |
13 | target/arm/internals.h | 10 ++++++++++ | 21 | target/arm/m_helper.c | 2 ++ |
14 | target/arm/helper.c | 14 +++++++++----- | 22 | 1 file changed, 2 insertions(+) |
15 | 2 files changed, 19 insertions(+), 5 deletions(-) | ||
16 | 23 | ||
17 | diff --git a/target/arm/internals.h b/target/arm/internals.h | 24 | diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c |
18 | index XXXXXXX..XXXXXXX 100644 | 25 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/target/arm/internals.h | 26 | --- a/target/arm/m_helper.c |
20 | +++ b/target/arm/internals.h | 27 | +++ b/target/arm/m_helper.c |
21 | @@ -XXX,XX +XXX,XX @@ FIELD(V7M_CONTROL, NPRIV, 0, 1) | ||
22 | FIELD(V7M_CONTROL, SPSEL, 1, 1) | ||
23 | FIELD(V7M_CONTROL, FPCA, 2, 1) | ||
24 | |||
25 | +/* Bit definitions for v7M exception return payload */ | ||
26 | +FIELD(V7M_EXCRET, ES, 0, 1) | ||
27 | +FIELD(V7M_EXCRET, RES0, 1, 1) | ||
28 | +FIELD(V7M_EXCRET, SPSEL, 2, 1) | ||
29 | +FIELD(V7M_EXCRET, MODE, 3, 1) | ||
30 | +FIELD(V7M_EXCRET, FTYPE, 4, 1) | ||
31 | +FIELD(V7M_EXCRET, DCRS, 5, 1) | ||
32 | +FIELD(V7M_EXCRET, S, 6, 1) | ||
33 | +FIELD(V7M_EXCRET, RES1, 7, 25) /* including the must-be-1 prefix */ | ||
34 | + | ||
35 | /* | ||
36 | * For AArch64, map a given EL to an index in the banked_spsr array. | ||
37 | * Note that this mapping and the AArch32 mapping defined in bank_number() | ||
38 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
39 | index XXXXXXX..XXXXXXX 100644 | ||
40 | --- a/target/arm/helper.c | ||
41 | +++ b/target/arm/helper.c | ||
42 | @@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu) | 28 | @@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu) |
43 | " previous exception %d\n", | 29 | qemu_log_mask(CPU_LOG_INT, "...taking UsageFault on existing " |
44 | type, env->v7m.exception); | 30 | "stackframe: NSACR prevents clearing FPU registers\n"); |
45 | 31 | v7m_exception_taken(cpu, excret, true, false); | |
46 | - if (extract32(type, 5, 23) != extract32(-1, 5, 23)) { | 32 | + return; |
47 | + if ((type & R_V7M_EXCRET_RES1_MASK) != R_V7M_EXCRET_RES1_MASK) { | 33 | } else if (!cpacr_pass) { |
48 | qemu_log_mask(LOG_GUEST_ERROR, "M profile: zero high bits in exception " | 34 | armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE, |
49 | "exit PC value 0x%" PRIx32 " are UNPREDICTABLE\n", type); | 35 | exc_secure); |
50 | } | ||
51 | @@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu) | 36 | @@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu) |
52 | * which security state's faultmask to clear. (v8M ARM ARM R_KBNF.) | 37 | qemu_log_mask(CPU_LOG_INT, "...taking UsageFault on existing " |
53 | */ | 38 | "stackframe: CPACR prevents clearing FPU registers\n"); |
54 | if (arm_feature(env, ARM_FEATURE_M_SECURITY)) { | 39 | v7m_exception_taken(cpu, excret, true, false); |
55 | - int es = type & 1; | 40 | + return; |
56 | + int es = type & R_V7M_EXCRET_ES_MASK; | 41 | } |
57 | if (armv7m_nvic_raw_execution_priority(env->nvic) >= 0) { | ||
58 | env->v7m.faultmask[es] = 0; | ||
59 | } | 42 | } |
60 | @@ -XXX,XX +XXX,XX @@ void arm_v7m_cpu_do_interrupt(CPUState *cs) | 43 | /* Clear s0..s15, FPSCR and VPR */ |
61 | return; /* Never happens. Keep compiler happy. */ | ||
62 | } | ||
63 | |||
64 | - lr = 0xfffffff1; | ||
65 | + lr = R_V7M_EXCRET_RES1_MASK | | ||
66 | + R_V7M_EXCRET_S_MASK | | ||
67 | + R_V7M_EXCRET_DCRS_MASK | | ||
68 | + R_V7M_EXCRET_FTYPE_MASK | | ||
69 | + R_V7M_EXCRET_ES_MASK; | ||
70 | if (env->v7m.control[env->v7m.secure] & R_V7M_CONTROL_SPSEL_MASK) { | ||
71 | - lr |= 4; | ||
72 | + lr |= R_V7M_EXCRET_SPSEL_MASK; | ||
73 | } | ||
74 | if (!arm_v7m_is_handler_mode(env)) { | ||
75 | - lr |= 8; | ||
76 | + lr |= R_V7M_EXCRET_MODE_MASK; | ||
77 | } | ||
78 | |||
79 | v7m_push_stack(cpu); | ||
80 | -- | 44 | -- |
81 | 2.7.4 | 45 | 2.20.1 |
82 | 46 | ||
83 | 47 | diff view generated by jsdifflib |
1 | In do_v7m_exception_exit(), there's no need to force the high 4 | 1 | For M-profile, we weren't reporting alignment faults triggered by the |
---|---|---|---|
2 | bits of 'type' to 1 when calling v7m_exception_taken(), because | 2 | generic TCG code correctly to the guest. These get passed into |
3 | we know that they're always 1 or we could not have got to this | 3 | arm_v7m_cpu_do_interrupt() as an EXCP_DATA_ABORT with an A-profile |
4 | "handle return to magic exception return address" code. Remove | 4 | style exception.fsr value of 1. We didn't check for this, and so |
5 | the unnecessary ORs. | 5 | they fell through into the default of "assume this is an MPU fault" |
6 | and were reported to the guest as a data access violation MPU fault. | ||
7 | |||
8 | Report these alignment faults as UsageFaults which set the UNALIGNED | ||
9 | bit in the UFSR. | ||
6 | 10 | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 12 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Acked-by: Alistair Francis <alistair.francis@xilinx.com> | 13 | Message-id: 20210723162146.5167-4-peter.maydell@linaro.org |
10 | Message-id: 1505137930-13255-6-git-send-email-peter.maydell@linaro.org | ||
11 | --- | 14 | --- |
12 | target/arm/helper.c | 4 ++-- | 15 | target/arm/m_helper.c | 8 ++++++++ |
13 | 1 file changed, 2 insertions(+), 2 deletions(-) | 16 | 1 file changed, 8 insertions(+) |
14 | 17 | ||
15 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 18 | diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c |
16 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/target/arm/helper.c | 20 | --- a/target/arm/m_helper.c |
18 | +++ b/target/arm/helper.c | 21 | +++ b/target/arm/m_helper.c |
19 | @@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu) | 22 | @@ -XXX,XX +XXX,XX @@ void arm_v7m_cpu_do_interrupt(CPUState *cs) |
20 | */ | 23 | env->v7m.sfsr |= R_V7M_SFSR_LSERR_MASK; |
21 | env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_INVPC_MASK; | 24 | break; |
22 | armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE); | 25 | case EXCP_UNALIGNED: |
23 | - v7m_exception_taken(cpu, type | 0xf0000000); | 26 | + /* Unaligned faults reported by M-profile aware code */ |
24 | + v7m_exception_taken(cpu, type); | 27 | armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE, env->v7m.secure); |
25 | qemu_log_mask(CPU_LOG_INT, "...taking UsageFault on existing " | 28 | env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_UNALIGNED_MASK; |
26 | "stackframe: failed exception return integrity check\n"); | 29 | break; |
27 | return; | 30 | @@ -XXX,XX +XXX,XX @@ void arm_v7m_cpu_do_interrupt(CPUState *cs) |
28 | @@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu) | 31 | } |
29 | armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE); | 32 | armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_BUS, false); |
30 | env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_INVPC_MASK; | 33 | break; |
31 | v7m_push_stack(cpu); | 34 | + case 0x1: /* Alignment fault reported by generic code */ |
32 | - v7m_exception_taken(cpu, type | 0xf0000000); | 35 | + qemu_log_mask(CPU_LOG_INT, |
33 | + v7m_exception_taken(cpu, type); | 36 | + "...really UsageFault with UFSR.UNALIGNED\n"); |
34 | qemu_log_mask(CPU_LOG_INT, "...taking UsageFault on new stackframe: " | 37 | + env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_UNALIGNED_MASK; |
35 | "failed exception return integrity check\n"); | 38 | + armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE, |
36 | return; | 39 | + env->v7m.secure); |
40 | + break; | ||
41 | default: | ||
42 | /* | ||
43 | * All other FSR values are either MPU faults or "can't happen | ||
37 | -- | 44 | -- |
38 | 2.7.4 | 45 | 2.20.1 |
39 | 46 | ||
40 | 47 | diff view generated by jsdifflib |
1 | In several places we were unconditionally applying the | 1 | The ISCR.ISRPENDING bit is set when an external interrupt is pending. |
---|---|---|---|
2 | nvic_gprio_mask() to a priority value. This is incorrect | 2 | This is true whether that external interrupt is enabled or not. |
3 | if the priority is one of the fixed negative priority | 3 | This means that we can't use 's->vectpending == 0' as a shortcut to |
4 | values (for NMI and HardFault), so don't do it. | 4 | "ISRPENDING is zero", because s->vectpending indicates only the |
5 | highest priority pending enabled interrupt. | ||
5 | 6 | ||
6 | This bug would have caused both NMI and HardFault to be | 7 | Remove the incorrect optimization so that if there is no pending |
7 | considered as the same priority and so NMI wouldn't | 8 | enabled interrupt we fall through to scanning through the whole |
8 | correctly preempt HardFault. | 9 | interrupt array. |
9 | 10 | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 12 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
12 | Message-id: 1505137930-13255-5-git-send-email-peter.maydell@linaro.org | 13 | Message-id: 20210723162146.5167-5-peter.maydell@linaro.org |
13 | --- | 14 | --- |
14 | hw/intc/armv7m_nvic.c | 11 +++++++++-- | 15 | hw/intc/armv7m_nvic.c | 9 ++++----- |
15 | 1 file changed, 9 insertions(+), 2 deletions(-) | 16 | 1 file changed, 4 insertions(+), 5 deletions(-) |
16 | 17 | ||
17 | diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c | 18 | diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c |
18 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/hw/intc/armv7m_nvic.c | 20 | --- a/hw/intc/armv7m_nvic.c |
20 | +++ b/hw/intc/armv7m_nvic.c | 21 | +++ b/hw/intc/armv7m_nvic.c |
21 | @@ -XXX,XX +XXX,XX @@ static void nvic_recompute_state(NVICState *s) | 22 | @@ -XXX,XX +XXX,XX @@ static bool nvic_isrpending(NVICState *s) |
22 | } | 23 | { |
24 | int irq; | ||
25 | |||
26 | - /* We can shortcut if the highest priority pending interrupt | ||
27 | - * happens to be external or if there is nothing pending. | ||
28 | + /* | ||
29 | + * We can shortcut if the highest priority pending interrupt | ||
30 | + * happens to be external; if not we need to check the whole | ||
31 | + * vectors[] array. | ||
32 | */ | ||
33 | if (s->vectpending > NVIC_FIRST_IRQ) { | ||
34 | return true; | ||
23 | } | 35 | } |
24 | 36 | - if (s->vectpending == 0) { | |
25 | + if (active_prio > 0) { | 37 | - return false; |
26 | + active_prio &= nvic_gprio_mask(s); | 38 | - } |
27 | + } | 39 | |
28 | + | 40 | for (irq = NVIC_FIRST_IRQ; irq < s->num_irq; irq++) { |
29 | s->vectpending = pend_irq; | 41 | if (s->vectors[irq].pending) { |
30 | - s->exception_prio = active_prio & nvic_gprio_mask(s); | ||
31 | + s->exception_prio = active_prio; | ||
32 | |||
33 | trace_nvic_recompute_state(s->vectpending, s->exception_prio); | ||
34 | } | ||
35 | @@ -XXX,XX +XXX,XX @@ void armv7m_nvic_acknowledge_irq(void *opaque) | ||
36 | assert(vec->enabled); | ||
37 | assert(vec->pending); | ||
38 | |||
39 | - pendgroupprio = vec->prio & nvic_gprio_mask(s); | ||
40 | + pendgroupprio = vec->prio; | ||
41 | + if (pendgroupprio > 0) { | ||
42 | + pendgroupprio &= nvic_gprio_mask(s); | ||
43 | + } | ||
44 | assert(pendgroupprio < running); | ||
45 | |||
46 | trace_nvic_acknowledge_irq(pending, vec->prio); | ||
47 | -- | 42 | -- |
48 | 2.7.4 | 43 | 2.20.1 |
49 | 44 | ||
50 | 45 | diff view generated by jsdifflib |
1 | For a bus fault, the M profile BFSR bit PRECISERR means a bus | 1 | The VECTPENDING field in the ICSR is 9 bits wide, in bits [20:12] of |
---|---|---|---|
2 | fault on a data access, and IBUSERR means a bus fault on an | 2 | the register. We were incorrectly masking it to 8 bits, so it would |
3 | instruction access. We had these the wrong way around; fix this. | 3 | report the wrong value if the pending exception was greater than 256. |
4 | Fix the bug. | ||
4 | 5 | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Reviewed-by: Alistair Francis <alistair.francis@xilinx.com> | ||
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Message-id: 1505137930-13255-4-git-send-email-peter.maydell@linaro.org | 8 | Message-id: 20210723162146.5167-6-peter.maydell@linaro.org |
9 | --- | 9 | --- |
10 | target/arm/helper.c | 8 ++++---- | 10 | hw/intc/armv7m_nvic.c | 2 +- |
11 | 1 file changed, 4 insertions(+), 4 deletions(-) | 11 | 1 file changed, 1 insertion(+), 1 deletion(-) |
12 | 12 | ||
13 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 13 | diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c |
14 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/helper.c | 15 | --- a/hw/intc/armv7m_nvic.c |
16 | +++ b/target/arm/helper.c | 16 | +++ b/hw/intc/armv7m_nvic.c |
17 | @@ -XXX,XX +XXX,XX @@ void arm_v7m_cpu_do_interrupt(CPUState *cs) | 17 | @@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs) |
18 | case 0x8: /* External Abort */ | 18 | /* VECTACTIVE */ |
19 | switch (cs->exception_index) { | 19 | val = cpu->env.v7m.exception; |
20 | case EXCP_PREFETCH_ABORT: | 20 | /* VECTPENDING */ |
21 | - env->v7m.cfsr[M_REG_NS] |= R_V7M_CFSR_PRECISERR_MASK; | 21 | - val |= (s->vectpending & 0xff) << 12; |
22 | - qemu_log_mask(CPU_LOG_INT, "...with CFSR.PRECISERR\n"); | 22 | + val |= (s->vectpending & 0x1ff) << 12; |
23 | + env->v7m.cfsr[M_REG_NS] |= R_V7M_CFSR_IBUSERR_MASK; | 23 | /* ISRPENDING - set if any external IRQ is pending */ |
24 | + qemu_log_mask(CPU_LOG_INT, "...with CFSR.IBUSERR\n"); | 24 | if (nvic_isrpending(s)) { |
25 | break; | 25 | val |= (1 << 22); |
26 | case EXCP_DATA_ABORT: | ||
27 | env->v7m.cfsr[M_REG_NS] |= | ||
28 | - (R_V7M_CFSR_IBUSERR_MASK | R_V7M_CFSR_BFARVALID_MASK); | ||
29 | + (R_V7M_CFSR_PRECISERR_MASK | R_V7M_CFSR_BFARVALID_MASK); | ||
30 | env->v7m.bfar = env->exception.vaddress; | ||
31 | qemu_log_mask(CPU_LOG_INT, | ||
32 | - "...with CFSR.IBUSERR and BFAR 0x%x\n", | ||
33 | + "...with CFSR.PRECISERR and BFAR 0x%x\n", | ||
34 | env->v7m.bfar); | ||
35 | break; | ||
36 | } | ||
37 | -- | 26 | -- |
38 | 2.7.4 | 27 | 2.20.1 |
39 | 28 | ||
40 | 29 | diff view generated by jsdifflib |
1 | From: Pranavkumar Sawargaonkar <pranavkumar@linaro.org> | 1 | In Arm v8.1M the VECTPENDING field in the ICSR has new behaviour: if |
---|---|---|---|
2 | the register is accessed NonSecure and the highest priority pending | ||
3 | enabled exception (that would be returned in the VECTPENDING field) | ||
4 | targets Secure, then the VECTPENDING field must read 1 rather than | ||
5 | the exception number of the pending exception. Implement this. | ||
2 | 6 | ||
3 | Now we are able to retrieve the gsi from the INTx pin, let's | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | enable intx_to_irq routing. From that point on, irqfd becomes | 8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
5 | usable along with INTx when assigning a PCIe device. | 9 | Message-id: 20210723162146.5167-7-peter.maydell@linaro.org |
10 | --- | ||
11 | hw/intc/armv7m_nvic.c | 31 ++++++++++++++++++++++++------- | ||
12 | 1 file changed, 24 insertions(+), 7 deletions(-) | ||
6 | 13 | ||
7 | Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org> | 14 | diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c |
8 | Signed-off-by: Tushar Jagad <tushar.jagad@linaro.org> | ||
9 | Signed-off-by: Eric Auger <eric.auger@redhat.com> | ||
10 | Reviewed-by: Andrew Jones <drjones@redhat.com> | ||
11 | Tested-by: Feng Kan <fkan@apm.com> | ||
12 | Message-id: 1505296004-6798-4-git-send-email-eric.auger@redhat.com | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | --- | ||
15 | hw/pci-host/gpex.c | 12 ++++++++++++ | ||
16 | 1 file changed, 12 insertions(+) | ||
17 | |||
18 | diff --git a/hw/pci-host/gpex.c b/hw/pci-host/gpex.c | ||
19 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/hw/pci-host/gpex.c | 16 | --- a/hw/intc/armv7m_nvic.c |
21 | +++ b/hw/pci-host/gpex.c | 17 | +++ b/hw/intc/armv7m_nvic.c |
22 | @@ -XXX,XX +XXX,XX @@ int gpex_set_irq_num(GPEXHost *s, int index, int gsi) | 18 | @@ -XXX,XX +XXX,XX @@ void armv7m_nvic_acknowledge_irq(void *opaque) |
23 | return 0; | 19 | nvic_irq_update(s); |
24 | } | 20 | } |
25 | 21 | ||
26 | +static PCIINTxRoute gpex_route_intx_pin_to_irq(void *opaque, int pin) | 22 | +static bool vectpending_targets_secure(NVICState *s) |
27 | +{ | 23 | +{ |
28 | + PCIINTxRoute route; | 24 | + /* Return true if s->vectpending targets Secure state */ |
29 | + GPEXHost *s = opaque; | 25 | + if (s->vectpending_is_s_banked) { |
30 | + | 26 | + return true; |
31 | + route.mode = PCI_INTX_ENABLED; | 27 | + } |
32 | + route.irq = s->irq_num[pin]; | 28 | + return !exc_is_banked(s->vectpending) && |
33 | + | 29 | + exc_targets_secure(s, s->vectpending); |
34 | + return route; | ||
35 | +} | 30 | +} |
36 | + | 31 | + |
37 | static void gpex_host_realize(DeviceState *dev, Error **errp) | 32 | void armv7m_nvic_get_pending_irq_info(void *opaque, |
33 | int *pirq, bool *ptargets_secure) | ||
38 | { | 34 | { |
39 | PCIHostState *pci = PCI_HOST_BRIDGE(dev); | 35 | @@ -XXX,XX +XXX,XX @@ void armv7m_nvic_get_pending_irq_info(void *opaque, |
40 | @@ -XXX,XX +XXX,XX @@ static void gpex_host_realize(DeviceState *dev, Error **errp) | 36 | |
41 | &s->io_ioport, 0, 4, TYPE_PCIE_BUS); | 37 | assert(pending > ARMV7M_EXCP_RESET && pending < s->num_irq); |
42 | 38 | ||
43 | qdev_set_parent_bus(DEVICE(&s->gpex_root), BUS(pci->bus)); | 39 | - if (s->vectpending_is_s_banked) { |
44 | + pci_bus_set_route_irq_fn(pci->bus, gpex_route_intx_pin_to_irq); | 40 | - targets_secure = true; |
45 | qdev_init_nofail(DEVICE(&s->gpex_root)); | 41 | - } else { |
46 | } | 42 | - targets_secure = !exc_is_banked(pending) && |
47 | 43 | - exc_targets_secure(s, pending); | |
44 | - } | ||
45 | + targets_secure = vectpending_targets_secure(s); | ||
46 | |||
47 | trace_nvic_get_pending_irq_info(pending, targets_secure); | ||
48 | |||
49 | @@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs) | ||
50 | /* VECTACTIVE */ | ||
51 | val = cpu->env.v7m.exception; | ||
52 | /* VECTPENDING */ | ||
53 | - val |= (s->vectpending & 0x1ff) << 12; | ||
54 | + if (s->vectpending) { | ||
55 | + /* | ||
56 | + * From v8.1M VECTPENDING must read as 1 if accessed as | ||
57 | + * NonSecure and the highest priority pending and enabled | ||
58 | + * exception targets Secure. | ||
59 | + */ | ||
60 | + int vp = s->vectpending; | ||
61 | + if (!attrs.secure && arm_feature(&cpu->env, ARM_FEATURE_V8_1M) && | ||
62 | + vectpending_targets_secure(s)) { | ||
63 | + vp = 1; | ||
64 | + } | ||
65 | + val |= (vp & 0x1ff) << 12; | ||
66 | + } | ||
67 | /* ISRPENDING - set if any external IRQ is pending */ | ||
68 | if (nvic_isrpending(s)) { | ||
69 | val |= (1 << 22); | ||
48 | -- | 70 | -- |
49 | 2.7.4 | 71 | 2.20.1 |
50 | 72 | ||
51 | 73 | diff view generated by jsdifflib |
1 | From: Pranavkumar Sawargaonkar <pranavkumar@linaro.org> | 1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> |
---|---|---|---|
2 | 2 | ||
3 | To implement INTx to gsi routing we need to pass the gpex host | 3 | Missed in commit f3478392 "docs: Move deprecation, build |
4 | bridge the gsi associated to each INTx index. Let's introduce | 4 | and license info out of system/" |
5 | irq_num array and gpex_set_irq_num setter function. | ||
6 | 5 | ||
7 | Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org> | 6 | Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> |
8 | Signed-off-by: Tushar Jagad <tushar.jagad@linaro.org> | 7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Signed-off-by: Eric Auger <eric.auger@redhat.com> | 8 | Message-id: 20210723065828.1336760-1-maozhongyi@cmss.chinamobile.com |
10 | Tested-by: Feng Kan <fkan@apm.com> | ||
11 | Reviewed-by: Andrew Jones <drjones@redhat.com> | ||
12 | Message-id: 1505296004-6798-2-git-send-email-eric.auger@redhat.com | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | --- | 10 | --- |
15 | include/hw/pci-host/gpex.h | 3 +++ | 11 | configure | 2 +- |
16 | hw/pci-host/gpex.c | 10 ++++++++++ | 12 | target/i386/cpu.c | 2 +- |
17 | 2 files changed, 13 insertions(+) | 13 | MAINTAINERS | 2 +- |
14 | 3 files changed, 3 insertions(+), 3 deletions(-) | ||
18 | 15 | ||
19 | diff --git a/include/hw/pci-host/gpex.h b/include/hw/pci-host/gpex.h | 16 | diff --git a/configure b/configure |
17 | index XXXXXXX..XXXXXXX 100755 | ||
18 | --- a/configure | ||
19 | +++ b/configure | ||
20 | @@ -XXX,XX +XXX,XX @@ fi | ||
21 | |||
22 | if test -n "${deprecated_features}"; then | ||
23 | echo "Warning, deprecated features enabled." | ||
24 | - echo "Please see docs/system/deprecated.rst" | ||
25 | + echo "Please see docs/about/deprecated.rst" | ||
26 | echo " features: ${deprecated_features}" | ||
27 | fi | ||
28 | |||
29 | diff --git a/target/i386/cpu.c b/target/i386/cpu.c | ||
20 | index XXXXXXX..XXXXXXX 100644 | 30 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/include/hw/pci-host/gpex.h | 31 | --- a/target/i386/cpu.c |
22 | +++ b/include/hw/pci-host/gpex.h | 32 | +++ b/target/i386/cpu.c |
23 | @@ -XXX,XX +XXX,XX @@ typedef struct GPEXHost { | 33 | @@ -XXX,XX +XXX,XX @@ static const X86CPUDefinition builtin_x86_defs[] = { |
24 | MemoryRegion io_ioport; | 34 | * none", but this is just for compatibility while libvirt isn't |
25 | MemoryRegion io_mmio; | 35 | * adapted to resolve CPU model versions before creating VMs. |
26 | qemu_irq irq[GPEX_NUM_IRQS]; | 36 | * See "Runnability guarantee of CPU models" at |
27 | + int irq_num[GPEX_NUM_IRQS]; | 37 | - * docs/system/deprecated.rst. |
28 | } GPEXHost; | 38 | + * docs/about/deprecated.rst. |
29 | 39 | */ | |
30 | +int gpex_set_irq_num(GPEXHost *s, int index, int gsi); | 40 | X86CPUVersion default_cpu_version = 1; |
31 | + | 41 | |
32 | #endif /* HW_GPEX_H */ | 42 | diff --git a/MAINTAINERS b/MAINTAINERS |
33 | diff --git a/hw/pci-host/gpex.c b/hw/pci-host/gpex.c | ||
34 | index XXXXXXX..XXXXXXX 100644 | 43 | index XXXXXXX..XXXXXXX 100644 |
35 | --- a/hw/pci-host/gpex.c | 44 | --- a/MAINTAINERS |
36 | +++ b/hw/pci-host/gpex.c | 45 | +++ b/MAINTAINERS |
37 | @@ -XXX,XX +XXX,XX @@ static void gpex_set_irq(void *opaque, int irq_num, int level) | 46 | @@ -XXX,XX +XXX,XX @@ F: contrib/gitdm/* |
38 | qemu_set_irq(s->irq[irq_num], level); | 47 | |
39 | } | 48 | Incompatible changes |
40 | 49 | R: libvir-list@redhat.com | |
41 | +int gpex_set_irq_num(GPEXHost *s, int index, int gsi) | 50 | -F: docs/system/deprecated.rst |
42 | +{ | 51 | +F: docs/about/deprecated.rst |
43 | + if (index >= GPEX_NUM_IRQS) { | 52 | |
44 | + return -EINVAL; | 53 | Build System |
45 | + } | 54 | ------------ |
46 | + | ||
47 | + s->irq_num[index] = gsi; | ||
48 | + return 0; | ||
49 | +} | ||
50 | + | ||
51 | static void gpex_host_realize(DeviceState *dev, Error **errp) | ||
52 | { | ||
53 | PCIHostState *pci = PCI_HOST_BRIDGE(dev); | ||
54 | -- | 55 | -- |
55 | 2.7.4 | 56 | 2.20.1 |
56 | 57 | ||
57 | 58 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Instead of copying addr to a local temp, reuse the value (which we | 3 | Currently, our only caller is sve_zcr_len_for_el, which has |
4 | have just compared as equal) already saved in cpu_exclusive_addr. | 4 | already masked the length extracted from ZCR_ELx, so the |
5 | masking done here is a nop. But we will shortly have uses | ||
6 | from other locations, where the length will be unmasked. | ||
7 | |||
8 | Saturate the length to ARM_MAX_VQ instead of truncating to | ||
9 | the low 4 bits. | ||
5 | 10 | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 11 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Reviewed-by: Alistair Francis <alistair.francis@xilinx.com> | 12 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Message-id: 20170908163859.29820-1-richard.henderson@linaro.org | 13 | Message-id: 20210723203344.968563-2-richard.henderson@linaro.org |
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 15 | --- |
11 | target/arm/translate-a64.c | 26 +++++++++----------------- | 16 | target/arm/helper.c | 4 +++- |
12 | 1 file changed, 9 insertions(+), 17 deletions(-) | 17 | 1 file changed, 3 insertions(+), 1 deletion(-) |
13 | 18 | ||
14 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 19 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
15 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/translate-a64.c | 21 | --- a/target/arm/helper.c |
17 | +++ b/target/arm/translate-a64.c | 22 | +++ b/target/arm/helper.c |
18 | @@ -XXX,XX +XXX,XX @@ static void gen_load_exclusive(DisasContext *s, int rt, int rt2, | 23 | @@ -XXX,XX +XXX,XX @@ static uint32_t sve_zcr_get_valid_len(ARMCPU *cpu, uint32_t start_len) |
19 | } | ||
20 | |||
21 | static void gen_store_exclusive(DisasContext *s, int rd, int rt, int rt2, | ||
22 | - TCGv_i64 inaddr, int size, int is_pair) | ||
23 | + TCGv_i64 addr, int size, int is_pair) | ||
24 | { | 24 | { |
25 | /* if (env->exclusive_addr == addr && env->exclusive_val == [addr] | 25 | uint32_t end_len; |
26 | * && (!is_pair || env->exclusive_high == [addr + datasize])) { | 26 | |
27 | @@ -XXX,XX +XXX,XX @@ static void gen_store_exclusive(DisasContext *s, int rd, int rt, int rt2, | 27 | - end_len = start_len &= 0xf; |
28 | */ | 28 | + start_len = MIN(start_len, ARM_MAX_VQ - 1); |
29 | TCGLabel *fail_label = gen_new_label(); | 29 | + end_len = start_len; |
30 | TCGLabel *done_label = gen_new_label(); | 30 | + |
31 | - TCGv_i64 addr = tcg_temp_local_new_i64(); | 31 | if (!test_bit(start_len, cpu->sve_vq_map)) { |
32 | TCGv_i64 tmp; | 32 | end_len = find_last_bit(cpu->sve_vq_map, start_len); |
33 | 33 | assert(end_len < start_len); | |
34 | - /* Copy input into a local temp so it is not trashed when the | ||
35 | - * basic block ends at the branch insn. | ||
36 | - */ | ||
37 | - tcg_gen_mov_i64(addr, inaddr); | ||
38 | tcg_gen_brcond_i64(TCG_COND_NE, addr, cpu_exclusive_addr, fail_label); | ||
39 | |||
40 | tmp = tcg_temp_new_i64(); | ||
41 | @@ -XXX,XX +XXX,XX @@ static void gen_store_exclusive(DisasContext *s, int rd, int rt, int rt2, | ||
42 | } else { | ||
43 | tcg_gen_concat32_i64(tmp, cpu_reg(s, rt2), cpu_reg(s, rt)); | ||
44 | } | ||
45 | - tcg_gen_atomic_cmpxchg_i64(tmp, addr, cpu_exclusive_val, tmp, | ||
46 | + tcg_gen_atomic_cmpxchg_i64(tmp, cpu_exclusive_addr, | ||
47 | + cpu_exclusive_val, tmp, | ||
48 | get_mem_index(s), | ||
49 | MO_64 | MO_ALIGN | s->be_data); | ||
50 | tcg_gen_setcond_i64(TCG_COND_NE, tmp, tmp, cpu_exclusive_val); | ||
51 | } else if (s->be_data == MO_LE) { | ||
52 | - gen_helper_paired_cmpxchg64_le(tmp, cpu_env, addr, cpu_reg(s, rt), | ||
53 | - cpu_reg(s, rt2)); | ||
54 | + gen_helper_paired_cmpxchg64_le(tmp, cpu_env, cpu_exclusive_addr, | ||
55 | + cpu_reg(s, rt), cpu_reg(s, rt2)); | ||
56 | } else { | ||
57 | - gen_helper_paired_cmpxchg64_be(tmp, cpu_env, addr, cpu_reg(s, rt), | ||
58 | - cpu_reg(s, rt2)); | ||
59 | + gen_helper_paired_cmpxchg64_be(tmp, cpu_env, cpu_exclusive_addr, | ||
60 | + cpu_reg(s, rt), cpu_reg(s, rt2)); | ||
61 | } | ||
62 | } else { | ||
63 | - TCGv_i64 val = cpu_reg(s, rt); | ||
64 | - tcg_gen_atomic_cmpxchg_i64(tmp, addr, cpu_exclusive_val, val, | ||
65 | - get_mem_index(s), | ||
66 | + tcg_gen_atomic_cmpxchg_i64(tmp, cpu_exclusive_addr, cpu_exclusive_val, | ||
67 | + cpu_reg(s, rt), get_mem_index(s), | ||
68 | size | MO_ALIGN | s->be_data); | ||
69 | tcg_gen_setcond_i64(TCG_COND_NE, tmp, tmp, cpu_exclusive_val); | ||
70 | } | ||
71 | - | ||
72 | - tcg_temp_free_i64(addr); | ||
73 | - | ||
74 | tcg_gen_mov_i64(cpu_reg(s, rd), tmp); | ||
75 | tcg_temp_free_i64(tmp); | ||
76 | tcg_gen_br(done_label); | ||
77 | -- | 34 | -- |
78 | 2.7.4 | 35 | 2.20.1 |
79 | 36 | ||
80 | 37 | diff view generated by jsdifflib |
1 | For M profile we must clear the exclusive monitor on reset, exception | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | entry and exception exit. We weren't doing any of these things; fix | ||
3 | this bug. | ||
4 | 2 | ||
3 | Rename from sve_zcr_get_valid_len and make accessible | ||
4 | from outside of helper.c. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Message-id: 20210723203344.968563-3-richard.henderson@linaro.org | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Reviewed-by: Alistair Francis <alistair.francis@xilinx.com> | ||
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 1505137930-13255-3-git-send-email-peter.maydell@linaro.org | ||
9 | --- | 10 | --- |
10 | target/arm/internals.h | 10 ++++++++++ | 11 | target/arm/internals.h | 10 ++++++++++ |
11 | target/arm/cpu.c | 6 ++++++ | 12 | target/arm/helper.c | 4 ++-- |
12 | target/arm/helper.c | 2 ++ | 13 | 2 files changed, 12 insertions(+), 2 deletions(-) |
13 | target/arm/op_helper.c | 2 +- | ||
14 | 4 files changed, 19 insertions(+), 1 deletion(-) | ||
15 | 14 | ||
16 | diff --git a/target/arm/internals.h b/target/arm/internals.h | 15 | diff --git a/target/arm/internals.h b/target/arm/internals.h |
17 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/internals.h | 17 | --- a/target/arm/internals.h |
19 | +++ b/target/arm/internals.h | 18 | +++ b/target/arm/internals.h |
20 | @@ -XXX,XX +XXX,XX @@ void arm_handle_psci_call(ARMCPU *cpu); | 19 | @@ -XXX,XX +XXX,XX @@ void arm_translate_init(void); |
21 | #endif | 20 | void arm_cpu_synchronize_from_tb(CPUState *cs, const TranslationBlock *tb); |
22 | 21 | #endif /* CONFIG_TCG */ | |
23 | /** | 22 | |
24 | + * arm_clear_exclusive: clear the exclusive monitor | 23 | +/** |
25 | + * @env: CPU env | 24 | + * aarch64_sve_zcr_get_valid_len: |
26 | + * Clear the CPU's exclusive monitor, like the guest CLREX instruction. | 25 | + * @cpu: cpu context |
26 | + * @start_len: maximum len to consider | ||
27 | + * | ||
28 | + * Return the maximum supported sve vector length <= @start_len. | ||
29 | + * Note that both @start_len and the return value are in units | ||
30 | + * of ZCR_ELx.LEN, so the vector bit length is (x + 1) * 128. | ||
27 | + */ | 31 | + */ |
28 | +static inline void arm_clear_exclusive(CPUARMState *env) | 32 | +uint32_t aarch64_sve_zcr_get_valid_len(ARMCPU *cpu, uint32_t start_len); |
29 | +{ | 33 | |
30 | + env->exclusive_addr = -1; | 34 | enum arm_fprounding { |
31 | +} | 35 | FPROUNDING_TIEEVEN, |
32 | + | ||
33 | +/** | ||
34 | * ARMMMUFaultInfo: Information describing an ARM MMU Fault | ||
35 | * @s2addr: Address that caused a fault at stage 2 | ||
36 | * @stage2: True if we faulted at stage 2 | ||
37 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | ||
38 | index XXXXXXX..XXXXXXX 100644 | ||
39 | --- a/target/arm/cpu.c | ||
40 | +++ b/target/arm/cpu.c | ||
41 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset(CPUState *s) | ||
42 | env->regs[15] = 0xFFFF0000; | ||
43 | } | ||
44 | |||
45 | + /* M profile requires that reset clears the exclusive monitor; | ||
46 | + * A profile does not, but clearing it makes more sense than having it | ||
47 | + * set with an exclusive access on address zero. | ||
48 | + */ | ||
49 | + arm_clear_exclusive(env); | ||
50 | + | ||
51 | env->vfp.xregs[ARM_VFP_FPEXC] = 0; | ||
52 | #endif | ||
53 | |||
54 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 36 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
55 | index XXXXXXX..XXXXXXX 100644 | 37 | index XXXXXXX..XXXXXXX 100644 |
56 | --- a/target/arm/helper.c | 38 | --- a/target/arm/helper.c |
57 | +++ b/target/arm/helper.c | 39 | +++ b/target/arm/helper.c |
58 | @@ -XXX,XX +XXX,XX @@ static void v7m_exception_taken(ARMCPU *cpu, uint32_t lr) | 40 | @@ -XXX,XX +XXX,XX @@ int sve_exception_el(CPUARMState *env, int el) |
59 | 41 | return 0; | |
60 | armv7m_nvic_acknowledge_irq(env->nvic); | 42 | } |
61 | switch_v7m_sp(env, 0); | 43 | |
62 | + arm_clear_exclusive(env); | 44 | -static uint32_t sve_zcr_get_valid_len(ARMCPU *cpu, uint32_t start_len) |
63 | /* Clear IT bits */ | 45 | +uint32_t aarch64_sve_zcr_get_valid_len(ARMCPU *cpu, uint32_t start_len) |
64 | env->condexec_bits = 0; | 46 | { |
65 | env->regs[14] = lr; | 47 | uint32_t end_len; |
66 | @@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu) | 48 | |
49 | @@ -XXX,XX +XXX,XX @@ uint32_t sve_zcr_len_for_el(CPUARMState *env, int el) | ||
50 | zcr_len = MIN(zcr_len, 0xf & (uint32_t)env->vfp.zcr_el[3]); | ||
67 | } | 51 | } |
68 | 52 | ||
69 | /* Otherwise, we have a successful exception exit. */ | 53 | - return sve_zcr_get_valid_len(cpu, zcr_len); |
70 | + arm_clear_exclusive(env); | 54 | + return aarch64_sve_zcr_get_valid_len(cpu, zcr_len); |
71 | qemu_log_mask(CPU_LOG_INT, "...successful exception return\n"); | ||
72 | } | 55 | } |
73 | 56 | ||
74 | diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c | 57 | static void zcr_write(CPUARMState *env, const ARMCPRegInfo *ri, |
75 | index XXXXXXX..XXXXXXX 100644 | ||
76 | --- a/target/arm/op_helper.c | ||
77 | +++ b/target/arm/op_helper.c | ||
78 | @@ -XXX,XX +XXX,XX @@ void HELPER(exception_return)(CPUARMState *env) | ||
79 | |||
80 | aarch64_save_sp(env, cur_el); | ||
81 | |||
82 | - env->exclusive_addr = -1; | ||
83 | + arm_clear_exclusive(env); | ||
84 | |||
85 | /* We must squash the PSTATE.SS bit to zero unless both of the | ||
86 | * following hold: | ||
87 | -- | 58 | -- |
88 | 2.7.4 | 59 | 2.20.1 |
89 | 60 | ||
90 | 61 | diff view generated by jsdifflib |
1 | From: Alistair Francis <alistair.francis@xilinx.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Add a machine level virtualization property. This defaults to false and can be | 3 | Mirror the behavour of /proc/sys/abi/sve_default_vector_length |
4 | set to true using this machine command line argument: | 4 | under the real linux kernel. We have no way of passing along |
5 | -machine xlnx-zcu102,virtualization=on | 5 | a real default across exec like the kernel can, but this is a |
6 | decent way of adjusting the startup vector length of a process. | ||
6 | 7 | ||
7 | This follows what the ARM virt machine does. | 8 | Resolves: https://gitlab.com/qemu-project/qemu/-/issues/482 |
8 | 9 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | |
9 | This property only applies to the ZCU102 machine. The EP108 machine does | 10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
10 | not have this property. | 11 | Message-id: 20210723203344.968563-4-richard.henderson@linaro.org |
11 | 12 | [PMM: tweaked docs formatting, document -1 special-case, | |
12 | Signed-off-by: Alistair Francis <alistair.francis@xilinx.com> | 13 | added fixup patch from RTH mentioning QEMU's maximum veclen.] |
13 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
15 | --- | 15 | --- |
16 | include/hw/arm/xlnx-zynqmp.h | 2 ++ | 16 | docs/system/arm/cpu-features.rst | 15 ++++++++ |
17 | hw/arm/xlnx-zcu102.c | 30 +++++++++++++++++++++++++++++- | 17 | target/arm/cpu.h | 5 +++ |
18 | hw/arm/xlnx-zynqmp.c | 3 ++- | 18 | target/arm/cpu.c | 14 ++++++-- |
19 | 3 files changed, 33 insertions(+), 2 deletions(-) | 19 | target/arm/cpu64.c | 60 ++++++++++++++++++++++++++++++++ |
20 | 4 files changed, 92 insertions(+), 2 deletions(-) | ||
20 | 21 | ||
21 | diff --git a/include/hw/arm/xlnx-zynqmp.h b/include/hw/arm/xlnx-zynqmp.h | 22 | diff --git a/docs/system/arm/cpu-features.rst b/docs/system/arm/cpu-features.rst |
22 | index XXXXXXX..XXXXXXX 100644 | 23 | index XXXXXXX..XXXXXXX 100644 |
23 | --- a/include/hw/arm/xlnx-zynqmp.h | 24 | --- a/docs/system/arm/cpu-features.rst |
24 | +++ b/include/hw/arm/xlnx-zynqmp.h | 25 | +++ b/docs/system/arm/cpu-features.rst |
25 | @@ -XXX,XX +XXX,XX @@ typedef struct XlnxZynqMPState { | 26 | @@ -XXX,XX +XXX,XX @@ verbose command lines. However, the recommended way to select vector |
26 | 27 | lengths is to explicitly enable each desired length. Therefore only | |
27 | /* Has the ARM Security extensions? */ | 28 | example's (1), (4), and (6) exhibit recommended uses of the properties. |
28 | bool secure; | 29 | |
29 | + /* Has the ARM Virtualization extensions? */ | 30 | +SVE User-mode Default Vector Length Property |
30 | + bool virt; | 31 | +-------------------------------------------- |
31 | /* Has the RPU subsystem? */ | 32 | + |
32 | bool has_rpu; | 33 | +For qemu-aarch64, the cpu property ``sve-default-vector-length=N`` is |
33 | } XlnxZynqMPState; | 34 | +defined to mirror the Linux kernel parameter file |
34 | diff --git a/hw/arm/xlnx-zcu102.c b/hw/arm/xlnx-zcu102.c | 35 | +``/proc/sys/abi/sve_default_vector_length``. The default length, ``N``, |
36 | +is in units of bytes and must be between 16 and 8192. | ||
37 | +If not specified, the default vector length is 64. | ||
38 | + | ||
39 | +If the default length is larger than the maximum vector length enabled, | ||
40 | +the actual vector length will be reduced. Note that the maximum vector | ||
41 | +length supported by QEMU is 256. | ||
42 | + | ||
43 | +If this property is set to ``-1`` then the default vector length | ||
44 | +is set to the maximum possible length. | ||
45 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
35 | index XXXXXXX..XXXXXXX 100644 | 46 | index XXXXXXX..XXXXXXX 100644 |
36 | --- a/hw/arm/xlnx-zcu102.c | 47 | --- a/target/arm/cpu.h |
37 | +++ b/hw/arm/xlnx-zcu102.c | 48 | +++ b/target/arm/cpu.h |
38 | @@ -XXX,XX +XXX,XX @@ typedef struct XlnxZCU102 { | 49 | @@ -XXX,XX +XXX,XX @@ struct ARMCPU { |
39 | MemoryRegion ddr_ram; | 50 | /* Used to set the maximum vector length the cpu will support. */ |
40 | 51 | uint32_t sve_max_vq; | |
41 | bool secure; | 52 | |
42 | + bool virt; | 53 | +#ifdef CONFIG_USER_ONLY |
43 | } XlnxZCU102; | 54 | + /* Used to set the default vector length at process start. */ |
44 | 55 | + uint32_t sve_default_vq; | |
45 | #define TYPE_ZCU102_MACHINE MACHINE_TYPE_NAME("xlnx-zcu102") | 56 | +#endif |
46 | @@ -XXX,XX +XXX,XX @@ static void zcu102_set_secure(Object *obj, bool value, Error **errp) | 57 | + |
47 | s->secure = value; | 58 | /* |
59 | * In sve_vq_map each set bit is a supported vector length of | ||
60 | * (bit-number + 1) * 16 bytes, i.e. each bit number + 1 is the vector | ||
61 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | ||
62 | index XXXXXXX..XXXXXXX 100644 | ||
63 | --- a/target/arm/cpu.c | ||
64 | +++ b/target/arm/cpu.c | ||
65 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset(DeviceState *dev) | ||
66 | env->cp15.cpacr_el1 = deposit64(env->cp15.cpacr_el1, 16, 2, 3); | ||
67 | /* with reasonable vector length */ | ||
68 | if (cpu_isar_feature(aa64_sve, cpu)) { | ||
69 | - env->vfp.zcr_el[1] = MIN(cpu->sve_max_vq - 1, 3); | ||
70 | + env->vfp.zcr_el[1] = | ||
71 | + aarch64_sve_zcr_get_valid_len(cpu, cpu->sve_default_vq - 1); | ||
72 | } | ||
73 | /* | ||
74 | * Enable TBI0 but not TBI1. | ||
75 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_initfn(Object *obj) | ||
76 | QLIST_INIT(&cpu->pre_el_change_hooks); | ||
77 | QLIST_INIT(&cpu->el_change_hooks); | ||
78 | |||
79 | -#ifndef CONFIG_USER_ONLY | ||
80 | +#ifdef CONFIG_USER_ONLY | ||
81 | +# ifdef TARGET_AARCH64 | ||
82 | + /* | ||
83 | + * The linux kernel defaults to 512-bit vectors, when sve is supported. | ||
84 | + * See documentation for /proc/sys/abi/sve_default_vector_length, and | ||
85 | + * our corresponding sve-default-vector-length cpu property. | ||
86 | + */ | ||
87 | + cpu->sve_default_vq = 4; | ||
88 | +# endif | ||
89 | +#else | ||
90 | /* Our inbound IRQ and FIQ lines */ | ||
91 | if (kvm_enabled()) { | ||
92 | /* VIRQ and VFIQ are unused with KVM but we add them to maintain | ||
93 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | ||
94 | index XXXXXXX..XXXXXXX 100644 | ||
95 | --- a/target/arm/cpu64.c | ||
96 | +++ b/target/arm/cpu64.c | ||
97 | @@ -XXX,XX +XXX,XX @@ static void cpu_arm_set_sve(Object *obj, bool value, Error **errp) | ||
98 | cpu->isar.id_aa64pfr0 = t; | ||
48 | } | 99 | } |
49 | 100 | ||
50 | +static bool zcu102_get_virt(Object *obj, Error **errp) | 101 | +#ifdef CONFIG_USER_ONLY |
102 | +/* Mirror linux /proc/sys/abi/sve_default_vector_length. */ | ||
103 | +static void cpu_arm_set_sve_default_vec_len(Object *obj, Visitor *v, | ||
104 | + const char *name, void *opaque, | ||
105 | + Error **errp) | ||
51 | +{ | 106 | +{ |
52 | + XlnxZCU102 *s = ZCU102_MACHINE(obj); | 107 | + ARMCPU *cpu = ARM_CPU(obj); |
108 | + int32_t default_len, default_vq, remainder; | ||
53 | + | 109 | + |
54 | + return s->virt; | 110 | + if (!visit_type_int32(v, name, &default_len, errp)) { |
111 | + return; | ||
112 | + } | ||
113 | + | ||
114 | + /* Undocumented, but the kernel allows -1 to indicate "maximum". */ | ||
115 | + if (default_len == -1) { | ||
116 | + cpu->sve_default_vq = ARM_MAX_VQ; | ||
117 | + return; | ||
118 | + } | ||
119 | + | ||
120 | + default_vq = default_len / 16; | ||
121 | + remainder = default_len % 16; | ||
122 | + | ||
123 | + /* | ||
124 | + * Note that the 512 max comes from include/uapi/asm/sve_context.h | ||
125 | + * and is the maximum architectural width of ZCR_ELx.LEN. | ||
126 | + */ | ||
127 | + if (remainder || default_vq < 1 || default_vq > 512) { | ||
128 | + error_setg(errp, "cannot set sve-default-vector-length"); | ||
129 | + if (remainder) { | ||
130 | + error_append_hint(errp, "Vector length not a multiple of 16\n"); | ||
131 | + } else if (default_vq < 1) { | ||
132 | + error_append_hint(errp, "Vector length smaller than 16\n"); | ||
133 | + } else { | ||
134 | + error_append_hint(errp, "Vector length larger than %d\n", | ||
135 | + 512 * 16); | ||
136 | + } | ||
137 | + return; | ||
138 | + } | ||
139 | + | ||
140 | + cpu->sve_default_vq = default_vq; | ||
55 | +} | 141 | +} |
56 | + | 142 | + |
57 | +static void zcu102_set_virt(Object *obj, bool value, Error **errp) | 143 | +static void cpu_arm_get_sve_default_vec_len(Object *obj, Visitor *v, |
144 | + const char *name, void *opaque, | ||
145 | + Error **errp) | ||
58 | +{ | 146 | +{ |
59 | + XlnxZCU102 *s = ZCU102_MACHINE(obj); | 147 | + ARMCPU *cpu = ARM_CPU(obj); |
148 | + int32_t value = cpu->sve_default_vq * 16; | ||
60 | + | 149 | + |
61 | + s->virt = value; | 150 | + visit_type_int32(v, name, &value, errp); |
62 | +} | 151 | +} |
152 | +#endif | ||
63 | + | 153 | + |
64 | static void xlnx_zynqmp_init(XlnxZCU102 *s, MachineState *machine) | 154 | void aarch64_add_sve_properties(Object *obj) |
65 | { | 155 | { |
66 | int i; | 156 | uint32_t vq; |
67 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_init(XlnxZCU102 *s, MachineState *machine) | 157 | @@ -XXX,XX +XXX,XX @@ void aarch64_add_sve_properties(Object *obj) |
68 | "ddr-ram", &error_abort); | 158 | object_property_add(obj, name, "bool", cpu_arm_get_sve_vq, |
69 | object_property_set_bool(OBJECT(&s->soc), s->secure, "secure", | 159 | cpu_arm_set_sve_vq, NULL, NULL); |
70 | &error_fatal); | 160 | } |
71 | + object_property_set_bool(OBJECT(&s->soc), s->virt, "virtualization", | 161 | + |
72 | + &error_fatal); | 162 | +#ifdef CONFIG_USER_ONLY |
73 | 163 | + /* Mirror linux /proc/sys/abi/sve_default_vector_length. */ | |
74 | object_property_set_bool(OBJECT(&s->soc), true, "realized", &error_fatal); | 164 | + object_property_add(obj, "sve-default-vector-length", "int32", |
75 | 165 | + cpu_arm_get_sve_default_vec_len, | |
76 | @@ -XXX,XX +XXX,XX @@ static void xlnx_ep108_machine_instance_init(Object *obj) | 166 | + cpu_arm_set_sve_default_vec_len, NULL, NULL); |
77 | { | 167 | +#endif |
78 | XlnxZCU102 *s = EP108_MACHINE(obj); | ||
79 | |||
80 | - /* EP108, we don't support setting secure */ | ||
81 | + /* EP108, we don't support setting secure or virt */ | ||
82 | s->secure = false; | ||
83 | + s->virt = false; | ||
84 | } | 168 | } |
85 | 169 | ||
86 | static void xlnx_ep108_machine_class_init(ObjectClass *oc, void *data) | 170 | void arm_cpu_pauth_finalize(ARMCPU *cpu, Error **errp) |
87 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zcu102_machine_instance_init(Object *obj) | ||
88 | "Set on/off to enable/disable the ARM " | ||
89 | "Security Extensions (TrustZone)", | ||
90 | NULL); | ||
91 | + | ||
92 | + /* Default to virt (EL2) being disabled */ | ||
93 | + s->virt = false; | ||
94 | + object_property_add_bool(obj, "virtualization", zcu102_get_virt, | ||
95 | + zcu102_set_virt, NULL); | ||
96 | + object_property_set_description(obj, "virtualization", | ||
97 | + "Set on/off to enable/disable emulating a " | ||
98 | + "guest CPU which implements the ARM " | ||
99 | + "Virtualization Extensions", | ||
100 | + NULL); | ||
101 | } | ||
102 | |||
103 | static void xlnx_zcu102_machine_class_init(ObjectClass *oc, void *data) | ||
104 | diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c | ||
105 | index XXXXXXX..XXXXXXX 100644 | ||
106 | --- a/hw/arm/xlnx-zynqmp.c | ||
107 | +++ b/hw/arm/xlnx-zynqmp.c | ||
108 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) | ||
109 | object_property_set_bool(OBJECT(&s->apu_cpu[i]), | ||
110 | s->secure, "has_el3", NULL); | ||
111 | object_property_set_bool(OBJECT(&s->apu_cpu[i]), | ||
112 | - false, "has_el2", NULL); | ||
113 | + s->virt, "has_el2", NULL); | ||
114 | object_property_set_int(OBJECT(&s->apu_cpu[i]), GIC_BASE_ADDR, | ||
115 | "reset-cbar", &error_abort); | ||
116 | object_property_set_bool(OBJECT(&s->apu_cpu[i]), true, "realized", | ||
117 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) | ||
118 | static Property xlnx_zynqmp_props[] = { | ||
119 | DEFINE_PROP_STRING("boot-cpu", XlnxZynqMPState, boot_cpu), | ||
120 | DEFINE_PROP_BOOL("secure", XlnxZynqMPState, secure, false), | ||
121 | + DEFINE_PROP_BOOL("virtualization", XlnxZynqMPState, virt, false), | ||
122 | DEFINE_PROP_BOOL("has_rpu", XlnxZynqMPState, has_rpu, false), | ||
123 | DEFINE_PROP_LINK("ddr-ram", XlnxZynqMPState, ddr_ram, TYPE_MEMORY_REGION, | ||
124 | MemoryRegion *), | ||
125 | -- | 171 | -- |
126 | 2.7.4 | 172 | 2.20.1 |
127 | 173 | ||
128 | 174 | diff view generated by jsdifflib |
1 | From: Pranavkumar Sawargaonkar <pranavkumar@linaro.org> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | Let's provide the GPEX host bridge with the INTx/gsi mapping. This is | 3 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
4 | needed for INTx/gsi routing. | 4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
5 | 5 | Message-id: 20210726150953.1218690-1-f4bug@amsat.org | |
6 | Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org> | ||
7 | Signed-off-by: Tushar Jagad <tushar.jagad@linaro.org> | ||
8 | Signed-off-by: Eric Auger <eric.auger@redhat.com> | ||
9 | Reviewed-by: Andrew Jones <drjones@redhat.com> | ||
10 | Tested-by: Feng Kan <fkan@apm.com> | ||
11 | Message-id: 1505296004-6798-3-git-send-email-eric.auger@redhat.com | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | --- | 7 | --- |
14 | hw/arm/virt.c | 1 + | 8 | hw/arm/nseries.c | 2 +- |
15 | 1 file changed, 1 insertion(+) | 9 | 1 file changed, 1 insertion(+), 1 deletion(-) |
16 | 10 | ||
17 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | 11 | diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c |
18 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/hw/arm/virt.c | 13 | --- a/hw/arm/nseries.c |
20 | +++ b/hw/arm/virt.c | 14 | +++ b/hw/arm/nseries.c |
21 | @@ -XXX,XX +XXX,XX @@ static void create_pcie(const VirtMachineState *vms, qemu_irq *pic) | 15 | @@ -XXX,XX +XXX,XX @@ static uint32_t mipid_txrx(void *opaque, uint32_t cmd, int len) |
22 | 16 | default: | |
23 | for (i = 0; i < GPEX_NUM_IRQS; i++) { | 17 | bad_cmd: |
24 | sysbus_connect_irq(SYS_BUS_DEVICE(dev), i, pic[irq + i]); | 18 | qemu_log_mask(LOG_GUEST_ERROR, |
25 | + gpex_set_irq_num(GPEX_HOST(dev), i, irq + i); | 19 | - "%s: unknown command %02x\n", __func__, s->cmd); |
20 | + "%s: unknown command 0x%02x\n", __func__, s->cmd); | ||
21 | break; | ||
26 | } | 22 | } |
27 | 23 | ||
28 | pci = PCI_HOST_BRIDGE(dev); | ||
29 | -- | 24 | -- |
30 | 2.7.4 | 25 | 2.20.1 |
31 | 26 | ||
32 | 27 | diff view generated by jsdifflib |
1 | From: Alistair Francis <alistair.francis@xilinx.com> | 1 | From: Joel Stanley <joel@jms.id.au> |
---|---|---|---|
2 | 2 | ||
3 | The EP108 is a early access development board. Now that silicon is in | 3 | The macro used to calculate the maximum memory size of the MMIO region |
4 | production people have access to the ZCU102. Let's rename the internal | 4 | had a mistake, causing all GPIO models to create a mapping of 0x9D8. |
5 | QEMU files and variables to use the ZCU102. | 5 | The intent was to have it be 0x9D8 - 0x800. |
6 | 6 | ||
7 | There is no functional change here as the EP108 is still a valid board | 7 | This extra size doesn't matter on ast2400 and ast2500, which have a 4KB |
8 | option. | 8 | region set aside for the GPIO controller. |
9 | 9 | ||
10 | Signed-off-by: Alistair Francis <alistair.francis@xilinx.com> | 10 | On the ast2600 the 3.3V and 1.8V GPIO controllers are 2KB apart, so the |
11 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 11 | regions would overlap. Worse was the 1.8V controller would map over the |
12 | top of the following peripheral, which happens to be the RTC. | ||
13 | |||
14 | The mmio region used by each device is a maximum of 2KB, so avoid the | ||
15 | calculations and hard code this as the maximum. | ||
16 | |||
17 | Fixes: 36d737ee82b2 ("hw/gpio: Add in AST2600 specific implementation") | ||
18 | Signed-off-by: Joel Stanley <joel@jms.id.au> | ||
19 | Reviewed-by: Rashmica Gupta <rashmica.g@gmail.com> | ||
20 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | ||
21 | Message-id: 20210713065854.134634-2-joel@jms.id.au | ||
22 | [PMM: fix autocorrect error in commit message] | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 23 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | --- | 24 | --- |
14 | hw/arm/Makefile.objs | 2 +- | 25 | hw/gpio/aspeed_gpio.c | 3 +-- |
15 | hw/arm/{xlnx-ep108.c => xlnx-zcu102.c} | 30 +++++++++++++++--------------- | 26 | 1 file changed, 1 insertion(+), 2 deletions(-) |
16 | 2 files changed, 16 insertions(+), 16 deletions(-) | ||
17 | rename hw/arm/{xlnx-ep108.c => xlnx-zcu102.c} (85%) | ||
18 | 27 | ||
19 | diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs | 28 | diff --git a/hw/gpio/aspeed_gpio.c b/hw/gpio/aspeed_gpio.c |
20 | index XXXXXXX..XXXXXXX 100644 | 29 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/hw/arm/Makefile.objs | 30 | --- a/hw/gpio/aspeed_gpio.c |
22 | +++ b/hw/arm/Makefile.objs | 31 | +++ b/hw/gpio/aspeed_gpio.c |
23 | @@ -XXX,XX +XXX,XX @@ obj-y += omap1.o omap2.o strongarm.o | ||
24 | obj-$(CONFIG_ALLWINNER_A10) += allwinner-a10.o cubieboard.o | ||
25 | obj-$(CONFIG_RASPI) += bcm2835_peripherals.o bcm2836.o raspi.o | ||
26 | obj-$(CONFIG_STM32F205_SOC) += stm32f205_soc.o | ||
27 | -obj-$(CONFIG_XLNX_ZYNQMP) += xlnx-zynqmp.o xlnx-ep108.o | ||
28 | +obj-$(CONFIG_XLNX_ZYNQMP) += xlnx-zynqmp.o xlnx-zcu102.o | ||
29 | obj-$(CONFIG_FSL_IMX25) += fsl-imx25.o imx25_pdk.o | ||
30 | obj-$(CONFIG_FSL_IMX31) += fsl-imx31.o kzm.o | ||
31 | obj-$(CONFIG_FSL_IMX6) += fsl-imx6.o sabrelite.o | ||
32 | diff --git a/hw/arm/xlnx-ep108.c b/hw/arm/xlnx-zcu102.c | ||
33 | similarity index 85% | ||
34 | rename from hw/arm/xlnx-ep108.c | ||
35 | rename to hw/arm/xlnx-zcu102.c | ||
36 | index XXXXXXX..XXXXXXX 100644 | ||
37 | --- a/hw/arm/xlnx-ep108.c | ||
38 | +++ b/hw/arm/xlnx-zcu102.c | ||
39 | @@ -XXX,XX +XXX,XX @@ | 32 | @@ -XXX,XX +XXX,XX @@ |
40 | /* | 33 | #define GPIO_1_8V_MEM_SIZE 0x9D8 |
41 | - * Xilinx ZynqMP EP108 board | 34 | #define GPIO_1_8V_REG_ARRAY_SIZE ((GPIO_1_8V_MEM_SIZE - \ |
42 | + * Xilinx ZynqMP ZCU102 board | 35 | GPIO_1_8V_REG_OFFSET) >> 2) |
43 | * | 36 | -#define GPIO_MAX_MEM_SIZE MAX(GPIO_3_6V_MEM_SIZE, GPIO_1_8V_MEM_SIZE) |
44 | * Copyright (C) 2015 Xilinx Inc | 37 | |
45 | * Written by Peter Crosthwaite <peter.crosthwaite@xilinx.com> | 38 | static int aspeed_evaluate_irq(GPIOSets *regs, int gpio_prev_high, int gpio) |
46 | @@ -XXX,XX +XXX,XX @@ | ||
47 | #include "exec/address-spaces.h" | ||
48 | #include "qemu/log.h" | ||
49 | |||
50 | -typedef struct XlnxEP108 { | ||
51 | +typedef struct XlnxZCU102 { | ||
52 | XlnxZynqMPState soc; | ||
53 | MemoryRegion ddr_ram; | ||
54 | -} XlnxEP108; | ||
55 | +} XlnxZCU102; | ||
56 | |||
57 | -static struct arm_boot_info xlnx_ep108_binfo; | ||
58 | +static struct arm_boot_info xlnx_zcu102_binfo; | ||
59 | |||
60 | -static void xlnx_ep108_init(MachineState *machine) | ||
61 | +static void xlnx_zcu102_init(MachineState *machine) | ||
62 | { | 39 | { |
63 | - XlnxEP108 *s = g_new0(XlnxEP108, 1); | 40 | @@ -XXX,XX +XXX,XX @@ static void aspeed_gpio_realize(DeviceState *dev, Error **errp) |
64 | + XlnxZCU102 *s = g_new0(XlnxZCU102, 1); | ||
65 | int i; | ||
66 | uint64_t ram_size = machine->ram_size; | ||
67 | |||
68 | @@ -XXX,XX +XXX,XX @@ static void xlnx_ep108_init(MachineState *machine) | ||
69 | } | 41 | } |
70 | 42 | ||
71 | if (ram_size < 0x08000000) { | 43 | memory_region_init_io(&s->iomem, OBJECT(s), &aspeed_gpio_ops, s, |
72 | - qemu_log("WARNING: RAM size 0x%" PRIx64 " is small for EP108", | 44 | - TYPE_ASPEED_GPIO, GPIO_MAX_MEM_SIZE); |
73 | + qemu_log("WARNING: RAM size 0x%" PRIx64 " is small for ZCU102", | 45 | + TYPE_ASPEED_GPIO, 0x800); |
74 | ram_size); | 46 | |
75 | } | 47 | sysbus_init_mmio(sbd, &s->iomem); |
76 | |||
77 | @@ -XXX,XX +XXX,XX @@ static void xlnx_ep108_init(MachineState *machine) | ||
78 | |||
79 | /* TODO create and connect IDE devices for ide_drive_get() */ | ||
80 | |||
81 | - xlnx_ep108_binfo.ram_size = ram_size; | ||
82 | - xlnx_ep108_binfo.kernel_filename = machine->kernel_filename; | ||
83 | - xlnx_ep108_binfo.kernel_cmdline = machine->kernel_cmdline; | ||
84 | - xlnx_ep108_binfo.initrd_filename = machine->initrd_filename; | ||
85 | - xlnx_ep108_binfo.loader_start = 0; | ||
86 | - arm_load_kernel(s->soc.boot_cpu_ptr, &xlnx_ep108_binfo); | ||
87 | + xlnx_zcu102_binfo.ram_size = ram_size; | ||
88 | + xlnx_zcu102_binfo.kernel_filename = machine->kernel_filename; | ||
89 | + xlnx_zcu102_binfo.kernel_cmdline = machine->kernel_cmdline; | ||
90 | + xlnx_zcu102_binfo.initrd_filename = machine->initrd_filename; | ||
91 | + xlnx_zcu102_binfo.loader_start = 0; | ||
92 | + arm_load_kernel(s->soc.boot_cpu_ptr, &xlnx_zcu102_binfo); | ||
93 | } | 48 | } |
94 | |||
95 | static void xlnx_ep108_machine_init(MachineClass *mc) | ||
96 | { | ||
97 | mc->desc = "Xilinx ZynqMP EP108 board"; | ||
98 | - mc->init = xlnx_ep108_init; | ||
99 | + mc->init = xlnx_zcu102_init; | ||
100 | mc->block_default_type = IF_IDE; | ||
101 | mc->units_per_default_bus = 1; | ||
102 | mc->ignore_memory_transaction_failures = true; | ||
103 | @@ -XXX,XX +XXX,XX @@ DEFINE_MACHINE("xlnx-ep108", xlnx_ep108_machine_init) | ||
104 | static void xlnx_zcu102_machine_init(MachineClass *mc) | ||
105 | { | ||
106 | mc->desc = "Xilinx ZynqMP ZCU102 board"; | ||
107 | - mc->init = xlnx_ep108_init; | ||
108 | + mc->init = xlnx_zcu102_init; | ||
109 | mc->block_default_type = IF_IDE; | ||
110 | mc->units_per_default_bus = 1; | ||
111 | mc->ignore_memory_transaction_failures = true; | ||
112 | -- | 49 | -- |
113 | 2.7.4 | 50 | 2.20.1 |
114 | 51 | ||
115 | 52 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Alistair Francis <alistair.francis@xilinx.com> | ||
2 | 1 | ||
3 | In preperation for future work let's manually create the Xilnx machines. | ||
4 | This will allow us to set properties for the machines in the future. | ||
5 | |||
6 | Signed-off-by: Alistair Francis <alistair.francis@xilinx.com> | ||
7 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | hw/arm/xlnx-zcu102.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++----- | ||
11 | 1 file changed, 67 insertions(+), 7 deletions(-) | ||
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 @@ | ||
18 | #include "qemu/log.h" | ||
19 | |||
20 | typedef struct XlnxZCU102 { | ||
21 | + MachineState parent_obj; | ||
22 | + | ||
23 | XlnxZynqMPState soc; | ||
24 | MemoryRegion ddr_ram; | ||
25 | } XlnxZCU102; | ||
26 | |||
27 | +#define TYPE_ZCU102_MACHINE MACHINE_TYPE_NAME("xlnx-zcu102") | ||
28 | +#define ZCU102_MACHINE(obj) \ | ||
29 | + OBJECT_CHECK(XlnxZCU102, (obj), TYPE_ZCU102_MACHINE) | ||
30 | + | ||
31 | +#define TYPE_EP108_MACHINE MACHINE_TYPE_NAME("xlnx-ep108") | ||
32 | +#define EP108_MACHINE(obj) \ | ||
33 | + OBJECT_CHECK(XlnxZCU102, (obj), TYPE_EP108_MACHINE) | ||
34 | + | ||
35 | static struct arm_boot_info xlnx_zcu102_binfo; | ||
36 | |||
37 | -static void xlnx_zcu102_init(MachineState *machine) | ||
38 | +static void xlnx_zynqmp_init(XlnxZCU102 *s, MachineState *machine) | ||
39 | { | ||
40 | - XlnxZCU102 *s = g_new0(XlnxZCU102, 1); | ||
41 | int i; | ||
42 | uint64_t ram_size = machine->ram_size; | ||
43 | |||
44 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zcu102_init(MachineState *machine) | ||
45 | arm_load_kernel(s->soc.boot_cpu_ptr, &xlnx_zcu102_binfo); | ||
46 | } | ||
47 | |||
48 | -static void xlnx_ep108_machine_init(MachineClass *mc) | ||
49 | +static void xlnx_ep108_init(MachineState *machine) | ||
50 | +{ | ||
51 | + XlnxZCU102 *s = EP108_MACHINE(machine); | ||
52 | + | ||
53 | + xlnx_zynqmp_init(s, machine); | ||
54 | +} | ||
55 | + | ||
56 | +static void xlnx_ep108_machine_instance_init(Object *obj) | ||
57 | { | ||
58 | +} | ||
59 | + | ||
60 | +static void xlnx_ep108_machine_class_init(ObjectClass *oc, void *data) | ||
61 | +{ | ||
62 | + MachineClass *mc = MACHINE_CLASS(oc); | ||
63 | + | ||
64 | mc->desc = "Xilinx ZynqMP EP108 board"; | ||
65 | - mc->init = xlnx_zcu102_init; | ||
66 | + mc->init = xlnx_ep108_init; | ||
67 | mc->block_default_type = IF_IDE; | ||
68 | mc->units_per_default_bus = 1; | ||
69 | mc->ignore_memory_transaction_failures = true; | ||
70 | } | ||
71 | |||
72 | -DEFINE_MACHINE("xlnx-ep108", xlnx_ep108_machine_init) | ||
73 | +static const TypeInfo xlnx_ep108_machine_init_typeinfo = { | ||
74 | + .name = MACHINE_TYPE_NAME("xlnx-ep108"), | ||
75 | + .parent = TYPE_MACHINE, | ||
76 | + .class_init = xlnx_ep108_machine_class_init, | ||
77 | + .instance_init = xlnx_ep108_machine_instance_init, | ||
78 | + .instance_size = sizeof(XlnxZCU102), | ||
79 | +}; | ||
80 | |||
81 | -static void xlnx_zcu102_machine_init(MachineClass *mc) | ||
82 | +static void xlnx_ep108_machine_init_register_types(void) | ||
83 | { | ||
84 | + type_register_static(&xlnx_ep108_machine_init_typeinfo); | ||
85 | +} | ||
86 | + | ||
87 | +static void xlnx_zcu102_init(MachineState *machine) | ||
88 | +{ | ||
89 | + XlnxZCU102 *s = ZCU102_MACHINE(machine); | ||
90 | + | ||
91 | + xlnx_zynqmp_init(s, machine); | ||
92 | +} | ||
93 | + | ||
94 | +static void xlnx_zcu102_machine_instance_init(Object *obj) | ||
95 | +{ | ||
96 | +} | ||
97 | + | ||
98 | +static void xlnx_zcu102_machine_class_init(ObjectClass *oc, void *data) | ||
99 | +{ | ||
100 | + MachineClass *mc = MACHINE_CLASS(oc); | ||
101 | + | ||
102 | mc->desc = "Xilinx ZynqMP ZCU102 board"; | ||
103 | mc->init = xlnx_zcu102_init; | ||
104 | mc->block_default_type = IF_IDE; | ||
105 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zcu102_machine_init(MachineClass *mc) | ||
106 | mc->ignore_memory_transaction_failures = true; | ||
107 | } | ||
108 | |||
109 | -DEFINE_MACHINE("xlnx-zcu102", xlnx_zcu102_machine_init) | ||
110 | +static const TypeInfo xlnx_zcu102_machine_init_typeinfo = { | ||
111 | + .name = MACHINE_TYPE_NAME("xlnx-zcu102"), | ||
112 | + .parent = TYPE_MACHINE, | ||
113 | + .class_init = xlnx_zcu102_machine_class_init, | ||
114 | + .instance_init = xlnx_zcu102_machine_instance_init, | ||
115 | + .instance_size = sizeof(XlnxZCU102), | ||
116 | +}; | ||
117 | + | ||
118 | +static void xlnx_zcu102_machine_init_register_types(void) | ||
119 | +{ | ||
120 | + type_register_static(&xlnx_zcu102_machine_init_typeinfo); | ||
121 | +} | ||
122 | + | ||
123 | +type_init(xlnx_zcu102_machine_init_register_types) | ||
124 | +type_init(xlnx_ep108_machine_init_register_types) | ||
125 | -- | ||
126 | 2.7.4 | ||
127 | |||
128 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Alistair Francis <alistair.francis@xilinx.com> | ||
2 | 1 | ||
3 | Add a machine level secure property. This defaults to false and can be | ||
4 | set to true using this machine command line argument: | ||
5 | -machine xlnx-zcu102,secure=on | ||
6 | |||
7 | This follows what the ARM virt machine does. | ||
8 | |||
9 | This property only applies to the ZCU102 machine. The EP108 machine does | ||
10 | not have this property. | ||
11 | |||
12 | Signed-off-by: Alistair Francis <alistair.francis@xilinx.com> | ||
13 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
15 | --- | ||
16 | hw/arm/xlnx-zcu102.c | 32 ++++++++++++++++++++++++++++++++ | ||
17 | 1 file changed, 32 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 @@ typedef struct XlnxZCU102 { | ||
24 | |||
25 | XlnxZynqMPState soc; | ||
26 | MemoryRegion ddr_ram; | ||
27 | + | ||
28 | + bool secure; | ||
29 | } XlnxZCU102; | ||
30 | |||
31 | #define TYPE_ZCU102_MACHINE MACHINE_TYPE_NAME("xlnx-zcu102") | ||
32 | @@ -XXX,XX +XXX,XX @@ typedef struct XlnxZCU102 { | ||
33 | |||
34 | static struct arm_boot_info xlnx_zcu102_binfo; | ||
35 | |||
36 | +static bool zcu102_get_secure(Object *obj, Error **errp) | ||
37 | +{ | ||
38 | + XlnxZCU102 *s = ZCU102_MACHINE(obj); | ||
39 | + | ||
40 | + return s->secure; | ||
41 | +} | ||
42 | + | ||
43 | +static void zcu102_set_secure(Object *obj, bool value, Error **errp) | ||
44 | +{ | ||
45 | + XlnxZCU102 *s = ZCU102_MACHINE(obj); | ||
46 | + | ||
47 | + s->secure = value; | ||
48 | +} | ||
49 | + | ||
50 | static void xlnx_zynqmp_init(XlnxZCU102 *s, MachineState *machine) | ||
51 | { | ||
52 | int i; | ||
53 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_init(XlnxZCU102 *s, MachineState *machine) | ||
54 | |||
55 | object_property_set_link(OBJECT(&s->soc), OBJECT(&s->ddr_ram), | ||
56 | "ddr-ram", &error_abort); | ||
57 | + object_property_set_bool(OBJECT(&s->soc), s->secure, "secure", | ||
58 | + &error_fatal); | ||
59 | |||
60 | object_property_set_bool(OBJECT(&s->soc), true, "realized", &error_fatal); | ||
61 | |||
62 | @@ -XXX,XX +XXX,XX @@ static void xlnx_ep108_init(MachineState *machine) | ||
63 | |||
64 | static void xlnx_ep108_machine_instance_init(Object *obj) | ||
65 | { | ||
66 | + XlnxZCU102 *s = EP108_MACHINE(obj); | ||
67 | + | ||
68 | + /* EP108, we don't support setting secure */ | ||
69 | + s->secure = false; | ||
70 | } | ||
71 | |||
72 | static void xlnx_ep108_machine_class_init(ObjectClass *oc, void *data) | ||
73 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zcu102_init(MachineState *machine) | ||
74 | |||
75 | static void xlnx_zcu102_machine_instance_init(Object *obj) | ||
76 | { | ||
77 | + XlnxZCU102 *s = ZCU102_MACHINE(obj); | ||
78 | + | ||
79 | + /* Default to secure mode being disabled */ | ||
80 | + s->secure = false; | ||
81 | + object_property_add_bool(obj, "secure", zcu102_get_secure, | ||
82 | + zcu102_set_secure, NULL); | ||
83 | + object_property_set_description(obj, "secure", | ||
84 | + "Set on/off to enable/disable the ARM " | ||
85 | + "Security Extensions (TrustZone)", | ||
86 | + NULL); | ||
87 | } | ||
88 | |||
89 | static void xlnx_zcu102_machine_class_init(ObjectClass *oc, void *data) | ||
90 | -- | ||
91 | 2.7.4 | ||
92 | |||
93 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Jaroslaw Pelczar <j.pelczar@samsung.com> | ||
2 | 1 | ||
3 | Previously when single stepping through ERET instruction via GDB | ||
4 | would result in debugger entering the "next" PC after ERET instruction. | ||
5 | When debugging in kernel mode, this will also cause unintended behavior, | ||
6 | because debugger will try to access memory from EL0 point of view. | ||
7 | |||
8 | Signed-off-by: Jaroslaw Pelczar <j.pelczar@samsung.com> | ||
9 | Message-id: 001c01d32895$483027f0$d89077d0$@samsung.com | ||
10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | --- | ||
13 | target/arm/translate-a64.c | 1 + | ||
14 | 1 file changed, 1 insertion(+) | ||
15 | |||
16 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/target/arm/translate-a64.c | ||
19 | +++ b/target/arm/translate-a64.c | ||
20 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) | ||
21 | default: | ||
22 | gen_a64_set_pc_im(dc->pc); | ||
23 | /* fall through */ | ||
24 | + case DISAS_EXIT: | ||
25 | case DISAS_JUMP: | ||
26 | if (dc->base.singlestep_enabled) { | ||
27 | gen_exception_internal(EXCP_DEBUG); | ||
28 | -- | ||
29 | 2.7.4 | ||
30 | |||
31 | diff view generated by jsdifflib |