Re: [PATCH 33/44] drm/mcde: Don't use drm_device->dev_private

2020-04-11 Thread Linus Walleij
On Fri, Apr 3, 2020 at 3:59 PM Daniel Vetter  wrote:

> Upcasting using a container_of macro is more typesafe, faster and
> easier for the compiler to optimize.
>
> Signed-off-by: Daniel Vetter 
> Cc: Linus Walleij 

Nice, thanks!
Reviewed-by: Linus Walleij 

Yours,
Linus Walleij
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 12/17] drm/mcde: Use mode->clock instead of reverse calculating it from the vrefresh

2020-04-11 Thread Linus Walleij
On Fri, Apr 3, 2020 at 10:41 PM Ville Syrjala
 wrote:

> From: Ville Syrjälä 
>
> htotal*vtotal*vrefresh ~= clock. So just say "clock" when we mean it.
>
> Cc: Linus Walleij 
> Cc: Sam Ravnborg 
> Signed-off-by: Ville Syrjälä 

Indeed :)
Reviewed-by: Linus Walleij 

Yours,
Linus Walleij
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 4.4 09/16] drm/omap: fix possible object reference leak

2020-04-11 Thread Sasha Levin
From: Wen Yang 

[ Upstream commit 47340e46f34a3b1d80e40b43ae3d7a8da34a3541 ]

The call to of_find_matching_node returns a node pointer with refcount
incremented thus it must be explicitly decremented after the last
usage.

Detected by coccinelle with the following warnings:
drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c:212:2-8: ERROR: missing 
of_node_put; acquired a node pointer with refcount incremented on line 209, but 
without a corresponding object release within this function.
drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c:237:1-7: ERROR: missing 
of_node_put; acquired a node pointer with refcount incremented on line 209, but 
without a corresponding object release within this function.

Signed-off-by: Wen Yang 
Reviewed-by: Laurent Pinchart 
Reviewed-by: Mukesh Ojha 
Cc: Tomi Valkeinen 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Sebastian Reichel 
Cc: Laurent Pinchart 
Cc: dri-devel@lists.freedesktop.org
Cc: linux-ker...@vger.kernel.org
Cc: Markus Elfring 
Signed-off-by: Tomi Valkeinen 
Link: 
https://patchwork.freedesktop.org/patch/msgid/1554692313-28882-2-git-send-email-wen.yan...@zte.com.cn
Signed-off-by: Sasha Levin 
---
 drivers/video/fbdev/omap2/dss/omapdss-boot-init.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c 
b/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c
index 8b6f6d5fdd68b..43186fa8a13c9 100644
--- a/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c
+++ b/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c
@@ -194,7 +194,7 @@ static int __init omapdss_boot_init(void)
dss = of_find_matching_node(NULL, omapdss_of_match);
 
if (dss == NULL || !of_device_is_available(dss))
-   return 0;
+   goto put_node;
 
omapdss_walk_device(dss, true);
 
@@ -221,6 +221,8 @@ static int __init omapdss_boot_init(void)
kfree(n);
}
 
+put_node:
+   of_node_put(dss);
return 0;
 }
 
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 4.9 08/26] drm/tegra: dc: Release PM and RGB output when client's registration fails

2020-04-11 Thread Sasha Levin
From: Dmitry Osipenko 

[ Upstream commit 0411ea89a689531e1829fdf8af3747646c02c721 ]

Runtime PM and RGB output need to be released when host1x client
registration fails. The releasing is missed in the code, let's correct it.

Signed-off-by: Dmitry Osipenko 
Signed-off-by: Thierry Reding 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/tegra/dc.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
index 4010d69cbd084..9cb742c01c28a 100644
--- a/drivers/gpu/drm/tegra/dc.c
+++ b/drivers/gpu/drm/tegra/dc.c
@@ -2019,10 +2019,16 @@ static int tegra_dc_probe(struct platform_device *pdev)
if (err < 0) {
dev_err(>dev, "failed to register host1x client: %d\n",
err);
-   return err;
+   goto disable_pm;
}
 
return 0;
+
+disable_pm:
+   pm_runtime_disable(>dev);
+   tegra_dc_rgb_remove(dc);
+
+   return err;
 }
 
 static int tegra_dc_remove(struct platform_device *pdev)
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 4.9 15/26] drm/omap: fix possible object reference leak

2020-04-11 Thread Sasha Levin
From: Wen Yang 

[ Upstream commit 47340e46f34a3b1d80e40b43ae3d7a8da34a3541 ]

The call to of_find_matching_node returns a node pointer with refcount
incremented thus it must be explicitly decremented after the last
usage.

Detected by coccinelle with the following warnings:
drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c:212:2-8: ERROR: missing 
of_node_put; acquired a node pointer with refcount incremented on line 209, but 
without a corresponding object release within this function.
drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c:237:1-7: ERROR: missing 
of_node_put; acquired a node pointer with refcount incremented on line 209, but 
without a corresponding object release within this function.

Signed-off-by: Wen Yang 
Reviewed-by: Laurent Pinchart 
Reviewed-by: Mukesh Ojha 
Cc: Tomi Valkeinen 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Sebastian Reichel 
Cc: Laurent Pinchart 
Cc: dri-devel@lists.freedesktop.org
Cc: linux-ker...@vger.kernel.org
Cc: Markus Elfring 
Signed-off-by: Tomi Valkeinen 
Link: 
https://patchwork.freedesktop.org/patch/msgid/1554692313-28882-2-git-send-email-wen.yan...@zte.com.cn
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c 
b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
index 136d30484d023..46111e9ee9a25 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
@@ -194,7 +194,7 @@ static int __init omapdss_boot_init(void)
dss = of_find_matching_node(NULL, omapdss_of_match);
 
if (dss == NULL || !of_device_is_available(dss))
-   return 0;
+   goto put_node;
 
omapdss_walk_device(dss, true);
 
@@ -219,6 +219,8 @@ static int __init omapdss_boot_init(void)
kfree(n);
}
 
+put_node:
+   of_node_put(dss);
return 0;
 }
 
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 4.14 21/37] drm/omap: fix possible object reference leak

2020-04-11 Thread Sasha Levin
From: Wen Yang 

[ Upstream commit 47340e46f34a3b1d80e40b43ae3d7a8da34a3541 ]

The call to of_find_matching_node returns a node pointer with refcount
incremented thus it must be explicitly decremented after the last
usage.

Detected by coccinelle with the following warnings:
drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c:212:2-8: ERROR: missing 
of_node_put; acquired a node pointer with refcount incremented on line 209, but 
without a corresponding object release within this function.
drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c:237:1-7: ERROR: missing 
of_node_put; acquired a node pointer with refcount incremented on line 209, but 
without a corresponding object release within this function.

Signed-off-by: Wen Yang 
Reviewed-by: Laurent Pinchart 
Reviewed-by: Mukesh Ojha 
Cc: Tomi Valkeinen 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Sebastian Reichel 
Cc: Laurent Pinchart 
Cc: dri-devel@lists.freedesktop.org
Cc: linux-ker...@vger.kernel.org
Cc: Markus Elfring 
Signed-off-by: Tomi Valkeinen 
Link: 
https://patchwork.freedesktop.org/patch/msgid/1554692313-28882-2-git-send-email-wen.yan...@zte.com.cn
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c 
b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
index bf626acae2712..cd8e9b799b9a5 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
@@ -193,7 +193,7 @@ static int __init omapdss_boot_init(void)
dss = of_find_matching_node(NULL, omapdss_of_match);
 
if (dss == NULL || !of_device_is_available(dss))
-   return 0;
+   goto put_node;
 
omapdss_walk_device(dss, true);
 
@@ -218,6 +218,8 @@ static int __init omapdss_boot_init(void)
kfree(n);
}
 
+put_node:
+   of_node_put(dss);
return 0;
 }
 
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 4.19 33/66] drm/omap: fix possible object reference leak

2020-04-11 Thread Sasha Levin
From: Wen Yang 

[ Upstream commit 47340e46f34a3b1d80e40b43ae3d7a8da34a3541 ]

The call to of_find_matching_node returns a node pointer with refcount
incremented thus it must be explicitly decremented after the last
usage.

Detected by coccinelle with the following warnings:
drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c:212:2-8: ERROR: missing 
of_node_put; acquired a node pointer with refcount incremented on line 209, but 
without a corresponding object release within this function.
drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c:237:1-7: ERROR: missing 
of_node_put; acquired a node pointer with refcount incremented on line 209, but 
without a corresponding object release within this function.

Signed-off-by: Wen Yang 
Reviewed-by: Laurent Pinchart 
Reviewed-by: Mukesh Ojha 
Cc: Tomi Valkeinen 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Sebastian Reichel 
Cc: Laurent Pinchart 
Cc: dri-devel@lists.freedesktop.org
Cc: linux-ker...@vger.kernel.org
Cc: Markus Elfring 
Signed-off-by: Tomi Valkeinen 
Link: 
https://patchwork.freedesktop.org/patch/msgid/1554692313-28882-2-git-send-email-wen.yan...@zte.com.cn
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c 
b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
index 3bfb95d230e0e..d8fb686c1fda9 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
@@ -193,7 +193,7 @@ static int __init omapdss_boot_init(void)
dss = of_find_matching_node(NULL, omapdss_of_match);
 
if (dss == NULL || !of_device_is_available(dss))
-   return 0;
+   goto put_node;
 
omapdss_walk_device(dss, true);
 
@@ -218,6 +218,8 @@ static int __init omapdss_boot_init(void)
kfree(n);
}
 
+put_node:
+   of_node_put(dss);
return 0;
 }
 
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 4.19 39/66] drm/amd/display: dal_ddc_i2c_payloads_create can fail causing panic

2020-04-11 Thread Sasha Levin
From: Aric Cyr 

[ Upstream commit 6a6c4a4d459ecacc9013c45dcbf2bc9747fdbdbd ]

[Why]
Since the i2c payload allocation can fail need to check return codes

[How]
Clean up i2c payload allocations and check for errors

Signed-off-by: Aric Cyr 
Reviewed-by: Joshua Aberback 
Acked-by: Rodrigo Siqueira 
Acked-by: Harry Wentland 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 .../gpu/drm/amd/display/dc/core/dc_link_ddc.c | 52 +--
 1 file changed, 25 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c 
b/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
index 46c9cb47a96e5..145af3bb2dfcb 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
@@ -127,22 +127,16 @@ struct aux_payloads {
struct vector payloads;
 };
 
-static struct i2c_payloads *dal_ddc_i2c_payloads_create(struct dc_context 
*ctx, uint32_t count)
+static bool dal_ddc_i2c_payloads_create(
+   struct dc_context *ctx,
+   struct i2c_payloads *payloads,
+   uint32_t count)
 {
-   struct i2c_payloads *payloads;
-
-   payloads = kzalloc(sizeof(struct i2c_payloads), GFP_KERNEL);
-
-   if (!payloads)
-   return NULL;
-
if (dal_vector_construct(
>payloads, ctx, count, sizeof(struct i2c_payload)))
-   return payloads;
-
-   kfree(payloads);
-   return NULL;
+   return true;
 
+   return false;
 }
 
 static struct i2c_payload *dal_ddc_i2c_payloads_get(struct i2c_payloads *p)
@@ -155,14 +149,12 @@ static uint32_t dal_ddc_i2c_payloads_get_count(struct 
i2c_payloads *p)
return p->payloads.count;
 }
 
-static void dal_ddc_i2c_payloads_destroy(struct i2c_payloads **p)
+static void dal_ddc_i2c_payloads_destroy(struct i2c_payloads *p)
 {
-   if (!p || !*p)
+   if (!p)
return;
-   dal_vector_destruct(&(*p)->payloads);
-   kfree(*p);
-   *p = NULL;
 
+   dal_vector_destruct(>payloads);
 }
 
 static struct aux_payloads *dal_ddc_aux_payloads_create(struct dc_context 
*ctx, uint32_t count)
@@ -580,9 +572,13 @@ bool dal_ddc_service_query_ddc_data(
 
uint32_t payloads_num = write_payloads + read_payloads;
 
+
if (write_size > EDID_SEGMENT_SIZE || read_size > EDID_SEGMENT_SIZE)
return false;
 
+   if (!payloads_num)
+   return false;
+
/*TODO: len of payload data for i2c and aux is uint8,
 *  but we want to read 256 over i2c*/
if (dal_ddc_service_is_in_aux_transaction_mode(ddc)) {
@@ -613,23 +609,25 @@ bool dal_ddc_service_query_ddc_data(
dal_ddc_aux_payloads_destroy();
 
} else {
-   struct i2c_payloads *payloads =
-   dal_ddc_i2c_payloads_create(ddc->ctx, payloads_num);
+   struct i2c_command command = {0};
+   struct i2c_payloads payloads;
 
-   struct i2c_command command = {
-   .payloads = dal_ddc_i2c_payloads_get(payloads),
-   .number_of_payloads = 0,
-   .engine = DDC_I2C_COMMAND_ENGINE,
-   .speed = ddc->ctx->dc->caps.i2c_speed_in_khz };
+   if (!dal_ddc_i2c_payloads_create(ddc->ctx, , 
payloads_num))
+   return false;
+
+   command.payloads = dal_ddc_i2c_payloads_get();
+   command.number_of_payloads = 0;
+   command.engine = DDC_I2C_COMMAND_ENGINE;
+   command.speed = ddc->ctx->dc->caps.i2c_speed_in_khz;
 
dal_ddc_i2c_payloads_add(
-   payloads, address, write_size, write_buf, true);
+   , address, write_size, write_buf, true);
 
dal_ddc_i2c_payloads_add(
-   payloads, address, read_size, read_buf, false);
+   , address, read_size, read_buf, false);
 
command.number_of_payloads =
-   dal_ddc_i2c_payloads_get_count(payloads);
+   dal_ddc_i2c_payloads_get_count();
 
ret = dm_helpers_submit_i2c(
ddc->ctx,
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 4.14 12/37] drm/tegra: dc: Release PM and RGB output when client's registration fails

2020-04-11 Thread Sasha Levin
From: Dmitry Osipenko 

[ Upstream commit 0411ea89a689531e1829fdf8af3747646c02c721 ]

Runtime PM and RGB output need to be released when host1x client
registration fails. The releasing is missed in the code, let's correct it.

Signed-off-by: Dmitry Osipenko 
Signed-off-by: Thierry Reding 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/tegra/dc.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
index 4df39112e38ec..176fb9a40ddf9 100644
--- a/drivers/gpu/drm/tegra/dc.c
+++ b/drivers/gpu/drm/tegra/dc.c
@@ -2059,10 +2059,16 @@ static int tegra_dc_probe(struct platform_device *pdev)
if (err < 0) {
dev_err(>dev, "failed to register host1x client: %d\n",
err);
-   return err;
+   goto disable_pm;
}
 
return 0;
+
+disable_pm:
+   pm_runtime_disable(>dev);
+   tegra_dc_rgb_remove(dc);
+
+   return err;
 }
 
 static int tegra_dc_remove(struct platform_device *pdev)
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 4.19 48/66] drm/msm/a5xx: Always set an OPP supported hardware value

2020-04-11 Thread Sasha Levin
From: Jordan Crouse 

[ Upstream commit 0478b4fc5f37f4d494245fe7bcce3f531cf380e9 ]

If the opp table specifies opp-supported-hw as a property but the driver
has not set a supported hardware value the OPP subsystem will reject
all the table entries.

Set a "default" value that will match the default table entries but not
conflict with any possible real bin values. Also fix a small memory leak
and free the buffer allocated by nvmem_cell_read().

Signed-off-by: Jordan Crouse 
Reviewed-by: Eric Anholt 
Signed-off-by: Rob Clark 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 27 ---
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
index ba6f3c14495c0..dd298abc5f393 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
@@ -1474,18 +1474,31 @@ static const struct adreno_gpu_funcs funcs = {
 static void check_speed_bin(struct device *dev)
 {
struct nvmem_cell *cell;
-   u32 bin, val;
+   u32 val;
+
+   /*
+* If the OPP table specifies a opp-supported-hw property then we have
+* to set something with dev_pm_opp_set_supported_hw() or the table
+* doesn't get populated so pick an arbitrary value that should
+* ensure the default frequencies are selected but not conflict with any
+* actual bins
+*/
+   val = 0x80;
 
cell = nvmem_cell_get(dev, "speed_bin");
 
-   /* If a nvmem cell isn't defined, nothing to do */
-   if (IS_ERR(cell))
-   return;
+   if (!IS_ERR(cell)) {
+   void *buf = nvmem_cell_read(cell, NULL);
+
+   if (!IS_ERR(buf)) {
+   u8 bin = *((u8 *) buf);
 
-   bin = *((u32 *) nvmem_cell_read(cell, NULL));
-   nvmem_cell_put(cell);
+   val = (1 << bin);
+   kfree(buf);
+   }
 
-   val = (1 << bin);
+   nvmem_cell_put(cell);
+   }
 
dev_pm_opp_set_supported_hw(dev, , 1);
 }
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 4.19 47/66] drm/msm: fix leaks if initialization fails

2020-04-11 Thread Sasha Levin
From: Pavel Machek 

[ Upstream commit 66be340f827554cb1c8a1ed7dea97920b4085af2 ]

We should free resources in unlikely case of allocation failure.

Signed-off-by: Pavel Machek 
Signed-off-by: Rob Clark 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/msm/msm_drv.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index 6f81de85fb860..01524009dede8 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -495,8 +495,10 @@ static int msm_drm_init(struct device *dev, struct 
drm_driver *drv)
if (!dev->dma_parms) {
dev->dma_parms = devm_kzalloc(dev, sizeof(*dev->dma_parms),
  GFP_KERNEL);
-   if (!dev->dma_parms)
-   return -ENOMEM;
+   if (!dev->dma_parms) {
+   ret = -ENOMEM;
+   goto err_msm_uninit;
+   }
}
dma_set_max_seg_size(dev, DMA_BIT_MASK(32));
 
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 4.19 66/66] PCI: Use ioremap(), not phys_to_virt() for platform ROM

2020-04-11 Thread Sasha Levin
From: Mikel Rychliski 

[ Upstream commit 72e0ef0e5f067fd991f702f0b2635d911d0cf208 ]

On some EFI systems, the video BIOS is provided by the EFI firmware.  The
boot stub code stores the physical address of the ROM image in pdev->rom.
Currently we attempt to access this pointer using phys_to_virt(), which
doesn't work with CONFIG_HIGHMEM.

On these systems, attempting to load the radeon module on a x86_32 kernel
can result in the following:

  BUG: unable to handle page fault for address: 3e8ed03c
  #PF: supervisor read access in kernel mode
  #PF: error_code(0x) - not-present page
  *pde = 
  Oops:  [#1] PREEMPT SMP
  CPU: 0 PID: 317 Comm: systemd-udevd Not tainted 5.6.0-rc3-next-20200228 #2
  Hardware name: Apple Computer, Inc. MacPro1,1/Mac-F4208DC8, BIOS 
MP11.88Z.005C.B08.0707021221 07/02/07
  EIP: radeon_get_bios+0x5ed/0xe50 [radeon]
  Code: 00 00 84 c0 0f 85 12 fd ff ff c7 87 64 01 00 00 00 00 00 00 8b 47 08 8b 
55 b0 e8 1e 83 e1 d6 85 c0 74 1a 8b 55 c0 85 d2 74 13 <80> 38 55 75 0e 80 78 01 
aa 0f 84 a4 03 00 00 8d 74 26 00 68 dc 06
  EAX: 3e8ed03c EBX:  ECX: 3e8ed03c EDX: 0001
  ESI: 0004 EDI: eec04000 EBP: eef3fc60 ESP: eef3fbe0
  DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 EFLAGS: 00010206
  CR0: 80050033 CR2: 3e8ed03c CR3: 2ec77000 CR4: 06d0
  Call Trace:
   r520_init+0x26/0x240 [radeon]
   radeon_device_init+0x533/0xa50 [radeon]
   radeon_driver_load_kms+0x80/0x220 [radeon]
   drm_dev_register+0xa7/0x180 [drm]
   radeon_pci_probe+0x10f/0x1a0 [radeon]
   pci_device_probe+0xd4/0x140

Fix the issue by updating all drivers which can access a platform provided
ROM. Instead of calling the helper function pci_platform_rom() which uses
phys_to_virt(), call ioremap() directly on the pdev->rom.

radeon_read_platform_bios() previously directly accessed an __iomem
pointer. Avoid this by calling memcpy_fromio() instead of kmemdup().

pci_platform_rom() now has no remaining callers, so remove it.

Link: https://lore.kernel.org/r/20200319021623.5426-1-mi...@mikelr.com
Signed-off-by: Mikel Rychliski 
Signed-off-by: Bjorn Helgaas 
Acked-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c  | 31 +++
 .../drm/nouveau/nvkm/subdev/bios/shadowpci.c  | 17 --
 drivers/gpu/drm/radeon/radeon_bios.c  | 30 +++---
 drivers/pci/rom.c | 17 --
 include/linux/pci.h   |  1 -
 5 files changed, 52 insertions(+), 44 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
index a5df80d50d447..6cf3dd5edffda 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
@@ -191,30 +191,35 @@ static bool amdgpu_read_bios_from_rom(struct 
amdgpu_device *adev)
 
 static bool amdgpu_read_platform_bios(struct amdgpu_device *adev)
 {
-   uint8_t __iomem *bios;
-   size_t size;
+   phys_addr_t rom = adev->pdev->rom;
+   size_t romlen = adev->pdev->romlen;
+   void __iomem *bios;
 
adev->bios = NULL;
 
-   bios = pci_platform_rom(adev->pdev, );
-   if (!bios) {
+   if (!rom || romlen == 0)
return false;
-   }
 
-   adev->bios = kzalloc(size, GFP_KERNEL);
-   if (adev->bios == NULL)
+   adev->bios = kzalloc(romlen, GFP_KERNEL);
+   if (!adev->bios)
return false;
 
-   memcpy_fromio(adev->bios, bios, size);
+   bios = ioremap(rom, romlen);
+   if (!bios)
+   goto free_bios;
 
-   if (!check_atom_bios(adev->bios, size)) {
-   kfree(adev->bios);
-   return false;
-   }
+   memcpy_fromio(adev->bios, bios, romlen);
+   iounmap(bios);
 
-   adev->bios_size = size;
+   if (!check_atom_bios(adev->bios, romlen))
+   goto free_bios;
+
+   adev->bios_size = romlen;
 
return true;
+free_bios:
+   kfree(adev->bios);
+   return false;
 }
 
 #ifdef CONFIG_ACPI
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c 
b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
index 9b91da09dc5f8..8d9812a51ef63 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
@@ -101,9 +101,13 @@ platform_init(struct nvkm_bios *bios, const char *name)
else
return ERR_PTR(-ENODEV);
 
+   if (!pdev->rom || pdev->romlen == 0)
+   return ERR_PTR(-ENODEV);
+
if ((priv = kmalloc(sizeof(*priv), GFP_KERNEL))) {
+   priv->size = pdev->romlen;
if (ret = -ENODEV,
-   (priv->rom = pci_platform_rom(pdev, >size)))
+   (priv->rom = ioremap(pdev->rom, pdev->romlen)))
return priv;
kfree(priv);
}
@@ -111,11 +115,20 @@ platform_init(struct nvkm_bios *bios, const char *name)
return 

[PATCH AUTOSEL 4.19 36/66] drm/stm: ltdc: check crtc state before enabling LIE

2020-04-11 Thread Sasha Levin
From: Yannick Fertre 

[ Upstream commit a6bd58c51ac43083f3977057a7ad668def55812f ]

Following investigations of a hardware bug, the LIE interrupt
can occur while the display controller is not activated.
LIE interrupt (vblank) don't have to be set if the CRTC is not
enabled.

Signed-off-by: Yannick Fertre 
Acked-by: Philippe Cornu 
Signed-off-by: Benjamin Gaignard 
Link: 
https://patchwork.freedesktop.org/patch/msgid/1579601650-7055-1-git-send-email-yannick.fer...@st.com
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/stm/ltdc.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index 477d0a27b9a5d..75d108db127c8 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -612,9 +612,14 @@ static const struct drm_crtc_helper_funcs 
ltdc_crtc_helper_funcs = {
 static int ltdc_crtc_enable_vblank(struct drm_crtc *crtc)
 {
struct ltdc_device *ldev = crtc_to_ltdc(crtc);
+   struct drm_crtc_state *state = crtc->state;
 
DRM_DEBUG_DRIVER("\n");
-   reg_set(ldev->regs, LTDC_IER, IER_LIE);
+
+   if (state->enable)
+   reg_set(ldev->regs, LTDC_IER, IER_LIE);
+   else
+   return -EPERM;
 
return 0;
 }
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 4.19 30/66] drm/sun4i: dsi: Use NULL to signify "no panel"

2020-04-11 Thread Sasha Levin
From: Samuel Holland 

[ Upstream commit 0e4e3fb4901d19f49e5c0a582f383b10dda8d1c5 ]

The continued use of an ERR_PTR to signify "no panel" outside of
sun6i_dsi_attach is confusing because it is a double negative. Because
the connector always reports itself as connected, there is also the
possibility of sending an ERR_PTR to drm_panel_get_modes(), which would
crash.

Solve both of these by only storing the panel pointer if it is valid.

Fixes: 133add5b5ad4 ("drm/sun4i: Add Allwinner A31 MIPI-DSI controller support")
Signed-off-by: Samuel Holland 
Signed-off-by: Maxime Ripard 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20200211072858.30784-2-sam...@sholland.org
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c 
b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
index 79eb11cd185d1..bc9454a562877 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -642,7 +642,7 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder 
*encoder)
sun6i_dphy_init(dsi->dphy, device->lanes);
sun6i_dphy_power_on(dsi->dphy, device->lanes);
 
-   if (!IS_ERR(dsi->panel))
+   if (dsi->panel)
drm_panel_prepare(dsi->panel);
 
/*
@@ -657,7 +657,7 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder 
*encoder)
 * ordering on the panels I've tested it with, so I guess this
 * will do for now, until that IP is better understood.
 */
-   if (!IS_ERR(dsi->panel))
+   if (dsi->panel)
drm_panel_enable(dsi->panel);
 
sun6i_dsi_start(dsi, DSI_START_HSC);
@@ -673,7 +673,7 @@ static void sun6i_dsi_encoder_disable(struct drm_encoder 
*encoder)
 
DRM_DEBUG_DRIVER("Disabling DSI output\n");
 
-   if (!IS_ERR(dsi->panel)) {
+   if (dsi->panel) {
drm_panel_disable(dsi->panel);
drm_panel_unprepare(dsi->panel);
}
@@ -835,11 +835,13 @@ static int sun6i_dsi_attach(struct mipi_dsi_host *host,
struct mipi_dsi_device *device)
 {
struct sun6i_dsi *dsi = host_to_sun6i_dsi(host);
+   struct drm_panel *panel = of_drm_find_panel(device->dev.of_node);
 
+   if (IS_ERR(panel))
+   return PTR_ERR(panel);
+
+   dsi->panel = panel;
dsi->device = device;
-   dsi->panel = of_drm_find_panel(device->dev.of_node);
-   if (IS_ERR(dsi->panel))
-   return PTR_ERR(dsi->panel);
 
dev_info(host->dev, "Attached device %s\n", device->name);
 
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 4.19 20/66] drm/amd/display: Fix default logger mask definition

2020-04-11 Thread Sasha Levin
From: Eric Bernstein 

[ Upstream commit ccb6af1e25830e5601b6beacc698390f0245316f ]

[Why]
Logger mask was updated to uint64_t, however default mask definition was
not updated for unsigned long long

[How]
Update DC_DEFAULT_LOG_MASK to support uint64_t type

Signed-off-by: Eric Bernstein 
Reviewed-by: Dmytro Laktyushkin 
Acked-by: Rodrigo Siqueira 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 .../drm/amd/display/include/logger_types.h| 63 ++-
 1 file changed, 32 insertions(+), 31 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/include/logger_types.h 
b/drivers/gpu/drm/amd/display/include/logger_types.h
index ad3695e67b76f..dbc5a4d6d2e3f 100644
--- a/drivers/gpu/drm/amd/display/include/logger_types.h
+++ b/drivers/gpu/drm/amd/display/include/logger_types.h
@@ -106,36 +106,37 @@ enum dc_log_type {
 #define DC_MIN_LOG_MASK ((1 << LOG_ERROR) | \
(1 << LOG_DETECTION_EDID_PARSER))
 
-#define DC_DEFAULT_LOG_MASK ((1 << LOG_ERROR) | \
-   (1 << LOG_WARNING) | \
-   (1 << LOG_EVENT_MODE_SET) | \
-   (1 << LOG_EVENT_DETECTION) | \
-   (1 << LOG_EVENT_LINK_TRAINING) | \
-   (1 << LOG_EVENT_LINK_LOSS) | \
-   (1 << LOG_EVENT_UNDERFLOW) | \
-   (1 << LOG_RESOURCE) | \
-   (1 << LOG_FEATURE_OVERRIDE) | \
-   (1 << LOG_DETECTION_EDID_PARSER) | \
-   (1 << LOG_DC) | \
-   (1 << LOG_HW_HOTPLUG) | \
-   (1 << LOG_HW_SET_MODE) | \
-   (1 << LOG_HW_RESUME_S3) | \
-   (1 << LOG_HW_HPD_IRQ) | \
-   (1 << LOG_SYNC) | \
-   (1 << LOG_BANDWIDTH_VALIDATION) | \
-   (1 << LOG_MST) | \
-   (1 << LOG_DETECTION_DP_CAPS) | \
-   (1 << LOG_BACKLIGHT)) | \
-   (1 << LOG_I2C_AUX) | \
-   (1 << LOG_IF_TRACE) | \
-   (1 << LOG_DTN) /* | \
-   (1 << LOG_DEBUG) | \
-   (1 << LOG_BIOS) | \
-   (1 << LOG_SURFACE) | \
-   (1 << LOG_SCALER) | \
-   (1 << LOG_DML) | \
-   (1 << LOG_HW_LINK_TRAINING) | \
-   (1 << LOG_HW_AUDIO)| \
-   (1 << LOG_BANDWIDTH_CALCS)*/
+#define DC_DEFAULT_LOG_MASK ((1ULL << LOG_ERROR) | \
+   (1ULL << LOG_WARNING) | \
+   (1ULL << LOG_EVENT_MODE_SET) | \
+   (1ULL << LOG_EVENT_DETECTION) | \
+   (1ULL << LOG_EVENT_LINK_TRAINING) | \
+   (1ULL << LOG_EVENT_LINK_LOSS) | \
+   (1ULL << LOG_EVENT_UNDERFLOW) | \
+   (1ULL << LOG_RESOURCE) | \
+   (1ULL << LOG_FEATURE_OVERRIDE) | \
+   (1ULL << LOG_DETECTION_EDID_PARSER) | \
+   (1ULL << LOG_DC) | \
+   (1ULL << LOG_HW_HOTPLUG) | \
+   (1ULL << LOG_HW_SET_MODE) | \
+   (1ULL << LOG_HW_RESUME_S3) | \
+   (1ULL << LOG_HW_HPD_IRQ) | \
+   (1ULL << LOG_SYNC) | \
+   (1ULL << LOG_BANDWIDTH_VALIDATION) | \
+   (1ULL << LOG_MST) | \
+   (1ULL << LOG_DETECTION_DP_CAPS) | \
+   (1ULL << LOG_BACKLIGHT)) | \
+   (1ULL << LOG_I2C_AUX) | \
+   (1ULL << LOG_IF_TRACE) | \
+   (1ULL << LOG_HDMI_FRL) | \
+   (1ULL << LOG_DTN) /* | \
+   (1ULL << LOG_DEBUG) | \
+   (1ULL << LOG_BIOS) | \
+   (1ULL << LOG_SURFACE) | \
+   (1ULL << LOG_SCALER) | \
+   (1ULL << LOG_DML) | \
+   (1ULL << LOG_HW_LINK_TRAINING) | \
+   (1ULL << LOG_HW_AUDIO)| \
+   (1ULL << LOG_BANDWIDTH_CALCS)*/
 
 #endif /* __DAL_LOGGER_TYPES_H__ */
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 4.19 17/66] drm/amd/display: writing stereo polarity register if swapped

2020-04-11 Thread Sasha Levin
From: Martin Leung 

[ Upstream commit e592e85f3378246dd66b861fa60ef803d8cece6b ]

[why]
on some displays that prefer swapped polarity we were seeing L/R images
swapped because OTG_STEREO_SYNC_OUTPUT_POLARITY would always be mapped
to 0

[how]
fix initial dal3 implementation to properly update the polarity field
according to the crtc_stereo_flags (same as
OTG_STEREO_EYE_FLAG_POLARITY)

Signed-off-by: Martin Leung 
Reviewed-by: Aric Cyr 
Acked-by: Rodrigo Siqueira 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c 
b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c
index 411f89218e019..ff3a87c9d5194 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c
@@ -1161,7 +1161,7 @@ static void optc1_enable_stereo(struct timing_generator 
*optc,
REG_UPDATE_3(OTG_STEREO_CONTROL,
OTG_STEREO_EN, stereo_en,
OTG_STEREO_SYNC_OUTPUT_LINE_NUM, 0,
-   OTG_STEREO_SYNC_OUTPUT_POLARITY, 0);
+   OTG_STEREO_SYNC_OUTPUT_POLARITY, 
flags->RIGHT_EYE_POLARITY == 0 ? 0 : 1);
 
if (flags->PROGRAM_POLARITY)
REG_UPDATE(OTG_STEREO_CONTROL,
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 4.19 15/66] drm/amd/display: Stop if retimer is not available

2020-04-11 Thread Sasha Levin
From: Rodrigo Siqueira 

[ Upstream commit a0e40018dcc3f59a10ca21d58f8ea8ceb1b035ac ]

Raven provides retimer feature support that requires i2c interaction in
order to make it work well, all settings required for this configuration
are loaded from the Atom bios which include the i2c address. If the
retimer feature is not available, we should abort the attempt to set
this feature, otherwise, it makes the following line return
I2C_CHANNEL_OPERATION_NO_RESPONSE:

 i2c_success = i2c_write(pipe_ctx, slave_address, buffer, sizeof(buffer));
 ...
 if (!i2c_success)
   ASSERT(i2c_success);

This ends up causing problems with hotplugging HDMI displays on Raven,
and causes retimer settings to warn like so:

WARNING: CPU: 1 PID: 429 at
drivers/gpu/drm/amd/amdgpu/../dal/dc/core/dc_link.c:1998
write_i2c_retimer_setting+0xc2/0x3c0 [amdgpu] Modules linked in:
edac_mce_amd ccp kvm irqbypass binfmt_misc crct10dif_pclmul crc32_pclmul
ghash_clmulni_intel snd_hda_codec_realtek snd_hda_codec_generic
ledtrig_audio snd_hda_codec_hdmi snd_hda_intel amdgpu(+) snd_hda_codec
snd_hda_core snd_hwdep snd_pcm snd_seq_midi snd_seq_midi_event
snd_rawmidi aesni_intel snd_seq amd_iommu_v2 gpu_sched aes_x86_64
crypto_simd cryptd glue_helper snd_seq_device ttm drm_kms_helper
snd_timer eeepc_wmi wmi_bmof asus_wmi sparse_keymap drm mxm_wmi snd
k10temp fb_sys_fops syscopyarea sysfillrect sysimgblt soundcore joydev
input_leds mac_hid sch_fq_codel parport_pc ppdev lp parport ip_tables
x_tables autofs4 igb i2c_algo_bit hid_generic usbhid i2c_piix4 dca ahci
hid libahci video wmi gpio_amdpt gpio_generic CPU: 1 PID: 429 Comm:
systemd-udevd Tainted: GW 5.2.0-rc1sept162019+ #1
Hardware name: System manufacturer System Product Name/ROG STRIX B450-F
GAMING, BIOS 2605 08/06/2019
RIP: 0010:write_i2c_retimer_setting+0xc2/0x3c0 [amdgpu]
Code: ff 0f b6 4d ce 44 0f b6 45 cf 44 0f b6 c8 45 89 cf 44 89 e2 48 c7
c6 f0 34 bc c0 bf 04 00 00 00 e8 63 b0 90 ff 45 84 ff 75 02 <0f> 0b 42
0f b6 04 73 8d 50 f6 80 fa 02 77 8c 3c 0a 0f 85 c8 00 00 RSP:
0018:a99d02726fd0 EFLAGS: 00010246
RAX:  RBX: a99d02727035 RCX: 0006
RDX:  RSI: 0002 RDI: 976acc857440
RBP: a99d02727018 R08: 0002 R09: 0002a600
R10: e90610193680 R11: 05e3 R12: 005d
R13: 976ac4b201b8 R14: 0001 R15: 
FS:  7f14f99e1680() GS:976acc84() knlGS:
CS:  0010 DS:  ES:  CR0: 80050033
CR2: 7fdf212843b8 CR3: 000408906000 CR4: 003406e0
Call Trace:
 core_link_enable_stream+0x626/0x680 [amdgpu]
 dce110_apply_ctx_to_hw+0x414/0x4e0 [amdgpu]
 dc_commit_state+0x331/0x5e0 [amdgpu]
 ? drm_calc_timestamping_constants+0xf9/0x150 [drm]
 amdgpu_dm_atomic_commit_tail+0x395/0x1e00 [amdgpu]
 ? dm_plane_helper_prepare_fb+0x20c/0x280 [amdgpu]
 commit_tail+0x42/0x70 [drm_kms_helper]
 drm_atomic_helper_commit+0x10c/0x120 [drm_kms_helper]
 amdgpu_dm_atomic_commit+0x95/0xa0 [amdgpu]
 drm_atomic_commit+0x4a/0x50 [drm]
 restore_fbdev_mode_atomic+0x1c0/0x1e0 [drm_kms_helper]
 restore_fbdev_mode+0x4c/0x160 [drm_kms_helper]
 ? _cond_resched+0x19/0x40
 drm_fb_helper_restore_fbdev_mode_unlocked+0x4e/0xa0 [drm_kms_helper]
 drm_fb_helper_set_par+0x2d/0x50 [drm_kms_helper]
 fbcon_init+0x471/0x630
 visual_init+0xd5/0x130
 do_bind_con_driver+0x20a/0x430
 do_take_over_console+0x7d/0x1b0
 do_fbcon_takeover+0x5c/0xb0
 fbcon_event_notify+0x6cd/0x8a0
 notifier_call_chain+0x4c/0x70
 blocking_notifier_call_chain+0x43/0x60
 fb_notifier_call_chain+0x1b/0x20
 register_framebuffer+0x254/0x360
 __drm_fb_helper_initial_config_and_unlock+0x2c5/0x510 [drm_kms_helper]
 drm_fb_helper_initial_config+0x35/0x40 [drm_kms_helper]
 amdgpu_fbdev_init+0xcd/0x100 [amdgpu]
 amdgpu_device_init+0x1156/0x1930 [amdgpu]
 amdgpu_driver_load_kms+0x8d/0x2e0 [amdgpu]
 drm_dev_register+0x12b/0x1c0 [drm]
 amdgpu_pci_probe+0xd3/0x160 [amdgpu]
 local_pci_probe+0x47/0xa0
 pci_device_probe+0x142/0x1b0
 really_probe+0xf5/0x3d0
 driver_probe_device+0x11b/0x130
 device_driver_attach+0x58/0x60
 __driver_attach+0xa3/0x140
 ? device_driver_attach+0x60/0x60
 ? device_driver_attach+0x60/0x60
 bus_for_each_dev+0x74/0xb0
 ? kmem_cache_alloc_trace+0x1a3/0x1c0
 driver_attach+0x1e/0x20
 bus_add_driver+0x147/0x220
 ? 0xc0cb9000
 driver_register+0x60/0x100
 ? 0xc0cb9000
 __pci_register_driver+0x5a/0x60
 amdgpu_init+0x74/0x83 [amdgpu]
 do_one_initcall+0x4a/0x1fa
 ? _cond_resched+0x19/0x40
 ? kmem_cache_alloc_trace+0x3f/0x1c0
 ? __vunmap+0x1cc/0x200
 do_init_module+0x5f/0x227
 load_module+0x2330/0x2b40
 __do_sys_finit_module+0xfc/0x120
 ? __do_sys_finit_module+0xfc/0x120
 __x64_sys_finit_module+0x1a/0x20
 do_syscall_64+0x5a/0x130
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x7f14f9500839
Code: 00 f3 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89
f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01
f0 ff ff 73 01 c3 48 8b 0d 1f 

[PATCH AUTOSEL 5.4 108/108] PCI: Use ioremap(), not phys_to_virt() for platform ROM

2020-04-11 Thread Sasha Levin
From: Mikel Rychliski 

[ Upstream commit 72e0ef0e5f067fd991f702f0b2635d911d0cf208 ]

On some EFI systems, the video BIOS is provided by the EFI firmware.  The
boot stub code stores the physical address of the ROM image in pdev->rom.
Currently we attempt to access this pointer using phys_to_virt(), which
doesn't work with CONFIG_HIGHMEM.

On these systems, attempting to load the radeon module on a x86_32 kernel
can result in the following:

  BUG: unable to handle page fault for address: 3e8ed03c
  #PF: supervisor read access in kernel mode
  #PF: error_code(0x) - not-present page
  *pde = 
  Oops:  [#1] PREEMPT SMP
  CPU: 0 PID: 317 Comm: systemd-udevd Not tainted 5.6.0-rc3-next-20200228 #2
  Hardware name: Apple Computer, Inc. MacPro1,1/Mac-F4208DC8, BIOS 
MP11.88Z.005C.B08.0707021221 07/02/07
  EIP: radeon_get_bios+0x5ed/0xe50 [radeon]
  Code: 00 00 84 c0 0f 85 12 fd ff ff c7 87 64 01 00 00 00 00 00 00 8b 47 08 8b 
55 b0 e8 1e 83 e1 d6 85 c0 74 1a 8b 55 c0 85 d2 74 13 <80> 38 55 75 0e 80 78 01 
aa 0f 84 a4 03 00 00 8d 74 26 00 68 dc 06
  EAX: 3e8ed03c EBX:  ECX: 3e8ed03c EDX: 0001
  ESI: 0004 EDI: eec04000 EBP: eef3fc60 ESP: eef3fbe0
  DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 EFLAGS: 00010206
  CR0: 80050033 CR2: 3e8ed03c CR3: 2ec77000 CR4: 06d0
  Call Trace:
   r520_init+0x26/0x240 [radeon]
   radeon_device_init+0x533/0xa50 [radeon]
   radeon_driver_load_kms+0x80/0x220 [radeon]
   drm_dev_register+0xa7/0x180 [drm]
   radeon_pci_probe+0x10f/0x1a0 [radeon]
   pci_device_probe+0xd4/0x140

Fix the issue by updating all drivers which can access a platform provided
ROM. Instead of calling the helper function pci_platform_rom() which uses
phys_to_virt(), call ioremap() directly on the pdev->rom.

radeon_read_platform_bios() previously directly accessed an __iomem
pointer. Avoid this by calling memcpy_fromio() instead of kmemdup().

pci_platform_rom() now has no remaining callers, so remove it.

Link: https://lore.kernel.org/r/20200319021623.5426-1-mi...@mikelr.com
Signed-off-by: Mikel Rychliski 
Signed-off-by: Bjorn Helgaas 
Acked-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c  | 31 +++
 .../drm/nouveau/nvkm/subdev/bios/shadowpci.c  | 17 --
 drivers/gpu/drm/radeon/radeon_bios.c  | 30 +++---
 drivers/pci/rom.c | 17 --
 include/linux/pci.h   |  1 -
 5 files changed, 52 insertions(+), 44 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
index 50dff69a0f6e3..b1172d93c99c3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
@@ -192,30 +192,35 @@ static bool amdgpu_read_bios_from_rom(struct 
amdgpu_device *adev)
 
 static bool amdgpu_read_platform_bios(struct amdgpu_device *adev)
 {
-   uint8_t __iomem *bios;
-   size_t size;
+   phys_addr_t rom = adev->pdev->rom;
+   size_t romlen = adev->pdev->romlen;
+   void __iomem *bios;
 
adev->bios = NULL;
 
-   bios = pci_platform_rom(adev->pdev, );
-   if (!bios) {
+   if (!rom || romlen == 0)
return false;
-   }
 
-   adev->bios = kzalloc(size, GFP_KERNEL);
-   if (adev->bios == NULL)
+   adev->bios = kzalloc(romlen, GFP_KERNEL);
+   if (!adev->bios)
return false;
 
-   memcpy_fromio(adev->bios, bios, size);
+   bios = ioremap(rom, romlen);
+   if (!bios)
+   goto free_bios;
 
-   if (!check_atom_bios(adev->bios, size)) {
-   kfree(adev->bios);
-   return false;
-   }
+   memcpy_fromio(adev->bios, bios, romlen);
+   iounmap(bios);
 
-   adev->bios_size = size;
+   if (!check_atom_bios(adev->bios, romlen))
+   goto free_bios;
+
+   adev->bios_size = romlen;
 
return true;
+free_bios:
+   kfree(adev->bios);
+   return false;
 }
 
 #ifdef CONFIG_ACPI
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c 
b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
index 9b91da09dc5f8..8d9812a51ef63 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
@@ -101,9 +101,13 @@ platform_init(struct nvkm_bios *bios, const char *name)
else
return ERR_PTR(-ENODEV);
 
+   if (!pdev->rom || pdev->romlen == 0)
+   return ERR_PTR(-ENODEV);
+
if ((priv = kmalloc(sizeof(*priv), GFP_KERNEL))) {
+   priv->size = pdev->romlen;
if (ret = -ENODEV,
-   (priv->rom = pci_platform_rom(pdev, >size)))
+   (priv->rom = ioremap(pdev->rom, pdev->romlen)))
return priv;
kfree(priv);
}
@@ -111,11 +115,20 @@ platform_init(struct nvkm_bios *bios, const char *name)
return 

[PATCH AUTOSEL 4.19 14/66] drm/tegra: dc: Release PM and RGB output when client's registration fails

2020-04-11 Thread Sasha Levin
From: Dmitry Osipenko 

[ Upstream commit 0411ea89a689531e1829fdf8af3747646c02c721 ]

Runtime PM and RGB output need to be released when host1x client
registration fails. The releasing is missed in the code, let's correct it.

Signed-off-by: Dmitry Osipenko 
Signed-off-by: Thierry Reding 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/tegra/dc.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
index 965088afcfade..923088626e1f4 100644
--- a/drivers/gpu/drm/tegra/dc.c
+++ b/drivers/gpu/drm/tegra/dc.c
@@ -2420,10 +2420,16 @@ static int tegra_dc_probe(struct platform_device *pdev)
if (err < 0) {
dev_err(>dev, "failed to register host1x client: %d\n",
err);
-   return err;
+   goto disable_pm;
}
 
return 0;
+
+disable_pm:
+   pm_runtime_disable(>dev);
+   tegra_dc_rgb_remove(dc);
+
+   return err;
 }
 
 static int tegra_dc_remove(struct platform_device *pdev)
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.4 051/108] drm/stm: ltdc: check crtc state before enabling LIE

2020-04-11 Thread Sasha Levin
From: Yannick Fertre 

[ Upstream commit a6bd58c51ac43083f3977057a7ad668def55812f ]

Following investigations of a hardware bug, the LIE interrupt
can occur while the display controller is not activated.
LIE interrupt (vblank) don't have to be set if the CRTC is not
enabled.

Signed-off-by: Yannick Fertre 
Acked-by: Philippe Cornu 
Signed-off-by: Benjamin Gaignard 
Link: 
https://patchwork.freedesktop.org/patch/msgid/1579601650-7055-1-git-send-email-yannick.fer...@st.com
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/stm/ltdc.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index 3ab4fbf8eb0d1..2526dfb77401c 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -653,9 +653,14 @@ static const struct drm_crtc_helper_funcs 
ltdc_crtc_helper_funcs = {
 static int ltdc_crtc_enable_vblank(struct drm_crtc *crtc)
 {
struct ltdc_device *ldev = crtc_to_ltdc(crtc);
+   struct drm_crtc_state *state = crtc->state;
 
DRM_DEBUG_DRIVER("\n");
-   reg_set(ldev->regs, LTDC_IER, IER_LIE);
+
+   if (state->enable)
+   reg_set(ldev->regs, LTDC_IER, IER_LIE);
+   else
+   return -EPERM;
 
return 0;
 }
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.4 074/108] drm/msm: devcoredump should dump MSM_SUBMIT_BO_DUMP buffers

2020-04-11 Thread Sasha Levin
From: Rob Clark 

[ Upstream commit e515af8d4a6f18f96c360724568a7497868101a8 ]

Also log buffers with the DUMP flag set, to ensure we capture all useful
cmdstream in crashdump state with modern mesa.

Otherwise we miss out on the contents of "state object" cmdstream
buffers.

v2: add missing 'inline'

Signed-off-by: Rob Clark 
Reviewed-by: Jordan Crouse 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/msm/msm_gem.h | 10 ++
 drivers/gpu/drm/msm/msm_gpu.c | 28 +++-
 drivers/gpu/drm/msm/msm_rd.c  |  8 +---
 3 files changed, 34 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_gem.h b/drivers/gpu/drm/msm/msm_gem.h
index 9e0953c2b7cea..dcee0e223ed86 100644
--- a/drivers/gpu/drm/msm/msm_gem.h
+++ b/drivers/gpu/drm/msm/msm_gem.h
@@ -160,4 +160,14 @@ struct msm_gem_submit {
} bos[0];
 };
 
+/* helper to determine of a buffer in submit should be dumped, used for both
+ * devcoredump and debugfs cmdstream dumping:
+ */
+static inline bool
+should_dump(struct msm_gem_submit *submit, int idx)
+{
+   extern bool rd_full;
+   return rd_full || (submit->bos[idx].flags & MSM_SUBMIT_BO_DUMP);
+}
+
 #endif /* __MSM_GEM_H__ */
diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c
index edd45f434ccd6..aea93e5035758 100644
--- a/drivers/gpu/drm/msm/msm_gpu.c
+++ b/drivers/gpu/drm/msm/msm_gpu.c
@@ -355,16 +355,34 @@ static void msm_gpu_crashstate_capture(struct msm_gpu 
*gpu,
state->cmd = kstrdup(cmd, GFP_KERNEL);
 
if (submit) {
-   int i;
-
-   state->bos = kcalloc(submit->nr_cmds,
+   int i, nr = 0;
+
+   /* count # of buffers to dump: */
+   for (i = 0; i < submit->nr_bos; i++)
+   if (should_dump(submit, i))
+   nr++;
+   /* always dump cmd bo's, but don't double count them: */
+   for (i = 0; i < submit->nr_cmds; i++)
+   if (!should_dump(submit, submit->cmd[i].idx))
+   nr++;
+
+   state->bos = kcalloc(nr,
sizeof(struct msm_gpu_state_bo), GFP_KERNEL);
 
+   for (i = 0; i < submit->nr_bos; i++) {
+   if (should_dump(submit, i)) {
+   msm_gpu_crashstate_get_bo(state, 
submit->bos[i].obj,
+   submit->bos[i].iova, 
submit->bos[i].flags);
+   }
+   }
+
for (i = 0; state->bos && i < submit->nr_cmds; i++) {
int idx = submit->cmd[i].idx;
 
-   msm_gpu_crashstate_get_bo(state, submit->bos[idx].obj,
-   submit->bos[idx].iova, submit->bos[idx].flags);
+   if (!should_dump(submit, submit->cmd[i].idx)) {
+   msm_gpu_crashstate_get_bo(state, 
submit->bos[idx].obj,
+   submit->bos[idx].iova, 
submit->bos[idx].flags);
+   }
}
}
 
diff --git a/drivers/gpu/drm/msm/msm_rd.c b/drivers/gpu/drm/msm/msm_rd.c
index c7832a951039f..4acebaefaed74 100644
--- a/drivers/gpu/drm/msm/msm_rd.c
+++ b/drivers/gpu/drm/msm/msm_rd.c
@@ -43,7 +43,7 @@
 #include "msm_gpu.h"
 #include "msm_gem.h"
 
-static bool rd_full = false;
+bool rd_full = false;
 MODULE_PARM_DESC(rd_full, "If true, $debugfs/.../rd will snapshot all buffer 
contents");
 module_param_named(rd_full, rd_full, bool, 0600);
 
@@ -333,12 +333,6 @@ static void snapshot_buf(struct msm_rd_state *rd,
msm_gem_put_vaddr(>base);
 }
 
-static bool
-should_dump(struct msm_gem_submit *submit, int idx)
-{
-   return rd_full || (submit->bos[idx].flags & MSM_SUBMIT_BO_DUMP);
-}
-
 /* called under struct_mutex */
 void msm_rd_dump_submit(struct msm_rd_state *rd, struct msm_gem_submit *submit,
const char *fmt, ...)
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.4 054/108] drm/amdgpu: fix parentheses in amdgpu_vm_update_ptes

2020-04-11 Thread Sasha Levin
From: Christian König 

[ Upstream commit bfcd6c69e4c3f73f2f92b997983537f9a3ac3b29 ]

For the root PD mask can be 0x as well which would
overrun to 0 if we don't cast it before we add one.

Signed-off-by: Christian König 
Tested-by: Tom St Denis 
Reviewed-by: Felix Kuehling 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index c7514f7434095..7455581a02b30 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -1443,7 +1443,7 @@ static int amdgpu_vm_update_ptes(struct 
amdgpu_vm_update_params *params,
incr = (uint64_t)AMDGPU_GPU_PAGE_SIZE << shift;
mask = amdgpu_vm_entries_mask(adev, cursor.level);
pe_start = ((cursor.pfn >> shift) & mask) * 8;
-   entry_end = (uint64_t)(mask + 1) << shift;
+   entry_end = ((uint64_t)mask + 1) << shift;
entry_end += cursor.pfn & ~(entry_end - 1);
entry_end = min(entry_end, end);
 
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.4 073/108] drm/msm/a5xx: Always set an OPP supported hardware value

2020-04-11 Thread Sasha Levin
From: Jordan Crouse 

[ Upstream commit 0478b4fc5f37f4d494245fe7bcce3f531cf380e9 ]

If the opp table specifies opp-supported-hw as a property but the driver
has not set a supported hardware value the OPP subsystem will reject
all the table entries.

Set a "default" value that will match the default table entries but not
conflict with any possible real bin values. Also fix a small memory leak
and free the buffer allocated by nvmem_cell_read().

Signed-off-by: Jordan Crouse 
Reviewed-by: Eric Anholt 
Signed-off-by: Rob Clark 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 27 ---
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
index 99cd6e62a9715..eb31fdc6428d9 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
@@ -1401,18 +1401,31 @@ static const struct adreno_gpu_funcs funcs = {
 static void check_speed_bin(struct device *dev)
 {
struct nvmem_cell *cell;
-   u32 bin, val;
+   u32 val;
+
+   /*
+* If the OPP table specifies a opp-supported-hw property then we have
+* to set something with dev_pm_opp_set_supported_hw() or the table
+* doesn't get populated so pick an arbitrary value that should
+* ensure the default frequencies are selected but not conflict with any
+* actual bins
+*/
+   val = 0x80;
 
cell = nvmem_cell_get(dev, "speed_bin");
 
-   /* If a nvmem cell isn't defined, nothing to do */
-   if (IS_ERR(cell))
-   return;
+   if (!IS_ERR(cell)) {
+   void *buf = nvmem_cell_read(cell, NULL);
+
+   if (!IS_ERR(buf)) {
+   u8 bin = *((u8 *) buf);
 
-   bin = *((u32 *) nvmem_cell_read(cell, NULL));
-   nvmem_cell_put(cell);
+   val = (1 << bin);
+   kfree(buf);
+   }
 
-   val = (1 << bin);
+   nvmem_cell_put(cell);
+   }
 
dev_pm_opp_set_supported_hw(dev, , 1);
 }
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.4 062/108] drm/amd/display: System crashes when add_ptb_to_table() gets called

2020-04-11 Thread Sasha Levin
From: Peikang Zhang 

[ Upstream commit 0062972b9d9f888d0273c6496769d02e8f509135 ]

[Why]
Unused VMIDs were not evicted correctly

[How]
1. evict_vmids() logic was fixed;
2. Added boundary check for add_ptb_to_table() and
   clear_entry_from_vmid_table() to avoid crash caused by array out of
   boundary;
3. For mod_vmid_get_for_ptb(), vimd is changed from unsigned to signed
   due to vimd is signed.

Signed-off-by: Peikang Zhang 
Reviewed-by: Aric Cyr 
Acked-by: Rodrigo Siqueira 
Acked-by: Harry Wentland 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/display/modules/vmid/vmid.c | 16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/modules/vmid/vmid.c 
b/drivers/gpu/drm/amd/display/modules/vmid/vmid.c
index f0a153704f6e0..00f132f8ad55d 100644
--- a/drivers/gpu/drm/amd/display/modules/vmid/vmid.c
+++ b/drivers/gpu/drm/amd/display/modules/vmid/vmid.c
@@ -40,14 +40,18 @@ struct core_vmid {
 
 static void add_ptb_to_table(struct core_vmid *core_vmid, unsigned int vmid, 
uint64_t ptb)
 {
-   core_vmid->ptb_assigned_to_vmid[vmid] = ptb;
-   core_vmid->num_vmids_available--;
+   if (vmid < MAX_VMID) {
+   core_vmid->ptb_assigned_to_vmid[vmid] = ptb;
+   core_vmid->num_vmids_available--;
+   }
 }
 
 static void clear_entry_from_vmid_table(struct core_vmid *core_vmid, unsigned 
int vmid)
 {
-   core_vmid->ptb_assigned_to_vmid[vmid] = 0;
-   core_vmid->num_vmids_available++;
+   if (vmid < MAX_VMID) {
+   core_vmid->ptb_assigned_to_vmid[vmid] = 0;
+   core_vmid->num_vmids_available++;
+   }
 }
 
 static void evict_vmids(struct core_vmid *core_vmid)
@@ -57,7 +61,7 @@ static void evict_vmids(struct core_vmid *core_vmid)
 
// At this point any positions with value 0 are unused vmids, evict them
for (i = 1; i < core_vmid->num_vmid; i++) {
-   if (ord & (1u << i))
+   if (!(ord & (1u << i)))
clear_entry_from_vmid_table(core_vmid, i);
}
 }
@@ -91,7 +95,7 @@ static int get_next_available_vmid(struct core_vmid 
*core_vmid)
 uint8_t mod_vmid_get_for_ptb(struct mod_vmid *mod_vmid, uint64_t ptb)
 {
struct core_vmid *core_vmid = MOD_VMID_TO_CORE(mod_vmid);
-   unsigned int vmid = 0;
+   int vmid = 0;
 
// Physical address gets vmid 0
if (ptb == 0)
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.4 055/108] drm/amd/display: dc_get_vmid_use_vector() crashes when get called

2020-04-11 Thread Sasha Levin
From: Peikang Zhang 

[ Upstream commit 68bbca15e7062f4ae16531e29893f78d0b4840b6 ]

[Why]
int i can go out of boundary which will cause crash

[How]
Fixed the maximum value of i to avoid i going out of boundary

Signed-off-by: Peikang Zhang 
Reviewed-by: Jun Lei 
Acked-by: Bhawanpreet Lakha 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/display/dc/core/dc_vm_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_vm_helper.c 
b/drivers/gpu/drm/amd/display/dc/core/dc_vm_helper.c
index a96d8de9380e6..f2b39ec35c898 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_vm_helper.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_vm_helper.c
@@ -62,7 +62,7 @@ int dc_get_vmid_use_vector(struct dc *dc)
int i;
int in_use = 0;
 
-   for (i = 0; i < dc->vm_helper->num_vmid; i++)
+   for (i = 0; i < MAX_HUBP; i++)
in_use |= dc->vm_helper->hubp_vmid_usage[i].vmid_usage[0]
| dc->vm_helper->hubp_vmid_usage[i].vmid_usage[1];
return in_use;
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.4 052/108] fbdev: potential information leak in do_fb_ioctl()

2020-04-11 Thread Sasha Levin
From: Dan Carpenter 

[ Upstream commit d3d19d6fc5736a798b118971935ce274f7deaa82 ]

The "fix" struct has a 2 byte hole after ->ywrapstep and the
"fix = info->fix;" assignment doesn't necessarily clear it.  It depends
on the compiler.  The solution is just to replace the assignment with an
memcpy().

Fixes: 1f5e31d7e55a ("fbmem: don't call copy_from/to_user() with mutex held")
Signed-off-by: Dan Carpenter 
Cc: Andrew Morton 
Cc: Arnd Bergmann 
Cc: "Eric W. Biederman" 
Cc: Andrea Righi 
Cc: Daniel Vetter 
Cc: Sam Ravnborg 
Cc: Maarten Lankhorst 
Cc: Daniel Thompson 
Cc: Peter Rosin 
Cc: Jani Nikula 
Cc: Gerd Hoffmann 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20200113100132.ixpaymordi24n3av@kili.mountain
Signed-off-by: Sasha Levin 
---
 drivers/video/fbdev/core/fbmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index e6a1c805064f0..36469943795a8 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -1110,7 +1110,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned 
int cmd,
break;
case FBIOGET_FSCREENINFO:
lock_fb_info(info);
-   fix = info->fix;
+   memcpy(, >fix, sizeof(fix));
if (info->flags & FBINFO_HIDE_SMEM_START)
fix.smem_start = 0;
unlock_fb_info(info);
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.4 053/108] drm/crc: Actually allow to change the crc source

2020-04-11 Thread Sasha Levin
From: Daniel Vetter 

[ Upstream commit 3cb6d8e5cf9811a62e27f366fd1c05f90310a8fd ]

Oops.

Fixes: 9edbf1fa600a ("drm: Add API for capturing frame CRCs")
Cc: Tomeu Vizoso 
Cc: Emil Velikov 
Cc: Benjamin Gaignard 
Signed-off-by: Daniel Vetter 
Reviewed-by: Ville Syrjälä 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20190821203835.18314-1-daniel.vet...@ffwll.ch
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/drm_debugfs_crc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_debugfs_crc.c 
b/drivers/gpu/drm/drm_debugfs_crc.c
index 6a626c82e264b..41755fb93788a 100644
--- a/drivers/gpu/drm/drm_debugfs_crc.c
+++ b/drivers/gpu/drm/drm_debugfs_crc.c
@@ -369,7 +369,7 @@ void drm_debugfs_crtc_crc_add(struct drm_crtc *crtc)
 
crc_ent = debugfs_create_dir("crc", crtc->debugfs_entry);
 
-   debugfs_create_file("control", S_IRUGO, crc_ent, crtc,
+   debugfs_create_file("control", S_IRUGO | S_IWUSR, crc_ent, crtc,
_crtc_crc_control_fops);
debugfs_create_file("data", S_IRUGO, crc_ent, crtc,
_crtc_crc_data_fops);
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.4 063/108] drm/omap: dss: Cleanup DSS ports on initialisation failure

2020-04-11 Thread Sasha Levin
From: Laurent Pinchart 

[ Upstream commit 2a0a3ae17d36fa86dcf7c8e8d7b7f056ebd6c064 ]

When the DSS initialises its output DPI and SDI ports, failures don't
clean up previous successfully initialised ports. This can lead to
resource leak or memory corruption. Fix it.

Reported-by: Hans Verkuil 
Signed-off-by: Laurent Pinchart 
Reviewed-by: Tomi Valkeinen 
Acked-by: Sam Ravnborg 
Tested-by: Sebastian Reichel 
Reviewed-by: Sebastian Reichel 
Signed-off-by: Tomi Valkeinen 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20200226112514.12455-22-laurent.pinch...@ideasonboard.com
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/omapdrm/dss/dss.c | 43 +++
 1 file changed, 26 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c 
b/drivers/gpu/drm/omapdrm/dss/dss.c
index 4bdd63b571002..ac93dae2a9c84 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss.c
+++ b/drivers/gpu/drm/omapdrm/dss/dss.c
@@ -1151,46 +1151,38 @@ static const struct dss_features dra7xx_dss_feats = {
.has_lcd_clk_src=   true,
 };
 
-static int dss_init_ports(struct dss_device *dss)
+static void __dss_uninit_ports(struct dss_device *dss, unsigned int num_ports)
 {
struct platform_device *pdev = dss->pdev;
struct device_node *parent = pdev->dev.of_node;
struct device_node *port;
unsigned int i;
-   int r;
 
-   for (i = 0; i < dss->feat->num_ports; i++) {
+   for (i = 0; i < num_ports; i++) {
port = of_graph_get_port_by_id(parent, i);
if (!port)
continue;
 
switch (dss->feat->ports[i]) {
case OMAP_DISPLAY_TYPE_DPI:
-   r = dpi_init_port(dss, pdev, port, dss->feat->model);
-   if (r)
-   return r;
+   dpi_uninit_port(port);
break;
-
case OMAP_DISPLAY_TYPE_SDI:
-   r = sdi_init_port(dss, pdev, port);
-   if (r)
-   return r;
+   sdi_uninit_port(port);
break;
-
default:
break;
}
}
-
-   return 0;
 }
 
-static void dss_uninit_ports(struct dss_device *dss)
+static int dss_init_ports(struct dss_device *dss)
 {
struct platform_device *pdev = dss->pdev;
struct device_node *parent = pdev->dev.of_node;
struct device_node *port;
-   int i;
+   unsigned int i;
+   int r;
 
for (i = 0; i < dss->feat->num_ports; i++) {
port = of_graph_get_port_by_id(parent, i);
@@ -1199,15 +1191,32 @@ static void dss_uninit_ports(struct dss_device *dss)
 
switch (dss->feat->ports[i]) {
case OMAP_DISPLAY_TYPE_DPI:
-   dpi_uninit_port(port);
+   r = dpi_init_port(dss, pdev, port, dss->feat->model);
+   if (r)
+   goto error;
break;
+
case OMAP_DISPLAY_TYPE_SDI:
-   sdi_uninit_port(port);
+   r = sdi_init_port(dss, pdev, port);
+   if (r)
+   goto error;
break;
+
default:
break;
}
}
+
+   return 0;
+
+error:
+   __dss_uninit_ports(dss, i);
+   return r;
+}
+
+static void dss_uninit_ports(struct dss_device *dss)
+{
+   __dss_uninit_ports(dss, dss->feat->num_ports);
 }
 
 static int dss_video_pll_probe(struct dss_device *dss)
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.4 061/108] drm/amd/display: dal_ddc_i2c_payloads_create can fail causing panic

2020-04-11 Thread Sasha Levin
From: Aric Cyr 

[ Upstream commit 6a6c4a4d459ecacc9013c45dcbf2bc9747fdbdbd ]

[Why]
Since the i2c payload allocation can fail need to check return codes

[How]
Clean up i2c payload allocations and check for errors

Signed-off-by: Aric Cyr 
Reviewed-by: Joshua Aberback 
Acked-by: Rodrigo Siqueira 
Acked-by: Harry Wentland 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 .../gpu/drm/amd/display/dc/core/dc_link_ddc.c | 52 +--
 1 file changed, 25 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c 
b/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
index 51991bf26a93c..4c90d68db2307 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
@@ -126,22 +126,16 @@ struct aux_payloads {
struct vector payloads;
 };
 
-static struct i2c_payloads *dal_ddc_i2c_payloads_create(struct dc_context 
*ctx, uint32_t count)
+static bool dal_ddc_i2c_payloads_create(
+   struct dc_context *ctx,
+   struct i2c_payloads *payloads,
+   uint32_t count)
 {
-   struct i2c_payloads *payloads;
-
-   payloads = kzalloc(sizeof(struct i2c_payloads), GFP_KERNEL);
-
-   if (!payloads)
-   return NULL;
-
if (dal_vector_construct(
>payloads, ctx, count, sizeof(struct i2c_payload)))
-   return payloads;
-
-   kfree(payloads);
-   return NULL;
+   return true;
 
+   return false;
 }
 
 static struct i2c_payload *dal_ddc_i2c_payloads_get(struct i2c_payloads *p)
@@ -154,14 +148,12 @@ static uint32_t dal_ddc_i2c_payloads_get_count(struct 
i2c_payloads *p)
return p->payloads.count;
 }
 
-static void dal_ddc_i2c_payloads_destroy(struct i2c_payloads **p)
+static void dal_ddc_i2c_payloads_destroy(struct i2c_payloads *p)
 {
-   if (!p || !*p)
+   if (!p)
return;
-   dal_vector_destruct(&(*p)->payloads);
-   kfree(*p);
-   *p = NULL;
 
+   dal_vector_destruct(>payloads);
 }
 
 #define DDC_MIN(a, b) (((a) < (b)) ? (a) : (b))
@@ -521,9 +513,13 @@ bool dal_ddc_service_query_ddc_data(
 
uint32_t payloads_num = write_payloads + read_payloads;
 
+
if (write_size > EDID_SEGMENT_SIZE || read_size > EDID_SEGMENT_SIZE)
return false;
 
+   if (!payloads_num)
+   return false;
+
/*TODO: len of payload data for i2c and aux is uint8,
 *  but we want to read 256 over i2c*/
if (dal_ddc_service_is_in_aux_transaction_mode(ddc)) {
@@ -556,23 +552,25 @@ bool dal_ddc_service_query_ddc_data(
 
ret = dc_link_aux_transfer_with_retries(ddc, _payload);
} else {
-   struct i2c_payloads *payloads =
-   dal_ddc_i2c_payloads_create(ddc->ctx, payloads_num);
+   struct i2c_command command = {0};
+   struct i2c_payloads payloads;
+
+   if (!dal_ddc_i2c_payloads_create(ddc->ctx, , 
payloads_num))
+   return false;
 
-   struct i2c_command command = {
-   .payloads = dal_ddc_i2c_payloads_get(payloads),
-   .number_of_payloads = 0,
-   .engine = DDC_I2C_COMMAND_ENGINE,
-   .speed = ddc->ctx->dc->caps.i2c_speed_in_khz };
+   command.payloads = dal_ddc_i2c_payloads_get();
+   command.number_of_payloads = 0;
+   command.engine = DDC_I2C_COMMAND_ENGINE;
+   command.speed = ddc->ctx->dc->caps.i2c_speed_in_khz;
 
dal_ddc_i2c_payloads_add(
-   payloads, address, write_size, write_buf, true);
+   , address, write_size, write_buf, true);
 
dal_ddc_i2c_payloads_add(
-   payloads, address, read_size, read_buf, false);
+   , address, read_size, read_buf, false);
 
command.number_of_payloads =
-   dal_ddc_i2c_payloads_get_count(payloads);
+   dal_ddc_i2c_payloads_get_count();
 
ret = dm_helpers_submit_i2c(
ddc->ctx,
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.4 072/108] drm/msm: fix leaks if initialization fails

2020-04-11 Thread Sasha Levin
From: Pavel Machek 

[ Upstream commit 66be340f827554cb1c8a1ed7dea97920b4085af2 ]

We should free resources in unlikely case of allocation failure.

Signed-off-by: Pavel Machek 
Signed-off-by: Rob Clark 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/msm/msm_drv.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index b73fbb65e14b2..68785ee02e97c 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -444,8 +444,10 @@ static int msm_drm_init(struct device *dev, struct 
drm_driver *drv)
if (!dev->dma_parms) {
dev->dma_parms = devm_kzalloc(dev, sizeof(*dev->dma_parms),
  GFP_KERNEL);
-   if (!dev->dma_parms)
-   return -ENOMEM;
+   if (!dev->dma_parms) {
+   ret = -ENOMEM;
+   goto err_msm_uninit;
+   }
}
dma_set_max_seg_size(dev, DMA_BIT_MASK(32));
 
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.4 048/108] drm/omap: fix possible object reference leak

2020-04-11 Thread Sasha Levin
From: Wen Yang 

[ Upstream commit 47340e46f34a3b1d80e40b43ae3d7a8da34a3541 ]

The call to of_find_matching_node returns a node pointer with refcount
incremented thus it must be explicitly decremented after the last
usage.

Detected by coccinelle with the following warnings:
drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c:212:2-8: ERROR: missing 
of_node_put; acquired a node pointer with refcount incremented on line 209, but 
without a corresponding object release within this function.
drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c:237:1-7: ERROR: missing 
of_node_put; acquired a node pointer with refcount incremented on line 209, but 
without a corresponding object release within this function.

Signed-off-by: Wen Yang 
Reviewed-by: Laurent Pinchart 
Reviewed-by: Mukesh Ojha 
Cc: Tomi Valkeinen 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Sebastian Reichel 
Cc: Laurent Pinchart 
Cc: dri-devel@lists.freedesktop.org
Cc: linux-ker...@vger.kernel.org
Cc: Markus Elfring 
Signed-off-by: Tomi Valkeinen 
Link: 
https://patchwork.freedesktop.org/patch/msgid/1554692313-28882-2-git-send-email-wen.yan...@zte.com.cn
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c 
b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
index 31502857f013d..ce67891eedd46 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
@@ -192,7 +192,7 @@ static int __init omapdss_boot_init(void)
dss = of_find_matching_node(NULL, omapdss_of_match);
 
if (dss == NULL || !of_device_is_available(dss))
-   return 0;
+   goto put_node;
 
omapdss_walk_device(dss, true);
 
@@ -217,6 +217,8 @@ static int __init omapdss_boot_init(void)
kfree(n);
}
 
+put_node:
+   of_node_put(dss);
return 0;
 }
 
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.4 042/108] drm/sun4i: dsi: Use NULL to signify "no panel"

2020-04-11 Thread Sasha Levin
From: Samuel Holland 

[ Upstream commit 0e4e3fb4901d19f49e5c0a582f383b10dda8d1c5 ]

The continued use of an ERR_PTR to signify "no panel" outside of
sun6i_dsi_attach is confusing because it is a double negative. Because
the connector always reports itself as connected, there is also the
possibility of sending an ERR_PTR to drm_panel_get_modes(), which would
crash.

Solve both of these by only storing the panel pointer if it is valid.

Fixes: 133add5b5ad4 ("drm/sun4i: Add Allwinner A31 MIPI-DSI controller support")
Signed-off-by: Samuel Holland 
Signed-off-by: Maxime Ripard 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20200211072858.30784-2-sam...@sholland.org
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c 
b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
index f83522717488a..d2ade0ad67708 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -748,7 +748,7 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder 
*encoder)
phy_configure(dsi->dphy, );
phy_power_on(dsi->dphy);
 
-   if (!IS_ERR(dsi->panel))
+   if (dsi->panel)
drm_panel_prepare(dsi->panel);
 
/*
@@ -763,7 +763,7 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder 
*encoder)
 * ordering on the panels I've tested it with, so I guess this
 * will do for now, until that IP is better understood.
 */
-   if (!IS_ERR(dsi->panel))
+   if (dsi->panel)
drm_panel_enable(dsi->panel);
 
sun6i_dsi_start(dsi, DSI_START_HSC);
@@ -779,7 +779,7 @@ static void sun6i_dsi_encoder_disable(struct drm_encoder 
*encoder)
 
DRM_DEBUG_DRIVER("Disabling DSI output\n");
 
-   if (!IS_ERR(dsi->panel)) {
+   if (dsi->panel) {
drm_panel_disable(dsi->panel);
drm_panel_unprepare(dsi->panel);
}
@@ -941,11 +941,13 @@ static int sun6i_dsi_attach(struct mipi_dsi_host *host,
struct mipi_dsi_device *device)
 {
struct sun6i_dsi *dsi = host_to_sun6i_dsi(host);
+   struct drm_panel *panel = of_drm_find_panel(device->dev.of_node);
 
+   if (IS_ERR(panel))
+   return PTR_ERR(panel);
+
+   dsi->panel = panel;
dsi->device = device;
-   dsi->panel = of_drm_find_panel(device->dev.of_node);
-   if (IS_ERR(dsi->panel))
-   return PTR_ERR(dsi->panel);
 
dev_info(host->dev, "Attached device %s\n", device->name);
 
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.4 029/108] drm/amd/display: Fix default logger mask definition

2020-04-11 Thread Sasha Levin
From: Eric Bernstein 

[ Upstream commit ccb6af1e25830e5601b6beacc698390f0245316f ]

[Why]
Logger mask was updated to uint64_t, however default mask definition was
not updated for unsigned long long

[How]
Update DC_DEFAULT_LOG_MASK to support uint64_t type

Signed-off-by: Eric Bernstein 
Reviewed-by: Dmytro Laktyushkin 
Acked-by: Rodrigo Siqueira 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 .../drm/amd/display/include/logger_types.h| 63 ++-
 1 file changed, 32 insertions(+), 31 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/include/logger_types.h 
b/drivers/gpu/drm/amd/display/include/logger_types.h
index 2b219cdb13ad4..e0fcc0ce677e7 100644
--- a/drivers/gpu/drm/amd/display/include/logger_types.h
+++ b/drivers/gpu/drm/amd/display/include/logger_types.h
@@ -130,36 +130,37 @@ enum dc_log_type {
 #define DC_MIN_LOG_MASK ((1 << LOG_ERROR) | \
(1 << LOG_DETECTION_EDID_PARSER))
 
-#define DC_DEFAULT_LOG_MASK ((1 << LOG_ERROR) | \
-   (1 << LOG_WARNING) | \
-   (1 << LOG_EVENT_MODE_SET) | \
-   (1 << LOG_EVENT_DETECTION) | \
-   (1 << LOG_EVENT_LINK_TRAINING) | \
-   (1 << LOG_EVENT_LINK_LOSS) | \
-   (1 << LOG_EVENT_UNDERFLOW) | \
-   (1 << LOG_RESOURCE) | \
-   (1 << LOG_FEATURE_OVERRIDE) | \
-   (1 << LOG_DETECTION_EDID_PARSER) | \
-   (1 << LOG_DC) | \
-   (1 << LOG_HW_HOTPLUG) | \
-   (1 << LOG_HW_SET_MODE) | \
-   (1 << LOG_HW_RESUME_S3) | \
-   (1 << LOG_HW_HPD_IRQ) | \
-   (1 << LOG_SYNC) | \
-   (1 << LOG_BANDWIDTH_VALIDATION) | \
-   (1 << LOG_MST) | \
-   (1 << LOG_DETECTION_DP_CAPS) | \
-   (1 << LOG_BACKLIGHT)) | \
-   (1 << LOG_I2C_AUX) | \
-   (1 << LOG_IF_TRACE) | \
-   (1 << LOG_DTN) /* | \
-   (1 << LOG_DEBUG) | \
-   (1 << LOG_BIOS) | \
-   (1 << LOG_SURFACE) | \
-   (1 << LOG_SCALER) | \
-   (1 << LOG_DML) | \
-   (1 << LOG_HW_LINK_TRAINING) | \
-   (1 << LOG_HW_AUDIO)| \
-   (1 << LOG_BANDWIDTH_CALCS)*/
+#define DC_DEFAULT_LOG_MASK ((1ULL << LOG_ERROR) | \
+   (1ULL << LOG_WARNING) | \
+   (1ULL << LOG_EVENT_MODE_SET) | \
+   (1ULL << LOG_EVENT_DETECTION) | \
+   (1ULL << LOG_EVENT_LINK_TRAINING) | \
+   (1ULL << LOG_EVENT_LINK_LOSS) | \
+   (1ULL << LOG_EVENT_UNDERFLOW) | \
+   (1ULL << LOG_RESOURCE) | \
+   (1ULL << LOG_FEATURE_OVERRIDE) | \
+   (1ULL << LOG_DETECTION_EDID_PARSER) | \
+   (1ULL << LOG_DC) | \
+   (1ULL << LOG_HW_HOTPLUG) | \
+   (1ULL << LOG_HW_SET_MODE) | \
+   (1ULL << LOG_HW_RESUME_S3) | \
+   (1ULL << LOG_HW_HPD_IRQ) | \
+   (1ULL << LOG_SYNC) | \
+   (1ULL << LOG_BANDWIDTH_VALIDATION) | \
+   (1ULL << LOG_MST) | \
+   (1ULL << LOG_DETECTION_DP_CAPS) | \
+   (1ULL << LOG_BACKLIGHT)) | \
+   (1ULL << LOG_I2C_AUX) | \
+   (1ULL << LOG_IF_TRACE) | \
+   (1ULL << LOG_HDMI_FRL) | \
+   (1ULL << LOG_DTN) /* | \
+   (1ULL << LOG_DEBUG) | \
+   (1ULL << LOG_BIOS) | \
+   (1ULL << LOG_SURFACE) | \
+   (1ULL << LOG_SCALER) | \
+   (1ULL << LOG_DML) | \
+   (1ULL << LOG_HW_LINK_TRAINING) | \
+   (1ULL << LOG_HW_AUDIO)| \
+   (1ULL << LOG_BANDWIDTH_CALCS)*/
 
 #endif /* __DAL_LOGGER_TYPES_H__ */
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.4 032/108] drm/amd/display: Only round InfoFrame refresh rates

2020-04-11 Thread Sasha Levin
From: Aric Cyr 

[ Upstream commit 3fc6376ed6f2f67bc9fb0c7a3cf07967d6aa6216 ]

[Why]
When calculating nominal refresh rates, don't round.
Only the VSIF needs to be rounded.

[How]
Revert rounding change for nominal and just round when forming the
FreeSync VSIF.

Signed-off-by: Aric Cyr 
Reviewed-by: Anthony Koo 
Acked-by: Rodrigo Siqueira 
Acked-by: Harry Wentland 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/display/modules/freesync/freesync.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c 
b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
index 7d67cb2c61f04..37090384c2302 100644
--- a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
+++ b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
@@ -520,12 +520,12 @@ static void build_vrr_infopacket_data(const struct 
mod_vrr_params *vrr,
infopacket->sb[6] |= 0x04;
 
/* PB7 = FreeSync Minimum refresh rate (Hz) */
-   infopacket->sb[7] = (unsigned char)(vrr->min_refresh_in_uhz / 100);
+   infopacket->sb[7] = (unsigned char)((vrr->min_refresh_in_uhz + 50) 
/ 100);
 
/* PB8 = FreeSync Maximum refresh rate (Hz)
 * Note: We should never go above the field rate of the mode timing set.
 */
-   infopacket->sb[8] = (unsigned char)(vrr->max_refresh_in_uhz / 100);
+   infopacket->sb[8] = (unsigned char)((vrr->max_refresh_in_uhz + 50) 
/ 100);
 
 
//FreeSync HDR
@@ -743,10 +743,6 @@ void mod_freesync_build_vrr_params(struct mod_freesync 
*mod_freesync,
nominal_field_rate_in_uhz =
mod_freesync_calc_nominal_field_rate(stream);
 
-   /* Rounded to the nearest Hz */
-   nominal_field_rate_in_uhz = 100ULL *
-   div_u64(nominal_field_rate_in_uhz + 50, 100);
-
min_refresh_in_uhz = in_config->min_refresh_in_uhz;
max_refresh_in_uhz = in_config->max_refresh_in_uhz;
 
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.4 026/108] drm/amd/display: writing stereo polarity register if swapped

2020-04-11 Thread Sasha Levin
From: Martin Leung 

[ Upstream commit e592e85f3378246dd66b861fa60ef803d8cece6b ]

[why]
on some displays that prefer swapped polarity we were seeing L/R images
swapped because OTG_STEREO_SYNC_OUTPUT_POLARITY would always be mapped
to 0

[how]
fix initial dal3 implementation to properly update the polarity field
according to the crtc_stereo_flags (same as
OTG_STEREO_EYE_FLAG_POLARITY)

Signed-off-by: Martin Leung 
Reviewed-by: Aric Cyr 
Acked-by: Rodrigo Siqueira 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c 
b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c
index e74a07d03fde9..5fda5824f2669 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c
@@ -1185,7 +1185,7 @@ static void optc1_enable_stereo(struct timing_generator 
*optc,
REG_UPDATE_3(OTG_STEREO_CONTROL,
OTG_STEREO_EN, stereo_en,
OTG_STEREO_SYNC_OUTPUT_LINE_NUM, 0,
-   OTG_STEREO_SYNC_OUTPUT_POLARITY, 0);
+   OTG_STEREO_SYNC_OUTPUT_POLARITY, 
flags->RIGHT_EYE_POLARITY == 0 ? 0 : 1);
 
if (flags->PROGRAM_POLARITY)
REG_UPDATE(OTG_STEREO_CONTROL,
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.5 121/121] PCI: Use ioremap(), not phys_to_virt() for platform ROM

2020-04-11 Thread Sasha Levin
From: Mikel Rychliski 

[ Upstream commit 72e0ef0e5f067fd991f702f0b2635d911d0cf208 ]

On some EFI systems, the video BIOS is provided by the EFI firmware.  The
boot stub code stores the physical address of the ROM image in pdev->rom.
Currently we attempt to access this pointer using phys_to_virt(), which
doesn't work with CONFIG_HIGHMEM.

On these systems, attempting to load the radeon module on a x86_32 kernel
can result in the following:

  BUG: unable to handle page fault for address: 3e8ed03c
  #PF: supervisor read access in kernel mode
  #PF: error_code(0x) - not-present page
  *pde = 
  Oops:  [#1] PREEMPT SMP
  CPU: 0 PID: 317 Comm: systemd-udevd Not tainted 5.6.0-rc3-next-20200228 #2
  Hardware name: Apple Computer, Inc. MacPro1,1/Mac-F4208DC8, BIOS 
MP11.88Z.005C.B08.0707021221 07/02/07
  EIP: radeon_get_bios+0x5ed/0xe50 [radeon]
  Code: 00 00 84 c0 0f 85 12 fd ff ff c7 87 64 01 00 00 00 00 00 00 8b 47 08 8b 
55 b0 e8 1e 83 e1 d6 85 c0 74 1a 8b 55 c0 85 d2 74 13 <80> 38 55 75 0e 80 78 01 
aa 0f 84 a4 03 00 00 8d 74 26 00 68 dc 06
  EAX: 3e8ed03c EBX:  ECX: 3e8ed03c EDX: 0001
  ESI: 0004 EDI: eec04000 EBP: eef3fc60 ESP: eef3fbe0
  DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 EFLAGS: 00010206
  CR0: 80050033 CR2: 3e8ed03c CR3: 2ec77000 CR4: 06d0
  Call Trace:
   r520_init+0x26/0x240 [radeon]
   radeon_device_init+0x533/0xa50 [radeon]
   radeon_driver_load_kms+0x80/0x220 [radeon]
   drm_dev_register+0xa7/0x180 [drm]
   radeon_pci_probe+0x10f/0x1a0 [radeon]
   pci_device_probe+0xd4/0x140

Fix the issue by updating all drivers which can access a platform provided
ROM. Instead of calling the helper function pci_platform_rom() which uses
phys_to_virt(), call ioremap() directly on the pdev->rom.

radeon_read_platform_bios() previously directly accessed an __iomem
pointer. Avoid this by calling memcpy_fromio() instead of kmemdup().

pci_platform_rom() now has no remaining callers, so remove it.

Link: https://lore.kernel.org/r/20200319021623.5426-1-mi...@mikelr.com
Signed-off-by: Mikel Rychliski 
Signed-off-by: Bjorn Helgaas 
Acked-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c  | 31 +++
 .../drm/nouveau/nvkm/subdev/bios/shadowpci.c  | 17 --
 drivers/gpu/drm/radeon/radeon_bios.c  | 30 +++---
 drivers/pci/rom.c | 17 --
 include/linux/pci.h   |  1 -
 5 files changed, 52 insertions(+), 44 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
index 50dff69a0f6e3..b1172d93c99c3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
@@ -192,30 +192,35 @@ static bool amdgpu_read_bios_from_rom(struct 
amdgpu_device *adev)
 
 static bool amdgpu_read_platform_bios(struct amdgpu_device *adev)
 {
-   uint8_t __iomem *bios;
-   size_t size;
+   phys_addr_t rom = adev->pdev->rom;
+   size_t romlen = adev->pdev->romlen;
+   void __iomem *bios;
 
adev->bios = NULL;
 
-   bios = pci_platform_rom(adev->pdev, );
-   if (!bios) {
+   if (!rom || romlen == 0)
return false;
-   }
 
-   adev->bios = kzalloc(size, GFP_KERNEL);
-   if (adev->bios == NULL)
+   adev->bios = kzalloc(romlen, GFP_KERNEL);
+   if (!adev->bios)
return false;
 
-   memcpy_fromio(adev->bios, bios, size);
+   bios = ioremap(rom, romlen);
+   if (!bios)
+   goto free_bios;
 
-   if (!check_atom_bios(adev->bios, size)) {
-   kfree(adev->bios);
-   return false;
-   }
+   memcpy_fromio(adev->bios, bios, romlen);
+   iounmap(bios);
 
-   adev->bios_size = size;
+   if (!check_atom_bios(adev->bios, romlen))
+   goto free_bios;
+
+   adev->bios_size = romlen;
 
return true;
+free_bios:
+   kfree(adev->bios);
+   return false;
 }
 
 #ifdef CONFIG_ACPI
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c 
b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
index 9b91da09dc5f8..8d9812a51ef63 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
@@ -101,9 +101,13 @@ platform_init(struct nvkm_bios *bios, const char *name)
else
return ERR_PTR(-ENODEV);
 
+   if (!pdev->rom || pdev->romlen == 0)
+   return ERR_PTR(-ENODEV);
+
if ((priv = kmalloc(sizeof(*priv), GFP_KERNEL))) {
+   priv->size = pdev->romlen;
if (ret = -ENODEV,
-   (priv->rom = pci_platform_rom(pdev, >size)))
+   (priv->rom = ioremap(pdev->rom, pdev->romlen)))
return priv;
kfree(priv);
}
@@ -111,11 +115,20 @@ platform_init(struct nvkm_bios *bios, const char *name)
return 

[PATCH AUTOSEL 5.4 012/108] drm/amd/display: Explicitly disable triplebuffer flips

2020-04-11 Thread Sasha Levin
From: Nicholas Kazlauskas 

[ Upstream commit 2d673560b7b83f8fe4163610f35c51b4d095525c ]

[Why]
This is enabled by default on Renoir but there's userspace/API support
to actually make use of this.

Since we're not passing this down through surface updates, let's
explicitly disable this for now.

This fixes "dcn20_program_front_end_for_ctx" warnings associated with
incorrect/unexpected programming sequences performed while this is
enabled.

[How]
Disable it at the topmost level in DM in case anyone tries to flip this
to enabled for any of the other ASICs like Navi10/14.

Signed-off-by: Nicholas Kazlauskas 
Reviewed-by: Hersen Wu 
Acked-by: Rodrigo Siqueira 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 360c87ba45956..1b54744b1ba07 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -2391,6 +2391,9 @@ static int amdgpu_dm_initialize_drm_device(struct 
amdgpu_device *adev)
if (adev->asic_type != CHIP_CARRIZO && adev->asic_type != CHIP_STONEY)
dm->dc->debug.disable_stutter = amdgpu_pp_feature_mask & 
PP_STUTTER_MODE ? false : true;
 
+   /* No userspace support. */
+   dm->dc->debug.disable_tri_buf = true;
+
return 0;
 fail:
kfree(aencoder);
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.4 024/108] drm/amd/display: Stop if retimer is not available

2020-04-11 Thread Sasha Levin
From: Rodrigo Siqueira 

[ Upstream commit a0e40018dcc3f59a10ca21d58f8ea8ceb1b035ac ]

Raven provides retimer feature support that requires i2c interaction in
order to make it work well, all settings required for this configuration
are loaded from the Atom bios which include the i2c address. If the
retimer feature is not available, we should abort the attempt to set
this feature, otherwise, it makes the following line return
I2C_CHANNEL_OPERATION_NO_RESPONSE:

 i2c_success = i2c_write(pipe_ctx, slave_address, buffer, sizeof(buffer));
 ...
 if (!i2c_success)
   ASSERT(i2c_success);

This ends up causing problems with hotplugging HDMI displays on Raven,
and causes retimer settings to warn like so:

WARNING: CPU: 1 PID: 429 at
drivers/gpu/drm/amd/amdgpu/../dal/dc/core/dc_link.c:1998
write_i2c_retimer_setting+0xc2/0x3c0 [amdgpu] Modules linked in:
edac_mce_amd ccp kvm irqbypass binfmt_misc crct10dif_pclmul crc32_pclmul
ghash_clmulni_intel snd_hda_codec_realtek snd_hda_codec_generic
ledtrig_audio snd_hda_codec_hdmi snd_hda_intel amdgpu(+) snd_hda_codec
snd_hda_core snd_hwdep snd_pcm snd_seq_midi snd_seq_midi_event
snd_rawmidi aesni_intel snd_seq amd_iommu_v2 gpu_sched aes_x86_64
crypto_simd cryptd glue_helper snd_seq_device ttm drm_kms_helper
snd_timer eeepc_wmi wmi_bmof asus_wmi sparse_keymap drm mxm_wmi snd
k10temp fb_sys_fops syscopyarea sysfillrect sysimgblt soundcore joydev
input_leds mac_hid sch_fq_codel parport_pc ppdev lp parport ip_tables
x_tables autofs4 igb i2c_algo_bit hid_generic usbhid i2c_piix4 dca ahci
hid libahci video wmi gpio_amdpt gpio_generic CPU: 1 PID: 429 Comm:
systemd-udevd Tainted: GW 5.2.0-rc1sept162019+ #1
Hardware name: System manufacturer System Product Name/ROG STRIX B450-F
GAMING, BIOS 2605 08/06/2019
RIP: 0010:write_i2c_retimer_setting+0xc2/0x3c0 [amdgpu]
Code: ff 0f b6 4d ce 44 0f b6 45 cf 44 0f b6 c8 45 89 cf 44 89 e2 48 c7
c6 f0 34 bc c0 bf 04 00 00 00 e8 63 b0 90 ff 45 84 ff 75 02 <0f> 0b 42
0f b6 04 73 8d 50 f6 80 fa 02 77 8c 3c 0a 0f 85 c8 00 00 RSP:
0018:a99d02726fd0 EFLAGS: 00010246
RAX:  RBX: a99d02727035 RCX: 0006
RDX:  RSI: 0002 RDI: 976acc857440
RBP: a99d02727018 R08: 0002 R09: 0002a600
R10: e90610193680 R11: 05e3 R12: 005d
R13: 976ac4b201b8 R14: 0001 R15: 
FS:  7f14f99e1680() GS:976acc84() knlGS:
CS:  0010 DS:  ES:  CR0: 80050033
CR2: 7fdf212843b8 CR3: 000408906000 CR4: 003406e0
Call Trace:
 core_link_enable_stream+0x626/0x680 [amdgpu]
 dce110_apply_ctx_to_hw+0x414/0x4e0 [amdgpu]
 dc_commit_state+0x331/0x5e0 [amdgpu]
 ? drm_calc_timestamping_constants+0xf9/0x150 [drm]
 amdgpu_dm_atomic_commit_tail+0x395/0x1e00 [amdgpu]
 ? dm_plane_helper_prepare_fb+0x20c/0x280 [amdgpu]
 commit_tail+0x42/0x70 [drm_kms_helper]
 drm_atomic_helper_commit+0x10c/0x120 [drm_kms_helper]
 amdgpu_dm_atomic_commit+0x95/0xa0 [amdgpu]
 drm_atomic_commit+0x4a/0x50 [drm]
 restore_fbdev_mode_atomic+0x1c0/0x1e0 [drm_kms_helper]
 restore_fbdev_mode+0x4c/0x160 [drm_kms_helper]
 ? _cond_resched+0x19/0x40
 drm_fb_helper_restore_fbdev_mode_unlocked+0x4e/0xa0 [drm_kms_helper]
 drm_fb_helper_set_par+0x2d/0x50 [drm_kms_helper]
 fbcon_init+0x471/0x630
 visual_init+0xd5/0x130
 do_bind_con_driver+0x20a/0x430
 do_take_over_console+0x7d/0x1b0
 do_fbcon_takeover+0x5c/0xb0
 fbcon_event_notify+0x6cd/0x8a0
 notifier_call_chain+0x4c/0x70
 blocking_notifier_call_chain+0x43/0x60
 fb_notifier_call_chain+0x1b/0x20
 register_framebuffer+0x254/0x360
 __drm_fb_helper_initial_config_and_unlock+0x2c5/0x510 [drm_kms_helper]
 drm_fb_helper_initial_config+0x35/0x40 [drm_kms_helper]
 amdgpu_fbdev_init+0xcd/0x100 [amdgpu]
 amdgpu_device_init+0x1156/0x1930 [amdgpu]
 amdgpu_driver_load_kms+0x8d/0x2e0 [amdgpu]
 drm_dev_register+0x12b/0x1c0 [drm]
 amdgpu_pci_probe+0xd3/0x160 [amdgpu]
 local_pci_probe+0x47/0xa0
 pci_device_probe+0x142/0x1b0
 really_probe+0xf5/0x3d0
 driver_probe_device+0x11b/0x130
 device_driver_attach+0x58/0x60
 __driver_attach+0xa3/0x140
 ? device_driver_attach+0x60/0x60
 ? device_driver_attach+0x60/0x60
 bus_for_each_dev+0x74/0xb0
 ? kmem_cache_alloc_trace+0x1a3/0x1c0
 driver_attach+0x1e/0x20
 bus_add_driver+0x147/0x220
 ? 0xc0cb9000
 driver_register+0x60/0x100
 ? 0xc0cb9000
 __pci_register_driver+0x5a/0x60
 amdgpu_init+0x74/0x83 [amdgpu]
 do_one_initcall+0x4a/0x1fa
 ? _cond_resched+0x19/0x40
 ? kmem_cache_alloc_trace+0x3f/0x1c0
 ? __vunmap+0x1cc/0x200
 do_init_module+0x5f/0x227
 load_module+0x2330/0x2b40
 __do_sys_finit_module+0xfc/0x120
 ? __do_sys_finit_module+0xfc/0x120
 __x64_sys_finit_module+0x1a/0x20
 do_syscall_64+0x5a/0x130
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x7f14f9500839
Code: 00 f3 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89
f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01
f0 ff ff 73 01 c3 48 8b 0d 1f 

[PATCH AUTOSEL 5.4 022/108] drm/tegra: dc: Release PM and RGB output when client's registration fails

2020-04-11 Thread Sasha Levin
From: Dmitry Osipenko 

[ Upstream commit 0411ea89a689531e1829fdf8af3747646c02c721 ]

Runtime PM and RGB output need to be released when host1x client
registration fails. The releasing is missed in the code, let's correct it.

Signed-off-by: Dmitry Osipenko 
Signed-off-by: Thierry Reding 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/tegra/dc.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
index fbf57bc3cdaba..6dbbd238f60be 100644
--- a/drivers/gpu/drm/tegra/dc.c
+++ b/drivers/gpu/drm/tegra/dc.c
@@ -2496,10 +2496,16 @@ static int tegra_dc_probe(struct platform_device *pdev)
if (err < 0) {
dev_err(>dev, "failed to register host1x client: %d\n",
err);
-   return err;
+   goto disable_pm;
}
 
return 0;
+
+disable_pm:
+   pm_runtime_disable(>dev);
+   tegra_dc_rgb_remove(dc);
+
+   return err;
 }
 
 static int tegra_dc_remove(struct platform_device *pdev)
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.5 085/121] drm/msm/a5xx: Always set an OPP supported hardware value

2020-04-11 Thread Sasha Levin
From: Jordan Crouse 

[ Upstream commit 0478b4fc5f37f4d494245fe7bcce3f531cf380e9 ]

If the opp table specifies opp-supported-hw as a property but the driver
has not set a supported hardware value the OPP subsystem will reject
all the table entries.

Set a "default" value that will match the default table entries but not
conflict with any possible real bin values. Also fix a small memory leak
and free the buffer allocated by nvmem_cell_read().

Signed-off-by: Jordan Crouse 
Reviewed-by: Eric Anholt 
Signed-off-by: Rob Clark 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 27 ---
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
index 7d9e63e20dedd..724024a2243a4 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
@@ -1446,18 +1446,31 @@ static const struct adreno_gpu_funcs funcs = {
 static void check_speed_bin(struct device *dev)
 {
struct nvmem_cell *cell;
-   u32 bin, val;
+   u32 val;
+
+   /*
+* If the OPP table specifies a opp-supported-hw property then we have
+* to set something with dev_pm_opp_set_supported_hw() or the table
+* doesn't get populated so pick an arbitrary value that should
+* ensure the default frequencies are selected but not conflict with any
+* actual bins
+*/
+   val = 0x80;
 
cell = nvmem_cell_get(dev, "speed_bin");
 
-   /* If a nvmem cell isn't defined, nothing to do */
-   if (IS_ERR(cell))
-   return;
+   if (!IS_ERR(cell)) {
+   void *buf = nvmem_cell_read(cell, NULL);
+
+   if (!IS_ERR(buf)) {
+   u8 bin = *((u8 *) buf);
 
-   bin = *((u32 *) nvmem_cell_read(cell, NULL));
-   nvmem_cell_put(cell);
+   val = (1 << bin);
+   kfree(buf);
+   }
 
-   val = (1 << bin);
+   nvmem_cell_put(cell);
+   }
 
dev_pm_opp_set_supported_hw(dev, , 1);
 }
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.5 084/121] drm/msm: fix leaks if initialization fails

2020-04-11 Thread Sasha Levin
From: Pavel Machek 

[ Upstream commit 66be340f827554cb1c8a1ed7dea97920b4085af2 ]

We should free resources in unlikely case of allocation failure.

Signed-off-by: Pavel Machek 
Signed-off-by: Rob Clark 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/msm/msm_drv.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index b73fbb65e14b2..68785ee02e97c 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -444,8 +444,10 @@ static int msm_drm_init(struct device *dev, struct 
drm_driver *drv)
if (!dev->dma_parms) {
dev->dma_parms = devm_kzalloc(dev, sizeof(*dev->dma_parms),
  GFP_KERNEL);
-   if (!dev->dma_parms)
-   return -ENOMEM;
+   if (!dev->dma_parms) {
+   ret = -ENOMEM;
+   goto err_msm_uninit;
+   }
}
dma_set_max_seg_size(dev, DMA_BIT_MASK(32));
 
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.5 069/121] drm/amd/display: dal_ddc_i2c_payloads_create can fail causing panic

2020-04-11 Thread Sasha Levin
From: Aric Cyr 

[ Upstream commit 6a6c4a4d459ecacc9013c45dcbf2bc9747fdbdbd ]

[Why]
Since the i2c payload allocation can fail need to check return codes

[How]
Clean up i2c payload allocations and check for errors

Signed-off-by: Aric Cyr 
Reviewed-by: Joshua Aberback 
Acked-by: Rodrigo Siqueira 
Acked-by: Harry Wentland 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 .../gpu/drm/amd/display/dc/core/dc_link_ddc.c | 52 +--
 1 file changed, 25 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c 
b/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
index 81789191d4ec0..7fb3c2fda9dae 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
@@ -126,22 +126,16 @@ struct aux_payloads {
struct vector payloads;
 };
 
-static struct i2c_payloads *dal_ddc_i2c_payloads_create(struct dc_context 
*ctx, uint32_t count)
+static bool dal_ddc_i2c_payloads_create(
+   struct dc_context *ctx,
+   struct i2c_payloads *payloads,
+   uint32_t count)
 {
-   struct i2c_payloads *payloads;
-
-   payloads = kzalloc(sizeof(struct i2c_payloads), GFP_KERNEL);
-
-   if (!payloads)
-   return NULL;
-
if (dal_vector_construct(
>payloads, ctx, count, sizeof(struct i2c_payload)))
-   return payloads;
-
-   kfree(payloads);
-   return NULL;
+   return true;
 
+   return false;
 }
 
 static struct i2c_payload *dal_ddc_i2c_payloads_get(struct i2c_payloads *p)
@@ -154,14 +148,12 @@ static uint32_t dal_ddc_i2c_payloads_get_count(struct 
i2c_payloads *p)
return p->payloads.count;
 }
 
-static void dal_ddc_i2c_payloads_destroy(struct i2c_payloads **p)
+static void dal_ddc_i2c_payloads_destroy(struct i2c_payloads *p)
 {
-   if (!p || !*p)
+   if (!p)
return;
-   dal_vector_destruct(&(*p)->payloads);
-   kfree(*p);
-   *p = NULL;
 
+   dal_vector_destruct(>payloads);
 }
 
 #define DDC_MIN(a, b) (((a) < (b)) ? (a) : (b))
@@ -521,9 +513,13 @@ bool dal_ddc_service_query_ddc_data(
 
uint32_t payloads_num = write_payloads + read_payloads;
 
+
if (write_size > EDID_SEGMENT_SIZE || read_size > EDID_SEGMENT_SIZE)
return false;
 
+   if (!payloads_num)
+   return false;
+
/*TODO: len of payload data for i2c and aux is uint8,
 *  but we want to read 256 over i2c*/
if (dal_ddc_service_is_in_aux_transaction_mode(ddc)) {
@@ -554,23 +550,25 @@ bool dal_ddc_service_query_ddc_data(
ret = dal_ddc_submit_aux_command(ddc, );
}
} else {
-   struct i2c_payloads *payloads =
-   dal_ddc_i2c_payloads_create(ddc->ctx, payloads_num);
+   struct i2c_command command = {0};
+   struct i2c_payloads payloads;
+
+   if (!dal_ddc_i2c_payloads_create(ddc->ctx, , 
payloads_num))
+   return false;
 
-   struct i2c_command command = {
-   .payloads = dal_ddc_i2c_payloads_get(payloads),
-   .number_of_payloads = 0,
-   .engine = DDC_I2C_COMMAND_ENGINE,
-   .speed = ddc->ctx->dc->caps.i2c_speed_in_khz };
+   command.payloads = dal_ddc_i2c_payloads_get();
+   command.number_of_payloads = 0;
+   command.engine = DDC_I2C_COMMAND_ENGINE;
+   command.speed = ddc->ctx->dc->caps.i2c_speed_in_khz;
 
dal_ddc_i2c_payloads_add(
-   payloads, address, write_size, write_buf, true);
+   , address, write_size, write_buf, true);
 
dal_ddc_i2c_payloads_add(
-   payloads, address, read_size, read_buf, false);
+   , address, read_size, read_buf, false);
 
command.number_of_payloads =
-   dal_ddc_i2c_payloads_get_count(payloads);
+   dal_ddc_i2c_payloads_get_count();
 
ret = dm_helpers_submit_i2c(
ddc->ctx,
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.5 062/121] drm/amdgpu: fix parentheses in amdgpu_vm_update_ptes

2020-04-11 Thread Sasha Levin
From: Christian König 

[ Upstream commit bfcd6c69e4c3f73f2f92b997983537f9a3ac3b29 ]

For the root PD mask can be 0x as well which would
overrun to 0 if we don't cast it before we add one.

Signed-off-by: Christian König 
Tested-by: Tom St Denis 
Reviewed-by: Felix Kuehling 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 598c24505c73b..d37d9c372e7d8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -1468,7 +1468,7 @@ static int amdgpu_vm_update_ptes(struct 
amdgpu_vm_update_params *params,
incr = (uint64_t)AMDGPU_GPU_PAGE_SIZE << shift;
mask = amdgpu_vm_entries_mask(adev, cursor.level);
pe_start = ((cursor.pfn >> shift) & mask) * 8;
-   entry_end = (uint64_t)(mask + 1) << shift;
+   entry_end = ((uint64_t)mask + 1) << shift;
entry_end += cursor.pfn & ~(entry_end - 1);
entry_end = min(entry_end, end);
 
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.5 070/121] drm/amd/display: System crashes when add_ptb_to_table() gets called

2020-04-11 Thread Sasha Levin
From: Peikang Zhang 

[ Upstream commit 0062972b9d9f888d0273c6496769d02e8f509135 ]

[Why]
Unused VMIDs were not evicted correctly

[How]
1. evict_vmids() logic was fixed;
2. Added boundary check for add_ptb_to_table() and
   clear_entry_from_vmid_table() to avoid crash caused by array out of
   boundary;
3. For mod_vmid_get_for_ptb(), vimd is changed from unsigned to signed
   due to vimd is signed.

Signed-off-by: Peikang Zhang 
Reviewed-by: Aric Cyr 
Acked-by: Rodrigo Siqueira 
Acked-by: Harry Wentland 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/display/modules/vmid/vmid.c | 16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/modules/vmid/vmid.c 
b/drivers/gpu/drm/amd/display/modules/vmid/vmid.c
index f0a153704f6e0..00f132f8ad55d 100644
--- a/drivers/gpu/drm/amd/display/modules/vmid/vmid.c
+++ b/drivers/gpu/drm/amd/display/modules/vmid/vmid.c
@@ -40,14 +40,18 @@ struct core_vmid {
 
 static void add_ptb_to_table(struct core_vmid *core_vmid, unsigned int vmid, 
uint64_t ptb)
 {
-   core_vmid->ptb_assigned_to_vmid[vmid] = ptb;
-   core_vmid->num_vmids_available--;
+   if (vmid < MAX_VMID) {
+   core_vmid->ptb_assigned_to_vmid[vmid] = ptb;
+   core_vmid->num_vmids_available--;
+   }
 }
 
 static void clear_entry_from_vmid_table(struct core_vmid *core_vmid, unsigned 
int vmid)
 {
-   core_vmid->ptb_assigned_to_vmid[vmid] = 0;
-   core_vmid->num_vmids_available++;
+   if (vmid < MAX_VMID) {
+   core_vmid->ptb_assigned_to_vmid[vmid] = 0;
+   core_vmid->num_vmids_available++;
+   }
 }
 
 static void evict_vmids(struct core_vmid *core_vmid)
@@ -57,7 +61,7 @@ static void evict_vmids(struct core_vmid *core_vmid)
 
// At this point any positions with value 0 are unused vmids, evict them
for (i = 1; i < core_vmid->num_vmid; i++) {
-   if (ord & (1u << i))
+   if (!(ord & (1u << i)))
clear_entry_from_vmid_table(core_vmid, i);
}
 }
@@ -91,7 +95,7 @@ static int get_next_available_vmid(struct core_vmid 
*core_vmid)
 uint8_t mod_vmid_get_for_ptb(struct mod_vmid *mod_vmid, uint64_t ptb)
 {
struct core_vmid *core_vmid = MOD_VMID_TO_CORE(mod_vmid);
-   unsigned int vmid = 0;
+   int vmid = 0;
 
// Physical address gets vmid 0
if (ptb == 0)
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.5 059/121] drm/stm: ltdc: check crtc state before enabling LIE

2020-04-11 Thread Sasha Levin
From: Yannick Fertre 

[ Upstream commit a6bd58c51ac43083f3977057a7ad668def55812f ]

Following investigations of a hardware bug, the LIE interrupt
can occur while the display controller is not activated.
LIE interrupt (vblank) don't have to be set if the CRTC is not
enabled.

Signed-off-by: Yannick Fertre 
Acked-by: Philippe Cornu 
Signed-off-by: Benjamin Gaignard 
Link: 
https://patchwork.freedesktop.org/patch/msgid/1579601650-7055-1-git-send-email-yannick.fer...@st.com
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/stm/ltdc.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index 5b51298921cf1..cf899cff7610a 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -654,9 +654,14 @@ static const struct drm_crtc_helper_funcs 
ltdc_crtc_helper_funcs = {
 static int ltdc_crtc_enable_vblank(struct drm_crtc *crtc)
 {
struct ltdc_device *ldev = crtc_to_ltdc(crtc);
+   struct drm_crtc_state *state = crtc->state;
 
DRM_DEBUG_DRIVER("\n");
-   reg_set(ldev->regs, LTDC_IER, IER_LIE);
+
+   if (state->enable)
+   reg_set(ldev->regs, LTDC_IER, IER_LIE);
+   else
+   return -EPERM;
 
return 0;
 }
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.5 063/121] drm/amd/display: dc_get_vmid_use_vector() crashes when get called

2020-04-11 Thread Sasha Levin
From: Peikang Zhang 

[ Upstream commit 68bbca15e7062f4ae16531e29893f78d0b4840b6 ]

[Why]
int i can go out of boundary which will cause crash

[How]
Fixed the maximum value of i to avoid i going out of boundary

Signed-off-by: Peikang Zhang 
Reviewed-by: Jun Lei 
Acked-by: Bhawanpreet Lakha 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/display/dc/core/dc_vm_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_vm_helper.c 
b/drivers/gpu/drm/amd/display/dc/core/dc_vm_helper.c
index a96d8de9380e6..f2b39ec35c898 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_vm_helper.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_vm_helper.c
@@ -62,7 +62,7 @@ int dc_get_vmid_use_vector(struct dc *dc)
int i;
int in_use = 0;
 
-   for (i = 0; i < dc->vm_helper->num_vmid; i++)
+   for (i = 0; i < MAX_HUBP; i++)
in_use |= dc->vm_helper->hubp_vmid_usage[i].vmid_usage[0]
| dc->vm_helper->hubp_vmid_usage[i].vmid_usage[1];
return in_use;
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.5 033/121] drm/amd/display: Fix default logger mask definition

2020-04-11 Thread Sasha Levin
From: Eric Bernstein 

[ Upstream commit ccb6af1e25830e5601b6beacc698390f0245316f ]

[Why]
Logger mask was updated to uint64_t, however default mask definition was
not updated for unsigned long long

[How]
Update DC_DEFAULT_LOG_MASK to support uint64_t type

Signed-off-by: Eric Bernstein 
Reviewed-by: Dmytro Laktyushkin 
Acked-by: Rodrigo Siqueira 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 .../drm/amd/display/include/logger_types.h| 63 ++-
 1 file changed, 32 insertions(+), 31 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/include/logger_types.h 
b/drivers/gpu/drm/amd/display/include/logger_types.h
index 2b219cdb13ad4..e0fcc0ce677e7 100644
--- a/drivers/gpu/drm/amd/display/include/logger_types.h
+++ b/drivers/gpu/drm/amd/display/include/logger_types.h
@@ -130,36 +130,37 @@ enum dc_log_type {
 #define DC_MIN_LOG_MASK ((1 << LOG_ERROR) | \
(1 << LOG_DETECTION_EDID_PARSER))
 
-#define DC_DEFAULT_LOG_MASK ((1 << LOG_ERROR) | \
-   (1 << LOG_WARNING) | \
-   (1 << LOG_EVENT_MODE_SET) | \
-   (1 << LOG_EVENT_DETECTION) | \
-   (1 << LOG_EVENT_LINK_TRAINING) | \
-   (1 << LOG_EVENT_LINK_LOSS) | \
-   (1 << LOG_EVENT_UNDERFLOW) | \
-   (1 << LOG_RESOURCE) | \
-   (1 << LOG_FEATURE_OVERRIDE) | \
-   (1 << LOG_DETECTION_EDID_PARSER) | \
-   (1 << LOG_DC) | \
-   (1 << LOG_HW_HOTPLUG) | \
-   (1 << LOG_HW_SET_MODE) | \
-   (1 << LOG_HW_RESUME_S3) | \
-   (1 << LOG_HW_HPD_IRQ) | \
-   (1 << LOG_SYNC) | \
-   (1 << LOG_BANDWIDTH_VALIDATION) | \
-   (1 << LOG_MST) | \
-   (1 << LOG_DETECTION_DP_CAPS) | \
-   (1 << LOG_BACKLIGHT)) | \
-   (1 << LOG_I2C_AUX) | \
-   (1 << LOG_IF_TRACE) | \
-   (1 << LOG_DTN) /* | \
-   (1 << LOG_DEBUG) | \
-   (1 << LOG_BIOS) | \
-   (1 << LOG_SURFACE) | \
-   (1 << LOG_SCALER) | \
-   (1 << LOG_DML) | \
-   (1 << LOG_HW_LINK_TRAINING) | \
-   (1 << LOG_HW_AUDIO)| \
-   (1 << LOG_BANDWIDTH_CALCS)*/
+#define DC_DEFAULT_LOG_MASK ((1ULL << LOG_ERROR) | \
+   (1ULL << LOG_WARNING) | \
+   (1ULL << LOG_EVENT_MODE_SET) | \
+   (1ULL << LOG_EVENT_DETECTION) | \
+   (1ULL << LOG_EVENT_LINK_TRAINING) | \
+   (1ULL << LOG_EVENT_LINK_LOSS) | \
+   (1ULL << LOG_EVENT_UNDERFLOW) | \
+   (1ULL << LOG_RESOURCE) | \
+   (1ULL << LOG_FEATURE_OVERRIDE) | \
+   (1ULL << LOG_DETECTION_EDID_PARSER) | \
+   (1ULL << LOG_DC) | \
+   (1ULL << LOG_HW_HOTPLUG) | \
+   (1ULL << LOG_HW_SET_MODE) | \
+   (1ULL << LOG_HW_RESUME_S3) | \
+   (1ULL << LOG_HW_HPD_IRQ) | \
+   (1ULL << LOG_SYNC) | \
+   (1ULL << LOG_BANDWIDTH_VALIDATION) | \
+   (1ULL << LOG_MST) | \
+   (1ULL << LOG_DETECTION_DP_CAPS) | \
+   (1ULL << LOG_BACKLIGHT)) | \
+   (1ULL << LOG_I2C_AUX) | \
+   (1ULL << LOG_IF_TRACE) | \
+   (1ULL << LOG_HDMI_FRL) | \
+   (1ULL << LOG_DTN) /* | \
+   (1ULL << LOG_DEBUG) | \
+   (1ULL << LOG_BIOS) | \
+   (1ULL << LOG_SURFACE) | \
+   (1ULL << LOG_SCALER) | \
+   (1ULL << LOG_DML) | \
+   (1ULL << LOG_HW_LINK_TRAINING) | \
+   (1ULL << LOG_HW_AUDIO)| \
+   (1ULL << LOG_BANDWIDTH_CALCS)*/
 
 #endif /* __DAL_LOGGER_TYPES_H__ */
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.5 037/121] drm/amd/display: Only round InfoFrame refresh rates

2020-04-11 Thread Sasha Levin
From: Aric Cyr 

[ Upstream commit 3fc6376ed6f2f67bc9fb0c7a3cf07967d6aa6216 ]

[Why]
When calculating nominal refresh rates, don't round.
Only the VSIF needs to be rounded.

[How]
Revert rounding change for nominal and just round when forming the
FreeSync VSIF.

Signed-off-by: Aric Cyr 
Reviewed-by: Anthony Koo 
Acked-by: Rodrigo Siqueira 
Acked-by: Harry Wentland 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/display/modules/freesync/freesync.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c 
b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
index d9ea4ae690af6..592ad78f731fd 100644
--- a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
+++ b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
@@ -524,12 +524,12 @@ static void build_vrr_infopacket_data(const struct 
mod_vrr_params *vrr,
infopacket->sb[6] |= 0x04;
 
/* PB7 = FreeSync Minimum refresh rate (Hz) */
-   infopacket->sb[7] = (unsigned char)(vrr->min_refresh_in_uhz / 100);
+   infopacket->sb[7] = (unsigned char)((vrr->min_refresh_in_uhz + 50) 
/ 100);
 
/* PB8 = FreeSync Maximum refresh rate (Hz)
 * Note: We should never go above the field rate of the mode timing set.
 */
-   infopacket->sb[8] = (unsigned char)(vrr->max_refresh_in_uhz / 100);
+   infopacket->sb[8] = (unsigned char)((vrr->max_refresh_in_uhz + 50) 
/ 100);
 
 
//FreeSync HDR
@@ -747,10 +747,6 @@ void mod_freesync_build_vrr_params(struct mod_freesync 
*mod_freesync,
nominal_field_rate_in_uhz =
mod_freesync_calc_nominal_field_rate(stream);
 
-   /* Rounded to the nearest Hz */
-   nominal_field_rate_in_uhz = 100ULL *
-   div_u64(nominal_field_rate_in_uhz + 50, 100);
-
min_refresh_in_uhz = in_config->min_refresh_in_uhz;
max_refresh_in_uhz = in_config->max_refresh_in_uhz;
 
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.5 048/121] drm/sun4i: dsi: Use NULL to signify "no panel"

2020-04-11 Thread Sasha Levin
From: Samuel Holland 

[ Upstream commit 0e4e3fb4901d19f49e5c0a582f383b10dda8d1c5 ]

The continued use of an ERR_PTR to signify "no panel" outside of
sun6i_dsi_attach is confusing because it is a double negative. Because
the connector always reports itself as connected, there is also the
possibility of sending an ERR_PTR to drm_panel_get_modes(), which would
crash.

Solve both of these by only storing the panel pointer if it is valid.

Fixes: 133add5b5ad4 ("drm/sun4i: Add Allwinner A31 MIPI-DSI controller support")
Signed-off-by: Samuel Holland 
Signed-off-by: Maxime Ripard 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20200211072858.30784-2-sam...@sholland.org
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c 
b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
index c958ca9bae632..f1f9bcdfa372c 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -749,7 +749,7 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder 
*encoder)
phy_configure(dsi->dphy, );
phy_power_on(dsi->dphy);
 
-   if (!IS_ERR(dsi->panel))
+   if (dsi->panel)
drm_panel_prepare(dsi->panel);
 
/*
@@ -764,7 +764,7 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder 
*encoder)
 * ordering on the panels I've tested it with, so I guess this
 * will do for now, until that IP is better understood.
 */
-   if (!IS_ERR(dsi->panel))
+   if (dsi->panel)
drm_panel_enable(dsi->panel);
 
sun6i_dsi_start(dsi, DSI_START_HSC);
@@ -780,7 +780,7 @@ static void sun6i_dsi_encoder_disable(struct drm_encoder 
*encoder)
 
DRM_DEBUG_DRIVER("Disabling DSI output\n");
 
-   if (!IS_ERR(dsi->panel)) {
+   if (dsi->panel) {
drm_panel_disable(dsi->panel);
drm_panel_unprepare(dsi->panel);
}
@@ -942,11 +942,13 @@ static int sun6i_dsi_attach(struct mipi_dsi_host *host,
struct mipi_dsi_device *device)
 {
struct sun6i_dsi *dsi = host_to_sun6i_dsi(host);
+   struct drm_panel *panel = of_drm_find_panel(device->dev.of_node);
 
+   if (IS_ERR(panel))
+   return PTR_ERR(panel);
+
+   dsi->panel = panel;
dsi->device = device;
-   dsi->panel = of_drm_find_panel(device->dev.of_node);
-   if (IS_ERR(dsi->panel))
-   return PTR_ERR(dsi->panel);
 
dev_info(host->dev, "Attached device %s\n", device->name);
 
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.5 060/121] fbdev: potential information leak in do_fb_ioctl()

2020-04-11 Thread Sasha Levin
From: Dan Carpenter 

[ Upstream commit d3d19d6fc5736a798b118971935ce274f7deaa82 ]

The "fix" struct has a 2 byte hole after ->ywrapstep and the
"fix = info->fix;" assignment doesn't necessarily clear it.  It depends
on the compiler.  The solution is just to replace the assignment with an
memcpy().

Fixes: 1f5e31d7e55a ("fbmem: don't call copy_from/to_user() with mutex held")
Signed-off-by: Dan Carpenter 
Cc: Andrew Morton 
Cc: Arnd Bergmann 
Cc: "Eric W. Biederman" 
Cc: Andrea Righi 
Cc: Daniel Vetter 
Cc: Sam Ravnborg 
Cc: Maarten Lankhorst 
Cc: Daniel Thompson 
Cc: Peter Rosin 
Cc: Jani Nikula 
Cc: Gerd Hoffmann 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20200113100132.ixpaymordi24n3av@kili.mountain
Signed-off-by: Sasha Levin 
---
 drivers/video/fbdev/core/fbmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index 6f6fc785b5453..28158e21672ad 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -1110,7 +1110,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned 
int cmd,
break;
case FBIOGET_FSCREENINFO:
lock_fb_info(info);
-   fix = info->fix;
+   memcpy(, >fix, sizeof(fix));
if (info->flags & FBINFO_HIDE_SMEM_START)
fix.smem_start = 0;
unlock_fb_info(info);
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.5 056/121] drm/omap: fix possible object reference leak

2020-04-11 Thread Sasha Levin
From: Wen Yang 

[ Upstream commit 47340e46f34a3b1d80e40b43ae3d7a8da34a3541 ]

The call to of_find_matching_node returns a node pointer with refcount
incremented thus it must be explicitly decremented after the last
usage.

Detected by coccinelle with the following warnings:
drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c:212:2-8: ERROR: missing 
of_node_put; acquired a node pointer with refcount incremented on line 209, but 
without a corresponding object release within this function.
drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c:237:1-7: ERROR: missing 
of_node_put; acquired a node pointer with refcount incremented on line 209, but 
without a corresponding object release within this function.

Signed-off-by: Wen Yang 
Reviewed-by: Laurent Pinchart 
Reviewed-by: Mukesh Ojha 
Cc: Tomi Valkeinen 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Sebastian Reichel 
Cc: Laurent Pinchart 
Cc: dri-devel@lists.freedesktop.org
Cc: linux-ker...@vger.kernel.org
Cc: Markus Elfring 
Signed-off-by: Tomi Valkeinen 
Link: 
https://patchwork.freedesktop.org/patch/msgid/1554692313-28882-2-git-send-email-wen.yan...@zte.com.cn
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c 
b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
index 31502857f013d..ce67891eedd46 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
@@ -192,7 +192,7 @@ static int __init omapdss_boot_init(void)
dss = of_find_matching_node(NULL, omapdss_of_match);
 
if (dss == NULL || !of_device_is_available(dss))
-   return 0;
+   goto put_node;
 
omapdss_walk_device(dss, true);
 
@@ -217,6 +217,8 @@ static int __init omapdss_boot_init(void)
kfree(n);
}
 
+put_node:
+   of_node_put(dss);
return 0;
 }
 
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.5 061/121] drm/crc: Actually allow to change the crc source

2020-04-11 Thread Sasha Levin
From: Daniel Vetter 

[ Upstream commit 3cb6d8e5cf9811a62e27f366fd1c05f90310a8fd ]

Oops.

Fixes: 9edbf1fa600a ("drm: Add API for capturing frame CRCs")
Cc: Tomeu Vizoso 
Cc: Emil Velikov 
Cc: Benjamin Gaignard 
Signed-off-by: Daniel Vetter 
Reviewed-by: Ville Syrjälä 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20190821203835.18314-1-daniel.vet...@ffwll.ch
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/drm_debugfs_crc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_debugfs_crc.c 
b/drivers/gpu/drm/drm_debugfs_crc.c
index 2ece2957da1af..6b20da279bc7f 100644
--- a/drivers/gpu/drm/drm_debugfs_crc.c
+++ b/drivers/gpu/drm/drm_debugfs_crc.c
@@ -367,7 +367,7 @@ void drm_debugfs_crtc_crc_add(struct drm_crtc *crtc)
 
crc_ent = debugfs_create_dir("crc", crtc->debugfs_entry);
 
-   debugfs_create_file("control", S_IRUGO, crc_ent, crtc,
+   debugfs_create_file("control", S_IRUGO | S_IWUSR, crc_ent, crtc,
_crtc_crc_control_fops);
debugfs_create_file("data", S_IRUGO, crc_ent, crtc,
_crtc_crc_data_fops);
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.5 039/121] drm/panel: simple: fix osd070t1718_19ts sync drive edge

2020-04-11 Thread Sasha Levin
From: Tomi Valkeinen 

[ Upstream commit fb0629db6622c16da1aa76a4520daf9a46e2 ]

The panel datasheet says that the panel samples at falling edge, but
does not say anything about h/v sync signals. Testing shows that if the
sync signals are driven on falling edge, the picture on the panel will
be slightly shifted right.

Setting sync drive edge to the same as data drive edge fixes this issue.

Signed-off-by: Tomi Valkeinen 
Acked-by: Laurent Pinchart 
Signed-off-by: Sam Ravnborg 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20191114093950.4101-4-tomi.valkei...@ti.com
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/panel/panel-simple.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index 72f69709f3493..df2c7392463b5 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -2431,7 +2431,8 @@ static const struct panel_desc 
osddisplays_osd070t1718_19ts = {
.height = 91,
},
.bus_format = MEDIA_BUS_FMT_RGB888_1X24,
-   .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE,
+   .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE |
+   DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE,
.connector_type = DRM_MODE_CONNECTOR_DPI,
 };
 
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.5 071/121] drm/omap: dss: Cleanup DSS ports on initialisation failure

2020-04-11 Thread Sasha Levin
From: Laurent Pinchart 

[ Upstream commit 2a0a3ae17d36fa86dcf7c8e8d7b7f056ebd6c064 ]

When the DSS initialises its output DPI and SDI ports, failures don't
clean up previous successfully initialised ports. This can lead to
resource leak or memory corruption. Fix it.

Reported-by: Hans Verkuil 
Signed-off-by: Laurent Pinchart 
Reviewed-by: Tomi Valkeinen 
Acked-by: Sam Ravnborg 
Tested-by: Sebastian Reichel 
Reviewed-by: Sebastian Reichel 
Signed-off-by: Tomi Valkeinen 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20200226112514.12455-22-laurent.pinch...@ideasonboard.com
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/omapdrm/dss/dss.c | 43 +++
 1 file changed, 26 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c 
b/drivers/gpu/drm/omapdrm/dss/dss.c
index 225ec808b01a9..67b92b5d8dd76 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss.c
+++ b/drivers/gpu/drm/omapdrm/dss/dss.c
@@ -1151,46 +1151,38 @@ static const struct dss_features dra7xx_dss_feats = {
.has_lcd_clk_src=   true,
 };
 
-static int dss_init_ports(struct dss_device *dss)
+static void __dss_uninit_ports(struct dss_device *dss, unsigned int num_ports)
 {
struct platform_device *pdev = dss->pdev;
struct device_node *parent = pdev->dev.of_node;
struct device_node *port;
unsigned int i;
-   int r;
 
-   for (i = 0; i < dss->feat->num_ports; i++) {
+   for (i = 0; i < num_ports; i++) {
port = of_graph_get_port_by_id(parent, i);
if (!port)
continue;
 
switch (dss->feat->ports[i]) {
case OMAP_DISPLAY_TYPE_DPI:
-   r = dpi_init_port(dss, pdev, port, dss->feat->model);
-   if (r)
-   return r;
+   dpi_uninit_port(port);
break;
-
case OMAP_DISPLAY_TYPE_SDI:
-   r = sdi_init_port(dss, pdev, port);
-   if (r)
-   return r;
+   sdi_uninit_port(port);
break;
-
default:
break;
}
}
-
-   return 0;
 }
 
-static void dss_uninit_ports(struct dss_device *dss)
+static int dss_init_ports(struct dss_device *dss)
 {
struct platform_device *pdev = dss->pdev;
struct device_node *parent = pdev->dev.of_node;
struct device_node *port;
-   int i;
+   unsigned int i;
+   int r;
 
for (i = 0; i < dss->feat->num_ports; i++) {
port = of_graph_get_port_by_id(parent, i);
@@ -1199,15 +1191,32 @@ static void dss_uninit_ports(struct dss_device *dss)
 
switch (dss->feat->ports[i]) {
case OMAP_DISPLAY_TYPE_DPI:
-   dpi_uninit_port(port);
+   r = dpi_init_port(dss, pdev, port, dss->feat->model);
+   if (r)
+   goto error;
break;
+
case OMAP_DISPLAY_TYPE_SDI:
-   sdi_uninit_port(port);
+   r = sdi_init_port(dss, pdev, port);
+   if (r)
+   goto error;
break;
+
default:
break;
}
}
+
+   return 0;
+
+error:
+   __dss_uninit_ports(dss, i);
+   return r;
+}
+
+static void dss_uninit_ports(struct dss_device *dss)
+{
+   __dss_uninit_ports(dss, dss->feat->num_ports);
 }
 
 static int dss_video_pll_probe(struct dss_device *dss)
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.5 028/121] drm/amd/display: Stop if retimer is not available

2020-04-11 Thread Sasha Levin
From: Rodrigo Siqueira 

[ Upstream commit a0e40018dcc3f59a10ca21d58f8ea8ceb1b035ac ]

Raven provides retimer feature support that requires i2c interaction in
order to make it work well, all settings required for this configuration
are loaded from the Atom bios which include the i2c address. If the
retimer feature is not available, we should abort the attempt to set
this feature, otherwise, it makes the following line return
I2C_CHANNEL_OPERATION_NO_RESPONSE:

 i2c_success = i2c_write(pipe_ctx, slave_address, buffer, sizeof(buffer));
 ...
 if (!i2c_success)
   ASSERT(i2c_success);

This ends up causing problems with hotplugging HDMI displays on Raven,
and causes retimer settings to warn like so:

WARNING: CPU: 1 PID: 429 at
drivers/gpu/drm/amd/amdgpu/../dal/dc/core/dc_link.c:1998
write_i2c_retimer_setting+0xc2/0x3c0 [amdgpu] Modules linked in:
edac_mce_amd ccp kvm irqbypass binfmt_misc crct10dif_pclmul crc32_pclmul
ghash_clmulni_intel snd_hda_codec_realtek snd_hda_codec_generic
ledtrig_audio snd_hda_codec_hdmi snd_hda_intel amdgpu(+) snd_hda_codec
snd_hda_core snd_hwdep snd_pcm snd_seq_midi snd_seq_midi_event
snd_rawmidi aesni_intel snd_seq amd_iommu_v2 gpu_sched aes_x86_64
crypto_simd cryptd glue_helper snd_seq_device ttm drm_kms_helper
snd_timer eeepc_wmi wmi_bmof asus_wmi sparse_keymap drm mxm_wmi snd
k10temp fb_sys_fops syscopyarea sysfillrect sysimgblt soundcore joydev
input_leds mac_hid sch_fq_codel parport_pc ppdev lp parport ip_tables
x_tables autofs4 igb i2c_algo_bit hid_generic usbhid i2c_piix4 dca ahci
hid libahci video wmi gpio_amdpt gpio_generic CPU: 1 PID: 429 Comm:
systemd-udevd Tainted: GW 5.2.0-rc1sept162019+ #1
Hardware name: System manufacturer System Product Name/ROG STRIX B450-F
GAMING, BIOS 2605 08/06/2019
RIP: 0010:write_i2c_retimer_setting+0xc2/0x3c0 [amdgpu]
Code: ff 0f b6 4d ce 44 0f b6 45 cf 44 0f b6 c8 45 89 cf 44 89 e2 48 c7
c6 f0 34 bc c0 bf 04 00 00 00 e8 63 b0 90 ff 45 84 ff 75 02 <0f> 0b 42
0f b6 04 73 8d 50 f6 80 fa 02 77 8c 3c 0a 0f 85 c8 00 00 RSP:
0018:a99d02726fd0 EFLAGS: 00010246
RAX:  RBX: a99d02727035 RCX: 0006
RDX:  RSI: 0002 RDI: 976acc857440
RBP: a99d02727018 R08: 0002 R09: 0002a600
R10: e90610193680 R11: 05e3 R12: 005d
R13: 976ac4b201b8 R14: 0001 R15: 
FS:  7f14f99e1680() GS:976acc84() knlGS:
CS:  0010 DS:  ES:  CR0: 80050033
CR2: 7fdf212843b8 CR3: 000408906000 CR4: 003406e0
Call Trace:
 core_link_enable_stream+0x626/0x680 [amdgpu]
 dce110_apply_ctx_to_hw+0x414/0x4e0 [amdgpu]
 dc_commit_state+0x331/0x5e0 [amdgpu]
 ? drm_calc_timestamping_constants+0xf9/0x150 [drm]
 amdgpu_dm_atomic_commit_tail+0x395/0x1e00 [amdgpu]
 ? dm_plane_helper_prepare_fb+0x20c/0x280 [amdgpu]
 commit_tail+0x42/0x70 [drm_kms_helper]
 drm_atomic_helper_commit+0x10c/0x120 [drm_kms_helper]
 amdgpu_dm_atomic_commit+0x95/0xa0 [amdgpu]
 drm_atomic_commit+0x4a/0x50 [drm]
 restore_fbdev_mode_atomic+0x1c0/0x1e0 [drm_kms_helper]
 restore_fbdev_mode+0x4c/0x160 [drm_kms_helper]
 ? _cond_resched+0x19/0x40
 drm_fb_helper_restore_fbdev_mode_unlocked+0x4e/0xa0 [drm_kms_helper]
 drm_fb_helper_set_par+0x2d/0x50 [drm_kms_helper]
 fbcon_init+0x471/0x630
 visual_init+0xd5/0x130
 do_bind_con_driver+0x20a/0x430
 do_take_over_console+0x7d/0x1b0
 do_fbcon_takeover+0x5c/0xb0
 fbcon_event_notify+0x6cd/0x8a0
 notifier_call_chain+0x4c/0x70
 blocking_notifier_call_chain+0x43/0x60
 fb_notifier_call_chain+0x1b/0x20
 register_framebuffer+0x254/0x360
 __drm_fb_helper_initial_config_and_unlock+0x2c5/0x510 [drm_kms_helper]
 drm_fb_helper_initial_config+0x35/0x40 [drm_kms_helper]
 amdgpu_fbdev_init+0xcd/0x100 [amdgpu]
 amdgpu_device_init+0x1156/0x1930 [amdgpu]
 amdgpu_driver_load_kms+0x8d/0x2e0 [amdgpu]
 drm_dev_register+0x12b/0x1c0 [drm]
 amdgpu_pci_probe+0xd3/0x160 [amdgpu]
 local_pci_probe+0x47/0xa0
 pci_device_probe+0x142/0x1b0
 really_probe+0xf5/0x3d0
 driver_probe_device+0x11b/0x130
 device_driver_attach+0x58/0x60
 __driver_attach+0xa3/0x140
 ? device_driver_attach+0x60/0x60
 ? device_driver_attach+0x60/0x60
 bus_for_each_dev+0x74/0xb0
 ? kmem_cache_alloc_trace+0x1a3/0x1c0
 driver_attach+0x1e/0x20
 bus_add_driver+0x147/0x220
 ? 0xc0cb9000
 driver_register+0x60/0x100
 ? 0xc0cb9000
 __pci_register_driver+0x5a/0x60
 amdgpu_init+0x74/0x83 [amdgpu]
 do_one_initcall+0x4a/0x1fa
 ? _cond_resched+0x19/0x40
 ? kmem_cache_alloc_trace+0x3f/0x1c0
 ? __vunmap+0x1cc/0x200
 do_init_module+0x5f/0x227
 load_module+0x2330/0x2b40
 __do_sys_finit_module+0xfc/0x120
 ? __do_sys_finit_module+0xfc/0x120
 __x64_sys_finit_module+0x1a/0x20
 do_syscall_64+0x5a/0x130
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x7f14f9500839
Code: 00 f3 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89
f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01
f0 ff ff 73 01 c3 48 8b 0d 1f 

[PATCH AUTOSEL 5.5 026/121] drm/tegra: dc: Release PM and RGB output when client's registration fails

2020-04-11 Thread Sasha Levin
From: Dmitry Osipenko 

[ Upstream commit 0411ea89a689531e1829fdf8af3747646c02c721 ]

Runtime PM and RGB output need to be released when host1x client
registration fails. The releasing is missed in the code, let's correct it.

Signed-off-by: Dmitry Osipenko 
Signed-off-by: Thierry Reding 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/tegra/dc.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
index 714af052fbefe..ed870117c72c9 100644
--- a/drivers/gpu/drm/tegra/dc.c
+++ b/drivers/gpu/drm/tegra/dc.c
@@ -2506,10 +2506,16 @@ static int tegra_dc_probe(struct platform_device *pdev)
if (err < 0) {
dev_err(>dev, "failed to register host1x client: %d\n",
err);
-   return err;
+   goto disable_pm;
}
 
return 0;
+
+disable_pm:
+   pm_runtime_disable(>dev);
+   tegra_dc_rgb_remove(dc);
+
+   return err;
 }
 
 static int tegra_dc_remove(struct platform_device *pdev)
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.5 030/121] drm/amd/display: writing stereo polarity register if swapped

2020-04-11 Thread Sasha Levin
From: Martin Leung 

[ Upstream commit e592e85f3378246dd66b861fa60ef803d8cece6b ]

[why]
on some displays that prefer swapped polarity we were seeing L/R images
swapped because OTG_STEREO_SYNC_OUTPUT_POLARITY would always be mapped
to 0

[how]
fix initial dal3 implementation to properly update the polarity field
according to the crtc_stereo_flags (same as
OTG_STEREO_EYE_FLAG_POLARITY)

Signed-off-by: Martin Leung 
Reviewed-by: Aric Cyr 
Acked-by: Rodrigo Siqueira 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c 
b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c
index dabccbd49ad4a..1d6956cc3a011 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c
@@ -1185,7 +1185,7 @@ static void optc1_enable_stereo(struct timing_generator 
*optc,
REG_UPDATE_3(OTG_STEREO_CONTROL,
OTG_STEREO_EN, stereo_en,
OTG_STEREO_SYNC_OUTPUT_LINE_NUM, 0,
-   OTG_STEREO_SYNC_OUTPUT_POLARITY, 0);
+   OTG_STEREO_SYNC_OUTPUT_POLARITY, 
flags->RIGHT_EYE_POLARITY == 0 ? 0 : 1);
 
if (flags->PROGRAM_POLARITY)
REG_UPDATE(OTG_STEREO_CONTROL,
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.5 013/121] drm/amd/display: Explicitly disable triplebuffer flips

2020-04-11 Thread Sasha Levin
From: Nicholas Kazlauskas 

[ Upstream commit 2d673560b7b83f8fe4163610f35c51b4d095525c ]

[Why]
This is enabled by default on Renoir but there's userspace/API support
to actually make use of this.

Since we're not passing this down through surface updates, let's
explicitly disable this for now.

This fixes "dcn20_program_front_end_for_ctx" warnings associated with
incorrect/unexpected programming sequences performed while this is
enabled.

[How]
Disable it at the topmost level in DM in case anyone tries to flip this
to enabled for any of the other ASICs like Navi10/14.

Signed-off-by: Nicholas Kazlauskas 
Reviewed-by: Hersen Wu 
Acked-by: Rodrigo Siqueira 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 803e59d974111..fb1efdde7a49d 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -2481,6 +2481,9 @@ static int amdgpu_dm_initialize_drm_device(struct 
amdgpu_device *adev)
if (adev->asic_type != CHIP_CARRIZO && adev->asic_type != CHIP_STONEY)
dm->dc->debug.disable_stutter = amdgpu_pp_feature_mask & 
PP_STUTTER_MODE ? false : true;
 
+   /* No userspace support. */
+   dm->dc->debug.disable_tri_buf = true;
+
return 0;
 fail:
kfree(aencoder);
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.6 149/149] PCI: Use ioremap(), not phys_to_virt() for platform ROM

2020-04-11 Thread Sasha Levin
From: Mikel Rychliski 

[ Upstream commit 72e0ef0e5f067fd991f702f0b2635d911d0cf208 ]

On some EFI systems, the video BIOS is provided by the EFI firmware.  The
boot stub code stores the physical address of the ROM image in pdev->rom.
Currently we attempt to access this pointer using phys_to_virt(), which
doesn't work with CONFIG_HIGHMEM.

On these systems, attempting to load the radeon module on a x86_32 kernel
can result in the following:

  BUG: unable to handle page fault for address: 3e8ed03c
  #PF: supervisor read access in kernel mode
  #PF: error_code(0x) - not-present page
  *pde = 
  Oops:  [#1] PREEMPT SMP
  CPU: 0 PID: 317 Comm: systemd-udevd Not tainted 5.6.0-rc3-next-20200228 #2
  Hardware name: Apple Computer, Inc. MacPro1,1/Mac-F4208DC8, BIOS 
MP11.88Z.005C.B08.0707021221 07/02/07
  EIP: radeon_get_bios+0x5ed/0xe50 [radeon]
  Code: 00 00 84 c0 0f 85 12 fd ff ff c7 87 64 01 00 00 00 00 00 00 8b 47 08 8b 
55 b0 e8 1e 83 e1 d6 85 c0 74 1a 8b 55 c0 85 d2 74 13 <80> 38 55 75 0e 80 78 01 
aa 0f 84 a4 03 00 00 8d 74 26 00 68 dc 06
  EAX: 3e8ed03c EBX:  ECX: 3e8ed03c EDX: 0001
  ESI: 0004 EDI: eec04000 EBP: eef3fc60 ESP: eef3fbe0
  DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 EFLAGS: 00010206
  CR0: 80050033 CR2: 3e8ed03c CR3: 2ec77000 CR4: 06d0
  Call Trace:
   r520_init+0x26/0x240 [radeon]
   radeon_device_init+0x533/0xa50 [radeon]
   radeon_driver_load_kms+0x80/0x220 [radeon]
   drm_dev_register+0xa7/0x180 [drm]
   radeon_pci_probe+0x10f/0x1a0 [radeon]
   pci_device_probe+0xd4/0x140

Fix the issue by updating all drivers which can access a platform provided
ROM. Instead of calling the helper function pci_platform_rom() which uses
phys_to_virt(), call ioremap() directly on the pdev->rom.

radeon_read_platform_bios() previously directly accessed an __iomem
pointer. Avoid this by calling memcpy_fromio() instead of kmemdup().

pci_platform_rom() now has no remaining callers, so remove it.

Link: https://lore.kernel.org/r/20200319021623.5426-1-mi...@mikelr.com
Signed-off-by: Mikel Rychliski 
Signed-off-by: Bjorn Helgaas 
Acked-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c  | 31 +++
 .../drm/nouveau/nvkm/subdev/bios/shadowpci.c  | 17 --
 drivers/gpu/drm/radeon/radeon_bios.c  | 30 +++---
 drivers/pci/rom.c | 17 --
 include/linux/pci.h   |  1 -
 5 files changed, 52 insertions(+), 44 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
index 50dff69a0f6e3..b1172d93c99c3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
@@ -192,30 +192,35 @@ static bool amdgpu_read_bios_from_rom(struct 
amdgpu_device *adev)
 
 static bool amdgpu_read_platform_bios(struct amdgpu_device *adev)
 {
-   uint8_t __iomem *bios;
-   size_t size;
+   phys_addr_t rom = adev->pdev->rom;
+   size_t romlen = adev->pdev->romlen;
+   void __iomem *bios;
 
adev->bios = NULL;
 
-   bios = pci_platform_rom(adev->pdev, );
-   if (!bios) {
+   if (!rom || romlen == 0)
return false;
-   }
 
-   adev->bios = kzalloc(size, GFP_KERNEL);
-   if (adev->bios == NULL)
+   adev->bios = kzalloc(romlen, GFP_KERNEL);
+   if (!adev->bios)
return false;
 
-   memcpy_fromio(adev->bios, bios, size);
+   bios = ioremap(rom, romlen);
+   if (!bios)
+   goto free_bios;
 
-   if (!check_atom_bios(adev->bios, size)) {
-   kfree(adev->bios);
-   return false;
-   }
+   memcpy_fromio(adev->bios, bios, romlen);
+   iounmap(bios);
 
-   adev->bios_size = size;
+   if (!check_atom_bios(adev->bios, romlen))
+   goto free_bios;
+
+   adev->bios_size = romlen;
 
return true;
+free_bios:
+   kfree(adev->bios);
+   return false;
 }
 
 #ifdef CONFIG_ACPI
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c 
b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
index 9b91da09dc5f8..8d9812a51ef63 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
@@ -101,9 +101,13 @@ platform_init(struct nvkm_bios *bios, const char *name)
else
return ERR_PTR(-ENODEV);
 
+   if (!pdev->rom || pdev->romlen == 0)
+   return ERR_PTR(-ENODEV);
+
if ((priv = kmalloc(sizeof(*priv), GFP_KERNEL))) {
+   priv->size = pdev->romlen;
if (ret = -ENODEV,
-   (priv->rom = pci_platform_rom(pdev, >size)))
+   (priv->rom = ioremap(pdev->rom, pdev->romlen)))
return priv;
kfree(priv);
}
@@ -111,11 +115,20 @@ platform_init(struct nvkm_bios *bios, const char *name)
return 

[PATCH AUTOSEL 5.6 105/149] drm/msm: fix leaks if initialization fails

2020-04-11 Thread Sasha Levin
From: Pavel Machek 

[ Upstream commit 66be340f827554cb1c8a1ed7dea97920b4085af2 ]

We should free resources in unlikely case of allocation failure.

Signed-off-by: Pavel Machek 
Signed-off-by: Rob Clark 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/msm/msm_drv.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index e4b750b0c2d3f..7d985f8865bef 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -444,8 +444,10 @@ static int msm_drm_init(struct device *dev, struct 
drm_driver *drv)
if (!dev->dma_parms) {
dev->dma_parms = devm_kzalloc(dev, sizeof(*dev->dma_parms),
  GFP_KERNEL);
-   if (!dev->dma_parms)
-   return -ENOMEM;
+   if (!dev->dma_parms) {
+   ret = -ENOMEM;
+   goto err_msm_uninit;
+   }
}
dma_set_max_seg_size(dev, DMA_BIT_MASK(32));
 
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.6 090/149] drm/amdkfd: Fix a memory leak in queue creation error handling

2020-04-11 Thread Sasha Levin
From: Yong Zhao 

[ Upstream commit 66f28b9a169855367d6e3ef71001969a8bffb19b ]

When the queue creation failed, some resources were not freed. Fix it.

Signed-off-by: Yong Zhao 
Acked-by: Alex Deucher 
Reviewed-by: Felix Kuehling 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
index 31fcd1b51f00f..4f7927b661ff4 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
@@ -328,6 +328,9 @@ int pqm_create_queue(struct process_queue_manager *pqm,
return retval;
 
 err_create_queue:
+   uninit_queue(q);
+   if (kq)
+   kernel_queue_uninit(kq, false);
kfree(pqn);
 err_allocate_pqn:
/* check if queues list is empty unregister process from device */
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.6 106/149] drm/msm/a5xx: Always set an OPP supported hardware value

2020-04-11 Thread Sasha Levin
From: Jordan Crouse 

[ Upstream commit 0478b4fc5f37f4d494245fe7bcce3f531cf380e9 ]

If the opp table specifies opp-supported-hw as a property but the driver
has not set a supported hardware value the OPP subsystem will reject
all the table entries.

Set a "default" value that will match the default table entries but not
conflict with any possible real bin values. Also fix a small memory leak
and free the buffer allocated by nvmem_cell_read().

Signed-off-by: Jordan Crouse 
Reviewed-by: Eric Anholt 
Signed-off-by: Rob Clark 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 27 ---
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
index 7d9e63e20dedd..724024a2243a4 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
@@ -1446,18 +1446,31 @@ static const struct adreno_gpu_funcs funcs = {
 static void check_speed_bin(struct device *dev)
 {
struct nvmem_cell *cell;
-   u32 bin, val;
+   u32 val;
+
+   /*
+* If the OPP table specifies a opp-supported-hw property then we have
+* to set something with dev_pm_opp_set_supported_hw() or the table
+* doesn't get populated so pick an arbitrary value that should
+* ensure the default frequencies are selected but not conflict with any
+* actual bins
+*/
+   val = 0x80;
 
cell = nvmem_cell_get(dev, "speed_bin");
 
-   /* If a nvmem cell isn't defined, nothing to do */
-   if (IS_ERR(cell))
-   return;
+   if (!IS_ERR(cell)) {
+   void *buf = nvmem_cell_read(cell, NULL);
+
+   if (!IS_ERR(buf)) {
+   u8 bin = *((u8 *) buf);
 
-   bin = *((u32 *) nvmem_cell_read(cell, NULL));
-   nvmem_cell_put(cell);
+   val = (1 << bin);
+   kfree(buf);
+   }
 
-   val = (1 << bin);
+   nvmem_cell_put(cell);
+   }
 
dev_pm_opp_set_supported_hw(dev, , 1);
 }
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.6 089/149] drm/omap: dss: Cleanup DSS ports on initialisation failure

2020-04-11 Thread Sasha Levin
From: Laurent Pinchart 

[ Upstream commit 2a0a3ae17d36fa86dcf7c8e8d7b7f056ebd6c064 ]

When the DSS initialises its output DPI and SDI ports, failures don't
clean up previous successfully initialised ports. This can lead to
resource leak or memory corruption. Fix it.

Reported-by: Hans Verkuil 
Signed-off-by: Laurent Pinchart 
Reviewed-by: Tomi Valkeinen 
Acked-by: Sam Ravnborg 
Tested-by: Sebastian Reichel 
Reviewed-by: Sebastian Reichel 
Signed-off-by: Tomi Valkeinen 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20200226112514.12455-22-laurent.pinch...@ideasonboard.com
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/omapdrm/dss/dss.c | 43 +++
 1 file changed, 26 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c 
b/drivers/gpu/drm/omapdrm/dss/dss.c
index 225ec808b01a9..67b92b5d8dd76 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss.c
+++ b/drivers/gpu/drm/omapdrm/dss/dss.c
@@ -1151,46 +1151,38 @@ static const struct dss_features dra7xx_dss_feats = {
.has_lcd_clk_src=   true,
 };
 
-static int dss_init_ports(struct dss_device *dss)
+static void __dss_uninit_ports(struct dss_device *dss, unsigned int num_ports)
 {
struct platform_device *pdev = dss->pdev;
struct device_node *parent = pdev->dev.of_node;
struct device_node *port;
unsigned int i;
-   int r;
 
-   for (i = 0; i < dss->feat->num_ports; i++) {
+   for (i = 0; i < num_ports; i++) {
port = of_graph_get_port_by_id(parent, i);
if (!port)
continue;
 
switch (dss->feat->ports[i]) {
case OMAP_DISPLAY_TYPE_DPI:
-   r = dpi_init_port(dss, pdev, port, dss->feat->model);
-   if (r)
-   return r;
+   dpi_uninit_port(port);
break;
-
case OMAP_DISPLAY_TYPE_SDI:
-   r = sdi_init_port(dss, pdev, port);
-   if (r)
-   return r;
+   sdi_uninit_port(port);
break;
-
default:
break;
}
}
-
-   return 0;
 }
 
-static void dss_uninit_ports(struct dss_device *dss)
+static int dss_init_ports(struct dss_device *dss)
 {
struct platform_device *pdev = dss->pdev;
struct device_node *parent = pdev->dev.of_node;
struct device_node *port;
-   int i;
+   unsigned int i;
+   int r;
 
for (i = 0; i < dss->feat->num_ports; i++) {
port = of_graph_get_port_by_id(parent, i);
@@ -1199,15 +1191,32 @@ static void dss_uninit_ports(struct dss_device *dss)
 
switch (dss->feat->ports[i]) {
case OMAP_DISPLAY_TYPE_DPI:
-   dpi_uninit_port(port);
+   r = dpi_init_port(dss, pdev, port, dss->feat->model);
+   if (r)
+   goto error;
break;
+
case OMAP_DISPLAY_TYPE_SDI:
-   sdi_uninit_port(port);
+   r = sdi_init_port(dss, pdev, port);
+   if (r)
+   goto error;
break;
+
default:
break;
}
}
+
+   return 0;
+
+error:
+   __dss_uninit_ports(dss, i);
+   return r;
+}
+
+static void dss_uninit_ports(struct dss_device *dss)
+{
+   __dss_uninit_ports(dss, dss->feat->num_ports);
 }
 
 static int dss_video_pll_probe(struct dss_device *dss)
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.6 095/149] drm/amd/display: Fix dmub_psr_destroy()

2020-04-11 Thread Sasha Levin
From: Dan Carpenter 

[ Upstream commit e599f01f44a77578c43530b027886933d9d2bb5b ]

This is freeing the wrong variable so it will crash.  It should be
freeing "*dmub" instead of "dmub".

Fixes: 4c1a1335dfe0 ("drm/amd/display: Driverside changes to support PSR in 
DMCUB")
Reviewed-by: Nicholas Kazlauskas 
Signed-off-by: Dan Carpenter 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c 
b/drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c
index 225955ec6d392..5fd3b59f183b7 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c
@@ -215,6 +215,6 @@ struct dmub_psr *dmub_psr_create(struct dc_context *ctx)
  */
 void dmub_psr_destroy(struct dmub_psr **dmub)
 {
-   kfree(dmub);
+   kfree(*dmub);
*dmub = NULL;
 }
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.6 088/149] drm/amd/display: System crashes when add_ptb_to_table() gets called

2020-04-11 Thread Sasha Levin
From: Peikang Zhang 

[ Upstream commit 0062972b9d9f888d0273c6496769d02e8f509135 ]

[Why]
Unused VMIDs were not evicted correctly

[How]
1. evict_vmids() logic was fixed;
2. Added boundary check for add_ptb_to_table() and
   clear_entry_from_vmid_table() to avoid crash caused by array out of
   boundary;
3. For mod_vmid_get_for_ptb(), vimd is changed from unsigned to signed
   due to vimd is signed.

Signed-off-by: Peikang Zhang 
Reviewed-by: Aric Cyr 
Acked-by: Rodrigo Siqueira 
Acked-by: Harry Wentland 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/display/modules/vmid/vmid.c | 16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/modules/vmid/vmid.c 
b/drivers/gpu/drm/amd/display/modules/vmid/vmid.c
index f0a153704f6e0..00f132f8ad55d 100644
--- a/drivers/gpu/drm/amd/display/modules/vmid/vmid.c
+++ b/drivers/gpu/drm/amd/display/modules/vmid/vmid.c
@@ -40,14 +40,18 @@ struct core_vmid {
 
 static void add_ptb_to_table(struct core_vmid *core_vmid, unsigned int vmid, 
uint64_t ptb)
 {
-   core_vmid->ptb_assigned_to_vmid[vmid] = ptb;
-   core_vmid->num_vmids_available--;
+   if (vmid < MAX_VMID) {
+   core_vmid->ptb_assigned_to_vmid[vmid] = ptb;
+   core_vmid->num_vmids_available--;
+   }
 }
 
 static void clear_entry_from_vmid_table(struct core_vmid *core_vmid, unsigned 
int vmid)
 {
-   core_vmid->ptb_assigned_to_vmid[vmid] = 0;
-   core_vmid->num_vmids_available++;
+   if (vmid < MAX_VMID) {
+   core_vmid->ptb_assigned_to_vmid[vmid] = 0;
+   core_vmid->num_vmids_available++;
+   }
 }
 
 static void evict_vmids(struct core_vmid *core_vmid)
@@ -57,7 +61,7 @@ static void evict_vmids(struct core_vmid *core_vmid)
 
// At this point any positions with value 0 are unused vmids, evict them
for (i = 1; i < core_vmid->num_vmid; i++) {
-   if (ord & (1u << i))
+   if (!(ord & (1u << i)))
clear_entry_from_vmid_table(core_vmid, i);
}
 }
@@ -91,7 +95,7 @@ static int get_next_available_vmid(struct core_vmid 
*core_vmid)
 uint8_t mod_vmid_get_for_ptb(struct mod_vmid *mod_vmid, uint64_t ptb)
 {
struct core_vmid *core_vmid = MOD_VMID_TO_CORE(mod_vmid);
-   unsigned int vmid = 0;
+   int vmid = 0;
 
// Physical address gets vmid 0
if (ptb == 0)
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.6 076/149] drm/amd/display: dc_get_vmid_use_vector() crashes when get called

2020-04-11 Thread Sasha Levin
From: Peikang Zhang 

[ Upstream commit 68bbca15e7062f4ae16531e29893f78d0b4840b6 ]

[Why]
int i can go out of boundary which will cause crash

[How]
Fixed the maximum value of i to avoid i going out of boundary

Signed-off-by: Peikang Zhang 
Reviewed-by: Jun Lei 
Acked-by: Bhawanpreet Lakha 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/display/dc/core/dc_vm_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_vm_helper.c 
b/drivers/gpu/drm/amd/display/dc/core/dc_vm_helper.c
index a96d8de9380e6..f2b39ec35c898 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_vm_helper.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_vm_helper.c
@@ -62,7 +62,7 @@ int dc_get_vmid_use_vector(struct dc *dc)
int i;
int in_use = 0;
 
-   for (i = 0; i < dc->vm_helper->num_vmid; i++)
+   for (i = 0; i < MAX_HUBP; i++)
in_use |= dc->vm_helper->hubp_vmid_usage[i].vmid_usage[0]
| dc->vm_helper->hubp_vmid_usage[i].vmid_usage[1];
return in_use;
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.6 047/149] drm/amd/display: Fix HDMI repeater authentication

2020-04-11 Thread Sasha Levin
From: Bhawanpreet Lakha 

[ Upstream commit 63a85ff6c35d8a7aaf0fb60ddbab93530d495bf3 ]

when the rxstatus split was done the index was incorrect. This
lead to HDMI repeater authentication failure for HDCP2.X So fix it

Fixes: 302169003733 ("drm/amd/display: split rxstatus for hdmi and dp")
Signed-off-by: Bhawanpreet Lakha 
Reviewed-by: Wenjing Liu 
Acked-by: Rodrigo Siqueira 
Acked-by: Harry Wentland 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/display/modules/hdcp/hdcp2_execution.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/modules/hdcp/hdcp2_execution.c 
b/drivers/gpu/drm/amd/display/modules/hdcp/hdcp2_execution.c
index 55246711700ba..6fd68326452ce 100644
--- a/drivers/gpu/drm/amd/display/modules/hdcp/hdcp2_execution.c
+++ b/drivers/gpu/drm/amd/display/modules/hdcp/hdcp2_execution.c
@@ -34,7 +34,7 @@ static inline enum mod_hdcp_status 
check_receiver_id_list_ready(struct mod_hdcp
if (is_dp_hdcp(hdcp))
is_ready = 
HDCP_2_2_DP_RXSTATUS_READY(hdcp->auth.msg.hdcp2.rxstatus_dp) ? 1 : 0;
else
-   is_ready = 
(HDCP_2_2_HDMI_RXSTATUS_READY(hdcp->auth.msg.hdcp2.rxstatus[0]) &&
+   is_ready = 
(HDCP_2_2_HDMI_RXSTATUS_READY(hdcp->auth.msg.hdcp2.rxstatus[1]) &&

(HDCP_2_2_HDMI_RXSTATUS_MSG_SZ_HI(hdcp->auth.msg.hdcp2.rxstatus[1]) << 8 |

hdcp->auth.msg.hdcp2.rxstatus[0])) ? 1 : 0;
return is_ready ? MOD_HDCP_STATUS_SUCCESS :
@@ -67,7 +67,7 @@ static inline enum mod_hdcp_status 
check_reauthentication_request(
MOD_HDCP_STATUS_HDCP2_REAUTH_REQUEST :
MOD_HDCP_STATUS_SUCCESS;
else
-   ret = 
HDCP_2_2_HDMI_RXSTATUS_REAUTH_REQ(hdcp->auth.msg.hdcp2.rxstatus[0]) ?
+   ret = 
HDCP_2_2_HDMI_RXSTATUS_REAUTH_REQ(hdcp->auth.msg.hdcp2.rxstatus[1]) ?
MOD_HDCP_STATUS_HDCP2_REAUTH_REQUEST :
MOD_HDCP_STATUS_SUCCESS;
return ret;
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.6 049/149] drm/panel: simple: fix osd070t1718_19ts sync drive edge

2020-04-11 Thread Sasha Levin
From: Tomi Valkeinen 

[ Upstream commit fb0629db6622c16da1aa76a4520daf9a46e2 ]

The panel datasheet says that the panel samples at falling edge, but
does not say anything about h/v sync signals. Testing shows that if the
sync signals are driven on falling edge, the picture on the panel will
be slightly shifted right.

Setting sync drive edge to the same as data drive edge fixes this issue.

Signed-off-by: Tomi Valkeinen 
Acked-by: Laurent Pinchart 
Signed-off-by: Sam Ravnborg 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20191114093950.4101-4-tomi.valkei...@ti.com
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/panel/panel-simple.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index e14c14ac62b53..417bbe9984606 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -2464,7 +2464,8 @@ static const struct panel_desc 
osddisplays_osd070t1718_19ts = {
.height = 91,
},
.bus_format = MEDIA_BUS_FMT_RGB888_1X24,
-   .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE,
+   .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE |
+   DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE,
.connector_type = DRM_MODE_CONNECTOR_DPI,
 };
 
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.6 074/149] drm/crc: Actually allow to change the crc source

2020-04-11 Thread Sasha Levin
From: Daniel Vetter 

[ Upstream commit 3cb6d8e5cf9811a62e27f366fd1c05f90310a8fd ]

Oops.

Fixes: 9edbf1fa600a ("drm: Add API for capturing frame CRCs")
Cc: Tomeu Vizoso 
Cc: Emil Velikov 
Cc: Benjamin Gaignard 
Signed-off-by: Daniel Vetter 
Reviewed-by: Ville Syrjälä 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20190821203835.18314-1-daniel.vet...@ffwll.ch
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/drm_debugfs_crc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_debugfs_crc.c 
b/drivers/gpu/drm/drm_debugfs_crc.c
index e22b812c4b802..5d67a41f7c3a8 100644
--- a/drivers/gpu/drm/drm_debugfs_crc.c
+++ b/drivers/gpu/drm/drm_debugfs_crc.c
@@ -372,7 +372,7 @@ void drm_debugfs_crtc_crc_add(struct drm_crtc *crtc)
 
crc_ent = debugfs_create_dir("crc", crtc->debugfs_entry);
 
-   debugfs_create_file("control", S_IRUGO, crc_ent, crtc,
+   debugfs_create_file("control", S_IRUGO | S_IWUSR, crc_ent, crtc,
_crtc_crc_control_fops);
debugfs_create_file("data", S_IRUGO, crc_ent, crtc,
_crtc_crc_data_fops);
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.6 075/149] drm/amdgpu: fix parentheses in amdgpu_vm_update_ptes

2020-04-11 Thread Sasha Levin
From: Christian König 

[ Upstream commit bfcd6c69e4c3f73f2f92b997983537f9a3ac3b29 ]

For the root PD mask can be 0x as well which would
overrun to 0 if we don't cast it before we add one.

Signed-off-by: Christian König 
Tested-by: Tom St Denis 
Reviewed-by: Felix Kuehling 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index d16231d6a790b..67e7422032265 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -1498,7 +1498,7 @@ static int amdgpu_vm_update_ptes(struct 
amdgpu_vm_update_params *params,
incr = (uint64_t)AMDGPU_GPU_PAGE_SIZE << shift;
mask = amdgpu_vm_entries_mask(adev, cursor.level);
pe_start = ((cursor.pfn >> shift) & mask) * 8;
-   entry_end = (uint64_t)(mask + 1) << shift;
+   entry_end = ((uint64_t)mask + 1) << shift;
entry_end += cursor.pfn & ~(entry_end - 1);
entry_end = min(entry_end, end);
 
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.6 046/149] drm/amd/display: Only round InfoFrame refresh rates

2020-04-11 Thread Sasha Levin
From: Aric Cyr 

[ Upstream commit 3fc6376ed6f2f67bc9fb0c7a3cf07967d6aa6216 ]

[Why]
When calculating nominal refresh rates, don't round.
Only the VSIF needs to be rounded.

[How]
Revert rounding change for nominal and just round when forming the
FreeSync VSIF.

Signed-off-by: Aric Cyr 
Reviewed-by: Anthony Koo 
Acked-by: Rodrigo Siqueira 
Acked-by: Harry Wentland 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/display/modules/freesync/freesync.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c 
b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
index b9992ebf77a62..4e542826cd269 100644
--- a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
+++ b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
@@ -524,12 +524,12 @@ static void build_vrr_infopacket_data(const struct 
mod_vrr_params *vrr,
infopacket->sb[6] |= 0x04;
 
/* PB7 = FreeSync Minimum refresh rate (Hz) */
-   infopacket->sb[7] = (unsigned char)(vrr->min_refresh_in_uhz / 100);
+   infopacket->sb[7] = (unsigned char)((vrr->min_refresh_in_uhz + 50) 
/ 100);
 
/* PB8 = FreeSync Maximum refresh rate (Hz)
 * Note: We should never go above the field rate of the mode timing set.
 */
-   infopacket->sb[8] = (unsigned char)(vrr->max_refresh_in_uhz / 100);
+   infopacket->sb[8] = (unsigned char)((vrr->max_refresh_in_uhz + 50) 
/ 100);
 
 
//FreeSync HDR
@@ -747,10 +747,6 @@ void mod_freesync_build_vrr_params(struct mod_freesync 
*mod_freesync,
nominal_field_rate_in_uhz =
mod_freesync_calc_nominal_field_rate(stream);
 
-   /* Rounded to the nearest Hz */
-   nominal_field_rate_in_uhz = 100ULL *
-   div_u64(nominal_field_rate_in_uhz + 50, 100);
-
min_refresh_in_uhz = in_config->min_refresh_in_uhz;
max_refresh_in_uhz = in_config->max_refresh_in_uhz;
 
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.6 087/149] drm/amd/display: dal_ddc_i2c_payloads_create can fail causing panic

2020-04-11 Thread Sasha Levin
From: Aric Cyr 

[ Upstream commit 6a6c4a4d459ecacc9013c45dcbf2bc9747fdbdbd ]

[Why]
Since the i2c payload allocation can fail need to check return codes

[How]
Clean up i2c payload allocations and check for errors

Signed-off-by: Aric Cyr 
Reviewed-by: Joshua Aberback 
Acked-by: Rodrigo Siqueira 
Acked-by: Harry Wentland 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 .../gpu/drm/amd/display/dc/core/dc_link_ddc.c | 52 +--
 1 file changed, 25 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c 
b/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
index a49c10d5df26b..2d0524f677c7c 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
@@ -126,22 +126,16 @@ struct aux_payloads {
struct vector payloads;
 };
 
-static struct i2c_payloads *dal_ddc_i2c_payloads_create(struct dc_context 
*ctx, uint32_t count)
+static bool dal_ddc_i2c_payloads_create(
+   struct dc_context *ctx,
+   struct i2c_payloads *payloads,
+   uint32_t count)
 {
-   struct i2c_payloads *payloads;
-
-   payloads = kzalloc(sizeof(struct i2c_payloads), GFP_KERNEL);
-
-   if (!payloads)
-   return NULL;
-
if (dal_vector_construct(
>payloads, ctx, count, sizeof(struct i2c_payload)))
-   return payloads;
-
-   kfree(payloads);
-   return NULL;
+   return true;
 
+   return false;
 }
 
 static struct i2c_payload *dal_ddc_i2c_payloads_get(struct i2c_payloads *p)
@@ -154,14 +148,12 @@ static uint32_t dal_ddc_i2c_payloads_get_count(struct 
i2c_payloads *p)
return p->payloads.count;
 }
 
-static void dal_ddc_i2c_payloads_destroy(struct i2c_payloads **p)
+static void dal_ddc_i2c_payloads_destroy(struct i2c_payloads *p)
 {
-   if (!p || !*p)
+   if (!p)
return;
-   dal_vector_destruct(&(*p)->payloads);
-   kfree(*p);
-   *p = NULL;
 
+   dal_vector_destruct(>payloads);
 }
 
 #define DDC_MIN(a, b) (((a) < (b)) ? (a) : (b))
@@ -524,9 +516,13 @@ bool dal_ddc_service_query_ddc_data(
 
uint32_t payloads_num = write_payloads + read_payloads;
 
+
if (write_size > EDID_SEGMENT_SIZE || read_size > EDID_SEGMENT_SIZE)
return false;
 
+   if (!payloads_num)
+   return false;
+
/*TODO: len of payload data for i2c and aux is uint8,
 *  but we want to read 256 over i2c*/
if (dal_ddc_service_is_in_aux_transaction_mode(ddc)) {
@@ -557,23 +553,25 @@ bool dal_ddc_service_query_ddc_data(
ret = dal_ddc_submit_aux_command(ddc, );
}
} else {
-   struct i2c_payloads *payloads =
-   dal_ddc_i2c_payloads_create(ddc->ctx, payloads_num);
+   struct i2c_command command = {0};
+   struct i2c_payloads payloads;
+
+   if (!dal_ddc_i2c_payloads_create(ddc->ctx, , 
payloads_num))
+   return false;
 
-   struct i2c_command command = {
-   .payloads = dal_ddc_i2c_payloads_get(payloads),
-   .number_of_payloads = 0,
-   .engine = DDC_I2C_COMMAND_ENGINE,
-   .speed = ddc->ctx->dc->caps.i2c_speed_in_khz };
+   command.payloads = dal_ddc_i2c_payloads_get();
+   command.number_of_payloads = 0;
+   command.engine = DDC_I2C_COMMAND_ENGINE;
+   command.speed = ddc->ctx->dc->caps.i2c_speed_in_khz;
 
dal_ddc_i2c_payloads_add(
-   payloads, address, write_size, write_buf, true);
+   , address, write_size, write_buf, true);
 
dal_ddc_i2c_payloads_add(
-   payloads, address, read_size, read_buf, false);
+   , address, read_size, read_buf, false);
 
command.number_of_payloads =
-   dal_ddc_i2c_payloads_get_count(payloads);
+   dal_ddc_i2c_payloads_get_count();
 
ret = dm_helpers_submit_i2c(
ddc->ctx,
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.6 065/149] drm/amdgpu: Fix missing error check in suspend

2020-04-11 Thread Sasha Levin
From: Rajneesh Bhardwaj 

[ Upstream commit 70bedd68e7b3a7f1d7f3198bb698fc23bc5aaa68 ]

amdgpu_device_suspend might return an error code since it can be called
from both runtime and system suspend flows. Add the missing return code
in case of a failure.

Reviewed-by: Oak Zeng 
Reviewed-by: Felix Kuehling 
Reviewed-by: Alex Deucher 
Signed-off-by: Rajneesh Bhardwaj 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 42f4febe24c6d..921e2944255b2 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -1225,6 +1225,9 @@ static int amdgpu_pmops_runtime_suspend(struct device 
*dev)
drm_kms_helper_poll_disable(drm_dev);
 
ret = amdgpu_device_suspend(drm_dev, false);
+   if (ret)
+   return ret;
+
if (amdgpu_device_supports_boco(drm_dev)) {
/* Only need to handle PCI state in the driver for ATPX
 * PCI core handles it for _PR3.
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.6 033/149] drm/amd/display: Stop if retimer is not available

2020-04-11 Thread Sasha Levin
From: Rodrigo Siqueira 

[ Upstream commit a0e40018dcc3f59a10ca21d58f8ea8ceb1b035ac ]

Raven provides retimer feature support that requires i2c interaction in
order to make it work well, all settings required for this configuration
are loaded from the Atom bios which include the i2c address. If the
retimer feature is not available, we should abort the attempt to set
this feature, otherwise, it makes the following line return
I2C_CHANNEL_OPERATION_NO_RESPONSE:

 i2c_success = i2c_write(pipe_ctx, slave_address, buffer, sizeof(buffer));
 ...
 if (!i2c_success)
   ASSERT(i2c_success);

This ends up causing problems with hotplugging HDMI displays on Raven,
and causes retimer settings to warn like so:

WARNING: CPU: 1 PID: 429 at
drivers/gpu/drm/amd/amdgpu/../dal/dc/core/dc_link.c:1998
write_i2c_retimer_setting+0xc2/0x3c0 [amdgpu] Modules linked in:
edac_mce_amd ccp kvm irqbypass binfmt_misc crct10dif_pclmul crc32_pclmul
ghash_clmulni_intel snd_hda_codec_realtek snd_hda_codec_generic
ledtrig_audio snd_hda_codec_hdmi snd_hda_intel amdgpu(+) snd_hda_codec
snd_hda_core snd_hwdep snd_pcm snd_seq_midi snd_seq_midi_event
snd_rawmidi aesni_intel snd_seq amd_iommu_v2 gpu_sched aes_x86_64
crypto_simd cryptd glue_helper snd_seq_device ttm drm_kms_helper
snd_timer eeepc_wmi wmi_bmof asus_wmi sparse_keymap drm mxm_wmi snd
k10temp fb_sys_fops syscopyarea sysfillrect sysimgblt soundcore joydev
input_leds mac_hid sch_fq_codel parport_pc ppdev lp parport ip_tables
x_tables autofs4 igb i2c_algo_bit hid_generic usbhid i2c_piix4 dca ahci
hid libahci video wmi gpio_amdpt gpio_generic CPU: 1 PID: 429 Comm:
systemd-udevd Tainted: GW 5.2.0-rc1sept162019+ #1
Hardware name: System manufacturer System Product Name/ROG STRIX B450-F
GAMING, BIOS 2605 08/06/2019
RIP: 0010:write_i2c_retimer_setting+0xc2/0x3c0 [amdgpu]
Code: ff 0f b6 4d ce 44 0f b6 45 cf 44 0f b6 c8 45 89 cf 44 89 e2 48 c7
c6 f0 34 bc c0 bf 04 00 00 00 e8 63 b0 90 ff 45 84 ff 75 02 <0f> 0b 42
0f b6 04 73 8d 50 f6 80 fa 02 77 8c 3c 0a 0f 85 c8 00 00 RSP:
0018:a99d02726fd0 EFLAGS: 00010246
RAX:  RBX: a99d02727035 RCX: 0006
RDX:  RSI: 0002 RDI: 976acc857440
RBP: a99d02727018 R08: 0002 R09: 0002a600
R10: e90610193680 R11: 05e3 R12: 005d
R13: 976ac4b201b8 R14: 0001 R15: 
FS:  7f14f99e1680() GS:976acc84() knlGS:
CS:  0010 DS:  ES:  CR0: 80050033
CR2: 7fdf212843b8 CR3: 000408906000 CR4: 003406e0
Call Trace:
 core_link_enable_stream+0x626/0x680 [amdgpu]
 dce110_apply_ctx_to_hw+0x414/0x4e0 [amdgpu]
 dc_commit_state+0x331/0x5e0 [amdgpu]
 ? drm_calc_timestamping_constants+0xf9/0x150 [drm]
 amdgpu_dm_atomic_commit_tail+0x395/0x1e00 [amdgpu]
 ? dm_plane_helper_prepare_fb+0x20c/0x280 [amdgpu]
 commit_tail+0x42/0x70 [drm_kms_helper]
 drm_atomic_helper_commit+0x10c/0x120 [drm_kms_helper]
 amdgpu_dm_atomic_commit+0x95/0xa0 [amdgpu]
 drm_atomic_commit+0x4a/0x50 [drm]
 restore_fbdev_mode_atomic+0x1c0/0x1e0 [drm_kms_helper]
 restore_fbdev_mode+0x4c/0x160 [drm_kms_helper]
 ? _cond_resched+0x19/0x40
 drm_fb_helper_restore_fbdev_mode_unlocked+0x4e/0xa0 [drm_kms_helper]
 drm_fb_helper_set_par+0x2d/0x50 [drm_kms_helper]
 fbcon_init+0x471/0x630
 visual_init+0xd5/0x130
 do_bind_con_driver+0x20a/0x430
 do_take_over_console+0x7d/0x1b0
 do_fbcon_takeover+0x5c/0xb0
 fbcon_event_notify+0x6cd/0x8a0
 notifier_call_chain+0x4c/0x70
 blocking_notifier_call_chain+0x43/0x60
 fb_notifier_call_chain+0x1b/0x20
 register_framebuffer+0x254/0x360
 __drm_fb_helper_initial_config_and_unlock+0x2c5/0x510 [drm_kms_helper]
 drm_fb_helper_initial_config+0x35/0x40 [drm_kms_helper]
 amdgpu_fbdev_init+0xcd/0x100 [amdgpu]
 amdgpu_device_init+0x1156/0x1930 [amdgpu]
 amdgpu_driver_load_kms+0x8d/0x2e0 [amdgpu]
 drm_dev_register+0x12b/0x1c0 [drm]
 amdgpu_pci_probe+0xd3/0x160 [amdgpu]
 local_pci_probe+0x47/0xa0
 pci_device_probe+0x142/0x1b0
 really_probe+0xf5/0x3d0
 driver_probe_device+0x11b/0x130
 device_driver_attach+0x58/0x60
 __driver_attach+0xa3/0x140
 ? device_driver_attach+0x60/0x60
 ? device_driver_attach+0x60/0x60
 bus_for_each_dev+0x74/0xb0
 ? kmem_cache_alloc_trace+0x1a3/0x1c0
 driver_attach+0x1e/0x20
 bus_add_driver+0x147/0x220
 ? 0xc0cb9000
 driver_register+0x60/0x100
 ? 0xc0cb9000
 __pci_register_driver+0x5a/0x60
 amdgpu_init+0x74/0x83 [amdgpu]
 do_one_initcall+0x4a/0x1fa
 ? _cond_resched+0x19/0x40
 ? kmem_cache_alloc_trace+0x3f/0x1c0
 ? __vunmap+0x1cc/0x200
 do_init_module+0x5f/0x227
 load_module+0x2330/0x2b40
 __do_sys_finit_module+0xfc/0x120
 ? __do_sys_finit_module+0xfc/0x120
 __x64_sys_finit_module+0x1a/0x20
 do_syscall_64+0x5a/0x130
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x7f14f9500839
Code: 00 f3 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89
f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01
f0 ff ff 73 01 c3 48 8b 0d 1f 

[PATCH AUTOSEL 5.6 072/149] drm/stm: ltdc: check crtc state before enabling LIE

2020-04-11 Thread Sasha Levin
From: Yannick Fertre 

[ Upstream commit a6bd58c51ac43083f3977057a7ad668def55812f ]

Following investigations of a hardware bug, the LIE interrupt
can occur while the display controller is not activated.
LIE interrupt (vblank) don't have to be set if the CRTC is not
enabled.

Signed-off-by: Yannick Fertre 
Acked-by: Philippe Cornu 
Signed-off-by: Benjamin Gaignard 
Link: 
https://patchwork.freedesktop.org/patch/msgid/1579601650-7055-1-git-send-email-yannick.fer...@st.com
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/stm/ltdc.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index c2815e8ae1da2..ea654c7280f7e 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -648,9 +648,14 @@ static const struct drm_crtc_helper_funcs 
ltdc_crtc_helper_funcs = {
 static int ltdc_crtc_enable_vblank(struct drm_crtc *crtc)
 {
struct ltdc_device *ldev = crtc_to_ltdc(crtc);
+   struct drm_crtc_state *state = crtc->state;
 
DRM_DEBUG_DRIVER("\n");
-   reg_set(ldev->regs, LTDC_IER, IER_LIE);
+
+   if (state->enable)
+   reg_set(ldev->regs, LTDC_IER, IER_LIE);
+   else
+   return -EPERM;
 
return 0;
 }
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.6 036/149] drm/amd/display: writing stereo polarity register if swapped

2020-04-11 Thread Sasha Levin
From: Martin Leung 

[ Upstream commit e592e85f3378246dd66b861fa60ef803d8cece6b ]

[why]
on some displays that prefer swapped polarity we were seeing L/R images
swapped because OTG_STEREO_SYNC_OUTPUT_POLARITY would always be mapped
to 0

[how]
fix initial dal3 implementation to properly update the polarity field
according to the crtc_stereo_flags (same as
OTG_STEREO_EYE_FLAG_POLARITY)

Signed-off-by: Martin Leung 
Reviewed-by: Aric Cyr 
Acked-by: Rodrigo Siqueira 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c 
b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c
index a9a43b397db99..f39c94d68fb25 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c
@@ -1195,7 +1195,7 @@ static void optc1_enable_stereo(struct timing_generator 
*optc,
REG_UPDATE_3(OTG_STEREO_CONTROL,
OTG_STEREO_EN, stereo_en,
OTG_STEREO_SYNC_OUTPUT_LINE_NUM, 0,
-   OTG_STEREO_SYNC_OUTPUT_POLARITY, 0);
+   OTG_STEREO_SYNC_OUTPUT_POLARITY, 
flags->RIGHT_EYE_POLARITY == 0 ? 0 : 1);
 
if (flags->PROGRAM_POLARITY)
REG_UPDATE(OTG_STEREO_CONTROL,
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.6 068/149] drm/amd/display: always apply T7/T9 delay logic

2020-04-11 Thread Sasha Levin
From: Martin Leung 

[ Upstream commit cb8348fec250e517b5facb4cab3125ddc597f9aa ]

[why]
before we exit early in edp_reciever_ready if we detect that panel
is not edp or below rev 1.2. This will skip the backlight/t7 delay panel
patch.

[how]
edit logic to ensure panel patch is applied regardless of edp rev.

Signed-off-by: Martin Leung 
Reviewed-by: Anthony Koo 
Acked-by: Rodrigo Siqueira 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 .../drm/amd/display/dc/core/dc_link_hwss.c| 56 ++-
 1 file changed, 29 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c 
b/drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c
index ddb8550457672..58634f191a55d 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c
@@ -153,18 +153,19 @@ bool edp_receiver_ready_T9(struct dc_link *link)
unsigned char edpRev = 0;
enum dc_status result = DC_OK;
result = core_link_read_dpcd(link, DP_EDP_DPCD_REV, , 
sizeof(edpRev));
-   if (edpRev < DP_EDP_12)
-   return true;
-   /* start from eDP version 1.2, SINK_STAUS indicate the sink is ready.*/
-   do {
-   sinkstatus = 1;
-   result = core_link_read_dpcd(link, DP_SINK_STATUS, , 
sizeof(sinkstatus));
-   if (sinkstatus == 0)
-   break;
-   if (result != DC_OK)
-   break;
-   udelay(100); //MAx T9
-   } while (++tries < 50);
+
+ /* start from eDP version 1.2, SINK_STAUS indicate the sink is ready.*/
+   if (result == DC_OK && edpRev >= DP_EDP_12) {
+   do {
+   sinkstatus = 1;
+   result = core_link_read_dpcd(link, DP_SINK_STATUS, 
, sizeof(sinkstatus));
+   if (sinkstatus == 0)
+   break;
+   if (result != DC_OK)
+   break;
+   udelay(100); //MAx T9
+   } while (++tries < 50);
+   }
 
if (link->local_sink->edid_caps.panel_patch.extra_delay_backlight_off > 
0)

udelay(link->local_sink->edid_caps.panel_patch.extra_delay_backlight_off * 
1000);
@@ -183,21 +184,22 @@ bool edp_receiver_ready_T7(struct dc_link *link)
unsigned long long time_taken_in_ns = 0;
 
result = core_link_read_dpcd(link, DP_EDP_DPCD_REV, , 
sizeof(edpRev));
-   if (result == DC_OK && edpRev < DP_EDP_12)
-   return true;
-   /* start from eDP version 1.2, SINK_STAUS indicate the sink is ready.*/
-   enter_timestamp = dm_get_timestamp(link->ctx);
-   do {
-   sinkstatus = 0;
-   result = core_link_read_dpcd(link, DP_SINK_STATUS, , 
sizeof(sinkstatus));
-   if (sinkstatus == 1)
-   break;
-   if (result != DC_OK)
-   break;
-   udelay(25);
-   finish_timestamp = dm_get_timestamp(link->ctx);
-   time_taken_in_ns = dm_get_elapse_time_in_ns(link->ctx, 
finish_timestamp, enter_timestamp);
-   } while (time_taken_in_ns < 50 * 100); //MAx T7 is 50ms
+
+   if (result == DC_OK && edpRev >= DP_EDP_12) {
+   /* start from eDP version 1.2, SINK_STAUS indicate the sink is 
ready.*/
+   enter_timestamp = dm_get_timestamp(link->ctx);
+   do {
+   sinkstatus = 0;
+   result = core_link_read_dpcd(link, DP_SINK_STATUS, 
, sizeof(sinkstatus));
+   if (sinkstatus == 1)
+   break;
+   if (result != DC_OK)
+   break;
+   udelay(25);
+   finish_timestamp = dm_get_timestamp(link->ctx);
+   time_taken_in_ns = dm_get_elapse_time_in_ns(link->ctx, 
finish_timestamp, enter_timestamp);
+   } while (time_taken_in_ns < 50 * 100); //MAx T7 is 50ms
+   }
 
if (link->local_sink->edid_caps.panel_patch.extra_t7_ms > 0)
udelay(link->local_sink->edid_caps.panel_patch.extra_t7_ms * 
1000);
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.6 059/149] drm/sun4i: dsi: Use NULL to signify "no panel"

2020-04-11 Thread Sasha Levin
From: Samuel Holland 

[ Upstream commit 0e4e3fb4901d19f49e5c0a582f383b10dda8d1c5 ]

The continued use of an ERR_PTR to signify "no panel" outside of
sun6i_dsi_attach is confusing because it is a double negative. Because
the connector always reports itself as connected, there is also the
possibility of sending an ERR_PTR to drm_panel_get_modes(), which would
crash.

Solve both of these by only storing the panel pointer if it is valid.

Fixes: 133add5b5ad4 ("drm/sun4i: Add Allwinner A31 MIPI-DSI controller support")
Signed-off-by: Samuel Holland 
Signed-off-by: Maxime Ripard 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20200211072858.30784-2-sam...@sholland.org
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c 
b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
index a75fcb1131724..9bd3c97ff3e68 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -749,7 +749,7 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder 
*encoder)
phy_configure(dsi->dphy, );
phy_power_on(dsi->dphy);
 
-   if (!IS_ERR(dsi->panel))
+   if (dsi->panel)
drm_panel_prepare(dsi->panel);
 
/*
@@ -764,7 +764,7 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder 
*encoder)
 * ordering on the panels I've tested it with, so I guess this
 * will do for now, until that IP is better understood.
 */
-   if (!IS_ERR(dsi->panel))
+   if (dsi->panel)
drm_panel_enable(dsi->panel);
 
sun6i_dsi_start(dsi, DSI_START_HSC);
@@ -780,7 +780,7 @@ static void sun6i_dsi_encoder_disable(struct drm_encoder 
*encoder)
 
DRM_DEBUG_DRIVER("Disabling DSI output\n");
 
-   if (!IS_ERR(dsi->panel)) {
+   if (dsi->panel) {
drm_panel_disable(dsi->panel);
drm_panel_unprepare(dsi->panel);
}
@@ -942,11 +942,13 @@ static int sun6i_dsi_attach(struct mipi_dsi_host *host,
struct mipi_dsi_device *device)
 {
struct sun6i_dsi *dsi = host_to_sun6i_dsi(host);
+   struct drm_panel *panel = of_drm_find_panel(device->dev.of_node);
 
+   if (IS_ERR(panel))
+   return PTR_ERR(panel);
+
+   dsi->panel = panel;
dsi->device = device;
-   dsi->panel = of_drm_find_panel(device->dev.of_node);
-   if (IS_ERR(dsi->panel))
-   return PTR_ERR(dsi->panel);
 
dev_info(host->dev, "Attached device %s\n", device->name);
 
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.6 069/149] drm/omap: fix possible object reference leak

2020-04-11 Thread Sasha Levin
From: Wen Yang 

[ Upstream commit 47340e46f34a3b1d80e40b43ae3d7a8da34a3541 ]

The call to of_find_matching_node returns a node pointer with refcount
incremented thus it must be explicitly decremented after the last
usage.

Detected by coccinelle with the following warnings:
drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c:212:2-8: ERROR: missing 
of_node_put; acquired a node pointer with refcount incremented on line 209, but 
without a corresponding object release within this function.
drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c:237:1-7: ERROR: missing 
of_node_put; acquired a node pointer with refcount incremented on line 209, but 
without a corresponding object release within this function.

Signed-off-by: Wen Yang 
Reviewed-by: Laurent Pinchart 
Reviewed-by: Mukesh Ojha 
Cc: Tomi Valkeinen 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Sebastian Reichel 
Cc: Laurent Pinchart 
Cc: dri-devel@lists.freedesktop.org
Cc: linux-ker...@vger.kernel.org
Cc: Markus Elfring 
Signed-off-by: Tomi Valkeinen 
Link: 
https://patchwork.freedesktop.org/patch/msgid/1554692313-28882-2-git-send-email-wen.yan...@zte.com.cn
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c 
b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
index 31502857f013d..ce67891eedd46 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
@@ -192,7 +192,7 @@ static int __init omapdss_boot_init(void)
dss = of_find_matching_node(NULL, omapdss_of_match);
 
if (dss == NULL || !of_device_is_available(dss))
-   return 0;
+   goto put_node;
 
omapdss_walk_device(dss, true);
 
@@ -217,6 +217,8 @@ static int __init omapdss_boot_init(void)
kfree(n);
}
 
+put_node:
+   of_node_put(dss);
return 0;
 }
 
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.6 073/149] fbdev: potential information leak in do_fb_ioctl()

2020-04-11 Thread Sasha Levin
From: Dan Carpenter 

[ Upstream commit d3d19d6fc5736a798b118971935ce274f7deaa82 ]

The "fix" struct has a 2 byte hole after ->ywrapstep and the
"fix = info->fix;" assignment doesn't necessarily clear it.  It depends
on the compiler.  The solution is just to replace the assignment with an
memcpy().

Fixes: 1f5e31d7e55a ("fbmem: don't call copy_from/to_user() with mutex held")
Signed-off-by: Dan Carpenter 
Cc: Andrew Morton 
Cc: Arnd Bergmann 
Cc: "Eric W. Biederman" 
Cc: Andrea Righi 
Cc: Daniel Vetter 
Cc: Sam Ravnborg 
Cc: Maarten Lankhorst 
Cc: Daniel Thompson 
Cc: Peter Rosin 
Cc: Jani Nikula 
Cc: Gerd Hoffmann 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20200113100132.ixpaymordi24n3av@kili.mountain
Signed-off-by: Sasha Levin 
---
 drivers/video/fbdev/core/fbmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index d04554959ea7e..bb8d8dbc0461c 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -1115,7 +1115,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned 
int cmd,
break;
case FBIOGET_FSCREENINFO:
lock_fb_info(info);
-   fix = info->fix;
+   memcpy(, >fix, sizeof(fix));
if (info->flags & FBINFO_HIDE_SMEM_START)
fix.smem_start = 0;
unlock_fb_info(info);
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.6 031/149] drm/tegra: dc: Release PM and RGB output when client's registration fails

2020-04-11 Thread Sasha Levin
From: Dmitry Osipenko 

[ Upstream commit 0411ea89a689531e1829fdf8af3747646c02c721 ]

Runtime PM and RGB output need to be released when host1x client
registration fails. The releasing is missed in the code, let's correct it.

Signed-off-by: Dmitry Osipenko 
Signed-off-by: Thierry Reding 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/tegra/dc.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
index 7c70fd31a4c24..870f9a68ad2c5 100644
--- a/drivers/gpu/drm/tegra/dc.c
+++ b/drivers/gpu/drm/tegra/dc.c
@@ -2588,10 +2588,16 @@ static int tegra_dc_probe(struct platform_device *pdev)
if (err < 0) {
dev_err(>dev, "failed to register host1x client: %d\n",
err);
-   return err;
+   goto disable_pm;
}
 
return 0;
+
+disable_pm:
+   pm_runtime_disable(>dev);
+   tegra_dc_rgb_remove(dc);
+
+   return err;
 }
 
 static int tegra_dc_remove(struct platform_device *pdev)
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.6 039/149] drm/amd/display: Fix default logger mask definition

2020-04-11 Thread Sasha Levin
From: Eric Bernstein 

[ Upstream commit ccb6af1e25830e5601b6beacc698390f0245316f ]

[Why]
Logger mask was updated to uint64_t, however default mask definition was
not updated for unsigned long long

[How]
Update DC_DEFAULT_LOG_MASK to support uint64_t type

Signed-off-by: Eric Bernstein 
Reviewed-by: Dmytro Laktyushkin 
Acked-by: Rodrigo Siqueira 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 .../drm/amd/display/include/logger_types.h| 63 ++-
 1 file changed, 32 insertions(+), 31 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/include/logger_types.h 
b/drivers/gpu/drm/amd/display/include/logger_types.h
index 89a7092670193..d66f9d8eefb49 100644
--- a/drivers/gpu/drm/amd/display/include/logger_types.h
+++ b/drivers/gpu/drm/amd/display/include/logger_types.h
@@ -124,36 +124,37 @@ enum dc_log_type {
 #define DC_MIN_LOG_MASK ((1 << LOG_ERROR) | \
(1 << LOG_DETECTION_EDID_PARSER))
 
-#define DC_DEFAULT_LOG_MASK ((1 << LOG_ERROR) | \
-   (1 << LOG_WARNING) | \
-   (1 << LOG_EVENT_MODE_SET) | \
-   (1 << LOG_EVENT_DETECTION) | \
-   (1 << LOG_EVENT_LINK_TRAINING) | \
-   (1 << LOG_EVENT_LINK_LOSS) | \
-   (1 << LOG_EVENT_UNDERFLOW) | \
-   (1 << LOG_RESOURCE) | \
-   (1 << LOG_FEATURE_OVERRIDE) | \
-   (1 << LOG_DETECTION_EDID_PARSER) | \
-   (1 << LOG_DC) | \
-   (1 << LOG_HW_HOTPLUG) | \
-   (1 << LOG_HW_SET_MODE) | \
-   (1 << LOG_HW_RESUME_S3) | \
-   (1 << LOG_HW_HPD_IRQ) | \
-   (1 << LOG_SYNC) | \
-   (1 << LOG_BANDWIDTH_VALIDATION) | \
-   (1 << LOG_MST) | \
-   (1 << LOG_DETECTION_DP_CAPS) | \
-   (1 << LOG_BACKLIGHT)) | \
-   (1 << LOG_I2C_AUX) | \
-   (1 << LOG_IF_TRACE) | \
-   (1 << LOG_DTN) /* | \
-   (1 << LOG_DEBUG) | \
-   (1 << LOG_BIOS) | \
-   (1 << LOG_SURFACE) | \
-   (1 << LOG_SCALER) | \
-   (1 << LOG_DML) | \
-   (1 << LOG_HW_LINK_TRAINING) | \
-   (1 << LOG_HW_AUDIO)| \
-   (1 << LOG_BANDWIDTH_CALCS)*/
+#define DC_DEFAULT_LOG_MASK ((1ULL << LOG_ERROR) | \
+   (1ULL << LOG_WARNING) | \
+   (1ULL << LOG_EVENT_MODE_SET) | \
+   (1ULL << LOG_EVENT_DETECTION) | \
+   (1ULL << LOG_EVENT_LINK_TRAINING) | \
+   (1ULL << LOG_EVENT_LINK_LOSS) | \
+   (1ULL << LOG_EVENT_UNDERFLOW) | \
+   (1ULL << LOG_RESOURCE) | \
+   (1ULL << LOG_FEATURE_OVERRIDE) | \
+   (1ULL << LOG_DETECTION_EDID_PARSER) | \
+   (1ULL << LOG_DC) | \
+   (1ULL << LOG_HW_HOTPLUG) | \
+   (1ULL << LOG_HW_SET_MODE) | \
+   (1ULL << LOG_HW_RESUME_S3) | \
+   (1ULL << LOG_HW_HPD_IRQ) | \
+   (1ULL << LOG_SYNC) | \
+   (1ULL << LOG_BANDWIDTH_VALIDATION) | \
+   (1ULL << LOG_MST) | \
+   (1ULL << LOG_DETECTION_DP_CAPS) | \
+   (1ULL << LOG_BACKLIGHT)) | \
+   (1ULL << LOG_I2C_AUX) | \
+   (1ULL << LOG_IF_TRACE) | \
+   (1ULL << LOG_HDMI_FRL) | \
+   (1ULL << LOG_DTN) /* | \
+   (1ULL << LOG_DEBUG) | \
+   (1ULL << LOG_BIOS) | \
+   (1ULL << LOG_SURFACE) | \
+   (1ULL << LOG_SCALER) | \
+   (1ULL << LOG_DML) | \
+   (1ULL << LOG_HW_LINK_TRAINING) | \
+   (1ULL << LOG_HW_AUDIO)| \
+   (1ULL << LOG_BANDWIDTH_CALCS)*/
 
 #endif /* __DAL_LOGGER_TYPES_H__ */
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.6 015/149] drm/amd/display: Explicitly disable triplebuffer flips

2020-04-11 Thread Sasha Levin
From: Nicholas Kazlauskas 

[ Upstream commit 2d673560b7b83f8fe4163610f35c51b4d095525c ]

[Why]
This is enabled by default on Renoir but there's userspace/API support
to actually make use of this.

Since we're not passing this down through surface updates, let's
explicitly disable this for now.

This fixes "dcn20_program_front_end_for_ctx" warnings associated with
incorrect/unexpected programming sequences performed while this is
enabled.

[How]
Disable it at the topmost level in DM in case anyone tries to flip this
to enabled for any of the other ASICs like Navi10/14.

Signed-off-by: Nicholas Kazlauskas 
Reviewed-by: Hersen Wu 
Acked-by: Rodrigo Siqueira 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index b9853fd724d60..f2850f5b0808c 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -2909,6 +2909,9 @@ static int amdgpu_dm_initialize_drm_device(struct 
amdgpu_device *adev)
if (adev->asic_type != CHIP_CARRIZO && adev->asic_type != CHIP_STONEY)
dm->dc->debug.disable_stutter = amdgpu_pp_feature_mask & 
PP_STUTTER_MODE ? false : true;
 
+   /* No userspace support. */
+   dm->dc->debug.disable_tri_buf = true;
+
return 0;
 fail:
kfree(aencoder);
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.6 023/149] drm/amdgpu: check GFX RAS capability before reset counters

2020-04-11 Thread Sasha Levin
From: Hawking Zhang 

[ Upstream commit 06dcd7eb83ee65382305ce48686e3dadaad42088 ]

disallow the logical to be enabled on platforms that
don't support gfx ras at this stage, like sriov skus,
dgpu with legacy ras.etc

Signed-off-by: Hawking Zhang 
Reviewed-by: Monk Liu 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 3 +++
 drivers/gpu/drm/amd/amdgpu/gfx_v9_4.c | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
index 889154a78c4a8..beba9c596c493 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
@@ -6326,6 +6326,9 @@ static void gfx_v9_0_clear_ras_edc_counter(struct 
amdgpu_device *adev)
 {
int i, j, k;
 
+   if (!amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__GFX))
+   return;
+
/* read back registers to clear the counters */
mutex_lock(>grbm_idx_mutex);
for (i = 0; i < ARRAY_SIZE(gfx_v9_0_edc_counter_regs); i++) {
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4.c
index f099f13d7f1e9..9955532345ec0 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4.c
@@ -897,6 +897,9 @@ void gfx_v9_4_clear_ras_edc_counter(struct amdgpu_device 
*adev)
 {
int i, j, k;
 
+   if (!amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__GFX))
+   return;
+
mutex_lock(>grbm_idx_mutex);
for (i = 0; i < ARRAY_SIZE(gfx_v9_4_edc_counter_regs); i++) {
for (j = 0; j < gfx_v9_4_edc_counter_regs[i].se_num; j++) {
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH AUTOSEL 5.6 010/149] drm/amd/display: differentiate vsc sdp colorimetry use criteria between MST and SST

2020-04-11 Thread Sasha Levin
From: Martin Tsai 

[ Upstream commit c38cc6770fd5f78a0918ed0b01af14de31aba5cb ]

[Why]
We should check MST BU support capability on output port before building
vsc info packet.

[How]
Add a new definition for port and sink capability check.

Signed-off-by: Martin Tsai 
Reviewed-by: Wenjing Liu 
Acked-by: Rodrigo Siqueira 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 19 +++---
 drivers/gpu/drm/amd/display/dc/dc.h   |  2 ++
 .../amd/display/modules/inc/mod_info_packet.h |  3 +--
 .../display/modules/info_packet/info_packet.c | 20 +++
 4 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 6240259b3a937..b9853fd724d60 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -4200,9 +4200,22 @@ create_stream_for_sink(struct amdgpu_dm_connector 
*aconnector,
struct dmcu *dmcu = core_dc->res_pool->dmcu;
 
stream->psr_version = dmcu->dmcu_version.psr_version;
-   mod_build_vsc_infopacket(stream,
-   >vsc_infopacket,
-   >use_vsc_sdp_for_colorimetry);
+
+   //
+   // should decide stream support vsc sdp colorimetry 
capability
+   // before building vsc info packet
+   //
+   stream->use_vsc_sdp_for_colorimetry = false;
+   if (aconnector->dc_sink->sink_signal == 
SIGNAL_TYPE_DISPLAY_PORT_MST) {
+   stream->use_vsc_sdp_for_colorimetry =
+   
aconnector->dc_sink->is_vsc_sdp_colorimetry_supported;
+   } else {
+   if (stream->link->dpcd_caps.dpcd_rev.raw >= 
0x14 &&
+   
stream->link->dpcd_caps.dprx_feature.bits.VSC_SDP_COLORIMETRY_SUPPORTED) {
+   stream->use_vsc_sdp_for_colorimetry = 
true;
+   }
+   }
+   mod_build_vsc_infopacket(stream, 
>vsc_infopacket);
}
}
 finish:
diff --git a/drivers/gpu/drm/amd/display/dc/dc.h 
b/drivers/gpu/drm/amd/display/dc/dc.h
index 8ff25b5dd2f6d..4afe33c6aeb5b 100644
--- a/drivers/gpu/drm/amd/display/dc/dc.h
+++ b/drivers/gpu/drm/amd/display/dc/dc.h
@@ -1019,6 +1019,8 @@ struct dc_sink {
 
struct dc_sink_dsc_caps sink_dsc_caps;
 
+   bool is_vsc_sdp_colorimetry_supported;
+
/* private to DC core */
struct dc_link *link;
struct dc_context *ctx;
diff --git a/drivers/gpu/drm/amd/display/modules/inc/mod_info_packet.h 
b/drivers/gpu/drm/amd/display/modules/inc/mod_info_packet.h
index 42cbeffac6402..13c57ff2abdce 100644
--- a/drivers/gpu/drm/amd/display/modules/inc/mod_info_packet.h
+++ b/drivers/gpu/drm/amd/display/modules/inc/mod_info_packet.h
@@ -34,8 +34,7 @@ struct dc_info_packet;
 struct mod_vrr_params;
 
 void mod_build_vsc_infopacket(const struct dc_stream_state *stream,
-   struct dc_info_packet *info_packet,
-   bool *use_vsc_sdp_for_colorimetry);
+   struct dc_info_packet *info_packet);
 
 void mod_build_hf_vsif_infopacket(const struct dc_stream_state *stream,
struct dc_info_packet *info_packet, int ALLMEnabled, int 
ALLMValue);
diff --git a/drivers/gpu/drm/amd/display/modules/info_packet/info_packet.c 
b/drivers/gpu/drm/amd/display/modules/info_packet/info_packet.c
index 6a8a056424b85..cff3ab15fc0cc 100644
--- a/drivers/gpu/drm/amd/display/modules/info_packet/info_packet.c
+++ b/drivers/gpu/drm/amd/display/modules/info_packet/info_packet.c
@@ -130,8 +130,7 @@ enum ColorimetryYCCDP {
 };
 
 void mod_build_vsc_infopacket(const struct dc_stream_state *stream,
-   struct dc_info_packet *info_packet,
-   bool *use_vsc_sdp_for_colorimetry)
+   struct dc_info_packet *info_packet)
 {
unsigned int vsc_packet_revision = vsc_packet_undefined;
unsigned int i;
@@ -139,11 +138,6 @@ void mod_build_vsc_infopacket(const struct dc_stream_state 
*stream,
unsigned int colorimetryFormat = 0;
bool stereo3dSupport = false;
 
-   /* Initialize first, later if infopacket is valid determine if VSC SDP
-* should be used to signal colorimetry format and pixel encoding.
-*/
-   *use_vsc_sdp_for_colorimetry = false;
-
if (stream->timing.timing_3d_format != TIMING_3D_FORMAT_NONE && 
stream->view_format != VIEW_3D_FORMAT_NONE) {
vsc_packet_revision = vsc_packet_rev1;
stereo3dSupport = true;
@@ -153,9 +147,8 @@ void mod_build_vsc_infopacket(const struct dc_stream_state 
*stream,

[PATCH AUTOSEL 5.6 016/149] drm/amd/display: Fix test pattern color space inconsistency for Linux

2020-04-11 Thread Sasha Levin
From: "Jerry (Fangzhi) Zuo" 

[ Upstream commit ef65c702d40637ed9ee25edc8e8a994168a32377 ]

[why]
When reprogram MSA with updated color space, the test color space shows
inconsistency. Linux has separate routine to set up test pattern color
space, but it fails to configure RGB.

[How]
Add RGB to test pattern.

Fixes: 43563bc2e6a769 ("drm/amd/display: update MSA and VSC SDP on video test 
pattern request")
Signed-off-by: Jerry (Fangzhi) Zuo 
Reviewed-by: Hersen Wu 
Acked-by: Rodrigo Siqueira 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c 
b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
index fd9e69634c50a..f01bc378a51ee 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
@@ -2654,9 +2654,12 @@ static void dp_test_send_link_test_pattern(struct 
dc_link *link)
break;
}
 
-   test_pattern_color_space = dpcd_test_params.bits.YCBCR_COEFS ?
-   DP_TEST_PATTERN_COLOR_SPACE_YCBCR709 :
-   DP_TEST_PATTERN_COLOR_SPACE_YCBCR601;
+   if (dpcd_test_params.bits.CLR_FORMAT == 0)
+   test_pattern_color_space = DP_TEST_PATTERN_COLOR_SPACE_RGB;
+   else
+   test_pattern_color_space = dpcd_test_params.bits.YCBCR_COEFS ?
+   DP_TEST_PATTERN_COLOR_SPACE_YCBCR709 :
+   DP_TEST_PATTERN_COLOR_SPACE_YCBCR601;
 
dc_link_dp_set_test_pattern(
link,
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2] component: Silence bind error on -EPROBE_DEFER

2020-04-11 Thread James Hilliard
If a component fails to bind due to -EPROBE_DEFER we should not log an
error as this is not a real failure.

Fixes:
vc4-drm soc:gpu: failed to bind 3f902000.hdmi (ops vc4_hdmi_ops): -517
vc4-drm soc:gpu: master bind failed: -517

Signed-off-by: James Hilliard 
---
Changes v1 -> v2:
  - remove braces
---
 drivers/base/component.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/base/component.c b/drivers/base/component.c
index e97704104784..dcfbe7251dc4 100644
--- a/drivers/base/component.c
+++ b/drivers/base/component.c
@@ -256,7 +256,8 @@ static int try_to_bring_up_master(struct master *master,
ret = master->ops->bind(master->dev);
if (ret < 0) {
devres_release_group(master->dev, NULL);
-   dev_info(master->dev, "master bind failed: %d\n", ret);
+   if (ret != -EPROBE_DEFER)
+   dev_info(master->dev, "master bind failed: %d\n", ret);
return ret;
}
 
@@ -611,8 +612,9 @@ static int component_bind(struct component *component, 
struct master *master,
devres_release_group(component->dev, NULL);
devres_release_group(master->dev, NULL);
 
-   dev_err(master->dev, "failed to bind %s (ops %ps): %d\n",
-   dev_name(component->dev), component->ops, ret);
+   if (ret != -EPROBE_DEFER)
+   dev_err(master->dev, "failed to bind %s (ops %ps): 
%d\n",
+   dev_name(component->dev), component->ops, ret);
}
 
return ret;
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 207199] New: VC4: debugfs error message

2020-04-11 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=207199

Bug ID: 207199
   Summary: VC4: debugfs error message
   Product: Drivers
   Version: 2.5
Kernel Version: 5.4.23
  Hardware: ARM
OS: Linux
  Tree: Mainline
Status: NEW
  Severity: normal
  Priority: P1
 Component: Video(DRI - non Intel)
  Assignee: drivers_video-...@kernel-bugs.osdl.org
  Reporter: mela...@trash-mail.com
Regression: No

On my Raspberry Pi 1B+ device, the following error message (which seems to be
caused by the CONFIG_DRM_VC4 kernel driver) is logged during boot:

=> debugfs: Directory '20902000.hdmi' with parent 'vc4-hdmi' already present!

-- 
You are receiving this mail because:
You are watching the assignee of the bug.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 206575] [amdgpu] [drm] No video signal on resume from suspend, R9 380

2020-04-11 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=206575

--- Comment #21 from Noel Maersk (veox+ker...@veox.pw) ---
Created attachment 288351
  --> https://bugzilla.kernel.org/attachment.cgi?id=288351=edit
git bisect log to find the culprit

Attaching original git bisect log (was posted to github previously).

-- 
You are receiving this mail because:
You are watching the assignee of the bug.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 206575] [amdgpu] [drm] No video signal on resume from suspend, R9 380

2020-04-11 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=206575

--- Comment #20 from Noel Maersk (veox+ker...@veox.pw) ---
I'll do a bisect to identify the fix. Roughly 15 steps.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


RE: [PATCH 20/28] mm: remove the pgprot argument to __vmalloc

2020-04-11 Thread Michael Kelley
From: Christoph Hellwig  Sent: Wednesday, April 8, 2020 4:59 AM
> 
> The pgprot argument to __vmalloc is always PROT_KERNEL now, so remove
> it.
> 
> Signed-off-by: Christoph Hellwig 
> ---
>  arch/x86/hyperv/hv_init.c  |  3 +--
>  arch/x86/include/asm/kvm_host.h|  3 +--
>  arch/x86/kvm/svm.c |  3 +--
>  drivers/block/drbd/drbd_bitmap.c   |  4 +---
>  drivers/gpu/drm/etnaviv/etnaviv_dump.c |  4 ++--
>  drivers/lightnvm/pblk-init.c   |  5 ++---
>  drivers/md/dm-bufio.c  |  4 ++--
>  drivers/mtd/ubi/io.c   |  4 ++--
>  drivers/scsi/sd_zbc.c  |  3 +--
>  fs/gfs2/dir.c  |  9 -
>  fs/gfs2/quota.c|  2 +-
>  fs/nfs/blocklayout/extent_tree.c   |  2 +-
>  fs/ntfs/malloc.h   |  2 +-
>  fs/ubifs/debug.c   |  2 +-
>  fs/ubifs/lprops.c  |  2 +-
>  fs/ubifs/lpt_commit.c  |  4 ++--
>  fs/ubifs/orphan.c  |  2 +-
>  fs/xfs/kmem.c  |  2 +-
>  include/linux/vmalloc.h|  2 +-
>  kernel/bpf/core.c  |  6 +++---
>  kernel/groups.c|  2 +-
>  kernel/module.c|  3 +--
>  mm/nommu.c | 15 +++
>  mm/page_alloc.c|  2 +-
>  mm/percpu.c|  2 +-
>  mm/vmalloc.c   |  4 ++--
>  net/bridge/netfilter/ebtables.c|  6 ++
>  sound/core/memalloc.c  |  2 +-
>  sound/core/pcm_memory.c|  2 +-
>  29 files changed, 47 insertions(+), 59 deletions(-)
> 

For Hyper-V changes,

Reviewed-by: Michael Kelley 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


RE: [PATCH 01/28] x86/hyperv: use vmalloc_exec for the hypercall page

2020-04-11 Thread Michael Kelley
From: Christoph Hellwig  Sent: Wednesday, April 8, 2020 4:59 AM
> 
> Use the designated helper for allocating executable kernel memory, and
> remove the now unused PAGE_KERNEL_RX define.
> 
> Signed-off-by: Christoph Hellwig 
> ---
>  arch/x86/hyperv/hv_init.c| 2 +-
>  arch/x86/include/asm/pgtable_types.h | 2 --
>  2 files changed, 1 insertion(+), 3 deletions(-)
> 

Reviewed-by: Michael Kelley 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2] drm/i915: Fix ref->mutex deadlock in i915_active_wait()

2020-04-11 Thread Sultan Alsawaf
On Fri, Apr 10, 2020 at 11:08:38AM +0200, Greg KH wrote:
> On Tue, Apr 07, 2020 at 12:18:09AM -0700, Sultan Alsawaf wrote:
> > From: Sultan Alsawaf 
> > 
> > The following deadlock exists in i915_active_wait() due to a double lock
> > on ref->mutex (call chain listed in order from top to bottom):
> >  i915_active_wait();
> >  mutex_lock_interruptible(>mutex); <-- ref->mutex first acquired
> >  i915_active_request_retire();
> >  node_retire();
> >  active_retire();
> >  mutex_lock_nested(>mutex, SINGLE_DEPTH_NESTING); <-- DEADLOCK
> > 
> > Fix the deadlock by skipping the second ref->mutex lock when
> > active_retire() is called through i915_active_request_retire().
> > 
> > Note that this bug only affects 5.4 and has since been fixed in 5.5.
> > Normally, a backport of the fix from 5.5 would be in order, but the
> > patch set that fixes this deadlock involves massive changes that are
> > neither feasible nor desirable for backporting [1][2][3]. Therefore,
> > this small patch was made to address the deadlock specifically for 5.4.
> > 
> > [1] 274cbf20fd10 ("drm/i915: Push the i915_active.retire into a worker")
> > [2] 093b92287363 ("drm/i915: Split i915_active.mutex into an irq-safe 
> > spinlock for the rbtree")
> > [3] 750bde2fd4ff ("drm/i915: Serialise with remote retirement")
> > 
> > Fixes: 12c255b5dad1 ("drm/i915: Provide an i915_active.acquire callback")
> > Cc:  # 5.4.x
> > Signed-off-by: Sultan Alsawaf 
> > ---
> >  drivers/gpu/drm/i915/i915_active.c | 27 +++
> >  drivers/gpu/drm/i915/i915_active.h |  4 ++--
> >  2 files changed, 25 insertions(+), 6 deletions(-)
> 
> Now queued up, thanks.
> 
> greg k-h

Hi Greg,

Thanks for queuing this! However, you queued the v1 version of the patch instead
of v2. Please pick the v2 version instead.

Thanks,
Sultan
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [RFC 0/6] Regressions for "imply" behavior change

2020-04-11 Thread Saeed Mahameed
On Fri, 2020-04-10 at 14:13 -0300, Jason Gunthorpe wrote:
> On Fri, Apr 10, 2020 at 02:40:42AM +, Saeed Mahameed wrote:
> 
> > This assumes that the module using FOO has its own flag
> > representing
> > FOO which is not always the case.
> > 
> > for example in mlx5 we use VXLAN config flag directly to compile
> > VXLAN
> > related files:
> > 
> > mlx5/core/Makefile:
> > 
> > obj-$(CONFIG_MLX5_CORE) += mlx5_core.o
> > 
> > mlx5_core-y := mlx5_core.o
> > mlx5_core-$(VXLAN) += mlx5_vxlan.o
> > 
> > and in mlx5_main.o we do:
> 
> Does this work if VXLAN = m ?

Yes, if VXLAN IS_REACHABLE to MLX5, mlx5_vxlan.o will be
compiled/linked.

> 
> > if (IS_ENABLED(VXLAN))
> >mlx5_vxlan_init()
> > 
> > after the change in imply semantics:
> > our options are:
> > 
> > 1) use IS_REACHABLE(VXLAN) instead of IS_ENABLED(VXLAN)
> > 
> > 2) have MLX5_VXLAN in mlx5 Kconfig and use IS_ENABLED(MLX5_VXLAN) 
> > config MLX5_VXLAN
> > depends on VXLAN || !VXLAN
> > bool
> 
> Does this trick work when vxlan is a bool not a tristate?
> 
> Why not just put the VXLAN || !VXLAN directly on MLX5_CORE?
> 

so force MLX5_CORE to n if vxlan is not reachable ? why ? mlx5_core can
perfectly live without vxlan .. all we need to know is if VXLAN is
supported and reachable, if so, then we want to also support vxlan in
mlx5 (i.e compile mlx5_vxlan.o) 

and how do we compile mlx5_vxlan.o wihout a single flag 
can i do in Makefile :
mlx5_core-$(VXLAN || !VXLAN) += mlx5_vxlan.o ?? 


> Jason
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: drm/tve200: Checking for a failed platform_get_irq() call in tve200_probe()

2020-04-11 Thread Markus Elfring
>> I found 20 source files from the software “Linux next-20200408”
>> which seem to contain similar update candidates.
>> Would you like to clarify any extensions for improved applications
>> of scripts with the semantic patch language (Coccinelle software)
>> for corresponding analysis and transformation purposes?
> Please just send a series of patches, one for each driver.

I am used to this possibility for years.


> Each changelog needs to explain the rationale behind the change.

I hope to achieve higher confidence also around specific checks
for return values of Linux functions so that unwanted misunderstandings
can be avoided for mentioned implementation details.


> As for coccinelle - I cannot help you.

I might help you more also by the means of this development tool
if related system factors can be improved somehow.

Regards,
Markus
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [RFC 0/6] Regressions for "imply" behavior change

2020-04-11 Thread Jason Gunthorpe
On Fri, Apr 10, 2020 at 02:40:42AM +, Saeed Mahameed wrote:

> This assumes that the module using FOO has its own flag representing
> FOO which is not always the case.
> 
> for example in mlx5 we use VXLAN config flag directly to compile VXLAN
> related files:
> 
> mlx5/core/Makefile:
> 
> obj-$(CONFIG_MLX5_CORE) += mlx5_core.o
> 
> mlx5_core-y := mlx5_core.o
> mlx5_core-$(VXLAN) += mlx5_vxlan.o
> 
> and in mlx5_main.o we do:

Does this work if VXLAN = m ?

> if (IS_ENABLED(VXLAN))
>mlx5_vxlan_init()
> 
> after the change in imply semantics:
> our options are:
> 
> 1) use IS_REACHABLE(VXLAN) instead of IS_ENABLED(VXLAN)
> 
> 2) have MLX5_VXLAN in mlx5 Kconfig and use IS_ENABLED(MLX5_VXLAN) 
> config MLX5_VXLAN
>   depends on VXLAN || !VXLAN
>   bool

Does this trick work when vxlan is a bool not a tristate?

Why not just put the VXLAN || !VXLAN directly on MLX5_CORE?

Jason
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: drm/tve200: Checking for a failed platform_get_irq() call in tve200_probe()

2020-04-11 Thread Markus Elfring
> The right way to check for errors is to check if the return value is
> less than 0.

Thanks for your constructive feedback.

I was unsure if I noticed another programming mistake.


> Could you please audit all uses of platform_get_irq() in drivers/gpu/

I found 20 source files from the software “Linux next-20200408”
which seem to contain similar update candidates.
Would you like to clarify any extensions for improved applications
of scripts with the semantic patch language (Coccinelle software)
for corresponding analysis and transformation purposes?


> and send a series of patches, one for each driver.

Do other contributors know the affected software module better than me?

Regards,
Markus
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: BUG: kernel NULL pointer dereference, address: 0000000000000026 after switching to 5.7 kernel

2020-04-11 Thread Hillf Danton


On Sat, 11 Apr 2020 00:51:48 +0500 Mikhail Gavrilov wrote:
> Hi folks.
> After upgrade kernel to 5.7 I see every boot in kernel log following
> error messages:
> 
> [2.569513] [drm] Found UVD firmware ENC: 1.2 DEC: .43 Family ID: 19
> [2.569538] [drm] PSP loading UVD firmware
> [2.570038] BUG: kernel NULL pointer dereference, address: 0026
> [2.570045] #PF: supervisor read access in kernel mode
> [2.570050] #PF: error_code(0x) - not-present page
> [2.570055] PGD 0 P4D 0
> [2.570060] Oops:  [#1] SMP NOPTI
> [2.570065] CPU: 5 PID: 667 Comm: uvd_enc_1.1 Not tainted
> 5.7.0-0.rc0.git6.1.2.fc33.x86_64 #1
> [2.570072] Hardware name: System manufacturer System Product
> Name/ROG STRIX X570-I GAMING, BIOS 1405 11/19/2019
> [2.570085] RIP: 0010:__kthread_should_park+0x5/0x30
> [2.570090] Code: 00 e9 fe fe ff ff e8 ca 3a 08 00 e9 49 fe ff ff
> 48 89 df e8 dd 38 08 00 84 c0 0f 84 6a ff ff ff e9 a6 fe ff ff 0f 1f
> 44 00 00  47 26 20 74 12 48 8b 87 88 09 00 00 48 8b 00 48 c1 e8 02
> 83 e0
> [2.570103] RSP: 0018:ad8141723e50 EFLAGS: 00010246
> [2.570107] RAX: 7fff RBX: 8a8d1d116ed8 RCX: 
> 
> [2.570112] RDX:  RSI:  RDI: 
> 
> [2.570116] RBP: 8a8d28c11300 R08:  R09: 
> 
> [2.570120] R10:  R11:  R12: 
> 8a8d1d152e40
> [2.570125] R13: 8a8d1d117280 R14: 8a8d1d116ed8 R15: 
> 8a8d1ca68000
> [2.570131] FS:  () GS:8a8d3aa0()
> knlGS:
> [2.570137] CS:  0010 DS:  ES:  CR0: 80050033
> [2.570142] CR2: 0026 CR3: 0007e3dc6000 CR4: 
> 003406e0
> [2.570147] Call Trace:
> [2.570157]  drm_sched_get_cleanup_job+0x42/0x130 [gpu_sched]
> [2.570166]  drm_sched_main+0x6f/0x530 [gpu_sched]
> [2.570173]  ? lockdep_hardirqs_on+0x11e/0x1b0
> [2.570179]  ? drm_sched_get_cleanup_job+0x130/0x130 [gpu_sched]
> [2.570185]  kthread+0x131/0x150
> [2.570189]  ? __kthread_bind_mask+0x60/0x60
> [2.570196]  ret_from_fork+0x27/0x50
> [2.570203] Modules linked in: fjes(-) amdgpu(+) amd_iommu_v2
> gpu_sched ttm drm_kms_helper drm crc32c_intel igb nvme nvme_core dca
> i2c_algo_bit wmi pinctrl_amd br_netfilter bridge stp llc fuse
> [2.570223] CR2: 0026
> [2.570228] ---[ end trace 80c25d326e1e0d7c ]---
> [2.570233] RIP: 0010:__kthread_should_park+0x5/0x30
> [2.570238] Code: 00 e9 fe fe ff ff e8 ca 3a 08 00 e9 49 fe ff ff
> 48 89 df e8 dd 38 08 00 84 c0 0f 84 6a ff ff ff e9 a6 fe ff ff 0f 1f
> 44 00 00  47 26 20 74 12 48 8b 87 88 09 00 00 48 8b 00 48 c1 e8 02
> 83 e0
> [2.570250] RSP: 0018:ad8141723e50 EFLAGS: 00010246
> [2.570255] RAX: 7fff RBX: 8a8d1d116ed8 RCX: 
> 
> [2.570260] RDX:  RSI:  RDI: 
> 
> [2.570265] RBP: 8a8d28c11300 R08:  R09: 
> 
> [2.570271] R10:  R11:  R12: 
> 8a8d1d152e40
> [2.570276] R13: 8a8d1d117280 R14: 8a8d1d116ed8 R15: 
> 8a8d1ca68000
> [2.570281] FS:  () GS:8a8d3aa0()
> knlGS:
> [2.570287] CS:  0010 DS:  ES:  CR0: 80050033
> [2.570292] CR2: 0026 CR3: 0007e3dc6000 CR4: 
> 003406e0
> [2.570299] BUG: sleeping function called from invalid context at
> include/linux/percpu-rwsem.h:49
> [2.570306] in_atomic(): 0, irqs_disabled(): 1, non_block: 0, pid:
> 667, name: uvd_enc_1.1
> [2.570311] INFO: lockdep is turned off.
> [2.570315] irq event stamp: 14
> [2.570319] hardirqs last  enabled at (13): []
> _raw_spin_unlock_irqrestore+0x46/0x60
> [2.570330] hardirqs last disabled at (14): []
> trace_hardirqs_off_thunk+0x1a/0x1c
> [2.570338] softirqs last  enabled at (0): []
> copy_process+0x706/0x1bc0
> [2.570345] softirqs last disabled at (0): [<>] 0x0
> [2.570351] CPU: 5 PID: 667 Comm: uvd_enc_1.1 Tainted: G  D
>   5.7.0-0.rc0.git6.1.2.fc33.x86_64 #1
> [2.570358] Hardware name: System manufacturer System Product
> Name/ROG STRIX X570-I GAMING, BIOS 1405 11/19/2019
> [2.570365] Call Trace:
> [2.570373]  dump_stack+0x8b/0xc8
> [2.570380]  ___might_sleep.cold+0xb6/0xc6
> [2.570385]  exit_signals+0x1c/0x2d0
> [2.570390]  do_exit+0xb1/0xc30
> [2.570395]  ? kthread+0x131/0x150
> [2.570400]  rewind_stack_do_exit+0x17/0x20
> [2.570559] [drm] Found VCE firmware Version: 57.6 Binary ID: 4
> [2.570572] [drm] PSP loading VCE firmware
> [3.146462] [drm] reserve 0x40 from 0x83fe80 for PSP TMR
> 
> $ /usr/src/kernels/`uname -r`/scripts/faddr2line
> /lib/debug/lib/modules/`uname -r`/vmlinux __kthread_should_park+0x5
> __kthread_should_park+0x5/0x30:
> 

Re: [PATCH] drm/hisilicon: Code refactoring for hibmc_drv_vdac

2020-04-11 Thread tiantao (H)


Thank you, your suggestion is accepted and I will issue v2

在 2020/4/11 11:43, Joe Perches 写道:

On Sat, 2020-04-11 at 10:49 +0800, Tian Tao wrote:

code refactoring for hibmc_drv_vdac.c, no actual function changes.


Seems sensible.


diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c 
b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c

[]

@@ -109,13 +83,6 @@ int hibmc_vdac_init(struct hibmc_drm_private *priv)
struct drm_connector *connector;
int ret;
  
-	connector = hibmc_connector_init(priv);

-   if (IS_ERR(connector)) {
-   DRM_ERROR("failed to create connector: %ld\n",
- PTR_ERR(connector));
-   return PTR_ERR(connector);
-   }
-
encoder = devm_kzalloc(dev->dev, sizeof(*encoder), GFP_KERNEL);
if (!encoder) {
DRM_ERROR("failed to alloc memory when init encoder\n");


The alloc error messages could be removed.


@@ -131,6 +98,21 @@ int hibmc_vdac_init(struct hibmc_drm_private *priv)
}
  
  	drm_encoder_helper_add(encoder, _encoder_helper_funcs);

+
+   connector = devm_kzalloc(dev->dev, sizeof(*connector), GFP_KERNEL);
+   if (!connector) {
+   DRM_ERROR("failed to alloc memory when init connector\n");


and here.



.



___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm/hisilicon: Add the shutdown for hibmc_pci_driver

2020-04-11 Thread Tian Tao
add the shutdown function to release the resource.

Signed-off-by: Tian Tao 
---
 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c 
b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
index a6fd0c2..126d4f4 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
@@ -232,6 +232,21 @@ static int hibmc_hw_map(struct hibmc_drm_private *priv)
return 0;
 }
 
+static void hibmc_hw_unmap(struct hibmc_drm_private *priv)
+{
+   struct drm_device *dev = priv->dev;
+
+   if (priv->mmio) {
+   devm_iounmap(dev->dev, priv->mmio);
+   priv->mmio = NULL;
+   }
+
+   if (priv->fb_map) {
+   devm_iounmap(dev->dev, priv->fb_map);
+   priv->fb_map = NULL;
+   }
+}
+
 static int hibmc_hw_init(struct hibmc_drm_private *priv)
 {
int ret;
@@ -258,6 +273,7 @@ static int hibmc_unload(struct drm_device *dev)
 
hibmc_kms_fini(priv);
hibmc_mm_fini(priv);
+   hibmc_hw_unmap(priv);
dev->dev_private = NULL;
return 0;
 }
@@ -374,6 +390,12 @@ static void hibmc_pci_remove(struct pci_dev *pdev)
drm_dev_unregister(dev);
hibmc_unload(dev);
drm_dev_put(dev);
+   pci_disable_device(pdev);
+}
+
+static void hibmc_pci_shutdown(struct pci_dev *pdev)
+{
+   hibmc_pci_remove(pdev);
 }
 
 static struct pci_device_id hibmc_pci_table[] = {
@@ -386,6 +408,7 @@ static struct pci_driver hibmc_pci_driver = {
.id_table = hibmc_pci_table,
.probe =hibmc_pci_probe,
.remove =   hibmc_pci_remove,
+   .shutdown = hibmc_pci_shutdown,
.driver.pm =_pm_ops,
 };
 
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


  1   2   >