From patchwork Sun Apr 23 17:08:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 9694965 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9F15A60245 for ; Sun, 23 Apr 2017 17:11:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 877C926530 for ; Sun, 23 Apr 2017 17:11:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7C5AF265B9; Sun, 23 Apr 2017 17:11:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F087226530 for ; Sun, 23 Apr 2017 17:11:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1163130AbdDWRLb (ORCPT ); Sun, 23 Apr 2017 13:11:31 -0400 Received: from mail-wm0-f42.google.com ([74.125.82.42]:38641 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1162390AbdDWRKJ (ORCPT ); Sun, 23 Apr 2017 13:10:09 -0400 Received: by mail-wm0-f42.google.com with SMTP id r190so50450674wme.1 for ; Sun, 23 Apr 2017 10:10:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=vI05b3EQNzGvHg0b0eNUXMXT3vNzKc1l8idnl+kKoIM=; b=UUL1msRnOvIYhg17FOwH4IpS6rst3LxwEgfJIqUny6kG6etogqcogwBagSbZdBmpxI le/t1L8lRfhBAtbxWFKFtCRm5ZF1Fyvpt5eSd64eYQjSmK3tfefglIArz6TXczwVYR2O GXRZHr6eSVzAMTKmYo5EDVBMDX1LMXwXn6QwU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=vI05b3EQNzGvHg0b0eNUXMXT3vNzKc1l8idnl+kKoIM=; b=liRnofK6fJ82ZkUm3/EzM8/lx5miEW4NBoRpflDlZTdIc2YNZSHhPKFUzwBN3OfgHx gASWyEEJHtGjSvzAh+mlsuQdGJdI4/oM/nLIF2zpbKrT1p+NhIKXsw7TlA3twG95Mw0W rR9GNyWIronhSu66VR/ywJQXvCyM/iBzhMSCzDBd47NcS7ccxENVNCWcjzpSm9IaeKvn rUFDxQiUEx7LU+ke80Z+hJaGMgckQfSF/tvAVvbjd+F4TdvqT6VCQuJCWzfMwYNZVlBf DIrD67sMuSHkBVsaMMJsUQCkTJtRkfQQt9wrqFOLT8BTLngx4kQwEyROxCI4geXLmR9I Uw0Q== X-Gm-Message-State: AN3rC/68CJW6kXPrAtwkfGLcwB4sUAnR1TPoYyWW9sWEkkinvD2Ygd/a tcFCcP9tS/aMj+hFMxP34Q== X-Received: by 10.80.149.167 with SMTP id w36mr134726eda.37.1492967407962; Sun, 23 Apr 2017 10:10:07 -0700 (PDT) Received: from localhost.localdomain (xd93ddc2d.cust.hiper.dk. [217.61.220.45]) by smtp.gmail.com with ESMTPSA id 58sm2803521edz.2.2017.04.23.10.10.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 23 Apr 2017 10:10:07 -0700 (PDT) From: Christoffer Dall To: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Cc: Marc Zyngier , kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PULL 35/79] arm: KVM: Treat CP15 accessors returning false as successful Date: Sun, 23 Apr 2017 19:08:45 +0200 Message-Id: <20170423170929.27334-36-cdall@linaro.org> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170423170929.27334-1-cdall@linaro.org> References: <20170423170929.27334-1-cdall@linaro.org> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Marc Zyngier Instead of considering that a CP15 accessor has failed when returning false, let's consider that it is *always* successful (after all, we won't stand for an incomplete emulation). The return value now simply indicates whether we should skip the instruction (because it has now been emulated), or if we should leave the PC alone if the emulation has injected an exception. Reviewed-by: Christoffer Dall Signed-off-by: Marc Zyngier --- arch/arm/kvm/coproc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/kvm/coproc.c b/arch/arm/kvm/coproc.c index 519aac1..2c14b69 100644 --- a/arch/arm/kvm/coproc.c +++ b/arch/arm/kvm/coproc.c @@ -520,15 +520,15 @@ static int emulate_cp15(struct kvm_vcpu *vcpu, if (likely(r->access(vcpu, params, r))) { /* Skip instruction, since it was emulated */ kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu)); - return 1; } - /* If access function fails, it should complain. */ } else { + /* If access function fails, it should complain. */ kvm_err("Unsupported guest CP15 access at: %08lx\n", *vcpu_pc(vcpu)); print_cp_instr(params); + kvm_inject_undefined(vcpu); } - kvm_inject_undefined(vcpu); + return 1; }