From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: [PATCH 3/3] KVM: MMU: Document cr0.wp emulation Date: Thu, 27 May 2010 14:50:06 +0300 Message-ID: <1274961006-19413-4-git-send-email-avi@redhat.com> References: <1274961006-19413-1-git-send-email-avi@redhat.com> Cc: kvm@vger.kernel.org To: Xiao Guangrong , Marcelo Tosatti Return-path: Received: from mx1.redhat.com ([209.132.183.28]:34469 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759178Ab0E0LuM (ORCPT ); Thu, 27 May 2010 07:50:12 -0400 In-Reply-To: <1274961006-19413-1-git-send-email-avi@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Signed-off-by: Avi Kivity --- Documentation/kvm/mmu.txt | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/Documentation/kvm/mmu.txt b/Documentation/kvm/mmu.txt index 2201dcb..6528ad9 100644 --- a/Documentation/kvm/mmu.txt +++ b/Documentation/kvm/mmu.txt @@ -298,6 +298,24 @@ Host translation updates: - look up affected sptes through reverse map - drop (or update) translations +Emulating cr0.wp +================ + +If tdp is not enabled, the host must keep cr0.wp=1 so page write protection +works for the guest kernel, not guest guest userspace. When the guest +cr0.wp=1, this does not present a problem. However when the guest cr0.wp=0, +we cannot map the permissions for gpte.u=1, gpte.w=0 to any spte. + +We handle this my mapping the permissions to two possible gptes, depending +on fault type: + +- kernel write fault: spte.u=0, spte.w=1 (allows full kernel access, + disallows user access) +- read fault: spte.u=1, spte.w=0 (allows full read access, disallows kernel + write access) + +(user write faults generate a #PF) + Further reading =============== -- 1.7.1