qemu patch (was: em(4) patch for qemu/kvm/vbox guests)

Juergen Lock nox at jelal.kn-bremen.de
Sun Jun 7 19:46:12 UTC 2009


On Sun, Jun 07, 2009 at 07:27:12PM +0200, Juergen Lock wrote:
> In article <4A2BC96B.9010209 at demax.sk> you write:
> >Hi
> >
> >I think its caused by internal control of MAC address validity in 
> >freebsd-sources ( sys/dev/e1000/if_em.c ) on line 4950.
> >You can safely remove references to that function + function itself and than 
> >happily use if_em undex VBox as before.
> 
> Actually that wasn't it, in fact commit 190872 changed the way mac addresses
> are read (e1000_read_mac_addr_generic() in sys/dev/e1000/e1000_nvm.c) - if I
> add the old way back for the case that the new code gets all zeros em(4)
> works again:

And I just submitted a qemu git patch for this problem on the qemu list;
here is a version for 0.10.5, you can put it in
/usr/ports/emulators/qemu/files/patch-e1000-fbsd8 :

Index: qemu/hw/e1000.c
@@ -1100,6 +1100,16 @@ pci_e1000_init(PCIBus *bus, NICInfo *nd,
     memmove(d->phy_reg, phy_reg_init, sizeof phy_reg_init);
     memset(d->mac_reg, 0, sizeof d->mac_reg);
     memmove(d->mac_reg, mac_reg_init, sizeof mac_reg_init);
+    /*
+     * FreeBSD 8.0-current svn rev >= 190872 expects the mac address here,
+     * see e1000_read_mac_addr_generic() in sys/dev/e1000/if_em.c:
+     * http://svn.freebsd.org/viewvc/base/head/sys/dev/e1000/e1000_nvm.c?view=markup&pathrev=190872
+     * http://svn.freebsd.org/viewvc/base?view=revision&revision=190872
+     */
+    d->mac_reg[RA] = (nd->macaddr[3]<<24) | (nd->macaddr[2]<<16) |
+        (nd->macaddr[1]<<8) | nd->macaddr[0]; 
+    d->mac_reg[RA+1] = (nd->macaddr[5]<<8) | nd->macaddr[4]; 
+
     d->rxbuf_min_shift = 1;
     memset(&d->tx, 0, sizeof d->tx);
 


More information about the freebsd-emulation mailing list