|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 3/5] x86/svm: Cleanup virt_ext_t type
Rearrange the union to drop the .fields infix, rename bytes to the more
common raw, adjust types where appropriate, and simplify some names.
Adjust the users accordingly.
No functional change intended.
Suggested-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Signed-off-by: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
---
xen/arch/x86/hvm/svm/nestedsvm.c | 11 +++++------
xen/arch/x86/hvm/svm/svm.c | 2 +-
xen/arch/x86/hvm/svm/vmcb.c | 2 +-
xen/arch/x86/hvm/svm/vmcb.h | 8 ++++----
4 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/xen/arch/x86/hvm/svm/nestedsvm.c b/xen/arch/x86/hvm/svm/nestedsvm.c
index 13a2144fdba4..1ef4c5c83f16 100644
--- a/xen/arch/x86/hvm/svm/nestedsvm.c
+++ b/xen/arch/x86/hvm/svm/nestedsvm.c
@@ -457,8 +457,7 @@ static int nsvm_vmcb_prepare4vmrun(struct vcpu *v, struct
cpu_user_regs *regs)
/* Pending Interrupts */
n2vmcb->event_inj = ns_vmcb->event_inj;
- n2vmcb->virt_ext.bytes =
- n1vmcb->virt_ext.bytes | ns_vmcb->virt_ext.bytes;
+ n2vmcb->virt_ext.raw = n1vmcb->virt_ext.raw | ns_vmcb->virt_ext.raw;
/* NextRIP - only evaluated on #VMEXIT. */
@@ -1556,11 +1555,11 @@ void svm_nested_features_on_efer_update(struct vcpu *v)
*/
if ( nsvm_efer_svm_enabled(v) )
{
- if ( !vmcb->virt_ext.fields.vloadsave_enable &&
+ if ( !vmcb->virt_ext.vloadsave &&
!paging_mode_shadow(v->domain) &&
cpu_has_svm_vloadsave )
{
- vmcb->virt_ext.fields.vloadsave_enable = 1;
+ vmcb->virt_ext.vloadsave = 1;
general2_intercepts = vmcb_get_general2_intercepts(vmcb);
general2_intercepts &= ~(GENERAL2_INTERCEPT_VMLOAD |
GENERAL2_INTERCEPT_VMSAVE);
@@ -1582,9 +1581,9 @@ void svm_nested_features_on_efer_update(struct vcpu *v)
}
else
{
- if ( vmcb->virt_ext.fields.vloadsave_enable )
+ if ( vmcb->virt_ext.vloadsave )
{
- vmcb->virt_ext.fields.vloadsave_enable = 0;
+ vmcb->virt_ext.vloadsave = 0;
general2_intercepts = vmcb_get_general2_intercepts(vmcb);
general2_intercepts |= (GENERAL2_INTERCEPT_VMLOAD |
GENERAL2_INTERCEPT_VMSAVE);
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 05e25764f4b3..8a7a58317d60 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -1933,7 +1933,7 @@ static int cf_check svm_msr_write_intercept(
vmcb_set_debugctlmsr(vmcb, msr_content);
if ( !msr_content || !cpu_has_svm_lbrv )
break;
- vmcb->virt_ext.fields.lbr_enable = 1;
+ vmcb->virt_ext.lbr = 1;
svm_disable_intercept_for_msr(v, MSR_IA32_DEBUGCTLMSR);
svm_disable_intercept_for_msr(v, MSR_IA32_LASTBRANCHFROMIP);
svm_disable_intercept_for_msr(v, MSR_IA32_LASTBRANCHTOIP);
diff --git a/xen/arch/x86/hvm/svm/vmcb.c b/xen/arch/x86/hvm/svm/vmcb.c
index 753f5d295064..694166bc5f39 100644
--- a/xen/arch/x86/hvm/svm/vmcb.c
+++ b/xen/arch/x86/hvm/svm/vmcb.c
@@ -291,7 +291,7 @@ void svm_vmcb_dump(const char *from, const struct
vmcb_struct *vmcb)
vmcb_get_sev(vmcb) ? " SEV" : "",
vmcb_get_sev_es(vmcb) ? " SEV_ES" : "");
printk("virtual vmload/vmsave = %d, virt_ext = %#"PRIx64"\n",
- vmcb->virt_ext.fields.vloadsave_enable, vmcb->virt_ext.bytes);
+ vmcb->virt_ext.vloadsave, vmcb->virt_ext.raw);
printk("cpl = %d efer = %#"PRIx64" star = %#"PRIx64" lstar = %#"PRIx64"\n",
vmcb_get_cpl(vmcb), vmcb_get_efer(vmcb), vmcb->star, vmcb->lstar);
printk("CR0 = 0x%016"PRIx64" CR2 = 0x%016"PRIx64"\n",
diff --git a/xen/arch/x86/hvm/svm/vmcb.h b/xen/arch/x86/hvm/svm/vmcb.h
index 2fc10caec136..34308f3b19f2 100644
--- a/xen/arch/x86/hvm/svm/vmcb.h
+++ b/xen/arch/x86/hvm/svm/vmcb.h
@@ -353,12 +353,12 @@ typedef union
typedef union
{
- u64 bytes;
struct
{
- u64 lbr_enable:1;
- u64 vloadsave_enable:1;
- } fields;
+ bool lbr:1;
+ bool vloadsave:1;
+ };
+ uint64_t raw;
} virt_ext_t;
typedef union
--
2.55.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |