ACPI & driver patch candidates for 2.6.34
Subsystems (7)
Len Brown
reviewerhere is the current queue for 2.6.34
Len Brown
reviewerPATCH 1/8 sony-laptop - remove private workqueue, use keventd instead
From: Dmitry Torokhov <[email protected]>
If we reschedule work instead of having work function sleep for 10 msecs between reads from kfifo we can safely use the main workqueue (keventd) and not bother with creating driver-private one.
--- drivers/platform/x86/sony-laptop.c | 71 ++++++++++++++++++++---------------- 1 files changed, 39 insertions(+), 32 deletions(-)
drivers/platform/x86/sony-laptop.c +39 -32
@@ -145,7 +145,6 @@ struct sony_laptop_input_s {struct input_dev *key_dev;struct kfifo fifo;spinlock_t fifo_lock; -struct workqueue_struct *wq; };static struct sony_laptop_input_s sony_laptop_input = {
@@ -301,18 +300,28 @@ static int sony_laptop_input_keycode_map[] = {/* release buttons after a short delay if pressed */ static void do_sony_laptop_release_key (struct work_struct *work) { +struct delayed_work *dwork = + container_of(work, struct delayed_work, work);struct sony_laptop_keypress kp; +unsigned long flags; + +spin_lock_irqsave (&sony_laptop_input.fifo_lock, flags); -while (kfifo_out_locked (&sony_laptop_input.fifo, (unsigned char *)&kp, -sizeof (kp), &sony_laptop_input.fifo_lock) - ==sizeof (kp)) { -msleep (10 ); +if (kfifo_out (&sony_laptop_input.fifo, + (unsigned char *)&kp,sizeof (kp)) ==sizeof (kp)) {input_report_key (kp.dev, kp.key,0 );input_sync (kp.dev); } + +/* If there is something in the fifo schedule next release. */ +if (kfifo_len (&sony_laptop_input.fifo) !=0 ) +schedule_delayed_work (dwork,msecs_to_jiffies (10 )); + +spin_unlock_irqrestore (&sony_laptop_input.fifo_lock, flags); } -static DECLARE_WORK(sony_laptop_release_key_work, - do_sony_laptop_release_key); + +static DECLARE_DELAYED_WORK(sony_laptop_release_key_work, + do_sony_laptop_release_key);/* forward event to the input subsystem */ static void sony_laptop_report_input_event (u8 event)
@@ -366,13 +375,13 @@ static void sony_laptop_report_input_event(u8 event)/* we emit the scancode so we can always remap the key */ input_event (kp.dev,EV_MSC ,MSC_SCAN , event);input_sync (kp.dev); -kfifo_in_locked (&sony_laptop_input.fifo, - (unsigned char *)&kp,sizeof (kp), - &sony_laptop_input.fifo_lock); -if (!work_pending (&sony_laptop_release_key_work)) -queue_work (sony_laptop_input.wq, - &sony_laptop_release_key_work); +/* schedule key release */ +kfifo_in_locked (&sony_laptop_input.fifo, + (unsigned char *)&kp,sizeof (kp), + &sony_laptop_input.fifo_lock); +schedule_delayed_work (&sony_laptop_release_key_work, +msecs_to_jiffies (10 )); }else dprintk ("unknown input event %.2x\n" , event); }
@@ -390,27 +399,18 @@ static int sony_laptop_setup_input(struct acpi_device *acpi_device)/* kfifo */ spin_lock_init (&sony_laptop_input.fifo_lock); - error = -kfifo_alloc (&sony_laptop_input.fifo,SONY_LAPTOP_BUF_SIZE ,GFP_KERNEL ); + error =kfifo_alloc (&sony_laptop_input.fifo, +SONY_LAPTOP_BUF_SIZE ,GFP_KERNEL );if (error) { printk(KERN_ERR DRV_PFX "kfifo_alloc failed\n"); goto err_dec_users; } -/* init workqueue */ - sony_laptop_input.wq =create_singlethread_workqueue ("sony-laptop" ); -if (!sony_laptop_input.wq) { - printk(KERN_ERR DRV_PFX - "Unable to create workqueue.\n"); - error = -ENXIO ; - goto err_free_kfifo; - } -/* input keys */ key_dev =input_allocate_device ();if (!key_dev) { error = -ENOMEM ; - goto err_destroy_wq; + goto err_free_kfifo; } key_dev->name ="Sony Vaio Keys" ;
@@ -473,9 +473,6 @@ err_unregister_keydev: err_free_keydev:input_free_device (key_dev); -err_destroy_wq: -destroy_workqueue (sony_laptop_input.wq); - err_free_kfifo:kfifo_free (&sony_laptop_input.fifo);
@@ -486,12 +483,23 @@ err_dec_users:static void sony_laptop_remove_input (void ) { -/* cleanup only after the last user has gone */ +struct sony_laptop_keypress kp = {NULL }; + +/* Cleanup only after the last user has gone */ if (!atomic_dec_and_test (&sony_laptop_input.users))return ; -/* flush workqueue first */ -flush_workqueue (sony_laptop_input.wq); +cancel_delayed_work_sync (&sony_laptop_release_key_work); + +/* +* Generate key-up events for remaining keys. Note that we don't +* need locking since nobody is adding new events to the kfifo. +*/ +while (kfifo_out (&sony_laptop_input.fifo, + (unsigned char *)&kp,sizeof (kp)) ==sizeof (kp)) { +input_report_key (kp.dev, kp.key,0 ); +input_sync (kp.dev); + }/* destroy input devs */ input_unregister_device (sony_laptop_input.key_dev);
@@ -502,7 +510,6 @@ static void sony_laptop_remove_input(void) sony_laptop_input.jog_dev =NULL ; } -destroy_workqueue (sony_laptop_input.wq);kfifo_free (&sony_laptop_input.fifo); }
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 2/8 sony-laptop - simplify keymap initialization
In reply to Len BrownFrom: Dmitry Torokhov <[email protected]>
Also use input_set_capability() helper instead of manipulating bits directly.
--- drivers/platform/x86/sony-laptop.c | 20 ++++++++------------ 1 files changed, 8 insertions(+), 12 deletions(-)
drivers/platform/x86/sony-laptop.c +8 -12
@@ -419,18 +419,15 @@ static int sony_laptop_setup_input(struct acpi_device *acpi_device) key_dev->dev.parent = &acpi_device->dev;/* Initialize the Input Drivers: special keys */ -set_bit (EV_KEY , key_dev->evbit); -set_bit (EV_MSC , key_dev->evbit); -set_bit (MSC_SCAN , key_dev->mscbit); +input_set_capability (key_dev,EV_MSC ,MSC_SCAN ); + +__set_bit (EV_KEY , key_dev->evbit); key_dev->keycodesize =sizeof (sony_laptop_input_keycode_map[0 ]); key_dev->keycodemax =ARRAY_SIZE (sony_laptop_input_keycode_map); key_dev->keycode = &sony_laptop_input_keycode_map; -for (i =0 ; i <ARRAY_SIZE (sony_laptop_input_keycode_map); i++) { -if (sony_laptop_input_keycode_map[i] !=KEY_RESERVED ) { -set_bit (sony_laptop_input_keycode_map[i], - key_dev->keybit); - } - } +for (i =0 ; i <ARRAY_SIZE (sony_laptop_input_keycode_map); i++) +__set_bit (sony_laptop_input_keycode_map[i], key_dev->keybit); +__clear_bit (KEY_RESERVED , key_dev->keybit); error =input_register_device (key_dev);if (error)
@@ -450,9 +447,8 @@ static int sony_laptop_setup_input(struct acpi_device *acpi_device) jog_dev->id.vendor =PCI_VENDOR_ID_SONY ; key_dev->dev.parent = &acpi_device->dev; - jog_dev->evbit[0 ] =BIT_MASK (EV_KEY ) |BIT_MASK (EV_REL ); - jog_dev->keybit[BIT_WORD (BTN_MOUSE )] =BIT_MASK (BTN_MIDDLE ); - jog_dev->relbit[0 ] =BIT_MASK (REL_WHEEL ); +input_set_capability (jog_dev,EV_KEY ,BTN_MIDDLE ); +input_set_capability (jog_dev,EV_REL ,REL_WHEEL ); error =input_register_device (jog_dev);if (error)
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 3/8 sony-laptop - switch from workqueue to a timer
In reply to Len BrownFrom: Dmitry Torokhov <[email protected]>
The function that is executing in workqueue context does not need to sleep so let's switch to a timer which is more lightweight.
--- drivers/platform/x86/sony-laptop.c | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-)
drivers/platform/x86/sony-laptop.c +10 -10
@@ -145,6 +145,7 @@ struct sony_laptop_input_s {struct input_dev *key_dev;struct kfifo fifo;spinlock_t fifo_lock; +struct timer_list release_key_timer; };static struct sony_laptop_input_s sony_laptop_input = {
@@ -298,10 +299,8 @@ static int sony_laptop_input_keycode_map[] = { };/* release buttons after a short delay if pressed */ -static void do_sony_laptop_release_key (struct work_struct *work) +static void do_sony_laptop_release_key (unsigned long unused) { -struct delayed_work *dwork = - container_of(work, struct delayed_work, work);struct sony_laptop_keypress kp;unsigned long flags;
@@ -315,14 +314,12 @@ static void do_sony_laptop_release_key(struct work_struct *work)/* If there is something in the fifo schedule next release. */ if (kfifo_len (&sony_laptop_input.fifo) !=0 ) -schedule_delayed_work (dwork,msecs_to_jiffies (10 )); +mod_timer (&sony_laptop_input.release_key_timer, + jiffies +msecs_to_jiffies (10 ));spin_unlock_irqrestore (&sony_laptop_input.fifo_lock, flags); } -static DECLARE_DELAYED_WORK(sony_laptop_release_key_work, - do_sony_laptop_release_key); -/* forward event to the input subsystem */ static void sony_laptop_report_input_event (u8 event) {
@@ -380,8 +377,8 @@ static void sony_laptop_report_input_event(u8 event)kfifo_in_locked (&sony_laptop_input.fifo, (unsigned char *)&kp,sizeof (kp), &sony_laptop_input.fifo_lock); -schedule_delayed_work (&sony_laptop_release_key_work, -msecs_to_jiffies (10 )); +mod_timer (&sony_laptop_input.release_key_timer, + jiffies +msecs_to_jiffies (10 )); }else dprintk ("unknown input event %.2x\n" , event); }
@@ -406,6 +403,9 @@ static int sony_laptop_setup_input(struct acpi_device *acpi_device) goto err_dec_users; } +setup_timer (&sony_laptop_input.release_key_timer, + do_sony_laptop_release_key,0 ); +/* input keys */ key_dev =input_allocate_device ();if (!key_dev) {
@@ -485,7 +485,7 @@ static void sony_laptop_remove_input(void)if (!atomic_dec_and_test (&sony_laptop_input.users))return ; -cancel_delayed_work_sync (&sony_laptop_release_key_work); +del_timer_sync (&sony_laptop_input.release_key_timer);/* * Generate key-up events for remaining keys. Note that we don't
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 4/8 ACPI, IO memory pre-mapping and atomic accessing
In reply to Len BrownFrom: Huang Ying <[email protected]>
Some ACPI IO accessing need to be done in atomic context. For example, APEI ERST operations may be used for permanent storage in hardware error handler. That is, it may be called in atomic contexts such as IRQ or NMI, etc. And, ERST/EINJ implement their operations via IO memory/port accessing. But the IO memory accessing method provided by ACPI (acpi_read/acpi_write) maps the IO memory during it is accessed, so it can not be used in atomic context. To solve the issue, the IO memory should be pre-mapped during EINJ/ERST initializing. A linked list is used to record which memory area has been mapped, when memory is accessed in hardware error handler, search the linked list for the mapped virtual address from the given physical address.
--- drivers/acpi/Makefile | 1 + drivers/acpi/atomicio.c | 360 +++++++++++++++++++++++++++++++++++++++++++++++ include/acpi/atomicio.h | 10 ++ 3 files changed, 371 insertions(+), 0 deletions(-) create mode 100644 drivers/acpi/atomicio.c create mode 100644 include/acpi/atomicio.h
drivers/acpi/Makefile +1 -0
@@ -19,6 +19,7 @@ obj-y += acpi.o \ # All the builtin files are in the "acpi." module_param namespace. acpi-y += osl.o utils.o reboot.o +acpi-y += atomicio.o acpi-y += hest.o # sleep related files
drivers/acpi/atomicio.c new file +360 -0
360 lines not on this page · raw message
include/acpi/atomicio.h new file +10 -0
@@ -0,0 +1,10 @@ +#ifndef ACPI_ATOMIC_IO_H +#define ACPI_ATOMIC_IO_H + +int acpi_pre_map_gar (struct acpi_generic_address *reg); +int acpi_post_unmap_gar (struct acpi_generic_address *reg); + +int acpi_atomic_read (u64 *val,struct acpi_generic_address *reg); +int acpi_atomic_write (u64 val,struct acpi_generic_address *reg); + +#endif
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 5/8 ACPI, APEI, APEI supporting infrastructure
In reply to Len BrownFrom: Huang Ying <[email protected]>
APEI stands for ACPI Platform Error Interface, which allows to report errors (for example from the chipset) to the operating system. This improves NMI handling especially. In addition it supports error serialization and error injection.
For more information about APEI, please refer to ACPI Specification version 4.0, chapter 17.
This patch provides some common functions used by more than one APEI tables, mainly framework of interpreter for EINJ and ERST.
A machine readable language is defined for EINJ and ERST for OS to execute, and so to drive the firmware to fulfill the corresponding functions. The machine language for EINJ and ERST is compatible, so a common framework is defined for them.
--- drivers/acpi/Kconfig | 2 + drivers/acpi/Makefile | 2 + drivers/acpi/apei/Kconfig | 9 + drivers/acpi/apei/Makefile | 3 + drivers/acpi/apei/apei-base.c | 572 +++++++++++++++++++++++++++++++++++++ drivers/acpi/apei/apei-internal.h | 95 ++++++ 6 files changed, 683 insertions(+), 0 deletions(-) create mode 100644 drivers/acpi/apei/Kconfig create mode 100644 drivers/acpi/apei/Makefile create mode 100644 drivers/acpi/apei/apei-base.c create mode 100644 drivers/acpi/apei/apei-internal.h
drivers/acpi/Kconfig +2 -0
@@ -360,4 +360,6 @@ config ACPI_SBS To compile this driver as a module, choose M here: the modules will be called sbs and sbshc. +source "drivers/acpi/apei/Kconfig" + endif # ACPI
drivers/acpi/Makefile +2 -0
@@ -67,3 +67,5 @@ processor-y += processor_idle.o processor_thermal.o processor-$(CONFIG_CPU_FREQ) += processor_perflib.o obj-$(CONFIG_ACPI_PROCESSOR_AGGREGATOR) += acpi_pad.o + +obj-$(CONFIG_ACPI_APEI) += apei/
drivers/acpi/apei/Kconfig new file +9 -0
@@ -0,0 +1,9 @@ +config ACPI_APEI + tristate "ACPI Platform Error Interface (APEI)" + depends on X86 + help + APEI allows to report errors (for example from the chipset) + to the operating system. This improves NMI handling + especially. In addition it supports error serialization and + error injection. +
drivers/acpi/apei/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +obj-$(CONFIG_ACPI_APEI) += apei.o + +apei-y := apei-base.o
drivers/acpi/apei/apei-base.c new file +572 -0
572 lines not on this page · raw message
drivers/acpi/apei/apei-internal.h new file +95 -0
95 lines not on this page · raw message
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 6/8 ACPI, APEI, HEST table parsing
In reply to Len BrownFrom: Huang Ying <[email protected]>
HEST describes error sources in detail; communicating operational parameters (i.e. severity levels, masking bits, and threshold values) to OS as necessary. It also allows the platform to report error sources for which OS would typically not implement support (for example, chipset-specific error registers).
HEST information may be needed by other subsystems. For example, HEST PCIE AER error source information describes whether a PCIE root port works in "firmware first" mode, this is needed by general PCIE AER error subsystem. So a public HEST tabling parsing interface is provided.
--- drivers/acpi/apei/Makefile | 2 +- drivers/acpi/apei/apei-base.c | 17 ++++ drivers/acpi/apei/apei-internal.h | 2 + drivers/acpi/apei/hest.c | 147 +++++++++++++++++++++++++++++++++++++ include/acpi/apei.h | 13 +++ 5 files changed, 180 insertions(+), 1 deletions(-) create mode 100644 drivers/acpi/apei/hest.c create mode 100644 include/acpi/apei.h
drivers/acpi/apei/Makefile +1 -1
@@ -1,3 +1,3 @@ obj-$(CONFIG_ACPI_APEI) += apei.o -apei-y := apei-base.o +apei-y := apei-base.o hest.o
drivers/acpi/apei/apei-base.c +17 -0
@@ -48,6 +48,9 @@struct dentry *apei_debug_dir;EXPORT_SYMBOL_GPL (apei_debug_dir); +int hest_disable; +EXPORT_SYMBOL (hest_disable); +/* * APEI ERST (Error Record Serialization Table) and EINJ (Error * INJection) interpreter framework.
@@ -552,9 +555,21 @@ EXPORT_SYMBOL_GPL(apei_exec_collect_resources);static int __init apei_init (void ) { +int rc; + apei_debug_dir =debugfs_create_dir ("apei" ,NULL );if (!apei_debug_dir)return -ENOMEM ; +if (!hest_disable) { + rc =hest_init (); +if (rc) { + hest_disable =1 ; +if (rc != -ENODEV ) +pr_err ( +"ACPI: APEI: Failed to initialize Hardware " +"Error Source Table (HEST) subsystem\n" ); + } + }return 0 ; }
@@ -567,6 +582,8 @@ static void __exit apei_exit(void)module_init (apei_init);module_exit (apei_exit); +module_param (hest_disable, int,0444 ); +MODULE_AUTHOR ("Huang Ying" );MODULE_DESCRIPTION ("ACPI Platform Error Interface support" );MODULE_LICENSE ("GPL" );
drivers/acpi/apei/apei-internal.h +2 -0
@@ -6,6 +6,8 @@#ifndef APEI_INTERNAL_H #define APEI_INTERNAL_H +int hest_init (void ); +struct apei_exec_context ; typedef int (*apei_exec_ins_func_t)(struct apei_exec_context *ctx,
drivers/acpi/apei/hest.c new file +147 -0
147 lines not on this page · raw message
include/acpi/apei.h new file +13 -0
@@ -0,0 +1,13 @@ +/* +* apei.h - ACPI Platform Error Interface +*/ + +#ifndef ACPI_APEI_H +#define ACPI_APEI_H + +extern int hest_disable; + +typedef int (*apei_hest_func_t )(struct acpi_hest_header *hest_hdr,void *data); +int apei_hest_parse (apei_hest_func_t func,void *data); + +#endif
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 7/8 ACPI, APEI, EINJ support
In reply to Len BrownFrom: Huang Ying <[email protected]>
EINJ provides a hardware error injection mechanism, this is useful for debugging and testing of other APEI and RAS features.
--- drivers/acpi/apei/Kconfig | 7 + drivers/acpi/apei/Makefile | 1 + drivers/acpi/apei/einj.c | 471 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 479 insertions(+), 0 deletions(-) create mode 100644 drivers/acpi/apei/einj.c
drivers/acpi/apei/Kconfig +7 -0
@@ -7,3 +7,10 @@ config ACPI_APEI especially. In addition it supports error serialization and error injection. +config ACPI_APEI_EINJ + tristate "APEI Error INJection (EINJ)" + depends on ACPI_APEI && DEBUG_FS + help + EINJ provides a hardware error injection mechanism, it is + mainly used for debugging and testing the other parts of + APEI and some other RAS features.
drivers/acpi/apei/Makefile +1 -0
@@ -1,3 +1,4 @@ obj-$(CONFIG_ACPI_APEI) += apei.o +obj-$(CONFIG_ACPI_APEI_EINJ) += einj.o apei-y := apei-base.o hest.o
drivers/acpi/apei/einj.c new file +471 -0
471 lines not on this page · raw message
Signature · 1 line
1.6.0.6
Len Brown
reviewerPATCH 8/8 ACPI, APEI, Document for APEI
In reply to Len BrownFrom: Huang Ying <[email protected]>
Add document for APEI, including kernel parameters and EINJ debug file sytem interface.
--- Documentation/acpi/apei/einj.txt | 49 +++++++++++++++++++++++++++++++++++ Documentation/kernel-parameters.txt | 5 +++ 2 files changed, 54 insertions(+), 0 deletions(-) create mode 100644 Documentation/acpi/apei/einj.txt
Documentation/acpi/apei/einj.txt new file +49 -0
@@ -0,0 +1,49 @@ + APEI Error INJection + ~~~~~~~~~~~~~~~~~~~~ + +EINJ provides a hardware error injection mechanism, it is very useful +for debugging and testing of other APEI and RAS features. + +To use EINJ, make the following is enabled in your kernel +configuration: + +CONFIG_DEBUG_FS +CONFIG_ACPI_APEI +CONFIG_ACPI_APEI_EINJ + +The user interface of EINJ is in debug file system, under the +directory apei/einj. The following files are provided. + +- available_error_type + Read this file will return the error injection capability of the + platform, that is, which error types are supported. The error type + definition is as follow, the left field is the error type value, the + right field is error description. + + 0x00000001 Processor Correctable + 0x00000002 Processor Uncorrectable non-fatal + 0x00000004 Processor Uncorrectable fatal + 0x00000008 Memory Correctable + 0x00000010 Memory Uncorrectable non-fatal + 0x00000020 Memory Uncorrectable fatal + 0x00000040 PCI Express Correctable + 0x00000080 PCI Express Uncorrectable fatal + 0x00000100 PCI Express Uncorrectable non-fatal + 0x00000200 Platform Correctable + 0x00000400 Platform Uncorrectable non-fatal + 0x00000800 Platform Uncorrectable fatal + + The format of file contents are as above, except there are only the + available error type lines. + +- error_type + This file is used to set the error type value. The error type value + is defined in "available_error_type" description. + +- error_inject + Write any integer to this file to trigger the error + injection. Before this, please specify all necessary error + parameters. + +For more information about EINJ, please refer to ACPI specification +version 4.0, section 17.5.
Documentation/kernel-parameters.txt +5 -0
@@ -338,6 +338,11 @@ and is between 256 and 4096 characters. It is defined in the file not play well with APC CPU idle - disable it if you have APC and your system crashes randomly. + apei.hest_disable= [ACPI] + Disable Hardware Error Source Table (HEST) support, + corresponding firmware-first mode error processing + logic will be disabled. + apic= [APIC,X86-32] Advanced Programmable Interrupt Controller Change the output verbosity whilst booting Format: { quiet (default) | verbose | debug }
Signature · 1 line
1.6.0.6
Quoted 1 line · On Saturday 16 January 2010 07:34:08 Len Brown wrote:
here is the current queue for 2.6.34
"acer-wmi: Respect current backlight level when loading" [0] appears to have fallen down the back of the sofa.
[0] http://patchwork.kernel.org/patch/69797/
-Carlos
Signature · 3 lines
E-Mail: [email protected] Web: strangeworlds.co.uk GPG Key ID: 0x23EE722D