]> rtime.felk.cvut.cz Git - lisovros/linux_canprio.git/commitdiff
KVM: MMU: Document cr0.wp emulation
authorAvi Kivity <avi@redhat.com>
Thu, 27 May 2010 11:46:04 +0000 (14:46 +0300)
committerAvi Kivity <avi@redhat.com>
Sun, 1 Aug 2010 07:39:23 +0000 (10:39 +0300)
Signed-off-by: Avi Kivity <avi@redhat.com>
Documentation/kvm/mmu.txt

index 2201dcba92a1f4644196bbb831ba07c55d2f5c8e..1e7ecdd15bba475812eb93a39f24814e30358501 100644 (file)
@@ -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
 ===============