From nobody Thu Oct 2 19:39:05 2025 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2054.outbound.protection.outlook.com [40.107.237.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7C7C63101AE; Fri, 12 Sep 2025 14:45:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.54 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757688347; cv=fail; b=iL0suMu47O4EUzPglRBqehb4WLuEsPP0iaPWyMlxlJZA17Q40eUNDLro0ZQ/+0n9+MzOEVhKwSg5rdOOhA7cGO/L1nrJsW7RlC2ivDIfILUBZAF20PqpID6QYNKJeisMHngNgnSQ3DYhHWxL90Z/gq+V1o4vCVvXnELpKyhGSSU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757688347; c=relaxed/simple; bh=3nD/UTAL1znSLViDwmfn6Bg2ylrr5PQXUlfBE86Dmzo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=h9fl36esS6Bt2EtFD3U+BIq0nKJ/h/FpAwdyjmol2Y0dbFbcNxTvDW7bcGInjBlbKM+49BZvMaj560ONw2XB/dswyGVP9tLnRd/eL4wpUhvOcuHM+3xlQEBl5/rXklWI3UC4erbQclAZsDvLi+L1dLip9lQ+6YxpMTyyXuGUBok= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=BMqOw9I2; arc=fail smtp.client-ip=40.107.237.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="BMqOw9I2" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=AYfrv71grnu7v72Oh1TFpXiSec8AeAPHxuLEJI4yu/4HQrzBI2l/ch/d1PhLhLBVzD2PMcXLCOMcw6K9xB6vbhAUqpiS4WrgN9YCwK5l01Um/dTfRxxHv5WQMaVWk8RRwbNlOK5e9NHlovhWVnsZJPbTxmtYVFLXOAnKxQ2h1k164ho9fB2Ujls8S4hn67lkinsPo6zCyIwDyCBB6IAgRIV/ddKyqEJyFnegLq5Y8po3t1DyZpqCOHrjmkkcDb4zvHfdwqIdVGZCQDMHifFGWjYrKsMsYLDiT2e5DlYewuVyco3IZD9Ozdk8nf0RMcWA1uaRjP0Myet5W7DqGx+XFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=oj51Oi8DLTdBft+RqQztAGagbVtX2VAFkhKFTLZFBog=; b=fsyyl11fB456nvsC4M5brGHLj0ELbeynJgep6uh1ku/2OaYNf8WMFz44gV05eO88EppWEQiGUxvmrwlMKwESTZPVO3dR1x3g8dozyq6KCs8gKoQKiCMasul5TW5cGGitA8HoosRst2XzNkkivuR81JTr8Cg/Z7g7yyfYrpJ/N411oOA7sw4dYXH74RaYP1cuvxtnN0ggewVuZjEj3Z29o46sD/Vv6jiPNyZmUV0nuIYBZuIeo9+TDr4Q9u395YYGOgbLTbO0Cy5mfxerzZVL/DKhWiMRbNHx5vtPuXevk+Dtk0rEcWvgEA/oUNMUqzrk5pQdbD3xERlYyjHh6hcAPw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oj51Oi8DLTdBft+RqQztAGagbVtX2VAFkhKFTLZFBog=; b=BMqOw9I2WhLX3c9DJ3PQbu+z+qTW/2Wt0METN0CkKmA1TRXSchLmifeLuPD0ET7uYR4Ap3OXY1kIgVkNfy6ZbbAIALdgoiihGp18CcOdWDEHOANbKn2RQ1vfgz0KEp3e9EWzPtXEbkHE9hi4JBqBPmetGsXYjQ60N3OfOP0ZZAg= Received: from SA9P221CA0003.NAMP221.PROD.OUTLOOK.COM (2603:10b6:806:25::8) by BN7PPFA8145BD40.namprd12.prod.outlook.com (2603:10b6:40f:fc02::6de) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9094.22; Fri, 12 Sep 2025 14:45:43 +0000 Received: from SN1PEPF00026367.namprd02.prod.outlook.com (2603:10b6:806:25:cafe::6d) by SA9P221CA0003.outlook.office365.com (2603:10b6:806:25::8) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9115.18 via Frontend Transport; Fri, 12 Sep 2025 14:45:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by SN1PEPF00026367.mail.protection.outlook.com (10.167.241.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9115.13 via Frontend Transport; Fri, 12 Sep 2025 14:45:42 +0000 Received: from rric.localdomain (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Fri, 12 Sep 2025 07:45:39 -0700 From: Robert Richter To: Alison Schofield , Vishal Verma , Ira Weiny , Dan Williams , Jonathan Cameron , Dave Jiang , Davidlohr Bueso CC: , , Gregory Price , "Fabio M. De Francesco" , Terry Bowman , Joshua Hahn , Robert Richter Subject: [PATCH v3 02/11] cxl/region: Store HPA range in struct cxl_region Date: Fri, 12 Sep 2025 16:45:04 +0200 Message-ID: <20250912144514.526441-3-rrichter@amd.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250912144514.526441-1-rrichter@amd.com> References: <20250912144514.526441-1-rrichter@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF00026367:EE_|BN7PPFA8145BD40:EE_ X-MS-Office365-Filtering-Correlation-Id: 4420b0e1-d44c-45fc-b2e9-08ddf20b0cd4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|376014|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?niNinPH620fkgWLTr9R7mZBitsCekBhobwLuMnrP/55pMoMd+XTpGSeIgNxR?= =?us-ascii?Q?9Up4HDHcsqGPxtFnL0OFZBYKsrk3x1wQfthkOZ0GEQ2jI1rxK+JeJeMAfnai?= =?us-ascii?Q?JpL3N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ENHFtr0tfjz?= =?us-ascii?Q?OLCqN0FQNHdCc7eiT4I+f09EmP5JpBCikIAwXdwVXR/bNZ/lIYAxAKEObsDE?= =?us-ascii?Q?I5T0NtZTq3m9u1YtHeNkO+ByAnrU3BMQjHYTGWvAMhacjsQnZ0YvJ8ZW2yom?= =?us-ascii?Q?D1BxC1Z7Yxcvwj9M79AB8Lr1aQojSTe4mXF96Mi2QrjP4jCbVoX1gfu0K1n3?= =?us-ascii?Q?iTHFuoHHC/g+sf9tqeoXVZm3HOyFfYaSKI7f7BKug13YkNa7zzTYxgpSz8Tp?= =?us-ascii?Q?qZrA6ts48Ru0ThXLLbDUqK0sDHQZbBf6jyZ4osOHKRAXDgUrtCrmspy3NR3U?= =?us-ascii?Q?wJf1oFIm3yOp3CZh1nn3PyKEdMX3i0txEWNCr7zNkkzJG7E2oCiM1/qVjlKp?= =?us-ascii?Q?3egbrEF2iPpoEkaGiMJn89jyAeQhyTyao+iAvcEhndvg6CmmOkfL7hmj9tf8?= =?us-ascii?Q?F/2pV8jmLlM9WF/4mNsAJVfVOL5V0FrWW1AsBGNTge4aYccWCkEfZ5PfXGhm?= =?us-ascii?Q?whXDnIs4W1i4SJAG/AIt1JYNIN/ZlviD6CeF?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(7416014)(376014)(82310400026)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Sep 2025 14:45:42.9655 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4420b0e1-d44c-45fc-b2e9-08ddf20b0cd4 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF00026367.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PPFA8145BD40 Content-Type: text/plain; charset="utf-8" Each region has a known host physical address (HPA) range it is assigned to. Endpoint decoders assigned to a region share the same HPA range. The region's address range is the system's physical address (SPA) range. Endpoint decoders in systems that need address translation use HPAs which are not SPAs. To make the SPA range accessible to the endpoint decoders, store and track the region's SPA range in struct cxl_region. Introduce the @hpa_range member to the struct. Now, the SPA range of an endpoint decoder can be determined based on its assigned region. Patch is a prerequisite to implement address translation which uses struct cxl_region to store all relevant region and interleaving parameters. Signed-off-by: Robert Richter Reviewed-by: Dave Jiang Reviewed-by: Gregory Price Reviewed-by: Jonathan Cameron --- drivers/cxl/core/region.c | 17 +++++++++++++++++ drivers/cxl/cxl.h | 2 ++ 2 files changed, 19 insertions(+) diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c index 2c37c060d983..777d04870180 100644 --- a/drivers/cxl/core/region.c +++ b/drivers/cxl/core/region.c @@ -664,6 +664,11 @@ static int alloc_hpa(struct cxl_region *cxlr, resource= _size_t size) return PTR_ERR(res); } =20 + cxlr->hpa_range =3D (struct range) { + .start =3D res->start, + .end =3D res->end, + }; + p->res =3D res; p->state =3D CXL_CONFIG_INTERLEAVE_ACTIVE; =20 @@ -700,8 +705,14 @@ static int free_hpa(struct cxl_region *cxlr) if (p->state >=3D CXL_CONFIG_ACTIVE) return -EBUSY; =20 + cxlr->hpa_range =3D (struct range) { + .start =3D 0, + .end =3D -1, + }; + cxl_region_iomem_release(cxlr); p->state =3D CXL_CONFIG_IDLE; + return 0; } =20 @@ -2400,6 +2411,11 @@ static void unregister_region(void *_cxlr) for (i =3D 0; i < p->interleave_ways; i++) detach_target(cxlr, i); =20 + cxlr->hpa_range =3D (struct range) { + .start =3D 0, + .end =3D -1, + }; + cxl_region_iomem_release(cxlr); put_device(&cxlr->dev); } @@ -3458,6 +3474,7 @@ static int __construct_region(struct cxl_region *cxlr, } =20 set_bit(CXL_REGION_F_AUTO, &cxlr->flags); + cxlr->hpa_range =3D *hpa; =20 res =3D kmalloc(sizeof(*res), GFP_KERNEL); if (!res) diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h index 350ccd6949b3..f182982f1c14 100644 --- a/drivers/cxl/cxl.h +++ b/drivers/cxl/cxl.h @@ -518,6 +518,7 @@ enum cxl_partition_mode { * @dev: This region's device * @id: This region's id. Id is globally unique across all regions * @cxlrd: Region's root decoder + * @hpa_range: Address range occupied by the region * @mode: Operational mode of the mapped capacity * @type: Endpoint decoder target type * @cxl_nvb: nvdimm bridge for coordinating @cxlr_pmem setup / shutdown @@ -532,6 +533,7 @@ struct cxl_region { struct device dev; int id; struct cxl_root_decoder *cxlrd; + struct range hpa_range; enum cxl_partition_mode mode; enum cxl_decoder_type type; struct cxl_nvdimm_bridge *cxl_nvb; --=20 2.39.5