Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DE3FDC636CC for ; Tue, 7 Feb 2023 16:20:32 +0000 (UTC) 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) 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-Google-Smtp-Source: AK7set9Kn6v3qI1WKeR8vJHYyK7zYba3lpn6/CdTjrXrC5ZR3pXyKFZw0s+39QnXeqgbt4e2D8VX7g== 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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(-) -- 2.39.1