* [PATCH] KVM: x86: selftests: svm_int_ctl_test: fix intercept calculation
@ 2021-12-02 23:10 Maciej S. Szmigiero
2021-12-03 7:36 ` Maxim Levitsky
2021-12-08 14:04 ` Paolo Bonzini
0 siblings, 2 replies; 3+ messages in thread
From: Maciej S. Szmigiero @ 2021-12-02 23:10 UTC (permalink / raw)
To: Paolo Bonzini
Cc: Shuah Khan, Maxim Levitsky, kvm, linux-kselftest, linux-kernel
From: "Maciej S. Szmigiero" <maciej.szmigiero@oracle.com>
INTERCEPT_x are bit positions, but the code was using the raw value of
INTERCEPT_VINTR (4) instead of BIT(INTERCEPT_VINTR).
This resulted in masking of bit 2 - that is, SMI instead of VINTR.
Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
---
tools/testing/selftests/kvm/x86_64/svm_int_ctl_test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/kvm/x86_64/svm_int_ctl_test.c b/tools/testing/selftests/kvm/x86_64/svm_int_ctl_test.c
index df04f56ce859..30a81038df46 100644
--- a/tools/testing/selftests/kvm/x86_64/svm_int_ctl_test.c
+++ b/tools/testing/selftests/kvm/x86_64/svm_int_ctl_test.c
@@ -75,7 +75,7 @@ static void l1_guest_code(struct svm_test_data *svm)
vmcb->control.int_ctl &= ~V_INTR_MASKING_MASK;
/* No intercepts for real and virtual interrupts */
- vmcb->control.intercept &= ~(1ULL << INTERCEPT_INTR | INTERCEPT_VINTR);
+ vmcb->control.intercept &= ~(BIT(INTERCEPT_INTR) | BIT(INTERCEPT_VINTR));
/* Make a virtual interrupt VINTR_IRQ_NUMBER pending */
vmcb->control.int_ctl |= V_IRQ_MASK | (0x1 << V_INTR_PRIO_SHIFT);
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] KVM: x86: selftests: svm_int_ctl_test: fix intercept calculation
2021-12-02 23:10 [PATCH] KVM: x86: selftests: svm_int_ctl_test: fix intercept calculation Maciej S. Szmigiero
@ 2021-12-03 7:36 ` Maxim Levitsky
2021-12-08 14:04 ` Paolo Bonzini
1 sibling, 0 replies; 3+ messages in thread
From: Maxim Levitsky @ 2021-12-03 7:36 UTC (permalink / raw)
To: Maciej S. Szmigiero, Paolo Bonzini
Cc: Shuah Khan, kvm, linux-kselftest, linux-kernel
On Fri, 2021-12-03 at 00:10 +0100, Maciej S. Szmigiero wrote:
> From: "Maciej S. Szmigiero" <maciej.szmigiero@oracle.com>
>
> INTERCEPT_x are bit positions, but the code was using the raw value of
> INTERCEPT_VINTR (4) instead of BIT(INTERCEPT_VINTR).
> This resulted in masking of bit 2 - that is, SMI instead of VINTR.
>
> Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
> ---
> tools/testing/selftests/kvm/x86_64/svm_int_ctl_test.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/kvm/x86_64/svm_int_ctl_test.c b/tools/testing/selftests/kvm/x86_64/svm_int_ctl_test.c
> index df04f56ce859..30a81038df46 100644
> --- a/tools/testing/selftests/kvm/x86_64/svm_int_ctl_test.c
> +++ b/tools/testing/selftests/kvm/x86_64/svm_int_ctl_test.c
> @@ -75,7 +75,7 @@ static void l1_guest_code(struct svm_test_data *svm)
> vmcb->control.int_ctl &= ~V_INTR_MASKING_MASK;
>
> /* No intercepts for real and virtual interrupts */
> - vmcb->control.intercept &= ~(1ULL << INTERCEPT_INTR | INTERCEPT_VINTR);
> + vmcb->control.intercept &= ~(BIT(INTERCEPT_INTR) | BIT(INTERCEPT_VINTR));
>
> /* Make a virtual interrupt VINTR_IRQ_NUMBER pending */
> vmcb->control.int_ctl |= V_IRQ_MASK | (0x1 << V_INTR_PRIO_SHIFT);
>
Sorry about that.
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Best regards,
Maxim Levitsky
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] KVM: x86: selftests: svm_int_ctl_test: fix intercept calculation
2021-12-02 23:10 [PATCH] KVM: x86: selftests: svm_int_ctl_test: fix intercept calculation Maciej S. Szmigiero
2021-12-03 7:36 ` Maxim Levitsky
@ 2021-12-08 14:04 ` Paolo Bonzini
1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2021-12-08 14:04 UTC (permalink / raw)
To: Maciej S. Szmigiero
Cc: Shuah Khan, Maxim Levitsky, kvm, linux-kselftest, linux-kernel
On 12/3/21 00:10, Maciej S. Szmigiero wrote:
> From: "Maciej S. Szmigiero" <maciej.szmigiero@oracle.com>
>
> INTERCEPT_x are bit positions, but the code was using the raw value of
> INTERCEPT_VINTR (4) instead of BIT(INTERCEPT_VINTR).
> This resulted in masking of bit 2 - that is, SMI instead of VINTR.
>
> Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
> ---
> tools/testing/selftests/kvm/x86_64/svm_int_ctl_test.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/kvm/x86_64/svm_int_ctl_test.c b/tools/testing/selftests/kvm/x86_64/svm_int_ctl_test.c
> index df04f56ce859..30a81038df46 100644
> --- a/tools/testing/selftests/kvm/x86_64/svm_int_ctl_test.c
> +++ b/tools/testing/selftests/kvm/x86_64/svm_int_ctl_test.c
> @@ -75,7 +75,7 @@ static void l1_guest_code(struct svm_test_data *svm)
> vmcb->control.int_ctl &= ~V_INTR_MASKING_MASK;
>
> /* No intercepts for real and virtual interrupts */
> - vmcb->control.intercept &= ~(1ULL << INTERCEPT_INTR | INTERCEPT_VINTR);
> + vmcb->control.intercept &= ~(BIT(INTERCEPT_INTR) | BIT(INTERCEPT_VINTR));
>
> /* Make a virtual interrupt VINTR_IRQ_NUMBER pending */
> vmcb->control.int_ctl |= V_IRQ_MASK | (0x1 << V_INTR_PRIO_SHIFT);
>
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-12-08 14:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-02 23:10 [PATCH] KVM: x86: selftests: svm_int_ctl_test: fix intercept calculation Maciej S. Szmigiero
2021-12-03 7:36 ` Maxim Levitsky
2021-12-08 14:04 ` 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).