diff options
author | Dave Martin <Dave.Martin@arm.com> | 2019-04-06 06:29:40 -0400 |
---|---|---|
committer | Marc Zyngier <marc.zyngier@arm.com> | 2019-07-05 08:57:25 -0400 |
commit | fdec2a9ef853172529baaa192673b4cdb9a44fac (patch) | |
tree | 54fd76a27f05b7de5ae0d6835e065979a49e7558 /virt | |
parent | 49caebe9b3e2a83161f4374ac347eb14e11c3b54 (diff) |
KVM: arm64: Migrate _elx sysreg accessors to msr_s/mrs_s
Currently, the {read,write}_sysreg_el*() accessors for accessing
particular ELs' sysregs in the presence of VHE rely on some local
hacks and define their system register encodings in a way that is
inconsistent with the core definitions in <asm/sysreg.h>.
As a result, it is necessary to add duplicate definitions for any
system register that already needs a definition in sysreg.h for
other reasons.
This is a bit of a maintenance headache, and the reasons for the
_el*() accessors working the way they do is a bit historical.
This patch gets rid of the shadow sysreg definitions in
<asm/kvm_hyp.h>, converts the _el*() accessors to use the core
__msr_s/__mrs_s interface, and converts all call sites to use the
standard sysreg #define names (i.e., upper case, with SYS_ prefix).
This patch will conflict heavily anyway, so the opportunity
to clean up some bad whitespace in the context of the changes is
taken.
The change exposes a few system registers that have no sysreg.h
definition, due to msr_s/mrs_s being used in place of msr/mrs:
additions are made in order to fill in the gaps.
Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christoffer Dall <christoffer.dall@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Link: https://www.spinics.net/lists/kvm-arm/msg31717.html
[Rebased to v4.21-rc1]
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
[Rebased to v5.2-rc5, changelog updates]
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'virt')
-rw-r--r-- | virt/kvm/arm/arch_timer.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/virt/kvm/arm/arch_timer.c b/virt/kvm/arm/arch_timer.c index 1be486d5d7cb..e2bb5bd60227 100644 --- a/virt/kvm/arm/arch_timer.c +++ b/virt/kvm/arm/arch_timer.c | |||
@@ -237,10 +237,10 @@ static bool kvm_timer_should_fire(struct arch_timer_context *timer_ctx) | |||
237 | 237 | ||
238 | switch (index) { | 238 | switch (index) { |
239 | case TIMER_VTIMER: | 239 | case TIMER_VTIMER: |
240 | cnt_ctl = read_sysreg_el0(cntv_ctl); | 240 | cnt_ctl = read_sysreg_el0(SYS_CNTV_CTL); |
241 | break; | 241 | break; |
242 | case TIMER_PTIMER: | 242 | case TIMER_PTIMER: |
243 | cnt_ctl = read_sysreg_el0(cntp_ctl); | 243 | cnt_ctl = read_sysreg_el0(SYS_CNTP_CTL); |
244 | break; | 244 | break; |
245 | case NR_KVM_TIMERS: | 245 | case NR_KVM_TIMERS: |
246 | /* GCC is braindead */ | 246 | /* GCC is braindead */ |
@@ -350,20 +350,20 @@ static void timer_save_state(struct arch_timer_context *ctx) | |||
350 | 350 | ||
351 | switch (index) { | 351 | switch (index) { |
352 | case TIMER_VTIMER: | 352 | case TIMER_VTIMER: |
353 | ctx->cnt_ctl = read_sysreg_el0(cntv_ctl); | 353 | ctx->cnt_ctl = read_sysreg_el0(SYS_CNTV_CTL); |
354 | ctx->cnt_cval = read_sysreg_el0(cntv_cval); | 354 | ctx->cnt_cval = read_sysreg_el0(SYS_CNTV_CVAL); |
355 | 355 | ||
356 | /* Disable the timer */ | 356 | /* Disable the timer */ |
357 | write_sysreg_el0(0, cntv_ctl); | 357 | write_sysreg_el0(0, SYS_CNTV_CTL); |
358 | isb(); | 358 | isb(); |
359 | 359 | ||
360 | break; | 360 | break; |
361 | case TIMER_PTIMER: | 361 | case TIMER_PTIMER: |
362 | ctx->cnt_ctl = read_sysreg_el0(cntp_ctl); | 362 | ctx->cnt_ctl = read_sysreg_el0(SYS_CNTP_CTL); |
363 | ctx->cnt_cval = read_sysreg_el0(cntp_cval); | 363 | ctx->cnt_cval = read_sysreg_el0(SYS_CNTP_CVAL); |
364 | 364 | ||
365 | /* Disable the timer */ | 365 | /* Disable the timer */ |
366 | write_sysreg_el0(0, cntp_ctl); | 366 | write_sysreg_el0(0, SYS_CNTP_CTL); |
367 | isb(); | 367 | isb(); |
368 | 368 | ||
369 | break; | 369 | break; |
@@ -429,14 +429,14 @@ static void timer_restore_state(struct arch_timer_context *ctx) | |||
429 | 429 | ||
430 | switch (index) { | 430 | switch (index) { |
431 | case TIMER_VTIMER: | 431 | case TIMER_VTIMER: |
432 | write_sysreg_el0(ctx->cnt_cval, cntv_cval); | 432 | write_sysreg_el0(ctx->cnt_cval, SYS_CNTV_CVAL); |
433 | isb(); | 433 | isb(); |
434 | write_sysreg_el0(ctx->cnt_ctl, cntv_ctl); | 434 | write_sysreg_el0(ctx->cnt_ctl, SYS_CNTV_CTL); |
435 | break; | 435 | break; |
436 | case TIMER_PTIMER: | 436 | case TIMER_PTIMER: |
437 | write_sysreg_el0(ctx->cnt_cval, cntp_cval); | 437 | write_sysreg_el0(ctx->cnt_cval, SYS_CNTP_CVAL); |
438 | isb(); | 438 | isb(); |
439 | write_sysreg_el0(ctx->cnt_ctl, cntp_ctl); | 439 | write_sysreg_el0(ctx->cnt_ctl, SYS_CNTP_CTL); |
440 | break; | 440 | break; |
441 | case NR_KVM_TIMERS: | 441 | case NR_KVM_TIMERS: |
442 | BUG(); | 442 | BUG(); |