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

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



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1207753420 -3600
# Node ID 40c0dda6eae68ec1bbd3bfd3e812d8b9e34051a0
# Parent  70ebf23f8a43000960ca62262941e8207da59369
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>
---
 tools/ioemu/hw/rtl8139.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+)

diff -r 70ebf23f8a43 -r 40c0dda6eae6 tools/ioemu/hw/rtl8139.c
--- a/tools/ioemu/hw/rtl8139.c  Wed Apr 09 16:02:49 2008 +0100
+++ b/tools/ioemu/hw/rtl8139.c  Wed Apr 09 16:03:40 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®.