Re: [Qemu-devel] [PATCH 5/6] merge pc_piix.c to pc.c

2012-03-26 Thread Avi Kivity
On 03/26/2012 04:06 AM, Wanpeng Li wrote:
 From: Anthony Liguori aligu...@us.ibm.com

 @@ -889,7 +900,7 @@ static DeviceState *apic_init(void *env, uint8_t apic_id)
  DeviceState *dev;
  static int apic_mapped;
  
 -if (kvm_irqchip_in_kernel()) {
 +if (kvm_enabled()  kvm_irqchip_in_kernel()) {
  dev = qdev_create(NULL, kvm-apic);
  } else {
  dev = qdev_create(NULL, apic);
 @@ -908,7 +919,7 @@ static DeviceState *apic_init(void *env, uint8_t apic_id)
  }
  
  /* KVM does not support MSI yet. */
 -if (!kvm_irqchip_in_kernel()) {
 +if (!kvm_enabled() || !kvm_irqchip_in_kernel()) {
  msi_supported = true;

Why these changes?

-- 
error compiling committee.c: too many arguments to function




Re: [Qemu-devel] [PATCH 5/6] merge pc_piix.c to pc.c

2012-03-26 Thread Jan Kiszka
On 2012-03-26 14:42, Avi Kivity wrote:
 On 03/26/2012 04:06 AM, Wanpeng Li wrote:
 From: Anthony Liguori aligu...@us.ibm.com

 @@ -889,7 +900,7 @@ static DeviceState *apic_init(void *env, uint8_t apic_id)
  DeviceState *dev;
  static int apic_mapped;
  
 -if (kvm_irqchip_in_kernel()) {
 +if (kvm_enabled()  kvm_irqchip_in_kernel()) {
  dev = qdev_create(NULL, kvm-apic);
  } else {
  dev = qdev_create(NULL, apic);
 @@ -908,7 +919,7 @@ static DeviceState *apic_init(void *env, uint8_t apic_id)
  }
  
  /* KVM does not support MSI yet. */
 -if (!kvm_irqchip_in_kernel()) {
 +if (!kvm_enabled() || !kvm_irqchip_in_kernel()) {
  msi_supported = true;
 
 Why these changes?
 

Yep, they are obsolete, likely related to the rebase of the original
patch. A lot of code is moved around here, and I bet there are more
artifacts...

Jan

-- 
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux



Re: [Qemu-devel] [PATCH 5/6] merge pc_piix.c to pc.c

2012-03-26 Thread Anthony Liguori

On 03/26/2012 07:47 AM, Jan Kiszka wrote:

On 2012-03-26 14:42, Avi Kivity wrote:

On 03/26/2012 04:06 AM, Wanpeng Li wrote:

From: Anthony Liguorialigu...@us.ibm.com

@@ -889,7 +900,7 @@ static DeviceState *apic_init(void *env, uint8_t apic_id)
  DeviceState *dev;
  static int apic_mapped;

-if (kvm_irqchip_in_kernel()) {
+if (kvm_enabled()  kvm_irqchip_in_kernel()) {
  dev = qdev_create(NULL, kvm-apic);
  } else {
  dev = qdev_create(NULL, apic);
@@ -908,7 +919,7 @@ static DeviceState *apic_init(void *env, uint8_t apic_id)
  }

  /* KVM does not support MSI yet. */
-if (!kvm_irqchip_in_kernel()) {
+if (!kvm_enabled() || !kvm_irqchip_in_kernel()) {
  msi_supported = true;


Why these changes?



Yep, they are obsolete, likely related to the rebase of the original
patch. A lot of code is moved around here, and I bet there are more
artifacts...


git should have thrown a rebase error here.  I think that means the conflicts 
were ignored.


For something like this, if there's a rebase error, you pretty much have to 
repeat the copy/paste of the code for the section that threw a rebase error.


I'd suggest rebasing again but this time, be a bit more careful when resolving 
conflicts.


Regards,

Anthony Liguori



Jan






[Qemu-devel] [PATCH 5/6] merge pc_piix.c to pc.c

2012-03-25 Thread Wanpeng Li

From: Anthony Liguori aligu...@us.ibm.com

Signed-off-by: Anthony Liguori aligu...@us.ibm.com
Signed-off-by: Wanpeng Li l...@linux.vnet.ibm.com

---
 Makefile.target |1 -
 hw/pc.c |  816 +--
 hw/pc.h |   20 +-
 hw/pc_piix.c|  762 ---
 4 files changed, 739 insertions(+), 860 deletions(-)
 delete mode 100644 hw/pc_piix.c

diff --git a/Makefile.target b/Makefile.target
index 24fb0c0..5c4605f 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -251,7 +251,6 @@ obj-i386-y += sga.o ioapic_common.o ioapic.o i440fx.o 
piix3.o
 obj-i386-y += vmport.o
 obj-i386-y += pci-hotplug.o smbios.o wdt_ib700.o
 obj-i386-y += debugcon.o multiboot.o
-obj-i386-y += pc_piix.o
 obj-i386-y += pc_sysfw.o
 obj-i386-$(CONFIG_KVM) += kvm/clock.o kvm/apic.o kvm/i8259.o kvm/ioapic.o 
kvm/i8254.o
 obj-i386-$(CONFIG_SPICE) += qxl.o qxl-logger.o qxl-render.o
diff --git a/hw/pc.c b/hw/pc.c
index 83a1b5b..d5a557e 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -36,8 +36,6 @@
 #include elf.h
 #include multiboot.h
 #include mc146818rtc.h
-#include i8254.h
-#include pcspk.h
 #include msi.h
 #include sysbus.h
 #include sysemu.h
@@ -46,6 +44,11 @@
 #include ui/qemu-spice.h
 #include memory.h
 #include exec-memory.h
+#include kvm/clock.h
+#include xen.h
+#include arch_init.h
+#include smbus.h
+#include boards.h
 
 /* output Bochs bios info messages */
 //#define DEBUG_BIOS
@@ -60,6 +63,8 @@
 #define DPRINTF(fmt, ...)
 #endif
 
+#define PC_MAX_BIOS_SIZE (4 * 1024 * 1024)
+
 /* Leave a chunk of memory at the top of RAM for the BIOS ACPI tables.  */
 #define ACPI_DATA_SIZE   0x1
 #define BIOS_CFG_IOPORT 0x510
@@ -73,6 +78,8 @@
 
 #define E820_NR_ENTRIES16
 
+#define MAX_IDE_BUS 2
+
 struct e820_entry {
 uint64_t address;
 uint64_t length;
@@ -84,6 +91,10 @@ struct e820_table {
 struct e820_entry entry[E820_NR_ENTRIES];
 } QEMU_PACKED __attribute((__aligned__(4)));
 
+static const int ide_iobase[MAX_IDE_BUS] = { 0x1f0, 0x170 };
+static const int ide_iobase2[MAX_IDE_BUS] = { 0x3f6, 0x376 };
+static const int ide_irq[MAX_IDE_BUS] = { 14, 15 };
+
 static struct e820_table e820_table;
 struct hpet_fw_config hpet_cfg = {.count = UINT8_MAX};
 
@@ -889,7 +900,7 @@ static DeviceState *apic_init(void *env, uint8_t apic_id)
 DeviceState *dev;
 static int apic_mapped;
 
-if (kvm_irqchip_in_kernel()) {
+if (kvm_enabled()  kvm_irqchip_in_kernel()) {
 dev = qdev_create(NULL, kvm-apic);
 } else {
 dev = qdev_create(NULL, apic);
@@ -908,7 +919,7 @@ static DeviceState *apic_init(void *env, uint8_t apic_id)
 }
 
 /* KVM does not support MSI yet. */
-if (!kvm_irqchip_in_kernel()) {
+if (!kvm_enabled() || !kvm_irqchip_in_kernel()) {
 msi_supported = true;
 }
 
@@ -972,50 +983,13 @@ void pc_memory_init(MemoryRegion *system_memory,
 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)
+ram_addr_t above_4g_mem_size)
 {
 int linux_boot, i;
-MemoryRegion *ram, *option_rom_mr;
-MemoryRegion *ram_below_4g, *ram_above_4g;
 void *fw_cfg;
 
 linux_boot = (kernel_filename != NULL);
 
-/* Allocate RAM.  We allocate it as a single memory region and use
- * aliases to address portions of it, mostly for backwards compatibility
- * with older qemus that used qemu_ram_alloc().
- */
-ram = g_malloc(sizeof(*ram));
-memory_region_init_ram(ram, pc.ram,
-   below_4g_mem_size + above_4g_mem_size);
-vmstate_register_ram_global(ram);
-*ram_memory = ram;
-ram_below_4g = g_malloc(sizeof(*ram_below_4g));
-memory_region_init_alias(ram_below_4g, ram-below-4g, ram,
- 0, below_4g_mem_size);
-memory_region_add_subregion(system_memory, 0, ram_below_4g);
-if (above_4g_mem_size  0) {
-ram_above_4g = g_malloc(sizeof(*ram_above_4g));
-memory_region_init_alias(ram_above_4g, ram-above-4g, ram,
- below_4g_mem_size, above_4g_mem_size);
-memory_region_add_subregion(system_memory, 0x1ULL,
-ram_above_4g);
-}
-
-
-/* Initialize PC system firmware */
-pc_system_firmware_init(rom_memory);
-
-option_rom_mr = g_malloc(sizeof(*option_rom_mr));
-memory_region_init_ram(option_rom_mr, pc.rom, PC_ROM_SIZE);
-vmstate_register_ram_global(option_rom_mr);
-memory_region_add_subregion_overlap(rom_memory,
-PC_ROM_MIN_VGA,
-option_rom_mr,
-1);
-
 fw_cfg = bochs_bios_init();