From patchwork Tue Jul 20 17:02:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1507676 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=Z8XYubUR; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.a=rsa-sha256 header.s=badeba3b8450 header.b=UtDYPz9k; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GTlQf36Trz9sWq for ; Wed, 21 Jul 2021 03:03:06 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=aoCM/z8WPlAFW37gJAwwhNrplIgAoKlO1qHDbVuCvBE=; b=Z8XYubURrMjZgu JMeBzAubUEjs3iIOcTfR+6MeG9uMnZTnDhANKD9g1dGDIWNqkBHWM/kxezVPZhTpPmTPQb2uhJW1e kNNeI/5bxuOha371xTPWQRahhYCMcv51JN/vv0rn24M4xqpAHtypttqwAHU9ua5BDVBgpdyYRi6n3 KnL8aNW1ZkFfH5Kbri/6/ql7L8GaENkoFivEG1CTZotKsR8IVF7Y1QHjSfqQIDldjFcBatPtd5NyH ZrOEGTfib0XSz5T1PQBpj/KJQEhGH5YhPXZWB7s57NFbaeHuDgwmn2RC+lxWt8d6kRVvczQAvR/0M BFkZl3cgyL5o1NwxYY7g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m5t93-00Dc00-Jb; Tue, 20 Jul 2021 17:03:02 +0000 Received: from mout.gmx.net ([212.227.17.21]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m5t90-00Dbyu-Nh for opensbi@lists.infradead.org; Tue, 20 Jul 2021 17:03:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1626800569; bh=9p7k4rJdUlS/S5R2ux+KxKQy0PZspDxm4Ug/i/qvd1U=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date; b=UtDYPz9kz1UsK7hE4vJFcyPwoO2Q8bRb6XCZkp5lJVbkTIOXbi5+VoOqUWmo0zq/Z iA+A+z1Yy62bmz1tL7lLMawTewcGWuF4nFoUuyZsw5IizbHNL4Ek+NX7d8Kj/ZxCc5 +oAa164cUxQOZi5uhsP4mv4HjtoT8+oIKlZnWSNs= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from LT2ubnt.fritz.box ([88.152.144.157]) by mail.gmx.net (mrgmx105 [212.227.17.174]) with ESMTPSA (Nemesis) id 1Mn2WF-1lM8vG0gSt-00k75z; Tue, 20 Jul 2021 19:02:49 +0200 From: Heinrich Schuchardt To: OpenSBI Cc: David Abdurachmanov , Atish Patra , Anup Patel , William Wilson , Heinrich Schuchardt Subject: [PATCH] generic: fu740: add workaround for CIP-1200 errata Date: Tue, 20 Jul 2021 19:02:39 +0200 Message-Id: <20210720170239.25804-1-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Provags-ID: V03:K1:Bh3w/JB2IKJLutAiCOHG4mZAvPK7v+NmRGj87K/Tc9alNyyyWdT 5N3tKRBXEUArhDwpbI8qfjLl+GC0BtRi0UpmoWQywjZn3+x/eIcsOAXxiP3LhEAFB8Foim7 YvdnrqKg8DHI82oYaqlfOsz6xhA0MfdIO2WZWSgck6avYFTazSxXYCK1aFbFPSoxvOOyPPh aBUAIJXUV9sDLttwhMtYA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:zZFD8JFUoLg=:MlOw71O40XLsun5M3e0qLr Ff6KJTxmKRKZMvpuEzf5VfbwOJUPGWxszJsLuDVRxFKLAFMi7eBGdh5NkvQr+Ybcn0bCakVLp 45DWO+2zF+IwxjT2RY4NEyYm1h9YUT3Dxd78EHlWjleuPdw/php/28bAKV768NGfk1u+4XWwG IGTbZd2/l6sLsyQH5ZFz/qYJhcO3J3EulAplu+bzSSNdV49gKAGBgHIZEwzjpdqUuZ0yh7Qzl 31LH+SDo4p/DXH0+I1I6s+sMRFxJCgM6zs/wgenVXvHNZvtPKIZT+/85Z9WhG8iMBCqHtdpG/ YPRkvKP+fA1LMUbA7iGJFUT52F4p5b2+GzFmjhesmVRJC+93S4RGQO87vA6STztOdfVgCvoop u95rhcDkxXOQhJlLbq8tiORGh548+ygRg1MOudWpT8p9kxqRqQuMMDtxnz4xZD8WaBQ9/I4hv WGjS6Rw7+LdJLq3zQ5CG9dfEDbJu+winjdOSpe9PVtHlldfhjzg1PfYfTPS0MHv93d5yIUctd V3BWHVxAJUdtG0xFqU2ouh4qsfzk91xHp/Jo7Ajr0ywP4wYIIr2XabIDGrtF1sUqRKwjRk9OQ yeey3VxJ8gpbDVGGkaZolb/EmvpRBBZCBHQU8fFKpIgGsHRTFUpCokPbYLlQ0IdlxCeTwMTKF 6afK8FzN5wzqMk3mmxOZfFc7DQAKmF8hX2n6TcHE+Mcfyp/A+VU+7gWxVOuJFZUae4ykajGD5 8QhR64tuQOpoBogKxcHrmFBUQYpah+TY6e4DfaBCghsMhbXM4ckSTG9SlMa+B1p93zgm/tboR QoySSnQb4QYbG3sS9zNvt8FHXnfpue+UPbRBHsX6vlYAtnJk/hWn3Has2wAXZZJwS+ASG2k24 ggfIzljQxab06X4j5Un1oQXQSKTsh4RJ6DtosTfyua0VBMe+bM6VLge+1l6nlRJqdQhs4RluW 1cYrKoQ238rakToofiYZOw/WITNlv/1jvysBKOt+ZgCEk1voc30kJ8eBFiUUgKCIlvNKavxSn eXYG12PGVjzPSyqXG/MPj5qbsnCOWQnLd3qJjyfk9suLKx01wPaYvXpNxrEUJPz43swGCvTRu eisDtYdZ6fVOX9pwgPHULiNHs7oGP0P0jM3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210720_100259_112876_BE45CE54 X-CRM114-Status: GOOD ( 12.96 ) X-Spam-Score: 0.0 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: David Abdurachmanov Instruction TLB can fail to respect a non-global SFENCE thus we need to flush the TLB using SFENCE.VMA x0, x0 See full description of CIP-1200 in Errata_FU740-C000_20210205 from https://www.sifive.com/boards/hifive-unmatched Content analysis details: (0.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [212.227.17.21 listed in wl.mailspike.net] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [xypron.glpk[at]gmx.de] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: David Abdurachmanov Instruction TLB can fail to respect a non-global SFENCE thus we need to flush the TLB using SFENCE.VMA x0, x0 See full description of CIP-1200 in Errata_FU740-C000_20210205 from https://www.sifive.com/boards/hifive-unmatched Signed-off-by: David Abdurachmanov Signed-off-by: Heinrich Schuchardt Reviewed-by: Atish Patra --- platform/generic/objects.mk | 1 + platform/generic/platform.c | 2 ++ platform/generic/sifive_fu740.c | 36 +++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 platform/generic/sifive_fu740.c -- 2.29.2 diff --git a/platform/generic/objects.mk b/platform/generic/objects.mk index d6c8a42..cb15a18 100644 --- a/platform/generic/objects.mk +++ b/platform/generic/objects.mk @@ -9,3 +9,4 @@ platform-objs-y += platform.o platform-objs-y += sifive_fu540.o +platform-objs-y += sifive_fu740.o diff --git a/platform/generic/platform.c b/platform/generic/platform.c index 8c1e06f..2d5e930 100644 --- a/platform/generic/platform.c +++ b/platform/generic/platform.c @@ -23,9 +23,11 @@ #include extern const struct platform_override sifive_fu540; +extern const struct platform_override sifive_fu740; static const struct platform_override *special_platforms[] = { &sifive_fu540, + &sifive_fu740, }; static const struct platform_override *generic_plat = NULL; diff --git a/platform/generic/sifive_fu740.c b/platform/generic/sifive_fu740.c new file mode 100644 index 0000000..c8325d3 --- /dev/null +++ b/platform/generic/sifive_fu740.c @@ -0,0 +1,36 @@ +/* + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2021 SiFive + * + * Authors: + * David Abdurachmanov + */ + +#include +#include +#include + +static u64 sifive_fu740_tlbr_flush_limit(const struct fdt_match *match) +{ + /* + * Needed to address CIP-1200 errata on SiFive FU740 + * Title: Instruction TLB can fail to respect a non-global SFENCE + * Workaround: Flush the TLB using SFENCE.VMA x0, x0 + * See Errata_FU740-C000_20210205 from + * https://www.sifive.com/boards/hifive-unmatched + */ + return 0; +} + +static const struct fdt_match sifive_fu740_match[] = { + { .compatible = "sifive,fu740" }, + { .compatible = "sifive,fu740-c000" }, + { .compatible = "sifive,hifive-unmatched-a00" }, + { }, +}; + +const struct platform_override sifive_fu740 = { + .match_table = sifive_fu740_match, + .tlbr_flush_limit = sifive_fu740_tlbr_flush_limit, +};