{"id":2234825,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2234825/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20260508043543.217179-22-kwilczynski@kernel.org/","project":{"id":2,"url":"http://patchwork.ozlabs.org/api/1.2/projects/2/?format=json","name":"Linux PPC development","link_name":"linuxppc-dev","list_id":"linuxppc-dev.lists.ozlabs.org","list_email":"linuxppc-dev@lists.ozlabs.org","web_url":"https://github.com/linuxppc/wiki/wiki","scm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git","webscm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/","list_archive_url":"https://lore.kernel.org/linuxppc-dev/","list_archive_url_format":"https://lore.kernel.org/linuxppc-dev/{}/","commit_url_format":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}"},"msgid":"<20260508043543.217179-22-kwilczynski@kernel.org>","list_archive_url":"https://lore.kernel.org/linuxppc-dev/20260508043543.217179-22-kwilczynski@kernel.org/","date":"2026-05-08T04:35:40","name":"[v7,21/24] PCI/sysfs: Add __weak pci_legacy_has_sparse() helper","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"52a3dc2f5995f083ef026d4e471564dc3553239a","submitter":{"id":86709,"url":"http://patchwork.ozlabs.org/api/1.2/people/86709/?format=json","name":"Krzysztof Wilczyński","email":"kwilczynski@kernel.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20260508043543.217179-22-kwilczynski@kernel.org/mbox/","series":[{"id":503322,"url":"http://patchwork.ozlabs.org/api/1.2/series/503322/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=503322","date":"2026-05-08T04:35:20","name":"PCI: Convert all dynamic sysfs attributes to static","version":7,"mbox":"http://patchwork.ozlabs.org/series/503322/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2234825/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2234825/checks/","tags":{},"related":[],"headers":{"Return-Path":"\n <linuxppc-dev+bounces-20605-incoming=patchwork.ozlabs.org@lists.ozlabs.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=gojkxWSs;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org\n (client-ip=2404:9400:21b9:f100::1; helo=lists.ozlabs.org;\n envelope-from=linuxppc-dev+bounces-20605-incoming=patchwork.ozlabs.org@lists.ozlabs.org;\n receiver=patchwork.ozlabs.org)","lists.ozlabs.org;\n arc=none smtp.remote-ip=172.105.4.254","lists.ozlabs.org;\n dmarc=pass (p=quarantine dis=none) header.from=kernel.org","lists.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=gojkxWSs;\n\tdkim-atps=neutral","lists.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org\n (client-ip=172.105.4.254; helo=tor.source.kernel.org;\n envelope-from=kwilczynski@kernel.org; receiver=lists.ozlabs.org)"],"Received":["from lists.ozlabs.org (lists.ozlabs.org\n [IPv6:2404:9400:21b9:f100::1])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4gBbwX6jhFz1yJq\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 08 May 2026 14:38:36 +1000 (AEST)","from boromir.ozlabs.org (localhost [127.0.0.1])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 4gBbtr3VJJz30VT;\n\tFri, 08 May 2026 14:37:08 +1000 (AEST)","from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 4gBbtq4519z2xPb\n\tfor <linuxppc-dev@lists.ozlabs.org>; Fri, 08 May 2026 14:37:07 +1000 (AEST)","from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58])\n\tby tor.source.kernel.org (Postfix) with ESMTP id 86D67600AE;\n\tFri,  8 May 2026 04:37:05 +0000 (UTC)","by smtp.kernel.org (Postfix) with ESMTPSA id EE601C2BCB0;\n\tFri,  8 May 2026 04:37:01 +0000 (UTC)"],"ARC-Seal":"i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1778215028;\n\tcv=none;\n b=XUUU0T0MP0UAN/HQTf++Qp2iyC0bh30gpRAdsvHsP9LZr5GAqLtDcNQBI8YZJcJFnY1TdrRxr3TKYAJv8XXQbzhDCl2hStKg6y4/fN8R9DbonqgyABVOwbGEZxgnk7J+X6G4IdnvFsIrLVLFZ7yEyTpZk3J6Sg2vX77ysXdKm71yx+6zfgmGT7GDTB6hXHBD7vMXo+V0hgk5FuBOrYAPsyTRDIZ0dQkpHOv1ogvDGVwz05+ptQnKRZgjLvLskb8dreJcBd+V2tG4cPYay/156NRrnVBqy50dLspdVyjVpJjXcYG40qqQOVLNVofpVMEsaXGnqCRvC7fsz8HJpq9wpQ==","ARC-Message-Signature":"i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707;\n\tt=1778215028; c=relaxed/relaxed;\n\tbh=UceKPhlHkzghVv7RXcRxJvLShNkk/5LOuiiN4exntiQ=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version:Content-Type;\n b=e4wL8z8QxT7eEEB1vEVdz2sDbgUoJgMEFqpLoS5aIN0Pznk/w+s610Iuw6smS7n0xZp4zDJxO+JjoDX79/kalpPX6c4wxQJPgWwvV+fEZIUhedcvtE4r1J7yzj3j+f7Kw+T2+w6sRoO3fjzC5Py4c8B8gt8hnxxtbC+1mfXqbR4f62+SBcVobVai1tuLcntfkbN+Uml7oMMOO8SuOMf6vEfDw5tTW1ekVaY/KrCBnmEzz8dyCr5pFhlJ+joVKyL5tmjxr0rWF4y+YKPPwtNZpf3rDnHjIWAomyKgzH25WZvImRfBTL7UA54uCPaLqQMebCvjnYkLN15jCFInOsCd5g==","ARC-Authentication-Results":"i=1; lists.ozlabs.org;\n dmarc=pass (p=quarantine dis=none) header.from=kernel.org;\n dkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=gojkxWSs; dkim-atps=neutral;\n spf=pass (client-ip=172.105.4.254; helo=tor.source.kernel.org;\n envelope-from=kwilczynski@kernel.org;\n receiver=lists.ozlabs.org) smtp.mailfrom=kernel.org","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1778215025;\n\tbh=dvrWWiezWy8a25eOYZ7kT3ZuDPygnOIs6x7THQzp8XQ=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=gojkxWSsjs4HHq9Sz1NSR2O576qHSQJY9wjQgo3bfowHdAoHZaa2OE4OAIT5iyLuP\n\t 1VpquJbvclXBjRHzxZVoiaJSQm2KwI5VPFtECPmugIzmuvpF01L1CdZ1Yjr+cEJVC3\n\t Ak226U0ylzCooHHs2Q9NZp3EfiQYOOGqhd63jMVXMSq71IBWsjMVr+Wq9sjwozh97L\n\t QxTwsxqawiRzUVwLTbNnwDEOqzjD2/st35DFOcvcz+br+7wpfW5xaoSw4uBOuLmCxM\n\t BqUa22aGeF+PkSv+tOokpEGR+dM9F5rxgNRml1vbS7Jb+3HweCOElZNafhXQPdmZh+\n\t Iuvqb+63kgpMQ==","From":"=?utf-8?q?Krzysztof_Wilczy=C5=84ski?= <kwilczynski@kernel.org>","To":"Bjorn Helgaas <bhelgaas@google.com>","Cc":"Bjorn Helgaas <helgaas@kernel.org>,\n Manivannan Sadhasivam <mani@kernel.org>,\n Lorenzo Pieralisi <lpieralisi@kernel.org>,\n Alex Williamson <alex@shazbot.org>, Magnus Lindholm <linmag7@gmail.com>,\n Matt Turner <mattst88@gmail.com>,\n Richard Henderson <richard.henderson@linaro.org>,\n Christophe Leroy <chleroy@kernel.org>,\n Madhavan Srinivasan <maddy@linux.ibm.com>,\n Michael Ellerman <mpe@ellerman.id.au>, Nicholas Piggin <npiggin@gmail.com>,\n Dexuan Cui <decui@microsoft.com>,\n =?utf-8?q?Krzysztof_Ha=C5=82asa?= <khalasa@piap.pl>,\n Lukas Wunner <lukas@wunner.de>, \"Oliver O'Halloran\" <oohall@gmail.com>,\n Saurabh Singh Sengar <ssengar@microsoft.com>,\n Shuan He <heshuan@bytedance.com>, Srivatsa Bhat <srivatsabhat@microsoft.com>,\n\t=?utf-8?q?Ilpo_J=C3=A4rvinen?= <ilpo.jarvinen@linux.intel.com>,\n linux-pci@vger.kernel.org, linux-alpha@vger.kernel.org,\n linuxppc-dev@lists.ozlabs.org","Subject":"[PATCH v7 21/24] PCI/sysfs: Add __weak pci_legacy_has_sparse() helper","Date":"Fri,  8 May 2026 04:35:40 +0000","Message-ID":"<20260508043543.217179-22-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":"<linuxppc-dev.lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev+help@lists.ozlabs.org>","List-Owner":"<mailto:linuxppc-dev+owner@lists.ozlabs.org>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Archive":"<https://lore.kernel.org/linuxppc-dev/>,\n  <https://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Subscribe":"<mailto:linuxppc-dev+subscribe@lists.ozlabs.org>,\n  <mailto:linuxppc-dev+subscribe-digest@lists.ozlabs.org>,\n  <mailto:linuxppc-dev+subscribe-nomail@lists.ozlabs.org>","List-Unsubscribe":"<mailto:linuxppc-dev+unsubscribe@lists.ozlabs.org>","Precedence":"list","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","X-Spam-Status":"No, score=-0.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,\n\tDKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS\n\tautolearn=disabled version=4.0.1 OzLabs 8","X-Spam-Checker-Version":"SpamAssassin 4.0.1 (2024-03-25) on lists.ozlabs.org"},"content":"Currently, Alpha's sparse/dense legacy attribute handling is done via\npci_adjust_legacy_attr(), which updates dynamically allocated attributes\nat runtime.  The upcoming conversion to static attributes needs a way\nto determine sparse support at visibility check time.\n\nAdd a __weak pci_legacy_has_sparse() that returns false by default.\nAlpha overrides it to check has_sparse() on the bus host controller.\n\nTested-by: Shivaprasad G Bhat <sbhat@linux.ibm.com>\nSigned-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>\n---\n arch/alpha/include/asm/pci.h  | 2 ++\n arch/alpha/kernel/pci-sysfs.c | 7 +++++++\n drivers/pci/pci-sysfs.c       | 6 ++++++\n drivers/pci/pci.h             | 4 ++++\n 4 files changed, 19 insertions(+)","diff":"diff --git a/arch/alpha/include/asm/pci.h b/arch/alpha/include/asm/pci.h\nindex ef19295f2e33..95de7ffd59e8 100644\n--- a/arch/alpha/include/asm/pci.h\n+++ b/arch/alpha/include/asm/pci.h\n@@ -86,6 +86,8 @@ extern int pci_mmap_legacy_page_range(struct pci_bus *bus,\n \t\t\t\t      enum pci_mmap_state mmap_state);\n extern void pci_adjust_legacy_attr(struct pci_bus *bus,\n \t\t\t\t   enum pci_mmap_state mmap_type);\n+extern bool pci_legacy_has_sparse(struct pci_bus *bus,\n+\t\t\t\t  enum pci_mmap_state type);\n #define HAVE_PCI_LEGACY\t1\n \n extern const struct attribute_group pci_dev_resource_attr_group;\ndiff --git a/arch/alpha/kernel/pci-sysfs.c b/arch/alpha/kernel/pci-sysfs.c\nindex 89329910b890..2d46502ba09b 100644\n--- a/arch/alpha/kernel/pci-sysfs.c\n+++ b/arch/alpha/kernel/pci-sysfs.c\n@@ -185,6 +185,13 @@ int pci_mmap_legacy_page_range(struct pci_bus *bus, struct vm_area_struct *vma,\n \treturn hose_mmap_page_range(hose, vma, mmap_type, sparse);\n }\n \n+bool pci_legacy_has_sparse(struct pci_bus *bus, enum pci_mmap_state type)\n+{\n+\tstruct pci_controller *hose = bus->sysdata;\n+\n+\treturn has_sparse(hose, type);\n+}\n+\n /**\n  * pci_adjust_legacy_attr - adjustment of legacy file attributes\n  * @bus: bus to create files under\ndiff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c\nindex 7ba12b2abe48..1e6786463e4e 100644\n--- a/drivers/pci/pci-sysfs.c\n+++ b/drivers/pci/pci-sysfs.c\n@@ -983,6 +983,12 @@ static int pci_mmap_legacy_io(struct file *filp, struct kobject *kobj,\n \treturn pci_mmap_legacy_page_range(bus, vma, pci_mmap_io);\n }\n \n+bool __weak pci_legacy_has_sparse(struct pci_bus *bus,\n+\t\t\t\t  enum pci_mmap_state type)\n+{\n+\treturn false;\n+}\n+\n /**\n  * pci_adjust_legacy_attr - adjustment of legacy file attributes\n  * @b: bus to create files under\ndiff --git a/drivers/pci/pci.h b/drivers/pci/pci.h\nindex 71a1fde1e505..c64c7f5f0bcf 100644\n--- a/drivers/pci/pci.h\n+++ b/drivers/pci/pci.h\n@@ -392,6 +392,10 @@ static inline int pci_no_d1d2(struct pci_dev *dev)\n \n }\n \n+#ifdef HAVE_PCI_LEGACY\n+bool pci_legacy_has_sparse(struct pci_bus *bus, enum pci_mmap_state type);\n+#endif\n+\n #ifdef CONFIG_SYSFS\n extern const struct attribute_group *pci_dev_groups[];\n extern const struct attribute_group *pci_dev_attr_groups[];\n","prefixes":["v7","21/24"]}