Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp1160740img; Tue, 19 Mar 2019 01:32:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqzhHUeSSTw1/PQMO7CosW9KtkSrEGnnvkC2KrTKraehga5XjzDA3fxkdtAFJ5LFhYgYGOOL X-Received: by 2002:a63:cd13:: with SMTP id i19mr1136182pgg.317.1552984348182; Tue, 19 Mar 2019 01:32:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552984348; cv=none; d=google.com; s=arc-20160816; b=e/8BQX55/iSJ6p3zpKYIke/ok/Z0986WdjiCNqD2qICAUT5UYkwLmLA/jM8vlPaWg3 BhhD0GYzph+iWgJFO5vhIqgFhf3C0rz0EbeSl5AZv0F9G/TRPz9O7fwkF+JEffcVSlF5 /HmBVqJTKZA8Sla/ZLfhXl5xtXDDoi9e1pHGgqIC4PZBT60sXx48C0Ea4SgWstFkGMmw Wq3yk7Ya0pRj3Q/1TMHe9bkHVoY6rR7LgvZQ/0oZtGRUMgGfN+VSnW2cO0pabk1BeRsT V1oknUdhYDzb7V1abbMJLeq3l4IuEguUs4ur8L2ea4rtR2UHe247wol5IF7zYUn6Zx9D W2sg== 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=rgqMdOVj5VZTPBKeqIAqZ/fYuobxh9WeoXShJgPl+vg=; b=PBMu/b+Z0gg5B/qKHuMb1eVA6I4lRUcusigdfyAIJlUrnvrih7RaLZjvnMz4fHfuVI w9eZfeICzzT9ZNHrOxS8HHBZa3zu6ZmBLw8Ue5+cK3SLMhVFG82TRdyY12xZd9X9hc2J REApMgxxcOcyd9j1KXe7LV/2z1Ue4MY869wEzApFjnWVt9eGRH3wY0fEQtuy0yMK4VNe 06MQewhKc5ODlx6yRWiq4ehLsuXgThsv6PzgHAlbmUf9V2PAMkMNblVB+3s/bDHZZgzu gyYmCI20zHFPnmDoWDucDamCBF4UqlIHnD0axathmNoUd5MVFPSMjffpUACDz4lrLxXG QtmQ== 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 60si8899255plf.122.2019.03.19.01.32.12; Tue, 19 Mar 2019 01:32:28 -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 S1727560AbfCSIbZ (ORCPT + 99 others); Tue, 19 Mar 2019 04:31:25 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:46982 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725934AbfCSIbY (ORCPT ); Tue, 19 Mar 2019 04:31:24 -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 4893B1596; Tue, 19 Mar 2019 01:31:24 -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 102383F59C; Tue, 19 Mar 2019 01:31:19 -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 v7 3/10] KVM: arm64: Move hyp_symbol_addr to fix dependency Date: Tue, 19 Mar 2019 14:00:36 +0530 Message-Id: <1552984243-7689-4-git-send-email-amit.kachhap@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1552984243-7689-1-git-send-email-amit.kachhap@arm.com> References: <1552984243-7689-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 palced 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 kvm_ksym_ref is corresponding counterpart of hyp_symbol_addr so should be ideally placed inside kvm_asm.h. Suggested by: James Morse Signed-off-by: Amit Daniel Kachhap Cc: Marc Zyngier Cc: Christoffer Dall Cc: kvmarm@lists.cs.columbia.edu --- 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