Devel Digest, Vol 77, Issue 2
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Alexei Fedorov
Tested-by Hans de GoedeRe: [PATCH] ACPI: SPCR: Use access width to determine mmio
usage (Zheng, Lv)
Hi Zheng,
Quoted 5 lines
(quoted diff) +5
-0+ switch (table->serial_port.access_width) { + default: + pr_err("Unexpected SPCR Access Width. Defaulting to byte size\n"); + case ACPI_ACCESS_SIZE_BYTE: + iotype = "mmio";
Review
Quoted 10 lines
(quoted diff) +10
-0+ break; + case ACPI_ACCESS_SIZE_WORD: + iotype = "mmio16"; + break; + case ACPI_ACCESS_SIZE_DWORD: + iotype = "mmio32"; + break; + } + } else + iotype = "io";
Why there's no code for ACPI_ACCESS_SIZE_QWORD?
Regards,
Alexei.
________________________________
From: Devel <devel-bounces(a)acpica.org> on behalf of devel-request(a)acpica.org <devel-request(a)acpica.org>
Sent: 16 May 2017 08:13:53
To: devel(a)acpica.org
Subject: Devel Digest, Vol 77, Issue 2
Send Devel mailing list submissions to
devel(a)acpica.org
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.acpica.org/mailman/listinfo/devel
or, via email, send a message with subject or body 'help' to
devel-request(a)acpica.org
You can reach the person managing the list at
devel-owner(a)acpica.org
When replying, please edit your Subject line so it is more specific than "Re: Contents of Devel digest..."
Today's Topics:
1. Re: [PATCH] ACPI: SPCR: Use access width to determine mmio usage (Zheng, Lv)
2. [RFC PATCH v2 0/5] ACPICA: Tables: Add deferred verification support (Lv Zheng)
3. [RFC PATCH v2 1/5] ACPICA: Tables: Cleanup table handler invokers (Lv Zheng)
4. [RFC PATCH v2 2/5] ACPICA: Tables: Do not validate signature for dynamic table load (Lv Zheng)
5. [RFC PATCH v2 3/5] ACPICA: Tables: Change table duplication check to be related to acpi_gbl_verify_table_checksum (Lv Zheng)
6. [RFC PATCH v2 4/5] ACPICA: Tables: Combine checksum/duplication verification together (Lv Zheng)
----------------------------------------------------------------------
Message: 1
Date: Fri, 5 May 2017 03:09:34 +0000
From: "Zheng, Lv" <lv.zheng(a)intel.com>
To: Jon Mason <jon.mason(a)broadcom.com>, Rafael Wysocki
<rjw(a)rjwysocki.net>, Len Brown <lenb(a)kernel.org>, "Moore, Robert" <robert.moore(a)intel.com>
Cc: "linux-acpi(a)vger.kernel.org" <linux-acpi(a)vger.kernel.org>,
"linux-kernel(a)vger.kernel.org" <linux-kernel(a)vger.kernel.org>,
"devel(a)acpica.org" <devel(a)acpica.org>,
"bcm-kernel-feedback-list(a)broadcom.com"
<bcm-kernel-feedback-list(a)broadcom.com>
Subject: Re: [Devel] [PATCH] ACPI: SPCR: Use access width to determine
mmio usage
Message-ID:
<1AE640813FDE7649BE1B193DEA596E886CE9DCBC(a)SHSMSX101.ccr.corp.intel.com>Content-Type: text/plain; charset="gb2312"
Hi,
Quoted 54 lines
From: Jon Mason [mailto:jon.mason(a)broadcom.com]
Sent: Thursday, May 4, 2017 11:06 PM
Subject: [PATCH] ACPI: SPCR: Use access width to determine mmio usageThe current SPCR code does not check the access width of the mmio, and uses a default of 8bit register accesses. This prevents devices that only do 16 or 32bit register accesses from working. By simply checking this field and setting the mmio string appropriately, this issue can be corrected. To prevent any legacy issues, the code will default to 8bit accesses if the value is anything but 16 or 32.
Signed-off-by Jon Mason <jon.mason(a)broadcom.com>--- drivers/acpi/spcr.c | 18 ++++++++++++++++-- include/acpi/acrestyp.h | 7 +++++++ 2 files changed, 23 insertions(+), 2 deletions(-)drivers/acpi/spcr.c +16
-2@@ -74,8 +74,22 @@ int __init parse_spcr(bool earlycon) goto done; } - iotype = table->serial_port.space_id ==ACPI_ADR_SPACE_SYSTEM_MEMORY ? -"mmio" :"io" ; +if (table->serial_port.space_id ==ACPI_ADR_SPACE_SYSTEM_MEMORY ) { +switch (table->serial_port.access_width) { +default : +pr_err ("Unexpected SPCR Access Width. Defaulting to byte size\n" ); +case ACPI_ACCESS_SIZE_BYTE : + iotype ="mmio" ; +break ; +case ACPI_ACCESS_SIZE_WORD : + iotype ="mmio16" ; +break ; +case ACPI_ACCESS_SIZE_DWORD : + iotype ="mmio32" ; +break ; + } + }else + iotype ="io" ;switch (table->interface_type) {case ACPI_DBG2_ARM_SBSA_32BIT :include/acpi/acrestyp.h +0
-0@@ -372,6 +372,13 @@ struct acpi_resource_generic_register {u64 address; };
include/acpi/acrestyp.h struct acpi_resource_generic_register { · line 384
Quoted 10 lines
include/acpi/acrestyp.h +7
-0+/* Generic Address Space Access Sizes */ +#define ACPI_ACCESS_SIZE_UNDEFINED 0 +#define ACPI_ACCESS_SIZE_BYTE 1 +#define ACPI_ACCESS_SIZE_WORD 2 +#define ACPI_ACCESS_SIZE_DWORD 3 +#define ACPI_ACCESS_SIZE_QWORD 4 +struct acpi_resource_gpio {u8 revision_id;u8 connection_type;
Please don't define this.
It's possible to calculate 8/16/32/64 from the access width value. Try:
1 << (access_width + 2?
Thanks
Lv
------------------------------
Message: 2
Date: Tue, 16 May 2017 15:13:08 +0800
From: Lv Zheng <lv.zheng(a)intel.com>
To: "Rafael J . Wysocki" <rafael.j.wysocki(a)intel.com>, Len Brown
<len.brown(a)intel.com>, Robert Moore <robert.moore(a)intel.com>, Lv Zheng <lv.zheng(a)intel.com>, "David E . Box" <david.e.box(a)intel.com>
Cc: Lv Zheng <zetalog(a)gmail.com>, linux-acpi(a)vger.kernel.org,
devel(a)acpica.org, Hans de Goede <hdegoede(a)redhat.com>
Subject: [Devel] [RFC PATCH v2 0/5] ACPICA: Tables: Add deferred
verification support
Message-ID: <cover.1494916766.git.lv.zheng(a)intel.com>
On linux, we can not verify ACPI tables before installing them into the global table list in early stage due to the number of slot limitations for early ioremap. This leaves a problem that we cannot detect duplicated tables in early stage, causing unwanted error messages seen when the duplicated tables are failed to be loaded [link #1].
This patchset as ACPICA PR [link #2] adds support to verify tables in acpi_reallocate_root_tables() which is invoked after installing tables in early stage, being ready for late ioremap and beofre loading table in late stage. If duplicated tables are detected, acpi_reallocate_root_tables() stops installing them to the final reallocated global table list.
In v1 patchset [link #3], problems can be seen for dynamic loading tables which are allocated as virtuall allocated tables. Such tables are incremented in the global table list as the sanity check done in install step only compares the table addresses while the virtual allocated addresses are not stable.
In v2 patchset, we follow original design discussion made in ACPICA devel mailing list, implements deferred table verification so that duplicate tables are still can be detected in install step rather than in load step. Also we removed table signature check according to verified windows behavior [link #4] and reported issues [link #5].
https://bugzilla.kernel.org/show_bug.cgi?id=118601 [#5]
Lv Zheng (5):
ACPICA: Tables: Cleanup table handler invokers
ACPICA: Tables: Do not validate signature for dynamic table load
ACPICA: Tables: Change table duplication check to be related to
acpi_gbl_verify_table_checksum
ACPICA: Tables: Combine checksum/duplication verification together
ACPICA: Tables: Add deferred table verification support
drivers/acpi/acpica/actables.h | 5 +- drivers/acpi/acpica/tbdata.c | 222 ++++++++++++++++++++++++++++++++++++----- drivers/acpi/acpica/tbinstal.c | 161 ++++-------------------------- drivers/acpi/acpica/tbxface.c | 36 ++++++- drivers/acpi/acpica/tbxfload.c | 2 +- drivers/acpi/bus.c | 3 - drivers/acpi/tables.c | 4 +- include/acpi/acpixf.h | 15 +-- include/acpi/actbl.h | 1 + 9 files changed, 266 insertions(+), 183 deletions(-)
--
2.7.4
------------------------------
Message: 3
Date: Tue, 16 May 2017 15:13:17 +0800
From: Lv Zheng <lv.zheng(a)intel.com>
To: "Rafael J . Wysocki" <rafael.j.wysocki(a)intel.com>, Len Brown
<len.brown(a)intel.com>, Robert Moore <robert.moore(a)intel.com>, Lv Zheng <lv.zheng(a)intel.com>, "David E . Box" <david.e.box(a)intel.com>
Cc: Lv Zheng <zetalog(a)gmail.com>, linux-acpi(a)vger.kernel.org,
devel(a)acpica.org, Hans de Goede <hdegoede(a)redhat.com>
Subject: [Devel] [RFC PATCH v2 1/5] ACPICA: Tables: Cleanup table
handler invokers
Message-ID:
<c8a48e0379ed9d06d50844b4d7ac59ac8fb6e7d7.1494916766.git.lv.zheng(a)intel.com>
Recently, we allows the table mutex to be held in both early and late stage APIs. This patch further cleans up the related code to reduce redundant code related to acpi_gbl_table_handler. Lv Zheng.
--- drivers/acpi/acpica/actables.h | 2 ++ drivers/acpi/acpica/tbdata.c | 43 ++++++++++++++++++++++++++++-------------- drivers/acpi/acpica/tbinstal.c | 8 ++------ 3 files changed, 33 insertions(+), 20 deletions(-)
drivers/acpi/acpica/actables.h +2 -0
@@ -132,6 +132,8 @@ acpi_tb_install_and_load_table(acpi_physical_address address,acpi_status acpi_tb_unload_table (u32 table_index); +void acpi_tb_notify_table (u32 event,void *table); +void acpi_tb_terminate (void );acpi_status acpi_tb_delete_namespace_by_owner (u32 table_index);
drivers/acpi/acpica/tbdata.c +29 -14
60 lines not on this page · raw message
drivers/acpi/acpica/tbinstal.c +2 -6
@@ -306,14 +306,10 @@ acpi_tb_install_standard_table(acpi_physical_address address,acpi_tb_install_table_with_override (&new_table_desc, override, table_index); -/* Invoke table handler if present */ +/* Invoke table handler */ (void )acpi_ut_release_mutex (ACPI_MTX_TABLES ); -if (acpi_gbl_table_handler) { - (void )acpi_gbl_table_handler (ACPI_TABLE_EVENT_INSTALL , - new_table_desc.pointer, - acpi_gbl_table_handler_context); - } +acpi_tb_notify_table (ACPI_TABLE_EVENT_INSTALL , new_table_desc.pointer); (void )acpi_ut_acquire_mutex (ACPI_MTX_TABLES ); unlock_and_exit:
--
2.7.4
------------------------------
Message: 4
Date: Tue, 16 May 2017 15:13:26 +0800
From: Lv Zheng <lv.zheng(a)intel.com>
To: "Rafael J . Wysocki" <rafael.j.wysocki(a)intel.com>, Len Brown
<len.brown(a)intel.com>, Robert Moore <robert.moore(a)intel.com>, Lv Zheng <lv.zheng(a)intel.com>, "David E . Box" <david.e.box(a)intel.com>
Cc: Lv Zheng <zetalog(a)gmail.com>, linux-acpi(a)vger.kernel.org,
devel(a)acpica.org, Hans de Goede <hdegoede(a)redhat.com>
Subject: [Devel] [RFC PATCH v2 2/5] ACPICA: Tables: Do not validate
signature for dynamic table load
Message-ID:
<f07bb8cfeda364698adad9bc15d54c9b2ac8b366.1494916766.git.lv.zheng(a)intel.com>
Windows seems to allow arbitrary table signatures for Load/load_table opcodes:
ACPI BIOS Error (bug): Table has invalid signature [PRAD] (0x44415250)
So this patch removes dynamic load signature checks. However we need to find a way to avoid table loading against tables like MADT. This is not covered by this commit.
This Windows behavior has been validated on link #1. An end user bug report can also be found on link #2.
This patch also includes simple cleanup for static load signature check code. Reported by Ye Xiaolong, Fixed by Lv Zheng.
--- drivers/acpi/acpica/tbinstal.c | 28 ---------------------------- drivers/acpi/acpica/tbxfload.c | 2 +- 2 files changed, 1 insertion(+), 29 deletions(-)
drivers/acpi/acpica/tbinstal.c +0 -28
@@ -222,34 +222,6 @@ acpi_tb_install_standard_table(acpi_physical_address address, (void )acpi_ut_acquire_mutex (ACPI_MTX_TABLES );if (reload) { -/* -* Validate the incoming table signature. -* -* 1) Originally, we checked the table signature for "SSDT" or "PSDT". -* 2) We added support for OEMx tables, signature "OEM". -* 3) Valid tables were encountered with a null signature, so we just -* gave up on validating the signature, (05/2008). -* 4) We encountered non-AML tables such as the MADT, which caused -* interpreter errors and kernel faults. So now, we once again allow -* only "SSDT", "OEMx", and now, also a null signature. (05/2011). -*/ -if ((new_table_desc.signature.ascii[0 ] !=0x00 ) && - (!ACPI_COMPARE_NAME - (&new_table_desc.signature,ACPI_SIG_SSDT )) - && (strncmp (new_table_desc.signature.ascii,"OEM" ,3 ))) { -ACPI_BIOS_ERROR ((AE_INFO , -"Table has invalid signature [%4.4s] (0x%8.8X), " -"must be SSDT or OEMx" , -acpi_ut_valid_nameseg (new_table_desc. - signature. - ascii) ? - new_table_desc.signature. - ascii :"????" , - new_table_desc.signature.integer)); - - status =AE_BAD_SIGNATURE ; - goto unlock_and_exit; - }/* Check if table is already registered */
drivers/acpi/acpica/tbxfload.c +1 -1
@@ -206,7 +206,7 @@ acpi_status acpi_tb_load_namespace(void)for (i =0 ; i < acpi_gbl_root_table_list.current_table_count; ++i) { table = &acpi_gbl_root_table_list.tables[i]; - if (!acpi_gbl_root_table_list.tables[i].address || + if (!table->address || (!ACPI_COMPARE_NAME(table->signature.ascii, ACPI_SIG_SSDT) && !ACPI_COMPARE_NAME(table->signature.ascii, ACPI_SIG_PSDT)
--
2.7.4
------------------------------
Message: 5
Date: Tue, 16 May 2017 15:13:39 +0800
From: Lv Zheng <lv.zheng(a)intel.com>
To: "Rafael J . Wysocki" <rafael.j.wysocki(a)intel.com>, Len Brown
<len.brown(a)intel.com>, Robert Moore <robert.moore(a)intel.com>, Lv Zheng <lv.zheng(a)intel.com>, "David E . Box" <david.e.box(a)intel.com>
Cc: Lv Zheng <zetalog(a)gmail.com>, linux-acpi(a)vger.kernel.org,
devel(a)acpica.org, Hans de Goede <hdegoede(a)redhat.com>
Subject: [Devel] [RFC PATCH v2 3/5] ACPICA: Tables: Change table
duplication check to be related to acpi_gbl_verify_table_checksum
Message-ID:
<579de00f5d54e128b04bba5ae627afd0f132c528.1494916766.git.lv.zheng(a)intel.com>
acpi_gbl_verify_table_checksum is used to avoid validating (mapping) an entire table in OS boot stage. 2nd "Reload" check in acpi_tb_install_standard_table() is prepared for the same purpose. So this patch combines them together using a renamed acpi_gbl_enable_table_validation flag. Lv Zheng.
--- drivers/acpi/acpica/tbdata.c | 4 ++-- drivers/acpi/acpica/tbinstal.c | 2 +- drivers/acpi/acpica/tbxface.c | 8 ++++++++ drivers/acpi/bus.c | 2 +- drivers/acpi/tables.c | 4 ++-- include/acpi/acpixf.h | 15 ++++++++------- 6 files changed, 22 insertions(+), 13 deletions(-)
drivers/acpi/acpica/tbdata.c +2 -2
@@ -338,7 +338,7 @@ void acpi_tb_invalidate_table(struct acpi_table_desc *table_desc)acpi_status acpi_tb_validate_temp_table (struct acpi_table_desc *table_desc) { -if (!table_desc->pointer && !acpi_gbl_verify_table_checksum) { +if (!table_desc->pointer && !acpi_gbl_enable_table_validation) {/* * Only validates the header of the table. * Note that Length contains the size of the mapping after invoking
@@ -394,7 +394,7 @@ acpi_tb_verify_temp_table(struct acpi_table_desc *table_desc, char *signature)/* Verify the checksum */ -if (acpi_gbl_verify_table_checksum) { +if (acpi_gbl_enable_table_validation) { status =acpi_tb_verify_checksum (table_desc->pointer, table_desc->length);
drivers/acpi/acpica/tbinstal.c +1 -1
@@ -221,7 +221,7 @@ acpi_tb_install_standard_table(acpi_physical_address address, (void )acpi_ut_acquire_mutex (ACPI_MTX_TABLES ); -if (reload) { +if (acpi_gbl_enable_table_validation) {/* Check if table is already registered */
drivers/acpi/acpica/tbxface.c +8 -0
@@ -194,6 +194,14 @@ acpi_status ACPI_INIT_FUNCTION acpi_reallocate_root_table(void) } } +if (!acpi_gbl_enable_table_validation) { +/* +* Now it's safe to do full table validation. We can do deferred +* table initilization here once the flag is set. +*/ + acpi_gbl_enable_table_validation = TRUE; + } + acpi_gbl_root_table_list.flags |=ACPI_ROOT_ALLOW_RESIZE ; status =acpi_tb_resize_root_table_list ();
drivers/acpi/bus.c +1 -1
@@ -1010,7 +1010,7 @@ void __init acpi_early_init(void) printk(KERN_INFO PREFIX "Core revision %08x\n", ACPI_CA_VERSION);/* It's safe to verify table checksums during late stage */ - acpi_gbl_verify_table_checksum = TRUE; + acpi_gbl_enable_table_validation = TRUE;/* enable workarounds, unless strict ACPI spec. compliance */ if (!acpi_strict)
drivers/acpi/tables.c +2 -2
@@ -740,10 +740,10 @@ int __init acpi_table_init(void)if (acpi_verify_table_checksum) {pr_info ("Early table checksum verification enabled\n" ); - acpi_gbl_verify_table_checksum = TRUE; + acpi_gbl_enable_table_validation = TRUE; }else {pr_info ("Early table checksum verification disabled\n" ); - acpi_gbl_verify_table_checksum = FALSE; + acpi_gbl_enable_table_validation = FALSE; } status =acpi_initialize_tables (initial_tables,ACPI_MAX_TABLES ,0 );
include/acpi/acpixf.h +8 -7
@@ -160,13 +160,14 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_create_osi_method, TRUE);ACPI_INIT_GLOBAL (u8, acpi_gbl_use_default_register_widths, TRUE);/* -* Whether or not to verify the table checksum before installation. Set -* this to TRUE to verify the table checksum before install it to the table -* manager. Note that enabling this option causes errors to happen in some -* OSPMs during early initialization stages. Default behavior is to do such -* verification. -*/ -ACPI_INIT_GLOBAL (u8, acpi_gbl_verify_table_checksum, TRUE); +* Whether or not to validate (map) an entire table to verify +* checksum/duplication in early stage before install. Set this to TRUE to +* allow early table validation before install it to the table manager. +* Note that enabling this option causes errors to happen in some OSPMs +* during early initialization stages. Default behavior is to allow such +* validation. +*/ +ACPI_INIT_GLOBAL (u8, acpi_gbl_enable_table_validation, TRUE);/* * Optionally enable output from the AML Debug Object.
--
2.7.4
------------------------------
Message: 6
Date: Tue, 16 May 2017 15:13:48 +0800
From: Lv Zheng <lv.zheng(a)intel.com>
To: "Rafael J . Wysocki" <rafael.j.wysocki(a)intel.com>, Len Brown
<len.brown(a)intel.com>, Robert Moore <robert.moore(a)intel.com>, Lv Zheng <lv.zheng(a)intel.com>, "David E . Box" <david.e.box(a)intel.com>
Cc: Lv Zheng <zetalog(a)gmail.com>, linux-acpi(a)vger.kernel.org,
devel(a)acpica.org, Hans de Goede <hdegoede(a)redhat.com>
Subject: [Devel] [RFC PATCH v2 4/5] ACPICA: Tables: Combine
checksum/duplication verification together
Message-ID:
<eef9d0a56bb7bd7383dda740042b583fa58103c7.1494916766.git.lv.zheng(a)intel.com>
They are all mechanism used to verify if a table is qualified to be installed and controlled by acpi_gbl_enable_table_validation, so combine them together. Lv Zheng.
--- drivers/acpi/acpica/actables.h | 3 +- drivers/acpi/acpica/tbdata.c | 148 +++++++++++++++++++++++++++++++++++++++-- drivers/acpi/acpica/tbinstal.c | 124 ++++++---------------------------- 3 files changed, 165 insertions(+), 110 deletions(-)
drivers/acpi/acpica/actables.h +2 -1
@@ -76,7 +76,8 @@ void acpi_tb_release_temp_table(struct acpi_table_desc *table_desc);acpi_status acpi_tb_validate_temp_table (struct acpi_table_desc *table_desc);acpi_status -acpi_tb_verify_temp_table (struct acpi_table_desc *table_desc,char *signature); +acpi_tb_verify_temp_table (struct acpi_table_desc *table_desc, +char *signature,u32 *table_index);u8 acpi_tb_is_table_loaded (u32 table_index);
drivers/acpi/acpica/tbdata.c +144 -4
193 lines not on this page · raw message
drivers/acpi/acpica/tbinstal.c +19 -105
156 lines not on this page · raw message
--
2.7.4
------------------------------
Subject: Digest Footer
_______________________________________________
Devel mailing list
Devel(a)acpica.org
https://lists.acpica.org/mailman/listinfo/devel
------------------------------
End of Devel Digest, Vol 77, Issue 2
************************************
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.