Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp6232523ybe; Tue, 17 Sep 2019 23:27:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqwFA6fyxpmiG4+nST6RK7RtV2yBs3uRhrVlxlNw31ruIsmaeCa6lUYXMDBdBCSwuVV8n6/H X-Received: by 2002:a50:ccd3:: with SMTP id b19mr8409967edj.257.1568788061798; Tue, 17 Sep 2019 23:27:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568788061; cv=none; d=google.com; s=arc-20160816; b=UAr0oTVdQ4ljdcxzb/GdC50BlAQV8dxH19uKFDS59cEo9PSeJMA7tcuAbBGhmjQdZq WOBAD70u8Xg/qTSFRcXwbXmJPadtnCDZ7MP7xDib3Km+pJkN9A3kMF5VjUCAsIvg+9Do y80ywADKpa2s/P8Vmo76IhLY/Q8KOEaPM68LoW/G8jODoOCoAm7wS50Rq7JWthw54Egh uo8UEJLE4RyKj2pfeO7Q0AXpX6axro4fneS8OYy2sgkktCIB2+LKS7lRM2TPbWcfuQ0y ibz5Jul5n8EWCdK4rLGsYlc6/dlOTNJ1qW4HC0GmdfNd5c/E1FqdWOgmEPEQCtw7WzQw W/Pg== 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=eEsD/0b36x7sJB1ByArTZ3UmWPjj6bNHEKfKCoxVfAzSb61FIHg7wCdGYvW/eBaOfV PF9xKti9MEOHEmG6q1WPV5n6WXF5sf4We7PKeTDjh4wfDqFL1DKy/VKZbRTaHXqi+ZdA BcHuuwsx+DsRJaaqYCmHzGf+ITA8zD3vvAfwHWS98sbuBEba5WYZlXhHMWP+fBJUp736 QJjLTOrkoE04SyAGpcRbVoUuQUA0zWKh9I1An7BFfTy03FRT5oamlZkr6wXdob0sJODA ccv/BLEaWJxFVu54rFozwG4S2xQKK3+PnlAU0hd3+cdvR0V6MWaIHb+P2GfnlFrQQ1so KKDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0JrTKDHM; 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 p13si2778793edi.410.2019.09.17.23.27.18; Tue, 17 Sep 2019 23:27:41 -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=0JrTKDHM; 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 S1729753AbfIRGYC (ORCPT + 99 others); Wed, 18 Sep 2019 02:24:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:44364 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727496AbfIRGYA (ORCPT ); Wed, 18 Sep 2019 02:24:00 -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 B8C3C21925; Wed, 18 Sep 2019 06:23:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568787840; bh=pNjQlHwmYnMq2l7APwROzUARrPp84X47aBsz4iOvu9Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0JrTKDHM2bkWUSNNOB8jnoROBjp5l9sH5OOvmP7CbbO7HewjWl2uJL23rwxu2voIE e94sQZPTkrpjwhC0hQsXvzEZFRIrWME1MRFNrdYkqAB43yPsLHw9+JfhrnqXnCaLHP fmCrUOaCQWSt6PCElCkczEmZNwcModkcWnif8yEE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alex Williamson , Bjorn Helgaas Subject: [PATCH 4.19 30/50] PCI: Always allow probing with driver_override Date: Wed, 18 Sep 2019 08:19:13 +0200 Message-Id: <20190918061226.640775776@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190918061223.116178343@linuxfoundation.org> References: <20190918061223.116178343@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)