On 16.04.2024 08:25, Sergiy Kibrik wrote:
> Use altp2m index only when it is supported by the platform, i.e. VMX.
> The puspose of that is the possiblity to disable VMX support and
> exclude its code from the build completely.

I'm afraid this description doesn't make clear what problem there is,
which may be related to the fact that (as mentioned elsewhere by others)
altp2m isn't a VMX-specific thing. The field read by altp2m_vcpu_idx()
also looks to be zero for domains that never had altp2m enabled for them.
Further, ...

> --- a/xen/arch/x86/hvm/monitor.c
> +++ b/xen/arch/x86/hvm/monitor.c
> @@ -262,6 +262,8 @@ bool hvm_monitor_check_p2m(unsigned long gla, gfn_t gfn, 
> uint32_t pfec,
>      struct vcpu *curr = current;
>      vm_event_request_t req = {};
>      paddr_t gpa = (gfn_to_gaddr(gfn) | (gla & ~PAGE_MASK));
> +    unsigned int altp2m_idx = hvm_altp2m_supported() ?
> +                              altp2m_vcpu_idx(curr) : 0;

... elsewhere uses of altp2m_vcpu_idx() are guarded by altp2m_active()
checks. Why the domain-independent hvm_altp2m_supported() here?

Jan

Reply via email to