Commit c8723711 authored by Dave Airlie's avatar Dave Airlie
Browse files

Merge tag 'drm-misc-next-2019-08-23' of git://anongit.freedesktop.org/drm/drm-misc into drm-next



drm-misc-next for 5.4:

UAPI Changes:

Cross-subsystem Changes:

Core Changes:
  - dma-buf: dma-fence selftests

Driver Changes:
  - kirin: Various cleanups and reworks
  - komeda: Add support for DT memory-regions
  - meson: Rely on the compatible to detect vpu features
  - omap: Implement alpha and pixel blend mode properties
  - panfrost: Implement per-fd address spaces, various fixes
  - rockchip: DSI DT binding rework
  - fbdev: Various cleanups

Signed-off-by: default avatarDave Airlie <airlied@redhat.com>

From: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190823083509.c7mduqdqjnxc7ubb@flea
parents 8c973fb6 e26ae7c0
Loading
Loading
Loading
Loading
+21 −2
Original line number Diff line number Diff line
@@ -14,6 +14,8 @@ Required properties:
- rockchip,grf: this soc should set GRF regs to mux vopl/vopb.
- ports: contain a port node with endpoint definitions as defined in [2].
  For vopb,set the reg = <0> and set the reg = <1> for vopl.
- video port 0 for the VOP input, the remote endpoint maybe vopb or vopl
- video port 1 for either a panel or subsequent encoder

Optional properties:
- power-domains: a phandle to mipi dsi power domain node.
@@ -40,11 +42,12 @@ Example:
		ports {
			#address-cells = <1>;
			#size-cells = <0>;
			reg = <1>;

			mipi_in: port {
			mipi_in: port@0 {
				reg = <0>;
				#address-cells = <1>;
				#size-cells = <0>;

				mipi_in_vopb: endpoint@0 {
					reg = <0>;
					remote-endpoint = <&vopb_out_mipi>;
@@ -54,6 +57,16 @@ Example:
					remote-endpoint = <&vopl_out_mipi>;
				};
			};

			mipi_out: port@1 {
				reg = <1>;
				#address-cells = <1>;
				#size-cells = <0>;

				mipi_out_panel: endpoint {
					remote-endpoint = <&panel_in_mipi>;
				};
			};
		};

		panel {
@@ -64,5 +77,11 @@ Example:
			pinctrl-names = "default";
			pinctrl-0 = <&lcd_en>;
			backlight = <&backlight>;

			port {
				panel_in_mipi: endpoint {
					remote-endpoint = <&mipi_out_panel>;
				};
			};
		};
	};
+5 −0
Original line number Diff line number Diff line
@@ -39,4 +39,9 @@ config UDMABUF
	  A driver to let userspace turn memfd regions into dma-bufs.
	  Qemu can use this to create host dmabufs for guest framebuffers.

config DMABUF_SELFTESTS
	tristate "Selftests for the dma-buf interfaces"
	default n
	depends on DMA_SHARED_BUFFER

endmenu
+6 −0
Original line number Diff line number Diff line
@@ -4,3 +4,9 @@ obj-y := dma-buf.o dma-fence.o dma-fence-array.o dma-fence-chain.o \
obj-$(CONFIG_SYNC_FILE)		+= sync_file.o
obj-$(CONFIG_SW_SYNC)		+= sw_sync.o sync_debug.o
obj-$(CONFIG_UDMABUF)		+= udmabuf.o

dmabuf_selftests-y := \
	selftest.o \
	st-dma-fence.o

obj-$(CONFIG_DMABUF_SELFTESTS)	+= dmabuf_selftests.o
+167 −0
Original line number Diff line number Diff line
/* SPDX-License-Identifier: MIT */

/*
 * Copyright © 2019 Intel Corporation
 */

#include <linux/compiler.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/sched/signal.h>
#include <linux/slab.h>

#include "selftest.h"

enum {
#define selftest(n, func) __idx_##n,
#include "selftests.h"
#undef selftest
};

#define selftest(n, f) [__idx_##n] = { .name = #n, .func = f },
static struct selftest {
	bool enabled;
	const char *name;
	int (*func)(void);
} selftests[] = {
#include "selftests.h"
};
#undef selftest

/* Embed the line number into the parameter name so that we can order tests */
#define param(n) __PASTE(igt__, __PASTE(__PASTE(__LINE__, __), n))
#define selftest_0(n, func, id) \
module_param_named(id, selftests[__idx_##n].enabled, bool, 0400);
#define selftest(n, func) selftest_0(n, func, param(n))
#include "selftests.h"
#undef selftest

int __sanitycheck__(void)
{
	pr_debug("Hello World!\n");
	return 0;
}

static char *__st_filter;

static bool apply_subtest_filter(const char *caller, const char *name)
{
	char *filter, *sep, *tok;
	bool result = true;

	filter = kstrdup(__st_filter, GFP_KERNEL);
	for (sep = filter; (tok = strsep(&sep, ","));) {
		bool allow = true;
		char *sl;

		if (*tok == '!') {
			allow = false;
			tok++;
		}

		if (*tok == '\0')
			continue;

		sl = strchr(tok, '/');
		if (sl) {
			*sl++ = '\0';
			if (strcmp(tok, caller)) {
				if (allow)
					result = false;
				continue;
			}
			tok = sl;
		}

		if (strcmp(tok, name)) {
			if (allow)
				result = false;
			continue;
		}

		result = allow;
		break;
	}
	kfree(filter);

	return result;
}

int
__subtests(const char *caller, const struct subtest *st, int count, void *data)
{
	int err;

	for (; count--; st++) {
		cond_resched();
		if (signal_pending(current))
			return -EINTR;

		if (!apply_subtest_filter(caller, st->name))
			continue;

		pr_info("dma-buf: Running %s/%s\n", caller, st->name);

		err = st->func(data);
		if (err && err != -EINTR) {
			pr_err("dma-buf/%s: %s failed with error %d\n",
			       caller, st->name, err);
			return err;
		}
	}

	return 0;
}

static void set_default_test_all(struct selftest *st, unsigned long count)
{
	unsigned long i;

	for (i = 0; i < count; i++)
		if (st[i].enabled)
			return;

	for (i = 0; i < count; i++)
		st[i].enabled = true;
}

static int run_selftests(struct selftest *st, unsigned long count)
{
	int err = 0;

	set_default_test_all(st, count);

	/* Tests are listed in natural order in selftests.h */
	for (; count--; st++) {
		if (!st->enabled)
			continue;

		pr_info("dma-buf: Running %s\n", st->name);
		err = st->func();
		if (err)
			break;
	}

	if (WARN(err > 0 || err == -ENOTTY,
		 "%s returned %d, conflicting with selftest's magic values!\n",
		 st->name, err))
		err = -1;

	return err;
}

static int __init st_init(void)
{
	return run_selftests(selftests, ARRAY_SIZE(selftests));
}

static void __exit st_exit(void)
{
}

module_param_named(st_filter, __st_filter, charp, 0400);
module_init(st_init);
module_exit(st_exit);

MODULE_DESCRIPTION("Self-test harness for dma-buf");
MODULE_LICENSE("GPL and additional rights");
+30 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: MIT

/*
 * Copyright © 2019 Intel Corporation
 */

#ifndef __SELFTEST_H__
#define __SELFTEST_H__

#include <linux/compiler.h>

#define selftest(name, func) int func(void);
#include "selftests.h"
#undef selftest

struct subtest {
	int (*func)(void *data);
	const char *name;
};

int __subtests(const char *caller,
	       const struct subtest *st,
	       int count,
	       void *data);
#define subtests(T, data) \
	__subtests(__func__, T, ARRAY_SIZE(T), data)

#define SUBTEST(x) { x, #x }

#endif /* __SELFTEST_H__ */
Loading