qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

linux-headers: add linux/mman.h.

Update it to 4.20-rc1

Signed-off-by: Zhang Yi <yi.z.zhang@linux.intel.com>
Message-Id: <f9346f1816b940a4231524a84d57a2cac8466ccc.1549555521.git.yi.z.zhang@linux.intel.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

authored by

Zhang Yi and committed by
Eduardo Habkost
8cf108c5 0289881f

+359
+4
linux-headers/asm-arm/mman.h
··· 1 + #include <asm-generic/mman.h> 2 + 3 + #define arch_mmap_check(addr, len, flags) \ 4 + (((flags) & MAP_FIXED && (addr) < FIRST_USER_ADDRESS) ? -EINVAL : 0)
+1
linux-headers/asm-arm64/mman.h
··· 1 + #include <asm-generic/mman.h>
+36
linux-headers/asm-generic/hugetlb_encode.h
··· 1 + #ifndef _ASM_GENERIC_HUGETLB_ENCODE_H_ 2 + #define _ASM_GENERIC_HUGETLB_ENCODE_H_ 3 + 4 + /* 5 + * Several system calls take a flag to request "hugetlb" huge pages. 6 + * Without further specification, these system calls will use the 7 + * system's default huge page size. If a system supports multiple 8 + * huge page sizes, the desired huge page size can be specified in 9 + * bits [26:31] of the flag arguments. The value in these 6 bits 10 + * will encode the log2 of the huge page size. 11 + * 12 + * The following definitions are associated with this huge page size 13 + * encoding in flag arguments. System call specific header files 14 + * that use this encoding should include this file. They can then 15 + * provide definitions based on these with their own specific prefix. 16 + * for example: 17 + * #define MAP_HUGE_SHIFT HUGETLB_FLAG_ENCODE_SHIFT 18 + */ 19 + 20 + #define HUGETLB_FLAG_ENCODE_SHIFT 26 21 + #define HUGETLB_FLAG_ENCODE_MASK 0x3f 22 + 23 + #define HUGETLB_FLAG_ENCODE_64KB (16 << HUGETLB_FLAG_ENCODE_SHIFT) 24 + #define HUGETLB_FLAG_ENCODE_512KB (19 << HUGETLB_FLAG_ENCODE_SHIFT) 25 + #define HUGETLB_FLAG_ENCODE_1MB (20 << HUGETLB_FLAG_ENCODE_SHIFT) 26 + #define HUGETLB_FLAG_ENCODE_2MB (21 << HUGETLB_FLAG_ENCODE_SHIFT) 27 + #define HUGETLB_FLAG_ENCODE_8MB (23 << HUGETLB_FLAG_ENCODE_SHIFT) 28 + #define HUGETLB_FLAG_ENCODE_16MB (24 << HUGETLB_FLAG_ENCODE_SHIFT) 29 + #define HUGETLB_FLAG_ENCODE_32MB (25 << HUGETLB_FLAG_ENCODE_SHIFT) 30 + #define HUGETLB_FLAG_ENCODE_256MB (28 << HUGETLB_FLAG_ENCODE_SHIFT) 31 + #define HUGETLB_FLAG_ENCODE_512MB (29 << HUGETLB_FLAG_ENCODE_SHIFT) 32 + #define HUGETLB_FLAG_ENCODE_1GB (30 << HUGETLB_FLAG_ENCODE_SHIFT) 33 + #define HUGETLB_FLAG_ENCODE_2GB (31 << HUGETLB_FLAG_ENCODE_SHIFT) 34 + #define HUGETLB_FLAG_ENCODE_16GB (34 << HUGETLB_FLAG_ENCODE_SHIFT) 35 + 36 + #endif /* _ASM_GENERIC_HUGETLB_ENCODE_H_ */
+77
linux-headers/asm-generic/mman-common.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 + #ifndef __ASM_GENERIC_MMAN_COMMON_H 3 + #define __ASM_GENERIC_MMAN_COMMON_H 4 + 5 + /* 6 + Author: Michael S. Tsirkin <mst@mellanox.co.il>, Mellanox Technologies Ltd. 7 + Based on: asm-xxx/mman.h 8 + */ 9 + 10 + #define PROT_READ 0x1 /* page can be read */ 11 + #define PROT_WRITE 0x2 /* page can be written */ 12 + #define PROT_EXEC 0x4 /* page can be executed */ 13 + #define PROT_SEM 0x8 /* page may be used for atomic ops */ 14 + #define PROT_NONE 0x0 /* page can not be accessed */ 15 + #define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */ 16 + #define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */ 17 + 18 + #define MAP_SHARED 0x01 /* Share changes */ 19 + #define MAP_PRIVATE 0x02 /* Changes are private */ 20 + #define MAP_SHARED_VALIDATE 0x03 /* share + validate extension flags */ 21 + #define MAP_TYPE 0x0f /* Mask for type of mapping */ 22 + #define MAP_FIXED 0x10 /* Interpret addr exactly */ 23 + #define MAP_ANONYMOUS 0x20 /* don't use a file */ 24 + #ifdef CONFIG_MMAP_ALLOW_UNINITIALIZED 25 + # define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could be uninitialized */ 26 + #else 27 + # define MAP_UNINITIALIZED 0x0 /* Don't support this flag */ 28 + #endif 29 + 30 + /* 0x0100 - 0x80000 flags are defined in asm-generic/mman.h */ 31 + #define MAP_FIXED_NOREPLACE 0x100000 /* MAP_FIXED which doesn't unmap underlying mapping */ 32 + 33 + /* 34 + * Flags for mlock 35 + */ 36 + #define MLOCK_ONFAULT 0x01 /* Lock pages in range after they are faulted in, do not prefault */ 37 + 38 + #define MS_ASYNC 1 /* sync memory asynchronously */ 39 + #define MS_INVALIDATE 2 /* invalidate the caches */ 40 + #define MS_SYNC 4 /* synchronous memory sync */ 41 + 42 + #define MADV_NORMAL 0 /* no further special treatment */ 43 + #define MADV_RANDOM 1 /* expect random page references */ 44 + #define MADV_SEQUENTIAL 2 /* expect sequential page references */ 45 + #define MADV_WILLNEED 3 /* will need these pages */ 46 + #define MADV_DONTNEED 4 /* don't need these pages */ 47 + 48 + /* common parameters: try to keep these consistent across architectures */ 49 + #define MADV_FREE 8 /* free pages only if memory pressure */ 50 + #define MADV_REMOVE 9 /* remove these pages & resources */ 51 + #define MADV_DONTFORK 10 /* don't inherit across fork */ 52 + #define MADV_DOFORK 11 /* do inherit across fork */ 53 + #define MADV_HWPOISON 100 /* poison a page for testing */ 54 + #define MADV_SOFT_OFFLINE 101 /* soft offline page for testing */ 55 + 56 + #define MADV_MERGEABLE 12 /* KSM may merge identical pages */ 57 + #define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages */ 58 + 59 + #define MADV_HUGEPAGE 14 /* Worth backing with hugepages */ 60 + #define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */ 61 + 62 + #define MADV_DONTDUMP 16 /* Explicity exclude from the core dump, 63 + overrides the coredump filter bits */ 64 + #define MADV_DODUMP 17 /* Clear the MADV_DONTDUMP flag */ 65 + 66 + #define MADV_WIPEONFORK 18 /* Zero memory on fork, child only */ 67 + #define MADV_KEEPONFORK 19 /* Undo MADV_WIPEONFORK */ 68 + 69 + /* compatibility flags */ 70 + #define MAP_FILE 0 71 + 72 + #define PKEY_DISABLE_ACCESS 0x1 73 + #define PKEY_DISABLE_WRITE 0x2 74 + #define PKEY_ACCESS_MASK (PKEY_DISABLE_ACCESS |\ 75 + PKEY_DISABLE_WRITE) 76 + 77 + #endif /* __ASM_GENERIC_MMAN_COMMON_H */
+24
linux-headers/asm-generic/mman.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 + #ifndef __ASM_GENERIC_MMAN_H 3 + #define __ASM_GENERIC_MMAN_H 4 + 5 + #include <asm-generic/mman-common.h> 6 + 7 + #define MAP_GROWSDOWN 0x0100 /* stack-like segment */ 8 + #define MAP_DENYWRITE 0x0800 /* ETXTBSY */ 9 + #define MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 10 + #define MAP_LOCKED 0x2000 /* pages are locked */ 11 + #define MAP_NORESERVE 0x4000 /* don't check for reservations */ 12 + #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 13 + #define MAP_NONBLOCK 0x10000 /* do not block on IO */ 14 + #define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */ 15 + #define MAP_HUGETLB 0x40000 /* create a huge page mapping */ 16 + #define MAP_SYNC 0x80000 /* perform synchronous page faults for the mapping */ 17 + 18 + /* Bits [26:31] are reserved, see mman-common.h for MAP_HUGETLB usage */ 19 + 20 + #define MCL_CURRENT 1 /* lock all current mappings */ 21 + #define MCL_FUTURE 2 /* lock all future mappings */ 22 + #define MCL_ONFAULT 4 /* lock all pages that are faulted in */ 23 + 24 + #endif /* __ASM_GENERIC_MMAN_H */
+108
linux-headers/asm-mips/mman.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 + /* 3 + * This file is subject to the terms and conditions of the GNU General Public 4 + * License. See the file "COPYING" in the main directory of this archive 5 + * for more details. 6 + * 7 + * Copyright (C) 1995, 1999, 2002 by Ralf Baechle 8 + */ 9 + #ifndef _ASM_MMAN_H 10 + #define _ASM_MMAN_H 11 + 12 + /* 13 + * Protections are chosen from these bits, OR'd together. The 14 + * implementation does not necessarily support PROT_EXEC or PROT_WRITE 15 + * without PROT_READ. The only guarantees are that no writing will be 16 + * allowed without PROT_WRITE and no access will be allowed for PROT_NONE. 17 + */ 18 + #define PROT_NONE 0x00 /* page can not be accessed */ 19 + #define PROT_READ 0x01 /* page can be read */ 20 + #define PROT_WRITE 0x02 /* page can be written */ 21 + #define PROT_EXEC 0x04 /* page can be executed */ 22 + /* 0x08 reserved for PROT_EXEC_NOFLUSH */ 23 + #define PROT_SEM 0x10 /* page may be used for atomic ops */ 24 + #define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */ 25 + #define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */ 26 + 27 + /* 28 + * Flags for mmap 29 + */ 30 + #define MAP_SHARED 0x001 /* Share changes */ 31 + #define MAP_PRIVATE 0x002 /* Changes are private */ 32 + #define MAP_SHARED_VALIDATE 0x003 /* share + validate extension flags */ 33 + #define MAP_TYPE 0x00f /* Mask for type of mapping */ 34 + #define MAP_FIXED 0x010 /* Interpret addr exactly */ 35 + 36 + /* not used by linux, but here to make sure we don't clash with ABI defines */ 37 + #define MAP_RENAME 0x020 /* Assign page to file */ 38 + #define MAP_AUTOGROW 0x040 /* File may grow by writing */ 39 + #define MAP_LOCAL 0x080 /* Copy on fork/sproc */ 40 + #define MAP_AUTORSRV 0x100 /* Logical swap reserved on demand */ 41 + 42 + /* These are linux-specific */ 43 + #define MAP_NORESERVE 0x0400 /* don't check for reservations */ 44 + #define MAP_ANONYMOUS 0x0800 /* don't use a file */ 45 + #define MAP_GROWSDOWN 0x1000 /* stack-like segment */ 46 + #define MAP_DENYWRITE 0x2000 /* ETXTBSY */ 47 + #define MAP_EXECUTABLE 0x4000 /* mark it as an executable */ 48 + #define MAP_LOCKED 0x8000 /* pages are locked */ 49 + #define MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ 50 + #define MAP_NONBLOCK 0x20000 /* do not block on IO */ 51 + #define MAP_STACK 0x40000 /* give out an address that is best suited for process/thread stacks */ 52 + #define MAP_HUGETLB 0x80000 /* create a huge page mapping */ 53 + #define MAP_FIXED_NOREPLACE 0x100000 /* MAP_FIXED which doesn't unmap underlying mapping */ 54 + 55 + /* 56 + * Flags for msync 57 + */ 58 + #define MS_ASYNC 0x0001 /* sync memory asynchronously */ 59 + #define MS_INVALIDATE 0x0002 /* invalidate mappings & caches */ 60 + #define MS_SYNC 0x0004 /* synchronous memory sync */ 61 + 62 + /* 63 + * Flags for mlockall 64 + */ 65 + #define MCL_CURRENT 1 /* lock all current mappings */ 66 + #define MCL_FUTURE 2 /* lock all future mappings */ 67 + #define MCL_ONFAULT 4 /* lock all pages that are faulted in */ 68 + 69 + /* 70 + * Flags for mlock 71 + */ 72 + #define MLOCK_ONFAULT 0x01 /* Lock pages in range after they are faulted in, do not prefault */ 73 + 74 + #define MADV_NORMAL 0 /* no further special treatment */ 75 + #define MADV_RANDOM 1 /* expect random page references */ 76 + #define MADV_SEQUENTIAL 2 /* expect sequential page references */ 77 + #define MADV_WILLNEED 3 /* will need these pages */ 78 + #define MADV_DONTNEED 4 /* don't need these pages */ 79 + 80 + /* common parameters: try to keep these consistent across architectures */ 81 + #define MADV_FREE 8 /* free pages only if memory pressure */ 82 + #define MADV_REMOVE 9 /* remove these pages & resources */ 83 + #define MADV_DONTFORK 10 /* don't inherit across fork */ 84 + #define MADV_DOFORK 11 /* do inherit across fork */ 85 + 86 + #define MADV_MERGEABLE 12 /* KSM may merge identical pages */ 87 + #define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages */ 88 + #define MADV_HWPOISON 100 /* poison a page for testing */ 89 + 90 + #define MADV_HUGEPAGE 14 /* Worth backing with hugepages */ 91 + #define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */ 92 + 93 + #define MADV_DONTDUMP 16 /* Explicity exclude from the core dump, 94 + overrides the coredump filter bits */ 95 + #define MADV_DODUMP 17 /* Clear the MADV_NODUMP flag */ 96 + 97 + #define MADV_WIPEONFORK 18 /* Zero memory on fork, child only */ 98 + #define MADV_KEEPONFORK 19 /* Undo MADV_WIPEONFORK */ 99 + 100 + /* compatibility flags */ 101 + #define MAP_FILE 0 102 + 103 + #define PKEY_DISABLE_ACCESS 0x1 104 + #define PKEY_DISABLE_WRITE 0x2 105 + #define PKEY_ACCESS_MASK (PKEY_DISABLE_ACCESS |\ 106 + PKEY_DISABLE_WRITE) 107 + 108 + #endif /* _ASM_MMAN_H */
+39
linux-headers/asm-powerpc/mman.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ 2 + /* 3 + * This program is free software; you can redistribute it and/or 4 + * modify it under the terms of the GNU General Public License 5 + * as published by the Free Software Foundation; either version 6 + * 2 of the License, or (at your option) any later version. 7 + */ 8 + #ifndef _ASM_POWERPC_MMAN_H 9 + #define _ASM_POWERPC_MMAN_H 10 + 11 + #include <asm-generic/mman-common.h> 12 + 13 + 14 + #define PROT_SAO 0x10 /* Strong Access Ordering */ 15 + 16 + #define MAP_RENAME MAP_ANONYMOUS /* In SunOS terminology */ 17 + #define MAP_NORESERVE 0x40 /* don't reserve swap pages */ 18 + #define MAP_LOCKED 0x80 19 + 20 + #define MAP_GROWSDOWN 0x0100 /* stack-like segment */ 21 + #define MAP_DENYWRITE 0x0800 /* ETXTBSY */ 22 + #define MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 23 + 24 + #define MCL_CURRENT 0x2000 /* lock all currently mapped pages */ 25 + #define MCL_FUTURE 0x4000 /* lock all additions to address space */ 26 + #define MCL_ONFAULT 0x8000 /* lock all pages that are faulted in */ 27 + 28 + #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 29 + #define MAP_NONBLOCK 0x10000 /* do not block on IO */ 30 + #define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */ 31 + #define MAP_HUGETLB 0x40000 /* create a huge page mapping */ 32 + 33 + /* Override any generic PKEY permission defines */ 34 + #define PKEY_DISABLE_EXECUTE 0x4 35 + #undef PKEY_ACCESS_MASK 36 + #define PKEY_ACCESS_MASK (PKEY_DISABLE_ACCESS |\ 37 + PKEY_DISABLE_WRITE |\ 38 + PKEY_DISABLE_EXECUTE) 39 + #endif /* _ASM_POWERPC_MMAN_H */
+1
linux-headers/asm-s390/mman.h
··· 1 + #include <asm-generic/mman.h>
+31
linux-headers/asm-x86/mman.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 + #ifndef _ASM_X86_MMAN_H 3 + #define _ASM_X86_MMAN_H 4 + 5 + #define MAP_32BIT 0x40 /* only give out 32bit addresses */ 6 + 7 + #ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS 8 + /* 9 + * Take the 4 protection key bits out of the vma->vm_flags 10 + * value and turn them in to the bits that we can put in 11 + * to a pte. 12 + * 13 + * Only override these if Protection Keys are available 14 + * (which is only on 64-bit). 15 + */ 16 + #define arch_vm_get_page_prot(vm_flags) __pgprot( \ 17 + ((vm_flags) & VM_PKEY_BIT0 ? _PAGE_PKEY_BIT0 : 0) | \ 18 + ((vm_flags) & VM_PKEY_BIT1 ? _PAGE_PKEY_BIT1 : 0) | \ 19 + ((vm_flags) & VM_PKEY_BIT2 ? _PAGE_PKEY_BIT2 : 0) | \ 20 + ((vm_flags) & VM_PKEY_BIT3 ? _PAGE_PKEY_BIT3 : 0)) 21 + 22 + #define arch_calc_vm_prot_bits(prot, key) ( \ 23 + ((key) & 0x1 ? VM_PKEY_BIT0 : 0) | \ 24 + ((key) & 0x2 ? VM_PKEY_BIT1 : 0) | \ 25 + ((key) & 0x4 ? VM_PKEY_BIT2 : 0) | \ 26 + ((key) & 0x8 ? VM_PKEY_BIT3 : 0)) 27 + #endif 28 + 29 + #include <asm-generic/mman.h> 30 + 31 + #endif /* _ASM_X86_MMAN_H */
+38
linux-headers/linux/mman.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 + #ifndef _LINUX_MMAN_H 3 + #define _LINUX_MMAN_H 4 + 5 + #include <asm/mman.h> 6 + #include <asm-generic/hugetlb_encode.h> 7 + 8 + #define MREMAP_MAYMOVE 1 9 + #define MREMAP_FIXED 2 10 + 11 + #define OVERCOMMIT_GUESS 0 12 + #define OVERCOMMIT_ALWAYS 1 13 + #define OVERCOMMIT_NEVER 2 14 + 15 + /* 16 + * Huge page size encoding when MAP_HUGETLB is specified, and a huge page 17 + * size other than the default is desired. See hugetlb_encode.h. 18 + * All known huge page size encodings are provided here. It is the 19 + * responsibility of the application to know which sizes are supported on 20 + * the running system. See mmap(2) man page for details. 21 + */ 22 + #define MAP_HUGE_SHIFT HUGETLB_FLAG_ENCODE_SHIFT 23 + #define MAP_HUGE_MASK HUGETLB_FLAG_ENCODE_MASK 24 + 25 + #define MAP_HUGE_64KB HUGETLB_FLAG_ENCODE_64KB 26 + #define MAP_HUGE_512KB HUGETLB_FLAG_ENCODE_512KB 27 + #define MAP_HUGE_1MB HUGETLB_FLAG_ENCODE_1MB 28 + #define MAP_HUGE_2MB HUGETLB_FLAG_ENCODE_2MB 29 + #define MAP_HUGE_8MB HUGETLB_FLAG_ENCODE_8MB 30 + #define MAP_HUGE_16MB HUGETLB_FLAG_ENCODE_16MB 31 + #define MAP_HUGE_32MB HUGETLB_FLAG_ENCODE_32MB 32 + #define MAP_HUGE_256MB HUGETLB_FLAG_ENCODE_256MB 33 + #define MAP_HUGE_512MB HUGETLB_FLAG_ENCODE_512MB 34 + #define MAP_HUGE_1GB HUGETLB_FLAG_ENCODE_1GB 35 + #define MAP_HUGE_2GB HUGETLB_FLAG_ENCODE_2GB 36 + #define MAP_HUGE_16GB HUGETLB_FLAG_ENCODE_16GB 37 + 38 + #endif /* _LINUX_MMAN_H */