Skip to contentSkip to conversation

x86/vmx: __vmread() cleanup

PATCH In review [email protected] 3 participants 9 messages May 13, 2025 – May 16, 2025

lore
Share & tools
lore
#0 lore raw

v5 cover x86/vmx: __vmread() cleanup

Patch 1 is a straight replace of __vmread() with a new vmread() call. Patch 2 removes __vmread() and updates ECLAIR config; depends on patch 1.

Link to v4: https://lore.kernel.org/xen-devel/[email protected]/
Link to CI: https://gitlab.com/xen-project/people/dmukhin/xen/-/pipelines/1814196127

Denis Mukhin (2):
x86/vmx: replace __vmread() with vmread()
x86/vmx: remove __vmread()

 docs/misra/function-macro-properties.json |   9 --
 xen/arch/x86/cpu/vpmu_intel.c             |   2 +-
 xen/arch/x86/hvm/vmx/intr.c               |  12 +-
 xen/arch/x86/hvm/vmx/realmode.c           |   2 +-
 xen/arch/x86/hvm/vmx/vmcs.c               |   8 +-
 xen/arch/x86/hvm/vmx/vmx.c                | 170 +++++++++++-----------
 xen/arch/x86/hvm/vmx/vvmx.c               |  36 ++---
 xen/arch/x86/include/asm/hvm/vmx/vmx.h    |   5 -
 8 files changed, 115 insertions(+), 129 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH v5 1/2 x86/vmx: replace __vmread() with vmread()

From: Denis Mukhin <[email protected]>

Use vmread() instead of __vmread() everywhere in the VT-x code.

---
 xen/arch/x86/cpu/vpmu_intel.c   |   2 +-
 xen/arch/x86/hvm/vmx/intr.c     |  12 +--
 xen/arch/x86/hvm/vmx/realmode.c |   2 +-
 xen/arch/x86/hvm/vmx/vmcs.c     |   8 +-
 xen/arch/x86/hvm/vmx/vmx.c      | 170 ++++++++++++++++----------------
 xen/arch/x86/hvm/vmx/vvmx.c     |  36 +++----
 6 files changed, 115 insertions(+), 115 deletions(-)
xen/arch/x86/cpu/vpmu_intel.c +1 -1
index 7ce98ee42e..e358342ac9 100644
@@ -796,7 +796,7 @@ static int cf_check core2_vpmu_do_interrupt(void)
     else
     {
         /* No PMC overflow but perhaps a Trace Message interrupt. */
-        __vmread(GUEST_IA32_DEBUGCTL, &msr_content);
+        msr_content = vmread(GUEST_IA32_DEBUGCTL);
         if ( !(msr_content & IA32_DEBUGCTLMSR_TR) )
             return 0;
     }
xen/arch/x86/hvm/vmx/intr.c +6 -6
index 91b407e6bc..b622ae1e60 100644
@@ -65,7 +65,7 @@ static void vmx_enable_intr_window(struct vcpu *v, struct hvm_intack intack)
     {
         unsigned long intr;
 
-        __vmread(VM_ENTRY_INTR_INFO, &intr);
+        intr = vmread(VM_ENTRY_INTR_INFO);
         TRACE(TRC_HVM_INTR_WINDOW, intack.vector, intack.source,
               (intr & INTR_INFO_VALID_MASK) ? intr & 0xff : -1);
     }
@@ -83,7 +83,7 @@ static void vmx_enable_intr_window(struct vcpu *v, struct hvm_intack intack)
          */
         unsigned long intr_shadow;
 
-        __vmread(GUEST_INTERRUPTIBILITY_INFO, &intr_shadow);
+        intr_shadow = vmread(GUEST_INTERRUPTIBILITY_INFO);
         if ( intr_shadow & VMX_INTR_SHADOW_STI )
         {
             /* Having both STI-blocking and MOV-SS-blocking fails vmentry. */
@@ -148,7 +148,7 @@ enum hvm_intblk cf_check nvmx_intr_blocked(struct vcpu *v)
         {
             unsigned long intr_info;
 
-            __vmread(VM_ENTRY_INTR_INFO, &intr_info);
+            intr_info = vmread(VM_ENTRY_INTR_INFO);
             if ( intr_info & INTR_INFO_VALID_MASK )
                 r = hvm_intblk_rflags_ie;
         }
@@ -275,7 +275,7 @@ void asmlinkage vmx_intr_assist(void)
                 goto out;
             }
 
-            __vmread(VM_ENTRY_INTR_INFO, &intr_info);
+            intr_info = vmread(VM_ENTRY_INTR_INFO);
             if ( intr_info & INTR_INFO_VALID_MASK )
             {
                 if ( (intack.source == hvm_intsrc_pic) ||
@@ -299,7 +299,7 @@ void asmlinkage vmx_intr_assist(void)
         }
         else
         {
-            __vmread(VM_ENTRY_INTR_INFO, &intr_info);
+            intr_info = vmread(VM_ENTRY_INTR_INFO);
             if ( intr_info & INTR_INFO_VALID_MASK )
             {
                 vmx_enable_intr_window(v, intack);
@@ -377,7 +377,7 @@ void asmlinkage vmx_intr_assist(void)
         }
 
         /* we need update the RVI field */
-        __vmread(GUEST_INTR_STATUS, &status);
+        status = vmread(GUEST_INTR_STATUS);
         status &= ~VMX_GUEST_INTR_STATUS_SUBFIELD_BITMASK;
         status |= VMX_GUEST_INTR_STATUS_SUBFIELD_BITMASK &
                     intack.vector;
xen/arch/x86/hvm/vmx/realmode.c +1 -1
index ff44ddcfa6..40cbc273d0 100644
@@ -159,7 +159,7 @@ void vmx_realmode(struct cpu_user_regs *regs)
     unsigned int emulations = 0;
 
     /* Get-and-clear VM_ENTRY_INTR_INFO. */
-    __vmread(VM_ENTRY_INTR_INFO, &intr_info);
+    intr_info = vmread(VM_ENTRY_INTR_INFO);
     if ( intr_info & INTR_INFO_VALID_MASK )
         __vmwrite(VM_ENTRY_INTR_INFO, 0);
 
xen/arch/x86/hvm/vmx/vmcs.c +4 -4
index a44475ae15..f6267f65dd 100644
@@ -1031,7 +1031,7 @@ u64 virtual_vmcs_vmread(const struct vcpu *v, u32 vmcs_encoding)
     u64 res;
 
     virtual_vmcs_enter(v);
-    __vmread(vmcs_encoding, &res);
+    res = vmread(vmcs_encoding);
     virtual_vmcs_exit(v);
 
     return res;
@@ -1691,7 +1691,7 @@ void vmx_vcpu_flush_pml_buffer(struct vcpu *v)
 
     vmx_vmcs_enter(v);
 
-    __vmread(GUEST_PML_INDEX, &pml_idx);
+    pml_idx = vmread(GUEST_PML_INDEX);
 
     /* Do nothing if PML buffer is empty. */
     if ( pml_idx == (NR_PML_ENTRIES - 1) )
@@ -1876,7 +1876,7 @@ void vmx_vmentry_failure(void)
     struct vcpu *curr = current;
     unsigned long error;
 
-    __vmread(VM_INSTRUCTION_ERROR, &error);
+    error = vmread(VM_INSTRUCTION_ERROR);
     gprintk(XENLOG_ERR, "VM%s error: %#lx\n",
             curr->arch.hvm.vmx.launched ? "RESUME" : "LAUNCH", error);
 
@@ -1957,7 +1957,7 @@ void cf_check vmx_do_resume(void)
     hvm_do_resume(v);
 
     /* Sync host CR4 in case its value has changed. */
-    __vmread(HOST_CR4, &host_cr4);
+    host_cr4 = vmread(HOST_CR4);
     if ( host_cr4 != read_cr4() )
         __vmwrite(HOST_CR4, read_cr4());
 
xen/arch/x86/hvm/vmx/vmx.c +85 -85

538 lines not on this page · raw message

xen/arch/x86/hvm/vmx/vvmx.c +18 -18
index ceb5e5a322..720c86aeaf 100644
@@ -400,7 +400,7 @@ static int decode_vmx_inst(struct cpu_user_regs *regs,
     unsigned long base, index, seg_base, disp, offset;
     int scale, size;
 
-    __vmread(VMX_INSTRUCTION_INFO, &offset);
+    offset = vmread(VMX_INSTRUCTION_INFO);
     info.word = offset;
 
     if ( info.fields.memreg ) {
@@ -428,7 +428,7 @@ static int decode_vmx_inst(struct cpu_user_regs *regs,
 
         scale = 1 << info.fields.scaling;
 
-        __vmread(EXIT_QUALIFICATION, &disp);
+        disp = vmread(EXIT_QUALIFICATION);
 
         size = 1 << (info.fields.addr_size + 1);
 
@@ -997,7 +997,7 @@ static void vvmcs_to_shadow_bulk(struct vcpu *v, unsigned int n,
 
     virtual_vmcs_enter(v);
     for ( i = 0; i < n; i++ )
-        __vmread(field[i], &value[i]);
+        value[i] = vmread(field[i]);
     virtual_vmcs_exit(v);
 
     for ( i = 0; i < n; i++ )
@@ -1036,7 +1036,7 @@ static void shadow_to_vvmcs_bulk(struct vcpu *v, unsigned int n,
     }
 
     for ( i = 0; i < n; i++ )
-        __vmread(field[i], &value[i]);
+        value[i] = vmread(field[i]);
 
     virtual_vmcs_enter(v);
     for ( i = 0; i < n; i++ )
@@ -1405,7 +1405,7 @@ static void nvmx_update_apicv(struct vcpu *v)
     }
     else
        /* Keep previous SVI if there's any. */
-       __vmread(GUEST_INTR_STATUS, &status);
+       status = vmread(GUEST_INTR_STATUS);
 
     rvi = vlapic_has_pending_irq(v);
     if ( rvi != -1 )
@@ -1696,7 +1696,7 @@ static int nvmx_handle_vmresume(struct cpu_user_regs *regs)
         return X86EMUL_OKAY;        
     }
 
-    __vmread(GUEST_INTERRUPTIBILITY_INFO, &intr_shadow);
+    intr_shadow = vmread(GUEST_INTERRUPTIBILITY_INFO);
     if ( intr_shadow & VMX_INTR_SHADOW_MOV_SS )
     {
         vmfail_valid(regs, VMX_INSN_VMENTRY_BLOCKED_BY_MOV_SS);
@@ -1732,7 +1732,7 @@ static int nvmx_handle_vmlaunch(struct cpu_user_regs *regs)
         return X86EMUL_OKAY;
     }
 
-    __vmread(GUEST_INTERRUPTIBILITY_INFO, &intr_shadow);
+    intr_shadow = vmread(GUEST_INTERRUPTIBILITY_INFO);
     if ( intr_shadow & VMX_INTR_SHADOW_MOV_SS )
     {
         vmfail_valid(regs, VMX_INSN_VMENTRY_BLOCKED_BY_MOV_SS);
@@ -2355,7 +2355,7 @@ int cf_check nvmx_hap_walk_L1_p2m(
 
     vmx_vmcs_enter(v);
 
-    __vmread(EXIT_QUALIFICATION, &exit_qual);
+    exit_qual = vmread(EXIT_QUALIFICATION);
     rc = nept_translate_l2ga(v, L2_gpa, page_order, rwx_rights, &gfn, p2m_acc,
                              &exit_qual, &exit_reason);
     switch ( rc )
@@ -2391,7 +2391,7 @@ void nvmx_idtv_handling(void)
     struct nestedvcpu *nvcpu = &vcpu_nestedhvm(v);
     unsigned long idtv_info, reason;
 
-    __vmread(IDT_VECTORING_INFO, &idtv_info);
+    idtv_info = vmread(IDT_VECTORING_INFO);
     if ( likely(!(idtv_info & INTR_INFO_VALID_MASK)) )
         return;
 
@@ -2399,7 +2399,7 @@ void nvmx_idtv_handling(void)
      * If L0 can solve the fault that causes idt vectoring, it should
      * be reinjected, otherwise, pass to L1.
      */
-    __vmread(VM_EXIT_REASON, &reason);
+    reason = vmread(VM_EXIT_REASON);
     if ( (uint16_t)reason != EXIT_REASON_EPT_VIOLATION ?
          !(nvmx->intr.intr_info & INTR_INFO_VALID_MASK) :
          !nvcpu->nv_vmexit_pending )
@@ -2407,7 +2407,7 @@ void nvmx_idtv_handling(void)
         __vmwrite(VM_ENTRY_INTR_INFO, idtv_info & ~INTR_INFO_RESVD_BITS_MASK);
         if ( idtv_info & INTR_INFO_DELIVER_CODE_MASK )
         {
-            __vmread(IDT_VECTORING_ERROR_CODE, &reason);
+            reason = vmread(IDT_VECTORING_ERROR_CODE);
             __vmwrite(VM_ENTRY_EXCEPTION_ERROR_CODE, reason);
         }
         /*
@@ -2418,7 +2418,7 @@ void nvmx_idtv_handling(void)
          * This means EXIT_INSTRUCTION_LEN is always valid here, for
          * software interrupts both injected by L1, and generated in L2.
          */
-        __vmread(VM_EXIT_INSTRUCTION_LEN, &reason);
+        reason = vmread(VM_EXIT_INSTRUCTION_LEN);
         __vmwrite(VM_ENTRY_INSTRUCTION_LEN, reason);
    }
 }
@@ -2452,7 +2452,7 @@ int nvmx_n2_vmexit_handler(struct cpu_user_regs *regs,
         u64 exec_bitmap;
         int vector;
 
-        __vmread(VM_EXIT_INTR_INFO, &intr_info);
+        intr_info = vmread(VM_EXIT_INTR_INFO);
         vector = intr_info & INTR_INFO_VECTOR_MASK;
         /*
          * decided by L0 and L1 exception bitmap, if the vetor is set by
@@ -2531,7 +2531,7 @@ int nvmx_n2_vmexit_handler(struct cpu_user_regs *regs,
             unsigned long qual;
             u16 port, size;
 
-            __vmread(EXIT_QUALIFICATION, &qual);
+            qual = vmread(EXIT_QUALIFICATION);
             port = qual >> 16;
             size = (qual & 7) + 1;
             do {
@@ -2638,7 +2638,7 @@ int nvmx_n2_vmexit_handler(struct cpu_user_regs *regs,
         cr_access_qual_t qual;
         u32 mask = 0;
 
-        __vmread(EXIT_QUALIFICATION, &qual.raw);
+        qual.raw = vmread(EXIT_QUALIFICATION);
         /* also according to guest exec_control */
         ctrl = __n2_exec_control(v);
 
@@ -2680,7 +2680,7 @@ int nvmx_n2_vmexit_handler(struct cpu_user_regs *regs,
                 {
                     u64 cr0_gh_mask = get_vvmcs(v, CR0_GUEST_HOST_MASK);
 
-                    __vmread(CR0_READ_SHADOW, &old_val);
+                    old_val = vmread(CR0_READ_SHADOW);
                     changed_bits = old_val ^ val;
                     if ( changed_bits & cr0_gh_mask )
                         nvcpu->nv_vmexit_pending = 1;
@@ -2696,7 +2696,7 @@ int nvmx_n2_vmexit_handler(struct cpu_user_regs *regs,
                 {
                     u64 cr4_gh_mask = get_vvmcs(v, CR4_GUEST_HOST_MASK);
 
-                    __vmread(CR4_READ_SHADOW, &old_val);
+                    old_val = vmread(CR4_READ_SHADOW);
                     changed_bits = old_val ^ val;
                     if ( changed_bits & cr4_gh_mask )
                         nvcpu->nv_vmexit_pending = 1;
@@ -2732,7 +2732,7 @@ int nvmx_n2_vmexit_handler(struct cpu_user_regs *regs,
             {
                 u64 cr0_gh_mask = get_vvmcs(v, CR0_GUEST_HOST_MASK);
 
-                __vmread(CR0_READ_SHADOW, &old_val);
+                old_val = vmread(CR0_READ_SHADOW);
                 old_val &= X86_CR0_PE|X86_CR0_MP|X86_CR0_EM|X86_CR0_TS;
                 val = qual.lmsw_data &
                       (X86_CR0_PE|X86_CR0_MP|X86_CR0_EM|X86_CR0_TS);
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH v5 1/2] x86/vmx: replace __vmread() with vmread()

xen/arch/x86/hvm/vmx/intr.c static void vmx_enable_intr_window(struct vcpu *v, struct hvm_intack intack) · line 71

Quoted 13 lines · On 13/05/2025 6:28 am, [email protected] wrote:
xen/arch/x86/hvm/vmx/intr.c +1 -1
index 91b407e6bc..b622ae1e60 100644
@@ -65,7 +65,7 @@ static void vmx_enable_intr_window(struct vcpu *v, struct hvm_intack intack)
     {
         unsigned long intr;
 
-        __vmread(VM_ENTRY_INTR_INFO, &intr);
+        intr = vmread(VM_ENTRY_INTR_INFO);
         TRACE(TRC_HVM_INTR_WINDOW, intack.vector, intack.source,
               (intr & INTR_INFO_VALID_MASK) ? intr & 0xff : -1);
     }

As Jan said in v4, lots of these should now change away from being unsigned long.

For example, this delta alone:

xen/arch/x86/hvm/vmx/vmx.c +0 -0
index 203ca83c16e7..c540ea5bd850 100644
@@ -4154,9 +4154,8 @@ static void undo_nmis_unblocked_by_iret(void)


 void asmlinkage vmx_vmexit_handler(struct cpu_user_regs *regs) {
-    unsigned long exit_qualification, exit_reason, idtv_info, intr_info = 0;
-    unsigned long cs_ar_bytes = 0;
-    unsigned int vector = 0;
+    unsigned long exit_qualification;
+    unsigned int exit_reason, idtv_info, intr_info = 0, cs_ar_bytes = 0, vector = 0;
     struct vcpu *v = current;
     struct domain *currd = v->domain;

@@ -4830,7 +4829,7 @@ void asmlinkage vmx_vmexit_handler(struct cpu_user_regs *regs)
     /* fall through */
     default:
     exit_and_crash:
-        gprintk(XENLOG_ERR, "Unexpected vmexit: reason %lu\n", exit_reason);
+        gprintk(XENLOG_ERR, "Unexpected vmexit: reason %u\n", exit_reason);
         if ( vmx_get_cpl() ) hvm_inject_hw_exception(X86_EXC_UD,

results in:

    add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-331 (-331) Function                                     old     new   delta vmx_vmexit_handler.cold                      929     839     -90 vmx_vmexit_handler                          5490    5249    -241

worth of saving in the fastpath.  (Yes, I chose this example carefully because it's surely the largest win to be had.)

I've just sent out a minor docs patch annotating the sizes of the fields.

This patch wants splitting into at least 3:

 * One for the 64bit and natural fields which are a straight transform and no type-change away from unsigned long.
 * One for the 16bit fields (there are few enough that this can easily be a single patch).
 * One or more for the 32bit fields, doing a type change to unsigned int too.  (Might get quite large.  Hard to judge whether it wants to be one or more without seeing it.)

~Andrew

#3 lore raw

Re: [PATCH v5 1/2] x86/vmx: replace __vmread() with vmread()

Quoted 9 lines · Andrew Cooper
Quoted 8 lines · On 13/05/2025 6:28 am, [email protected] wrote:
xen/arch/x86/hvm/vmx/intr.c +0 -0
index 91b407e6bc..b622ae1e60 100644
@@ -65,7 +65,7 @@ static void vmx_enable_intr_window(struct vcpu *v, struct hvm_intack intack)
     {
         unsigned long intr;
 
Quoted 8 lines

xen/arch/x86/hvm/vmx/intr.c static void vmx_enable_intr_window(struct vcpu *v, struct hvm_intack intack) · line 71

Quoted 5 lines
xen/arch/x86/hvm/vmx/intr.c +1 -1
-        __vmread(VM_ENTRY_INTR_INFO, &intr);
+        intr = vmread(VM_ENTRY_INTR_INFO);
         TRACE(TRC_HVM_INTR_WINDOW, intack.vector, intack.source,
               (intr & INTR_INFO_VALID_MASK) ? intr & 0xff : -1);
     }

As Jan said in v4, lots of these should now change away from being unsigned long.

Sorry, I interpreted v4 feedback as "first, do straight reuse of vmread() everywhere, then send follow on smaller patches cleaning up the code around vmread()s".

Quoted 47 lines

For example, this delta alone:

xen/arch/x86/hvm/vmx/vmx.c +0 -0
index 203ca83c16e7..c540ea5bd850 100644
@@ -4154,9 +4154,8 @@ static void undo_nmis_unblocked_by_iret(void)


 void asmlinkage vmx_vmexit_handler(struct cpu_user_regs *regs) {
-    unsigned long exit_qualification, exit_reason, idtv_info, intr_info = 0;
-    unsigned long cs_ar_bytes = 0;
-    unsigned int vector = 0;
+    unsigned long exit_qualification;
+    unsigned int exit_reason, idtv_info, intr_info = 0, cs_ar_bytes = 0, vector = 0;
     struct vcpu *v = current;
     struct domain *currd = v->domain;

xen/arch/x86/hvm/vmx/vmx.c +0 -0
@@ -4830,7 +4829,7 @@ void asmlinkage vmx_vmexit_handler(struct
 cpu_user_regs *regs)
      /* fall through */

     default:
     exit_and_crash:
-        gprintk(XENLOG_ERR, "Unexpected vmexit: reason %lu\n", exit_reason);
+        gprintk(XENLOG_ERR, "Unexpected vmexit: reason %u\n", exit_reason);
         if ( vmx_get_cpl() ) hvm_inject_hw_exception(X86_EXC_UD,

results in:

    add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-331 (-331) Function                                     old     new   delta vmx_vmexit_handler.cold                      929     839     -90 vmx_vmexit_handler                          5490    5249    -241

worth of saving in the fastpath.  (Yes, I chose this example carefully because it's surely the largest win to be had.)

I've just sent out a minor docs patch annotating the sizes of the fields.

This patch wants splitting into at least 3:

Quoted 7 lines

 * One for the 64bit and natural fields which are a straight transform and no type-change away from unsigned long.
 * One for the 16bit fields (there are few enough that this can easily be a single patch).
 * One or more for the 32bit fields, doing a type change to unsigned int too.  (Might get quite large.  Hard to judge whether it wants to be one or more without seeing it.)

Thanks for the feedback!

Quoted 2 lines

~Andrew

#4 lore raw

PATCH v5 2/2 x86/vmx: remove __vmread()

In reply to [email protected]

From: Denis Mukhin <[email protected]>

Remove __vmread() and adjust ECLAIR configuration to account for the change.

---
 docs/misra/function-macro-properties.json | 9 ---------
 xen/arch/x86/include/asm/hvm/vmx/vmx.h    | 5 -----
 2 files changed, 14 deletions(-)
docs/misra/function-macro-properties.json +0 -9
index 74058297b5..59ba63626e 100644
@@ -152,15 +152,6 @@
             "taken": ""
          }
       },
-      {
-         "type": "function",
-         "value": "^__vmread.*$",
-         "properties":{
-            "pointee_write": "2=always",
-            "pointee_read": "2=never",
-            "taken": ""
-         }
-      },
       {
          "type": "function",
          "value": "^hvm_pci_decode_addr.*$",
xen/arch/x86/include/asm/hvm/vmx/vmx.h +0 -5
index d85b52b9d5..299e2eff6b 100644
@@ -336,11 +336,6 @@ static always_inline unsigned long vmread(unsigned long field)
     return value;
 }
 
-static always_inline void __vmread(unsigned long field, unsigned long *value)
-{
-    *value = vmread(field);
-}
-
 static always_inline void __vmwrite(unsigned long field, unsigned long value)
 {
     asm goto ( "vmwrite %[value], %[field]\n\t"
Signature · 1 line
2.34.1
#5 lore raw

[PING MISRA] Re: [PATCH v5 2/2] x86/vmx: remove __vmread()

Hello,

This is adjusting some MISRA configuration.  I'm reasonably sure the change is fine as we're simply removing the referenced helper, but can we get a second opinion from anyone who knows what function-macro-properties.json is supposed to be doing?

Thanks,

~Andrew

Quoted 46 lines · On 13/05/2025 6:28 am, [email protected] wrote:

From: Denis Mukhin <[email protected]>

Remove __vmread() and adjust ECLAIR configuration to account for the change.

---
 docs/misra/function-macro-properties.json | 9 ---------
 xen/arch/x86/include/asm/hvm/vmx/vmx.h    | 5 -----
 2 files changed, 14 deletions(-)
docs/misra/function-macro-properties.json +0 -9
index 74058297b5..59ba63626e 100644
@@ -152,15 +152,6 @@
             "taken": ""
          }
       },
-      {
-         "type": "function",
-         "value": "^__vmread.*$",
-         "properties":{
-            "pointee_write": "2=always",
-            "pointee_read": "2=never",
-            "taken": ""
-         }
-      },
       {
          "type": "function",
          "value": "^hvm_pci_decode_addr.*$",
xen/arch/x86/include/asm/hvm/vmx/vmx.h +0 -5
index d85b52b9d5..299e2eff6b 100644
@@ -336,11 +336,6 @@ static always_inline unsigned long vmread(unsigned long field)
     return value;
 }
 
-static always_inline void __vmread(unsigned long field, unsigned long *value)
-{
-    *value = vmread(field);
-}
-
 static always_inline void __vmwrite(unsigned long field, unsigned long value)
 {
     asm goto ( "vmwrite %[value], %[field]\n\t"
Reviewed-by
#6 lore raw

Re: [PING MISRA] Re: [PATCH v5 2/2] x86/vmx: remove __vmread()

Quoted 11 lines · Andrew Cooper

Hello,

This is adjusting some MISRA configuration.  I'm reasonably sure the change is fine as we're simply removing the referenced helper, but can we get a second opinion from anyone who knows what function-macro-properties.json is supposed to be doing?

Thanks,

~Andrew

Hi Andrew,

sorry, it slipped under other emails. The change is ok.

Quoted 6 lines · On 13/05/2025 6:28 am, [email protected] wrote:
Quoted 5 lines

From: Denis Mukhin <[email protected]>

Remove __vmread() and adjust ECLAIR configuration to account for the change.

Quoted 44 lines
Quoted 44 lines
---
 docs/misra/function-macro-properties.json | 9 ---------
 xen/arch/x86/include/asm/hvm/vmx/vmx.h    | 5 -----
 2 files changed, 14 deletions(-)
docs/misra/function-macro-properties.json +0 -9
index 74058297b5..59ba63626e 100644
@@ -152,15 +152,6 @@
             "taken": ""
          }
       },
-      {
-         "type": "function",
-         "value": "^__vmread.*$",
-         "properties":{
-            "pointee_write": "2=always",
-            "pointee_read": "2=never",
-            "taken": ""
-         }
-      },
       {
          "type": "function",
          "value": "^hvm_pci_decode_addr.*$",
xen/arch/x86/include/asm/hvm/vmx/vmx.h +0 -5
index d85b52b9d5..299e2eff6b 100644
@@ -336,11 +336,6 @@ static always_inline unsigned long 
 vmread(unsigned long field)
     return value;
 }
 
-static always_inline void __vmread(unsigned long field, unsigned long 
 *value)
-{
-    *value = vmread(field);
-}
-
 static always_inline void __vmwrite(unsigned long field, unsigned 

long value)

 {
     asm goto ( "vmwrite %[value], %[field]\n\t"
Signature · 4 lines
Nicola Vetrini, B.Sc.
Software Engineer
BUGSENG (https://bugseng.com)
LinkedIn: https://www.linkedin.com/in/nicola-vetrini-a42471253
#7 lore raw

Re: [PING MISRA] Re: [PATCH v5 2/2] x86/vmx: remove __vmread()

Quoted 8 lines · Nicola Vetrini
Quoted 7 lines · Andrew Cooper

Hello,

This is adjusting some MISRA configuration.  I'm reasonably sure the change is fine as we're simply removing the referenced helper, but can we get a second opinion from anyone who knows what function-macro-properties.json is supposed to be doing?

Quoted 8 lines
Quoted 4 lines

Thanks,

~Andrew

Hi Andrew,

sorry, it slipped under other emails. The change is ok.

No worries.  These things happen.

Quoted 10 lines
Quoted 8 lines · On 13/05/2025 6:28 am, [email protected] wrote:
Quoted 6 lines

From: Denis Mukhin <[email protected]>

Remove __vmread() and adjust ECLAIR configuration to account for the change.

Thankyou.

~Andrew

#8 lore raw

Re: [PING MISRA] Re: [PATCH v5 2/2] x86/vmx: remove __vmread()

In reply to Nicola Vetrini
Quoted 18 lines · Nicola Vetrini
Quoted 11 lines · Andrew Cooper

Hello,

This is adjusting some MISRA configuration.  I'm reasonably sure the change is fine as we're simply removing the referenced helper, but can we get a second opinion from anyone who knows what function-macro-properties.json is supposed to be doing?

Thanks,

~Andrew

Hi Andrew,

sorry, it slipped under other emails. The change is ok.

Quoted 1 line · On 13/05/2025 6:28 am, [email protected] wrote:
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines

From: Denis Mukhin <[email protected]>

Remove __vmread() and adjust ECLAIR configuration to account for the change.

Thank you

Quoted 53 lines
Quoted 37 lines
Quoted 37 lines
---
 docs/misra/function-macro-properties.json | 9 ---------
 xen/arch/x86/include/asm/hvm/vmx/vmx.h    | 5 -----
 2 files changed, 14 deletions(-)
docs/misra/function-macro-properties.json +0 -9
index 74058297b5..59ba63626e 100644
@@ -152,15 +152,6 @@
             "taken": ""
          }
       },
-      {
-         "type": "function",
-         "value": "^__vmread.*$",
-         "properties":{
-            "pointee_write": "2=always",
-            "pointee_read": "2=never",
-            "taken": ""
-         }
-      },
       {
          "type": "function",
          "value": "^hvm_pci_decode_addr.*$",
xen/arch/x86/include/asm/hvm/vmx/vmx.h +0 -0
index d85b52b9d5..299e2eff6b 100644
@@ -336,11 +336,6 @@ static always_inline unsigned long
 vmread(unsigned long field)
     return value;
 }
 
Quoted 10 lines
Quoted 10 lines
xen/arch/x86/include/asm/hvm/vmx/vmx.h +0 -5
-static always_inline void __vmread(unsigned long field, unsigned long
 *value)
-{
-    *value = vmread(field);
-}
-
 static always_inline void __vmwrite(unsigned long field, unsigned

long value)

 {
     asm goto ( "vmwrite %[value], %[field]\n\t"

--
Nicola Vetrini, B.Sc.
Software Engineer
BUGSENG (https://bugseng.com)
LinkedIn: https://www.linkedin.com/in/nicola-vetrini-a42471253