Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp3687830pxb; Sun, 26 Sep 2021 23:47:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwTXD0SgnW/GBufMabmPvr4OF1NWLNYeenXK68QpxPfeUMs04DZlOkr3stVrmOkQagcjelb X-Received: by 2002:a63:3483:: with SMTP id b125mr15365792pga.35.1632725231266; Sun, 26 Sep 2021 23:47:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632725231; cv=none; d=google.com; s=arc-20160816; b=tGz654vFZPUoR7ma4j+eLG5CjZVpKm8ZJYf8K2VrV7OYxOFfztQSaf4nzshUo0oK2i fFElpdDFUxvivVRnZ7IIemfQxqTILVv9gJIoZs1GcT9+ZoQOx0T9c1G4IcS/5BUxgowJ u9aExc/+5Hk2XR0Ri+f9H2N64xFaBaaCpylC/U0GUfEHnsj+eABXup4ZqKKmp/mlqaCe p20ajdbsbrwSJnBVlsTCXyT4LtcttCqH1dRtBQcKyVTTuVMJvrLCdNjgIMRNiLb3WCV6 Ujx2JYL96FlWjCZVR858TmIx78memt+Ln56vyRr3Ds+ozOm++Aj/5ujRapcFLHtq01S6 CoMA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Ai8sUkrTJLMEK7DEUmx7WDpgBn+NiOpP42pR5T7FS2E=; b=B2/SyF40OMESjM/ZXZLa9sOshutEXSVFWkCSruGtiEEZj354KqbBUcmc0YEqzLrQwS 57Xhr4xhl/JxHW5O4XvTsKs7YzY9fh0eLoFJxIiZb9TbdG925yJdGlVI97pAlM649wh0 7KMpuIkR5b3AC6GAjHr3s8g59pmY0KMxzEvcFISepr8TsUV33YZVb+vxCL+fRcZjU28m zEu7v1OedZ5jUDNOBAO0X1gzExgHd587brUjIBdAPVYbBz7CdVAtbQKBeqFH+jc43WPU lywuJJgE++GKqdubbcF36+IrJ4ONZa2WnNaSZRPoeZ34kwGk5cHnBacwTRkDx6o9DyND 2eGA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w127si22268141pfc.294.2021.09.26.23.46.59; Sun, 26 Sep 2021 23:47:11 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233056AbhI0Grl (ORCPT + 99 others); Mon, 27 Sep 2021 02:47:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:39388 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232979AbhI0Grk (ORCPT ); Mon, 27 Sep 2021 02:47:40 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 73C446113D; Mon, 27 Sep 2021 06:45:59 +0000 (UTC) From: Huacai Chen To: Arnd Bergmann , Andy Lutomirski , Thomas Gleixner , Peter Zijlstra , Andrew Morton , David Airlie , Jonathan Corbet , Linus Torvalds Cc: linux-arch@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Xuefeng Li , Yanteng Si , Huacai Chen , Jiaxun Yang , Huacai Chen Subject: [PATCH V4 03/22] LoongArch: Add elf-related definitions Date: Mon, 27 Sep 2021 14:42:40 +0800 Message-Id: <20210927064300.624279-4-chenhuacai@loongson.cn> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210927064300.624279-1-chenhuacai@loongson.cn> References: <20210927064300.624279-1-chenhuacai@loongson.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add elf-related definitions for LoongArch, including: EM_LOONGARCH, KEXEC_ARCH_LOONGARCH, AUDIT_ARCH_LOONGARCH32, AUDIT_ARCH_LOONGARCH64 and NT_LOONGARCH_*. Signed-off-by: Huacai Chen --- include/uapi/linux/audit.h | 2 ++ include/uapi/linux/elf-em.h | 1 + include/uapi/linux/elf.h | 5 +++++ include/uapi/linux/kexec.h | 1 + scripts/sorttable.c | 5 +++++ 5 files changed, 14 insertions(+) diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h index daa481729e9b..e6023f00eaf9 100644 --- a/include/uapi/linux/audit.h +++ b/include/uapi/linux/audit.h @@ -434,6 +434,8 @@ enum { #define AUDIT_ARCH_UNICORE (EM_UNICORE|__AUDIT_ARCH_LE) #define AUDIT_ARCH_X86_64 (EM_X86_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) #define AUDIT_ARCH_XTENSA (EM_XTENSA) +#define AUDIT_ARCH_LOONGARCH32 (EM_LOONGARCH|__AUDIT_ARCH_LE) +#define AUDIT_ARCH_LOONGARCH64 (EM_LOONGARCH|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) #define AUDIT_PERM_EXEC 1 #define AUDIT_PERM_WRITE 2 diff --git a/include/uapi/linux/elf-em.h b/include/uapi/linux/elf-em.h index f47e853546fa..ef38c2bc5ab7 100644 --- a/include/uapi/linux/elf-em.h +++ b/include/uapi/linux/elf-em.h @@ -51,6 +51,7 @@ #define EM_RISCV 243 /* RISC-V */ #define EM_BPF 247 /* Linux BPF - in-kernel virtual machine */ #define EM_CSKY 252 /* C-SKY */ +#define EM_LOONGARCH 258 /* LoongArch */ #define EM_FRV 0x5441 /* Fujitsu FR-V */ /* diff --git a/include/uapi/linux/elf.h b/include/uapi/linux/elf.h index 61bf4774b8f2..c788dd648226 100644 --- a/include/uapi/linux/elf.h +++ b/include/uapi/linux/elf.h @@ -432,6 +432,11 @@ typedef struct elf64_shdr { #define NT_MIPS_DSP 0x800 /* MIPS DSP ASE registers */ #define NT_MIPS_FP_MODE 0x801 /* MIPS floating-point mode */ #define NT_MIPS_MSA 0x802 /* MIPS SIMD registers */ +#define NT_LOONGARCH_CPUCFG 0xa00 /* LoongArch CPU config registers */ +#define NT_LOONGARCH_CSR 0xa01 /* LoongArch control and status registers */ +#define NT_LOONGARCH_LSX 0xa02 /* LoongArch Loongson SIMD Extension registers */ +#define NT_LOONGARCH_LASX 0xa03 /* LoongArch Loongson Advanced SIMD Extension registers */ +#define NT_LOONGARCH_LBT 0xa04 /* LoongArch Loongson Binary Translation registers */ /* Note types with note name "GNU" */ #define NT_GNU_PROPERTY_TYPE_0 5 diff --git a/include/uapi/linux/kexec.h b/include/uapi/linux/kexec.h index 778dc191c265..5ef2df004565 100644 --- a/include/uapi/linux/kexec.h +++ b/include/uapi/linux/kexec.h @@ -43,6 +43,7 @@ #define KEXEC_ARCH_MIPS ( 8 << 16) #define KEXEC_ARCH_AARCH64 (183 << 16) #define KEXEC_ARCH_RISCV (243 << 16) +#define KEXEC_ARCH_LOONGARCH (258 << 16) /* The artificial cap on the number of segments passed to kexec_load. */ #define KEXEC_SEGMENT_MAX 16 diff --git a/scripts/sorttable.c b/scripts/sorttable.c index 6ee4fa882919..426e98bee364 100644 --- a/scripts/sorttable.c +++ b/scripts/sorttable.c @@ -58,6 +58,10 @@ #define EM_RISCV 243 #endif +#ifndef EM_LOONGARCH +#define EM_LOONGARCH 258 +#endif + static uint32_t (*r)(const uint32_t *); static uint16_t (*r2)(const uint16_t *); static uint64_t (*r8)(const uint64_t *); @@ -351,6 +355,7 @@ static int do_file(char const *const fname, void *addr) case EM_ARCOMPACT: case EM_ARCV2: case EM_ARM: + case EM_LOONGARCH: case EM_MICROBLAZE: case EM_MIPS: case EM_RISCV: -- 2.27.0