Skip to content

Commit 5db9ce2

Browse files
committed
Merge branches 'acpi-apei', 'acpi-dptf', 'acpi-x86' and 'acpi-docs'
Merge APEI material, changes related to DPTF, ACPI-related x86 cleanup and documentation improvement for 5.19-rc1: - Fix missing ERST record ID in the APEI code (Liu Xinpeng). - Make APEI error injection to refuse to inject into the zero page (Tony Luck). - Correct description of INT3407 / INT3532 DPTF attributes in sysfs (Sumeet Pawnikar). - Add support for high frequency impedance notification to the DPTF driver (Sumeet Pawnikar). - Make mp_config_acpi_gsi() a void function (Li kunyu). - Unify Package () representation for properties in the ACPI device properties documentation (Andy Shevchenko). * acpi-apei: ACPI, APEI, EINJ: Refuse to inject into the zero page ACPI: APEI: Fix missing ERST record id * acpi-dptf: ACPI: DPTF: Add support for high frequency impedance notification ACPI: DPTF: Correct description of INT3407 / INT3532 attributes * acpi-x86: x86: ACPI: Make mp_config_acpi_gsi() a void function * acpi-docs: ACPI: docs: enumeration: Unify Package () for properties (part 2)
5 parents 4aa8c70 + ab59c89 + 42e5ed0 + 24773e6 + e802ca7 commit 5db9ce2

File tree

8 files changed

+90
-22
lines changed

8 files changed

+90
-22
lines changed

Documentation/firmware-guide/acpi/enumeration.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,7 @@ The table below shows an example of its usage::
167167
Name (_DSD, Package () {
168168
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
169169
Package () {
170-
Package () {"interrupt-names",
171-
Package (2) {"default", "alert"}},
170+
Package () { "interrupt-names", Package () { "default", "alert" } },
172171
}
173172
...
174173
})

arch/x86/kernel/acpi/boot.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ static void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger,
375375
isa_irq_to_gsi[bus_irq] = gsi;
376376
}
377377

378-
static int mp_config_acpi_gsi(struct device *dev, u32 gsi, int trigger,
378+
static void mp_config_acpi_gsi(struct device *dev, u32 gsi, int trigger,
379379
int polarity)
380380
{
381381
#ifdef CONFIG_X86_MPPARSE
@@ -387,9 +387,9 @@ static int mp_config_acpi_gsi(struct device *dev, u32 gsi, int trigger,
387387
u8 pin;
388388

389389
if (!acpi_ioapic)
390-
return 0;
390+
return;
391391
if (!dev || !dev_is_pci(dev))
392-
return 0;
392+
return;
393393

394394
pdev = to_pci_dev(dev);
395395
number = pdev->bus->number;
@@ -408,7 +408,6 @@ static int mp_config_acpi_gsi(struct device *dev, u32 gsi, int trigger,
408408

409409
mp_save_irq(&mp_irq);
410410
#endif
411-
return 0;
412411
}
413412

414413
static int __init mp_register_ioapic_irq(u8 bus_irq, u8 polarity,

arch/x86/kernel/cpu/mce/apei.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,16 +177,14 @@ ssize_t apei_read_mce(struct mce *m, u64 *record_id)
177177
/* no more record */
178178
if (*record_id == APEI_ERST_INVALID_RECORD_ID)
179179
goto out;
180-
rc = erst_read(*record_id, &rcd.hdr, sizeof(rcd));
180+
rc = erst_read_record(*record_id, &rcd.hdr, sizeof(rcd), sizeof(rcd),
181+
&CPER_CREATOR_MCE);
181182
/* someone else has cleared the record, try next one */
182183
if (rc == -ENOENT)
183184
goto retry;
184185
else if (rc < 0)
185186
goto out;
186-
/* try to skip other type records in storage */
187-
else if (rc != sizeof(rcd) ||
188-
!guid_equal(&rcd.hdr.creator_id, &CPER_CREATOR_MCE))
189-
goto retry;
187+
190188
memcpy(m, &rcd.mce, sizeof(*m));
191189
rc = sizeof(*m);
192190
out:

drivers/acpi/apei/einj.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,9 @@ static int einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2,
549549
!arch_is_platform_page(base_addr)))
550550
return -EINVAL;
551551

552+
if (is_zero_pfn(base_addr >> PAGE_SHIFT))
553+
return -EADDRINUSE;
554+
552555
inject:
553556
mutex_lock(&einj_mutex);
554557
rc = __einj_error_inject(type, flags, param1, param2, param3, param4);

drivers/acpi/apei/erst-dbg.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ static ssize_t erst_dbg_read(struct file *filp, char __user *ubuf,
111111
goto out;
112112
}
113113
retry:
114-
rc = len = erst_read(id, erst_dbg_buf, erst_dbg_buf_len);
114+
rc = len = erst_read_record(id, erst_dbg_buf, erst_dbg_buf_len,
115+
erst_dbg_buf_len, NULL);
115116
/* The record may be cleared by others, try read next record */
116117
if (rc == -ENOENT)
117118
goto retry_next;

drivers/acpi/apei/erst.c

Lines changed: 71 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,74 @@ ssize_t erst_read(u64 record_id, struct cper_record_header *record,
856856
}
857857
EXPORT_SYMBOL_GPL(erst_read);
858858

859+
static void erst_clear_cache(u64 record_id)
860+
{
861+
int i;
862+
u64 *entries;
863+
864+
mutex_lock(&erst_record_id_cache.lock);
865+
866+
entries = erst_record_id_cache.entries;
867+
for (i = 0; i < erst_record_id_cache.len; i++) {
868+
if (entries[i] == record_id)
869+
entries[i] = APEI_ERST_INVALID_RECORD_ID;
870+
}
871+
__erst_record_id_cache_compact();
872+
873+
mutex_unlock(&erst_record_id_cache.lock);
874+
}
875+
876+
ssize_t erst_read_record(u64 record_id, struct cper_record_header *record,
877+
size_t buflen, size_t recordlen, const guid_t *creatorid)
878+
{
879+
ssize_t len;
880+
881+
/*
882+
* if creatorid is NULL, read any record for erst-dbg module
883+
*/
884+
if (creatorid == NULL) {
885+
len = erst_read(record_id, record, buflen);
886+
if (len == -ENOENT)
887+
erst_clear_cache(record_id);
888+
889+
return len;
890+
}
891+
892+
len = erst_read(record_id, record, buflen);
893+
/*
894+
* if erst_read return value is -ENOENT skip to next record_id,
895+
* and clear the record_id cache.
896+
*/
897+
if (len == -ENOENT) {
898+
erst_clear_cache(record_id);
899+
goto out;
900+
}
901+
902+
if (len < 0)
903+
goto out;
904+
905+
/*
906+
* if erst_read return value is less than record head length,
907+
* consider it as -EIO, and clear the record_id cache.
908+
*/
909+
if (len < recordlen) {
910+
len = -EIO;
911+
erst_clear_cache(record_id);
912+
goto out;
913+
}
914+
915+
/*
916+
* if creatorid is not wanted, consider it as not found,
917+
* for skipping to next record_id.
918+
*/
919+
if (!guid_equal(&record->creator_id, creatorid))
920+
len = -ENOENT;
921+
922+
out:
923+
return len;
924+
}
925+
EXPORT_SYMBOL_GPL(erst_read_record);
926+
859927
int erst_clear(u64 record_id)
860928
{
861929
int rc, i;
@@ -996,16 +1064,13 @@ static ssize_t erst_reader(struct pstore_record *record)
9961064
goto out;
9971065
}
9981066

999-
len = erst_read(record_id, &rcd->hdr, rcd_len);
1067+
len = erst_read_record(record_id, &rcd->hdr, rcd_len, sizeof(*rcd),
1068+
&CPER_CREATOR_PSTORE);
10001069
/* The record may be cleared by others, try read next record */
10011070
if (len == -ENOENT)
10021071
goto skip;
1003-
else if (len < 0 || len < sizeof(*rcd)) {
1004-
rc = -EIO;
1072+
else if (len < 0)
10051073
goto out;
1006-
}
1007-
if (!guid_equal(&rcd->hdr.creator_id, &CPER_CREATOR_PSTORE))
1008-
goto skip;
10091074

10101075
record->buf = kmalloc(len, GFP_KERNEL);
10111076
if (record->buf == NULL) {

drivers/acpi/dptf/dptf_power.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,12 @@
1212
/*
1313
* Presentation of attributes which are defined for INT3407 and INT3532.
1414
* They are:
15-
* PMAX : Maximum platform powe
15+
* PMAX : Maximum platform power
1616
* PSRC : Platform power source
1717
* ARTG : Adapter rating
1818
* CTYP : Charger type
19-
* PBSS : Battery steady power
2019
* PROP : Rest of worst case platform Power
2120
* PBSS : Power Battery Steady State
22-
* PBSS : Power Battery Steady State
2321
* RBHF : High Frequency Impedance
2422
* VBNL : Instantaneous No-Load Voltage
2523
* CMPP : Current Discharge Capability
@@ -117,7 +115,7 @@ static const struct attribute_group dptf_battery_attribute_group = {
117115
#define POWER_STATE_CHANGED 0x81
118116
#define STEADY_STATE_POWER_CHANGED 0x83
119117
#define POWER_PROP_CHANGE_EVENT 0x84
120-
#define IMPEDANCED_CHNGED 0x85
118+
#define IMPEDANCE_CHANGED 0x85
121119
#define VOLTAGE_CURRENT_CHANGED 0x86
122120

123121
static long long dptf_participant_type(acpi_handle handle)
@@ -150,6 +148,9 @@ static void dptf_power_notify(acpi_handle handle, u32 event, void *data)
150148
case STEADY_STATE_POWER_CHANGED:
151149
attr = "max_steady_state_power_mw";
152150
break;
151+
case IMPEDANCE_CHANGED:
152+
attr = "high_freq_impedance_mohm";
153+
break;
153154
case VOLTAGE_CURRENT_CHANGED:
154155
attr = "no_load_voltage_mv";
155156
break;

include/acpi/apei.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ int erst_get_record_id_next(int *pos, u64 *record_id);
4646
void erst_get_record_id_end(void);
4747
ssize_t erst_read(u64 record_id, struct cper_record_header *record,
4848
size_t buflen);
49+
ssize_t erst_read_record(u64 record_id, struct cper_record_header *record,
50+
size_t buflen, size_t recordlen, const guid_t *creatorid);
4951
int erst_clear(u64 record_id);
5052

5153
int arch_apei_enable_cmcff(struct acpi_hest_header *hest_hdr, void *data);

0 commit comments

Comments
 (0)