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)
This commit is contained in:
Rafael J. Wysocki 2022-05-23 18:44:27 +02:00
8 changed files with 90 additions and 22 deletions

View File

@ -167,8 +167,7 @@ The table below shows an example of its usage::
Name (_DSD, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () {
Package () {"interrupt-names",
Package (2) {"default", "alert"}},
Package () { "interrupt-names", Package () { "default", "alert" } },
}
...
})

View File

@ -375,7 +375,7 @@ static void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger,
isa_irq_to_gsi[bus_irq] = gsi;
}
static int mp_config_acpi_gsi(struct device *dev, u32 gsi, int trigger,
static void mp_config_acpi_gsi(struct device *dev, u32 gsi, int trigger,
int polarity)
{
#ifdef CONFIG_X86_MPPARSE
@ -387,9 +387,9 @@ static int mp_config_acpi_gsi(struct device *dev, u32 gsi, int trigger,
u8 pin;
if (!acpi_ioapic)
return 0;
return;
if (!dev || !dev_is_pci(dev))
return 0;
return;
pdev = to_pci_dev(dev);
number = pdev->bus->number;
@ -408,7 +408,6 @@ static int mp_config_acpi_gsi(struct device *dev, u32 gsi, int trigger,
mp_save_irq(&mp_irq);
#endif
return 0;
}
static int __init mp_register_ioapic_irq(u8 bus_irq, u8 polarity,

View File

@ -177,16 +177,14 @@ retry:
/* no more record */
if (*record_id == APEI_ERST_INVALID_RECORD_ID)
goto out;
rc = erst_read(*record_id, &rcd.hdr, sizeof(rcd));
rc = erst_read_record(*record_id, &rcd.hdr, sizeof(rcd), sizeof(rcd),
&CPER_CREATOR_MCE);
/* someone else has cleared the record, try next one */
if (rc == -ENOENT)
goto retry;
else if (rc < 0)
goto out;
/* try to skip other type records in storage */
else if (rc != sizeof(rcd) ||
!guid_equal(&rcd.hdr.creator_id, &CPER_CREATOR_MCE))
goto retry;
memcpy(m, &rcd.mce, sizeof(*m));
rc = sizeof(*m);
out:

View File

@ -549,6 +549,9 @@ static int einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2,
!arch_is_platform_page(base_addr)))
return -EINVAL;
if (is_zero_pfn(base_addr >> PAGE_SHIFT))
return -EADDRINUSE;
inject:
mutex_lock(&einj_mutex);
rc = __einj_error_inject(type, flags, param1, param2, param3, param4);

View File

@ -111,7 +111,8 @@ retry_next:
goto out;
}
retry:
rc = len = erst_read(id, erst_dbg_buf, erst_dbg_buf_len);
rc = len = erst_read_record(id, erst_dbg_buf, erst_dbg_buf_len,
erst_dbg_buf_len, NULL);
/* The record may be cleared by others, try read next record */
if (rc == -ENOENT)
goto retry_next;

View File

@ -856,6 +856,74 @@ ssize_t erst_read(u64 record_id, struct cper_record_header *record,
}
EXPORT_SYMBOL_GPL(erst_read);
static void erst_clear_cache(u64 record_id)
{
int i;
u64 *entries;
mutex_lock(&erst_record_id_cache.lock);
entries = erst_record_id_cache.entries;
for (i = 0; i < erst_record_id_cache.len; i++) {
if (entries[i] == record_id)
entries[i] = APEI_ERST_INVALID_RECORD_ID;
}
__erst_record_id_cache_compact();
mutex_unlock(&erst_record_id_cache.lock);
}
ssize_t erst_read_record(u64 record_id, struct cper_record_header *record,
size_t buflen, size_t recordlen, const guid_t *creatorid)
{
ssize_t len;
/*
* if creatorid is NULL, read any record for erst-dbg module
*/
if (creatorid == NULL) {
len = erst_read(record_id, record, buflen);
if (len == -ENOENT)
erst_clear_cache(record_id);
return len;
}
len = erst_read(record_id, record, buflen);
/*
* if erst_read return value is -ENOENT skip to next record_id,
* and clear the record_id cache.
*/
if (len == -ENOENT) {
erst_clear_cache(record_id);
goto out;
}
if (len < 0)
goto out;
/*
* if erst_read return value is less than record head length,
* consider it as -EIO, and clear the record_id cache.
*/
if (len < recordlen) {
len = -EIO;
erst_clear_cache(record_id);
goto out;
}
/*
* if creatorid is not wanted, consider it as not found,
* for skipping to next record_id.
*/
if (!guid_equal(&record->creator_id, creatorid))
len = -ENOENT;
out:
return len;
}
EXPORT_SYMBOL_GPL(erst_read_record);
int erst_clear(u64 record_id)
{
int rc, i;
@ -996,16 +1064,13 @@ skip:
goto out;
}
len = erst_read(record_id, &rcd->hdr, rcd_len);
len = erst_read_record(record_id, &rcd->hdr, rcd_len, sizeof(*rcd),
&CPER_CREATOR_PSTORE);
/* The record may be cleared by others, try read next record */
if (len == -ENOENT)
goto skip;
else if (len < 0 || len < sizeof(*rcd)) {
rc = -EIO;
else if (len < 0)
goto out;
}
if (!guid_equal(&rcd->hdr.creator_id, &CPER_CREATOR_PSTORE))
goto skip;
record->buf = kmalloc(len, GFP_KERNEL);
if (record->buf == NULL) {

View File

@ -12,14 +12,12 @@
/*
* Presentation of attributes which are defined for INT3407 and INT3532.
* They are:
* PMAX : Maximum platform powe
* PMAX : Maximum platform power
* PSRC : Platform power source
* ARTG : Adapter rating
* CTYP : Charger type
* PBSS : Battery steady power
* PROP : Rest of worst case platform Power
* PBSS : Power Battery Steady State
* PBSS : Power Battery Steady State
* RBHF : High Frequency Impedance
* VBNL : Instantaneous No-Load Voltage
* CMPP : Current Discharge Capability
@ -117,7 +115,7 @@ static const struct attribute_group dptf_battery_attribute_group = {
#define POWER_STATE_CHANGED 0x81
#define STEADY_STATE_POWER_CHANGED 0x83
#define POWER_PROP_CHANGE_EVENT 0x84
#define IMPEDANCED_CHNGED 0x85
#define IMPEDANCE_CHANGED 0x85
#define VOLTAGE_CURRENT_CHANGED 0x86
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)
case STEADY_STATE_POWER_CHANGED:
attr = "max_steady_state_power_mw";
break;
case IMPEDANCE_CHANGED:
attr = "high_freq_impedance_mohm";
break;
case VOLTAGE_CURRENT_CHANGED:
attr = "no_load_voltage_mv";
break;

View File

@ -46,6 +46,8 @@ int erst_get_record_id_next(int *pos, u64 *record_id);
void erst_get_record_id_end(void);
ssize_t erst_read(u64 record_id, struct cper_record_header *record,
size_t buflen);
ssize_t erst_read_record(u64 record_id, struct cper_record_header *record,
size_t buflen, size_t recordlen, const guid_t *creatorid);
int erst_clear(u64 record_id);
int arch_apei_enable_cmcff(struct acpi_hest_header *hest_hdr, void *data);