1 | A small set of arm bugfixes for rc0. | 1 | v2: drop pvpanic-pci patches. |
---|---|---|---|
2 | 2 | ||
3 | The following changes since commit f1fcb6851aba6dd9838886dc179717a11e344a1c: | ||
3 | 4 | ||
5 | Merge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2021-01-19' into staging (2021-01-19 11:57:07 +0000) | ||
4 | 6 | ||
5 | The following changes since commit 5853e92207193e967abf5e4c25b4a551c7604725: | 7 | are available in the Git repository at: |
6 | 8 | ||
7 | Merge remote-tracking branch 'remotes/pmaydell/tags/pull-cocoa-20171107' into staging (2017-11-07 12:19:48 +0000) | 9 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20210119-1 |
8 | 10 | ||
9 | are available in the git repository at: | 11 | for you to fetch changes up to b93f4fbdc48283a39089469c44a5529d79dc40a8: |
10 | 12 | ||
11 | git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20171107 | 13 | docs: Build and install all the docs in a single manual (2021-01-19 15:45:14 +0000) |
12 | |||
13 | for you to fetch changes up to 8a7348b5d62d7ea16807e6bea54b448a0184bb0f: | ||
14 | |||
15 | hw/intc/arm_gicv3_its: Don't abort on table save failure (2017-11-07 13:03:52 +0000) | ||
16 | 14 | ||
17 | ---------------------------------------------------------------- | 15 | ---------------------------------------------------------------- |
18 | target-arm queue: | 16 | target-arm queue: |
19 | * arm_gicv3_its: Don't abort on table save failure | 17 | * Implement IMPDEF pauth algorithm |
20 | * arm_gicv3_its: Fix the VM termination in vm_change_state_handler() | 18 | * Support ARMv8.4-SEL2 |
21 | * translate.c: Fix usermode big-endian AArch32 LDREXD and STREXD | 19 | * Fix bug where we were truncating predicate vector lengths in SVE insns |
22 | * hw/arm: Mark the "fsl,imx31/25/6" devices with user_creatable = false | 20 | * npcm7xx_adc-test: Fix memleak in adc_qom_set |
23 | * arm: implement cache/shareability attribute bits for PAR registers | 21 | * target/arm/m_helper: Silence GCC 10 maybe-uninitialized error |
22 | * docs: Build and install all the docs in a single manual | ||
24 | 23 | ||
25 | ---------------------------------------------------------------- | 24 | ---------------------------------------------------------------- |
26 | Andrew Baumann (1): | 25 | Gan Qixin (1): |
27 | arm: implement cache/shareability attribute bits for PAR registers | 26 | npcm7xx_adc-test: Fix memleak in adc_qom_set |
28 | |||
29 | Eric Auger (1): | ||
30 | hw/intc/arm_gicv3_its: Don't abort on table save failure | ||
31 | 27 | ||
32 | Peter Maydell (1): | 28 | Peter Maydell (1): |
33 | translate.c: Fix usermode big-endian AArch32 LDREXD and STREXD | 29 | docs: Build and install all the docs in a single manual |
34 | 30 | ||
35 | Shanker Donthineni (1): | 31 | Philippe Mathieu-Daudé (1): |
36 | hw/intc/arm_gicv3_its: Fix the VM termination in vm_change_state_handler() | 32 | target/arm/m_helper: Silence GCC 10 maybe-uninitialized error |
37 | 33 | ||
38 | Thomas Huth (3): | 34 | Richard Henderson (7): |
39 | hw/arm: Mark the "fsl,imx6" device with user_creatable = false | 35 | target/arm: Implement an IMPDEF pauth algorithm |
40 | hw/arm: Mark the "fsl,imx25" device with user_creatable = false | 36 | target/arm: Add cpu properties to control pauth |
41 | hw/arm: Mark the "fsl,imx31" device with user_creatable = false | 37 | target/arm: Use object_property_add_bool for "sve" property |
38 | target/arm: Introduce PREDDESC field definitions | ||
39 | target/arm: Update PFIRST, PNEXT for pred_desc | ||
40 | target/arm: Update ZIP, UZP, TRN for pred_desc | ||
41 | target/arm: Update REV, PUNPK for pred_desc | ||
42 | 42 | ||
43 | hw/arm/fsl-imx25.c | 6 +- | 43 | Rémi Denis-Courmont (19): |
44 | hw/arm/fsl-imx31.c | 6 +- | 44 | target/arm: remove redundant tests |
45 | hw/arm/fsl-imx6.c | 3 +- | 45 | target/arm: add arm_is_el2_enabled() helper |
46 | hw/intc/arm_gicv3_its_kvm.c | 12 +-- | 46 | target/arm: use arm_is_el2_enabled() where applicable |
47 | target/arm/helper.c | 178 ++++++++++++++++++++++++++++++++++++++++---- | 47 | target/arm: use arm_hcr_el2_eff() where applicable |
48 | target/arm/translate.c | 39 ++++++++-- | 48 | target/arm: factor MDCR_EL2 common handling |
49 | 6 files changed, 214 insertions(+), 30 deletions(-) | 49 | target/arm: Define isar_feature function to test for presence of SEL2 |
50 | target/arm: add 64-bit S-EL2 to EL exception table | ||
51 | target/arm: add MMU stage 1 for Secure EL2 | ||
52 | target/arm: add ARMv8.4-SEL2 system registers | ||
53 | target/arm: handle VMID change in secure state | ||
54 | target/arm: do S1_ptw_translate() before address space lookup | ||
55 | target/arm: translate NS bit in page-walks | ||
56 | target/arm: generalize 2-stage page-walk condition | ||
57 | target/arm: secure stage 2 translation regime | ||
58 | target/arm: set HPFAR_EL2.NS on secure stage 2 faults | ||
59 | target/arm: revector to run-time pick target EL | ||
60 | target/arm: Implement SCR_EL2.EEL2 | ||
61 | target/arm: enable Secure EL2 in max CPU | ||
62 | target/arm: refactor vae1_tlbmask() | ||
50 | 63 | ||
64 | docs/conf.py | 46 ++++- | ||
65 | docs/devel/conf.py | 15 -- | ||
66 | docs/index.html.in | 17 -- | ||
67 | docs/interop/conf.py | 28 --- | ||
68 | docs/meson.build | 64 +++--- | ||
69 | docs/specs/conf.py | 16 -- | ||
70 | docs/system/arm/cpu-features.rst | 21 ++ | ||
71 | docs/system/conf.py | 28 --- | ||
72 | docs/tools/conf.py | 37 ---- | ||
73 | docs/user/conf.py | 15 -- | ||
74 | include/qemu/xxhash.h | 98 +++++++++ | ||
75 | target/arm/cpu-param.h | 2 +- | ||
76 | target/arm/cpu.h | 107 ++++++++-- | ||
77 | target/arm/internals.h | 45 +++++ | ||
78 | target/arm/cpu.c | 23 ++- | ||
79 | target/arm/cpu64.c | 65 ++++-- | ||
80 | target/arm/helper-a64.c | 8 +- | ||
81 | target/arm/helper.c | 414 ++++++++++++++++++++++++++------------- | ||
82 | target/arm/m_helper.c | 2 +- | ||
83 | target/arm/monitor.c | 1 + | ||
84 | target/arm/op_helper.c | 4 +- | ||
85 | target/arm/pauth_helper.c | 27 ++- | ||
86 | target/arm/sve_helper.c | 33 ++-- | ||
87 | target/arm/tlb_helper.c | 3 + | ||
88 | target/arm/translate-a64.c | 4 + | ||
89 | target/arm/translate-sve.c | 31 ++- | ||
90 | target/arm/translate.c | 36 +++- | ||
91 | tests/qtest/arm-cpu-features.c | 13 ++ | ||
92 | tests/qtest/npcm7xx_adc-test.c | 1 + | ||
93 | .gitlab-ci.yml | 4 +- | ||
94 | 30 files changed, 770 insertions(+), 438 deletions(-) | ||
95 | delete mode 100644 docs/devel/conf.py | ||
96 | delete mode 100644 docs/index.html.in | ||
97 | delete mode 100644 docs/interop/conf.py | ||
98 | delete mode 100644 docs/specs/conf.py | ||
99 | delete mode 100644 docs/system/conf.py | ||
100 | delete mode 100644 docs/tools/conf.py | ||
101 | delete mode 100644 docs/user/conf.py | ||
102 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Andrew Baumann <Andrew.Baumann@microsoft.com> | ||
2 | 1 | ||
3 | On a successful address translation instruction, PAR is supposed to | ||
4 | contain cacheability and shareability attributes determined by the | ||
5 | translation. We previously returned 0 for these bits (in line with the | ||
6 | general strategy of ignoring caches and memory attributes), but some | ||
7 | guest OSes may depend on them. | ||
8 | |||
9 | This patch collects the attribute bits in the page-table walk, and | ||
10 | updates PAR with the correct attributes for all LPAE translations. | ||
11 | Short descriptor formats still return 0 for these bits, as in the | ||
12 | prior implementation. | ||
13 | |||
14 | Signed-off-by: Andrew Baumann <Andrew.Baumann@microsoft.com> | ||
15 | Message-id: 20171031223830.4608-1-Andrew.Baumann@microsoft.com | ||
16 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
18 | --- | ||
19 | target/arm/helper.c | 178 +++++++++++++++++++++++++++++++++++++++++++++++----- | ||
20 | 1 file changed, 164 insertions(+), 14 deletions(-) | ||
21 | |||
22 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
23 | index XXXXXXX..XXXXXXX 100644 | ||
24 | --- a/target/arm/helper.c | ||
25 | +++ b/target/arm/helper.c | ||
26 | @@ -XXX,XX +XXX,XX @@ | ||
27 | #define ARM_CPU_FREQ 1000000000 /* FIXME: 1 GHz, should be configurable */ | ||
28 | |||
29 | #ifndef CONFIG_USER_ONLY | ||
30 | +/* Cacheability and shareability attributes for a memory access */ | ||
31 | +typedef struct ARMCacheAttrs { | ||
32 | + unsigned int attrs:8; /* as in the MAIR register encoding */ | ||
33 | + unsigned int shareability:2; /* as in the SH field of the VMSAv8-64 PTEs */ | ||
34 | +} ARMCacheAttrs; | ||
35 | + | ||
36 | static bool get_phys_addr(CPUARMState *env, target_ulong address, | ||
37 | MMUAccessType access_type, ARMMMUIdx mmu_idx, | ||
38 | hwaddr *phys_ptr, MemTxAttrs *attrs, int *prot, | ||
39 | target_ulong *page_size, uint32_t *fsr, | ||
40 | - ARMMMUFaultInfo *fi); | ||
41 | + ARMMMUFaultInfo *fi, ARMCacheAttrs *cacheattrs); | ||
42 | |||
43 | static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, | ||
44 | MMUAccessType access_type, ARMMMUIdx mmu_idx, | ||
45 | hwaddr *phys_ptr, MemTxAttrs *txattrs, int *prot, | ||
46 | target_ulong *page_size_ptr, uint32_t *fsr, | ||
47 | - ARMMMUFaultInfo *fi); | ||
48 | + ARMMMUFaultInfo *fi, ARMCacheAttrs *cacheattrs); | ||
49 | |||
50 | /* Security attributes for an address, as returned by v8m_security_lookup. */ | ||
51 | typedef struct V8M_SAttributes { | ||
52 | @@ -XXX,XX +XXX,XX @@ static uint64_t do_ats_write(CPUARMState *env, uint64_t value, | ||
53 | uint64_t par64; | ||
54 | MemTxAttrs attrs = {}; | ||
55 | ARMMMUFaultInfo fi = {}; | ||
56 | + ARMCacheAttrs cacheattrs = {}; | ||
57 | |||
58 | - ret = get_phys_addr(env, value, access_type, mmu_idx, | ||
59 | - &phys_addr, &attrs, &prot, &page_size, &fsr, &fi); | ||
60 | + ret = get_phys_addr(env, value, access_type, mmu_idx, &phys_addr, &attrs, | ||
61 | + &prot, &page_size, &fsr, &fi, &cacheattrs); | ||
62 | if (extended_addresses_enabled(env)) { | ||
63 | /* fsr is a DFSR/IFSR value for the long descriptor | ||
64 | * translation table format, but with WnR always clear. | ||
65 | @@ -XXX,XX +XXX,XX @@ static uint64_t do_ats_write(CPUARMState *env, uint64_t value, | ||
66 | if (!attrs.secure) { | ||
67 | par64 |= (1 << 9); /* NS */ | ||
68 | } | ||
69 | - /* We don't set the ATTR or SH fields in the PAR. */ | ||
70 | + par64 |= (uint64_t)cacheattrs.attrs << 56; /* ATTR */ | ||
71 | + par64 |= cacheattrs.shareability << 7; /* SH */ | ||
72 | } else { | ||
73 | par64 |= 1; /* F */ | ||
74 | par64 |= (fsr & 0x3f) << 1; /* FS */ | ||
75 | @@ -XXX,XX +XXX,XX @@ static bool v7m_read_half_insn(ARMCPU *cpu, ARMMMUIdx mmu_idx, | ||
76 | return false; | ||
77 | } | ||
78 | if (get_phys_addr(env, addr, MMU_INST_FETCH, mmu_idx, | ||
79 | - &physaddr, &attrs, &prot, &page_size, &fsr, &fi)) { | ||
80 | + &physaddr, &attrs, &prot, &page_size, &fsr, &fi, NULL)) { | ||
81 | /* the MPU lookup failed */ | ||
82 | env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_IACCVIOL_MASK; | ||
83 | armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_MEM, env->v7m.secure); | ||
84 | @@ -XXX,XX +XXX,XX @@ static hwaddr S1_ptw_translate(CPUARMState *env, ARMMMUIdx mmu_idx, | ||
85 | int ret; | ||
86 | |||
87 | ret = get_phys_addr_lpae(env, addr, 0, ARMMMUIdx_S2NS, &s2pa, | ||
88 | - &txattrs, &s2prot, &s2size, fsr, fi); | ||
89 | + &txattrs, &s2prot, &s2size, fsr, fi, NULL); | ||
90 | if (ret) { | ||
91 | fi->s2addr = addr; | ||
92 | fi->stage2 = true; | ||
93 | @@ -XXX,XX +XXX,XX @@ static bool check_s2_mmu_setup(ARMCPU *cpu, bool is_aa64, int level, | ||
94 | return true; | ||
95 | } | ||
96 | |||
97 | +/* Translate from the 4-bit stage 2 representation of | ||
98 | + * memory attributes (without cache-allocation hints) to | ||
99 | + * the 8-bit representation of the stage 1 MAIR registers | ||
100 | + * (which includes allocation hints). | ||
101 | + * | ||
102 | + * ref: shared/translation/attrs/S2AttrDecode() | ||
103 | + * .../S2ConvertAttrsHints() | ||
104 | + */ | ||
105 | +static uint8_t convert_stage2_attrs(CPUARMState *env, uint8_t s2attrs) | ||
106 | +{ | ||
107 | + uint8_t hiattr = extract32(s2attrs, 2, 2); | ||
108 | + uint8_t loattr = extract32(s2attrs, 0, 2); | ||
109 | + uint8_t hihint = 0, lohint = 0; | ||
110 | + | ||
111 | + if (hiattr != 0) { /* normal memory */ | ||
112 | + if ((env->cp15.hcr_el2 & HCR_CD) != 0) { /* cache disabled */ | ||
113 | + hiattr = loattr = 1; /* non-cacheable */ | ||
114 | + } else { | ||
115 | + if (hiattr != 1) { /* Write-through or write-back */ | ||
116 | + hihint = 3; /* RW allocate */ | ||
117 | + } | ||
118 | + if (loattr != 1) { /* Write-through or write-back */ | ||
119 | + lohint = 3; /* RW allocate */ | ||
120 | + } | ||
121 | + } | ||
122 | + } | ||
123 | + | ||
124 | + return (hiattr << 6) | (hihint << 4) | (loattr << 2) | lohint; | ||
125 | +} | ||
126 | + | ||
127 | static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, | ||
128 | MMUAccessType access_type, ARMMMUIdx mmu_idx, | ||
129 | hwaddr *phys_ptr, MemTxAttrs *txattrs, int *prot, | ||
130 | target_ulong *page_size_ptr, uint32_t *fsr, | ||
131 | - ARMMMUFaultInfo *fi) | ||
132 | + ARMMMUFaultInfo *fi, ARMCacheAttrs *cacheattrs) | ||
133 | { | ||
134 | ARMCPU *cpu = arm_env_get_cpu(env); | ||
135 | CPUState *cs = CPU(cpu); | ||
136 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, | ||
137 | */ | ||
138 | txattrs->secure = false; | ||
139 | } | ||
140 | + | ||
141 | + if (cacheattrs != NULL) { | ||
142 | + if (mmu_idx == ARMMMUIdx_S2NS) { | ||
143 | + cacheattrs->attrs = convert_stage2_attrs(env, | ||
144 | + extract32(attrs, 0, 4)); | ||
145 | + } else { | ||
146 | + /* Index into MAIR registers for cache attributes */ | ||
147 | + uint8_t attrindx = extract32(attrs, 0, 3); | ||
148 | + uint64_t mair = env->cp15.mair_el[regime_el(env, mmu_idx)]; | ||
149 | + assert(attrindx <= 7); | ||
150 | + cacheattrs->attrs = extract64(mair, attrindx * 8, 8); | ||
151 | + } | ||
152 | + cacheattrs->shareability = extract32(attrs, 6, 2); | ||
153 | + } | ||
154 | + | ||
155 | *phys_ptr = descaddr; | ||
156 | *page_size_ptr = page_size; | ||
157 | return false; | ||
158 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav5(CPUARMState *env, uint32_t address, | ||
159 | return false; | ||
160 | } | ||
161 | |||
162 | +/* Combine either inner or outer cacheability attributes for normal | ||
163 | + * memory, according to table D4-42 and pseudocode procedure | ||
164 | + * CombineS1S2AttrHints() of ARM DDI 0487B.b (the ARMv8 ARM). | ||
165 | + * | ||
166 | + * NB: only stage 1 includes allocation hints (RW bits), leading to | ||
167 | + * some asymmetry. | ||
168 | + */ | ||
169 | +static uint8_t combine_cacheattr_nibble(uint8_t s1, uint8_t s2) | ||
170 | +{ | ||
171 | + if (s1 == 4 || s2 == 4) { | ||
172 | + /* non-cacheable has precedence */ | ||
173 | + return 4; | ||
174 | + } else if (extract32(s1, 2, 2) == 0 || extract32(s1, 2, 2) == 2) { | ||
175 | + /* stage 1 write-through takes precedence */ | ||
176 | + return s1; | ||
177 | + } else if (extract32(s2, 2, 2) == 2) { | ||
178 | + /* stage 2 write-through takes precedence, but the allocation hint | ||
179 | + * is still taken from stage 1 | ||
180 | + */ | ||
181 | + return (2 << 2) | extract32(s1, 0, 2); | ||
182 | + } else { /* write-back */ | ||
183 | + return s1; | ||
184 | + } | ||
185 | +} | ||
186 | + | ||
187 | +/* Combine S1 and S2 cacheability/shareability attributes, per D4.5.4 | ||
188 | + * and CombineS1S2Desc() | ||
189 | + * | ||
190 | + * @s1: Attributes from stage 1 walk | ||
191 | + * @s2: Attributes from stage 2 walk | ||
192 | + */ | ||
193 | +static ARMCacheAttrs combine_cacheattrs(ARMCacheAttrs s1, ARMCacheAttrs s2) | ||
194 | +{ | ||
195 | + uint8_t s1lo = extract32(s1.attrs, 0, 4), s2lo = extract32(s2.attrs, 0, 4); | ||
196 | + uint8_t s1hi = extract32(s1.attrs, 4, 4), s2hi = extract32(s2.attrs, 4, 4); | ||
197 | + ARMCacheAttrs ret; | ||
198 | + | ||
199 | + /* Combine shareability attributes (table D4-43) */ | ||
200 | + if (s1.shareability == 2 || s2.shareability == 2) { | ||
201 | + /* if either are outer-shareable, the result is outer-shareable */ | ||
202 | + ret.shareability = 2; | ||
203 | + } else if (s1.shareability == 3 || s2.shareability == 3) { | ||
204 | + /* if either are inner-shareable, the result is inner-shareable */ | ||
205 | + ret.shareability = 3; | ||
206 | + } else { | ||
207 | + /* both non-shareable */ | ||
208 | + ret.shareability = 0; | ||
209 | + } | ||
210 | + | ||
211 | + /* Combine memory type and cacheability attributes */ | ||
212 | + if (s1hi == 0 || s2hi == 0) { | ||
213 | + /* Device has precedence over normal */ | ||
214 | + if (s1lo == 0 || s2lo == 0) { | ||
215 | + /* nGnRnE has precedence over anything */ | ||
216 | + ret.attrs = 0; | ||
217 | + } else if (s1lo == 4 || s2lo == 4) { | ||
218 | + /* non-Reordering has precedence over Reordering */ | ||
219 | + ret.attrs = 4; /* nGnRE */ | ||
220 | + } else if (s1lo == 8 || s2lo == 8) { | ||
221 | + /* non-Gathering has precedence over Gathering */ | ||
222 | + ret.attrs = 8; /* nGRE */ | ||
223 | + } else { | ||
224 | + ret.attrs = 0xc; /* GRE */ | ||
225 | + } | ||
226 | + | ||
227 | + /* Any location for which the resultant memory type is any | ||
228 | + * type of Device memory is always treated as Outer Shareable. | ||
229 | + */ | ||
230 | + ret.shareability = 2; | ||
231 | + } else { /* Normal memory */ | ||
232 | + /* Outer/inner cacheability combine independently */ | ||
233 | + ret.attrs = combine_cacheattr_nibble(s1hi, s2hi) << 4 | ||
234 | + | combine_cacheattr_nibble(s1lo, s2lo); | ||
235 | + | ||
236 | + if (ret.attrs == 0x44) { | ||
237 | + /* Any location for which the resultant memory type is Normal | ||
238 | + * Inner Non-cacheable, Outer Non-cacheable is always treated | ||
239 | + * as Outer Shareable. | ||
240 | + */ | ||
241 | + ret.shareability = 2; | ||
242 | + } | ||
243 | + } | ||
244 | + | ||
245 | + return ret; | ||
246 | +} | ||
247 | + | ||
248 | + | ||
249 | /* get_phys_addr - get the physical address for this virtual address | ||
250 | * | ||
251 | * Find the physical address corresponding to the given virtual address, | ||
252 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav5(CPUARMState *env, uint32_t address, | ||
253 | * @prot: set to the permissions for the page containing phys_ptr | ||
254 | * @page_size: set to the size of the page containing phys_ptr | ||
255 | * @fsr: set to the DFSR/IFSR value on failure | ||
256 | + * @fi: set to fault info if the translation fails | ||
257 | + * @cacheattrs: (if non-NULL) set to the cacheability/shareability attributes | ||
258 | */ | ||
259 | static bool get_phys_addr(CPUARMState *env, target_ulong address, | ||
260 | MMUAccessType access_type, ARMMMUIdx mmu_idx, | ||
261 | hwaddr *phys_ptr, MemTxAttrs *attrs, int *prot, | ||
262 | target_ulong *page_size, uint32_t *fsr, | ||
263 | - ARMMMUFaultInfo *fi) | ||
264 | + ARMMMUFaultInfo *fi, ARMCacheAttrs *cacheattrs) | ||
265 | { | ||
266 | if (mmu_idx == ARMMMUIdx_S12NSE0 || mmu_idx == ARMMMUIdx_S12NSE1) { | ||
267 | /* Call ourselves recursively to do the stage 1 and then stage 2 | ||
268 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr(CPUARMState *env, target_ulong address, | ||
269 | hwaddr ipa; | ||
270 | int s2_prot; | ||
271 | int ret; | ||
272 | + ARMCacheAttrs cacheattrs2 = {}; | ||
273 | |||
274 | ret = get_phys_addr(env, address, access_type, | ||
275 | stage_1_mmu_idx(mmu_idx), &ipa, attrs, | ||
276 | - prot, page_size, fsr, fi); | ||
277 | + prot, page_size, fsr, fi, cacheattrs); | ||
278 | |||
279 | /* If S1 fails or S2 is disabled, return early. */ | ||
280 | if (ret || regime_translation_disabled(env, ARMMMUIdx_S2NS)) { | ||
281 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr(CPUARMState *env, target_ulong address, | ||
282 | /* S1 is done. Now do S2 translation. */ | ||
283 | ret = get_phys_addr_lpae(env, ipa, access_type, ARMMMUIdx_S2NS, | ||
284 | phys_ptr, attrs, &s2_prot, | ||
285 | - page_size, fsr, fi); | ||
286 | + page_size, fsr, fi, | ||
287 | + cacheattrs != NULL ? &cacheattrs2 : NULL); | ||
288 | fi->s2addr = ipa; | ||
289 | /* Combine the S1 and S2 perms. */ | ||
290 | *prot &= s2_prot; | ||
291 | + | ||
292 | + /* Combine the S1 and S2 cache attributes, if needed */ | ||
293 | + if (!ret && cacheattrs != NULL) { | ||
294 | + *cacheattrs = combine_cacheattrs(*cacheattrs, cacheattrs2); | ||
295 | + } | ||
296 | + | ||
297 | return ret; | ||
298 | } else { | ||
299 | /* | ||
300 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr(CPUARMState *env, target_ulong address, | ||
301 | |||
302 | if (regime_using_lpae_format(env, mmu_idx)) { | ||
303 | return get_phys_addr_lpae(env, address, access_type, mmu_idx, phys_ptr, | ||
304 | - attrs, prot, page_size, fsr, fi); | ||
305 | + attrs, prot, page_size, fsr, fi, cacheattrs); | ||
306 | } else if (regime_sctlr(env, mmu_idx) & SCTLR_XP) { | ||
307 | return get_phys_addr_v6(env, address, access_type, mmu_idx, phys_ptr, | ||
308 | attrs, prot, page_size, fsr, fi); | ||
309 | @@ -XXX,XX +XXX,XX @@ bool arm_tlb_fill(CPUState *cs, vaddr address, | ||
310 | |||
311 | ret = get_phys_addr(env, address, access_type, | ||
312 | core_to_arm_mmu_idx(env, mmu_idx), &phys_addr, | ||
313 | - &attrs, &prot, &page_size, fsr, fi); | ||
314 | + &attrs, &prot, &page_size, fsr, fi, NULL); | ||
315 | if (!ret) { | ||
316 | /* Map a single [sub]page. */ | ||
317 | phys_addr &= TARGET_PAGE_MASK; | ||
318 | @@ -XXX,XX +XXX,XX @@ hwaddr arm_cpu_get_phys_page_attrs_debug(CPUState *cs, vaddr addr, | ||
319 | *attrs = (MemTxAttrs) {}; | ||
320 | |||
321 | ret = get_phys_addr(env, addr, 0, mmu_idx, &phys_addr, | ||
322 | - attrs, &prot, &page_size, &fsr, &fi); | ||
323 | + attrs, &prot, &page_size, &fsr, &fi, NULL); | ||
324 | |||
325 | if (ret) { | ||
326 | return -1; | ||
327 | -- | ||
328 | 2.7.4 | ||
329 | |||
330 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Thomas Huth <thuth@redhat.com> | ||
2 | 1 | ||
3 | This device causes QEMU to abort if the user tries to instantiate it: | ||
4 | |||
5 | $ qemu-system-aarch64 -M sabrelite -smp 1,maxcpus=2 -device fsl,,imx6 | ||
6 | Unexpected error in qemu_chr_fe_init() at chardev/char-fe.c:222: | ||
7 | qemu-system-aarch64: -device fsl,,imx6: Device 'serial0' is in use | ||
8 | Aborted (core dumped) | ||
9 | |||
10 | The device uses serial_hds[] directly in its realize function, so it | ||
11 | can not be instantiated again by the user. | ||
12 | |||
13 | Signed-off-by: Thomas Huth <thuth@redhat.com> | ||
14 | Message-id: 1509519537-6964-2-git-send-email-thuth@redhat.com | ||
15 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
17 | --- | ||
18 | hw/arm/fsl-imx6.c | 3 ++- | ||
19 | 1 file changed, 2 insertions(+), 1 deletion(-) | ||
20 | |||
21 | diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c | ||
22 | index XXXXXXX..XXXXXXX 100644 | ||
23 | --- a/hw/arm/fsl-imx6.c | ||
24 | +++ b/hw/arm/fsl-imx6.c | ||
25 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6_class_init(ObjectClass *oc, void *data) | ||
26 | DeviceClass *dc = DEVICE_CLASS(oc); | ||
27 | |||
28 | dc->realize = fsl_imx6_realize; | ||
29 | - | ||
30 | dc->desc = "i.MX6 SOC"; | ||
31 | + /* Reason: Uses serial_hds[] in the realize() function */ | ||
32 | + dc->user_creatable = false; | ||
33 | } | ||
34 | |||
35 | static const TypeInfo fsl_imx6_type_info = { | ||
36 | -- | ||
37 | 2.7.4 | ||
38 | |||
39 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Thomas Huth <thuth@redhat.com> | ||
2 | 1 | ||
3 | QEMU currently crashes when the user tries to instantiate the fsl,imx25 | ||
4 | device manually: | ||
5 | |||
6 | $ aarch64-softmmu/qemu-system-aarch64 -S -M imx25-pdk -device fsl,,imx25 | ||
7 | ** | ||
8 | ERROR:/home/thuth/devel/qemu/tcg/tcg.c:538:tcg_register_thread: | ||
9 | assertion failed: (n < max_cpus) | ||
10 | |||
11 | The imx25-pdk board (which is the one that uses this CPU type) only | ||
12 | supports one CPU, and the realize function of the "fsl,imx25" device | ||
13 | also uses serial_hds[] directly, so this device clearly can not be | ||
14 | instantiated twice and thus we should mark it with user_creatable = 0. | ||
15 | |||
16 | Signed-off-by: Thomas Huth <thuth@redhat.com> | ||
17 | Message-id: 1509519537-6964-3-git-send-email-thuth@redhat.com | ||
18 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
20 | --- | ||
21 | hw/arm/fsl-imx25.c | 6 +++++- | ||
22 | 1 file changed, 5 insertions(+), 1 deletion(-) | ||
23 | |||
24 | diff --git a/hw/arm/fsl-imx25.c b/hw/arm/fsl-imx25.c | ||
25 | index XXXXXXX..XXXXXXX 100644 | ||
26 | --- a/hw/arm/fsl-imx25.c | ||
27 | +++ b/hw/arm/fsl-imx25.c | ||
28 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx25_class_init(ObjectClass *oc, void *data) | ||
29 | DeviceClass *dc = DEVICE_CLASS(oc); | ||
30 | |||
31 | dc->realize = fsl_imx25_realize; | ||
32 | - | ||
33 | dc->desc = "i.MX25 SOC"; | ||
34 | + /* | ||
35 | + * Reason: uses serial_hds in realize and the imx25 board does not | ||
36 | + * support multiple CPUs | ||
37 | + */ | ||
38 | + dc->user_creatable = false; | ||
39 | } | ||
40 | |||
41 | static const TypeInfo fsl_imx25_type_info = { | ||
42 | -- | ||
43 | 2.7.4 | ||
44 | |||
45 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Thomas Huth <thuth@redhat.com> | ||
2 | 1 | ||
3 | QEMU currently crashes when the user tries to instantiate the fsl,imx31 | ||
4 | device manually: | ||
5 | |||
6 | $ aarch64-softmmu/qemu-system-aarch64 -M kzm -device fsl,,imx31 | ||
7 | ** | ||
8 | ERROR:/home/thuth/devel/qemu/tcg/tcg.c:538:tcg_register_thread: | ||
9 | assertion failed: (n < max_cpus) | ||
10 | Aborted (core dumped) | ||
11 | |||
12 | The kzm board (which is the one that uses this CPU type) only supports | ||
13 | one CPU, and the realize function of the "fsl,imx31" device also uses | ||
14 | serial_hds[] directly, so this device clearly can not be instantiated | ||
15 | twice and thus we should mark it with user_creatable = false. | ||
16 | |||
17 | Signed-off-by: Thomas Huth <thuth@redhat.com> | ||
18 | Message-id: 1509519537-6964-4-git-send-email-thuth@redhat.com | ||
19 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
20 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
21 | --- | ||
22 | hw/arm/fsl-imx31.c | 6 +++++- | ||
23 | 1 file changed, 5 insertions(+), 1 deletion(-) | ||
24 | |||
25 | diff --git a/hw/arm/fsl-imx31.c b/hw/arm/fsl-imx31.c | ||
26 | index XXXXXXX..XXXXXXX 100644 | ||
27 | --- a/hw/arm/fsl-imx31.c | ||
28 | +++ b/hw/arm/fsl-imx31.c | ||
29 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx31_class_init(ObjectClass *oc, void *data) | ||
30 | DeviceClass *dc = DEVICE_CLASS(oc); | ||
31 | |||
32 | dc->realize = fsl_imx31_realize; | ||
33 | - | ||
34 | dc->desc = "i.MX31 SOC"; | ||
35 | + /* | ||
36 | + * Reason: uses serial_hds in realize and the kzm board does not | ||
37 | + * support multiple CPUs | ||
38 | + */ | ||
39 | + dc->user_creatable = false; | ||
40 | } | ||
41 | |||
42 | static const TypeInfo fsl_imx31_type_info = { | ||
43 | -- | ||
44 | 2.7.4 | ||
45 | |||
46 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | For AArch32 LDREXD and STREXD, architecturally the 32-bit word at the | ||
2 | lowest address is always Rt and the one at addr+4 is Rt2, even if the | ||
3 | CPU is big-endian. Our implementation does these with a single | ||
4 | 64-bit store, so if we're big-endian then we need to put the two | ||
5 | 32-bit halves together in the opposite order to little-endian, | ||
6 | so that they end up in the right places. We were trying to do | ||
7 | this with the gen_aa32_frob64() function, but that is not correct | ||
8 | for the usermode emulator, because there there is a distinction | ||
9 | between "load a 64 bit value" (which does a BE 64-bit access | ||
10 | and doesn't need swapping) and "load two 32 bit values as one | ||
11 | 64 bit access" (where we still need to do the swapping, like | ||
12 | system mode BE32). | ||
13 | 1 | ||
14 | Fixes: https://bugs.launchpad.net/qemu/+bug/1725267 | ||
15 | Cc: qemu-stable@nongnu.org | ||
16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
17 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
18 | Message-id: 1509622400-13351-1-git-send-email-peter.maydell@linaro.org | ||
19 | --- | ||
20 | target/arm/translate.c | 39 ++++++++++++++++++++++++++++++++++----- | ||
21 | 1 file changed, 34 insertions(+), 5 deletions(-) | ||
22 | |||
23 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
24 | index XXXXXXX..XXXXXXX 100644 | ||
25 | --- a/target/arm/translate.c | ||
26 | +++ b/target/arm/translate.c | ||
27 | @@ -XXX,XX +XXX,XX @@ static void gen_load_exclusive(DisasContext *s, int rt, int rt2, | ||
28 | TCGv_i32 tmp2 = tcg_temp_new_i32(); | ||
29 | TCGv_i64 t64 = tcg_temp_new_i64(); | ||
30 | |||
31 | - gen_aa32_ld_i64(s, t64, addr, get_mem_index(s), opc); | ||
32 | + /* For AArch32, architecturally the 32-bit word at the lowest | ||
33 | + * address is always Rt and the one at addr+4 is Rt2, even if | ||
34 | + * the CPU is big-endian. That means we don't want to do a | ||
35 | + * gen_aa32_ld_i64(), which invokes gen_aa32_frob64() as if | ||
36 | + * for an architecturally 64-bit access, but instead do a | ||
37 | + * 64-bit access using MO_BE if appropriate and then split | ||
38 | + * the two halves. | ||
39 | + * This only makes a difference for BE32 user-mode, where | ||
40 | + * frob64() must not flip the two halves of the 64-bit data | ||
41 | + * but this code must treat BE32 user-mode like BE32 system. | ||
42 | + */ | ||
43 | + TCGv taddr = gen_aa32_addr(s, addr, opc); | ||
44 | + | ||
45 | + tcg_gen_qemu_ld_i64(t64, taddr, get_mem_index(s), opc); | ||
46 | + tcg_temp_free(taddr); | ||
47 | tcg_gen_mov_i64(cpu_exclusive_val, t64); | ||
48 | - tcg_gen_extr_i64_i32(tmp, tmp2, t64); | ||
49 | + if (s->be_data == MO_BE) { | ||
50 | + tcg_gen_extr_i64_i32(tmp2, tmp, t64); | ||
51 | + } else { | ||
52 | + tcg_gen_extr_i64_i32(tmp, tmp2, t64); | ||
53 | + } | ||
54 | tcg_temp_free_i64(t64); | ||
55 | |||
56 | store_reg(s, rt2, tmp2); | ||
57 | @@ -XXX,XX +XXX,XX @@ static void gen_store_exclusive(DisasContext *s, int rd, int rt, int rt2, | ||
58 | TCGv_i64 n64 = tcg_temp_new_i64(); | ||
59 | |||
60 | t2 = load_reg(s, rt2); | ||
61 | - tcg_gen_concat_i32_i64(n64, t1, t2); | ||
62 | + /* For AArch32, architecturally the 32-bit word at the lowest | ||
63 | + * address is always Rt and the one at addr+4 is Rt2, even if | ||
64 | + * the CPU is big-endian. Since we're going to treat this as a | ||
65 | + * single 64-bit BE store, we need to put the two halves in the | ||
66 | + * opposite order for BE to LE, so that they end up in the right | ||
67 | + * places. | ||
68 | + * We don't want gen_aa32_frob64() because that does the wrong | ||
69 | + * thing for BE32 usermode. | ||
70 | + */ | ||
71 | + if (s->be_data == MO_BE) { | ||
72 | + tcg_gen_concat_i32_i64(n64, t2, t1); | ||
73 | + } else { | ||
74 | + tcg_gen_concat_i32_i64(n64, t1, t2); | ||
75 | + } | ||
76 | tcg_temp_free_i32(t2); | ||
77 | - gen_aa32_frob64(s, n64); | ||
78 | |||
79 | tcg_gen_atomic_cmpxchg_i64(o64, taddr, cpu_exclusive_val, n64, | ||
80 | get_mem_index(s), opc); | ||
81 | tcg_temp_free_i64(n64); | ||
82 | |||
83 | - gen_aa32_frob64(s, o64); | ||
84 | tcg_gen_setcond_i64(TCG_COND_NE, o64, o64, cpu_exclusive_val); | ||
85 | tcg_gen_extrl_i64_i32(t0, o64); | ||
86 | |||
87 | -- | ||
88 | 2.7.4 | ||
89 | |||
90 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Shanker Donthineni <shankerd@codeaurora.org> | ||
2 | 1 | ||
3 | The commit cddafd8f353d ("hw/intc/arm_gicv3_its: Implement state save | ||
4 | /restore") breaks the backward compatibility with the older kernels | ||
5 | where vITS save/restore support is not available. The vmstate function | ||
6 | vm_change_state_handler() should not be registered if the running kernel | ||
7 | doesn't support ITS save/restore feature. Otherwise VM instance will be | ||
8 | killed whenever vmstate callback function is invoked. | ||
9 | |||
10 | Observed a virtual machine shutdown with QEMU-2.10+linux-4.11 when testing | ||
11 | the reboot command "virsh reboot <domain> --mode acpi" instead of reboot. | ||
12 | |||
13 | KVM Error: 'KVM_SET_DEVICE_ATTR failed: Group 4 attr 0x00000000000001' | ||
14 | |||
15 | Signed-off-by: Shanker Donthineni <shankerd@codeaurora.org> | ||
16 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
17 | Message-id: 1509712671-16299-1-git-send-email-shankerd@codeaurora.org | ||
18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
19 | --- | ||
20 | hw/intc/arm_gicv3_its_kvm.c | 4 ++-- | ||
21 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
22 | |||
23 | diff --git a/hw/intc/arm_gicv3_its_kvm.c b/hw/intc/arm_gicv3_its_kvm.c | ||
24 | index XXXXXXX..XXXXXXX 100644 | ||
25 | --- a/hw/intc/arm_gicv3_its_kvm.c | ||
26 | +++ b/hw/intc/arm_gicv3_its_kvm.c | ||
27 | @@ -XXX,XX +XXX,XX @@ static void kvm_arm_its_realize(DeviceState *dev, Error **errp) | ||
28 | error_free(s->migration_blocker); | ||
29 | return; | ||
30 | } | ||
31 | + } else { | ||
32 | + qemu_add_vm_change_state_handler(vm_change_state_handler, s); | ||
33 | } | ||
34 | |||
35 | kvm_msi_use_devid = true; | ||
36 | kvm_gsi_direct_mapping = false; | ||
37 | kvm_msi_via_irqfd_allowed = kvm_irqfds_enabled(); | ||
38 | - | ||
39 | - qemu_add_vm_change_state_handler(vm_change_state_handler, s); | ||
40 | } | ||
41 | |||
42 | /** | ||
43 | -- | ||
44 | 2.7.4 | ||
45 | |||
46 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Eric Auger <eric.auger@redhat.com> | ||
2 | 1 | ||
3 | The ITS is not fully properly reset at the moment. Caches are | ||
4 | not emptied. | ||
5 | |||
6 | After a reset, in case we attempt to save the state before | ||
7 | the bound devices have registered their MSIs and after the | ||
8 | 1st level table has been allocated by the ITS driver | ||
9 | (device BASER is valid), the first level entries are still | ||
10 | invalid. If the device cache is not empty (devices registered | ||
11 | before the reset), vgic_its_save_device_tables fails with -EINVAL. | ||
12 | This causes a QEMU abort(). | ||
13 | |||
14 | Cc: qemu-stable@nongnu.org | ||
15 | Signed-off-by: Eric Auger <eric.auger@redhat.com> | ||
16 | Reported-by: wanghaibin <wanghaibin.wang@huawei.com> | ||
17 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
19 | --- | ||
20 | hw/intc/arm_gicv3_its_kvm.c | 8 ++------ | ||
21 | 1 file changed, 2 insertions(+), 6 deletions(-) | ||
22 | |||
23 | diff --git a/hw/intc/arm_gicv3_its_kvm.c b/hw/intc/arm_gicv3_its_kvm.c | ||
24 | index XXXXXXX..XXXXXXX 100644 | ||
25 | --- a/hw/intc/arm_gicv3_its_kvm.c | ||
26 | +++ b/hw/intc/arm_gicv3_its_kvm.c | ||
27 | @@ -XXX,XX +XXX,XX @@ static void vm_change_state_handler(void *opaque, int running, | ||
28 | { | ||
29 | GICv3ITSState *s = (GICv3ITSState *)opaque; | ||
30 | Error *err = NULL; | ||
31 | - int ret; | ||
32 | |||
33 | if (running) { | ||
34 | return; | ||
35 | } | ||
36 | |||
37 | - ret = kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_CTRL, | ||
38 | - KVM_DEV_ARM_ITS_SAVE_TABLES, NULL, true, &err); | ||
39 | + kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_CTRL, | ||
40 | + KVM_DEV_ARM_ITS_SAVE_TABLES, NULL, true, &err); | ||
41 | if (err) { | ||
42 | error_report_err(err); | ||
43 | } | ||
44 | - if (ret < 0 && ret != -EFAULT) { | ||
45 | - abort(); | ||
46 | - } | ||
47 | } | ||
48 | |||
49 | static void kvm_arm_its_realize(DeviceState *dev, Error **errp) | ||
50 | -- | ||
51 | 2.7.4 | ||
52 | |||
53 | diff view generated by jsdifflib |