Merge tag 'drm-for-v4.15' of git://people.freedesktop.org/~airlied/linux
Pull drm updates from Dave Airlie: "This is the main drm pull request for v4.15. Core: - Atomic object lifetime fixes - Atomic iterator improvements - Sparse/smatch fixes - Legacy kms ioctls to be interruptible - EDID override improvements - fb/gem helper cleanups - Simple outreachy patches - Documentation improvements - Fix dma-buf rcu races - DRM mode object leasing for improving VR use cases. - vgaarb improvements for non-x86 platforms. New driver: - tve200: Faraday Technology TVE200 block. This "TV Encoder" encodes a ITU-T BT.656 stream and can be found in the StorLink SL3516 (later Cortina Systems CS3516) as well as the Grain Media GM8180. New bridges: - SiI9234 support New panels: - S6E63J0X03, OTM8009A, Seiko 43WVF1G, 7" rpi touch panel, Toshiba LT089AC19000, Innolux AT043TN24 i915: - Remove Coffeelake from alpha support - Cannonlake workarounds - Infoframe refactoring for DisplayPort - VBT updates - DisplayPort vswing/emph/buffer translation refactoring - CCS fixes - Restore GPU clock boost on missed vblanks - Scatter list updates for userptr allocations - Gen9+ transition watermarks - Display IPC (Isochronous Priority Control) - Private PAT management - GVT: improved error handling and pci config sanitizing - Execlist refactoring - Transparent Huge Page support - User defined priorities support - HuC/GuC firmware refactoring - DP MST fixes - eDP power sequencing fixes - Use RCU instead of stop_machine - PSR state tracking support - Eviction fixes - BDW DP aux channel timeout fixes - LSPCON fixes - Cannonlake PLL fixes amdgpu: - Per VM BO support - Powerplay cleanups - CI powerplay support - PASID mgr for kfd - SR-IOV fixes - initial GPU reset for vega10 - Prime mmap support - TTM updates - Clock query interface for Raven - Fence to handle ioctl - UVD encode ring support on Polaris - Transparent huge page DMA support - Compute LRU pipe tweaks - BO flag to allow buffers to opt out of implicit sync - CTX priority setting API - VRAM lost infrastructure plumbing qxl: - fix flicker since atomic rework amdkfd: - Further improvements from internal AMD tree - Usermode events - Drop radeon support nouveau: - Pascal temperature sensor support - Improved BAR2 handling - MMU rework to support Pascal MMU exynos: - Improved HDMI/mixer support - HDMI audio interface support tegra: - Prep work for tegra186 - Cleanup/fixes msm: - Preemption support for a5xx - Display fixes for 8x96 (snapdragon 820) - Async cursor plane fixes - FW loading rework - GPU debugging improvements vc4: - Prep for DSI panels - fix T-format tiling scanout - New madvise ioctl Rockchip: - LVDS support omapdrm: - omap4 HDMI CEC support etnaviv: - GPU performance counters groundwork sun4i: - refactor driver load + TCON backend - HDMI improvements - A31 support - Misc fixes udl: - Probe/EDID read fixes. tilcdc: - Misc fixes. pl111: - Support more variants adv7511: - Improve EDID handling. - HDMI CEC support sii8620: - Add remote control support" * tag 'drm-for-v4.15' of git://people.freedesktop.org/~airlied/linux: (1480 commits) drm/rockchip: analogix_dp: Use mutex rather than spinlock drm/mode_object: fix documentation for object lookups. drm/i915: Reorder context-close to avoid calling i915_vma_close() under RCU drm/i915: Move init_clock_gating() back to where it was drm/i915: Prune the reservation shared fence array drm/i915: Idle the GPU before shinking everything drm/i915: Lock llist_del_first() vs llist_del_all() drm/i915: Calculate ironlake intermediate watermarks correctly, v2. drm/i915: Disable lazy PPGTT page table optimization for vGPU drm/i915/execlists: Remove the priority "optimisation" drm/i915: Filter out spurious execlists context-switch interrupts drm/amdgpu: use irq-safe lock for kiq->ring_lock drm/amdgpu: bypass lru touch for KIQ ring submission drm/amdgpu: Potential uninitialized variable in amdgpu_vm_update_directories() drm/amdgpu: potential uninitialized variable in amdgpu_vce_ring_parse_cs() drm/amd/powerplay: initialize a variable before using it drm/amd/powerplay: suppress KASAN out of bounds warning in vega10_populate_all_memory_levels drm/amd/amdgpu: fix evicted VRAM bo adjudgement condition drm/vblank: Tune drm_crtc_accurate_vblank_count() WARN down to a debug drm/rockchip: add CONFIG_OF dependency for lvds ...
This commit is contained in:
30
tools/testing/scatterlist/Makefile
Normal file
30
tools/testing/scatterlist/Makefile
Normal file
@@ -0,0 +1,30 @@
|
||||
CFLAGS += -I. -I../../include -g -O2 -Wall -fsanitize=address
|
||||
LDFLAGS += -fsanitize=address -fsanitize=undefined
|
||||
TARGETS = main
|
||||
OFILES = main.o scatterlist.o
|
||||
|
||||
ifeq ($(BUILD), 32)
|
||||
CFLAGS += -m32
|
||||
LDFLAGS += -m32
|
||||
endif
|
||||
|
||||
targets: include $(TARGETS)
|
||||
|
||||
main: $(OFILES)
|
||||
|
||||
clean:
|
||||
$(RM) $(TARGETS) $(OFILES) scatterlist.c linux/scatterlist.h linux/highmem.h linux/kmemleak.h asm/io.h
|
||||
@rmdir asm
|
||||
|
||||
scatterlist.c: ../../../lib/scatterlist.c
|
||||
@sed -e 's/^static //' -e 's/__always_inline //' -e 's/inline //' < $< > $@
|
||||
|
||||
.PHONY: include
|
||||
|
||||
include: ../../../include/linux/scatterlist.h
|
||||
@mkdir -p linux
|
||||
@mkdir -p asm
|
||||
@touch asm/io.h
|
||||
@touch linux/highmem.h
|
||||
@touch linux/kmemleak.h
|
||||
@cp $< linux/scatterlist.h
|
125
tools/testing/scatterlist/linux/mm.h
Normal file
125
tools/testing/scatterlist/linux/mm.h
Normal file
@@ -0,0 +1,125 @@
|
||||
#ifndef _LINUX_MM_H
|
||||
#define _LINUX_MM_H
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
|
||||
typedef unsigned long dma_addr_t;
|
||||
|
||||
#define unlikely
|
||||
|
||||
#define BUG_ON(x) assert(!(x))
|
||||
|
||||
#define WARN_ON(condition) ({ \
|
||||
int __ret_warn_on = !!(condition); \
|
||||
unlikely(__ret_warn_on); \
|
||||
})
|
||||
|
||||
#define WARN_ON_ONCE(condition) ({ \
|
||||
int __ret_warn_on = !!(condition); \
|
||||
if (unlikely(__ret_warn_on)) \
|
||||
assert(0); \
|
||||
unlikely(__ret_warn_on); \
|
||||
})
|
||||
|
||||
#define PAGE_SIZE (4096)
|
||||
#define PAGE_SHIFT (12)
|
||||
#define PAGE_MASK (~(PAGE_SIZE-1))
|
||||
|
||||
#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
|
||||
#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
|
||||
#define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
|
||||
|
||||
#define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE)
|
||||
|
||||
#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK)
|
||||
|
||||
#define virt_to_page(x) ((void *)x)
|
||||
#define page_address(x) ((void *)x)
|
||||
|
||||
static inline unsigned long page_to_phys(struct page *page)
|
||||
{
|
||||
assert(0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define page_to_pfn(page) ((unsigned long)(page) / PAGE_SIZE)
|
||||
#define pfn_to_page(pfn) (void *)((pfn) * PAGE_SIZE)
|
||||
#define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n))
|
||||
|
||||
#define __min(t1, t2, min1, min2, x, y) ({ \
|
||||
t1 min1 = (x); \
|
||||
t2 min2 = (y); \
|
||||
(void) (&min1 == &min2); \
|
||||
min1 < min2 ? min1 : min2; })
|
||||
|
||||
#define ___PASTE(a,b) a##b
|
||||
#define __PASTE(a,b) ___PASTE(a,b)
|
||||
|
||||
#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
|
||||
|
||||
#define min(x, y) \
|
||||
__min(typeof(x), typeof(y), \
|
||||
__UNIQUE_ID(min1_), __UNIQUE_ID(min2_), \
|
||||
x, y)
|
||||
|
||||
#define min_t(type, x, y) \
|
||||
__min(type, type, \
|
||||
__UNIQUE_ID(min1_), __UNIQUE_ID(min2_), \
|
||||
x, y)
|
||||
|
||||
#define preemptible() (1)
|
||||
|
||||
static inline void *kmap(struct page *page)
|
||||
{
|
||||
assert(0);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline void *kmap_atomic(struct page *page)
|
||||
{
|
||||
assert(0);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline void kunmap(void *addr)
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
|
||||
static inline void kunmap_atomic(void *addr)
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
|
||||
static inline unsigned long __get_free_page(unsigned int flags)
|
||||
{
|
||||
return (unsigned long)malloc(PAGE_SIZE);
|
||||
}
|
||||
|
||||
static inline void free_page(unsigned long page)
|
||||
{
|
||||
free((void *)page);
|
||||
}
|
||||
|
||||
static inline void *kmalloc(unsigned int size, unsigned int flags)
|
||||
{
|
||||
return malloc(size);
|
||||
}
|
||||
|
||||
#define kfree(x) free(x)
|
||||
|
||||
#define kmemleak_alloc(a, b, c, d)
|
||||
#define kmemleak_free(a)
|
||||
|
||||
#define PageSlab(p) (0)
|
||||
#define flush_kernel_dcache_page(p)
|
||||
|
||||
#endif
|
79
tools/testing/scatterlist/main.c
Normal file
79
tools/testing/scatterlist/main.c
Normal file
@@ -0,0 +1,79 @@
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <linux/scatterlist.h>
|
||||
|
||||
#define MAX_PAGES (64)
|
||||
|
||||
static void set_pages(struct page **pages, const unsigned *array, unsigned num)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
assert(num < MAX_PAGES);
|
||||
for (i = 0; i < num; i++)
|
||||
pages[i] = (struct page *)(unsigned long)
|
||||
((1 + array[i]) * PAGE_SIZE);
|
||||
}
|
||||
|
||||
#define pfn(...) (unsigned []){ __VA_ARGS__ }
|
||||
|
||||
int main(void)
|
||||
{
|
||||
const unsigned int sgmax = SCATTERLIST_MAX_SEGMENT;
|
||||
struct test {
|
||||
int alloc_ret;
|
||||
unsigned num_pages;
|
||||
unsigned *pfn;
|
||||
unsigned size;
|
||||
unsigned int max_seg;
|
||||
unsigned int expected_segments;
|
||||
} *test, tests[] = {
|
||||
{ -EINVAL, 1, pfn(0), PAGE_SIZE, PAGE_SIZE + 1, 1 },
|
||||
{ -EINVAL, 1, pfn(0), PAGE_SIZE, 0, 1 },
|
||||
{ -EINVAL, 1, pfn(0), PAGE_SIZE, sgmax + 1, 1 },
|
||||
{ 0, 1, pfn(0), PAGE_SIZE, sgmax, 1 },
|
||||
{ 0, 1, pfn(0), 1, sgmax, 1 },
|
||||
{ 0, 2, pfn(0, 1), 2 * PAGE_SIZE, sgmax, 1 },
|
||||
{ 0, 2, pfn(1, 0), 2 * PAGE_SIZE, sgmax, 2 },
|
||||
{ 0, 3, pfn(0, 1, 2), 3 * PAGE_SIZE, sgmax, 1 },
|
||||
{ 0, 3, pfn(0, 2, 1), 3 * PAGE_SIZE, sgmax, 3 },
|
||||
{ 0, 3, pfn(0, 1, 3), 3 * PAGE_SIZE, sgmax, 2 },
|
||||
{ 0, 3, pfn(1, 2, 4), 3 * PAGE_SIZE, sgmax, 2 },
|
||||
{ 0, 3, pfn(1, 3, 4), 3 * PAGE_SIZE, sgmax, 2 },
|
||||
{ 0, 4, pfn(0, 1, 3, 4), 4 * PAGE_SIZE, sgmax, 2 },
|
||||
{ 0, 5, pfn(0, 1, 3, 4, 5), 5 * PAGE_SIZE, sgmax, 2 },
|
||||
{ 0, 5, pfn(0, 1, 3, 4, 6), 5 * PAGE_SIZE, sgmax, 3 },
|
||||
{ 0, 5, pfn(0, 1, 2, 3, 4), 5 * PAGE_SIZE, sgmax, 1 },
|
||||
{ 0, 5, pfn(0, 1, 2, 3, 4), 5 * PAGE_SIZE, 2 * PAGE_SIZE, 3 },
|
||||
{ 0, 6, pfn(0, 1, 2, 3, 4, 5), 6 * PAGE_SIZE, 2 * PAGE_SIZE, 3 },
|
||||
{ 0, 6, pfn(0, 2, 3, 4, 5, 6), 6 * PAGE_SIZE, 2 * PAGE_SIZE, 4 },
|
||||
{ 0, 6, pfn(0, 1, 3, 4, 5, 6), 6 * PAGE_SIZE, 2 * PAGE_SIZE, 3 },
|
||||
{ 0, 0, NULL, 0, 0, 0 },
|
||||
};
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0, test = tests; test->expected_segments; test++, i++) {
|
||||
struct page *pages[MAX_PAGES];
|
||||
struct sg_table st;
|
||||
int ret;
|
||||
|
||||
set_pages(pages, test->pfn, test->num_pages);
|
||||
|
||||
ret = __sg_alloc_table_from_pages(&st, pages, test->num_pages,
|
||||
0, test->size, test->max_seg,
|
||||
GFP_KERNEL);
|
||||
assert(ret == test->alloc_ret);
|
||||
|
||||
if (test->alloc_ret)
|
||||
continue;
|
||||
|
||||
assert(st.nents == test->expected_segments);
|
||||
assert(st.orig_nents == test->expected_segments);
|
||||
|
||||
sg_free_table(&st);
|
||||
}
|
||||
|
||||
assert(i == (sizeof(tests) / sizeof(tests[0])) - 1);
|
||||
|
||||
return 0;
|
||||
}
|
Viittaa uudesa ongelmassa
Block a user