All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] device-drivers/acpi: skip certain tests for HW-reduced ACPI
@ 2018-08-17 15:43 Stanislav Kholmanskikh
  2018-10-01 12:41 ` Stanislav Kholmanskikh
  0 siblings, 1 reply; 6+ messages in thread
From: Stanislav Kholmanskikh @ 2018-08-17 15:43 UTC (permalink / raw)
  To: ltp

The "4.1 Hardware-Reduced ACPI" of the ACPI specification
details that for Hardware-reduced platforms the ACPI Fixed Hardware
interface is not implemented, so related test cases fail.
To avoid that, we skip these test cases if HW-reduced mode is detected.

One example of such systems is the aarch64 server platform.

Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
---
 .../kernel/device-drivers/acpi/ltp_acpi_cmds.c     |   25 +++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/testcases/kernel/device-drivers/acpi/ltp_acpi_cmds.c b/testcases/kernel/device-drivers/acpi/ltp_acpi_cmds.c
index 6e8f051..2733753 100644
--- a/testcases/kernel/device-drivers/acpi/ltp_acpi_cmds.c
+++ b/testcases/kernel/device-drivers/acpi/ltp_acpi_cmds.c
@@ -231,14 +231,25 @@ static int acpi_traverse_from_root(void)
 
 /* first found device with _STR */
 static acpi_handle dev_handle;
+static int acpi_hw_reduced;
 
 static int acpi_init(void)
 {
 	acpi_status status;
 	acpi_handle parent_handle;
-
+	struct acpi_table_fadt *fadt;
+	struct acpi_table_header *table;
 	struct acpi_device_info *dev_info;
 
+	status = acpi_get_table(ACPI_SIG_FADT, 0, &table);
+	if (ACPI_SUCCESS(status)) {
+		fadt = (struct acpi_table_fadt *)table;
+		if (fadt->flags & ACPI_FADT_HW_REDUCED)
+			acpi_hw_reduced = 1;
+	}
+	if (acpi_hw_reduced)
+		prk_alert("Detected the Hardware-reduced ACPI mode");
+
 	prk_alert("TEST -- acpi_get_handle ");
 	status = acpi_get_handle(NULL, "\\_SB", &parent_handle);
 	if (acpi_failure(status, "acpi_get_handle"))
@@ -312,6 +323,10 @@ static int acpi_test_event_handler(void)
 	acpi_status status;
 
 	prk_alert("TEST -- acpi_install_fixed_event_handler");
+	if (acpi_hw_reduced) {
+		prk_alert("Skipped due to the HW-reduced mode");
+		return 0;
+	}
 	status = acpi_install_fixed_event_handler(ACPI_EVENT_POWER_BUTTON,
 		ltp_test_power_button_ev_handler, NULL);
 
@@ -352,6 +367,10 @@ static int acpi_global_lock(void)
 	u32 global_lock = 0;
 
 	prk_alert("TEST -- acpi_acquire_global_lock ");
+	if (acpi_hw_reduced) {
+		prk_alert("Skipped due to the HW-reduced mode");
+		return 0;
+	}
 	status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &global_lock);
 	if (acpi_failure(status, "acpi_acquire_global_lock"))
 		return 1;
@@ -448,6 +467,10 @@ static int acpi_test_register(void)
 	acpi_status status;
 
 	prk_alert("TEST -- acpi_read_bit_register");
+	if (acpi_hw_reduced) {
+		prk_alert("Skipped due to the HW-reduced mode");
+		return 0;
+	}
 	/*
 	 * ACPICA: Remove obsolete Flags parameter.
 	 * http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [LTP] [PATCH] device-drivers/acpi: skip certain tests for HW-reduced ACPI
  2018-08-17 15:43 [LTP] [PATCH] device-drivers/acpi: skip certain tests for HW-reduced ACPI Stanislav Kholmanskikh
@ 2018-10-01 12:41 ` Stanislav Kholmanskikh
  2018-10-01 12:42   ` Cyril Hrubis
  0 siblings, 1 reply; 6+ messages in thread
From: Stanislav Kholmanskikh @ 2018-10-01 12:41 UTC (permalink / raw)
  To: ltp

Hi!

Could anybody have a look at this, please?

Thanks.

On 08/17/2018 06:43 PM, Stanislav Kholmanskikh wrote:
> The "4.1 Hardware-Reduced ACPI" of the ACPI specification
> details that for Hardware-reduced platforms the ACPI Fixed Hardware
> interface is not implemented, so related test cases fail.
> To avoid that, we skip these test cases if HW-reduced mode is detected.
> 
> One example of such systems is the aarch64 server platform.
> 
> Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
> ---
>  .../kernel/device-drivers/acpi/ltp_acpi_cmds.c     |   25 +++++++++++++++++++-
>  1 files changed, 24 insertions(+), 1 deletions(-)
> 
> diff --git a/testcases/kernel/device-drivers/acpi/ltp_acpi_cmds.c b/testcases/kernel/device-drivers/acpi/ltp_acpi_cmds.c
> index 6e8f051..2733753 100644
> --- a/testcases/kernel/device-drivers/acpi/ltp_acpi_cmds.c
> +++ b/testcases/kernel/device-drivers/acpi/ltp_acpi_cmds.c
> @@ -231,14 +231,25 @@ static int acpi_traverse_from_root(void)
>  
>  /* first found device with _STR */
>  static acpi_handle dev_handle;
> +static int acpi_hw_reduced;
>  
>  static int acpi_init(void)
>  {
>  	acpi_status status;
>  	acpi_handle parent_handle;
> -
> +	struct acpi_table_fadt *fadt;
> +	struct acpi_table_header *table;
>  	struct acpi_device_info *dev_info;
>  
> +	status = acpi_get_table(ACPI_SIG_FADT, 0, &table);
> +	if (ACPI_SUCCESS(status)) {
> +		fadt = (struct acpi_table_fadt *)table;
> +		if (fadt->flags & ACPI_FADT_HW_REDUCED)
> +			acpi_hw_reduced = 1;
> +	}
> +	if (acpi_hw_reduced)
> +		prk_alert("Detected the Hardware-reduced ACPI mode");
> +
>  	prk_alert("TEST -- acpi_get_handle ");
>  	status = acpi_get_handle(NULL, "\\_SB", &parent_handle);
>  	if (acpi_failure(status, "acpi_get_handle"))
> @@ -312,6 +323,10 @@ static int acpi_test_event_handler(void)
>  	acpi_status status;
>  
>  	prk_alert("TEST -- acpi_install_fixed_event_handler");
> +	if (acpi_hw_reduced) {
> +		prk_alert("Skipped due to the HW-reduced mode");
> +		return 0;
> +	}
>  	status = acpi_install_fixed_event_handler(ACPI_EVENT_POWER_BUTTON,
>  		ltp_test_power_button_ev_handler, NULL);
>  
> @@ -352,6 +367,10 @@ static int acpi_global_lock(void)
>  	u32 global_lock = 0;
>  
>  	prk_alert("TEST -- acpi_acquire_global_lock ");
> +	if (acpi_hw_reduced) {
> +		prk_alert("Skipped due to the HW-reduced mode");
> +		return 0;
> +	}
>  	status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &global_lock);
>  	if (acpi_failure(status, "acpi_acquire_global_lock"))
>  		return 1;
> @@ -448,6 +467,10 @@ static int acpi_test_register(void)
>  	acpi_status status;
>  
>  	prk_alert("TEST -- acpi_read_bit_register");
> +	if (acpi_hw_reduced) {
> +		prk_alert("Skipped due to the HW-reduced mode");
> +		return 0;
> +	}
>  	/*
>  	 * ACPICA: Remove obsolete Flags parameter.
>  	 * http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [LTP] [PATCH] device-drivers/acpi: skip certain tests for HW-reduced ACPI
  2018-10-01 12:41 ` Stanislav Kholmanskikh
@ 2018-10-01 12:42   ` Cyril Hrubis
  2018-10-02 16:16     ` Stanislav Kholmanskikh
  0 siblings, 1 reply; 6+ messages in thread
From: Cyril Hrubis @ 2018-10-01 12:42 UTC (permalink / raw)
  To: ltp

Hi!
> Could anybody have a look at this, please?

Looks OK, I haven't checked the ACPI calls used to get the reduced flag
are correct though.

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [LTP] [PATCH] device-drivers/acpi: skip certain tests for HW-reduced ACPI
  2018-10-01 12:42   ` Cyril Hrubis
@ 2018-10-02 16:16     ` Stanislav Kholmanskikh
  2018-10-03  7:40       ` Cyril Hrubis
  0 siblings, 1 reply; 6+ messages in thread
From: Stanislav Kholmanskikh @ 2018-10-02 16:16 UTC (permalink / raw)
  To: ltp

Hi!

On 10/01/2018 03:42 PM, Cyril Hrubis wrote:
> Hi!
>> Could anybody have a look at this, please?
> 
> Looks OK, I haven't checked the ACPI calls used to get the reduced flag
> are correct though.
> 

Thank you. They work for me.

On an aarch64 box with the ACPI reduced flag set:

[root@bma002-ps ~]# acpixtract -a acpidump.out
<...>
[root@bma002-ps ~]# iasl -d facp.dat
<...>
[root@bma002-ps ~]# less facp.dsl
[root@bma002-ps ~]# grep -i reduced facp.dsl
                       Hardware Reduced (V5) : 1
[root@bma002-ps ~]#

without the patch the test reports:

ltp_acpi    2  TPASS  :  Test-case '1'
ltp_acpi    3  TPASS  :  Test-case '2'
ltp_acpi    4  TFAIL  :  ltp_acpi.c:139: Test-case '3'
ltp_acpi    5  TFAIL  :  ltp_acpi.c:139: Test-case '4'
ltp_acpi    6  TPASS  :  Test-case '5'
ltp_acpi    7  TPASS  :  Test-case '6'
ltp_acpi    8  TPASS  :  Test-case '7'
ltp_acpi    9  TFAIL  :  ltp_acpi.c:139: Test-case '8'
ltp_acpi   10  TPASS  :  Test-case '9'
<<<execution_status>>>

In contrast, here is the output from the same machine with the patch:

ltp_acpi    2  TPASS  :  Test-case '1'
ltp_acpi    3  TPASS  :  Test-case '2'
ltp_acpi    4  TPASS  :  Test-case '3'
ltp_acpi    5  TPASS  :  Test-case '4'
ltp_acpi    6  TPASS  :  Test-case '5'
ltp_acpi    7  TPASS  :  Test-case '6'
ltp_acpi    8  TPASS  :  Test-case '7'
ltp_acpi    9  TPASS  :  Test-case '8'
ltp_acpi   10  TPASS  :  Test-case '9'
<<<execution_status>>>

and the new string in dmesg:

[28580.729499] LTP: starting kernel_misc:ltp_acpi (ltp_acpi)
[28580.738129] ltp_acpi_test: Starting module
[28580.742241] ltp_acpi_test: device registered
[28580.746950] ltp_acpi_test: test-case 0
[28580.750707] ltp_acpi_test: Detected the Hardware-reduced ACPI mode
[28580.756882] ltp_acpi_test: TEST -- acpi_get_handle
[28580.761785] ltp_acpi_test: ACPI object name CP00, type 6


On my x86_64 desktop, where the flag is not set, I see no difference in
test output and dmesg before and after applying the patch.

I.e. everything seems to be working as expected.

Am I applying the patch then?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [LTP] [PATCH] device-drivers/acpi: skip certain tests for HW-reduced ACPI
  2018-10-02 16:16     ` Stanislav Kholmanskikh
@ 2018-10-03  7:40       ` Cyril Hrubis
  2018-10-03 12:55         ` Stanislav Kholmanskikh
  0 siblings, 1 reply; 6+ messages in thread
From: Cyril Hrubis @ 2018-10-03  7:40 UTC (permalink / raw)
  To: ltp

Hi!
> Am I applying the patch then?

Yes please.

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [LTP] [PATCH] device-drivers/acpi: skip certain tests for HW-reduced ACPI
  2018-10-03  7:40       ` Cyril Hrubis
@ 2018-10-03 12:55         ` Stanislav Kholmanskikh
  0 siblings, 0 replies; 6+ messages in thread
From: Stanislav Kholmanskikh @ 2018-10-03 12:55 UTC (permalink / raw)
  To: ltp



On 10/03/2018 10:40 AM, Cyril Hrubis wrote:
> Hi!
>> Am I applying the patch then?
> 
> Yes please.
> 

Committed. Thank you.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-10-03 12:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-17 15:43 [LTP] [PATCH] device-drivers/acpi: skip certain tests for HW-reduced ACPI Stanislav Kholmanskikh
2018-10-01 12:41 ` Stanislav Kholmanskikh
2018-10-01 12:42   ` Cyril Hrubis
2018-10-02 16:16     ` Stanislav Kholmanskikh
2018-10-03  7:40       ` Cyril Hrubis
2018-10-03 12:55         ` Stanislav Kholmanskikh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.