Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'drm-intel-next-2020-08-24-1' of git://anongit.freedesktop.org/drm/drm-intel into drm-next

UAPI Changes:

- Introduce a mechanism to extend execbuf2 (Lionel)
- Add syncobj timeline support (Lionel)

Driver Changes:

- Limit stolen mem usage on the compressed frame buffer (Ville)
- Some clean-up around display's cdclk (Ville)
- Some DDI changes for better DP link training according
to spec (Imre)
- Provide the perf pmu.module (Chris)
- Remove dobious Valleyview PCI IDs (Alexei)
- Add new display power saving feature for gen12+ called
HOBL (Jose)
- Move SKL's clock gating w/a to skl_init_clock_gating() (Ville)
- Rocket Lake display additions (Matt)
- Selftest: temporarily downgrade on severity of frequency
scaling tests (Chris)
- Introduce a new display workaround for fixing FLR related
issues on new PCH. (Jose)
- Temporarily disable FBC on TGL. It was the culprit of random
underruns. (Uma).
- Copy default modparams to mock i915_device (Chris)
- Add compiler paranoia for checking HWSP values (Chris)
- Remove useless gen check before calling intel_rps_boost (Chris)
- Fix a null pointer dereference (Chris)
- Add a couple of missing i915_active_fini() (Chris)
- Update TGL display power's bw_buddy table according to
update spec (Matt)
- Fix couple wrong return values (Tianjia)
- Selftest: Avoid passing random 0 into ilog2 (George)
- Many Tiger Lake display fixes and improvements for Type-C and
DP compliance (Imre, Jose)
- Start the addition of PSR2 selective fetch (Jose)
- Update a few DMC and HuC firmware versions (Jose)
- Add gen11+ w/a to fix underuns (Matt)
- Fix cmd parser desc matching with mask (Mika)

Signed-off-by: Dave Airlie <airlied@redhat.com>

From: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200826232733.GA129053@intel.com

+952 -252
+6 -5
drivers/gpu/drm/i915/display/intel_cdclk.c
··· 2677 2677 */ 2678 2678 if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) 2679 2679 intel_de_write(dev_priv, GMBUSFREQ_VLV, 2680 - DIV_ROUND_UP(dev_priv->cdclk.hw.cdclk, 1000)); 2680 + DIV_ROUND_UP(dev_priv->cdclk.hw.cdclk, 1000)); 2681 2681 } 2682 2682 2683 2683 static int cnp_rawclk(struct drm_i915_private *dev_priv) ··· 2903 2903 dev_priv->display.get_cdclk = i85x_get_cdclk; 2904 2904 else if (IS_I845G(dev_priv)) 2905 2905 dev_priv->display.get_cdclk = fixed_200mhz_get_cdclk; 2906 - else { /* 830 */ 2907 - drm_WARN(&dev_priv->drm, !IS_I830(dev_priv), 2908 - "Unknown platform. Assuming 133 MHz CDCLK\n"); 2906 + else if (IS_I830(dev_priv)) 2909 2907 dev_priv->display.get_cdclk = fixed_133mhz_get_cdclk; 2910 - } 2908 + 2909 + if (drm_WARN(&dev_priv->drm, !dev_priv->display.get_cdclk, 2910 + "Unknown platform. Assuming 133 MHz CDCLK\n")) 2911 + dev_priv->display.get_cdclk = fixed_133mhz_get_cdclk; 2911 2912 }
+1 -1
drivers/gpu/drm/i915/display/intel_cdclk.h
··· 17 17 struct intel_crtc_state; 18 18 19 19 struct intel_cdclk_vals { 20 - u16 refclk; 21 20 u32 cdclk; 21 + u16 refclk; 22 22 u8 divider; /* CD2X divider * 2 */ 23 23 u8 ratio; 24 24 };
+4 -4
drivers/gpu/drm/i915/display/intel_csr.c
··· 40 40 41 41 #define GEN12_CSR_MAX_FW_SIZE ICL_CSR_MAX_FW_SIZE 42 42 43 - #define RKL_CSR_PATH "i915/rkl_dmc_ver2_01.bin" 44 - #define RKL_CSR_VERSION_REQUIRED CSR_VERSION(2, 1) 43 + #define RKL_CSR_PATH "i915/rkl_dmc_ver2_02.bin" 44 + #define RKL_CSR_VERSION_REQUIRED CSR_VERSION(2, 2) 45 45 MODULE_FIRMWARE(RKL_CSR_PATH); 46 46 47 - #define TGL_CSR_PATH "i915/tgl_dmc_ver2_06.bin" 48 - #define TGL_CSR_VERSION_REQUIRED CSR_VERSION(2, 6) 47 + #define TGL_CSR_PATH "i915/tgl_dmc_ver2_08.bin" 48 + #define TGL_CSR_VERSION_REQUIRED CSR_VERSION(2, 8) 49 49 #define TGL_CSR_MAX_FW_SIZE 0x6000 50 50 MODULE_FIRMWARE(TGL_CSR_PATH); 51 51
+97 -14
drivers/gpu/drm/i915/display/intel_ddi.c
··· 706 706 { 0x6, 0x7F, 0x3F, 0x00, 0x00 }, /* 900 900 0.0 */ 707 707 }; 708 708 709 + static const struct cnl_ddi_buf_trans tgl_uy_combo_phy_ddi_translations_dp_hbr2[] = { 710 + /* NT mV Trans mV db */ 711 + { 0xA, 0x35, 0x3F, 0x00, 0x00 }, /* 350 350 0.0 */ 712 + { 0xA, 0x4F, 0x36, 0x00, 0x09 }, /* 350 500 3.1 */ 713 + { 0xC, 0x60, 0x32, 0x00, 0x0D }, /* 350 700 6.0 */ 714 + { 0xC, 0x7F, 0x2D, 0x00, 0x12 }, /* 350 900 8.2 */ 715 + { 0xC, 0x47, 0x3F, 0x00, 0x00 }, /* 500 500 0.0 */ 716 + { 0xC, 0x6F, 0x36, 0x00, 0x09 }, /* 500 700 2.9 */ 717 + { 0x6, 0x7D, 0x32, 0x00, 0x0D }, /* 500 900 5.1 */ 718 + { 0x6, 0x60, 0x3C, 0x00, 0x03 }, /* 650 700 0.6 */ 719 + { 0x6, 0x7F, 0x34, 0x00, 0x0B }, /* 600 900 3.5 */ 720 + { 0x6, 0x7F, 0x3F, 0x00, 0x00 }, /* 900 900 0.0 */ 721 + }; 722 + 723 + /* 724 + * Cloned the HOBL entry to comply with the voltage and pre-emphasis entries 725 + * that DisplayPort specification requires 726 + */ 727 + static const struct cnl_ddi_buf_trans tgl_combo_phy_ddi_translations_edp_hbr2_hobl[] = { 728 + /* VS pre-emp */ 729 + { 0x6, 0x7F, 0x3F, 0x00, 0x00 }, /* 0 0 */ 730 + { 0x6, 0x7F, 0x3F, 0x00, 0x00 }, /* 0 1 */ 731 + { 0x6, 0x7F, 0x3F, 0x00, 0x00 }, /* 0 2 */ 732 + { 0x6, 0x7F, 0x3F, 0x00, 0x00 }, /* 0 3 */ 733 + { 0x6, 0x7F, 0x3F, 0x00, 0x00 }, /* 1 0 */ 734 + { 0x6, 0x7F, 0x3F, 0x00, 0x00 }, /* 1 1 */ 735 + { 0x6, 0x7F, 0x3F, 0x00, 0x00 }, /* 1 2 */ 736 + { 0x6, 0x7F, 0x3F, 0x00, 0x00 }, /* 2 0 */ 737 + { 0x6, 0x7F, 0x3F, 0x00, 0x00 }, /* 2 1 */ 738 + }; 739 + 740 + static bool is_hobl_buf_trans(const struct cnl_ddi_buf_trans *table) 741 + { 742 + return table == tgl_combo_phy_ddi_translations_edp_hbr2_hobl; 743 + } 744 + 709 745 static const struct ddi_buf_trans * 710 746 bdw_get_buf_trans_edp(struct intel_encoder *encoder, int *n_entries) 711 747 { ··· 1086 1050 tgl_get_combo_buf_trans(struct intel_encoder *encoder, int type, int rate, 1087 1051 int *n_entries) 1088 1052 { 1053 + struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); 1054 + 1055 + if (type == INTEL_OUTPUT_EDP && dev_priv->vbt.edp.hobl) { 1056 + struct intel_dp *intel_dp = enc_to_intel_dp(encoder); 1057 + 1058 + if (!intel_dp->hobl_failed && rate <= 540000) { 1059 + /* Same table applies to TGL, RKL and DG1 */ 1060 + *n_entries = ARRAY_SIZE(tgl_combo_phy_ddi_translations_edp_hbr2_hobl); 1061 + return tgl_combo_phy_ddi_translations_edp_hbr2_hobl; 1062 + } 1063 + } 1064 + 1089 1065 if (type == INTEL_OUTPUT_HDMI || type == INTEL_OUTPUT_EDP) { 1090 1066 return icl_get_combo_buf_trans(encoder, type, rate, n_entries); 1091 1067 } else if (rate > 270000) { 1068 + if (IS_TGL_U(dev_priv) || IS_TGL_Y(dev_priv)) { 1069 + *n_entries = ARRAY_SIZE(tgl_uy_combo_phy_ddi_translations_dp_hbr2); 1070 + return tgl_uy_combo_phy_ddi_translations_dp_hbr2; 1071 + } 1072 + 1092 1073 *n_entries = ARRAY_SIZE(tgl_combo_phy_ddi_translations_dp_hbr2); 1093 1074 return tgl_combo_phy_ddi_translations_dp_hbr2; 1094 1075 } ··· 2445 2392 level = n_entries - 1; 2446 2393 } 2447 2394 2395 + if (type == INTEL_OUTPUT_EDP) { 2396 + struct intel_dp *intel_dp = enc_to_intel_dp(encoder); 2397 + 2398 + val = EDP4K2K_MODE_OVRD_EN | EDP4K2K_MODE_OVRD_OPTIMIZED; 2399 + intel_dp->hobl_active = is_hobl_buf_trans(ddi_translations); 2400 + intel_de_rmw(dev_priv, ICL_PORT_CL_DW10(phy), val, 2401 + intel_dp->hobl_active ? val : 0); 2402 + } 2403 + 2448 2404 /* Set PORT_TX_DW5 */ 2449 2405 val = intel_de_read(dev_priv, ICL_PORT_TX_DW5_LN0(phy)); 2450 2406 val &= ~(SCALING_MODE_SEL_MASK | RTERM_SELECT_MASK | ··· 2864 2802 static u32 icl_dpclka_cfgcr0_clk_off(struct drm_i915_private *dev_priv, 2865 2803 enum phy phy) 2866 2804 { 2867 - if (intel_phy_is_combo(dev_priv, phy)) { 2805 + if (IS_ROCKETLAKE(dev_priv)) { 2806 + return RKL_DPCLKA_CFGCR0_DDI_CLK_OFF(phy); 2807 + } else if (intel_phy_is_combo(dev_priv, phy)) { 2868 2808 return ICL_DPCLKA_CFGCR0_DDI_CLK_OFF(phy); 2869 2809 } else if (intel_phy_is_tc(dev_priv, phy)) { 2870 2810 enum tc_port tc_port = intel_port_to_tc(dev_priv, ··· 2893 2829 (val & icl_dpclka_cfgcr0_clk_off(dev_priv, phy)) == 0); 2894 2830 2895 2831 if (intel_phy_is_combo(dev_priv, phy)) { 2832 + u32 mask, sel; 2833 + 2834 + if (IS_ROCKETLAKE(dev_priv)) { 2835 + mask = RKL_DPCLKA_CFGCR0_DDI_CLK_SEL_MASK(phy); 2836 + sel = RKL_DPCLKA_CFGCR0_DDI_CLK_SEL(pll->info->id, phy); 2837 + } else { 2838 + mask = ICL_DPCLKA_CFGCR0_DDI_CLK_SEL_MASK(phy); 2839 + sel = ICL_DPCLKA_CFGCR0_DDI_CLK_SEL(pll->info->id, phy); 2840 + } 2841 + 2896 2842 /* 2897 2843 * Even though this register references DDIs, note that we 2898 2844 * want to pass the PHY rather than the port (DDI). For ··· 2913 2839 * Clock Select chooses the PLL for both DDIA and DDID and 2914 2840 * drives port A in all cases." 2915 2841 */ 2916 - val &= ~ICL_DPCLKA_CFGCR0_DDI_CLK_SEL_MASK(phy); 2917 - val |= ICL_DPCLKA_CFGCR0_DDI_CLK_SEL(pll->info->id, phy); 2842 + val &= ~mask; 2843 + val |= sel; 2918 2844 intel_de_write(dev_priv, ICL_DPCLKA_CFGCR0, val); 2919 2845 intel_de_posting_read(dev_priv, ICL_DPCLKA_CFGCR0); 2920 2846 } ··· 4111 4037 intel_wait_ddi_buf_idle(dev_priv, port); 4112 4038 } 4113 4039 4114 - dp_tp_ctl = DP_TP_CTL_ENABLE | 4115 - DP_TP_CTL_LINK_TRAIN_PAT1 | DP_TP_CTL_SCRAMBLE_DISABLE; 4040 + dp_tp_ctl = DP_TP_CTL_ENABLE | DP_TP_CTL_LINK_TRAIN_PAT1; 4116 4041 if (intel_dp->link_mst) 4117 4042 dp_tp_ctl |= DP_TP_CTL_MODE_MST; 4118 4043 else { ··· 4134 4061 { 4135 4062 struct drm_i915_private *dev_priv = dp_to_i915(intel_dp); 4136 4063 u8 train_pat_mask = drm_dp_training_pattern_mask(intel_dp->dpcd); 4137 - enum port port = dp_to_dig_port(intel_dp)->base.port; 4138 4064 u32 temp; 4139 4065 4140 4066 temp = intel_de_read(dev_priv, intel_dp->regs.dp_tp_ctl); 4141 - 4142 - if (dp_train_pat & DP_LINK_SCRAMBLING_DISABLE) 4143 - temp |= DP_TP_CTL_SCRAMBLE_DISABLE; 4144 - else 4145 - temp &= ~DP_TP_CTL_SCRAMBLE_DISABLE; 4146 4067 4147 4068 temp &= ~DP_TP_CTL_LINK_TRAIN_MASK; 4148 4069 switch (dp_train_pat & train_pat_mask) { ··· 4158 4091 } 4159 4092 4160 4093 intel_de_write(dev_priv, intel_dp->regs.dp_tp_ctl, temp); 4161 - 4162 - intel_de_write(dev_priv, DDI_BUF_CTL(port), intel_dp->DP); 4163 - intel_de_posting_read(dev_priv, DDI_BUF_CTL(port)); 4164 4094 } 4165 4095 4166 4096 static void intel_ddi_set_idle_link_train(struct intel_dp *intel_dp) ··· 4942 4878 return max_lanes; 4943 4879 } 4944 4880 4881 + static bool hti_uses_phy(struct drm_i915_private *i915, enum phy phy) 4882 + { 4883 + return i915->hti_state & HDPORT_ENABLED && 4884 + (i915->hti_state & HDPORT_PHY_USED_DP(phy) || 4885 + i915->hti_state & HDPORT_PHY_USED_HDMI(phy)); 4886 + } 4887 + 4945 4888 void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port) 4946 4889 { 4947 4890 struct intel_digital_port *dig_port; 4948 4891 struct intel_encoder *encoder; 4949 4892 bool init_hdmi, init_dp, init_lspcon = false; 4950 4893 enum phy phy = intel_port_to_phy(dev_priv, port); 4894 + 4895 + /* 4896 + * On platforms with HTI (aka HDPORT), if it's enabled at boot it may 4897 + * have taken over some of the PHYs and made them unavailable to the 4898 + * driver. In that case we should skip initializing the corresponding 4899 + * outputs. 4900 + */ 4901 + if (hti_uses_phy(dev_priv, phy)) { 4902 + drm_dbg_kms(&dev_priv->drm, "PORT %c / PHY %c reserved by HTI\n", 4903 + port_name(port), phy_name(phy)); 4904 + return; 4905 + } 4951 4906 4952 4907 init_hdmi = intel_bios_port_supports_dvi(dev_priv, port) || 4953 4908 intel_bios_port_supports_hdmi(dev_priv, port);
+75 -13
drivers/gpu/drm/i915/display/intel_display.c
··· 47 47 #include "display/intel_ddi.h" 48 48 #include "display/intel_dp.h" 49 49 #include "display/intel_dp_mst.h" 50 + #include "display/intel_dpll_mgr.h" 50 51 #include "display/intel_dsi.h" 51 52 #include "display/intel_dvo.h" 52 53 #include "display/intel_gmbus.h" ··· 3762 3761 } 3763 3762 } 3764 3763 3764 + static int icl_min_plane_width(const struct drm_framebuffer *fb) 3765 + { 3766 + /* Wa_14011264657, Wa_14011050563: gen11+ */ 3767 + switch (fb->format->format) { 3768 + case DRM_FORMAT_C8: 3769 + return 18; 3770 + case DRM_FORMAT_RGB565: 3771 + return 10; 3772 + case DRM_FORMAT_XRGB8888: 3773 + case DRM_FORMAT_XBGR8888: 3774 + case DRM_FORMAT_ARGB8888: 3775 + case DRM_FORMAT_ABGR8888: 3776 + case DRM_FORMAT_XRGB2101010: 3777 + case DRM_FORMAT_XBGR2101010: 3778 + case DRM_FORMAT_ARGB2101010: 3779 + case DRM_FORMAT_ABGR2101010: 3780 + case DRM_FORMAT_XVYU2101010: 3781 + case DRM_FORMAT_Y212: 3782 + case DRM_FORMAT_Y216: 3783 + return 6; 3784 + case DRM_FORMAT_NV12: 3785 + return 20; 3786 + case DRM_FORMAT_P010: 3787 + case DRM_FORMAT_P012: 3788 + case DRM_FORMAT_P016: 3789 + return 12; 3790 + case DRM_FORMAT_XRGB16161616F: 3791 + case DRM_FORMAT_XBGR16161616F: 3792 + case DRM_FORMAT_ARGB16161616F: 3793 + case DRM_FORMAT_ABGR16161616F: 3794 + case DRM_FORMAT_XVYU12_16161616: 3795 + case DRM_FORMAT_XVYU16161616: 3796 + return 4; 3797 + default: 3798 + return 1; 3799 + } 3800 + } 3801 + 3765 3802 static int icl_max_plane_width(const struct drm_framebuffer *fb, 3766 3803 int color_plane, 3767 3804 unsigned int rotation) ··· 3882 3843 int y = plane_state->uapi.src.y1 >> 16; 3883 3844 int w = drm_rect_width(&plane_state->uapi.src) >> 16; 3884 3845 int h = drm_rect_height(&plane_state->uapi.src) >> 16; 3885 - int max_width; 3886 - int max_height; 3887 - u32 alignment; 3888 - u32 offset; 3846 + int max_width, min_width, max_height; 3847 + u32 alignment, offset; 3889 3848 int aux_plane = intel_main_to_aux_plane(fb, 0); 3890 3849 u32 aux_offset = plane_state->color_plane[aux_plane].offset; 3891 3850 3892 - if (INTEL_GEN(dev_priv) >= 11) 3851 + if (INTEL_GEN(dev_priv) >= 11) { 3893 3852 max_width = icl_max_plane_width(fb, 0, rotation); 3894 - else if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)) 3853 + min_width = icl_min_plane_width(fb); 3854 + } else if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)) { 3895 3855 max_width = glk_max_plane_width(fb, 0, rotation); 3896 - else 3856 + min_width = 1; 3857 + } else { 3897 3858 max_width = skl_max_plane_width(fb, 0, rotation); 3859 + min_width = 1; 3860 + } 3898 3861 3899 3862 if (INTEL_GEN(dev_priv) >= 11) 3900 3863 max_height = icl_max_plane_height(); 3901 3864 else 3902 3865 max_height = skl_max_plane_height(); 3903 3866 3904 - if (w > max_width || h > max_height) { 3867 + if (w > max_width || w < min_width || h > max_height) { 3905 3868 drm_dbg_kms(&dev_priv->drm, 3906 - "requested Y/RGB source size %dx%d too big (limit %dx%d)\n", 3907 - w, h, max_width, max_height); 3869 + "requested Y/RGB source size %dx%d outside limits (min: %dx1 max: %dx%d)\n", 3870 + w, h, min_width, max_width, max_height); 3908 3871 return -EINVAL; 3909 3872 } 3910 3873 ··· 10843 10802 u32 temp; 10844 10803 10845 10804 if (intel_phy_is_combo(dev_priv, phy)) { 10846 - temp = intel_de_read(dev_priv, ICL_DPCLKA_CFGCR0) & 10847 - ICL_DPCLKA_CFGCR0_DDI_CLK_SEL_MASK(phy); 10848 - id = temp >> ICL_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy); 10805 + u32 mask, shift; 10806 + 10807 + if (IS_ROCKETLAKE(dev_priv)) { 10808 + mask = RKL_DPCLKA_CFGCR0_DDI_CLK_SEL_MASK(phy); 10809 + shift = RKL_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy); 10810 + } else { 10811 + mask = ICL_DPCLKA_CFGCR0_DDI_CLK_SEL_MASK(phy); 10812 + shift = ICL_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy); 10813 + } 10814 + 10815 + temp = intel_de_read(dev_priv, ICL_DPCLKA_CFGCR0) & mask; 10816 + id = temp >> shift; 10849 10817 port_dpll_id = ICL_PORT_DPLL_DEFAULT; 10850 10818 } else if (intel_phy_is_tc(dev_priv, phy)) { 10851 10819 u32 clk_sel = intel_de_read(dev_priv, DDI_CLK_SEL(port)) & DDI_CLK_SEL_MASK; ··· 12809 12759 return ret; 12810 12760 12811 12761 } 12762 + 12763 + if (!mode_changed) 12764 + intel_psr2_sel_fetch_update(state, crtc); 12812 12765 12813 12766 return 0; 12814 12767 } ··· 15189 15136 15190 15137 if (new_crtc_state->update_pipe) 15191 15138 intel_pipe_fastset(old_crtc_state, new_crtc_state); 15139 + 15140 + intel_psr2_program_trans_man_trk_ctl(new_crtc_state); 15192 15141 } 15193 15142 15194 15143 if (dev_priv->display.atomic_update_watermarks) ··· 17948 17893 17949 17894 if (i915->max_cdclk_freq == 0) 17950 17895 intel_update_max_cdclk(i915); 17896 + 17897 + /* 17898 + * If the platform has HTI, we need to find out whether it has reserved 17899 + * any display resources before we create our display outputs. 17900 + */ 17901 + if (INTEL_INFO(i915)->display.has_hti) 17902 + i915->hti_state = intel_de_read(i915, HDPORT_STATE); 17951 17903 17952 17904 /* Just disable it once at startup */ 17953 17905 intel_vga_disable(i915);
+3
drivers/gpu/drm/i915/display/intel_display_debugfs.c
··· 417 417 su_blocks = su_blocks >> PSR2_SU_STATUS_SHIFT(frame); 418 418 seq_printf(m, "%d\t%d\n", frame, su_blocks); 419 419 } 420 + 421 + seq_printf(m, "PSR2 selective fetch: %s\n", 422 + enableddisabled(psr->psr2_sel_fetch_enabled)); 420 423 } 421 424 422 425 unlock:
+11 -5
drivers/gpu/drm/i915/display/intel_display_power.c
··· 3927 3927 int ret; 3928 3928 3929 3929 while (1) { 3930 - u32 low_val = 0, high_val; 3930 + u32 low_val; 3931 + u32 high_val = 0; 3931 3932 3932 3933 if (block) 3933 - high_val = TGL_PCODE_EXIT_TCCOLD_DATA_H_BLOCK_REQ; 3934 + low_val = TGL_PCODE_EXIT_TCCOLD_DATA_L_BLOCK_REQ; 3934 3935 else 3935 - high_val = TGL_PCODE_EXIT_TCCOLD_DATA_H_UNBLOCK_REQ; 3936 + low_val = TGL_PCODE_EXIT_TCCOLD_DATA_L_UNBLOCK_REQ; 3936 3937 3937 3938 /* 3938 3939 * Spec states that we should timeout the request after 200us ··· 3952 3951 if (++tries == 3) 3953 3952 break; 3954 3953 3955 - if (ret == -EAGAIN) 3956 - msleep(1); 3954 + msleep(1); 3957 3955 } 3958 3956 3959 3957 if (ret) ··· 5301 5301 u32 val; 5302 5302 5303 5303 gen9_set_dc_state(dev_priv, DC_STATE_DISABLE); 5304 + 5305 + /* Wa_14011294188:ehl,jsl,tgl,rkl */ 5306 + if (INTEL_PCH_TYPE(dev_priv) >= PCH_JSP && 5307 + INTEL_PCH_TYPE(dev_priv) < PCH_DG1) 5308 + intel_de_rmw(dev_priv, SOUTH_DSPCLK_GATE_D, 0, 5309 + PCH_DPMGUNIT_CLOCK_GATE_DISABLE); 5304 5310 5305 5311 /* 1. Enable PCH reset handshake. */ 5306 5312 intel_pch_reset_handshake(dev_priv, !HAS_PCH_NOP(dev_priv));
+6
drivers/gpu/drm/i915/display/intel_display_types.h
··· 931 931 932 932 bool has_psr; 933 933 bool has_psr2; 934 + bool enable_psr2_sel_fetch; 934 935 u32 dc3co_exitline; 935 936 936 937 /* ··· 1074 1073 1075 1074 /* For DSB related info */ 1076 1075 struct intel_dsb *dsb; 1076 + 1077 + u32 psr2_man_track_ctl; 1077 1078 }; 1078 1079 1079 1080 enum intel_pipe_crc_source { ··· 1378 1375 1379 1376 /* Display stream compression testing */ 1380 1377 bool force_dsc_en; 1378 + 1379 + bool hobl_failed; 1380 + bool hobl_active; 1381 1381 }; 1382 1382 1383 1383 enum lspcon_vendor {
+47 -5
drivers/gpu/drm/i915/display/intel_dpll_mgr.c
··· 3475 3475 icl_set_active_port_dpll(crtc_state, port_dpll_id); 3476 3476 } 3477 3477 3478 + static u32 intel_get_hti_plls(struct drm_i915_private *i915) 3479 + { 3480 + if (!(i915->hti_state & HDPORT_ENABLED)) 3481 + return 0; 3482 + 3483 + return REG_FIELD_GET(HDPORT_DPLL_USED_MASK, i915->hti_state); 3484 + } 3485 + 3478 3486 static bool icl_get_combo_phy_dpll(struct intel_atomic_state *state, 3479 3487 struct intel_crtc *crtc, 3480 3488 struct intel_encoder *encoder) ··· 3512 3504 3513 3505 icl_calc_dpll_state(dev_priv, &pll_params, &port_dpll->hw_state); 3514 3506 3515 - if (IS_ELKHARTLAKE(dev_priv) && port != PORT_A) 3507 + if (IS_ROCKETLAKE(dev_priv)) { 3516 3508 dpll_mask = 3517 3509 BIT(DPLL_ID_EHL_DPLL4) | 3518 3510 BIT(DPLL_ID_ICL_DPLL1) | 3519 3511 BIT(DPLL_ID_ICL_DPLL0); 3520 - else 3512 + } else if (IS_ELKHARTLAKE(dev_priv) && port != PORT_A) { 3513 + dpll_mask = 3514 + BIT(DPLL_ID_EHL_DPLL4) | 3515 + BIT(DPLL_ID_ICL_DPLL1) | 3516 + BIT(DPLL_ID_ICL_DPLL0); 3517 + } else { 3521 3518 dpll_mask = BIT(DPLL_ID_ICL_DPLL1) | BIT(DPLL_ID_ICL_DPLL0); 3519 + } 3520 + 3521 + /* Eliminate DPLLs from consideration if reserved by HTI */ 3522 + dpll_mask &= ~intel_get_hti_plls(dev_priv); 3522 3523 3523 3524 port_dpll->pll = intel_find_shared_dpll(state, crtc, 3524 3525 &port_dpll->hw_state, ··· 3808 3791 if (!(val & PLL_ENABLE)) 3809 3792 goto out; 3810 3793 3811 - if (INTEL_GEN(dev_priv) >= 12) { 3794 + if (IS_ROCKETLAKE(dev_priv)) { 3795 + hw_state->cfgcr0 = intel_de_read(dev_priv, 3796 + RKL_DPLL_CFGCR0(id)); 3797 + hw_state->cfgcr1 = intel_de_read(dev_priv, 3798 + RKL_DPLL_CFGCR1(id)); 3799 + } else if (INTEL_GEN(dev_priv) >= 12) { 3812 3800 hw_state->cfgcr0 = intel_de_read(dev_priv, 3813 3801 TGL_DPLL_CFGCR0(id)); 3814 3802 hw_state->cfgcr1 = intel_de_read(dev_priv, ··· 3866 3844 const enum intel_dpll_id id = pll->info->id; 3867 3845 i915_reg_t cfgcr0_reg, cfgcr1_reg; 3868 3846 3869 - if (INTEL_GEN(dev_priv) >= 12) { 3847 + if (IS_ROCKETLAKE(dev_priv)) { 3848 + cfgcr0_reg = RKL_DPLL_CFGCR0(id); 3849 + cfgcr1_reg = RKL_DPLL_CFGCR1(id); 3850 + } else if (INTEL_GEN(dev_priv) >= 12) { 3870 3851 cfgcr0_reg = TGL_DPLL_CFGCR0(id); 3871 3852 cfgcr1_reg = TGL_DPLL_CFGCR1(id); 3872 3853 } else { ··· 4301 4276 .dump_hw_state = icl_dump_hw_state, 4302 4277 }; 4303 4278 4279 + static const struct dpll_info rkl_plls[] = { 4280 + { "DPLL 0", &combo_pll_funcs, DPLL_ID_ICL_DPLL0, 0 }, 4281 + { "DPLL 1", &combo_pll_funcs, DPLL_ID_ICL_DPLL1, 0 }, 4282 + { "DPLL 4", &combo_pll_funcs, DPLL_ID_EHL_DPLL4, 0 }, 4283 + { }, 4284 + }; 4285 + 4286 + static const struct intel_dpll_mgr rkl_pll_mgr = { 4287 + .dpll_info = rkl_plls, 4288 + .get_dplls = icl_get_dplls, 4289 + .put_dplls = icl_put_dplls, 4290 + .update_ref_clks = icl_update_dpll_ref_clks, 4291 + .dump_hw_state = icl_dump_hw_state, 4292 + }; 4293 + 4304 4294 /** 4305 4295 * intel_shared_dpll_init - Initialize shared DPLLs 4306 4296 * @dev: drm device ··· 4329 4289 const struct dpll_info *dpll_info; 4330 4290 int i; 4331 4291 4332 - if (INTEL_GEN(dev_priv) >= 12) 4292 + if (IS_ROCKETLAKE(dev_priv)) 4293 + dpll_mgr = &rkl_pll_mgr; 4294 + else if (INTEL_GEN(dev_priv) >= 12) 4333 4295 dpll_mgr = &tgl_pll_mgr; 4334 4296 else if (IS_ELKHARTLAKE(dev_priv)) 4335 4297 dpll_mgr = &ehl_pll_mgr;
+17
drivers/gpu/drm/i915/display/intel_fbc.c
··· 424 424 fbc->no_fbc_reason = reason; 425 425 } 426 426 427 + static u64 intel_fbc_cfb_base_max(struct drm_i915_private *i915) 428 + { 429 + if (INTEL_GEN(i915) >= 5 || IS_G4X(i915)) 430 + return BIT_ULL(28); 431 + else 432 + return BIT_ULL(32); 433 + } 434 + 427 435 static int find_compression_threshold(struct drm_i915_private *dev_priv, 428 436 struct drm_mm_node *node, 429 437 unsigned int size, ··· 449 441 end = resource_size(&dev_priv->dsm) - 8 * 1024 * 1024; 450 442 else 451 443 end = U64_MAX; 444 + 445 + end = min(end, intel_fbc_cfb_base_max(dev_priv)); 452 446 453 447 /* HACK: This code depends on what we will do in *_enable_fbc. If that 454 448 * code changes, this code needs to change as well. ··· 1424 1414 return !!dev_priv->params.enable_fbc; 1425 1415 1426 1416 if (!HAS_FBC(dev_priv)) 1417 + return 0; 1418 + 1419 + /* 1420 + * Fbc is causing random underruns in CI execution on TGL platforms. 1421 + * Disabling the same while the problem is being debugged and analyzed. 1422 + */ 1423 + if (IS_TIGERLAKE(dev_priv)) 1427 1424 return 0; 1428 1425 1429 1426 if (IS_BROADWELL(dev_priv) || INTEL_GEN(dev_priv) >= 9)
+2
drivers/gpu/drm/i915/display/intel_frontbuffer.c
··· 232 232 RCU_INIT_POINTER(obj->frontbuffer, NULL); 233 233 spin_unlock(&to_i915(obj->base.dev)->fb_tracking.lock); 234 234 235 + i915_active_fini(&front->write); 236 + 235 237 i915_gem_object_put(obj); 236 238 kfree_rcu(front, rcu); 237 239 }
+96 -14
drivers/gpu/drm/i915/display/intel_psr.c
··· 553 553 val |= EDP_PSR2_FAST_WAKE(7); 554 554 } 555 555 556 + if (dev_priv->psr.psr2_sel_fetch_enabled) { 557 + /* WA 1408330847 */ 558 + if (IS_TGL_REVID(dev_priv, TGL_REVID_A0, TGL_REVID_A0) || 559 + IS_RKL_REVID(dev_priv, RKL_REVID_A0, RKL_REVID_A0)) 560 + intel_de_rmw(dev_priv, CHICKEN_PAR1_1, 561 + DIS_RAM_BYPASS_PSR2_MAN_TRACK, 562 + DIS_RAM_BYPASS_PSR2_MAN_TRACK); 563 + 564 + intel_de_write(dev_priv, 565 + PSR2_MAN_TRK_CTL(dev_priv->psr.transcoder), 566 + PSR2_MAN_TRK_CTL_ENABLE); 567 + } else if (HAS_PSR2_SEL_FETCH(dev_priv)) { 568 + intel_de_write(dev_priv, 569 + PSR2_MAN_TRK_CTL(dev_priv->psr.transcoder), 0); 570 + } 571 + 556 572 /* 557 573 * PSR2 HW is incorrectly using EDP_PSR_TP1_TP3_SEL and BSpec is 558 574 * recommending keep this bit unset while PSR2 is enabled. ··· 679 663 crtc_state->dc3co_exitline = crtc_vdisplay - exit_scanlines; 680 664 } 681 665 666 + static bool intel_psr2_sel_fetch_config_valid(struct intel_dp *intel_dp, 667 + struct intel_crtc_state *crtc_state) 668 + { 669 + struct intel_atomic_state *state = to_intel_atomic_state(crtc_state->uapi.state); 670 + struct drm_i915_private *dev_priv = dp_to_i915(intel_dp); 671 + struct intel_plane_state *plane_state; 672 + struct intel_plane *plane; 673 + int i; 674 + 675 + if (!dev_priv->params.enable_psr2_sel_fetch) { 676 + drm_dbg_kms(&dev_priv->drm, 677 + "PSR2 sel fetch not enabled, disabled by parameter\n"); 678 + return false; 679 + } 680 + 681 + if (crtc_state->uapi.async_flip) { 682 + drm_dbg_kms(&dev_priv->drm, 683 + "PSR2 sel fetch not enabled, async flip enabled\n"); 684 + return false; 685 + } 686 + 687 + for_each_new_intel_plane_in_state(state, plane, plane_state, i) { 688 + if (plane_state->uapi.rotation != DRM_MODE_ROTATE_0) { 689 + drm_dbg_kms(&dev_priv->drm, 690 + "PSR2 sel fetch not enabled, plane rotated\n"); 691 + return false; 692 + } 693 + } 694 + 695 + return crtc_state->enable_psr2_sel_fetch = true; 696 + } 697 + 682 698 static bool intel_psr2_config_valid(struct intel_dp *intel_dp, 683 699 struct intel_crtc_state *crtc_state) 684 700 { ··· 780 732 return false; 781 733 } 782 734 783 - /* 784 - * Some platforms lack PSR2 HW tracking and instead require manual 785 - * tracking by software. In this case, the driver is required to track 786 - * the areas that need updates and program hardware to send selective 787 - * updates. 788 - * 789 - * So until the software tracking is implemented, PSR2 needs to be 790 - * disabled for platforms without PSR2 HW tracking. 791 - */ 792 - if (!HAS_PSR_HW_TRACKING(dev_priv)) { 793 - drm_dbg_kms(&dev_priv->drm, 794 - "No PSR2 HW tracking in the platform\n"); 795 - return false; 735 + if (HAS_PSR2_SEL_FETCH(dev_priv)) { 736 + if (!intel_psr2_sel_fetch_config_valid(intel_dp, crtc_state) && 737 + !HAS_PSR_HW_TRACKING(dev_priv)) { 738 + drm_dbg_kms(&dev_priv->drm, 739 + "PSR2 not enabled, selective fetch not valid and no HW tracking available\n"); 740 + return false; 741 + } 796 742 } 797 743 798 - if (crtc_hdisplay > psr_max_h || crtc_vdisplay > psr_max_v) { 744 + if (!crtc_state->enable_psr2_sel_fetch && 745 + (crtc_hdisplay > psr_max_h || crtc_vdisplay > psr_max_v)) { 799 746 drm_dbg_kms(&dev_priv->drm, 800 747 "PSR2 not enabled, resolution %dx%d > max supported %dx%d\n", 801 748 crtc_hdisplay, crtc_vdisplay, ··· 941 898 val |= EXITLINE_ENABLE; 942 899 intel_de_write(dev_priv, EXITLINE(cpu_transcoder), val); 943 900 } 901 + 902 + if (HAS_PSR_HW_TRACKING(dev_priv)) 903 + intel_de_rmw(dev_priv, CHICKEN_PAR1_1, IGNORE_PSR2_HW_TRACKING, 904 + dev_priv->psr.psr2_sel_fetch_enabled ? 905 + IGNORE_PSR2_HW_TRACKING : 0); 944 906 } 945 907 946 908 static void intel_psr_enable_locked(struct drm_i915_private *dev_priv, ··· 967 919 /* DC5/DC6 requires at least 6 idle frames */ 968 920 val = usecs_to_jiffies(intel_get_frame_time_us(crtc_state) * 6); 969 921 dev_priv->psr.dc3co_exit_delay = val; 922 + dev_priv->psr.psr2_sel_fetch_enabled = crtc_state->enable_psr2_sel_fetch; 970 923 971 924 /* 972 925 * If a PSR error happened and the driver is reloaded, the EDP_PSR_IIR ··· 1107 1058 psr_status_mask, 2000)) 1108 1059 drm_err(&dev_priv->drm, "Timed out waiting PSR idle state\n"); 1109 1060 1061 + /* WA 1408330847 */ 1062 + if (dev_priv->psr.psr2_sel_fetch_enabled && 1063 + (IS_TGL_REVID(dev_priv, TGL_REVID_A0, TGL_REVID_A0) || 1064 + IS_RKL_REVID(dev_priv, RKL_REVID_A0, RKL_REVID_A0))) 1065 + intel_de_rmw(dev_priv, CHICKEN_PAR1_1, 1066 + DIS_RAM_BYPASS_PSR2_MAN_TRACK, 0); 1067 + 1110 1068 /* Disable PSR on Sink */ 1111 1069 drm_dp_dpcd_writeb(&intel_dp->aux, DP_PSR_EN_CFG, 0); 1112 1070 ··· 1169 1113 * on older gens so doing the manual exit instead. 1170 1114 */ 1171 1115 intel_psr_exit(dev_priv); 1116 + } 1117 + 1118 + void intel_psr2_program_trans_man_trk_ctl(const struct intel_crtc_state *crtc_state) 1119 + { 1120 + struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); 1121 + struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); 1122 + struct i915_psr *psr = &dev_priv->psr; 1123 + 1124 + if (!HAS_PSR2_SEL_FETCH(dev_priv) || 1125 + !crtc_state->enable_psr2_sel_fetch) 1126 + return; 1127 + 1128 + intel_de_write(dev_priv, PSR2_MAN_TRK_CTL(psr->transcoder), 1129 + crtc_state->psr2_man_track_ctl); 1130 + } 1131 + 1132 + void intel_psr2_sel_fetch_update(struct intel_atomic_state *state, 1133 + struct intel_crtc *crtc) 1134 + { 1135 + struct intel_crtc_state *crtc_state = intel_atomic_get_new_crtc_state(state, crtc); 1136 + 1137 + if (!crtc_state->enable_psr2_sel_fetch) 1138 + return; 1139 + 1140 + crtc_state->psr2_man_track_ctl = PSR2_MAN_TRK_CTL_ENABLE | 1141 + PSR2_MAN_TRK_CTL_SF_SINGLE_FULL_FRAME; 1172 1142 } 1173 1143 1174 1144 /**
+5
drivers/gpu/drm/i915/display/intel_psr.h
··· 13 13 struct drm_i915_private; 14 14 struct intel_crtc_state; 15 15 struct intel_dp; 16 + struct intel_crtc; 17 + struct intel_atomic_state; 16 18 17 19 #define CAN_PSR(dev_priv) (HAS_PSR(dev_priv) && dev_priv->psr.sink_support) 18 20 void intel_psr_init_dpcd(struct intel_dp *intel_dp); ··· 45 43 struct drm_connector_state *old_state, 46 44 struct drm_connector_state *new_state); 47 45 void intel_psr_set_force_mode_changed(struct intel_dp *intel_dp); 46 + void intel_psr2_sel_fetch_update(struct intel_atomic_state *state, 47 + struct intel_crtc *crtc); 48 + void intel_psr2_program_trans_man_trk_ctl(const struct intel_crtc_state *crtc_state); 48 49 49 50 #endif /* __INTEL_PSR_H__ */
+3 -2
drivers/gpu/drm/i915/display/intel_sprite.c
··· 2843 2843 static bool gen12_plane_supports_mc_ccs(struct drm_i915_private *dev_priv, 2844 2844 enum plane_id plane_id) 2845 2845 { 2846 - /* Wa_14010477008:tgl[a0..c0] */ 2847 - if (IS_TGL_REVID(dev_priv, TGL_REVID_A0, TGL_REVID_C0)) 2846 + /* Wa_14010477008:tgl[a0..c0],rkl[all] */ 2847 + if (IS_ROCKETLAKE(dev_priv) || 2848 + IS_TGL_REVID(dev_priv, TGL_REVID_A0, TGL_REVID_C0)) 2848 2849 return false; 2849 2850 2850 2851 return plane_id < PLANE_SPRITE4;
+284 -87
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
··· 26 26 #include "i915_gem_ioctls.h" 27 27 #include "i915_sw_fence_work.h" 28 28 #include "i915_trace.h" 29 + #include "i915_user_extensions.h" 29 30 30 31 struct eb_vma { 31 32 struct i915_vma *vma; ··· 223 222 * the batchbuffer in trusted mode, otherwise the ioctl is rejected. 224 223 */ 225 224 225 + struct eb_fence { 226 + struct drm_syncobj *syncobj; /* Use with ptr_mask_bits() */ 227 + struct dma_fence *dma_fence; 228 + u64 value; 229 + struct dma_fence_chain *chain_fence; 230 + }; 231 + 226 232 struct i915_execbuffer { 227 233 struct drm_i915_private *i915; /** i915 backpointer */ 228 234 struct drm_file *file; /** per-file lookup tables and limits */ ··· 289 281 int lut_size; 290 282 struct hlist_head *buckets; /** ht for relocation handles */ 291 283 struct eb_vma_array *array; 284 + 285 + struct eb_fence *fences; 286 + unsigned long num_fences; 292 287 }; 293 288 294 289 static inline bool eb_use_cmdparser(const struct i915_execbuffer *eb) ··· 1633 1622 return -EINVAL; 1634 1623 1635 1624 /* Kernel clipping was a DRI1 misfeature */ 1636 - if (!(exec->flags & I915_EXEC_FENCE_ARRAY)) { 1625 + if (!(exec->flags & (I915_EXEC_FENCE_ARRAY | 1626 + I915_EXEC_USE_EXTENSIONS))) { 1637 1627 if (exec->num_cliprects || exec->cliprects_ptr) 1638 1628 return -EINVAL; 1639 1629 } ··· 2213 2201 } 2214 2202 2215 2203 static void 2216 - __free_fence_array(struct drm_syncobj **fences, unsigned int n) 2204 + __free_fence_array(struct eb_fence *fences, unsigned int n) 2217 2205 { 2218 - while (n--) 2219 - drm_syncobj_put(ptr_mask_bits(fences[n], 2)); 2206 + while (n--) { 2207 + drm_syncobj_put(ptr_mask_bits(fences[n].syncobj, 2)); 2208 + dma_fence_put(fences[n].dma_fence); 2209 + kfree(fences[n].chain_fence); 2210 + } 2220 2211 kvfree(fences); 2221 2212 } 2222 2213 2223 - static struct drm_syncobj ** 2224 - get_fence_array(struct drm_i915_gem_execbuffer2 *args, 2225 - struct drm_file *file) 2214 + static int 2215 + add_timeline_fence_array(struct i915_execbuffer *eb, 2216 + const struct drm_i915_gem_execbuffer_ext_timeline_fences *timeline_fences) 2226 2217 { 2227 - const unsigned long nfences = args->num_cliprects; 2228 - struct drm_i915_gem_exec_fence __user *user; 2229 - struct drm_syncobj **fences; 2230 - unsigned long n; 2231 - int err; 2218 + struct drm_i915_gem_exec_fence __user *user_fences; 2219 + u64 __user *user_values; 2220 + struct eb_fence *f; 2221 + u64 nfences; 2222 + int err = 0; 2232 2223 2233 - if (!(args->flags & I915_EXEC_FENCE_ARRAY)) 2234 - return NULL; 2224 + nfences = timeline_fences->fence_count; 2225 + if (!nfences) 2226 + return 0; 2235 2227 2236 2228 /* Check multiplication overflow for access_ok() and kvmalloc_array() */ 2237 2229 BUILD_BUG_ON(sizeof(size_t) > sizeof(unsigned long)); 2238 2230 if (nfences > min_t(unsigned long, 2239 - ULONG_MAX / sizeof(*user), 2240 - SIZE_MAX / sizeof(*fences))) 2241 - return ERR_PTR(-EINVAL); 2231 + ULONG_MAX / sizeof(*user_fences), 2232 + SIZE_MAX / sizeof(*f)) - eb->num_fences) 2233 + return -EINVAL; 2242 2234 2243 - user = u64_to_user_ptr(args->cliprects_ptr); 2244 - if (!access_ok(user, nfences * sizeof(*user))) 2245 - return ERR_PTR(-EFAULT); 2235 + user_fences = u64_to_user_ptr(timeline_fences->handles_ptr); 2236 + if (!access_ok(user_fences, nfences * sizeof(*user_fences))) 2237 + return -EFAULT; 2246 2238 2247 - fences = kvmalloc_array(nfences, sizeof(*fences), 2248 - __GFP_NOWARN | GFP_KERNEL); 2249 - if (!fences) 2250 - return ERR_PTR(-ENOMEM); 2239 + user_values = u64_to_user_ptr(timeline_fences->values_ptr); 2240 + if (!access_ok(user_values, nfences * sizeof(*user_values))) 2241 + return -EFAULT; 2251 2242 2252 - for (n = 0; n < nfences; n++) { 2253 - struct drm_i915_gem_exec_fence fence; 2243 + f = krealloc(eb->fences, 2244 + (eb->num_fences + nfences) * sizeof(*f), 2245 + __GFP_NOWARN | GFP_KERNEL); 2246 + if (!f) 2247 + return -ENOMEM; 2248 + 2249 + eb->fences = f; 2250 + f += eb->num_fences; 2251 + 2252 + BUILD_BUG_ON(~(ARCH_KMALLOC_MINALIGN - 1) & 2253 + ~__I915_EXEC_FENCE_UNKNOWN_FLAGS); 2254 + 2255 + while (nfences--) { 2256 + struct drm_i915_gem_exec_fence user_fence; 2254 2257 struct drm_syncobj *syncobj; 2258 + struct dma_fence *fence = NULL; 2259 + u64 point; 2255 2260 2256 - if (__copy_from_user(&fence, user++, sizeof(fence))) { 2257 - err = -EFAULT; 2258 - goto err; 2259 - } 2261 + if (__copy_from_user(&user_fence, 2262 + user_fences++, 2263 + sizeof(user_fence))) 2264 + return -EFAULT; 2260 2265 2261 - if (fence.flags & __I915_EXEC_FENCE_UNKNOWN_FLAGS) { 2262 - err = -EINVAL; 2263 - goto err; 2264 - } 2266 + if (user_fence.flags & __I915_EXEC_FENCE_UNKNOWN_FLAGS) 2267 + return -EINVAL; 2265 2268 2266 - syncobj = drm_syncobj_find(file, fence.handle); 2269 + if (__get_user(point, user_values++)) 2270 + return -EFAULT; 2271 + 2272 + syncobj = drm_syncobj_find(eb->file, user_fence.handle); 2267 2273 if (!syncobj) { 2268 2274 DRM_DEBUG("Invalid syncobj handle provided\n"); 2269 - err = -ENOENT; 2270 - goto err; 2275 + return -ENOENT; 2276 + } 2277 + 2278 + fence = drm_syncobj_fence_get(syncobj); 2279 + 2280 + if (!fence && user_fence.flags && 2281 + !(user_fence.flags & I915_EXEC_FENCE_SIGNAL)) { 2282 + DRM_DEBUG("Syncobj handle has no fence\n"); 2283 + drm_syncobj_put(syncobj); 2284 + return -EINVAL; 2285 + } 2286 + 2287 + if (fence) 2288 + err = dma_fence_chain_find_seqno(&fence, point); 2289 + 2290 + if (err && !(user_fence.flags & I915_EXEC_FENCE_SIGNAL)) { 2291 + DRM_DEBUG("Syncobj handle missing requested point %llu\n", point); 2292 + drm_syncobj_put(syncobj); 2293 + return err; 2294 + } 2295 + 2296 + /* 2297 + * A point might have been signaled already and 2298 + * garbage collected from the timeline. In this case 2299 + * just ignore the point and carry on. 2300 + */ 2301 + if (!fence && !(user_fence.flags & I915_EXEC_FENCE_SIGNAL)) { 2302 + drm_syncobj_put(syncobj); 2303 + continue; 2304 + } 2305 + 2306 + /* 2307 + * For timeline syncobjs we need to preallocate chains for 2308 + * later signaling. 2309 + */ 2310 + if (point != 0 && user_fence.flags & I915_EXEC_FENCE_SIGNAL) { 2311 + /* 2312 + * Waiting and signaling the same point (when point != 2313 + * 0) would break the timeline. 2314 + */ 2315 + if (user_fence.flags & I915_EXEC_FENCE_WAIT) { 2316 + DRM_DEBUG("Trying to wait & signal the same timeline point.\n"); 2317 + dma_fence_put(fence); 2318 + drm_syncobj_put(syncobj); 2319 + return -EINVAL; 2320 + } 2321 + 2322 + f->chain_fence = 2323 + kmalloc(sizeof(*f->chain_fence), 2324 + GFP_KERNEL); 2325 + if (!f->chain_fence) { 2326 + drm_syncobj_put(syncobj); 2327 + dma_fence_put(fence); 2328 + return -ENOMEM; 2329 + } 2330 + } else { 2331 + f->chain_fence = NULL; 2332 + } 2333 + 2334 + f->syncobj = ptr_pack_bits(syncobj, user_fence.flags, 2); 2335 + f->dma_fence = fence; 2336 + f->value = point; 2337 + f++; 2338 + eb->num_fences++; 2339 + } 2340 + 2341 + return 0; 2342 + } 2343 + 2344 + static int add_fence_array(struct i915_execbuffer *eb) 2345 + { 2346 + struct drm_i915_gem_execbuffer2 *args = eb->args; 2347 + struct drm_i915_gem_exec_fence __user *user; 2348 + unsigned long num_fences = args->num_cliprects; 2349 + struct eb_fence *f; 2350 + 2351 + if (!(args->flags & I915_EXEC_FENCE_ARRAY)) 2352 + return 0; 2353 + 2354 + if (!num_fences) 2355 + return 0; 2356 + 2357 + /* Check multiplication overflow for access_ok() and kvmalloc_array() */ 2358 + BUILD_BUG_ON(sizeof(size_t) > sizeof(unsigned long)); 2359 + if (num_fences > min_t(unsigned long, 2360 + ULONG_MAX / sizeof(*user), 2361 + SIZE_MAX / sizeof(*f) - eb->num_fences)) 2362 + return -EINVAL; 2363 + 2364 + user = u64_to_user_ptr(args->cliprects_ptr); 2365 + if (!access_ok(user, num_fences * sizeof(*user))) 2366 + return -EFAULT; 2367 + 2368 + f = krealloc(eb->fences, 2369 + (eb->num_fences + num_fences) * sizeof(*f), 2370 + __GFP_NOWARN | GFP_KERNEL); 2371 + if (!f) 2372 + return -ENOMEM; 2373 + 2374 + eb->fences = f; 2375 + f += eb->num_fences; 2376 + while (num_fences--) { 2377 + struct drm_i915_gem_exec_fence user_fence; 2378 + struct drm_syncobj *syncobj; 2379 + struct dma_fence *fence = NULL; 2380 + 2381 + if (__copy_from_user(&user_fence, user++, sizeof(user_fence))) 2382 + return -EFAULT; 2383 + 2384 + if (user_fence.flags & __I915_EXEC_FENCE_UNKNOWN_FLAGS) 2385 + return -EINVAL; 2386 + 2387 + syncobj = drm_syncobj_find(eb->file, user_fence.handle); 2388 + if (!syncobj) { 2389 + DRM_DEBUG("Invalid syncobj handle provided\n"); 2390 + return -ENOENT; 2391 + } 2392 + 2393 + if (user_fence.flags & I915_EXEC_FENCE_WAIT) { 2394 + fence = drm_syncobj_fence_get(syncobj); 2395 + if (!fence) { 2396 + DRM_DEBUG("Syncobj handle has no fence\n"); 2397 + drm_syncobj_put(syncobj); 2398 + return -EINVAL; 2399 + } 2271 2400 } 2272 2401 2273 2402 BUILD_BUG_ON(~(ARCH_KMALLOC_MINALIGN - 1) & 2274 2403 ~__I915_EXEC_FENCE_UNKNOWN_FLAGS); 2275 2404 2276 - fences[n] = ptr_pack_bits(syncobj, fence.flags, 2); 2405 + f->syncobj = ptr_pack_bits(syncobj, user_fence.flags, 2); 2406 + f->dma_fence = fence; 2407 + f->value = 0; 2408 + f->chain_fence = NULL; 2409 + f++; 2410 + eb->num_fences++; 2277 2411 } 2278 2412 2279 - return fences; 2280 - 2281 - err: 2282 - __free_fence_array(fences, n); 2283 - return ERR_PTR(err); 2413 + return 0; 2284 2414 } 2285 2415 2286 - static void 2287 - put_fence_array(struct drm_i915_gem_execbuffer2 *args, 2288 - struct drm_syncobj **fences) 2416 + static void put_fence_array(struct eb_fence *fences, int num_fences) 2289 2417 { 2290 2418 if (fences) 2291 - __free_fence_array(fences, args->num_cliprects); 2419 + __free_fence_array(fences, num_fences); 2292 2420 } 2293 2421 2294 2422 static int 2295 - await_fence_array(struct i915_execbuffer *eb, 2296 - struct drm_syncobj **fences) 2423 + await_fence_array(struct i915_execbuffer *eb) 2297 2424 { 2298 - const unsigned int nfences = eb->args->num_cliprects; 2299 2425 unsigned int n; 2300 2426 int err; 2301 2427 2302 - for (n = 0; n < nfences; n++) { 2428 + for (n = 0; n < eb->num_fences; n++) { 2303 2429 struct drm_syncobj *syncobj; 2304 - struct dma_fence *fence; 2305 2430 unsigned int flags; 2306 2431 2307 - syncobj = ptr_unpack_bits(fences[n], &flags, 2); 2308 - if (!(flags & I915_EXEC_FENCE_WAIT)) 2432 + syncobj = ptr_unpack_bits(eb->fences[n].syncobj, &flags, 2); 2433 + 2434 + if (!eb->fences[n].dma_fence) 2309 2435 continue; 2310 2436 2311 - fence = drm_syncobj_fence_get(syncobj); 2312 - if (!fence) 2313 - return -EINVAL; 2314 - 2315 - err = i915_request_await_dma_fence(eb->request, fence); 2316 - dma_fence_put(fence); 2437 + err = i915_request_await_dma_fence(eb->request, 2438 + eb->fences[n].dma_fence); 2317 2439 if (err < 0) 2318 2440 return err; 2319 2441 } ··· 2455 2309 return 0; 2456 2310 } 2457 2311 2458 - static void 2459 - signal_fence_array(struct i915_execbuffer *eb, 2460 - struct drm_syncobj **fences) 2312 + static void signal_fence_array(const struct i915_execbuffer *eb) 2461 2313 { 2462 - const unsigned int nfences = eb->args->num_cliprects; 2463 2314 struct dma_fence * const fence = &eb->request->fence; 2464 2315 unsigned int n; 2465 2316 2466 - for (n = 0; n < nfences; n++) { 2317 + for (n = 0; n < eb->num_fences; n++) { 2467 2318 struct drm_syncobj *syncobj; 2468 2319 unsigned int flags; 2469 2320 2470 - syncobj = ptr_unpack_bits(fences[n], &flags, 2); 2321 + syncobj = ptr_unpack_bits(eb->fences[n].syncobj, &flags, 2); 2471 2322 if (!(flags & I915_EXEC_FENCE_SIGNAL)) 2472 2323 continue; 2473 2324 2474 - drm_syncobj_replace_fence(syncobj, fence); 2325 + if (eb->fences[n].chain_fence) { 2326 + drm_syncobj_add_point(syncobj, 2327 + eb->fences[n].chain_fence, 2328 + fence, 2329 + eb->fences[n].value); 2330 + /* 2331 + * The chain's ownership is transferred to the 2332 + * timeline. 2333 + */ 2334 + eb->fences[n].chain_fence = NULL; 2335 + } else { 2336 + drm_syncobj_replace_fence(syncobj, fence); 2337 + } 2475 2338 } 2339 + } 2340 + 2341 + static int 2342 + parse_timeline_fences(struct i915_user_extension __user *ext, void *data) 2343 + { 2344 + struct i915_execbuffer *eb = data; 2345 + struct drm_i915_gem_execbuffer_ext_timeline_fences timeline_fences; 2346 + 2347 + if (copy_from_user(&timeline_fences, ext, sizeof(timeline_fences))) 2348 + return -EFAULT; 2349 + 2350 + return add_timeline_fence_array(eb, &timeline_fences); 2476 2351 } 2477 2352 2478 2353 static void retire_requests(struct intel_timeline *tl, struct i915_request *end) ··· 2537 2370 mutex_unlock(&tl->mutex); 2538 2371 } 2539 2372 2373 + static const i915_user_extension_fn execbuf_extensions[] = { 2374 + [DRM_I915_GEM_EXECBUFFER_EXT_TIMELINE_FENCES] = parse_timeline_fences, 2375 + }; 2376 + 2377 + static int 2378 + parse_execbuf2_extensions(struct drm_i915_gem_execbuffer2 *args, 2379 + struct i915_execbuffer *eb) 2380 + { 2381 + if (!(args->flags & I915_EXEC_USE_EXTENSIONS)) 2382 + return 0; 2383 + 2384 + /* The execbuf2 extension mechanism reuses cliprects_ptr. So we cannot 2385 + * have another flag also using it at the same time. 2386 + */ 2387 + if (eb->args->flags & I915_EXEC_FENCE_ARRAY) 2388 + return -EINVAL; 2389 + 2390 + if (args->num_cliprects != 0) 2391 + return -EINVAL; 2392 + 2393 + return i915_user_extensions(u64_to_user_ptr(args->cliprects_ptr), 2394 + execbuf_extensions, 2395 + ARRAY_SIZE(execbuf_extensions), 2396 + eb); 2397 + } 2398 + 2540 2399 static int 2541 2400 i915_gem_do_execbuffer(struct drm_device *dev, 2542 2401 struct drm_file *file, 2543 2402 struct drm_i915_gem_execbuffer2 *args, 2544 - struct drm_i915_gem_exec_object2 *exec, 2545 - struct drm_syncobj **fences) 2403 + struct drm_i915_gem_exec_object2 *exec) 2546 2404 { 2547 2405 struct drm_i915_private *i915 = to_i915(dev); 2548 2406 struct i915_execbuffer eb; ··· 2597 2405 eb.batch_len = args->batch_len; 2598 2406 eb.trampoline = NULL; 2599 2407 2408 + eb.fences = NULL; 2409 + eb.num_fences = 0; 2410 + 2600 2411 eb.batch_flags = 0; 2601 2412 if (args->flags & I915_EXEC_SECURE) { 2602 2413 if (INTEL_GEN(i915) >= 11) ··· 2617 2422 if (args->flags & I915_EXEC_IS_PINNED) 2618 2423 eb.batch_flags |= I915_DISPATCH_PINNED; 2619 2424 2425 + err = parse_execbuf2_extensions(args, &eb); 2426 + if (err) 2427 + goto err_ext; 2428 + 2429 + err = add_fence_array(&eb); 2430 + if (err) 2431 + goto err_ext; 2432 + 2620 2433 #define IN_FENCES (I915_EXEC_FENCE_IN | I915_EXEC_FENCE_SUBMIT) 2621 2434 if (args->flags & IN_FENCES) { 2622 2435 if ((args->flags & IN_FENCES) == IN_FENCES) 2623 2436 return -EINVAL; 2624 2437 2625 2438 in_fence = sync_file_get_fence(lower_32_bits(args->rsvd2)); 2626 - if (!in_fence) 2627 - return -EINVAL; 2439 + if (!in_fence) { 2440 + err = -EINVAL; 2441 + goto err_ext; 2442 + } 2628 2443 } 2629 2444 #undef IN_FENCES 2630 2445 ··· 2744 2539 goto err_request; 2745 2540 } 2746 2541 2747 - if (fences) { 2748 - err = await_fence_array(&eb, fences); 2542 + if (eb.fences) { 2543 + err = await_fence_array(&eb); 2749 2544 if (err) 2750 2545 goto err_request; 2751 2546 } ··· 2776 2571 i915_request_get(eb.request); 2777 2572 eb_request_add(&eb); 2778 2573 2779 - if (fences) 2780 - signal_fence_array(&eb, fences); 2574 + if (eb.fences) 2575 + signal_fence_array(&eb); 2781 2576 2782 2577 if (out_fence) { 2783 2578 if (err == 0) { ··· 2810 2605 put_unused_fd(out_fence_fd); 2811 2606 err_in_fence: 2812 2607 dma_fence_put(in_fence); 2608 + err_ext: 2609 + put_fence_array(eb.fences, eb.num_fences); 2813 2610 return err; 2814 2611 } 2815 2612 ··· 2906 2699 exec2_list[i].flags = 0; 2907 2700 } 2908 2701 2909 - err = i915_gem_do_execbuffer(dev, file, &exec2, exec2_list, NULL); 2702 + err = i915_gem_do_execbuffer(dev, file, &exec2, exec2_list); 2910 2703 if (exec2.flags & __EXEC_HAS_RELOC) { 2911 2704 struct drm_i915_gem_exec_object __user *user_exec_list = 2912 2705 u64_to_user_ptr(args->buffers_ptr); ··· 2938 2731 struct drm_i915_private *i915 = to_i915(dev); 2939 2732 struct drm_i915_gem_execbuffer2 *args = data; 2940 2733 struct drm_i915_gem_exec_object2 *exec2_list; 2941 - struct drm_syncobj **fences = NULL; 2942 2734 const size_t count = args->buffer_count; 2943 2735 int err; 2944 2736 ··· 2965 2759 return -EFAULT; 2966 2760 } 2967 2761 2968 - if (args->flags & I915_EXEC_FENCE_ARRAY) { 2969 - fences = get_fence_array(args, file); 2970 - if (IS_ERR(fences)) { 2971 - kvfree(exec2_list); 2972 - return PTR_ERR(fences); 2973 - } 2974 - } 2975 - 2976 - err = i915_gem_do_execbuffer(dev, file, args, exec2_list, fences); 2762 + err = i915_gem_do_execbuffer(dev, file, args, exec2_list); 2977 2763 2978 2764 /* 2979 2765 * Now that we have begun execution of the batchbuffer, we ignore ··· 3006 2808 } 3007 2809 3008 2810 args->flags &= ~__I915_EXEC_UNKNOWN_FLAGS; 3009 - put_fence_array(args, fences); 3010 2811 kvfree(exec2_list); 3011 2812 return err; 3012 2813 }
+1 -1
drivers/gpu/drm/i915/gt/intel_lrc.c
··· 4555 4555 vf_flush_wa = true; 4556 4556 4557 4557 /* WaForGAMHang:kbl */ 4558 - if (IS_KBL_REVID(request->engine->i915, 0, KBL_REVID_B0)) 4558 + if (IS_KBL_GT_REVID(request->engine->i915, 0, KBL_REVID_B0)) 4559 4559 dc_flush_wa = true; 4560 4560 } 4561 4561
+78 -35
drivers/gpu/drm/i915/gt/intel_workarounds.c
··· 52 52 * - Public functions to init or apply the given workaround type. 53 53 */ 54 54 55 + /* 56 + * KBL revision ID ordering is bizarre; higher revision ID's map to lower 57 + * steppings in some cases. So rather than test against the revision ID 58 + * directly, let's map that into our own range of increasing ID's that we 59 + * can test against in a regular manner. 60 + */ 61 + 62 + const struct i915_rev_steppings kbl_revids[] = { 63 + [0] = { .gt_stepping = KBL_REVID_A0, .disp_stepping = KBL_REVID_A0 }, 64 + [1] = { .gt_stepping = KBL_REVID_B0, .disp_stepping = KBL_REVID_B0 }, 65 + [2] = { .gt_stepping = KBL_REVID_C0, .disp_stepping = KBL_REVID_B0 }, 66 + [3] = { .gt_stepping = KBL_REVID_D0, .disp_stepping = KBL_REVID_B0 }, 67 + [4] = { .gt_stepping = KBL_REVID_F0, .disp_stepping = KBL_REVID_C0 }, 68 + [5] = { .gt_stepping = KBL_REVID_C0, .disp_stepping = KBL_REVID_B1 }, 69 + [6] = { .gt_stepping = KBL_REVID_D1, .disp_stepping = KBL_REVID_B1 }, 70 + [7] = { .gt_stepping = KBL_REVID_G0, .disp_stepping = KBL_REVID_C0 }, 71 + }; 72 + 55 73 static void wa_init_start(struct i915_wa_list *wal, const char *name, const char *engine_name) 56 74 { 57 75 wal->name = name; ··· 488 470 gen9_ctx_workarounds_init(engine, wal); 489 471 490 472 /* WaToEnableHwFixForPushConstHWBug:kbl */ 491 - if (IS_KBL_REVID(i915, KBL_REVID_C0, REVID_FOREVER)) 473 + if (IS_KBL_GT_REVID(i915, KBL_REVID_C0, REVID_FOREVER)) 492 474 WA_SET_BIT_MASKED(COMMON_SLICE_CHICKEN2, 493 475 GEN8_SBE_DISABLE_REPLAY_BUF_OPTIMIZATION); 494 476 ··· 614 596 wa_masked_en(wal, GEN9_ROW_CHICKEN4, GEN11_DIS_PICK_2ND_EU); 615 597 } 616 598 617 - static void tgl_ctx_workarounds_init(struct intel_engine_cs *engine, 618 - struct i915_wa_list *wal) 599 + static void gen12_ctx_workarounds_init(struct intel_engine_cs *engine, 600 + struct i915_wa_list *wal) 619 601 { 620 602 /* 621 603 * Wa_1409142259:tgl ··· 625 607 * Wa_1409207793:tgl 626 608 * Wa_1409178076:tgl 627 609 * Wa_1408979724:tgl 610 + * Wa_14010443199:rkl 611 + * Wa_14010698770:rkl 628 612 */ 629 613 WA_SET_BIT_MASKED(GEN11_COMMON_SLICE_CHICKEN3, 630 614 GEN12_DISABLE_CPS_AWARE_COLOR_PIPE); 631 615 616 + /* WaDisableGPGPUMidThreadPreemption:gen12 */ 617 + WA_SET_FIELD_MASKED(GEN8_CS_CHICKEN1, 618 + GEN9_PREEMPT_GPGPU_LEVEL_MASK, 619 + GEN9_PREEMPT_GPGPU_THREAD_GROUP_LEVEL); 620 + } 621 + 622 + static void tgl_ctx_workarounds_init(struct intel_engine_cs *engine, 623 + struct i915_wa_list *wal) 624 + { 625 + gen12_ctx_workarounds_init(engine, wal); 626 + 632 627 /* 633 - * Wa_1604555607:gen12 and Wa_1608008084:gen12 628 + * Wa_1604555607:tgl,rkl 629 + * 630 + * Note that the implementation of this workaround is further modified 631 + * according to the FF_MODE2 guidance given by Wa_1608008084:gen12. 634 632 * FF_MODE2 register will return the wrong value when read. The default 635 633 * value for this register is zero for all fields and there are no bit 636 634 * masks. So instead of doing a RMW we should just write the GS Timer ··· 657 623 FF_MODE2_GS_TIMER_MASK | FF_MODE2_TDS_TIMER_MASK, 658 624 FF_MODE2_GS_TIMER_224 | FF_MODE2_TDS_TIMER_128, 659 625 0); 660 - 661 - /* WaDisableGPGPUMidThreadPreemption:tgl */ 662 - WA_SET_FIELD_MASKED(GEN8_CS_CHICKEN1, 663 - GEN9_PREEMPT_GPGPU_LEVEL_MASK, 664 - GEN9_PREEMPT_GPGPU_THREAD_GROUP_LEVEL); 665 626 } 666 627 667 628 static void ··· 671 642 672 643 wa_init_start(wal, name, engine->name); 673 644 674 - if (IS_GEN(i915, 12)) 645 + if (IS_ROCKETLAKE(i915) || IS_TIGERLAKE(i915)) 675 646 tgl_ctx_workarounds_init(engine, wal); 647 + else if (IS_GEN(i915, 12)) 648 + gen12_ctx_workarounds_init(engine, wal); 676 649 else if (IS_GEN(i915, 11)) 677 650 icl_ctx_workarounds_init(engine, wal); 678 651 else if (IS_CANNONLAKE(i915)) ··· 1026 995 gen9_gt_workarounds_init(i915, wal); 1027 996 1028 997 /* WaDisableDynamicCreditSharing:kbl */ 1029 - if (IS_KBL_REVID(i915, 0, KBL_REVID_B0)) 998 + if (IS_KBL_GT_REVID(i915, 0, KBL_REVID_B0)) 1030 999 wa_write_or(wal, 1031 1000 GAMT_CHKN_BIT_REG, 1032 1001 GAMT_CHKN_DISABLE_DYNAMIC_CREDIT_SHARING); ··· 1207 1176 } 1208 1177 1209 1178 static void 1210 - tgl_gt_workarounds_init(struct drm_i915_private *i915, struct i915_wa_list *wal) 1179 + gen12_gt_workarounds_init(struct drm_i915_private *i915, 1180 + struct i915_wa_list *wal) 1211 1181 { 1212 1182 wa_init_mcr(i915, wal); 1183 + } 1184 + 1185 + static void 1186 + tgl_gt_workarounds_init(struct drm_i915_private *i915, struct i915_wa_list *wal) 1187 + { 1188 + gen12_gt_workarounds_init(i915, wal); 1213 1189 1214 1190 /* Wa_1409420604:tgl */ 1215 1191 if (IS_TGL_REVID(i915, TGL_REVID_A0, TGL_REVID_A0)) ··· 1234 1196 static void 1235 1197 gt_init_workarounds(struct drm_i915_private *i915, struct i915_wa_list *wal) 1236 1198 { 1237 - if (IS_GEN(i915, 12)) 1199 + if (IS_TIGERLAKE(i915)) 1238 1200 tgl_gt_workarounds_init(i915, wal); 1201 + else if (IS_GEN(i915, 12)) 1202 + gen12_gt_workarounds_init(i915, wal); 1239 1203 else if (IS_GEN(i915, 11)) 1240 1204 icl_gt_workarounds_init(i915, wal); 1241 1205 else if (IS_CANNONLAKE(i915)) ··· 1670 1630 GEN12_DISABLE_POSH_BUSY_FF_DOP_CG); 1671 1631 1672 1632 /* 1673 - * Wa_1607030317:tgl 1674 - * Wa_1607186500:tgl 1675 - * Wa_1607297627:tgl there is 3 entries for this WA on BSpec, 2 1676 - * of then says it is fixed on B0 the other one says it is 1677 - * permanent 1678 - */ 1679 - wa_masked_en(wal, 1680 - GEN6_RC_SLEEP_PSMI_CONTROL, 1681 - GEN12_WAIT_FOR_EVENT_POWER_DOWN_DISABLE | 1682 - GEN8_RC_SEMA_IDLE_MSG_DISABLE); 1683 - 1684 - /* 1685 1633 * Wa_1606679103:tgl 1686 1634 * (see also Wa_1606682166:icl) 1687 1635 */ ··· 1682 1654 VSUNIT_CLKGATE_DIS_TGL); 1683 1655 } 1684 1656 1685 - if (IS_TIGERLAKE(i915)) { 1686 - /* Wa_1606931601:tgl */ 1657 + if (IS_ROCKETLAKE(i915) || IS_TIGERLAKE(i915)) { 1658 + /* Wa_1606931601:tgl,rkl */ 1687 1659 wa_masked_en(wal, GEN7_ROW_CHICKEN2, GEN12_DISABLE_EARLY_READ); 1688 1660 1689 - /* Wa_1409804808:tgl */ 1661 + /* Wa_1409804808:tgl,rkl */ 1690 1662 wa_masked_en(wal, GEN7_ROW_CHICKEN2, 1691 1663 GEN12_PUSH_CONST_DEREF_HOLD_DIS); 1692 1664 1693 - /* Wa_1606700617:tgl */ 1694 - wa_masked_en(wal, 1695 - GEN9_CS_DEBUG_MODE1, 1696 - FF_DOP_CLOCK_GATE_DISABLE); 1697 - 1698 1665 /* 1699 1666 * Wa_1409085225:tgl 1700 - * Wa_14010229206:tgl 1667 + * Wa_14010229206:tgl,rkl 1701 1668 */ 1702 1669 wa_masked_en(wal, GEN9_ROW_CHICKEN4, GEN12_DISABLE_TDL_PUSH); 1703 1670 ··· 1700 1677 * Wa_1407928979:tgl A* 1701 1678 * Wa_18011464164:tgl B0+ 1702 1679 * Wa_22010931296:tgl B0+ 1680 + * Wa_14010919138:rkl 1703 1681 */ 1704 1682 wa_write_or(wal, GEN7_FF_THREAD_MODE, 1705 1683 GEN12_FF_TESSELATION_DOP_GATE_DISABLE); 1684 + 1685 + /* 1686 + * Wa_1607030317:tgl 1687 + * Wa_1607186500:tgl 1688 + * Wa_1607297627:tgl,rkl there are multiple entries for this 1689 + * WA in the BSpec; some indicate this is an A0-only WA, 1690 + * others indicate it applies to all steppings. 1691 + */ 1692 + wa_masked_en(wal, 1693 + GEN6_RC_SLEEP_PSMI_CONTROL, 1694 + GEN12_WAIT_FOR_EVENT_POWER_DOWN_DISABLE | 1695 + GEN8_RC_SEMA_IDLE_MSG_DISABLE); 1696 + } 1697 + 1698 + if (IS_TIGERLAKE(i915)) { 1699 + /* Wa_1606700617:tgl */ 1700 + wa_masked_en(wal, 1701 + GEN9_CS_DEBUG_MODE1, 1702 + FF_DOP_CLOCK_GATE_DISABLE); 1706 1703 } 1707 1704 1708 1705 if (IS_GEN(i915, 11)) { ··· 1941 1898 struct drm_i915_private *i915 = engine->i915; 1942 1899 1943 1900 /* WaKBLVECSSemaphoreWaitPoll:kbl */ 1944 - if (IS_KBL_REVID(i915, KBL_REVID_A0, KBL_REVID_E0)) { 1901 + if (IS_KBL_GT_REVID(i915, KBL_REVID_A0, KBL_REVID_E0)) { 1945 1902 wa_write(wal, 1946 1903 RING_SEMA_WAIT_POLL(engine->mmio_base), 1947 1904 1);
+4 -1
drivers/gpu/drm/i915/gt/selftest_engine_heartbeat.c
··· 47 47 48 48 static void pulse_free(struct kref *kref) 49 49 { 50 - kfree(container_of(kref, struct pulse, kref)); 50 + struct pulse *p = container_of(kref, typeof(*p), kref); 51 + 52 + i915_active_fini(&p->active); 53 + kfree(p); 51 54 } 52 55 53 56 static void pulse_put(struct pulse *p)
+2 -2
drivers/gpu/drm/i915/gt/selftest_rps.c
··· 700 700 f = act; /* may skip ahead [pcu granularity] */ 701 701 } 702 702 703 - err = -EINVAL; 703 + err = -EINTR; /* ignore error, continue on with test */ 704 704 } 705 705 706 706 err_vma: ··· 841 841 f = act; /* may skip ahead [pcu granularity] */ 842 842 } 843 843 844 - err = -EINVAL; 844 + err = -EINTR; /* ignore error, continue on with test */ 845 845 } 846 846 847 847 err_vma:
+13 -11
drivers/gpu/drm/i915/gt/selftest_timeline.c
··· 491 491 if (IS_ERR(tl)) 492 492 return tl; 493 493 494 - if (*tl->hwsp_seqno != tl->seqno) { 494 + if (READ_ONCE(*tl->hwsp_seqno) != tl->seqno) { 495 495 pr_err("Timeline created with incorrect breadcrumb, found %x, expected %x\n", 496 496 *tl->hwsp_seqno, tl->seqno); 497 497 intel_timeline_put(tl); ··· 561 561 for (n = 0; n < count; n++) { 562 562 struct intel_timeline *tl = timelines[n]; 563 563 564 - if (!err && *tl->hwsp_seqno != n) { 565 - pr_err("Invalid seqno stored in timeline %lu @ %x, found 0x%x\n", 566 - n, tl->hwsp_offset, *tl->hwsp_seqno); 564 + if (!err && READ_ONCE(*tl->hwsp_seqno) != n) { 565 + GEM_TRACE_ERR("Invalid seqno:%lu stored in timeline %llu @ %x, found 0x%x\n", 566 + n, tl->fence_context, tl->hwsp_offset, *tl->hwsp_seqno); 567 567 GEM_TRACE_DUMP(); 568 568 err = -EINVAL; 569 569 } ··· 633 633 for (n = 0; n < count; n++) { 634 634 struct intel_timeline *tl = timelines[n]; 635 635 636 - if (!err && *tl->hwsp_seqno != n) { 637 - pr_err("Invalid seqno stored in timeline %lu @ %x, found 0x%x\n", 638 - n, tl->hwsp_offset, *tl->hwsp_seqno); 636 + if (!err && READ_ONCE(*tl->hwsp_seqno) != n) { 637 + GEM_TRACE_ERR("Invalid seqno:%lu stored in timeline %llu @ %x, found 0x%x\n", 638 + n, tl->fence_context, tl->hwsp_offset, *tl->hwsp_seqno); 639 639 GEM_TRACE_DUMP(); 640 640 err = -EINVAL; 641 641 } ··· 733 733 goto out; 734 734 } 735 735 736 - if (*hwsp_seqno[0] != seqno[0] || *hwsp_seqno[1] != seqno[1]) { 736 + if (READ_ONCE(*hwsp_seqno[0]) != seqno[0] || 737 + READ_ONCE(*hwsp_seqno[1]) != seqno[1]) { 737 738 pr_err("Bad timeline values: found (%x, %x), expected (%x, %x)\n", 738 739 *hwsp_seqno[0], *hwsp_seqno[1], 739 740 seqno[0], seqno[1]); ··· 967 966 break; 968 967 } 969 968 970 - if (*tl->hwsp_seqno != count) { 971 - pr_err("Invalid seqno stored in timeline %lu @ tl->hwsp_offset, found 0x%x\n", 972 - count, *tl->hwsp_seqno); 969 + if (READ_ONCE(*tl->hwsp_seqno) != count) { 970 + GEM_TRACE_ERR("Invalid seqno:%lu stored in timeline %llu @ %x found 0x%x\n", 971 + count, tl->fence_context, 972 + tl->hwsp_offset, *tl->hwsp_seqno); 973 973 GEM_TRACE_DUMP(); 974 974 err = -EINVAL; 975 975 }
+2 -2
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c
··· 51 51 * Note that RKL uses the same firmware as TGL. 52 52 */ 53 53 #define INTEL_UC_FIRMWARE_DEFS(fw_def, guc_def, huc_def) \ 54 - fw_def(ROCKETLAKE, 0, guc_def(tgl, 35, 2, 0), huc_def(tgl, 7, 0, 12)) \ 55 - fw_def(TIGERLAKE, 0, guc_def(tgl, 35, 2, 0), huc_def(tgl, 7, 0, 12)) \ 54 + fw_def(ROCKETLAKE, 0, guc_def(tgl, 35, 2, 0), huc_def(tgl, 7, 5, 0)) \ 55 + fw_def(TIGERLAKE, 0, guc_def(tgl, 35, 2, 0), huc_def(tgl, 7, 5, 0)) \ 56 56 fw_def(ELKHARTLAKE, 0, guc_def(ehl, 33, 0, 4), huc_def(ehl, 9, 0, 0)) \ 57 57 fw_def(ICELAKE, 0, guc_def(icl, 33, 0, 0), huc_def(icl, 9, 0, 0)) \ 58 58 fw_def(COMETLAKE, 5, guc_def(cml, 33, 0, 0), huc_def(cml, 4, 0, 0)) \
+2 -5
drivers/gpu/drm/i915/i915_active.c
··· 758 758 intel_engine_mask_t tmp, mask = engine->mask; 759 759 struct llist_node *first = NULL, *last = NULL; 760 760 struct intel_gt *gt = engine->gt; 761 - int err; 762 761 763 762 GEM_BUG_ON(i915_active_is_idle(ref)); 764 763 ··· 780 781 node = reuse_idle_barrier(ref, idx); 781 782 if (!node) { 782 783 node = kmem_cache_alloc(global.slab_cache, GFP_KERNEL); 783 - if (!node) { 784 - err = ENOMEM; 784 + if (!node) 785 785 goto unwind; 786 - } 787 786 788 787 RCU_INIT_POINTER(node->base.fence, NULL); 789 788 node->base.cb.func = node_retire; ··· 829 832 830 833 kmem_cache_free(global.slab_cache, node); 831 834 } 832 - return err; 835 + return -ENOMEM; 833 836 } 834 837 835 838 void i915_active_acquire_barrier(struct i915_active *ref)
+10 -4
drivers/gpu/drm/i915/i915_cmd_parser.c
··· 1204 1204 return dst; 1205 1205 } 1206 1206 1207 + static inline bool cmd_desc_is(const struct drm_i915_cmd_descriptor * const desc, 1208 + const u32 cmd) 1209 + { 1210 + return desc->cmd.value == (cmd & desc->cmd.mask); 1211 + } 1212 + 1207 1213 static bool check_cmd(const struct intel_engine_cs *engine, 1208 1214 const struct drm_i915_cmd_descriptor *desc, 1209 1215 const u32 *cmd, u32 length) ··· 1248 1242 * allowed mask/value pair given in the whitelist entry. 1249 1243 */ 1250 1244 if (reg->mask) { 1251 - if (desc->cmd.value == MI_LOAD_REGISTER_MEM) { 1245 + if (cmd_desc_is(desc, MI_LOAD_REGISTER_MEM)) { 1252 1246 DRM_DEBUG("CMD: Rejected LRM to masked register 0x%08X\n", 1253 1247 reg_addr); 1254 1248 return false; 1255 1249 } 1256 1250 1257 - if (desc->cmd.value == MI_LOAD_REGISTER_REG) { 1251 + if (cmd_desc_is(desc, MI_LOAD_REGISTER_REG)) { 1258 1252 DRM_DEBUG("CMD: Rejected LRR to masked register 0x%08X\n", 1259 1253 reg_addr); 1260 1254 return false; 1261 1255 } 1262 1256 1263 - if (desc->cmd.value == MI_LOAD_REGISTER_IMM(1) && 1257 + if (cmd_desc_is(desc, MI_LOAD_REGISTER_IMM(1)) && 1264 1258 (offset + 2 > length || 1265 1259 (cmd[offset + 1] & reg->mask) != reg->value)) { 1266 1260 DRM_DEBUG("CMD: Rejected LRI to masked register 0x%08X\n", ··· 1484 1478 break; 1485 1479 } 1486 1480 1487 - if (desc->cmd.value == MI_BATCH_BUFFER_START) { 1481 + if (cmd_desc_is(desc, MI_BATCH_BUFFER_START)) { 1488 1482 ret = check_bbstart(cmd, offset, length, batch_length, 1489 1483 batch_addr, shadow_addr, 1490 1484 jump_whitelist);
+3 -2
drivers/gpu/drm/i915/i915_drv.c
··· 392 392 pre |= IS_HSW_EARLY_SDV(dev_priv); 393 393 pre |= IS_SKL_REVID(dev_priv, 0, SKL_REVID_F0); 394 394 pre |= IS_BXT_REVID(dev_priv, 0, BXT_REVID_B_LAST); 395 - pre |= IS_KBL_REVID(dev_priv, 0, KBL_REVID_A0); 395 + pre |= IS_KBL_GT_REVID(dev_priv, 0, KBL_REVID_A0); 396 396 pre |= IS_GLK_REVID(dev_priv, 0, GLK_REVID_A2); 397 397 398 398 if (pre) { ··· 1846 1846 */ 1847 1847 .driver_features = 1848 1848 DRIVER_GEM | 1849 - DRIVER_RENDER | DRIVER_MODESET | DRIVER_ATOMIC | DRIVER_SYNCOBJ, 1849 + DRIVER_RENDER | DRIVER_MODESET | DRIVER_ATOMIC | DRIVER_SYNCOBJ | 1850 + DRIVER_SYNCOBJ_TIMELINE, 1850 1851 .release = i915_driver_release, 1851 1852 .open = i915_driver_open, 1852 1853 .lastclose = i915_driver_lastclose,
+45 -9
drivers/gpu/drm/i915/i915_drv.h
··· 108 108 109 109 #define DRIVER_NAME "i915" 110 110 #define DRIVER_DESC "Intel Graphics" 111 - #define DRIVER_DATE "20200715" 112 - #define DRIVER_TIMESTAMP 1594811881 111 + #define DRIVER_DATE "20200824" 112 + #define DRIVER_TIMESTAMP 1598293597 113 113 114 114 struct drm_i915_gem_object; 115 115 ··· 506 506 bool link_standby; 507 507 bool colorimetry_support; 508 508 bool psr2_enabled; 509 + bool psr2_sel_fetch_enabled; 509 510 u8 sink_sync_latency; 510 511 ktime_t last_entry_attempt; 511 512 ktime_t last_exit; ··· 1046 1045 struct intel_l3_parity l3_parity; 1047 1046 1048 1047 /* 1048 + * HTI (aka HDPORT) state read during initial hw readout. Most 1049 + * platforms don't have HTI, so this will just stay 0. Those that do 1050 + * will use this later to figure out which PLLs and PHYs are unavailable 1051 + * for driver usage. 1052 + */ 1053 + u32 hti_state; 1054 + 1055 + /* 1049 1056 * edram size in MB. 1050 1057 * Cannot be determined by PCIID. You must always read a register. 1051 1058 */ ··· 1498 1489 #define IS_ICL_WITH_PORT_F(dev_priv) \ 1499 1490 IS_SUBPLATFORM(dev_priv, INTEL_ICELAKE, INTEL_SUBPLATFORM_PORTF) 1500 1491 1492 + #define IS_TGL_U(dev_priv) \ 1493 + IS_SUBPLATFORM(dev_priv, INTEL_TIGERLAKE, INTEL_SUBPLATFORM_ULT) 1494 + 1495 + #define IS_TGL_Y(dev_priv) \ 1496 + IS_SUBPLATFORM(dev_priv, INTEL_TIGERLAKE, INTEL_SUBPLATFORM_ULX) 1497 + 1501 1498 #define SKL_REVID_A0 0x0 1502 1499 #define SKL_REVID_B0 0x1 1503 1500 #define SKL_REVID_C0 0x2 ··· 1524 1509 #define IS_BXT_REVID(dev_priv, since, until) \ 1525 1510 (IS_BROXTON(dev_priv) && IS_REVID(dev_priv, since, until)) 1526 1511 1527 - #define KBL_REVID_A0 0x0 1528 - #define KBL_REVID_B0 0x1 1529 - #define KBL_REVID_C0 0x2 1530 - #define KBL_REVID_D0 0x3 1531 - #define KBL_REVID_E0 0x4 1512 + enum { 1513 + KBL_REVID_A0, 1514 + KBL_REVID_B0, 1515 + KBL_REVID_B1, 1516 + KBL_REVID_C0, 1517 + KBL_REVID_D0, 1518 + KBL_REVID_D1, 1519 + KBL_REVID_E0, 1520 + KBL_REVID_F0, 1521 + KBL_REVID_G0, 1522 + }; 1532 1523 1533 - #define IS_KBL_REVID(dev_priv, since, until) \ 1534 - (IS_KABYLAKE(dev_priv) && IS_REVID(dev_priv, since, until)) 1524 + struct i915_rev_steppings { 1525 + u8 gt_stepping; 1526 + u8 disp_stepping; 1527 + }; 1528 + 1529 + /* Defined in intel_workarounds.c */ 1530 + extern const struct i915_rev_steppings kbl_revids[]; 1531 + 1532 + #define IS_KBL_GT_REVID(dev_priv, since, until) \ 1533 + (IS_KABYLAKE(dev_priv) && \ 1534 + kbl_revids[INTEL_REVID(dev_priv)].gt_stepping >= since && \ 1535 + kbl_revids[INTEL_REVID(dev_priv)].gt_stepping <= until) 1536 + #define IS_KBL_DISP_REVID(dev_priv, since, until) \ 1537 + (IS_KABYLAKE(dev_priv) && \ 1538 + kbl_revids[INTEL_REVID(dev_priv)].disp_stepping >= since && \ 1539 + kbl_revids[INTEL_REVID(dev_priv)].disp_stepping <= until) 1535 1540 1536 1541 #define GLK_REVID_A0 0x0 1537 1542 #define GLK_REVID_A1 0x1 ··· 1700 1665 #define HAS_PSR(dev_priv) (INTEL_INFO(dev_priv)->display.has_psr) 1701 1666 #define HAS_PSR_HW_TRACKING(dev_priv) \ 1702 1667 (INTEL_INFO(dev_priv)->display.has_psr_hw_tracking) 1668 + #define HAS_PSR2_SEL_FETCH(dev_priv) (INTEL_GEN(dev_priv) >= 12) 1703 1669 #define HAS_TRANSCODER(dev_priv, trans) ((INTEL_INFO(dev_priv)->cpu_transcoder_mask & BIT(trans)) != 0) 1704 1670 1705 1671 #define HAS_RC6(dev_priv) (INTEL_INFO(dev_priv)->has_rc6)
+1
drivers/gpu/drm/i915/i915_getparam.c
··· 132 132 case I915_PARAM_HAS_EXEC_BATCH_FIRST: 133 133 case I915_PARAM_HAS_EXEC_FENCE_ARRAY: 134 134 case I915_PARAM_HAS_EXEC_SUBMIT_FENCE: 135 + case I915_PARAM_HAS_EXEC_TIMELINE_FENCES: 135 136 /* For the time being all of these are always true; 136 137 * if some supported hardware does not have one of these 137 138 * features this value needs to be provided from
+5
drivers/gpu/drm/i915/i915_params.c
··· 102 102 "is helpful to detect if PSR issues are related to bad values set in " 103 103 " VBT. (0=use VBT parameters, 1=use safest parameters)"); 104 104 105 + i915_param_named_unsafe(enable_psr2_sel_fetch, bool, 0400, 106 + "Enable PSR2 selective fetch " 107 + "(0=disabled, 1=enabled) " 108 + "Default: 0"); 109 + 105 110 i915_param_named_unsafe(force_probe, charp, 0400, 106 111 "Force probe the driver for specified devices. " 107 112 "See CONFIG_DRM_I915_FORCE_PROBE for details.");
+1
drivers/gpu/drm/i915/i915_params.h
··· 54 54 param(int, enable_fbc, -1, 0600) \ 55 55 param(int, enable_psr, -1, 0600) \ 56 56 param(bool, psr_safest_params, false, 0600) \ 57 + param(bool, enable_psr2_sel_fetch, false, 0600) \ 57 58 param(int, disable_power_well, -1, 0400) \ 58 59 param(int, enable_ips, 1, 0600) \ 59 60 param(int, invert_brightness, 0, 0600) \
+1
drivers/gpu/drm/i915/i915_pci.c
··· 890 890 .cpu_transcoder_mask = BIT(TRANSCODER_A) | BIT(TRANSCODER_B) | 891 891 BIT(TRANSCODER_C), 892 892 .require_force_probe = 1, 893 + .display.has_hti = 1, 893 894 .display.has_psr_hw_tracking = 0, 894 895 .platform_engine_mask = 895 896 BIT(RCS0) | BIT(BCS0) | BIT(VECS0) | BIT(VCS0),
+28 -4
drivers/gpu/drm/i915/i915_reg.h
··· 1898 1898 #define PWR_DOWN_LN_3_1_0 (0xb << 4) 1899 1899 #define PWR_DOWN_LN_MASK (0xf << 4) 1900 1900 #define PWR_DOWN_LN_SHIFT 4 1901 + #define EDP4K2K_MODE_OVRD_EN (1 << 3) 1902 + #define EDP4K2K_MODE_OVRD_OPTIMIZED (1 << 2) 1901 1903 1902 1904 #define ICL_PORT_CL_DW12(phy) _MMIO(_ICL_PORT_CL_DW(12, phy)) 1903 1905 #define ICL_LANE_ENABLE_AUX (1 << 0) ··· 2920 2918 #define MBUS_UBOX_CTL _MMIO(0x4503C) 2921 2919 #define MBUS_BBOX_CTL_S1 _MMIO(0x45040) 2922 2920 #define MBUS_BBOX_CTL_S2 _MMIO(0x45044) 2921 + 2922 + #define HDPORT_STATE _MMIO(0x45050) 2923 + #define HDPORT_DPLL_USED_MASK REG_GENMASK(14, 12) 2924 + #define HDPORT_PHY_USED_DP(phy) REG_BIT(2 * (phy) + 2) 2925 + #define HDPORT_PHY_USED_HDMI(phy) REG_BIT(2 * (phy) + 1) 2926 + #define HDPORT_ENABLED REG_BIT(0) 2923 2927 2924 2928 /* Make render/texture TLB fetches lower priorty than associated data 2925 2929 * fetches. This is not turned on by default ··· 7878 7870 # define CHICKEN3_DGMG_DONE_FIX_DISABLE (1 << 2) 7879 7871 7880 7872 #define CHICKEN_PAR1_1 _MMIO(0x42080) 7873 + #define DIS_RAM_BYPASS_PSR2_MAN_TRACK (1 << 16) 7881 7874 #define SKL_DE_COMPRESSED_HASH_MODE (1 << 15) 7882 7875 #define DPA_MASK_VBLANK_SRD (1 << 15) 7883 7876 #define FORCE_ARB_IDLE_PLANES (1 << 14) ··· 8720 8711 #define PCH_GMBUSUNIT_CLOCK_GATE_DISABLE (1 << 31) 8721 8712 #define PCH_DPLUNIT_CLOCK_GATE_DISABLE (1 << 30) 8722 8713 #define PCH_DPLSUNIT_CLOCK_GATE_DISABLE (1 << 29) 8714 + #define PCH_DPMGUNIT_CLOCK_GATE_DISABLE (1 << 15) 8723 8715 #define PCH_CPUNIT_CLOCK_GATE_DISABLE (1 << 14) 8724 8716 #define CNP_PWM_CGE_GATING_DISABLE (1 << 13) 8725 8717 #define PCH_LP_PARTITION_LEVEL_DISABLE (1 << 12) ··· 9227 9217 #define DISPLAY_IPS_CONTROL 0x19 9228 9218 #define TGL_PCODE_TCCOLD 0x26 9229 9219 #define TGL_PCODE_EXIT_TCCOLD_DATA_L_EXIT_FAILED REG_BIT(0) 9230 - #define TGL_PCODE_EXIT_TCCOLD_DATA_H_BLOCK_REQ 0 9231 - #define TGL_PCODE_EXIT_TCCOLD_DATA_H_UNBLOCK_REQ REG_BIT(0) 9220 + #define TGL_PCODE_EXIT_TCCOLD_DATA_L_BLOCK_REQ 0 9221 + #define TGL_PCODE_EXIT_TCCOLD_DATA_L_UNBLOCK_REQ REG_BIT(0) 9232 9222 /* See also IPS_CTL */ 9233 9223 #define IPS_PCODE_CONTROL (1 << 30) 9234 9224 #define HSW_PCODE_DYNAMIC_DUTY_CYCLE_CONTROL 0x1A ··· 10287 10277 10288 10278 #define ICL_DPCLKA_CFGCR0 _MMIO(0x164280) 10289 10279 #define ICL_DPCLKA_CFGCR0_DDI_CLK_OFF(phy) (1 << _PICK(phy, 10, 11, 24)) 10280 + #define RKL_DPCLKA_CFGCR0_DDI_CLK_OFF(phy) REG_BIT((phy) + 10) 10290 10281 #define ICL_DPCLKA_CFGCR0_TC_CLK_OFF(tc_port) (1 << ((tc_port) < PORT_TC4 ? \ 10291 10282 (tc_port) + 12 : \ 10292 10283 (tc_port) - PORT_TC4 + 21)) 10293 10284 #define ICL_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy) ((phy) * 2) 10294 10285 #define ICL_DPCLKA_CFGCR0_DDI_CLK_SEL_MASK(phy) (3 << ICL_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy)) 10295 10286 #define ICL_DPCLKA_CFGCR0_DDI_CLK_SEL(pll, phy) ((pll) << ICL_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy)) 10287 + #define RKL_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy) _PICK(phy, 0, 2, 4, 27) 10288 + #define RKL_DPCLKA_CFGCR0_DDI_CLK_SEL_MASK(phy) \ 10289 + (3 << RKL_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy)) 10290 + #define RKL_DPCLKA_CFGCR0_DDI_CLK_SEL(pll, phy) \ 10291 + ((pll) << RKL_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy)) 10296 10292 10297 10293 /* CNL PLL */ 10298 10294 #define DPLL0_ENABLE 0x46010 ··· 10519 10503 10520 10504 #define _TGL_DPLL0_CFGCR0 0x164284 10521 10505 #define _TGL_DPLL1_CFGCR0 0x16428C 10522 - /* TODO: add DPLL4 */ 10523 10506 #define _TGL_TBTPLL_CFGCR0 0x16429C 10524 10507 #define TGL_DPLL_CFGCR0(pll) _MMIO_PLL3(pll, _TGL_DPLL0_CFGCR0, \ 10525 10508 _TGL_DPLL1_CFGCR0, \ 10526 10509 _TGL_TBTPLL_CFGCR0) 10510 + #define RKL_DPLL_CFGCR0(pll) _MMIO_PLL(pll, _TGL_DPLL0_CFGCR0, \ 10511 + _TGL_DPLL1_CFGCR0) 10527 10512 10528 10513 #define _TGL_DPLL0_CFGCR1 0x164288 10529 10514 #define _TGL_DPLL1_CFGCR1 0x164290 10530 - /* TODO: add DPLL4 */ 10531 10515 #define _TGL_TBTPLL_CFGCR1 0x1642A0 10532 10516 #define TGL_DPLL_CFGCR1(pll) _MMIO_PLL3(pll, _TGL_DPLL0_CFGCR1, \ 10533 10517 _TGL_DPLL1_CFGCR1, \ 10534 10518 _TGL_TBTPLL_CFGCR1) 10519 + #define RKL_DPLL_CFGCR1(pll) _MMIO_PLL(pll, _TGL_DPLL0_CFGCR1, \ 10520 + _TGL_DPLL1_CFGCR1) 10535 10521 10536 10522 #define _DKL_PHY1_BASE 0x168000 10537 10523 #define _DKL_PHY2_BASE 0x169000 ··· 12353 12335 #define DSB_CTRL(pipe, id) _MMIO(DSBSL_INSTANCE(pipe, id) + 0x8) 12354 12336 #define DSB_ENABLE (1 << 31) 12355 12337 #define DSB_STATUS (1 << 0) 12338 + 12339 + #define TGL_ROOT_DEVICE_ID 0x9A00 12340 + #define TGL_ROOT_DEVICE_MASK 0xFF00 12341 + #define TGL_ROOT_DEVICE_SKU_MASK 0xF 12342 + #define TGL_ROOT_DEVICE_SKU_ULX 0x2 12343 + #define TGL_ROOT_DEVICE_SKU_ULT 0x4 12356 12344 12357 12345 #endif /* _I915_REG_H_ */
+2 -5
drivers/gpu/drm/i915/i915_request.c
··· 1783 1783 * but at a cost of spending more power processing the workload 1784 1784 * (bad for battery). 1785 1785 */ 1786 - if (flags & I915_WAIT_PRIORITY) { 1787 - if (!i915_request_started(rq) && 1788 - INTEL_GEN(rq->engine->i915) >= 6) 1789 - intel_rps_boost(rq); 1790 - } 1786 + if (flags & I915_WAIT_PRIORITY && !i915_request_started(rq)) 1787 + intel_rps_boost(rq); 1791 1788 1792 1789 wait.tsk = current; 1793 1790 if (dma_fence_add_callback(&rq->fence, &wait.cb, request_wait_wake))
+19
drivers/gpu/drm/i915/intel_device_info.c
··· 346 346 mask = BIT(INTEL_SUBPLATFORM_PORTF); 347 347 } 348 348 349 + if (IS_TIGERLAKE(i915)) { 350 + struct pci_dev *root, *pdev = i915->drm.pdev; 351 + 352 + root = list_first_entry(&pdev->bus->devices, typeof(*root), bus_list); 353 + 354 + drm_WARN_ON(&i915->drm, mask); 355 + drm_WARN_ON(&i915->drm, (root->device & TGL_ROOT_DEVICE_MASK) != 356 + TGL_ROOT_DEVICE_ID); 357 + 358 + switch (root->device & TGL_ROOT_DEVICE_SKU_MASK) { 359 + case TGL_ROOT_DEVICE_SKU_ULX: 360 + mask = BIT(INTEL_SUBPLATFORM_ULX); 361 + break; 362 + case TGL_ROOT_DEVICE_SKU_ULT: 363 + mask = BIT(INTEL_SUBPLATFORM_ULT); 364 + break; 365 + } 366 + } 367 + 349 368 GEM_BUG_ON(mask & ~INTEL_SUBPLATFORM_BITS); 350 369 351 370 RUNTIME_INFO(i915)->platform_mask[pi] |= mask;
+1
drivers/gpu/drm/i915/intel_device_info.h
··· 146 146 func(has_gmch); \ 147 147 func(has_hdcp); \ 148 148 func(has_hotplug); \ 149 + func(has_hti); \ 149 150 func(has_ipc); \ 150 151 func(has_modular_fia); \ 151 152 func(has_overlay); \
+6 -8
drivers/gpu/drm/i915/intel_pm.c
··· 100 100 */ 101 101 I915_WRITE(DISP_ARB_CTL, I915_READ(DISP_ARB_CTL) | 102 102 DISP_FBC_MEMORY_WAKE); 103 - 104 - if (IS_SKYLAKE(dev_priv)) { 105 - /* WaDisableDopClockGating */ 106 - I915_WRITE(GEN7_MISCCPCTL, I915_READ(GEN7_MISCCPCTL) 107 - & ~GEN7_DOP_CLOCK_GATE_ENABLE); 108 - } 109 103 } 110 104 111 105 static void bxt_init_clock_gating(struct drm_i915_private *dev_priv) ··· 7217 7223 gen9_init_clock_gating(dev_priv); 7218 7224 7219 7225 /* WaDisableSDEUnitClockGating:kbl */ 7220 - if (IS_KBL_REVID(dev_priv, 0, KBL_REVID_B0)) 7226 + if (IS_KBL_GT_REVID(dev_priv, 0, KBL_REVID_B0)) 7221 7227 I915_WRITE(GEN8_UCGCTL6, I915_READ(GEN8_UCGCTL6) | 7222 7228 GEN8_SDEUNIT_CLOCK_GATE_DISABLE); 7223 7229 7224 7230 /* WaDisableGamClockGating:kbl */ 7225 - if (IS_KBL_REVID(dev_priv, 0, KBL_REVID_B0)) 7231 + if (IS_KBL_GT_REVID(dev_priv, 0, KBL_REVID_B0)) 7226 7232 I915_WRITE(GEN6_UCGCTL1, I915_READ(GEN6_UCGCTL1) | 7227 7233 GEN6_GAMUNIT_CLOCK_GATE_DISABLE); 7228 7234 ··· 7244 7250 static void skl_init_clock_gating(struct drm_i915_private *dev_priv) 7245 7251 { 7246 7252 gen9_init_clock_gating(dev_priv); 7253 + 7254 + /* WaDisableDopClockGating:skl */ 7255 + I915_WRITE(GEN7_MISCCPCTL, I915_READ(GEN7_MISCCPCTL) & 7256 + ~GEN7_DOP_CLOCK_GATE_ENABLE); 7247 7257 7248 7258 /* WAC6entrylatency:skl */ 7249 7259 I915_WRITE(FBC_LLC_READ_CTRL, I915_READ(FBC_LLC_READ_CTRL) |
+1 -1
drivers/gpu/drm/i915/selftests/i915_request.c
··· 331 331 if (!wait) { 332 332 i915_sw_fence_commit(submit); 333 333 heap_fence_put(submit); 334 - err = ENOMEM; 334 + err = -ENOMEM; 335 335 break; 336 336 } 337 337
+1 -3
include/drm/i915_pciids.h
··· 258 258 INTEL_VGA_DEVICE(0x0f30, info), \ 259 259 INTEL_VGA_DEVICE(0x0f31, info), \ 260 260 INTEL_VGA_DEVICE(0x0f32, info), \ 261 - INTEL_VGA_DEVICE(0x0f33, info), \ 262 - INTEL_VGA_DEVICE(0x0157, info), \ 263 - INTEL_VGA_DEVICE(0x0155, info) 261 + INTEL_VGA_DEVICE(0x0f33, info) 264 262 265 263 #define INTEL_BDW_ULT_GT1_IDS(info) \ 266 264 INTEL_VGA_DEVICE(0x1606, info), /* GT1 ULT */ \
+56 -3
include/uapi/drm/i915_drm.h
··· 619 619 */ 620 620 #define I915_PARAM_PERF_REVISION 54 621 621 622 + /* Query whether DRM_I915_GEM_EXECBUFFER2 supports supplying an array of 623 + * timeline syncobj through drm_i915_gem_execbuffer_ext_timeline_fences. See 624 + * I915_EXEC_USE_EXTENSIONS. 625 + */ 626 + #define I915_PARAM_HAS_EXEC_TIMELINE_FENCES 55 627 + 622 628 /* Must be kept compact -- no holes and well documented */ 623 629 624 630 typedef struct drm_i915_getparam { ··· 1052 1046 __u32 flags; 1053 1047 }; 1054 1048 1049 + /** 1050 + * See drm_i915_gem_execbuffer_ext_timeline_fences. 1051 + */ 1052 + #define DRM_I915_GEM_EXECBUFFER_EXT_TIMELINE_FENCES 0 1053 + 1054 + /** 1055 + * This structure describes an array of drm_syncobj and associated points for 1056 + * timeline variants of drm_syncobj. It is invalid to append this structure to 1057 + * the execbuf if I915_EXEC_FENCE_ARRAY is set. 1058 + */ 1059 + struct drm_i915_gem_execbuffer_ext_timeline_fences { 1060 + struct i915_user_extension base; 1061 + 1062 + /** 1063 + * Number of element in the handles_ptr & value_ptr arrays. 1064 + */ 1065 + __u64 fence_count; 1066 + 1067 + /** 1068 + * Pointer to an array of struct drm_i915_gem_exec_fence of length 1069 + * fence_count. 1070 + */ 1071 + __u64 handles_ptr; 1072 + 1073 + /** 1074 + * Pointer to an array of u64 values of length fence_count. Values 1075 + * must be 0 for a binary drm_syncobj. A Value of 0 for a timeline 1076 + * drm_syncobj is invalid as it turns a drm_syncobj into a binary one. 1077 + */ 1078 + __u64 values_ptr; 1079 + }; 1080 + 1055 1081 struct drm_i915_gem_execbuffer2 { 1056 1082 /** 1057 1083 * List of gem_exec_object2 structs ··· 1100 1062 __u32 num_cliprects; 1101 1063 /** 1102 1064 * This is a struct drm_clip_rect *cliprects if I915_EXEC_FENCE_ARRAY 1103 - * is not set. If I915_EXEC_FENCE_ARRAY is set, then this is a 1104 - * struct drm_i915_gem_exec_fence *fences. 1065 + * & I915_EXEC_USE_EXTENSIONS are not set. 1066 + * 1067 + * If I915_EXEC_FENCE_ARRAY is set, then this is a pointer to an array 1068 + * of struct drm_i915_gem_exec_fence and num_cliprects is the length 1069 + * of the array. 1070 + * 1071 + * If I915_EXEC_USE_EXTENSIONS is set, then this is a pointer to a 1072 + * single struct i915_user_extension and num_cliprects is 0. 1105 1073 */ 1106 1074 __u64 cliprects_ptr; 1107 1075 #define I915_EXEC_RING_MASK (0x3f) ··· 1225 1181 */ 1226 1182 #define I915_EXEC_FENCE_SUBMIT (1 << 20) 1227 1183 1228 - #define __I915_EXEC_UNKNOWN_FLAGS (-(I915_EXEC_FENCE_SUBMIT << 1)) 1184 + /* 1185 + * Setting I915_EXEC_USE_EXTENSIONS implies that 1186 + * drm_i915_gem_execbuffer2.cliprects_ptr is treated as a pointer to an linked 1187 + * list of i915_user_extension. Each i915_user_extension node is the base of a 1188 + * larger structure. The list of supported structures are listed in the 1189 + * drm_i915_gem_execbuffer_ext enum. 1190 + */ 1191 + #define I915_EXEC_USE_EXTENSIONS (1 << 21) 1192 + 1193 + #define __I915_EXEC_UNKNOWN_FLAGS (-(I915_EXEC_USE_EXTENSIONS << 1)) 1229 1194 1230 1195 #define I915_EXEC_CONTEXT_ID_MASK (0xffffffff) 1231 1196 #define i915_execbuffer2_set_context_id(eb2, context) \