From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60216) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLDOI-0004w1-15 for qemu-devel@nongnu.org; Tue, 10 Feb 2015 11:10:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YLDOC-0007q1-7w for qemu-devel@nongnu.org; Tue, 10 Feb 2015 11:10:21 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43060) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLDOC-0007pq-13 for qemu-devel@nongnu.org; Tue, 10 Feb 2015 11:10:16 -0500 Date: Wed, 11 Feb 2015 00:11:20 +0800 From: Amos Kong Message-ID: <20150210161120.GA21088@air.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> <20150206134636.GA18729@stefanha-thinkpad.redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="17pEHd4RhPHOinZp" Content-Disposition: inline In-Reply-To: <20150206134636.GA18729@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: Stefan Hajnoczi Cc: mst@redhat.com, jasowang@redhat.com, marcel.a@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com, somlo@cmu.edu --17pEHd4RhPHOinZp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Feb 06, 2015 at 01:46:36PM +0000, Stefan Hajnoczi wrote: > 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_= 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 unconditio= nally > > > + * 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? QEMU emulated e1000 is too old, it's not in the official support list of window network debug. > > Before we merge a hack like this we should understand the problem 100%. >=20 > Any new insights into what is going on here? It's not good to unconditionaly enable BM, we should enable/disable it according to other event/status change. =20 > Stefan --=20 Amos. --17pEHd4RhPHOinZp Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJU2i2oAAoJELxSv6I5vP9jy7IQAIizkkwzMNVxmTk4lKvXVkTN Qv55NqnTN/mqfgzShENMAGc/v80eX/gdwWstr2Szt4L++xcwPoav+MhmP4SmpEcz WIGnOLoFA+hDlX3RGntPhblrwuW3v0Jv7N3K4WJ5Z4ZdcI8jF+HFXecmfVgL3zRa UEElXLwNKmudl+0rIYR9Q9oWCh7Z5LcOoZ2j4vj4IMe4S5T3Ry7DHImZhUbBty29 wuEoCR5K+XVgf4bY34ebtHrKmc/i6YpH8yYW+OVved3zZkOg5MwtZRjzINTmfs6X 1rS/bhDoAwaolXz+u0hIXR0fr6TpNHW9Shq5af0v+JEky4yP/tFMn8OEBrJTpxyv f54gcIHXZ4s4Cs063E5uYWeHKIofcDmO4sXM/oCy9srH2Z7pMAvkTIIaKv+CCEHk 3SiHdMEfz+FeKCWAQMBfOmkEVFzybYY4TQ3Nz57GxBo8xCY6kIm7UMmoJwKG4EC2 9D/dBDm+GyyHHY96Nuei0MlixFvJGPlU1X+Y7VDFbgmItPKFz/s0loqEnL126YBe 7qAaVijV2sAZuv2f0DXtsqclDycSeVeAEYYwt0taMDk5P05XRmQa2zeLH6Wb09IX QbvqR1O17LMvPTi3bnGEhXi/gFwTF2S6pROtcZ43tcNlPMimfopxJYyboXjx4tng R3XNMTZDra/i1RJhrVWN =rO20 -----END PGP SIGNATURE----- --17pEHd4RhPHOinZp--