Skip to contentSkip to conversation

qemu/powernv: coreboot support?

DISCUSSION Marty E. Plummer 5 participants 24 messages Oct 18, 2019 – Oct 23, 2019

lore
Share & tools
lore
#0 lore raw

Hello,

First off, thank you for the work you've done on the ppc64 support, it has been very useful. I'm currently working on a coreboot port for the talos ii line of systems (which means more ppc64 support, support specifically for the power9 sforza chip, and specific mainboard support. My plate is very full lol) and have been using qemu to debug the bootblock.

It has been very useful for that, but I'm now at the point where I need to jump to romstage, and that's where it gets tricky. qemu parses the rom image and looks for a ffs header, locates skiboot on it, and jumps straight to that. Not exactly ideal for debugging something not produced from op-build.

Do you think it would be within your wheelhouse to provide a generic, non-ffs pnor interface for loading arbitary rom images? It would be of great help if you could. (This would still hopefully have the bmc support code as well, as I'm still needing to support a system using one).

Regards,
Marty

#1 lore raw
Quoted 8 lines · Marty E. Plummer

Hello,

First off, thank you for the work you've done on the ppc64 support, it has been very useful. I'm currently working on a coreboot port for the talos ii line of systems (which means more ppc64 support, support specifically for the power9 sforza chip, and specific mainboard support. My plate is very full lol) and have been using qemu to debug the bootblock.

Ok. I'm assuming that's with the powernv machine type?

Quoted 5 lines

It has been very useful for that, but I'm now at the point where I need to jump to romstage, and that's where it gets tricky. qemu parses the rom image and looks for a ffs header, locates skiboot on it, and jumps straight to that. Not exactly ideal for debugging something not produced from op-build.

Um.. I'm not sure what code you're talking about. AFAICT the pnv code just starts the cpus at address 0x10.

Quoted 4 lines

Do you think it would be within your wheelhouse to provide a generic, non-ffs pnor interface for loading arbitary rom images? It would be of great help if you could. (This would still hopefully have the bmc support code as well, as I'm still needing to support a system using one).

Uh.. and I'm not really sure what you're asking for here.

Signature · 4 lines
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
#2 lore raw
Quoted 12 lines · David Gibson
Quoted 8 lines · Marty E. Plummer

Hello,

First off, thank you for the work you've done on the ppc64 support, it has been very useful. I'm currently working on a coreboot port for the talos ii line of systems (which means more ppc64 support, support specifically for the power9 sforza chip, and specific mainboard support. My plate is very full lol) and have been using qemu to debug the bootblock.

Ok. I'm assuming that's with the powernv machine type?

Assuming you mean the hardware, yes, the kernel for it is configured with the powernv_defconfig.

Assuming that you mean how I call qemu, yes, also powernv: my full command is:

qemu-system-ppc64 -cpu power9 -M powernv -m 4G -s -S \
-chardev socket,id=qemu-monitor,host=localhost,port=7777,server,nowait,telnet \
-mon qemu-monitor,mode=readline -nographic -bios build/cbfs/fallback/bootblock.bin

Quoted 9 lines
Quoted 5 lines

It has been very useful for that, but I'm now at the point where I need to jump to romstage, and that's where it gets tricky. qemu parses the rom image and looks for a ffs header, locates skiboot on it, and jumps straight to that. Not exactly ideal for debugging something not produced from op-build.

Um.. I'm not sure what code you're talking about. AFAICT the pnv code just starts the cpus at address 0x10.

If I pass it the full coreboot.rom file via
-drive file=./build/coreboot.rom,format=raw,if=mtd it returns this error:
'qemu-system-ppc64: Initialization of device pnv-pnor failed: bad header' which arises in hw/ppc/pnv_pnor.c:136-140 using legoater's powernv-4.2 branch.

Ah, so I wasn't going crazy and it was skipping the first four instructions, how odd. Any particular reason the first four instruction are skipped? On hostboot that's setting up the msr; on skiboot that seems to be the fdt_entry branch to boot_entry.

Quoted 7 lines
Quoted 4 lines

Do you think it would be within your wheelhouse to provide a generic, non-ffs pnor interface for loading arbitary rom images? It would be of great help if you could. (This would still hopefully have the bmc support code as well, as I'm still needing to support a system using one).

Uh.. and I'm not really sure what you're asking for here.

Basically not have to have a pnor-style image for mtd devices, and not immidiatly jump to skiboot.

Quoted 5 lines
Signature · 4 lines
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
#3 lore raw
In reply to Marty E. Plummer
Quoted 9 lines · Marty E. Plummer

Hello,

First off, thank you for the work you've done on the ppc64 support, it has been very useful. I'm currently working on a coreboot port for the talos ii line of systems (which means more ppc64 support, support specifically for the power9 sforza chip, and specific mainboard support. My plate is very full lol) and have been using qemu to debug the bootblock.

Quoted 4 lines

It has been very useful for that, but I'm now at the point where I need to jump to romstage, and that's where it gets tricky. qemu parses the rom image and looks for a ffs header, locates skiboot on it, and jumps straight to that. Not exactly ideal for debugging something not produced from op-build.

yes. I suppose you are using my branch powernv-4.2 which adds PNOR support and a way to boot directly from PNOR. In that case, QEMU parses the PNOR file to extract the PAYLOAD partition (skiboot). skiboot also detects the flash and extract the kernel and initramfs from the PNOR.

However, you can bypass all this internal boot process by simply passing a -bios option and not passing a MTD device.

I haven't published the PNOR support and the boot from PNOR yet. Lack of time and because sPAPR is the priority.

Quoted 2 lines

Do you think it would be within your wheelhouse to provide a generic, non-ffs pnor interface for loading arbitary rom images?

I should probably send the PNOR patchset now so that we can discuss on a better way to satisfy all needs.

Quoted 3 lines

It would be of great help if
you could. (This would still hopefully have the bmc support code as well, as I'm still needing to support a system using one).

We have support for Aspeed machines AST2400, AST2500 and AST2600. It is possible to interconnect them through the BT device. Or you can use the IPMI BT simulator of QEMU on the PowerNV machine

Thanks,

C.

#4 lore raw
Quoted 15 lines · Cédric Le Goater
Quoted 9 lines · Marty E. Plummer

Hello,

First off, thank you for the work you've done on the ppc64 support, it has been very useful. I'm currently working on a coreboot port for the talos ii line of systems (which means more ppc64 support, support specifically for the power9 sforza chip, and specific mainboard support. My plate is very full lol) and have been using qemu to debug the bootblock.

Quoted 4 lines

It has been very useful for that, but I'm now at the point where I need to jump to romstage, and that's where it gets tricky. qemu parses the rom image and looks for a ffs header, locates skiboot on it, and jumps straight to that. Not exactly ideal for debugging something not produced from op-build.

Quoted 8 lines

yes. I suppose you are using my branch powernv-4.2 which adds PNOR support and a way to boot directly from PNOR. In that case, QEMU parses the PNOR file to extract the PAYLOAD partition (skiboot). skiboot also detects the flash and extract the kernel and initramfs from the PNOR.

However, you can bypass all this internal boot process by simply passing a -bios option and not passing a MTD device.

Doing so gives me the following error:
qemu-system-ppc64: Could not load OPAL firmware 'build/coreboot.rom' (this is after I patched the 4mb size limit up)

Quoted 21 lines

I haven't published the PNOR support and the boot from PNOR yet. Lack of time and because sPAPR is the priority.

Quoted 2 lines

Do you think it would be within your wheelhouse to provide a generic, non-ffs pnor interface for loading arbitary rom images?

I should probably send the PNOR patchset now so that we can discuss on a better way to satisfy all needs.

Quoted 3 lines

It would be of great help if
you could. (This would still hopefully have the bmc support code as well, as I'm still needing to support a system using one).

We have support for Aspeed machines AST2400, AST2500 and AST2600. It is possible to interconnect them through the BT device. Or you can use the IPMI BT simulator of QEMU on the PowerNV machine

Thanks,

C.

#5 lore raw
Quoted 21 lines · Marty E. Plummer
Quoted 20 lines · Cédric Le Goater
Quoted 9 lines · Marty E. Plummer

Hello,

First off, thank you for the work you've done on the ppc64 support, it has been very useful. I'm currently working on a coreboot port for the talos ii line of systems (which means more ppc64 support, support specifically for the power9 sforza chip, and specific mainboard support. My plate is very full lol) and have been using qemu to debug the bootblock.

Quoted 4 lines

It has been very useful for that, but I'm now at the point where I need to jump to romstage, and that's where it gets tricky. qemu parses the rom image and looks for a ffs header, locates skiboot on it, and jumps straight to that. Not exactly ideal for debugging something not produced from op-build.

yes. I suppose you are using my branch powernv-4.2 which adds PNOR support and a way to boot directly from PNOR. In that case, QEMU parses the PNOR file to extract the PAYLOAD partition (skiboot). skiboot also detects the flash and extract the kernel and initramfs from the PNOR.

Quoted 6 lines
Quoted 3 lines

However, you can bypass all this internal boot process by simply passing a -bios option and not passing a MTD device.

Doing so gives me the following error:
qemu-system-ppc64: Could not load OPAL firmware 'build/coreboot.rom' (this is after I patched the 4mb size limit up)

Could you make that rom available ?

Thanks,

C.

#6 lore raw
Quoted 22 lines · Cédric Le Goater
Quoted 21 lines · Marty E. Plummer
Quoted 20 lines · Cédric Le Goater
Quoted 9 lines · Marty E. Plummer

Hello,

First off, thank you for the work you've done on the ppc64 support, it has been very useful. I'm currently working on a coreboot port for the talos ii line of systems (which means more ppc64 support, support specifically for the power9 sforza chip, and specific mainboard support. My plate is very full lol) and have been using qemu to debug the bootblock.

Quoted 4 lines

It has been very useful for that, but I'm now at the point where I need to jump to romstage, and that's where it gets tricky. qemu parses the rom image and looks for a ffs header, locates skiboot on it, and jumps straight to that. Not exactly ideal for debugging something not produced from op-build.

yes. I suppose you are using my branch powernv-4.2 which adds PNOR support and a way to boot directly from PNOR. In that case, QEMU parses the PNOR file to extract the PAYLOAD partition (skiboot). skiboot also detects the flash and extract the kernel and initramfs from the PNOR.

Quoted 9 lines
Quoted 6 lines
Quoted 3 lines

However, you can bypass all this internal boot process by simply passing a -bios option and not passing a MTD device.

Doing so gives me the following error:
qemu-system-ppc64: Could not load OPAL firmware 'build/coreboot.rom' (this is after I patched the 4mb size limit up)

Could you make that rom available ?

Sure, I think. Not sure about how sending files works in my current mail client but will see. Its more or less a 'stock' (as stock as can be for a new coreboot target) coreboot.rom file, but I've added some logic into the build to fake a pnor ffs header at the end in order to trick hostboot bootloader into loading it.

Quoted 3 lines

Thanks,

C.

#7 lore raw
Quoted 30 lines · Marty E. Plummer
Quoted 29 lines · Cédric Le Goater
Quoted 27 lines · Marty E. Plummer
Quoted 15 lines · Cédric Le Goater
Quoted 9 lines · Marty E. Plummer

Hello,

First off, thank you for the work you've done on the ppc64 support, it has been very useful. I'm currently working on a coreboot port for the talos ii line of systems (which means more ppc64 support, support specifically for the power9 sforza chip, and specific mainboard support. My plate is very full lol) and have been using qemu to debug the bootblock.

Quoted 4 lines

It has been very useful for that, but I'm now at the point where I need to jump to romstage, and that's where it gets tricky. qemu parses the rom image and looks for a ffs header, locates skiboot on it, and jumps straight to that. Not exactly ideal for debugging something not produced from op-build.

Quoted 8 lines

yes. I suppose you are using my branch powernv-4.2 which adds PNOR support and a way to boot directly from PNOR. In that case, QEMU parses the PNOR file to extract the PAYLOAD partition (skiboot). skiboot also detects the flash and extract the kernel and initramfs from the PNOR.

However, you can bypass all this internal boot process by simply passing a -bios option and not passing a MTD device.

Doing so gives me the following error:
qemu-system-ppc64: Could not load OPAL firmware 'build/coreboot.rom' (this is after I patched the 4mb size limit up)

Quoted 7 lines
Quoted 2 lines

Could you make that rom available ?

Sure, I think. Not sure about how sending files works in my current mail client but will see. Its more or less a 'stock' (as stock as can be for a new coreboot target) coreboot.rom file, but I've added some logic into the build to fake a pnor ffs header at the end in order to trick hostboot bootloader into loading it.

Ok. Note that the qemu emulated machine doesn't model the hardware right down to the level of hostboot. That's wy we're just loading skiboot and jumping straight into it usually. I guess clg's stuff to load pnor images gets us a little closer to the hardware behaviour, but I think it's still only a rough approximation.

Quoted 3 lines
Quoted 3 lines

Thanks,

C.

Signature · 4 lines
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
#8 lore raw
Quoted 39 lines · David Gibson
Quoted 30 lines · Marty E. Plummer
Quoted 29 lines · Cédric Le Goater
Quoted 27 lines · Marty E. Plummer
Quoted 15 lines · Cédric Le Goater
Quoted 9 lines · Marty E. Plummer

Hello,

First off, thank you for the work you've done on the ppc64 support, it has been very useful. I'm currently working on a coreboot port for the talos ii line of systems (which means more ppc64 support, support specifically for the power9 sforza chip, and specific mainboard support. My plate is very full lol) and have been using qemu to debug the bootblock.

Quoted 4 lines

It has been very useful for that, but I'm now at the point where I need to jump to romstage, and that's where it gets tricky. qemu parses the rom image and looks for a ffs header, locates skiboot on it, and jumps straight to that. Not exactly ideal for debugging something not produced from op-build.

Quoted 8 lines

yes. I suppose you are using my branch powernv-4.2 which adds PNOR support and a way to boot directly from PNOR. In that case, QEMU parses the PNOR file to extract the PAYLOAD partition (skiboot). skiboot also detects the flash and extract the kernel and initramfs from the PNOR.

However, you can bypass all this internal boot process by simply passing a -bios option and not passing a MTD device.

Doing so gives me the following error:
qemu-system-ppc64: Could not load OPAL firmware 'build/coreboot.rom' (this is after I patched the 4mb size limit up)

Quoted 7 lines
Quoted 2 lines

Could you make that rom available ?

Sure, I think. Not sure about how sending files works in my current mail client but will see. Its more or less a 'stock' (as stock as can be for a new coreboot target) coreboot.rom file, but I've added some logic into the build to fake a pnor ffs header at the end in order to trick hostboot bootloader into loading it.

Quoted 5 lines

Ok. Note that the qemu emulated machine doesn't model the hardware right down to the level of hostboot. That's wy we're just loading skiboot and jumping straight into it usually. I guess clg's stuff to load pnor images gets us a little closer to the hardware behaviour, but I think it's still only a rough approximation.

It's really tied to the OpenPOWER firmwares using the HIOMAP protocol to discuss with the BMC and load the flash. We could loosen how QEMU interprets the MTD device and use a property to inform QEMU that this is an OpenPOWER PNOR file and that skiboot and can be loaded from it. Something to discuss.

I have applied this small hack to load larger -bios files :

hw/ppc/pnv.c +1 -1
@@ -58,7 +58,7 @@
 
 #define FW_FILE_NAME            "skiboot.lid"
 #define FW_LOAD_ADDR            0x0
-#define FW_MAX_SIZE             (4 * MiB)
+#define FW_MAX_SIZE             (64 * MiB)
 
 #define KERNEL_LOAD_ADDR        0x20000000
 #define KERNEL_MAX_SIZE         (256 * MiB)

and coreboot.rom loads and boots and loops.

You can use -d exec,in_asm to check what's going on.

C.

#9 lore raw
Quoted 7 lines · Cédric Le Goater
Quoted 5 lines · David Gibson

Ok. Note that the qemu emulated machine doesn't model the hardware right down to the level of hostboot. That's wy we're just loading skiboot and jumping straight into it usually. I guess clg's stuff to load pnor images gets us a little closer to the hardware behaviour, but I think it's still only a rough approximation.

Yeah, but its useful enough to see that my rough understanding of ppc64 assembly is more/less correct (using the hostboot/skiboot sources as a reference [both are elfv1] to write coreboot [I'm using elfv2] is a bit fun)

Quoted 6 lines

It's really tied to the OpenPOWER firmwares using the HIOMAP protocol to discuss with the BMC and load the flash. We could loosen how QEMU interprets the MTD device and use a property to inform QEMU that this is an OpenPOWER PNOR file and that skiboot and can be loaded from it. Something to discuss.

Yeah, it would be useful to be able to use a non-pnor mtd device but still get the hiomap behavior, because that's what I'll be dealing with on real hardware.

hw/ppc/pnv.c line 62

Quoted 12 lines

I have applied this small hack to load larger -bios files :

hw/ppc/pnv.c +1 -1
@@ -58,7 +58,7 @@
 
 #define FW_FILE_NAME            "skiboot.lid"
 #define FW_LOAD_ADDR            0x0
-#define FW_MAX_SIZE             (4 * MiB)
+#define FW_MAX_SIZE             (64 * MiB)
 

Yeah, I did a similar hack after I realized I only did this hack to version 4.1.0 and not the powernv-4.2 git version.

Quoted 8 lines
hw/ppc/pnv.c +0 -0
 #define KERNEL_LOAD_ADDR        0x20000000
 #define KERNEL_MAX_SIZE         (256 * MiB)

and coreboot.rom loads and boots and loops.

You can use -d exec,in_asm to check what's going on.

Ended up using -s -S and gdb'ing it. It loops because of endian issues in the coreboot fmap implmentation. That needs to be fixed upstream.

Quoted 2 lines

C.

#10 lore raw
In reply to Cédric Le Goater
Quoted 46 lines · Cédric Le Goater
Quoted 39 lines · David Gibson
Quoted 30 lines · Marty E. Plummer
Quoted 29 lines · Cédric Le Goater
Quoted 27 lines · Marty E. Plummer
Quoted 15 lines · Cédric Le Goater
Quoted 9 lines · Marty E. Plummer

Hello,

First off, thank you for the work you've done on the ppc64 support, it has been very useful. I'm currently working on a coreboot port for the talos ii line of systems (which means more ppc64 support, support specifically for the power9 sforza chip, and specific mainboard support. My plate is very full lol) and have been using qemu to debug the bootblock.

Quoted 4 lines

It has been very useful for that, but I'm now at the point where I need to jump to romstage, and that's where it gets tricky. qemu parses the rom image and looks for a ffs header, locates skiboot on it, and jumps straight to that. Not exactly ideal for debugging something not produced from op-build.

Quoted 8 lines

yes. I suppose you are using my branch powernv-4.2 which adds PNOR support and a way to boot directly from PNOR. In that case, QEMU parses the PNOR file to extract the PAYLOAD partition (skiboot). skiboot also detects the flash and extract the kernel and initramfs from the PNOR.

However, you can bypass all this internal boot process by simply passing a -bios option and not passing a MTD device.

Doing so gives me the following error:
qemu-system-ppc64: Could not load OPAL firmware 'build/coreboot.rom' (this is after I patched the 4mb size limit up)

Quoted 7 lines
Quoted 2 lines

Could you make that rom available ?

Sure, I think. Not sure about how sending files works in my current mail client but will see. Its more or less a 'stock' (as stock as can be for a new coreboot target) coreboot.rom file, but I've added some logic into the build to fake a pnor ffs header at the end in order to trick hostboot bootloader into loading it.

Quoted 5 lines

Ok. Note that the qemu emulated machine doesn't model the hardware right down to the level of hostboot. That's wy we're just loading skiboot and jumping straight into it usually. I guess clg's stuff to load pnor images gets us a little closer to the hardware behaviour, but I think it's still only a rough approximation.

Quoted 5 lines

It's really tied to the OpenPOWER firmwares using the HIOMAP protocol to discuss with the BMC and load the flash. We could loosen how QEMU interprets the MTD device and use a property to inform QEMU that this is an OpenPOWER PNOR file and that skiboot and can be loaded from it. Something to discuss.

Right. I'm guessing one significant issue here is that to fully model the BMC, with *its* firmware and comms channels with the main host would be quite a lot of work, hence cheating a bit to bypass that.

Quoted 22 lines

I have applied this small hack to load larger -bios files :

hw/ppc/pnv.c +1 -1
@@ -58,7 +58,7 @@
 
 #define FW_FILE_NAME            "skiboot.lid"
 #define FW_LOAD_ADDR            0x0
-#define FW_MAX_SIZE             (4 * MiB)
+#define FW_MAX_SIZE             (64 * MiB)
 
 #define KERNEL_LOAD_ADDR        0x20000000
 #define KERNEL_MAX_SIZE         (256 * MiB)

and coreboot.rom loads and boots and loops.

You can use -d exec,in_asm to check what's going on.

C.

Signature · 4 lines
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
#11 lore raw
Quoted 53 lines · David Gibson
Quoted 46 lines · Cédric Le Goater
Quoted 39 lines · David Gibson
Quoted 30 lines · Marty E. Plummer
Quoted 29 lines · Cédric Le Goater
Quoted 27 lines · Marty E. Plummer
Quoted 15 lines · Cédric Le Goater
Quoted 9 lines · Marty E. Plummer

Hello,

First off, thank you for the work you've done on the ppc64 support, it has been very useful. I'm currently working on a coreboot port for the talos ii line of systems (which means more ppc64 support, support specifically for the power9 sforza chip, and specific mainboard support. My plate is very full lol) and have been using qemu to debug the bootblock.

Quoted 4 lines

It has been very useful for that, but I'm now at the point where I need to jump to romstage, and that's where it gets tricky. qemu parses the rom image and looks for a ffs header, locates skiboot on it, and jumps straight to that. Not exactly ideal for debugging something not produced from op-build.

Quoted 8 lines

yes. I suppose you are using my branch powernv-4.2 which adds PNOR support and a way to boot directly from PNOR. In that case, QEMU parses the PNOR file to extract the PAYLOAD partition (skiboot). skiboot also detects the flash and extract the kernel and initramfs from the PNOR.

However, you can bypass all this internal boot process by simply passing a -bios option and not passing a MTD device.

Doing so gives me the following error:
qemu-system-ppc64: Could not load OPAL firmware 'build/coreboot.rom' (this is after I patched the 4mb size limit up)

Quoted 7 lines
Quoted 2 lines

Could you make that rom available ?

Sure, I think. Not sure about how sending files works in my current mail client but will see. Its more or less a 'stock' (as stock as can be for a new coreboot target) coreboot.rom file, but I've added some logic into the build to fake a pnor ffs header at the end in order to trick hostboot bootloader into loading it.

Quoted 5 lines

Ok. Note that the qemu emulated machine doesn't model the hardware right down to the level of hostboot. That's wy we're just loading skiboot and jumping straight into it usually. I guess clg's stuff to load pnor images gets us a little closer to the hardware behaviour, but I think it's still only a rough approximation.

Quoted 5 lines

It's really tied to the OpenPOWER firmwares using the HIOMAP protocol to discuss with the BMC and load the flash. We could loosen how QEMU interprets the MTD device and use a property to inform QEMU that this is an OpenPOWER PNOR file and that skiboot and can be loaded from it. Something to discuss.

Quoted 3 lines

Right. I'm guessing one significant issue here is that to fully model the BMC, with *its* firmware and comms channels with the main host would be quite a lot of work, hence cheating a bit to bypass that.

In fact, we are not cheating that much. We use the IPMI BT interface of QEMU to handle the HIOMAP communication with the BMC and this model is quite precise.

The mapping of the PNOR is simply mapped on the LPC FW address space. The underlying access are simplified because we don't have a LPC model but we could generate all the SPI transaction using the Aspeed models. I had experiments in that sense for P8.

I will sense the patches I have on the topic.

C.

Quoted 23 lines
Quoted 22 lines

I have applied this small hack to load larger -bios files :

hw/ppc/pnv.c +1 -1
@@ -58,7 +58,7 @@
 
 #define FW_FILE_NAME            "skiboot.lid"
 #define FW_LOAD_ADDR            0x0
-#define FW_MAX_SIZE             (4 * MiB)
+#define FW_MAX_SIZE             (64 * MiB)
 
 #define KERNEL_LOAD_ADDR        0x20000000
 #define KERNEL_MAX_SIZE         (256 * MiB)

and coreboot.rom loads and boots and loops.

You can use -d exec,in_asm to check what's going on.

C.

#12 lore raw
Quoted 10 lines · Cédric Le Goater
Quoted 9 lines · David Gibson
Quoted 8 lines · Cédric Le Goater
Quoted 6 lines · David Gibson

Ok. Note that the qemu emulated machine doesn't model the hardware right down to the level of hostboot. That's wy we're just loading skiboot and jumping straight into it usually. I guess clg's stuff to load pnor images gets us a little closer to the hardware behaviour, but I think it's still only a rough approximation.

On that note, is qemu-ppc64 currently capable of running LE firmware? My coreboot port has currently reached a hitch in that part of the firmware headers mapping stuff out is saved in LE mode while the cpu (real or emu) is running in BE mode (FMAP headers are saved LE but CBFS headers are saved BE)

Quoted 10 lines
Quoted 9 lines
Quoted 5 lines

It's really tied to the OpenPOWER firmwares using the HIOMAP protocol to discuss with the BMC and load the flash. We could loosen how QEMU interprets the MTD device and use a property to inform QEMU that this is an OpenPOWER PNOR file and that skiboot and can be loaded from it. Something to discuss.

Right. I'm guessing one significant issue here is that to fully model the BMC, with *its* firmware and comms channels with the main host would be quite a lot of work, hence cheating a bit to bypass that.

Quoted 9 lines

In fact, we are not cheating that much. We use the IPMI BT interface of QEMU to handle the HIOMAP communication with the BMC and this model is quite precise.

The mapping of the PNOR is simply mapped on the LPC FW address space. The underlying access are simplified because we don't have a LPC model but we could generate all the SPI transaction using the Aspeed models. I had experiments in that sense for P8.

Honestly getting the coreboot.rom into the lpc fw addr space in the same way you do pnor images would be a useful sim, as that's more or less how its going to be done on existing hardware.

Quoted 3 lines

I will sense the patches I have on the topic.

C.

#13 lore raw
Quoted 5 lines · Marty E. Plummer
Quoted 4 lines · Cédric Le Goater
Quoted 3 lines · David Gibson
Quoted 2 lines · Cédric Le Goater
Quoted 1 line · David Gibson
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

Ok. Note that the qemu emulated machine doesn't model the hardware right down to the level of hostboot. That's wy we're just loading skiboot and jumping straight into it usually. I guess clg's stuff to load pnor images gets us a little closer to the hardware behaviour, but I think it's still only a rough approximation.

On that note, is qemu-ppc64 currently capable of running LE firmware?

Well.. "qemu-ppc64" as such isn't capable of running either LE or firmware, since that's the Linux userspace emulator. qemu-system-ppc64 *is* capable of running both LE and BE firmwares though.

Your firmware will, however, need a tiny BE shim to switch the cpu into LE mode.

Quoted 31 lines

My
coreboot port has currently reached a hitch in that part of the firmware headers mapping stuff out is saved in LE mode while the cpu (real or emu) is running in BE mode (FMAP headers are saved LE but CBFS headers are saved BE)

Quoted 10 lines
Quoted 9 lines
Quoted 5 lines

It's really tied to the OpenPOWER firmwares using the HIOMAP protocol to discuss with the BMC and load the flash. We could loosen how QEMU interprets the MTD device and use a property to inform QEMU that this is an OpenPOWER PNOR file and that skiboot and can be loaded from it. Something to discuss.

Right. I'm guessing one significant issue here is that to fully model the BMC, with *its* firmware and comms channels with the main host would be quite a lot of work, hence cheating a bit to bypass that.

Quoted 9 lines

In fact, we are not cheating that much. We use the IPMI BT interface of QEMU to handle the HIOMAP communication with the BMC and this model is quite precise.

The mapping of the PNOR is simply mapped on the LPC FW address space. The underlying access are simplified because we don't have a LPC model but we could generate all the SPI transaction using the Aspeed models. I had experiments in that sense for P8.

Honestly getting the coreboot.rom into the lpc fw addr space in the same way you do pnor images would be a useful sim, as that's more or less how its going to be done on existing hardware.

Quoted 3 lines

I will sense the patches I have on the topic.

C.

Signature · 4 lines
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
#14 lore raw
Quoted 8 lines · David Gibson
Quoted 2 lines · Marty E. Plummer

On that note, is qemu-ppc64 currently capable of running LE firmware?

Well.. "qemu-ppc64" as such isn't capable of running either LE or firmware, since that's the Linux userspace emulator. qemu-system-ppc64 *is* capable of running both LE and BE firmwares though.

Ah. yeah, that's what I meant. Good to know.

Quoted 3 lines

Your firmware will, however, need a tiny BE shim to switch the cpu into LE mode.

Yeah, I figured as much, and was planning to have a shim available for 'real' hardware in the event a user wants to run coreboot in LE mode after both work properly (though somewhere in the OpenPOWER spec it is stated firmware must be BE).

Quoted 5 lines
Signature · 4 lines
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
#15 lore raw
Quoted 10 lines · Marty E. Plummer
Quoted 8 lines · David Gibson
Quoted 2 lines · Marty E. Plummer

On that note, is qemu-ppc64 currently capable of running LE firmware?

Well.. "qemu-ppc64" as such isn't capable of running either LE or firmware, since that's the Linux userspace emulator. qemu-system-ppc64 *is* capable of running both LE and BE firmwares though.

Ah. yeah, that's what I meant. Good to know.

Paul Mackerras came up with some magic code that can get you from an unknown endian state to a known state.

Quoted 7 lines
Quoted 3 lines

Your firmware will, however, need a tiny BE shim to switch the cpu into LE mode.

Yeah, I figured as much, and was planning to have a shim available for 'real' hardware in the event a user wants to run coreboot in LE mode after both work properly (though somewhere in the OpenPOWER spec it is stated firmware must be BE).

TBH, it makes no sense to specify the endianness of the firmware - it's an internal detail. The endianness of the firmware *interfaces* needs to be fixed of course, but not the endianness of the implementation.

Signature · 4 lines
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
#16 lore raw
In reply to Marty E. Plummer
Quoted 30 lines · Marty E. Plummer
Quoted 10 lines · Cédric Le Goater
Quoted 9 lines · David Gibson
Quoted 8 lines · Cédric Le Goater
Quoted 6 lines · David Gibson

Ok. Note that the qemu emulated machine doesn't model the hardware right down to the level of hostboot. That's wy we're just loading skiboot and jumping straight into it usually. I guess clg's stuff to load pnor images gets us a little closer to the hardware behaviour, but I think it's still only a rough approximation.

On that note, is qemu-ppc64 currently capable of running LE firmware? My coreboot port has currently reached a hitch in that part of the firmware headers mapping stuff out is saved in LE mode while the cpu (real or emu) is running in BE mode (FMAP headers are saved LE but CBFS headers are saved BE)

Quoted 14 lines
Quoted 9 lines
Quoted 5 lines

It's really tied to the OpenPOWER firmwares using the HIOMAP protocol to discuss with the BMC and load the flash. We could loosen how QEMU interprets the MTD device and use a property to inform QEMU that this is an OpenPOWER PNOR file and that skiboot and can be loaded from it. Something to discuss.

Right. I'm guessing one significant issue here is that to fully model the BMC, with *its* firmware and comms channels with the main host would be quite a lot of work, hence cheating a bit to bypass that.

In fact, we are not cheating that much. We use the IPMI BT interface of QEMU to handle the HIOMAP communication with the BMC and this model is quite precise.

Quoted 8 lines
Quoted 5 lines

The mapping of the PNOR is simply mapped on the LPC FW address space. The underlying access are simplified because we don't have a LPC model but we could generate all the SPI transaction using the Aspeed models. I had experiments in that sense for P8.

Honestly getting the coreboot.rom into the lpc fw addr space in the same way you do pnor images would be a useful sim, as that's more or less how its going to be done on existing hardware.

That is covered by patch 'ppc/pnv: Add HIOMAP commands' in the series I sent.

C.

#17 lore raw
Quoted 36 lines · Cédric Le Goater
Quoted 35 lines · Marty E. Plummer
Quoted 10 lines · Cédric Le Goater
Quoted 9 lines · David Gibson
Quoted 8 lines · Cédric Le Goater
Quoted 6 lines · David Gibson

Ok. Note that the qemu emulated machine doesn't model the hardware right down to the level of hostboot. That's wy we're just loading skiboot and jumping straight into it usually. I guess clg's stuff to load pnor images gets us a little closer to the hardware behaviour, but I think it's still only a rough approximation.

On that note, is qemu-ppc64 currently capable of running LE firmware? My coreboot port has currently reached a hitch in that part of the firmware headers mapping stuff out is saved in LE mode while the cpu (real or emu) is running in BE mode (FMAP headers are saved LE but CBFS headers are saved BE)

Quoted 19 lines
Quoted 9 lines
Quoted 5 lines

It's really tied to the OpenPOWER firmwares using the HIOMAP protocol to discuss with the BMC and load the flash. We could loosen how QEMU interprets the MTD device and use a property to inform QEMU that this is an OpenPOWER PNOR file and that skiboot and can be loaded from it. Something to discuss.

Right. I'm guessing one significant issue here is that to fully model the BMC, with *its* firmware and comms channels with the main host would be quite a lot of work, hence cheating a bit to bypass that.

In fact, we are not cheating that much. We use the IPMI BT interface of QEMU to handle the HIOMAP communication with the BMC and this model is quite precise.

The mapping of the PNOR is simply mapped on the LPC FW address space. The underlying access are simplified because we don't have a LPC model but we could generate all the SPI transaction using the Aspeed models. I had experiments in that sense for P8.

Quoted 7 lines
Quoted 3 lines

Honestly getting the coreboot.rom into the lpc fw addr space in the same way you do pnor images would be a useful sim, as that's more or less how its going to be done on existing hardware.

That is covered by patch 'ppc/pnv: Add HIOMAP commands' in the series I sent.

Unless I'm mistaken I have that patch in my build (I assume you pulled that right from your git branch powernv-4.2, which is what I built from) and that it would still parse and look for the skiboot partition, and run it. I need something akin to 'hey, shove this at the addr space and start executing $bios (where bios is either the bottom of the flash in that addr space or a provided -bios file on the command line).

The final intent after the first 'conversion' flash is that the coreboot bootblock will reside in the seeprom, akin to current hostboot bootloader, and then pull romstage from the flash over lpc into cache, then after romstage initializes memory pull ramstage into from the flash over lpc into ram and start executing that.

Quoted 1 line

C.

#18 lore raw
In reply to Cédric Le Goater
Quoted 22 lines · Cédric Le Goater
Quoted 21 lines · Marty E. Plummer
Quoted 20 lines · Cédric Le Goater
Quoted 9 lines · Marty E. Plummer

Hello,

First off, thank you for the work you've done on the ppc64 support, it has been very useful. I'm currently working on a coreboot port for the talos ii line of systems (which means more ppc64 support, support specifically for the power9 sforza chip, and specific mainboard support. My plate is very full lol) and have been using qemu to debug the bootblock.

Quoted 4 lines

It has been very useful for that, but I'm now at the point where I need to jump to romstage, and that's where it gets tricky. qemu parses the rom image and looks for a ffs header, locates skiboot on it, and jumps straight to that. Not exactly ideal for debugging something not produced from op-build.

yes. I suppose you are using my branch powernv-4.2 which adds PNOR support and a way to boot directly from PNOR. In that case, QEMU parses the PNOR file to extract the PAYLOAD partition (skiboot). skiboot also detects the flash and extract the kernel and initramfs from the PNOR.

Quoted 9 lines
Quoted 6 lines
Quoted 3 lines

However, you can bypass all this internal boot process by simply passing a -bios option and not passing a MTD device.

Doing so gives me the following error:
qemu-system-ppc64: Could not load OPAL firmware 'build/coreboot.rom' (this is after I patched the 4mb size limit up)

Could you make that rom available ?

Sent it, but the ml kicked back a 'hey, that's not a normal text file' error, could you confirm if you personally got it?

Quoted 3 lines

Thanks,

C.

#19 lore raw
In reply to Cédric Le Goater
Quoted 22 lines · Cédric Le Goater
Quoted 21 lines · Marty E. Plummer
Quoted 20 lines · Cédric Le Goater
Quoted 9 lines · Marty E. Plummer

Hello,

First off, thank you for the work you've done on the ppc64 support, it has been very useful. I'm currently working on a coreboot port for the talos ii line of systems (which means more ppc64 support, support specifically for the power9 sforza chip, and specific mainboard support. My plate is very full lol) and have been using qemu to debug the bootblock.

Quoted 4 lines

It has been very useful for that, but I'm now at the point where I need to jump to romstage, and that's where it gets tricky. qemu parses the rom image and looks for a ffs header, locates skiboot on it, and jumps straight to that. Not exactly ideal for debugging something not produced from op-build.

yes. I suppose you are using my branch powernv-4.2 which adds PNOR support and a way to boot directly from PNOR. In that case, QEMU parses the PNOR file to extract the PAYLOAD partition (skiboot). skiboot also detects the flash and extract the kernel and initramfs from the PNOR.

Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

However, you can bypass all this internal boot process by simply passing a -bios option and not passing a MTD device.

Doing so gives me the following error:
qemu-system-ppc64: Could not load OPAL firmware 'build/coreboot.rom' (this is after I patched the 4mb size limit up)

Oof. My bad, I had only patched the 4.1.0 package, not the live sources from your tree.

Quoted 2 lines

Could you make that rom available ?

Turns out the 'not text' warning came from lists.sr.ht, I wonder why that mailed me.

Quoted 3 lines

Thanks,

C.

#20 lore raw
Quoted 2 lines · Marty E. Plummer

Turns out the 'not text' warning came from lists.sr.ht, I wonder why that mailed me.

It's just an individual subscribed address that complains, not the qemu mailing list itself.

Philippe, did you say it was you that had subscribed a lists.sr.ht address ? Could you configure it not to complain to individual list senders? Failing that, would it be too annoying to unsubscribe it? At the moment it mostly seems to confuse people.

The other alternative here is I could turn back on the qemu-devel list facility that turns HTML emails into plain text. I sort of didn't want to do that, though, as editing emails means we end up with from-header mangling if the sender has a strict dmarc/dkim setup...

thanks
-- PMM

#21 lore raw
Quoted 4 lines · Peter Maydell
Quoted 2 lines · Marty E. Plummer

Turns out the 'not text' warning came from lists.sr.ht, I wonder why that mailed me.

Quoted 8 lines

It's just an individual subscribed address that complains, not the qemu mailing list itself.

Philippe, did you say it was you that had subscribed a lists.sr.ht address ? Could you configure it not to complain to individual list senders? Failing that, would it be too annoying to unsubscribe it? At the moment it mostly seems to confuse people.

Unfortunately it is not very configurable, so I simply unsubscribed it (no problem, it was just an experiment with sr.ht which provide fancy features such a similar patchwork system and repository, but we use patchew).

Quoted 5 lines

The other alternative here is I could turn back on the qemu-devel list facility that turns HTML emails into plain text. I sort of didn't want to do that, though, as editing emails means we end up with from-header mangling if the sender has a strict dmarc/dkim setup...

Agreed, no need to go back to this.

Sorry for the noise with this experiment.

Regards,

Phil.

#22 lore raw
In reply to Marty E. Plummer
Quoted 21 lines · Marty E. Plummer
Quoted 20 lines · Cédric Le Goater
Quoted 9 lines · Marty E. Plummer

Hello,

First off, thank you for the work you've done on the ppc64 support, it has been very useful. I'm currently working on a coreboot port for the talos ii line of systems (which means more ppc64 support, support specifically for the power9 sforza chip, and specific mainboard support. My plate is very full lol) and have been using qemu to debug the bootblock.

Quoted 4 lines

It has been very useful for that, but I'm now at the point where I need to jump to romstage, and that's where it gets tricky. qemu parses the rom image and looks for a ffs header, locates skiboot on it, and jumps straight to that. Not exactly ideal for debugging something not produced from op-build.

yes. I suppose you are using my branch powernv-4.2 which adds PNOR support and a way to boot directly from PNOR. In that case, QEMU parses the PNOR file to extract the PAYLOAD partition (skiboot). skiboot also detects the flash and extract the kernel and initramfs from the PNOR.

Quoted 6 lines
Quoted 3 lines

However, you can bypass all this internal boot process by simply passing a -bios option and not passing a MTD device.

Doing so gives me the following error:
qemu-system-ppc64: Could not load OPAL firmware 'build/coreboot.rom' (this is after I patched the 4mb size limit up)

Hm curious. We'd have to delve into load_image_targphys() and see why it's failing. Have you checked for simple causes: incorrect path, or bad permissions to your coreboot image.

Quoted 22 lines
Quoted 21 lines

I haven't published the PNOR support and the boot from PNOR yet. Lack of time and because sPAPR is the priority.

Quoted 2 lines

Do you think it would be within your wheelhouse to provide a generic, non-ffs pnor interface for loading arbitary rom images?

I should probably send the PNOR patchset now so that we can discuss on a better way to satisfy all needs.

Quoted 3 lines

It would be of great help if
you could. (This would still hopefully have the bmc support code as well, as I'm still needing to support a system using one).

We have support for Aspeed machines AST2400, AST2500 and AST2600. It is possible to interconnect them through the BT device. Or you can use the IPMI BT simulator of QEMU on the PowerNV machine

Thanks,

C.

Signature · 4 lines
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
#23 lore raw
In reply to Cédric Le Goater
Quoted 15 lines · Cédric Le Goater
Quoted 9 lines · Marty E. Plummer

Hello,

First off, thank you for the work you've done on the ppc64 support, it has been very useful. I'm currently working on a coreboot port for the talos ii line of systems (which means more ppc64 support, support specifically for the power9 sforza chip, and specific mainboard support. My plate is very full lol) and have been using qemu to debug the bootblock.

Quoted 4 lines

It has been very useful for that, but I'm now at the point where I need to jump to romstage, and that's where it gets tricky. qemu parses the rom image and looks for a ffs header, locates skiboot on it, and jumps straight to that. Not exactly ideal for debugging something not produced from op-build.

Quoted 4 lines

yes. I suppose you are using my branch powernv-4.2 which adds PNOR support and a way to boot directly from PNOR. In that case, QEMU parses the PNOR file to extract the PAYLOAD partition (skiboot). skiboot also detects the flash and extract the kernel and initramfs from the PNOR.

Ah! Now I understand. I hadn't looked at that branch, so I had no idea what all this pnor stuff was about. In mainline we just load skiboot as a normal firmware file and jump into it.

Quoted 2 lines

However, you can bypass all this internal boot process by simply passing a -bios option and not passing a MTD device.

Right.

Quoted 21 lines

I haven't published the PNOR support and the boot from PNOR yet. Lack of time and because sPAPR is the priority.

Quoted 2 lines

Do you think it would be within your wheelhouse to provide a generic, non-ffs pnor interface for loading arbitary rom images?

I should probably send the PNOR patchset now so that we can discuss on a better way to satisfy all needs.

Quoted 3 lines

It would be of great help if
you could. (This would still hopefully have the bmc support code as well, as I'm still needing to support a system using one).

We have support for Aspeed machines AST2400, AST2500 and AST2600. It is possible to interconnect them through the BT device. Or you can use the IPMI BT simulator of QEMU on the PowerNV machine

Thanks,

C.

Signature · 4 lines
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