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