mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
Merge branches 'acpi-pcc', 'acpi-numa', 'acpi-pfrut', 'acpi-misc' and 'pnp'
Merge updates of the ACPI PCC (Platform Communications Channel) driver, ACPI NUMA support code, ACPI Platform Firmware Runtime Update and Telemetry driver, ACPI WMI support code, and a PNP update for 7.4: - Fix the shared memory signature handling in the ACPI PCC address space handler, free the PCC mailbox channel on operation region deactivation, and avoid unnecessary repeated computations of the PCC operation region command timeout (Sudeep Holla) - Fix a log message typo in the ACPI NUMA support code (Hemanth Selam) - Zero-initialize capability query result in the ACPI Platform Firmware Runtime Update and Telemetry driver to avoid disclosure of kernel stack data to user space (Karl Mehltretter) - Replace the remaining built-in/module check for CONFIG_ACPI_WMI in a header file with IS_ENABLED() macro (Lalit Shankar Chowdhury) - Detach device after resource transition failure in pnp_device_probe() to avoid blocking later manual PNP configuration attempts (Myeonghun Pak) * acpi-pcc: ACPI: PCC: Cache OpRegion command timeout ACPI: PCC: Free channel on OpRegion deactivation ACPI: PCC: Preserve shared memory signature in OpRegion handler * acpi-numa: ACPI: NUMA: fix typo in log message * acpi-pfrut: ACPI: pfr_update: zero-initialize capability query result * acpi-misc: ACPI: WMI: use IS_ENABLED() to simplify built-in or module check * pnp: PNP: Detach device after resource transition failure
This commit is contained in:
commit
84c4409e85
|
|
@ -28,6 +28,7 @@
|
|||
* to PCC commands
|
||||
*/
|
||||
#define PCC_CMD_WAIT_RETRIES_NUM 500ULL
|
||||
#define PCC_SIGNATURE_SIZE sizeof(u32)
|
||||
|
||||
struct pcc_data {
|
||||
struct pcc_mbox_chan *pcc_chan;
|
||||
|
|
@ -49,10 +50,24 @@ static acpi_status
|
|||
acpi_pcc_address_space_setup(acpi_handle region_handle, u32 function,
|
||||
void *handler_context, void **region_context)
|
||||
{
|
||||
struct pcc_data *data;
|
||||
struct acpi_pcc_info *ctx = handler_context;
|
||||
struct pcc_mbox_chan *pcc_chan;
|
||||
struct pcc_data *data;
|
||||
acpi_status ret;
|
||||
u64 usecs_lat;
|
||||
|
||||
if (function == ACPI_REGION_DEACTIVATE) {
|
||||
data = *region_context;
|
||||
if (data) {
|
||||
pcc_mbox_free_channel(data->pcc_chan);
|
||||
kfree(data);
|
||||
*region_context = NULL;
|
||||
}
|
||||
return AE_OK;
|
||||
}
|
||||
|
||||
if (function != ACPI_REGION_ACTIVATE)
|
||||
return AE_BAD_PARAMETER;
|
||||
|
||||
data = kzalloc_obj(*data);
|
||||
if (!data)
|
||||
|
|
@ -74,6 +89,14 @@ acpi_pcc_address_space_setup(acpi_handle region_handle, u32 function,
|
|||
}
|
||||
|
||||
pcc_chan = data->pcc_chan;
|
||||
if (pcc_chan->shmem_size < PCC_SIGNATURE_SIZE ||
|
||||
ctx->length > pcc_chan->shmem_size - PCC_SIGNATURE_SIZE) {
|
||||
pr_err("PCC channel-%d shared memory is too small.\n",
|
||||
ctx->subspace_id);
|
||||
ret = AE_AML_REGION_LIMIT;
|
||||
goto err_free_channel;
|
||||
}
|
||||
|
||||
if (!pcc_chan->mchan->mbox->txdone_irq) {
|
||||
pr_err("This channel-%d does not support interrupt.\n",
|
||||
ctx->subspace_id);
|
||||
|
|
@ -81,6 +104,16 @@ acpi_pcc_address_space_setup(acpi_handle region_handle, u32 function,
|
|||
goto err_free_channel;
|
||||
}
|
||||
|
||||
/*
|
||||
* pcc_chan->latency is just a Nominal value. In reality the remote
|
||||
* processor could be much slower to reply. So add an arbitrary
|
||||
* amount of wait on top of Nominal.
|
||||
*/
|
||||
usecs_lat = PCC_CMD_WAIT_RETRIES_NUM * pcc_chan->latency;
|
||||
data->cl.tx_tout = DIV_ROUND_UP_ULL(usecs_lat, 1000);
|
||||
if (!data->cl.tx_tout)
|
||||
data->cl.tx_tout = 1;
|
||||
|
||||
*region_context = data;
|
||||
return AE_OK;
|
||||
|
||||
|
|
@ -97,27 +130,23 @@ acpi_pcc_address_space_handler(u32 function, acpi_physical_address addr,
|
|||
u32 bits, acpi_integer *value,
|
||||
void *handler_context, void *region_context)
|
||||
{
|
||||
int ret;
|
||||
struct pcc_data *data = region_context;
|
||||
u64 usecs_lat;
|
||||
void __iomem *pcc_opregion;
|
||||
int ret;
|
||||
|
||||
pcc_opregion = data->pcc_chan->shmem + PCC_SIGNATURE_SIZE;
|
||||
|
||||
reinit_completion(&data->done);
|
||||
|
||||
/* Write to Shared Memory */
|
||||
memcpy_toio(data->pcc_chan->shmem, (void *)value, data->ctx.length);
|
||||
/* Write to the PCC OperationRegion after the shared memory signature. */
|
||||
memcpy_toio(pcc_opregion, (void *)value, data->ctx.length);
|
||||
|
||||
ret = mbox_send_message(data->pcc_chan->mchan, NULL);
|
||||
if (ret < 0)
|
||||
return AE_ERROR;
|
||||
|
||||
/*
|
||||
* pcc_chan->latency is just a Nominal value. In reality the remote
|
||||
* processor could be much slower to reply. So add an arbitrary
|
||||
* amount of wait on top of Nominal.
|
||||
*/
|
||||
usecs_lat = PCC_CMD_WAIT_RETRIES_NUM * data->pcc_chan->latency;
|
||||
ret = wait_for_completion_timeout(&data->done,
|
||||
usecs_to_jiffies(usecs_lat));
|
||||
msecs_to_jiffies(data->cl.tx_tout));
|
||||
if (ret == 0) {
|
||||
pr_err("PCC command executed timeout!\n");
|
||||
return AE_TIME;
|
||||
|
|
@ -125,7 +154,7 @@ acpi_pcc_address_space_handler(u32 function, acpi_physical_address addr,
|
|||
|
||||
mbox_chan_txdone(data->pcc_chan->mchan, ret);
|
||||
|
||||
memcpy_fromio(value, data->pcc_chan->shmem, data->ctx.length);
|
||||
memcpy_fromio(value, pcc_opregion, data->ctx.length);
|
||||
|
||||
return AE_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ int __init fix_pxm_node_maps(int max_nid)
|
|||
for (j = 0; j <= max_nid; j++) {
|
||||
if ((emu_nid_to_phys[j] == i) &&
|
||||
WARN(node_to_pxm_map_copy[j] != PXM_INVAL,
|
||||
"Node %d is already binded to PXM %d\n",
|
||||
"Node %d is already bound to PXM %d\n",
|
||||
j, node_to_pxm_map_copy[j]))
|
||||
return -1;
|
||||
if (emu_nid_to_phys[j] == i) {
|
||||
|
|
|
|||
|
|
@ -422,7 +422,7 @@ static int start_update(int action, struct pfru_device *pfru_dev)
|
|||
|
||||
static long pfru_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
struct pfru_update_cap_info cap_hdr;
|
||||
struct pfru_update_cap_info cap_hdr = {};
|
||||
struct pfru_device *pfru_dev = to_pfru_dev(file);
|
||||
void __user *p = (void __user *)arg;
|
||||
u32 rev;
|
||||
|
|
|
|||
|
|
@ -96,13 +96,13 @@ static int pnp_device_probe(struct device *dev)
|
|||
if (!(pnp_drv->flags & PNP_DRIVER_RES_DO_NOT_CHANGE)) {
|
||||
error = pnp_activate_dev(pnp_dev);
|
||||
if (error < 0)
|
||||
return error;
|
||||
goto fail;
|
||||
}
|
||||
} else if ((pnp_drv->flags & PNP_DRIVER_RES_DISABLE)
|
||||
== PNP_DRIVER_RES_DISABLE) {
|
||||
error = pnp_disable_dev(pnp_dev);
|
||||
if (error < 0)
|
||||
return error;
|
||||
goto fail;
|
||||
}
|
||||
error = 0;
|
||||
if (pnp_drv->probe) {
|
||||
|
|
|
|||
|
|
@ -434,7 +434,7 @@ extern acpi_handle ec_get_handle(void);
|
|||
|
||||
extern bool acpi_is_pnp_device(struct acpi_device *);
|
||||
|
||||
#if defined(CONFIG_ACPI_WMI) || defined(CONFIG_ACPI_WMI_MODULE)
|
||||
#if IS_ENABLED(CONFIG_ACPI_WMI)
|
||||
|
||||
typedef void (*wmi_notify_handler) (union acpi_object *data, void *context);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user