qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/4] use FWCfgState* instead of void* for fw_cfg data
@ 2012-12-07 16:07 Eduardo Habkost
  2012-12-07 16:07 ` [Qemu-devel] [PATCH 1/4] multiboot: use FWCfgState* as argument instead of void* Eduardo Habkost
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Eduardo Habkost @ 2012-12-07 16:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: Igor Mammedov

Many parts of the code use void* for fw_cfg data when it could simply use the
right data type (FWCfgState*). This series changes that code to use
FWCfgState*.

Eduardo Habkost (4):
  multiboot: use FWCfgState* as argument instead of void*
  pc: use FWCfgState* instead of void* for fw_cfg data
  ppc: use FWCfgState* instead of void* for fw_cfg data
  sparc: use FWCfgState* instead of void* for fw_cfg data

 hw/acpi_piix4.c   |  2 +-
 hw/multiboot.c    |  2 +-
 hw/multiboot.h    |  4 +++-
 hw/pc.c           | 28 ++++++++++++++--------------
 hw/pc.h           | 19 ++++++++++---------
 hw/pc_piix.c      |  2 +-
 hw/ppc_newworld.c |  2 +-
 hw/ppc_oldworld.c |  2 +-
 hw/sun4m.c        |  6 +++---
 hw/sun4u.c        |  2 +-
 10 files changed, 36 insertions(+), 33 deletions(-)

-- 
1.7.11.7

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PATCH 1/4] multiboot: use FWCfgState* as argument instead of void*
  2012-12-07 16:07 [Qemu-devel] [PATCH 0/4] use FWCfgState* instead of void* for fw_cfg data Eduardo Habkost
@ 2012-12-07 16:07 ` Eduardo Habkost
  2012-12-07 16:07 ` [Qemu-devel] [PATCH 2/4] pc: use FWCfgState* instead of void* for fw_cfg data Eduardo Habkost
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Eduardo Habkost @ 2012-12-07 16:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: Igor Mammedov, Anthony Liguori

There's no point in using void* if we can simply use the right type for
the argument (FWCfgState*).

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: Anthony Liguori <aliguori@us.ibm.com>
---
 hw/multiboot.c | 2 +-
 hw/multiboot.h | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/hw/multiboot.c b/hw/multiboot.c
index 09ec5b2..06bbf4c 100644
--- a/hw/multiboot.c
+++ b/hw/multiboot.c
@@ -124,7 +124,7 @@ static void mb_add_mod(MultibootState *s,
     s->mb_mods_count++;
 }
 
-int load_multiboot(void *fw_cfg,
+int load_multiboot(FWCfgState *fw_cfg,
                    FILE *f,
                    const char *kernel_filename,
                    const char *initrd_filename,
diff --git a/hw/multiboot.h b/hw/multiboot.h
index 98fb1b7..33c82b1 100644
--- a/hw/multiboot.h
+++ b/hw/multiboot.h
@@ -1,7 +1,9 @@
 #ifndef QEMU_MULTIBOOT_H
 #define QEMU_MULTIBOOT_H
 
-int load_multiboot(void *fw_cfg,
+#include "fw_cfg.h"
+
+int load_multiboot(FWCfgState *fw_cfg,
                    FILE *f,
                    const char *kernel_filename,
                    const char *initrd_filename,
-- 
1.7.11.7

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PATCH 2/4] pc: use FWCfgState* instead of void* for fw_cfg data
  2012-12-07 16:07 [Qemu-devel] [PATCH 0/4] use FWCfgState* instead of void* for fw_cfg data Eduardo Habkost
  2012-12-07 16:07 ` [Qemu-devel] [PATCH 1/4] multiboot: use FWCfgState* as argument instead of void* Eduardo Habkost
@ 2012-12-07 16:07 ` Eduardo Habkost
  2012-12-07 16:07 ` [Qemu-devel] [PATCH 3/4] ppc: " Eduardo Habkost
  2012-12-07 16:07 ` [Qemu-devel] [PATCH 4/4] sparc: " Eduardo Habkost
  3 siblings, 0 replies; 6+ messages in thread
From: Eduardo Habkost @ 2012-12-07 16:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: Igor Mammedov, Anthony Liguori

There's no point in using void* if all functions dealing with that data
use FWCfgState*.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: Anthony Liguori <aliguori@us.ibm.com>
---
 hw/acpi_piix4.c |  2 +-
 hw/pc.c         | 28 ++++++++++++++--------------
 hw/pc.h         | 19 ++++++++++---------
 hw/pc_piix.c    |  2 +-
 4 files changed, 26 insertions(+), 25 deletions(-)

diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c
index 519269a..6ddee93 100644
--- a/hw/acpi_piix4.c
+++ b/hw/acpi_piix4.c
@@ -473,7 +473,7 @@ static int piix4_pm_initfn(PCIDevice *dev)
 
 i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
                        qemu_irq sci_irq, qemu_irq smi_irq,
-                       int kvm_enabled, void *fw_cfg)
+                       int kvm_enabled, FWCfgState *fw_cfg)
 {
     PCIDevice *dev;
     PIIX4PMState *s;
diff --git a/hw/pc.c b/hw/pc.c
index 2b5bbbf..70d3394 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -567,9 +567,9 @@ int e820_add_entry(uint64_t address, uint64_t length, uint32_t type)
     return index;
 }
 
-static void *bochs_bios_init(void)
+static FWCfgState *bochs_bios_init(void)
 {
-    void *fw_cfg;
+    FWCfgState *fw_cfg;
     uint8_t *smbios_table;
     size_t smbios_len;
     uint64_t *numa_fw_cfg;
@@ -635,10 +635,10 @@ static long get_file_size(FILE *f)
     return size;
 }
 
-static void load_linux(void *fw_cfg,
+static void load_linux(FWCfgState *fw_cfg,
                        const char *kernel_filename,
-		       const char *initrd_filename,
-		       const char *kernel_cmdline,
+                       const char *initrd_filename,
+                       const char *kernel_cmdline,
                        hwaddr max_ram_size)
 {
     uint16_t protocol;
@@ -877,19 +877,19 @@ void pc_cpus_init(const char *cpu_model)
     }
 }
 
-void *pc_memory_init(MemoryRegion *system_memory,
-                    const char *kernel_filename,
-                    const char *kernel_cmdline,
-                    const char *initrd_filename,
-                    ram_addr_t below_4g_mem_size,
-                    ram_addr_t above_4g_mem_size,
-                    MemoryRegion *rom_memory,
-                    MemoryRegion **ram_memory)
+FWCfgState *pc_memory_init(MemoryRegion *system_memory,
+                           const char *kernel_filename,
+                           const char *kernel_cmdline,
+                           const char *initrd_filename,
+                           ram_addr_t below_4g_mem_size,
+                           ram_addr_t above_4g_mem_size,
+                           MemoryRegion *rom_memory,
+                           MemoryRegion **ram_memory)
 {
     int linux_boot, i;
     MemoryRegion *ram, *option_rom_mr;
     MemoryRegion *ram_below_4g, *ram_above_4g;
-    void *fw_cfg;
+    FWCfgState *fw_cfg;
 
     linux_boot = (kernel_filename != NULL);
 
diff --git a/hw/pc.h b/hw/pc.h
index 2237e86..0fc97ea 100644
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -9,6 +9,7 @@
 #include "net.h"
 #include "memory.h"
 #include "ioapic.h"
+#include "fw_cfg.h"
 
 /* PC-style peripherals (also used by other machines).  */
 
@@ -79,14 +80,14 @@ void pc_register_ferr_irq(qemu_irq irq);
 void pc_acpi_smi_interrupt(void *opaque, int irq, int level);
 
 void pc_cpus_init(const char *cpu_model);
-void *pc_memory_init(MemoryRegion *system_memory,
-                    const char *kernel_filename,
-                    const char *kernel_cmdline,
-                    const char *initrd_filename,
-                    ram_addr_t below_4g_mem_size,
-                    ram_addr_t above_4g_mem_size,
-                    MemoryRegion *rom_memory,
-                    MemoryRegion **ram_memory);
+FWCfgState *pc_memory_init(MemoryRegion *system_memory,
+                           const char *kernel_filename,
+                           const char *kernel_cmdline,
+                           const char *initrd_filename,
+                           ram_addr_t below_4g_mem_size,
+                           ram_addr_t above_4g_mem_size,
+                           MemoryRegion *rom_memory,
+                           MemoryRegion **ram_memory);
 qemu_irq *pc_allocate_cpu_irq(void);
 DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus);
 void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
@@ -118,7 +119,7 @@ int acpi_table_add(const char *table_desc);
 
 i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
                        qemu_irq sci_irq, qemu_irq smi_irq,
-                       int kvm_enabled, void *fw_cfg);
+                       int kvm_enabled, FWCfgState *fw_cfg);
 void piix4_smbus_register_device(SMBusDevice *dev, uint8_t addr);
 
 /* hpet.c */
diff --git a/hw/pc_piix.c b/hw/pc_piix.c
index aa3e7f4..d636bcf 100644
--- a/hw/pc_piix.c
+++ b/hw/pc_piix.c
@@ -84,7 +84,7 @@ static void pc_init1(MemoryRegion *system_memory,
     MemoryRegion *ram_memory;
     MemoryRegion *pci_memory;
     MemoryRegion *rom_memory;
-    void *fw_cfg = NULL;
+    FWCfgState *fw_cfg = NULL;
 
     pc_cpus_init(cpu_model);
 
-- 
1.7.11.7

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PATCH 3/4] ppc: use FWCfgState* instead of void* for fw_cfg data
  2012-12-07 16:07 [Qemu-devel] [PATCH 0/4] use FWCfgState* instead of void* for fw_cfg data Eduardo Habkost
  2012-12-07 16:07 ` [Qemu-devel] [PATCH 1/4] multiboot: use FWCfgState* as argument instead of void* Eduardo Habkost
  2012-12-07 16:07 ` [Qemu-devel] [PATCH 2/4] pc: use FWCfgState* instead of void* for fw_cfg data Eduardo Habkost
@ 2012-12-07 16:07 ` Eduardo Habkost
  2012-12-07 18:32   ` Alexander Graf
  2012-12-07 16:07 ` [Qemu-devel] [PATCH 4/4] sparc: " Eduardo Habkost
  3 siblings, 1 reply; 6+ messages in thread
From: Eduardo Habkost @ 2012-12-07 16:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: Igor Mammedov, Alexander Graf

There's no point in using void* if all functions dealing with that data
use FWCfgState*.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: Alexander Graf <agraf@suse.de>
---
 hw/ppc_newworld.c | 2 +-
 hw/ppc_oldworld.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/ppc_newworld.c b/hw/ppc_newworld.c
index 664747e..426ea51 100644
--- a/hw/ppc_newworld.c
+++ b/hw/ppc_newworld.c
@@ -153,7 +153,7 @@ static void ppc_core99_init(QEMUMachineInitArgs *args)
     MemoryRegion *ide_mem[3];
     int ppc_boot_device;
     DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
-    void *fw_cfg;
+    FWCfgState *fw_cfg;
     void *dbdma;
     int machine_arch;
 
diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c
index e8138c0..9855dcd 100644
--- a/hw/ppc_oldworld.c
+++ b/hw/ppc_oldworld.c
@@ -96,7 +96,7 @@ static void ppc_heathrow_init(QEMUMachineInitArgs *args)
     MemoryRegion *escc_mem, *escc_bar = g_new(MemoryRegion, 1), *ide_mem[2];
     uint16_t ppc_boot_device;
     DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
-    void *fw_cfg;
+    FWCfgState *fw_cfg;
     void *dbdma;
 
     linux_boot = (kernel_filename != NULL);
-- 
1.7.11.7

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PATCH 4/4] sparc: use FWCfgState* instead of void* for fw_cfg data
  2012-12-07 16:07 [Qemu-devel] [PATCH 0/4] use FWCfgState* instead of void* for fw_cfg data Eduardo Habkost
                   ` (2 preceding siblings ...)
  2012-12-07 16:07 ` [Qemu-devel] [PATCH 3/4] ppc: " Eduardo Habkost
@ 2012-12-07 16:07 ` Eduardo Habkost
  3 siblings, 0 replies; 6+ messages in thread
From: Eduardo Habkost @ 2012-12-07 16:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: Blue Swirl, Igor Mammedov

There's no point in using void* if all functions dealing with that data
use FWCfgState*.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: Blue Swirl <blauwirbel@gmail.com>
---
 hw/sun4m.c | 6 +++---
 hw/sun4u.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/sun4m.c b/hw/sun4m.c
index 1a78676..efcd5dd 100644
--- a/hw/sun4m.c
+++ b/hw/sun4m.c
@@ -866,7 +866,7 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, ram_addr_t RAM_size,
     qemu_irq *cpu_halt;
     unsigned long kernel_size;
     DriveInfo *fd[MAX_FD];
-    void *fw_cfg;
+    FWCfgState *fw_cfg;
     unsigned int num_vsimms;
 
     /* init CPUs */
@@ -1576,7 +1576,7 @@ static void sun4d_hw_init(const struct sun4d_hwdef *hwdef, ram_addr_t RAM_size,
         espdma_irq, ledma_irq;
     qemu_irq esp_reset, dma_enable;
     unsigned long kernel_size;
-    void *fw_cfg;
+    FWCfgState *fw_cfg;
     DeviceState *dev;
 
     /* init CPUs */
@@ -1776,7 +1776,7 @@ static void sun4c_hw_init(const struct sun4c_hwdef *hwdef, ram_addr_t RAM_size,
     qemu_irq fdc_tc;
     unsigned long kernel_size;
     DriveInfo *fd[MAX_FD];
-    void *fw_cfg;
+    FWCfgState *fw_cfg;
     DeviceState *dev;
     unsigned int i;
 
diff --git a/hw/sun4u.c b/hw/sun4u.c
index b2b51e3..8a7f52d 100644
--- a/hw/sun4u.c
+++ b/hw/sun4u.c
@@ -812,7 +812,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
     qemu_irq *ivec_irqs, *pbm_irqs;
     DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
     DriveInfo *fd[MAX_FD];
-    void *fw_cfg;
+    FWCfgState *fw_cfg;
 
     /* init CPUs */
     cpu = cpu_devinit(cpu_model, hwdef);
-- 
1.7.11.7

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH 3/4] ppc: use FWCfgState* instead of void* for fw_cfg data
  2012-12-07 16:07 ` [Qemu-devel] [PATCH 3/4] ppc: " Eduardo Habkost
@ 2012-12-07 18:32   ` Alexander Graf
  0 siblings, 0 replies; 6+ messages in thread
From: Alexander Graf @ 2012-12-07 18:32 UTC (permalink / raw)
  To: Eduardo Habkost; +Cc: Igor Mammedov, qemu-devel


On 07.12.2012, at 17:07, Eduardo Habkost wrote:

> There's no point in using void* if all functions dealing with that data
> use FWCfgState*.

Acked-by: Alexander Graf <agraf@suse.de>


Alex

> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
> Cc: Alexander Graf <agraf@suse.de>
> ---
> hw/ppc_newworld.c | 2 +-
> hw/ppc_oldworld.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/ppc_newworld.c b/hw/ppc_newworld.c
> index 664747e..426ea51 100644
> --- a/hw/ppc_newworld.c
> +++ b/hw/ppc_newworld.c
> @@ -153,7 +153,7 @@ static void ppc_core99_init(QEMUMachineInitArgs *args)
>     MemoryRegion *ide_mem[3];
>     int ppc_boot_device;
>     DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
> -    void *fw_cfg;
> +    FWCfgState *fw_cfg;
>     void *dbdma;
>     int machine_arch;
> 
> diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c
> index e8138c0..9855dcd 100644
> --- a/hw/ppc_oldworld.c
> +++ b/hw/ppc_oldworld.c
> @@ -96,7 +96,7 @@ static void ppc_heathrow_init(QEMUMachineInitArgs *args)
>     MemoryRegion *escc_mem, *escc_bar = g_new(MemoryRegion, 1), *ide_mem[2];
>     uint16_t ppc_boot_device;
>     DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
> -    void *fw_cfg;
> +    FWCfgState *fw_cfg;
>     void *dbdma;
> 
>     linux_boot = (kernel_filename != NULL);
> -- 
> 1.7.11.7
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-12-07 18:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-07 16:07 [Qemu-devel] [PATCH 0/4] use FWCfgState* instead of void* for fw_cfg data Eduardo Habkost
2012-12-07 16:07 ` [Qemu-devel] [PATCH 1/4] multiboot: use FWCfgState* as argument instead of void* Eduardo Habkost
2012-12-07 16:07 ` [Qemu-devel] [PATCH 2/4] pc: use FWCfgState* instead of void* for fw_cfg data Eduardo Habkost
2012-12-07 16:07 ` [Qemu-devel] [PATCH 3/4] ppc: " Eduardo Habkost
2012-12-07 18:32   ` Alexander Graf
2012-12-07 16:07 ` [Qemu-devel] [PATCH 4/4] sparc: " Eduardo Habkost

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).