Skip to content

Commit

Permalink
Merge branches 'acpi-properties', 'acpi-tables', 'acpi-x86' and 'acpi…
Browse files Browse the repository at this point in the history
…-soc'

Merge changes related to ACPI data-only tables handling and ACPI device
properties management, x86-specific ACPI code changes and ACPI SoC driver
changes for 6.1-rc1:

 - Clean up the ACPI LPSS (Intel SoC) driver (Andy Shevchenko).

 - Add a quirk for Dell Inspiron 14 2-in-1 for StorageD3Enable (Mario
   Limonciello).

 - Drop unused dev_fmt() and redundant 'HMAT' prefix from the HMAT
  parsing code (Liu Shixin).

 - Make ACPI FPDT parsing code avoid calling acpi_os_map_memory() on
   invalid physical addresses (Hans de Goede).

 - Silence missing-declarations warning related to Apple device
   properties management (Lukas Wunner).

* acpi-properties:
  ACPI: property: Silence missing-declarations warning in apple.c

* acpi-tables:
  ACPI: HMAT: Drop unused dev_fmt() and redundant 'HMAT' prefix
  ACPI: tables: FPDT: Don't call acpi_os_map_memory() on invalid phys address

* acpi-x86:
  ACPI: x86: Add a quirk for Dell Inspiron 14 2-in-1 for StorageD3Enable

* acpi-soc:
  ACPI: LPSS: Deduplicate skipping device in acpi_lpss_create_device()
  ACPI: LPSS: Replace loop with first entry retrieval
  • Loading branch information
Rafael J. Wysocki committed Sep 30, 2022
5 parents c77f54a + a1cf1fd + 5621635 + 018d671 + 6cc401b commit e996c7e
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 38 deletions.
22 changes: 22 additions & 0 deletions drivers/acpi/acpi_fpdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,23 @@ static const struct attribute_group boot_attr_group = {

static struct kobject *fpdt_kobj;

#if defined CONFIG_X86 && defined CONFIG_PHYS_ADDR_T_64BIT
#include <linux/processor.h>
static bool fpdt_address_valid(u64 address)
{
/*
* On some systems the table contains invalid addresses
* with unsuppored high address bits set, check for this.
*/
return !(address >> boot_cpu_data.x86_phys_bits);
}
#else
static bool fpdt_address_valid(u64 address)
{
return true;
}
#endif

static int fpdt_process_subtable(u64 address, u32 subtable_type)
{
struct fpdt_subtable_header *subtable_header;
Expand All @@ -151,6 +168,11 @@ static int fpdt_process_subtable(u64 address, u32 subtable_type)
u32 length, offset;
int result;

if (!fpdt_address_valid(address)) {
pr_info(FW_BUG "invalid physical address: 0x%llx!\n", address);
return -EINVAL;
}

subtable_header = acpi_os_map_memory(address, sizeof(*subtable_header));
if (!subtable_header)
return -ENOMEM;
Expand Down
45 changes: 21 additions & 24 deletions drivers/acpi/acpi_lpss.c
Original file line number Diff line number Diff line change
Expand Up @@ -656,25 +656,21 @@ static int acpi_lpss_create_device(struct acpi_device *adev,
if (ret < 0)
goto err_out;

list_for_each_entry(rentry, &resource_list, node)
if (resource_type(rentry->res) == IORESOURCE_MEM) {
if (dev_desc->prv_size_override)
pdata->mmio_size = dev_desc->prv_size_override;
else
pdata->mmio_size = resource_size(rentry->res);
pdata->mmio_base = ioremap(rentry->res->start,
pdata->mmio_size);
break;
}
rentry = list_first_entry_or_null(&resource_list, struct resource_entry, node);
if (rentry) {
if (dev_desc->prv_size_override)
pdata->mmio_size = dev_desc->prv_size_override;
else
pdata->mmio_size = resource_size(rentry->res);
pdata->mmio_base = ioremap(rentry->res->start, pdata->mmio_size);
}

acpi_dev_free_resource_list(&resource_list);

if (!pdata->mmio_base) {
/* Avoid acpi_bus_attach() instantiating a pdev for this dev. */
adev->pnp.type.platform_id = 0;
/* Skip the device, but continue the namespace scan. */
ret = 0;
goto err_out;
goto out_free;
}

pdata->adev = adev;
Expand All @@ -685,11 +681,8 @@ static int acpi_lpss_create_device(struct acpi_device *adev,

if (dev_desc->flags & LPSS_CLK) {
ret = register_device_clock(adev, pdata);
if (ret) {
/* Skip the device, but continue the namespace scan. */
ret = 0;
goto err_out;
}
if (ret)
goto out_free;
}

/*
Expand All @@ -701,15 +694,19 @@ static int acpi_lpss_create_device(struct acpi_device *adev,

adev->driver_data = pdata;
pdev = acpi_create_platform_device(adev, dev_desc->properties);
if (!IS_ERR_OR_NULL(pdev)) {
acpi_lpss_create_device_links(adev, pdev);
return 1;
if (IS_ERR_OR_NULL(pdev)) {
adev->driver_data = NULL;
ret = PTR_ERR(pdev);
goto err_out;
}

ret = PTR_ERR(pdev);
adev->driver_data = NULL;
acpi_lpss_create_device_links(adev, pdev);
return 1;

err_out:
out_free:
/* Skip the device, but continue the namespace scan */
ret = 0;
err_out:
kfree(pdata);
return ret;
}
Expand Down
25 changes: 12 additions & 13 deletions drivers/acpi/numa/hmat.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
*/

#define pr_fmt(fmt) "acpi/hmat: " fmt
#define dev_fmt(fmt) "acpi/hmat: " fmt

#include <linux/acpi.h>
#include <linux/bitops.h>
Expand Down Expand Up @@ -302,7 +301,7 @@ static __init int hmat_parse_locality(union acpi_subtable_headers *header,
u8 type, mem_hier;

if (hmat_loc->header.length < sizeof(*hmat_loc)) {
pr_notice("HMAT: Unexpected locality header length: %u\n",
pr_notice("Unexpected locality header length: %u\n",
hmat_loc->header.length);
return -EINVAL;
}
Expand All @@ -314,12 +313,12 @@ static __init int hmat_parse_locality(union acpi_subtable_headers *header,
total_size = sizeof(*hmat_loc) + sizeof(*entries) * ipds * tpds +
sizeof(*inits) * ipds + sizeof(*targs) * tpds;
if (hmat_loc->header.length < total_size) {
pr_notice("HMAT: Unexpected locality header length:%u, minimum required:%u\n",
pr_notice("Unexpected locality header length:%u, minimum required:%u\n",
hmat_loc->header.length, total_size);
return -EINVAL;
}

pr_info("HMAT: Locality: Flags:%02x Type:%s Initiator Domains:%u Target Domains:%u Base:%lld\n",
pr_info("Locality: Flags:%02x Type:%s Initiator Domains:%u Target Domains:%u Base:%lld\n",
hmat_loc->flags, hmat_data_type(type), ipds, tpds,
hmat_loc->entry_base_unit);

Expand Down Expand Up @@ -363,13 +362,13 @@ static __init int hmat_parse_cache(union acpi_subtable_headers *header,
u32 attrs;

if (cache->header.length < sizeof(*cache)) {
pr_notice("HMAT: Unexpected cache header length: %u\n",
pr_notice("Unexpected cache header length: %u\n",
cache->header.length);
return -EINVAL;
}

attrs = cache->cache_attributes;
pr_info("HMAT: Cache: Domain:%u Size:%llu Attrs:%08x SMBIOS Handles:%d\n",
pr_info("Cache: Domain:%u Size:%llu Attrs:%08x SMBIOS Handles:%d\n",
cache->memory_PD, cache->cache_size, attrs,
cache->number_of_SMBIOShandles);

Expand Down Expand Up @@ -424,32 +423,32 @@ static int __init hmat_parse_proximity_domain(union acpi_subtable_headers *heade
struct memory_target *target = NULL;

if (p->header.length != sizeof(*p)) {
pr_notice("HMAT: Unexpected address range header length: %u\n",
pr_notice("Unexpected address range header length: %u\n",
p->header.length);
return -EINVAL;
}

if (hmat_revision == 1)
pr_info("HMAT: Memory (%#llx length %#llx) Flags:%04x Processor Domain:%u Memory Domain:%u\n",
pr_info("Memory (%#llx length %#llx) Flags:%04x Processor Domain:%u Memory Domain:%u\n",
p->reserved3, p->reserved4, p->flags, p->processor_PD,
p->memory_PD);
else
pr_info("HMAT: Memory Flags:%04x Processor Domain:%u Memory Domain:%u\n",
pr_info("Memory Flags:%04x Processor Domain:%u Memory Domain:%u\n",
p->flags, p->processor_PD, p->memory_PD);

if ((hmat_revision == 1 && p->flags & ACPI_HMAT_MEMORY_PD_VALID) ||
hmat_revision > 1) {
target = find_mem_target(p->memory_PD);
if (!target) {
pr_debug("HMAT: Memory Domain missing from SRAT\n");
pr_debug("Memory Domain missing from SRAT\n");
return -EINVAL;
}
}
if (target && p->flags & ACPI_HMAT_PROCESSOR_PD_VALID) {
int p_node = pxm_to_node(p->processor_PD);

if (p_node == NUMA_NO_NODE) {
pr_debug("HMAT: Invalid Processor Domain\n");
pr_debug("Invalid Processor Domain\n");
return -EINVAL;
}
target->processor_pxm = p->processor_PD;
Expand Down Expand Up @@ -840,15 +839,15 @@ static __init int hmat_init(void)
case 2:
break;
default:
pr_notice("Ignoring HMAT: Unknown revision:%d\n", hmat_revision);
pr_notice("Ignoring: Unknown revision:%d\n", hmat_revision);
goto out_put;
}

for (i = ACPI_HMAT_TYPE_PROXIMITY; i < ACPI_HMAT_TYPE_RESERVED; i++) {
if (acpi_table_parse_entries(ACPI_SIG_HMAT,
sizeof(struct acpi_table_hmat), i,
hmat_parse_subtable, 0) < 0) {
pr_notice("Ignoring HMAT: Invalid table");
pr_notice("Ignoring: Invalid table");
goto out_put;
}
}
Expand Down
1 change: 1 addition & 0 deletions drivers/acpi/x86/apple.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <linux/bitmap.h>
#include <linux/platform_data/x86/apple.h>
#include <linux/uuid.h>
#include "../internal.h"

/* Apple _DSM device properties GUID */
static const guid_t apple_prp_guid =
Expand Down
19 changes: 18 additions & 1 deletion drivers/acpi/x86/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,26 @@ static const struct x86_cpu_id storage_d3_cpu_ids[] = {
{}
};

static const struct dmi_system_id force_storage_d3_dmi[] = {
{
/*
* _ADR is ambiguous between GPP1.DEV0 and GPP1.NVME
* but .NVME is needed to get StorageD3Enable node
* https://bugzilla.kernel.org/show_bug.cgi?id=216440
*/
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 14 7425 2-in-1"),
}
},
{}
};

bool force_storage_d3(void)
{
return x86_match_cpu(storage_d3_cpu_ids);
const struct dmi_system_id *dmi_id = dmi_first_match(force_storage_d3_dmi);

return dmi_id || x86_match_cpu(storage_d3_cpu_ids);
}

/*
Expand Down

0 comments on commit e996c7e

Please sign in to comment.