From: "Luke Jones" <luke@ljones.dev>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Hans de Goede" <hdegoede@redhat.com>
Cc: corentin.chary@gmail.com, platform-driver-x86@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 7/9] platform/x86: asus-wmi: add enable/disable CPU cores
Date: Wed, 29 May 2024 09:37:32 +1200 [thread overview]
Message-ID: <a476aebc-fb31-4236-81cf-70a9e1e564a3@app.fastmail.com> (raw)
In-Reply-To: <4660daf1-f42f-9b65-eaf5-30daf2931058@linux.intel.com>
On Tue, 28 May 2024, at 9:27 PM, Ilpo Järvinen wrote:
> Hi,
>
> Hans, please check my question below.
>
> On Tue, 28 May 2024, Luke D. Jones wrote:
>
> > Exposes the WMI functions for enable/disable of performance and
> > efficiency cores on some laptop models (largely Intel only).
> >
> > Signed-off-by: Luke D. Jones <luke@ljones.dev>
> > ---
>
> > diff --git a/Documentation/ABI/testing/sysfs-platform-asus-wmi b/Documentation/ABI/testing/sysfs-platform-asus-wmi
> > index 3b4eeea75b7b..ac881e72e374 100644
> > --- a/Documentation/ABI/testing/sysfs-platform-asus-wmi
> > +++ b/Documentation/ABI/testing/sysfs-platform-asus-wmi
> > @@ -226,3 +226,22 @@ Description:
> > Set panel to UHD or FHD mode
> > * 0 - UHD,
> > * 1 - FHD
> > +
> > +What: /sys/devices/platform/<platform>/cores_enabled
> > +Date: Jun 2024
> > +KernelVersion: 6.11
> > +Contact: "Luke Jones" <luke@ljones.dev>
> > +Description:
> > + Enable/disable efficiency and performance cores. The format is
> > + 0x[E][P] where [E] is the efficiency core count, and [P] is
> > + the perfromance core count. If the core count is a single digit
>
> performance
>
> > + it is preceded by a 0 such as 0x0406; E=4, P=6, 0x1006; E=10, P=6
> > +
> > +What: /sys/devices/platform/<platform>/cores_max
> > +Date: Jun 2024
> > +KernelVersion: 6.11
> > +Contact: "Luke Jones" <luke@ljones.dev>
> > +Description:
> > + Show the maximum performance and efficiency core countin format
> > + 0x[E][P] where [E] is the efficiency core count, and [P] is
> > + the perfromance core count.
>
> performance
>
> > diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
> > index 4b045f1828f1..f62a36dfcd4b 100644
> > --- a/drivers/platform/x86/asus-wmi.c
> > +++ b/drivers/platform/x86/asus-wmi.c
> > @@ -815,6 +815,46 @@ static ssize_t panel_fhd_store(struct device *dev,
> > WMI_SIMPLE_SHOW(panel_fhd, "%d\n", ASUS_WMI_DEVID_PANEL_FHD);
> > static DEVICE_ATTR_RW(panel_fhd);
> >
> > +/* Efficiency and Performance core control **********************************/
> > +static ssize_t cores_enabled_store(struct device *dev,
> > + struct device_attribute *attr,
> > + const char *buf, size_t count)
> > +{
> > + struct asus_wmi *asus = dev_get_drvdata(dev);
> > + int result, err;
> > + u32 cores, max;
> > +
> > + result = kstrtou32(buf, 16, &cores);
> > + if (result)
> > + return result;
> > +
> > + err = asus_wmi_get_devstate(asus, ASUS_WMI_DEVID_CORES_MAX, &max);
> > + if (err < 0)
> > + return err;
> > +
> > + if (cores > max) {
>
> This only checks one part of it and the P part can contain whatever
> garbage as long as E is small enough?
>
> But I'm not sure if it's good idea to have these two changed through the
> same sysfs file, I'm leaning more on that it would be better to split the
> interface for P and E.
>
> Hans, what you think about this?
I'm inclined to agree. It's no issue to change it.
Ack all reviews. I'll work through them over the week but with a lower priority while I await both yours and Hans response in other replies with Mario regarding the firmware_attributes change/use.
>
> > + pr_warn("Core count 0x%x exceeds max: 0x%x\n", cores, max);
> > + return -EIO;
> > + }
> > +
> > + err = asus_wmi_set_devstate(ASUS_WMI_DEVID_CORES_SET, cores, &result);
> > + if (err) {
> > + pr_warn("Failed to set cores_enabled: %d\n", err);
> > + return err;
> > + }
> > +
> > + pr_info("Enabled core count changed, reboot required\n");
> > + sysfs_notify(&asus->platform_device->dev.kobj, NULL, "cores_enabled");
> > +
> > + return count;
> > +}
>
> > @@ -4131,6 +4173,9 @@ static umode_t asus_sysfs_is_visible(struct kobject *kobj,
> > devid = ASUS_WMI_DEVID_PANEL_OD;
> > else if (attr == &dev_attr_panel_fhd.attr)
> > devid = ASUS_WMI_DEVID_PANEL_FHD;
> > + else if (attr == &dev_attr_cores_enabled.attr
> > + || attr == &dev_attr_cores_max.attr)
>
> Wrong alignment.
>
> --
> i.
>
>
next prev parent reply other threads:[~2024-05-28 21:37 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-28 1:36 [PATCH 0/9] platform-x86-asus-wmi: multiple fixes, improvements, features Luke D. Jones
2024-05-28 1:36 ` [PATCH 1/9] platform/x86: asus-wmi: add debug print in more key places Luke D. Jones
2024-05-28 1:36 ` [PATCH 2/9] platform/x86: asus-wmi: don't fail if platform_profile already registered Luke D. Jones
2024-05-28 1:36 ` [PATCH 3/9] platform/x86: asus-wmi: add macros and expose min/max sysfs for ppt tunables Luke D. Jones
2024-05-28 8:50 ` Ilpo Järvinen
2024-06-04 5:14 ` kernel test robot
2024-05-28 1:36 ` [PATCH 4/9] platform/x86: asus-wmi: reduce code duplication with macros Luke D. Jones
2024-05-28 8:55 ` Ilpo Järvinen
2024-05-28 9:03 ` Ilpo Järvinen
2024-05-28 1:36 ` [PATCH 5/9] platform/x86: asus-wmi: use WMI_SIMPLE_SHOW in more places Luke D. Jones
2024-05-28 9:06 ` Ilpo Järvinen
2024-05-28 1:36 ` [PATCH 6/9] platform/x86: asus-wmi: add panel-fhd functionality Luke D. Jones
2024-05-28 9:18 ` Ilpo Järvinen
2024-05-28 1:36 ` [PATCH 7/9] platform/x86: asus-wmi: add enable/disable CPU cores Luke D. Jones
2024-05-28 9:27 ` Ilpo Järvinen
2024-05-28 21:37 ` Luke Jones [this message]
2024-05-28 1:36 ` [PATCH 8/9] platform/x86: asus-wmi: add apu_mem setting Luke D. Jones
2024-05-28 2:19 ` Limonciello, Mario
2024-05-28 2:40 ` Luke Jones
2024-05-28 13:27 ` Mario Limonciello
2024-05-28 21:04 ` Luke Jones
2024-05-28 21:16 ` Mario Limonciello
2024-05-28 21:34 ` Luke Jones
2024-05-28 21:36 ` Mario Limonciello
2024-05-28 21:37 ` Mario Limonciello
2024-05-28 1:36 ` [PATCH 9/9] platform/x86: asus-wmi: add setting dGPU TGP Luke D. Jones
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=a476aebc-fb31-4236-81cf-70a9e1e564a3@app.fastmail.com \
--to=luke@ljones.dev \
--cc=corentin.chary@gmail.com \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.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®