Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rebase required Linux's patches on v4.9/rcar-3.5.9 #36

Merged
merged 25 commits into from
Mar 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
09c0162
clk:shmobile: Hide clock for SCIF2
Jun 9, 2016
146c56d
r8a7795(6).dtsi: Add ranges that AUDMACs relies on
otyshchenko1 Jan 24, 2017
c46b200
swiotlb-xen: implement xen_swiotlb_dma_mmap callback
Jan 10, 2017
63ce53d
swiotlb-xen: implement xen_swiotlb_get_sgtable callback
Jan 10, 2017
d55c385
drm: rcar-du: hack: Enable gsx clock too
otyshchenko1 Mar 30, 2017
3af2c41
xen/kbdif: update protocol description
Apr 10, 2017
8c1c8c9
xen/kbdif: add multi-touch support
Apr 10, 2017
b28f206
xen/displif: add ABI for para-virtual display
Apr 10, 2017
e17140e
xen: introduce xenbus_read_unsigned()
jgross1 Oct 31, 2016
9debc48
xen: make use of xenbus_read_unsigned() in xen-kbdfront
jgross1 Oct 31, 2016
b8d1cfd
xen/drm: add para-virtual DRM front-end driver
Dec 23, 2016
f571f6a
xen,input: add xen-kbdfront module parameter for setting resolution
jgross1 Apr 11, 2017
3f5e055
xen/input: use string constants from PV protocol
Apr 10, 2017
d345c55
xen/input: add multi-touch support
Apr 11, 2017
657f940
xen/sndif: add sound-device ABI
Apr 10, 2017
f078117
xen/snd: add para-virtual sound device driver
Nov 7, 2016
3d3312c
drm/xen-zcopy: Fix ballooning in/out
Nov 30, 2017
b8622cf
drm/xen-front: Rename dumb_cookie to dbuf_cookie
Nov 16, 2017
49e03e2
drm/xen-front: Handle PRIME import
Nov 16, 2017
bf91c0c
drm/xen-zcopy: Implement dumb free wait IOCTL
Dec 5, 2017
111d1f3
drm/xen: Major refactoring towards upstream
Dec 14, 2017
7a47400
drm/xen-front: Fix mmap operation
Dec 19, 2017
065255a
drm/xen-front: Use XenBus API to close frontend
Dec 19, 2017
643cf78
drm/xen-front: Rework vblank handling
Dec 26, 2017
bd274d4
[HACK?]rcar_du_vs: zero-out sg_tables on plane duplication
lorc Jan 5, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions arch/arm/xen/mm.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,29 @@ bool xen_arch_need_swiotlb(struct device *dev,
!is_device_dma_coherent(dev));
}

/*
* Create userspace mapping for the DMA-coherent memory.
*/
static int xen_swiotlb_dma_mmap(struct device *dev, struct vm_area_struct *vma,
void *cpu_addr, dma_addr_t dma_addr, size_t size,
unsigned long attrs)
{
if (__generic_dma_ops(dev)->mmap)
return __generic_dma_ops(dev)->mmap(dev, vma, cpu_addr, dma_addr, size, attrs);

return dma_common_mmap(dev, vma, cpu_addr, dma_addr, size);
}

static int xen_swiotlb_get_sgtable(struct device *dev, struct sg_table *sgt,
void *cpu_addr, dma_addr_t handle, size_t size,
unsigned long attrs)
{
if (__generic_dma_ops(dev)->get_sgtable)
return __generic_dma_ops(dev)->get_sgtable(dev, sgt, cpu_addr, handle,
size, attrs);
return dma_common_get_sgtable(dev, sgt, cpu_addr, handle, size);
}

int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order,
unsigned int address_bits,
dma_addr_t *dma_handle)
Expand Down Expand Up @@ -199,6 +222,8 @@ static struct dma_map_ops xen_swiotlb_dma_ops = {
.unmap_page = xen_swiotlb_unmap_page,
.dma_supported = xen_swiotlb_dma_supported,
.set_dma_mask = xen_swiotlb_set_dma_mask,
.mmap = xen_swiotlb_dma_mmap,
.get_sgtable = xen_swiotlb_get_sgtable,
};

int __init xen_mm_init(void)
Expand Down
4 changes: 3 additions & 1 deletion arch/arm64/boot/dts/renesas/r8a7795.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -1689,7 +1689,9 @@
<0 0xec5a0000 0 0x100>, /* ADG */
<0 0xec540000 0 0x1000>, /* SSIU */
<0 0xec541000 0 0x280>, /* SSI */
<0 0xec740000 0 0x200>; /* Audio DMAC peri peri*/
<0 0xec740000 0 0x200>, /* Audio DMAC peri peri*/
<0 0xec000000 0 0x1000>,
<0 0xec008000 0 0x1000>;
reg-names = "scu", "adg", "ssiu", "ssi", "audmapp";

clocks = <&cpg CPG_MOD 1005>,
Expand Down
4 changes: 3 additions & 1 deletion arch/arm64/boot/dts/renesas/r8a7796.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -2272,7 +2272,9 @@
<0 0xec5a0000 0 0x100>, /* ADG */
<0 0xec540000 0 0x1000>, /* SSIU */
<0 0xec541000 0 0x280>, /* SSI */
<0 0xec740000 0 0x200>; /* Audio DMAC peri peri*/
<0 0xec740000 0 0x200>, /* Audio DMAC peri peri*/
<0 0xec000000 0 0x1000>,
<0 0xec008000 0 0x1000>;
reg-names = "scu", "adg", "ssiu", "ssi", "audmapp";

clocks = <&cpg CPG_MOD 1005>,
Expand Down
4 changes: 3 additions & 1 deletion arch/arm64/boot/dts/renesas/r8a77965.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -2194,7 +2194,9 @@
<0 0xec5a0000 0 0x100>, /* ADG */
<0 0xec540000 0 0x1000>, /* SSIU */
<0 0xec541000 0 0x280>, /* SSI */
<0 0xec740000 0 0x200>; /* Audio DMAC peri peri*/
<0 0xec740000 0 0x200>, /* Audio DMAC peri peri*/
<0 0xec000000 0 0x1000>,
<0 0xec008000 0 0x1000>;
reg-names = "scu", "adg", "ssiu", "ssi", "audmapp";

clocks = <&cpg CPG_MOD 1005>,
Expand Down
2 changes: 1 addition & 1 deletion drivers/clk/renesas/r8a7795-cpg-mssr.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ static struct mssr_mod_clk r8a7795_mod_clks[] __initdata = {
DEF_MOD("cmt2", 301, R8A7795_CLK_R),
DEF_MOD("cmt1", 302, R8A7795_CLK_R),
DEF_MOD("cmt0", 303, R8A7795_CLK_R),
DEF_MOD("scif2", 310, R8A7795_CLK_S3D4),
/*DEF_MOD("scif2", 310, R8A7795_CLK_S3D4),*/
DEF_MOD("sdif3", 311, R8A7795_CLK_SD3),
DEF_MOD("sdif2", 312, R8A7795_CLK_SD2),
DEF_MOD("sdif1", 313, R8A7795_CLK_SD1),
Expand Down
2 changes: 1 addition & 1 deletion drivers/clk/renesas/r8a7796-cpg-mssr.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ static const struct mssr_mod_clk r8a7796_mod_clks[] __initconst = {
DEF_MOD("cmt2", 301, R8A7796_CLK_R),
DEF_MOD("cmt1", 302, R8A7796_CLK_R),
DEF_MOD("cmt0", 303, R8A7796_CLK_R),
DEF_MOD("scif2", 310, R8A7796_CLK_S3D4),
/* DEF_MOD("scif2", 310, R8A7796_CLK_S3D4),*/
DEF_MOD("sdif3", 311, R8A7796_CLK_SD3),
DEF_MOD("sdif2", 312, R8A7796_CLK_SD2),
DEF_MOD("sdif1", 313, R8A7796_CLK_SD1),
Expand Down
2 changes: 1 addition & 1 deletion drivers/clk/renesas/r8a77965-cpg-mssr.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ static const struct mssr_mod_clk r8a77965_mod_clks[] __initconst = {
DEF_MOD("cmt2", 301, R8A77965_CLK_R),
DEF_MOD("cmt1", 302, R8A77965_CLK_R),
DEF_MOD("cmt0", 303, R8A77965_CLK_R),
DEF_MOD("scif2", 310, R8A77965_CLK_S3D4),
/*DEF_MOD("scif2", 310, R8A77965_CLK_S3D4),*/
DEF_MOD("sdif3", 311, R8A77965_CLK_SD3),
DEF_MOD("sdif2", 312, R8A77965_CLK_SD2),
DEF_MOD("sdif1", 313, R8A77965_CLK_SD1),
Expand Down
2 changes: 2 additions & 0 deletions drivers/gpu/drm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,8 @@ source "drivers/gpu/drm/hisilicon/Kconfig"

source "drivers/gpu/drm/mediatek/Kconfig"

source "drivers/gpu/drm/xen/Kconfig"

# Keep legacy drivers last

menuconfig DRM_LEGACY
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,4 @@ obj-$(CONFIG_DRM_FSL_DCU) += fsl-dcu/
obj-$(CONFIG_DRM_ETNAVIV) += etnaviv/
obj-$(CONFIG_DRM_ARCPGU)+= arc/
obj-y += hisilicon/
obj-$(CONFIG_DRM_XEN) += xen/
40 changes: 40 additions & 0 deletions drivers/gpu/drm/rcar-du/rcar_du_crtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,7 @@ static irqreturn_t rcar_du_crtc_irq(int irq, void *arg)
/* -----------------------------------------------------------------------------
* Initialization
*/
#define RGX_3DGE_CORE_CLOCK_SPEED 600000000

int rcar_du_crtc_create(struct rcar_du_group *rgrp, unsigned int index)
{
Expand All @@ -823,6 +824,7 @@ int rcar_du_crtc_create(struct rcar_du_group *rgrp, unsigned int index)
int irq;
int ret;
int offset_index;
static int setup_gfx_clk = false;

if (rcdu->info->skip_ch && (rcdu->info->skip_ch == (0x01 << index)))
offset_index = index + 1; /* offset for r8a77965 */
Expand Down Expand Up @@ -865,6 +867,44 @@ int rcar_du_crtc_create(struct rcar_du_group *rgrp, unsigned int index)
return -EPROBE_DEFER;
}

if (!setup_gfx_clk) {
unsigned long new_rate, cur_rate;

strcpy(clk_name, "3dge");
clk = devm_clk_get(rcdu->dev, clk_name);
if (IS_ERR(clk)) {
dev_err(rcdu->dev, "no clk for GFX\n");
setup_gfx_clk = true;
goto gfx_skip;
}

new_rate = clk_round_rate(clk, RGX_3DGE_CORE_CLOCK_SPEED + 1000000);
if (new_rate <= 0) {
dev_err(rcdu->dev, "clk_round_rate for GFX clk failed. res = %ld\n", new_rate);
return -1;
}

cur_rate = clk_get_rate(clk);
if (cur_rate != new_rate) {
ret = clk_set_rate(clk, new_rate);
if (ret < 0) {
dev_err(rcdu->dev, "clk_set_rate for GFX clk failed. res = %d\n", ret);
return ret;
}
}

ret = clk_prepare_enable(clk);
if (ret < 0) {
dev_err(rcdu->dev, "clk_prepare_enable for GFX clk failed. res = %d\n", ret);
return ret;
}

dev_err(rcdu->dev, "GFX clk enabled\n");

setup_gfx_clk = true;
}

gfx_skip:
init_waitqueue_head(&rcrtc->flip_wait);
init_waitqueue_head(&rcrtc->vblank_wait);
spin_lock_init(&rcrtc->vblank_lock);
Expand Down
2 changes: 2 additions & 0 deletions drivers/gpu/drm/rcar-du/rcar_du_vsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@ rcar_du_vsp_plane_atomic_duplicate_state(struct drm_plane *plane)
if (copy == NULL)
return NULL;

memset(state->sg_tables, 0, sizeof(state->sg_tables));

__drm_atomic_helper_plane_duplicate_state(plane, &copy->state);

return &copy->state;
Expand Down
69 changes: 69 additions & 0 deletions drivers/gpu/drm/xen/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
config DRM_XEN
bool "DRM Support for Xen guest OS (EXPERIMENTAL)"
depends on XEN
help
Choose this option if you want to enable DRM support
for Xen.

choice
prompt "DRM driver sub-type selection"
depends on DRM_XEN

config DRM_XEN_FRONTEND
tristate "Front-end paravirtualized driver for Xen guest OS"
depends on DRM_XEN
depends on DRM
select DRM_KMS_HELPER
select VIDEOMODE_HELPERS
select XEN_XENBUS_FRONTEND
help
Choose this option if you want to enable a paravirtualized
front-end DRM driver for Xen guest OSes.

config DRM_XEN_FRONTEND_CMA
bool "Use DRM CMA to allocate dumb buffers"
depends on DRM_XEN_FRONTEND=y
select DRM_KMS_CMA_HELPER
select DRM_GEM_CMA_HELPER
help
Use DRM CMA to allocate dumb buffers.
This is only available for built-in driver, because
there is a dependency on DMA ops which are only available
for built-in code.
Note: in this mode driver cannot use buffers allocated
by backend.

config DRM_XEN_ZCOPY
tristate "Zero copy driver for Xen"
depends on DRM_XEN
depends on DRM
select DRM_KMS_HELPER
help
Choose this option if you want to enable a zero copy
DRM driver for Xen. This is implemented via mapping
of foreign dumb buffer pages into current domain and
exporting new dumb via PRIME interface. This allows
domains to use buffers of unpriveledged ones without
additional memory copying.

config DRM_XEN_ZCOPY_WA_SWIOTLB
bool "Workaround SWIOTLB"
depends on DRM_XEN_ZCOPY
depends on SWIOTLB
help
While exporting scatter-gather table use individual
pages rather combining contiguous chunks. This may
help systems which suffer from SWIOTLB buffer
overflows.

config DRM_XEN_ZCOPY_CMA
bool "Use CMA to allocate buffers"
depends on DRM_XEN_ZCOPY=y
help
Use CMA to allocate buffers.
This is only available for built-in driver, because
there is a dependency on DMA ops which are only available
for built-in code.

endchoice

19 changes: 19 additions & 0 deletions drivers/gpu/drm/xen/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#
# Makefile for the drm device driver. This driver provides support for the
# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.

drm_xen_front-objs := xen_drm_front.o xen_drm_front_drv.o xen_drm_front_kms.o \
xen_drm_front_crtc.o xen_drm_front_shbuf.o xen_drm_balloon.o \
xen_drm_front_evtchnl.o xen_drm_front_cfg.o

ifeq ($(CONFIG_DRM_XEN_FRONTEND_CMA),y)
drm_xen_front-objs += xen_drm_front_gem_cma.o
else
drm_xen_front-objs += xen_drm_front_gem.o
endif

obj-$(CONFIG_DRM_XEN_FRONTEND) += drm_xen_front.o

drm_xen_zcopy-objs := xen_drm_zcopy_drv.o xen_drm_balloon.o

obj-$(CONFIG_DRM_XEN_ZCOPY) += drm_xen_zcopy.o
Loading