Skip to content

Commit e1dab4c

Browse files
committed
Merge tag 'acpi-5.14-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI fixes from Rafael Wysocki: "These revert a recent IRQ resources handling modification that turned out to be problematic, fix suspend-to-idle handling on AMD platforms to take upcoming systems into account properly and fix the retrieval of the DPTF attributes of the PCH FIVR. Specifics: - Revert recent change of the ACPI IRQ resources handling that attempted to improve the ACPI IRQ override selection logic, but introduced serious regressions on some systems (Hui Wang). - Fix up quirks for AMD platforms in the suspend-to-idle support code so as to take upcoming systems using uPEP HID AMDI007 into account as appropriate (Mario Limonciello). - Fix the code retrieving DPTF attributes of the PCH FIVR so that it agrees on the return data type with the ACPI control method evaluated for this purpose (Srinivas Pandruvada)" * tag 'acpi-5.14-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: ACPI: DPTF: Fix reading of attributes Revert "ACPI: resources: Add checks for ACPI IRQ override" ACPI: PM: Add support for upcoming AMD uPEP HID AMDI007
2 parents 3a34b13 + e83f54e commit e1dab4c

File tree

3 files changed

+52
-18
lines changed

3 files changed

+52
-18
lines changed

drivers/acpi/dptf/dptf_pch_fivr.c

+43-8
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,42 @@
99
#include <linux/module.h>
1010
#include <linux/platform_device.h>
1111

12+
struct pch_fivr_resp {
13+
u64 status;
14+
u64 result;
15+
};
16+
17+
static int pch_fivr_read(acpi_handle handle, char *method, struct pch_fivr_resp *fivr_resp)
18+
{
19+
struct acpi_buffer resp = { sizeof(struct pch_fivr_resp), fivr_resp};
20+
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
21+
struct acpi_buffer format = { sizeof("NN"), "NN" };
22+
union acpi_object *obj;
23+
acpi_status status;
24+
int ret = -EFAULT;
25+
26+
status = acpi_evaluate_object(handle, method, NULL, &buffer);
27+
if (ACPI_FAILURE(status))
28+
return ret;
29+
30+
obj = buffer.pointer;
31+
if (!obj || obj->type != ACPI_TYPE_PACKAGE)
32+
goto release_buffer;
33+
34+
status = acpi_extract_package(obj, &format, &resp);
35+
if (ACPI_FAILURE(status))
36+
goto release_buffer;
37+
38+
if (fivr_resp->status)
39+
goto release_buffer;
40+
41+
ret = 0;
42+
43+
release_buffer:
44+
kfree(buffer.pointer);
45+
return ret;
46+
}
47+
1248
/*
1349
* Presentation of attributes which are defined for INT1045
1450
* They are:
@@ -23,15 +59,14 @@ static ssize_t name##_show(struct device *dev,\
2359
char *buf)\
2460
{\
2561
struct acpi_device *acpi_dev = dev_get_drvdata(dev);\
26-
unsigned long long val;\
27-
acpi_status status;\
62+
struct pch_fivr_resp fivr_resp;\
63+
int status;\
2864
\
29-
status = acpi_evaluate_integer(acpi_dev->handle, #method,\
30-
NULL, &val);\
31-
if (ACPI_SUCCESS(status))\
32-
return sprintf(buf, "%d\n", (int)val);\
33-
else\
34-
return -EINVAL;\
65+
status = pch_fivr_read(acpi_dev->handle, #method, &fivr_resp);\
66+
if (status)\
67+
return status;\
68+
\
69+
return sprintf(buf, "%llu\n", fivr_resp.result);\
3570
}
3671

3772
#define PCH_FIVR_STORE(name, method) \

drivers/acpi/resource.c

+1-8
Original file line numberDiff line numberDiff line change
@@ -423,13 +423,6 @@ static void acpi_dev_get_irqresource(struct resource *res, u32 gsi,
423423
}
424424
}
425425

426-
static bool irq_is_legacy(struct acpi_resource_irq *irq)
427-
{
428-
return irq->triggering == ACPI_EDGE_SENSITIVE &&
429-
irq->polarity == ACPI_ACTIVE_HIGH &&
430-
irq->shareable == ACPI_EXCLUSIVE;
431-
}
432-
433426
/**
434427
* acpi_dev_resource_interrupt - Extract ACPI interrupt resource information.
435428
* @ares: Input ACPI resource object.
@@ -468,7 +461,7 @@ bool acpi_dev_resource_interrupt(struct acpi_resource *ares, int index,
468461
}
469462
acpi_dev_get_irqresource(res, irq->interrupts[index],
470463
irq->triggering, irq->polarity,
471-
irq->shareable, irq_is_legacy(irq));
464+
irq->shareable, true);
472465
break;
473466
case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
474467
ext_irq = &ares->data.extended_irq;

drivers/acpi/x86/s2idle.c

+8-2
Original file line numberDiff line numberDiff line change
@@ -378,19 +378,25 @@ static int lps0_device_attach(struct acpi_device *adev,
378378
* AMDI0006:
379379
* - should use rev_id 0x0
380380
* - function mask = 0x3: Should use Microsoft method
381+
* AMDI0007:
382+
* - Should use rev_id 0x2
383+
* - Should only use AMD method
381384
*/
382385
const char *hid = acpi_device_hid(adev);
383-
rev_id = 0;
386+
rev_id = strcmp(hid, "AMDI0007") ? 0 : 2;
384387
lps0_dsm_func_mask = validate_dsm(adev->handle,
385388
ACPI_LPS0_DSM_UUID_AMD, rev_id, &lps0_dsm_guid);
386389
lps0_dsm_func_mask_microsoft = validate_dsm(adev->handle,
387-
ACPI_LPS0_DSM_UUID_MICROSOFT, rev_id,
390+
ACPI_LPS0_DSM_UUID_MICROSOFT, 0,
388391
&lps0_dsm_guid_microsoft);
389392
if (lps0_dsm_func_mask > 0x3 && (!strcmp(hid, "AMD0004") ||
390393
!strcmp(hid, "AMDI0005"))) {
391394
lps0_dsm_func_mask = (lps0_dsm_func_mask << 1) | 0x1;
392395
acpi_handle_debug(adev->handle, "_DSM UUID %s: Adjusted function mask: 0x%x\n",
393396
ACPI_LPS0_DSM_UUID_AMD, lps0_dsm_func_mask);
397+
} else if (lps0_dsm_func_mask_microsoft > 0 && !strcmp(hid, "AMDI0007")) {
398+
lps0_dsm_func_mask_microsoft = -EINVAL;
399+
acpi_handle_debug(adev->handle, "_DSM Using AMD method\n");
394400
}
395401
} else {
396402
rev_id = 1;

0 commit comments

Comments
 (0)