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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 52448F33A65 for ; Thu, 5 Mar 2026 13:57:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EB48710EB99; Thu, 5 Mar 2026 13:57:24 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="JLVYRZco"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id 59FE910EB99 for ; Thu, 5 Mar 2026 13:57:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1772719043; x=1804255043; h=date:message-id:from:to:cc:subject:in-reply-to: references:mime-version; bh=egaP2p85VKEHkJbcHoJr/cbixQ37ctfmUdbIDNmN9ME=; b=JLVYRZcoR8LmF2s8jzGmbeB61k0OXxqCblfkcF6/G1KDaBAn8rHlGUeN C1iGxkACR/UP/C3EWQn8XAdCQWqZy1V9RaBH2KAPCfybJUNjQTBPIdlj5 5dDMuTWanf/ZZIWwGGIFAwH2lFksWYzISFQGT3r5Kr5FcvA1tIalrV88+ ql5wHr7vRH2aHFBVbWpnZvgjWWod1fDufru4743sMn9Vacv8h2vDZUiQo MlUaPMTglPHB6gbTSW3CKHg2HNiZOqELLt/27dUyGFPYWuRlXJBYi5nTF 2Ic9VyxPN3Qa7FDA3smke53SAZgTknSPgmHN6i4qDU/xDA2UojDHjzCH0 w==; X-CSE-ConnectionGUID: 98TZNBduT8mapYzFKk0c+Q== X-CSE-MsgGUID: 3NiELCWFTZ+r+Z95Zi4p2A== X-IronPort-AV: E=McAfee;i="6800,10657,11720"; a="73926623" X-IronPort-AV: E=Sophos;i="6.23,103,1770624000"; d="scan'208";a="73926623" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Mar 2026 05:57:23 -0800 X-CSE-ConnectionGUID: NbpOcbdZRguGWLaiKcuJog== X-CSE-MsgGUID: F9nCY6cDT+yEv0SOncTFug== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,103,1770624000"; d="scan'208";a="218686865" Received: from cohendav-mobl1.ger.corp.intel.com (HELO adixit-MOBL3.intel.com) ([10.125.161.186]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Mar 2026 05:57:23 -0800 Date: Thu, 05 Mar 2026 05:57:21 -0800 Message-ID: <87ms0m5qgu.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: Cc: , , , Subject: Re: [PATCH v2 i-g-t] lib/intel_pat: Cache PAT config for unprivileged processes In-Reply-To: <20260305122548.28328-1-himanshu.girotra@intel.com> References: <20260305122548.28328-1-himanshu.girotra@intel.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.2 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-BeenThere: igt-dev@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development mailing list for IGT GPU Tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" On Thu, 05 Mar 2026 04:25:48 -0800, wrote: > > diff --git a/lib/intel_pat.c b/lib/intel_pat.c > index 8660a2515..1dcb84cc6 100644 > --- a/lib/intel_pat.c > +++ b/lib/intel_pat.c > @@ -6,6 +6,7 @@ > #include > #include "igt.h" > #include "intel_pat.h" > +#include "xe/xe_query.h" > > /** > * xe_get_pat_sw_config - Helper to read PAT (Page Attribute Table) software configuration > @@ -99,17 +100,18 @@ static void intel_get_pat_idx(int fd, struct intel_pat_cache *pat) > uint16_t dev_id; > > /* > - * For Xe driver, query the kernel's PAT software configuration > - * via debugfs. The kernel is the authoritative source for PAT > - * indices, accounting for platform-specific workarounds > - * (e.g. Wa_16023588340) at runtime. > + * For Xe, use the PAT cache stored in struct xe_device. > + * xe_device_get() populates the cache while still root; forked > + * children that inherit the xe_device can use it post-drop_root(). > */ > if (is_xe_device(fd)) { > - int32_t parsed = xe_get_pat_sw_config(fd, pat); > + struct xe_device *xe_dev = xe_device_get(fd); > > - igt_assert_f(parsed > 0, > - "Failed to get PAT sw_config from debugfs (parsed=%d)\n", > - parsed); > + igt_assert_f(xe_dev->pat_cached, > + "PAT not cached in xe_device for fd %d -- " > + "was xe_device_get() called before igt_drop_root()?\n", > + fd); Maybe change this print too since we are doing xe_device_get() right above. > + *pat = xe_dev->pat_cache; > return; > } >