From patchwork Wed Jun 7 23:38:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "David E. Box" X-Patchwork-Id: 104778 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp578446vqr; Wed, 7 Jun 2023 17:43:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Vhni51sg3pzvVO0AJX52/s4mNae3p3p4iFoaLKszYmPD1ntIiNlCzbuAutJI/h9pmN8XP X-Received: by 2002:a05:6a21:2d8a:b0:103:b073:7a57 with SMTP id ty10-20020a056a212d8a00b00103b0737a57mr4839120pzb.23.1686185014253; Wed, 07 Jun 2023 17:43:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686185014; cv=none; d=google.com; s=arc-20160816; b=OMpvXMLxsBXy978Okcvyxott/NY8+yXToxP6mSNcV8VP5QDuLHwf0BFYjD4ZfPJeKE Nx6UBU6e93A8z01J4kOBczUOKMpVAlqgHcoL6b/wFA0QEbwk6XBvazKXCRBE4n5/ZNWb z2lqAGeCOmujxL79V3zMfQUbeWS4dGiXYHo8qJtXn6qELjSR/+gBO8B8Y2yAfamfJzo/ 9uIwx3v5q8xkLJoocpcfpHYI962HujvL0unAOQH2Zj2RU/RlUg2+aEr8kDJKkHtx6pJO jHZElZXzAybbGdVyKd0bhn9qeFVeuFAlPJyzoEasBBFgR9ihKBeWxkcVrvzWBGr/YU7p lO0w== 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=6S3dLZYs4RKXq+H0C/obGS5oLsEiBTQw7CFi9ddObrc=; b=RBCSdkHVKKBN3ZldaR0INLDUUytrwpSzRcGXd5EVORABb9k8N0HtZunwsquIgDBvgh Ahu2NjgPwGt20uXm8YMfRJaxQM8dCVC302ybz7pmUI2Oz61BJNSJ8M55oD++RjxdVCdP k9JoU0FYS9NUEJ6BfcQeqYDdXzieF/AhCXQbDkZO0pVgXnAU6fJkKIZdb7KaEK6xiR25 z6hEwUqvlAsij1VkT1i2EY2bBGkqEEsNWOoaXwUqf2v+eOHwyWapiO+TNehYFHadxVSr Wp7CfzUKNzzZPa11FRYzHiX7elEkc69tNdH1m9YjRGi4e07B2ErnAZ7EcBh9CHyvmQsP KjZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Z7CN/rA7"; 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 h184-20020a6383c1000000b00543a89c95bdsi130075pge.66.2023.06.07.17.43.20; Wed, 07 Jun 2023 17:43:34 -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="Z7CN/rA7"; 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 S232283AbjFGXjQ (ORCPT + 99 others); Wed, 7 Jun 2023 19:39:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229968AbjFGXjP (ORCPT ); Wed, 7 Jun 2023 19:39:15 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A292212B; Wed, 7 Jun 2023 16:38:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686181131; x=1717717131; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=KlCxXW3cettU4hkVoOWitZPtIUn44RhFROQOzqvvN6g=; b=Z7CN/rA7g2YUusFukq0iSSbPUrX0o1v1p//tMd+CLKJCiDSxX5ly1+q0 pm6qx3bcoyr9nO22Xa1e1dJBMU3TkOEq5/UJKysbXM7wSeV10b4F2XmnD sJAqiladYTukjGeNi9jjXfqthtNcFtZeYYOvZ9fGVIyhwfiukRwOZIJpZ mqGlpyrGUmM0q91o7J3NuCKw25RyqMc3QPECYDU4HFobdE4OACTXjoH9O XR9ddY4EO7tP7SuvdeHI2d1L9KM6wWYrlV7i3CxXd4IGqW3t6fkpWMVHz HQ07AZ1UvuaFpByCzuImJlSgdFLnTESUavZqnYTj3kpWHFr1U9Vh6lyLl w==; X-IronPort-AV: E=McAfee;i="6600,9927,10734"; a="354631544" X-IronPort-AV: E=Sophos;i="6.00,225,1681196400"; d="scan'208";a="354631544" 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="739461201" X-IronPort-AV: E=Sophos;i="6.00,225,1681196400"; d="scan'208";a="739461201" 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 159CB580B54; Wed, 7 Jun 2023 16:38:50 -0700 (PDT) From: "David E. Box" 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 1/2] platform/x86/intel/pmc: Add resume callback Date: Wed, 7 Jun 2023 16:38:48 -0700 Message-Id: <20230607233849.239047-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.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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768093137329644766?= X-GMAIL-MSGID: =?utf-8?q?1768093137329644766?= Add a resume callback to perform platform specific functions during resume from suspend. Signed-off-by: David E. Box Reviewed-by: Ilpo Järvinen --- V2 - Change resume_fixup to just resume and use it a a replacement for the regular resume flow (now called pmc_core_resume_common) if it exist. Suggested by Ilpo. drivers/platform/x86/intel/pmc/core.c | 14 ++++++++++++-- drivers/platform/x86/intel/pmc/core.h | 3 +++ 2 files changed, 15 insertions(+), 2 deletions(-) base-commit: 86f67fe2db439867f9476c9b78ea3ebd4a06a123 diff --git a/drivers/platform/x86/intel/pmc/core.c b/drivers/platform/x86/intel/pmc/core.c index da6e7206d38b..bb2f11251f73 100644 --- a/drivers/platform/x86/intel/pmc/core.c +++ b/drivers/platform/x86/intel/pmc/core.c @@ -1223,11 +1223,11 @@ static inline bool pmc_core_is_s0ix_failed(struct pmc_dev *pmcdev) return false; } -static __maybe_unused int pmc_core_resume(struct device *dev) +int pmc_core_resume_common(struct pmc_dev *pmcdev) { - struct pmc_dev *pmcdev = dev_get_drvdata(dev); const struct pmc_bit_map **maps = pmcdev->map->lpm_sts; int offset = pmcdev->map->lpm_status_offset; + struct device *dev = &pmcdev->pdev->dev; /* Check if the syspend used S0ix */ if (pm_suspend_via_firmware()) @@ -1257,6 +1257,16 @@ static __maybe_unused int pmc_core_resume(struct device *dev) return 0; } +static __maybe_unused int pmc_core_resume(struct device *dev) +{ + struct pmc_dev *pmcdev = dev_get_drvdata(dev); + + if (pmcdev->resume) + return pmcdev->resume(pmcdev); + + return pmc_core_resume_common(pmcdev); +} + static const struct dev_pm_ops pmc_core_pm_ops = { SET_LATE_SYSTEM_SLEEP_PM_OPS(pmc_core_suspend, pmc_core_resume) }; diff --git a/drivers/platform/x86/intel/pmc/core.h b/drivers/platform/x86/intel/pmc/core.h index 9ca9b9746719..7c95586e742b 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: Function to perform platform specific 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); + int (*resume)(struct pmc_dev *pmcdev); }; extern const struct pmc_bit_map msr_map[]; @@ -398,6 +400,7 @@ extern const struct pmc_reg_map mtl_reg_map; extern void pmc_core_get_tgl_lpm_reqs(struct platform_device *pdev); extern int pmc_core_send_ltr_ignore(struct pmc_dev *pmcdev, u32 value); +int pmc_core_resume_common(struct pmc_dev *pmcdev); void spt_core_init(struct pmc_dev *pmcdev); void cnp_core_init(struct pmc_dev *pmcdev); void icl_core_init(struct pmc_dev *pmcdev); From patchwork Wed Jun 7 23:38:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "David E. Box" X-Patchwork-Id: 104776 Return-Path: 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 + 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 ); 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" 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 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: 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?= 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 Reviewed-by: Ilpo Järvinen --- 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; +}