diff options
| author | Juergen Gross <jgross@suse.com> | 2025-08-26 16:56:06 +0200 |
|---|---|---|
| committer | Juergen Gross <jgross@suse.com> | 2025-09-08 17:01:36 +0200 |
| commit | 34c605fe53d49886d2741223b12950a33bdf2acf (patch) | |
| tree | 2b575fbe8f5be414ea97866d39cc7cfd2aa4b95f /include/xen | |
| parent | 76eeb9b8de9880ca38696b2fb56ac45ac0a25c6c (diff) | |
xen: rework xen_pv_domain()
Rework xen_pv_domain() to no longer use the xen_domain_type variable,
but the artificial X86_FEATURE_XENPV cpu feature.
On non-x86 architectures xen_pv_domain() can be defined as "0".
This has the advantage that a kernel not built with CONFIG_XEN_PV
will be smaller due to dead code elimination.
Set the X86_FEATURE_XENPV feature very early, as xen_pv_domain() is
used rather early, too.
Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Message-ID: <20250826145608.10352-2-jgross@suse.com>
Diffstat (limited to 'include/xen')
| -rw-r--r-- | include/xen/xen.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/include/xen/xen.h b/include/xen/xen.h index a1e5b3f18d69..61854e3f2837 100644 --- a/include/xen/xen.h +++ b/include/xen/xen.h @@ -22,8 +22,15 @@ extern bool xen_pvh; #define xen_pvh 0 #endif +#ifdef CONFIG_X86 +#include <asm/cpufeature.h> + +#define xen_pv_domain() (cpu_feature_enabled(X86_FEATURE_XENPV)) +#else +#define xen_pv_domain() 0 +#endif + #define xen_domain() (xen_domain_type != XEN_NATIVE) -#define xen_pv_domain() (xen_domain_type == XEN_PV_DOMAIN) #define xen_hvm_domain() (xen_domain_type == XEN_HVM_DOMAIN) #define xen_pvh_domain() (xen_pvh) |
