Hi Atish,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   9f29bd8b2e7132b409178d1367dae1813017bd0e
commit: e557793799c5a8406afb08aa170509619f7eac36 RISC-V: Fix maximum allowed 
phsyical memory for RV32
date:   6 days ago
config: riscv-randconfig-r002-20210122 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 
bd3a387ee76f58caa0d7901f3f84e9bb3d006f27)
reproduce (this is a W=1 build):
        wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e557793799c5a8406afb08aa170509619f7eac36
        git remote add linus 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout e557793799c5a8406afb08aa170509619f7eac36
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <l...@intel.com>

All errors (new ones prefixed by >>):

   arch/riscv/kernel/head.S: Assembler messages:
>> arch/riscv/kernel/head.S:72: Error: illegal operands `li 
>> a1,CONFIG_PAGE_OFFSET'
   clang-12: error: assembler command failed with exit code 1 (use -v to see 
invocation)
--
   In file included from arch/riscv/kernel/soc.c:7:
   In file included from include/linux/pgtable.h:6:
   In file included from arch/riscv/include/asm/pgtable.h:64:
>> arch/riscv/include/asm/pgtable-64.h:70:9: error: use of undeclared 
>> identifier 'UL'
           return pfn_to_page(pud_val(pud) >> _PAGE_PFN_SHIFT);
                  ^
   include/asm-generic/memory_model.h:82:21: note: expanded from macro 
'pfn_to_page'
   #define pfn_to_page __pfn_to_page
                       ^
   include/asm-generic/memory_model.h:54:29: note: expanded from macro 
'__pfn_to_page'
   #define __pfn_to_page(pfn)      (vmemmap + (pfn))
                                    ^
   arch/riscv/include/asm/pgtable.h:47:34: note: expanded from macro 'vmemmap'
   #define vmemmap         ((struct page *)VMEMMAP_START)
                                           ^
   arch/riscv/include/asm/pgtable.h:41:24: note: expanded from macro 
'VMEMMAP_START'
   #define VMEMMAP_START   (VMALLOC_START - VMEMMAP_SIZE)
                            ^
   arch/riscv/include/asm/pgtable.h:26:27: note: expanded from macro 
'VMALLOC_START'
   #define VMALLOC_START    (PAGE_OFFSET - VMALLOC_SIZE)
                             ^
   arch/riscv/include/asm/page.h:34:46: note: expanded from macro 'PAGE_OFFSET'
   #define PAGE_OFFSET             _AC(CONFIG_PAGE_OFFSET, UL)
                                                           ^
   In file included from arch/riscv/kernel/soc.c:7:
   In file included from include/linux/pgtable.h:6:
   In file included from arch/riscv/include/asm/pgtable.h:64:
>> arch/riscv/include/asm/pgtable-64.h:70:9: error: use of undeclared 
>> identifier 'UL'
   include/asm-generic/memory_model.h:82:21: note: expanded from macro 
'pfn_to_page'
   #define pfn_to_page __pfn_to_page
                       ^
   include/asm-generic/memory_model.h:54:29: note: expanded from macro 
'__pfn_to_page'
   #define __pfn_to_page(pfn)      (vmemmap + (pfn))
                                    ^
   arch/riscv/include/asm/pgtable.h:47:34: note: expanded from macro 'vmemmap'
   #define vmemmap         ((struct page *)VMEMMAP_START)
                                           ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to 
see all)
   arch/riscv/include/asm/pgtable.h:24:27: note: expanded from macro 
'VMALLOC_SIZE'
   #define VMALLOC_SIZE     (KERN_VIRT_SIZE >> 1)
                             ^
   arch/riscv/include/asm/page.h:36:26: note: expanded from macro 
'KERN_VIRT_SIZE'
   #define KERN_VIRT_SIZE (-PAGE_OFFSET)
                            ^
   arch/riscv/include/asm/page.h:34:46: note: expanded from macro 'PAGE_OFFSET'
   #define PAGE_OFFSET             _AC(CONFIG_PAGE_OFFSET, UL)
                                                           ^
   In file included from arch/riscv/kernel/soc.c:7:
   In file included from include/linux/pgtable.h:6:
>> arch/riscv/include/asm/pgtable.h:181:9: error: use of undeclared identifier 
>> 'UL'
           return pfn_to_page(pmd_val(pmd) >> _PAGE_PFN_SHIFT);
                  ^
   include/asm-generic/memory_model.h:82:21: note: expanded from macro 
'pfn_to_page'
   #define pfn_to_page __pfn_to_page
                       ^
   include/asm-generic/memory_model.h:54:29: note: expanded from macro 
'__pfn_to_page'
   #define __pfn_to_page(pfn)      (vmemmap + (pfn))
                                    ^
   arch/riscv/include/asm/pgtable.h:47:34: note: expanded from macro 'vmemmap'
   #define vmemmap         ((struct page *)VMEMMAP_START)
                                           ^
   arch/riscv/include/asm/pgtable.h:41:24: note: expanded from macro 
'VMEMMAP_START'
   #define VMEMMAP_START   (VMALLOC_START - VMEMMAP_SIZE)
                            ^
   arch/riscv/include/asm/pgtable.h:26:27: note: expanded from macro 
'VMALLOC_START'
   #define VMALLOC_START    (PAGE_OFFSET - VMALLOC_SIZE)
                             ^
   arch/riscv/include/asm/page.h:34:46: note: expanded from macro 'PAGE_OFFSET'
   #define PAGE_OFFSET             _AC(CONFIG_PAGE_OFFSET, UL)
                                                           ^
   In file included from arch/riscv/kernel/soc.c:7:
   In file included from include/linux/pgtable.h:6:
>> arch/riscv/include/asm/pgtable.h:181:9: error: use of undeclared identifier 
>> 'UL'
   include/asm-generic/memory_model.h:82:21: note: expanded from macro 
'pfn_to_page'
   #define pfn_to_page __pfn_to_page
                       ^
   include/asm-generic/memory_model.h:54:29: note: expanded from macro 
'__pfn_to_page'
   #define __pfn_to_page(pfn)      (vmemmap + (pfn))
                                    ^
   arch/riscv/include/asm/pgtable.h:47:34: note: expanded from macro 'vmemmap'
   #define vmemmap         ((struct page *)VMEMMAP_START)
                                           ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to 
see all)
   arch/riscv/include/asm/pgtable.h:24:27: note: expanded from macro 
'VMALLOC_SIZE'
   #define VMALLOC_SIZE     (KERN_VIRT_SIZE >> 1)
                             ^
   arch/riscv/include/asm/page.h:36:26: note: expanded from macro 
'KERN_VIRT_SIZE'
   #define KERN_VIRT_SIZE (-PAGE_OFFSET)
                            ^
   arch/riscv/include/asm/page.h:34:46: note: expanded from macro 'PAGE_OFFSET'
   #define PAGE_OFFSET             _AC(CONFIG_PAGE_OFFSET, UL)
                                                           ^
   4 errors generated.
--
   In file included from arch/riscv/kernel/irq.c:8:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:10:
   In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/riscv/include/asm/io.h:15:
   In file included from include/linux/pgtable.h:6:
   In file included from arch/riscv/include/asm/pgtable.h:64:
>> arch/riscv/include/asm/pgtable-64.h:70:9: error: use of undeclared 
>> identifier 'UL'
           return pfn_to_page(pud_val(pud) >> _PAGE_PFN_SHIFT);
                  ^
   include/asm-generic/memory_model.h:82:21: note: expanded from macro 
'pfn_to_page'
   #define pfn_to_page __pfn_to_page
                       ^
   include/asm-generic/memory_model.h:54:29: note: expanded from macro 
'__pfn_to_page'
   #define __pfn_to_page(pfn)      (vmemmap + (pfn))
                                    ^
   arch/riscv/include/asm/pgtable.h:47:34: note: expanded from macro 'vmemmap'
   #define vmemmap         ((struct page *)VMEMMAP_START)
                                           ^
   arch/riscv/include/asm/pgtable.h:41:24: note: expanded from macro 
'VMEMMAP_START'
   #define VMEMMAP_START   (VMALLOC_START - VMEMMAP_SIZE)
                            ^
   arch/riscv/include/asm/pgtable.h:26:27: note: expanded from macro 
'VMALLOC_START'
   #define VMALLOC_START    (PAGE_OFFSET - VMALLOC_SIZE)
                             ^
   arch/riscv/include/asm/page.h:34:46: note: expanded from macro 'PAGE_OFFSET'
   #define PAGE_OFFSET             _AC(CONFIG_PAGE_OFFSET, UL)
                                                           ^
   In file included from arch/riscv/kernel/irq.c:8:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:10:
   In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/riscv/include/asm/io.h:15:
   In file included from include/linux/pgtable.h:6:
   In file included from arch/riscv/include/asm/pgtable.h:64:
>> arch/riscv/include/asm/pgtable-64.h:70:9: error: use of undeclared 
>> identifier 'UL'
   include/asm-generic/memory_model.h:82:21: note: expanded from macro 
'pfn_to_page'
   #define pfn_to_page __pfn_to_page
                       ^
   include/asm-generic/memory_model.h:54:29: note: expanded from macro 
'__pfn_to_page'
   #define __pfn_to_page(pfn)      (vmemmap + (pfn))
                                    ^
   arch/riscv/include/asm/pgtable.h:47:34: note: expanded from macro 'vmemmap'
   #define vmemmap         ((struct page *)VMEMMAP_START)
                                           ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to 
see all)
   arch/riscv/include/asm/pgtable.h:24:27: note: expanded from macro 
'VMALLOC_SIZE'
   #define VMALLOC_SIZE     (KERN_VIRT_SIZE >> 1)
                             ^
   arch/riscv/include/asm/page.h:36:26: note: expanded from macro 
'KERN_VIRT_SIZE'
   #define KERN_VIRT_SIZE (-PAGE_OFFSET)
                            ^
   arch/riscv/include/asm/page.h:34:46: note: expanded from macro 'PAGE_OFFSET'
   #define PAGE_OFFSET             _AC(CONFIG_PAGE_OFFSET, UL)
                                                           ^
   In file included from arch/riscv/kernel/irq.c:8:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:10:
   In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/riscv/include/asm/io.h:15:
   In file included from include/linux/pgtable.h:6:
>> arch/riscv/include/asm/pgtable.h:181:9: error: use of undeclared identifier 
>> 'UL'
           return pfn_to_page(pmd_val(pmd) >> _PAGE_PFN_SHIFT);
                  ^
   include/asm-generic/memory_model.h:82:21: note: expanded from macro 
'pfn_to_page'
   #define pfn_to_page __pfn_to_page
                       ^
   include/asm-generic/memory_model.h:54:29: note: expanded from macro 
'__pfn_to_page'
   #define __pfn_to_page(pfn)      (vmemmap + (pfn))
                                    ^
   arch/riscv/include/asm/pgtable.h:47:34: note: expanded from macro 'vmemmap'
   #define vmemmap         ((struct page *)VMEMMAP_START)
                                           ^
   arch/riscv/include/asm/pgtable.h:41:24: note: expanded from macro 
'VMEMMAP_START'
   #define VMEMMAP_START   (VMALLOC_START - VMEMMAP_SIZE)
                            ^
   arch/riscv/include/asm/pgtable.h:26:27: note: expanded from macro 
'VMALLOC_START'
   #define VMALLOC_START    (PAGE_OFFSET - VMALLOC_SIZE)
                             ^
   arch/riscv/include/asm/page.h:34:46: note: expanded from macro 'PAGE_OFFSET'
   #define PAGE_OFFSET             _AC(CONFIG_PAGE_OFFSET, UL)
                                                           ^
   In file included from arch/riscv/kernel/irq.c:8:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:10:
   In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/riscv/include/asm/io.h:15:
   In file included from include/linux/pgtable.h:6:
>> arch/riscv/include/asm/pgtable.h:181:9: error: use of undeclared identifier 
>> 'UL'
   include/asm-generic/memory_model.h:82:21: note: expanded from macro 
'pfn_to_page'
   #define pfn_to_page __pfn_to_page
                       ^
   include/asm-generic/memory_model.h:54:29: note: expanded from macro 
'__pfn_to_page'
   #define __pfn_to_page(pfn)      (vmemmap + (pfn))
                                    ^
   arch/riscv/include/asm/pgtable.h:47:34: note: expanded from macro 'vmemmap'
   #define vmemmap         ((struct page *)VMEMMAP_START)
                                           ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to 
see all)
   arch/riscv/include/asm/pgtable.h:24:27: note: expanded from macro 
'VMALLOC_SIZE'
   #define VMALLOC_SIZE     (KERN_VIRT_SIZE >> 1)
                             ^
   arch/riscv/include/asm/page.h:36:26: note: expanded from macro 
'KERN_VIRT_SIZE'
   #define KERN_VIRT_SIZE (-PAGE_OFFSET)
                            ^
   arch/riscv/include/asm/page.h:34:46: note: expanded from macro 'PAGE_OFFSET'
   #define PAGE_OFFSET             _AC(CONFIG_PAGE_OFFSET, UL)
                                                           ^
   In file included from arch/riscv/kernel/irq.c:8:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:10:
   In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/riscv/include/asm/io.h:149:
>> include/asm-generic/io.h:556:9: error: use of undeclared identifier 'UL'
           return inb(addr);
                  ^
   arch/riscv/include/asm/io.h:55:65: note: expanded from macro 'inb'
   #define inb(c)          ({ u8  __v; __io_pbr(); __v = 
readb_cpu((void*)(PCI_IOBASE + (c))); __io_par(__v); __v; })
                                                                           ^
   arch/riscv/include/asm/io.h:30:38: note: expanded from macro 'PCI_IOBASE'
   #define PCI_IOBASE              ((void __iomem *)PCI_IO_START)
                                                    ^
   arch/riscv/include/asm/pgtable.h:51:27: note: expanded from macro 
'PCI_IO_START'
   #define PCI_IO_START     (PCI_IO_END - PCI_IO_SIZE)
                             ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to 
see all)
   arch/riscv/include/asm/pgtable.h:41:24: note: expanded from macro 
'VMEMMAP_START'
   #define VMEMMAP_START   (VMALLOC_START - VMEMMAP_SIZE)
                            ^
   arch/riscv/include/asm/pgtable.h:26:27: note: expanded from macro 
'VMALLOC_START'
   #define VMALLOC_START    (PAGE_OFFSET - VMALLOC_SIZE)
                             ^
   arch/riscv/include/asm/page.h:34:46: note: expanded from macro 'PAGE_OFFSET'
   #define PAGE_OFFSET             _AC(CONFIG_PAGE_OFFSET, UL)
                                                           ^
   In file included from arch/riscv/kernel/irq.c:8:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:10:
   In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/riscv/include/asm/io.h:149:
>> include/asm-generic/io.h:556:9: error: use of undeclared identifier 'UL'
   arch/riscv/include/asm/io.h:55:65: note: expanded from macro 'inb'
   #define inb(c)          ({ u8  __v; __io_pbr(); __v = 
readb_cpu((void*)(PCI_IOBASE + (c))); __io_par(__v); __v; })
                                                                           ^
   arch/riscv/include/asm/io.h:30:38: note: expanded from macro 'PCI_IOBASE'
   #define PCI_IOBASE              ((void __iomem *)PCI_IO_START)
                                                    ^
   arch/riscv/include/asm/pgtable.h:51:27: note: expanded from macro 
'PCI_IO_START'
   #define PCI_IO_START     (PCI_IO_END - PCI_IO_SIZE)
                             ^
   note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to 
see all)
   arch/riscv/include/asm/pgtable.h:24:27: note: expanded from macro 
'VMALLOC_SIZE'
   #define VMALLOC_SIZE     (KERN_VIRT_SIZE >> 1)
                             ^
   arch/riscv/include/asm/page.h:36:26: note: expanded from macro 
'KERN_VIRT_SIZE'
   #define KERN_VIRT_SIZE (-PAGE_OFFSET)
                            ^
   arch/riscv/include/asm/page.h:34:46: note: expanded from macro 'PAGE_OFFSET'
   #define PAGE_OFFSET             _AC(CONFIG_PAGE_OFFSET, UL)
                                                           ^
   In file included from arch/riscv/kernel/irq.c:8:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:10:
   In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/riscv/include/asm/io.h:149:
   include/asm-generic/io.h:564:9: error: use of undeclared identifier 'UL'
           return inw(addr);
                  ^
   arch/riscv/include/asm/io.h:56:65: note: expanded from macro 'inw'
   #define inw(c)          ({ u16 __v; __io_pbr(); __v = 
readw_cpu((void*)(PCI_IOBASE + (c))); __io_par(__v); __v; })
                                                                           ^
   arch/riscv/include/asm/io.h:30:38: note: expanded from macro 'PCI_IOBASE'
   #define PCI_IOBASE              ((void __iomem *)PCI_IO_START)
                                                    ^
   arch/riscv/include/asm/pgtable.h:51:27: note: expanded from macro 
'PCI_IO_START'
   #define PCI_IO_START     (PCI_IO_END - PCI_IO_SIZE)
                             ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to 
see all)
   arch/riscv/include/asm/pgtable.h:41:24: note: expanded from macro 
'VMEMMAP_START'
   #define VMEMMAP_START   (VMALLOC_START - VMEMMAP_SIZE)
                            ^
   arch/riscv/include/asm/pgtable.h:26:27: note: expanded from macro 
'VMALLOC_START'
   #define VMALLOC_START    (PAGE_OFFSET - VMALLOC_SIZE)
                             ^
   arch/riscv/include/asm/page.h:34:46: note: expanded from macro 'PAGE_OFFSET'
   #define PAGE_OFFSET             _AC(CONFIG_PAGE_OFFSET, UL)
                                                           ^
   In file included from arch/riscv/kernel/irq.c:8:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:10:
   In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/riscv/include/asm/io.h:149:
   include/asm-generic/io.h:564:9: error: use of undeclared identifier 'UL'
   arch/riscv/include/asm/io.h:56:65: note: expanded from macro 'inw'
   #define inw(c)          ({ u16 __v; __io_pbr(); __v = 
readw_cpu((void*)(PCI_IOBASE + (c))); __io_par(__v); __v; })
                                                                           ^
   arch/riscv/include/asm/io.h:30:38: note: expanded from macro 'PCI_IOBASE'
   #define PCI_IOBASE              ((void __iomem *)PCI_IO_START)
                                                    ^
   arch/riscv/include/asm/pgtable.h:51:27: note: expanded from macro 
'PCI_IO_START'
   #define PCI_IO_START     (PCI_IO_END - PCI_IO_SIZE)
                             ^
   note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to 
see all)
   arch/riscv/include/asm/pgtable.h:24:27: note: expanded from macro 
'VMALLOC_SIZE'
   #define VMALLOC_SIZE     (KERN_VIRT_SIZE >> 1)
                             ^
   arch/riscv/include/asm/page.h:36:26: note: expanded from macro 
'KERN_VIRT_SIZE'
   #define KERN_VIRT_SIZE (-PAGE_OFFSET)
                            ^
   arch/riscv/include/asm/page.h:34:46: note: expanded from macro 'PAGE_OFFSET'
   #define PAGE_OFFSET             _AC(CONFIG_PAGE_OFFSET, UL)
                                                           ^
   In file included from arch/riscv/kernel/irq.c:8:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:10:
   In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/riscv/include/asm/io.h:149:
   include/asm-generic/io.h:572:9: error: use of undeclared identifier 'UL'
           return inl(addr);
                  ^
   arch/riscv/include/asm/io.h:57:65: note: expanded from macro 'inl'
   #define inl(c)          ({ u32 __v; __io_pbr(); __v = 
readl_cpu((void*)(PCI_IOBASE + (c))); __io_par(__v); __v; })
                                                                           ^
   arch/riscv/include/asm/io.h:30:38: note: expanded from macro 'PCI_IOBASE'
   #define PCI_IOBASE              ((void __iomem *)PCI_IO_START)
                                                    ^
   arch/riscv/include/asm/pgtable.h:51:27: note: expanded from macro 
'PCI_IO_START'
   #define PCI_IO_START     (PCI_IO_END - PCI_IO_SIZE)
                             ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to 
see all)
   arch/riscv/include/asm/pgtable.h:41:24: note: expanded from macro 
'VMEMMAP_START'
   #define VMEMMAP_START   (VMALLOC_START - VMEMMAP_SIZE)
..


vim +72 arch/riscv/kernel/head.S

0f327f2aaad6a873 Atish Patra 2019-06-06   67  
e011995e826f85fb Atish Patra 2020-03-17   68  .align 2
e011995e826f85fb Atish Patra 2020-03-17   69  #ifdef CONFIG_MMU
e011995e826f85fb Atish Patra 2020-03-17   70  relocate:
e011995e826f85fb Atish Patra 2020-03-17   71    /* Relocate return address */
e011995e826f85fb Atish Patra 2020-03-17  @72    li a1, PAGE_OFFSET
e011995e826f85fb Atish Patra 2020-03-17   73    la a2, _start
e011995e826f85fb Atish Patra 2020-03-17   74    sub a1, a1, a2
e011995e826f85fb Atish Patra 2020-03-17   75    add ra, ra, a1
e011995e826f85fb Atish Patra 2020-03-17   76  
e011995e826f85fb Atish Patra 2020-03-17   77    /* Point stvec to virtual 
address of intruction after satp write */
e011995e826f85fb Atish Patra 2020-03-17   78    la a2, 1f
e011995e826f85fb Atish Patra 2020-03-17   79    add a2, a2, a1
e011995e826f85fb Atish Patra 2020-03-17   80    csrw CSR_TVEC, a2
e011995e826f85fb Atish Patra 2020-03-17   81  
e011995e826f85fb Atish Patra 2020-03-17   82    /* Compute satp for kernel page 
tables, but don't load it yet */
e011995e826f85fb Atish Patra 2020-03-17   83    srl a2, a0, PAGE_SHIFT
e011995e826f85fb Atish Patra 2020-03-17   84    li a1, SATP_MODE
e011995e826f85fb Atish Patra 2020-03-17   85    or a2, a2, a1
e011995e826f85fb Atish Patra 2020-03-17   86  
e011995e826f85fb Atish Patra 2020-03-17   87    /*
e011995e826f85fb Atish Patra 2020-03-17   88     * Load trampoline page 
directory, which will cause us to trap to
e011995e826f85fb Atish Patra 2020-03-17   89     * stvec if VA != PA, or simply 
fall through if VA == PA.  We need a
e011995e826f85fb Atish Patra 2020-03-17   90     * full fence here because 
setup_vm() just wrote these PTEs and we need
e011995e826f85fb Atish Patra 2020-03-17   91     * to ensure the new 
translations are in use.
e011995e826f85fb Atish Patra 2020-03-17   92     */
e011995e826f85fb Atish Patra 2020-03-17   93    la a0, trampoline_pg_dir
e011995e826f85fb Atish Patra 2020-03-17   94    srl a0, a0, PAGE_SHIFT
e011995e826f85fb Atish Patra 2020-03-17   95    or a0, a0, a1
e011995e826f85fb Atish Patra 2020-03-17   96    sfence.vma
e011995e826f85fb Atish Patra 2020-03-17   97    csrw CSR_SATP, a0
e011995e826f85fb Atish Patra 2020-03-17   98  .align 2
e011995e826f85fb Atish Patra 2020-03-17   99  1:
76d4467a97bd8c4b Qiu Wenbo   2020-08-13  100    /* Set trap vector to spin 
forever to help debug */
76d4467a97bd8c4b Qiu Wenbo   2020-08-13  101    la a0, .Lsecondary_park
e011995e826f85fb Atish Patra 2020-03-17  102    csrw CSR_TVEC, a0
e011995e826f85fb Atish Patra 2020-03-17  103  
e011995e826f85fb Atish Patra 2020-03-17  104    /* Reload the global pointer */
e011995e826f85fb Atish Patra 2020-03-17  105  .option push
e011995e826f85fb Atish Patra 2020-03-17  106  .option norelax
e011995e826f85fb Atish Patra 2020-03-17  107    la gp, __global_pointer$
e011995e826f85fb Atish Patra 2020-03-17  108  .option pop
e011995e826f85fb Atish Patra 2020-03-17  109  
e011995e826f85fb Atish Patra 2020-03-17  110    /*
e011995e826f85fb Atish Patra 2020-03-17  111     * Switch to kernel page 
tables.  A full fence is necessary in order to
e011995e826f85fb Atish Patra 2020-03-17  112     * avoid using the trampoline 
translations, which are only correct for
e011995e826f85fb Atish Patra 2020-03-17  113     * the first superpage.  
Fetching the fence is guarnteed to work
e011995e826f85fb Atish Patra 2020-03-17  114     * because that first superpage 
is translated the same way.
e011995e826f85fb Atish Patra 2020-03-17  115     */
e011995e826f85fb Atish Patra 2020-03-17  116    csrw CSR_SATP, a2
e011995e826f85fb Atish Patra 2020-03-17  117    sfence.vma
e011995e826f85fb Atish Patra 2020-03-17  118  
e011995e826f85fb Atish Patra 2020-03-17  119    ret
e011995e826f85fb Atish Patra 2020-03-17  120  #endif /* CONFIG_MMU */
e011995e826f85fb Atish Patra 2020-03-17  121  #ifdef CONFIG_SMP
cfafe260137418d0 Atish Patra 2020-03-17  122    .global secondary_start_sbi
cfafe260137418d0 Atish Patra 2020-03-17  123  secondary_start_sbi:
cfafe260137418d0 Atish Patra 2020-03-17  124    /* Mask all interrupts */
cfafe260137418d0 Atish Patra 2020-03-17  125    csrw CSR_IE, zero
cfafe260137418d0 Atish Patra 2020-03-17  126    csrw CSR_IP, zero
cfafe260137418d0 Atish Patra 2020-03-17  127  
cfafe260137418d0 Atish Patra 2020-03-17  128    /* Load the global pointer */
cfafe260137418d0 Atish Patra 2020-03-17  129    .option push
cfafe260137418d0 Atish Patra 2020-03-17  130    .option norelax
cfafe260137418d0 Atish Patra 2020-03-17  131            la gp, __global_pointer$
cfafe260137418d0 Atish Patra 2020-03-17  132    .option pop
cfafe260137418d0 Atish Patra 2020-03-17  133  
cfafe260137418d0 Atish Patra 2020-03-17  134    /*
cfafe260137418d0 Atish Patra 2020-03-17  135     * Disable FPU to detect 
illegal usage of
cfafe260137418d0 Atish Patra 2020-03-17  136     * floating point in kernel 
space
cfafe260137418d0 Atish Patra 2020-03-17  137     */
cfafe260137418d0 Atish Patra 2020-03-17  138    li t0, SR_FS
cfafe260137418d0 Atish Patra 2020-03-17  139    csrc CSR_STATUS, t0
cfafe260137418d0 Atish Patra 2020-03-17  140  
e011995e826f85fb Atish Patra 2020-03-17  141    /* Set trap vector to spin 
forever to help debug */
e011995e826f85fb Atish Patra 2020-03-17  142    la a3, .Lsecondary_park
e011995e826f85fb Atish Patra 2020-03-17  143    csrw CSR_TVEC, a3
e011995e826f85fb Atish Patra 2020-03-17  144  
e011995e826f85fb Atish Patra 2020-03-17  145    slli a3, a0, LGREG
cfafe260137418d0 Atish Patra 2020-03-17  146    la a4, __cpu_up_stack_pointer
cfafe260137418d0 Atish Patra 2020-03-17  147    la a5, __cpu_up_task_pointer
cfafe260137418d0 Atish Patra 2020-03-17  148    add a4, a3, a4
cfafe260137418d0 Atish Patra 2020-03-17  149    add a5, a3, a5
cfafe260137418d0 Atish Patra 2020-03-17  150    REG_L sp, (a4)
cfafe260137418d0 Atish Patra 2020-03-17  151    REG_L tp, (a5)
cfafe260137418d0 Atish Patra 2020-03-17  152  
e011995e826f85fb Atish Patra 2020-03-17  153    .global secondary_start_common
e011995e826f85fb Atish Patra 2020-03-17  154  secondary_start_common:
e011995e826f85fb Atish Patra 2020-03-17  155  

:::::: The code at line 72 was first introduced by commit
:::::: e011995e826f85fbe55dc7d4ce649461163d1052 RISC-V: Move relocate and few 
other functions out of __init

:::::: TO: Atish Patra <atish.pa...@wdc.com>
:::::: CC: Palmer Dabbelt <palmerdabb...@google.com>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org

Attachment: .config.gz
Description: application/gzip

Reply via email to