From patchwork Thu Dec 7 17:06:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10100291 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 984D160360 for ; Thu, 7 Dec 2017 17:13:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F127284CE for ; Thu, 7 Dec 2017 17:13:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 73E0F284DE; Thu, 7 Dec 2017 17:13:24 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED 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 0F24628508 for ; Thu, 7 Dec 2017 17:13:24 +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=qWNu4m8puP1SJukqzHMvV7KQor0ymJy1A0jN/ru8msk=; b=MUpSumXYoNB+8hD8p1XTVt9fCg LjOoYE5VozJwVCJL+1OZZZxCT10h2O0ip6qbcTt9vzseuvWS3MLQuVMUX6CfohCnMTNMVaiy9sGCB qXfzYNroRYnqAfkFBbaKt8gFq4lshK0oKjhaPEfRYUaKVPE2Oz0jzwXQdz4FO+9DCpt2TMP9xUDWi 6KBnb47Tft6sAeertRISrbc4yr1TX52lkT0QmzpyR4H1WyTh0x8m5wUGOrvR0ApT3eFakydKr6xST thwr1fPoFd7g0WPexJ7oGMQHhcoVo0GRSboJQoOe2ubu9CEPWx87UWdcoPgx04XgwVQFa55FYu9UC OtKrrqZA==; 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 1eMzjf-0001Mg-Bn; Thu, 07 Dec 2017 17:13:23 +0000 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eMze5-0003Eg-Rs for linux-arm-kernel@lists.infradead.org; Thu, 07 Dec 2017 17:08:09 +0000 Received: by mail-wm0-x242.google.com with SMTP id b76so14242641wmg.1 for ; Thu, 07 Dec 2017 09:07:18 -0800 (PST) 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=n1Z5jEwyxXA//VaGTLgDL9bVzZssjyFeLwBl+u1Ls/o=; b=MG/WWEwSpwpP0jJoQLMpJ9gE08SY/m7BMgK072SkKeqXaH0Kie/M+CXWjc9zDiACJS fenYX7ojAbwlaBlTDdPfWcSqtutVuZwykiIl+shb2ZBav6PnQuaPmJiNGhhXVDrbUlam /WMZcGGSUlxGV+DUv9aMZVNXTytCpZWKJYcnw= 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=n1Z5jEwyxXA//VaGTLgDL9bVzZssjyFeLwBl+u1Ls/o=; b=KLmrsCzbTFLrf3FOti2Fy+R2FYRT6gj2MPTnnX++de8CY3wtNkDXc+ddT83GfSQ8YJ VkCkRuQuYynTLJBy0WJAVO+wm+NfwVJWNCpqQ/hZj/sC1s1O9+dl9KuE6d2BHDy3qxMP 5X2C8D2SmIH/Dhvs6rbx1ai+XvQxHdy3W7nj9SfHLS1O3spaEDJOPOwvCqcyq57Xj/et A7ki5ZSa/+/kyOiyI7ffpcNUYMQseuN7W16W3zaSYSoRPHcCzbBgU0m1phwoCa5LZpdQ VKoj6wRh4oD3K/dw5XRsy96Hb5V9vuV44LQmr8CH/psBt7yUb4uxwAZOglBVciEpXE60 /cxg== X-Gm-Message-State: AJaThX4VlIxQAlzCS0SyG05ENOfiLPfWo58VtqJAGdArrcXaPTVCNWjy UhH4MDKasGZL9LbzViqO4jetvg== X-Google-Smtp-Source: AGs4zMbBmCa1zY6EqqARK2WP+tiZ0D/R0WR9ETSvrXzep/amtuV7n+4aljzyy0hfNcZScVL8pr6LeA== X-Received: by 10.80.216.74 with SMTP id v10mr45700319edj.258.1512666437174; Thu, 07 Dec 2017 09:07:17 -0800 (PST) Received: from localhost.localdomain (x50d2404e.cust.hiper.dk. [80.210.64.78]) by smtp.gmail.com with ESMTPSA id a16sm2868270edd.19.2017.12.07.09.07.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Dec 2017 09:07:16 -0800 (PST) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 23/36] KVM: arm64: Prepare to handle traps on deferred EL0 sysregs Date: Thu, 7 Dec 2017 18:06:17 +0100 Message-Id: <20171207170630.592-24-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171207170630.592-1-christoffer.dall@linaro.org> References: <20171207170630.592-1-christoffer.dall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171207_090738_691810_AEB0142E X-CRM114-Status: GOOD ( 12.26 ) 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 , Andrew Jones , Christoffer Dall , Shih-Wei Li , kvm@vger.kernel.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 We can trap access to ACTLR_EL1 which we can later defer to only save/restore during vcpu_load and vcpu_put, so let's read the value directly from the CPU when necessary. Signed-off-by: Christoffer Dall --- Notes: Changes since v1: - Fix bug in access_actlr that read the actlr_el1 and threw away the value. Whoops. arch/arm64/kvm/sys_regs_generic_v8.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kvm/sys_regs_generic_v8.c b/arch/arm64/kvm/sys_regs_generic_v8.c index 969ade1d333d..8df4b4301696 100644 --- a/arch/arm64/kvm/sys_regs_generic_v8.c +++ b/arch/arm64/kvm/sys_regs_generic_v8.c @@ -38,7 +38,10 @@ static bool access_actlr(struct kvm_vcpu *vcpu, if (p->is_write) return ignore_write(vcpu, p); - p->regval = vcpu_sys_reg(vcpu, ACTLR_EL1); + if (vcpu->arch.sysregs_loaded_on_cpu) + p->regval = read_sysreg(actlr_el1); + else + p->regval = vcpu_sys_reg(vcpu, ACTLR_EL1); return true; }