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 D71BBFA1FD0 for ; Wed, 22 Apr 2026 16:16:52 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4g147x4lGgz3cB5; Thu, 23 Apr 2026 02:15:25 +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=1776874525; cv=none; b=nwGcVOLvVHl6notaSm9MwGeGuD3OG8xgFfmegLsVRuaUZb+dIWdIpD6jTB5hg2ULjgowU2nFoasU4L+3i9lpKL2IF/jcOXCqQ+HNUKzATWRNNRPCTm9e/dql8UxkaXwN8Rz+9IaUmVEX/tXeH46ESvSwVSvHU5e7AySg6LLRl68vb27IselYGHHqKtaqi4V2L4/ujxMPzdMtSHCLFmWiJGu9lK0TMrjMMY4HpAOrkN0S/UDNMVozkhNEX7s1mT/7c5wqGRRCHAdAfZo18TlUnoVmZNz01CXMCLO7oPzbt95UZ6+EyTtSMHqMLANtE8N5K1gl0Nj2uT2ZFP9xihDvVg== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1776874525; c=relaxed/relaxed; bh=RRU2/GQRl3GxZO5NxOyA39DO9P+fw8gaX9JMZ7unmsY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=XOcdWTCH2p9jHL4tAS898kOZ7BkjnzV2OF5Y7bIM3AGJjCoL7VkOYxNl707sozXq/RXgix5nU3LtSiKrnd4Fy9Xepkq5Y65jXLFFxm6ZUTfMYskxmcrJyN5GmfGpDQyDQ7dc8geyesuIxBGZSGmLDegxV89itmlT6m1dZUwCPZIUv/xaEkkLnyRPxJGdrmK3Yr3++Rxdr9w+C/KcN7RZt2Q8mR1dF1ZUGB8T4f0cr6+SFM/jhv4ymDBMTdOMgG97/iK/QD/dX/JGgFlOB3ty0msDcW/aXj4tOuGJuSCnnUfv25Z+exbN5TnP9UliPw85C6ZlSmoJeTwA+2lNStMb6g== 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=D5CcSfMH; 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=D5CcSfMH; 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 4g147r5qBZz3btw for ; Thu, 23 Apr 2026 02:15: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 EC2406012A; Wed, 22 Apr 2026 16:15:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C21CC19425; Wed, 22 Apr 2026 16:15:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1776874518; bh=dijWWutmL7JHzGDHtujgmiIt1pal0+qTFGDBt404M9U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D5CcSfMHYCKVSxhdvGoAFxTAB3raXTVVyvqAkhMcNEcUyBzMCPOuAML6zE5POqQjk +C6Oi6Rz9HMP4+964KHpXS8PSMEvo9qn/cxW75QNkJt/s2znl4b4lrZku29O42/AVD pk4GGDiqhjSo8CLN1kSxG3VSN72chC7cd7TmhL9g+KbIWBtScDUcXwsYDqwd74TtmO rHceuuE6GWaXMdYW+nirk6x4J1U4WArg0Nz1HYruqRTm89YPyFf74rtjMqEypkT6GP S9YG3MPy0eoObeOOneh+wS1gAJNNcvURBBHBTxY0GIyRyMDG4iaPMJNu0v8iFLfPVV S9Xr8i1MxTAyw== 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 v6 19/24] PCI: Add macros for legacy I/O and memory address space sizes Date: Wed, 22 Apr 2026 16:14:02 +0000 Message-ID: <20260422161407.118748-20-kwilczynski@kernel.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260422161407.118748-1-kwilczynski@kernel.org> References: <20260422161407.118748-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 defines for the standard PCI legacy address space sizes, replacing the raw literals used by the legacy sysfs attributes. Then, replace open-coded values with the newly added macros. No functional changes intended. Suggested-by: Ilpo Järvinen Signed-off-by: Krzysztof Wilczyński --- drivers/pci/pci-sysfs.c | 4 ++-- include/linux/pci.h | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index 3a7bbb00ca60..ad8ee192c94b 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c @@ -1055,7 +1055,7 @@ void pci_create_legacy_files(struct pci_bus *b) sysfs_bin_attr_init(b->legacy_io); b->legacy_io->attr.name = "legacy_io"; - b->legacy_io->size = 0xffff; + b->legacy_io->size = PCI_LEGACY_IO_SIZE; b->legacy_io->attr.mode = 0600; b->legacy_io->read = pci_read_legacy_io; b->legacy_io->write = pci_write_legacy_io; @@ -1072,7 +1072,7 @@ void pci_create_legacy_files(struct pci_bus *b) b->legacy_mem = b->legacy_io + 1; sysfs_bin_attr_init(b->legacy_mem); b->legacy_mem->attr.name = "legacy_mem"; - b->legacy_mem->size = 1024*1024; + b->legacy_mem->size = PCI_LEGACY_MEM_SIZE; b->legacy_mem->attr.mode = 0600; b->legacy_mem->mmap = pci_mmap_legacy_mem; /* See pci_create_attr() for motivation */ diff --git a/include/linux/pci.h b/include/linux/pci.h index f6f55005f82d..6b630bac8c08 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -1167,6 +1168,10 @@ enum { /* These external functions are only available when PCI support is enabled */ #ifdef CONFIG_PCI +/* PCI legacy I/O port and memory address space sizes. */ +#define PCI_LEGACY_IO_SIZE (SZ_64K - 1) +#define PCI_LEGACY_MEM_SIZE SZ_1M + extern unsigned int pci_flags; static inline void pci_set_flags(int flags) { pci_flags = flags; } -- 2.54.0