linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* drivers/remoteproc/pru_rproc.c:145 pru_d_da_to_va() warn: always true condition '(da >= 0) => (0-u32max >= 0)'
@ 2021-07-28 13:23 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2021-07-28 13:23 UTC (permalink / raw)
  To: Suman Anna
  Cc: kbuild-all, linux-kernel, Bjorn Andersson, Andrew F. Davis,
	Grzegorz Jaszczyk, Mathieu Poirier

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   7d549995d4e0d99b68e8a7793a0d23da6fc40fe8
commit: d4ce2de7e4af8b978eb816784d0eafc220336d52 remoteproc: pru: Add a PRU remoteproc driver
date:   8 months ago
config: arm64-randconfig-m031-20210728 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 10.3.0

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

smatch warnings:
drivers/remoteproc/pru_rproc.c:145 pru_d_da_to_va() warn: always true condition '(da >= 0) => (0-u32max >= 0)'
drivers/remoteproc/pru_rproc.c:176 pru_i_da_to_va() warn: always true condition '(da >= 0) => (0-u32max >= 0)'

vim +145 drivers/remoteproc/pru_rproc.c

   118	
   119	/*
   120	 * Convert PRU device address (data spaces only) to kernel virtual address.
   121	 *
   122	 * Each PRU has access to all data memories within the PRUSS, accessible at
   123	 * different ranges. So, look through both its primary and secondary Data
   124	 * RAMs as well as any shared Data RAM to convert a PRU device address to
   125	 * kernel virtual address. Data RAM0 is primary Data RAM for PRU0 and Data
   126	 * RAM1 is primary Data RAM for PRU1.
   127	 */
   128	static void *pru_d_da_to_va(struct pru_rproc *pru, u32 da, size_t len)
   129	{
   130		struct pruss_mem_region dram0, dram1, shrd_ram;
   131		struct pruss *pruss = pru->pruss;
   132		u32 offset;
   133		void *va = NULL;
   134	
   135		if (len == 0)
   136			return NULL;
   137	
   138		dram0 = pruss->mem_regions[PRUSS_MEM_DRAM0];
   139		dram1 = pruss->mem_regions[PRUSS_MEM_DRAM1];
   140		/* PRU1 has its local RAM addresses reversed */
   141		if (pru->id == 1)
   142			swap(dram0, dram1);
   143		shrd_ram = pruss->mem_regions[PRUSS_MEM_SHRD_RAM2];
   144	
 > 145		if (da >= PRU_PDRAM_DA && da + len <= PRU_PDRAM_DA + dram0.size) {
   146			offset = da - PRU_PDRAM_DA;
   147			va = (__force void *)(dram0.va + offset);
   148		} else if (da >= PRU_SDRAM_DA &&
   149			   da + len <= PRU_SDRAM_DA + dram1.size) {
   150			offset = da - PRU_SDRAM_DA;
   151			va = (__force void *)(dram1.va + offset);
   152		} else if (da >= PRU_SHRDRAM_DA &&
   153			   da + len <= PRU_SHRDRAM_DA + shrd_ram.size) {
   154			offset = da - PRU_SHRDRAM_DA;
   155			va = (__force void *)(shrd_ram.va + offset);
   156		}
   157	
   158		return va;
   159	}
   160	
   161	/*
   162	 * Convert PRU device address (instruction space) to kernel virtual address.
   163	 *
   164	 * A PRU does not have an unified address space. Each PRU has its very own
   165	 * private Instruction RAM, and its device address is identical to that of
   166	 * its primary Data RAM device address.
   167	 */
   168	static void *pru_i_da_to_va(struct pru_rproc *pru, u32 da, size_t len)
   169	{
   170		u32 offset;
   171		void *va = NULL;
   172	
   173		if (len == 0)
   174			return NULL;
   175	
 > 176		if (da >= PRU_IRAM_DA &&
   177		    da + len <= PRU_IRAM_DA + pru->mem_regions[PRU_IOMEM_IRAM].size) {
   178			offset = da - PRU_IRAM_DA;
   179			va = (__force void *)(pru->mem_regions[PRU_IOMEM_IRAM].va +
   180					      offset);
   181		}
   182	
   183		return va;
   184	}
   185	

---
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: 36500 bytes --]

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

* drivers/remoteproc/pru_rproc.c:145 pru_d_da_to_va() warn: always true condition '(da >= 0) => (0-u32max >= 0)'
@ 2021-05-04 13:39 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2021-05-04 13:39 UTC (permalink / raw)
  To: Suman Anna
  Cc: kbuild-all, linux-kernel, Bjorn Andersson, Andrew F. Davis,
	Grzegorz Jaszczyk, Mathieu Poirier

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   5e321ded302da4d8c5d5dd953423d9b748ab3775
commit: d4ce2de7e4af8b978eb816784d0eafc220336d52 remoteproc: pru: Add a PRU remoteproc driver
date:   5 months ago
config: arm64-randconfig-m031-20210504 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0

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

smatch warnings:
drivers/remoteproc/pru_rproc.c:145 pru_d_da_to_va() warn: always true condition '(da >= 0) => (0-u32max >= 0)'
drivers/remoteproc/pru_rproc.c:176 pru_i_da_to_va() warn: always true condition '(da >= 0) => (0-u32max >= 0)'

vim +145 drivers/remoteproc/pru_rproc.c

   118	
   119	/*
   120	 * Convert PRU device address (data spaces only) to kernel virtual address.
   121	 *
   122	 * Each PRU has access to all data memories within the PRUSS, accessible at
   123	 * different ranges. So, look through both its primary and secondary Data
   124	 * RAMs as well as any shared Data RAM to convert a PRU device address to
   125	 * kernel virtual address. Data RAM0 is primary Data RAM for PRU0 and Data
   126	 * RAM1 is primary Data RAM for PRU1.
   127	 */
   128	static void *pru_d_da_to_va(struct pru_rproc *pru, u32 da, size_t len)
   129	{
   130		struct pruss_mem_region dram0, dram1, shrd_ram;
   131		struct pruss *pruss = pru->pruss;
   132		u32 offset;
   133		void *va = NULL;
   134	
   135		if (len == 0)
   136			return NULL;
   137	
   138		dram0 = pruss->mem_regions[PRUSS_MEM_DRAM0];
   139		dram1 = pruss->mem_regions[PRUSS_MEM_DRAM1];
   140		/* PRU1 has its local RAM addresses reversed */
   141		if (pru->id == 1)
   142			swap(dram0, dram1);
   143		shrd_ram = pruss->mem_regions[PRUSS_MEM_SHRD_RAM2];
   144	
 > 145		if (da >= PRU_PDRAM_DA && da + len <= PRU_PDRAM_DA + dram0.size) {
   146			offset = da - PRU_PDRAM_DA;
   147			va = (__force void *)(dram0.va + offset);
   148		} else if (da >= PRU_SDRAM_DA &&
   149			   da + len <= PRU_SDRAM_DA + dram1.size) {
   150			offset = da - PRU_SDRAM_DA;
   151			va = (__force void *)(dram1.va + offset);
   152		} else if (da >= PRU_SHRDRAM_DA &&
   153			   da + len <= PRU_SHRDRAM_DA + shrd_ram.size) {
   154			offset = da - PRU_SHRDRAM_DA;
   155			va = (__force void *)(shrd_ram.va + offset);
   156		}
   157	
   158		return va;
   159	}
   160	
   161	/*
   162	 * Convert PRU device address (instruction space) to kernel virtual address.
   163	 *
   164	 * A PRU does not have an unified address space. Each PRU has its very own
   165	 * private Instruction RAM, and its device address is identical to that of
   166	 * its primary Data RAM device address.
   167	 */
   168	static void *pru_i_da_to_va(struct pru_rproc *pru, u32 da, size_t len)
   169	{
   170		u32 offset;
   171		void *va = NULL;
   172	
   173		if (len == 0)
   174			return NULL;
   175	
 > 176		if (da >= PRU_IRAM_DA &&
   177		    da + len <= PRU_IRAM_DA + pru->mem_regions[PRU_IOMEM_IRAM].size) {
   178			offset = da - PRU_IRAM_DA;
   179			va = (__force void *)(pru->mem_regions[PRU_IOMEM_IRAM].va +
   180					      offset);
   181		}
   182	
   183		return va;
   184	}
   185	

---
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: 28959 bytes --]

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

* drivers/remoteproc/pru_rproc.c:145 pru_d_da_to_va() warn: always true condition '(da >= 0) => (0-u32max >= 0)'
@ 2021-03-25 21:22 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2021-03-25 21:22 UTC (permalink / raw)
  To: Suman Anna
  Cc: kbuild-all, linux-kernel, Bjorn Andersson, Andrew F. Davis,
	Grzegorz Jaszczyk, Mathieu Poirier

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   e138138003eb3b3d06cc91cf2e8c5dec77e2a31e
commit: d4ce2de7e4af8b978eb816784d0eafc220336d52 remoteproc: pru: Add a PRU remoteproc driver
date:   4 months ago
config: arm64-randconfig-m031-20210325 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0

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

smatch warnings:
drivers/remoteproc/pru_rproc.c:145 pru_d_da_to_va() warn: always true condition '(da >= 0) => (0-u32max >= 0)'
drivers/remoteproc/pru_rproc.c:176 pru_i_da_to_va() warn: always true condition '(da >= 0) => (0-u32max >= 0)'

vim +145 drivers/remoteproc/pru_rproc.c

   118	
   119	/*
   120	 * Convert PRU device address (data spaces only) to kernel virtual address.
   121	 *
   122	 * Each PRU has access to all data memories within the PRUSS, accessible at
   123	 * different ranges. So, look through both its primary and secondary Data
   124	 * RAMs as well as any shared Data RAM to convert a PRU device address to
   125	 * kernel virtual address. Data RAM0 is primary Data RAM for PRU0 and Data
   126	 * RAM1 is primary Data RAM for PRU1.
   127	 */
   128	static void *pru_d_da_to_va(struct pru_rproc *pru, u32 da, size_t len)
   129	{
   130		struct pruss_mem_region dram0, dram1, shrd_ram;
   131		struct pruss *pruss = pru->pruss;
   132		u32 offset;
   133		void *va = NULL;
   134	
   135		if (len == 0)
   136			return NULL;
   137	
   138		dram0 = pruss->mem_regions[PRUSS_MEM_DRAM0];
   139		dram1 = pruss->mem_regions[PRUSS_MEM_DRAM1];
   140		/* PRU1 has its local RAM addresses reversed */
   141		if (pru->id == 1)
   142			swap(dram0, dram1);
   143		shrd_ram = pruss->mem_regions[PRUSS_MEM_SHRD_RAM2];
   144	
 > 145		if (da >= PRU_PDRAM_DA && da + len <= PRU_PDRAM_DA + dram0.size) {
   146			offset = da - PRU_PDRAM_DA;
   147			va = (__force void *)(dram0.va + offset);
   148		} else if (da >= PRU_SDRAM_DA &&
   149			   da + len <= PRU_SDRAM_DA + dram1.size) {
   150			offset = da - PRU_SDRAM_DA;
   151			va = (__force void *)(dram1.va + offset);
   152		} else if (da >= PRU_SHRDRAM_DA &&
   153			   da + len <= PRU_SHRDRAM_DA + shrd_ram.size) {
   154			offset = da - PRU_SHRDRAM_DA;
   155			va = (__force void *)(shrd_ram.va + offset);
   156		}
   157	
   158		return va;
   159	}
   160	
   161	/*
   162	 * Convert PRU device address (instruction space) to kernel virtual address.
   163	 *
   164	 * A PRU does not have an unified address space. Each PRU has its very own
   165	 * private Instruction RAM, and its device address is identical to that of
   166	 * its primary Data RAM device address.
   167	 */
   168	static void *pru_i_da_to_va(struct pru_rproc *pru, u32 da, size_t len)
   169	{
   170		u32 offset;
   171		void *va = NULL;
   172	
   173		if (len == 0)
   174			return NULL;
   175	
 > 176		if (da >= PRU_IRAM_DA &&
   177		    da + len <= PRU_IRAM_DA + pru->mem_regions[PRU_IOMEM_IRAM].size) {
   178			offset = da - PRU_IRAM_DA;
   179			va = (__force void *)(pru->mem_regions[PRU_IOMEM_IRAM].va +
   180					      offset);
   181		}
   182	
   183		return va;
   184	}
   185	

---
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: 39836 bytes --]

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

end of thread, other threads:[~2021-07-28 13:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-28 13:23 drivers/remoteproc/pru_rproc.c:145 pru_d_da_to_va() warn: always true condition '(da >= 0) => (0-u32max >= 0)' kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2021-05-04 13:39 kernel test robot
2021-03-25 21:22 kernel test robot

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