linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@infradead.org>
To: LKML <linux-kernel@vger.kernel.org>, linux-riscv@lists.infradead.org
Cc: Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>
Subject: Kconfig-induced build errors: CONFIG_PAGE_OFFSET
Date: Wed, 27 Jan 2021 19:18:11 -0800	[thread overview]
Message-ID: <b67f8941-6624-d814-e6d3-2ddfdfbdf7dd@infradead.org> (raw)

Hi,

I took a riscv-32 .config from kernel test robot (it was for a clang build)
and did a "make olddefconfig" (using gcc tools) and got build errors
due to this config item from arch/riscv/Kconfig;


config PAGE_OFFSET
	hex
	default 0xC0000000 if 32BIT && MAXPHYSMEM_1GB
	default 0x80000000 if 64BIT && !MMU
	default 0xffffffff80000000 if 64BIT && MAXPHYSMEM_2GB
	default 0xffffffe000000000 if 64BIT && MAXPHYSMEM_128GB

PAGE_OFFSET is undefined for the case of 32BIT && MAXPHYSMEM_2GB.
That causes lots of errors when _AC() is used to paste
CONFIG_PAGE_OFFSET to "UL", like these:

In file included from ../include/vdso/const.h:5,
                 from ../include/linux/const.h:4,
                 from ../include/linux/bits.h:5,
                 from ../include/linux/bitops.h:6,
                 from ../include/linux/kernel.h:11,
                 from ../init/do_mounts_initrd.c:3:
../arch/riscv/include/asm/uaccess.h: In function '__access_ok':
../arch/riscv/include/asm/page.h:34:46: error: 'UL' undeclared (first use in this function)
   34 | #define PAGE_OFFSET  _AC(CONFIG_PAGE_OFFSET, UL)
      |                                              ^~
../include/uapi/linux/const.h:20:23: note: in definition of macro '__AC'
   20 | #define __AC(X,Y) (X##Y)
      |                       ^
../arch/riscv/include/asm/page.h:34:22: note: in expansion of macro '_AC'
   34 | #define PAGE_OFFSET  _AC(CONFIG_PAGE_OFFSET, UL)
      |                      ^~~
../arch/riscv/include/asm/pgtable.h:26:27: note: in expansion of macro 'PAGE_OFFSET'
   26 | #define VMALLOC_START    (PAGE_OFFSET - VMALLOC_SIZE)
      |                           ^~~~~~~~~~~
../arch/riscv/include/asm/pgtable.h:41:24: note: in expansion of macro 'VMALLOC_START'
   41 | #define VMEMMAP_START (VMALLOC_START - VMEMMAP_SIZE)
      |                        ^~~~~~~~~~~~~
../arch/riscv/include/asm/pgtable.h:50:26: note: in expansion of macro 'VMEMMAP_START'
   50 | #define PCI_IO_END       VMEMMAP_START
      |                          ^~~~~~~~~~~~~
../arch/riscv/include/asm/pgtable.h:51:27: note: in expansion of macro 'PCI_IO_END'
   51 | #define PCI_IO_START     (PCI_IO_END - PCI_IO_SIZE)
      |                           ^~~~~~~~~~
../arch/riscv/include/asm/pgtable.h:53:26: note: in expansion of macro 'PCI_IO_START'
   53 | #define FIXADDR_TOP      PCI_IO_START
      |                          ^~~~~~~~~~~~
../arch/riscv/include/asm/pgtable.h:59:27: note: in expansion of macro 'FIXADDR_TOP'
   59 | #define FIXADDR_START    (FIXADDR_TOP - FIXADDR_SIZE)
      |                           ^~~~~~~~~~~
../arch/riscv/include/asm/pgtable.h:471:19: note: in expansion of macro 'FIXADDR_START'
  471 | #define TASK_SIZE FIXADDR_START
      |                   ^~~~~~~~~~~~~
../arch/riscv/include/asm/uaccess.h:56:17: note: in expansion of macro 'TASK_SIZE'
   56 |  return size <= TASK_SIZE && addr <= TASK_SIZE - size;


I suppose that it wants something like this, but someone else can
fix/use the correct default value here:

---

From: Randy Dunlap <rdunlap@infradead.org>

Provide a default value for PAGE_OFFSET for the case of
32BIT and MAXPHYSMEM_2GB.

Fixes many build errors.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
---
 arch/riscv/Kconfig |    1 +
 1 file changed, 1 insertion(+)

--- linux-next-20210125.orig/arch/riscv/Kconfig
+++ linux-next-20210125/arch/riscv/Kconfig
@@ -143,6 +143,7 @@ config PA_BITS
 config PAGE_OFFSET
 	hex
 	default 0xC0000000 if 32BIT && MAXPHYSMEM_1GB
+	default 0x80000000 if 32BIT && MAXPHYSMEM_2GB
 	default 0x80000000 if 64BIT && !MMU
 	default 0xffffffff80000000 if 64BIT && MAXPHYSMEM_2GB
 	default 0xffffffe000000000 if 64BIT && MAXPHYSMEM_128GB



-- 
~Randy
Reported-by: Randy Dunlap <rdunlap@infradead.org>


             reply	other threads:[~2021-01-28  3:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-28  3:18 Randy Dunlap [this message]
2021-01-28 20:07 ` Kconfig-induced build errors: CONFIG_PAGE_OFFSET Atish Patra
2021-01-28 20:40   ` Randy Dunlap
     [not found] <CAMuHMdWb8We=-L3mrZi5dSc308rapqH8NyAq9OJU=Qo7YijGpw@mail.gmail.com>
2021-02-03  2:27 ` Palmer Dabbelt
2021-02-03  2:35   ` Palmer Dabbelt

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=b67f8941-6624-d814-e6d3-2ddfdfbdf7dd@infradead.org \
    --to=rdunlap@infradead.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    /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).