Skip to contentSkip to conversation

prep: Fix offset of BIOS MemoryRegion

PATCH Applied Andreas Färber 4 participants 10 messages Jan 5, 2012 – Jan 16, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 prep: Fix offset of BIOS MemoryRegion

Since 0c90c52fab5ea92d7f12b29bfe26a7cd75d9efcb (ppc_prep: convert to memory API) OHW was "Trying to execute code outside RAM or ROM at 0xfff00700".

The BIOS MemoryRegion is created with a fixed size of 1 MiB. Ensure that the full size can be accessed since the exception vectors are located at 0xfff00000 and the BIOS may want to use them.

It thereby no longer depends on the actual BIOS binary size.

Cc Avi Kivity <[email protected]>
Cc Alexander Graf <[email protected]>
---
 hw/ppc_prep.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
hw/ppc_prep.c +2 -2
index 47dab3f..dec059a 100644
@@ -560,6 +560,8 @@ static void ppc_prep_init (ram_addr_t ram_size,
 
     /* allocate and load BIOS */
     memory_region_init_ram(bios, "ppc_prep.bios", BIOS_SIZE);
+    memory_region_set_readonly(bios, true);
+    memory_region_add_subregion(sysmem, (uint32_t)(-BIOS_SIZE), bios);
     vmstate_register_ram_global(bios);
     if (bios_name == NULL)
         bios_name = BIOS_FILENAME;
@@ -573,8 +575,6 @@ static void ppc_prep_init (ram_addr_t ram_size,
         target_phys_addr_t bios_addr;
         bios_size = (bios_size + 0xfff) & ~0xfff;
         bios_addr = (uint32_t)(-bios_size);
-        memory_region_set_readonly(bios, true);
-        memory_region_add_subregion(sysmem, bios_addr, bios);
         bios_size = load_image_targphys(filename, bios_addr, bios_size);
     }
     if (bios_size < 0 || bios_size > BIOS_SIZE) {
Signature · 1 line
1.7.7
#1 lore raw

Am 05.01.2012 18:13, schrieb Andreas Färber:

Quoted 7 lines

Since 0c90c52fab5ea92d7f12b29bfe26a7cd75d9efcb (ppc_prep: convert to memory API) OHW was "Trying to execute code outside RAM or ROM at 0xfff00700".

The BIOS MemoryRegion is created with a fixed size of 1 MiB. Ensure that the full size can be accessed since the exception vectors are located at 0xfff00000 and the BIOS may want to use them.

Quoted 5 lines

It thereby no longer depends on the actual BIOS binary size.

Cc Avi Kivity <[email protected]>
Cc Alexander Graf <[email protected]>

Ping! Is everyone okay with this? Should I send a PULL?

Andreas

Quoted 26 lines
---
 hw/ppc_prep.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
hw/ppc_prep.c +2 -2
index 47dab3f..dec059a 100644
@@ -560,6 +560,8 @@ static void ppc_prep_init (ram_addr_t ram_size,
 
     /* allocate and load BIOS */
     memory_region_init_ram(bios, "ppc_prep.bios", BIOS_SIZE);
+    memory_region_set_readonly(bios, true);
+    memory_region_add_subregion(sysmem, (uint32_t)(-BIOS_SIZE), bios);
     vmstate_register_ram_global(bios);
     if (bios_name == NULL)
         bios_name = BIOS_FILENAME;
@@ -573,8 +575,6 @@ static void ppc_prep_init (ram_addr_t ram_size,
         target_phys_addr_t bios_addr;
         bios_size = (bios_size + 0xfff) & ~0xfff;
         bios_addr = (uint32_t)(-bios_size);
-        memory_region_set_readonly(bios, true);
-        memory_region_add_subregion(sysmem, bios_addr, bios);
         bios_size = load_image_targphys(filename, bios_addr, bios_size);
     }
     if (bios_size < 0 || bios_size > BIOS_SIZE) {
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#2 lore raw
Quoted 8 lines · Andreas Färber

Am 05.01.2012 18:13, schrieb Andreas Färber:

Quoted 7 lines

Since 0c90c52fab5ea92d7f12b29bfe26a7cd75d9efcb (ppc_prep: convert to memory API) OHW was "Trying to execute code outside RAM or ROM at 0xfff00700".

The BIOS MemoryRegion is created with a fixed size of 1 MiB. Ensure that the full size can be accessed since the exception vectors are located at 0xfff00000 and the BIOS may want to use them.

Quoted 7 lines
Quoted 5 lines

It thereby no longer depends on the actual BIOS binary size.

Cc Avi Kivity<[email protected]>
Cc Alexander Graf<[email protected]>

Ping! Is everyone okay with this? Should I send a PULL?

I would expect this to come through Alex's tree.

Regards,

Anthony Liguori

Quoted 30 lines

Andreas

Quoted 26 lines
---
  hw/ppc_prep.c |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
hw/ppc_prep.c +2 -2
index 47dab3f..dec059a 100644
@@ -560,6 +560,8 @@ static void ppc_prep_init (ram_addr_t ram_size,
 
      /* allocate and load BIOS */
      memory_region_init_ram(bios, "ppc_prep.bios", BIOS_SIZE);
+    memory_region_set_readonly(bios, true);
+    memory_region_add_subregion(sysmem, (uint32_t)(-BIOS_SIZE), bios);
      vmstate_register_ram_global(bios);
      if (bios_name == NULL)
          bios_name = BIOS_FILENAME;
@@ -573,8 +575,6 @@ static void ppc_prep_init (ram_addr_t ram_size,
          target_phys_addr_t bios_addr;
          bios_size = (bios_size + 0xfff)&  ~0xfff;
          bios_addr = (uint32_t)(-bios_size);
-        memory_region_set_readonly(bios, true);
-        memory_region_add_subregion(sysmem, bios_addr, bios);
          bios_size = load_image_targphys(filename, bios_addr, bios_size);
      }
      if (bios_size<  0 || bios_size>  BIOS_SIZE) {
#3 lore raw
Quoted 11 lines · Anthony Liguori
Quoted 10 lines · Andreas Färber

Am 05.01.2012 18:13, schrieb Andreas Färber:

Quoted 9 lines

Since 0c90c52fab5ea92d7f12b29bfe26a7cd75d9efcb (ppc_prep: convert to memory API) OHW was "Trying to execute code outside RAM or ROM at 0xfff00700".

The BIOS MemoryRegion is created with a fixed size of 1 MiB. Ensure that the full size can be accessed since the exception vectors are located at 0xfff00000 and the BIOS may want to use them.

It thereby no longer depends on the actual BIOS binary size.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Cc Avi Kivity<[email protected]>
Cc Alexander Graf<[email protected]>

Ping! Is everyone okay with this? Should I send a PULL?

I would expect this to come through Alex's tree.

I don't want to have yet another maintainer behind me. PREP and normal PPC stuff have very little common code, so I would rather have Andreas send PULL requests directly.

Alex

#4 lore raw
Quoted 18 lines · Alexander Graf
Quoted 15 lines · Anthony Liguori
Quoted 14 lines · Andreas Färber

Am 05.01.2012 18:13, schrieb Andreas Färber:

Quoted 12 lines

Since 0c90c52fab5ea92d7f12b29bfe26a7cd75d9efcb (ppc_prep: convert to memory API) OHW was "Trying to execute code outside RAM or ROM at 0xfff00700".

The BIOS MemoryRegion is created with a fixed size of 1 MiB. Ensure that the full size can be accessed since the exception vectors are located at 0xfff00000 and the BIOS may want to use them.

It thereby no longer depends on the actual BIOS binary size.

Cc Avi Kivity<[email protected]>
Cc Alexander Graf<[email protected]>
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Ping! Is everyone okay with this? Should I send a PULL?

I would expect this to come through Alex's tree.

I don't want to have yet another maintainer behind me. PREP and normal PPC stuff have very little common code, so I would rather have Andreas send PULL requests directly.

Plus I know close to nothing about how PREP works ;). Code that does touch common stuff should still either go through my tree or get acked by me of course.

Alex

#5 lore raw

Am 11.01.2012 22:51, schrieb Alexander Graf:

Quoted 21 lines · Alexander Graf
Quoted 19 lines · Anthony Liguori
Quoted 16 lines · Andreas Färber
Quoted 14 lines

Am 05.01.2012 18:13, schrieb Andreas Färber:

Quoted 12 lines

Since 0c90c52fab5ea92d7f12b29bfe26a7cd75d9efcb (ppc_prep: convert to memory API) OHW was "Trying to execute code outside RAM or ROM at 0xfff00700".

The BIOS MemoryRegion is created with a fixed size of 1 MiB. Ensure that the full size can be accessed since the exception vectors are located at 0xfff00000 and the BIOS may want to use them.

It thereby no longer depends on the actual BIOS binary size.

Cc Avi Kivity<[email protected]>
Cc Alexander Graf<[email protected]>
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Ping! Is everyone okay with this? Should I send a PULL?

I would expect this to come through Alex's tree.

I don't want to have yet another maintainer behind me. PREP and normal PPC stuff have very little common code, so I would rather have Andreas send PULL requests directly.

Plus I know close to nothing about how PREP works ;). Code that does touch common stuff should still either go through my tree or get acked by me of course.

Please ack my MAINTAINERS update for prep_pci then. I would propose to do the equivalent with grackle and uni-north as part of my upcoming QOM updates, since today there's no obvious connection as far as get_maintainers.pl is concerned.

Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#6 lore raw
Quoted 26 lines · Andreas Färber

Am 11.01.2012 22:51, schrieb Alexander Graf:

Quoted 25 lines · Alexander Graf
Quoted 23 lines · Anthony Liguori
Quoted 19 lines · Andreas Färber
Quoted 8 lines

Am 05.01.2012 18:13, schrieb Andreas Färber:

Quoted 7 lines

Since 0c90c52fab5ea92d7f12b29bfe26a7cd75d9efcb (ppc_prep: convert to memory API) OHW was "Trying to execute code outside RAM or ROM at 0xfff00700".

The BIOS MemoryRegion is created with a fixed size of 1 MiB. Ensure that the full size can be accessed since the exception vectors are located at 0xfff00000 and the BIOS may want to use them.

Quoted 7 lines
Quoted 5 lines

It thereby no longer depends on the actual BIOS binary size.

Cc Avi Kivity<[email protected]>
Cc Alexander Graf<[email protected]>

Ping! Is everyone okay with this? Should I send a PULL?

I would expect this to come through Alex's tree.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

I don't want to have yet another maintainer behind me. PREP and normal PPC stuff have very little common code, so I would rather have Andreas send PULL requests directly.

Plus I know close to nothing about how PREP works ;). Code that does touch common stuff should still either go through my tree or get acked by me of course.

Please ack my MAINTAINERS update for prep_pci then. I would propose to do the equivalent with grackle and uni-north as part of my upcoming QOM updates, since today there's no obvious connection as far as get_maintainers.pl is concerned.

done :)

Alex

#7 lore raw
In reply to Alexander Graf
Quoted 18 lines · Alexander Graf
Quoted 15 lines · Anthony Liguori
Quoted 14 lines · Andreas Färber

Am 05.01.2012 18:13, schrieb Andreas Färber:

Quoted 12 lines

Since 0c90c52fab5ea92d7f12b29bfe26a7cd75d9efcb (ppc_prep: convert to memory API) OHW was "Trying to execute code outside RAM or ROM at 0xfff00700".

The BIOS MemoryRegion is created with a fixed size of 1 MiB. Ensure that the full size can be accessed since the exception vectors are located at 0xfff00000 and the BIOS may want to use them.

It thereby no longer depends on the actual BIOS binary size.

Cc Avi Kivity<[email protected]>
Cc Alexander Graf<[email protected]>
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Ping! Is everyone okay with this? Should I send a PULL?

I would expect this to come through Alex's tree.

I don't want to have yet another maintainer behind me. PREP and normal PPC stuff have very little common code, so I would rather have Andreas send PULL requests directly.

That's fine, I was just confused about who was maintaining prep...

If you're listed as M: in MAINTAINERS for a subsystem, and the patches have been posted for a reasonable time without reviews, then by all means, send a pull request.

Regards,

Anthony Liguori

Quoted 5 lines

Alex

#8 lore raw

PATCH 1/1 PREP: Finish qdev conversion

In reply to Andreas Färber

In your previous 2 patches you start off with a really nice qdev conversion, don't finish it unfortunately though. This patch goes the final mile and does what's necessary to address the comments I had.

---
 hw/ppc_prep.c |   14 ++++++++++-
 hw/prep_pci.c |   72 +++++++++++++++++++++++++++-----------------------------
 2 files changed, 48 insertions(+), 38 deletions(-)
hw/ppc_prep.c +13 -1
index dec059a..af80e43 100644
@@ -39,6 +39,7 @@
 #include "mc146818rtc.h"
 #include "blockdev.h"
 #include "exec-memory.h"
+#include "sysbus.h"
 
 //#define HARD_DEBUG_PPC_IO
 //#define DEBUG_PPC_IO
@@ -529,6 +530,7 @@ static void ppc_prep_init (ram_addr_t ram_size,
     int ppc_boot_device;
     DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
     DriveInfo *fd[MAX_FD];
+    DeviceState *dev;
 
     sysctrl = g_malloc0(sizeof(sysctrl_t));
 
@@ -633,7 +635,17 @@ static void ppc_prep_init (ram_addr_t ram_size,
     /* Hmm, prep has no pci-isa bridge ??? */
     isa_bus = isa_bus_new(NULL, get_system_io());
     i8259 = i8259_init(isa_bus, first_cpu->irq_inputs[PPC6xx_INPUT_INT]);
-    pci_bus = pci_prep_init(i8259, get_system_memory(), get_system_io());
+
+    dev = qdev_create(NULL, "raven-pcihost");
+    dev = sysbus_create_varargs("raven-pcihost", 0x80800000,
+                                i8259[9], i8259[11], i8259[9], i8259[11],
+                                NULL);
+    pci_bus = (PCIBus *)qdev_get_child_bus(dev, "pci.0");
+    if (!pci_bus) {
+        fprintf(stderr, "couldn't create PCI controller!\n");
+        exit(1);
+    }
+
     isa_bus_irqs(isa_bus, i8259);
     //    pci_bus = i440fx_init();
     /* Register 8 MB of ISA IO space (needed for non-contiguous map) */
hw/prep_pci.c +35 -37

134 lines not on this page · raw message

Signature · 1 line
1.6.0.2
#9 lore raw
In reply to Andreas Färber

Am 05.01.2012 18:13, schrieb Andreas Färber:

Quoted 7 lines

Since 0c90c52fab5ea92d7f12b29bfe26a7cd75d9efcb (ppc_prep: convert to memory API) OHW was "Trying to execute code outside RAM or ROM at 0xfff00700".

The BIOS MemoryRegion is created with a fixed size of 1 MiB. Ensure that the full size can be accessed since the exception vectors are located at 0xfff00000 and the BIOS may want to use them.

Quoted 6 lines

It thereby no longer depends on the actual BIOS binary size.

Cc Avi Kivity <[email protected]>
Cc Alexander Graf <[email protected]>

---

Applied to prep-up branch.

/-F