diff options
author | Marc Zyngier <marc.zyngier@arm.com> | 2014-04-24 05:21:16 -0400 |
---|---|---|
committer | Christoffer Dall <christoffer.dall@linaro.org> | 2014-07-11 07:57:43 -0400 |
commit | 7609c1251f9d8bbcd6a05ba22153e50cf4f88cff (patch) | |
tree | 0c3ee899e3158ce4821f8fcc2f26ba729ec47910 /arch/arm64/kvm | |
parent | f0a3eaff71b8bd5d5acfda1f0cf3eedf49755622 (diff) |
arm64: KVM: rename pm_fake handler to trap_raz_wi
pm_fake doesn't quite describe what the handler does (ignoring writes
and returning 0 for reads).
As we're about to use it (a lot) in a different context, rename it
with a (admitedly cryptic) name that make sense for all users.
Reviewed-by: Anup Patel <anup.patel@linaro.org>
Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'arch/arm64/kvm')
-rw-r--r-- | arch/arm64/kvm/sys_regs.c | 83 |
1 files changed, 43 insertions, 40 deletions
diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index 56288f31c12d..492ba301e10c 100644 --- a/arch/arm64/kvm/sys_regs.c +++ b/arch/arm64/kvm/sys_regs.c | |||
@@ -161,18 +161,9 @@ static bool access_sctlr(struct kvm_vcpu *vcpu, | |||
161 | return true; | 161 | return true; |
162 | } | 162 | } |
163 | 163 | ||
164 | /* | 164 | static bool trap_raz_wi(struct kvm_vcpu *vcpu, |
165 | * We could trap ID_DFR0 and tell the guest we don't support performance | 165 | const struct sys_reg_params *p, |
166 | * monitoring. Unfortunately the patch to make the kernel check ID_DFR0 was | 166 | const struct sys_reg_desc *r) |
167 | * NAKed, so it will read the PMCR anyway. | ||
168 | * | ||
169 | * Therefore we tell the guest we have 0 counters. Unfortunately, we | ||
170 | * must always support PMCCNTR (the cycle counter): we just RAZ/WI for | ||
171 | * all PM registers, which doesn't crash the guest kernel at least. | ||
172 | */ | ||
173 | static bool pm_fake(struct kvm_vcpu *vcpu, | ||
174 | const struct sys_reg_params *p, | ||
175 | const struct sys_reg_desc *r) | ||
176 | { | 167 | { |
177 | if (p->is_write) | 168 | if (p->is_write) |
178 | return ignore_write(vcpu, p); | 169 | return ignore_write(vcpu, p); |
@@ -199,6 +190,17 @@ static void reset_mpidr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *r) | |||
199 | /* | 190 | /* |
200 | * Architected system registers. | 191 | * Architected system registers. |
201 | * Important: Must be sorted ascending by Op0, Op1, CRn, CRm, Op2 | 192 | * Important: Must be sorted ascending by Op0, Op1, CRn, CRm, Op2 |
193 | * | ||
194 | * We could trap ID_DFR0 and tell the guest we don't support performance | ||
195 | * monitoring. Unfortunately the patch to make the kernel check ID_DFR0 was | ||
196 | * NAKed, so it will read the PMCR anyway. | ||
197 | * | ||
198 | * Therefore we tell the guest we have 0 counters. Unfortunately, we | ||
199 | * must always support PMCCNTR (the cycle counter): we just RAZ/WI for | ||
200 | * all PM registers, which doesn't crash the guest kernel at least. | ||
201 | * | ||
202 | * Same goes for the whole debug infrastructure, which probably breaks | ||
203 | * some guest functionnality. This should be fixed. | ||
202 | */ | 204 | */ |
203 | static const struct sys_reg_desc sys_reg_descs[] = { | 205 | static const struct sys_reg_desc sys_reg_descs[] = { |
204 | /* DC ISW */ | 206 | /* DC ISW */ |
@@ -258,10 +260,10 @@ static const struct sys_reg_desc sys_reg_descs[] = { | |||
258 | 260 | ||
259 | /* PMINTENSET_EL1 */ | 261 | /* PMINTENSET_EL1 */ |
260 | { Op0(0b11), Op1(0b000), CRn(0b1001), CRm(0b1110), Op2(0b001), | 262 | { Op0(0b11), Op1(0b000), CRn(0b1001), CRm(0b1110), Op2(0b001), |
261 | pm_fake }, | 263 | trap_raz_wi }, |
262 | /* PMINTENCLR_EL1 */ | 264 | /* PMINTENCLR_EL1 */ |
263 | { Op0(0b11), Op1(0b000), CRn(0b1001), CRm(0b1110), Op2(0b010), | 265 | { Op0(0b11), Op1(0b000), CRn(0b1001), CRm(0b1110), Op2(0b010), |
264 | pm_fake }, | 266 | trap_raz_wi }, |
265 | 267 | ||
266 | /* MAIR_EL1 */ | 268 | /* MAIR_EL1 */ |
267 | { Op0(0b11), Op1(0b000), CRn(0b1010), CRm(0b0010), Op2(0b000), | 269 | { Op0(0b11), Op1(0b000), CRn(0b1010), CRm(0b0010), Op2(0b000), |
@@ -290,43 +292,43 @@ static const struct sys_reg_desc sys_reg_descs[] = { | |||
290 | 292 | ||
291 | /* PMCR_EL0 */ | 293 | /* PMCR_EL0 */ |
292 | { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b000), | 294 | { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b000), |
293 | pm_fake }, | 295 | trap_raz_wi }, |
294 | /* PMCNTENSET_EL0 */ | 296 | /* PMCNTENSET_EL0 */ |
295 | { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b001), | 297 | { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b001), |
296 | pm_fake }, | 298 | trap_raz_wi }, |
297 | /* PMCNTENCLR_EL0 */ | 299 | /* PMCNTENCLR_EL0 */ |
298 | { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b010), | 300 | { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b010), |
299 | pm_fake }, | 301 | trap_raz_wi }, |
300 | /* PMOVSCLR_EL0 */ | 302 | /* PMOVSCLR_EL0 */ |
301 | { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b011), | 303 | { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b011), |
302 | pm_fake }, | 304 | trap_raz_wi }, |
303 | /* PMSWINC_EL0 */ | 305 | /* PMSWINC_EL0 */ |
304 | { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b100), | 306 | { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b100), |
305 | pm_fake }, | 307 | trap_raz_wi }, |
306 | /* PMSELR_EL0 */ | 308 | /* PMSELR_EL0 */ |
307 | { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b101), | 309 | { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b101), |
308 | pm_fake }, | 310 | trap_raz_wi }, |
309 | /* PMCEID0_EL0 */ | 311 | /* PMCEID0_EL0 */ |
310 | { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b110), | 312 | { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b110), |
311 | pm_fake }, | 313 | trap_raz_wi }, |
312 | /* PMCEID1_EL0 */ | 314 | /* PMCEID1_EL0 */ |
313 | { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b111), | 315 | { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b111), |
314 | pm_fake }, | 316 | trap_raz_wi }, |
315 | /* PMCCNTR_EL0 */ | 317 | /* PMCCNTR_EL0 */ |
316 | { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1101), Op2(0b000), | 318 | { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1101), Op2(0b000), |
317 | pm_fake }, | 319 | trap_raz_wi }, |
318 | /* PMXEVTYPER_EL0 */ | 320 | /* PMXEVTYPER_EL0 */ |
319 | { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1101), Op2(0b001), | 321 | { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1101), Op2(0b001), |
320 | pm_fake }, | 322 | trap_raz_wi }, |
321 | /* PMXEVCNTR_EL0 */ | 323 | /* PMXEVCNTR_EL0 */ |
322 | { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1101), Op2(0b010), | 324 | { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1101), Op2(0b010), |
323 | pm_fake }, | 325 | trap_raz_wi }, |
324 | /* PMUSERENR_EL0 */ | 326 | /* PMUSERENR_EL0 */ |
325 | { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1110), Op2(0b000), | 327 | { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1110), Op2(0b000), |
326 | pm_fake }, | 328 | trap_raz_wi }, |
327 | /* PMOVSSET_EL0 */ | 329 | /* PMOVSSET_EL0 */ |
328 | { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1110), Op2(0b011), | 330 | { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1110), Op2(0b011), |
329 | pm_fake }, | 331 | trap_raz_wi }, |
330 | 332 | ||
331 | /* TPIDR_EL0 */ | 333 | /* TPIDR_EL0 */ |
332 | { Op0(0b11), Op1(0b011), CRn(0b1101), CRm(0b0000), Op2(0b010), | 334 | { Op0(0b11), Op1(0b011), CRn(0b1101), CRm(0b0000), Op2(0b010), |
@@ -372,19 +374,20 @@ static const struct sys_reg_desc cp15_regs[] = { | |||
372 | { Op1( 0), CRn( 7), CRm(10), Op2( 2), access_dcsw }, | 374 | { Op1( 0), CRn( 7), CRm(10), Op2( 2), access_dcsw }, |
373 | { Op1( 0), CRn( 7), CRm(14), Op2( 2), access_dcsw }, | 375 | { Op1( 0), CRn( 7), CRm(14), Op2( 2), access_dcsw }, |
374 | 376 | ||
375 | { Op1( 0), CRn( 9), CRm(12), Op2( 0), pm_fake }, | 377 | /* PMU */ |
376 | { Op1( 0), CRn( 9), CRm(12), Op2( 1), pm_fake }, | 378 | { Op1( 0), CRn( 9), CRm(12), Op2( 0), trap_raz_wi }, |
377 | { Op1( 0), CRn( 9), CRm(12), Op2( 2), pm_fake }, | 379 | { Op1( 0), CRn( 9), CRm(12), Op2( 1), trap_raz_wi }, |
378 | { Op1( 0), CRn( 9), CRm(12), Op2( 3), pm_fake }, | 380 | { Op1( 0), CRn( 9), CRm(12), Op2( 2), trap_raz_wi }, |
379 | { Op1( 0), CRn( 9), CRm(12), Op2( 5), pm_fake }, | 381 | { Op1( 0), CRn( 9), CRm(12), Op2( 3), trap_raz_wi }, |
380 | { Op1( 0), CRn( 9), CRm(12), Op2( 6), pm_fake }, | 382 | { Op1( 0), CRn( 9), CRm(12), Op2( 5), trap_raz_wi }, |
381 | { Op1( 0), CRn( 9), CRm(12), Op2( 7), pm_fake }, | 383 | { Op1( 0), CRn( 9), CRm(12), Op2( 6), trap_raz_wi }, |
382 | { Op1( 0), CRn( 9), CRm(13), Op2( 0), pm_fake }, | 384 | { Op1( 0), CRn( 9), CRm(12), Op2( 7), trap_raz_wi }, |
383 | { Op1( 0), CRn( 9), CRm(13), Op2( 1), pm_fake }, | 385 | { Op1( 0), CRn( 9), CRm(13), Op2( 0), trap_raz_wi }, |
384 | { Op1( 0), CRn( 9), CRm(13), Op2( 2), pm_fake }, | 386 | { Op1( 0), CRn( 9), CRm(13), Op2( 1), trap_raz_wi }, |
385 | { Op1( 0), CRn( 9), CRm(14), Op2( 0), pm_fake }, | 387 | { Op1( 0), CRn( 9), CRm(13), Op2( 2), trap_raz_wi }, |
386 | { Op1( 0), CRn( 9), CRm(14), Op2( 1), pm_fake }, | 388 | { Op1( 0), CRn( 9), CRm(14), Op2( 0), trap_raz_wi }, |
387 | { Op1( 0), CRn( 9), CRm(14), Op2( 2), pm_fake }, | 389 | { Op1( 0), CRn( 9), CRm(14), Op2( 1), trap_raz_wi }, |
390 | { Op1( 0), CRn( 9), CRm(14), Op2( 2), trap_raz_wi }, | ||
388 | 391 | ||
389 | { Op1( 0), CRn(10), CRm( 2), Op2( 0), access_vm_reg, NULL, c10_PRRR }, | 392 | { Op1( 0), CRn(10), CRm( 2), Op2( 0), access_vm_reg, NULL, c10_PRRR }, |
390 | { Op1( 0), CRn(10), CRm( 2), Op2( 1), access_vm_reg, NULL, c10_NMRR }, | 393 | { Op1( 0), CRn(10), CRm( 2), Op2( 1), access_vm_reg, NULL, c10_NMRR }, |