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: 9695163 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 CA744601E9 for ; Sun, 23 Apr 2017 17:33:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C81EA209D8 for ; Sun, 23 Apr 2017 17:33:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BC77726490; Sun, 23 Apr 2017 17:33:03 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 49359209D8 for ; Sun, 23 Apr 2017 17:33:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To: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:List-Owner; bh=Modi1uEXgZdfrEeVEolpZy0HpvbC8be4Oc6gEsyqIqE=; b=seAu94h0FrQTreiEZJ0fDwiKkO N5QpveD07Cd5Xw4e1tS20CMmTwodxnWbe2F8h4ZBAw8HagccdQqBTJBw+JYhL45jDjR4KE0NK5EPH XzcqoS/+kUZmh6fzQtMSJaBka29cMvOr7HOq7oS2xmeMKsigJgKtdQHheK7Gi8+D99kDey4ERV9E7 y3JOWz40Y2Dascp4Dm+w+aGPn9i7K9I8Oz9I5PihZkiY9vxAIYQsnTyYKeI7tuV188mhCwcmYS8bM w1Bibv0W/4LFd6vk1NaQDl8j4fm8GpI1zbEEpouOYddYQORlzy1zElCwAAfewctPsrxB4Lgrk5m90 +PEFfXiQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1d2LNe-00054m-Ip; Sun, 23 Apr 2017 17:33:02 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d2LLz-0002ZO-Sa for linux-arm-kernel@bombadil.infradead.org; Sun, 23 Apr 2017 17:31:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=vI05b3EQNzGvHg0b0eNUXMXT3vNzKc1l8idnl+kKoIM=; b=GEO5WtKp35U2X0x3k1Az4bJoX dpbLHabbVo8ch9IcKz4BRxEz5yjMY0bn5AmSS5XwPxKFqkCbvs/SLL1u1M1n8ZuYzysMgpsYfaa8N ataUEuDGQjV+mUTGJCvCIrAKX3AOjlvRUHy+OWy8I8Hz2YwBW8E+Jqib4w4svvGnwYiaYCEkByc06 qfC9jxYN1kvEVFC+Qw/AS091LGUY/0q/xfy3iPJSJS9yokuv60oullS6eGVIHzp/UeT7dI8DXNad9 DQr7qrv/X8dgF3KR6D5W5v3SQCH9M79ZoZUvesU8U2+dCCuszF2/SXQVFMU8U/x4ccjvruLG+PgO0 8WNzVkGoQ==; Received: from mail-wm0-x234.google.com ([2a00:1450:400c:c09::234]) by merlin.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d2L3j-0005Mh-4q for linux-arm-kernel@lists.infradead.org; Sun, 23 Apr 2017 17:12:27 +0000 Received: by mail-wm0-x234.google.com with SMTP id m123so50337735wma.0 for ; Sun, 23 Apr 2017 10:12:09 -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=s6VOhYlhX3WkbH9aMy6/COZgUA2z9lWT7vQh9gU6aiV9sCrSlQUNEtOcl7m6LMMfNk Ve3XSTy50wjQWeQtPctCEl+XL/RI41P8c+YrdruezrB4AgpIwMfunZRBBBu7Ui7afpzK 6d8ossw+4O0lnLnSqE5LyN7x6ZcjI9Uc/ylE9jqWyZxPd1RgxxbmfksQsx7mPge+1NFO XuZtAWfjChzbbCYPbQsGNzcZEM4kfKs6lCf/NH8DxIqGC5E0ez2EXxPZH+o7RLgj3Dtk lobbOGaJAwgTK3hDhYUh21/UhWWNFIW371zZRmB91GF+bmGLuC6zb+HaAEUU3i3d2nyy dh2A== X-Gm-Message-State: AN3rC/4aaEMSm5/wlIEtrBnbG+v3qkzD6MEqzw6sco48iGshDfv2pgXs BVKpDUr6nBB6DMkG 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?= 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170423_131227_346719_03CCEB04 X-CRM114-Status: GOOD ( 11.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Zyngier , kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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; }