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