hitmoon / rpms / kernel

Forked from rpms/kernel 4 years ago
Clone
Pablo Greco d6c4c4
From dbdda4277cf0422a9ccb7ea98d0263c3cdbecdf6 Mon Sep 17 00:00:00 2001
Pablo Greco d6c4c4
From: Mark Salter <msalter@redhat.com>
Pablo Greco d6c4c4
Date: Tue, 8 May 2018 21:54:39 -0400
Pablo Greco d6c4c4
Subject: [PATCH] ACPI / irq: Workaround firmware issue on X-Gene based
Pablo Greco d6c4c4
 m400
Pablo Greco d6c4c4
Pablo Greco d6c4c4
The ACPI firmware on the xgene-based m400 platorms erroneously
Pablo Greco d6c4c4
describes its UART interrupt as ACPI_PRODUCER rather than
Pablo Greco d6c4c4
ACPI_CONSUMER. This leads to the UART driver being unable to
Pablo Greco d6c4c4
find its interrupt and the kernel unable find a console.
Pablo Greco d6c4c4
Work around this by avoiding the producer/consumer check
Pablo Greco d6c4c4
for X-Gene UARTs.
Pablo Greco d6c4c4
Pablo Greco d6c4c4
Signed-off-by: Mark Salter <msalter@redhat.com>
Pablo Greco d6c4c4
---
Pablo Greco d6c4c4
 drivers/acpi/irq.c | 17 +++++++++++++++--
Pablo Greco d6c4c4
 1 file changed, 15 insertions(+), 2 deletions(-)
Pablo Greco d6c4c4
Pablo Greco d6c4c4
diff --git a/drivers/acpi/irq.c b/drivers/acpi/irq.c
Pablo Greco d6c4c4
index 7c352cba0528..028c1a564cff 100644
Pablo Greco d6c4c4
--- a/drivers/acpi/irq.c
Pablo Greco d6c4c4
+++ b/drivers/acpi/irq.c
Pablo Greco d6c4c4
@@ -129,6 +129,7 @@ struct acpi_irq_parse_one_ctx {
Pablo Greco d6c4c4
 	unsigned int index;
Pablo Greco d6c4c4
 	unsigned long *res_flags;
Pablo Greco d6c4c4
 	struct irq_fwspec *fwspec;
Pablo Greco d6c4c4
+	bool skip_producer_check;
Pablo Greco d6c4c4
 };
Pablo Greco d6c4c4
 
Pablo Greco d6c4c4
 /**
Pablo Greco d6c4c4
@@ -200,7 +201,8 @@ static acpi_status acpi_irq_parse_one_cb(struct acpi_resource *ares,
Pablo Greco d6c4c4
 		return AE_CTRL_TERMINATE;
Pablo Greco d6c4c4
 	case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
Pablo Greco d6c4c4
 		eirq = &ares->data.extended_irq;
Pablo Greco d6c4c4
-		if (eirq->producer_consumer == ACPI_PRODUCER)
Pablo Greco d6c4c4
+		if (!ctx->skip_producer_check &&
Pablo Greco d6c4c4
+		    eirq->producer_consumer == ACPI_PRODUCER)
Pablo Greco d6c4c4
 			return AE_OK;
Pablo Greco d6c4c4
 		if (ctx->index >= eirq->interrupt_count) {
Pablo Greco d6c4c4
 			ctx->index -= eirq->interrupt_count;
Pablo Greco d6c4c4
@@ -235,8 +237,19 @@ static acpi_status acpi_irq_parse_one_cb(struct acpi_resource *ares,
Pablo Greco d6c4c4
 static int acpi_irq_parse_one(acpi_handle handle, unsigned int index,
Pablo Greco d6c4c4
 			      struct irq_fwspec *fwspec, unsigned long *flags)
Pablo Greco d6c4c4
 {
Pablo Greco d6c4c4
-	struct acpi_irq_parse_one_ctx ctx = { -EINVAL, index, flags, fwspec };
Pablo Greco d6c4c4
+	struct acpi_irq_parse_one_ctx ctx = { -EINVAL, index, flags, fwspec, false };
Pablo Greco d6c4c4
 
Pablo Greco d6c4c4
+	/*
Pablo Greco d6c4c4
+	 * Firmware on arm64-based HPE m400 platform incorrectly marks
Pablo Greco d6c4c4
+	 * its UART interrupt as ACPI_PRODUCER rather than ACPI_CONSUMER.
Pablo Greco d6c4c4
+	 * Don't do the producer/consumer check for that device.
Pablo Greco d6c4c4
+	 */
Pablo Greco d6c4c4
+	if (IS_ENABLED(CONFIG_ARM64)) {
Pablo Greco d6c4c4
+		struct acpi_device *adev = acpi_bus_get_acpi_device(handle);
Pablo Greco d6c4c4
+
Pablo Greco d6c4c4
+		if (adev && !strcmp(acpi_device_hid(adev), "APMC0D08"))
Pablo Greco d6c4c4
+			ctx.skip_producer_check = true;
Pablo Greco d6c4c4
+	}
Pablo Greco d6c4c4
 	acpi_walk_resources(handle, METHOD_NAME__CRS, acpi_irq_parse_one_cb, &ctx;;
Pablo Greco d6c4c4
 	return ctx.rc;
Pablo Greco d6c4c4
 }
Pablo Greco d6c4c4
-- 
Pablo Greco d6c4c4
2.17.0
Pablo Greco d6c4c4