Received: by 2002:a05:6520:4211:b029:f4:110d:56bc with SMTP id o17csp2103606lkv; Thu, 20 May 2021 03:29:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxWe+ZhlSKRBSBpv20yylbKKMdbS4HgpQvx4MwRuznR7lcbADk2su7BAdSaLQH/fzCVgsl X-Received: by 2002:a02:caa9:: with SMTP id e9mr4940288jap.87.1621506585151; Thu, 20 May 2021 03:29:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621506585; cv=none; d=google.com; s=arc-20160816; b=yXcsxDmAHDNDMIjzrPMD4HQNoylFLBZsxbpXhpOLiEbcFlyhCAhx1VQUnecEaG/yWQ k6QeLiNHbNA1/TY5rnEPMSK7M80cGrc551DOv0o+oaIMOOG3X+4qRNOBsLUVQe6PiFmk ZdXqMQuyoJ3b0He/Fl6ngKfOskpMpyFK/sYCz3unm5Bf5vX8DET7DHPZaE5SdJDN/KcO ojbhcbQILnzTkNX65qA22kxu9DeGSHPkhmNWcOloS0CdinGAKfHl5d9uyPGY2j3ha+Vr 1oHPMz0eWYL4FwZQ5XbvGflbR11/K4Y+3eKa/Ukpz72FBEBPyGkJOZ97e0ypFbi+07Lj FjUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TAhdXrSzLeerdnJRr4f/UQvj1mCMaEFYLjbZs2X6olo=; b=fkk2PtUp8DPKAfxHuQ+Mv8DMQHZEWlN/6P0QHNN+3ytISCivqovnkeW53h5W5u6Cvl wohVDhg0AOytEaAJyPGDEo40FOljYCl2v5pJrJ8EuZR3PgfE0WGRDfZsbT+Cb/vmxWOd xLn6WSlLhQXjDB5iAA2rofVQh0l3RiUxiHTo9uMPGGEFhgK/pGOURW/PjxdAeWP3Kirm /vfeboJMq4k+9ffFV62dF/RoM7j9WuI3XC/6uJL1ZpIqYbIjD981C7Mrvh/oXSIsLb8x FJKOvFKdFe5+AKhIqibn8fkV81cTuv14vv/WY5yCrxRQDd7SUKnQluIctkMxjEqEowUI Su7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=s+EG5tKX; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g5si2220431ilq.106.2021.05.20.03.29.08; Thu, 20 May 2021 03:29:45 -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=@linuxfoundation.org header.s=korg header.b=s+EG5tKX; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236848AbhETK2i (ORCPT + 99 others); Thu, 20 May 2021 06:28:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:48106 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236504AbhETKP1 (ORCPT ); Thu, 20 May 2021 06:15:27 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D154361995; Thu, 20 May 2021 09:45:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621503941; bh=nuChM8ImR0ujZjXzXBnAdo3YIb+qGGAUz7THygdCtGc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s+EG5tKXdvXFdz/clV89B4WeICHatrm+gAr1/U6BUxEEgIz2VU1083cLPgg6ofgRE qE3QEsV16Xx1mBQrc+IC7dW0be+esBCuuyKdbOpRWBGfBrvzQ/ZDiXFLyKyLenVQUL 8o/ncxJKwwrEAYODH5LpMklTutAOkwhmoCVezhyw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Burton , Matt Redfearn , "Maciej W. Rozycki" , Ralf Baechle , linux-mips@linux-mips.org, James Hogan , Sudip Mukherjee Subject: [PATCH 4.14 008/323] MIPS: Introduce isa-rev.h to define MIPS_ISA_REV Date: Thu, 20 May 2021 11:18:20 +0200 Message-Id: <20210520092120.407563202@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092120.115153432@linuxfoundation.org> References: <20210520092120.115153432@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Matt Redfearn commit 1690905240fd45cc04e873312df8574631c9f595 upstream 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 Reviewed-by: Maciej W. Rozycki Cc: Ralf Baechle Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/18676/ Signed-off-by: James Hogan Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- arch/mips/include/asm/isa-rev.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 arch/mips/include/asm/isa-rev.h --- /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__ */