* [Qemu-devel] [PATCH prep for-1.5] prep: Add ELF support for -bios
@ 2013-04-28 0:32 Andreas Färber
2013-04-28 5:57 ` Hervé Poussineau
2013-04-28 9:44 ` Alexander Graf
0 siblings, 2 replies; 7+ messages in thread
From: Andreas Färber @ 2013-04-28 0:32 UTC (permalink / raw)
To: qemu-devel
Cc: mark.cave-ayland, Alexander Graf, chouteau, hpoussin,
Andreas Färber, open list:PReP
This prepares for switching from OpenHack'Ware to OpenBIOS.
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
---
hw/ppc/prep.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
index cceab3e..9bb0119 100644
--- a/hw/ppc/prep.c
+++ b/hw/ppc/prep.c
@@ -41,6 +41,7 @@
#include "sysemu/blockdev.h"
#include "sysemu/arch_init.h"
#include "exec/address-spaces.h"
+#include "elf.h"
//#define HARD_DEBUG_PPC_IO
//#define DEBUG_PPC_IO
@@ -502,18 +503,22 @@ static void ppc_prep_init(QEMUMachineInitArgs *args)
bios_name = BIOS_FILENAME;
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
if (filename) {
- bios_size = get_image_size(filename);
+ bios_size = load_elf(filename, NULL, NULL, NULL,
+ NULL, NULL, 1, ELF_MACHINE, 0);
+ if (bios_size < 0) {
+ bios_size = get_image_size(filename);
+ if (bios_size > 0 && bios_size <= BIOS_SIZE) {
+ hwaddr bios_addr;
+ bios_size = (bios_size + 0xfff) & ~0xfff;
+ bios_addr = (uint32_t)(-bios_size);
+ bios_size = load_image_targphys(filename, bios_addr, bios_size);
+ }
+ }
} else {
bios_size = -1;
}
- if (bios_size > 0 && bios_size <= BIOS_SIZE) {
- hwaddr bios_addr;
- bios_size = (bios_size + 0xfff) & ~0xfff;
- bios_addr = (uint32_t)(-bios_size);
- bios_size = load_image_targphys(filename, bios_addr, bios_size);
- }
if (bios_size < 0 || bios_size > BIOS_SIZE) {
- hw_error("qemu: could not load PPC PREP bios '%s'\n", bios_name);
+ fprintf(stderr, "qemu: could not load PPC PREP bios '%s'\n", bios_name);
}
if (filename) {
g_free(filename);
--
1.8.1.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH prep for-1.5] prep: Add ELF support for -bios
2013-04-28 0:32 [Qemu-devel] [PATCH prep for-1.5] prep: Add ELF support for -bios Andreas Färber
@ 2013-04-28 5:57 ` Hervé Poussineau
2013-04-28 9:44 ` Alexander Graf
1 sibling, 0 replies; 7+ messages in thread
From: Hervé Poussineau @ 2013-04-28 5:57 UTC (permalink / raw)
To: Andreas Färber
Cc: mark.cave-ayland, qemu-devel, chouteau, Alexander Graf, hpoussin,
PReP
Andreas Färber a écrit :
> This prepares for switching from OpenHack'Ware to OpenBIOS.
>
> Signed-off-by: Andreas Färber <andreas.faerber@web.de>
> ---
> hw/ppc/prep.c | 21 +++++++++++++--------
> 1 file changed, 13 insertions(+), 8 deletions(-)
>
>
Acked-by: Hervé Poussineau <hpoussin@reactos.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH prep for-1.5] prep: Add ELF support for -bios
2013-04-28 0:32 [Qemu-devel] [PATCH prep for-1.5] prep: Add ELF support for -bios Andreas Färber
2013-04-28 5:57 ` Hervé Poussineau
@ 2013-04-28 9:44 ` Alexander Graf
2013-04-28 10:16 ` Andreas Färber
1 sibling, 1 reply; 7+ messages in thread
From: Alexander Graf @ 2013-04-28 9:44 UTC (permalink / raw)
To: Andreas Färber
Cc: open list:PReP, hpoussin, mark.cave-ayland, qemu-devel, chouteau
On 28.04.2013, at 02:32, Andreas Färber wrote:
> This prepares for switching from OpenHack'Ware to OpenBIOS.
>
> Signed-off-by: Andreas Färber <andreas.faerber@web.de>
> ---
> hw/ppc/prep.c | 21 +++++++++++++--------
> 1 file changed, 13 insertions(+), 8 deletions(-)
>
> diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
> index cceab3e..9bb0119 100644
> --- a/hw/ppc/prep.c
> +++ b/hw/ppc/prep.c
> @@ -41,6 +41,7 @@
> #include "sysemu/blockdev.h"
> #include "sysemu/arch_init.h"
> #include "exec/address-spaces.h"
> +#include "elf.h"
>
> //#define HARD_DEBUG_PPC_IO
> //#define DEBUG_PPC_IO
> @@ -502,18 +503,22 @@ static void ppc_prep_init(QEMUMachineInitArgs *args)
> bios_name = BIOS_FILENAME;
> filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
> if (filename) {
> - bios_size = get_image_size(filename);
> + bios_size = load_elf(filename, NULL, NULL, NULL,
> + NULL, NULL, 1, ELF_MACHINE, 0);
This leaves bios_addr unset, no?
> + if (bios_size < 0) {
> + bios_size = get_image_size(filename);
> + if (bios_size > 0 && bios_size <= BIOS_SIZE) {
> + hwaddr bios_addr;
> + bios_size = (bios_size + 0xfff) & ~0xfff;
> + bios_addr = (uint32_t)(-bios_size);
> + bios_size = load_image_targphys(filename, bios_addr, bios_size);
> + }
> + }
> } else {
> bios_size = -1;
> }
> - if (bios_size > 0 && bios_size <= BIOS_SIZE) {
> - hwaddr bios_addr;
> - bios_size = (bios_size + 0xfff) & ~0xfff;
> - bios_addr = (uint32_t)(-bios_size);
> - bios_size = load_image_targphys(filename, bios_addr, bios_size);
> - }
> if (bios_size < 0 || bios_size > BIOS_SIZE) {
> - hw_error("qemu: could not load PPC PREP bios '%s'\n", bios_name);
> + fprintf(stderr, "qemu: could not load PPC PREP bios '%s'\n", bios_name);
You probably want to split this up. Bios_size < 0 means that image loading failed, which is always a fatal error. Bios_size > BIOS_SIZE should only really apply to flat image loading, I think.
Alex
> }
> if (filename) {
> g_free(filename);
> --
> 1.8.1.4
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH prep for-1.5] prep: Add ELF support for -bios
2013-04-28 9:44 ` Alexander Graf
@ 2013-04-28 10:16 ` Andreas Färber
2013-04-28 10:22 ` Alexander Graf
2013-04-29 10:14 ` Fabien Chouteau
0 siblings, 2 replies; 7+ messages in thread
From: Andreas Färber @ 2013-04-28 10:16 UTC (permalink / raw)
To: Alexander Graf, Paolo Bonzini
Cc: PReP, mark.cave-ayland, Hervé Poussineau, qemu-devel,
chouteau
Am 28.04.2013 11:44, schrieb Alexander Graf:
>
> On 28.04.2013, at 02:32, Andreas Färber wrote:
>
>> This prepares for switching from OpenHack'Ware to OpenBIOS.
>>
>> Signed-off-by: Andreas Färber <andreas.faerber@web.de>
>> ---
>> hw/ppc/prep.c | 21 +++++++++++++--------
>> 1 file changed, 13 insertions(+), 8 deletions(-)
>>
>> diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
>> index cceab3e..9bb0119 100644
>> --- a/hw/ppc/prep.c
>> +++ b/hw/ppc/prep.c
>> @@ -41,6 +41,7 @@
>> #include "sysemu/blockdev.h"
>> #include "sysemu/arch_init.h"
>> #include "exec/address-spaces.h"
>> +#include "elf.h"
>>
>> //#define HARD_DEBUG_PPC_IO
>> //#define DEBUG_PPC_IO
>> @@ -502,18 +503,22 @@ static void ppc_prep_init(QEMUMachineInitArgs *args)
>> bios_name = BIOS_FILENAME;
>> filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
>> if (filename) {
>> - bios_size = get_image_size(filename);
>> + bios_size = load_elf(filename, NULL, NULL, NULL,
>> + NULL, NULL, 1, ELF_MACHINE, 0);
>
> This leaves bios_addr unset, no?
bios_addr is not yet defined in this scope and doesn't seem needed here?
It's been a while that I wrote this (extracted it from a larger patch
since Fabien had a need for ELF support), thought I copied this from one
of the other ppc machines at the time...
>> + if (bios_size < 0) {
>> + bios_size = get_image_size(filename);
>> + if (bios_size > 0 && bios_size <= BIOS_SIZE) {
>> + hwaddr bios_addr;
>> + bios_size = (bios_size + 0xfff) & ~0xfff;
>> + bios_addr = (uint32_t)(-bios_size);
>> + bios_size = load_image_targphys(filename, bios_addr, bios_size);
>> + }
>> + }
>> } else {
>> bios_size = -1;
>> }
>> - if (bios_size > 0 && bios_size <= BIOS_SIZE) {
>> - hwaddr bios_addr;
>> - bios_size = (bios_size + 0xfff) & ~0xfff;
>> - bios_addr = (uint32_t)(-bios_size);
>> - bios_size = load_image_targphys(filename, bios_addr, bios_size);
>> - }
>> if (bios_size < 0 || bios_size > BIOS_SIZE) {
>> - hw_error("qemu: could not load PPC PREP bios '%s'\n", bios_name);
>> + fprintf(stderr, "qemu: could not load PPC PREP bios '%s'\n", bios_name);
>
> You probably want to split this up. Bios_size < 0 means that image loading failed, which is always a fatal error. Bios_size > BIOS_SIZE should only really apply to flat image loading, I think.
Sure, I might even pull that out of this patch for - I believe - this
was fixing a crash since the CPU was not yet properly initialized at
this point. IIUC you are suggesting to move the bios_size > BIOS_SIZE
check to after get_image_size() and leave only the bios_size < 0 check
here for both code paths.
Andreas
P.S. I am happy about your review comments, but you were not
intentionally CC'ed on a PReP patch - this is apparently the result of
Paolo having used hw/ppc/ pattern in the ppc TCG guest core section,
which used to be target-ppc/ only. Should we exclude prep.c and future
PReP files or even hw/ppc/ from that MAINTAINERS section? Similar
question for most other architectures - TCG translation maintenance and
device maintenance used to be two different responsibilities.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH prep for-1.5] prep: Add ELF support for -bios
2013-04-28 10:16 ` Andreas Färber
@ 2013-04-28 10:22 ` Alexander Graf
2013-04-28 10:30 ` Andreas Färber
2013-04-29 10:14 ` Fabien Chouteau
1 sibling, 1 reply; 7+ messages in thread
From: Alexander Graf @ 2013-04-28 10:22 UTC (permalink / raw)
To: Andreas Färber
Cc: mark.cave-ayland, qemu-devel, chouteau, PReP, Paolo Bonzini,
Hervé Poussineau
On 28.04.2013, at 12:16, Andreas Färber wrote:
> Am 28.04.2013 11:44, schrieb Alexander Graf:
>>
>> On 28.04.2013, at 02:32, Andreas Färber wrote:
>>
>>> This prepares for switching from OpenHack'Ware to OpenBIOS.
>>>
>>> Signed-off-by: Andreas Färber <andreas.faerber@web.de>
>>> ---
>>> hw/ppc/prep.c | 21 +++++++++++++--------
>>> 1 file changed, 13 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
>>> index cceab3e..9bb0119 100644
>>> --- a/hw/ppc/prep.c
>>> +++ b/hw/ppc/prep.c
>>> @@ -41,6 +41,7 @@
>>> #include "sysemu/blockdev.h"
>>> #include "sysemu/arch_init.h"
>>> #include "exec/address-spaces.h"
>>> +#include "elf.h"
>>>
>>> //#define HARD_DEBUG_PPC_IO
>>> //#define DEBUG_PPC_IO
>>> @@ -502,18 +503,22 @@ static void ppc_prep_init(QEMUMachineInitArgs *args)
>>> bios_name = BIOS_FILENAME;
>>> filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
>>> if (filename) {
>>> - bios_size = get_image_size(filename);
>>> + bios_size = load_elf(filename, NULL, NULL, NULL,
>>> + NULL, NULL, 1, ELF_MACHINE, 0);
>>
>> This leaves bios_addr unset, no?
>
> bios_addr is not yet defined in this scope and doesn't seem needed here?
> It's been a while that I wrote this (extracted it from a larger patch
> since Fabien had a need for ELF support), thought I copied this from one
> of the other ppc machines at the time...
Ah, sorry, my bad :). I didn't see that bios_addr was only defined inside the branch to specify where to load the image too. Interesting code ;).
>
>>> + if (bios_size < 0) {
>>> + bios_size = get_image_size(filename);
>>> + if (bios_size > 0 && bios_size <= BIOS_SIZE) {
>>> + hwaddr bios_addr;
>>> + bios_size = (bios_size + 0xfff) & ~0xfff;
>>> + bios_addr = (uint32_t)(-bios_size);
>>> + bios_size = load_image_targphys(filename, bios_addr, bios_size);
>>> + }
>>> + }
>>> } else {
>>> bios_size = -1;
>>> }
>>> - if (bios_size > 0 && bios_size <= BIOS_SIZE) {
>>> - hwaddr bios_addr;
>>> - bios_size = (bios_size + 0xfff) & ~0xfff;
>>> - bios_addr = (uint32_t)(-bios_size);
>>> - bios_size = load_image_targphys(filename, bios_addr, bios_size);
>>> - }
>>> if (bios_size < 0 || bios_size > BIOS_SIZE) {
>>> - hw_error("qemu: could not load PPC PREP bios '%s'\n", bios_name);
>>> + fprintf(stderr, "qemu: could not load PPC PREP bios '%s'\n", bios_name);
>>
>> You probably want to split this up. Bios_size < 0 means that image loading failed, which is always a fatal error. Bios_size > BIOS_SIZE should only really apply to flat image loading, I think.
>
> Sure, I might even pull that out of this patch for - I believe - this
> was fixing a crash since the CPU was not yet properly initialized at
> this point. IIUC you are suggesting to move the bios_size > BIOS_SIZE
> check to after get_image_size() and leave only the bios_size < 0 check
> here for both code paths.
Yes :).
>
> Andreas
>
> P.S. I am happy about your review comments, but you were not
> intentionally CC'ed on a PReP patch - this is apparently the result of
> Paolo having used hw/ppc/ pattern in the ppc TCG guest core section,
> which used to be target-ppc/ only. Should we exclude prep.c and future
> PReP files or even hw/ppc/ from that MAINTAINERS section? Similar
I think having hw/ppc at least listed as CC to qemu-ppc@nongnu.org is a good idea. I'm not sure how much hassle it'll be to split maintainership inside of a directory. Does it mean we have to list all files individually? That'd be annoying :).
Alex
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH prep for-1.5] prep: Add ELF support for -bios
2013-04-28 10:22 ` Alexander Graf
@ 2013-04-28 10:30 ` Andreas Färber
0 siblings, 0 replies; 7+ messages in thread
From: Andreas Färber @ 2013-04-28 10:30 UTC (permalink / raw)
To: Alexander Graf
Cc: mark.cave-ayland, qemu-devel, chouteau, PReP, Paolo Bonzini,
Hervé Poussineau
Am 28.04.2013 12:22, schrieb Alexander Graf:
>
> On 28.04.2013, at 12:16, Andreas Färber wrote:
>
>> P.S. I am happy about your review comments, but you were not
>> intentionally CC'ed on a PReP patch - this is apparently the result of
>> Paolo having used hw/ppc/ pattern in the ppc TCG guest core section,
>> which used to be target-ppc/ only. Should we exclude prep.c and future
>> PReP files or even hw/ppc/ from that MAINTAINERS section? Similar
>
> I think having hw/ppc at least listed as CC to qemu-ppc@nongnu.org is a good idea. I'm not sure how much hassle it'll be to split maintainership inside of a directory. Does it mean we have to list all files individually? That'd be annoying :).
Well, what I was rather thinking of was removing F: hw/foo/ from all
"Guest CPU cores (TCG)" sections. We already have boards listed
individually under "PowerPC Machines", so this seems duplicate here;
alternatively it would certainly be possible to add a new heading for
hw/foo/ entries. I do not remember seeing any discussion about this
MAINTAINERS change nor us ack'ing it, so reverting would seem the most
natural solution.
Exclusion in the current scheme would mean adding:
X: hw/ppc/prep.c
Andreas
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH prep for-1.5] prep: Add ELF support for -bios
2013-04-28 10:16 ` Andreas Färber
2013-04-28 10:22 ` Alexander Graf
@ 2013-04-29 10:14 ` Fabien Chouteau
1 sibling, 0 replies; 7+ messages in thread
From: Fabien Chouteau @ 2013-04-29 10:14 UTC (permalink / raw)
To: Andreas Färber
Cc: mark.cave-ayland, qemu-devel, Alexander Graf, PReP, Paolo Bonzini,
Hervé Poussineau
On 04/28/2013 12:16 PM, Andreas Färber wrote:
> Am 28.04.2013 11:44, schrieb Alexander Graf:
>>
>> On 28.04.2013, at 02:32, Andreas Färber wrote:
>>
>>> This prepares for switching from OpenHack'Ware to OpenBIOS.
>>>
>>> Signed-off-by: Andreas Färber <andreas.faerber@web.de>
>>> ---
>>> hw/ppc/prep.c | 21 +++++++++++++--------
>>> 1 file changed, 13 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
>>> index cceab3e..9bb0119 100644
>>> --- a/hw/ppc/prep.c
>>> +++ b/hw/ppc/prep.c
>>> @@ -41,6 +41,7 @@
>>> #include "sysemu/blockdev.h"
>>> #include "sysemu/arch_init.h"
>>> #include "exec/address-spaces.h"
>>> +#include "elf.h"
>>>
>>> //#define HARD_DEBUG_PPC_IO
>>> //#define DEBUG_PPC_IO
>>> @@ -502,18 +503,22 @@ static void ppc_prep_init(QEMUMachineInitArgs *args)
>>> bios_name = BIOS_FILENAME;
>>> filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
>>> if (filename) {
>>> - bios_size = get_image_size(filename);
>>> + bios_size = load_elf(filename, NULL, NULL, NULL,
>>> + NULL, NULL, 1, ELF_MACHINE, 0);
>>
>> This leaves bios_addr unset, no?
>
> bios_addr is not yet defined in this scope and doesn't seem needed here?
> It's been a while that I wrote this (extracted it from a larger patch
> since Fabien had a need for ELF support), thought I copied this from one
> of the other ppc machines at the time...
Thanks Andreas, that will be very useful.
--
Fabien Chouteau
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-04-29 10:14 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-28 0:32 [Qemu-devel] [PATCH prep for-1.5] prep: Add ELF support for -bios Andreas Färber
2013-04-28 5:57 ` Hervé Poussineau
2013-04-28 9:44 ` Alexander Graf
2013-04-28 10:16 ` Andreas Färber
2013-04-28 10:22 ` Alexander Graf
2013-04-28 10:30 ` Andreas Färber
2013-04-29 10:14 ` Fabien Chouteau
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).