1
ARM queue: nothing particularly exciting, but 18 patches
1
A last small test of bug fixes before rc1.
2
is enough to send out.
3
2
4
thanks
3
thanks
5
-- PMM
4
-- PMM
6
5
7
The following changes since commit 3dabde1128b671f36ac6cb36b97b273139964420:
6
The following changes since commit ed8ad9728a9c0eec34db9dff61dfa2f1dd625637:
8
7
9
Merge remote-tracking branch 'remotes/dgilbert/tags/pull-hmp-20170914' into staging (2017-09-14 16:33:02 +0100)
8
Merge tag 'pull-tpm-2023-07-14-1' of https://github.com/stefanberger/qemu-tpm into staging (2023-07-15 14:54:04 +0100)
10
9
11
are available in the git repository at:
10
are available in the Git repository at:
12
11
13
git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20170914
12
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20230717
14
13
15
for you to fetch changes up to ce3bc112cdb1d462e2d52eaa17a7314e7f3af504:
14
for you to fetch changes up to c2c1c4a35c7c2b1a4140b0942b9797c857e476a4:
16
15
17
mps2-an511: Fix wiring of UART overflow interrupt lines (2017-09-14 18:43:19 +0100)
16
hw/nvram: Avoid unnecessary Xilinx eFuse backstore write (2023-07-17 11:05:52 +0100)
18
17
19
----------------------------------------------------------------
18
----------------------------------------------------------------
20
target-arm queue:
19
target-arm queue:
21
* v7M: various code cleanups
20
* hw/arm/sbsa-ref: set 'slots' property of xhci
22
* v7M: set correct BFSR bits on bus fault
21
* linux-user: Remove pointless NULL check in clock_adjtime handling
23
* v7M: clear exclusive monitor on reset and exception entry/exit
22
* ptw: Fix S1_ptw_translate() debug path
24
* v7M: don't apply priority mask to negative priorities
23
* ptw: Account for FEAT_RME when applying {N}SW, SA bits
25
* zcu102: support 'secure' and 'virtualization' machine properties
24
* accel/tcg: Zero-pad PC in TCG CPU exec trace lines
26
* aarch64: fix ERET single stepping
25
* hw/nvram: Avoid unnecessary Xilinx eFuse backstore write
27
* gpex: implement PCI INTx routing
28
* mps2-an511: fix UART overflow interrupt line wiring
29
26
30
----------------------------------------------------------------
27
----------------------------------------------------------------
31
Alistair Francis (5):
28
Peter Maydell (5):
32
xlnx-ep108: Rename to ZCU102
29
linux-user: Remove pointless NULL check in clock_adjtime handling
33
xlnx-zcu102: Manually create the machines
30
target/arm/ptw.c: Add comments to S1Translate struct fields
34
xlnx-zcu102: Add a machine level secure property
31
target/arm: Fix S1_ptw_translate() debug path
35
xlnx-zcu102: Add a machine level virtualization property
32
target/arm/ptw.c: Account for FEAT_RME when applying {N}SW, SA bits
36
xlnx-zcu102: Mark the EP108 machine as deprecated
33
accel/tcg: Zero-pad PC in TCG CPU exec trace lines
37
34
38
Jaroslaw Pelczar (1):
35
Tong Ho (1):
39
AArch64: Fix single stepping of ERET instruction
36
hw/nvram: Avoid unnecessary Xilinx eFuse backstore write
40
37
41
Peter Maydell (8):
38
Yuquan Wang (1):
42
target/arm: Use M_REG_NUM_BANKS rather than hardcoding 2
39
hw/arm/sbsa-ref: set 'slots' property of xhci
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
40
51
Pranavkumar Sawargaonkar (3):
41
accel/tcg/cpu-exec.c | 4 +--
52
hw/pci-host/gpex: Set INTx index/gsi mapping
42
accel/tcg/translate-all.c | 2 +-
53
hw/arm/virt: Set INTx/gsi mapping
43
hw/arm/sbsa-ref.c | 1 +
54
hw/pci-host/gpex: Implement PCI INTx routing
44
hw/nvram/xlnx-efuse.c | 11 ++++--
55
45
linux-user/syscall.c | 12 +++----
56
Richard Henderson (1):
46
target/arm/ptw.c | 90 +++++++++++++++++++++++++++++++++++++++++------
57
target/arm: Avoid an extra temporary for store_exclusive
47
6 files changed, 98 insertions(+), 22 deletions(-)
58
59
hw/arm/Makefile.objs | 2 +-
60
include/hw/arm/xlnx-zynqmp.h | 2 +
61
include/hw/pci-host/gpex.h | 3 +
62
target/arm/cpu.h | 35 +++---
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
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: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
1
From: Yuquan Wang <wangyuquan1236@phytium.com.cn>
2
2
3
Let's provide the GPEX host bridge with the INTx/gsi mapping. This is
3
This extends the slots of xhci to 64, since the default xhci_sysbus
4
needed for INTx/gsi routing.
4
just supports one slot.
5
5
6
Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
6
Signed-off-by: Wang Yuquan <wangyuquan1236@phytium.com.cn>
7
Signed-off-by: Tushar Jagad <tushar.jagad@linaro.org>
7
Signed-off-by: Chen Baozi <chenbaozi@phytium.com.cn>
8
Signed-off-by: Eric Auger <eric.auger@redhat.com>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Reviewed-by: Andrew Jones <drjones@redhat.com>
9
Reviewed-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
10
Tested-by: Feng Kan <fkan@apm.com>
10
Tested-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
11
Message-id: 1505296004-6798-3-git-send-email-eric.auger@redhat.com
11
Message-id: 20230710063750.473510-2-wangyuquan1236@phytium.com.cn
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
13
---
14
hw/arm/virt.c | 1 +
14
hw/arm/sbsa-ref.c | 1 +
15
1 file changed, 1 insertion(+)
15
1 file changed, 1 insertion(+)
16
16
17
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
17
diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
18
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/arm/virt.c
19
--- a/hw/arm/sbsa-ref.c
20
+++ b/hw/arm/virt.c
20
+++ b/hw/arm/sbsa-ref.c
21
@@ -XXX,XX +XXX,XX @@ static void create_pcie(const VirtMachineState *vms, qemu_irq *pic)
21
@@ -XXX,XX +XXX,XX @@ static void create_xhci(const SBSAMachineState *sms)
22
22
hwaddr base = sbsa_ref_memmap[SBSA_XHCI].base;
23
for (i = 0; i < GPEX_NUM_IRQS; i++) {
23
int irq = sbsa_ref_irqmap[SBSA_XHCI];
24
sysbus_connect_irq(SYS_BUS_DEVICE(dev), i, pic[irq + i]);
24
DeviceState *dev = qdev_new(TYPE_XHCI_SYSBUS);
25
+ gpex_set_irq_num(GPEX_HOST(dev), i, irq + i);
25
+ qdev_prop_set_uint32(dev, "slots", XHCI_MAXSLOTS);
26
}
26
27
27
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
28
pci = PCI_HOST_BRIDGE(dev);
28
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
29
--
29
--
30
2.7.4
30
2.34.1
31
32
diff view generated by jsdifflib
1
For a bus fault, the M profile BFSR bit PRECISERR means a bus
1
In the code for TARGET_NR_clock_adjtime, we set the pointer phtx to
2
fault on a data access, and IBUSERR means a bus fault on an
2
the address of the local variable htx. This means it can never be
3
instruction access. We had these the wrong way around; fix this.
3
NULL, but later in the code we check it for NULL anyway. Coverity
4
complains about this (CID 1507683) because the NULL check comes after
5
a call to clock_adjtime() that assumes it is non-NULL.
6
7
Since phtx is always &htx, and is used only in three places, it's not
8
really necessary. Remove it, bringing the code structure in to line
9
with that for TARGET_NR_clock_adjtime64, which already uses a simple
10
'&htx' when it wants a pointer to 'htx'.
4
11
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
13
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 1505137930-13255-4-git-send-email-peter.maydell@linaro.org
15
Message-id: 20230623144410.1837261-1-peter.maydell@linaro.org
9
---
16
---
10
target/arm/helper.c | 8 ++++----
17
linux-user/syscall.c | 12 +++++-------
11
1 file changed, 4 insertions(+), 4 deletions(-)
18
1 file changed, 5 insertions(+), 7 deletions(-)
12
19
13
diff --git a/target/arm/helper.c b/target/arm/helper.c
20
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
14
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/helper.c
22
--- a/linux-user/syscall.c
16
+++ b/target/arm/helper.c
23
+++ b/linux-user/syscall.c
17
@@ -XXX,XX +XXX,XX @@ void arm_v7m_cpu_do_interrupt(CPUState *cs)
24
@@ -XXX,XX +XXX,XX @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
18
case 0x8: /* External Abort */
25
#if defined(TARGET_NR_clock_adjtime) && defined(CONFIG_CLOCK_ADJTIME)
19
switch (cs->exception_index) {
26
case TARGET_NR_clock_adjtime:
20
case EXCP_PREFETCH_ABORT:
27
{
21
- env->v7m.cfsr[M_REG_NS] |= R_V7M_CFSR_PRECISERR_MASK;
28
- struct timex htx, *phtx = &htx;
22
- qemu_log_mask(CPU_LOG_INT, "...with CFSR.PRECISERR\n");
29
+ struct timex htx;
23
+ env->v7m.cfsr[M_REG_NS] |= R_V7M_CFSR_IBUSERR_MASK;
30
24
+ qemu_log_mask(CPU_LOG_INT, "...with CFSR.IBUSERR\n");
31
- if (target_to_host_timex(phtx, arg2) != 0) {
25
break;
32
+ if (target_to_host_timex(&htx, arg2) != 0) {
26
case EXCP_DATA_ABORT:
33
return -TARGET_EFAULT;
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
}
34
}
35
- ret = get_errno(clock_adjtime(arg1, phtx));
36
- if (!is_error(ret) && phtx) {
37
- if (host_to_target_timex(arg2, phtx) != 0) {
38
- return -TARGET_EFAULT;
39
- }
40
+ ret = get_errno(clock_adjtime(arg1, &htx));
41
+ if (!is_error(ret) && host_to_target_timex(arg2, &htx)) {
42
+ return -TARGET_EFAULT;
43
}
44
}
45
return ret;
37
--
46
--
38
2.7.4
47
2.34.1
39
48
40
49
diff view generated by jsdifflib
1
For M profile we must clear the exclusive monitor on reset, exception
1
Add comments to the in_* fields in the S1Translate struct
2
entry and exception exit. We weren't doing any of these things; fix
2
that explain what they're doing.
3
this bug.
4
3
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
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>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 1505137930-13255-3-git-send-email-peter.maydell@linaro.org
6
Message-id: 20230710152130.3928330-2-peter.maydell@linaro.org
9
---
7
---
10
target/arm/internals.h | 10 ++++++++++
8
target/arm/ptw.c | 40 ++++++++++++++++++++++++++++++++++++++++
11
target/arm/cpu.c | 6 ++++++
9
1 file changed, 40 insertions(+)
12
target/arm/helper.c | 2 ++
13
target/arm/op_helper.c | 2 +-
14
4 files changed, 19 insertions(+), 1 deletion(-)
15
10
16
diff --git a/target/arm/internals.h b/target/arm/internals.h
11
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
17
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/internals.h
13
--- a/target/arm/ptw.c
19
+++ b/target/arm/internals.h
14
+++ b/target/arm/ptw.c
20
@@ -XXX,XX +XXX,XX @@ void arm_handle_psci_call(ARMCPU *cpu);
15
@@ -XXX,XX +XXX,XX @@
21
#endif
16
#endif
22
17
23
/**
18
typedef struct S1Translate {
24
+ * arm_clear_exclusive: clear the exclusive monitor
19
+ /*
25
+ * @env: CPU env
20
+ * in_mmu_idx : specifies which TTBR, TCR, etc to use for the walk.
26
+ * Clear the CPU's exclusive monitor, like the guest CLREX instruction.
21
+ * Together with in_space, specifies the architectural translation regime.
27
+ */
28
+static inline void arm_clear_exclusive(CPUARMState *env)
29
+{
30
+ env->exclusive_addr = -1;
31
+}
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
+ */
22
+ */
49
+ arm_clear_exclusive(env);
23
ARMMMUIdx in_mmu_idx;
50
+
24
+ /*
51
env->vfp.xregs[ARM_VFP_FPEXC] = 0;
25
+ * in_ptw_idx: specifies which mmuidx to use for the actual
52
#endif
26
+ * page table descriptor load operations. This will be one of the
53
27
+ * ARMMMUIdx_Stage2* or one of the ARMMMUIdx_Phys_* indexes.
54
diff --git a/target/arm/helper.c b/target/arm/helper.c
28
+ * If a Secure ptw is "downgraded" to NonSecure by an NSTable bit,
55
index XXXXXXX..XXXXXXX 100644
29
+ * this field is updated accordingly.
56
--- a/target/arm/helper.c
30
+ */
57
+++ b/target/arm/helper.c
31
ARMMMUIdx in_ptw_idx;
58
@@ -XXX,XX +XXX,XX @@ static void v7m_exception_taken(ARMCPU *cpu, uint32_t lr)
32
+ /*
59
33
+ * in_space: the security space for this walk. This plus
60
armv7m_nvic_acknowledge_irq(env->nvic);
34
+ * the in_mmu_idx specify the architectural translation regime.
61
switch_v7m_sp(env, 0);
35
+ * If a Secure ptw is "downgraded" to NonSecure by an NSTable bit,
62
+ arm_clear_exclusive(env);
36
+ * this field is updated accordingly.
63
/* Clear IT bits */
37
+ *
64
env->condexec_bits = 0;
38
+ * Note that the security space for the in_ptw_idx may be different
65
env->regs[14] = lr;
39
+ * from that for the in_mmu_idx. We do not need to explicitly track
66
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
40
+ * the in_ptw_idx security space because:
67
}
41
+ * - if the in_ptw_idx is an ARMMMUIdx_Phys_* then the mmuidx
68
42
+ * itself specifies the security space
69
/* Otherwise, we have a successful exception exit. */
43
+ * - if the in_ptw_idx is an ARMMMUIdx_Stage2* then the security
70
+ arm_clear_exclusive(env);
44
+ * space used for ptw reads is the same as that of the security
71
qemu_log_mask(CPU_LOG_INT, "...successful exception return\n");
45
+ * space of the stage 1 translation for all cases except where
72
}
46
+ * stage 1 is Secure; in that case the only possibilities for
73
47
+ * the ptw read are Secure and NonSecure, and the in_ptw_idx
74
diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c
48
+ * value being Stage2 vs Stage2_S distinguishes those.
75
index XXXXXXX..XXXXXXX 100644
49
+ */
76
--- a/target/arm/op_helper.c
50
ARMSecuritySpace in_space;
77
+++ b/target/arm/op_helper.c
51
+ /*
78
@@ -XXX,XX +XXX,XX @@ void HELPER(exception_return)(CPUARMState *env)
52
+ * in_secure: whether the translation regime is a Secure one.
79
53
+ * This is always equal to arm_space_is_secure(in_space).
80
aarch64_save_sp(env, cur_el);
54
+ * If a Secure ptw is "downgraded" to NonSecure by an NSTable bit,
81
55
+ * this field is updated accordingly.
82
- env->exclusive_addr = -1;
56
+ */
83
+ arm_clear_exclusive(env);
57
bool in_secure;
84
58
+ /*
85
/* We must squash the PSTATE.SS bit to zero unless both of the
59
+ * in_debug: is this a QEMU debug access (gdbstub, etc)? Debug
86
* following hold:
60
+ * accesses will not update the guest page table access flags
61
+ * and will not change the state of the softmmu TLBs.
62
+ */
63
bool in_debug;
64
/*
65
* If this is stage 2 of a stage 1+2 page table walk, then this must
87
--
66
--
88
2.7.4
67
2.34.1
89
90
diff view generated by jsdifflib
1
From: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
1
In commit fe4a5472ccd6 we rearranged the logic in S1_ptw_translate()
2
so that the debug-access "call get_phys_addr_*" codepath is used both
3
when S1 is doing ptw reads from stage 2 and when it is doing ptw
4
reads from physical memory. However, we didn't update the
5
calculation of s2ptw->in_space and s2ptw->in_secure to account for
6
the "ptw reads from physical memory" case. This meant that debug
7
accesses when in Secure state broke.
2
8
3
Now we are able to retrieve the gsi from the INTx pin, let's
9
Create a new function S2_security_space() which returns the
4
enable intx_to_irq routing. From that point on, irqfd becomes
10
correct security space to use for the ptw load, and use it to
5
usable along with INTx when assigning a PCIe device.
11
determine the correct .in_secure and .in_space fields for the
12
stage 2 lookup for the ptw load.
6
13
7
Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
14
Reported-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
8
Signed-off-by: Tushar Jagad <tushar.jagad@linaro.org>
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Eric Auger <eric.auger@redhat.com>
16
Tested-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
10
Reviewed-by: Andrew Jones <drjones@redhat.com>
17
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11
Tested-by: Feng Kan <fkan@apm.com>
18
Message-id: 20230710152130.3928330-3-peter.maydell@linaro.org
12
Message-id: 1505296004-6798-4-git-send-email-eric.auger@redhat.com
19
Fixes: fe4a5472ccd6 ("target/arm: Use get_phys_addr_with_struct in S1_ptw_translate")
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
---
21
---
15
hw/pci-host/gpex.c | 12 ++++++++++++
22
target/arm/ptw.c | 37 ++++++++++++++++++++++++++++++++-----
16
1 file changed, 12 insertions(+)
23
1 file changed, 32 insertions(+), 5 deletions(-)
17
24
18
diff --git a/hw/pci-host/gpex.c b/hw/pci-host/gpex.c
25
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
19
index XXXXXXX..XXXXXXX 100644
26
index XXXXXXX..XXXXXXX 100644
20
--- a/hw/pci-host/gpex.c
27
--- a/target/arm/ptw.c
21
+++ b/hw/pci-host/gpex.c
28
+++ b/target/arm/ptw.c
22
@@ -XXX,XX +XXX,XX @@ int gpex_set_irq_num(GPEXHost *s, int index, int gsi)
29
@@ -XXX,XX +XXX,XX @@ static bool S2_attrs_are_device(uint64_t hcr, uint8_t attrs)
23
return 0;
30
}
24
}
31
}
25
32
26
+static PCIINTxRoute gpex_route_intx_pin_to_irq(void *opaque, int pin)
33
+static ARMSecuritySpace S2_security_space(ARMSecuritySpace s1_space,
34
+ ARMMMUIdx s2_mmu_idx)
27
+{
35
+{
28
+ PCIINTxRoute route;
36
+ /*
29
+ GPEXHost *s = opaque;
37
+ * Return the security space to use for stage 2 when doing
30
+
38
+ * the S1 page table descriptor load.
31
+ route.mode = PCI_INTX_ENABLED;
39
+ */
32
+ route.irq = s->irq_num[pin];
40
+ if (regime_is_stage2(s2_mmu_idx)) {
33
+
41
+ /*
34
+ return route;
42
+ * The security space for ptw reads is almost always the same
43
+ * as that of the security space of the stage 1 translation.
44
+ * The only exception is when stage 1 is Secure; in that case
45
+ * the ptw read might be to the Secure or the NonSecure space
46
+ * (but never Realm or Root), and the s2_mmu_idx tells us which.
47
+ * Root translations are always single-stage.
48
+ */
49
+ if (s1_space == ARMSS_Secure) {
50
+ return arm_secure_to_space(s2_mmu_idx == ARMMMUIdx_Stage2_S);
51
+ } else {
52
+ assert(s2_mmu_idx != ARMMMUIdx_Stage2_S);
53
+ assert(s1_space != ARMSS_Root);
54
+ return s1_space;
55
+ }
56
+ } else {
57
+ /* ptw loads are from phys: the mmu idx itself says which space */
58
+ return arm_phys_to_space(s2_mmu_idx);
59
+ }
35
+}
60
+}
36
+
61
+
37
static void gpex_host_realize(DeviceState *dev, Error **errp)
62
/* Translate a S1 pagetable walk through S2 if needed. */
63
static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw,
64
hwaddr addr, ARMMMUFaultInfo *fi)
38
{
65
{
39
PCIHostState *pci = PCI_HOST_BRIDGE(dev);
66
- ARMSecuritySpace space = ptw->in_space;
40
@@ -XXX,XX +XXX,XX @@ static void gpex_host_realize(DeviceState *dev, Error **errp)
67
bool is_secure = ptw->in_secure;
41
&s->io_ioport, 0, 4, TYPE_PCIE_BUS);
68
ARMMMUIdx mmu_idx = ptw->in_mmu_idx;
42
69
ARMMMUIdx s2_mmu_idx = ptw->in_ptw_idx;
43
qdev_set_parent_bus(DEVICE(&s->gpex_root), BUS(pci->bus));
70
@@ -XXX,XX +XXX,XX @@ static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw,
44
+ pci_bus_set_route_irq_fn(pci->bus, gpex_route_intx_pin_to_irq);
71
* From gdbstub, do not use softmmu so that we don't modify the
45
qdev_init_nofail(DEVICE(&s->gpex_root));
72
* state of the cpu at all, including softmmu tlb contents.
46
}
73
*/
47
74
+ ARMSecuritySpace s2_space = S2_security_space(ptw->in_space, s2_mmu_idx);
75
S1Translate s2ptw = {
76
.in_mmu_idx = s2_mmu_idx,
77
.in_ptw_idx = ptw_idx_for_stage_2(env, s2_mmu_idx),
78
- .in_secure = s2_mmu_idx == ARMMMUIdx_Stage2_S,
79
- .in_space = (s2_mmu_idx == ARMMMUIdx_Stage2_S ? ARMSS_Secure
80
- : space == ARMSS_Realm ? ARMSS_Realm
81
- : ARMSS_NonSecure),
82
+ .in_secure = arm_space_is_secure(s2_space),
83
+ .in_space = s2_space,
84
.in_debug = true,
85
};
86
GetPhysAddrResult s2 = { };
48
--
87
--
49
2.7.4
88
2.34.1
50
51
diff view generated by jsdifflib
1
In do_v7m_exception_exit(), there's no need to force the high 4
1
In get_phys_addr_twostage() the code that applies the effects of
2
bits of 'type' to 1 when calling v7m_exception_taken(), because
2
VSTCR.{SA,SW} and VTCR.{NSA,NSW} only updates result->f.attrs.secure.
3
we know that they're always 1 or we could not have got to this
3
Now we also have f.attrs.space for FEAT_RME, we need to keep the two
4
"handle return to magic exception return address" code. Remove
4
in sync.
5
the unnecessary ORs.
5
6
These bits only have an effect for Secure space translations, not
7
for Root, so use the input in_space field to determine whether to
8
apply them rather than the input is_secure. This doesn't actually
9
make a difference because Root translations are never two-stage,
10
but it's a little clearer.
6
11
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Acked-by: Alistair Francis <alistair.francis@xilinx.com>
14
Message-id: 20230710152130.3928330-4-peter.maydell@linaro.org
10
Message-id: 1505137930-13255-6-git-send-email-peter.maydell@linaro.org
11
---
15
---
12
target/arm/helper.c | 4 ++--
16
target/arm/ptw.c | 13 ++++++++-----
13
1 file changed, 2 insertions(+), 2 deletions(-)
17
1 file changed, 8 insertions(+), 5 deletions(-)
14
18
15
diff --git a/target/arm/helper.c b/target/arm/helper.c
19
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
16
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/helper.c
21
--- a/target/arm/ptw.c
18
+++ b/target/arm/helper.c
22
+++ b/target/arm/ptw.c
19
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
23
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw,
20
*/
24
hwaddr ipa;
21
env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_INVPC_MASK;
25
int s1_prot, s1_lgpgsz;
22
armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE);
26
bool is_secure = ptw->in_secure;
23
- v7m_exception_taken(cpu, type | 0xf0000000);
27
+ ARMSecuritySpace in_space = ptw->in_space;
24
+ v7m_exception_taken(cpu, type);
28
bool ret, ipa_secure;
25
qemu_log_mask(CPU_LOG_INT, "...taking UsageFault on existing "
29
ARMCacheAttrs cacheattrs1;
26
"stackframe: failed exception return integrity check\n");
30
ARMSecuritySpace ipa_space;
27
return;
31
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw,
28
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
32
* Check if IPA translates to secure or non-secure PA space.
29
armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE);
33
* Note that VSTCR overrides VTCR and {N}SW overrides {N}SA.
30
env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_INVPC_MASK;
34
*/
31
v7m_push_stack(cpu);
35
- result->f.attrs.secure =
32
- v7m_exception_taken(cpu, type | 0xf0000000);
36
- (is_secure
33
+ v7m_exception_taken(cpu, type);
37
- && !(env->cp15.vstcr_el2 & (VSTCR_SA | VSTCR_SW))
34
qemu_log_mask(CPU_LOG_INT, "...taking UsageFault on new stackframe: "
38
- && (ipa_secure
35
"failed exception return integrity check\n");
39
- || !(env->cp15.vtcr_el2 & (VTCR_NSA | VTCR_NSW))));
36
return;
40
+ if (in_space == ARMSS_Secure) {
41
+ result->f.attrs.secure =
42
+ !(env->cp15.vstcr_el2 & (VSTCR_SA | VSTCR_SW))
43
+ && (ipa_secure
44
+ || !(env->cp15.vtcr_el2 & (VTCR_NSA | VTCR_NSW)));
45
+ result->f.attrs.space = arm_secure_to_space(result->f.attrs.secure);
46
+ }
47
48
return false;
49
}
37
--
50
--
38
2.7.4
51
2.34.1
39
40
diff view generated by jsdifflib
1
In several places we were unconditionally applying the
1
In commit f0a08b0913befbd we changed the type of the PC from
2
nvic_gprio_mask() to a priority value. This is incorrect
2
target_ulong to vaddr. In doing so we inadvertently dropped the
3
if the priority is one of the fixed negative priority
3
zero-padding on the PC in trace lines (the second item inside the []
4
values (for NMI and HardFault), so don't do it.
4
in these lines). They used to look like this on AArch64, for
5
instance:
5
6
6
This bug would have caused both NMI and HardFault to be
7
Trace 0: 0x7f2260000100 [00000000/0000000040000000/00000061/ff200000]
7
considered as the same priority and so NMI wouldn't
8
correctly preempt HardFault.
9
8
9
and now they look like this:
10
Trace 0: 0x7f4f50000100 [00000000/40000000/00000061/ff200000]
11
12
and if the PC happens to be somewhere low like 0x5000
13
then the field is shown as /5000/.
14
15
This is because TARGET_FMT_lx is a "%08x" or "%016x" specifier,
16
depending on TARGET_LONG_SIZE, whereas VADDR_PRIx is just PRIx64
17
with no width specifier.
18
19
Restore the zero-padding by adding an 016 width specifier to
20
this tracing and a couple of others that were similarly recently
21
changed to use VADDR_PRIx without a width specifier.
22
23
We can't unfortunately restore the "32-bit guests are padded to
24
8 hex digits and 64-bit guests to 16 hex digits" behaviour so
25
easily.
26
27
Fixes: f0a08b0913befbd ("accel/tcg/cpu-exec.c: Widen pc to vaddr")
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
28
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
29
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
12
Message-id: 1505137930-13255-5-git-send-email-peter.maydell@linaro.org
30
Reviewed-by: Anton Johansson <anjo@rev.ng>
31
Message-id: 20230711165434.4123674-1-peter.maydell@linaro.org
13
---
32
---
14
hw/intc/armv7m_nvic.c | 11 +++++++++--
33
accel/tcg/cpu-exec.c | 4 ++--
15
1 file changed, 9 insertions(+), 2 deletions(-)
34
accel/tcg/translate-all.c | 2 +-
35
2 files changed, 3 insertions(+), 3 deletions(-)
16
36
17
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
37
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
18
index XXXXXXX..XXXXXXX 100644
38
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/intc/armv7m_nvic.c
39
--- a/accel/tcg/cpu-exec.c
20
+++ b/hw/intc/armv7m_nvic.c
40
+++ b/accel/tcg/cpu-exec.c
21
@@ -XXX,XX +XXX,XX @@ static void nvic_recompute_state(NVICState *s)
41
@@ -XXX,XX +XXX,XX @@ static void log_cpu_exec(vaddr pc, CPUState *cpu,
42
if (qemu_log_in_addr_range(pc)) {
43
qemu_log_mask(CPU_LOG_EXEC,
44
"Trace %d: %p [%08" PRIx64
45
- "/%" VADDR_PRIx "/%08x/%08x] %s\n",
46
+ "/%016" VADDR_PRIx "/%08x/%08x] %s\n",
47
cpu->cpu_index, tb->tc.ptr, tb->cs_base, pc,
48
tb->flags, tb->cflags, lookup_symbol(pc));
49
50
@@ -XXX,XX +XXX,XX @@ cpu_tb_exec(CPUState *cpu, TranslationBlock *itb, int *tb_exit)
51
if (qemu_loglevel_mask(CPU_LOG_EXEC)) {
52
vaddr pc = log_pc(cpu, last_tb);
53
if (qemu_log_in_addr_range(pc)) {
54
- qemu_log("Stopped execution of TB chain before %p [%"
55
+ qemu_log("Stopped execution of TB chain before %p [%016"
56
VADDR_PRIx "] %s\n",
57
last_tb->tc.ptr, pc, lookup_symbol(pc));
58
}
59
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
60
index XXXXXXX..XXXXXXX 100644
61
--- a/accel/tcg/translate-all.c
62
+++ b/accel/tcg/translate-all.c
63
@@ -XXX,XX +XXX,XX @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr)
64
if (qemu_loglevel_mask(CPU_LOG_EXEC)) {
65
vaddr pc = log_pc(cpu, tb);
66
if (qemu_log_in_addr_range(pc)) {
67
- qemu_log("cpu_io_recompile: rewound execution of TB to %"
68
+ qemu_log("cpu_io_recompile: rewound execution of TB to %016"
69
VADDR_PRIx "\n", pc);
22
}
70
}
23
}
71
}
24
25
+ if (active_prio > 0) {
26
+ active_prio &= nvic_gprio_mask(s);
27
+ }
28
+
29
s->vectpending = pend_irq;
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
--
72
--
48
2.7.4
73
2.34.1
49
74
50
75
diff view generated by jsdifflib
Deleted patch
1
The exception-return magic values get some new bits in v8M, which
2
makes some bit definitions for them worthwhile.
3
1
4
We don't use the bit definitions for the switch on the low bits
5
which checks the return type for v7M, because this is defined
6
in the v7M ARM ARM as a set of valid values rather than via
7
per-bit checks.
8
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
11
Message-id: 1505137930-13255-7-git-send-email-peter.maydell@linaro.org
12
---
13
target/arm/internals.h | 10 ++++++++++
14
target/arm/helper.c | 14 +++++++++-----
15
2 files changed, 19 insertions(+), 5 deletions(-)
16
17
diff --git a/target/arm/internals.h b/target/arm/internals.h
18
index XXXXXXX..XXXXXXX 100644
19
--- a/target/arm/internals.h
20
+++ b/target/arm/internals.h
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)
43
" previous exception %d\n",
44
type, env->v7m.exception);
45
46
- if (extract32(type, 5, 23) != extract32(-1, 5, 23)) {
47
+ if ((type & R_V7M_EXCRET_RES1_MASK) != R_V7M_EXCRET_RES1_MASK) {
48
qemu_log_mask(LOG_GUEST_ERROR, "M profile: zero high bits in exception "
49
"exit PC value 0x%" PRIx32 " are UNPREDICTABLE\n", type);
50
}
51
@@ -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.)
53
*/
54
if (arm_feature(env, ARM_FEATURE_M_SECURITY)) {
55
- int es = type & 1;
56
+ int es = type & R_V7M_EXCRET_ES_MASK;
57
if (armv7m_nvic_raw_execution_priority(env->nvic) >= 0) {
58
env->v7m.faultmask[es] = 0;
59
}
60
@@ -XXX,XX +XXX,XX @@ void arm_v7m_cpu_do_interrupt(CPUState *cs)
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
--
81
2.7.4
82
83
diff view generated by jsdifflib
Deleted patch
1
In the v7M and v8M ARM ARM, the magic exception return values are
2
referred to as EXC_RETURN values, and in QEMU we use V7M_EXCRET_*
3
constants to define bits within them. Rename the 'type' variable
4
which holds the exception return value in do_v7m_exception_exit()
5
to excret, making it clearer that it does hold an EXC_RETURN value.
6
1
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11
Message-id: 1505137930-13255-8-git-send-email-peter.maydell@linaro.org
12
---
13
target/arm/helper.c | 23 ++++++++++++-----------
14
1 file changed, 12 insertions(+), 11 deletions(-)
15
16
diff --git a/target/arm/helper.c b/target/arm/helper.c
17
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/helper.c
19
+++ b/target/arm/helper.c
20
@@ -XXX,XX +XXX,XX @@ static void v7m_push_stack(ARMCPU *cpu)
21
static void do_v7m_exception_exit(ARMCPU *cpu)
22
{
23
CPUARMState *env = &cpu->env;
24
- uint32_t type;
25
+ uint32_t excret;
26
uint32_t xpsr;
27
bool ufault = false;
28
bool return_to_sp_process = false;
29
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
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
}
39
40
qemu_log_mask(CPU_LOG_INT, "Exception return: magic PC %" PRIx32
41
" previous exception %d\n",
42
- type, env->v7m.exception);
43
+ excret, env->v7m.exception);
44
45
- if ((type & R_V7M_EXCRET_RES1_MASK) != R_V7M_EXCRET_RES1_MASK) {
46
+ if ((excret & R_V7M_EXCRET_RES1_MASK) != R_V7M_EXCRET_RES1_MASK) {
47
qemu_log_mask(LOG_GUEST_ERROR, "M profile: zero high bits in exception "
48
- "exit PC value 0x%" PRIx32 " are UNPREDICTABLE\n", type);
49
+ "exit PC value 0x%" PRIx32 " are UNPREDICTABLE\n",
50
+ excret);
51
}
52
53
if (env->v7m.exception != ARMV7M_EXCP_NMI) {
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
--
99
2.7.4
100
101
diff view generated by jsdifflib
1
From: Alistair Francis <alistair.francis@xilinx.com>
1
From: Tong Ho <tong.ho@amd.com>
2
2
3
The EP108 is a early access development board. Now that silicon is in
3
Add a check in the bit-set operation to write the backstore
4
production people have access to the ZCU102. Let's rename the internal
4
only if the affected bit is 0 before.
5
QEMU files and variables to use the ZCU102.
6
5
7
There is no functional change here as the EP108 is still a valid board
6
With this in place, there will be no need for callers to
8
option.
7
do the checking in order to avoid unnecessary writes.
9
8
10
Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
9
Signed-off-by: Tong Ho <tong.ho@amd.com>
11
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
10
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
11
Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com>
12
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
14
---
14
hw/arm/Makefile.objs | 2 +-
15
hw/nvram/xlnx-efuse.c | 11 +++++++++--
15
hw/arm/{xlnx-ep108.c => xlnx-zcu102.c} | 30 +++++++++++++++---------------
16
1 file changed, 9 insertions(+), 2 deletions(-)
16
2 files changed, 16 insertions(+), 16 deletions(-)
17
rename hw/arm/{xlnx-ep108.c => xlnx-zcu102.c} (85%)
18
17
19
diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs
18
diff --git a/hw/nvram/xlnx-efuse.c b/hw/nvram/xlnx-efuse.c
20
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
21
--- a/hw/arm/Makefile.objs
20
--- a/hw/nvram/xlnx-efuse.c
22
+++ b/hw/arm/Makefile.objs
21
+++ b/hw/nvram/xlnx-efuse.c
23
@@ -XXX,XX +XXX,XX @@ obj-y += omap1.o omap2.o strongarm.o
22
@@ -XXX,XX +XXX,XX @@ static bool efuse_ro_bits_find(XlnxEFuse *s, uint32_t k)
24
obj-$(CONFIG_ALLWINNER_A10) += allwinner-a10.o cubieboard.o
23
25
obj-$(CONFIG_RASPI) += bcm2835_peripherals.o bcm2836.o raspi.o
24
bool xlnx_efuse_set_bit(XlnxEFuse *s, unsigned int bit)
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 @@
40
/*
41
- * Xilinx ZynqMP EP108 board
42
+ * Xilinx ZynqMP ZCU102 board
43
*
44
* Copyright (C) 2015 Xilinx Inc
45
* Written by Peter Crosthwaite <peter.crosthwaite@xilinx.com>
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
{
25
{
63
- XlnxEP108 *s = g_new0(XlnxEP108, 1);
26
+ uint32_t set, *row;
64
+ XlnxZCU102 *s = g_new0(XlnxZCU102, 1);
27
+
65
int i;
28
if (efuse_ro_bits_find(s, bit)) {
66
uint64_t ram_size = machine->ram_size;
29
g_autofree char *path = object_get_canonical_path(OBJECT(s));
67
30
68
@@ -XXX,XX +XXX,XX @@ static void xlnx_ep108_init(MachineState *machine)
31
@@ -XXX,XX +XXX,XX @@ bool xlnx_efuse_set_bit(XlnxEFuse *s, unsigned int bit)
32
return false;
69
}
33
}
70
34
71
if (ram_size < 0x08000000) {
35
- s->fuse32[bit / 32] |= 1 << (bit % 32);
72
- qemu_log("WARNING: RAM size 0x%" PRIx64 " is small for EP108",
36
- efuse_bdrv_sync(s, bit);
73
+ qemu_log("WARNING: RAM size 0x%" PRIx64 " is small for ZCU102",
37
+ /* Avoid back-end write unless there is a real update */
74
ram_size);
38
+ row = &s->fuse32[bit / 32];
75
}
39
+ set = 1 << (bit % 32);
76
40
+ if (!(set & *row)) {
77
@@ -XXX,XX +XXX,XX @@ static void xlnx_ep108_init(MachineState *machine)
41
+ *row |= set;
78
42
+ efuse_bdrv_sync(s, bit);
79
/* TODO create and connect IDE devices for ide_drive_get() */
43
+ }
80
44
return true;
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
}
45
}
94
46
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
--
47
--
113
2.7.4
48
2.34.1
114
49
115
50
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: Alistair Francis <alistair.francis@xilinx.com>
2
1
3
Add a machine level virtualization property. This defaults to false and can be
4
set to true using this machine command line argument:
5
-machine xlnx-zcu102,virtualization=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
include/hw/arm/xlnx-zynqmp.h | 2 ++
17
hw/arm/xlnx-zcu102.c | 30 +++++++++++++++++++++++++++++-
18
hw/arm/xlnx-zynqmp.c | 3 ++-
19
3 files changed, 33 insertions(+), 2 deletions(-)
20
21
diff --git a/include/hw/arm/xlnx-zynqmp.h b/include/hw/arm/xlnx-zynqmp.h
22
index XXXXXXX..XXXXXXX 100644
23
--- a/include/hw/arm/xlnx-zynqmp.h
24
+++ b/include/hw/arm/xlnx-zynqmp.h
25
@@ -XXX,XX +XXX,XX @@ typedef struct XlnxZynqMPState {
26
27
/* Has the ARM Security extensions? */
28
bool secure;
29
+ /* Has the ARM Virtualization extensions? */
30
+ bool virt;
31
/* Has the RPU subsystem? */
32
bool has_rpu;
33
} XlnxZynqMPState;
34
diff --git a/hw/arm/xlnx-zcu102.c b/hw/arm/xlnx-zcu102.c
35
index XXXXXXX..XXXXXXX 100644
36
--- a/hw/arm/xlnx-zcu102.c
37
+++ b/hw/arm/xlnx-zcu102.c
38
@@ -XXX,XX +XXX,XX @@ typedef struct XlnxZCU102 {
39
MemoryRegion ddr_ram;
40
41
bool secure;
42
+ bool virt;
43
} XlnxZCU102;
44
45
#define TYPE_ZCU102_MACHINE MACHINE_TYPE_NAME("xlnx-zcu102")
46
@@ -XXX,XX +XXX,XX @@ static void zcu102_set_secure(Object *obj, bool value, Error **errp)
47
s->secure = value;
48
}
49
50
+static bool zcu102_get_virt(Object *obj, Error **errp)
51
+{
52
+ XlnxZCU102 *s = ZCU102_MACHINE(obj);
53
+
54
+ return s->virt;
55
+}
56
+
57
+static void zcu102_set_virt(Object *obj, bool value, Error **errp)
58
+{
59
+ XlnxZCU102 *s = ZCU102_MACHINE(obj);
60
+
61
+ s->virt = value;
62
+}
63
+
64
static void xlnx_zynqmp_init(XlnxZCU102 *s, MachineState *machine)
65
{
66
int i;
67
@@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_init(XlnxZCU102 *s, MachineState *machine)
68
"ddr-ram", &error_abort);
69
object_property_set_bool(OBJECT(&s->soc), s->secure, "secure",
70
&error_fatal);
71
+ object_property_set_bool(OBJECT(&s->soc), s->virt, "virtualization",
72
+ &error_fatal);
73
74
object_property_set_bool(OBJECT(&s->soc), true, "realized", &error_fatal);
75
76
@@ -XXX,XX +XXX,XX @@ static void xlnx_ep108_machine_instance_init(Object *obj)
77
{
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
}
85
86
static void xlnx_ep108_machine_class_init(ObjectClass *oc, void *data)
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
--
126
2.7.4
127
128
diff view generated by jsdifflib
Deleted patch
1
From: Alistair Francis <alistair.francis@xilinx.com>
2
1
3
The EP108 is the same as the ZCU102, mark it as deprecated as we don't
4
need two machines.
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 | 2 +-
11
1 file changed, 1 insertion(+), 1 deletion(-)
12
13
diff --git a/hw/arm/xlnx-zcu102.c b/hw/arm/xlnx-zcu102.c
14
index XXXXXXX..XXXXXXX 100644
15
--- a/hw/arm/xlnx-zcu102.c
16
+++ b/hw/arm/xlnx-zcu102.c
17
@@ -XXX,XX +XXX,XX @@ static void xlnx_ep108_machine_class_init(ObjectClass *oc, void *data)
18
{
19
MachineClass *mc = MACHINE_CLASS(oc);
20
21
- mc->desc = "Xilinx ZynqMP EP108 board";
22
+ mc->desc = "Xilinx ZynqMP EP108 board (Deprecated, please use xlnx-zcu102)";
23
mc->init = xlnx_ep108_init;
24
mc->block_default_type = IF_IDE;
25
mc->units_per_default_bus = 1;
26
--
27
2.7.4
28
29
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
Deleted patch
1
From: Richard Henderson <richard.henderson@linaro.org>
2
1
3
Instead of copying addr to a local temp, reuse the value (which we
4
have just compared as equal) already saved in cpu_exclusive_addr.
5
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
8
Message-id: 20170908163859.29820-1-richard.henderson@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
target/arm/translate-a64.c | 26 +++++++++-----------------
12
1 file changed, 9 insertions(+), 17 deletions(-)
13
14
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/translate-a64.c
17
+++ b/target/arm/translate-a64.c
18
@@ -XXX,XX +XXX,XX @@ static void gen_load_exclusive(DisasContext *s, int rt, int rt2,
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
{
25
/* if (env->exclusive_addr == addr && env->exclusive_val == [addr]
26
* && (!is_pair || env->exclusive_high == [addr + datasize])) {
27
@@ -XXX,XX +XXX,XX @@ static void gen_store_exclusive(DisasContext *s, int rd, int rt, int rt2,
28
*/
29
TCGLabel *fail_label = gen_new_label();
30
TCGLabel *done_label = gen_new_label();
31
- TCGv_i64 addr = tcg_temp_local_new_i64();
32
TCGv_i64 tmp;
33
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
--
78
2.7.4
79
80
diff view generated by jsdifflib
Deleted patch
1
From: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
2
1
3
To implement INTx to gsi routing we need to pass the gpex host
4
bridge the gsi associated to each INTx index. Let's introduce
5
irq_num array and gpex_set_irq_num setter function.
6
7
Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
8
Signed-off-by: Tushar Jagad <tushar.jagad@linaro.org>
9
Signed-off-by: Eric Auger <eric.auger@redhat.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>
14
---
15
include/hw/pci-host/gpex.h | 3 +++
16
hw/pci-host/gpex.c | 10 ++++++++++
17
2 files changed, 13 insertions(+)
18
19
diff --git a/include/hw/pci-host/gpex.h b/include/hw/pci-host/gpex.h
20
index XXXXXXX..XXXXXXX 100644
21
--- a/include/hw/pci-host/gpex.h
22
+++ b/include/hw/pci-host/gpex.h
23
@@ -XXX,XX +XXX,XX @@ typedef struct GPEXHost {
24
MemoryRegion io_ioport;
25
MemoryRegion io_mmio;
26
qemu_irq irq[GPEX_NUM_IRQS];
27
+ int irq_num[GPEX_NUM_IRQS];
28
} GPEXHost;
29
30
+int gpex_set_irq_num(GPEXHost *s, int index, int gsi);
31
+
32
#endif /* HW_GPEX_H */
33
diff --git a/hw/pci-host/gpex.c b/hw/pci-host/gpex.c
34
index XXXXXXX..XXXXXXX 100644
35
--- a/hw/pci-host/gpex.c
36
+++ b/hw/pci-host/gpex.c
37
@@ -XXX,XX +XXX,XX @@ static void gpex_set_irq(void *opaque, int irq_num, int level)
38
qemu_set_irq(s->irq[irq_num], level);
39
}
40
41
+int gpex_set_irq_num(GPEXHost *s, int index, int gsi)
42
+{
43
+ if (index >= GPEX_NUM_IRQS) {
44
+ return -EINVAL;
45
+ }
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
2.7.4
56
57
diff view generated by jsdifflib
Deleted patch
1
Fix an error that meant we were wiring every UART's overflow
2
interrupts into the same inputs 0 and 1 of the OR gate,
3
rather than giving each its own input.
4
1
5
Cc: qemu-stable@nongnu.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: 1505232834-20890-1-git-send-email-peter.maydell@linaro.org
10
---
11
hw/arm/mps2.c | 4 ++--
12
1 file changed, 2 insertions(+), 2 deletions(-)
13
14
diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/arm/mps2.c
17
+++ b/hw/arm/mps2.c
18
@@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine)
19
cmsdk_apb_uart_create(uartbase[i],
20
qdev_get_gpio_in(txrx_orgate_dev, 0),
21
qdev_get_gpio_in(txrx_orgate_dev, 1),
22
- qdev_get_gpio_in(orgate_dev, 0),
23
- qdev_get_gpio_in(orgate_dev, 1),
24
+ qdev_get_gpio_in(orgate_dev, i * 2),
25
+ qdev_get_gpio_in(orgate_dev, i * 2 + 1),
26
NULL,
27
uartchr, SYSCLK_FRQ);
28
}
29
--
30
2.7.4
31
32
diff view generated by jsdifflib