[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH RFC 04/14] xen: vmx: Introduce SPP-Induced vm exit and it's handle.
From: Zhang Yi Z <yi.z.zhang@xxxxxxxxxxxxxxx> Accesses using guest-physical addresses may cause SPP-induced VM exits due to an SPPT misconfiguration or an SPPT miss. The basic VM exit reason code reported for SPP-induced VM exits is 66. An SPPT misconfiguration VM exit occurs when, in the course of translating a guest-physical address, the logical processor encounters a leaf EPT paging-structure entry mapping a 4KB page for which the sub-page write permission control bit is set and during the SPPT lookup an SPPT paging-structure entry contains an unsupported value. An SPPT miss VM exit occurs when, in the course of translation a guest-physical address, the logical processor encounters a leaf EPT paging-structure entry for which the sub-page write permission control bit is set and during the SPPT lookup there is no SPPT misconfiguration but any level of SPPT paging-structure entries are not-present. Also Introduced the new exit qualification for SPPT-induced vmexits. | Bit | Contents | | :---- | :---------------------------------------------------------------- | | 10:0 | Reserved (0). | | 11 | SPPT VM exit type. Set for SPPT Miss, cleared for SPPT Misconfig. | | 12 | NMI unblocking due to IRET | | 63:13 | Reserved (0) | Signed-off-by: Zhang Yi Z <yi.z.zhang@xxxxxxxxxxxxxxx> --- xen/arch/x86/hvm/vmx/vmx.c | 31 +++++++++++++++++++++++++++++++ xen/include/asm-x86/hvm/vmx/vmx.h | 11 +++++++++++ 2 files changed, 42 insertions(+) diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index 69ce3aa..04ae0d6 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -3521,6 +3521,28 @@ static int vmx_handle_apic_write(void) return vlapic_apicv_write(current, exit_qualification & 0xfff); } +static int vmx_handle_spp(spp_qual_t q, paddr_t gpa) +{ + if ( q.sppt_miss_type ) + { + /* + * SPPT Miss : + * Subpage Protection Table not present + */ + printk("SPP miss occured at gpa:%lx\n", gpa); + + return true; + } + + /* + * SPPT Misconfig + * This is probably possible that your sppt table + * set as a incorrect format + */ + WARN_ON(1); + return false; +} + void vmx_vmexit_handler(struct cpu_user_regs *regs) { unsigned long exit_qualification, exit_reason, idtv_info, intr_info = 0; @@ -4124,6 +4146,15 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs) case EXIT_REASON_ACCESS_LDTR_OR_TR: vmx_handle_descriptor_access(exit_reason); break; + case EXIT_REASON_SPP: + { + paddr_t gpa; + + __vmread(GUEST_PHYSICAL_ADDRESS, &gpa); + __vmread(EXIT_QUALIFICATION, &exit_qualification); + vmx_handle_spp(exit_qualification, gpa); + break; + } case EXIT_REASON_VMX_PREEMPTION_TIMER_EXPIRED: case EXIT_REASON_INVPCID: diff --git a/xen/include/asm-x86/hvm/vmx/vmx.h b/xen/include/asm-x86/hvm/vmx/vmx.h index 4889a64..35aada6 100644 --- a/xen/include/asm-x86/hvm/vmx/vmx.h +++ b/xen/include/asm-x86/hvm/vmx/vmx.h @@ -213,6 +213,7 @@ static inline void pi_clear_sn(struct pi_desc *pi_desc) #define EXIT_REASON_PML_FULL 62 #define EXIT_REASON_XSAVES 63 #define EXIT_REASON_XRSTORS 64 +#define EXIT_REASON_SPP 66 /* * Interruption-information format @@ -616,6 +617,16 @@ typedef union ept_qual { }; } __transparent__ ept_qual_t; +/* SPP induced vmexit qualifications definitions */ +typedef union spp_qual { + unsigned long raw; + struct { + unsigned long reserved :11; + bool sppt_miss_type :1; + unsigned long reserved2 :52; + }; +} __transparent__ spp_qual_t; + #define EPT_L4_PAGETABLE_SHIFT 39 #define EPT_PAGETABLE_ENTRIES 512 -- 2.7.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |