kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [kvm-unit-tests PATCH] x86: Fix APIC version register test
@ 2019-04-30 14:32 nadav.amit
  2019-05-20 14:12 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: nadav.amit @ 2019-04-30 14:32 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: kvm, Nadav Amit, Sean Christopherson

From: Nadav Amit <nadav.amit@gmail.com>

The local APIC existance test considers reserved bits (bits [8:15]),
which is not good. In addition, it is best to consider every integrated
APIC version as valid.

Cc: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Nadav Amit <nadav.amit@gmail.com>
---
 x86/apic.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/x86/apic.c b/x86/apic.c
index cfdbef2..21041ec 100644
--- a/x86/apic.c
+++ b/x86/apic.c
@@ -11,11 +11,11 @@
 
 static void test_lapic_existence(void)
 {
-    u32 lvr;
+    u8 version;
 
-    lvr = apic_read(APIC_LVR);
-    printf("apic version: %x\n", lvr);
-    report("apic existence", (u16)lvr == 0x14);
+    version = (u8)apic_read(APIC_LVR);
+    printf("apic version: %x\n", version);
+    report("apic existence", version >= 0x10 && version <= 0x15);
 }
 
 #define TSC_DEADLINE_TIMER_VECTOR 0xef
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [kvm-unit-tests PATCH] x86: Fix APIC version register test
  2019-04-30 14:32 [kvm-unit-tests PATCH] x86: Fix APIC version register test nadav.amit
@ 2019-05-20 14:12 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2019-05-20 14:12 UTC (permalink / raw)
  To: nadav.amit; +Cc: kvm, Sean Christopherson

On 30/04/19 16:32, nadav.amit@gmail.com wrote:
> From: Nadav Amit <nadav.amit@gmail.com>
> 
> The local APIC existance test considers reserved bits (bits [8:15]),
> which is not good. In addition, it is best to consider every integrated
> APIC version as valid.
> 
> Cc: Sean Christopherson <sean.j.christopherson@intel.com>
> Signed-off-by: Nadav Amit <nadav.amit@gmail.com>
> ---
>  x86/apic.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/x86/apic.c b/x86/apic.c
> index cfdbef2..21041ec 100644
> --- a/x86/apic.c
> +++ b/x86/apic.c
> @@ -11,11 +11,11 @@
>  
>  static void test_lapic_existence(void)
>  {
> -    u32 lvr;
> +    u8 version;
>  
> -    lvr = apic_read(APIC_LVR);
> -    printf("apic version: %x\n", lvr);
> -    report("apic existence", (u16)lvr == 0x14);
> +    version = (u8)apic_read(APIC_LVR);
> +    printf("apic version: %x\n", version);
> +    report("apic existence", version >= 0x10 && version <= 0x15);
>  }
>  
>  #define TSC_DEADLINE_TIMER_VECTOR 0xef
> 

Queued, thanks.

Paolo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-05-20 14:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-30 14:32 [kvm-unit-tests PATCH] x86: Fix APIC version register test nadav.amit
2019-05-20 14:12 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).