Ok, I made those changes to openbios, here is the output.
> On May 8, 2018, at 6:50 AM, Joe van Tunen <joevt(a)shaw.ca> wrote:
>
> : (debug-feval) ( fcode# -- fcode# )
> \ Address
> fcode-stream 1 - . here u. ." : "
>
> \ Indicate if word is compiled
> state @ 0<> if
> ." (compile) "
> then
> dup fcode>xt cell - lfa2name type
> dup ." [ 0x" . ." ]" cr
> ;
These patches add support for booting from virtio-blk (PCI) devices as
used by QEMU.
Patches 1 and 2 add bootindex support which is the new way for passing
boot order information from QEMU to OpenBIOS. Note that there are also
corresponding patches for QEMU required, without which the generated
device paths will be incorrect and cause virtio boot to fail.
Patch 3 adds the legacy virtio-blk driver (it follows the 0.9 rather
than the 1.0 specification).
Patch 4 enables the new driver for both PPC and SPARC64 architectures
so that virtio-blk devices will be usable out-of-the-box with QEMU.
Once these patches have been applied to OpenBIOS (along with the
corresponding fw path fixes for QEMU) it is possible to boot from
virtio-blk devices like this:
PPC:
./qemu-system-ppc -drive file=debian-9.0-powerpc-NETINST.iso,if=none,index=0,id=cd,media=cdrom \
-device virtio-blk-pci,drive=cd,bootindex=0 -m 256 -boot d
SPARC:
./qemu-system-sparc64 -drive debian-9.0-sparc64-NETINST.iso,if=none,index=0,id=cd,media=cdrom \
-device virtio-blk-pci,bus=pciB,drive=cd,bootindex=0 -m 256 -boot d -nographic
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland(a)ilande.co.uk>
Mark Cave-Ayland (4):
ppc: add bootindex support
SPARC64: add bootindex support
drivers: add legacy virtio-blk driver
config: enable virtio-blk driver for default PPC and SPARC64 builds
arch/ppc/qemu/init.c | 55 ++++-
arch/sparc64/boot.c | 2 +-
arch/sparc64/boot.h | 2 +-
arch/sparc64/openbios.c | 38 +++-
config/examples/ppc_config.xml | 1 +
config/examples/sparc64_config.xml | 1 +
drivers/build.xml | 1 +
drivers/pci.c | 18 ++
drivers/pci_database.c | 4 +-
drivers/pci_database.h | 1 +
drivers/virtio.c | 424 +++++++++++++++++++++++++++++++++++++
drivers/virtio.h | 331 +++++++++++++++++++++++++++++
include/drivers/drivers.h | 4 +
13 files changed, 862 insertions(+), 20 deletions(-)
create mode 100644 drivers/virtio.c
create mode 100644 drivers/virtio.h
--
2.11.0
Here are a couple of 40p fixes I noticed whilst debugging the interrupt
routing in QEMU's 40p PReP machine.
Note that the IRQ changes in patch 2 are dependent upon my fix for the
40p PCI IRQ routing posted at
https://lists.gnu.org/archive/html/qemu-devel/2018-08/msg05705.html.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland(a)ilande.co.uk>
Mark Cave-Ayland (2):
40p: fix up generation of interrupt properties
40p: update PReP configuration to match 40p machine
arch/ppc/qemu/init.c | 4 ++--
drivers/pci.c | 15 +++++++--------
2 files changed, 9 insertions(+), 10 deletions(-)
--
2.11.0
These patches add support for booting from virtio-blk (PCI) devices as
used by QEMU.
Patches 1 and 2 add bootindex support which is the new way for passing
boot order information from QEMU to OpenBIOS. Note that there are also
corresponding patches for QEMU required, without which the generated
device paths will be incorrect and cause virtio boot to fail.
Patch 3 adds the virtio-1.0 compliant virtio-blk PCI driver.
Patch 4 enables the new driver for both PPC and SPARC64 architectures
so that virtio-blk-pci devices will be usable out-of-the-box with QEMU.
Once these patches have been applied to OpenBIOS (along with the
corresponding fw path fixes for QEMU) it is possible to boot from
virtio-blk-pci devices like this:
PPC:
./qemu-system-ppc -drive file=debian-9.0-powerpc-NETINST.iso,if=none,index=0,id=cd,media=cdrom \
-device virtio-blk-pci,drive=cd,bootindex=0 -m 256 -boot d
SPARC:
./qemu-system-sparc64 -drive debian-9.0-sparc64-NETINST.iso,if=none,index=0,id=cd,media=cdrom \
-device virtio-blk-pci,bus=pciB,drive=cd,bootindex=0 -m 256 -boot d -nographic
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland(a)ilande.co.uk>
v3:
- Rebase onto master
- Convert from legacy driver to virtio-1.0 driver
v2:
- Switch over to using dma-* words to allocate rings and descriptors
- Fix up some minor whitespace issues
Mark Cave-Ayland (4):
ppc: add bootindex support
SPARC64: add bootindex support
drivers: add virtio-1.0 virtio-blk driver
config: enable virtio-blk driver for default PPC and SPARC64 builds
arch/ppc/qemu/init.c | 55 +++-
arch/sparc64/boot.c | 2 +-
arch/sparc64/boot.h | 2 +-
arch/sparc64/openbios.c | 38 ++-
config/examples/ppc_config.xml | 1 +
config/examples/sparc64_config.xml | 1 +
drivers/build.xml | 1 +
drivers/pci.c | 63 +++++
drivers/pci_database.c | 14 +-
drivers/pci_database.h | 1 +
drivers/virtio.c | 555 +++++++++++++++++++++++++++++++++++++
drivers/virtio.h | 370 +++++++++++++++++++++++++
include/drivers/drivers.h | 5 +
include/drivers/pci.h | 6 +
14 files changed, 1093 insertions(+), 21 deletions(-)
create mode 100644 drivers/virtio.c
create mode 100644 drivers/virtio.h
--
2.11.0
The default context used by init-program is allocated from the OpenBIOS
heap which uses a different virt to phys mapping to avoid having to
physically relocate the PROM on startup for PPC machines.
It seems that the OpenBSD bootloader isn't happy with this change
introduced by the context rework, most likely because there is an
assumption that the client stack is mapped 1:1 virt to phys.
Fix this by overriding the default context stack during init-program
to a location just under the MMU hash table (SDR1) which was its
previous hard-coded location in 1:1 virt to phys mapped memory, and
allow OpenBSD to boot.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland(a)ilande.co.uk>
---
arch/ppc/qemu/context.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/arch/ppc/qemu/context.c b/arch/ppc/qemu/context.c
index 03ca173..06e0122 100644
--- a/arch/ppc/qemu/context.c
+++ b/arch/ppc/qemu/context.c
@@ -16,6 +16,7 @@
#include "libopenbios/ofmem.h"
#include "libopenbios/initprogram.h"
#include "libopenbios/sys_info.h"
+#include "arch/ppc/processor.h"
#define MAIN_STACK_SIZE 16384
#define IMAGE_STACK_SIZE 4096*2
@@ -232,6 +233,14 @@ arch_init_program(void)
ctx->regs[REG_R6] = 0;
ctx->regs[REG_R7] = 0;
+ /* Override the stack in the default context: the OpenBSD bootloader
+ fails soon after setting up virt to phys mappings with the default
+ stack. My best guess is that this is because the malloc() heap
+ doesn't have a 1:1 virt to phys mapping. So for the moment we use
+ the original (pre-context) location just under the MMU hash table
+ (SDR1) which is mapped 1:1 and makes the bootloader happy. */
+ ctx->sp = mfsdr1() - 32768 - 65536;
+
/* Set param */
feval("load-state >ls.param @");
param = POP();
--
2.11.0
These patches add support for booting from virtio-blk (PCI) devices as
used by QEMU.
Patches 1 and 2 add bootindex support which is the new way for passing
boot order information from QEMU to OpenBIOS. Note that there are also
corresponding patches for QEMU required, without which the generated
device paths will be incorrect and cause virtio boot to fail.
Patch 3 adds the legacy virtio-blk driver (it follows the 0.9 rather
than the 1.0 specification).
Patch 4 enables the new driver for both PPC and SPARC64 architectures
so that virtio-blk devices will be usable out-of-the-box with QEMU.
Once these patches have been applied to OpenBIOS (along with the
corresponding fw path fixes for QEMU) it is possible to boot from
virtio-blk devices like this:
PPC:
./qemu-system-ppc -drive file=debian-9.0-powerpc-NETINST.iso,if=none,index=0,id=cd,media=cdrom \
-device virtio-blk-pci,drive=cd,bootindex=0 -m 256 -boot d
SPARC:
./qemu-system-sparc64 -drive debian-9.0-sparc64-NETINST.iso,if=none,index=0,id=cd,media=cdrom \
-device virtio-blk-pci,bus=pciB,drive=cd,bootindex=0 -m 256 -boot d -nographic
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland(a)ilande.co.uk>
v2:
- Switch over to using dma-* words to allocate rings and descriptors
- Fix up some minor whitespace issues
Mark Cave-Ayland (4):
ppc: add bootindex support
SPARC64: add bootindex support
drivers: add legacy virtio-blk driver
config: enable virtio-blk driver for default PPC and SPARC64 builds
arch/ppc/qemu/init.c | 55 +++-
arch/sparc64/boot.c | 2 +-
arch/sparc64/boot.h | 2 +-
arch/sparc64/openbios.c | 38 ++-
config/examples/ppc_config.xml | 1 +
config/examples/sparc64_config.xml | 1 +
drivers/build.xml | 1 +
drivers/pci.c | 18 ++
drivers/pci_database.c | 4 +-
drivers/pci_database.h | 1 +
drivers/virtio.c | 516 +++++++++++++++++++++++++++++++++++++
drivers/virtio.h | 330 ++++++++++++++++++++++++
include/drivers/drivers.h | 4 +
13 files changed, 953 insertions(+), 20 deletions(-)
create mode 100644 drivers/virtio.c
create mode 100644 drivers/virtio.h
--
2.11.0
Here is a set of fixes discovered during my work on adding virtio-blk
support to OpenBIOS.
Patch 1 changes the way in which the IDE controller DT nodes are generated
so that they use the controller index as the address, and not the value
programmed in the PCI BAR. Otherwise it is impossible for QEMU to determine
the fw path for IDE boot devices, since the PCI BARs are programmed after
the machine has been initialised.
Patches 2 and 3 contain fixes for bugs that were discovered whilst trying
to initialise the virtio-blk device for both PPC and SPARC64 architectures.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland(a)ilande.co.uk>
Mark Cave-Ayland (3):
ide: don't use ioports as part of the controller node address
libopenbios: don't allow find_package_method() to push a NULL for
empty strings
pci: use absolute PCI IO addresses when programming bridge IO limits
config/examples/ppc64_config.xml | 2 +-
config/examples/ppc_config.xml | 2 +-
drivers/ide.c | 18 ++++++++----------
drivers/pci.c | 2 +-
libopenbios/bindings.c | 7 ++++++-
5 files changed, 17 insertions(+), 14 deletions(-)
--
2.11.0