From: Paolo Bonzini <pbonzini@redhat.com>
To: Xiao Guangrong <guangrong.xiao@linux.intel.com>,
linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: jroedel@suse.de, alex.williamson@redhat.com,
ogerlitz@mellanox.com, amirv@mellanox.com
Subject: Re: [PATCH 2/4] KVM: SVM: use NPT page attributes
Date: Thu, 9 Jul 2015 17:18:25 +0200 [thread overview]
Message-ID: <559E90C1.6000605@redhat.com> (raw)
In-Reply-To: <559DDCD0.2090502@linux.intel.com>
On 09/07/2015 04:30, Xiao Guangrong wrote:
>>>> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
>>>> index 602b974a60a6..0f125c1860ec 100644
>>>> --- a/arch/x86/kvm/svm.c
>>>> +++ b/arch/x86/kvm/svm.c
>>>> @@ -1085,6 +1085,47 @@ static u64 svm_compute_tsc_offset(struct
>>>> kvm_vcpu *vcpu, u64 target_tsc)
>>>> return target_tsc - tsc;
>>>> }
>>>>
>>>> +static void svm_set_guest_pat(struct vcpu_svm *svm, u64 *g_pat)
>>>> +{
>>>> + struct kvm_vcpu *vcpu = &svm->vcpu;
>>>> +
>>>> + /* Unlike Intel, AMD takes the guest's CR0.CD into account.
>>>
>>> I noticed this code in svm_set_cr0():
>>>
>>> if (!(vcpu->kvm->arch.disabled_quirks & KVM_QUIRK_CD_NW_CLEARED))
>>> cr0 &= ~(X86_CR0_CD | X86_CR0_NW);
>>>
>>> gCR0.CD is hidden to CPU if KVM_QUIRK_CD_NW_CLEARED is not set and looks
>>> like it is the normal case after grepping Qemu code.
Hi Xiao,
yes, this is correct. QEMU still does not have support for disabling
"quirks", so gCR0.CD is currently hidden on SVM. I would like to
include this series in 4.2, while for 4.3 I will disable the quirk above
altogether (it is superseded by the way PAT is forced to all-WB).
In any case, this is just a KVM limitation. gCR0.CD is taken into
account by the processor when computing the effective memory type. It
uses all of these:
- the guest page tables PAT/PCD/PWT
- the guest page tables CR3.PCD/CR3.PWD
- the nested page tables PAT/PCD/PWT
- the guest page tables CR3.PCD/CR3.PWD
- the host MTRRs
- gCR0.CD
- hCR0.CD
Paolo
> How about this one? I still do not know how SVM properly emulates
> CR0.CD? :(
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2015-07-09 15:18 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-07 13:45 [RFC/RFT PATCH v2 0/4] KVM: x86: full virtualization of guest MTRR Paolo Bonzini
2015-07-07 13:45 ` [PATCH 1/4] KVM: count number of assigned devices Paolo Bonzini
2015-07-07 15:22 ` Alex Williamson
2015-07-07 15:36 ` Paolo Bonzini
2015-07-07 13:45 ` [PATCH 2/4] KVM: SVM: use NPT page attributes Paolo Bonzini
2015-07-08 5:59 ` Xiao Guangrong
2015-07-08 11:19 ` Paolo Bonzini
2015-07-09 2:30 ` Xiao Guangrong
2015-07-09 15:18 ` Paolo Bonzini [this message]
2015-07-10 1:19 ` Xiao Guangrong
2015-07-10 10:47 ` Paolo Bonzini
2015-07-10 16:02 ` Xiao Guangrong
2015-07-17 0:35 ` Andy Lutomirski
2015-07-17 2:31 ` Paolo Bonzini
2015-07-07 13:45 ` [PATCH 3/4] KVM: SVM: Sync g_pat with guest-written PAT value Paolo Bonzini
2015-07-07 13:45 ` [PATCH 4/4] KVM: x86: apply guest MTRR virtualization on host reserved pages Paolo Bonzini
2015-07-07 14:06 ` [RFC/RFT PATCH v2 0/4] KVM: x86: full virtualization of guest MTRR Joerg Roedel
2015-07-07 14:09 ` Paolo Bonzini
2015-07-07 14:14 ` Joerg Roedel
-- strict thread matches above, loose matches on Subject: below --
2015-07-08 15:18 [RFC/RFT PATCH v3 " Paolo Bonzini
2015-07-08 15:18 ` [PATCH 2/4] KVM: SVM: use NPT page attributes 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=559E90C1.6000605@redhat.com \
--to=pbonzini@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=amirv@mellanox.com \
--cc=guangrong.xiao@linux.intel.com \
--cc=jroedel@suse.de \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ogerlitz@mellanox.com \
/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;
as well as URLs for NNTP newsgroup(s).