Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp6346699ybe; Wed, 18 Sep 2019 01:52:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqzpBbADD663jvzZg18QNC8/DbOFcwQJtPmK5cEdVPuU24DpTvMvwRnihABb2f3M1wDnjlJ+ X-Received: by 2002:a50:95c1:: with SMTP id x1mr8879487eda.180.1568796725692; Wed, 18 Sep 2019 01:52:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568796725; cv=none; d=google.com; s=arc-20160816; b=Ywtitb2wBqxHSb4TOo3YEpSErJNAu3rLJQ2K73X+w6CmL79OOyMfwrL4lxlhPrwpae zdFAtVXYitnJLE1Wj0GYmQM8FzNQoEASaAODoWOrbaz8dmXXO0J3a48P5eh79bgsHyQn uefqpiDRjd4h0WAdosLxI9dYWaN7l+MRUk3JsKs8+GSH52SfASo7rHkybgoomxZpyuQA /UwPS+tP9iNoA9rtINuZMm1FBsB+4y6QDch+ifgN26bkXXkyDczwYhdXpuc3SXp8EDYE teZsp1f/VT1Fp2/lUf+VIUkYQECYGMlZHaRYXoZGpnUDsYTzJtLDCxNCBdT3UK8ga8wl nGPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dpvIENjv/MayH8zieBn50dVOfmImiMMuyD5MdLEpif4=; b=OC1/v57J3XwWLO+EFfhonECncY+lm3PqmMNNhkuVWtM/EVuyIwdz1yUEP+b6CVdEux n/xzagEdY6kJTIWmQXy2ki0eQCeupo+HH0QI4tVIIrwti6yChqXKOE79r6llAPiyDVcw kJjt6+2gA+4Edv1Nv+X6J2/Dq7FgZC90brKk+QfPTdZ1s4u4T3BtqLg7DqoFywmjc2HJ PDRpEsEIzf9D0TVFjqIsEYlAEpJvi6Bh1iWhqITJ2v9mzw5fIprcft19OOFVeTDMzmNC ehu4eYepaJQbPuv6FZGB5UMJv1xCiYIz7qI41qsFhqO5jCcuK0vGn5ZPUJt5WfevhzKj KUWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BEe5r2ls; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e16si2545771ejj.372.2019.09.18.01.51.28; Wed, 18 Sep 2019 01:52:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BEe5r2ls; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730340AbfIRG0g (ORCPT + 99 others); Wed, 18 Sep 2019 02:26:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:48026 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730326AbfIRG0d (ORCPT ); Wed, 18 Sep 2019 02:26:33 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B5A36218AF; Wed, 18 Sep 2019 06:26:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568787993; bh=pNjQlHwmYnMq2l7APwROzUARrPp84X47aBsz4iOvu9Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BEe5r2ls8hloZf9T23X2LrYm4UL3d+pQ+6P/8ZikQhHh0E8ZaGX585DRbCA4yANf3 SrO86SInl1Y7+2eZDOmNXnLYPPtYKPMsC7tr2sFmd4f4GOt3wNQf3OeUt8LQ0BYF3C QeArMnZhvzvNqhgkgFZ9/1ss4f1ZVpyODt1/Pymw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alex Williamson , Bjorn Helgaas Subject: [PATCH 5.2 60/85] PCI: Always allow probing with driver_override Date: Wed, 18 Sep 2019 08:19:18 +0200 Message-Id: <20190918061236.000565114@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190918061234.107708857@linuxfoundation.org> References: <20190918061234.107708857@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alex Williamson commit 2d2f4273cbe9058d1f5a518e5e880d27d7b3b30f upstream. Commit 0e7df22401a3 ("PCI: Add sysfs sriov_drivers_autoprobe to control VF driver binding") introduced the sriov_drivers_autoprobe attribute which allows users to prevent the kernel from automatically probing a driver for new VFs as they are created. This allows VFs to be spawned without automatically binding the new device to a host driver, such as in cases where the user intends to use the device only with a meta driver like vfio-pci. However, the current implementation prevents any use of drivers_probe with the VF while sriov_drivers_autoprobe=0. This blocks the now current general practice of setting driver_override followed by using drivers_probe to bind a device to a specified driver. The kernel never automatically sets a driver_override therefore it seems we can assume a driver_override reflects the intent of the user. Also, probing a device using a driver_override match seems outside the scope of the 'auto' part of sriov_drivers_autoprobe. Therefore, let's allow driver_override matches regardless of sriov_drivers_autoprobe, which we can do by simply testing if a driver_override is set for a device as a 'can probe' condition. Fixes: 0e7df22401a3 ("PCI: Add sysfs sriov_drivers_autoprobe to control VF driver binding") Link: https://lore.kernel.org/lkml/155742996741.21878.569845487290798703.stgit@gimli.home Link: https://lore.kernel.org/linux-pci/155672991496.20698.4279330795743262888.stgit@gimli.home/T/#u Signed-off-by: Alex Williamson Signed-off-by: Bjorn Helgaas Signed-off-by: Greg Kroah-Hartman --- drivers/pci/pci-driver.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c @@ -399,7 +399,8 @@ void __weak pcibios_free_irq(struct pci_ #ifdef CONFIG_PCI_IOV static inline bool pci_device_can_probe(struct pci_dev *pdev) { - return (!pdev->is_virtfn || pdev->physfn->sriov->drivers_autoprobe); + return (!pdev->is_virtfn || pdev->physfn->sriov->drivers_autoprobe || + pdev->driver_override); } #else static inline bool pci_device_can_probe(struct pci_dev *pdev)