diff mbox

[kvm-unit-tests,0/2] arm64: add vtimer test

Message ID 20170704135838.9061-1-drjones@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andrew Jones July 4, 2017, 1:58 p.m. UTC
Add a test for the vtimer. I've tested on
 accel=tcg
 accel=kvm,kernel-irqchip=on  : on thunderx, seattle, and mustang
 accel=kvm,kernel-irqchip=off : on thunderx and mustang

It works everywhere without modification except on mustang. My mustang
seems to have a hardware problem requiring bit 31 of CNTV_CVAL_EL0
to be clear before attempting to enable (setting CNTV_CTL_EL0.ENABLE),
otherwise the VCPU hangs... My mustang's CNTV_CVAL_EL0 also has the
strange issue of not being able to set the upper 8 bits.  Well, fixing
hardware is outside my job description, so "oh, well..." If you hit
the same problem, try the hack below, which allows tests to run and
pass for me.


Alexander Graf (1):
  arm64: add vtimer test

Andrew Jones (1):
  arm64: timer: check for vtimer interrupt

 arm/Makefile.arm64 |   2 +-
 arm/timer.c        | 134 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 arm/unittests.cfg  |   6 +++
 lib/arm/asm/gic.h  |   4 ++
 4 files changed, 145 insertions(+), 1 deletion(-)
 create mode 100644 arm/timer.c

Comments

Paolo Bonzini July 4, 2017, 5:29 p.m. UTC | #1
On 04/07/2017 15:58, Andrew Jones wrote:
> Add a test for the vtimer. I've tested on
>  accel=tcg
>  accel=kvm,kernel-irqchip=on  : on thunderx, seattle, and mustang
>  accel=kvm,kernel-irqchip=off : on thunderx and mustang
> 
> It works everywhere without modification except on mustang. My mustang
> seems to have a hardware problem requiring bit 31 of CNTV_CVAL_EL0
> to be clear before attempting to enable (setting CNTV_CTL_EL0.ENABLE),
> otherwise the VCPU hangs... My mustang's CNTV_CVAL_EL0 also has the
> strange issue of not being able to set the upper 8 bits.  Well, fixing
> hardware is outside my job description, so "oh, well..." If you hit
> the same problem, try the hack below, which allows tests to run and
> pass for me.

Applied and pushed, thanks.

Paolo

> diff --git a/arm/timer.c b/arm/timer.c
> index 89f4c9400ab69..18b8c4773c92f 100644
> --- a/arm/timer.c
> +++ b/arm/timer.c
> @@ -73,7 +73,7 @@ static void test_vtimer(void)
>  	report_prefix_push("vtimer-busy-loop");
>  
>  	/* Enable the timer */
> -	write_sysreg(~0, cntv_cval_el0);
> +	write_sysreg(~0 & ~(1<<31), cntv_cval_el0);
>  	isb();
>  	write_sysreg(CNTV_CTL_ENABLE, cntv_ctl_el0);
>  
> 
> Alexander Graf (1):
>   arm64: add vtimer test
> 
> Andrew Jones (1):
>   arm64: timer: check for vtimer interrupt
> 
>  arm/Makefile.arm64 |   2 +-
>  arm/timer.c        | 134 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  arm/unittests.cfg  |   6 +++
>  lib/arm/asm/gic.h  |   4 ++
>  4 files changed, 145 insertions(+), 1 deletion(-)
>  create mode 100644 arm/timer.c
>
diff mbox

Patch

diff --git a/arm/timer.c b/arm/timer.c
index 89f4c9400ab69..18b8c4773c92f 100644
--- a/arm/timer.c
+++ b/arm/timer.c
@@ -73,7 +73,7 @@  static void test_vtimer(void)
 	report_prefix_push("vtimer-busy-loop");
 
 	/* Enable the timer */
-	write_sysreg(~0, cntv_cval_el0);
+	write_sysreg(~0 & ~(1<<31), cntv_cval_el0);
 	isb();
 	write_sysreg(CNTV_CTL_ENABLE, cntv_ctl_el0);