Received: by 10.223.185.116 with SMTP id b49csp3978715wrg; Mon, 26 Feb 2018 09:08:41 -0800 (PST) X-Google-Smtp-Source: AH8x224O6C79sCUaYHUkKBSVctdaP/7b4KvL7vUUMHVuTEg+RSlPzvpfFHhbyCs3GP6/XOPf++4Q X-Received: by 10.101.69.134 with SMTP id o6mr9160985pgq.340.1519664921641; Mon, 26 Feb 2018 09:08:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519664921; cv=none; d=google.com; s=arc-20160816; b=JqTmcFhuZjBDqCarsxfnwoIkR3PJtL6CEi4Xbg1TPGR+wLrPyN11crvra09skAeggH pKhvWsdkSkHWYe1YdscXuvX9yBU4tappxacq4D9faWeha9rrXwoLLeUFmaVwTp8AOLSO JP9NANtOrUJCDiL8vo3LTqw62caBh5TK6PZscw3zOiiOZEZZhU3f3/lsgPOMCmpAFMPr mgpwILRpofwdp8YG5YPXYad9bWgVIZE/M72rv84UdpGCM7xYzrihHkn+acohmG0DjoWF FI3fFOqzpwVE+8lHScHBHyZH23QCTFTTvbmRILoFiKwzhePsgiCc5SEksKTqJ+LYx3yM Uf+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=uVTVvDlSSq0H8fVdZAqe7nU+fkxDqdQpoEQYB2TwJsQ=; b=igTvWCxPiX4c9mxVJeuu/4bAPbZaSgRqt65UVAG/wVazX2FjO/cptP4BzzZAHIebRU 7tNuKDiipob1QZvzK7aJvaGgOsVQI8yVMLjIJ2+RMZPv4+TZHsziY9lcMkMK2Setvz4V hnjSU0u7Xn320QxtwvvQFC9k/VNonet9YKqy0WPBns2F3pj1kkLnZxR0fvRT9k/ArCoK UawCaMmc524KTGOWDODjtNchOqzhjQkyiZza7DiG8Lsa7Jsp9TXr0Nyfm6pR7YnhIW5d LVDaLR60JWrTRCWonK6zvQCQQ8142fy2AizUG/UfWQc5cFkYMeDxCclcNMJ5+d8WFgk5 +puw== 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 t137si5720394pgb.808.2018.02.26.09.08.06; Mon, 26 Feb 2018 09:08:41 -0800 (PST) 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 S1751798AbeBZRGi (ORCPT + 99 others); Mon, 26 Feb 2018 12:06:38 -0500 Received: from 9pmail.ess.barracuda.com ([64.235.150.225]:51878 "EHLO 9pmail.ess.barracuda.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751724AbeBZRG1 (ORCPT ); Mon, 26 Feb 2018 12:06:27 -0500 Received: from MIPSMAIL01.mipstec.com (mailrelay.mips.com [12.201.5.28]) by mx29.ess.sfj.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NO); Mon, 26 Feb 2018 17:06:21 +0000 Received: from mredfearn-linux.mipstec.com (192.168.155.41) by MIPSMAIL01.mipstec.com (10.20.43.31) with Microsoft SMTP Server (TLS) id 14.3.361.1; Mon, 26 Feb 2018 09:03:01 -0800 From: Matt Redfearn To: James Hogan , Ralf Baechle CC: , Paul Burton , "Matt Redfearn" , Subject: [PATCH 1/4] MIPS: Introduce isa-rev.h to define MIPS_ISA_REV Date: Mon, 26 Feb 2018 17:02:42 +0000 Message-ID: <1519664565-10955-2-git-send-email-matt.redfearn@mips.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519664565-10955-1-git-send-email-matt.redfearn@mips.com> References: <1519664565-10955-1-git-send-email-matt.redfearn@mips.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [192.168.155.41] X-BESS-ID: 1519664779-637139-10615-123154-11 X-BESS-VER: 2018.2-r1802232356 X-BESS-Apparent-Source-IP: 12.201.5.28 X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.190443 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS59374 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are multiple instances in the kernel where we need to include or exclude particular instructions based on the ISA revision of the target processor. For MIPS32 / MIPS64, the compiler exports a __mips_isa_rev define. However, when targeting MIPS I - V, this define is absent. This leads to each use of __mips_isa_rev having to check that it is defined first. To simplify this, introduce the isa-rev.h header which always exports MIPS_ISA_REV. The name is changed so as to avoid confusion with the compiler builtin and to avoid accidentally using the builtin. MIPS_ISA_REV is defined to the compilers builtin if provided, or 0, which satisfies all current usages. Suggested-by: Paul Burton Signed-off-by: Matt Redfearn --- arch/mips/include/asm/isa-rev.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 arch/mips/include/asm/isa-rev.h diff --git a/arch/mips/include/asm/isa-rev.h b/arch/mips/include/asm/isa-rev.h new file mode 100644 index 000000000000..683ea3454dcb --- /dev/null +++ b/arch/mips/include/asm/isa-rev.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2018 MIPS Tech, LLC + * Author: Matt Redfearn + */ + +#ifndef __MIPS_ASM_ISA_REV_H__ +#define __MIPS_ASM_ISA_REV_H__ + +/* + * The ISA revision level. This is 0 for MIPS I to V and N for + * MIPS{32,64}rN. + */ + +/* If the compiler has defined __mips_isa_rev, believe it. */ +#ifdef __mips_isa_rev +#define MIPS_ISA_REV __mips_isa_rev +#else +/* The compiler hasn't defined the isa rev so assume it's MIPS I - V (0) */ +#define MIPS_ISA_REV 0 +#endif + + +#endif /* __MIPS_ASM_ISA_REV_H__ */ -- 2.7.4