Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1739685ybg; Sat, 19 Oct 2019 01:28:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqxBXyvZbpekAI3/+b7C1t+HCb3qi4+Ew5S3Z9yHTWBN+aSahG6V2kU56QkIv89s47gi5/uB X-Received: by 2002:aa7:d316:: with SMTP id p22mr14096261edq.77.1571473689017; Sat, 19 Oct 2019 01:28:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571473689; cv=none; d=google.com; s=arc-20160816; b=WxSK5edQ/fYNCipoTLX1HMafWo0xoXbpefsMY4CsCzVEyNn+ygHSrNYi4fMt+R3A97 t2emEHZbeFQKC518ZSC8EBwgkLR+XuQJ9lkqo9Zd6WAEX5I3X8963L2ZpKD1Zvah04Aj FRg5jicQZwmK9dW7M69UPFehpne35SiaG1f+/tSbs3qFRBz10TgEv/ktgeZlge1cnovl tqXhrmTPR2uSwF0EIBxBC8RSsvdGqeuIZE5D/9kH7T3yeyFiFyiwEjgUm5Be+XMczQfK SUiERS/+K9aEHrC0c865d8DYxMJ21MGeLO6HmYZnxbsXjw6vtzdPoY8ToVuc3ZHlmmAO szXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=9ZGn96oqhuURWNSaLiMPf5pFZ37Rr7dyH5URptQ42t4=; b=1CLf+ahNx8bus+oaENz1iOlAOHKHdqfMoqG8WWcv65yOUGT/B+QfWL71Ce+wNhgT7y lCMhzUwsxNCNIKX+4TfNDR55wAdor7oMFJSi2q8E6hh1lT8rNpUpPRi6M+w3aHrmx9Fs 0n2o60mWmt1fRqIStBQDRtGqDoBvIbynVC/xBAf9bx0ANZ3ybU4ObXwSE2IwLW7ODYMT mU0L/27BIp3hOUGXCiQbySKDbOTHOHmnAmK4UrCFMqDIBErNYarS46BsYrAkALUrKacB w8uhm0amdEcKeRJSIN1HgBXfPELA0WEz7px8W91uNQqTz4jIb41aYFGLepEWfxYQo559 6F+g== 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 b19si4791019ejj.83.2019.10.19.01.27.45; Sat, 19 Oct 2019 01:28:08 -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 S2438258AbfJRNiJ (ORCPT + 99 others); Fri, 18 Oct 2019 09:38:09 -0400 Received: from [217.140.110.172] ([217.140.110.172]:39580 "EHLO foss.arm.com" rhost-flags-FAIL-FAIL-OK-OK) by vger.kernel.org with ESMTP id S2408565AbfJRNiJ (ORCPT ); Fri, 18 Oct 2019 09:38:09 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E57F6442; Fri, 18 Oct 2019 06:37:45 -0700 (PDT) Received: from arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0AA813F6C4; Fri, 18 Oct 2019 06:37:42 -0700 (PDT) Date: Fri, 18 Oct 2019 14:37:40 +0100 From: Dave Martin To: Mark Rutland Cc: Paul Elliott , Peter Zijlstra , Catalin Marinas , Will Deacon , Andrew Jones , Amit Kachhap , Vincenzo Frascino , linux-arch@vger.kernel.org, Eugene Syromiatnikov , Szabolcs Nagy , "H.J. Lu" , Yu-cheng Yu , Kees Cook , Arnd Bergmann , Jann Horn , Richard Henderson , Kristina =?utf-8?Q?Mart=C5=A1enko?= , Mark Brown , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Florian Weimer , linux-kernel@vger.kernel.org, Sudakshina Das Subject: Re: [PATCH v2 05/12] arm64: Basic Branch Target Identification support Message-ID: <20191018133739.GD27757@arm.com> References: <1570733080-21015-1-git-send-email-Dave.Martin@arm.com> <1570733080-21015-6-git-send-email-Dave.Martin@arm.com> <20191011151028.GE33537@lakrids.cambridge.arm.com> <20191011172013.GQ27757@arm.com> <20191018111003.GC27759@lakrids.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191018111003.GC27759@lakrids.cambridge.arm.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 18, 2019 at 12:10:03PM +0100, Mark Rutland wrote: > On Fri, Oct 11, 2019 at 06:20:15PM +0100, Dave Martin wrote: > > On Fri, Oct 11, 2019 at 04:10:29PM +0100, Mark Rutland wrote: > > > On Thu, Oct 10, 2019 at 07:44:33PM +0100, Dave Martin wrote: > > > > +#define arch_calc_vm_prot_bits(prot, pkey) arm64_calc_vm_prot_bits(prot) > > > > +static inline unsigned long arm64_calc_vm_prot_bits(unsigned long prot) > > > > +{ > > > > + if (system_supports_bti() && (prot & PROT_BTI)) > > > > + return VM_ARM64_BTI; > > > > + > > > > + return 0; > > > > +} > > > > > > Can we call this arch_calc_vm_prot_bits() directly, with all the > > > arguments: > > > > > > static inline unsigned long arch_calc_vm_prot_bits(unsigned long prot, > > > unsigned long pkey) > > > { > > > ... > > > } > > > #define arch_calc_vm_prot_bits arch_calc_vm_prot_bits > > > > > > ... as that makes it a bit easier to match definition with use, and just > > > definign the name makes it a bit clearer that that's probably for the > > > benefit of some ifdeffery. > > > > > > Likewise for the other functions here. > > > > > > > +#define arch_vm_get_page_prot(vm_flags) arm64_vm_get_page_prot(vm_flags) > > > > +static inline pgprot_t arm64_vm_get_page_prot(unsigned long vm_flags) > > > > +{ > > > > + return (vm_flags & VM_ARM64_BTI) ? __pgprot(PTE_GP) : __pgprot(0); > > > > +} > > > > + > > > > +#define arch_validate_prot(prot, addr) arm64_validate_prot(prot, addr) > > > > +static inline int arm64_validate_prot(unsigned long prot, unsigned long addr) > > > > Can do, though it looks like a used sparc as a template, and that has a > > sparc_ prefix. > > > > powerpc uses the generic name, as does x86 ... in its UAPI headers. > > Odd. > > > > I can change the names here, though I'm not sure it adds a lot of value. > > > > If you feel strongly I can do it. > > I'd really prefer it because it minimizes surprises, and makes it much > easier to hop around the codebase and find the thing you're looking for. OK, I've no objection in that case. I'll make the change. [...] Cheers ---Dave