This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


RE: [Xen-devel] [pvops-dom0] [patch] Hook Linux's PCI probe and remove c

To: "Kay, Allen M" <allen.m.kay@xxxxxxxxx>, Jeremy Fitzhardinge <jeremy@xxxxxxxx>, "Han, Weidong" <weidong.han@xxxxxxxxx>
Subject: RE: [Xen-devel] [pvops-dom0] [patch] Hook Linux's PCI probe and remove callbacks
From: "Jiang, Yunhong" <yunhong.jiang@xxxxxxxxx>
Date: Sun, 19 Jul 2009 19:55:47 +0800
Accept-language: en-US
Acceptlanguage: en-US
Cc: 'Keir, "'xen-devel@xxxxxxxxxxxxxxxxxxx'" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Fraser' <Keir.Fraser@xxxxxxxxxxxxx>
Delivery-date: Sun, 19 Jul 2009 04:56:55 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <57C9024A16AD2D4C97DC78E552063EA3A90A8D30@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <715D42877B251141A38726ABF5CABF2C0545AE597D@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> <4A6105CA.1000904@xxxxxxxx> <57C9024A16AD2D4C97DC78E552063EA3A90A8D30@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcoHNFJ/diyrvrQ3QJqyNU4RyrPjeAAAv6LwAEvH/oA=
Thread-topic: [Xen-devel] [pvops-dom0] [patch] Hook Linux's PCI probe and remove callbacks
 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 
BUS_NOTIFY_ADD_DEVICE notifier to achieve ths purpose. We can just add a 
notifier to it. I assume this is simlar to IOMMU in kernel, which should 
requires this notify also. So a Xen specific notifier should achieve our 
purpose without change to the PCI bus layer. 

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 Intel 
IOMMU has no such support, do you know if VT-d in kernel support device hotplug 

Allen/Jeremy, any suggestion?

Yunhong Jiang

>-----Original Message-----
>From: Kay, Allen M 
>Sent: 2009年7月18日 7:43
>To: Jeremy Fitzhardinge; Han, Weidong
>Cc: 'xen-devel@xxxxxxxxxxxxxxxxxxx'; 'Keir Fraser'; Jiang, Yunhong
>Subject: RE: [Xen-devel] [pvops-dom0] [patch] Hook Linux's PCI 
>probe and remove callbacks
>These hooks for two purposes:
>1) Enabling of a SR-IOV virtual function.  The hypercall will 
>tell xen to setup VT-d context entries for the BDF 
>corresponding to the new virtual function.  This is required 
>for SR-IOV to work.
>2) PCI hot-plug support when devices are hot added/removed.  
>Vt-d context entries and data structures in Xen needs to be 
>modified accordingly.
>These hooks needs to be enabled before either of these 
>functions are performed - I assume after dom0 boots.
>Can you suggest a better way to do this?
>-----Original Message-----
>From: Jeremy Fitzhardinge [mailto:jeremy@xxxxxxxx] 
>Sent: Friday, July 17, 2009 4:14 PM
>To: Han, Weidong
>Cc: 'xen-devel@xxxxxxxxxxxxxxxxxxx'; 'Keir Fraser'; Kay, Allen 
>M; Jiang, Yunhong
>Subject: Re: [Xen-devel] [pvops-dom0] [patch] Hook Linux's PCI 
>probe and remove callbacks
>On 07/15/09 22:15, Han, Weidong wrote:
>> 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 
>assigned to guest.
>> This patch is based on xen-tip-master branch of jeremy's pv-ops tree.
>Yunhong Jiang sent me a version of this patch as part of his MSI work. 
>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 touch
>a Xen file, but it is changing a variable belonging to the PCI
>subsystem).  We need to work with the Linux PCI maintainers to 
>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?
>    J
Xen-devel mailing list