From patchwork Wed Feb 8 20:54:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Liu X-Patchwork-Id: 651706 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp3722410wrr; Wed, 8 Feb 2023 12:54:51 -0800 (PST) X-Google-Smtp-Source: AK7set/QXD+pizaCGYAzWJKFHni39uIttJFn+gqXpvdW+YW5Kbb3E8vy57YjrkN9LAG+/EUQwzrt X-Received: by 2002:a05:6870:819d:b0:16a:a256:9bf9 with SMTP id k29-20020a056870819d00b0016aa2569bf9mr2167287oae.27.1675889691599; Wed, 08 Feb 2023 12:54:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675889691; cv=none; d=google.com; s=arc-20160816; b=Y4oo6pZrPVYTcFiS9Z37I61MfnT6b8xTK1e63djMZZs2MX9VD9H+GyAIBzeyH4g0YZ 9WbrNybUpwbT0yIGuLH3fUAVI7szPXHffqykWYrXBXgeH6wLPirgMBvvhsPVE/ZvxbWn OXzuZeyIB4FxU0T8CD44SxehsuueGDmO3Y+YC1+Lje49Dk79rIfsGKclvj8CDEnq0us/ dgGZy7tAI/HbkUeCx9sbZF5G8pRI86XzKzo6UKvLTg7rPlApC9lmCUKSXozkq4bHllMD 2hKNlfYIydMZdIeDRnAYoSeDUZhyGwjHdfwYJZ5QEJerX3M7pcN3hRb4BlcSbA1FGbaC q0Ag== 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=9Q+Bs+O9lb9GIqEzbWpwGXGuxnLkGp1hWto9OR2+BB8=; b=nXiVA8YujRfGbXgm2hB+cuVbhhJmbIq+t3fASruchcTd5bzRiWuswbOIr3eAZXON8t YrbJHiBJ1iH1OKeHAtLcv6n8+4sFDI8JWS9R0qhKkbwGE/SP79GM4sxr08FlErwD92EN Xgoks6EXxBWN1nZAt8NWf0NHsAsnXdyp1KeK+APjK99yks3z649PoMCVBg9m7gL1xYId PoiEtGphoDZ7Nngv4ij+qwj6P798J+gUNNEOPSWBNfiwL9kQ8XKxMIkamR2QDxWeDbMo D1h3G87qNeelgKVZh0FMZ4RiOJV9qMql51QpSEJB8xNa7MxlruAT0/ixeqaaZrjgOu5x ry5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sN0resJp; 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 el24-20020a056870f69800b00163df612a05si16042350oab.305.2023.02.08.12.54.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Feb 2023 12:54:51 -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=sN0resJp; 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 2FD1785F3D; Wed, 8 Feb 2023 21:54:41 +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="sN0resJp"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BCF4385F3A; Wed, 8 Feb 2023 21:54:38 +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-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) (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 E44F185EFA for ; Wed, 8 Feb 2023 21:54:35 +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-pj1-x102e.google.com with SMTP id m2-20020a17090a414200b00231173c006fso3066688pjg.5 for ; Wed, 08 Feb 2023 12:54:35 -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=9Q+Bs+O9lb9GIqEzbWpwGXGuxnLkGp1hWto9OR2+BB8=; b=sN0resJpRH2fQTtCsP8OJZog1RkSNvBaHRZi1uwYOY+kVDevFh/WrGgf+n8X+8ik3Y mzcCjhOXz98Qlv7fNsISmKBn/bsk+W9HdoTczWxmih1ou8E2EuP7McvjbQneptDoMG0y 8EQLezX8uV5eHAR7img11OQHCSaKvZ37LHR4reT3JXO47o14GGwYs/t0G27iD+CPc1dC o3aASynl4GHVF8LQt1Ml8Q8QpG9pPzW3kzNKh6NL5DSO2zepYZfvgSzp6kQyMBLBk5DK 49aTZO5HN7OnEQNtwjBlLlr/xjfk75O23XCfCMpdEv4i7/sy9MJs2oqjQgZl2Q6KGkNB j5wQ== 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=9Q+Bs+O9lb9GIqEzbWpwGXGuxnLkGp1hWto9OR2+BB8=; b=IzwmH4eJt0dadE36J+tYHc3LTN/4YHY4W+r/6JhjChf0EVZd2XBF9bx1+6ZxKEhNGV dxafGo4zd2V1lRg0bnWQkIDGSHX+9+F2EMDMINF8SD6tjtFtOuciWe15HjE5DkH/24U9 VgmMfjrvE5nkFehQSNKJORKfym2ZLsioGgMAHFrJagxSFJvIDDxvG0YeeN/42LnTFXQC Voc3SL8diZ8cOvP1m3s/DAmDx2769XJfOM0ltIoyAFUEscaqMWimQsUQmzqqgUVTkE0F 7y1MEKHFYUv5FDewYZ6OlIWQ1V7v36c4y6cG51pYqwbsxhp5Clp2O1FhsRX/0LlQGd4V 3xLQ== X-Gm-Message-State: AO0yUKXWTjvqiIRTLmxfxOJ8pwiJlmXGYWcYC3FuAgPfozpXg+IVN33J 6xce0mrfVWqhGkRGNjFuhmjKTB0XfxbdXK+R X-Received: by 2002:a17:903:2352:b0:192:4f85:b91d with SMTP id c18-20020a170903235200b001924f85b91dmr10316210plh.46.1675889673488; Wed, 08 Feb 2023 12:54:33 -0800 (PST) Received: from localhost ([111.184.129.17]) by smtp.gmail.com with ESMTPSA id x20-20020a1709027c1400b0018963b8e131sm11465843pll.290.2023.02.08.12.54.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Feb 2023 12:54:33 -0800 (PST) From: "Ying-Chun Liu (PaulLiu)" To: u-boot@lists.denx.de Cc: "Ying-Chun Liu (PaulLiu)" Subject: [PATCH v2 0/2] arm: cpu: Add optional CMOs by VA Date: Thu, 9 Feb 2023 04:54:26 +0800 Message-Id: <20230208205428.1083689-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. Marc Zyngier (1): arm: cpu: Add optional CMOs by VA Pierre-Clément Tosi (1): arm64: Initialize TLB memory if CMO_BY_VA_ONLY v2: Fix the Signed-off-by list. 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(-)