Message ID | 20230602232142.278155-2-david.e.box@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> 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 <rfc822;limurcpp@gmail.com> + 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 <rfc822;linux-kernel@vger.kernel.org>); 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" <david.e.box@linux.intel.com> 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 Content-Transfer-Encoding: 8bit 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: <linux-kernel.vger.kernel.org> 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?= |
Series |
[1/2] platform/x86/intel/pmc: Add resume_fixup callback
|
|
Commit Message
David E. Box
June 2, 2023, 11:21 p.m. UTC
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 <david.e.box@linux.intel.com>
---
drivers/platform/x86/intel/pmc/mtl.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
Comments
On Fri, 2 Jun 2023, David E. Box wrote: > 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 <david.e.box@linux.intel.com> > --- > 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); I'd prefer the function be called something related to d3 / power state / or some along those lines rather than something obscure such as mtl_fixup(). And you can move the comment to be a function comment now. > } > + > +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; I'm a bit on the edge here whether this is a good approach in long-term or if it would be better to just provide a way for the platform file to replace entire .resume() (for this task it's obviously enough but it feels a bit hacky to hook into one fixed place on resume path). static __maybe_unused int pmc_core_resume(struct device *dev) { if (pmcdev->resume) return pmcdev->resume(); else return pmc_core_resume_common(); } where pmc_core_resume_common() contains the current pmc_core_resume() contents. mtl_resume() would just call the d3 func and the common resume functions.
On Mon, 2023-06-05 at 14:59 +0300, Ilpo Järvinen wrote: > On Fri, 2 Jun 2023, David E. Box wrote: > > > 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 <david.e.box@linux.intel.com> > > --- > > 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); > > I'd prefer the function be called something related to d3 / power state / > or some along those lines rather than something obscure such as > mtl_fixup(). And you can move the comment to be a function comment now. Okay. > > > } > > + > > +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; > > I'm a bit on the edge here whether this is a good approach in long-term or > if it would be better to just provide a way for the platform file to > replace entire .resume() (for this task it's obviously enough but it > feels a bit hacky to hook into one fixed place on resume path). > > static __maybe_unused int pmc_core_resume(struct device *dev) > { > if (pmcdev->resume) > return pmcdev->resume(); > else > return pmc_core_resume_common(); > } > > where pmc_core_resume_common() contains the current pmc_core_resume() > contents. > > mtl_resume() would just call the d3 func and the common resume functions. Yeah, makes sense. There are several conditional tasks in the current resume code, so trying to have a fixed place in there to call a platform specific workaround may not be possible if we need to use this again for a different reason. David > >
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; +}