Re: [PATCH 1/2] mm: make "vm_flags" be an u64

From: kernel test robot
Date: Tue Jun 01 2021 - 21:58:52 EST


Hi Ming,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linux/master]
[also build test WARNING on arm64/for-next/core powerpc/next asm-generic/master linus/master v5.13-rc4]
[cannot apply to hnaz-linux-mm/master tip/x86/core next-20210601]
[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/Ming-Lin/mm-adds-MAP_NOSIGBUS-extension-for-shmem-read/20210602-072403
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git dd860052c99b1e088352bdd4fb7aef46f8d2ef47
config: x86_64-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/0b6b8b44f566199698248899d0fef7466ba6b0f3
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Ming-Lin/mm-adds-MAP_NOSIGBUS-extension-for-shmem-read/20210602-072403
git checkout 0b6b8b44f566199698248899d0fef7466ba6b0f3
# save the attached .config to linux build tree
make W=1 ARCH=x86_64

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

All warnings (new ones prefixed by >>):

In file included from drivers/infiniband/hw/hfi1/trace.h:57,
from drivers/infiniband/hw/hfi1/file_ops.c:61:
drivers/infiniband/hw/hfi1/file_ops.c: In function 'hfi1_file_mmap':
>> drivers/infiniband/hw/hfi1/file_ops.c:572:5: warning: format '%lx' expects argument of type 'long unsigned int', but argument 11 has type 'vm_flags_t' {aka 'long long unsigned int'} [-Wformat=]
572 | "%u:%u type:%u io/vf:%d/%d, addr:0x%llx, len:%lu(%lu), flags:0x%lx\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
573 | ctxt, subctxt, type, mapio, vmf, memaddr, memlen,
574 | vma->vm_end - vma->vm_start, vma->vm_flags);
| ~~~~~~~~~~~~~
| |
| vm_flags_t {aka long long unsigned int}
drivers/infiniband/hw/hfi1/trace_dbg.h:133:33: note: in definition of macro 'hfi1_cdbg'
133 | __hfi1_trace_##which(__func__, fmt, ##__VA_ARGS__)
| ^~~
drivers/infiniband/hw/hfi1/file_ops.c:572:70: note: format string is defined here
572 | "%u:%u type:%u io/vf:%d/%d, addr:0x%llx, len:%lu(%lu), flags:0x%lx\n",
| ~~^
| |
| long unsigned int
| %llx
--
In file included from include/linux/device.h:15,
from include/linux/pci.h:37,
from drivers/infiniband/hw/qib/qib_file_ops.c:35:
drivers/infiniband/hw/qib/qib_file_ops.c: In function 'mmap_rcvegrbufs':
>> drivers/infiniband/hw/qib/qib_file_ops.c:849:4: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'vm_flags_t' {aka 'long long unsigned int'} [-Wformat=]
849 | "Can't map eager buffers as writable (flags=%lx)\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
19 | #define dev_fmt(fmt) fmt
| ^~~
drivers/infiniband/hw/qib/qib.h:1472:2: note: in expansion of macro 'dev_info'
1472 | dev_info(&(pcidev)->dev, fmt, ##__VA_ARGS__)
| ^~~~~~~~
drivers/infiniband/hw/qib/qib_file_ops.c:848:3: note: in expansion of macro 'qib_devinfo'
848 | qib_devinfo(dd->pcidev,
| ^~~~~~~~~~~
drivers/infiniband/hw/qib/qib_file_ops.c:849:50: note: format string is defined here
849 | "Can't map eager buffers as writable (flags=%lx)\n",
| ~~^
| |
| long unsigned int
| %llx
In file included from include/linux/device.h:15,
from include/linux/pci.h:37,
from drivers/infiniband/hw/qib/qib_file_ops.c:35:
drivers/infiniband/hw/qib/qib_file_ops.c: In function 'mmap_kvaddr':
drivers/infiniband/hw/qib/qib_file_ops.c:938:6: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'vm_flags_t' {aka 'long long unsigned int'} [-Wformat=]
938 | "Can't map eager buffers as writable (flags=%lx)\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
19 | #define dev_fmt(fmt) fmt
| ^~~
drivers/infiniband/hw/qib/qib.h:1472:2: note: in expansion of macro 'dev_info'
1472 | dev_info(&(pcidev)->dev, fmt, ##__VA_ARGS__)
| ^~~~~~~~
drivers/infiniband/hw/qib/qib_file_ops.c:937:4: note: in expansion of macro 'qib_devinfo'
937 | qib_devinfo(dd->pcidev,
| ^~~~~~~~~~~
drivers/infiniband/hw/qib/qib_file_ops.c:938:52: note: format string is defined here
938 | "Can't map eager buffers as writable (flags=%lx)\n",
| ~~^
| |
| long unsigned int
| %llx
--
In file included from drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_priv.h:48,
from drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_chardev.c:38:
drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_chardev.c: In function 'kfd_mmio_mmap':
>> drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgpu.h:35:21: warning: format '%lX' expects argument of type 'long unsigned int', but argument 6 has type 'vm_flags_t' {aka 'long long unsigned int'} [-Wformat=]
35 | #define pr_fmt(fmt) "amdgpu: " fmt
| ^~~~~~~~~~
include/linux/dynamic_debug.h:129:15: note: in expansion of macro 'pr_fmt'
129 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:147:2: note: in expansion of macro '__dynamic_func_call'
147 | __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:157:2: note: in expansion of macro '_dynamic_func_call'
157 | _dynamic_func_call(fmt, __dynamic_pr_debug, \
| ^~~~~~~~~~~~~~~~~~
include/linux/printk.h:424:2: note: in expansion of macro 'dynamic_pr_debug'
424 | dynamic_pr_debug(fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_chardev.c:1957:2: note: in expansion of macro 'pr_debug'
1957 | pr_debug("pasid 0x%x mapping mmio page\n"
| ^~~~~~~~
drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_chardev.c:1960:39: note: format string is defined here
1960 | " vm_flags == 0x%04lX\n"
| ~~~~^
| |
| long unsigned int
| %04llX


vim +572 drivers/infiniband/hw/hfi1/file_ops.c

7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 347
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 348 static int hfi1_file_mmap(struct file *fp, struct vm_area_struct *vma)
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 349 {
9e10af4787ac51 drivers/staging/rdma/hfi1/file_ops.c Ira Weiny 2015-10-30 350 struct hfi1_filedata *fd = fp->private_data;
9e10af4787ac51 drivers/staging/rdma/hfi1/file_ops.c Ira Weiny 2015-10-30 351 struct hfi1_ctxtdata *uctxt = fd->uctxt;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 352 struct hfi1_devdata *dd;
60368186fd8538 drivers/infiniband/hw/hfi1/file_ops.c Tymoteusz Kielan 2016-09-06 353 unsigned long flags;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 354 u64 token = vma->vm_pgoff << PAGE_SHIFT,
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 355 memaddr = 0;
60368186fd8538 drivers/infiniband/hw/hfi1/file_ops.c Tymoteusz Kielan 2016-09-06 356 void *memvirt = NULL;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 357 u8 subctxt, mapio = 0, vmf = 0, type;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 358 ssize_t memlen = 0;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 359 int ret = 0;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 360 u16 ctxt;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 361
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 362 if (!is_valid_mmap(token) || !uctxt ||
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 363 !(vma->vm_flags & VM_SHARED)) {
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 364 ret = -EINVAL;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 365 goto done;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 366 }
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 367 dd = uctxt->dd;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 368 ctxt = HFI1_MMAP_TOKEN_GET(CTXT, token);
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 369 subctxt = HFI1_MMAP_TOKEN_GET(SUBCTXT, token);
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 370 type = HFI1_MMAP_TOKEN_GET(TYPE, token);
9e10af4787ac51 drivers/staging/rdma/hfi1/file_ops.c Ira Weiny 2015-10-30 371 if (ctxt != uctxt->ctxt || subctxt != fd->subctxt) {
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 372 ret = -EINVAL;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 373 goto done;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 374 }
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 375
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 376 flags = vma->vm_flags;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 377
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 378 switch (type) {
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 379 case PIO_BUFS:
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 380 case PIO_BUFS_SOP:
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 381 memaddr = ((dd->physaddr + TXE_PIO_SEND) +
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 382 /* chip pio base */
d32cf44a62716d drivers/staging/rdma/hfi1/file_ops.c Amitoj Kaur Chawla 2015-10-16 383 (uctxt->sc->hw_context * BIT(16))) +
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 384 /* 64K PIO space / ctxt */
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 385 (type == PIO_BUFS_SOP ?
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 386 (TXE_PIO_SIZE / 2) : 0); /* sop? */
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 387 /*
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 388 * Map only the amount allocated to the context, not the
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 389 * entire available context's PIO space.
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 390 */
437b29d1159af1 drivers/staging/rdma/hfi1/file_ops.c Amitoj Kaur Chawla 2016-03-04 391 memlen = PAGE_ALIGN(uctxt->sc->credits * PIO_BLOCK_SIZE);
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 392 flags &= ~VM_MAYREAD;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 393 flags |= VM_DONTCOPY | VM_DONTEXPAND;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 394 vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 395 mapio = 1;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 396 break;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 397 case PIO_CRED:
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 398 if (flags & VM_WRITE) {
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 399 ret = -EPERM;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 400 goto done;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 401 }
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 402 /*
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 403 * The credit return location for this context could be on the
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 404 * second or third page allocated for credit returns (if number
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 405 * of enabled contexts > 64 and 128 respectively).
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 406 */
60368186fd8538 drivers/infiniband/hw/hfi1/file_ops.c Tymoteusz Kielan 2016-09-06 407 memvirt = dd->cr_base[uctxt->numa_id].va;
60368186fd8538 drivers/infiniband/hw/hfi1/file_ops.c Tymoteusz Kielan 2016-09-06 408 memaddr = virt_to_phys(memvirt) +
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 409 (((u64)uctxt->sc->hw_free -
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 410 (u64)dd->cr_base[uctxt->numa_id].va) & PAGE_MASK);
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 411 memlen = PAGE_SIZE;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 412 flags &= ~VM_MAYWRITE;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 413 flags |= VM_DONTCOPY | VM_DONTEXPAND;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 414 /*
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 415 * The driver has already allocated memory for credit
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 416 * returns and programmed it into the chip. Has that
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 417 * memory been flagged as non-cached?
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 418 */
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 419 /* vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); */
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 420 mapio = 1;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 421 break;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 422 case RCV_HDRQ:
b25784312840bc drivers/infiniband/hw/hfi1/file_ops.c Mike Marciniszyn 2018-06-20 423 memlen = rcvhdrq_size(uctxt);
60368186fd8538 drivers/infiniband/hw/hfi1/file_ops.c Tymoteusz Kielan 2016-09-06 424 memvirt = uctxt->rcvhdrq;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 425 break;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 426 case RCV_EGRBUF: {
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 427 unsigned long addr;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 428 int i;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 429 /*
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 430 * The RcvEgr buffer need to be handled differently
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 431 * as multiple non-contiguous pages need to be mapped
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 432 * into the user process.
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 433 */
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 434 memlen = uctxt->egrbufs.size;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 435 if ((vma->vm_end - vma->vm_start) != memlen) {
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 436 dd_dev_err(dd, "Eager buffer map size invalid (%lu != %lu)\n",
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 437 (vma->vm_end - vma->vm_start), memlen);
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 438 ret = -EINVAL;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 439 goto done;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 440 }
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 441 if (vma->vm_flags & VM_WRITE) {
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 442 ret = -EPERM;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 443 goto done;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 444 }
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 445 vma->vm_flags &= ~VM_MAYWRITE;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 446 addr = vma->vm_start;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 447 for (i = 0 ; i < uctxt->egrbufs.numbufs; i++) {
60368186fd8538 drivers/infiniband/hw/hfi1/file_ops.c Tymoteusz Kielan 2016-09-06 448 memlen = uctxt->egrbufs.buffers[i].len;
60368186fd8538 drivers/infiniband/hw/hfi1/file_ops.c Tymoteusz Kielan 2016-09-06 449 memvirt = uctxt->egrbufs.buffers[i].addr;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 450 ret = remap_pfn_range(
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 451 vma, addr,
60368186fd8538 drivers/infiniband/hw/hfi1/file_ops.c Tymoteusz Kielan 2016-09-06 452 /*
60368186fd8538 drivers/infiniband/hw/hfi1/file_ops.c Tymoteusz Kielan 2016-09-06 453 * virt_to_pfn() does the same, but
60368186fd8538 drivers/infiniband/hw/hfi1/file_ops.c Tymoteusz Kielan 2016-09-06 454 * it's not available on x86_64
60368186fd8538 drivers/infiniband/hw/hfi1/file_ops.c Tymoteusz Kielan 2016-09-06 455 * when CONFIG_MMU is enabled.
60368186fd8538 drivers/infiniband/hw/hfi1/file_ops.c Tymoteusz Kielan 2016-09-06 456 */
60368186fd8538 drivers/infiniband/hw/hfi1/file_ops.c Tymoteusz Kielan 2016-09-06 457 PFN_DOWN(__pa(memvirt)),
60368186fd8538 drivers/infiniband/hw/hfi1/file_ops.c Tymoteusz Kielan 2016-09-06 458 memlen,
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 459 vma->vm_page_prot);
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 460 if (ret < 0)
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 461 goto done;
60368186fd8538 drivers/infiniband/hw/hfi1/file_ops.c Tymoteusz Kielan 2016-09-06 462 addr += memlen;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 463 }
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 464 ret = 0;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 465 goto done;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 466 }
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 467 case UREGS:
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 468 /*
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 469 * Map only the page that contains this context's user
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 470 * registers.
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 471 */
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 472 memaddr = (unsigned long)
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 473 (dd->physaddr + RXE_PER_CONTEXT_USER)
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 474 + (uctxt->ctxt * RXE_PER_CONTEXT_SIZE);
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 475 /*
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 476 * TidFlow table is on the same page as the rest of the
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 477 * user registers.
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 478 */
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 479 memlen = PAGE_SIZE;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 480 flags |= VM_DONTCOPY | VM_DONTEXPAND;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 481 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 482 mapio = 1;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 483 break;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 484 case EVENTS:
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 485 /*
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 486 * Use the page where this context's flags are. User level
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 487 * knows where it's own bitmap is within the page.
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 488 */
21e5acc06403f6 drivers/infiniband/hw/hfi1/file_ops.c Michael J. Ruhl 2017-09-26 489 memaddr = (unsigned long)
21e5acc06403f6 drivers/infiniband/hw/hfi1/file_ops.c Michael J. Ruhl 2017-09-26 490 (dd->events + uctxt_offset(uctxt)) & PAGE_MASK;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 491 memlen = PAGE_SIZE;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 492 /*
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 493 * v3.7 removes VM_RESERVED but the effect is kept by
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 494 * using VM_IO.
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 495 */
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 496 flags |= VM_IO | VM_DONTEXPAND;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 497 vmf = 1;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 498 break;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 499 case STATUS:
7709b0dc265f28 drivers/infiniband/hw/hfi1/file_ops.c Michael J. Ruhl 2019-01-17 500 if (flags & VM_WRITE) {
12220267645cb7 drivers/infiniband/hw/hfi1/file_ops.c Ira Weiny 2017-04-09 501 ret = -EPERM;
12220267645cb7 drivers/infiniband/hw/hfi1/file_ops.c Ira Weiny 2017-04-09 502 goto done;
12220267645cb7 drivers/infiniband/hw/hfi1/file_ops.c Ira Weiny 2017-04-09 503 }
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 504 memaddr = kvirt_to_phys((void *)dd->status);
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 505 memlen = PAGE_SIZE;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 506 flags |= VM_IO | VM_DONTEXPAND;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 507 break;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 508 case RTAIL:
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 509 if (!HFI1_CAP_IS_USET(DMA_RTAIL)) {
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 510 /*
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 511 * If the memory allocation failed, the context alloc
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 512 * also would have failed, so we would never get here
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 513 */
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 514 ret = -EINVAL;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 515 goto done;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 516 }
2fb3b5ae1ca771 drivers/infiniband/hw/hfi1/file_ops.c Mike Marciniszyn 2019-12-19 517 if ((flags & VM_WRITE) || !hfi1_rcvhdrtail_kvaddr(uctxt)) {
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 518 ret = -EPERM;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 519 goto done;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 520 }
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 521 memlen = PAGE_SIZE;
2fb3b5ae1ca771 drivers/infiniband/hw/hfi1/file_ops.c Mike Marciniszyn 2019-12-19 522 memvirt = (void *)hfi1_rcvhdrtail_kvaddr(uctxt);
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 523 flags &= ~VM_MAYWRITE;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 524 break;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 525 case SUBCTXT_UREGS:
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 526 memaddr = (u64)uctxt->subctxt_uregbase;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 527 memlen = PAGE_SIZE;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 528 flags |= VM_IO | VM_DONTEXPAND;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 529 vmf = 1;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 530 break;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 531 case SUBCTXT_RCV_HDRQ:
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 532 memaddr = (u64)uctxt->subctxt_rcvhdr_base;
b25784312840bc drivers/infiniband/hw/hfi1/file_ops.c Mike Marciniszyn 2018-06-20 533 memlen = rcvhdrq_size(uctxt) * uctxt->subctxt_cnt;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 534 flags |= VM_IO | VM_DONTEXPAND;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 535 vmf = 1;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 536 break;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 537 case SUBCTXT_EGRBUF:
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 538 memaddr = (u64)uctxt->subctxt_rcvegrbuf;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 539 memlen = uctxt->egrbufs.size * uctxt->subctxt_cnt;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 540 flags |= VM_IO | VM_DONTEXPAND;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 541 flags &= ~VM_MAYWRITE;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 542 vmf = 1;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 543 break;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 544 case SDMA_COMP: {
9e10af4787ac51 drivers/staging/rdma/hfi1/file_ops.c Ira Weiny 2015-10-30 545 struct hfi1_user_sdma_comp_q *cq = fd->cq;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 546
9e10af4787ac51 drivers/staging/rdma/hfi1/file_ops.c Ira Weiny 2015-10-30 547 if (!cq) {
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 548 ret = -EFAULT;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 549 goto done;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 550 }
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 551 memaddr = (u64)cq->comps;
437b29d1159af1 drivers/staging/rdma/hfi1/file_ops.c Amitoj Kaur Chawla 2016-03-04 552 memlen = PAGE_ALIGN(sizeof(*cq->comps) * cq->nentries);
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 553 flags |= VM_IO | VM_DONTEXPAND;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 554 vmf = 1;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 555 break;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 556 }
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 557 default:
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 558 ret = -EINVAL;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 559 break;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 560 }
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 561
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 562 if ((vma->vm_end - vma->vm_start) != memlen) {
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 563 hfi1_cdbg(PROC, "%u:%u Memory size mismatch %lu:%lu",
9e10af4787ac51 drivers/staging/rdma/hfi1/file_ops.c Ira Weiny 2015-10-30 564 uctxt->ctxt, fd->subctxt,
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 565 (vma->vm_end - vma->vm_start), memlen);
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 566 ret = -EINVAL;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 567 goto done;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 568 }
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 569
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 570 vma->vm_flags = flags;
6c63e4238acad0 drivers/staging/rdma/hfi1/file_ops.c Sebastian Sanchez 2015-11-06 571 hfi1_cdbg(PROC,
6c63e4238acad0 drivers/staging/rdma/hfi1/file_ops.c Sebastian Sanchez 2015-11-06 @572 "%u:%u type:%u io/vf:%d/%d, addr:0x%llx, len:%lu(%lu), flags:0x%lx\n",
6c63e4238acad0 drivers/staging/rdma/hfi1/file_ops.c Sebastian Sanchez 2015-11-06 573 ctxt, subctxt, type, mapio, vmf, memaddr, memlen,
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 574 vma->vm_end - vma->vm_start, vma->vm_flags);
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 575 if (vmf) {
60368186fd8538 drivers/infiniband/hw/hfi1/file_ops.c Tymoteusz Kielan 2016-09-06 576 vma->vm_pgoff = PFN_DOWN(memaddr);
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 577 vma->vm_ops = &vm_ops;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 578 ret = 0;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 579 } else if (mapio) {
60368186fd8538 drivers/infiniband/hw/hfi1/file_ops.c Tymoteusz Kielan 2016-09-06 580 ret = io_remap_pfn_range(vma, vma->vm_start,
60368186fd8538 drivers/infiniband/hw/hfi1/file_ops.c Tymoteusz Kielan 2016-09-06 581 PFN_DOWN(memaddr),
60368186fd8538 drivers/infiniband/hw/hfi1/file_ops.c Tymoteusz Kielan 2016-09-06 582 memlen,
60368186fd8538 drivers/infiniband/hw/hfi1/file_ops.c Tymoteusz Kielan 2016-09-06 583 vma->vm_page_prot);
60368186fd8538 drivers/infiniband/hw/hfi1/file_ops.c Tymoteusz Kielan 2016-09-06 584 } else if (memvirt) {
60368186fd8538 drivers/infiniband/hw/hfi1/file_ops.c Tymoteusz Kielan 2016-09-06 585 ret = remap_pfn_range(vma, vma->vm_start,
60368186fd8538 drivers/infiniband/hw/hfi1/file_ops.c Tymoteusz Kielan 2016-09-06 586 PFN_DOWN(__pa(memvirt)),
60368186fd8538 drivers/infiniband/hw/hfi1/file_ops.c Tymoteusz Kielan 2016-09-06 587 memlen,
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 588 vma->vm_page_prot);
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 589 } else {
60368186fd8538 drivers/infiniband/hw/hfi1/file_ops.c Tymoteusz Kielan 2016-09-06 590 ret = remap_pfn_range(vma, vma->vm_start,
60368186fd8538 drivers/infiniband/hw/hfi1/file_ops.c Tymoteusz Kielan 2016-09-06 591 PFN_DOWN(memaddr),
60368186fd8538 drivers/infiniband/hw/hfi1/file_ops.c Tymoteusz Kielan 2016-09-06 592 memlen,
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 593 vma->vm_page_prot);
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 594 }
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 595 done:
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 596 return ret;
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 597 }
7724105686e718 drivers/staging/rdma/hfi1/file_ops.c Mike Marciniszyn 2015-07-30 598

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

Attachment: .config.gz
Description: application/gzip