Message ID | 20230607233849.239047-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 k13csp557903vqr; Wed, 7 Jun 2023 16:55:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6I1dgNxgyIhqtQrMgrY1LgD/N9ZnZ0zeT5bNMUnBR9qLkw6dfxc+o0e5XzVxyEiac1luxi X-Received: by 2002:a05:6a00:14ca:b0:662:5c39:48e4 with SMTP id w10-20020a056a0014ca00b006625c3948e4mr3509609pfu.9.1686182153561; Wed, 07 Jun 2023 16:55:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686182153; cv=none; d=google.com; s=arc-20160816; b=cHxKv0RxS9EjxsYwvri9Yktif9JC+W95lc7x7/B+tuhRGvMfHKcKkrtU0GOcPyjGHt L4aCEYNjeLxSo8bSbZ+RBCynqKzA5lxis8ws2kRNB2ueghvaIK+T1v7aJfOSSNCE4P+1 z89Zof1NmdpwN6CPftbQ42ACMydwZ0h15/2sxSmi5MP9IItPrt7G3KartTOznWh4aWh8 qJK8VMXZsm66JuNYBZdj5G0IJ40nkx8gfRouK0hS+0hsl+hNzm+FEKWZWZ0MVh7P+dUY Pl0L8GgaF5L9ugH6xeagDjAXPVqBIcbhi95dzk/FR7jQ9pUFvnu8VLTY7MhBUCEIO6p6 5KhA== 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=yr5jsl9/J0qf0TNiy0HXpAxkP0kSI4u5UWL5PN/3N50=; b=Qqim64XXGmFpcZFL1JiBN+WCoa1CShXWwqYmOzyNII3O2UxuHZdImuUjr6ayHD5MsX ehAOuvrqYnBpj4sMkkBOdsrouMkxilWaFpb9Os+ZB/mIKDOlGvfGLodKwPAxlKtArVd/ rnS0pqUYkXOYodmRs2VBcWno5eFc16Er2n+BjgfffGN0uJEs/jCIyT1L1qtKOKCRCSfn R670Ob7yb7oqhM0luR2H91bO3j1PVHBj5kYS9hl64RLjQpUvlOHNdm4xGJVXm2AYot8+ ylS57UD9fqDVTtjX5d1AcJss7f//pVDSwvgsBHajb7qq5v1yqDhUvAYUdradxzmO4kG1 B0pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=m5Ykuvsy; 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 q80-20020a632a53000000b005321c340960si9245pgq.811.2023.06.07.16.55.41; Wed, 07 Jun 2023 16:55:53 -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=m5Ykuvsy; 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 S232721AbjFGXja (ORCPT <rfc822;literming00@gmail.com> + 99 others); Wed, 7 Jun 2023 19:39:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232927AbjFGXjX (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 7 Jun 2023 19:39:23 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 255612115; Wed, 7 Jun 2023 16:39:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686181155; x=1717717155; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=N+5v16ekd4mpMdaitluJiCwSxF+P8KWqlxIOWs7E2XU=; b=m5Ykuvsya0tthuO1WIvfngfTcovTsCH4E95bQ+OuiCKJc8gsq4h7sE4p MZi2BiekztJEgjwvm6uYJgxcz2QgurWmfjUnDiLwT/oI1QeFl5lU5j/6K QDawhNNlScIkYK7mVcaFQz5RhITcMMedxjtNuB8gNXruqQ+2cs0a4eI88 K6I63YP9nbfWTjhIlNc+oY72c3eQr9sbTp+WDV9v0+l7HDexwSmvh16OM h4KBtbEalFV/EXStaIOxxwPWda6j6p1okvNiOVoUq2jUaa+6DwJ/WWqVJ eiXjmV1tvl+eVzrXUBKElMHMm7KLRfjd2awaYbcHsa4yvnL5uckS94WUn w==; X-IronPort-AV: E=McAfee;i="6600,9927,10734"; a="354631549" X-IronPort-AV: E=Sophos;i="6.00,225,1681196400"; d="scan'208";a="354631549" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jun 2023 16:38:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10734"; a="739461206" X-IronPort-AV: E=Sophos;i="6.00,225,1681196400"; d="scan'208";a="739461206" Received: from linux.intel.com ([10.54.29.200]) by orsmga008.jf.intel.com with ESMTP; 07 Jun 2023 16:38:50 -0700 Received: from debox1-desk4.intel.com (unknown [10.251.3.221]) by linux.intel.com (Postfix) with ESMTP id 605AF580D26; Wed, 7 Jun 2023 16:38:50 -0700 (PDT) From: "David E. Box" <david.e.box@linux.intel.com> To: linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org Cc: david.e.box@linux.intel.com, markgross@kernel.org, hdegoede@redhat.com, irenic.rajneesh@gmail.com, ilpo.jarvinen@linux.intel.com, xi.pardee@intel.com, rajvi.jingar@linux.intel.com Subject: [PATCH V2 2/2] platform/x86/intel/pmc/mtl: Put devices in D3 during resume Date: Wed, 7 Jun 2023 16:38:49 -0700 Message-Id: <20230607233849.239047-2-david.e.box@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230607233849.239047-1-david.e.box@linux.intel.com> References: <20230607233849.239047-1-david.e.box@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 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?1768090137783084691?= X-GMAIL-MSGID: =?utf-8?q?1768090137783084691?= |
Series |
[V2,1/2] platform/x86/intel/pmc: Add resume callback
|
|
Commit Message
David E. Box
June 7, 2023, 11:38 p.m. UTC
An earlier commit placed some driverless devices in D3 during boot so that
they don't block package cstate entry on Meteor Lake. 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>
---
V2 - rename mtl_fixup to mtl_d3_fixup. Call it from new mtl_resume
function, followed by the common resume. Suggested by Ilpo.
drivers/platform/x86/intel/pmc/mtl.c | 29 ++++++++++++++++++++--------
1 file changed, 21 insertions(+), 8 deletions(-)
Comments
On Wed, 7 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 on Meteor Lake. 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> > --- > > V2 - rename mtl_fixup to mtl_d3_fixup. Call it from new mtl_resume > function, followed by the common resume. Suggested by Ilpo. > > drivers/platform/x86/intel/pmc/mtl.c | 29 ++++++++++++++++++++-------- > 1 file changed, 21 insertions(+), 8 deletions(-) > > diff --git a/drivers/platform/x86/intel/pmc/mtl.c b/drivers/platform/x86/intel/pmc/mtl.c > index e8cc156412ce..2b00ad9da621 100644 > --- a/drivers/platform/x86/intel/pmc/mtl.c > +++ b/drivers/platform/x86/intel/pmc/mtl.c > @@ -68,16 +68,29 @@ static void mtl_set_device_d3(unsigned int device) > } > } > > -void mtl_core_init(struct pmc_dev *pmcdev) > +/* > + * Set power state of select devices that do not have drivers to D3 > + * so that they do not block Package C entry. > + */ > +static void mtl_d3_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. > - */ > mtl_set_device_d3(MTL_GNA_PCI_DEV); > mtl_set_device_d3(MTL_IPU_PCI_DEV); > mtl_set_device_d3(MTL_VPU_PCI_DEV); > } > + > +static int mtl_resume(struct pmc_dev *pmcdev) > +{ > + mtl_d3_fixup(); > + return pmc_core_resume_common(pmcdev); > +} > + > +void mtl_core_init(struct pmc_dev *pmcdev) > +{ > + pmcdev->map = &mtl_reg_map; > + pmcdev->core_configure = mtl_core_configure; > + > + mtl_d3_fixup(); > + > + pmcdev->resume = mtl_resume; > +} Thanks. Looks good now, Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Hi David, On 6/8/23 01:38, David E. Box wrote: > An earlier commit placed some driverless devices in D3 during boot so that > they don't block package cstate entry on Meteor Lake. 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> Thank you for your patch. There is one thing which has me worried here: What about when real proper drivers show up for these blocks? I know that at least some people will likely be using the out of tree IPU6 driver with the IPU block. And having 2 different drivers poke at the hw state seems like a bad idea to me. Maybe we can add a check if no driver is bound and only set the state to D3 if no driver is bound? Regards, Hans > --- > > V2 - rename mtl_fixup to mtl_d3_fixup. Call it from new mtl_resume > function, followed by the common resume. Suggested by Ilpo. > > drivers/platform/x86/intel/pmc/mtl.c | 29 ++++++++++++++++++++-------- > 1 file changed, 21 insertions(+), 8 deletions(-) > > diff --git a/drivers/platform/x86/intel/pmc/mtl.c b/drivers/platform/x86/intel/pmc/mtl.c > index e8cc156412ce..2b00ad9da621 100644 > --- a/drivers/platform/x86/intel/pmc/mtl.c > +++ b/drivers/platform/x86/intel/pmc/mtl.c > @@ -68,16 +68,29 @@ static void mtl_set_device_d3(unsigned int device) > } > } > > -void mtl_core_init(struct pmc_dev *pmcdev) > +/* > + * Set power state of select devices that do not have drivers to D3 > + * so that they do not block Package C entry. > + */ > +static void mtl_d3_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. > - */ > mtl_set_device_d3(MTL_GNA_PCI_DEV); > mtl_set_device_d3(MTL_IPU_PCI_DEV); > mtl_set_device_d3(MTL_VPU_PCI_DEV); > } > + > +static int mtl_resume(struct pmc_dev *pmcdev) > +{ > + mtl_d3_fixup(); > + return pmc_core_resume_common(pmcdev); > +} > + > +void mtl_core_init(struct pmc_dev *pmcdev) > +{ > + pmcdev->map = &mtl_reg_map; > + pmcdev->core_configure = mtl_core_configure; > + > + mtl_d3_fixup(); > + > + pmcdev->resume = mtl_resume; > +}
Hi Hans, On Mon, 2023-06-12 at 11:42 +0200, Hans de Goede wrote: > Hi David, > > On 6/8/23 01:38, David E. Box wrote: > > An earlier commit placed some driverless devices in D3 during boot so that > > they don't block package cstate entry on Meteor Lake. 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> > > Thank you for your patch. > > There is one thing which has me worried here: > > What about when real proper drivers show up for these blocks? > > I know that at least some people will likely be using the out of tree IPU6 > driver with the IPU block. > > And having 2 different drivers poke at the hw state seems like a bad idea to > me. > > Maybe we can add a check if no driver is bound and only set the state to D3 if > no driver is bound? This check exists but is not shown in the patch. mtl_set_device_d3() gets the device lock and checks to see if dev.driver is NULL before putting in D3. This was checked with the GNA driver installed. David > > Regards, > > Hans > > > > > --- > > > > V2 - rename mtl_fixup to mtl_d3_fixup. Call it from new mtl_resume > > function, followed by the common resume. Suggested by Ilpo. > > > > drivers/platform/x86/intel/pmc/mtl.c | 29 ++++++++++++++++++++-------- > > 1 file changed, 21 insertions(+), 8 deletions(-) > > > > diff --git a/drivers/platform/x86/intel/pmc/mtl.c > > b/drivers/platform/x86/intel/pmc/mtl.c > > index e8cc156412ce..2b00ad9da621 100644 > > --- a/drivers/platform/x86/intel/pmc/mtl.c > > +++ b/drivers/platform/x86/intel/pmc/mtl.c > > @@ -68,16 +68,29 @@ static void mtl_set_device_d3(unsigned int device) > > } > > } > > > > -void mtl_core_init(struct pmc_dev *pmcdev) > > +/* > > + * Set power state of select devices that do not have drivers to D3 > > + * so that they do not block Package C entry. > > + */ > > +static void mtl_d3_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. > > - */ > > mtl_set_device_d3(MTL_GNA_PCI_DEV); > > mtl_set_device_d3(MTL_IPU_PCI_DEV); > > mtl_set_device_d3(MTL_VPU_PCI_DEV); > > } > > + > > +static int mtl_resume(struct pmc_dev *pmcdev) > > +{ > > + mtl_d3_fixup(); > > + return pmc_core_resume_common(pmcdev); > > +} > > + > > +void mtl_core_init(struct pmc_dev *pmcdev) > > +{ > > + pmcdev->map = &mtl_reg_map; > > + pmcdev->core_configure = mtl_core_configure; > > + > > + mtl_d3_fixup(); > > + > > + pmcdev->resume = mtl_resume; > > +} >
Hi, On 6/12/23 20:02, David E. Box wrote: > Hi Hans, > > On Mon, 2023-06-12 at 11:42 +0200, Hans de Goede wrote: >> Hi David, >> >> On 6/8/23 01:38, David E. Box wrote: >>> An earlier commit placed some driverless devices in D3 during boot so that >>> they don't block package cstate entry on Meteor Lake. 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> >> >> Thank you for your patch. >> >> There is one thing which has me worried here: >> >> What about when real proper drivers show up for these blocks? >> >> I know that at least some people will likely be using the out of tree IPU6 >> driver with the IPU block. >> >> And having 2 different drivers poke at the hw state seems like a bad idea to >> me. >> >> Maybe we can add a check if no driver is bound and only set the state to D3 if >> no driver is bound? > > This check exists but is not shown in the patch. mtl_set_device_d3() gets the > device lock and checks to see if dev.driver is NULL before putting in D3. This > was checked with the GNA driver installed. Ah, yes I remember this now from the original patch adding mtl_set_device_d3(). Good. Let me go and merge this right away then. Regards, Hans >>> --- >>> >>> V2 - rename mtl_fixup to mtl_d3_fixup. Call it from new mtl_resume >>> function, followed by the common resume. Suggested by Ilpo. >>> >>> drivers/platform/x86/intel/pmc/mtl.c | 29 ++++++++++++++++++++-------- >>> 1 file changed, 21 insertions(+), 8 deletions(-) >>> >>> diff --git a/drivers/platform/x86/intel/pmc/mtl.c >>> b/drivers/platform/x86/intel/pmc/mtl.c >>> index e8cc156412ce..2b00ad9da621 100644 >>> --- a/drivers/platform/x86/intel/pmc/mtl.c >>> +++ b/drivers/platform/x86/intel/pmc/mtl.c >>> @@ -68,16 +68,29 @@ static void mtl_set_device_d3(unsigned int device) >>> } >>> } >>> >>> -void mtl_core_init(struct pmc_dev *pmcdev) >>> +/* >>> + * Set power state of select devices that do not have drivers to D3 >>> + * so that they do not block Package C entry. >>> + */ >>> +static void mtl_d3_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. >>> - */ >>> mtl_set_device_d3(MTL_GNA_PCI_DEV); >>> mtl_set_device_d3(MTL_IPU_PCI_DEV); >>> mtl_set_device_d3(MTL_VPU_PCI_DEV); >>> } >>> + >>> +static int mtl_resume(struct pmc_dev *pmcdev) >>> +{ >>> + mtl_d3_fixup(); >>> + return pmc_core_resume_common(pmcdev); >>> +} >>> + >>> +void mtl_core_init(struct pmc_dev *pmcdev) >>> +{ >>> + pmcdev->map = &mtl_reg_map; >>> + pmcdev->core_configure = mtl_core_configure; >>> + >>> + mtl_d3_fixup(); >>> + >>> + pmcdev->resume = mtl_resume; >>> +} >> >
diff --git a/drivers/platform/x86/intel/pmc/mtl.c b/drivers/platform/x86/intel/pmc/mtl.c index e8cc156412ce..2b00ad9da621 100644 --- a/drivers/platform/x86/intel/pmc/mtl.c +++ b/drivers/platform/x86/intel/pmc/mtl.c @@ -68,16 +68,29 @@ static void mtl_set_device_d3(unsigned int device) } } -void mtl_core_init(struct pmc_dev *pmcdev) +/* + * Set power state of select devices that do not have drivers to D3 + * so that they do not block Package C entry. + */ +static void mtl_d3_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. - */ mtl_set_device_d3(MTL_GNA_PCI_DEV); mtl_set_device_d3(MTL_IPU_PCI_DEV); mtl_set_device_d3(MTL_VPU_PCI_DEV); } + +static int mtl_resume(struct pmc_dev *pmcdev) +{ + mtl_d3_fixup(); + return pmc_core_resume_common(pmcdev); +} + +void mtl_core_init(struct pmc_dev *pmcdev) +{ + pmcdev->map = &mtl_reg_map; + pmcdev->core_configure = mtl_core_configure; + + mtl_d3_fixup(); + + pmcdev->resume = mtl_resume; +}