From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57403) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJjF9-0007qW-KE for qemu-devel@nongnu.org; Fri, 06 Feb 2015 08:46:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YJjF3-0004iv-Ie for qemu-devel@nongnu.org; Fri, 06 Feb 2015 08:46:47 -0500 Received: from mail-wi0-x22f.google.com ([2a00:1450:400c:c05::22f]:52083) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJjF3-0004ii-8b for qemu-devel@nongnu.org; Fri, 06 Feb 2015 08:46:41 -0500 Received: by mail-wi0-f175.google.com with SMTP id fb4so2578174wid.2 for ; Fri, 06 Feb 2015 05:46:40 -0800 (PST) Date: Fri, 6 Feb 2015 13:46:36 +0000 From: Stefan Hajnoczi Message-ID: <20150206134636.GA18729@stefanha-thinkpad.redhat.com> References: <1418894539-13990-1-git-send-email-akong@redhat.com> <1418894539-13990-3-git-send-email-akong@redhat.com> <20150107160829.GP22440@stefanha-thinkpad.redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="wac7ysb48OaltWcw" Content-Disposition: inline In-Reply-To: <20150107160829.GP22440@stefanha-thinkpad.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 --wac7ysb48OaltWcw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jan 07, 2015 at 04:08:29PM +0000, Stefan Hajnoczi wrote: > 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_de= v, 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 unconditiona= lly > > + * 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, = true); > > qemu_flush_queued_packets(qemu_get_queue(s->nic)); > > start_xmit(s); > > } >=20 > This is weird. >=20 > 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? >=20 > Before we merge a hack like this we should understand the problem 100%. Any new insights into what is going on here? Stefan --wac7ysb48OaltWcw Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJU1MW8AAoJEJykq7OBq3PIZIwIAIfTmODf85JG+1mLIEziBpUI I4U/DZYQY7TjuhoQOU6uJlUAKxRiZ7QtGFJ/M7ChXNH7yaf6RE+r0dQUKAZToWtv Vc65JAou2F04JoSbhiRVWB9Rk1jOEebHQlDHYKgelOAth8JCLe3BrMbfuufWerGK Rd2T6y0TIr/qQKULgLwVP22gyUzav9BRryUQyKHJWF1OIjmbW/o5giGq80w2X+pC 2zHWiPkxIWlVw1oRSQarpWsVaOHjc2tJHW7oJyIFdlrqYiOzytnP/Ob85WbtHvlb N34Cv4lPbzII7wD8LNDq+SjqkHiNOqqFM0AKLeRc9v6lRvetfGcvPoYlIXfnbYE= =Hl0d -----END PGP SIGNATURE----- --wac7ysb48OaltWcw--