From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 2002:a17:505:1e8b:b0:1be9:327d:8ee3 with SMTP id mw11csp924457njb; Mon, 5 Aug 2024 10:03:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVAowKtfHLALFTX528APGwtrkr26aa1CgkqHQOo+Lht05Hixpxe6hbCVDR4K7Q1EaRLTG/y05E/3q1DRpazIyTmzT419UUZ X-Google-Smtp-Source: AGHT+IEckML6xh1Gc+fDgMM4mIHlJfEYU3HK/uvbcOH3zvTCOf616jrZK44kAVuYunIAVyQPFycQ X-Received: by 2002:a05:6102:c4b:b0:48f:df3b:9827 with SMTP id ada2fe7eead31-4945bf4bb72mr13606697137.31.1722877428446; Mon, 05 Aug 2024 10:03:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1722877428; cv=pass; d=google.com; s=arc-20160816; b=aKitBp2R1NAmItQ9ZobabW4R+93lgan4ugvMoazycyb4R+YoWAdzJN1JwjPc0Dm1cm DGwRnShbT5600jWjwSVLxoIdGJrcF88V319WoB7SjMpDT7fWgfK5+/ISjgumClctlqT+ mr7Fq2WC9EgiIpFJadbYqhxAjfxBcKhRnS7ftD87TnTH8TEU4K0Q8IwTA4h4fCKmIyPP Rk9plDTrigAV0gXajHdsgKszZoltPG844iwNlYGUc+/TB+DX0eByvKubAQc0beE+EGxC owHUq2+zpFjcY9oK6YwvRnlVpVxJkO2Bt9sq2I1CoWYFOHO88YwCUmOE0zuhAOVXQD/S 9DRQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:organization:references :in-reply-to:message-id:subject:cc:to:from:date; bh=HTZh4E25zGpGZtYWuTZP4kvSau7wDKOqPThd9FQka3U=; fh=c5SdJPmuZjLqL/yVd759G8+oVgaaCcPKba91GgsaS4c=; b=Ga3or50LpY9cfiw20lzxSUo46FfwSc5p5JAuiCjlRVBMow7Sdu6x1u7FTgHq+yzfZR O0/nWwWwIFWKP6Iz7swAukOFjaWHaBn5x/Oi1MGptgdGvKr68xvZJGMPv/FyZnWhVErz gqQol0tgpVhjuW2VGqimULM0F/tjhTOCHDmI7W2Ih6K6CAjtlZJMGr+duGSN+C+6uyPg v6bAcNuviwbCsahDy8ykLwsIRLokBQO0y5C/HS7tOad0aYg9YMYILbVpeuV96/ukrF7O 3d8l4bwFWaGBuTdRCwSzm31mwfpoV86LkKETeZ4dclITmB7cKIfIoCzI0D7lVVx1Otkn hFAw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-275038-alex.bennee=linaro.org@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-275038-alex.bennee=linaro.org@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id ada2fe7eead31-4945da8154dsi1793723137.104.2024.08.05.10.03.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Aug 2024 10:03:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-275038-alex.bennee=linaro.org@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-275038-alex.bennee=linaro.org@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-275038-alex.bennee=linaro.org@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 270521C21DCA for ; Mon, 5 Aug 2024 17:03:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0EA4515ECED; Mon, 5 Aug 2024 17:03:36 +0000 (UTC) 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 6D2CE15ECCA for ; Mon, 5 Aug 2024 17:03:32 +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=1722877415; cv=none; b=IFwJGokCPTjy19QJnyHsa8puWOmo3cq8FqOJmZkeh/R4gRG0LQ2zpVjI7eEMwbzSxlOWgB+staf7Q7dC75AFiFoCRWfzoPRcEd+h0YynrZk5ijyuPCIcipQqPLYrJpUY++ky0MumRCf4iKn3/j5OM03OLg36sDDasgnhOWEs3h0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722877415; c=relaxed/simple; bh=Dn2k5qh3qBvNIHK1xSaAQ0OAAUVlMKuU+Zr79+pBPFI=; h=Date:From:To:CC:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=adIVmXQoG8IdcCfBeXRqNhVLaxs4zdRj2MuhMSS26jTyqEXDxh8O5Wk/BRwkJM1UI/D2czCxG3LQohnxrXyHgDveIjxDlM5kKLA/1lD5R7R0Y/GD6jzwaaYuLKMKK7wZLx6lstiVbuKDGT8PE64cZPJuJYhjggzyciIlhDueULI= 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.31]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Wd2lJ1Jw9z6K5Tg; Tue, 6 Aug 2024 01:01:16 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 0C3DE140A87; Tue, 6 Aug 2024 01:03:30 +0800 (CST) Received: from localhost (10.203.177.66) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 5 Aug 2024 18:03:29 +0100 Date: Mon, 5 Aug 2024 18:03:28 +0100 From: Jonathan Cameron To: Mauro Carvalho Chehab CC: Shiju Jose , "Michael S. Tsirkin" , Ani Sinha , Dongjiu Geng , Igor Mammedov , , , Subject: Re: [PATCH v5 6/7] acpi/ghes: add support for generic error injection via QAPI Message-ID: <20240805180328.00003a82@Huawei.com> In-Reply-To: <20c491e357340e0062b6ff09867c1661ed4d2479.1722634602.git.mchehab+huawei@kernel.org> References: <20c491e357340e0062b6ff09867c1661ed4d2479.1722634602.git.mchehab+huawei@kernel.org> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; 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: lhrpeml100002.china.huawei.com (7.191.160.241) To lhrpeml500005.china.huawei.com (7.191.163.240) X-TUID: IKCmO5uXmTLm On Fri, 2 Aug 2024 23:44:01 +0200 Mauro Carvalho Chehab wrote: > Provide a generic interface for error injection via GHESv2. > > This patch is co-authored: > - original ghes logic to inject a simple ARM record by Shiju Jose; > - generic logic to handle block addresses by Jonathan Cameron; > - generic GHESv2 error inject by Mauro Carvalho Chehab; > > Co-authored-by: Jonathan Cameron > Co-authored-by: Shiju Jose > Co-authored-by: Mauro Carvalho Chehab > Cc: Jonathan Cameron > Cc: Shiju Jose > Signed-off-by: Mauro Carvalho Chehab Looks fine to me. Feel free to put in my SoB on the resulting co-auth Signed-off-by: Jonathan Cameron if appropriate? Does this work same as kernel co-developed-by? > +void ghes_record_cper_errors(AcpiGhesCper *cper, Error **errp, > + uint32_t notify) > +{ > + int read_ack = 0; > + uint32_t i; > + uint64_t read_ack_addr = 0; > + uint64_t error_block_addr = 0; > + uint32_t data_length; > + GArray *block; > + > + if (!ghes_get_addr(notify, &error_block_addr, &read_ack_addr)) { > + error_setg(errp, "GHES: Invalid error block/ack address(es)"); > + return; > + } > + > + cpu_physical_memory_read(read_ack_addr, > + &read_ack, sizeof(uint64_t)); > + > + /* zero means OSPM does not acknowledge the error */ > + if (!read_ack) { > + error_setg(errp, > + "Last CPER record was not acknowledged yet"); > + read_ack = 1; > + cpu_physical_memory_write(read_ack_addr, > + &read_ack, sizeof(uint64_t)); > + return; > + } > + > + read_ack = cpu_to_le64(0); > + cpu_physical_memory_write(read_ack_addr, > + &read_ack, sizeof(uint64_t)); > + > + /* Build CPER record */ > + > + /* > + * Invalid fru id: ACPI 4.0: 17.3.2.6.1 Generic Error Data, > + * Table 17-13 Generic Error Data Entry > + */ > + QemuUUID fru_id = {}; > + > + block = g_array_new(false, true /* clear */, 1); > + data_length = ACPI_GHES_DATA_LENGTH + cper->data_len; > + > + /* Odd formatting. > + * It should not run out of the preallocated memory if > + * adding a new generic error data entry > + */ > + assert((data_length + ACPI_GHES_GESB_SIZE) <= > + ACPI_GHES_MAX_RAW_DATA_LENGTH); > + > + /* Build the new generic error status block header */ > + acpi_ghes_generic_error_status(block, ACPI_GEBS_UNCORRECTABLE, > + 0, 0, data_length, > + ACPI_CPER_SEV_RECOVERABLE); > + > + /* Build this new generic error data entry header */ > + acpi_ghes_generic_error_data(block, cper->guid, > + ACPI_CPER_SEV_RECOVERABLE, 0, 0, > + cper->data_len, fru_id, 0); > + > + /* Add CPER data */ > + for (i = 0; i < cper->data_len; i++) { > + build_append_int_noprefix(block, cper->data[i], 1); > + } > + > + /* Write the generic error data entry into guest memory */ > + cpu_physical_memory_write(error_block_addr, block->data, block->len); > + > + g_array_free(block, true); > + > + notifier_list_notify(&generic_error_notifiers, NULL); > +} > + > bool acpi_ghes_present(void) > { > AcpiGedState *acpi_ged_state; 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 7D3E1C3DA4A for ; Mon, 5 Aug 2024 17:04:00 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sb17S-0006zc-R2; Mon, 05 Aug 2024 13:03:38 -0400 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 1sb17O-0006x5-2o; Mon, 05 Aug 2024 13:03:34 -0400 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 1sb17M-00067f-64; Mon, 05 Aug 2024 13:03:33 -0400 Received: from mail.maildlp.com (unknown [172.18.186.31]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Wd2lJ1Jw9z6K5Tg; Tue, 6 Aug 2024 01:01:16 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 0C3DE140A87; Tue, 6 Aug 2024 01:03:30 +0800 (CST) Received: from localhost (10.203.177.66) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 5 Aug 2024 18:03:29 +0100 Date: Mon, 5 Aug 2024 18:03:28 +0100 To: Mauro Carvalho Chehab CC: Shiju Jose , "Michael S. Tsirkin" , Ani Sinha , Dongjiu Geng , Igor Mammedov , , , Subject: Re: [PATCH v5 6/7] acpi/ghes: add support for generic error injection via QAPI Message-ID: <20240805180328.00003a82@Huawei.com> In-Reply-To: <20c491e357340e0062b6ff09867c1661ed4d2479.1722634602.git.mchehab+huawei@kernel.org> References: <20c491e357340e0062b6ff09867c1661ed4d2479.1722634602.git.mchehab+huawei@kernel.org> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; 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: lhrpeml100002.china.huawei.com (7.191.160.241) To lhrpeml500005.china.huawei.com (7.191.163.240) 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_H3=0.001, RCVD_IN_MSPIKE_WL=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 Fri, 2 Aug 2024 23:44:01 +0200 Mauro Carvalho Chehab wrote: > Provide a generic interface for error injection via GHESv2. > > This patch is co-authored: > - original ghes logic to inject a simple ARM record by Shiju Jose; > - generic logic to handle block addresses by Jonathan Cameron; > - generic GHESv2 error inject by Mauro Carvalho Chehab; > > Co-authored-by: Jonathan Cameron > Co-authored-by: Shiju Jose > Co-authored-by: Mauro Carvalho Chehab > Cc: Jonathan Cameron > Cc: Shiju Jose > Signed-off-by: Mauro Carvalho Chehab Looks fine to me. Feel free to put in my SoB on the resulting co-auth Signed-off-by: Jonathan Cameron if appropriate? Does this work same as kernel co-developed-by? > +void ghes_record_cper_errors(AcpiGhesCper *cper, Error **errp, > + uint32_t notify) > +{ > + int read_ack = 0; > + uint32_t i; > + uint64_t read_ack_addr = 0; > + uint64_t error_block_addr = 0; > + uint32_t data_length; > + GArray *block; > + > + if (!ghes_get_addr(notify, &error_block_addr, &read_ack_addr)) { > + error_setg(errp, "GHES: Invalid error block/ack address(es)"); > + return; > + } > + > + cpu_physical_memory_read(read_ack_addr, > + &read_ack, sizeof(uint64_t)); > + > + /* zero means OSPM does not acknowledge the error */ > + if (!read_ack) { > + error_setg(errp, > + "Last CPER record was not acknowledged yet"); > + read_ack = 1; > + cpu_physical_memory_write(read_ack_addr, > + &read_ack, sizeof(uint64_t)); > + return; > + } > + > + read_ack = cpu_to_le64(0); > + cpu_physical_memory_write(read_ack_addr, > + &read_ack, sizeof(uint64_t)); > + > + /* Build CPER record */ > + > + /* > + * Invalid fru id: ACPI 4.0: 17.3.2.6.1 Generic Error Data, > + * Table 17-13 Generic Error Data Entry > + */ > + QemuUUID fru_id = {}; > + > + block = g_array_new(false, true /* clear */, 1); > + data_length = ACPI_GHES_DATA_LENGTH + cper->data_len; > + > + /* Odd formatting. > + * It should not run out of the preallocated memory if > + * adding a new generic error data entry > + */ > + assert((data_length + ACPI_GHES_GESB_SIZE) <= > + ACPI_GHES_MAX_RAW_DATA_LENGTH); > + > + /* Build the new generic error status block header */ > + acpi_ghes_generic_error_status(block, ACPI_GEBS_UNCORRECTABLE, > + 0, 0, data_length, > + ACPI_CPER_SEV_RECOVERABLE); > + > + /* Build this new generic error data entry header */ > + acpi_ghes_generic_error_data(block, cper->guid, > + ACPI_CPER_SEV_RECOVERABLE, 0, 0, > + cper->data_len, fru_id, 0); > + > + /* Add CPER data */ > + for (i = 0; i < cper->data_len; i++) { > + build_append_int_noprefix(block, cper->data[i], 1); > + } > + > + /* Write the generic error data entry into guest memory */ > + cpu_physical_memory_write(error_block_addr, block->data, block->len); > + > + g_array_free(block, true); > + > + notifier_list_notify(&generic_error_notifiers, NULL); > +} > + > bool acpi_ghes_present(void) > { > AcpiGedState *acpi_ged_state;