Commit f3c0d6a1 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

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
Loading
Loading
Loading
Loading
+37 −4
Original line number Diff line number Diff line
@@ -59,6 +59,10 @@ static struct acpi_table_erst *erst_tab;
#define ERST_RANGE_NVRAM	0x0002
#define ERST_RANGE_SLOW		0x0004

/* ERST Exec max timings */
#define ERST_EXEC_TIMING_MAX_MASK      0xFFFFFFFF00000000
#define ERST_EXEC_TIMING_MAX_SHIFT     32

/*
 * ERST Error Log Address Range, used as buffer for reading/writing
 * error records.
@@ -68,6 +72,7 @@ static struct erst_erange {
	u64 size;
	void __iomem *vaddr;
	u32 attr;
	u64 timings;
} erst_erange;

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

static inline u64 erst_get_timeout(void)
{
	u64 timeout = FIRMWARE_TIMEOUT;

	if (erst_erange.attr & ERST_RANGE_SLOW) {
		timeout = ((erst_erange.timings & ERST_EXEC_TIMING_MAX_MASK) >>
			ERST_EXEC_TIMING_MAX_SHIFT) * NSEC_PER_MSEC;
		if (timeout < FIRMWARE_TIMEOUT)
			timeout = FIRMWARE_TIMEOUT;
	}
	return timeout;
}

static int erst_timedout(u64 *t, u64 spin_unit)
{
	if ((s64)*t < spin_unit) {
@@ -191,9 +209,11 @@ static int erst_exec_stall_while_true(struct apei_exec_context *ctx,
{
	int rc;
	u64 val;
	u64 timeout = FIRMWARE_TIMEOUT;
	u64 timeout;
	u64 stall_time;

	timeout = erst_get_timeout();

	if (ctx->var1 > FIRMWARE_MAX_STALL) {
		if (!in_nmi())
			pr_warn(FW_WARN
@@ -389,6 +409,13 @@ static int erst_get_erange(struct erst_erange *range)
	if (rc)
		return rc;
	range->attr = apei_exec_ctx_get_output(&ctx);
	rc = apei_exec_run(&ctx, ACPI_ERST_EXECUTE_TIMINGS);
	if (rc == 0)
		range->timings = apei_exec_ctx_get_output(&ctx);
	else if (rc == -ENOENT)
		range->timings = 0;
	else
		return rc;

	return 0;
}
@@ -621,10 +648,12 @@ EXPORT_SYMBOL_GPL(erst_get_record_id_end);
static int __erst_write_to_storage(u64 offset)
{
	struct apei_exec_context ctx;
	u64 timeout = FIRMWARE_TIMEOUT;
	u64 timeout;
	u64 val;
	int rc;

	timeout = erst_get_timeout();

	erst_exec_ctx_init(&ctx);
	rc = apei_exec_run_optional(&ctx, ACPI_ERST_BEGIN_WRITE);
	if (rc)
@@ -660,10 +689,12 @@ static int __erst_write_to_storage(u64 offset)
static int __erst_read_from_storage(u64 record_id, u64 offset)
{
	struct apei_exec_context ctx;
	u64 timeout = FIRMWARE_TIMEOUT;
	u64 timeout;
	u64 val;
	int rc;

	timeout = erst_get_timeout();

	erst_exec_ctx_init(&ctx);
	rc = apei_exec_run_optional(&ctx, ACPI_ERST_BEGIN_READ);
	if (rc)
@@ -703,10 +734,12 @@ static int __erst_read_from_storage(u64 record_id, u64 offset)
static int __erst_clear_from_storage(u64 record_id)
{
	struct apei_exec_context ctx;
	u64 timeout = FIRMWARE_TIMEOUT;
	u64 timeout;
	u64 val;
	int rc;

	timeout = erst_get_timeout();

	erst_exec_ctx_init(&ctx);
	rc = apei_exec_run_optional(&ctx, ACPI_ERST_BEGIN_CLEAR);
	if (rc)
+22 −1
Original line number Diff line number Diff line
@@ -209,6 +209,20 @@ int ghes_estatus_pool_init(unsigned int num_ghes)
	return -ENOMEM;
}

/**
 * ghes_estatus_pool_region_free - free previously allocated memory
 *				   from the ghes_estatus_pool.
 * @addr: address of memory to free.
 * @size: size of memory to free.
 *
 * Returns none.
 */
void ghes_estatus_pool_region_free(unsigned long addr, u32 size)
{
	gen_pool_free(ghes_estatus_pool, addr, size);
}
EXPORT_SYMBOL_GPL(ghes_estatus_pool_region_free);

static int map_gen_v2(struct ghes *ghes)
{
	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)
	    pcie_err->validation_bits & CPER_PCIE_VALID_AER_INFO) {
		unsigned int devfn;
		int aer_severity;
		u8 *aer_info;

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

		aer_info = (void *)gen_pool_alloc(ghes_estatus_pool,
						  sizeof(struct aer_capability_regs));
		if (!aer_info)
			return;
		memcpy(aer_info, pcie_err->aer_info, sizeof(struct aer_capability_regs));

		aer_recover_queue(pcie_err->device_id.segment,
				  pcie_err->device_id.bus,
				  devfn, aer_severity,
				  (struct aer_capability_regs *)
				  pcie_err->aer_info);
				  aer_info);
	}
#endif
}
+1 −1
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ struct prm_module_info {
	bool updatable;

	struct list_head module_list;
	struct prm_handler_info handlers[];
	struct prm_handler_info handlers[] __counted_by(handler_count);
};

static u64 efi_pa_va_lookup(u64 pa)
+76 −8
Original line number Diff line number Diff line
@@ -130,6 +130,16 @@ static int video_detect_force_native(const struct dmi_system_id *d)
	return 0;
}

static int video_detect_portege_r100(const struct dmi_system_id *d)
{
	struct pci_dev *dev;
	/* Search for Trident CyberBlade XP4m32 to confirm Portégé R100 */
	dev = pci_get_device(PCI_VENDOR_ID_TRIDENT, 0x2100, NULL);
	if (dev)
		acpi_backlight_dmi = acpi_backlight_vendor;
	return 0;
}

static const struct dmi_system_id video_detect_dmi_table[] = {
	/*
	 * Models which should use the vendor backlight interface,
@@ -229,14 +239,6 @@ static const struct dmi_system_id video_detect_dmi_table[] = {
		DMI_MATCH(DMI_BOARD_NAME, "NC210/NC110"),
		},
	},
	{
	 .callback = video_detect_force_vendor,
	 /* Xiaomi Mi Pad 2 */
	 .matches = {
			DMI_MATCH(DMI_SYS_VENDOR, "Xiaomi Inc"),
			DMI_MATCH(DMI_PRODUCT_NAME, "Mipad2"),
		},
	},

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

	/*
	 * Toshiba Portégé R100 has working both acpi_video and toshiba_acpi
	 * vendor driver. But none of them gets activated as it has a VGA with
	 * no kernel driver (Trident CyberBlade XP4m32).
	 * The DMI strings are generic so check for the VGA chip in callback.
	 */
	{
	 .callback = video_detect_portege_r100,
	 .matches = {
		DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
		DMI_MATCH(DMI_PRODUCT_NAME, "Portable PC"),
		DMI_MATCH(DMI_PRODUCT_VERSION, "Version 1.0"),
		DMI_MATCH(DMI_BOARD_NAME, "Portable PC")
		},
	},

	/*
	 * Models which need acpi_video backlight control where the GPU drivers
	 * 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[] = {
		DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 15 3535"),
		},
	},

	/*
	 * x86 android tablets which directly control the backlight through
	 * an external backlight controller, typically TI's LP8557.
	 * The backlight is directly controlled by the lp855x driver on these.
	 * This setup means that neither i915's native nor acpi_video backlight
	 * control works. Add a "vendor" quirk to disable both. Note these
	 * devices do not use vendor control in the typical meaning of
	 * vendor specific SMBIOS or ACPI calls being used.
	 */
	{
	 .callback = video_detect_force_vendor,
	 /* Lenovo Yoga Book X90F / X90L */
	 .matches = {
		DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Intel Corporation"),
		DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "CHERRYVIEW D1 PLATFORM"),
		DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "YETI-11"),
		},
	},
	{
	 .callback = video_detect_force_vendor,
	 /*
	  * Lenovo Yoga Tablet 2 830F/L or 1050F/L (The 8" and 10"
	  * Lenovo Yoga Tablet 2 use the same mainboard)
	  */
	 .matches = {
		DMI_MATCH(DMI_SYS_VENDOR, "Intel Corp."),
		DMI_MATCH(DMI_PRODUCT_NAME, "VALLEYVIEW C0 PLATFORM"),
		DMI_MATCH(DMI_BOARD_NAME, "BYT-T FFD8"),
		/* Partial match on beginning of BIOS version */
		DMI_MATCH(DMI_BIOS_VERSION, "BLADE_21"),
		},
	},
	{
	 .callback = video_detect_force_vendor,
	 /* Lenovo Yoga Tab 3 Pro YT3-X90F */
	 .matches = {
		DMI_MATCH(DMI_SYS_VENDOR, "Intel Corporation"),
		DMI_MATCH(DMI_PRODUCT_NAME, "CHERRYVIEW D1 PLATFORM"),
		DMI_MATCH(DMI_PRODUCT_VERSION, "Blade3-10A-001"),
		},
	},
	{
	 .callback = video_detect_force_vendor,
	 /* Xiaomi Mi Pad 2 */
	 .matches = {
		DMI_MATCH(DMI_SYS_VENDOR, "Xiaomi Inc"),
		DMI_MATCH(DMI_PRODUCT_NAME, "Mipad2"),
		},
	},
	{ },
};

+5 −11
Original line number Diff line number Diff line
@@ -57,12 +57,6 @@
	(MSG_TYPE_SET(MSG_TYPE_PWRMGMT) | \
	MSG_SUBTYPE_SET(hndl) | TPC_CMD_SET(cmd) | type)

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

	/* Write signature for subspace */
	WRITE_ONCE(generic_comm_base->signature,
		   cpu_to_le32(PCC_SIGNATURE_MASK | ctx->mbox_idx));
		   cpu_to_le32(PCC_SIGNATURE | ctx->mbox_idx));

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

	/* Flip CMD COMPLETE bit */
	val = le16_to_cpu(READ_ONCE(generic_comm_base->status));
	val &= ~PCCS_CMD_COMPLETE;
	val &= ~PCC_STATUS_CMD_COMPLETE;
	WRITE_ONCE(generic_comm_base->status, cpu_to_le16(val));

	/* 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)
	msg = generic_comm_base + 1;
	/* Check if platform sends interrupt */
	if (!xgene_word_tst_and_clr(&generic_comm_base->status,
				    PCCS_SCI_DOORBEL))
				    PCC_STATUS_SCI_DOORBELL))
		return;

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