From: Amos Kong <akong@redhat.com>
To: Jason Wang <jasowang@redhat.com>
Cc: somlo@cmu.edu, mst@redhat.com, qemu-devel@nongnu.org,
stefanha@redhat.com, marcel.a@redhat.com
Subject: Re: [Qemu-devel] [PATCH 2/2] e1000: unconditionally enable bus mastering
Date: Thu, 18 Dec 2014 18:30:19 +0800 [thread overview]
Message-ID: <20141218103019.GA12275@air.redhat.com> (raw)
In-Reply-To: <1418896169.6411.0@smtp.corp.redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2201 bytes --]
On Thu, Dec 18, 2014 at 09:57:29AM +0008, Jason Wang wrote:
>
>
> On Thu, Dec 18, 2014 at 5:22 PM, Amos Kong <akong@redhat.com> 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 <akong@redhat.com>
> >---
> > 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?
BM will be cleared many times in boot stage, enabling it once doesn't
work. Curently we honestly clear the bit, then BM isn't enabled.
But it's might be too aggressive/crazy to enable BM forever.
> >
> > qemu_flush_queued_packets(qemu_get_queue(s->nic));
> > start_xmit(s);
> > }
--
Amos.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2014-12-18 10:30 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-18 9:22 [Qemu-devel] [PATCH 0/2] ignore bus master for e1000 Amos Kong
2014-12-18 9:22 ` [Qemu-devel] [PATCH 1/2] e1000: defer packets until BM enabled Amos Kong
2014-12-18 9:22 ` [Qemu-devel] [PATCH 2/2] e1000: unconditionally enable bus mastering Amos Kong
2014-12-18 9:49 ` Jason Wang
2014-12-18 10:30 ` Amos Kong [this message]
2015-01-07 16:08 ` Stefan Hajnoczi
2015-02-06 13:46 ` Stefan Hajnoczi
2015-02-10 16:11 ` Amos Kong
2014-12-18 10:05 ` [Qemu-devel] [PATCH 0/2] ignore bus master for e1000 Jason Wang
2014-12-18 11:01 ` Denis V. Lunev
2014-12-18 11:11 ` Denis V. Lunev
2014-12-19 4:59 ` Jason Wang
2014-12-19 3:09 ` Amos Kong
2014-12-19 5:00 ` Jason Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141218103019.GA12275@air.redhat.com \
--to=akong@redhat.com \
--cc=jasowang@redhat.com \
--cc=marcel.a@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=somlo@cmu.edu \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).