* [Patch] IBM Real-Time "SMI Free" mode driver -v7
@ 2010-10-05 22:47 Vernon Mauery
2010-10-21 13:54 ` Matthew Garrett
0 siblings, 1 reply; 9+ messages in thread
From: Vernon Mauery @ 2010-10-05 22:47 UTC (permalink / raw)
To: Linux Kernel Mailing List
Cc: Randy Dunlap, Matthew Garrett, Linux Documentation,
Platform driver x86
After a period of RFC for this driver, I think it is ready
for inclusion in the platform-driver-x86 tree, hopefully to
be staged in the next merge window into Linus's tree.
--Vernon
------------------------------------------------------------
IBM Real-Time "SMI Free" mode driver
This driver supports the Real-Time Linux (RTL) BIOS feature.
The RTL feature allows non-fatal System Management Interrupts
(SMIs) to be disabled on supported IBM platforms and is
intended to be coupled with a user-space daemon to monitor
the hardware in a way that can be prioritized and scheduled
to better suit the requirements for the system.
The Device is presented as a special "_RTL_" table to the OS
in the Extended BIOS Data Area. There is a simple protocol
for entering and exiting the mode at runtime. This driver
creates a simple sysfs interface to allow a simple entry and
exit from RTL mode in the UFI/BIOS.
Since the driver is specific to IBM SystemX hardware (x86-
based servers) it only builds on x86 builds. To reduce the
risk of loading on the wrong hardware, the module uses DMI
information and checks a list of servers that are known to
work.
Signed-off-by: Vernon Mauery <vernux@us.ibm.com>
diff --git a/Documentation/ABI/testing/sysfs-devices-system-ibm-rtl b/Documentation/ABI/testing/sysfs-devices-system-ibm-rtl
new file mode 100644
index 0000000..b82deea
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-devices-system-ibm-rtl
@@ -0,0 +1,22 @@
+What: state
+Date: Sep 2010
+KernelVersion: 2.6.37
+Contact: Vernon Mauery <vernux@us.ibm.com>
+Description: The state file allows a means by which to change in and
+ out of Premium Real-Time Mode (PRTM), as well as the
+ ability to query the current state.
+ 0 => PRTM off
+ 1 => PRTM enabled
+Users: The ibm-prtm userspace daemon uses this interface.
+
+
+What: version
+Date: Sep 2010
+KernelVersion: 2.6.37
+Contact: Vernon Mauery <vernux@us.ibm.com>
+Description: The version file provides a means by which to query
+ the RTL table version that lives in the Extended
+ BIOS Data Area (EBDA).
+Users: The ibm-prtm userspace daemon uses this interface.
+
+
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index cff7cc2..55c6b86 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -590,4 +590,20 @@ config INTEL_IPS
functionality. If in doubt, say Y here; it will only load on
supported platforms.
+config IBM_RTL
+ tristate "Device driver to enable PRTL support"
+ depends on X86 && PCI
+ ---help---
+ Enable support for IBM Premium Real Time Mode (PRTM).
+ This module will allow you the enter and exit PRTM in the BIOS via
+ sysfs on platforms that support this feature. System in PRTM will
+ not receive CPU-generated SMIs for recoverable errors. Use of this
+ feature without proper support may void your hardware warranty.
+
+ If the proper BIOS support is found the driver will load and create
+ /sys/devices/system/ibm_rtl/. The "state" variable will indicate
+ whether or not the BIOS is in PRTM.
+ state = 0 (BIOS SMIs on)
+ state = 1 (BIOS SMIs off)
+
endif # X86_PLATFORM_DEVICES
diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
index 85fb2b8..50fae7a 100644
--- a/drivers/platform/x86/Makefile
+++ b/drivers/platform/x86/Makefile
@@ -30,4 +30,5 @@ obj-$(CONFIG_INTEL_SCU_IPC) += intel_scu_ipc.o
obj-$(CONFIG_RAR_REGISTER) += intel_rar_register.o
obj-$(CONFIG_INTEL_IPS) += intel_ips.o
obj-$(CONFIG_GPIO_INTEL_PMIC) += intel_pmic_gpio.o
+obj-$(CONFIG_IBM_RTL) += ibm_rtl.o
diff --git a/drivers/platform/x86/ibm_rtl.c b/drivers/platform/x86/ibm_rtl.c
new file mode 100644
index 0000000..3c2c6b9
--- /dev/null
+++ b/drivers/platform/x86/ibm_rtl.c
@@ -0,0 +1,341 @@
+/*
+ * IBM Real-Time Linux driver
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Copyright (C) IBM Corporation, 2010
+ *
+ * Author: Keith Mannthey <kmannth@us.ibm.com>
+ * Vernon Mauery <vernux@us.ibm.com>
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/delay.h>
+#include <linux/module.h>
+#include <linux/io.h>
+#include <linux/sysdev.h>
+#include <linux/dmi.h>
+#include <linux/mutex.h>
+#include <asm/bios_ebda.h>
+
+static bool force;
+module_param(force, bool, 0);
+MODULE_PARM_DESC(force, "Force driver load, ignore DMI data");
+
+static bool debug;
+module_param(debug, bool, 0644);
+MODULE_PARM_DESC(debug, "Show debug output");
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Keith Mannthey <kmmanth@us.ibm.com>");
+MODULE_AUTHOR("Vernon Mauery <vernux@us.ibm.com>");
+
+#define RTL_ADDR_TYPE_IO 1
+#define RTL_ADDR_TYPE_MMIO 2
+
+#define RTL_CMD_ENTER_PRTM 1
+#define RTL_CMD_EXIT_PRTM 2
+
+/* The RTL table as presented by the EBDA: */
+struct ibm_rtl_table {
+ char signature[5]; /* signature should be "_RTL_" */
+ u8 version;
+ u8 rt_status;
+ u8 command;
+ u8 command_status;
+ u8 cmd_address_type;
+ u8 cmd_granularity;
+ u8 cmd_offset;
+ u16 reserve1;
+ u32 cmd_port_address; /* platform dependent address */
+ u32 cmd_port_value; /* platform dependent value */
+} __attribute__((packed));
+
+/* to locate "_RTL_" signature do a masked 5-byte integer compare */
+#define RTL_SIGNATURE 0x0000005f4c54525fULL
+#define RTL_MASK 0x000000ffffffffffULL
+
+#define RTL_DEBUG(A, ...) do { \
+ if (debug) \
+ pr_info("ibm-rtl: " A, ##__VA_ARGS__ ); \
+} while (0)
+
+static DEFINE_MUTEX(rtl_lock);
+static struct ibm_rtl_table __iomem *rtl_table;
+static void __iomem *ebda_map;
+static void __iomem *rtl_cmd_addr;
+static u8 rtl_cmd_type;
+static u8 rtl_cmd_width;
+
+static void __iomem *rtl_port_map(phys_addr_t addr, unsigned long len)
+{
+ if (rtl_cmd_type == RTL_ADDR_TYPE_MMIO)
+ return ioremap(addr, len);
+ return ioport_map(addr, len);
+}
+
+static void rtl_port_unmap(void __iomem *addr)
+{
+ if (addr && rtl_cmd_type == RTL_ADDR_TYPE_MMIO)
+ iounmap(addr);
+ else
+ ioport_unmap(addr);
+}
+
+static int ibm_rtl_write(u8 value)
+{
+ int ret = 0, count = 0;
+ static u32 cmd_port_val;
+
+ RTL_DEBUG("%s(%d)\n", __FUNCTION__, value);
+
+ value = value == 1 ? RTL_CMD_ENTER_PRTM : RTL_CMD_EXIT_PRTM;
+
+ mutex_lock(&rtl_lock);
+
+ if (ioread8(&rtl_table->rt_status) != value) {
+ iowrite8(value, &rtl_table->command);
+
+ switch (rtl_cmd_width) {
+ case 8:
+ cmd_port_val = ioread8(&rtl_table->cmd_port_value);
+ RTL_DEBUG("cmd_port_val = %u\n", cmd_port_val);
+ iowrite8((u8)cmd_port_val, rtl_cmd_addr);
+ break;
+ case 16:
+ cmd_port_val = ioread16(&rtl_table->cmd_port_value);
+ RTL_DEBUG("cmd_port_val = %u\n", cmd_port_val);
+ iowrite16((u16)cmd_port_val, rtl_cmd_addr);
+ break;
+ case 32:
+ cmd_port_val = ioread32(&rtl_table->cmd_port_value);
+ RTL_DEBUG("cmd_port_val = %u\n", cmd_port_val);
+ iowrite32(cmd_port_val, rtl_cmd_addr);
+ break;
+ }
+
+ while (ioread8(&rtl_table->command)) {
+ msleep(10);
+ if (count++ > 500) {
+ pr_err("ibm-rtl: Hardware not responding to "
+ "mode switch request\n");
+ ret = -EIO;
+ break;
+ }
+
+ }
+
+ if (ioread8(&rtl_table->command_status)) {
+ RTL_DEBUG("command_status reports failed command\n");
+ ret = -EIO;
+ }
+ }
+
+ mutex_unlock(&rtl_lock);
+ return ret;
+}
+
+static ssize_t rtl_show_version(struct sysdev_class * dev,
+ struct sysdev_class_attribute *attr,
+ char *buf)
+{
+ return sprintf(buf, "%d\n", (int)ioread8(&rtl_table->version));
+}
+
+static ssize_t rtl_show_state(struct sysdev_class *dev,
+ struct sysdev_class_attribute *attr,
+ char *buf)
+{
+ return sprintf(buf, "%d\n", ioread8(&rtl_table->rt_status));
+}
+
+static ssize_t rtl_set_state(struct sysdev_class *dev,
+ struct sysdev_class_attribute *attr,
+ const char *buf,
+ size_t count)
+{
+ ssize_t ret;
+
+ if (count < 1 || count > 2)
+ return -EINVAL;
+
+ switch (buf[0]) {
+ case '0':
+ ret = ibm_rtl_write(0);
+ break;
+ case '1':
+ ret = ibm_rtl_write(1);
+ break;
+ default:
+ ret = -EINVAL;
+ }
+ if (ret >= 0)
+ ret = count;
+
+ return ret;
+}
+
+static struct sysdev_class class_rtl = {
+ .name = "ibm_rtl",
+};
+
+static SYSDEV_CLASS_ATTR(version, S_IRUGO, rtl_show_version, NULL);
+static SYSDEV_CLASS_ATTR(state, 0600, rtl_show_state, rtl_set_state);
+
+static struct sysdev_class_attribute *rtl_attributes[] = {
+ &attr_version,
+ &attr_state,
+ NULL
+};
+
+
+static int rtl_setup_sysfs(void) {
+ int ret, i;
+ ret = sysdev_class_register(&class_rtl);
+
+ if (!ret) {
+ for (i = 0; rtl_attributes[i]; i ++)
+ sysdev_class_create_file(&class_rtl, rtl_attributes[i]);
+ }
+ return ret;
+}
+
+static void rtl_teardown_sysfs(void) {
+ int i;
+ for (i = 0; rtl_attributes[i]; i ++)
+ sysdev_class_remove_file(&class_rtl, rtl_attributes[i]);
+ sysdev_class_unregister(&class_rtl);
+}
+
+static int dmi_check_cb(const struct dmi_system_id *id)
+{
+ RTL_DEBUG("found IBM server '%s'\n", id->ident);
+ return 0;
+}
+
+#define ibm_dmi_entry(NAME, TYPE) \
+{ \
+ .ident = NAME, \
+ .matches = { \
+ DMI_MATCH(DMI_SYS_VENDOR, "IBM"), \
+ DMI_MATCH(DMI_PRODUCT_NAME, TYPE), \
+ }, \
+ .callback = dmi_check_cb \
+}
+
+static struct dmi_system_id __initdata ibm_rtl_dmi_table[] = {
+ ibm_dmi_entry("BladeCenter LS21", "7971"),
+ ibm_dmi_entry("BladeCenter LS22", "7901"),
+ ibm_dmi_entry("BladeCenter HS21 XM", "7995"),
+ ibm_dmi_entry("BladeCenter HS22", "7870"),
+ ibm_dmi_entry("BladeCenter HS22V", "7871"),
+ ibm_dmi_entry("System x3550 M2", "7946"),
+ ibm_dmi_entry("System x3650 M2", "7947"),
+ ibm_dmi_entry("System x3550 M3", "7944"),
+ ibm_dmi_entry("System x3650 M3", "7945"),
+ { }
+};
+
+static int __init ibm_rtl_init(void) {
+ unsigned long ebda_addr, ebda_size;
+ unsigned int ebda_kb;
+ int ret = -ENODEV, i;
+
+ if (force)
+ pr_warning("ibm-rtl: module loaded by force\n");
+ /* first ensure that we are running on IBM HW */
+ else if (!dmi_check_system(ibm_rtl_dmi_table))
+ return -ENODEV;
+
+ /* Get the address for the Extended BIOS Data Area */
+ ebda_addr = get_bios_ebda();
+ if (!ebda_addr) {
+ RTL_DEBUG("no BIOS EBDA found\n");
+ return -ENODEV;
+ }
+
+ ebda_map = ioremap(ebda_addr, 4);
+ if (!ebda_map)
+ return -ENOMEM;
+
+ /* First word in the EDBA is the Size in KB */
+ ebda_kb = ioread16(ebda_map);
+ RTL_DEBUG("EBDA is %d kB\n", ebda_kb);
+
+ if (ebda_kb == 0)
+ goto out;
+
+ iounmap(ebda_map);
+ ebda_size = ebda_kb*1024;
+
+ /* Remap the whole table */
+ ebda_map = ioremap(ebda_addr, ebda_size);
+ if (!ebda_map)
+ return -ENOMEM;
+
+ /* search for the _RTL_ signature at the start of the table */
+ for (i = 0 ; i < ebda_size/sizeof(unsigned int); i++) {
+ struct ibm_rtl_table __iomem * tmp;
+ tmp = (struct ibm_rtl_table __iomem *) (ebda_map+i);
+ if ((readq(&tmp->signature) & RTL_MASK) == RTL_SIGNATURE) {
+ phys_addr_t addr;
+ unsigned int plen;
+ RTL_DEBUG("found RTL_SIGNATURE at %#llx\n", (u64)tmp);
+ rtl_table = tmp;
+ /* The address, value, width and offset are platform
+ * dependent and found in the ibm_rtl_table */
+ rtl_cmd_width = ioread8(&rtl_table->cmd_granularity);
+ rtl_cmd_type = ioread8(&rtl_table->cmd_address_type);
+ RTL_DEBUG("rtl_cmd_width = %u, rtl_cmd_type = %u\n",
+ rtl_cmd_width, rtl_cmd_type);
+ addr = ioread32(&rtl_table->cmd_port_address);
+ RTL_DEBUG("addr = %#llx\n", addr);
+ plen = rtl_cmd_width/sizeof(char);
+ rtl_cmd_addr = rtl_port_map(addr, plen);
+ RTL_DEBUG("rtl_cmd_addr = %#llx\n", (u64)rtl_cmd_addr);
+ if (!rtl_cmd_addr) {
+ ret = -ENOMEM;
+ break;
+ }
+ ret = rtl_setup_sysfs();
+ break;
+ }
+ }
+
+out:
+ if (ret) {
+ iounmap(ebda_map);
+ rtl_port_unmap(rtl_cmd_addr);
+ }
+
+ return ret;
+}
+
+static void __exit ibm_rtl_exit(void)
+{
+ if (rtl_table) {
+ RTL_DEBUG("cleaning up");
+ /* do not leave the machine in SMI-free mode */
+ ibm_rtl_write(0);
+ /* unmap, unlink and remove all traces */
+ rtl_teardown_sysfs();
+ iounmap(ebda_map);
+ rtl_port_unmap(rtl_cmd_addr);
+ }
+}
+
+module_init(ibm_rtl_init);
+module_exit(ibm_rtl_exit);
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [Patch] IBM Real-Time "SMI Free" mode driver -v7
2010-10-05 22:47 [Patch] IBM Real-Time "SMI Free" mode driver -v7 Vernon Mauery
@ 2010-10-21 13:54 ` Matthew Garrett
2010-10-21 14:23 ` Vernon Mauery
0 siblings, 1 reply; 9+ messages in thread
From: Matthew Garrett @ 2010-10-21 13:54 UTC (permalink / raw)
To: Vernon Mauery
Cc: Linux Kernel Mailing List, Randy Dunlap, Linux Documentation,
Platform driver x86
Applied, thanks. It'd be nice if we didn't have to rely on DMI,
especially since enterprise customers often end up running later kernels
- is there any other way to determine that this is safe to load? Could
we just limit it to IBM systems in a server/blade chassis and then check
for the _RTL_ area?
--
Matthew Garrett | mjg59@srcf.ucam.org
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Patch] IBM Real-Time "SMI Free" mode driver -v7
2010-10-21 13:54 ` Matthew Garrett
@ 2010-10-21 14:23 ` Vernon Mauery
2010-10-21 14:25 ` Matthew Garrett
0 siblings, 1 reply; 9+ messages in thread
From: Vernon Mauery @ 2010-10-21 14:23 UTC (permalink / raw)
To: Matthew Garrett
Cc: Linux Kernel Mailing List, Randy Dunlap, Linux Documentation,
Platform driver x86
On 21-Oct-2010 02:54 PM, Matthew Garrett wrote:
>Applied, thanks. It'd be nice if we didn't have to rely on DMI,
>especially since enterprise customers often end up running later kernels
I am not sure what you mean here by problems with DMI running later
kernels.
>- is there any other way to determine that this is safe to load? Could
I can't think of anything off the top of my head that would allow us to
ensure that this is only loaded on IBM systems. DMI is pretty good
about that.
--Vernon
>we just limit it to IBM systems in a server/blade chassis and then check
>for the _RTL_ area?
>
>--
>Matthew Garrett | mjg59@srcf.ucam.org
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Patch] IBM Real-Time "SMI Free" mode driver -v7
2010-10-21 14:23 ` Vernon Mauery
@ 2010-10-21 14:25 ` Matthew Garrett
2010-10-21 14:38 ` Vernon Mauery
0 siblings, 1 reply; 9+ messages in thread
From: Matthew Garrett @ 2010-10-21 14:25 UTC (permalink / raw)
To: Vernon Mauery
Cc: Linux Kernel Mailing List, Randy Dunlap, Linux Documentation,
Platform driver x86
On Thu, Oct 21, 2010 at 07:23:19AM -0700, Vernon Mauery wrote:
> On 21-Oct-2010 02:54 PM, Matthew Garrett wrote:
>> Applied, thanks. It'd be nice if we didn't have to rely on DMI,
>> especially since enterprise customers often end up running later kernels
>
> I am not sure what you mean here by problems with DMI running later
> kernels.
Oops, sorry! I mean running on older kernels.
>> - is there any other way to determine that this is safe to load? Could
>
> I can't think of anything off the top of my head that would allow us to
> ensure that this is only loaded on IBM systems. DMI is pretty good
> about that.
I'd suggest using DMI to verify that it's an IBM, and perhaps also using
DMI to check that it's a server or blade rather than a laptop or
desktop. After that you could just check the ebda rather than having to
have an entry for every specific machine.
--
Matthew Garrett | mjg59@srcf.ucam.org
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Patch] IBM Real-Time "SMI Free" mode driver -v7
2010-10-21 14:25 ` Matthew Garrett
@ 2010-10-21 14:38 ` Vernon Mauery
2010-10-21 14:42 ` Matthew Garrett
0 siblings, 1 reply; 9+ messages in thread
From: Vernon Mauery @ 2010-10-21 14:38 UTC (permalink / raw)
To: Matthew Garrett
Cc: Linux Kernel Mailing List, Randy Dunlap, Linux Documentation,
Platform driver x86
On 21-Oct-2010 03:25 PM, Matthew Garrett wrote:
>On Thu, Oct 21, 2010 at 07:23:19AM -0700, Vernon Mauery wrote:
>> On 21-Oct-2010 02:54 PM, Matthew Garrett wrote:
>>> Applied, thanks. It'd be nice if we didn't have to rely on DMI,
>>> especially since enterprise customers often end up running later kernels
>>
>> I am not sure what you mean here by problems with DMI running later
>> kernels.
>
>Oops, sorry! I mean running on older kernels.
Do older kernels not have DMI support? I would think that if an
enterprise distribution wanted this driver they would likely already
have DMI support backported as well.
Or they can work with me to find a way that works in that kernel. I was
thinking that in the current (and future) kernel, DMI was the best way
to go.
>>> - is there any other way to determine that this is safe to load? Could
>>
>> I can't think of anything off the top of my head that would allow us to
>> ensure that this is only loaded on IBM systems. DMI is pretty good
>> about that.
>
>I'd suggest using DMI to verify that it's an IBM, and perhaps also using
>DMI to check that it's a server or blade rather than a laptop or
>desktop. After that you could just check the ebda rather than having to
>have an entry for every specific machine.
I went for a better safe than sorry route. Before I added the DMI
checking I had some reports of this getting loaded on non-IBM hardware
and it came up with some nasty error messages. I figured since I knew
exactly which platforms have support, I could just limit the driver to
those. Then there is the force parameter that allows a user to ignore
the DMI data and try to load the driver anyway.
--Vernon
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Patch] IBM Real-Time "SMI Free" mode driver -v7
2010-10-21 14:38 ` Vernon Mauery
@ 2010-10-21 14:42 ` Matthew Garrett
2010-10-21 15:09 ` Vernon Mauery
0 siblings, 1 reply; 9+ messages in thread
From: Matthew Garrett @ 2010-10-21 14:42 UTC (permalink / raw)
To: Vernon Mauery
Cc: Linux Kernel Mailing List, Randy Dunlap, Linux Documentation,
Platform driver x86
On Thu, Oct 21, 2010 at 07:38:21AM -0700, Vernon Mauery wrote:
> On 21-Oct-2010 03:25 PM, Matthew Garrett wrote:
>> Oops, sorry! I mean running on older kernels.
>
> Do older kernels not have DMI support? I would think that if an
> enterprise distribution wanted this driver they would likely already
> have DMI support backported as well.
I mean that they may run the current driver on newer hardware that isn't
in the DMI table, and that may be the only thing preventing it from
working.
>> I'd suggest using DMI to verify that it's an IBM, and perhaps also using
>> DMI to check that it's a server or blade rather than a laptop or
>> desktop. After that you could just check the ebda rather than having to
>> have an entry for every specific machine.
>
> I went for a better safe than sorry route. Before I added the DMI
> checking I had some reports of this getting loaded on non-IBM hardware
> and it came up with some nasty error messages. I figured since I knew
> exactly which platforms have support, I could just limit the driver to
> those. Then there is the force parameter that allows a user to ignore
> the DMI data and try to load the driver anyway.
It's preferable to have the driver be able to support future hardware
built to the same spec without having to add extra IDs. It's easy to
make sure that you're loading on an IBM server - are there any of these
that have the _RTL_ header but will break?
--
Matthew Garrett | mjg59@srcf.ucam.org
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Patch] IBM Real-Time "SMI Free" mode driver -v7
2010-10-21 14:42 ` Matthew Garrett
@ 2010-10-21 15:09 ` Vernon Mauery
2010-10-22 21:13 ` [Patch 1/2] ibm_rtl: DMI match should include all IBM machines Vernon Mauery
2010-10-22 21:17 ` [Patch 2/2] ibm_rtl: check for efi_enabled Vernon Mauery
0 siblings, 2 replies; 9+ messages in thread
From: Vernon Mauery @ 2010-10-21 15:09 UTC (permalink / raw)
To: Matthew Garrett
Cc: Linux Kernel Mailing List, Randy Dunlap, Linux Documentation,
Platform driver x86
On 21-Oct-2010 03:42 PM, Matthew Garrett wrote:
>On Thu, Oct 21, 2010 at 07:38:21AM -0700, Vernon Mauery wrote:
>> On 21-Oct-2010 03:25 PM, Matthew Garrett wrote:
>>> Oops, sorry! I mean running on older kernels.
>>
>> Do older kernels not have DMI support? I would think that if an
>> enterprise distribution wanted this driver they would likely already
>> have DMI support backported as well.
>
>I mean that they may run the current driver on newer hardware that isn't
>in the DMI table, and that may be the only thing preventing it from
>working.
>
>>> I'd suggest using DMI to verify that it's an IBM, and perhaps also using
>>> DMI to check that it's a server or blade rather than a laptop or
>>> desktop. After that you could just check the ebda rather than having to
>>> have an entry for every specific machine.
>>
>> I went for a better safe than sorry route. Before I added the DMI
>> checking I had some reports of this getting loaded on non-IBM hardware
>> and it came up with some nasty error messages. I figured since I knew
>> exactly which platforms have support, I could just limit the driver to
>> those. Then there is the force parameter that allows a user to ignore
>> the DMI data and try to load the driver anyway.
>
>It's preferable to have the driver be able to support future hardware
>built to the same spec without having to add extra IDs. It's easy to
>make sure that you're loading on an IBM server - are there any of these
>that have the _RTL_ header but will break?
No, if it has the _RTL_ header it should be fine. I was more concerned
about the driver trying to map the EBDA and reading through it on
non-ibm platforms, so I guess just a check to see that it is IBM should
be sufficient. Let me get a patch that does that.
--Vernon
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Patch 1/2] ibm_rtl: DMI match should include all IBM machines
2010-10-21 15:09 ` Vernon Mauery
@ 2010-10-22 21:13 ` Vernon Mauery
2010-10-22 21:17 ` [Patch 2/2] ibm_rtl: check for efi_enabled Vernon Mauery
1 sibling, 0 replies; 9+ messages in thread
From: Vernon Mauery @ 2010-10-22 21:13 UTC (permalink / raw)
To: Matthew Garrett
Cc: Linux Kernel Mailing List, Randy Dunlap, Platform driver x86
On 21-Oct-2010 08:09 AM, Vernon Mauery wrote:
>No, if it has the _RTL_ header it should be fine. I was more
>concerned about the driver trying to map the EBDA and reading through
>it on non-ibm platforms, so I guess just a check to see that it is
>IBM should be sufficient. Let me get a patch that does that.
This patch should do just that:
--Vernon
ibm_rtl: Loosen the DMI criteria to match all IBM machines
Allow all IBM machines to pass the DMI check so that we
don't have to add them one by one to the driver. Any IBM
machine that has the _RTL_ table in the EBDA will work.
Signed-off-by: Vernon Mauery <vernux@us.ibm.com>
diff --git a/drivers/platform/x86/ibm_rtl.c b/drivers/platform/x86/ibm_rtl.c
index 3c2c6b9..c5a0061 100644
--- a/drivers/platform/x86/ibm_rtl.c
+++ b/drivers/platform/x86/ibm_rtl.c
@@ -220,32 +220,13 @@ static void rtl_teardown_sysfs(void) {
sysdev_class_unregister(&class_rtl);
}
-static int dmi_check_cb(const struct dmi_system_id *id)
-{
- RTL_DEBUG("found IBM server '%s'\n", id->ident);
- return 0;
-}
-
-#define ibm_dmi_entry(NAME, TYPE) \
-{ \
- .ident = NAME, \
- .matches = { \
- DMI_MATCH(DMI_SYS_VENDOR, "IBM"), \
- DMI_MATCH(DMI_PRODUCT_NAME, TYPE), \
- }, \
- .callback = dmi_check_cb \
-}
static struct dmi_system_id __initdata ibm_rtl_dmi_table[] = {
- ibm_dmi_entry("BladeCenter LS21", "7971"),
- ibm_dmi_entry("BladeCenter LS22", "7901"),
- ibm_dmi_entry("BladeCenter HS21 XM", "7995"),
- ibm_dmi_entry("BladeCenter HS22", "7870"),
- ibm_dmi_entry("BladeCenter HS22V", "7871"),
- ibm_dmi_entry("System x3550 M2", "7946"),
- ibm_dmi_entry("System x3650 M2", "7947"),
- ibm_dmi_entry("System x3550 M3", "7944"),
- ibm_dmi_entry("System x3650 M3", "7945"),
+ { \
+ .matches = { \
+ DMI_MATCH(DMI_SYS_VENDOR, "IBM"), \
+ }, \
+ },
{ }
};
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [Patch 2/2] ibm_rtl: check for efi_enabled
2010-10-21 15:09 ` Vernon Mauery
2010-10-22 21:13 ` [Patch 1/2] ibm_rtl: DMI match should include all IBM machines Vernon Mauery
@ 2010-10-22 21:17 ` Vernon Mauery
1 sibling, 0 replies; 9+ messages in thread
From: Vernon Mauery @ 2010-10-22 21:17 UTC (permalink / raw)
To: Matthew Garrett
Cc: Linux Kernel Mailing List, Randy Dunlap, Platform driver x86
I tested ibm_rtl on an IBM machine that is supported by this driver in
Legacy BIOS mode, but which was running in UEFI mode and the system
complained about remapping the EBDA because the EBDA should not have
been there to start with. This patch fixes that:
--Vernon
ibm_rtl: _RTL_ is not available in UEFI mode
Some of the IBM servers that are supported by ibm_rtl
can run in both Legacy mode (BIOS) and in UEFI mode.
When running in UEFI mode, it is possible that the
EBDA table exists but cannot be mapped and reports
errors. We need to make sure that by default we don't
try to probe the machines if they are running in UEFI
mode.
Signed-off-by: Vernon Mauery <vernux@us.ibm.com>
diff --git a/drivers/platform/x86/ibm_rtl.c b/drivers/platform/x86/ibm_rtl.c
index c5a0061..3cff0e5 100644
--- a/drivers/platform/x86/ibm_rtl.c
+++ b/drivers/platform/x86/ibm_rtl.c
@@ -28,6 +28,7 @@
#include <linux/io.h>
#include <linux/sysdev.h>
#include <linux/dmi.h>
+#include <linux/efi.h>
#include <linux/mutex.h>
#include <asm/bios_ebda.h>
@@ -238,7 +239,7 @@ static int __init ibm_rtl_init(void) {
if (force)
pr_warning("ibm-rtl: module loaded by force\n");
/* first ensure that we are running on IBM HW */
- else if (!dmi_check_system(ibm_rtl_dmi_table))
+ else if (efi_enabled || !dmi_check_system(ibm_rtl_dmi_table))
return -ENODEV;
/* Get the address for the Extended BIOS Data Area */
^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2010-10-22 21:17 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-05 22:47 [Patch] IBM Real-Time "SMI Free" mode driver -v7 Vernon Mauery
2010-10-21 13:54 ` Matthew Garrett
2010-10-21 14:23 ` Vernon Mauery
2010-10-21 14:25 ` Matthew Garrett
2010-10-21 14:38 ` Vernon Mauery
2010-10-21 14:42 ` Matthew Garrett
2010-10-21 15:09 ` Vernon Mauery
2010-10-22 21:13 ` [Patch 1/2] ibm_rtl: DMI match should include all IBM machines Vernon Mauery
2010-10-22 21:17 ` [Patch 2/2] ibm_rtl: check for efi_enabled Vernon Mauery
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox