--- /dev/null
+From 8c7f0a44b4b4ef16df8f44fbaee6d1f5d1593c83 Mon Sep 17 00:00:00 2001
+From: Sergei Lopatin <magist3r@gmail.com>
+Date: Wed, 26 Jun 2019 14:56:59 +0500
+Subject: drm/amd/powerplay: force the trim of the mclk dpm_levels if OD is enabled
+
+From: Sergei Lopatin <magist3r@gmail.com>
+
+commit 8c7f0a44b4b4ef16df8f44fbaee6d1f5d1593c83 upstream.
+
+Should prevent flicker if PP_OVERDRIVE_MASK is set.
+
+bug: https://bugs.freedesktop.org/show_bug.cgi?id=102646
+bug: https://bugs.freedesktop.org/show_bug.cgi?id=108941
+bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1088
+bug: https://gitlab.freedesktop.org/drm/amd/-/issues/628
+
+Signed-off-by: Sergei Lopatin <magist3r@gmail.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
++++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
+@@ -3804,9 +3804,12 @@ static int smu7_trim_single_dpm_states(s
+ {
+ uint32_t i;
+
++ /* force the trim if mclk_switching is disabled to prevent flicker */
++ bool force_trim = (low_limit == high_limit);
+ for (i = 0; i < dpm_table->count; i++) {
+ /*skip the trim if od is enabled*/
+- if (!hwmgr->od_enabled && (dpm_table->dpm_levels[i].value < low_limit
++ if ((!hwmgr->od_enabled || force_trim)
++ && (dpm_table->dpm_levels[i].value < low_limit
+ || dpm_table->dpm_levels[i].value > high_limit))
+ dpm_table->dpm_levels[i].enabled = false;
+ else
--- /dev/null
+From b2a7e9735ab2864330be9d00d7f38c961c28de5d Mon Sep 17 00:00:00 2001
+From: Prike Liang <Prike.Liang@amd.com>
+Date: Mon, 13 Apr 2020 21:41:14 +0800
+Subject: drm/amdgpu: fix the hw hang during perform system reboot and reset
+
+From: Prike Liang <Prike.Liang@amd.com>
+
+commit b2a7e9735ab2864330be9d00d7f38c961c28de5d upstream.
+
+The system reboot failed as some IP blocks enter power gate before perform
+hw resource destory. Meanwhile use unify interface to set device CGPG to ungate
+state can simplify the amdgpu poweroff or reset ungate guard.
+
+Fixes: 487eca11a321ef ("drm/amdgpu: fix gfx hang during suspend with video playback (v2)")
+Signed-off-by: Prike Liang <Prike.Liang@amd.com>
+Tested-by: Mengbing Wang <Mengbing.Wang@amd.com>
+Tested-by: Paul Menzel <pmenzel@molgen.mpg.de>
+Acked-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+@@ -2259,6 +2259,8 @@ static int amdgpu_device_ip_suspend_phas
+ {
+ int i, r;
+
++ amdgpu_device_set_pg_state(adev, AMD_PG_STATE_UNGATE);
++ amdgpu_device_set_cg_state(adev, AMD_CG_STATE_UNGATE);
+
+ for (i = adev->num_ip_blocks - 1; i >= 0; i--) {
+ if (!adev->ip_blocks[i].status.valid)
--- /dev/null
+From bcad588dea538a4fc173d16a90a005536ec8dbf2 Mon Sep 17 00:00:00 2001
+From: Ashutosh Dixit <ashutosh.dixit@intel.com>
+Date: Wed, 8 Apr 2020 16:42:01 -0700
+Subject: drm/i915/perf: Do not clear pollin for small user read buffers
+
+From: Ashutosh Dixit <ashutosh.dixit@intel.com>
+
+commit bcad588dea538a4fc173d16a90a005536ec8dbf2 upstream.
+
+It is wrong to block the user thread in the next poll when OA data is
+already available which could not fit in the user buffer provided in
+the previous read. In several cases the exact user buffer size is not
+known. Blocking user space in poll can lead to data loss when the
+buffer size used is smaller than the available data.
+
+This change fixes this issue and allows user space to read all OA data
+even when using a buffer size smaller than the available data using
+multiple non-blocking reads rather than staying blocked in poll till
+the next timer interrupt.
+
+v2: Fix ret value for blocking reads (Umesh)
+v3: Mistake during patch send (Ashutosh)
+v4: Remove -EAGAIN from comment (Umesh)
+v5: Improve condition for clearing pollin and return (Lionel)
+v6: Improve blocking read loop and other cleanups (Lionel)
+v7: Added Cc stable
+
+Testcase: igt/perf/polling-small-buf
+Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
+Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
+Cc: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+Link: https://patchwork.freedesktop.org/patch/msgid/20200403010120.3067-1-ashutosh.dixit@intel.com
+(cherry-picked from commit 6352219c39c04ed3f9a8d1cf93f87c21753a213e)
+Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/i915/i915_perf.c | 65 ++++++---------------------------------
+ 1 file changed, 11 insertions(+), 54 deletions(-)
+
+--- a/drivers/gpu/drm/i915/i915_perf.c
++++ b/drivers/gpu/drm/i915/i915_perf.c
+@@ -2907,49 +2907,6 @@ void i915_oa_init_reg_state(const struct
+ }
+
+ /**
+- * i915_perf_read_locked - &i915_perf_stream_ops->read with error normalisation
+- * @stream: An i915 perf stream
+- * @file: An i915 perf stream file
+- * @buf: destination buffer given by userspace
+- * @count: the number of bytes userspace wants to read
+- * @ppos: (inout) file seek position (unused)
+- *
+- * Besides wrapping &i915_perf_stream_ops->read this provides a common place to
+- * ensure that if we've successfully copied any data then reporting that takes
+- * precedence over any internal error status, so the data isn't lost.
+- *
+- * For example ret will be -ENOSPC whenever there is more buffered data than
+- * can be copied to userspace, but that's only interesting if we weren't able
+- * to copy some data because it implies the userspace buffer is too small to
+- * receive a single record (and we never split records).
+- *
+- * Another case with ret == -EFAULT is more of a grey area since it would seem
+- * like bad form for userspace to ask us to overrun its buffer, but the user
+- * knows best:
+- *
+- * http://yarchive.net/comp/linux/partial_reads_writes.html
+- *
+- * Returns: The number of bytes copied or a negative error code on failure.
+- */
+-static ssize_t i915_perf_read_locked(struct i915_perf_stream *stream,
+- struct file *file,
+- char __user *buf,
+- size_t count,
+- loff_t *ppos)
+-{
+- /* Note we keep the offset (aka bytes read) separate from any
+- * error status so that the final check for whether we return
+- * the bytes read with a higher precedence than any error (see
+- * comment below) doesn't need to be handled/duplicated in
+- * stream->ops->read() implementations.
+- */
+- size_t offset = 0;
+- int ret = stream->ops->read(stream, buf, count, &offset);
+-
+- return offset ?: (ret ?: -EAGAIN);
+-}
+-
+-/**
+ * i915_perf_read - handles read() FOP for i915 perf stream FDs
+ * @file: An i915 perf stream file
+ * @buf: destination buffer given by userspace
+@@ -2974,7 +2931,8 @@ static ssize_t i915_perf_read(struct fil
+ {
+ struct i915_perf_stream *stream = file->private_data;
+ struct i915_perf *perf = stream->perf;
+- ssize_t ret;
++ size_t offset = 0;
++ int ret;
+
+ /* To ensure it's handled consistently we simply treat all reads of a
+ * disabled stream as an error. In particular it might otherwise lead
+@@ -2997,13 +2955,12 @@ static ssize_t i915_perf_read(struct fil
+ return ret;
+
+ mutex_lock(&perf->lock);
+- ret = i915_perf_read_locked(stream, file,
+- buf, count, ppos);
++ ret = stream->ops->read(stream, buf, count, &offset);
+ mutex_unlock(&perf->lock);
+- } while (ret == -EAGAIN);
++ } while (!offset && !ret);
+ } else {
+ mutex_lock(&perf->lock);
+- ret = i915_perf_read_locked(stream, file, buf, count, ppos);
++ ret = stream->ops->read(stream, buf, count, &offset);
+ mutex_unlock(&perf->lock);
+ }
+
+@@ -3014,15 +2971,15 @@ static ssize_t i915_perf_read(struct fil
+ * and read() returning -EAGAIN. Clearing the oa.pollin state here
+ * effectively ensures we back off until the next hrtimer callback
+ * before reporting another EPOLLIN event.
++ * The exception to this is if ops->read() returned -ENOSPC which means
++ * that more OA data is available than could fit in the user provided
++ * buffer. In this case we want the next poll() call to not block.
+ */
+- if (ret >= 0 || ret == -EAGAIN) {
+- /* Maybe make ->pollin per-stream state if we support multiple
+- * concurrent streams in the future.
+- */
++ if (ret != -ENOSPC)
+ stream->pollin = false;
+- }
+
+- return ret;
++ /* Possible values for ret are 0, -EFAULT, -ENOSPC, -EIO, ... */
++ return offset ?: (ret ?: -EAGAIN);
+ }
+
+ static enum hrtimer_restart oa_poll_check_timer_cb(struct hrtimer *hrtimer)
--- /dev/null
+From d79294d0de12ddd1420110813626d691f440b86f Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede@redhat.com>
+Date: Tue, 7 Apr 2020 20:11:16 +0200
+Subject: i2c: designware: platdrv: Remove DPM_FLAG_SMART_SUSPEND flag on BYT and CHT
+
+From: Hans de Goede <hdegoede@redhat.com>
+
+commit d79294d0de12ddd1420110813626d691f440b86f upstream.
+
+We already set DPM_FLAG_SMART_PREPARE, so we completely skip all
+callbacks (other then prepare) where possible, quoting from
+dw_i2c_plat_prepare():
+
+ /*
+ * If the ACPI companion device object is present for this device, it
+ * may be accessed during suspend and resume of other devices via I2C
+ * operation regions, so tell the PM core and middle layers to avoid
+ * skipping system suspend/resume callbacks for it in that case.
+ */
+ return !has_acpi_companion(dev);
+
+Also setting the DPM_FLAG_SMART_SUSPEND will cause acpi_subsys_suspend()
+to leave the controller runtime-suspended even if dw_i2c_plat_prepare()
+returned 0.
+
+Leaving the controller runtime-suspended normally, when the I2C controller
+is suspended during the suspend_late phase, is not an issue because
+the pm_runtime_get_sync() done by i2c_dw_xfer() will (runtime-)resume it.
+
+But for dw I2C controllers on Bay- and Cherry-Trail devices acpi_lpss.c
+leaves the controller alive until the suspend_noirq phase, because it may
+be used by the _PS3 ACPI methods of PCI devices and PCI devices are left
+powered on until the suspend_noirq phase.
+
+Between the suspend_late and resume_early phases runtime-pm is disabled.
+So for any ACPI I2C OPRegion accesses done after the suspend_late phase,
+the pm_runtime_get_sync() done by i2c_dw_xfer() is a no-op and the
+controller is left runtime-suspended.
+
+i2c_dw_xfer() has a check to catch this condition (rather then waiting
+for the I2C transfer to timeout because the controller is suspended).
+acpi_subsys_suspend() leaving the controller runtime-suspended in
+combination with an ACPI I2C OPRegion access done after the suspend_late
+phase triggers this check, leading to the following error being logged
+on a Bay Trail based Lenovo Thinkpad 8 tablet:
+
+[ 93.275882] i2c_designware 80860F41:00: Transfer while suspended
+[ 93.275993] WARNING: CPU: 0 PID: 412 at drivers/i2c/busses/i2c-designware-master.c:429 i2c_dw_xfer+0x239/0x280
+...
+[ 93.276252] Workqueue: kacpi_notify acpi_os_execute_deferred
+[ 93.276267] RIP: 0010:i2c_dw_xfer+0x239/0x280
+...
+[ 93.276340] Call Trace:
+[ 93.276366] __i2c_transfer+0x121/0x520
+[ 93.276379] i2c_transfer+0x4c/0x100
+[ 93.276392] i2c_acpi_space_handler+0x219/0x510
+[ 93.276408] ? up+0x40/0x60
+[ 93.276419] ? i2c_acpi_notify+0x130/0x130
+[ 93.276433] acpi_ev_address_space_dispatch+0x1e1/0x252
+...
+
+So since on BYT and CHT platforms we want ACPI I2c OPRegion accesses
+to work until the suspend_noirq phase, we need the controller to be
+runtime-resumed during the suspend phase if it is runtime-suspended
+suspended at that time. This means that we must not set the
+DPM_FLAG_SMART_SUSPEND on these platforms.
+
+On BYT and CHT we already have a special ACCESS_NO_IRQ_SUSPEND flag
+to make sure the controller stays functional until the suspend_noirq
+phase. This commit makes the driver not set the DPM_FLAG_SMART_SUSPEND
+flag when that flag is set.
+
+Cc: stable@vger.kernel.org
+Fixes: b30f2f65568f ("i2c: designware: Set IRQF_NO_SUSPEND flag for all BYT and CHT controllers")
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
+Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/i2c/busses/i2c-designware-platdrv.c | 14 ++++++++++----
+ 1 file changed, 10 insertions(+), 4 deletions(-)
+
+--- a/drivers/i2c/busses/i2c-designware-platdrv.c
++++ b/drivers/i2c/busses/i2c-designware-platdrv.c
+@@ -370,10 +370,16 @@ static int dw_i2c_plat_probe(struct plat
+ adap->dev.of_node = pdev->dev.of_node;
+ adap->nr = -1;
+
+- dev_pm_set_driver_flags(&pdev->dev,
+- DPM_FLAG_SMART_PREPARE |
+- DPM_FLAG_SMART_SUSPEND |
+- DPM_FLAG_LEAVE_SUSPENDED);
++ if (dev->flags & ACCESS_NO_IRQ_SUSPEND) {
++ dev_pm_set_driver_flags(&pdev->dev,
++ DPM_FLAG_SMART_PREPARE |
++ DPM_FLAG_LEAVE_SUSPENDED);
++ } else {
++ dev_pm_set_driver_flags(&pdev->dev,
++ DPM_FLAG_SMART_PREPARE |
++ DPM_FLAG_SMART_SUSPEND |
++ DPM_FLAG_LEAVE_SUSPENDED);
++ }
+
+ /* The code below assumes runtime PM to be disabled. */
+ WARN_ON(pm_runtime_enabled(&pdev->dev));
net-mlx5e-encapsulate-updating-netdev-queues-into-a-.patch
net-mlx5e-rename-hw_modify-to-preactivate.patch
net-mlx5e-use-preactivate-hook-to-set-the-indirectio.patch
+drm-amd-powerplay-force-the-trim-of-the-mclk-dpm_levels-if-od-is-enabled.patch
+drm-amdgpu-fix-the-hw-hang-during-perform-system-reboot-and-reset.patch
+i2c-designware-platdrv-remove-dpm_flag_smart_suspend-flag-on-byt-and-cht.patch
+drm-i915-perf-do-not-clear-pollin-for-small-user-read-buffers.patch