1
target-arm queue for rc2. This has 3 Arm related bug fixes,
1
A last small test of bug fixes before rc1.
2
and a couple of non-arm patches which don't have an obviously
3
better route into the tree.
4
2
5
thanks
3
thanks
6
-- PMM
4
-- PMM
7
5
8
The following changes since commit b9e02bb3f98174209dbd5c96858e65a31723221b:
6
The following changes since commit ed8ad9728a9c0eec34db9dff61dfa2f1dd625637:
9
7
10
Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2019-07-19' into staging (2019-07-22 10:11:28 +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)
11
9
12
are available in the Git repository at:
10
are available in the Git repository at:
13
11
14
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20190722
12
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20230717
15
13
16
for you to fetch changes up to ddb45afbfbc639365d6c934e4e29f6de5e5e2a0e:
14
for you to fetch changes up to c2c1c4a35c7c2b1a4140b0942b9797c857e476a4:
17
15
18
contrib/elf2dmp: Build download.o with CURL_CFLAGS (2019-07-22 14:07:39 +0100)
16
hw/nvram: Avoid unnecessary Xilinx eFuse backstore write (2023-07-17 11:05:52 +0100)
19
17
20
----------------------------------------------------------------
18
----------------------------------------------------------------
21
target-arm queue:
19
target-arm queue:
22
* target/arm: Add missing break statement for Hypervisor Trap Exception
20
* hw/arm/sbsa-ref: set 'slots' property of xhci
23
(fixes handling of SMC insn taken to AArch32 Hyp mode via HCR.TSC)
21
* linux-user: Remove pointless NULL check in clock_adjtime handling
24
* hw/arm/fsl-imx6ul.c: Remove dead SMP-related code
22
* ptw: Fix S1_ptw_translate() debug path
25
* target/arm: Limit ID register assertions to TCG
23
* ptw: Account for FEAT_RME when applying {N}SW, SA bits
26
* configure: Clarify URL to source downloads
24
* accel/tcg: Zero-pad PC in TCG CPU exec trace lines
27
* contrib/elf2dmp: Build download.o with CURL_CFLAGS
25
* hw/nvram: Avoid unnecessary Xilinx eFuse backstore write
28
26
29
----------------------------------------------------------------
27
----------------------------------------------------------------
30
Peter Maydell (4):
28
Peter Maydell (5):
31
hw/arm/fsl-imx6ul.c: Remove dead SMP-related code
29
linux-user: Remove pointless NULL check in clock_adjtime handling
32
target/arm: Limit ID register assertions to TCG
30
target/arm/ptw.c: Add comments to S1Translate struct fields
33
configure: Clarify URL to source downloads
31
target/arm: Fix S1_ptw_translate() debug path
34
contrib/elf2dmp: Build download.o with CURL_CFLAGS
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
35
34
36
Philippe Mathieu-Daudé (1):
35
Tong Ho (1):
37
target/arm: Add missing break statement for Hypervisor Trap Exception
36
hw/nvram: Avoid unnecessary Xilinx eFuse backstore write
38
37
39
configure | 2 +-
38
Yuquan Wang (1):
40
Makefile | 1 -
39
hw/arm/sbsa-ref: set 'slots' property of xhci
41
contrib/elf2dmp/Makefile.objs | 3 +++
42
include/hw/arm/fsl-imx6ul.h | 2 +-
43
hw/arm/fsl-imx6ul.c | 62 +++++++++++++------------------------------
44
hw/arm/mcimx6ul-evk.c | 2 +-
45
target/arm/cpu.c | 7 +++--
46
target/arm/helper.c | 1 +
47
8 files changed, 30 insertions(+), 50 deletions(-)
48
40
41
accel/tcg/cpu-exec.c | 4 +--
42
accel/tcg/translate-all.c | 2 +-
43
hw/arm/sbsa-ref.c | 1 +
44
hw/nvram/xlnx-efuse.c | 11 ++++--
45
linux-user/syscall.c | 12 +++----
46
target/arm/ptw.c | 90 +++++++++++++++++++++++++++++++++++++++++------
47
6 files changed, 98 insertions(+), 22 deletions(-)
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
From: Yuquan Wang <wangyuquan1236@phytium.com.cn>
2
2
3
Reported by GCC9 when building with -Wimplicit-fallthrough=2:
3
This extends the slots of xhci to 64, since the default xhci_sysbus
4
just supports one slot.
4
5
5
target/arm/helper.c: In function ‘arm_cpu_do_interrupt_aarch32_hyp’:
6
Signed-off-by: Wang Yuquan <wangyuquan1236@phytium.com.cn>
6
target/arm/helper.c:7958:14: error: this statement may fall through [-Werror=implicit-fallthrough=]
7
Signed-off-by: Chen Baozi <chenbaozi@phytium.com.cn>
7
7958 | addr = 0x14;
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
| ~~~~~^~~~~~
9
Reviewed-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
9
target/arm/helper.c:7959:5: note: here
10
Tested-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
10
7959 | default:
11
Message-id: 20230710063750.473510-2-wangyuquan1236@phytium.com.cn
11
| ^~~~~~~
12
cc1: all warnings being treated as errors
13
14
Fixes: b9bc21ff9f9
15
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
16
Reported-by: Stefan Weil <sw@weilnetz.de>
17
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
18
Message-id: 20190719111451.12406-1-philmd@redhat.com
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
---
13
---
21
target/arm/helper.c | 1 +
14
hw/arm/sbsa-ref.c | 1 +
22
1 file changed, 1 insertion(+)
15
1 file changed, 1 insertion(+)
23
16
24
diff --git a/target/arm/helper.c b/target/arm/helper.c
17
diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
25
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
26
--- a/target/arm/helper.c
19
--- a/hw/arm/sbsa-ref.c
27
+++ b/target/arm/helper.c
20
+++ b/hw/arm/sbsa-ref.c
28
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_do_interrupt_aarch32_hyp(CPUState *cs)
21
@@ -XXX,XX +XXX,XX @@ static void create_xhci(const SBSAMachineState *sms)
29
break;
22
hwaddr base = sbsa_ref_memmap[SBSA_XHCI].base;
30
case EXCP_HYP_TRAP:
23
int irq = sbsa_ref_irqmap[SBSA_XHCI];
31
addr = 0x14;
24
DeviceState *dev = qdev_new(TYPE_XHCI_SYSBUS);
32
+ break;
25
+ qdev_prop_set_uint32(dev, "slots", XHCI_MAXSLOTS);
33
default:
26
34
cpu_abort(cs, "Unhandled exception 0x%x\n", cs->exception_index);
27
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
35
}
28
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
36
--
29
--
37
2.20.1
30
2.34.1
38
39
diff view generated by jsdifflib
1
contrib/elf2dmp has a source file which uses curl/curl.h;
1
In the code for TARGET_NR_clock_adjtime, we set the pointer phtx to
2
although we link the final executable with CURL_LIBS, we
2
the address of the local variable htx. This means it can never be
3
forgot to build this source file with CURL_CFLAGS, so if
3
NULL, but later in the code we check it for NULL anyway. Coverity
4
the curl header is in a place that's not already on the
4
complains about this (CID 1507683) because the NULL check comes after
5
system include path then it will fail to build.
5
a call to clock_adjtime() that assumes it is non-NULL.
6
6
7
Add a line specifying the cflags needed for download.o;
7
Since phtx is always &htx, and is used only in three places, it's not
8
while we are here, bring the specification of the libs
8
really necessary. Remove it, bringing the code structure in to line
9
into line with this, since using a per-object variable
9
with that for TARGET_NR_clock_adjtime64, which already uses a simple
10
setting is preferred over adding them to the final
10
'&htx' when it wants a pointer to 'htx'.
11
executable link line.
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: Marc-André Lureau <marcandre.lureau@redhat.com>
13
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
15
Message-id: 20190719100955.17180-1-peter.maydell@linaro.org
14
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
15
Message-id: 20230623144410.1837261-1-peter.maydell@linaro.org
16
---
16
---
17
Makefile | 1 -
17
linux-user/syscall.c | 12 +++++-------
18
contrib/elf2dmp/Makefile.objs | 3 +++
18
1 file changed, 5 insertions(+), 7 deletions(-)
19
2 files changed, 3 insertions(+), 1 deletion(-)
20
19
21
diff --git a/Makefile b/Makefile
20
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
22
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
23
--- a/Makefile
22
--- a/linux-user/syscall.c
24
+++ b/Makefile
23
+++ b/linux-user/syscall.c
25
@@ -XXX,XX +XXX,XX @@ ifneq ($(EXESUF),)
24
@@ -XXX,XX +XXX,XX @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
26
qemu-ga: qemu-ga$(EXESUF) $(QGA_VSS_PROVIDER) $(QEMU_GA_MSI)
25
#if defined(TARGET_NR_clock_adjtime) && defined(CONFIG_CLOCK_ADJTIME)
27
endif
26
case TARGET_NR_clock_adjtime:
28
27
{
29
-elf2dmp$(EXESUF): LIBS += $(CURL_LIBS)
28
- struct timex htx, *phtx = &htx;
30
elf2dmp$(EXESUF): $(elf2dmp-obj-y)
29
+ struct timex htx;
31
    $(call LINK, $^)
30
32
31
- if (target_to_host_timex(phtx, arg2) != 0) {
33
diff --git a/contrib/elf2dmp/Makefile.objs b/contrib/elf2dmp/Makefile.objs
32
+ if (target_to_host_timex(&htx, arg2) != 0) {
34
index XXXXXXX..XXXXXXX 100644
33
return -TARGET_EFAULT;
35
--- a/contrib/elf2dmp/Makefile.objs
34
}
36
+++ b/contrib/elf2dmp/Makefile.objs
35
- ret = get_errno(clock_adjtime(arg1, phtx));
37
@@ -1 +1,4 @@
36
- if (!is_error(ret) && phtx) {
38
elf2dmp-obj-y = main.o addrspace.o download.o pdb.o qemu_elf.o
37
- if (host_to_target_timex(arg2, phtx) != 0) {
39
+
38
- return -TARGET_EFAULT;
40
+download.o-cflags := $(CURL_CFLAGS)
39
- }
41
+download.o-libs := $(CURL_LIBS)
40
+ ret = get_errno(clock_adjtime(arg1, &htx));
41
+ if (!is_error(ret) && host_to_target_timex(arg2, &htx)) {
42
+ return -TARGET_EFAULT;
43
}
44
}
45
return ret;
42
--
46
--
43
2.20.1
47
2.34.1
44
48
45
49
diff view generated by jsdifflib
New patch
1
Add comments to the in_* fields in the S1Translate struct
2
that explain what they're doing.
1
3
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20230710152130.3928330-2-peter.maydell@linaro.org
7
---
8
target/arm/ptw.c | 40 ++++++++++++++++++++++++++++++++++++++++
9
1 file changed, 40 insertions(+)
10
11
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
12
index XXXXXXX..XXXXXXX 100644
13
--- a/target/arm/ptw.c
14
+++ b/target/arm/ptw.c
15
@@ -XXX,XX +XXX,XX @@
16
#endif
17
18
typedef struct S1Translate {
19
+ /*
20
+ * in_mmu_idx : specifies which TTBR, TCR, etc to use for the walk.
21
+ * Together with in_space, specifies the architectural translation regime.
22
+ */
23
ARMMMUIdx in_mmu_idx;
24
+ /*
25
+ * in_ptw_idx: specifies which mmuidx to use for the actual
26
+ * page table descriptor load operations. This will be one of the
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
66
--
67
2.34.1
diff view generated by jsdifflib
1
If configure detects that it's being run on a source tree which
1
In commit fe4a5472ccd6 we rearranged the logic in S1_ptw_translate()
2
is missing git modules, it prints an error messages suggesting
2
so that the debug-access "call get_phys_addr_*" codepath is used both
3
that the user downloads a correct source archive from the project
3
when S1 is doing ptw reads from stage 2 and when it is doing ptw
4
website. However https://www.qemu.org/download/ is a link to a
4
reads from physical memory. However, we didn't update the
5
page with multiple tabs, with the default being the one telling
5
calculation of s2ptw->in_space and s2ptw->in_secure to account for
6
users how to get binaries from their distro. Clarify the URL
6
the "ptw reads from physical memory" case. This meant that debug
7
we print to include the #source anchor, so that the browser will
7
accesses when in Secure state broke.
8
go directly to the source-tarball instructions.
9
8
10
Reported-by: Philippe Mathieu-Daudé <philmd@redhat.com>
9
Create a new function S2_security_space() which returns the
11
Reviewed-by: Thomas Huth <thuth@redhat.com>
10
correct security space to use for the ptw load, and use it to
12
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
11
determine the correct .in_secure and .in_space fields for the
13
Reviewed-by: Stefan Weil <sw@weilnetz.de>
12
stage 2 lookup for the ptw load.
14
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
13
14
Reported-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Message-id: 20190718131659.20783-1-peter.maydell@linaro.org
16
Tested-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
17
Suggested-by: Stefan Weil <sw@weilnetz.de>
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")
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
---
21
---
20
configure | 2 +-
22
target/arm/ptw.c | 37 ++++++++++++++++++++++++++++++++-----
21
1 file changed, 1 insertion(+), 1 deletion(-)
23
1 file changed, 32 insertions(+), 5 deletions(-)
22
24
23
diff --git a/configure b/configure
25
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
24
index XXXXXXX..XXXXXXX 100755
26
index XXXXXXX..XXXXXXX 100644
25
--- a/configure
27
--- a/target/arm/ptw.c
26
+++ b/configure
28
+++ b/target/arm/ptw.c
27
@@ -XXX,XX +XXX,XX @@ else
29
@@ -XXX,XX +XXX,XX @@ static bool S2_attrs_are_device(uint64_t hcr, uint8_t attrs)
28
echo "to acquire QEMU source archives. Non-GIT builds are only"
30
}
29
echo "supported with source archives linked from:"
31
}
30
echo
32
31
- echo " https://www.qemu.org/download/"
33
+static ARMSecuritySpace S2_security_space(ARMSecuritySpace s1_space,
32
+ echo " https://www.qemu.org/download/#source"
34
+ ARMMMUIdx s2_mmu_idx)
33
echo
35
+{
34
echo "Developers working with GIT can use scripts/archive-source.sh"
36
+ /*
35
echo "if they need to create valid source archives."
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
+}
61
+
62
/* Translate a S1 pagetable walk through S2 if needed. */
63
static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw,
64
hwaddr addr, ARMMMUFaultInfo *fi)
65
{
66
- ARMSecuritySpace space = ptw->in_space;
67
bool is_secure = ptw->in_secure;
68
ARMMMUIdx mmu_idx = ptw->in_mmu_idx;
69
ARMMMUIdx s2_mmu_idx = ptw->in_ptw_idx;
70
@@ -XXX,XX +XXX,XX @@ static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw,
71
* From gdbstub, do not use softmmu so that we don't modify the
72
* state of the cpu at all, including softmmu tlb contents.
73
*/
74
+ ARMSecuritySpace s2_space = S2_security_space(ptw->in_space, s2_mmu_idx);
75
S1Translate s2ptw = {
76
.in_mmu_idx = s2_mmu_idx,
77
.in_ptw_idx = ptw_idx_for_stage_2(env, s2_mmu_idx),
78
- .in_secure = s2_mmu_idx == ARMMMUIdx_Stage2_S,
79
- .in_space = (s2_mmu_idx == ARMMMUIdx_Stage2_S ? ARMSS_Secure
80
- : space == ARMSS_Realm ? ARMSS_Realm
81
- : ARMSS_NonSecure),
82
+ .in_secure = arm_space_is_secure(s2_space),
83
+ .in_space = s2_space,
84
.in_debug = true,
85
};
86
GetPhysAddrResult s2 = { };
36
--
87
--
37
2.20.1
88
2.34.1
38
39
diff view generated by jsdifflib
New patch
1
In get_phys_addr_twostage() the code that applies the effects of
2
VSTCR.{SA,SW} and VTCR.{NSA,NSW} only updates result->f.attrs.secure.
3
Now we also have f.attrs.space for FEAT_RME, we need to keep the two
4
in sync.
1
5
6
These bits only have an effect for Secure space translations, not
7
for Root, so use the input in_space field to determine whether to
8
apply them rather than the input is_secure. This doesn't actually
9
make a difference because Root translations are never two-stage,
10
but it's a little clearer.
11
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Message-id: 20230710152130.3928330-4-peter.maydell@linaro.org
15
---
16
target/arm/ptw.c | 13 ++++++++-----
17
1 file changed, 8 insertions(+), 5 deletions(-)
18
19
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
20
index XXXXXXX..XXXXXXX 100644
21
--- a/target/arm/ptw.c
22
+++ b/target/arm/ptw.c
23
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw,
24
hwaddr ipa;
25
int s1_prot, s1_lgpgsz;
26
bool is_secure = ptw->in_secure;
27
+ ARMSecuritySpace in_space = ptw->in_space;
28
bool ret, ipa_secure;
29
ARMCacheAttrs cacheattrs1;
30
ARMSecuritySpace ipa_space;
31
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw,
32
* Check if IPA translates to secure or non-secure PA space.
33
* Note that VSTCR overrides VTCR and {N}SW overrides {N}SA.
34
*/
35
- result->f.attrs.secure =
36
- (is_secure
37
- && !(env->cp15.vstcr_el2 & (VSTCR_SA | VSTCR_SW))
38
- && (ipa_secure
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);
46
+ }
47
48
return false;
49
}
50
--
51
2.34.1
diff view generated by jsdifflib
1
In arm_cpu_realizefn() we make several assertions about the values of
1
In commit f0a08b0913befbd we changed the type of the PC from
2
guest ID registers:
2
target_ulong to vaddr. In doing so we inadvertently dropped the
3
* if the CPU provides AArch32 v7VE or better it must advertise the
3
zero-padding on the PC in trace lines (the second item inside the []
4
ARM_DIV feature
4
in these lines). They used to look like this on AArch64, for
5
* if the CPU provides AArch32 A-profile v6 or better it must
5
instance:
6
advertise the Jazelle feature
7
6
8
These are essentially consistency checks that our ID register
7
Trace 0: 0x7f2260000100 [00000000/0000000040000000/00000061/ff200000]
9
specifications in cpu.c didn't accidentally miss out a feature,
10
because increasingly the TCG emulation gates features on the values
11
in ID registers rather than using old-style checks of ARM_FEATURE_FOO
12
bits.
13
8
14
Unfortunately, these asserts can cause problems if we're running KVM,
9
and now they look like this:
15
because in that case we don't control the values of the ID registers
10
Trace 0: 0x7f4f50000100 [00000000/40000000/00000061/ff200000]
16
-- we read them from the host kernel. In particular, if the host
17
kernel is older than 4.15 then it doesn't expose the ID registers via
18
the KVM_GET_ONE_REG ioctl, and we set up dummy values for some
19
registers and leave the rest at zero. (See the comment in
20
target/arm/kvm64.c kvm_arm_get_host_cpu_features().) This set of
21
dummy values is not sufficient to pass our assertions, and so on
22
those kernels running an AArch32 guest on AArch64 will assert.
23
11
24
We could provide a more sophisticated set of dummy ID registers in
12
and if the PC happens to be somewhere low like 0x5000
25
this case, but that still leaves the possibility of a host CPU which
13
then the field is shown as /5000/.
26
reports bogus ID register values that would cause us to assert. It's
27
more robust to only do these ID register checks if we're using TCG,
28
as that is the only case where this is truly a QEMU code bug.
29
14
30
Reported-by: Laszlo Ersek <lersek@redhat.com>
15
This is because TARGET_FMT_lx is a "%08x" or "%016x" specifier,
31
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
16
depending on TARGET_LONG_SIZE, whereas VADDR_PRIx is just PRIx64
32
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
17
with no width specifier.
33
Tested-by: Laszlo Ersek <lersek@redhat.com>
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")
34
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
28
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
35
Message-id: 20190718125928.20147-1-peter.maydell@linaro.org
29
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
36
Fixes: https://bugs.launchpad.net/qemu/+bug/1830864
30
Reviewed-by: Anton Johansson <anjo@rev.ng>
37
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
31
Message-id: 20230711165434.4123674-1-peter.maydell@linaro.org
38
---
32
---
39
target/arm/cpu.c | 7 +++++--
33
accel/tcg/cpu-exec.c | 4 ++--
40
1 file changed, 5 insertions(+), 2 deletions(-)
34
accel/tcg/translate-all.c | 2 +-
35
2 files changed, 3 insertions(+), 3 deletions(-)
41
36
42
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
37
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
43
index XXXXXXX..XXXXXXX 100644
38
index XXXXXXX..XXXXXXX 100644
44
--- a/target/arm/cpu.c
39
--- a/accel/tcg/cpu-exec.c
45
+++ b/target/arm/cpu.c
40
+++ b/accel/tcg/cpu-exec.c
46
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
41
@@ -XXX,XX +XXX,XX @@ static void log_cpu_exec(vaddr pc, CPUState *cpu,
47
* There exist AArch64 cpus without AArch32 support. When KVM
42
if (qemu_log_in_addr_range(pc)) {
48
* queries ID_ISAR0_EL1 on such a host, the value is UNKNOWN.
43
qemu_log_mask(CPU_LOG_EXEC,
49
* Similarly, we cannot check ID_AA64PFR0 without AArch64 support.
44
"Trace %d: %p [%08" PRIx64
50
+ * As a general principle, we also do not make ID register
45
- "/%" VADDR_PRIx "/%08x/%08x] %s\n",
51
+ * consistency checks anywhere unless using TCG, because only
46
+ "/%016" VADDR_PRIx "/%08x/%08x] %s\n",
52
+ * for TCG would a consistency-check failure be a QEMU bug.
47
cpu->cpu_index, tb->tc.ptr, tb->cs_base, pc,
53
*/
48
tb->flags, tb->cflags, lookup_symbol(pc));
54
if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64)) {
49
55
no_aa32 = !cpu_isar_feature(aa64_aa32, cpu);
50
@@ -XXX,XX +XXX,XX @@ cpu_tb_exec(CPUState *cpu, TranslationBlock *itb, int *tb_exit)
56
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
51
if (qemu_loglevel_mask(CPU_LOG_EXEC)) {
57
* Presence of EL2 itself is ARM_FEATURE_EL2, and of the
52
vaddr pc = log_pc(cpu, last_tb);
58
* Security Extensions is ARM_FEATURE_EL3.
53
if (qemu_log_in_addr_range(pc)) {
59
*/
54
- qemu_log("Stopped execution of TB chain before %p [%"
60
- assert(no_aa32 || cpu_isar_feature(arm_div, cpu));
55
+ qemu_log("Stopped execution of TB chain before %p [%016"
61
+ assert(!tcg_enabled() || no_aa32 || cpu_isar_feature(arm_div, cpu));
56
VADDR_PRIx "] %s\n",
62
set_feature(env, ARM_FEATURE_LPAE);
57
last_tb->tc.ptr, pc, lookup_symbol(pc));
63
set_feature(env, ARM_FEATURE_V7);
58
}
64
}
59
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
65
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
60
index XXXXXXX..XXXXXXX 100644
66
if (arm_feature(env, ARM_FEATURE_V6)) {
61
--- a/accel/tcg/translate-all.c
67
set_feature(env, ARM_FEATURE_V5);
62
+++ b/accel/tcg/translate-all.c
68
if (!arm_feature(env, ARM_FEATURE_M)) {
63
@@ -XXX,XX +XXX,XX @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr)
69
- assert(no_aa32 || cpu_isar_feature(jazelle, cpu));
64
if (qemu_loglevel_mask(CPU_LOG_EXEC)) {
70
+ assert(!tcg_enabled() || no_aa32 || cpu_isar_feature(jazelle, cpu));
65
vaddr pc = log_pc(cpu, tb);
71
set_feature(env, ARM_FEATURE_AUXCR);
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);
72
}
70
}
73
}
71
}
74
--
72
--
75
2.20.1
73
2.34.1
76
74
77
75
diff view generated by jsdifflib
1
The i.MX6UL always has a single Cortex-A7 CPU (we set FSL_IMX6UL_NUM_CPUS
1
From: Tong Ho <tong.ho@amd.com>
2
to 1 in line with this). This means that all the code in fsl-imx6ul.c to
3
handle multiple CPUs is dead code, and Coverity is now complaining that
4
it is unreachable (CID 1403008, 1403011).
5
2
6
Remove the unreachable code and the only-executes-once loops,
3
Add a check in the bit-set operation to write the backstore
7
and replace the single-entry cpu[] array in the FSLIMX6ULState
4
only if the affected bit is 0 before.
8
with a simple cpu member.
9
5
6
With this in place, there will be no need for callers to
7
do the checking in order to avoid unnecessary writes.
8
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>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
12
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
13
Message-id: 20190712115030.26895-1-peter.maydell@linaro.org
14
---
14
---
15
include/hw/arm/fsl-imx6ul.h | 2 +-
15
hw/nvram/xlnx-efuse.c | 11 +++++++++--
16
hw/arm/fsl-imx6ul.c | 62 +++++++++++--------------------------
16
1 file changed, 9 insertions(+), 2 deletions(-)
17
hw/arm/mcimx6ul-evk.c | 2 +-
18
3 files changed, 20 insertions(+), 46 deletions(-)
19
17
20
diff --git a/include/hw/arm/fsl-imx6ul.h b/include/hw/arm/fsl-imx6ul.h
18
diff --git a/hw/nvram/xlnx-efuse.c b/hw/nvram/xlnx-efuse.c
21
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
22
--- a/include/hw/arm/fsl-imx6ul.h
20
--- a/hw/nvram/xlnx-efuse.c
23
+++ b/include/hw/arm/fsl-imx6ul.h
21
+++ b/hw/nvram/xlnx-efuse.c
24
@@ -XXX,XX +XXX,XX @@ typedef struct FslIMX6ULState {
22
@@ -XXX,XX +XXX,XX @@ static bool efuse_ro_bits_find(XlnxEFuse *s, uint32_t k)
25
DeviceState parent_obj;
23
26
24
bool xlnx_efuse_set_bit(XlnxEFuse *s, unsigned int bit)
27
/*< public >*/
28
- ARMCPU cpu[FSL_IMX6UL_NUM_CPUS];
29
+ ARMCPU cpu;
30
A15MPPrivState a7mpcore;
31
IMXGPTState gpt[FSL_IMX6UL_NUM_GPTS];
32
IMXEPITState epit[FSL_IMX6UL_NUM_EPITS];
33
diff --git a/hw/arm/fsl-imx6ul.c b/hw/arm/fsl-imx6ul.c
34
index XXXXXXX..XXXXXXX 100644
35
--- a/hw/arm/fsl-imx6ul.c
36
+++ b/hw/arm/fsl-imx6ul.c
37
@@ -XXX,XX +XXX,XX @@
38
39
static void fsl_imx6ul_init(Object *obj)
40
{
25
{
41
- MachineState *ms = MACHINE(qdev_get_machine());
26
+ uint32_t set, *row;
42
FslIMX6ULState *s = FSL_IMX6UL(obj);
27
+
43
char name[NAME_SIZE];
28
if (efuse_ro_bits_find(s, bit)) {
44
int i;
29
g_autofree char *path = object_get_canonical_path(OBJECT(s));
45
30
46
- for (i = 0; i < MIN(ms->smp.cpus, FSL_IMX6UL_NUM_CPUS); i++) {
31
@@ -XXX,XX +XXX,XX @@ bool xlnx_efuse_set_bit(XlnxEFuse *s, unsigned int bit)
47
- snprintf(name, NAME_SIZE, "cpu%d", i);
32
return false;
48
- object_initialize_child(obj, name, &s->cpu[i], sizeof(s->cpu[i]),
49
- "cortex-a7-" TYPE_ARM_CPU, &error_abort, NULL);
50
- }
51
+ object_initialize_child(obj, "cpu0", &s->cpu, sizeof(s->cpu),
52
+ "cortex-a7-" TYPE_ARM_CPU, &error_abort, NULL);
53
54
/*
55
* A7MPCORE
56
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp)
57
MachineState *ms = MACHINE(qdev_get_machine());
58
FslIMX6ULState *s = FSL_IMX6UL(dev);
59
int i;
60
- qemu_irq irq;
61
char name[NAME_SIZE];
62
- unsigned int smp_cpus = ms->smp.cpus;
63
+ SysBusDevice *sbd;
64
+ DeviceState *d;
65
66
- if (smp_cpus > FSL_IMX6UL_NUM_CPUS) {
67
- error_setg(errp, "%s: Only %d CPUs are supported (%d requested)",
68
- TYPE_FSL_IMX6UL, FSL_IMX6UL_NUM_CPUS, smp_cpus);
69
+ if (ms->smp.cpus > 1) {
70
+ error_setg(errp, "%s: Only a single CPU is supported (%d requested)",
71
+ TYPE_FSL_IMX6UL, ms->smp.cpus);
72
return;
73
}
33
}
74
34
75
- for (i = 0; i < smp_cpus; i++) {
35
- s->fuse32[bit / 32] |= 1 << (bit % 32);
76
- Object *o = OBJECT(&s->cpu[i]);
36
- efuse_bdrv_sync(s, bit);
77
-
37
+ /* Avoid back-end write unless there is a real update */
78
- object_property_set_int(o, QEMU_PSCI_CONDUIT_SMC,
38
+ row = &s->fuse32[bit / 32];
79
- "psci-conduit", &error_abort);
39
+ set = 1 << (bit % 32);
80
-
40
+ if (!(set & *row)) {
81
- /* On uniprocessor, the CBAR is set to 0 */
41
+ *row |= set;
82
- if (smp_cpus > 1) {
42
+ efuse_bdrv_sync(s, bit);
83
- object_property_set_int(o, FSL_IMX6UL_A7MPCORE_ADDR,
43
+ }
84
- "reset-cbar", &error_abort);
44
return true;
85
- }
86
-
87
- if (i) {
88
- /* Secondary CPUs start in PSCI powered-down state */
89
- object_property_set_bool(o, true,
90
- "start-powered-off", &error_abort);
91
- }
92
-
93
- object_property_set_bool(o, true, "realized", &error_abort);
94
- }
95
+ object_property_set_int(OBJECT(&s->cpu), QEMU_PSCI_CONDUIT_SMC,
96
+ "psci-conduit", &error_abort);
97
+ object_property_set_bool(OBJECT(&s->cpu), true,
98
+ "realized", &error_abort);
99
100
/*
101
* A7MPCORE
102
*/
103
- object_property_set_int(OBJECT(&s->a7mpcore), smp_cpus, "num-cpu",
104
- &error_abort);
105
+ object_property_set_int(OBJECT(&s->a7mpcore), 1, "num-cpu", &error_abort);
106
object_property_set_int(OBJECT(&s->a7mpcore),
107
FSL_IMX6UL_MAX_IRQ + GIC_INTERNAL,
108
"num-irq", &error_abort);
109
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp)
110
&error_abort);
111
sysbus_mmio_map(SYS_BUS_DEVICE(&s->a7mpcore), 0, FSL_IMX6UL_A7MPCORE_ADDR);
112
113
- for (i = 0; i < smp_cpus; i++) {
114
- SysBusDevice *sbd = SYS_BUS_DEVICE(&s->a7mpcore);
115
- DeviceState *d = DEVICE(qemu_get_cpu(i));
116
+ sbd = SYS_BUS_DEVICE(&s->a7mpcore);
117
+ d = DEVICE(&s->cpu);
118
119
- irq = qdev_get_gpio_in(d, ARM_CPU_IRQ);
120
- sysbus_connect_irq(sbd, i, irq);
121
- sysbus_connect_irq(sbd, i + smp_cpus, qdev_get_gpio_in(d, ARM_CPU_FIQ));
122
- sysbus_connect_irq(sbd, i + 2 * smp_cpus,
123
- qdev_get_gpio_in(d, ARM_CPU_VIRQ));
124
- sysbus_connect_irq(sbd, i + 3 * smp_cpus,
125
- qdev_get_gpio_in(d, ARM_CPU_VFIQ));
126
- }
127
+ sysbus_connect_irq(sbd, 0, qdev_get_gpio_in(d, ARM_CPU_IRQ));
128
+ sysbus_connect_irq(sbd, 1, qdev_get_gpio_in(d, ARM_CPU_FIQ));
129
+ sysbus_connect_irq(sbd, 2, qdev_get_gpio_in(d, ARM_CPU_VIRQ));
130
+ sysbus_connect_irq(sbd, 3, qdev_get_gpio_in(d, ARM_CPU_VFIQ));
131
132
/*
133
* A7MPCORE DAP
134
diff --git a/hw/arm/mcimx6ul-evk.c b/hw/arm/mcimx6ul-evk.c
135
index XXXXXXX..XXXXXXX 100644
136
--- a/hw/arm/mcimx6ul-evk.c
137
+++ b/hw/arm/mcimx6ul-evk.c
138
@@ -XXX,XX +XXX,XX @@ static void mcimx6ul_evk_init(MachineState *machine)
139
}
140
141
if (!qtest_enabled()) {
142
- arm_load_kernel(&s->soc.cpu[0], &boot_info);
143
+ arm_load_kernel(&s->soc.cpu, &boot_info);
144
}
145
}
45
}
146
46
147
--
47
--
148
2.20.1
48
2.34.1
149
49
150
50
diff view generated by jsdifflib