On 16.07.2025 22:15, Petr Beneš wrote:
> From: Petr Beneš <w1be...@gmail.com>
> 
> The p2m_altp2m_check() stub was previously declared on all architectures,
> even though the altp2m feature is only supported on x86. This patch removes
> the unused stub definitions from ARM, PPC, and RISC-V, and wraps the actual
> usage sites in #ifdef CONFIG_ALTP2M instead.

Hmm, using IS_ENABLED() would certainly be preferred. That would apparently
require ...

> --- a/xen/arch/x86/include/asm/p2m.h
> +++ b/xen/arch/x86/include/asm/p2m.h
> @@ -962,17 +962,16 @@ int p2m_altp2m_propagate_change(struct domain *d, gfn_t 
> gfn,
>  /* Set a specific p2m view visibility */
>  int p2m_set_altp2m_view_visibility(struct domain *d, unsigned int altp2m_idx,
>                                     uint8_t visible);
> -#else /* !CONFIG_HVM */
> -struct p2m_domain *p2m_get_altp2m(struct vcpu *v);
> -#endif /* CONFIG_HVM */
>  
>  #ifdef CONFIG_ALTP2M
>  /* Check to see if vcpu should be switched to a different p2m. */
>  void p2m_altp2m_check(struct vcpu *v, uint16_t idx);

... the declaration to be generally visible (likely also outside of x86).

> --- a/xen/common/vm_event.c
> +++ b/xen/common/vm_event.c
> @@ -430,9 +430,11 @@ static int vm_event_resume(struct domain *d, struct 
> vm_event_domain *ved)
>               */
>              vm_event_toggle_singlestep(d, v, &rsp);
>  
> +#ifdef CONFIG_ALTP2M
>              /* Check for altp2m switch */
>              if ( rsp.flags & VM_EVENT_FLAG_ALTERNATE_P2M )
>                  p2m_altp2m_check(v, rsp.altp2m_idx);
> +#endif

Is (and was) this actually correct? Shouldn't the caller be notified
somehow that its use of VM_EVENT_FLAG_ALTERNATE_P2M had no effect when
ALTP2M=n?

Jan

Reply via email to