Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3403185pxb; Mon, 9 Nov 2020 10:12:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJx8cZ/KKXT2PytwOTSM4KGdL91PJxu/TszPBywvh3w2+Ocpl9ZWvOUTCcPLPxlO+8I5k2KP X-Received: by 2002:a50:9319:: with SMTP id m25mr17001304eda.297.1604945542042; Mon, 09 Nov 2020 10:12:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604945542; cv=none; d=google.com; s=arc-20160816; b=vK642kJC2VaoIVMAQYZzPbwTTmo4IUJoZwt7WJwqSpAg0/0anxwb2NfT8THVWbImeZ RHmaNJxayBGSAf24DYCKuzR8m2Q/xUvFTI7RlbOFZn8wrfNcTrb2/H2d2rYc29Cq8uI+ pQ1/2RIzu4LPIT9kxXOowEfCMiCBcNAIgDunCexkhdNs1ImDrTOFNuHMzR2mle7U6+OB 5CHYuNjJoLePaxvbl7RZgZD2SCXLldIeDtMWzTmcl2usZRTaltkGfYtE2pdog5JAR3Mx QicbKag+gPIhco5nsQd0RY3I8uVYLeCPfd8kWH5Qf3ey0naFXJI/dS7C8Knqv6o4gGQb PeTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:user-agent:references:in-reply-to :subject:cc:to:from:date:content-transfer-encoding:mime-version :dkim-signature; bh=Nxf9SNlHR3GPvYXHXtPsr2x+RUrOliTSQTBFjqoSgLM=; b=nwgCmRevmYiyTLmQMftXf/nnMcPuPK0x0HOXadXpgU8dRDkqx8AK4AMERGLwx8OW6L 65uL6PtozNzY5SWJ4QmjEiWdFC2vqLGPf1vNGiPgCGxrz9X2U8CO3VgprBzfmE+rqF41 5vdt2uNhyDqZcB0IuRZkEyvMV/WMit7tn34my3HpoI79zlDSCWaRltna6HHOLTRy0xsD 3kA7OMrnKTDYSeXxFuWlqih91yKXsdcWQBXHLFnlqSRDctPmYzejNIoCORsscZ+S1CEG RRPUkc+b+tWa91/CtzkI0FKaTjMx8GgMsuAwwTgpfwdL/3U5lt99F9ujnWyX3cTaYFNc K48Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KUtZu1Rn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d3si7160333ejc.49.2020.11.09.10.11.59; Mon, 09 Nov 2020 10:12:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KUtZu1Rn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729451AbgKISKJ (ORCPT + 99 others); Mon, 9 Nov 2020 13:10:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:50202 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729243AbgKISKI (ORCPT ); Mon, 9 Nov 2020 13:10:08 -0500 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E735F20678; Mon, 9 Nov 2020 18:10:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604945408; bh=nYCGURReaUreeGBHrXbl9iNHp3A/C4AwY6eb8qAExsQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=KUtZu1RnUQqSxMBLI3fAWGVI5lMwBSpHUy5touvUvB0NURtA38bMOPugtz9BGhOQy vb35Fbvo9bPZjR3ZxgiiFfPdpk/Rha9GnYZk8knuTKFTryuOAjbfrxWFBSytOqzZZC sXJIhflIuW0amm+u+oHEvdGvGrD89NPunTQZb7cY= Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94) (envelope-from ) id 1kcBcD-009BeV-RM; Mon, 09 Nov 2020 18:10:05 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 09 Nov 2020 18:10:05 +0000 From: Marc Zyngier To: Quentin Perret Cc: David Brazdil , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, James Morse , Julien Thierry , Suzuki K Poulose , Catalin Marinas , Will Deacon , Dennis Zhou , Tejun Heo , Christoph Lameter , Mark Rutland , Lorenzo Pieralisi , Andrew Scull , Andrew Walbran , kernel-team@android.com Subject: Re: [PATCH v1 17/24] kvm: arm64: Add __hyp_pa_symbol helper macro In-Reply-To: <20201109165933.GA447754@google.com> References: <20201109113233.9012-1-dbrazdil@google.com> <20201109113233.9012-18-dbrazdil@google.com> <20201109165933.GA447754@google.com> User-Agent: Roundcube Webmail/1.4.9 Message-ID: <1951645a457232caeca323bec2af5408@kernel.org> X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: qperret@google.com, dbrazdil@google.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, will@kernel.org, dennis@kernel.org, tj@kernel.org, cl@linux.com, mark.rutland@arm.com, lorenzo.pieralisi@arm.com, ascull@google.com, qwandor@google.com, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-11-09 16:59, Quentin Perret wrote: > Hey David, > > On Monday 09 Nov 2020 at 11:32:26 (+0000), David Brazdil wrote: >> Add helper macro for computing the PA of a kernel symbol in nVHE hyp >> code. This will be useful for computing the PA of a PSCI CPU_ON entry >> point. >> >> Signed-off-by: David Brazdil >> --- >> arch/arm64/kvm/hyp/nvhe/psci.c | 10 ++++++++++ >> 1 file changed, 10 insertions(+) >> >> diff --git a/arch/arm64/kvm/hyp/nvhe/psci.c >> b/arch/arm64/kvm/hyp/nvhe/psci.c >> index b0b5df590ba5..7510b9e174e9 100644 >> --- a/arch/arm64/kvm/hyp/nvhe/psci.c >> +++ b/arch/arm64/kvm/hyp/nvhe/psci.c >> @@ -20,6 +20,16 @@ s64 hyp_physvirt_offset; >> >> #define __hyp_pa(x) ((phys_addr_t)((x)) + hyp_physvirt_offset) >> >> +#define __hyp_pa_symbol(sym) \ >> + ({ \ >> + extern char sym[]; \ >> + unsigned long kern_va; \ >> + \ >> + asm volatile("ldr %0, =%1" : "=r" (kern_va) \ >> + : "S" (sym)); \ >> + kern_va - kimage_voffset; \ >> + }) >> + > > Could this be simplified to __hyp_pa(hyp_symbol_addr(sym))? That would > avoid the dependency on kimage_voffset. I'm going to move away from evaluating kimage_voffset at runtime anyway, see [1]. Thanks, M. [1] https://lore.kernel.org/r/20201109175923.445945-1-maz@kernel.org -- Jazz is not dead. It just smells funny...