Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp864770yba; Mon, 1 Apr 2019 19:28:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqzvzZW4QSTv+w11NWmq91iwS3MwtSEfXA6hxHLDwxI+r97pUZZ2o4YHJzEacRVNGiqIqG5c X-Received: by 2002:a17:902:3f83:: with SMTP id a3mr64477386pld.6.1554172132011; Mon, 01 Apr 2019 19:28:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554172132; cv=none; d=google.com; s=arc-20160816; b=CbzUAq7HHYktPRxdNnec/Or0YzpawLZLjaZfnFgOUlP93QhTSCv3lu+x9TMslrhcTu 3qHmTSMQACiPC+znM2al/uxjk06tB5XkZVQMxDLtbUIguolBMR3KNvmCmhhbyGdDRsLr sYQrUymCkRLptGZ9Ccs6qmZHpIwVCsuObMgafH5+4A72mQ0jMM80s3XFiJMIriqbM82F gmi0511el0ny7dvHZ5rxjsD9UdklAtsEF0YuSqJ7pYBuFeft9KtvhMab+p/62p1OqcV5 veenpYzRMin2VyO+DZtSPHMJ1FnTvSHcDTQhHnbP6Z01ZEhqtw6HH9yerJ47mfYVpsa4 sCVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=wxcAiwo4wJqy1oHzLtguIA187Nat/P8LFTUOA41dk7A=; b=fbAJ8B/5+FT5scBQ/W5RaINb1FxDwhY1raz41IXImDuH3s3Lx1nHnF5wOdxAZxWudw FuhBxsUigNoRWdyWwVH2TrHMF086TKx+MhCdkMOAeeCIaEZrEQL9Ff/4c58pAZ0tlXIG ckrZY0Tuchzf9WXKnsl4c3Pa1aO2JQ2h/8oPYu5KqNy44WP5iKulE4DLgCLP6pd2thKH TUyBbPUuzyT8WlcjBmbWdTDX4q6Of5Sb8WdSj9hgbVbaVg8n+rmWAOs5aVa7x88so+e+ Q378UUZ0yCPcn7MP2Z2votNs9Fmnr5SwzieLhRh91MO0pOiCZjH5w8WHrPLNepu9kvEx dZ5A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 82si10117721pft.35.2019.04.01.19.28.36; Mon, 01 Apr 2019 19:28:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728856AbfDBC1v (ORCPT + 99 others); Mon, 1 Apr 2019 22:27:51 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:43524 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726269AbfDBC1u (ORCPT ); Mon, 1 Apr 2019 22:27:50 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2344E80D; Mon, 1 Apr 2019 19:27:50 -0700 (PDT) Received: from a075553-lin.blr.arm.com (a075553-lin.blr.arm.com [10.162.0.144]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 6790B3F59C; Mon, 1 Apr 2019 19:27:45 -0700 (PDT) From: Amit Daniel Kachhap To: linux-arm-kernel@lists.infradead.org Cc: Christoffer Dall , Marc Zyngier , Catalin Marinas , Will Deacon , Andrew Jones , Dave Martin , Ramana Radhakrishnan , kvmarm@lists.cs.columbia.edu, Kristina Martsenko , linux-kernel@vger.kernel.org, Amit Daniel Kachhap , Mark Rutland , James Morse , Julien Thierry Subject: [PATCH v8 3/9] KVM: arm64: Move hyp_symbol_addr to fix dependency Date: Tue, 2 Apr 2019 07:57:11 +0530 Message-Id: <1554172037-4516-4-git-send-email-amit.kachhap@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1554172037-4516-1-git-send-email-amit.kachhap@arm.com> References: <1554172037-4516-1-git-send-email-amit.kachhap@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently hyp_symbol_addr is placed in kvm_mmu.h which is mostly used by __hyp_this_cpu_ptr in kvm_asm.h but it cannot include kvm_mmu.h directly as kvm_mmu.h uses kvm_ksym_ref which is defined inside kvm_asm.h. Hence, hyp_symbol_addr is moved inside kvm_asm.h to fix this dependency on each other. Also, hyp_symbol_addr corresponding counterpart, kvm_ksym_ref, is already in kvm_asm.h, making it more sensible to move kvm_symbol_addr to the same file. Suggested by: James Morse Signed-off-by: Amit Daniel Kachhap Reviewed-by: Julien Thierry Cc: Marc Zyngier Cc: Christoffer Dall Cc: kvmarm@lists.cs.columbia.edu --- Changes since v7: * Slight change in commit message [Julien Thierry]. arch/arm64/include/asm/kvm_asm.h | 20 ++++++++++++++++++++ arch/arm64/include/asm/kvm_mmu.h | 20 -------------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/arch/arm64/include/asm/kvm_asm.h b/arch/arm64/include/asm/kvm_asm.h index f5b79e9..57a07e8 100644 --- a/arch/arm64/include/asm/kvm_asm.h +++ b/arch/arm64/include/asm/kvm_asm.h @@ -80,6 +80,26 @@ extern void __vgic_v3_init_lrs(void); extern u32 __kvm_get_mdcr_el2(void); +/* + * Obtain the PC-relative address of a kernel symbol + * s: symbol + * + * The goal of this macro is to return a symbol's address based on a + * PC-relative computation, as opposed to a loading the VA from a + * constant pool or something similar. This works well for HYP, as an + * absolute VA is guaranteed to be wrong. Only use this if trying to + * obtain the address of a symbol (i.e. not something you obtained by + * following a pointer). + */ +#define hyp_symbol_addr(s) \ + ({ \ + typeof(s) *addr; \ + asm("adrp %0, %1\n" \ + "add %0, %0, :lo12:%1\n" \ + : "=r" (addr) : "S" (&s)); \ + addr; \ + }) + /* Home-grown __this_cpu_{ptr,read} variants that always work at HYP */ #define __hyp_this_cpu_ptr(sym) \ ({ \ diff --git a/arch/arm64/include/asm/kvm_mmu.h b/arch/arm64/include/asm/kvm_mmu.h index b0742a1..3dea6af 100644 --- a/arch/arm64/include/asm/kvm_mmu.h +++ b/arch/arm64/include/asm/kvm_mmu.h @@ -118,26 +118,6 @@ static inline unsigned long __kern_hyp_va(unsigned long v) #define kern_hyp_va(v) ((typeof(v))(__kern_hyp_va((unsigned long)(v)))) /* - * Obtain the PC-relative address of a kernel symbol - * s: symbol - * - * The goal of this macro is to return a symbol's address based on a - * PC-relative computation, as opposed to a loading the VA from a - * constant pool or something similar. This works well for HYP, as an - * absolute VA is guaranteed to be wrong. Only use this if trying to - * obtain the address of a symbol (i.e. not something you obtained by - * following a pointer). - */ -#define hyp_symbol_addr(s) \ - ({ \ - typeof(s) *addr; \ - asm("adrp %0, %1\n" \ - "add %0, %0, :lo12:%1\n" \ - : "=r" (addr) : "S" (&s)); \ - addr; \ - }) - -/* * We currently support using a VM-specified IPA size. For backward * compatibility, the default IPA size is fixed to 40bits. */ -- 2.7.4