Re: [PATCH v2] ACPI, APEI, EINJ: Subtract any matching Register Region from Trigger resources

2017-08-30 Thread Rafael J. Wysocki
On Monday, August 28, 2017 8:13:14 PM CEST Yazen Ghannam wrote:
> From: Yazen Ghannam 
> 
> ACPI defines a number of instructions to use for triggering errors. However
> we are currently removing the address resources from the trigger resources
> for only the WRITE_REGISTER_VALUE instruction. This leads to a resource
> conflict for any other valid instruction.
> 
> Check that the instruction is less than or equal to the
> WRITE_REGISTER_VALUE instruction. This allows all valid memory access
> instructions and protects against invalid instructions.
> 
> Fixes: b4e008dc53a3 ("ACPI, APEI, EINJ, Refine the fix of resource conflict")
> Signed-off-by: Yazen Ghannam 
> Acked-by: Tony Luck 
> ---
> Link:
> https://lkml.kernel.org/r/1502387883-16667-1-git-send-email-yazen.ghan...@amd.com
> 
> v1->v2:
> * Apply Tony's comment to restrict behavior to valid memory instructions.

Applied, thanks!



[PATCH v2] ACPI, APEI, EINJ: Subtract any matching Register Region from Trigger resources

2017-08-28 Thread Yazen Ghannam
From: Yazen Ghannam 

ACPI defines a number of instructions to use for triggering errors. However
we are currently removing the address resources from the trigger resources
for only the WRITE_REGISTER_VALUE instruction. This leads to a resource
conflict for any other valid instruction.

Check that the instruction is less than or equal to the
WRITE_REGISTER_VALUE instruction. This allows all valid memory access
instructions and protects against invalid instructions.

Fixes: b4e008dc53a3 ("ACPI, APEI, EINJ, Refine the fix of resource conflict")
Signed-off-by: Yazen Ghannam 
Acked-by: Tony Luck 
---
Link:
https://lkml.kernel.org/r/1502387883-16667-1-git-send-email-yazen.ghan...@amd.com

v1->v2:
* Apply Tony's comment to restrict behavior to valid memory instructions.

 drivers/acpi/apei/einj.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c
index ec50c32ea3da..b38737c83a24 100644
--- a/drivers/acpi/apei/einj.c
+++ b/drivers/acpi/apei/einj.c
@@ -281,7 +281,7 @@ static struct acpi_generic_address 
*einj_get_trigger_parameter_region(
((char *)trigger_tab + sizeof(struct acpi_einj_trigger));
for (i = 0; i < trigger_tab->entry_count; i++) {
if (entry->action == ACPI_EINJ_TRIGGER_ERROR &&
-   entry->instruction == ACPI_EINJ_WRITE_REGISTER_VALUE &&
+   entry->instruction <= ACPI_EINJ_WRITE_REGISTER_VALUE &&
entry->register_region.space_id ==
ACPI_ADR_SPACE_SYSTEM_MEMORY &&
(entry->register_region.address & param2) == (param1 & param2))
-- 
2.7.4