Justin Vreeland 794d92
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
Justin Vreeland 794d92
From: Laura Abbott <labbott@redhat.com>
Justin Vreeland 794d92
Date: Sun, 10 Feb 2019 01:27:54 +0000
Justin Vreeland 794d92
Subject: [PATCH] ipmi: do not configure ipmi for HPE m400
Justin Vreeland 794d92
Justin Vreeland 794d92
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1670017
Justin Vreeland 794d92
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=20147017
Justin Vreeland 794d92
Justin Vreeland 794d92
Commit 913a89f009d9 ("ipmi: Don't initialize anything in the core until
Justin Vreeland 794d92
something uses it") added new locking which broke context.
Justin Vreeland 794d92
Justin Vreeland 794d92
    Message-id: <20180713142210.15700-1-tcamuso@redhat.com>
Justin Vreeland 794d92
    Patchwork-id: 224899
Justin Vreeland 794d92
    O-Subject: [RHEL8 BZ 1583537 1/1] ipmi: do not configure ipmi for HPE m400
Justin Vreeland 794d92
    Bugzilla: 1583537
Justin Vreeland 794d92
    RH-Acked-by: Dean Nelson <dnelson@redhat.com>
Justin Vreeland 794d92
    RH-Acked-by: Al Stone <ahs3@redhat.com>
Justin Vreeland 794d92
    RH-Acked-by: Mark Salter <msalter@redhat.com>
Justin Vreeland 794d92
Justin Vreeland 794d92
    bugzilla:https://bugzilla.redhat.com/show_bug.cgi?id=1583537
Justin Vreeland 794d92
    brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=17150528
Justin Vreeland 794d92
Justin Vreeland 794d92
    RHEL-only
Justin Vreeland 794d92
Justin Vreeland 794d92
    The ARM-based HPE m400 reports host-side ipmi as residing in intel
Justin Vreeland 794d92
    port-io space, which does not exist in ARM processors. Therefore, when
Justin Vreeland 794d92
    running on an m400, host-side ipmi configuration code must simply return
Justin Vreeland 794d92
    zero without trying to configure the host-side ipmi.
Justin Vreeland 794d92
Justin Vreeland 794d92
    This patch prevents panic on boot by averting attempts to configure
Justin Vreeland 794d92
    host-side ipmi on this platform.
Justin Vreeland 794d92
Justin Vreeland 794d92
    Though HPE m400 is not certified with RHEL, and HPE has relegated it to
Justin Vreeland 794d92
    EOL status, the platform is still used extensively in ARM development
Justin Vreeland 794d92
    and test for RHEL.
Justin Vreeland 794d92
Justin Vreeland 794d92
    Testing:
Justin Vreeland 794d92
    Boot without blacklisting ipmi and check to see that no ipmi modules
Justin Vreeland 794d92
    are loaded.
Justin Vreeland 794d92
Justin Vreeland 794d92
    Signed-off-by: Tony Camuso <tcamuso@redhat.com>
Justin Vreeland 794d92
Justin Vreeland 794d92
    cc: Prarit Bhargava <prarit@redhat.com>
Justin Vreeland 794d92
    cc: Brendan Conoboy <blc@redhat.com>
Justin Vreeland 794d92
    cc: Jeff Bastian <jbastian@redhat.com>
Justin Vreeland 794d92
    cc: Scott Herold <sherold@redhat.com>
Justin Vreeland 794d92
    Signed-off-by: Herton R. Krzesinski <herton@redhat.com>
Justin Vreeland 794d92
Justin Vreeland 794d92
Upstream Status: RHEL only
Justin Vreeland 794d92
Signed-off-by: Laura Abbott <labbott@redhat.com>
Justin Vreeland 794d92
Acked-by: Tony Camuso <tcamuso@redhat.com>
Justin Vreeland 794d92
Acked-by: Dean Nelson <dnelson@redhat.com>
Justin Vreeland 794d92
Acked-by: Jarod Wilson <jarod@redhat.com>
Justin Vreeland 794d92
Acked-by: Mark Salter <msalter@redhat.com>
Justin Vreeland 794d92
---
Justin Vreeland 794d92
 drivers/char/ipmi/ipmi_dmi.c        | 15 +++++++++++++++
Justin Vreeland 794d92
 drivers/char/ipmi/ipmi_msghandler.c | 16 +++++++++++++++-
Justin Vreeland 794d92
 2 files changed, 30 insertions(+), 1 deletion(-)
Justin Vreeland 794d92
Justin Vreeland 794d92
diff --git a/drivers/char/ipmi/ipmi_dmi.c b/drivers/char/ipmi/ipmi_dmi.c
Justin Vreeland 794d92
index bbf7029e224b..cf7faa970dd6 100644
Justin Vreeland 794d92
--- a/drivers/char/ipmi/ipmi_dmi.c
Justin Vreeland 794d92
+++ b/drivers/char/ipmi/ipmi_dmi.c
Justin Vreeland 794d92
@@ -215,6 +215,21 @@ static int __init scan_for_dmi_ipmi(void)
Justin Vreeland 794d92
 {
Justin Vreeland 794d92
 	const struct dmi_device *dev = NULL;
Justin Vreeland 794d92
Justin Vreeland 794d92
+#ifdef CONFIG_ARM64
Justin Vreeland 794d92
+	/* RHEL-only
Justin Vreeland 794d92
+	 * If this is ARM-based HPE m400, return now, because that platform
Justin Vreeland 794d92
+	 * reports the host-side ipmi address as intel port-io space, which
Justin Vreeland 794d92
+	 * does not exist in the ARM architecture.
Justin Vreeland 794d92
+	 */
Justin Vreeland 794d92
+	const char *dmistr = dmi_get_system_info(DMI_PRODUCT_NAME);
Justin Vreeland 794d92
+
Justin Vreeland 794d92
+	if (dmistr && (strcmp("ProLiant m400 Server", dmistr) == 0)) {
Justin Vreeland 794d92
+		pr_debug("%s does not support host ipmi\n", dmistr);
Justin Vreeland 794d92
+		return 0;
Justin Vreeland 794d92
+	}
Justin Vreeland 794d92
+	/* END RHEL-only */
Justin Vreeland 794d92
+#endif
Justin Vreeland 794d92
+
Justin Vreeland 794d92
 	while ((dev = dmi_find_device(DMI_DEV_TYPE_IPMI, NULL, dev)))
Justin Vreeland 794d92
 		dmi_decode_ipmi((const struct dmi_header *) dev->device_data);
Justin Vreeland 794d92
Justin Vreeland 794d92
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
Justin Vreeland 794d92
index 737c0b6b24ea..7901e780323b 100644
Justin Vreeland 794d92
--- a/drivers/char/ipmi/ipmi_msghandler.c
Justin Vreeland 794d92
+++ b/drivers/char/ipmi/ipmi_msghandler.c
Justin Vreeland 794d92
@@ -34,6 +34,7 @@
Justin Vreeland 794d92
 #include <linux/nospec.h>
Justin Vreeland 794d92
 #include <linux/vmalloc.h>
Justin Vreeland 794d92
 #include <linux/delay.h>
Justin Vreeland 794d92
+#include <linux/dmi.h>
Justin Vreeland 794d92
Justin Vreeland 794d92
 #define IPMI_DRIVER_VERSION "39.2"
Justin Vreeland 794d92
Justin Vreeland 794d92
@@ -5153,8 +5154,21 @@ static int __init ipmi_init_msghandler_mod(void)
Justin Vreeland 794d92
 {
Justin Vreeland 794d92
 	int rv;
Justin Vreeland 794d92
Justin Vreeland 794d92
-	pr_info("version " IPMI_DRIVER_VERSION "\n");
Justin Vreeland 794d92
+#ifdef CONFIG_ARM64
Justin Vreeland 794d92
+	/* RHEL-only
Justin Vreeland 794d92
+	 * If this is ARM-based HPE m400, return now, because that platform
Justin Vreeland 794d92
+	 * reports the host-side ipmi address as intel port-io space, which
Justin Vreeland 794d92
+	 * does not exist in the ARM architecture.
Justin Vreeland 794d92
+	 */
Justin Vreeland 794d92
+	const char *dmistr = dmi_get_system_info(DMI_PRODUCT_NAME);
Justin Vreeland 794d92
Justin Vreeland 794d92
+	if (dmistr && (strcmp("ProLiant m400 Server", dmistr) == 0)) {
Justin Vreeland 794d92
+		pr_debug("%s does not support host ipmi\n", dmistr);
Justin Vreeland 794d92
+		return -ENOSYS;
Justin Vreeland 794d92
+	}
Justin Vreeland 794d92
+	/* END RHEL-only */
Justin Vreeland 794d92
+#endif
Justin Vreeland 794d92
+	pr_info("version " IPMI_DRIVER_VERSION "\n");
Justin Vreeland 794d92
 	mutex_lock(&ipmi_interfaces_mutex);
Justin Vreeland 794d92
 	rv = ipmi_register_driver();
Justin Vreeland 794d92
 	mutex_unlock(&ipmi_interfaces_mutex);
Justin Vreeland 794d92
-- 
Justin Vreeland 794d92
2.28.0
Justin Vreeland 794d92