From patchwork Tue Sep 24 20:35:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Vivi X-Patchwork-Id: 13811164 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 B35BACF9C6B for ; Tue, 24 Sep 2024 20:43:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2DDDE10E175; Tue, 24 Sep 2024 20:43:09 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="AXRQEyZd"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) by gabe.freedesktop.org (Postfix) with ESMTPS id 60EA610E746; Tue, 24 Sep 2024 20:43:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1727210589; x=1758746589; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=5/VXjSRm2vSfNiAK4Lp4aAqtby5ziRNh83f2Rj4/tk8=; b=AXRQEyZdwA6qvfmdmKNNoeGsEqLdp7ozRBBfADFY2TsUEDmG875wepxE ua2p3TL3ftn26Sh4AH7Wg+q0fjT+Jpqe5TYBRTAPDbxAS8CbYgHpKI2Yn gKYiqr3JYQ8GLxbGDRGUPzIPxG4qus2zxMAIB8E7HQZyhqzktBu7evAcF t9zOnBnj2nqbJGovYG4jFtPdlOk61TPnMc0ZWGzRiO0Tz12uTfyedstzp dfwfrIU/nA1TwmcPW5zSAdExmxrBA568ezoRyAcSvyfjOBkMn9q1hMstt OpC8qJXDwwmPJPiTZcosM2Za6Zi3pKPtiQppV1C/zW2uJ0UERBs3RSIcd w==; X-CSE-ConnectionGUID: ytA4cJ+cSCyHsq+Tprd3pA== X-CSE-MsgGUID: /i2kSO1iTBaYDXChO5UqgQ== X-IronPort-AV: E=McAfee;i="6700,10204,11205"; a="26326099" X-IronPort-AV: E=Sophos;i="6.10,255,1719903600"; d="scan'208";a="26326099" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Sep 2024 13:43:08 -0700 X-CSE-ConnectionGUID: eZiQtPlZSJG1akYk7F8itg== X-CSE-MsgGUID: XzXEfW70RPST8xu9u/1N/g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,255,1719903600"; d="scan'208";a="109001490" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by orviesa001.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 24 Sep 2024 13:43:08 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) 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.39; Tue, 24 Sep 2024 13:43:07 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 24 Sep 2024 13:43:07 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Tue, 24 Sep 2024 13:43:07 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.169) 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.39; Tue, 24 Sep 2024 13:43:07 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dv4GpOYjYnkeCVuP5ZOPMRw9MSyIEoGKjio8+Geu8trpvaIjl7IhCF5v74qYPCncL91K/WFVj9gf8xFdVy0o5ceNZOZT55gPgaJW+GEGy3DH0DXpNu6f5zAGm2jEUR6oKbY3sQb9ArbWnM5Z1heLvp1d4lY+s7UIuYTyk/p1/cqZVB3FsFQWZ01rBcrHrIruiJfgRK1v4+M0yYTo9Y73npPTKiRY7wtcMtbBxTeL0NuaF3uyf5TgD+gqg2ACwvKIc0wDi0QO7QaY5phESO87Dm8YYJ7GEnEy862iDC0f3CMplI4IHpaSGFwMomKWNT0UKs3LZOALhiXWsIuh5n8egg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ye6BKmDX6r5CRlRbJFIGfmuCwuryxVqFEig0EO5WEHM=; b=wZrZLReTiYsrtNmxOW+jydPY+Qq/cAc6uEYiLQPBftloHYirzoJiJECQKHAFqabbXzAUCu0qbmkNTgPxh6axWRU+iWNCF/eLVu8JMdi5oaCzgGOSrY2CeViaRTZ/lSVdavKcpmOAdysZV6ui/s0IjFFoweW7f5uOKA5RzyT8CjsArqhRHIbxRy/tlcfwESv0LfGrf5jaVHRYz9QAS9gRJy+6H97BSgo7ZF7TQlpgEV3cuaUv7RrVQwbuD0UrR5ekGT0XYlcuvusqwDxFOn2KtNJaC1H4rcY8VVhczvRlgXFhUxxKmsSLJhirvzPzhlUjiuJSEsH6yjbahBPE3g+/jA== 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 BYAPR11MB2854.namprd11.prod.outlook.com (2603:10b6:a02:c9::12) by PH0PR11MB4965.namprd11.prod.outlook.com (2603:10b6:510:34::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.27; Tue, 24 Sep 2024 20:43:05 +0000 Received: from BYAPR11MB2854.namprd11.prod.outlook.com ([fe80::8a98:4745:7147:ed42]) by BYAPR11MB2854.namprd11.prod.outlook.com ([fe80::8a98:4745:7147:ed42%5]) with mapi id 15.20.7962.022; Tue, 24 Sep 2024 20:43:05 +0000 From: Rodrigo Vivi To: , CC: , Rodrigo Vivi Subject: [PATCH 10/31] drm/xe/display: Spin-off xe_display runtime/d3cold sequences Date: Tue, 24 Sep 2024 16:35:31 -0400 Message-ID: <20240924204222.246862-11-rodrigo.vivi@intel.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240924204222.246862-1-rodrigo.vivi@intel.com> References: <20240924204222.246862-1-rodrigo.vivi@intel.com> X-ClientProxiedBy: MW4PR02CA0005.namprd02.prod.outlook.com (2603:10b6:303:16d::14) To BYAPR11MB2854.namprd11.prod.outlook.com (2603:10b6:a02:c9::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR11MB2854:EE_|PH0PR11MB4965:EE_ X-MS-Office365-Filtering-Correlation-Id: 1eb6a0b9-09f3-496f-2795-08dcdcd97d80 X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376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8kDSykmavIZsADbz0jXE4deJuvOd2YiUJGXPIDDcJ+r21mc0sr3t2+GQi+y2FIm+osGjyw/Lyi8wWA0NMWi0srTBGTUIRyuc87hXn7m06NgY7Kn1FDaD4Q8gRT6711H2+eq7xXSp1eHG6pt4qm7s2iM8p3z9+WQJYBucTUHtOJn3/L+y6t0kNaZflIfkdEuN4zivnmfKKnJK+s8MJWNOZWU8s/7GFYyfw3Yl5b9MmU6M0uMzw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR11MB2854.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(376014)(366016); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: AXICXKtgfaTKROPgx/0z9oQjfSSkgOKYlHy0mhtojD78WLHnyUJ5qeb/UfihvQr8Ii67erlcUAu+Zj+WYVQTPcETAJGdCK6kLrFY5ArCTn+ZBe+j0G3DJ9b66XZHaecppM5G7Ds/GrJW+qTK8ZD+9mrtlwbpIOrmB+TnUpopYpSUaniUZCOXPvxpkSh9yRyR/hV0Bfg+/qS+kc/EDCS/TVyyTe4QgTmz/T2XB4idN0ioqLrkTojqBpFMNOuXLH05yC9xIdPIW6JlfuLgT2n25dSgS0TMQBYQ/4yqmXRAxxaXWOn0VPr3+8Eu2KHloJxIHv2zwNpDTPdp27NrHBTAd1XuyGc3xFtrk8LOA+m6iGhQG3rd72cNLSdS8YLmqTEHYQ+UHFKskQsbCP1haCmJeL1yGEgb0Z1MepUPJyjC3WgLhO5CPtJPC5FXBFmJLoNllp7tUmGGjjmmFny0WZYD+Lqzp4TK/3/6tAutXqjcWvcTzw1W9/CGH1nePjdoNYowCD493DBOwoYbyU1kyAiRMlQVuRytUQmBNkIn4ySgKa10EflGgdTxDCdUi3pctpV7zsNYT1dGIj47gTTF/ZDnEamfdhb8ToAdjMB4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MS-Exchange-CrossTenant-AuthSource: BYAPR11MB2854.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Sep 2024 20:43:05.3803 (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: pqSy+ZBm0nFZmVWXloN02FrUD7tcA1QnMUefDXeqfuthp55DXWO2kewVsCJ5G4TkKVHWWGfZsCDwPrI44Cm8gQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB4965 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" No functional change. This patch only splits the xe_display_pm suspend/resume functions in the regular suspend/resume from the runtime/d3cold ones. Signed-off-by: Rodrigo Vivi Reviewed-by: Jonathan Cavitt --- drivers/gpu/drm/xe/display/xe_display.c | 68 ++++++++++++++++--------- 1 file changed, 45 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/xe/display/xe_display.c b/drivers/gpu/drm/xe/display/xe_display.c index be431d9907df..a4705a452adb 100644 --- a/drivers/gpu/drm/xe/display/xe_display.c +++ b/drivers/gpu/drm/xe/display/xe_display.c @@ -308,8 +308,41 @@ static void xe_display_flush_cleanup_work(struct xe_device *xe) } } -/* TODO: System and runtime suspend/resume sequences will be sanitized as a follow-up. */ -static void __xe_display_pm_suspend(struct xe_device *xe, bool runtime) +static void xe_display_to_d3cold(struct xe_device *xe) +{ + struct intel_display *display = &xe->display; + + /* We do a lot of poking in a lot of registers, make sure they work properly. */ + intel_power_domains_disable(xe); + + xe_display_flush_cleanup_work(xe); + + intel_hpd_cancel_work(xe); + + intel_opregion_suspend(display, PCI_D3cold); + + intel_dmc_suspend(display); +} + +static void xe_display_from_d3cold(struct xe_device *xe) +{ + struct intel_display *display = &xe->display; + + intel_dmc_resume(display); + + if (has_display(xe)) + drm_mode_config_reset(&xe->drm); + + intel_display_driver_init_hw(xe); + + intel_hpd_init(xe); + + intel_opregion_resume(display); + + intel_power_domains_enable(xe); +} + +void xe_display_pm_suspend(struct xe_device *xe) { struct intel_display *display = &xe->display; bool s2idle = suspend_to_idle(); @@ -321,10 +354,10 @@ static void __xe_display_pm_suspend(struct xe_device *xe, bool runtime) * properly. */ intel_power_domains_disable(xe); - if (!runtime) - intel_fbdev_set_suspend(&xe->drm, FBINFO_STATE_SUSPENDED, true); - if (!runtime && has_display(xe)) { + intel_fbdev_set_suspend(&xe->drm, FBINFO_STATE_SUSPENDED, true); + + if (has_display(xe)) { drm_kms_helper_poll_disable(&xe->drm); intel_display_driver_disable_user_access(xe); intel_display_driver_suspend(xe); @@ -334,7 +367,7 @@ static void __xe_display_pm_suspend(struct xe_device *xe, bool runtime) intel_hpd_cancel_work(xe); - if (!runtime && has_display(xe)) { + if (has_display(xe)) { intel_display_driver_suspend_access(xe); intel_encoder_suspend_all(&xe->display); } @@ -344,11 +377,6 @@ static void __xe_display_pm_suspend(struct xe_device *xe, bool runtime) intel_dmc_suspend(display); } -void xe_display_pm_suspend(struct xe_device *xe) -{ - __xe_display_pm_suspend(xe, false); -} - void xe_display_pm_shutdown(struct xe_device *xe) { if (!xe->info.probe_display) @@ -379,7 +407,7 @@ void xe_display_pm_runtime_suspend(struct xe_device *xe) return; if (xe->d3cold.allowed) - __xe_display_pm_suspend(xe, true); + xe_display_to_d3cold(xe); intel_hpd_poll_enable(xe); } @@ -405,7 +433,7 @@ void xe_display_pm_resume_early(struct xe_device *xe) intel_power_domains_resume(xe); } -static void __xe_display_pm_resume(struct xe_device *xe, bool runtime) +void xe_display_pm_resume(struct xe_device *xe) { struct intel_display *display = &xe->display; @@ -419,12 +447,12 @@ static void __xe_display_pm_resume(struct xe_device *xe, bool runtime) intel_display_driver_init_hw(xe); - if (!runtime && has_display(xe)) + if (has_display(xe)) intel_display_driver_resume_access(xe); intel_hpd_init(xe); - if (!runtime && has_display(xe)) { + if (has_display(xe)) { intel_display_driver_resume(xe); drm_kms_helper_poll_enable(&xe->drm); intel_display_driver_enable_user_access(xe); @@ -433,17 +461,11 @@ static void __xe_display_pm_resume(struct xe_device *xe, bool runtime) intel_opregion_resume(display); - if (!runtime) - intel_fbdev_set_suspend(&xe->drm, FBINFO_STATE_RUNNING, false); + intel_fbdev_set_suspend(&xe->drm, FBINFO_STATE_RUNNING, false); intel_power_domains_enable(xe); } -void xe_display_pm_resume(struct xe_device *xe) -{ - __xe_display_pm_resume(xe, false); -} - void xe_display_pm_runtime_resume(struct xe_device *xe) { if (!xe->info.probe_display) @@ -452,7 +474,7 @@ void xe_display_pm_runtime_resume(struct xe_device *xe) intel_hpd_poll_disable(xe); if (xe->d3cold.allowed) - __xe_display_pm_resume(xe, true); + xe_display_from_d3cold(xe); }