Skip to contentSkip to conversation

avoid unnecessary loading NIC rom.

PATCH In review Akio Takebe 2 participants 6 messages Dec 18, 2008 – Dec 19, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 avoid unnecessary loading NIC rom.

Hi,

When we don't specify PXE boot in guest configuration file, it is not necessary for hvmloader to load PXE option ROM. This patch avoid unncessary loading the rom.
It can save shadow memory area for option ROMs.

Best Regards,

Akio Takebe

tools/firmware/hvmloader/hvmloader.c +20 -11
diff -r a76b4e00e186 tools/firmware/hvmloader/hvmloader.c
@@ -423,19 +423,28 @@
 {
     uint8_t devfn;
     uint16_t class, vendor_id, device_id;
+    uint16_t bootdev;
+    uint16_t seq_nr;
 
-    for ( devfn = 0; devfn < 128; devfn++ )
-    {
-        class     = pci_readw(devfn, PCI_CLASS_DEVICE);
-        vendor_id = pci_readw(devfn, PCI_VENDOR_ID);
-        device_id = pci_readw(devfn, PCI_DEVICE_ID);
+    for (seq_nr=0; seq_nr<3; seq_nr++ ){
+        bootdev = cmos_inb(0x3d);
+        bootdev |= ((cmos_inb(0x38) & 0xf0) << 4);
+        bootdev >>= 4 * seq_nr;
+        bootdev &= 0xf;
+	if ( bootdev == 4 ){
+            for ( devfn = 0; devfn < 128; devfn++ ){
+                class     = pci_readw(devfn, PCI_CLASS_DEVICE);
+                vendor_id = pci_readw(devfn, PCI_VENDOR_ID);
+                device_id = pci_readw(devfn, PCI_DEVICE_ID);
 
-        /* We're only interested in NICs. */
-        if ( (vendor_id != 0xffff) &&
-             (device_id != 0xffff) &&
-             (class == 0x0200) )
-            return scan_option_rom(
-                devfn, vendor_id, device_id, etherboot, copy_rom_dest);
+                /* We're only interested in NICs. */
+                if ( (vendor_id != 0xffff) &&
+                     (device_id != 0xffff) &&
+                     (class == 0x0200) )
+                    return scan_option_rom(devfn, vendor_id, 
+                               device_id, etherboot, copy_rom_dest);
+            }
+        }
     }
 
     return 0;

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 4 lines · Akio Takebe

When we don't specify PXE boot in guest configuration file, it is not necessary for hvmloader to load PXE option ROM. This patch avoid unncessary loading the rom.
It can save shadow memory area for option ROMs.

There's a 'F10 to select boot device' option in rombios, so you can't determine this in hvmloader.

-- Keir

#2 lore raw
Quoted 9 lines · Keir Fraser
Quoted 4 lines · Akio Takebe

When we don't specify PXE boot in guest configuration file, it is not necessary for hvmloader to load PXE option ROM. This patch avoid unncessary loading the rom.
It can save shadow memory area for option ROMs.

There's a 'F10 to select boot device' option in rombios, so you can't determine this in hvmloader.

Exactly. But if gPXE rom is loaded,
hvmloader cannot load some option ROMs of raal PCI cards. I suspect we don't use F10 option for PXE boot. Do you have good idea?

Best Regards,

Akio Takebe

#3 lore raw
Quoted 6 lines · Akio Takebe
Quoted 2 lines

There's a 'F10 to select boot device' option in rombios, so you can't determine this in hvmloader.

Exactly. But if gPXE rom is loaded,
hvmloader cannot load some option ROMs of raal PCI cards. I suspect we don't use F10 option for PXE boot. Do you have good idea?

Not really. Perhaps scan_etherboot_nic() after pci_load_option_roms(), so the latter takes priority?

-- Keir

#4 lore raw
Quoted 9 lines · Keir Fraser
Quoted 6 lines
Quoted 2 lines

There's a 'F10 to select boot device' option in rombios, so you can't determine this in hvmloader.

Exactly. But if gPXE rom is loaded,
hvmloader cannot load some option ROMs of raal PCI cards. I suspect we don't use F10 option for PXE boot. Do you have good idea?

Not really. Perhaps scan_etherboot_nic() after pci_load_option_roms(), so the latter takes priority?

Another possibility is to let option ROMs load up to 0xe9000 rather than just 0xe0000. There's nothing in the range 0xe0000-0xe9000 right now; it's 36kB of wasted space.

-- Keir

#5 lore raw
Quoted 8 lines · Keir Fraser
Quoted 6 lines · Keir Fraser
Quoted 6 lines
Quoted 2 lines

There's a 'F10 to select boot device' option in rombios, so you can't determine this in hvmloader.

Exactly. But if gPXE rom is loaded,
hvmloader cannot load some option ROMs of raal PCI cards. I suspect we don't use F10 option for PXE boot. Do you have good idea?

Quoted 7 lines
Quoted 2 lines

Not really. Perhaps scan_etherboot_nic() after pci_load_option_roms(), so the latter takes priority?

Another possibility is to let option ROMs load up to 0xe9000 rather than just 0xe0000. There's nothing in the range 0xe0000-0xe9000 right now; it's 36kB of wasted space.

OK. I'll try to use the range 0xe0000-0xe9000.
The range seems to be OK in BBS spec.

Best Regards,

Akio Takebe