Skip to contentSkip to conversation

x86/mem_access: move p2m_mem_access_sanity_check() from header

PATCH In review Razvan Cojocaru 3 participants 4 messages Nov 20, 2018 – Nov 21, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/mem_access: move p2m_mem_access_sanity_check() from header

Move p2m_mem_access_sanity_check() from the asm-x86/mem_access.h header, where it currently is declared inline, to arch/x86/mm/mem_access.c. This allows source code that includes it directly, or indirectly (such as xen/mem_access.h), to not worry about also including sched.h for is_hvm_domain(). Including xen/mem_access.h is useful for code wanting to use p2m_access_t.

---
 xen/arch/x86/mm/mem_access.c     | 5 +++++
 xen/include/asm-x86/mem_access.h | 5 +----
 2 files changed, 6 insertions(+), 4 deletions(-)
xen/arch/x86/mm/mem_access.c +5 -0
index 2f1295e..30c2f1a 100644
@@ -541,6 +541,11 @@ void arch_p2m_set_access_required(struct domain *d, bool access_required)
 #endif
 }
 
+bool p2m_mem_access_sanity_check(struct domain *d)
+{
+    return is_hvm_domain(d) && cpu_has_vmx && hap_enabled(d);
+}
+
 /*
  * Local variables:
  * mode: C
xen/include/asm-x86/mem_access.h +1 -4
index 4043c9f..c815db8 100644
@@ -44,10 +44,7 @@ bool p2m_mem_access_emulate_check(struct vcpu *v,
                                   const vm_event_response_t *rsp);
 
 /* Sanity check for mem_access hardware support */
-static inline bool p2m_mem_access_sanity_check(struct domain *d)
-{
-    return is_hvm_domain(d) && cpu_has_vmx && hap_enabled(d);
-}
+bool p2m_mem_access_sanity_check(struct domain *d);
 
 #endif /*__ASM_X86_MEM_ACCESS_H__ */
 
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Razvan Cojocaru

Move p2m_mem_access_sanity_check() from the asm-x86/mem_access.h header, where it currently is declared inline, to arch/x86/mm/mem_access.c. This allows source code that includes it directly, or indirectly (such as xen/mem_access.h), to not worry about also including sched.h for is_hvm_domain(). Including xen/mem_access.h is useful for code wanting to use p2m_access_t.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw
In reply to Razvan Cojocaru

xen/arch/x86/mm/mem_access.c void arch_p2m_set_access_required(struct domain *d, bool access_required) · line 547

Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 20.11.18 at 19:05, <[email protected]> wrote:
xen/arch/x86/mm/mem_access.c +4 -0
@@ -541,6 +541,11 @@ void arch_p2m_set_access_required(struct domain *d, bool access_required)
 #endif
 }
 
+bool p2m_mem_access_sanity_check(struct domain *d)
+{
+    return is_hvm_domain(d) && cpu_has_vmx && hap_enabled(d);
+}

With Tamas's ack I've committed this as is, but for the future may I ask that you take the opportunity and do trivial improvements in such cases (here: add const)?

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#3 lore raw
Quoted 7 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 20.11.18 at 19:05, <[email protected]> wrote:
xen/arch/x86/mm/mem_access.c +0 -0
@@ -541,6 +541,11 @@ void arch_p2m_set_access_required(struct domain *d, bool access_required)
 #endif
 }
 
Quoted 8 lines

xen/arch/x86/mm/mem_access.c void arch_p2m_set_access_required(struct domain *d, bool access_required) · line 547

Quoted 4 lines
xen/arch/x86/mm/mem_access.c +4 -0
+bool p2m_mem_access_sanity_check(struct domain *d)
+{
+    return is_hvm_domain(d) && cpu_has_vmx && hap_enabled(d);
+}

With Tamas's ack I've committed this as is, but for the future may I ask that you take the opportunity and do trivial improvements in such cases (here: add const)?

Of course, I'll send a new patch as soon as possible.

Thanks,
Razvan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel