From patchwork Wed Mar 17 14:17:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Perret X-Patchwork-Id: 12145863 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=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT 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 723F6C433DB for ; Wed, 17 Mar 2021 14:19:27 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 E11EB64F26 for ; Wed, 17 Mar 2021 14:19:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E11EB64F26 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Cc:To:From:Subject:References:Mime-Version: Message-Id:In-Reply-To:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bFpR1FvRdRPjGXKrks83HynAP/BW50B40/oHzlJP9ks=; b=hEDSpJqZYRE26q syV0UUzMql2Z9lvXKLxguVwcYqg6HBO8zvyeN/s4IYwmgLuQCbdyljTw2ttMLSE4TTsc7E+LUGpNW d0FU1MLcNRrklSMX9ljD9y8uoSBX7+KrdlGM8xUvWoiukRPJOu+6Mab7HQQQcs6mVV8x4aUDT+znb Y0udOBSiFQJyvePaJiDlet/4z/HEV/+XCsBdP3xa2j7NfKAOn9hooF/iZh7/jcplCZGxB+SRax5pg GihWTFLHgKq/ZD4yRTUdKTzP9meIoNdEqudwZF3Ag8fLGJOYAEE3VwOCVZ7YWU6HO79wwbCnKi3u1 qsUNf2mmZKHmVsqM0dmA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lMWzS-003Elx-Uf; Wed, 17 Mar 2021 14:17:39 +0000 Received: from mail-wm1-x349.google.com ([2a00:1450:4864:20::349]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lMWzD-003Ejv-CL for linux-arm-kernel@lists.infradead.org; Wed, 17 Mar 2021 14:17:25 +0000 Received: by mail-wm1-x349.google.com with SMTP id n2so10789524wmi.2 for ; Wed, 17 Mar 2021 07:17:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=Q4V+uOAPZg+8IRDU5mahURH8jFF9ksprgkE8pnV2+pI=; b=nOjGyLVk+LQQpkIGloNKaOBZGiHuZP3o8hZS0+/PkEKwar0iBam9A/S5fY3dDEp2tv 9eaTVYSgiNCZd9vqBh9EaR6rr5ABZcqJhepuIaJP/qswFsC/PblA0Uj/H/9RTNGBhAwc nJsxrNTaJDJ2sleNFqxmCW2yVVO+d2Wjy6hZHm94blPNYxt/12pwGeKx0qud6E9mpXc1 SkgMzZv/otO2vBE54oi6bzmLhcaJC4iVNMm+YLttfKkRvOxjqZWbpL8lX755fLMcGwww oOzTADmiTzBT7CrXki6+oREF4m72flOVuTEm78cImMKccnkACbjJhWURXjcoGTStJPPw +J2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=Q4V+uOAPZg+8IRDU5mahURH8jFF9ksprgkE8pnV2+pI=; b=Tv/LZFIX4nr8umv7P2+Bus2N6SfUCCLrFtP+QDP7yb9qK5wLdAAlzNZUwPjlVOGCN8 1+naIMhKNCpqybJhtoMZwMJWX6is+mAIMsY5P+nB2ZkILYR5ctOPsugvCOiCp8wgF/xP Q+1BakZ9o5B2OCLY/OdNuNY8jO0WdLsZTQc7N2yPGxE8BAaeHzl8CmATQl2h4PW+IDlS 4xnT5KleArdS8lOgOPNgBJIUjX1aUVEuNGqUF4qdNHTCHHBWdwKAw7O9hIMyBcvnOxdX yfzMyftUFBZTxxWZ99vVF3oQ1eAyYc4c2gkqI3c3tux1kkH1fJdA8Qp9gb0Zw6aZx162 OUiQ== X-Gm-Message-State: AOAM531eFAUwVd0JYafazuu8VnHTnKkZIGc1UHHFjRFgIb1zaghJWkMI WDSUMShcF64iQKd2TFmXqsEn69Rika0l X-Google-Smtp-Source: ABdhPJzfbGHlOZ2mswIVtX/K86GO+y6S/0YGq3nxkyi0qI2XV2uCdtoLRdQPNroMNClPqw4jAdENknrb1l1c X-Received: from r2d2-qp.c.googlers.com ([fda3:e722:ac3:10:28:9cb1:c0a8:1652]) (user=qperret job=sendgmr) by 2002:a1c:e912:: with SMTP id q18mr3949743wmc.59.1615990642409; Wed, 17 Mar 2021 07:17:22 -0700 (PDT) Date: Wed, 17 Mar 2021 14:17:14 +0000 In-Reply-To: <20210317141714.383046-1-qperret@google.com> Message-Id: <20210317141714.383046-3-qperret@google.com> Mime-Version: 1.0 References: <20210315143536.214621-34-qperret@google.com> <20210317141714.383046-1-qperret@google.com> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog Subject: [PATCH 2/2] KVM: arm64: Disable FWB in host stage-2 From: Quentin Perret To: qperret@google.com Cc: catalin.marinas@arm.com, will@kernel.org, maz@kernel.org, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, android-kvm@google.com, seanjc@google.com, linux-kernel@vger.kernel.org, robh+dt@kernel.org, linux-arm-kernel@lists.infradead.org, kernel-team@android.com, kvmarm@lists.cs.columbia.edu, tabba@google.com, ardb@kernel.org, mark.rutland@arm.com, dbrazdil@google.com, mate.toth-pal@arm.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210317_141723_476181_80EA3E46 X-CRM114-Status: UNSURE ( 9.35 ) X-CRM114-Notice: Please train this message. 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org We need the host to be in control of cacheability of its own mappings, so let's disable FWB altogether in its stage 2. Signed-off-by: Quentin Perret --- Obviously this will have to be folded in the relevant patch for v6, but I kept it separate for the sake of review. --- arch/arm64/kvm/hyp/nvhe/mem_protect.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/arm64/kvm/hyp/nvhe/mem_protect.c b/arch/arm64/kvm/hyp/nvhe/mem_protect.c index dd03252b9574..c472c3becf40 100644 --- a/arch/arm64/kvm/hyp/nvhe/mem_protect.c +++ b/arch/arm64/kvm/hyp/nvhe/mem_protect.c @@ -94,8 +94,8 @@ int kvm_host_prepare_stage2(void *mem_pgt_pool, void *dev_pgt_pool) if (ret) return ret; - ret = kvm_pgtable_stage2_init(&host_kvm.pgt, &host_kvm.arch, - &host_kvm.mm_ops); + ret = kvm_pgtable_stage2_init_flags(&host_kvm.pgt, &host_kvm.arch, + &host_kvm.mm_ops, KVM_PGTABLE_S2_NOFWB); if (ret) return ret; @@ -116,8 +116,6 @@ int __pkvm_prot_finalize(void) params->vttbr = kvm_get_vttbr(mmu); params->vtcr = host_kvm.arch.vtcr; params->hcr_el2 |= HCR_VM; - if (cpus_have_const_cap(ARM64_HAS_STAGE2_FWB)) - params->hcr_el2 |= HCR_FWB; kvm_flush_dcache_to_poc(params, sizeof(*params)); write_sysreg(params->hcr_el2, hcr_el2);