Skip to contentSkip to conversation

x86: fix !CONFIG_HVM build for clang 3.8

PATCH In review Wei Liu 3 participants 3 messages Oct 4, 2018 – Oct 5, 2018

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

PATCH 1/1 x86: fix !CONFIG_HVM build for clang 3.8

It is discovered that hvm_funcs made it into monitor.o even when HVM is disabled. This version of clang doesn't seem to completely eliminate the code after is_hvm_domain() in arch_monitor_get_capabilities().

---
 xen/include/asm-x86/hvm/hvm.h | 10 ++++++++++
 xen/include/asm-x86/monitor.h |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)
xen/include/asm-x86/hvm/hvm.h +10 -0
index 3959604287..e2cbcf53db 100644
@@ -379,6 +379,11 @@ unsigned long hvm_cr4_guest_valid_bits(const struct domain *d, bool restore);
 
 #define hvm_long_mode_active(v) (!!((v)->arch.hvm.guest_efer & EFER_LMA))
 
+static inline bool hvm_has_set_descriptor_access_exiting(void)
+{
+    return hvm_funcs.set_descriptor_access_exiting;
+}
+
 static inline int
 hvm_guest_x86_mode(struct vcpu *v)
 {
@@ -757,6 +762,11 @@ static inline void hvm_inject_hw_exception(unsigned int vector, int errcode)
     ASSERT_UNREACHABLE();
 }
 
+static inline bool hvm_has_set_descriptor_access_exiting(void)
+{
+    return false;
+}
+
 #define is_viridian_domain(d) ((void)(d), false)
 #define has_viridian_time_ref_count(d) ((void)(d), false)
 #define hvm_long_mode_active(v) ((void)(v), false)
xen/include/asm-x86/monitor.h +1 -1
index e02484f56b..4afb0665e8 100644
@@ -90,7 +90,7 @@ static inline uint32_t arch_monitor_get_capabilities(struct domain *d)
     if ( hvm_is_singlestep_supported() )
         capabilities |= (1U << XEN_DOMCTL_MONITOR_EVENT_SINGLESTEP);
 
-    if ( hvm_funcs.set_descriptor_access_exiting )
+    if ( hvm_has_set_descriptor_access_exiting() )
         capabilities |= (1U << XEN_DOMCTL_MONITOR_EVENT_DESC_ACCESS);
 
     return capabilities;
Signature · 7 lines
2.11.0


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

It is discovered that hvm_funcs made it into monitor.o even when HVM is disabled. This version of clang doesn't seem to completely eliminate the code after is_hvm_domain() in arch_monitor_get_capabilities().

Thanks,
Razvan

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

Acked-by on v1 1/1
#2 lore raw
In reply to Wei Liu
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 04.10.18 at 18:42, <[email protected]> wrote:

It is discovered that hvm_funcs made it into monitor.o even when HVM is disabled. This version of clang doesn't seem to completely eliminate the code after is_hvm_domain() in arch_monitor_get_capabilities().

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