All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] acpi: ghes: fix the OSPM acknowledges error flow
@ 2017-08-03 15:42 ` Dongjiu Geng
  0 siblings, 0 replies; 4+ messages in thread
From: Dongjiu Geng @ 2017-08-03 15:42 UTC (permalink / raw)
  To: rjw, lenb, tbaicar, will.deacon, james.morse, bp, prarit,
	andriy.shevchenko, zjzhang, linux-acpi, linux-kernel
  Cc: gengdongjiu, huangshaoyu, wuquanming, wangxiongfeng2

In GHESv2, The read_ack_register is used to specify the
location of the read ack register, it is only the physical
address, but not the value. so needs to continue reading
the address to get the right value. Also It needs to write
the ack value to the right physical address.

Signed-off-by: Dongjiu Geng <gengdongjiu@huawei.com>
---
 drivers/acpi/apei/ghes.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
index bb83044..44bb65f 100644
--- a/drivers/acpi/apei/ghes.c
+++ b/drivers/acpi/apei/ghes.c
@@ -703,16 +703,25 @@ static void ghes_estatus_cache_add(
 static int ghes_ack_error(struct acpi_hest_generic_v2 *gv2)
 {
 	int rc;
-	u64 val = 0;
+	u64 ack_paddr;
+	u64 ack_val = 0;
 
-	rc = apei_read(&val, &gv2->read_ack_register);
+	rc = apei_read(&ack_paddr, &gv2->read_ack_register);
 	if (rc)
 		return rc;
 
-	val &= gv2->read_ack_preserve << gv2->read_ack_register.bit_offset;
-	val |= gv2->read_ack_write    << gv2->read_ack_register.bit_offset;
+	if (!ack_paddr)
+		return -ENOENT;
+
+	ghes_copy_tofrom_phys(&ack_val, ack_paddr,
+			      sizeof(u64), 1);
 
-	return apei_write(val, &gv2->read_ack_register);
+	ack_val &= gv2->read_ack_preserve << gv2->read_ack_register.bit_offset;
+	ack_val |= gv2->read_ack_write    << gv2->read_ack_register.bit_offset;
+
+	ghes_copy_tofrom_phys(&ack_val, ack_paddr,
+				sizeof(u64), 0);
+	return 0;
 }
 
 static void __ghes_panic(struct ghes *ghes)
-- 
2.10.1


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

* [PATCH] acpi: ghes: fix the OSPM acknowledges error flow
@ 2017-08-03 15:42 ` Dongjiu Geng
  0 siblings, 0 replies; 4+ messages in thread
From: Dongjiu Geng @ 2017-08-03 15:42 UTC (permalink / raw)
  To: rjw, lenb, tbaicar, will.deacon, james.morse, bp, prarit,
	andriy.shevchenko, zjzhang, linux-acpi, linux-kernel
  Cc: gengdongjiu, huangshaoyu, wuquanming, wangxiongfeng2

In GHESv2, The read_ack_register is used to specify the
location of the read ack register, it is only the physical
address, but not the value. so needs to continue reading
the address to get the right value. Also It needs to write
the ack value to the right physical address.

Signed-off-by: Dongjiu Geng <gengdongjiu@huawei.com>
---
 drivers/acpi/apei/ghes.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
index bb83044..44bb65f 100644
--- a/drivers/acpi/apei/ghes.c
+++ b/drivers/acpi/apei/ghes.c
@@ -703,16 +703,25 @@ static void ghes_estatus_cache_add(
 static int ghes_ack_error(struct acpi_hest_generic_v2 *gv2)
 {
 	int rc;
-	u64 val = 0;
+	u64 ack_paddr;
+	u64 ack_val = 0;
 
-	rc = apei_read(&val, &gv2->read_ack_register);
+	rc = apei_read(&ack_paddr, &gv2->read_ack_register);
 	if (rc)
 		return rc;
 
-	val &= gv2->read_ack_preserve << gv2->read_ack_register.bit_offset;
-	val |= gv2->read_ack_write    << gv2->read_ack_register.bit_offset;
+	if (!ack_paddr)
+		return -ENOENT;
+
+	ghes_copy_tofrom_phys(&ack_val, ack_paddr,
+			      sizeof(u64), 1);
 
-	return apei_write(val, &gv2->read_ack_register);
+	ack_val &= gv2->read_ack_preserve << gv2->read_ack_register.bit_offset;
+	ack_val |= gv2->read_ack_write    << gv2->read_ack_register.bit_offset;
+
+	ghes_copy_tofrom_phys(&ack_val, ack_paddr,
+				sizeof(u64), 0);
+	return 0;
 }
 
 static void __ghes_panic(struct ghes *ghes)
-- 
2.10.1

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

* Re: [PATCH] acpi: ghes: fix the OSPM acknowledges error flow
  2017-08-03 15:42 ` Dongjiu Geng
@ 2017-08-04  9:53   ` gengdongjiu
  -1 siblings, 0 replies; 4+ messages in thread
From: gengdongjiu @ 2017-08-04  9:53 UTC (permalink / raw)
  To: rjw, lenb, tbaicar, will.deacon, james.morse, bp, prarit,
	andriy.shevchenko, zjzhang, linux-acpi, linux-kernel

Hi,
   please ignore this fix, original logic is right. the Read ACK register directly contain the ACK value, not the ACK address.


On 2017/8/3 23:42, Dongjiu Geng wrote:
> In GHESv2, The read_ack_register is used to specify the
> location of the read ack register, it is only the physical
> address, but not the value. so needs to continue reading
> the address to get the right value. Also It needs to write
> the ack value to the right physical address.
> 
> Signed-off-by: Dongjiu Geng <gengdongjiu@huawei.com>
> ---
>  drivers/acpi/apei/ghes.c | 19 ++++++++++++++-----
>  1 file changed, 14 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
> index bb83044..44bb65f 100644
> --- a/drivers/acpi/apei/ghes.c
> +++ b/drivers/acpi/apei/ghes.c
> @@ -703,16 +703,25 @@ static void ghes_estatus_cache_add(
>  static int ghes_ack_error(struct acpi_hest_generic_v2 *gv2)
>  {
>  	int rc;
> -	u64 val = 0;
> +	u64 ack_paddr;
> +	u64 ack_val = 0;
>  
> -	rc = apei_read(&val, &gv2->read_ack_register);
> +	rc = apei_read(&ack_paddr, &gv2->read_ack_register);
>  	if (rc)
>  		return rc;
>  
> -	val &= gv2->read_ack_preserve << gv2->read_ack_register.bit_offset;
> -	val |= gv2->read_ack_write    << gv2->read_ack_register.bit_offset;
> +	if (!ack_paddr)
> +		return -ENOENT;
> +
> +	ghes_copy_tofrom_phys(&ack_val, ack_paddr,
> +			      sizeof(u64), 1);
>  
> -	return apei_write(val, &gv2->read_ack_register);
> +	ack_val &= gv2->read_ack_preserve << gv2->read_ack_register.bit_offset;
> +	ack_val |= gv2->read_ack_write    << gv2->read_ack_register.bit_offset;
> +
> +	ghes_copy_tofrom_phys(&ack_val, ack_paddr,
> +				sizeof(u64), 0);
> +	return 0;
>  }
>  
>  static void __ghes_panic(struct ghes *ghes)
> 


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

* Re: [PATCH] acpi: ghes: fix the OSPM acknowledges error flow
@ 2017-08-04  9:53   ` gengdongjiu
  0 siblings, 0 replies; 4+ messages in thread
From: gengdongjiu @ 2017-08-04  9:53 UTC (permalink / raw)
  To: rjw, lenb, tbaicar, will.deacon, james.morse, bp, prarit,
	andriy.shevchenko, zjzhang, linux-acpi, linux-kernel

Hi,
   please ignore this fix, original logic is right. the Read ACK register directly contain the ACK value, not the ACK address.


On 2017/8/3 23:42, Dongjiu Geng wrote:
> In GHESv2, The read_ack_register is used to specify the
> location of the read ack register, it is only the physical
> address, but not the value. so needs to continue reading
> the address to get the right value. Also It needs to write
> the ack value to the right physical address.
> 
> Signed-off-by: Dongjiu Geng <gengdongjiu@huawei.com>
> ---
>  drivers/acpi/apei/ghes.c | 19 ++++++++++++++-----
>  1 file changed, 14 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
> index bb83044..44bb65f 100644
> --- a/drivers/acpi/apei/ghes.c
> +++ b/drivers/acpi/apei/ghes.c
> @@ -703,16 +703,25 @@ static void ghes_estatus_cache_add(
>  static int ghes_ack_error(struct acpi_hest_generic_v2 *gv2)
>  {
>  	int rc;
> -	u64 val = 0;
> +	u64 ack_paddr;
> +	u64 ack_val = 0;
>  
> -	rc = apei_read(&val, &gv2->read_ack_register);
> +	rc = apei_read(&ack_paddr, &gv2->read_ack_register);
>  	if (rc)
>  		return rc;
>  
> -	val &= gv2->read_ack_preserve << gv2->read_ack_register.bit_offset;
> -	val |= gv2->read_ack_write    << gv2->read_ack_register.bit_offset;
> +	if (!ack_paddr)
> +		return -ENOENT;
> +
> +	ghes_copy_tofrom_phys(&ack_val, ack_paddr,
> +			      sizeof(u64), 1);
>  
> -	return apei_write(val, &gv2->read_ack_register);
> +	ack_val &= gv2->read_ack_preserve << gv2->read_ack_register.bit_offset;
> +	ack_val |= gv2->read_ack_write    << gv2->read_ack_register.bit_offset;
> +
> +	ghes_copy_tofrom_phys(&ack_val, ack_paddr,
> +				sizeof(u64), 0);
> +	return 0;
>  }
>  
>  static void __ghes_panic(struct ghes *ghes)
> 

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

end of thread, other threads:[~2017-08-04  9:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-03 15:42 [PATCH] acpi: ghes: fix the OSPM acknowledges error flow Dongjiu Geng
2017-08-03 15:42 ` Dongjiu Geng
2017-08-04  9:53 ` gengdongjiu
2017-08-04  9:53   ` gengdongjiu

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.