IBM Real-Time "SMI Free" mode driver -v7
PATCH 1/1 IBM Real-Time "SMI Free" mode driver -v7
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.
Documentation/ABI/testing/sysfs-devices-system-ibm-rtl new file +22 -0
@@ -0,0 +1,22 @@ +What: state +Date: Sep 2010 +KernelVersion: 2.6.37 +Contact: Vernon Mauery <[email protected]> +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 <[email protected]> +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. + +
drivers/platform/x86/Kconfig +16 -0
@@ -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
drivers/platform/x86/Makefile +1 -0
@@ -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
drivers/platform/x86/ibm_rtl.c new file +341 -0
341 lines not on this page · raw message
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?
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 2 lines · Matthew Garrett
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.
Quoted 1 line
- 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
Quoted 6 lines
we just limit it to IBM systems in a server/blade chassis and then check for the _RTL_ area?
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 6 lines · Vernon Mauery
Quoted 2 lines · Matthew Garrett
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.
Quoted 5 lines
Quoted 1 line
- 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.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 9 lines · Matthew Garrett
Quoted 6 lines · Vernon Mauery
Quoted 2 lines · Matthew Garrett
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.
Quoted 10 lines
Quoted 5 lines
Quoted 1 line
- 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
Quoted 6 lines · Vernon Mauery
Quoted 1 line · Matthew Garrett
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.
Quoted 11 lines
Quoted 4 lines
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?
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 24 lines · Matthew Garrett
Quoted 6 lines · Vernon Mauery
Quoted 1 line · Matthew Garrett
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.
Quoted 11 lines
Quoted 4 lines
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.
Quoted 4 lines
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
PATCH 1/2 ibm_rtl: DMI match should include all IBM machines
Quoted 1 line · Vernon Mauery
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.
drivers/platform/x86/ibm_rtl.c +5 -24
@@ -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" ), \ + }, \ + }, { } };
PATCH 2/2 ibm_rtl: check for efi_enabled
In reply to Vernon MaueryI 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.
drivers/platform/x86/ibm_rtl.c +2 -1
@@ -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 */