From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752312AbcIIO3X (ORCPT ); Fri, 9 Sep 2016 10:29:23 -0400 Received: from mx2.suse.de ([195.135.220.15]:51394 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751203AbcIIO3W (ORCPT ); Fri, 9 Sep 2016 10:29:22 -0400 Subject: Re: [Xen-devel] [PATCH v2] xen/pciback: support driver_override To: David Vrabel , Boris Ostrovsky , linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org References: <1472819456-12995-1-git-send-email-jgross@suse.com> <74aef1d8-8f92-f7e4-fc40-a13708a2bf19@oracle.com> <69161c4e-02ac-5b02-8c9a-161d2ec2d6ce@suse.com> <57D2C6DD.2050405@citrix.com> From: Juergen Gross Message-ID: Date: Fri, 9 Sep 2016 16:29:18 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <57D2C6DD.2050405@citrix.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/09/16 16:27, David Vrabel wrote: > On 09/09/16 07:14, Juergen Gross wrote: >> On 08/09/16 16:10, Boris Ostrovsky wrote: >>> On 09/02/2016 08:30 AM, Juergen Gross wrote: >>>> Support the driver_override scheme introduced with commit 782a985d7af2 >>>> ("PCI: Introduce new device binding path using pci_dev.driver_override") >>>> >>>> As pcistub_probe() is called for all devices (it has to check for a >>>> match based on the slot address rather than device type) it has to >>>> check for driver_override set to "pciback" itself. >>>> >>>> Signed-off-by: Juergen Gross >>>> --- >>>> V2: removed now unused label >>>> --- >>>> drivers/xen/xen-pciback/pci_stub.c | 16 ++++++++++------ >>>> 1 file changed, 10 insertions(+), 6 deletions(-) >>>> >>>> diff --git a/drivers/xen/xen-pciback/pci_stub.c b/drivers/xen/xen-pciback/pci_stub.c >>>> index 258b7c3..85c28f7 100644 >>>> --- a/drivers/xen/xen-pciback/pci_stub.c >>>> +++ b/drivers/xen/xen-pciback/pci_stub.c >>>> @@ -25,6 +25,8 @@ >>>> #include "conf_space.h" >>>> #include "conf_space_quirks.h" >>>> >>>> +#define PCISTUB_DRIVER_NAME "pciback" >>>> + >>>> static char *pci_devs_to_hide; >>>> wait_queue_head_t xen_pcibk_aer_wait_queue; >>>> /*Add sem for sync AER handling and xen_pcibk remove/reconfigue ops, >>>> @@ -529,16 +531,18 @@ static int pcistub_probe(struct pci_dev *dev, const struct pci_device_id *id) >>>> "don't have a normal (0) or bridge (1) " >>>> "header type!\n"); >>>> err = -ENODEV; >>>> - goto out; >>>> } >>>> >>>> + } else if (!dev->driver_override || >>>> + strcmp(dev->driver_override, PCISTUB_DRIVER_NAME)) >>>> + /* Didn't find the device */ >>>> + err = -ENODEV; >>>> + >>>> + if (!err) { >>>> dev_info(&dev->dev, "seizing device\n"); >>>> err = pcistub_seize(dev); >>>> - } else >>>> - /* Didn't find the device */ >>>> - err = -ENODEV; >>>> + } >>> >>> Should devices with pciback override be displayed in >>> /sys/bus/pci/drivers/pciback/slots? If they should then they need to be >>> either added to pcistub_device_ids or kept on some other list. >> >> No, I don't think so. The patch is just needed to _avoid_ having to use >> the slots stuff: without the patch you need something like: >> >> echo 0000:07:10.0 > /sys/bus/pci/devices/0000\:07\:10.0/driver/unbind >> echo 0000:07:10.0 > /sys/bus/pci/drivers/pciback/new_slot >> echo 0000:07:10.0 > /sys/bus/pci/drivers_probe >> >> while with the patch you can use the same mechanism as for similar >> drivers like pci-stub and vfio-pci: >> >> echo pciback > /sys/bus/pci/devices/0000\:07\:10.0/driver_override >> echo 0000:07:10.0 > /sys/bus/pci/devices/0000\:07\:10.0/driver/unbind >> echo 0000:07:10.0 > /sys/bus/pci/drivers_probe >> >> So e.g. libvirt doesn't need special handling for pciback. The slot list >> is necessary for assigning devices to pciback on boot, but I think the >> override mechanism is better for runtime assignment. > > Can you include something like this in the commit message? Okay. Juergen