1 | A last small test of bug fixes before rc1. | 1 | Nothing exciting here: two minor bug fixes, some fixes for |
---|---|---|---|
2 | running on a 32-bit host, and a docs tweak. | ||
2 | 3 | ||
3 | thanks | 4 | thanks |
4 | -- PMM | 5 | -- PMM |
5 | 6 | ||
6 | The following changes since commit ed8ad9728a9c0eec34db9dff61dfa2f1dd625637: | 7 | The following changes since commit 6af9d12c88b9720f209912f6e4b01fefe5906d59: |
7 | 8 | ||
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 | Merge tag 'migration-20240331-pull-request' of https://gitlab.com/peterx/qemu into staging (2024-04-01 13:12:40 +0100) |
9 | 10 | ||
10 | are available in the Git repository at: | 11 | are available in the Git repository at: |
11 | 12 | ||
12 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20230717 | 13 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20240402 |
13 | 14 | ||
14 | for you to fetch changes up to c2c1c4a35c7c2b1a4140b0942b9797c857e476a4: | 15 | for you to fetch changes up to 393770d7a02135e7468018f52da610712f151ec0: |
15 | 16 | ||
16 | hw/nvram: Avoid unnecessary Xilinx eFuse backstore write (2023-07-17 11:05:52 +0100) | 17 | raspi4b: Reduce RAM to 1Gb on 32-bit hosts (2024-04-02 10:13:48 +0100) |
17 | 18 | ||
18 | ---------------------------------------------------------------- | 19 | ---------------------------------------------------------------- |
19 | target-arm queue: | 20 | target-arm queue: |
20 | * hw/arm/sbsa-ref: set 'slots' property of xhci | 21 | * take HSTR traps of cp15 accesses to EL2, not EL1 |
21 | * linux-user: Remove pointless NULL check in clock_adjtime handling | 22 | * docs: sbsa: update specs, add dt note |
22 | * ptw: Fix S1_ptw_translate() debug path | 23 | * hw/intc/arm_gicv3: ICC_HPPIR* return SPURIOUS if int group is disabled |
23 | * ptw: Account for FEAT_RME when applying {N}SW, SA bits | 24 | * tests/qtest: Fix STM32L4x5 GPIO test on 32-bit |
24 | * accel/tcg: Zero-pad PC in TCG CPU exec trace lines | 25 | * raspi4b: Reduce RAM to 1Gb on 32-bit hosts |
25 | * hw/nvram: Avoid unnecessary Xilinx eFuse backstore write | ||
26 | 26 | ||
27 | ---------------------------------------------------------------- | 27 | ---------------------------------------------------------------- |
28 | Peter Maydell (5): | 28 | Cédric Le Goater (2): |
29 | linux-user: Remove pointless NULL check in clock_adjtime handling | 29 | tests/qtest: Fix STM32L4x5 GPIO test on 32-bit |
30 | target/arm/ptw.c: Add comments to S1Translate struct fields | 30 | raspi4b: Reduce RAM to 1Gb on 32-bit hosts |
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 | 31 | ||
35 | Tong Ho (1): | 32 | Marcin Juszkiewicz (1): |
36 | hw/nvram: Avoid unnecessary Xilinx eFuse backstore write | 33 | docs: sbsa: update specs, add dt note |
37 | 34 | ||
38 | Yuquan Wang (1): | 35 | Peter Maydell (2): |
39 | hw/arm/sbsa-ref: set 'slots' property of xhci | 36 | target/arm: take HSTR traps of cp15 accesses to EL2, not EL1 |
37 | hw/intc/arm_gicv3: ICC_HPPIR* return SPURIOUS if int group is disabled | ||
40 | 38 | ||
41 | accel/tcg/cpu-exec.c | 4 +-- | 39 | docs/system/arm/sbsa.rst | 35 +++++++++++++++++------ |
42 | accel/tcg/translate-all.c | 2 +- | 40 | hw/arm/raspi4b.c | 4 +++ |
43 | hw/arm/sbsa-ref.c | 1 + | 41 | hw/intc/arm_gicv3_cpuif.c | 4 +-- |
44 | hw/nvram/xlnx-efuse.c | 11 ++++-- | 42 | target/arm/tcg/translate.c | 2 +- |
45 | linux-user/syscall.c | 12 +++---- | 43 | tests/qtest/stm32l4x5_gpio-test.c | 59 +++++++++++++++++++++++---------------- |
46 | target/arm/ptw.c | 90 +++++++++++++++++++++++++++++++++++++++++------ | 44 | 5 files changed, 68 insertions(+), 36 deletions(-) |
47 | 6 files changed, 98 insertions(+), 22 deletions(-) | 45 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Yuquan Wang <wangyuquan1236@phytium.com.cn> | ||
2 | 1 | ||
3 | This extends the slots of xhci to 64, since the default xhci_sysbus | ||
4 | just supports one slot. | ||
5 | |||
6 | Signed-off-by: Wang Yuquan <wangyuquan1236@phytium.com.cn> | ||
7 | Signed-off-by: Chen Baozi <chenbaozi@phytium.com.cn> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Reviewed-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org> | ||
10 | Tested-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org> | ||
11 | Message-id: 20230710063750.473510-2-wangyuquan1236@phytium.com.cn | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | --- | ||
14 | hw/arm/sbsa-ref.c | 1 + | ||
15 | 1 file changed, 1 insertion(+) | ||
16 | |||
17 | diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/hw/arm/sbsa-ref.c | ||
20 | +++ b/hw/arm/sbsa-ref.c | ||
21 | @@ -XXX,XX +XXX,XX @@ static void create_xhci(const SBSAMachineState *sms) | ||
22 | hwaddr base = sbsa_ref_memmap[SBSA_XHCI].base; | ||
23 | int irq = sbsa_ref_irqmap[SBSA_XHCI]; | ||
24 | DeviceState *dev = qdev_new(TYPE_XHCI_SYSBUS); | ||
25 | + qdev_prop_set_uint32(dev, "slots", XHCI_MAXSLOTS); | ||
26 | |||
27 | sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); | ||
28 | sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); | ||
29 | -- | ||
30 | 2.34.1 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | In the code for TARGET_NR_clock_adjtime, we set the pointer phtx to | ||
2 | the address of the local variable htx. This means it can never be | ||
3 | NULL, but later in the code we check it for NULL anyway. Coverity | ||
4 | complains about this (CID 1507683) because the NULL check comes after | ||
5 | a call to clock_adjtime() that assumes it is non-NULL. | ||
6 | 1 | ||
7 | Since phtx is always &htx, and is used only in three places, it's not | ||
8 | really necessary. Remove it, bringing the code structure in to line | ||
9 | with that for TARGET_NR_clock_adjtime64, which already uses a simple | ||
10 | '&htx' when it wants a pointer to 'htx'. | ||
11 | |||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
14 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
15 | Message-id: 20230623144410.1837261-1-peter.maydell@linaro.org | ||
16 | --- | ||
17 | linux-user/syscall.c | 12 +++++------- | ||
18 | 1 file changed, 5 insertions(+), 7 deletions(-) | ||
19 | |||
20 | diff --git a/linux-user/syscall.c b/linux-user/syscall.c | ||
21 | index XXXXXXX..XXXXXXX 100644 | ||
22 | --- a/linux-user/syscall.c | ||
23 | +++ b/linux-user/syscall.c | ||
24 | @@ -XXX,XX +XXX,XX @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, | ||
25 | #if defined(TARGET_NR_clock_adjtime) && defined(CONFIG_CLOCK_ADJTIME) | ||
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; | ||
34 | } | ||
35 | - ret = get_errno(clock_adjtime(arg1, phtx)); | ||
36 | - if (!is_error(ret) && phtx) { | ||
37 | - if (host_to_target_timex(arg2, phtx) != 0) { | ||
38 | - return -TARGET_EFAULT; | ||
39 | - } | ||
40 | + ret = get_errno(clock_adjtime(arg1, &htx)); | ||
41 | + if (!is_error(ret) && host_to_target_timex(arg2, &htx)) { | ||
42 | + return -TARGET_EFAULT; | ||
43 | } | ||
44 | } | ||
45 | return ret; | ||
46 | -- | ||
47 | 2.34.1 | ||
48 | |||
49 | diff view generated by jsdifflib |
1 | In get_phys_addr_twostage() the code that applies the effects of | 1 | The HSTR_EL2 register allows the hypervisor to trap AArch32 EL1 and |
---|---|---|---|
2 | VSTCR.{SA,SW} and VTCR.{NSA,NSW} only updates result->f.attrs.secure. | 2 | EL0 accesses to cp15 registers. We incorrectly implemented this so |
3 | Now we also have f.attrs.space for FEAT_RME, we need to keep the two | 3 | they trap to EL1 when we detect the need for a HSTR trap at code |
4 | in sync. | 4 | generation time. (The check in access_check_cp_reg() which we do at |
5 | runtime to catch traps from EL0 is correctly routing them to EL2.) | ||
5 | 6 | ||
6 | These bits only have an effect for Secure space translations, not | 7 | Use the correct target EL when generating the code to take the trap. |
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 | 8 | ||
9 | Cc: qemu-stable@nongnu.org | ||
10 | Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2226 | ||
11 | Fixes: 049edada5e93df ("target/arm: Make HSTR_EL2 traps take priority over UNDEF-at-EL1") | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 13 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
14 | Message-id: 20230710152130.3928330-4-peter.maydell@linaro.org | 14 | Message-id: 20240325133116.2075362-1-peter.maydell@linaro.org |
15 | --- | 15 | --- |
16 | target/arm/ptw.c | 13 ++++++++----- | 16 | target/arm/tcg/translate.c | 2 +- |
17 | 1 file changed, 8 insertions(+), 5 deletions(-) | 17 | 1 file changed, 1 insertion(+), 1 deletion(-) |
18 | 18 | ||
19 | diff --git a/target/arm/ptw.c b/target/arm/ptw.c | 19 | diff --git a/target/arm/tcg/translate.c b/target/arm/tcg/translate.c |
20 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/target/arm/ptw.c | 21 | --- a/target/arm/tcg/translate.c |
22 | +++ b/target/arm/ptw.c | 22 | +++ b/target/arm/tcg/translate.c |
23 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw, | 23 | @@ -XXX,XX +XXX,XX @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64, |
24 | hwaddr ipa; | 24 | tcg_gen_andi_i32(t, t, 1u << maskbit); |
25 | int s1_prot, s1_lgpgsz; | 25 | tcg_gen_brcondi_i32(TCG_COND_EQ, t, 0, over.label); |
26 | bool is_secure = ptw->in_secure; | 26 | |
27 | + ARMSecuritySpace in_space = ptw->in_space; | 27 | - gen_exception_insn(s, 0, EXCP_UDEF, syndrome); |
28 | bool ret, ipa_secure; | 28 | + gen_exception_insn_el(s, 0, EXCP_UDEF, syndrome, 2); |
29 | ARMCacheAttrs cacheattrs1; | 29 | /* |
30 | ARMSecuritySpace ipa_space; | 30 | * gen_exception_insn() will set is_jmp to DISAS_NORETURN, |
31 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw, | 31 | * but since we're conditionally branching over it, we want |
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 | -- | 32 | -- |
51 | 2.34.1 | 33 | 2.34.1 | diff view generated by jsdifflib |
1 | In commit fe4a5472ccd6 we rearranged the logic in S1_ptw_translate() | 1 | From: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org> |
---|---|---|---|
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. | ||
8 | 2 | ||
9 | Create a new function S2_security_space() which returns the | 3 | Hardware of sbsa-ref board is nowadays defined by both BSA and SBSA |
10 | correct security space to use for the ptw load, and use it to | 4 | specifications. Then BBR defines firmware interface. |
11 | determine the correct .in_secure and .in_space fields for the | ||
12 | stage 2 lookup for the ptw load. | ||
13 | 5 | ||
14 | Reported-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | 6 | Added note about DeviceTree data passed from QEMU to firmware. It is |
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | very minimal and provides only data we use in firmware. |
16 | Tested-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | 8 | |
17 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 9 | Added NUMA information to list of things reported by DeviceTree. |
18 | Message-id: 20230710152130.3928330-3-peter.maydell@linaro.org | 10 | |
19 | Fixes: fe4a5472ccd6 ("target/arm: Use get_phys_addr_with_struct in S1_ptw_translate") | 11 | Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org> |
12 | Message-id: 20240328163851.1386176-1-marcin.juszkiewicz@linaro.org | ||
13 | Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com> | ||
20 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
21 | --- | 15 | --- |
22 | target/arm/ptw.c | 37 ++++++++++++++++++++++++++++++++----- | 16 | docs/system/arm/sbsa.rst | 35 ++++++++++++++++++++++++++--------- |
23 | 1 file changed, 32 insertions(+), 5 deletions(-) | 17 | 1 file changed, 26 insertions(+), 9 deletions(-) |
24 | 18 | ||
25 | diff --git a/target/arm/ptw.c b/target/arm/ptw.c | 19 | diff --git a/docs/system/arm/sbsa.rst b/docs/system/arm/sbsa.rst |
26 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
27 | --- a/target/arm/ptw.c | 21 | --- a/docs/system/arm/sbsa.rst |
28 | +++ b/target/arm/ptw.c | 22 | +++ b/docs/system/arm/sbsa.rst |
29 | @@ -XXX,XX +XXX,XX @@ static bool S2_attrs_are_device(uint64_t hcr, uint8_t attrs) | 23 | @@ -XXX,XX +XXX,XX @@ |
30 | } | 24 | Arm Server Base System Architecture Reference board (``sbsa-ref``) |
31 | } | 25 | ================================================================== |
32 | 26 | ||
33 | +static ARMSecuritySpace S2_security_space(ARMSecuritySpace s1_space, | 27 | -While the ``virt`` board is a generic board platform that doesn't match |
34 | + ARMMMUIdx s2_mmu_idx) | 28 | -any real hardware the ``sbsa-ref`` board intends to look like real |
35 | +{ | 29 | -hardware. The `Server Base System Architecture |
36 | + /* | 30 | -<https://developer.arm.com/documentation/den0029/latest>`_ defines a |
37 | + * Return the security space to use for stage 2 when doing | 31 | -minimum base line of hardware support and importantly how the firmware |
38 | + * the S1 page table descriptor load. | 32 | -reports that to any operating system. |
39 | + */ | 33 | +The ``sbsa-ref`` board intends to look like real hardware (while the ``virt`` |
40 | + if (regime_is_stage2(s2_mmu_idx)) { | 34 | +board is a generic board platform that doesn't match any real hardware). |
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 | + | 35 | + |
62 | /* Translate a S1 pagetable walk through S2 if needed. */ | 36 | +The hardware part is defined by two specifications: |
63 | static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw, | 37 | + |
64 | hwaddr addr, ARMMMUFaultInfo *fi) | 38 | + - `Base System Architecture <https://developer.arm.com/documentation/den0094/>`__ (BSA) |
65 | { | 39 | + - `Server Base System Architecture <https://developer.arm.com/documentation/den0029/>`__ (SBSA) |
66 | - ARMSecuritySpace space = ptw->in_space; | 40 | + |
67 | bool is_secure = ptw->in_secure; | 41 | +The `Arm Base Boot Requirements <https://developer.arm.com/documentation/den0044/>`__ (BBR) |
68 | ARMMMUIdx mmu_idx = ptw->in_mmu_idx; | 42 | +specification defines how the firmware reports that to any operating system. |
69 | ARMMMUIdx s2_mmu_idx = ptw->in_ptw_idx; | 43 | |
70 | @@ -XXX,XX +XXX,XX @@ static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw, | 44 | It is intended to be a machine for developing firmware and testing |
71 | * From gdbstub, do not use softmmu so that we don't modify the | 45 | standards compliance with operating systems. |
72 | * state of the cpu at all, including softmmu tlb contents. | 46 | @@ -XXX,XX +XXX,XX @@ includes both internal hardware and parts affected by the qemu command line |
73 | */ | 47 | (i.e. CPUs and memory). As a result it must have a firmware specifically built |
74 | + ARMSecuritySpace s2_space = S2_security_space(ptw->in_space, s2_mmu_idx); | 48 | to expect a certain hardware layout (as you would in a real machine). |
75 | S1Translate s2ptw = { | 49 | |
76 | .in_mmu_idx = s2_mmu_idx, | 50 | +Note |
77 | .in_ptw_idx = ptw_idx_for_stage_2(env, s2_mmu_idx), | 51 | +'''' |
78 | - .in_secure = s2_mmu_idx == ARMMMUIdx_Stage2_S, | 52 | + |
79 | - .in_space = (s2_mmu_idx == ARMMMUIdx_Stage2_S ? ARMSS_Secure | 53 | +QEMU provides the guest EL3 firmware with minimal information about hardware |
80 | - : space == ARMSS_Realm ? ARMSS_Realm | 54 | +platform using minimalistic devicetree. This is not a Linux devicetree. It is |
81 | - : ARMSS_NonSecure), | 55 | +not even a firmware devicetree. |
82 | + .in_secure = arm_space_is_secure(s2_space), | 56 | + |
83 | + .in_space = s2_space, | 57 | +It is information passed from QEMU to describe the information a hardware |
84 | .in_debug = true, | 58 | +platform would have other mechanisms to discover at runtime, that are affected |
85 | }; | 59 | +by the QEMU command line. |
86 | GetPhysAddrResult s2 = { }; | 60 | + |
61 | +Ultimately this devicetree may be replaced by IPC calls to an emulated SCP. | ||
62 | + | ||
63 | DeviceTree information | ||
64 | '''''''''''''''''''''' | ||
65 | |||
66 | -The devicetree provided by the board model to the firmware is not intended | ||
67 | -to be a complete compliant DT. It currently reports: | ||
68 | +The devicetree reports: | ||
69 | |||
70 | - CPUs | ||
71 | - memory | ||
72 | - platform version | ||
73 | - GIC addresses | ||
74 | + - NUMA node id for CPUs and memory | ||
75 | |||
76 | Platform version | ||
77 | '''''''''''''''' | ||
78 | @@ -XXX,XX +XXX,XX @@ Platform version changes: | ||
79 | GIC ITS information is present in devicetree. | ||
80 | |||
81 | 0.3 | ||
82 | - The USB controller is an XHCI device, not EHCI | ||
83 | + The USB controller is an XHCI device, not EHCI. | ||
87 | -- | 84 | -- |
88 | 2.34.1 | 85 | 2.34.1 | diff view generated by jsdifflib |
1 | Add comments to the in_* fields in the S1Translate struct | 1 | If the group of the highest priority pending interrupt is disabled |
---|---|---|---|
2 | that explain what they're doing. | 2 | via ICC_IGRPEN*, the ICC_HPPIR* registers should return |
3 | INTID_SPURIOUS, not the interrupt ID. (See the GIC architecture | ||
4 | specification pseudocode functions ICC_HPPIR1_EL1[] and | ||
5 | HighestPriorityPendingInterrupt().) | ||
3 | 6 | ||
7 | Make HPPIR reads honour the group disable, the way we already do | ||
8 | when determining whether to preempt in icc_hppi_can_preempt(). | ||
9 | |||
10 | Cc: qemu-stable@nongnu.org | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 12 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
6 | Message-id: 20230710152130.3928330-2-peter.maydell@linaro.org | 13 | Message-id: 20240328153333.2522667-1-peter.maydell@linaro.org |
7 | --- | 14 | --- |
8 | target/arm/ptw.c | 40 ++++++++++++++++++++++++++++++++++++++++ | 15 | hw/intc/arm_gicv3_cpuif.c | 4 ++-- |
9 | 1 file changed, 40 insertions(+) | 16 | 1 file changed, 2 insertions(+), 2 deletions(-) |
10 | 17 | ||
11 | diff --git a/target/arm/ptw.c b/target/arm/ptw.c | 18 | diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c |
12 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/target/arm/ptw.c | 20 | --- a/hw/intc/arm_gicv3_cpuif.c |
14 | +++ b/target/arm/ptw.c | 21 | +++ b/hw/intc/arm_gicv3_cpuif.c |
15 | @@ -XXX,XX +XXX,XX @@ | 22 | @@ -XXX,XX +XXX,XX @@ static uint64_t icc_hppir0_value(GICv3CPUState *cs, CPUARMState *env) |
16 | #endif | 23 | */ |
17 | 24 | bool irq_is_secure; | |
18 | typedef struct S1Translate { | 25 | |
19 | + /* | 26 | - if (cs->hppi.prio == 0xff) { |
20 | + * in_mmu_idx : specifies which TTBR, TCR, etc to use for the walk. | 27 | + if (icc_no_enabled_hppi(cs)) { |
21 | + * Together with in_space, specifies the architectural translation regime. | 28 | return INTID_SPURIOUS; |
22 | + */ | 29 | } |
23 | ARMMMUIdx in_mmu_idx; | 30 | |
24 | + /* | 31 | @@ -XXX,XX +XXX,XX @@ static uint64_t icc_hppir1_value(GICv3CPUState *cs, CPUARMState *env) |
25 | + * in_ptw_idx: specifies which mmuidx to use for the actual | 32 | */ |
26 | + * page table descriptor load operations. This will be one of the | 33 | bool irq_is_secure; |
27 | + * ARMMMUIdx_Stage2* or one of the ARMMMUIdx_Phys_* indexes. | 34 | |
28 | + * If a Secure ptw is "downgraded" to NonSecure by an NSTable bit, | 35 | - if (cs->hppi.prio == 0xff) { |
29 | + * this field is updated accordingly. | 36 | + if (icc_no_enabled_hppi(cs)) { |
30 | + */ | 37 | return INTID_SPURIOUS; |
31 | ARMMMUIdx in_ptw_idx; | 38 | } |
32 | + /* | 39 | |
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 | -- | 40 | -- |
67 | 2.34.1 | 41 | 2.34.1 | diff view generated by jsdifflib |
1 | In commit f0a08b0913befbd we changed the type of the PC from | 1 | From: Cédric Le Goater <clg@redhat.com> |
---|---|---|---|
2 | target_ulong to vaddr. In doing so we inadvertently dropped the | ||
3 | zero-padding on the PC in trace lines (the second item inside the [] | ||
4 | in these lines). They used to look like this on AArch64, for | ||
5 | instance: | ||
6 | 2 | ||
7 | Trace 0: 0x7f2260000100 [00000000/0000000040000000/00000061/ff200000] | 3 | The test mangles the GPIO address and the pin number in the |
4 | qtest_add_data_func data parameter. Doing so, it assumes that the host | ||
5 | pointer size is always 64-bit, which breaks on 32-bit : | ||
8 | 6 | ||
9 | and now they look like this: | 7 | ../tests/qtest/stm32l4x5_gpio-test.c: In function ‘test_gpio_output_mode’: |
10 | Trace 0: 0x7f4f50000100 [00000000/40000000/00000061/ff200000] | 8 | ../tests/qtest/stm32l4x5_gpio-test.c:272:25: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] |
9 | 272 | unsigned int pin = ((uint64_t)data) & 0xF; | ||
10 | | ^ | ||
11 | ../tests/qtest/stm32l4x5_gpio-test.c:273:22: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] | ||
12 | 273 | uint32_t gpio = ((uint64_t)data) >> 32; | ||
13 | | ^ | ||
11 | 14 | ||
12 | and if the PC happens to be somewhere low like 0x5000 | 15 | To fix, improve the mangling of the GPIO address and pin number fields |
13 | then the field is shown as /5000/. | 16 | by using GPIO_SIZE so that the resulting value fits in a 32-bit pointer. |
17 | While at it, include some helpers to hide the details. | ||
14 | 18 | ||
15 | This is because TARGET_FMT_lx is a "%08x" or "%016x" specifier, | 19 | Cc: Arnaud Minier <arnaud.minier@telecom-paris.fr> |
16 | depending on TARGET_LONG_SIZE, whereas VADDR_PRIx is just PRIx64 | 20 | Cc: Inès Varhol <ines.varhol@telecom-paris.fr> |
17 | with no width specifier. | 21 | Signed-off-by: Cédric Le Goater <clg@redhat.com> |
22 | Message-id: 20240329092747.298259-1-clg@redhat.com | ||
23 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
24 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
25 | --- | ||
26 | tests/qtest/stm32l4x5_gpio-test.c | 59 ++++++++++++++++++------------- | ||
27 | 1 file changed, 35 insertions(+), 24 deletions(-) | ||
18 | 28 | ||
19 | Restore the zero-padding by adding an 016 width specifier to | 29 | diff --git a/tests/qtest/stm32l4x5_gpio-test.c b/tests/qtest/stm32l4x5_gpio-test.c |
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") | ||
28 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
29 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
30 | Reviewed-by: Anton Johansson <anjo@rev.ng> | ||
31 | Message-id: 20230711165434.4123674-1-peter.maydell@linaro.org | ||
32 | --- | ||
33 | accel/tcg/cpu-exec.c | 4 ++-- | ||
34 | accel/tcg/translate-all.c | 2 +- | ||
35 | 2 files changed, 3 insertions(+), 3 deletions(-) | ||
36 | |||
37 | diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c | ||
38 | index XXXXXXX..XXXXXXX 100644 | 30 | index XXXXXXX..XXXXXXX 100644 |
39 | --- a/accel/tcg/cpu-exec.c | 31 | --- a/tests/qtest/stm32l4x5_gpio-test.c |
40 | +++ b/accel/tcg/cpu-exec.c | 32 | +++ b/tests/qtest/stm32l4x5_gpio-test.c |
41 | @@ -XXX,XX +XXX,XX @@ static void log_cpu_exec(vaddr pc, CPUState *cpu, | 33 | @@ -XXX,XX +XXX,XX @@ const uint32_t idr_reset[NUM_GPIOS] = { |
42 | if (qemu_log_in_addr_range(pc)) { | 34 | 0x00000000 |
43 | qemu_log_mask(CPU_LOG_EXEC, | 35 | }; |
44 | "Trace %d: %p [%08" PRIx64 | 36 | |
45 | - "/%" VADDR_PRIx "/%08x/%08x] %s\n", | 37 | +#define PIN_MASK 0xF |
46 | + "/%016" VADDR_PRIx "/%08x/%08x] %s\n", | 38 | +#define GPIO_ADDR_MASK (~(GPIO_SIZE - 1)) |
47 | cpu->cpu_index, tb->tc.ptr, tb->cs_base, pc, | 39 | + |
48 | tb->flags, tb->cflags, lookup_symbol(pc)); | 40 | +static inline void *test_data(uint32_t gpio_addr, uint8_t pin) |
49 | 41 | +{ | |
50 | @@ -XXX,XX +XXX,XX @@ cpu_tb_exec(CPUState *cpu, TranslationBlock *itb, int *tb_exit) | 42 | + return (void *)(uintptr_t)((gpio_addr & GPIO_ADDR_MASK) | (pin & PIN_MASK)); |
51 | if (qemu_loglevel_mask(CPU_LOG_EXEC)) { | 43 | +} |
52 | vaddr pc = log_pc(cpu, last_tb); | 44 | + |
53 | if (qemu_log_in_addr_range(pc)) { | 45 | +#define test_gpio_addr(data) ((uintptr_t)(data) & GPIO_ADDR_MASK) |
54 | - qemu_log("Stopped execution of TB chain before %p [%" | 46 | +#define test_pin(data) ((uintptr_t)(data) & PIN_MASK) |
55 | + qemu_log("Stopped execution of TB chain before %p [%016" | 47 | + |
56 | VADDR_PRIx "] %s\n", | 48 | static uint32_t gpio_readl(unsigned int gpio, unsigned int offset) |
57 | last_tb->tc.ptr, pc, lookup_symbol(pc)); | 49 | { |
58 | } | 50 | return readl(gpio + offset); |
59 | diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c | 51 | @@ -XXX,XX +XXX,XX @@ static void test_gpio_output_mode(const void *data) |
60 | index XXXXXXX..XXXXXXX 100644 | 52 | * Additionally, it checks that values written to ODR |
61 | --- a/accel/tcg/translate-all.c | 53 | * when not in output mode are stored and not discarded. |
62 | +++ b/accel/tcg/translate-all.c | 54 | */ |
63 | @@ -XXX,XX +XXX,XX @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr) | 55 | - unsigned int pin = ((uint64_t)data) & 0xF; |
64 | if (qemu_loglevel_mask(CPU_LOG_EXEC)) { | 56 | - uint32_t gpio = ((uint64_t)data) >> 32; |
65 | vaddr pc = log_pc(cpu, tb); | 57 | + unsigned int pin = test_pin(data); |
66 | if (qemu_log_in_addr_range(pc)) { | 58 | + uint32_t gpio = test_gpio_addr(data); |
67 | - qemu_log("cpu_io_recompile: rewound execution of TB to %" | 59 | unsigned int gpio_id = get_gpio_id(gpio); |
68 | + qemu_log("cpu_io_recompile: rewound execution of TB to %016" | 60 | |
69 | VADDR_PRIx "\n", pc); | 61 | qtest_irq_intercept_in(global_qtest, "/machine/soc/syscfg"); |
70 | } | 62 | @@ -XXX,XX +XXX,XX @@ static void test_gpio_input_mode(const void *data) |
71 | } | 63 | * corresponding GPIO line high/low : it should set the |
64 | * right bit in IDR and send an irq to syscfg. | ||
65 | */ | ||
66 | - unsigned int pin = ((uint64_t)data) & 0xF; | ||
67 | - uint32_t gpio = ((uint64_t)data) >> 32; | ||
68 | + unsigned int pin = test_pin(data); | ||
69 | + uint32_t gpio = test_gpio_addr(data); | ||
70 | unsigned int gpio_id = get_gpio_id(gpio); | ||
71 | |||
72 | qtest_irq_intercept_in(global_qtest, "/machine/soc/syscfg"); | ||
73 | @@ -XXX,XX +XXX,XX @@ static void test_pull_up_pull_down(const void *data) | ||
74 | * Test that a floating pin with pull-up sets the pin | ||
75 | * high and vice-versa. | ||
76 | */ | ||
77 | - unsigned int pin = ((uint64_t)data) & 0xF; | ||
78 | - uint32_t gpio = ((uint64_t)data) >> 32; | ||
79 | + unsigned int pin = test_pin(data); | ||
80 | + uint32_t gpio = test_gpio_addr(data); | ||
81 | unsigned int gpio_id = get_gpio_id(gpio); | ||
82 | |||
83 | qtest_irq_intercept_in(global_qtest, "/machine/soc/syscfg"); | ||
84 | @@ -XXX,XX +XXX,XX @@ static void test_push_pull(const void *data) | ||
85 | * disconnects the pin, that the pin can't be set or reset | ||
86 | * externally afterwards. | ||
87 | */ | ||
88 | - unsigned int pin = ((uint64_t)data) & 0xF; | ||
89 | - uint32_t gpio = ((uint64_t)data) >> 32; | ||
90 | + unsigned int pin = test_pin(data); | ||
91 | + uint32_t gpio = test_gpio_addr(data); | ||
92 | uint32_t gpio2 = GPIO_BASE_ADDR + (GPIO_H - gpio); | ||
93 | |||
94 | qtest_irq_intercept_in(global_qtest, "/machine/soc/syscfg"); | ||
95 | @@ -XXX,XX +XXX,XX @@ static void test_open_drain(const void *data) | ||
96 | * However a pin set low externally shouldn't be disconnected, | ||
97 | * and it can be set low externally when in open-drain mode. | ||
98 | */ | ||
99 | - unsigned int pin = ((uint64_t)data) & 0xF; | ||
100 | - uint32_t gpio = ((uint64_t)data) >> 32; | ||
101 | + unsigned int pin = test_pin(data); | ||
102 | + uint32_t gpio = test_gpio_addr(data); | ||
103 | uint32_t gpio2 = GPIO_BASE_ADDR + (GPIO_H - gpio); | ||
104 | |||
105 | qtest_irq_intercept_in(global_qtest, "/machine/soc/syscfg"); | ||
106 | @@ -XXX,XX +XXX,XX @@ static void test_bsrr_brr(const void *data) | ||
107 | * has the desired effect on ODR. | ||
108 | * In BSRR, BSx has priority over BRx. | ||
109 | */ | ||
110 | - unsigned int pin = ((uint64_t)data) & 0xF; | ||
111 | - uint32_t gpio = ((uint64_t)data) >> 32; | ||
112 | + unsigned int pin = test_pin(data); | ||
113 | + uint32_t gpio = test_gpio_addr(data); | ||
114 | |||
115 | gpio_writel(gpio, BSRR, (1 << pin)); | ||
116 | g_assert_cmphex(gpio_readl(gpio, ODR), ==, reset(gpio, ODR) | (1 << pin)); | ||
117 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv) | ||
118 | * is problematic since the pin was already high. | ||
119 | */ | ||
120 | qtest_add_data_func("stm32l4x5/gpio/test_gpioc5_output_mode", | ||
121 | - (void *)((uint64_t)GPIO_C << 32 | 5), | ||
122 | + test_data(GPIO_C, 5), | ||
123 | test_gpio_output_mode); | ||
124 | qtest_add_data_func("stm32l4x5/gpio/test_gpioh3_output_mode", | ||
125 | - (void *)((uint64_t)GPIO_H << 32 | 3), | ||
126 | + test_data(GPIO_H, 3), | ||
127 | test_gpio_output_mode); | ||
128 | qtest_add_data_func("stm32l4x5/gpio/test_gpio_input_mode1", | ||
129 | - (void *)((uint64_t)GPIO_D << 32 | 6), | ||
130 | + test_data(GPIO_D, 6), | ||
131 | test_gpio_input_mode); | ||
132 | qtest_add_data_func("stm32l4x5/gpio/test_gpio_input_mode2", | ||
133 | - (void *)((uint64_t)GPIO_C << 32 | 10), | ||
134 | + test_data(GPIO_C, 10), | ||
135 | test_gpio_input_mode); | ||
136 | qtest_add_data_func("stm32l4x5/gpio/test_gpio_pull_up_pull_down1", | ||
137 | - (void *)((uint64_t)GPIO_B << 32 | 5), | ||
138 | + test_data(GPIO_B, 5), | ||
139 | test_pull_up_pull_down); | ||
140 | qtest_add_data_func("stm32l4x5/gpio/test_gpio_pull_up_pull_down2", | ||
141 | - (void *)((uint64_t)GPIO_F << 32 | 1), | ||
142 | + test_data(GPIO_F, 1), | ||
143 | test_pull_up_pull_down); | ||
144 | qtest_add_data_func("stm32l4x5/gpio/test_gpio_push_pull1", | ||
145 | - (void *)((uint64_t)GPIO_G << 32 | 6), | ||
146 | + test_data(GPIO_G, 6), | ||
147 | test_push_pull); | ||
148 | qtest_add_data_func("stm32l4x5/gpio/test_gpio_push_pull2", | ||
149 | - (void *)((uint64_t)GPIO_H << 32 | 3), | ||
150 | + test_data(GPIO_H, 3), | ||
151 | test_push_pull); | ||
152 | qtest_add_data_func("stm32l4x5/gpio/test_gpio_open_drain1", | ||
153 | - (void *)((uint64_t)GPIO_C << 32 | 4), | ||
154 | + test_data(GPIO_C, 4), | ||
155 | test_open_drain); | ||
156 | qtest_add_data_func("stm32l4x5/gpio/test_gpio_open_drain2", | ||
157 | - (void *)((uint64_t)GPIO_E << 32 | 11), | ||
158 | + test_data(GPIO_E, 11), | ||
159 | test_open_drain); | ||
160 | qtest_add_data_func("stm32l4x5/gpio/test_bsrr_brr1", | ||
161 | - (void *)((uint64_t)GPIO_A << 32 | 12), | ||
162 | + test_data(GPIO_A, 12), | ||
163 | test_bsrr_brr); | ||
164 | qtest_add_data_func("stm32l4x5/gpio/test_bsrr_brr2", | ||
165 | - (void *)((uint64_t)GPIO_D << 32 | 0), | ||
166 | + test_data(GPIO_D, 0), | ||
167 | test_bsrr_brr); | ||
168 | |||
169 | qtest_start("-machine b-l475e-iot01a"); | ||
72 | -- | 170 | -- |
73 | 2.34.1 | 171 | 2.34.1 |
74 | 172 | ||
75 | 173 | diff view generated by jsdifflib |
1 | From: Tong Ho <tong.ho@amd.com> | 1 | From: Cédric Le Goater <clg@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | Add a check in the bit-set operation to write the backstore | 3 | Change the board revision number and RAM size to 1Gb on 32-bit hosts. |
4 | only if the affected bit is 0 before. | 4 | On these systems, RAM has a 2047 MB limit and this breaks the tests. |
5 | 5 | ||
6 | With this in place, there will be no need for callers to | 6 | Fixes: 7785e8ea2204 ("hw/arm: Introduce Raspberry PI 4 machine") |
7 | do the checking in order to avoid unnecessary writes. | 7 | Signed-off-by: Cédric Le Goater <clg@redhat.com> |
8 | 8 | Message-id: 20240329150155.357043-1-clg@redhat.com | |
9 | Signed-off-by: Tong Ho <tong.ho@amd.com> | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
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> | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | --- | 11 | --- |
15 | hw/nvram/xlnx-efuse.c | 11 +++++++++-- | 12 | hw/arm/raspi4b.c | 4 ++++ |
16 | 1 file changed, 9 insertions(+), 2 deletions(-) | 13 | 1 file changed, 4 insertions(+) |
17 | 14 | ||
18 | diff --git a/hw/nvram/xlnx-efuse.c b/hw/nvram/xlnx-efuse.c | 15 | diff --git a/hw/arm/raspi4b.c b/hw/arm/raspi4b.c |
19 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/hw/nvram/xlnx-efuse.c | 17 | --- a/hw/arm/raspi4b.c |
21 | +++ b/hw/nvram/xlnx-efuse.c | 18 | +++ b/hw/arm/raspi4b.c |
22 | @@ -XXX,XX +XXX,XX @@ static bool efuse_ro_bits_find(XlnxEFuse *s, uint32_t k) | 19 | @@ -XXX,XX +XXX,XX @@ static void raspi4b_machine_class_init(ObjectClass *oc, void *data) |
23 | 20 | MachineClass *mc = MACHINE_CLASS(oc); | |
24 | bool xlnx_efuse_set_bit(XlnxEFuse *s, unsigned int bit) | 21 | RaspiBaseMachineClass *rmc = RASPI_BASE_MACHINE_CLASS(oc); |
25 | { | 22 | |
26 | + uint32_t set, *row; | 23 | +#if HOST_LONG_BITS == 32 |
27 | + | 24 | + rmc->board_rev = 0xa03111; /* Revision 1.1, 1 Gb RAM */ |
28 | if (efuse_ro_bits_find(s, bit)) { | 25 | +#else |
29 | g_autofree char *path = object_get_canonical_path(OBJECT(s)); | 26 | rmc->board_rev = 0xb03115; /* Revision 1.5, 2 Gb RAM */ |
30 | 27 | +#endif | |
31 | @@ -XXX,XX +XXX,XX @@ bool xlnx_efuse_set_bit(XlnxEFuse *s, unsigned int bit) | 28 | raspi_machine_class_common_init(mc, rmc->board_rev); |
32 | return false; | 29 | mc->init = raspi4b_machine_init; |
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; | ||
45 | } | 30 | } |
46 | |||
47 | -- | 31 | -- |
48 | 2.34.1 | 32 | 2.34.1 |
49 | 33 | ||
50 | 34 | diff view generated by jsdifflib |