Skip to content

Commit 8a696a2

Browse files
committed
Merge tag 'platform-drivers-x86-v6.8-2' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86
Pull x86 platform driver fixes from Hans de Goede: - WMI bus driver fixes - Second attempt (previously reverted) at P2SB PCI rescan deadlock fix - AMD PMF driver improvements - MAINTAINERS updates - Misc other small fixes and hw-id additions * tag 'platform-drivers-x86-v6.8-2' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86: platform/x86: touchscreen_dmi: Add info for the TECLAST X16 Plus tablet platform/x86/intel/ifs: Call release_firmware() when handling errors. platform/x86/amd/pmf: Fix memory leak in amd_pmf_get_pb_data() platform/x86/amd/pmf: Get ambient light information from AMD SFH driver platform/x86/amd/pmf: Get Human presence information from AMD SFH driver platform/mellanox: mlxbf-pmc: Fix offset calculation for crspace events platform/mellanox: mlxbf-tmfifo: Drop Tx network packet when Tx TmFIFO is full MAINTAINERS: remove defunct acpi4asus project info from asus notebooks section MAINTAINERS: add Luke Jones as maintainer for asus notebooks MAINTAINERS: Remove Perry Yuan as DELL WMI HARDWARE PRIVACY SUPPORT maintainer platform/x86: silicom-platform: Add missing "Description:" for power_cycle sysfs attr platform/x86: intel-wmi-sbl-fw-update: Fix function name in error message platform/x86: p2sb: Use pci_resource_n() in p2sb_read_bar0() platform/x86: p2sb: Allow p2sb_bar() calls during PCI device probe platform/x86: intel-uncore-freq: Fix types in sysfs callbacks platform/x86: wmi: Fix wmi_dev_probe() platform/x86: wmi: Fix notify callback locking platform/x86: wmi: Decouple legacy WMI notify handlers from wmi_block_list platform/x86: wmi: Return immediately if an suitable WMI event is found platform/x86: wmi: Fix error handling in legacy WMI notify handler functions
2 parents 9553404 + 1abdf28 commit 8a696a2

File tree

14 files changed

+460
-177
lines changed

14 files changed

+460
-177
lines changed

Documentation/ABI/testing/sysfs-platform-silicom

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ What: /sys/devices/platform/silicom-platform/power_cycle
1010
Date: November 2023
1111
KernelVersion: 6.7
1212
Contact: Henry Shi <henrys@silicom-usa.com>
13+
Description:
1314
This file allow user to power cycle the platform.
1415
Default value is 0; when set to 1, it powers down
1516
the platform, waits 5 seconds, then powers on the

MAINTAINERS

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3168,10 +3168,10 @@ F: drivers/hwmon/asus-ec-sensors.c
31683168

31693169
ASUS NOTEBOOKS AND EEEPC ACPI/WMI EXTRAS DRIVERS
31703170
M: Corentin Chary <corentin.chary@gmail.com>
3171-
L: acpi4asus-user@lists.sourceforge.net
3171+
M: Luke D. Jones <luke@ljones.dev>
31723172
L: platform-driver-x86@vger.kernel.org
31733173
S: Maintained
3174-
W: http://acpi4asus.sf.net
3174+
W: https://asus-linux.org/
31753175
F: drivers/platform/x86/asus*.c
31763176
F: drivers/platform/x86/eeepc*.c
31773177

@@ -5958,7 +5958,6 @@ S: Maintained
59585958
F: drivers/platform/x86/dell/dell-wmi-descriptor.c
59595959

59605960
DELL WMI HARDWARE PRIVACY SUPPORT
5961-
M: Perry Yuan <Perry.Yuan@dell.com>
59625961
L: Dell.Client.Kernel@dell.com
59635962
L: platform-driver-x86@vger.kernel.org
59645963
S: Maintained

drivers/platform/mellanox/mlxbf-pmc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,7 +1170,7 @@ static int mlxbf_pmc_program_crspace_counter(int blk_num, uint32_t cnt_num,
11701170
int ret;
11711171

11721172
addr = pmc->block[blk_num].mmio_base +
1173-
(rounddown(cnt_num, 2) * MLXBF_PMC_CRSPACE_PERFSEL_SZ);
1173+
((cnt_num / 2) * MLXBF_PMC_CRSPACE_PERFSEL_SZ);
11741174
ret = mlxbf_pmc_readl(addr, &word);
11751175
if (ret)
11761176
return ret;
@@ -1413,7 +1413,7 @@ static int mlxbf_pmc_read_crspace_event(int blk_num, uint32_t cnt_num,
14131413
int ret;
14141414

14151415
addr = pmc->block[blk_num].mmio_base +
1416-
(rounddown(cnt_num, 2) * MLXBF_PMC_CRSPACE_PERFSEL_SZ);
1416+
((cnt_num / 2) * MLXBF_PMC_CRSPACE_PERFSEL_SZ);
14171417
ret = mlxbf_pmc_readl(addr, &word);
14181418
if (ret)
14191419
return ret;

drivers/platform/mellanox/mlxbf-tmfifo.c

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@
4747
/* Message with data needs at least two words (for header & data). */
4848
#define MLXBF_TMFIFO_DATA_MIN_WORDS 2
4949

50+
/* Tx timeout in milliseconds. */
51+
#define TMFIFO_TX_TIMEOUT 2000
52+
5053
/* ACPI UID for BlueField-3. */
5154
#define TMFIFO_BF3_UID 1
5255

@@ -62,12 +65,14 @@ struct mlxbf_tmfifo;
6265
* @drop_desc: dummy desc for packet dropping
6366
* @cur_len: processed length of the current descriptor
6467
* @rem_len: remaining length of the pending packet
68+
* @rem_padding: remaining bytes to send as paddings
6569
* @pkt_len: total length of the pending packet
6670
* @next_avail: next avail descriptor id
6771
* @num: vring size (number of descriptors)
6872
* @align: vring alignment size
6973
* @index: vring index
7074
* @vdev_id: vring virtio id (VIRTIO_ID_xxx)
75+
* @tx_timeout: expire time of last tx packet
7176
* @fifo: pointer to the tmfifo structure
7277
*/
7378
struct mlxbf_tmfifo_vring {
@@ -79,12 +84,14 @@ struct mlxbf_tmfifo_vring {
7984
struct vring_desc drop_desc;
8085
int cur_len;
8186
int rem_len;
87+
int rem_padding;
8288
u32 pkt_len;
8389
u16 next_avail;
8490
int num;
8591
int align;
8692
int index;
8793
int vdev_id;
94+
unsigned long tx_timeout;
8895
struct mlxbf_tmfifo *fifo;
8996
};
9097

@@ -819,6 +826,50 @@ static bool mlxbf_tmfifo_rxtx_one_desc(struct mlxbf_tmfifo_vring *vring,
819826
return true;
820827
}
821828

829+
static void mlxbf_tmfifo_check_tx_timeout(struct mlxbf_tmfifo_vring *vring)
830+
{
831+
unsigned long flags;
832+
833+
/* Only handle Tx timeout for network vdev. */
834+
if (vring->vdev_id != VIRTIO_ID_NET)
835+
return;
836+
837+
/* Initialize the timeout or return if not expired. */
838+
if (!vring->tx_timeout) {
839+
/* Initialize the timeout. */
840+
vring->tx_timeout = jiffies +
841+
msecs_to_jiffies(TMFIFO_TX_TIMEOUT);
842+
return;
843+
} else if (time_before(jiffies, vring->tx_timeout)) {
844+
/* Return if not timeout yet. */
845+
return;
846+
}
847+
848+
/*
849+
* Drop the packet after timeout. The outstanding packet is
850+
* released and the remaining bytes will be sent with padding byte 0x00
851+
* as a recovery. On the peer(host) side, the padding bytes 0x00 will be
852+
* either dropped directly, or appended into existing outstanding packet
853+
* thus dropped as corrupted network packet.
854+
*/
855+
vring->rem_padding = round_up(vring->rem_len, sizeof(u64));
856+
mlxbf_tmfifo_release_pkt(vring);
857+
vring->cur_len = 0;
858+
vring->rem_len = 0;
859+
vring->fifo->vring[0] = NULL;
860+
861+
/*
862+
* Make sure the load/store are in order before
863+
* returning back to virtio.
864+
*/
865+
virtio_mb(false);
866+
867+
/* Notify upper layer. */
868+
spin_lock_irqsave(&vring->fifo->spin_lock[0], flags);
869+
vring_interrupt(0, vring->vq);
870+
spin_unlock_irqrestore(&vring->fifo->spin_lock[0], flags);
871+
}
872+
822873
/* Rx & Tx processing of a queue. */
823874
static void mlxbf_tmfifo_rxtx(struct mlxbf_tmfifo_vring *vring, bool is_rx)
824875
{
@@ -841,6 +892,7 @@ static void mlxbf_tmfifo_rxtx(struct mlxbf_tmfifo_vring *vring, bool is_rx)
841892
return;
842893

843894
do {
895+
retry:
844896
/* Get available FIFO space. */
845897
if (avail == 0) {
846898
if (is_rx)
@@ -851,6 +903,17 @@ static void mlxbf_tmfifo_rxtx(struct mlxbf_tmfifo_vring *vring, bool is_rx)
851903
break;
852904
}
853905

906+
/* Insert paddings for discarded Tx packet. */
907+
if (!is_rx) {
908+
vring->tx_timeout = 0;
909+
while (vring->rem_padding >= sizeof(u64)) {
910+
writeq(0, vring->fifo->tx.data);
911+
vring->rem_padding -= sizeof(u64);
912+
if (--avail == 0)
913+
goto retry;
914+
}
915+
}
916+
854917
/* Console output always comes from the Tx buffer. */
855918
if (!is_rx && devid == VIRTIO_ID_CONSOLE) {
856919
mlxbf_tmfifo_console_tx(fifo, avail);
@@ -860,6 +923,10 @@ static void mlxbf_tmfifo_rxtx(struct mlxbf_tmfifo_vring *vring, bool is_rx)
860923
/* Handle one descriptor. */
861924
more = mlxbf_tmfifo_rxtx_one_desc(vring, is_rx, &avail);
862925
} while (more);
926+
927+
/* Check Tx timeout. */
928+
if (avail <= 0 && !is_rx)
929+
mlxbf_tmfifo_check_tx_timeout(vring);
863930
}
864931

865932
/* Handle Rx or Tx queues. */

drivers/platform/x86/amd/pmf/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ config AMD_PMF
1010
depends on AMD_NB
1111
select ACPI_PLATFORM_PROFILE
1212
depends on TEE && AMDTEE
13+
depends on AMD_SFH_HID
1314
help
1415
This driver provides support for the AMD Platform Management Framework.
1516
The goal is to enhance end user experience by making AMD PCs smarter,

drivers/platform/x86/amd/pmf/spc.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
*/
1111

1212
#include <acpi/button.h>
13+
#include <linux/amd-pmf-io.h>
1314
#include <linux/power_supply.h>
1415
#include <linux/units.h>
1516
#include "pmf.h"
@@ -44,6 +45,8 @@ void amd_pmf_dump_ta_inputs(struct amd_pmf_dev *dev, struct ta_pmf_enact_table *
4445
dev_dbg(dev->dev, "Max C0 Residency: %u\n", in->ev_info.max_c0residency);
4546
dev_dbg(dev->dev, "GFX Busy: %u\n", in->ev_info.gfx_busy);
4647
dev_dbg(dev->dev, "LID State: %s\n", in->ev_info.lid_state ? "close" : "open");
48+
dev_dbg(dev->dev, "User Presence: %s\n", in->ev_info.user_present ? "Present" : "Away");
49+
dev_dbg(dev->dev, "Ambient Light: %d\n", in->ev_info.ambient_light);
4750
dev_dbg(dev->dev, "==== TA inputs END ====\n");
4851
}
4952
#else
@@ -147,6 +150,38 @@ static int amd_pmf_get_slider_info(struct amd_pmf_dev *dev, struct ta_pmf_enact_
147150
return 0;
148151
}
149152

153+
static int amd_pmf_get_sensor_info(struct amd_pmf_dev *dev, struct ta_pmf_enact_table *in)
154+
{
155+
struct amd_sfh_info sfh_info;
156+
int ret;
157+
158+
/* Get ALS data */
159+
ret = amd_get_sfh_info(&sfh_info, MT_ALS);
160+
if (!ret)
161+
in->ev_info.ambient_light = sfh_info.ambient_light;
162+
else
163+
return ret;
164+
165+
/* get HPD data */
166+
ret = amd_get_sfh_info(&sfh_info, MT_HPD);
167+
if (ret)
168+
return ret;
169+
170+
switch (sfh_info.user_present) {
171+
case SFH_NOT_DETECTED:
172+
in->ev_info.user_present = 0xff; /* assume no sensors connected */
173+
break;
174+
case SFH_USER_PRESENT:
175+
in->ev_info.user_present = 1;
176+
break;
177+
case SFH_USER_AWAY:
178+
in->ev_info.user_present = 0;
179+
break;
180+
}
181+
182+
return 0;
183+
}
184+
150185
void amd_pmf_populate_ta_inputs(struct amd_pmf_dev *dev, struct ta_pmf_enact_table *in)
151186
{
152187
/* TA side lid open is 1 and close is 0, hence the ! here */
@@ -155,4 +190,5 @@ void amd_pmf_populate_ta_inputs(struct amd_pmf_dev *dev, struct ta_pmf_enact_tab
155190
amd_pmf_get_smu_info(dev, in);
156191
amd_pmf_get_battery_info(dev, in);
157192
amd_pmf_get_slider_info(dev, in);
193+
amd_pmf_get_sensor_info(dev, in);
158194
}

drivers/platform/x86/amd/pmf/tee-if.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,10 @@ static ssize_t amd_pmf_get_pb_data(struct file *filp, const char __user *buf,
298298
if (!new_policy_buf)
299299
return -ENOMEM;
300300

301-
if (copy_from_user(new_policy_buf, buf, length))
301+
if (copy_from_user(new_policy_buf, buf, length)) {
302+
kfree(new_policy_buf);
302303
return -EFAULT;
304+
}
303305

304306
kfree(dev->policy_buf);
305307
dev->policy_buf = new_policy_buf;

drivers/platform/x86/intel/ifs/load.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,8 @@ int ifs_load_firmware(struct device *dev)
399399
if (fw->size != expected_size) {
400400
dev_err(dev, "File size mismatch (expected %u, actual %zu). Corrupted IFS image.\n",
401401
expected_size, fw->size);
402-
return -EINVAL;
402+
ret = -EINVAL;
403+
goto release;
403404
}
404405

405406
ret = image_sanity_check(dev, (struct microcode_header_intel *)fw->data);

0 commit comments

Comments
 (0)