Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

nios2: Add CDX support

Add support for the CDX Code Density Extensions present in
Nios II R2 . This introduces new 16bit instruction set to
improve code density while retaining support for the 32bit
Nios II R2 instructions.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Ley Foon Tan <lftan@altera.com>

authored by

Marek Vasut and committed by
Ley Foon Tan
edebea98 23460839

+19 -2
+1
arch/nios2/Makefile
··· 30 30 KBUILD_CFLAGS += $(if $(CONFIG_NIOS2_HW_MULX_SUPPORT),-mhw-mulx,-mno-hw-mulx) 31 31 KBUILD_CFLAGS += $(if $(CONFIG_NIOS2_HW_DIV_SUPPORT),-mhw-div,-mno-hw-div) 32 32 KBUILD_CFLAGS += $(if $(CONFIG_NIOS2_BMX_SUPPORT),-mbmx,-mno-bmx) 33 + KBUILD_CFLAGS += $(if $(CONFIG_NIOS2_CDX_SUPPORT),-mcdx,-mno-cdx) 33 34 KBUILD_CFLAGS += $(if $(CONFIG_NIOS2_FPU_SUPPORT),-mcustom-fpu-cfg=60-1,) 34 35 35 36 KBUILD_CFLAGS += -fno-optimize-sibling-calls
+1
arch/nios2/include/asm/cpuinfo.h
··· 30 30 bool has_mul; 31 31 bool has_mulx; 32 32 bool has_bmx; 33 + bool has_cdx; 33 34 34 35 /* CPU caches */ 35 36 u32 icache_line_size;
+8 -2
arch/nios2/kernel/cpuinfo.c
··· 68 68 cpuinfo.has_mul = of_property_read_bool(cpu, "altr,has-mul"); 69 69 cpuinfo.has_mulx = of_property_read_bool(cpu, "altr,has-mulx"); 70 70 cpuinfo.has_bmx = of_property_read_bool(cpu, "altr,has-bmx"); 71 + cpuinfo.has_cdx = of_property_read_bool(cpu, "altr,has-cdx"); 71 72 cpuinfo.mmu = of_property_read_bool(cpu, "altr,has-mmu"); 72 73 73 74 if (IS_ENABLED(CONFIG_NIOS2_HW_DIV_SUPPORT) && !cpuinfo.has_div) ··· 82 81 83 82 if (IS_ENABLED(CONFIG_NIOS2_BMX_SUPPORT) && !cpuinfo.has_bmx) 84 83 err_cpu("BMX"); 84 + 85 + if (IS_ENABLED(CONFIG_NIOS2_CDX_SUPPORT) && !cpuinfo.has_cdx) 86 + err_cpu("CDX"); 85 87 86 88 cpuinfo.tlb_num_ways = fcpu(cpu, "altr,tlb-num-ways"); 87 89 if (!cpuinfo.tlb_num_ways) ··· 152 148 " MUL:\t\t%s\n" 153 149 " MULX:\t\t%s\n" 154 150 " DIV:\t\t%s\n" 155 - " BMX:\t\t%s\n", 151 + " BMX:\t\t%s\n" 152 + " CDX:\t\t%s\n", 156 153 cpuinfo.has_mul ? "yes" : "no", 157 154 cpuinfo.has_mulx ? "yes" : "no", 158 155 cpuinfo.has_div ? "yes" : "no", 159 - cpuinfo.has_bmx ? "yes" : "no"); 156 + cpuinfo.has_bmx ? "yes" : "no", 157 + cpuinfo.has_cdx ? "yes" : "no"); 160 158 161 159 seq_printf(m, 162 160 "Icache:\t\t%ukB, line length: %u\n",
+9
arch/nios2/platform/Kconfig.platform
··· 90 90 the BMX Bit Manipulation Extension instructions. Enables 91 91 the -mbmx compiler flag. 92 92 93 + config NIOS2_CDX_SUPPORT 94 + bool "Enable CDX instructions" 95 + depends on NIOS2_ARCH_REVISION = 2 96 + default n 97 + help 98 + Set to true if you configured the Nios II R2 to include 99 + the CDX Bit Manipulation Extension instructions. Enables 100 + the -mcdx compiler flag. 101 + 93 102 config NIOS2_FPU_SUPPORT 94 103 bool "Custom floating point instr support" 95 104 default n