Message ID | 20240416062503.3468942-1-Sergiy_Kibrik@epam.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | x86: make cpu virtualization support configurable | expand |
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
18.04.24 14:31, Jan Beulich: > 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, ... I'll try to improve description > >> --- 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? > understood, will do with altp2m_active() -Sergiy
diff --git a/xen/arch/x86/hvm/monitor.c b/xen/arch/x86/hvm/monitor.c index 4f500beaf5..192a721403 100644 --- 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; 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); if ( rc == -ESRCH ) access = XENMEM_access_n;
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. Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com> --- xen/arch/x86/hvm/monitor.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)