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 D43C3CD98F8 for ; Fri, 19 Jun 2026 08:54:29 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4ghWb82NQrz3bsM; Fri, 19 Jun 2026 18:53:24 +1000 (AEST) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip="2600:3c0a:e001:78e:0:1991:8:25" ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1781859204; cv=none; b=EzhyJ9dopf/fIx+rLJlDs0Jl8StU6/VYDHk6OpKjiaJH3oeVTuDENBkB8uk8aluW4WBglnn9damgxRsdZGYB22JvUHhoJoBlZ9qlV7j3fi7od3SC3hy7KkwvEmo5yDIjYL1sAuCl/aWQJNTuVADUFCgph34NNO557nFI8PS3P0Qbaahd9VpRDhmm0K6Z469KhlAWJ4Q3vRw01f1s4r9oe87Wrs67PT1DseBRYnln1MuHsPn2FjxnuZR6X05SuUUFqOEfkDflUTNhJLonxqNZUbaMgk1J3T8uj4ReNYII62YXeFt6Q/GTVDwcqpX57ZHyxRy13om8Bm5YXqzuq5s4Dw== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1781859204; c=relaxed/relaxed; bh=ZtExgl18k1w/oxRcDRexEZu+AmUEBl9WvzTUZuXPKUM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=nDjBAWlsxteSDUxiXh9aZ1mMzFSGAsGxtp5M+KVHn40B6P6BcV6Xmz7+XvUgWriSVmrkOGxHw2uFDW3U48t5uDMezBq3fQAdUWFYsiatUFTDKOLAldn6OiVQVtkGugcwdMPBB5HP1YoMBuF6ILdeDzB4dC644FaCiSGgVvu9BIKlgwYMe1avvGfnqqKrMPLacv1f23NnwIZ+8fFxevN/xfHpWzl1xkN2SRRQLUl2aUE6ta57PdSg45VszBfT/qDe44ybzmPbUA4zXQZOiANFOh4YmIvP0n9Me9YIu/L1JuYjCqeKZC9vH16ecuy3WdV/AviKEw36hmacyQLL0hu1ng== 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=k20260515 header.b=IIU94N26; dkim-atps=neutral; spf=pass (client-ip=2600:3c0a:e001:78e:0:1991:8:25; helo=sea.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=k20260515 header.b=IIU94N26; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=2600:3c0a:e001:78e:0:1991:8:25; helo=sea.source.kernel.org; envelope-from=kwilczynski@kernel.org; receiver=lists.ozlabs.org) Received: from sea.source.kernel.org (sea.source.kernel.org [IPv6:2600:3c0a:e001:78e:0:1991:8:25]) (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 4ghWb731X8z3bs5 for ; Fri, 19 Jun 2026 18:53:23 +1000 (AEST) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 6642A43ABF; Fri, 19 Jun 2026 08:53:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B6DE1F00A3D; Fri, 19 Jun 2026 08:53:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1781859201; bh=ZtExgl18k1w/oxRcDRexEZu+AmUEBl9WvzTUZuXPKUM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=IIU94N26OFj14yaKOeXQ0CYvtS0FGm4xOxAxpX2CVg2BrSeNwPdwO5mRslwGyTAcw Rqkq9eqndDEHEIQFued8aOjVJfHfjytldnew8BFe0tiFZ7d5sPL3VhREQPcaRl0y4O TB+s8lITse4bF5Xz/CRTn0GMODcYCGmDXJcJqI0Pl0TV6Wv2I6HsTfKCE9w6gNvkLH wsQ7btk4rcaFKxjHdw+bfzfTcv23lfqB4pVzkITh7v08Q1q3ATSYwiU9xsctsPnFK6 yu9P/WsdbtfJ+O09iK4chj2fBxKKCk4qYUT1Dx7sPixXaZTRg4Qvc5/TSHjFd4g2nc hYcmS7/ahB94g== 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 v8 21/25] PCI/sysfs: Add __weak pci_legacy_has_sparse() helper Date: Fri, 19 Jun 2026 08:51:56 +0000 Message-ID: <20260619085200.3729431-22-kwilczynski@kernel.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260619085200.3729431-1-kwilczynski@kernel.org> References: <20260619085200.3729431-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 Currently, Alpha's sparse/dense legacy attribute handling is done via pci_adjust_legacy_attr(), which updates dynamically allocated attributes at runtime. The upcoming conversion to static attributes needs a way to determine sparse support at visibility check time. Add a __weak pci_legacy_has_sparse() that returns false by default. Alpha overrides it to check has_sparse() on the bus host controller. Tested-by: Shivaprasad G Bhat Signed-off-by: Krzysztof WilczyƄski --- arch/alpha/include/asm/pci.h | 2 ++ arch/alpha/kernel/pci-sysfs.c | 7 +++++++ drivers/pci/pci-sysfs.c | 6 ++++++ drivers/pci/pci.h | 4 ++++ 4 files changed, 19 insertions(+) diff --git a/arch/alpha/include/asm/pci.h b/arch/alpha/include/asm/pci.h index ef19295f2e33..95de7ffd59e8 100644 --- a/arch/alpha/include/asm/pci.h +++ b/arch/alpha/include/asm/pci.h @@ -86,6 +86,8 @@ extern int pci_mmap_legacy_page_range(struct pci_bus *bus, enum pci_mmap_state mmap_state); extern void pci_adjust_legacy_attr(struct pci_bus *bus, enum pci_mmap_state mmap_type); +extern bool pci_legacy_has_sparse(struct pci_bus *bus, + enum pci_mmap_state type); #define HAVE_PCI_LEGACY 1 extern const struct attribute_group pci_dev_resource_attr_group; diff --git a/arch/alpha/kernel/pci-sysfs.c b/arch/alpha/kernel/pci-sysfs.c index 74c9145e0253..2d878b310629 100644 --- a/arch/alpha/kernel/pci-sysfs.c +++ b/arch/alpha/kernel/pci-sysfs.c @@ -184,6 +184,13 @@ int pci_mmap_legacy_page_range(struct pci_bus *bus, struct vm_area_struct *vma, return hose_mmap_page_range(hose, vma, mmap_type, sparse); } +bool pci_legacy_has_sparse(struct pci_bus *bus, enum pci_mmap_state type) +{ + struct pci_controller *hose = bus->sysdata; + + return has_sparse(hose, type); +} + /** * pci_adjust_legacy_attr - adjustment of legacy file attributes * @bus: bus to create files under diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index b8986a735a46..a861484ac0c0 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c @@ -983,6 +983,12 @@ static int pci_mmap_legacy_io(struct file *filp, struct kobject *kobj, return pci_mmap_legacy_page_range(bus, vma, pci_mmap_io); } +bool __weak pci_legacy_has_sparse(struct pci_bus *bus, + enum pci_mmap_state type) +{ + return false; +} + /** * pci_adjust_legacy_attr - adjustment of legacy file attributes * @b: bus to create files under diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 71a1fde1e505..c64c7f5f0bcf 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -392,6 +392,10 @@ static inline int pci_no_d1d2(struct pci_dev *dev) } +#ifdef HAVE_PCI_LEGACY +bool pci_legacy_has_sparse(struct pci_bus *bus, enum pci_mmap_state type); +#endif + #ifdef CONFIG_SYSFS extern const struct attribute_group *pci_dev_groups[]; extern const struct attribute_group *pci_dev_attr_groups[]; -- 2.54.0