From 5aa05eb5c4f33f4503b35c2983793a8d090f846c Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sat, 15 Apr 2023 20:42:34 +0200 Subject: [PATCH] 6.1-stable patches added patches: drm-i915-dsi-fix-dss-ctl-register-offsets-for-tgl.patch fbcon-fix-error-paths-in-set_con2fb_map.patch fbcon-set_con2fb_map-needs-to-set-con2fb_map.patch kvm-arm64-pmu-restore-the-guest-s-el0-event-counting-after-migration.patch --- ...fix-dss-ctl-register-offsets-for-tgl.patch | 76 +++++++++++++++ ...on-fix-error-paths-in-set_con2fb_map.patch | 95 +++++++++++++++++++ ...t_con2fb_map-needs-to-set-con2fb_map.patch | 54 +++++++++++ ...s-el0-event-counting-after-migration.patch | 57 +++++++++++ queue-6.1/series | 4 + 5 files changed, 286 insertions(+) create mode 100644 queue-6.1/drm-i915-dsi-fix-dss-ctl-register-offsets-for-tgl.patch create mode 100644 queue-6.1/fbcon-fix-error-paths-in-set_con2fb_map.patch create mode 100644 queue-6.1/fbcon-set_con2fb_map-needs-to-set-con2fb_map.patch create mode 100644 queue-6.1/kvm-arm64-pmu-restore-the-guest-s-el0-event-counting-after-migration.patch diff --git a/queue-6.1/drm-i915-dsi-fix-dss-ctl-register-offsets-for-tgl.patch b/queue-6.1/drm-i915-dsi-fix-dss-ctl-register-offsets-for-tgl.patch new file mode 100644 index 00000000000..be63f7c4141 --- /dev/null +++ b/queue-6.1/drm-i915-dsi-fix-dss-ctl-register-offsets-for-tgl.patch @@ -0,0 +1,76 @@ +From 6b8446859c971a5783a2cdc90adf32e64de3bd23 Mon Sep 17 00:00:00 2001 +From: Jani Nikula +Date: Wed, 1 Mar 2023 17:14:09 +0200 +Subject: drm/i915/dsi: fix DSS CTL register offsets for TGL+ +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Jani Nikula + +commit 6b8446859c971a5783a2cdc90adf32e64de3bd23 upstream. + +On TGL+ the DSS control registers are at different offsets, and there's +one per pipe. Fix the offsets to fix dual link DSI for TGL+. + +There would be helpers for this in the DSC code, but just do the quick +fix now for DSI. Long term, we should probably move all the DSS handling +into intel_vdsc.c, so exporting the helpers seems counter-productive. + +Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/8232 +Cc: Ville Syrjala +Cc: stable@vger.kernel.org +Signed-off-by: Jani Nikula +Reviewed-by: Ville Syrjälä +Link: https://patchwork.freedesktop.org/patch/msgid/20230301151409.1581574-1-jani.nikula@intel.com +(cherry picked from commit 1a62dd9895dca78bee28bba3a36f08836fdd143d) +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/i915/display/icl_dsi.c | 20 ++++++++++++++++---- + 1 file changed, 16 insertions(+), 4 deletions(-) + +--- a/drivers/gpu/drm/i915/display/icl_dsi.c ++++ b/drivers/gpu/drm/i915/display/icl_dsi.c +@@ -299,9 +299,21 @@ static void configure_dual_link_mode(str + { + struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); + struct intel_dsi *intel_dsi = enc_to_intel_dsi(encoder); ++ i915_reg_t dss_ctl1_reg, dss_ctl2_reg; + u32 dss_ctl1; + +- dss_ctl1 = intel_de_read(dev_priv, DSS_CTL1); ++ /* FIXME: Move all DSS handling to intel_vdsc.c */ ++ if (DISPLAY_VER(dev_priv) >= 12) { ++ struct intel_crtc *crtc = to_intel_crtc(pipe_config->uapi.crtc); ++ ++ dss_ctl1_reg = ICL_PIPE_DSS_CTL1(crtc->pipe); ++ dss_ctl2_reg = ICL_PIPE_DSS_CTL2(crtc->pipe); ++ } else { ++ dss_ctl1_reg = DSS_CTL1; ++ dss_ctl2_reg = DSS_CTL2; ++ } ++ ++ dss_ctl1 = intel_de_read(dev_priv, dss_ctl1_reg); + dss_ctl1 |= SPLITTER_ENABLE; + dss_ctl1 &= ~OVERLAP_PIXELS_MASK; + dss_ctl1 |= OVERLAP_PIXELS(intel_dsi->pixel_overlap); +@@ -322,16 +334,16 @@ static void configure_dual_link_mode(str + + dss_ctl1 &= ~LEFT_DL_BUF_TARGET_DEPTH_MASK; + dss_ctl1 |= LEFT_DL_BUF_TARGET_DEPTH(dl_buffer_depth); +- dss_ctl2 = intel_de_read(dev_priv, DSS_CTL2); ++ dss_ctl2 = intel_de_read(dev_priv, dss_ctl2_reg); + dss_ctl2 &= ~RIGHT_DL_BUF_TARGET_DEPTH_MASK; + dss_ctl2 |= RIGHT_DL_BUF_TARGET_DEPTH(dl_buffer_depth); +- intel_de_write(dev_priv, DSS_CTL2, dss_ctl2); ++ intel_de_write(dev_priv, dss_ctl2_reg, dss_ctl2); + } else { + /* Interleave */ + dss_ctl1 |= DUAL_LINK_MODE_INTERLEAVE; + } + +- intel_de_write(dev_priv, DSS_CTL1, dss_ctl1); ++ intel_de_write(dev_priv, dss_ctl1_reg, dss_ctl1); + } + + /* aka DSI 8X clock */ diff --git a/queue-6.1/fbcon-fix-error-paths-in-set_con2fb_map.patch b/queue-6.1/fbcon-fix-error-paths-in-set_con2fb_map.patch new file mode 100644 index 00000000000..40698444a91 --- /dev/null +++ b/queue-6.1/fbcon-fix-error-paths-in-set_con2fb_map.patch @@ -0,0 +1,95 @@ +From edf79dd2172233452ff142dcc98b19d955fc8974 Mon Sep 17 00:00:00 2001 +From: Daniel Vetter +Date: Wed, 12 Apr 2023 17:23:49 +0200 +Subject: fbcon: Fix error paths in set_con2fb_map + +From: Daniel Vetter + +commit edf79dd2172233452ff142dcc98b19d955fc8974 upstream. + +This is a regressoin introduced in b07db3958485 ("fbcon: Ditch error +handling for con2fb_release_oldinfo"). I failed to realize what the if +(!err) checks. The mentioned commit was dropping the +con2fb_release_oldinfo() return value but the if (!err) was also +checking whether the con2fb_acquire_newinfo() function call above +failed or not. + +Fix this with an early return statement. + +Note that there's still a difference compared to the orginal state of +the code, the below lines are now also skipped on error: + + if (!search_fb_in_map(info_idx)) + info_idx = newidx; + +These are only needed when we've actually thrown out an old fb_info +from the console mappings, which only happens later on. + +Also move the fbcon_add_cursor_work() call into the same if block, +it's all protected by console_lock so doesn't matter when we set up +the blinking cursor delayed work anyway. This further simplifies the +control flow and allows us to ditch the found local variable. + +v2: Clarify commit message (Javier) + +Signed-off-by: Daniel Vetter +Reviewed-by: Javier Martinez Canillas +Acked-by: Helge Deller +Tested-by: Xingyuan Mo +Fixes: b07db3958485 ("fbcon: Ditch error handling for con2fb_release_oldinfo") +Cc: Thomas Zimmermann +Cc: Sam Ravnborg +Cc: Xingyuan Mo +Cc: Thomas Zimmermann +Cc: Helge Deller +Cc: # v5.19+ +Signed-off-by: Greg Kroah-Hartman +--- + drivers/video/fbdev/core/fbcon.c | 17 ++++++++--------- + 1 file changed, 8 insertions(+), 9 deletions(-) + +--- a/drivers/video/fbdev/core/fbcon.c ++++ b/drivers/video/fbdev/core/fbcon.c +@@ -823,7 +823,7 @@ static int set_con2fb_map(int unit, int + int oldidx = con2fb_map[unit]; + struct fb_info *info = fbcon_registered_fb[newidx]; + struct fb_info *oldinfo = NULL; +- int found, err = 0, show_logo; ++ int err = 0, show_logo; + + WARN_CONSOLE_UNLOCKED(); + +@@ -841,26 +841,25 @@ static int set_con2fb_map(int unit, int + if (oldidx != -1) + oldinfo = fbcon_registered_fb[oldidx]; + +- found = search_fb_in_map(newidx); +- +- if (!err && !found) { ++ if (!search_fb_in_map(newidx)) { + err = con2fb_acquire_newinfo(vc, info, unit); +- if (!err) +- con2fb_map[unit] = newidx; ++ if (err) ++ return err; ++ ++ con2fb_map[unit] = newidx; ++ fbcon_add_cursor_work(info); + } + + /* + * If old fb is not mapped to any of the consoles, + * fbcon should release it. + */ +- if (!err && oldinfo && !search_fb_in_map(oldidx)) ++ if (oldinfo && !search_fb_in_map(oldidx)) + con2fb_release_oldinfo(vc, oldinfo, info); + + show_logo = (fg_console == 0 && !user && + logo_shown != FBCON_LOGO_DONTSHOW); + +- if (!found) +- fbcon_add_cursor_work(info); + con2fb_map_boot[unit] = newidx; + con2fb_init_display(vc, info, unit, show_logo); + diff --git a/queue-6.1/fbcon-set_con2fb_map-needs-to-set-con2fb_map.patch b/queue-6.1/fbcon-set_con2fb_map-needs-to-set-con2fb_map.patch new file mode 100644 index 00000000000..ce06af7b4bb --- /dev/null +++ b/queue-6.1/fbcon-set_con2fb_map-needs-to-set-con2fb_map.patch @@ -0,0 +1,54 @@ +From fffb0b52d5258554c645c966c6cbef7de50b851d Mon Sep 17 00:00:00 2001 +From: Daniel Vetter +Date: Wed, 12 Apr 2023 17:31:46 +0200 +Subject: fbcon: set_con2fb_map needs to set con2fb_map! + +From: Daniel Vetter + +commit fffb0b52d5258554c645c966c6cbef7de50b851d upstream. + +I got really badly confused in d443d9386472 ("fbcon: move more common +code into fb_open()") because we set the con2fb_map before the failure +points, which didn't look good. + +But in trying to fix that I moved the assignment into the wrong path - +we need to do it for _all_ vc we take over, not just the first one +(which additionally requires the call to con2fb_acquire_newinfo). + +I've figured this out because of a KASAN bug report, where the +fbcon_registered_fb and fbcon_display arrays went out of sync in +fbcon_mode_deleted() because the con2fb_map pointed at the old +fb_info, but the modes and everything was updated for the new one. + +Signed-off-by: Daniel Vetter +Reviewed-by: Javier Martinez Canillas +Acked-by: Helge Deller +Tested-by: Xingyuan Mo +Fixes: d443d9386472 ("fbcon: move more common code into fb_open()") +Reported-by: Xingyuan Mo +Cc: Thomas Zimmermann +Cc: Sam Ravnborg +Cc: Xingyuan Mo +Cc: Thomas Zimmermann +Cc: Helge Deller +Cc: # v5.19+ +Signed-off-by: Greg Kroah-Hartman +--- + drivers/video/fbdev/core/fbcon.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/video/fbdev/core/fbcon.c ++++ b/drivers/video/fbdev/core/fbcon.c +@@ -846,10 +846,11 @@ static int set_con2fb_map(int unit, int + if (err) + return err; + +- con2fb_map[unit] = newidx; + fbcon_add_cursor_work(info); + } + ++ con2fb_map[unit] = newidx; ++ + /* + * If old fb is not mapped to any of the consoles, + * fbcon should release it. diff --git a/queue-6.1/kvm-arm64-pmu-restore-the-guest-s-el0-event-counting-after-migration.patch b/queue-6.1/kvm-arm64-pmu-restore-the-guest-s-el0-event-counting-after-migration.patch new file mode 100644 index 00000000000..350348239ae --- /dev/null +++ b/queue-6.1/kvm-arm64-pmu-restore-the-guest-s-el0-event-counting-after-migration.patch @@ -0,0 +1,57 @@ +From f9ea835e99bc8d049bf2a3ec8fa5a7cb4fcade23 Mon Sep 17 00:00:00 2001 +From: Reiji Watanabe +Date: Tue, 28 Mar 2023 19:39:44 -0700 +Subject: KVM: arm64: PMU: Restore the guest's EL0 event counting after migration + +From: Reiji Watanabe + +commit f9ea835e99bc8d049bf2a3ec8fa5a7cb4fcade23 upstream. + +Currently, with VHE, KVM enables the EL0 event counting for the +guest on vcpu_load() or KVM enables it as a part of the PMU +register emulation process, when needed. However, in the migration +case (with VHE), the same handling is lacking, as vPMU register +values that were restored by userspace haven't been propagated yet +(the PMU events haven't been created) at the vcpu load-time on the +first KVM_RUN (kvm_vcpu_pmu_restore_guest() called from vcpu_load() +on the first KVM_RUN won't do anything as events_{guest,host} of +kvm_pmu_events are still zero). + +So, with VHE, enable the guest's EL0 event counting on the first +KVM_RUN (after the migration) when needed. More specifically, +have kvm_pmu_handle_pmcr() call kvm_vcpu_pmu_restore_guest() +so that kvm_pmu_handle_pmcr() on the first KVM_RUN can take +care of it. + +Fixes: d0c94c49792c ("KVM: arm64: Restore PMU configuration on first run") +Cc: stable@vger.kernel.org +Reviewed-by: Marc Zyngier +Signed-off-by: Reiji Watanabe +Link: https://lore.kernel.org/r/20230329023944.2488484-1-reijiw@google.com +Signed-off-by: Oliver Upton +Signed-off-by: Greg Kroah-Hartman +--- + arch/arm64/kvm/pmu-emul.c | 1 + + arch/arm64/kvm/sys_regs.c | 1 - + 2 files changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/arm64/kvm/pmu-emul.c ++++ b/arch/arm64/kvm/pmu-emul.c +@@ -531,6 +531,7 @@ void kvm_pmu_handle_pmcr(struct kvm_vcpu + for_each_set_bit(i, &mask, 32) + kvm_pmu_set_counter_value(vcpu, i, 0); + } ++ kvm_vcpu_pmu_restore_guest(vcpu); + } + + static bool kvm_pmu_counter_is_enabled(struct kvm_vcpu *vcpu, u64 select_idx) +--- a/arch/arm64/kvm/sys_regs.c ++++ b/arch/arm64/kvm/sys_regs.c +@@ -707,7 +707,6 @@ static bool access_pmcr(struct kvm_vcpu + if (!kvm_supports_32bit_el0()) + val |= ARMV8_PMU_PMCR_LC; + kvm_pmu_handle_pmcr(vcpu, val); +- kvm_vcpu_pmu_restore_guest(vcpu); + } else { + /* PMCR.P & PMCR.C are RAZ */ + val = __vcpu_sys_reg(vcpu, PMCR_EL0) diff --git a/queue-6.1/series b/queue-6.1/series index 862ad942724..f1575ab5fa9 100644 --- a/queue-6.1/series +++ b/queue-6.1/series @@ -21,3 +21,7 @@ mtdblock-tolerate-corrected-bit-flips.patch mtd-rawnand-meson-fix-bitmask-for-length-in-command-word.patch mtd-rawnand-stm32_fmc2-remove-unsupported-edo-mode.patch mtd-rawnand-stm32_fmc2-use-timings.mode-instead-of-checking-trc_min.patch +kvm-arm64-pmu-restore-the-guest-s-el0-event-counting-after-migration.patch +fbcon-fix-error-paths-in-set_con2fb_map.patch +fbcon-set_con2fb_map-needs-to-set-con2fb_map.patch +drm-i915-dsi-fix-dss-ctl-register-offsets-for-tgl.patch -- 2.47.3