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 28956F36BA7 for ; Sat, 11 Apr 2026 08:04:47 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4ft5l62KXkz2yrD; Sat, 11 Apr 2026 18:03:14 +1000 (AEST) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip="2600:3c04:e001:324:0:1991:8:25" ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1775894594; cv=none; b=Y/PlyFA4IGyKIVf/3T0K5BzrrwyyR9QP+1tqvp78DajbcIEHwO0SrdILMLJGr2sfzO1dXK6i0h5BWDXPi5DqxqvkMRuiCEk9ABWmRwzXezuSJemW3np7g+IzTBTbKgKgDsQl6bY1D6xidh26kt+MRm+qWiI1srZVae1PZskWI8lz3PyByABeajG/zl4GE9zdPrl0sxm/YUuiF67CvkJCcrGWZN5l/ojMuQk8Cjrt8MEQUMMSp1kX2IjTovChdXAkvKgJeyCUdK76ByK4MrGCWHhOP0oMZsvQJ7leROQzZV+YGrY1O+kt5kv7EZA4j4AIa4L5dSU+jnDs4qWYzcBOIw== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1775894594; c=relaxed/relaxed; bh=I+jw9Q0ejs2ukF8rbBWfWqh5USCUZtszzvM0LV8iQgU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MaVYa8tSINRj8n3UoF6rtGMREd5hYqYyhqXD6VCmKl8IfrTiDZNfHgyZ7WJJUurC5ut12Hbr7oSsqF2o6SrkeiQ/CllxYwLTkwOfbgLb+25VucShegL2pVGRse47ko2yusX7s5ccj5BXIn4jGV1UdgPv5QEHPJiBV9c5oDag2PNBCOpUhuFab93Qf2e6XP9zwcDVLnQooRtVKCU8XejzpU0FjeMIsWJg1bFq0JqKtTVO8A9xJohJbTbT0twk2zrr1UhcFevatT32C4M5YZ0OFKJx8maas2BqwCWAR1duQDZNIXnda0r0GWIkDzOp2abV4rH7Y7kCWU9PVsXf5jWiQQ== 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=cMP/y7W1; dkim-atps=neutral; spf=pass (client-ip=2600:3c04:e001:324:0:1991:8:25; 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=cMP/y7W1; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=2600:3c04:e001:324:0:1991:8:25; helo=tor.source.kernel.org; envelope-from=kwilczynski@kernel.org; receiver=lists.ozlabs.org) Received: from tor.source.kernel.org (tor.source.kernel.org [IPv6:2600:3c04:e001:324: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 4ft5l54RQFz2yk6 for ; Sat, 11 Apr 2026 18:03:13 +1000 (AEST) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id B3C6060141; Sat, 11 Apr 2026 08:03:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3EB68C2BC9E; Sat, 11 Apr 2026 08:03:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775894591; bh=6TdFxnj/XF9dGvehexRWCwNHzJWM7dA99CTM42Uhd0k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cMP/y7W1Fkw+9eXey4NyQYjxyZUxA+Yrl9JuSmZzLWwI0/YEs+9gbjnmbTLa8uiOj VIVR3BMkLl8BGjI5OlPWzFOXDNvXwk3nm0O1g+N7SDm8EVpFl/30kSTYtB9W4zMn8j mWG/Ia/YDTHfKqZXfMqkxSma1lyTIYLLHvPmhDkyv7uCNuh6OZddiPeRVJj0UyhjXt t8NR3IYUfEtqFmn1OztDwngHcOleIWaUrUOkPvkzfgghm4fm2yrYAth1yZ5F0hKV3E xr84uvy8fYf3tO4P6s2Zce7kYvvWfSwUplBXyKwsAmc3fUwnjbrp0kMO9RKQy8jw21 HDrtdQHNb6MQA== From: =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= To: Bjorn Helgaas Cc: Bjorn Helgaas , Manivannan Sadhasivam , Lorenzo Pieralisi , 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 v4 22/24] PCI/sysfs: Add __weak pci_legacy_has_sparse() helper Date: Sat, 11 Apr 2026 08:01:46 +0000 Message-ID: <20260411080148.471335-23-kwilczynski@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260411080148.471335-1-kwilczynski@kernel.org> References: <20260411080148.471335-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. 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 a9dea147528d..ea51f6b20458 100644 --- a/arch/alpha/kernel/pci-sysfs.c +++ b/arch/alpha/kernel/pci-sysfs.c @@ -191,6 +191,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 3a7bbb00ca60..ce004b349594 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c @@ -1019,6 +1019,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 1bf165595583..f52caf7e4d13 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -390,6 +390,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.53.0