1
target-arm queue: a smallish set of patches for rc1 tomorrow.
1
A last small test of bug fixes before rc1.
2
I've included the tcg patches because RTH has no others that
3
would merit a pullreq.
4
5
I haven't included Thomas Huth's 17-patch set to deal with
6
the introspection crashes, to give that a little more time
7
on-list for review.
8
2
9
thanks
3
thanks
10
-- PMM
4
-- PMM
11
5
12
The following changes since commit 102ad0a80f5110483efd06877c29c4236be267f9:
6
The following changes since commit ed8ad9728a9c0eec34db9dff61dfa2f1dd625637:
13
7
14
Merge remote-tracking branch 'remotes/armbru/tags/pull-misc-2018-07-16' into staging (2018-07-16 15:34:38 +0100)
8
Merge tag 'pull-tpm-2023-07-14-1' of https://github.com/stefanberger/qemu-tpm into staging (2023-07-15 14:54:04 +0100)
15
9
16
are available in the Git repository at:
10
are available in the Git repository at:
17
11
18
git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20180716
12
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20230717
19
13
20
for you to fetch changes up to 3474c98a2a2afcefa7c665f02ad2bed2a43ab0f7:
14
for you to fetch changes up to c2c1c4a35c7c2b1a4140b0942b9797c857e476a4:
21
15
22
accel/tcg: Assert that tlb fill gave us a valid TLB entry (2018-07-16 17:26:01 +0100)
16
hw/nvram: Avoid unnecessary Xilinx eFuse backstore write (2023-07-17 11:05:52 +0100)
23
17
24
----------------------------------------------------------------
18
----------------------------------------------------------------
25
target-arm queue:
19
target-arm queue:
26
* accel/tcg: Use correct test when looking in victim TLB for code
20
* hw/arm/sbsa-ref: set 'slots' property of xhci
27
* bcm2835_aux: Swap RX and TX interrupt assignments
21
* linux-user: Remove pointless NULL check in clock_adjtime handling
28
* hw/arm/bcm2836: Mark the bcm2836 / bcm2837 devices with user_creatable = false
22
* ptw: Fix S1_ptw_translate() debug path
29
* hw/intc/arm_gic: Fix handling of GICD_ITARGETSR
23
* ptw: Account for FEAT_RME when applying {N}SW, SA bits
30
* hw/intc/arm_gic: Check interrupt number in gic_deactivate_irq()
24
* accel/tcg: Zero-pad PC in TCG CPU exec trace lines
31
* aspeed: Implement write-1-{set, clear} for AST2500 strapping
25
* hw/nvram: Avoid unnecessary Xilinx eFuse backstore write
32
* target/arm: Fix LD1W and LDFF1W (scalar plus vector)
33
26
34
----------------------------------------------------------------
27
----------------------------------------------------------------
35
Andrew Jeffery (1):
28
Peter Maydell (5):
36
aspeed: Implement write-1-{set, clear} for AST2500 strapping
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
37
34
38
Guenter Roeck (1):
35
Tong Ho (1):
39
bcm2835_aux: Swap RX and TX interrupt assignments
36
hw/nvram: Avoid unnecessary Xilinx eFuse backstore write
40
37
41
Peter Maydell (4):
38
Yuquan Wang (1):
42
hw/intc/arm_gic: Check interrupt number in gic_deactivate_irq()
39
hw/arm/sbsa-ref: set 'slots' property of xhci
43
hw/intc/arm_gic: Fix handling of GICD_ITARGETSR
44
accel/tcg: Use correct test when looking in victim TLB for code
45
accel/tcg: Assert that tlb fill gave us a valid TLB entry
46
40
47
Richard Henderson (1):
41
accel/tcg/cpu-exec.c | 4 +--
48
target/arm: Fix LD1W and LDFF1W (scalar plus vector)
42
accel/tcg/translate-all.c | 2 +-
49
43
hw/arm/sbsa-ref.c | 1 +
50
Thomas Huth (1):
44
hw/nvram/xlnx-efuse.c | 11 ++++--
51
hw/arm/bcm2836: Mark the bcm2836 / bcm2837 devices with user_creatable = false
45
linux-user/syscall.c | 12 +++----
52
46
target/arm/ptw.c | 90 +++++++++++++++++++++++++++++++++++++++++------
53
include/hw/misc/aspeed_scu.h | 2 ++
47
6 files changed, 98 insertions(+), 22 deletions(-)
54
accel/tcg/cputlb.c | 6 +++---
55
hw/arm/bcm2836.c | 2 ++
56
hw/char/bcm2835_aux.c | 4 ++--
57
hw/intc/arm_gic.c | 22 +++++++++++++++++++---
58
hw/misc/aspeed_scu.c | 19 +++++++++++++++++--
59
target/arm/sve_helper.c | 4 ++--
60
7 files changed, 47 insertions(+), 12 deletions(-)
61
diff view generated by jsdifflib
Deleted patch
1
From: Richard Henderson <richard.henderson@linaro.org>
2
1
3
'I' was being double-incremented; correctly within the inner loop
4
and incorrectly within the outer loop.
5
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Reviewed-by: Laurent Desnogues <laurent.desnogues@gmail.com>
8
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
9
Tested-by: Alex Bennée <alex.bennee@linaro.org>
10
Message-id: 20180711103957.3040-1-richard.henderson@linaro.org
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
13
target/arm/sve_helper.c | 4 ++--
14
1 file changed, 2 insertions(+), 2 deletions(-)
15
16
diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c
17
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/sve_helper.c
19
+++ b/target/arm/sve_helper.c
20
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(CPUARMState *env, void *vd, void *vg, void *vm, \
21
intptr_t i, oprsz = simd_oprsz(desc); \
22
unsigned scale = simd_data(desc); \
23
uintptr_t ra = GETPC(); \
24
- for (i = 0; i < oprsz; i++) { \
25
+ for (i = 0; i < oprsz; ) { \
26
uint16_t pg = *(uint16_t *)(vg + H1_2(i >> 3)); \
27
do { \
28
TYPEM m = 0; \
29
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(CPUARMState *env, void *vd, void *vg, void *vm, \
30
uintptr_t ra = GETPC(); \
31
bool first = true; \
32
mmap_lock(); \
33
- for (i = 0; i < oprsz; i++) { \
34
+ for (i = 0; i < oprsz; ) { \
35
uint16_t pg = *(uint16_t *)(vg + H1_2(i >> 3)); \
36
do { \
37
TYPEM m = 0; \
38
--
39
2.17.1
40
41
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
From: Yuquan Wang <wangyuquan1236@phytium.com.cn>
2
2
3
RX and TX interrupt bits were reversed, resulting in an endless sequence
3
This extends the slots of xhci to 64, since the default xhci_sysbus
4
of serial interupts in the emulated system and the following repeated
4
just supports one slot.
5
error message when booting Linux.
6
5
7
serial8250: too much work for irq61
6
Signed-off-by: Wang Yuquan <wangyuquan1236@phytium.com.cn>
8
7
Signed-off-by: Chen Baozi <chenbaozi@phytium.com.cn>
9
This results in a boot failure most of the time.
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
9
Reviewed-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
11
Qemu command line used to reproduce the problem:
10
Tested-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
12
11
Message-id: 20230710063750.473510-2-wangyuquan1236@phytium.com.cn
13
    qemu-system-aarch64 -M raspi3 -m 1024 \
14
    -kernel arch/arm64/boot/Image \
15
    --append "rdinit=/sbin/init console=ttyS1,115200"
16
    -initrd rootfs.cpio \
17
    -dtb arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dtb \
18
    -nographic -monitor null -serial null -serial stdio
19
20
This is with arm64:defconfig. The root file system was generated using
21
buildroot.
22
23
NB that this error likely arises from an erratum in the
24
BCM2835 datasheet where the TX and RX bits were swapped
25
in the AU_MU_IER_REG description (but correct for IIR):
26
https://elinux.org/BCM2835_datasheet_errata#p12
27
28
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
29
Message-id: 1529355846-25102-1-git-send-email-linux@roeck-us.net
30
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
31
[PMM: added NB about datasheet]
32
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
33
---
13
---
34
hw/char/bcm2835_aux.c | 4 ++--
14
hw/arm/sbsa-ref.c | 1 +
35
1 file changed, 2 insertions(+), 2 deletions(-)
15
1 file changed, 1 insertion(+)
36
16
37
diff --git a/hw/char/bcm2835_aux.c b/hw/char/bcm2835_aux.c
17
diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
38
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
39
--- a/hw/char/bcm2835_aux.c
19
--- a/hw/arm/sbsa-ref.c
40
+++ b/hw/char/bcm2835_aux.c
20
+++ b/hw/arm/sbsa-ref.c
41
@@ -XXX,XX +XXX,XX @@
21
@@ -XXX,XX +XXX,XX @@ static void create_xhci(const SBSAMachineState *sms)
42
#define AUX_MU_BAUD_REG 0x68
22
hwaddr base = sbsa_ref_memmap[SBSA_XHCI].base;
43
23
int irq = sbsa_ref_irqmap[SBSA_XHCI];
44
/* bits in IER/IIR registers */
24
DeviceState *dev = qdev_new(TYPE_XHCI_SYSBUS);
45
-#define TX_INT 0x1
25
+ qdev_prop_set_uint32(dev, "slots", XHCI_MAXSLOTS);
46
-#define RX_INT 0x2
26
47
+#define RX_INT 0x1
27
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
48
+#define TX_INT 0x2
28
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
49
50
static void bcm2835_aux_update(BCM2835AuxState *s)
51
{
52
--
29
--
53
2.17.1
30
2.34.1
54
55
diff view generated by jsdifflib
1
The GICD_ITARGETSR implementation still has some 11MPCore behaviour
1
In the code for TARGET_NR_clock_adjtime, we set the pointer phtx to
2
that we were incorrectly using in our GICv1 and GICv2 implementations
2
the address of the local variable htx. This means it can never be
3
for the case where the interrupt number is less than GIC_INTERNAL.
3
NULL, but later in the code we check it for NULL anyway. Coverity
4
The desired behaviour here is:
4
complains about this (CID 1507683) because the NULL check comes after
5
* for 11MPCore: RAZ/WI for irqs 0..28; read a number matching the
5
a call to clock_adjtime() that assumes it is non-NULL.
6
CPU doing the read for irqs 29..31
7
* for GICv1 and v2: RAZ/WI if uniprocessor; otherwise read a
8
number matching the CPU doing the read for all irqs < 32
9
6
10
Stop squashing GICD_ITARGETSR to 0 for IRQs 0..28 unless this
7
Since phtx is always &htx, and is used only in three places, it's not
11
is an 11MPCore GIC.
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'.
12
11
13
Reported-by: Jan Kiszka <jan.kiszka@web.de>
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
15
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
16
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
15
Message-id: 20230623144410.1837261-1-peter.maydell@linaro.org
17
Message-id: 20180712154152.32183-3-peter.maydell@linaro.org
18
---
16
---
19
hw/intc/arm_gic.c | 6 ++++--
17
linux-user/syscall.c | 12 +++++-------
20
1 file changed, 4 insertions(+), 2 deletions(-)
18
1 file changed, 5 insertions(+), 7 deletions(-)
21
19
22
diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.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/hw/intc/arm_gic.c
22
--- a/linux-user/syscall.c
25
+++ b/hw/intc/arm_gic.c
23
+++ b/linux-user/syscall.c
26
@@ -XXX,XX +XXX,XX @@ static uint32_t gic_dist_readb(void *opaque, hwaddr offset, MemTxAttrs attrs)
24
@@ -XXX,XX +XXX,XX @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
27
if (irq >= s->num_irq) {
25
#if defined(TARGET_NR_clock_adjtime) && defined(CONFIG_CLOCK_ADJTIME)
28
goto bad_reg;
26
case TARGET_NR_clock_adjtime:
27
{
28
- struct timex htx, *phtx = &htx;
29
+ struct timex htx;
30
31
- if (target_to_host_timex(phtx, arg2) != 0) {
32
+ if (target_to_host_timex(&htx, arg2) != 0) {
33
return -TARGET_EFAULT;
29
}
34
}
30
- if (irq >= 29 && irq <= 31) {
35
- ret = get_errno(clock_adjtime(arg1, phtx));
31
+ if (irq < 29 && s->revision == REV_11MPCORE) {
36
- if (!is_error(ret) && phtx) {
32
+ res = 0;
37
- if (host_to_target_timex(arg2, phtx) != 0) {
33
+ } else if (irq < GIC_INTERNAL) {
38
- return -TARGET_EFAULT;
34
res = cm;
39
- }
35
} else {
40
+ ret = get_errno(clock_adjtime(arg1, &htx));
36
res = GIC_TARGET(irq);
41
+ if (!is_error(ret) && host_to_target_timex(arg2, &htx)) {
37
@@ -XXX,XX +XXX,XX @@ static void gic_dist_writeb(void *opaque, hwaddr offset,
42
+ return -TARGET_EFAULT;
38
if (irq >= s->num_irq) {
39
goto bad_reg;
40
}
43
}
41
- if (irq < 29) {
44
}
42
+ if (irq < 29 && s->revision == REV_11MPCORE) {
45
return ret;
43
value = 0;
44
} else if (irq < GIC_INTERNAL) {
45
value = ALL_CPU_MASK;
46
--
46
--
47
2.17.1
47
2.34.1
48
48
49
49
diff view generated by jsdifflib
1
In commit 4b1a3e1e34ad97 we added a check for whether the TLB entry
1
Add comments to the in_* fields in the S1Translate struct
2
we had following a tlb_fill had the INVALID bit set. This could
2
that explain what they're doing.
3
happen in some circumstances because a stale or wrong TLB entry was
4
pulled out of the victim cache. However, after commit
5
68fea038553039e (which prevents stale entries being in the victim
6
cache) and the previous commit (which ensures we don't incorrectly
7
hit in the victim cache)) this should never be possible.
8
9
Drop the check on TLB_INVALID_MASK from the "is this a TLB_RECHECK?"
10
condition, and instead assert that the tlb fill procedure has given
11
us a valid TLB entry (or longjumped out with a guest exception).
12
3
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
15
Message-id: 20180713141636.18665-3-peter.maydell@linaro.org
6
Message-id: 20230710152130.3928330-2-peter.maydell@linaro.org
16
---
7
---
17
accel/tcg/cputlb.c | 4 ++--
8
target/arm/ptw.c | 40 ++++++++++++++++++++++++++++++++++++++++
18
1 file changed, 2 insertions(+), 2 deletions(-)
9
1 file changed, 40 insertions(+)
19
10
20
diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
11
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
21
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
22
--- a/accel/tcg/cputlb.c
13
--- a/target/arm/ptw.c
23
+++ b/accel/tcg/cputlb.c
14
+++ b/target/arm/ptw.c
24
@@ -XXX,XX +XXX,XX @@ tb_page_addr_t get_page_addr_code(CPUArchState *env, target_ulong addr)
15
@@ -XXX,XX +XXX,XX @@
25
if (!VICTIM_TLB_HIT(addr_code, addr)) {
16
#endif
26
tlb_fill(ENV_GET_CPU(env), addr, 0, MMU_INST_FETCH, mmu_idx, 0);
17
27
}
18
typedef struct S1Translate {
28
+ assert(tlb_hit(env->tlb_table[mmu_idx][index].addr_code, addr));
19
+ /*
29
}
20
+ * in_mmu_idx : specifies which TTBR, TCR, etc to use for the walk.
30
21
+ * Together with in_space, specifies the architectural translation regime.
31
- if (unlikely((env->tlb_table[mmu_idx][index].addr_code &
22
+ */
32
- (TLB_RECHECK | TLB_INVALID_MASK)) == TLB_RECHECK)) {
23
ARMMMUIdx in_mmu_idx;
33
+ if (unlikely(env->tlb_table[mmu_idx][index].addr_code & TLB_RECHECK)) {
24
+ /*
34
/*
25
+ * in_ptw_idx: specifies which mmuidx to use for the actual
35
* This is a TLB_RECHECK access, where the MMU protection
26
+ * page table descriptor load operations. This will be one of the
36
* covers a smaller range than a target page, and we must
27
+ * ARMMMUIdx_Stage2* or one of the ARMMMUIdx_Phys_* indexes.
28
+ * If a Secure ptw is "downgraded" to NonSecure by an NSTable bit,
29
+ * this field is updated accordingly.
30
+ */
31
ARMMMUIdx in_ptw_idx;
32
+ /*
33
+ * in_space: the security space for this walk. This plus
34
+ * the in_mmu_idx specify the architectural translation regime.
35
+ * If a Secure ptw is "downgraded" to NonSecure by an NSTable bit,
36
+ * this field is updated accordingly.
37
+ *
38
+ * Note that the security space for the in_ptw_idx may be different
39
+ * from that for the in_mmu_idx. We do not need to explicitly track
40
+ * the in_ptw_idx security space because:
41
+ * - if the in_ptw_idx is an ARMMMUIdx_Phys_* then the mmuidx
42
+ * itself specifies the security space
43
+ * - if the in_ptw_idx is an ARMMMUIdx_Stage2* then the security
44
+ * space used for ptw reads is the same as that of the security
45
+ * space of the stage 1 translation for all cases except where
46
+ * stage 1 is Secure; in that case the only possibilities for
47
+ * the ptw read are Secure and NonSecure, and the in_ptw_idx
48
+ * value being Stage2 vs Stage2_S distinguishes those.
49
+ */
50
ARMSecuritySpace in_space;
51
+ /*
52
+ * in_secure: whether the translation regime is a Secure one.
53
+ * This is always equal to arm_space_is_secure(in_space).
54
+ * If a Secure ptw is "downgraded" to NonSecure by an NSTable bit,
55
+ * this field is updated accordingly.
56
+ */
57
bool in_secure;
58
+ /*
59
+ * in_debug: is this a QEMU debug access (gdbstub, etc)? Debug
60
+ * accesses will not update the guest page table access flags
61
+ * and will not change the state of the softmmu TLBs.
62
+ */
63
bool in_debug;
64
/*
65
* If this is stage 2 of a stage 1+2 page table walk, then this must
37
--
66
--
38
2.17.1
67
2.34.1
39
40
diff view generated by jsdifflib
1
From: Andrew Jeffery <andrew@aj.id.au>
1
In commit fe4a5472ccd6 we rearranged the logic in S1_ptw_translate()
2
so that the debug-access "call get_phys_addr_*" codepath is used both
3
when S1 is doing ptw reads from stage 2 and when it is doing ptw
4
reads from physical memory. However, we didn't update the
5
calculation of s2ptw->in_space and s2ptw->in_secure to account for
6
the "ptw reads from physical memory" case. This meant that debug
7
accesses when in Secure state broke.
2
8
3
The AST2500 SoC family changes the runtime behaviour of the hardware
9
Create a new function S2_security_space() which returns the
4
strapping register (SCU70) to write-1-set/write-1-clear, with
10
correct security space to use for the ptw load, and use it to
5
write-1-clear implemented on the "read-only" SoC revision register
11
determine the correct .in_secure and .in_space fields for the
6
(SCU7C). For the the AST2400, the hardware strapping is
12
stage 2 lookup for the ptw load.
7
runtime-configured with read-modify-write semantics.
8
13
9
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
14
Reported-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
10
Reviewed-by: Joel Stanley <joel@jms.id.au>
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Message-id: 20180709143524.17480-1-andrew@aj.id.au
16
Tested-by: Jean-Philippe Brucker <jean-philippe@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")
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
21
---
14
include/hw/misc/aspeed_scu.h | 2 ++
22
target/arm/ptw.c | 37 ++++++++++++++++++++++++++++++++-----
15
hw/misc/aspeed_scu.c | 19 +++++++++++++++++--
23
1 file changed, 32 insertions(+), 5 deletions(-)
16
2 files changed, 19 insertions(+), 2 deletions(-)
17
24
18
diff --git a/include/hw/misc/aspeed_scu.h b/include/hw/misc/aspeed_scu.h
25
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
19
index XXXXXXX..XXXXXXX 100644
26
index XXXXXXX..XXXXXXX 100644
20
--- a/include/hw/misc/aspeed_scu.h
27
--- a/target/arm/ptw.c
21
+++ b/include/hw/misc/aspeed_scu.h
28
+++ b/target/arm/ptw.c
22
@@ -XXX,XX +XXX,XX @@ typedef struct AspeedSCUState {
29
@@ -XXX,XX +XXX,XX @@ static bool S2_attrs_are_device(uint64_t hcr, uint8_t attrs)
23
#define AST2500_A0_SILICON_REV 0x04000303U
30
}
24
#define AST2500_A1_SILICON_REV 0x04010303U
31
}
25
32
26
+#define ASPEED_IS_AST2500(si_rev) ((((si_rev) >> 24) & 0xff) == 0x04)
33
+static ARMSecuritySpace S2_security_space(ARMSecuritySpace s1_space,
34
+ ARMMMUIdx s2_mmu_idx)
35
+{
36
+ /*
37
+ * Return the security space to use for stage 2 when doing
38
+ * the S1 page table descriptor load.
39
+ */
40
+ if (regime_is_stage2(s2_mmu_idx)) {
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
+ }
56
+ } else {
57
+ /* ptw loads are from phys: the mmu idx itself says which space */
58
+ return arm_phys_to_space(s2_mmu_idx);
59
+ }
60
+}
27
+
61
+
28
extern bool is_supported_silicon_rev(uint32_t silicon_rev);
62
/* Translate a S1 pagetable walk through S2 if needed. */
29
63
static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw,
30
#define ASPEED_SCU_PROT_KEY 0x1688A8A8
64
hwaddr addr, ARMMMUFaultInfo *fi)
31
diff --git a/hw/misc/aspeed_scu.c b/hw/misc/aspeed_scu.c
65
{
32
index XXXXXXX..XXXXXXX 100644
66
- ARMSecuritySpace space = ptw->in_space;
33
--- a/hw/misc/aspeed_scu.c
67
bool is_secure = ptw->in_secure;
34
+++ b/hw/misc/aspeed_scu.c
68
ARMMMUIdx mmu_idx = ptw->in_mmu_idx;
35
@@ -XXX,XX +XXX,XX @@ static void aspeed_scu_write(void *opaque, hwaddr offset, uint64_t data,
69
ARMMMUIdx s2_mmu_idx = ptw->in_ptw_idx;
36
s->regs[reg] = data;
70
@@ -XXX,XX +XXX,XX @@ static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw,
37
aspeed_scu_set_apb_freq(s);
71
* From gdbstub, do not use softmmu so that we don't modify the
38
break;
72
* state of the cpu at all, including softmmu tlb contents.
39
-
73
*/
40
+ case HW_STRAP1:
74
+ ARMSecuritySpace s2_space = S2_security_space(ptw->in_space, s2_mmu_idx);
41
+ if (ASPEED_IS_AST2500(s->regs[SILICON_REV])) {
75
S1Translate s2ptw = {
42
+ s->regs[HW_STRAP1] |= data;
76
.in_mmu_idx = s2_mmu_idx,
43
+ return;
77
.in_ptw_idx = ptw_idx_for_stage_2(env, s2_mmu_idx),
44
+ }
78
- .in_secure = s2_mmu_idx == ARMMMUIdx_Stage2_S,
45
+ /* Jump to assignment below */
79
- .in_space = (s2_mmu_idx == ARMMMUIdx_Stage2_S ? ARMSS_Secure
46
+ break;
80
- : space == ARMSS_Realm ? ARMSS_Realm
47
+ case SILICON_REV:
81
- : ARMSS_NonSecure),
48
+ if (ASPEED_IS_AST2500(s->regs[SILICON_REV])) {
82
+ .in_secure = arm_space_is_secure(s2_space),
49
+ s->regs[HW_STRAP1] &= ~data;
83
+ .in_space = s2_space,
50
+ } else {
84
.in_debug = true,
51
+ qemu_log_mask(LOG_GUEST_ERROR,
85
};
52
+ "%s: Write to read-only offset 0x%" HWADDR_PRIx "\n",
86
GetPhysAddrResult s2 = { };
53
+ __func__, offset);
54
+ }
55
+ /* Avoid assignment below, we've handled everything */
56
+ return;
57
case FREQ_CNTR_EVAL:
58
case VGA_SCRATCH1 ... VGA_SCRATCH8:
59
case RNG_DATA:
60
- case SILICON_REV:
61
case FREE_CNTR4:
62
case FREE_CNTR4_EXT:
63
qemu_log_mask(LOG_GUEST_ERROR,
64
--
87
--
65
2.17.1
88
2.34.1
66
67
diff view generated by jsdifflib
1
In gic_deactivate_irq() the interrupt number comes from the guest
1
In get_phys_addr_twostage() the code that applies the effects of
2
(on a write to the GICC_DIR register), so we need to sanity check
2
VSTCR.{SA,SW} and VTCR.{NSA,NSW} only updates result->f.attrs.secure.
3
that it isn't out of range before we use it as an array index.
3
Now we also have f.attrs.space for FEAT_RME, we need to keep the two
4
Handle this in a similar manner to the check we do in
4
in sync.
5
gic_complete_irq() for the GICC_EOI register.
6
5
7
The array overrun is not disastrous because the calling code
6
These bits only have an effect for Secure space translations, not
8
uses (value & 0x3ff) to extract the interrupt field, so the
7
for Root, so use the input in_space field to determine whether to
9
only out-of-range values possible are 1020..1023, which allow
8
apply them rather than the input is_secure. This doesn't actually
10
overrunning only from irq_state[] into the following
9
make a difference because Root translations are never two-stage,
11
irq_target[] array which the guest can already manipulate.
10
but it's a little clearer.
12
11
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
15
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
14
Message-id: 20230710152130.3928330-4-peter.maydell@linaro.org
16
Message-id: 20180712154152.32183-2-peter.maydell@linaro.org
17
---
15
---
18
hw/intc/arm_gic.c | 16 +++++++++++++++-
16
target/arm/ptw.c | 13 ++++++++-----
19
1 file changed, 15 insertions(+), 1 deletion(-)
17
1 file changed, 8 insertions(+), 5 deletions(-)
20
18
21
diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c
19
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
22
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
23
--- a/hw/intc/arm_gic.c
21
--- a/target/arm/ptw.c
24
+++ b/hw/intc/arm_gic.c
22
+++ b/target/arm/ptw.c
25
@@ -XXX,XX +XXX,XX @@ static bool gic_eoi_split(GICState *s, int cpu, MemTxAttrs attrs)
23
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw,
26
static void gic_deactivate_irq(GICState *s, int cpu, int irq, MemTxAttrs attrs)
24
hwaddr ipa;
27
{
25
int s1_prot, s1_lgpgsz;
28
int cm = 1 << cpu;
26
bool is_secure = ptw->in_secure;
29
- int group = gic_has_groups(s) && GIC_TEST_GROUP(irq, cm);
27
+ ARMSecuritySpace in_space = ptw->in_space;
30
+ int group;
28
bool ret, ipa_secure;
31
+
29
ARMCacheAttrs cacheattrs1;
32
+ if (irq >= s->num_irq) {
30
ARMSecuritySpace ipa_space;
33
+ /*
31
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw,
34
+ * This handles two cases:
32
* Check if IPA translates to secure or non-secure PA space.
35
+ * 1. If software writes the ID of a spurious interrupt [ie 1023]
33
* Note that VSTCR overrides VTCR and {N}SW overrides {N}SA.
36
+ * to the GICC_DIR, the GIC ignores that write.
34
*/
37
+ * 2. If software writes the number of a non-existent interrupt
35
- result->f.attrs.secure =
38
+ * this must be a subcase of "value written is not an active interrupt"
36
- (is_secure
39
+ * and so this is UNPREDICTABLE. We choose to ignore it.
37
- && !(env->cp15.vstcr_el2 & (VSTCR_SA | VSTCR_SW))
40
+ */
38
- && (ipa_secure
41
+ return;
39
- || !(env->cp15.vtcr_el2 & (VTCR_NSA | VTCR_NSW))));
40
+ if (in_space == ARMSS_Secure) {
41
+ result->f.attrs.secure =
42
+ !(env->cp15.vstcr_el2 & (VSTCR_SA | VSTCR_SW))
43
+ && (ipa_secure
44
+ || !(env->cp15.vtcr_el2 & (VTCR_NSA | VTCR_NSW)));
45
+ result->f.attrs.space = arm_secure_to_space(result->f.attrs.secure);
42
+ }
46
+ }
43
+
47
44
+ group = gic_has_groups(s) && GIC_TEST_GROUP(irq, cm);
48
return false;
45
49
}
46
if (!gic_eoi_split(s, cpu, attrs)) {
47
/* This is UNPREDICTABLE; we choose to ignore it */
48
--
50
--
49
2.17.1
51
2.34.1
50
51
diff view generated by jsdifflib
1
In get_page_addr_code(), we were incorrectly looking in the victim
1
In commit f0a08b0913befbd we changed the type of the PC from
2
TLB for an entry which matched the target address for reads, not
2
target_ulong to vaddr. In doing so we inadvertently dropped the
3
for code accesses. This meant that we could hit on a victim TLB
3
zero-padding on the PC in trace lines (the second item inside the []
4
entry that indicated that the address was readable but not
4
in these lines). They used to look like this on AArch64, for
5
executable, and incorrectly bypass the call to tlb_fill() which
5
instance:
6
should generate the guest MMU exception. Fix this bug.
7
6
7
Trace 0: 0x7f2260000100 [00000000/0000000040000000/00000061/ff200000]
8
9
and now they look like this:
10
Trace 0: 0x7f4f50000100 [00000000/40000000/00000061/ff200000]
11
12
and if the PC happens to be somewhere low like 0x5000
13
then the field is shown as /5000/.
14
15
This is because TARGET_FMT_lx is a "%08x" or "%016x" specifier,
16
depending on TARGET_LONG_SIZE, whereas VADDR_PRIx is just PRIx64
17
with no width specifier.
18
19
Restore the zero-padding by adding an 016 width specifier to
20
this tracing and a couple of others that were similarly recently
21
changed to use VADDR_PRIx without a width specifier.
22
23
We can't unfortunately restore the "32-bit guests are padded to
24
8 hex digits and 64-bit guests to 16 hex digits" behaviour so
25
easily.
26
27
Fixes: f0a08b0913befbd ("accel/tcg/cpu-exec.c: Widen pc to vaddr")
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
28
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
29
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
10
Message-id: 20180713141636.18665-2-peter.maydell@linaro.org
30
Reviewed-by: Anton Johansson <anjo@rev.ng>
31
Message-id: 20230711165434.4123674-1-peter.maydell@linaro.org
11
---
32
---
12
accel/tcg/cputlb.c | 2 +-
33
accel/tcg/cpu-exec.c | 4 ++--
13
1 file changed, 1 insertion(+), 1 deletion(-)
34
accel/tcg/translate-all.c | 2 +-
35
2 files changed, 3 insertions(+), 3 deletions(-)
14
36
15
diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
37
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
16
index XXXXXXX..XXXXXXX 100644
38
index XXXXXXX..XXXXXXX 100644
17
--- a/accel/tcg/cputlb.c
39
--- a/accel/tcg/cpu-exec.c
18
+++ b/accel/tcg/cputlb.c
40
+++ b/accel/tcg/cpu-exec.c
19
@@ -XXX,XX +XXX,XX @@ tb_page_addr_t get_page_addr_code(CPUArchState *env, target_ulong addr)
41
@@ -XXX,XX +XXX,XX @@ static void log_cpu_exec(vaddr pc, CPUState *cpu,
20
index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1);
42
if (qemu_log_in_addr_range(pc)) {
21
mmu_idx = cpu_mmu_index(env, true);
43
qemu_log_mask(CPU_LOG_EXEC,
22
if (unlikely(!tlb_hit(env->tlb_table[mmu_idx][index].addr_code, addr))) {
44
"Trace %d: %p [%08" PRIx64
23
- if (!VICTIM_TLB_HIT(addr_read, addr)) {
45
- "/%" VADDR_PRIx "/%08x/%08x] %s\n",
24
+ if (!VICTIM_TLB_HIT(addr_code, addr)) {
46
+ "/%016" VADDR_PRIx "/%08x/%08x] %s\n",
25
tlb_fill(ENV_GET_CPU(env), addr, 0, MMU_INST_FETCH, mmu_idx, 0);
47
cpu->cpu_index, tb->tc.ptr, tb->cs_base, pc,
48
tb->flags, tb->cflags, lookup_symbol(pc));
49
50
@@ -XXX,XX +XXX,XX @@ cpu_tb_exec(CPUState *cpu, TranslationBlock *itb, int *tb_exit)
51
if (qemu_loglevel_mask(CPU_LOG_EXEC)) {
52
vaddr pc = log_pc(cpu, last_tb);
53
if (qemu_log_in_addr_range(pc)) {
54
- qemu_log("Stopped execution of TB chain before %p [%"
55
+ qemu_log("Stopped execution of TB chain before %p [%016"
56
VADDR_PRIx "] %s\n",
57
last_tb->tc.ptr, pc, lookup_symbol(pc));
58
}
59
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
60
index XXXXXXX..XXXXXXX 100644
61
--- a/accel/tcg/translate-all.c
62
+++ b/accel/tcg/translate-all.c
63
@@ -XXX,XX +XXX,XX @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr)
64
if (qemu_loglevel_mask(CPU_LOG_EXEC)) {
65
vaddr pc = log_pc(cpu, tb);
66
if (qemu_log_in_addr_range(pc)) {
67
- qemu_log("cpu_io_recompile: rewound execution of TB to %"
68
+ qemu_log("cpu_io_recompile: rewound execution of TB to %016"
69
VADDR_PRIx "\n", pc);
26
}
70
}
27
}
71
}
28
--
72
--
29
2.17.1
73
2.34.1
30
74
31
75
diff view generated by jsdifflib
1
From: Thomas Huth <thuth@redhat.com>
1
From: Tong Ho <tong.ho@amd.com>
2
2
3
These devices are currently causing some problems when a user is trying
3
Add a check in the bit-set operation to write the backstore
4
to hot-plug or introspect them during runtime. Since these devices can
4
only if the affected bit is 0 before.
5
not be instantiated by the user at all (they need to be wired up in code
6
instead), we should mark them with user_creatable = false anyway, then we
7
avoid at least the crashes with the hot-plugging. The introspection problem
8
will be handled by a separate patch.
9
5
10
Signed-off-by: Thomas Huth <thuth@redhat.com>
6
With this in place, there will be no need for callers to
11
Message-id: 1531415537-26037-1-git-send-email-thuth@redhat.com
7
do the checking in order to avoid unnecessary writes.
12
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
13
Reviewed-by: Markus Armbruster <armbru@redhat.com>
9
Signed-off-by: Tong Ho <tong.ho@amd.com>
10
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
11
Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com>
12
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
---
14
---
16
hw/arm/bcm2836.c | 2 ++
15
hw/nvram/xlnx-efuse.c | 11 +++++++++--
17
1 file changed, 2 insertions(+)
16
1 file changed, 9 insertions(+), 2 deletions(-)
18
17
19
diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c
18
diff --git a/hw/nvram/xlnx-efuse.c b/hw/nvram/xlnx-efuse.c
20
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
21
--- a/hw/arm/bcm2836.c
20
--- a/hw/nvram/xlnx-efuse.c
22
+++ b/hw/arm/bcm2836.c
21
+++ b/hw/nvram/xlnx-efuse.c
23
@@ -XXX,XX +XXX,XX @@ static void bcm283x_class_init(ObjectClass *oc, void *data)
22
@@ -XXX,XX +XXX,XX @@ static bool efuse_ro_bits_find(XlnxEFuse *s, uint32_t k)
24
bc->info = data;
23
25
dc->realize = bcm2836_realize;
24
bool xlnx_efuse_set_bit(XlnxEFuse *s, unsigned int bit)
26
dc->props = bcm2836_props;
25
{
27
+ /* Reason: Must be wired up in code (see raspi_init() function) */
26
+ uint32_t set, *row;
28
+ dc->user_creatable = false;
27
+
28
if (efuse_ro_bits_find(s, bit)) {
29
g_autofree char *path = object_get_canonical_path(OBJECT(s));
30
31
@@ -XXX,XX +XXX,XX @@ bool xlnx_efuse_set_bit(XlnxEFuse *s, unsigned int bit)
32
return false;
33
}
34
35
- s->fuse32[bit / 32] |= 1 << (bit % 32);
36
- efuse_bdrv_sync(s, bit);
37
+ /* Avoid back-end write unless there is a real update */
38
+ row = &s->fuse32[bit / 32];
39
+ set = 1 << (bit % 32);
40
+ if (!(set & *row)) {
41
+ *row |= set;
42
+ efuse_bdrv_sync(s, bit);
43
+ }
44
return true;
29
}
45
}
30
46
31
static const TypeInfo bcm283x_type_info = {
32
--
47
--
33
2.17.1
48
2.34.1
34
49
35
50
diff view generated by jsdifflib