Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1040084pxk; Fri, 18 Sep 2020 02:09:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJdqZa6lz+ulPe4cebDByJ1UWdF29Y3Izt9BdTd2oLe8jcKG1c2P60PbpZE+pJjQlT6vbJ X-Received: by 2002:a17:906:fb97:: with SMTP id lr23mr35554091ejb.257.1600420156030; Fri, 18 Sep 2020 02:09:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600420156; cv=none; d=google.com; s=arc-20160816; b=l06vqW3FnIZKsKOCtTRB0RldSdoZOv84DZPDRJn0p3NF4GoLYIs5nzxE8Kt5ryZZVY lXPiucrkArrcQSCuDD2aG2oIkqCOi43L0mNRACYu8PxzUypSHzsTjxUSfuqtSfJlaQmt rQwNZupMEM711T2BbnDDVHZppM2YggNEXm+YxJk6QaGnMhlsJWIW4shu9f2A8+/vARWH /VMewx2uPSBwPDpfcmytmJQmdNL9sA1WQb8Gre8XvjhM7NFlXseMtlAAck2Xzd2kfWZY SxZt7AS0gy8u7rVY7572xqR7l59tadt+Ynj+sapKKZIScaRraJLWrmelHPLY/KPMkROn jIXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=p1fUhhTTzDB6hQ4pcNyo7FSH8t2II99wHiJN8+vcw8A=; b=R+ekziZshfeJRWeOzlR7NgsOpw0VrO3pvut1ikA5dz0iSjH1ibClpW+k+PNinDSy8S OyYKxFWBX1SkEpHglfWvzDMYirPg3FoakWnxx5N3jlxHg/a63CNl1CXDZyRW1IcLoi0D DjQ28+hQGDS5Y4tS9AlCrmbrjzDnZdhGsz0Z/rALaFq9QO/shY4opl7to6NYNrTXDxU0 aqKSzI4zHhkCxiEtFOvvKfzjY6GEp0umDl9P4K1NrAKoZNLME9bAY7LXMZd1bscEmR5K s26IyGU597Fqrw4XrH6JSVMCOfmxbI7boAaKvY8kRcVrpGfn2aA74wB3+V+OntL1rT9L +UDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RW9Go77W; 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 j23si1617649edq.339.2020.09.18.02.08.53; Fri, 18 Sep 2020 02:09:16 -0700 (PDT) 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=RW9Go77W; 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 S1726174AbgIRJFk (ORCPT + 99 others); Fri, 18 Sep 2020 05:05:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:35530 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726102AbgIRJFj (ORCPT ); Fri, 18 Sep 2020 05:05:39 -0400 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (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 E677D20684; Fri, 18 Sep 2020 09:05:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600419939; bh=8bbkGB04wpb31wFP8bwL1MzqYlfmTRKDty4Y+cqJkqs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=RW9Go77Wx9GYu/FTIOjFFIKGYaoJQirk92/zZmytjdUrm67V87Lxb3ZtGXddUhikA y0b+5uBv4Qb+wfOCqKhzOzwoifzGdX575HxGkW8mgmedHIXMHX44v/XngCe+JAGMS7 UimHKWTCG8MVKk0k7OI0G4qumwIfcUNQgpQyH1uE= Date: Fri, 18 Sep 2020 10:05:33 +0100 From: Will Deacon To: David Brazdil Cc: kvmarm@lists.cs.columbia.edu, Catalin Marinas , Marc Zyngier , James Morse , Julien Thierry , Suzuki K Poulose , Dennis Zhou , Tejun Heo , Christoph Lameter , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel-team@android.com, Andrew Scull Subject: Re: [PATCH v3 05/11] kvm: arm64: Remove hyp_adr/ldr_this_cpu Message-ID: <20200918090533.GE30834@willie-the-truck> References: <20200916173439.32265-1-dbrazdil@google.com> <20200916173439.32265-6-dbrazdil@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200916173439.32265-6-dbrazdil@google.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 16, 2020 at 06:34:33PM +0100, David Brazdil wrote: > The hyp_adr/ldr_this_cpu helpers were introduced for use in hyp code > because they always needed to use TPIDR_EL2 for base, while > adr/ldr_this_cpu from kernel proper would select between TPIDR_EL2 and > _EL1 based on VHE/nVHE. > > Simplify this now that the hyp mode case can be handled using the > __KVM_VHE/NVHE_HYPERVISOR__ macros. > > Acked-by: Andrew Scull > Signed-off-by: David Brazdil > --- > arch/arm64/include/asm/assembler.h | 27 +++++++++++++++++---------- > arch/arm64/include/asm/kvm_asm.h | 14 +------------- > arch/arm64/kvm/hyp/hyp-entry.S | 2 +- > 3 files changed, 19 insertions(+), 24 deletions(-) > > diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h > index 54d181177656..f79231a0f949 100644 > --- a/arch/arm64/include/asm/assembler.h > +++ b/arch/arm64/include/asm/assembler.h > @@ -218,6 +218,21 @@ lr .req x30 // link register > str \src, [\tmp, :lo12:\sym] > .endm > > + /* > + * @dst: destination register (32 or 64 bit wide) > + */ > + .macro this_cpu_offset, dst > +#if defined(__KVM_NVHE_HYPERVISOR__) || defined(__KVM_VHE_HYPERVISOR__) > + mrs \dst, tpidr_el2 > +#else > +alternative_if_not ARM64_HAS_VIRT_HOST_EXTN > + mrs \dst, tpidr_el1 > +alternative_else > + mrs \dst, tpidr_el2 > +alternative_endif > +#endif Cosmetic, but I think it would be cleaner just to define two variants of the macro here: #if defined(__KVM_NVHE_HYPERVISOR__) || defined(__KVM_VHE_HYPERVISOR__) .macro this_cpu_offset, dst mrs \dst, tpidr_el2 .endm #else .macro this_cpu_offset, dst alternative_if_not ARM64_HAS_VIRT_HOST_EXTN mrs \dst, tpidr_el1 alternative_else mrs \dst, tpidr_el2 alternative_endif .endm #endif (and should we have a shorthand __HYPERVISOR define to avoid the NVHE || VHE logic?) With that: Acked-by: Will Deacon Will