All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Huaitong Han <huaitong.han@intel.com>, gleb@kernel.org
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH 7/9] KVM, pkeys: Add pkeys support for gva_to_gpa funcions
Date: Mon, 9 Nov 2015 14:23:00 +0100	[thread overview]
Message-ID: <56409E34.2050400@redhat.com> (raw)
In-Reply-To: <1447070055-4207-8-git-send-email-huaitong.han@intel.com>



On 09/11/2015 12:54, Huaitong Han wrote:
> index 7a84b83..6e9156d 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -3960,6 +3960,8 @@ gpa_t kvm_mmu_gva_to_gpa_read(struct kvm_vcpu *vcpu, gva_t gva,
>  			      struct x86_exception *exception)
>  {
>  	u32 access = (kvm_x86_ops->get_cpl(vcpu) == 3) ? PFERR_USER_MASK : 0;
> +	access |= is_long_mode(vcpu) && kvm_read_cr4_bits(vcpu, X86_CR4_PKE)
> +		? PFERR_PK_MASK : 0;
>  	return vcpu->arch.walk_mmu->gva_to_gpa(vcpu, gva, access, exception);

I think checking is_long_mode is not necessary here, since is_long_mode
is not checked in update_permission_bitmask but (dynamically) in
permission_fault.
> 
> +	gpa_t gpa;
> +
> +	access |= is_long_mode(vcpu) && kvm_read_cr4_bits(vcpu, X86_CR4_PKE)
> +		? PFERR_PK_MASK : 0;

Fetches never have PFERR_PK_MASK set.

Thanks,

Paolo

>  	/* Inline kvm_read_guest_virt_helper for speed.  */
> -	gpa_t gpa = vcpu->arch.walk_mmu->gva_to_gpa(vcpu, addr, access|PFERR_FETCH_MASK,
> -						    exception);
> +	gpa = vcpu->arch.walk_mmu->gva_to_gpa(vcpu, addr,
> +			access | PFERR_FETCH_MASK, exception);

  reply	other threads:[~2015-11-09 13:23 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-09 11:54 [PATCH 0/9] KVM, pkeys: add memory protection-key support Huaitong Han
2015-11-09 11:54 ` [PATCH 1/9] KVM, pkeys: expose CPUID:PKU to guest Huaitong Han
2015-11-09 11:54 ` [PATCH 2/9] KVM, pkeys: add pkeys support when setting CR4 Huaitong Han
2015-11-09 11:54 ` [PATCH 3/9] KVM, pkeys: expose CPUID:OSPKE to guest Huaitong Han
2015-11-09 12:32   ` Paolo Bonzini
2015-11-09 11:54 ` [PATCH 4/9] KVM, pkeys: disable pkeys for guests in non-paging mode Huaitong Han
2015-11-09 11:54 ` [PATCH 5/9] KVM, pkeys: update memeory permission bitmask for pkeys Huaitong Han
2015-11-09 13:24   ` Paolo Bonzini
2015-11-09 11:54 ` [PATCH 6/9] KVM, pkeys: add pkeys support for permission_fault logic Huaitong Han
2015-11-09 12:43   ` Paolo Bonzini
2015-11-09 13:17     ` Paolo Bonzini
2015-11-10  9:28       ` Han, Huaitong
2015-11-10  9:35         ` Paolo Bonzini
2015-11-09 11:54 ` [PATCH 7/9] KVM, pkeys: Add pkeys support for gva_to_gpa funcions Huaitong Han
2015-11-09 13:23   ` Paolo Bonzini [this message]
2015-11-09 11:54 ` [PATCH 8/9] KVM, pkeys: add pkeys support for xsave state Huaitong Han
2015-11-09 11:54 ` [PATCH 9/9] KVM, pkeys: disable PKU feature without ept Huaitong Han
2015-11-09 13:26 ` [PATCH 0/9] KVM, pkeys: add memory protection-key support Paolo Bonzini

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=56409E34.2050400@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=gleb@kernel.org \
    --cc=huaitong.han@intel.com \
    --cc=kvm@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.