summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2010-05-27 14:46:04 +0300
committerAvi Kivity <avi@redhat.com>2010-08-01 10:39:23 +0300
commitec87fe2afcbcc4f430554980ec3e408bae34229d (patch)
tree17f5574d13dbd24b75d515d77bd0bf26373e0dab
parent8184dd38e22fcaec664c2b98c382b85c26780e26 (diff)
KVM: MMU: Document cr0.wp emulation
Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r--Documentation/kvm/mmu.txt19
1 files changed, 19 insertions, 0 deletions
diff --git a/Documentation/kvm/mmu.txt b/Documentation/kvm/mmu.txt
index 2201dcba92a..1e7ecdd15bb 100644
--- a/Documentation/kvm/mmu.txt
+++ b/Documentation/kvm/mmu.txt
@@ -298,6 +298,25 @@ 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 (the
+semantics require allowing any guest kernel access plus user read access).
+
+We handle this by mapping the permissions to two possible sptes, 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
===============