From patchwork Fri Jan 15 09:30:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jianyong Wu X-Patchwork-Id: 12022023 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_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, 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 76660C433E0 for ; Fri, 15 Jan 2021 09:32:23 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 3AF2523436 for ; Fri, 15 Jan 2021 09:32:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3AF2523436 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Owner; bh=IOnw6/bUXA3xkPMARmJgLtHWbf2sRLYM2D9SdiDTx3g=; b=UseJw+YWDGx1sihSGz6aOeStc4 YVHb93oCjlyEn/ufimZO3bOAOFnGhWf9/Et7w4lRRo/iV3FhdTVkkaAc2YuKKXMDzjVePHSEGbXRn FNnp+U8vejfctiKrssLBCSpYGSECHOT5N2JQLAaAvFR6+kyFiqXSwU0uyQu67bxrnN4rpd1FZ0gLQ vu+TxknooJu4ay6QXhcyBcGxWg3L74v0sl3GUAXb7ypwIbFZfxs5diYAoOdHaUpPz5eXhf/ohiOt1 FYVfyQKapG8wfENtUAOSzsmzpm7l+1G0/i+xgOsVjh2pMcTMHYSsznDIx+bJ1VdFMUS6U66IR2FSL vMmEFo6A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l0LRc-0003gZ-30; Fri, 15 Jan 2021 09:31:00 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l0LRX-0003ek-CD for linux-arm-kernel@lists.infradead.org; Fri, 15 Jan 2021 09:30:56 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 20E79D6E; Fri, 15 Jan 2021 01:30:52 -0800 (PST) Received: from entos-thunderx2-desktop.shanghai.arm.com (entos-thunderx2-desktop.shanghai.arm.com [10.169.212.218]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id D7DEB3F66E; Fri, 15 Jan 2021 01:30:48 -0800 (PST) From: Jianyong Wu To: maz@kernel.org, james.morse@arm.com, will@kernel.org Subject: [PATCH] arm64/kvm: correct the error report in kvm_handle_guest_abort Date: Fri, 15 Jan 2021 17:30:28 +0800 Message-Id: <20210115093028.6504-1-jianyong.wu@arm.com> X-Mailer: git-send-email 2.17.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210115_043055_508408_E2C69CF1 X-CRM114-Status: GOOD ( 10.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: justin.he@arm.com, Steve.Capper@arm.com, jianyong.wu@arm.com, nd@arm.com, suzuki.poulose@arm.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Currently, error report when cache maintenance at read-only memory range, like rom, is not clear enough and even not correct. As the specific error is definitely known by kvm, it is obliged to give it out. Fox example, in a qemu/kvm VM, if the guest do dc at the pflash range from 0 to 128M, error is reported by kvm as "Data abort outside memslots with no valid syndrome info" which is not quite correct. Signed-off-by: Jianyong Wu Signed-off-by: Marc Zyngier --- arch/arm64/kvm/mmu.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c index 7d2257cc5438..de66b7e38a5b 100644 --- a/arch/arm64/kvm/mmu.c +++ b/arch/arm64/kvm/mmu.c @@ -1022,9 +1022,15 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu) * So let's assume that the guest is just being * cautious, and skip the instruction. */ - if (kvm_is_error_hva(hva) && kvm_vcpu_dabt_is_cm(vcpu)) { - kvm_incr_pc(vcpu); - ret = 1; + if (kvm_vcpu_dabt_is_cm(vcpu)) { + if (kvm_is_error_hva(hva)) { + kvm_incr_pc(vcpu); + ret = 1; + goto out_unlock; + } + + kvm_err("Do cache maintenance in the read-only memory range\n"); + ret = -EFAULT; goto out_unlock; }