2021-04-28 17:40:27

by Shubhankar Kuranagatti

[permalink] [raw]
Subject: [PATCH] drivers: parisc: ccio-dma.c: Added tab insead of spaces

Single space has been removed.
It has been replaced with tabs.
This is done to maintain code uniformity.

Signed-off-by: Shubhankar Kuranagatti <[email protected]>
---
drivers/parisc/ccio-dma.c | 88 +++++++++++++++++++--------------------
1 file changed, 44 insertions(+), 44 deletions(-)

diff --git a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c
index b5f9ee81a46c..9b777357e8cb 100644
--- a/drivers/parisc/ccio-dma.c
+++ b/drivers/parisc/ccio-dma.c
@@ -111,29 +111,29 @@
#define CMD_TLB_PURGE 33 /* IO_COMMAND to Purge I/O TLB entry */

struct ioa_registers {
- /* Runway Supervisory Set */
- int32_t unused1[12];
- uint32_t io_command; /* Offset 12 */
- uint32_t io_status; /* Offset 13 */
- uint32_t io_control; /* Offset 14 */
- int32_t unused2[1];
-
- /* Runway Auxiliary Register Set */
- uint32_t io_err_resp; /* Offset 0 */
- uint32_t io_err_info; /* Offset 1 */
- uint32_t io_err_req; /* Offset 2 */
- uint32_t io_err_resp_hi; /* Offset 3 */
- uint32_t io_tlb_entry_m; /* Offset 4 */
- uint32_t io_tlb_entry_l; /* Offset 5 */
- uint32_t unused3[1];
- uint32_t io_pdir_base; /* Offset 7 */
- uint32_t io_io_low_hv; /* Offset 8 */
- uint32_t io_io_high_hv; /* Offset 9 */
- uint32_t unused4[1];
- uint32_t io_chain_id_mask; /* Offset 11 */
- uint32_t unused5[2];
- uint32_t io_io_low; /* Offset 14 */
- uint32_t io_io_high; /* Offset 15 */
+ /* Runway Supervisory Set */
+ int32_t unused1[12];
+ uint32_t io_command; /* Offset 12 */
+ uint32_t io_status; /* Offset 13 */
+ uint32_t io_control; /* Offset 14 */
+ int32_t unused2[1];
+
+ /* Runway Auxiliary Register Set */
+ uint32_t io_err_resp; /* Offset 0 */
+ uint32_t io_err_info; /* Offset 1 */
+ uint32_t io_err_req; /* Offset 2 */
+ uint32_t io_err_resp_hi; /* Offset 3 */
+ uint32_t io_tlb_entry_m; /* Offset 4 */
+ uint32_t io_tlb_entry_l; /* Offset 5 */
+ uint32_t unused3[1];
+ uint32_t io_pdir_base; /* Offset 7 */
+ uint32_t io_io_low_hv; /* Offset 8 */
+ uint32_t io_io_high_hv; /* Offset 9 */
+ uint32_t unused4[1];
+ uint32_t io_chain_id_mask; /* Offset 11 */
+ uint32_t unused5[2];
+ uint32_t io_io_low; /* Offset 14 */
+ uint32_t io_io_high; /* Offset 15 */
};

/*
@@ -198,7 +198,7 @@ struct ioa_registers {
** In order for a Runway address to reside within GSC+ extended address space:
** Runway Address [0:7] must identically compare to 8'b11111111
** Runway Address [8:11] must be equal to IO_IO_LOW(_HV)[16:19]
-** Runway Address [12:23] must be greater than or equal to
+** Runway Address [12:23] must be greater than or equal to
** IO_IO_LOW(_HV)[20:31] and less than IO_IO_HIGH(_HV)[20:31].
** Runway Address [24:39] is not used in the comparison.
**
@@ -226,10 +226,10 @@ struct ioc {
struct ioa_registers __iomem *ioc_regs; /* I/O MMU base address */
u8 *res_map; /* resource map, bit == pdir entry */
u64 *pdir_base; /* physical base address */
- u32 pdir_size; /* bytes, function of IOV Space size */
- u32 res_hint; /* next available IOVP -
+ u32 pdir_size; /* bytes, function of IOV Space size */
+ u32 res_hint; /* next available IOVP -
circular search */
- u32 res_size; /* size of resource map in bytes */
+ u32 res_size; /* size of resource map in bytes */
spinlock_t res_lock;

#ifdef CCIO_COLLECT_STATS
@@ -249,7 +249,7 @@ struct ioc {
unsigned short cujo20_bug;

/* STUFF We don't need in performance path */
- u32 chainid_shift; /* specify bit location of chain_id */
+ u32 chainid_shift; /* specify bit location of chain_id */
struct ioc *next; /* Linked list of discovered iocs */
const char *name; /* device name from firmware */
unsigned int hw_path; /* the hardware path this ioc is associatd with */
@@ -293,7 +293,7 @@ static int ioc_count;
** cause the kernel to panic anyhow.
*/
#define CCIO_SEARCH_LOOP(ioc, res_idx, mask, size) \
- for(; res_ptr < res_end; ++res_ptr) { \
+ for (; res_ptr < res_end; ++res_ptr) { \
int ret;\
unsigned int idx;\
idx = (unsigned int)((unsigned long)res_ptr - (unsigned long)ioc->res_map); \
@@ -303,15 +303,15 @@ static int ioc_count;
res_idx = idx;\
ioc->res_hint = res_idx + (size >> 3); \
goto resource_found; \
- } \
+ \
}

#define CCIO_FIND_FREE_MAPPING(ioa, res_idx, mask, size) \
u##size *res_ptr = (u##size *)&((ioc)->res_map[ioa->res_hint & ~((size >> 3) - 1)]); \
u##size *res_end = (u##size *)&(ioc)->res_map[ioa->res_size]; \
- CCIO_SEARCH_LOOP(ioc, res_idx, mask, size); \
- res_ptr = (u##size *)&(ioc)->res_map[0]; \
- CCIO_SEARCH_LOOP(ioa, res_idx, mask, size);
+ CCIO_SEARCH_LOOP(ioc, res_idx, mask, size); \
+ res_ptr = (u##size *)&(ioc)->res_map[0]; \
+ CCIO_SEARCH_LOOP(ioa, res_idx, mask, size);

/*
** Find available bit in this ioa's resource map.
@@ -348,9 +348,9 @@ ccio_alloc_range(struct ioc *ioc, struct device *dev, size_t size)

BUG_ON(pages_needed == 0);
BUG_ON((pages_needed * IOVP_SIZE) > DMA_CHUNK_SIZE);
-
- DBG_RES("%s() size: %d pages_needed %d\n",
- __func__, size, pages_needed);
+
+ DBG_RES("%s() size: %d pages_needed %d\n",
+ __func__, size, pages_needed);

/*
** "seek and ye shall find"...praying never hurts either...
@@ -416,7 +416,7 @@ ccio_alloc_range(struct ioc *ioc, struct device *dev, size_t size)
#define CCIO_FREE_MAPPINGS(ioc, res_idx, mask, size) \
u##size *res_ptr = (u##size *)&((ioc)->res_map[res_idx]); \
BUG_ON((*res_ptr & mask) != mask); \
- *res_ptr &= ~(mask);
+ *res_ptr &= ~(mask);

/**
* ccio_free_range - Free pages from the ioc's resource map.
@@ -845,7 +845,7 @@ static void *
ccio_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flag,
unsigned long attrs)
{
- void *ret;
+ void *ret;
#if 0
/* GRANT Need to establish hierarchy for non-PCI devs as well
** and then provide matching gsc_map_xxx() functions for them as well.
@@ -856,7 +856,7 @@ ccio_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flag,
return 0;
}
#endif
- ret = (void *) __get_free_pages(flag, get_order(size));
+ ret = (void *) __get_free_pages(flag, get_order(size));

if (ret) {
memset(ret, 0, size);
@@ -1022,8 +1022,8 @@ static const struct dma_map_ops ccio_ops = {
.free = ccio_free,
.map_page = ccio_map_page,
.unmap_page = ccio_unmap_page,
- .map_sg = ccio_map_sg,
- .unmap_sg = ccio_unmap_sg,
+ .map_sg = ccio_map_sg,
+ .unmap_sg = ccio_unmap_sg,
.get_sgtable = dma_common_get_sgtable,
.alloc_pages = dma_common_alloc_pages,
.free_pages = dma_common_free_pages,
@@ -1080,7 +1080,7 @@ static int ccio_proc_info(struct seq_file *m, void *p)
max = ioc->usingle_pages - ioc->usg_pages;
seq_printf(m, "pci_unmap_single: %8ld calls %8ld pages (avg %d/1000)\n",
min, max, (int)((max * 1000)/min));
-
+
seq_printf(m, "pci_map_sg() : %8ld calls %8ld pages (avg %d/1000)\n",
ioc->msg_calls, ioc->msg_pages,
(int)((ioc->msg_pages * 1000)/ioc->msg_calls));
@@ -1169,7 +1169,7 @@ void __init ccio_cujo20_fixup(struct parisc_device *cujo, u32 iovp)
idx = PDIR_INDEX(iovp) >> 3;

while (idx < ioc->res_size) {
- res_ptr[idx] |= 0xff;
+ res_ptr[idx] |= 0xff;
idx += PDIR_INDEX(CUJO_20_STEP) >> 3;
}
}
@@ -1297,7 +1297,7 @@ ccio_ioc_init(struct ioc *ioc)
DBG_INIT(" base %p\n", ioc->pdir_base);

/* resource map size dictated by pdir_size */
- ioc->res_size = (ioc->pdir_size / sizeof(u64)) >> 3;
+ ioc->res_size = (ioc->pdir_size / sizeof(u64)) >> 3;
DBG_INIT("%s() res_size 0x%x\n", __func__, ioc->res_size);

ioc->res_map = (u8 *)__get_free_pages(GFP_KERNEL,
--
2.17.1


2021-04-28 20:55:20

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] drivers: parisc: ccio-dma.c: Added tab insead of spaces

Hi Shubhankar,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on hp-parisc/for-next]
[also build test WARNING on v5.12 next-20210428]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Shubhankar-Kuranagatti/drivers-parisc-ccio-dma-c-Added-tab-insead-of-spaces/20210428-235316
base: https://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux.git for-next
config: parisc-defconfig (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.3.0
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
# https://github.com/0day-ci/linux/commit/d69bc48f1b1d854da39ad6d1809d2a009d9d4de3
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Shubhankar-Kuranagatti/drivers-parisc-ccio-dma-c-Added-tab-insead-of-spaces/20210428-235316
git checkout d69bc48f1b1d854da39ad6d1809d2a009d9d4de3
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross W=1 ARCH=parisc

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

drivers/parisc/ccio-dma.c: In function 'ccio_alloc_range':
drivers/parisc/ccio-dma.c:378:4: error: 'else' without a previous 'if'
378 | } else if (pages_needed <= 16) {
| ^~~~
drivers/parisc/ccio-dma.c:380:4: error: 'else' without a previous 'if'
380 | } else if (pages_needed <= 32) {
| ^~~~
drivers/parisc/ccio-dma.c:386:4: error: 'else' without a previous 'if'
386 | } else {
| ^~~~
drivers/parisc/ccio-dma.c:431:1: error: invalid storage class for function 'ccio_free_range'
431 | ccio_free_range(struct ioc *ioc, dma_addr_t iova, unsigned long pages_mapped)
| ^~~~~~~~~~~~~~~
>> drivers/parisc/ccio-dma.c:430:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
430 | static void
| ^~~~~~
drivers/parisc/ccio-dma.c:555:1: warning: 'inline' is not at beginning of declaration [-Wold-style-declaration]
555 | static void CCIO_INLINE
| ^~~~~~
drivers/parisc/ccio-dma.c:556:1: error: invalid storage class for function 'ccio_io_pdir_entry'
556 | ccio_io_pdir_entry(u64 *pdir_ptr, space_t sid, unsigned long vba,
| ^~~~~~~~~~~~~~~~~~
drivers/parisc/ccio-dma.c:627:1: error: invalid storage class for function 'ccio_clear_io_tlb'
627 | ccio_clear_io_tlb(struct ioc *ioc, dma_addr_t iovp, size_t byte_cnt)
| ^~~~~~~~~~~~~~~~~
drivers/parisc/ccio-dma.c:660:1: error: invalid storage class for function 'ccio_mark_invalid'
660 | ccio_mark_invalid(struct ioc *ioc, dma_addr_t iova, size_t byte_cnt)
| ^~~~~~~~~~~~~~~~~
drivers/parisc/ccio-dma.c:702:1: error: invalid storage class for function 'ccio_dma_supported'
702 | ccio_dma_supported(struct device *dev, u64 mask)
| ^~~~~~~~~~~~~~~~~~
drivers/parisc/ccio-dma.c:724:1: error: invalid storage class for function 'ccio_map_single'
724 | ccio_map_single(struct device *dev, void *addr, size_t size,
| ^~~~~~~~~~~~~~~
drivers/parisc/ccio-dma.c:786:1: error: invalid storage class for function 'ccio_map_page'
786 | ccio_map_page(struct device *dev, struct page *page, unsigned long offset,
| ^~~~~~~~~~~~~
drivers/parisc/ccio-dma.c:803:1: error: invalid storage class for function 'ccio_unmap_page'
803 | ccio_unmap_page(struct device *dev, dma_addr_t iova, size_t size,
| ^~~~~~~~~~~~~~~
drivers/parisc/ccio-dma.c:845:1: error: invalid storage class for function 'ccio_alloc'
845 | ccio_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flag,
| ^~~~~~~~~~
drivers/parisc/ccio-dma.c:879:1: error: invalid storage class for function 'ccio_free'
879 | ccio_free(struct device *dev, size_t size, void *cpu_addr,
| ^~~~~~~~~
In file included from drivers/parisc/iommu-helpers.h:2,
from drivers/parisc/ccio-dma.c:896:
include/linux/prefetch.h:55:20: error: invalid storage class for function 'prefetch_range'
55 | static inline void prefetch_range(void *addr, size_t len)
| ^~~~~~~~~~~~~~
include/linux/prefetch.h:66:20: error: invalid storage class for function 'prefetch_page_address'
66 | static inline void prefetch_page_address(struct page *page)
| ^~~~~~~~~~~~~~~~~~~~~
In file included from drivers/parisc/ccio-dma.c:896:
drivers/parisc/iommu-helpers.h:15:1: error: invalid storage class for function 'iommu_fill_pdir'
15 | iommu_fill_pdir(struct ioc *ioc, struct scatterlist *startsg, int nents,
| ^~~~~~~~~~~~~~~
drivers/parisc/iommu-helpers.h:101:1: error: invalid storage class for function 'iommu_coalesce_chunks'
101 | iommu_coalesce_chunks(struct ioc *ioc, struct device *dev,
| ^~~~~~~~~~~~~~~~~~~~~
drivers/parisc/ccio-dma.c:908:1: error: invalid storage class for function 'ccio_map_sg'
908 | ccio_map_sg(struct device *dev, struct scatterlist *sglist, int nents,
| ^~~~~~~~~~~
drivers/parisc/ccio-dma.c:987:1: error: invalid storage class for function 'ccio_unmap_sg'
987 | ccio_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents,
| ^~~~~~~~~~~~~
drivers/parisc/ccio-dma.c:1020:19: error: initializer element is not constant
1020 | .dma_supported = ccio_dma_supported,
| ^~~~~~~~~~~~~~~~~~
drivers/parisc/ccio-dma.c:1020:19: note: (near initialization for 'ccio_ops.dma_supported')
drivers/parisc/ccio-dma.c:1021:12: error: initializer element is not constant
1021 | .alloc = ccio_alloc,
| ^~~~~~~~~~
drivers/parisc/ccio-dma.c:1021:12: note: (near initialization for 'ccio_ops.alloc')
drivers/parisc/ccio-dma.c:1022:12: error: initializer element is not constant
1022 | .free = ccio_free,
| ^~~~~~~~~
drivers/parisc/ccio-dma.c:1022:12: note: (near initialization for 'ccio_ops.free')
drivers/parisc/ccio-dma.c:1023:15: error: initializer element is not constant
1023 | .map_page = ccio_map_page,
| ^~~~~~~~~~~~~
drivers/parisc/ccio-dma.c:1023:15: note: (near initialization for 'ccio_ops.map_page')
drivers/parisc/ccio-dma.c:1024:17: error: initializer element is not constant
1024 | .unmap_page = ccio_unmap_page,
| ^~~~~~~~~~~~~~~
drivers/parisc/ccio-dma.c:1024:17: note: (near initialization for 'ccio_ops.unmap_page')
drivers/parisc/ccio-dma.c:1025:13: error: initializer element is not constant
1025 | .map_sg = ccio_map_sg,
| ^~~~~~~~~~~
drivers/parisc/ccio-dma.c:1025:13: note: (near initialization for 'ccio_ops.map_sg')
drivers/parisc/ccio-dma.c:1026:15: error: initializer element is not constant
1026 | .unmap_sg = ccio_unmap_sg,
| ^~~~~~~~~~~~~
drivers/parisc/ccio-dma.c:1026:15: note: (near initialization for 'ccio_ops.unmap_sg')
drivers/parisc/ccio-dma.c:1033:12: error: invalid storage class for function 'ccio_proc_info'
1033 | static int ccio_proc_info(struct seq_file *m, void *p)
| ^~~~~~~~~~~~~~
drivers/parisc/ccio-dma.c:1099:12: error: invalid storage class for function 'ccio_proc_bitmap_info'
1099 | static int ccio_proc_bitmap_info(struct seq_file *m, void *p)
| ^~~~~~~~~~~~~~~~~~~~~
drivers/parisc/ccio-dma.c:1122:21: error: invalid storage class for function 'ccio_find_ioc'
1122 | static struct ioc * ccio_find_ioc(int hw_path)
| ^~~~~~~~~~~~~
drivers/parisc/ccio-dma.c:1212:12: error: invalid storage class for function 'ccio_probe'
1212 | static int ccio_probe(struct parisc_device *dev);
| ^~~~~~~~~~
drivers/parisc/ccio-dma.c:1217:11: error: 'ccio_probe' undeclared (first use in this function); did you mean 'ccio_free'?
1217 | .probe = ccio_probe,
| ^~~~~~~~~~
| ccio_free
drivers/parisc/ccio-dma.c:1217:11: note: each undeclared identifier is reported only once for each function it appears in
drivers/parisc/ccio-dma.c:1229:1: error: invalid storage class for function 'ccio_ioc_init'
1229 | ccio_ioc_init(struct ioc *ioc)


vim +430 drivers/parisc/ccio-dma.c

^1da177e4c3f41 Linus Torvalds 2005-04-16 415
^1da177e4c3f41 Linus Torvalds 2005-04-16 416 #define CCIO_FREE_MAPPINGS(ioc, res_idx, mask, size) \
^1da177e4c3f41 Linus Torvalds 2005-04-16 417 u##size *res_ptr = (u##size *)&((ioc)->res_map[res_idx]); \
^1da177e4c3f41 Linus Torvalds 2005-04-16 418 BUG_ON((*res_ptr & mask) != mask); \
^1da177e4c3f41 Linus Torvalds 2005-04-16 419 *res_ptr &= ~(mask);
^1da177e4c3f41 Linus Torvalds 2005-04-16 420
^1da177e4c3f41 Linus Torvalds 2005-04-16 421 /**
^1da177e4c3f41 Linus Torvalds 2005-04-16 422 * ccio_free_range - Free pages from the ioc's resource map.
^1da177e4c3f41 Linus Torvalds 2005-04-16 423 * @ioc: The I/O Controller.
^1da177e4c3f41 Linus Torvalds 2005-04-16 424 * @iova: The I/O Virtual Address.
^1da177e4c3f41 Linus Torvalds 2005-04-16 425 * @pages_mapped: The requested number of pages to be freed from the
^1da177e4c3f41 Linus Torvalds 2005-04-16 426 * I/O Pdir.
^1da177e4c3f41 Linus Torvalds 2005-04-16 427 *
^1da177e4c3f41 Linus Torvalds 2005-04-16 428 * This function frees the resouces allocated for the iova.
^1da177e4c3f41 Linus Torvalds 2005-04-16 429 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 @430 static void
^1da177e4c3f41 Linus Torvalds 2005-04-16 431 ccio_free_range(struct ioc *ioc, dma_addr_t iova, unsigned long pages_mapped)
^1da177e4c3f41 Linus Torvalds 2005-04-16 432 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 433 unsigned long iovp = CCIO_IOVP(iova);
^1da177e4c3f41 Linus Torvalds 2005-04-16 434 unsigned int res_idx = PDIR_INDEX(iovp) >> 3;
^1da177e4c3f41 Linus Torvalds 2005-04-16 435
^1da177e4c3f41 Linus Torvalds 2005-04-16 436 BUG_ON(pages_mapped == 0);
^1da177e4c3f41 Linus Torvalds 2005-04-16 437 BUG_ON((pages_mapped * IOVP_SIZE) > DMA_CHUNK_SIZE);
^1da177e4c3f41 Linus Torvalds 2005-04-16 438 BUG_ON(pages_mapped > BITS_PER_LONG);
^1da177e4c3f41 Linus Torvalds 2005-04-16 439
^1da177e4c3f41 Linus Torvalds 2005-04-16 440 DBG_RES("%s(): res_idx: %d pages_mapped %d\n",
a8043ecb17bd2e Harvey Harrison 2008-05-14 441 __func__, res_idx, pages_mapped);
^1da177e4c3f41 Linus Torvalds 2005-04-16 442

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (11.00 kB)
.config.gz (18.02 kB)
Download all attachments

2021-04-28 21:46:58

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] drivers: parisc: ccio-dma.c: Added tab insead of spaces

Hi Shubhankar,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on hp-parisc/for-next]
[also build test ERROR on v5.12 next-20210428]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Shubhankar-Kuranagatti/drivers-parisc-ccio-dma-c-Added-tab-insead-of-spaces/20210428-235316
base: https://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux.git for-next
config: parisc-defconfig (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.3.0
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
# https://github.com/0day-ci/linux/commit/d69bc48f1b1d854da39ad6d1809d2a009d9d4de3
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Shubhankar-Kuranagatti/drivers-parisc-ccio-dma-c-Added-tab-insead-of-spaces/20210428-235316
git checkout d69bc48f1b1d854da39ad6d1809d2a009d9d4de3
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross W=1 ARCH=parisc

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

drivers/parisc/ccio-dma.c: In function 'ccio_alloc_range':
>> drivers/parisc/ccio-dma.c:378:4: error: 'else' without a previous 'if'
378 | } else if (pages_needed <= 16) {
| ^~~~
drivers/parisc/ccio-dma.c:380:4: error: 'else' without a previous 'if'
380 | } else if (pages_needed <= 32) {
| ^~~~
drivers/parisc/ccio-dma.c:386:4: error: 'else' without a previous 'if'
386 | } else {
| ^~~~
>> drivers/parisc/ccio-dma.c:431:1: error: invalid storage class for function 'ccio_free_range'
431 | ccio_free_range(struct ioc *ioc, dma_addr_t iova, unsigned long pages_mapped)
| ^~~~~~~~~~~~~~~
drivers/parisc/ccio-dma.c:430:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
430 | static void
| ^~~~~~
drivers/parisc/ccio-dma.c:555:1: warning: 'inline' is not at beginning of declaration [-Wold-style-declaration]
555 | static void CCIO_INLINE
| ^~~~~~
>> drivers/parisc/ccio-dma.c:556:1: error: invalid storage class for function 'ccio_io_pdir_entry'
556 | ccio_io_pdir_entry(u64 *pdir_ptr, space_t sid, unsigned long vba,
| ^~~~~~~~~~~~~~~~~~
>> drivers/parisc/ccio-dma.c:627:1: error: invalid storage class for function 'ccio_clear_io_tlb'
627 | ccio_clear_io_tlb(struct ioc *ioc, dma_addr_t iovp, size_t byte_cnt)
| ^~~~~~~~~~~~~~~~~
>> drivers/parisc/ccio-dma.c:660:1: error: invalid storage class for function 'ccio_mark_invalid'
660 | ccio_mark_invalid(struct ioc *ioc, dma_addr_t iova, size_t byte_cnt)
| ^~~~~~~~~~~~~~~~~
>> drivers/parisc/ccio-dma.c:702:1: error: invalid storage class for function 'ccio_dma_supported'
702 | ccio_dma_supported(struct device *dev, u64 mask)
| ^~~~~~~~~~~~~~~~~~
>> drivers/parisc/ccio-dma.c:724:1: error: invalid storage class for function 'ccio_map_single'
724 | ccio_map_single(struct device *dev, void *addr, size_t size,
| ^~~~~~~~~~~~~~~
>> drivers/parisc/ccio-dma.c:786:1: error: invalid storage class for function 'ccio_map_page'
786 | ccio_map_page(struct device *dev, struct page *page, unsigned long offset,
| ^~~~~~~~~~~~~
>> drivers/parisc/ccio-dma.c:803:1: error: invalid storage class for function 'ccio_unmap_page'
803 | ccio_unmap_page(struct device *dev, dma_addr_t iova, size_t size,
| ^~~~~~~~~~~~~~~
>> drivers/parisc/ccio-dma.c:845:1: error: invalid storage class for function 'ccio_alloc'
845 | ccio_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flag,
| ^~~~~~~~~~
>> drivers/parisc/ccio-dma.c:879:1: error: invalid storage class for function 'ccio_free'
879 | ccio_free(struct device *dev, size_t size, void *cpu_addr,
| ^~~~~~~~~
In file included from drivers/parisc/iommu-helpers.h:2,
from drivers/parisc/ccio-dma.c:896:
>> include/linux/prefetch.h:55:20: error: invalid storage class for function 'prefetch_range'
55 | static inline void prefetch_range(void *addr, size_t len)
| ^~~~~~~~~~~~~~
>> include/linux/prefetch.h:66:20: error: invalid storage class for function 'prefetch_page_address'
66 | static inline void prefetch_page_address(struct page *page)
| ^~~~~~~~~~~~~~~~~~~~~
In file included from drivers/parisc/ccio-dma.c:896:
>> drivers/parisc/iommu-helpers.h:15:1: error: invalid storage class for function 'iommu_fill_pdir'
15 | iommu_fill_pdir(struct ioc *ioc, struct scatterlist *startsg, int nents,
| ^~~~~~~~~~~~~~~
>> drivers/parisc/iommu-helpers.h:101:1: error: invalid storage class for function 'iommu_coalesce_chunks'
101 | iommu_coalesce_chunks(struct ioc *ioc, struct device *dev,
| ^~~~~~~~~~~~~~~~~~~~~
>> drivers/parisc/ccio-dma.c:908:1: error: invalid storage class for function 'ccio_map_sg'
908 | ccio_map_sg(struct device *dev, struct scatterlist *sglist, int nents,
| ^~~~~~~~~~~
>> drivers/parisc/ccio-dma.c:987:1: error: invalid storage class for function 'ccio_unmap_sg'
987 | ccio_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents,
| ^~~~~~~~~~~~~
>> drivers/parisc/ccio-dma.c:1020:19: error: initializer element is not constant
1020 | .dma_supported = ccio_dma_supported,
| ^~~~~~~~~~~~~~~~~~
drivers/parisc/ccio-dma.c:1020:19: note: (near initialization for 'ccio_ops.dma_supported')
drivers/parisc/ccio-dma.c:1021:12: error: initializer element is not constant
1021 | .alloc = ccio_alloc,
| ^~~~~~~~~~
drivers/parisc/ccio-dma.c:1021:12: note: (near initialization for 'ccio_ops.alloc')
drivers/parisc/ccio-dma.c:1022:12: error: initializer element is not constant
1022 | .free = ccio_free,
| ^~~~~~~~~
drivers/parisc/ccio-dma.c:1022:12: note: (near initialization for 'ccio_ops.free')
drivers/parisc/ccio-dma.c:1023:15: error: initializer element is not constant
1023 | .map_page = ccio_map_page,
| ^~~~~~~~~~~~~
drivers/parisc/ccio-dma.c:1023:15: note: (near initialization for 'ccio_ops.map_page')
drivers/parisc/ccio-dma.c:1024:17: error: initializer element is not constant
1024 | .unmap_page = ccio_unmap_page,
| ^~~~~~~~~~~~~~~
drivers/parisc/ccio-dma.c:1024:17: note: (near initialization for 'ccio_ops.unmap_page')
drivers/parisc/ccio-dma.c:1025:13: error: initializer element is not constant
1025 | .map_sg = ccio_map_sg,
| ^~~~~~~~~~~
drivers/parisc/ccio-dma.c:1025:13: note: (near initialization for 'ccio_ops.map_sg')
drivers/parisc/ccio-dma.c:1026:15: error: initializer element is not constant
1026 | .unmap_sg = ccio_unmap_sg,
| ^~~~~~~~~~~~~
drivers/parisc/ccio-dma.c:1026:15: note: (near initialization for 'ccio_ops.unmap_sg')
>> drivers/parisc/ccio-dma.c:1033:12: error: invalid storage class for function 'ccio_proc_info'
1033 | static int ccio_proc_info(struct seq_file *m, void *p)
| ^~~~~~~~~~~~~~
>> drivers/parisc/ccio-dma.c:1099:12: error: invalid storage class for function 'ccio_proc_bitmap_info'
1099 | static int ccio_proc_bitmap_info(struct seq_file *m, void *p)
| ^~~~~~~~~~~~~~~~~~~~~
drivers/parisc/ccio-dma.c:1122:21: error: invalid storage class for function 'ccio_find_ioc'
1122 | static struct ioc * ccio_find_ioc(int hw_path)
| ^~~~~~~~~~~~~
drivers/parisc/ccio-dma.c:1212:12: error: invalid storage class for function 'ccio_probe'
1212 | static int ccio_probe(struct parisc_device *dev);
| ^~~~~~~~~~
drivers/parisc/ccio-dma.c:1217:11: error: 'ccio_probe' undeclared (first use in this function); did you mean 'ccio_free'?
1217 | .probe = ccio_probe,
| ^~~~~~~~~~
| ccio_free
drivers/parisc/ccio-dma.c:1217:11: note: each undeclared identifier is reported only once for each function it appears in
drivers/parisc/ccio-dma.c:1229:1: error: invalid storage class for function 'ccio_ioc_init'
1229 | ccio_ioc_init(struct ioc *ioc)
| ^~~~~~~~~~~~~
drivers/parisc/ccio-dma.c:1350:1: error: invalid storage class for function 'ccio_init_resource'
1350 | ccio_init_resource(struct resource *res, char *name, void __iomem *ioaddr)
| ^~~~~~~~~~~~~~~~~~
drivers/parisc/ccio-dma.c:1382:20: error: invalid storage class for function 'ccio_init_resources'
1382 | static void __init ccio_init_resources(struct ioc *ioc)
| ^~~~~~~~~~~~~~~~~~~
drivers/parisc/ccio-dma.c:1393:12: error: invalid storage class for function 'new_ioc_area'
1393 | static int new_ioc_area(struct resource *res, unsigned long size,
| ^~~~~~~~~~~~
drivers/parisc/ccio-dma.c:1412:12: error: invalid storage class for function 'expand_ioc_area'
1412 | static int expand_ioc_area(struct resource *res, unsigned long size,
| ^~~~~~~~~~~~~~~
drivers/parisc/ccio-dma.c:1516:19: error: invalid storage class for function 'ccio_probe'
1516 | static int __init ccio_probe(struct parisc_device *dev)
| ^~~~~~~~~~
drivers/parisc/ccio-dma.c:1517: confused by earlier errors, bailing out


vim +378 drivers/parisc/ccio-dma.c

^1da177e4c3f41 Linus Torvalds 2005-04-16 329
^1da177e4c3f41 Linus Torvalds 2005-04-16 330 /**
^1da177e4c3f41 Linus Torvalds 2005-04-16 331 * ccio_alloc_range - Allocate pages in the ioc's resource map.
^1da177e4c3f41 Linus Torvalds 2005-04-16 332 * @ioc: The I/O Controller.
^1da177e4c3f41 Linus Torvalds 2005-04-16 333 * @pages_needed: The requested number of pages to be mapped into the
^1da177e4c3f41 Linus Torvalds 2005-04-16 334 * I/O Pdir...
^1da177e4c3f41 Linus Torvalds 2005-04-16 335 *
^1da177e4c3f41 Linus Torvalds 2005-04-16 336 * This function searches the resource map of the ioc to locate a range
^1da177e4c3f41 Linus Torvalds 2005-04-16 337 * of available pages for the requested size.
^1da177e4c3f41 Linus Torvalds 2005-04-16 338 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 339 static int
7c8cda625acd9b FUJITA Tomonori 2008-03-04 340 ccio_alloc_range(struct ioc *ioc, struct device *dev, size_t size)
^1da177e4c3f41 Linus Torvalds 2005-04-16 341 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 342 unsigned int pages_needed = size >> IOVP_SHIFT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 343 unsigned int res_idx;
466634488e8096 FUJITA Tomonori 2008-03-04 344 unsigned long boundary_size;
1e22166c40a99f Kyle McMartin 2008-07-28 345 #ifdef CCIO_COLLECT_STATS
^1da177e4c3f41 Linus Torvalds 2005-04-16 346 unsigned long cr_start = mfctl(16);
^1da177e4c3f41 Linus Torvalds 2005-04-16 347 #endif
^1da177e4c3f41 Linus Torvalds 2005-04-16 348
^1da177e4c3f41 Linus Torvalds 2005-04-16 349 BUG_ON(pages_needed == 0);
^1da177e4c3f41 Linus Torvalds 2005-04-16 350 BUG_ON((pages_needed * IOVP_SIZE) > DMA_CHUNK_SIZE);
^1da177e4c3f41 Linus Torvalds 2005-04-16 351
^1da177e4c3f41 Linus Torvalds 2005-04-16 352 DBG_RES("%s() size: %d pages_needed %d\n",
a8043ecb17bd2e Harvey Harrison 2008-05-14 353 __func__, size, pages_needed);
^1da177e4c3f41 Linus Torvalds 2005-04-16 354
^1da177e4c3f41 Linus Torvalds 2005-04-16 355 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 356 ** "seek and ye shall find"...praying never hurts either...
^1da177e4c3f41 Linus Torvalds 2005-04-16 357 ** ggg sacrifices another 710 to the computer gods.
^1da177e4c3f41 Linus Torvalds 2005-04-16 358 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 359
1e9d90dbed120e Nicolin Chen 2020-09-01 360 boundary_size = dma_get_seg_boundary_nr_pages(dev, IOVP_SHIFT);
466634488e8096 FUJITA Tomonori 2008-03-04 361
^1da177e4c3f41 Linus Torvalds 2005-04-16 362 if (pages_needed <= 8) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 363 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 364 * LAN traffic will not thrash the TLB IFF the same NIC
4f63ba17086673 Joe Perches 2008-02-03 365 * uses 8 adjacent pages to map separate payload data.
^1da177e4c3f41 Linus Torvalds 2005-04-16 366 * ie the same byte in the resource bit map.
^1da177e4c3f41 Linus Torvalds 2005-04-16 367 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 368 #if 0
^1da177e4c3f41 Linus Torvalds 2005-04-16 369 /* FIXME: bit search should shift it's way through
^1da177e4c3f41 Linus Torvalds 2005-04-16 370 * an unsigned long - not byte at a time. As it is now,
^1da177e4c3f41 Linus Torvalds 2005-04-16 371 * we effectively allocate this byte to this mapping.
^1da177e4c3f41 Linus Torvalds 2005-04-16 372 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 373 unsigned long mask = ~(~0UL >> pages_needed);
^1da177e4c3f41 Linus Torvalds 2005-04-16 374 CCIO_FIND_FREE_MAPPING(ioc, res_idx, mask, 8);
^1da177e4c3f41 Linus Torvalds 2005-04-16 375 #else
^1da177e4c3f41 Linus Torvalds 2005-04-16 376 CCIO_FIND_FREE_MAPPING(ioc, res_idx, 0xff, 8);
^1da177e4c3f41 Linus Torvalds 2005-04-16 377 #endif
^1da177e4c3f41 Linus Torvalds 2005-04-16 @378 } else if (pages_needed <= 16) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 379 CCIO_FIND_FREE_MAPPING(ioc, res_idx, 0xffff, 16);
^1da177e4c3f41 Linus Torvalds 2005-04-16 380 } else if (pages_needed <= 32) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 381 CCIO_FIND_FREE_MAPPING(ioc, res_idx, ~(unsigned int)0, 32);
^1da177e4c3f41 Linus Torvalds 2005-04-16 382 #ifdef __LP64__
^1da177e4c3f41 Linus Torvalds 2005-04-16 383 } else if (pages_needed <= 64) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 384 CCIO_FIND_FREE_MAPPING(ioc, res_idx, ~0UL, 64);
^1da177e4c3f41 Linus Torvalds 2005-04-16 385 #endif
^1da177e4c3f41 Linus Torvalds 2005-04-16 386 } else {
^1da177e4c3f41 Linus Torvalds 2005-04-16 387 panic("%s: %s() Too many pages to map. pages_needed: %u\n",
a8043ecb17bd2e Harvey Harrison 2008-05-14 388 __FILE__, __func__, pages_needed);
^1da177e4c3f41 Linus Torvalds 2005-04-16 389 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 390
^1da177e4c3f41 Linus Torvalds 2005-04-16 391 panic("%s: %s() I/O MMU is out of mapping resources.\n", __FILE__,
a8043ecb17bd2e Harvey Harrison 2008-05-14 392 __func__);
^1da177e4c3f41 Linus Torvalds 2005-04-16 393
^1da177e4c3f41 Linus Torvalds 2005-04-16 394 resource_found:
^1da177e4c3f41 Linus Torvalds 2005-04-16 395
^1da177e4c3f41 Linus Torvalds 2005-04-16 396 DBG_RES("%s() res_idx %d res_hint: %d\n",
a8043ecb17bd2e Harvey Harrison 2008-05-14 397 __func__, res_idx, ioc->res_hint);
^1da177e4c3f41 Linus Torvalds 2005-04-16 398
1e22166c40a99f Kyle McMartin 2008-07-28 399 #ifdef CCIO_COLLECT_STATS
^1da177e4c3f41 Linus Torvalds 2005-04-16 400 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 401 unsigned long cr_end = mfctl(16);
^1da177e4c3f41 Linus Torvalds 2005-04-16 402 unsigned long tmp = cr_end - cr_start;
^1da177e4c3f41 Linus Torvalds 2005-04-16 403 /* check for roll over */
^1da177e4c3f41 Linus Torvalds 2005-04-16 404 cr_start = (cr_end < cr_start) ? -(tmp) : (tmp);
^1da177e4c3f41 Linus Torvalds 2005-04-16 405 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 406 ioc->avg_search[ioc->avg_idx++] = cr_start;
^1da177e4c3f41 Linus Torvalds 2005-04-16 407 ioc->avg_idx &= CCIO_SEARCH_SAMPLE - 1;
^1da177e4c3f41 Linus Torvalds 2005-04-16 408 ioc->used_pages += pages_needed;
^1da177e4c3f41 Linus Torvalds 2005-04-16 409 #endif
^1da177e4c3f41 Linus Torvalds 2005-04-16 410 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 411 ** return the bit address.
^1da177e4c3f41 Linus Torvalds 2005-04-16 412 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 413 return res_idx << 3;
^1da177e4c3f41 Linus Torvalds 2005-04-16 414 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 415
^1da177e4c3f41 Linus Torvalds 2005-04-16 416 #define CCIO_FREE_MAPPINGS(ioc, res_idx, mask, size) \
^1da177e4c3f41 Linus Torvalds 2005-04-16 417 u##size *res_ptr = (u##size *)&((ioc)->res_map[res_idx]); \
^1da177e4c3f41 Linus Torvalds 2005-04-16 418 BUG_ON((*res_ptr & mask) != mask); \
^1da177e4c3f41 Linus Torvalds 2005-04-16 419 *res_ptr &= ~(mask);
^1da177e4c3f41 Linus Torvalds 2005-04-16 420
^1da177e4c3f41 Linus Torvalds 2005-04-16 421 /**
^1da177e4c3f41 Linus Torvalds 2005-04-16 422 * ccio_free_range - Free pages from the ioc's resource map.
^1da177e4c3f41 Linus Torvalds 2005-04-16 423 * @ioc: The I/O Controller.
^1da177e4c3f41 Linus Torvalds 2005-04-16 424 * @iova: The I/O Virtual Address.
^1da177e4c3f41 Linus Torvalds 2005-04-16 425 * @pages_mapped: The requested number of pages to be freed from the
^1da177e4c3f41 Linus Torvalds 2005-04-16 426 * I/O Pdir.
^1da177e4c3f41 Linus Torvalds 2005-04-16 427 *
^1da177e4c3f41 Linus Torvalds 2005-04-16 428 * This function frees the resouces allocated for the iova.
^1da177e4c3f41 Linus Torvalds 2005-04-16 429 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 430 static void
^1da177e4c3f41 Linus Torvalds 2005-04-16 @431 ccio_free_range(struct ioc *ioc, dma_addr_t iova, unsigned long pages_mapped)
^1da177e4c3f41 Linus Torvalds 2005-04-16 432 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 433 unsigned long iovp = CCIO_IOVP(iova);
^1da177e4c3f41 Linus Torvalds 2005-04-16 434 unsigned int res_idx = PDIR_INDEX(iovp) >> 3;
^1da177e4c3f41 Linus Torvalds 2005-04-16 435
^1da177e4c3f41 Linus Torvalds 2005-04-16 436 BUG_ON(pages_mapped == 0);
^1da177e4c3f41 Linus Torvalds 2005-04-16 437 BUG_ON((pages_mapped * IOVP_SIZE) > DMA_CHUNK_SIZE);
^1da177e4c3f41 Linus Torvalds 2005-04-16 438 BUG_ON(pages_mapped > BITS_PER_LONG);
^1da177e4c3f41 Linus Torvalds 2005-04-16 439
^1da177e4c3f41 Linus Torvalds 2005-04-16 440 DBG_RES("%s(): res_idx: %d pages_mapped %d\n",
a8043ecb17bd2e Harvey Harrison 2008-05-14 441 __func__, res_idx, pages_mapped);
^1da177e4c3f41 Linus Torvalds 2005-04-16 442
1e22166c40a99f Kyle McMartin 2008-07-28 443 #ifdef CCIO_COLLECT_STATS
^1da177e4c3f41 Linus Torvalds 2005-04-16 444 ioc->used_pages -= pages_mapped;
^1da177e4c3f41 Linus Torvalds 2005-04-16 445 #endif
^1da177e4c3f41 Linus Torvalds 2005-04-16 446
^1da177e4c3f41 Linus Torvalds 2005-04-16 447 if(pages_mapped <= 8) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 448 #if 0
^1da177e4c3f41 Linus Torvalds 2005-04-16 449 /* see matching comments in alloc_range */
^1da177e4c3f41 Linus Torvalds 2005-04-16 450 unsigned long mask = ~(~0UL >> pages_mapped);
^1da177e4c3f41 Linus Torvalds 2005-04-16 451 CCIO_FREE_MAPPINGS(ioc, res_idx, mask, 8);
^1da177e4c3f41 Linus Torvalds 2005-04-16 452 #else
c18b4608958ff4 Alexander Beregalov 2009-03-19 453 CCIO_FREE_MAPPINGS(ioc, res_idx, 0xffUL, 8);
^1da177e4c3f41 Linus Torvalds 2005-04-16 454 #endif
^1da177e4c3f41 Linus Torvalds 2005-04-16 455 } else if(pages_mapped <= 16) {
c18b4608958ff4 Alexander Beregalov 2009-03-19 456 CCIO_FREE_MAPPINGS(ioc, res_idx, 0xffffUL, 16);
^1da177e4c3f41 Linus Torvalds 2005-04-16 457 } else if(pages_mapped <= 32) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 458 CCIO_FREE_MAPPINGS(ioc, res_idx, ~(unsigned int)0, 32);
^1da177e4c3f41 Linus Torvalds 2005-04-16 459 #ifdef __LP64__
^1da177e4c3f41 Linus Torvalds 2005-04-16 460 } else if(pages_mapped <= 64) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 461 CCIO_FREE_MAPPINGS(ioc, res_idx, ~0UL, 64);
^1da177e4c3f41 Linus Torvalds 2005-04-16 462 #endif
^1da177e4c3f41 Linus Torvalds 2005-04-16 463 } else {
^1da177e4c3f41 Linus Torvalds 2005-04-16 464 panic("%s:%s() Too many pages to unmap.\n", __FILE__,
a8043ecb17bd2e Harvey Harrison 2008-05-14 465 __func__);
^1da177e4c3f41 Linus Torvalds 2005-04-16 466 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 467 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 468
^1da177e4c3f41 Linus Torvalds 2005-04-16 469 /****************************************************************
^1da177e4c3f41 Linus Torvalds 2005-04-16 470 **
^1da177e4c3f41 Linus Torvalds 2005-04-16 471 ** CCIO dma_ops support routines
^1da177e4c3f41 Linus Torvalds 2005-04-16 472 **
^1da177e4c3f41 Linus Torvalds 2005-04-16 473 *****************************************************************/
^1da177e4c3f41 Linus Torvalds 2005-04-16 474
^1da177e4c3f41 Linus Torvalds 2005-04-16 475 typedef unsigned long space_t;
^1da177e4c3f41 Linus Torvalds 2005-04-16 476 #define KERNEL_SPACE 0
^1da177e4c3f41 Linus Torvalds 2005-04-16 477
^1da177e4c3f41 Linus Torvalds 2005-04-16 478 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 479 ** DMA "Page Type" and Hints
^1da177e4c3f41 Linus Torvalds 2005-04-16 480 ** o if SAFE_DMA isn't set, mapping is for FAST_DMA. SAFE_DMA should be
^1da177e4c3f41 Linus Torvalds 2005-04-16 481 ** set for subcacheline DMA transfers since we don't want to damage the
^1da177e4c3f41 Linus Torvalds 2005-04-16 482 ** other part of a cacheline.
^1da177e4c3f41 Linus Torvalds 2005-04-16 483 ** o SAFE_DMA must be set for "memory" allocated via pci_alloc_consistent().
^1da177e4c3f41 Linus Torvalds 2005-04-16 484 ** This bit tells U2 to do R/M/W for partial cachelines. "Streaming"
^1da177e4c3f41 Linus Torvalds 2005-04-16 485 ** data can avoid this if the mapping covers full cache lines.
^1da177e4c3f41 Linus Torvalds 2005-04-16 486 ** o STOP_MOST is needed for atomicity across cachelines.
0779bf2d2ecc4d Matt LaPlante 2006-11-30 487 ** Apparently only "some EISA devices" need this.
^1da177e4c3f41 Linus Torvalds 2005-04-16 488 ** Using CONFIG_ISA is hack. Only the IOA with EISA under it needs
^1da177e4c3f41 Linus Torvalds 2005-04-16 489 ** to use this hint iff the EISA devices needs this feature.
^1da177e4c3f41 Linus Torvalds 2005-04-16 490 ** According to the U2 ERS, STOP_MOST enabled pages hurt performance.
^1da177e4c3f41 Linus Torvalds 2005-04-16 491 ** o PREFETCH should *not* be set for cases like Multiple PCI devices
^1da177e4c3f41 Linus Torvalds 2005-04-16 492 ** behind GSCtoPCI (dino) bus converter. Only one cacheline per GSC
^1da177e4c3f41 Linus Torvalds 2005-04-16 493 ** device can be fetched and multiply DMA streams will thrash the
^1da177e4c3f41 Linus Torvalds 2005-04-16 494 ** prefetch buffer and burn memory bandwidth. See 6.7.3 "Prefetch Rules
^1da177e4c3f41 Linus Torvalds 2005-04-16 495 ** and Invalidation of Prefetch Entries".
^1da177e4c3f41 Linus Torvalds 2005-04-16 496 **
^1da177e4c3f41 Linus Torvalds 2005-04-16 497 ** FIXME: the default hints need to be per GSC device - not global.
^1da177e4c3f41 Linus Torvalds 2005-04-16 498 **
^1da177e4c3f41 Linus Torvalds 2005-04-16 499 ** HP-UX dorks: linux device driver programming model is totally different
^1da177e4c3f41 Linus Torvalds 2005-04-16 500 ** than HP-UX's. HP-UX always sets HINT_PREFETCH since it's drivers
^1da177e4c3f41 Linus Torvalds 2005-04-16 501 ** do special things to work on non-coherent platforms...linux has to
^1da177e4c3f41 Linus Torvalds 2005-04-16 502 ** be much more careful with this.
^1da177e4c3f41 Linus Torvalds 2005-04-16 503 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 504 #define IOPDIR_VALID 0x01UL
^1da177e4c3f41 Linus Torvalds 2005-04-16 505 #define HINT_SAFE_DMA 0x02UL /* used for pci_alloc_consistent() pages */
^1da177e4c3f41 Linus Torvalds 2005-04-16 506 #ifdef CONFIG_EISA
^1da177e4c3f41 Linus Torvalds 2005-04-16 507 #define HINT_STOP_MOST 0x04UL /* LSL support */
^1da177e4c3f41 Linus Torvalds 2005-04-16 508 #else
^1da177e4c3f41 Linus Torvalds 2005-04-16 509 #define HINT_STOP_MOST 0x00UL /* only needed for "some EISA devices" */
^1da177e4c3f41 Linus Torvalds 2005-04-16 510 #endif
^1da177e4c3f41 Linus Torvalds 2005-04-16 511 #define HINT_UDPATE_ENB 0x08UL /* not used/supported by U2 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 512 #define HINT_PREFETCH 0x10UL /* for outbound pages which are not SAFE */
^1da177e4c3f41 Linus Torvalds 2005-04-16 513
^1da177e4c3f41 Linus Torvalds 2005-04-16 514
^1da177e4c3f41 Linus Torvalds 2005-04-16 515 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 516 ** Use direction (ie PCI_DMA_TODEVICE) to pick hint.
^1da177e4c3f41 Linus Torvalds 2005-04-16 517 ** ccio_alloc_consistent() depends on this to get SAFE_DMA
^1da177e4c3f41 Linus Torvalds 2005-04-16 518 ** when it passes in BIDIRECTIONAL flag.
^1da177e4c3f41 Linus Torvalds 2005-04-16 519 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 520 static u32 hint_lookup[] = {
^1da177e4c3f41 Linus Torvalds 2005-04-16 521 [PCI_DMA_BIDIRECTIONAL] = HINT_STOP_MOST | HINT_SAFE_DMA | IOPDIR_VALID,
^1da177e4c3f41 Linus Torvalds 2005-04-16 522 [PCI_DMA_TODEVICE] = HINT_STOP_MOST | HINT_PREFETCH | IOPDIR_VALID,
^1da177e4c3f41 Linus Torvalds 2005-04-16 523 [PCI_DMA_FROMDEVICE] = HINT_STOP_MOST | IOPDIR_VALID,
^1da177e4c3f41 Linus Torvalds 2005-04-16 524 };
^1da177e4c3f41 Linus Torvalds 2005-04-16 525
^1da177e4c3f41 Linus Torvalds 2005-04-16 526 /**
^1da177e4c3f41 Linus Torvalds 2005-04-16 527 * ccio_io_pdir_entry - Initialize an I/O Pdir.
^1da177e4c3f41 Linus Torvalds 2005-04-16 528 * @pdir_ptr: A pointer into I/O Pdir.
^1da177e4c3f41 Linus Torvalds 2005-04-16 529 * @sid: The Space Identifier.
^1da177e4c3f41 Linus Torvalds 2005-04-16 530 * @vba: The virtual address.
^1da177e4c3f41 Linus Torvalds 2005-04-16 531 * @hints: The DMA Hint.
^1da177e4c3f41 Linus Torvalds 2005-04-16 532 *
^1da177e4c3f41 Linus Torvalds 2005-04-16 533 * Given a virtual address (vba, arg2) and space id, (sid, arg1),
^1da177e4c3f41 Linus Torvalds 2005-04-16 534 * load the I/O PDIR entry pointed to by pdir_ptr (arg0). Each IO Pdir
^1da177e4c3f41 Linus Torvalds 2005-04-16 535 * entry consists of 8 bytes as shown below (MSB == bit 0):
^1da177e4c3f41 Linus Torvalds 2005-04-16 536 *
^1da177e4c3f41 Linus Torvalds 2005-04-16 537 *
^1da177e4c3f41 Linus Torvalds 2005-04-16 538 * WORD 0:
^1da177e4c3f41 Linus Torvalds 2005-04-16 539 * +------+----------------+-----------------------------------------------+
^1da177e4c3f41 Linus Torvalds 2005-04-16 540 * | Phys | Virtual Index | Phys |
^1da177e4c3f41 Linus Torvalds 2005-04-16 541 * | 0:3 | 0:11 | 4:19 |
^1da177e4c3f41 Linus Torvalds 2005-04-16 542 * |4 bits| 12 bits | 16 bits |
^1da177e4c3f41 Linus Torvalds 2005-04-16 543 * +------+----------------+-----------------------------------------------+
^1da177e4c3f41 Linus Torvalds 2005-04-16 544 * WORD 1:
^1da177e4c3f41 Linus Torvalds 2005-04-16 545 * +-----------------------+-----------------------------------------------+
^1da177e4c3f41 Linus Torvalds 2005-04-16 546 * | Phys | Rsvd | Prefetch |Update |Rsvd |Lock |Safe |Valid |
^1da177e4c3f41 Linus Torvalds 2005-04-16 547 * | 20:39 | | Enable |Enable | |Enable|DMA | |
^1da177e4c3f41 Linus Torvalds 2005-04-16 548 * | 20 bits | 5 bits | 1 bit |1 bit |2 bits|1 bit |1 bit |1 bit |
^1da177e4c3f41 Linus Torvalds 2005-04-16 549 * +-----------------------+-----------------------------------------------+
^1da177e4c3f41 Linus Torvalds 2005-04-16 550 *
^1da177e4c3f41 Linus Torvalds 2005-04-16 551 * The virtual index field is filled with the results of the LCI
^1da177e4c3f41 Linus Torvalds 2005-04-16 552 * (Load Coherence Index) instruction. The 8 bits used for the virtual
^1da177e4c3f41 Linus Torvalds 2005-04-16 553 * index are bits 12:19 of the value returned by LCI.
^1da177e4c3f41 Linus Torvalds 2005-04-16 554 */
df8e5bc6b7b61c Adrian Bunk 2008-12-02 555 static void CCIO_INLINE
^1da177e4c3f41 Linus Torvalds 2005-04-16 @556 ccio_io_pdir_entry(u64 *pdir_ptr, space_t sid, unsigned long vba,
^1da177e4c3f41 Linus Torvalds 2005-04-16 557 unsigned long hints)
^1da177e4c3f41 Linus Torvalds 2005-04-16 558 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 559 register unsigned long pa;
^1da177e4c3f41 Linus Torvalds 2005-04-16 560 register unsigned long ci; /* coherent index */
^1da177e4c3f41 Linus Torvalds 2005-04-16 561
^1da177e4c3f41 Linus Torvalds 2005-04-16 562 /* We currently only support kernel addresses */
^1da177e4c3f41 Linus Torvalds 2005-04-16 563 BUG_ON(sid != KERNEL_SPACE);
^1da177e4c3f41 Linus Torvalds 2005-04-16 564
^1da177e4c3f41 Linus Torvalds 2005-04-16 565 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 566 ** WORD 1 - low order word
^1da177e4c3f41 Linus Torvalds 2005-04-16 567 ** "hints" parm includes the VALID bit!
^1da177e4c3f41 Linus Torvalds 2005-04-16 568 ** "dep" clobbers the physical address offset bits as well.
^1da177e4c3f41 Linus Torvalds 2005-04-16 569 */
116d753308cf03 John David Anglin 2019-06-02 570 pa = lpa(vba);
^1da177e4c3f41 Linus Torvalds 2005-04-16 571 asm volatile("depw %1,31,12,%0" : "+r" (pa) : "r" (hints));
^1da177e4c3f41 Linus Torvalds 2005-04-16 572 ((u32 *)pdir_ptr)[1] = (u32) pa;
^1da177e4c3f41 Linus Torvalds 2005-04-16 573
^1da177e4c3f41 Linus Torvalds 2005-04-16 574 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 575 ** WORD 0 - high order word
^1da177e4c3f41 Linus Torvalds 2005-04-16 576 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 577

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (30.97 kB)
.config.gz (18.02 kB)
Download all attachments