From: srinivas pandruvada <srinivas.pandruvada@linux.intel.com>
To: Hans de Goede <hdegoede@redhat.com>, markgross@kernel.org
Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 12/12] platform/x86: ISST: Add suspend/resume callbacks
Date: Wed, 01 Mar 2023 06:46:15 -0800 [thread overview]
Message-ID: <fbad311a983902703ced27894d8e34a5e0b5d966.camel@linux.intel.com> (raw)
In-Reply-To: <bba19fc3-0cbc-7829-6721-7d84ac4d9136@redhat.com>
Hi Hans,
On Wed, 2023-03-01 at 15:40 +0100, Hans de Goede wrote:
> Hi,
>
> On 2/11/23 07:32, Srinivas Pandruvada wrote:
> > To support S3/S4 with TPMI interface add suspend/resume callbacks.
> > Here HW state is stored in suspend callback and restored during
> > resume callback.
> >
> > The hardware state which needs to be stored/restored:
> > - CLOS configuration
> > - CLOS Association
> > - SST-CP enable/disable status
> > - SST-PP perf level setting
> >
> > Signed-off-by: Srinivas Pandruvada
> > <srinivas.pandruvada@linux.intel.com>
> > ---
> > .../x86/intel/speed_select_if/isst_tpmi.c | 21 ++++++++
> > .../intel/speed_select_if/isst_tpmi_core.c | 49
> > +++++++++++++++++++
> > .../intel/speed_select_if/isst_tpmi_core.h | 2 +
> > 3 files changed, 72 insertions(+)
> >
> > diff --git a/drivers/platform/x86/intel/speed_select_if/isst_tpmi.c
> > b/drivers/platform/x86/intel/speed_select_if/isst_tpmi.c
> > index 7b4bdeefb8bc..ef39870c9829 100644
> > --- a/drivers/platform/x86/intel/speed_select_if/isst_tpmi.c
> > +++ b/drivers/platform/x86/intel/speed_select_if/isst_tpmi.c
> > @@ -34,6 +34,24 @@ static void intel_sst_remove(struct
> > auxiliary_device *auxdev)
> > tpmi_sst_exit();
> > }
> >
> > +static int __maybe_unused intel_sst_suspend(struct device *dev)
> > +{
> > + tpmi_sst_dev_suspend(to_auxiliary_dev(dev));
> > +
> > + return 0;
> > +}
> > +
> > +static int __maybe_unused intel_sst_resume(struct device *dev)
> > +{
> > + tpmi_sst_dev_resume(to_auxiliary_dev(dev));
> > +
> > + return 0;
> > +}
>
> Please drop the __maybe_unused here; and
OK.
>
> > +
> > +static const struct dev_pm_ops intel_sst_pm = {
> > + SET_SYSTEM_SLEEP_PM_OPS(intel_sst_suspend,
> > intel_sst_resume)
> > +};
> > +
>
> Replace this with:
>
> static DEFINE_SIMPLE_DEV_PM_OPS(intel_sst_pm, intel_sst_suspend,
> intel_sst_resume);
>
Sure.
> > static const struct auxiliary_device_id intel_sst_id_table[] = {
> > { .name = "intel_vsec.tpmi-sst" },
> > {}
> > @@ -44,6 +62,9 @@ static struct auxiliary_driver
> > intel_sst_aux_driver = {
> > .id_table = intel_sst_id_table,
> > .remove = intel_sst_remove,
> > .probe = intel_sst_probe,
> > + .driver = {
> > + .pm = &intel_sst_pm,
>
> And use:
>
> .pm = pm_sleep_ptr(&intel_sst_pm),
>
>
> Here, this is the new #ifdef and __maybe_unused free way of dealing
> with pm_ops.
Sure.
Thanks,
Srinivas
>
> Regards,
>
> Hans
>
>
> > + },
> > };
> >
> > module_auxiliary_driver(intel_sst_aux_driver);
> > diff --git
> > a/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c
> > b/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c
> > index 9eaff90bb649..e173167085ea 100644
> > --- a/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c
> > +++ b/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c
> > @@ -229,6 +229,10 @@ struct perf_level {
> > * @status_offset: Store the status offset for each PP-level
> > * @sst_base: Mapped SST base IO memory
> > * @auxdev: Auxiliary device instance enumerated this
> > instance
> > + * @saved_sst_cp_control: Save SST-CP control configuration to
> > store restore for suspend/resume
> > + * @saved_clos_configs: Save SST-CP CLOS configuration to
> > store restore for suspend/resume
> > + * @saved_clos_assocs: Save SST-CP CLOS association to store
> > restore for suspend/resume
> > + * @saved_pp_control: Save SST-PP control information to store
> > restore for suspend/resume
> > *
> > * This structure is used store complete SST information for a
> > power_domain. This information
> > * is used to read/write request for any SST IOCTL. Each physical
> > CPU package can have multiple
> > @@ -250,6 +254,10 @@ struct tpmi_per_power_domain_info {
> > struct pp_status_offset status_offset;
> > void __iomem *sst_base;
> > struct auxiliary_device *auxdev;
> > + u64 saved_sst_cp_control;
> > + u64 saved_clos_configs[4];
> > + u64 saved_clos_assocs[4];
> > + u64 saved_pp_control;
> > };
> >
> > /**
> > @@ -1333,6 +1341,47 @@ void tpmi_sst_dev_remove(struct
> > auxiliary_device *auxdev)
> > }
> > EXPORT_SYMBOL_NS_GPL(tpmi_sst_dev_remove, INTEL_TPMI_SST);
> >
> > +void tpmi_sst_dev_suspend(struct auxiliary_device *auxdev)
> > +{
> > + struct tpmi_sst_struct *tpmi_sst =
> > auxiliary_get_drvdata(auxdev);
> > + struct tpmi_per_power_domain_info *power_domain_info =
> > tpmi_sst->power_domain_info;
> > + void __iomem *cp_base;
> > +
> > + cp_base = power_domain_info->sst_base + power_domain_info-
> > >sst_header.cp_offset;
> > + power_domain_info->saved_sst_cp_control = readq(cp_base +
> > SST_CP_CONTROL_OFFSET);
> > +
> > + memcpy_fromio(power_domain_info->saved_clos_configs,
> > cp_base + SST_CLOS_CONFIG_0_OFFSET,
> > + sizeof(power_domain_info-
> > >saved_clos_configs));
> > +
> > + memcpy_fromio(power_domain_info->saved_clos_assocs, cp_base
> > + SST_CLOS_ASSOC_0_OFFSET,
> > + sizeof(power_domain_info-
> > >saved_clos_assocs));
> > +
> > + power_domain_info->saved_pp_control =
> > readq(power_domain_info->sst_base +
> > +
> > power_domain_info->sst_header.pp_offset +
> > +
> > SST_PP_CONTROL_OFFSET);
> > +}
> > +EXPORT_SYMBOL_NS_GPL(tpmi_sst_dev_suspend, INTEL_TPMI_SST);
> > +
> > +void tpmi_sst_dev_resume(struct auxiliary_device *auxdev)
> > +{
> > + struct tpmi_sst_struct *tpmi_sst =
> > auxiliary_get_drvdata(auxdev);
> > + struct tpmi_per_power_domain_info *power_domain_info =
> > tpmi_sst->power_domain_info;
> > + void __iomem *cp_base;
> > +
> > + cp_base = power_domain_info->sst_base + power_domain_info-
> > >sst_header.cp_offset;
> > + writeq(power_domain_info->saved_sst_cp_control, cp_base +
> > SST_CP_CONTROL_OFFSET);
> > +
> > + memcpy_toio(cp_base + SST_CLOS_CONFIG_0_OFFSET,
> > power_domain_info->saved_clos_configs,
> > + sizeof(power_domain_info->saved_clos_configs));
> > +
> > + memcpy_toio(cp_base + SST_CLOS_ASSOC_0_OFFSET,
> > power_domain_info->saved_clos_assocs,
> > + sizeof(power_domain_info->saved_clos_assocs));
> > +
> > + writeq(power_domain_info->saved_pp_control,
> > power_domain_info->sst_base +
> > + power_domain_info-
> > >sst_header.pp_offset + SST_PP_CONTROL_OFFSET);
> > +}
> > +EXPORT_SYMBOL_NS_GPL(tpmi_sst_dev_resume, INTEL_TPMI_SST);
> > +
> > #define ISST_TPMI_API_VERSION 0x02
> >
> > int tpmi_sst_init(void)
> > diff --git
> > a/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.h
> > b/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.h
> > index 356cb02273b1..900b483703f9 100644
> > --- a/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.h
> > +++ b/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.h
> > @@ -13,4 +13,6 @@ int tpmi_sst_init(void);
> > void tpmi_sst_exit(void);
> > int tpmi_sst_dev_add(struct auxiliary_device *auxdev);
> > void tpmi_sst_dev_remove(struct auxiliary_device *auxdev);
> > +void tpmi_sst_dev_suspend(struct auxiliary_device *auxdev);
> > +void tpmi_sst_dev_resume(struct auxiliary_device *auxdev);
> > #endif
>
prev parent reply other threads:[~2023-03-01 14:46 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-11 6:32 [PATCH 00/12] platform/x86: ISST: Use TPMI interface Srinivas Pandruvada
2023-02-11 6:32 ` [PATCH 01/12] platform/x86: ISST: Fix kernel documentation warnings Srinivas Pandruvada
2023-03-01 14:23 ` Hans de Goede
2023-03-01 14:48 ` srinivas pandruvada
2023-03-01 14:48 ` Hans de Goede
2023-02-11 6:32 ` [PATCH 02/12] platform/x86: ISST: Add TPMI target Srinivas Pandruvada
2023-03-01 14:25 ` Hans de Goede
2023-02-11 6:32 ` [PATCH 03/12] platform/x86: ISST: Add IOCTL default callback Srinivas Pandruvada
2023-02-11 6:32 ` [PATCH 04/12] platform/x86: ISST: Add API version of the target Srinivas Pandruvada
2023-02-11 6:32 ` [PATCH 05/12] platform/x86: ISST: Add support for MSR 0x54 Srinivas Pandruvada
2023-03-01 14:30 ` Hans de Goede
2023-03-01 14:41 ` srinivas pandruvada
2023-03-01 14:46 ` Hans de Goede
2023-02-11 6:32 ` [PATCH 06/12] platform/x86: ISST: Enumerate TPMI SST and create framework Srinivas Pandruvada
2023-03-01 14:37 ` Hans de Goede
2023-03-01 14:45 ` srinivas pandruvada
2023-03-01 14:47 ` Hans de Goede
2023-02-11 6:32 ` [PATCH 07/12] platform/x86: ISST: Parse SST MMIO and update instance Srinivas Pandruvada
2023-02-11 6:32 ` [PATCH 08/12] platform/x86: ISST: Add SST-CP support via TPMI Srinivas Pandruvada
2023-02-11 6:32 ` [PATCH 09/12] platform/x86: ISST: Add SST-PP " Srinivas Pandruvada
2023-02-11 6:32 ` [PATCH 10/12] platform/x86: ISST: Add SST-BF " Srinivas Pandruvada
2023-02-11 6:32 ` [PATCH 11/12] platform/x86: ISST: Add SST-TF " Srinivas Pandruvada
2023-02-11 6:32 ` [PATCH 12/12] platform/x86: ISST: Add suspend/resume callbacks Srinivas Pandruvada
2023-03-01 14:40 ` Hans de Goede
2023-03-01 14:46 ` srinivas pandruvada [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fbad311a983902703ced27894d8e34a5e0b5d966.camel@linux.intel.com \
--to=srinivas.pandruvada@linux.intel.com \
--cc=hdegoede@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=markgross@kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®