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