From patchwork Fri Jun 2 17:01:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colton Lewis X-Patchwork-Id: 13265714 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B7C31C7EE24 for ; Fri, 2 Jun 2023 17:03:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:Message-ID: References:Mime-Version: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=JCbKbyoBMUaNk1lUjsbTkbbSDGTAyTs9pKFfoqOfK9M=; b=eu0MUPi2YM4VKx/iSmjHyOIxLP bRacZh3K5XSOvK5mPN0sED9XQhxKtGQsRhhReiizLFX1rrp+phTBXYGSVNJ8SNQUw9jXrJq2xu6U8 xx6cncIcWQxqpDVkUeZuCDbJbc1gDcP79UCrK+Gf0MSDbNQ2+9//BewFtPFHcKhDX0fOEy1w6oX1A UuvJLoK8VANPjy6Ex7mQtxgwYRi0Xi5DV7+ED5chZtaHQ8mJnxP4Z4EppR1jbxRwk0dck/LfsFv2j dTzkrxFGN+HWC+i+oF0QMz+HpQu7yHbAN5usj6vsGMVrXT2Uqk5jDn5n6WnuW22PNsrkEr9WCdd6L tMfx1Xwg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q58B0-007UM4-2d; Fri, 02 Jun 2023 17:02:58 +0000 Received: from mail-il1-x149.google.com ([2607:f8b0:4864:20::149]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q58Ax-007UJI-0X for linux-arm-kernel@lists.infradead.org; Fri, 02 Jun 2023 17:02:56 +0000 Received: by mail-il1-x149.google.com with SMTP id e9e14a558f8ab-33b88241696so20304505ab.1 for ; Fri, 02 Jun 2023 10:02:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1685725372; x=1688317372; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=jc0HXGzYvsWKFFqMwew1siGd4KbapSh3HWhZ39XsN18=; b=j+tKfi2kSo+PoSM8bzNfiRyUHJOyeGZ8cXfsmhGYboQIkXNZcgKm7MC/cWX/C6ZkqG 60f7UABnT6ErAicHdSv8GNsaMsxzvOwv4YmniUVjWIoOAFBY8RnuSFSvJlf10WPLD0Pl 04johD9tWvxiLCZi1WR0w+oOd0+AB/CP+2jYhm7evUJn7pTqemwzVAxdP+R68pydUGOA HIqJ0F9ltOSTrTcu2f3O/9bIynM8h5wdOVo4MLk5r9Ic6t6CxEi8rZbTDEZoGZX1Jbzt PmrdFFznsQ54/dOus3KfJ9Qig75zKJPzP+rVna7qVoudLzvULSQv2dyT4F4wCWi6idZ2 o0vQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685725372; x=1688317372; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=jc0HXGzYvsWKFFqMwew1siGd4KbapSh3HWhZ39XsN18=; b=JhPDZZJ9Z58NNLCNa4VIfKN0YLxQZFjGrH8SXoGakgjqj6lRiXYkAr9wZTmFmtQAed UXen6JBTLiNjsxnHbCf8fRAj58Bccqih6l16MEPZNWDijmS6uqVUcC+KqDsOJrcqs25f 3+tUCRkrtRWM9mQbxFMJN2ZdtHVcW81I6oa2fsRnVZt9mPk99j8vleLbcJtB9fJuJMdd YegKXV4VsRQiRY+VyQdiy+BabfuHM+XjTFLnrY8b9awZfKktyaXQO20gEbjH0VvRm8a9 twbisPsa688RUwdMzDCb7Af/K/3LsgDMQlzijTyBuolR/SMq9V3a2hB5mSOfhSoSa+Xz 5H1A== X-Gm-Message-State: AC+VfDzTlztqLEGB15IBLIZ8hkxpBdFdM7YZgrRqIAKv6/lYfzeMcvq0 ZTsWdI3q4YyKvtV+gYq9x6gNn7ULwzR6GgRE0w== X-Google-Smtp-Source: ACHHUZ7+edDLEpgV1IGnbtuAGa0C22RGdZstxlqcJBRqQ5INrzQuoJ8ypYZbCeOZkcJOp1lxWUSrEVByOHlYXL/q9g== X-Received: from coltonlewis-kvm.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:14ce]) (user=coltonlewis job=sendgmr) by 2002:a92:db52:0:b0:335:908b:8f9 with SMTP id w18-20020a92db52000000b00335908b08f9mr4386617ilq.1.1685725372593; Fri, 02 Jun 2023 10:02:52 -0700 (PDT) Date: Fri, 2 Jun 2023 17:01:46 +0000 In-Reply-To: <20230602170147.1541355-1-coltonlewis@google.com> Mime-Version: 1.0 References: <20230602170147.1541355-1-coltonlewis@google.com> X-Mailer: git-send-email 2.41.0.rc0.172.g3f132b7071-goog Message-ID: <20230602170147.1541355-3-coltonlewis@google.com> Subject: [PATCH 2/3] KVM: arm64: Clear possible conflict aborts From: Colton Lewis To: kvm@vger.kernel.org Cc: Catalin Marinas , Will Deacon , Marc Zyngier , Oliver Upton , James Morse , Suzuki K Poulose , Zenghui Yu , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, Colton Lewis X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230602_100255_201720_BF97BEA3 X-CRM114-Status: GOOD ( 11.16 ) 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 Clear possible conflict aborts by TLB invalidation targeted to the address that caused the abort. Making use of FEAT_BBM Level 2 creates the possibility of a conflict abort when translating addresses, where multiple entries exist in the TLB for a single input address. Signed-off-by: Colton Lewis --- arch/arm64/include/asm/esr.h | 1 + arch/arm64/kvm/mmu.c | 6 ++++++ 2 files changed, 7 insertions(+) -- 2.41.0.rc0.172.g3f132b7071-goog diff --git a/arch/arm64/include/asm/esr.h b/arch/arm64/include/asm/esr.h index 8487aec9b6587..41336cfa19ff3 100644 --- a/arch/arm64/include/asm/esr.h +++ b/arch/arm64/include/asm/esr.h @@ -123,6 +123,7 @@ #define ESR_ELx_FSC_SECC_TTW1 (0x1d) #define ESR_ELx_FSC_SECC_TTW2 (0x1e) #define ESR_ELx_FSC_SECC_TTW3 (0x1f) +#define ESR_ELx_FSC_CONFLICT (0x30) /* ISS field definitions for Data Aborts */ #define ESR_ELx_ISV_SHIFT (24) diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c index 7a68398517c95..96b950f20c8d0 100644 --- a/arch/arm64/kvm/mmu.c +++ b/arch/arm64/kvm/mmu.c @@ -1591,6 +1591,12 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu) return 1; } + if (fault_status == ESR_ELx_FSC_CONFLICT) { + /* We could be at any level. 0 covers all levels. */ + __kvm_tlb_flush_vmid_ipa(vcpu->arch.hw_mmu, fault_ipa, 0); + return 1; + } + trace_kvm_guest_fault(*vcpu_pc(vcpu), kvm_vcpu_get_esr(vcpu), kvm_vcpu_get_hfar(vcpu), fault_ipa);