/linux/arch/arm/mm/ |
H A D | dma-mapping.c | 1 // SPDX-License-Identifier: GPL-2.0-only 3 * linux/arch/arm/mm/dma-mapping.c 5 * Copyright (C) 2000-2004 Russell King 17 #include <linux/dma-direct.h> 18 #include <linux/dma-map-ops.h> 28 #include <asm/page.h> 33 #include <asm/dma-iommu.h> 36 #include <asm/xen/xen-ops.h> 43 size_t size; member 53 size_t size; member [all …]
|
/linux/kernel/dma/ |
H A D | direct.c | 1 // SPDX-License-Identifier: GPL-2.0 3 * Copyright (C) 2018-2020 Christoph Hellwig. 10 #include <linux/dma-map-ops.h> 16 #include <linux/pci-p2pdma.h> 22 * override the variable below for dma-direct to work properly. 34 static inline struct page *dma_direct_to_page(struct device *dev, in dma_direct_to_page() 42 phys_addr_t phys = (phys_addr_t)(max_pfn - 1) << PAGE_SHIFT; in dma_direct_get_required_mask() 45 return (1ULL << (fls64(max_dma) - 1)) * 2 - 1; in dma_direct_get_required_mask() 51 dev->coherent_dma_mask, in dma_direct_optimal_gfp_mask() 52 dev->bus_dma_limit); in dma_direct_optimal_gfp_mask() [all …]
|
H A D | ops_helpers.c | 1 // SPDX-License-Identifier: GPL-2.0 6 #include <linux/dma-map-ops.h> 7 #include <linux/iommu-dma.h> 9 static struct page *dma_common_vaddr_to_page(void *cpu_addr) in dma_common_vaddr_to_page() 17 * Create scatter-list for the already allocated DMA buffer. 20 void *cpu_addr, dma_addr_t dma_addr, size_t size, in dma_common_get_sgtable() argument 23 struct page *page = dma_common_vaddr_to_page(cpu_addr); in dma_common_get_sgtable() local 28 sg_set_page(sgt->sgl, page, PAGE_ALIGN(size), 0); in dma_common_get_sgtable() 33 * Create userspace mapping for the DMA-coherent memory. 36 void *cpu_addr, dma_addr_t dma_addr, size_t size, in dma_common_mmap() argument [all …]
|
H A D | pool.c | 1 // SPDX-License-Identifier: GPL-2.0 8 #include <linux/dma-map-ops.h> 9 #include <linux/dma-direct.h> 23 /* Size can be defined by the coherent_pool command line */ 46 static void dma_atomic_pool_size_add(gfp_t gfp, size_t size) in dma_atomic_pool_size_add() argument 49 pool_size_dma += size; in dma_atomic_pool_size_add() 51 pool_size_dma32 += size; in dma_atomic_pool_size_add() 53 pool_size_kernel += size; in dma_atomic_pool_size_add() 58 unsigned long size; in cma_in_zone() local 66 size = cma_get_size(cma); in cma_in_zone() [all …]
|
H A D | contiguous.c | 1 // SPDX-License-Identifier: GPL-2.0+ 4 * Copyright (c) 2010-2011 by Samsung Electronics. 17 * Various devices on embedded systems have no scatter-getter and/or 30 * inaccessible to page system even if device drivers don't use it. 40 #include <asm/page.h> 45 #include <linux/dma-map-ops.h> 58 * Default global CMA area size can be defined in kernel's .config. 61 * The size can be set in bytes or as a percentage of the total memory 64 * Users, who want to set the size of global CMA area for their system 68 static phys_addr_t size_cmdline __initdata = -1; [all …]
|
/linux/include/net/page_pool/ |
H A D | helpers.h | 1 /* SPDX-License-Identifier: GPL-2.0 11 * The page_pool allocator is optimized for recycling page or page fragment used 15 * which allocate memory with or without page splitting depending on the 16 * requested memory size. 19 * always smaller than half a page, it can use one of the more specific API 22 * 1. page_pool_alloc_pages(): allocate memory without page splitting when 23 * driver knows that the memory it need is always bigger than half of the page 111 page_pool_dev_alloc_frag(struct page_pool * pool,unsigned int * offset,unsigned int size) page_pool_dev_alloc_frag() argument 120 page_pool_alloc_netmem(struct page_pool * pool,unsigned int * offset,unsigned int * size,gfp_t gfp) page_pool_alloc_netmem() argument 149 page_pool_dev_alloc_netmem(struct page_pool * pool,unsigned int * offset,unsigned int * size) page_pool_dev_alloc_netmem() argument 158 page_pool_alloc(struct page_pool * pool,unsigned int * offset,unsigned int * size,gfp_t gfp) page_pool_alloc() argument 177 page_pool_dev_alloc(struct page_pool * pool,unsigned int * offset,unsigned int * size) page_pool_dev_alloc() argument 185 page_pool_alloc_va(struct page_pool * pool,unsigned int * size,gfp_t gfp) page_pool_alloc_va() argument 188 struct page *page; page_pool_alloc_va() local 210 page_pool_dev_alloc_va(struct page_pool * pool,unsigned int * size) page_pool_dev_alloc_va() argument 253 page_pool_fragment_page(struct page * page,long nr) page_pool_fragment_page() argument 303 page_pool_unref_page(struct page * page,long nr) page_pool_unref_page() argument 313 page_pool_ref_page(struct page * page) page_pool_ref_page() argument 354 page_pool_put_page(struct page_pool * pool,struct page * page,unsigned int dma_sync_size,bool allow_direct) page_pool_put_page() argument 379 page_pool_put_full_page(struct page_pool * pool,struct page * page,bool allow_direct) page_pool_put_full_page() argument 393 page_pool_recycle_direct(struct page_pool * pool,struct page * page) page_pool_recycle_direct() argument 432 page_pool_get_dma_addr(const struct page * page) page_pool_get_dma_addr() argument 464 page_pool_dma_sync_for_cpu(const struct page_pool * pool,const struct page * page,u32 offset,u32 dma_sync_size) page_pool_dma_sync_for_cpu() argument [all...] |
/linux/arch/arm64/include/asm/ |
H A D | kvm_pgtable.h | 1 // SPDX-License-Identifier: GPL-2.0-only 14 #define KVM_PGTABLE_FIRST_LEVEL -1 18 * The largest supported block sizes for KVM (no 52-bit PA support): 19 * - 4K (level 1): 1GB 20 * - 16K (level 2): 32MB 21 * - 64K (level 2): 512MB 60 #define KVM_PHYS_INVALID (-1ULL) 104 * Used to indicate a pte for which a 'break-before-make' sequence is in 181 static inline bool kvm_is_block_size_supported(u64 size) in kvm_is_block_size_supported() argument 183 bool is_power_of_two = IS_ALIGNED(size, size); in kvm_is_block_size_supported() [all …]
|
/linux/Documentation/admin-guide/mm/ |
H A D | transhuge.rst | 12 that supports the automatic promotion and demotion of page sizes and 19 in the examples below we presume that the basic page size is 4K and 20 the huge page size is 2M, although the actual numbers may vary 26 requiring larger clear-page copy-page in page faults which is a 28 single page fault for each 2M virtual region touched by userland (so 43 larger size only if both KVM and the Linux guest are using 48 Modern kernels support "multi-size THP" (mTHP), which introduces the 49 ability to allocate memory in blocks that are bigger than a base page 50 but smaller than traditional PMD-size (as described above), in 51 increments of a power-of-2 number of pages. mTHP can back anonymous [all …]
|
/linux/mm/ |
H A D | dmapool.c | 1 // SPDX-License-Identifier: GPL-2.0-only 9 * This allocator returns small blocks of a given size which are DMA-able by 10 * the given device. It uses the dma_alloc_coherent page allocator to get 11 * new pages, then splits them up into blocks of the required size. 15 * represented by the 'struct dma_pool' which keeps a doubly-linked list of 16 * allocated pages. Each page i 56 unsigned int size; global() member 75 unsigned size; pools_show() local 122 struct dma_page *page; pool_find_page() local 136 struct dma_page *page; pool_block_err() local 159 pool_init_page(struct dma_pool * pool,struct dma_page * page) pool_init_page() argument 176 pool_init_page(struct dma_pool * pool,struct dma_page * page) pool_init_page() argument 225 dma_pool_create(const char * name,struct device * dev,size_t size,size_t align,size_t boundary) dma_pool_create() argument 300 pool_initialise_page(struct dma_pool * pool,struct dma_page * page) pool_initialise_page() argument 336 struct dma_page *page; pool_alloc_page() local 362 struct dma_page *page, *tmp; dma_pool_destroy() local 408 struct dma_page *page; dma_pool_alloc() local 494 dmam_pool_create(const char * name,struct device * dev,size_t size,size_t align,size_t allocation) dmam_pool_create() argument [all...] |
H A D | readahead.c | 1 // SPDX-License-Identifier: GPL-2.0-only 3 * mm/readahead.c - address_space-level file readahead. 14 * Readahead is used to read content into the page cache before it is 16 * attempts to read folios that are not yet in the page cache. If a 17 * folio is present but not up-to-dat 368 get_init_ra_size(unsigned long size,unsigned long max) get_init_ra_size() argument [all...] |
/linux/drivers/vdpa/vdpa_user/ |
H A D | iova_domain.c | 1 // SPDX-License-Identifier: GPL-2.0-only 3 * MMU-based software IOTLB. 5 * Copyright (C) 2020-2021 Bytedance Inc. and/or its affiliates. All rights reserved. 30 return -ENOMEM; in vduse_iotlb_add_range() 32 map_file->file = get_file(file); in vduse_iotlb_add_range() 33 map_file->offset = offset; in vduse_iotlb_add_range() 35 ret = vhost_iotlb_add_range_ctx(domain->iotlb, start, last, in vduse_iotlb_add_range() 38 fput(map_file->file); in vduse_iotlb_add_range() 51 while ((map = vhost_iotlb_itree_first(domain->iotlb, start, last))) { in vduse_iotlb_del_range() 52 map_file = (struct vdpa_map_file *)map->opaque; in vduse_iotlb_del_range() [all …]
|
/linux/include/linux/ |
H A D | dma-map-ops.h | 1 /* SPDX-License-Identifier: GPL-2.0 */ 9 #include <linux/dma-mapping.h> 17 void *(*alloc)(struct device *dev, size_t size, 20 void (*free)(struct device *dev, size_t size, void *vaddr, 22 struct page *(*alloc_pages_op)(struct device *dev, size_t size, 25 void (*free_pages)(struct device *dev, size_t size, struct page *vaddr, 31 void *cpu_addr, dma_addr_t dma_addr, size_t size, 34 dma_addr_t (*map_page)(struct device *dev, struct page *page, 35 unsigned long offset, size_t size, 38 size_t size, enum dma_data_direction dir, [all …]
|
/linux/drivers/misc/ |
H A D | vmw_balloon.c | 1 // SPDX-License-Identifier: GPL-2.0 5 * Copyright (C) 2000-2018, VMware, Inc. All Rights Reserved. 46 …"Enable non-cooperative out-of-memory protection. Disabled by default as it may degrade performanc… 54 /* Magic number for the balloon mount-point */ 80 #define VMW_BALLOON_2M_ORDER (PMD_SHIFT - PAGE_SHIFT) 83 * 64-bit targets are only supported in 64-bit 118 * enum vmballoon_cmd_type - backdoor commands. 140 * @VMW_BALLOON_CMD_GET_TARGET: Gets the balloon target size. 141 * @VMW_BALLOON_CMD_LOCK: Informs the hypervisor about a ballooned page. 142 * @VMW_BALLOON_CMD_UNLOCK: Informs the hypervisor about a page that is about [all …]
|
/linux/arch/powerpc/include/asm/nohash/32/ |
H A D | mmu-8xx.h | 1 /* SPDX-License-Identifier: GPL-2.0 */ 10 * During software tablewalk, the registers used perform mask/shift-add 34 * Then we use the APG to say whether accesses are according to Page rules or 39 * 0 => Kernel => 11 (all accesses performed according as user iaw page definition) 40 * 1 => Kernel+Accessed => 01 (all accesses performed according to page definition) 41 * 2 => User => 11 (all accesses performed according as user iaw page definition) 42 * 3 => User+Accessed => 10 (all accesses performed according to swaped page definition) for KUEP 43 * 4-15 => Not Used 47 /* The effective page number register. When read, contains the information 52 #define MI_EPNMASK 0xfffff000 /* Effective page number for entry */ [all …]
|
/linux/arch/powerpc/mm/ |
H A D | dma-noncoherent.c | 1 // SPDX-License-Identifier: GPL-2.0-only 13 #include <linux/dma-direct.h> 14 #include <linux/dma-map-ops.h> 22 static void __dma_sync(void *vaddr, size_t size, int direction) in __dma_sync() argument 25 unsigned long end = start + size; in __dma_sync() 32 * invalidate only when cache-line aligned otherwise there is in __dma_sync() 35 if ((start | end) & (L1_CACHE_BYTES - 1)) in __dma_sync() 52 * In this case, each page of a buffer must be kmapped/kunmapped 57 * beyond the first page. 59 static inline void __dma_sync_page_highmem(struct page *page, in __dma_sync_page_highmem() argument [all …]
|
/linux/fs/hfsplus/ |
H A D | bitmap.c | 1 // SPDX-License-Identifier: GPL-2.0 19 int hfsplus_block_allocate(struct super_block *sb, u32 size, in hfsplus_block_allocate() argument 23 struct page *page; in hfsplus_block_allocate() local 32 return size; in hfsplus_block_allocate() 34 hfs_dbg(BITMAP, "block_allocate: %u,%u,%u\n", size, offset, len); in hfsplus_block_allocate() 35 mutex_lock(&sbi->alloc_mutex); in hfsplus_block_allocate() 36 mapping = sbi->alloc_file->i_mapping; in hfsplus_block_allocate() 37 page = read_mapping_page(mapping, offset / PAGE_CACHE_BITS, NULL); in hfsplus_block_allocate() 38 if (IS_ERR(page)) { in hfsplus_block_allocate() 39 start = size; in hfsplus_block_allocate() [all …]
|
/linux/sound/pci/trident/ |
H A D | trident_memory.c | 1 // SPDX-License-Identifier: GPL-2.0-or-later 7 * Trident 4DWave-NX memory page allocation (TLB area) 19 /* page arguments of these two macros are Trident page (4096 bytes), not like 22 #define __set_tlb_bus(trident,page,addr) \ argument 23 (trident)->tlb.entries[page] = cpu_to_le32((addr) & ~(SNDRV_TRIDENT_PAGE_SIZE-1)) 24 #define __tlb_to_addr(trident,page) \ argument 25 (dma_addr_t)le32_to_cpu((trident->tlb.entries[page]) & ~(SNDRV_TRIDENT_PAGE_SIZE - 1)) 28 /* page size == SNDRV_TRIDENT_PAGE_SIZE */ 29 #define ALIGN_PAGE_SIZE PAGE_SIZE /* minimum page size for allocation */ 31 /* fill TLB entrie(s) corresponding to page with ptr */ [all …]
|
/linux/kernel/module/ |
H A D | decompress.c | 1 // SPDX-License-Identifier: GPL-2.0-or-later 19 struct page **new_pages; in module_extend_max_pages() 21 new_pages = kvmalloc_array(info->max_pages + extent, in module_extend_max_pages() 22 sizeof(info->pages), GFP_KERNEL); in module_extend_max_pages() 24 return -ENOMEM; in module_extend_max_pages() 26 memcpy(new_pages, info->pages, info->max_pages * sizeof(info->pages)); in module_extend_max_pages() 27 kvfree(info->pages); in module_extend_max_pages() 28 info->pages = new_pages; in module_extend_max_pages() 29 info->max_pages += extent; in module_extend_max_pages() 34 static struct page *module_get_next_page(struct load_info *info) in module_get_next_page() [all …]
|
/linux/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/ |
H A D | uvmm.c | 42 return nvkm_vmm_ref(nvkm_uvmm(object)->vmm); in nvkm_uvmm_search() 51 struct nvkm_vmm *vmm = uvmm->vmm; in nvkm_uvmm_mthd_pfnclr() 52 int ret = -ENOSYS; in nvkm_uvmm_mthd_pfnclr() 53 u64 addr, size; in nvkm_uvmm_mthd_pfnclr() local 55 if (!(ret = nvif_unpack(ret, &argv, &argc, args->v0, 0, 0, false))) { in nvkm_uvmm_mthd_pfnclr() 56 addr = args->v0.addr; in nvkm_uvmm_mthd_pfnclr() 57 size = args->v0.size; in nvkm_uvmm_mthd_pfnclr() 61 if (nvkm_vmm_in_managed_range(vmm, addr, size) && vmm->managed.raw) in nvkm_uvmm_mthd_pfnclr() 62 return -EINVAL; in nvkm_uvmm_mthd_pfnclr() 64 if (size) { in nvkm_uvmm_mthd_pfnclr() [all …]
|
/linux/tools/testing/selftests/mm/ |
H A D | cow.c | 1 // SPDX-License-Identifier: GPL-2.0-only 44 static int sz2ord(size_t size) in sz2ord() argument 46 return __builtin_ctzll(size / pagesize); in sz2ord() 69 ksft_print_msg("[INFO] detected THP size: %zu KiB\n", kb); in detect_thp_sizes() 100 static bool range_is_swapped(void *addr, size_t size) in range_is_swapped() argument 102 for (; size; addr += pagesize, size -= pagesize) in range_is_swapped() 115 if (pipe(comm_pipes->child_ready) < 0) { in setup_comm_pipes() 117 return -errno; in setup_comm_pipes() 119 if (pipe(comm_pipes->parent_ready) < 0) { in setup_comm_pipes() 121 close(comm_pipes->child_ready[0]); in setup_comm_pipes() [all …]
|
/linux/drivers/nvmem/ |
H A D | rave-sp-eeprom.c | 1 // SPDX-License-Identifier: GPL-2.0+ 10 #include <linux/mfd/rave-sp.h> 12 #include <linux/nvmem-provider.h> 18 * enum rave_sp_eeprom_access_type - Supported types of EEPROM access 29 * enum rave_sp_eeprom_header_size - EEPROM command header sizes 31 * @RAVE_SP_EEPROM_HEADER_SMALL: EEPROM header size for "small" devices (< 8K) 32 * @RAVE_SP_EEPROM_HEADER_BIG: EEPROM header size for "big" devices (> 8K) 43 * struct rave_sp_eeprom_page - RAVE SP EEPROM page 59 * struct rave_sp_eeprom - RAVE SP EEPROM device 64 * @header_size: Size of EEPROM command header for this device [all …]
|
/linux/drivers/net/thunderbolt/ |
H A D | trace.h | 1 /* SPDX-License-Identifier: GPL-2.0 */ 15 #include <linux/dma-direction.h> 26 TP_PROTO(unsigned int index, const void *page, dma_addr_t phys, 28 TP_ARGS(index, page, phys, dir), 31 __field(const void *, page) 36 __entry->index = index; 37 __entry->page = page; 38 __entry->phys = phys; 39 __entry->dir = dir; 41 TP_printk("index=%u page=%p phys=%pad dir=%s", [all …]
|
/linux/arch/arm64/boot/dts/renesas/ |
H A D | r8a779g3-sparrow-hawk.dts | 1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 3 * Device Tree Source for the R-Car V4H ES3.0 Sparrow Hawk board 20 * CONN3 (HeadSet) ---+----> MSIOF1 22 * CONN4 AUX ---------+ on/off (A) 36 * > arecord -f cd xxx.wav 39 /dts-v1/; 40 #include <dt-bindings/gpio/gpio.h> 46 compatible = "retronix,sparrow-hawk", "renesas,r8a779g3", 65 stdout-path = "serial0:921600n8"; 68 /* Page 31 / FAN */ [all …]
|
/linux/drivers/staging/media/ipu3/ |
H A D | ipu3-dmamap.c | 1 // SPDX-License-Identifier: GPL-2.0 13 #include "ipu3-css-pool.h" 14 #include "ipu3-mmu.h" 15 #include "ipu3-dmamap.h" 20 static void imgu_dmamap_free_buffer(struct page **pages, in imgu_dmamap_free_buffer() 21 size_t size) in imgu_dmamap_free_buffer() argument 23 int count = size >> PAGE_SHIFT; in imgu_dmamap_free_buffer() 25 while (count--) in imgu_dmamap_free_buffer() 32 * defined in drivers/iommu/dma-iommu.c 34 static struct page **imgu_dmamap_alloc_buffer(size_t size, gfp_t gfp) in imgu_dmamap_alloc_buffer() argument [all …]
|
/linux/mm/kmsan/ |
H A D | shadow.c | 1 // SPDX-License-Identifier: GPL-2.0 5 * Copyright (C) 2017-2022 Google LLC 22 #define shadow_page_for(page) ((page)->kmsan_shadow) argument 24 #define origin_page_for(page) ((page)->kmsan_origin) argument 26 static void *shadow_ptr_for(struct page *page) in shadow_ptr_for() argument 28 return page_address(shadow_page_for(page)); in shadow_ptr_for() 31 static void *origin_ptr_for(struct page *page) in origin_ptr_for() argument 33 return page_address(origin_page_for(page)); in origin_ptr_for() 36 static bool page_has_metadata(struct page *page) in page_has_metadata() argument 38 return shadow_page_for(page) && origin_page_for(page); in page_has_metadata() [all …]
|