From patchwork Sun Apr 23 17:09:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 9695065 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 9322C60245 for ; Sun, 23 Apr 2017 17:14:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D38526538 for ; Sun, 23 Apr 2017 17:14:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 70C5A267EC; Sun, 23 Apr 2017 17:14:04 +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=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 23B6D26538 for ; Sun, 23 Apr 2017 17:14:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1162710AbdDWRN7 (ORCPT ); Sun, 23 Apr 2017 13:13:59 -0400 Received: from mail-wr0-f170.google.com ([209.85.128.170]:34045 "EHLO mail-wr0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1162935AbdDWRKf (ORCPT ); Sun, 23 Apr 2017 13:10:35 -0400 Received: by mail-wr0-f170.google.com with SMTP id z109so79246653wrb.1 for ; Sun, 23 Apr 2017 10:10:35 -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=BiPEt+unr452/sk1S5OSgiKSB4/Lt0B1FoeIiaIYcP4=; b=LDUUI9OY4OnWSz9GhIzOSar84HVw3owo6pzrhnPcsgstt4YTRcHC3aSnNI0CoJWWcz m7Yc+bH+x0k+dkXlIxbHIdghO0vWYgZMMkiq76GwOIHxwSiETT4P7P2SfSuueQD22T1P thQdQUYkjwKRoLGjOhydGeWmFe2tQ4gBcOSHE= 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=BiPEt+unr452/sk1S5OSgiKSB4/Lt0B1FoeIiaIYcP4=; b=a3WWelS4+XNuVhTgbKzZAATzb2NhDSg6b4vLxbxqsqgOAQfNBnPkaxRReU/PDluVOq fJiLuhvHqxQRPOdN6Qoyr8CNq88LKGlqSLL+kbI0Wwb3IOpxWcXQjPLux0T9eIEhJbQS T3n2pnG7xk2nf8af2fE+DmEM5DLUSeTwA9WvE6aqotYj0mvykuiYES7zpVKBgzvLZuGz WOXcaV1BA8XCkMions1ZLiOTO84sTpZqbWrFYCWBDG4z2i2Q5xdT4DgikN54/4zZEL92 Y6YYQvHtnbVg7bDtyoQGJLIDMIMPCQV03h4Vs9dRvZ7Xa32hutSwno5sEx6Vcg+UXngY k77Q== X-Gm-Message-State: AN3rC/7LQWNPssdbBCnrK2mBHcRs2sC6D+2euP+wkygivg1gqQjDVcJD S9Ms7oQtO1Ah+qro X-Received: by 10.223.151.146 with SMTP id s18mr2316920wrb.40.1492967434121; Sun, 23 Apr 2017 10:10:34 -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.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 23 Apr 2017 10:10:33 -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, Christoffer Dall Subject: [PULL 59/79] ARM: KVM: Implement HVC_SOFT_RESTART in the init code Date: Sun, 23 Apr 2017 19:09:09 +0200 Message-Id: <20170423170929.27334-60-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 Another missing stub hypercall is HVC_SOFT_RESTART. It turns out that it is pretty easy to implement in terms of HVC_RESET_VECTORS (since it needs to turn the MMU off). Tested-by: Keerthy Acked-by: Russell King Acked-by: Catalin Marinas Signed-off-by: Marc Zyngier Signed-off-by: Christoffer Dall --- arch/arm/kvm/init.S | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/arch/arm/kvm/init.S b/arch/arm/kvm/init.S index fb33609..e53360d 100644 --- a/arch/arm/kvm/init.S +++ b/arch/arm/kvm/init.S @@ -127,8 +127,22 @@ ENTRY(__kvm_handle_stub_hvc) mrc p15, 4, r0, c12, c0, 0 @ get HVBAR b exit +1: cmp r0, #HVC_SOFT_RESTART + bne 1f + + /* The target is expected in r1 */ + msr ELR_hyp, r1 + mrs r0, cpsr + bic r0, r0, #MODE_MASK + orr r0, r0, #HYP_MODE +THUMB( orr r0, r0, #PSR_T_BIT ) + msr spsr_cxsf, r0 + b reset + 1: cmp r0, #HVC_RESET_VECTORS bne 1f + +reset: /* We're now in idmap, disable MMU */ mrc p15, 4, r1, c1, c0, 0 @ HSCTLR ldr r0, =(HSCTLR_M | HSCTLR_A | HSCTLR_C | HSCTLR_I)