From patchwork Mon Mar 11 19:22:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Vivi X-Patchwork-Id: 13589284 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 A4D8FC54E58 for ; Mon, 11 Mar 2024 19:23:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0E0E6112C22; Mon, 11 Mar 2024 19:23:23 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="bwHVUbyx"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) by gabe.freedesktop.org (Postfix) with ESMTPS id EF60F112C20 for ; Mon, 11 Mar 2024 19:23:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710185002; x=1741721002; h=from:to:cc:subject:date:message-id: content-transfer-encoding:mime-version; bh=KhqWmD8qlozfu1bc1oCAIXvYQreVkTMp66V3YFFvhr0=; b=bwHVUbyxJPKmwm0kTuOf//WDtLaSEeq5YF3o9I5MOwmlS1IWdXKn4SBQ RwJ4+LSrq/hdc4mXGDnrqBMU+FGXg2OkqG/6vpbtrc+poTQSHxHub1nc+ ui8c/5jE5kNhhJ86JiMwRnvhnsjwmi9bpU70UyU9SNyH5diNLpnBjKJYu /BQFf77DIE6jPa5+bivz7gkMNXrqeRSLW7vbtk7AUXEpOg1JqQ0B2ERe1 MbtOsp0eYcWZFlSHFt3ebGAuPlZnnppFxd4LirrREiYgfOdCJblRcvMBb RlFnE34A4cFMNYtw/3kvM1pzcg0kcRft2b+HLumalMV+rFxCTibsGuSYT Q==; X-IronPort-AV: E=McAfee;i="6600,9927,11010"; a="16270822" X-IronPort-AV: E=Sophos;i="6.07,117,1708416000"; d="scan'208";a="16270822" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Mar 2024 12:23:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,117,1708416000"; d="scan'208";a="15762106" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmviesa005.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 11 Mar 2024 12:23:20 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 11 Mar 2024 12:23:19 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 11 Mar 2024 12:23:14 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Mon, 11 Mar 2024 12:23:14 -0700 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (104.47.56.41) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 11 Mar 2024 12:23:09 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fP34+cduDfjgePir76HTnXUdgDJmABbixFXWTIG3N7t7Vh0prPbCY7IRKRdVTpsKLiB4phWktpPLOiphGPW6tckul7ycLik83W1i6YK7rgE37qTnCyyzKoS87sKvnOcOPxjNxnSt/LspeT+A+gO11unpCVW9FENT5hW6DN6jjppR/+QBlba/w4cttSG6I0aRY/pgD35K3S4NpWkkAZy3tJfUd0o2UuJmGrlCxLgL7Ipjmhf5SvQXf8DQ/bzdS8fTjpimtbcYrEVpGc4pXEnrzwEIGhzJzr42CR9AC8DH0yu2olK62CDSeVCEg2cfRRSdGhN/LLFz6Xw3pcfNIa9Xtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=b1WWAD7UnCdGDidhQw2rN/uK6XfBrAwCZCcUw7E2EkU=; b=k18BjzsQB51AkrxZeg+toS5/Aw+LANK9w3bpAzIOzQ5w0+tDgmYqxCQp26mzJjFbrUbQweLZ2dRbCbEEChG657j9iIROU/ruqaLo7Nsk2Rw17b3x1Bc7TU35PKVEvyfrRtN2ZtAN+rZvHbFJ1i0e3cWaT/ukTo+YifE5nJPp1jJ6aS/JqR/ExYp5TYL46yrJSgMXUsC5V3hC1valZf+SoD/ZZ6/Dq9Bx8nyI5SzMheS02QP1e2FmVIa2y1e0KQHYer/ykx6fFmQogdpJkRq+dzS6RUWNt4mkuBqrcn6vFzm21q4lkJc9ErPQE5cvNYOlv8VAkoXO1h12+eBBlPT6TQ== 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: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from MN0PR11MB6059.namprd11.prod.outlook.com (2603:10b6:208:377::9) by SA0PR11MB4526.namprd11.prod.outlook.com (2603:10b6:806:96::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.16; Mon, 11 Mar 2024 19:23:07 +0000 Received: from MN0PR11MB6059.namprd11.prod.outlook.com ([fe80::7607:bd60:9638:7189]) by MN0PR11MB6059.namprd11.prod.outlook.com ([fe80::7607:bd60:9638:7189%4]) with mapi id 15.20.7386.016; Mon, 11 Mar 2024 19:23:07 +0000 From: Rodrigo Vivi To: CC: Rodrigo Vivi , Matthew Auld Subject: [PATCH 01/11] drm/xe: Introduce xe_pm_runtime_get_noresume for inner callers Date: Mon, 11 Mar 2024 15:22:53 -0400 Message-ID: <20240311192303.33961-1-rodrigo.vivi@intel.com> X-Mailer: git-send-email 2.44.0 X-ClientProxiedBy: SJ0PR05CA0198.namprd05.prod.outlook.com (2603:10b6:a03:330::23) To MN0PR11MB6059.namprd11.prod.outlook.com (2603:10b6:208:377::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN0PR11MB6059:EE_|SA0PR11MB4526:EE_ X-MS-Office365-Filtering-Correlation-Id: 9fd93e34-8f18-467e-ecef-08dc4200ae75 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: K5ctWqczbRGmMr5LQuZLbDm0ZILz73gpev7rmBSceg0NEdonz8l+Ve267i/w6FSZ14kC0Hb3BVQaMjcg3HTpo2PAA756WfNoVe5W0NU2XRsmyI9wP4/e/pfonc+UsvzI1CrRMtDsXjSi2T8Iqezi3xZSItPJ1yRW40Di4TpZwvkE1QpfsnTLqoLsT9uzC2vO7z3cJ8HgqkS7XTCdgunGVQD1pPTINBaM+txB7e0UD4MkZT8MDfdtNWkGQeIrKzUwwquzu9ZHmg8pzlXPj/S8Dp7Yragl2NiI00ZQxtt2qX4GibZgwZJrm1X/P9gcGJy7WTLriTNke8G5POYPOOctYL02CaWubt1G6y86eIgv4Rvz0V6FBwsSzad50Mv/2VG2yay6uBuEcOALYO7rsKPk2+cpAlzOu9i2YXkInJS0s0xUMtGcKpL4ao+UB/VVr7GwXyJbvsSsYJm09+AB+btsHWrc83MyLxFtfUsjHxRAR+V/cdEc7QOytKj+pccF86Yc3IGIA8ctmhdrA95EIZEKpNMYOuYuojUek+mdRiCY+PSMOv4S4YVnNBL4HMrK0b3aUzNR3CJHesvhg4KTGWJQ4F8n8rzGRp+eoj6Ukdj7bRqItn+m0LhYvGMSUjPIPLp+lnizmIR1iMZPPkSzxJnAxaWbrtJ/QxtBQZN+74yzgsA= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN0PR11MB6059.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(1800799015)(376005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WtqJCG0PumRcUsv4Q2+bBkJb2lp/S4tDEXkJUSE+1eB7fAyCOHwsPXZVcVeh3vEnZj7soBll1SOo0DDdhapPEIW5UZ7kzIigqHn6Vf7VCw3BoF4UczqJIy5jsUzzPVLO4BZbRn8MFm7rGppVm5nYTVKm5i5lG2KJn7gJgs1K2LqG6js7EL88qQUYWccwF+t99r+v1l0TetRR9djkxPmDG5pS0Z22l2RJudgm7G6SMXKsp5Xh1vLdfxTSt4v+rmj9Q/WdovAzA8AICjoyYzZ42wF3AzhEz+TePbt5PYHjhBB8IeivETtPbw7aoAIVGFWVQLJAtOJHSIRj2GKRCbdkAMaiEkcYmpjAmQjJCT4neDvNudHPaZCxFjdycsRPiXQ29EYYHmYiq5nlFRxwwbSciwa3b81eqVuTZyfQy4ytnAYCx+FHrENg086jPy0DllRYTpADtsKcPWpCheHL4wQG8cg7ZxHAG6YIQjY5SERJijo86rT6IUXcXtg0BKyLZuHM6O3azyoe0kmqIaKqu75KqmiuJbwO2U01yvsOf4d/PTNkqP1MNuqAxg41Xf10iekmjBnMO6+vh2y/5Yl/JuzhgbzAs+IXo7XvFLVx8xQO+QSMYLtGPcJk0QqF8ZMPSsALQg0+5zDC+jLDkWNzrJaud/Kga+Chz29mN+TIjdPbqZzwCHyC95PdBuNl/GQFPUGI2TCA/6HjVxsI93osUsiDTtf1M5Hai8KkfoagqTRLrg9NhRJhzvWF3FleSH6pnoC3O7u2erChbAxSpLKt3pjLhMqVxTp4zHK3tbhVsGdkD1UVT38AmcchyEW8IdgaHjckf2qOD509rxDnygl4gTeD+N+KoFoHoul14/S0LqxDK+nEfOmH01jyTbpSDqhrtjZSPPA7q+UhgsQCs8Wh4ZSlEldigFkkbwZXcYLn+Yv1jyB/2QoItT27DRnjiEIhbfSqKpOH+I91ZTIQgGy46t2HCFPBbvZ9YESSpgXuHYAOZJdQ4l0yHkeGtoss3nO+g8v1E8g7lh6ZlaiTQlbdVpIwTYhAmkMifCWMnfGsA0nGBrA5ec3eDyLOqqqr0ezJoyKtx151fYXsh5HdXwUqT4guTv7/t7h5FCH3L8cGLKTdG90dyw3Ye/d4JEDlkri+dLzkpIIzqUzyUOqVzGVnCYZ1WerOkDocxVzsQZ570BSI8d15wR+/P0oXbV2t3fhh8+vZ3edJ0zThj0b51e+3Xw0eRkv/56MmgN8LS5U9jorBYi7jj0xR/IfOJVyE47TVoVZFGDHdho2rQzF27EZuSKH0MzJ5cu8xZx2SlYFWtSqH4uY0zmRG8nj4R4K/VE8pFPbGeXvHVsJf/PFjqJ3hDIcf9Tnfw4G00oqBKLdoisAYu3vP7fZXaCEA50XQrfVuKV5IisqCe7alKZs9MAU8jOqLlzuCSMwhTeTEYKmbIdxBgNrCOmyXrbYeapWMxl+oS8yD7QcsjdOrYljRlw53RtKFQMck1uNuiLAsOsEv4T3llFGvjzbM2W9G27BI+a5lUbm5P2OOiGHFEBgiL11YqlyEIJ+Ft45Tdm4zePz47fGd0rnbANlXatG/nY2OD14l39FeXYuIEMFoxXub9aN0Cpl9ag== X-MS-Exchange-CrossTenant-Network-Message-Id: 9fd93e34-8f18-467e-ecef-08dc4200ae75 X-MS-Exchange-CrossTenant-AuthSource: MN0PR11MB6059.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2024 19:23:07.6475 (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: dSYSOtJ4KJWGxOCIgB1huqmmi9CZVT4/Om7/uMMe1w4t+QelQiVitsWbEtLhTIwL/j/XylmNKok5m9genDAxMw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR11MB4526 X-OriginatorOrg: intel.com X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Let's ensure that we have an option for inner callers that will raise WARN if device is not active and not protected by outer callers. Make this also a void function forcing every caller to unconditionally put the reference back afterwards. This will be very important for cases where we want to hold the reference before scheduling a work in a queue. Then the work job will be responsible for putting it back. While at this, already convert a case from mem_access_ongoing where it is not checking for the reference and put it back, what would cause the underflow. Signed-off-by: Rodrigo Vivi Reviewed-by: Matthew Auld --- drivers/gpu/drm/xe/xe_exec_queue.c | 2 +- drivers/gpu/drm/xe/xe_pm.c | 20 ++++++++++++++++++++ drivers/gpu/drm/xe/xe_pm.h | 1 + 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/xe/xe_exec_queue.c b/drivers/gpu/drm/xe/xe_exec_queue.c index 6a83bc57826a..f69a9c99329c 100644 --- a/drivers/gpu/drm/xe/xe_exec_queue.c +++ b/drivers/gpu/drm/xe/xe_exec_queue.c @@ -128,7 +128,7 @@ static int __xe_exec_queue_init(struct xe_exec_queue *q) * already grabbed the rpm ref outside any sensitive locks. */ if (!(q->flags & EXEC_QUEUE_FLAG_PERMANENT) && (q->flags & EXEC_QUEUE_FLAG_VM || !q->vm)) - drm_WARN_ON(&xe->drm, !xe_device_mem_access_get_if_ongoing(xe)); + xe_pm_runtime_get_noresume(xe); return 0; diff --git a/drivers/gpu/drm/xe/xe_pm.c b/drivers/gpu/drm/xe/xe_pm.c index 9fbb6f6c598a..847b263afe70 100644 --- a/drivers/gpu/drm/xe/xe_pm.c +++ b/drivers/gpu/drm/xe/xe_pm.c @@ -477,6 +477,26 @@ bool xe_pm_runtime_get_if_in_use(struct xe_device *xe) return pm_runtime_get_if_in_use(xe->drm.dev) > 0; } +/** + * xe_pm_runtime_get_noresume - Bump runtime PM usage counter without resuming + * @xe: xe device instance + * + * This function should be used in inner places where it is surely already + * protected by outer-bound callers of `xe_pm_runtime_get`. + * It will warn if not protected. + * The reference should be put back after this function regardless, since it + * will always bump the usage counter, regardless. + */ +void xe_pm_runtime_get_noresume(struct xe_device *xe) +{ + bool ref; + + ref = xe_pm_runtime_get_if_in_use(xe); + + if (drm_WARN(&xe->drm, !ref, "Missing outer runtime PM protection\n")) + pm_runtime_get_noresume(xe->drm.dev); +} + /** * xe_pm_runtime_resume_and_get - Resume, then get a runtime_pm ref if awake. * @xe: xe device instance diff --git a/drivers/gpu/drm/xe/xe_pm.h b/drivers/gpu/drm/xe/xe_pm.h index 0cb38ca244fe..119b630ad1d1 100644 --- a/drivers/gpu/drm/xe/xe_pm.h +++ b/drivers/gpu/drm/xe/xe_pm.h @@ -31,6 +31,7 @@ int xe_pm_runtime_get_ioctl(struct xe_device *xe); void xe_pm_runtime_put(struct xe_device *xe); int xe_pm_runtime_get_if_active(struct xe_device *xe); bool xe_pm_runtime_get_if_in_use(struct xe_device *xe); +void xe_pm_runtime_get_noresume(struct xe_device *xe); bool xe_pm_runtime_resume_and_get(struct xe_device *xe); void xe_pm_assert_unbounded_bridge(struct xe_device *xe); int xe_pm_set_vram_threshold(struct xe_device *xe, u32 threshold); From patchwork Mon Mar 11 19:22:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Vivi X-Patchwork-Id: 13589282 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 4A101C5475B for ; Mon, 11 Mar 2024 19:23:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 62FC2112C1E; Mon, 11 Mar 2024 19:23:18 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="aQ/cSzDl"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) by gabe.freedesktop.org (Postfix) with ESMTPS id E5813112C1E for ; Mon, 11 Mar 2024 19:23:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710184998; x=1741720998; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=gqEA83ZtOOxqEONLvEk7CGKvhrmdpjQWtSvD7fl5C9s=; b=aQ/cSzDl+H2mWbudEfxnsj7owHGgZLMHX4UTwfAFnXQqPC2I24aDpqf3 gcuhu47vTEIUclNglr1TT/CUkhy507lIs0+fmcOM/YZxaQ5BgaaFmE8bJ ku3Tysvd/BhA9DrbG2Y3AhoAWqAUzXKRp1+B3BVTLDofqZygBCSFVVY1i SGYkwW8fRc3LBFW6gOM/dcBjSH4AEwFnliLZjS5T8Pyh5v3qhAWUADYat Z64wRDIxiFTyIm26b/v+u+zZw3gabHFXFWImeFdDZByK6K2lbbDrrlJeh +dcT2wD7gNiZtJuYrh1w15s4C4pgR7jGTqK5k2UzTAn+F2/R/gUqQj0en g==; X-IronPort-AV: E=McAfee;i="6600,9927,11010"; a="8686261" X-IronPort-AV: E=Sophos;i="6.07,117,1708416000"; d="scan'208";a="8686261" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Mar 2024 12:23:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,117,1708416000"; d="scan'208";a="11338452" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by fmviesa006.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 11 Mar 2024 12:23:16 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 11 Mar 2024 12:23:15 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Mon, 11 Mar 2024 12:23:15 -0700 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (104.47.56.41) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 11 Mar 2024 12:23:14 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CKdEB+cBxTvgvYPk0WBIskNmzHl/f8HWWinrNHqUpn6r3i9bRwSDSlq/B8lA/W2uavMSCSHvlOP/6Mx/OdHeJAJrWl8ZptJfZ/mGc5lm65mrCqAozu6TDOltDaR4cW+wYjprHtly8IhFJjNAf1qpEw5anYnQUPVrunxT83H67rmttmpM5kR8asjEvrRTI0M359axyPcfDIWVct7c+FNNVufdDR+lPRw4HBljzldmZBwrrs2+LxVd9+W0/7IfgBo7gnTIDsvnfvZEdhbwCkKpxDp6ahAruMJDGIYXIVuOqLTczjuCEFOLE5F506fuS/7w9/eVNtPoJfvvGRN683No4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=EB238jmxX46Y4UddB2n9Ix5zgvjmCsEbNTlpNKAZz1w=; b=E+TbkGHZoNsKVlExXsiMAWBL4FdJNvvcPmqP1o+MAURjuNAGMPeoqHMoZltt5OwY/N8LbfU9C7Fw3MbJ/wTbe9JlEX+MaFUVnyaMG4aYuhBhrtQe+7y4Mn3KTmHLk+qncAfoVIGxxhWfkPClQJz1tFV+gZuy+y2V7ud+9KgmoI+7PrfwI4UvUC5kj4Fk0xkfSCmNVQ2ii5sj8Fj0zlIb3FFV9aRLTONDWg6FHZb4fKE6m8HFr+relrPRQnwcfa9AQRmnEHLAWsAhba4zBaOEaAEKVsCEb6KAlx/zU+BP0MfM55J5VOD0gsFV073FXVBFE3ZyEE7YtCRJvTiGnKZ7uA== 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: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from MN0PR11MB6059.namprd11.prod.outlook.com (2603:10b6:208:377::9) by SA0PR11MB4526.namprd11.prod.outlook.com (2603:10b6:806:96::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.16; Mon, 11 Mar 2024 19:23:11 +0000 Received: from MN0PR11MB6059.namprd11.prod.outlook.com ([fe80::7607:bd60:9638:7189]) by MN0PR11MB6059.namprd11.prod.outlook.com ([fe80::7607:bd60:9638:7189%4]) with mapi id 15.20.7386.016; Mon, 11 Mar 2024 19:23:11 +0000 From: Rodrigo Vivi To: CC: Rodrigo Vivi Subject: [PATCH 02/11] drm/xe: Introduce intel_runtime_pm_get_noresume at compat-i915-headers for display Date: Mon, 11 Mar 2024 15:22:54 -0400 Message-ID: <20240311192303.33961-2-rodrigo.vivi@intel.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240311192303.33961-1-rodrigo.vivi@intel.com> References: <20240311192303.33961-1-rodrigo.vivi@intel.com> X-ClientProxiedBy: BYAPR08CA0025.namprd08.prod.outlook.com (2603:10b6:a03:100::38) To MN0PR11MB6059.namprd11.prod.outlook.com (2603:10b6:208:377::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN0PR11MB6059:EE_|SA0PR11MB4526:EE_ X-MS-Office365-Filtering-Correlation-Id: 1d0423d1-fef7-4a8b-aa2b-08dc4200b072 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ViooXs1jZQiNKVd4lU32cLFUrsX1BIj3oEqE0YO9AgSpSXmiKgQfA53KXHY5RicoZeAPOZtSYN9/UZNqOXk/9Vu0ADLVHnFG5eZIAcVW+qM0XEpMrodjjhC/3Ot9ahNitbWniFdAJt3sZsy2V+D5QD1CM2QDWbdYcjM6EfHG+dZqAZCAke/hsW1iM8ihagcowGM7PuUYd3AMikTXuol7oq3k/t0AfGp4btoIKRXC7E4CC64C4v17CYGNlZGCh8JcLtXTrvY/bJZ/UfzHbSswEB9eRHhrnd1yn8pSaaLyvOG74HY0uGe8yon0teIW0nAL4keJF+ANfoBT5Faq3qYtfNSFopKU6KQWR0AsIm11piMoHSTlNMuz29tfzSeDJHR6duEUrKvzl/ZhSxufVjJ46ewdHjS2enRrTK+fV0dMHCcqgO2TZpekcF3azPBgn+k4hN+TY9TdDJnKEGuhFIY21F5Dpw8OZ9OZRgQ0TQRv9WEp+bmKBxwNEM267YAdRUS11dW+TKdXmKNqxF+HktffkBjWXISR5owh2CMIOaxfca8yPgqPPDOkMsCKgAXUame3ueMcHTXkk+wXh0gmbjkuCPVjyoERaZ0R9N56sBIK7/BAZfo/SCwPyL/ca+RQbCRDf2iIYylCZRQsXnKpZcEn+XK/6MrTKWfOfHFHEnnig00= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN0PR11MB6059.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(1800799015)(376005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: nFxxmYdaNixsecyImS/GZoehbpCRJ1f5uy8JxPI0I0vd6f2GHM7w+9m0iqAZN/vm22U6/Z1pBvBn1Dijwz1jTydD6pPjOYlF9rUtMs1gKPi5moWcurzyzSqCby25mD6fnLQ5RYscQVz4Ji9Ly2CwAlk66Oahcn+1n+nSOQO/n8Kdbv4l9nHqMklFcFZY3meenVEAnXII/TxbYWQs4FKDAl79FgSATho8xerklOjT+kAzongPASgkOVDqK+R7soVQeCmcYob0frZVQNR+ZYWt1TexDEt3qehbwJ+yFcwPWSlqNmtTZdbNp6LRPx7HBC0HfCWJc6zOqUnhKZ/cBeBbrlLiNBkyrzhpwH4r9ylGDNYA5MH/86CB7aytwHPbwZy3zBwkYO7/mt0SXYkG15X4PNW4vJLylDnWBMp/KvapG/KZwZMvC/oU4x8m8SWK3EUhZGgWA8ZePc9U6c5d3BZNV6RznZ1CwpMbyrIaEy+AA9bQc/He7eJA68g62UARujEA/UwDzKgnX7sJLHwJYJ+oMm2SJLt3g4dgrUZKQ2rOP+vIelZwzxUv8CFqkhVoAxpDiGSLN5c2JwQtHrTgKGLv7zPHD2sfcqB33ASrdGjOMtnYQdyr8Nx2SreqZjSC2GbR+MV8b8sQWkzs493J/LARwlZENSBtVWlUIQzGJ2gUPuonO1xRNBQNkPlots/rXwvmWQOdwJMQBRS/byiKyHagOYojnapAFzpyDXCLv/iY1leQnwflxoYtGkqDl8bGPTj5IZytQgFggetMuio3R0IhLJ3O0tOaVFisDEIZ62fKtflP3nNMZOQLcvQXwpqrJzsOB4ZP4CeZMZFpfBa4l48Vjq0+GFOiz1wyLqNCsnUpIyuJlzIU+VRkVnlspvzv/v7TQHT9GAsNggy/SbFtbCqIkh7jaNw28xYGXh20Csp/GOp8I6i7l/GdomOAL3hJ9rXf8exUW733seCXxtaabwlQRIPkYITBt1Ubw44gHauSMr5RN49yo/8hrUXCdNt3hb8673kztlNjtbeyN5K8ipFbRLUqgXXLoQgS5t6Ocgo13FxDTCipkns9ZJMm9UzFiZgjlNukFtXDWW60V3TwdflYbAwRAQfvQWBldCLGRygXdMHQScVXhh8t9lHicyaxv06471WrmotNaPhVtkmCWGeG0BdIJS0U8oCs0EGdpWLFBu6y6VvzH+GeBSYhiRaEsw5Rien4KCMtyW4s7ToZMdDDwvSGoN3GQBYvmb7JnCPXHZNVwKYbFFheeMifuNkRmLMTF5QYm4z+Djqjl+hA11d+74asZcRqtC/0DyVJSm4/i5qSd/LgFJxQAMSwrU/ZSqxirEEcC4HQ+9pnCMa3Te4IMKqFXLXiw6iO83pjYvlbKD+B9W+C9HVKzoEMkxq53CRt8FvDhgOFuhvcA4jM8tsVq9mVfEcobTPEk7jimn7fWTt6STIJs/m1jiOg8EFfstWEBBrbZlTgDGVIMZma4oZbOg0MsGwpI2yL/GrYPf4tmVpgpsGqKOoraQwCielAKucnlu+FDq6dakjOZC5bPdkorgMUn2cNkQruyQyvRopJXfqK8pJ4yjF9wX25M252n01Ia+9R2m+WjJFXGU5nQYit8Q== X-MS-Exchange-CrossTenant-Network-Message-Id: 1d0423d1-fef7-4a8b-aa2b-08dc4200b072 X-MS-Exchange-CrossTenant-AuthSource: MN0PR11MB6059.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2024 19:23:11.1040 (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: iSvZiOTsx+cv5KyF0/PbyU7R49sFc+B8ImiA8H41TBZksjXh0VCiifGP74UXaLOFJagV4ajLdRMYluO7txK0nA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR11MB4526 X-OriginatorOrg: intel.com X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" The i915-display will start using the intel_runtime_pm_noresume. So we need to add the compat header before it. Signed-off-by: Rodrigo Vivi --- drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h b/drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h index fef969112b1d..84fda436faab 100644 --- a/drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h +++ b/drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h @@ -176,6 +176,13 @@ static inline intel_wakeref_t intel_runtime_pm_get_if_in_use(struct xe_runtime_p return xe_pm_runtime_get_if_in_use(xe); } +static inline intel_wakeref_t intel_runtime_pm_get_noresume(struct xe_runtime_pm *pm) +{ + struct xe_device *xe = container_of(pm, struct xe_device, runtime_pm); + xe_pm_runtime_get_noresume(xe); + return true; +} + static inline void intel_runtime_pm_put_unchecked(struct xe_runtime_pm *pm) { struct xe_device *xe = container_of(pm, struct xe_device, runtime_pm); From patchwork Mon Mar 11 19:22:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Rodrigo Vivi X-Patchwork-Id: 13589283 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 CCF07C54E58 for ; Mon, 11 Mar 2024 19:23:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1BF4E112C1F; Mon, 11 Mar 2024 19:23:20 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="RQXQ/KtS"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2D74D112C1F for ; Mon, 11 Mar 2024 19:23:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710184999; x=1741720999; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=pvh51CM4dvm8/ILZyE+gMzntt2UD51B1oleZs7ZcJaM=; b=RQXQ/KtSBKAKUO/uPf2N34kDj1B9RnpnzLsoERpmsTVKd0+4MY9h/DMF oMoCa6WMSvAto/AsGwJwEavFE/L2syBtw4KSg/TQrVCRabvivtXEwefPW KvkhurLgDYgsiHFO8tagywmZtyPjcZCv5wRmxuX1gthidpMuJtjdxhOZa oOP8GHYYTWlA4cmu9wwZhOwMRagxXWsYVDFeK845vb+JXKOSh4qSDHETh 7YYlHusz+pSedd3tVJFp1gMr2gsOzdIoDuvrVxBwy0RlzVvYo2BIAgqAr RqioyGGq1+x6WtbqoQthOA0nh20S5oLQI0/PjAn79u8+Tq0Ac9DElxPXL g==; X-IronPort-AV: E=McAfee;i="6600,9927,11010"; a="8627069" X-IronPort-AV: E=Sophos;i="6.07,117,1708416000"; d="scan'208";a="8627069" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Mar 2024 12:23:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,117,1708416000"; d="scan'208";a="11344229" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orviesa009.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 11 Mar 2024 12:23:18 -0700 Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 11 Mar 2024 12:23:17 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Mon, 11 Mar 2024 12:23:17 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.169) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 11 Mar 2024 12:23:17 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=al1/yXVxjYDJzcoawpusqmCQTjsuWR+5BLsifgtiFnuSqmDTBVRY6Iri6AoLCH8fPeMz8/M3x4BIvTZSBKxIhjnz7CcTtREA7VserJbspD9/S6byX4xIssw/16NKCWFxZ9RU6VpVuC49ptvqTPt12IeJDTm7j3Ten2n6jeSxtYo0l7FzJOmpXJJ5Y3UZY6UxA15OqJ4DYzI66aSdK+X0pF8uZ8bu1Dm4Q1KWQOHv6MoUVNDM4YaItR2o50m60xuHv4NTi86xjcfMKv7OCBlpsCdKMOQn1CyG7x+cCBtfmuK2mQncvLYsk39r59TBvhzsVAIyJ56Imud36emv8qASWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=TkU9iIsX1CFiehJF2VD0WynPvCJD7NNWHLUhH6KsJw0=; b=B7ClfKAL5o+Pl0e6/26lQ5Ej6jq6GHx5kxf/enGMln8V5Bya2lTtbQC6jGRhx6I4kXUfZtCJR93VJz8rEiJlPYbnpQLxJcN//2kwNzuATdmwXYk0arpaw1PrJnBgy79el6zF0O6PaV9wN06m4SADmHgODplgXaS4KIvTFMJpGBn5/wsa7yi+jKNyICo/4E0JKalwtBtDV8CEwOWkhIY6UD5VcT6U/5TLRkN3ET85HwuIUPHxIdvfcNLAKswwfFgULatPwMG6GfeFg2kkXNWUtgckcYwB2TlPIR8mu0AQ/aPgxeD49JrGXsausaoHbCR7lBhG0Gz1KPgOKhTtj4HFmw== 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: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from MN0PR11MB6059.namprd11.prod.outlook.com (2603:10b6:208:377::9) by SA1PR11MB8253.namprd11.prod.outlook.com (2603:10b6:806:250::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.14; Mon, 11 Mar 2024 19:23:14 +0000 Received: from MN0PR11MB6059.namprd11.prod.outlook.com ([fe80::7607:bd60:9638:7189]) by MN0PR11MB6059.namprd11.prod.outlook.com ([fe80::7607:bd60:9638:7189%4]) with mapi id 15.20.7386.016; Mon, 11 Mar 2024 19:23:14 +0000 From: Rodrigo Vivi To: CC: Rodrigo Vivi , =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= , "Imre Deak" , Matthew Auld Subject: [PATCH 03/11] drm/i915/display: convert inner wakeref get towards get_if_in_use Date: Mon, 11 Mar 2024 15:22:55 -0400 Message-ID: <20240311192303.33961-3-rodrigo.vivi@intel.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240311192303.33961-1-rodrigo.vivi@intel.com> References: <20240311192303.33961-1-rodrigo.vivi@intel.com> X-ClientProxiedBy: BY5PR17CA0049.namprd17.prod.outlook.com (2603:10b6:a03:167::26) To MN0PR11MB6059.namprd11.prod.outlook.com (2603:10b6:208:377::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN0PR11MB6059:EE_|SA1PR11MB8253:EE_ X-MS-Office365-Filtering-Correlation-Id: 09fc28b7-7d05-4f19-5883-08dc4200b2a5 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; X-Microsoft-Antispam-Message-Info: Exl/tFwWVj6iU7asRgykokO0q4zlf9LoY7eozFBiN7MAC97uYjGEpLFUO3BEVPY2NDvtulamfRE/knajHNw90G/XHjtXiUcBXoXj58j1GzJo4DBVvQ2zLc/c2u8+hAghrBA367skFp+1uzMG61Fx8QWnBRHPVXv0pnoyKFlzZ3E+rk5qF9K6AL02GaJBY+diyPewWc2FZi9qX/X1MAUNpItH/goWYeJh7xdJJGWvdlRiIlvB88v44SwljpTssS2HUbTAltJyR2/Y4j9JsKN5P/dQ0P1My7l3nGqRhKj3dKE/bpD0OXphQMU3jIF+e6C1sxpVeOPiPuI8ZqLGLcju78wzf40JhUrZ7GKUnceNmW+ESmJnHUBLVJ6TH1lsMHn6MWSbgKpDmYAvoXr6i2CJp5zUrIMlyQKVPA042e3lrPBdu3h7jJaSP1ro+naxufEZSnJVcjBzDoVhYwdCi7ra5p5RrL9S/xszTX7reHDbnmyKgeHreB2nGF4F2dGjRs3+1S/khu8bDsCw4sFw/XDuKJFaSuzLNGJ4Us75WeA7eXGTUAIYtTyCCqyxc7UT+4nfGzV9EALdsU2ezUSSo9360JpNJyq+5c705oAKm0lLJqrls5rM16ThqEDzPEY8MDc4Gy004piskme6ugYx/e2TQ3OiH6l5C5eM6uXFhia6gYc= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN0PR11MB6059.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(1800799015)(376005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?C7HSw3eh95UgIHABnCGQKHj77rR7?= =?utf-8?q?1UgPNOgnrBTtWLKYBCTqiy1QAEyl43TX6plvtrBcCIhcnKiAikAF8YMJWRb4boZTo?= =?utf-8?q?LDUlFQx/8uN9DcHqy9JJ3gRKIDNloTlKih/yJOG5dgOYqGN35ORlaOFH8ahJ97irb?= =?utf-8?q?vR41u9yX3KEqQ+m/DqA4uNP7TmIoxR0Y8WB67N0bYMfJWJafOVG7nfCEMfnhqr0Pd?= =?utf-8?q?PSzkjhq/qM3o065Cne89Vyu3mM4d7JVNeGdH8dliHZm8Se5QWwK7jIr3YYFdJYmBh?= =?utf-8?q?X171QUltzWiEMK86dAUHQknBJXtU3gQnWA7+ddpyZ1HGsN8ffIOvS5GuJK4O1g1kR?= =?utf-8?q?1WKciohaEtbeL+cjRhNVk+D/xEMxcfofCpY2H/aI4MO2PdRkjndxTrym5ysgXDriO?= =?utf-8?q?Iuky78p58b1k7maBtEes5ZRpmb3D7Z8pHhcBkpsV6zWYNt8vpIVqyD30EDjDzZq9m?= =?utf-8?q?sxjmJ599j+gwbRxjapqL8/VIUJy4mFr+2eh+ffpKKtPJSQu7XiQPkDEcf3x0sW85F?= =?utf-8?q?qgpuYkTS8gSOWUN8Cy4jxjEa0U2dp7hIobU5w4CMMJlJCkUPCnAVRsMkZBeHc7pqU?= =?utf-8?q?rDk0U79FtM7bCLEj+mQsf/mgKztB+Gf3yaKN/ft8eQBbEMzSu/Bj+rNMBi0TtpqS8?= =?utf-8?q?eyjj/9I2DW/WlwS1Wn2eKAKMfdWB+KsXbu+a21qTfP4yfqWy8qXDz98Irle2J0OdJ?= =?utf-8?q?ml3XlZDDW//E7CucySlD9JMoila7c/J/LweccVhnpuMcJJzQz0C8eF8HeB/wa9Rnl?= =?utf-8?q?Izxlm261uG42cWhpCUnmOw3/rulb666cXkX3CriMiZo/kY8gS0vQeeTPf8jaQyuvS?= =?utf-8?q?9rjoaBMj+NQq2S8raBEhMyEhy2tVCWlNyxeNkZ8RL/q4YtbhrVv4jGRe7qNLAaNHo?= =?utf-8?q?BS0goLQmyl5UGVhn76j0oNi6nqj9pNpeG0yRPz+fpn95pdOl+01rQE9Fnz6RW1rvL?= =?utf-8?q?251EBI4NwdRQ1v6SY/vM6zTqJlYP/Qb/0R++e/U08QxjntI6nZqb9w+Yb4JmYZ6iJ?= =?utf-8?q?EZbn/Lywtv5oSJdMOW7SZSNBP+sIFq+C+jfsxgwqmvpaIDM6UyMncek1zzs0U9JJ4?= =?utf-8?q?ccQnEDUONTI1oUbVsASkus6W6LCf4xa/bnorsq+/sOAtU1Bw13XtVmz5dc2fpyoxj?= =?utf-8?q?oYq7+VrPFxI0jIsRMHLbYAZX04AwAdSq11CcbxSc8VVm2mfZKjT8pOSv8yHRxDa0l?= =?utf-8?q?GSpNSXywStfky/CVfRHVcw2g1eevC6IXdiZfKCmBzR7xuzIpzRaQJfKKvYdZaxpbJ?= =?utf-8?q?nXvNdjp1vuCCfE3XHMoc8ojBcTxj+jc7hUnLRapFn0ua/ut7ks91zLILKBvfzCbr5?= =?utf-8?q?iYqVohaQpHp/jiiMsa8zT2ZBQXiwrYil8UQDBmFv4QpYHWVmr+ZayPrd15UUaMtS1?= =?utf-8?q?9JMbLpYuhhZ2ur1s4AN518izEgOxdpZvyjfzjtlL6zWiVq2rshlk7R/6c0gzCuU31?= =?utf-8?q?54CnLm5NjrW2+A5wwEkjqahRI6ReXOcVjplCFyQcBm3WD7rLe947JEwS2GArLxmCF?= =?utf-8?q?zJdysSmTr41QxjmFaTocwOmjXY0qicmxUw=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 09fc28b7-7d05-4f19-5883-08dc4200b2a5 X-MS-Exchange-CrossTenant-AuthSource: MN0PR11MB6059.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2024 19:23:14.6919 (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: gfS2oL8P3vR8A8JKVhPJMbweBHPVh6pfWK8jXBP8589jA91K6fW/9KsxFFZRrdWfp0yhTuABzz9v2aNXXwIOUw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR11MB8253 X-OriginatorOrg: intel.com X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" This patch brings no functional change. Since at this point of the code we are already asserting a wakeref was held, it means that we are with runtime_pm 'in_use' and in practical terms we are only bumping the pm_runtime usage counter and moving on. However, xe driver has a lockdep annotation that warned us that if a sync resume was actually called at this point, we could have a deadlock because we are inside the power_domains->lock locked area and the resume would call the irq_reset, which would also try to get the power_domains->lock. For this reason, let's convert this call to a safer option and calm lockdep on. v2: use _noresume variant instead of get_in_use (Ville, Imre) Cc: Ville Syrjälä Acked-by: Imre Deak Cc: Matthew Auld Signed-off-by: Rodrigo Vivi --- drivers/gpu/drm/i915/display/intel_display_power.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c b/drivers/gpu/drm/i915/display/intel_display_power.c index 6fd4fa52253a..048943d0a881 100644 --- a/drivers/gpu/drm/i915/display/intel_display_power.c +++ b/drivers/gpu/drm/i915/display/intel_display_power.c @@ -646,7 +646,7 @@ release_async_put_domains(struct i915_power_domains *power_domains, * power well disabling. */ assert_rpm_raw_wakeref_held(rpm); - wakeref = intel_runtime_pm_get(rpm); + wakeref = intel_runtime_pm_get_noresume(rpm); for_each_power_domain(domain, mask) { /* Clear before put, so put's sanity check is happy. */ From patchwork Mon Mar 11 19:22:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Vivi X-Patchwork-Id: 13589285 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 AEF91C5475B for ; Mon, 11 Mar 2024 19:23:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6ED2A112C23; Mon, 11 Mar 2024 19:23:23 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="kBpvTnUz"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) by gabe.freedesktop.org (Postfix) with ESMTPS id 21429112C22 for ; Mon, 11 Mar 2024 19:23:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710185002; x=1741721002; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=0OH2pdLRjKObCJ5hJrT8dD78kkM3XCAK+KkNEbAS2N4=; b=kBpvTnUzZ9g7DCUwF3WsZST3EK98zeuUvaxcl3moHAffvWR7tqsSQmCC xvWL9Oi/aFWLPY+gzlI07gkrUUSIjPDrLoKuedZlUlfyuWgmQ0vIHnhsI D0iHZD1GIWf/GfQrI6uhX44DXtuUSz0/ypdHZU/TxZmKI4zMGEV8ebamZ NOTJ9Oj1iEA7GPvLPRNyaREMzeKKl2y+nMggFCVmCkEJ3/WIjPfrPeMU8 T8P8tODe51jaKC/rxXj854BDvse2G4eH09pc+F02SHIpqnRVoEoQ+8XS0 +OtnzwrPcWQslCRVe8SVvKPp1GxBIfFHAcZrLcVKV8osCkqjOtlboCsV5 g==; X-IronPort-AV: E=McAfee;i="6600,9927,11010"; a="16270824" X-IronPort-AV: E=Sophos;i="6.07,117,1708416000"; d="scan'208";a="16270824" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Mar 2024 12:23:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,117,1708416000"; d="scan'208";a="15762110" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmviesa005.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 11 Mar 2024 12:23:21 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 11 Mar 2024 12:23:20 -0700 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 11 Mar 2024 12:23:20 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Mon, 11 Mar 2024 12:23:20 -0700 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (104.47.56.40) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 11 Mar 2024 12:23:19 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=faKA0PovS0svJy84wOTnPIkCXGgH26wl0/X2l5ofaewlW9rgG2VlpTWQJei6VIUTuHclPXcLnwmUTBXfTE/kHH38PEjGFwbYwo2arZXJuOK24LFlSj8PA1agwSB6I2qJnvm4R3ZBjZh5IGQRU2ruplZAhCvDeoZmJR2XVql959Q4RzSNBWWpngsRqgMdWomP/hAbYXkqnOVJAA3rRV/8jV2z32xi5RnE1s2xAzc+M0j5nSkpHyQt4XguI2eMOJ7owVNzJO+0Pq80Kbz7LI9M4DnSwJe4YxMUpw1z44s4wXZzY51fRDimzFKiLXXJfyevYbJ8Zt5j1ESZUi1+ZtG4ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=ly7smjagvht86Iw2ktVOVkIVjFz3nKai2Lzne3lG+r4=; b=EeCTjt8e6BQkF109dJHUBnApcgIqp4ZQN/0/0bU7+GfdHp1ulzlAWM9izwpFcmL2rUtLh/vnt8iSqrPuGLDYMGJfUhvywWImXtd5eCEPWbc1iORKUuhQFVLLoeRkHup5G96RAp0fbz5w2+jet+sPoBydM7wF0x7G98V0aRdrz9vbxcAbuhtZSHvRxtZ8TJjYfCz+AfE8TC7EbUpa3XInlXUNyEHRunPS2LB6CtHA5Tx0o408gpgE4HdBZtrNg4I92/T80/MuTS3CmxJnQScNvBju1lDpG1bhbZq7796ZgoUay1VWwBLloWsPVGtik4doveS81km0SzxHnmtDela7QQ== 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: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from MN0PR11MB6059.namprd11.prod.outlook.com (2603:10b6:208:377::9) by SA0PR11MB4526.namprd11.prod.outlook.com (2603:10b6:806:96::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.16; Mon, 11 Mar 2024 19:23:18 +0000 Received: from MN0PR11MB6059.namprd11.prod.outlook.com ([fe80::7607:bd60:9638:7189]) by MN0PR11MB6059.namprd11.prod.outlook.com ([fe80::7607:bd60:9638:7189%4]) with mapi id 15.20.7386.016; Mon, 11 Mar 2024 19:23:18 +0000 From: Rodrigo Vivi To: CC: Rodrigo Vivi , Matthew Auld Subject: [PATCH 04/11] drm/xe: Move lockdep protection from mem_access to xe_pm_runtime Date: Mon, 11 Mar 2024 15:22:56 -0400 Message-ID: <20240311192303.33961-4-rodrigo.vivi@intel.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240311192303.33961-1-rodrigo.vivi@intel.com> References: <20240311192303.33961-1-rodrigo.vivi@intel.com> X-ClientProxiedBy: BYAPR02CA0033.namprd02.prod.outlook.com (2603:10b6:a02:ee::46) To MN0PR11MB6059.namprd11.prod.outlook.com (2603:10b6:208:377::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN0PR11MB6059:EE_|SA0PR11MB4526:EE_ X-MS-Office365-Filtering-Correlation-Id: af1ff55e-fd3b-4336-593d-08dc4200b49c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: X8xwitK15GLAGb2yLWYO80xFzIudalZRmRL2JLogvJaOxhOTSd6ejfBM3fbwjZzJR4mGo0k3UmmrLSbNzW7NG/+cJSS822tUKVMCAhesgu9+Xzn6Qer+Vlqfei2Zd1YPnkHNz6UhTwh5OLIfqvLwNOXcQ24UaOB2s2+IO5b44MnJ8xO9fnDqfIn+M7D34MN7ndYHRJ6Pw1Fbq5wnJwkXdJXZdcxN1xVxY4pPd2IjNoOWDZpe+jjcFFAjcyQpteCAo9kI1yp9GMrQX9DRxW/i+Ze/kCtsZekKSCgQI06DKxVT+3mlfMzlVWi+nODD1JxY5mCKXFgQ+8j4L/a3YyZJsub14WtLhJnOR4yx8CK32TuGN3bfLUE2rblYpmZGu/bEr1Ojp43H6f/zcQ6KK0P8eHkR2uVexMyOBaZ2AGMVEA0nsNAW9ryE+TWRGT2d2hmo0fflknaxn4LV1KuvajsdkRTQXMwkqTKfi3zdjhq1xQ+sTIc26lZKckyseixyube5whdIau+mw7qvM8kFK5CMxsu1k6543muSZyOoCVhYfF6HJ2FJTh6do2rnxOPgfdyE+TQ/MqWUsm7/zK8gKRYZorN0a6ijvUosjRT/wLqs2ZTgL2BRFslNUG5yJFhWRJrEhk3GHEZtqVvAeYh5FcMK6T2F8OCbnMWzAzxunQYal/Q= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN0PR11MB6059.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(1800799015)(376005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: I+jVLDES3PpKYDvk247yl0gQaYDM3vzkGbTWVSLwlVl7ie67OdoJRa27SYLM3oRBYCyVmWN/7DTsCOlQjOE74lbNJO1HHHeSGJNePecasoPnGYK9m6saNZ92I22ugXB3ochAVjpLrs56JWjsMJX75qaa8tf7EvLHHtNNyx2PgergEPO7pF4AJMfWIZykuUtxG1xZfucE6vpThLft9OPgal+kKR6vqGViExhKydWJPqEwwWw3nD0MBsV7eGbkJnJ8Lk1YEa/bpQFDdC+xb33amqchNIeEZRWRrkPYSd8c2krY84b7gdI8ZOP9w6PMfv78SmTwaVRihhjhqVxpOl51rXlb5HhzLj5YhvlkCy7gSW3q8ky3TpclRO5jNzEBUdWhwXtNnKcLoi3Gze4pjJLQQbd8wY+bXmTai4yD9rkLNog4gm4RIzb8cq45MvGMZ7WcHIqelXdnxo27TBnoHFQFeM1r3eqNV8z5K3s2FG+cyYuYZSnlofF4ZGV164Bu+oGU8PHqrTvLGvw43Vz9mpCS0C/rnk+845wx0cqqKVZWXXeIbVXmLmLb0KIYxdmAMtWaBXqW6LY6CCgin3RtTFbSetGbQpDDgERgnqp3HeEJz5oNs8Ywo7JnMawHrjw8FSJheO6z3hBw1PiMGU7kZHt64Ka6Iz8VvobE+sFgaaJRAxMCx/sYiIS2t6PFS1KbRhlB5xQxPNN6VWzJs3m5I/sOrHVOvUFPpCKIiNRArY/OFZZK++P2F9W+hZsxu0bV9ui3DJFz5fYA7W5fds/uE2yfMdrXdXdGU72iUm6bnyII6iDsxxLFaeo43j/bGgQIqxh3IZhkX9AIYrr1fCc4AIZ9pyUR4P/EzewWqM173BouucB/xRkGndKTz+QT5OGAtztRraukqcje3E4aq/bE6qnULZNU5ImkrUW1iNm354CV9RdydOOnCWM1nqqUdQenoqty66wegg2ryYWqRuUDb5LXck93tjeiIfgWAccP5S3Ife8yIUVws8LhQymwn5y/gH74T3/Fe4fLS2vUA+tXf9rA1acmCCsuURxWGROvzHgOMpRU9vh+cCi5EIXuDzoKx1Bk2BBOdU9zCVp0SU4uddkSNiGJwQpy00Sb+cq5936FCxxr6ccZi3yWZVQe8o9PXNELrujW8pfobikYfAhPfuYdCFaZEc9qqKpHUJsc3EZ0U07Yutn+2cBQdTbxTJbEegaetvZagALjN9++zIB8NDUNOhneGGvjOpSL7VaLhibit9wiqkSg9WNFORyeBb44SJ0ldsAkZIytiKVS6tzu/kQFqyB8PC8IJnFGvgNLjCA2sIZmp7r/+SuQCY5P3QUhwiRLP1u5tlmkedk3Vb0zb3jXBSeHO6F4b2Viw6szZDHnlB9kNzyOiewUFnie0ROjnxhqiRdPnTElHYdwYTvRHAkei1cP2E2UK5HdMGZ7N875/u240wB+DesuT7lhLsoegOks8343ZupwuLnS/wOemUI2gXBBJ5F4aKcuEJ3L8ai0E/jOzTuWmUF+5MBK5ezBt5a4CsngqDRyaYw6PQIaDzHwpyzKkQ7MrwvmheV/BPUVauFTQFZU56WCjZXO65v4IeKD/GY1/6GsgY1nvnDV8YqWfA== X-MS-Exchange-CrossTenant-Network-Message-Id: af1ff55e-fd3b-4336-593d-08dc4200b49c X-MS-Exchange-CrossTenant-AuthSource: MN0PR11MB6059.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2024 19:23:17.9806 (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: QyJk0BtvTepwPYGS2wCekCFDcmBG4+LUHz+pqk4VqFeRkncVIFec3lN3KXQ6Kd6quakkLqZSByuIRkAztaQRDA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR11MB4526 X-OriginatorOrg: intel.com X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" The mem_access itself is not holding any lock, but attempting to train lockdep with possible scarring locks happening during runtime pm. We are going soon to kill the mem_access get and put helpers in favor of direct xe_pm_runtime calls, so let's just move this lock around to where it now belongs. v2: s/lockdep_training/lockdep_prime (Matt Auld) Reviewed-by: Matthew Auld Signed-off-by: Rodrigo Vivi --- drivers/gpu/drm/xe/xe_device.c | 23 ----------------- drivers/gpu/drm/xe/xe_device.h | 4 --- drivers/gpu/drm/xe/xe_pm.c | 45 ++++++++++++++++++++++++++++------ 3 files changed, 37 insertions(+), 35 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c index 919ad88f0495..49a413725c8f 100644 --- a/drivers/gpu/drm/xe/xe_device.c +++ b/drivers/gpu/drm/xe/xe_device.c @@ -45,12 +45,6 @@ #include "xe_vm.h" #include "xe_wait_user_fence.h" -#ifdef CONFIG_LOCKDEP -struct lockdep_map xe_device_mem_access_lockdep_map = { - .name = "xe_device_mem_access_lockdep_map" -}; -#endif - static int xe_file_open(struct drm_device *dev, struct drm_file *file) { struct xe_device *xe = to_xe_device(dev); @@ -702,23 +696,6 @@ void xe_device_mem_access_get(struct xe_device *xe) if (xe_pm_read_callback_task(xe) == current) return; - /* - * Since the resume here is synchronous it can be quite easy to deadlock - * if we are not careful. Also in practice it might be quite timing - * sensitive to ever see the 0 -> 1 transition with the callers locks - * held, so deadlocks might exist but are hard for lockdep to ever see. - * With this in mind, help lockdep learn about the potentially scary - * stuff that can happen inside the runtime_resume callback by acquiring - * a dummy lock (it doesn't protect anything and gets compiled out on - * non-debug builds). Lockdep then only needs to see the - * mem_access_lockdep_map -> runtime_resume callback once, and then can - * hopefully validate all the (callers_locks) -> mem_access_lockdep_map. - * For example if the (callers_locks) are ever grabbed in the - * runtime_resume callback, lockdep should give us a nice splat. - */ - lock_map_acquire(&xe_device_mem_access_lockdep_map); - lock_map_release(&xe_device_mem_access_lockdep_map); - xe_pm_runtime_get(xe); ref = atomic_inc_return(&xe->mem_access.ref); diff --git a/drivers/gpu/drm/xe/xe_device.h b/drivers/gpu/drm/xe/xe_device.h index 14be34d9f543..2653f53bee4e 100644 --- a/drivers/gpu/drm/xe/xe_device.h +++ b/drivers/gpu/drm/xe/xe_device.h @@ -16,10 +16,6 @@ struct xe_file; #include "xe_force_wake.h" #include "xe_macros.h" -#ifdef CONFIG_LOCKDEP -extern struct lockdep_map xe_device_mem_access_lockdep_map; -#endif - static inline struct xe_device *to_xe_device(const struct drm_device *dev) { return container_of(dev, struct xe_device, drm); diff --git a/drivers/gpu/drm/xe/xe_pm.c b/drivers/gpu/drm/xe/xe_pm.c index 847b263afe70..393f14411ae0 100644 --- a/drivers/gpu/drm/xe/xe_pm.c +++ b/drivers/gpu/drm/xe/xe_pm.c @@ -68,6 +68,12 @@ * management (RPS). */ +#ifdef CONFIG_LOCKDEP +struct lockdep_map xe_pm_runtime_lockdep_map = { + .name = "xe_pm_runtime_lockdep_map" +}; +#endif + /** * xe_pm_suspend - Helper for System suspend, i.e. S0->S3 / S0->S2idle * @xe: xe device instance @@ -297,11 +303,11 @@ int xe_pm_runtime_suspend(struct xe_device *xe) xe_pm_write_callback_task(xe, current); /* - * The actual xe_device_mem_access_put() is always async underneath, so + * The actual xe_pm_runtime_put() is always async underneath, so * exactly where that is called should makes no difference to us. However * we still need to be very careful with the locks that this callback * acquires and the locks that are acquired and held by any callers of - * xe_device_mem_access_get(). We already have the matching annotation + * xe_runtime_pm_get(). We already have the matching annotation * on that side, but we also need it here. For example lockdep should be * able to tell us if the following scenario is in theory possible: * @@ -309,15 +315,15 @@ int xe_pm_runtime_suspend(struct xe_device *xe) * lock(A) | * | xe_pm_runtime_suspend() * | lock(A) - * xe_device_mem_access_get() | + * xe_pm_runtime_get() | * * This will clearly deadlock since rpm core needs to wait for * xe_pm_runtime_suspend() to complete, but here we are holding lock(A) * on CPU0 which prevents CPU1 making forward progress. With the - * annotation here and in xe_device_mem_access_get() lockdep will see + * annotation here and in xe_pm_runtime_get() lockdep will see * the potential lock inversion and give us a nice splat. */ - lock_map_acquire(&xe_device_mem_access_lockdep_map); + lock_map_acquire(&xe_pm_runtime_lockdep_map); /* * Applying lock for entire list op as xe_ttm_bo_destroy and xe_bo_move_notify @@ -343,7 +349,7 @@ int xe_pm_runtime_suspend(struct xe_device *xe) xe_irq_suspend(xe); out: - lock_map_release(&xe_device_mem_access_lockdep_map); + lock_map_release(&xe_pm_runtime_lockdep_map); xe_pm_write_callback_task(xe, NULL); return err; } @@ -363,7 +369,7 @@ int xe_pm_runtime_resume(struct xe_device *xe) /* Disable access_ongoing asserts and prevent recursive pm calls */ xe_pm_write_callback_task(xe, current); - lock_map_acquire(&xe_device_mem_access_lockdep_map); + lock_map_acquire(&xe_pm_runtime_lockdep_map); /* * It can be possible that xe has allowed d3cold but other pcie devices @@ -400,11 +406,31 @@ int xe_pm_runtime_resume(struct xe_device *xe) goto out; } out: - lock_map_release(&xe_device_mem_access_lockdep_map); + lock_map_release(&xe_pm_runtime_lockdep_map); xe_pm_write_callback_task(xe, NULL); return err; } +/* + * For places where resume is synchronous it can be quite easy to deadlock + * if we are not careful. Also in practice it might be quite timing + * sensitive to ever see the 0 -> 1 transition with the callers locks + * held, so deadlocks might exist but are hard for lockdep to ever see. + * With this in mind, help lockdep learn about the potentially scary + * stuff that can happen inside the runtime_resume callback by acquiring + * a dummy lock (it doesn't protect anything and gets compiled out on + * non-debug builds). Lockdep then only needs to see the + * xe_pm_runtime_lockdep_map -> runtime_resume callback once, and then can + * hopefully validate all the (callers_locks) -> xe_pm_runtime_lockdep_map. + * For example if the (callers_locks) are ever grabbed in the + * runtime_resume callback, lockdep should give us a nice splat. + */ +static void pm_runtime_lockdep_prime(void) +{ + lock_map_acquire(&xe_pm_runtime_lockdep_map); + lock_map_release(&xe_pm_runtime_lockdep_map); +} + /** * xe_pm_runtime_get - Get a runtime_pm reference and resume synchronously * @xe: xe device instance @@ -416,6 +442,7 @@ void xe_pm_runtime_get(struct xe_device *xe) if (xe_pm_read_callback_task(xe) == current) return; + pm_runtime_lockdep_prime(); pm_runtime_resume(xe->drm.dev); } @@ -445,6 +472,7 @@ int xe_pm_runtime_get_ioctl(struct xe_device *xe) if (WARN_ON(xe_pm_read_callback_task(xe) == current)) return -ELOOP; + pm_runtime_lockdep_prime(); return pm_runtime_get_sync(xe->drm.dev); } @@ -511,6 +539,7 @@ bool xe_pm_runtime_resume_and_get(struct xe_device *xe) return true; } + pm_runtime_lockdep_prime(); return pm_runtime_resume_and_get(xe->drm.dev) >= 0; } From patchwork Mon Mar 11 19:22:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Vivi X-Patchwork-Id: 13589286 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 3195DC54E58 for ; Mon, 11 Mar 2024 19:23:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B9171112C26; Mon, 11 Mar 2024 19:23:28 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="Viy1ZR7a"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) by gabe.freedesktop.org (Postfix) with ESMTPS id E17D7112C25 for ; Mon, 11 Mar 2024 19:23:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710185008; x=1741721008; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=5kbhf1xbAIctSZ8eqpCnNc4Fe/rt3++0NZGwxm7kKJY=; b=Viy1ZR7ayBNN69Z2uWU63Bb5wyVvcT3Zbfr4ghqoW4KcUf591S0YveAx JksoL2nBsQKiZIbAS8/mlcEpa9oNUUvw7yl8bCrebPD9OSRyRP68R15fU iR97HF2yonDRhw93+S3QGS/N+dsCIoU/NxM/pn4KnENWuXtinOP19ylIF eDr4vtcZ/lQgtWaYr6n8ul4p71v+hvz3CY8818SvOzdJw0WV3ShOCtSq+ Mczz1cPcTjP3ave5RB6fWf3aFle8A5Y01azxgr8dR+aQLWBHVuOaw5DlL HAtzAUIHM8ZLKk3p4NnNFXoOVlnDqKJukS2zjuzXyD//c0kAU7sNmjFFF g==; X-IronPort-AV: E=McAfee;i="6600,9927,11010"; a="8627089" X-IronPort-AV: E=Sophos;i="6.07,117,1708416000"; d="scan'208";a="8627089" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Mar 2024 12:23:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,117,1708416000"; d="scan'208";a="11344286" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orviesa009.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 11 Mar 2024 12:23:27 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 11 Mar 2024 12:23:26 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Mon, 11 Mar 2024 12:23:26 -0700 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (104.47.56.40) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 11 Mar 2024 12:23:23 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i61uHw1GK64jCWfrj97vkJ4t1sY/ePv+/sRuYqm0HRTtTbJGwhM3KaTaT57DhVMnY6dBIdlvlDtfrLAlhGE5CfyG8yj2KR3Hc3Gi0sjslIHxbe83TGuMRzR+2yTm7d6gyVkAMCute847LZ48f2DPfP+yY3uoeSbLGkHce9/HAFFwB/CNESTZWvPhFLIPPUoHepQEbi3tUqVXp6y6f0GVGvH1VfhqdeFfYyCvQkh7L7wO8EL4qcs9kgGoUHch7hlK7kF/ifTUBOUX+JZ9WG15TWjsbQUjZuwI79y/DplKv4YRxFw0Hhl/CRyZ2ZInYtGBfTLFF5Tc4sul7hBt6HN02A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=eEgnDhXMzqO3WTV37HUuAMsl+sCzS5xhJh1fZhnSdyo=; b=ZqspX2rRD1IrkpghqCT9epoPJdhQRE1I3EbUI3jQ1WxFm7Ey3diuh4uSOMzZ1P84W3uS2F0XIszGtntht84RZD7lkej8c+YKws4A79J8W5Uz3qiIMaUreHmXZ/yn+WQcjSFK0Oaqyqnm8ZTFT/8axQDMJ0oLxXL20SY4ZRBxKCr19LQvA47IfqvtWmpoUSjvbuZT2xcH3j7mWvc8bHC02JVjnU/Qzh6ycwh+H1Y1keil7iUcj04eJbgCoheEn9NIrgfC7ptyWMdMBTsOxZkQStb9iP2x3+rhX+pzEMOMpPuuSsq3lyMtVF5Pafpn7fTmLJjvNXa8O9wHw6Eb87xi5g== 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: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from MN0PR11MB6059.namprd11.prod.outlook.com (2603:10b6:208:377::9) by SA0PR11MB4526.namprd11.prod.outlook.com (2603:10b6:806:96::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.16; Mon, 11 Mar 2024 19:23:21 +0000 Received: from MN0PR11MB6059.namprd11.prod.outlook.com ([fe80::7607:bd60:9638:7189]) by MN0PR11MB6059.namprd11.prod.outlook.com ([fe80::7607:bd60:9638:7189%4]) with mapi id 15.20.7386.016; Mon, 11 Mar 2024 19:23:21 +0000 From: Rodrigo Vivi To: CC: Rodrigo Vivi Subject: [PATCH 05/11] drm/xe: Convert GSC HDCP from mem_access to direct xe_pm_runtime calls Date: Mon, 11 Mar 2024 15:22:57 -0400 Message-ID: <20240311192303.33961-5-rodrigo.vivi@intel.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240311192303.33961-1-rodrigo.vivi@intel.com> References: <20240311192303.33961-1-rodrigo.vivi@intel.com> X-ClientProxiedBy: SJ0PR05CA0088.namprd05.prod.outlook.com (2603:10b6:a03:332::33) To MN0PR11MB6059.namprd11.prod.outlook.com (2603:10b6:208:377::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN0PR11MB6059:EE_|SA0PR11MB4526:EE_ X-MS-Office365-Filtering-Correlation-Id: 38bf6f1a-06b9-4d51-aedd-08dc4200b6c2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: P54rz2LDZ43Creq4sh0LHLJRvv7heHiznv0Cx2oIiLLmyOjh4Cb2Y4kX9wrbf05qzm5XSiJFA/kwDAjQdC1M6XkJejoOnWPeAJKYcWvRO+XpLpDi8pdAxBQUNFaVIK4ZLETwGN6BzxEariryOvD0YPzYcS3gxIeJ+U/S/lJmQGf6rdn4wJOdTdQbKBHvraBY1fxotjm3Bz5LRci/Jk4VtwTZUeRf1joWggdLRpFUoKNBZWk7+oju6ohEw5cBnc9V60b28OnavSOJZ82YdxSg3AvCipJFb79Syx2xj25/OKifA16Lws0/ZFHTwPuyvNFfzaqKcobuaqHCAiSKnvvhQsvwnkWctN0TnxJMEht+C9JzsXhmBQe1AQLlFNqS02+AeUUXx4vpvHD7KWgKLIpm66QfVLxY58IqJ25IeYlSY+OtcoJkmszMYfhg3hUPl1/2HUQn1an0Q3I5GaWV9E4ID+f/Fe/fYGWY/yUM26IMm3I5mg1C3L7sHtpQaElcTmj7r4msNx/gYv86c70v8lmmtwwfPUhpunuj9dpgQDOLdhhpmaE7TVPbAaHvyfne+USjTPqq1zhee6x6VCnEWH0aHOAAb+C71imzzDY9F86FRfia+6wRDgwidJMwq1roRhjMZePYbUQ82DxJAUmfUoI8nR26I8F34/ay1zyelO7wipk= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN0PR11MB6059.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(1800799015)(376005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: u92Ovrm62PPA2VIxWssUcJ2PXmqg75PCu6q9u1OstUoD8bgaDpZHcJQ/BUIZ9yBo9bS2yQ8Y1KCN3AcI59Q4VTkePYdHaD4UolPG2R0tVlNAmEZdbUVmu8Bwm6ZNZMBUsBomYAtxkFKxtnM8F1v+p6hbthV4nXh/TZpGyMTVneLK6cT4Ap8/7+D41iQIM3dnx5Ltgc432hcdp1xnyogc1ntrWSMJbWwg9KrX2dt0tZeRjE7gZsZWflZugnKGykKBWLSHzIB1hEb8Ers75pBJ0GcYTUiYauGPI3X9hemKWtf6ymhKNDwDiE1+8LdUKrT2kC6Dakc/yo/4Z7YS2luDJpTgsg7c4tAEeFBFI1nCnrDbo7BUn2s8A5Iq37glanNoD5LAzi/Y6SHwpq3MRmi3cCrvp1YcfJnAAQ6Pn9JQnlUCiGpfTMW259dyFMFqrcmNO1R6Lm6j8p3nfHITl3qZPhC6PJEJmYs5eIZ5Eimq0PzoTyHnEzFA3ArB7PMrfpho1XfnDjJfsWMumWWsAONEhNTs7koVya5zHobC0MXjn1UpFdyBhLcdLoTkoqMZdR8fn+SuopJL7Iq6NLJbIEbUFlR05WEgM37Qp1I/IRjPUtXmL/U33JSyZUAQcfnjBEL0qY6FNbo6HBFxhofeW/apKifTLlus6TRUM29EwuhUXGIbyj8xUZFawAeFTfhEO73vdhKCJ6IDKJn8lnffdqp+FhIivN5Q1+kGz6TVgbMFkr05s792K9iGV6WF2fV6UWGD5vUWCyQC6SoHSQ9cnk0MXK8w47EeK/v9rKWRNH2gx9qxZ2Q0cmYnlNxyqA98KZivjOPsIi7KoFd2uvIbPq56LyWeeHYU+qTOPczfG+1LVEpsxsVWd5EIl+4TWdh2zeOq79KVj+7W2f/sHK0alV/QvqWzQWC2FDG1ZYwBuC7hsi2GwOpmnCoaHSGb/bDflUTUTYBOdLhaBPngSOcT1rMLao99qK4wHtuwTcCjqVLVvy8yn5wfqb3i8VpKX49K9SAOSXcHNeYUMwW8qfQ6o4GOzr3oWV+qeMXB5pMmeVWeVaizIUKY2aIDm7eecFYK9qL/IkL+4FoQdkDLmdgQkt/weSyh/zHiN4ZsJnZLHfeKVXthL2if90dEDuRVJ/7EYNzdAi5Vxi0gwNVy9AlBia1oWJyA1tRG6xCWPwCzbrK2iqOX5Cd+KQU3xCuT8FD43Ev9VuuFEcOZ4GRCvIxHJHujd5mBQlFv24RgBA1Fxh4lRL2qrLGG34CQWtfld4ZyEx/WujlZv+h5bcndJE54yOk7NFui4v5hMt95orOtJW35fg5vH3Ugg+dQSzRdqSfmT9+aVFSvqr7L7beaSA6XwXcuhn2aTf3LUyUwlT13tz8CYKIlQpUiBzPGlmueyZLdkiEcfTDLn6XZ8y1b5Yr0K/9w04tf9Oyo4xA0g7Ps+lu0SI+q4goNEz5NfAfbQJxsJM4Lk3rg2+IMnYu5UKXyDy1GAO9jKqVeF//vGNWb5XNUH2YiGxTxQhwH+jBJywilUBcmovbtVuJBIPH3ch/0yxONCEWE1ulr3FZTyX3+cqY4YkAgN1H0IXbeEfKdvRsBpTRbyFyOQhFIo+509RxOJtyT1w== X-MS-Exchange-CrossTenant-Network-Message-Id: 38bf6f1a-06b9-4d51-aedd-08dc4200b6c2 X-MS-Exchange-CrossTenant-AuthSource: MN0PR11MB6059.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2024 19:23:21.5671 (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: TBJ5GhbgJu4ZTK2MFOLXBcvyU9aGiyjZLmMLWOOBumRTP7nY3NbFv3h0/HPkPXTMadc+iVnpDjz8dsrQD5vA3Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR11MB4526 X-OriginatorOrg: intel.com X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" We need to convert so we can continue to kill the mem_access. At this point we should be protected by the display wakerefs already, so let's use the noresume variant. Signed-off-by: Rodrigo Vivi --- drivers/gpu/drm/xe/display/xe_hdcp_gsc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c b/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c index 25c73602ef55..a221f0cf4bac 100644 --- a/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c +++ b/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c @@ -217,7 +217,7 @@ ssize_t intel_hdcp_gsc_msg_send(struct xe_device *xe, u8 *msg_in, addr_out_off = PAGE_SIZE; host_session_id = xe_gsc_create_host_session_id(); - xe_device_mem_access_get(xe); + xe_pm_runtime_get_noresume(xe); addr_in_wr_off = xe_gsc_emit_header(xe, &hdcp_message->hdcp_bo->vmap, addr_in_wr_off, HECI_MEADDRESS_HDCP, host_session_id, msg_in_len); @@ -249,6 +249,6 @@ ssize_t intel_hdcp_gsc_msg_send(struct xe_device *xe, u8 *msg_in, msg_out_len); out: - xe_device_mem_access_put(xe); + xe_pm_runtime_put(xe); return ret; } From patchwork Mon Mar 11 19:22:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Vivi X-Patchwork-Id: 13589287 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 AE8ABC54E5D for ; Mon, 11 Mar 2024 19:23:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 37880112C25; Mon, 11 Mar 2024 19:23:29 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="XpVTfd+1"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) by gabe.freedesktop.org (Postfix) with ESMTPS id AF028112C25 for ; Mon, 11 Mar 2024 19:23:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710185008; x=1741721008; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=D+RihmXYC+bAQsE4LJEaV9QlNfMYv6I2owL6UZ7uuqY=; b=XpVTfd+1y2lbsBPuVV2kxwsptzxokTnUdk7NiBgVXiFTm5SXlGtjFzSV 5DezIMn0YZf5gBzkz3YYZVUvPA8qDjkd+rJ6PUnNxJHaa2EN2eFdTJk4w UnNo6JMbn961kprNG72EHzrpEidvV25t4yrIXABmYcDMOv9FOJO+UB1Ww J4unWEZRZq35SB4IR5FQ8gJO+a9ijKxlj53BJsGu4Z9ql5LE+tDYaUIye lzRMjgbksFr3APaGFPUBhfVWKsQF7Pt7AEqQz4YESGxhDdG93Ec1bSAxw 9DwlUsqN7C+59Mtemm1OiOd/AyFMHZbznsWtAVSsZIdjcXfjr8u2nCsdb Q==; X-IronPort-AV: E=McAfee;i="6600,9927,11010"; a="8627090" X-IronPort-AV: E=Sophos;i="6.07,117,1708416000"; d="scan'208";a="8627090" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Mar 2024 12:23:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,117,1708416000"; d="scan'208";a="11344297" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orviesa009.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 11 Mar 2024 12:23:28 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 11 Mar 2024 12:23:27 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Mon, 11 Mar 2024 12:23:27 -0700 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (104.47.56.40) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 11 Mar 2024 12:23:26 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bmNmAoPesbGDnSAg4/JQV/WiwaSX+JrPP0jzTsi61mrjzLNNS+Qr0GriNeMRIzI3eHupXpF3UJyTbW/fTQmt2yoLp++Y+P0sc+xVaySP0mBmmsZ93sn5aB1M581g6ph87ZIJWUy7L5H93Z8ZdE4nPtkNOGyY94RGHWxmAgLmf1ijRQwjJufc2/Pl1dbgOZJlwQGmDuAH+Lfs9T1YDIapZZaUBhOYFufsBDeAEe8ZrGgcacsviS1Lnl+oMLQltSzzAPuFYEwgTFlN41qQGEO7QmQudexTkPxbKDrvB1CdmPp2lG/kvahGHhkStjymP/Cd7rNnE15IvPAG2V1hvS7R3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=24zD2mAbeMS+ji9nUAohFYLguz2LBzIyZuIrnbwaUs4=; b=hI25wljb3tVF0N2qnQa0ikurVKq638I/ldLiAJuEwsfACaPytnRpCqEamOUczj9ZhWc23FP9oYqoRB4aFtQABRjwzQg81PaRtdW/sinrBGMDEDhEOqhFG/8DXayMcs472WFpvFHHPEMnaeiazFkB7T3y/zVdGKWVj3q8p8xhLjigUMmn8ufOJCKUj1dTTcNn2ZohfjbIl8u4N5oh6JczGpR8pVGy8HgTYMuGgUIBNRiaUKrdvB6QIJmbH7zCZOLvcXlSqF1PE3gr3zAoftCjVi21zeTZmn1dMb2oB+YbzMcs2CUrL2Q5DAAlIIIODpqZ5nkijONGIFXbGQUxvV69oA== 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: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from MN0PR11MB6059.namprd11.prod.outlook.com (2603:10b6:208:377::9) by SA0PR11MB4526.namprd11.prod.outlook.com (2603:10b6:806:96::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.16; Mon, 11 Mar 2024 19:23:25 +0000 Received: from MN0PR11MB6059.namprd11.prod.outlook.com ([fe80::7607:bd60:9638:7189]) by MN0PR11MB6059.namprd11.prod.outlook.com ([fe80::7607:bd60:9638:7189%4]) with mapi id 15.20.7386.016; Mon, 11 Mar 2024 19:23:25 +0000 From: Rodrigo Vivi To: CC: Rodrigo Vivi , Matthew Auld Subject: [PATCH 06/11] drm/xe: Remove useless mem_access during probe Date: Mon, 11 Mar 2024 15:22:58 -0400 Message-ID: <20240311192303.33961-6-rodrigo.vivi@intel.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240311192303.33961-1-rodrigo.vivi@intel.com> References: <20240311192303.33961-1-rodrigo.vivi@intel.com> X-ClientProxiedBy: SJ0PR03CA0210.namprd03.prod.outlook.com (2603:10b6:a03:2ef::35) To MN0PR11MB6059.namprd11.prod.outlook.com (2603:10b6:208:377::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN0PR11MB6059:EE_|SA0PR11MB4526:EE_ X-MS-Office365-Filtering-Correlation-Id: efe6835a-34e5-4f79-dbaa-08dc4200b8c4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TsYfl0q3NNLMEQInE2nzeAzs8rp2WnBMxbnY9zVHjNrTZ+uaUNaSa4BWw9lYwHYiRZy2A/K1+1u0+kNFK5ipnq+ti+BZ1zS4Zcz1Y/0s696E0+vcKHkssECnLpiQ/eiGLSVtg456ui/0fIahHfcqZlDIg+z4jBffHosU27wLGcWjkz+5OfAl/cyRZT9YLT9ZTOyH/aQ6UICQfJmMPVNnt2ns7tBc7DjuYGz1IT7nCak5Uocmr5mh4Apuot6ssLnQjzK11Ezimm/C4FUUACxf0bW/alH+l1PKDzLe41gkI6CZrzbFhS0BkAXIDLMM382MgI01DKO4r9IjxtuiMoTlO7ozTXZnT9a4lEWjr6bbOIvt2xYs5b64Gj5Yl+f17EIsyfe6gcGdZTMUivCYSd7h3pyVwsCBgtzk+CfjaZRdt0ecHhOK32rMurs97uQ9omtDh5JdgorR0xJ2q7hUN4wCX+bW0lByVPxKiNal2LrifYETn404on8XT/jaLTLGFluOLkcXZelZux4wrudo5nAMWWA2vQOo17E4RUal8B94zJOk6smLm/S3QqaEDLc2rQxzUQJKUG00dWRgpxJ8LTQWmhym8aBiZKJJZpa2zwh21wFN4btdryx0fOMLK697gRGjwLmBLRsThGpQ6a5XVPTnT1X0DA8lwg+pLAJZn84Ovu8= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN0PR11MB6059.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(1800799015)(376005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: A7M8MZ073fmEl+z8ImG8Ro5uRP1zwOIclat9+FV5vZ8zIOtqa+x+/iy1pO08rsHwWdYsAzETjD7uZoGQdJJcHo7Wttgyy6lW1hpFOVBk72mTnYyq7ol4X9pstd5wpLaQfcyyZkMTrIucLLF/8bZGMjabg7kXwD4I71bO/unFbeLKC2fH1ZcPXXy28FDsNEPgBvpWVIB+dEhDU+2q/5z9gokDCKY/JvYZllwcsSZbV87XoykMx1WlM9+GUtzDv74aNWMK2uRP/pvtXxyrbfUnoH+yX93r+EqMbYJiNEO79vXJ9H7q/BA6I6D6uSRuQxouTpI3NGEqk7sBJDjPiNY0XTf5IXOmjh0AoDIDYhoBsJgh3w6V1CzhssG0iGAwHQ/iwtvyB9s0tal/WwJY7DQNqME+MkZnKDDFaJNIcs9P4kWdJSbWkS4ZA6fiQ9L5GHKrRmCucPTiU30EXho55zhNyTGUx5xwkPPoPs+qtWiHL6j3+EfCCfUEwiJMJX1eBeUbDbRbVXn9FcyEaNPf+VHr36PAHeI13NKunfX8FoM6K+9GI+o/oq6ZH480nxMBnlUhumponi/kTzqF79CG8QiMCMVr4qkA+t2McHiyKbrV5AVRoj3ikEBbptvWL2T3Y5J0fbWJ5Nb7qm/S3v2cS9Igc+BoPKRdY3LKIamBY5aKJ8SCHKx4TSX7vgZNvKop7GUtQXDSTqJH7J55giM7tEIHYHTI4rytT8EdfyW8eHg37eGKjeEwEL6r4LaDrfxcG/Rp7HDrYr62LKFJeeVfZsCkO3YmcUi9I1U+yFUpCZcUeMvC36LfYR3ueO+tCztm/U1VRtjm2YG4gjBqdO0DUY4a1reRiWv3jDYAlE06HlE8m2yT3iUtGMdEfITjO+klZCv85Tk7ckkEEBTvvGCCHuLk683cyKX9rSAMYfUuuq/VWZYdHsKACbVNM4yeOhThQn1ksg/BiJmIFQW2Ni8KF3HiJoUcDvPrdvZgScRnPFGV1u90fQBWPngM5s4ZoobJGfJu9q+5XcrDDgQKsgDTOG7RkbSaBPxI42X0pCaj3pEK8u0wP+vyzbssMOL//ykmuK3LGqgH+BgK3sq1Ms6EOzkETQaq8Iq3O16SoXJhuciDqFe6r0WSZ+LZjL5c5GxHzZ0nwl7KSrb6Q3ThvuveShBJyyNV3xfbRsNqc8pubbXER+sKqU/F5IOPgXXvhFN1gH4L7pRJ20eNe2KgKGHQ7ga6dwv01Mc18ZvxY/Tx4lzYrhyVuohsOZRnc0rgrwiPOpiJl7XwCMDO2V3hikfI8cZvxm5KbFIWg10WOnG5t6GfR1NPZnqEvnFuYtNVBA3RfXWZ+e1qEj1z+0yBWFfPNw2d0kMQ1AjMHSalzSpk8CT8e38C4govkASttreMbYOEqpLWqRRiqbqYWKQOSOmTmzZ/NgiiyyBfa8DdcN14b2edpMhlIdk+kTayRhZqtIECH6xEZkS+Ec3tfPzfX0rbdqSVKVbqx4VxuM16RmRa4KcuW9r/iQJRypCnVzoKA5WlEm8pF0eC/o8xAF740h+2KEJs68+3oDgcYzUhk8lgBSS6eXkNCT6SrVJUBkt1ZWh65eBvTyCTCvftJ3skEVvM6A+Wog== X-MS-Exchange-CrossTenant-Network-Message-Id: efe6835a-34e5-4f79-dbaa-08dc4200b8c4 X-MS-Exchange-CrossTenant-AuthSource: MN0PR11MB6059.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2024 19:23:24.9244 (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: hJZf12zJiwLBvEMrhjgdHpLe1b5MyaA79S83j3qoewyYj7NLGIjK/vUaB4Xa9b+VmQSX9w2rQJ9q0ByhDznhnA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR11MB4526 X-OriginatorOrg: intel.com X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" xe_pm_init is the very last thing during the xe_pci_probe(), hence these protections are useless from the point of view of ensuring that the device is awake. Let's remove it so we continue towards the goal of killing xe_device_mem_access. v2: Adding more cases v3: Provide a separate fix for xe_tile_init_noalloc return (Matt) Adding a new case where display HDCP init calls which are also called at display probe time. Cc: Matthew Auld Signed-off-by: Rodrigo Vivi Reviewed-by: Matthew Auld --- drivers/gpu/drm/xe/display/xe_hdcp_gsc.c | 2 -- drivers/gpu/drm/xe/xe_ggtt.c | 2 -- drivers/gpu/drm/xe/xe_gt.c | 9 --------- drivers/gpu/drm/xe/xe_tile.c | 15 +++++---------- drivers/gpu/drm/xe/xe_uc.c | 11 ----------- 5 files changed, 5 insertions(+), 34 deletions(-) diff --git a/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c b/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c index a221f0cf4bac..b2bd56a9b76d 100644 --- a/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c +++ b/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c @@ -70,7 +70,6 @@ static int intel_hdcp_gsc_initialize_message(struct xe_device *xe, int ret = 0; /* allocate object of two page for HDCP command memory and store it */ - xe_device_mem_access_get(xe); bo = xe_bo_create_pin_map(xe, xe_device_get_root_tile(xe), NULL, PAGE_SIZE * 2, ttm_bo_type_kernel, XE_BO_CREATE_SYSTEM_BIT | @@ -90,7 +89,6 @@ static int intel_hdcp_gsc_initialize_message(struct xe_device *xe, hdcp_message->hdcp_cmd_in = cmd_in; hdcp_message->hdcp_cmd_out = cmd_out; out: - xe_device_mem_access_put(xe); return ret; } diff --git a/drivers/gpu/drm/xe/xe_ggtt.c b/drivers/gpu/drm/xe/xe_ggtt.c index 325337c38961..0f96b7db6dcc 100644 --- a/drivers/gpu/drm/xe/xe_ggtt.c +++ b/drivers/gpu/drm/xe/xe_ggtt.c @@ -206,14 +206,12 @@ static void xe_ggtt_initial_clear(struct xe_ggtt *ggtt) u64 start, end; /* Display may have allocated inside ggtt, so be careful with clearing here */ - xe_device_mem_access_get(tile_to_xe(ggtt->tile)); mutex_lock(&ggtt->lock); drm_mm_for_each_hole(hole, &ggtt->mm, start, end) xe_ggtt_clear(ggtt, start, end - start); xe_ggtt_invalidate(ggtt); mutex_unlock(&ggtt->lock); - xe_device_mem_access_put(tile_to_xe(ggtt->tile)); } int xe_ggtt_init(struct xe_ggtt *ggtt) diff --git a/drivers/gpu/drm/xe/xe_gt.c b/drivers/gpu/drm/xe/xe_gt.c index 85408e7a932b..063b710a8c7b 100644 --- a/drivers/gpu/drm/xe/xe_gt.c +++ b/drivers/gpu/drm/xe/xe_gt.c @@ -347,7 +347,6 @@ static int gt_fw_domain_init(struct xe_gt *gt) { int err, i; - xe_device_mem_access_get(gt_to_xe(gt)); err = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT); if (err) goto err_hw_fence_irq; @@ -389,7 +388,6 @@ static int gt_fw_domain_init(struct xe_gt *gt) err = xe_force_wake_put(gt_to_fw(gt), XE_FW_GT); XE_WARN_ON(err); - xe_device_mem_access_put(gt_to_xe(gt)); return 0; @@ -399,7 +397,6 @@ static int gt_fw_domain_init(struct xe_gt *gt) err_hw_fence_irq: for (i = 0; i < XE_ENGINE_CLASS_MAX; ++i) xe_hw_fence_irq_finish(>->fence_irq[i]); - xe_device_mem_access_put(gt_to_xe(gt)); return err; } @@ -408,7 +405,6 @@ static int all_fw_domain_init(struct xe_gt *gt) { int err, i; - xe_device_mem_access_get(gt_to_xe(gt)); err = xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL); if (err) goto err_hw_fence_irq; @@ -474,7 +470,6 @@ static int all_fw_domain_init(struct xe_gt *gt) err = xe_force_wake_put(gt_to_fw(gt), XE_FORCEWAKE_ALL); XE_WARN_ON(err); - xe_device_mem_access_put(gt_to_xe(gt)); return 0; @@ -483,7 +478,6 @@ static int all_fw_domain_init(struct xe_gt *gt) err_hw_fence_irq: for (i = 0; i < XE_ENGINE_CLASS_MAX; ++i) xe_hw_fence_irq_finish(>->fence_irq[i]); - xe_device_mem_access_put(gt_to_xe(gt)); return err; } @@ -496,7 +490,6 @@ int xe_gt_init_hwconfig(struct xe_gt *gt) { int err; - xe_device_mem_access_get(gt_to_xe(gt)); err = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT); if (err) goto out; @@ -519,8 +512,6 @@ int xe_gt_init_hwconfig(struct xe_gt *gt) out_fw: xe_force_wake_put(gt_to_fw(gt), XE_FW_GT); out: - xe_device_mem_access_put(gt_to_xe(gt)); - return err; } diff --git a/drivers/gpu/drm/xe/xe_tile.c b/drivers/gpu/drm/xe/xe_tile.c index 0650b2fa75ef..74ecb5f39438 100644 --- a/drivers/gpu/drm/xe/xe_tile.c +++ b/drivers/gpu/drm/xe/xe_tile.c @@ -160,24 +160,19 @@ int xe_tile_init_noalloc(struct xe_tile *tile) { int err; - xe_device_mem_access_get(tile_to_xe(tile)); - err = tile_ttm_mgr_init(tile); if (err) - goto err_mem_access; + return err; tile->mem.kernel_bb_pool = xe_sa_bo_manager_init(tile, SZ_1M, 16); - if (IS_ERR(tile->mem.kernel_bb_pool)) { - err = PTR_ERR(tile->mem.kernel_bb_pool); - goto err_mem_access; - } + if (IS_ERR(tile->mem.kernel_bb_pool)) + return PTR_ERR(tile->mem.kernel_bb_pool); + xe_wa_apply_tile_workarounds(tile); xe_tile_sysfs_init(tile); -err_mem_access: - xe_device_mem_access_put(tile_to_xe(tile)); - return err; + return 0; } void xe_tile_migrate_wait(struct xe_tile *tile) diff --git a/drivers/gpu/drm/xe/xe_uc.c b/drivers/gpu/drm/xe/xe_uc.c index 7033f8c1b431..4feb35c95a1c 100644 --- a/drivers/gpu/drm/xe/xe_uc.c +++ b/drivers/gpu/drm/xe/xe_uc.c @@ -32,11 +32,8 @@ uc_to_xe(struct xe_uc *uc) /* Should be called once at driver load only */ int xe_uc_init(struct xe_uc *uc) { - struct xe_device *xe = uc_to_xe(uc); int ret; - xe_device_mem_access_get(xe); - /* * We call the GuC/HuC/GSC init functions even if GuC submission is off * to correctly move our tracking of the FW state to "disabled". @@ -65,16 +62,8 @@ int xe_uc_init(struct xe_uc *uc) goto err; ret = xe_guc_db_mgr_init(&uc->guc.dbm, ~0); - if (ret) - goto err; - - xe_device_mem_access_put(xe); - - return 0; err: - xe_device_mem_access_put(xe); - return ret; } From patchwork Mon Mar 11 19:22:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Vivi X-Patchwork-Id: 13589289 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 AD22FC54E58 for ; Mon, 11 Mar 2024 19:23:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 28B46112C29; Mon, 11 Mar 2024 19:23:38 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="LFv/z1d2"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) by gabe.freedesktop.org (Postfix) with ESMTPS id 74C30112C2A for ; Mon, 11 Mar 2024 19:23:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710185015; x=1741721015; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=SLAy7xb0kIdLBGA8KH7TIdD31kWZ8RwTKjj2aRORC4Q=; b=LFv/z1d2ZYmvAUw905F5wii2NlVFBglnHWyLlLmhVbrV6Sgv5TOBfgOK EAKEutP1LwiIlqPLNQmogl4FblWMoU+3Mj9hdItt2KftInQorgwDXY57J fxG7Je6Y4mN4nk11lOspk2z9BEMMlT3XfpE1h0aVQe/K10qd4sw70nTeH F3Dlv5vkMcQj3aDaHTlwymmavFmP4BTEy1F6ej376yJvm0QENFiCdb8V7 fgB0xDklVvMa9uVHVAlSH1Yr92grhR4TXHbKpgzrRRZolDBE0JMIFYImt wB2LNn+bLvDl2tWh415YD9+3qi615J4ftr62zKsTiWeMok3t/t5xuIHe3 A==; X-IronPort-AV: E=McAfee;i="6600,9927,11010"; a="8627096" X-IronPort-AV: E=Sophos;i="6.07,117,1708416000"; d="scan'208";a="8627096" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Mar 2024 12:23:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,117,1708416000"; d="scan'208";a="11344350" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orviesa009.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 11 Mar 2024 12:23:35 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 11 Mar 2024 12:23:34 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 11 Mar 2024 12:23:33 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Mon, 11 Mar 2024 12:23:33 -0700 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.57.41) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 11 Mar 2024 12:23:33 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lIRsYvdM33qGcAh9ne5GX0pU2cXUkq7uPwMhi11Dj2o5UwH+gkLJN2bVG5I/ljLpNny5shRClA2TcCfWNFyP50jtrTyuXY7YzD6vL/Af14DMnfJeAgl/lJpPRiXHSjoV+MB2/z5umYRDaeS3MADYI67Gy845Ivty+P2LE44MWUbRsJXxcfypfHKMiojZvMRhxgYXfbwt8BO/Us1tIoyruHz0GXHJinOADl0t5802kN1nC+0fdfrkOv3Gsj63KeuK2UUpJLRk8CXSdqT4KdiNk/CxUYUbMhkyEDO0taChHRMKBMb3nfQOR+0R/SvAeV0pDWo684qLHjiJDlcCxpYMwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=wbneBIyhKiLdNGjTGM9EQMuGfLWJx4uRR5IX+6rj/ak=; b=ky1NkllNQoarBLRDcWvg7UdJng/YK4gJ8pDnqkeKFE0Xpw2MNHF1kO+btCEubTAmdsFvr9rq++ro/lTHh2yrx0nH2WDiA31vjv7X7lz6RVByq0Vveh3tcuL0HEFzCRUG+Y2Qj6G+Y7uv508hTvMesmMnEjk0qAfBFLvvkZqyBrT41wr6JVPFfEX+N3CbflLlpiP82UuQqoP5OLBG5LxE0PLBLJsSYLC4J3a4KF39Wg5VO2uM3xsP8GrwkI3dBhqDu12WfrnFJDqWZL3yl51yKHT39X0e7uuQZ64/WelRIJ3ohBUZ6B6YEzDNiJDCqnrgoJ4Zqc3ol6nCKn2LVhisbw== 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: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from MN0PR11MB6059.namprd11.prod.outlook.com (2603:10b6:208:377::9) by SA1PR11MB8253.namprd11.prod.outlook.com (2603:10b6:806:250::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.14; Mon, 11 Mar 2024 19:23:28 +0000 Received: from MN0PR11MB6059.namprd11.prod.outlook.com ([fe80::7607:bd60:9638:7189]) by MN0PR11MB6059.namprd11.prod.outlook.com ([fe80::7607:bd60:9638:7189%4]) with mapi id 15.20.7386.016; Mon, 11 Mar 2024 19:23:28 +0000 From: Rodrigo Vivi To: CC: Rodrigo Vivi , Matthew Auld Subject: [PATCH 07/11] drm/xe: Convert xe_gem_fault to use direct xe_pm_runtime calls Date: Mon, 11 Mar 2024 15:22:59 -0400 Message-ID: <20240311192303.33961-7-rodrigo.vivi@intel.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240311192303.33961-1-rodrigo.vivi@intel.com> References: <20240311192303.33961-1-rodrigo.vivi@intel.com> X-ClientProxiedBy: BYAPR05CA0029.namprd05.prod.outlook.com (2603:10b6:a03:c0::42) To MN0PR11MB6059.namprd11.prod.outlook.com (2603:10b6:208:377::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN0PR11MB6059:EE_|SA1PR11MB8253:EE_ X-MS-Office365-Filtering-Correlation-Id: a87ce7f1-7623-4674-aa71-08dc4200babe X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EuOb+rrwIumGG9N1ic7J2+RhWd8HZhgudfKksOEaGVMVUVPCbdsDmFagmk+++hN7LmfWJ77GaKpqu0MkqmTUQhVdI/IjGQ6u+DkpIHVNdmVO5Rlywwqv6WkNEYPk91R/fxHSkpmOTRulTwF11yVvoBeMsBkOe40eYvQnL94mG/cbGTP3x0sFJ1P0XOqJ/YjICybx/IcphsSDOZ/fdvPOnMmm6Wb92S3CIj9AVsTdNxK3mqXuJaXszg9TsBln5yVdb0ykASd838VyXge/uQIguFzEm11nNd1kyR5KvooWHgLQLglOA2uqDKJPmbGkxfavjP2sVj2RGifPPf7p+eNtiUGDLi5HxJ69Oo04Jl5pAioqgDbOK690FDfQ/mFgHFdRnsAjLAw3zyvtBFHBTLMx0ZN1F5Kb23UxYkC+8AxJMb6beaa7q2aV55J4YC0JDI5WgRpq9whowvejUIQsf+fIjrd3c3+20wiWleeZ2F93HU3U+ud3kep22ZiqWiYT5oDcqP3qzOKCfx3x6nA1hVVVmE1D2V4sl+PS8JXj3TdmhJYOzOsBdelaqDjDLlCjvMxGn8Sds/ypp0p+WPDHG2u251S/3KLZEOcYDbVTaV+25TRgMQ8vTfEVyd5hvdsW/JuLsppfsoDStgS55HYt1f1kOD67CeHjc6rnsKe9HJc1r/Q= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN0PR11MB6059.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(1800799015)(376005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: T/aAU8xfSputppDiFxz380LofuSx254zsJEdOyX/+xKmto2XqOkR8QNuDy6dIp0H0b2p6GdsXDqPuRkJ9bW3Q5WNPYClnUNhou3MrVUEjmjoMxqmnyqvhPWaVEEc/aBhDRAXUjh8iiiBpdd2QJDiDjkCS7B7vwtaFDKMfeBO4qcJ9ohRjVmeF6eUW2VaDf6v25kSQB0zbCx4mFiqeiA5t4wS56ieglicgrG3hvqxuOtJOqJOwfffAoPgBGTvMcM4NJs+fbLz3bYTicrvWojkIjIo9BDpZtZvug0TAJafYnf9D+hcddkTxaGPBP+KqTISDnd6DF99oxKEe7fIB4oWy4tKJJNnm8vfqdnhe5CPwKGWFsTua+mNsfHYA4p1rHmAqeHkbN1laf4T9N5p4n61V3tcjDMspmwz+IqJnwIaKkkXIo6AP4BkAjT8d+OekkPyrbMaMP4ILwfB7FX3it1wUsF3weglJ42RhUkUnuN0Ba/eaLGx+UPE56Qds/upJKFcZQMPBGOsnSJL9abEK1Y2uyWwMR7NXJoTWrpWHKh4sdCduMQiN+f6CaXaPlpGw/c+YoUZ9m1HLWF65+4yxXQXKJtO/aO8AOcvsxR08ZbHymn049BFLotdy1lMhUJ03owGt4uqxjiOckmTb5tptpLnwRYjXz2+pBqL8fNT8pfcJB92xvmQsa7to4G7BRUQTjrKDZfaUevth5TmRldQK9dCLwwXSh7fA1vxLQr7jZymNN4wJp63HRW4fv1AFAo3VyWD2I+xyYYo11jT2HY+yBZy7v2gg6Hy8mdtOITJ27sYSNWH3Sq/GOI+0IDriTsxBsRD9DnAI2uxebhqJqhna9lJ8qLe+MWeJHa0LA57f133WqbetvtnMt998PS0tLcCaxGpcVfScyBlo/pOqcOhtr2ien0pYKFGNSGi9MCtNfT7+pGwJJfU49EbXTD9P/5lGv2hUx5ybXlvuAmnnuBss0+VDQ+jaSEZwrAfBOFSCpU0zJMkUxyeaTdA027SRU6+JqoBTVcl583v2YJXbC/Vtjo9/mrw8cKF2cSDuzw+9Ajw46KUpI6jMmXa39+P+QGrtZeyaiQSx1BqQGjwKHxxpC2lp0ZuHg/oVjTFXlAPY79wOhpGOkLdiAV2VEKtlO6rs6bL0xMiPFqEtjoo7w4xLYRtAUPL7c+ykwhkjJ6KDcFFsi21A3J7lhNd7LvQyzpu0pJNq/KIB6XR3IW5aKHTDk/VaRt8Kn/q98h/sXJtpQkf99cIreDBUAro/5tuEENjTzLRFibdTgwsm2RSna7TTlo4+B4YCG/fJHnFikxV/2XvitFB3i/ShTegdtJDRoc5dbKJJ66XiFmOweU7Qve6mmtC16m/8fG/NFXesdXKcMw/RFhufwCn697qWCRIlIvuElOVI1E0L4txBiuJlm4mcrIU7rjIQw+rY+8YbD+mTH9TQiUm1/IgIDCSIR3ba0eYldw2Au9mstd/8TaJ/ym5c7n3zJeJACt4QSwPRq0bSjdjPxUTWFRNWOjYt8BPVEqysmXeEft5Un08+iilFJxNP52JZAPPyCYdKh6kZ9eGgWtedrkn0UG5yHM4FTLNdU3cFAopq+uJZrzIjCobcAYKV3WFAA== X-MS-Exchange-CrossTenant-Network-Message-Id: a87ce7f1-7623-4674-aa71-08dc4200babe X-MS-Exchange-CrossTenant-AuthSource: MN0PR11MB6059.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2024 19:23:28.2695 (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: Weog+BztyzmIGpz6KkJ2dtFSn3mAcKhNzXhO6asu375G0yIt2lXZbQsd17YnOKNgPjdX7TCY5IYUE9d8xoSJFA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR11MB8253 X-OriginatorOrg: intel.com X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" The gem page fault is one of the outer bound protections where we want to ensure that the hardware is in D0 before proceeding with memory access. Let's convert it towards the xe_pm_runtime functions directly so we can then convert the mem_access to be inner protection only and then Kill it for good. Signed-off-by: Rodrigo Vivi Reviewed-by: Matthew Auld --- drivers/gpu/drm/xe/xe_bo.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c index b89ac6db68a1..bc0cc5edc533 100644 --- a/drivers/gpu/drm/xe/xe_bo.c +++ b/drivers/gpu/drm/xe/xe_bo.c @@ -22,6 +22,7 @@ #include "xe_gt.h" #include "xe_map.h" #include "xe_migrate.h" +#include "xe_pm.h" #include "xe_preempt_fence.h" #include "xe_res_cursor.h" #include "xe_trace.h" @@ -1136,7 +1137,7 @@ static vm_fault_t xe_gem_fault(struct vm_fault *vmf) int idx, r = 0; if (needs_rpm) - xe_device_mem_access_get(xe); + xe_pm_runtime_get(xe); ret = ttm_bo_vm_reserve(tbo, vmf); if (ret) @@ -1176,7 +1177,7 @@ static vm_fault_t xe_gem_fault(struct vm_fault *vmf) dma_resv_unlock(tbo->base.resv); out: if (needs_rpm) - xe_device_mem_access_put(xe); + xe_pm_runtime_put(xe); return ret; } From patchwork Mon Mar 11 19:23:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Vivi X-Patchwork-Id: 13589288 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 0C66DC5475B for ; Mon, 11 Mar 2024 19:23:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5897D112C2A; Mon, 11 Mar 2024 19:23:36 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="A+lCz8dp"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) by gabe.freedesktop.org (Postfix) with ESMTPS id A23D1112C2B for ; Mon, 11 Mar 2024 19:23:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710185015; x=1741721015; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=zlu1RWDfn/nNMQBT7TscusInSrYqBmN4s0Nwr2cYktA=; b=A+lCz8dpy9iLpVUsYvdOP5p0X3INm+3jrjR9u62Q74RO7+713gE9I1WA x2tdl/gnDMMvzpDY3PuhSbDdglT60BUTLWHwxs8mKlQA4Aq4gG+RQXbCU UIBWfU1t6q9bRamXD9J+hm9AQi/vksz4hUqDyD0dE8bho9gwyPg83xyj3 WNWw2qD3+rpFxQgAtH/TDaxKawmUOzHTSSKKfKVPMFhUxf1Qgs37tSJw6 qtYwRaYPSp8/G+1wOOuwX2ZGmnDNg122lAJQBM2kIn+NSys9pwbcASQfH NXeLW1m6kSm1L7z0G7ov7Qbu3ZHuuLdMndiWM4aZhVguU0KOWOXvcr1S0 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,11010"; a="8627097" X-IronPort-AV: E=Sophos;i="6.07,117,1708416000"; d="scan'208";a="8627097" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Mar 2024 12:23:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,117,1708416000"; d="scan'208";a="11344352" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orviesa009.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 11 Mar 2024 12:23:35 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 11 Mar 2024 12:23:34 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 11 Mar 2024 12:23:34 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Mon, 11 Mar 2024 12:23:34 -0700 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.57.41) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 11 Mar 2024 12:23:34 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OtZlHLx9EltcdcPcxExoFz1UCfynG/DHnHx8zjAWoRF1wlHOrHfDOJLtbmVa0lWWiswtNWO58rmdx9/p1QomWHdBzZFqawZEShz3iYw9m+MQXJgy39Ue8g4+huK4sMBYUIcU7li8Clf9OZHDm/WUhCG9EXNbR/b7Ty78/kybc9dR15qvo21PRJ0DBkskKz1YL4BA6rY4DJtUIp+0BbSeeOxmnCUGA7Z+6698e7I/PyLpEYAJ8eBgxXMVlG5OGYhGgmNk0E8FQEkzibu2aE3QFN1AeftDku42yRYXWLq774A0oMV/u/mTpP+X30qx9SuXicvJOwDlbwqj5Rcypw2R3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=wuNcwmGliE5s4pR8T2OX5oSKXcK4n/S8N9PD+v73ang=; b=eKZYzE1Ph5EBNelIvuJ2By6zuWXug88vIXeD10+KVhrafSTJ7SVTvp9dLU6FeR4rslGHaSyiR2ySmMPOJNz7rT6TW9xQDmdFeWf14c1Eh/4p+LUQvQUBvdbuY9yotvARAMmcp/NyeQvX/XYTvjUODU+gKfzmmtdrrOgjx0IAa/XJ5nbz/M7jgZqfRUN9chEfkbPQm++HNYkmgUkr7j6Us2REIsiQQdIndqg//frLjHok1xWRtLqZ1LgxHrfwfj44n5GdPhJzSfMfmg6j3b4cu4HABDgQnjXSTs9qqgjhzS7Pa3Mg+gXZtZOSmz2aCZq4KThNU/Y5QNyxjxR8ykXwHw== 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: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from MN0PR11MB6059.namprd11.prod.outlook.com (2603:10b6:208:377::9) by SA1PR11MB8253.namprd11.prod.outlook.com (2603:10b6:806:250::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.14; Mon, 11 Mar 2024 19:23:31 +0000 Received: from MN0PR11MB6059.namprd11.prod.outlook.com ([fe80::7607:bd60:9638:7189]) by MN0PR11MB6059.namprd11.prod.outlook.com ([fe80::7607:bd60:9638:7189%4]) with mapi id 15.20.7386.016; Mon, 11 Mar 2024 19:23:31 +0000 From: Rodrigo Vivi To: CC: Rodrigo Vivi , Matthew Auld Subject: [PATCH 08/11] drm/xe: Removing extra mem_access protection from runtime pm Date: Mon, 11 Mar 2024 15:23:00 -0400 Message-ID: <20240311192303.33961-8-rodrigo.vivi@intel.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240311192303.33961-1-rodrigo.vivi@intel.com> References: <20240311192303.33961-1-rodrigo.vivi@intel.com> X-ClientProxiedBy: BY5PR17CA0012.namprd17.prod.outlook.com (2603:10b6:a03:1b8::25) To MN0PR11MB6059.namprd11.prod.outlook.com (2603:10b6:208:377::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN0PR11MB6059:EE_|SA1PR11MB8253:EE_ X-MS-Office365-Filtering-Correlation-Id: 7a59d53b-f09f-4678-f93c-08dc4200bcb9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: v4Lr73xxIJOofG+CJlF4wj6t4W6Vz2Whud6028v3/P/vv0S0tmlzqsEWXl7i+51O47h12A8YTVeEpRSYPhDCVkXsWY+h0fPEvemFvenf2ysCD2fy9EaDtQWkX3pm04aU2Z3F9cIgrGRxjXLb6S2KOH0120PvkIj4vIRQF+bpHjqjIB6+PBsJFxxlNCA/p9+xYLo1hh8B9KgVMC1Xg2yCTzCpkOqRIE6lbwEEtop5MvyRfjetvbwNWpWW2tOtM3VEoJFT5bSSGTnuDPwqG6/9Eva1/44vLtKyZVp63vmbT5ChiQTv0nuERKZPAxzmVvVx7GoKpSHx9VvjfP2BQ+Zq/T/zBD1PKYsJlhNzN2Z9uNBCzJHgeIRb43yNOwtcH2feC8LtkLyI1sf+JzM5g+3cTOjeiQnx97Y1/NnMsAAfQU16u/v/v9GrwJdI+vd7DzYz8dW50vO38zoEnF1+vtsJ8pjJL+DtN8NoiNbVnQy1efN27Edwh9Gobr2EArvV3EerpUvb8vGDw2lg7XcYVrWMIdPHRKjjLPSZhoBlkGvm9jlsgV3qw1rnMKrre2jWeUObnCOnSLptkz13XBsGrJjtqCp+zJYGoSoix1dWmOU3D6RPHwkr5dZ+xHqVl1TmtNhQ+CYgp7PEJAufMMoMxaBmg1thpTDTMKymlSAvSaUeclQ= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN0PR11MB6059.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(1800799015)(376005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6rlsl4KC1B5FO4Im6SeB0nOczj9NKtM2CsBjDCDdPKbFKTXANrll7oQHY5yqouihPbFTn9h9raEtQAqwRFbNhd5kl2GuX0Dc6WGowKDcn/4xRTlHMZbH/A6iKqXCJ+JCIjMI9WkEOlvHL39Lp4v0tfEq1fBu9nwyiOfm8/hP/S/yG3Mr1AIxk09pFcTF7F9jIMBPQVwZzKag3FPsoWICRS3n7CuarMOET1VeLl+4NbtnhTunGVUTry2f3NRf55IFVBx7jJpIdNXjAWoWV2aC99+wgyHy/8yPD4jBM3dkrLyTM2T7o0W4rNqXScNDmgHYNFCbcw78Bd3RRQ3+TAk/mqmR9e2JqZXb61UqJz+OdHdK4WToP+/+SCIifthe7+Qh1ywKlZKKz0kF0sNFFKLBR230I/Klv5VzKrLc1cNwVQXIiIMz6efNXgUl30qqDhns901ISiJ3fABsZypU7adoBQWy5FLhgPxy+5ZUUE8I7yttbDMxPHS+ANH6YZfkSSkfQTGtTweO+ZuhrYCREJeZOJLbBP8zZt9WarvRCWVkt0WwU4Ffd1HhE8t75GVq4LyjWY+fa0tiXLhwQjfyJhq9QOkb2U0cFT8VlHm9zFcKdzrnCNn+RU7Wy/KkciN5X7JFwXvm2XEGBSLPjrVLe3pqPQj97z6+qy3RZPIGweif6aBumwGOEJxI8GpA7aSpcccYs+L9/V4gLp32pTEhmUtiMwye2hYk1sz+JEIOXkB7D4tWGyFqLHuUfEQQqPWc7Ej3DN/ti8FFpiHBVNC8JuzlHPvv3qqZhNWK0Sfi5SJGyAQba+rv0ejVoW0F5Em1kq5MvXwVtP0Cm4cd/txy1URU0SyvvxnT7l6s+yM3+KfAXyh3GAlD7GvaLdfJ/n0EMeJTJagewcSpI6U9w0y9nGb6GIMyX3vopj1CdW5fsYryGIiBkUInwP9V0f6T0oGdJy/Yy1fXg0q7ycCB2isg9Gg59gOeIoSf/09MuzSIUYBlHz1A6d3AaJ4SLDNECE3McOE0nNouGp36usoo0+zalYfwOSnERFQeUP9sDVlPCu40TGNZzRCoIhgEJElPfM5dCVqp+djEkiXT5v6i9aC1VxutoulQ+Ce9I3mxEV1qTbYMwHrVyag4iuZcfg404ePbgcQisxpcY45IinenVsxvDURfmjgTw1tiyAgNC3p5uSrjW0/DCBbPrY6KzJtwHK5+bAeg7UrDE2Wx9TOPY5DJMuPXiuP92lODFYO+6M2drHo5leQUM4WhoHqnDrU9vl+w2EV59WOXrcXOla1cQcBVqqgGvs/m9hyogyf2mDD3DUiJcfYLKnqzXStHAulDF6UqKAqLH+nqdF2iw+CCFh0vUyGmxUs/OKgM3T3ZH+/8M3xYJRqFAfGLTf+znZej6ICnWQ0emN2FKNp+SqCY0wHCkDSi0naMbzWVS3fvzmQonzeGAfnKM4cVtrs14qFHxd89FhInVz0KTNH17b0lqUTgw0087dDbJjpouPV0zfHtZp35b5Z7C93qEx3WNYkKlMh9jyWolbGoAIDeYPLSPwY8jhmtDwd9Jx1DnVRRY6itRbupMhv2xYgt2+EivbOF2mFkcwsiP2SfmmuWypEdsxvYf0puXw== X-MS-Exchange-CrossTenant-Network-Message-Id: 7a59d53b-f09f-4678-f93c-08dc4200bcb9 X-MS-Exchange-CrossTenant-AuthSource: MN0PR11MB6059.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2024 19:23:31.6290 (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: dneVBUi0mAicTineUFwmbg7fDZDSQCLT6yboukDvyzQZh5gI/HfhmEX/GkTQEjZiT+4Fxt8GMMwoYNi94uP6Uw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR11MB8253 X-OriginatorOrg: intel.com X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" This is not needed any longer, now that we have all the protection in place with the runtime pm itself. Signed-off-by: Rodrigo Vivi Reviewed-by: Matthew Auld --- drivers/gpu/drm/xe/xe_device.c | 8 -------- drivers/gpu/drm/xe/xe_device.h | 1 - drivers/gpu/drm/xe/xe_pm.c | 3 --- 3 files changed, 12 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c index 49a413725c8f..a9128bde85c1 100644 --- a/drivers/gpu/drm/xe/xe_device.c +++ b/drivers/gpu/drm/xe/xe_device.c @@ -639,14 +639,6 @@ u32 xe_device_ccs_bytes(struct xe_device *xe, u64 size) DIV_ROUND_UP_ULL(size, NUM_BYTES_PER_CCS_BYTE(xe)) : 0; } -bool xe_device_mem_access_ongoing(struct xe_device *xe) -{ - if (xe_pm_read_callback_task(xe) != NULL) - return true; - - return atomic_read(&xe->mem_access.ref); -} - /** * xe_device_assert_mem_access - Inspect the current runtime_pm state. * @xe: xe device instance diff --git a/drivers/gpu/drm/xe/xe_device.h b/drivers/gpu/drm/xe/xe_device.h index 2653f53bee4e..2327b6c0ae6a 100644 --- a/drivers/gpu/drm/xe/xe_device.h +++ b/drivers/gpu/drm/xe/xe_device.h @@ -138,7 +138,6 @@ bool xe_device_mem_access_get_if_ongoing(struct xe_device *xe); void xe_device_mem_access_put(struct xe_device *xe); void xe_device_assert_mem_access(struct xe_device *xe); -bool xe_device_mem_access_ongoing(struct xe_device *xe); static inline bool xe_device_in_fault_mode(struct xe_device *xe) { diff --git a/drivers/gpu/drm/xe/xe_pm.c b/drivers/gpu/drm/xe/xe_pm.c index 393f14411ae0..3e92f09b8d83 100644 --- a/drivers/gpu/drm/xe/xe_pm.c +++ b/drivers/gpu/drm/xe/xe_pm.c @@ -296,9 +296,6 @@ int xe_pm_runtime_suspend(struct xe_device *xe) u8 id; int err = 0; - if (xe->d3cold.allowed && xe_device_mem_access_ongoing(xe)) - return -EBUSY; - /* Disable access_ongoing asserts and prevent recursive pm calls */ xe_pm_write_callback_task(xe, current); From patchwork Mon Mar 11 19:23:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Vivi X-Patchwork-Id: 13589290 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 75BF6C54E58 for ; Mon, 11 Mar 2024 19:23:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C1A0A112C2B; Mon, 11 Mar 2024 19:23:40 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="FYeJMIFF"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) by gabe.freedesktop.org (Postfix) with ESMTPS id EF4B1112C2B for ; Mon, 11 Mar 2024 19:23:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710185019; x=1741721019; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=ySxvZZ+cW22f2GyBxGYYq6Kb0eVtvM99yxptmTTQWFU=; b=FYeJMIFFt9Ky5NiU3CNZ0UO+uyTOrir62W6y5kUB3U3ktPPi4QJpYxN9 nu6MWvGDWLa+gEGMHGvVWsjnd2WwZLOlPXixnhOHXxAaIWFxsErQzzA+X 7h9maj/CMpIdFiAFhbIyjT8Ku99ZypFdaun0ADRLohQqLZ/sZTctLeWsm WFao4k0JABBSBVm+1NWGhlEJBVJ8aU7L8m4lPf6I6oEOFKamEE/7HpBng cNIWYGrX5qahnMplqHkC3/uHqtqbWOIAN9ZNSxK0jGZgdztqdRm+9meqR l7tYICTs2cGKr2n8eTRThJwVI0qD/boMZFgS3dcRMT0eVNor0ArGUbhyD A==; X-IronPort-AV: E=McAfee;i="6600,9927,11010"; a="4725830" X-IronPort-AV: E=Sophos;i="6.07,117,1708416000"; d="scan'208";a="4725830" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Mar 2024 12:23:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,117,1708416000"; d="scan'208";a="11856956" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orviesa008.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 11 Mar 2024 12:23:38 -0700 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 11 Mar 2024 12:23:37 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Mon, 11 Mar 2024 12:23:37 -0700 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.57.41) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 11 Mar 2024 12:23:37 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E0pDe3blDzYLx/+vxxi0AMhGJA/2Vd4U085iBB725ju/FFpWou2SNy8paWQcEzrIwMRe3IwA3VMbpAxhDDAscugmZhVdZYUiIx8mWUzjsF3OyMyVF5o5XtCiO7/lPXZ7c/4frCNad/99fs5R2sCZ6jtDWaLNv4dSRJ+KCl5h9toqSiOpTTALBTgusKedewHh8/Vlbwa/58kvtft8Qspli7UysZQCM4tgpZ/HcXBI0S7RjuXbKD8JzAVF7f4UXrjpuK+G3vkE5QdVLuOwCotUScUQiNiT0Tul+IPCs6mnmntlQ+9RoZTh7nb3mW+6RL6HRm6TZ6ryUaDr9DnGe8kmyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=was4OWZ1w3G1oWq++TCMl0dY2SrQOSGQk1Ex/5rwt4A=; b=fySpHSXy9gOw2jJXyixKUUg2B1UKs1dGcp/ZCnMEWmz5KepJP0DQbXhZCxPifIWSxlVbu3xVNJRoiSG3QFnKPIF9n9YktLp0Kwf3i3N+IaUC2iCKOyCUWrr5Ph1om10na6dXT5tnhPC+4hBFCTiCpI/0NgZu25hvfoF39pi+d1hGjBbyz7yXQHNnvAKDDPMKOzWS0LjN41K9KBn7O/XHPUJ16tAhKVlydaAu0YtPgpYE1dfaR+tNmVGOgNrrQBDDWq9wCL2mI9wfuVSoJTelblO8qLv8IioAosdxKi59uVeuc+jvWV5Ke7PS3SGGVderuovNpjoCDsbPiLu0kkbl8A== 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: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from MN0PR11MB6059.namprd11.prod.outlook.com (2603:10b6:208:377::9) by SA1PR11MB8253.namprd11.prod.outlook.com (2603:10b6:806:250::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.14; Mon, 11 Mar 2024 19:23:35 +0000 Received: from MN0PR11MB6059.namprd11.prod.outlook.com ([fe80::7607:bd60:9638:7189]) by MN0PR11MB6059.namprd11.prod.outlook.com ([fe80::7607:bd60:9638:7189%4]) with mapi id 15.20.7386.016; Mon, 11 Mar 2024 19:23:35 +0000 From: Rodrigo Vivi To: CC: Rodrigo Vivi , Matthew Auld Subject: [PATCH 09/11] drm/xe: Convert mem_access_if_ongoing to direct xe_pm_runtime_get_if_active Date: Mon, 11 Mar 2024 15:23:01 -0400 Message-ID: <20240311192303.33961-9-rodrigo.vivi@intel.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240311192303.33961-1-rodrigo.vivi@intel.com> References: <20240311192303.33961-1-rodrigo.vivi@intel.com> X-ClientProxiedBy: SJ0PR05CA0106.namprd05.prod.outlook.com (2603:10b6:a03:334::21) To MN0PR11MB6059.namprd11.prod.outlook.com (2603:10b6:208:377::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN0PR11MB6059:EE_|SA1PR11MB8253:EE_ X-MS-Office365-Filtering-Correlation-Id: 5b810e19-9a8b-47d4-de64-08dc4200bed3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bjyoFMsjVlU6jYY6uje7o9XP8Ek7kNzaibqlU3YnE0TvxgDwftZU2T8DbA824bfShXHAce202YK7XxklwiVjqRuwaf52cVYzEJ+rs806JK+SH2ASsa0aSCykx2hLfmK5KdM31o9mjn7H+x/yFC2Us65LtGRtlj+H+bFc/1ojea+811jY0E1sd2KNacBDZfyOil2WVubKCJbuZFs+F1al2kNRS2xbUmYMpdF5XgIzKiqA5MNpFKNYwvm8d5WAfMnEyRJZqXuyGe4s33rYigS6Se6AJKGLscwxSzOUgzGYybIP3H8NR5bxgIcEMjK0ufVf8s6s6gan2pebfjy8rE545JmGo0qQntDrrmykQnebA17uq7foHxsCyR1jVg53WXD4YKoGNlt3dqmYjFbvJ5FNu80k1fc25nbPHElc9/LT+nP9PMZWU6Xzzo/chgs1BbhS5JO8h4sM+wRY3LOcjH+/EAurGvXNoxiVq+LUcI9Sk6DlPbQc1Hl44GaNX1+EypRvghp+WgSpHwUp7gIQ6Un/sUPRsm5O/9Jr3mliXASGKdZHv9Vgoi1OGvuvhyT9UnusVkwmTZ/Jw6Gs0PgZlYLhe6mEqjF/MBur/f+7Mp0n8tjV1XzINU5z8JD/Hkqxqv9by5n7/P0b85/IwqgJ8L/QWbuHuXCKYQKpuKy02GBAgfA= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN0PR11MB6059.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(1800799015)(376005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4M7JweIa86ezWcPvgRknbtJYF5QCOugi6lSSAHX2vndjyQ+ezWH/1dczAq1ds5y8luLBRSV4faptbr8J9yh8hY+cbFDX4y2c6MgV5LoTsvwRDPI76k6c33L6s14L9H+m7yrG+kutPV09evczCk+W1bkoqAYmJOADasDoxDQykaYp5nnPoaHFvPBrvCZzQu6100SUxc2eUE1Af2wlfD2EcxEPGosfMQqvHmZdoomMsChyvxU8uAwxXxXt6ssZwgebsuMOZ2t+7kwT2tzynV+CrbAuwgEXPxh45YbONKz6Ev8vIo0c+AjfPyxixQnrwPGSHhzQo7oG2UV/v/Ud0ovk1tLj8rPqndUeYr34j2uHCpGRetrfq9tI16xHoxxpE/PnlELjnTdblbOtzHaGruklX61wEGcPynjuPA/4l/GDNnCVL+k9PbRlvikBfjPetVXoh0oSba2P4kYOVJ6zYEb7iyZlCnhkz6qPxD6aCga4SL0RV+I/T3aacikaIrnWiVV6tYjCBuqObuxIca1LKJMKfNiXaQ5V4tYcPUrx7jRxGpGSByeIfVzUkdPafgBQqcf4AITbLzDciBh7gPx4+xS1FT6aiPwzR65Vj0Y3v5qLQ290JL6M+tIABZztH+sEZCWCnxhdUGhn4EtgnQEL0tPNYIXcqAoMlghp0TmAONRjxk1MU30oSvsdwdpoeWMnugs99o2NfirgVTM6EJkVoc1l1Z6yQZISqlPuXnvozf0x/DQ7nw3lfu5lNkcuxazAtQvcEPYwdJKTB7EuipQxwmUBGxuXPqcHy1wNiigpcJvl4h/9jK204TwKsrXAvX6jCk8q44RsZSo/FXJiIsBB4zzma1wgQxzgfJdg6fv8PpGoPNTTe7+d7ZTiNfuOuHZR4W5E/f31+hhGfyaa7rFV2+fCELQVBo3bIjW1OPLBmRENhb4NfUOWT8LIOq/WpU+zOh2JSM6jzdkrLWeecHbJU+2kWY9UYfKPomKd7r62Oh8NL4QzdDZmlWM8rIMRPouaD1WjuB4X8Ai/0ByuGf6AlJ7LOJ3NykrwhiyFLcXEr6K2XNYEqLyNg40NpE+Kn77e+X41fCm9S8Mxr2Dty5o0/Rr2G8dsAvJ3NylAEuaQKX8V55kD0papax+AbZTyvqblWUGdsnnfmDKAh2mBixtz/HTsu2Q7Tgp8PKqv3HyaxcD/hpUvtUgyCq6eZaiYE9xTmsuWxiPdfEsG17ZZjnELUzEEjsL7vXWduxmXFhK2EfLFiBM+pesmh5nL8OfA2l/9S4f2UWWHJWRyOAs/F3qDpLYrXvT5v7pUddADh4pZDH6a1R2r2U0tXhPg6nyeDfz9Nrj3gkXncCMGEADUPmQnxxE0GGCkIK8AEA/PNAU5KVZFTmGmQwlNmDjgGVkqeY9QcZtl3w1eF7siGXWUmZ3jNZ/HNBu91hBUbvU+dlnE9h2n3gDjrT36+AJMqdPyGjvk90DuMOVNBXQS4joinyJe+c/Rob28GmEZ6K4MZjMAs+KDCzLqXMlQCZmwp7SiYo0BWXznWlkonP26yjT9B8DL41Ue8GlDsX/jVkQyfnTcccMKWMiaLoTCjzP4W89BWzCcvf+uhmR+UNfPB0B6QyjEfT8QDQ== X-MS-Exchange-CrossTenant-Network-Message-Id: 5b810e19-9a8b-47d4-de64-08dc4200bed3 X-MS-Exchange-CrossTenant-AuthSource: MN0PR11MB6059.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2024 19:23:35.4846 (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: FMpaBJnOh7f+CiizyA9edEfgRpHemxEAxhceClIcj+mQY/IlumbhO4F/cEOxcb8NNlm6x87qlJdVwbZcC0fQIw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR11MB8253 X-OriginatorOrg: intel.com X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Now that assert_mem_access is relying directly on the pm_runtime state instead of the counters, there's no reason why we cannot use the pm_runtime functions directly. Signed-off-by: Rodrigo Vivi Reviewed-by: Matthew Auld --- drivers/gpu/drm/xe/xe_device.c | 17 ----------------- drivers/gpu/drm/xe/xe_device.h | 1 - drivers/gpu/drm/xe/xe_guc_ct.c | 8 ++++---- 3 files changed, 4 insertions(+), 22 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c index a9128bde85c1..6c7850dd70b5 100644 --- a/drivers/gpu/drm/xe/xe_device.c +++ b/drivers/gpu/drm/xe/xe_device.c @@ -655,23 +655,6 @@ void xe_device_assert_mem_access(struct xe_device *xe) XE_WARN_ON(xe_pm_runtime_suspended(xe)); } -bool xe_device_mem_access_get_if_ongoing(struct xe_device *xe) -{ - bool active; - - if (xe_pm_read_callback_task(xe) == current) - return true; - - active = xe_pm_runtime_get_if_active(xe); - if (active) { - int ref = atomic_inc_return(&xe->mem_access.ref); - - xe_assert(xe, ref != S32_MAX); - } - - return active; -} - void xe_device_mem_access_get(struct xe_device *xe) { int ref; diff --git a/drivers/gpu/drm/xe/xe_device.h b/drivers/gpu/drm/xe/xe_device.h index 2327b6c0ae6a..b45592b0bf19 100644 --- a/drivers/gpu/drm/xe/xe_device.h +++ b/drivers/gpu/drm/xe/xe_device.h @@ -134,7 +134,6 @@ static inline struct xe_force_wake *gt_to_fw(struct xe_gt *gt) } void xe_device_mem_access_get(struct xe_device *xe); -bool xe_device_mem_access_get_if_ongoing(struct xe_device *xe); void xe_device_mem_access_put(struct xe_device *xe); void xe_device_assert_mem_access(struct xe_device *xe); diff --git a/drivers/gpu/drm/xe/xe_guc_ct.c b/drivers/gpu/drm/xe/xe_guc_ct.c index 355edd4d758a..8d7b1b42b2e6 100644 --- a/drivers/gpu/drm/xe/xe_guc_ct.c +++ b/drivers/gpu/drm/xe/xe_guc_ct.c @@ -1203,7 +1203,7 @@ void xe_guc_ct_fast_path(struct xe_guc_ct *ct) bool ongoing; int len; - ongoing = xe_device_mem_access_get_if_ongoing(ct_to_xe(ct)); + ongoing = xe_pm_runtime_get_if_active(ct_to_xe(ct)); if (!ongoing && xe_pm_read_callback_task(ct_to_xe(ct)) == NULL) return; @@ -1216,7 +1216,7 @@ void xe_guc_ct_fast_path(struct xe_guc_ct *ct) spin_unlock(&ct->fast_lock); if (ongoing) - xe_device_mem_access_put(xe); + xe_pm_runtime_put(xe); } /* Returns less than zero on error, 0 on done, 1 on more available */ @@ -1273,7 +1273,7 @@ static void g2h_worker_func(struct work_struct *w) * responses, if the worker here is blocked on those callbacks * completing, creating a deadlock. */ - ongoing = xe_device_mem_access_get_if_ongoing(ct_to_xe(ct)); + ongoing = xe_pm_runtime_get_if_active(ct_to_xe(ct)); if (!ongoing && xe_pm_read_callback_task(ct_to_xe(ct)) == NULL) return; @@ -1292,7 +1292,7 @@ static void g2h_worker_func(struct work_struct *w) } while (ret == 1); if (ongoing) - xe_device_mem_access_put(ct_to_xe(ct)); + xe_pm_runtime_put(ct_to_xe(ct)); } static void guc_ctb_snapshot_capture(struct xe_device *xe, struct guc_ctb *ctb, From patchwork Mon Mar 11 19:23:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Vivi X-Patchwork-Id: 13589291 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 9B0AEC54E58 for ; Mon, 11 Mar 2024 19:23:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 12969112C28; Mon, 11 Mar 2024 19:23:45 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="mVT7HLBj"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2C4C5112C2C for ; Mon, 11 Mar 2024 19:23:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710185023; x=1741721023; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=vv30FoXXjVLOHbZ8hKYLNKiV/gUMxgvqznVoHaPWC2E=; b=mVT7HLBjiFqCohVIatOBI9LvNxg4zhvXqnqKd0n9jNa+qSvEhV+le04M TMnuhZevvZfGrVpT4BPpwutw/Y4sdmJDNCsp2/9qXDAzTvnGoJe6XCdar D3c/A4rPUHQvjfnERMar4mki1SHWXrZgvFXmScBJb4qm9jvU8j69VUAkA qkrj+WmPkPtC9VOv5smQDyAt4xu2mWsyBZjmKGszRhWY6s+61i2DuE+iY OtHyfn+gETop9Nxop8qwbgr/mN16CqQaEPTqjFA9aG9Cl1zKP+tyhLLLI KNbKQabGT1w+ckxmPHp8zzSNR3qKF6EXzooONXfJ0Kkmm6oIH8lvTXba8 A==; X-IronPort-AV: E=McAfee;i="6600,9927,11010"; a="8627116" X-IronPort-AV: E=Sophos;i="6.07,117,1708416000"; d="scan'208";a="8627116" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Mar 2024 12:23:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,117,1708416000"; d="scan'208";a="11344386" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orviesa009.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 11 Mar 2024 12:23:42 -0700 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 11 Mar 2024 12:23:41 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Mon, 11 Mar 2024 12:23:41 -0700 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.57.40) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 11 Mar 2024 12:23:40 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jlKHUAq1iGrTsEiIkLRiwxfJB4bAVpGihQgxe9qNxv/v7i2FCH+UlwoLXwMlyfp2KzaRkUlR3Qsi9i3BKU6j7mQpx1Zw9eG8tCfN7e3ZhWMpvTCFwO5Uw9aFquZwcjRtZsA1befAO86SS+iSZC4OqyZHRQ58B824FnjOmRtdBQ9JUElFPV6Ayc4KikNnT+8Z/yXKq+DJZbk9Yc870/q8RLDafVE0jbU5YJ3PfR+JIyjLvKCqfn8mXDHElyyih7TJ7IL5lqIC9eYiEPkRriZQEKyQiFDgNbYVJDF+PgvJM4h40+TJkFplqk+BnLn1lSmYs4TiwFTGQzAXphKfiIyU3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=jkzYfd0BbikAreL81H4WV+Fi2c8UMbZFY1NYMAvyzEE=; b=NNGq8/KZ5t/ASZA95tEtYrHHex515xmJ7fURHchutbAxd2KPUYhLY9pJMeMhoshGjNNy9yGgkVkNgpLc0nuB3pjhLwzxJytzciYSSod2CbN/gsf8X0yQvTQ6k+Qd70RzJHimrUvpJNNUaQuuXHxV0C4qYJudTTnoyXh2fLEoka6ljre8GsEPMLVhmLIM+PfDJvss9r9PeY/TbzsjQy6DKarL8DX1IWWFW0okB+uJYnn7+JrqcSWpJRVhFyF1XuYiSR88x/KsqBnxs7XoH7rHz0VhzXjL8t9TsKjpDcOSkobAm5V4MA8pz1+7ct8KUR6JOhFaV+2c8tDDs1ZpjgVo5g== 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: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from MN0PR11MB6059.namprd11.prod.outlook.com (2603:10b6:208:377::9) by SA1PR11MB8253.namprd11.prod.outlook.com (2603:10b6:806:250::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.14; Mon, 11 Mar 2024 19:23:38 +0000 Received: from MN0PR11MB6059.namprd11.prod.outlook.com ([fe80::7607:bd60:9638:7189]) by MN0PR11MB6059.namprd11.prod.outlook.com ([fe80::7607:bd60:9638:7189%4]) with mapi id 15.20.7386.016; Mon, 11 Mar 2024 19:23:38 +0000 From: Rodrigo Vivi To: CC: Rodrigo Vivi , Matthew Auld Subject: [PATCH 10/11] drm/xe: Ensure all the inner access are using the _noresume variant Date: Mon, 11 Mar 2024 15:23:02 -0400 Message-ID: <20240311192303.33961-10-rodrigo.vivi@intel.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240311192303.33961-1-rodrigo.vivi@intel.com> References: <20240311192303.33961-1-rodrigo.vivi@intel.com> X-ClientProxiedBy: BYAPR06CA0033.namprd06.prod.outlook.com (2603:10b6:a03:d4::46) To MN0PR11MB6059.namprd11.prod.outlook.com (2603:10b6:208:377::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN0PR11MB6059:EE_|SA1PR11MB8253:EE_ X-MS-Office365-Filtering-Correlation-Id: 6d47df6f-cb14-4e48-c88e-08dc4200c0ee X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: F801nBmG0uKkmlU8NQkjc24+/4Fpa0RQGQpMyT0ch0u2a47xl2APU3sc8FG7Jevsc13Xp4JaVnSxvOYowip8aSZJmGRDu05V/wIVaxJLAZZISa6D/O9JyBpGpaKsv6GESSE/3ciyc4X782oQ6TMHjCaPg5CGt6bZVv/VaiNtzEda9KBrNYOYft80oQNxbpNfoX5TmuOIlmUsFrFjjxioPXKq1wUJF/Aa+Cu01znAhNYrfK5JO5M+TCBvn+ttPzb4uVkWd21XaHVuIT+4D2QClONWwMfZHHBCtUZLmukiBB++9TQDD8u/+cNkCASIUkV8vQfLqU6US8xaNZvWmcLz7qyoTi8NbtBHOrb0pg8jSPq7LGvQs3rHsHmnA/8FTJXJe8yOFcHMLRWezO10Vq+/gQJTn1i4Y8kaKJKVhLIbm3jj4AgJEjFPIG6kwu2ESd1vUDJzZoSo6FBPfOm3Bs7j9wV/tjOzFIALRgYksj0N8xudL4h2gZnDvB0flVvY7QonsWEidysz9rrqUVBYb76d0GSLx+MwsZoYrdX2//UHOY919w1xpl2/EajC97y4ZngKxzmYJAmhQHzvEFOabzAuLO+6kQrmXy9n67FU9QhaRJAxdIjyvVofOA8BXjDjdvWEf6CjvpkO95oxiwDMG4PP4g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN0PR11MB6059.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(1800799015)(376005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 664EMgunQJmLfpZynAcXThWjqwOAgMmXrlGQeKPO75uc7F28WPPAR73+4cRQsZxhOvcx3/qlP51juVFsWsRewcXJPxOpTUwrBIXRpqRpORJzP9tE5GvrwRj+DhTcST/qEUovRIaLaFeiDqGnYKbtU6nwMC3iwJo4jaRIztt0Jypl6lDucT5cmuEA5onGgbZFsuRvXN6fnCnQxqmy+bNkOnCH8xpjhoX3yCvv/v+tP86+87GhFCTop7nbBSHWpU9LnbiBZjzthzAbtv8z3CWoCiCTTI21bZFYAbUuvlmOipi145EUP0zHQiWlD84VVLEtf8Jgs+s2g3+ycPioH4/a8szTv/lD2pUhERXRKNEgsBpdXMOxGA/z7bjpXKSSb+PVQKzcvclECg19dKv3Kpww+dLlloXs5Oq+asXtE4Lr6hO5owpAFWgZfONaqXtXHDUYIBBC/R6aX6acPT+bpwJdUVogvp+0f/UO5fxfwP4ircWKW5NRY9o5ZQ4QZyYnmueSqn+5wiUSR4vAczqbdV8XT625bxMGWnV2nxlS0y3ec/0sHOU3/GbWr57F2RJwAq2QIcU248T9O1nslls8iZaX+O/bY5PhKD3qd+vtheLVY9+Mjb7pEU/9/Q3+Zbtmi/OnAW2ZTaTNeqNEPph/WzuXOeo2aHAeYD0jon+tlRPeljZQG/J/9zkpBS758cOXN/uDNDSuxhKPrLksO7Cq0Pc1sdgiX/eTxhOjk/rW4EAj6JaDYggy/x/vltCZ/SjJfYQOaD/e0giQJu+wfmxC1PEcqydHoqxwe6/gsIz3itcvXHVhkkmw8VQss/XuXtilKlu36FycAd+7n489058TA2RqJw3xe4jkHfuce9OJ6BJ7Tb1FSuSIDvu4Bap1kBaUu3FzC9iLMP7ej7TZSUMXEgPdkmQ5+w+8ieliyHK18AbA2MmoCh1rJFYLrw0CoNHD8B6BCcoy2GUOHt1UO/HBqzUWnXyT+A8qYA6JBZj0hmul++ib30w84sXTa1O/WrvaR36+kexSl95Lobo9TnzQpF7Mby5quDKeUTUmKuW+uZam6O39E1cSjMqE500hipGRbM/7WBL3QWl7YX7UqUxSSC/NIxtI/aPxGvrjfiJKC6K3Rk0zR+0ft4ROZTle22VnHqTW5eRuspPRBfHXG6gevMp2oQ05++nAMrGwH2xl/g7EdBi8LSz6HrZF+PMDwLkVVJtQ6tXGIJNw9f/Tm+GjJG1CIM3wOFw/ZmOY1qxZmdGw4L5Fu6rHmPXlxJZ9QBvYb5Cqk0cSXHVd6S6q9HlXRyRMixutUQpQB2SKlCX2nF3g4OXoBHuV3W68YVxmLJeZCdUAYmCvZ6M2R8lZ0DCLrIZ3l8k7DEG9Cx54y8Vlo722JVBxWDpI0NCJV6G7nwbgoikWa5g+pkPTV1oWEdV14vRGll9/jrlZWleNu4L+HuzgNIQCYWGJUIIHvzLeihnA8lIU8t+96O8MswnkVBI4iMCYMKRdyXHBRJEuSpge7PynZhCHZpbywQ6oPu2CYh1LCknt0hVxZx5mqu8QSNG1lg4QU6zoi8KqG83LbpFvk18VPxMuCBb1USpJXfRrXh6t/6C20FIYjAyqxKDsx9EpeDeptg== X-MS-Exchange-CrossTenant-Network-Message-Id: 6d47df6f-cb14-4e48-c88e-08dc4200c0ee X-MS-Exchange-CrossTenant-AuthSource: MN0PR11MB6059.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2024 19:23:38.5964 (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: mydLxSYQ0egya2Epc7D6RGYion9x5uf78T1gbl8/jAAHY/U5pjVrxXX6NPVZYRDxhzAKtckpp380kRn6w08z6Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR11MB8253 X-OriginatorOrg: intel.com X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" At this point mem_access references should be only used as inner points of the execution and a get with synchronous resume previously called at an outer point. So, before killing mem_acces in favor of direct accsess, let's ensure that we first convert them towards the new _noresume variant that will WARN us if no inner caller happened. Signed-off-by: Rodrigo Vivi Reviewed-by: Matthew Auld --- drivers/gpu/drm/xe/xe_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c index 6c7850dd70b5..58815e9bf242 100644 --- a/drivers/gpu/drm/xe/xe_device.c +++ b/drivers/gpu/drm/xe/xe_device.c @@ -671,7 +671,7 @@ void xe_device_mem_access_get(struct xe_device *xe) if (xe_pm_read_callback_task(xe) == current) return; - xe_pm_runtime_get(xe); + xe_pm_runtime_get_noresume(xe); ref = atomic_inc_return(&xe->mem_access.ref); xe_assert(xe, ref != S32_MAX); From patchwork Mon Mar 11 19:23:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Vivi X-Patchwork-Id: 13589292 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 0D113C54E58 for ; Mon, 11 Mar 2024 19:23:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 620DE112C20; Mon, 11 Mar 2024 19:23:47 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="FJqLmpD6"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) by gabe.freedesktop.org (Postfix) with ESMTPS id A60C7112C2E for ; Mon, 11 Mar 2024 19:23:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710185025; x=1741721025; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=OSVOIspRwAAoSby4X+f5hRmHMoLfirvyM5GkOm5ThMQ=; b=FJqLmpD6Fq0UopKrRCouUe2tj4pjt23G76j/03YN1xzXs8Pd6uJxxjK7 W88p+iQxey4yXjT9b3IjL4FwBns12UjJ+CpMVp1LsVqXQjOtPEhfC4L1t 2B8AP8MPQqAJ/G3imYCJZ7bronvfb+Px+03fHhjGh2qUdD1JqzLBnF3ss igt1K0CdrfgRxX7+K102i9YAX3hA33BOyK3Gb6SM8gzR3Y60WV/wnDji/ 9NMYHVOBIGCTFHOf8uA5mzXxFlGRwqLtuV2z+GagI5SxXRVhcw2WvNzXL NYn6y7fFSN0a7bigguuAKwJhkRKVTcQRh/pAvEZyJauKfLkacbDFXCXI0 g==; X-IronPort-AV: E=McAfee;i="6600,9927,11010"; a="8627120" X-IronPort-AV: E=Sophos;i="6.07,117,1708416000"; d="scan'208";a="8627120" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Mar 2024 12:23:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,117,1708416000"; d="scan'208";a="11344409" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orviesa009.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 11 Mar 2024 12:23:45 -0700 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 11 Mar 2024 12:23:44 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Mon, 11 Mar 2024 12:23:44 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.168) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 11 Mar 2024 12:23:44 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ayfdvJQLloPxSEZOnR+qNll4m8C3MyACbma7dqFRczFTJb5n21x8ylF+Oxz9aOHXVvkosSVHtIGyQm60Bfz9m+SMhniqCC+EPZ6r2zp+58emjMXWXSwtRxzcGezcYydf5Y8BvFQKG793kz8d6aNGjT2YniFwAMP7pBivgqzkb7AR8gDP/0vVGTP8YperThoA1DWnCL5Vq0jT/+bXxoXsnmSP+InD9ZAWu0o/cvkDevcMxmGUEvxheqAeK+Q3RtVH8X+w/COL6pQYxUcVq3XlKnt9cNqFvv+raDL/uN/f0jpvnMBll/s92EC48v5ZfjJqt/ejoj7mnu+57kgRnZ65qA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=9cyTbc4DT+quwAetrqV9hhoVtzQzEtCemiMNpB3dppc=; b=jKVQwl6fcSuUFu91hgMx2jxARPF2wezWFSB9jssxvtGsJ/iUd9SE9+lG6flX2KG9pYvXQyW35qSIYRUYYY7Is0Vh89s0L1OC/E/ry3cx57zIroA7ixI927FeW2oEI2dgFdP9wq8v/UI4LSKEOQ/4gMfYUFURKe+49GAEFYexii+Au4guBWaksPLdTGNrUTI9mNSx+YzTz1XpwUBjps7f2Antswxl4lgcRtkh5TNpwOtZ5wcTQpx+SxtxeGBArrfeFVugzfNkxFlnbM1j+6r6GdSnB3V1LRslAeW1sOs0waIBSKbGrZdeZH4Y78RgOdKNpBYN5IADAy65f68k38Wz8w== 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: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from MN0PR11MB6059.namprd11.prod.outlook.com (2603:10b6:208:377::9) by SA1PR11MB8253.namprd11.prod.outlook.com (2603:10b6:806:250::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.14; Mon, 11 Mar 2024 19:23:41 +0000 Received: from MN0PR11MB6059.namprd11.prod.outlook.com ([fe80::7607:bd60:9638:7189]) by MN0PR11MB6059.namprd11.prod.outlook.com ([fe80::7607:bd60:9638:7189%4]) with mapi id 15.20.7386.016; Mon, 11 Mar 2024 19:23:41 +0000 From: Rodrigo Vivi To: CC: Rodrigo Vivi , Matthew Auld Subject: [PATCH 11/11] drm/xe: Kill xe_device_mem_access_{get*,put} Date: Mon, 11 Mar 2024 15:23:03 -0400 Message-ID: <20240311192303.33961-11-rodrigo.vivi@intel.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240311192303.33961-1-rodrigo.vivi@intel.com> References: <20240311192303.33961-1-rodrigo.vivi@intel.com> X-ClientProxiedBy: BY3PR05CA0059.namprd05.prod.outlook.com (2603:10b6:a03:39b::34) To MN0PR11MB6059.namprd11.prod.outlook.com (2603:10b6:208:377::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN0PR11MB6059:EE_|SA1PR11MB8253:EE_ X-MS-Office365-Filtering-Correlation-Id: 3c3a0f7d-8cfd-48ec-7e09-08dc4200c2c4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5vkBGcvbPO93vx8kB7Q9vQ/b6oOv8N+HlVQl9mhjNGkPVu4qTinpy3eldmvJyiY8mblW06zxMVmdPWKI19q29xYJfKlfG5CpYC7bQT/6e8tVLb6vbj4M2teOh/cqkM2021Id+Gu7iGYImwE4601K8Ltvoqrm4pPpvXl8IYjF48yVLc8qGEXP9nfdTaDmOxmkggNi3UGbamE5ZhUJKl5NtowhHmL9PStFQv1iyVubHBYNohOT1Jof8+sgOGd5a7Fvch0rlPccDM7Y2/Th3RteFK6LeqCTSY4IVw7Wgm5r+SoynFOIQ3mBn2VXflV2aUCJDdsJtTGwPiULOBhIoHPOVlvnXnpzC97D8JLbjAmBXE5SnFBZ8jgMsQmrUcMnQnrd3bl15CwSdki3tKCxshkPfL33cg3hb9SuG1KFhDmiT9L+ryWZemSNudaohqpg3y4uX8lotZFVpyAv1IyRMxEQvt9iWM2w0Hz0gJ1j7YXTjZD7PrV57GLrtCjxuSVNzVvvEVjAECrDOF+UgXnNl/Gg7t1/er8IkfCoKANKgW23vv7mvsiiqMT2YK06pg8pGxBC9IFa0Y7EXOdfXgL73Wq8fvANW0YELfmUEhULlerKFmEShUgqm4JdqiEWuxPcRqDWKLnjwvXAbcWiYroVQMPBn9+GeYuJ/0EaS7McGgWBtZo= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN0PR11MB6059.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(1800799015)(376005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: eWAHLWnA7HDpUsJaESKiqJggCFTsmSAwO4YS2C4FLLuVKo81CVNzBLmG77Osfr2X5h0ff89NPBxMdkScqBX68sVxEqFkO+sL0yobW368VJ+vprTqhpDkWbvByqyn5qT0MR19it54Kw9J0ZUpOnYVbohDGqeWX2ehmwM68cS4WIrK5ghtpgJtAWPufQvnx1B9fXr8vTAtyoItfjw8lPF6ohp7N7MFtqeap5dpuNzT6KfO1p8fR7qv7eZ+CETnrTJhxz/21fjkFVeqouBQVyFt+f3wP8PrQmxtbpJgzL7++rJc7JSj4MLruTk9qMvxQskFPWwT1y52ezfQP2jOGxcbd0zHbyJoUO4CYexYjuTtL60gg541XwjIM9rcm+FjPgELK87PLivZoiSakZWI2eDUWY18QtISpggLSp1DPydeo8sygLGY15wKt0SPuHtHUe/VxXJjj5gkoyk6pOHMNhug2X1fzfoqYBr4uVhGtYLieEFclLr8KGZ2mc6I5K8UZ1FHuJD0BVMFjJMPXmXzfPewlbO5Hbi0dY+azajcRBCJRGsENAgpf3BWFwga1nSjAcPoggdwfdGfbUgxY9fmsml2zOes2NSUaNTNVhwAiPL18LPGk1qe6StHMRqi//nOqyLldzscl6Jjeqd1/FSL6whbRlptbZMhb5cPQRFTorsST03v+DPX7VAQ9xyH+wizlal06vPhC0Flh8ZJxOUH6kyNwxb1P17zbi96VRmNFRJC+XyT+YwFI0IxhwUXOmwTttLQgya5M8/+Erz12YQIeFp1Mi/R1G990UcFprGZ1q6PKAYCtfd1CcROvIoA9vhF+0LjcLVXWmrJs4bgCiEhx8/QEeKVFBUA/ChfxegrPTzXBW3GB7/YdlYOxtJUjwU7pSpUASYk3E5C9vNCNlOqoMSwkuWWLD3LXQcfxnciMXe3E5DFrUp16q9mT4P5oON9NCK0499J/KWux6Fwc49cxHNXkxJQ9dRSZ/2F6H2CYWtndupzvRoMSgHyW3PHXSSH/Rsijt8FbA7b1xBLPs5mLQtdon56yKhuIpBCKI+YYaqU0z4611SYVJJOJ4HyAMEN2wpNPKkKw/y0j0RJ1zeZVfgLdEKgMrpmC0enm93nFY0UBF8VCFNIQUHZ9LcJzoCm6TCs3IXsDeKmJ0dENftIEqqtKEIDcmpL9kmuT316WjA61bo3QpEfisBkJ4ocERI7hsbcY+IAyfok0Nalowt5CCs+w52XzUwxerUyztVbB199K2sMTd3hWu0Dly5807Qw198jTN6UDp2RYcJ+lNq0WDisQhH4vrZ8QQZbV89YVeZp9213aBbqqRrgyKTrUOUEP+MBE1YE4u/iEM5eGq99Edks15jW5ti9Mv6Uvf8iyc26pQQgJUVYC+fGEdM+EKUfDo/vJtil94XG57KQRMtpOPI1rHdq9RkGbUJwD5DVwyH9AoF0D2dqpnNaLxHtguRuRDP9ULq+wdb/0MBajT0OdwgdOP6wijD3plqg1JK8MQ+CJvu5yNXE+5bcsXWxU3buywUc0gxbkF/IV3MSIs1HIPhvhE8HxE3KOynTN4HmaeDdWP8RS7dtU52Ac8BucpnWoexgVJwJjxbEG493RyJoFSYafQ== X-MS-Exchange-CrossTenant-Network-Message-Id: 3c3a0f7d-8cfd-48ec-7e09-08dc4200c2c4 X-MS-Exchange-CrossTenant-AuthSource: MN0PR11MB6059.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2024 19:23:41.7123 (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: 9d484MVeZeIzNfjc5HO+Ay9akZC6CIQHdQCsQsrM6768bJxlhxjS4h5zpe71X+kOSc+nSaQf4M6o3t2ijINd/w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR11MB8253 X-OriginatorOrg: intel.com X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Let's simply convert all the current callers towards direct xe_pm_runtime access and remove this extra layer of indirection. v2: Convert all the current callers instead of a big refactor at once. Signed-off-by: Rodrigo Vivi Reviewed-by: Matthew Auld --- drivers/gpu/drm/xe/display/xe_fb_pin.c | 7 ++--- drivers/gpu/drm/xe/xe_bo.c | 8 +++--- drivers/gpu/drm/xe/xe_device.c | 36 -------------------------- drivers/gpu/drm/xe/xe_device.h | 3 --- drivers/gpu/drm/xe/xe_device_types.h | 3 --- drivers/gpu/drm/xe/xe_exec_queue.c | 6 ++--- drivers/gpu/drm/xe/xe_ggtt.c | 9 ++++--- drivers/gpu/drm/xe/xe_sched_job.c | 5 ++-- drivers/gpu/drm/xe/xe_vm.c | 6 ++--- 9 files changed, 22 insertions(+), 61 deletions(-) diff --git a/drivers/gpu/drm/xe/display/xe_fb_pin.c b/drivers/gpu/drm/xe/display/xe_fb_pin.c index 722c84a56607..403ed2d42f6b 100644 --- a/drivers/gpu/drm/xe/display/xe_fb_pin.c +++ b/drivers/gpu/drm/xe/display/xe_fb_pin.c @@ -10,6 +10,7 @@ #include "intel_fb_pin.h" #include "xe_ggtt.h" #include "xe_gt.h" +#include "xe_pm.h" #include @@ -190,7 +191,7 @@ static int __xe_pin_fb_vma_ggtt(struct intel_framebuffer *fb, /* TODO: Consider sharing framebuffer mapping? * embed i915_vma inside intel_framebuffer */ - xe_device_mem_access_get(tile_to_xe(ggtt->tile)); + xe_pm_runtime_get_noresume(tile_to_xe(ggtt->tile)); ret = mutex_lock_interruptible(&ggtt->lock); if (ret) goto out; @@ -242,7 +243,7 @@ static int __xe_pin_fb_vma_ggtt(struct intel_framebuffer *fb, out_unlock: mutex_unlock(&ggtt->lock); out: - xe_device_mem_access_put(tile_to_xe(ggtt->tile)); + xe_pm_runtime_put(tile_to_xe(ggtt->tile)); return ret; } @@ -381,4 +382,4 @@ struct i915_address_space *intel_dpt_create(struct intel_framebuffer *fb) void intel_dpt_destroy(struct i915_address_space *vm) { return; -} \ No newline at end of file +} diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c index bc0cc5edc533..531c67083e2c 100644 --- a/drivers/gpu/drm/xe/xe_bo.c +++ b/drivers/gpu/drm/xe/xe_bo.c @@ -738,7 +738,7 @@ static int xe_bo_move(struct ttm_buffer_object *ttm_bo, bool evict, xe_assert(xe, migrate); trace_xe_bo_move(bo, new_mem->mem_type, old_mem_type, move_lacks_source); - xe_device_mem_access_get(xe); + xe_pm_runtime_get_noresume(xe); if (xe_bo_is_pinned(bo) && !xe_bo_is_user(bo)) { /* @@ -762,7 +762,7 @@ static int xe_bo_move(struct ttm_buffer_object *ttm_bo, bool evict, if (XE_WARN_ON(new_mem->start == XE_BO_INVALID_OFFSET)) { ret = -EINVAL; - xe_device_mem_access_put(xe); + xe_pm_runtime_put(xe); goto out; } @@ -780,7 +780,7 @@ static int xe_bo_move(struct ttm_buffer_object *ttm_bo, bool evict, new_mem, handle_system_ccs); if (IS_ERR(fence)) { ret = PTR_ERR(fence); - xe_device_mem_access_put(xe); + xe_pm_runtime_put(xe); goto out; } if (!move_lacks_source) { @@ -805,7 +805,7 @@ static int xe_bo_move(struct ttm_buffer_object *ttm_bo, bool evict, dma_fence_put(fence); } - xe_device_mem_access_put(xe); + xe_pm_runtime_put(xe); out: return ret; diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c index 58815e9bf242..e2e6b6dc8534 100644 --- a/drivers/gpu/drm/xe/xe_device.c +++ b/drivers/gpu/drm/xe/xe_device.c @@ -655,42 +655,6 @@ void xe_device_assert_mem_access(struct xe_device *xe) XE_WARN_ON(xe_pm_runtime_suspended(xe)); } -void xe_device_mem_access_get(struct xe_device *xe) -{ - int ref; - - /* - * This looks racy, but should be fine since the pm_callback_task only - * transitions from NULL -> current (and back to NULL again), during the - * runtime_resume() or runtime_suspend() callbacks, for which there can - * only be a single one running for our device. We only need to prevent - * recursively calling the runtime_get or runtime_put from those - * callbacks, as well as preventing triggering any access_ongoing - * asserts. - */ - if (xe_pm_read_callback_task(xe) == current) - return; - - xe_pm_runtime_get_noresume(xe); - ref = atomic_inc_return(&xe->mem_access.ref); - - xe_assert(xe, ref != S32_MAX); - -} - -void xe_device_mem_access_put(struct xe_device *xe) -{ - int ref; - - if (xe_pm_read_callback_task(xe) == current) - return; - - ref = atomic_dec_return(&xe->mem_access.ref); - xe_pm_runtime_put(xe); - - xe_assert(xe, ref >= 0); -} - void xe_device_snapshot_print(struct xe_device *xe, struct drm_printer *p) { struct xe_gt *gt; diff --git a/drivers/gpu/drm/xe/xe_device.h b/drivers/gpu/drm/xe/xe_device.h index b45592b0bf19..355bddfc8274 100644 --- a/drivers/gpu/drm/xe/xe_device.h +++ b/drivers/gpu/drm/xe/xe_device.h @@ -133,9 +133,6 @@ static inline struct xe_force_wake *gt_to_fw(struct xe_gt *gt) return >->mmio.fw; } -void xe_device_mem_access_get(struct xe_device *xe); -void xe_device_mem_access_put(struct xe_device *xe); - void xe_device_assert_mem_access(struct xe_device *xe); static inline bool xe_device_in_fault_mode(struct xe_device *xe) diff --git a/drivers/gpu/drm/xe/xe_device_types.h b/drivers/gpu/drm/xe/xe_device_types.h index 9785eef2e5a4..4bec8b90a37c 100644 --- a/drivers/gpu/drm/xe/xe_device_types.h +++ b/drivers/gpu/drm/xe/xe_device_types.h @@ -377,9 +377,6 @@ struct xe_device { * triggering additional actions when they occur. */ struct { - /** @mem_access.ref: ref count of memory accesses */ - atomic_t ref; - /** * @mem_access.vram_userfault: Encapsulate vram_userfault * related stuff diff --git a/drivers/gpu/drm/xe/xe_exec_queue.c b/drivers/gpu/drm/xe/xe_exec_queue.c index f69a9c99329c..42ddf857e9e8 100644 --- a/drivers/gpu/drm/xe/xe_exec_queue.c +++ b/drivers/gpu/drm/xe/xe_exec_queue.c @@ -217,7 +217,7 @@ void xe_exec_queue_fini(struct xe_exec_queue *q) for (i = 0; i < q->width; ++i) xe_lrc_finish(q->lrc + i); if (!(q->flags & EXEC_QUEUE_FLAG_PERMANENT) && (q->flags & EXEC_QUEUE_FLAG_VM || !q->vm)) - xe_device_mem_access_put(gt_to_xe(q->gt)); + xe_pm_runtime_put(gt_to_xe(q->gt)); __xe_exec_queue_free(q); } @@ -589,7 +589,7 @@ int xe_exec_queue_create_ioctl(struct drm_device *dev, void *data, return -EINVAL; /* The migration vm doesn't hold rpm ref */ - xe_device_mem_access_get(xe); + xe_pm_runtime_get_noresume(xe); flags = EXEC_QUEUE_FLAG_VM | (id ? EXEC_QUEUE_FLAG_BIND_ENGINE_CHILD : 0); @@ -598,7 +598,7 @@ int xe_exec_queue_create_ioctl(struct drm_device *dev, void *data, args->width, hwe, flags, args->extensions); - xe_device_mem_access_put(xe); /* now held by engine */ + xe_pm_runtime_put(xe); /* now held by engine */ xe_vm_put(migrate_vm); if (IS_ERR(new)) { diff --git a/drivers/gpu/drm/xe/xe_ggtt.c b/drivers/gpu/drm/xe/xe_ggtt.c index 0f96b7db6dcc..d73056aa2362 100644 --- a/drivers/gpu/drm/xe/xe_ggtt.c +++ b/drivers/gpu/drm/xe/xe_ggtt.c @@ -20,6 +20,7 @@ #include "xe_gt_printk.h" #include "xe_gt_tlb_invalidation.h" #include "xe_map.h" +#include "xe_pm.h" #include "xe_sriov.h" #include "xe_wopcm.h" @@ -408,14 +409,14 @@ static int __xe_ggtt_insert_bo_at(struct xe_ggtt *ggtt, struct xe_bo *bo, if (err) return err; - xe_device_mem_access_get(tile_to_xe(ggtt->tile)); + xe_pm_runtime_get_noresume(tile_to_xe(ggtt->tile)); mutex_lock(&ggtt->lock); err = drm_mm_insert_node_in_range(&ggtt->mm, &bo->ggtt_node, bo->size, alignment, 0, start, end, 0); if (!err) xe_ggtt_map_bo(ggtt, bo); mutex_unlock(&ggtt->lock); - xe_device_mem_access_put(tile_to_xe(ggtt->tile)); + xe_pm_runtime_put(tile_to_xe(ggtt->tile)); return err; } @@ -433,7 +434,7 @@ int xe_ggtt_insert_bo(struct xe_ggtt *ggtt, struct xe_bo *bo) void xe_ggtt_remove_node(struct xe_ggtt *ggtt, struct drm_mm_node *node) { - xe_device_mem_access_get(tile_to_xe(ggtt->tile)); + xe_pm_runtime_get_noresume(tile_to_xe(ggtt->tile)); mutex_lock(&ggtt->lock); xe_ggtt_clear(ggtt, node->start, node->size); @@ -443,7 +444,7 @@ void xe_ggtt_remove_node(struct xe_ggtt *ggtt, struct drm_mm_node *node) xe_ggtt_invalidate(ggtt); mutex_unlock(&ggtt->lock); - xe_device_mem_access_put(tile_to_xe(ggtt->tile)); + xe_pm_runtime_put(tile_to_xe(ggtt->tile)); } void xe_ggtt_remove_bo(struct xe_ggtt *ggtt, struct xe_bo *bo) diff --git a/drivers/gpu/drm/xe/xe_sched_job.c b/drivers/gpu/drm/xe/xe_sched_job.c index 8151ddafb940..8ba35b1698ed 100644 --- a/drivers/gpu/drm/xe/xe_sched_job.c +++ b/drivers/gpu/drm/xe/xe_sched_job.c @@ -15,6 +15,7 @@ #include "xe_hw_fence.h" #include "xe_lrc.h" #include "xe_macros.h" +#include "xe_pm.h" #include "xe_trace.h" #include "xe_vm.h" @@ -157,7 +158,7 @@ struct xe_sched_job *xe_sched_job_create(struct xe_exec_queue *q, /* All other jobs require a VM to be open which has a ref */ if (unlikely(q->flags & EXEC_QUEUE_FLAG_KERNEL)) - xe_device_mem_access_get(job_to_xe(job)); + xe_pm_runtime_get_noresume(job_to_xe(job)); xe_device_assert_mem_access(job_to_xe(job)); trace_xe_sched_job_create(job); @@ -190,7 +191,7 @@ void xe_sched_job_destroy(struct kref *ref) container_of(ref, struct xe_sched_job, refcount); if (unlikely(job->q->flags & EXEC_QUEUE_FLAG_KERNEL)) - xe_device_mem_access_put(job_to_xe(job)); + xe_pm_runtime_put(job_to_xe(job)); xe_exec_queue_put(job->q); dma_fence_put(job->fence); drm_sched_job_cleanup(&job->drm); diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c index 643b3701a738..84360f4a1b60 100644 --- a/drivers/gpu/drm/xe/xe_vm.c +++ b/drivers/gpu/drm/xe/xe_vm.c @@ -1324,7 +1324,7 @@ struct xe_vm *xe_vm_create(struct xe_device *xe, u32 flags) vm->pt_ops = &xelp_pt_ops; if (!(flags & XE_VM_FLAG_MIGRATION)) - xe_device_mem_access_get(xe); + xe_pm_runtime_get_noresume(xe); vm_resv_obj = drm_gpuvm_resv_object_alloc(&xe->drm); if (!vm_resv_obj) { @@ -1435,7 +1435,7 @@ struct xe_vm *xe_vm_create(struct xe_device *xe, u32 flags) xe_range_fence_tree_fini(&vm->rftree[id]); kfree(vm); if (!(flags & XE_VM_FLAG_MIGRATION)) - xe_device_mem_access_put(xe); + xe_pm_runtime_put(xe); return ERR_PTR(err); } @@ -1558,7 +1558,7 @@ static void vm_destroy_work_func(struct work_struct *w) mutex_destroy(&vm->snap_mutex); if (!(vm->flags & XE_VM_FLAG_MIGRATION)) { - xe_device_mem_access_put(xe); + xe_pm_runtime_put(xe); if (xe->info.has_asid && vm->usm.asid) { mutex_lock(&xe->usm.lock);