From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41526) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y1XiT-000638-K7 for qemu-devel@nongnu.org; Thu, 18 Dec 2014 04:49:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y1XiL-0005lt-5N for qemu-devel@nongnu.org; Thu, 18 Dec 2014 04:49:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54145) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y1XiK-0005lR-Tl for qemu-devel@nongnu.org; Thu, 18 Dec 2014 04:49:45 -0500 Date: Thu, 18 Dec 2014 09:57:29 +0008 From: Jason Wang Message-Id: <1418896169.6411.0@smtp.corp.redhat.com> In-Reply-To: <1418894539-13990-3-git-send-email-akong@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: text/plain; charset=utf-8; format=flowed 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: somlo@cmu.edu, mst@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com, marcel.a@redhat.com On Thu, Dec 18, 2014 at 5:22 PM, 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. > > # 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) > > If we disable debug function, e1000 driver can enable bus > mastering bit successfully, guest network is fine. > > This patch changed e1000 backend to enalbe bus mastering > unconditionally as a workaround. > > Signed-off-by: Amos Kong > --- > hw/net/e1000.c | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > 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, > > pci_default_write_config(pci_dev, address, val, len); > > - 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] |= PCI_COMMAND_MASTER; > + > memory_region_set_enabled(&pci_dev->bus_master_enable_region, true); So BM is still set even if guest want to clear it? > > qemu_flush_queued_packets(qemu_get_queue(s->nic)); > start_xmit(s); > } > -- > 2.1.0 > >