* [Qemu-devel] [PATCH] ppc: initialize GPRs as per epapr
@ 2013-04-26 6:17 Bharat Bhushan
2013-04-26 6:21 ` Alexander Graf
0 siblings, 1 reply; 6+ messages in thread
From: Bharat Bhushan @ 2013-04-26 6:17 UTC (permalink / raw)
To: qemu-ppc, qemu-devel, agraf, scottwood; +Cc: Bharat Bhushan, Stuart Yoder
ePAPR defines the initial values of cpu registers. This patch initialize
the GPRs as per ePAPR specification.
This resolves the issue of guest reboot/reset (guest hang on reboot).
Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
Signed-off-by: Stuart Yoder <stuart.yoder@freescale.com>
---
hw/ppc/e500.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index c1bdb6b..a47f976 100644
--- a/hw/ppc/e500.c
+++ b/hw/ppc/e500.c
@@ -37,6 +37,7 @@
#include "qemu/host-utils.h"
#include "hw/pci-host/ppce500.h"
+#define EPAPR_MAGIC (0x45504150)
#define BINARY_DEVICE_TREE_FILE "mpc8544ds.dtb"
#define UIMAGE_LOAD_BASE 0
#define DTC_LOAD_PAD 0x1800000
@@ -444,6 +445,12 @@ static void ppce500_cpu_reset(void *opaque)
cs->halted = 0;
env->gpr[1] = (16<<20) - 8;
env->gpr[3] = bi->dt_base;
+ env->gpr[4] = 0;
+ env->gpr[5] = 0;
+ env->gpr[6] = EPAPR_MAGIC;
+ env->gpr[7] = (64 * 1024 * 1024);
+ env->gpr[8] = 0;
+ env->gpr[9] = 0;
env->nip = bi->entry;
mmubooke_create_initial_mapping(env);
}
--
1.7.0.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] ppc: initialize GPRs as per epapr
2013-04-26 6:17 [Qemu-devel] [PATCH] ppc: initialize GPRs as per epapr Bharat Bhushan
@ 2013-04-26 6:21 ` Alexander Graf
2013-04-26 6:51 ` Bhushan Bharat-R65777
2013-04-26 11:58 ` [Qemu-devel] [Qemu-ppc] " David Gibson
0 siblings, 2 replies; 6+ messages in thread
From: Alexander Graf @ 2013-04-26 6:21 UTC (permalink / raw)
To: Bharat Bhushan
Cc: scottwood, Bharat Bhushan, qemu-ppc, qemu-devel, Stuart Yoder
On 26.04.2013, at 08:17, Bharat Bhushan wrote:
> ePAPR defines the initial values of cpu registers. This patch initialize
> the GPRs as per ePAPR specification.
>
> This resolves the issue of guest reboot/reset (guest hang on reboot).
Why does it hang only on reboot, not on initial bootup?
>
> Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
> Signed-off-by: Stuart Yoder <stuart.yoder@freescale.com>
> ---
> hw/ppc/e500.c | 7 +++++++
> 1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
> index c1bdb6b..a47f976 100644
> --- a/hw/ppc/e500.c
> +++ b/hw/ppc/e500.c
> @@ -37,6 +37,7 @@
> #include "qemu/host-utils.h"
> #include "hw/pci-host/ppce500.h"
>
> +#define EPAPR_MAGIC (0x45504150)
> #define BINARY_DEVICE_TREE_FILE "mpc8544ds.dtb"
> #define UIMAGE_LOAD_BASE 0
> #define DTC_LOAD_PAD 0x1800000
> @@ -444,6 +445,12 @@ static void ppce500_cpu_reset(void *opaque)
Does ePAPR mention anything wrt GPR state of secondary CPUs?
> cs->halted = 0;
> env->gpr[1] = (16<<20) - 8;
> env->gpr[3] = bi->dt_base;
> + env->gpr[4] = 0;
> + env->gpr[5] = 0;
> + env->gpr[6] = EPAPR_MAGIC;
> + env->gpr[7] = (64 * 1024 * 1024);
What is this?
Alex
> + env->gpr[8] = 0;
> + env->gpr[9] = 0;
> env->nip = bi->entry;
> mmubooke_create_initial_mapping(env);
> }
> --
> 1.7.0.4
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] ppc: initialize GPRs as per epapr
2013-04-26 6:21 ` Alexander Graf
@ 2013-04-26 6:51 ` Bhushan Bharat-R65777
2013-04-26 6:59 ` Alexander Graf
2013-04-26 11:58 ` [Qemu-devel] [Qemu-ppc] " David Gibson
1 sibling, 1 reply; 6+ messages in thread
From: Bhushan Bharat-R65777 @ 2013-04-26 6:51 UTC (permalink / raw)
To: Alexander Graf
Cc: Wood Scott-B07421, qemu-ppc@nongnu.org, qemu-devel@nongnu.org,
Yoder Stuart-B08248
> -----Original Message-----
> From: Alexander Graf [mailto:agraf@suse.de]
> Sent: Friday, April 26, 2013 11:51 AM
> To: Bhushan Bharat-R65777
> Cc: qemu-ppc@nongnu.org; qemu-devel@nongnu.org; Wood Scott-B07421; Bhushan
> Bharat-R65777; Yoder Stuart-B08248
> Subject: Re: [PATCH] ppc: initialize GPRs as per epapr
>
>
> On 26.04.2013, at 08:17, Bharat Bhushan wrote:
>
> > ePAPR defines the initial values of cpu registers. This patch
> > initialize the GPRs as per ePAPR specification.
> >
> > This resolves the issue of guest reboot/reset (guest hang on reboot).
>
> Why does it hang only on reboot, not on initial bootup?
may be memory pointed by env pointer are zero initialized initially.
Reboot also not always hangs. I have seen reboot mostly working on e500v2/e500mc and mostly hanging on e5500.
>
> >
> > Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
> > Signed-off-by: Stuart Yoder <stuart.yoder@freescale.com>
> > ---
> > hw/ppc/e500.c | 7 +++++++
> > 1 files changed, 7 insertions(+), 0 deletions(-)
> >
> > diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c index c1bdb6b..a47f976
> > 100644
> > --- a/hw/ppc/e500.c
> > +++ b/hw/ppc/e500.c
> > @@ -37,6 +37,7 @@
> > #include "qemu/host-utils.h"
> > #include "hw/pci-host/ppce500.h"
> >
> > +#define EPAPR_MAGIC (0x45504150)
> > #define BINARY_DEVICE_TREE_FILE "mpc8544ds.dtb"
> > #define UIMAGE_LOAD_BASE 0
> > #define DTC_LOAD_PAD 0x1800000
> > @@ -444,6 +445,12 @@ static void ppce500_cpu_reset(void *opaque)
>
> Does ePAPR mention anything wrt GPR state of secondary CPUs?
Yes, I think we handle this in hw/ppc/ppce500_spin.c
>
> > cs->halted = 0;
> > env->gpr[1] = (16<<20) - 8;
> > env->gpr[3] = bi->dt_base;
> > + env->gpr[4] = 0;
> > + env->gpr[5] = 0;
> > + env->gpr[6] = EPAPR_MAGIC;
> > + env->gpr[7] = (64 * 1024 * 1024);
>
> What is this?
Size of initial TLB ( should be big enough to cover kernel handler). I do not see ePAPR defines any value, I set this to 64M.
-Bharat
>
>
> Alex
>
> > + env->gpr[8] = 0;
> > + env->gpr[9] = 0;
> > env->nip = bi->entry;
> > mmubooke_create_initial_mapping(env);
> > }
> > --
> > 1.7.0.4
> >
> >
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] ppc: initialize GPRs as per epapr
2013-04-26 6:51 ` Bhushan Bharat-R65777
@ 2013-04-26 6:59 ` Alexander Graf
2013-04-26 17:06 ` Scott Wood
0 siblings, 1 reply; 6+ messages in thread
From: Alexander Graf @ 2013-04-26 6:59 UTC (permalink / raw)
To: Bhushan Bharat-R65777
Cc: Wood Scott-B07421, qemu-ppc@nongnu.org, qemu-devel@nongnu.org,
Yoder Stuart-B08248
On 26.04.2013, at 08:51, Bhushan Bharat-R65777 wrote:
>
>
>> -----Original Message-----
>> From: Alexander Graf [mailto:agraf@suse.de]
>> Sent: Friday, April 26, 2013 11:51 AM
>> To: Bhushan Bharat-R65777
>> Cc: qemu-ppc@nongnu.org; qemu-devel@nongnu.org; Wood Scott-B07421; Bhushan
>> Bharat-R65777; Yoder Stuart-B08248
>> Subject: Re: [PATCH] ppc: initialize GPRs as per epapr
>>
>>
>> On 26.04.2013, at 08:17, Bharat Bhushan wrote:
>>
>>> ePAPR defines the initial values of cpu registers. This patch
>>> initialize the GPRs as per ePAPR specification.
>>>
>>> This resolves the issue of guest reboot/reset (guest hang on reboot).
>>
>> Why does it hang only on reboot, not on initial bootup?
>
> may be memory pointed by env pointer are zero initialized initially.
> Reboot also not always hangs. I have seen reboot mostly working on e500v2/e500mc and mostly hanging on e5500.
Yes, they're all zero initialized. I'm surprised that got things working.
>
>>
>>>
>>> Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
>>> Signed-off-by: Stuart Yoder <stuart.yoder@freescale.com>
>>> ---
>>> hw/ppc/e500.c | 7 +++++++
>>> 1 files changed, 7 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c index c1bdb6b..a47f976
>>> 100644
>>> --- a/hw/ppc/e500.c
>>> +++ b/hw/ppc/e500.c
>>> @@ -37,6 +37,7 @@
>>> #include "qemu/host-utils.h"
>>> #include "hw/pci-host/ppce500.h"
>>>
>>> +#define EPAPR_MAGIC (0x45504150)
>>> #define BINARY_DEVICE_TREE_FILE "mpc8544ds.dtb"
>>> #define UIMAGE_LOAD_BASE 0
>>> #define DTC_LOAD_PAD 0x1800000
>>> @@ -444,6 +445,12 @@ static void ppce500_cpu_reset(void *opaque)
>>
>> Does ePAPR mention anything wrt GPR state of secondary CPUs?
>
> Yes, I think we handle this in hw/ppc/ppce500_spin.c
>
>>
>>> cs->halted = 0;
>>> env->gpr[1] = (16<<20) - 8;
>>> env->gpr[3] = bi->dt_base;
>>> + env->gpr[4] = 0;
>>> + env->gpr[5] = 0;
>>> + env->gpr[6] = EPAPR_MAGIC;
>>> + env->gpr[7] = (64 * 1024 * 1024);
>>
>> What is this?
>
> Size of initial TLB ( should be big enough to cover kernel handler). I do not see ePAPR defines any value, I set this to 64M.
It's dynamic. Please set it to the actual size of the initial TLB mapping we create.
Alex
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc] [PATCH] ppc: initialize GPRs as per epapr
2013-04-26 6:21 ` Alexander Graf
2013-04-26 6:51 ` Bhushan Bharat-R65777
@ 2013-04-26 11:58 ` David Gibson
1 sibling, 0 replies; 6+ messages in thread
From: David Gibson @ 2013-04-26 11:58 UTC (permalink / raw)
To: Alexander Graf
Cc: Stuart Yoder, qemu-devel, Bharat Bhushan, qemu-ppc,
Bharat Bhushan, scottwood
[-- Attachment #1: Type: text/plain, Size: 1752 bytes --]
On Fri, Apr 26, 2013 at 08:21:24AM +0200, Alexander Graf wrote:
>
> On 26.04.2013, at 08:17, Bharat Bhushan wrote:
>
> > ePAPR defines the initial values of cpu registers. This patch initialize
> > the GPRs as per ePAPR specification.
> >
> > This resolves the issue of guest reboot/reset (guest hang on reboot).
>
> Why does it hang only on reboot, not on initial bootup?
>
> >
> > Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
> > Signed-off-by: Stuart Yoder <stuart.yoder@freescale.com>
> > ---
> > hw/ppc/e500.c | 7 +++++++
> > 1 files changed, 7 insertions(+), 0 deletions(-)
> >
> > diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
> > index c1bdb6b..a47f976 100644
> > --- a/hw/ppc/e500.c
> > +++ b/hw/ppc/e500.c
> > @@ -37,6 +37,7 @@
> > #include "qemu/host-utils.h"
> > #include "hw/pci-host/ppce500.h"
> >
> > +#define EPAPR_MAGIC (0x45504150)
> > #define BINARY_DEVICE_TREE_FILE "mpc8544ds.dtb"
> > #define UIMAGE_LOAD_BASE 0
> > #define DTC_LOAD_PAD 0x1800000
> > @@ -444,6 +445,12 @@ static void ppce500_cpu_reset(void *opaque)
>
> Does ePAPR mention anything wrt GPR state of secondary CPUs?
Yes and no. The entry point state for secondary CPUs depends on the
"enable-method" used to start the CPU. The spin-table enable method
defined in ePAPR gives some information on GPR state, although the
constraints are much weaker than for the boot cpu. Platform specific
enable-methods would have to define their own entry point requirements.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] ppc: initialize GPRs as per epapr
2013-04-26 6:59 ` Alexander Graf
@ 2013-04-26 17:06 ` Scott Wood
0 siblings, 0 replies; 6+ messages in thread
From: Scott Wood @ 2013-04-26 17:06 UTC (permalink / raw)
To: Alexander Graf
Cc: Wood Scott-B07421, Yoder Stuart-B08248, qemu-ppc@nongnu.org,
qemu-devel@nongnu.org, Bhushan Bharat-R65777
On 04/26/2013 01:59:10 AM, Alexander Graf wrote:
>
> On 26.04.2013, at 08:51, Bhushan Bharat-R65777 wrote:
>
> >
> >
> >> -----Original Message-----
> >> From: Alexander Graf [mailto:agraf@suse.de]
> >> Sent: Friday, April 26, 2013 11:51 AM
> >> To: Bhushan Bharat-R65777
> >> Cc: qemu-ppc@nongnu.org; qemu-devel@nongnu.org; Wood Scott-B07421;
> Bhushan
> >> Bharat-R65777; Yoder Stuart-B08248
> >> Subject: Re: [PATCH] ppc: initialize GPRs as per epapr
> >>
> >>
> >> On 26.04.2013, at 08:17, Bharat Bhushan wrote:
> >>
> >>> ePAPR defines the initial values of cpu registers. This patch
> >>> initialize the GPRs as per ePAPR specification.
> >>>
> >>> This resolves the issue of guest reboot/reset (guest hang on
> reboot).
> >>
> >> Why does it hang only on reboot, not on initial bootup?
> >
> > may be memory pointed by env pointer are zero initialized initially.
> > Reboot also not always hangs. I have seen reboot mostly working on
> e500v2/e500mc and mostly hanging on e5500.
>
> Yes, they're all zero initialized. I'm surprised that got things
> working.
head_64.S assumes it's being booted from Open Firmware if r5 is
non-zero -- this is why ePAPR requires r5 to be zero.
-Scott
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-04-26 17:22 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-26 6:17 [Qemu-devel] [PATCH] ppc: initialize GPRs as per epapr Bharat Bhushan
2013-04-26 6:21 ` Alexander Graf
2013-04-26 6:51 ` Bhushan Bharat-R65777
2013-04-26 6:59 ` Alexander Graf
2013-04-26 17:06 ` Scott Wood
2013-04-26 11:58 ` [Qemu-devel] [Qemu-ppc] " David Gibson
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).