Re: [PATCH v3] platform/x86: Add new vga-switcheroo gmux driver for ACPI-driven muxes

2020-08-10 Thread Lukas Wunner
On Mon, Aug 10, 2020 at 01:44:58PM -0500, Daniel Dadap wrote:
> On 8/10/20 3:37 AM, Lukas Wunner wrote:
> > On Wed, Jul 29, 2020 at 04:05:57PM -0500, Daniel Dadap wrote:
> > > + * Call MXDS with bit 0 set to change the current state.
> > > + * When changing state, clear bit 4 for iGPU and set bit 4 for dGPU.
> > [...]
> > > +enum mux_state_command {
> > > + MUX_STATE_GET = 0,
> > > + MUX_STATE_SET_IGPU = 0x01,
> > > + MUX_STATE_SET_DGPU = 0x11,
> > > +};
> > It looks like the code comment is wrong and bit 1 (instead of bit 4) is
> > used to select the GPU.
> 
> The code comment is correct. The enum values are hexadecimal, not binary.

Ugh, missed that, sorry for the noise.

> Would it be clearer to write it out as something like 0 << 4 & 1 << 0 for
> MUX_STATE_SET_IGPU and 1 << 4 & 1 << 0 for MUX_STATE_SET_DGPU?

BIT(4) | BIT(0) might be clearer, but that gives you an unsigned long
and I'm not sure if gcc accepts that as an enum (=int) initializer.

> > > +static enum vga_switcheroo_client_id mxds_gmux_get_client_id(
> > > + struct pci_dev *dev)
> > > +{
> > > + if (dev) {
> > > + if (ig_dev && dev->vendor == ig_dev->vendor)
> > > + return VGA_SWITCHEROO_IGD;
> > > + if (dg_dev && dev->vendor == dg_dev->vendor)
> > > + return VGA_SWITCHEROO_DIS;
> > > + }
> > That's a little odd.  Why not use "ig_dev == dev" and "dg_dev == dev"?
> 
> No reason; that is indeed better. I think originally these comparisons got a
> vendor ID from some other means.

Perhaps it was necessary in case an eGPU is attached, but that shouldn't
be an issue if you filter out Thunderbolt devices with
pci_is_thunderbolt_attached().

> Yes, MXMX and MXDS go back a ways, it seems. I'm not familiar enough with
> the MXMX+MXDS designs to know if MXDS uses the same API in those designs as
> it doesn in the MXDM+MXDS designs. I'm not aware of any already available
> designs with MXDM. MXMX was used for switching DDC lines independently back
> when LVDS panels were the norm. The upcoming MXDM+MXDS designs are eDP-based
> and do not support independent DDC muxing.

Interesting, thank you for the explanation.

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


Re: [PATCH v6 2/3] drm: bridge: Add support for Cadence MHDP DPI/DP bridge

2020-08-10 Thread Laurent Pinchart
Hi Tomi, Daniel,

On Thu, Mar 12, 2020 at 09:13:06AM +0200, Tomi Valkeinen wrote:
> On 12/03/2020 00:20, Laurent Pinchart wrote:
> >> +  ret = load_firmware(mhdp);
> >> +  if (ret)
> >> +  goto phy_exit;
> >> +
> >> +  drm_bridge_add(>bridge);
>
> > What if someone starts using the bridge before the firmware is
> > operational ? It seems that you should delay bridge registration until
> > the firmware is loaded. It may make it possible to remove
> > bridge_attached and solve the problem you mention in mhdp_fw_cb().
> 
> Handling the fw has been a bit of a pain... This is what we came up with to 
> support all the 
> combinations (built-in/module, fw-userspace-helper/direct load, 
> single-output/multiple-outputs).
> 
> The idea is that when the driver is loaded and probed (with or without fw), 
> the DP is "ready". If we 
> don't have fw yet, everything looks fine, but the connector stays in 
> disconnected state. When we get 
> the fw, connector will get connected (only if there's a cable connected, of 
> course).
> 
> If we register the bridge only when we have fw, two things can happen:
> 
> - If we get the fw only rather late (in case userspace fw helper), a 
> userspace app (e.g. weston) 
> could already have been started, and failed due to there being no DRM card.
> 
> - If we have two displays from the same display controller, say, DP and HDMI, 
> the HDMI will only be 
> available when the DP is available. If the DP fw, for some reason, cannot be 
> loaded, we never get HDMI.

These seem to me to be deficiencies in the graphics stack. We don't have
to solve them now, but I'm curious to know if anyone would have ideas on
how this should ideally be addressed. Daniel, what do you think ?

-- 
Regards,

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


Re: [PATCH v8 3/3] drm: bridge: cdns-mhdp: Add j721e wrapper

2020-08-10 Thread Laurent Pinchart
Hi Swapnil,

Thank you for the patch.

On Thu, Aug 06, 2020 at 01:34:32PM +0200, Swapnil Jakhade wrote:
> Add j721e wrapper for mhdp, which sets up the clock and data muxes.
> 
> Signed-off-by: Jyri Sarha 
> Signed-off-by: Yuti Amonkar 
> Signed-off-by: Swapnil Jakhade 
> Reviewed-by: Tomi Valkeinen 
> Reviewed-by: Laurent Pinchart 
> ---
>  drivers/gpu/drm/bridge/Kconfig   | 13 +
>  drivers/gpu/drm/bridge/Makefile  |  2 +
>  drivers/gpu/drm/bridge/cdns-mhdp-core.c  | 15 +
>  drivers/gpu/drm/bridge/cdns-mhdp-core.h  |  1 +
>  drivers/gpu/drm/bridge/cdns-mhdp-j721e.c | 72 
>  drivers/gpu/drm/bridge/cdns-mhdp-j721e.h | 19 +++
>  6 files changed, 122 insertions(+)
>  create mode 100644 drivers/gpu/drm/bridge/cdns-mhdp-j721e.c
>  create mode 100644 drivers/gpu/drm/bridge/cdns-mhdp-j721e.h
> 
> diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
> index 6a4c324302a8..8c1738653b7e 100644
> --- a/drivers/gpu/drm/bridge/Kconfig
> +++ b/drivers/gpu/drm/bridge/Kconfig
> @@ -38,6 +38,19 @@ config DRM_CDNS_MHDP
> It takes a DPI stream as input and outputs it encoded
> in DP format.
>  
> +if DRM_CDNS_MHDP
> +
> +config DRM_CDNS_MHDP_J721E
> + depends on ARCH_K3_J721E_SOC

depends on ARCH_K3_J721E_SOC || COMPILE_TEST

> + bool "J721E Cadence DPI/DP wrapper support"
> + default y
> + help
> +   Support J721E Cadence DPI/DP wrapper. This is a wrapper
> +   which adds support for J721E related platform ops. It
> +   initializes the J721e Display Port and sets up the
> +   clock and data muxes.
> +endif
> +
>  config DRM_CHRONTEL_CH7033
>   tristate "Chrontel CH7033 Video Encoder"
>   depends on OF
> diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
> index 7046bf077603..be92ebf620b6 100644
> --- a/drivers/gpu/drm/bridge/Makefile
> +++ b/drivers/gpu/drm/bridge/Makefile
> @@ -2,6 +2,8 @@
>  obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
>  obj-$(CONFIG_DRM_CDNS_MHDP) += cdns-mhdp.o
>  cdns-mhdp-y := cdns-mhdp-core.o
> +cdns-mhdp-$(CONFIG_DRM_CDNS_MHDP_J721E) += cdns-mhdp-j721e.o
> +
>  obj-$(CONFIG_DRM_CHRONTEL_CH7033) += chrontel-ch7033.o
>  obj-$(CONFIG_DRM_DISPLAY_CONNECTOR) += display-connector.o
>  obj-$(CONFIG_DRM_LVDS_CODEC) += lvds-codec.o
> diff --git a/drivers/gpu/drm/bridge/cdns-mhdp-core.c 
> b/drivers/gpu/drm/bridge/cdns-mhdp-core.c
> index d47187ab358b..53c25f6ecddf 100644
> --- a/drivers/gpu/drm/bridge/cdns-mhdp-core.c
> +++ b/drivers/gpu/drm/bridge/cdns-mhdp-core.c
> @@ -42,6 +42,8 @@
>  
>  #include "cdns-mhdp-core.h"
>  
> +#include "cdns-mhdp-j721e.h"
> +
>  static DECLARE_WAIT_QUEUE_HEAD(fw_load_wq);
>  
>  static int cdns_mhdp_mailbox_read(struct cdns_mhdp_device *mhdp)
> @@ -1702,6 +1704,16 @@ static int cdns_mhdp_connector_init(struct 
> cdns_mhdp_device *mhdp)
>  
>   conn->display_info.bus_flags = DRM_BUS_FLAG_DE_HIGH;
>  
> + if (of_device_is_compatible(mhdp->dev->of_node, "ti,j721e-mhdp8546"))
> + /*
> +  * DP is internal to J7 SoC and we need to use DRIVE_POSEDGE
> +  * in the display controller. This is achieved for the time being
> +  * by defining SAMPLE_NEGEDGE here.
> +  */

The indentation is wrong. You can adjust it or move it before the if (...).

> + conn->display_info.bus_flags |=
> + DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE |
> + DRM_BUS_FLAG_SYNC_SAMPLE_NEGEDGE;

This should be set in drm_bridge_timings.input_bus_flags instead, and
the tidss should use those when available instead of getting the value
from the connector.

> +
>   ret = drm_connector_attach_encoder(conn, bridge->encoder);
>   if (ret) {
>   DRM_ERROR("Failed to attach connector to encoder\n");
> @@ -2521,6 +2533,9 @@ static int cdns_mhdp_remove(struct platform_device 
> *pdev)
>  
>  static const struct of_device_id mhdp_ids[] = {
>   { .compatible = "cdns,mhdp8546", },
> +#ifdef CONFIG_DRM_CDNS_MHDP_J721E
> + { .compatible = "ti,j721e-mhdp8546", .data = _ti_j721e_ops },
> +#endif
>   { /* sentinel */ }
>  };
>  MODULE_DEVICE_TABLE(of, mhdp_ids);
> diff --git a/drivers/gpu/drm/bridge/cdns-mhdp-core.h 
> b/drivers/gpu/drm/bridge/cdns-mhdp-core.h
> index bd97a7aeb28b..d40a0f8615a4 100644
> --- a/drivers/gpu/drm/bridge/cdns-mhdp-core.h
> +++ b/drivers/gpu/drm/bridge/cdns-mhdp-core.h
> @@ -343,6 +343,7 @@ struct cdns_mhdp_bridge_state {
>  
>  struct cdns_mhdp_device {
>   void __iomem *regs;
> + void __iomem *j721e_regs;
>  
>   struct device *dev;
>   struct clk *clk;
> diff --git a/drivers/gpu/drm/bridge/cdns-mhdp-j721e.c 
> b/drivers/gpu/drm/bridge/cdns-mhdp-j721e.c
> new file mode 100644
> index ..cc33c9afb5bb
> --- /dev/null
> +++ b/drivers/gpu/drm/bridge/cdns-mhdp-j721e.c
> @@ -0,0 +1,72 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * TI j721e Cadence MHDP DP wrapper
> + *
> + * 

Re: [PATCH v8 2/3] drm: bridge: Add support for Cadence MHDP DPI/DP bridge

2020-08-10 Thread Laurent Pinchart
Hi Swapnil,

Thank you for the patch.

On Thu, Aug 06, 2020 at 01:34:31PM +0200, Swapnil Jakhade wrote:
> Add a new DRM bridge driver for Cadence MHDP DPTX IP used in TI J721e SoC.
> MHDP DPTX IP is the component that complies with VESA DisplayPort (DP) and
> embedded Display Port (eDP) standards. It integrates uCPU running the
> embedded Firmware (FW) interfaced over APB interface.
> 
> Basically, it takes a DPI stream as input and outputs it encoded in DP
> format. Currently, it supports only SST mode.
> 
> Co-developed-by: Tomi Valkeinen 
> Signed-off-by: Tomi Valkeinen 
> Co-developed-by: Jyri Sarha 
> Signed-off-by: Jyri Sarha 
> Signed-off-by: Quentin Schulz 
> Signed-off-by: Yuti Amonkar 
> Signed-off-by: Swapnil Jakhade 
> ---
>  drivers/gpu/drm/bridge/Kconfig  |   11 +
>  drivers/gpu/drm/bridge/Makefile |2 +
>  drivers/gpu/drm/bridge/cdns-mhdp-core.c | 2547 +++
>  drivers/gpu/drm/bridge/cdns-mhdp-core.h |  396 
>  4 files changed, 2956 insertions(+)
>  create mode 100644 drivers/gpu/drm/bridge/cdns-mhdp-core.c
>  create mode 100644 drivers/gpu/drm/bridge/cdns-mhdp-core.h
> 
> diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
> index 43271c21d3fc..6a4c324302a8 100644
> --- a/drivers/gpu/drm/bridge/Kconfig
> +++ b/drivers/gpu/drm/bridge/Kconfig
> @@ -27,6 +27,17 @@ config DRM_CDNS_DSI
> Support Cadence DPI to DSI bridge. This is an internal
> bridge and is meant to be directly embedded in a SoC.
>  
> +config DRM_CDNS_MHDP
> + tristate "Cadence DPI/DP bridge"
> + select DRM_KMS_HELPER
> + select DRM_PANEL_BRIDGE
> + depends on OF
> + help
> +   Support Cadence DPI to DP bridge. This is an internal
> +   bridge and is meant to be directly embedded in a SoC.
> +   It takes a DPI stream as input and outputs it encoded
> +   in DP format.
> +
>  config DRM_CHRONTEL_CH7033
>   tristate "Chrontel CH7033 Video Encoder"
>   depends on OF
> diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
> index d63d4b7e4347..7046bf077603 100644
> --- a/drivers/gpu/drm/bridge/Makefile
> +++ b/drivers/gpu/drm/bridge/Makefile
> @@ -1,5 +1,7 @@
>  # SPDX-License-Identifier: GPL-2.0
>  obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
> +obj-$(CONFIG_DRM_CDNS_MHDP) += cdns-mhdp.o
> +cdns-mhdp-y := cdns-mhdp-core.o
>  obj-$(CONFIG_DRM_CHRONTEL_CH7033) += chrontel-ch7033.o
>  obj-$(CONFIG_DRM_DISPLAY_CONNECTOR) += display-connector.o
>  obj-$(CONFIG_DRM_LVDS_CODEC) += lvds-codec.o
> diff --git a/drivers/gpu/drm/bridge/cdns-mhdp-core.c 
> b/drivers/gpu/drm/bridge/cdns-mhdp-core.c
> new file mode 100644
> index ..d47187ab358b
> --- /dev/null
> +++ b/drivers/gpu/drm/bridge/cdns-mhdp-core.c
> @@ -0,0 +1,2547 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Cadence MHDP DP bridge driver.
> + *
> + * Copyright (C) 2020 Cadence Design Systems, Inc.
> + *
> + * Authors: Quentin Schulz 
> + *  Swapnil Jakhade 
> + *  Yuti Amonkar 
> + *  Tomi Valkeinen 
> + *  Jyri Sarha 
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +
> +#include "cdns-mhdp-core.h"
> +
> +static DECLARE_WAIT_QUEUE_HEAD(fw_load_wq);

Does this need to be a global variable, can't it be stored in
cdns_mhdp_device ?

> +
> +static int cdns_mhdp_mailbox_read(struct cdns_mhdp_device *mhdp)
> +{
> + int ret, empty;
> +
> + WARN_ON(!mutex_is_locked(>mbox_mutex));
> +
> + ret = readx_poll_timeout(readl, mhdp->regs + CDNS_MAILBOX_EMPTY,
> +  empty, !empty, MAILBOX_RETRY_US,
> +  MAILBOX_TIMEOUT_US);
> + if (ret < 0)
> + return ret;
> +
> + return readl(mhdp->regs + CDNS_MAILBOX_RX_DATA) & 0xff;
> +}
> +
> +static int cdns_mhdp_mailbox_write(struct cdns_mhdp_device *mhdp, u8 val)
> +{
> + int ret, full;
> +
> + WARN_ON(!mutex_is_locked(>mbox_mutex));
> +
> + ret = readx_poll_timeout(readl, mhdp->regs + CDNS_MAILBOX_FULL,
> +  full, !full, MAILBOX_RETRY_US,
> +  MAILBOX_TIMEOUT_US);
> + if (ret < 0)
> + return ret;
> +
> + writel(val, mhdp->regs + CDNS_MAILBOX_TX_DATA);
> +
> + return 0;
> +}

As commented previously, I think there's room for optimization here. Two
options that I think should be investigated are using the mailbox
interrupts, and only polling for the first byte of the message
(depending on whether the firmware implementation can guarantee that
when the first byte is available, the rest of the message will be
immediately available too). This can be done on top of this patch
though.

How 

[PATCH 2/2] drm/vmwgfx/ldu: Use drm_mode_config_reset

2020-08-10 Thread Roland Scheidegger (VMware)
From: Roland Scheidegger 

Same problem as in stdu, same fix.

Fixes: 51f644b40b4b ("drm/atomic-helper: reset vblank on crtc reset")
Acked-by: Charmaine Lee 
Reviewed-by: Zack Rusin 
Signed-off-by: Roland Scheidegger 
---
 drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
index 009f1742bed5..c4017c7a24db 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
@@ -387,8 +387,6 @@ static int vmw_ldu_init(struct vmw_private *dev_priv, 
unsigned unit)
ldu->base.is_implicit = true;
 
/* Initialize primary plane */
-   vmw_du_plane_reset(primary);
-
ret = drm_universal_plane_init(dev, >base.primary,
   0, _ldu_plane_funcs,
   vmw_primary_plane_formats,
@@ -402,8 +400,6 @@ static int vmw_ldu_init(struct vmw_private *dev_priv, 
unsigned unit)
drm_plane_helper_add(primary, _ldu_primary_plane_helper_funcs);
 
/* Initialize cursor plane */
-   vmw_du_plane_reset(cursor);
-
ret = drm_universal_plane_init(dev, >base.cursor,
0, _ldu_cursor_funcs,
vmw_cursor_plane_formats,
@@ -417,7 +413,6 @@ static int vmw_ldu_init(struct vmw_private *dev_priv, 
unsigned unit)
 
drm_plane_helper_add(cursor, _ldu_cursor_plane_helper_funcs);
 
-   vmw_du_connector_reset(connector);
ret = drm_connector_init(dev, connector, _legacy_connector_funcs,
 DRM_MODE_CONNECTOR_VIRTUAL);
if (ret) {
@@ -445,7 +440,6 @@ static int vmw_ldu_init(struct vmw_private *dev_priv, 
unsigned unit)
goto err_free_encoder;
}
 
-   vmw_du_crtc_reset(crtc);
ret = drm_crtc_init_with_planes(dev, crtc, >base.primary,
>base.cursor,
_legacy_crtc_funcs, NULL);
@@ -520,6 +514,8 @@ int vmw_kms_ldu_init_display(struct vmw_private *dev_priv)
 
dev_priv->active_display_unit = vmw_du_legacy;
 
+   drm_mode_config_reset(dev);
+
DRM_INFO("Legacy Display Unit initialized\n");
 
return 0;
-- 
2.17.1

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


[PATCH 1/2] drm/vmwgfx/sou: Use drm_mode_config_reset

2020-08-10 Thread Roland Scheidegger (VMware)
From: Roland Scheidegger 

Same problem as in stdu, same fix.

Fixes: 51f644b40b4b ("drm/atomic-helper: reset vblank on crtc reset")
Acked-by: Charmaine Lee 
Reviewed-by: Zack Rusin 
Signed-off-by: Roland Scheidegger 
---
 drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
index 32a22e4eddb1..4bf0f5ec4fc2 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
@@ -859,8 +859,6 @@ static int vmw_sou_init(struct vmw_private *dev_priv, 
unsigned unit)
sou->base.is_implicit = false;
 
/* Initialize primary plane */
-   vmw_du_plane_reset(primary);
-
ret = drm_universal_plane_init(dev, >base.primary,
   0, _sou_plane_funcs,
   vmw_primary_plane_formats,
@@ -875,8 +873,6 @@ static int vmw_sou_init(struct vmw_private *dev_priv, 
unsigned unit)
drm_plane_enable_fb_damage_clips(primary);
 
/* Initialize cursor plane */
-   vmw_du_plane_reset(cursor);
-
ret = drm_universal_plane_init(dev, >base.cursor,
0, _sou_cursor_funcs,
vmw_cursor_plane_formats,
@@ -890,7 +886,6 @@ static int vmw_sou_init(struct vmw_private *dev_priv, 
unsigned unit)
 
drm_plane_helper_add(cursor, _sou_cursor_plane_helper_funcs);
 
-   vmw_du_connector_reset(connector);
ret = drm_connector_init(dev, connector, _sou_connector_funcs,
 DRM_MODE_CONNECTOR_VIRTUAL);
if (ret) {
@@ -918,8 +913,6 @@ static int vmw_sou_init(struct vmw_private *dev_priv, 
unsigned unit)
goto err_free_encoder;
}
 
-
-   vmw_du_crtc_reset(crtc);
ret = drm_crtc_init_with_planes(dev, crtc, >base.primary,
>base.cursor,
_screen_object_crtc_funcs, NULL);
@@ -973,6 +966,8 @@ int vmw_kms_sou_init_display(struct vmw_private *dev_priv)
 
dev_priv->active_display_unit = vmw_du_screen_object;
 
+   drm_mode_config_reset(dev);
+
DRM_INFO("Screen Objects Display Unit initialized\n");
 
return 0;
-- 
2.17.1

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


[PATCH v5] arm64: dts: qcom: sc7180: Add Display Port dt node

2020-08-10 Thread Tanmay Shah
Add DP device node on sc7180.

Changes in v2:

- Add assigned-clocks and assigned-clock-parents
- Remove cell-index and pixel_rcg
- Change compatible to qcom,sc7180-dp

Changes in v3:
- Update commit text
- Make DP child node of MDSS
- Remove data-lanes property from SOC dts
- Disable DP node in SOC dts
- Assign DP to Port2 in MDP node
- Add MDSS AHB clock in DP device node

Changes in v4:
- Remove redundant reg-names property
- Use IRQ flag instead had hard coded value.
- Add link clock source in assigned-clocks list.

Changes in v5:
- Add OPP table and power-domains for DisplayPort

This patch depends-on following series:
https://lore.kernel.org/dri-devel/20200807071718.17937-1-tan...@codeaurora.org/

Signed-off-by: Tanmay Shah 
Co-developed-by: Kuogee Hsieh 
Signed-off-by: Kuogee Hsieh 
---
 arch/arm64/boot/dts/qcom/sc7180.dtsi | 76 +++-
 1 file changed, 74 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/sc7180.dtsi 
b/arch/arm64/boot/dts/qcom/sc7180.dtsi
index 31b9217bb5bf..2998fae863a7 100644
--- a/arch/arm64/boot/dts/qcom/sc7180.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180.dtsi
@@ -2371,6 +2371,13 @@ dpu_intf1_out: endpoint {
remote-endpoint = 
<_in>;
};
};
+
+   port@2 {
+   reg = <2>;
+   dpu_intf0_out: endpoint {
+   remote-endpoint = 
<_in>;
+   };
+   };
};
};
 
@@ -2440,6 +2447,71 @@ dsi_phy: dsi-phy@ae94400 {
 
status = "disabled";
};
+
+   msm_dp: displayport-controller@ae9 {
+   status = "disabled";
+   compatible = "qcom,sc7180-dp";
+
+   reg = <0 0x0ae9 0 0x1400>;
+
+   interrupt-parent = <>;
+   interrupts = <12 IRQ_TYPE_NONE>;
+
+   clocks = < DISP_CC_MDSS_AHB_CLK>,
+< DISP_CC_MDSS_DP_AUX_CLK>,
+< DISP_CC_MDSS_DP_LINK_CLK>,
+< 
DISP_CC_MDSS_DP_LINK_INTF_CLK>,
+< DISP_CC_MDSS_DP_PIXEL_CLK>;
+   clock-names = "core_iface", "core_aux", 
"ctrl_link",
+ "ctrl_link_iface", "stream_pixel";
+   #clock-cells = <1>;
+   assigned-clocks = < 
DISP_CC_MDSS_DP_LINK_CLK_SRC>,
+ < 
DISP_CC_MDSS_DP_PIXEL_CLK_SRC>;
+   assigned-clock-parents = <_dp 0>, <_dp 
1>;
+
+   operating-points-v2 = <_opp_table>;
+   power-domains = < SC7180_CX>;
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   port@0 {
+   reg = <0>;
+   dp_in: endpoint {
+   remote-endpoint = 
<_intf0_out>;
+   };
+   };
+
+   port@1 {
+   reg = <1>;
+   dp_out: endpoint { };
+   };
+   };
+
+   dp_opp_table: dp-opp-table {
+   compatible = "operating-points-v2";
+
+   opp-16000 {
+   opp-hz = /bits/ 64 <16000>;
+   required-opps = 
<_opp_low_svs>;
+   };
+
+   opp-27000 {
+   opp-hz = /bits/ 64 <27000>;
+   required-opps = 
<_opp_svs>;
+   };
+
+   opp-54000 {
+   opp-hz = /bits/ 64 <54000>;
+   required-opps = 
<_opp_svs_l1>;
+   };
+
+   opp-81000 

Re: [PATCH] drm/vmwgfx: fix spelling mistake "Cant" -> "Can't"

2020-08-10 Thread Roland Scheidegger
Thanks, I've put the fix in the vmwgfx-next branch.

Roland

Am 10.08.20 um 12:04 schrieb Colin King:
> From: Colin Ian King 
> 
> There is a spelling mistake in a DRM_ERROR message. Fix it.
> 
> Signed-off-by: Colin Ian King 
> ---
>  drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c 
> b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> index bbce45d142aa..471836672312 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> @@ -186,7 +186,7 @@ void vmw_kms_cursor_snoop(struct vmw_surface *srf,
>   /* TODO handle none page aligned offsets */
>   /* TODO handle more dst & src != 0 */
>   /* TODO handle more then one copy */
> - DRM_ERROR("Cant snoop dma request for cursor!\n");
> + DRM_ERROR("Can't snoop dma request for cursor!\n");
>   DRM_ERROR("(%u, %u, %u) (%u, %u, %u) (%ux%ux%u) %u %u\n",
> box->srcx, box->srcy, box->srcz,
> box->x, box->y, box->z,
> 

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


[RFC PATCH V2 0/2] Add Xilinx DSI TX driver

2020-08-10 Thread Venkateshwar Rao Gannavarapu
Xilinx DSI-TX subsytem consists of DSI controller core, AXI crossbar
and D-PHY as sub blocks. DSI TX subsystem driver supports multiple lanes
upto 4, RGB color formats, video mode and command modes.

DSI-TX driver is implemented as an encoder driver, as it going to be
the final node in display pipeline. Xilinx doesn't support any converter
logic to make this as bridge driver. Xilinx doesn't have such
use cases where end node can't be an encoder like DSI-TX. And Xilinx
encoder drivers represents a subsystem where individual blocks can't be
used with external components / encoders.

changes in v2:
 - converted bindings to .yaml format
 - updated compatible string with version number
 - addressed Laurent and Hyun's review comments
 - removed wrappers for enable/disable API's
 - few API's are inlined
 - fixes indent, extra spaces and alignments.
 - added generic long write command mode support

Venkateshwar Rao Gannavarapu (2):
  dt-bindings: display: xlnx: dsi: This add a DT binding for Xilinx DSI
TX subsystem.
  drm: xlnx: dsi: driver for Xilinx DSI TX subsystem

 .../devicetree/bindings/display/xlnx/xlnx,dsi.yaml | 147 +
 drivers/gpu/drm/xlnx/Kconfig   |  11 +
 drivers/gpu/drm/xlnx/Makefile  |   2 +
 drivers/gpu/drm/xlnx/xlnx_dsi.c| 701 +
 4 files changed, 861 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/xlnx/xlnx,dsi.yaml
 create mode 100644 drivers/gpu/drm/xlnx/xlnx_dsi.c

--
1.8.3.1

This email and any attachments are intended for the sole use of the named 
recipient(s) and contain(s) confidential information that may be proprietary, 
privileged or copyrighted under applicable law. If you are not the intended 
recipient, do not read, copy, or forward this email message or any attachments. 
Delete this email message and any attachments immediately.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[RFC PATCH V2 2/2] drm: xlnx: dsi: driver for Xilinx DSI TX subsystem

2020-08-10 Thread Venkateshwar Rao Gannavarapu
The Xilinx MIPI DSI TX subsystem soft IP is used to display video
data from AXI-4 stream interface.

It supports upto 4 lanes, multiple RGB color formats, video mode
and command mode. The driver provides the kernel mode setting and
MIPI DSI host functionalities.

Signed-off-by: Venkateshwar Rao Gannavarapu 

---
 drivers/gpu/drm/xlnx/Kconfig|  11 +
 drivers/gpu/drm/xlnx/Makefile   |   2 +
 drivers/gpu/drm/xlnx/xlnx_dsi.c | 701 
 3 files changed, 714 insertions(+)
 create mode 100644 drivers/gpu/drm/xlnx/xlnx_dsi.c

diff --git a/drivers/gpu/drm/xlnx/Kconfig b/drivers/gpu/drm/xlnx/Kconfig
index aa6cd88..991bb37 100644
--- a/drivers/gpu/drm/xlnx/Kconfig
+++ b/drivers/gpu/drm/xlnx/Kconfig
@@ -11,3 +11,14 @@ config DRM_ZYNQMP_DPSUB
  This is a DRM/KMS driver for ZynqMP DisplayPort controller. Choose
  this option if you have a Xilinx ZynqMP SoC with DisplayPort
  subsystem.
+
+config DRM_XLNX_DSI
+   tristate "Xilinx DRM DSI Subsystem Driver"
+   select DRM_MIPI_DSI
+   select DRM_PANEL
+   select DRM_PANEL_SIMPLE
+   help
+ DRM KMS driver for Xilinx programmable DSI subsystem controller.
+ Choose this option if you have a Xilinx MIPI DSI-TX in video
+ pipeline. The driver provides the kernel mode settings and MIPI
+ DSI host functionalities.
diff --git a/drivers/gpu/drm/xlnx/Makefile b/drivers/gpu/drm/xlnx/Makefile
index 2b844c6..b7ee6ef 100644
--- a/drivers/gpu/drm/xlnx/Makefile
+++ b/drivers/gpu/drm/xlnx/Makefile
@@ -1,2 +1,4 @@
 zynqmp-dpsub-objs += zynqmp_disp.o zynqmp_dpsub.o zynqmp_dp.o
 obj-$(CONFIG_DRM_ZYNQMP_DPSUB) += zynqmp-dpsub.o
+
+obj-$(CONFIG_DRM_XLNX_DSI) += xlnx_dsi.o
diff --git a/drivers/gpu/drm/xlnx/xlnx_dsi.c b/drivers/gpu/drm/xlnx/xlnx_dsi.c
new file mode 100644
index 000..3231043
--- /dev/null
+++ b/drivers/gpu/drm/xlnx/xlnx_dsi.c
@@ -0,0 +1,701 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Xilinx FPGA MIPI DSI Tx Controller driver
+ *
+ * Copyright (C) 2017 - 2019 Xilinx, Inc.
+ *
+ * Authors:
+ * - Saurabh Sengar 
+ * - Venkateshwar Rao Gannavarapu 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+/* DSI Tx IP registers */
+#define XDSI_CCR   0x00
+#define XDSI_CCR_COREENB   BIT(0)
+#define XDSI_CCR_SOFTRST   BIT(1)
+#define XDSI_CCR_CRREADY   BIT(2)
+#define XDSI_CCR_CMDMODE   BIT(3)
+#define XDSI_CCR_DFIFORST  BIT(4)
+#define XDSI_CCR_CMDFIFORSTBIT(5)
+#define XDSI_PCR   0x04
+#define XDSI_PCR_VIDEOMODE(x)  (((x) & 0x3) << 3)
+#define XDSI_PCR_VIDEOMODE_MASK(0x3 << 3)
+#define XDSI_PCR_VIDEOMODE_SHIFT   3
+#define XDSI_PCR_BLLPTYPE(x)   ((x) << 5)
+#define XDSI_PCR_BLLPMODE(x)   ((x) << 6)
+#define XDSI_PCR_EOTPENABLE(x) ((x) << 13)
+#define XDSI_GIER  0x20
+#define XDSI_ISR   0x24
+#define XDSI_IER   0x28
+#define XDSI_STR   0x2C
+#define XDSI_STR_RDY_SHPKT BIT(6)
+#define XDSI_STR_RDY_LNGPKTBIT(7)
+#define XDSI_STR_DFIFO_FULLBIT(8)
+#define XDSI_STR_DFIFO_EMPTY   BIT(9)
+#define XDSI_STR_WAITFR_DATA   BIT(10)
+#define XDSI_STR_CMD_EXE_PGS   BIT(11)
+#define XDSI_STR_CCMD_PROC BIT(12)
+#define XDSI_STR_LPKT_MASK (0x5 << 7)
+#define XDSI_CMD   0x30
+#define XDSI_CMD_QUEUE_PACKET(x)   ((x) & GENMASK(23, 0))
+#define XDSI_DFR   0x34
+#define XDSI_TIME1 0x50
+#define XDSI_TIME1_BLLP_BURST(x)   ((x) & GENMASK(15, 0))
+#define XDSI_TIME1_HSA(x)  (((x) & GENMASK(15, 0)) << 16)
+#define XDSI_TIME2 0x54
+#define XDSI_TIME2_VACT(x) ((x) & GENMASK(15, 0))
+#define XDSI_TIME2_HACT(x) (((x) & GENMASK(15, 0)) << 16)
+#define XDSI_HACT_MULTIPLIER   GENMASK(1, 0)
+#define XDSI_TIME3 0x58
+#define XDSI_TIME3_HFP(x)  ((x) & GENMASK(15, 0))
+#define XDSI_TIME3_HBP(x)  (((x) & GENMASK(15, 0)) << 16)
+#define XDSI_TIME4 0x5c
+#define XDSI_TIME4_VFP(x)  ((x) & GENMASK(7, 0))
+#define XDSI_TIME4_VBP(x)  (((x) & GENMASK(7, 0)) << 8)
+#define XDSI_TIME4_VSA(x)  (((x) & GENMASK(7, 0)) << 16)
+#define XDSI_LTIME 0x60
+#define XDSI_BLLP_TIME 0x64
+/*
+ * XDSI_NUM_DATA_T represents number of data types in the
+ * enum mipi_dsi_pixel_format in the MIPI DSI part of DRM framework.
+ */
+#define XDSI_NUM_DATA_T4
+
+#define XDSI_DPHY_CLK_MIN  1970UL
+#define XDSI_DPHY_CLK_MAX  

[RFC PATCH V2 0/2] Add Xilinx DSI TX driver

2020-08-10 Thread Venkateshwar Rao Gannavarapu
Xilinx DSI-TX subsytem consists of DSI controller core, AXI crossbar
and D-PHY as sub blocks. DSI TX subsystem driver supports multiple lanes
upto 4, RGB color formats, video mode and command modes.

DSI-TX driver is implemented as an encoder driver, as it going to be
the final node in display pipeline. Xilinx doesn't support any converter
logic to make this as bridge driver. Xilinx doesn't have such
use cases where end node can't be an encoder like DSI-TX. And Xilinx
encoder drivers represents a subsystem where individual blocks can't be
used with external components / encoders.

Venkateshwar Rao Gannavarapu (2):
  dt-bindings: display: xlnx: dsi: This add a DT binding for Xilinx DSI
TX subsystem.
  drm: xlnx: dsi: driver for Xilinx DSI TX subsystem

 .../devicetree/bindings/display/xlnx/xlnx,dsi.yaml | 147 +
 drivers/gpu/drm/xlnx/Kconfig   |  11 +
 drivers/gpu/drm/xlnx/Makefile  |   2 +
 drivers/gpu/drm/xlnx/xlnx_dsi.c| 701 +
 4 files changed, 861 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/xlnx/xlnx,dsi.yaml
 create mode 100644 drivers/gpu/drm/xlnx/xlnx_dsi.c

--
1.8.3.1

This email and any attachments are intended for the sole use of the named 
recipient(s) and contain(s) confidential information that may be proprietary, 
privileged or copyrighted under applicable law. If you are not the intended 
recipient, do not read, copy, or forward this email message or any attachments. 
Delete this email message and any attachments immediately.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[RFC PATCH V2 1/2] dt-bindings: display: xlnx: dsi: This add a DT binding for Xilinx DSI TX subsystem.

2020-08-10 Thread Venkateshwar Rao Gannavarapu
The Xilinx MIPI DSI (Display Serial Interface) Transmitter subsystem
implements the Mobile Industry Processor Interface (MIPI) based display
interface. It supports the interface with programmable logic (FPGA).

Signed-off-by: Venkateshwar Rao Gannavarapu 

---
 .../devicetree/bindings/display/xlnx/xlnx,dsi.yaml | 147 +
 1 file changed, 147 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/xlnx/xlnx,dsi.yaml

diff --git a/Documentation/devicetree/bindings/display/xlnx/xlnx,dsi.yaml 
b/Documentation/devicetree/bindings/display/xlnx/xlnx,dsi.yaml
new file mode 100644
index 000..73da0d8
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/xlnx/xlnx,dsi.yaml
@@ -0,0 +1,147 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/xlnx/xlnx,dsi.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Xilinx Programmable DSI-TX Subsystem
+
+description: |
+  The programmable MIPI DSI controller of Xilinx implements display pipeline
+  based on DSI v1.3 specification. The subsystem includes multiple functional
+  blocks as below
+
+  +---+
+---+
+  |   ||  +--+ 
|
+  |   || v--->+AXI CROSBAR   
|XXX  |
+  |FRAME BUFFER   | AXI STREAM | ||  X 
  X |
+  |(DMA)  |   +--->++++--+ 
 XX |
+  |   +<--+||MIPI| 
 X  |
+  |   |||DSI-TX  | 
 X  |
+  |   |||Controller  | 
++  |
+  |   |||+->D-PHY  
 |  |
+  +---+||| |   
 |  |
+  S_AXIS_ACLK  |+-<+   
 |  |
+ +>+   |   
 |  |
+   |   |   
 |  |
+  DPHY_CLK_200M|   |   
 |  |
+ +>+   |   
 |  |
+ + |   
++  |
+   |   
|
+   | MIPI DSI TX SUBSYSTEM 
|
+   
+---+
+
+  The DSI TX controller consists of multiple layers such as lane management 
layer,
+  low-level protocol and pixel-to-byte conversion. The DSI TX controller core
+  receives stream of image data through an input stream interface. The 
subsystem
+  driver supports upto 4 lane support and generates PPI trasfers towards DPHY
+  with continuous clock. It supports Burst, non-burst modes and command modes.
+
+maintainers:
+  - Venkateshwar Rao Gannavarapu 
+
+properties:
+  compatible:
+const: xlnx,dsi-1.0
+
+  reg:
+maxItems: 1
+
+  clocks:
+description: List of clock specifiers
+items:
+  - description: AXI Lite clock
+  - description: Video DPHY clock
+
+  clock-names:
+items:
+  - const: s_axis_aclk
+  - const: dphy_clk_200M
+
+  xlnx,dsi-num-lanes:
+description: Maximum number of lanes that IP configured with.
+   possible values are 1, 2, 4.
+
+allOf:
+  - $ref: /schemas/types.yaml#/definitions/uint32
+  - enum: [1, 2, 4]
+
+  xlnx,dsi-data-type:
+description: MIPI DSI pixel format.
+   possible values are 0, 1, 2, 3.
+
+allOf:
+  - $ref: /schemas/types.yaml#/definitions/uint32
+  - enum: [0, 1, 2, 3]
+
+  xlnx,dsi-cmd-mode:
+description: denotes command mode support
+
+allOf:
+  - $ref: /schemas/types.yaml#/definitions/uint32
+  - enum: [0, 1]
+
+  ports:
+type: object
+
+properties:
+  port@0:
+type: object
+description: |
+  output / source port node, endpoint describing modules
+  connected the DSI TX subsystem
+
+properties:
+  reg:
+const: 0
+
+  endpoint:
+type: object
+
+properties:
+
+  remote-endpoint: true
+
+required:
+  - remote-endpoint
+
+additionalProperties: false
+
+additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - xlnx,dsi-num-lanes
+  - xlnx,dsi-data-type
+  - xlnx,dsi-cmd-mode
+  - ports
+
+additionalProperties: false
+
+examples:
+ -  |
+mipi_dsi_tx_subsystem@8000 {
+  compatible = "xlnx,dsi-1.0";
+  reg = 

Re: [PATCH v8 1/3] dt-bindings: drm/bridge: Document Cadence MHDP bridge bindings

2020-08-10 Thread Laurent Pinchart
Hi Swapnil,

Thank you for the patch.

On Thu, Aug 06, 2020 at 01:34:30PM +0200, Swapnil Jakhade wrote:
> From: Yuti Amonkar 
> 
> Document the bindings used for the Cadence MHDP DPI/DP bridge in
> yaml format.
> 
> Signed-off-by: Yuti Amonkar 
> Signed-off-by: Swapnil Jakhade 
> Reviewed-by: Rob Herring 
> Reviewed-by: Laurent Pinchart 
> ---
>  .../bindings/display/bridge/cdns,mhdp.yaml| 139 ++
>  1 file changed, 139 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/display/bridge/cdns,mhdp.yaml
> 
> diff --git a/Documentation/devicetree/bindings/display/bridge/cdns,mhdp.yaml 
> b/Documentation/devicetree/bindings/display/bridge/cdns,mhdp.yaml
> new file mode 100644
> index ..dabccefe0983
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/display/bridge/cdns,mhdp.yaml
> @@ -0,0 +1,139 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: "http://devicetree.org/schemas/display/bridge/cdns,mhdp.yaml#;
> +$schema: "http://devicetree.org/meta-schemas/core.yaml#;
> +
> +title: Cadence MHDP bridge
> +
> +maintainers:
> +  - Swapnil Jakhade 
> +  - Yuti Amonkar 
> +
> +properties:
> +  compatible:
> +enum:
> +  - cdns,mhdp8546
> +  - ti,j721e-mhdp8546
> +
> +  reg:
> +minItems: 1
> +maxItems: 2
> +items:
> +  - description:
> +  Register block of mhdptx apb registers up to PHY mapped area 
> (AUX_CONFIG_P).
> +  The AUX and PMA registers are not part of this range, they are 
> instead
> +  included in the associated PHY.
> +  - description:
> +  Register block for DSS_EDP0_INTG_CFG_VP registers in case of TI J7 
> SoCs.
> +
> +  reg-names:
> +minItems: 1
> +maxItems: 2
> +items:
> +  - const: mhdptx
> +  - const: j721e-intg
> +
> +  clocks:
> +maxItems: 1
> +description:
> +  DP bridge clock, used by the IP to know how to translate a number of
> +  clock cycles into a time (which is used to comply with DP standard 
> timings
> +  and delays).
> +
> +  phys:
> +maxItems: 1
> +description:
> +  phandle to the DisplayPort PHY.
> +
> +  ports:
> +type: object
> +description:
> +  Ports as described in Documentation/devicetree/bindings/graph.txt.
> +
> +properties:
> +  '#address-cells':
> +const: 1
> +
> +  '#size-cells':
> +const: 0
> +
> +  port@0:
> +type: object
> +description:
> +  Input port representing the DP bridge input.
> +
> +  port@1:
> +type: object
> +description:
> +  Output port representing the DP bridge output.

I've got a chance to study the J721E datasheet, and it shows the DP
bridge has 4 inputs, to support MST. Shouldn't this already be reflected
in the DT bindings ? I think it should be as simple as having 4 input
ports (port@0 to port@3) and one output port (port@4).

The bindings are ABI, so care must be taken to support all features and
avoid future changes that would break backward compatibility. It's fine
if the driver doesn't implement this feature yet.

> +
> +required:
> +  - port@0
> +  - port@1
> +  - '#address-cells'
> +  - '#size-cells'
> +
> +allOf:
> +  - if:
> +  properties:
> +compatible:
> +  contains:
> +const: ti,j721e-mhdp8546
> +then:
> +  properties:
> +reg:
> +  minItems: 2
> +reg-names:
> +  minItems: 2
> +else:
> +  properties:
> +reg:
> +  maxItems: 1
> +reg-names:
> +  maxItems: 1
> +
> +required:
> +  - compatible
> +  - clocks
> +  - reg
> +  - reg-names
> +  - phys
> +  - ports
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +bus {
> +#address-cells = <2>;
> +#size-cells = <2>;
> +
> +mhdp: dp-bridge@f0fb00 {
> +compatible = "cdns,mhdp8546";
> +reg = <0xf0 0xfb00 0x0 0x100>;
> +reg-names = "mhdptx";
> +clocks = <_clock>;
> +phys = <_phy>;
> +
> +ports {
> +#address-cells = <1>;
> +#size-cells = <0>;
> +
> +port@0 {
> +reg = <0>;
> +dp_bridge_input: endpoint {
> +remote-endpoint = <_dpi_output>;
> +};
> +};
> +
> +port@1 {
> +reg = <1>;
> +dp_bridge_output: endpoint {
> +remote-endpoint = <_dp_connector_input>;
> +};
> +};
> +};
> +};
> +};
> +...

-- 
Regards,

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


Re: [PATCH v6 2/3] drm: bridge: Add support for Cadence MHDP DPI/DP bridge

2020-08-10 Thread Laurent Pinchart
Hi Yuti,

On Fri, May 01, 2020 at 07:32:58AM +, Yuti Suresh Amonkar wrote:
> Hi Laurent, 
> 
> Thank you so much for reviewing the patch and providing valuable
> comments. Apologies for the delayed response. We are working on your
> review comments and will send the next version of the driver for
> review soon. Please see the responses to comments inline below.

Thank you for the answers. I was reviewing v8 and realized there were a
few things I didn't fully understand related to communication with the
firmware, so I have a few questions here.

> On Thursday, March 12, 2020 3:51, Laurent Pinchart wrote:
> > On Wed, Feb 26, 2020 at 11:22:58AM +0100, Yuti Amonkar wrote:
> > > This patch adds new DRM driver for Cadence MHDP DPTX IP used on J721e SoC.
> > 
> > s/DRM driver/DRM bridge driver.
> > 
> > > MHDP DPTX IP is the component that complies with VESA DisplayPort (DP) and
> > > embedded Display Port (eDP) standards. It integrates uCPU running the
> > > embedded Firmware(FW) interfaced over APB interface.
> > > Basically, it takes a DPI stream as input and output it encoded in DP
> > 
> > s/output/outputs/
> > 
> > > format. Currently, it supports only SST mode.
> > >
> > > Signed-off-by: Yuti Amonkar 
> > > Signed-off-by: Jyri Sarha 
> > > Signed-off-by: Quentin Schulz 
> > > Signed-off-by: Swapnil Jakhade 
> > > Signed-off-by: Tomi Valkeinen 
> > > ---
> > >  drivers/gpu/drm/bridge/Kconfig  |   11 +
> > >  drivers/gpu/drm/bridge/Makefile |2 +
> > >  drivers/gpu/drm/bridge/cdns-mhdp-core.c | 2196 +++
> > >  drivers/gpu/drm/bridge/cdns-mhdp-core.h |  380 
> > >  4 files changed, 2589 insertions(+)
> > >  create mode 100644 drivers/gpu/drm/bridge/cdns-mhdp-core.c
> > >  create mode 100644 drivers/gpu/drm/bridge/cdns-mhdp-core.h
> > >
> > > diff --git a/drivers/gpu/drm/bridge/Kconfig 
> > > b/drivers/gpu/drm/bridge/Kconfig
> > > index 20a439199cb8..3bfabb76f2bb 100644
> > > --- a/drivers/gpu/drm/bridge/Kconfig
> > > +++ b/drivers/gpu/drm/bridge/Kconfig
> > > @@ -27,6 +27,17 @@ config DRM_CDNS_DSI
> > > Support Cadence DPI to DSI bridge. This is an internal
> > > bridge and is meant to be directly embedded in a SoC.
> > >
> > > +config DRM_CDNS_MHDP
> > > + tristate "Cadence DPI/DP bridge"
> > > + select DRM_KMS_HELPER
> > > + select DRM_PANEL_BRIDGE
> > > + depends on OF
> > > + help
> > > +   Support Cadence DPI to DP bridge. This is an internal
> > > +   bridge and is meant to be directly embedded in a SoC.
> > > +   It takes a DPI stream as input and output it encoded
> > 
> > s/output/outputs/
> > 
> > > +   in DP format.
> > > +
> > >  config DRM_DUMB_VGA_DAC
> > >   tristate "Dumb VGA DAC Bridge support"
> > >   depends on OF
> > > diff --git a/drivers/gpu/drm/bridge/Makefile 
> > > b/drivers/gpu/drm/bridge/Makefile
> > > index b0d5c3af0b5a..2e2c5be7c714 100644
> > > --- a/drivers/gpu/drm/bridge/Makefile
> > > +++ b/drivers/gpu/drm/bridge/Makefile
> > > @@ -16,6 +16,8 @@ obj-$(CONFIG_DRM_TOSHIBA_TC358768) += tc358768.o
> > >  obj-$(CONFIG_DRM_I2C_ADV7511) += adv7511/
> > >  obj-$(CONFIG_DRM_TI_SN65DSI86) += ti-sn65dsi86.o
> > >  obj-$(CONFIG_DRM_TI_TFP410) += ti-tfp410.o
> > > +obj-$(CONFIG_DRM_CDNS_MHDP) += cdns-mhdp.o
> > 
> > Should this be kept alphabetically sorted ?
> > 
> > > +cdns-mhdp-objs := cdns-mhdp-core.o
> > >
> > >  obj-y += analogix/
> > >  obj-y += synopsys/
> > > diff --git a/drivers/gpu/drm/bridge/cdns-mhdp-core.c 
> > > b/drivers/gpu/drm/bridge/cdns-mhdp-core.c
> > > new file mode 100644
> > > index ..cc642893baa8
> > > --- /dev/null
> > > +++ b/drivers/gpu/drm/bridge/cdns-mhdp-core.c
> > > @@ -0,0 +1,2196 @@
> > > +// SPDX-License-Identifier: GPL-2.0
> > > +/*
> > > + * Cadence MHDP DP bridge driver.
> > > + *
> > > + * Copyright: 2019 Cadence Design Systems, Inc.
> > > + *
> > > + * Author: Quentin Schulz 
> > > + */
> > > +
> > > +#include 
> > > +#include 
> > > +#include 
> > > +#include 
> > > +#include 
> > > +#include 
> > > +#include 
> > > +#include 
> > > +#include 
> > > +#include 
> > > +#include 
> > 
> > I think of_irq.h isn't needed.
> > 
> > > +#include 
> > > +#include 
> > > +#include 
> > 
> > phy comes before platform.
> > 
> > > +#include 
> > > +
> > > +#include 
> > > +#include 
> > > +#include 
> > > +#include 
> > > +#include 
> > > +#include 
> > > +#include 
> > > +#include 
> > > +
> > > +#include 
> > > +
> > > +#include "cdns-mhdp-core.h"
> > > +
> > > +static const struct of_device_id mhdp_ids[] = {
> > > + { .compatible = "cdns,mhdp8546", },
> > > + { /* sentinel */ }
> > > +};
> > > +MODULE_DEVICE_TABLE(of, mhdp_ids);
> > 
> > Small detail, this is usually put at at or towards the end of the file.
> > 
> > > +
> > > +static inline u32 get_unaligned_be24(const void *p)
> > > +{
> > > + const u8 *_p = p;
> > > +
> > > + return _p[0] << 16 | _p[1] << 8 | _p[2];
> > > +}
> > > +
> > > +static inline void put_unaligned_be24(u32 val, void *p)
> > > +{
> > > + u8 *_p = p;
> > > +
> > > + 

[Bug 201957] amdgpu: ring gfx timeout

2020-08-10 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=201957

Randy (randyk...@gmail.com) changed:

   What|Removed |Added

 CC||randyk...@gmail.com

--- Comment #35 from Randy (randyk...@gmail.com) ---
I've been getting "ring gfx timeouts" for some time, most of the time it's when
the computer has not had any input for a while (while I'm away from it).  When
it freezes I can SSH into it but when I try to do a: "shutdown -h now" it boots
me out of SSH as it should but the computer never seems to actually shutdown. 
The screen stays frozen with whatever was on the display when it froze.  Any
help would be greatly appreciated, here is my info:

Mobo: AsRock AB350 Pro4 UEFI: 5.80
Video card: Sapphire Nitro+ RX580 (8GB)
Distro: Manjaro
Kernel: 5.7.9-1-MANJARO

Aug 09 21:33:06.054857 kernel: pcieport :00:03.1: AER: Multiple Uncorrected
(Non-Fatal) error received: :00:00.0
Aug 09 21:33:06.068305 kernel: pcieport :00:03.1: AER: PCIe Bus Error:
severity=Uncorrected (Non-Fatal), type=Transaction Layer, (Receiver ID)
Aug 09 21:33:06.068636 kernel: pcieport :00:03.1: AER:   device [1022:1453]
error status/mask=0020/
Aug 09 21:33:06.068863 kernel: pcieport :00:03.1: AER:[21] ACSViol 
  (First)
Aug 09 21:33:06.069137 kernel: amdgpu :0a:00.0: AER: can't recover (no
error_detected callback)
Aug 09 21:33:06.069421 kernel: snd_hda_intel :0a:00.1: AER: can't recover
(no error_detected callback)
Aug 09 21:33:06.069633 kernel: pcieport :00:03.1: AER: device recovery
failed
Aug 09 21:33:16.258283 kernel: [drm:amdgpu_job_timedout [amdgpu]] *ERROR* ring
sdma0 timeout, signaled seq=9087, emitted seq=9089
Aug 09 21:33:16.258412 kernel: [drm:amdgpu_job_timedout [amdgpu]] *ERROR*
Process information: process  pid 0 thread  pid 0
Aug 09 21:33:16.258446 kernel: amdgpu :0a:00.0: GPU reset begin!
Aug 09 21:33:16.258741 kernel: [drm:amdgpu_job_timedout [amdgpu]] *ERROR* ring
gfx timeout, but soft recovered
Aug 09 21:33:16.258773 kernel: amdgpu: [powerplay] 
last message was failed ret is 65535
Aug 09 21:33:16.258803 kernel: amdgpu: [powerplay] 
failed to send message 261 ret is 65535 
Aug 09 21:33:16.258835 kernel: amdgpu: [powerplay] 
last message was failed ret is 65535
Aug 09 21:33:16.258869 kernel: amdgpu: [powerplay] 
failed to send message 261 ret is 65535 
Aug 09 21:33:16.258896 kernel: amdgpu: [powerplay] 
last message was failed ret is 65535
Aug 09 21:33:16.258925 kernel: amdgpu: [powerplay] 
failed to send message 261 ret is 65535 
Aug 09 21:33:16.258951 kernel: amdgpu: [powerplay] 
last message was failed ret is 65535
Aug 09 21:33:16.258977 kernel: amdgpu: [powerplay] 
failed to send message 261 ret is 65535 
Aug 09 21:33:16.259009 kernel: amdgpu: [powerplay] 
last message was failed ret is 65535
Aug 09 21:33:16.259035 kernel: amdgpu: [powerplay] 
failed to send message 261 ret is 65535 
Aug 09 21:33:16.259060 kernel: amdgpu: [powerplay] 
last message was failed ret is 65535
Aug 09 21:33:16.259084 kernel: amdgpu: [powerplay] 
failed to send message 261 ret is 65535 
Aug 09 21:33:16.259108 kernel: amdgpu: [powerplay] 
last message was failed ret is 65535
Aug 09 21:33:16.259131 kernel: amdgpu: [powerplay] 
failed to send message 261 ret is 65535 
Aug 09 21:33:16.259156 kernel: amdgpu: [powerplay] 
last message was failed ret is 65535
Aug 09 21:33:16.259186 kernel: amdgpu: [powerplay] 
failed to send message 261 ret is 65535 
Aug 09 21:33:16.259213 kernel: amdgpu: [powerplay] 
last message was failed ret is 65535
Aug 09 21:33:16.259242 kernel: amdgpu: [powerplay] 
failed to send message 261 ret is 65535 
Aug 09 21:33:16.259272 kernel: amdgpu: [powerplay] 
last message was failed ret is 65535
Aug 09 21:33:16.259298 kernel: amdgpu: [powerplay] 
failed to send message 261 ret is 65535 
Aug 09 21:33:16.259324 kernel: amdgpu: [powerplay] 
last message was failed ret is 65535
Aug 09 21:33:16.259350 kernel: amdgpu: [powerplay] 
failed to send message 261 ret is 65535 
Aug 09 21:33:16.259373 kernel: amdgpu: [powerplay] 
last message was failed ret is 65535
Aug 09 21:33:16.259400 kernel: amdgpu: [powerplay] 
  

Re: [RESEND v7, PATCH 3/7] mtk-mmsys: add mmsys private data

2020-08-10 Thread Chun-Kuang Hu
Hi, Yongqiang:

Yongqiang Niu  於 2020年8月8日 週六 上午10:56寫道:
>
> the reason why split out display connection function:
> 1. there will more and more Mediatek Soc upstream, and the display path
> connection function mtk_mmsys_ddp_mout_en, mtk_mmsys_ddp_sel_in and
> mtk_mmsys_ddp_sout_sel will complicated more and more
> 2. many of the connection are only used in some SoC, and useless for
> other SoC and not readable,
> 3. if we add a new SoC connection, we need check is this affect other
> Soc
>
> the reason why not apply the previous series method:
> this version is more readable and clear
> if go on use v6, except mt2701/mt8173/mt2712, we need add two more
> private data array for mt6779 and mt6797, and the connect function
> will add more if/else usecase
>
> move current display connection function into mt2701-mmsys.c
> keep mt2701/mt8173/mt2712/mt6779/mt6797 with original version
> connection function
> the corresponded SoC upstream member will coding these and test it
> on the SoC if it is need.
>

For this patch, I prefer [1]'s implementation. In [1], for each SoC,
the only difference is an array for routing register setting. In this
patch, the difference are three function which is more complicated
than [1]. If you like, you could pick [1] to upstream.

[1] 
https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2345186

Regards,
Chun-Kuang.

> Signed-off-by: Yongqiang Niu 
> ---
>  drivers/soc/mediatek/Makefile |   1 +
>  drivers/soc/mediatek/mmsys/Makefile   |   2 +
>  drivers/soc/mediatek/mmsys/mt2701-mmsys.c | 250 +++
>  drivers/soc/mediatek/mtk-mmsys.c  | 271 
> +-
>  include/linux/soc/mediatek/mtk-mmsys.h|  15 ++
>  5 files changed, 314 insertions(+), 225 deletions(-)
>  create mode 100644 drivers/soc/mediatek/mmsys/Makefile
>  create mode 100644 drivers/soc/mediatek/mmsys/mt2701-mmsys.c
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [git pull] drm next for 5.9-rc1

2020-08-10 Thread Ben Skeggs
On Tue, 11 Aug 2020 at 04:46, Dave Airlie  wrote:
>
> On Mon, 10 Aug 2020 at 22:23, Christoph Hellwig  wrote:
> >
> > On Thu, Aug 06, 2020 at 11:07:02AM +1000, Dave Airlie wrote:
> > > nouveau:
> > > - add CRC support
> > > - start using NVIDIA published class header files
> >
> > Where does Nvdia provide them?  I looked into the commits and the
> > Nouveau mailing list archives and could not find anything.
>
> https://github.com/NVIDIA/open-gpu-doc
>
> Is I believe the canonical upstream source for them.
> >
> > Note that various new files with a MIT boilerplate instead of
> > an SPDX tag.
>
> Ben might just have imported them directly, so SPDX tags might need to
> be sent upstream and see if they accept them.
Yeah, I decided to play it safe and keep NVIDIA's headers as-provided,
just trimmed down to the parts we're using.

Ben.

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


[PATCH v12 11/13] drm/msm/a6xx: Add support for per-instance pagetables

2020-08-10 Thread Jordan Crouse
Add support for using per-instance pagetables if all the dependencies are
available.

Signed-off-by: Jordan Crouse 
---

 drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 70 +++
 drivers/gpu/drm/msm/adreno/a6xx_gpu.h |  1 +
 drivers/gpu/drm/msm/msm_ringbuffer.h  |  1 +
 3 files changed, 72 insertions(+)

diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
index 5eabb0109577..9653ac9b3cb8 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
@@ -81,6 +81,56 @@ static void get_stats_counter(struct msm_ringbuffer *ring, 
u32 counter,
OUT_RING(ring, upper_32_bits(iova));
 }
 
+static void a6xx_set_pagetable(struct a6xx_gpu *a6xx_gpu,
+   struct msm_ringbuffer *ring, struct msm_file_private *ctx)
+{
+   phys_addr_t ttbr;
+   u32 asid;
+   u64 memptr = rbmemptr(ring, ttbr0);
+
+   if (ctx == a6xx_gpu->cur_ctx)
+   return;
+
+   if (msm_iommu_pagetable_params(ctx->aspace->mmu, , ))
+   return;
+
+   /* Execute the table update */
+   OUT_PKT7(ring, CP_SMMU_TABLE_UPDATE, 4);
+   OUT_RING(ring, CP_SMMU_TABLE_UPDATE_0_TTBR0_LO(lower_32_bits(ttbr)));
+
+   /*
+* For now ignore the asid since the smmu driver uses a TLBIASID to
+* flush the TLB when we use iommu_flush_tlb_all() and the smmu driver
+* isn't aware that the asid changed.  Instead, keep the default asid
+* (0, same as the context bank) to make sure the TLB is properly
+* flushed.
+*/
+   OUT_RING(ring,
+   CP_SMMU_TABLE_UPDATE_1_TTBR0_HI(upper_32_bits(ttbr)) |
+   CP_SMMU_TABLE_UPDATE_1_ASID(0));
+   OUT_RING(ring, CP_SMMU_TABLE_UPDATE_2_CONTEXTIDR(0));
+   OUT_RING(ring, CP_SMMU_TABLE_UPDATE_3_CONTEXTBANK(0));
+
+   /*
+* Write the new TTBR0 to the memstore. This is good for debugging.
+*/
+   OUT_PKT7(ring, CP_MEM_WRITE, 4);
+   OUT_RING(ring, CP_MEM_WRITE_0_ADDR_LO(lower_32_bits(memptr)));
+   OUT_RING(ring, CP_MEM_WRITE_1_ADDR_HI(upper_32_bits(memptr)));
+   OUT_RING(ring, lower_32_bits(ttbr));
+   OUT_RING(ring, (0 << 16) | upper_32_bits(ttbr));
+
+   /*
+* And finally, trigger a uche flush to be sure there isn't anything
+* lingering in that part of the GPU
+*/
+
+   OUT_PKT7(ring, CP_EVENT_WRITE, 1);
+   OUT_RING(ring, 0x31);
+
+   a6xx_gpu->cur_ctx = ctx;
+}
+
 static void a6xx_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit)
 {
unsigned int index = submit->seqno % MSM_GPU_SUBMIT_STATS_COUNT;
@@ -90,6 +140,8 @@ static void a6xx_submit(struct msm_gpu *gpu, struct 
msm_gem_submit *submit)
struct msm_ringbuffer *ring = submit->ring;
unsigned int i;
 
+   a6xx_set_pagetable(a6xx_gpu, ring, submit->queue->ctx);
+
get_stats_counter(ring, REG_A6XX_RBBM_PERFCTR_CP_0_LO,
rbmemptr_stats(ring, index, cpcycles_start));
 
@@ -696,6 +748,8 @@ static int a6xx_hw_init(struct msm_gpu *gpu)
/* Always come up on rb 0 */
a6xx_gpu->cur_ring = gpu->rb[0];
 
+   a6xx_gpu->cur_ctx = NULL;
+
/* Enable the SQE_to start the CP engine */
gpu_write(gpu, REG_A6XX_CP_SQE_CNTL, 1);
 
@@ -1008,6 +1062,21 @@ static unsigned long a6xx_gpu_busy(struct msm_gpu *gpu)
return (unsigned long)busy_time;
 }
 
+static struct msm_gem_address_space *
+a6xx_create_private_address_space(struct msm_gpu *gpu)
+{
+   struct msm_gem_address_space *aspace = NULL;
+   struct msm_mmu *mmu;
+
+   mmu = msm_iommu_pagetable_create(gpu->aspace->mmu);
+
+   if (!IS_ERR(mmu))
+   aspace = msm_gem_address_space_create(mmu,
+   "gpu", 0x1ULL, 0x1ULL);
+
+   return aspace;
+}
+
 static const struct adreno_gpu_funcs funcs = {
.base = {
.get_param = adreno_get_param,
@@ -1031,6 +1100,7 @@ static const struct adreno_gpu_funcs funcs = {
.gpu_state_put = a6xx_gpu_state_put,
 #endif
.create_address_space = adreno_iommu_create_address_space,
+   .create_private_address_space = 
a6xx_create_private_address_space,
},
.get_timestamp = a6xx_get_timestamp,
 };
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.h 
b/drivers/gpu/drm/msm/adreno/a6xx_gpu.h
index 03ba60d5b07f..da22d7549d9b 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.h
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.h
@@ -19,6 +19,7 @@ struct a6xx_gpu {
uint64_t sqe_iova;
 
struct msm_ringbuffer *cur_ring;
+   struct msm_file_private *cur_ctx;
 
struct a6xx_gmu gmu;
 };
diff --git a/drivers/gpu/drm/msm/msm_ringbuffer.h 
b/drivers/gpu/drm/msm/msm_ringbuffer.h
index 7764373d0ed2..0987d6bf848c 100644
--- a/drivers/gpu/drm/msm/msm_ringbuffer.h
+++ b/drivers/gpu/drm/msm/msm_ringbuffer.h
@@ -31,6 +31,7 @@ struct msm_rbmemptrs {
volatile uint32_t 

[PATCH v12 10/13] drm/msm: Add support for private address space instances

2020-08-10 Thread Jordan Crouse
Add support for allocating private address space instances. Targets that
support per-context pagetables should implement their own function to
allocate private address spaces.

The default will return a pointer to the global address space.

Signed-off-by: Jordan Crouse 
---

 drivers/gpu/drm/msm/msm_drv.c | 13 +++--
 drivers/gpu/drm/msm/msm_drv.h |  5 +
 drivers/gpu/drm/msm/msm_gem_vma.c |  9 +
 drivers/gpu/drm/msm/msm_gpu.c | 22 ++
 drivers/gpu/drm/msm/msm_gpu.h |  5 +
 5 files changed, 48 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index 108b663c3ef2..f072306f1260 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -597,7 +597,7 @@ static int context_init(struct drm_device *dev, struct 
drm_file *file)
kref_init(>ref);
msm_submitqueue_init(dev, ctx);
 
-   ctx->aspace = priv->gpu ? priv->gpu->aspace : NULL;
+   ctx->aspace = msm_gpu_create_private_address_space(priv->gpu);
file->driver_priv = ctx;
 
return 0;
@@ -780,18 +780,19 @@ static int msm_ioctl_gem_cpu_fini(struct drm_device *dev, 
void *data,
 }
 
 static int msm_ioctl_gem_info_iova(struct drm_device *dev,
-   struct drm_gem_object *obj, uint64_t *iova)
+   struct drm_file *file, struct drm_gem_object *obj,
+   uint64_t *iova)
 {
-   struct msm_drm_private *priv = dev->dev_private;
+   struct msm_file_private *ctx = file->driver_priv;
 
-   if (!priv->gpu)
+   if (!ctx->aspace)
return -EINVAL;
 
/*
 * Don't pin the memory here - just get an address so that userspace can
 * be productive
 */
-   return msm_gem_get_iova(obj, priv->gpu->aspace, iova);
+   return msm_gem_get_iova(obj, ctx->aspace, iova);
 }
 
 static int msm_ioctl_gem_info(struct drm_device *dev, void *data,
@@ -830,7 +831,7 @@ static int msm_ioctl_gem_info(struct drm_device *dev, void 
*data,
args->value = msm_gem_mmap_offset(obj);
break;
case MSM_INFO_GET_IOVA:
-   ret = msm_ioctl_gem_info_iova(dev, obj, >value);
+   ret = msm_ioctl_gem_info_iova(dev, file, obj, >value);
break;
case MSM_INFO_SET_NAME:
/* length check should leave room for terminating null: */
diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index f69c6d62584d..51a5c9083e13 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -249,6 +249,10 @@ int msm_gem_map_vma(struct msm_gem_address_space *aspace,
 void msm_gem_close_vma(struct msm_gem_address_space *aspace,
struct msm_gem_vma *vma);
 
+
+struct msm_gem_address_space *
+msm_gem_address_space_get(struct msm_gem_address_space *aspace);
+
 void msm_gem_address_space_put(struct msm_gem_address_space *aspace);
 
 struct msm_gem_address_space *
@@ -434,6 +438,7 @@ static inline void msm_file_private_destroy(struct kref 
*kref)
struct msm_file_private *ctx = container_of(kref,
struct msm_file_private, ref);
 
+   msm_gem_address_space_put(ctx->aspace);
kfree(ctx);
 }
 
diff --git a/drivers/gpu/drm/msm/msm_gem_vma.c 
b/drivers/gpu/drm/msm/msm_gem_vma.c
index 5f6a11211b64..29cc1305cf37 100644
--- a/drivers/gpu/drm/msm/msm_gem_vma.c
+++ b/drivers/gpu/drm/msm/msm_gem_vma.c
@@ -27,6 +27,15 @@ void msm_gem_address_space_put(struct msm_gem_address_space 
*aspace)
kref_put(>kref, msm_gem_address_space_destroy);
 }
 
+struct msm_gem_address_space *
+msm_gem_address_space_get(struct msm_gem_address_space *aspace)
+{
+   if (!IS_ERR_OR_NULL(aspace))
+   kref_get(>kref);
+
+   return aspace;
+}
+
 /* Actually unmap memory for the vma */
 void msm_gem_purge_vma(struct msm_gem_address_space *aspace,
struct msm_gem_vma *vma)
diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c
index a1f3da6550e5..b070355369d8 100644
--- a/drivers/gpu/drm/msm/msm_gpu.c
+++ b/drivers/gpu/drm/msm/msm_gpu.c
@@ -823,6 +823,28 @@ static int get_clocks(struct platform_device *pdev, struct 
msm_gpu *gpu)
return 0;
 }
 
+/* Return a new address space for a msm_drm_private instance */
+struct msm_gem_address_space *
+msm_gpu_create_private_address_space(struct msm_gpu *gpu)
+{
+   struct msm_gem_address_space *aspace = NULL;
+
+   if (!gpu)
+   return NULL;
+
+   /*
+* If the target doesn't support private address spaces then return
+* the global one
+*/
+   if (gpu->funcs->create_private_address_space)
+   aspace = gpu->funcs->create_private_address_space(gpu);
+
+   if (IS_ERR_OR_NULL(aspace))
+   aspace = msm_gem_address_space_get(gpu->aspace);
+
+   return aspace;
+}
+
 int msm_gpu_init(struct drm_device *drm, struct platform_device *pdev,
   

[PATCH v12 09/13] drm/msm: Add support to create a local pagetable

2020-08-10 Thread Jordan Crouse
Add support to create a io-pgtable for use by targets that support
per-instance pagetables. In order to support per-instance pagetables the
GPU SMMU device needs to have the qcom,adreno-smmu compatible string and
split pagetables enabled.

Signed-off-by: Jordan Crouse 
---

 drivers/gpu/drm/msm/msm_gpummu.c |   2 +-
 drivers/gpu/drm/msm/msm_iommu.c  | 190 ++-
 drivers/gpu/drm/msm/msm_mmu.h|  16 ++-
 3 files changed, 205 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_gpummu.c b/drivers/gpu/drm/msm/msm_gpummu.c
index 310a31b05faa..aab121f4beb7 100644
--- a/drivers/gpu/drm/msm/msm_gpummu.c
+++ b/drivers/gpu/drm/msm/msm_gpummu.c
@@ -102,7 +102,7 @@ struct msm_mmu *msm_gpummu_new(struct device *dev, struct 
msm_gpu *gpu)
}
 
gpummu->gpu = gpu;
-   msm_mmu_init(>base, dev, );
+   msm_mmu_init(>base, dev, , MSM_MMU_GPUMMU);
 
return >base;
 }
diff --git a/drivers/gpu/drm/msm/msm_iommu.c b/drivers/gpu/drm/msm/msm_iommu.c
index 1b6635504069..bc04dda8a198 100644
--- a/drivers/gpu/drm/msm/msm_iommu.c
+++ b/drivers/gpu/drm/msm/msm_iommu.c
@@ -4,15 +4,201 @@
  * Author: Rob Clark 
  */
 
+#include 
 #include "msm_drv.h"
 #include "msm_mmu.h"
 
 struct msm_iommu {
struct msm_mmu base;
struct iommu_domain *domain;
+   atomic_t pagetables;
 };
+
 #define to_msm_iommu(x) container_of(x, struct msm_iommu, base)
 
+struct msm_iommu_pagetable {
+   struct msm_mmu base;
+   struct msm_mmu *parent;
+   struct io_pgtable_ops *pgtbl_ops;
+   phys_addr_t ttbr;
+   u32 asid;
+};
+static struct msm_iommu_pagetable *to_pagetable(struct msm_mmu *mmu)
+{
+   return container_of(mmu, struct msm_iommu_pagetable, base);
+}
+
+static int msm_iommu_pagetable_unmap(struct msm_mmu *mmu, u64 iova,
+   size_t size)
+{
+   struct msm_iommu_pagetable *pagetable = to_pagetable(mmu);
+   struct io_pgtable_ops *ops = pagetable->pgtbl_ops;
+   size_t unmapped = 0;
+
+   /* Unmap the block one page at a time */
+   while (size) {
+   unmapped += ops->unmap(ops, iova, 4096, NULL);
+   iova += 4096;
+   size -= 4096;
+   }
+
+   iommu_flush_tlb_all(to_msm_iommu(pagetable->parent)->domain);
+
+   return (unmapped == size) ? 0 : -EINVAL;
+}
+
+static int msm_iommu_pagetable_map(struct msm_mmu *mmu, u64 iova,
+   struct sg_table *sgt, size_t len, int prot)
+{
+   struct msm_iommu_pagetable *pagetable = to_pagetable(mmu);
+   struct io_pgtable_ops *ops = pagetable->pgtbl_ops;
+   struct scatterlist *sg;
+   size_t mapped = 0;
+   u64 addr = iova;
+   unsigned int i;
+
+   for_each_sg(sgt->sgl, sg, sgt->nents, i) {
+   size_t size = sg->length;
+   phys_addr_t phys = sg_phys(sg);
+
+   /* Map the block one page at a time */
+   while (size) {
+   if (ops->map(ops, addr, phys, 4096, prot, GFP_KERNEL)) {
+   msm_iommu_pagetable_unmap(mmu, iova, mapped);
+   return -EINVAL;
+   }
+
+   phys += 4096;
+   addr += 4096;
+   size -= 4096;
+   mapped += 4096;
+   }
+   }
+
+   return 0;
+}
+
+static void msm_iommu_pagetable_destroy(struct msm_mmu *mmu)
+{
+   struct msm_iommu_pagetable *pagetable = to_pagetable(mmu);
+   struct msm_iommu *iommu = to_msm_iommu(pagetable->parent);
+
+   /*
+* If this is the last attached pagetable for the parent,
+* disable TTBR0 in the arm-smmu driver
+*/
+   if (atomic_dec_return(>pagetables) == 0)
+   iommu_domain_set_attr(iommu->domain,
+   DOMAIN_ATTR_PGTABLE_CFG, NULL);
+
+   free_io_pgtable_ops(pagetable->pgtbl_ops);
+   kfree(pagetable);
+}
+
+int msm_iommu_pagetable_params(struct msm_mmu *mmu,
+   phys_addr_t *ttbr, int *asid)
+{
+   struct msm_iommu_pagetable *pagetable;
+
+   if (mmu->type != MSM_MMU_IOMMU_PAGETABLE)
+   return -EINVAL;
+
+   pagetable = to_pagetable(mmu);
+
+   if (ttbr)
+   *ttbr = pagetable->ttbr;
+
+   if (asid)
+   *asid = pagetable->asid;
+
+   return 0;
+}
+
+static const struct msm_mmu_funcs pagetable_funcs = {
+   .map = msm_iommu_pagetable_map,
+   .unmap = msm_iommu_pagetable_unmap,
+   .destroy = msm_iommu_pagetable_destroy,
+};
+
+static void msm_iommu_tlb_flush_all(void *cookie)
+{
+}
+
+static void msm_iommu_tlb_flush_walk(unsigned long iova, size_t size,
+   size_t granule, void *cookie)
+{
+}
+
+static void msm_iommu_tlb_add_page(struct iommu_iotlb_gather *gather,
+   unsigned long iova, size_t granule, void *cookie)
+{
+}
+
+static const struct iommu_flush_ops null_tlb_ops = {
+   

[PATCH v12 00/13] iommu/arm-smmu: Add Adreno SMMU specific implementation

2020-08-10 Thread Jordan Crouse
This series adds an Adreno SMMU implementation to arm-smmu to allow GPU hardware
pagetable switching.

The Adreno GPU has built in capabilities to switch the TTBR0 pagetable during
runtime to allow each individual instance or application to have its own
pagetable.  In order to take advantage of the HW capabilities there are certain
requirements needed of the SMMU hardware.

This series adds support for an Adreno specific arm-smmu implementation. The new
implementation 1) ensures that the GPU domain is always assigned context bank 0,
2) enables split pagetable support (TTBR1) so that the instance specific
pagetable can be swapped while the global memory remains in place and 3) shares
the current pagetable configuration with the GPU driver to allow it to create
its own io-pgtable instances.

The series then adds the drm/msm code to enable these features. For targets that
support it allocate new pagetables using the io-pgtable configuration shared by
the arm-smmu driver and swap them in during runtime.

This version of the series merges the previous patchset(s) [1] and [2]
with the following improvements:

v12:
  - Nitpick cleanups in gpu/drm/msm/msm_iommu.c (Rob Clark)
  - Reorg in gpu/drm/msm/msm_gpu.c (Rob Clark)
  - Use the default asid for the context bank so that iommu_tlb_flush_all works
  - Flush the UCHE after a page switch
  - Add the SCTLR.HUPCF patch at the end of the series
v11:
  - Add implementation specific get_attr/set_attr functions (per Rob Clark)
  - Fix context bank allocation (per Bjorn Andersson)
v10:
  - arm-smmu: add implementation hook to allocate context banks
  - arm-smmu: Match the GPU domain by stream ID instead of compatible string
  - arm-smmu: Make DOMAIN_ATTR_PGTABLE_CFG bi-directional. The leaf driver
queries the configuration to create a pagetable and then sends the newly
created configuration back to the smmu-driver to enable TTBR0
  - drm/msm: Add context reference counting for submissions
  - drm/msm: Use dummy functions to skip TLB operations on per-instance
pagetables

[1] https://lists.linuxfoundation.org/pipermail/iommu/2020-June/045653.html
[2] https://lists.linuxfoundation.org/pipermail/iommu/2020-June/045659.html


Jordan Crouse (13):
  iommu/arm-smmu: Pass io-pgtable config to implementation specific
function
  iommu/arm-smmu: Add support for split pagetables
  iommu/arm-smmu: Prepare for the adreno-smmu implementation
  iommu: Add a domain attribute to get/set a pagetable configuration
  iommu/arm-smmu-qcom: Add implementation for the adreno GPU SMMU
  dt-bindings: arm-smmu: Add compatible string for Adreno GPU SMMU
  drm/msm: Add a context pointer to the submitqueue
  drm/msm: Set the global virtual address range from the IOMMU domain
  drm/msm: Add support to create a local pagetable
  drm/msm: Add support for private address space instances
  drm/msm/a6xx: Add support for per-instance pagetables
  arm: dts: qcom: sm845: Set the compatible string for the GPU SMMU
  iommu/arm-smmu: Add a init_context_bank implementation hook

 .../devicetree/bindings/iommu/arm,smmu.yaml   |   4 +
 arch/arm64/boot/dts/qcom/sdm845.dtsi  |   2 +-
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c |  12 +-
 drivers/gpu/drm/msm/adreno/a6xx_gpu.c |  75 ++-
 drivers/gpu/drm/msm/adreno/a6xx_gpu.h |   1 +
 drivers/gpu/drm/msm/adreno/adreno_gpu.c   |  18 +-
 drivers/gpu/drm/msm/adreno/adreno_gpu.h   |   3 +-
 drivers/gpu/drm/msm/msm_drv.c |  16 +-
 drivers/gpu/drm/msm/msm_drv.h |  13 ++
 drivers/gpu/drm/msm/msm_gem.h |   1 +
 drivers/gpu/drm/msm/msm_gem_submit.c  |   8 +-
 drivers/gpu/drm/msm/msm_gem_vma.c |   9 +
 drivers/gpu/drm/msm/msm_gpu.c |  31 ++-
 drivers/gpu/drm/msm/msm_gpu.h |  12 +-
 drivers/gpu/drm/msm/msm_gpummu.c  |   2 +-
 drivers/gpu/drm/msm/msm_iommu.c   | 197 +-
 drivers/gpu/drm/msm/msm_mmu.h |  16 +-
 drivers/gpu/drm/msm/msm_ringbuffer.h  |   1 +
 drivers/gpu/drm/msm/msm_submitqueue.c |   8 +-
 drivers/iommu/arm/arm-smmu/arm-smmu-impl.c|   6 +-
 drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c| 172 ++-
 drivers/iommu/arm/arm-smmu/arm-smmu.c | 134 ++--
 drivers/iommu/arm/arm-smmu/arm-smmu.h |  87 +++-
 include/linux/iommu.h |   1 +
 24 files changed, 708 insertions(+), 121 deletions(-)

-- 
2.25.1

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


[PATCH v12 07/13] drm/msm: Add a context pointer to the submitqueue

2020-08-10 Thread Jordan Crouse
Each submitqueue is attached to a context. Add a pointer to the
context to the submitqueue at create time and refcount it so
that it stays around through the life of the queue.

GPU submissions can access the active context via the submitqueue
instead of requiring it to be passed around from function to
function.

Signed-off-by: Jordan Crouse 
---

 drivers/gpu/drm/msm/adreno/a5xx_gpu.c   | 12 +---
 drivers/gpu/drm/msm/adreno/a6xx_gpu.c   |  5 ++---
 drivers/gpu/drm/msm/adreno/adreno_gpu.c |  5 ++---
 drivers/gpu/drm/msm/adreno/adreno_gpu.h |  3 +--
 drivers/gpu/drm/msm/msm_drv.c   |  3 ++-
 drivers/gpu/drm/msm/msm_drv.h   |  8 
 drivers/gpu/drm/msm/msm_gem.h   |  1 +
 drivers/gpu/drm/msm/msm_gem_submit.c|  8 
 drivers/gpu/drm/msm/msm_gpu.c   |  9 -
 drivers/gpu/drm/msm/msm_gpu.h   |  7 +++
 drivers/gpu/drm/msm/msm_submitqueue.c   |  8 +++-
 11 files changed, 39 insertions(+), 30 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
index 9e63a190642c..eff2439ea57b 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
@@ -43,8 +43,7 @@ static void a5xx_flush(struct msm_gpu *gpu, struct 
msm_ringbuffer *ring)
gpu_write(gpu, REG_A5XX_CP_RB_WPTR, wptr);
 }
 
-static void a5xx_submit_in_rb(struct msm_gpu *gpu, struct msm_gem_submit 
*submit,
-   struct msm_file_private *ctx)
+static void a5xx_submit_in_rb(struct msm_gpu *gpu, struct msm_gem_submit 
*submit)
 {
struct msm_drm_private *priv = gpu->dev->dev_private;
struct msm_ringbuffer *ring = submit->ring;
@@ -57,7 +56,7 @@ static void a5xx_submit_in_rb(struct msm_gpu *gpu, struct 
msm_gem_submit *submit
case MSM_SUBMIT_CMD_IB_TARGET_BUF:
break;
case MSM_SUBMIT_CMD_CTX_RESTORE_BUF:
-   if (priv->lastctx == ctx)
+   if (priv->lastctx == submit->queue->ctx)
break;
/* fall-thru */
case MSM_SUBMIT_CMD_BUF:
@@ -103,8 +102,7 @@ static void a5xx_submit_in_rb(struct msm_gpu *gpu, struct 
msm_gem_submit *submit
msm_gpu_retire(gpu);
 }
 
-static void a5xx_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit,
-   struct msm_file_private *ctx)
+static void a5xx_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit)
 {
struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
struct a5xx_gpu *a5xx_gpu = to_a5xx_gpu(adreno_gpu);
@@ -114,7 +112,7 @@ static void a5xx_submit(struct msm_gpu *gpu, struct 
msm_gem_submit *submit,
 
if (IS_ENABLED(CONFIG_DRM_MSM_GPU_SUDO) && submit->in_rb) {
priv->lastctx = NULL;
-   a5xx_submit_in_rb(gpu, submit, ctx);
+   a5xx_submit_in_rb(gpu, submit);
return;
}
 
@@ -148,7 +146,7 @@ static void a5xx_submit(struct msm_gpu *gpu, struct 
msm_gem_submit *submit,
case MSM_SUBMIT_CMD_IB_TARGET_BUF:
break;
case MSM_SUBMIT_CMD_CTX_RESTORE_BUF:
-   if (priv->lastctx == ctx)
+   if (priv->lastctx == submit->queue->ctx)
break;
/* fall-thru */
case MSM_SUBMIT_CMD_BUF:
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
index c5a3e4d4c007..5eabb0109577 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
@@ -81,8 +81,7 @@ static void get_stats_counter(struct msm_ringbuffer *ring, 
u32 counter,
OUT_RING(ring, upper_32_bits(iova));
 }
 
-static void a6xx_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit,
-   struct msm_file_private *ctx)
+static void a6xx_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit)
 {
unsigned int index = submit->seqno % MSM_GPU_SUBMIT_STATS_COUNT;
struct msm_drm_private *priv = gpu->dev->dev_private;
@@ -115,7 +114,7 @@ static void a6xx_submit(struct msm_gpu *gpu, struct 
msm_gem_submit *submit,
case MSM_SUBMIT_CMD_IB_TARGET_BUF:
break;
case MSM_SUBMIT_CMD_CTX_RESTORE_BUF:
-   if (priv->lastctx == ctx)
+   if (priv->lastctx == submit->queue->ctx)
break;
/* fall-thru */
case MSM_SUBMIT_CMD_BUF:
diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c 
b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
index e23641a5ec84..b38a8126541a 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
@@ -457,8 +457,7 @@ void adreno_recover(struct msm_gpu *gpu)
}
 }
 
-void adreno_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit,
-   struct msm_file_private 

[PATCH v12 08/13] drm/msm: Set the global virtual address range from the IOMMU domain

2020-08-10 Thread Jordan Crouse
Use the aperture settings from the IOMMU domain to set up the virtual
address range for the GPU. This allows us to transparently deal with
IOMMU side features (like split pagetables).

Signed-off-by: Jordan Crouse 
---

 drivers/gpu/drm/msm/adreno/adreno_gpu.c | 13 +++--
 drivers/gpu/drm/msm/msm_iommu.c |  7 +++
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c 
b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
index b38a8126541a..f9e3badf2fca 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
@@ -192,9 +192,18 @@ adreno_iommu_create_address_space(struct msm_gpu *gpu,
struct iommu_domain *iommu = iommu_domain_alloc(_bus_type);
struct msm_mmu *mmu = msm_iommu_new(>dev, iommu);
struct msm_gem_address_space *aspace;
+   u64 start, size;
 
-   aspace = msm_gem_address_space_create(mmu, "gpu", SZ_16M,
-   0x - SZ_16M);
+   /*
+* Use the aperture start or SZ_16M, whichever is greater. This will
+* ensure that we align with the allocated pagetable range while still
+* allowing room in the lower 32 bits for GMEM and whatnot
+*/
+   start = max_t(u64, SZ_16M, iommu->geometry.aperture_start);
+   size = iommu->geometry.aperture_end - start + 1;
+
+   aspace = msm_gem_address_space_create(mmu, "gpu",
+   start & GENMASK(48, 0), size);
 
if (IS_ERR(aspace) && !IS_ERR(mmu))
mmu->funcs->destroy(mmu);
diff --git a/drivers/gpu/drm/msm/msm_iommu.c b/drivers/gpu/drm/msm/msm_iommu.c
index 3a381a9674c9..1b6635504069 100644
--- a/drivers/gpu/drm/msm/msm_iommu.c
+++ b/drivers/gpu/drm/msm/msm_iommu.c
@@ -36,6 +36,10 @@ static int msm_iommu_map(struct msm_mmu *mmu, uint64_t iova,
struct msm_iommu *iommu = to_msm_iommu(mmu);
size_t ret;
 
+   /* The arm-smmu driver expects the addresses to be sign extended */
+   if (iova & BIT_ULL(48))
+   iova |= GENMASK_ULL(63, 49);
+
ret = iommu_map_sg(iommu->domain, iova, sgt->sgl, sgt->nents, prot);
WARN_ON(!ret);
 
@@ -46,6 +50,9 @@ static int msm_iommu_unmap(struct msm_mmu *mmu, uint64_t 
iova, size_t len)
 {
struct msm_iommu *iommu = to_msm_iommu(mmu);
 
+   if (iova & BIT_ULL(48))
+   iova |= GENMASK_ULL(63, 49);
+
iommu_unmap(iommu->domain, iova, len);
 
return 0;
-- 
2.25.1

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


[PATCH v6] Add support for KeemBay DRM driver

2020-08-10 Thread Anitha Chrisanthus
This is a new DRM driver for Intel's KeemBay SOC.
The SoC couples an ARM Cortex A53 CPU with an Intel
Movidius VPU.

This driver is tested with the KMB EVM board which is the refernce baord
for Keem Bay SOC. The SOC's display pipeline is as follows

+--++-++---+
|LCD controller| -> |Mipi DSI | -> |Mipi to HDMI Converter |
+--++-++---+

LCD controller and Mipi DSI transmitter are part of the SOC and
mipi to HDMI converter is ADV7535 for KMB EVM board.

The DRM driver is a basic KMS atomic modesetting display driver and
has no 2D or 3D graphics.It calls into the ADV bridge driver at
the connector level.

Only 1080p resolution and single plane is supported at this time.
The usecase is for debugging video and camera outputs.

Device tree patches are under review here
https://lore.kernel.org/linux-arm-kernel/20200708175020.194436-1-daniele.alessandre...@linux.intel.com/T/

Changes since v1:
- Removed redundant license text, updated license
- Rearranged include blocks
- renamed global vars and removed extern in c
- Used upclassing for dev_private
- Used drm_dev_init in drm device create
- minor cleanups

Changes since v2:
- squashed all commits to a single commit
- logging changed to drm_info, drm_dbg etc.
- used devm_drm_dev_alloc()
- removed commented out sections and general cleanup

Changes since v3:
- renamed dev_p to kmb
- moved clocks under kmb_clock, consolidated clk initializations
- use drmm functions
- use DRM_GEM_CMA_DRIVER_OPS_VMAP
- more cleanups

Changes since v4:
- corrected spellings

Changes since v5:
- corrected checkpatch warnings/checks
-Please ignore checkpatch checks on Camelcase - this is how it is
named in the databook
- Please ignore checkpatch warnings on misspelled for hsa, dout,
widthn etc. - they are spelled as in the databook
- Please ignore checkpatch checks on macro arguments reuse - 
its confirmed ok

Anitha Chrisanthus (1):
  drm/kmb: Add support for KeemBay Display

 drivers/gpu/drm/Kconfig |2 +
 drivers/gpu/drm/Makefile|1 +
 drivers/gpu/drm/kmb/Kconfig |   13 +
 drivers/gpu/drm/kmb/Makefile|2 +
 drivers/gpu/drm/kmb/kmb_crtc.c  |  217 +
 drivers/gpu/drm/kmb/kmb_crtc.h  |   36 +
 drivers/gpu/drm/kmb/kmb_drv.c   |  725 
 drivers/gpu/drm/kmb/kmb_drv.h   |  172 
 drivers/gpu/drm/kmb/kmb_dsi.c   | 1828 +++
 drivers/gpu/drm/kmb/kmb_dsi.h   |  370 
 drivers/gpu/drm/kmb/kmb_plane.c |  519 +++
 drivers/gpu/drm/kmb/kmb_plane.h |  124 +++
 drivers/gpu/drm/kmb/kmb_regs.h  |  748 
 13 files changed, 4757 insertions(+)
 create mode 100644 drivers/gpu/drm/kmb/Kconfig
 create mode 100644 drivers/gpu/drm/kmb/Makefile
 create mode 100644 drivers/gpu/drm/kmb/kmb_crtc.c
 create mode 100644 drivers/gpu/drm/kmb/kmb_crtc.h
 create mode 100644 drivers/gpu/drm/kmb/kmb_drv.c
 create mode 100644 drivers/gpu/drm/kmb/kmb_drv.h
 create mode 100644 drivers/gpu/drm/kmb/kmb_dsi.c
 create mode 100644 drivers/gpu/drm/kmb/kmb_dsi.h
 create mode 100644 drivers/gpu/drm/kmb/kmb_plane.c
 create mode 100644 drivers/gpu/drm/kmb/kmb_plane.h
 create mode 100644 drivers/gpu/drm/kmb/kmb_regs.h

-- 
2.7.4

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


[PATCH 1/2] drm/nouveau/kms/nv140-: Include correct push header in crcc37d.c

2020-08-10 Thread Lyude Paul
Looks like when we converted everything over to Nvidia's class headers,
we mistakenly included the nvif/push507b.h instead of nvif/pushc37b.h,
which resulted in breaking CRC reporting for volta+:

nouveau :1f:00.0: disp: chid 0 stat 10003361 reason 3
[RESERVED_METHOD] mthd 0d84 data  code 
nouveau :1f:00.0: disp: chid 0 stat 10003360 reason 3
[RESERVED_METHOD] mthd 0d80 data  code 
nouveau :1f:00.0: DRM: CRC notifier ctx for head 3 not finished
after 50ms

So, fix that.

Signed-off-by: Lyude Paul 
Fixes: c4b27bc8682c ("drm/nouveau/kms/nv50-: convert core crc_set_src() to new 
push macros")
---
 drivers/gpu/drm/nouveau/dispnv50/crcc37d.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv50/crcc37d.c 
b/drivers/gpu/drm/nouveau/dispnv50/crcc37d.c
index 9afe9a87bde0c..814e5bd974460 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/crcc37d.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/crcc37d.c
@@ -6,7 +6,7 @@
 #include "disp.h"
 #include "head.h"
 
-#include 
+#include 
 
 #include 
 
-- 
2.26.2

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


[PATCH 2/2] drm/nouveau/kms/nv50-: Don't call HEAD_SET_CRC_CONTROL in head907d_mode()

2020-08-10 Thread Lyude Paul
This was a mistake that was present before, but never got noticed until
we converted over to using nvidia's class headers for display
programming. Luckily though it never caused any problems, since we
always end up calling crc907d_set_src() after head907d_mode().

So, let's get rid of this.

Signed-off-by: Lyude Paul 
---
 drivers/gpu/drm/nouveau/dispnv50/head907d.c | 11 ++-
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv50/head907d.c 
b/drivers/gpu/drm/nouveau/dispnv50/head907d.c
index 8f860e9c52247..85648d790743f 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/head907d.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/head907d.c
@@ -322,7 +322,7 @@ head907d_mode(struct nv50_head *head, struct nv50_head_atom 
*asyh)
const int i = head->base.index;
int ret;
 
-   if ((ret = PUSH_WAIT(push, 14)))
+   if ((ret = PUSH_WAIT(push, 13)))
return ret;
 
PUSH_MTHD(push, NV907D, HEAD_SET_OVERSCAN_COLOR(i),
@@ -353,14 +353,7 @@ head907d_mode(struct nv50_head *head, struct 
nv50_head_atom *asyh)
PUSH_MTHD(push, NV907D, HEAD_SET_DEFAULT_BASE_COLOR(i),
  NVVAL(NV907D, HEAD_SET_DEFAULT_BASE_COLOR, RED, 0) |
  NVVAL(NV907D, HEAD_SET_DEFAULT_BASE_COLOR, GREEN, 0) |
- NVVAL(NV907D, HEAD_SET_DEFAULT_BASE_COLOR, BLUE, 0),
-
-   HEAD_SET_CRC_CONTROL(i),
- NVDEF(NV907D, HEAD_SET_CRC_CONTROL, CONTROLLING_CHANNEL, 
CORE) |
- NVDEF(NV907D, HEAD_SET_CRC_CONTROL, EXPECT_BUFFER_COLLAPSE, 
FALSE) |
- NVDEF(NV907D, HEAD_SET_CRC_CONTROL, TIMESTAMP_MODE, FALSE) |
- NVDEF(NV907D, HEAD_SET_CRC_CONTROL, PRIMARY_OUTPUT, NONE) |
- NVDEF(NV907D, HEAD_SET_CRC_CONTROL, SECONDARY_OUTPUT, NONE));
+ NVVAL(NV907D, HEAD_SET_DEFAULT_BASE_COLOR, BLUE, 0));
 
PUSH_MTHD(push, NV907D, HEAD_SET_PIXEL_CLOCK_FREQUENCY(i),
  NVVAL(NV907D, HEAD_SET_PIXEL_CLOCK_FREQUENCY, HERTZ, m->clock 
* 1000) |
-- 
2.26.2

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


Re: [PATCH] drm: amdgpu: Use the correct size when allocating memory

2020-08-10 Thread Alex Deucher
Applied and updated the commit message to reflect the sizes.

Thanks!

Alex

On Mon, Aug 10, 2020 at 3:07 PM Marion & Christophe JAILLET
 wrote:
>
>
> Le 10/08/2020 à 17:42, Dan Carpenter a écrit :
> > On Sun, Aug 09, 2020 at 10:34:06PM +0200, Christophe JAILLET wrote:
> >> When '*sgt' is allocated, we must allocated 'sizeof(**sgt)' bytes instead
> >> of 'sizeof(*sg)'. 'sg' (i.e. struct scatterlist) is smaller than
> >> 'sgt' (i.e struct sg_table), so this could lead to memory corruption.
> > The sizeof(*sg) is bigger than sizeof(**sgt) so this wastes memory but
> > it won't lead to corruption.
> >
> >  11  struct scatterlist {
> >  12  unsigned long   page_link;
> >  13  unsigned intoffset;
> >  14  unsigned intlength;
> >  15  dma_addr_t  dma_address;
> >  16  #ifdef CONFIG_NEED_SG_DMA_LENGTH
> >  17  unsigned intdma_length;
> >  18  #endif
> >  19  };
> >
> >  42  struct sg_table {
> >  43  struct scatterlist *sgl;/* the list */
> >  44  unsigned int nents; /* number of mapped 
> > entries */
> >  45  unsigned int orig_nents;/* original size of list */
> >  46  };
> >
> > regards,
> > dan carpenter
>
>
> My bad. I read 'struct scatterlist sgl' (without the *)
> Thanks for the follow-up, Dan.
>
> Doesn't smatch catch such mismatch?
> (I've not run smatch for a while, so it is maybe reported)
>
> Well, the proposal is still valid, even if it has less impact as
> initially thought.
>
> Thx for the review.
>
> CJ
>
> ___
> amd-gfx mailing list
> amd-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 208573] Black screen on boot if two displays plugged in with NAVI 10

2020-08-10 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=208573

Thomas Langkamp (thomas.langk...@medicalschool-hamburg.de) changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #11 from Thomas Langkamp (thomas.langk...@medicalschool-hamburg.de) 
---
206903

*** This bug has been marked as a duplicate of bug 206903 ***

-- 
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] drm/amd/display: convert to use le16_add_cpu()

2020-08-10 Thread Alex Deucher
Applied.  Thanks!

Alex

On Mon, Aug 10, 2020 at 9:05 AM Qinglang Miao  wrote:
>
> Convert cpu_to_le16(le16_to_cpu(E1) + E2) to use le16_add_cpu().
>
> Signed-off-by: Qinglang Miao 
> ---
>  drivers/gpu/drm/amd/display/dc/bios/command_table.c  | 4 +---
>  drivers/gpu/drm/amd/display/dc/bios/command_table2.c | 5 +
>  2 files changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/bios/command_table.c 
> b/drivers/gpu/drm/amd/display/dc/bios/command_table.c
> index 5815983ca..070459e3e 100644
> --- a/drivers/gpu/drm/amd/display/dc/bios/command_table.c
> +++ b/drivers/gpu/drm/amd/display/dc/bios/command_table.c
> @@ -1877,9 +1877,7 @@ static enum bp_result set_crtc_using_dtd_timing_v3(
>  * but it is 4 either from Edid data (spec CEA 861)
>  * or CEA timing table.
>  */
> -   params.usV_SyncOffset =
> -   
> cpu_to_le16(le16_to_cpu(params.usV_SyncOffset) + 1);
> -
> +   le16_add_cpu(_SyncOffset, 1);
> }
> }
>
> diff --git a/drivers/gpu/drm/amd/display/dc/bios/command_table2.c 
> b/drivers/gpu/drm/amd/display/dc/bios/command_table2.c
> index bed91572f..e8f52eb8e 100644
> --- a/drivers/gpu/drm/amd/display/dc/bios/command_table2.c
> +++ b/drivers/gpu/drm/amd/display/dc/bios/command_table2.c
> @@ -569,10 +569,7 @@ static enum bp_result set_crtc_using_dtd_timing_v3(
>  * but it is 4 either from Edid data (spec CEA 861)
>  * or CEA timing table.
>  */
> -   params.v_syncoffset =
> -   cpu_to_le16(le16_to_cpu(params.v_syncoffset) +
> -   1);
> -
> +   le16_add_cpu(_syncoffset, 1);
> }
> }
>
> --
> 2.25.1
>
> ___
> amd-gfx mailing list
> amd-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 208573] Black screen on boot if two displays plugged in with NAVI 10

2020-08-10 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=208573

--- Comment #10 from Alex Deucher (alexdeuc...@gmail.com) ---
You can probably mark this bug as a duplicate of 208573 then.

-- 
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 v14 0/2] Add initial support for slimport anx7625

2020-08-10 Thread Sam Ravnborg
Hi Xin Ji.

On Thu, Jul 09, 2020 at 04:31:09PM +0800, Xin Ji wrote:
> Hi all,
> 
> The following series add support for the Slimport ANX7625 transmitter, a
> ultra-low power Full-HD 4K MIPI to DP transmitter designed for portable 
> device.
> 
> 
> This is the v14 version, any mistakes, please let me know, I will fix it in
> the next series.
> 
> Change history:
> v14: Fix comments from Sam and Nicolas
>  - Check flags at drm_bridge_attach
>  - Use panel_bridge instead of drm_panel
>  - Fix not correct return value

Sorry for ignoring this for so long time.
The patch applies but no longer builds.

I could fix it locally but wanted to know if you have a later version to
be applied?

Sam


> 
> v13: Fix comments from Launrent Pinchart and Rob Herring
>  - Picked up Rob's Reviewed-By
>  - Add .detect and .get_edid interface in bridge funcs.
> 
> v12: Fix comments from Hsin-Yi Wang
>  - Rebase the code on kernel 5.7, fix DRM interface not match issue.
> 
> v11: Fix comments from Rob Herring
>  - Update commit message.
>  - Remove unused label.
> 
> v10: Fix comments from Rob Herring, Daniel.
>  - Fix dt_binding_check warning.
>  - Update description.
> 
> v9: Fix comments from Sam, Nicolas, Daniel
>  - Remove extcon interface.
>  - Remove DPI support.
>  - Fix dt_binding_check complains.
>  - Code clean up and update description.
> 
> v8: Fix comments from Nicolas.
>  - Fix several coding format.
>  - Update description.
> 
> v7:
>  - Fix critical timing(eg:odd hfp/hbp) in "mode_fixup" interface,
>enhance MIPI RX tolerance by setting register MIPI_DIGITAL_ADJ_1 to 0x3D.
> 
> 
> Xin Ji (2):
>   dt-bindings: drm/bridge: anx7625: MIPI to DP transmitter DT schema
>   drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP
> 
>  .../bindings/display/bridge/analogix,anx7625.yaml  |   95 +
>  drivers/gpu/drm/bridge/analogix/Kconfig|9 +
>  drivers/gpu/drm/bridge/analogix/Makefile   |1 +
>  drivers/gpu/drm/bridge/analogix/anx7625.c  | 1939 
> 
>  drivers/gpu/drm/bridge/analogix/anx7625.h  |  391 
>  5 files changed, 2435 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml
>  create mode 100644 drivers/gpu/drm/bridge/analogix/anx7625.c
>  create mode 100644 drivers/gpu/drm/bridge/analogix/anx7625.h
> 
> -- 
> 2.7.4
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/imx: dw_hdmi-imx: use imx_drm_encoder_parse_of

2020-08-10 Thread Sam Ravnborg
On Tue, Jul 21, 2020 at 03:07:10PM +0200, Philipp Zabel wrote:
> This is the same code and comment that is already shared by imx-ldb,
> imx-tve, and parallel-display in imx_drm_encoder_parse_of().
> 
> Signed-off-by: Philipp Zabel 

Looks OK:
Reviewed-by: Sam Ravnborg 

> ---
>  drivers/gpu/drm/imx/dw_hdmi-imx.c | 12 +++-
>  1 file changed, 3 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/imx/dw_hdmi-imx.c 
> b/drivers/gpu/drm/imx/dw_hdmi-imx.c
> index 87869b9997a6..a4f178c1d9bc 100644
> --- a/drivers/gpu/drm/imx/dw_hdmi-imx.c
> +++ b/drivers/gpu/drm/imx/dw_hdmi-imx.c
> @@ -217,15 +217,9 @@ static int dw_hdmi_imx_bind(struct device *dev, struct 
> device *master,
>   hdmi->dev = >dev;
>   encoder = >encoder;
>  
> - encoder->possible_crtcs = drm_of_find_possible_crtcs(drm, dev->of_node);
> - /*
> -  * If we failed to find the CRTC(s) which this encoder is
> -  * supposed to be connected to, it's because the CRTC has
> -  * not been registered yet.  Defer probing, and hope that
> -  * the required CRTC is added later.
> -  */
> - if (encoder->possible_crtcs == 0)
> - return -EPROBE_DEFER;
> + ret = imx_drm_encoder_parse_of(drm, encoder, dev->of_node);
> + if (ret)
> + return ret;
>  
>   ret = dw_hdmi_imx_parse_dt(hdmi);
>   if (ret < 0)
> -- 
> 2.20.1
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

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


Re: [linux.git drm/ttm]: NULL pointer dereference upon driver probe

2020-08-10 Thread Dave Airlie
On Tue, 11 Aug 2020 at 05:24, Christian König  wrote:
>
> Am 10.08.20 um 20:51 schrieb Dave Airlie:
> > On Mon, 10 Aug 2020 at 22:20, Christian König  
> > wrote:
> >> Am 07.08.20 um 09:02 schrieb Christian König:
> >>> Am 06.08.20 um 20:50 schrieb Roland Scheidegger:
>  Am 06.08.20 um 17:28 schrieb Christian König:
> > My best guess is that you are facing two separate bugs here.
> >
> > Crash #1 is somehow related to CRTCs and might even be cause by the
> > atomic-helper change you noted below.
> >
> > Crash #2 is caused because vmw_bo_create_and_populate() tries to
> > manually populate a BO object instead of relying on TTM to do it when
> > necessary. This indeed doesn't work any more because of "drm/ttm: make
> > TT creation purely optional v3".
> >
> > Question is why vmwgfx is doing this?
>  Not really sure unfortunately, it's possible vmwgfx is doing it because
>  ttm lacked some capabilities at some point?
> >>> I think so as well, yes.
> >>>
> Trying to figure this one out...
> >>> Problem is that what vmwgfx is doing here is questionable at best.
> >>>
> >>> By definition BOs in the SYSTEM domain are not accessible by the GPU,
> >>> even if it is a virtual one.
> >>>
> >>> And what vmwgfx does is allocating one in the SYSTEM domain as not
> >>> evictable and then bypassing TTM in filling and mapping it to the GPU.
> >>>
> >>> That doesn't really makes sense to me, why shouldn't that BO be put in
> >>> the GTT domain then in the first place?
> >> Well I think I figured out what VMWGFX is doing here, but you won't like 
> >> it.
> >>
> >> See VMWGFX doesn't support TTMs GTT domain. So to implement the mob and
> >> otable BOs it is allocating system domain BOs, pinning them and manually
> >> filling them with pages.
> >>
> >> The correct fix would be to audit VMWGFX and fix this handling so that
> >> it doesn't mess any more with TTM internal object state.
> >>
> >> Till that happens we can only revert the patch for now.
> > Probably good to do, at least we know the problem now.
> >
> > However I found myself in the same place yesterday so we should
> > discuss how to fix it going forward.
> >
> > At least on Intel IGPs you have GTT and PPGTT (per-process table). GTT
> > on later hw is only needed for certain objects, like scanout etc. Not
> > every object needs to be in the GTT domain.
>
> We have the same situation on amdgpu. GART objects are only allocated
> for scanout and VMID0 access.
>
> See out amdgpu_gtt_mgr.c.
>
> > But when you get an execbuffer and you want to bind the PPGTT objects,
> > you need to either move the object to the GTT domain pointlessly and
> > suboptimally, since the GTT domain could fill up and start needing
> > evictions.
>
> That is intentional behavior. The GTT domain is the over all memory
> which is currently GPU accessible.
>
> The GART can be much smaller than the GTT domain.
>
> > So the option is to get SYSTEM domain objects, only move them to
> > TTM_PL_TT when pinning for scanout etc, but otherwise generate the
> > pages lists from the objects. In my playing around I've hacked up a TT
> > create/populate path, with no bind.
>
> We already tried this and it turned out to be a bad idea.
>
> See amdgpu_ttm_alloc_gart() how to easily do it with the GTT domain.

Okay I think this needs some commenting. Because it's not immediately
obvious what it means if you have an invalid address here and how that
comes about.

My reading is that you use lpfn to decide if something should be
allocated GTT space at all, and only set lpfn when you have requested
GART space explicitly?

To me it feels like we are working around TTM here, I think this sort
of feature should be more first-class in the TTM API instead of having
every driver write figure it out on a discover your own journey path.

I suppose separating the concept of TTM_PL_TT from the concept of
being bound to a global TT is what we need to do here somehow.

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


Re: [PATCH] gpu: ipu-v3: remove unused functions

2020-08-10 Thread Sam Ravnborg
On Tue, Jul 21, 2020 at 03:05:04PM +0200, Philipp Zabel wrote:
> ipu_mbus_code_to_colorspace, ipu_stride_to_bytes, and
> ipu_pixelformat_is_planar are unused. Remove them.
> 
> Signed-off-by: Philipp Zabel 

git grep agrees with you.

Reviewed-by: Sam Ravnborg 

> ---
>  drivers/gpu/ipu-v3/ipu-common.c | 67 -
>  include/video/imx-ipu-v3.h  |  3 --
>  2 files changed, 70 deletions(-)
> 
> diff --git a/drivers/gpu/ipu-v3/ipu-common.c b/drivers/gpu/ipu-v3/ipu-common.c
> index b3dae9ec1a38..d166ee262ce4 100644
> --- a/drivers/gpu/ipu-v3/ipu-common.c
> +++ b/drivers/gpu/ipu-v3/ipu-common.c
> @@ -133,73 +133,6 @@ enum ipu_color_space ipu_pixelformat_to_colorspace(u32 
> pixelformat)
>  }
>  EXPORT_SYMBOL_GPL(ipu_pixelformat_to_colorspace);
>  
> -bool ipu_pixelformat_is_planar(u32 pixelformat)
> -{
> - switch (pixelformat) {
> - case V4L2_PIX_FMT_YUV420:
> - case V4L2_PIX_FMT_YVU420:
> - case V4L2_PIX_FMT_YUV422P:
> - case V4L2_PIX_FMT_NV12:
> - case V4L2_PIX_FMT_NV21:
> - case V4L2_PIX_FMT_NV16:
> - case V4L2_PIX_FMT_NV61:
> - return true;
> - }
> -
> - return false;
> -}
> -EXPORT_SYMBOL_GPL(ipu_pixelformat_is_planar);
> -
> -enum ipu_color_space ipu_mbus_code_to_colorspace(u32 mbus_code)
> -{
> - switch (mbus_code & 0xf000) {
> - case 0x1000:
> - return IPUV3_COLORSPACE_RGB;
> - case 0x2000:
> - return IPUV3_COLORSPACE_YUV;
> - default:
> - return IPUV3_COLORSPACE_UNKNOWN;
> - }
> -}
> -EXPORT_SYMBOL_GPL(ipu_mbus_code_to_colorspace);
> -
> -int ipu_stride_to_bytes(u32 pixel_stride, u32 pixelformat)
> -{
> - switch (pixelformat) {
> - case V4L2_PIX_FMT_YUV420:
> - case V4L2_PIX_FMT_YVU420:
> - case V4L2_PIX_FMT_YUV422P:
> - case V4L2_PIX_FMT_NV12:
> - case V4L2_PIX_FMT_NV21:
> - case V4L2_PIX_FMT_NV16:
> - case V4L2_PIX_FMT_NV61:
> - /*
> -  * for the planar YUV formats, the stride passed to
> -  * cpmem must be the stride in bytes of the Y plane.
> -  * And all the planar YUV formats have an 8-bit
> -  * Y component.
> -  */
> - return (8 * pixel_stride) >> 3;
> - case V4L2_PIX_FMT_RGB565:
> - case V4L2_PIX_FMT_YUYV:
> - case V4L2_PIX_FMT_UYVY:
> - return (16 * pixel_stride) >> 3;
> - case V4L2_PIX_FMT_BGR24:
> - case V4L2_PIX_FMT_RGB24:
> - return (24 * pixel_stride) >> 3;
> - case V4L2_PIX_FMT_BGR32:
> - case V4L2_PIX_FMT_RGB32:
> - case V4L2_PIX_FMT_XBGR32:
> - case V4L2_PIX_FMT_XRGB32:
> - return (32 * pixel_stride) >> 3;
> - default:
> - break;
> - }
> -
> - return -EINVAL;
> -}
> -EXPORT_SYMBOL_GPL(ipu_stride_to_bytes);
> -
>  int ipu_degrees_to_rot_mode(enum ipu_rotate_mode *mode, int degrees,
>   bool hflip, bool vflip)
>  {
> diff --git a/include/video/imx-ipu-v3.h b/include/video/imx-ipu-v3.h
> index 06b0b57e996c..d1b3889f74d8 100644
> --- a/include/video/imx-ipu-v3.h
> +++ b/include/video/imx-ipu-v3.h
> @@ -484,9 +484,6 @@ int ipu_smfc_set_watermark(struct ipu_smfc *smfc, u32 
> set_level, u32 clr_level);
>  
>  enum ipu_color_space ipu_drm_fourcc_to_colorspace(u32 drm_fourcc);
>  enum ipu_color_space ipu_pixelformat_to_colorspace(u32 pixelformat);
> -enum ipu_color_space ipu_mbus_code_to_colorspace(u32 mbus_code);
> -int ipu_stride_to_bytes(u32 pixel_stride, u32 pixelformat);
> -bool ipu_pixelformat_is_planar(u32 pixelformat);
>  int ipu_degrees_to_rot_mode(enum ipu_rotate_mode *mode, int degrees,
>   bool hflip, bool vflip);
>  int ipu_rot_mode_to_degrees(int *degrees, enum ipu_rotate_mode mode,
> -- 
> 2.20.1
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [linux.git drm/ttm]: NULL pointer dereference upon driver probe

2020-08-10 Thread Christian König

Am 10.08.20 um 20:51 schrieb Dave Airlie:

On Mon, 10 Aug 2020 at 22:20, Christian König  wrote:

Am 07.08.20 um 09:02 schrieb Christian König:

Am 06.08.20 um 20:50 schrieb Roland Scheidegger:

Am 06.08.20 um 17:28 schrieb Christian König:

My best guess is that you are facing two separate bugs here.

Crash #1 is somehow related to CRTCs and might even be cause by the
atomic-helper change you noted below.

Crash #2 is caused because vmw_bo_create_and_populate() tries to
manually populate a BO object instead of relying on TTM to do it when
necessary. This indeed doesn't work any more because of "drm/ttm: make
TT creation purely optional v3".

Question is why vmwgfx is doing this?

Not really sure unfortunately, it's possible vmwgfx is doing it because
ttm lacked some capabilities at some point?

I think so as well, yes.


   Trying to figure this one out...

Problem is that what vmwgfx is doing here is questionable at best.

By definition BOs in the SYSTEM domain are not accessible by the GPU,
even if it is a virtual one.

And what vmwgfx does is allocating one in the SYSTEM domain as not
evictable and then bypassing TTM in filling and mapping it to the GPU.

That doesn't really makes sense to me, why shouldn't that BO be put in
the GTT domain then in the first place?

Well I think I figured out what VMWGFX is doing here, but you won't like it.

See VMWGFX doesn't support TTMs GTT domain. So to implement the mob and
otable BOs it is allocating system domain BOs, pinning them and manually
filling them with pages.

The correct fix would be to audit VMWGFX and fix this handling so that
it doesn't mess any more with TTM internal object state.

Till that happens we can only revert the patch for now.

Probably good to do, at least we know the problem now.

However I found myself in the same place yesterday so we should
discuss how to fix it going forward.

At least on Intel IGPs you have GTT and PPGTT (per-process table). GTT
on later hw is only needed for certain objects, like scanout etc. Not
every object needs to be in the GTT domain.


We have the same situation on amdgpu. GART objects are only allocated 
for scanout and VMID0 access.


See out amdgpu_gtt_mgr.c.


But when you get an execbuffer and you want to bind the PPGTT objects,
you need to either move the object to the GTT domain pointlessly and
suboptimally, since the GTT domain could fill up and start needing
evictions.


That is intentional behavior. The GTT domain is the over all memory 
which is currently GPU accessible.


The GART can be much smaller than the GTT domain.


So the option is to get SYSTEM domain objects, only move them to
TTM_PL_TT when pinning for scanout etc, but otherwise generate the
pages lists from the objects. In my playing around I've hacked up a TT
create/populate path, with no bind.


We already tried this and it turned out to be a bad idea.

See amdgpu_ttm_alloc_gart() how to easily do it with the GTT domain.

Regards,
Christian.



Dave.
I have hardware that has no requirement for all objects to be in the
TT domain, but still has a TT domain.


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


[PATCH AUTOSEL 4.14 15/22] gpu: host1x: debug: Fix multiple channels emitting messages simultaneously

2020-08-10 Thread Sasha Levin
From: Dmitry Osipenko 

[ Upstream commit 35681862808472a0a4b9a8817ae2789c0b5b3edc ]

Once channel's job is hung, it dumps the channel's state into KMSG before
tearing down the offending job. If multiple channels hang at once, then
they dump messages simultaneously, making the debug info unreadable, and
thus, useless. This patch adds mutex which allows only one channel to emit
debug messages at a time.

Signed-off-by: Dmitry Osipenko 
Signed-off-by: Thierry Reding 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/host1x/debug.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/host1x/debug.c b/drivers/gpu/host1x/debug.c
index 2aae0e63214c2..0b8c23c399c2a 100644
--- a/drivers/gpu/host1x/debug.c
+++ b/drivers/gpu/host1x/debug.c
@@ -25,6 +25,8 @@
 #include "debug.h"
 #include "channel.h"
 
+static DEFINE_MUTEX(debug_lock);
+
 unsigned int host1x_debug_trace_cmdbuf;
 
 static pid_t host1x_debug_force_timeout_pid;
@@ -49,12 +51,14 @@ static int show_channel(struct host1x_channel *ch, void 
*data, bool show_fifo)
struct output *o = data;
 
mutex_lock(>cdma.lock);
+   mutex_lock(_lock);
 
if (show_fifo)
host1x_hw_show_channel_fifo(m, ch, o);
 
host1x_hw_show_channel_cdma(m, ch, o);
 
+   mutex_unlock(_lock);
mutex_unlock(>cdma.lock);
 
return 0;
-- 
2.25.1

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


[PATCH AUTOSEL 4.9 01/17] drm/tilcdc: fix leak & null ref in panel_connector_get_modes

2020-08-10 Thread Sasha Levin
From: Tomi Valkeinen 

[ Upstream commit 3f9c1c872cc97875ddc8d63bc9fe6ee13652b933 ]

If videomode_from_timings() returns true, the mode allocated with
drm_mode_create will be leaked.

Also, the return value of drm_mode_create() is never checked, and thus
could cause NULL deref.

Fix these two issues.

Signed-off-by: Tomi Valkeinen 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20200429104234.18910-1-tomi.valkei...@ti.com
Reviewed-by: Jyri Sarha 
Acked-by: Sam Ravnborg 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/tilcdc/tilcdc_panel.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_panel.c 
b/drivers/gpu/drm/tilcdc/tilcdc_panel.c
index 2134bb20fbe9d..2836154dbb126 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_panel.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_panel.c
@@ -159,12 +159,16 @@ static int panel_connector_get_modes(struct drm_connector 
*connector)
int i;
 
for (i = 0; i < timings->num_timings; i++) {
-   struct drm_display_mode *mode = drm_mode_create(dev);
+   struct drm_display_mode *mode;
struct videomode vm;
 
if (videomode_from_timings(timings, , i))
break;
 
+   mode = drm_mode_create(dev);
+   if (!mode)
+   break;
+
drm_display_mode_from_videomode(, mode);
 
mode->type = DRM_MODE_TYPE_DRIVER;
-- 
2.25.1

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


[PATCH AUTOSEL 4.4 01/16] drm/tilcdc: fix leak & null ref in panel_connector_get_modes

2020-08-10 Thread Sasha Levin
From: Tomi Valkeinen 

[ Upstream commit 3f9c1c872cc97875ddc8d63bc9fe6ee13652b933 ]

If videomode_from_timings() returns true, the mode allocated with
drm_mode_create will be leaked.

Also, the return value of drm_mode_create() is never checked, and thus
could cause NULL deref.

Fix these two issues.

Signed-off-by: Tomi Valkeinen 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20200429104234.18910-1-tomi.valkei...@ti.com
Reviewed-by: Jyri Sarha 
Acked-by: Sam Ravnborg 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/tilcdc/tilcdc_panel.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_panel.c 
b/drivers/gpu/drm/tilcdc/tilcdc_panel.c
index 0af8bed7ce1ee..08d8f608be632 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_panel.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_panel.c
@@ -177,12 +177,16 @@ static int panel_connector_get_modes(struct drm_connector 
*connector)
int i;
 
for (i = 0; i < timings->num_timings; i++) {
-   struct drm_display_mode *mode = drm_mode_create(dev);
+   struct drm_display_mode *mode;
struct videomode vm;
 
if (videomode_from_timings(timings, , i))
break;
 
+   mode = drm_mode_create(dev);
+   if (!mode)
+   break;
+
drm_display_mode_from_videomode(, mode);
 
mode->type = DRM_MODE_TYPE_DRIVER;
-- 
2.25.1

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


[PATCH AUTOSEL 4.9 08/17] drm/debugfs: fix plain echo to connector "force" attribute

2020-08-10 Thread Sasha Levin
From: Michael Tretter 

[ Upstream commit c704b17071c4dc571dca3af4e4151dac51de081a ]

Using plain echo to set the "force" connector attribute fails with
-EINVAL, because echo appends a newline to the output.

Replace strcmp with sysfs_streq to also accept strings that end with a
newline.

v2: use sysfs_streq instead of stripping trailing whitespace

Signed-off-by: Michael Tretter 
Reviewed-by: Jani Nikula 
Signed-off-by: Emil Velikov 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20170817104307.17124-1-m.tret...@pengutronix.de
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/drm_debugfs.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
index 1205790ed960c..5ffe4b664cfbf 100644
--- a/drivers/gpu/drm/drm_debugfs.c
+++ b/drivers/gpu/drm/drm_debugfs.c
@@ -287,13 +287,13 @@ static ssize_t connector_write(struct file *file, const 
char __user *ubuf,
 
buf[len] = '\0';
 
-   if (!strcmp(buf, "on"))
+   if (sysfs_streq(buf, "on"))
connector->force = DRM_FORCE_ON;
-   else if (!strcmp(buf, "digital"))
+   else if (sysfs_streq(buf, "digital"))
connector->force = DRM_FORCE_ON_DIGITAL;
-   else if (!strcmp(buf, "off"))
+   else if (sysfs_streq(buf, "off"))
connector->force = DRM_FORCE_OFF;
-   else if (!strcmp(buf, "unspecified"))
+   else if (sysfs_streq(buf, "unspecified"))
connector->force = DRM_FORCE_UNSPECIFIED;
else
return -EINVAL;
-- 
2.25.1

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


[PATCH AUTOSEL 4.4 04/16] drm/radeon: Fix reference count leaks caused by pm_runtime_get_sync

2020-08-10 Thread Sasha Levin
From: Aditya Pakki 

[ Upstream commit 9fb10671011143d15b6b40d6d5fa9c52c57e9d63 ]

On calling pm_runtime_get_sync() the reference count of the device
is incremented. In case of failure, decrement the
reference count before returning the error.

Acked-by: Evan Quan 
Signed-off-by: Aditya Pakki 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/radeon/radeon_display.c | 4 +++-
 drivers/gpu/drm/radeon/radeon_drv.c | 4 +++-
 drivers/gpu/drm/radeon/radeon_kms.c | 4 +++-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_display.c 
b/drivers/gpu/drm/radeon/radeon_display.c
index 4572bfba017c5..17c73b8c90e71 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -660,8 +660,10 @@ radeon_crtc_set_config(struct drm_mode_set *set)
dev = set->crtc->dev;
 
ret = pm_runtime_get_sync(dev->dev);
-   if (ret < 0)
+   if (ret < 0) {
+   pm_runtime_put_autosuspend(dev->dev);
return ret;
+   }
 
ret = drm_crtc_helper_set_config(set);
 
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c 
b/drivers/gpu/drm/radeon/radeon_drv.c
index 5b6a6f5b3619e..401403a3ea50c 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -527,8 +527,10 @@ long radeon_drm_ioctl(struct file *filp,
long ret;
dev = file_priv->minor->dev;
ret = pm_runtime_get_sync(dev->dev);
-   if (ret < 0)
+   if (ret < 0) {
+   pm_runtime_put_autosuspend(dev->dev);
return ret;
+   }
 
ret = drm_ioctl(filp, cmd, arg);

diff --git a/drivers/gpu/drm/radeon/radeon_kms.c 
b/drivers/gpu/drm/radeon/radeon_kms.c
index d290a8a09036e..41caf7da90548 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -631,8 +631,10 @@ int radeon_driver_open_kms(struct drm_device *dev, struct 
drm_file *file_priv)
file_priv->driver_priv = NULL;
 
r = pm_runtime_get_sync(dev->dev);
-   if (r < 0)
+   if (r < 0) {
+   pm_runtime_put_autosuspend(dev->dev);
return r;
+   }
 
/* new gpu have virtual address space support */
if (rdev->family >= CHIP_CAYMAN) {
-- 
2.25.1

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


[PATCH AUTOSEL 4.4 07/16] drm/debugfs: fix plain echo to connector "force" attribute

2020-08-10 Thread Sasha Levin
From: Michael Tretter 

[ Upstream commit c704b17071c4dc571dca3af4e4151dac51de081a ]

Using plain echo to set the "force" connector attribute fails with
-EINVAL, because echo appends a newline to the output.

Replace strcmp with sysfs_streq to also accept strings that end with a
newline.

v2: use sysfs_streq instead of stripping trailing whitespace

Signed-off-by: Michael Tretter 
Reviewed-by: Jani Nikula 
Signed-off-by: Emil Velikov 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20170817104307.17124-1-m.tret...@pengutronix.de
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/drm_debugfs.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
index 3bcf8e6a85b35..5b0fdcd0b63fd 100644
--- a/drivers/gpu/drm/drm_debugfs.c
+++ b/drivers/gpu/drm/drm_debugfs.c
@@ -290,13 +290,13 @@ static ssize_t connector_write(struct file *file, const 
char __user *ubuf,
 
buf[len] = '\0';
 
-   if (!strcmp(buf, "on"))
+   if (sysfs_streq(buf, "on"))
connector->force = DRM_FORCE_ON;
-   else if (!strcmp(buf, "digital"))
+   else if (sysfs_streq(buf, "digital"))
connector->force = DRM_FORCE_ON_DIGITAL;
-   else if (!strcmp(buf, "off"))
+   else if (sysfs_streq(buf, "off"))
connector->force = DRM_FORCE_OFF;
-   else if (!strcmp(buf, "unspecified"))
+   else if (sysfs_streq(buf, "unspecified"))
connector->force = DRM_FORCE_UNSPECIFIED;
else
return -EINVAL;
-- 
2.25.1

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


[PATCH AUTOSEL 4.4 06/16] drm/nouveau: fix multiple instances of reference count leaks

2020-08-10 Thread Sasha Levin
From: Aditya Pakki 

[ Upstream commit 659fb5f154c3434c90a34586f3b7aa1c39cf6062 ]

On calling pm_runtime_get_sync() the reference count of the device
is incremented. In case of failure, decrement the
ref count before returning the error.

Signed-off-by: Aditya Pakki 
Signed-off-by: Ben Skeggs 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/nouveau/nouveau_drm.c | 8 ++--
 drivers/gpu/drm/nouveau/nouveau_gem.c | 4 +++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c 
b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 91a61d2cca889..a90840e391100 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -805,8 +805,10 @@ nouveau_drm_open(struct drm_device *dev, struct drm_file 
*fpriv)
 
/* need to bring up power immediately if opening device */
ret = pm_runtime_get_sync(dev->dev);
-   if (ret < 0 && ret != -EACCES)
+   if (ret < 0 && ret != -EACCES) {
+   pm_runtime_put_autosuspend(dev->dev);
return ret;
+   }
 
get_task_comm(tmpname, current);
snprintf(name, sizeof(name), "%s[%d]", tmpname, pid_nr(fpriv->pid));
@@ -894,8 +896,10 @@ nouveau_drm_ioctl(struct file *file, unsigned int cmd, 
unsigned long arg)
long ret;
 
ret = pm_runtime_get_sync(dev->dev);
-   if (ret < 0 && ret != -EACCES)
+   if (ret < 0 && ret != -EACCES) {
+   pm_runtime_put_autosuspend(dev->dev);
return ret;
+   }
 
switch (_IOC_NR(cmd) - DRM_COMMAND_BASE) {
case DRM_NOUVEAU_NVIF:
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c 
b/drivers/gpu/drm/nouveau/nouveau_gem.c
index ae560f5977fca..e5db2a385cb65 100644
--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
@@ -42,8 +42,10 @@ nouveau_gem_object_del(struct drm_gem_object *gem)
int ret;
 
ret = pm_runtime_get_sync(dev);
-   if (WARN_ON(ret < 0 && ret != -EACCES))
+   if (WARN_ON(ret < 0 && ret != -EACCES)) {
+   pm_runtime_put_autosuspend(dev);
return;
+   }
 
if (gem->import_attach)
drm_prime_gem_destroy(gem, nvbo->bo.sg);
-- 
2.25.1

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


[PATCH AUTOSEL 4.4 05/16] video: fbdev: neofb: fix memory leak in neo_scan_monitor()

2020-08-10 Thread Sasha Levin
From: Evgeny Novikov 

[ Upstream commit edcb3895a751c762a18d25c8d9846ce9759ed7e1 ]

neofb_probe() calls neo_scan_monitor() that can successfully allocate a
memory for info->monspecs.modedb and proceed to case 0x03. There it does
not free the memory and returns -1. neofb_probe() goes to label
err_scan_monitor, thus, it does not free this memory through calling
fb_destroy_modedb() as well. We can not go to label err_init_hw since
neo_scan_monitor() can fail during memory allocation. So, the patch frees
the memory directly for case 0x03.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Evgeny Novikov 
Cc: Jani Nikula 
Cc: Mike Rapoport 
Cc: Daniel Vetter 
Cc: Andrew Morton 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20200630195451.18675-1-novi...@ispras.ru
Signed-off-by: Sasha Levin 
---
 drivers/video/fbdev/neofb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/video/fbdev/neofb.c b/drivers/video/fbdev/neofb.c
index db023a97d1eae..e243254a57214 100644
--- a/drivers/video/fbdev/neofb.c
+++ b/drivers/video/fbdev/neofb.c
@@ -1820,6 +1820,7 @@ static int neo_scan_monitor(struct fb_info *info)
 #else
printk(KERN_ERR
   "neofb: Only 640x480, 800x600/480 and 1024x768 panels 
are currently supported\n");
+   kfree(info->monspecs.modedb);
return -1;
 #endif
default:
-- 
2.25.1

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


[PATCH AUTOSEL 4.9 04/17] drm/radeon: Fix reference count leaks caused by pm_runtime_get_sync

2020-08-10 Thread Sasha Levin
From: Aditya Pakki 

[ Upstream commit 9fb10671011143d15b6b40d6d5fa9c52c57e9d63 ]

On calling pm_runtime_get_sync() the reference count of the device
is incremented. In case of failure, decrement the
reference count before returning the error.

Acked-by: Evan Quan 
Signed-off-by: Aditya Pakki 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/radeon/radeon_display.c | 4 +++-
 drivers/gpu/drm/radeon/radeon_drv.c | 4 +++-
 drivers/gpu/drm/radeon/radeon_kms.c | 4 +++-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_display.c 
b/drivers/gpu/drm/radeon/radeon_display.c
index 432ad7d73cb9b..99e23800cadc7 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -639,8 +639,10 @@ radeon_crtc_set_config(struct drm_mode_set *set)
dev = set->crtc->dev;
 
ret = pm_runtime_get_sync(dev->dev);
-   if (ret < 0)
+   if (ret < 0) {
+   pm_runtime_put_autosuspend(dev->dev);
return ret;
+   }
 
ret = drm_crtc_helper_set_config(set);
 
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c 
b/drivers/gpu/drm/radeon/radeon_drv.c
index 30bd4a6a9d466..7648fd0d10751 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -496,8 +496,10 @@ long radeon_drm_ioctl(struct file *filp,
long ret;
dev = file_priv->minor->dev;
ret = pm_runtime_get_sync(dev->dev);
-   if (ret < 0)
+   if (ret < 0) {
+   pm_runtime_put_autosuspend(dev->dev);
return ret;
+   }
 
ret = drm_ioctl(filp, cmd, arg);

diff --git a/drivers/gpu/drm/radeon/radeon_kms.c 
b/drivers/gpu/drm/radeon/radeon_kms.c
index 4388ddeec8d24..96d2a564d9a3c 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -634,8 +634,10 @@ int radeon_driver_open_kms(struct drm_device *dev, struct 
drm_file *file_priv)
file_priv->driver_priv = NULL;
 
r = pm_runtime_get_sync(dev->dev);
-   if (r < 0)
+   if (r < 0) {
+   pm_runtime_put_autosuspend(dev->dev);
return r;
+   }
 
/* new gpu have virtual address space support */
if (rdev->family >= CHIP_CAYMAN) {
-- 
2.25.1

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


[PATCH AUTOSEL 4.9 05/17] video: fbdev: neofb: fix memory leak in neo_scan_monitor()

2020-08-10 Thread Sasha Levin
From: Evgeny Novikov 

[ Upstream commit edcb3895a751c762a18d25c8d9846ce9759ed7e1 ]

neofb_probe() calls neo_scan_monitor() that can successfully allocate a
memory for info->monspecs.modedb and proceed to case 0x03. There it does
not free the memory and returns -1. neofb_probe() goes to label
err_scan_monitor, thus, it does not free this memory through calling
fb_destroy_modedb() as well. We can not go to label err_init_hw since
neo_scan_monitor() can fail during memory allocation. So, the patch frees
the memory directly for case 0x03.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Evgeny Novikov 
Cc: Jani Nikula 
Cc: Mike Rapoport 
Cc: Daniel Vetter 
Cc: Andrew Morton 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20200630195451.18675-1-novi...@ispras.ru
Signed-off-by: Sasha Levin 
---
 drivers/video/fbdev/neofb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/video/fbdev/neofb.c b/drivers/video/fbdev/neofb.c
index db023a97d1eae..e243254a57214 100644
--- a/drivers/video/fbdev/neofb.c
+++ b/drivers/video/fbdev/neofb.c
@@ -1820,6 +1820,7 @@ static int neo_scan_monitor(struct fb_info *info)
 #else
printk(KERN_ERR
   "neofb: Only 640x480, 800x600/480 and 1024x768 panels 
are currently supported\n");
+   kfree(info->monspecs.modedb);
return -1;
 #endif
default:
-- 
2.25.1

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


[PATCH AUTOSEL 4.9 07/17] drm/nouveau: fix multiple instances of reference count leaks

2020-08-10 Thread Sasha Levin
From: Aditya Pakki 

[ Upstream commit 659fb5f154c3434c90a34586f3b7aa1c39cf6062 ]

On calling pm_runtime_get_sync() the reference count of the device
is incremented. In case of failure, decrement the
ref count before returning the error.

Signed-off-by: Aditya Pakki 
Signed-off-by: Ben Skeggs 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/nouveau/nouveau_drm.c | 8 ++--
 drivers/gpu/drm/nouveau/nouveau_gem.c | 4 +++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c 
b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 42829a942e33c..4e12d3d59651b 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -823,8 +823,10 @@ nouveau_drm_open(struct drm_device *dev, struct drm_file 
*fpriv)
 
/* need to bring up power immediately if opening device */
ret = pm_runtime_get_sync(dev->dev);
-   if (ret < 0 && ret != -EACCES)
+   if (ret < 0 && ret != -EACCES) {
+   pm_runtime_put_autosuspend(dev->dev);
return ret;
+   }
 
get_task_comm(tmpname, current);
snprintf(name, sizeof(name), "%s[%d]", tmpname, pid_nr(fpriv->pid));
@@ -912,8 +914,10 @@ nouveau_drm_ioctl(struct file *file, unsigned int cmd, 
unsigned long arg)
long ret;
 
ret = pm_runtime_get_sync(dev->dev);
-   if (ret < 0 && ret != -EACCES)
+   if (ret < 0 && ret != -EACCES) {
+   pm_runtime_put_autosuspend(dev->dev);
return ret;
+   }
 
switch (_IOC_NR(cmd) - DRM_COMMAND_BASE) {
case DRM_NOUVEAU_NVIF:
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c 
b/drivers/gpu/drm/nouveau/nouveau_gem.c
index 505dca48b9f80..be6672da33a65 100644
--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
@@ -42,8 +42,10 @@ nouveau_gem_object_del(struct drm_gem_object *gem)
int ret;
 
ret = pm_runtime_get_sync(dev);
-   if (WARN_ON(ret < 0 && ret != -EACCES))
+   if (WARN_ON(ret < 0 && ret != -EACCES)) {
+   pm_runtime_put_autosuspend(dev);
return;
+   }
 
if (gem->import_attach)
drm_prime_gem_destroy(gem, nvbo->bo.sg);
-- 
2.25.1

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


[PATCH AUTOSEL 4.19 23/31] gpu: host1x: debug: Fix multiple channels emitting messages simultaneously

2020-08-10 Thread Sasha Levin
From: Dmitry Osipenko 

[ Upstream commit 35681862808472a0a4b9a8817ae2789c0b5b3edc ]

Once channel's job is hung, it dumps the channel's state into KMSG before
tearing down the offending job. If multiple channels hang at once, then
they dump messages simultaneously, making the debug info unreadable, and
thus, useless. This patch adds mutex which allows only one channel to emit
debug messages at a time.

Signed-off-by: Dmitry Osipenko 
Signed-off-by: Thierry Reding 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/host1x/debug.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/host1x/debug.c b/drivers/gpu/host1x/debug.c
index 329e4a3d8ae7b..6c9ad4533999c 100644
--- a/drivers/gpu/host1x/debug.c
+++ b/drivers/gpu/host1x/debug.c
@@ -25,6 +25,8 @@
 #include "debug.h"
 #include "channel.h"
 
+static DEFINE_MUTEX(debug_lock);
+
 unsigned int host1x_debug_trace_cmdbuf;
 
 static pid_t host1x_debug_force_timeout_pid;
@@ -61,12 +63,14 @@ static int show_channel(struct host1x_channel *ch, void 
*data, bool show_fifo)
struct output *o = data;
 
mutex_lock(>cdma.lock);
+   mutex_lock(_lock);
 
if (show_fifo)
host1x_hw_show_channel_fifo(m, ch, o);
 
host1x_hw_show_channel_cdma(m, ch, o);
 
+   mutex_unlock(_lock);
mutex_unlock(>cdma.lock);
 
return 0;
-- 
2.25.1

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


[PATCH AUTOSEL 4.14 09/22] drm/debugfs: fix plain echo to connector "force" attribute

2020-08-10 Thread Sasha Levin
From: Michael Tretter 

[ Upstream commit c704b17071c4dc571dca3af4e4151dac51de081a ]

Using plain echo to set the "force" connector attribute fails with
-EINVAL, because echo appends a newline to the output.

Replace strcmp with sysfs_streq to also accept strings that end with a
newline.

v2: use sysfs_streq instead of stripping trailing whitespace

Signed-off-by: Michael Tretter 
Reviewed-by: Jani Nikula 
Signed-off-by: Emil Velikov 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20170817104307.17124-1-m.tret...@pengutronix.de
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/drm_debugfs.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
index c1807d5754b2a..454deba13ee5b 100644
--- a/drivers/gpu/drm/drm_debugfs.c
+++ b/drivers/gpu/drm/drm_debugfs.c
@@ -250,13 +250,13 @@ static ssize_t connector_write(struct file *file, const 
char __user *ubuf,
 
buf[len] = '\0';
 
-   if (!strcmp(buf, "on"))
+   if (sysfs_streq(buf, "on"))
connector->force = DRM_FORCE_ON;
-   else if (!strcmp(buf, "digital"))
+   else if (sysfs_streq(buf, "digital"))
connector->force = DRM_FORCE_ON_DIGITAL;
-   else if (!strcmp(buf, "off"))
+   else if (sysfs_streq(buf, "off"))
connector->force = DRM_FORCE_OFF;
-   else if (!strcmp(buf, "unspecified"))
+   else if (sysfs_streq(buf, "unspecified"))
connector->force = DRM_FORCE_UNSPECIFIED;
else
return -EINVAL;
-- 
2.25.1

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


[PATCH AUTOSEL 4.14 05/22] video: fbdev: neofb: fix memory leak in neo_scan_monitor()

2020-08-10 Thread Sasha Levin
From: Evgeny Novikov 

[ Upstream commit edcb3895a751c762a18d25c8d9846ce9759ed7e1 ]

neofb_probe() calls neo_scan_monitor() that can successfully allocate a
memory for info->monspecs.modedb and proceed to case 0x03. There it does
not free the memory and returns -1. neofb_probe() goes to label
err_scan_monitor, thus, it does not free this memory through calling
fb_destroy_modedb() as well. We can not go to label err_init_hw since
neo_scan_monitor() can fail during memory allocation. So, the patch frees
the memory directly for case 0x03.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Evgeny Novikov 
Cc: Jani Nikula 
Cc: Mike Rapoport 
Cc: Daniel Vetter 
Cc: Andrew Morton 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20200630195451.18675-1-novi...@ispras.ru
Signed-off-by: Sasha Levin 
---
 drivers/video/fbdev/neofb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/video/fbdev/neofb.c b/drivers/video/fbdev/neofb.c
index 5d3a444083f74..2018e1ca33eb6 100644
--- a/drivers/video/fbdev/neofb.c
+++ b/drivers/video/fbdev/neofb.c
@@ -1820,6 +1820,7 @@ static int neo_scan_monitor(struct fb_info *info)
 #else
printk(KERN_ERR
   "neofb: Only 640x480, 800x600/480 and 1024x768 panels 
are currently supported\n");
+   kfree(info->monspecs.modedb);
return -1;
 #endif
default:
-- 
2.25.1

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


[PATCH AUTOSEL 4.14 08/22] drm/nouveau: fix multiple instances of reference count leaks

2020-08-10 Thread Sasha Levin
From: Aditya Pakki 

[ Upstream commit 659fb5f154c3434c90a34586f3b7aa1c39cf6062 ]

On calling pm_runtime_get_sync() the reference count of the device
is incremented. In case of failure, decrement the
ref count before returning the error.

Signed-off-by: Aditya Pakki 
Signed-off-by: Ben Skeggs 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/nouveau/nouveau_drm.c | 8 ++--
 drivers/gpu/drm/nouveau/nouveau_gem.c | 4 +++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c 
b/drivers/gpu/drm/nouveau/nouveau_drm.c
index d00524a5d7f08..fb6b1d0f7fef3 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -840,8 +840,10 @@ nouveau_drm_open(struct drm_device *dev, struct drm_file 
*fpriv)
 
/* need to bring up power immediately if opening device */
ret = pm_runtime_get_sync(dev->dev);
-   if (ret < 0 && ret != -EACCES)
+   if (ret < 0 && ret != -EACCES) {
+   pm_runtime_put_autosuspend(dev->dev);
return ret;
+   }
 
get_task_comm(tmpname, current);
snprintf(name, sizeof(name), "%s[%d]", tmpname, pid_nr(fpriv->pid));
@@ -930,8 +932,10 @@ nouveau_drm_ioctl(struct file *file, unsigned int cmd, 
unsigned long arg)
long ret;
 
ret = pm_runtime_get_sync(dev->dev);
-   if (ret < 0 && ret != -EACCES)
+   if (ret < 0 && ret != -EACCES) {
+   pm_runtime_put_autosuspend(dev->dev);
return ret;
+   }
 
switch (_IOC_NR(cmd) - DRM_COMMAND_BASE) {
case DRM_NOUVEAU_NVIF:
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c 
b/drivers/gpu/drm/nouveau/nouveau_gem.c
index 60ffb70bb9089..c6149b5be073e 100644
--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
@@ -42,8 +42,10 @@ nouveau_gem_object_del(struct drm_gem_object *gem)
int ret;
 
ret = pm_runtime_get_sync(dev);
-   if (WARN_ON(ret < 0 && ret != -EACCES))
+   if (WARN_ON(ret < 0 && ret != -EACCES)) {
+   pm_runtime_put_autosuspend(dev);
return;
+   }
 
if (gem->import_attach)
drm_prime_gem_destroy(gem, nvbo->bo.sg);
-- 
2.25.1

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


[PATCH AUTOSEL 4.14 04/22] drm/radeon: Fix reference count leaks caused by pm_runtime_get_sync

2020-08-10 Thread Sasha Levin
From: Aditya Pakki 

[ Upstream commit 9fb10671011143d15b6b40d6d5fa9c52c57e9d63 ]

On calling pm_runtime_get_sync() the reference count of the device
is incremented. In case of failure, decrement the
reference count before returning the error.

Acked-by: Evan Quan 
Signed-off-by: Aditya Pakki 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/radeon/radeon_display.c | 4 +++-
 drivers/gpu/drm/radeon/radeon_drv.c | 4 +++-
 drivers/gpu/drm/radeon/radeon_kms.c | 4 +++-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_display.c 
b/drivers/gpu/drm/radeon/radeon_display.c
index d86110cdf0852..b2334349799d1 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -627,8 +627,10 @@ radeon_crtc_set_config(struct drm_mode_set *set,
dev = set->crtc->dev;
 
ret = pm_runtime_get_sync(dev->dev);
-   if (ret < 0)
+   if (ret < 0) {
+   pm_runtime_put_autosuspend(dev->dev);
return ret;
+   }
 
ret = drm_crtc_helper_set_config(set, ctx);
 
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c 
b/drivers/gpu/drm/radeon/radeon_drv.c
index f6908e2f9e55a..41e8abd099784 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -496,8 +496,10 @@ long radeon_drm_ioctl(struct file *filp,
long ret;
dev = file_priv->minor->dev;
ret = pm_runtime_get_sync(dev->dev);
-   if (ret < 0)
+   if (ret < 0) {
+   pm_runtime_put_autosuspend(dev->dev);
return ret;
+   }
 
ret = drm_ioctl(filp, cmd, arg);

diff --git a/drivers/gpu/drm/radeon/radeon_kms.c 
b/drivers/gpu/drm/radeon/radeon_kms.c
index dfee8f7d94ae5..2e28cf8118404 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -659,8 +659,10 @@ int radeon_driver_open_kms(struct drm_device *dev, struct 
drm_file *file_priv)
file_priv->driver_priv = NULL;
 
r = pm_runtime_get_sync(dev->dev);
-   if (r < 0)
+   if (r < 0) {
+   pm_runtime_put_autosuspend(dev->dev);
return r;
+   }
 
/* new gpu have virtual address space support */
if (rdev->family >= CHIP_CAYMAN) {
-- 
2.25.1

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


[PATCH AUTOSEL 4.14 01/22] drm/tilcdc: fix leak & null ref in panel_connector_get_modes

2020-08-10 Thread Sasha Levin
From: Tomi Valkeinen 

[ Upstream commit 3f9c1c872cc97875ddc8d63bc9fe6ee13652b933 ]

If videomode_from_timings() returns true, the mode allocated with
drm_mode_create will be leaked.

Also, the return value of drm_mode_create() is never checked, and thus
could cause NULL deref.

Fix these two issues.

Signed-off-by: Tomi Valkeinen 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20200429104234.18910-1-tomi.valkei...@ti.com
Reviewed-by: Jyri Sarha 
Acked-by: Sam Ravnborg 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/tilcdc/tilcdc_panel.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_panel.c 
b/drivers/gpu/drm/tilcdc/tilcdc_panel.c
index 1813a3623ce60..0484b2cf0e2b5 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_panel.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_panel.c
@@ -152,12 +152,16 @@ static int panel_connector_get_modes(struct drm_connector 
*connector)
int i;
 
for (i = 0; i < timings->num_timings; i++) {
-   struct drm_display_mode *mode = drm_mode_create(dev);
+   struct drm_display_mode *mode;
struct videomode vm;
 
if (videomode_from_timings(timings, , i))
break;
 
+   mode = drm_mode_create(dev);
+   if (!mode)
+   break;
+
drm_display_mode_from_videomode(, mode);
 
mode->type = DRM_MODE_TYPE_DRIVER;
-- 
2.25.1

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


[PATCH AUTOSEL 4.19 31/31] drm/msm: ratelimit crtc event overflow error

2020-08-10 Thread Sasha Levin
From: Rob Clark 

[ Upstream commit 5e16372b5940b1fecc3cc887fc02a50ba148d373 ]

This can happen a lot when things go pear shaped.  Lets not flood dmesg
when this happens.

Signed-off-by: Rob Clark 
Reviewed-by: Abhinav Kumar 
Signed-off-by: Rob Clark 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index 4752f08f0884c..3c3b7f7013e87 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -659,7 +659,7 @@ static void dpu_crtc_frame_event_cb(void *data, u32 event)
spin_unlock_irqrestore(_crtc->spin_lock, flags);
 
if (!fevent) {
-   DRM_ERROR("crtc%d event %d overflow\n", crtc->base.id, event);
+   DRM_ERROR_RATELIMITED("crtc%d event %d overflow\n", 
crtc->base.id, event);
return;
}
 
-- 
2.25.1

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


[PATCH AUTOSEL 4.19 16/31] drm/radeon: disable AGP by default

2020-08-10 Thread Sasha Levin
From: Christian König 

[ Upstream commit ba806f98f868ce107aa9c453fef751de9980e4af ]

Always use the PCI GART instead. We just have to many cases
where AGP still causes problems. This means a performance
regression for some GPUs, but also a bug fix for some others.

Signed-off-by: Christian König 
Reviewed-by: Alex Deucher 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/radeon/radeon_drv.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_drv.c 
b/drivers/gpu/drm/radeon/radeon_drv.c
index 54729acd0d4af..0cd33289c2b63 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -168,12 +168,7 @@ int radeon_no_wb;
 int radeon_modeset = -1;
 int radeon_dynclks = -1;
 int radeon_r4xx_atom = 0;
-#ifdef __powerpc__
-/* Default to PCI on PowerPC (fdo #95017) */
 int radeon_agpmode = -1;
-#else
-int radeon_agpmode = 0;
-#endif
 int radeon_vram_limit = 0;
 int radeon_gart_size = -1; /* auto */
 int radeon_benchmarking = 0;
-- 
2.25.1

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


[PATCH AUTOSEL 4.19 15/31] drm/debugfs: fix plain echo to connector "force" attribute

2020-08-10 Thread Sasha Levin
From: Michael Tretter 

[ Upstream commit c704b17071c4dc571dca3af4e4151dac51de081a ]

Using plain echo to set the "force" connector attribute fails with
-EINVAL, because echo appends a newline to the output.

Replace strcmp with sysfs_streq to also accept strings that end with a
newline.

v2: use sysfs_streq instead of stripping trailing whitespace

Signed-off-by: Michael Tretter 
Reviewed-by: Jani Nikula 
Signed-off-by: Emil Velikov 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20170817104307.17124-1-m.tret...@pengutronix.de
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/drm_debugfs.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
index 373bd4c2b698b..84b7b22a9590a 100644
--- a/drivers/gpu/drm/drm_debugfs.c
+++ b/drivers/gpu/drm/drm_debugfs.c
@@ -265,13 +265,13 @@ static ssize_t connector_write(struct file *file, const 
char __user *ubuf,
 
buf[len] = '\0';
 
-   if (!strcmp(buf, "on"))
+   if (sysfs_streq(buf, "on"))
connector->force = DRM_FORCE_ON;
-   else if (!strcmp(buf, "digital"))
+   else if (sysfs_streq(buf, "digital"))
connector->force = DRM_FORCE_ON_DIGITAL;
-   else if (!strcmp(buf, "off"))
+   else if (sysfs_streq(buf, "off"))
connector->force = DRM_FORCE_OFF;
-   else if (!strcmp(buf, "unspecified"))
+   else if (sysfs_streq(buf, "unspecified"))
connector->force = DRM_FORCE_UNSPECIFIED;
else
return -EINVAL;
-- 
2.25.1

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


[PATCH AUTOSEL 4.19 13/31] drm/nouveau: fix multiple instances of reference count leaks

2020-08-10 Thread Sasha Levin
From: Aditya Pakki 

[ Upstream commit 659fb5f154c3434c90a34586f3b7aa1c39cf6062 ]

On calling pm_runtime_get_sync() the reference count of the device
is incremented. In case of failure, decrement the
ref count before returning the error.

Signed-off-by: Aditya Pakki 
Signed-off-by: Ben Skeggs 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/nouveau/nouveau_drm.c | 8 ++--
 drivers/gpu/drm/nouveau/nouveau_gem.c | 4 +++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c 
b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 2b7a54cc3c9ef..81999bed1e4a5 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -899,8 +899,10 @@ nouveau_drm_open(struct drm_device *dev, struct drm_file 
*fpriv)
 
/* need to bring up power immediately if opening device */
ret = pm_runtime_get_sync(dev->dev);
-   if (ret < 0 && ret != -EACCES)
+   if (ret < 0 && ret != -EACCES) {
+   pm_runtime_put_autosuspend(dev->dev);
return ret;
+   }
 
get_task_comm(tmpname, current);
snprintf(name, sizeof(name), "%s[%d]", tmpname, pid_nr(fpriv->pid));
@@ -980,8 +982,10 @@ nouveau_drm_ioctl(struct file *file, unsigned int cmd, 
unsigned long arg)
long ret;
 
ret = pm_runtime_get_sync(dev->dev);
-   if (ret < 0 && ret != -EACCES)
+   if (ret < 0 && ret != -EACCES) {
+   pm_runtime_put_autosuspend(dev->dev);
return ret;
+   }
 
switch (_IOC_NR(cmd) - DRM_COMMAND_BASE) {
case DRM_NOUVEAU_NVIF:
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c 
b/drivers/gpu/drm/nouveau/nouveau_gem.c
index b56524d343c3e..791f970714ed6 100644
--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
@@ -46,8 +46,10 @@ nouveau_gem_object_del(struct drm_gem_object *gem)
int ret;
 
ret = pm_runtime_get_sync(dev);
-   if (WARN_ON(ret < 0 && ret != -EACCES))
+   if (WARN_ON(ret < 0 && ret != -EACCES)) {
+   pm_runtime_put_autosuspend(dev);
return;
+   }
 
if (gem->import_attach)
drm_prime_gem_destroy(gem, nvbo->bo.sg);
-- 
2.25.1

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


[PATCH AUTOSEL 4.19 12/31] drm/etnaviv: fix ref count leak via pm_runtime_get_sync

2020-08-10 Thread Sasha Levin
From: Navid Emamdoost 

[ Upstream commit c5d5a32ead1e3a61a07a1e59eb52a53e4a6b2a7f ]

in etnaviv_gpu_submit, etnaviv_gpu_recover_hang, etnaviv_gpu_debugfs,
and etnaviv_gpu_init the call to pm_runtime_get_sync increments the
counter even in case of failure, leading to incorrect ref count.
In case of failure, decrement the ref count before returning.

Signed-off-by: Navid Emamdoost 
Signed-off-by: Lucas Stach 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c 
b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
index 6a859e077ea02..f17fbe6ff7c74 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
@@ -694,7 +694,7 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
ret = pm_runtime_get_sync(gpu->dev);
if (ret < 0) {
dev_err(gpu->dev, "Failed to enable GPU power domain\n");
-   return ret;
+   goto pm_put;
}
 
etnaviv_hw_identify(gpu);
@@ -808,6 +808,7 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
gpu->mmu = NULL;
 fail:
pm_runtime_mark_last_busy(gpu->dev);
+pm_put:
pm_runtime_put_autosuspend(gpu->dev);
 
return ret;
@@ -848,7 +849,7 @@ int etnaviv_gpu_debugfs(struct etnaviv_gpu *gpu, struct 
seq_file *m)
 
ret = pm_runtime_get_sync(gpu->dev);
if (ret < 0)
-   return ret;
+   goto pm_put;
 
dma_lo = gpu_read(gpu, VIVS_FE_DMA_LOW);
dma_hi = gpu_read(gpu, VIVS_FE_DMA_HIGH);
@@ -971,6 +972,7 @@ int etnaviv_gpu_debugfs(struct etnaviv_gpu *gpu, struct 
seq_file *m)
ret = 0;
 
pm_runtime_mark_last_busy(gpu->dev);
+pm_put:
pm_runtime_put_autosuspend(gpu->dev);
 
return ret;
@@ -985,7 +987,7 @@ void etnaviv_gpu_recover_hang(struct etnaviv_gpu *gpu)
dev_err(gpu->dev, "recover hung GPU!\n");
 
if (pm_runtime_get_sync(gpu->dev) < 0)
-   return;
+   goto pm_put;
 
mutex_lock(>lock);
 
@@ -1005,6 +1007,7 @@ void etnaviv_gpu_recover_hang(struct etnaviv_gpu *gpu)
 
mutex_unlock(>lock);
pm_runtime_mark_last_busy(gpu->dev);
+pm_put:
pm_runtime_put_autosuspend(gpu->dev);
 }
 
@@ -1278,8 +1281,10 @@ struct dma_fence *etnaviv_gpu_submit(struct 
etnaviv_gem_submit *submit)
 
if (!submit->runtime_resumed) {
ret = pm_runtime_get_sync(gpu->dev);
-   if (ret < 0)
+   if (ret < 0) {
+   pm_runtime_put_noidle(gpu->dev);
return NULL;
+   }
submit->runtime_resumed = true;
}
 
@@ -1296,6 +1301,7 @@ struct dma_fence *etnaviv_gpu_submit(struct 
etnaviv_gem_submit *submit)
ret = event_alloc(gpu, nr_events, event);
if (ret) {
DRM_ERROR("no free events\n");
+   pm_runtime_put_noidle(gpu->dev);
return NULL;
}
 
-- 
2.25.1

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


[PATCH AUTOSEL 4.19 09/31] video: fbdev: neofb: fix memory leak in neo_scan_monitor()

2020-08-10 Thread Sasha Levin
From: Evgeny Novikov 

[ Upstream commit edcb3895a751c762a18d25c8d9846ce9759ed7e1 ]

neofb_probe() calls neo_scan_monitor() that can successfully allocate a
memory for info->monspecs.modedb and proceed to case 0x03. There it does
not free the memory and returns -1. neofb_probe() goes to label
err_scan_monitor, thus, it does not free this memory through calling
fb_destroy_modedb() as well. We can not go to label err_init_hw since
neo_scan_monitor() can fail during memory allocation. So, the patch frees
the memory directly for case 0x03.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Evgeny Novikov 
Cc: Jani Nikula 
Cc: Mike Rapoport 
Cc: Daniel Vetter 
Cc: Andrew Morton 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20200630195451.18675-1-novi...@ispras.ru
Signed-off-by: Sasha Levin 
---
 drivers/video/fbdev/neofb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/video/fbdev/neofb.c b/drivers/video/fbdev/neofb.c
index 5d3a444083f74..2018e1ca33eb6 100644
--- a/drivers/video/fbdev/neofb.c
+++ b/drivers/video/fbdev/neofb.c
@@ -1820,6 +1820,7 @@ static int neo_scan_monitor(struct fb_info *info)
 #else
printk(KERN_ERR
   "neofb: Only 640x480, 800x600/480 and 1024x768 panels 
are currently supported\n");
+   kfree(info->monspecs.modedb);
return -1;
 #endif
default:
-- 
2.25.1

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


[PATCH AUTOSEL 4.19 06/31] drm/amdgpu: avoid dereferencing a NULL pointer

2020-08-10 Thread Sasha Levin
From: Jack Xiao 

[ Upstream commit 55611b507fd6453d26030c0c0619fdf0c262766d ]

Check if irq_src is NULL to avoid dereferencing a NULL pointer,
for MES ring is uneccessary to recieve an interrupt notification.

Signed-off-by: Jack Xiao 
Acked-by: Alex Deucher 
Reviewed-by: Hawking Zhang 
Reviewed-by: Christian König 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 19 ---
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
index 869ff624b108c..e5e51e4d4f3d8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
@@ -396,7 +396,9 @@ int amdgpu_fence_driver_start_ring(struct amdgpu_ring *ring,
ring->fence_drv.gpu_addr = adev->uvd.inst[ring->me].gpu_addr + 
index;
}
amdgpu_fence_write(ring, atomic_read(>fence_drv.last_seq));
-   amdgpu_irq_get(adev, irq_src, irq_type);
+
+   if (irq_src)
+   amdgpu_irq_get(adev, irq_src, irq_type);
 
ring->fence_drv.irq_src = irq_src;
ring->fence_drv.irq_type = irq_type;
@@ -508,8 +510,9 @@ void amdgpu_fence_driver_fini(struct amdgpu_device *adev)
/* no need to trigger GPU reset as we are unloading */
amdgpu_fence_driver_force_completion(ring);
}
-   amdgpu_irq_put(adev, ring->fence_drv.irq_src,
-  ring->fence_drv.irq_type);
+   if (ring->fence_drv.irq_src)
+   amdgpu_irq_put(adev, ring->fence_drv.irq_src,
+  ring->fence_drv.irq_type);
drm_sched_fini(>sched);
del_timer_sync(>fence_drv.fallback_timer);
for (j = 0; j <= ring->fence_drv.num_fences_mask; ++j)
@@ -545,8 +548,9 @@ void amdgpu_fence_driver_suspend(struct amdgpu_device *adev)
}
 
/* disable the interrupt */
-   amdgpu_irq_put(adev, ring->fence_drv.irq_src,
-  ring->fence_drv.irq_type);
+   if (ring->fence_drv.irq_src)
+   amdgpu_irq_put(adev, ring->fence_drv.irq_src,
+  ring->fence_drv.irq_type);
}
 }
 
@@ -572,8 +576,9 @@ void amdgpu_fence_driver_resume(struct amdgpu_device *adev)
continue;
 
/* enable the interrupt */
-   amdgpu_irq_get(adev, ring->fence_drv.irq_src,
-  ring->fence_drv.irq_type);
+   if (ring->fence_drv.irq_src)
+   amdgpu_irq_get(adev, ring->fence_drv.irq_src,
+  ring->fence_drv.irq_type);
}
 }
 
-- 
2.25.1

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


[PATCH AUTOSEL 5.4 22/45] drm/msm: Fix a null pointer access in msm_gem_shrinker_count()

2020-08-10 Thread Sasha Levin
From: Akhil P Oommen 

[ Upstream commit 3cbdc8d8b7f39a7af3ea7b8dfa75caaebfda4e56 ]

Adding an msm_gem_object object to the inactive_list before completing
its initialization is a bad idea because shrinker may pick it up from the
inactive_list. Fix this by making sure that the initialization is complete
before moving the msm_obj object to the inactive list.

This patch fixes the below error:
[10027.553044] Unable to handle kernel NULL pointer dereference at virtual 
address 0068
[10027.573305] Mem abort info:
[10027.590160]   ESR = 0x9606
[10027.597905]   EC = 0x25: DABT (current EL), IL = 32 bits
[10027.614430]   SET = 0, FnV = 0
[10027.624427]   EA = 0, S1PTW = 0
[10027.632722] Data abort info:
[10027.638039]   ISV = 0, ISS = 0x0006
[10027.647459]   CM = 0, WnR = 0
[10027.654345] user pgtable: 4k pages, 39-bit VAs, pgdp=0001e3a6a000
[10027.672681] [0068] pgd=000198c31003, pud=000198c31003, 
pmd=
[10027.693900] Internal error: Oops: 9606 [#1] PREEMPT SMP
[10027.738261] CPU: 3 PID: 214 Comm: kswapd0 Tainted: G S5.4.40 
#1
[10027.745766] Hardware name: Qualcomm Technologies, Inc. SC7180 IDP (DT)
[10027.752472] pstate: 80c9 (Nzcv daif +PAN +UAO)
[10027.757409] pc : mutex_is_locked+0x14/0x2c
[10027.761626] lr : msm_gem_shrinker_count+0x70/0xec
[10027.766454] sp : ffc011323ad0
[10027.769867] x29: ffc011323ad0 x28: ffe677e4b878
[10027.775324] x27: 0cc0 x26: 
[10027.780783] x25: ff817114a708 x24: 0008
[10027.786242] x23: ff8023ab7170 x22: 0001
[10027.791701] x21: ff817114a080 x20: 0119
[10027.797160] x19: 0068 x18: 03bc
[10027.802621] x17: 04a34210 x16: 00c0
[10027.808083] x15:  x14: 
[10027.813542] x13: ffe677e0a3c0 x12: 
[10027.819000] x11:  x10: ff8174b94340
[10027.824461] x9 :  x8 : 
[10027.829919] x7 : 01fc x6 : ffc011323c88
[10027.835373] x5 : 0001 x4 : ffc011323d80
[10027.840832] x3 : 0477b348 x2 : 
[10027.846290] x1 : ffc011323b68 x0 : 0068
[10027.851748] Call trace:
[10027.854264]  mutex_is_locked+0x14/0x2c
[10027.858121]  msm_gem_shrinker_count+0x70/0xec
[10027.862603]  shrink_slab+0xc0/0x4b4
[10027.866187]  shrink_node+0x4a8/0x818
[10027.869860]  kswapd+0x624/0x890
[10027.873097]  kthread+0x11c/0x12c
[10027.876424]  ret_from_fork+0x10/0x18
[10027.880102] Code: f9000bf3 910003fd aa0003f3 d503201f (f9400268)
[10027.886362] ---[ end trace df5849a1a3543251 ]---
[10027.891518] Kernel panic - not syncing: Fatal exception

Signed-off-by: Akhil P Oommen 
Signed-off-by: Rob Clark 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/msm/msm_gem.c | 36 ---
 1 file changed, 21 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c
index 5a6a79fbc9d6e..d92a0ffe2a767 100644
--- a/drivers/gpu/drm/msm/msm_gem.c
+++ b/drivers/gpu/drm/msm/msm_gem.c
@@ -977,10 +977,8 @@ int msm_gem_new_handle(struct drm_device *dev, struct 
drm_file *file,
 
 static int msm_gem_new_impl(struct drm_device *dev,
uint32_t size, uint32_t flags,
-   struct drm_gem_object **obj,
-   bool struct_mutex_locked)
+   struct drm_gem_object **obj)
 {
-   struct msm_drm_private *priv = dev->dev_private;
struct msm_gem_object *msm_obj;
 
switch (flags & MSM_BO_CACHE_MASK) {
@@ -1006,15 +1004,6 @@ static int msm_gem_new_impl(struct drm_device *dev,
INIT_LIST_HEAD(_obj->submit_entry);
INIT_LIST_HEAD(_obj->vmas);
 
-   if (struct_mutex_locked) {
-   WARN_ON(!mutex_is_locked(>struct_mutex));
-   list_add_tail(_obj->mm_list, >inactive_list);
-   } else {
-   mutex_lock(>struct_mutex);
-   list_add_tail(_obj->mm_list, >inactive_list);
-   mutex_unlock(>struct_mutex);
-   }
-
*obj = _obj->base;
 
return 0;
@@ -1024,6 +1013,7 @@ static struct drm_gem_object *_msm_gem_new(struct 
drm_device *dev,
uint32_t size, uint32_t flags, bool struct_mutex_locked)
 {
struct msm_drm_private *priv = dev->dev_private;
+   struct msm_gem_object *msm_obj;
struct drm_gem_object *obj = NULL;
bool use_vram = false;
int ret;
@@ -1044,14 +1034,15 @@ static struct drm_gem_object *_msm_gem_new(struct 
drm_device *dev,
if (size == 0)
return ERR_PTR(-EINVAL);
 
-   ret = msm_gem_new_impl(dev, size, flags, , struct_mutex_locked);
+   ret = msm_gem_new_impl(dev, size, flags, );
if (ret)
goto fail;
 
+   msm_obj = to_msm_bo(obj);
+
if (use_vram) {
struct msm_gem_vma *vma;
struct page **pages;
- 

[PATCH AUTOSEL 5.4 24/45] drm/radeon: disable AGP by default

2020-08-10 Thread Sasha Levin
From: Christian König 

[ Upstream commit ba806f98f868ce107aa9c453fef751de9980e4af ]

Always use the PCI GART instead. We just have to many cases
where AGP still causes problems. This means a performance
regression for some GPUs, but also a bug fix for some others.

Signed-off-by: Christian König 
Reviewed-by: Alex Deucher 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/radeon/radeon_drv.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_drv.c 
b/drivers/gpu/drm/radeon/radeon_drv.c
index 7d417b9a52501..c2573096d43c0 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -174,12 +174,7 @@ int radeon_no_wb;
 int radeon_modeset = -1;
 int radeon_dynclks = -1;
 int radeon_r4xx_atom = 0;
-#ifdef __powerpc__
-/* Default to PCI on PowerPC (fdo #95017) */
 int radeon_agpmode = -1;
-#else
-int radeon_agpmode = 0;
-#endif
 int radeon_vram_limit = 0;
 int radeon_gart_size = -1; /* auto */
 int radeon_benchmarking = 0;
-- 
2.25.1

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


[PATCH AUTOSEL 4.19 07/31] drm/radeon: Fix reference count leaks caused by pm_runtime_get_sync

2020-08-10 Thread Sasha Levin
From: Aditya Pakki 

[ Upstream commit 9fb10671011143d15b6b40d6d5fa9c52c57e9d63 ]

On calling pm_runtime_get_sync() the reference count of the device
is incremented. In case of failure, decrement the
reference count before returning the error.

Acked-by: Evan Quan 
Signed-off-by: Aditya Pakki 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/radeon/radeon_display.c | 4 +++-
 drivers/gpu/drm/radeon/radeon_drv.c | 4 +++-
 drivers/gpu/drm/radeon/radeon_kms.c | 4 +++-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_display.c 
b/drivers/gpu/drm/radeon/radeon_display.c
index 7d1e14f0140a2..3f0f3a578ddf0 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -625,8 +625,10 @@ radeon_crtc_set_config(struct drm_mode_set *set,
dev = set->crtc->dev;
 
ret = pm_runtime_get_sync(dev->dev);
-   if (ret < 0)
+   if (ret < 0) {
+   pm_runtime_put_autosuspend(dev->dev);
return ret;
+   }
 
ret = drm_crtc_helper_set_config(set, ctx);
 
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c 
b/drivers/gpu/drm/radeon/radeon_drv.c
index c26f09b47ecb2..54729acd0d4af 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -523,8 +523,10 @@ long radeon_drm_ioctl(struct file *filp,
long ret;
dev = file_priv->minor->dev;
ret = pm_runtime_get_sync(dev->dev);
-   if (ret < 0)
+   if (ret < 0) {
+   pm_runtime_put_autosuspend(dev->dev);
return ret;
+   }
 
ret = drm_ioctl(filp, cmd, arg);

diff --git a/drivers/gpu/drm/radeon/radeon_kms.c 
b/drivers/gpu/drm/radeon/radeon_kms.c
index 3ff835767ac58..34b3cb6c146f9 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -627,8 +627,10 @@ int radeon_driver_open_kms(struct drm_device *dev, struct 
drm_file *file_priv)
file_priv->driver_priv = NULL;
 
r = pm_runtime_get_sync(dev->dev);
-   if (r < 0)
+   if (r < 0) {
+   pm_runtime_put_autosuspend(dev->dev);
return r;
+   }
 
/* new gpu have virtual address space support */
if (rdev->family >= CHIP_CAYMAN) {
-- 
2.25.1

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


[PATCH AUTOSEL 5.4 23/45] drm/debugfs: fix plain echo to connector "force" attribute

2020-08-10 Thread Sasha Levin
From: Michael Tretter 

[ Upstream commit c704b17071c4dc571dca3af4e4151dac51de081a ]

Using plain echo to set the "force" connector attribute fails with
-EINVAL, because echo appends a newline to the output.

Replace strcmp with sysfs_streq to also accept strings that end with a
newline.

v2: use sysfs_streq instead of stripping trailing whitespace

Signed-off-by: Michael Tretter 
Reviewed-by: Jani Nikula 
Signed-off-by: Emil Velikov 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20170817104307.17124-1-m.tret...@pengutronix.de
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/drm_debugfs.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
index eab0f2687cd6e..00debd02c3220 100644
--- a/drivers/gpu/drm/drm_debugfs.c
+++ b/drivers/gpu/drm/drm_debugfs.c
@@ -337,13 +337,13 @@ static ssize_t connector_write(struct file *file, const 
char __user *ubuf,
 
buf[len] = '\0';
 
-   if (!strcmp(buf, "on"))
+   if (sysfs_streq(buf, "on"))
connector->force = DRM_FORCE_ON;
-   else if (!strcmp(buf, "digital"))
+   else if (sysfs_streq(buf, "digital"))
connector->force = DRM_FORCE_ON_DIGITAL;
-   else if (!strcmp(buf, "off"))
+   else if (sysfs_streq(buf, "off"))
connector->force = DRM_FORCE_OFF;
-   else if (!strcmp(buf, "unspecified"))
+   else if (sysfs_streq(buf, "unspecified"))
connector->force = DRM_FORCE_UNSPECIFIED;
else
return -EINVAL;
-- 
2.25.1

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


[PATCH AUTOSEL 5.4 21/45] drm: msm: a6xx: fix gpu failure after system resume

2020-08-10 Thread Sasha Levin
From: Akhil P Oommen 

[ Upstream commit 57c0bd517c06b088106b0236ed604056c8e06da5 ]

On targets where GMU is available, GMU takes over the ownership of GX GDSC
during its initialization. So, move the refcount-get on GX PD before we
initialize the GMU. This ensures that nobody can collapse the GX GDSC
once GMU owns the GX GDSC. This patch fixes some GMU OOB errors seen
during GPU wake up during a system resume.

Reported-by: Matthias Kaehlcke 
Signed-off-by: Akhil P Oommen 
Tested-by: Matthias Kaehlcke 
Reviewed-by: Jordan Crouse 
Signed-off-by: Rob Clark 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 18 ++
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c 
b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
index e62b286947a7f..9ea748667fab0 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
@@ -713,10 +713,19 @@ int a6xx_gmu_resume(struct a6xx_gpu *a6xx_gpu)
/* Turn on the resources */
pm_runtime_get_sync(gmu->dev);
 
+   /*
+* "enable" the GX power domain which won't actually do anything but it
+* will make sure that the refcounting is correct in case we need to
+* bring down the GX after a GMU failure
+*/
+   if (!IS_ERR_OR_NULL(gmu->gxpd))
+   pm_runtime_get_sync(gmu->gxpd);
+
/* Use a known rate to bring up the GMU */
clk_set_rate(gmu->core_clk, 2);
ret = clk_bulk_prepare_enable(gmu->nr_clocks, gmu->clocks);
if (ret) {
+   pm_runtime_put(gmu->gxpd);
pm_runtime_put(gmu->dev);
return ret;
}
@@ -752,19 +761,12 @@ int a6xx_gmu_resume(struct a6xx_gpu *a6xx_gpu)
/* Set the GPU to the highest power frequency */
__a6xx_gmu_set_freq(gmu, gmu->nr_gpu_freqs - 1);
 
-   /*
-* "enable" the GX power domain which won't actually do anything but it
-* will make sure that the refcounting is correct in case we need to
-* bring down the GX after a GMU failure
-*/
-   if (!IS_ERR_OR_NULL(gmu->gxpd))
-   pm_runtime_get(gmu->gxpd);
-
 out:
/* On failure, shut down the GMU to leave it in a good state */
if (ret) {
disable_irq(gmu->gmu_irq);
a6xx_rpmh_stop(gmu);
+   pm_runtime_put(gmu->gxpd);
pm_runtime_put(gmu->dev);
}
 
-- 
2.25.1

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


[PATCH AUTOSEL 4.19 01/31] drm/tilcdc: fix leak & null ref in panel_connector_get_modes

2020-08-10 Thread Sasha Levin
From: Tomi Valkeinen 

[ Upstream commit 3f9c1c872cc97875ddc8d63bc9fe6ee13652b933 ]

If videomode_from_timings() returns true, the mode allocated with
drm_mode_create will be leaked.

Also, the return value of drm_mode_create() is never checked, and thus
could cause NULL deref.

Fix these two issues.

Signed-off-by: Tomi Valkeinen 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20200429104234.18910-1-tomi.valkei...@ti.com
Reviewed-by: Jyri Sarha 
Acked-by: Sam Ravnborg 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/tilcdc/tilcdc_panel.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_panel.c 
b/drivers/gpu/drm/tilcdc/tilcdc_panel.c
index a1acab39d87f4..096a33f12c615 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_panel.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_panel.c
@@ -150,12 +150,16 @@ static int panel_connector_get_modes(struct drm_connector 
*connector)
int i;
 
for (i = 0; i < timings->num_timings; i++) {
-   struct drm_display_mode *mode = drm_mode_create(dev);
+   struct drm_display_mode *mode;
struct videomode vm;
 
if (videomode_from_timings(timings, , i))
break;
 
+   mode = drm_mode_create(dev);
+   if (!mode)
+   break;
+
drm_display_mode_from_videomode(, mode);
 
mode->type = DRM_MODE_TYPE_DRIVER;
-- 
2.25.1

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


[PATCH AUTOSEL 5.4 09/45] video: fbdev: savage: fix memory leak on error handling path in probe

2020-08-10 Thread Sasha Levin
From: Evgeny Novikov 

[ Upstream commit e8d35898a78e34fc854ed9680bc3f9caedab08cd ]

savagefb_probe() calls savage_init_fb_info() that can successfully
allocate memory for info->pixmap.addr but then fail when
fb_alloc_cmap() fails. savagefb_probe() goes to label failed_init and
does not free allocated memory. It is not valid to go to label
failed_mmio since savage_init_fb_info() can fail during memory
allocation as well. So, the patch free allocated memory on the error
handling path in savage_init_fb_info() itself.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Evgeny Novikov 
Cc: Antonino Daplas 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20200619162136.9010-1-novi...@ispras.ru
Signed-off-by: Sasha Levin 
---
 drivers/video/fbdev/savage/savagefb_driver.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/video/fbdev/savage/savagefb_driver.c 
b/drivers/video/fbdev/savage/savagefb_driver.c
index 512789f5f8848..d5d22d9c0f562 100644
--- a/drivers/video/fbdev/savage/savagefb_driver.c
+++ b/drivers/video/fbdev/savage/savagefb_driver.c
@@ -2158,6 +2158,8 @@ static int savage_init_fb_info(struct fb_info *info, 
struct pci_dev *dev,
info->flags |= FBINFO_HWACCEL_COPYAREA |
   FBINFO_HWACCEL_FILLRECT |
   FBINFO_HWACCEL_IMAGEBLIT;
+   else
+   kfree(info->pixmap.addr);
}
 #endif
return err;
-- 
2.25.1

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


[PATCH AUTOSEL 5.4 17/45] drm/nouveau: fix multiple instances of reference count leaks

2020-08-10 Thread Sasha Levin
From: Aditya Pakki 

[ Upstream commit 659fb5f154c3434c90a34586f3b7aa1c39cf6062 ]

On calling pm_runtime_get_sync() the reference count of the device
is incremented. In case of failure, decrement the
ref count before returning the error.

Signed-off-by: Aditya Pakki 
Signed-off-by: Ben Skeggs 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/nouveau/nouveau_drm.c | 8 ++--
 drivers/gpu/drm/nouveau/nouveau_gem.c | 4 +++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c 
b/drivers/gpu/drm/nouveau/nouveau_drm.c
index b1beed40e746a..5347e5bdee8cc 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -1052,8 +1052,10 @@ nouveau_drm_open(struct drm_device *dev, struct drm_file 
*fpriv)
 
/* need to bring up power immediately if opening device */
ret = pm_runtime_get_sync(dev->dev);
-   if (ret < 0 && ret != -EACCES)
+   if (ret < 0 && ret != -EACCES) {
+   pm_runtime_put_autosuspend(dev->dev);
return ret;
+   }
 
get_task_comm(tmpname, current);
snprintf(name, sizeof(name), "%s[%d]", tmpname, pid_nr(fpriv->pid));
@@ -1135,8 +1137,10 @@ nouveau_drm_ioctl(struct file *file, unsigned int cmd, 
unsigned long arg)
long ret;
 
ret = pm_runtime_get_sync(dev->dev);
-   if (ret < 0 && ret != -EACCES)
+   if (ret < 0 && ret != -EACCES) {
+   pm_runtime_put_autosuspend(dev->dev);
return ret;
+   }
 
switch (_IOC_NR(cmd) - DRM_COMMAND_BASE) {
case DRM_NOUVEAU_NVIF:
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c 
b/drivers/gpu/drm/nouveau/nouveau_gem.c
index 1324c19f4e5cf..fbfe254227740 100644
--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
@@ -45,8 +45,10 @@ nouveau_gem_object_del(struct drm_gem_object *gem)
int ret;
 
ret = pm_runtime_get_sync(dev);
-   if (WARN_ON(ret < 0 && ret != -EACCES))
+   if (WARN_ON(ret < 0 && ret != -EACCES)) {
+   pm_runtime_put_autosuspend(dev);
return;
+   }
 
if (gem->import_attach)
drm_prime_gem_destroy(gem, nvbo->bo.sg);
-- 
2.25.1

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


[PATCH AUTOSEL 5.4 45/45] drm/msm: ratelimit crtc event overflow error

2020-08-10 Thread Sasha Levin
From: Rob Clark 

[ Upstream commit 5e16372b5940b1fecc3cc887fc02a50ba148d373 ]

This can happen a lot when things go pear shaped.  Lets not flood dmesg
when this happens.

Signed-off-by: Rob Clark 
Reviewed-by: Abhinav Kumar 
Signed-off-by: Rob Clark 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index ce59adff06aa1..36c85c05b7cf7 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -381,7 +381,7 @@ static void dpu_crtc_frame_event_cb(void *data, u32 event)
spin_unlock_irqrestore(_crtc->spin_lock, flags);
 
if (!fevent) {
-   DRM_ERROR("crtc%d event %d overflow\n", crtc->base.id, event);
+   DRM_ERROR_RATELIMITED("crtc%d event %d overflow\n", 
crtc->base.id, event);
return;
}
 
-- 
2.25.1

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


[PATCH AUTOSEL 5.4 27/45] drm/amdgpu/display bail early in dm_pp_get_static_clocks

2020-08-10 Thread Sasha Levin
From: Alex Deucher 

[ Upstream commit 376814f5fcf1aadda501d1413d56e8af85d19a97 ]

If there are no supported callbacks.  We'll fall back to the
nominal clocks.

Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1170
Reviewed-by: Evan Quan 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c
index 785322cd4c6c9..7241d4c207789 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c
@@ -530,6 +530,8 @@ bool dm_pp_get_static_clocks(
_clk_info);
else if (adev->smu.funcs)
ret = smu_get_current_clocks(>smu, _clk_info);
+   else
+   return false;
if (ret)
return false;
 
-- 
2.25.1

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


[PATCH AUTOSEL 5.4 13/45] drm/nouveau/kms/nv50-: Fix disabling dithering

2020-08-10 Thread Sasha Levin
From: Lyude Paul 

[ Upstream commit fb2420b701edbf96c2b6d557f0139902f455dc2b ]

While we expose the ability to turn off hardware dithering for nouveau,
we actually make the mistake of turning it on anyway, due to
dithering_depth containing a non-zero value if our dithering depth isn't
also set to 6 bpc.

So, fix it by never enabling dithering when it's disabled.

Signed-off-by: Lyude Paul 
Reviewed-by: Ben Skeggs 
Acked-by: Dave Airlie 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20200627194657.156514-6-ly...@redhat.com
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/nouveau/dispnv50/head.c | 24 +---
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv50/head.c 
b/drivers/gpu/drm/nouveau/dispnv50/head.c
index c9692df2b76cc..46578108a4305 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/head.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/head.c
@@ -83,18 +83,20 @@ nv50_head_atomic_check_dither(struct nv50_head_atom *armh,
 {
u32 mode = 0x00;
 
-   if (asyc->dither.mode == DITHERING_MODE_AUTO) {
-   if (asyh->base.depth > asyh->or.bpc * 3)
-   mode = DITHERING_MODE_DYNAMIC2X2;
-   } else {
-   mode = asyc->dither.mode;
-   }
+   if (asyc->dither.mode) {
+   if (asyc->dither.mode == DITHERING_MODE_AUTO) {
+   if (asyh->base.depth > asyh->or.bpc * 3)
+   mode = DITHERING_MODE_DYNAMIC2X2;
+   } else {
+   mode = asyc->dither.mode;
+   }
 
-   if (asyc->dither.depth == DITHERING_DEPTH_AUTO) {
-   if (asyh->or.bpc >= 8)
-   mode |= DITHERING_DEPTH_8BPC;
-   } else {
-   mode |= asyc->dither.depth;
+   if (asyc->dither.depth == DITHERING_DEPTH_AUTO) {
+   if (asyh->or.bpc >= 8)
+   mode |= DITHERING_DEPTH_8BPC;
+   } else {
+   mode |= asyc->dither.depth;
+   }
}
 
asyh->dither.enable = mode;
-- 
2.25.1

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


[PATCH AUTOSEL 5.4 16/45] drm/nouveau: fix reference count leak in nouveau_debugfs_strap_peek

2020-08-10 Thread Sasha Levin
From: Aditya Pakki 

[ Upstream commit 8f29432417b11039ef960ab18987c7d61b2b5396 ]

nouveau_debugfs_strap_peek() calls pm_runtime_get_sync() that
increments the reference count. In case of failure, decrement the
ref count before returning the error.

Signed-off-by: Aditya Pakki 
Signed-off-by: Ben Skeggs 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/nouveau/nouveau_debugfs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_debugfs.c 
b/drivers/gpu/drm/nouveau/nouveau_debugfs.c
index 7dfbbbc1beea6..5c314f135dd10 100644
--- a/drivers/gpu/drm/nouveau/nouveau_debugfs.c
+++ b/drivers/gpu/drm/nouveau/nouveau_debugfs.c
@@ -54,8 +54,10 @@ nouveau_debugfs_strap_peek(struct seq_file *m, void *data)
int ret;
 
ret = pm_runtime_get_sync(drm->dev->dev);
-   if (ret < 0 && ret != -EACCES)
+   if (ret < 0 && ret != -EACCES) {
+   pm_runtime_put_autosuspend(drm->dev->dev);
return ret;
+   }
 
seq_printf(m, "0x%08x\n",
   nvif_rd32(>client.device.object, 0x101000));
-- 
2.25.1

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


[PATCH AUTOSEL 5.4 28/45] drm/amd/powerplay: fix compile error with ARCH=arc

2020-08-10 Thread Sasha Levin
From: Evan Quan 

[ Upstream commit 9822ba2ead1baa3de4860ad9472f652c4cc78c9c ]

Fix the compile error below:
drivers/gpu/drm/amd/amdgpu/../powerplay/smu_v11_0.c: In function 
'smu_v11_0_init_microcode':
>> arch/arc/include/asm/bug.h:22:2: error: implicit declaration of function 
>> 'pr_warn'; did you mean 'pci_warn'? [-Werror=implicit-function-declaration]
  22 |  pr_warn("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, 
__func__); \
 |  ^~~
drivers/gpu/drm/amd/amdgpu/../powerplay/smu_v11_0.c:176:3: note: in expansion 
of macro 'BUG'
 176 |   BUG();

Reported-by: kernel test robot 
Signed-off-by: Evan Quan 
Acked-by: Alex Deucher 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c 
b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
index 0922d9cd858a0..c4d8c52c6b9ca 100644
--- a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
+++ b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
@@ -171,7 +171,8 @@ static int smu_v11_0_init_microcode(struct smu_context *smu)
chip_name = "navi12";
break;
default:
-   BUG();
+   dev_err(adev->dev, "Unsupported ASIC type %d\n", 
adev->asic_type);
+   return -EINVAL;
}
 
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_smc.bin", chip_name);
-- 
2.25.1

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


[PATCH AUTOSEL 5.4 35/45] gpu: host1x: debug: Fix multiple channels emitting messages simultaneously

2020-08-10 Thread Sasha Levin
From: Dmitry Osipenko 

[ Upstream commit 35681862808472a0a4b9a8817ae2789c0b5b3edc ]

Once channel's job is hung, it dumps the channel's state into KMSG before
tearing down the offending job. If multiple channels hang at once, then
they dump messages simultaneously, making the debug info unreadable, and
thus, useless. This patch adds mutex which allows only one channel to emit
debug messages at a time.

Signed-off-by: Dmitry Osipenko 
Signed-off-by: Thierry Reding 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/host1x/debug.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/host1x/debug.c b/drivers/gpu/host1x/debug.c
index c0392672a8421..1b4997bda1c79 100644
--- a/drivers/gpu/host1x/debug.c
+++ b/drivers/gpu/host1x/debug.c
@@ -16,6 +16,8 @@
 #include "debug.h"
 #include "channel.h"
 
+static DEFINE_MUTEX(debug_lock);
+
 unsigned int host1x_debug_trace_cmdbuf;
 
 static pid_t host1x_debug_force_timeout_pid;
@@ -52,12 +54,14 @@ static int show_channel(struct host1x_channel *ch, void 
*data, bool show_fifo)
struct output *o = data;
 
mutex_lock(>cdma.lock);
+   mutex_lock(_lock);
 
if (show_fifo)
host1x_hw_show_channel_fifo(m, ch, o);
 
host1x_hw_show_channel_cdma(m, ch, o);
 
+   mutex_unlock(_lock);
mutex_unlock(>cdma.lock);
 
return 0;
-- 
2.25.1

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


[PATCH AUTOSEL 5.7 44/60] drm/amd/powerplay: suppress compile error around BUG_ON

2020-08-10 Thread Sasha Levin
From: Evan Quan 

[ Upstream commit 75bc07e2403caea9ecac69f766dfb7dc33547594 ]

To suppress the compile error below for "ARCH=arc".
   drivers/gpu/drm/amd/amdgpu/../powerplay/arcturus_ppt.c: In function 
'arcturus_fill_eeprom_i2c_req':
>> arch/arc/include/asm/bug.h:22:2: error: implicit declaration of function 
>> 'pr_warn'; did you mean 'pci_warn'? [-Werror=implicit-function-declaration]
  22 |  pr_warn("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, 
__func__); \
 |  ^~~
   include/asm-generic/bug.h:62:57: note: in expansion of macro 'BUG'
  62 | #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } 
while (0)
 | ^~~
   drivers/gpu/drm/amd/amdgpu/../powerplay/arcturus_ppt.c:2157:2: note: in 
expansion of macro 'BUG_ON'
2157 |  BUG_ON(numbytes > MAX_SW_I2C_COMMANDS);

Signed-off-by: Evan Quan 
Acked-by: Alex Deucher 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c 
b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
index 1ef0923f71906..9ad0e6f18be49 100644
--- a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
@@ -2035,8 +2035,6 @@ static void arcturus_fill_eeprom_i2c_req(SwI2cRequest_t  
*req, bool write,
 {
int i;
 
-   BUG_ON(numbytes > MAX_SW_I2C_COMMANDS);
-
req->I2CcontrollerPort = 0;
req->I2CSpeed = 2;
req->SlaveAddress = address;
@@ -2074,6 +2072,12 @@ static int arcturus_i2c_eeprom_read_data(struct 
i2c_adapter *control,
struct smu_table_context *smu_table = >smu.smu_table;
struct smu_table *table = _table->driver_table;
 
+   if (numbytes > MAX_SW_I2C_COMMANDS) {
+   dev_err(adev->dev, "numbytes requested %d is over max allowed 
%d\n",
+   numbytes, MAX_SW_I2C_COMMANDS);
+   return -EINVAL;
+   }
+
memset(, 0, sizeof(req));
arcturus_fill_eeprom_i2c_req(, false, address, numbytes, data);
 
@@ -2110,6 +2114,12 @@ static int arcturus_i2c_eeprom_write_data(struct 
i2c_adapter *control,
SwI2cRequest_t req;
struct amdgpu_device *adev = to_amdgpu_device(control);
 
+   if (numbytes > MAX_SW_I2C_COMMANDS) {
+   dev_err(adev->dev, "numbytes requested %d is over max allowed 
%d\n",
+   numbytes, MAX_SW_I2C_COMMANDS);
+   return -EINVAL;
+   }
+
memset(, 0, sizeof(req));
arcturus_fill_eeprom_i2c_req(, true, address, numbytes, data);
 
-- 
2.25.1

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


[PATCH AUTOSEL 5.7 60/60] drm/msm: ratelimit crtc event overflow error

2020-08-10 Thread Sasha Levin
From: Rob Clark 

[ Upstream commit 5e16372b5940b1fecc3cc887fc02a50ba148d373 ]

This can happen a lot when things go pear shaped.  Lets not flood dmesg
when this happens.

Signed-off-by: Rob Clark 
Reviewed-by: Abhinav Kumar 
Signed-off-by: Rob Clark 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index 17448505a9b5f..d263d6e69bf12 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -386,7 +386,7 @@ static void dpu_crtc_frame_event_cb(void *data, u32 event)
spin_unlock_irqrestore(_crtc->spin_lock, flags);
 
if (!fevent) {
-   DRM_ERROR("crtc%d event %d overflow\n", crtc->base.id, event);
+   DRM_ERROR_RATELIMITED("crtc%d event %d overflow\n", 
crtc->base.id, event);
return;
}
 
-- 
2.25.1

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


[PATCH AUTOSEL 5.4 01/45] drm/tilcdc: fix leak & null ref in panel_connector_get_modes

2020-08-10 Thread Sasha Levin
From: Tomi Valkeinen 

[ Upstream commit 3f9c1c872cc97875ddc8d63bc9fe6ee13652b933 ]

If videomode_from_timings() returns true, the mode allocated with
drm_mode_create will be leaked.

Also, the return value of drm_mode_create() is never checked, and thus
could cause NULL deref.

Fix these two issues.

Signed-off-by: Tomi Valkeinen 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20200429104234.18910-1-tomi.valkei...@ti.com
Reviewed-by: Jyri Sarha 
Acked-by: Sam Ravnborg 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/tilcdc/tilcdc_panel.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_panel.c 
b/drivers/gpu/drm/tilcdc/tilcdc_panel.c
index 5584e656b8575..8c4fd1aa4c2db 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_panel.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_panel.c
@@ -143,12 +143,16 @@ static int panel_connector_get_modes(struct drm_connector 
*connector)
int i;
 
for (i = 0; i < timings->num_timings; i++) {
-   struct drm_display_mode *mode = drm_mode_create(dev);
+   struct drm_display_mode *mode;
struct videomode vm;
 
if (videomode_from_timings(timings, , i))
break;
 
+   mode = drm_mode_create(dev);
+   if (!mode)
+   break;
+
drm_display_mode_from_videomode(, mode);
 
mode->type = DRM_MODE_TYPE_DRIVER;
-- 
2.25.1

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


[PATCH AUTOSEL 5.4 15/45] drm/etnaviv: fix ref count leak via pm_runtime_get_sync

2020-08-10 Thread Sasha Levin
From: Navid Emamdoost 

[ Upstream commit c5d5a32ead1e3a61a07a1e59eb52a53e4a6b2a7f ]

in etnaviv_gpu_submit, etnaviv_gpu_recover_hang, etnaviv_gpu_debugfs,
and etnaviv_gpu_init the call to pm_runtime_get_sync increments the
counter even in case of failure, leading to incorrect ref count.
In case of failure, decrement the ref count before returning.

Signed-off-by: Navid Emamdoost 
Signed-off-by: Lucas Stach 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c 
b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
index d47d1a8e02198..8a26ea2a53348 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
@@ -713,7 +713,7 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
ret = pm_runtime_get_sync(gpu->dev);
if (ret < 0) {
dev_err(gpu->dev, "Failed to enable GPU power domain\n");
-   return ret;
+   goto pm_put;
}
 
etnaviv_hw_identify(gpu);
@@ -802,6 +802,7 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
 
 fail:
pm_runtime_mark_last_busy(gpu->dev);
+pm_put:
pm_runtime_put_autosuspend(gpu->dev);
 
return ret;
@@ -842,7 +843,7 @@ int etnaviv_gpu_debugfs(struct etnaviv_gpu *gpu, struct 
seq_file *m)
 
ret = pm_runtime_get_sync(gpu->dev);
if (ret < 0)
-   return ret;
+   goto pm_put;
 
dma_lo = gpu_read(gpu, VIVS_FE_DMA_LOW);
dma_hi = gpu_read(gpu, VIVS_FE_DMA_HIGH);
@@ -965,6 +966,7 @@ int etnaviv_gpu_debugfs(struct etnaviv_gpu *gpu, struct 
seq_file *m)
ret = 0;
 
pm_runtime_mark_last_busy(gpu->dev);
+pm_put:
pm_runtime_put_autosuspend(gpu->dev);
 
return ret;
@@ -978,7 +980,7 @@ void etnaviv_gpu_recover_hang(struct etnaviv_gpu *gpu)
dev_err(gpu->dev, "recover hung GPU!\n");
 
if (pm_runtime_get_sync(gpu->dev) < 0)
-   return;
+   goto pm_put;
 
mutex_lock(>lock);
 
@@ -997,6 +999,7 @@ void etnaviv_gpu_recover_hang(struct etnaviv_gpu *gpu)
 
mutex_unlock(>lock);
pm_runtime_mark_last_busy(gpu->dev);
+pm_put:
pm_runtime_put_autosuspend(gpu->dev);
 }
 
@@ -1269,8 +1272,10 @@ struct dma_fence *etnaviv_gpu_submit(struct 
etnaviv_gem_submit *submit)
 
if (!submit->runtime_resumed) {
ret = pm_runtime_get_sync(gpu->dev);
-   if (ret < 0)
+   if (ret < 0) {
+   pm_runtime_put_noidle(gpu->dev);
return NULL;
+   }
submit->runtime_resumed = true;
}
 
@@ -1287,6 +1292,7 @@ struct dma_fence *etnaviv_gpu_submit(struct 
etnaviv_gem_submit *submit)
ret = event_alloc(gpu, nr_events, event);
if (ret) {
DRM_ERROR("no free events\n");
+   pm_runtime_put_noidle(gpu->dev);
return NULL;
}
 
-- 
2.25.1

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


[PATCH AUTOSEL 5.4 10/45] video: fbdev: neofb: fix memory leak in neo_scan_monitor()

2020-08-10 Thread Sasha Levin
From: Evgeny Novikov 

[ Upstream commit edcb3895a751c762a18d25c8d9846ce9759ed7e1 ]

neofb_probe() calls neo_scan_monitor() that can successfully allocate a
memory for info->monspecs.modedb and proceed to case 0x03. There it does
not free the memory and returns -1. neofb_probe() goes to label
err_scan_monitor, thus, it does not free this memory through calling
fb_destroy_modedb() as well. We can not go to label err_init_hw since
neo_scan_monitor() can fail during memory allocation. So, the patch frees
the memory directly for case 0x03.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Evgeny Novikov 
Cc: Jani Nikula 
Cc: Mike Rapoport 
Cc: Daniel Vetter 
Cc: Andrew Morton 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20200630195451.18675-1-novi...@ispras.ru
Signed-off-by: Sasha Levin 
---
 drivers/video/fbdev/neofb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/video/fbdev/neofb.c b/drivers/video/fbdev/neofb.c
index b770946a09206..76464000933d8 100644
--- a/drivers/video/fbdev/neofb.c
+++ b/drivers/video/fbdev/neofb.c
@@ -1820,6 +1820,7 @@ static int neo_scan_monitor(struct fb_info *info)
 #else
printk(KERN_ERR
   "neofb: Only 640x480, 800x600/480 and 1024x768 panels 
are currently supported\n");
+   kfree(info->monspecs.modedb);
return -1;
 #endif
default:
-- 
2.25.1

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


[PATCH AUTOSEL 5.4 06/45] drm/amdgpu: avoid dereferencing a NULL pointer

2020-08-10 Thread Sasha Levin
From: Jack Xiao 

[ Upstream commit 55611b507fd6453d26030c0c0619fdf0c262766d ]

Check if irq_src is NULL to avoid dereferencing a NULL pointer,
for MES ring is uneccessary to recieve an interrupt notification.

Signed-off-by: Jack Xiao 
Acked-by: Alex Deucher 
Reviewed-by: Hawking Zhang 
Reviewed-by: Christian König 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 19 ---
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
index 23085b352cf2d..c212d5fc665c6 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
@@ -404,7 +404,9 @@ int amdgpu_fence_driver_start_ring(struct amdgpu_ring *ring,
ring->fence_drv.gpu_addr = adev->uvd.inst[ring->me].gpu_addr + 
index;
}
amdgpu_fence_write(ring, atomic_read(>fence_drv.last_seq));
-   amdgpu_irq_get(adev, irq_src, irq_type);
+
+   if (irq_src)
+   amdgpu_irq_get(adev, irq_src, irq_type);
 
ring->fence_drv.irq_src = irq_src;
ring->fence_drv.irq_type = irq_type;
@@ -539,8 +541,9 @@ void amdgpu_fence_driver_fini(struct amdgpu_device *adev)
/* no need to trigger GPU reset as we are unloading */
amdgpu_fence_driver_force_completion(ring);
}
-   amdgpu_irq_put(adev, ring->fence_drv.irq_src,
-  ring->fence_drv.irq_type);
+   if (ring->fence_drv.irq_src)
+   amdgpu_irq_put(adev, ring->fence_drv.irq_src,
+  ring->fence_drv.irq_type);
drm_sched_fini(>sched);
del_timer_sync(>fence_drv.fallback_timer);
for (j = 0; j <= ring->fence_drv.num_fences_mask; ++j)
@@ -576,8 +579,9 @@ void amdgpu_fence_driver_suspend(struct amdgpu_device *adev)
}
 
/* disable the interrupt */
-   amdgpu_irq_put(adev, ring->fence_drv.irq_src,
-  ring->fence_drv.irq_type);
+   if (ring->fence_drv.irq_src)
+   amdgpu_irq_put(adev, ring->fence_drv.irq_src,
+  ring->fence_drv.irq_type);
}
 }
 
@@ -603,8 +607,9 @@ void amdgpu_fence_driver_resume(struct amdgpu_device *adev)
continue;
 
/* enable the interrupt */
-   amdgpu_irq_get(adev, ring->fence_drv.irq_src,
-  ring->fence_drv.irq_type);
+   if (ring->fence_drv.irq_src)
+   amdgpu_irq_get(adev, ring->fence_drv.irq_src,
+  ring->fence_drv.irq_type);
}
 }
 
-- 
2.25.1

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


[PATCH AUTOSEL 5.7 35/60] drm/amd/powerplay: fix compile error with ARCH=arc

2020-08-10 Thread Sasha Levin
From: Evan Quan 

[ Upstream commit 9822ba2ead1baa3de4860ad9472f652c4cc78c9c ]

Fix the compile error below:
drivers/gpu/drm/amd/amdgpu/../powerplay/smu_v11_0.c: In function 
'smu_v11_0_init_microcode':
>> arch/arc/include/asm/bug.h:22:2: error: implicit declaration of function 
>> 'pr_warn'; did you mean 'pci_warn'? [-Werror=implicit-function-declaration]
  22 |  pr_warn("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, 
__func__); \
 |  ^~~
drivers/gpu/drm/amd/amdgpu/../powerplay/smu_v11_0.c:176:3: note: in expansion 
of macro 'BUG'
 176 |   BUG();

Reported-by: kernel test robot 
Signed-off-by: Evan Quan 
Acked-by: Alex Deucher 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c 
b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
index 655ba4fb05dcd..48af305d42d54 100644
--- a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
+++ b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
@@ -159,7 +159,8 @@ int smu_v11_0_init_microcode(struct smu_context *smu)
chip_name = "navi12";
break;
default:
-   BUG();
+   dev_err(adev->dev, "Unsupported ASIC type %d\n", 
adev->asic_type);
+   return -EINVAL;
}
 
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_smc.bin", chip_name);
-- 
2.25.1

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


[PATCH AUTOSEL 5.7 34/60] drm/amdgpu/display: properly guard the calls to swSMU functions

2020-08-10 Thread Sasha Levin
From: Alex Deucher 

[ Upstream commit 4072327a2622af8688b88f5cd0a472136d3bf33d ]

It's only applicable on newer asics.  We could end up here when
using DC on older asics like SI or KV.

Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1170
Reviewed-by: Evan Quan 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c
index 7cee8070cb113..5c6a6ae48d396 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c
@@ -106,7 +106,7 @@ bool dm_pp_apply_display_requirements(
adev->powerplay.pp_funcs->display_configuration_change(
adev->powerplay.pp_handle,
>pm.pm_display_cfg);
-   else
+   else if (adev->smu.ppt_funcs)
smu_display_configuration_change(smu,
 
>pm.pm_display_cfg);
 
@@ -592,7 +592,7 @@ void pp_rv_set_wm_ranges(struct pp_smu *pp,
if (pp_funcs && pp_funcs->set_watermarks_for_clocks_ranges)
pp_funcs->set_watermarks_for_clocks_ranges(pp_handle,
   
_with_clock_ranges);
-   else
+   else if (adev->smu.ppt_funcs)
smu_set_watermarks_for_clock_ranges(>smu,
_with_clock_ranges);
 }
-- 
2.25.1

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


[PATCH AUTOSEL 5.7 28/60] drm/radeon: disable AGP by default

2020-08-10 Thread Sasha Levin
From: Christian König 

[ Upstream commit ba806f98f868ce107aa9c453fef751de9980e4af ]

Always use the PCI GART instead. We just have to many cases
where AGP still causes problems. This means a performance
regression for some GPUs, but also a bug fix for some others.

Signed-off-by: Christian König 
Reviewed-by: Alex Deucher 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/radeon/radeon_drv.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_drv.c 
b/drivers/gpu/drm/radeon/radeon_drv.c
index 0cf0b00a0623e..6f0d1971099b7 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -171,12 +171,7 @@ int radeon_no_wb;
 int radeon_modeset = -1;
 int radeon_dynclks = -1;
 int radeon_r4xx_atom = 0;
-#ifdef __powerpc__
-/* Default to PCI on PowerPC (fdo #95017) */
 int radeon_agpmode = -1;
-#else
-int radeon_agpmode = 0;
-#endif
 int radeon_vram_limit = 0;
 int radeon_gart_size = -1; /* auto */
 int radeon_benchmarking = 0;
-- 
2.25.1

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


[PATCH AUTOSEL 5.7 43/60] gpu: host1x: debug: Fix multiple channels emitting messages simultaneously

2020-08-10 Thread Sasha Levin
From: Dmitry Osipenko 

[ Upstream commit 35681862808472a0a4b9a8817ae2789c0b5b3edc ]

Once channel's job is hung, it dumps the channel's state into KMSG before
tearing down the offending job. If multiple channels hang at once, then
they dump messages simultaneously, making the debug info unreadable, and
thus, useless. This patch adds mutex which allows only one channel to emit
debug messages at a time.

Signed-off-by: Dmitry Osipenko 
Signed-off-by: Thierry Reding 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/host1x/debug.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/host1x/debug.c b/drivers/gpu/host1x/debug.c
index c0392672a8421..1b4997bda1c79 100644
--- a/drivers/gpu/host1x/debug.c
+++ b/drivers/gpu/host1x/debug.c
@@ -16,6 +16,8 @@
 #include "debug.h"
 #include "channel.h"
 
+static DEFINE_MUTEX(debug_lock);
+
 unsigned int host1x_debug_trace_cmdbuf;
 
 static pid_t host1x_debug_force_timeout_pid;
@@ -52,12 +54,14 @@ static int show_channel(struct host1x_channel *ch, void 
*data, bool show_fifo)
struct output *o = data;
 
mutex_lock(>cdma.lock);
+   mutex_lock(_lock);
 
if (show_fifo)
host1x_hw_show_channel_fifo(m, ch, o);
 
host1x_hw_show_channel_cdma(m, ch, o);
 
+   mutex_unlock(_lock);
mutex_unlock(>cdma.lock);
 
return 0;
-- 
2.25.1

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


[PATCH AUTOSEL 5.4 07/45] drm/radeon: Fix reference count leaks caused by pm_runtime_get_sync

2020-08-10 Thread Sasha Levin
From: Aditya Pakki 

[ Upstream commit 9fb10671011143d15b6b40d6d5fa9c52c57e9d63 ]

On calling pm_runtime_get_sync() the reference count of the device
is incremented. In case of failure, decrement the
reference count before returning the error.

Acked-by: Evan Quan 
Signed-off-by: Aditya Pakki 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/radeon/radeon_display.c | 4 +++-
 drivers/gpu/drm/radeon/radeon_drv.c | 4 +++-
 drivers/gpu/drm/radeon/radeon_kms.c | 4 +++-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_display.c 
b/drivers/gpu/drm/radeon/radeon_display.c
index 0826efd9b5f51..f9f74150d0d73 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -631,8 +631,10 @@ radeon_crtc_set_config(struct drm_mode_set *set,
dev = set->crtc->dev;
 
ret = pm_runtime_get_sync(dev->dev);
-   if (ret < 0)
+   if (ret < 0) {
+   pm_runtime_put_autosuspend(dev->dev);
return ret;
+   }
 
ret = drm_crtc_helper_set_config(set, ctx);
 
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c 
b/drivers/gpu/drm/radeon/radeon_drv.c
index 6128792ab8836..7d417b9a52501 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -555,8 +555,10 @@ long radeon_drm_ioctl(struct file *filp,
long ret;
dev = file_priv->minor->dev;
ret = pm_runtime_get_sync(dev->dev);
-   if (ret < 0)
+   if (ret < 0) {
+   pm_runtime_put_autosuspend(dev->dev);
return ret;
+   }
 
ret = drm_ioctl(filp, cmd, arg);

diff --git a/drivers/gpu/drm/radeon/radeon_kms.c 
b/drivers/gpu/drm/radeon/radeon_kms.c
index 2bb0187c5bc78..709c4ef5e7d59 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -638,8 +638,10 @@ int radeon_driver_open_kms(struct drm_device *dev, struct 
drm_file *file_priv)
file_priv->driver_priv = NULL;
 
r = pm_runtime_get_sync(dev->dev);
-   if (r < 0)
+   if (r < 0) {
+   pm_runtime_put_autosuspend(dev->dev);
return r;
+   }
 
/* new gpu have virtual address space support */
if (rdev->family >= CHIP_CAYMAN) {
-- 
2.25.1

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


[PATCH AUTOSEL 5.7 27/60] drm/debugfs: fix plain echo to connector "force" attribute

2020-08-10 Thread Sasha Levin
From: Michael Tretter 

[ Upstream commit c704b17071c4dc571dca3af4e4151dac51de081a ]

Using plain echo to set the "force" connector attribute fails with
-EINVAL, because echo appends a newline to the output.

Replace strcmp with sysfs_streq to also accept strings that end with a
newline.

v2: use sysfs_streq instead of stripping trailing whitespace

Signed-off-by: Michael Tretter 
Reviewed-by: Jani Nikula 
Signed-off-by: Emil Velikov 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20170817104307.17124-1-m.tret...@pengutronix.de
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/drm_debugfs.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
index 4e673d318503c..fb251c00fdd3e 100644
--- a/drivers/gpu/drm/drm_debugfs.c
+++ b/drivers/gpu/drm/drm_debugfs.c
@@ -336,13 +336,13 @@ static ssize_t connector_write(struct file *file, const 
char __user *ubuf,
 
buf[len] = '\0';
 
-   if (!strcmp(buf, "on"))
+   if (sysfs_streq(buf, "on"))
connector->force = DRM_FORCE_ON;
-   else if (!strcmp(buf, "digital"))
+   else if (sysfs_streq(buf, "digital"))
connector->force = DRM_FORCE_ON_DIGITAL;
-   else if (!strcmp(buf, "off"))
+   else if (sysfs_streq(buf, "off"))
connector->force = DRM_FORCE_OFF;
-   else if (!strcmp(buf, "unspecified"))
+   else if (sysfs_streq(buf, "unspecified"))
connector->force = DRM_FORCE_UNSPECIFIED;
else
return -EINVAL;
-- 
2.25.1

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


[PATCH AUTOSEL 5.7 21/60] drm/nouveau: fix multiple instances of reference count leaks

2020-08-10 Thread Sasha Levin
From: Aditya Pakki 

[ Upstream commit 659fb5f154c3434c90a34586f3b7aa1c39cf6062 ]

On calling pm_runtime_get_sync() the reference count of the device
is incremented. In case of failure, decrement the
ref count before returning the error.

Signed-off-by: Aditya Pakki 
Signed-off-by: Ben Skeggs 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/nouveau/nouveau_drm.c | 8 ++--
 drivers/gpu/drm/nouveau/nouveau_gem.c | 4 +++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c 
b/drivers/gpu/drm/nouveau/nouveau_drm.c
index ca4087f5a15b6..c484d21820c9b 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -1051,8 +1051,10 @@ nouveau_drm_open(struct drm_device *dev, struct drm_file 
*fpriv)
 
/* need to bring up power immediately if opening device */
ret = pm_runtime_get_sync(dev->dev);
-   if (ret < 0 && ret != -EACCES)
+   if (ret < 0 && ret != -EACCES) {
+   pm_runtime_put_autosuspend(dev->dev);
return ret;
+   }
 
get_task_comm(tmpname, current);
snprintf(name, sizeof(name), "%s[%d]", tmpname, pid_nr(fpriv->pid));
@@ -1134,8 +1136,10 @@ nouveau_drm_ioctl(struct file *file, unsigned int cmd, 
unsigned long arg)
long ret;
 
ret = pm_runtime_get_sync(dev->dev);
-   if (ret < 0 && ret != -EACCES)
+   if (ret < 0 && ret != -EACCES) {
+   pm_runtime_put_autosuspend(dev->dev);
return ret;
+   }
 
switch (_IOC_NR(cmd) - DRM_COMMAND_BASE) {
case DRM_NOUVEAU_NVIF:
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c 
b/drivers/gpu/drm/nouveau/nouveau_gem.c
index f5ece1f949734..f941ce8f81e3a 100644
--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
@@ -45,8 +45,10 @@ nouveau_gem_object_del(struct drm_gem_object *gem)
int ret;
 
ret = pm_runtime_get_sync(dev);
-   if (WARN_ON(ret < 0 && ret != -EACCES))
+   if (WARN_ON(ret < 0 && ret != -EACCES)) {
+   pm_runtime_put_autosuspend(dev);
return;
+   }
 
if (gem->import_attach)
drm_prime_gem_destroy(gem, nvbo->bo.sg);
-- 
2.25.1

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


[PATCH AUTOSEL 5.7 10/60] drm/radeon: Fix reference count leaks caused by pm_runtime_get_sync

2020-08-10 Thread Sasha Levin
From: Aditya Pakki 

[ Upstream commit 9fb10671011143d15b6b40d6d5fa9c52c57e9d63 ]

On calling pm_runtime_get_sync() the reference count of the device
is incremented. In case of failure, decrement the
reference count before returning the error.

Acked-by: Evan Quan 
Signed-off-by: Aditya Pakki 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/radeon/radeon_display.c | 4 +++-
 drivers/gpu/drm/radeon/radeon_drv.c | 4 +++-
 drivers/gpu/drm/radeon/radeon_kms.c | 4 +++-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_display.c 
b/drivers/gpu/drm/radeon/radeon_display.c
index 35db79a168bf7..df1a7eb736517 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -635,8 +635,10 @@ radeon_crtc_set_config(struct drm_mode_set *set,
dev = set->crtc->dev;
 
ret = pm_runtime_get_sync(dev->dev);
-   if (ret < 0)
+   if (ret < 0) {
+   pm_runtime_put_autosuspend(dev->dev);
return ret;
+   }
 
ret = drm_crtc_helper_set_config(set, ctx);
 
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c 
b/drivers/gpu/drm/radeon/radeon_drv.c
index 59f8186a24151..0cf0b00a0623e 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -549,8 +549,10 @@ long radeon_drm_ioctl(struct file *filp,
long ret;
dev = file_priv->minor->dev;
ret = pm_runtime_get_sync(dev->dev);
-   if (ret < 0)
+   if (ret < 0) {
+   pm_runtime_put_autosuspend(dev->dev);
return ret;
+   }
 
ret = drm_ioctl(filp, cmd, arg);

diff --git a/drivers/gpu/drm/radeon/radeon_kms.c 
b/drivers/gpu/drm/radeon/radeon_kms.c
index 58176db85952c..779e4cd86245d 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -638,8 +638,10 @@ int radeon_driver_open_kms(struct drm_device *dev, struct 
drm_file *file_priv)
file_priv->driver_priv = NULL;
 
r = pm_runtime_get_sync(dev->dev);
-   if (r < 0)
+   if (r < 0) {
+   pm_runtime_put_autosuspend(dev->dev);
return r;
+   }
 
/* new gpu have virtual address space support */
if (rdev->family >= CHIP_CAYMAN) {
-- 
2.25.1

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


[PATCH AUTOSEL 5.7 18/60] drm/etnaviv: fix ref count leak via pm_runtime_get_sync

2020-08-10 Thread Sasha Levin
From: Navid Emamdoost 

[ Upstream commit c5d5a32ead1e3a61a07a1e59eb52a53e4a6b2a7f ]

in etnaviv_gpu_submit, etnaviv_gpu_recover_hang, etnaviv_gpu_debugfs,
and etnaviv_gpu_init the call to pm_runtime_get_sync increments the
counter even in case of failure, leading to incorrect ref count.
In case of failure, decrement the ref count before returning.

Signed-off-by: Navid Emamdoost 
Signed-off-by: Lucas Stach 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c 
b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
index a31eeff2b297a..7c9f3f9ba1235 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
@@ -722,7 +722,7 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
ret = pm_runtime_get_sync(gpu->dev);
if (ret < 0) {
dev_err(gpu->dev, "Failed to enable GPU power domain\n");
-   return ret;
+   goto pm_put;
}
 
etnaviv_hw_identify(gpu);
@@ -819,6 +819,7 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
 
 fail:
pm_runtime_mark_last_busy(gpu->dev);
+pm_put:
pm_runtime_put_autosuspend(gpu->dev);
 
return ret;
@@ -859,7 +860,7 @@ int etnaviv_gpu_debugfs(struct etnaviv_gpu *gpu, struct 
seq_file *m)
 
ret = pm_runtime_get_sync(gpu->dev);
if (ret < 0)
-   return ret;
+   goto pm_put;
 
dma_lo = gpu_read(gpu, VIVS_FE_DMA_LOW);
dma_hi = gpu_read(gpu, VIVS_FE_DMA_HIGH);
@@ -1003,6 +1004,7 @@ int etnaviv_gpu_debugfs(struct etnaviv_gpu *gpu, struct 
seq_file *m)
ret = 0;
 
pm_runtime_mark_last_busy(gpu->dev);
+pm_put:
pm_runtime_put_autosuspend(gpu->dev);
 
return ret;
@@ -1016,7 +1018,7 @@ void etnaviv_gpu_recover_hang(struct etnaviv_gpu *gpu)
dev_err(gpu->dev, "recover hung GPU!\n");
 
if (pm_runtime_get_sync(gpu->dev) < 0)
-   return;
+   goto pm_put;
 
mutex_lock(>lock);
 
@@ -1035,6 +1037,7 @@ void etnaviv_gpu_recover_hang(struct etnaviv_gpu *gpu)
 
mutex_unlock(>lock);
pm_runtime_mark_last_busy(gpu->dev);
+pm_put:
pm_runtime_put_autosuspend(gpu->dev);
 }
 
@@ -1308,8 +1311,10 @@ struct dma_fence *etnaviv_gpu_submit(struct 
etnaviv_gem_submit *submit)
 
if (!submit->runtime_resumed) {
ret = pm_runtime_get_sync(gpu->dev);
-   if (ret < 0)
+   if (ret < 0) {
+   pm_runtime_put_noidle(gpu->dev);
return NULL;
+   }
submit->runtime_resumed = true;
}
 
@@ -1326,6 +1331,7 @@ struct dma_fence *etnaviv_gpu_submit(struct 
etnaviv_gem_submit *submit)
ret = event_alloc(gpu, nr_events, event);
if (ret) {
DRM_ERROR("no free events\n");
+   pm_runtime_put_noidle(gpu->dev);
return NULL;
}
 
-- 
2.25.1

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


[PATCH AUTOSEL 5.7 33/60] drm/amdgpu/display bail early in dm_pp_get_static_clocks

2020-08-10 Thread Sasha Levin
From: Alex Deucher 

[ Upstream commit 376814f5fcf1aadda501d1413d56e8af85d19a97 ]

If there are no supported callbacks.  We'll fall back to the
nominal clocks.

Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1170
Reviewed-by: Evan Quan 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c
index a2e1a73f66b81..7cee8070cb113 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c
@@ -530,6 +530,8 @@ bool dm_pp_get_static_clocks(
_clk_info);
else if (adev->smu.ppt_funcs)
ret = smu_get_current_clocks(>smu, _clk_info);
+   else
+   return false;
if (ret)
return false;
 
-- 
2.25.1

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


[PATCH AUTOSEL 5.7 12/60] video: fbdev: savage: fix memory leak on error handling path in probe

2020-08-10 Thread Sasha Levin
From: Evgeny Novikov 

[ Upstream commit e8d35898a78e34fc854ed9680bc3f9caedab08cd ]

savagefb_probe() calls savage_init_fb_info() that can successfully
allocate memory for info->pixmap.addr but then fail when
fb_alloc_cmap() fails. savagefb_probe() goes to label failed_init and
does not free allocated memory. It is not valid to go to label
failed_mmio since savage_init_fb_info() can fail during memory
allocation as well. So, the patch free allocated memory on the error
handling path in savage_init_fb_info() itself.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Evgeny Novikov 
Cc: Antonino Daplas 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20200619162136.9010-1-novi...@ispras.ru
Signed-off-by: Sasha Levin 
---
 drivers/video/fbdev/savage/savagefb_driver.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/video/fbdev/savage/savagefb_driver.c 
b/drivers/video/fbdev/savage/savagefb_driver.c
index aab312a7d9da3..a542c33f20828 100644
--- a/drivers/video/fbdev/savage/savagefb_driver.c
+++ b/drivers/video/fbdev/savage/savagefb_driver.c
@@ -2158,6 +2158,8 @@ static int savage_init_fb_info(struct fb_info *info, 
struct pci_dev *dev,
info->flags |= FBINFO_HWACCEL_COPYAREA |
   FBINFO_HWACCEL_FILLRECT |
   FBINFO_HWACCEL_IMAGEBLIT;
+   else
+   kfree(info->pixmap.addr);
}
 #endif
return err;
-- 
2.25.1

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


[PATCH AUTOSEL 5.7 25/60] drm: msm: a6xx: fix gpu failure after system resume

2020-08-10 Thread Sasha Levin
From: Akhil P Oommen 

[ Upstream commit 57c0bd517c06b088106b0236ed604056c8e06da5 ]

On targets where GMU is available, GMU takes over the ownership of GX GDSC
during its initialization. So, move the refcount-get on GX PD before we
initialize the GMU. This ensures that nobody can collapse the GX GDSC
once GMU owns the GX GDSC. This patch fixes some GMU OOB errors seen
during GPU wake up during a system resume.

Reported-by: Matthias Kaehlcke 
Signed-off-by: Akhil P Oommen 
Tested-by: Matthias Kaehlcke 
Reviewed-by: Jordan Crouse 
Signed-off-by: Rob Clark 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 18 ++
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c 
b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
index 34607a98cc7c8..9a7a18951dc2b 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
@@ -732,10 +732,19 @@ int a6xx_gmu_resume(struct a6xx_gpu *a6xx_gpu)
/* Turn on the resources */
pm_runtime_get_sync(gmu->dev);
 
+   /*
+* "enable" the GX power domain which won't actually do anything but it
+* will make sure that the refcounting is correct in case we need to
+* bring down the GX after a GMU failure
+*/
+   if (!IS_ERR_OR_NULL(gmu->gxpd))
+   pm_runtime_get_sync(gmu->gxpd);
+
/* Use a known rate to bring up the GMU */
clk_set_rate(gmu->core_clk, 2);
ret = clk_bulk_prepare_enable(gmu->nr_clocks, gmu->clocks);
if (ret) {
+   pm_runtime_put(gmu->gxpd);
pm_runtime_put(gmu->dev);
return ret;
}
@@ -771,19 +780,12 @@ int a6xx_gmu_resume(struct a6xx_gpu *a6xx_gpu)
/* Set the GPU to the current freq */
__a6xx_gmu_set_freq(gmu, gmu->current_perf_index);
 
-   /*
-* "enable" the GX power domain which won't actually do anything but it
-* will make sure that the refcounting is correct in case we need to
-* bring down the GX after a GMU failure
-*/
-   if (!IS_ERR_OR_NULL(gmu->gxpd))
-   pm_runtime_get(gmu->gxpd);
-
 out:
/* On failure, shut down the GMU to leave it in a good state */
if (ret) {
disable_irq(gmu->gmu_irq);
a6xx_rpmh_stop(gmu);
+   pm_runtime_put(gmu->gxpd);
pm_runtime_put(gmu->dev);
}
 
-- 
2.25.1

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


[PATCH AUTOSEL 5.7 09/60] drm/amdgpu: avoid dereferencing a NULL pointer

2020-08-10 Thread Sasha Levin
From: Jack Xiao 

[ Upstream commit 55611b507fd6453d26030c0c0619fdf0c262766d ]

Check if irq_src is NULL to avoid dereferencing a NULL pointer,
for MES ring is uneccessary to recieve an interrupt notification.

Signed-off-by: Jack Xiao 
Acked-by: Alex Deucher 
Reviewed-by: Hawking Zhang 
Reviewed-by: Christian König 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 19 ---
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
index 7531527067dfb..892c1e9a1eb04 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
@@ -408,7 +408,9 @@ int amdgpu_fence_driver_start_ring(struct amdgpu_ring *ring,
ring->fence_drv.gpu_addr = adev->uvd.inst[ring->me].gpu_addr + 
index;
}
amdgpu_fence_write(ring, atomic_read(>fence_drv.last_seq));
-   amdgpu_irq_get(adev, irq_src, irq_type);
+
+   if (irq_src)
+   amdgpu_irq_get(adev, irq_src, irq_type);
 
ring->fence_drv.irq_src = irq_src;
ring->fence_drv.irq_type = irq_type;
@@ -529,8 +531,9 @@ void amdgpu_fence_driver_fini(struct amdgpu_device *adev)
/* no need to trigger GPU reset as we are unloading */
amdgpu_fence_driver_force_completion(ring);
}
-   amdgpu_irq_put(adev, ring->fence_drv.irq_src,
-  ring->fence_drv.irq_type);
+   if (ring->fence_drv.irq_src)
+   amdgpu_irq_put(adev, ring->fence_drv.irq_src,
+  ring->fence_drv.irq_type);
drm_sched_fini(>sched);
del_timer_sync(>fence_drv.fallback_timer);
for (j = 0; j <= ring->fence_drv.num_fences_mask; ++j)
@@ -566,8 +569,9 @@ void amdgpu_fence_driver_suspend(struct amdgpu_device *adev)
}
 
/* disable the interrupt */
-   amdgpu_irq_put(adev, ring->fence_drv.irq_src,
-  ring->fence_drv.irq_type);
+   if (ring->fence_drv.irq_src)
+   amdgpu_irq_put(adev, ring->fence_drv.irq_src,
+  ring->fence_drv.irq_type);
}
 }
 
@@ -593,8 +597,9 @@ void amdgpu_fence_driver_resume(struct amdgpu_device *adev)
continue;
 
/* enable the interrupt */
-   amdgpu_irq_get(adev, ring->fence_drv.irq_src,
-  ring->fence_drv.irq_type);
+   if (ring->fence_drv.irq_src)
+   amdgpu_irq_get(adev, ring->fence_drv.irq_src,
+  ring->fence_drv.irq_type);
}
 }
 
-- 
2.25.1

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


[PATCH AUTOSEL 5.7 20/60] drm/nouveau: fix reference count leak in nouveau_debugfs_strap_peek

2020-08-10 Thread Sasha Levin
From: Aditya Pakki 

[ Upstream commit 8f29432417b11039ef960ab18987c7d61b2b5396 ]

nouveau_debugfs_strap_peek() calls pm_runtime_get_sync() that
increments the reference count. In case of failure, decrement the
ref count before returning the error.

Signed-off-by: Aditya Pakki 
Signed-off-by: Ben Skeggs 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/nouveau/nouveau_debugfs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_debugfs.c 
b/drivers/gpu/drm/nouveau/nouveau_debugfs.c
index 15a3d40edf029..3e15a9d5e8faa 100644
--- a/drivers/gpu/drm/nouveau/nouveau_debugfs.c
+++ b/drivers/gpu/drm/nouveau/nouveau_debugfs.c
@@ -54,8 +54,10 @@ nouveau_debugfs_strap_peek(struct seq_file *m, void *data)
int ret;
 
ret = pm_runtime_get_sync(drm->dev->dev);
-   if (ret < 0 && ret != -EACCES)
+   if (ret < 0 && ret != -EACCES) {
+   pm_runtime_put_autosuspend(drm->dev->dev);
return ret;
+   }
 
seq_printf(m, "0x%08x\n",
   nvif_rd32(>client.device.object, 0x101000));
-- 
2.25.1

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


[PATCH AUTOSEL 5.7 16/60] drm/nouveau/kms/nv50-: Fix disabling dithering

2020-08-10 Thread Sasha Levin
From: Lyude Paul 

[ Upstream commit fb2420b701edbf96c2b6d557f0139902f455dc2b ]

While we expose the ability to turn off hardware dithering for nouveau,
we actually make the mistake of turning it on anyway, due to
dithering_depth containing a non-zero value if our dithering depth isn't
also set to 6 bpc.

So, fix it by never enabling dithering when it's disabled.

Signed-off-by: Lyude Paul 
Reviewed-by: Ben Skeggs 
Acked-by: Dave Airlie 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20200627194657.156514-6-ly...@redhat.com
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/nouveau/dispnv50/head.c | 24 +---
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv50/head.c 
b/drivers/gpu/drm/nouveau/dispnv50/head.c
index 8f6455697ba72..ed6819519f6d8 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/head.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/head.c
@@ -84,18 +84,20 @@ nv50_head_atomic_check_dither(struct nv50_head_atom *armh,
 {
u32 mode = 0x00;
 
-   if (asyc->dither.mode == DITHERING_MODE_AUTO) {
-   if (asyh->base.depth > asyh->or.bpc * 3)
-   mode = DITHERING_MODE_DYNAMIC2X2;
-   } else {
-   mode = asyc->dither.mode;
-   }
+   if (asyc->dither.mode) {
+   if (asyc->dither.mode == DITHERING_MODE_AUTO) {
+   if (asyh->base.depth > asyh->or.bpc * 3)
+   mode = DITHERING_MODE_DYNAMIC2X2;
+   } else {
+   mode = asyc->dither.mode;
+   }
 
-   if (asyc->dither.depth == DITHERING_DEPTH_AUTO) {
-   if (asyh->or.bpc >= 8)
-   mode |= DITHERING_DEPTH_8BPC;
-   } else {
-   mode |= asyc->dither.depth;
+   if (asyc->dither.depth == DITHERING_DEPTH_AUTO) {
+   if (asyh->or.bpc >= 8)
+   mode |= DITHERING_DEPTH_8BPC;
+   } else {
+   mode |= asyc->dither.depth;
+   }
}
 
asyh->dither.enable = mode;
-- 
2.25.1

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


[PATCH AUTOSEL 5.7 01/60] drm/tilcdc: fix leak & null ref in panel_connector_get_modes

2020-08-10 Thread Sasha Levin
From: Tomi Valkeinen 

[ Upstream commit 3f9c1c872cc97875ddc8d63bc9fe6ee13652b933 ]

If videomode_from_timings() returns true, the mode allocated with
drm_mode_create will be leaked.

Also, the return value of drm_mode_create() is never checked, and thus
could cause NULL deref.

Fix these two issues.

Signed-off-by: Tomi Valkeinen 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20200429104234.18910-1-tomi.valkei...@ti.com
Reviewed-by: Jyri Sarha 
Acked-by: Sam Ravnborg 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/tilcdc/tilcdc_panel.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_panel.c 
b/drivers/gpu/drm/tilcdc/tilcdc_panel.c
index 5584e656b8575..8c4fd1aa4c2db 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_panel.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_panel.c
@@ -143,12 +143,16 @@ static int panel_connector_get_modes(struct drm_connector 
*connector)
int i;
 
for (i = 0; i < timings->num_timings; i++) {
-   struct drm_display_mode *mode = drm_mode_create(dev);
+   struct drm_display_mode *mode;
struct videomode vm;
 
if (videomode_from_timings(timings, , i))
break;
 
+   mode = drm_mode_create(dev);
+   if (!mode)
+   break;
+
drm_display_mode_from_videomode(, mode);
 
mode->type = DRM_MODE_TYPE_DRIVER;
-- 
2.25.1

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


[PATCH AUTOSEL 5.7 32/60] drm/amd/display: Improve DisplayPort monitor interop

2020-08-10 Thread Sasha Levin
From: Aric Cyr 

[ Upstream commit eec3303de3378cdfaa0bb86f43546dbbd88f94e2 ]

[Why]
DC is very fast at link training and stream enablement
which causes issues such as blackscreens for non-compliant
monitors.

[How]
After debugging with scaler vendors we implement the
minimum delays at the necessary locations to ensure
the monitor does not hang.  Delays are generic due to
lack of IEEE OUI information on the failing displays.

Signed-off-by: Aric Cyr 
Reviewed-by: Wenjing Liu 
Acked-by: Qingqing Zhuo 
Acked-by: Tony Cheng 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/display/dc/core/dc_link.c|  4 +++-
 drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 16 ++--
 .../amd/display/dc/dce110/dce110_hw_sequencer.c  | 11 ++-
 3 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c 
b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
index 67cfff1586e9f..3f157bcc174b9 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
@@ -3146,9 +3146,11 @@ void core_link_disable_stream(struct pipe_ctx *pipe_ctx)
write_i2c_redriver_setting(pipe_ctx, false);
}
}
-   dc->hwss.disable_stream(pipe_ctx);
 
disable_link(pipe_ctx->stream->link, pipe_ctx->stream->signal);
+
+   dc->hwss.disable_stream(pipe_ctx);
+
if (pipe_ctx->stream->timing.flags.DSC) {
if (dc_is_dp_signal(pipe_ctx->stream->signal))
dp_set_dsc_enable(pipe_ctx, false);
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 caa090d0b6acc..1ada01322cd2c 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
@@ -1103,6 +1103,10 @@ static inline enum link_training_result 
perform_link_training_int(
dpcd_pattern.v1_4.TRAINING_PATTERN_SET = 
DPCD_TRAINING_PATTERN_VIDEOIDLE;
dpcd_set_training_pattern(link, dpcd_pattern);
 
+   /* delay 5ms after notifying sink of idle pattern before switching 
output */
+   if (link->connector_signal != SIGNAL_TYPE_EDP)
+   msleep(5);
+
/* 4. mainlink output idle pattern*/
dp_set_hw_test_pattern(link, DP_TEST_PATTERN_VIDEO_MODE, NULL, 0);
 
@@ -1552,6 +1556,12 @@ bool perform_link_training_with_retries(
struct dc_link *link = stream->link;
enum dp_panel_mode panel_mode = dp_get_panel_mode(link);
 
+   /* We need to do this before the link training to ensure the idle 
pattern in SST
+* mode will be sent right after the link training
+*/
+   link->link_enc->funcs->connect_dig_be_to_fe(link->link_enc,
+   
pipe_ctx->stream_res.stream_enc->id, true);
+
for (j = 0; j < attempts; ++j) {
 
dp_enable_link_phy(
@@ -1568,12 +1578,6 @@ bool perform_link_training_with_retries(
 
dp_set_panel_mode(link, panel_mode);
 
-   /* We need to do this before the link training to ensure the 
idle pattern in SST
-* mode will be sent right after the link training
-*/
-   link->link_enc->funcs->connect_dig_be_to_fe(link->link_enc,
-   
pipe_ctx->stream_res.stream_enc->id, true);
-
if (link->aux_access_disabled) {
dc_link_dp_perform_link_training_skip_aux(link, 
link_setting);
return true;
diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c 
b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
index 10527593868cc..24ca592c90df5 100644
--- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
+++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
@@ -1090,8 +1090,17 @@ void dce110_blank_stream(struct pipe_ctx *pipe_ctx)
dc_link_set_abm_disable(link);
}
 
-   if (dc_is_dp_signal(pipe_ctx->stream->signal))
+   if (dc_is_dp_signal(pipe_ctx->stream->signal)) {

pipe_ctx->stream_res.stream_enc->funcs->dp_blank(pipe_ctx->stream_res.stream_enc);
+
+   /*
+* After output is idle pattern some sinks need time to 
recognize the stream
+* has changed or they enter protection state and hang.
+*/
+   if (!dc_is_embedded_signal(pipe_ctx->stream->signal))
+   msleep(60);
+   }
+
 }
 
 
-- 
2.25.1

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


[PATCH AUTOSEL 5.7 13/60] video: fbdev: neofb: fix memory leak in neo_scan_monitor()

2020-08-10 Thread Sasha Levin
From: Evgeny Novikov 

[ Upstream commit edcb3895a751c762a18d25c8d9846ce9759ed7e1 ]

neofb_probe() calls neo_scan_monitor() that can successfully allocate a
memory for info->monspecs.modedb and proceed to case 0x03. There it does
not free the memory and returns -1. neofb_probe() goes to label
err_scan_monitor, thus, it does not free this memory through calling
fb_destroy_modedb() as well. We can not go to label err_init_hw since
neo_scan_monitor() can fail during memory allocation. So, the patch frees
the memory directly for case 0x03.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Evgeny Novikov 
Cc: Jani Nikula 
Cc: Mike Rapoport 
Cc: Daniel Vetter 
Cc: Andrew Morton 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20200630195451.18675-1-novi...@ispras.ru
Signed-off-by: Sasha Levin 
---
 drivers/video/fbdev/neofb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/video/fbdev/neofb.c b/drivers/video/fbdev/neofb.c
index e6ea853c17238..5a363ce9b4cbe 100644
--- a/drivers/video/fbdev/neofb.c
+++ b/drivers/video/fbdev/neofb.c
@@ -1820,6 +1820,7 @@ static int neo_scan_monitor(struct fb_info *info)
 #else
printk(KERN_ERR
   "neofb: Only 640x480, 800x600/480 and 1024x768 panels 
are currently supported\n");
+   kfree(info->monspecs.modedb);
return -1;
 #endif
default:
-- 
2.25.1

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


[PATCH AUTOSEL 5.7 26/60] drm/msm: Fix a null pointer access in msm_gem_shrinker_count()

2020-08-10 Thread Sasha Levin
From: Akhil P Oommen 

[ Upstream commit 3cbdc8d8b7f39a7af3ea7b8dfa75caaebfda4e56 ]

Adding an msm_gem_object object to the inactive_list before completing
its initialization is a bad idea because shrinker may pick it up from the
inactive_list. Fix this by making sure that the initialization is complete
before moving the msm_obj object to the inactive list.

This patch fixes the below error:
[10027.553044] Unable to handle kernel NULL pointer dereference at virtual 
address 0068
[10027.573305] Mem abort info:
[10027.590160]   ESR = 0x9606
[10027.597905]   EC = 0x25: DABT (current EL), IL = 32 bits
[10027.614430]   SET = 0, FnV = 0
[10027.624427]   EA = 0, S1PTW = 0
[10027.632722] Data abort info:
[10027.638039]   ISV = 0, ISS = 0x0006
[10027.647459]   CM = 0, WnR = 0
[10027.654345] user pgtable: 4k pages, 39-bit VAs, pgdp=0001e3a6a000
[10027.672681] [0068] pgd=000198c31003, pud=000198c31003, 
pmd=
[10027.693900] Internal error: Oops: 9606 [#1] PREEMPT SMP
[10027.738261] CPU: 3 PID: 214 Comm: kswapd0 Tainted: G S5.4.40 
#1
[10027.745766] Hardware name: Qualcomm Technologies, Inc. SC7180 IDP (DT)
[10027.752472] pstate: 80c9 (Nzcv daif +PAN +UAO)
[10027.757409] pc : mutex_is_locked+0x14/0x2c
[10027.761626] lr : msm_gem_shrinker_count+0x70/0xec
[10027.766454] sp : ffc011323ad0
[10027.769867] x29: ffc011323ad0 x28: ffe677e4b878
[10027.775324] x27: 0cc0 x26: 
[10027.780783] x25: ff817114a708 x24: 0008
[10027.786242] x23: ff8023ab7170 x22: 0001
[10027.791701] x21: ff817114a080 x20: 0119
[10027.797160] x19: 0068 x18: 03bc
[10027.802621] x17: 04a34210 x16: 00c0
[10027.808083] x15:  x14: 
[10027.813542] x13: ffe677e0a3c0 x12: 
[10027.819000] x11:  x10: ff8174b94340
[10027.824461] x9 :  x8 : 
[10027.829919] x7 : 01fc x6 : ffc011323c88
[10027.835373] x5 : 0001 x4 : ffc011323d80
[10027.840832] x3 : 0477b348 x2 : 
[10027.846290] x1 : ffc011323b68 x0 : 0068
[10027.851748] Call trace:
[10027.854264]  mutex_is_locked+0x14/0x2c
[10027.858121]  msm_gem_shrinker_count+0x70/0xec
[10027.862603]  shrink_slab+0xc0/0x4b4
[10027.866187]  shrink_node+0x4a8/0x818
[10027.869860]  kswapd+0x624/0x890
[10027.873097]  kthread+0x11c/0x12c
[10027.876424]  ret_from_fork+0x10/0x18
[10027.880102] Code: f9000bf3 910003fd aa0003f3 d503201f (f9400268)
[10027.886362] ---[ end trace df5849a1a3543251 ]---
[10027.891518] Kernel panic - not syncing: Fatal exception

Signed-off-by: Akhil P Oommen 
Signed-off-by: Rob Clark 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/msm/msm_gem.c | 36 ---
 1 file changed, 21 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c
index 5a6a79fbc9d6e..d92a0ffe2a767 100644
--- a/drivers/gpu/drm/msm/msm_gem.c
+++ b/drivers/gpu/drm/msm/msm_gem.c
@@ -977,10 +977,8 @@ int msm_gem_new_handle(struct drm_device *dev, struct 
drm_file *file,
 
 static int msm_gem_new_impl(struct drm_device *dev,
uint32_t size, uint32_t flags,
-   struct drm_gem_object **obj,
-   bool struct_mutex_locked)
+   struct drm_gem_object **obj)
 {
-   struct msm_drm_private *priv = dev->dev_private;
struct msm_gem_object *msm_obj;
 
switch (flags & MSM_BO_CACHE_MASK) {
@@ -1006,15 +1004,6 @@ static int msm_gem_new_impl(struct drm_device *dev,
INIT_LIST_HEAD(_obj->submit_entry);
INIT_LIST_HEAD(_obj->vmas);
 
-   if (struct_mutex_locked) {
-   WARN_ON(!mutex_is_locked(>struct_mutex));
-   list_add_tail(_obj->mm_list, >inactive_list);
-   } else {
-   mutex_lock(>struct_mutex);
-   list_add_tail(_obj->mm_list, >inactive_list);
-   mutex_unlock(>struct_mutex);
-   }
-
*obj = _obj->base;
 
return 0;
@@ -1024,6 +1013,7 @@ static struct drm_gem_object *_msm_gem_new(struct 
drm_device *dev,
uint32_t size, uint32_t flags, bool struct_mutex_locked)
 {
struct msm_drm_private *priv = dev->dev_private;
+   struct msm_gem_object *msm_obj;
struct drm_gem_object *obj = NULL;
bool use_vram = false;
int ret;
@@ -1044,14 +1034,15 @@ static struct drm_gem_object *_msm_gem_new(struct 
drm_device *dev,
if (size == 0)
return ERR_PTR(-EINVAL);
 
-   ret = msm_gem_new_impl(dev, size, flags, , struct_mutex_locked);
+   ret = msm_gem_new_impl(dev, size, flags, );
if (ret)
goto fail;
 
+   msm_obj = to_msm_bo(obj);
+
if (use_vram) {
struct msm_gem_vma *vma;
struct page **pages;
- 

[PATCH AUTOSEL 5.8 64/64] drm/msm: ratelimit crtc event overflow error

2020-08-10 Thread Sasha Levin
From: Rob Clark 

[ Upstream commit 5e16372b5940b1fecc3cc887fc02a50ba148d373 ]

This can happen a lot when things go pear shaped.  Lets not flood dmesg
when this happens.

Signed-off-by: Rob Clark 
Reviewed-by: Abhinav Kumar 
Signed-off-by: Rob Clark 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index e15b42a780e04..969d95aa873c4 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -389,7 +389,7 @@ static void dpu_crtc_frame_event_cb(void *data, u32 event)
spin_unlock_irqrestore(_crtc->spin_lock, flags);
 
if (!fevent) {
-   DRM_ERROR("crtc%d event %d overflow\n", crtc->base.id, event);
+   DRM_ERROR_RATELIMITED("crtc%d event %d overflow\n", 
crtc->base.id, event);
return;
}
 
-- 
2.25.1

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


[PATCH AUTOSEL 5.8 30/64] drm/radeon: disable AGP by default

2020-08-10 Thread Sasha Levin
From: Christian König 

[ Upstream commit ba806f98f868ce107aa9c453fef751de9980e4af ]

Always use the PCI GART instead. We just have to many cases
where AGP still causes problems. This means a performance
regression for some GPUs, but also a bug fix for some others.

Signed-off-by: Christian König 
Reviewed-by: Alex Deucher 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/radeon/radeon_drv.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_drv.c 
b/drivers/gpu/drm/radeon/radeon_drv.c
index 62b5069122cc4..4cd30613fa1dd 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -171,12 +171,7 @@ int radeon_no_wb;
 int radeon_modeset = -1;
 int radeon_dynclks = -1;
 int radeon_r4xx_atom = 0;
-#ifdef __powerpc__
-/* Default to PCI on PowerPC (fdo #95017) */
 int radeon_agpmode = -1;
-#else
-int radeon_agpmode = 0;
-#endif
 int radeon_vram_limit = 0;
 int radeon_gart_size = -1; /* auto */
 int radeon_benchmarking = 0;
-- 
2.25.1

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


  1   2   3   >