Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp637502pxb; Fri, 8 Jan 2021 14:10:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJw0z0lBO9uGXXknW7aAOH58a/azmg/wcWezKJGQo7nCiSnF4GqMHJdsQMjuvicDzN7VDKpI X-Received: by 2002:aa7:dacf:: with SMTP id x15mr6562617eds.134.1610143822266; Fri, 08 Jan 2021 14:10:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610143822; cv=none; d=google.com; s=arc-20160816; b=H3JCufJP0xHaWq07HMkqJVbGRww7u7g0mzknL2QcPXdro6tsdpRN32wcNItTr0FFuC cZVvVM5T231WX3I/Z9O7ZdLJtTYNeJRU9PaQ1BQycEpaqTV/dLXz7A57z0qu/f/VmMBU 9hTTxs8pBELEMBKbJJd7tEHsUfa2njTRxqmpKfJgMCsHfc9cxietKSi4M/DeN4zWIJQN JivKscMz6POONK4MCVIelX1W0O3o1tK5s3960aQs5K5FVOChPrHCnQo1vYgjbvRzY2Yv 1eRFkqCSFFbeLRZTdNcRBA4sOdBQfNpHA2lVZo5GH6FQofwvlku5L9BU+SU4zLuKvCsu Nz5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=tzkmnWd707SGcOcBxSrShNHuNRrKOfCCZxlFIGOcO4U=; b=Y2IvVxNIVLGGW0k7SXFPTAIz+WaLX3LMjN8baBU7pYuY3nODgtd63NVsEWpzcM/86w sVvCz0SwO9E7k6jYWS1fuLxgzL4Lf88UiL5Sm3I901jdjBuMAW9g2Z5QKps3yi5+yAO8 Ef4HirmwdSRMRnz+ilNjoHb4y4GK4CJp+v9rQftsrxBe29g0LA8BtfRrNq+Qyt13h2Ia 2s8caK5LG8ApDS1wfWBhCLi6tcKhnsjYGlsWw8kLQXhedKFgnhRqnkAzH2B5JBTd+c2W 0kXCfsi7fEAv3iuwSpmlDYJljc1WyZIgXIyP5wltrXUUjkHvTAPN9nD+XW/rMoW4fQOy BCKQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cq20si4094119edb.563.2021.01.08.14.09.57; Fri, 08 Jan 2021 14:10:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725930AbhAHWID (ORCPT + 99 others); Fri, 8 Jan 2021 17:08:03 -0500 Received: from mail-pf1-f179.google.com ([209.85.210.179]:40830 "EHLO mail-pf1-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725763AbhAHWID (ORCPT ); Fri, 8 Jan 2021 17:08:03 -0500 Received: by mail-pf1-f179.google.com with SMTP id x126so7102194pfc.7; Fri, 08 Jan 2021 14:07:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=tzkmnWd707SGcOcBxSrShNHuNRrKOfCCZxlFIGOcO4U=; b=Lm1jnuvfYQ2/u7DvJMuM5rpO84Dh7PPm+afeaHh0MS5awT/tylylGyKHhBoPuHlbxd vN9n8LrsayhQk/rZViqPZDUICYKQLhswMNTPxbUTZNmn/8TH7/kJ3WSxsuLa5AsmNVb1 JQDJN8eGunA+bq+BuzWMTzRLZ1QlKptiGKnuN+8VahChKUK7qQNaVynLavwT/vxMccHD lppT4N8s/WwYwyAcRYybqvIBNdEwHrhWtILxKvq4hZ+Q1w/DzAyPlVRRGJBKnlgYVgLw PYgk8db6Kko67iObGMLljNz2+cLxLrm5Vy6fCfpVU4N32uezojKgWQQH5QYGZ0j0/UvV Sf7w== X-Gm-Message-State: AOAM53333cXrx4FtelyVO7r+NDso8ZewcgL4KKueXm1RlpVl/ZgM8jHk KRXvQ3qv6dpZOeqvVNm9F2obH0b9iLg= X-Received: by 2002:a63:6806:: with SMTP id d6mr8931266pgc.205.1610143642277; Fri, 08 Jan 2021 14:07:22 -0800 (PST) Received: from localhost ([2601:647:5b00:1162:1ac0:17a6:4cc6:d1ef]) by smtp.gmail.com with ESMTPSA id a136sm10494826pfd.149.2021.01.08.14.07.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 14:07:21 -0800 (PST) From: Moritz Fischer To: linux-pci@vger.kernel.org Cc: linux-kernel@vger.kernel.org, bhelgaas@google.com, moritzf@google.com, Moritz Fischer , Brian Foley Subject: [PATCH] PCI/IOV: Clarify error message for unbound devices Date: Fri, 8 Jan 2021 14:06:30 -0800 Message-Id: <20210108220630.10863-1-mdf@kernel.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Be more verbose to disambiguate the error case when trying to configure SRIOV with no driver bound vs. a driver that does not implement the SRIOV callback. Reported-by: Brian Foley Signed-off-by: Moritz Fischer --- drivers/pci/iov.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c index 4afd4ee4f7f0..f9ecc691daf5 100644 --- a/drivers/pci/iov.c +++ b/drivers/pci/iov.c @@ -304,8 +304,15 @@ static ssize_t sriov_numvfs_store(struct device *dev, if (num_vfs == pdev->sriov->num_VFs) goto exit; + /* is PF driver loaded */ + if (!pdev->driver) { + pci_info(pdev, "No driver bound to device. Cannot configure SRIOV\n"); + ret = -ENOENT; + goto exit; + } + /* is PF driver loaded w/callback */ - if (!pdev->driver || !pdev->driver->sriov_configure) { + if (!pdev->driver->sriov_configure) { pci_info(pdev, "Driver does not support SRIOV configuration via sysfs\n"); ret = -ENOENT; goto exit; -- 2.29.2