On 15.05.2024 11:01, Sergiy Kibrik wrote:
> --- 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 = altp2m_active(curr->domain) ?
> + altp2m_vcpu_idx(curr) : 0;
> int rc;
>
> ASSERT(curr->arch.vm_event->send_event);
> @@ -270,7 +272,7 @@ bool hvm_monitor_check_p2m(unsigned long gla, gfn_t gfn,
> uint32_t pfec,
> * p2m_get_mem_access() can fail from a invalid MFN and return -ESRCH
> * in which case access must be restricted.
> */
> - rc = p2m_get_mem_access(curr->domain, gfn, &access,
> altp2m_vcpu_idx(curr));
> + rc = p2m_get_mem_access(curr->domain, gfn, &access, altp2m_idx);
I think something like this wants taking care of by the function itself.
asm/altp2m.h already has certain stubs (the conditional of which I expect
a later change will switch to CONFIG_ALTP2M); you'd need to just add one
more. Then the other (and any future) users of the function would be
covered as well.
Jan