|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [XTF PATCH v1 3/6] x86: isolate FEP in setup_fep()
On Wed, 11 Nov 2026, dmukhin@xxxxxxxx wrote:
> 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();
> }
The FEP skip now happens in arch_setup(), before the banner, and
xtf_main() still calls test_setup() unconditionally. So a test that
needs FEP and has its own test_setup() runs that setup even after it's
been skipped. If that setup fails, the SKIP turns into FAILURE.
Maybe we should guard test_setup() with !xtf_status_reported()
> 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
>
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |