mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dongjiu Geng <gengdongjiu@huawei.com>
To: <rjw@rjwysocki.net>, <lenb@kernel.org>, <tbaicar@codeaurora.org>,
	<will.deacon@arm.com>, <james.morse@arm.com>, <bp@suse.de>,
	<prarit@redhat.com>, <andriy.shevchenko@linux.intel.com>,
	<zjzhang@codeaurora.org>, <linux-acpi@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Cc: <gengdongjiu@huawei.com>, <huangshaoyu@huawei.com>,
	<wuquanming@huawei.com>, <wangxiongfeng2@huawei.com>
Subject: [PATCH] acpi: ghes: fix the OSPM acknowledges error flow
Date: Thu, 3 Aug 2017 23:42:25 +0800	[thread overview]
Message-ID: <1501774945-31726-1-git-send-email-gengdongjiu@huawei.com> (raw)

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

             reply	other threads:[~2017-08-03 15:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-03 15:42 Dongjiu Geng [this message]
2017-08-04  9:53 ` gengdongjiu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1501774945-31726-1-git-send-email-gengdongjiu@huawei.com \
    --to=gengdongjiu@huawei.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bp@suse.de \
    --cc=huangshaoyu@huawei.com \
    --cc=james.morse@arm.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=prarit@redhat.com \
    --cc=rjw@rjwysocki.net \
    --cc=tbaicar@codeaurora.org \
    --cc=wangxiongfeng2@huawei.com \
    --cc=will.deacon@arm.com \
    --cc=wuquanming@huawei.com \
    --cc=zjzhang@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®