[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2 14/17] xen: x86: reset EPC when guest got suspended.
From: Kai Huang <kai.huang@xxxxxxxxxxxxxxx> EPC is destroyed when power state goes to S3-S5. Emulate this behavior. A new function s3_suspend is added to hvm_function_table for this purpose. Signed-off-by: Kai Huang <kai.huang@xxxxxxxxxxxxxxx> --- xen/arch/x86/hvm/hvm.c | 3 +++ xen/arch/x86/hvm/vmx/vmx.c | 7 +++++++ xen/include/asm-x86/hvm/hvm.h | 3 +++ 3 files changed, 13 insertions(+) diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index c5e8467f3219..053c15afc46a 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -3952,6 +3952,9 @@ static void hvm_s3_suspend(struct domain *d) hvm_vcpu_reset_state(d->vcpu[0], 0xf000, 0xfff0); + if ( hvm_funcs.s3_suspend ) + hvm_funcs.s3_suspend(d); + domain_unlock(d); } diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index 280fc82ca1ff..17190b06a421 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -2307,6 +2307,12 @@ static bool vmx_get_pending_event(struct vcpu *v, struct x86_event *info) return true; } +static void vmx_s3_suspend(struct domain *d) +{ + if ( d->arch.cpuid->feat.sgx ) + domain_reset_epc(d, false); +} + static struct hvm_function_table __initdata vmx_function_table = { .name = "VMX", .cpu_up_prepare = vmx_cpu_up_prepare, @@ -2378,6 +2384,7 @@ static struct hvm_function_table __initdata vmx_function_table = { .max_ratio = VMX_TSC_MULTIPLIER_MAX, .setup = vmx_setup_tsc_scaling, }, + .s3_suspend = vmx_s3_suspend, }; /* Handle VT-d posted-interrupt when VCPU is blocked. */ diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h index 6ecad3331695..d9ff98a1b0ed 100644 --- a/xen/include/asm-x86/hvm/hvm.h +++ b/xen/include/asm-x86/hvm/hvm.h @@ -227,6 +227,9 @@ struct hvm_function_table { /* Architecture function to setup TSC scaling ratio */ void (*setup)(struct vcpu *v); } tsc_scaling; + + /* Domain S3 suspend */ + void (*s3_suspend)(struct domain *d); }; extern struct hvm_function_table hvm_funcs; -- 2.15.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |