From nobody Fri Nov 29 23:51:08 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 D45D078283 for ; Sat, 14 Sep 2024 06:13:54 +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=1726294434; cv=none; b=hSnftmuVSXnTjNeDPwdrT3Lg2Z+uiC6FDvGqz3rocr8DN4Q/j4SeE8cOcDU2fBMR6k9CZmOsSq95RgLaB79fdMo4k0A1C1TRFDvhULOMWOZesJ+0qauT50otJ2vTjQPBn9wQjSUFRlTbKekRRo0LaEa+UN6s15tnjVBbmXayrJo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726294434; c=relaxed/simple; bh=1dC6qge5j6u0iMd7Y9iF2l9tSLTNhq/Z8HDaN5NFEKg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eFTu5MTAWwirfpLp0NrrdCZG4HJjf5Yu7zYc+oO8G9yZtUufm2yTLZhLL8XTBN9ZWCiMhrW9mduLgkiv+j0T11y+qDAzt5OBnxjJ3UBS32a4dx64+6+eS9jVopic+8E1YAZHn1V3jGP+Prie/shmqPbzgOwS+Hy/pmBM4vJx/XI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GsxQvSOm; 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="GsxQvSOm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 553DAC4CEEA; Sat, 14 Sep 2024 06:13:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1726294434; bh=1dC6qge5j6u0iMd7Y9iF2l9tSLTNhq/Z8HDaN5NFEKg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GsxQvSOmilsc9bLAco2lwhUosdZ8GGfW6pOnAuMJVq5+vhZqZwBruNWjoKtuDm6Ni hfPGS53prFKRHaROaETVSX34J7K8hIZH3rS6mpJjikZOV9I7uGbKPhRANYHFesdUkT zlB4TUtMODuEzz+HLMeBAdPvsYSO3QPc3M1+EDmyHBB67XpwbOrfwEPHrj8pYbuIHK 6AwZOOM7gden7CpDanVUHe+7kLljAT761QBSGSLtlfwd8mwDJfnId2tYn1MLG+Im6P X1CrABu0+EpozHyXXXAGYfwQUSOWdfVVdl6sSeQY9Dx4JF8k/uv5OEXjooZVKsAnmu Cm3gnLHy2+8/A== Received: from mchehab by mail.kernel.org with local (Exim 4.98) (envelope-from ) id 1spM2a-00000003V6l-23GT; Sat, 14 Sep 2024 08:13:52 +0200 From: Mauro Carvalho Chehab To: Igor Mammedov Cc: Jonathan Cameron , Shiju Jose , Mauro Carvalho Chehab , Cleber Rosa , John Snow , linux-kernel@vger.kernel.org, qemu-devel@nongnu.org Subject: [PATCH v10 21/21] scripts/arm_processor_error.py: retrieve mpidr if not filled Date: Sat, 14 Sep 2024 08:13:42 +0200 Message-ID: <62f32c5c40309a9c175e6b418fe368468e6aab06.1726293808.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 62e0c5662232..0a16d4f0d8b1 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 @@ -174,11 +172,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: @@ -362,7 +373,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