From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeremy Fitzhardinge Subject: Re: [pvops-dom0] [patch] Hook Linux's PCI probe and remove callbacks Date: Mon, 20 Jul 2009 10:01:37 -0700 Message-ID: <4A64A2F1.2090303@goop.org> References: <715D42877B251141A38726ABF5CABF2C0545AE597D@pdsmsx503.ccr.corp.intel.com> <4A6105CA.1000904@goop.org> <57C9024A16AD2D4C97DC78E552063EA3A90A8D30@orsmsx505.amr.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "Jiang, Yunhong" Cc: "Han, Weidong" , "'xen-devel@lists.xensource.com'" , "Kay, Allen M" , 'Keir Fraser' , Jesse Barnes List-Id: xen-devel@lists.xenproject.org On 07/19/09 04:55, Jiang, Yunhong wrote: > One consideration to is to split them into two item: > a) For all device that is not hot-pluged, we don't need this hypercall,= instead, Xen will do the scan and setup the mapping. > b) For those hot-plug device and SR-IOV devices, maybe we can use the B= US_NOTIFY_ADD_DEVICE notifier to achieve ths purpose. We can just add a n= otifier to it. I assume this is simlar to IOMMU in kernel, which should r= equires this notify also. So a Xen specific notifier should achieve our p= urpose without change to the PCI bus layer.=20 > > I checked the kernel code, and noticed that arch/x86/kernel/amd_iommu.c= register the notifier for BUS_NOTIFY_ADD_DEVICE, but a bit strange why I= ntel IOMMU has no such support, do you know if VT-d in kernel support dev= ice hotplug already? > > Allen/Jeremy, any suggestion? > =20 Yes, this is exactly the kind of answer I was looking for. J > Thanks > Yunhong Jiang > > =20 >> -----Original Message----- >> From: Kay, Allen M=20 >> Sent: 2009=C4=EA7=D4=C218=C8=D5 7:43 >> To: Jeremy Fitzhardinge; Han, Weidong >> Cc: 'xen-devel@lists.xensource.com'; 'Keir Fraser'; Jiang, Yunhong >> Subject: RE: [Xen-devel] [pvops-dom0] [patch] Hook Linux's PCI=20 >> probe and remove callbacks >> >> These hooks for two purposes: >> >> 1) Enabling of a SR-IOV virtual function. The hypercall will=20 >> tell xen to setup VT-d context entries for the BDF=20 >> corresponding to the new virtual function. This is required=20 >> for SR-IOV to work. >> >> 2) PCI hot-plug support when devices are hot added/removed. =20 >> Vt-d context entries and data structures in Xen needs to be=20 >> modified accordingly. >> >> These hooks needs to be enabled before either of these=20 >> functions are performed - I assume after dom0 boots. >> >> Can you suggest a better way to do this? >> >> -----Original Message----- >> From: Jeremy Fitzhardinge [mailto:jeremy@goop.org]=20 >> Sent: Friday, July 17, 2009 4:14 PM >> To: Han, Weidong >> Cc: 'xen-devel@lists.xensource.com'; 'Keir Fraser'; Kay, Allen=20 >> M; Jiang, Yunhong >> Subject: Re: [Xen-devel] [pvops-dom0] [patch] Hook Linux's PCI=20 >> probe and remove callbacks >> >> On 07/15/09 22:15, Han, Weidong wrote: >> =20 >>> Hijack the pci_bus_type probe and remove callbacks. This option only >>> requires modification to the Xen specific part of Linux. >>> >>> This is useful to add and remove pci device to Xen hypervisor when >>> load and remove its driver. For example, when VFs are created by PF, >>> they will be added to Xen hypervisor, and then can be=20 >>> =20 >> assigned to guest. >> =20 >>> This patch is based on xen-tip-master branch of jeremy's pv-ops tree. >>> =20 >>> =20 >> Yunhong Jiang sent me a version of this patch as part of his MSI work.= =20 >> This kind of interception of pci_bus_type.probe is pretty ugly, and is >> unlikely to be accepted upstream in this form (the patch may only touc= h >> a Xen file, but it is changing a variable belonging to the PCI >> subsystem). We need to work with the Linux PCI maintainers to=20 >> find some >> other way of achieving what we need here. >> >> Can you explain what the functional requirements are here. Could we >> defer registering the device with Xen until some other convenient hook= , >> or must it be done at this point in the code? >> >> Thanks, >> J >> =20 > >