--- /dev/null
+From e0936c3471a8411a5df327641fa3ffe12a2fb07b Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Wed, 9 Aug 2017 02:16:20 +0000
+Subject: ASoC: rsnd: avoid duplicate free_irq()
+
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+
+commit e0936c3471a8411a5df327641fa3ffe12a2fb07b upstream.
+
+commit 1f8754d4daea5f ("ASoC: rsnd: don't call free_irq() on
+Parent SSI") fixed Parent SSI duplicate free_irq().
+But on Renesas Sound, not only Parent SSI but also Multi SSI
+have same issue.
+This patch avoid duplicate free_irq() if it was not pure SSI.
+
+Fixes: 1f8754d4daea5f ("ASoC: rsnd: don't call free_irq() on Parent SSI")
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: thongsyho <thong.ho.px@rvc.renesas.com>
+Signed-off-by: Nhan Nguyen <nhan.nguyen.yb@renesas.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/soc/sh/rcar/ssi.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/sound/soc/sh/rcar/ssi.c
++++ b/sound/soc/sh/rcar/ssi.c
+@@ -699,12 +699,12 @@ static int rsnd_ssi_dma_remove(struct rs
+ struct rsnd_priv *priv)
+ {
+ struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
+- struct rsnd_mod *ssi_parent_mod = rsnd_io_to_mod_ssip(io);
++ struct rsnd_mod *pure_ssi_mod = rsnd_io_to_mod_ssi(io);
+ struct device *dev = rsnd_priv_to_dev(priv);
+ int irq = ssi->irq;
+
+- /* Do nothing for SSI parent mod */
+- if (ssi_parent_mod == mod)
++ /* Do nothing if non SSI (= SSI parent, multi SSI) mod */
++ if (pure_ssi_mod != mod)
+ return 0;
+
+ /* PIO will request IRQ again */
--- /dev/null
+From 1f8754d4daea5f257370a52a30fcb22798c54516 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Tue, 16 May 2017 01:48:24 +0000
+Subject: ASoC: rsnd: don't call free_irq() on Parent SSI
+
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+
+commit 1f8754d4daea5f257370a52a30fcb22798c54516 upstream.
+
+If SSI uses shared pin, some SSI will be used as parent SSI.
+Then, normal SSI's remove and Parent SSI's remove
+(these are same SSI) will be called when unbind or remove timing.
+In this case, free_irq() will be called twice.
+This patch solve this issue.
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
+Reported-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: thongsyho <thong.ho.px@rvc.renesas.com>
+Signed-off-by: Nhan Nguyen <nhan.nguyen.yb@renesas.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/soc/sh/rcar/ssi.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+--- a/sound/soc/sh/rcar/ssi.c
++++ b/sound/soc/sh/rcar/ssi.c
+@@ -699,9 +699,14 @@ static int rsnd_ssi_dma_remove(struct rs
+ struct rsnd_priv *priv)
+ {
+ struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
++ struct rsnd_mod *ssi_parent_mod = rsnd_io_to_mod_ssip(io);
+ struct device *dev = rsnd_priv_to_dev(priv);
+ int irq = ssi->irq;
+
++ /* Do nothing for SSI parent mod */
++ if (ssi_parent_mod == mod)
++ return 0;
++
+ /* PIO will request IRQ again */
+ devm_free_irq(dev, irq, mod);
+
--- /dev/null
+From 7ac45d1635a4cd2e99a4b11903d4a2815ca1b27b Mon Sep 17 00:00:00 2001
+From: Julian Scheel <julian@jusst.de>
+Date: Wed, 24 May 2017 12:28:23 +0200
+Subject: ASoC: simple-card: Fix misleading error message
+
+From: Julian Scheel <julian@jusst.de>
+
+commit 7ac45d1635a4cd2e99a4b11903d4a2815ca1b27b upstream.
+
+In case cpu could not be found the error message would always refer to
+/codec/ not being found in DT. Fix this by catching the cpu node not found
+case explicitly.
+
+Signed-off-by: Julian Scheel <julian@jusst.de>
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: thongsyho <thong.ho.px@rvc.renesas.com>
+Signed-off-by: Nhan Nguyen <nhan.nguyen.yb@renesas.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/soc/generic/simple-card.c | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+--- a/sound/soc/generic/simple-card.c
++++ b/sound/soc/generic/simple-card.c
+@@ -232,13 +232,19 @@ static int asoc_simple_card_dai_link_of(
+ snprintf(prop, sizeof(prop), "%scpu", prefix);
+ cpu = of_get_child_by_name(node, prop);
+
++ if (!cpu) {
++ ret = -EINVAL;
++ dev_err(dev, "%s: Can't find %s DT node\n", __func__, prop);
++ goto dai_link_of_err;
++ }
++
+ snprintf(prop, sizeof(prop), "%splat", prefix);
+ plat = of_get_child_by_name(node, prop);
+
+ snprintf(prop, sizeof(prop), "%scodec", prefix);
+ codec = of_get_child_by_name(node, prop);
+
+- if (!cpu || !codec) {
++ if (!codec) {
+ ret = -EINVAL;
+ dev_err(dev, "%s: Can't find %s DT node\n", __func__, prop);
+ goto dai_link_of_err;
--- /dev/null
+From 5c6ac1d4f8fbdbed65dbeb8cf149d736409d16a1 Mon Sep 17 00:00:00 2001
+From: Robert Baronescu <robert.baronescu@nxp.com>
+Date: Tue, 10 Oct 2017 13:21:59 +0300
+Subject: crypto: tcrypt - fix S/G table for test_aead_speed()
+
+From: Robert Baronescu <robert.baronescu@nxp.com>
+
+commit 5c6ac1d4f8fbdbed65dbeb8cf149d736409d16a1 upstream.
+
+In case buffer length is a multiple of PAGE_SIZE,
+the S/G table is incorrectly generated.
+Fix this by handling buflen = k * PAGE_SIZE separately.
+
+Signed-off-by: Robert Baronescu <robert.baronescu@nxp.com>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ crypto/tcrypt.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+--- a/crypto/tcrypt.c
++++ b/crypto/tcrypt.c
+@@ -223,11 +223,13 @@ static void sg_init_aead(struct scatterl
+ }
+
+ sg_init_table(sg, np + 1);
+- np--;
++ if (rem)
++ np--;
+ for (k = 0; k < np; k++)
+ sg_set_buf(&sg[k + 1], xbuf[k], PAGE_SIZE);
+
+- sg_set_buf(&sg[k + 1], xbuf[k], rem);
++ if (rem)
++ sg_set_buf(&sg[k + 1], xbuf[k], rem);
+ }
+
+ static void test_aead_speed(const char *algo, int enc, unsigned int secs,
--- /dev/null
+From 641307df71fe77d7b38a477067495ede05d47295 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Sat, 29 Jul 2017 02:31:33 +0300
+Subject: drm: rcar-du: Fix race condition when disabling planes at CRTC stop
+
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+
+commit 641307df71fe77d7b38a477067495ede05d47295 upstream.
+
+When stopping the CRTC the driver must disable all planes and wait for
+the change to take effect at the next vblank. Merely calling
+drm_crtc_wait_one_vblank() is not enough, as the function doesn't
+include any mechanism to handle the race with vblank interrupts.
+
+Replace the drm_crtc_wait_one_vblank() call with a manual mechanism that
+handles the vblank interrupt race.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
+Signed-off-by: thongsyho <thong.ho.px@rvc.renesas.com>
+Signed-off-by: Nhan Nguyen <nhan.nguyen.yb@renesas.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 53 +++++++++++++++++++++++++++++----
+ drivers/gpu/drm/rcar-du/rcar_du_crtc.h | 8 ++++
+ 2 files changed, 55 insertions(+), 6 deletions(-)
+
+--- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
++++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
+@@ -392,6 +392,31 @@ static void rcar_du_crtc_start(struct rc
+ rcrtc->started = true;
+ }
+
++static void rcar_du_crtc_disable_planes(struct rcar_du_crtc *rcrtc)
++{
++ struct rcar_du_device *rcdu = rcrtc->group->dev;
++ struct drm_crtc *crtc = &rcrtc->crtc;
++ u32 status;
++ /* Make sure vblank interrupts are enabled. */
++ drm_crtc_vblank_get(crtc);
++ /*
++ * Disable planes and calculate how many vertical blanking interrupts we
++ * have to wait for. If a vertical blanking interrupt has been triggered
++ * but not processed yet, we don't know whether it occurred before or
++ * after the planes got disabled. We thus have to wait for two vblank
++ * interrupts in that case.
++ */
++ spin_lock_irq(&rcrtc->vblank_lock);
++ rcar_du_group_write(rcrtc->group, rcrtc->index % 2 ? DS2PR : DS1PR, 0);
++ status = rcar_du_crtc_read(rcrtc, DSSR);
++ rcrtc->vblank_count = status & DSSR_VBK ? 2 : 1;
++ spin_unlock_irq(&rcrtc->vblank_lock);
++ if (!wait_event_timeout(rcrtc->vblank_wait, rcrtc->vblank_count == 0,
++ msecs_to_jiffies(100)))
++ dev_warn(rcdu->dev, "vertical blanking timeout\n");
++ drm_crtc_vblank_put(crtc);
++}
++
+ static void rcar_du_crtc_stop(struct rcar_du_crtc *rcrtc)
+ {
+ struct drm_crtc *crtc = &rcrtc->crtc;
+@@ -400,17 +425,16 @@ static void rcar_du_crtc_stop(struct rca
+ return;
+
+ /* Disable all planes and wait for the change to take effect. This is
+- * required as the DSnPR registers are updated on vblank, and no vblank
+- * will occur once the CRTC is stopped. Disabling planes when starting
+- * the CRTC thus wouldn't be enough as it would start scanning out
+- * immediately from old frame buffers until the next vblank.
++ * required as the plane enable registers are updated on vblank, and no
++ * vblank will occur once the CRTC is stopped. Disabling planes when
++ * starting the CRTC thus wouldn't be enough as it would start scanning
++ * out immediately from old frame buffers until the next vblank.
+ *
+ * This increases the CRTC stop delay, especially when multiple CRTCs
+ * are stopped in one operation as we now wait for one vblank per CRTC.
+ * Whether this can be improved needs to be researched.
+ */
+- rcar_du_group_write(rcrtc->group, rcrtc->index % 2 ? DS2PR : DS1PR, 0);
+- drm_crtc_wait_one_vblank(crtc);
++ rcar_du_crtc_disable_planes(rcrtc);
+
+ /* Disable vertical blanking interrupt reporting. We first need to wait
+ * for page flip completion before stopping the CRTC as userspace
+@@ -548,10 +572,25 @@ static irqreturn_t rcar_du_crtc_irq(int
+ irqreturn_t ret = IRQ_NONE;
+ u32 status;
+
++ spin_lock(&rcrtc->vblank_lock);
++
+ status = rcar_du_crtc_read(rcrtc, DSSR);
+ rcar_du_crtc_write(rcrtc, DSRCR, status & DSRCR_MASK);
+
+ if (status & DSSR_VBK) {
++ /*
++ * Wake up the vblank wait if the counter reaches 0. This must
++ * be protected by the vblank_lock to avoid races in
++ * rcar_du_crtc_disable_planes().
++ */
++ if (rcrtc->vblank_count) {
++ if (--rcrtc->vblank_count == 0)
++ wake_up(&rcrtc->vblank_wait);
++ }
++ }
++ spin_unlock(&rcrtc->vblank_lock);
++
++ if (status & DSSR_VBK) {
+ drm_crtc_handle_vblank(&rcrtc->crtc);
+ rcar_du_crtc_finish_page_flip(rcrtc);
+ ret = IRQ_HANDLED;
+@@ -606,6 +645,8 @@ int rcar_du_crtc_create(struct rcar_du_g
+ }
+
+ init_waitqueue_head(&rcrtc->flip_wait);
++ init_waitqueue_head(&rcrtc->vblank_wait);
++ spin_lock_init(&rcrtc->vblank_lock);
+
+ rcrtc->group = rgrp;
+ rcrtc->mmio_offset = mmio_offsets[index];
+--- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.h
++++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.h
+@@ -15,6 +15,7 @@
+ #define __RCAR_DU_CRTC_H__
+
+ #include <linux/mutex.h>
++#include <linux/spinlock.h>
+ #include <linux/wait.h>
+
+ #include <drm/drmP.h>
+@@ -33,6 +34,9 @@ struct rcar_du_vsp;
+ * @started: whether the CRTC has been started and is running
+ * @event: event to post when the pending page flip completes
+ * @flip_wait: wait queue used to signal page flip completion
++ * @vblank_lock: protects vblank_wait and vblank_count
++ * @vblank_wait: wait queue used to signal vertical blanking
++ * @vblank_count: number of vertical blanking interrupts to wait for
+ * @outputs: bitmask of the outputs (enum rcar_du_output) driven by this CRTC
+ * @group: CRTC group this CRTC belongs to
+ */
+@@ -48,6 +52,10 @@ struct rcar_du_crtc {
+ struct drm_pending_vblank_event *event;
+ wait_queue_head_t flip_wait;
+
++ spinlock_t vblank_lock;
++ wait_queue_head_t vblank_wait;
++ unsigned int vblank_count;
++
+ unsigned int outputs;
+
+ struct rcar_du_group *group;
--- /dev/null
+From cbbb90b0c084d7dfb2ed8e3fecf8df200fbdd2a0 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Mon, 10 Jul 2017 23:46:39 +0300
+Subject: drm: rcar-du: Use the VBK interrupt for vblank events
+
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+
+commit cbbb90b0c084d7dfb2ed8e3fecf8df200fbdd2a0 upstream.
+
+When implementing support for interlaced modes, the driver switched from
+reporting vblank events on the vertical blanking (VBK) interrupt to the
+frame end interrupt (FRM). This incorrectly divided the reported refresh
+rate by two. Fix it by moving back to the VBK interrupt.
+
+Fixes: 906eff7fcada ("drm: rcar-du: Implement support for interlaced modes")
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
+Signed-off-by: thongsyho <thong.ho.px@rvc.renesas.com>
+Signed-off-by: Nhan Nguyen <nhan.nguyen.yb@renesas.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
++++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
+@@ -551,7 +551,7 @@ static irqreturn_t rcar_du_crtc_irq(int
+ status = rcar_du_crtc_read(rcrtc, DSSR);
+ rcar_du_crtc_write(rcrtc, DSRCR, status & DSRCR_MASK);
+
+- if (status & DSSR_FRM) {
++ if (status & DSSR_VBK) {
+ drm_crtc_handle_vblank(&rcrtc->crtc);
+ rcar_du_crtc_finish_page_flip(rcrtc);
+ ret = IRQ_HANDLED;
kvm-vmx-emulate-msr_ia32_arch_capabilities.patch
kvm-vmx-allow-direct-access-to-msr_ia32_spec_ctrl.patch
kvm-svm-allow-direct-access-to-msr_ia32_spec_ctrl.patch
+crypto-tcrypt-fix-s-g-table-for-test_aead_speed.patch
+asoc-simple-card-fix-misleading-error-message.patch
+asoc-rsnd-don-t-call-free_irq-on-parent-ssi.patch
+asoc-rsnd-avoid-duplicate-free_irq.patch
+drm-rcar-du-use-the-vbk-interrupt-for-vblank-events.patch
+drm-rcar-du-fix-race-condition-when-disabling-planes-at-crtc-stop.patch