From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.remote-ip=198.175.65.12 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=fail; t=1796405800; b=1YMsD45oLC4AA6fWLb+wPGp7GHMsw51LhRZx/zluSlOz3tsGlx5vy568En/SWhV/JS6E rSrfqOzq/U9ZkbpH87gbQwqwjmYIdYfs2wqYtxcSDW2PKl/E/6AP+3IReS6z/UhVzNVRX rE0nvPejqgnlwPKL1OHUlpCc+qDB5msPUGR5+b18Ax7SJ90W9kijtRKZdQQfVuCU1cM5c /MIZYxqtmZVTUmNGbleLLbTX0/IEX8q9FeCakHLkcie3fjo/jgAF6gXb3j6RA9UrO6osB yIAMxWyEPR5tYYRgYaRQVSvCR8a0YCtV/cXx3UUFouqJy5TucDxgZrDeZTv29G0FyXA== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796405800; 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=tqJoo6mMLyNj1Wx0BzjcZMHTzs3PQsW67O4KIyvcGfw=; b=4Fb98CWOmWjQti8M0OP5FMWx9cnkDoKeUyHx7Cjl92ePX0xu5U5RxxOvx/yVGnCoYrxr vU0UPO5SXQM7m4kq6GOO37d7tXPNXno8Uk68yUdpw/aq8H3xN3nLqzoJnfArtGBhtmE3E 5xso7zqO01DxdczR2ikw22QYK6jxD+6AOVUIeXO8YbqxPHUa+8vO6XJx4MKlnUUOIEFjC IO+OznTMhny2ufS3YGxiysENpKhiGmwEIMZoaxa2DayO28f5+yUGqtOBcNoUoFYO3SIKw cAaOumCbnP1XVXAcuXMetIw3VqQzWtfe9XDYumUzAzv0ktkFsf9YOX0u62p5FoT2+Yg== 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="G//VpUWP"; arc=fail smtp.remote-ip=198.175.65.12 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (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 292E3606A322 for ; Fri, 4 Dec 2026 17:36:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 292E3606A322 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) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=G//VpUWP DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796405800; x=1827941800; h=date:from:to:cc:subject:message-id:references: content-transfer-encoding:in-reply-to:mime-version; bh=tqJoo6mMLyNj1Wx0BzjcZMHTzs3PQsW67O4KIyvcGfw=; b=G//VpUWPgbMusO4tBna30bXWa54+n+1jDnaq6dMD00EBAC2z32C/HNvG /Tflz2VObDdFVQXg8VGbWck6vQkc6hajOXzcCpTOIl5ic69cf+D9hEbTs SLE2bxC89ixh4TTkUqPLqyUljWHaW37PHhgHepAgCNlxUU/Ef1E/ur/44 +ixcCHRKriyb3zu5jnmxG21bNrrEv+SocXZ9QmbdM8JZOSC++CL5QL+I/ 4iAIOJSCGwIHoXY68xClfHwydIpFFYwAC4ALcrlDXEhWf0bFaahVhACcX gvjSo22kswuHDqOzf0TgiI9ozvigiAzGJ+9GJgE9WHDafNuYyrzCxEfBS g==; X-CSE-ConnectionGUID: xTGxyo6RQh+iqni9GbIsgQ== X-CSE-MsgGUID: CHr+bBRgSsuwyr9xwm9tfQ== X-IronPort-AV: E=McAfee;i="6800,10657,11986"; a="5316848" X-IronPort-AV: E=Sophos;i="6.29,78,1794902400"; d="scan'208";a="5316848" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2026 09:36:40 -0800 X-CSE-ConnectionGUID: wkThbjLRQ++SjSEDezkqSQ== X-CSE-MsgGUID: h/7v6EUgRdur35rZACh7LA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.29,78,1794902400"; d="scan'208";a="5604375" Received: from fmsmsx901.amr.corp.intel.com ([10.18.126.90]) by orviesa010.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2026 09:36:39 -0800 Received: from FMSMSX903.amr.corp.intel.com (10.18.126.92) by fmsmsx901.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Fri, 4 Dec 2026 09:36:38 -0800 Received: from fmsedg901.ED.cps.intel.com (10.1.192.143) 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; Fri, 4 Dec 2026 09:36:38 -0800 Received: from BYAPR05CU005.outbound.protection.outlook.com (52.101.85.58) by edgegateway.intel.com (192.55.55.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Fri, 4 Dec 2026 09:36:38 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Jlfppmq80aOwcyhWFwcmfiDvaCfnyT3/bf4qKoZO+f+Tlsy6FK8hxlwuhvZ/xnjEnOcBgFev8veh8t2iAViWugLLwc8kdXPUBGmHpoAC2QcHa69XDC0dMIXriK27WOHvt4YmPgazhLlIeCJtF4qwEMMkglsE3P8s4xRpP2jrJIpv8LWuIaTQzgS2MNQEQtCenljiOi1LfyXbvR/L93DslKyD4GQQTOOjaR+GqP9K3Os+5pYS2GflqcsXtrT6AjEWsGWZRSgXuyMNp0cRjj5n6euEJPO8kvsUKGuYABn0UMcfxCW7vR/Uin6qd6YRKUC/6bkxD9B28xrtrieo06qQtw== 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=2jXD7mGWOMVaF276U4B2fcWp5jGalesY9oNPd1HSQuY=; b=KRg0Qbus8IpY9OsZOczios5B/ea3ZxzS9A/n6cKv24M06oxcAUjJHrc1a7KcdNcUayfB9rRrgEAOTJuRe8nEZMXWU1hddn84SCzTAzj6MfQdyPPJHGg20Q2TM00Qqr36AdcugstGJl6sddcdX4ZAFY/OHNggsi0fD5F4Ubf5OMLGnKAFXX2/4YmWEkJG1y0vZFs1eG2B2soQ063Qw6rxwvJ/IE7+hcvw11d0rL3JNbaBGt4eVoX1VgjgIWphNNZGogKh/X5SUHCpZRElRn2KpXksmq+Vuz2Wk7xQgkVRg2Cp97NOuMJuyaVid0U4sTSsQ8VSbb3AWfFbJHIsJYatGg== 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 CO1PR11MB4787.namprd11.prod.outlook.com (2603:10b6:303:95::23) by PH7PR11MB8525.namprd11.prod.outlook.com (2603:10b6:510:304::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.10; Fri, 4 Dec 2026 17:36:35 +0000 Received: from CO1PR11MB4787.namprd11.prod.outlook.com ([fe80::e7eb:a872:53d1:21fd]) by CO1PR11MB4787.namprd11.prod.outlook.com ([fe80::e7eb:a872:53d1:21fd%4]) with mapi id 15.21.0688.011; Fri, 4 Dec 2026 17:36:35 +0000 Date: Fri, 4 Dec 2026 09:36:31 -0800 From: Matthew Brost To: Natalie Vock CC: , , Carlos Santa , Ryan Neph , "Arun Pravin" , Matthew Auld , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , , Thomas =?iso-8859-1?Q?Hellstr=F6m?= , "Niranjana Vishwanathapura" Subject: Re: [PATCH v6 02/35] drm/ttm/pool: Add ttm_pool_page_order_nodma() helper Message-ID: References: <20261203202352.4153159-1-matthew.brost@intel.com> <20261203202352.4153159-3-matthew.brost@intel.com> Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-ClientProxiedBy: PH8P221CA0011.NAMP221.PROD.OUTLOOK.COM (2603:10b6:510:2d8::26) To CO1PR11MB4787.namprd11.prod.outlook.com (2603:10b6:303:95::23) 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: CO1PR11MB4787:EE_|PH7PR11MB8525:EE_ X-MS-Office365-Filtering-Correlation-Id: dede7848-d30f-4bcf-c3be-08df522d248d 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|1800799024|23010399003|376014|7416014|22082099003|18002099003|56012099006|261026121527099003|261028144727099003|261102123227099003|261026140227099003|261022075727099003|261022105027099003|261021121427099003|261021123027099003|261102130727099003|10067099003|261009221227099003|261009220027099003|261009221727099003|261009223327099003|261009223027099003|11063799006|4143699003|5023799004|6133799003; X-Microsoft-Antispam-Message-Info: nk+yJtooWDEdiRwx22AetIhRiZL/Y0DqfK4jZbp8hWDfE5l5X3TQKzyR94z4xtJPFL1FGYI+SQhKl8ZzpPCeKKZH0f/7AEUVFlun6wfmZezOFapynjiiyPeLghoLW5W5EoqWhWeyKheLdMjSDwNnpJQx56sRD/6wUV6g4OxCh6WUweCc2zi/7QamJrqYstofbm4RS8Qdy+IFKlYfpTsUrVloyeNroJ6j8gGVspHghGNeYd+kHrs+fWYX0EEkeJw0vSdGba8ZbOLHnXx1/JHO1fzdJrCYOodH1vl6DDVMx6hWhyqBDHvGl27UMg25xP5E1VWag1qOYUEG3tYR2BPzMY2uDE+aDOHvrpZWLRrWWjr3vw54MpzQZ3WEVWdCbgM0+ed2F4eDIFPh32ldVI2XZQTh7XptgTMoTq1yUkZ9bT0zGYgWI3/imx/n1AvhNUS0p7iCG4b9DNUXQak4a01Rc4GtLubL5nQE2WPg9xiCTYIK5E56g/l4SQ1wargRAPHasLZUBrh48j1LNROOd0HynOaTYjCKJqQxmGTqwtfs+Fk2/bPLGZo+2j84zp6N4W0jT0fhnOPP3fBdsFn5wOfuNIlUJGlEeBjhJxcSy/vCiw2zy/AzGxU2LRERKveoUFSdAQnLDsMmcQYu3huISQARmCd0O4lgyZsvhW9E9PgHxZ8= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CO1PR11MB4787.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(23010399003)(376014)(7416014)(22082099003)(18002099003)(56012099006)(261026121527099003)(261028144727099003)(261102123227099003)(261026140227099003)(261022075727099003)(261022105027099003)(261021121427099003)(261021123027099003)(261102130727099003)(10067099003)(261009221227099003)(261009220027099003)(261009221727099003)(261009223327099003)(261009223027099003)(11063799006)(4143699003)(5023799004)(6133799003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?iso-8859-1?Q?fLc6Fm2ub4vD378edDah3DhzA535GJZsxbI4b/Rq1bc4sWMzkHUL4/XAXn?= =?iso-8859-1?Q?1cvWhHneVajztGitjA/1T1NjcEt8PaezignMpnzfu/rtaQFhGXu4tJLgre?= =?iso-8859-1?Q?ncJybVIG516s5bKd3rDF3mGNvnnEnEunmUpgnqZNN+OFjTwNFil8dg6uI/?= =?iso-8859-1?Q?CfvSkBXxDnmLkwV1WJUOgfLcPr4sT5dVsQt5iDfc+ygu7MOmcuEdG83ty7?= =?iso-8859-1?Q?abrG9bP2/+EEdDlqJbmVF8JAASPVNVWQKw1ZgXifWdZcnV8iI1/Z6Ol+Jw?= =?iso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M9cLw54/jlbDGnbxFmur148w0x5BDBFulSYrnS1JrfUdMWefXR9l6zfMpP0xI6udvMmCYLUjqUPjhwGDs1L+6aVGn6Dva3WfqPLIZPS6cfop4wnA== X-MS-Exchange-CrossTenant-Network-Message-Id: dede7848-d30f-4bcf-c3be-08df522d248d X-MS-Exchange-CrossTenant-AuthSource: CO1PR11MB4787.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2026 17:36:35.1903 (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: qUm2LPsaRjXRF+AvkF5uHbk560UQOYG33O0htDVGglAq3qh2vjIR/ws77iwiM4MPoBFIcvWqhEnINpnnJKDuCA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB8525 X-OriginatorOrg: intel.com On Fri, Dec 04, 2026 at 02:12:26PM +0100, Natalie Vock wrote: > On Thursday, 3 December 2026 21:23 Matthew Brost wrote: > > TTM records the allocation order of a multi-order page in page->private at > > allocation time. For pools that do not use dma_alloc the order is stored > > directly, while dma_alloc pools store a struct ttm_pool_dma pointer there > > instead. Drivers that do their own DMA mapping (e.g. Xe) need the per-page > > order to walk a populated ttm_tt one chunk at a time, but cannot rely on > > folio_order(): TTM allocates high-order pages with alloc_pages_node() > > without __GFP_COMP, so they are not compound and folio_order() always > > returns 0. > > I'm not completely sure why this is needed? > Is the problem that you don't know the relevant ttm_pool at the > callsite? AFAICT Xe never sets TTM_ALLOCATION_POOL_USE_DMA_ALLOC, so > why isn't ttm_pool_page_order enough? > Xe doesn't set TTM_ALLOCATION_POOL_USE_DMA_ALLOC and doesn't (easily) have access to the TTM pool at the call site, so add a new helper to derive the order from a page. Eventually, we should switch to using compound pages (i.e., folios), and this entire helper can go away. I floated a patch for that, but Christian said there might be historical reasons why this didn't work with KVM, if I recall correctly. Neither of us had time to investigate whether that's true, but for what it's worth, compound pages worked just fine in TTM/Xe. > Besides, why can't TTM know about the IOVA-based DMA mapping? > Managing DMA mappings for pool pages sounds like a TTM responsibility, > is there any reason why the logic needs to be hidden from it inside Xe? > Ok, this is a bit of a can of worms. Let me give you some background. When Xe had the PoC from Faith, by the time she handed it over to me and a few others, the DMA mapping was already implemented inside Xe. I was blissfully unaware that TTM could perform the DMA mapping itself. I only realized that TTM had DMA-mapping support once I started working on this series. I also noticed that TTM performs DMA mapping in about the worst possible way for performance: it calls dma_map_page() on each individual page, and each call issues an IOMMU sync. Compare that to SG-based DMA mapping or IOVA-based DMA mapping, where all IOMMU page tables are programmed first and then a single IOMMU sync is issued. iirc when I switched GPUSVM to use dma_iova_* vs. dma_map_page for 512 4k pages, I got something like a 100x speedup. I'm not going to switch Xe over to TTM-based DMA mapping and knowingly regress performance. Maybe we can look at making TTM's DMA-mapping implementation less terrible in a follow-up, but that would require reworking multiple drivers and is, in my opinion, out of scope for this series. Matt > Thanks, > Natalie > > > > > Expose ttm_pool_page_order_nodma(), a thin wrapper that returns the order > > recorded in page->private. It is only valid for pages from a pool that does > > not use dma_alloc; whether a TTM device uses dma_alloc is fixed at ttm > > device init time, so callers know from their device configuration that this > > helper applies. Use it from the existing internal ttm_pool_page_order() to > > keep a single source of truth. > > > > v4: > > - const struct page (Niranjana) > > > > 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 > > Signed-off-by: Matthew Brost > > Reviewed-by: Matthew Auld > > Reviewed-by: Niranjana Vishwanathapura > > --- > > drivers/gpu/drm/ttm/ttm_pool.c | 25 ++++++++++++++++++++++++- > > include/drm/ttm/ttm_pool.h | 2 ++ > > 2 files changed, 26 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/gpu/drm/ttm/ttm_pool.c b/drivers/gpu/drm/ttm/ttm_pool.c > > index 16fd125d7375..c6fbcdba9bdb 100644 > > --- a/drivers/gpu/drm/ttm/ttm_pool.c > > +++ b/drivers/gpu/drm/ttm/ttm_pool.c > > @@ -477,6 +477,29 @@ static unsigned int ttm_pool_shrink(int nid, unsigned long num_to_free) > > return num_pages; > > } > > > > +/** > > + * ttm_pool_page_order_nodma() - Allocation order of a non-dma_alloc TTM page > > + * @p: The page to query. > > + * > > + * Return the allocation order that the TTM pool allocator recorded in > > + * @p->private at allocation time. This only works for pages that were > > + * allocated from a pool which does *not* use dma_alloc (i.e. pages backed by > > + * alloc_pages_node()), where TTM stores the order directly in page->private. > > + * > > + * For dma_alloc pools, page->private instead holds a struct ttm_pool_dma > > + * pointer and this helper must not be used. Whether a TTM device uses > > + * dma_alloc is fixed at ttm device init time, so callers are expected to know > > + * from their TTM device configuration that their pages are not dma_alloc > > + * backed before using this helper. > > + * > > + * Return: The allocation order of the page. > > + */ > > +unsigned int ttm_pool_page_order_nodma(const struct page *p) > > +{ > > + return p->private; > > +} > > +EXPORT_SYMBOL(ttm_pool_page_order_nodma); > > + > > /* Return the allocation order based for a page */ > > static unsigned int ttm_pool_page_order(struct ttm_pool *pool, struct page *p) > > { > > @@ -486,7 +509,7 @@ static unsigned int ttm_pool_page_order(struct ttm_pool *pool, struct page *p) > > return dma->vaddr & ~PAGE_MASK; > > } > > > > - return p->private; > > + return ttm_pool_page_order_nodma(p); > > } > > > > /* > > diff --git a/include/drm/ttm/ttm_pool.h b/include/drm/ttm/ttm_pool.h > > index bb6347e5b297..429f4f987a19 100644 > > --- a/include/drm/ttm/ttm_pool.h > > +++ b/include/drm/ttm/ttm_pool.h > > @@ -94,6 +94,8 @@ long ttm_pool_backup(struct ttm_pool *pool, struct ttm_tt *ttm, > > int ttm_pool_restore_and_alloc(struct ttm_pool *pool, struct ttm_tt *tt, > > const struct ttm_operation_ctx *ctx); > > > > +unsigned int ttm_pool_page_order_nodma(const struct page *p); > > + > > int ttm_pool_mgr_init(void); > > void ttm_pool_mgr_fini(void); > > > > > > > >