From patchwork Thu Aug 8 12:26:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 13757350 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 664CFC52D6F for ; Thu, 8 Aug 2024 12:27:34 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sc2EH-0000Ow-DI; Thu, 08 Aug 2024 08:26:53 -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 1sc2EE-0000BW-Q5 for qemu-devel@nongnu.org; Thu, 08 Aug 2024 08:26:52 -0400 Received: from sin.source.kernel.org ([145.40.73.55]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sc2EB-0005xy-Hb for qemu-devel@nongnu.org; Thu, 08 Aug 2024 08:26:49 -0400 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id DFBCECE13D6; Thu, 8 Aug 2024 12:26:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB218C4AF19; Thu, 8 Aug 2024 12:26:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723120003; bh=rEyXbt+nHyXfhaHjwgifZvCFRsjRrNRv8uaioILzvnk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oUFymcJd+FLhY18BhBN9DZVPJ5JTVDrqAPSAC08ovTReEk4oiVx0HGCueUBlAO2d/ GvY2OIXFCWhWSWSrcR0/IgtcWHeg+GDS5rY+ZnBypCh3mrZnBeF3c4ZiFOkk7ag9VA buMx+OvGVC1wk/KTfh2l4RZRNsfMQ5jNGttUwgs3ZDiubg4DWsrYu3ETCzC7gGdO+f tvJvYV43YEGMsfIBSAXQjB0sH7ncL85O0aVtYZLJqNtdgpt5asn4sOar/BaMAg69Mk PlGQg35UZN6JchM7EMAomGYibgnuSdR3VKZh4UhorTCHm9ZE/GyTjEVd1F0YMt4aS1 KH3yMmcQCMXaA== Received: from mchehab by mail.kernel.org with local (Exim 4.98) (envelope-from ) id 1sc2E5-00000000oDm-0Iiu; Thu, 08 Aug 2024 14:26:41 +0200 From: Mauro Carvalho Chehab To: Cc: Jonathan Cameron , Shiju Jose , Mauro Carvalho Chehab , Cleber Rosa , John Snow , linux-kernel@vger.kernel.org, qemu-devel@nongnu.org Subject: [PATCH v6 10/10] scripts/arm_processor_error.py: retrieve mpidr if not filled Date: Thu, 8 Aug 2024 14:26:36 +0200 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=145.40.73.55; envelope-from=mchehab+huawei@kernel.org; helo=sin.source.kernel.org X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.141, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Add support to retrieve mpidr value via qom-get. Signed-off-by: Mauro Carvalho Chehab --- scripts/arm_processor_error.py | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/scripts/arm_processor_error.py b/scripts/arm_processor_error.py index b464254c8b7c..756935a2263c 100644 --- a/scripts/arm_processor_error.py +++ b/scripts/arm_processor_error.py @@ -5,12 +5,10 @@ # # Copyright (C) 2024 Mauro Carvalho Chehab -# TODO: current implementation has dummy defaults. -# -# For a better implementation, a QMP addition/call is needed to -# retrieve some data for ARM Processor Error injection: -# -# - ARM registers: power_state, mpidr. +# Note: currently it lacks a method to fill the ARM Processor Error CPER +# psci field from emulation. On a real hardware, this is filled only +# when a CPU is not running. Implementing support for it to simulate a +# real hardware is not trivial. import argparse import re @@ -168,11 +166,27 @@ def send_cper(self, args): else: cper["running-state"] = 0 + if args.mpidr: + cper["mpidr-el1"] = arg["mpidr"] + elif cpus: + get_mpidr = { + "execute": "qom-get", + "arguments": { + 'path': cpus[0], + 'property': "x-mpidr" + } + } + ret = qmp_cmd.send_cmd(get_mpidr, may_open=True) + if isinstance(ret, int): + cper["mpidr-el1"] = ret + else: + cper["mpidr-el1"] = 0 + if arm_valid_init: if args.affinity: cper["valid"] |= self.arm_valid_bits["affinity"] - if args.mpidr: + if "mpidr-el1" in cper: cper["valid"] |= self.arm_valid_bits["mpidr"] if "running-state" in cper: @@ -360,7 +374,7 @@ def send_cper(self, args): if isinstance(ret, int): arg["midr-el1"] = ret - util.data_add(data, arg.get("mpidr-el1", 0), 8) + util.data_add(data, cper["mpidr-el1"], 8) util.data_add(data, arg.get("midr-el1", 0), 8) util.data_add(data, cper["running-state"], 4) util.data_add(data, arg.get("psci-state", 0), 4)