[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202111171033.IdiY4yA4-lkp@intel.com>
Date: Wed, 17 Nov 2021 10:24:44 +0800
From: kernel test robot <lkp@...el.com>
To: Johannes Berg <johannes.berg@...el.com>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
Richard Weinberger <richard@....at>
Subject: drivers/vfio/pci/vfio_pci_rdwr.c:317:9: warning: assignment to 'void
*' from 'int' makes pointer from integer without a cast
Hi Johannes,
First bad commit (maybe != root cause):
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 8ab774587903771821b59471cc723bba6d893942
commit: 68f5d3f3b6543266b29e047cfaf9842333019b4c um: add PCI over virtio emulation driver
date: 5 months ago
config: um-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=68f5d3f3b6543266b29e047cfaf9842333019b4c
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 68f5d3f3b6543266b29e047cfaf9842333019b4c
# save the attached .config to linux build tree
make W=1 ARCH=um
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
All warnings (new ones prefixed by >>):
drivers/vfio/pci/vfio_pci_rdwr.c: In function 'vfio_pci_vga_rw':
drivers/vfio/pci/vfio_pci_rdwr.c:317:11: error: implicit declaration of function 'ioport_map' [-Werror=implicit-function-declaration]
317 | iomem = ioport_map(0x3b0, 0x3bb - 0x3b0 + 1);
| ^~~~~~~~~~
>> drivers/vfio/pci/vfio_pci_rdwr.c:317:9: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
317 | iomem = ioport_map(0x3b0, 0x3bb - 0x3b0 + 1);
| ^
drivers/vfio/pci/vfio_pci_rdwr.c:324:9: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
324 | iomem = ioport_map(0x3c0, 0x3df - 0x3c0 + 1);
| ^
drivers/vfio/pci/vfio_pci_rdwr.c:338:15: error: implicit declaration of function 'ioport_unmap'; did you mean 'iommu_unmap'? [-Werror=implicit-function-declaration]
338 | is_ioport ? ioport_unmap(iomem) : iounmap(iomem);
| ^~~~~~~~~~~~
| iommu_unmap
cc1: some warnings being treated as errors
--
In file included from arch/x86/include/asm/pgtable_types.h:8,
from arch/x86/include/asm/memtype.h:6,
from arch/x86/include/asm/mtrr.h:27,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:41:
arch/x86/include/asm/page_types.h:11: warning: "PAGE_SIZE" redefined
11 | #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
|
In file included from arch/um/include/asm/thread_info.h:15,
from include/linux/thread_info.h:59,
from include/asm-generic/current.h:5,
from ./arch/um/include/generated/asm/current.h:1,
from include/linux/mutex.h:14,
from include/linux/kernfs.h:12,
from include/linux/sysfs.h:16,
from include/linux/kobject.h:20,
from include/linux/pci.h:35,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:40:
arch/um/include/asm/page.h:14: note: this is the location of the previous definition
14 | #define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
|
In file included from arch/x86/include/asm/pgtable_types.h:8,
from arch/x86/include/asm/memtype.h:6,
from arch/x86/include/asm/mtrr.h:27,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:41:
arch/x86/include/asm/page_types.h:36: warning: "PAGE_OFFSET" redefined
36 | #define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET)
|
In file included from arch/um/include/asm/thread_info.h:15,
from include/linux/thread_info.h:59,
from include/asm-generic/current.h:5,
from ./arch/um/include/generated/asm/current.h:1,
from include/linux/mutex.h:14,
from include/linux/kernfs.h:12,
from include/linux/sysfs.h:16,
from include/linux/kobject.h:20,
from include/linux/pci.h:35,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:40:
arch/um/include/asm/page.h:93: note: this is the location of the previous definition
93 | #define PAGE_OFFSET (uml_physmem)
|
In file included from arch/x86/include/asm/pgtable_types.h:8,
from arch/x86/include/asm/memtype.h:6,
from arch/x86/include/asm/mtrr.h:27,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:41:
arch/x86/include/asm/page_types.h:38: warning: "VM_DATA_DEFAULT_FLAGS" redefined
38 | #define VM_DATA_DEFAULT_FLAGS VM_DATA_FLAGS_TSK_EXEC
|
In file included from include/linux/scatterlist.h:8,
from include/linux/dmapool.h:14,
from include/linux/pci.h:1463,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:40:
include/linux/mm.h:396: note: this is the location of the previous definition
396 | #define VM_DATA_DEFAULT_FLAGS VM_DATA_FLAGS_EXEC
|
In file included from arch/x86/include/asm/page_types.h:46,
from arch/x86/include/asm/pgtable_types.h:8,
from arch/x86/include/asm/memtype.h:6,
from arch/x86/include/asm/mtrr.h:27,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:41:
arch/x86/include/asm/page_64_types.h:15: warning: "THREAD_SIZE_ORDER" redefined
15 | #define THREAD_SIZE_ORDER (2 + KASAN_STACK_ORDER)
|
In file included from include/linux/thread_info.h:59,
from include/asm-generic/current.h:5,
from ./arch/um/include/generated/asm/current.h:1,
from include/linux/mutex.h:14,
from include/linux/kernfs.h:12,
from include/linux/sysfs.h:16,
from include/linux/kobject.h:20,
from include/linux/pci.h:35,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:40:
arch/um/include/asm/thread_info.h:9: note: this is the location of the previous definition
9 | #define THREAD_SIZE_ORDER CONFIG_KERNEL_STACK_ORDER
|
In file included from arch/x86/include/asm/page_types.h:46,
from arch/x86/include/asm/pgtable_types.h:8,
from arch/x86/include/asm/memtype.h:6,
from arch/x86/include/asm/mtrr.h:27,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:41:
arch/x86/include/asm/page_64_types.h:16: warning: "THREAD_SIZE" redefined
16 | #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
|
In file included from include/linux/thread_info.h:59,
from include/asm-generic/current.h:5,
from ./arch/um/include/generated/asm/current.h:1,
from include/linux/mutex.h:14,
from include/linux/kernfs.h:12,
from include/linux/sysfs.h:16,
from include/linux/kobject.h:20,
from include/linux/pci.h:35,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:40:
arch/um/include/asm/thread_info.h:10: note: this is the location of the previous definition
10 | #define THREAD_SIZE ((1 << CONFIG_KERNEL_STACK_ORDER) * PAGE_SIZE)
|
In file included from arch/x86/include/asm/page_types.h:46,
from arch/x86/include/asm/pgtable_types.h:8,
from arch/x86/include/asm/memtype.h:6,
from arch/x86/include/asm/mtrr.h:27,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:41:
>> arch/x86/include/asm/page_64_types.h:75: warning: "TASK_SIZE" redefined
75 | #define TASK_SIZE (test_thread_flag(TIF_ADDR32) ? \
|
In file included from arch/x86/um/asm/processor.h:41,
from include/linux/mutex.h:19,
from include/linux/kernfs.h:12,
from include/linux/sysfs.h:16,
from include/linux/kobject.h:20,
from include/linux/pci.h:35,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:40:
arch/um/include/asm/processor-generic.h:71: note: this is the location of the previous definition
71 | #define TASK_SIZE (task_size)
|
In file included from arch/x86/include/asm/page_types.h:46,
from arch/x86/include/asm/pgtable_types.h:8,
from arch/x86/include/asm/memtype.h:6,
from arch/x86/include/asm/mtrr.h:27,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:41:
>> arch/x86/include/asm/page_64_types.h:77: warning: "TASK_SIZE_OF" redefined
77 | #define TASK_SIZE_OF(child) ((test_tsk_thread_flag(child, TIF_ADDR32)) ? \
|
In file included from include/linux/ratelimit.h:6,
from include/linux/dev_printk.h:16,
from include/linux/device.h:15,
from include/linux/pci.h:37,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:40:
include/linux/sched.h:2041: note: this is the location of the previous definition
2041 | #define TASK_SIZE_OF(tsk) TASK_SIZE
|
In file included from arch/x86/include/asm/page_types.h:46,
from arch/x86/include/asm/pgtable_types.h:8,
from arch/x86/include/asm/memtype.h:6,
from arch/x86/include/asm/mtrr.h:27,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:41:
>> arch/x86/include/asm/page_64_types.h:80: warning: "STACK_TOP" redefined
80 | #define STACK_TOP TASK_SIZE_LOW
|
In file included from arch/x86/um/asm/processor.h:41,
from include/linux/mutex.h:19,
from include/linux/kernfs.h:12,
from include/linux/sysfs.h:16,
from include/linux/kobject.h:20,
from include/linux/pci.h:35,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:40:
arch/um/include/asm/processor-generic.h:79: note: this is the location of the previous definition
79 | #define STACK_TOP (TASK_SIZE - 2 * PAGE_SIZE)
|
In file included from arch/x86/include/asm/page_types.h:46,
from arch/x86/include/asm/pgtable_types.h:8,
from arch/x86/include/asm/memtype.h:6,
from arch/x86/include/asm/mtrr.h:27,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:41:
>> arch/x86/include/asm/page_64_types.h:81: warning: "STACK_TOP_MAX" redefined
81 | #define STACK_TOP_MAX TASK_SIZE_MAX
|
In file included from arch/x86/um/asm/processor.h:41,
from include/linux/mutex.h:19,
from include/linux/kernfs.h:12,
from include/linux/sysfs.h:16,
from include/linux/kobject.h:20,
from include/linux/pci.h:35,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:40:
arch/um/include/asm/processor-generic.h:80: note: this is the location of the previous definition
80 | #define STACK_TOP_MAX STACK_TOP
|
In file included from arch/x86/include/asm/pgtable_types.h:8,
from arch/x86/include/asm/memtype.h:6,
from arch/x86/include/asm/mtrr.h:27,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:41:
arch/x86/include/asm/page_types.h:47: warning: "IOREMAP_MAX_ORDER" redefined
47 | #define IOREMAP_MAX_ORDER (PUD_SHIFT)
|
In file included from include/asm-generic/io.h:911,
from arch/um/include/asm/io.h:24,
from include/linux/io.h:13,
from include/linux/irq.h:20,
from include/asm-generic/hardirq.h:17,
from arch/um/include/asm/hardirq.h:5,
from include/linux/hardirq.h:11,
from include/linux/interrupt.h:11,
from include/linux/pci.h:38,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:40:
include/linux/vmalloc.h:49: note: this is the location of the previous definition
49 | #define IOREMAP_MAX_ORDER (7 + PAGE_SHIFT) /* 128 pages */
|
In file included from arch/x86/include/asm/memtype.h:6,
from arch/x86/include/asm/mtrr.h:27,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:41:
arch/x86/include/asm/pgtable_types.h:43: warning: "_PAGE_PRESENT" redefined
43 | #define _PAGE_PRESENT (_AT(pteval_t, 1) << _PAGE_BIT_PRESENT)
|
In file included from include/linux/pgtable.h:6,
from include/linux/mm.h:33,
from include/linux/scatterlist.h:8,
from include/linux/dmapool.h:14,
from include/linux/pci.h:1463,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:40:
arch/um/include/asm/pgtable.h:13: note: this is the location of the previous definition
13 | #define _PAGE_PRESENT 0x001
|
In file included from arch/x86/include/asm/memtype.h:6,
from arch/x86/include/asm/mtrr.h:27,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:41:
arch/x86/include/asm/pgtable_types.h:44: warning: "_PAGE_RW" redefined
44 | #define _PAGE_RW (_AT(pteval_t, 1) << _PAGE_BIT_RW)
|
In file included from include/linux/pgtable.h:6,
from include/linux/mm.h:33,
from include/linux/scatterlist.h:8,
from include/linux/dmapool.h:14,
from include/linux/pci.h:1463,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:40:
arch/um/include/asm/pgtable.h:16: note: this is the location of the previous definition
16 | #define _PAGE_RW 0x020
|
In file included from arch/x86/include/asm/memtype.h:6,
from arch/x86/include/asm/mtrr.h:27,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:41:
arch/x86/include/asm/pgtable_types.h:45: warning: "_PAGE_USER" redefined
45 | #define _PAGE_USER (_AT(pteval_t, 1) << _PAGE_BIT_USER)
|
In file included from include/linux/pgtable.h:6,
from include/linux/mm.h:33,
from include/linux/scatterlist.h:8,
from include/linux/dmapool.h:14,
from include/linux/pci.h:1463,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:40:
arch/um/include/asm/pgtable.h:17: note: this is the location of the previous definition
17 | #define _PAGE_USER 0x040
|
In file included from arch/x86/include/asm/memtype.h:6,
from arch/x86/include/asm/mtrr.h:27,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:41:
arch/x86/include/asm/pgtable_types.h:48: warning: "_PAGE_ACCESSED" redefined
48 | #define _PAGE_ACCESSED (_AT(pteval_t, 1) << _PAGE_BIT_ACCESSED)
|
In file included from include/linux/pgtable.h:6,
from include/linux/mm.h:33,
from include/linux/scatterlist.h:8,
from include/linux/dmapool.h:14,
from include/linux/pci.h:1463,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:40:
arch/um/include/asm/pgtable.h:18: note: this is the location of the previous definition
18 | #define _PAGE_ACCESSED 0x080
|
In file included from arch/x86/include/asm/memtype.h:6,
from arch/x86/include/asm/mtrr.h:27,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:41:
arch/x86/include/asm/pgtable_types.h:49: warning: "_PAGE_DIRTY" redefined
49 | #define _PAGE_DIRTY (_AT(pteval_t, 1) << _PAGE_BIT_DIRTY)
|
In file included from include/linux/pgtable.h:6,
from include/linux/mm.h:33,
from include/linux/scatterlist.h:8,
from include/linux/dmapool.h:14,
from include/linux/pci.h:1463,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:40:
arch/um/include/asm/pgtable.h:19: note: this is the location of the previous definition
19 | #define _PAGE_DIRTY 0x100
|
In file included from arch/x86/include/asm/memtype.h:6,
from arch/x86/include/asm/mtrr.h:27,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:41:
arch/x86/include/asm/pgtable_types.h:120: warning: "_PAGE_PROTNONE" redefined
120 | #define _PAGE_PROTNONE (_AT(pteval_t, 1) << _PAGE_BIT_PROTNONE)
|
In file included from include/linux/pgtable.h:6,
from include/linux/mm.h:33,
from include/linux/scatterlist.h:8,
from include/linux/dmapool.h:14,
from include/linux/pci.h:1463,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:40:
arch/um/include/asm/pgtable.h:21: note: this is the location of the previous definition
21 | #define _PAGE_PROTNONE 0x010 /* if the user mapped it with PROT_NONE;
|
In file included from arch/x86/include/asm/memtype.h:6,
from arch/x86/include/asm/mtrr.h:27,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:41:
arch/x86/include/asm/pgtable_types.h:128: warning: "_PAGE_CHG_MASK" redefined
128 | #define _PAGE_CHG_MASK (PTE_PFN_MASK | _PAGE_PCD | _PAGE_PWT | \
|
In file included from include/linux/pgtable.h:6,
from include/linux/mm.h:33,
from include/linux/scatterlist.h:8,
from include/linux/dmapool.h:14,
from include/linux/pci.h:1463,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:40:
arch/um/include/asm/pgtable.h:55: note: this is the location of the previous definition
55 | #define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY)
|
In file included from arch/x86/include/asm/memtype.h:6,
from arch/x86/include/asm/mtrr.h:27,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:41:
>> arch/x86/include/asm/pgtable_types.h:180: warning: "PAGE_NONE" redefined
180 | #define PAGE_NONE __pg( 0| 0| 0|___A| 0| 0| 0|___G)
|
In file included from include/linux/pgtable.h:6,
from include/linux/mm.h:33,
from include/linux/scatterlist.h:8,
from include/linux/dmapool.h:14,
from include/linux/pci.h:1463,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:40:
arch/um/include/asm/pgtable.h:58: note: this is the location of the previous definition
58 | #define PAGE_NONE __pgprot(_PAGE_PROTNONE | _PAGE_ACCESSED)
|
In file included from arch/x86/include/asm/memtype.h:6,
from arch/x86/include/asm/mtrr.h:27,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:41:
arch/x86/include/asm/pgtable_types.h:181: warning: "PAGE_SHARED" redefined
181 | #define PAGE_SHARED __pg(__PP|__RW|_USR|___A|__NX| 0| 0| 0)
|
In file included from include/linux/pgtable.h:6,
from include/linux/mm.h:33,
from include/linux/scatterlist.h:8,
from include/linux/dmapool.h:14,
from include/linux/pci.h:1463,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:40:
arch/um/include/asm/pgtable.h:59: note: this is the location of the previous definition
59 | #define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED)
|
In file included from arch/x86/include/asm/memtype.h:6,
from arch/x86/include/asm/mtrr.h:27,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:41:
arch/x86/include/asm/pgtable_types.h:185: warning: "PAGE_COPY" redefined
185 | #define PAGE_COPY __pg(__PP| 0|_USR|___A|__NX| 0| 0| 0)
|
In file included from include/linux/pgtable.h:6,
from include/linux/mm.h:33,
from include/linux/scatterlist.h:8,
from include/linux/dmapool.h:14,
from include/linux/pci.h:1463,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:40:
arch/um/include/asm/pgtable.h:60: note: this is the location of the previous definition
60 | #define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED)
|
In file included from arch/x86/include/asm/memtype.h:6,
from arch/x86/include/asm/mtrr.h:27,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:41:
arch/x86/include/asm/pgtable_types.h:186: warning: "PAGE_READONLY" redefined
186 | #define PAGE_READONLY __pg(__PP| 0|_USR|___A|__NX| 0| 0| 0)
|
In file included from include/linux/pgtable.h:6,
from include/linux/mm.h:33,
from include/linux/scatterlist.h:8,
from include/linux/dmapool.h:14,
from include/linux/pci.h:1463,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:40:
arch/um/include/asm/pgtable.h:61: note: this is the location of the previous definition
61 | #define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED)
|
In file included from arch/x86/include/asm/memtype.h:6,
from arch/x86/include/asm/mtrr.h:27,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:41:
arch/x86/include/asm/pgtable_types.h:190: warning: "__PAGE_KERNEL_EXEC" redefined
190 | #define __PAGE_KERNEL_EXEC (__PP|__RW| 0|___A| 0|___D| 0|___G)
|
In file included from include/linux/pgtable.h:6,
from include/linux/mm.h:33,
from include/linux/scatterlist.h:8,
from include/linux/dmapool.h:14,
from include/linux/pci.h:1463,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:40:
arch/um/include/asm/pgtable.h:56: note: this is the location of the previous definition
56 | #define __PAGE_KERNEL_EXEC \
|
In file included from arch/x86/include/asm/memtype.h:6,
from arch/x86/include/asm/mtrr.h:27,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:41:
arch/x86/include/asm/pgtable_types.h:192: warning: "_KERNPG_TABLE" redefined
192 | #define _KERNPG_TABLE (__PP|__RW| 0|___A| 0|___D| 0| 0| _ENC)
|
In file included from include/linux/pgtable.h:6,
from include/linux/mm.h:33,
from include/linux/scatterlist.h:8,
from include/linux/dmapool.h:14,
from include/linux/pci.h:1463,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:40:
arch/um/include/asm/pgtable.h:54: note: this is the location of the previous definition
54 | #define _KERNPG_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY)
|
In file included from arch/x86/include/asm/memtype.h:6,
from arch/x86/include/asm/mtrr.h:27,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:41:
arch/x86/include/asm/pgtable_types.h:194: warning: "_PAGE_TABLE" redefined
194 | #define _PAGE_TABLE (__PP|__RW|_USR|___A| 0|___D| 0| 0| _ENC)
|
In file included from include/linux/pgtable.h:6,
from include/linux/mm.h:33,
from include/linux/scatterlist.h:8,
from include/linux/dmapool.h:14,
from include/linux/pci.h:1463,
from drivers/infiniband/hw/qib/qib_wc_x86_64.c:40:
arch/um/include/asm/pgtable.h:53: note: this is the location of the previous definition
53 | #define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED | _PAGE_DIRTY)
..
vim +317 drivers/vfio/pci/vfio_pci_rdwr.c
84237a826b261d Alex Williamson 2013-02-18 290
84237a826b261d Alex Williamson 2013-02-18 291 ssize_t vfio_pci_vga_rw(struct vfio_pci_device *vdev, char __user *buf,
84237a826b261d Alex Williamson 2013-02-18 292 size_t count, loff_t *ppos, bool iswrite)
84237a826b261d Alex Williamson 2013-02-18 293 {
84237a826b261d Alex Williamson 2013-02-18 294 int ret;
84237a826b261d Alex Williamson 2013-02-18 295 loff_t off, pos = *ppos & VFIO_PCI_OFFSET_MASK;
84237a826b261d Alex Williamson 2013-02-18 296 void __iomem *iomem = NULL;
84237a826b261d Alex Williamson 2013-02-18 297 unsigned int rsrc;
84237a826b261d Alex Williamson 2013-02-18 298 bool is_ioport;
84237a826b261d Alex Williamson 2013-02-18 299 ssize_t done;
84237a826b261d Alex Williamson 2013-02-18 300
84237a826b261d Alex Williamson 2013-02-18 301 if (!vdev->has_vga)
84237a826b261d Alex Williamson 2013-02-18 302 return -EINVAL;
84237a826b261d Alex Williamson 2013-02-18 303
45e86971448943 Arnd Bergmann 2016-12-30 304 if (pos > 0xbfffful)
45e86971448943 Arnd Bergmann 2016-12-30 305 return -EINVAL;
45e86971448943 Arnd Bergmann 2016-12-30 306
45e86971448943 Arnd Bergmann 2016-12-30 307 switch ((u32)pos) {
84237a826b261d Alex Williamson 2013-02-18 308 case 0xa0000 ... 0xbffff:
84237a826b261d Alex Williamson 2013-02-18 309 count = min(count, (size_t)(0xc0000 - pos));
4bdc0d676a6431 Christoph Hellwig 2020-01-06 310 iomem = ioremap(0xa0000, 0xbffff - 0xa0000 + 1);
84237a826b261d Alex Williamson 2013-02-18 311 off = pos - 0xa0000;
84237a826b261d Alex Williamson 2013-02-18 312 rsrc = VGA_RSRC_LEGACY_MEM;
84237a826b261d Alex Williamson 2013-02-18 313 is_ioport = false;
84237a826b261d Alex Williamson 2013-02-18 314 break;
84237a826b261d Alex Williamson 2013-02-18 315 case 0x3b0 ... 0x3bb:
84237a826b261d Alex Williamson 2013-02-18 316 count = min(count, (size_t)(0x3bc - pos));
84237a826b261d Alex Williamson 2013-02-18 @317 iomem = ioport_map(0x3b0, 0x3bb - 0x3b0 + 1);
84237a826b261d Alex Williamson 2013-02-18 318 off = pos - 0x3b0;
84237a826b261d Alex Williamson 2013-02-18 319 rsrc = VGA_RSRC_LEGACY_IO;
84237a826b261d Alex Williamson 2013-02-18 320 is_ioport = true;
84237a826b261d Alex Williamson 2013-02-18 321 break;
84237a826b261d Alex Williamson 2013-02-18 322 case 0x3c0 ... 0x3df:
84237a826b261d Alex Williamson 2013-02-18 323 count = min(count, (size_t)(0x3e0 - pos));
84237a826b261d Alex Williamson 2013-02-18 324 iomem = ioport_map(0x3c0, 0x3df - 0x3c0 + 1);
84237a826b261d Alex Williamson 2013-02-18 325 off = pos - 0x3c0;
84237a826b261d Alex Williamson 2013-02-18 326 rsrc = VGA_RSRC_LEGACY_IO;
84237a826b261d Alex Williamson 2013-02-18 327 is_ioport = true;
84237a826b261d Alex Williamson 2013-02-18 328 break;
84237a826b261d Alex Williamson 2013-02-18 329 default:
84237a826b261d Alex Williamson 2013-02-18 330 return -EINVAL;
84237a826b261d Alex Williamson 2013-02-18 331 }
84237a826b261d Alex Williamson 2013-02-18 332
84237a826b261d Alex Williamson 2013-02-18 333 if (!iomem)
84237a826b261d Alex Williamson 2013-02-18 334 return -ENOMEM;
84237a826b261d Alex Williamson 2013-02-18 335
84237a826b261d Alex Williamson 2013-02-18 336 ret = vga_get_interruptible(vdev->pdev, rsrc);
84237a826b261d Alex Williamson 2013-02-18 337 if (ret) {
84237a826b261d Alex Williamson 2013-02-18 338 is_ioport ? ioport_unmap(iomem) : iounmap(iomem);
84237a826b261d Alex Williamson 2013-02-18 339 return ret;
84237a826b261d Alex Williamson 2013-02-18 340 }
84237a826b261d Alex Williamson 2013-02-18 341
bc93b9ae0151ae Alex Williamson 2020-08-17 342 /*
bc93b9ae0151ae Alex Williamson 2020-08-17 343 * VGA MMIO is a legacy, non-BAR resource that hopefully allows
bc93b9ae0151ae Alex Williamson 2020-08-17 344 * probing, so we don't currently worry about access in relation
bc93b9ae0151ae Alex Williamson 2020-08-17 345 * to the memory enable bit in the command register.
bc93b9ae0151ae Alex Williamson 2020-08-17 346 */
bc93b9ae0151ae Alex Williamson 2020-08-17 347 done = do_io_rw(vdev, false, iomem, buf, off, count, 0, 0, iswrite);
84237a826b261d Alex Williamson 2013-02-18 348
84237a826b261d Alex Williamson 2013-02-18 349 vga_put(vdev->pdev, rsrc);
84237a826b261d Alex Williamson 2013-02-18 350
84237a826b261d Alex Williamson 2013-02-18 351 is_ioport ? ioport_unmap(iomem) : iounmap(iomem);
84237a826b261d Alex Williamson 2013-02-18 352
84237a826b261d Alex Williamson 2013-02-18 353 if (done >= 0)
84237a826b261d Alex Williamson 2013-02-18 354 *ppos += done;
84237a826b261d Alex Williamson 2013-02-18 355
84237a826b261d Alex Williamson 2013-02-18 356 return done;
84237a826b261d Alex Williamson 2013-02-18 357 }
30656177c40804 Alex Williamson 2018-03-21 358
:::::: The code at line 317 was first introduced by commit
:::::: 84237a826b261de7ddd3d09ee53ee68cb4138937 vfio-pci: Add support for VGA region access
:::::: TO: Alex Williamson <alex.williamson@...hat.com>
:::::: CC: Alex Williamson <alex.williamson@...hat.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (62337 bytes)
Powered by blists - more mailing lists