The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Gregory CLEMENT <gregory.clement@bootlin.com>
To: kernel test robot <lkp@intel.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
	"Thomas Bogendoerfer" <tsbogend@alpha.franken.de>,
	"Théo Lebrun" <theo.lebrun@bootlin.com>
Subject: Re: arch/mips/include/asm/mips-cm.h:329:1: sparse: sparse: cast truncates bits from constant value (fffffffff000 becomes fffff000)
Date: Tue, 10 Dec 2024 18:06:37 +0100	[thread overview]
Message-ID: <87ed2flb6q.fsf@BLaptop.bootlin.com> (raw)
In-Reply-To: <202412091227.KUZgstBB-lkp@intel.com>

Hello,

> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   fac04efc5c793dccbd07e2d59af9f90b7fc0dca4
> commit: 6f14293257309a02a6d451e80e4ef1d78560479e MIPS: Allow using more than 32-bit addresses for reset vectors when possible
> date:   6 weeks ago
> config: mips-randconfig-r112-20241209 (https://download.01.org/0day-ci/archive/20241209/202412091227.KUZgstBB-lkp@intel.com/config)
> compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 592c0fe55f6d9a811028b5f3507be91458ab2713)
> reproduce: (https://download.01.org/0day-ci/archive/20241209/202412091227.KUZgstBB-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/202412091227.KUZgstBB-lkp@intel.com/

[...]

>    arch/mips/kernel/smp-cps.c: note: in included file (through arch/mips/include/asm/mips-cps.h):
>    arch/mips/include/asm/mips-cm.h:329:1: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *mem @@     got void * @@
>    arch/mips/include/asm/mips-cm.h:329:1: sparse:     expected void volatile [noderef] __iomem *mem
>    arch/mips/include/asm/mips-cm.h:329:1: sparse:     got void *
>    arch/mips/include/asm/mips-cm.h:329:1: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *mem @@     got void * @@
>    arch/mips/include/asm/mips-cm.h:329:1: sparse:     expected void volatile [noderef] __iomem *mem
>    arch/mips/include/asm/mips-cm.h:329:1: sparse:     got void *
>    arch/mips/include/asm/mips-cm.h:329:1: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *mem @@     got void * @@
>    arch/mips/include/asm/mips-cm.h:329:1: sparse:     expected void volatile [noderef] __iomem *mem
>    arch/mips/include/asm/mips-cm.h:329:1: sparse:     got void *
>    arch/mips/include/asm/mips-cm.h:329:1: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *mem @@     got void * @@
>    arch/mips/include/asm/mips-cm.h:329:1: sparse:     expected void volatile [noderef] __iomem *mem
>    arch/mips/include/asm/mips-cm.h:329:1: sparse:     got void *
>>> arch/mips/include/asm/mips-cm.h:329:1: sparse: sparse: cast truncates bits from constant value (fffffffff000 becomes fffff000)
>    arch/mips/include/asm/mips-cm.h:329:1: sparse: sparse: incorrect type in return expression (different address spaces) @@     expected void * @@     got void [noderef] __iomem * @@
>    arch/mips/include/asm/mips-cm.h:329:1: sparse:     expected void *
>    arch/mips/include/asm/mips-cm.h:329:1: sparse:     got void [noderef] __iomem *
>    arch/mips/include/asm/mips-cm.h:329:1: sparse: sparse: incorrect type in return expression (different address spaces) @@     expected void * @@     got void [noderef] __iomem * @@
>    arch/mips/include/asm/mips-cm.h:329:1: sparse:     expected void *
>    arch/mips/include/asm/mips-cm.h:329:1: sparse:     got void [noderef] __iomem *
>    arch/mips/include/asm/mips-cm.h:329:1: sparse: sparse: incorrect type in return expression (different address spaces) @@     expected void * @@     got void [noderef] __iomem * @@
>    arch/mips/include/asm/mips-cm.h:329:1: sparse:     expected void *
>    arch/mips/include/asm/mips-cm.h:329:1: sparse:     got void [noderef] __iomem *
>>> arch/mips/include/asm/mips-cm.h:329:1: sparse: sparse: cast truncates bits from constant value (fffffffff000 becomes fffff000)

So I looked for from where this error comes and found that it was caused
by:
  write_gcr_co_reset64_base(CM_GCR_Cx_RESET64_BASE_BEVEXCBASE);
in function check_64bit_reset() (smp-cps.c)

The constant value being CM_GCR_Cx_RESET64_BASE_BEVEXCBASE.

It occurs due to:
  __raw_writel(val, addr_##unit##_##name());
in write_##unit##_##name(uint##sz##_t val) (mips-cps.h)

However, check_64bit_reset() is only called when mips_cm_is64 is true,
whereas in write_##unit##_##name(uint##sz##_t val) __raw_writel is not
called when mips_cm_is64 is true. This warning is therefore a false
positive and I do not see any reasonable way to silence it, so I think
we should simply ignore it unless someone has a better proposal.

Gregory

[...]


>
> vim +329 arch/mips/include/asm/mips-cm.h
>
>    326	
>    327	/* GCR_Cx_RESET_BASE - Configure where powered up cores will fetch from */
>    328	GCR_CX_ACCESSOR_RW(32, 0x020, reset_base)
>  > 329	GCR_CX_ACCESSOR_RW(64, 0x020, reset64_base)
>    330	#define CM_GCR_Cx_RESET_BASE_BEVEXCBASE		GENMASK(31, 12)
>    331	#define CM_GCR_Cx_RESET64_BASE_BEVEXCBASE	GENMASK_ULL(47, 12)
>    332	#define CM_GCR_Cx_RESET_BASE_MODE		BIT(1)
>    333	
>
> -- 
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki

-- 
Grégory CLEMENT, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

      reply	other threads:[~2024-12-10 17:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-09  5:08 arch/mips/include/asm/mips-cm.h:329:1: sparse: sparse: cast truncates bits from constant value (fffffffff000 becomes fffff000) kernel test robot
2024-12-10 17:06 ` Gregory CLEMENT [this message]

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=87ed2flb6q.fsf@BLaptop.bootlin.com \
    --to=gregory.clement@bootlin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=theo.lebrun@bootlin.com \
    --cc=tsbogend@alpha.franken.de \
    /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