From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4F7FC432C0 for ; Mon, 18 Nov 2019 13:18:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AF7BA206D4 for ; Mon, 18 Nov 2019 13:18:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726627AbfKRNSP (ORCPT ); Mon, 18 Nov 2019 08:18:15 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:33652 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726284AbfKRNSP (ORCPT ); Mon, 18 Nov 2019 08:18:15 -0500 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 863DE3839AA8C708ED17; Mon, 18 Nov 2019 21:18:13 +0800 (CST) Received: from [127.0.0.1] (10.142.68.147) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.439.0; Mon, 18 Nov 2019 21:18:03 +0800 Subject: Re: [RESEND PATCH v21 3/6] ACPI: Add APEI GHES table generation support From: gengdongjiu To: Igor Mammedov , Xiang Zheng CC: , , , , , , , , , , , , , , , References: <20191111014048.21296-1-zhengxiang9@huawei.com> <20191111014048.21296-4-zhengxiang9@huawei.com> <20191115103801.547fc84d@redhat.com> Message-ID: <87758ec2-c242-71c3-51f8-a5d348f8e7fd@huawei.com> Date: Mon, 18 Nov 2019 21:18:01 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.142.68.147] X-CFilter-Loop: Reflected Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On 2019/11/18 20:49, gengdongjiu wrote: >>> + */ >>> + build_append_int_noprefix(table_data, source_id, 2); >>> + /* Related Source Id */ >>> + build_append_int_noprefix(table_data, 0xffff, 2); >>> + /* Flags */ >>> + build_append_int_noprefix(table_data, 0, 1); >>> + /* Enabled */ >>> + build_append_int_noprefix(table_data, 1, 1); >>> + >>> + /* Number of Records To Pre-allocate */ >>> + build_append_int_noprefix(table_data, 1, 4); >>> + /* Max Sections Per Record */ >>> + build_append_int_noprefix(table_data, 1, 4); >>> + /* Max Raw Data Length */ >>> + build_append_int_noprefix(table_data, ACPI_GHES_MAX_RAW_DATA_LENGTH, 4); >>> + >>> + /* Error Status Address */ >>> + build_append_gas(table_data, AML_AS_SYSTEM_MEMORY, 0x40, 0, >>> + 4 /* QWord access */, 0); >>> + bios_linker_loader_add_pointer(linker, ACPI_BUILD_TABLE_FILE, >>> + ACPI_GHES_ERROR_STATUS_ADDRESS_OFFSET(hest_start, source_id), >> it's fine only if GHESv2 is the only entries in HEST, but once >> other types are added this macro will silently fall apart and >> cause table corruption. why silently fall? I think the acpi_ghes.c only support GHESv2 type, not support other type. >> >> Instead of offset from hest_start, I suggest to use offset relative >> to GAS structure, here is an idea>> >> #define GAS_ADDR_OFFSET 4 >> >> off = table->len >> build_append_gas() >> bios_linker_loader_add_pointer(..., >> off + GAS_ADDR_OFFSET, ... If use offset relative to GAS structure, the code does not easily extend to support more Generic Hardware Error Source. if use offset relative to hest_start, just use a loop, the code can support more error source, for example: for (source_id = 0; i