xen/arch/x86/hvm/nestedhvm.c | 7 ------- xen/arch/x86/include/asm/hvm/nestedhvm.h | 6 +++++- 2 files changed, 5 insertions(+), 8 deletions(-)
This function just returns vcpu_nestedhvm(v).nv_guestmode and would
be better inlined to improve codegen.
Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
---
xen/arch/x86/hvm/nestedhvm.c | 7 -------
xen/arch/x86/include/asm/hvm/nestedhvm.h | 6 +++++-
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/xen/arch/x86/hvm/nestedhvm.c b/xen/arch/x86/hvm/nestedhvm.c
index bddd77d810..3205277e81 100644
--- a/xen/arch/x86/hvm/nestedhvm.c
+++ b/xen/arch/x86/hvm/nestedhvm.c
@@ -15,13 +15,6 @@
static unsigned long *shadow_io_bitmap[3];
-/* Nested VCPU */
-bool
-nestedhvm_vcpu_in_guestmode(struct vcpu *v)
-{
- return vcpu_nestedhvm(v).nv_guestmode;
-}
-
void
nestedhvm_vcpu_reset(struct vcpu *v)
{
diff --git a/xen/arch/x86/include/asm/hvm/nestedhvm.h b/xen/arch/x86/include/asm/hvm/nestedhvm.h
index ea2c1bc328..9e158bc5ce 100644
--- a/xen/arch/x86/include/asm/hvm/nestedhvm.h
+++ b/xen/arch/x86/include/asm/hvm/nestedhvm.h
@@ -28,11 +28,15 @@ static inline bool nestedhvm_enabled(const struct domain *d)
return IS_ENABLED(CONFIG_HVM) && (d->options & XEN_DOMCTL_CDF_nested_virt);
}
+static inline bool nestedhvm_vcpu_in_guestmode(struct vcpu *v)
+{
+ return vcpu_nestedhvm(v).nv_guestmode;
+}
+
/* Nested VCPU */
int nestedhvm_vcpu_initialise(struct vcpu *v);
void nestedhvm_vcpu_destroy(struct vcpu *v);
void nestedhvm_vcpu_reset(struct vcpu *v);
-bool nestedhvm_vcpu_in_guestmode(struct vcpu *v);
#define nestedhvm_vcpu_enter_guestmode(v) \
vcpu_nestedhvm(v).nv_guestmode = 1
#define nestedhvm_vcpu_exit_guestmode(v) \
--
2.56.0
--
Teddy Astie | Vates XCP-ng Developer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
On 20.10.2026 18:53, Teddy Astie wrote:
> --- a/xen/arch/x86/include/asm/hvm/nestedhvm.h
> +++ b/xen/arch/x86/include/asm/hvm/nestedhvm.h
> @@ -28,11 +28,15 @@ static inline bool nestedhvm_enabled(const struct domain *d)
> return IS_ENABLED(CONFIG_HVM) && (d->options & XEN_DOMCTL_CDF_nested_virt);
> }
>
> +static inline bool nestedhvm_vcpu_in_guestmode(struct vcpu *v)
> +{
> + return vcpu_nestedhvm(v).nv_guestmode;
> +}
While converting the function, can't its parameter also be pointer-to-const?
Jan
On 10/20/26 5:53 PM, Teddy Astie wrote:
> This function just returns vcpu_nestedhvm(v).nv_guestmode and would
> be better inlined to improve codegen.
>
> Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
> ---
> xen/arch/x86/hvm/nestedhvm.c | 7 -------
> xen/arch/x86/include/asm/hvm/nestedhvm.h | 6 +++++-
> 2 files changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/xen/arch/x86/hvm/nestedhvm.c b/xen/arch/x86/hvm/nestedhvm.c
> index bddd77d810..3205277e81 100644
> --- a/xen/arch/x86/hvm/nestedhvm.c
> +++ b/xen/arch/x86/hvm/nestedhvm.c
> @@ -15,13 +15,6 @@
>
> static unsigned long *shadow_io_bitmap[3];
>
> -/* Nested VCPU */
(minor) I think this comment logically applies to the following functions as
well, but since it doesn't add any value I think it's fine to remove it.
> -bool
> -nestedhvm_vcpu_in_guestmode(struct vcpu *v)
> -{
> - return vcpu_nestedhvm(v).nv_guestmode;
> -}
> -
> void
> nestedhvm_vcpu_reset(struct vcpu *v)
> {
> diff --git a/xen/arch/x86/include/asm/hvm/nestedhvm.h b/xen/arch/x86/include/asm/hvm/nestedhvm.h
> index ea2c1bc328..9e158bc5ce 100644
> --- a/xen/arch/x86/include/asm/hvm/nestedhvm.h
> +++ b/xen/arch/x86/include/asm/hvm/nestedhvm.h
> @@ -28,11 +28,15 @@ static inline bool nestedhvm_enabled(const struct domain *d)
> return IS_ENABLED(CONFIG_HVM) && (d->options & XEN_DOMCTL_CDF_nested_virt);
> }
>
> +static inline bool nestedhvm_vcpu_in_guestmode(struct vcpu *v)
> +{
> + return vcpu_nestedhvm(v).nv_guestmode;
> +}
> +
> /* Nested VCPU */
(minor) I think the function should logically go after this comment but again,
it doesn't add any value so should probably just be removed.
Otherwise this looks good to me.
Ross
> int nestedhvm_vcpu_initialise(struct vcpu *v);
> void nestedhvm_vcpu_destroy(struct vcpu *v);
> void nestedhvm_vcpu_reset(struct vcpu *v);
> -bool nestedhvm_vcpu_in_guestmode(struct vcpu *v);
> #define nestedhvm_vcpu_enter_guestmode(v) \
> vcpu_nestedhvm(v).nv_guestmode = 1
> #define nestedhvm_vcpu_exit_guestmode(v) \
© 2016 - 2026 Red Hat, Inc.