1 | A last arm pullreq before rc0. This is mostly bug fixes, | 1 | A last small test of bug fixes before rc1. |
---|---|---|---|
2 | though you could call adding the missing local timer | ||
3 | support to bcm2836_control a new feature I suppose -- | ||
4 | in any case it's a small and localised change. | ||
5 | 2 | ||
6 | thanks | 3 | thanks |
7 | -- PMM | 4 | -- PMM |
8 | 5 | ||
9 | The following changes since commit 7074ab12c81a1b2b1e0e1c40983f56b2c5ccc494: | 6 | The following changes since commit ed8ad9728a9c0eec34db9dff61dfa2f1dd625637: |
10 | 7 | ||
11 | Merge remote-tracking branch 'remotes/vivier2/tags/trivial-branch-pull-request' into staging (2019-03-14 16:19:37 +0000) | 8 | Merge tag 'pull-tpm-2023-07-14-1' of https://github.com/stefanberger/qemu-tpm into staging (2023-07-15 14:54:04 +0100) |
12 | 9 | ||
13 | are available in the Git repository at: | 10 | are available in the Git repository at: |
14 | 11 | ||
15 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20190315 | 12 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20230717 |
16 | 13 | ||
17 | for you to fetch changes up to 5de56742a3c91de3d646326bec43a989bba83ca4: | 14 | for you to fetch changes up to c2c1c4a35c7c2b1a4140b0942b9797c857e476a4: |
18 | 15 | ||
19 | target/arm: Check access permission to ADDVL/ADDPL/RDVL (2019-03-15 11:12:29 +0000) | 16 | hw/nvram: Avoid unnecessary Xilinx eFuse backstore write (2023-07-17 11:05:52 +0100) |
20 | 17 | ||
21 | ---------------------------------------------------------------- | 18 | ---------------------------------------------------------------- |
22 | target-arm queue: | 19 | target-arm queue: |
23 | * Add missing SVE-enabled check to ADDVL/ADDPL/RDVL | 20 | * hw/arm/sbsa-ref: set 'slots' property of xhci |
24 | * virt-acpi-build: use PCIE_MMCFG_BUS to retrieve end_bus_number | 21 | * linux-user: Remove pointless NULL check in clock_adjtime handling |
25 | * virt-acpi-build: Fix SMMUv3 GSIV values | 22 | * ptw: Fix S1_ptw_translate() debug path |
26 | * Allow EL0 to write to arch timer registers, not just read them | 23 | * ptw: Account for FEAT_RME when applying {N}SW, SA bits |
27 | * bcm2836_control: Implement local timer | 24 | * accel/tcg: Zero-pad PC in TCG CPU exec trace lines |
25 | * hw/nvram: Avoid unnecessary Xilinx eFuse backstore write | ||
28 | 26 | ||
29 | ---------------------------------------------------------------- | 27 | ---------------------------------------------------------------- |
30 | Amir Charif (1): | 28 | Peter Maydell (5): |
31 | target/arm: Check access permission to ADDVL/ADDPL/RDVL | 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 | ||
32 | 34 | ||
33 | Dongjiu Geng (1): | 35 | Tong Ho (1): |
34 | target/arm: change arch timer registers access permission | 36 | hw/nvram: Avoid unnecessary Xilinx eFuse backstore write |
35 | 37 | ||
36 | Eric Auger (1): | 38 | Yuquan Wang (1): |
37 | hw/arm/virt-acpi-build: Fix SMMUv3 GSIV values | 39 | hw/arm/sbsa-ref: set 'slots' property of xhci |
38 | 40 | ||
39 | Wei Yang (1): | 41 | accel/tcg/cpu-exec.c | 4 +-- |
40 | hw/arm/virt-acpi-build: use PCIE_MMCFG_BUS to retrieve end_bus_number | 42 | accel/tcg/translate-all.c | 2 +- |
41 | 43 | hw/arm/sbsa-ref.c | 1 + | |
42 | Zoltán Baldaszti (1): | 44 | hw/nvram/xlnx-efuse.c | 11 ++++-- |
43 | hw/intc/bcm2836_control: Implement local timer | 45 | linux-user/syscall.c | 12 +++---- |
44 | 46 | target/arm/ptw.c | 90 +++++++++++++++++++++++++++++++++++++++++------ | |
45 | include/hw/intc/bcm2836_control.h | 9 ++++ | 47 | 6 files changed, 98 insertions(+), 22 deletions(-) |
46 | hw/arm/virt-acpi-build.c | 6 +-- | ||
47 | hw/intc/bcm2836_control.c | 101 +++++++++++++++++++++++++++++++++++++- | ||
48 | target/arm/helper.c | 30 +++++------ | ||
49 | target/arm/translate-sve.c | 22 ++++++--- | ||
50 | 5 files changed, 140 insertions(+), 28 deletions(-) | ||
51 | diff view generated by jsdifflib |
1 | From: Wei Yang <richardw.yang@linux.intel.com> | 1 | From: Yuquan Wang <wangyuquan1236@phytium.com.cn> |
---|---|---|---|
2 | 2 | ||
3 | This is more proper to use PCIE_MMCFG_BUS to retrieve end_bus_number. | 3 | This extends the slots of xhci to 64, since the default xhci_sysbus |
4 | just supports one slot. | ||
4 | 5 | ||
5 | Signed-off-by: Wei Yang <richardw.yang@linux.intel.com> | 6 | Signed-off-by: Wang Yuquan <wangyuquan1236@phytium.com.cn> |
6 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | 7 | Signed-off-by: Chen Baozi <chenbaozi@phytium.com.cn> |
7 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> | 8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Message-id: 20190312074953.16671-1-richardw.yang@linux.intel.com | 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 | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 13 | --- |
11 | hw/arm/virt-acpi-build.c | 4 ++-- | 14 | hw/arm/sbsa-ref.c | 1 + |
12 | 1 file changed, 2 insertions(+), 2 deletions(-) | 15 | 1 file changed, 1 insertion(+) |
13 | 16 | ||
14 | diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c | 17 | diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c |
15 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/arm/virt-acpi-build.c | 19 | --- a/hw/arm/sbsa-ref.c |
17 | +++ b/hw/arm/virt-acpi-build.c | 20 | +++ b/hw/arm/sbsa-ref.c |
18 | @@ -XXX,XX +XXX,XX @@ build_mcfg(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) | 21 | @@ -XXX,XX +XXX,XX @@ static void create_xhci(const SBSAMachineState *sms) |
19 | /* Only a single allocation so no need to play with segments */ | 22 | hwaddr base = sbsa_ref_memmap[SBSA_XHCI].base; |
20 | mcfg->allocation[0].pci_segment = cpu_to_le16(0); | 23 | int irq = sbsa_ref_irqmap[SBSA_XHCI]; |
21 | mcfg->allocation[0].start_bus_number = 0; | 24 | DeviceState *dev = qdev_new(TYPE_XHCI_SYSBUS); |
22 | - mcfg->allocation[0].end_bus_number = (memmap[ecam_id].size | 25 | + qdev_prop_set_uint32(dev, "slots", XHCI_MAXSLOTS); |
23 | - / PCIE_MMCFG_SIZE_MIN) - 1; | 26 | |
24 | + mcfg->allocation[0].end_bus_number = | 27 | sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); |
25 | + PCIE_MMCFG_BUS(memmap[ecam_id].size - 1); | 28 | sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); |
26 | |||
27 | build_header(linker, table_data, (void *)(table_data->data + mcfg_start), | ||
28 | "MCFG", table_data->len - mcfg_start, 1, NULL, NULL); | ||
29 | -- | 29 | -- |
30 | 2.20.1 | 30 | 2.34.1 |
31 | |||
32 | diff view generated by jsdifflib |
1 | From: Dongjiu Geng <gengdongjiu@huawei.com> | 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. | ||
2 | 6 | ||
3 | Some generic arch timer registers are Config-RW in the EL0, | 7 | Since phtx is always &htx, and is used only in three places, it's not |
4 | which means the EL0 exception level can have write permission | 8 | really necessary. Remove it, bringing the code structure in to line |
5 | if it is appropriately configured. | 9 | with that for TARGET_NR_clock_adjtime64, which already uses a simple |
10 | '&htx' when it wants a pointer to 'htx'. | ||
6 | 11 | ||
7 | When VM access registers, QEMU firstly checks whether they have RW | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | permission, then check whether it is appropriately configured. | 13 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
9 | If they are defined to read only in EL0, even though they have been | 14 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
10 | appropriately configured, they still do not have write permission. | 15 | Message-id: 20230623144410.1837261-1-peter.maydell@linaro.org |
11 | So need to add the write permission according to ARMV8 spec when | 16 | --- |
12 | define it. | 17 | linux-user/syscall.c | 12 +++++------- |
18 | 1 file changed, 5 insertions(+), 7 deletions(-) | ||
13 | 19 | ||
14 | Signed-off-by: Dongjiu Geng <gengdongjiu@huawei.com> | 20 | diff --git a/linux-user/syscall.c b/linux-user/syscall.c |
15 | Message-id: 1552395177-12608-1-git-send-email-gengdongjiu@huawei.com | ||
16 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
17 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
19 | --- | ||
20 | target/arm/helper.c | 30 +++++++++++++++--------------- | ||
21 | 1 file changed, 15 insertions(+), 15 deletions(-) | ||
22 | |||
23 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
24 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
25 | --- a/target/arm/helper.c | 22 | --- a/linux-user/syscall.c |
26 | +++ b/target/arm/helper.c | 23 | +++ b/linux-user/syscall.c |
27 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = { | 24 | @@ -XXX,XX +XXX,XX @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, |
28 | /* per-timer control */ | 25 | #if defined(TARGET_NR_clock_adjtime) && defined(CONFIG_CLOCK_ADJTIME) |
29 | { .name = "CNTP_CTL", .cp = 15, .crn = 14, .crm = 2, .opc1 = 0, .opc2 = 1, | 26 | case TARGET_NR_clock_adjtime: |
30 | .secure = ARM_CP_SECSTATE_NS, | 27 | { |
31 | - .type = ARM_CP_IO | ARM_CP_ALIAS, .access = PL1_RW | PL0_R, | 28 | - struct timex htx, *phtx = &htx; |
32 | + .type = ARM_CP_IO | ARM_CP_ALIAS, .access = PL0_RW, | 29 | + struct timex htx; |
33 | .accessfn = gt_ptimer_access, | 30 | |
34 | .fieldoffset = offsetoflow32(CPUARMState, | 31 | - if (target_to_host_timex(phtx, arg2) != 0) { |
35 | cp15.c14_timer[GTIMER_PHYS].ctl), | 32 | + if (target_to_host_timex(&htx, arg2) != 0) { |
36 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = { | 33 | return -TARGET_EFAULT; |
37 | { .name = "CNTP_CTL_S", | 34 | } |
38 | .cp = 15, .crn = 14, .crm = 2, .opc1 = 0, .opc2 = 1, | 35 | - ret = get_errno(clock_adjtime(arg1, phtx)); |
39 | .secure = ARM_CP_SECSTATE_S, | 36 | - if (!is_error(ret) && phtx) { |
40 | - .type = ARM_CP_IO | ARM_CP_ALIAS, .access = PL1_RW | PL0_R, | 37 | - if (host_to_target_timex(arg2, phtx) != 0) { |
41 | + .type = ARM_CP_IO | ARM_CP_ALIAS, .access = PL0_RW, | 38 | - return -TARGET_EFAULT; |
42 | .accessfn = gt_ptimer_access, | 39 | - } |
43 | .fieldoffset = offsetoflow32(CPUARMState, | 40 | + ret = get_errno(clock_adjtime(arg1, &htx)); |
44 | cp15.c14_timer[GTIMER_SEC].ctl), | 41 | + if (!is_error(ret) && host_to_target_timex(arg2, &htx)) { |
45 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = { | 42 | + return -TARGET_EFAULT; |
46 | }, | 43 | } |
47 | { .name = "CNTP_CTL_EL0", .state = ARM_CP_STATE_AA64, | 44 | } |
48 | .opc0 = 3, .opc1 = 3, .crn = 14, .crm = 2, .opc2 = 1, | 45 | return ret; |
49 | - .type = ARM_CP_IO, .access = PL1_RW | PL0_R, | ||
50 | + .type = ARM_CP_IO, .access = PL0_RW, | ||
51 | .accessfn = gt_ptimer_access, | ||
52 | .fieldoffset = offsetof(CPUARMState, cp15.c14_timer[GTIMER_PHYS].ctl), | ||
53 | .resetvalue = 0, | ||
54 | .writefn = gt_phys_ctl_write, .raw_writefn = raw_write, | ||
55 | }, | ||
56 | { .name = "CNTV_CTL", .cp = 15, .crn = 14, .crm = 3, .opc1 = 0, .opc2 = 1, | ||
57 | - .type = ARM_CP_IO | ARM_CP_ALIAS, .access = PL1_RW | PL0_R, | ||
58 | + .type = ARM_CP_IO | ARM_CP_ALIAS, .access = PL0_RW, | ||
59 | .accessfn = gt_vtimer_access, | ||
60 | .fieldoffset = offsetoflow32(CPUARMState, | ||
61 | cp15.c14_timer[GTIMER_VIRT].ctl), | ||
62 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = { | ||
63 | }, | ||
64 | { .name = "CNTV_CTL_EL0", .state = ARM_CP_STATE_AA64, | ||
65 | .opc0 = 3, .opc1 = 3, .crn = 14, .crm = 3, .opc2 = 1, | ||
66 | - .type = ARM_CP_IO, .access = PL1_RW | PL0_R, | ||
67 | + .type = ARM_CP_IO, .access = PL0_RW, | ||
68 | .accessfn = gt_vtimer_access, | ||
69 | .fieldoffset = offsetof(CPUARMState, cp15.c14_timer[GTIMER_VIRT].ctl), | ||
70 | .resetvalue = 0, | ||
71 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = { | ||
72 | /* TimerValue views: a 32 bit downcounting view of the underlying state */ | ||
73 | { .name = "CNTP_TVAL", .cp = 15, .crn = 14, .crm = 2, .opc1 = 0, .opc2 = 0, | ||
74 | .secure = ARM_CP_SECSTATE_NS, | ||
75 | - .type = ARM_CP_NO_RAW | ARM_CP_IO, .access = PL1_RW | PL0_R, | ||
76 | + .type = ARM_CP_NO_RAW | ARM_CP_IO, .access = PL0_RW, | ||
77 | .accessfn = gt_ptimer_access, | ||
78 | .readfn = gt_phys_tval_read, .writefn = gt_phys_tval_write, | ||
79 | }, | ||
80 | { .name = "CNTP_TVAL_S", | ||
81 | .cp = 15, .crn = 14, .crm = 2, .opc1 = 0, .opc2 = 0, | ||
82 | .secure = ARM_CP_SECSTATE_S, | ||
83 | - .type = ARM_CP_NO_RAW | ARM_CP_IO, .access = PL1_RW | PL0_R, | ||
84 | + .type = ARM_CP_NO_RAW | ARM_CP_IO, .access = PL0_RW, | ||
85 | .accessfn = gt_ptimer_access, | ||
86 | .readfn = gt_sec_tval_read, .writefn = gt_sec_tval_write, | ||
87 | }, | ||
88 | { .name = "CNTP_TVAL_EL0", .state = ARM_CP_STATE_AA64, | ||
89 | .opc0 = 3, .opc1 = 3, .crn = 14, .crm = 2, .opc2 = 0, | ||
90 | - .type = ARM_CP_NO_RAW | ARM_CP_IO, .access = PL1_RW | PL0_R, | ||
91 | + .type = ARM_CP_NO_RAW | ARM_CP_IO, .access = PL0_RW, | ||
92 | .accessfn = gt_ptimer_access, .resetfn = gt_phys_timer_reset, | ||
93 | .readfn = gt_phys_tval_read, .writefn = gt_phys_tval_write, | ||
94 | }, | ||
95 | { .name = "CNTV_TVAL", .cp = 15, .crn = 14, .crm = 3, .opc1 = 0, .opc2 = 0, | ||
96 | - .type = ARM_CP_NO_RAW | ARM_CP_IO, .access = PL1_RW | PL0_R, | ||
97 | + .type = ARM_CP_NO_RAW | ARM_CP_IO, .access = PL0_RW, | ||
98 | .accessfn = gt_vtimer_access, | ||
99 | .readfn = gt_virt_tval_read, .writefn = gt_virt_tval_write, | ||
100 | }, | ||
101 | { .name = "CNTV_TVAL_EL0", .state = ARM_CP_STATE_AA64, | ||
102 | .opc0 = 3, .opc1 = 3, .crn = 14, .crm = 3, .opc2 = 0, | ||
103 | - .type = ARM_CP_NO_RAW | ARM_CP_IO, .access = PL1_RW | PL0_R, | ||
104 | + .type = ARM_CP_NO_RAW | ARM_CP_IO, .access = PL0_RW, | ||
105 | .accessfn = gt_vtimer_access, .resetfn = gt_virt_timer_reset, | ||
106 | .readfn = gt_virt_tval_read, .writefn = gt_virt_tval_write, | ||
107 | }, | ||
108 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = { | ||
109 | /* Comparison value, indicating when the timer goes off */ | ||
110 | { .name = "CNTP_CVAL", .cp = 15, .crm = 14, .opc1 = 2, | ||
111 | .secure = ARM_CP_SECSTATE_NS, | ||
112 | - .access = PL1_RW | PL0_R, | ||
113 | + .access = PL0_RW, | ||
114 | .type = ARM_CP_64BIT | ARM_CP_IO | ARM_CP_ALIAS, | ||
115 | .fieldoffset = offsetof(CPUARMState, cp15.c14_timer[GTIMER_PHYS].cval), | ||
116 | .accessfn = gt_ptimer_access, | ||
117 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = { | ||
118 | }, | ||
119 | { .name = "CNTP_CVAL_S", .cp = 15, .crm = 14, .opc1 = 2, | ||
120 | .secure = ARM_CP_SECSTATE_S, | ||
121 | - .access = PL1_RW | PL0_R, | ||
122 | + .access = PL0_RW, | ||
123 | .type = ARM_CP_64BIT | ARM_CP_IO | ARM_CP_ALIAS, | ||
124 | .fieldoffset = offsetof(CPUARMState, cp15.c14_timer[GTIMER_SEC].cval), | ||
125 | .accessfn = gt_ptimer_access, | ||
126 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = { | ||
127 | }, | ||
128 | { .name = "CNTP_CVAL_EL0", .state = ARM_CP_STATE_AA64, | ||
129 | .opc0 = 3, .opc1 = 3, .crn = 14, .crm = 2, .opc2 = 2, | ||
130 | - .access = PL1_RW | PL0_R, | ||
131 | + .access = PL0_RW, | ||
132 | .type = ARM_CP_IO, | ||
133 | .fieldoffset = offsetof(CPUARMState, cp15.c14_timer[GTIMER_PHYS].cval), | ||
134 | .resetvalue = 0, .accessfn = gt_ptimer_access, | ||
135 | .writefn = gt_phys_cval_write, .raw_writefn = raw_write, | ||
136 | }, | ||
137 | { .name = "CNTV_CVAL", .cp = 15, .crm = 14, .opc1 = 3, | ||
138 | - .access = PL1_RW | PL0_R, | ||
139 | + .access = PL0_RW, | ||
140 | .type = ARM_CP_64BIT | ARM_CP_IO | ARM_CP_ALIAS, | ||
141 | .fieldoffset = offsetof(CPUARMState, cp15.c14_timer[GTIMER_VIRT].cval), | ||
142 | .accessfn = gt_vtimer_access, | ||
143 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = { | ||
144 | }, | ||
145 | { .name = "CNTV_CVAL_EL0", .state = ARM_CP_STATE_AA64, | ||
146 | .opc0 = 3, .opc1 = 3, .crn = 14, .crm = 3, .opc2 = 2, | ||
147 | - .access = PL1_RW | PL0_R, | ||
148 | + .access = PL0_RW, | ||
149 | .type = ARM_CP_IO, | ||
150 | .fieldoffset = offsetof(CPUARMState, cp15.c14_timer[GTIMER_VIRT].cval), | ||
151 | .resetvalue = 0, .accessfn = gt_vtimer_access, | ||
152 | -- | 46 | -- |
153 | 2.20.1 | 47 | 2.34.1 |
154 | 48 | ||
155 | 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 | From: Zoltán Baldaszti <bztemail@gmail.com> | 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 BCM2836 control logic module includes a simple | 9 | Create a new function S2_security_space() which returns the |
4 | "local timer" which is a programmable down-counter that | 10 | correct security space to use for the ptw load, and use it to |
5 | can generates an interrupt. Implement this functionality. | 11 | determine the correct .in_secure and .in_space fields for the |
12 | stage 2 lookup for the ptw load. | ||
6 | 13 | ||
7 | Signed-off-by: Zoltán Baldaszti <bztemail@gmail.com> | 14 | Reported-by: Jean-Philippe Brucker <jean-philippe@linaro.org> |
8 | [PMM: wrote commit message; wrapped long line; tweaked | 15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | some comments to match the final version of the code] | 16 | Tested-by: Jean-Philippe Brucker <jean-philippe@linaro.org> |
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 17 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
18 | Message-id: 20230710152130.3928330-3-peter.maydell@linaro.org | ||
19 | Fixes: fe4a5472ccd6 ("target/arm: Use get_phys_addr_with_struct in S1_ptw_translate") | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 20 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 21 | --- |
13 | include/hw/intc/bcm2836_control.h | 9 +++ | 22 | target/arm/ptw.c | 37 ++++++++++++++++++++++++++++++++----- |
14 | hw/intc/bcm2836_control.c | 101 +++++++++++++++++++++++++++++- | 23 | 1 file changed, 32 insertions(+), 5 deletions(-) |
15 | 2 files changed, 108 insertions(+), 2 deletions(-) | ||
16 | 24 | ||
17 | diff --git a/include/hw/intc/bcm2836_control.h b/include/hw/intc/bcm2836_control.h | 25 | diff --git a/target/arm/ptw.c b/target/arm/ptw.c |
18 | index XXXXXXX..XXXXXXX 100644 | 26 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/include/hw/intc/bcm2836_control.h | 27 | --- a/target/arm/ptw.c |
20 | +++ b/include/hw/intc/bcm2836_control.h | 28 | +++ b/target/arm/ptw.c |
21 | @@ -XXX,XX +XXX,XX @@ | 29 | @@ -XXX,XX +XXX,XX @@ static bool S2_attrs_are_device(uint64_t hcr, uint8_t attrs) |
22 | * Rasperry Pi 2 emulation and refactoring Copyright (c) 2015, Microsoft | ||
23 | * Written by Andrew Baumann | ||
24 | * | ||
25 | + * ARM Local Timer IRQ Copyright (c) 2019. Zoltán Baldaszti | ||
26 | + * Added basic IRQ_TIMER interrupt support | ||
27 | + * | ||
28 | * This code is licensed under the GNU GPLv2 and later. | ||
29 | */ | ||
30 | |||
31 | @@ -XXX,XX +XXX,XX @@ | ||
32 | #define BCM2836_CONTROL_H | ||
33 | |||
34 | #include "hw/sysbus.h" | ||
35 | +#include "qemu/timer.h" | ||
36 | |||
37 | /* 4 mailboxes per core, for 16 total */ | ||
38 | #define BCM2836_NCORES 4 | ||
39 | @@ -XXX,XX +XXX,XX @@ typedef struct BCM2836ControlState { | ||
40 | bool gpu_irq, gpu_fiq; | ||
41 | uint8_t timerirqs[BCM2836_NCORES]; | ||
42 | |||
43 | + /* local timer */ | ||
44 | + QEMUTimer timer; | ||
45 | + uint32_t local_timer_control; | ||
46 | + uint8_t route_localtimer; | ||
47 | + | ||
48 | /* interrupt source registers, post-routing (also input-derived; visible) */ | ||
49 | uint32_t irqsrc[BCM2836_NCORES]; | ||
50 | uint32_t fiqsrc[BCM2836_NCORES]; | ||
51 | diff --git a/hw/intc/bcm2836_control.c b/hw/intc/bcm2836_control.c | ||
52 | index XXXXXXX..XXXXXXX 100644 | ||
53 | --- a/hw/intc/bcm2836_control.c | ||
54 | +++ b/hw/intc/bcm2836_control.c | ||
55 | @@ -XXX,XX +XXX,XX @@ | ||
56 | * This code is licensed under the GNU GPLv2 and later. | ||
57 | * | ||
58 | * At present, only implements interrupt routing, and mailboxes (i.e., | ||
59 | - * not local timer, PMU interrupt, or AXI counters). | ||
60 | + * not PMU interrupt, or AXI counters). | ||
61 | + * | ||
62 | + * ARM Local Timer IRQ Copyright (c) 2019. Zoltán Baldaszti | ||
63 | * | ||
64 | * Ref: | ||
65 | * https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2836/QA7_rev3.4.pdf | ||
66 | @@ -XXX,XX +XXX,XX @@ | ||
67 | #include "qemu/log.h" | ||
68 | |||
69 | #define REG_GPU_ROUTE 0x0c | ||
70 | +#define REG_LOCALTIMERROUTING 0x24 | ||
71 | +#define REG_LOCALTIMERCONTROL 0x34 | ||
72 | +#define REG_LOCALTIMERACK 0x38 | ||
73 | #define REG_TIMERCONTROL 0x40 | ||
74 | #define REG_MBOXCONTROL 0x50 | ||
75 | #define REG_IRQSRC 0x60 | ||
76 | @@ -XXX,XX +XXX,XX @@ | ||
77 | #define IRQ_TIMER 11 | ||
78 | #define IRQ_MAX IRQ_TIMER | ||
79 | |||
80 | +#define LOCALTIMER_FREQ 38400000 | ||
81 | +#define LOCALTIMER_INTFLAG (1 << 31) | ||
82 | +#define LOCALTIMER_RELOAD (1 << 30) | ||
83 | +#define LOCALTIMER_INTENABLE (1 << 29) | ||
84 | +#define LOCALTIMER_ENABLE (1 << 28) | ||
85 | +#define LOCALTIMER_VALUE(x) ((x) & 0xfffffff) | ||
86 | + | ||
87 | static void deliver_local(BCM2836ControlState *s, uint8_t core, uint8_t irq, | ||
88 | uint32_t controlreg, uint8_t controlidx) | ||
89 | { | ||
90 | @@ -XXX,XX +XXX,XX @@ static void bcm2836_control_update(BCM2836ControlState *s) | ||
91 | s->fiqsrc[s->route_gpu_fiq] |= (uint32_t)1 << IRQ_GPU; | ||
92 | } | 30 | } |
93 | 31 | } | |
32 | |||
33 | +static ARMSecuritySpace S2_security_space(ARMSecuritySpace s1_space, | ||
34 | + ARMMMUIdx s2_mmu_idx) | ||
35 | +{ | ||
94 | + /* | 36 | + /* |
95 | + * handle the control module 'local timer' interrupt for one of the | 37 | + * Return the security space to use for stage 2 when doing |
96 | + * cores' IRQ/FIQ; this is distinct from the per-CPU timer | 38 | + * the S1 page table descriptor load. |
97 | + * interrupts handled below. | ||
98 | + */ | 39 | + */ |
99 | + if ((s->local_timer_control & LOCALTIMER_INTENABLE) && | 40 | + if (regime_is_stage2(s2_mmu_idx)) { |
100 | + (s->local_timer_control & LOCALTIMER_INTFLAG)) { | 41 | + /* |
101 | + if (s->route_localtimer & 4) { | 42 | + * The security space for ptw reads is almost always the same |
102 | + s->fiqsrc[(s->route_localtimer & 3)] |= (uint32_t)1 << IRQ_TIMER; | 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); | ||
103 | + } else { | 51 | + } else { |
104 | + s->irqsrc[(s->route_localtimer & 3)] |= (uint32_t)1 << IRQ_TIMER; | 52 | + assert(s2_mmu_idx != ARMMMUIdx_Stage2_S); |
53 | + assert(s1_space != ARMSS_Root); | ||
54 | + return s1_space; | ||
105 | + } | 55 | + } |
106 | + } | ||
107 | + | ||
108 | for (i = 0; i < BCM2836_NCORES; i++) { | ||
109 | /* handle local timer interrupts for this core */ | ||
110 | if (s->timerirqs[i]) { | ||
111 | @@ -XXX,XX +XXX,XX @@ static void bcm2836_control_set_gpu_fiq(void *opaque, int irq, int level) | ||
112 | bcm2836_control_update(s); | ||
113 | } | ||
114 | |||
115 | +static void bcm2836_control_local_timer_set_next(void *opaque) | ||
116 | +{ | ||
117 | + BCM2836ControlState *s = opaque; | ||
118 | + uint64_t next_event; | ||
119 | + | ||
120 | + assert(LOCALTIMER_VALUE(s->local_timer_control) > 0); | ||
121 | + | ||
122 | + next_event = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + | ||
123 | + muldiv64(LOCALTIMER_VALUE(s->local_timer_control), | ||
124 | + NANOSECONDS_PER_SECOND, LOCALTIMER_FREQ); | ||
125 | + timer_mod(&s->timer, next_event); | ||
126 | +} | ||
127 | + | ||
128 | +static void bcm2836_control_local_timer_tick(void *opaque) | ||
129 | +{ | ||
130 | + BCM2836ControlState *s = opaque; | ||
131 | + | ||
132 | + bcm2836_control_local_timer_set_next(s); | ||
133 | + | ||
134 | + s->local_timer_control |= LOCALTIMER_INTFLAG; | ||
135 | + bcm2836_control_update(s); | ||
136 | +} | ||
137 | + | ||
138 | +static void bcm2836_control_local_timer_control(void *opaque, uint32_t val) | ||
139 | +{ | ||
140 | + BCM2836ControlState *s = opaque; | ||
141 | + | ||
142 | + s->local_timer_control = val; | ||
143 | + if (val & LOCALTIMER_ENABLE) { | ||
144 | + bcm2836_control_local_timer_set_next(s); | ||
145 | + } else { | 56 | + } else { |
146 | + timer_del(&s->timer); | 57 | + /* ptw loads are from phys: the mmu idx itself says which space */ |
58 | + return arm_phys_to_space(s2_mmu_idx); | ||
147 | + } | 59 | + } |
148 | +} | 60 | +} |
149 | + | 61 | + |
150 | +static void bcm2836_control_local_timer_ack(void *opaque, uint32_t val) | 62 | /* Translate a S1 pagetable walk through S2 if needed. */ |
151 | +{ | 63 | static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw, |
152 | + BCM2836ControlState *s = opaque; | 64 | hwaddr addr, ARMMMUFaultInfo *fi) |
153 | + | ||
154 | + if (val & LOCALTIMER_INTFLAG) { | ||
155 | + s->local_timer_control &= ~LOCALTIMER_INTFLAG; | ||
156 | + } | ||
157 | + if ((val & LOCALTIMER_RELOAD) && | ||
158 | + (s->local_timer_control & LOCALTIMER_ENABLE)) { | ||
159 | + bcm2836_control_local_timer_set_next(s); | ||
160 | + } | ||
161 | +} | ||
162 | + | ||
163 | static uint64_t bcm2836_control_read(void *opaque, hwaddr offset, unsigned size) | ||
164 | { | 65 | { |
165 | BCM2836ControlState *s = opaque; | 66 | - ARMSecuritySpace space = ptw->in_space; |
166 | @@ -XXX,XX +XXX,XX @@ static uint64_t bcm2836_control_read(void *opaque, hwaddr offset, unsigned size) | 67 | bool is_secure = ptw->in_secure; |
167 | assert(s->route_gpu_fiq < BCM2836_NCORES | 68 | ARMMMUIdx mmu_idx = ptw->in_mmu_idx; |
168 | && s->route_gpu_irq < BCM2836_NCORES); | 69 | ARMMMUIdx s2_mmu_idx = ptw->in_ptw_idx; |
169 | return ((uint32_t)s->route_gpu_fiq << 2) | s->route_gpu_irq; | 70 | @@ -XXX,XX +XXX,XX @@ static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw, |
170 | + } else if (offset == REG_LOCALTIMERROUTING) { | 71 | * From gdbstub, do not use softmmu so that we don't modify the |
171 | + return s->route_localtimer; | 72 | * state of the cpu at all, including softmmu tlb contents. |
172 | + } else if (offset == REG_LOCALTIMERCONTROL) { | 73 | */ |
173 | + return s->local_timer_control; | 74 | + ARMSecuritySpace s2_space = S2_security_space(ptw->in_space, s2_mmu_idx); |
174 | + } else if (offset == REG_LOCALTIMERACK) { | 75 | S1Translate s2ptw = { |
175 | + return 0; | 76 | .in_mmu_idx = s2_mmu_idx, |
176 | } else if (offset >= REG_TIMERCONTROL && offset < REG_MBOXCONTROL) { | 77 | .in_ptw_idx = ptw_idx_for_stage_2(env, s2_mmu_idx), |
177 | return s->timercontrol[(offset - REG_TIMERCONTROL) >> 2]; | 78 | - .in_secure = s2_mmu_idx == ARMMMUIdx_Stage2_S, |
178 | } else if (offset >= REG_MBOXCONTROL && offset < REG_IRQSRC) { | 79 | - .in_space = (s2_mmu_idx == ARMMMUIdx_Stage2_S ? ARMSS_Secure |
179 | @@ -XXX,XX +XXX,XX @@ static void bcm2836_control_write(void *opaque, hwaddr offset, | 80 | - : space == ARMSS_Realm ? ARMSS_Realm |
180 | if (offset == REG_GPU_ROUTE) { | 81 | - : ARMSS_NonSecure), |
181 | s->route_gpu_irq = val & 0x3; | 82 | + .in_secure = arm_space_is_secure(s2_space), |
182 | s->route_gpu_fiq = (val >> 2) & 0x3; | 83 | + .in_space = s2_space, |
183 | + } else if (offset == REG_LOCALTIMERROUTING) { | 84 | .in_debug = true, |
184 | + s->route_localtimer = val & 7; | 85 | }; |
185 | + } else if (offset == REG_LOCALTIMERCONTROL) { | 86 | GetPhysAddrResult s2 = { }; |
186 | + bcm2836_control_local_timer_control(s, val); | ||
187 | + } else if (offset == REG_LOCALTIMERACK) { | ||
188 | + bcm2836_control_local_timer_ack(s, val); | ||
189 | } else if (offset >= REG_TIMERCONTROL && offset < REG_MBOXCONTROL) { | ||
190 | s->timercontrol[(offset - REG_TIMERCONTROL) >> 2] = val & 0xff; | ||
191 | } else if (offset >= REG_MBOXCONTROL && offset < REG_IRQSRC) { | ||
192 | @@ -XXX,XX +XXX,XX @@ static void bcm2836_control_reset(DeviceState *d) | ||
193 | |||
194 | s->route_gpu_irq = s->route_gpu_fiq = 0; | ||
195 | |||
196 | + timer_del(&s->timer); | ||
197 | + s->route_localtimer = 0; | ||
198 | + s->local_timer_control = 0; | ||
199 | + | ||
200 | for (i = 0; i < BCM2836_NCORES; i++) { | ||
201 | s->timercontrol[i] = 0; | ||
202 | s->mailboxcontrol[i] = 0; | ||
203 | @@ -XXX,XX +XXX,XX @@ static void bcm2836_control_init(Object *obj) | ||
204 | /* outputs to CPU cores */ | ||
205 | qdev_init_gpio_out_named(dev, s->irq, "irq", BCM2836_NCORES); | ||
206 | qdev_init_gpio_out_named(dev, s->fiq, "fiq", BCM2836_NCORES); | ||
207 | + | ||
208 | + /* create a qemu virtual timer */ | ||
209 | + timer_init_ns(&s->timer, QEMU_CLOCK_VIRTUAL, | ||
210 | + bcm2836_control_local_timer_tick, s); | ||
211 | } | ||
212 | |||
213 | static const VMStateDescription vmstate_bcm2836_control = { | ||
214 | .name = TYPE_BCM2836_CONTROL, | ||
215 | - .version_id = 1, | ||
216 | + .version_id = 2, | ||
217 | .minimum_version_id = 1, | ||
218 | .fields = (VMStateField[]) { | ||
219 | VMSTATE_UINT32_ARRAY(mailboxes, BCM2836ControlState, | ||
220 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_bcm2836_control = { | ||
221 | VMSTATE_UINT32_ARRAY(timercontrol, BCM2836ControlState, BCM2836_NCORES), | ||
222 | VMSTATE_UINT32_ARRAY(mailboxcontrol, BCM2836ControlState, | ||
223 | BCM2836_NCORES), | ||
224 | + VMSTATE_TIMER_V(timer, BCM2836ControlState, 2), | ||
225 | + VMSTATE_UINT32_V(local_timer_control, BCM2836ControlState, 2), | ||
226 | + VMSTATE_UINT8_V(route_localtimer, BCM2836ControlState, 2), | ||
227 | VMSTATE_END_OF_LIST() | ||
228 | } | ||
229 | }; | ||
230 | -- | 87 | -- |
231 | 2.20.1 | 88 | 2.34.1 |
232 | |||
233 | 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 | From: Eric Auger <eric.auger@redhat.com> | 1 | In commit f0a08b0913befbd we changed the type of the PC from |
---|---|---|---|
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: | ||
2 | 6 | ||
3 | The GSIV numbers of the SPI based interrupts is not correct as | 7 | Trace 0: 0x7f2260000100 [00000000/0000000040000000/00000061/ff200000] |
4 | ARM_SPI_BASE was not added to the irqmap[VIRT_SMMU] value. So | ||
5 | this may collide with VIRTIO_MMIO irq window. | ||
6 | 8 | ||
7 | Signed-off-by: Eric Auger <eric.auger@redhat.com> | 9 | and now they look like this: |
8 | Message-id: 20190312091031.5185-1-eric.auger@redhat.com | 10 | Trace 0: 0x7f4f50000100 [00000000/40000000/00000061/ff200000] |
9 | Reviewed-by: Shannon Zhao <shannon.zhaosl@gmail.com> | 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") | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 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 | ||
11 | --- | 32 | --- |
12 | hw/arm/virt-acpi-build.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/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.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/hw/arm/virt-acpi-build.c | 39 | --- a/accel/tcg/cpu-exec.c |
18 | +++ b/hw/arm/virt-acpi-build.c | 40 | +++ b/accel/tcg/cpu-exec.c |
19 | @@ -XXX,XX +XXX,XX @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) | 41 | @@ -XXX,XX +XXX,XX @@ static void log_cpu_exec(vaddr pc, CPUState *cpu, |
20 | its->identifiers[0] = 0; /* MADT translation_id */ | 42 | if (qemu_log_in_addr_range(pc)) { |
21 | 43 | qemu_log_mask(CPU_LOG_EXEC, | |
22 | if (vms->iommu == VIRT_IOMMU_SMMUV3) { | 44 | "Trace %d: %p [%08" PRIx64 |
23 | - int irq = vms->irqmap[VIRT_SMMU]; | 45 | - "/%" VADDR_PRIx "/%08x/%08x] %s\n", |
24 | + int irq = vms->irqmap[VIRT_SMMU] + ARM_SPI_BASE; | 46 | + "/%016" VADDR_PRIx "/%08x/%08x] %s\n", |
25 | 47 | cpu->cpu_index, tb->tc.ptr, tb->cs_base, pc, | |
26 | /* SMMUv3 node */ | 48 | tb->flags, tb->cflags, lookup_symbol(pc)); |
27 | smmu_offset = iort_node_offset + node_size; | 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); | ||
70 | } | ||
71 | } | ||
28 | -- | 72 | -- |
29 | 2.20.1 | 73 | 2.34.1 |
30 | 74 | ||
31 | 75 | diff view generated by jsdifflib |
1 | From: Amir Charif <amir.charif@cea.fr> | 1 | From: Tong Ho <tong.ho@amd.com> |
---|---|---|---|
2 | 2 | ||
3 | These instructions do not trap when SVE is disabled in EL0, | 3 | Add a check in the bit-set operation to write the backstore |
4 | causing them to be executed with wrong size information. | 4 | only if the affected bit is 0 before. |
5 | 5 | ||
6 | Signed-off-by: Amir Charif <amir.charif@cea.fr> | 6 | With this in place, there will be no need for callers to |
7 | Message-id: 1552579248-31025-1-git-send-email-amir.charif@cea.fr | 7 | do the checking in order to avoid unnecessary writes. |
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 8 | |
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Tong Ho <tong.ho@amd.com> |
10 | [PMM: added 'target/arm' prefix to subject] | 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> | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 14 | --- |
13 | target/arm/translate-sve.c | 22 ++++++++++++++-------- | 15 | hw/nvram/xlnx-efuse.c | 11 +++++++++-- |
14 | 1 file changed, 14 insertions(+), 8 deletions(-) | 16 | 1 file changed, 9 insertions(+), 2 deletions(-) |
15 | 17 | ||
16 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | 18 | diff --git a/hw/nvram/xlnx-efuse.c b/hw/nvram/xlnx-efuse.c |
17 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/translate-sve.c | 20 | --- a/hw/nvram/xlnx-efuse.c |
19 | +++ b/target/arm/translate-sve.c | 21 | +++ b/hw/nvram/xlnx-efuse.c |
20 | @@ -XXX,XX +XXX,XX @@ static bool trans_INDEX_rr(DisasContext *s, arg_INDEX_rr *a) | 22 | @@ -XXX,XX +XXX,XX @@ static bool efuse_ro_bits_find(XlnxEFuse *s, uint32_t k) |
21 | 23 | ||
22 | static bool trans_ADDVL(DisasContext *s, arg_ADDVL *a) | 24 | bool xlnx_efuse_set_bit(XlnxEFuse *s, unsigned int bit) |
23 | { | 25 | { |
24 | - TCGv_i64 rd = cpu_reg_sp(s, a->rd); | 26 | + uint32_t set, *row; |
25 | - TCGv_i64 rn = cpu_reg_sp(s, a->rn); | 27 | + |
26 | - tcg_gen_addi_i64(rd, rn, a->imm * vec_full_reg_size(s)); | 28 | if (efuse_ro_bits_find(s, bit)) { |
27 | + if (sve_access_check(s)) { | 29 | g_autofree char *path = object_get_canonical_path(OBJECT(s)); |
28 | + TCGv_i64 rd = cpu_reg_sp(s, a->rd); | 30 | |
29 | + TCGv_i64 rn = cpu_reg_sp(s, a->rn); | 31 | @@ -XXX,XX +XXX,XX @@ bool xlnx_efuse_set_bit(XlnxEFuse *s, unsigned int bit) |
30 | + tcg_gen_addi_i64(rd, rn, a->imm * vec_full_reg_size(s)); | 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); | ||
31 | + } | 43 | + } |
32 | return true; | 44 | return true; |
33 | } | 45 | } |
34 | 46 | ||
35 | static bool trans_ADDPL(DisasContext *s, arg_ADDPL *a) | ||
36 | { | ||
37 | - TCGv_i64 rd = cpu_reg_sp(s, a->rd); | ||
38 | - TCGv_i64 rn = cpu_reg_sp(s, a->rn); | ||
39 | - tcg_gen_addi_i64(rd, rn, a->imm * pred_full_reg_size(s)); | ||
40 | + if (sve_access_check(s)) { | ||
41 | + TCGv_i64 rd = cpu_reg_sp(s, a->rd); | ||
42 | + TCGv_i64 rn = cpu_reg_sp(s, a->rn); | ||
43 | + tcg_gen_addi_i64(rd, rn, a->imm * pred_full_reg_size(s)); | ||
44 | + } | ||
45 | return true; | ||
46 | } | ||
47 | |||
48 | static bool trans_RDVL(DisasContext *s, arg_RDVL *a) | ||
49 | { | ||
50 | - TCGv_i64 reg = cpu_reg(s, a->rd); | ||
51 | - tcg_gen_movi_i64(reg, a->imm * vec_full_reg_size(s)); | ||
52 | + if (sve_access_check(s)) { | ||
53 | + TCGv_i64 reg = cpu_reg(s, a->rd); | ||
54 | + tcg_gen_movi_i64(reg, a->imm * vec_full_reg_size(s)); | ||
55 | + } | ||
56 | return true; | ||
57 | } | ||
58 | |||
59 | -- | 47 | -- |
60 | 2.20.1 | 48 | 2.34.1 |
61 | 49 | ||
62 | 50 | diff view generated by jsdifflib |