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 X-Spam-Level: X-Spam-Status: No, score=-12.2 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0130FC48BDF for ; Fri, 18 Jun 2021 12:04:16 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A845A613EB for ; Fri, 18 Jun 2021 12:04:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A845A613EB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=jNe2huP7F9fDFDZkqzxLLgtCLokvK7oki+upZvVj3a0=; b=xzhyHqfbRsYiIuuxJJmhGLPecG W4bNsVJgXWQ3Ia4nzw/ogLRyE2zp7dK0bjbkCU1KbPXavSDqk7MMUrt26XvWOXKVkxI8Wc51D0XxB ASiOcPQ1MaMIpHd8m3cm6DGZ8uMFDUQGIHNz5IZzFoD/VnncUWjom5z7EiFJiflULbSN9GUEr1PY9 Y+2wGRbDiM70LmAg/I9jSqlMtgwsQqUIkGvA8PwCERGpXI1MEaEYt1uf5pmBbsTmkrV3wP39V6J52 0XHdrLWcNFPZs8pIO/BWdnCvw/sXOvmFg/ZWWeb3693jCbE8AtdVyyd2ygEkasfi0BxiqyJoetXvm KuRETyew==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1luDCN-00DxDq-D9; Fri, 18 Jun 2021 12:02:11 +0000 Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1luDCJ-00DxDN-Hu for linux-arm-kernel@lists.infradead.org; Fri, 18 Jun 2021 12:02:09 +0000 Received: by mail-ed1-x532.google.com with SMTP id r7so8242831edv.12 for ; Fri, 18 Jun 2021 05:02:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=CRne1Obv6bfpFN2zwH0E1iSytqwftTUZyuSgOuNDck8=; b=cRjUFpDd0ezPpaaShv29KJL3M2ml3fYDoOx8CA86QVlvJ6oSw6ty7AEqC/rwIE8Q41 QMlcF/GHEuGHJDNoy6l29qXcoUbqTWXYLpWqY8Yma+db3dB9JgrZWsQrA0pPzRvht/IN JTl6YOfyGcnqWVCD6QnLd0cPlWxl0GxIGx5H37GcWvNmg+jfPF0lBE855qGNxJg24dcE jqlsM92/5LdjaX6bLfn2yEkusLRGF3geIRk0hQPQPBHQpE1KXqLqcBSVTtLKtwtlQpEY 0FrgEqB73XHSQUOvDE1ntLcZHy8Cw3KT/qo+hJjKvYppPDUYYCNrsnKlZi/uZpMxwmom 3Oqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=CRne1Obv6bfpFN2zwH0E1iSytqwftTUZyuSgOuNDck8=; b=KIxwnQg9m3JNKEJGm2lHupvhera7zVS04luRL5cfxSv6l1aDmVCgVP+tA0gRViVdAq l8l0LmHoMsh/WBY6KAnZvoFiiy+w8JvyrI11ZS0VcNm4vqzuGbmqgWXONV9m3VU8NKrS G1UtZfyf1YYxT3RogDfXyCI26O8yrOQgffRi6BPL44F8f+rOLjz4RukAX3bPNZvldrt4 1J9nXy1zq/uqanoaURy7T+misfPzPhscv1JKkZUZneuqO/9l6XImZ9MraqydDFvBN0ZS P+32jIn0pPSudKN5W+Q3nhitqDUNRz97/OSBOeOQLTjYq21CZ47Mo+kra62gqNHkM2gk b1NA== X-Gm-Message-State: AOAM5303sFmJLa9vbR9avZmQ5HHPE9lOV26xN4ZtKhLwAOEb1AvL9QNy DdnpEyKZtOc30soJqMtd9JM= X-Google-Smtp-Source: ABdhPJz3K1LWFlqJDgSjo825niKdSkm2FjQCwq47GZQp1aOaKU7hDTD0A44QHMyNFXsdef9Dz2lYQQ== X-Received: by 2002:a05:6402:26c2:: with SMTP id x2mr4551069edd.124.1624017725993; Fri, 18 Jun 2021 05:02:05 -0700 (PDT) Received: from localhost ([62.96.65.119]) by smtp.gmail.com with ESMTPSA id f20sm6065049edq.64.2021.06.18.05.02.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Jun 2021 05:02:04 -0700 (PDT) Date: Fri, 18 Jun 2021 14:03:54 +0200 From: Thierry Reding To: Mikko Perttunen Cc: jonathanh@nvidia.com, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2] soc: tegra: Add Tegra186 ARI driver Message-ID: References: <20210617121307.792386-1-mperttunen@nvidia.com> MIME-Version: 1.0 In-Reply-To: <20210617121307.792386-1-mperttunen@nvidia.com> User-Agent: Mutt/2.0.7 (481f3800) (2021-05-04) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210618_050207_668531_F121D4A1 X-CRM114-Status: GOOD ( 30.68 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============2491752456736576472==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============2491752456736576472== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="dkyho8UKE4IjX4xx" Content-Disposition: inline --dkyho8UKE4IjX4xx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jun 17, 2021 at 03:13:07PM +0300, Mikko Perttunen wrote: > Add a driver to hook into panic notifiers and print machine check > status for debugging. Status information is retrieved via SMC. This > is supported by upstream ARM Trusted Firmware. >=20 > Signed-off-by: Mikko Perttunen > --- > v2: > * Changed to use panic notifier instead of serror hook > --- > drivers/soc/tegra/Makefile | 1 + > drivers/soc/tegra/ari-tegra186.c | 80 ++++++++++++++++++++++++++++++++ > 2 files changed, 81 insertions(+) > create mode 100644 drivers/soc/tegra/ari-tegra186.c >=20 > diff --git a/drivers/soc/tegra/Makefile b/drivers/soc/tegra/Makefile > index 9c809c1814bd..054e862b63d8 100644 > --- a/drivers/soc/tegra/Makefile > +++ b/drivers/soc/tegra/Makefile > @@ -7,3 +7,4 @@ obj-$(CONFIG_SOC_TEGRA_PMC) +=3D pmc.o > obj-$(CONFIG_SOC_TEGRA_POWERGATE_BPMP) +=3D powergate-bpmp.o > obj-$(CONFIG_SOC_TEGRA20_VOLTAGE_COUPLER) +=3D regulators-tegra20.o > obj-$(CONFIG_SOC_TEGRA30_VOLTAGE_COUPLER) +=3D regulators-tegra30.o > +obj-$(CONFIG_ARCH_TEGRA_186_SOC) +=3D ari-tegra186.o > diff --git a/drivers/soc/tegra/ari-tegra186.c b/drivers/soc/tegra/ari-teg= ra186.c > new file mode 100644 > index 000000000000..02577853ec49 > --- /dev/null > +++ b/drivers/soc/tegra/ari-tegra186.c > @@ -0,0 +1,80 @@ > +// SPDX-License-Identifier: GPL-2.0-only > +/* > + * Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. > + */ > + > +#include > +#include > +#include > +#include > + > +#define SMC_SIP_INVOKE_MCE 0xc2ffff00 > +#define MCE_SMC_READ_MCA 12 > + > +#define MCA_ARI_CMD_RD_SERR 1 > + > +#define MCA_ARI_RW_SUBIDX_STAT 1 > +#define SERR_STATUS_VAL BIT_ULL(63) > + > +#define MCA_ARI_RW_SUBIDX_ADDR 2 > +#define MCA_ARI_RW_SUBIDX_MSC1 3 > +#define MCA_ARI_RW_SUBIDX_MSC2 4 > + > +static const char * const bank_names[] =3D { > + "SYS:DPMU", "ROC:IOB", "ROC:MCB", "ROC:CCE", "ROC:CQX", "ROC:CTU", > +}; > + > +static void read_uncore_mca(u8 cmd, u8 idx, u8 subidx, u8 inst, u64 *dat= a) > +{ > + struct arm_smccc_res res; > + > + arm_smccc_smc(SMC_SIP_INVOKE_MCE | MCE_SMC_READ_MCA, > + ((u64)inst << 24) | ((u64)idx << 16) | > + ((u64)subidx << 8) | ((u64)cmd << 0), > + 0, 0, 0, 0, 0, 0, &res); > + > + *data =3D res.a2; > +} > + > +static int tegra186_ari_panic_handler(struct notifier_block *nb, > + unsigned long code, void *unused) > +{ > + u64 status; > + int i; > + > + for (i =3D 0; i < ARRAY_SIZE(bank_names); i++) { > + read_uncore_mca(MCA_ARI_CMD_RD_SERR, i, MCA_ARI_RW_SUBIDX_STAT, > + 0, &status); > + > + if (status & SERR_STATUS_VAL) { > + u64 addr, misc1, misc2; > + > + read_uncore_mca(MCA_ARI_CMD_RD_SERR, i, > + MCA_ARI_RW_SUBIDX_ADDR, 0, &addr); > + read_uncore_mca(MCA_ARI_CMD_RD_SERR, i, > + MCA_ARI_RW_SUBIDX_MSC1, 0, &misc1); > + read_uncore_mca(MCA_ARI_CMD_RD_SERR, i, > + MCA_ARI_RW_SUBIDX_MSC2, 0, &misc2); > + > + pr_crit("Machine Check Error in %s\n" > + " status=3D0x%llx addr=3D0x%llx\n" > + " msc1=3D0x%llx msc2=3D0x%llx\n", > + bank_names[i], status, addr, misc1, misc2); This still looks rather cryptic to me. Is there some way to further decode things like the status and MSC registers? Or is this something that people are supposed to know how to intepret? Also, I'm not sure it's evident what those various banks are. Is there some way we can provide a description for these? Additional information doesn't necessarily have to go into code, but it'd be nice if at least there was some sort of comment somewhere that goes into a bit more detail so that people know how to use this. Or perhaps this is documented in the TRM? If so, perhaps provide a reference to that so that people know where to find the information. Thierry --dkyho8UKE4IjX4xx Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEiOrDCAFJzPfAjcif3SOs138+s6EFAmDMi6gACgkQ3SOs138+ s6FdLw/+LfTzpDzPJa2KyjpaFkhqSby4d/BMqjiu5FoQxTWEkdDIVPX350MO2lIn P4MYYWikEC1bMVo6nrxLVZoqxt3tLk+FIFJeKJTJArsqK3YhVyYzs2mgZiAfmmij VyTdI20+iQm5DMa5xkmwA5pYZxhNj2hgUp9nXfD6mCyzHHO84iQPsbwUlNMsWw/h S3O0W6bOX7JQ2OieXZiuwEhC+PD9sOKEwI/v/042IhjuK7KL3g3bHeglkPfD88pa jS5zOWJ41z8JM8laf4QjTQj7mR6ahI6hPrtd4G9/wTuTxZLdeo+nmHyigirbf039 /IMYg/4GWscf8m6CN3IWLimtzxOhTC5KFX3YAA4tPlmAflwSgiLtw+tP8Q5fScs3 W60T+y5XgzUoRk3bQuH/5VIAhQuNtc1mkPdfMinXnnWqR+fDPlA6CCvyaJt2yacr eUx/ik+wu1eXhxwCYZiKlM/yYYs/0qjavxO6T+Osou4mAl5yZGslO5h/e/jUIvXf t5hdkr37ujydnbZndMbEAMKl0N8uGxUy/fCGPLjsLA3zCCyFY6SgXOXn7KH4g+dy FSNBIBi1qJZCBxA2yoCFT2sfojQ/7KU8VYogDKR5SXASUDQu0w7oI5fVnd0gmPZF Np3MVGgCWjJN8NvB3Fh2HZ7pSVOQl/7fUNDPPQyxzRwZDglAUVE= =Haux -----END PGP SIGNATURE----- --dkyho8UKE4IjX4xx-- --===============2491752456736576472== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============2491752456736576472==--