This patch enables OpenBIOS to initialize on PPC64, enabling support for -cpu 970fx. It gets up to the boot prompt and works rather good so far, though I haven't been able to run a kernel yet.
For more recent PowerPC CPUs the PTE layout has changed, so we need to take that into account and create PTEs according to the new layout and at the new physical positions.
v2 takes Laurent's comments into account
Signed-off-by: Alexander Graf alex@csgraf.de
Le 27 févr. 09 à 00:39, Alexander Graf a écrit :
This patch enables OpenBIOS to initialize on PPC64, enabling support for -cpu 970fx. It gets up to the boot prompt and works rather good so far, though I haven't been able to run a kernel yet.
For more recent PowerPC CPUs the PTE layout has changed, so we need to take that into account and create PTEs according to the new layout and at the new physical positions.
v2 takes Laurent's comments into account
Thank you
Signed-off-by: Alexander Graf alex@csgraf.de
...
Index: arch/ppc/qemu/mmutypes.h
--- arch/ppc/qemu/mmutypes.h (revision 459) +++ arch/ppc/qemu/mmutypes.h (working copy) @@ -38,7 +38,28 @@ unsigned long pp:2; /* Page protection */ } mPTE_t;
+typedef struct mPTE_64 {
uint32_t avpn_low; /* Abbreviated Virtual Page Number (unused) */
uint32_t avpn:25; /* Abbreviated Virtual Page Number */
uint32_t sw:4; /* Software Use */
uint32_t :1; /* Reserved */
uint32_t h:1; /* Hash algorithm indicator */
uint32_t v:1; /* Entry is valid */
uint32_t rpn_low; /* Real (physical) page number (unused) */
uint32_t rpn:20; /* Real (physical) page number */
uint32_t :2; /* Reserved */
uint32_t ac:1; /* Address Compare*/
uint32_t r:1; /* Referenced */
uint32_t c:1; /* Changed */
uint32_t w:1; /* Write-thru cache mode */
uint32_t i:1; /* Cache inhibited */
uint32_t m:1; /* Memory coherence */
uint32_t g:1; /* Guarded */
uint32_t n:1; /* No-Execute */
uint32_t pp:2; /* Page protection */
+} mPTE_64_t;
To answer to the comment of your previous patch:
Porting openBIOS to ppc64 seems useless as ppc32 can run on ppc64 (Do you want to run a database in openBIOS ? ;-) ). If I remember correctly there were some mails about this between Aurélien and BlueSwirl on openBIOS mailing list.
But I agree that "unsigned long"is not a good choice in this case.
And a personal comment you must ignore: I don't like bitfield.
But if you use mask/shift and defines, you can use same values for 32 and 64bit PTE (it's not true for all fields):
#define PTE_PAGE_PROTECTION 0x0003 #define PTE_NOEXEC 0x0004 ... #define PTE_CHANGED 0x0100 ... #define PTE_RPN 0xfffffffffffff000ULL
But as it is done now is not an issue for me, it's just, from a personal and cosmetic point of view, ugly...
I'll try to test and commit your patch tomorrow (well, tomorrow is today, now...)
Regards, Laurent
On 2/27/09, Alexander Graf alex@csgraf.de wrote:
This patch enables OpenBIOS to initialize on PPC64, enabling support for -cpu 970fx. It gets up to the boot prompt and works rather good so far, though I haven't been able to run a kernel yet.
For more recent PowerPC CPUs the PTE layout has changed, so we need to take that into account and create PTEs according to the new layout and at the new physical positions.
v2 takes Laurent's comments into account
Signed-off-by: Alexander Graf alex@csgraf.de
Great work. Just a minor nit:
+ vsid = (ea>>28) + SEGR_BASE;
Please add spaces around ">>".
I wonder if is_ppc64() is correct for all known CPUs. Alternatively the CPU init function could set a global is_ppc64 flag, or call the MMU initialize function.
In dsi_exception the mask could be initialized just once and in other cases a static value could be used for speed. The speed of OpenBIOS is of course not very critical.
On 2/27/09, Alexander Graf alex@csgraf.de wrote:
This patch enables OpenBIOS to initialize on PPC64, enabling support for -cpu 970fx. It gets up to the boot prompt and works rather good so far, though I haven't been able to run a kernel yet.
It looks like there is a bug in Qemu (testing boot from Debian 4.0R5 CD):
invalid/unsupported opcode: 1e - 12 - 1b (782106e4) 00000000014080e4 1 IN: 0x00000000014080d0: mr r31,r3 0x00000000014080d4: mr r30,r4 0x00000000014080d8: mr r29,r5 0x00000000014080dc: mr r28,r6 0x00000000014080e0: mr r27,r7 0x00000000014080e4: rldicr r1,r1,0,59
But rldicr should be supported on a 750, according to "IBM PowerPC 740 / PowerPC 750 RISC Microprocessor User’s Manual".
Le 27 févr. 09 à 00:39, Alexander Graf a écrit :
This patch enables OpenBIOS to initialize on PPC64, enabling support for -cpu 970fx. It gets up to the boot prompt and works rather good so far, though I haven't been able to run a kernel yet.
For more recent PowerPC CPUs the PTE layout has changed, so we need to take that into account and create PTEs according to the new layout and at the new physical positions.
v2 takes Laurent's comments into account
Signed-off-by: Alexander Graf alex@csgraf.de
<ppc64.patch>
Applied as r461 (with the space modification asked by BlueSwirl)
Thanks.
On 27.02.2009, at 22:47, Blue Swirl wrote:
On 2/27/09, Alexander Graf alex@csgraf.de wrote:
This patch enables OpenBIOS to initialize on PPC64, enabling support for -cpu 970fx. It gets up to the boot prompt and works rather good so far, though I haven't been able to run a kernel yet.
It looks like there is a bug in Qemu (testing boot from Debian 4.0R5 CD):
invalid/unsupported opcode: 1e - 12 - 1b (782106e4) 00000000014080e4 1 IN: 0x00000000014080d0: mr r31,r3 0x00000000014080d4: mr r30,r4 0x00000000014080d8: mr r29,r5 0x00000000014080dc: mr r28,r6 0x00000000014080e0: mr r27,r7 0x00000000014080e4: rldicr r1,r1,0,59
But rldicr should be supported on a 750, according to "IBM PowerPC 740 / PowerPC 750 RISC Microprocessor User’s Manual".
Please keep in mind that booting a PPC64 kernel doesn't work for me yet. I'm currently stuck with the DSI handler clobbering the high 32 bits in the 64 bit GPRs.
I'll try to write up a patch that provides custom register save/ restore code for ppc64. Are there any preferences on that?
Would it be better to build a specific PPC64 binary or to detect which code to take in runtime and patch it accordingly?
Alex
On 2/28/09, Alexander Graf alex@csgraf.de wrote:
On 27.02.2009, at 22:47, Blue Swirl wrote:
On 2/27/09, Alexander Graf alex@csgraf.de wrote:
This patch enables OpenBIOS to initialize on PPC64, enabling support for -cpu 970fx. It gets up to the boot prompt and works rather good so far, though I
haven't
been able to run a kernel yet.
It looks like there is a bug in Qemu (testing boot from Debian 4.0R5 CD):
invalid/unsupported opcode: 1e - 12 - 1b (782106e4) 00000000014080e4 1 IN: 0x00000000014080d0: mr r31,r3 0x00000000014080d4: mr r30,r4 0x00000000014080d8: mr r29,r5 0x00000000014080dc: mr r28,r6 0x00000000014080e0: mr r27,r7 0x00000000014080e4: rldicr r1,r1,0,59
But rldicr should be supported on a 750, according to "IBM PowerPC 740 / PowerPC 750 RISC Microprocessor User’s Manual".
Sorry, I was confused: 970 != 750.
Please keep in mind that booting a PPC64 kernel doesn't work for me yet. I'm currently stuck with the DSI handler clobbering the high 32 bits in the 64 bit GPRs.
I'll try to write up a patch that provides custom register save/restore code for ppc64. Are there any preferences on that?
Would it be better to build a specific PPC64 binary or to detect which code to take in runtime and patch it accordingly?
Single binary for both if possible.