All of lore.kernel.org
 help / color / mirror / Atom feed
* [V3 PATCH 0/9] x86/hvm: pkeys, add memory protection-key support
@ 2015-12-07  9:16 Huaitong Han
  2015-12-07  9:16 ` [V3 PATCH 1/9] x86/hvm: pkeys, add the flag to enable Memory Protection Keys Huaitong Han
                   ` (8 more replies)
  0 siblings, 9 replies; 44+ messages in thread
From: Huaitong Han @ 2015-12-07  9:16 UTC (permalink / raw)
  To: jbeulich, andrew.cooper3, jun.nakajima, eddie.dong, kevin.tian,
	george.dunlap, ian.jackson, stefano.stabellini, ian.campbell,
	wei.liu2, keir
  Cc: Huaitong Han, xen-devel

Changes in v3:
*Get CPUID:ospke depend on guest cpuid instead of host hardware capable, 
and Move cpuid patch to the last of patches.
*Move opt_pku to cpu/common.c.
*Use MASK_EXTR for get_pte_pkeys.
*Add quoting for pkru macro, and use static inline pkru_read functions.
*Rebase get_xsave_addr for updated codes, and add uncompressed format support
for xsave state.
*Use fpu_xsave instead of vcpu_save_fpu, and adjust the code style for
leaf_pte_pkeys_check.
*Add parentheses for PFEC_prot_key of gva2gfn funcitons.

Changes in v2:
*Rebase all patches in staging branch
*Disable X86_CR4_PKE on hypervisor, and delete pkru_read/write functions, and
use xsave state read to get pkru value.
*Delete the patch that adds pkeys support for do_page_fault.
*Add pkeys support for gva2gfn so that setting _PAGE_PK_BIT in the return
value can get propagated to the guest correctly.

The protection-key feature provides an additional mechanism by which IA-32e
paging controls access to usermode addresses.

Hardware support for protection keys for user pages is enumerated with CPUID
feature flag CPUID.7.0.ECX[3]:PKU. Software support is CPUID.7.0.ECX[4]:OSPKE
with the setting of CR4.PKE(bit 22).

When CR4.PKE = 1, every linear address is associated with the 4-bit protection
key located in bits 62:59 of the paging-structure entry that mapped the page
containing the linear address. The PKRU register determines, for each
protection key, whether user-mode addresses with that protection key may be
read or written.

The PKRU register (protection key rights for user pages) is a 32-bit register
with the following format: for each i (0 ≤ i ≤ 15), PKRU[2i] is the
access-disable bit for protection key i (ADi); PKRU[2i+1] is the write-disable
bit for protection key i (WDi).

Software can use the RDPKRU and WRPKRU instructions with ECX = 0 to read and
write PKRU. In addition, the PKRU register is XSAVE-managed state and can thus
be read and written by instructions in the XSAVE feature set.

PFEC.PK (bit 5) is defined as protection key violations.

The specification of Protection Keys can be found at SDM (4.6.2, volume 3)
http://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-manual-325462.pdf.

Huaitong Han (9):
  x86/hvm: pkeys, add the flag to enable Memory Protection Keys
  x86/hvm: pkeys, add pkeys support when setting CR4
  x86/hvm: pkeys, disable pkeys for guests in non-paging mode
  x86/hvm: pkeys, add functions to get pkeys value from PTE
  x86/hvm: pkeys, add functions to support PKRU access
  x86/hvm: pkeys, add xstate support for pkeys
  x86/hvm: pkeys, add pkeys support for guest_walk_tables
  x86/hvm: pkeys, add pkeys support for gva2gfn funcitons
  x86/hvm: pkeys, add pkeys support for cpuid handling

 docs/misc/xen-command-line.markdown | 21 +++++++++++
 tools/libxc/xc_cpufeature.h         |  2 +
 tools/libxc/xc_cpuid_x86.c          |  6 ++-
 xen/arch/x86/cpu/common.c           | 10 ++++-
 xen/arch/x86/hvm/hvm.c              | 34 +++++++++++++----
 xen/arch/x86/hvm/vmx/vmx.c          | 11 +++---
 xen/arch/x86/i387.c                 |  2 +-
 xen/arch/x86/mm/guest_walk.c        | 73 +++++++++++++++++++++++++++++++++++++
 xen/arch/x86/xstate.c               |  7 +++-
 xen/include/asm-x86/cpufeature.h    |  6 ++-
 xen/include/asm-x86/guest_pt.h      |  7 ++++
 xen/include/asm-x86/hvm/hvm.h       |  2 +
 xen/include/asm-x86/i387.h          |  1 +
 xen/include/asm-x86/page.h          |  5 +++
 xen/include/asm-x86/processor.h     | 20 ++++++++++
 xen/include/asm-x86/x86_64/page.h   | 12 ++++++
 xen/include/asm-x86/xstate.h        |  4 +-
 17 files changed, 203 insertions(+), 20 deletions(-)

-- 
2.4.3


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 44+ messages in thread

end of thread, other threads:[~2015-12-18 11:46 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-07  9:16 [V3 PATCH 0/9] x86/hvm: pkeys, add memory protection-key support Huaitong Han
2015-12-07  9:16 ` [V3 PATCH 1/9] x86/hvm: pkeys, add the flag to enable Memory Protection Keys Huaitong Han
2015-12-10 15:37   ` George Dunlap
2015-12-07  9:16 ` [V3 PATCH 2/9] x86/hvm: pkeys, add pkeys support when setting CR4 Huaitong Han
2015-12-07  9:16 ` [V3 PATCH 3/9] x86/hvm: pkeys, disable pkeys for guests in non-paging mode Huaitong Han
2015-12-07  9:16 ` [V3 PATCH 4/9] x86/hvm: pkeys, add functions to get pkeys value from PTE Huaitong Han
2015-12-10 15:48   ` George Dunlap
2015-12-10 18:47     ` Andrew Cooper
2015-12-07  9:16 ` [V3 PATCH 5/9] x86/hvm: pkeys, add functions to support PKRU access Huaitong Han
2015-12-10 18:48   ` Andrew Cooper
2015-12-07  9:16 ` [V3 PATCH 6/9] x86/hvm: pkeys, add xstate support for pkeys Huaitong Han
2015-12-10 17:39   ` George Dunlap
2015-12-10 18:57   ` Andrew Cooper
2015-12-11  9:36   ` Jan Beulich
2015-12-07  9:16 ` [V3 PATCH 7/9] x86/hvm: pkeys, add pkeys support for guest_walk_tables Huaitong Han
2015-12-10 18:19   ` George Dunlap
2015-12-11  9:16     ` Wu, Feng
2015-12-11  9:23       ` Jan Beulich
2015-12-16 15:36       ` George Dunlap
2015-12-16 16:28         ` Tim Deegan
2015-12-16 16:34           ` Andrew Cooper
2015-12-16 17:33             ` Tim Deegan
2015-12-16 16:50           ` George Dunlap
2015-12-16 17:21             ` Tim Deegan
2015-12-18  8:21         ` Han, Huaitong
2015-12-18 10:03           ` George Dunlap
2015-12-18 11:46           ` Tim Deegan
2015-12-11  9:23     ` Han, Huaitong
2015-12-11  9:50       ` Jan Beulich
2015-12-11  9:26     ` Jan Beulich
2015-12-15  8:14       ` Han, Huaitong
2015-12-15  9:02         ` Jan Beulich
2015-12-16  8:16           ` Han, Huaitong
2015-12-16  8:32             ` Jan Beulich
2015-12-16  9:03               ` Han, Huaitong
2015-12-16  9:12                 ` Jan Beulich
2015-12-17  9:18                   ` Han, Huaitong
2015-12-17 10:05                     ` Jan Beulich
2015-12-10 18:59   ` Andrew Cooper
2015-12-11  7:18     ` Han, Huaitong
2015-12-11  8:48       ` Andrew Cooper
2015-12-07  9:16 ` [V3 PATCH 8/9] x86/hvm: pkeys, add pkeys support for gva2gfn funcitons Huaitong Han
2015-12-07  9:16 ` [V3 PATCH 9/9] x86/hvm: pkeys, add pkeys support for cpuid handling Huaitong Han
2015-12-11  9:47   ` Jan Beulich

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.