From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 2002:a17:505:a60a:b0:1be9:327d:8ee3 with SMTP id qv10csp4011387njc; Wed, 20 Nov 2024 07:09:49 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXSiTTrKNlvltefiVVlLJuJ8q43V8ca2Ey/uwoJTzendrfCFzkRQprLUYlPquzSwvbaV9VCvrD+0gaTNw==@linaro.org X-Google-Smtp-Source: AGHT+IHMpjnoNl9UOF/XZeAjsnp7T7aftUfeUnBTeCnoe1tL3WXNM1yQ9dFlvEXDoJWd+zsB2j4r X-Received: by 2002:a05:6358:7288:b0:1b5:f95a:5a67 with SMTP id e5c5f4694b2df-1ca664a2216mr150488055d.15.1732115389113; Wed, 20 Nov 2024 07:09:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732115389; cv=none; d=google.com; s=arc-20240605; b=UN2uGmbl2r46o+h9SEKsHcgggWi7DyJZCe+0efJEQ4+svSARcNKpUxEeCAYdNk2bFm DKT9b3E1lL6axseY6paFfhcctyJfysoWhR6swh2HhiNDnsfV69tNb3mYfABPC1uPbGjO gPi3zcJEvq7BxXPl05wfZ4VKiyj6b9fv+xgk48/aEltwDz4rxw7xtV8n1RenGyWcw5Uu 0t9dimgETN9SfaEV/vStKtvZKsOs39FacbnmkJcXflqTtEmQUKTwA3GDYUeHASg8Msia WHzkW2fGCnw+H/0X7XFjcdfZMfZT+PGu9cFMAQvxvFwTPypXWMErUOk/WjuaJX5xMc1S xS+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:from:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:date; bh=Oqol2x4lJN9D6tWhmq0aSH+ftlzTaS/xosmPSXOHKGo=; fh=Y4mkk80SYzC6pPdAHn8c6jPp//k/fEvb32jx45v2XC8=; b=R2xynxxF/FVjqZCwSe+vkf85FRZD+ShyIs66aUcgwlhcRLyZS8RdlFzsaMacpPEYRO UPAR1nl0LtO9CpjJaXKDOByBMOOtJ2Xe18VvaqABZ6vQldcoMRvoeoSOoG7R9n/lKRFj Ucg1kN5OQzYiw9SZ4h3iFm8lNA2Molsp1EQi26gvltwXAYW9IIRmVk9xRsRzYPaseWPB VeYw6dnbi+UPGJZ75fwD+4r5c5/F3YdMQ74+dTXJlk39B9Ssjxn2IoSrHj+ITmn3z8wM FoEtZ7ZUIsw8RghqLnmNlZss5YeqdKIhPD/vBJ2slp9viqEdrX6Xl7D+FV2Rx1/1XA9i lbZA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 71dfb90a1353d-514dcbebde7si108644e0c.94.2024.11.20.07.09.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 Nov 2024 07:09:49 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nongnu.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tDmKl-0006Bk-Ld; Wed, 20 Nov 2024 10:09:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tDmKj-0006B2-Gr; Wed, 20 Nov 2024 10:09:33 -0500 Received: from frasgout.his.huawei.com ([185.176.79.56]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tDmKh-0005NT-Pf; Wed, 20 Nov 2024 10:09:33 -0500 Received: from mail.maildlp.com (unknown [172.18.186.216]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4XtlBV2KDdz6LD78; Wed, 20 Nov 2024 23:09:06 +0800 (CST) Received: from frapeml500008.china.huawei.com (unknown [7.182.85.71]) by mail.maildlp.com (Postfix) with ESMTPS id ED86C140D26; Wed, 20 Nov 2024 23:09:28 +0800 (CST) Received: from localhost (10.203.177.66) by frapeml500008.china.huawei.com (7.182.85.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Wed, 20 Nov 2024 16:09:28 +0100 Date: Wed, 20 Nov 2024 15:09:26 +0000 To: Mauro Carvalho Chehab CC: Igor Mammedov , Shiju Jose , "Michael S. Tsirkin" , Philippe =?ISO-8859-1?Q?Mathieu-Da?= =?ISO-8859-1?Q?ud=E9?= , Ani Sinha , Dongjiu Geng , "Eduardo Habkost" , Marcel Apfelbaum , Peter Maydell , Shannon Zhao , Yanan Wang , Zhao Liu , , , Subject: Re: [PATCH 6/6] acpi/generic_event_device: add logic to detect if HEST addr is available Message-ID: <20241120150926.00003db6@huawei.com> In-Reply-To: <92fdd4cbfb0b52450cd0a2abac0a3227458c9618.1731486604.git.mchehab+huawei@kernel.org> References: <92fdd4cbfb0b52450cd0a2abac0a3227458c9618.1731486604.git.mchehab+huawei@kernel.org> X-Mailer: Claws Mail 4.3.0 (GTK 3.24.42; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.203.177.66] X-ClientProxiedBy: lhrpeml500012.china.huawei.com (7.191.174.4) To frapeml500008.china.huawei.com (7.182.85.71) Received-SPF: pass client-ip=185.176.79.56; envelope-from=jonathan.cameron@huawei.com; helo=frasgout.his.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-arm@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Jonathan Cameron From: Jonathan Cameron via Errors-To: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org Sender: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org X-TUID: hIWb/joZuBoe On Wed, 13 Nov 2024 09:37:03 +0100 Mauro Carvalho Chehab wrote: > Create a new property (x-has-hest-addr) and use it to detect if > the GHES table offsets can be calculated from the HEST address > (qemu 9.2 and upper) or via the legacy way via an offset obtained > from the hardware_errors firmware file. > > Signed-off-by: Mauro Carvalho Chehab Comments inline. Nice work hammering all this into shape. Thanks, Jonathan > --- > hw/acpi/generic_event_device.c | 1 + > hw/acpi/ghes.c | 27 ++++++++++++++++++++------- > hw/arm/virt-acpi-build.c | 30 ++++++++++++++++++++++++++---- > hw/core/machine.c | 2 ++ > include/hw/acpi/ghes.h | 1 + > 5 files changed, 50 insertions(+), 11 deletions(-) > > diff --git a/hw/acpi/generic_event_device.c b/hw/acpi/generic_event_device.c > index c1116dd8d7ae..df6b4fab2d30 100644 > --- a/hw/acpi/generic_event_device.c > +++ b/hw/acpi/generic_event_device.c > @@ -318,6 +318,7 @@ static void acpi_ged_send_event(AcpiDeviceIf *adev, AcpiEventStatusBits ev) > > static Property acpi_ged_properties[] = { > DEFINE_PROP_UINT32("ged-event", AcpiGedState, ged_event_bitmap, 0), > + DEFINE_PROP_BOOL("x-has-hest-addr", AcpiGedState, ghes_state.hest_lookup, true), > DEFINE_PROP_END_OF_LIST(), > }; > > diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c > index 9ee25efe8abf..2d34a6ddf133 100644 > --- a/hw/acpi/ghes.c > +++ b/hw/acpi/ghes.c > @@ -365,6 +365,8 @@ void acpi_build_hest(GArray *table_data, GArray *hardware_errors, > { > AcpiTable table = { .sig = "HEST", .rev = 1, > .oem_id = oem_id, .oem_table_id = oem_table_id }; > + AcpiGedState *acpi_ged_state; > + AcpiGhesState *ags = NULL; > int i; > > build_ghes_error_table(hardware_errors, linker, num_sources); > @@ -385,10 +387,19 @@ void acpi_build_hest(GArray *table_data, GArray *hardware_errors, > * tell firmware to write into GPA the address of HEST via fw_cfg, > * once initialized. > */ > - bios_linker_loader_write_pointer(linker, > - ACPI_HEST_ADDR_FW_CFG_FILE, 0, > - sizeof(uint64_t), > - ACPI_BUILD_TABLE_FILE, hest_offset); > + > + acpi_ged_state = ACPI_GED(object_resolve_path_type("", TYPE_ACPI_GED, > + NULL)); > + if (acpi_ged_state) { Won't fail, but if it did (And given you have a check you are assuming it might). > + ags = &acpi_ged_state->ghes_state; > + } > + Then ags is NULL and boom. > + if (ags->hest_lookup) { > + bios_linker_loader_write_pointer(linker, > + ACPI_HEST_ADDR_FW_CFG_FILE, 0, > + sizeof(uint64_t), > + ACPI_BUILD_TABLE_FILE, hest_offset); > + } > } > diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c > index 40f66792570c..930ba9e0a14c 100644 > --- a/hw/arm/virt-acpi-build.c > +++ b/hw/arm/virt-acpi-build.c > @@ -893,6 +893,10 @@ static const AcpiNotificationSourceId hest_ghes_notify[] = { > {ACPI_HEST_SRC_ID_SYNC, ACPI_GHES_NOTIFY_SEA}, > }; > > +static const AcpiNotificationSourceId hest_ghes_notify_9_1[] = { > + {ACPI_HEST_SRC_ID_SYNC, ACPI_GHES_NOTIFY_SEA}, { ACPI... > +}; 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 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C3E89D711AD for ; Wed, 20 Nov 2024 15:10:34 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tDmKl-0006Bc-Et; Wed, 20 Nov 2024 10:09:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tDmKj-0006B2-Gr; Wed, 20 Nov 2024 10:09:33 -0500 Received: from frasgout.his.huawei.com ([185.176.79.56]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tDmKh-0005NT-Pf; Wed, 20 Nov 2024 10:09:33 -0500 Received: from mail.maildlp.com (unknown [172.18.186.216]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4XtlBV2KDdz6LD78; Wed, 20 Nov 2024 23:09:06 +0800 (CST) Received: from frapeml500008.china.huawei.com (unknown [7.182.85.71]) by mail.maildlp.com (Postfix) with ESMTPS id ED86C140D26; Wed, 20 Nov 2024 23:09:28 +0800 (CST) Received: from localhost (10.203.177.66) by frapeml500008.china.huawei.com (7.182.85.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Wed, 20 Nov 2024 16:09:28 +0100 Date: Wed, 20 Nov 2024 15:09:26 +0000 To: Mauro Carvalho Chehab CC: Igor Mammedov , Shiju Jose , "Michael S. Tsirkin" , Philippe =?ISO-8859-1?Q?Mathieu-Da?= =?ISO-8859-1?Q?ud=E9?= , Ani Sinha , Dongjiu Geng , "Eduardo Habkost" , Marcel Apfelbaum , Peter Maydell , Shannon Zhao , Yanan Wang , Zhao Liu , , , Subject: Re: [PATCH 6/6] acpi/generic_event_device: add logic to detect if HEST addr is available Message-ID: <20241120150926.00003db6@huawei.com> In-Reply-To: <92fdd4cbfb0b52450cd0a2abac0a3227458c9618.1731486604.git.mchehab+huawei@kernel.org> References: <92fdd4cbfb0b52450cd0a2abac0a3227458c9618.1731486604.git.mchehab+huawei@kernel.org> X-Mailer: Claws Mail 4.3.0 (GTK 3.24.42; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.203.177.66] X-ClientProxiedBy: lhrpeml500012.china.huawei.com (7.191.174.4) To frapeml500008.china.huawei.com (7.182.85.71) Received-SPF: pass client-ip=185.176.79.56; envelope-from=jonathan.cameron@huawei.com; helo=frasgout.his.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Jonathan Cameron From: Jonathan Cameron via Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org On Wed, 13 Nov 2024 09:37:03 +0100 Mauro Carvalho Chehab wrote: > Create a new property (x-has-hest-addr) and use it to detect if > the GHES table offsets can be calculated from the HEST address > (qemu 9.2 and upper) or via the legacy way via an offset obtained > from the hardware_errors firmware file. > > Signed-off-by: Mauro Carvalho Chehab Comments inline. Nice work hammering all this into shape. Thanks, Jonathan > --- > hw/acpi/generic_event_device.c | 1 + > hw/acpi/ghes.c | 27 ++++++++++++++++++++------- > hw/arm/virt-acpi-build.c | 30 ++++++++++++++++++++++++++---- > hw/core/machine.c | 2 ++ > include/hw/acpi/ghes.h | 1 + > 5 files changed, 50 insertions(+), 11 deletions(-) > > diff --git a/hw/acpi/generic_event_device.c b/hw/acpi/generic_event_device.c > index c1116dd8d7ae..df6b4fab2d30 100644 > --- a/hw/acpi/generic_event_device.c > +++ b/hw/acpi/generic_event_device.c > @@ -318,6 +318,7 @@ static void acpi_ged_send_event(AcpiDeviceIf *adev, AcpiEventStatusBits ev) > > static Property acpi_ged_properties[] = { > DEFINE_PROP_UINT32("ged-event", AcpiGedState, ged_event_bitmap, 0), > + DEFINE_PROP_BOOL("x-has-hest-addr", AcpiGedState, ghes_state.hest_lookup, true), > DEFINE_PROP_END_OF_LIST(), > }; > > diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c > index 9ee25efe8abf..2d34a6ddf133 100644 > --- a/hw/acpi/ghes.c > +++ b/hw/acpi/ghes.c > @@ -365,6 +365,8 @@ void acpi_build_hest(GArray *table_data, GArray *hardware_errors, > { > AcpiTable table = { .sig = "HEST", .rev = 1, > .oem_id = oem_id, .oem_table_id = oem_table_id }; > + AcpiGedState *acpi_ged_state; > + AcpiGhesState *ags = NULL; > int i; > > build_ghes_error_table(hardware_errors, linker, num_sources); > @@ -385,10 +387,19 @@ void acpi_build_hest(GArray *table_data, GArray *hardware_errors, > * tell firmware to write into GPA the address of HEST via fw_cfg, > * once initialized. > */ > - bios_linker_loader_write_pointer(linker, > - ACPI_HEST_ADDR_FW_CFG_FILE, 0, > - sizeof(uint64_t), > - ACPI_BUILD_TABLE_FILE, hest_offset); > + > + acpi_ged_state = ACPI_GED(object_resolve_path_type("", TYPE_ACPI_GED, > + NULL)); > + if (acpi_ged_state) { Won't fail, but if it did (And given you have a check you are assuming it might). > + ags = &acpi_ged_state->ghes_state; > + } > + Then ags is NULL and boom. > + if (ags->hest_lookup) { > + bios_linker_loader_write_pointer(linker, > + ACPI_HEST_ADDR_FW_CFG_FILE, 0, > + sizeof(uint64_t), > + ACPI_BUILD_TABLE_FILE, hest_offset); > + } > } > diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c > index 40f66792570c..930ba9e0a14c 100644 > --- a/hw/arm/virt-acpi-build.c > +++ b/hw/arm/virt-acpi-build.c > @@ -893,6 +893,10 @@ static const AcpiNotificationSourceId hest_ghes_notify[] = { > {ACPI_HEST_SRC_ID_SYNC, ACPI_GHES_NOTIFY_SEA}, > }; > > +static const AcpiNotificationSourceId hest_ghes_notify_9_1[] = { > + {ACPI_HEST_SRC_ID_SYNC, ACPI_GHES_NOTIFY_SEA}, { ACPI... > +}; From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 05E8D1AB508 for ; Wed, 20 Nov 2024 15:09:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732115373; cv=none; b=WjiyjIot3XtHLVevWrxZ1rKvufhA9zAKiQNCA6yJ0wGogrTivGmYTj8c1NdnV/PxDcYtY5KjP1PtWywok/il59VPLKMKAm+l82YL0YfOvEZoD5KhAw3avkQnr4kkna4NsbWv6lbXoLcEpBrsp6S/LmHdoGW87dyEWEZ3N6tGDTo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732115373; c=relaxed/simple; bh=TluUCMCw7yENRRFhV7x4IWhesvbQbZK9ddgdERckE7M=; h=Date:From:To:CC:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=hcnjf7piCrI9l6Z9jTvsCeyK4a1f3UBmU1hU4Qide6nLSjr251cq8Uea3tplkWuut9wI6ClD55McFflvrjxZdXlpo4+7TsSy+8CYmJgbI6KzYZvESeNFh7gztZxscA2FhlThIL0cm/ArVcT4Z4kFPbNxYeg3Zb2Y541A0TbNNa8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.216]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4XtlBV2KDdz6LD78; Wed, 20 Nov 2024 23:09:06 +0800 (CST) Received: from frapeml500008.china.huawei.com (unknown [7.182.85.71]) by mail.maildlp.com (Postfix) with ESMTPS id ED86C140D26; Wed, 20 Nov 2024 23:09:28 +0800 (CST) Received: from localhost (10.203.177.66) by frapeml500008.china.huawei.com (7.182.85.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Wed, 20 Nov 2024 16:09:28 +0100 Date: Wed, 20 Nov 2024 15:09:26 +0000 From: Jonathan Cameron To: Mauro Carvalho Chehab CC: Igor Mammedov , Shiju Jose , "Michael S. Tsirkin" , Philippe =?ISO-8859-1?Q?Mathieu-Da?= =?ISO-8859-1?Q?ud=E9?= , Ani Sinha , Dongjiu Geng , "Eduardo Habkost" , Marcel Apfelbaum , Peter Maydell , Shannon Zhao , Yanan Wang , Zhao Liu , , , Subject: Re: [PATCH 6/6] acpi/generic_event_device: add logic to detect if HEST addr is available Message-ID: <20241120150926.00003db6@huawei.com> In-Reply-To: <92fdd4cbfb0b52450cd0a2abac0a3227458c9618.1731486604.git.mchehab+huawei@kernel.org> References: <92fdd4cbfb0b52450cd0a2abac0a3227458c9618.1731486604.git.mchehab+huawei@kernel.org> X-Mailer: Claws Mail 4.3.0 (GTK 3.24.42; x86_64-w64-mingw32) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: lhrpeml500012.china.huawei.com (7.191.174.4) To frapeml500008.china.huawei.com (7.182.85.71) On Wed, 13 Nov 2024 09:37:03 +0100 Mauro Carvalho Chehab wrote: > Create a new property (x-has-hest-addr) and use it to detect if > the GHES table offsets can be calculated from the HEST address > (qemu 9.2 and upper) or via the legacy way via an offset obtained > from the hardware_errors firmware file. > > Signed-off-by: Mauro Carvalho Chehab Comments inline. Nice work hammering all this into shape. Thanks, Jonathan > --- > hw/acpi/generic_event_device.c | 1 + > hw/acpi/ghes.c | 27 ++++++++++++++++++++------- > hw/arm/virt-acpi-build.c | 30 ++++++++++++++++++++++++++---- > hw/core/machine.c | 2 ++ > include/hw/acpi/ghes.h | 1 + > 5 files changed, 50 insertions(+), 11 deletions(-) > > diff --git a/hw/acpi/generic_event_device.c b/hw/acpi/generic_event_device.c > index c1116dd8d7ae..df6b4fab2d30 100644 > --- a/hw/acpi/generic_event_device.c > +++ b/hw/acpi/generic_event_device.c > @@ -318,6 +318,7 @@ static void acpi_ged_send_event(AcpiDeviceIf *adev, AcpiEventStatusBits ev) > > static Property acpi_ged_properties[] = { > DEFINE_PROP_UINT32("ged-event", AcpiGedState, ged_event_bitmap, 0), > + DEFINE_PROP_BOOL("x-has-hest-addr", AcpiGedState, ghes_state.hest_lookup, true), > DEFINE_PROP_END_OF_LIST(), > }; > > diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c > index 9ee25efe8abf..2d34a6ddf133 100644 > --- a/hw/acpi/ghes.c > +++ b/hw/acpi/ghes.c > @@ -365,6 +365,8 @@ void acpi_build_hest(GArray *table_data, GArray *hardware_errors, > { > AcpiTable table = { .sig = "HEST", .rev = 1, > .oem_id = oem_id, .oem_table_id = oem_table_id }; > + AcpiGedState *acpi_ged_state; > + AcpiGhesState *ags = NULL; > int i; > > build_ghes_error_table(hardware_errors, linker, num_sources); > @@ -385,10 +387,19 @@ void acpi_build_hest(GArray *table_data, GArray *hardware_errors, > * tell firmware to write into GPA the address of HEST via fw_cfg, > * once initialized. > */ > - bios_linker_loader_write_pointer(linker, > - ACPI_HEST_ADDR_FW_CFG_FILE, 0, > - sizeof(uint64_t), > - ACPI_BUILD_TABLE_FILE, hest_offset); > + > + acpi_ged_state = ACPI_GED(object_resolve_path_type("", TYPE_ACPI_GED, > + NULL)); > + if (acpi_ged_state) { Won't fail, but if it did (And given you have a check you are assuming it might). > + ags = &acpi_ged_state->ghes_state; > + } > + Then ags is NULL and boom. > + if (ags->hest_lookup) { > + bios_linker_loader_write_pointer(linker, > + ACPI_HEST_ADDR_FW_CFG_FILE, 0, > + sizeof(uint64_t), > + ACPI_BUILD_TABLE_FILE, hest_offset); > + } > } > diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c > index 40f66792570c..930ba9e0a14c 100644 > --- a/hw/arm/virt-acpi-build.c > +++ b/hw/arm/virt-acpi-build.c > @@ -893,6 +893,10 @@ static const AcpiNotificationSourceId hest_ghes_notify[] = { > {ACPI_HEST_SRC_ID_SYNC, ACPI_GHES_NOTIFY_SEA}, > }; > > +static const AcpiNotificationSourceId hest_ghes_notify_9_1[] = { > + {ACPI_HEST_SRC_ID_SYNC, ACPI_GHES_NOTIFY_SEA}, { ACPI... > +};