From patchwork Wed Mar 17 14:17:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Perret X-Patchwork-Id: 12145859 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=-12.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, 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 1627DC433E0 for ; Wed, 17 Mar 2021 14:19:04 +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 7771064F26 for ; Wed, 17 Mar 2021 14:19:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7771064F26 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=SUsiysn810TnNG/SWzS3ZSScGaHYiA81krlUqM5af/0=; b=c41QZ7WWLFRloe h/D8rX+n1UnhI9Z+KrRAV+IPyMHiPuQ5ChNXU4FGcKPek9n5XZL+UvI21W2+btFU+OQyoqV8ghPtp eEkOzXldWB2gHPFdMg8C2krt542GzPFmZX1iXlp8LnenUH7DaOEEHYjvN2IfFr5NT9Qw1Y0UZb/y1 gEcGK+KBqXUrfPM0pXgeJrNfiw8JZ4BztY0Ah+BC0Hu1ZgqIwOMVDyyc5gs1yM19U4Rke0VbF3Ilt JRQKTSyi8tmQdnHIfyPI5Bi/+V/FwbtUU8SYr9aVJTj2wOq5mnM4dNiukc23WjsY3TxPUT8IpKSrg dWAcRuhmGW9bUmAMNzjQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lMWzE-003Ejx-21; Wed, 17 Mar 2021 14:17:24 +0000 Received: from mail-qk1-x74a.google.com ([2607:f8b0:4864:20::74a]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lMWz9-003EjA-IB for linux-arm-kernel@lists.infradead.org; Wed, 17 Mar 2021 14:17:21 +0000 Received: by mail-qk1-x74a.google.com with SMTP id t24so12165916qkg.3 for ; Wed, 17 Mar 2021 07:17:18 -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=KrfxD88Ict/v6ngLTLvsT+oMLpFGTSrf7Eslq0SGM14=; b=a+nv8X7pyir1+SV83VwUJ4vj+AHhzDv9PQ9WnWuQqlWQwiB8a746kscytqy4ej1iuw eyas/id66NAzXCPbs1TSyWUPg0J1tAfqygJ563ZEyLL86DAMxCXR1eoiH5rVUm6wwKsN crGLP6vZayX2cQNy4hcQz8SC03UJwBdpmg407s9BSCKHMY6GoXRntodV5QOCc7JdoIdV zhW+OWR5QMi/4VcTh3g3DTA6Q8Q2/Z/aXggxBg1pEDZVGOiCxDLIZZoC5Se7sXzaEtjn pr0I3chBsy50GvwK9oKIj76iUUqJwg6uv+nTrysi6egixhFVdjdZQzkMPVQ/2bWl5qLl Dfqw== 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=KrfxD88Ict/v6ngLTLvsT+oMLpFGTSrf7Eslq0SGM14=; b=G/ColFkWtffbs4RVyVwCM2Fnozy9oRtrbi7kSJWPEvd5yOw13Icm75TQh5x3ntGbS1 OrENnOImqWQd09A4G2BUVAow8mrMCpxn698ax1O8N6y9eFYYwUw1YSQYL1SU8Rq27yQT AkR2BE3z8aC34y4Heq/TjO8/hJKFPNbaqsigMGIEFBBSo+nOW+BvtGpasZai27bqXQVQ 8uE5+jQ50Nrgm7M4YbYAxWucb/1betiaYT3WRSxSTuRfeNUTkR31zAd2MFkASavMQtVl Na3H164bBgJhRvU5m0KM22EiN7Gf5jeNp06dnDddm6unqjxAzkmFdVfsQGgcbQL9awsq PGHw== X-Gm-Message-State: AOAM531GJFEf5ukHtG7s+qOS2i0TnGjn7QtSKzuwObj8GzhdtseRrE6m ebpPIwtCOaD2T9OpvydTBkUxMcrsejmd X-Google-Smtp-Source: ABdhPJzkVS1O87T4WUzd78oVRcatodCw8tdcjCnylMKpUhZ05gMFuwQ7e3RhsN9PT90TU72c/bE143W9PeYp X-Received: from r2d2-qp.c.googlers.com ([fda3:e722:ac3:10:28:9cb1:c0a8:1652]) (user=qperret job=sendgmr) by 2002:ad4:472d:: with SMTP id l13mr5273536qvz.17.1615990637862; Wed, 17 Mar 2021 07:17:17 -0700 (PDT) Date: Wed, 17 Mar 2021 14:17:12 +0000 In-Reply-To: <20210315143536.214621-34-qperret@google.com> Message-Id: <20210317141714.383046-1-qperret@google.com> Mime-Version: 1.0 References: <20210315143536.214621-34-qperret@google.com> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog Subject: [PATCH 0/2] Fixes for FWB 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_141719_658682_34AF1ADD X-CRM114-Status: UNSURE ( 9.08 ) 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 Hi folks, This is an alternative solution to the KVM_PGTABLE_PROT_S2_NOFWB patch I shared earlier (and which is a bit of a hack). With this series we basically force FWB off for the host stage-2, even when the CPUs support it. This is done by passing flags to the pgtable init function, and propagating it down where needed. It's a bit more intrusive, but cleaner conceptually. Thoughts? Thanks, Quentin Quentin Perret (2): KVM: arm64: Introduce KVM_PGTABLE_S2_NOFWB Stage-2 flag KVM: arm64: Disable FWB in host stage-2 arch/arm64/include/asm/kvm_pgtable.h | 19 +++++++++-- arch/arm64/include/asm/pgtable-prot.h | 4 +-- arch/arm64/kvm/hyp/nvhe/mem_protect.c | 6 ++-- arch/arm64/kvm/hyp/pgtable.c | 49 +++++++++++++++++---------- 4 files changed, 52 insertions(+), 26 deletions(-)