From nobody Sun Nov 24 11:31:43 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 E6962137903 for ; Fri, 16 Aug 2024 07:37:53 +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=1723793874; cv=none; b=VWniRc4XhOYebjy2mAJeJY6rj3ivCSBvXki6Kr+LWtjP7hSSgY3ZZ2lvD+apMQMT8xxKzc84AdoRWR0+Oe9CX/C51Ut7xVwtseL+4jQJPm9FqAiOfW5uG699P4G7cl+gtOagD0MlnFLdAxVmQZeGGGsQd3FxE1XFJvJNmbwGCjI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723793874; c=relaxed/simple; bh=1dC6qge5j6u0iMd7Y9iF2l9tSLTNhq/Z8HDaN5NFEKg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=M0trlEg0+iUnlWn7TowjgaA3Ahtm7dJKeW4KBs84NzVVVBIvtYZQ0wkz3uvIKE5jSttmVHk/TlZCTLR6uQJl9MqpdgLAzQ5PH1G9QGKltyx4QpyKywlSzKmLtgZq5dt55OpLiYADUMsDCqC7pXE615ZlowMjZ/U12u5o8RN9Tj8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DXF2kbFO; 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="DXF2kbFO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A306C4AF11; Fri, 16 Aug 2024 07:37:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723793873; bh=1dC6qge5j6u0iMd7Y9iF2l9tSLTNhq/Z8HDaN5NFEKg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DXF2kbFOu/d0z+t1Ms+g5NWG//Ep0IG5elrFrqpzaQwKmFjK24inwdZMTckRHm7Dz ZR3SyNvp0Sl+GxTr4rmgvWYkdMVdoelD4KYiKyi+DkKmWOexSe6tz4HzaN4tYzUlN7 Blbt8I3FgFnoUdTpooR3xBIiZ+6n8RqECQarWWVpkDzPwcbHMVead9+KQZKC5Zx640 hmlPQAdkwwmI4j+doVKPmRLBxrU1mO31F4cz1MqHnOkKocome/JoIteJx/DkWGjz3G 16PMdVYWFgiOtSRkUZACyWV8aRlE9rNVLnbR8lLHljvqq89UVyHNxyrf/fitwTVBiH ZsNHrSBB1BXUg== Received: from mchehab by mail.kernel.org with local (Exim 4.98) (envelope-from ) id 1serWx-000000055ez-2v1X; Fri, 16 Aug 2024 09:37:51 +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 v8 11/13] scripts/arm_processor_error.py: retrieve mpidr if not filled Date: Fri, 16 Aug 2024 09:37:43 +0200 Message-ID: <9fab07e7af3efaae9546ab2c7b12b2482ba02da5.1723793768.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