mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "SU Hang" <darcy.sh@antgroup.com>
To: kvm@vger.kernel.org
Cc: 赖江山 <jiangshan.ljs@antgroup.com>,
	"SU Hang" <darcy.sh@antgroup.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Sean Christopherson" <seanjc@google.com>,
	"Vitaly Kuznetsov" <vkuznets@redhat.com>,
	"Wanpeng Li" <wanpengli@tencent.com>,
	"Jim Mattson" <jmattson@google.com>,
	"Joerg Roedel" <joro@8bytes.org>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Borislav Petkov" <bp@alien8.de>,
	"Dave Hansen" <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] KVM: X86: use EPT_VIOLATION_* instead of 0x7
Date: Mon, 21 Mar 2022 17:42:03 +0800	[thread overview]
Message-ID: <20220321094203.109546-2-darcy.sh@antgroup.com> (raw)
In-Reply-To: <20220321094203.109546-1-darcy.sh@antgroup.com>

Use symbolic value, EPT_VIOLATION_*, instead of 0x7
in FNAME(walk_addr_generic)().

Signed-off-by: SU Hang <darcy.sh@antgroup.com>
---
 arch/x86/kvm/mmu/paging_tmpl.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/mmu/paging_tmpl.h b/arch/x86/kvm/mmu/paging_tmpl.h
index 7853c7ef13a1..2e2b1f7ccaca 100644
--- a/arch/x86/kvm/mmu/paging_tmpl.h
+++ b/arch/x86/kvm/mmu/paging_tmpl.h
@@ -531,7 +531,12 @@ static int FNAME(walk_addr_generic)(struct guest_walker *walker,
 			vcpu->arch.exit_qualification |= EPT_VIOLATION_ACC_READ;
 		if (fetch_fault)
 			vcpu->arch.exit_qualification |= EPT_VIOLATION_ACC_INSTR;
-		vcpu->arch.exit_qualification |= (pte_access & 0x7) << 3;
+		if (pte_access & ACC_USER_MASK)
+			vcpu->arch.exit_qualification |= EPT_VIOLATION_READABLE;
+		if (pte_access & ACC_WRITE_MASK)
+			vcpu->arch.exit_qualification |= EPT_VIOLATION_WRITABLE;
+		if (pte_access & ACC_EXEC_MASK)
+			vcpu->arch.exit_qualification |= EPT_VIOLATION_EXECUTABLE;
 	}
 #endif
 	walker->fault.address = addr;
-- 
2.32.0.3.g01195cf9f


  reply	other threads:[~2022-03-21  9:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-21  9:42 [PATCH 1/2] KVM: VMX: replace 0x180 with EPT_VIOLATION_* definition SU Hang
2022-03-21  9:42 ` SU Hang [this message]
2022-03-25  0:30   ` [PATCH 2/2] KVM: X86: use EPT_VIOLATION_* instead of 0x7 Sean Christopherson
2022-04-11  4:55     ` [PATCH v2 2/2] KVM: x86/mmu: Derive EPT violation RWX bits from EPTE RWX bits SU Hang
2022-03-25  0:08 ` [PATCH 1/2] KVM: VMX: replace 0x180 with EPT_VIOLATION_* definition Sean Christopherson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220321094203.109546-2-darcy.sh@antgroup.com \
    --to=darcy.sh@antgroup.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jiangshan.ljs@antgroup.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=tglx@linutronix.de \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®