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

[XTF PATCH v1 3/6] x86: isolate FEP in setup_fep()


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: dmukhin@xxxxxxxx
  • Date: Wed, 11 Nov 2026 11:51:06 -0800
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 205.220.161.53) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=ford.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ford.com; dkim=pass (signature was verified) header.d=saarlouis.ford.com; dkim=pass (signature was verified) header.d=ford.com; 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=Wp4pgvmicn5rS7W+LOf218M2zwWa7DzUvgtz3aMSVfk=; b=BwpH5Kf6qz1oAeQffhrO+XTsHQdBxZ0d6jDoJO4MsF6yrS2o9CkD18npnVX9EBpy+i4RAeaikUi7jZjIcXFLO0JlcXqHy2qjQhRWJXqpaLuVn1ZqnGkApiPLqCMdfMcVVWIZkMtJV6JrHeA3brldoLACfG6tETrl0QA/fcbtW6/2pAelQ+BfJ91RZm9uEVePpgROi75cH1bpB3p2DPlaoTdjTXxUtaRRon50EVBKY6DkGCO05qEbqvZDm41+VtsU1rw9wjHg2eSMrd0nEMPyticxr4uLe6skm+dVs/JnO7BNLLeIdW1lrLWfZBM+xQMb4ZctItf5TECil/MnxPtx0w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CIUhJIFdQ47WMONhCGCuZMxMvoZOKhwS6OSai/35uCgIQC3rJvjAlrSsddrL574Ak2iKt+XzU7DW6EAhPVkhC93mlZO8O2YmAl0kkk/v5QFbWWPVaEWsvKFTe41WB9mHPm0FycSSlo7pecEEBIvVm583r9OwmaVMjYNSKuSvRMrxmIjNKmgtCludImyZ/F6ASb4JfH++H/TUx7hnfk1CLczPJLmGnNaCdtfolWnD8O0ynAQucvg5wNEjdqT0crCiPU3V8ZSpLG7Btiaqe3CEFcE5MdRS7bWD4Y6zLq+g7wFe9ZWmI0B74LcaPDfPIlDOvSx+p5RODYyoT0Sf22fFGQ==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=ppford header.d=ford.com header.i="@ford.com" header.h="Cc:Content-Transfer-Encoding:Content-Type:Date:From:In-Reply-To:Message-ID:MIME-Version:References:Subject:To"; dkim=pass header.s=selector2-azureford-onmicrosoft-com header.d=azureford.onmicrosoft.com header.i="@azureford.onmicrosoft.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"; dkim=pass header.s=ppserprodsaar header.d=saarlouis.ford.com header.i="@saarlouis.ford.com" header.h="Cc:Content-Transfer-Encoding:Date:From:In-Reply-To:Message-ID:MIME-Version:References:Subject:To"; dkim=pass header.s=ppfserpocford header.d=ford.com header.i="@ford.com" header.h="Cc:Content-Transfer-Encoding:Date:From:In-Reply-To:Message-ID:MIME-Version:References:Subject:To"
  • Cc: andrew.cooper3@xxxxxxxxxx, anthony.perard@xxxxxxxxxx, jbeulich@xxxxxxxx, julien@xxxxxxx, michal.orzel@xxxxxxx, roger@xxxxxxxxxxxxxx, sstabellini@xxxxxxxxxx, dmukhin@xxxxxxx, Denis Mukhin <dmukhin@xxxxxxxx>
  • Delivery-date: Wed, 11 Nov 2026 19:51:40 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Pser-m365-app: SER-APP

From: Denis Mukhin <dmukhin@xxxxxxxx>

Keep weak symbol test_setup() for per-test definition.

Isolate FEP into a new setup_fep() call which is executed on a common x86
path.

Signed-off-by: Denis Mukhin <dmukhin@xxxxxxxx>
---
 arch/x86/setup.c | 80 +++++++++++++++++++++++++-----------------------
 1 file changed, 41 insertions(+), 39 deletions(-)

diff --git a/arch/x86/setup.c b/arch/x86/setup.c
index ba6f9c320843..8fea6495de1c 100644
--- a/arch/x86/setup.c
+++ b/arch/x86/setup.c
@@ -253,6 +253,45 @@ static void xen_console_write(const char *buf, size_t len)
     hypercall_console_write(buf, len);
 }
 
+/*
+ * Common test setup:
+ *
+ * xtf_has_* indicates the availabiliy of options which require runtime
+ * detection.
+ */
+bool xtf_has_fep = false;
+
+/*
+ * Default weak settings.
+ *
+ * test_wants_* indicates default settings for the framework, which may be
+ * overridden by individual tests by providing non-weak variables.
+ *
+ * test_needs_* indicates options required by the test, without which the test
+ * isn't worth running.
+ */
+bool __weak test_needs_fep = false;
+
+static void setup_fep(void)
+{
+    /*
+     * Attempt to use the forced emulation prefix to set the value of
+     * xtf_has_fep to the value of 1.  Use the exception table to compensate
+     * for the #UD exception if FEP is not available.
+     */
+    asm volatile ("1:" _ASM_XEN_FEP "mov $1, %[fep];"
+                  "2:"
+                  _ASM_EXTABLE(1b, 2b)
+                  : [fep] "=q" (xtf_has_fep)
+                  : "0" (false));
+
+    if ( test_needs_fep && !xtf_has_fep )
+    {
+        printk("FEP unavailable, but needed by test. (Is Xen support\n");
+        return xtf_skip("compiled in, and booted with 'hvm_fep'?)\n");
+    }
+}
+
 void arch_setup(void)
 {
     if ( IS_DEFINED(CONFIG_HVM) && !pvh_start_info )
@@ -275,6 +314,8 @@ void arch_setup(void)
     }
 
     map_shared_info();
+
+    setup_fep();
 }
 
 int arch_get_domid(void)
@@ -293,45 +334,6 @@ int arch_get_domid(void)
     return -1;
 }
 
-/*
- * Common test setup:
- *
- * xtf_has_* indicates the availabiliy of options which require runtime
- * detection.
- */
-bool xtf_has_fep = false;
-
-/*
- * Default weak settings.
- *
- * test_wants_* indicates default settings for the framework, which may be
- * overridden by individual tests by providing non-weak variables.
- *
- * test_needs_* indicates options required by the test, without which the test
- * isn't worth running.
- */
-bool __weak test_needs_fep = false;
-
-void test_setup(void)
-{
-    /*
-     * Attempt to use the forced emulation prefix to set the value of
-     * xtf_has_fep to the value of 1.  Use the exception table to compensate
-     * for the #UD exception if FEP is not available.
-     */
-    asm volatile ("1:" _ASM_XEN_FEP "mov $1, %[fep];"
-                  "2:"
-                  _ASM_EXTABLE(1b, 2b)
-                  : [fep] "=q" (xtf_has_fep)
-                  : "0" (false));
-
-    if ( test_needs_fep && !xtf_has_fep )
-    {
-        printk("FEP unavailable, but needed by test. (Is Xen support\n");
-        return xtf_skip("compiled in, and booted with 'hvm_fep'?)\n");
-    }
-}
-
 /*
  * Local variables:
  * mode: C
-- 
2.56.0




 


Rackspace

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