[OpenWrt-Devel] [PATCH] MIPS64: add support for MIPS64R6

Yousong Zhou yszhou4tech at gmail.com
Fri Feb 22 01:29:49 EST 2019


On Fri, 22 Feb 2019 at 12:05, zh h <hua.zhang1974 at hotmail.com> wrote:
>
> From: Hua Zhang <hua.zhang1974 at hotmail.com>
>
> 1. add support for MIPS64R6 in target.mk
> 2. add support for MIPS64R6 in target malta
> 3. add support for MIPS64R6 in gcc configuration
>
> Signed-off-by: Hua Zhang <hua.zhang1974 at hotmail.com>

I just checked the code and it looks like the malta mips64 subtargets
are on their own with no other targets sharing the same cpu type.

Virtual targets are mainly for development purposes and as such they
should not exist on its own.  Do you plan to add new target support
into OpenWrt that also uses mips64r6 cpu type?

We can consider just converting existing malta 64 subtargets into
using mips64r6 arch.

                yousong

> ---
>  include/target.mk                        |  1 +
>  target/linux/malta/Makefile              |  2 +-
>  target/linux/malta/README                |  6 ++++
>  target/linux/malta/be64r6/config-default | 38 ++++++++++++++++++++++++
>  target/linux/malta/be64r6/target.mk      | 10 +++++++
>  target/linux/malta/le64r6/config-default | 38 ++++++++++++++++++++++++
>  target/linux/malta/le64r6/target.mk      | 10 +++++++
>  toolchain/gcc/common.mk                  | 10 +++++--
>  8 files changed, 112 insertions(+), 3 deletions(-)
>  create mode 100644 target/linux/malta/be64r6/config-default
>  create mode 100644 target/linux/malta/be64r6/target.mk
>  create mode 100644 target/linux/malta/le64r6/config-default
>  create mode 100644 target/linux/malta/le64r6/target.mk
>
> diff --git a/include/target.mk b/include/target.mk
> index 1d6888fde3..181aba9b3a 100644
> --- a/include/target.mk
> +++ b/include/target.mk
> @@ -174,6 +174,7 @@ ifeq ($(DUMP),1)
>      CPU_CFLAGS_mips64 = -mips64 -mtune=mips64 -mabi=64
>      CPU_CFLAGS_24kc = -mips32r2 -mtune=24kc
>      CPU_CFLAGS_74kc = -mips32r2 -mtune=74kc
> +    CPU_CFLAGS_mips64r6 = -mips64r6 -mtune=mips64r6 -mabi=64
>      CPU_CFLAGS_octeonplus = -march=octeon+ -mabi=64
>    endif
>    ifeq ($(ARCH),i386)
> diff --git a/target/linux/malta/Makefile b/target/linux/malta/Makefile
> index c71f34d109..5e1e745ba5 100644
> --- a/target/linux/malta/Makefile
> +++ b/target/linux/malta/Makefile
> @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
>  BOARD:=malta
>  BOARDNAME:=MIPS Malta CoreLV board (qemu)
>  CPU_TYPE:=24kc
> -SUBTARGETS:=le be le64 be64
> +SUBTARGETS:=le be le64 be64 le64r6 be64r6
>  INITRAMFS_EXTRA_FILES:=
>  MAINTAINER:=Florian Fainelli <florian at openwrt.org>
>  FEATURES:=ramdisk
> diff --git a/target/linux/malta/README b/target/linux/malta/README
> index 0bb1a1e35a..f631007fcb 100644
> --- a/target/linux/malta/README
> +++ b/target/linux/malta/README
> @@ -16,4 +16,10 @@ qemu-system-mips64el -kernel bin/targets/malta/le64/openwrt-malta-le64-vmlinux-i
>  For the 64 bit big-endian image:
>  qemu-system-mips64 -kernel bin/targets/malta/be64/openwrt-malta-be64-vmlinux-initramfs.elf -nographic -m 256
>
> +For the 64 bit r6 little-endian image:
> +qemu-system-mips64el -cpu I6400-kernel bin/targets/malta/le64r6/openwrt-malta-le64r6-vmlinux-initramfs.elf -nographic -m 256
> +
> +For the 64 bit r6 big-endian image:
> +qemu-system-mips64 -cpu I6400 -kernel bin/targets/malta/be64r6/openwrt-malta-be64r6-vmlinux-initramfs.elf -nographic -m 256
> +
>  and enjoy the system bootin.
> diff --git a/target/linux/malta/be64r6/config-default b/target/linux/malta/be64r6/config-default
> new file mode 100644
> index 0000000000..3097d15cbf
> --- /dev/null
> +++ b/target/linux/malta/be64r6/config-default
> @@ -0,0 +1,38 @@
> +# CONFIG_32BIT is not set
> +CONFIG_64BIT=y
> +CONFIG_ARCH_DMA_ADDR_T_64BIT=y
> +CONFIG_ARCH_MMAP_RND_BITS=12
> +CONFIG_ARCH_MMAP_RND_BITS_MAX=18
> +CONFIG_ARCH_MMAP_RND_BITS_MIN=12
> +CONFIG_ARCH_MMAP_RND_COMPAT_BITS=8
> +CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y
> +CONFIG_ARCH_WANT_COMPAT_IPC_PARSE_VERSION=y
> +CONFIG_ARCH_WANT_OLD_COMPAT_IPC=y
> +CONFIG_BINFMT_ELF32=y
> +CONFIG_BLOCK_COMPAT=y
> +CONFIG_COMPAT=y
> +CONFIG_COMPAT_NETLINK_MESSAGES=y
> +CONFIG_CPU_BIG_ENDIAN=y
> +# CONFIG_CPU_LITTLE_ENDIAN is not set
> +CONFIG_CPU_MIPS64=y
> +CONFIG_CPU_MIPS64_R6=y
> +CONFIG_CPU_MIPSR1=y
> +CONFIG_CPU_SUPPORTS_64BIT_KERNEL=y
> +CONFIG_CPU_SUPPORTS_HUGEPAGES=y
> +CONFIG_HAVE_64BIT_ALIGNED_ACCESS=y
> +CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS=y
> +CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y
> +CONFIG_HAVE_EBPF_JIT=y
> +CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y
> +# CONFIG_HUGETLBFS is not set
> +CONFIG_MIPS32_COMPAT=y
> +CONFIG_MIPS32_N32=y
> +CONFIG_MIPS32_O32=y
> +# CONFIG_MIPS_VA_BITS_48 is not set
> +CONFIG_MODULES_USE_ELF_RELA=y
> +CONFIG_PCI_BUS_ADDR_T_64BIT=y
> +CONFIG_PGTABLE_LEVELS=3
> +CONFIG_PHYS_ADDR_T_64BIT=y
> +CONFIG_SYSVIPC_COMPAT=y
> +CONFIG_SYS_SUPPORTS_HUGETLBFS=y
> +CONFIG_ZONE_DMA32=y
> diff --git a/target/linux/malta/be64r6/target.mk b/target/linux/malta/be64r6/target.mk
> new file mode 100644
> index 0000000000..a645d01de3
> --- /dev/null
> +++ b/target/linux/malta/be64r6/target.mk
> @@ -0,0 +1,10 @@
> +ARCH:=mips64
> +CPU_TYPE:=mips64r6
> +SUBTARGET:=be64r6
> +FEATURES+=source-only
> +BOARDNAME:=Big Endian R6 (64-bits-r6)
> +
> +define Target/Description
> +       Build BE firmware images for MIPS Malta CoreLV board running in
> +       big-endian and 64-bits-r6 mode
> +endef
> diff --git a/target/linux/malta/le64r6/config-default b/target/linux/malta/le64r6/config-default
> new file mode 100644
> index 0000000000..37de98817e
> --- /dev/null
> +++ b/target/linux/malta/le64r6/config-default
> @@ -0,0 +1,38 @@
> +# CONFIG_32BIT is not set
> +CONFIG_64BIT=y
> +CONFIG_ARCH_DMA_ADDR_T_64BIT=y
> +CONFIG_ARCH_MMAP_RND_BITS=12
> +CONFIG_ARCH_MMAP_RND_BITS_MAX=18
> +CONFIG_ARCH_MMAP_RND_BITS_MIN=12
> +CONFIG_ARCH_MMAP_RND_COMPAT_BITS=8
> +CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y
> +CONFIG_ARCH_WANT_COMPAT_IPC_PARSE_VERSION=y
> +CONFIG_ARCH_WANT_OLD_COMPAT_IPC=y
> +CONFIG_BINFMT_ELF32=y
> +CONFIG_BLOCK_COMPAT=y
> +CONFIG_COMPAT=y
> +CONFIG_COMPAT_NETLINK_MESSAGES=y
> +# CONFIG_CPU_BIG_ENDIAN is not set
> +CONFIG_CPU_LITTLE_ENDIAN=y
> +CONFIG_CPU_MIPS64=y
> +CONFIG_CPU_MIPS64_R6=y
> +CONFIG_CPU_MIPSR1=y
> +CONFIG_CPU_SUPPORTS_64BIT_KERNEL=y
> +CONFIG_CPU_SUPPORTS_HUGEPAGES=y
> +CONFIG_HAVE_64BIT_ALIGNED_ACCESS=y
> +CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS=y
> +CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y
> +CONFIG_HAVE_EBPF_JIT=y
> +CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y
> +# CONFIG_HUGETLBFS is not set
> +CONFIG_MIPS32_COMPAT=y
> +CONFIG_MIPS32_N32=y
> +CONFIG_MIPS32_O32=y
> +# CONFIG_MIPS_VA_BITS_48 is not set
> +CONFIG_MODULES_USE_ELF_RELA=y
> +CONFIG_PCI_BUS_ADDR_T_64BIT=y
> +CONFIG_PGTABLE_LEVELS=3
> +CONFIG_PHYS_ADDR_T_64BIT=y
> +CONFIG_SYSVIPC_COMPAT=y
> +CONFIG_SYS_SUPPORTS_HUGETLBFS=y
> +CONFIG_ZONE_DMA32=y
> diff --git a/target/linux/malta/le64r6/target.mk b/target/linux/malta/le64r6/target.mk
> new file mode 100644
> index 0000000000..392c46dbdd
> --- /dev/null
> +++ b/target/linux/malta/le64r6/target.mk
> @@ -0,0 +1,10 @@
> +ARCH:=mips64el
> +CPU_TYPE:=mips64r6
> +SUBTARGET:=le64r6
> +FEATURES+=source-only
> +BOARDNAME:=Little Endian R6 (64-bits-r6)
> +
> +define Target/Description
> +       Build LE firmware images for MIPS Malta CoreLV board running in
> +       little-endian and 64-bits-r6 mode
> +endef
> diff --git a/toolchain/gcc/common.mk b/toolchain/gcc/common.mk
> index b75fce57ef..225bf27de0 100644
> --- a/toolchain/gcc/common.mk
> +++ b/toolchain/gcc/common.mk
> @@ -117,13 +117,19 @@ GCC_CONFIGURE:= \
>                 --with-host-libstdcxx=-lstdc++ \
>                 $(SOFT_FLOAT_CONFIG_OPTION) \
>                 $(call qstrip,$(CONFIG_EXTRA_GCC_CONFIG_OPTIONS)) \
> -               $(if $(CONFIG_mips64)$(CONFIG_mips64el),--with-arch=mips64 \
> -                       --with-abi=$(call qstrip,$(CONFIG_MIPS64_ABI))) \
>                 $(if $(CONFIG_arc),--with-cpu=$(CONFIG_CPU_TYPE)) \
>                 --with-gmp=$(TOPDIR)/staging_dir/host \
>                 --with-mpfr=$(TOPDIR)/staging_dir/host \
>                 --with-mpc=$(TOPDIR)/staging_dir/host \
>                 --disable-decimal-float
> +ifneq ($(CONFIG_mips64)$(CONFIG_mips64el),)
> +  ifeq ($(CONFIG_CPU_TYPE), "mips64r6")
> +    GCC_CONFIGURE += --with-arch=mips64r6  --with-abi=$(call qstrip,$(CONFIG_MIPS64_ABI))
> +  else
> +    GCC_CONFIGURE += --with-arch=mips64  --with-abi=$(call qstrip,$(CONFIG_MIPS64_ABI))
> +  endif
> +endif
> +
>  ifneq ($(CONFIG_mips)$(CONFIG_mipsel),)
>    GCC_CONFIGURE += --with-mips-plt
>  endif
> --
> 2.17.1
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list