linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Huacai Chen <chenhuacai@loongson.cn>
Cc: Andy Lutomirski <luto@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	David Airlie <airlied@linux.ie>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	linux-arch <linux-arch@vger.kernel.org>,
	Xuefeng Li <lixuefeng@loongson.cn>,
	Huacai Chen <chenhuacai@gmail.com>,
	Jiaxun Yang <jiaxun.yang@flygoat.com>
Subject: Re: [PATCH 03/19] LoongArch: Add build infrastructure
Date: Tue, 6 Jul 2021 12:35:53 +0200	[thread overview]
Message-ID: <CAK8P3a1TTuzpOUELWhmFwo8LNmyt9QT8TVdoRFCisXBt1yr=5g@mail.gmail.com> (raw)
In-Reply-To: <20210706041820.1536502-4-chenhuacai@loongson.cn>

Tue, Jul 6, 2021 at 6:18 AM Huacai Chen <chenhuacai@loongson.cn> wrote:

> --- /dev/null
> +++ b/arch/loongarch/Kbuild
> @@ -0,0 +1,21 @@
> +# Fail on warnings - also for files referenced in subdirs
> +# -Werror can be disabled for specific files using:
> +# CFLAGS_<file.o> := -Wno-error
> +ifeq ($(W),)
> +subdir-ccflags-y := -Werror
> +endif

This tends to break building with 'make W=12' or similar, I would recommend not
adding -Werror. It is a good idea though to have your CI systems build
with -Werror enabled on the command line though.

> +# platform specific definitions
> +include arch/loongarch/Kbuild.platforms
> +obj-y := $(platform-y)
> +

I would recommend not planning on having platform specific files. The way
we do it on modern platforms (arm64, rv64) is to have all the device drivers
in the driver subsystems instead.

> +       select GENERIC_IOMAP

GENERIC_IOMAP is one of those you probably don't want here. If PCI I/O
space is mapped into MMIO registers, just do what arm64 has and make
ioport_map() return a pointer, then make ioread32() an alias for readl().

> +       select HAVE_CBPF_JIT if !64BIT
> +       select HAVE_EBPF_JIT if 64BIT

These look like you incorrectly copied them from MIPS. I don't see any EBPF_JIT
implemementation (I may have missed that, as I'm still starting), but
you probably
don't want the CBPF version for 32-bit anyway.

> +       select HAVE_IDE

drivers/ide/ was just removed,so this line can go as well.

> +       select VIRT_TO_BUS

Remove this: if you still require a driver that fails to use the dma-mapping
API, fix the driver instead so it can work with IOMMUs.

> +menu "Machine selection"
> +
> +choice
> +       prompt "System type"
> +       default MACH_LOONGSON64
> +
> +config MACH_LOONGSON64
> +       bool "Loongson 64-bit family of machines"

There should generally not be a 'choice' menu to select between
different machine types, but instead the kernel should be able
to run on all platforms that have the same instruction set.

Maybe just make this a silent option and use 'select
MACH_LOONGSON64' so you can pick up the device drivers
that mips uses.

> +       select ARCH_MIGHT_HAVE_PC_PARPORT
> +       select ARCH_MIGHT_HAVE_PC_SERIO
> +       select GENERIC_ISA_DMA
> +       select ISA

Do you actually have ISA-style add-on cards? If not, then
remove the ISA options. If you do, which drivers are they?


> +config CPU_LOONGSON64
> +       bool "Loongson 64-bit CPU"
> +       depends on SYS_HAS_CPU_LOONGSON64
> +       select CPU_SUPPORTS_64BIT_KERNEL
> +       select GPIOLIB
> +       select SWIOTLB
> +       select ARCH_SUPPORTS_ATOMIC_RMW
> +       help
> +         The Loongson 64-bit processor implements the LoongArch64 (the 64-bit
> +         version of LoongArch) instruction set.
> +
> +endchoice
> +
> +config SYS_HAS_CPU_LOONGSON64
> +       bool
> +
> +endmenu
> +
> +config SYS_SUPPORTS_32BIT_KERNEL
> +       bool
> +config SYS_SUPPORTS_64BIT_KERNEL
> +       bool
> +config CPU_SUPPORTS_32BIT_KERNEL
> +       bool
> +config CPU_SUPPORTS_64BIT_KERNEL
> +       bool

Same for the CPUs: I would suggest you keep this simple until you get
to the point of actually having multiple CPUs that you need to distinguish.

Different 64-bit CPUs are hopefully going to be compatible with one
another, so they should not be listed as mutually exclusive in a
'choice' statement. The complexity with two levels of 32/64 support
is probably not going to be helpful here either.

The 'select' statements that you have under CPU_LOONGSON64
ook like they should just be in the top level.

GPIOLIB and SWIOTLB could just be left user selectable, if turning
them off results only in run-time loss of functionality but not a
build failure.

> +menu "Kernel type"
> +
> +choice
> +       prompt "Kernel code model"
> +       help
> +         You should only select this option if you have a workload that
> +         actually benefits from 64-bit processing or if your machine has
> +         large memory.  You will only be presented a single option in this
> +         menu if your system does not support both 32-bit and 64-bit kernels.
> +
> +config 32BIT
> +       bool "32-bit kernel"
> +       depends on CPU_SUPPORTS_32BIT_KERNEL && SYS_SUPPORTS_32BIT_KERNEL
> +       help
> +         Select this option if you want to build a 32-bit kernel.
> +
> +config 64BIT
> +       bool "64-bit kernel"
> +       depends on CPU_SUPPORTS_64BIT_KERNEL && SYS_SUPPORTS_64BIT_KERNEL
> +       help
> +         Select this option if you want to build a 64-bit kernel.
> +
> +endchoice

Since you don't support any 32-bit target at the moment, just make CONFIG_64BIT
a default-on statement, and make it user-selectable only when you add a 32-bit
target.


> +choice
> +       prompt "Kernel page size"
> +       default PAGE_SIZE_16KB
> +
> +config PAGE_SIZE_4KB
> +       bool "4kB"
> +       help
> +         This option select the standard 4kB Linux page size.
> +
> +config PAGE_SIZE_16KB
> +       bool "16kB"
> +       help
> +         This option select the standard 16kB Linux page size.
> +
> +config PAGE_SIZE_64KB
> +       bool "64kB"
> +       help
> +         This option select the standard 64kB Linux page size.
> +
> +endchoice
> +
> +choice
> +       prompt "Virtual memory address space bits"
> +       default VA_BITS_40
> +       help
> +         Allows choosing one of multiple possible virtual memory
> +         address space bits for applications. The level of page
> +         translation table is determined by a combination of page
> +         size and virtual memory address space bits.
> +
> +config VA_BITS_40
> +       bool "40-bits"
> +       depends on 64BIT
> +       help
> +         Support a maximum at least 40 bits of application virtual memory.
> +
> +config VA_BITS_48
> +       bool "48-bits"
> +       depends on 64BIT
> +       help
> +         Support a maximum at least 48 bits of application virtual memory.
> +
> +endchoice

Isn't the size of the address space tied to the page size?

         Arnd

  parent reply	other threads:[~2021-07-06 10:36 UTC|newest]

Thread overview: 131+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-06  4:18 [PATCH 00/19] arch: Add basic LoongArch support Huacai Chen
2021-07-06  4:18 ` [PATCH 01/19] LoongArch: Add elf-related definitions Huacai Chen
2021-07-06  4:18 ` [PATCH 02/19] LoongArch: Add writecombine support for drm Huacai Chen
2021-07-06  4:18 ` [PATCH 03/19] LoongArch: Add build infrastructure Huacai Chen
2021-07-06 10:12   ` Arnd Bergmann
2021-07-19  1:26     ` Huacai Chen
2021-07-19  7:43       ` Arnd Bergmann
2021-07-19 13:02         ` Huacai Chen
2021-07-06 10:35   ` Arnd Bergmann [this message]
2021-07-07  0:00   ` Randy Dunlap
2021-07-19  1:28     ` Huacai Chen
2021-07-06  4:18 ` [PATCH 05/19] LoongArch: Add boot and setup routines Huacai Chen
2021-07-06 10:16   ` Arnd Bergmann
2021-07-27 11:53     ` Huacai Chen
2021-07-27 12:40       ` Arnd Bergmann
2021-07-27 12:51         ` Ard Biesheuvel
2021-07-27 13:14           ` Arnd Bergmann
2021-07-27 16:22             ` Ard Biesheuvel
2021-07-27 17:53               ` Arnd Bergmann
2021-07-28 10:24                 ` Huacai Chen
2021-07-06 10:55   ` Arnd Bergmann
2021-07-06  4:18 ` [PATCH 06/19] LoongArch: Add exception/interrupt handling Huacai Chen
2021-07-06 10:16   ` Arnd Bergmann
2021-07-06 10:56     ` Arnd Bergmann
2021-07-06 11:06   ` Peter Zijlstra
2021-07-07 13:56     ` Nicholas Piggin
2021-07-27 14:10       ` Peter Zijlstra
2021-07-27 15:08         ` Arnd Bergmann
2021-07-28 10:16           ` Huacai Chen
2021-07-28 12:23             ` Arnd Bergmann
2021-07-06  4:18 ` [PATCH 07/19] LoongArch: Add process management Huacai Chen
2021-07-06 10:16   ` Arnd Bergmann
2021-07-06 10:57     ` Arnd Bergmann
2021-07-06 11:09     ` Peter Zijlstra
2021-08-12 11:17       ` Huacai Chen
2021-08-12 12:29         ` Arnd Bergmann
2021-08-12 12:51           ` Huacai Chen
2021-07-06  4:18 ` [PATCH 08/19] LoongArch: Add memory management Huacai Chen
2021-07-06 10:16   ` Arnd Bergmann
2021-07-06 10:57     ` Arnd Bergmann
2021-08-12 11:20     ` Huacai Chen
2021-08-16  1:57   ` Guo Ren
2021-08-16  3:31     ` Huacai Chen
2021-07-06  4:18 ` [PATCH 09/19] LoongArch: Add system call support Huacai Chen
2021-07-06 10:17   ` Arnd Bergmann
2021-07-06 10:58     ` Arnd Bergmann
2021-07-07  4:24     ` Huacai Chen
2021-07-07  6:44       ` Arnd Bergmann
2021-07-07  7:00         ` Huacai Chen
2021-07-09  8:44         ` Huacai Chen
2021-07-06 13:51   ` Thomas Gleixner
2021-07-07  4:27     ` Huacai Chen
2021-08-12 12:40     ` Huacai Chen
2021-07-06  4:18 ` [PATCH 10/19] LoongArch: Add signal handling support Huacai Chen
2021-07-06 10:17   ` Arnd Bergmann
2021-07-06 10:59     ` Arnd Bergmann
2021-07-08 13:04     ` Huacai Chen
2021-07-08 13:23       ` Arnd Bergmann
2021-07-09  9:24         ` Huacai Chen
2021-07-09 10:22           ` Arnd Bergmann
2021-07-09 14:49             ` Eric W. Biederman
2021-07-09 15:59               ` Arnd Bergmann
2021-08-26 16:43   ` Xi Ruoyao
2021-08-27  4:23     ` Huacai Chen
2021-08-27  4:27       ` Xi Ruoyao
2021-07-06  4:18 ` [PATCH 11/19] LoongArch: Add elf and module support Huacai Chen
2021-07-06  4:18 ` [PATCH 12/19] LoongArch: Add misc common routines Huacai Chen
2021-07-06 10:17   ` Arnd Bergmann
2021-07-06 11:00     ` Arnd Bergmann
2021-07-23 10:41     ` Huacai Chen
2021-07-23 11:43       ` Arnd Bergmann
2021-07-24 12:53         ` Huacai Chen
2021-07-06  4:18 ` [PATCH 13/19] LoongArch: Add some library functions Huacai Chen
2021-07-06 10:17   ` Arnd Bergmann
2021-07-06 11:00     ` Arnd Bergmann
2021-08-12 11:22     ` Huacai Chen
2021-07-06  4:18 ` [PATCH 14/19] LoongArch: Add 64-bit Loongson platform Huacai Chen
2021-07-06  4:18 ` [PATCH 15/19] LoongArch: Add PCI controller support Huacai Chen
2021-07-06 10:17   ` Arnd Bergmann
2021-07-06 11:01     ` Arnd Bergmann
2021-08-12 11:29     ` Huacai Chen
2021-07-06  4:18 ` [PATCH 16/19] LoongArch: Add VDSO and VSYSCALL support Huacai Chen
2021-07-06 10:17   ` Arnd Bergmann
2021-07-06 11:02     ` Arnd Bergmann
2021-08-12 11:31     ` Huacai Chen
2021-07-06  4:18 ` [PATCH 17/19] LoongArch: Add multi-processor (SMP) support Huacai Chen
2021-07-06 10:17   ` Arnd Bergmann
2021-07-06 11:03     ` Arnd Bergmann
2021-07-06 11:32   ` Peter Zijlstra
2021-08-12 11:39     ` Huacai Chen
2021-07-06 11:56   ` Peter Zijlstra
2021-07-06 13:48   ` Peter Zijlstra
2021-08-12 11:41     ` Huacai Chen
2021-07-06 13:52   ` Peter Zijlstra
2021-07-06  4:18 ` [PATCH 18/19] LoongArch: Add Non-Uniform Memory Access (NUMA) support Huacai Chen
2021-07-06 10:18   ` Arnd Bergmann
2021-07-06 11:03     ` Arnd Bergmann
2021-08-12 11:46     ` Huacai Chen
2021-08-12 12:48       ` Arnd Bergmann
2021-07-06  4:18 ` [PATCH 19/19] LoongArch: Add Loongson-3 default config file Huacai Chen
2021-07-06 10:18   ` Arnd Bergmann
2021-07-06 11:04     ` Arnd Bergmann
2021-08-12 11:58     ` Huacai Chen
2021-08-12 12:50       ` Arnd Bergmann
2021-07-06 10:11 ` [PATCH 00/19] arch: Add basic LoongArch support Arnd Bergmann
2021-07-07  3:04   ` Huacai Chen
2021-07-07  7:28     ` Arnd Bergmann
2021-07-29 16:48       ` Huacai Chen
2021-07-30 20:50         ` Arnd Bergmann
2021-07-06 10:33 ` Arnd Bergmann
     [not found] ` <20210706041820.1536502-5-chenhuacai@loongson.cn>
2021-07-06 10:16   ` [PATCH 04/19] LoongArch: Add common headers Arnd Bergmann
2021-08-12 11:05     ` Huacai Chen
2021-08-12 12:45       ` Arnd Bergmann
2021-08-13  3:30         ` Huacai Chen
2021-08-13  7:05           ` Arnd Bergmann
2021-08-13  8:14             ` Huacai Chen
2021-08-13  9:08               ` Arnd Bergmann
2021-08-14  2:50                 ` Huacai Chen
2021-08-15  8:56                   ` Arnd Bergmann
2021-08-16  4:10                     ` Huacai Chen
2021-08-18  9:38                       ` Arnd Bergmann
2021-08-20  4:00                         ` Huacai Chen
2021-08-20  7:55                           ` Arnd Bergmann
2021-08-21  8:16                             ` Huacai Chen
2021-07-06 10:54   ` Arnd Bergmann
2021-07-06 10:57   ` Peter Zijlstra
2021-07-06 11:23   ` Peter Zijlstra
2021-07-06 12:59     ` Arnd Bergmann
2021-07-06 13:20       ` Peter Zijlstra
2021-07-06 13:37       ` Peter Zijlstra
2021-07-06 11:59   ` Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAK8P3a1TTuzpOUELWhmFwo8LNmyt9QT8TVdoRFCisXBt1yr=5g@mail.gmail.com' \
    --to=arnd@arndb.de \
    --cc=airlied@linux.ie \
    --cc=akpm@linux-foundation.org \
    --cc=chenhuacai@gmail.com \
    --cc=chenhuacai@loongson.cn \
    --cc=jiaxun.yang@flygoat.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=lixuefeng@loongson.cn \
    --cc=luto@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).