[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC PATCH 1/2] x86emul: mark the trimmed emulator's section-internal labels maybe-unused


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Shuaidong Chen <shuaidong.chen@xxxxxxx>
  • Date: Tue, 10 Nov 2026 15:12:30 +0800
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Pdl88cKj8eE4YyVdxLsTs8gNxyGygoBD5SWqFeWofUM=; b=ZaT4AOhC84f5kRRuYc7QyUryQgOH2Slj5HRpT9N5sAaYUZ0zCAFmWOLO+NBcyA4/U19zmhfb9HSZB0nVKU7LtHlI4uX0ZDenaWzAHGSE+OZjJ+q8dNAGZZ/mXNdgMPIS7PvorCDTVgPZYzw9OYO/jJD8gOARkpGdz4AOkrmItzzINpzuRjfQH6SW356OM9YzAUW2exrSzgXHtYorswUOQ2AVIwyr7wN8rnLAb1j6MRqn5gQthoUlE9QHsb2YqPCtBETKhJ2YR4ob/lRZ+A1dbxxl27uZG3Vww1Zn1y3v4V37/0aX3JOSWFYlXeX6S0L+ApsIHPeA6ujqUpWt3TcYhQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SGP7wDfWA/kMLYjURGFPR1C6X56HgSr99gBJOG3kRgAbHXPFSPBOYbxtbgRzd3Bbsrw+zDSdwS3KB+vV+G9E/om8UtBxRLCkatojh8m3D4sWBjm+87uTh+aeSZPT2ImMD3Noklp1FgNB5UyiXBFBO145lAnkD/1/KUGtQZhKZ+wuFAkBBCg8SDnfi4M4ke8mJwDiMyPX7TVOh0DLlgeVRDZN22wR5Dynusmyqg8gTwCzoMkwab2lrYwyZgXtizowW/fRYUIpaVmhO6UhcySzUBBPMtjUPxDvlTFTqv0/3sC0PtZlBfNga0Mil9PzukVXzeBkMeUqJ3VhuhjoXy8+dA==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=amd.com header.i="@amd.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Cc: Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger@xxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, "Nicola Vetrini" <nicola.vetrini@xxxxxxxxxxx>, Doug Goldstein <cardoe@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Julien Grall <julien@xxxxxxx>, "Anthony PERARD" <anthony.perard@xxxxxxxxxx>, Teddy Astie <teddy.astie@xxxxxxxxxx>, Dmytro Prokopchuk <dmytro_prokopchuk1@xxxxxxxx>, Grygorii Strashko <grygorii_strashko@xxxxxxxx>, Penny Zheng <penny.zheng@xxxxxxx>, Ray Huang <Ray.Huang@xxxxxxx>, Shuaidong Chen <shuaidong.chen@xxxxxxx>
  • Delivery-date: Tue, 10 Nov 2026 07:13:24 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

In builds where the FPU, MMX and SIMD sections of the emulator are
compiled out - with CONFIG_HVM=n, private.h defines X86EMUL_NO_FPU,
X86EMUL_NO_MMX and X86EMUL_NO_SIMD - every `goto' targeting
simd_0f_fp, simd_0f_xmm, simd_0f_ymm, simd_0f_cvt, simd_0f_mmx,
simd_0f_imm8_avx2, simd_0f_imm8_ymm, simd_0f38_common and
simd_0f3a_common is preprocessed out, while the labels themselves
stay.  They are unused by construction, which the build already
acknowledges by passing -Wno-unused-label for this translation unit.

Say it on the labels as well, the way the rest of the tree does
(unimplemented_insn here, done in blk.c).  That also clears the reports
MISRA C:2012 Rule 2.6 (advisory) - "A function should not contain unused
label declarations" - raises against them, with no new deviation:
docs/misra/deviations.rst already recognises __maybe_unused as the way
to express this.

No functional change.

Signed-off-by: Shuaidong Chen <shuaidong.chen@xxxxxxx>
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c 
b/xen/arch/x86/x86_emulate/x86_emulate.c
index f168f3ebcf..8bafe6b308 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -3406,7 +3406,7 @@ x86_emulate(
                                            /* vdiv{p,s}{s,d} 
{x,y}mm/mem,{x,y}mm,{x,y}mm */
     CASE_SIMD_ALL_FP_VEX(0x0f, 0x5f):      /* max{p,s}{s,d} xmm/mem,xmm */
                                            /* vmax{p,s}{s,d} 
{x,y}mm/mem,{x,y}mm,{x,y}mm */
-    simd_0f_fp:
+    simd_0f_fp: __maybe_unused;
         if ( vex.opcx == vex_none )
         {
             if ( vex.pfx & VEX_PREFIX_DOUBLE_MASK )
@@ -3416,7 +3416,7 @@ x86_emulate(
             }
             else
                 vcpu_must_have(sse);
-    simd_0f_xmm:
+    simd_0f_xmm: __maybe_unused;
             get_fpu(X86EMUL_FPU_xmm);
         }
         else
@@ -3426,7 +3426,7 @@ x86_emulate(
                 d |= TwoOp;
     simd_0f_avx:
             vcpu_must_have(avx);
-    simd_0f_ymm:
+    simd_0f_ymm: __maybe_unused;
             get_fpu(X86EMUL_FPU_ymm);
         }
     simd_0f_common:
@@ -4147,7 +4147,7 @@ x86_emulate(
                                            /* vcvts{s,d}2s{s,d} 
xmm/mem,xmm,xmm */
         op_bytes = 4 << (((vex.pfx & VEX_PREFIX_SCALAR_MASK) ? 0 : 1 + vex.l) +
                          !!(vex.pfx & VEX_PREFIX_DOUBLE_MASK));
-    simd_0f_cvt:
+    simd_0f_cvt: __maybe_unused;
         if ( vex.opcx == vex_none )
             goto simd_0f_sse2;
         goto simd_0f_avx;
@@ -4354,7 +4354,7 @@ x86_emulate(
         if ( vex.pfx )
             goto simd_0f_sse2;
 #endif /* !X86EMUL_NO_SIMD */
-    simd_0f_mmx:
+    simd_0f_mmx: __maybe_unused;
         vcpu_must_have(mmx);
         get_fpu(X86EMUL_FPU_mmx);
         goto simd_0f_common;
@@ -4607,7 +4607,7 @@ x86_emulate(
 #endif
             if ( vex.l )
             {
-    simd_0f_imm8_avx2:
+    simd_0f_imm8_avx2: __maybe_unused;
                 vcpu_must_have(avx2);
             }
             else
@@ -4624,7 +4624,7 @@ x86_emulate(
     simd_0f_imm8_avx:
                 vcpu_must_have(avx);
             }
-    simd_0f_imm8_ymm:
+    simd_0f_imm8_ymm: __maybe_unused;
             get_fpu(X86EMUL_FPU_ymm);
         }
         else if ( vex.pfx )
@@ -5683,7 +5683,7 @@ x86_emulate(
         vcpu_must_have(ssse3);
         if ( vex.pfx )
         {
-    simd_0f38_common:
+    simd_0f38_common: __maybe_unused;
             get_fpu(X86EMUL_FPU_xmm);
         }
         else
@@ -7206,7 +7206,7 @@ x86_emulate(
         vcpu_must_have(ssse3);
         if ( vex.pfx )
         {
-    simd_0f3a_common:
+    simd_0f3a_common: __maybe_unused;
             get_fpu(X86EMUL_FPU_xmm);
         }
         else
-- 
2.34.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.