From patchwork Tue Oct 3 03:10:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jintack Lim X-Patchwork-Id: 9981573 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 2685E602B8 for ; Tue, 3 Oct 2017 03:18:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 19ED92887F for ; Tue, 3 Oct 2017 03:18:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0EC4528885; Tue, 3 Oct 2017 03:18:25 +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=unavailable 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 9BF552887F for ; Tue, 3 Oct 2017 03:18:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751813AbdJCDRh (ORCPT ); Mon, 2 Oct 2017 23:17:37 -0400 Received: from mail-it0-f43.google.com ([209.85.214.43]:46906 "EHLO mail-it0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751908AbdJCDLx (ORCPT ); Mon, 2 Oct 2017 23:11:53 -0400 Received: by mail-it0-f43.google.com with SMTP id d192so9963937itd.1 for ; Mon, 02 Oct 2017 20:11:53 -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=xS0UTzPa5rAUSRFYeXyRrNnLF/7hbYHNe7PYTIOBDV4=; b=JbaGGV7mk/KLEw0fSyPR20HWiBbc5K8iEb+wT5hFDx70vhiYRxiZsFuzMmZFUBm2CQ HyTSF4rI9sD9iJqA8ZFxFHUbf1Zp74u2BjHUNCuB6UKZYgPCwdEElDF5zgNiwxKQiUl/ 8oWnzPgJHODO0rxWBvkM1C5Utny7fipW0cfA8= 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=xS0UTzPa5rAUSRFYeXyRrNnLF/7hbYHNe7PYTIOBDV4=; b=J4ez21J7l8xy8I9GCsHEBA7ZKAdO1/cTpUFGxhMcIE7ABhgH8gi/SsF6ieV1s7lUcY AWlhScZMmphGDSN1m0spNYNLuupH0S34y2IbTncRmi29vYb+RcJmuLlOPugCS8gdcTs2 BJqSx1bxDDOXuamFLeIfWaKYnuaTXZDCwNT/wFGq5+V7/TdutjLzFLiMsl2JSCeQkN7J wAuyMUfvlqjlBpDkxVXoXuLr6cIwLKDvkhcTWLu1hEVLPKicnJu/KM8CJfSCuDT0Z2WB xO+RoPymiiC/qLPdqz+1R3wIbtKjHxANJROhg1jJZ5UG0yRZZZt6k+bXaT0CUwEa4qJf lZNg== X-Gm-Message-State: AHPjjUjla3vyYlCLnAbo6XadSm6mWcLwOBdw0t6V3dBtlJ5eyMihARlm GIeHfFtiNagmieHr1KzZN8SWiQ== X-Google-Smtp-Source: AOwi7QDgcbJeOhys7JB5rg1UlzB/NOMLyzsIjVEvQuhQfoo5ZhtKMiszmHcjHULca9wKinueaROdmw== X-Received: by 10.36.61.21 with SMTP id n21mr22637144itn.121.1507000312785; Mon, 02 Oct 2017 20:11:52 -0700 (PDT) Received: from node.jintackl-qv28633.kvmarm-pg0.wisc.cloudlab.us (c220g1-031126.wisc.cloudlab.us. [128.104.222.76]) by smtp.gmail.com with ESMTPSA id h84sm5367193iod.72.2017.10.02.20.11.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Oct 2017 20:11:52 -0700 (PDT) From: Jintack Lim To: christoffer.dall@linaro.org, marc.zyngier@arm.com, kvmarm@lists.cs.columbia.edu Cc: jintack@cs.columbia.edu, pbonzini@redhat.com, rkrcmar@redhat.com, catalin.marinas@arm.com, will.deacon@arm.com, linux@armlinux.org.uk, mark.rutland@arm.com, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH v2 13/31] KVM: arm/arm64: Move kvm_is_write_fault to header file Date: Mon, 2 Oct 2017 22:10:55 -0500 Message-Id: <1507000273-3735-11-git-send-email-jintack.lim@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1507000273-3735-1-git-send-email-jintack.lim@linaro.org> References: <1507000273-3735-1-git-send-email-jintack.lim@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: Christoffer Dall Move this little function to the header files for arm/arm64 so other code can make use of it directly. Signed-off-by: Christoffer Dall --- arch/arm/include/asm/kvm_emulate.h | 8 ++++++++ arch/arm64/include/asm/kvm_emulate.h | 8 ++++++++ virt/kvm/arm/mmu.c | 8 -------- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/arch/arm/include/asm/kvm_emulate.h b/arch/arm/include/asm/kvm_emulate.h index 8136464..9b745d9 100644 --- a/arch/arm/include/asm/kvm_emulate.h +++ b/arch/arm/include/asm/kvm_emulate.h @@ -223,6 +223,14 @@ static inline u8 kvm_vcpu_trap_get_fault_type(struct kvm_vcpu *vcpu) return kvm_vcpu_get_hsr(vcpu) & HSR_FSC_TYPE; } +static inline bool kvm_is_write_fault(struct kvm_vcpu *vcpu) +{ + if (kvm_vcpu_trap_is_iabt(vcpu)) + return false; + + return kvm_vcpu_dabt_iswrite(vcpu); +} + static inline u32 kvm_vcpu_hvc_get_imm(struct kvm_vcpu *vcpu) { return kvm_vcpu_get_hsr(vcpu) & HSR_HVC_IMM_MASK; diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h index c66554b..4c47bc7 100644 --- a/arch/arm64/include/asm/kvm_emulate.h +++ b/arch/arm64/include/asm/kvm_emulate.h @@ -307,6 +307,14 @@ static inline int kvm_vcpu_sys_get_rt(struct kvm_vcpu *vcpu) return (esr & ESR_ELx_SYS64_ISS_RT_MASK) >> ESR_ELx_SYS64_ISS_RT_SHIFT; } +static inline bool kvm_is_write_fault(struct kvm_vcpu *vcpu) +{ + if (kvm_vcpu_trap_is_iabt(vcpu)) + return false; + + return kvm_vcpu_dabt_iswrite(vcpu); +} + static inline unsigned long kvm_vcpu_get_mpidr_aff(struct kvm_vcpu *vcpu) { return vcpu_sys_reg(vcpu, MPIDR_EL1) & MPIDR_HWID_BITMASK; diff --git a/virt/kvm/arm/mmu.c b/virt/kvm/arm/mmu.c index 25d3d73..74941ad 100644 --- a/virt/kvm/arm/mmu.c +++ b/virt/kvm/arm/mmu.c @@ -1141,14 +1141,6 @@ static bool transparent_hugepage_adjust(kvm_pfn_t *pfnp, phys_addr_t *ipap, return false; } -static bool kvm_is_write_fault(struct kvm_vcpu *vcpu) -{ - if (kvm_vcpu_trap_is_iabt(vcpu)) - return false; - - return kvm_vcpu_dabt_iswrite(vcpu); -} - /** * stage2_wp_ptes - write protect PMD range * @pmd: pointer to pmd entry