Skip to contentSkip to conversation

ISA PC fixes

PATCH In review Jan Kiszka 2 participants 8 messages Sep 21, 2011 – Sep 23, 2011

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

cover ISA PC fixes

This plus [1] reanimates -M isapc for me again.

Jan Kiszka (4):
pc: Unbreak ROM mapping for ISA machine
pc: Disable HPET for ISA machine
vga: Unbreak ISA support
cirrus: Unbreak ISA support

 hw/cirrus_vga.c |    4 ++--
 hw/pc.c         |    8 ++++----
 hw/pc.h         |    2 +-
 hw/pc_piix.c    |   14 +++++++++++---
 hw/vga-isa.c    |    1 +
 5 files changed, 19 insertions(+), 10 deletions(-)
Signature · 1 line
1.7.3.4
author
#1 lore raw

PATCH 1/4 pc: Unbreak ROM mapping for ISA machine

From: Jan Kiszka <[email protected]>

This is based on the original fix by Hervé Poussineau: pc_memory_init actually takes a memory region for mapping BIOS and extension ROMs. That equals the PCI memory region if PCI is available, but must be system memory in the ISA case.

---
 hw/pc.c      |    8 ++++----
 hw/pc.h      |    2 +-
 hw/pc_piix.c |   13 ++++++++++---
 3 files changed, 15 insertions(+), 8 deletions(-)
hw/pc.c +4 -4
index fcaae9f..992c61d 100644
@@ -962,7 +962,7 @@ void pc_memory_init(MemoryRegion *system_memory,
                     const char *initrd_filename,
                     ram_addr_t below_4g_mem_size,
                     ram_addr_t above_4g_mem_size,
-                    MemoryRegion *pci_memory,
+                    MemoryRegion *rom_memory,
                     MemoryRegion **ram_memory)
 {
     char *filename;
@@ -1026,7 +1026,7 @@ void pc_memory_init(MemoryRegion *system_memory,
     isa_bios = g_malloc(sizeof(*isa_bios));
     memory_region_init_alias(isa_bios, "isa-bios", bios,
                              bios_size - isa_bios_size, isa_bios_size);
-    memory_region_add_subregion_overlap(pci_memory,
+    memory_region_add_subregion_overlap(rom_memory,
                                         0x100000 - isa_bios_size,
                                         isa_bios,
                                         1);
@@ -1034,13 +1034,13 @@ void pc_memory_init(MemoryRegion *system_memory,
 
     option_rom_mr = g_malloc(sizeof(*option_rom_mr));
     memory_region_init_ram(option_rom_mr, NULL, "pc.rom", PC_ROM_SIZE);
-    memory_region_add_subregion_overlap(pci_memory,
+    memory_region_add_subregion_overlap(rom_memory,
                                         PC_ROM_MIN_VGA,
                                         option_rom_mr,
                                         1);
 
     /* map all the bios at the top of memory */
-    memory_region_add_subregion(pci_memory,
+    memory_region_add_subregion(rom_memory,
                                 (uint32_t)(-bios_size),
                                 bios);
 
hw/pc.h +1 -1
index 958c77d..36749b0 100644
@@ -137,7 +137,7 @@ void pc_memory_init(MemoryRegion *system_memory,
                     const char *initrd_filename,
                     ram_addr_t below_4g_mem_size,
                     ram_addr_t above_4g_mem_size,
-                    MemoryRegion *pci_memory,
+                    MemoryRegion *rom_memory,
                     MemoryRegion **ram_memory);
 qemu_irq *pc_allocate_cpu_irq(void);
 void pc_vga_init(PCIBus *pci_bus);
hw/pc_piix.c +10 -3
index 75d96d9..52939f5 100644
@@ -97,6 +97,7 @@ static void pc_init1(MemoryRegion *system_memory,
     ISADevice *rtc_state;
     MemoryRegion *ram_memory;
     MemoryRegion *pci_memory;
+    MemoryRegion *rom_memory;
 
     pc_cpus_init(cpu_model);
 
@@ -112,15 +113,21 @@ static void pc_init1(MemoryRegion *system_memory,
         below_4g_mem_size = ram_size;
     }
 
-    pci_memory = g_new(MemoryRegion, 1);
-    memory_region_init(pci_memory, "pci", INT64_MAX);
+    if (pci_enabled) {
+        pci_memory = g_new(MemoryRegion, 1);
+        memory_region_init(pci_memory, "pci", INT64_MAX);
+        rom_memory = pci_memory;
+    } else {
+        pci_memory = NULL;
+        rom_memory = system_memory;
+    }
 
     /* allocate ram and load rom/bios */
     if (!xen_enabled()) {
         pc_memory_init(system_memory,
                        kernel_filename, kernel_cmdline, initrd_filename,
                        below_4g_mem_size, above_4g_mem_size,
-                       pci_memory, &ram_memory);
+                       rom_memory, &ram_memory);
     }
 
     if (!xen_enabled()) {
Signature · 1 line
1.7.3.4
author
#2 lore raw

PATCH 2/4 pc: Disable HPET for ISA machine

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

There was no HPET on ISA boxes.

---
 hw/pc_piix.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
hw/pc_piix.c +1 -0
index 52939f5..ec7da6d 100644
@@ -157,6 +157,7 @@ static void pc_init1(MemoryRegion *system_memory,
         pci_bus = NULL;
         i440fx_state = NULL;
         isa_bus_new(NULL);
+        no_hpet = 1;
     }
     isa_bus_irqs(isa_irq);
 
Signature · 1 line
1.7.3.4
author
#3 lore raw

PATCH 3/4 vga: Unbreak ISA support

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

We need to initialize legacy_address_space during ISA VGA setup so that the chain-4 alias can be registered properly.

---
 hw/vga-isa.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
hw/vga-isa.c +1 -0
index 0d19901..6b5c8ed 100644
@@ -49,6 +49,7 @@ static int vga_initfn(ISADevice *dev)
     MemoryRegion *vga_io_memory;
 
     vga_common_init(s, VGA_RAM_SIZE);
+    s->legacy_address_space = isa_address_space(dev);
     vga_io_memory = vga_init_io(s);
     memory_region_add_subregion_overlap(isa_address_space(dev),
                                         isa_mem_base + 0x000a0000,
Signature · 1 line
1.7.3.4
author
#4 lore raw

PATCH 4/4 cirrus: Unbreak ISA support

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

Do not try to map against the PCI bar in the ISA version of the device.

---
 hw/cirrus_vga.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
hw/cirrus_vga.c +2 -2
index ec7ea82..c7e365b 100644
@@ -2401,7 +2401,7 @@ static void map_linear_vram_bank(CirrusVGAState *s, unsigned bank)
 
 static void map_linear_vram(CirrusVGAState *s)
 {
-    if (!s->linear_vram) {
+    if (s->bustype == CIRRUS_BUSTYPE_PCI && !s->linear_vram) {
         s->linear_vram = true;
         memory_region_add_subregion_overlap(&s->pci_bar, 0, &s->vga.vram, 1);
     }
@@ -2411,7 +2411,7 @@ static void map_linear_vram(CirrusVGAState *s)
 
 static void unmap_linear_vram(CirrusVGAState *s)
 {
-    if (s->linear_vram) {
+    if (s->bustype == CIRRUS_BUSTYPE_PCI && s->linear_vram) {
         s->linear_vram = false;
         memory_region_del_subregion(&s->pci_bar, &s->vga.vram);
     }
Signature · 1 line
1.7.3.4
#5 lore raw
In reply to Jan Kiszka
Quoted 1 line · Jan Kiszka

This plus [1] reanimates -M isapc for me again.

Applied all. Thanks. What's [1] BTW?

Regards,

Anthony Liguori

Quoted 14 lines

Jan Kiszka (4):
pc: Unbreak ROM mapping for ISA machine
pc: Disable HPET for ISA machine
vga: Unbreak ISA support
cirrus: Unbreak ISA support

  hw/cirrus_vga.c |    4 ++--
  hw/pc.c         |    8 ++++----
  hw/pc.h         |    2 +-
  hw/pc_piix.c    |   14 +++++++++++---
  hw/vga-isa.c    |    1 +
  5 files changed, 19 insertions(+), 10 deletions(-)