4.18.8-stable review
Subsystems (4)
Greg Kroah-Hartman
maintainerPATCH 162/197 drm/edid: Quirk Vive Pro VR headset non-desktop.
In reply to Greg Kroah-Hartman4.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lubosz Sarnecki <[email protected]>
commit 6931317c714885f2d792e8150ef6715d416ac681 upstream.
This adds the Vive Pro's EDID information and
sets EDID_QUIRK_NON_DESKTOP.
--- drivers/gpu/drm/drm_edid.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_edid.c +2 -1
@@ -163,8 +163,9 @@ static const struct edid_quirk {/* Rotel RSX-1058 forwards sink's EDID but only does HDMI 1.1*/ { "ETR", 13896, EDID_QUIRK_FORCE_8BPC }, -/* HTC Vive VR Headset */ +/* HTC Vive and Vive Pro VR Headsets */ { "HVR", 0xaa01, EDID_QUIRK_NON_DESKTOP }, + { "HVR", 0xaa02, EDID_QUIRK_NON_DESKTOP },/* Oculus Rift DK1, DK2, and CV1 VR Headsets */ { "OVR", 0x0001, EDID_QUIRK_NON_DESKTOP },
Greg Kroah-Hartman
maintainerPATCH 163/197 drm/edid: Add 6 bpc quirk for SDC panel in Lenovo B50-80
In reply to Greg Kroah-Hartman4.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kai-Heng Feng <[email protected]>
commit 25da75043f8690fd083878447c91f289dfb63b87 upstream.
Another panel that reports "DFP 1.x compliant TMDS" but it supports 6bpc instead of 8 bpc.
Apply 6 bpc quirk for the panel to fix it.
--- drivers/gpu/drm/drm_edid.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/drm_edid.c +3 -0
@@ -116,6 +116,9 @@ static const struct edid_quirk {/* CPT panel of Asus UX303LA reports 8 bpc, but is a 6 bpc panel */ { "CPT", 0x17df, EDID_QUIRK_FORCE_6BPC }, +/* SDC panel of Lenovo B50-80 reports 8 bpc, but is a 6 bpc panel */ + { "SDC", 0x3652, EDID_QUIRK_FORCE_6BPC }, +/* Belinea 10 15 55 */ { "MAX", 1516, EDID_QUIRK_PREFER_LARGE_60 }, { "MAX", 0x77e, EDID_QUIRK_PREFER_LARGE_60 },
Greg Kroah-Hartman
maintainerPATCH 164/197 drm/amd/display: fix type of variable
In reply to Greg Kroah-Hartman4.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gustavo A. R. Silva <[email protected]>
commit fe78627d430435d22316fe39f2012ece31bf23c2 upstream.
Currently, the maximum value that *counter* can reach is 255, and code at line 150: while (counter < 1000) { implies a bigger value could be expected.
Fix this by changing the type of variable *counter* from uint8_t to uint16_t.
Addresses-Coverity-ID: 1470030 ("Operands don't affect result")
--- drivers/gpu/drm/amd/display/dc/dce110/dce110_compressor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dce110/dce110_compressor.c +1 -1
@@ -143,7 +143,7 @@ static void wait_for_fbc_state_changed(struct dce110_compressor *cp110, bool enabled) { - uint8_t counter = 0; + uint16_t counter = 0;uint32_t addr = mmFBC_STATUS;uint32_t value;
Greg Kroah-Hartman
maintainerPATCH 165/197 drm/amd/display: Dont share clk source between DP and HDMI
In reply to Greg Kroah-Hartman4.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikita Lipski <[email protected]>
commit 3e27e10e2ecee0d3a0083f8ae76354ac9c6ad15c upstream.
[why]
Prevent clock source sharing between HDMI and DP connectors. DP shouldn't be sharing its ref clock with phy clock, which caused an issue of older ASICS booting up with multiple diplays plugged in.
[how]
Add an extra check that would prevent HDMI and DP sharing clk.
--- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 22 +++++++++++++++- drivers/gpu/drm/amd/display/dc/dc.h | 1 drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c | 2 - drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c | 3 ++ 4 files changed, 26 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +21 -1
@@ -330,6 +330,9 @@ bool resource_are_streams_timing_synchro != stream2->timing.pix_clk_khz)return false; +if (stream1->clamping.c_depth != stream2->clamping.c_depth) +return false; +if (stream1->phy_pix_clk != stream2->phy_pix_clk && (!dc_is_dp_signal (stream1->signal) || !dc_is_dp_signal (stream2->signal)))
@@ -337,6 +340,20 @@ bool resource_are_streams_timing_synchroreturn true; } +static bool is_dp_and_hdmi_sharable ( +struct dc_stream_state *stream1, +struct dc_stream_state *stream2) +{ +if (stream1->ctx->dc->caps.disable_dp_clk_share) +return false; + +if (stream1->clamping.c_depth !=COLOR_DEPTH_888 || + stream2->clamping.c_depth !=COLOR_DEPTH_888 ) +return false; + +return true; + +} static bool is_sharable_clk_src( const struct pipe_ctx *pipe_with_clk_src,
@@ -348,7 +365,10 @@ static bool is_sharable_clk_src(if (pipe_with_clk_src->stream->signal ==SIGNAL_TYPE_VIRTUAL )return false; -if (dc_is_dp_signal (pipe_with_clk_src->stream->signal)) +if (dc_is_dp_signal (pipe_with_clk_src->stream->signal) || + (dc_is_dp_signal (pipe->stream->signal) && + !is_dp_and_hdmi_sharable (pipe_with_clk_src->stream, + pipe->stream)))return false; if (dc_is_hdmi_signal(pipe_with_clk_src->stream->signal)
drivers/gpu/drm/amd/display/dc/dc.h +1 -0
@@ -77,6 +77,7 @@ struct dc_caps {bool dual_link_dvi;bool post_blend_color_processing;bool force_dp_tps4_for_cp2520; +bool disable_dp_clk_share; };struct dc_dcc_surface_param {
drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c +1 -1
@@ -884,7 +884,7 @@ static bool construct( dc->caps.i2c_speed_in_khz =40 ; dc->caps.max_cursor_size =128 ; dc->caps.dual_link_dvi = true; - + dc->caps.disable_dp_clk_share = true;for (i =0 ; i < pool->base.pipe_count; i++) { pool->base.timing_generators[i] = dce100_timing_generator_create(
drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c +3 -0
@@ -902,6 +902,7 @@ static bool dce80_construct( } dc->caps.max_planes = pool->base.pipe_count; + dc->caps.disable_dp_clk_share = true;if (!resource_construct (num_virtual_links, dc, &pool->base, &res_create_funcs))
@@ -1087,6 +1088,7 @@ static bool dce81_construct( } dc->caps.max_planes = pool->base.pipe_count; + dc->caps.disable_dp_clk_share = true;if (!resource_construct (num_virtual_links, dc, &pool->base, &res_create_funcs))
@@ -1268,6 +1270,7 @@ static bool dce83_construct( } dc->caps.max_planes = pool->base.pipe_count; + dc->caps.disable_dp_clk_share = true;if (!resource_construct (num_virtual_links, dc, &pool->base, &res_create_funcs))
Greg Kroah-Hartman
maintainerPATCH 166/197 drm/amd/display: update clk for various HDMI color depths
In reply to Greg Kroah-Hartman4.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikita Lipski <[email protected]>
commit 81aca8e75c1b046865fb2badef95a0dcff6f73de upstream.
[why]
When programming tonga's connector's backend we didn't take in account that HDMI's colour depth might be more than 8bpc therefore we need to add a switch statement that would adjust the pixel clock accordingly.
[how]
Add a switch statement updating clock by its appropriate coefficient.
--- drivers/gpu/drm/amd/display/dc/bios/command_table.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/gpu/drm/amd/display/dc/bios/command_table.c +18 -0
@@ -808,6 +808,24 @@ static enum bp_result transmitter_contro* (=1: 8bpp, =1.25: 10bpp, =1.5:12bpp, =2: 16bpp) * LVDS mode: usPixelClock = pixel clock */ +if (cntl->signal ==SIGNAL_TYPE_HDMI_TYPE_A ) { +switch (cntl->color_depth) { +case COLOR_DEPTH_101010 : + params.usSymClock = +cpu_to_le16 ((le16_to_cpu (params.usSymClock) *30 ) /24 ); +break ; +case COLOR_DEPTH_121212 : + params.usSymClock = +cpu_to_le16 ((le16_to_cpu (params.usSymClock) *36 ) /24 ); +break ; +case COLOR_DEPTH_161616 : + params.usSymClock = +cpu_to_le16 ((le16_to_cpu (params.usSymClock) *48 ) /24 ); +break ; +default : +break ; + } + }if (EXEC_BIOS_CMD_TABLE (UNIPHYTransmitterControl, params)) result =BP_RESULT_OK ;
Greg Kroah-Hartman
maintainerPATCH 167/197 drm/amd/display: Use requested HDMI aspect ratio
In reply to Greg Kroah-Hartman4.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leo (Sunpeng) Li <[email protected]>
commit e11d41472a50742c16d53c968e143fb498fa482f upstream.
[Why]
The DRM mode's HDMI picture aspect ratio field was never saved in dc_stream's timing struct. This causes us to mistake a new stream to have the same timings as the old, even though the user has requested a different aspect ratio.
[How]
Save DRM's aspect ratio field within dc_stream's timing struct.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -7
@@ -2124,13 +2124,8 @@ convert_color_depth_from_display_info(costatic enum dc_aspect_ratio get_aspect_ratio (const struct drm_display_mode *mode_in) { -int32_t width = mode_in->crtc_hdisplay *9 ; -int32_t height = mode_in->crtc_vdisplay *16 ; - -if ((width - height) <10 && (width - height) >-10 ) -return ASPECT_RATIO_16_9 ; -else -return ASPECT_RATIO_4_3 ; +/* 1-1 mapping, since both enums follow the HDMI spec. */ +return (enum dc_aspect_ratio ) mode_in->picture_aspect_ratio; } static enum dc_color_space
Greg Kroah-Hartman
maintainerPATCH 168/197 drm/amd/display: Report non-DP display as disconnected without EDID
In reply to Greg Kroah-Hartman4.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Harry Wentland <[email protected]>
commit 01dc285d5cd89b77686d8baef8482c58d7dc3ead upstream.
[Why]
Some boards seem to have a problem where HPD is high on HDMI even though no display is connected. We don't want to report these as connected. DP spec still requires us to report DP displays as connected when HPD is high but we can't read the EDID in order to go to fail-safe mode.
[How]
If connector_signal is not DP abort detection if we can't retrieve the EDID.
v2: Add Bugzilla and stable
Bugzilla: https://bugs.freedesktop.org/107390
Bugzilla: https://bugs.freedesktop.org/106846
--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +11 -0
@@ -728,6 +728,17 @@ bool dc_link_detect(struct dc_link *linkbreak ;case EDID_NO_RESPONSE :DC_LOG_ERROR ("No EDID read.\n" ); + +/* +* Abort detection for non-DP connectors if we have +* no EDID +* +* DP needs to report as connected if HDP is high +* even if we have no EDID in order to go to +* fail-safe mode +*/ +if (!dc_is_dp_signal (link->connector_signal)) +return false;default :break ; }
Greg Kroah-Hartman
maintainerPATCH 169/197 drm/rockchip: lvds: add missing of_node_put
In reply to Greg Kroah-Hartman4.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Julia Lawall <[email protected]>
commit ebfb081edc8afd250a6d290c37481bfb2262e7cb upstream.
The device node iterators perform an of_node_get on each iteration, so a jump out of the loop requires an of_node_put.
The semantic patch that fixes this problem is as follows
(http://coccinelle.lip6.fr):
// <smpl>
@@
expression root,e;
local idexpression child;
iterator name for_each_child_of_node;
@@
for_each_child_of_node(root, child) {
... when != of_node_put(child)
when != e = child
+ of_node_put(child);
? break;
...
}
... when != child
// </smpl>
--- drivers/gpu/drm/rockchip/rockchip_lvds.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/rockchip/rockchip_lvds.c +3 -1
@@ -363,8 +363,10 @@ static int rockchip_lvds_bind(struct devof_property_read_u32 (endpoint,"reg" , &endpoint_id); ret =drm_of_find_panel_or_bridge (dev->of_node,1 , endpoint_id, &lvds->panel, &lvds->bridge); -if (!ret) +if (!ret) { +of_node_put (endpoint);break ; + } }if (!child_count) {DRM_DEV_ERROR (dev,"lvds port does not have any children\n" );
Greg Kroah-Hartman
maintainerPATCH 170/197 drm/rockchip: vop: split out core clock enablement into separate functions
In reply to Greg Kroah-Hartman4.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Stuebner <[email protected]>
commit e2810a7167df14c762e085fae5aade38425b71bf upstream.
Judging from the iommu code, both the hclk and aclk are necessary for register access. Split them off into separate functions from the regular vop enablement, so that we can use them elsewhere as well.
--- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 44 +++++++++++++++++++--------- 1 file changed, 31 insertions(+), 13 deletions(-)
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +31 -13
@@ -486,6 +486,31 @@ static void vop_line_flag_irq_disable(stspin_unlock_irqrestore (&vop->irq_lock, flags); } +static int vop_core_clks_enable (struct vop *vop) +{ +int ret; + + ret =clk_enable (vop->hclk); +if (ret <0 ) +return ret; + + ret =clk_enable (vop->aclk); +if (ret <0 ) + goto err_disable_hclk; + +return 0 ; + +err_disable_hclk: +clk_disable (vop->hclk); +return ret; +} + +static void vop_core_clks_disable (struct vop *vop) +{ +clk_disable (vop->aclk); +clk_disable (vop->hclk); +} +static int vop_enable (struct drm_crtc *crtc) {struct vop *vop =to_vop (crtc);
@@ -497,17 +522,13 @@ static int vop_enable(struct drm_crtc *creturn ret; } - ret =clk_enable (vop->hclk); + ret =vop_core_clks_enable (vop);if (WARN_ON (ret <0 )) goto err_put_pm_runtime; ret =clk_enable (vop->dclk);if (WARN_ON (ret <0 )) - goto err_disable_hclk; - - ret =clk_enable (vop->aclk); -if (WARN_ON (ret <0 )) - goto err_disable_dclk; + goto err_disable_core;/* * Slave iommu shares power, irq and clock with vop. It was associated
@@ -519,7 +540,7 @@ static int vop_enable(struct drm_crtc *cif (ret) {DRM_DEV_ERROR (vop->dev,"failed to attach dma mapping, %d\n" , ret); - goto err_disable_aclk; + goto err_disable_dclk; }spin_lock (&vop->reg_lock);
@@ -558,12 +579,10 @@ static int vop_enable(struct drm_crtc *creturn 0 ; -err_disable_aclk: -clk_disable (vop->aclk); err_disable_dclk:clk_disable (vop->dclk); -err_disable_hclk: -clk_disable (vop->hclk); +err_disable_core: +vop_core_clks_disable (vop); err_put_pm_runtime:pm_runtime_put_sync (vop->dev);return ret;
@@ -609,8 +628,7 @@ static void vop_crtc_atomic_disable(strurockchip_drm_dma_detach_device (vop->drm_dev, vop->dev);clk_disable (vop->dclk); -clk_disable (vop->aclk); -clk_disable (vop->hclk); +vop_core_clks_disable (vop);pm_runtime_put (vop->dev);mutex_unlock (&vop->vop_lock);
Greg Kroah-Hartman
maintainerPATCH 171/197 drm/rockchip: vop: fix irq disabled after vop driver probed
In reply to Greg Kroah-Hartman4.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sandy Huang <[email protected]>
commit 6456314ff1de246414a43e3132075b70b3e050ac upstream.
The vop irq is shared between vop and iommu and irq probing in the iommu driver moved to the probe function recently. This can in some cases lead to a stall if the irq is triggered while the vop driver still has it disabled, but the vop irq handler gets called.
But there is no real need to disable the irq, as the vop can simply also track its enabled state and ignore irqs in that case. For this we can simply check the power-domain state of the vop, similar to how the iommu driver does it.
So remove the enable/disable handling and add appropriate condition to the irq handler.
changes in v2:
- move to just check the power-domain state
- add clock handling
changes in v3:
- clarify comment to speak of runtime-pm not power-domain changes in v4:
- address Marc's comments (clk-enable WARN_ON and style improvement)
--- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-)
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +17 -8
@@ -573,8 +573,6 @@ static int vop_enable(struct drm_crtc *cspin_unlock (&vop->reg_lock); -enable_irq (vop->irq); -drm_crtc_vblank_on (crtc);return 0 ;
@@ -618,8 +616,6 @@ static void vop_crtc_atomic_disable(struvop_dsp_hold_valid_irq_disable (vop); -disable_irq (vop->irq); - vop->is_enabled = false;/*
@@ -1196,6 +1192,18 @@ static irqreturn_t vop_isr(int irq, voidint ret =IRQ_NONE ;/* +* The irq is shared with the iommu. If the runtime-pm state of the +* vop-device is disabled the irq has to be targeted at the iommu. +*/ +if (!pm_runtime_get_if_in_use (vop->dev)) +return IRQ_NONE ; + +if (vop_core_clks_enable (vop)) { +DRM_DEV_ERROR_RATELIMITED (vop->dev,"couldn't enable clocks\n" ); + goto out; + } + +/* * interrupt register has interrupt status, enable and clear bits, we * must hold irq_lock to avoid a race with enable/disable_vblank(). */
@@ -1210,7 +1218,7 @@ static irqreturn_t vop_isr(int irq, void/* This is expected for vop iommu irqs, since the irq is shared */ if (!active_irqs) -return IRQ_NONE ; + goto out_disable;if (active_irqs &DSP_HOLD_VALID_INTR ) {complete (&vop->dsp_hold_completion);
@@ -1236,6 +1244,10 @@ static irqreturn_t vop_isr(int irq, voidDRM_DEV_ERROR (vop->dev,"Unknown VOP IRQs: %#02x\n" , active_irqs); +out_disable: +vop_core_clks_disable (vop); +out: +pm_runtime_put (vop->dev);return ret; }
@@ -1614,9 +1626,6 @@ static int vop_bind(struct device *dev,if (ret) goto err_disable_pm_runtime; -/* IRQ is initially disabled; it gets enabled in power_on */ -disable_irq (vop->irq); -return 0 ; err_disable_pm_runtime:
Greg Kroah-Hartman
maintainerPATCH 172/197 drm/amd/display: Pass connector id when executing VBIOS CT
In reply to Greg Kroah-Hartman4.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikita Lipski <[email protected]>
commit 433149130c31de3f63b17b4ce08b45dab208f7e8 upstream.
[why]
Older ASICs require both phys_id and connector_id to execute bios command table. If we are not passing the right connector_id - it can lead to a black screen.
[how]
Set connector_obj_id when executing vbios command table
--- drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c +2 -2
@@ -919,7 +919,7 @@ void dce110_link_encoder_enable_tmds_outenum bp_result result;/* Enable the PHY */ - + cntl.connector_obj_id = enc110->base.connector; cntl.action =TRANSMITTER_CONTROL_ENABLE ; cntl.engine_id = enc->preferred_engine; cntl.transmitter = enc110->base.transmitter;
@@ -961,7 +961,7 @@ void dce110_link_encoder_enable_dp_outpu* We need to set number of lanes manually. */ configure_encoder (enc110, link_settings); - + cntl.connector_obj_id = enc110->base.connector; cntl.action =TRANSMITTER_CONTROL_ENABLE ; cntl.engine_id = enc->preferred_engine; cntl.transmitter = enc110->base.transmitter;
Greg Kroah-Hartman
maintainerPATCH 173/197 drm/amd/display: Check if clock source in use before disabling
In reply to Greg Kroah-Hartman4.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikita Lipski <[email protected]>
commit ad8960a6cb06c446d0a391ce095f6f28edf36aff upstream.
[why]
We are disabling clock source while other pipes are still using it, because we don't verify the number of pipes that share it.
[how]
- Adding a function in resources to return the number of pipes sharing the clock source.
- Checking that no one is sharing the clock source before disabling
--- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 46 ++++++++---- drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c | 4 - drivers/gpu/drm/amd/display/dc/inc/resource.h | 5 + 3 files changed, 40 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +32 -14
@@ -268,24 +268,30 @@ bool resource_construct(return true; } +static int find_matching_clock_source ( +const struct resource_pool *pool, +struct clock_source *clock_source) +{ +int i; + +for (i =0 ; i < pool->clk_src_count; i++) { +if (pool->clock_sources[i] == clock_source) +return i; + } +return -1 ; +}void resource_unreference_clock_source (struct resource_context *res_ctx,const struct resource_pool *pool,struct clock_source *clock_source) { -int i; - -for (i =0 ; i < pool->clk_src_count; i++) { -if (pool->clock_sources[i] != clock_source) -continue ; +int i =find_matching_clock_source (pool, clock_source); +if (i >-1 ) res_ctx->clock_source_ref_count[i]--; -break ; - } -if (pool->dp_clock_source == clock_source) res_ctx->dp_clock_source_ref_count--; }
@@ -295,19 +301,31 @@ void resource_reference_clock_source(const struct resource_pool *pool, struct clock_source *clock_source) { - int i; -for (i =0 ; i < pool->clk_src_count; i++) { -if (pool->clock_sources[i] != clock_source) -continue ; + int i = find_matching_clock_source(pool, clock_source); +if (i >-1 ) res_ctx->clock_source_ref_count[i]++; -break ; - }if (pool->dp_clock_source == clock_source) res_ctx->dp_clock_source_ref_count++; } +int resource_get_clock_source_reference ( +struct resource_context *res_ctx, +const struct resource_pool *pool, +struct clock_source *clock_source) +{ +int i =find_matching_clock_source (pool, clock_source); + +if (i >-1 ) +return res_ctx->clock_source_ref_count[i]; + +if (pool->dp_clock_source == clock_source) +return res_ctx->dp_clock_source_ref_count; + +return -1 ; +} +bool resource_are_streams_timing_synchronizable (struct dc_stream_state *stream1,struct dc_stream_state *stream2)
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +3 -1
@@ -1939,7 +1939,9 @@ static void dce110_reset_hw_ctx_wrap( pipe_ctx_old->plane_res.mi->funcs->free_mem_input ( pipe_ctx_old->plane_res.mi, dc->current_state->stream_count); -if (old_clk) +if (old_clk &&0 ==resource_get_clock_source_reference (&context->res_ctx, + dc->res_pool, + old_clk)) old_clk->funcs->cs_power_down (old_clk); dc->hwss.disable_plane (dc, pipe_ctx_old);
drivers/gpu/drm/amd/display/dc/inc/resource.h +5 -0
@@ -102,6 +102,11 @@ void resource_reference_clock_source(const struct resource_pool *pool, struct clock_source *clock_source); +int resource_get_clock_source_reference ( +struct resource_context *res_ctx, +const struct resource_pool *pool, +struct clock_source *clock_source); +bool resource_are_streams_timing_synchronizable (struct dc_stream_state *stream1,struct dc_stream_state *stream2);
Greg Kroah-Hartman
maintainerPATCH 174/197 drm/amdgpu: update tmr mc address
In reply to Greg Kroah-Hartman4.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Zhu <[email protected]>
commit 435198f33b56d7b875a8173a0227ddf0de285aa1 upstream.
Update tmr mc address with firmware loading address which is returned from PSP firmware
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +5 -0
@@ -131,6 +131,11 @@ psp_cmd_submit_buf(struct psp_context *pmsleep (1 ); } +if (ucode) { + ucode->tmr_mc_addr_lo = psp->cmd_buf_mem->resp.fw_addr_lo; + ucode->tmr_mc_addr_hi = psp->cmd_buf_mem->resp.fw_addr_hi; + } +return ret; }
Greg Kroah-Hartman
maintainerPATCH 175/197 drm/amdgpu:add tmr mc address into amdgpu_firmware_info
In reply to Greg Kroah-Hartman4.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Zhu <[email protected]>
commit abf412b3efb2f943d9b98a489e9aca836be21333 upstream.
amdgpu IP blocks booting need Trust Memory Region(tmr) mc address of its firmware which is loaded by PSP
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +3 -0
@@ -226,6 +226,9 @@ struct amdgpu_firmware_info {void *kaddr;/* ucode_size_bytes */ uint32_t ucode_size; +/* starting tmr mc address */ +uint32_t tmr_mc_addr_lo; +uint32_t tmr_mc_addr_hi; };void amdgpu_ucode_print_mc_hdr (const struct common_firmware_header *hdr);
Greg Kroah-Hartman
maintainerPATCH 176/197 drm/amdgpu:add new firmware id for VCN
In reply to Greg Kroah-Hartman4.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Likun Gao <[email protected]>
commit c9ca989696ff28ffb015cc2b7c5577938ef2626c upstream.
Add the new firmware id for VCN into the enum
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +1 -0
@@ -194,6 +194,7 @@ enum AMDGPU_UCODE_ID {AMDGPU_UCODE_ID_SMC ,AMDGPU_UCODE_ID_UVD ,AMDGPU_UCODE_ID_VCE , +AMDGPU_UCODE_ID_VCN , AMDGPU_UCODE_ID_MAXIMUM, };
Greg Kroah-Hartman
maintainerPATCH 177/197 drm/amdgpu:add VCN support in PSP driver
In reply to Greg Kroah-Hartman4.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Likun Gao <[email protected]>
commit 235ac9de625a0a586093ad81b3de6f7d7ab913ed upstream.
Add VCN support in PSP driver
--- drivers/gpu/drm/amd/amdgpu/psp_v10_0.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/psp_v10_0.c +3 -0
@@ -88,6 +88,9 @@ psp_v10_0_get_fw_type(struct amdgpu_firmcase AMDGPU_UCODE_ID_VCE : *type =GFX_FW_TYPE_VCE ;break ; +case AMDGPU_UCODE_ID_VCN : + *type =GFX_FW_TYPE_VCN ; +break ;case AMDGPU_UCODE_ID_MAXIMUM :default :return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 178/197 drm/amdgpu:add VCN booting with firmware loaded by PSP
In reply to Greg Kroah-Hartman4.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Likun Gao <[email protected]>
commit 4d77c0f676e910fb1f1870738aa4bd168f253621 upstream.
Setup psp firmware loading for VCN, and make VCN block booting from tmr mac address.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 17 ++++++++------ drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c | 38 +++++++++++++++++++++++++------- 2 files changed, 40 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +10 -7
@@ -111,9 +111,10 @@ int amdgpu_vcn_sw_init(struct amdgpu_dev version_major, version_minor, family_id); } - bo_size =AMDGPU_GPU_PAGE_ALIGN (le32_to_cpu (hdr->ucode_size_bytes) +8 ) - +AMDGPU_VCN_STACK_SIZE +AMDGPU_VCN_HEAP_SIZE + bo_size =AMDGPU_VCN_STACK_SIZE +AMDGPU_VCN_HEAP_SIZE +AMDGPU_VCN_SESSION_SIZE *40 ; +if (adev->firmware.load_type !=AMDGPU_FW_LOAD_PSP ) + bo_size +=AMDGPU_GPU_PAGE_ALIGN (le32_to_cpu (hdr->ucode_size_bytes) +8 ); r =amdgpu_bo_create_kernel (adev, bo_size,PAGE_SIZE ,AMDGPU_GEM_DOMAIN_VRAM , &adev->vcn.vcpu_bo, &adev->vcn.gpu_addr, &adev->vcn.cpu_addr);
@@ -187,11 +188,13 @@ int amdgpu_vcn_resume(struct amdgpu_deviunsigned offset; hdr = (const struct common_firmware_header *)adev->vcn.fw->data; - offset =le32_to_cpu (hdr->ucode_array_offset_bytes); -memcpy_toio (adev->vcn.cpu_addr, adev->vcn.fw->data + offset, -le32_to_cpu (hdr->ucode_size_bytes)); - size -=le32_to_cpu (hdr->ucode_size_bytes); - ptr +=le32_to_cpu (hdr->ucode_size_bytes); +if (adev->firmware.load_type !=AMDGPU_FW_LOAD_PSP ) { + offset =le32_to_cpu (hdr->ucode_array_offset_bytes); +memcpy_toio (adev->vcn.cpu_addr, adev->vcn.fw->data + offset, +le32_to_cpu (hdr->ucode_size_bytes)); + size -=le32_to_cpu (hdr->ucode_size_bytes); + ptr +=le32_to_cpu (hdr->ucode_size_bytes); + }memset_io (ptr,0 , size); }
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +30 -8
@@ -90,6 +90,16 @@ static int vcn_v1_0_sw_init(void *handleif (r)return r; +if (adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) { +const struct common_firmware_header *hdr; + hdr = (const struct common_firmware_header *)adev->vcn.fw->data; + adev->firmware.ucode[AMDGPU_UCODE_ID_VCN ].ucode_id =AMDGPU_UCODE_ID_VCN ; + adev->firmware.ucode[AMDGPU_UCODE_ID_VCN ].fw = adev->vcn.fw; + adev->firmware.fw_size += +ALIGN (le32_to_cpu (hdr->ucode_size_bytes),PAGE_SIZE ); +DRM_INFO ("PSP loading VCN firmware\n" ); + } + r =amdgpu_vcn_resume (adev);if (r)return r;
@@ -241,26 +251,38 @@ static int vcn_v1_0_resume(void *handle)static void vcn_v1_0_mc_resume (struct amdgpu_device *adev) {uint32_t size =AMDGPU_GPU_PAGE_ALIGN (adev->vcn.fw->size +4 ); +uint32_t offset; -WREG32_SOC15 (UVD ,0 , mmUVD_LMI_VCPU_CACHE_64BIT_BAR_LOW, +if (adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP ) { +WREG32_SOC15 (UVD ,0 , mmUVD_LMI_VCPU_CACHE_64BIT_BAR_LOW, + (adev->firmware.ucode[AMDGPU_UCODE_ID_VCN ].tmr_mc_addr_lo)); +WREG32_SOC15 (UVD ,0 , mmUVD_LMI_VCPU_CACHE_64BIT_BAR_HIGH, + (adev->firmware.ucode[AMDGPU_UCODE_ID_VCN ].tmr_mc_addr_hi)); +WREG32_SOC15 (UVD ,0 , mmUVD_VCPU_CACHE_OFFSET0,0 ); + offset =0 ; + }else { +WREG32_SOC15 (UVD ,0 , mmUVD_LMI_VCPU_CACHE_64BIT_BAR_LOW,lower_32_bits (adev->vcn.gpu_addr)); -WREG32_SOC15 (UVD ,0 , mmUVD_LMI_VCPU_CACHE_64BIT_BAR_HIGH, +WREG32_SOC15 (UVD ,0 , mmUVD_LMI_VCPU_CACHE_64BIT_BAR_HIGH,upper_32_bits (adev->vcn.gpu_addr)); -WREG32_SOC15 (UVD ,0 , mmUVD_VCPU_CACHE_OFFSET0, -AMDGPU_UVD_FIRMWARE_OFFSET >>3 ); + offset = size; +WREG32_SOC15 (UVD ,0 , mmUVD_VCPU_CACHE_OFFSET0, +AMDGPU_UVD_FIRMWARE_OFFSET >>3 ); + } +WREG32_SOC15 (UVD ,0 , mmUVD_VCPU_CACHE_SIZE0, size);WREG32_SOC15 (UVD ,0 , mmUVD_LMI_VCPU_CACHE1_64BIT_BAR_LOW, -lower_32_bits (adev->vcn.gpu_addr + size)); +lower_32_bits (adev->vcn.gpu_addr + offset));WREG32_SOC15 (UVD ,0 , mmUVD_LMI_VCPU_CACHE1_64BIT_BAR_HIGH, -upper_32_bits (adev->vcn.gpu_addr + size)); +upper_32_bits (adev->vcn.gpu_addr + offset));WREG32_SOC15 (UVD ,0 , mmUVD_VCPU_CACHE_OFFSET1,0 );WREG32_SOC15 (UVD ,0 , mmUVD_VCPU_CACHE_SIZE1,AMDGPU_VCN_HEAP_SIZE );WREG32_SOC15 (UVD ,0 , mmUVD_LMI_VCPU_CACHE2_64BIT_BAR_LOW, -lower_32_bits (adev->vcn.gpu_addr + size +AMDGPU_VCN_HEAP_SIZE )); +lower_32_bits (adev->vcn.gpu_addr + offset +AMDGPU_VCN_HEAP_SIZE ));WREG32_SOC15 (UVD ,0 , mmUVD_LMI_VCPU_CACHE2_64BIT_BAR_HIGH, -upper_32_bits (adev->vcn.gpu_addr + size +AMDGPU_VCN_HEAP_SIZE )); +upper_32_bits (adev->vcn.gpu_addr + offset +AMDGPU_VCN_HEAP_SIZE ));WREG32_SOC15 (UVD ,0 , mmUVD_VCPU_CACHE_OFFSET2,0 );WREG32_SOC15 (UVD ,0 , mmUVD_VCPU_CACHE_SIZE2,AMDGPU_VCN_STACK_SIZE + (AMDGPU_VCN_SESSION_SIZE *40 ));
Greg Kroah-Hartman
maintainerPATCH 179/197 drm/amdgpu: fix incorrect use of fcheck
In reply to Greg Kroah-Hartman4.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian König <[email protected]>
commit bce31d4c1ae8865d6382e3a27b07b4bb8e020ade upstream.
The usage isn't RCU protected.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c +3 -1
@@ -53,7 +53,7 @@ static int amdgpu_sched_process_priorityint fd, enum drm_sched_priority priority) { - struct file *filp = fcheck(fd); + struct file *filp = fget(fd);struct drm_file *file;struct pid *pid;struct amdgpu_fpriv *fpriv;
@@ -78,6 +78,8 @@ static int amdgpu_sched_process_priorityput_pid (pid); +fput (filp); +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 180/197 drm/amdgpu: fix incorrect use of drm_file->pid
In reply to Greg Kroah-Hartman4.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian König <[email protected]>
commit c4aed87630d41ee54e2ee23d4583c3dd423296dd upstream.
That's the PID of the creator of the file (usually the X server) and not the end user of the file.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c +4 -15
@@ -55,7 +55,6 @@ static int amdgpu_sched_process_priority {struct file *filp =fget (fd);struct drm_file *file; -struct pid *pid;struct amdgpu_fpriv *fpriv;struct amdgpu_ctx *ctx;uint32_t id;
@@ -63,20 +62,10 @@ static int amdgpu_sched_process_priorityif (!filp)return -EINVAL ; - pid =get_pid (((struct drm_file *)filp->private_data)->pid); - -mutex_lock (&adev->ddev->filelist_mutex); -list_for_each_entry (file, &adev->ddev->filelist, lhead) { -if (file->pid != pid) -continue ; - - fpriv = file->driver_priv; -idr_for_each_entry (&fpriv->ctx_mgr.ctx_handles, ctx, id) -amdgpu_ctx_priority_override (ctx, priority); - } -mutex_unlock (&adev->ddev->filelist_mutex); - -put_pid (pid); + file = filp->private_data; + fpriv = file->driver_priv; +idr_for_each_entry (&fpriv->ctx_mgr.ctx_handles, ctx, id) +amdgpu_ctx_priority_override (ctx, priority);fput (filp);
Greg Kroah-Hartman
maintainerPATCH 181/197 drm/i915: Re-apply "Perform link quality check, unconditionally during long pulse"
In reply to Greg Kroah-Hartman4.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan-Marek Glogowski <[email protected]>
commit 399334708b4f07b107094e5db4a390f0f25d2d4f upstream.
This re-applies the workaround for "some DP sinks, [which] are a little nuts" from commit 1a36147bb939 ("drm/i915: Perform link quality check unconditionally during long pulse").
It makes the secondary AOC E2460P monitor connected via DP to an acer Veriton N4640G usable again.
This hunk was dropped in commit c85d200e8321 ("drm/i915: Move SST DP link retraining into the ->post_hotplug() hook")
--- drivers/gpu/drm/i915/intel_dp.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +19 -14
@@ -4293,18 +4293,6 @@ intel_dp_needs_link_retrain(struct intelreturn !drm_dp_channel_eq_ok (link_status, intel_dp->lane_count); } -/* -* If display is now connected check links status, -* there has been known issues of link loss triggering -* long pulse. -* -* Some sinks (eg. ASUS PB287Q) seem to perform some -* weird HPD ping pong during modesets. So we can apparently -* end up with HPD going low during a modeset, and then -* going back up soon after. And once that happens we must -* retrain the link to get a picture. That's in case no -* userspace component reacted to intermittent HPD dip. -*/ int intel_dp_retrain_link (struct intel_encoder *encoder,struct drm_modeset_acquire_ctx *ctx) {
@@ -4794,7 +4782,8 @@ intel_dp_unset_edid(struct intel_dp *int }static int -intel_dp_long_pulse (struct intel_connector *connector) +intel_dp_long_pulse (struct intel_connector *connector, +struct drm_modeset_acquire_ctx *ctx) {struct drm_i915_private *dev_priv =to_i915 (connector->base.dev);struct intel_dp *intel_dp =intel_attached_dp (&connector->base);
@@ -4853,6 +4842,22 @@ intel_dp_long_pulse(struct intel_connect*/ status = connector_status_disconnected; goto out; + }else { +/* +* If display is now connected check links status, +* there has been known issues of link loss triggering +* long pulse. +* +* Some sinks (eg. ASUS PB287Q) seem to perform some +* weird HPD ping pong during modesets. So we can apparently +* end up with HPD going low during a modeset, and then +* going back up soon after. And once that happens we must +* retrain the link to get a picture. That's in case no +* userspace component reacted to intermittent HPD dip. +*/ +struct intel_encoder *encoder = &dp_to_dig_port (intel_dp)->base; + +intel_dp_retrain_link (encoder, ctx); }/*
@@ -4914,7 +4919,7 @@ intel_dp_detect(struct drm_connector *coreturn ret; } - status =intel_dp_long_pulse (intel_dp->attached_connector); + status =intel_dp_long_pulse (intel_dp->attached_connector, ctx); } intel_dp->detect_done = false;
Greg Kroah-Hartman
maintainerPATCH 182/197 uapi/linux/keyctl.h: dont use C++ reserved keyword as a struct member name
In reply to Greg Kroah-Hartman4.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Randy Dunlap <[email protected]>
commit 8a2336e549d385bb0b46880435b411df8d8200e8 upstream.
Since this header is in "include/uapi/linux/", apparently people want to use it in userspace programs -- even in C++ ones. However, the header uses a C++ reserved keyword ("private"), so change that to "dh_private" instead to allow the header file to be used in C++ userspace.
Fixes https://bugzilla.kernel.org/show_bug.cgi?id=191051
--- include/uapi/linux/keyctl.h | 2 +- security/keys/dh.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
include/uapi/linux/keyctl.h +1 -1
@@ -65,7 +65,7 @@/* keyctl structures */ struct keyctl_dh_params { -__s32 private; +__s32 dh_private;__s32 prime;__s32 base; };
security/keys/dh.c +1 -1
@@ -300,7 +300,7 @@ long __keyctl_dh_compute(struct keyctl_d } dh_inputs.g_size = dlen; - dlen =dh_data_from_key (pcopy.private, &dh_inputs.key); + dlen =dh_data_from_key (pcopy.dh_private, &dh_inputs.key);if (dlen <0 ) { ret = dlen; goto out2;
Greg Kroah-Hartman
maintainerPATCH 183/197 mm: respect arch_dup_mmap() return value
In reply to Greg Kroah-Hartman4.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nadav Amit <[email protected]>
commit 1ed0cc5a01a4d868d9907ce96468c4b4c6709556 upstream.
Commit d70f2a14b72a ("include/linux/sched/mm.h: uninline mmdrop_async(), etc") ignored the return value of arch_dup_mmap(). As a result, on x86, a failure to duplicate the LDT (e.g. due to memory allocation error) would leave the duplicated memory mapping in an inconsistent state.
Fix by using the return value, as it was before the change.
--- kernel/fork.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/fork.c +1 -2
@@ -549,8 +549,7 @@ static __latent_entropy int dup_mmap(str goto out; }/* a new mm has just been created */ -arch_dup_mmap (oldmm, mm); - retval =0 ; + retval =arch_dup_mmap (oldmm, mm); out:up_write (&mm->mmap_sem);flush_tlb_mm (oldmm);
Greg Kroah-Hartman
maintainerPATCH 184/197 drm/i915: set DP Main Stream Attribute for color range on DDI platforms
In reply to Greg Kroah-Hartman4.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jani Nikula <[email protected]>
commit 6209c285e7a5e68dbcdf8fd2456c6dd68433806b upstream.
Since Haswell we have no color range indication either in the pipe or port registers for DP. Instead, there's a separate register for setting the DP Main Stream Attributes (MSA) directly. The MSA register definition makes no references to colorimetry, just a vague reference to the DP spec. The connection to the color range was lost.
Apparently we've failed to set the proper MSA bit for limited, or CEA, range ever since the first DDI platforms. We've started setting other MSA parameters since commit dae847991a43 ("drm/i915: add intel_ddi_set_pipe_settings").
Without the crucial bit of information, the DP sink has no way of knowing the source is actually transmitting limited range RGB, leading to "washed out" colors. With the colorimetry information, compliant sinks should be able to handle the limited range properly. Native (i.e. non-LSPCON) HDMI was not affected because we do pass the color range via AVI infoframes.
Though not the root cause, the problem was made worse for DDI platforms with commit 55bc60db5988 ("drm/i915: Add "Automatic" mode for the "Broadcast RGB" property"), which selects limited range RGB automatically based on the mode, as per the DP, HDMI and CEA specs.
After all these years, the fix boils down to flipping one bit.
[Per testing reports, this fixes DP sinks, but not the LSPCON. My
educated guess is that the LSPCON fails to turn the CEA range MSA into AVI infoframes for HDMI.]
References: https://bugs.freedesktop.org/show_bug.cgi?id=100023
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107476
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=94921
--- drivers/gpu/drm/i915/i915_reg.h | 1 + drivers/gpu/drm/i915/intel_ddi.c | 4 ++++ 2 files changed, 5 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +1 -0
@@ -8825,6 +8825,7 @@ enum skl_power_gate {#define TRANS_MSA_10_BPC (2<<5)#define TRANS_MSA_12_BPC (3<<5)#define TRANS_MSA_16_BPC (4<<5) +#define TRANS_MSA_CEA_RANGE (1<<3)/* LCPLL Control */ #define LCPLL_CTL _MMIO(0x130040)
drivers/gpu/drm/i915/intel_ddi.c +4 -0
@@ -1659,6 +1659,10 @@ void intel_ddi_set_pipe_settings(const sWARN_ON (transcoder_is_dsi (cpu_transcoder)); temp =TRANS_MSA_SYNC_CLK ; + +if (crtc_state->limited_color_range) + temp |=TRANS_MSA_CEA_RANGE ; +switch (crtc_state->pipe_bpp) {case 18 : temp |=TRANS_MSA_6_BPC ;
Greg Kroah-Hartman
maintainerPATCH 185/197 x86/tsc: Prevent result truncation on 32bit
In reply to Greg Kroah-Hartman4.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuanhua Lei <[email protected]>
commit 17f6bac2249356c795339e03a0742cd79be3cab8 upstream.
Loops per jiffy is calculated by multiplying tsc_khz with 1e3 and then dividing it by HZ.
Both tsc_khz and the temporary variable holding the multiplication result are of type unsigned long, so on 32bit the result is truncated to the lower 32bit.
Use u64 as type for the temporary variable and cast tsc_khz to it before multiplying.
[ tglx: Massaged changelog and removed pointless braces ]
[ tglx: Backport to stable. Due to massive code changes is the upstream
commit not applicable anymore. The issue has gone unnoticed in kernels pre 4.19 because the bogus LPJ value gets fixed up in a later stage of early boot, but it still might cause subtle and hard to debug issues between these two points. ]
--- arch/x86/kernel/tsc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/tsc.c +2 -2
@@ -1343,7 +1343,7 @@ device_initcall(init_tsc_clocksource);void __init tsc_early_delay_calibrate (void ) { -unsigned long lpj; +u64 lpj;if (!boot_cpu_has (X86_FEATURE_TSC ))return ;
@@ -1355,7 +1355,7 @@ void __init tsc_early_delay_calibrate(voif (!tsc_khz)return ; - lpj = tsc_khz *1000 ; + lpj = (u64 )tsc_khz *1000 ;do_div (lpj,HZ ); loops_per_jiffy = lpj; }
Greg Kroah-Hartman
maintainerPATCH 186/197 drm/amdgpu: Keep track of amount of pinned CPU visible VRAM
In reply to Greg Kroah-Hartman4.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michel Dänzer <[email protected]>
commit ddc21af4d0f37f42b33c54cb69b215997fe5b082 upstream.
Instead of CPU invisible VRAM. Preparation for the following, no functional change intended.
v2:
* Also change amdgpu_vram_mgr_bo_invisible_size to amdgpu_vram_mgr_bo_visible_size, allowing further simplification (Christian König)
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 5 ++--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 20 ++++++++------------ 5 files changed, 14 insertions(+), 19 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -1
@@ -1580,7 +1580,7 @@ struct amdgpu_device {/* tracking pinned memory */ u64 vram_pin_size; -u64 invisible_pin_size; +u64 visible_pin_size;u64 gart_pin_size;/* amdkfd interface */
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +2 -3
@@ -497,7 +497,7 @@ static int amdgpu_info_ioctl(struct drm_ vram_gtt.vram_size = adev->gmc.real_vram_size; vram_gtt.vram_size -= adev->vram_pin_size; vram_gtt.vram_cpu_accessible_size = adev->gmc.visible_vram_size; - vram_gtt.vram_cpu_accessible_size -= (adev->vram_pin_size - adev->invisible_pin_size); + vram_gtt.vram_cpu_accessible_size -= adev->visible_pin_size; vram_gtt.gtt_size = adev->mman.bdev.man[TTM_PL_TT ].size; vram_gtt.gtt_size *=PAGE_SIZE ; vram_gtt.gtt_size -= adev->gart_pin_size;
@@ -518,8 +518,7 @@ static int amdgpu_info_ioctl(struct drm_ mem.cpu_accessible_vram.total_heap_size = adev->gmc.visible_vram_size; mem.cpu_accessible_vram.usable_heap_size = - adev->gmc.visible_vram_size - - (adev->vram_pin_size - adev->invisible_pin_size); + adev->gmc.visible_vram_size - adev->visible_pin_size; mem.cpu_accessible_vram.heap_usage =amdgpu_vram_mgr_vis_usage (&adev->mman.bdev.man[TTM_PL_VRAM ]); mem.cpu_accessible_vram.max_allocation =
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +2 -2
@@ -762,7 +762,7 @@ int amdgpu_bo_pin_restricted(struct amdg domain =amdgpu_mem_type_to_domain (bo->tbo.mem.mem_type);if (domain ==AMDGPU_GEM_DOMAIN_VRAM ) { adev->vram_pin_size +=amdgpu_bo_size (bo); - adev->invisible_pin_size +=amdgpu_vram_mgr_bo_invisible_size (bo); + adev->visible_pin_size +=amdgpu_vram_mgr_bo_visible_size (bo); }else if (domain ==AMDGPU_GEM_DOMAIN_GTT ) { adev->gart_pin_size +=amdgpu_bo_size (bo); }
@@ -792,7 +792,7 @@ int amdgpu_bo_unpin(struct amdgpu_bo *boif (bo->tbo.mem.mem_type ==TTM_PL_VRAM ) { adev->vram_pin_size -=amdgpu_bo_size (bo); - adev->invisible_pin_size -=amdgpu_vram_mgr_bo_invisible_size (bo); + adev->visible_pin_size -=amdgpu_vram_mgr_bo_visible_size (bo); }else if (bo->tbo.mem.mem_type ==TTM_PL_TT ) { adev->gart_pin_size -=amdgpu_bo_size (bo); }
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +1 -1
@@ -73,7 +73,7 @@ bool amdgpu_gtt_mgr_has_gart_addr(structuint64_t amdgpu_gtt_mgr_usage (struct ttm_mem_type_manager *man);int amdgpu_gtt_mgr_recover (struct ttm_mem_type_manager *man); -u64 amdgpu_vram_mgr_bo_invisible_size (struct amdgpu_bo *bo); +u64 amdgpu_vram_mgr_bo_visible_size (struct amdgpu_bo *bo);uint64_t amdgpu_vram_mgr_usage (struct ttm_mem_type_manager *man);uint64_t amdgpu_vram_mgr_vis_usage (struct ttm_mem_type_manager *man);
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c +8 -12
@@ -97,33 +97,29 @@ static u64 amdgpu_vram_mgr_vis_size(stru }/** -* amdgpu_vram_mgr_bo_invisible_size - CPU invisible BO size +* amdgpu_vram_mgr_bo_visible_size - CPU visible BO size * * @bo: &amdgpu_bo buffer object (must be in VRAM) * * Returns: -* How much of the given &amdgpu_bo buffer object lies in CPU invisible VRAM. +* How much of the given &amdgpu_bo buffer object lies in CPU visible VRAM. */ -u64 amdgpu_vram_mgr_bo_invisible_size (struct amdgpu_bo *bo) +u64 amdgpu_vram_mgr_bo_visible_size (struct amdgpu_bo *bo) {struct amdgpu_device *adev =amdgpu_ttm_adev (bo->tbo.bdev);struct ttm_mem_reg *mem = &bo->tbo.mem;struct drm_mm_node *nodes = mem->mm_node;unsigned pages = mem->num_pages; -u64 usage =0 ; +u64 usage;if (adev->gmc.visible_vram_size == adev->gmc.real_vram_size) -return 0 ; +return amdgpu_bo_size (bo);if (mem->start >= adev->gmc.visible_vram_size >>PAGE_SHIFT ) -return amdgpu_bo_size (bo); +return 0 ; -while (nodes && pages) { - usage += nodes->size <<PAGE_SHIFT ; - usage -=amdgpu_vram_mgr_vis_size (adev, nodes); - pages -= nodes->size; - ++nodes; - } +for (usage =0 ; nodes && pages; pages -= nodes->size, nodes++) + usage +=amdgpu_vram_mgr_vis_size (adev, nodes);return usage; }
Greg Kroah-Hartman
maintainerPATCH 187/197 drm/amdgpu: Make pin_size values atomic
In reply to Greg Kroah-Hartman4.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michel Dänzer <[email protected]>
commit a5ccfe5c20740f2fbf00291490cdf8d2373ec255 upstream.
Concurrent execution of the non-atomic arithmetic could result in completely bogus values.
v2:
* Rebased on v2 of the previous patch
Cc: [email protected]
Bugzilla: https://bugs.freedesktop.org/106872
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 6 +++--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 22 +++++++++++----------- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 14 ++++++++------ 4 files changed, 23 insertions(+), 21 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +3 -3
@@ -1579,9 +1579,9 @@ struct amdgpu_device {DECLARE_HASHTABLE (mn_hash,7 );/* tracking pinned memory */ -u64 vram_pin_size; -u64 visible_pin_size; -u64 gart_pin_size; +atomic64_t vram_pin_size; +atomic64_t visible_pin_size; +atomic64_t gart_pin_size;/* amdkfd interface */ struct kfd_dev *kfd;
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1 -1
@@ -257,7 +257,7 @@ static void amdgpu_cs_get_threshold_for_return ; } - total_vram = adev->gmc.real_vram_size - adev->vram_pin_size; + total_vram = adev->gmc.real_vram_size -atomic64_read (&adev->vram_pin_size); used_vram =amdgpu_vram_mgr_usage (&adev->mman.bdev.man[TTM_PL_VRAM ]); free_vram = used_vram >= total_vram ?0 : total_vram - used_vram;
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +11 -11
@@ -494,13 +494,13 @@ static int amdgpu_info_ioctl(struct drm_case AMDGPU_INFO_VRAM_GTT : {struct drm_amdgpu_info_vram_gtt vram_gtt; - vram_gtt.vram_size = adev->gmc.real_vram_size; - vram_gtt.vram_size -= adev->vram_pin_size; - vram_gtt.vram_cpu_accessible_size = adev->gmc.visible_vram_size; - vram_gtt.vram_cpu_accessible_size -= adev->visible_pin_size; + vram_gtt.vram_size = adev->gmc.real_vram_size - +atomic64_read (&adev->vram_pin_size); + vram_gtt.vram_cpu_accessible_size = adev->gmc.visible_vram_size - +atomic64_read (&adev->visible_pin_size); vram_gtt.gtt_size = adev->mman.bdev.man[TTM_PL_TT ].size; vram_gtt.gtt_size *=PAGE_SIZE ; - vram_gtt.gtt_size -= adev->gart_pin_size; + vram_gtt.gtt_size -=atomic64_read (&adev->gart_pin_size);return copy_to_user (out, &vram_gtt,min ((size_t )size,sizeof (vram_gtt))) ? -EFAULT :0 ; }
@@ -509,16 +509,16 @@ static int amdgpu_info_ioctl(struct drm_memset (&mem,0 ,sizeof (mem)); mem.vram.total_heap_size = adev->gmc.real_vram_size; - mem.vram.usable_heap_size = - adev->gmc.real_vram_size - adev->vram_pin_size; + mem.vram.usable_heap_size = adev->gmc.real_vram_size - +atomic64_read (&adev->vram_pin_size); mem.vram.heap_usage =amdgpu_vram_mgr_usage (&adev->mman.bdev.man[TTM_PL_VRAM ]); mem.vram.max_allocation = mem.vram.usable_heap_size *3 /4 ; mem.cpu_accessible_vram.total_heap_size = adev->gmc.visible_vram_size; - mem.cpu_accessible_vram.usable_heap_size = - adev->gmc.visible_vram_size - adev->visible_pin_size; + mem.cpu_accessible_vram.usable_heap_size = adev->gmc.visible_vram_size - +atomic64_read (&adev->visible_pin_size); mem.cpu_accessible_vram.heap_usage =amdgpu_vram_mgr_vis_usage (&adev->mman.bdev.man[TTM_PL_VRAM ]); mem.cpu_accessible_vram.max_allocation =
@@ -526,8 +526,8 @@ static int amdgpu_info_ioctl(struct drm_ mem.gtt.total_heap_size = adev->mman.bdev.man[TTM_PL_TT ].size; mem.gtt.total_heap_size *=PAGE_SIZE ; - mem.gtt.usable_heap_size = mem.gtt.total_heap_size - - adev->gart_pin_size; + mem.gtt.usable_heap_size = mem.gtt.total_heap_size - +atomic64_read (&adev->gart_pin_size); mem.gtt.heap_usage =amdgpu_gtt_mgr_usage (&adev->mman.bdev.man[TTM_PL_TT ]); mem.gtt.max_allocation = mem.gtt.usable_heap_size *3 /4 ;
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +8 -6
@@ -761,10 +761,11 @@ int amdgpu_bo_pin_restricted(struct amdg domain =amdgpu_mem_type_to_domain (bo->tbo.mem.mem_type);if (domain ==AMDGPU_GEM_DOMAIN_VRAM ) { - adev->vram_pin_size +=amdgpu_bo_size (bo); - adev->visible_pin_size +=amdgpu_vram_mgr_bo_visible_size (bo); +atomic64_add (amdgpu_bo_size (bo), &adev->vram_pin_size); +atomic64_add (amdgpu_vram_mgr_bo_visible_size (bo), + &adev->visible_pin_size); }else if (domain ==AMDGPU_GEM_DOMAIN_GTT ) { - adev->gart_pin_size +=amdgpu_bo_size (bo); +atomic64_add (amdgpu_bo_size (bo), &adev->gart_pin_size); } error:
@@ -791,10 +792,11 @@ int amdgpu_bo_unpin(struct amdgpu_bo *boreturn 0 ;if (bo->tbo.mem.mem_type ==TTM_PL_VRAM ) { - adev->vram_pin_size -=amdgpu_bo_size (bo); - adev->visible_pin_size -=amdgpu_vram_mgr_bo_visible_size (bo); +atomic64_sub (amdgpu_bo_size (bo), &adev->vram_pin_size); +atomic64_sub (amdgpu_vram_mgr_bo_visible_size (bo), + &adev->visible_pin_size); }else if (bo->tbo.mem.mem_type ==TTM_PL_TT ) { - adev->gart_pin_size -=amdgpu_bo_size (bo); +atomic64_sub (amdgpu_bo_size (bo), &adev->gart_pin_size); }for (i =0 ; i < bo->placement.num_placement; i++) {
Greg Kroah-Hartman
maintainerPATCH 188/197 drm/amdgpu: Warn and update pin_size values when destroying a pinned BO
In reply to Greg Kroah-Hartman4.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michel Dänzer <[email protected]>
commit 15e6b76880e65be24250e30986084b5569b7a06f upstream.
This shouldn't happen, but if it does, we'll get a backtrace of the caller, and update the pin_size values as needed.
v2:
* Check bo->pin_count instead of placement flags (Christian König)
--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 32 ++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +25 -7
@@ -50,11 +50,35 @@ static bool amdgpu_need_backup(struct amreturn true; } +/** +* amdgpu_bo_subtract_pin_size - Remove BO from pin_size accounting +* +* @bo: &amdgpu_bo buffer object +* +* This function is called when a BO stops being pinned, and updates the +* &amdgpu_device pin_size values accordingly. +*/ +static void amdgpu_bo_subtract_pin_size (struct amdgpu_bo *bo) +{ +struct amdgpu_device *adev =amdgpu_ttm_adev (bo->tbo.bdev); + +if (bo->tbo.mem.mem_type ==TTM_PL_VRAM ) { +atomic64_sub (amdgpu_bo_size (bo), &adev->vram_pin_size); +atomic64_sub (amdgpu_vram_mgr_bo_visible_size (bo), + &adev->visible_pin_size); + }else if (bo->tbo.mem.mem_type ==TTM_PL_TT ) { +atomic64_sub (amdgpu_bo_size (bo), &adev->gart_pin_size); + } +} +static void amdgpu_ttm_bo_destroy (struct ttm_buffer_object *tbo) {struct amdgpu_device *adev =amdgpu_ttm_adev (tbo->bdev);struct amdgpu_bo *bo =ttm_to_amdgpu_bo (tbo); +if (WARN_ON_ONCE (bo->pin_count >0 )) +amdgpu_bo_subtract_pin_size (bo); +if (bo->kfd_bo)amdgpu_amdkfd_unreserve_system_memory_limit (bo);
@@ -791,13 +815,7 @@ int amdgpu_bo_unpin(struct amdgpu_bo *boif (bo->pin_count)return 0 ; -if (bo->tbo.mem.mem_type ==TTM_PL_VRAM ) { -atomic64_sub (amdgpu_bo_size (bo), &adev->vram_pin_size); -atomic64_sub (amdgpu_vram_mgr_bo_visible_size (bo), - &adev->visible_pin_size); - }else if (bo->tbo.mem.mem_type ==TTM_PL_TT ) { -atomic64_sub (amdgpu_bo_size (bo), &adev->gart_pin_size); - } +amdgpu_bo_subtract_pin_size (bo);for (i =0 ; i < bo->placement.num_placement; i++) { bo->placements[i].lpfn =0 ;
Greg Kroah-Hartman
maintainerPATCH 189/197 drm/amdgpu: Dont warn on destroying a pinned BO
In reply to Greg Kroah-Hartman4.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michel Dänzer <[email protected]>
commit 456607d816d89a442a3d5ec98b02c8bc950b5228 upstream.
The warning turned out to be not so useful, as BO destruction tends to be deferred to a workqueue.
Also, we should be preventing any damage from this now, so not really important anymore to fix code doing this.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1 -1
@@ -76,7 +76,7 @@ static void amdgpu_ttm_bo_destroy(structstruct amdgpu_device *adev =amdgpu_ttm_adev (tbo->bdev);struct amdgpu_bo *bo =ttm_to_amdgpu_bo (tbo); -if (WARN_ON_ONCE (bo->pin_count >0 )) +if (bo->pin_count >0 )amdgpu_bo_subtract_pin_size (bo);if (bo->kfd_bo)
Greg Kroah-Hartman
maintainerPATCH 190/197 debugobjects: Make stack check warning more informative
In reply to Greg Kroah-Hartman4.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joel Fernandes (Google) <[email protected]>
commit fc91a3c4c27acdca0bc13af6fbb68c35cfd519f2 upstream.
While debugging an issue debugobject tracking warned about an annotation issue of an object on stack. It turned out that the issue was due to the object in concern being on a different stack which was due to another issue.
Thomas suggested to print the pointers and the location of the stack for the currently running task. This helped to figure out that the object was on the wrong stack.
As this is general useful information for debugging similar issues, make the error message more informative by printing the pointers.
[ tglx: Massaged changelog ]
--- lib/debugobjects.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
lib/debugobjects.c +5 -2
@@ -360,9 +360,12 @@ static void debug_object_is_on_stack(voi limit++;if (is_on_stack) -pr_warn ("object is on stack, but not annotated\n" ); +pr_warn ("object %p is on stack %p, but NOT annotated.\n" , addr, +task_stack_page (current));else -pr_warn ("object is not on stack, but annotated\n" ); +pr_warn ("object %p is NOT on stack %p, but annotated.\n" , addr, +task_stack_page (current)); +WARN_ON (1 ); }
Greg Kroah-Hartman
maintainerPATCH 191/197 x86/pae: use 64 bit atomic xchg function in native_ptep_get_and_clear
In reply to Greg Kroah-Hartman4.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juergen Gross <[email protected]>
commit b2d7a075a1ccef2fb321d595802190c8e9b39004 upstream.
Using only 32-bit writes for the pte will result in an intermediate L1TF vulnerable PTE. When running as a Xen PV guest this will at once switch the guest to shadow mode resulting in a loss of performance.
Use arch_atomic64_xchg() instead which will perform the requested operation atomically with all 64 bits.
Some performance considerations according to:
The main number should be the latency, as there is no tight loop around native_ptep_get_and_clear().
"lock cmpxchg8b" has a latency of 20 cycles, while "lock xchg" (with a memory operand) isn't mentioned in that document. "lock xadd" (with xadd having 3 cycles less latency than xchg) has a latency of 11, so we can assume a latency of 14 for "lock xchg".
--- arch/x86/include/asm/pgtable-3level.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
arch/x86/include/asm/pgtable-3level.h +3 -4
@@ -2,6 +2,8 @@#ifndef _ASM_X86_PGTABLE_3LEVEL_H#define _ASM_X86_PGTABLE_3LEVEL_H +#include <asm/atomic64_32.h> +/* * Intel Physical Address Extension (PAE) Mode - three-level page * tables on PPro+ CPUs.
@@ -147,10 +149,7 @@ static inline pte_t native_ptep_get_and_ {pte_t res; -/* xchg acts as a barrier before the setting of the high bits */ - res.pte_low =xchg (&ptep->pte_low,0 ); - res.pte_high = ptep->pte_high; - ptep->pte_high =0 ; + res.pte = (pteval_t )arch_atomic64_xchg ((atomic64_t *)ptep,0 );return res; }
Greg Kroah-Hartman
maintainerPATCH 192/197 x86/xen: dont write ptes directly in 32-bit PV guests
In reply to Greg Kroah-Hartman4.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juergen Gross <[email protected]>
commit f7c90c2aa4004808dff777ba6ae2c7294dd06851 upstream.
In some cases 32-bit PAE PV guests still write PTEs directly instead of using hypercalls. This is especially bad when clearing a PTE as this is done via 32-bit writes which will produce intermediate L1TF attackable PTEs.
Change the code to use hypercalls instead.
--- arch/x86/xen/mmu_pv.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
arch/x86/xen/mmu_pv.c +3 -4
@@ -434,14 +434,13 @@ static void xen_set_pud(pud_t *ptr, pud_static void xen_set_pte_atomic (pte_t *ptep,pte_t pte) {trace_xen_mmu_set_pte_atomic (ptep, pte); -set_64bit ((u64 *)ptep,native_pte_val (pte)); +__xen_set_pte (ptep, pte); }static void xen_pte_clear (struct mm_struct *mm,unsigned long addr,pte_t *ptep) {trace_xen_mmu_pte_clear (mm, addr, ptep); -if (!xen_batched_set_pte (ptep,native_make_pte (0 ))) -native_pte_clear (mm, addr, ptep); +__xen_set_pte (ptep,native_make_pte (0 )); }static void xen_pmd_clear (pmd_t *pmdp)
@@ -1571,7 +1570,7 @@ static void __init xen_set_pte_init(pte_ pte =__pte_ma (((pte_val_ma (*ptep) & _PAGE_RW) | ~_PAGE_RW) &pte_val_ma (pte));#endif -native_set_pte (ptep, pte); +__xen_set_pte (ptep, pte); }/* Early in boot, while setting up the initial pagetable, assume
Greg Kroah-Hartman
maintainerPATCH 193/197 kbuild: make missing $DEPMOD a Warning instead of an Error
In reply to Greg Kroah-Hartman4.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Randy Dunlap <[email protected]>
commit 914b087ff9e0e9a399a4927fa30793064afc0178 upstream.
When $DEPMOD is not found, only print a warning instead of exiting with an error message and error status:
Warning: 'make modules_install' requires /sbin/depmod. Please install it. This is probably in the kmod package.
Change the Error to a Warning because "not all build hosts for cross compiling Linux are Linux systems and are able to provide a working port of depmod, especially at the file patch /sbin/depmod."
I.e., "make modules_install" may be used to copy/install the loadable modules files to a target directory on a build system and then transferred to an embedded device where /sbin/depmod is run instead of it being run on the build system.
--- scripts/depmod.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/depmod.sh +2 -2
@@ -15,9 +15,9 @@ if ! test -r System.map ; then fi if [ -z $(command -v $DEPMOD) ]; then - echo "'make modules_install' requires $DEPMOD. Please install it." >&2 + echo "Warning: 'make modules_install' requires $DEPMOD. Please install it." >&2 echo "This is probably in the kmod package." >&2 - exit 1 + exit 0 fi # older versions of depmod require the version string to start with three
Greg Kroah-Hartman
maintainerPATCH 194/197 kvm: x86: Set highest physical address bits in non-present/reserved SPTEs
In reply to Greg Kroah-Hartman4.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junaid Shahid <[email protected]>
commit 28a1f3ac1d0c8558ee4453d9634dad891a6e922e upstream.
Always set the 5 upper-most supported physical address bits to 1 for SPTEs that are marked as non-present or reserved, to make them unusable for L1TF attacks from the guest. Currently, this just applies to MMIO SPTEs. (We do not need to mark PTEs that are completely 0 as physical page 0 is already reserved.)
This allows mitigation of L1TF without disabling hyper-threading by using shadow paging mode instead of EPT.
--- arch/x86/kvm/mmu.c | 43 ++++++++++++++++++++++++++++++++++++++----- arch/x86/kvm/x86.c | 8 ++++++-- 2 files changed, 44 insertions(+), 7 deletions(-)
arch/x86/kvm/mmu.c +38 -5
@@ -221,6 +221,17 @@ static const u64 shadow_acc_track_saved_PT64_EPT_EXECUTABLE_MASK ;static const u64 shadow_acc_track_saved_bits_shift =PT64_SECOND_AVAIL_BITS_SHIFT ; +/* +* This mask must be set on all non-zero Non-Present or Reserved SPTEs in order +* to guard against L1TF attacks. +*/ +static u64 __read_mostly shadow_nonpresent_or_rsvd_mask; + +/* +* The number of high-order 1 bits to use in the mask above. +*/ +static const u64 shadow_nonpresent_or_rsvd_mask_len =5 ; +static void mmu_spte_set (u64 *sptep,u64 spte);void kvm_mmu_set_mmio_spte_mask (u64 mmio_mask,u64 mmio_value)
@@ -308,9 +319,13 @@ static void mark_mmio_spte(struct kvm_vc {unsigned int gen =kvm_current_mmio_generation (vcpu);u64 mask =generation_mmio_spte_mask (gen); +u64 gpa = gfn <<PAGE_SHIFT ; access &=ACC_WRITE_MASK |ACC_USER_MASK ; - mask |= shadow_mmio_value | access | gfn <<PAGE_SHIFT ; + mask |= shadow_mmio_value | access; + mask |= gpa | shadow_nonpresent_or_rsvd_mask; + mask |= (gpa & shadow_nonpresent_or_rsvd_mask) + << shadow_nonpresent_or_rsvd_mask_len;trace_mark_mmio_spte (sptep, gfn, access, gen);mmu_spte_set (sptep, mask);
@@ -323,8 +338,14 @@ static bool is_mmio_spte(u64 spte)static gfn_t get_mmio_spte_gfn (u64 spte) { -u64 mask =generation_mmio_spte_mask (MMIO_GEN_MASK ) | shadow_mmio_mask; -return (spte & ~mask) >>PAGE_SHIFT ; +u64 mask =generation_mmio_spte_mask (MMIO_GEN_MASK ) | shadow_mmio_mask | + shadow_nonpresent_or_rsvd_mask; +u64 gpa = spte & ~mask; + + gpa |= (spte >> shadow_nonpresent_or_rsvd_mask_len) + & shadow_nonpresent_or_rsvd_mask; + +return gpa >>PAGE_SHIFT ; }static unsigned get_mmio_spte_access (u64 spte)
@@ -381,7 +402,7 @@ void kvm_mmu_set_mask_ptes(u64 user_mask }EXPORT_SYMBOL_GPL (kvm_mmu_set_mask_ptes); -static void kvm_mmu_clear_all_pte_masks (void ) +static void kvm_mmu_reset_all_pte_masks (void ) { shadow_user_mask =0 ; shadow_accessed_mask =0 ;
@@ -391,6 +412,18 @@ static void kvm_mmu_clear_all_pte_masks( shadow_mmio_mask =0 ; shadow_present_mask =0 ; shadow_acc_track_mask =0 ; + +/* +* If the CPU has 46 or less physical address bits, then set an +* appropriate mask to guard against L1TF attacks. Otherwise, it is +* assumed that the CPU is not vulnerable to L1TF. +*/ +if (boot_cpu_data.x86_phys_bits < +52 - shadow_nonpresent_or_rsvd_mask_len) + shadow_nonpresent_or_rsvd_mask = +rsvd_bits (boot_cpu_data.x86_phys_bits - + shadow_nonpresent_or_rsvd_mask_len, + boot_cpu_data.x86_phys_bits -1 ); }static int is_cpuid_PSE36 (void )
@@ -5500,7 +5533,7 @@ int kvm_mmu_module_init(void) {int ret = -ENOMEM ; -kvm_mmu_clear_all_pte_masks (); +kvm_mmu_reset_all_pte_masks (); pte_list_desc_cache = kmem_cache_create("pte_list_desc", sizeof(struct pte_list_desc),
arch/x86/kvm/x86.c +6 -2
@@ -6506,8 +6506,12 @@ static void kvm_set_mmio_spte_mask(void)* Set the reserved bits and the present bit of an paging-structure * entry to generate page fault with PFER.RSV = 1. */ -/* Mask the reserved physical address bits. */ - mask =rsvd_bits (maxphyaddr,51 ); + +/* +* Mask the uppermost physical address bit, which would be reserved as +* long as the supported physical address width is less than 52. +*/ + mask =1ull <<51 ;/* Set the present bit. */ mask |=1ull ;
Greg Kroah-Hartman
maintainerPATCH 195/197 x86: kvm: avoid unused variable warning
In reply to Greg Kroah-Hartman4.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit 7288bde1f9df6c1475675419bdd7725ce84dec56 upstream.
Removing one of the two accesses of the maxphyaddr variable led to a harmless warning:
arch/x86/kvm/x86.c: In function 'kvm_set_mmio_spte_mask':arch/x86/kvm/x86.c:6563:6: error: unused variable 'maxphyaddr' [-Werror=unused-variable]
Removing the #ifdef seems to be the nicest workaround, as it makes the code look cleaner than adding another #ifdef.
--- arch/x86/kvm/x86.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
arch/x86/kvm/x86.c +1 -3
@@ -6516,14 +6516,12 @@ static void kvm_set_mmio_spte_mask(void)/* Set the present bit. */ mask |=1ull ; -#ifdef CONFIG_X86_64 /* * If reserved bit is not supported, clear the present bit to disable * mmio page fault. */ -if (maxphyaddr ==52 ) +if (IS_ENABLED (CONFIG_X86_64 ) && maxphyaddr ==52 ) mask &= ~1ull ; -#endif kvm_mmu_set_mmio_spte_mask (mask, mask); }
Greg Kroah-Hartman
maintainerPATCH 196/197 HID: redragon: fix num lock and caps lock LEDs
In reply to Greg Kroah-Hartman4.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Robert Munteanu <[email protected]>
commit dc9b8e85ed95cbe7e3ad0eabb5b48d617bbc365e upstream.
The redragon asura keyboard registers two input devices. The initial commit 85455dd906d5 ("HID: redragon: Fix modifier keys for Redragon Asura Keyboard") considered this an error and prevented one of the devices from registering. However, once this is done the num lock and caps lock leds no longer toggle on and off, although the key functionality is not affected.
This commit removes the code that prevents the input device registration and restores the num lock and caps lock LEDs.
--- drivers/hid/hid-redragon.c | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-)
drivers/hid/hid-redragon.c +1 -25
@@ -44,29 +44,6 @@ static __u8 *redragon_report_fixup(strucreturn rdesc; } -static int redragon_probe (struct hid_device *dev, -const struct hid_device_id *id) -{ -int ret; - - ret =hid_parse (dev); -if (ret) { -hid_err (dev,"parse failed\n" ); -return ret; - } - -/* do not register unused input device */ -if (dev->maxapplication ==1 ) -return 0 ; - - ret =hid_hw_start (dev,HID_CONNECT_DEFAULT ); -if (ret) { -hid_err (dev,"hw start failed\n" ); -return ret; - } - -return 0 ; -}static const struct hid_device_id redragon_devices[] = { {HID_USB_DEVICE (USB_VENDOR_ID_JESS ,USB_DEVICE_ID_REDRAGON_ASURA )}, {}
@@ -77,8 +54,7 @@ MODULE_DEVICE_TABLE(hid, redragon_devicestatic struct hid_driver redragon_driver = { .name ="redragon" , .id_table = redragon_devices, - .report_fixup = redragon_report_fixup, - .probe = redragon_probe + .report_fixup = redragon_report_fixup };module_hid_driver (redragon_driver);
Greg Kroah-Hartman
maintainerPATCH 197/197 ASoC: wm8994: Fix missing break in switch
In reply to Greg Kroah-Hartman4.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gustavo A. R. Silva <[email protected]>
commit ad0eaee6195db1db1749dd46b9e6f4466793d178 upstream.
Add missing break statement in order to prevent the code from falling through to the default case.
Addresses-Coverity-ID: 115050 ("Missing break in switch")
--- sound/soc/codecs/wm8994.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/codecs/wm8994.c +1 -0
@@ -2432,6 +2432,7 @@ static int wm8994_set_dai_sysclk(structsnd_soc_component_update_bits (component,WM8994_POWER_MANAGEMENT_2 ,WM8994_OPCLK_ENA ,0 ); } +break ;default :return -EINVAL ;
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.18.8 release. There are 197 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat Sep 15 13:17:57 UTC 2018. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.18.8-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.18.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64 and i386.
Summary
------------------------------------------------------------------------
kernel: 4.18.8-rc1
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.18.y
git commit: ae285c20144a3ff94c31498fe34ca1decb2f0b4c
git describe: v4.18.7-198-gae285c20144a
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-4.18-oe/build/v4.18.7-198-gae285c20144a
No regressions (compared to build v4.18.7)
Ran 20231 total tests in the following environments and test suites.
Environments
--------------
- dragonboard-410c - arm64
- hi6220-hikey - arm64
- i386
- juno-r2 - arm64
- qemu_arm
- qemu_arm64
- qemu_i386
- qemu_x86_64
- x15 - arm
- x86_64
Test Suites
-----------
* boot
* kselftest
* libhugetlbfs
* ltp-cap_bounds-tests
* ltp-containers-tests
* ltp-cve-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-nptl-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* ltp-timers-tests
* ltp-open-posix-tests
* kselftest-vsyscall-mode-native
* kselftest-vsyscall-mode-none
Signature · 2 lines
Linaro LKFT https://lkft.linaro.org
Greg Kroah-Hartman
maintainerQuoted 16 lines · Naresh Kamboju
Quoted 14 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.18.8 release. There are 197 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat Sep 15 13:17:57 UTC 2018. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.18.8-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.18.y
and the diffstat can be found below.
Quoted 7 lines
Quoted 3 lines
thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm,x86_64and i386.
Wonderful, thanks for testing all of these and letting me know.
greg k-h
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.18.8 release. There are 197 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat Sep 15 13:17:57 UTC 2018. Anything received after that time might be too late.
Build results:
total: 139 pass: 139 fail: 0 Qemu test results: total: 221 pass: 221 fail: 0
Details are available at https://kerneltests.org/builders/.
Guenter
Quoted 6 lines · Guenter Roeck
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.18.8 release. There are 197 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 9 lines
Quoted 3 lines
Responses should be made by Sat Sep 15 13:17:57 UTC 2018. Anything received after that time might be too late.
Build results:
total: 139 pass: 139 fail: 0 Qemu test results: total: 221 pass: 221 fail: 0
No wait that was 3.18. Here are the results for 4.18:
Build results:
total: 137 pass: 137 fail: 0 Qemu test results: total: 318 pass: 318 fail: 0
Sorry for the confusion.
Guenter
Greg Kroah-Hartman
maintainerQuoted 7 lines · Guenter Roeck
Quoted 6 lines · Guenter Roeck
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.18.8 release. There are 197 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Responses should be made by Sat Sep 15 13:17:57 UTC 2018. Anything received after that time might be too late.
Build results:
total: 139 pass: 139 fail: 0 Qemu test results: total: 221 pass: 221 fail: 0
I was wondering what caused the numbers to drop :)
Quoted 8 lines
No wait that was 3.18. Here are the results for 4.18:
Build results:
total: 137 pass: 137 fail: 0 Qemu test results: total: 318 pass: 318 fail: 0Sorry for the confusion.
No problem at all. Thanks for testing all of these and letting me know.
greg k-h