Skip to content

Commit f3c0d6a

Browse files
committed
Merge branches 'acpi-video', 'acpi-prm', 'acpi-apei' and 'acpi-pcc'
Merge ACPI backlight driver updates, ACPI APEI updates, ACPI PRM updates and changes related to ACPI PCC for 6.7-rc1: - Add acpi_backlight=vendor quirk for Toshiba Portégé R100 (Ondrej Zary). - Add "vendor" backlight quirks for 3 Lenovo x86 Android tablets (Hans de Goede). - Move Xiaomi Mi Pad 2 backlight quirk to its own section (Hans de Goede). - Annotate struct prm_module_info with __counted_by (Kees Cook). - Fix AER info corruption in aer_recover_queue() when error status data has multiple sections (Shiju Jose). - Make APEI use ERST max execution time value for slow devices (Jeshua Smith). - Add support for platform notification handling to the PCC mailbox driver and modify it to support shared interrupts for multiple subspaces (Huisong Li). - Define common macros to use when referring to various bitfields in the PCC generic communications channel command and status fields and use them in some drivers (Sudeep Holla). * acpi-video: ACPI: video: Add acpi_backlight=vendor quirk for Toshiba Portégé R100 ACPI: video: Add "vendor" quirks for 3 Lenovo x86 Android tablets ACPI: video: Move Xiaomi Mi Pad 2 quirk to its own section * acpi-prm: ACPI: PRM: Annotate struct prm_module_info with __counted_by * acpi-apei: ACPI: APEI: Use ERST timeout for slow devices ACPI: APEI: Fix AER info corruption when error status data has multiple sections * acpi-pcc: soc: kunpeng_hccs: Migrate to use generic PCC shmem related macros hwmon: (xgene) Migrate to use generic PCC shmem related macros i2c: xgene-slimpro: Migrate to use generic PCC shmem related macros ACPI: PCC: Add PCC shared memory region command and status bitfields mailbox: pcc: Support shared interrupt for multiple subspaces mailbox: pcc: Add support for platform notification handling
5 parents ea40075 + 35a341c + 2e89345 + fac475a + aa2e505 commit f3c0d6a

File tree

11 files changed

+254
-54
lines changed

11 files changed

+254
-54
lines changed

drivers/acpi/apei/erst.c

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ static struct acpi_table_erst *erst_tab;
5959
#define ERST_RANGE_NVRAM 0x0002
6060
#define ERST_RANGE_SLOW 0x0004
6161

62+
/* ERST Exec max timings */
63+
#define ERST_EXEC_TIMING_MAX_MASK 0xFFFFFFFF00000000
64+
#define ERST_EXEC_TIMING_MAX_SHIFT 32
65+
6266
/*
6367
* ERST Error Log Address Range, used as buffer for reading/writing
6468
* error records.
@@ -68,6 +72,7 @@ static struct erst_erange {
6872
u64 size;
6973
void __iomem *vaddr;
7074
u32 attr;
75+
u64 timings;
7176
} erst_erange;
7277

7378
/*
@@ -97,6 +102,19 @@ static inline int erst_errno(int command_status)
97102
}
98103
}
99104

105+
static inline u64 erst_get_timeout(void)
106+
{
107+
u64 timeout = FIRMWARE_TIMEOUT;
108+
109+
if (erst_erange.attr & ERST_RANGE_SLOW) {
110+
timeout = ((erst_erange.timings & ERST_EXEC_TIMING_MAX_MASK) >>
111+
ERST_EXEC_TIMING_MAX_SHIFT) * NSEC_PER_MSEC;
112+
if (timeout < FIRMWARE_TIMEOUT)
113+
timeout = FIRMWARE_TIMEOUT;
114+
}
115+
return timeout;
116+
}
117+
100118
static int erst_timedout(u64 *t, u64 spin_unit)
101119
{
102120
if ((s64)*t < spin_unit) {
@@ -191,9 +209,11 @@ static int erst_exec_stall_while_true(struct apei_exec_context *ctx,
191209
{
192210
int rc;
193211
u64 val;
194-
u64 timeout = FIRMWARE_TIMEOUT;
212+
u64 timeout;
195213
u64 stall_time;
196214

215+
timeout = erst_get_timeout();
216+
197217
if (ctx->var1 > FIRMWARE_MAX_STALL) {
198218
if (!in_nmi())
199219
pr_warn(FW_WARN
@@ -389,6 +409,13 @@ static int erst_get_erange(struct erst_erange *range)
389409
if (rc)
390410
return rc;
391411
range->attr = apei_exec_ctx_get_output(&ctx);
412+
rc = apei_exec_run(&ctx, ACPI_ERST_EXECUTE_TIMINGS);
413+
if (rc == 0)
414+
range->timings = apei_exec_ctx_get_output(&ctx);
415+
else if (rc == -ENOENT)
416+
range->timings = 0;
417+
else
418+
return rc;
392419

393420
return 0;
394421
}
@@ -621,10 +648,12 @@ EXPORT_SYMBOL_GPL(erst_get_record_id_end);
621648
static int __erst_write_to_storage(u64 offset)
622649
{
623650
struct apei_exec_context ctx;
624-
u64 timeout = FIRMWARE_TIMEOUT;
651+
u64 timeout;
625652
u64 val;
626653
int rc;
627654

655+
timeout = erst_get_timeout();
656+
628657
erst_exec_ctx_init(&ctx);
629658
rc = apei_exec_run_optional(&ctx, ACPI_ERST_BEGIN_WRITE);
630659
if (rc)
@@ -660,10 +689,12 @@ static int __erst_write_to_storage(u64 offset)
660689
static int __erst_read_from_storage(u64 record_id, u64 offset)
661690
{
662691
struct apei_exec_context ctx;
663-
u64 timeout = FIRMWARE_TIMEOUT;
692+
u64 timeout;
664693
u64 val;
665694
int rc;
666695

696+
timeout = erst_get_timeout();
697+
667698
erst_exec_ctx_init(&ctx);
668699
rc = apei_exec_run_optional(&ctx, ACPI_ERST_BEGIN_READ);
669700
if (rc)
@@ -703,10 +734,12 @@ static int __erst_read_from_storage(u64 record_id, u64 offset)
703734
static int __erst_clear_from_storage(u64 record_id)
704735
{
705736
struct apei_exec_context ctx;
706-
u64 timeout = FIRMWARE_TIMEOUT;
737+
u64 timeout;
707738
u64 val;
708739
int rc;
709740

741+
timeout = erst_get_timeout();
742+
710743
erst_exec_ctx_init(&ctx);
711744
rc = apei_exec_run_optional(&ctx, ACPI_ERST_BEGIN_CLEAR);
712745
if (rc)

drivers/acpi/apei/ghes.c

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,20 @@ int ghes_estatus_pool_init(unsigned int num_ghes)
209209
return -ENOMEM;
210210
}
211211

212+
/**
213+
* ghes_estatus_pool_region_free - free previously allocated memory
214+
* from the ghes_estatus_pool.
215+
* @addr: address of memory to free.
216+
* @size: size of memory to free.
217+
*
218+
* Returns none.
219+
*/
220+
void ghes_estatus_pool_region_free(unsigned long addr, u32 size)
221+
{
222+
gen_pool_free(ghes_estatus_pool, addr, size);
223+
}
224+
EXPORT_SYMBOL_GPL(ghes_estatus_pool_region_free);
225+
212226
static int map_gen_v2(struct ghes *ghes)
213227
{
214228
return apei_map_generic_address(&ghes->generic_v2->read_ack_register);
@@ -564,6 +578,7 @@ static void ghes_handle_aer(struct acpi_hest_generic_data *gdata)
564578
pcie_err->validation_bits & CPER_PCIE_VALID_AER_INFO) {
565579
unsigned int devfn;
566580
int aer_severity;
581+
u8 *aer_info;
567582

568583
devfn = PCI_DEVFN(pcie_err->device_id.device,
569584
pcie_err->device_id.function);
@@ -577,11 +592,17 @@ static void ghes_handle_aer(struct acpi_hest_generic_data *gdata)
577592
if (gdata->flags & CPER_SEC_RESET)
578593
aer_severity = AER_FATAL;
579594

595+
aer_info = (void *)gen_pool_alloc(ghes_estatus_pool,
596+
sizeof(struct aer_capability_regs));
597+
if (!aer_info)
598+
return;
599+
memcpy(aer_info, pcie_err->aer_info, sizeof(struct aer_capability_regs));
600+
580601
aer_recover_queue(pcie_err->device_id.segment,
581602
pcie_err->device_id.bus,
582603
devfn, aer_severity,
583604
(struct aer_capability_regs *)
584-
pcie_err->aer_info);
605+
aer_info);
585606
}
586607
#endif
587608
}

drivers/acpi/prmt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ struct prm_module_info {
6969
bool updatable;
7070

7171
struct list_head module_list;
72-
struct prm_handler_info handlers[];
72+
struct prm_handler_info handlers[] __counted_by(handler_count);
7373
};
7474

7575
static u64 efi_pa_va_lookup(u64 pa)

drivers/acpi/video_detect.c

Lines changed: 76 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,16 @@ static int video_detect_force_native(const struct dmi_system_id *d)
130130
return 0;
131131
}
132132

133+
static int video_detect_portege_r100(const struct dmi_system_id *d)
134+
{
135+
struct pci_dev *dev;
136+
/* Search for Trident CyberBlade XP4m32 to confirm Portégé R100 */
137+
dev = pci_get_device(PCI_VENDOR_ID_TRIDENT, 0x2100, NULL);
138+
if (dev)
139+
acpi_backlight_dmi = acpi_backlight_vendor;
140+
return 0;
141+
}
142+
133143
static const struct dmi_system_id video_detect_dmi_table[] = {
134144
/*
135145
* Models which should use the vendor backlight interface,
@@ -229,14 +239,6 @@ static const struct dmi_system_id video_detect_dmi_table[] = {
229239
DMI_MATCH(DMI_BOARD_NAME, "NC210/NC110"),
230240
},
231241
},
232-
{
233-
.callback = video_detect_force_vendor,
234-
/* Xiaomi Mi Pad 2 */
235-
.matches = {
236-
DMI_MATCH(DMI_SYS_VENDOR, "Xiaomi Inc"),
237-
DMI_MATCH(DMI_PRODUCT_NAME, "Mipad2"),
238-
},
239-
},
240242

241243
/*
242244
* Models which should use the vendor backlight interface,
@@ -270,6 +272,22 @@ static const struct dmi_system_id video_detect_dmi_table[] = {
270272
},
271273
},
272274

275+
/*
276+
* Toshiba Portégé R100 has working both acpi_video and toshiba_acpi
277+
* vendor driver. But none of them gets activated as it has a VGA with
278+
* no kernel driver (Trident CyberBlade XP4m32).
279+
* The DMI strings are generic so check for the VGA chip in callback.
280+
*/
281+
{
282+
.callback = video_detect_portege_r100,
283+
.matches = {
284+
DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
285+
DMI_MATCH(DMI_PRODUCT_NAME, "Portable PC"),
286+
DMI_MATCH(DMI_PRODUCT_VERSION, "Version 1.0"),
287+
DMI_MATCH(DMI_BOARD_NAME, "Portable PC")
288+
},
289+
},
290+
273291
/*
274292
* Models which need acpi_video backlight control where the GPU drivers
275293
* do not call acpi_video_register_backlight() because no internal panel
@@ -799,6 +817,56 @@ static const struct dmi_system_id video_detect_dmi_table[] = {
799817
DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 15 3535"),
800818
},
801819
},
820+
821+
/*
822+
* x86 android tablets which directly control the backlight through
823+
* an external backlight controller, typically TI's LP8557.
824+
* The backlight is directly controlled by the lp855x driver on these.
825+
* This setup means that neither i915's native nor acpi_video backlight
826+
* control works. Add a "vendor" quirk to disable both. Note these
827+
* devices do not use vendor control in the typical meaning of
828+
* vendor specific SMBIOS or ACPI calls being used.
829+
*/
830+
{
831+
.callback = video_detect_force_vendor,
832+
/* Lenovo Yoga Book X90F / X90L */
833+
.matches = {
834+
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Intel Corporation"),
835+
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "CHERRYVIEW D1 PLATFORM"),
836+
DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "YETI-11"),
837+
},
838+
},
839+
{
840+
.callback = video_detect_force_vendor,
841+
/*
842+
* Lenovo Yoga Tablet 2 830F/L or 1050F/L (The 8" and 10"
843+
* Lenovo Yoga Tablet 2 use the same mainboard)
844+
*/
845+
.matches = {
846+
DMI_MATCH(DMI_SYS_VENDOR, "Intel Corp."),
847+
DMI_MATCH(DMI_PRODUCT_NAME, "VALLEYVIEW C0 PLATFORM"),
848+
DMI_MATCH(DMI_BOARD_NAME, "BYT-T FFD8"),
849+
/* Partial match on beginning of BIOS version */
850+
DMI_MATCH(DMI_BIOS_VERSION, "BLADE_21"),
851+
},
852+
},
853+
{
854+
.callback = video_detect_force_vendor,
855+
/* Lenovo Yoga Tab 3 Pro YT3-X90F */
856+
.matches = {
857+
DMI_MATCH(DMI_SYS_VENDOR, "Intel Corporation"),
858+
DMI_MATCH(DMI_PRODUCT_NAME, "CHERRYVIEW D1 PLATFORM"),
859+
DMI_MATCH(DMI_PRODUCT_VERSION, "Blade3-10A-001"),
860+
},
861+
},
862+
{
863+
.callback = video_detect_force_vendor,
864+
/* Xiaomi Mi Pad 2 */
865+
.matches = {
866+
DMI_MATCH(DMI_SYS_VENDOR, "Xiaomi Inc"),
867+
DMI_MATCH(DMI_PRODUCT_NAME, "Mipad2"),
868+
},
869+
},
802870
{ },
803871
};
804872

drivers/hwmon/xgene-hwmon.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,6 @@
5757
(MSG_TYPE_SET(MSG_TYPE_PWRMGMT) | \
5858
MSG_SUBTYPE_SET(hndl) | TPC_CMD_SET(cmd) | type)
5959

60-
/* PCC defines */
61-
#define PCC_SIGNATURE_MASK 0x50424300
62-
#define PCCC_GENERATE_DB_INT BIT(15)
63-
#define PCCS_CMD_COMPLETE BIT(0)
64-
#define PCCS_SCI_DOORBEL BIT(1)
65-
#define PCCS_PLATFORM_NOTIFICATION BIT(3)
6660
/*
6761
* Arbitrary retries in case the remote processor is slow to respond
6862
* to PCC commands
@@ -142,15 +136,15 @@ static int xgene_hwmon_pcc_rd(struct xgene_hwmon_dev *ctx, u32 *msg)
142136

143137
/* Write signature for subspace */
144138
WRITE_ONCE(generic_comm_base->signature,
145-
cpu_to_le32(PCC_SIGNATURE_MASK | ctx->mbox_idx));
139+
cpu_to_le32(PCC_SIGNATURE | ctx->mbox_idx));
146140

147141
/* Write to the shared command region */
148142
WRITE_ONCE(generic_comm_base->command,
149-
cpu_to_le16(MSG_TYPE(msg[0]) | PCCC_GENERATE_DB_INT));
143+
cpu_to_le16(MSG_TYPE(msg[0]) | PCC_CMD_GENERATE_DB_INTR));
150144

151145
/* Flip CMD COMPLETE bit */
152146
val = le16_to_cpu(READ_ONCE(generic_comm_base->status));
153-
val &= ~PCCS_CMD_COMPLETE;
147+
val &= ~PCC_STATUS_CMD_COMPLETE;
154148
WRITE_ONCE(generic_comm_base->status, cpu_to_le16(val));
155149

156150
/* Copy the message to the PCC comm space */
@@ -544,7 +538,7 @@ static void xgene_hwmon_pcc_rx_cb(struct mbox_client *cl, void *msg)
544538
msg = generic_comm_base + 1;
545539
/* Check if platform sends interrupt */
546540
if (!xgene_word_tst_and_clr(&generic_comm_base->status,
547-
PCCS_SCI_DOORBEL))
541+
PCC_STATUS_SCI_DOORBELL))
548542
return;
549543

550544
/*
@@ -566,7 +560,7 @@ static void xgene_hwmon_pcc_rx_cb(struct mbox_client *cl, void *msg)
566560
TPC_CMD(((u32 *)msg)[0]) == TPC_ALARM))) {
567561
/* Check if platform completes command */
568562
if (xgene_word_tst_and_clr(&generic_comm_base->status,
569-
PCCS_CMD_COMPLETE)) {
563+
PCC_STATUS_CMD_COMPLETE)) {
570564
ctx->sync_msg.msg = ((u32 *)msg)[0];
571565
ctx->sync_msg.param1 = ((u32 *)msg)[1];
572566
ctx->sync_msg.param2 = ((u32 *)msg)[2];

drivers/i2c/busses/i2c-xgene-slimpro.c

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,6 @@
9191

9292
#define SLIMPRO_IIC_MSG_DWORD_COUNT 3
9393

94-
/* PCC related defines */
95-
#define PCC_SIGNATURE 0x50424300
96-
#define PCC_STS_CMD_COMPLETE BIT(0)
97-
#define PCC_STS_SCI_DOORBELL BIT(1)
98-
#define PCC_STS_ERR BIT(2)
99-
#define PCC_STS_PLAT_NOTIFY BIT(3)
100-
#define PCC_CMD_GENERATE_DB_INT BIT(15)
101-
10294
struct slimpro_i2c_dev {
10395
struct i2c_adapter adapter;
10496
struct device *dev;
@@ -160,11 +152,11 @@ static void slimpro_i2c_pcc_rx_cb(struct mbox_client *cl, void *msg)
160152

161153
/* Check if platform sends interrupt */
162154
if (!xgene_word_tst_and_clr(&generic_comm_base->status,
163-
PCC_STS_SCI_DOORBELL))
155+
PCC_STATUS_SCI_DOORBELL))
164156
return;
165157

166158
if (xgene_word_tst_and_clr(&generic_comm_base->status,
167-
PCC_STS_CMD_COMPLETE)) {
159+
PCC_STATUS_CMD_COMPLETE)) {
168160
msg = generic_comm_base + 1;
169161

170162
/* Response message msg[1] contains the return value. */
@@ -186,10 +178,10 @@ static void slimpro_i2c_pcc_tx_prepare(struct slimpro_i2c_dev *ctx, u32 *msg)
186178
cpu_to_le32(PCC_SIGNATURE | ctx->mbox_idx));
187179

188180
WRITE_ONCE(generic_comm_base->command,
189-
cpu_to_le16(SLIMPRO_MSG_TYPE(msg[0]) | PCC_CMD_GENERATE_DB_INT));
181+
cpu_to_le16(SLIMPRO_MSG_TYPE(msg[0]) | PCC_CMD_GENERATE_DB_INTR));
190182

191183
status = le16_to_cpu(READ_ONCE(generic_comm_base->status));
192-
status &= ~PCC_STS_CMD_COMPLETE;
184+
status &= ~PCC_STATUS_CMD_COMPLETE;
193185
WRITE_ONCE(generic_comm_base->status, cpu_to_le16(status));
194186

195187
/* Copy the message to the PCC comm space */

0 commit comments

Comments
 (0)