Skip to contentSkip to conversation

KVM: Fix compilation on non-x86

PATCH Applied Alexander Graf 4 participants 5 messages Jan 25, 2012 – Feb 6, 2012 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: Fix compilation on non-x86

Commit 84b058d broke compilation for KVM on non-x86 targets, which don't have KVM_CAP_IRQ_ROUTING defined.

Fix by not using the unavailable constant when it's not around.

---
 kvm-all.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
kvm-all.c +4 -0
index e411d3c..831f39a 100644
@@ -1305,7 +1305,11 @@ int kvm_has_many_ioeventfds(void)
 
 int kvm_has_gsi_routing(void)
 {
+#ifdef KVM_CAP_IRQ_ROUTING
     return kvm_check_extension(kvm_state, KVM_CAP_IRQ_ROUTING);
+#else
+    return false;
+#endif
 }
 
 int kvm_allows_irq0_override(void)
Signature · 1 line
1.6.0.2
#1 lore raw
Quoted 16 lines · Alexander Graf

Commit 84b058d broke compilation for KVM on non-x86 targets, which don't have KVM_CAP_IRQ_ROUTING defined.

Fix by not using the unavailable constant when it's not around.

---
 kvm-all.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
kvm-all.c +0 -0
index e411d3c..831f39a 100644
@@ -1305,7 +1305,11 @@ int kvm_has_many_ioeventfds(void)
 

kvm-all.c int kvm_has_many_ioeventfds(void) · line 1315

Quoted 10 lines
kvm-all.c +4 -0
 int kvm_has_gsi_routing(void)
 {
+#ifdef KVM_CAP_IRQ_ROUTING
     return kvm_check_extension(kvm_state, KVM_CAP_IRQ_ROUTING);
+#else
+    return false;
+#endif
 }
 
 int kvm_allows_irq0_override(void)

Yep, thanks.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#2 lore raw
Quoted 26 lines · Jan Kiszka
Quoted 25 lines · Alexander Graf

Commit 84b058d broke compilation for KVM on non-x86 targets, which don't have KVM_CAP_IRQ_ROUTING defined.

Fix by not using the unavailable constant when it's not around.

---
  kvm-all.c |    4 ++++
  1 files changed, 4 insertions(+), 0 deletions(-)
kvm-all.c +4 -0
index e411d3c..831f39a 100644
@@ -1305,7 +1305,11 @@ int kvm_has_many_ioeventfds(void)
 
  int kvm_has_gsi_routing(void)
  {
+#ifdef KVM_CAP_IRQ_ROUTING
      return kvm_check_extension(kvm_state, KVM_CAP_IRQ_ROUTING);
+#else
+    return false;
+#endif
  }
 
Quoted 2 lines

kvm-all.c int kvm_has_many_ioeventfds(void) · line 1315

Quoted 1 line
kvm-all.c +0 -0
  int kvm_allows_irq0_override(void)

Yep, thanks.

Btw, I really dislike the concept of conditional CAP defines. If a CAP isn't available, we get false returned from the kernel anyway. And if a CAP is architecture specific, we should rather be #ifdefing on TARGET_XXX rather than the CAP.

Alex

#3 lore raw
Quoted 27 lines · Alexander Graf
Quoted 26 lines · Jan Kiszka
Quoted 25 lines · Alexander Graf

Commit 84b058d broke compilation for KVM on non-x86 targets, which don't have KVM_CAP_IRQ_ROUTING defined.

Fix by not using the unavailable constant when it's not around.

---
  kvm-all.c |    4 ++++
  1 files changed, 4 insertions(+), 0 deletions(-)
kvm-all.c +4 -0
index e411d3c..831f39a 100644
@@ -1305,7 +1305,11 @@ int kvm_has_many_ioeventfds(void)
 
  int kvm_has_gsi_routing(void)
  {
+#ifdef KVM_CAP_IRQ_ROUTING
      return kvm_check_extension(kvm_state, KVM_CAP_IRQ_ROUTING);
+#else
+    return false;
+#endif
  }
 
Quoted 7 lines
Quoted 2 lines

kvm-all.c int kvm_has_many_ioeventfds(void) · line 1315

Quoted 1 line
kvm-all.c +0 -0
  int kvm_allows_irq0_override(void)

Yep, thanks.

Btw, I really dislike the concept of conditional CAP defines. If a CAP isn't available, we get false returned from the kernel anyway. And if a CAP is architecture specific, we should rather be #ifdefing on TARGET_XXX rather than the CAP.

Yes, I hate it generally as well. There are cases (IIRC) where it is really useless. The use case here is that it allows to disable certain conceptually generic parts in kvm-all during build time. If it's worth it, that's a different question.

Jan