Patchwork prep: Fix offset of BIOS MemoryRegion

login
register
mail settings
Submitter Andreas Färber
Date Jan. 5, 2012, 5:13 p.m.
Message ID <1325783595-22962-1-git-send-email-afaerber@suse.de>
Download mbox | patch
Permalink /patch/134519/
State New
Headers show

Comments

Andreas Färber - Jan. 5, 2012, 5:13 p.m.
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(-)
Andreas Färber - Jan. 11, 2012, 9:43 p.m.
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) {
Anthony Liguori - Jan. 11, 2012, 9:46 p.m.
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) {
>
Alexander Graf - Jan. 11, 2012, 9:49 p.m.
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
Alexander Graf - Jan. 11, 2012, 9:51 p.m.
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
Andreas Färber - Jan. 11, 2012, 9:55 p.m.
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
Alexander Graf - Jan. 11, 2012, 9:58 p.m.
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
Anthony Liguori - Jan. 11, 2012, 10:04 p.m.
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
>
>
Andreas Färber - Jan. 16, 2012, 2:36 p.m.
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

Patch

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) {