From: "Ky Srinivasan" Subject: Re: issue in unplug qemu PCI devices Date: Fri, 12 Feb 2010 14:57:30 -0700 Message-ID: <4B756C5A020000300007F572@sinclair.provo.novell.com> References: <4B7515D9.7060407@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Stefano Stabellini , Edwin Zhai Cc: Xen Developers , Ian Jackson , Keir Fraser List-Id: xen-devel@lists.xenproject.org >>> On 2/12/2010 at 12:14 PM, in message , Stefano Stabellini wrote:=20 > On Fri, 12 Feb 2010, Zhai, Edwin wrote: >> IOEMU change set e7911109 uses Magic ioport (0x10) protocol for=20 >> negotating with guest PV drivers during startup, and allowing PV = drivers=20 >> to disable hardware emulations thus preventing guest from seeing the=20 >> same device through two paths. >>=20 >> But when I tried PV drivers in xen upstream, this unplug logic never=20 >> succeed. PV driver uses following io sequence to interact with=20 >> platform_pci device in qemu: >> 1. inw 0x10 >> 2. inb 0x12 >> 3. outw(0x12, 0xbeef) >> 4. outl(0x10,0xdead) >>=20 >> But I only saw 1&2 happened in xen io instruction=20 >> emulation(x86_emulate), while 3&4 seemed to lost so the unplug will=20 >> never happen. Looks like in 3&4 have the parameters reversed - the first parameter I = think should be the value and the second parameter should be the port. Regards, K. Y >>=20 >> Are you aware of this issue? Or some suggestion for debugging? >>=20 >> BTW, the unplug logic itself has some issues also: >> 1. Pass-through NICs are also unplugged, although them have different=20= >> path with vnif and emulated NIC. >> 2. Unplug happens as long as inserting the xen_platform_pci module=20 >> regardless of existence of PVed device in the config file. End user=20 >> likely to unplug all the PCI device by accident. >> 3. Inserting xen_platform_pci module would unplug all the devices, = which=20 >> is not reasonable. E.g. end user only has vbd driver, but all NICs = are=20 >> also unplugged. >>=20 >=20 > You are right, that is a bug and this patch should fix it. >=20 > Signed-off-by: Stefano Stabellini >=20 > --- >=20 > diff --git a/hw/pci.c b/hw/pci.c > index d7c516e..01eff8d 100644 > --- a/hw/pci.c > +++ b/hw/pci.c > @@ -826,7 +826,8 @@ void pci_unplug_netifs(void) > dev =3D bus->devices[x]; > if (dev && > dev->config[0xa] =3D=3D 0 && > - dev->config[0xb] =3D=3D 2) { > + dev->config[0xb] =3D=3D 2 && > + test_pci_slot(x >> 3) !=3D 1) { > /* Found a netif. Remove it from the bus. Note that > we don't free it here, since there could still be > references to it floating around. There are only >=20 > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel