chengshan / rpms / kernel

Forked from rpms/kernel 2 years ago
Clone
Pablo Greco 7b2c62
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
Pablo Greco 7b2c62
From: Mark Salter <msalter@redhat.com>
Pablo Greco 7b2c62
Date: Thu, 10 May 2018 17:38:43 -0400
Pablo Greco 7b2c62
Subject: [PATCH] ACPI / irq: Workaround firmware issue on X-Gene based m400
Pablo Greco 7b2c62
Pablo Greco 7b2c62
Message-id: <20180510173844.29580-3-msalter@redhat.com>
Pablo Greco 7b2c62
Patchwork-id: 214383
Pablo Greco 7b2c62
O-Subject: [RHEL-8 BZ1519554 2/3] ACPI / irq: Workaround firmware issue on X-Gene based m400
Pablo Greco 7b2c62
Bugzilla: 1519554
Pablo Greco 7b2c62
RH-Acked-by: Al Stone <astone@redhat.com>
Pablo Greco 7b2c62
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
Pablo Greco 7b2c62
Pablo Greco 7b2c62
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1519554
Pablo Greco 7b2c62
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=16144520
Pablo Greco 7b2c62
Pablo Greco 7b2c62
The ACPI firmware on the xgene-based m400 platorms erroneously
Pablo Greco 7b2c62
describes its UART interrupt as ACPI_PRODUCER rather than
Pablo Greco 7b2c62
ACPI_CONSUMER. This leads to the UART driver being unable to
Pablo Greco 7b2c62
find its interrupt and the kernel unable find a console.
Pablo Greco 7b2c62
Work around this by avoiding the producer/consumer check
Pablo Greco 7b2c62
for X-Gene UARTs.
Pablo Greco 7b2c62
Pablo Greco 7b2c62
Upstream Status: RHEL only
Pablo Greco 7b2c62
Signed-off-by: Mark Salter <msalter@redhat.com>
Pablo Greco 7b2c62
Signed-off-by: Herton R. Krzesinski <herton@redhat.com>
Pablo Greco 7b2c62
---
Pablo Greco 7b2c62
 drivers/acpi/irq.c | 17 +++++++++++++++--
Pablo Greco 7b2c62
 1 file changed, 15 insertions(+), 2 deletions(-)
Pablo Greco 7b2c62
Pablo Greco 7b2c62
diff --git a/drivers/acpi/irq.c b/drivers/acpi/irq.c
Pablo Greco 7b2c62
index e209081d644b..7484bcf59a1b 100644
Pablo Greco 7b2c62
--- a/drivers/acpi/irq.c
Pablo Greco 7b2c62
+++ b/drivers/acpi/irq.c
Pablo Greco 7b2c62
@@ -126,6 +126,7 @@ struct acpi_irq_parse_one_ctx {
Pablo Greco 7b2c62
 	unsigned int index;
Pablo Greco 7b2c62
 	unsigned long *res_flags;
Pablo Greco 7b2c62
 	struct irq_fwspec *fwspec;
Pablo Greco 7b2c62
+	bool skip_producer_check;
Pablo Greco 7b2c62
 };
Pablo Greco 7b2c62
Pablo Greco 7b2c62
 /**
Pablo Greco 7b2c62
@@ -197,7 +198,8 @@ static acpi_status acpi_irq_parse_one_cb(struct acpi_resource *ares,
Pablo Greco 7b2c62
 		return AE_CTRL_TERMINATE;
Pablo Greco 7b2c62
 	case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
Pablo Greco 7b2c62
 		eirq = &ares->data.extended_irq;
Pablo Greco 7b2c62
-		if (eirq->producer_consumer == ACPI_PRODUCER)
Pablo Greco 7b2c62
+		if (!ctx->skip_producer_check &&
Pablo Greco 7b2c62
+		    eirq->producer_consumer == ACPI_PRODUCER)
Pablo Greco 7b2c62
 			return AE_OK;
Pablo Greco 7b2c62
 		if (ctx->index >= eirq->interrupt_count) {
Pablo Greco 7b2c62
 			ctx->index -= eirq->interrupt_count;
Pablo Greco 7b2c62
@@ -232,8 +234,19 @@ static acpi_status acpi_irq_parse_one_cb(struct acpi_resource *ares,
Pablo Greco 7b2c62
 static int acpi_irq_parse_one(acpi_handle handle, unsigned int index,
Pablo Greco 7b2c62
 			      struct irq_fwspec *fwspec, unsigned long *flags)
Pablo Greco 7b2c62
 {
Pablo Greco 7b2c62
-	struct acpi_irq_parse_one_ctx ctx = { -EINVAL, index, flags, fwspec };
Pablo Greco 7b2c62
+	struct acpi_irq_parse_one_ctx ctx = { -EINVAL, index, flags, fwspec, false };
Pablo Greco 7b2c62
Pablo Greco 7b2c62
+	/*
Pablo Greco 7b2c62
+	 * Firmware on arm64-based HPE m400 platform incorrectly marks
Pablo Greco 7b2c62
+	 * its UART interrupt as ACPI_PRODUCER rather than ACPI_CONSUMER.
Pablo Greco 7b2c62
+	 * Don't do the producer/consumer check for that device.
Pablo Greco 7b2c62
+	 */
Pablo Greco 7b2c62
+	if (IS_ENABLED(CONFIG_ARM64)) {
Pablo Greco 7b2c62
+		struct acpi_device *adev = acpi_bus_get_acpi_device(handle);
Pablo Greco 7b2c62
+
Pablo Greco 7b2c62
+		if (adev && !strcmp(acpi_device_hid(adev), "APMC0D08"))
Pablo Greco 7b2c62
+			ctx.skip_producer_check = true;
Pablo Greco 7b2c62
+	}
Pablo Greco 7b2c62
 	acpi_walk_resources(handle, METHOD_NAME__CRS, acpi_irq_parse_one_cb, &ctx;;
Pablo Greco 7b2c62
 	return ctx.rc;
Pablo Greco 7b2c62
 }
Pablo Greco 7b2c62
-- 
Pablo Greco 7b2c62
2.28.0
Pablo Greco 7b2c62