From f39b985b6ec3b60c70434a659bcc3c08644e18d6 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Apr 16 2015 15:25:12 +0000 Subject: Fix virtio bug with UEFI driver --- diff --git a/0001-virtio-Downgrade-per-iobuf-debug-messages-to-DBGC2.patch b/0001-virtio-Downgrade-per-iobuf-debug-messages-to-DBGC2.patch new file mode 100644 index 0000000..d6a182d --- /dev/null +++ b/0001-virtio-Downgrade-per-iobuf-debug-messages-to-DBGC2.patch @@ -0,0 +1,51 @@ +From b12b1b620fffc89e86af3879a945e7ffaa7c141d Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Fri, 10 Apr 2015 21:53:21 +0200 +Subject: [PATCH] [virtio] Downgrade per-iobuf debug messages to DBGC2 + +Signed-off-by: Laszlo Ersek +Signed-off-by: Michael Brown +--- + src/drivers/net/virtio-net.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/src/drivers/net/virtio-net.c b/src/drivers/net/virtio-net.c +index 8b67d9d..533ccb0 100644 +--- a/src/drivers/net/virtio-net.c ++++ b/src/drivers/net/virtio-net.c +@@ -131,8 +131,8 @@ static void virtnet_enqueue_iob ( struct net_device *netdev, + }, + }; + +- DBGC ( virtnet, "VIRTIO-NET %p enqueuing iobuf %p on vq %d\n", +- virtnet, iobuf, vq_idx ); ++ DBGC2 ( virtnet, "VIRTIO-NET %p enqueuing iobuf %p on vq %d\n", ++ virtnet, iobuf, vq_idx ); + + vring_add_buf ( vq, list, out, in, iobuf, 0 ); + vring_kick ( virtnet->ioaddr, vq, 1 ); +@@ -256,8 +256,8 @@ static void virtnet_process_tx_packets ( struct net_device *netdev ) { + while ( vring_more_used ( tx_vq ) ) { + struct io_buffer *iobuf = vring_get_buf ( tx_vq, NULL ); + +- DBGC ( virtnet, "VIRTIO-NET %p tx complete iobuf %p\n", +- virtnet, iobuf ); ++ DBGC2 ( virtnet, "VIRTIO-NET %p tx complete iobuf %p\n", ++ virtnet, iobuf ); + + netdev_tx_complete ( netdev, iobuf ); + } +@@ -283,8 +283,8 @@ static void virtnet_process_rx_packets ( struct net_device *netdev ) { + iob_unput ( iobuf, RX_BUF_SIZE ); + iob_put ( iobuf, len - sizeof ( struct virtio_net_hdr ) ); + +- DBGC ( virtnet, "VIRTIO-NET %p rx complete iobuf %p len %zd\n", +- virtnet, iobuf, iob_len ( iobuf ) ); ++ DBGC2 ( virtnet, "VIRTIO-NET %p rx complete iobuf %p len %zd\n", ++ virtnet, iobuf, iob_len ( iobuf ) ); + + /* Pass completed packet to the network stack */ + netdev_rx ( netdev, iobuf ); +-- +2.3.5 + diff --git a/0002-efi-Ensure-drivers-are-disconnected-when-ExitBootSer.patch b/0002-efi-Ensure-drivers-are-disconnected-when-ExitBootSer.patch new file mode 100644 index 0000000..8cb1655 --- /dev/null +++ b/0002-efi-Ensure-drivers-are-disconnected-when-ExitBootSer.patch @@ -0,0 +1,79 @@ +From 755d2b8f6be681a2e620534b237471b75f28ed8c Mon Sep 17 00:00:00 2001 +From: Michael Brown +Date: Mon, 13 Apr 2015 12:06:59 +0100 +Subject: [PATCH] [efi] Ensure drivers are disconnected when ExitBootServices() + is called + +We hook the UEFI ExitBootServices() event and use it to trigger a call +to shutdown_boot(). This does not automatically cause drivers to be +disconnected from their devices, since device enumeration is now +handled by the UEFI core rather than by iPXE. (Under the old and +dubiously compatible device model, iPXE used to perform its own device +enumeration and so the call to shutdown_boot() would indeed have +caused drivers to be disconnected.) + +Fix by replicating parts of the dummy "EFI root device" from +efiprefix.c to efidrvprefix.c, so that the call to shutdown_boot() +will call efi_driver_disconnect_all(). + +Originally-fixed-by: Laszlo Ersek +Tested-by: Laszlo Ersek +Signed-off-by: Michael Brown +--- + src/arch/x86/prefix/efidrvprefix.c | 35 +++++++++++++++++++++++++++++++++++ + 1 file changed, 35 insertions(+) + +diff --git a/src/arch/x86/prefix/efidrvprefix.c b/src/arch/x86/prefix/efidrvprefix.c +index 3daefd0..4fbb19f 100644 +--- a/src/arch/x86/prefix/efidrvprefix.c ++++ b/src/arch/x86/prefix/efidrvprefix.c +@@ -21,7 +21,9 @@ FILE_LICENCE ( GPL2_OR_LATER ); + + #include + #include ++#include + #include ++#include + + /** + * EFI entry point +@@ -44,3 +46,36 @@ EFI_STATUS EFIAPI _efidrv_start ( EFI_HANDLE image_handle, + + return 0; + } ++ ++/** ++ * Probe EFI root bus ++ * ++ * @v rootdev EFI root device ++ */ ++static int efi_probe ( struct root_device *rootdev __unused ) { ++ ++ /* Do nothing */ ++ return 0; ++} ++ ++/** ++ * Remove EFI root bus ++ * ++ * @v rootdev EFI root device ++ */ ++static void efi_remove ( struct root_device *rootdev __unused ) { ++ ++ efi_driver_disconnect_all(); ++} ++ ++/** EFI root device driver */ ++static struct root_driver efi_root_driver = { ++ .probe = efi_probe, ++ .remove = efi_remove, ++}; ++ ++/** EFI root device */ ++struct root_device efi_root_device __root_device = { ++ .dev = { .name = "EFI" }, ++ .driver = &efi_root_driver, ++}; +-- +2.3.5 + diff --git a/ipxe.spec b/ipxe.spec index 81a0c9f..d80b3ae 100644 --- a/ipxe.spec +++ b/ipxe.spec @@ -39,7 +39,7 @@ Name: ipxe Version: %{date} -Release: 1.git%{hash}%{?dist} +Release: 2.git%{hash}%{?dist} Summary: A network boot loader Group: System Environment/Base @@ -50,6 +50,11 @@ Source0: %{name}-%{version}-git%{hash}.tar.xz Source1: USAGE Source2: config.local.general.h +# From upstream commit b12b1b620fffc89e86af3879a945e7ffaa7c141d +Patch0001: 0001-virtio-Downgrade-per-iobuf-debug-messages-to-DBGC2.patch +# From upstream commit 755d2b8f6be681a2e620534b237471b75f28ed8c +Patch0002: 0002-efi-Ensure-drivers-are-disconnected-when-ExitBootSer.patch + # From QEMU Patch1001: qemu-0001-efi_snp-improve-compliance-with-the-EFI_SIMPLE_NETWO.patch Patch1002: qemu-0002-efi-make-load-file-protocol-optional.patch @@ -119,6 +124,9 @@ DNS, HTTP, iSCSI, etc. %prep %setup -q -n %{name}-%{version}-git%{hash} +# From upstream +%patch0001 -p1 +%patch0002 -p1 # From QEMU %patch1001 -p1 %patch1002 -p1 @@ -218,6 +226,9 @@ done %endif %changelog +* Thu Apr 16 2015 Paolo Bonzini - 20150407-2.gitdc795b9f +- Fix virtio bug with UEFI driver + * Thu Apr 16 2015 Paolo Bonzini - 20150407-1.gitdc795b9f - Update to latest upstream snapshot - Switch source to .tar.xz