Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759578AbbGHQWV (ORCPT ); Wed, 8 Jul 2015 12:22:21 -0400 Received: from foss.arm.com ([217.140.101.70]:42154 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758914AbbGHQTh (ORCPT ); Wed, 8 Jul 2015 12:19:37 -0400 From: Marc Zyngier To: Catalin Marinas , Will Deacon , Christoffer Dall Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu Subject: [PATCH 06/13] arm64: KVM: VHE: Patch out kern_hyp_va Date: Wed, 8 Jul 2015 17:19:09 +0100 Message-Id: <1436372356-30410-7-git-send-email-marc.zyngier@arm.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1436372356-30410-1-git-send-email-marc.zyngier@arm.com> References: <1436372356-30410-1-git-send-email-marc.zyngier@arm.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1450 Lines: 53 The kern_hyp_va macro is pretty meaninless with VHE, as there is only one mapping - the kernel one. In order to keep the code readable and efficient, use runtime patching to replace the 'and' instruction used to compute the VA with a 'nop'. Signed-off-by: Marc Zyngier --- arch/arm64/include/asm/kvm_mmu.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/kvm_mmu.h b/arch/arm64/include/asm/kvm_mmu.h index b525cd2..285642e 100644 --- a/arch/arm64/include/asm/kvm_mmu.h +++ b/arch/arm64/include/asm/kvm_mmu.h @@ -55,6 +55,8 @@ #ifdef __ASSEMBLY__ +#include +#include #include .macro setup_vtcr tmp1, tmp2 @@ -69,12 +71,18 @@ msr vtcr_el2, \tmp1 isb .endm + +/* Stupid macro to deal with multiple level of macro expansion */ +.macro __vhe_nop inst val + alternative_insn "\inst\val", "nop", ARM64_HAS_VIRT_HOST_EXTN +.endm + /* * Convert a kernel VA into a HYP VA. * reg: VA to be converted. */ .macro kern_hyp_va reg - and \reg, \reg, #HYP_PAGE_OFFSET_MASK + __vhe_nop "and \reg, \reg, #", __stringify(HYP_PAGE_OFFSET_MASK) .endm #else -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/