Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5528916rwd; Mon, 5 Jun 2023 05:10:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ53vQK821yaZ2vdZXmlEJqxzzFd+T6rXNDANxQS+N19xY9WBPXillgfnZXTms67or9k9tGG X-Received: by 2002:a05:6a20:3c9e:b0:116:d50e:de38 with SMTP id b30-20020a056a203c9e00b00116d50ede38mr713281pzj.31.1685967057687; Mon, 05 Jun 2023 05:10:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685967057; cv=none; d=google.com; s=arc-20160816; b=qeccDQglr509QF6FffTAYniASaV73l232aj8GTG26TxGW//CYgyV3p8jMDpFmwS4Ro IdCIjiimEg4mo6yz7UI6SzBaofgxaA1FlX32sClOQPFJRLIzUi3QAQJopAykFbzmRy9v ms0MamIkm3ncKYJJ0wo/rdSHUF/sFpMarVLq4dD52qZNgBqLmWl0RbpjRUM1SoowA8AO ImWLgqYZWeZb0W+eFqwGuJeHWF4ssnhgF3dXv93ZKVo4gj7cy6dvN4I+MqBSitTkHxWV Bmk8bBw6RAeY1rTk9R3tdII5+bLWBOZpjQMVxw1MK9WPcoKmRjmMXFv+LV02l/A5ISrA Je+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=ELbNbNxhB7ZaPIg4pjtwFzp6cJv96ssZvGy+JE3ItfQ=; b=sdsltyCjDBaoBgAPHexFMTL/ikr2jtIV+LTmUAXYtgmGA/IBMo7kNi8BkSAAGJOgyl Ee2zkdP+7+FoPla+iEsGI+pAmttqFVC1EMuVqs681UALi6h44M9j+zg+P5IwEInliKqR b4e28n5IDxMDk/Ld8VvGzSrIAn3vKiXGtJJKjFI/87izt+5kii2L0ApX91TZoD20T9tF ddsPjefzQhbx1AHjpm04+YDS2TOdLA5AjsE87iIJ7AE60V+1/5P6CaycFCOayMcVSajW 6xXsFtUp5Jy14BIz0eMzs8tjai1puRjOGHyuDeLp8/nZVVwGdscNNwosQkD7OAu2NZbm GEUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Od5PUG5d; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z4-20020a1709027e8400b001b049396666si5241193pla.601.2023.06.05.05.10.44; Mon, 05 Jun 2023 05:10:57 -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=Od5PUG5d; 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 S233152AbjFEMAH (ORCPT + 99 others); Mon, 5 Jun 2023 08:00:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230371AbjFEMAG (ORCPT ); Mon, 5 Jun 2023 08:00:06 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9C129C; Mon, 5 Jun 2023 05:00:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685966404; x=1717502404; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=p5/S5k7Qizlk2AVy9vIiaRFPNQhWyVQblWCerOYsPfI=; b=Od5PUG5dodEOVF18JxdxDFjkopxQ52D/ts5EObcNfNn4wxmUjGGZ3XCi LqZLHO3rLG84JlJs4ufuY5IzSeN3GJal+TNeWB3oQUrI6ejkJzpMH0WL6 YTQCx+JLirp93iQ4XWhm0GS1teeJNYQgoQxYOr9os1NpQ2b+Syoq+VFRf Jz6s1ir8RAyRaGZpH0Q9mFGRsx83PCDZLve1gWO71iqwFoSG6c2QTQpiA hyFw2tP3FrOuzVtmUDKWrKi1NjdQ8wAbLPOiJi1HVq/BOvIvpHX43DeSh XbxuXZHazgyJmj7ep2VCQjA2IWhAvrrjg0t+Her/jNg01aG7uiXPy6Kz/ g==; X-IronPort-AV: E=McAfee;i="6600,9927,10731"; a="422174161" X-IronPort-AV: E=Sophos;i="6.00,217,1681196400"; d="scan'208";a="422174161" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2023 04:59:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10731"; a="702725735" X-IronPort-AV: E=Sophos;i="6.00,217,1681196400"; d="scan'208";a="702725735" Received: from gfittedx-mobl.ger.corp.intel.com ([10.252.47.115]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2023 04:59:26 -0700 Date: Mon, 5 Jun 2023 14:59:24 +0300 (EEST) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: "David E. Box" cc: irenic.rajneesh@gmail.com, hdegoede@redhat.com, markgross@kernel.org, platform-driver-x86@vger.kernel.org, LKML Subject: Re: [PATCH 2/2] platform/x86/intel/pmc/mtl: Put devices in D3 during resume In-Reply-To: <20230602232142.278155-2-david.e.box@linux.intel.com> Message-ID: <9a45d987-6840-9c7a-b0b5-702cf3aba4f@linux.intel.com> References: <20230602232142.278155-1-david.e.box@linux.intel.com> <20230602232142.278155-2-david.e.box@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII 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 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 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 > --- > 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. -- i.