Commit 7281a59c authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'platform-drivers-x86-v5.18-2' of...

Merge tag 'platform-drivers-x86-v5.18-2' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86

Pull x86 platform drivers fixes from Hans de Goede:

 - Documentation and compilation warning fixes

 - Kconfig dep fixes

 - Misc small code cleanups

* tag 'platform-drivers-x86-v5.18-2' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86:
  platform/x86: amd-pmc: Fix compilation without CONFIG_SUSPEND
  platform/x86: acerhdf: Cleanup str_starts_with()
  Documentation/ABI: sysfs-class-firmware-attributes: Misc. cleanups
  Documentation/ABI: sysfs-class-firmware-attributes: Fix Sphinx errors
  Documentation/ABI: sysfs-driver-intel_sdsi: Fix sphinx warnings
  platform/x86: barco-p50-gpio: Fix duplicate included linux/io.h
  platform/x86: samsung-laptop: Fix an unsigned comparison which can never be negative
  platform/x86: think-lmi: certificate support clean ups
parents ce522ba9 753ee989
...@@ -116,7 +116,7 @@ Description: ...@@ -116,7 +116,7 @@ Description:
<value>[ForceIf:<attribute>=<value>] <value>[ForceIf:<attribute>=<value>]
<value>[ForceIfNot:<attribute>=<value>] <value>[ForceIfNot:<attribute>=<value>]
For example: For example::
LegacyOrom/dell_value_modifier has value: LegacyOrom/dell_value_modifier has value:
Disabled[ForceIf:SecureBoot=Enabled] Disabled[ForceIf:SecureBoot=Enabled]
...@@ -212,7 +212,7 @@ Description: ...@@ -212,7 +212,7 @@ Description:
the next boot. the next boot.
Lenovo specific class extensions Lenovo specific class extensions
------------------------------ --------------------------------
On Lenovo systems the following additional settings are available: On Lenovo systems the following additional settings are available:
...@@ -246,9 +246,7 @@ Description: ...@@ -246,9 +246,7 @@ Description:
that is being referenced (e.g hdd0, hdd1 etc) that is being referenced (e.g hdd0, hdd1 etc)
This attribute defaults to device 0. This attribute defaults to device 0.
certificate: certificate, signature, save_signature:
signature:
save_signature:
These attributes are used for certificate based authentication. This is These attributes are used for certificate based authentication. This is
used in conjunction with a signing server as an alternative to password used in conjunction with a signing server as an alternative to password
based authentication. based authentication.
...@@ -257,22 +255,27 @@ Description: ...@@ -257,22 +255,27 @@ Description:
The attributes can be displayed to check the stored value. The attributes can be displayed to check the stored value.
Some usage examples: Some usage examples:
Installing a certificate to enable feature:
echo <supervisor password > authentication/Admin/current_password
echo <signed certificate> > authentication/Admin/certificate
Updating the installed certificate: Installing a certificate to enable feature::
echo <signature> > authentication/Admin/signature
echo <signed certificate> > authentication/Admin/certificate echo "supervisor password" > authentication/Admin/current_password
echo "signed certificate" > authentication/Admin/certificate
Updating the installed certificate::
echo "signature" > authentication/Admin/signature
echo "signed certificate" > authentication/Admin/certificate
Removing the installed certificate: Removing the installed certificate::
echo <signature> > authentication/Admin/signature
echo '' > authentication/Admin/certificate
Changing a BIOS setting: echo "signature" > authentication/Admin/signature
echo <signature> > authentication/Admin/signature echo "" > authentication/Admin/certificate
echo <save signature> > authentication/Admin/save_signature
echo Enable > attribute/PasswordBeep/current_value Changing a BIOS setting::
echo "signature" > authentication/Admin/signature
echo "save signature" > authentication/Admin/save_signature
echo Enable > attribute/PasswordBeep/current_value
You cannot enable certificate authentication if a supervisor password You cannot enable certificate authentication if a supervisor password
has not been set. has not been set.
...@@ -288,9 +291,10 @@ Description: ...@@ -288,9 +291,10 @@ Description:
certificate_to_password: certificate_to_password:
Write only attribute used to switch from certificate based authentication Write only attribute used to switch from certificate based authentication
back to password based. back to password based.
Usage: Usage::
echo <signature> > authentication/Admin/signature
echo <password> > authentication/Admin/certificate_to_password echo "signature" > authentication/Admin/signature
echo "password" > authentication/Admin/certificate_to_password
What: /sys/class/firmware-attributes/*/attributes/pending_reboot What: /sys/class/firmware-attributes/*/attributes/pending_reboot
...@@ -345,7 +349,7 @@ Description: ...@@ -345,7 +349,7 @@ Description:
# echo "factory" > /sys/class/firmware-attributes/*/device/attributes/reset_bios # echo "factory" > /sys/class/firmware-attributes/*/device/attributes/reset_bios
# cat /sys/class/firmware-attributes/*/device/attributes/reset_bios # cat /sys/class/firmware-attributes/*/device/attributes/reset_bios
# builtinsafe lastknowngood [factory] custom builtinsafe lastknowngood [factory] custom
Note that any changes to this attribute requires a reboot Note that any changes to this attribute requires a reboot
for changes to take effect. for changes to take effect.
......
...@@ -13,17 +13,19 @@ Description: ...@@ -13,17 +13,19 @@ Description:
Should the operation fail, one of the following error codes Should the operation fail, one of the following error codes
may be returned: may be returned:
========== =====
Error Code Cause Error Code Cause
---------- ----- ========== =====
EIO General mailbox failure. Log may indicate cause. EIO General mailbox failure. Log may indicate cause.
EBUSY Mailbox is owned by another agent. EBUSY Mailbox is owned by another agent.
EPERM SDSI capability is not enabled in hardware. EPERM SDSI capability is not enabled in hardware.
EPROTO Failure in mailbox protocol detected by driver. EPROTO Failure in mailbox protocol detected by driver.
See log for details. See log for details.
EOVERFLOW For provision commands, the size of the data EOVERFLOW For provision commands, the size of the data
exceeds what may be written. exceeds what may be written.
ESPIPE Seeking is not allowed. ESPIPE Seeking is not allowed.
ETIMEDOUT Failure to complete mailbox transaction in time. ETIMEDOUT Failure to complete mailbox transaction in time.
========== =====
What: /sys/bus/auxiliary/devices/intel_vsec.sdsi.X/guid What: /sys/bus/auxiliary/devices/intel_vsec.sdsi.X/guid
Date: Feb 2022 Date: Feb 2022
......
...@@ -584,21 +584,6 @@ static struct platform_driver acerhdf_driver = { ...@@ -584,21 +584,6 @@ static struct platform_driver acerhdf_driver = {
.remove = acerhdf_remove, .remove = acerhdf_remove,
}; };
/* checks if str begins with start */
static int str_starts_with(const char *str, const char *start)
{
unsigned long str_len = 0, start_len = 0;
str_len = strlen(str);
start_len = strlen(start);
if (str_len >= start_len &&
!strncmp(str, start, start_len))
return 1;
return 0;
}
/* check hardware */ /* check hardware */
static int __init acerhdf_check_hardware(void) static int __init acerhdf_check_hardware(void)
{ {
...@@ -651,9 +636,9 @@ static int __init acerhdf_check_hardware(void) ...@@ -651,9 +636,9 @@ static int __init acerhdf_check_hardware(void)
* check if actual hardware BIOS vendor, product and version * check if actual hardware BIOS vendor, product and version
* IDs start with the strings of BIOS table entry * IDs start with the strings of BIOS table entry
*/ */
if (str_starts_with(vendor, bt->vendor) && if (strstarts(vendor, bt->vendor) &&
str_starts_with(product, bt->product) && strstarts(product, bt->product) &&
str_starts_with(version, bt->version)) { strstarts(version, bt->version)) {
found = 1; found = 1;
break; break;
} }
......
...@@ -160,8 +160,10 @@ MODULE_PARM_DESC(enable_stb, "Enable the STB debug mechanism"); ...@@ -160,8 +160,10 @@ MODULE_PARM_DESC(enable_stb, "Enable the STB debug mechanism");
static struct amd_pmc_dev pmc; static struct amd_pmc_dev pmc;
static int amd_pmc_send_cmd(struct amd_pmc_dev *dev, u32 arg, u32 *data, u8 msg, bool ret); static int amd_pmc_send_cmd(struct amd_pmc_dev *dev, u32 arg, u32 *data, u8 msg, bool ret);
static int amd_pmc_write_stb(struct amd_pmc_dev *dev, u32 data);
static int amd_pmc_read_stb(struct amd_pmc_dev *dev, u32 *buf); static int amd_pmc_read_stb(struct amd_pmc_dev *dev, u32 *buf);
#ifdef CONFIG_SUSPEND
static int amd_pmc_write_stb(struct amd_pmc_dev *dev, u32 data);
#endif
static inline u32 amd_pmc_reg_read(struct amd_pmc_dev *dev, int reg_offset) static inline u32 amd_pmc_reg_read(struct amd_pmc_dev *dev, int reg_offset)
{ {
...@@ -325,6 +327,7 @@ static int get_metrics_table(struct amd_pmc_dev *pdev, struct smu_metrics *table ...@@ -325,6 +327,7 @@ static int get_metrics_table(struct amd_pmc_dev *pdev, struct smu_metrics *table
return 0; return 0;
} }
#ifdef CONFIG_SUSPEND
static void amd_pmc_validate_deepest(struct amd_pmc_dev *pdev) static void amd_pmc_validate_deepest(struct amd_pmc_dev *pdev)
{ {
struct smu_metrics table; struct smu_metrics table;
...@@ -338,6 +341,7 @@ static void amd_pmc_validate_deepest(struct amd_pmc_dev *pdev) ...@@ -338,6 +341,7 @@ static void amd_pmc_validate_deepest(struct amd_pmc_dev *pdev)
dev_dbg(pdev->dev, "Last suspend in deepest state for %lluus\n", dev_dbg(pdev->dev, "Last suspend in deepest state for %lluus\n",
table.timein_s0i3_lastcapture); table.timein_s0i3_lastcapture);
} }
#endif
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
static int smu_fw_info_show(struct seq_file *s, void *unused) static int smu_fw_info_show(struct seq_file *s, void *unused)
...@@ -569,6 +573,7 @@ static int amd_pmc_send_cmd(struct amd_pmc_dev *dev, u32 arg, u32 *data, u8 msg, ...@@ -569,6 +573,7 @@ static int amd_pmc_send_cmd(struct amd_pmc_dev *dev, u32 arg, u32 *data, u8 msg,
return rc; return rc;
} }
#ifdef CONFIG_SUSPEND
static int amd_pmc_get_os_hint(struct amd_pmc_dev *dev) static int amd_pmc_get_os_hint(struct amd_pmc_dev *dev)
{ {
switch (dev->cpu_id) { switch (dev->cpu_id) {
...@@ -694,6 +699,7 @@ static struct acpi_s2idle_dev_ops amd_pmc_s2idle_dev_ops = { ...@@ -694,6 +699,7 @@ static struct acpi_s2idle_dev_ops amd_pmc_s2idle_dev_ops = {
.prepare = amd_pmc_s2idle_prepare, .prepare = amd_pmc_s2idle_prepare,
.restore = amd_pmc_s2idle_restore, .restore = amd_pmc_s2idle_restore,
}; };
#endif
static const struct pci_device_id pmc_pci_ids[] = { static const struct pci_device_id pmc_pci_ids[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, AMD_CPU_ID_YC) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, AMD_CPU_ID_YC) },
...@@ -733,6 +739,7 @@ static int amd_pmc_s2d_init(struct amd_pmc_dev *dev) ...@@ -733,6 +739,7 @@ static int amd_pmc_s2d_init(struct amd_pmc_dev *dev)
return 0; return 0;
} }
#ifdef CONFIG_SUSPEND
static int amd_pmc_write_stb(struct amd_pmc_dev *dev, u32 data) static int amd_pmc_write_stb(struct amd_pmc_dev *dev, u32 data)
{ {
int err; int err;
...@@ -753,6 +760,7 @@ static int amd_pmc_write_stb(struct amd_pmc_dev *dev, u32 data) ...@@ -753,6 +760,7 @@ static int amd_pmc_write_stb(struct amd_pmc_dev *dev, u32 data)
return 0; return 0;
} }
#endif
static int amd_pmc_read_stb(struct amd_pmc_dev *dev, u32 *buf) static int amd_pmc_read_stb(struct amd_pmc_dev *dev, u32 *buf)
{ {
...@@ -859,9 +867,11 @@ static int amd_pmc_probe(struct platform_device *pdev) ...@@ -859,9 +867,11 @@ static int amd_pmc_probe(struct platform_device *pdev)
amd_pmc_get_smu_version(dev); amd_pmc_get_smu_version(dev);
platform_set_drvdata(pdev, dev); platform_set_drvdata(pdev, dev);
#ifdef CONFIG_SUSPEND
err = acpi_register_lps0_dev(&amd_pmc_s2idle_dev_ops); err = acpi_register_lps0_dev(&amd_pmc_s2idle_dev_ops);
if (err) if (err)
dev_warn(dev->dev, "failed to register LPS0 sleep handler, expect increased power consumption\n"); dev_warn(dev->dev, "failed to register LPS0 sleep handler, expect increased power consumption\n");
#endif
amd_pmc_dbgfs_register(dev); amd_pmc_dbgfs_register(dev);
return 0; return 0;
...@@ -875,7 +885,9 @@ static int amd_pmc_remove(struct platform_device *pdev) ...@@ -875,7 +885,9 @@ static int amd_pmc_remove(struct platform_device *pdev)
{ {
struct amd_pmc_dev *dev = platform_get_drvdata(pdev); struct amd_pmc_dev *dev = platform_get_drvdata(pdev);
#ifdef CONFIG_SUSPEND
acpi_unregister_lps0_dev(&amd_pmc_s2idle_dev_ops); acpi_unregister_lps0_dev(&amd_pmc_s2idle_dev_ops);
#endif
amd_pmc_dbgfs_unregister(dev); amd_pmc_dbgfs_unregister(dev);
pci_dev_put(dev->rdev); pci_dev_put(dev->rdev);
mutex_destroy(&dev->lock); mutex_destroy(&dev->lock);
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/io.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/dmi.h> #include <linux/dmi.h>
#include <linux/err.h> #include <linux/err.h>
......
...@@ -1121,8 +1121,6 @@ static void kbd_led_set(struct led_classdev *led_cdev, ...@@ -1121,8 +1121,6 @@ static void kbd_led_set(struct led_classdev *led_cdev,
if (value > samsung->kbd_led.max_brightness) if (value > samsung->kbd_led.max_brightness)
value = samsung->kbd_led.max_brightness; value = samsung->kbd_led.max_brightness;
else if (value < 0)
value = 0;
samsung->kbd_led_wk = value; samsung->kbd_led_wk = value;
queue_work(samsung->led_workqueue, &samsung->kbd_led_work); queue_work(samsung->led_workqueue, &samsung->kbd_led_work);
......
...@@ -740,16 +740,8 @@ static ssize_t certificate_store(struct kobject *kobj, ...@@ -740,16 +740,8 @@ static ssize_t certificate_store(struct kobject *kobj,
if (!tlmi_priv.certificate_support) if (!tlmi_priv.certificate_support)
return -EOPNOTSUPP; return -EOPNOTSUPP;
new_cert = kstrdup(buf, GFP_KERNEL);
if (!new_cert)
return -ENOMEM;
/* Strip out CR if one is present */
strip_cr(new_cert);
/* If empty then clear installed certificate */ /* If empty then clear installed certificate */
if (new_cert[0] == '\0') { /* Clear installed certificate */ if ((buf[0] == '\0') || (buf[0] == '\n')) { /* Clear installed certificate */
kfree(new_cert);
/* Check that signature is set */ /* Check that signature is set */
if (!setting->signature || !setting->signature[0]) if (!setting->signature || !setting->signature[0])
return -EACCES; return -EACCES;
...@@ -763,14 +755,16 @@ static ssize_t certificate_store(struct kobject *kobj, ...@@ -763,14 +755,16 @@ static ssize_t certificate_store(struct kobject *kobj,
ret = tlmi_simple_call(LENOVO_CLEAR_BIOS_CERT_GUID, auth_str); ret = tlmi_simple_call(LENOVO_CLEAR_BIOS_CERT_GUID, auth_str);
kfree(auth_str); kfree(auth_str);
if (ret)
return ret;
kfree(setting->certificate); return ret ?: count;
setting->certificate = NULL;
return count;
} }
new_cert = kstrdup(buf, GFP_KERNEL);
if (!new_cert)
return -ENOMEM;
/* Strip out CR if one is present */
strip_cr(new_cert);
if (setting->cert_installed) { if (setting->cert_installed) {
/* Certificate is installed so this is an update */ /* Certificate is installed so this is an update */
if (!setting->signature || !setting->signature[0]) { if (!setting->signature || !setting->signature[0]) {
...@@ -792,21 +786,14 @@ static ssize_t certificate_store(struct kobject *kobj, ...@@ -792,21 +786,14 @@ static ssize_t certificate_store(struct kobject *kobj,
auth_str = kasprintf(GFP_KERNEL, "%s,%s", auth_str = kasprintf(GFP_KERNEL, "%s,%s",
new_cert, setting->password); new_cert, setting->password);
} }
if (!auth_str) { kfree(new_cert);
kfree(new_cert); if (!auth_str)
return -ENOMEM; return -ENOMEM;
}
ret = tlmi_simple_call(guid, auth_str); ret = tlmi_simple_call(guid, auth_str);
kfree(auth_str); kfree(auth_str);
if (ret) {
kfree(new_cert);
return ret;
}
kfree(setting->certificate); return ret ?: count;
setting->certificate = new_cert;
return count;
} }
static struct kobj_attribute auth_certificate = __ATTR_WO(certificate); static struct kobj_attribute auth_certificate = __ATTR_WO(certificate);
...@@ -1194,6 +1181,10 @@ static void tlmi_release_attr(void) ...@@ -1194,6 +1181,10 @@ static void tlmi_release_attr(void)
kset_unregister(tlmi_priv.attribute_kset); kset_unregister(tlmi_priv.attribute_kset);
/* Free up any saved signatures */
kfree(tlmi_priv.pwd_admin->signature);
kfree(tlmi_priv.pwd_admin->save_signature);
/* Authentication structures */ /* Authentication structures */
sysfs_remove_group(&tlmi_priv.pwd_admin->kobj, &auth_attr_group); sysfs_remove_group(&tlmi_priv.pwd_admin->kobj, &auth_attr_group);
kobject_put(&tlmi_priv.pwd_admin->kobj); kobject_put(&tlmi_priv.pwd_admin->kobj);
...@@ -1210,11 +1201,6 @@ static void tlmi_release_attr(void) ...@@ -1210,11 +1201,6 @@ static void tlmi_release_attr(void)
} }
kset_unregister(tlmi_priv.authentication_kset); kset_unregister(tlmi_priv.authentication_kset);
/* Free up any saved certificates/signatures */
kfree(tlmi_priv.pwd_admin->certificate);
kfree(tlmi_priv.pwd_admin->signature);
kfree(tlmi_priv.pwd_admin->save_signature);
} }
static int tlmi_sysfs_init(void) static int tlmi_sysfs_init(void)
......
...@@ -63,7 +63,6 @@ struct tlmi_pwd_setting { ...@@ -63,7 +63,6 @@ struct tlmi_pwd_setting {
int index; /*Used for HDD and NVME auth */ int index; /*Used for HDD and NVME auth */
enum level_option level; enum level_option level;
bool cert_installed; bool cert_installed;
char *certificate;
char *signature; char *signature;
char *save_signature; char *save_signature;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment