From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58491) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y8t9w-0005CE-U9 for qemu-devel@nongnu.org; Wed, 07 Jan 2015 11:08:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y8t9t-0006gR-Ia for qemu-devel@nongnu.org; Wed, 07 Jan 2015 11:08:36 -0500 Received: from mail-wg0-x230.google.com ([2a00:1450:400c:c00::230]:64392) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y8t9t-0006gL-B7 for qemu-devel@nongnu.org; Wed, 07 Jan 2015 11:08:33 -0500 Received: by mail-wg0-f48.google.com with SMTP id l2so1465173wgh.7 for ; Wed, 07 Jan 2015 08:08:32 -0800 (PST) Date: Wed, 7 Jan 2015 16:08:29 +0000 From: Stefan Hajnoczi Message-ID: <20150107160829.GP22440@stefanha-thinkpad.redhat.com> References: <1418894539-13990-1-git-send-email-akong@redhat.com> <1418894539-13990-3-git-send-email-akong@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="+W7ryvxEk4RRyt+P" Content-Disposition: inline In-Reply-To: <1418894539-13990-3-git-send-email-akong@redhat.com> Subject: Re: [Qemu-devel] [PATCH 2/2] e1000: unconditionally enable bus mastering List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Amos Kong Cc: mst@redhat.com, jasowang@redhat.com, marcel.a@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com, somlo@cmu.edu --+W7ryvxEk4RRyt+P Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Dec 18, 2014 at 05:22:19PM +0800, Amos Kong wrote: > After enabled network debug of e1000 in Win2012-64r2 guest, > Bus mastering of e1000 can't be enabled by e1000 driver. It > caused guest can't get IP address. >=20 > # bcdedit /debug on > # bcdedit /dbgsettings net hostip:192.168.122.100 port:50000 > (We can use non-existed IP here, it's just used to pass the > setup, not really use it) >=20 > If we disable debug function, e1000 driver can enable bus > mastering bit successfully, guest network is fine. >=20 > This patch changed e1000 backend to enalbe bus mastering > unconditionally as a workaround. >=20 > Signed-off-by: Amos Kong > --- > hw/net/e1000.c | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) >=20 > diff --git a/hw/net/e1000.c b/hw/net/e1000.c > index ec9224b..82829ae 100644 > --- a/hw/net/e1000.c > +++ b/hw/net/e1000.c > @@ -1544,8 +1544,15 @@ static void e1000_write_config(PCIDevice *pci_dev,= uint32_t address, > =20 > pci_default_write_config(pci_dev, address, val, len); > =20 > - if (range_covers_byte(address, len, PCI_COMMAND) && > - (pci_dev->config[PCI_COMMAND] & PCI_COMMAND_MASTER)) { > + if (range_covers_byte(address, len, PCI_COMMAND)) { > + /* > + * Some guest (eg: Win2012-64r2) doesn't enable bus mastering > + * correctly, it caused guest network down. So we unconditionally > + * enable PCI bus mastering and BM memory region for e1000 as > + * a workaround. > + */ > + pci_dev->config[PCI_COMMAND] |=3D PCI_COMMAND_MASTER; > + memory_region_set_enabled(&pci_dev->bus_master_enable_region, tr= ue); > qemu_flush_queued_packets(qemu_get_queue(s->nic)); > start_xmit(s); > } This is weird. Are you sure there's not some guest behavior missing like the NIC option ROM leaving bus mastering enabled after the BIOS/EFI has booted, causing Windows debug to work on physical machines? Before we merge a hack like this we should understand the problem 100%. Stefan --+W7ryvxEk4RRyt+P Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJUrVn9AAoJEJykq7OBq3PIuFoH/3e52/A0FuG43pvvcAuzNE5K KQ0i62gIwHRULRQsxukqL+7iKvXGHSlAfpo7v07JWA/iSIzAwLotLHn8DJqZryTu 6KShj9CCyv67K5dZrJewMUH2wNUoqAWLGSQyJ98uJ1VqK8tPs/blhb6giYPlIOBa 8vNTcsfokF2oC8Ksu/IBUqwdLIhBmWSQdlujZwq+GzNJYSIlUaEeN2tcAlpdtHxa NPljksbYkzYvZie0XEmQ7f4VnGgwMORzu+eB7aGR2PecnI1pUX8wXWKcXoi01WaY NIhhnxbHcb7zh9AwsS7/SwV3kR1QFSVDX1POx5EfyGPOMtb/NiFw5Gcr6YVrRtk= =qwV8 -----END PGP SIGNATURE----- --+W7ryvxEk4RRyt+P--