linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* drivers/media/pci/intel/ipu3/ipu3-cio2.c:163:56: warning: implicit conversion from 'unsigned long' to 'u16' (aka 'unsigned short') changes value from 131072 to 0
@ 2020-11-21  8:23 kernel test robot
  2020-11-23 10:40 ` Andy Shevchenko
  0 siblings, 1 reply; 6+ messages in thread
From: kernel test robot @ 2020-11-21  8:23 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: kbuild-all, clang-built-linux, linux-kernel,
	Mauro Carvalho Chehab, linux-media, Sakari Ailus

[-- Attachment #1: Type: text/plain, Size: 2539 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   27bba9c532a8d21050b94224ffd310ad0058c353
commit: 7b285f41f7376dc37e7fad1e803995fd39f42848 media: ipu3-cio2: Introduce CIO2_LOP_ENTRIES constant
date:   2 months ago
config: arm64-randconfig-r031-20201121 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project bec968cbb367dd03439c89c1d4ef968ef662d7c0)
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 arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7b285f41f7376dc37e7fad1e803995fd39f42848
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 7b285f41f7376dc37e7fad1e803995fd39f42848
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 

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

All warnings (new ones prefixed by >>):

>> drivers/media/pci/intel/ipu3/ipu3-cio2.c:163:56: warning: implicit conversion from 'unsigned long' to 'u16' (aka 'unsigned short') changes value from 131072 to 0 [-Wconstant-conversion]
           entry[1].second_entry.num_of_pages = CIO2_LOP_ENTRIES * CIO2_MAX_LOPS;
                                              ~ ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
   1 warning generated.

vim +163 drivers/media/pci/intel/ipu3/ipu3-cio2.c

   154	
   155	/* Initialize fpbt entries to point to dummy frame */
   156	static void cio2_fbpt_entry_init_dummy(struct cio2_device *cio2,
   157					       struct cio2_fbpt_entry
   158					       entry[CIO2_MAX_LOPS])
   159	{
   160		unsigned int i;
   161	
   162		entry[0].first_entry.first_page_offset = 0;
 > 163		entry[1].second_entry.num_of_pages = CIO2_LOP_ENTRIES * CIO2_MAX_LOPS;
   164		entry[1].second_entry.last_page_available_bytes = CIO2_PAGE_SIZE - 1;
   165	
   166		for (i = 0; i < CIO2_MAX_LOPS; i++)
   167			entry[i].lop_page_addr = cio2->dummy_lop_bus_addr >> PAGE_SHIFT;
   168	
   169		cio2_fbpt_entry_enable(cio2, entry);
   170	}
   171	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 44874 bytes --]

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

* Re: drivers/media/pci/intel/ipu3/ipu3-cio2.c:163:56: warning: implicit conversion from 'unsigned long' to 'u16' (aka 'unsigned short') changes value from 131072 to 0
  2020-11-21  8:23 drivers/media/pci/intel/ipu3/ipu3-cio2.c:163:56: warning: implicit conversion from 'unsigned long' to 'u16' (aka 'unsigned short') changes value from 131072 to 0 kernel test robot
@ 2020-11-23 10:40 ` Andy Shevchenko
  2020-12-11 16:56   ` Sakari Ailus
  0 siblings, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2020-11-23 10:40 UTC (permalink / raw)
  To: kernel test robot
  Cc: kbuild-all, clang-built-linux, linux-kernel,
	Mauro Carvalho Chehab, linux-media, Sakari Ailus

On Sat, Nov 21, 2020 at 04:23:05PM +0800, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   27bba9c532a8d21050b94224ffd310ad0058c353
> commit: 7b285f41f7376dc37e7fad1e803995fd39f42848 media: ipu3-cio2: Introduce CIO2_LOP_ENTRIES constant
> date:   2 months ago
> config: arm64-randconfig-r031-20201121 (attached as .config)
> compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project bec968cbb367dd03439c89c1d4ef968ef662d7c0)
> 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 arm64 cross compiling tool for clang build
>         # apt-get install binutils-aarch64-linux-gnu
>         # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7b285f41f7376dc37e7fad1e803995fd39f42848
>         git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>         git fetch --no-tags linus master
>         git checkout 7b285f41f7376dc37e7fad1e803995fd39f42848
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All warnings (new ones prefixed by >>):
> 
> >> drivers/media/pci/intel/ipu3/ipu3-cio2.c:163:56: warning: implicit conversion from 'unsigned long' to 'u16' (aka 'unsigned short') changes value from 131072 to 0 [-Wconstant-conversion]
>            entry[1].second_entry.num_of_pages = CIO2_LOP_ENTRIES * CIO2_MAX_LOPS;
>                                               ~ ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
>    1 warning generated.

Okay, now we have an interesting case. The IP is quite unlikely be used on
ARM64, but my patches made the clear picture about use of PAGE_SIZE here.

So, I see at least the following options to mitigate the above, i.e.:
 1/ reduce driver scope to X86
 2/ fix the variables to be wider type to be able to hold PAGE_SIZE > 4k
 3/ switch to custom PAGE_SIZE / _SHIFT / _MASK and accompanying macros

And I still consider 3/ is silly move because as we see the driver was
never assumed to work with big page sizes (besides unsigned short type
here, PAGE_SHIFT and PAGE_MASK in the original code was as is and on ARM64
they compiled to 0 values w/o warnings, effectively make the driver
improperly functioning anyway).


-- 
With Best Regards,
Andy Shevchenko



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

* Re: drivers/media/pci/intel/ipu3/ipu3-cio2.c:163:56: warning: implicit conversion from 'unsigned long' to 'u16' (aka 'unsigned short') changes value from 131072 to 0
  2020-11-23 10:40 ` Andy Shevchenko
@ 2020-12-11 16:56   ` Sakari Ailus
  2020-12-14 15:29     ` Andy Shevchenko
  0 siblings, 1 reply; 6+ messages in thread
From: Sakari Ailus @ 2020-12-11 16:56 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: kernel test robot, kbuild-all, clang-built-linux, linux-kernel,
	Mauro Carvalho Chehab, linux-media

Hi Andy,

On Mon, Nov 23, 2020 at 12:40:18PM +0200, Andy Shevchenko wrote:
> On Sat, Nov 21, 2020 at 04:23:05PM +0800, kernel test robot wrote:
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > head:   27bba9c532a8d21050b94224ffd310ad0058c353
> > commit: 7b285f41f7376dc37e7fad1e803995fd39f42848 media: ipu3-cio2: Introduce CIO2_LOP_ENTRIES constant
> > date:   2 months ago
> > config: arm64-randconfig-r031-20201121 (attached as .config)
> > compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project bec968cbb367dd03439c89c1d4ef968ef662d7c0)
> > 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 arm64 cross compiling tool for clang build
> >         # apt-get install binutils-aarch64-linux-gnu
> >         # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7b285f41f7376dc37e7fad1e803995fd39f42848
> >         git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> >         git fetch --no-tags linus master
> >         git checkout 7b285f41f7376dc37e7fad1e803995fd39f42848
> >         # save the attached .config to linux build tree
> >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 
> > 
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@intel.com>
> > 
> > All warnings (new ones prefixed by >>):
> > 
> > >> drivers/media/pci/intel/ipu3/ipu3-cio2.c:163:56: warning: implicit conversion from 'unsigned long' to 'u16' (aka 'unsigned short') changes value from 131072 to 0 [-Wconstant-conversion]
> >            entry[1].second_entry.num_of_pages = CIO2_LOP_ENTRIES * CIO2_MAX_LOPS;
> >                                               ~ ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
> >    1 warning generated.
> 
> Okay, now we have an interesting case. The IP is quite unlikely be used on
> ARM64, but my patches made the clear picture about use of PAGE_SIZE here.
> 
> So, I see at least the following options to mitigate the above, i.e.:
>  1/ reduce driver scope to X86
>  2/ fix the variables to be wider type to be able to hold PAGE_SIZE > 4k
>  3/ switch to custom PAGE_SIZE / _SHIFT / _MASK and accompanying macros
> 
> And I still consider 3/ is silly move because as we see the driver was
> never assumed to work with big page sizes (besides unsigned short type
> here, PAGE_SHIFT and PAGE_MASK in the original code was as is and on ARM64
> they compiled to 0 values w/o warnings, effectively make the driver
> improperly functioning anyway).

Apologies for the late answer.

I think I'd favour the first option. It's not really useful to be able to
compile this elsewhere; as such the driver doesn't do anything special that
would make it prone to breakage through changes elsewhere.

Would you like to send a patch? :-)

-- 
Kind regards,

Sakari Ailus

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

* Re: drivers/media/pci/intel/ipu3/ipu3-cio2.c:163:56: warning: implicit conversion from 'unsigned long' to 'u16' (aka 'unsigned short') changes value from 131072 to 0
  2020-12-11 16:56   ` Sakari Ailus
@ 2020-12-14 15:29     ` Andy Shevchenko
  0 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2020-12-14 15:29 UTC (permalink / raw)
  To: Sakari Ailus
  Cc: kernel test robot, kbuild-all, clang-built-linux, linux-kernel,
	Mauro Carvalho Chehab, linux-media

On Fri, Dec 11, 2020 at 06:56:14PM +0200, Sakari Ailus wrote:
> On Mon, Nov 23, 2020 at 12:40:18PM +0200, Andy Shevchenko wrote:
> > On Sat, Nov 21, 2020 at 04:23:05PM +0800, kernel test robot wrote:

...

> > > All warnings (new ones prefixed by >>):
> > > 
> > > >> drivers/media/pci/intel/ipu3/ipu3-cio2.c:163:56: warning: implicit conversion from 'unsigned long' to 'u16' (aka 'unsigned short') changes value from 131072 to 0 [-Wconstant-conversion]
> > >            entry[1].second_entry.num_of_pages = CIO2_LOP_ENTRIES * CIO2_MAX_LOPS;
> > >                                               ~ ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
> > >    1 warning generated.
> > 
> > Okay, now we have an interesting case. The IP is quite unlikely be used on
> > ARM64, but my patches made the clear picture about use of PAGE_SIZE here.
> > 
> > So, I see at least the following options to mitigate the above, i.e.:
> >  1/ reduce driver scope to X86
> >  2/ fix the variables to be wider type to be able to hold PAGE_SIZE > 4k
> >  3/ switch to custom PAGE_SIZE / _SHIFT / _MASK and accompanying macros
> > 
> > And I still consider 3/ is silly move because as we see the driver was
> > never assumed to work with big page sizes (besides unsigned short type
> > here, PAGE_SHIFT and PAGE_MASK in the original code was as is and on ARM64
> > they compiled to 0 values w/o warnings, effectively make the driver
> > improperly functioning anyway).
> 
> Apologies for the late answer.
> 
> I think I'd favour the first option. It's not really useful to be able to
> compile this elsewhere; as such the driver doesn't do anything special that
> would make it prone to breakage through changes elsewhere.
> 
> Would you like to send a patch? :-)

Done.

-- 
With Best Regards,
Andy Shevchenko



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

* Re: drivers/media/pci/intel/ipu3/ipu3-cio2.c:163:56: warning: implicit conversion from 'unsigned long' to 'u16' (aka 'unsigned short') changes value from 131072 to 0
  2021-01-04 23:16 kernel test robot
@ 2021-01-04 23:24 ` Sakari Ailus
  0 siblings, 0 replies; 6+ messages in thread
From: Sakari Ailus @ 2021-01-04 23:24 UTC (permalink / raw)
  To: kernel test robot
  Cc: Andy Shevchenko, kbuild-all, clang-built-linux, linux-kernel,
	Mauro Carvalho Chehab, linux-media

On Tue, Jan 05, 2021 at 07:16:37AM +0800, kernel test robot wrote:
> Hi Andy,
> 
> FYI, the error/warning still remains.

The patch is in a pull request to Mauro now:

<URL:https://lore.kernel.org/linux-media/20210104120612.GB850@valkosipuli.retiisi.org.uk/T/#t>

-- 
Sakari Ailus

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

* drivers/media/pci/intel/ipu3/ipu3-cio2.c:163:56: warning: implicit conversion from 'unsigned long' to 'u16' (aka 'unsigned short') changes value from 131072 to 0
@ 2021-01-04 23:16 kernel test robot
  2021-01-04 23:24 ` Sakari Ailus
  0 siblings, 1 reply; 6+ messages in thread
From: kernel test robot @ 2021-01-04 23:16 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: kbuild-all, clang-built-linux, linux-kernel,
	Mauro Carvalho Chehab, linux-media, Sakari Ailus

[-- Attachment #1: Type: text/plain, Size: 2589 bytes --]

Hi Andy,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   e71ba9452f0b5b2e8dc8aa5445198cd9214a6a62
commit: 7b285f41f7376dc37e7fad1e803995fd39f42848 media: ipu3-cio2: Introduce CIO2_LOP_ENTRIES constant
date:   4 months ago
config: arm64-randconfig-r005-20210105 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 98cd1c33e3c2c3cfee36fb0fea3285fda06224d3)
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 arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7b285f41f7376dc37e7fad1e803995fd39f42848
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 7b285f41f7376dc37e7fad1e803995fd39f42848
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 

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

All warnings (new ones prefixed by >>):

>> drivers/media/pci/intel/ipu3/ipu3-cio2.c:163:56: warning: implicit conversion from 'unsigned long' to 'u16' (aka 'unsigned short') changes value from 131072 to 0 [-Wconstant-conversion]
           entry[1].second_entry.num_of_pages = CIO2_LOP_ENTRIES * CIO2_MAX_LOPS;
                                              ~ ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
   1 warning generated.


vim +163 drivers/media/pci/intel/ipu3/ipu3-cio2.c

   154	
   155	/* Initialize fpbt entries to point to dummy frame */
   156	static void cio2_fbpt_entry_init_dummy(struct cio2_device *cio2,
   157					       struct cio2_fbpt_entry
   158					       entry[CIO2_MAX_LOPS])
   159	{
   160		unsigned int i;
   161	
   162		entry[0].first_entry.first_page_offset = 0;
 > 163		entry[1].second_entry.num_of_pages = CIO2_LOP_ENTRIES * CIO2_MAX_LOPS;
   164		entry[1].second_entry.last_page_available_bytes = CIO2_PAGE_SIZE - 1;
   165	
   166		for (i = 0; i < CIO2_MAX_LOPS; i++)
   167			entry[i].lop_page_addr = cio2->dummy_lop_bus_addr >> PAGE_SHIFT;
   168	
   169		cio2_fbpt_entry_enable(cio2, entry);
   170	}
   171	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 40965 bytes --]

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

end of thread, other threads:[~2021-01-04 23:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-21  8:23 drivers/media/pci/intel/ipu3/ipu3-cio2.c:163:56: warning: implicit conversion from 'unsigned long' to 'u16' (aka 'unsigned short') changes value from 131072 to 0 kernel test robot
2020-11-23 10:40 ` Andy Shevchenko
2020-12-11 16:56   ` Sakari Ailus
2020-12-14 15:29     ` Andy Shevchenko
2021-01-04 23:16 kernel test robot
2021-01-04 23:24 ` Sakari Ailus

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).