public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
* [pdx86-platform-drivers-x86:review-hans 40/59] drivers/platform/x86/amd/pmc/mp2_stb.c:94:2: error: call to undeclared function 'writeq'; ISO C99 and later do not support implicit function declarations
@ 2024-04-16  2:35 kernel test robot
  2024-04-16 13:06 ` Andy Shevchenko
  0 siblings, 1 reply; 6+ messages in thread
From: kernel test robot @ 2024-04-16  2:35 UTC (permalink / raw)
  To: Basavaraj Natikar
  Cc: llvm, oe-kbuild-all, Andy Shevchenko, Hans de Goede,
	Shyam Sundar S K, Kuppuswamy Sathyanarayanan

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git review-hans
head:   0aae4c44b032b5ede39405dfc62900adc467f362
commit: 2dc77993cb5eb311d6bb5584d30c3d1d42d9fa4a [40/59] platform/x86/amd/pmc: Add AMD MP2 STB functionality
config: i386-randconfig-011-20240416 (https://download.01.org/0day-ci/archive/20240416/202404161050.NSNJAxvX-lkp@intel.com/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240416/202404161050.NSNJAxvX-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/202404161050.NSNJAxvX-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/platform/x86/amd/pmc/mp2_stb.c:94:2: error: call to undeclared function 'writeq'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
      94 |         writeq(mp2->dma_addr, mp2->mmio + AMD_C2P_MSG1);
         |         ^
   drivers/platform/x86/amd/pmc/mp2_stb.c:267:45: warning: shift count >= width of type [-Wshift-count-overflow]
     267 |         rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
         |                                                    ^~~~~~~~~~~~~~~~
   include/linux/dma-mapping.h:77:54: note: expanded from macro 'DMA_BIT_MASK'
      77 | #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
         |                                                      ^ ~~~
   1 warning and 1 error generated.


vim +/writeq +94 drivers/platform/x86/amd/pmc/mp2_stb.c

    84	
    85	static void amd_mp2_stb_send_cmd(struct amd_mp2_dev *mp2, u8 cmd_id, bool is_dma_used)
    86	{
    87		struct mp2_cmd_base cmd_base;
    88	
    89		cmd_base.ul = 0;
    90		cmd_base.field.cmd_id = cmd_id;
    91		cmd_base.field.intr_disable = 1;
    92		cmd_base.field.is_dma_used = is_dma_used;
    93	
  > 94		writeq(mp2->dma_addr, mp2->mmio + AMD_C2P_MSG1);
    95		writel(cmd_base.ul, mp2->mmio + AMD_C2P_MSG0);
    96	}
    97	

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [pdx86-platform-drivers-x86:review-hans 40/59] drivers/platform/x86/amd/pmc/mp2_stb.c:94:2: error: call to undeclared function 'writeq'; ISO C99 and later do not support implicit function declarations
  2024-04-16  2:35 [pdx86-platform-drivers-x86:review-hans 40/59] drivers/platform/x86/amd/pmc/mp2_stb.c:94:2: error: call to undeclared function 'writeq'; ISO C99 and later do not support implicit function declarations kernel test robot
@ 2024-04-16 13:06 ` Andy Shevchenko
  2024-04-16 15:09   ` Nathan Chancellor
  0 siblings, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2024-04-16 13:06 UTC (permalink / raw)
  To: kernel test robot
  Cc: Basavaraj Natikar, llvm, oe-kbuild-all, Hans de Goede,
	Shyam Sundar S K, Kuppuswamy Sathyanarayanan

On Tue, Apr 16, 2024 at 10:35:55AM +0800, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git review-hans
> head:   0aae4c44b032b5ede39405dfc62900adc467f362
> commit: 2dc77993cb5eb311d6bb5584d30c3d1d42d9fa4a [40/59] platform/x86/amd/pmc: Add AMD MP2 STB functionality
> config: i386-randconfig-011-20240416 (https://download.01.org/0day-ci/archive/20240416/202404161050.NSNJAxvX-lkp@intel.com/config)
> compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240416/202404161050.NSNJAxvX-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/202404161050.NSNJAxvX-lkp@intel.com/
> 
> All errors (new ones prefixed by >>):
> 
> >> drivers/platform/x86/amd/pmc/mp2_stb.c:94:2: error: call to undeclared function 'writeq'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
>       94 |         writeq(mp2->dma_addr, mp2->mmio + AMD_C2P_MSG1);
>          |         ^
>    drivers/platform/x86/amd/pmc/mp2_stb.c:267:45: warning: shift count >= width of type [-Wshift-count-overflow]
>      267 |         rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
>          |                                                    ^~~~~~~~~~~~~~~~
>    include/linux/dma-mapping.h:77:54: note: expanded from macro 'DMA_BIT_MASK'
>       77 | #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
>          |                                                      ^ ~~~
>    1 warning and 1 error generated.

This is bogus, but can perhaps be 'fixed" with GENMASK((n) - 1, 0).

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [pdx86-platform-drivers-x86:review-hans 40/59] drivers/platform/x86/amd/pmc/mp2_stb.c:94:2: error: call to undeclared function 'writeq'; ISO C99 and later do not support implicit function declarations
  2024-04-16 13:06 ` Andy Shevchenko
@ 2024-04-16 15:09   ` Nathan Chancellor
  2024-04-16 18:06     ` Andy Shevchenko
  0 siblings, 1 reply; 6+ messages in thread
From: Nathan Chancellor @ 2024-04-16 15:09 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: kernel test robot, Basavaraj Natikar, llvm, oe-kbuild-all,
	Hans de Goede, Shyam Sundar S K, Kuppuswamy Sathyanarayanan

On Tue, Apr 16, 2024 at 04:06:23PM +0300, Andy Shevchenko wrote:
> On Tue, Apr 16, 2024 at 10:35:55AM +0800, kernel test robot wrote:
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git review-hans
> > head:   0aae4c44b032b5ede39405dfc62900adc467f362
> > commit: 2dc77993cb5eb311d6bb5584d30c3d1d42d9fa4a [40/59] platform/x86/amd/pmc: Add AMD MP2 STB functionality
> > config: i386-randconfig-011-20240416 (https://download.01.org/0day-ci/archive/20240416/202404161050.NSNJAxvX-lkp@intel.com/config)
> > compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
> > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240416/202404161050.NSNJAxvX-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/202404161050.NSNJAxvX-lkp@intel.com/
> > 
> > All errors (new ones prefixed by >>):
> > 
> > >> drivers/platform/x86/amd/pmc/mp2_stb.c:94:2: error: call to undeclared function 'writeq'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
> >       94 |         writeq(mp2->dma_addr, mp2->mmio + AMD_C2P_MSG1);
> >          |         ^
> >    drivers/platform/x86/amd/pmc/mp2_stb.c:267:45: warning: shift count >= width of type [-Wshift-count-overflow]
> >      267 |         rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
> >          |                                                    ^~~~~~~~~~~~~~~~
> >    include/linux/dma-mapping.h:77:54: note: expanded from macro 'DMA_BIT_MASK'
> >       77 | #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
> >          |                                                      ^ ~~~
> >    1 warning and 1 error generated.
> 
> This is bogus, but can perhaps be 'fixed" with GENMASK((n) - 1, 0).

The second warning only appears because of the first error; if the first
error is fixed, I suspect the second one won't appear (although I have
not actually checked it).

Cheers,
Nathan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [pdx86-platform-drivers-x86:review-hans 40/59] drivers/platform/x86/amd/pmc/mp2_stb.c:94:2: error: call to undeclared function 'writeq'; ISO C99 and later do not support implicit function declarations
  2024-04-16 15:09   ` Nathan Chancellor
@ 2024-04-16 18:06     ` Andy Shevchenko
  2024-04-16 18:17       ` Nathan Chancellor
  0 siblings, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2024-04-16 18:06 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: kernel test robot, Basavaraj Natikar, llvm, oe-kbuild-all,
	Hans de Goede, Shyam Sundar S K, Kuppuswamy Sathyanarayanan

On Tue, Apr 16, 2024 at 08:09:16AM -0700, Nathan Chancellor wrote:
> On Tue, Apr 16, 2024 at 04:06:23PM +0300, Andy Shevchenko wrote:
> > On Tue, Apr 16, 2024 at 10:35:55AM +0800, kernel test robot wrote:
> > > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git review-hans
> > > head:   0aae4c44b032b5ede39405dfc62900adc467f362
> > > commit: 2dc77993cb5eb311d6bb5584d30c3d1d42d9fa4a [40/59] platform/x86/amd/pmc: Add AMD MP2 STB functionality
> > > config: i386-randconfig-011-20240416 (https://download.01.org/0day-ci/archive/20240416/202404161050.NSNJAxvX-lkp@intel.com/config)
> > > compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
> > > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240416/202404161050.NSNJAxvX-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/202404161050.NSNJAxvX-lkp@intel.com/
> > > 
> > > All errors (new ones prefixed by >>):
> > > 
> > > >> drivers/platform/x86/amd/pmc/mp2_stb.c:94:2: error: call to undeclared function 'writeq'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
> > >       94 |         writeq(mp2->dma_addr, mp2->mmio + AMD_C2P_MSG1);
> > >          |         ^
> > >    drivers/platform/x86/amd/pmc/mp2_stb.c:267:45: warning: shift count >= width of type [-Wshift-count-overflow]
> > >      267 |         rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
> > >          |                                                    ^~~~~~~~~~~~~~~~
> > >    include/linux/dma-mapping.h:77:54: note: expanded from macro 'DMA_BIT_MASK'
> > >       77 | #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
> > >          |                                                      ^ ~~~
> > >    1 warning and 1 error generated.
> > 
> > This is bogus, but can perhaps be 'fixed" with GENMASK((n) - 1, 0).
> 
> The second warning only appears because of the first error; if the first
> error is fixed, I suspect the second one won't appear (although I have
> not actually checked it).

Is it confirmed? Because to me it looks not obvious at all ==> complier can be
amended as well in warning reporting

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [pdx86-platform-drivers-x86:review-hans 40/59] drivers/platform/x86/amd/pmc/mp2_stb.c:94:2: error: call to undeclared function 'writeq'; ISO C99 and later do not support implicit function declarations
  2024-04-16 18:06     ` Andy Shevchenko
@ 2024-04-16 18:17       ` Nathan Chancellor
  2024-04-16 19:21         ` Andy Shevchenko
  0 siblings, 1 reply; 6+ messages in thread
From: Nathan Chancellor @ 2024-04-16 18:17 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: kernel test robot, Basavaraj Natikar, llvm, oe-kbuild-all,
	Hans de Goede, Shyam Sundar S K, Kuppuswamy Sathyanarayanan

On Tue, Apr 16, 2024 at 09:06:40PM +0300, Andy Shevchenko wrote:
> On Tue, Apr 16, 2024 at 08:09:16AM -0700, Nathan Chancellor wrote:
> > On Tue, Apr 16, 2024 at 04:06:23PM +0300, Andy Shevchenko wrote:
> > > On Tue, Apr 16, 2024 at 10:35:55AM +0800, kernel test robot wrote:
> > > > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git review-hans
> > > > head:   0aae4c44b032b5ede39405dfc62900adc467f362
> > > > commit: 2dc77993cb5eb311d6bb5584d30c3d1d42d9fa4a [40/59] platform/x86/amd/pmc: Add AMD MP2 STB functionality
> > > > config: i386-randconfig-011-20240416 (https://download.01.org/0day-ci/archive/20240416/202404161050.NSNJAxvX-lkp@intel.com/config)
> > > > compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
> > > > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240416/202404161050.NSNJAxvX-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/202404161050.NSNJAxvX-lkp@intel.com/
> > > > 
> > > > All errors (new ones prefixed by >>):
> > > > 
> > > > >> drivers/platform/x86/amd/pmc/mp2_stb.c:94:2: error: call to undeclared function 'writeq'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
> > > >       94 |         writeq(mp2->dma_addr, mp2->mmio + AMD_C2P_MSG1);
> > > >          |         ^
> > > >    drivers/platform/x86/amd/pmc/mp2_stb.c:267:45: warning: shift count >= width of type [-Wshift-count-overflow]
> > > >      267 |         rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
> > > >          |                                                    ^~~~~~~~~~~~~~~~
> > > >    include/linux/dma-mapping.h:77:54: note: expanded from macro 'DMA_BIT_MASK'
> > > >       77 | #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
> > > >          |                                                      ^ ~~~
> > > >    1 warning and 1 error generated.
> > > 
> > > This is bogus, but can perhaps be 'fixed" with GENMASK((n) - 1, 0).
> > 
> > The second warning only appears because of the first error; if the first
> > error is fixed, I suspect the second one won't appear (although I have
> > not actually checked it).
> 
> Is it confirmed? Because to me it looks not obvious at all ==> complier can be
> amended as well in warning reporting

Yes, I see no error or warning with the following diff on top of
2dc77993cb5eb311d6bb5584d30c3d1d42d9fa4a. I am not saying that is not an
issue that should be addressed, I am just explaining why the warning is
showing up at all. It happens with -Warray-bounds occasionally as well.

diff --git a/drivers/platform/x86/amd/pmc/mp2_stb.c b/drivers/platform/x86/amd/pmc/mp2_stb.c
index dfa55327e5f1..9775ddc1b27a 100644
--- a/drivers/platform/x86/amd/pmc/mp2_stb.c
+++ b/drivers/platform/x86/amd/pmc/mp2_stb.c
@@ -11,6 +11,7 @@
 #include <linux/debugfs.h>
 #include <linux/device.h>
 #include <linux/io.h>
+#include <linux/io-64-nonatomic-lo-hi.h>
 #include <linux/iopoll.h>
 #include <linux/pci.h>
 #include <linux/sizes.h>

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [pdx86-platform-drivers-x86:review-hans 40/59] drivers/platform/x86/amd/pmc/mp2_stb.c:94:2: error: call to undeclared function 'writeq'; ISO C99 and later do not support implicit function declarations
  2024-04-16 18:17       ` Nathan Chancellor
@ 2024-04-16 19:21         ` Andy Shevchenko
  0 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2024-04-16 19:21 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: kernel test robot, Basavaraj Natikar, llvm, oe-kbuild-all,
	Hans de Goede, Shyam Sundar S K, Kuppuswamy Sathyanarayanan

On Tue, Apr 16, 2024 at 11:17:15AM -0700, Nathan Chancellor wrote:
> On Tue, Apr 16, 2024 at 09:06:40PM +0300, Andy Shevchenko wrote:
> > On Tue, Apr 16, 2024 at 08:09:16AM -0700, Nathan Chancellor wrote:
> > > On Tue, Apr 16, 2024 at 04:06:23PM +0300, Andy Shevchenko wrote:
> > > > On Tue, Apr 16, 2024 at 10:35:55AM +0800, kernel test robot wrote:
> > > > > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git review-hans
> > > > > head:   0aae4c44b032b5ede39405dfc62900adc467f362
> > > > > commit: 2dc77993cb5eb311d6bb5584d30c3d1d42d9fa4a [40/59] platform/x86/amd/pmc: Add AMD MP2 STB functionality
> > > > > config: i386-randconfig-011-20240416 (https://download.01.org/0day-ci/archive/20240416/202404161050.NSNJAxvX-lkp@intel.com/config)
> > > > > compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
> > > > > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240416/202404161050.NSNJAxvX-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/202404161050.NSNJAxvX-lkp@intel.com/
> > > > > 
> > > > > All errors (new ones prefixed by >>):
> > > > > 
> > > > > >> drivers/platform/x86/amd/pmc/mp2_stb.c:94:2: error: call to undeclared function 'writeq'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
> > > > >       94 |         writeq(mp2->dma_addr, mp2->mmio + AMD_C2P_MSG1);
> > > > >          |         ^
> > > > >    drivers/platform/x86/amd/pmc/mp2_stb.c:267:45: warning: shift count >= width of type [-Wshift-count-overflow]
> > > > >      267 |         rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
> > > > >          |                                                    ^~~~~~~~~~~~~~~~
> > > > >    include/linux/dma-mapping.h:77:54: note: expanded from macro 'DMA_BIT_MASK'
> > > > >       77 | #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
> > > > >          |                                                      ^ ~~~
> > > > >    1 warning and 1 error generated.
> > > > 
> > > > This is bogus, but can perhaps be 'fixed" with GENMASK((n) - 1, 0).
> > > 
> > > The second warning only appears because of the first error; if the first
> > > error is fixed, I suspect the second one won't appear (although I have
> > > not actually checked it).
> > 
> > Is it confirmed? Because to me it looks not obvious at all ==> complier can be
> > amended as well in warning reporting
> 
> Yes, I see no error or warning with the following diff on top of
> 2dc77993cb5eb311d6bb5584d30c3d1d42d9fa4a. I am not saying that is not an
> issue that should be addressed, I am just explaining why the warning is
> showing up at all.

Yes and this is confusing.

> It happens with -Warray-bounds occasionally as well.

There is a ternary that definitely makes it never happen. How does compiler
miss that?

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-04-16 19:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-16  2:35 [pdx86-platform-drivers-x86:review-hans 40/59] drivers/platform/x86/amd/pmc/mp2_stb.c:94:2: error: call to undeclared function 'writeq'; ISO C99 and later do not support implicit function declarations kernel test robot
2024-04-16 13:06 ` Andy Shevchenko
2024-04-16 15:09   ` Nathan Chancellor
2024-04-16 18:06     ` Andy Shevchenko
2024-04-16 18:17       ` Nathan Chancellor
2024-04-16 19:21         ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox