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

[XTF PATCH v1 12/15] x86: isolate FEP in setup_fep()


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: dmukhin@xxxxxxxx
  • Date: Wed, 4 Nov 2026 17:38:14 -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=xYmb4BtcVfetBTbh+LvIz+mcd8Dino49KtqJpL9zxw4=; b=U1HbKLjuLJg1/i4xqdops6YuXLh/3nDbmsowG1fGKeMyFP7FGd1D49l0OWWpmiHy8n07iA14fg4aqFdkWeasPhaR7Zd9OMyge/F6czUFq1mxPyf8dw9+JSgSHx64VynYEIwtVelS5jvPCIgXX+znNCccC9pm5M7Pp/MOReYaf0XUlLJ+u9tQQJecTGeC/nIpxaSzH9NULBn5tIOst+Od06q6x4N4i02y+LVbpnNtDfqcSRGlWKcXlMhV7OmuPCKhMcSpMId6PEDN6tdM4rZZG5xVvZIpdyvi1pymP9+uXZn+r7AiTKWzEY3EG67+vHlq1M408SgcVJJ5WFrnbZ/1pQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rhilKR5HZD9M4sMjVerxM6YwqJmyvbhp+rwjrS20Lb25TxhYUsEA4uE7RrTtZM6wYPERahL7hGY57XXa96wEtq8NfeuXwaB2Q40sKZ4Z0QxIM7aYDzSSvpNIy/EBKmetHapkADmyIgi2WyNSFwmPbj/HqZuVnJxpErPqfqY/82h8m//SORMgmOATz5P1PTILVuZIE4/Ks+Ok/LvxWQBdurPS9KGXJiqjLanUTGw3TICbiVOGSNIaNQufTH3ML2n/xKj/YjyERkfkUErutKNDV2VwTsBGglMRXMo35JM2dmVcsmTsDoqu2cOqLhIA6NSYa2gTDIxa65dy7Uz0tqMqIw==
  • 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: Thu, 05 Nov 2026 01:39:06 +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.55.0




 


Rackspace

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