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 DACC7E99049 for ; Fri, 10 Apr 2026 07:15:46 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4fsSkn4QBvz2yrM; Fri, 10 Apr 2026 17:15:45 +1000 (AEST) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip=172.234.252.31 ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1775800312; cv=none; b=HA1JfXCM92oDEH9PQz3G7HxjIcmgceaLJgfZagVmytIYIn0wlIHSJElTQ3qi63Fz2DVbeVon53q51ZyYOFW0BzsHGb6IrIVf31Me0u3/52IXCAf3PFwNb7F7aGCY8u6lI5s7SD1IMd+9UfoBsYrFKNFjD9ED+sB4ucLoCEQgUf+BV2ukA+FqZsq0vDWf9p6yBUyvg4AU/qWjkthyf657xFMhon243bJr7th0hrO006pIFpzYI+7+iSKGu0hFFKb5uTWUvsAxoXRetnb9NDtvV6HZZHGkXFGeDuzyoHtondt/M9r+Nn3rfbLM+xuT1XCrvM7AP3sCExeRc2jVdE0RRw== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1775800312; c=relaxed/relaxed; bh=O8uSC0VRXlwXWVNRBOfVKi3KtllO+T7PRULpLZGRl6k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=luuq83ZYHEOM7M7etoapuanCdQVNKIAFPBUZFTY6AGg3ISJrGs2y7gzMAPu1F7RofWaDmN9laNybzxPzbCCNwhwwcytTCmlSIYG9fNczNy+IWlepVZ97oYvoYJtCsqTWyppL/6JGYtxS6z8l9iBZjvbzMBhgzpdWbUdWI18nvBLeLK14O58Moo9grcLlHskoqPOtNpIY0u8BqUsRqGkfsTq3TIjycTwLagnbx2m9tsPq34VHhJnTtWJXOe6u0iOQg9/OtZS7RPEsLfUtzb2+xyKyKGATg81RIVl8yac7cvKtSpekcmrHNkbNUEgBCmBxZb6nEQ4viF0HBRLlFvdEsA== 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=idNrnZGK; dkim-atps=neutral; spf=pass (client-ip=172.234.252.31; 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=k20201202 header.b=idNrnZGK; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=172.234.252.31; helo=sea.source.kernel.org; envelope-from=kwilczynski@kernel.org; receiver=lists.ozlabs.org) Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) (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 4fsQsz6wfsz2yRl for ; Fri, 10 Apr 2026 15:51:51 +1000 (AEST) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 7327B44554; Fri, 10 Apr 2026 05:51:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0872FC19424; Fri, 10 Apr 2026 05:51:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775800310; bh=oQgIbc3awQh5fpb2CqNNM9x6RSDapGc3MWBpJJrWA7E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=idNrnZGKoasnD+B1n6MQ4w55cpcbgnyBAaSbeyxgoqaEf9peMLrM99g7hbTJTahvx RPGuG1UNYkXbtttYpaE75RjqXuyb2pDPR1VMWk1U1OrtGjHHvKX4EPLinekes/d7vk bN46bFvKC5+DQQzRpB/ufCE4vD6TRb9VjEiIHPMyQ0z0kq8+2GzVzIDmINommzG9ow qyNlHpAMWYY4+QqnBUvBglUeE0z2v+iKqL98oyXZYUsDxikE5IemvqgnUbEtwGyJzB KTh7H61KNCjotmjDPR5DBjp75RYdJ84VeWLcUFJFRMxAwxP2/MrQUIQiKn64YXQvUU XpMjiHJAGvHlA== 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 18/20] PCI/sysfs: Add __weak pci_legacy_has_sparse() helper Date: Fri, 10 Apr 2026 05:50:38 +0000 Message-ID: <20260410055040.39233-19-kwilczynski@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260410055040.39233-1-kwilczynski@kernel.org> References: <20260410055040.39233-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/kernel/pci-sysfs.c | 7 +++++++ drivers/pci/pci-sysfs.c | 6 ++++++ drivers/pci/pci.h | 4 ++++ 3 files changed, 17 insertions(+) diff --git a/arch/alpha/kernel/pci-sysfs.c b/arch/alpha/kernel/pci-sysfs.c index 2da95d965e9c..2031a3b6972c 100644 --- a/arch/alpha/kernel/pci-sysfs.c +++ b/arch/alpha/kernel/pci-sysfs.c @@ -190,6 +190,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 40b5e21d77f3..fe079fb31dce 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