|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v4 27/30] x86/svm: restore guest debug registers in svm_do_resume()
svm_ctxt_switch_to() restores the guest's debug registers when its DR7
enables any of them, which also updates the VMCB. Do it in
svm_do_resume() instead, which follows it whenever the vCPU is
scheduled in.
svm_do_resume() also runs when a vCPU keeps running on its pCPU
(continue_running()), without svm_ctxt_switch_to(). Where the guest's
debug registers are already loaded, the restore does nothing:
flag_dr_dirty records that they are, and only svm_save_dr() clears it,
from svm_ctxt_switch_from().
This prepares for moving VMCBs off always-mapped memory:
svm_ctxt_switch_to() runs before write_ptbase(), where the incoming
vCPU's VMCB will not be mapped.
Not yet run with a guest using debug registers.
Assisted-by: Claude Code:claude-fable-5, Claude Code:claude-opus-5-5
Signed-off-by: George Dunlap <gwd@xxxxxxxxxxxxxx>
---
Changes in v4:
- New in this version.
---
xen/arch/x86/hvm/svm/svm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 4e19df9865..3de8da7ea3 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -955,8 +955,6 @@ static void cf_check svm_ctxt_switch_to(struct vcpu *v)
*/
disable_each_ist(per_cpu(idt, cpu));
- svm_restore_dr(v);
-
svm_tsc_ratio_load(v);
if ( cpu_has_msr_tsc_aux )
@@ -980,6 +978,8 @@ static void noreturn cf_check svm_do_resume(void)
bool vcpu_guestmode = false;
struct vlapic *vlapic = vcpu_vlapic(v);
+ svm_restore_dr(v);
+
if ( nestedhvm_enabled(v->domain) && nestedhvm_vcpu_in_guestmode(v) )
vcpu_guestmode = 1;
--
2.55.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |