From patchwork Thu Aug 3 15:42:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongjiu Geng X-Patchwork-Id: 9879329 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1FD6860360 for ; Thu, 3 Aug 2017 15:22:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 12B6128903 for ; Thu, 3 Aug 2017 15:22:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 10F762895A; Thu, 3 Aug 2017 15:22:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 77E7628903 for ; Thu, 3 Aug 2017 15:22:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751870AbdHCPWq (ORCPT ); Thu, 3 Aug 2017 11:22:46 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:10832 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751562AbdHCPWq (ORCPT ); Thu, 3 Aug 2017 11:22:46 -0400 Received: from 172.30.72.57 (EHLO DGGEML401-HUB.china.huawei.com) ([172.30.72.57]) by dggrg02-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id AST47780; Thu, 03 Aug 2017 23:22:43 +0800 (CST) Received: from linux.huawei.com (10.67.187.203) by DGGEML401-HUB.china.huawei.com (10.3.17.32) with Microsoft SMTP Server id 14.3.301.0; Thu, 3 Aug 2017 23:22:36 +0800 From: Dongjiu Geng To: , , , , , , , , , , CC: , , , Subject: [PATCH] acpi: ghes: fix the OSPM acknowledges error flow Date: Thu, 3 Aug 2017 23:42:25 +0800 Message-ID: <1501774945-31726-1-git-send-email-gengdongjiu@huawei.com> X-Mailer: git-send-email 1.7.7 MIME-Version: 1.0 X-Originating-IP: [10.67.187.203] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090203.59833FC3.0131, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 7e6673883149cb7f4424833d6a3c406e Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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)