Skip to contentSkip to conversation

Fix pcspk build with kvm disabled

PATCH In review Mark McLoughlin 2 participants 2 messages Jun 29, 2009 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix pcspk build with kvm disabled

Errors are:

hw/pcspk.c:85: error: expected declaration specifiers or ‘...’ before ‘kvm_pit_state’ hw/pcspk.c:87: error: expected declaration specifiers or ‘...’ before ‘kvm_pit_state’ hw/pcspk.c: In function ‘pcspk_callback’:
hw/pcspk.c:114: error: too many arguments to function ‘kvm_get_pit_ch2’ hw/pcspk.c: In function ‘pcspk_ioport_read’:
hw/pcspk.c:161: error: too many arguments to function ‘kvm_get_pit_ch2’ hw/pcspk.c: In function ‘pcspk_ioport_write’:
hw/pcspk.c:171: error: storage size of ‘inkernel_state’ isn’t known hw/pcspk.c:175: error: too many arguments to function ‘kvm_get_pit_ch2’ hw/pcspk.c:185: error: too many arguments to function ‘kvm_set_pit_ch2’ hw/pcspk.c:171: warning: unused variable ‘inkernel_state’

---
 hw/pcspk.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
hw/pcspk.c +5 -1
index 9e1b59a..fb823d5 100644
@@ -80,11 +80,15 @@ static void kvm_set_pit_ch2(PITState *pit,
         kvm_set_pit(kvm_context, inkernel_state);
     }
 }
-#else
+#elif defined(USE_KVM)
 static inline void kvm_get_pit_ch2(PITState *pit,
                                    kvm_pit_state *inkernel_state) { }
 static inline void kvm_set_pit_ch2(PITState *pit,
                                    kvm_pit_state *inkernel_state) { }
+#else
+typedef struct kvm_pit_state { char dummy; } kvm_pit_state;
+#define kvm_get_pit_ch2(p, s) do { (void)s; } while(0)
+#define kvm_set_pit_ch2(p, s) do { (void)s; } while(0)
 #endif
 
 static inline void generate_samples(PCSpkState *s)
Signature · 1 line
1.6.2.5
#1 lore raw
Quoted 26 lines · Mark McLoughlin

Errors are:

hw/pcspk.c:85: error: expected declaration specifiers or ‘...’ before ‘kvm_pit_state’ hw/pcspk.c:87: error: expected declaration specifiers or ‘...’ before ‘kvm_pit_state’ hw/pcspk.c: In function ‘pcspk_callback’:
hw/pcspk.c:114: error: too many arguments to function ‘kvm_get_pit_ch2’ hw/pcspk.c: In function ‘pcspk_ioport_read’:
hw/pcspk.c:161: error: too many arguments to function ‘kvm_get_pit_ch2’ hw/pcspk.c: In function ‘pcspk_ioport_write’:
hw/pcspk.c:171: error: storage size of ‘inkernel_state’ isn’t known hw/pcspk.c:175: error: too many arguments to function ‘kvm_get_pit_ch2’ hw/pcspk.c:185: error: too many arguments to function ‘kvm_set_pit_ch2’ hw/pcspk.c:171: warning: unused variable ‘inkernel_state’

---
 hw/pcspk.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
hw/pcspk.c +0 -0
index 9e1b59a..fb823d5 100644
@@ -80,11 +80,15 @@ static void kvm_set_pit_ch2(PITState *pit,
         kvm_set_pit(kvm_context, inkernel_state);

hw/pcspk.c static void kvm_set_pit_ch2(PITState *pit, · line 89

Quoted 10 lines
hw/pcspk.c +3 -1
     }
 }
-#else
+#elif defined(USE_KVM)
 static inline void kvm_get_pit_ch2(PITState *pit,
                                    kvm_pit_state *inkernel_state) { }
 static inline void kvm_set_pit_ch2(PITState *pit,
                                    kvm_pit_state *inkernel_state) { }
+#else
+typedef struct kvm_pit_state { char dummy; } kvm_pit_state;

If you do this...

hw/pcspk.c static void kvm_set_pit_ch2(PITState *pit, · line 91

Quoted 2 lines
hw/pcspk.c +2 -0
+#define kvm_get_pit_ch2(p, s) do { (void)s; } while(0)
+#define kvm_set_pit_ch2(p, s) do { (void)s; } while(0)

you don't need this.

hw/pcspk.c static void kvm_set_pit_ch2(PITState *pit, · line 94

Quoted 3 lines
hw/pcspk.c +0 -0
 #endif
 
 static inline void generate_samples(PCSpkState *s)

Basically that's band aid, but I could live with it for now. A cleaner approach would be to push the dummy type into (qemu-)kvm.h, ie. the file responsible for importing the kernel headers in the USE_KVM/CONFIG_KVM case.

Note that qemu-kvm still breaks in the non-kvm build for other reasons here. I wanted to look into this but got detracted.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux