Merge branches 'acpi-glue', 'acpi-osl', 'acpi-processor' and 'acpi-cppc'

Merge general ACPI cleanups and processor support updates for 5.19-rc1:

 - Rearrange find_child_checks() to simplify code (Rafael Wysocki).

 - Use memremap() to map the UCSI mailbox that is always in main memory
   and drop acpi_release_memory() that has no more users (Heikki
   Krogerus, Dan Carpenter).

 - Make max_cstate/nocst/bm_check_disable processor module parameters
   visible in sysfs (Yajun Deng).

 - Fix typo in the CPPC driver (Julia Lawall).

* acpi-glue:
  ACPI: glue: Rearrange find_child_checks()

* acpi-osl:
  usb: typec: ucsi: acpi: fix a NULL vs IS_ERR() check in probe
  ACPI: OSL: Remove the helper for deactivating memory region
  usb: typec: ucsi: acpi: Map the mailbox with memremap()

* acpi-processor:
  ACPI: processor: idle: Expose max_cstate/nocst/bm_check_disable read-only in sysfs

* acpi-cppc:
  ACPI: CPPC: fix typo in comment
This commit is contained in:
Rafael J. Wysocki 2022-05-30 18:04:57 +02:00
6 changed files with 22 additions and 120 deletions

View file

@ -315,7 +315,7 @@ static int send_pcc_cmd(int pcc_ss_id, u16 cmd)
goto end;
}
/* wait for completion and check for PCC errro bit */
/* wait for completion and check for PCC error bit */
ret = check_pcc_chan(pcc_ss_id, true);
if (pcc_ss_data->pcc_mrtt)

View file

@ -79,17 +79,17 @@ static struct acpi_bus_type *acpi_get_bus_type(struct device *dev)
static int find_child_checks(struct acpi_device *adev, bool check_children)
{
bool sta_present = true;
unsigned long long sta;
acpi_status status;
status = acpi_evaluate_integer(adev->handle, "_STA", NULL, &sta);
if (status == AE_NOT_FOUND)
sta_present = false;
else if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_ENABLED))
if (check_children && list_empty(&adev->children))
return -ENODEV;
if (check_children && list_empty(&adev->children))
status = acpi_evaluate_integer(adev->handle, "_STA", NULL, &sta);
if (status == AE_NOT_FOUND)
return FIND_CHILD_MIN_SCORE;
if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_ENABLED))
return -ENODEV;
/*
@ -99,8 +99,10 @@ static int find_child_checks(struct acpi_device *adev, bool check_children)
* matched going forward. [This means a second spec violation in a row,
* so whatever we do here is best effort anyway.]
*/
return sta_present && !adev->pnp.type.platform_id ?
FIND_CHILD_MAX_SCORE : FIND_CHILD_MIN_SCORE;
if (adev->pnp.type.platform_id)
return FIND_CHILD_MIN_SCORE;
return FIND_CHILD_MAX_SCORE;
}
struct acpi_device *acpi_find_child_device(struct acpi_device *parent,

View file

@ -36,7 +36,6 @@
#include <linux/io-64-nonatomic-lo-hi.h>
#include "acpica/accommon.h"
#include "acpica/acnamesp.h"
#include "internal.h"
/* Definitions for ACPI_DEBUG_PRINT() */
@ -1496,91 +1495,6 @@ int acpi_check_region(resource_size_t start, resource_size_t n,
}
EXPORT_SYMBOL(acpi_check_region);
static acpi_status acpi_deactivate_mem_region(acpi_handle handle, u32 level,
void *_res, void **return_value)
{
struct acpi_mem_space_context **mem_ctx;
union acpi_operand_object *handler_obj;
union acpi_operand_object *region_obj2;
union acpi_operand_object *region_obj;
struct resource *res = _res;
acpi_status status;
region_obj = acpi_ns_get_attached_object(handle);
if (!region_obj)
return AE_OK;
handler_obj = region_obj->region.handler;
if (!handler_obj)
return AE_OK;
if (region_obj->region.space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY)
return AE_OK;
if (!(region_obj->region.flags & AOPOBJ_SETUP_COMPLETE))
return AE_OK;
region_obj2 = acpi_ns_get_secondary_object(region_obj);
if (!region_obj2)
return AE_OK;
mem_ctx = (void *)&region_obj2->extra.region_context;
if (!(mem_ctx[0]->address >= res->start &&
mem_ctx[0]->address < res->end))
return AE_OK;
status = handler_obj->address_space.setup(region_obj,
ACPI_REGION_DEACTIVATE,
NULL, (void **)mem_ctx);
if (ACPI_SUCCESS(status))
region_obj->region.flags &= ~(AOPOBJ_SETUP_COMPLETE);
return status;
}
/**
* acpi_release_memory - Release any mappings done to a memory region
* @handle: Handle to namespace node
* @res: Memory resource
* @level: A level that terminates the search
*
* Walks through @handle and unmaps all SystemMemory Operation Regions that
* overlap with @res and that have already been activated (mapped).
*
* This is a helper that allows drivers to place special requirements on memory
* region that may overlap with operation regions, primarily allowing them to
* safely map the region as non-cached memory.
*
* The unmapped Operation Regions will be automatically remapped next time they
* are called, so the drivers do not need to do anything else.
*/
acpi_status acpi_release_memory(acpi_handle handle, struct resource *res,
u32 level)
{
acpi_status status;
if (!(res->flags & IORESOURCE_MEM))
return AE_TYPE;
status = acpi_walk_namespace(ACPI_TYPE_REGION, handle, level,
acpi_deactivate_mem_region, NULL,
res, NULL);
if (ACPI_FAILURE(status))
return status;
/*
* Wait for all of the mappings queued up for removal by
* acpi_deactivate_mem_region() to actually go away.
*/
synchronize_rcu();
rcu_barrier();
flush_scheduled_work();
return AE_OK;
}
EXPORT_SYMBOL_GPL(acpi_release_memory);
/*
* Let drivers know whether the resource checks are effective
*/

View file

@ -38,11 +38,11 @@
#define ACPI_IDLE_STATE_START (IS_ENABLED(CONFIG_ARCH_HAS_CPU_RELAX) ? 1 : 0)
static unsigned int max_cstate __read_mostly = ACPI_PROCESSOR_MAX_POWER;
module_param(max_cstate, uint, 0000);
static unsigned int nocst __read_mostly;
module_param(nocst, uint, 0000);
static int bm_check_disable __read_mostly;
module_param(bm_check_disable, uint, 0000);
module_param(max_cstate, uint, 0400);
static bool nocst __read_mostly;
module_param(nocst, bool, 0400);
static bool bm_check_disable __read_mostly;
module_param(bm_check_disable, bool, 0400);
static unsigned int latency_factor __read_mostly = 2;
module_param(latency_factor, uint, 0644);

View file

@ -19,7 +19,7 @@
struct ucsi_acpi {
struct device *dev;
struct ucsi *ucsi;
void __iomem *base;
void *base;
struct completion complete;
unsigned long flags;
guid_t guid;
@ -51,7 +51,7 @@ static int ucsi_acpi_read(struct ucsi *ucsi, unsigned int offset,
if (ret)
return ret;
memcpy(val, (const void __force *)(ua->base + offset), val_len);
memcpy(val, ua->base + offset, val_len);
return 0;
}
@ -61,7 +61,7 @@ static int ucsi_acpi_async_write(struct ucsi *ucsi, unsigned int offset,
{
struct ucsi_acpi *ua = ucsi_get_drvdata(ucsi);
memcpy((void __force *)(ua->base + offset), val, val_len);
memcpy(ua->base + offset, val, val_len);
return ucsi_acpi_dsm(ua, UCSI_DSM_FUNC_WRITE);
}
@ -132,20 +132,9 @@ static int ucsi_acpi_probe(struct platform_device *pdev)
return -ENODEV;
}
/* This will make sure we can use ioremap() */
status = acpi_release_memory(ACPI_HANDLE(&pdev->dev), res, 1);
if (ACPI_FAILURE(status))
return -ENOMEM;
/*
* NOTE: The memory region for the data structures is used also in an
* operation region, which means ACPI has already reserved it. Therefore
* it can not be requested here, and we can not use
* devm_ioremap_resource().
*/
ua->base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
if (!ua->base)
return -ENOMEM;
ua->base = devm_memremap(&pdev->dev, res->start, resource_size(res), MEMREMAP_WB);
if (IS_ERR(ua->base))
return PTR_ERR(ua->base);
ret = guid_parse(UCSI_DSM_UUID, &ua->guid);
if (ret)

View file

@ -520,9 +520,6 @@ int acpi_check_resource_conflict(const struct resource *res);
int acpi_check_region(resource_size_t start, resource_size_t n,
const char *name);
acpi_status acpi_release_memory(acpi_handle handle, struct resource *res,
u32 level);
int acpi_resources_are_enforced(void);
#ifdef CONFIG_HIBERNATION