From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" Subject: [PATCH v2 2/4] SVM: infer type in VMCB_ACCESSORS() Date: Wed, 07 Jun 2017 08:04:46 -0600 Message-ID: <5938241E02000078001606C4@prv-mh.provo.novell.com> References: <593822A3020000780016069F@prv-mh.provo.novell.com> <593822A3020000780016069F@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__PartE0D88CEE.2__=" Return-path: Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dIbZr-000515-Cj for xen-devel@lists.xenproject.org; Wed, 07 Jun 2017 14:04:51 +0000 In-Reply-To: <593822A3020000780016069F@prv-mh.provo.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" To: xen-devel Cc: Andrew Cooper , Boris Ostrovsky , Suravee Suthikulpanit List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__PartE0D88CEE.2__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Prevent accidental mistakes by not requiring explicit types to be specified in the macro invocations. Signed-off-by: Jan Beulich --- v2: Drop commented out accessors instead of adjusting them. --- unstable.orig/xen/include/asm-x86/hvm/svm/vmcb.h 2017-06-01 = 14:30:23.000000000 +0200 +++ unstable/xen/include/asm-x86/hvm/svm/vmcb.h 2017-06-01 14:31:29.0000000= 00 +0200 @@ -544,51 +544,47 @@ void svm_intercept_msr(struct vcpu *v, u * VMCB accessor functions. */ =20 -#define VMCB_ACCESSORS(_type, _name, _cleanbit) = \ -static inline void vmcb_set_##_name(struct vmcb_struct *vmcb, _type = value) \ -{ = \ - vmcb->_##_name =3D value; = \ - vmcb->cleanbits.fields._cleanbit =3D 0; = \ -} = \ -static inline _type vmcb_get_##_name(const struct vmcb_struct *vmcb) = \ -{ = \ - return vmcb->_##_name; = \ +#define VMCB_ACCESSORS(name, cleanbit) \ +static inline void \ +vmcb_set_ ## name(struct vmcb_struct *vmcb, \ + typeof(vmcb->_ ## name) value) \ +{ \ + vmcb->_ ## name =3D value; \ + vmcb->cleanbits.fields.cleanbit =3D 0; \ +} \ +static inline typeof(alloc_vmcb()->_ ## name) \ +vmcb_get_ ## name(const struct vmcb_struct *vmcb) \ +{ \ + return vmcb->_ ## name; \ } =20 -VMCB_ACCESSORS(u32, cr_intercepts, intercepts) -VMCB_ACCESSORS(u32, dr_intercepts, intercepts) -VMCB_ACCESSORS(u32, exception_intercepts, intercepts) -VMCB_ACCESSORS(u32, general1_intercepts, intercepts) -VMCB_ACCESSORS(u32, general2_intercepts, intercepts) -VMCB_ACCESSORS(u16, pause_filter_count, intercepts) -VMCB_ACCESSORS(u64, tsc_offset, intercepts) -VMCB_ACCESSORS(u64, iopm_base_pa, iopm) -VMCB_ACCESSORS(u64, msrpm_base_pa, iopm) -VMCB_ACCESSORS(u32, guest_asid, asid) -VMCB_ACCESSORS(vintr_t, vintr, tpr) -VMCB_ACCESSORS(u64, np_enable, np) -VMCB_ACCESSORS(u64, h_cr3, np) -VMCB_ACCESSORS(u64, g_pat, np) -VMCB_ACCESSORS(u64, cr0, cr) -VMCB_ACCESSORS(u64, cr3, cr) -VMCB_ACCESSORS(u64, cr4, cr) -VMCB_ACCESSORS(u64, efer, cr) -VMCB_ACCESSORS(u64, dr6, dr) -VMCB_ACCESSORS(u64, dr7, dr) -/* Updates are all via hvm_set_segment_register(). */ -/* VMCB_ACCESSORS(svm_segment_register_t, gdtr, dt) */ -/* VMCB_ACCESSORS(svm_segment_register_t, idtr, dt) */ -/* VMCB_ACCESSORS(svm_segment_register_t, cs, seg) */ -/* VMCB_ACCESSORS(svm_segment_register_t, ds, seg) */ -/* VMCB_ACCESSORS(svm_segment_register_t, es, seg) */ -/* VMCB_ACCESSORS(svm_segment_register_t, ss, seg) */ -VMCB_ACCESSORS(u8, cpl, seg) -VMCB_ACCESSORS(u64, cr2, cr2) -VMCB_ACCESSORS(u64, debugctlmsr, lbr) -VMCB_ACCESSORS(u64, lastbranchfromip, lbr) -VMCB_ACCESSORS(u64, lastbranchtoip, lbr) -VMCB_ACCESSORS(u64, lastintfromip, lbr) -VMCB_ACCESSORS(u64, lastinttoip, lbr) +VMCB_ACCESSORS(cr_intercepts, intercepts) +VMCB_ACCESSORS(dr_intercepts, intercepts) +VMCB_ACCESSORS(exception_intercepts, intercepts) +VMCB_ACCESSORS(general1_intercepts, intercepts) +VMCB_ACCESSORS(general2_intercepts, intercepts) +VMCB_ACCESSORS(pause_filter_count, intercepts) +VMCB_ACCESSORS(tsc_offset, intercepts) +VMCB_ACCESSORS(iopm_base_pa, iopm) +VMCB_ACCESSORS(msrpm_base_pa, iopm) +VMCB_ACCESSORS(guest_asid, asid) +VMCB_ACCESSORS(vintr, tpr) +VMCB_ACCESSORS(np_enable, np) +VMCB_ACCESSORS(h_cr3, np) +VMCB_ACCESSORS(g_pat, np) +VMCB_ACCESSORS(cr0, cr) +VMCB_ACCESSORS(cr3, cr) +VMCB_ACCESSORS(cr4, cr) +VMCB_ACCESSORS(efer, cr) +VMCB_ACCESSORS(dr6, dr) +VMCB_ACCESSORS(dr7, dr) +VMCB_ACCESSORS(cpl, seg) +VMCB_ACCESSORS(cr2, cr2) +VMCB_ACCESSORS(debugctlmsr, lbr) +VMCB_ACCESSORS(lastbranchfromip, lbr) +VMCB_ACCESSORS(lastbranchtoip, lbr) +VMCB_ACCESSORS(lastintfromip, lbr) +VMCB_ACCESSORS(lastinttoip, lbr) =20 #undef VMCB_ACCESSORS =20 --=__PartE0D88CEE.2__= Content-Type: text/plain; name="SVM-accessors-infer-type.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="SVM-accessors-infer-type.patch" SVM: infer type in VMCB_ACCESSORS()=0A=0APrevent accidental mistakes by = not requiring explicit types to be=0Aspecified in the macro invocations.=0A= =0ASigned-off-by: Jan Beulich =0A---=0Av2: Drop = commented out accessors instead of adjusting them.=0A=0A--- unstable.orig/x= en/include/asm-x86/hvm/svm/vmcb.h 2017-06-01 14:30:23.000000000 = +0200=0A+++ unstable/xen/include/asm-x86/hvm/svm/vmcb.h 2017-06-01 = 14:31:29.000000000 +0200=0A@@ -544,51 +544,47 @@ void svm_intercept_msr(str= uct vcpu *v, u=0A * VMCB accessor functions.=0A */=0A =0A-#define = VMCB_ACCESSORS(_type, _name, _cleanbit) = \=0A-static inline void vmcb_set_##_name(struct vmcb_struct *vmcb, _type = value) \=0A-{ = \=0A- vmcb->_##_name =3D value; = \=0A- vmcb->cleanbits.fields._cleanbit =3D 0; = \=0A-} = \=0A-static inline _type vmcb_get_##_na= me(const struct vmcb_struct *vmcb) \=0A-{ = \=0A- return vmcb->_##_n= ame; \=0A+#define = VMCB_ACCESSORS(name, cleanbit) \=0A+static inline void = \=0A+vmcb_set_ ## name(struct vmcb_struct *vmcb, = \=0A+ typeof(vmcb->_ ## name) value) \=0A+{ = \=0A+ vmcb->_ ## name =3D value; = \=0A+ vmcb->cleanbits.fields.cleanbit =3D 0; = \=0A+} \=0A+static inline = typeof(alloc_vmcb()->_ ## name) \=0A+vmcb_get_ ## name(const struct = vmcb_struct *vmcb) \=0A+{ = \=0A+ return vmcb->_ ## name; \=0A }=0A =0A-VMCB_A= CCESSORS(u32, cr_intercepts, intercepts)=0A-VMCB_ACCESSORS(u32, dr_intercep= ts, intercepts)=0A-VMCB_ACCESSORS(u32, exception_intercepts, intercepts)=0A= -VMCB_ACCESSORS(u32, general1_intercepts, intercepts)=0A-VMCB_ACCESSORS(u32= , general2_intercepts, intercepts)=0A-VMCB_ACCESSORS(u16, pause_filter_coun= t, intercepts)=0A-VMCB_ACCESSORS(u64, tsc_offset, intercepts)=0A-VMCB_ACCES= SORS(u64, iopm_base_pa, iopm)=0A-VMCB_ACCESSORS(u64, msrpm_base_pa, = iopm)=0A-VMCB_ACCESSORS(u32, guest_asid, asid)=0A-VMCB_ACCESSORS(vintr_t, = vintr, tpr)=0A-VMCB_ACCESSORS(u64, np_enable, np)=0A-VMCB_ACCESSORS(u64, = h_cr3, np)=0A-VMCB_ACCESSORS(u64, g_pat, np)=0A-VMCB_ACCESSORS(u64, cr0, = cr)=0A-VMCB_ACCESSORS(u64, cr3, cr)=0A-VMCB_ACCESSORS(u64, cr4, cr)=0A-VMCB= _ACCESSORS(u64, efer, cr)=0A-VMCB_ACCESSORS(u64, dr6, dr)=0A-VMCB_ACCESSORS= (u64, dr7, dr)=0A-/* Updates are all via hvm_set_segment_register(). = */=0A-/* VMCB_ACCESSORS(svm_segment_register_t, gdtr, dt) */=0A-/* = VMCB_ACCESSORS(svm_segment_register_t, idtr, dt) */=0A-/* VMCB_ACCESSORS(sv= m_segment_register_t, cs, seg) */=0A-/* VMCB_ACCESSORS(svm_segment_register= _t, ds, seg) */=0A-/* VMCB_ACCESSORS(svm_segment_register_t, es, seg) = */=0A-/* VMCB_ACCESSORS(svm_segment_register_t, ss, seg) */=0A-VMCB_ACCESSO= RS(u8, cpl, seg)=0A-VMCB_ACCESSORS(u64, cr2, cr2)=0A-VMCB_ACCESSORS(u64, = debugctlmsr, lbr)=0A-VMCB_ACCESSORS(u64, lastbranchfromip, lbr)=0A-VMCB_ACC= ESSORS(u64, lastbranchtoip, lbr)=0A-VMCB_ACCESSORS(u64, lastintfromip, = lbr)=0A-VMCB_ACCESSORS(u64, lastinttoip, lbr)=0A+VMCB_ACCESSORS(cr_intercep= ts, intercepts)=0A+VMCB_ACCESSORS(dr_intercepts, intercepts)=0A+VMCB_ACCESS= ORS(exception_intercepts, intercepts)=0A+VMCB_ACCESSORS(general1_intercepts= , intercepts)=0A+VMCB_ACCESSORS(general2_intercepts, intercepts)=0A+VMCB_AC= CESSORS(pause_filter_count, intercepts)=0A+VMCB_ACCESSORS(tsc_offset, = intercepts)=0A+VMCB_ACCESSORS(iopm_base_pa, iopm)=0A+VMCB_ACCESSORS(msrpm_b= ase_pa, iopm)=0A+VMCB_ACCESSORS(guest_asid, asid)=0A+VMCB_ACCESSORS(vintr, = tpr)=0A+VMCB_ACCESSORS(np_enable, np)=0A+VMCB_ACCESSORS(h_cr3, np)=0A+VMCB_= ACCESSORS(g_pat, np)=0A+VMCB_ACCESSORS(cr0, cr)=0A+VMCB_ACCESSORS(cr3, = cr)=0A+VMCB_ACCESSORS(cr4, cr)=0A+VMCB_ACCESSORS(efer, cr)=0A+VMCB_ACCESSOR= S(dr6, dr)=0A+VMCB_ACCESSORS(dr7, dr)=0A+VMCB_ACCESSORS(cpl, seg)=0A+VMCB_A= CCESSORS(cr2, cr2)=0A+VMCB_ACCESSORS(debugctlmsr, lbr)=0A+VMCB_ACCESSORS(la= stbranchfromip, lbr)=0A+VMCB_ACCESSORS(lastbranchtoip, lbr)=0A+VMCB_ACCESSO= RS(lastintfromip, lbr)=0A+VMCB_ACCESSORS(lastinttoip, lbr)=0A =0A #undef = VMCB_ACCESSORS=0A =0A --=__PartE0D88CEE.2__= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVuLm9yZwpodHRwczovL2xpc3RzLnhlbi5v cmcveGVuLWRldmVsCg== --=__PartE0D88CEE.2__=--