Received: by 2002:ac8:5491:0:b0:40f:fb00:664b with SMTP id h17csp608237qtq; Thu, 10 Aug 2023 10:22:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGUDL/y/PHQL3nUH52oV+Yb17G347894LU7QRKHhIvtkoATCPDr/XsVW9+I4s/y8YzLDagq X-Received: by 2002:a17:906:30cc:b0:98e:2413:952f with SMTP id b12-20020a17090630cc00b0098e2413952fmr3620122ejb.18.1691688130523; Thu, 10 Aug 2023 10:22:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691688130; cv=none; d=google.com; s=arc-20160816; b=pMTuPz+BoaEYBFhbriTcALaFtP+unf5MZY1bwLiB4J57/6DvGXmhkXKl05J0e1KK5b Kf1E9GxRSwg0gZPmGOoSaFM2KdrZVlBkwHpdetY7FFOvqj1OzdyJeM/JuGob8aD43vLx jSMxRUz5hotSNbBqgyd81eGWA0oCdmjW6UZoeShIPoj0B85aj0vg2UPHscU1to62Y040 GiNI747qT+qJdVkDYVLxestZSmure8VWJ8gWoGjh4NJhb5f1k8oEqQNkt2a3J2GsTo73 0xCq8N0Nf46twzb3clLuyHP0yfOFsvBwH5T2HLwViKUfx1Hxz2tYSIK2luxVVJx5TbXL toVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:organization:references:in-reply-to:date :cc:to:reply-to:from:subject:message-id:dkim-signature; bh=r7+pRLOhmCU2mY1+yp43/cT6YSLlci8CmLi2j4cMZDM=; fh=026t91cH/a4clUEB2b/FoU2mi/sIs+r4mn66D8U9LG4=; b=QPfBVGAS+NSAHv9hndOaJh3l0CjAJRimQ3cxhpFROixOn2ZhhdFlL6/jpSXsIG9BVu Kow7PDwKyzyn396OfrHn8l4UkRCyFmr6O9EnrqKUWWqOu+5ZHblSA8UaHZKh79liTDb9 IZb2uxF8FwgTM4NSgzUPO/Qfpg7AagnzeLe6zzaIYtJ8lsQ5YSyQSDKtCgOSOOzyPD0j m2UgvEsT8OaoMSX6juu90KrVmDm2L0AX9PlUFIPzg61B3WugaMoWuviddaGr99JcWoA6 3N3VNipj9ED/mLUyh+lpIyXyn9f1R9lw1p0pTZijtgyZHAfJnK6SDFm3ELqrDGBSp3// RzMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=a7b4p0pr; 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 o16-20020a17090608d000b00965a6d6b536si1856394eje.335.2023.08.10.10.21.45; Thu, 10 Aug 2023 10:22:10 -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=a7b4p0pr; 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 S233190AbjHJQno (ORCPT + 99 others); Thu, 10 Aug 2023 12:43:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234645AbjHJQn3 (ORCPT ); Thu, 10 Aug 2023 12:43:29 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B58D10C4; Thu, 10 Aug 2023 09:43:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691685808; x=1723221808; h=message-id:subject:from:reply-to:to:cc:date:in-reply-to: references:content-transfer-encoding:mime-version; bh=r7+pRLOhmCU2mY1+yp43/cT6YSLlci8CmLi2j4cMZDM=; b=a7b4p0prZDMNt18PH5rRzljbNrrJfQGyyvuROzBm1LFttHstKjunoOdt hoNWUhvQeuyuceWq/n5VRdm8v4l/7yvODAVrLkVHsfKS0ZhVpfaoRq83h CbnfcgRMgPdMx/ib1NTPnGzROBUhNifxXn9hCu5L9p9hYxA1SrXM16f2W vsGWEXBuhoBq3BO+2C9nj1TgJi++vgjwjQVKD05O1dR/r7ZORBbMScnyL tZV+L9IhtFngAvRhdk94a0ksFG6bKfqcYWTFnuWpPhTM0X5aByhKa6Uex HvlCyk9xMf8aRjg4x4+Fi3a13wze2fzI2AyIHWhlJOT7iUUoxxGrTOnYv A==; X-IronPort-AV: E=McAfee;i="6600,9927,10798"; a="351776957" X-IronPort-AV: E=Sophos;i="6.01,162,1684825200"; d="scan'208";a="351776957" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Aug 2023 09:36:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10798"; a="855987630" X-IronPort-AV: E=Sophos;i="6.01,162,1684825200"; d="scan'208";a="855987630" Received: from linux.intel.com ([10.54.29.200]) by orsmga004.jf.intel.com with ESMTP; 10 Aug 2023 09:36:15 -0700 Received: from tphi-mobl.amr.corp.intel.com (tphi-mobl.amr.corp.intel.com [10.209.57.169]) by linux.intel.com (Postfix) with ESMTP id 47411580AFF; Thu, 10 Aug 2023 09:36:15 -0700 (PDT) Message-ID: Subject: Re: [PATCH net-next v2 1/5] platform/x86: intel_pmc_core: Add IPC mailbox accessor function and add SoC register access From: "David E. Box" Reply-To: david.e.box@linux.intel.com To: Hans de Goede , Choong Yong Liang , Rajneesh Bhardwaj , Mark Gross , Jose Abreu , Andrew Lunn , Heiner Kallweit , Russell King , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Marek =?ISO-8859-1?Q?Beh=FAn?= , Jean Delvare , Guenter Roeck , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Richard Cochran , Philipp Zabel , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Wong Vee Khee , Jon Hunter , Jesse Brandeburg , Shenwei Wang , Andrey Konovalov , Jochen Henneberg Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, platform-driver-x86@vger.kernel.org, linux-hwmon@vger.kernel.org, bpf@vger.kernel.org, Voon Wei Feng , Tan Tee Min , Michael Sit Wei Hong , Lai Peter Jun Ann Date: Thu, 10 Aug 2023 09:36:15 -0700 In-Reply-To: <145d7375-0e58-b7cf-6240-5d8bc16b0344@redhat.com> References: <20230804084527.2082302-1-yong.liang.choong@linux.intel.com> <20230804084527.2082302-2-yong.liang.choong@linux.intel.com> <145d7375-0e58-b7cf-6240-5d8bc16b0344@redhat.com> Organization: David E. Box Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4-0ubuntu2 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 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 Hi Hans, On Mon, 2023-08-07 at 13:02 +0200, Hans de Goede wrote: > > Hi David, > >=20 > > On 8/4/23 10:45, Choong Yong Liang wrote: > > > > From: "David E. Box" > > > >=20 > > > > - Exports intel_pmc_core_ipc() for host access to the PMC IPC mailb= ox > > > > - Add support to use IPC command allows host to access SoC register= s > > > > through PMC firmware that are otherwise inaccessible to the host du= e to > > > > security policies. > > > >=20 > > > > Signed-off-by: David E. Box > > > > Signed-off-by: Chao Qin > > > > Signed-off-by: Choong Yong Liang > >=20 > > The new exported intel_pmc_core_ipc() function does not seem to > > depend on any existing PMC code. > >=20 > > IMHO it would be better to put this in a new .c file under > > arch/x86/platform/intel/ this is where similar helpers like > > the iosf_mbi functions also live. > >=20 > > This also avoids Kconfig complications. Currently the > > drivers/platform/x86/intel/pmc/core.c code is only > > build if CONFIG_X86_PLATFORM_DEVICES and > > CONFIG_INTEL_PMC_CORE are both set. So if a driver > > wants to make sure this is enabled by selecting them > > then it needs to select both. Yeah, makes sense. This is an old patch. Once upon a time the PMC driver wa= s going to use the IPC to access some registers but we were able to get them = from elsewhere. The patch was brought back for the TSN use case. But you're corr= ect that arch/x86/platform/intel makes more sense if the function is to be expo= rted now and doesn't require to PMC driver to discover the interface. We'll do t= hat. > >=20 > > Talking about Kconfig: > >=20 > > #if IS_ENABLED(CONFIG_INTEL_PMC_CORE) > > int intel_pmc_core_ipc(struct pmc_ipc_cmd *ipc_cmd, u32 *rbuf); > > #else > > static inline int intel_pmc_core_ipc(struct pmc_ipc_cmd *ipc_cmd, u32 *= rbuf) > > { > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0return -ENODEV; > > } > > #endif /* CONFIG_INTEL_PMC_CORE */ > >=20 > > Notice that CONFIG_INTEL_PMC_CORE is a tristate, so pmc might be build = as a > > > module where as a consumer of intel_pmc_core_ipc() might end up built= in in > > > which case this will not work without extra Kconfig protection. And i= f you > > are > going to add extra Kconfig you might just as well select or depen= d on > > > INTEL_PMC_CORE and drop the #if . Sure. Thanks. David > >=20 > > Regards, > >=20 > > Hans > >=20 > >=20 > >=20 > >=20 > >=20 > >=20 > > > > --- > > > > =C2=A0MAINTAINERS=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 |=C2=A0 1 + > > > > =C2=A0drivers/platform/x86/intel/pmc/core.c=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 | 60 +++++++++++++++++++ > > > > =C2=A0.../linux/platform_data/x86/intel_pmc_core.h=C2=A0 | 41 +++++= ++++++++ > > > > =C2=A03 files changed, 102 insertions(+) > > > > =C2=A0create mode 100644 include/linux/platform_data/x86/intel_pmc_= core.h > > > >=20 > > > > diff --git a/MAINTAINERS b/MAINTAINERS > > > > index 069e176d607a..8a034dee9da9 100644 > > > > --- a/MAINTAINERS > > > > +++ b/MAINTAINERS > > > > @@ -10648,6 +10648,7 @@ L:=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0platf= orm-driver-x86@vger.kernel.org > > > > =C2=A0S:=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0Maintained > > > > =C2=A0F:=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0Documentation/ABI/testing/sys= fs-platform-intel-pmc > > > > =C2=A0F:=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0drivers/platform/x86/intel/pm= c/ > > > > +F:=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0linux/platform_data/x86/intel_pmc_= core.h > > > > =C2=A0 > > > > =C2=A0INTEL PMIC GPIO DRIVERS > > > > =C2=A0M:=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0Andy Shevchenko > > > > diff --git a/drivers/platform/x86/intel/pmc/core.c > > > > > > b/drivers/platform/x86/intel/pmc/core.c > > > > index 5a36b3f77bc5..6fb1b0f453d8 100644 > > > > --- a/drivers/platform/x86/intel/pmc/core.c > > > > +++ b/drivers/platform/x86/intel/pmc/core.c > > > > @@ -20,6 +20,7 @@ > > > > =C2=A0#include > > > > =C2=A0#include > > > > =C2=A0#include > > > > +#include > > > > =C2=A0 > > > > =C2=A0#include > > > > =C2=A0#include > > > > @@ -28,6 +29,8 @@ > > > > =C2=A0 > > > > =C2=A0#include "core.h" > > > > =C2=A0 > > > > +#define PMC_IPCS_PARAM_COUNT=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 7 > > > > + > > > > =C2=A0/* Maximum number of modes supported by platfoms that has low= power > > > > mode > > capability */ > > > > =C2=A0const char *pmc_lpm_modes[] =3D { > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0"S0i2.0", > > > > @@ -53,6 +56,63 @@ const struct pmc_bit_map msr_map[] =3D { > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0{} > > > > =C2=A0}; > > > > =C2=A0 > > > > +int intel_pmc_core_ipc(struct pmc_ipc_cmd *ipc_cmd, u32 *rbuf) > > > > +{ > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0struct acpi_buffer buffe= r =3D { ACPI_ALLOCATE_BUFFER, NULL }; > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0union acpi_object params= [PMC_IPCS_PARAM_COUNT] =3D { > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0{.type =3D ACPI_TYPE_INTEGER,}, > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0{.type =3D ACPI_TYPE_INTEGER,}, > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0{.type =3D ACPI_TYPE_INTEGER,}, > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0{.type =3D ACPI_TYPE_INTEGER,}, > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0{.type =3D ACPI_TYPE_INTEGER,}, > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0{.type =3D ACPI_TYPE_INTEGER,}, > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0{.type =3D ACPI_TYPE_INTEGER,}, > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0}; > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0struct acpi_object_list = arg_list =3D { PMC_IPCS_PARAM_COUNT, > > > > params }; > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0union acpi_object *obj; > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0int status; > > > > + > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if (!ipc_cmd || !rbuf) > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0return -EINVAL; > > > > + > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0/* > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 * 0: IPC Command > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 * 1: IPC Sub Command > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 * 2: Size > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 * 3-6: Write Buffer for= offset > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 */ > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0params[0].integer.value = =3D ipc_cmd->cmd; > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0params[1].integer.value = =3D ipc_cmd->sub_cmd; > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0params[2].integer.value = =3D ipc_cmd->size; > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0params[3].integer.value = =3D ipc_cmd->wbuf[0]; > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0params[4].integer.value = =3D ipc_cmd->wbuf[1]; > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0params[5].integer.value = =3D ipc_cmd->wbuf[2]; > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0params[6].integer.value = =3D ipc_cmd->wbuf[3]; > > > > + > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0status =3D acpi_evaluate= _object(NULL, "\\IPCS", &arg_list, > > > > &buffer); > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if (ACPI_FAILURE(status)= ) > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0return -ENODEV; > > > > + > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0obj =3D buffer.pointer; > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0/* Check if the number o= f elements in package is 5 */ > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if (obj && obj->type =3D= =3D ACPI_TYPE_PACKAGE && obj->package.count > > > > =3D=3D > > 5) { > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0const union acpi_object *objs =3D obj->package.elem= ents; > > > > + > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0if ((u8)objs[0].integer.value !=3D 0) > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0ret= urn -EINVAL; > > > > + > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0rbuf[0] =3D objs[1].integer.value; > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0rbuf[1] =3D objs[2].integer.value; > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0rbuf[2] =3D objs[3].integer.value; > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0rbuf[3] =3D objs[4].integer.value; > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0} else { > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0return -EINVAL; > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0} > > > > + > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0return 0; > > > > +} > > > > +EXPORT_SYMBOL(intel_pmc_core_ipc); > > > > + > > > > =C2=A0static inline u32 pmc_core_reg_read(struct pmc *pmc, int reg_= offset) > > > > =C2=A0{ > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0return readl(pmc->r= egbase + reg_offset); > > > > diff --git a/include/linux/platform_data/x86/intel_pmc_core.h > > > > > > b/include/linux/platform_data/x86/intel_pmc_core.h > > > > new file mode 100644 > > > > index 000000000000..9bb3394fedcf > > > > --- /dev/null > > > > +++ b/include/linux/platform_data/x86/intel_pmc_core.h > > > > @@ -0,0 +1,41 @@ > > > > +/* SPDX-License-Identifier: GPL-2.0 */ > > > > +/* > > > > + * Intel Core SoC Power Management Controller Header File > > > > + * > > > > + * Copyright (c) 2023, Intel Corporation. > > > > + * All Rights Reserved. > > > > + * > > > > + * Authors: Choong Yong Liang > > > > + *=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 David E. = Box > > > > + */ > > > > +#ifndef INTEL_PMC_CORE_H > > > > +#define INTEL_PMC_CORE_H > > > > + > > > > +#define IPC_SOC_REGISTER_ACCESS=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A00xAA > > > > +#define IPC_SOC_SUB_CMD_READ=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A00x00 > > > > +#define IPC_SOC_SUB_CMD_WRITE=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A00x0= 1 > > > > + > > > > +struct pmc_ipc_cmd { > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0u32 cmd; > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0u32 sub_cmd; > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0u32 size; > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0u32 wbuf[4]; > > > > +}; > > > > + > > > > +#if IS_ENABLED(CONFIG_INTEL_PMC_CORE) > > > > +/** > > > > + * intel_pmc_core_ipc() - PMC IPC Mailbox accessor > > > > + * @ipc_cmd:=C2=A0 struct pmc_ipc_cmd prepared with input to send > > > > + * @rbuf:=C2=A0=C2=A0=C2=A0=C2=A0 Allocated u32[4] array for retur= ned IPC data > > > > + * > > > > + * Return: 0 on success. Non-zero on mailbox error > > > > + */ > > > > +int intel_pmc_core_ipc(struct pmc_ipc_cmd *ipc_cmd, u32 *rbuf); > > > > +#else > > > > +static inline int intel_pmc_core_ipc(struct pmc_ipc_cmd *ipc_cmd, = u32 > > > > > > *rbuf) > > > > +{ > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0return -ENODEV; > > > > +} > > > > +#endif /* CONFIG_INTEL_PMC_CORE */ > > > > + > > > > +#endif /* INTEL_PMC_CORE_H */ > >=20