From patchwork Fri Jun 2 23:21:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "David E. Box" X-Patchwork-Id: 102719 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1365120vqr; Fri, 2 Jun 2023 16:35:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ53nGPwoXY95oWvyXgGwLv4UTBc2wcQJFtnuz6Kd8y3qepCr4SOm+eGRXTe1liVi6w94fQa X-Received: by 2002:a05:6a21:998b:b0:104:1016:dd0e with SMTP id ve11-20020a056a21998b00b001041016dd0emr124046pzb.3.1685748914996; Fri, 02 Jun 2023 16:35:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685748914; cv=none; d=google.com; s=arc-20160816; b=I6arldxEi3gzN8AlmqIWEuxV/9OIAndRpjKVC+DQuBiwfGHd8iMQJKE08f95Ur9f7L imZcbMXy/2KR/JLevxU954V+fONDscHixOSr3QykZ0KZT+zVv0q5BAN6TMnMIGVJY3Hx +vzPOI9HNVrRE71oHEBPJqDykQQCRNuBR4phffY6YokggEMrUjfzbuJhs7+RlCbg+km3 jjBAMb2jRfyAVO/NC20EP2DLTGYQgRrZ9Gqb2rwx0WGjblaLcGF2+ppuIve2ChxQfwWh HEg77om6V0VzyYQ7pEXzatsw7jkjdxIQ5ZV+HaJgsbxc31WwslDTnzhNXHZ5Z+dmSSdv 5jeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=TDFb8x+v1Cpddrzea9fwkDk2w/Cje4yTRoEte8YcWps=; b=NqiRtWfXkKrdaK2/FCNys6Q8kPg/PvPEqAo+PuhnHs9upaaIQ/qpRdAEaf0cq9HFNO vj0oRuJ1Uru1hEpYWLLznWIHbrD8qebvwhcuG1vsSflKe6CfXPIxGsA8iQjdNsTSwZ7F t0LCaXCd/qwgIJ7PtHr1L85p3fON/on+BEdEwyr1VlehSttQnlRz+fkareypPUXd942M fBKbeh9j/+IlCxL2cb+v99Ml6pGQUlZtZmcNE3Q5oB6yf4VjJxZmRrNdqMfbAs844/zH EBS4QXLTHdV/cqL8pg3lTNRjVaXWoNo255fMaC/dOZtMixAJg3AttyyKc+1gP5WoLx4f 8d2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=MQJKTk7C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y16-20020a63b510000000b0052feffab912si1695970pge.273.2023.06.02.16.35.02; Fri, 02 Jun 2023 16:35:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=MQJKTk7C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236636AbjFBXVs (ORCPT + 99 others); Fri, 2 Jun 2023 19:21:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234452AbjFBXVr (ORCPT ); Fri, 2 Jun 2023 19:21:47 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AD871B5; Fri, 2 Jun 2023 16:21:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685748103; x=1717284103; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=0QMr+LsyFpUa44hvu1HGLdLwcSLm0H5G8gRPGZoFgm4=; b=MQJKTk7CtywPFOIZPNfKCfEVOtDbYPilD/zMOHHfwBVPgqHv8L5x/x2f zddYqCsd55wDigjPGrdXBK54yZX+2oWWTydsmCH8B1VzFnylubbxStYuF nUuL93MtQt9+zjkINEwuJH8sk3PfsFzNbXvn9x7z0O8/jb1s0ZzYvKsWe 5+5WVYawVwmZHhJnC0zpUxq0nVySNEr2fzFc1LA6HZaMDVl+ffwMRZ3yb WV+XhxW7lvng0UmNyEn39eIG2cqCs1Z3XO3KIQB+OgN3OYZiHSRlmHtt2 Fdo3ePUNOW1/zcFWC21akTuqnrcd8xkjwQRMzUi8NScjzUmR/6ujNyYMC g==; X-IronPort-AV: E=McAfee;i="6600,9927,10729"; a="442370907" X-IronPort-AV: E=Sophos;i="6.00,214,1681196400"; d="scan'208";a="442370907" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jun 2023 16:21:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10729"; a="882229221" X-IronPort-AV: E=Sophos;i="6.00,214,1681196400"; d="scan'208";a="882229221" Received: from linux.intel.com ([10.54.29.200]) by orsmga005.jf.intel.com with ESMTP; 02 Jun 2023 16:21:42 -0700 Received: from debox1-desk4.intel.com (unknown [10.212.214.169]) by linux.intel.com (Postfix) with ESMTP id 9CB4A580ABF; Fri, 2 Jun 2023 16:21:42 -0700 (PDT) From: "David E. Box" To: irenic.rajneesh@gmail.com, david.e.box@linux.intel.com, hdegoede@redhat.com, markgross@kernel.org, ilpo.jarvinen@linux.intel.com Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] platform/x86/intel/pmc: Add resume_fixup callback Date: Fri, 2 Jun 2023 16:21:41 -0700 Message-Id: <20230602232142.278155-1-david.e.box@linux.intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767635854216832342?= X-GMAIL-MSGID: =?utf-8?q?1767635854216832342?= Add a resume_fixup callback to perform platform specific fixups during resume from suspend. Signed-off-by: David E. Box --- drivers/platform/x86/intel/pmc/core.c | 3 +++ drivers/platform/x86/intel/pmc/core.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/drivers/platform/x86/intel/pmc/core.c b/drivers/platform/x86/intel/pmc/core.c index da6e7206d38b..0fcd1cb7264b 100644 --- a/drivers/platform/x86/intel/pmc/core.c +++ b/drivers/platform/x86/intel/pmc/core.c @@ -1229,6 +1229,9 @@ static __maybe_unused int pmc_core_resume(struct device *dev) const struct pmc_bit_map **maps = pmcdev->map->lpm_sts; int offset = pmcdev->map->lpm_status_offset; + if (pmcdev->resume_fixup) + pmcdev->resume_fixup(); + /* Check if the syspend used S0ix */ if (pm_suspend_via_firmware()) return 0; diff --git a/drivers/platform/x86/intel/pmc/core.h b/drivers/platform/x86/intel/pmc/core.h index 9ca9b9746719..b58458d00bd3 100644 --- a/drivers/platform/x86/intel/pmc/core.h +++ b/drivers/platform/x86/intel/pmc/core.h @@ -327,6 +327,7 @@ struct pmc_reg_map { * @lpm_en_modes: Array of enabled modes from lowest to highest priority * @lpm_req_regs: List of substate requirements * @core_configure: Function pointer to configure the platform + * @resume_fixup: Function to perform fixups during resume * * pmc_dev contains info about power management controller device. */ @@ -345,6 +346,7 @@ struct pmc_dev { int lpm_en_modes[LPM_MAX_NUM_MODES]; u32 *lpm_req_regs; void (*core_configure)(struct pmc_dev *pmcdev); + void (*resume_fixup)(void); }; extern const struct pmc_bit_map msr_map[]; From patchwork Fri Jun 2 23:21:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "David E. Box" X-Patchwork-Id: 102717 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1364633vqr; Fri, 2 Jun 2023 16:33:50 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7luQmYKpXoV9fJUIk08ZYc35+Fd8O7OBmgFL0oAF5o30UzM/TaW9yS2YGmZSgxh4HRe/T1 X-Received: by 2002:a05:6a20:6a1e:b0:101:3c60:6794 with SMTP id p30-20020a056a206a1e00b001013c606794mr136667pzk.2.1685748830426; Fri, 02 Jun 2023 16:33:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685748830; cv=none; d=google.com; s=arc-20160816; b=n4s97DX/2GeDQI6EoeLd1Sr5GAGAEndZ+E3A73EBxsQnR2t4Hx1dwWviGY7DxJa4AV NQk1m2UeSlEj7aDg5yko7vg26Ll8hbJ9P887pk55GihO0xDPxBh0g7P9dTpuWf6MWPwZ CyOjsWoUvwbH9KTv9SjOPV8Fw4s2oErTw5AuW5QuuOJLL9ytynMB9Vq4Z8F/p3jfFsOM v25YTzgBMYLMym/rfaehnmXDnXnsqvwm5y2nUOIF7ZQZLHwwhWmzu0OmfUc9ZSfgVDS1 L0wq1iYPEAYP87hYbosgYPPkigA26sYu5oIk9PIWamfjQBp/E+D7e5JvBIcfupH7QE26 uMBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Uvj2/gPtolhbW9f1XdhKgYN9ll6+nQsuoLe+h1N0J24=; b=YqJCbMfzdmbmchuDTr2PgpXg/GLpDzcMMd19QY3eefV9X0PsY28yG6Xt1ccIEKCyv5 37BiPN8J3uo7QiJ9biPx78fv+t7W0YlqlJz8P6SE041ZdX8pT5kp5B5zgbDa5gx29Gvj KU7W1C4D9yqZ8ESLCFjs6CWpqnYWXuxSyZ8BeZJVvR/oBWB6T/6LCn+qQKnkyXpzWrPk o6rA/wvfb8JIoOj/ckz/wicDftguLPcwPb+KVDuMcfwToZuphNemlecWzVH2kMidxSSd IWYaqtCYzNoWSa/10rw7grZ6Rd3byLwguLHyp2q/3Ye3BUG6HBk7LPauTI/pg65LLrMQ +kEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="D/llnO5h"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t14-20020a63780e000000b0053028c29b4dsi1705790pgc.92.2023.06.02.16.33.34; Fri, 02 Jun 2023 16:33:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="D/llnO5h"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234452AbjFBXVu (ORCPT + 99 others); Fri, 2 Jun 2023 19:21:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236529AbjFBXVr (ORCPT ); Fri, 2 Jun 2023 19:21:47 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1911BE42; Fri, 2 Jun 2023 16:21:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685748107; x=1717284107; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fsVknyo+YJ2O89L4WdIV6WoO7IVwiIgXQ8fTtfWuOdw=; b=D/llnO5hJXfoEqFnWUsw3duu4UsSP+5wy+3wdz6PDbTDo+Q4cbh2vo4O pwkhHUI4uCB3wgxVlfue+fC6a+zpEX9iUvsG2cJLyp6OkgfPcbAW8UzOc /5y4NnyP6XuQXdrLPxvTFsKos8oVu/cdHIkLXjgI3LTjiTTgCwgrZyqjB 2+g/+7Mu2eJxxE8igu+cjdWtK8lxY5WBivdtbfZL2EqHcdKaYhmO2DktY rE76Rcldu7oU7Ur3/spwR9yoBMHHU2D15oRYZ/EAjtzQsCgfbZaGj1zuH Dh8BJn1wcIMWVIvWY8xy4mcmuojHHcpzrpYhj8Bhg7r9FalkCUOrXztyR A==; X-IronPort-AV: E=McAfee;i="6600,9927,10729"; a="442370912" X-IronPort-AV: E=Sophos;i="6.00,214,1681196400"; d="scan'208";a="442370912" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jun 2023 16:21:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10729"; a="882229222" X-IronPort-AV: E=Sophos;i="6.00,214,1681196400"; d="scan'208";a="882229222" Received: from linux.intel.com ([10.54.29.200]) by orsmga005.jf.intel.com with ESMTP; 02 Jun 2023 16:21:42 -0700 Received: from debox1-desk4.intel.com (unknown [10.212.214.169]) by linux.intel.com (Postfix) with ESMTP id CBB73580D5F; Fri, 2 Jun 2023 16:21:42 -0700 (PDT) From: "David E. Box" To: irenic.rajneesh@gmail.com, david.e.box@linux.intel.com, hdegoede@redhat.com, markgross@kernel.org, ilpo.jarvinen@linux.intel.com Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] platform/x86/intel/pmc/mtl: Put devices in D3 during resume Date: Fri, 2 Jun 2023 16:21:42 -0700 Message-Id: <20230602232142.278155-2-david.e.box@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230602232142.278155-1-david.e.box@linux.intel.com> References: <20230602232142.278155-1-david.e.box@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767635765599893125?= X-GMAIL-MSGID: =?utf-8?q?1767635765599893125?= An earlier commit placed some driverless devices in D3 during boot so that they don't block package cstate entry. Also place these devices in D3 after resume from suspend. Fixes: 336ba968d3e3 ("platform/x86/intel/pmc/mtl: Put GNA/IPU/VPU devices in D3") Signed-off-by: David E. Box --- drivers/platform/x86/intel/pmc/mtl.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/platform/x86/intel/pmc/mtl.c b/drivers/platform/x86/intel/pmc/mtl.c index e8cc156412ce..d87c4597c6d4 100644 --- a/drivers/platform/x86/intel/pmc/mtl.c +++ b/drivers/platform/x86/intel/pmc/mtl.c @@ -68,11 +68,8 @@ static void mtl_set_device_d3(unsigned int device) } } -void mtl_core_init(struct pmc_dev *pmcdev) +static void mtl_fixup(void) { - pmcdev->map = &mtl_reg_map; - pmcdev->core_configure = mtl_core_configure; - /* * Set power state of select devices that do not have drivers to D3 * so that they do not block Package C entry. @@ -81,3 +78,13 @@ void mtl_core_init(struct pmc_dev *pmcdev) mtl_set_device_d3(MTL_IPU_PCI_DEV); mtl_set_device_d3(MTL_VPU_PCI_DEV); } + +void mtl_core_init(struct pmc_dev *pmcdev) +{ + pmcdev->map = &mtl_reg_map; + pmcdev->core_configure = mtl_core_configure; + + mtl_fixup(); + + pmcdev->resume_fixup = mtl_fixup; +}