Skip to contentSkip to conversation

Fixes for git ioemu tree

PATCH New Christoph Egger 1 participant 1 message Mar 17, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fixes for git ioemu tree

Hi Ian,

thanks for syncing with qemu.
Attached is a patch which adds a couple of fixes:

- Make ioemu build w/o CONFIG_PASSTHROUGH
- Make ioemu build w/ TAPGIFNAME defined
- Make pci_emulation_add non-static as it is used in different files
- remove redundant variable re-declarations/re-definitions
- Make xenstore functions static. They have no prototypes and aren't used elsewhere
- Initialize xenpv_machine correctly (xen_init_pv didn't match what QEMUmachine expected)
- Misc compiler warning fixes

Signature · 6 lines
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Karl-Hammerschmidt-Str. 34, 85609 Dornach b. Muenchen
Geschaeftsfuehrer: Jochen Polster, Thomas M. McCoy, Giuliano Meroni
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632
hw/pc.c +4 -0
index 77f6812..d383bdc 100644
@@ -56,6 +56,10 @@
 
 #define MAX_IDE_BUS 2
 
+#ifdef HAS_TPM
+void tpm_tis_init(SetIRQFunc *set_irq, void *opaque, int irq);
+#endif
+
 static fdctrl_t *floppy_controller;
 static RTCState *rtc_state;
 static PITState *pit;
hw/tpm_tis.c +6 -3
index ceb0dec..50ecac0 100644
@@ -138,7 +138,7 @@ typedef struct TPMState {
 
 
 /* local prototypes */
-static int TPM_Send(tpmState *s, tpmBuffer *buffer, uint8_t locty, char *msg);
+static int TPM_Send(tpmState *s, tpmBuffer *buffer, uint8_t locty, const char *msg);
 static int TPM_Receive(tpmState *s, tpmBuffer *buffer);
 static uint32_t vtpm_instance_from_xenstore(void);
 static void tis_poll_timer(void *opaque);
@@ -860,6 +860,9 @@ typedef struct LPCtpmState {
 /*
  * initialize TIS interface
  */
+
+void tpm_tis_init(SetIRQFunc *set_irq, void *opaque, int irq);
+
 void tpm_tis_init(SetIRQFunc *set_irq, void *opaque, int irq)
 {
     LPCtpmState *d;
@@ -952,7 +955,7 @@ const static unsigned char tpm_failure[] = {
 /*
  * Send a TPM request.
  */
-static int TPM_Send(tpmState *s, tpmBuffer *buffer, uint8_t locty, char *msg)
+static int TPM_Send(tpmState *s, tpmBuffer *buffer, uint8_t locty, const char *msg)
 {
     int len;
     uint32_t size = tpm_get_size_from_buffer(buffer->buf);
@@ -1073,7 +1076,7 @@ static uint32_t vtpm_instance_from_xenstore(void)
     unsigned int num;
     uint32_t number = VTPM_BAD_INSTANCE;
     int end = 0;
-    char *token = "tok";
+    const char *token = "tok";
     int subscribed = 0;
     int ctr = 0;
     fd_set readfds;
hw/xen_blktap.c +0 -2
index 0547889..24d10a3 100644
@@ -61,8 +61,6 @@
 #endif 
 
 
-extern int domid;
-
 int read_fd;
 int write_fd;
 
hw/xen_blktap.h +2 -0
index 92cc08e..0835878 100644
@@ -50,4 +50,6 @@ typedef struct fd_list_entry {
 	struct fd_list_entry **pprev, *next;
 } fd_list_entry_t;
 
+int init_blktap(void);
+
 #endif /*XEN_BLKTAP_H_*/
hw/xen_machine_pv.c +5 -5
index 674ffca..6e570ad 100644
@@ -28,18 +28,19 @@
 #include "boards.h"
 #include "xen_backend.h"
 
+#ifndef CONFIG_STUBDOM
+#include <hw/xen_blktap.h>
+#endif
+
 int xen_domid;
 enum xen_mode xen_mode = XEN_EMULATE;
 
-extern void init_blktap(void);
-
-
 /* The Xen PV machine currently provides
  *   - a virtual framebuffer
  *   - ....
  */
 static void xen_init_pv(ram_addr_t ram_size, int vga_ram_size,
-			const char *boot_device, DisplayState *ds,
+			const char *boot_device,
 			const char *kernel_filename,
 			const char *kernel_cmdline,
 			const char *initrd_filename,
@@ -47,7 +48,6 @@ static void xen_init_pv(ram_addr_t ram_size, int vga_ram_size,
 			const char *direct_pci)
 {
     struct xenfb *xenfb;
-    extern int domid;
     CPUState *env;
 
 #ifndef CONFIG_STUBDOM
i386-dm/exec-dm.c +1 -1
index d035eb5..99a32b2 100644
@@ -712,7 +712,7 @@ void cpu_physical_memory_write_rom(target_phys_addr_t addr,
 void qemu_register_coalesced_mmio(target_phys_addr_t addr, ram_addr_t size) { }
 void qemu_unregister_coalesced_mmio(target_phys_addr_t addr, ram_addr_t size) { }
 
-#if DIRECT_MMAP
+#ifdef DIRECT_MMAP
 void *cpu_physical_memory_map(target_phys_addr_t addr,
                               target_phys_addr_t *plen,
                               int is_write) {
i386-dm/helper2.c +0 -6
index f22b28d..969241f 100644
@@ -82,7 +82,6 @@ int vcpus = 1;
 int xc_handle = -1;
 
 char domain_name[64] = "Xen-no-name";
-int domid;
 
 int domid_backend = 0;
   /* 0 for now.  If we ever have non-dom0 backend domains, this
@@ -313,9 +312,6 @@ static void do_outp(CPUState *env, unsigned long addr,
     }
 }
 
-extern void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf,
-                                   int len, int is_write);
-
 static inline void read_physical(uint64_t addr, unsigned long size, void *val)
 {
     return cpu_physical_memory_rw((target_phys_addr_t)addr, val, size, 0);
@@ -505,7 +501,6 @@ static void handle_buffered_io(void *opaque)
 
 static void cpu_handle_ioreq(void *opaque)
 {
-    extern int vm_running;
     extern int shutdown_requested;
     CPUState *env = opaque;
     ioreq_t *req = cpu_get_ioreq();
@@ -552,7 +547,6 @@ int xen_pause_requested;
 
 int main_loop(void)
 {
-    extern int vm_running;
     CPUState *env = cpu_single_env;
     int evtchn_fd = xce_handle == -1 ? -1 : xc_evtchn_fd(xce_handle);
     char *qemu_file;
net.c +2 -0
index d7bf022..3b2a719 100644
@@ -753,6 +753,8 @@ static int tap_open(char *ifname, int ifname_size)
 #ifndef TAPGIFNAME
     char *dev;
     struct stat s;
+#else
+    struct ifreq ifr;
 #endif
 
     TFR(fd = open("/dev/tap", O_RDWR));
sysemu.h +4 -0
index 2fc4914..8185e3f 100644
@@ -44,6 +44,10 @@ void do_loadvm(const char *name);
 void do_delvm(const char *name);
 void do_info_snapshots(void);
 
+#ifdef CONFIG_PASSTHROUGH
+int pci_emulation_add(char *config_text);
+#endif
+
 void qemu_announce_self(void);
 
 void main_loop_wait(int timeout);
tapdisk-ioemu.c +1 -1
index 52c5ac6..5b257e7 100644
@@ -8,8 +8,8 @@
 #include <sys/time.h>
 
 #include <assert.h>
+#include <hw/xen_blktap.h>
 
-extern int init_blktap(void);
 extern void qemu_aio_init(void);
 extern void qemu_aio_poll(void);
 extern void bdrv_init(void);
vl.c +3 -1
index 9b9f7d5..3a130d1 100644
@@ -5894,12 +5894,14 @@ int main(int argc, char **argv, char **envp)
         }
     }
 
+#ifdef CONFIG_PASSTHROUGH
     for (i = 0; i < nb_pci_emulation; i++) {
-        if(pci_emulation_add(pci_emulation_config_text[i]) < 0) {
+        if (pci_emulation_add(pci_emulation_config_text[i]) < 0) {
             fprintf(stderr, "Warning: could not add PCI device %s\n",
                     pci_emulation_config_text[i]);
         }
     }
+#endif
 
     if (strlen(direct_pci_str) > 0)
         direct_pci = direct_pci_str;
xen-vl-extra.c +2 -2
index d47b0ab..b90708d 100644
@@ -7,7 +7,7 @@
 /* There is no need for multiple-inclusion protection since
  * there is only one place where this file is included. */
 
-
+#include "sysemu.h"
 
 /* Max number of PCI emulation */
 #define MAX_PCI_EMULATION 32
@@ -133,7 +133,7 @@ void do_pci_add(char *devname)
     acpi_php_add(pci_slot);
 }
 
-static int pci_emulation_add(char *config_text)
+int pci_emulation_add(char *config_text)
 {
     PCI_EMULATION_INFO *new;
     if ((new = qemu_mallocz(sizeof(PCI_EMULATION_INFO))) == NULL) {
xenstore.c +6 -5
index 4ee6ceb..3934f62 100644
@@ -247,7 +247,7 @@ static void xenstore_get_backend_path(char **backend, const char *devtype,
     free(frontend_doublecheck);
 }
 
-const char *xenstore_get_guest_uuid(void)
+static const char *xenstore_get_guest_uuid(void)
 {
     static char *already_computed = NULL;
 
@@ -646,7 +646,7 @@ int xenstore_fd(void)
     return -1;
 }
 
-void xenstore_process_logdirty_event(void)
+static void xenstore_process_logdirty_event(void)
 {
     char *act;
     static char *active_path = NULL;
@@ -1266,7 +1266,7 @@ char *xenstore_device_model_read(int domid, char *key, unsigned int *len)
     return value;
 }
 
-char *xenstore_extended_power_mgmt_read(const char *key, unsigned int *len)
+static char *xenstore_extended_power_mgmt_read(const char *key, unsigned int *len)
 {
     char *path = NULL, *value = NULL;
     
@@ -1281,7 +1281,7 @@ char *xenstore_extended_power_mgmt_read(const char *key, unsigned int *len)
     return value;
 }
 
-int xenstore_extended_power_mgmt_write(const char *key, const char *value)
+static int xenstore_extended_power_mgmt_write(const char *key, const char *value)
 {
     int ret;
     char *path = NULL;
@@ -1294,7 +1294,8 @@ int xenstore_extended_power_mgmt_write(const char *key, const char *value)
     return ret;
 }
 
-int xenstore_extended_power_mgmt_event_trigger(const char *key, const char *value)
+static int
+xenstore_extended_power_mgmt_event_trigger(const char *key, const char *value)
 {
     int ret;
     char *path = NULL;

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel