All of lore.kernel.org
 help / color / mirror / Atom feed
* [openeuler:OLK-6.6 2632/2632] arch/x86/kernel/head64.c:382:12: warning: no previous prototype for 'early_clflush_bss_decrypted_section'
@ 2025-08-03  6:50 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2025-08-03  6:50 UTC (permalink / raw)
  To: kernel; +Cc: oe-kbuild-all

tree:   https://gitee.com/openeuler/kernel.git OLK-6.6
head:   e5f0407c7ee0aba1c7b2ab0f516e9dfb707a0ee2
commit: ca0c1fa1ec4b6d9040cec7e543d50a93fc88d4c6 [2632/2632] x86/head/64: Flush caches for .bss..decrypted section after CR3 switches to early_top_pgt
config: x86_64-buildonly-randconfig-2001-20250803 (https://download.01.org/0day-ci/archive/20250803/202508030825.1WNeA3KA-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14+deb12u1) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250803/202508030825.1WNeA3KA-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202508030825.1WNeA3KA-lkp@intel.com/

Note: functions only called from assembly code should be annotated with the asmlinkage attribute
All warnings (new ones prefixed by >>):

>> arch/x86/kernel/head64.c:382:12: warning: no previous prototype for 'early_clflush_bss_decrypted_section' [-Wmissing-prototypes]
     382 | void __ref early_clflush_bss_decrypted_section(void)
         |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +/early_clflush_bss_decrypted_section +382 arch/x86/kernel/head64.c

   381	
 > 382	void __ref early_clflush_bss_decrypted_section(void)
   383	{
   384		unsigned long vaddr, vaddr_end;
   385		char *cl, *start, *end;
   386	
   387		/* Only allow bsp flush these caches and the bsp must at early boot stage */
   388		if (bsp_flush_bss_decrypted_section_handled)
   389			return;
   390	
   391		if (read_cr3_pa() != __pa_nodebug(early_top_pgt))
   392			return;
   393	
   394		/* Only Hygon CSV guest should do the clflush */
   395		if (!__should_do_clflush())
   396			goto handled;
   397	
   398		/*
   399		 * The memory region of .bss..decrypted section maybe mapped
   400		 * with encryption in earlier stage. If the correspond stale
   401		 * caches lives in earlier stage were not flushed before we
   402		 * access that memory region, then Linux will crash later
   403		 * because the stale caches will pollute the memory. So we
   404		 * need flush the caches with encrypted mapping before we
   405		 * access .bss..decrypted section.
   406		 *
   407		 * The function __startup_64() have already filled the
   408		 * encrypted mapping for .bss..decrypted section, use that
   409		 * mapping here.
   410		 */
   411		vaddr = (unsigned long)__start_bss_decrypted -
   412					__START_KERNEL_map + phys_base;
   413		vaddr_end = (unsigned long)__end_bss_decrypted -
   414					__START_KERNEL_map + phys_base;
   415	
   416		/* Hardcode cl-size to 64 at this stage. */
   417		start = (char *)(vaddr & ~63);
   418		end   = (char *)((vaddr_end + 63) & ~63);
   419	
   420		asm volatile("mfence" : : : "memory");
   421		for (cl = start; cl != end; cl += 64)
   422			clflush(cl);
   423		asm volatile("mfence" : : : "memory");
   424	
   425	handled:
   426		bsp_flush_bss_decrypted_section_handled = true;
   427	}
   428	#endif
   429	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-08-03  6:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-03  6:50 [openeuler:OLK-6.6 2632/2632] arch/x86/kernel/head64.c:382:12: warning: no previous prototype for 'early_clflush_bss_decrypted_section' kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.