From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 916FDCD342F for ; Fri, 8 May 2026 04:36:57 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4gBbsw6KcJz30Lw; Fri, 08 May 2026 14:36:20 +1000 (AEST) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip=172.105.4.254 ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1778214980; cv=none; b=Z/oOpchvLVhSk1TLPGUJPnrXtituJVrakLS5FQK1tLQhGKDKopQEEqSzS1TfQbRZIr7mAe06gfnGmO2ixhy0cEYN+3mJeIygG+ZtdbU/0IlbTa2wxPdCPJcVLwPE/awvAlvESxwJUp7+MIgvfHpQxagpDyM2PtrcLOIzhAEasK7E1s6E21aU3WYutYiZzXtPLemjXHn/qNqFs5QfavNL6h1JdteRE3OjQbYR4gmKCmsu9WsyqTqvN3ad1IwXaWN0qAiPV5prTENyuh2jVlq0j7adQQJMJydEKsl3QobwWmtbqgedzobfuFeSLJJTKNKfW3O5MTmB/1701HKCGtM1OQ== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1778214980; c=relaxed/relaxed; bh=5FO94nBRtGaqJOfD9g8mGYnlUBduBtpebOTsKzSu/NY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=hxQZW0yYd2NgXWzUYCQK8vvPoaC6IdrTDmt/gWpzuFUyZDi9Gwqra3wDvqVyPD0q6rmf1+u0vsEKm5gGwZ5D5MFbGwRB8l9jyYsJM3/ABWWmoa3JG/Ha+w2WNL/RW4XfuPH5pYlVzFeUgJocBPRqytrq8s2j3Y2JCaREPgta+CmnKZi+y3JrTuK6kAMiuhaKuyZHrCOLSi+J/pH8Q2Zs01LMIETJEH7vps9MclXGU+QYvMVG+rUQ2kJcMHyCQTy92jkky6yN0BAZhaQBYcMDAK+kkvdbe726BTe56IInZFrtiofU444irG9dWTuC6h15/z8cgWop43QrIioANQi/ng== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=NAOVaKZS; dkim-atps=neutral; spf=pass (client-ip=172.105.4.254; helo=tor.source.kernel.org; envelope-from=kwilczynski@kernel.org; receiver=lists.ozlabs.org) smtp.mailfrom=kernel.org Authentication-Results: lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=NAOVaKZS; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=172.105.4.254; helo=tor.source.kernel.org; envelope-from=kwilczynski@kernel.org; receiver=lists.ozlabs.org) Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4gBbsw0RQnz2xPb for ; Fri, 08 May 2026 14:36:20 +1000 (AEST) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 3580260181; Fri, 8 May 2026 04:36:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9BD14C2BCB4; Fri, 8 May 2026 04:36:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778214977; bh=npFjt2eFuO2uVckDmBE/VjWzSztOJLV6MfwijXvEL7M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NAOVaKZSgv2JC8kYDcMYr1zfF/BGWGk29hLtLyOrUeg8gi/M4FBPWTP2DTqY8U0kL OAnpX7rAzXkuisaJu0w4BgQT7QdsdJyl8OifmwkmOGmW+2QET8CxzeJ1yL7GhtDaw7 ZCBLnOnzfkEOau9IOeVLnWqxP37EdoKqckL55iCjfDknDHWHJQwXkAXt82crrhzqay KBq9hS8BDOas3hPbCvUYSSSN5JrcBWN++vRoX5EVzilPjLteTkI7I80XbftbQ6Mvwt xgEONVRMWMXalytUEVfgLhDHExjS7vPZtQ95P0MpkaACcMgyrCMXMFYlw5KUw/B8iS +qEnUACT6QfRg== From: =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= To: Bjorn Helgaas Cc: Bjorn Helgaas , Manivannan Sadhasivam , Lorenzo Pieralisi , Alex Williamson , Magnus Lindholm , Matt Turner , Richard Henderson , Christophe Leroy , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Dexuan Cui , =?UTF-8?q?Krzysztof=20Ha=C5=82asa?= , Lukas Wunner , "Oliver O'Halloran" , Saurabh Singh Sengar , Shuan He , Srivatsa Bhat , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , linux-pci@vger.kernel.org, linux-alpha@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH v7 08/24] PCI/sysfs: Warn about BAR resize failure in __resource_resize_store() Date: Fri, 8 May 2026 04:35:27 +0000 Message-ID: <20260508043543.217179-9-kwilczynski@kernel.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260508043543.217179-1-kwilczynski@kernel.org> References: <20260508043543.217179-1-kwilczynski@kernel.org> X-Mailing-List: linuxppc-dev@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Archive: , List-Subscribe: , , List-Unsubscribe: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a pci_warn() to __resource_resize_store(), so that BAR resize failures are visible to the user, which can help troubleshoot any potential resource resize issues. While at it, rename the resource_resize_is_visible() to resource_resize_attr_is_visible() along with the corresponding group variable to align with the naming convention used by the resource attribute groups. Also, change the order of pci_dev_groups[] such that the resize group is now located alongside the other resource groups. Tested-by: Shivaprasad G Bhat Signed-off-by: Krzysztof WilczyƄski --- drivers/pci/pci-sysfs.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index 0fa126d46e35..f34415a401ec 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c @@ -1679,6 +1679,9 @@ static ssize_t __resource_resize_store(struct device *dev, int n, sysfs_remove_groups(&pdev->dev.kobj, pci_dev_resource_attr_groups); ret = pci_resize_resource(pdev, n, size, 0); + if (ret) + pci_warn(pdev, "Failed to resize BAR %d: %pe\n", + n, ERR_PTR(ret)); pci_assign_unassigned_bus_resources(bus); @@ -1726,7 +1729,7 @@ static struct attribute *resource_resize_attrs[] = { NULL, }; -static umode_t resource_resize_is_visible(struct kobject *kobj, +static umode_t resource_resize_attr_is_visible(struct kobject *kobj, struct attribute *a, int n) { struct pci_dev *pdev = to_pci_dev(kobj_to_dev(kobj)); @@ -1734,9 +1737,9 @@ static umode_t resource_resize_is_visible(struct kobject *kobj, return pci_rebar_get_current_size(pdev, n) < 0 ? 0 : a->mode; } -static const struct attribute_group pci_dev_resource_resize_group = { +static const struct attribute_group pci_dev_resource_resize_attr_group = { .attrs = resource_resize_attrs, - .is_visible = resource_resize_is_visible, + .is_visible = resource_resize_attr_is_visible, }; int __must_check pci_create_sysfs_dev_files(struct pci_dev *pdev) @@ -1857,6 +1860,7 @@ const struct attribute_group *pci_dev_groups[] = { &pci_dev_resource_uc_attr_group, &pci_dev_resource_wc_attr_group, #endif + &pci_dev_resource_resize_attr_group, &pci_dev_config_attr_group, &pci_dev_rom_attr_group, &pci_dev_reset_attr_group, @@ -1868,7 +1872,6 @@ const struct attribute_group *pci_dev_groups[] = { #ifdef CONFIG_ACPI &pci_dev_acpi_attr_group, #endif - &pci_dev_resource_resize_group, ARCH_PCI_DEV_GROUPS NULL, }; -- 2.54.0