From: gengdongjiu <gengdongjiu@huawei.com>
To: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
Cc: <pbonzini@redhat.com>, <mst@redhat.com>, <imammedo@redhat.com>,
<shannon.zhaosl@gmail.com>, <peter.maydell@linaro.org>,
<fam@euphon.net>, <rth@twiddle.net>, <ehabkost@redhat.com>,
<mtosatti@redhat.com>, <xuwei5@huawei.com>, <james.morse@arm.com>,
<qemu-devel@nongnu.org>, <kvm@vger.kernel.org>,
<qemu-arm@nongnu.org>, <zhengxiang9@huawei.com>,
<linuxarm@huawei.com>
Subject: Re: [PATCH v22 4/9] ACPI: Build Hardware Error Source Table
Date: Mon, 10 Feb 2020 19:18:05 +0800 [thread overview]
Message-ID: <f24fb648-a06b-0b97-1afa-e4ed6137a7d4@huawei.com> (raw)
In-Reply-To: <20200205164328.00006f1e@Huawei.com>
On 2020/2/6 0:43, Jonathan Cameron wrote:
> On Wed, 8 Jan 2020 19:32:18 +0800
> Dongjiu Geng <gengdongjiu@huawei.com> wrote:
>
>> This patch builds Hardware Error Source Table(HEST) via fw_cfg blobs.
>> Now it only supports ARMv8 SEA, a type of Generic Hardware Error
>> Source version 2(GHESv2) error source. Afterwards, we can extend
>> the supported types if needed. For the CPER section, currently it
>> is memory section because kernel mainly wants userspace to handle
>> the memory errors.
>>
>> This patch follows the spec ACPI 6.2 to build the Hardware Error
>> Source table. For more detailed information, please refer to
>> document: docs/specs/acpi_hest_ghes.rst
>>
>> build_append_ghes_notify() will help to add Hardware Error Notification
>> to ACPI tables without using packed C structures and avoid endianness
>> issues as API doesn't need explicit conversion.
>>
>> Signed-off-by: Dongjiu Geng <gengdongjiu@huawei.com>
>> Signed-off-by: Xiang Zheng <zhengxiang9@huawei.com>
>> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
>> Acked-by: Xiang Zheng <zhengxiang9@huawei.com>
>
> Hi.
>
> I was forwards porting my old series adding CCIX error injection support
> and came across a place this could 'possibly' be improved.
Jonathan, It is great that you add CCIX error injection support based on this series.
thanks for using it.
>
> I say possibly because it's really about enabling more flexibility
> in how this code is reused than actually 'fixing' anything here.
>
> If you don't make the change here, I'll just add a precursor patch to my
> series. Just seems nice to tidy it up at source.
sure, I make a change to make your patch work well.
>
> The rest of the partMake your patch very good work.s of this series I am using seems to work great.
>
> Thanks!
>
> Jonathan
>
>> ---
>> hw/acpi/ghes.c | 118 ++++++++++++++++++++++++++++++++++++++++++++++-
>> hw/arm/virt-acpi-build.c | 2 +
>> include/hw/acpi/ghes.h | 40 ++++++++++++++++
>> 3 files changed, 159 insertions(+), 1 deletion(-)
>>
>> diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c
>> index b7fdbbb..9d37798 100644
>> --- a/hw/acpi/ghes.c
>> +++ b/hw/acpi/ghes.c
>> @@ -34,9 +34,42 @@
>> +
> ...
>> +/* Build Generic Hardware Error Source version 2 (GHESv2) */
>> +static void build_ghes_v2(GArray *table_data, int source_id, BIOSLinker *linker)
> This function takes source ID, which uses the enum of all sources registered.
> However, it doesn't use it to locate the actual physical addresses.
>
> Currently the code effectively assumes the value is 0.
yes, because there is only one source, so the value is 0.
>
>> +{
>> + uint64_t address_offset;
>> + /*
>> + * Type:
>> + * Generic Hardware Error Source version 2(GHESv2 - Type 10)
>> + */
>> + build_append_int_noprefix(table_data, ACPI_GHES_SOURCE_GENERIC_ERROR_V2, 2);
>> + /* Source Id */
>> + 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);
>> +
>> + address_offset = table_data->len;
>> + /* 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,
>> + address_offset + GAS_ADDR_OFFSET,
>> + sizeof(uint64_t), ACPI_GHES_ERRORS_FW_CFG_FILE, 0);
>
> The offset here would need to be source_id * sizeof(uint64_t) I think
>
>> +
>> + /*
>> + * Notification Structure
>> + * Now only enable ARMv8 SEA notification type
>> + */
>> + build_ghes_hw_error_notification(table_data, ACPI_GHES_NOTIFY_SEA);
> Perhaps a switch for this to allow for other options later.
OK, I will make this change in order to easily support more hardware error source.
>
> switch (source_id) {
> case ACPI_HEST_SRC_ID_SEA:
> ...
> break;
> default:
> //print some error message.
>
> }
ok
>> +
>> + /* Error Status Block Length */
>> + build_append_int_noprefix(table_data, ACPI_GHES_MAX_RAW_DATA_LENGTH, 4);
>> +
>> + /*
>> + * Read Ack Register
>> + * ACPI 6.1: 18.3.2.8 Generic Hardware Error Source
>> + * version 2 (GHESv2 - Type 10)
>> + */
>> + address_offset = table_data->len;
>> + 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,
>> + address_offset + GAS_ADDR_OFFSET,
>> + sizeof(uint64_t), ACPI_GHES_ERRORS_FW_CFG_FILE,
>> + ACPI_GHES_ERROR_SOURCE_COUNT * sizeof(uint64_t));
>
> Offset of (ACPI_GHES_ERROR_SOURCE_COUNT + source_id) * sizeof(uint64_t)
yes, It due to I only support one source, the source_id is zero and not use it.
In order to easily extend, I will add this change.
>
>> +
>> + /*
>> + * Read Ack Preserve
>> + * We only provide the first bit in Read Ack Register to OSPM to write
>> + * while the other bits are preserved.
>> + */
>> + build_append_int_noprefix(table_data, ~0x1ULL, 8);
>> + /* Read Ack Write */
>> + build_append_int_noprefix(table_data, 0x1, 8);
>> +}
>
>
>
> .
>
next prev parent reply other threads:[~2020-02-10 11:18 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-08 11:32 [PATCH v22 0/9] Add ARMv8 RAS virtualization support in QEMU Dongjiu Geng
2020-01-08 11:32 ` [PATCH v22 1/9] hw/arm/virt: Introduce a RAS machine option Dongjiu Geng
2020-01-08 11:32 ` [PATCH v22 2/9] docs: APEI GHES generation and CPER record description Dongjiu Geng
2020-01-15 15:11 ` Igor Mammedov
2020-01-08 11:32 ` [PATCH v22 3/9] ACPI: Build related register address fields via hardware error fw_cfg blob Dongjiu Geng
2020-01-23 15:14 ` Igor Mammedov
2020-02-02 14:01 ` gengdongjiu
2020-01-08 11:32 ` [PATCH v22 4/9] ACPI: Build Hardware Error Source Table Dongjiu Geng
2020-01-23 15:48 ` Igor Mammedov
2020-02-02 14:21 ` gengdongjiu
2020-02-05 16:43 ` Jonathan Cameron
2020-02-10 11:18 ` gengdongjiu [this message]
2020-01-08 11:32 ` [PATCH v22 5/9] ACPI: Record the Generic Error Status Block address Dongjiu Geng
2020-01-16 16:44 ` Peter Maydell
2020-01-17 10:36 ` gengdongjiu
2020-02-13 15:28 ` gengdongjiu
2020-01-17 7:39 ` Philippe Mathieu-Daudé
2020-01-17 10:47 ` gengdongjiu
2020-01-17 11:20 ` Philippe Mathieu-Daudé
2020-01-28 14:41 ` Igor Mammedov
2020-01-28 16:19 ` Igor Mammedov
2020-02-02 12:44 ` gengdongjiu
2020-02-03 7:51 ` Igor Mammedov
2020-01-08 11:32 ` [PATCH v22 6/9] KVM: Move hwpoison page related functions into kvm-all.c Dongjiu Geng
2020-01-08 11:32 ` [PATCH v22 7/9] ACPI: Record Generic Error Status Block(GESB) table Dongjiu Geng
2020-01-28 15:29 ` Igor Mammedov
2020-02-02 13:42 ` gengdongjiu
2020-02-03 7:55 ` Igor Mammedov
2020-01-08 11:32 ` [PATCH v22 8/9] target-arm: kvm64: handle SIGBUS signal from kernel or KVM Dongjiu Geng
2020-01-16 16:28 ` Peter Maydell
2020-01-16 16:40 ` Peter Maydell
2020-01-17 10:04 ` gengdongjiu
2020-01-20 12:15 ` Peter Maydell
2020-01-22 15:30 ` gengdongjiu
2020-01-08 11:32 ` [PATCH v22 9/9] MAINTAINERS: Add ACPI/HEST/GHES entries Dongjiu Geng
2020-01-16 16:46 ` Peter Maydell
2020-01-17 7:22 ` Philippe Mathieu-Daudé
2020-01-17 10:16 ` gengdongjiu
2020-01-17 11:09 ` Peter Maydell
2020-01-17 11:22 ` Philippe Mathieu-Daudé
2020-01-19 8:19 ` gengdongjiu
2020-01-17 12:19 ` Michael S. Tsirkin
2020-01-09 3:38 ` [PATCH v22 0/9] Add ARMv8 RAS virtualization support in QEMU 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=f24fb648-a06b-0b97-1afa-e4ed6137a7d4@huawei.com \
--to=gengdongjiu@huawei.com \
--cc=Jonathan.Cameron@Huawei.com \
--cc=ehabkost@redhat.com \
--cc=fam@euphon.net \
--cc=imammedo@redhat.com \
--cc=james.morse@arm.com \
--cc=kvm@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=mst@redhat.com \
--cc=mtosatti@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
--cc=shannon.zhaosl@gmail.com \
--cc=xuwei5@huawei.com \
--cc=zhengxiang9@huawei.com \
/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;
as well as URLs for NNTP newsgroup(s).