1
Ten arm-related bug fixes for 2.12...
1
A last small test of bug fixes before rc1.
2
2
3
thanks
3
thanks
4
-- PMM
4
-- PMM
5
5
6
The following changes since commit 4c2c1015905fa1d616750dfe024b4c0b35875950:
6
The following changes since commit ed8ad9728a9c0eec34db9dff61dfa2f1dd625637:
7
7
8
Merge remote-tracking branch 'remotes/borntraeger/tags/s390x-20180323' into staging (2018-03-23 10:20:54 +0000)
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)
9
9
10
are available in the Git repository at:
10
are available in the Git repository at:
11
11
12
git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20180323
12
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20230717
13
13
14
for you to fetch changes up to 548f514cf89dd9ab39c0cb4c063097bccf141fdd:
14
for you to fetch changes up to c2c1c4a35c7c2b1a4140b0942b9797c857e476a4:
15
15
16
target/arm: Always set FAR to a known unknown value for debug exceptions (2018-03-23 18:26:46 +0000)
16
hw/nvram: Avoid unnecessary Xilinx eFuse backstore write (2023-07-17 11:05:52 +0100)
17
17
18
----------------------------------------------------------------
18
----------------------------------------------------------------
19
target-arm queue:
19
target-arm queue:
20
* arm/translate-a64: don't lose interrupts after unmasking via write to DAIF
20
* hw/arm/sbsa-ref: set 'slots' property of xhci
21
* sdhci: fix incorrect use of Error *
21
* linux-user: Remove pointless NULL check in clock_adjtime handling
22
* hw/intc/arm_gicv3: Fix secure-GIC NS ICC_PMR and ICC_RPR accesses
22
* ptw: Fix S1_ptw_translate() debug path
23
* hw/arm/bcm2836: Use the Cortex-A7 instead of Cortex-A15
23
* ptw: Account for FEAT_RME when applying {N}SW, SA bits
24
* i.MX: Support serial RS-232 break properly
24
* accel/tcg: Zero-pad PC in TCG CPU exec trace lines
25
* mach-virt: Set VM's SMBIOS system version to mc->name
25
* hw/nvram: Avoid unnecessary Xilinx eFuse backstore write
26
* target/arm: Honour MDCR_EL2.TDE when routing exceptions due to BKPT/BRK
27
* target/arm: Factor out code to calculate FSR for debug exceptions
28
* target/arm: Set FSR for BKPT, BRK when raising exception
29
* target/arm: Always set FAR to a known unknown value for debug exceptions
30
26
31
----------------------------------------------------------------
27
----------------------------------------------------------------
32
Paolo Bonzini (1):
28
Peter Maydell (5):
33
sdhci: fix incorrect use of Error *
29
linux-user: Remove pointless NULL check in clock_adjtime handling
30
target/arm/ptw.c: Add comments to S1Translate struct fields
31
target/arm: Fix S1_ptw_translate() debug path
32
target/arm/ptw.c: Account for FEAT_RME when applying {N}SW, SA bits
33
accel/tcg: Zero-pad PC in TCG CPU exec trace lines
34
34
35
Peter Maydell (6):
35
Tong Ho (1):
36
hw/intc/arm_gicv3: Fix secure-GIC NS ICC_PMR and ICC_RPR accesses
36
hw/nvram: Avoid unnecessary Xilinx eFuse backstore write
37
hw/arm/bcm2836: Use the Cortex-A7 instead of Cortex-A15
38
target/arm: Honour MDCR_EL2.TDE when routing exceptions due to BKPT/BRK
39
target/arm: Factor out code to calculate FSR for debug exceptions
40
target/arm: Set FSR for BKPT, BRK when raising exception
41
target/arm: Always set FAR to a known unknown value for debug exceptions
42
37
43
Trent Piepho (1):
38
Yuquan Wang (1):
44
i.MX: Support serial RS-232 break properly
39
hw/arm/sbsa-ref: set 'slots' property of xhci
45
40
46
Victor Kamensky (1):
41
accel/tcg/cpu-exec.c | 4 +--
47
arm/translate-a64: treat DISAS_UPDATE as variant of DISAS_EXIT
42
accel/tcg/translate-all.c | 2 +-
48
43
hw/arm/sbsa-ref.c | 1 +
49
Wei Huang (1):
44
hw/nvram/xlnx-efuse.c | 11 ++++--
50
mach-virt: Set VM's SMBIOS system version to mc->name
45
linux-user/syscall.c | 12 +++----
51
46
target/arm/ptw.c | 90 +++++++++++++++++++++++++++++++++++++++++------
52
include/hw/arm/virt.h | 1 +
47
6 files changed, 98 insertions(+), 22 deletions(-)
53
include/hw/char/imx_serial.h | 1 +
54
target/arm/helper.h | 1 +
55
target/arm/internals.h | 25 +++++++++++++++++++++++++
56
hw/arm/bcm2836.c | 2 +-
57
hw/arm/raspi.c | 2 +-
58
hw/arm/virt.c | 8 +++++++-
59
hw/char/imx_serial.c | 5 ++++-
60
hw/intc/arm_gicv3_cpuif.c | 6 +++---
61
hw/sd/sdhci.c | 4 ++--
62
target/arm/helper.c | 1 -
63
target/arm/op_helper.c | 33 ++++++++++++++++++++++-----------
64
target/arm/translate-a64.c | 21 ++++++++++++++++-----
65
target/arm/translate.c | 19 ++++++++++++++-----
66
14 files changed, 98 insertions(+), 31 deletions(-)
67
diff view generated by jsdifflib
Deleted patch
1
From: Victor Kamensky <kamensky@cisco.com>
2
1
3
In OE project 4.15 linux kernel boot hang was observed under
4
single cpu aarch64 qemu. Kernel code was in a loop waiting for
5
vtimer arrival, spinning in TC generated blocks, while interrupt
6
was pending unprocessed. This happened because when qemu tried to
7
handle vtimer interrupt target had interrupts disabled, as
8
result flag indicating TCG exit, cpu->icount_decr.u16.high,
9
was cleared but arm_cpu_exec_interrupt function did not call
10
arm_cpu_do_interrupt to process interrupt. Later when target
11
reenabled interrupts, it happened without exit into main loop, so
12
following code that waited for result of interrupt execution
13
run in infinite loop.
14
15
To solve the problem instructions that operate on CPU sys state
16
(i.e enable/disable interrupt), and marked as DISAS_UPDATE,
17
should be considered as DISAS_EXIT variant, and should be
18
forced to exit back to main loop so qemu will have a chance
19
processing pending CPU state updates, including pending
20
interrupts.
21
22
This change brings consistency with how DISAS_UPDATE is treated
23
in aarch32 case.
24
25
CC: Peter Maydell <peter.maydell@linaro.org>
26
CC: Alex Bennée <alex.bennee@linaro.org>
27
CC: qemu-stable@nongnu.org
28
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
29
Signed-off-by: Victor Kamensky <kamensky@cisco.com>
30
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
31
Message-id: 1521526368-1996-1-git-send-email-kamensky@cisco.com
32
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
33
---
34
target/arm/translate-a64.c | 6 +++---
35
1 file changed, 3 insertions(+), 3 deletions(-)
36
37
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
38
index XXXXXXX..XXXXXXX 100644
39
--- a/target/arm/translate-a64.c
40
+++ b/target/arm/translate-a64.c
41
@@ -XXX,XX +XXX,XX @@ static void aarch64_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)
42
case DISAS_UPDATE:
43
gen_a64_set_pc_im(dc->pc);
44
/* fall through */
45
- case DISAS_JUMP:
46
- tcg_gen_lookup_and_goto_ptr();
47
- break;
48
case DISAS_EXIT:
49
tcg_gen_exit_tb(0);
50
break;
51
+ case DISAS_JUMP:
52
+ tcg_gen_lookup_and_goto_ptr();
53
+ break;
54
case DISAS_NORETURN:
55
case DISAS_SWI:
56
break;
57
--
58
2.16.2
59
60
diff view generated by jsdifflib
Deleted patch
1
From: Paolo Bonzini <pbonzini@redhat.com>
2
1
3
Detected by Coverity (CID 1386072, 1386073, 1386076, 1386077). local_err
4
was unused, and this made the static analyzer unhappy.
5
6
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7
Message-id: 20180320151355.25854-1-pbonzini@redhat.com
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
hw/sd/sdhci.c | 4 ++--
12
1 file changed, 2 insertions(+), 2 deletions(-)
13
14
diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/sd/sdhci.c
17
+++ b/hw/sd/sdhci.c
18
@@ -XXX,XX +XXX,XX @@ static void sdhci_pci_realize(PCIDevice *dev, Error **errp)
19
Error *local_err = NULL;
20
21
sdhci_initfn(s);
22
- sdhci_common_realize(s, errp);
23
+ sdhci_common_realize(s, &local_err);
24
if (local_err) {
25
error_propagate(errp, local_err);
26
return;
27
@@ -XXX,XX +XXX,XX @@ static void sdhci_sysbus_realize(DeviceState *dev, Error ** errp)
28
SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
29
Error *local_err = NULL;
30
31
- sdhci_common_realize(s, errp);
32
+ sdhci_common_realize(s, &local_err);
33
if (local_err) {
34
error_propagate(errp, local_err);
35
return;
36
--
37
2.16.2
38
39
diff view generated by jsdifflib
Deleted patch
1
If the GIC has the security extension support enabled, then a
2
non-secure access to ICC_PMR must take account of the non-secure
3
view of interrupt priorities, where real priorities 0x00..0x7f
4
are secure-only and not visible to the non-secure guest, and
5
priorities 0x80..0xff are shown to the guest as if they were
6
0x00..0xff. We had the logic here wrong:
7
* on reads, the priority is in the secure range if bit 7
8
is clear, not if it is set
9
* on writes, we want to set bit 7, not mask everything else
10
1
11
Our ICC_RPR read code had the same error as ICC_PMR.
12
13
(Compare the GICv3 spec pseudocode functions ICC_RPR_EL1
14
and ICC_PMR_EL1.)
15
16
Fixes: https://bugs.launchpad.net/qemu/+bug/1748434
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
Reviewed-by: Andrew Jones <drjones@redhat.com>
19
Message-id: 20180315133441.24149-1-peter.maydell@linaro.org
20
---
21
hw/intc/arm_gicv3_cpuif.c | 6 +++---
22
1 file changed, 3 insertions(+), 3 deletions(-)
23
24
diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c
25
index XXXXXXX..XXXXXXX 100644
26
--- a/hw/intc/arm_gicv3_cpuif.c
27
+++ b/hw/intc/arm_gicv3_cpuif.c
28
@@ -XXX,XX +XXX,XX @@ static uint64_t icc_pmr_read(CPUARMState *env, const ARMCPRegInfo *ri)
29
/* NS access and Group 0 is inaccessible to NS: return the
30
* NS view of the current priority
31
*/
32
- if (value & 0x80) {
33
+ if ((value & 0x80) == 0) {
34
/* Secure priorities not visible to NS */
35
value = 0;
36
} else if (value != 0xff) {
37
@@ -XXX,XX +XXX,XX @@ static void icc_pmr_write(CPUARMState *env, const ARMCPRegInfo *ri,
38
/* Current PMR in the secure range, don't allow NS to change it */
39
return;
40
}
41
- value = (value >> 1) & 0x80;
42
+ value = (value >> 1) | 0x80;
43
}
44
cs->icc_pmr_el1 = value;
45
gicv3_cpuif_update(cs);
46
@@ -XXX,XX +XXX,XX @@ static uint64_t icc_rpr_read(CPUARMState *env, const ARMCPRegInfo *ri)
47
if (arm_feature(env, ARM_FEATURE_EL3) &&
48
!arm_is_secure(env) && (env->cp15.scr_el3 & SCR_FIQ)) {
49
/* NS GIC access and Group 0 is inaccessible to NS */
50
- if (prio & 0x80) {
51
+ if ((prio & 0x80) == 0) {
52
/* NS mustn't see priorities in the Secure half of the range */
53
prio = 0;
54
} else if (prio != 0xff) {
55
--
56
2.16.2
57
58
diff view generated by jsdifflib
1
From: Trent Piepho <tpiepho@impinj.com>
1
From: Yuquan Wang <wangyuquan1236@phytium.com.cn>
2
2
3
Linux does not detect a break from this IMX serial driver as a magic
3
This extends the slots of xhci to 64, since the default xhci_sysbus
4
sysrq. Nor does it note a break in the port error counts.
4
just supports one slot.
5
5
6
The former is because the Linux driver uses the BRCD bit in the USR2
6
Signed-off-by: Wang Yuquan <wangyuquan1236@phytium.com.cn>
7
register to trigger the RS-232 break handler in the kernel, which is
7
Signed-off-by: Chen Baozi <chenbaozi@phytium.com.cn>
8
where sysrq hooks in. The emulated UART was not setting this status
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
bit.
9
Reviewed-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
10
10
Tested-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
11
The latter is because the Linux driver expects, in addition to the BRK
11
Message-id: 20230710063750.473510-2-wangyuquan1236@phytium.com.cn
12
bit, that the ERR bit is set when a break is read in the FIFO. A break
13
should also count as a frame error, so add that bit too.
14
15
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
16
Signed-off-by: Trent Piepho <tpiepho@impinj.com>
17
Message-id: 20180320013657.25038-1-tpiepho@impinj.com
18
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
---
13
---
21
include/hw/char/imx_serial.h | 1 +
14
hw/arm/sbsa-ref.c | 1 +
22
hw/char/imx_serial.c | 5 ++++-
15
1 file changed, 1 insertion(+)
23
2 files changed, 5 insertions(+), 1 deletion(-)
24
16
25
diff --git a/include/hw/char/imx_serial.h b/include/hw/char/imx_serial.h
17
diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
26
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
27
--- a/include/hw/char/imx_serial.h
19
--- a/hw/arm/sbsa-ref.c
28
+++ b/include/hw/char/imx_serial.h
20
+++ b/hw/arm/sbsa-ref.c
29
@@ -XXX,XX +XXX,XX @@
21
@@ -XXX,XX +XXX,XX @@ static void create_xhci(const SBSAMachineState *sms)
30
22
hwaddr base = sbsa_ref_memmap[SBSA_XHCI].base;
31
#define URXD_CHARRDY (1<<15) /* character read is valid */
23
int irq = sbsa_ref_irqmap[SBSA_XHCI];
32
#define URXD_ERR (1<<14) /* Character has error */
24
DeviceState *dev = qdev_new(TYPE_XHCI_SYSBUS);
33
+#define URXD_FRMERR (1<<12) /* Character has frame error */
25
+ qdev_prop_set_uint32(dev, "slots", XHCI_MAXSLOTS);
34
#define URXD_BRK (1<<11) /* Break received */
26
35
27
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
36
#define USR1_PARTYER (1<<15) /* Parity Error */
28
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
37
diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c
38
index XXXXXXX..XXXXXXX 100644
39
--- a/hw/char/imx_serial.c
40
+++ b/hw/char/imx_serial.c
41
@@ -XXX,XX +XXX,XX @@ static void imx_put_data(void *opaque, uint32_t value)
42
s->usr2 |= USR2_RDR;
43
s->uts1 &= ~UTS1_RXEMPTY;
44
s->readbuff = value;
45
+ if (value & URXD_BRK) {
46
+ s->usr2 |= USR2_BRCD;
47
+ }
48
imx_update(s);
49
}
50
51
@@ -XXX,XX +XXX,XX @@ static void imx_receive(void *opaque, const uint8_t *buf, int size)
52
static void imx_event(void *opaque, int event)
53
{
54
if (event == CHR_EVENT_BREAK) {
55
- imx_put_data(opaque, URXD_BRK);
56
+ imx_put_data(opaque, URXD_BRK | URXD_FRMERR | URXD_ERR);
57
}
58
}
59
60
--
29
--
61
2.16.2
30
2.34.1
62
63
diff view generated by jsdifflib
1
For debug exceptions due to breakpoints or the BKPT instruction which
1
In the code for TARGET_NR_clock_adjtime, we set the pointer phtx to
2
are taken to AArch32, the Fault Address Register is architecturally
2
the address of the local variable htx. This means it can never be
3
UNKNOWN. We were using that as license to simply not set
3
NULL, but later in the code we check it for NULL anyway. Coverity
4
env->exception.vaddress, but this isn't correct, because it will
4
complains about this (CID 1507683) because the NULL check comes after
5
expose to the guest whatever old value was in that field when
5
a call to clock_adjtime() that assumes it is non-NULL.
6
arm_cpu_do_interrupt_aarch32() writes it to the guest IFSR. That old
7
value might be a FAR for a previous guest EL2 or secure exception, in
8
which case we shouldn't show it to an EL1 or non-secure exception
9
handler. It might also be a non-deterministic value, which is bad
10
for record-and-replay.
11
6
12
Clear env->exception.vaddress before taking breakpoint debug
7
Since phtx is always &htx, and is used only in three places, it's not
13
exceptions, to avoid this minor information leak.
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'.
14
11
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
13
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
17
Message-id: 20180320134114.30418-5-peter.maydell@linaro.org
14
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
15
Message-id: 20230623144410.1837261-1-peter.maydell@linaro.org
18
---
16
---
19
target/arm/op_helper.c | 11 ++++++++++-
17
linux-user/syscall.c | 12 +++++-------
20
1 file changed, 10 insertions(+), 1 deletion(-)
18
1 file changed, 5 insertions(+), 7 deletions(-)
21
19
22
diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c
20
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
23
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
24
--- a/target/arm/op_helper.c
22
--- a/linux-user/syscall.c
25
+++ b/target/arm/op_helper.c
23
+++ b/linux-user/syscall.c
26
@@ -XXX,XX +XXX,XX @@ void HELPER(exception_bkpt_insn)(CPUARMState *env, uint32_t syndrome)
24
@@ -XXX,XX +XXX,XX @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
27
{
25
#if defined(TARGET_NR_clock_adjtime) && defined(CONFIG_CLOCK_ADJTIME)
28
/* FSR will only be used if the debug target EL is AArch32. */
26
case TARGET_NR_clock_adjtime:
29
env->exception.fsr = arm_debug_exception_fsr(env);
27
{
30
+ /* FAR is UNKNOWN: clear vaddress to avoid potentially exposing
28
- struct timex htx, *phtx = &htx;
31
+ * values to the guest that it shouldn't be able to see at its
29
+ struct timex htx;
32
+ * exception/security level.
30
33
+ */
31
- if (target_to_host_timex(phtx, arg2) != 0) {
34
+ env->exception.vaddress = 0;
32
+ if (target_to_host_timex(&htx, arg2) != 0) {
35
raise_exception(env, EXCP_BKPT, syndrome, arm_debug_target_el(env));
33
return -TARGET_EFAULT;
36
}
34
}
37
35
- ret = get_errno(clock_adjtime(arg1, phtx));
38
@@ -XXX,XX +XXX,XX @@ void arm_debug_excp_handler(CPUState *cs)
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
}
39
}
44
}
40
45
return ret;
41
env->exception.fsr = arm_debug_exception_fsr(env);
42
- /* FAR is UNKNOWN, so doesn't need setting */
43
+ /* FAR is UNKNOWN: clear vaddress to avoid potentially exposing
44
+ * values to the guest that it shouldn't be able to see at its
45
+ * exception/security level.
46
+ */
47
+ env->exception.vaddress = 0;
48
raise_exception(env, EXCP_PREFETCH_ABORT,
49
syn_breakpoint(same_el),
50
arm_debug_target_el(env));
51
--
46
--
52
2.16.2
47
2.34.1
53
48
54
49
diff view generated by jsdifflib
1
The MDCR_EL2.TDE bit allows the exception level targeted by debug
1
Add comments to the in_* fields in the S1Translate struct
2
exceptions to be set to EL2 for code executing at EL0. We handle
2
that explain what they're doing.
3
this in the arm_debug_target_el() function, but this is only used for
4
hardware breakpoint and watchpoint exceptions, not for the exception
5
generated when the guest executes an AArch32 BKPT or AArch64 BRK
6
instruction. We don't have enough information for a translate-time
7
equivalent of arm_debug_target_el(), so instead make BKPT and BRK
8
call a special purpose helper which can do the routing, rather than
9
the generic exception_with_syndrome helper.
10
3
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
13
Message-id: 20180320134114.30418-2-peter.maydell@linaro.org
6
Message-id: 20230710152130.3928330-2-peter.maydell@linaro.org
14
---
7
---
15
target/arm/helper.h | 1 +
8
target/arm/ptw.c | 40 ++++++++++++++++++++++++++++++++++++++++
16
target/arm/op_helper.c | 8 ++++++++
9
1 file changed, 40 insertions(+)
17
target/arm/translate-a64.c | 15 +++++++++++++--
18
target/arm/translate.c | 19 ++++++++++++++-----
19
4 files changed, 36 insertions(+), 7 deletions(-)
20
10
21
diff --git a/target/arm/helper.h b/target/arm/helper.h
11
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
22
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
23
--- a/target/arm/helper.h
13
--- a/target/arm/ptw.c
24
+++ b/target/arm/helper.h
14
+++ b/target/arm/ptw.c
25
@@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_3(sel_flags, TCG_CALL_NO_RWG_SE,
15
@@ -XXX,XX +XXX,XX @@
26
i32, i32, i32, i32)
16
#endif
27
DEF_HELPER_2(exception_internal, void, env, i32)
17
28
DEF_HELPER_4(exception_with_syndrome, void, env, i32, i32, i32)
18
typedef struct S1Translate {
29
+DEF_HELPER_2(exception_bkpt_insn, void, env, i32)
19
+ /*
30
DEF_HELPER_1(setend, void, env)
20
+ * in_mmu_idx : specifies which TTBR, TCR, etc to use for the walk.
31
DEF_HELPER_2(wfi, void, env, i32)
21
+ * Together with in_space, specifies the architectural translation regime.
32
DEF_HELPER_1(wfe, void, env)
22
+ */
33
diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c
23
ARMMMUIdx in_mmu_idx;
34
index XXXXXXX..XXXXXXX 100644
24
+ /*
35
--- a/target/arm/op_helper.c
25
+ * in_ptw_idx: specifies which mmuidx to use for the actual
36
+++ b/target/arm/op_helper.c
26
+ * page table descriptor load operations. This will be one of the
37
@@ -XXX,XX +XXX,XX @@ void HELPER(exception_with_syndrome)(CPUARMState *env, uint32_t excp,
27
+ * ARMMMUIdx_Stage2* or one of the ARMMMUIdx_Phys_* indexes.
38
raise_exception(env, excp, syndrome, target_el);
28
+ * If a Secure ptw is "downgraded" to NonSecure by an NSTable bit,
39
}
29
+ * this field is updated accordingly.
40
30
+ */
41
+/* Raise an EXCP_BKPT with the specified syndrome register value,
31
ARMMMUIdx in_ptw_idx;
42
+ * targeting the correct exception level for debug exceptions.
32
+ /*
43
+ */
33
+ * in_space: the security space for this walk. This plus
44
+void HELPER(exception_bkpt_insn)(CPUARMState *env, uint32_t syndrome)
34
+ * the in_mmu_idx specify the architectural translation regime.
45
+{
35
+ * If a Secure ptw is "downgraded" to NonSecure by an NSTable bit,
46
+ raise_exception(env, EXCP_BKPT, syndrome, arm_debug_target_el(env));
36
+ * this field is updated accordingly.
47
+}
37
+ *
48
+
38
+ * Note that the security space for the in_ptw_idx may be different
49
uint32_t HELPER(cpsr_read)(CPUARMState *env)
39
+ * from that for the in_mmu_idx. We do not need to explicitly track
50
{
40
+ * the in_ptw_idx security space because:
51
return cpsr_read(env) & ~(CPSR_EXEC | CPSR_RESERVED);
41
+ * - if the in_ptw_idx is an ARMMMUIdx_Phys_* then the mmuidx
52
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
42
+ * itself specifies the security space
53
index XXXXXXX..XXXXXXX 100644
43
+ * - if the in_ptw_idx is an ARMMMUIdx_Stage2* then the security
54
--- a/target/arm/translate-a64.c
44
+ * space used for ptw reads is the same as that of the security
55
+++ b/target/arm/translate-a64.c
45
+ * space of the stage 1 translation for all cases except where
56
@@ -XXX,XX +XXX,XX @@ static void gen_exception_insn(DisasContext *s, int offset, int excp,
46
+ * stage 1 is Secure; in that case the only possibilities for
57
s->base.is_jmp = DISAS_NORETURN;
47
+ * the ptw read are Secure and NonSecure, and the in_ptw_idx
58
}
48
+ * value being Stage2 vs Stage2_S distinguishes those.
59
49
+ */
60
+static void gen_exception_bkpt_insn(DisasContext *s, int offset,
50
ARMSecuritySpace in_space;
61
+ uint32_t syndrome)
51
+ /*
62
+{
52
+ * in_secure: whether the translation regime is a Secure one.
63
+ TCGv_i32 tcg_syn;
53
+ * This is always equal to arm_space_is_secure(in_space).
64
+
54
+ * If a Secure ptw is "downgraded" to NonSecure by an NSTable bit,
65
+ gen_a64_set_pc_im(s->pc - offset);
55
+ * this field is updated accordingly.
66
+ tcg_syn = tcg_const_i32(syndrome);
56
+ */
67
+ gen_helper_exception_bkpt_insn(cpu_env, tcg_syn);
57
bool in_secure;
68
+ tcg_temp_free_i32(tcg_syn);
58
+ /*
69
+ s->base.is_jmp = DISAS_NORETURN;
59
+ * in_debug: is this a QEMU debug access (gdbstub, etc)? Debug
70
+}
60
+ * accesses will not update the guest page table access flags
71
+
61
+ * and will not change the state of the softmmu TLBs.
72
static void gen_ss_advance(DisasContext *s)
62
+ */
73
{
63
bool in_debug;
74
/* If the singlestep state is Active-not-pending, advance to
64
/*
75
@@ -XXX,XX +XXX,XX @@ static void disas_exc(DisasContext *s, uint32_t insn)
65
* If this is stage 2 of a stage 1+2 page table walk, then this must
76
break;
77
}
78
/* BRK */
79
- gen_exception_insn(s, 4, EXCP_BKPT, syn_aa64_bkpt(imm16),
80
- default_exception_el(s));
81
+ gen_exception_bkpt_insn(s, 4, syn_aa64_bkpt(imm16));
82
break;
83
case 2:
84
if (op2_ll != 0) {
85
diff --git a/target/arm/translate.c b/target/arm/translate.c
86
index XXXXXXX..XXXXXXX 100644
87
--- a/target/arm/translate.c
88
+++ b/target/arm/translate.c
89
@@ -XXX,XX +XXX,XX @@ static void gen_exception_insn(DisasContext *s, int offset, int excp,
90
s->base.is_jmp = DISAS_NORETURN;
91
}
92
93
+static void gen_exception_bkpt_insn(DisasContext *s, int offset, uint32_t syn)
94
+{
95
+ TCGv_i32 tcg_syn;
96
+
97
+ gen_set_condexec(s);
98
+ gen_set_pc_im(s, s->pc - offset);
99
+ tcg_syn = tcg_const_i32(syn);
100
+ gen_helper_exception_bkpt_insn(cpu_env, tcg_syn);
101
+ tcg_temp_free_i32(tcg_syn);
102
+ s->base.is_jmp = DISAS_NORETURN;
103
+}
104
+
105
/* Force a TB lookup after an instruction that changes the CPU state. */
106
static inline void gen_lookup_tb(DisasContext *s)
107
{
108
@@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
109
case 1:
110
/* bkpt */
111
ARCH(5);
112
- gen_exception_insn(s, 4, EXCP_BKPT,
113
- syn_aa32_bkpt(imm16, false),
114
- default_exception_el(s));
115
+ gen_exception_bkpt_insn(s, 4, syn_aa32_bkpt(imm16, false));
116
break;
117
case 2:
118
/* Hypervisor call (v7) */
119
@@ -XXX,XX +XXX,XX @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn)
120
{
121
int imm8 = extract32(insn, 0, 8);
122
ARCH(5);
123
- gen_exception_insn(s, 2, EXCP_BKPT, syn_aa32_bkpt(imm8, true),
124
- default_exception_el(s));
125
+ gen_exception_bkpt_insn(s, 2, syn_aa32_bkpt(imm8, true));
126
break;
127
}
128
129
--
66
--
130
2.16.2
67
2.34.1
131
132
diff view generated by jsdifflib
1
When a debug exception is taken to AArch32, it appears as a Prefetch
1
In commit fe4a5472ccd6 we rearranged the logic in S1_ptw_translate()
2
Abort, and the Instruction Fault Status Register (IFSR) must be set.
2
so that the debug-access "call get_phys_addr_*" codepath is used both
3
The IFSR has two possible formats, depending on whether LPAE is in
3
when S1 is doing ptw reads from stage 2 and when it is doing ptw
4
use. Factor out the code in arm_debug_excp_handler() which picks
4
reads from physical memory. However, we didn't update the
5
an FSR value into its own utility function, update it to use
5
calculation of s2ptw->in_space and s2ptw->in_secure to account for
6
arm_fi_to_lfsc() and arm_fi_to_sfsc() rather than hard-coded constants,
6
the "ptw reads from physical memory" case. This meant that debug
7
and use the correct condition to select long or short format.
7
accesses when in Secure state broke.
8
8
9
In particular this fixes a bug where we could select the short
9
Create a new function S2_security_space() which returns the
10
format because we're at EL0 and the EL1 translation regime is
10
correct security space to use for the ptw load, and use it to
11
not using LPAE, but then route the debug exception to EL2 because
11
determine the correct .in_secure and .in_space fields for the
12
of MDCR_EL2.TDE and hand EL2 the wrong format FSR.
12
stage 2 lookup for the ptw load.
13
13
14
Reported-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
16
Tested-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
16
Message-id: 20180320134114.30418-3-peter.maydell@linaro.org
17
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
18
Message-id: 20230710152130.3928330-3-peter.maydell@linaro.org
19
Fixes: fe4a5472ccd6 ("target/arm: Use get_phys_addr_with_struct in S1_ptw_translate")
20
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
---
21
---
18
target/arm/internals.h | 25 +++++++++++++++++++++++++
22
target/arm/ptw.c | 37 ++++++++++++++++++++++++++++++++-----
19
target/arm/op_helper.c | 12 ++----------
23
1 file changed, 32 insertions(+), 5 deletions(-)
20
2 files changed, 27 insertions(+), 10 deletions(-)
21
24
22
diff --git a/target/arm/internals.h b/target/arm/internals.h
25
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
23
index XXXXXXX..XXXXXXX 100644
26
index XXXXXXX..XXXXXXX 100644
24
--- a/target/arm/internals.h
27
--- a/target/arm/ptw.c
25
+++ b/target/arm/internals.h
28
+++ b/target/arm/ptw.c
26
@@ -XXX,XX +XXX,XX @@ static inline bool regime_is_secure(CPUARMState *env, ARMMMUIdx mmu_idx)
29
@@ -XXX,XX +XXX,XX @@ static bool S2_attrs_are_device(uint64_t hcr, uint8_t attrs)
27
}
30
}
28
}
31
}
29
32
30
+/* Return the FSR value for a debug exception (watchpoint, hardware
33
+static ARMSecuritySpace S2_security_space(ARMSecuritySpace s1_space,
31
+ * breakpoint or BKPT insn) targeting the specified exception level.
34
+ ARMMMUIdx s2_mmu_idx)
32
+ */
33
+static inline uint32_t arm_debug_exception_fsr(CPUARMState *env)
34
+{
35
+{
35
+ ARMMMUFaultInfo fi = { .type = ARMFault_Debug };
36
+ /*
36
+ int target_el = arm_debug_target_el(env);
37
+ * Return the security space to use for stage 2 when doing
37
+ bool using_lpae = false;
38
+ * the S1 page table descriptor load.
38
+
39
+ */
39
+ if (target_el == 2 || arm_el_is_aa64(env, target_el)) {
40
+ if (regime_is_stage2(s2_mmu_idx)) {
40
+ using_lpae = true;
41
+ /*
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
+ }
41
+ } else {
56
+ } else {
42
+ if (arm_feature(env, ARM_FEATURE_LPAE) &&
57
+ /* ptw loads are from phys: the mmu idx itself says which space */
43
+ (env->cp15.tcr_el[target_el].raw_tcr & TTBCR_EAE)) {
58
+ return arm_phys_to_space(s2_mmu_idx);
44
+ using_lpae = true;
45
+ }
46
+ }
47
+
48
+ if (using_lpae) {
49
+ return arm_fi_to_lfsc(&fi);
50
+ } else {
51
+ return arm_fi_to_sfsc(&fi);
52
+ }
59
+ }
53
+}
60
+}
54
+
61
+
55
#endif
62
/* Translate a S1 pagetable walk through S2 if needed. */
56
diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c
63
static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw,
57
index XXXXXXX..XXXXXXX 100644
64
hwaddr addr, ARMMMUFaultInfo *fi)
58
--- a/target/arm/op_helper.c
65
{
59
+++ b/target/arm/op_helper.c
66
- ARMSecuritySpace space = ptw->in_space;
60
@@ -XXX,XX +XXX,XX @@ void arm_debug_excp_handler(CPUState *cs)
67
bool is_secure = ptw->in_secure;
61
68
ARMMMUIdx mmu_idx = ptw->in_mmu_idx;
62
cs->watchpoint_hit = NULL;
69
ARMMMUIdx s2_mmu_idx = ptw->in_ptw_idx;
63
70
@@ -XXX,XX +XXX,XX @@ static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw,
64
- if (extended_addresses_enabled(env)) {
71
* From gdbstub, do not use softmmu so that we don't modify the
65
- env->exception.fsr = (1 << 9) | 0x22;
72
* state of the cpu at all, including softmmu tlb contents.
66
- } else {
73
*/
67
- env->exception.fsr = 0x2;
74
+ ARMSecuritySpace s2_space = S2_security_space(ptw->in_space, s2_mmu_idx);
68
- }
75
S1Translate s2ptw = {
69
+ env->exception.fsr = arm_debug_exception_fsr(env);
76
.in_mmu_idx = s2_mmu_idx,
70
env->exception.vaddress = wp_hit->hitaddr;
77
.in_ptw_idx = ptw_idx_for_stage_2(env, s2_mmu_idx),
71
raise_exception(env, EXCP_DATA_ABORT,
78
- .in_secure = s2_mmu_idx == ARMMMUIdx_Stage2_S,
72
syn_watchpoint(same_el, 0, wnr),
79
- .in_space = (s2_mmu_idx == ARMMMUIdx_Stage2_S ? ARMSS_Secure
73
@@ -XXX,XX +XXX,XX @@ void arm_debug_excp_handler(CPUState *cs)
80
- : space == ARMSS_Realm ? ARMSS_Realm
74
return;
81
- : ARMSS_NonSecure),
75
}
82
+ .in_secure = arm_space_is_secure(s2_space),
76
83
+ .in_space = s2_space,
77
- if (extended_addresses_enabled(env)) {
84
.in_debug = true,
78
- env->exception.fsr = (1 << 9) | 0x22;
85
};
79
- } else {
86
GetPhysAddrResult s2 = { };
80
- env->exception.fsr = 0x2;
81
- }
82
+ env->exception.fsr = arm_debug_exception_fsr(env);
83
/* FAR is UNKNOWN, so doesn't need setting */
84
raise_exception(env, EXCP_PREFETCH_ABORT,
85
syn_breakpoint(same_el),
86
--
87
--
87
2.16.2
88
2.34.1
88
89
diff view generated by jsdifflib
1
The BCM2836 uses a Cortex-A7, not a Cortex-A15. Update the device to
1
In get_phys_addr_twostage() the code that applies the effects of
2
use the correct CPU.
2
VSTCR.{SA,SW} and VTCR.{NSA,NSW} only updates result->f.attrs.secure.
3
https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2836/QA7_rev3.4.pdf
3
Now we also have f.attrs.space for FEAT_RME, we need to keep the two
4
in sync.
4
5
5
When the BCM2836 was introduced (bad5623690b) the Cortex-A7 was not
6
These bits only have an effect for Secure space translations, not
6
available, so the very similar Cortex-A15 was used. Since dcf578ed8ce
7
for Root, so use the input in_space field to determine whether to
7
we can model the correct core.
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.
8
11
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Alistair Francis <alistair@alistair23.me>
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
14
Message-id: 20230710152130.3928330-4-peter.maydell@linaro.org
12
Message-id: 20180319110215.16755-1-peter.maydell@linaro.org
13
---
15
---
14
hw/arm/bcm2836.c | 2 +-
16
target/arm/ptw.c | 13 ++++++++-----
15
hw/arm/raspi.c | 2 +-
17
1 file changed, 8 insertions(+), 5 deletions(-)
16
2 files changed, 2 insertions(+), 2 deletions(-)
17
18
18
diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c
19
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
19
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
20
--- a/hw/arm/bcm2836.c
21
--- a/target/arm/ptw.c
21
+++ b/hw/arm/bcm2836.c
22
+++ b/target/arm/ptw.c
22
@@ -XXX,XX +XXX,XX @@ struct BCM283XInfo {
23
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw,
23
static const BCM283XInfo bcm283x_socs[] = {
24
hwaddr ipa;
24
{
25
int s1_prot, s1_lgpgsz;
25
.name = TYPE_BCM2836,
26
bool is_secure = ptw->in_secure;
26
- .cpu_type = ARM_CPU_TYPE_NAME("cortex-a15"),
27
+ ARMSecuritySpace in_space = ptw->in_space;
27
+ .cpu_type = ARM_CPU_TYPE_NAME("cortex-a7"),
28
bool ret, ipa_secure;
28
.clusterid = 0xf,
29
ARMCacheAttrs cacheattrs1;
29
},
30
ARMSecuritySpace ipa_space;
30
#ifdef TARGET_AARCH64
31
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw,
31
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
32
* Check if IPA translates to secure or non-secure PA space.
32
index XXXXXXX..XXXXXXX 100644
33
* Note that VSTCR overrides VTCR and {N}SW overrides {N}SA.
33
--- a/hw/arm/raspi.c
34
*/
34
+++ b/hw/arm/raspi.c
35
- result->f.attrs.secure =
35
@@ -XXX,XX +XXX,XX @@ static void raspi2_machine_init(MachineClass *mc)
36
- (is_secure
36
mc->no_parallel = 1;
37
- && !(env->cp15.vstcr_el2 & (VSTCR_SA | VSTCR_SW))
37
mc->no_floppy = 1;
38
- && (ipa_secure
38
mc->no_cdrom = 1;
39
- || !(env->cp15.vtcr_el2 & (VTCR_NSA | VTCR_NSW))));
39
- mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a15");
40
+ if (in_space == ARMSS_Secure) {
40
+ mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a7");
41
+ result->f.attrs.secure =
41
mc->max_cpus = BCM283X_NCPUS;
42
+ !(env->cp15.vstcr_el2 & (VSTCR_SA | VSTCR_SW))
42
mc->min_cpus = BCM283X_NCPUS;
43
+ && (ipa_secure
43
mc->default_cpus = BCM283X_NCPUS;
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
}
44
--
50
--
45
2.16.2
51
2.34.1
46
47
diff view generated by jsdifflib
1
Now that we have a helper function specifically for the BRK and
1
In commit f0a08b0913befbd we changed the type of the PC from
2
BKPT instructions, we can set the exception.fsr there rather
2
target_ulong to vaddr. In doing so we inadvertently dropped the
3
than in arm_cpu_do_interrupt_aarch32(). This allows us to
3
zero-padding on the PC in trace lines (the second item inside the []
4
use our new arm_debug_exception_fsr() helper.
4
in these lines). They used to look like this on AArch64, for
5
instance:
5
6
6
In particular this fixes a bug where we were hardcoding the
7
Trace 0: 0x7f2260000100 [00000000/0000000040000000/00000061/ff200000]
7
short-form IFSR value, which is wrong if the target exception
8
level has LPAE enabled.
9
8
10
Fixes: https://bugs.launchpad.net/qemu/+bug/1756927
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")
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
28
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
29
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
13
Message-id: 20180320134114.30418-4-peter.maydell@linaro.org
30
Reviewed-by: Anton Johansson <anjo@rev.ng>
31
Message-id: 20230711165434.4123674-1-peter.maydell@linaro.org
14
---
32
---
15
target/arm/helper.c | 1 -
33
accel/tcg/cpu-exec.c | 4 ++--
16
target/arm/op_helper.c | 2 ++
34
accel/tcg/translate-all.c | 2 +-
17
2 files changed, 2 insertions(+), 1 deletion(-)
35
2 files changed, 3 insertions(+), 3 deletions(-)
18
36
19
diff --git a/target/arm/helper.c b/target/arm/helper.c
37
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
20
index XXXXXXX..XXXXXXX 100644
38
index XXXXXXX..XXXXXXX 100644
21
--- a/target/arm/helper.c
39
--- a/accel/tcg/cpu-exec.c
22
+++ b/target/arm/helper.c
40
+++ b/accel/tcg/cpu-exec.c
23
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_do_interrupt_aarch32(CPUState *cs)
41
@@ -XXX,XX +XXX,XX @@ static void log_cpu_exec(vaddr pc, CPUState *cpu,
24
offset = 0;
42
if (qemu_log_in_addr_range(pc)) {
25
break;
43
qemu_log_mask(CPU_LOG_EXEC,
26
case EXCP_BKPT:
44
"Trace %d: %p [%08" PRIx64
27
- env->exception.fsr = 2;
45
- "/%" VADDR_PRIx "/%08x/%08x] %s\n",
28
/* Fall through to prefetch abort. */
46
+ "/%016" VADDR_PRIx "/%08x/%08x] %s\n",
29
case EXCP_PREFETCH_ABORT:
47
cpu->cpu_index, tb->tc.ptr, tb->cs_base, pc,
30
A32_BANKED_CURRENT_REG_SET(env, ifsr, env->exception.fsr);
48
tb->flags, tb->cflags, lookup_symbol(pc));
31
diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c
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
32
index XXXXXXX..XXXXXXX 100644
60
index XXXXXXX..XXXXXXX 100644
33
--- a/target/arm/op_helper.c
61
--- a/accel/tcg/translate-all.c
34
+++ b/target/arm/op_helper.c
62
+++ b/accel/tcg/translate-all.c
35
@@ -XXX,XX +XXX,XX @@ void HELPER(exception_with_syndrome)(CPUARMState *env, uint32_t excp,
63
@@ -XXX,XX +XXX,XX @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr)
36
*/
64
if (qemu_loglevel_mask(CPU_LOG_EXEC)) {
37
void HELPER(exception_bkpt_insn)(CPUARMState *env, uint32_t syndrome)
65
vaddr pc = log_pc(cpu, tb);
38
{
66
if (qemu_log_in_addr_range(pc)) {
39
+ /* FSR will only be used if the debug target EL is AArch32. */
67
- qemu_log("cpu_io_recompile: rewound execution of TB to %"
40
+ env->exception.fsr = arm_debug_exception_fsr(env);
68
+ qemu_log("cpu_io_recompile: rewound execution of TB to %016"
41
raise_exception(env, EXCP_BKPT, syndrome, arm_debug_target_el(env));
69
VADDR_PRIx "\n", pc);
42
}
70
}
43
71
}
44
--
72
--
45
2.16.2
73
2.34.1
46
74
47
75
diff view generated by jsdifflib
1
From: Wei Huang <wei@redhat.com>
1
From: Tong Ho <tong.ho@amd.com>
2
2
3
Instead of using "1.0" as the system version of SMBIOS, we should use
3
Add a check in the bit-set operation to write the backstore
4
mc->name for mach-virt machine type to be consistent other architectures.
4
only if the affected bit is 0 before.
5
With this patch, "dmidecode -t 1" (e.g., "-M virt-2.12,accel=kvm") will
6
show:
7
5
8
Handle 0x0100, DMI type 1, 27 bytes
6
With this in place, there will be no need for callers to
9
System Information
7
do the checking in order to avoid unnecessary writes.
10
Manufacturer: QEMU
11
Product Name: KVM Virtual Machine
12
Version: virt-2.12
13
Serial Number: Not Specified
14
...
15
8
16
instead of:
9
Signed-off-by: Tong Ho <tong.ho@amd.com>
17
10
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
18
Handle 0x0100, DMI type 1, 27 bytes
11
Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com>
19
System Information
12
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
20
Manufacturer: QEMU
21
Product Name: KVM Virtual Machine
22
Version: 1.0
23
Serial Number: Not Specified
24
...
25
26
For backward compatibility, we allow older machine types to keep "1.0"
27
as the default system version.
28
29
Signed-off-by: Wei Huang <wei@redhat.com>
30
Reviewed-by: Andrew Jones <drjones@redhat.com>
31
Message-id: 20180322212318.7182-1-wei@redhat.com
32
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
33
---
14
---
34
include/hw/arm/virt.h | 1 +
15
hw/nvram/xlnx-efuse.c | 11 +++++++++--
35
hw/arm/virt.c | 8 +++++++-
16
1 file changed, 9 insertions(+), 2 deletions(-)
36
2 files changed, 8 insertions(+), 1 deletion(-)
37
17
38
diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
18
diff --git a/hw/nvram/xlnx-efuse.c b/hw/nvram/xlnx-efuse.c
39
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
40
--- a/include/hw/arm/virt.h
20
--- a/hw/nvram/xlnx-efuse.c
41
+++ b/include/hw/arm/virt.h
21
+++ b/hw/nvram/xlnx-efuse.c
42
@@ -XXX,XX +XXX,XX @@ typedef struct {
22
@@ -XXX,XX +XXX,XX @@ static bool efuse_ro_bits_find(XlnxEFuse *s, uint32_t k)
43
bool no_its;
23
44
bool no_pmu;
24
bool xlnx_efuse_set_bit(XlnxEFuse *s, unsigned int bit)
45
bool claim_edge_triggered_timers;
46
+ bool smbios_old_sys_ver;
47
} VirtMachineClass;
48
49
typedef struct {
50
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
51
index XXXXXXX..XXXXXXX 100644
52
--- a/hw/arm/virt.c
53
+++ b/hw/arm/virt.c
54
@@ -XXX,XX +XXX,XX @@ static void *machvirt_dtb(const struct arm_boot_info *binfo, int *fdt_size)
55
56
static void virt_build_smbios(VirtMachineState *vms)
57
{
25
{
58
+ MachineClass *mc = MACHINE_GET_CLASS(vms);
26
+ uint32_t set, *row;
59
+ VirtMachineClass *vmc = VIRT_MACHINE_GET_CLASS(vms);
27
+
60
uint8_t *smbios_tables, *smbios_anchor;
28
if (efuse_ro_bits_find(s, bit)) {
61
size_t smbios_tables_len, smbios_anchor_len;
29
g_autofree char *path = object_get_canonical_path(OBJECT(s));
62
const char *product = "QEMU Virtual Machine";
30
63
@@ -XXX,XX +XXX,XX @@ static void virt_build_smbios(VirtMachineState *vms)
31
@@ -XXX,XX +XXX,XX @@ bool xlnx_efuse_set_bit(XlnxEFuse *s, unsigned int bit)
32
return false;
64
}
33
}
65
34
66
smbios_set_defaults("QEMU", product,
35
- s->fuse32[bit / 32] |= 1 << (bit % 32);
67
- "1.0", false, true, SMBIOS_ENTRY_POINT_30);
36
- efuse_bdrv_sync(s, bit);
68
+ vmc->smbios_old_sys_ver ? "1.0" : mc->name, false,
37
+ /* Avoid back-end write unless there is a real update */
69
+ true, SMBIOS_ENTRY_POINT_30);
38
+ row = &s->fuse32[bit / 32];
70
39
+ set = 1 << (bit % 32);
71
smbios_get_tables(NULL, 0, &smbios_tables, &smbios_tables_len,
40
+ if (!(set & *row)) {
72
&smbios_anchor, &smbios_anchor_len);
41
+ *row |= set;
73
@@ -XXX,XX +XXX,XX @@ static void virt_2_11_instance_init(Object *obj)
42
+ efuse_bdrv_sync(s, bit);
74
43
+ }
75
static void virt_machine_2_11_options(MachineClass *mc)
44
return true;
76
{
77
+ VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc));
78
+
79
virt_machine_2_12_options(mc);
80
SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_11);
81
+ vmc->smbios_old_sys_ver = true;
82
}
45
}
83
DEFINE_VIRT_MACHINE(2, 11)
84
46
85
--
47
--
86
2.16.2
48
2.34.1
87
49
88
50
diff view generated by jsdifflib