From patchwork Tue Feb 7 16:20:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Liu X-Patchwork-Id: 651263 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp2965600pva; Tue, 7 Feb 2023 08:20:35 -0800 (PST) X-Google-Smtp-Source: AK7set81TVDr6ztXzxGh4P85w8QxQxkclgJLo7ONHfSPT4SaeQZ8g320XXtBJw2OJ+SMSXSTQDH1 X-Received: by 2002:a05:6830:68c9:b0:68c:1c0d:ab6a with SMTP id cw9-20020a05683068c900b0068c1c0dab6amr2016239otb.13.1675786835090; Tue, 07 Feb 2023 08:20:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675786835; cv=none; d=google.com; s=arc-20160816; b=nVWyUCnObUK22J4PBMglyVPM3dNOImF2RMWqeZg2pRpScfhrf5nfZdfPIzoV3LZwX+ tpb/mcfh0G9phNd3ifzEwMtahQiad6oko5IV4G2Cg+tUBFAcMiEzKAewS0brKa03xf7T pJrOWCogwOkJzp2UiX1FH8M+RyI+v2kEKHfP2L0o5llQEBUN3nujSUTW531/WM7tLuZJ Z1WC5TwijIc2TLCxhDj0x/owkaNiVuiPM14FdZYp3vz/cHVGnEXfM1w7TTYGycjUzSU6 KUxdFFdjJA4o4jZoWavvURTGAPK2PHDJO5wLS9oJNCUNKK29FZ0Tv7DIcq2l+OOwwb4j RH8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=PA143qucN30RFS1QYeiewfSg4dBig00TVgldB/afrE8=; b=E7HOSG2wLJ193dNkDcjw566sN8ag7FOsdAYYIfuX/eis8amjlFQyNlS3vx17RIamC6 Sk4j0lv32C6ZGHtruB8Mp1csZhNpz2u0ShhWGebYGhgDMZkCWqdWyoG02j5DjVp+KZFS HTKZkZe4B0gBtbfCiIiXioxXl9Arhql8aHuw2Su0c+4TemOlIOzGbo6c9af5wNkzIjC9 S5lKcbkaPBEP05M5tJeoHVt/SUsJh9zs7ZfiQHExQZSvP9ZWmOT3drMWZ/Jlj2PZhbJv j922X1MJ4YASR2niAsUofLzgUb55TY0Uyv0ByZ1ptOHid1fct+qQsccKDkf22xmYjYue zAQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sx3gEqfl; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id p18-20020a056830319200b00683f3781f56si15237467ots.294.2023.02.07.08.20.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Feb 2023 08:20:35 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sx3gEqfl; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 94F5885E2F; Tue, 7 Feb 2023 17:20:29 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="sx3gEqfl"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 75FE185D9E; Tue, 7 Feb 2023 17:20:27 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id CAEBA85E0A for ; Tue, 7 Feb 2023 17:20:24 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=paul.liu@linaro.org Received: by mail-pf1-x42a.google.com with SMTP id g9so11102971pfo.5 for ; Tue, 07 Feb 2023 08:20:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=PA143qucN30RFS1QYeiewfSg4dBig00TVgldB/afrE8=; b=sx3gEqflH1HYOT+nVt/350HutdyYhefOSSMsNADauAUX5XcjZG6TNwj9SKXMFblc47 h/cc0ZKg+bVWZMzSAq1GNYk/L0OB8gQXvn87u+N1TwI2i1sc1GquF5DWmN4pdn0I7u4W 4UrgaZpAV4FwBBWC9p62BVOZdEldY3JaZ3IJ2RC89Fg3a35XI3054QpDTQP8mE4JwxA7 QGcEiLB5UBhowTN7DAqysKSxtT6umnshL2tBgxhkuHzbT/IbZR4c6mNLRfik1wKcWyNh wbOgo+5Ne47SOHnTjun53SSb33kBiDOvEl6j2vo6hjW1AUykQpbO5Up72qY4hNzr0ulL 7XyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=PA143qucN30RFS1QYeiewfSg4dBig00TVgldB/afrE8=; b=4Q7e4BuwudzLqYtBNNjajdis7HsvnAKk9ZVYrpSfsB0YF/8j+dffjPLVm3xweeyXHT yfZLfMxzUpLRNJ/KW0BSQF3dYGW9VqqSvL7R0GYBAiOmni/JfAVLHv6g7pCXwNxrL0y3 W50qVpwy0Nu/2NSzej3mEuTo8+WM3v4Wc/dnpdjnhmnHZjS/sE7fha+s8xnrce1GNik+ J6S/5ph6dO+WnR1Ny/rPKibU8bTJL0HfVIE5irtW85/DCsCV9JRjdW7coZ0Ix98iPySU MrCmYzRuf4XluPxXhZvdnhbo9f6s2DnFTGg/TIB6RcZf5rrlqvpHZQCOdXh1eO+CFX2N ybkw== X-Gm-Message-State: AO0yUKXYN7OBorNezTZsQwoOD08QiB6RxupDPLT2jeW9K6TtUBmV4XJ/ B42NE3/c9vJdexzZ8JmzzC8M9Jibc4Jb0YuP X-Received: by 2002:a62:2582:0:b0:593:b169:ae51 with SMTP id l124-20020a622582000000b00593b169ae51mr3026264pfl.32.1675786822683; Tue, 07 Feb 2023 08:20:22 -0800 (PST) Received: from localhost ([111.184.129.17]) by smtp.gmail.com with ESMTPSA id j23-20020aa78d17000000b005772d55df03sm1732291pfe.35.2023.02.07.08.20.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Feb 2023 08:20:22 -0800 (PST) From: "Ying-Chun Liu (PaulLiu)" To: u-boot@lists.denx.de Cc: "Ying-Chun Liu (PaulLiu)" Subject: [PATCH 0/2] arm: cpu: Add optional CMOs by VA Date: Wed, 8 Feb 2023 00:20:12 +0800 Message-Id: <20230207162014.58664-1-paul.liu@linaro.org> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Exposing set/way cache maintenance to a virtual machine is unsafe, not least because the instructions are not permission-checked but also because they are not broadcast between CPUs. Consequently, KVM traps and emulates such maintenance in the host kernel using by-VA operations and looping over the stage-2 page-tables. However, when running under protected KVM, these instructions are not able to be emulated and will instead result in an exception being delivered to the guest. Introduce CONFIG_CMO_BY_VA_ONLY so that virtual platforms can select this option and perform by-VA cache maintenance instead of using the set/way instructions. Ying-Chun Liu (PaulLiu) (2): arm: cpu: Add optional CMOs by VA arm64: Initialize TLB memory if CMO_BY_VA_ONLY arch/arm/cpu/armv8/Kconfig | 4 ++ arch/arm/cpu/armv8/cache.S | 50 +++++++++++++----- arch/arm/cpu/armv8/cache_v8.c | 97 ++++++++++++++++++++++++++++++++++- arch/arm/cpu/armv8/cpu.c | 30 +++++++---- arch/arm/lib/cache.c | 9 ++++ 5 files changed, 164 insertions(+), 26 deletions(-)