[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-3.1-testing] ioemu: Fix rtl8139 emulation so that reboot works correctly in 64-bit



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1207756797 -3600
# Node ID c156b4e04617041be3f7804978ce5ecdbc23fc0c
# Parent  fe6e23c8ed76f9124e0c983eeb668dbd33ad34cb
ioemu: Fix rtl8139 emulation so that reboot works correctly in 64-bit
Windows VMs. Return an error if the guest OS tries to transmit a
packet with the transmitter disabled, so that it doesn't spin forever
waiting for it to complete.

Signed-off-by: Steven Smith <Steven.Smith@xxxxxxxxxxxxx>
xen-unstable changeset:   17420:40c0dda6eae68ec1bbd3bfd3e812d8b9e34051a0
xen-unstable date:        Wed Apr 09 16:03:40 2008 +0100
---
 tools/ioemu/hw/rtl8139.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+)

diff -r fe6e23c8ed76 -r c156b4e04617 tools/ioemu/hw/rtl8139.c
--- a/tools/ioemu/hw/rtl8139.c  Wed Apr 09 16:59:35 2008 +0100
+++ b/tools/ioemu/hw/rtl8139.c  Wed Apr 09 16:59:57 2008 +0100
@@ -1416,12 +1416,28 @@ static uint32_t rtl8139_ChipCmd_read(RTL
 
 static void rtl8139_CpCmd_write(RTL8139State *s, uint32_t val)
 {
+    int i;
+
     val &= 0xffff;
 
     DEBUG_PRINT(("RTL8139C+ command register write(w) val=0x%04x\n", val));
 
     /* mask unwriteable bits */
     val = SET_MASKED(val, 0xff84, s->CpCmd);
+
+    if (  (s->CpCmd & CPlusTxEnb) &&
+         !(val      & CPlusTxEnb) )
+    {
+        /* Reset TX status when the transmitter drops from C+ to
+           non-C+ mode.  Windows has a habit of turning off C+ and
+           then waiting for the TX requests to clear as part of shut
+           down, and you get stuck forever if there are old DTCRs in
+           the registers. */
+        for (i = 0; i < 4; i++)
+        {
+            s->TxStatus[i] = TxHostOwns;
+        }
+    }
 
     s->CpCmd = val;
 }
@@ -1765,6 +1781,7 @@ static int rtl8139_transmit_one(RTL8139S
     {
         DEBUG_PRINT(("RTL8139: +++ cannot transmit from descriptor %d: 
transmitter disabled\n",
                      descriptor));
+        s->TxStatus[descriptor] = TxAborted | TxHostOwns;
         return 0;
     }
 
@@ -1772,6 +1789,7 @@ static int rtl8139_transmit_one(RTL8139S
     {
         DEBUG_PRINT(("RTL8139: +++ cannot transmit from descriptor %d: owned 
by host (%08x)\n",
                      descriptor, s->TxStatus[descriptor]));
+        s->TxStatus[descriptor] = TxAborted | TxHostOwns;
         return 0;
     }
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.