Skip to content

Commit e996c7e

Browse files
committed
Merge branches 'acpi-properties', 'acpi-tables', 'acpi-x86' and 'acpi-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
5 parents c77f54a + a1cf1fd + 5621635 + 018d671 + 6cc401b commit e996c7e

File tree

5 files changed

+74
-38
lines changed

5 files changed

+74
-38
lines changed

drivers/acpi/acpi_fpdt.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,23 @@ static const struct attribute_group boot_attr_group = {
143143

144144
static struct kobject *fpdt_kobj;
145145

146+
#if defined CONFIG_X86 && defined CONFIG_PHYS_ADDR_T_64BIT
147+
#include <linux/processor.h>
148+
static bool fpdt_address_valid(u64 address)
149+
{
150+
/*
151+
* On some systems the table contains invalid addresses
152+
* with unsuppored high address bits set, check for this.
153+
*/
154+
return !(address >> boot_cpu_data.x86_phys_bits);
155+
}
156+
#else
157+
static bool fpdt_address_valid(u64 address)
158+
{
159+
return true;
160+
}
161+
#endif
162+
146163
static int fpdt_process_subtable(u64 address, u32 subtable_type)
147164
{
148165
struct fpdt_subtable_header *subtable_header;
@@ -151,6 +168,11 @@ static int fpdt_process_subtable(u64 address, u32 subtable_type)
151168
u32 length, offset;
152169
int result;
153170

171+
if (!fpdt_address_valid(address)) {
172+
pr_info(FW_BUG "invalid physical address: 0x%llx!\n", address);
173+
return -EINVAL;
174+
}
175+
154176
subtable_header = acpi_os_map_memory(address, sizeof(*subtable_header));
155177
if (!subtable_header)
156178
return -ENOMEM;

drivers/acpi/acpi_lpss.c

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -656,25 +656,21 @@ static int acpi_lpss_create_device(struct acpi_device *adev,
656656
if (ret < 0)
657657
goto err_out;
658658

659-
list_for_each_entry(rentry, &resource_list, node)
660-
if (resource_type(rentry->res) == IORESOURCE_MEM) {
661-
if (dev_desc->prv_size_override)
662-
pdata->mmio_size = dev_desc->prv_size_override;
663-
else
664-
pdata->mmio_size = resource_size(rentry->res);
665-
pdata->mmio_base = ioremap(rentry->res->start,
666-
pdata->mmio_size);
667-
break;
668-
}
659+
rentry = list_first_entry_or_null(&resource_list, struct resource_entry, node);
660+
if (rentry) {
661+
if (dev_desc->prv_size_override)
662+
pdata->mmio_size = dev_desc->prv_size_override;
663+
else
664+
pdata->mmio_size = resource_size(rentry->res);
665+
pdata->mmio_base = ioremap(rentry->res->start, pdata->mmio_size);
666+
}
669667

670668
acpi_dev_free_resource_list(&resource_list);
671669

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

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

686682
if (dev_desc->flags & LPSS_CLK) {
687683
ret = register_device_clock(adev, pdata);
688-
if (ret) {
689-
/* Skip the device, but continue the namespace scan. */
690-
ret = 0;
691-
goto err_out;
692-
}
684+
if (ret)
685+
goto out_free;
693686
}
694687

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

702695
adev->driver_data = pdata;
703696
pdev = acpi_create_platform_device(adev, dev_desc->properties);
704-
if (!IS_ERR_OR_NULL(pdev)) {
705-
acpi_lpss_create_device_links(adev, pdev);
706-
return 1;
697+
if (IS_ERR_OR_NULL(pdev)) {
698+
adev->driver_data = NULL;
699+
ret = PTR_ERR(pdev);
700+
goto err_out;
707701
}
708702

709-
ret = PTR_ERR(pdev);
710-
adev->driver_data = NULL;
703+
acpi_lpss_create_device_links(adev, pdev);
704+
return 1;
711705

712-
err_out:
706+
out_free:
707+
/* Skip the device, but continue the namespace scan */
708+
ret = 0;
709+
err_out:
713710
kfree(pdata);
714711
return ret;
715712
}

drivers/acpi/numa/hmat.c

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
*/
1010

1111
#define pr_fmt(fmt) "acpi/hmat: " fmt
12-
#define dev_fmt(fmt) "acpi/hmat: " fmt
1312

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

304303
if (hmat_loc->header.length < sizeof(*hmat_loc)) {
305-
pr_notice("HMAT: Unexpected locality header length: %u\n",
304+
pr_notice("Unexpected locality header length: %u\n",
306305
hmat_loc->header.length);
307306
return -EINVAL;
308307
}
@@ -314,12 +313,12 @@ static __init int hmat_parse_locality(union acpi_subtable_headers *header,
314313
total_size = sizeof(*hmat_loc) + sizeof(*entries) * ipds * tpds +
315314
sizeof(*inits) * ipds + sizeof(*targs) * tpds;
316315
if (hmat_loc->header.length < total_size) {
317-
pr_notice("HMAT: Unexpected locality header length:%u, minimum required:%u\n",
316+
pr_notice("Unexpected locality header length:%u, minimum required:%u\n",
318317
hmat_loc->header.length, total_size);
319318
return -EINVAL;
320319
}
321320

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

@@ -363,13 +362,13 @@ static __init int hmat_parse_cache(union acpi_subtable_headers *header,
363362
u32 attrs;
364363

365364
if (cache->header.length < sizeof(*cache)) {
366-
pr_notice("HMAT: Unexpected cache header length: %u\n",
365+
pr_notice("Unexpected cache header length: %u\n",
367366
cache->header.length);
368367
return -EINVAL;
369368
}
370369

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

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

426425
if (p->header.length != sizeof(*p)) {
427-
pr_notice("HMAT: Unexpected address range header length: %u\n",
426+
pr_notice("Unexpected address range header length: %u\n",
428427
p->header.length);
429428
return -EINVAL;
430429
}
431430

432431
if (hmat_revision == 1)
433-
pr_info("HMAT: Memory (%#llx length %#llx) Flags:%04x Processor Domain:%u Memory Domain:%u\n",
432+
pr_info("Memory (%#llx length %#llx) Flags:%04x Processor Domain:%u Memory Domain:%u\n",
434433
p->reserved3, p->reserved4, p->flags, p->processor_PD,
435434
p->memory_PD);
436435
else
437-
pr_info("HMAT: Memory Flags:%04x Processor Domain:%u Memory Domain:%u\n",
436+
pr_info("Memory Flags:%04x Processor Domain:%u Memory Domain:%u\n",
438437
p->flags, p->processor_PD, p->memory_PD);
439438

440439
if ((hmat_revision == 1 && p->flags & ACPI_HMAT_MEMORY_PD_VALID) ||
441440
hmat_revision > 1) {
442441
target = find_mem_target(p->memory_PD);
443442
if (!target) {
444-
pr_debug("HMAT: Memory Domain missing from SRAT\n");
443+
pr_debug("Memory Domain missing from SRAT\n");
445444
return -EINVAL;
446445
}
447446
}
448447
if (target && p->flags & ACPI_HMAT_PROCESSOR_PD_VALID) {
449448
int p_node = pxm_to_node(p->processor_PD);
450449

451450
if (p_node == NUMA_NO_NODE) {
452-
pr_debug("HMAT: Invalid Processor Domain\n");
451+
pr_debug("Invalid Processor Domain\n");
453452
return -EINVAL;
454453
}
455454
target->processor_pxm = p->processor_PD;
@@ -840,15 +839,15 @@ static __init int hmat_init(void)
840839
case 2:
841840
break;
842841
default:
843-
pr_notice("Ignoring HMAT: Unknown revision:%d\n", hmat_revision);
842+
pr_notice("Ignoring: Unknown revision:%d\n", hmat_revision);
844843
goto out_put;
845844
}
846845

847846
for (i = ACPI_HMAT_TYPE_PROXIMITY; i < ACPI_HMAT_TYPE_RESERVED; i++) {
848847
if (acpi_table_parse_entries(ACPI_SIG_HMAT,
849848
sizeof(struct acpi_table_hmat), i,
850849
hmat_parse_subtable, 0) < 0) {
851-
pr_notice("Ignoring HMAT: Invalid table");
850+
pr_notice("Ignoring: Invalid table");
852851
goto out_put;
853852
}
854853
}

drivers/acpi/x86/apple.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <linux/bitmap.h>
99
#include <linux/platform_data/x86/apple.h>
1010
#include <linux/uuid.h>
11+
#include "../internal.h"
1112

1213
/* Apple _DSM device properties GUID */
1314
static const guid_t apple_prp_guid =

drivers/acpi/x86/utils.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,26 @@ static const struct x86_cpu_id storage_d3_cpu_ids[] = {
207207
{}
208208
};
209209

210+
static const struct dmi_system_id force_storage_d3_dmi[] = {
211+
{
212+
/*
213+
* _ADR is ambiguous between GPP1.DEV0 and GPP1.NVME
214+
* but .NVME is needed to get StorageD3Enable node
215+
* https://bugzilla.kernel.org/show_bug.cgi?id=216440
216+
*/
217+
.matches = {
218+
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
219+
DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 14 7425 2-in-1"),
220+
}
221+
},
222+
{}
223+
};
224+
210225
bool force_storage_d3(void)
211226
{
212-
return x86_match_cpu(storage_d3_cpu_ids);
227+
const struct dmi_system_id *dmi_id = dmi_first_match(force_storage_d3_dmi);
228+
229+
return dmi_id || x86_match_cpu(storage_d3_cpu_ids);
213230
}
214231

215232
/*

0 commit comments

Comments
 (0)