From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.remote-ip=198.175.65.21 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=fail; t=1796196912; b=ZXR5erXEqeT8CXOEbXYVaepeDCk6MPJuUuTbMquPv4AgGp/WGCKs1z5NuLU0zpnLRpEi TDdVonio1844FaucCN39vJHIuUTcsuxDpvMqMH50XoCBykdL20teuPBzjvS3RfwYjIIZa EeumsGf6qUlA+Ipf8yDcl+cFkOTLYXlamULNS6N1a0Y6W0H0vKzChYxD0CSVlW51wdUrx JXwsxFWcVMA6dYOoxfr2fRSFGsR8bY9/zP+h8BmojURsUuIN4m4IMC7nIbBTBTWgMUQJn SUTwFAtRO/UvGdJGUv5XnxM5OWbtVfsZ+PN2Es9VMwTYDX7lJwc00Y+7OYut/U2l/7g== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796196912; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:Received:Received: Received:Received:Received:Date:From:To:CC:Subject:Message-ID: References:Content-Type:Content-Disposition:Content-Transfer-Encoding: In-Reply-To:X-ClientProxiedBy:MIME-Version:X-MS-PublicTrafficType: X-MS-TrafficTypeDiagnostic:X-MS-Office365-Filtering-Correlation-Id: X-LD-Processed:X-MS-Exchange-SenderADCheck: X-MS-Exchange-AntiSpam-Relay:X-Microsoft-Antispam: X-Microsoft-Antispam-Message-Info:X-Forefront-Antispam-Report: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0:X-Exchange-RoutingPolicyChecked: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-CrossTenant-Id:X-MS-Exchange-CrossTenant-MailboxType: X-MS-Exchange-CrossTenant-UserPrincipalName: X-MS-Exchange-Transport-CrossTenantHeadersStamped:X-OriginatorOrg; bh=FEg6gMLO+Llvt2u67wQ3Vj07JtPe0iZ8eOsbmM+tiXE=; b=SMaPWsMboqK8RVfeJoi+T5QVgfbrVa4veNfuK0HE+rBdbG/0ZGfdHE8popwqV3Ry3c2v sGUOeM5ewBLoEeD1gIQG9iuBpIs+1VNtegaWtnGLiB1rPgJaCUZzgXPka8+/nk/w4VYlN iDynH+BgbM4nJvIam/b/7vNDVdbaPsmrInkMqt7ihRpPOYtc9g4dRjr6H1wsKFdZujCLC tt1JxzwtCRrZzMsE84dIWBXyfd6JyrndM2tAji5BET2U4n4I/5bdkBy1yZMnea3clL5KL FMFFNJyayYN5wFS2t/6lwpgZaVTJT3Luru5kHcHtm7/fr2cezmfbGQ0qVAMIEWZxzjA== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=Z8xW7oxz; arc=fail smtp.remote-ip=198.175.65.21 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A2065606A31A for ; Wed, 2 Dec 2026 07:35:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A2065606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=Z8xW7oxz DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796196911; x=1827732911; h=date:from:to:cc:subject:message-id:references: content-transfer-encoding:in-reply-to:mime-version; bh=FEg6gMLO+Llvt2u67wQ3Vj07JtPe0iZ8eOsbmM+tiXE=; b=Z8xW7oxzOg9WpRhY/l2eBpXnqxqHEakbzGhFQvAS7PeZqtnHfubpCYCH 9OM9AVPv3tgXl0U2l2mG2Kj5oZ8WmV1eoxiAlRABVZiYhcIZwY2vEhB7g 7VoKfP2CJw0iCSRFdz1FbVs5XCsPRD1Fg+HQP0/Y1eBdjFfyN6e2dZaej 4UGFUY0AK0fMiQAkbXpenKqu8RjC4x0swHC01/ZW73rndxGLbHtGMeIyD PtMJjhV4htFfQE1P/XCzhHpH6puvzMsxsP5JhQsdk+BvOiW4+JwdUbD6f ahzoDKiCRbLp6HWI68ZDO90a1xwyq3UmS44WJQDWqnMtKl4GMzviyUYAz w==; X-CSE-ConnectionGUID: 8J5J1b3kROOSkPYSsCxD3Q== X-CSE-MsgGUID: xrcBjgRBRTyMT+azsK7kQA== X-IronPort-AV: E=McAfee;i="6800,10657,11983"; a="5207414" X-IronPort-AV: E=Sophos;i="6.27,246,1787036400"; d="scan'208";a="5207414" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2026 23:35:10 -0800 X-CSE-ConnectionGUID: ZPOh5JGVT5emm+Yh1FzPgQ== X-CSE-MsgGUID: HtNvr1nIRwGT23dX9Qd+xQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,246,1787036400"; d="scan'208";a="13734249" Received: from fmsmsx902.amr.corp.intel.com ([10.18.126.91]) by fmviesa007.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2026 23:35:11 -0800 Received: from FMSMSX903.amr.corp.intel.com (10.18.126.92) by fmsmsx902.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Tue, 1 Dec 2026 23:35:10 -0800 Received: from fmsedg902.ED.cps.intel.com (10.1.192.144) by FMSMSX903.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57 via Frontend Transport; Tue, 1 Dec 2026 23:35:10 -0800 Received: from MW6PR02CU001.outbound.protection.outlook.com (52.101.48.3) by edgegateway.intel.com (192.55.55.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Tue, 1 Dec 2026 23:35:10 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Jor64A7u1AStHiVeQB8VFDUiY3wkU5l8J5w7gXmBx287fgvJbaus8z2mmd9hAy6xA8MoWB3nFSXHGsH1dbzdYO8DyiCFb+W7/4jyu9YhhJHkPASnGsDIWLDxxJIT22z+cuXB7PLQBoKhPivT64Hfwrxh/H5Oq4mFA3jqEzqrI9WvWfI4Rs3omAxaV44QRVGENjJWw/UgGgtv+sBjzvmj4sWYBcOOanca5wFDVYcKxt4gs351NVVKlA0KKfRKuPtfp7O0yV8FtZeJFDVKW6DyrWkVrynKBVsP99/RJEkl0Wf2ZVjQeeax2bgrXgRU1ML2TfApmUlJAT6S07dCMKgRzQ== 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=8EBp7T/28Q7k3/PcbGMzp6MUdxB87ZZquv4wijS/GQs=; b=Mdzqf4iu+x99UsL+InKuTE60qEak6L4bd6M1WzVBU0T52OlSZCz7Kzi1RntZLrrTkjdPTYITSpCPJCkfmZ0wKK+sBjvB/TeYJ4MPwlOwBSWhZgOP8Q5kRH6ERlZOl33TZfxmFOjpodRuCPnv00Jh9NgKNtNXkbLbhohXEt4I4HQOES9gwZJbBuk0d60OCvXkdIkA8GDaAav9XTeKpjTaOAzEpxwdxAlyzVMOMBw9RRhSPPNI2LoGEP3rloOyqUNNtE/CHTWuEGk21kW1I0csjD5OUjmUdKflHV+orE1/917HiKZ1c2W6iq0C8C0KpwNgidRYqeDOVaMvrLjFmVdqWg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from MW3PR11MB4684.namprd11.prod.outlook.com (2603:10b6:303:5d::14) by DS7PR11MB6198.namprd11.prod.outlook.com (2603:10b6:8:9a::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.662.9; Wed, 2 Dec 2026 07:35:06 +0000 Received: from MW3PR11MB4684.namprd11.prod.outlook.com ([fe80::2f5a:96ce:f7e4:c315]) by MW3PR11MB4684.namprd11.prod.outlook.com ([fe80::2f5a:96ce:f7e4:c315%7]) with mapi id 15.21.0688.009; Wed, 2 Dec 2026 07:35:06 +0000 Date: Tue, 1 Dec 2026 23:35:03 -0800 From: Niranjana Vishwanathapura To: Matthew Brost CC: , , Carlos Santa , Ryan Neph , Natalie Vock , Arun Pravin , Matthew Auld , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , , Thomas =?iso-8859-1?Q?Hellstr=F6m?= Subject: Re: [PATCH v4 25/33] drm/xe: Add IOVA-based xe_res_cursor variant Message-ID: References: <20261201234915.3305331-1-matthew.brost@intel.com> <20261201234915.3305331-26-matthew.brost@intel.com> Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20261201234915.3305331-26-matthew.brost@intel.com> X-ClientProxiedBy: BYAPR21CA0030.namprd21.prod.outlook.com (2603:10b6:a03:114::40) To MW3PR11MB4684.namprd11.prod.outlook.com (2603:10b6:303:5d::14) X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW3PR11MB4684:EE_|DS7PR11MB6198:EE_ X-MS-Office365-Filtering-Correlation-Id: 1c43a76a-7fd2-4d6e-400a-08df5046c8f2 X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|23010399003|7416014|376014|1800799024|56012099006|10067099003|261022105027099003|261026140227099003|261021123027099003|261028144727099003|261022075727099003|261021121427099003|261102123227099003|261009223027099003|18002099003|22082099003|4143699003|11063799006; X-Microsoft-Antispam-Message-Info: 8k4GTdj0U4z8thc0eZv/CFqaAR9F+nLpew9wK+QvXzWEKt6LXgUJJSwYXw5HZw7tfZgkKspHDIq3ZICLSkFT0+urTzj+FRHqYN1Cttz58g+u106OdZiULUd5Ft0viCBFW6cXD45hFyWYUJ3rYH5jmx41FuisFOyI2j9gHF8Fy8NGUG3puN7l6vxrfQj/mHjfEYVj0SgBJtsS6oUYY/RWSngoCdlL3Q0sdWBHslUDTFWYkR/WJD3Bt01Kxd1IZKFxW3Rk66vLrgsOTlKthUCsYJzC4SH+Ct/1i7U/blGJKI7k4TKGzI9X+XzRgcWxkCd70cRIiHCULnWFWa0eQnS7sIpmabuPMgoqCQq1toJczDJl4hRGjrlor1HtszeePCCUp0eo6J6rSFUAA7tYI+pD9ch7g+J4IgB+bxFFNC67waiL3QQ+4CrqZpfj4Xivgq7dsiSqwXz5+5fhGDjWn+hhR8w8rMciSPbAXg3GnMyj6fdQKwbndkiJsmxibNe58IbXnHonl71GYbAI5OuaHahvK25C1sypPZCQRh6vjvDreJpGKyVg+U6CqrLwdw29EVkfeDKsxfjJPUIh/ORWcWkp0AlHvyQ+DCi8oLi2jI6zjGzmz+JDtj9yJhZhuSxM6VnmBFDG2Kp8a9Dy9R/hEpMpvG8CkO6msqTLVwyNgnz/b1Y= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW3PR11MB4684.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(23010399003)(7416014)(376014)(1800799024)(56012099006)(10067099003)(261022105027099003)(261026140227099003)(261021123027099003)(261028144727099003)(261022075727099003)(261021121427099003)(261102123227099003)(261009223027099003)(18002099003)(22082099003)(4143699003)(11063799006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?iso-8859-1?Q?wkuQjVwMYXGFxwSEnv+Nr4Q8eBWpM6uj0AL3jeXSxv4amx2aVwoz5PYTzn?= =?iso-8859-1?Q?sxQoaOm9otvp/hlr8w3XAjIuh3Mtp5X8mqnGREblwbkSp6Xcu/zAcXVYG/?= =?iso-8859-1?Q?zQK4WBUUTWRksXENwe5iln0llo3iz2rbI3VyMo6MvB2hp3E3eLk1SrJLPs?= =?iso-8859-1?Q?zbKK2cL9mHoqZXiPob31EYGvrp1yMTezrRtL+HJfIIZ93O5GFJSKwN4NWH?= =?iso-8859-1?Q?cAiPzgNNt5VVLu9d0dlFysvCWCicZFXgJj0rSDHI4pLVH9B4MfBjthgiam?= =?iso-8859-1?Q?7Ii6xUgZMb/HhYW/oHrfd9HRNApX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s2yDC0D/bFI7fi9+eE/tyCnhfhspcK/RXLhg9cja4bYN2hgXCaj4IrzzIepJnzwQ== X-MS-Exchange-CrossTenant-Network-Message-Id: 1c43a76a-7fd2-4d6e-400a-08df5046c8f2 X-MS-Exchange-CrossTenant-AuthSource: MW3PR11MB4684.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Dec 2026 07:35:06.2124 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: d65GR1Peug362kT9pdyMEUb7zn1k426VWD1n4HaOcRNCUiXoN9ZAr2LYT5nGpOyLM8NbBSad02GvuTLz0Zsxdn7JnWHpsh6gKXfEvlnM9Xv5aea8hxasqrhXmkT3DDqs X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR11MB6198 X-OriginatorOrg: intel.com On Tue, Dec 01, 2026 at 03:49:07PM -0800, Matthew Brost wrote: >Introduce xe_res_first_iova() to walk a buffer that was DMA mapped using >the IOVA-based DMA API (dma_iova_try_alloc() and friends). Such a mapping >is described by a struct dma_iova_state and is a single contiguous IOVA >range, so the cursor walks it as one segment. > >Add an is_iova flag to struct xe_res_cursor to distinguish this case. >When set, xe_res_dma() returns the IOVA backing the current position >(state->addr + cursor offset), xe_res_next() advances within the single >contiguous segment, and xe_res_is_vram() returns false since IOVA >mappings never point to same-device VRAM. > >The flag is explicitly cleared in the existing xe_res_first(), >xe_res_first_sg() and xe_res_first_dma() initializers so stale stack >values cannot leak into the new path. > >Cc: Carlos Santa >Cc: Ryan Neph >Cc: Natalie Vock >Cc: Arun Pravin >Cc: Matthew Auld >Cc: Maarten Lankhorst >Cc: Maxime Ripard >Cc: Thomas Zimmermann >Cc: David Airlie >Cc: Simona Vetter >Cc: dri-devel@lists.freedesktop.org >Cc: linux-kernel@vger.kernel.org >Cc: Thomas Hellström >Assisted-by: LLM >Signed-off-by: Matthew Brost >Reviewed-by: Matthew Auld NIT..missing patch verion history, but LGTM. Reviewed-by: Niranjana Vishwanathapura >--- > drivers/gpu/drm/xe/xe_res_cursor.h | 52 +++++++++++++++++++++++++++++- > 1 file changed, 51 insertions(+), 1 deletion(-) > >diff --git a/drivers/gpu/drm/xe/xe_res_cursor.h b/drivers/gpu/drm/xe/xe_res_cursor.h >index c3a037e5f34e..b3ff92b4d837 100644 >--- a/drivers/gpu/drm/xe/xe_res_cursor.h >+++ b/drivers/gpu/drm/xe/xe_res_cursor.h >@@ -24,6 +24,7 @@ > #ifndef _XE_RES_CURSOR_H_ > #define _XE_RES_CURSOR_H_ > >+#include > #include > > #include >@@ -67,6 +68,12 @@ struct xe_res_cursor { > u64 dma_start; > /** @dma_seg_size: Size of the current DMA segment. */ > u64 dma_seg_size; >+ /** >+ * @is_iova: Whether the cursor walks a single contiguous IOVA >+ * mapping described by a struct dma_iova_state. When true, the >+ * DMA address is @dma_start + @start and never points to VRAM. >+ */ >+ bool is_iova; > }; > > static struct gpu_buddy *xe_res_get_buddy(struct ttm_resource *res) >@@ -93,6 +100,7 @@ static inline void xe_res_first(struct ttm_resource *res, > { > cur->sgl = NULL; > cur->dma_addr = NULL; >+ cur->is_iova = false; > if (!res) > goto fallback; > >@@ -224,6 +232,7 @@ static inline void xe_res_first_sg(const struct sg_table *sg, > cur->dma_addr = NULL; > cur->sgl = sg->sgl; > cur->mem_type = XE_PL_TT; >+ cur->is_iova = false; > __xe_res_sg_next(cur); > } > >@@ -256,6 +265,40 @@ static inline void xe_res_first_dma(const struct drm_pagemap_addr *dma_addr, > __xe_res_dma_next(cur); > cur->sgl = NULL; > cur->mem_type = XE_PL_TT; >+ cur->is_iova = false; >+} >+ >+/** >+ * xe_res_first_iova() - initialize a xe_res_cursor with a dma_iova_state >+ * >+ * @state: struct dma_iova_state describing a single contiguous IOVA mapping >+ * @start: Start of the range >+ * @size: Size of the range >+ * @cur: cursor object to initialize >+ * >+ * Start walking over the range of an allocation that was DMA mapped using the >+ * IOVA-based DMA API (see dma_iova_try_alloc()). Such a mapping is a single >+ * contiguous IOVA range, so the cursor walks it as one segment. Subsequent >+ * calls to xe_res_next() advance within that range and xe_res_dma() returns >+ * the IOVA backing the current position. xe_res_is_vram() always returns false >+ * for such a cursor. >+ */ >+static inline void xe_res_first_iova(struct dma_iova_state *state, >+ u64 start, u64 size, >+ struct xe_res_cursor *cur) >+{ >+ XE_WARN_ON(!state); >+ XE_WARN_ON(start + size > dma_iova_size(state)); >+ >+ cur->node = NULL; >+ cur->start = start; >+ cur->remaining = size; >+ cur->size = size; >+ cur->dma_addr = NULL; >+ cur->sgl = NULL; >+ cur->dma_start = state->addr; >+ cur->mem_type = XE_PL_TT; >+ cur->is_iova = true; > } > > /** >@@ -284,6 +327,10 @@ static inline void xe_res_next(struct xe_res_cursor *cur, u64 size) > return; > } > >+ /* IOVA cursors are a single segment, fully consumed by the above. */ >+ if (XE_WARN_ON(cur->is_iova)) >+ return; >+ > if (cur->dma_addr) { > cur->start += size; > __xe_res_dma_next(cur); >@@ -335,7 +382,7 @@ static inline void xe_res_next(struct xe_res_cursor *cur, u64 size) > */ > static inline u64 xe_res_dma(const struct xe_res_cursor *cur) > { >- if (cur->dma_addr) >+ if (cur->is_iova || cur->dma_addr) > return cur->dma_start + cur->start; > else if (cur->sgl) > return sg_dma_address(cur->sgl) + cur->start; >@@ -352,6 +399,9 @@ static inline u64 xe_res_dma(const struct xe_res_cursor *cur) > */ > static inline bool xe_res_is_vram(const struct xe_res_cursor *cur) > { >+ if (cur->is_iova) >+ return false; >+ > if (cur->dma_addr) > return cur->dma_addr->proto == XE_INTERCONNECT_VRAM; > >-- >2.34.1 >