]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.14-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 18 Sep 2021 12:38:00 +0000 (14:38 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 18 Sep 2021 12:38:00 +0000 (14:38 +0200)
added patches:
arm64-sve-use-correct-size-when-reinitialising-sve-state.patch
bnx2x-fix-enabling-network-interfaces-without-vfs.patch
drm-amd-amdgpu-increase-hwip_max_instance-to-10.patch
drm-amd-display-dsc-mst-2-4k-displays-go-dark-with-2-lane-hbr3.patch
drm-amd-display-fix-white-screen-page-fault-for-gpuvm.patch
drm-amd-display-get-backlight-from-pwm-if-dmcu-is-not-initialized.patch
drm-amd-pm-fix-runpm-hang-when-amdgpu-loaded-prior-to-sound-driver.patch
drm-amd-pm-fix-the-issue-of-uploading-powerplay-table.patch
drm-amdgpu-add-amdgpu_amdkfd_resume_iommu.patch
drm-amdgpu-fix-use-after-free-during-bo-move.patch
drm-amdgpu-move-iommu_resume-before-ip-init-resume.patch
drm-amdgpu-use-is_err-for-debugfs-apis.patch
drm-amdkfd-separate-kfd_iommu_resume-from-kfd_resume.patch
drm-radeon-pass-drm-dev-radeon_agp_head_init-directly.patch
io_uring-ensure-symmetry-in-handling-iter-types-in-loop_rw_iter.patch
pci-add-amd-gpu-multi-function-power-dependencies.patch
pm-base-power-don-t-try-to-use-non-existing-rtc-for-storing-data.patch
swiotlb-xen-avoid-double-free.patch
swiotlb-xen-fix-late-init-retry.patch
xen-fix-usage-of-pmd_populate-in-mremap-for-pv-guests.patch
xen-reset-legacy-rtc-flag-for-pv-domu.patch

22 files changed:
queue-5.14/arm64-sve-use-correct-size-when-reinitialising-sve-state.patch [new file with mode: 0644]
queue-5.14/bnx2x-fix-enabling-network-interfaces-without-vfs.patch [new file with mode: 0644]
queue-5.14/drm-amd-amdgpu-increase-hwip_max_instance-to-10.patch [new file with mode: 0644]
queue-5.14/drm-amd-display-dsc-mst-2-4k-displays-go-dark-with-2-lane-hbr3.patch [new file with mode: 0644]
queue-5.14/drm-amd-display-fix-white-screen-page-fault-for-gpuvm.patch [new file with mode: 0644]
queue-5.14/drm-amd-display-get-backlight-from-pwm-if-dmcu-is-not-initialized.patch [new file with mode: 0644]
queue-5.14/drm-amd-pm-fix-runpm-hang-when-amdgpu-loaded-prior-to-sound-driver.patch [new file with mode: 0644]
queue-5.14/drm-amd-pm-fix-the-issue-of-uploading-powerplay-table.patch [new file with mode: 0644]
queue-5.14/drm-amdgpu-add-amdgpu_amdkfd_resume_iommu.patch [new file with mode: 0644]
queue-5.14/drm-amdgpu-fix-use-after-free-during-bo-move.patch [new file with mode: 0644]
queue-5.14/drm-amdgpu-move-iommu_resume-before-ip-init-resume.patch [new file with mode: 0644]
queue-5.14/drm-amdgpu-use-is_err-for-debugfs-apis.patch [new file with mode: 0644]
queue-5.14/drm-amdkfd-separate-kfd_iommu_resume-from-kfd_resume.patch [new file with mode: 0644]
queue-5.14/drm-radeon-pass-drm-dev-radeon_agp_head_init-directly.patch [new file with mode: 0644]
queue-5.14/io_uring-ensure-symmetry-in-handling-iter-types-in-loop_rw_iter.patch [new file with mode: 0644]
queue-5.14/pci-add-amd-gpu-multi-function-power-dependencies.patch [new file with mode: 0644]
queue-5.14/pm-base-power-don-t-try-to-use-non-existing-rtc-for-storing-data.patch [new file with mode: 0644]
queue-5.14/series [new file with mode: 0644]
queue-5.14/swiotlb-xen-avoid-double-free.patch [new file with mode: 0644]
queue-5.14/swiotlb-xen-fix-late-init-retry.patch [new file with mode: 0644]
queue-5.14/xen-fix-usage-of-pmd_populate-in-mremap-for-pv-guests.patch [new file with mode: 0644]
queue-5.14/xen-reset-legacy-rtc-flag-for-pv-domu.patch [new file with mode: 0644]

diff --git a/queue-5.14/arm64-sve-use-correct-size-when-reinitialising-sve-state.patch b/queue-5.14/arm64-sve-use-correct-size-when-reinitialising-sve-state.patch
new file mode 100644 (file)
index 0000000..021c220
--- /dev/null
@@ -0,0 +1,45 @@
+From e35ac9d0b56e9efefaeeb84b635ea26c2839ea86 Mon Sep 17 00:00:00 2001
+From: Mark Brown <broonie@kernel.org>
+Date: Thu, 9 Sep 2021 17:53:56 +0100
+Subject: arm64/sve: Use correct size when reinitialising SVE state
+
+From: Mark Brown <broonie@kernel.org>
+
+commit e35ac9d0b56e9efefaeeb84b635ea26c2839ea86 upstream.
+
+When we need a buffer for SVE register state we call sve_alloc() to make
+sure that one is there. In order to avoid repeated allocations and frees
+we keep the buffer around unless we change vector length and just memset()
+it to ensure a clean register state. The function that deals with this
+takes the task to operate on as an argument, however in the case where we
+do a memset() we initialise using the SVE state size for the current task
+rather than the task passed as an argument.
+
+This is only an issue in the case where we are setting the register state
+for a task via ptrace and the task being configured has a different vector
+length to the task tracing it. In the case where the buffer is larger in
+the traced process we will leak old state from the traced process to
+itself, in the case where the buffer is smaller in the traced process we
+will overflow the buffer and corrupt memory.
+
+Fixes: bc0ee4760364 ("arm64/sve: Core task context handling")
+Cc: <stable@vger.kernel.org> # 4.15.x
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Link: https://lore.kernel.org/r/20210909165356.10675-1-broonie@kernel.org
+Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/arm64/kernel/fpsimd.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/arm64/kernel/fpsimd.c
++++ b/arch/arm64/kernel/fpsimd.c
+@@ -511,7 +511,7 @@ size_t sve_state_size(struct task_struct
+ void sve_alloc(struct task_struct *task)
+ {
+       if (task->thread.sve_state) {
+-              memset(task->thread.sve_state, 0, sve_state_size(current));
++              memset(task->thread.sve_state, 0, sve_state_size(task));
+               return;
+       }
diff --git a/queue-5.14/bnx2x-fix-enabling-network-interfaces-without-vfs.patch b/queue-5.14/bnx2x-fix-enabling-network-interfaces-without-vfs.patch
new file mode 100644 (file)
index 0000000..dd8c7c0
--- /dev/null
@@ -0,0 +1,36 @@
+From 52ce14c134a003fee03d8fc57442c05a55b53715 Mon Sep 17 00:00:00 2001
+From: Adrian Bunk <bunk@kernel.org>
+Date: Sun, 12 Sep 2021 22:05:23 +0300
+Subject: bnx2x: Fix enabling network interfaces without VFs
+
+From: Adrian Bunk <bunk@kernel.org>
+
+commit 52ce14c134a003fee03d8fc57442c05a55b53715 upstream.
+
+This function is called to enable SR-IOV when available,
+not enabling interfaces without VFs was a regression.
+
+Fixes: 65161c35554f ("bnx2x: Fix missing error code in bnx2x_iov_init_one()")
+Signed-off-by: Adrian Bunk <bunk@kernel.org>
+Reported-by: YunQiang Su <wzssyqa@gmail.com>
+Tested-by: YunQiang Su <wzssyqa@gmail.com>
+Cc: stable@vger.kernel.org
+Acked-by: Shai Malin <smalin@marvell.com>
+Link: https://lore.kernel.org/r/20210912190523.27991-1-bunk@kernel.org
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
+@@ -1224,7 +1224,7 @@ int bnx2x_iov_init_one(struct bnx2x *bp,
+       /* SR-IOV capability was enabled but there are no VFs*/
+       if (iov->total == 0) {
+-              err = -EINVAL;
++              err = 0;
+               goto failed;
+       }
diff --git a/queue-5.14/drm-amd-amdgpu-increase-hwip_max_instance-to-10.patch b/queue-5.14/drm-amd-amdgpu-increase-hwip_max_instance-to-10.patch
new file mode 100644 (file)
index 0000000..513738e
--- /dev/null
@@ -0,0 +1,37 @@
+From 67a44e659888569a133a8f858c8230e9d7aad1d5 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ernst=20Sj=C3=B6strand?= <ernstp@gmail.com>
+Date: Thu, 2 Sep 2021 09:50:27 +0200
+Subject: drm/amd/amdgpu: Increase HWIP_MAX_INSTANCE to 10
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Ernst Sjöstrand <ernstp@gmail.com>
+
+commit 67a44e659888569a133a8f858c8230e9d7aad1d5 upstream.
+
+Seems like newer cards can have even more instances now.
+Found by UBSAN: array-index-out-of-bounds in
+drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c:318:29
+index 8 is out of range for type 'uint32_t *[8]'
+
+Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1697
+Cc: stable@vger.kernel.org
+Signed-off-by: Ernst Sjöstrand <ernstp@gmail.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu.h |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+@@ -757,7 +757,7 @@ enum amd_hw_ip_block_type {
+       MAX_HWIP
+ };
+-#define HWIP_MAX_INSTANCE     8
++#define HWIP_MAX_INSTANCE     10
+ struct amd_powerplay {
+       void *pp_handle;
diff --git a/queue-5.14/drm-amd-display-dsc-mst-2-4k-displays-go-dark-with-2-lane-hbr3.patch b/queue-5.14/drm-amd-display-dsc-mst-2-4k-displays-go-dark-with-2-lane-hbr3.patch
new file mode 100644 (file)
index 0000000..4983638
--- /dev/null
@@ -0,0 +1,210 @@
+From 90517c9838602846daa0feec7b37382fed61b001 Mon Sep 17 00:00:00 2001
+From: Hersen Wu <hersenwu@amd.com>
+Date: Wed, 25 Aug 2021 16:27:47 -0400
+Subject: drm/amd/display: dsc mst 2 4K displays go dark with 2 lane HBR3
+
+From: Hersen Wu <hersenwu@amd.com>
+
+commit 90517c9838602846daa0feec7b37382fed61b001 upstream.
+
+[Why]
+call stack of amdgpu dsc mst pbn, slot num calculation is as below:
+-compute_bpp_x16_from_target_bandwidth
+-decide_dsc_target_bpp_x16
+-setup_dsc_config
+-dc_dsc_compute_bandwidth_range
+-compute_mst_dsc_configs_for_link
+-compute_mst_dsc_configs_for_state
+
+from pbn -> dsc target bpp_x16
+
+bpp_x16 is calulated by compute_bpp_x16_from_target_bandwidth.
+Beside pixel clock and bpp, num_slices_h and bpp_increment_div
+will also affect bpp_x16.
+
+from dsc target bpp_x16 -> pbn
+
+within dm_update_mst_vcpi_slots_for_dsc,
+pbn = drm_dp_calc_pbn_mode(clock, bpp_x16, true);
+
+drm_dp_calc_pbn_mode(int clock, int bpp, bool dsc)
+{
+  return DIV_ROUND_UP_ULL(mul_u32_u32(clock * (bpp / 16), 64 * 1006),
+            8 * 54 * 1000 * 1000);
+}
+
+bpp / 16 trunc digits after decimal point. This will cause calculation
+delta. drm_dp_calc_pbn_mode does not have other informations,
+like num_slices_h, bpp_increment_div. therefore, it does not do revese
+calcuation properly from bpp_x16 to pbn.
+
+pbn from drm_dp_calc_pbn_mode is less than pbn from
+compute_mst_dsc_configs_for_state. This cause not enough mst slot
+allocated to display. display could not visually light up.
+
+[How]
+pass pbn from compute_mst_dsc_configs_for_state to
+dm_update_mst_vcpi_slots_for_dsc
+
+Cc: stable@vger.kernel.org
+
+Reviewed-by: Scott Foster <Scott.Foster@amd.com>
+Acked-by: Mikita Lipski <mikita.lipski@amd.com>
+Signed-off-by: Hersen Wu <hersenwu@amd.com>
+Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c           |   22 ++++++++----
+ drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c |   18 ++++-----
+ drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h |   11 +++++-
+ 3 files changed, 34 insertions(+), 17 deletions(-)
+
+--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+@@ -6778,14 +6778,15 @@ const struct drm_encoder_helper_funcs am
+ #if defined(CONFIG_DRM_AMD_DC_DCN)
+ static int dm_update_mst_vcpi_slots_for_dsc(struct drm_atomic_state *state,
+-                                          struct dc_state *dc_state)
++                                          struct dc_state *dc_state,
++                                          struct dsc_mst_fairness_vars *vars)
+ {
+       struct dc_stream_state *stream = NULL;
+       struct drm_connector *connector;
+       struct drm_connector_state *new_con_state;
+       struct amdgpu_dm_connector *aconnector;
+       struct dm_connector_state *dm_conn_state;
+-      int i, j, clock, bpp;
++      int i, j, clock;
+       int vcpi, pbn_div, pbn = 0;
+       for_each_new_connector_in_state(state, connector, new_con_state, i) {
+@@ -6824,9 +6825,15 @@ static int dm_update_mst_vcpi_slots_for_
+               }
+               pbn_div = dm_mst_get_pbn_divider(stream->link);
+-              bpp = stream->timing.dsc_cfg.bits_per_pixel;
+               clock = stream->timing.pix_clk_100hz / 10;
+-              pbn = drm_dp_calc_pbn_mode(clock, bpp, true);
++              /* pbn is calculated by compute_mst_dsc_configs_for_state*/
++              for (j = 0; j < dc_state->stream_count; j++) {
++                      if (vars[j].aconnector == aconnector) {
++                              pbn = vars[j].pbn;
++                              break;
++                      }
++              }
++
+               vcpi = drm_dp_mst_atomic_enable_dsc(state,
+                                                   aconnector->port,
+                                                   pbn, pbn_div,
+@@ -10208,6 +10215,9 @@ static int amdgpu_dm_atomic_check(struct
+       int ret, i;
+       bool lock_and_validation_needed = false;
+       struct dm_crtc_state *dm_old_crtc_state;
++#if defined(CONFIG_DRM_AMD_DC_DCN)
++      struct dsc_mst_fairness_vars vars[MAX_PIPES];
++#endif
+       trace_amdgpu_dm_atomic_check_begin(state);
+@@ -10438,10 +10448,10 @@ static int amdgpu_dm_atomic_check(struct
+                       goto fail;
+ #if defined(CONFIG_DRM_AMD_DC_DCN)
+-              if (!compute_mst_dsc_configs_for_state(state, dm_state->context))
++              if (!compute_mst_dsc_configs_for_state(state, dm_state->context, vars))
+                       goto fail;
+-              ret = dm_update_mst_vcpi_slots_for_dsc(state, dm_state->context);
++              ret = dm_update_mst_vcpi_slots_for_dsc(state, dm_state->context, vars);
+               if (ret)
+                       goto fail;
+ #endif
+--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
+@@ -495,12 +495,7 @@ struct dsc_mst_fairness_params {
+       uint32_t num_slices_h;
+       uint32_t num_slices_v;
+       uint32_t bpp_overwrite;
+-};
+-
+-struct dsc_mst_fairness_vars {
+-      int pbn;
+-      bool dsc_enabled;
+-      int bpp_x16;
++      struct amdgpu_dm_connector *aconnector;
+ };
+ static int kbps_to_peak_pbn(int kbps)
+@@ -727,12 +722,12 @@ static void try_disable_dsc(struct drm_a
+ static bool compute_mst_dsc_configs_for_link(struct drm_atomic_state *state,
+                                            struct dc_state *dc_state,
+-                                           struct dc_link *dc_link)
++                                           struct dc_link *dc_link,
++                                           struct dsc_mst_fairness_vars *vars)
+ {
+       int i;
+       struct dc_stream_state *stream;
+       struct dsc_mst_fairness_params params[MAX_PIPES];
+-      struct dsc_mst_fairness_vars vars[MAX_PIPES];
+       struct amdgpu_dm_connector *aconnector;
+       int count = 0;
+       bool debugfs_overwrite = false;
+@@ -753,6 +748,7 @@ static bool compute_mst_dsc_configs_for_
+               params[count].timing = &stream->timing;
+               params[count].sink = stream->sink;
+               aconnector = (struct amdgpu_dm_connector *)stream->dm_stream_context;
++              params[count].aconnector = aconnector;
+               params[count].port = aconnector->port;
+               params[count].clock_force_enable = aconnector->dsc_settings.dsc_force_enable;
+               if (params[count].clock_force_enable == DSC_CLK_FORCE_ENABLE)
+@@ -775,6 +771,7 @@ static bool compute_mst_dsc_configs_for_
+       }
+       /* Try no compression */
+       for (i = 0; i < count; i++) {
++              vars[i].aconnector = params[i].aconnector;
+               vars[i].pbn = kbps_to_peak_pbn(params[i].bw_range.stream_kbps);
+               vars[i].dsc_enabled = false;
+               vars[i].bpp_x16 = 0;
+@@ -828,7 +825,8 @@ static bool compute_mst_dsc_configs_for_
+ }
+ bool compute_mst_dsc_configs_for_state(struct drm_atomic_state *state,
+-                                     struct dc_state *dc_state)
++                                     struct dc_state *dc_state,
++                                     struct dsc_mst_fairness_vars *vars)
+ {
+       int i, j;
+       struct dc_stream_state *stream;
+@@ -859,7 +857,7 @@ bool compute_mst_dsc_configs_for_state(s
+                       return false;
+               mutex_lock(&aconnector->mst_mgr.lock);
+-              if (!compute_mst_dsc_configs_for_link(state, dc_state, stream->link)) {
++              if (!compute_mst_dsc_configs_for_link(state, dc_state, stream->link, vars)) {
+                       mutex_unlock(&aconnector->mst_mgr.lock);
+                       return false;
+               }
+--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h
++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h
+@@ -39,8 +39,17 @@ void
+ dm_dp_create_fake_mst_encoders(struct amdgpu_device *adev);
+ #if defined(CONFIG_DRM_AMD_DC_DCN)
++
++struct dsc_mst_fairness_vars {
++      int pbn;
++      bool dsc_enabled;
++      int bpp_x16;
++      struct amdgpu_dm_connector *aconnector;
++};
++
+ bool compute_mst_dsc_configs_for_state(struct drm_atomic_state *state,
+-                                     struct dc_state *dc_state);
++                                     struct dc_state *dc_state,
++                                     struct dsc_mst_fairness_vars *vars);
+ #endif
+ #endif
diff --git a/queue-5.14/drm-amd-display-fix-white-screen-page-fault-for-gpuvm.patch b/queue-5.14/drm-amd-display-fix-white-screen-page-fault-for-gpuvm.patch
new file mode 100644 (file)
index 0000000..0fdec3f
--- /dev/null
@@ -0,0 +1,42 @@
+From a70939851f9ced298dc7d523374b8c4d05239caf Mon Sep 17 00:00:00 2001
+From: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
+Date: Mon, 13 Sep 2021 14:56:44 -0400
+Subject: drm/amd/display: Fix white screen page fault for gpuvm
+
+From: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
+
+commit a70939851f9ced298dc7d523374b8c4d05239caf upstream.
+
+[Why]
+The "base_addr_is_mc_addr" field was added for dcn3.1 support but
+pa_config was never updated to set it to false.
+
+Uninitialized memory causes it to be set to true which results in
+address mistranslation and white screen.
+
+[How]
+Use memset to ensure all fields are initialized to 0 by default.
+
+Fixes: 64b1d0e8d500 ("drm/amd/display: Add DCN3.1 HWSEQ")
+Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
+Acked-by: Alex Deucher <alexander.deucher@amd.com>
+Acked-by: Aaron Liu <aaron.liu@amd.com>
+Reviewed-by: Harry Wentland <harry.wentland@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/display/amdgpu_dm/amdgpu_dm.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+@@ -998,6 +998,8 @@ static void mmhub_read_system_context(st
+       uint32_t agp_base, agp_bot, agp_top;
+       PHYSICAL_ADDRESS_LOC page_table_start, page_table_end, page_table_base;
++      memset(pa_config, 0, sizeof(*pa_config));
++
+       logical_addr_low  = min(adev->gmc.fb_start, adev->gmc.agp_start) >> 18;
+       pt_base = amdgpu_gmc_pd_addr(adev->gart.bo);
diff --git a/queue-5.14/drm-amd-display-get-backlight-from-pwm-if-dmcu-is-not-initialized.patch b/queue-5.14/drm-amd-display-get-backlight-from-pwm-if-dmcu-is-not-initialized.patch
new file mode 100644 (file)
index 0000000..cdf7c97
--- /dev/null
@@ -0,0 +1,89 @@
+From 9987fbb368038d41bfdcda2a3f7f4945d7daa9a5 Mon Sep 17 00:00:00 2001
+From: Harry Wentland <harry.wentland@amd.com>
+Date: Mon, 16 Aug 2021 15:57:12 -0400
+Subject: drm/amd/display: Get backlight from PWM if DMCU is not initialized
+
+From: Harry Wentland <harry.wentland@amd.com>
+
+commit 9987fbb368038d41bfdcda2a3f7f4945d7daa9a5 upstream.
+
+On Carrizo/Stoney systems we set backlight through panel_cntl, i.e.
+directly via the PWM registers, if DMCU is not initialized. We
+always read it back through ABM registers which leads to a
+mismatch and forces atomic_commit to program the backlight
+each time.
+
+Instead make sure we use the same logic for backlight readback,
+i.e. read it from panel_cntl if DMCU is not initialized.
+
+We also need to remove some extraneous and incorrect calculations
+at the end of dce_get_16_bit_backlight_from_pwm.
+
+Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1666
+Cc: stable@vger.kernel.org
+
+Reviewed-by: Josip Pavic <josip.pavic@amd.com>
+Acked-by: Mikita Lipski <mikita.lipski@amd.com>
+Signed-off-by: Harry Wentland <harry.wentland@amd.com>
+Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/amd/display/dc/core/dc_link.c       |   16 ++++++++++++----
+ drivers/gpu/drm/amd/display/dc/dce/dce_panel_cntl.c |   10 ----------
+ 2 files changed, 12 insertions(+), 14 deletions(-)
+
+--- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c
++++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
+@@ -2578,13 +2578,21 @@ static struct abm *get_abm_from_stream_r
+ int dc_link_get_backlight_level(const struct dc_link *link)
+ {
+-
+       struct abm *abm = get_abm_from_stream_res(link);
++      struct panel_cntl *panel_cntl = link->panel_cntl;
++      struct dc  *dc = link->ctx->dc;
++      struct dmcu *dmcu = dc->res_pool->dmcu;
++      bool fw_set_brightness = true;
+-      if (abm == NULL || abm->funcs->get_current_backlight == NULL)
+-              return DC_ERROR_UNEXPECTED;
++      if (dmcu)
++              fw_set_brightness = dmcu->funcs->is_dmcu_initialized(dmcu);
+-      return (int) abm->funcs->get_current_backlight(abm);
++      if (!fw_set_brightness && panel_cntl->funcs->get_current_backlight)
++              return panel_cntl->funcs->get_current_backlight(panel_cntl);
++      else if (abm != NULL && abm->funcs->get_current_backlight != NULL)
++              return (int) abm->funcs->get_current_backlight(abm);
++      else
++              return DC_ERROR_UNEXPECTED;
+ }
+ int dc_link_get_target_backlight_pwm(const struct dc_link *link)
+--- a/drivers/gpu/drm/amd/display/dc/dce/dce_panel_cntl.c
++++ b/drivers/gpu/drm/amd/display/dc/dce/dce_panel_cntl.c
+@@ -49,7 +49,6 @@
+ static unsigned int dce_get_16_bit_backlight_from_pwm(struct panel_cntl *panel_cntl)
+ {
+       uint64_t current_backlight;
+-      uint32_t round_result;
+       uint32_t bl_period, bl_int_count;
+       uint32_t bl_pwm, fractional_duty_cycle_en;
+       uint32_t bl_period_mask, bl_pwm_mask;
+@@ -84,15 +83,6 @@ static unsigned int dce_get_16_bit_backl
+       current_backlight = div_u64(current_backlight, bl_period);
+       current_backlight = (current_backlight + 1) >> 1;
+-      current_backlight = (uint64_t)(current_backlight) * bl_period;
+-
+-      round_result = (uint32_t)(current_backlight & 0xFFFFFFFF);
+-
+-      round_result = (round_result >> (bl_int_count-1)) & 1;
+-
+-      current_backlight >>= bl_int_count;
+-      current_backlight += round_result;
+-
+       return (uint32_t)(current_backlight);
+ }
diff --git a/queue-5.14/drm-amd-pm-fix-runpm-hang-when-amdgpu-loaded-prior-to-sound-driver.patch b/queue-5.14/drm-amd-pm-fix-runpm-hang-when-amdgpu-loaded-prior-to-sound-driver.patch
new file mode 100644 (file)
index 0000000..d0b546b
--- /dev/null
@@ -0,0 +1,130 @@
+From 8b514e898ee7f861eb8863c647d258f71053af40 Mon Sep 17 00:00:00 2001
+From: Evan Quan <evan.quan@amd.com>
+Date: Thu, 9 Sep 2021 11:01:00 +0800
+Subject: drm/amd/pm: fix runpm hang when amdgpu loaded prior to sound driver
+
+From: Evan Quan <evan.quan@amd.com>
+
+commit 8b514e898ee7f861eb8863c647d258f71053af40 upstream.
+
+Current RUNPM mechanism relies on PMFW to master the timing for BACO
+in/exit. And that needs cooperation from sound driver for dstate
+change notification for function 1(audio). Otherwise(on sound driver
+missing), BACO cannot be kicked in correctly and hang will be observed
+on RUNPM exit.
+
+By switching back to legacy message way on sound driver missing,
+we are able to fix the runpm hang observed for the scenario below:
+amdgpu driver loaded -> runpm suspend kicked -> sound driver loaded
+
+Signed-off-by: Evan Quan <evan.quan@amd.com>
+Reported-and-tested-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
+Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
+Reviewed-by: Guchun Chen <guchun.chen@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/pm/swsmu/smu11/navi10_ppt.c         |   24 ++++++++++++++--
+ drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c |    4 +-
+ drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c                  |   21 ++++++++++++++
+ drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h                  |    2 +
+ 4 files changed, 47 insertions(+), 4 deletions(-)
+
+--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
++++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
+@@ -2269,7 +2269,27 @@ static int navi10_baco_enter(struct smu_
+ {
+       struct amdgpu_device *adev = smu->adev;
+-      if (adev->in_runpm)
++      /*
++       * This aims the case below:
++       *   amdgpu driver loaded -> runpm suspend kicked -> sound driver loaded
++       *
++       * For NAVI10 and later ASICs, we rely on PMFW to handle the runpm. To
++       * make that possible, PMFW needs to acknowledge the dstate transition
++       * process for both gfx(function 0) and audio(function 1) function of
++       * the ASIC.
++       *
++       * The PCI device's initial runpm status is RUNPM_SUSPENDED. So as the
++       * device representing the audio function of the ASIC. And that means
++       * even if the sound driver(snd_hda_intel) was not loaded yet, it's still
++       * possible runpm suspend kicked on the ASIC. However without the dstate
++       * transition notification from audio function, pmfw cannot handle the
++       * BACO in/exit correctly. And that will cause driver hang on runpm
++       * resuming.
++       *
++       * To address this, we revert to legacy message way(driver masters the
++       * timing for BACO in/exit) on sound driver missing.
++       */
++      if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev))
+               return smu_v11_0_baco_set_armd3_sequence(smu, BACO_SEQ_BACO);
+       else
+               return smu_v11_0_baco_enter(smu);
+@@ -2279,7 +2299,7 @@ static int navi10_baco_exit(struct smu_c
+ {
+       struct amdgpu_device *adev = smu->adev;
+-      if (adev->in_runpm) {
++      if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev)) {
+               /* Wait for PMFW handling for the Dstate change */
+               msleep(10);
+               return smu_v11_0_baco_set_armd3_sequence(smu, BACO_SEQ_ULPS);
+--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
++++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
+@@ -2133,7 +2133,7 @@ static int sienna_cichlid_baco_enter(str
+ {
+       struct amdgpu_device *adev = smu->adev;
+-      if (adev->in_runpm)
++      if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev))
+               return smu_v11_0_baco_set_armd3_sequence(smu, BACO_SEQ_BACO);
+       else
+               return smu_v11_0_baco_enter(smu);
+@@ -2143,7 +2143,7 @@ static int sienna_cichlid_baco_exit(stru
+ {
+       struct amdgpu_device *adev = smu->adev;
+-      if (adev->in_runpm) {
++      if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev)) {
+               /* Wait for PMFW handling for the Dstate change */
+               msleep(10);
+               return smu_v11_0_baco_set_armd3_sequence(smu, BACO_SEQ_ULPS);
+--- a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
++++ b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
+@@ -1053,3 +1053,24 @@ int smu_cmn_set_mp1_state(struct smu_con
+       return ret;
+ }
++
++bool smu_cmn_is_audio_func_enabled(struct amdgpu_device *adev)
++{
++      struct pci_dev *p = NULL;
++      bool snd_driver_loaded;
++
++      /*
++       * If the ASIC comes with no audio function, we always assume
++       * it is "enabled".
++       */
++      p = pci_get_domain_bus_and_slot(pci_domain_nr(adev->pdev->bus),
++                      adev->pdev->bus->number, 1);
++      if (!p)
++              return true;
++
++      snd_driver_loaded = pci_is_enabled(p) ? true : false;
++
++      pci_dev_put(p);
++
++      return snd_driver_loaded;
++}
+--- a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h
++++ b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h
+@@ -110,5 +110,7 @@ void smu_cmn_init_soft_gpu_metrics(void
+ int smu_cmn_set_mp1_state(struct smu_context *smu,
+                         enum pp_mp1_state mp1_state);
++bool smu_cmn_is_audio_func_enabled(struct amdgpu_device *adev);
++
+ #endif
+ #endif
diff --git a/queue-5.14/drm-amd-pm-fix-the-issue-of-uploading-powerplay-table.patch b/queue-5.14/drm-amd-pm-fix-the-issue-of-uploading-powerplay-table.patch
new file mode 100644 (file)
index 0000000..fa35faa
--- /dev/null
@@ -0,0 +1,31 @@
+From 5598d7c21a0bcab900f281dca4efbb1f80add0fe Mon Sep 17 00:00:00 2001
+From: Kenneth Feng <kenneth.feng@amd.com>
+Date: Mon, 6 Sep 2021 07:55:01 +0800
+Subject: drm/amd/pm: fix the issue of uploading powerplay table
+
+From: Kenneth Feng <kenneth.feng@amd.com>
+
+commit 5598d7c21a0bcab900f281dca4efbb1f80add0fe upstream.
+
+fix the issue of uploading powerplay table due to the dependancy of rlc.
+
+Signed-off-by: Kenneth Feng <kenneth.feng@amd.com>
+Reviewed-by: Jack Gui <Jack.Gui@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/pm/swsmu/amdgpu_smu.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
++++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+@@ -1381,7 +1381,7 @@ static int smu_disable_dpms(struct smu_c
+        */
+       if (smu->uploading_custom_pp_table &&
+           (adev->asic_type >= CHIP_NAVI10) &&
+-          (adev->asic_type <= CHIP_DIMGREY_CAVEFISH))
++          (adev->asic_type <= CHIP_BEIGE_GOBY))
+               return smu_disable_all_features_with_exception(smu,
+                                                              true,
+                                                              SMU_FEATURE_COUNT);
diff --git a/queue-5.14/drm-amdgpu-add-amdgpu_amdkfd_resume_iommu.patch b/queue-5.14/drm-amdgpu-add-amdgpu_amdkfd_resume_iommu.patch
new file mode 100644 (file)
index 0000000..5c1b494
--- /dev/null
@@ -0,0 +1,51 @@
+From 8066008482e533e91934bee49765bf8b4a7c40db Mon Sep 17 00:00:00 2001
+From: James Zhu <James.Zhu@amd.com>
+Date: Tue, 7 Sep 2021 11:27:31 -0400
+Subject: drm/amdgpu: add amdgpu_amdkfd_resume_iommu
+
+From: James Zhu <James.Zhu@amd.com>
+
+commit 8066008482e533e91934bee49765bf8b4a7c40db upstream.
+
+Add amdgpu_amdkfd_resume_iommu for amdgpu.
+
+Bug: https://bugzilla.kernel.org/show_bug.cgi?id=211277
+Signed-off-by: James Zhu <James.Zhu@amd.com>
+Reviewed-by: Felix Kuehling <Felix.Kuehling@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_amdkfd.c |   10 ++++++++++
+ drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h |    1 +
+ 2 files changed, 11 insertions(+)
+
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
+@@ -191,6 +191,16 @@ void amdgpu_amdkfd_suspend(struct amdgpu
+               kgd2kfd_suspend(adev->kfd.dev, run_pm);
+ }
++int amdgpu_amdkfd_resume_iommu(struct amdgpu_device *adev)
++{
++      int r = 0;
++
++      if (adev->kfd.dev)
++              r = kgd2kfd_resume_iommu(adev->kfd.dev);
++
++      return r;
++}
++
+ int amdgpu_amdkfd_resume(struct amdgpu_device *adev, bool run_pm)
+ {
+       int r = 0;
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
+@@ -137,6 +137,7 @@ int amdgpu_amdkfd_init(void);
+ void amdgpu_amdkfd_fini(void);
+ void amdgpu_amdkfd_suspend(struct amdgpu_device *adev, bool run_pm);
++int amdgpu_amdkfd_resume_iommu(struct amdgpu_device *adev);
+ int amdgpu_amdkfd_resume(struct amdgpu_device *adev, bool run_pm);
+ void amdgpu_amdkfd_interrupt(struct amdgpu_device *adev,
+                       const void *ih_ring_entry);
diff --git a/queue-5.14/drm-amdgpu-fix-use-after-free-during-bo-move.patch b/queue-5.14/drm-amdgpu-fix-use-after-free-during-bo-move.patch
new file mode 100644 (file)
index 0000000..f2f8d5b
--- /dev/null
@@ -0,0 +1,61 @@
+From c92db8d64f9e0313e7ecdc9500db93a5040c9370 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Christian=20K=C3=B6nig?= <christian.koenig@amd.com>
+Date: Tue, 7 Sep 2021 09:37:52 +0200
+Subject: drm/amdgpu: fix use after free during BO move
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Christian König <christian.koenig@amd.com>
+
+commit c92db8d64f9e0313e7ecdc9500db93a5040c9370 upstream.
+
+The memory backing old_mem is already freed at that point, move the
+check a bit more up.
+
+Signed-off-by: Christian König <christian.koenig@amd.com>
+Fixes: bfa3357ef9ab ("drm/ttm: allocate resource object instead of embedding it v2")
+Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1699
+Acked-by: Nirmoy Das <nirmoy.das@amd.com>
+Reviewed-by: Michel Dänzer <mdaenzer@redhat.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_ttm.c |   18 +++++++++---------
+ 1 file changed, 9 insertions(+), 9 deletions(-)
+
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+@@ -513,6 +513,15 @@ static int amdgpu_bo_move(struct ttm_buf
+               goto out;
+       }
++      if (bo->type == ttm_bo_type_device &&
++          new_mem->mem_type == TTM_PL_VRAM &&
++          old_mem->mem_type != TTM_PL_VRAM) {
++              /* amdgpu_bo_fault_reserve_notify will re-set this if the CPU
++               * accesses the BO after it's moved.
++               */
++              abo->flags &= ~AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
++      }
++
+       if (adev->mman.buffer_funcs_enabled) {
+               if (((old_mem->mem_type == TTM_PL_SYSTEM &&
+                     new_mem->mem_type == TTM_PL_VRAM) ||
+@@ -543,15 +552,6 @@ static int amdgpu_bo_move(struct ttm_buf
+                       return r;
+       }
+-      if (bo->type == ttm_bo_type_device &&
+-          new_mem->mem_type == TTM_PL_VRAM &&
+-          old_mem->mem_type != TTM_PL_VRAM) {
+-              /* amdgpu_bo_fault_reserve_notify will re-set this if the CPU
+-               * accesses the BO after it's moved.
+-               */
+-              abo->flags &= ~AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
+-      }
+-
+ out:
+       /* update statistics */
+       atomic64_add(bo->base.size, &adev->num_bytes_moved);
diff --git a/queue-5.14/drm-amdgpu-move-iommu_resume-before-ip-init-resume.patch b/queue-5.14/drm-amdgpu-move-iommu_resume-before-ip-init-resume.patch
new file mode 100644 (file)
index 0000000..b0335da
--- /dev/null
@@ -0,0 +1,57 @@
+From f02abeb0779700c308e661a412451b38962b8a0b Mon Sep 17 00:00:00 2001
+From: James Zhu <James.Zhu@amd.com>
+Date: Tue, 7 Sep 2021 11:32:22 -0400
+Subject: drm/amdgpu: move iommu_resume before ip init/resume
+
+From: James Zhu <James.Zhu@amd.com>
+
+commit f02abeb0779700c308e661a412451b38962b8a0b upstream.
+
+Separate iommu_resume from kfd_resume, and move it before
+other amdgpu ip init/resume.
+
+Bug: https://bugzilla.kernel.org/show_bug.cgi?id=211277
+Signed-off-by: James Zhu <James.Zhu@amd.com>
+Reviewed-by: Felix Kuehling <Felix.Kuehling@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 |   12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+@@ -2342,6 +2342,10 @@ static int amdgpu_device_ip_init(struct
+       if (r)
+               goto init_failed;
++      r = amdgpu_amdkfd_resume_iommu(adev);
++      if (r)
++              goto init_failed;
++
+       r = amdgpu_device_ip_hw_init_phase1(adev);
+       if (r)
+               goto init_failed;
+@@ -3096,6 +3100,10 @@ static int amdgpu_device_ip_resume(struc
+ {
+       int r;
++      r = amdgpu_amdkfd_resume_iommu(adev);
++      if (r)
++              return r;
++
+       r = amdgpu_device_ip_resume_phase1(adev);
+       if (r)
+               return r;
+@@ -4534,6 +4542,10 @@ int amdgpu_do_asic_reset(struct list_hea
+                               dev_warn(tmp_adev->dev, "asic atom init failed!");
+                       } else {
+                               dev_info(tmp_adev->dev, "GPU reset succeeded, trying to resume\n");
++                              r = amdgpu_amdkfd_resume_iommu(tmp_adev);
++                              if (r)
++                                      goto out;
++
+                               r = amdgpu_device_ip_resume_phase1(tmp_adev);
+                               if (r)
+                                       goto out;
diff --git a/queue-5.14/drm-amdgpu-use-is_err-for-debugfs-apis.patch b/queue-5.14/drm-amdgpu-use-is_err-for-debugfs-apis.patch
new file mode 100644 (file)
index 0000000..5503c91
--- /dev/null
@@ -0,0 +1,69 @@
+From b04ce53eac2fc326290817a6f64a440b5bffd2e3 Mon Sep 17 00:00:00 2001
+From: Nirmoy Das <nirmoy.das@amd.com>
+Date: Thu, 2 Sep 2021 13:27:56 +0200
+Subject: drm/amdgpu: use IS_ERR for debugfs APIs
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Nirmoy Das <nirmoy.das@amd.com>
+
+commit b04ce53eac2fc326290817a6f64a440b5bffd2e3 upstream.
+
+debugfs APIs returns encoded error so use
+IS_ERR for checking return value.
+
+v2: return PTR_ERR(ent)
+
+References: https://gitlab.freedesktop.org/drm/amd/-/issues/1686
+Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>
+Reviewed-by: Christian König <christian.koenig@amd.com>
+Reviewed-By: Shashank Sharma <shashank.sharma@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_debugfs.c |   10 ++++------
+ drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c    |    4 ++--
+ 2 files changed, 6 insertions(+), 8 deletions(-)
+
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
+@@ -1544,20 +1544,18 @@ int amdgpu_debugfs_init(struct amdgpu_de
+       struct dentry *ent;
+       int r, i;
+-
+-
+       ent = debugfs_create_file("amdgpu_preempt_ib", 0600, root, adev,
+                                 &fops_ib_preempt);
+-      if (!ent) {
++      if (IS_ERR(ent)) {
+               DRM_ERROR("unable to create amdgpu_preempt_ib debugsfs file\n");
+-              return -EIO;
++              return PTR_ERR(ent);
+       }
+       ent = debugfs_create_file("amdgpu_force_sclk", 0200, root, adev,
+                                 &fops_sclk_set);
+-      if (!ent) {
++      if (IS_ERR(ent)) {
+               DRM_ERROR("unable to create amdgpu_set_sclk debugsfs file\n");
+-              return -EIO;
++              return PTR_ERR(ent);
+       }
+       /* Register debugfs entries for amdgpu_ttm */
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
+@@ -428,8 +428,8 @@ int amdgpu_debugfs_ring_init(struct amdg
+       ent = debugfs_create_file(name,
+                                 S_IFREG | S_IRUGO, root,
+                                 ring, &amdgpu_debugfs_ring_fops);
+-      if (!ent)
+-              return -ENOMEM;
++      if (IS_ERR(ent))
++              return PTR_ERR(ent);
+       i_size_write(ent->d_inode, ring->ring_size + 12);
+       ring->ent = ent;
diff --git a/queue-5.14/drm-amdkfd-separate-kfd_iommu_resume-from-kfd_resume.patch b/queue-5.14/drm-amdkfd-separate-kfd_iommu_resume-from-kfd_resume.patch
new file mode 100644 (file)
index 0000000..99d22c1
--- /dev/null
@@ -0,0 +1,75 @@
+From fefc01f042f44ede373ee66773b8238dd8fdcb55 Mon Sep 17 00:00:00 2001
+From: James Zhu <James.Zhu@amd.com>
+Date: Tue, 7 Sep 2021 11:13:02 -0400
+Subject: drm/amdkfd: separate kfd_iommu_resume from kfd_resume
+
+From: James Zhu <James.Zhu@amd.com>
+
+commit fefc01f042f44ede373ee66773b8238dd8fdcb55 upstream.
+
+Separate kfd_iommu_resume from kfd_resume for fine-tuning
+of amdgpu device init/resume/reset/recovery sequence.
+
+v2: squash in fix for !CONFIG_HSA_AMD
+
+Bug: https://bugzilla.kernel.org/show_bug.cgi?id=211277
+Signed-off-by: James Zhu <James.Zhu@amd.com>
+Reviewed-by: Felix Kuehling <Felix.Kuehling@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_amdkfd.h |    6 ++++++
+ drivers/gpu/drm/amd/amdkfd/kfd_device.c    |   12 ++++++++----
+ 2 files changed, 14 insertions(+), 4 deletions(-)
+
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
+@@ -326,6 +326,7 @@ bool kgd2kfd_device_init(struct kfd_dev
+                        const struct kgd2kfd_shared_resources *gpu_resources);
+ void kgd2kfd_device_exit(struct kfd_dev *kfd);
+ void kgd2kfd_suspend(struct kfd_dev *kfd, bool run_pm);
++int kgd2kfd_resume_iommu(struct kfd_dev *kfd);
+ int kgd2kfd_resume(struct kfd_dev *kfd, bool run_pm);
+ int kgd2kfd_pre_reset(struct kfd_dev *kfd);
+ int kgd2kfd_post_reset(struct kfd_dev *kfd);
+@@ -364,6 +365,11 @@ static inline void kgd2kfd_suspend(struc
+ {
+ }
++static int __maybe_unused kgd2kfd_resume_iommu(struct kfd_dev *kfd)
++{
++      return 0;
++}
++
+ static inline int kgd2kfd_resume(struct kfd_dev *kfd, bool run_pm)
+ {
+       return 0;
+--- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c
++++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
+@@ -1008,17 +1008,21 @@ int kgd2kfd_resume(struct kfd_dev *kfd,
+       return ret;
+ }
+-static int kfd_resume(struct kfd_dev *kfd)
++int kgd2kfd_resume_iommu(struct kfd_dev *kfd)
+ {
+       int err = 0;
+       err = kfd_iommu_resume(kfd);
+-      if (err) {
++      if (err)
+               dev_err(kfd_device,
+                       "Failed to resume IOMMU for device %x:%x\n",
+                       kfd->pdev->vendor, kfd->pdev->device);
+-              return err;
+-      }
++      return err;
++}
++
++static int kfd_resume(struct kfd_dev *kfd)
++{
++      int err = 0;
+       err = kfd->dqm->ops.start(kfd->dqm);
+       if (err) {
diff --git a/queue-5.14/drm-radeon-pass-drm-dev-radeon_agp_head_init-directly.patch b/queue-5.14/drm-radeon-pass-drm-dev-radeon_agp_head_init-directly.patch
new file mode 100644 (file)
index 0000000..db97420
--- /dev/null
@@ -0,0 +1,36 @@
+From 93def70cf8b23de5049d101b7dd5367864694bd3 Mon Sep 17 00:00:00 2001
+From: Nirmoy Das <nirmoy.das@amd.com>
+Date: Mon, 13 Sep 2021 10:08:23 +0200
+Subject: drm/radeon: pass drm dev radeon_agp_head_init directly
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Nirmoy Das <nirmoy.das@amd.com>
+
+commit 93def70cf8b23de5049d101b7dd5367864694bd3 upstream.
+
+Pass drm dev directly as rdev->ddev gets initialized later on
+at radeon_device_init().
+
+Bug: https://bugzilla.kernel.org/show_bug.cgi?id=214375
+Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>
+Reviewed-by: Christian König <christian.koenig@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/radeon/radeon_kms.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/gpu/drm/radeon/radeon_kms.c
++++ b/drivers/gpu/drm/radeon/radeon_kms.c
+@@ -119,7 +119,7 @@ int radeon_driver_load_kms(struct drm_de
+ #endif
+       if (pci_find_capability(pdev, PCI_CAP_ID_AGP))
+-              rdev->agp = radeon_agp_head_init(rdev->ddev);
++              rdev->agp = radeon_agp_head_init(dev);
+       if (rdev->agp) {
+               rdev->agp->agp_mtrr = arch_phys_wc_add(
+                       rdev->agp->agp_info.aper_base,
diff --git a/queue-5.14/io_uring-ensure-symmetry-in-handling-iter-types-in-loop_rw_iter.patch b/queue-5.14/io_uring-ensure-symmetry-in-handling-iter-types-in-loop_rw_iter.patch
new file mode 100644 (file)
index 0000000..cd45feb
--- /dev/null
@@ -0,0 +1,45 @@
+From 16c8d2df7ec0eed31b7d3b61cb13206a7fb930cc Mon Sep 17 00:00:00 2001
+From: Jens Axboe <axboe@kernel.dk>
+Date: Sun, 12 Sep 2021 06:45:07 -0600
+Subject: io_uring: ensure symmetry in handling iter types in loop_rw_iter()
+
+From: Jens Axboe <axboe@kernel.dk>
+
+commit 16c8d2df7ec0eed31b7d3b61cb13206a7fb930cc upstream.
+
+When setting up the next segment, we check what type the iter is and
+handle it accordingly. However, when incrementing and processed amount
+we do not, and both iter advance and addr/len are adjusted, regardless
+of type. Split the increment side just like we do on the setup side.
+
+Fixes: 4017eb91a9e7 ("io_uring: make loop_rw_iter() use original user supplied pointers")
+Cc: stable@vger.kernel.org
+Reported-by: Valentina Palmiotti <vpalmiotti@gmail.com>
+Reviewed-by: Pavel Begunkov <asml.silence@gmail.com>
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/io_uring.c |    9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+--- a/fs/io_uring.c
++++ b/fs/io_uring.c
+@@ -3107,12 +3107,15 @@ static ssize_t loop_rw_iter(int rw, stru
+                               ret = nr;
+                       break;
+               }
++              if (!iov_iter_is_bvec(iter)) {
++                      iov_iter_advance(iter, nr);
++              } else {
++                      req->rw.len -= nr;
++                      req->rw.addr += nr;
++              }
+               ret += nr;
+               if (nr != iovec.iov_len)
+                       break;
+-              req->rw.len -= nr;
+-              req->rw.addr += nr;
+-              iov_iter_advance(iter, nr);
+       }
+       return ret;
diff --git a/queue-5.14/pci-add-amd-gpu-multi-function-power-dependencies.patch b/queue-5.14/pci-add-amd-gpu-multi-function-power-dependencies.patch
new file mode 100644 (file)
index 0000000..6528fa4
--- /dev/null
@@ -0,0 +1,63 @@
+From 60b78ed088ebe1a872ee1320b6c5ad6ee2c4bd9a Mon Sep 17 00:00:00 2001
+From: Evan Quan <evan.quan@amd.com>
+Date: Fri, 3 Sep 2021 14:33:11 +0800
+Subject: PCI: Add AMD GPU multi-function power dependencies
+
+From: Evan Quan <evan.quan@amd.com>
+
+commit 60b78ed088ebe1a872ee1320b6c5ad6ee2c4bd9a upstream.
+
+Some AMD GPUs have built-in USB xHCI and USB Type-C UCSI controllers with
+power dependencies between the GPU and the other functions as in
+6d2e369f0d4c ("PCI: Add NVIDIA GPU multi-function power dependencies").
+
+Add device link support for the AMD integrated USB xHCI and USB Type-C UCSI
+controllers.
+
+Without this, runtime power management, including GPU resume and temp and
+fan sensors don't work correctly.
+
+Reported-at: https://gitlab.freedesktop.org/drm/amd/-/issues/1704
+Link: https://lore.kernel.org/r/20210903063311.3606226-1-evan.quan@amd.com
+Signed-off-by: Evan Quan <evan.quan@amd.com>
+Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/pci/quirks.c |    9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+--- a/drivers/pci/quirks.c
++++ b/drivers/pci/quirks.c
+@@ -5350,7 +5350,7 @@ DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR
+                             PCI_CLASS_MULTIMEDIA_HD_AUDIO, 8, quirk_gpu_hda);
+ /*
+- * Create device link for NVIDIA GPU with integrated USB xHCI Host
++ * Create device link for GPUs with integrated USB xHCI Host
+  * controller to VGA.
+  */
+ static void quirk_gpu_usb(struct pci_dev *usb)
+@@ -5359,9 +5359,11 @@ static void quirk_gpu_usb(struct pci_dev
+ }
+ DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID,
+                             PCI_CLASS_SERIAL_USB, 8, quirk_gpu_usb);
++DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_ATI, PCI_ANY_ID,
++                            PCI_CLASS_SERIAL_USB, 8, quirk_gpu_usb);
+ /*
+- * Create device link for NVIDIA GPU with integrated Type-C UCSI controller
++ * Create device link for GPUs with integrated Type-C UCSI controller
+  * to VGA. Currently there is no class code defined for UCSI device over PCI
+  * so using UNKNOWN class for now and it will be updated when UCSI
+  * over PCI gets a class code.
+@@ -5374,6 +5376,9 @@ static void quirk_gpu_usb_typec_ucsi(str
+ DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID,
+                             PCI_CLASS_SERIAL_UNKNOWN, 8,
+                             quirk_gpu_usb_typec_ucsi);
++DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_ATI, PCI_ANY_ID,
++                            PCI_CLASS_SERIAL_UNKNOWN, 8,
++                            quirk_gpu_usb_typec_ucsi);
+ /*
+  * Enable the NVIDIA GPU integrated HDA controller if the BIOS left it
diff --git a/queue-5.14/pm-base-power-don-t-try-to-use-non-existing-rtc-for-storing-data.patch b/queue-5.14/pm-base-power-don-t-try-to-use-non-existing-rtc-for-storing-data.patch
new file mode 100644 (file)
index 0000000..73e8420
--- /dev/null
@@ -0,0 +1,62 @@
+From 0560204b360a332c321124dbc5cdfd3364533a74 Mon Sep 17 00:00:00 2001
+From: Juergen Gross <jgross@suse.com>
+Date: Fri, 3 Sep 2021 10:49:36 +0200
+Subject: PM: base: power: don't try to use non-existing RTC for storing data
+
+From: Juergen Gross <jgross@suse.com>
+
+commit 0560204b360a332c321124dbc5cdfd3364533a74 upstream.
+
+If there is no legacy RTC device, don't try to use it for storing trace
+data across suspend/resume.
+
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Juergen Gross <jgross@suse.com>
+Reviewed-by: Rafael J. Wysocki <rafael@kernel.org>
+Link: https://lore.kernel.org/r/20210903084937.19392-2-jgross@suse.com
+Signed-off-by: Juergen Gross <jgross@suse.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/base/power/trace.c |   10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+--- a/drivers/base/power/trace.c
++++ b/drivers/base/power/trace.c
+@@ -13,6 +13,7 @@
+ #include <linux/export.h>
+ #include <linux/rtc.h>
+ #include <linux/suspend.h>
++#include <linux/init.h>
+ #include <linux/mc146818rtc.h>
+@@ -165,6 +166,9 @@ void generate_pm_trace(const void *trace
+       const char *file = *(const char **)(tracedata + 2);
+       unsigned int user_hash_value, file_hash_value;
++      if (!x86_platform.legacy.rtc)
++              return;
++
+       user_hash_value = user % USERHASH;
+       file_hash_value = hash_string(lineno, file, FILEHASH);
+       set_magic_time(user_hash_value, file_hash_value, dev_hash_value);
+@@ -267,6 +271,9 @@ static struct notifier_block pm_trace_nb
+ static int __init early_resume_init(void)
+ {
++      if (!x86_platform.legacy.rtc)
++              return 0;
++
+       hash_value_early_read = read_magic_time();
+       register_pm_notifier(&pm_trace_nb);
+       return 0;
+@@ -277,6 +284,9 @@ static int __init late_resume_init(void)
+       unsigned int val = hash_value_early_read;
+       unsigned int user, file, dev;
++      if (!x86_platform.legacy.rtc)
++              return 0;
++
+       user = val % USERHASH;
+       val = val / USERHASH;
+       file = val % FILEHASH;
diff --git a/queue-5.14/series b/queue-5.14/series
new file mode 100644 (file)
index 0000000..b55d0cb
--- /dev/null
@@ -0,0 +1,21 @@
+io_uring-ensure-symmetry-in-handling-iter-types-in-loop_rw_iter.patch
+swiotlb-xen-avoid-double-free.patch
+swiotlb-xen-fix-late-init-retry.patch
+xen-reset-legacy-rtc-flag-for-pv-domu.patch
+xen-fix-usage-of-pmd_populate-in-mremap-for-pv-guests.patch
+bnx2x-fix-enabling-network-interfaces-without-vfs.patch
+arm64-sve-use-correct-size-when-reinitialising-sve-state.patch
+pm-base-power-don-t-try-to-use-non-existing-rtc-for-storing-data.patch
+pci-add-amd-gpu-multi-function-power-dependencies.patch
+drm-amd-display-get-backlight-from-pwm-if-dmcu-is-not-initialized.patch
+drm-amd-display-dsc-mst-2-4k-displays-go-dark-with-2-lane-hbr3.patch
+drm-amd-display-fix-white-screen-page-fault-for-gpuvm.patch
+drm-amd-pm-fix-runpm-hang-when-amdgpu-loaded-prior-to-sound-driver.patch
+drm-amd-amdgpu-increase-hwip_max_instance-to-10.patch
+drm-amdgpu-use-is_err-for-debugfs-apis.patch
+drm-amdgpu-fix-use-after-free-during-bo-move.patch
+drm-amdgpu-add-amdgpu_amdkfd_resume_iommu.patch
+drm-amdgpu-move-iommu_resume-before-ip-init-resume.patch
+drm-amd-pm-fix-the-issue-of-uploading-powerplay-table.patch
+drm-amdkfd-separate-kfd_iommu_resume-from-kfd_resume.patch
+drm-radeon-pass-drm-dev-radeon_agp_head_init-directly.patch
diff --git a/queue-5.14/swiotlb-xen-avoid-double-free.patch b/queue-5.14/swiotlb-xen-avoid-double-free.patch
new file mode 100644 (file)
index 0000000..51a18d6
--- /dev/null
@@ -0,0 +1,34 @@
+From ce6a80d1b2f923b1839655a1cda786293feaa085 Mon Sep 17 00:00:00 2001
+From: Jan Beulich <jbeulich@suse.com>
+Date: Tue, 7 Sep 2021 14:04:25 +0200
+Subject: swiotlb-xen: avoid double free
+
+From: Jan Beulich <jbeulich@suse.com>
+
+commit ce6a80d1b2f923b1839655a1cda786293feaa085 upstream.
+
+Of the two paths leading to the "error" label in xen_swiotlb_init() one
+didn't allocate anything, while the other did already free what was
+allocated.
+
+Fixes: b82776005369 ("xen/swiotlb: Use the swiotlb_late_init_with_tbl to init Xen-SWIOTLB late when PV PCI is used")
+Signed-off-by: Jan Beulich <jbeulich@suse.com>
+Cc: stable@vger.kernel.org
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Link: https://lore.kernel.org/r/ce9c2adb-8a52-6293-982a-0d6ece943ac6@suse.com
+Signed-off-by: Juergen Gross <jgross@suse.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/xen/swiotlb-xen.c |    1 -
+ 1 file changed, 1 deletion(-)
+
+--- a/drivers/xen/swiotlb-xen.c
++++ b/drivers/xen/swiotlb-xen.c
+@@ -216,7 +216,6 @@ error:
+               goto retry;
+       }
+       pr_err("%s (rc:%d)\n", xen_swiotlb_error(m_ret), rc);
+-      free_pages((unsigned long)start, order);
+       return rc;
+ }
diff --git a/queue-5.14/swiotlb-xen-fix-late-init-retry.patch b/queue-5.14/swiotlb-xen-fix-late-init-retry.patch
new file mode 100644 (file)
index 0000000..b00287d
--- /dev/null
@@ -0,0 +1,39 @@
+From 4c092c59015f7adf0f07685f869edb96d997a756 Mon Sep 17 00:00:00 2001
+From: Jan Beulich <jbeulich@suse.com>
+Date: Tue, 7 Sep 2021 14:04:47 +0200
+Subject: swiotlb-xen: fix late init retry
+
+From: Jan Beulich <jbeulich@suse.com>
+
+commit 4c092c59015f7adf0f07685f869edb96d997a756 upstream.
+
+The commit referenced below removed the assignment of "bytes" from
+xen_swiotlb_init() without - like done for xen_swiotlb_init_early() -
+adding an assignment on the retry path, thus leading to excessively
+sized allocations upon retries.
+
+Fixes: 2d29960af0be ("swiotlb: dynamically allocate io_tlb_default_mem")
+Signed-off-by: Jan Beulich <jbeulich@suse.com>
+Cc: stable@vger.kernel.org
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+Link: https://lore.kernel.org/r/778299d6-9cfd-1c13-026e-25ee5d14ecb3@suse.com
+Signed-off-by: Juergen Gross <jgross@suse.com>
+---
+ drivers/xen/swiotlb-xen.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/xen/swiotlb-xen.c
++++ b/drivers/xen/swiotlb-xen.c
+@@ -211,8 +211,8 @@ error:
+       if (repeat--) {
+               /* Min is 2MB */
+               nslabs = max(1024UL, (nslabs >> 1));
+-              pr_info("Lowering to %luMB\n",
+-                      (nslabs << IO_TLB_SHIFT) >> 20);
++              bytes = nslabs << IO_TLB_SHIFT;
++              pr_info("Lowering to %luMB\n", bytes >> 20);
+               goto retry;
+       }
+       pr_err("%s (rc:%d)\n", xen_swiotlb_error(m_ret), rc);
diff --git a/queue-5.14/xen-fix-usage-of-pmd_populate-in-mremap-for-pv-guests.patch b/queue-5.14/xen-fix-usage-of-pmd_populate-in-mremap-for-pv-guests.patch
new file mode 100644 (file)
index 0000000..69057fd
--- /dev/null
@@ -0,0 +1,89 @@
+From 36c9b5929b7094ea19a78827c0ede20d2e0e6c9c Mon Sep 17 00:00:00 2001
+From: Juergen Gross <jgross@suse.com>
+Date: Wed, 8 Sep 2021 09:36:40 +0200
+Subject: xen: fix usage of pmd_populate in mremap for pv guests
+
+From: Juergen Gross <jgross@suse.com>
+
+commit 36c9b5929b7094ea19a78827c0ede20d2e0e6c9c upstream.
+
+Commit 0881ace292b662 ("mm/mremap: use pmd/pud_poplulate to update page
+table entries") introduced a regression when running as Xen PV guest.
+
+Today pmd_populate() for Xen PV assumes that the PFN inserted is
+referencing a not yet used page table. In case of move_normal_pmd()
+this is not true, resulting in WARN splats like:
+
+[34321.304270] ------------[ cut here ]------------
+[34321.304277] WARNING: CPU: 0 PID: 23628 at arch/x86/xen/multicalls.c:102 xen_mc_flush+0x176/0x1a0
+[34321.304288] Modules linked in:
+[34321.304291] CPU: 0 PID: 23628 Comm: apt-get Not tainted 5.14.1-20210906-doflr-mac80211debug+ #1
+[34321.304294] Hardware name: MSI MS-7640/890FXA-GD70 (MS-7640)  , BIOS V1.8B1 09/13/2010
+[34321.304296] RIP: e030:xen_mc_flush+0x176/0x1a0
+[34321.304300] Code: 89 45 18 48 c1 e9 3f 48 89 ce e9 20 ff ff ff e8 60 03 00 00 66 90 5b 5d 41 5c 41 5d c3 48 c7 45 18 ea ff ff ff be 01 00 00 00 <0f> 0b 8b 55 00 48 c7 c7 10 97 aa 82 31 db 49 c7 c5 38 97 aa 82 65
+[34321.304303] RSP: e02b:ffffc90000a97c90 EFLAGS: 00010002
+[34321.304305] RAX: ffff88807d416398 RBX: ffff88807d416350 RCX: ffff88807d416398
+[34321.304306] RDX: 0000000000000001 RSI: 0000000000000001 RDI: deadbeefdeadf00d
+[34321.304308] RBP: ffff88807d416300 R08: aaaaaaaaaaaaaaaa R09: ffff888006160cc0
+[34321.304309] R10: deadbeefdeadf00d R11: ffffea000026a600 R12: 0000000000000000
+[34321.304310] R13: ffff888012f6b000 R14: 0000000012f6b000 R15: 0000000000000001
+[34321.304320] FS:  00007f5071177800(0000) GS:ffff88807d400000(0000) knlGS:0000000000000000
+[34321.304322] CS:  10000e030 DS: 0000 ES: 0000 CR0: 0000000080050033
+[34321.304323] CR2: 00007f506f542000 CR3: 00000000160cc000 CR4: 0000000000000660
+[34321.304326] Call Trace:
+[34321.304331]  xen_alloc_pte+0x294/0x320
+[34321.304334]  move_pgt_entry+0x165/0x4b0
+[34321.304339]  move_page_tables+0x6fa/0x8d0
+[34321.304342]  move_vma.isra.44+0x138/0x500
+[34321.304345]  __x64_sys_mremap+0x296/0x410
+[34321.304348]  do_syscall_64+0x3a/0x80
+[34321.304352]  entry_SYSCALL_64_after_hwframe+0x44/0xae
+[34321.304355] RIP: 0033:0x7f507196301a
+[34321.304358] Code: 73 01 c3 48 8b 0d 76 0e 0c 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 49 89 ca b8 19 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 46 0e 0c 00 f7 d8 64 89 01 48
+[34321.304360] RSP: 002b:00007ffda1eecd38 EFLAGS: 00000246 ORIG_RAX: 0000000000000019
+[34321.304362] RAX: ffffffffffffffda RBX: 000056205f950f30 RCX: 00007f507196301a
+[34321.304363] RDX: 0000000001a00000 RSI: 0000000001900000 RDI: 00007f506dc56000
+[34321.304364] RBP: 0000000001a00000 R08: 0000000000000010 R09: 0000000000000004
+[34321.304365] R10: 0000000000000001 R11: 0000000000000246 R12: 00007f506dc56060
+[34321.304367] R13: 00007f506dc56000 R14: 00007f506dc56060 R15: 000056205f950f30
+[34321.304368] ---[ end trace a19885b78fe8f33e ]---
+[34321.304370] 1 of 2 multicall(s) failed: cpu 0
+[34321.304371]   call  2: op=12297829382473034410 arg=[aaaaaaaaaaaaaaaa] result=-22
+
+Fix that by modifying xen_alloc_ptpage() to only pin the page table in
+case it wasn't pinned already.
+
+Fixes: 0881ace292b662 ("mm/mremap: use pmd/pud_poplulate to update page table entries")
+Cc: <stable@vger.kernel.org>
+Reported-by: Sander Eikelenboom <linux@eikelenboom.it>
+Tested-by: Sander Eikelenboom <linux@eikelenboom.it>
+Signed-off-by: Juergen Gross <jgross@suse.com>
+Link: https://lore.kernel.org/r/20210908073640.11299-1-jgross@suse.com
+Signed-off-by: Juergen Gross <jgross@suse.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/xen/mmu_pv.c |    7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+--- a/arch/x86/xen/mmu_pv.c
++++ b/arch/x86/xen/mmu_pv.c
+@@ -1518,14 +1518,17 @@ static inline void xen_alloc_ptpage(stru
+       if (pinned) {
+               struct page *page = pfn_to_page(pfn);
+-              if (static_branch_likely(&xen_struct_pages_ready))
++              pinned = false;
++              if (static_branch_likely(&xen_struct_pages_ready)) {
++                      pinned = PagePinned(page);
+                       SetPagePinned(page);
++              }
+               xen_mc_batch();
+               __set_pfn_prot(pfn, PAGE_KERNEL_RO);
+-              if (level == PT_PTE && USE_SPLIT_PTE_PTLOCKS)
++              if (level == PT_PTE && USE_SPLIT_PTE_PTLOCKS && !pinned)
+                       __pin_pagetable_pfn(MMUEXT_PIN_L1_TABLE, pfn);
+               xen_mc_issue(PARAVIRT_LAZY_MMU);
diff --git a/queue-5.14/xen-reset-legacy-rtc-flag-for-pv-domu.patch b/queue-5.14/xen-reset-legacy-rtc-flag-for-pv-domu.patch
new file mode 100644 (file)
index 0000000..8736e3e
--- /dev/null
@@ -0,0 +1,71 @@
+From f68aa100d815b5b4467fd1c3abbe3b99d65fd028 Mon Sep 17 00:00:00 2001
+From: Juergen Gross <jgross@suse.com>
+Date: Fri, 3 Sep 2021 10:49:37 +0200
+Subject: xen: reset legacy rtc flag for PV domU
+
+From: Juergen Gross <jgross@suse.com>
+
+commit f68aa100d815b5b4467fd1c3abbe3b99d65fd028 upstream.
+
+A Xen PV guest doesn't have a legacy RTC device, so reset the legacy
+RTC flag. Otherwise the following WARN splat will occur at boot:
+
+[    1.333404] WARNING: CPU: 1 PID: 1 at /home/gross/linux/head/drivers/rtc/rtc-mc146818-lib.c:25 mc146818_get_time+0x1be/0x210
+[    1.333404] Modules linked in:
+[    1.333404] CPU: 1 PID: 1 Comm: swapper/0 Tainted: G        W         5.14.0-rc7-default+ #282
+[    1.333404] RIP: e030:mc146818_get_time+0x1be/0x210
+[    1.333404] Code: c0 64 01 c5 83 fd 45 89 6b 14 7f 06 83 c5 64 89 6b 14 41 83 ec 01 b8 02 00 00 00 44 89 63 10 5b 5d 41 5c 41 5d 41 5e 41 5f c3 <0f> 0b 48 c7 c7 30 0e ef 82 4c 89 e6 e8 71 2a 24 00 48 c7 c0 ff ff
+[    1.333404] RSP: e02b:ffffc90040093df8 EFLAGS: 00010002
+[    1.333404] RAX: 00000000000000ff RBX: ffffc90040093e34 RCX: 0000000000000000
+[    1.333404] RDX: 0000000000000001 RSI: 0000000000000000 RDI: 000000000000000d
+[    1.333404] RBP: ffffffff82ef0e30 R08: ffff888005013e60 R09: 0000000000000000
+[    1.333404] R10: ffffffff82373e9b R11: 0000000000033080 R12: 0000000000000200
+[    1.333404] R13: 0000000000000000 R14: 0000000000000002 R15: ffffffff82cdc6d4
+[    1.333404] FS:  0000000000000000(0000) GS:ffff88807d440000(0000) knlGS:0000000000000000
+[    1.333404] CS:  10000e030 DS: 0000 ES: 0000 CR0: 0000000080050033
+[    1.333404] CR2: 0000000000000000 CR3: 000000000260a000 CR4: 0000000000050660
+[    1.333404] Call Trace:
+[    1.333404]  ? wakeup_sources_sysfs_init+0x30/0x30
+[    1.333404]  ? rdinit_setup+0x2b/0x2b
+[    1.333404]  early_resume_init+0x23/0xa4
+[    1.333404]  ? cn_proc_init+0x36/0x36
+[    1.333404]  do_one_initcall+0x3e/0x200
+[    1.333404]  kernel_init_freeable+0x232/0x28e
+[    1.333404]  ? rest_init+0xd0/0xd0
+[    1.333404]  kernel_init+0x16/0x120
+[    1.333404]  ret_from_fork+0x1f/0x30
+
+Cc: <stable@vger.kernel.org>
+Fixes: 8d152e7a5c7537 ("x86/rtc: Replace paravirt rtc check with platform legacy quirk")
+Signed-off-by: Juergen Gross <jgross@suse.com>
+Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
+Link: https://lore.kernel.org/r/20210903084937.19392-3-jgross@suse.com
+Signed-off-by: Juergen Gross <jgross@suse.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/xen/enlighten_pv.c |    7 +++++++
+ 1 file changed, 7 insertions(+)
+
+--- a/arch/x86/xen/enlighten_pv.c
++++ b/arch/x86/xen/enlighten_pv.c
+@@ -1215,6 +1215,11 @@ static void __init xen_dom0_set_legacy_f
+       x86_platform.legacy.rtc = 1;
+ }
++static void __init xen_domu_set_legacy_features(void)
++{
++      x86_platform.legacy.rtc = 0;
++}
++
+ /* First C function to be called on Xen boot */
+ asmlinkage __visible void __init xen_start_kernel(void)
+ {
+@@ -1367,6 +1372,8 @@ asmlinkage __visible void __init xen_sta
+               add_preferred_console("xenboot", 0, NULL);
+               if (pci_xen)
+                       x86_init.pci.arch_init = pci_xen_init;
++              x86_platform.set_legacy_features =
++                              xen_domu_set_legacy_features;
+       } else {
+               const struct dom0_vga_console_info *info =
+                       (void *)((char *)xen_start_info +