Skip to contentSkip to conversation

ipxe: add efi support

PATCH In review Gerd Hoffmann 2 participants 7 messages Mar 4, 2013

lore
Share & tools
lore
#0 lore raw

cover ipxe: add efi support

Hi,

This patch series adds efi support to our nic roms. Patch #4 (carrying the binaries) is pretty big and isn't sent to the list. If you wanna test without compiling your own roms please pull the git tree below.

cheers,
Gerd

The following changes since commit 806f352d3d6f7b326b0ab3a49c622b124459dc8d:

gen-icount.h: Rename gen_icount_start/end to gen_tb_start/end (2013-03-03 14:29:08 +0000)

are available in the git repository at:

git://git.kraxel.org/qemu ipxe.1

for you to fetch changes up to 3741d5a42cf9658d6ba7e0bb06db67f6f4a485e4:

Switch to efi-enabled nic roms by default (2013-03-04 10:21:19 +0100)

----------------------------------------------------------------
Gerd Hoffmann (5):
Add Makefile rules to build nic rom binaries Update ipxe submodule to latest master
Add Makefile rules to build nic rom binaries with efi support Add efi rom binaries
Switch to efi-enabled nic roms by default

 hw/e1000.c               |    2 +-
 hw/ne2000.c              |    2 +-
 hw/pc.h                  |   24 ++++++++++++++++++++++--
 hw/pcnet-pci.c           |    2 +-
 hw/rtl8139.c             |    2 +-
 hw/virtio-pci.c          |    2 +-
 pc-bios/efi-e1000.rom    |  Bin 0 -> 174080 bytes
 pc-bios/efi-eepro100.rom |  Bin 0 -> 175104 bytes
 pc-bios/efi-ne2k_pci.rom |  Bin 0 -> 173568 bytes
 pc-bios/efi-pcnet.rom    |  Bin 0 -> 173568 bytes
 pc-bios/efi-rtl8139.rom  |  Bin 0 -> 177152 bytes
 pc-bios/efi-virtio.rom   |  Bin 0 -> 171008 bytes
 roms/Makefile            |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 roms/ipxe                |    2 +-
 14 files changed, 74 insertions(+), 8 deletions(-)
 create mode 100644 pc-bios/efi-e1000.rom
 create mode 100644 pc-bios/efi-eepro100.rom
 create mode 100644 pc-bios/efi-ne2k_pci.rom
 create mode 100644 pc-bios/efi-pcnet.rom
 create mode 100644 pc-bios/efi-rtl8139.rom
 create mode 100644 pc-bios/efi-virtio.rom
#1 lore raw

PATCH 1/5 Add Makefile rules to build nic rom binaries

"make -C roms pxerom" will build the ipxe roms and update the binaries in pc-bios/, i.e. it basically documents how the build process of our current nic roms works.

---
 roms/Makefile |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
roms/Makefile +21 -0
index 5e645bc..be33652 100644
@@ -1,5 +1,19 @@
 
 vgabios_variants := stdvga cirrus vmware qxl
+pxerom_variants  := e1000 eepro100 ne2k_pci pcnet rtl8139 virtio
+
+pxe-rom-e1000    : VID := 8086
+pxe-rom-e1000    : DID := 100e
+pxe-rom-eepro100 : VID := 8086
+pxe-rom-eepro100 : DID := 1209
+pxe-rom-ne2k_pci : VID := 1050
+pxe-rom-ne2k_pci : DID := 0940
+pxe-rom-pcnet    : VID := 1022
+pxe-rom-pcnet    : DID := 2000
+pxe-rom-rtl8139  : VID := 10ec
+pxe-rom-rtl8139  : DID := 8139
+pxe-rom-virtio   : VID := 1af4
+pxe-rom-virtio   : DID := 1000
 
 default:
 	@echo "nothing is build by default"
@@ -7,6 +21,7 @@ default:
 	@echo "  bios           -- update bios.bin (seabios)"
 	@echo "  seavgabios     -- update vgabios binaries (seabios)"
 	@echo "  lgplvgabios    -- update vgabios binaries (lgpl)"
+	@echo "  pxerom         -- update nic roms (bios only)"
 
 bios: config.seabios
 	sh configure-seabios.sh $<
@@ -26,3 +41,9 @@ lgplvgabios: $(patsubst %,lgplvgabios-%,$(vgabios_variants))
 lgplvgabios-%:
 	make -C vgabios vgabios-$*.bin
 	cp vgabios/VGABIOS-lgpl-latest.$*.bin ../pc-bios/vgabios-$*.bin
+
+pxerom: $(patsubst %,pxe-rom-%,$(pxerom_variants))
+
+pxe-rom-%:
+	make -C ipxe/src bin/$(VID)$(DID).rom
+	cp ipxe/src/bin/$(VID)$(DID).rom ../pc-bios/pxe-$*.rom
Signature · 1 line
1.7.9.7
#2 lore raw

PATCH 2/5 Update ipxe submodule to latest master

In reply to Gerd Hoffmann

Needed for efi support.

ipxe is grown a bit, so *not* recompiling the (non-efi) pxe roms because that would make some pxe roms larger than 64k, which in turn would be a guest-visible change because the rom bar size grows from 64k to 128k.

---
 roms/ipxe |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
roms/ipxe +1 -1
index 7aee315..09c5109 160000
@@ -1 +1 @@
-Subproject commit 7aee315f61aaf1be6d2fff26339f28a1137231a5
+Subproject commit 09c5109b8585178172c7608de8d52e9d9af0b680
Signature · 1 line
1.7.9.7
#3 lore raw

PATCH 3/5 Add Makefile rules to build nic rom binaries with efi support

In reply to Gerd Hoffmann

"make -C roms efirom" will build rom binaries with EFI support. They are composed from three images: legacy bios, efi ia32 and efi x64. So netbooting via SeaBIOS will continue to work like it does today, and additionally we get network support for EFI. This target needs the EfiRom utility (shipped with edk2) somewhere in the $PATH.

---
 roms/Makefile |   49 +++++++++++++++++++++++++++++++++++++------------
 1 file changed, 37 insertions(+), 12 deletions(-)
roms/Makefile +37 -12
index be33652..3dc5609 100644
@@ -2,18 +2,29 @@
 vgabios_variants := stdvga cirrus vmware qxl
 pxerom_variants  := e1000 eepro100 ne2k_pci pcnet rtl8139 virtio
 
-pxe-rom-e1000    : VID := 8086
-pxe-rom-e1000    : DID := 100e
-pxe-rom-eepro100 : VID := 8086
-pxe-rom-eepro100 : DID := 1209
-pxe-rom-ne2k_pci : VID := 1050
-pxe-rom-ne2k_pci : DID := 0940
-pxe-rom-pcnet    : VID := 1022
-pxe-rom-pcnet    : DID := 2000
-pxe-rom-rtl8139  : VID := 10ec
-pxe-rom-rtl8139  : DID := 8139
-pxe-rom-virtio   : VID := 1af4
-pxe-rom-virtio   : DID := 1000
+pxe-rom-e1000    efi-rom-e1000    : VID := 8086
+pxe-rom-e1000    efi-rom-e1000    : DID := 100e
+pxe-rom-eepro100 efi-rom-eepro100 : VID := 8086
+pxe-rom-eepro100 efi-rom-eepro100 : DID := 1209
+pxe-rom-ne2k_pci efi-rom-ne2k_pci : VID := 1050
+pxe-rom-ne2k_pci efi-rom-ne2k_pci : DID := 0940
+pxe-rom-pcnet    efi-rom-pcnet    : VID := 1022
+pxe-rom-pcnet    efi-rom-pcnet    : DID := 2000
+pxe-rom-rtl8139  efi-rom-rtl8139  : VID := 10ec
+pxe-rom-rtl8139  efi-rom-rtl8139  : DID := 8139
+pxe-rom-virtio   efi-rom-virtio   : VID := 1af4
+pxe-rom-virtio   efi-rom-virtio   : DID := 1000
+
+#
+# EfiRom utility is shipped with edk2 / tianocore, in BaseTools/
+#
+# We need that to combine multiple images (legacy bios,
+# efi ia32, efi x64) into a single rom binary.
+#
+# We try to find it in the path.  You can also pass the location on
+# the command line, i.e. "make EFIROM=/path/to/EfiRom efirom"
+#
+EFIROM ?= $(shell which EfiRom 2>/dev/null)
 
 default:
 	@echo "nothing is build by default"
@@ -22,6 +33,8 @@ default:
 	@echo "  seavgabios     -- update vgabios binaries (seabios)"
 	@echo "  lgplvgabios    -- update vgabios binaries (lgpl)"
 	@echo "  pxerom         -- update nic roms (bios only)"
+	@echo "  efirom         -- update nic roms (bios+efi, this needs"
+	@echo "                    the EfiRom utility from edk2 / tianocore)"
 
 bios: config.seabios
 	sh configure-seabios.sh $<
@@ -47,3 +60,15 @@ pxerom: $(patsubst %,pxe-rom-%,$(pxerom_variants))
 pxe-rom-%:
 	make -C ipxe/src bin/$(VID)$(DID).rom
 	cp ipxe/src/bin/$(VID)$(DID).rom ../pc-bios/pxe-$*.rom
+
+efirom: $(patsubst %,efi-rom-%,$(pxerom_variants))
+
+efi-rom-%:
+	make -C ipxe/src bin/$(VID)$(DID).rom
+	make -C ipxe/src bin-i386-efi/$(VID)$(DID).efidrv
+	make -C ipxe/src bin-x86_64-efi/$(VID)$(DID).efidrv
+	$(EFIROM) -f "0x$(VID)" -i "0x$(DID)" -l 0x02 \
+		-b ipxe/src/bin/$(VID)$(DID).rom \
+		-ec ipxe/src/bin-i386-efi/$(VID)$(DID).efidrv \
+		-ec ipxe/src/bin-x86_64-efi/$(VID)$(DID).efidrv \
+		-o ../pc-bios/efi-$*.rom
Signature · 1 line
1.7.9.7
#4 lore raw

PATCH 4/5 Add efi rom binaries

In reply to Gerd Hoffmann
---
 pc-bios/efi-e1000.rom    |  Bin 0 -> 174080 bytes
 pc-bios/efi-eepro100.rom |  Bin 0 -> 175104 bytes
 pc-bios/efi-ne2k_pci.rom |  Bin 0 -> 173568 bytes
 pc-bios/efi-pcnet.rom    |  Bin 0 -> 173568 bytes
 pc-bios/efi-rtl8139.rom  |  Bin 0 -> 177152 bytes
 pc-bios/efi-virtio.rom   |  Bin 0 -> 171008 bytes
 6 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 pc-bios/efi-e1000.rom
 create mode 100644 pc-bios/efi-eepro100.rom
 create mode 100644 pc-bios/efi-ne2k_pci.rom
 create mode 100644 pc-bios/efi-pcnet.rom
 create mode 100644 pc-bios/efi-rtl8139.rom
 create mode 100644 pc-bios/efi-virtio.rom
pc-bios/efi-e1000.rom +0 -0

[ ... snipped xxl binary patch ... ]

#5 lore raw

PATCH 5/5 Switch to efi-enabled nic roms by default

In reply to Gerd Hoffmann

All PCI nics are switched to EFI-enabled roms by default. They are composed from three images (legacy, efi ia32 & efi x86), so classic pxe booting will continue to work.

Exception: eepro100 is not switched, it uses a single rom for all emulated eepro100 variants, then goes patch the rom header on the fly with the correct PCI IDs. I doubt that will work as-is with the efi roms.

Keep old roms for 1.4+older machine types via compat properties, needed because the efi-enabled roms are larger so the pci rom bar size would change.

---
 hw/e1000.c      |    2 +-
 hw/ne2000.c     |    2 +-
 hw/pc.h         |   24 ++++++++++++++++++++++--
 hw/pcnet-pci.c  |    2 +-
 hw/rtl8139.c    |    2 +-
 hw/virtio-pci.c |    2 +-
 6 files changed, 27 insertions(+), 7 deletions(-)
hw/e1000.c +1 -1
index d6fe815..c95304f 100644
@@ -1353,7 +1353,7 @@ static void e1000_class_init(ObjectClass *klass, void *data)
 
     k->init = pci_e1000_init;
     k->exit = pci_e1000_uninit;
-    k->romfile = "pxe-e1000.rom";
+    k->romfile = "efi-e1000.rom";
     k->vendor_id = PCI_VENDOR_ID_INTEL;
     k->device_id = E1000_DEVID;
     k->revision = 0x03;
hw/ne2000.c +1 -1
index 3dd1c84..ba86701 100644
@@ -766,7 +766,7 @@ static void ne2000_class_init(ObjectClass *klass, void *data)
 
     k->init = pci_ne2000_init;
     k->exit = pci_ne2000_exit;
-    k->romfile = "pxe-ne2k_pci.rom",
+    k->romfile = "efi-ne2k_pci.rom",
     k->vendor_id = PCI_VENDOR_ID_REALTEK;
     k->device_id = PCI_DEVICE_ID_REALTEK_8029;
     k->class_id = PCI_CLASS_NETWORK_ETHERNET;
hw/pc.h +22 -2
index da1b102..30b0cf5 100644
@@ -212,10 +212,30 @@ int e820_add_entry(uint64_t, uint64_t, uint32_t);
             .driver   = "ide-drive",\
             .property = "discard_granularity",\
             .value    = stringify(0),\
-	},{\
+        },{\
             .driver   = "virtio-blk-pci",\
             .property = "discard_granularity",\
             .value    = stringify(0),\
-	}
+        },{\
+            .driver   = "e1000",\
+            .property = "romfile",\
+            .value    = "pxe-e1000.rom",\
+        },{\
+            .driver   = "ne2k_pci",\
+            .property = "romfile",\
+            .value    = "pxe-ne2k_pci.rom",\
+        },{\
+            .driver   = "pcnet",\
+            .property = "romfile",\
+            .value    = "pxe-pcnet.rom",\
+        },{\
+            .driver   = "rtl8139",\
+            .property = "romfile",\
+            .value    = "pxe-rtl8139.rom",\
+        },{\
+            .driver   = "virtio-net-pci",\
+            .property = "romfile",\
+            .value    = "pxe-virtio.rom",\
+        }
 
 #endif
hw/pcnet-pci.c +1 -1
index df63b22..e89e5fa 100644
@@ -351,7 +351,7 @@ static void pcnet_class_init(ObjectClass *klass, void *data)
 
     k->init = pci_pcnet_init;
     k->exit = pci_pcnet_uninit;
-    k->romfile = "pxe-pcnet.rom",
+    k->romfile = "efi-pcnet.rom",
     k->vendor_id = PCI_VENDOR_ID_AMD;
     k->device_id = PCI_DEVICE_ID_AMD_LANCE;
     k->revision = 0x10;
hw/rtl8139.c +1 -1
index d7716be..fc2c7f1 100644
@@ -3530,7 +3530,7 @@ static void rtl8139_class_init(ObjectClass *klass, void *data)
 
     k->init = pci_rtl8139_init;
     k->exit = pci_rtl8139_uninit;
-    k->romfile = "pxe-rtl8139.rom";
+    k->romfile = "efi-rtl8139.rom";
     k->vendor_id = PCI_VENDOR_ID_REALTEK;
     k->device_id = PCI_DEVICE_ID_REALTEK_8139;
     k->revision = RTL8139_PCI_REVID; /* >=0x20 is for 8139C+ */
hw/virtio-pci.c +1 -1
index a869f53..e24b20f 100644
@@ -1137,7 +1137,7 @@ static void virtio_net_class_init(ObjectClass *klass, void *data)
 
     k->init = virtio_net_init_pci;
     k->exit = virtio_net_exit_pci;
-    k->romfile = "pxe-virtio.rom";
+    k->romfile = "efi-virtio.rom";
     k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
     k->device_id = PCI_DEVICE_ID_VIRTIO_NET;
     k->revision = VIRTIO_PCI_ABI_VERSION;
Signature · 1 line
1.7.9.7
Reviewed-by on the v1 series
#6 lore raw
In reply to Gerd Hoffmann
Quoted 7 lines · Gerd Hoffmann

Hi,

This patch series adds efi support to our nic roms. Patch #4 (carrying the binaries) is pretty big and isn't sent to the list. If you wanna test without compiling your own roms please pull the git tree below.

Looks pretty reasonable.

Regards,

Anthony Liguori

Quoted 44 lines

cheers,
Gerd

The following changes since commit 806f352d3d6f7b326b0ab3a49c622b124459dc8d:

gen-icount.h: Rename gen_icount_start/end to gen_tb_start/end (2013-03-03 14:29:08 +0000)

are available in the git repository at:

git://git.kraxel.org/qemu ipxe.1

for you to fetch changes up to 3741d5a42cf9658d6ba7e0bb06db67f6f4a485e4:

Switch to efi-enabled nic roms by default (2013-03-04 10:21:19 +0100)

----------------------------------------------------------------
Gerd Hoffmann (5):
Add Makefile rules to build nic rom binaries Update ipxe submodule to latest master
Add Makefile rules to build nic rom binaries with efi support Add efi rom binaries
Switch to efi-enabled nic roms by default

 hw/e1000.c               |    2 +-
 hw/ne2000.c              |    2 +-
 hw/pc.h                  |   24 ++++++++++++++++++++++--
 hw/pcnet-pci.c           |    2 +-
 hw/rtl8139.c             |    2 +-
 hw/virtio-pci.c          |    2 +-
 pc-bios/efi-e1000.rom    |  Bin 0 -> 174080 bytes
 pc-bios/efi-eepro100.rom |  Bin 0 -> 175104 bytes
 pc-bios/efi-ne2k_pci.rom |  Bin 0 -> 173568 bytes
 pc-bios/efi-pcnet.rom    |  Bin 0 -> 173568 bytes
 pc-bios/efi-rtl8139.rom  |  Bin 0 -> 177152 bytes
 pc-bios/efi-virtio.rom   |  Bin 0 -> 171008 bytes
 roms/Makefile            |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 roms/ipxe                |    2 +-
 14 files changed, 74 insertions(+), 8 deletions(-)
 create mode 100644 pc-bios/efi-e1000.rom
 create mode 100644 pc-bios/efi-eepro100.rom
 create mode 100644 pc-bios/efi-ne2k_pci.rom
 create mode 100644 pc-bios/efi-pcnet.rom
 create mode 100644 pc-bios/efi-rtl8139.rom
 create mode 100644 pc-bios/efi-virtio.rom