1
ARM queue: nothing particularly exciting, but 18 patches
1
Arm queue; bugfixes only.
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 48aa8f0ac536db3550a35c295ff7de94e4c33739:
8
7
9
Merge remote-tracking branch 'remotes/dgilbert/tags/pull-hmp-20170914' into staging (2017-09-14 16:33:02 +0100)
8
Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2020-11-16' into staging (2020-11-17 11:07:00 +0000)
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-20201117
14
13
15
for you to fetch changes up to ce3bc112cdb1d462e2d52eaa17a7314e7f3af504:
14
for you to fetch changes up to ab135622cf478585bdfcb68b85e4a817d74a0c42:
16
15
17
mps2-an511: Fix wiring of UART overflow interrupt lines (2017-09-14 18:43:19 +0100)
16
tmp105: Correct handling of temperature limit checks (2020-11-17 12:56:33 +0000)
18
17
19
----------------------------------------------------------------
18
----------------------------------------------------------------
20
target-arm queue:
19
target-arm queue:
21
* v7M: various code cleanups
20
* hw/arm/virt: ARM_VIRT must select ARM_GIC
22
* v7M: set correct BFSR bits on bus fault
21
* exynos: Fix bad printf format specifiers
23
* v7M: clear exclusive monitor on reset and exception entry/exit
22
* hw/input/ps2.c: Remove remnants of printf debug
24
* v7M: don't apply priority mask to negative priorities
23
* target/openrisc: Remove dead code attempting to check "is timer disabled"
25
* zcu102: support 'secure' and 'virtualization' machine properties
24
* register: Remove unnecessary NULL check
26
* aarch64: fix ERET single stepping
25
* util/cutils: Fix Coverity array overrun in freq_to_str()
27
* gpex: implement PCI INTx routing
26
* configure: Make "does libgio work" test pull in some actual functions
28
* mps2-an511: fix UART overflow interrupt line wiring
27
* tmp105: reset the T_low and T_High registers
28
* tmp105: Correct handling of temperature limit checks
29
29
30
----------------------------------------------------------------
30
----------------------------------------------------------------
31
Alistair Francis (5):
31
Alex Chen (1):
32
xlnx-ep108: Rename to ZCU102
32
exynos: Fix bad printf format specifiers
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
33
38
Jaroslaw Pelczar (1):
34
Alistair Francis (1):
39
AArch64: Fix single stepping of ERET instruction
35
register: Remove unnecessary NULL check
40
36
41
Peter Maydell (8):
37
Andrew Jones (1):
42
target/arm: Use M_REG_NUM_BANKS rather than hardcoding 2
38
hw/arm/virt: ARM_VIRT must select ARM_GIC
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
39
51
Pranavkumar Sawargaonkar (3):
40
Peter Maydell (5):
52
hw/pci-host/gpex: Set INTx index/gsi mapping
41
hw/input/ps2.c: Remove remnants of printf debug
53
hw/arm/virt: Set INTx/gsi mapping
42
target/openrisc: Remove dead code attempting to check "is timer disabled"
54
hw/pci-host/gpex: Implement PCI INTx routing
43
configure: Make "does libgio work" test pull in some actual functions
44
hw/misc/tmp105: reset the T_low and T_High registers
45
tmp105: Correct handling of temperature limit checks
55
46
56
Richard Henderson (1):
47
Philippe Mathieu-Daudé (1):
57
target/arm: Avoid an extra temporary for store_exclusive
48
util/cutils: Fix Coverity array overrun in freq_to_str()
58
49
59
hw/arm/Makefile.objs | 2 +-
50
configure | 11 +++++--
60
include/hw/arm/xlnx-zynqmp.h | 2 +
51
hw/misc/tmp105.h | 7 +++++
61
include/hw/pci-host/gpex.h | 3 +
52
hw/core/register.c | 4 ---
62
target/arm/cpu.h | 35 +++---
53
hw/input/ps2.c | 9 ------
63
target/arm/internals.h | 20 ++++
54
hw/misc/tmp105.c | 73 ++++++++++++++++++++++++++++++++++++++------
64
hw/arm/mps2.c | 4 +-
55
hw/timer/exynos4210_mct.c | 4 +--
65
hw/arm/virt.c | 1 +
56
hw/timer/exynos4210_pwm.c | 8 ++---
66
hw/arm/xlnx-ep108.c | 139 -----------------------
57
target/openrisc/sys_helper.c | 3 --
67
hw/arm/xlnx-zcu102.c | 259 +++++++++++++++++++++++++++++++++++++++++++
58
util/cutils.c | 3 +-
68
hw/arm/xlnx-zynqmp.c | 3 +-
59
hw/arm/Kconfig | 1 +
69
hw/intc/armv7m_nvic.c | 11 +-
60
10 files changed, 89 insertions(+), 34 deletions(-)
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
61
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: Andrew Jones <drjones@redhat.com>
2
2
3
Let's provide the GPEX host bridge with the INTx/gsi mapping. This is
3
The removal of the selection of A15MPCORE from ARM_VIRT also
4
needed for INTx/gsi routing.
4
removed what A15MPCORE selects, ARM_GIC. We still need ARM_GIC.
5
5
6
Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
6
Fixes: bec3c97e0cf9 ("hw/arm/virt: Remove dependency on Cortex-A15 MPCore peripherals")
7
Signed-off-by: Tushar Jagad <tushar.jagad@linaro.org>
7
Reported-by: Miroslav Rezanina <mrezanin@redhat.com>
8
Signed-off-by: Eric Auger <eric.auger@redhat.com>
8
Signed-off-by: Andrew Jones <drjones@redhat.com>
9
Reviewed-by: Andrew Jones <drjones@redhat.com>
9
Reviewed-by: Miroslav Rezanina <mrezanin@redhat.com>
10
Tested-by: Feng Kan <fkan@apm.com>
10
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
11
Message-id: 1505296004-6798-3-git-send-email-eric.auger@redhat.com
11
Message-id: 20201111143440.112763-1-drjones@redhat.com
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/Kconfig | 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/Kconfig b/hw/arm/Kconfig
18
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/arm/virt.c
19
--- a/hw/arm/Kconfig
20
+++ b/hw/arm/virt.c
20
+++ b/hw/arm/Kconfig
21
@@ -XXX,XX +XXX,XX @@ static void create_pcie(const VirtMachineState *vms, qemu_irq *pic)
21
@@ -XXX,XX +XXX,XX @@ config ARM_VIRT
22
22
imply VFIO_PLATFORM
23
for (i = 0; i < GPEX_NUM_IRQS; i++) {
23
imply VFIO_XGMAC
24
sysbus_connect_irq(SYS_BUS_DEVICE(dev), i, pic[irq + i]);
24
imply TPM_TIS_SYSBUS
25
+ gpex_set_irq_num(GPEX_HOST(dev), i, irq + i);
25
+ select ARM_GIC
26
}
26
select ACPI
27
27
select ARM_SMMUV3
28
pci = PCI_HOST_BRIDGE(dev);
28
select GPIO_KEY
29
--
29
--
30
2.7.4
30
2.20.1
31
31
32
32
diff view generated by jsdifflib
1
From: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
1
From: Alex Chen <alex.chen@huawei.com>
2
2
3
To implement INTx to gsi routing we need to pass the gpex host
3
We should use printf format specifier "%u" instead of "%d" for
4
bridge the gsi associated to each INTx index. Let's introduce
4
argument of type "unsigned int".
5
irq_num array and gpex_set_irq_num setter function.
6
5
7
Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
6
Reported-by: Euler Robot <euler.robot@huawei.com>
8
Signed-off-by: Tushar Jagad <tushar.jagad@linaro.org>
7
Signed-off-by: Alex Chen <alex.chen@huawei.com>
9
Signed-off-by: Eric Auger <eric.auger@redhat.com>
8
Message-id: 20201111073651.72804-1-alex.chen@huawei.com
10
Tested-by: Feng Kan <fkan@apm.com>
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
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>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
---
11
---
15
include/hw/pci-host/gpex.h | 3 +++
12
hw/timer/exynos4210_mct.c | 4 ++--
16
hw/pci-host/gpex.c | 10 ++++++++++
13
hw/timer/exynos4210_pwm.c | 8 ++++----
17
2 files changed, 13 insertions(+)
14
2 files changed, 6 insertions(+), 6 deletions(-)
18
15
19
diff --git a/include/hw/pci-host/gpex.h b/include/hw/pci-host/gpex.h
16
diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c
20
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
21
--- a/include/hw/pci-host/gpex.h
18
--- a/hw/timer/exynos4210_mct.c
22
+++ b/include/hw/pci-host/gpex.h
19
+++ b/hw/timer/exynos4210_mct.c
23
@@ -XXX,XX +XXX,XX @@ typedef struct GPEXHost {
20
@@ -XXX,XX +XXX,XX @@ static void exynos4210_gcomp_raise_irq(void *opaque, uint32_t id)
24
MemoryRegion io_ioport;
21
/* If CSTAT is pending and IRQ is enabled */
25
MemoryRegion io_mmio;
22
if ((s->reg.int_cstat & G_INT_CSTAT_COMP(id)) &&
26
qemu_irq irq[GPEX_NUM_IRQS];
23
(s->reg.int_enb & G_INT_ENABLE(id))) {
27
+ int irq_num[GPEX_NUM_IRQS];
24
- DPRINTF("gcmp timer[%d] IRQ\n", id);
28
} GPEXHost;
25
+ DPRINTF("gcmp timer[%u] IRQ\n", id);
29
26
qemu_irq_raise(s->irq[id]);
30
+int gpex_set_irq_num(GPEXHost *s, int index, int gsi);
27
}
31
+
28
}
32
#endif /* HW_GPEX_H */
29
@@ -XXX,XX +XXX,XX @@ static void exynos4210_mct_update_freq(Exynos4210MCTState *s)
33
diff --git a/hw/pci-host/gpex.c b/hw/pci-host/gpex.c
30
MCT_CFG_GET_DIVIDER(s->reg_mct_cfg));
31
32
if (freq != s->freq) {
33
- DPRINTF("freq=%dHz\n", s->freq);
34
+ DPRINTF("freq=%uHz\n", s->freq);
35
36
/* global timer */
37
tx_ptimer_set_freq(s->g_timer.ptimer_frc, s->freq);
38
diff --git a/hw/timer/exynos4210_pwm.c b/hw/timer/exynos4210_pwm.c
34
index XXXXXXX..XXXXXXX 100644
39
index XXXXXXX..XXXXXXX 100644
35
--- a/hw/pci-host/gpex.c
40
--- a/hw/timer/exynos4210_pwm.c
36
+++ b/hw/pci-host/gpex.c
41
+++ b/hw/timer/exynos4210_pwm.c
37
@@ -XXX,XX +XXX,XX @@ static void gpex_set_irq(void *opaque, int irq_num, int level)
42
@@ -XXX,XX +XXX,XX @@ static void exynos4210_pwm_update_freq(Exynos4210PWMState *s, uint32_t id)
38
qemu_set_irq(s->irq[irq_num], level);
43
44
if (freq != s->timer[id].freq) {
45
ptimer_set_freq(s->timer[id].ptimer, s->timer[id].freq);
46
- DPRINTF("freq=%dHz\n", s->timer[id].freq);
47
+ DPRINTF("freq=%uHz\n", s->timer[id].freq);
48
}
39
}
49
}
40
50
41
+int gpex_set_irq_num(GPEXHost *s, int index, int gsi)
51
@@ -XXX,XX +XXX,XX @@ static void exynos4210_pwm_tick(void *opaque)
42
+{
52
uint32_t id = s->id;
43
+ if (index >= GPEX_NUM_IRQS) {
53
bool cmp;
44
+ return -EINVAL;
54
45
+ }
55
- DPRINTF("timer %d tick\n", id);
46
+
56
+ DPRINTF("timer %u tick\n", id);
47
+ s->irq_num[index] = gsi;
57
48
+ return 0;
58
/* set irq status */
49
+}
59
p->reg_tint_cstat |= TINT_CSTAT_STATUS(id);
50
+
60
51
static void gpex_host_realize(DeviceState *dev, Error **errp)
61
/* raise IRQ */
52
{
62
if (p->reg_tint_cstat & TINT_CSTAT_ENABLE(id)) {
53
PCIHostState *pci = PCI_HOST_BRIDGE(dev);
63
- DPRINTF("timer %d IRQ\n", id);
64
+ DPRINTF("timer %u IRQ\n", id);
65
qemu_irq_raise(p->timer[id].irq);
66
}
67
68
@@ -XXX,XX +XXX,XX @@ static void exynos4210_pwm_tick(void *opaque)
69
}
70
71
if (cmp) {
72
- DPRINTF("auto reload timer %d count to %x\n", id,
73
+ DPRINTF("auto reload timer %u count to %x\n", id,
74
p->timer[id].reg_tcntb);
75
ptimer_set_count(p->timer[id].ptimer, p->timer[id].reg_tcntb);
76
ptimer_run(p->timer[id].ptimer, 1);
54
--
77
--
55
2.7.4
78
2.20.1
56
79
57
80
diff view generated by jsdifflib
1
For a bus fault, the M profile BFSR bit PRECISERR means a bus
1
In commit 5edab03d4040 we added tracepoints to the ps2 keyboard
2
fault on a data access, and IBUSERR means a bus fault on an
2
and mouse emulation. However we didn't remove all the debug-by-printf
3
instruction access. We had these the wrong way around; fix this.
3
support. In fact there is only one printf() remaining, and it is
4
redundant with the trace_ps2_write_mouse() event next to it.
5
Remove the printf() and the now-unused DEBUG* macros.
4
6
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
8
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
8
Message-id: 1505137930-13255-4-git-send-email-peter.maydell@linaro.org
10
Message-id: 20201101133258.4240-1-peter.maydell@linaro.org
9
---
11
---
10
target/arm/helper.c | 8 ++++----
12
hw/input/ps2.c | 9 ---------
11
1 file changed, 4 insertions(+), 4 deletions(-)
13
1 file changed, 9 deletions(-)
12
14
13
diff --git a/target/arm/helper.c b/target/arm/helper.c
15
diff --git a/hw/input/ps2.c b/hw/input/ps2.c
14
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/helper.c
17
--- a/hw/input/ps2.c
16
+++ b/target/arm/helper.c
18
+++ b/hw/input/ps2.c
17
@@ -XXX,XX +XXX,XX @@ void arm_v7m_cpu_do_interrupt(CPUState *cs)
19
@@ -XXX,XX +XXX,XX @@
18
case 0x8: /* External Abort */
20
19
switch (cs->exception_index) {
21
#include "trace.h"
20
case EXCP_PREFETCH_ABORT:
22
21
- env->v7m.cfsr[M_REG_NS] |= R_V7M_CFSR_PRECISERR_MASK;
23
-/* debug PC keyboard */
22
- qemu_log_mask(CPU_LOG_INT, "...with CFSR.PRECISERR\n");
24
-//#define DEBUG_KBD
23
+ env->v7m.cfsr[M_REG_NS] |= R_V7M_CFSR_IBUSERR_MASK;
25
-
24
+ qemu_log_mask(CPU_LOG_INT, "...with CFSR.IBUSERR\n");
26
-/* debug PC keyboard : only mouse */
25
break;
27
-//#define DEBUG_MOUSE
26
case EXCP_DATA_ABORT:
28
-
27
env->v7m.cfsr[M_REG_NS] |=
29
/* Keyboard Commands */
28
- (R_V7M_CFSR_IBUSERR_MASK | R_V7M_CFSR_BFARVALID_MASK);
30
#define KBD_CMD_SET_LEDS    0xED    /* Set keyboard leds */
29
+ (R_V7M_CFSR_PRECISERR_MASK | R_V7M_CFSR_BFARVALID_MASK);
31
#define KBD_CMD_ECHO     0xEE
30
env->v7m.bfar = env->exception.vaddress;
32
@@ -XXX,XX +XXX,XX @@ void ps2_write_mouse(void *opaque, int val)
31
qemu_log_mask(CPU_LOG_INT,
33
PS2MouseState *s = (PS2MouseState *)opaque;
32
- "...with CFSR.IBUSERR and BFAR 0x%x\n",
34
33
+ "...with CFSR.PRECISERR and BFAR 0x%x\n",
35
trace_ps2_write_mouse(opaque, val);
34
env->v7m.bfar);
36
-#ifdef DEBUG_MOUSE
35
break;
37
- printf("kbd: write mouse 0x%02x\n", val);
36
}
38
-#endif
39
switch(s->common.write_cmd) {
40
default:
41
case -1:
37
--
42
--
38
2.7.4
43
2.20.1
39
44
40
45
diff view generated by jsdifflib
1
Fix an error that meant we were wiring every UART's overflow
1
In the mtspr helper we attempt to check for "is the timer disabled"
2
interrupts into the same inputs 0 and 1 of the OR gate,
2
with "if (env->ttmr & TIMER_NONE)". This is wrong because TIMER_NONE
3
rather than giving each its own input.
3
is zero and the condition is always false (Coverity complains about
4
the dead code.)
4
5
5
Cc: qemu-stable@nongnu.org
6
The correct check would be to test whether the TTMR_M field in the
7
register is equal to TIMER_NONE instead. However, the
8
cpu_openrisc_timer_update() function checks whether the timer is
9
enabled (it looks at cpu->env.is_counting, which is set to 0 via
10
cpu_openrisc_count_stop() when the TTMR_M field is set to
11
TIMER_NONE), so there's no need to check for "timer disabled" in the
12
target/openrisc code. Instead, simply remove the dead code.
13
14
Fixes: Coverity CID 1005812
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
16
Acked-by: Stafford Horne <shorne@gmail.com>
8
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
17
Message-id: 20201103114654.18540-1-peter.maydell@linaro.org
9
Message-id: 1505232834-20890-1-git-send-email-peter.maydell@linaro.org
10
---
18
---
11
hw/arm/mps2.c | 4 ++--
19
target/openrisc/sys_helper.c | 3 ---
12
1 file changed, 2 insertions(+), 2 deletions(-)
20
1 file changed, 3 deletions(-)
13
21
14
diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c
22
diff --git a/target/openrisc/sys_helper.c b/target/openrisc/sys_helper.c
15
index XXXXXXX..XXXXXXX 100644
23
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/arm/mps2.c
24
--- a/target/openrisc/sys_helper.c
17
+++ b/hw/arm/mps2.c
25
+++ b/target/openrisc/sys_helper.c
18
@@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine)
26
@@ -XXX,XX +XXX,XX @@ void HELPER(mtspr)(CPUOpenRISCState *env, target_ulong spr, target_ulong rb)
19
cmsdk_apb_uart_create(uartbase[i],
27
20
qdev_get_gpio_in(txrx_orgate_dev, 0),
28
case TO_SPR(10, 1): /* TTCR */
21
qdev_get_gpio_in(txrx_orgate_dev, 1),
29
cpu_openrisc_count_set(cpu, rb);
22
- qdev_get_gpio_in(orgate_dev, 0),
30
- if (env->ttmr & TIMER_NONE) {
23
- qdev_get_gpio_in(orgate_dev, 1),
31
- return;
24
+ qdev_get_gpio_in(orgate_dev, i * 2),
32
- }
25
+ qdev_get_gpio_in(orgate_dev, i * 2 + 1),
33
cpu_openrisc_timer_update(cpu);
26
NULL,
34
break;
27
uartchr, SYSCLK_FRQ);
35
#endif
28
}
29
--
36
--
30
2.7.4
37
2.20.1
31
38
32
39
diff view generated by jsdifflib
1
From: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
1
From: Alistair Francis <alistair.francis@wdc.com>
2
2
3
Now we are able to retrieve the gsi from the INTx pin, let's
3
This patch fixes CID 1432800 by removing an unnecessary check.
4
enable intx_to_irq routing. From that point on, irqfd becomes
5
usable along with INTx when assigning a PCIe device.
6
4
7
Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
5
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
8
Signed-off-by: Tushar Jagad <tushar.jagad@linaro.org>
6
Reviewed-by: Peter Maydell <peter.maydell@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>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
---
8
---
15
hw/pci-host/gpex.c | 12 ++++++++++++
9
hw/core/register.c | 4 ----
16
1 file changed, 12 insertions(+)
10
1 file changed, 4 deletions(-)
17
11
18
diff --git a/hw/pci-host/gpex.c b/hw/pci-host/gpex.c
12
diff --git a/hw/core/register.c b/hw/core/register.c
19
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
20
--- a/hw/pci-host/gpex.c
14
--- a/hw/core/register.c
21
+++ b/hw/pci-host/gpex.c
15
+++ b/hw/core/register.c
22
@@ -XXX,XX +XXX,XX @@ int gpex_set_irq_num(GPEXHost *s, int index, int gsi)
16
@@ -XXX,XX +XXX,XX @@ static RegisterInfoArray *register_init_block(DeviceState *owner,
23
return 0;
17
int index = rae[i].addr / data_size;
24
}
18
RegisterInfo *r = &ri[index];
25
19
26
+static PCIINTxRoute gpex_route_intx_pin_to_irq(void *opaque, int pin)
20
- if (data + data_size * index == 0 || !&rae[i]) {
27
+{
21
- continue;
28
+ PCIINTxRoute route;
22
- }
29
+ GPEXHost *s = opaque;
23
-
30
+
24
/* Init the register, this will zero it. */
31
+ route.mode = PCI_INTX_ENABLED;
25
object_initialize((void *)r, sizeof(*r), TYPE_REGISTER);
32
+ route.irq = s->irq_num[pin];
33
+
34
+ return route;
35
+}
36
+
37
static void gpex_host_realize(DeviceState *dev, Error **errp)
38
{
39
PCIHostState *pci = PCI_HOST_BRIDGE(dev);
40
@@ -XXX,XX +XXX,XX @@ static void gpex_host_realize(DeviceState *dev, Error **errp)
41
&s->io_ioport, 0, 4, TYPE_PCIE_BUS);
42
43
qdev_set_parent_bus(DEVICE(&s->gpex_root), BUS(pci->bus));
44
+ pci_bus_set_route_irq_fn(pci->bus, gpex_route_intx_pin_to_irq);
45
qdev_init_nofail(DEVICE(&s->gpex_root));
46
}
47
26
48
--
27
--
49
2.7.4
28
2.20.1
50
29
51
30
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
2
3
Instead of copying addr to a local temp, reuse the value (which we
3
Fix Coverity CID 1435957: Memory - illegal accesses (OVERRUN):
4
have just compared as equal) already saved in cpu_exclusive_addr.
5
4
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5
>>> Overrunning array "suffixes" of 7 8-byte elements at element
7
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
6
index 7 (byte offset 63) using index "idx" (which evaluates to 7).
8
Message-id: 20170908163859.29820-1-richard.henderson@linaro.org
7
8
Note, the biggest input value freq_to_str() can accept is UINT64_MAX,
9
which is ~18.446 EHz, less than 1000 EHz.
10
11
Reported-by: Eduardo Habkost <ehabkost@redhat.com>
12
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
13
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
14
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
15
Reviewed-by: Luc Michel <luc@lmichel.fr>
16
Message-id: 20201101215755.2021421-1-f4bug@amsat.org
17
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
18
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
20
---
11
target/arm/translate-a64.c | 26 +++++++++-----------------
21
util/cutils.c | 3 ++-
12
1 file changed, 9 insertions(+), 17 deletions(-)
22
1 file changed, 2 insertions(+), 1 deletion(-)
13
23
14
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
24
diff --git a/util/cutils.c b/util/cutils.c
15
index XXXXXXX..XXXXXXX 100644
25
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/translate-a64.c
26
--- a/util/cutils.c
17
+++ b/target/arm/translate-a64.c
27
+++ b/util/cutils.c
18
@@ -XXX,XX +XXX,XX @@ static void gen_load_exclusive(DisasContext *s, int rt, int rt2,
28
@@ -XXX,XX +XXX,XX @@ char *freq_to_str(uint64_t freq_hz)
29
double freq = freq_hz;
30
size_t idx = 0;
31
32
- while (freq >= 1000.0 && idx < ARRAY_SIZE(suffixes)) {
33
+ while (freq >= 1000.0) {
34
freq /= 1000.0;
35
idx++;
36
}
37
+ assert(idx < ARRAY_SIZE(suffixes));
38
39
return g_strdup_printf("%0.3g %sHz", freq, suffixes[idx]);
19
}
40
}
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
--
41
--
78
2.7.4
42
2.20.1
79
43
80
44
diff view generated by jsdifflib
1
In several places we were unconditionally applying the
1
In commit 76346b6264a9b01979 we tried to add a configure check that
2
nvic_gprio_mask() to a priority value. This is incorrect
2
the libgio pkg-config data was correct, which builds an executable
3
if the priority is one of the fixed negative priority
3
linked against it. Unfortunately this doesn't catch the problem
4
values (for NMI and HardFault), so don't do it.
4
(missing static library dependency info), because a "do nothing" test
5
source file doesn't have any symbol references that cause the linker
6
to pull in .o files from libgio.a, and so we don't see the "missing
7
symbols from libmount" error that a full QEMU link triggers.
5
8
6
This bug would have caused both NMI and HardFault to be
9
(The ineffective test went unnoticed because of a typo that
7
considered as the same priority and so NMI wouldn't
10
effectively disabled libgio unconditionally, but after commit
8
correctly preempt HardFault.
11
3569a5dfc11f2 fixed that, a static link of the system emulator on
12
Ubuntu stopped working again.)
13
14
Improve the gio test by having the test source fragment reference a
15
g_dbus function (which is what is indirectly causing us to end up
16
wanting functions from libmount).
9
17
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
19
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
12
Message-id: 1505137930-13255-5-git-send-email-peter.maydell@linaro.org
20
Message-id: 20201116104617.18333-1-peter.maydell@linaro.org
13
---
21
---
14
hw/intc/armv7m_nvic.c | 11 +++++++++--
22
configure | 11 +++++++++--
15
1 file changed, 9 insertions(+), 2 deletions(-)
23
1 file changed, 9 insertions(+), 2 deletions(-)
16
24
17
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
25
diff --git a/configure b/configure
18
index XXXXXXX..XXXXXXX 100644
26
index XXXXXXX..XXXXXXX 100755
19
--- a/hw/intc/armv7m_nvic.c
27
--- a/configure
20
+++ b/hw/intc/armv7m_nvic.c
28
+++ b/configure
21
@@ -XXX,XX +XXX,XX @@ static void nvic_recompute_state(NVICState *s)
29
@@ -XXX,XX +XXX,XX @@ if $pkg_config --atleast-version=$glib_req_ver gio-2.0; then
22
}
30
# Check that the libraries actually work -- Ubuntu 18.04 ships
23
}
31
# with pkg-config --static --libs data for gio-2.0 that is missing
24
32
# -lblkid and will give a link error.
25
+ if (active_prio > 0) {
33
- write_c_skeleton
26
+ active_prio &= nvic_gprio_mask(s);
34
- if compile_prog "" "$gio_libs" ; then
27
+ }
35
+ cat > $TMPC <<EOF
28
+
36
+#include <gio/gio.h>
29
s->vectpending = pend_irq;
37
+int main(void)
30
- s->exception_prio = active_prio & nvic_gprio_mask(s);
38
+{
31
+ s->exception_prio = active_prio;
39
+ g_dbus_proxy_new_sync(0, 0, 0, 0, 0, 0, 0, 0);
32
40
+ return 0;
33
trace_nvic_recompute_state(s->vectpending, s->exception_prio);
41
+}
34
}
42
+EOF
35
@@ -XXX,XX +XXX,XX @@ void armv7m_nvic_acknowledge_irq(void *opaque)
43
+ if compile_prog "$gio_cflags" "$gio_libs" ; then
36
assert(vec->enabled);
44
gio=yes
37
assert(vec->pending);
45
else
38
46
gio=no
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
--
47
--
48
2.7.4
48
2.20.1
49
49
50
50
diff view generated by jsdifflib
1
For M profile we must clear the exclusive monitor on reset, exception
1
The TMP105 datasheet (https://www.ti.com/lit/gpn/tmp105) says that the
2
entry and exception exit. We weren't doing any of these things; fix
2
power-up reset values for the T_low and T_high registers are 80 degrees C
3
this bug.
3
and 75 degrees C, which are 0x500 and 0x4B0 hex according to table 5. These
4
values are then shifted right by four bits to give the register reset
5
values, since both registers store the 12 bits of temperature data in bits
6
[15..4] of a 16 bit register.
7
8
We were resetting these registers to zero, which is problematic for Linux
9
guests which enable the alert interrupt and then immediately take an
10
unexpected overtemperature alert because the current temperature is above
11
freezing...
4
12
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
14
Reviewed-by: Cédric Le Goater <clg@kaod.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
15
Message-id: 20201110150023.25533-2-peter.maydell@linaro.org
8
Message-id: 1505137930-13255-3-git-send-email-peter.maydell@linaro.org
9
---
16
---
10
target/arm/internals.h | 10 ++++++++++
17
hw/misc/tmp105.c | 3 +++
11
target/arm/cpu.c | 6 ++++++
18
1 file changed, 3 insertions(+)
12
target/arm/helper.c | 2 ++
13
target/arm/op_helper.c | 2 +-
14
4 files changed, 19 insertions(+), 1 deletion(-)
15
19
16
diff --git a/target/arm/internals.h b/target/arm/internals.h
20
diff --git a/hw/misc/tmp105.c b/hw/misc/tmp105.c
17
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/internals.h
22
--- a/hw/misc/tmp105.c
19
+++ b/target/arm/internals.h
23
+++ b/hw/misc/tmp105.c
20
@@ -XXX,XX +XXX,XX @@ void arm_handle_psci_call(ARMCPU *cpu);
24
@@ -XXX,XX +XXX,XX @@ static void tmp105_reset(I2CSlave *i2c)
21
#endif
25
s->faults = tmp105_faultq[(s->config >> 3) & 3];
22
26
s->alarm = 0;
23
/**
27
24
+ * arm_clear_exclusive: clear the exclusive monitor
28
+ s->limit[0] = 0x4b00; /* T_LOW, 75 degrees C */
25
+ * @env: CPU env
29
+ s->limit[1] = 0x5000; /* T_HIGH, 80 degrees C */
26
+ * Clear the CPU's exclusive monitor, like the guest CLREX instruction.
27
+ */
28
+static inline void arm_clear_exclusive(CPUARMState *env)
29
+{
30
+ env->exclusive_addr = -1;
31
+}
32
+
30
+
33
+/**
31
tmp105_interrupt_update(s);
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
55
index XXXXXXX..XXXXXXX 100644
56
--- a/target/arm/helper.c
57
+++ b/target/arm/helper.c
58
@@ -XXX,XX +XXX,XX @@ static void v7m_exception_taken(ARMCPU *cpu, uint32_t lr)
59
60
armv7m_nvic_acknowledge_irq(env->nvic);
61
switch_v7m_sp(env, 0);
62
+ arm_clear_exclusive(env);
63
/* Clear IT bits */
64
env->condexec_bits = 0;
65
env->regs[14] = lr;
66
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
67
}
68
69
/* Otherwise, we have a successful exception exit. */
70
+ arm_clear_exclusive(env);
71
qemu_log_mask(CPU_LOG_INT, "...successful exception return\n");
72
}
32
}
73
33
74
diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c
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
--
34
--
88
2.7.4
35
2.20.1
89
36
90
37
diff view generated by jsdifflib
Deleted patch
1
In do_v7m_exception_exit(), there's no need to force the high 4
2
bits of 'type' to 1 when calling v7m_exception_taken(), because
3
we know that they're always 1 or we could not have got to this
4
"handle return to magic exception return address" code. Remove
5
the unnecessary ORs.
6
1
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Acked-by: Alistair Francis <alistair.francis@xilinx.com>
10
Message-id: 1505137930-13255-6-git-send-email-peter.maydell@linaro.org
11
---
12
target/arm/helper.c | 4 ++--
13
1 file changed, 2 insertions(+), 2 deletions(-)
14
15
diff --git a/target/arm/helper.c b/target/arm/helper.c
16
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/helper.c
18
+++ b/target/arm/helper.c
19
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
20
*/
21
env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_INVPC_MASK;
22
armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE);
23
- v7m_exception_taken(cpu, type | 0xf0000000);
24
+ v7m_exception_taken(cpu, type);
25
qemu_log_mask(CPU_LOG_INT, "...taking UsageFault on existing "
26
"stackframe: failed exception return integrity check\n");
27
return;
28
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
29
armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE);
30
env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_INVPC_MASK;
31
v7m_push_stack(cpu);
32
- v7m_exception_taken(cpu, type | 0xf0000000);
33
+ v7m_exception_taken(cpu, type);
34
qemu_log_mask(CPU_LOG_INT, "...taking UsageFault on new stackframe: "
35
"failed exception return integrity check\n");
36
return;
37
--
38
2.7.4
39
40
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
1
In the v7M and v8M ARM ARM, the magic exception return values are
1
The TMP105 datasheet says that in Interrupt Mode (when TM==1) the device
2
referred to as EXC_RETURN values, and in QEMU we use V7M_EXCRET_*
2
signals an alert when the temperature equals or exceeds the T_high value and
3
constants to define bits within them. Rename the 'type' variable
3
then remains high until a device register is read or the device responds to
4
which holds the exception return value in do_v7m_exception_exit()
4
the SMBUS Alert Response address, or the device is put into Shutdown Mode.
5
to excret, making it clearer that it does hold an EXC_RETURN value.
5
Thereafter the Alert pin will only be re-signalled when temperature falls
6
below T_low; alert can then be cleared in the same set of ways, and the
7
device returns to its initial "alert when temperature goes above T_high"
8
mode. (If this textual description is confusing, see figure 3 in the
9
TI datasheet at https://www.ti.com/lit/gpn/tmp105 .)
10
11
We were misimplementing this as a simple "always alert if temperature is
12
above T_high or below T_low" condition, which gives a spurious alert on
13
startup if using the "T_high = 80 degrees C, T_low = 75 degrees C" reset
14
limit values.
15
16
Implement the correct (hysteresis) behaviour by tracking whether we
17
are currently looking for the temperature to rise over T_high or
18
for it to fall below T_low. Our implementation of the comparator
19
mode (TM==0) wasn't wrong, but rephrase it to match the way that
20
interrupt mode is now handled for clarity.
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>
23
Reviewed-by: Cédric Le Goater <clg@kaod.org>
9
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
24
Message-id: 20201110150023.25533-3-peter.maydell@linaro.org
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11
Message-id: 1505137930-13255-8-git-send-email-peter.maydell@linaro.org
12
---
25
---
13
target/arm/helper.c | 23 ++++++++++++-----------
26
hw/misc/tmp105.h | 7 +++++
14
1 file changed, 12 insertions(+), 11 deletions(-)
27
hw/misc/tmp105.c | 70 +++++++++++++++++++++++++++++++++++++++++-------
28
2 files changed, 68 insertions(+), 9 deletions(-)
15
29
16
diff --git a/target/arm/helper.c b/target/arm/helper.c
30
diff --git a/hw/misc/tmp105.h b/hw/misc/tmp105.h
17
index XXXXXXX..XXXXXXX 100644
31
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/helper.c
32
--- a/hw/misc/tmp105.h
19
+++ b/target/arm/helper.c
33
+++ b/hw/misc/tmp105.h
20
@@ -XXX,XX +XXX,XX @@ static void v7m_push_stack(ARMCPU *cpu)
34
@@ -XXX,XX +XXX,XX @@ struct TMP105State {
21
static void do_v7m_exception_exit(ARMCPU *cpu)
35
int16_t limit[2];
22
{
36
int faults;
23
CPUARMState *env = &cpu->env;
37
uint8_t alarm;
24
- uint32_t type;
38
+ /*
25
+ uint32_t excret;
39
+ * The TMP105 initially looks for a temperature rising above T_high;
26
uint32_t xpsr;
40
+ * once this is detected, the condition it looks for next is the
27
bool ufault = false;
41
+ * temperature falling below T_low. This flag is false when initially
28
bool return_to_sp_process = false;
42
+ * looking for T_high, true when looking for T_low.
29
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
43
+ */
30
* the target value up between env->regs[15] and env->thumb in
44
+ bool detect_falling;
31
* gen_bx(). Reconstitute it.
45
};
32
*/
46
33
- type = env->regs[15];
47
#endif
34
+ excret = env->regs[15];
48
diff --git a/hw/misc/tmp105.c b/hw/misc/tmp105.c
35
if (env->thumb) {
49
index XXXXXXX..XXXXXXX 100644
36
- type |= 1;
50
--- a/hw/misc/tmp105.c
37
+ excret |= 1;
51
+++ b/hw/misc/tmp105.c
52
@@ -XXX,XX +XXX,XX @@ static void tmp105_alarm_update(TMP105State *s)
53
return;
38
}
54
}
39
55
40
qemu_log_mask(CPU_LOG_INT, "Exception return: magic PC %" PRIx32
56
- if ((s->config >> 1) & 1) {                    /* TM */
41
" previous exception %d\n",
57
- if (s->temperature >= s->limit[1])
42
- type, env->v7m.exception);
58
- s->alarm = 1;
43
+ excret, env->v7m.exception);
59
- else if (s->temperature < s->limit[0])
44
60
- s->alarm = 1;
45
- if ((type & R_V7M_EXCRET_RES1_MASK) != R_V7M_EXCRET_RES1_MASK) {
61
+ if (s->config >> 1 & 1) {
46
+ if ((excret & R_V7M_EXCRET_RES1_MASK) != R_V7M_EXCRET_RES1_MASK) {
62
+ /*
47
qemu_log_mask(LOG_GUEST_ERROR, "M profile: zero high bits in exception "
63
+ * TM == 1 : Interrupt mode. We signal Alert when the
48
- "exit PC value 0x%" PRIx32 " are UNPREDICTABLE\n", type);
64
+ * temperature rises above T_high, and expect the guest to clear
49
+ "exit PC value 0x%" PRIx32 " are UNPREDICTABLE\n",
65
+ * it (eg by reading a device register).
50
+ excret);
66
+ */
67
+ if (s->detect_falling) {
68
+ if (s->temperature < s->limit[0]) {
69
+ s->alarm = 1;
70
+ s->detect_falling = false;
71
+ }
72
+ } else {
73
+ if (s->temperature >= s->limit[1]) {
74
+ s->alarm = 1;
75
+ s->detect_falling = true;
76
+ }
77
+ }
78
} else {
79
- if (s->temperature >= s->limit[1])
80
- s->alarm = 1;
81
- else if (s->temperature < s->limit[0])
82
- s->alarm = 0;
83
+ /*
84
+ * TM == 0 : Comparator mode. We signal Alert when the temperature
85
+ * rises above T_high, and stop signalling it when the temperature
86
+ * falls below T_low.
87
+ */
88
+ if (s->detect_falling) {
89
+ if (s->temperature < s->limit[0]) {
90
+ s->alarm = 0;
91
+ s->detect_falling = false;
92
+ }
93
+ } else {
94
+ if (s->temperature >= s->limit[1]) {
95
+ s->alarm = 1;
96
+ s->detect_falling = true;
97
+ }
98
+ }
51
}
99
}
52
100
53
if (env->v7m.exception != ARMV7M_EXCP_NMI) {
101
tmp105_interrupt_update(s);
54
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
102
@@ -XXX,XX +XXX,XX @@ static int tmp105_post_load(void *opaque, int version_id)
55
* which security state's faultmask to clear. (v8M ARM ARM R_KBNF.)
103
return 0;
56
*/
104
}
57
if (arm_feature(env, ARM_FEATURE_M_SECURITY)) {
105
58
- int es = type & R_V7M_EXCRET_ES_MASK;
106
+static bool detect_falling_needed(void *opaque)
59
+ int es = excret & R_V7M_EXCRET_ES_MASK;
107
+{
60
if (armv7m_nvic_raw_execution_priority(env->nvic) >= 0) {
108
+ TMP105State *s = opaque;
61
env->v7m.faultmask[es] = 0;
109
+
62
}
110
+ /*
63
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
111
+ * We only need to migrate the detect_falling bool if it's set;
64
g_assert_not_reached();
112
+ * for migration from older machines we assume that it is false
113
+ * (ie temperature is not out of range).
114
+ */
115
+ return s->detect_falling;
116
+}
117
+
118
+static const VMStateDescription vmstate_tmp105_detect_falling = {
119
+ .name = "TMP105/detect-falling",
120
+ .version_id = 1,
121
+ .minimum_version_id = 1,
122
+ .needed = detect_falling_needed,
123
+ .fields = (VMStateField[]) {
124
+ VMSTATE_BOOL(detect_falling, TMP105State),
125
+ VMSTATE_END_OF_LIST()
126
+ }
127
+};
128
+
129
static const VMStateDescription vmstate_tmp105 = {
130
.name = "TMP105",
131
.version_id = 0,
132
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_tmp105 = {
133
VMSTATE_UINT8(alarm, TMP105State),
134
VMSTATE_I2C_SLAVE(i2c, TMP105State),
135
VMSTATE_END_OF_LIST()
136
+ },
137
+ .subsections = (const VMStateDescription*[]) {
138
+ &vmstate_tmp105_detect_falling,
139
+ NULL
65
}
140
}
66
141
};
67
- switch (type & 0xf) {
142
68
+ switch (excret & 0xf) {
143
@@ -XXX,XX +XXX,XX @@ static void tmp105_reset(I2CSlave *i2c)
69
case 1: /* Return to Handler */
144
s->config = 0;
70
return_to_handler = true;
145
s->faults = tmp105_faultq[(s->config >> 3) & 3];
71
break;
146
s->alarm = 0;
72
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
147
+ s->detect_falling = false;
73
*/
148
74
env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_INVPC_MASK;
149
s->limit[0] = 0x4b00; /* T_LOW, 75 degrees C */
75
armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE);
150
s->limit[1] = 0x5000; /* T_HIGH, 80 degrees C */
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
--
151
--
99
2.7.4
152
2.20.1
100
153
101
154
diff view generated by jsdifflib
Deleted patch
1
From: Alistair Francis <alistair.francis@xilinx.com>
2
1
3
The EP108 is a early access development board. Now that silicon is in
4
production people have access to the ZCU102. Let's rename the internal
5
QEMU files and variables to use the ZCU102.
6
7
There is no functional change here as the EP108 is still a valid board
8
option.
9
10
Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
11
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
14
hw/arm/Makefile.objs | 2 +-
15
hw/arm/{xlnx-ep108.c => xlnx-zcu102.c} | 30 +++++++++++++++---------------
16
2 files changed, 16 insertions(+), 16 deletions(-)
17
rename hw/arm/{xlnx-ep108.c => xlnx-zcu102.c} (85%)
18
19
diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs
20
index XXXXXXX..XXXXXXX 100644
21
--- a/hw/arm/Makefile.objs
22
+++ b/hw/arm/Makefile.objs
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 @@
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
{
63
- XlnxEP108 *s = g_new0(XlnxEP108, 1);
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
}
70
71
if (ram_size < 0x08000000) {
72
- qemu_log("WARNING: RAM size 0x%" PRIx64 " is small for EP108",
73
+ qemu_log("WARNING: RAM size 0x%" PRIx64 " is small for ZCU102",
74
ram_size);
75
}
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
}
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
--
113
2.7.4
114
115
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