kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: x86: Deplete Paolo's brown paper bag supply by one
@ 2022-04-06 22:51 Sean Christopherson
  2022-04-07  7:07 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Sean Christopherson @ 2022-04-06 22:51 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Sean Christopherson, Vitaly Kuznetsov, Wanpeng Li, Jim Mattson,
	Joerg Roedel, kvm, linux-kernel

Fix an inverted check on CR0.PG when computing the cpu_role, the MMU is
direct and all CR4 bits ignored if paging is disabled, not enabled.

Fixes: d73678dc11ec ("KVM: x86/mmu: split cpu_role from mmu_role")
Signed-off-by: Sean Christopherson <seanjc@google.com>
---

I haven't done much testing on the rest of the MMU role patches, this just
popped up in very, very basic testing ;-)  I assume this will be squashed,
hence the snarky shortlog.

 arch/x86/kvm/mmu/mmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index e41d7bba7a65..ab24fc161bac 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -4699,7 +4699,7 @@ kvm_calc_cpu_role(struct kvm_vcpu *vcpu, const struct kvm_mmu_role_regs *regs)
 	role.base.smm = is_smm(vcpu);
 	role.base.guest_mode = is_guest_mode(vcpu);
 
-	if (____is_cr0_pg(regs)) {
+	if (!____is_cr0_pg(regs)) {
 		role.base.direct = 1;
 		return role;
 	}

base-commit: 56ba4b488353a8925b30367d72e41d1996c23554
-- 
2.35.1.1094.g7c7d902a7c-goog


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

* Re: [PATCH] KVM: x86: Deplete Paolo's brown paper bag supply by one
  2022-04-06 22:51 [PATCH] KVM: x86: Deplete Paolo's brown paper bag supply by one Sean Christopherson
@ 2022-04-07  7:07 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2022-04-07  7:07 UTC (permalink / raw)
  To: Sean Christopherson
  Cc: Vitaly Kuznetsov, Wanpeng Li, Jim Mattson, Joerg Roedel, kvm,
	linux-kernel

On 4/7/22 00:51, Sean Christopherson wrote:
> Fix an inverted check on CR0.PG when computing the cpu_role, the MMU is
> direct and all CR4 bits ignored if paging is disabled, not enabled.
> 
> Fixes: d73678dc11ec ("KVM: x86/mmu: split cpu_role from mmu_role")
> Signed-off-by: Sean Christopherson <seanjc@google.com>
> ---
> 
> I haven't done much testing on the rest of the MMU role patches, this just
> popped up in very, very basic testing ;-)  I assume this will be squashed,
> hence the snarky shortlog.

It certainly got my attention... squashed, thanks. :)

Paolo

>   arch/x86/kvm/mmu/mmu.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
> index e41d7bba7a65..ab24fc161bac 100644
> --- a/arch/x86/kvm/mmu/mmu.c
> +++ b/arch/x86/kvm/mmu/mmu.c
> @@ -4699,7 +4699,7 @@ kvm_calc_cpu_role(struct kvm_vcpu *vcpu, const struct kvm_mmu_role_regs *regs)
>   	role.base.smm = is_smm(vcpu);
>   	role.base.guest_mode = is_guest_mode(vcpu);
>   
> -	if (____is_cr0_pg(regs)) {
> +	if (!____is_cr0_pg(regs)) {
>   		role.base.direct = 1;
>   		return role;
>   	}
> 
> base-commit: 56ba4b488353a8925b30367d72e41d1996c23554


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

end of thread, other threads:[~2022-04-07  7:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-06 22:51 [PATCH] KVM: x86: Deplete Paolo's brown paper bag supply by one Sean Christopherson
2022-04-07  7:07 ` 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).