All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] prep: Fix offset of BIOS MemoryRegion
@ 2012-01-05 17:13 Andreas Färber
  2012-01-11 21:43 ` Andreas Färber
  2012-01-16 14:36 ` [Qemu-devel] [PATCH] prep: Fix offset of BIOS MemoryRegion Andreas Färber
  0 siblings, 2 replies; 10+ messages in thread
From: Andreas Färber @ 2012-01-05 17:13 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alexander Graf, qemu-ppc, Andreas Färber, Avi Kivity

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.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: Avi Kivity <avi@redhat.com>
Cc: Alexander Graf <agraf@suse.de>
---
 hw/ppc_prep.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/ppc_prep.c b/hw/ppc_prep.c
index 47dab3f..dec059a 100644
--- a/hw/ppc_prep.c
+++ b/hw/ppc_prep.c
@@ -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) {
-- 
1.7.7

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

* Re: [Qemu-devel] [PATCH] prep: Fix offset of BIOS MemoryRegion
  2012-01-05 17:13 [Qemu-devel] [PATCH] prep: Fix offset of BIOS MemoryRegion Andreas Färber
@ 2012-01-11 21:43 ` Andreas Färber
  2012-01-11 21:46   ` Anthony Liguori
  2012-01-11 23:12   ` [Qemu-devel] [PATCH] PREP: Finish qdev conversion Alexander Graf
  2012-01-16 14:36 ` [Qemu-devel] [PATCH] prep: Fix offset of BIOS MemoryRegion Andreas Färber
  1 sibling, 2 replies; 10+ messages in thread
From: Andreas Färber @ 2012-01-11 21:43 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-ppc, Alexander Graf, Avi Kivity

Am 05.01.2012 18:13, schrieb Andreas Färber:
> 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.
> 
> Signed-off-by: Andreas Färber <afaerber@suse.de>
> Cc: Avi Kivity <avi@redhat.com>
> Cc: Alexander Graf <agraf@suse.de>

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

Andreas

> ---
>  hw/ppc_prep.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/ppc_prep.c b/hw/ppc_prep.c
> index 47dab3f..dec059a 100644
> --- a/hw/ppc_prep.c
> +++ b/hw/ppc_prep.c
> @@ -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) {

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

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

* Re: [Qemu-devel] [PATCH] prep: Fix offset of BIOS MemoryRegion
  2012-01-11 21:43 ` Andreas Färber
@ 2012-01-11 21:46   ` Anthony Liguori
  2012-01-11 21:49     ` Alexander Graf
  2012-01-11 23:12   ` [Qemu-devel] [PATCH] PREP: Finish qdev conversion Alexander Graf
  1 sibling, 1 reply; 10+ messages in thread
From: Anthony Liguori @ 2012-01-11 21:46 UTC (permalink / raw)
  To: Andreas Färber; +Cc: Avi Kivity, qemu-ppc, qemu-devel, Alexander Graf

On 01/11/2012 03:43 PM, Andreas Färber wrote:
> Am 05.01.2012 18:13, schrieb Andreas Färber:
>> 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.
>>
>> Signed-off-by: Andreas Färber<afaerber@suse.de>
>> Cc: Avi Kivity<avi@redhat.com>
>> Cc: Alexander Graf<agraf@suse.de>
>
> Ping! Is everyone okay with this? Should I send a PULL?

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

Regards,

Anthony Liguori

>
> Andreas
>
>> ---
>>   hw/ppc_prep.c |    4 ++--
>>   1 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/hw/ppc_prep.c b/hw/ppc_prep.c
>> index 47dab3f..dec059a 100644
>> --- a/hw/ppc_prep.c
>> +++ b/hw/ppc_prep.c
>> @@ -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) {
>

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

* Re: [Qemu-devel] [PATCH] prep: Fix offset of BIOS MemoryRegion
  2012-01-11 21:46   ` Anthony Liguori
@ 2012-01-11 21:49     ` Alexander Graf
  2012-01-11 21:51       ` [Qemu-devel] [Qemu-ppc] " Alexander Graf
  2012-01-11 22:04       ` [Qemu-devel] " Anthony Liguori
  0 siblings, 2 replies; 10+ messages in thread
From: Alexander Graf @ 2012-01-11 21:49 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Avi Kivity, qemu-ppc, Andreas Färber, qemu-devel


On 11.01.2012, at 22:46, Anthony Liguori wrote:

> On 01/11/2012 03:43 PM, Andreas Färber wrote:
>> Am 05.01.2012 18:13, schrieb Andreas Färber:
>>> 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.
>>> 
>>> Signed-off-by: Andreas Färber<afaerber@suse.de>
>>> Cc: Avi Kivity<avi@redhat.com>
>>> Cc: Alexander Graf<agraf@suse.de>
>> 
>> 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

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

* Re: [Qemu-devel] [Qemu-ppc] [PATCH] prep: Fix offset of BIOS MemoryRegion
  2012-01-11 21:49     ` Alexander Graf
@ 2012-01-11 21:51       ` Alexander Graf
  2012-01-11 21:55         ` Andreas Färber
  2012-01-11 22:04       ` [Qemu-devel] " Anthony Liguori
  1 sibling, 1 reply; 10+ messages in thread
From: Alexander Graf @ 2012-01-11 21:51 UTC (permalink / raw)
  To: Anthony Liguori
  Cc: qemu-devel Developers, qemu-ppc, Avi Kivity, Andreas Färber


On 11.01.2012, at 22:49, Alexander Graf wrote:

> 
> On 11.01.2012, at 22:46, Anthony Liguori wrote:
> 
>> On 01/11/2012 03:43 PM, Andreas Färber wrote:
>>> Am 05.01.2012 18:13, schrieb Andreas Färber:
>>>> 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.
>>>> 
>>>> Signed-off-by: Andreas Färber<afaerber@suse.de>
>>>> Cc: Avi Kivity<avi@redhat.com>
>>>> Cc: Alexander Graf<agraf@suse.de>
>>> 
>>> 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

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

* Re: [Qemu-devel] [Qemu-ppc] [PATCH] prep: Fix offset of BIOS MemoryRegion
  2012-01-11 21:51       ` [Qemu-devel] [Qemu-ppc] " Alexander Graf
@ 2012-01-11 21:55         ` Andreas Färber
  2012-01-11 21:58           ` Alexander Graf
  0 siblings, 1 reply; 10+ messages in thread
From: Andreas Färber @ 2012-01-11 21:55 UTC (permalink / raw)
  To: Alexander Graf; +Cc: qemu-ppc, Avi Kivity, qemu-devel Developers

Am 11.01.2012 22:51, schrieb Alexander Graf:
> 
> On 11.01.2012, at 22:49, Alexander Graf wrote:
> 
>>
>> On 11.01.2012, at 22:46, Anthony Liguori wrote:
>>
>>> On 01/11/2012 03:43 PM, Andreas Färber wrote:
>>>> Am 05.01.2012 18:13, schrieb Andreas Färber:
>>>>> 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.
>>>>>
>>>>> Signed-off-by: Andreas Färber<afaerber@suse.de>
>>>>> Cc: Avi Kivity<avi@redhat.com>
>>>>> Cc: Alexander Graf<agraf@suse.de>
>>>>
>>>> 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

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

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

* Re: [Qemu-devel] [Qemu-ppc] [PATCH] prep: Fix offset of BIOS MemoryRegion
  2012-01-11 21:55         ` Andreas Färber
@ 2012-01-11 21:58           ` Alexander Graf
  0 siblings, 0 replies; 10+ messages in thread
From: Alexander Graf @ 2012-01-11 21:58 UTC (permalink / raw)
  To: Andreas Färber; +Cc: qemu-ppc, Avi Kivity, qemu-devel Developers


On 11.01.2012, at 22:55, Andreas Färber wrote:

> Am 11.01.2012 22:51, schrieb Alexander Graf:
>> 
>> On 11.01.2012, at 22:49, Alexander Graf wrote:
>> 
>>> 
>>> On 11.01.2012, at 22:46, Anthony Liguori wrote:
>>> 
>>>> On 01/11/2012 03:43 PM, Andreas Färber wrote:
>>>>> Am 05.01.2012 18:13, schrieb Andreas Färber:
>>>>>> 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.
>>>>>> 
>>>>>> Signed-off-by: Andreas Färber<afaerber@suse.de>
>>>>>> Cc: Avi Kivity<avi@redhat.com>
>>>>>> Cc: Alexander Graf<agraf@suse.de>
>>>>> 
>>>>> 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.

done :)


Alex

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

* Re: [Qemu-devel] [PATCH] prep: Fix offset of BIOS MemoryRegion
  2012-01-11 21:49     ` Alexander Graf
  2012-01-11 21:51       ` [Qemu-devel] [Qemu-ppc] " Alexander Graf
@ 2012-01-11 22:04       ` Anthony Liguori
  1 sibling, 0 replies; 10+ messages in thread
From: Anthony Liguori @ 2012-01-11 22:04 UTC (permalink / raw)
  To: Alexander Graf; +Cc: qemu-devel, qemu-ppc, Avi Kivity, Andreas Färber

On 01/11/2012 03:49 PM, Alexander Graf wrote:
>
> On 11.01.2012, at 22:46, Anthony Liguori wrote:
>
>> On 01/11/2012 03:43 PM, Andreas Färber wrote:
>>> Am 05.01.2012 18:13, schrieb Andreas Färber:
>>>> 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.
>>>>
>>>> Signed-off-by: Andreas Färber<afaerber@suse.de>
>>>> Cc: Avi Kivity<avi@redhat.com>
>>>> Cc: Alexander Graf<agraf@suse.de>
>>>
>>> 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

>
>
> Alex
>
>

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

* [Qemu-devel] [PATCH] PREP: Finish qdev conversion
  2012-01-11 21:43 ` Andreas Färber
  2012-01-11 21:46   ` Anthony Liguori
@ 2012-01-11 23:12   ` Alexander Graf
  1 sibling, 0 replies; 10+ messages in thread
From: Alexander Graf @ 2012-01-11 23:12 UTC (permalink / raw)
  To: Andreas Färber
  Cc: qemu-ppc, qemu-devel@nongnu.org Developers, Avi Kivity

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.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 hw/ppc_prep.c |   14 ++++++++++-
 hw/prep_pci.c |   72 +++++++++++++++++++++++++++-----------------------------
 2 files changed, 48 insertions(+), 38 deletions(-)

diff --git a/hw/ppc_prep.c b/hw/ppc_prep.c
index dec059a..af80e43 100644
--- a/hw/ppc_prep.c
+++ b/hw/ppc_prep.c
@@ -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) */
diff --git a/hw/prep_pci.c b/hw/prep_pci.c
index 2ff6b8c..015f029 100644
--- a/hw/prep_pci.c
+++ b/hw/prep_pci.c
@@ -26,8 +26,12 @@
 #include "pci.h"
 #include "pci_host.h"
 #include "prep_pci.h"
+#include "exec-memory.h"
 
-typedef PCIHostState PREPPCIState;
+typedef struct PREPPCIState {
+    PCIHostState pci_state;
+    qemu_irq irq[4];
+} PREPPCIState;
 
 typedef struct RavenPCIState {
     PCIDevice dev;
@@ -47,28 +51,28 @@ static inline uint32_t PPC_PCIIO_config(target_phys_addr_t addr)
 static void PPC_PCIIO_writeb (void *opaque, target_phys_addr_t addr, uint32_t val)
 {
     PREPPCIState *s = opaque;
-    pci_data_write(s->bus, PPC_PCIIO_config(addr), val, 1);
+    pci_data_write(s->pci_state.bus, PPC_PCIIO_config(addr), val, 1);
 }
 
 static void PPC_PCIIO_writew (void *opaque, target_phys_addr_t addr, uint32_t val)
 {
     PREPPCIState *s = opaque;
     val = bswap16(val);
-    pci_data_write(s->bus, PPC_PCIIO_config(addr), val, 2);
+    pci_data_write(s->pci_state.bus, PPC_PCIIO_config(addr), val, 2);
 }
 
 static void PPC_PCIIO_writel (void *opaque, target_phys_addr_t addr, uint32_t val)
 {
     PREPPCIState *s = opaque;
     val = bswap32(val);
-    pci_data_write(s->bus, PPC_PCIIO_config(addr), val, 4);
+    pci_data_write(s->pci_state.bus, PPC_PCIIO_config(addr), val, 4);
 }
 
 static uint32_t PPC_PCIIO_readb (void *opaque, target_phys_addr_t addr)
 {
     PREPPCIState *s = opaque;
     uint32_t val;
-    val = pci_data_read(s->bus, PPC_PCIIO_config(addr), 1);
+    val = pci_data_read(s->pci_state.bus, PPC_PCIIO_config(addr), 1);
     return val;
 }
 
@@ -76,7 +80,7 @@ static uint32_t PPC_PCIIO_readw (void *opaque, target_phys_addr_t addr)
 {
     PREPPCIState *s = opaque;
     uint32_t val;
-    val = pci_data_read(s->bus, PPC_PCIIO_config(addr), 2);
+    val = pci_data_read(s->pci_state.bus, PPC_PCIIO_config(addr), 2);
     val = bswap16(val);
     return val;
 }
@@ -85,7 +89,7 @@ static uint32_t PPC_PCIIO_readl (void *opaque, target_phys_addr_t addr)
 {
     PREPPCIState *s = opaque;
     uint32_t val;
-    val = pci_data_read(s->bus, PPC_PCIIO_config(addr), 4);
+    val = pci_data_read(s->pci_state.bus, PPC_PCIIO_config(addr), 4);
     val = bswap32(val);
     return val;
 }
@@ -106,49 +110,43 @@ static int prep_map_irq(PCIDevice *pci_dev, int irq_num)
 static void prep_set_irq(void *opaque, int irq_num, int level)
 {
     qemu_irq *pic = opaque;
-
-    qemu_set_irq(pic[(irq_num & 1) ? 11 : 9] , level);
+    qemu_set_irq(pic[irq_num], level);
 }
 
-PCIBus *pci_prep_init(qemu_irq *pic,
-                      MemoryRegion *address_space_mem,
-                      MemoryRegion *address_space_io)
+static int raven_pcihost_init(SysBusDevice *dev)
 {
-    DeviceState *dev;
+    PCIHostState *h;
     PREPPCIState *s;
+    MemoryRegion *address_space_mem = get_system_memory();
+    MemoryRegion *address_space_io = get_system_io();
+    int i;
+
+    h = FROM_SYSBUS(PCIHostState, sysbus_from_qdev(dev));
+    s = DO_UPCAST(PREPPCIState, pci_state, h);
+
+    for (i = 0; i < ARRAY_SIZE(s->irq); i++) {
+        sysbus_init_irq(dev, &s->irq[i]);
+    }
 
-    dev = qdev_create(NULL, "raven-pcihost");
-    s = FROM_SYSBUS(PREPPCIState, sysbus_from_qdev(dev));
-    s->address_space = address_space_mem;
-    s->bus = pci_register_bus(&s->busdev.qdev, "pci",
-                              prep_set_irq, prep_map_irq, pic,
+    h->bus = pci_register_bus(&h->busdev.qdev, NULL,
+                              prep_set_irq, prep_map_irq, s->irq,
                               address_space_mem,
                               address_space_io,
                               0, 4);
-    qdev_init_nofail(dev);
-    qdev_property_add_child(qdev_get_root(), "raven", dev, NULL);
+    pci_create_simple(h->bus, 0, "raven");
 
-    memory_region_init_io(&s->mmcfg, &PPC_PCIIO_ops, s, "pciio", 0x00400000);
-    memory_region_add_subregion(address_space_mem, 0x80800000, &s->mmcfg);
-
-    pci_create_simple(s->bus, 0, "raven");
-
-    return s->bus;
-}
-
-static int raven_pcihost_init(SysBusDevice *dev)
-{
-    PREPPCIState *s = FROM_SYSBUS(PREPPCIState, dev);
+    memory_region_init_io(&h->mmcfg, &PPC_PCIIO_ops, s, "pciio", 0x00400000);
+    sysbus_init_mmio(dev, &h->mmcfg);
 
-    memory_region_init_io(&s->conf_mem, &pci_host_conf_be_ops, s,
+    memory_region_init_io(&h->conf_mem, &pci_host_conf_be_ops, s,
                           "pci-conf-idx", 1);
-    sysbus_add_io(dev, 0xcf8, &s->conf_mem);
-    sysbus_init_ioports(&s->busdev, 0xcf8, 1);
+    sysbus_add_io(dev, 0xcf8, &h->conf_mem);
+    sysbus_init_ioports(&h->busdev, 0xcf8, 1);
 
-    memory_region_init_io(&s->data_mem, &pci_host_data_be_ops, s,
+    memory_region_init_io(&h->data_mem, &pci_host_data_be_ops, s,
                           "pci-conf-data", 1);
-    sysbus_add_io(dev, 0xcfc, &s->data_mem);
-    sysbus_init_ioports(&s->busdev, 0xcfc, 1);
+    sysbus_add_io(dev, 0xcfc, &h->data_mem);
+    sysbus_init_ioports(&h->busdev, 0xcfc, 1);
 
     return 0;
 }
-- 
1.6.0.2

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

* Re: [Qemu-devel] [PATCH] prep: Fix offset of BIOS MemoryRegion
  2012-01-05 17:13 [Qemu-devel] [PATCH] prep: Fix offset of BIOS MemoryRegion Andreas Färber
  2012-01-11 21:43 ` Andreas Färber
@ 2012-01-16 14:36 ` Andreas Färber
  1 sibling, 0 replies; 10+ messages in thread
From: Andreas Färber @ 2012-01-16 14:36 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-ppc, Alexander Graf, Avi Kivity

Am 05.01.2012 18:13, schrieb Andreas Färber:
> 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.
> 
> Signed-off-by: Andreas Färber <afaerber@suse.de>
> Cc: Avi Kivity <avi@redhat.com>
> Cc: Alexander Graf <agraf@suse.de>
> ---

Applied to prep-up branch.

/-F

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

end of thread, other threads:[~2012-01-16 14:38 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-05 17:13 [Qemu-devel] [PATCH] prep: Fix offset of BIOS MemoryRegion Andreas Färber
2012-01-11 21:43 ` Andreas Färber
2012-01-11 21:46   ` Anthony Liguori
2012-01-11 21:49     ` Alexander Graf
2012-01-11 21:51       ` [Qemu-devel] [Qemu-ppc] " Alexander Graf
2012-01-11 21:55         ` Andreas Färber
2012-01-11 21:58           ` Alexander Graf
2012-01-11 22:04       ` [Qemu-devel] " Anthony Liguori
2012-01-11 23:12   ` [Qemu-devel] [PATCH] PREP: Finish qdev conversion Alexander Graf
2012-01-16 14:36 ` [Qemu-devel] [PATCH] prep: Fix offset of BIOS MemoryRegion Andreas Färber

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.