From nobody Sun Nov 24 13:01:04 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 D118D1AC42B for ; Tue, 13 Aug 2024 23:24:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723591451; cv=none; b=pL3LV5Y1JGo5vhYFh3D3O1u9AX2HmX9SNH3DyKgCJWalpRdO+5w+Bsr/cHEdDsqEhApn4p+BSNDx4ylPnQe76d4dLzjdXIvrahF3R38+1VUkRgsZT/po4eP1S8rhSutiHEFiXtE2vOcqcSWHQKeJDpPwV0WIj0vhfkeaEJNNDEM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723591451; c=relaxed/simple; bh=j486ons4LyU7EE4gQ8GJy4aORh/7MBRYapAi7rAlR+o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ha44NNBrSfo7mYz+jxsb4fV+D7c5WvmOsfJOgFj9r7SDxgi9xKCg9zQ3aImaiaSSNfxCs0raFmH3dTLtVIJBzUIiUWIQ9q4N8yZCNPUgdB3Lhqs54f8Fu0uPFGgc0KQbWHViTbh/ocLNjrmgHQxNVE/FosL+z6i0YT9JPf7m/8A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Yx9MluHJ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Yx9MluHJ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63EAEC4AF13; Tue, 13 Aug 2024 23:24:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723591451; bh=j486ons4LyU7EE4gQ8GJy4aORh/7MBRYapAi7rAlR+o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yx9MluHJQmDwLQG3DJapFOoAdn5xMLfX5NVv0dsyrsYubiIW+gEv9OsMna87IYz/h akhdJFXIwELLRJ1nYSLqJrpDqGs3UADWfrRqUulCrex73TfTNW7H0GgyP/VcIDLAMP XmLOm6zd8VRmalAtkp1DhALF+ppVDCvl4169EWsyhPXWLsUASzwV9Kz5jfmZbhUj7R 7xRIBTlAZ6sdeNk9Vhq5n/qvuu6IQX94GAvavM87c9BlF4I0E90EkZlJhNytA5D0Rn TTNTnfJVpdrjHlR74fIFAL8B+AFC3jE3CfQUJpBNZHBYHQCYE00nw89EFnbnH2k/fP jqpVgEMwcednw== Received: from mchehab by mail.kernel.org with local (Exim 4.98) (envelope-from ) id 1se0s5-00000002ask-2DMl; Wed, 14 Aug 2024 01:24:09 +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 v7 10/10] scripts/arm_processor_error.py: retrieve mpidr if not filled Date: Wed, 14 Aug 2024 01:23:32 +0200 Message-ID: <01a655b405ab098aed7396fe87f8fd406e966141.1723591201.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: Mauro Carvalho Chehab Content-Type: text/plain; charset="utf-8" Add support to retrieve mpidr value via qom-get. Signed-off-by: Mauro Carvalho Chehab --- scripts/arm_processor_error.py | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/scripts/arm_processor_error.py b/scripts/arm_processor_error.py index 2643e4ddc5f3..f869f07860b8 100644 --- a/scripts/arm_processor_error.py +++ b/scripts/arm_processor_error.py @@ -5,12 +5,10 @@ # # Copyright (C) 2024 Mauro Carvalho Chehab =20 -# 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. =20 import argparse import re @@ -168,11 +166,24 @@ def send_cper(self, args): else: cper["running-state"] =3D 0 =20 + if args.mpidr: + cper["mpidr-el1"] =3D arg["mpidr"] + elif cpus: + cmd_arg =3D { + 'path': cpus[0], + 'property': "x-mpidr" + } + ret =3D qmp_cmd.send_cmd("qom-get", cmd_arg, may_open=3DTrue) + if isinstance(ret, int): + cper["mpidr-el1"] =3D ret + else: + cper["mpidr-el1"] =3D 0 + if arm_valid_init: if args.affinity: cper["valid"] |=3D self.arm_valid_bits["affinity"] =20 - if args.mpidr: + if "mpidr-el1" in cper: cper["valid"] |=3D self.arm_valid_bits["mpidr"] =20 if "running-state" in cper: @@ -356,7 +367,7 @@ def send_cper(self, args): if isinstance(ret, int): arg["midr-el1"] =3D ret =20 - 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) --=20 2.46.0