Re: [PATCH v4 06/16] drm/i915/hdcp: HDCP stream encryption support

2020-11-05 Thread Ramalingam C
On 2020-11-06 at 10:52:03 +0530, Anshuman Gupta wrote:
> On 2020-11-05 at 21:04:03 +0530, Ramalingam C wrote:
> > On 2020-10-27 at 22:11:58 +0530, Anshuman Gupta wrote:
> > > Both HDCP_{1.x,2.x} requires to select/deselect Multistream HDCP bit
> > > in TRANS_DDI_FUNC_CTL in order to enable/disable stream HDCP
> > > encryption over DP MST Transport Link.
> > > 
> > > HDCP 1.4 stream encryption requires to validate the stream encryption
> > > status in HDCP_STATUS_{TRANSCODER,PORT} register driving that link
> > > in order to enable/disable the stream encryption.
> > > 
> > > Both of above requirement are same for all Gen with respect to
> > > B.Spec Documentation.
> > > 
> > > v2:
> > > Cosmetic changes function name, error msg print and
> > > stream typo fixes. [Uma]
> > > 
> > > Cc: Ramalingam C 
> > > Signed-off-by: Anshuman Gupta 
> > > ---
> > >  drivers/gpu/drm/i915/display/intel_ddi.c  | 10 +--
> > >  drivers/gpu/drm/i915/display/intel_ddi.h  |  6 +-
> > >  .../drm/i915/display/intel_display_types.h|  4 +
> > >  drivers/gpu/drm/i915/display/intel_dp_hdcp.c  | 80 ---
> > >  drivers/gpu/drm/i915/display/intel_hdmi.c | 14 ++--
> > >  drivers/gpu/drm/i915/i915_reg.h   |  1 +
> > >  6 files changed, 90 insertions(+), 25 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c 
> > > b/drivers/gpu/drm/i915/display/intel_ddi.c
> > > index 9fce623e951e..779603a38cfc 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> > > +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> > > @@ -1948,9 +1948,9 @@ void intel_ddi_disable_transcoder_func(const struct 
> > > intel_crtc_state *crtc_state
> > >   }
> > >  }
> > >  
> > > -int intel_ddi_toggle_hdcp_signalling(struct intel_encoder *intel_encoder,
> > > -  enum transcoder cpu_transcoder,
> > > -  bool enable)
> > > +int intel_ddi_toggle_hdcp_bits(struct intel_encoder *intel_encoder,
> > > +enum transcoder cpu_transcoder,
> > > +bool enable, u32 hdcp_mask)
> > >  {
> > >   struct drm_device *dev = intel_encoder->base.dev;
> > >   struct drm_i915_private *dev_priv = to_i915(dev);
> > > @@ -1965,9 +1965,9 @@ int intel_ddi_toggle_hdcp_signalling(struct 
> > > intel_encoder *intel_encoder,
> > >  
> > >   tmp = intel_de_read(dev_priv, TRANS_DDI_FUNC_CTL(cpu_transcoder));
> > >   if (enable)
> > > - tmp |= TRANS_DDI_HDCP_SIGNALLING;
> > > + tmp |= hdcp_mask;
> > >   else
> > > - tmp &= ~TRANS_DDI_HDCP_SIGNALLING;
> > > + tmp &= ~hdcp_mask;
> > >   intel_de_write(dev_priv, TRANS_DDI_FUNC_CTL(cpu_transcoder), tmp);
> > >   intel_display_power_put(dev_priv, intel_encoder->power_domain, wakeref);
> > >   return ret;
> > > diff --git a/drivers/gpu/drm/i915/display/intel_ddi.h 
> > > b/drivers/gpu/drm/i915/display/intel_ddi.h
> > > index dcc711cfe4fe..a4dd815c 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_ddi.h
> > > +++ b/drivers/gpu/drm/i915/display/intel_ddi.h
> > > @@ -50,9 +50,9 @@ u32 bxt_signal_levels(struct intel_dp *intel_dp,
> > > const struct intel_crtc_state *crtc_state);
> > >  u32 ddi_signal_levels(struct intel_dp *intel_dp,
> > > const struct intel_crtc_state *crtc_state);
> > > -int intel_ddi_toggle_hdcp_signalling(struct intel_encoder *intel_encoder,
> > > -  enum transcoder cpu_transcoder,
> > > -  bool enable);
> > > +int intel_ddi_toggle_hdcp_bits(struct intel_encoder *intel_encoder,
> > > +enum transcoder cpu_transcoder,
> > > +bool enable, u32 hdcp_mask);
> > >  void icl_sanitize_encoder_pll_mapping(struct intel_encoder *encoder);
> > >  
> > >  #endif /* __INTEL_DDI_H__ */
> > > diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h 
> > > b/drivers/gpu/drm/i915/display/intel_display_types.h
> > > index c47124a679b6..59b8fc21e3e8 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_display_types.h
> > > +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
> > > @@ -339,6 +339,10 @@ struct intel_hdcp_shim {
> > >enum transcoder cpu_transcoder,
> > >bool enable);
> > >  
> > > + /* Enable/Disable stream encryption on DP MST Transport Link */
> > > + int (*stream_encryption)(struct intel_digital_port *dig_port,
> > > +  bool enable);
> > > +
> > >   /* Ensures the link is still protected */
> > >   bool (*check_link)(struct intel_digital_port *dig_port,
> > >  struct intel_connector *connector);
> > > diff --git a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c 
> > > b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
> > > index 03424d20e9f7..6dcbfaffd2c5 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
> > > +++ b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
> > > @@ -16,6 +16,30 @@
> 

Re: [PATCH v4 08/16] drm/i915/hdcp: Pass dig_port to intel_hdcp_init

2020-11-05 Thread Ramalingam C
On 2020-11-06 at 10:20:35 +0530, Anshuman Gupta wrote:
> On 2020-11-05 at 22:09:12 +0530, Ramalingam C wrote:
> > On 2020-10-27 at 22:12:00 +0530, Anshuman Gupta wrote:
> > > Pass dig_port as an argument to intel_hdcp_init()
> > > and intel_hdcp2_init().
> > > This will be required for HDCP 2.2 stream encryption.
> > > 
> > > Cc: Ramalingam C 
> > > Reviewed-by: Uma Shankar 
> > > Signed-off-by: Anshuman Gupta 
> > > ---
> > >  drivers/gpu/drm/i915/display/intel_dp_hdcp.c |  4 ++--
> > >  drivers/gpu/drm/i915/display/intel_hdcp.c| 12 +++-
> > >  drivers/gpu/drm/i915/display/intel_hdcp.h|  4 +++-
> > >  drivers/gpu/drm/i915/display/intel_hdmi.c|  2 +-
> > >  4 files changed, 13 insertions(+), 9 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c 
> > > b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
> > > index 6dcbfaffd2c5..591b68e5de48 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
> > > +++ b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
> > > @@ -751,10 +751,10 @@ int intel_dp_init_hdcp(struct intel_digital_port 
> > > *dig_port,
> > >   return 0;
> > >  
> > >   if (intel_connector->mst_port)
> > > - return intel_hdcp_init(intel_connector, port,
> > > + return intel_hdcp_init(intel_connector, dig_port,
> > cant we retrieve the dig_port from connector?
> No, actually intel_hdcp_init get called for DP MST in atomic check phase,
> in atomic check phase DP MST connector->encoder is not initialize  yet,
> it initialize  with DP MST encoder in commit phase.
> so using intel_attached_dig_port(connector) results in OOPS in 
> intel_hdcp_init().
Oh ok. Otherwise LGTM

Reviewed-by: Ramalingam C 
> Thanks,
> Anshuman Gupta.
> > 
> > -Ram
> > >  _dp_mst_hdcp_shim);
> > >   else if (!intel_dp_is_edp(intel_dp))
> > > - return intel_hdcp_init(intel_connector, port,
> > > + return intel_hdcp_init(intel_connector, dig_port,
> > >  _dp_hdcp_shim);
> > >  
> > >   return 0;
> > > diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c 
> > > b/drivers/gpu/drm/i915/display/intel_hdcp.c
> > > index 937af4aeaac2..b0f47687bc59 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_hdcp.c
> > > +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c
> > > @@ -1982,12 +1982,13 @@ static enum mei_fw_tc intel_get_mei_fw_tc(enum 
> > > transcoder cpu_transcoder)
> > >  }
> > >  
> > >  static int initialize_hdcp_port_data(struct intel_connector *connector,
> > > -  enum port port,
> > > +  struct intel_digital_port *dig_port,
> > >const struct intel_hdcp_shim *shim)
> > >  {
> > >   struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
> > >   struct intel_hdcp *hdcp = >hdcp;
> > >   struct hdcp_port_data *data = >port_data;
> > > + enum port port = dig_port->base.port;
> > >  
> > >   if (INTEL_GEN(dev_priv) < 12)
> > >   data->fw_ddi = intel_get_mei_fw_ddi_index(port);
> > > @@ -2060,14 +2061,15 @@ void intel_hdcp_component_init(struct 
> > > drm_i915_private *dev_priv)
> > >   }
> > >  }
> > >  
> > > -static void intel_hdcp2_init(struct intel_connector *connector, enum 
> > > port port,
> > > +static void intel_hdcp2_init(struct intel_connector *connector,
> > > +  struct intel_digital_port *dig_port,
> > >const struct intel_hdcp_shim *shim)
> > >  {
> > >   struct drm_i915_private *i915 = to_i915(connector->base.dev);
> > >   struct intel_hdcp *hdcp = >hdcp;
> > >   int ret;
> > >  
> > > - ret = initialize_hdcp_port_data(connector, port, shim);
> > > + ret = initialize_hdcp_port_data(connector, dig_port, shim);
> > >   if (ret) {
> > >   drm_dbg_kms(>drm, "Mei hdcp data init failed\n");
> > >   return;
> > > @@ -2077,7 +2079,7 @@ static void intel_hdcp2_init(struct intel_connector 
> > > *connector, enum port port,
> > >  }
> > >  
> > >  int intel_hdcp_init(struct intel_connector *connector,
> > > - enum port port,
> > > + struct intel_digital_port *dig_port,
> > >   const struct intel_hdcp_shim *shim)
> > >  {
> > >   struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
> > > @@ -2088,7 +2090,7 @@ int intel_hdcp_init(struct intel_connector 
> > > *connector,
> > >   return -EINVAL;
> > >  
> > >   if (is_hdcp2_supported(dev_priv) && !connector->mst_port)
> > > - intel_hdcp2_init(connector, port, shim);
> > > + intel_hdcp2_init(connector, dig_port, shim);
> > >  
> > >   ret =
> > >   drm_connector_attach_content_protection_property(>base,
> > > diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.h 
> > > b/drivers/gpu/drm/i915/display/intel_hdcp.h
> > > index b912a3a0f5b8..8f53b0c7fe5c 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_hdcp.h
> > > +++ b/drivers/gpu/drm/i915/display/intel_hdcp.h
> > > @@ -18,13 +18,15 @@ 

Re: [PATCH 16/19] gpu: drm: panel: panel-ilitek-ili9322: Demote non-conformant kernel-doc header

2020-11-05 Thread Lee Jones
On Thu, 05 Nov 2020, Sam Ravnborg wrote:

> Hi Lee.
> 
> On Thu, Nov 05, 2020 at 02:45:14PM +, Lee Jones wrote:
> > Fixes the following W=1 kernel build warning(s):
> > 
> >  drivers/gpu/drm/panel/panel-ilitek-ili9322.c:177: warning: Enum value 
> > 'ILI9322_INPUT_SRGB_THROUGH' not described in enum 'ili9322_input'
> >  drivers/gpu/drm/panel/panel-ilitek-ili9322.c:177: warning: Enum value 
> > 'ILI9322_INPUT_SRGB_ALIGNED' not described in enum 'ili9322_input'
> >  drivers/gpu/drm/panel/panel-ilitek-ili9322.c:177: warning: Enum value 
> > 'ILI9322_INPUT_SRGB_DUMMY_320X240' not described in enum 'ili9322_input'
> >  drivers/gpu/drm/panel/panel-ilitek-ili9322.c:177: warning: Enum value 
> > 'ILI9322_INPUT_SRGB_DUMMY_360X240' not described in enum 'ili9322_input'
> >  drivers/gpu/drm/panel/panel-ilitek-ili9322.c:177: warning: Enum value 
> > 'ILI9322_INPUT_DISABLED_1' not described in enum 'ili9322_input'
> >  drivers/gpu/drm/panel/panel-ilitek-ili9322.c:177: warning: Enum value 
> > 'ILI9322_INPUT_PRGB_THROUGH' not described in enum 'ili9322_input'
> >  drivers/gpu/drm/panel/panel-ilitek-ili9322.c:177: warning: Enum value 
> > 'ILI9322_INPUT_PRGB_ALIGNED' not described in enum 'ili9322_input'
> >  drivers/gpu/drm/panel/panel-ilitek-ili9322.c:177: warning: Enum value 
> > 'ILI9322_INPUT_YUV_640X320_YCBCR' not described in enum 'ili9322_input'
> >  drivers/gpu/drm/panel/panel-ilitek-ili9322.c:177: warning: Enum value 
> > 'ILI9322_INPUT_YUV_720X360_YCBCR' not described in enum 'ili9322_input'
> >  drivers/gpu/drm/panel/panel-ilitek-ili9322.c:177: warning: Enum value 
> > 'ILI9322_INPUT_DISABLED_2' not described in enum 'ili9322_input'
> >  drivers/gpu/drm/panel/panel-ilitek-ili9322.c:177: warning: Enum value 
> > 'ILI9322_INPUT_ITU_R_BT656_720X360_YCBCR' not described in enum 
> > 'ili9322_input'
> >  drivers/gpu/drm/panel/panel-ilitek-ili9322.c:177: warning: Enum value 
> > 'ILI9322_INPUT_ITU_R_BT656_640X320_YCBCR' not described in enum 
> > 'ili9322_input'
> >  drivers/gpu/drm/panel/panel-ilitek-ili9322.c:177: warning: Enum value 
> > 'ILI9322_INPUT_UNKNOWN' not described in enum 'ili9322_input'
> > 
> > Cc: Thierry Reding 
> > Cc: Sam Ravnborg 
> > Cc: David Airlie 
> > Cc: Daniel Vetter 
> > Cc: Linus Walleij 
> > Cc: dri-devel@lists.freedesktop.org
> > Signed-off-by: Lee Jones 
> 
> Applied to drm-misc-next.

Thanks for all these Sam.

Any idea what happens to the other patches?

Do they go in via a different Maintainer?

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 03/19] gpu: drm: imx: ipuv3-plane: Mark 'crtc_state' as __always_unused

2020-11-05 Thread Lee Jones
On Thu, 05 Nov 2020, Ahmad Fatoum wrote:

> Hello Lee,
> 
> On 11/5/20 3:45 PM, Lee Jones wrote:
> > In the macro for_each_oldnew_crtc_in_state() 'crtc_state' is provided
> > as a container for state->crtcs[i].new_state, but is not utilised in
> > this use-case.  We cannot simply delete the variable, so here we tell
> > the compiler that we're intentionally discarding the read value.
> 
> for_each_oldnew_crtc_in_state already (void) casts the drm_crtc and the old
> drm_crtc_state to silence unused-but-set-variable warning. Should we maybe
> (void) cast the new crtc_state as well?

From what I saw, it only void casts the ones which aren't assigned.

> > Fixes the following W=1 kernel build warning(s):
> > 
> >  drivers/gpu/drm/imx/ipuv3-plane.c: In function ‘ipu_planes_assign_pre’:
> >  drivers/gpu/drm/imx/ipuv3-plane.c:746:42: warning: variable ‘crtc_state’ 
> > set but not used [-Wunused-but-set-variable]
> > 
> > Cc: Philipp Zabel 
> > Cc: David Airlie 
> > Cc: Daniel Vetter 
> > Cc: Shawn Guo 
> > Cc: Sascha Hauer 
> > Cc: Pengutronix Kernel Team 
> > Cc: Fabio Estevam 
> > Cc: NXP Linux Team 
> > Cc: dri-devel@lists.freedesktop.org
> > Signed-off-by: Lee Jones 
> > ---
> >  drivers/gpu/drm/imx/ipuv3-plane.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c 
> > b/drivers/gpu/drm/imx/ipuv3-plane.c
> > index 8a4235d9d9f1e..acc0a3ce4992f 100644
> > --- a/drivers/gpu/drm/imx/ipuv3-plane.c
> > +++ b/drivers/gpu/drm/imx/ipuv3-plane.c
> > @@ -743,7 +743,7 @@ bool ipu_plane_atomic_update_pending(struct drm_plane 
> > *plane)
> >  int ipu_planes_assign_pre(struct drm_device *dev,
> >   struct drm_atomic_state *state)
> >  {
> > -   struct drm_crtc_state *old_crtc_state, *crtc_state;
> > +   struct drm_crtc_state *old_crtc_state, __always_unused *crtc_state;
> > struct drm_plane_state *plane_state;
> > struct ipu_plane_state *ipu_state;
> > struct ipu_plane *ipu_plane;
> > 
> 

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [Freedreno] [PATCH v5 3/3] dt-bindings: drm/msm/gpu: Add cooling device support

2020-11-05 Thread Akhil P Oommen

On 11/5/2020 2:28 AM, Rob Clark wrote:

On Wed, Nov 4, 2020 at 12:03 PM Rob Herring  wrote:


On Fri, 30 Oct 2020 16:17:12 +0530, Akhil P Oommen wrote:

Add cooling device support to gpu. A cooling device is bound to a
thermal zone to allow thermal mitigation.

Signed-off-by: Akhil P Oommen 
Reviewed-by: Matthias Kaehlcke 
---
  Documentation/devicetree/bindings/display/msm/gpu.txt | 7 +++
  1 file changed, 7 insertions(+)




Please add Acked-by/Reviewed-by tags when posting new versions. However,
there's no need to repost patches *only* to add the tags. The upstream
maintainer will do that for acks received on the version they apply.

If a tag was not added on purpose, please state why and what changed.




Thanks Rob

I've copied over your ack from the previous version.. but yes, it
definitely makes my life easier when patch senders do this for me ;-)

BR,
-R


Robh, you Acked v4 after I shared v5 patches!!

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


Re: [PATCH] drm/ast: Fixed 1920x1080 sync. polarity issue

2020-11-05 Thread Thomas Zimmermann
Hi

Am 06.11.20 um 01:31 schrieb Kuo-Hsiang Chou:
> To Sir
> 
> Yes, I ran scripts/checkpatch.pl and cleared 3 errors about tailing spaces.
> 
> OK, would you please give me the mail-address of Daniel?

It's 

> And  will be removed from CC. 

Thanks!

> Because I ran get_maintainers.pl and got the result of " The current 
> directory does not appear to be a linux kernel source tree. "

Strange, that sounds like a problem in your setup. Go to the actual
directory where you checkout out the Linux source code; where the
MAINTAINERS file is located. From there use

  scripts/get_maintainers.pl

That should work.

Best regards
Thomas

> So, I got the information from MAINTAINERS by keyword of "/drm/ast", likes as:
> DRM DRIVER FOR AST SERVER GRAPHICS CHIPS
> M:Dave Airlie 
> R:Thomas Zimmermann 
> L:dri-devel@lists.freedesktop.org
> S:Supported
> T:git git://anongit.freedesktop.org/drm/drm-misc
> F:drivers/gpu/drm/ast/
> 
> Thanks and Have a good day,
>   Kuo-Hsiang Chou
> 
> -Original Message-
> From: Thomas Zimmermann [mailto:tzimmerm...@suse.de] 
> Sent: Thursday, November 05, 2020 8:09 PM
> To: Kuo-Hsiang Chou ; 
> dri-devel@lists.freedesktop.org
> Cc: e...@suse.com; Tommy Huang ; Jenmin Yuan 
> ; airl...@redhat.com; Arc Sung 
> 
> Subject: Re: [PATCH] drm/ast: Fixed 1920x1080 sync. polarity issue
> 
> Hi,
> 
> please follow the advise we're giving you. Had you run scripts/checkpatch.pl 
> on the patch file it would have told you
> 
> <<<
> ERROR: patch seems to be corrupt (line wrapped?)
> #102: FILE: drivers/gpu/drm/ast/ast_tables.h:294:
> 
> 
> ERROR: DOS line endings
> #106: FILE: drivers/gpu/drm/ast/ast_tables.h:297:
> +^I (SyncPP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo 
> +|^M$
> 
> ERROR: DOS line endings
> #110: FILE: drivers/gpu/drm/ast/ast_tables.h:300:
> +^I (SyncPP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo 
> +|^M$
> 
> total: 3 errors, 0 warnings, 19 lines checked

> 
> As said before, the mail e...@suse.de is still not relevant any longer.
> But you did not add Daniel into CC. Did you run scripts/get_maintainers.pl?
> 
> Best regards
> Thomas
> 
> Am 05.11.20 um 10:47 schrieb KuoHsiang Chou:
>> [Bug] Change the vertical synchroous polary of 1920x1080 @60Hz
>>   from  Negtive to Positive
>>
>> Signed-off-by: KuoHsiang Chou 
>> ---
>>  drivers/gpu/drm/ast/ast_tables.h | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/ast/ast_tables.h 
>> b/drivers/gpu/drm/ast/ast_tables.h
>> index 8414e543f260..51efc5b4a55c 100644
>> --- a/drivers/gpu/drm/ast/ast_tables.h
>> +++ b/drivers/gpu/drm/ast/ast_tables.h
>> @@ -295,10 +295,10 @@ static const struct ast_vbios_enhtable 
>> res_1600x900[] = {
>>
>>  static const struct ast_vbios_enhtable res_1920x1080[] = {
>>  {2200, 1920, 88, 44, 1125, 1080, 4, 5, VCLK148_5,   /* 60Hz */
>> - (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo |
>> + (SyncPP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo 
>> +|
>>AST2500PreCatchCRT), 60, 1, 0x38 },
>>  {2200, 1920, 88, 44, 1125, 1080, 4, 5, VCLK148_5,   /* 60Hz */
>> - (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo |
>> + (SyncPP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo 
>> +|
>>AST2500PreCatchCRT), 0xFF, 1, 0x38 },  };
>>
>> --
>> 2.18.4
>>
>> ___
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>>
> 
> --
> Thomas Zimmermann
> Graphics Driver Developer
> SUSE Software Solutions Germany GmbH
> Maxfeldstr. 5, 90409 Nürnberg, Germany
> (HRB 36809, AG Nürnberg)
> Geschäftsführer: Felix Imendörffer
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


OpenPGP_0x680DC11D530B7A23.asc
Description: application/pgp-keys


OpenPGP_signature
Description: OpenPGP digital signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v4 07/16] drm/i915/hdcp: Enable Gen12 HDCP 1.4 DP MST support

2020-11-05 Thread Anshuman Gupta
On 2020-11-05 at 21:11:52 +0530, Ramalingam C wrote:
> On 2020-10-27 at 22:11:59 +0530, Anshuman Gupta wrote:
> > Enable HDCP 1.4 over DP MST for Gen12.
> > This also enable the stream encryption support for
> > older generations, which was missing earlier.
> It will be nice to have them in separate patches.
Thanks for review comment.
Sure i will refactor a separate patch for this.
Thanks,
Anshuman Gupta
> 
> -Ram
> > 
> > v2:
> > - Added debug print for stream encryption.
> > - Disable the hdcp on port after disabling last stream
> >   encryption.
> > v3:
> > - Cosmetic change, removed the value less comment. [Uma]
> > 
> > Cc: Ramalingam C 
> > Signed-off-by: Anshuman Gupta 
> > ---
> >  drivers/gpu/drm/i915/display/intel_dp_mst.c | 10 ++---
> >  drivers/gpu/drm/i915/display/intel_hdcp.c   | 43 ++---
> >  2 files changed, 32 insertions(+), 21 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c 
> > b/drivers/gpu/drm/i915/display/intel_dp_mst.c
> > index 16865b200062..f00e12fc83e8 100644
> > --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c
> > +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c
> > @@ -826,13 +826,9 @@ static struct drm_connector 
> > *intel_dp_add_mst_connector(struct drm_dp_mst_topolo
> > intel_attach_force_audio_property(connector);
> > intel_attach_broadcast_rgb_property(connector);
> >  
> > -
> > -   /* TODO: Figure out how to make HDCP work on GEN12+ */
> > -   if (INTEL_GEN(dev_priv) < 12) {
> > -   ret = intel_dp_init_hdcp(dig_port, intel_connector);
> > -   if (ret)
> > -   DRM_DEBUG_KMS("HDCP init failed, skipping.\n");
> > -   }
> > +   ret = intel_dp_init_hdcp(dig_port, intel_connector);
> > +   if (ret)
> > +   drm_dbg_kms(_priv->drm, "HDCP init failed, skipping.\n");
> >  
> > /*
> >  * Reuse the prop from the SST connector because we're
> > diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c 
> > b/drivers/gpu/drm/i915/display/intel_hdcp.c
> > index 0322a83c151d..937af4aeaac2 100644
> > --- a/drivers/gpu/drm/i915/display/intel_hdcp.c
> > +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c
> > @@ -612,7 +612,12 @@ int intel_hdcp_auth_downstream(struct intel_connector 
> > *connector)
> > return ret;
> >  }
> >  
> > -/* Implements Part 1 of the HDCP authorization procedure */
> > +/*
> > + * Implements Part 1 of the HDCP authorization procedure.
> > + * Authentication Part 1 steps for Multi-stream DisplayPort.
> > + * Step 1. Auth Part 1 sequence on the driving MST Trasport Link.
> > + * Step 2. Enable encryption for each stream that requires encryption.
> > + */
> >  static int intel_hdcp_auth(struct intel_connector *connector)
> >  {
> > struct intel_digital_port *dig_port = 
> > intel_attached_dig_port(connector);
> > @@ -766,10 +771,16 @@ static int intel_hdcp_auth(struct intel_connector 
> > *connector)
> > return -ETIMEDOUT;
> > }
> >  
> > -   /*
> > -* XXX: If we have MST-connected devices, we need to enable encryption
> > -* on those as well.
> > -*/
> > +   /* DP MST Auth Part 1 Step 2.a and Step 2.b */
> > +   if (shim->stream_encryption) {
> > +   ret = shim->stream_encryption(dig_port, true);
> > +   if (ret) {
> > +   drm_err(_priv->drm, "Failed to enable HDCP 1.4 
> > stream enc\n");
> > +   return ret;
> > +   }
> > +   drm_dbg_kms(_priv->drm, "HDCP 1.4 tras %s stream 
> > encrypted\n",
> > +   transcoder_name(hdcp->stream_transcoder));
> > +   }
> >  
> > if (repeater_present)
> > return intel_hdcp_auth_downstream(connector);
> > @@ -791,18 +802,22 @@ static int _intel_hdcp_disable(struct intel_connector 
> > *connector)
> > drm_dbg_kms(_priv->drm, "[%s:%d] HDCP is being disabled...\n",
> > connector->base.name, connector->base.base.id);
> >  
> > +   if (hdcp->shim->stream_encryption) {
> > +   ret = hdcp->shim->stream_encryption(dig_port, false);
> > +   if (ret) {
> > +   drm_err(_priv->drm, "Failed to disable HDCP 1.4 
> > stream enc\n");
> > +   return ret;
> > +   }
> > +   drm_dbg_kms(_priv->drm, "HDCP 1.4 trans %s stream 
> > encryption disabled\n",
> > +   transcoder_name(hdcp->stream_transcoder));
> > +   }
> > +
> > /*
> > -* If there are other connectors on this port using HDCP, don't disable
> > -* it. Instead, toggle the HDCP signalling off on that particular
> > -* connector/pipe and exit.
> > +* If there are other connectors on this port using HDCP, don't disable 
> > it.
> > +* Repeat steps 1-2 for each stream that no longer requires encryption.
> >  */
> > -   if (dig_port->num_hdcp_streams > 0) {
> > -   ret = hdcp->shim->toggle_signalling(dig_port,
> > -   cpu_transcoder, false);
> > -   if (ret)
> > -   

Re: [PATCH v4 12/16] drm/i915/hdcp: MST streams support in hdcp port_data

2020-11-05 Thread Anshuman Gupta
On 2020-11-05 at 22:04:15 +0530, Ramalingam C wrote:
> On 2020-10-27 at 22:12:04 +0530, Anshuman Gupta wrote:
> > Add support for multiple mst stream in hdcp port data
> > which will be used by RepeaterAuthStreamManage msg and
> > HDCP 2.2 security f/w for m' validation.
> > 
> > v2:
> > Init the hdcp port data k for HDMI/DP SST strem.
> > 
> > v3:
> > Cosmetic changes. [Uma]
> > 
> > Cc: Ramalingam C 
> > Signed-off-by: Anshuman Gupta 
> > ---
> >  .../drm/i915/display/intel_display_types.h|   4 +-
> >  drivers/gpu/drm/i915/display/intel_hdcp.c | 103 +++---
> >  2 files changed, 92 insertions(+), 15 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h 
> > b/drivers/gpu/drm/i915/display/intel_display_types.h
> > index 749c3a7e0b45..24e0067c2e7c 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display_types.h
> > +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
> > @@ -1445,10 +1445,12 @@ struct intel_digital_port {
> > enum phy_fia tc_phy_fia;
> > u8 tc_phy_fia_idx;
> >  
> > -   /* protects num_hdcp_streams reference count, port_data */
> > +   /* protects num_hdcp_streams reference count, port_data and port_auth */
> > struct mutex hdcp_mutex;
> > /* the number of pipes using HDCP signalling out of this port */
> > unsigned int num_hdcp_streams;
> > +   /* port HDCP auth status */
> > +   bool port_auth;
> > /* HDCP port data need to pass to security f/w */
> > struct hdcp_port_data port_data;
> since this is no more in hdcp related struct, it will be better to be named as
> hdcp_auth_status and hdcp_port_data !?
sure i will do this chnage.
Thanks,
Anshuman Gupta.
> 
> -Ram
> >  
> > diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c 
> > b/drivers/gpu/drm/i915/display/intel_hdcp.c
> > index a5ec4f72f50f..1df6d4a23476 100644
> > --- a/drivers/gpu/drm/i915/display/intel_hdcp.c
> > +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c
> > @@ -26,6 +26,64 @@
> >  #define KEY_LOAD_TRIES 5
> >  #define HDCP2_LC_RETRY_CNT 3
> >  
> > +static int intel_conn_to_vcpi(struct intel_connector *connector)
> > +{
> > +   /* For HDMI this is forced to be 0x0. For DP SST also this is 0x0. */
> > +   return connector->port  ? connector->port->vcpi.vcpi : 0;
> > +}
> > +
> > +static int
> > +intel_hdcp_required_content_stream(struct intel_digital_port *dig_port)
> > +{
> > +   struct drm_connector_list_iter conn_iter;
> > +   struct intel_digital_port *conn_dig_port;
> > +   struct intel_connector *connector;
> > +   struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
> > +   struct hdcp_port_data *data = _port->port_data;
> > +   bool enforce_type0 = false;
> > +   int k;
> > +
> > +   if (dig_port->port_auth)
> > +   return 0;
> > +
> > +   drm_connector_list_iter_begin(>drm, _iter);
> > +   for_each_intel_connector_iter(connector, _iter) {
> > +   if (!intel_encoder_is_mst(intel_attached_encoder(connector)))
> > +   continue;
> > +
> > +   conn_dig_port = intel_attached_dig_port(connector);
> > +   if (conn_dig_port != dig_port)
> > +   continue;
> > +
> > +   if (connector->base.status == connector_status_disconnected)
> > +   continue;
> > +
> > +   if (!enforce_type0 && !intel_hdcp2_capable(connector))
> > +   enforce_type0 = true;
> > +
> > +   data->streams[data->k].stream_id = 
> > intel_conn_to_vcpi(connector);
> > +   data->k++;
> > +
> > +   /* if there is only one active stream */
> > +   if (dig_port->dp.active_mst_links <= 1)
> > +   break;
> > +   }
> > +   drm_connector_list_iter_end(_iter);
> > +
> > +   if (drm_WARN_ON(>drm, data->k > INTEL_NUM_PIPES(i915) || data->k 
> > == 0))
> > +   return -EINVAL;
> > +
> > +   /*
> > +* Apply common protection level across all streams in DP MST Topology.
> > +* Use highest supported content type for all streams in DP MST 
> > Topology.
> > +*/
> > +   for (k = 0; k < data->k; k++)
> > +   data->streams[k].stream_type =
> > +   enforce_type0 ? DRM_MODE_HDCP_CONTENT_TYPE0 : 
> > DRM_MODE_HDCP_CONTENT_TYPE1;
> > +
> > +   return 0;
> > +}
> > +
> >  static
> >  bool intel_hdcp_is_ksv_valid(u8 *ksv)
> >  {
> > @@ -1474,13 +1532,14 @@ static
> >  int _hdcp2_propagate_stream_management_info(struct intel_connector 
> > *connector)
> >  {
> > struct intel_digital_port *dig_port = 
> > intel_attached_dig_port(connector);
> > +   struct hdcp_port_data *data = _port->port_data;
> > struct intel_hdcp *hdcp = >hdcp;
> > union {
> > struct hdcp2_rep_stream_manage stream_manage;
> > struct hdcp2_rep_stream_ready stream_ready;
> > } msgs;
> > const struct intel_hdcp_shim *shim = hdcp->shim;
> > -   int ret;
> > +   int ret, streams_size_delta, i;
> >  
> > if (connector->hdcp.seq_num_m > HDCP_2_2_SEQ_NUM_MAX)

Re: [PATCH v4 06/16] drm/i915/hdcp: HDCP stream encryption support

2020-11-05 Thread Anshuman Gupta
On 2020-11-05 at 21:04:03 +0530, Ramalingam C wrote:
> On 2020-10-27 at 22:11:58 +0530, Anshuman Gupta wrote:
> > Both HDCP_{1.x,2.x} requires to select/deselect Multistream HDCP bit
> > in TRANS_DDI_FUNC_CTL in order to enable/disable stream HDCP
> > encryption over DP MST Transport Link.
> > 
> > HDCP 1.4 stream encryption requires to validate the stream encryption
> > status in HDCP_STATUS_{TRANSCODER,PORT} register driving that link
> > in order to enable/disable the stream encryption.
> > 
> > Both of above requirement are same for all Gen with respect to
> > B.Spec Documentation.
> > 
> > v2:
> > Cosmetic changes function name, error msg print and
> > stream typo fixes. [Uma]
> > 
> > Cc: Ramalingam C 
> > Signed-off-by: Anshuman Gupta 
> > ---
> >  drivers/gpu/drm/i915/display/intel_ddi.c  | 10 +--
> >  drivers/gpu/drm/i915/display/intel_ddi.h  |  6 +-
> >  .../drm/i915/display/intel_display_types.h|  4 +
> >  drivers/gpu/drm/i915/display/intel_dp_hdcp.c  | 80 ---
> >  drivers/gpu/drm/i915/display/intel_hdmi.c | 14 ++--
> >  drivers/gpu/drm/i915/i915_reg.h   |  1 +
> >  6 files changed, 90 insertions(+), 25 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c 
> > b/drivers/gpu/drm/i915/display/intel_ddi.c
> > index 9fce623e951e..779603a38cfc 100644
> > --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> > +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> > @@ -1948,9 +1948,9 @@ void intel_ddi_disable_transcoder_func(const struct 
> > intel_crtc_state *crtc_state
> > }
> >  }
> >  
> > -int intel_ddi_toggle_hdcp_signalling(struct intel_encoder *intel_encoder,
> > -enum transcoder cpu_transcoder,
> > -bool enable)
> > +int intel_ddi_toggle_hdcp_bits(struct intel_encoder *intel_encoder,
> > +  enum transcoder cpu_transcoder,
> > +  bool enable, u32 hdcp_mask)
> >  {
> > struct drm_device *dev = intel_encoder->base.dev;
> > struct drm_i915_private *dev_priv = to_i915(dev);
> > @@ -1965,9 +1965,9 @@ int intel_ddi_toggle_hdcp_signalling(struct 
> > intel_encoder *intel_encoder,
> >  
> > tmp = intel_de_read(dev_priv, TRANS_DDI_FUNC_CTL(cpu_transcoder));
> > if (enable)
> > -   tmp |= TRANS_DDI_HDCP_SIGNALLING;
> > +   tmp |= hdcp_mask;
> > else
> > -   tmp &= ~TRANS_DDI_HDCP_SIGNALLING;
> > +   tmp &= ~hdcp_mask;
> > intel_de_write(dev_priv, TRANS_DDI_FUNC_CTL(cpu_transcoder), tmp);
> > intel_display_power_put(dev_priv, intel_encoder->power_domain, wakeref);
> > return ret;
> > diff --git a/drivers/gpu/drm/i915/display/intel_ddi.h 
> > b/drivers/gpu/drm/i915/display/intel_ddi.h
> > index dcc711cfe4fe..a4dd815c 100644
> > --- a/drivers/gpu/drm/i915/display/intel_ddi.h
> > +++ b/drivers/gpu/drm/i915/display/intel_ddi.h
> > @@ -50,9 +50,9 @@ u32 bxt_signal_levels(struct intel_dp *intel_dp,
> >   const struct intel_crtc_state *crtc_state);
> >  u32 ddi_signal_levels(struct intel_dp *intel_dp,
> >   const struct intel_crtc_state *crtc_state);
> > -int intel_ddi_toggle_hdcp_signalling(struct intel_encoder *intel_encoder,
> > -enum transcoder cpu_transcoder,
> > -bool enable);
> > +int intel_ddi_toggle_hdcp_bits(struct intel_encoder *intel_encoder,
> > +  enum transcoder cpu_transcoder,
> > +  bool enable, u32 hdcp_mask);
> >  void icl_sanitize_encoder_pll_mapping(struct intel_encoder *encoder);
> >  
> >  #endif /* __INTEL_DDI_H__ */
> > diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h 
> > b/drivers/gpu/drm/i915/display/intel_display_types.h
> > index c47124a679b6..59b8fc21e3e8 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display_types.h
> > +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
> > @@ -339,6 +339,10 @@ struct intel_hdcp_shim {
> >  enum transcoder cpu_transcoder,
> >  bool enable);
> >  
> > +   /* Enable/Disable stream encryption on DP MST Transport Link */
> > +   int (*stream_encryption)(struct intel_digital_port *dig_port,
> > +bool enable);
> > +
> > /* Ensures the link is still protected */
> > bool (*check_link)(struct intel_digital_port *dig_port,
> >struct intel_connector *connector);
> > diff --git a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c 
> > b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
> > index 03424d20e9f7..6dcbfaffd2c5 100644
> > --- a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
> > +++ b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
> > @@ -16,6 +16,30 @@
> >  #include "intel_dp.h"
> >  #include "intel_hdcp.h"
> >  
> > +static unsigned int transcoder_to_stream_enc_status(enum transcoder 
> > cpu_transcoder)
> > +{
> > +   u32 stream_enc_mask;
> 

Re: [PATCH v4 13/16] drm/i915/hdcp: Pass connector to check_2_2_link

2020-11-05 Thread Anshuman Gupta
On 2020-11-05 at 22:15:37 +0530, Ramalingam C wrote:
> On 2020-10-27 at 22:12:05 +0530, Anshuman Gupta wrote:
> > This requires for HDCP 2.2 MST check link.
> > 
> > Cc: Ramalingam C 
> > Reviewed-by: Uma Shankar 
> > Signed-off-by: Anshuman Gupta 
> > ---
> >  drivers/gpu/drm/i915/display/intel_display_types.h | 3 ++-
> >  drivers/gpu/drm/i915/display/intel_dp_hdcp.c   | 3 ++-
> >  drivers/gpu/drm/i915/display/intel_hdcp.c  | 2 +-
> >  drivers/gpu/drm/i915/display/intel_hdmi.c  | 3 ++-
> >  4 files changed, 7 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h 
> > b/drivers/gpu/drm/i915/display/intel_display_types.h
> > index 24e0067c2e7c..dfb5be64e03a 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display_types.h
> > +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
> > @@ -375,7 +375,8 @@ struct intel_hdcp_shim {
> >   bool is_repeater, u8 type);
> >  
> > /* HDCP2.2 Link Integrity Check */
> > -   int (*check_2_2_link)(struct intel_digital_port *dig_port);
> > +   int (*check_2_2_link)(struct intel_digital_port *dig_port,
> > + struct intel_connector *connector);
> do we need both of them?
I have followed the HDCP 1.4 check_link signature.
https://patchwork.freedesktop.org/patch/386157/?series=78749=3
We need connector for QSES check, we can't retrieve DP MST connector from
dig_port.
Thanks,
Anshuman 
> 
> -Ram.
> >  };
> >  
> >  struct intel_hdcp {
> > diff --git a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c 
> > b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
> > index 591b68e5de48..4be61e7fde4e 100644
> > --- a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
> > +++ b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
> > @@ -585,7 +585,8 @@ int intel_dp_hdcp2_config_stream_type(struct 
> > intel_digital_port *dig_port,
> >  }
> >  
> >  static
> > -int intel_dp_hdcp2_check_link(struct intel_digital_port *dig_port)
> > +int intel_dp_hdcp2_check_link(struct intel_digital_port *dig_port,
> > + struct intel_connector *connector)
> >  {
> > u8 rx_status;
> > int ret;
> > diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c 
> > b/drivers/gpu/drm/i915/display/intel_hdcp.c
> > index 1df6d4a23476..87f7aaf3a319 100644
> > --- a/drivers/gpu/drm/i915/display/intel_hdcp.c
> > +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c
> > @@ -1940,7 +1940,7 @@ static int intel_hdcp2_check_link(struct 
> > intel_connector *connector)
> > goto out;
> > }
> >  
> > -   ret = hdcp->shim->check_2_2_link(dig_port);
> > +   ret = hdcp->shim->check_2_2_link(dig_port, connector);
> > if (ret == HDCP_LINK_PROTECTED) {
> > if (hdcp->value != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) {
> > intel_hdcp_update_value(connector,
> > diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c 
> > b/drivers/gpu/drm/i915/display/intel_hdmi.c
> > index 0788de04711b..bd0d91101464 100644
> > --- a/drivers/gpu/drm/i915/display/intel_hdmi.c
> > +++ b/drivers/gpu/drm/i915/display/intel_hdmi.c
> > @@ -1734,7 +1734,8 @@ int intel_hdmi_hdcp2_read_msg(struct 
> > intel_digital_port *dig_port,
> >  }
> >  
> >  static
> > -int intel_hdmi_hdcp2_check_link(struct intel_digital_port *dig_port)
> > +int intel_hdmi_hdcp2_check_link(struct intel_digital_port *dig_port,
> > +   struct intel_connector *connector)
> >  {
> > u8 rx_status[HDCP_2_2_HDMI_RXSTATUS_LEN];
> > int ret;
> > -- 
> > 2.26.2
> > 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v3 07/56] drm/omap: panel-dsi-cm: convert to transfer API

2020-11-05 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:44PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> This converts the panel-dsi-cm driver to use the transfer
> API instead of specific functions, so that the specific
> functions can be unexported and squashed into the generic
> transfer function.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 

There are a few very minor comments I would have made below, but as this
file is going away later in this series, it doesn't matter.

Acked-by: Laurent Pinchart 

> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 132 +-
>  1 file changed, 95 insertions(+), 37 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index b8f3a7aacbf4..8b2e80129bd8 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -140,45 +140,61 @@ static void hw_guard_wait(struct panel_drv_data *ddata)
>  static int dsicm_dcs_read_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 
> *data)
>  {
>   struct omap_dss_device *src = ddata->src;
> - int r;
> - u8 buf[1];
> -
> - r = src->ops->dsi.dcs_read(src, ddata->channel, dcs_cmd, buf, 1);
> -
> - if (r < 0)
> - return r;
> -
> - *data = buf[0];
> + const struct mipi_dsi_msg msg = {
> + .channel = ddata->channel,
> + .type = MIPI_DSI_DCS_READ,
> + .tx_len = 1,
> + .tx_buf = _cmd,
> + .rx_len = 1,
> + .rx_buf = data
> + };
>  
> - return 0;
> + return src->ops->dsi.transfer(src, );
>  }
>  
>  static int dsicm_dcs_write_0(struct panel_drv_data *ddata, u8 dcs_cmd)
>  {
>   struct omap_dss_device *src = ddata->src;
> + const struct mipi_dsi_msg msg = {
> + .channel = ddata->channel,
> + .type = MIPI_DSI_DCS_SHORT_WRITE,
> + .tx_buf = _cmd,
> + .tx_len = 1,
> + };
>  
> - return src->ops->dsi.dcs_write(src, ddata->channel, _cmd, 1);
> + return src->ops->dsi.transfer(src, );
>  }
>  
>  static int dsicm_dcs_write_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 
> param)
>  {
>   struct omap_dss_device *src = ddata->src;
> - u8 buf[2] = { dcs_cmd, param };
> + const u8 buf[] = { dcs_cmd, param };
> + const struct mipi_dsi_msg msg = {
> + .channel = ddata->channel,
> + .type = MIPI_DSI_DCS_SHORT_WRITE_PARAM,
> + .tx_buf = ,
> + .tx_len = 2,
> + };
>  
> - return src->ops->dsi.dcs_write(src, ddata->channel, buf, 2);
> + return src->ops->dsi.transfer(src, );
>  }
>  
>  static int dsicm_sleep_in(struct panel_drv_data *ddata)
>  
>  {
>   struct omap_dss_device *src = ddata->src;
> - u8 cmd;
>   int r;
> + const u8 cmd = MIPI_DCS_ENTER_SLEEP_MODE;
> + const struct mipi_dsi_msg msg = {
> + .channel = ddata->channel,
> + .type = MIPI_DSI_DCS_SHORT_WRITE,
> + .tx_buf = ,
> + .tx_len = 1,
> + };
>  
>   hw_guard_wait(ddata);
>  
> - cmd = MIPI_DCS_ENTER_SLEEP_MODE;
> - r = src->ops->dsi.dcs_write_nosync(src, ddata->channel, , 1);
> + r = src->ops->dsi.transfer(src, );
>   if (r)
>   return r;
>  
> @@ -233,28 +249,43 @@ static int dsicm_set_update_window(struct 
> panel_drv_data *ddata,
>   u16 y1 = y;
>   u16 y2 = y + h - 1;
>  
> - u8 buf[5];
> - buf[0] = MIPI_DCS_SET_COLUMN_ADDRESS;
> - buf[1] = (x1 >> 8) & 0xff;
> - buf[2] = (x1 >> 0) & 0xff;
> - buf[3] = (x2 >> 8) & 0xff;
> - buf[4] = (x2 >> 0) & 0xff;
> + const u8 paramX[] = {
> + MIPI_DCS_SET_COLUMN_ADDRESS,
> + (x1 >> 8) & 0xff,
> + (x1 >> 0) & 0xff,
> + (x2 >> 8) & 0xff,
> + (x2 >> 0) & 0xff,
> + };
>  
> - r = src->ops->dsi.dcs_write_nosync(src, ddata->channel, buf, 
> sizeof(buf));
> - if (r)
> - return r;
> + const struct mipi_dsi_msg msgX = {
> + .channel = ddata->channel,
> + .type = MIPI_DSI_GENERIC_LONG_WRITE,
> + .tx_buf = paramX,
> + .tx_len = 5,
> + };
> +
> + const u8 paramY[] = {
> + MIPI_DCS_SET_PAGE_ADDRESS,
> + (y1 >> 8) & 0xff,
> + (y1 >> 0) & 0xff,
> + (y2 >> 8) & 0xff,
> + (y2 >> 0) & 0xff,
> + };
>  
> - buf[0] = MIPI_DCS_SET_PAGE_ADDRESS;
> - buf[1] = (y1 >> 8) & 0xff;
> - buf[2] = (y1 >> 0) & 0xff;
> - buf[3] = (y2 >> 8) & 0xff;
> - buf[4] = (y2 >> 0) & 0xff;
> + const struct mipi_dsi_msg msgY = {
> + .channel = ddata->channel,
> + .type = MIPI_DSI_GENERIC_LONG_WRITE,
> + .tx_buf = paramY,
> + .tx_len = 5,
> + };
>  
> - r = src->ops->dsi.dcs_write_nosync(src, 

Re: [PATCH v3 06/56] drm/omap: dsi: add generic transfer function

2020-11-05 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:43PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> This prepares the driver for becoming a mipi_dsi_host implementation,
> which provides a generic transfer function instead of all kind of
> different read/write functions. The implementation will become more
> elegant after unexporting the specific functions in the following
> patches.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 
> ---
>  drivers/gpu/drm/omapdrm/dss/dsi.c | 54 +++
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  3 ++
>  2 files changed, 57 insertions(+)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 22d74d762a10..59a62d1d41cb 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -4842,6 +4842,58 @@ static void dsi_release_vc(struct omap_dss_device 
> *dssdev, int channel)
>   }
>  }
>  
> +static ssize_t omap_dsi_transfer(struct omap_dss_device *dssdev,
> +  const struct mipi_dsi_msg *msg)
> +{
> + /*
> +  * no_sync can be used to optimize performance by sending e.g. column

Can we start this with "TODO: no_sync can ..." to make it standout as
something to be addressed ?

> +  * and page information without syncing in between. It's not absolutley

s/absolutley/absolutely/

Reviewed-by: Laurent Pinchart 

> +  * required, so postpone this feature for now.
> +  */
> + bool no_sync = false;
> + u16 val;
> +
> + switch (msg->type) {
> + case MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM:
> + case MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM:
> + case MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM:
> + case MIPI_DSI_GENERIC_LONG_WRITE:
> + if (no_sync)
> + return dsi_vc_generic_write_nosync(dssdev, msg->channel,
> +msg->tx_buf,
> +msg->tx_len);
> + else
> + return dsi_vc_generic_write(dssdev, msg->channel,
> + msg->tx_buf, msg->tx_len);
> + case MIPI_DSI_DCS_SHORT_WRITE:
> + case MIPI_DSI_DCS_SHORT_WRITE_PARAM:
> + case MIPI_DSI_DCS_LONG_WRITE:
> + if (no_sync)
> + return dsi_vc_dcs_write_nosync(dssdev, msg->channel,
> +msg->tx_buf,
> +msg->tx_len);
> + else
> + return dsi_vc_dcs_write(dssdev, msg->channel,
> + msg->tx_buf, msg->tx_len);
> + case MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM:
> + case MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM:
> + case MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM:
> + return dsi_vc_generic_read(dssdev, msg->channel,
> +msg->tx_buf, msg->tx_len,
> +msg->rx_buf, msg->rx_len);
> + case MIPI_DSI_DCS_READ:
> + return dsi_vc_dcs_read(dssdev, msg->channel,
> +((u8 *)msg->tx_buf)[0],
> +msg->rx_buf, msg->rx_len);
> + case MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE:
> + val = le16_to_cpu(*((__le16 *)msg->tx_buf));
> + return dsi_vc_set_max_rx_packet_size(dssdev, msg->channel, val);
> + case MIPI_DSI_NULL_PACKET:
> + return dsi_vc_send_null(to_dsi_data(dssdev), msg->channel);
> + }
> +
> + return -EINVAL;
> +}
>  
>  static int dsi_get_clocks(struct dsi_data *dsi)
>  {
> @@ -4896,6 +4948,8 @@ static const struct omap_dss_device_ops dsi_ops = {
>   .set_vc_id = dsi_set_vc_id,
>   .release_vc = dsi_release_vc,
>  
> + .transfer = omap_dsi_transfer,
> +
>   .dcs_write = dsi_vc_dcs_write,
>   .dcs_write_nosync = dsi_vc_dcs_write_nosync,
>   .dcs_read = dsi_vc_dcs_read,
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 8e96ab2f20b6..654618e5a4e5 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -308,6 +308,9 @@ struct omapdss_dsi_ops {
>   void (*release_vc)(struct omap_dss_device *dssdev, int channel);
>  
>   /* data transfer */
> + ssize_t (*transfer)(struct omap_dss_device *dssdev,
> + const struct mipi_dsi_msg *msg);
> +
>   int (*dcs_write)(struct omap_dss_device *dssdev, int channel,
>   const u8 *data, int len);
>   int (*dcs_write_nosync)(struct omap_dss_device *dssdev, int channel,

-- 
Regards,

Laurent Pinchart
___
dri-devel mailing list
dri-devel@lists.freedesktop.org

Re: [PATCH v4 08/16] drm/i915/hdcp: Pass dig_port to intel_hdcp_init

2020-11-05 Thread Anshuman Gupta
On 2020-11-05 at 22:09:12 +0530, Ramalingam C wrote:
> On 2020-10-27 at 22:12:00 +0530, Anshuman Gupta wrote:
> > Pass dig_port as an argument to intel_hdcp_init()
> > and intel_hdcp2_init().
> > This will be required for HDCP 2.2 stream encryption.
> > 
> > Cc: Ramalingam C 
> > Reviewed-by: Uma Shankar 
> > Signed-off-by: Anshuman Gupta 
> > ---
> >  drivers/gpu/drm/i915/display/intel_dp_hdcp.c |  4 ++--
> >  drivers/gpu/drm/i915/display/intel_hdcp.c| 12 +++-
> >  drivers/gpu/drm/i915/display/intel_hdcp.h|  4 +++-
> >  drivers/gpu/drm/i915/display/intel_hdmi.c|  2 +-
> >  4 files changed, 13 insertions(+), 9 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c 
> > b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
> > index 6dcbfaffd2c5..591b68e5de48 100644
> > --- a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
> > +++ b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
> > @@ -751,10 +751,10 @@ int intel_dp_init_hdcp(struct intel_digital_port 
> > *dig_port,
> > return 0;
> >  
> > if (intel_connector->mst_port)
> > -   return intel_hdcp_init(intel_connector, port,
> > +   return intel_hdcp_init(intel_connector, dig_port,
> cant we retrieve the dig_port from connector?
No, actually intel_hdcp_init get called for DP MST in atomic check phase,
in atomic check phase DP MST connector->encoder is not initialize  yet,
it initialize  with DP MST encoder in commit phase.
so using intel_attached_dig_port(connector) results in OOPS in 
intel_hdcp_init().
Thanks,
Anshuman Gupta.
> 
> -Ram
> >_dp_mst_hdcp_shim);
> > else if (!intel_dp_is_edp(intel_dp))
> > -   return intel_hdcp_init(intel_connector, port,
> > +   return intel_hdcp_init(intel_connector, dig_port,
> >_dp_hdcp_shim);
> >  
> > return 0;
> > diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c 
> > b/drivers/gpu/drm/i915/display/intel_hdcp.c
> > index 937af4aeaac2..b0f47687bc59 100644
> > --- a/drivers/gpu/drm/i915/display/intel_hdcp.c
> > +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c
> > @@ -1982,12 +1982,13 @@ static enum mei_fw_tc intel_get_mei_fw_tc(enum 
> > transcoder cpu_transcoder)
> >  }
> >  
> >  static int initialize_hdcp_port_data(struct intel_connector *connector,
> > -enum port port,
> > +struct intel_digital_port *dig_port,
> >  const struct intel_hdcp_shim *shim)
> >  {
> > struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
> > struct intel_hdcp *hdcp = >hdcp;
> > struct hdcp_port_data *data = >port_data;
> > +   enum port port = dig_port->base.port;
> >  
> > if (INTEL_GEN(dev_priv) < 12)
> > data->fw_ddi = intel_get_mei_fw_ddi_index(port);
> > @@ -2060,14 +2061,15 @@ void intel_hdcp_component_init(struct 
> > drm_i915_private *dev_priv)
> > }
> >  }
> >  
> > -static void intel_hdcp2_init(struct intel_connector *connector, enum port 
> > port,
> > +static void intel_hdcp2_init(struct intel_connector *connector,
> > +struct intel_digital_port *dig_port,
> >  const struct intel_hdcp_shim *shim)
> >  {
> > struct drm_i915_private *i915 = to_i915(connector->base.dev);
> > struct intel_hdcp *hdcp = >hdcp;
> > int ret;
> >  
> > -   ret = initialize_hdcp_port_data(connector, port, shim);
> > +   ret = initialize_hdcp_port_data(connector, dig_port, shim);
> > if (ret) {
> > drm_dbg_kms(>drm, "Mei hdcp data init failed\n");
> > return;
> > @@ -2077,7 +2079,7 @@ static void intel_hdcp2_init(struct intel_connector 
> > *connector, enum port port,
> >  }
> >  
> >  int intel_hdcp_init(struct intel_connector *connector,
> > -   enum port port,
> > +   struct intel_digital_port *dig_port,
> > const struct intel_hdcp_shim *shim)
> >  {
> > struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
> > @@ -2088,7 +2090,7 @@ int intel_hdcp_init(struct intel_connector *connector,
> > return -EINVAL;
> >  
> > if (is_hdcp2_supported(dev_priv) && !connector->mst_port)
> > -   intel_hdcp2_init(connector, port, shim);
> > +   intel_hdcp2_init(connector, dig_port, shim);
> >  
> > ret =
> > drm_connector_attach_content_protection_property(>base,
> > diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.h 
> > b/drivers/gpu/drm/i915/display/intel_hdcp.h
> > index b912a3a0f5b8..8f53b0c7fe5c 100644
> > --- a/drivers/gpu/drm/i915/display/intel_hdcp.h
> > +++ b/drivers/gpu/drm/i915/display/intel_hdcp.h
> > @@ -18,13 +18,15 @@ struct intel_connector;
> >  struct intel_crtc_state;
> >  struct intel_encoder;
> >  struct intel_hdcp_shim;
> > +struct intel_digital_port;
> >  enum port;
> >  enum transcoder;
> >  
> >  void intel_hdcp_atomic_check(struct drm_connector *connector,
> 

Re: [PATCH v3 05/56] drm/omap: constify write buffers

2020-11-05 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:42PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> The write buffers are not modified, so they can be constant.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/gpu/drm/omapdrm/dss/dsi.c | 24 
>  drivers/gpu/drm/omapdrm/dss/omapdss.h | 10 +-
>  2 files changed, 17 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 86b9d435fb94..22d74d762a10 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -2601,11 +2601,11 @@ static inline void dsi_vc_write_long_payload(struct 
> dsi_data *dsi, int channel,
>  }
>  
>  static int dsi_vc_send_long(struct dsi_data *dsi, int channel, u8 data_type,
> - u8 *data, u16 len, u8 ecc)
> + const u8 *data, u16 len, u8 ecc)
>  {
>   /*u32 val; */
>   int i;
> - u8 *p;
> + const u8 *p;
>   int r = 0;
>   u8 b1, b2, b3, b4;
>  
> @@ -2698,7 +2698,7 @@ static int dsi_vc_send_null(struct dsi_data *dsi, int 
> channel)
>  }
>  
>  static int dsi_vc_write_nosync_common(struct dsi_data *dsi, int channel,
> -   u8 *data, int len,
> +   const u8 *data, int len,
> enum dss_dsi_content_type type)
>  {
>   int r;
> @@ -2729,7 +2729,7 @@ static int dsi_vc_write_nosync_common(struct dsi_data 
> *dsi, int channel,
>  }
>  
>  static int dsi_vc_dcs_write_nosync(struct omap_dss_device *dssdev, int 
> channel,
> - u8 *data, int len)
> + const u8 *data, int len)
>  {
>   struct dsi_data *dsi = to_dsi_data(dssdev);
>  
> @@ -2738,7 +2738,7 @@ static int dsi_vc_dcs_write_nosync(struct 
> omap_dss_device *dssdev, int channel,
>  }
>  
>  static int dsi_vc_generic_write_nosync(struct omap_dss_device *dssdev, int 
> channel,
> - u8 *data, int len)
> + const u8 *data, int len)
>  {
>   struct dsi_data *dsi = to_dsi_data(dssdev);
>  
> @@ -2747,7 +2747,7 @@ static int dsi_vc_generic_write_nosync(struct 
> omap_dss_device *dssdev, int chann
>  }
>  
>  static int dsi_vc_write_common(struct omap_dss_device *dssdev,
> -int channel, u8 *data, int len,
> +int channel, const u8 *data, int len,
>  enum dss_dsi_content_type type)
>  {
>   struct dsi_data *dsi = to_dsi_data(dssdev);
> @@ -2776,15 +2776,15 @@ static int dsi_vc_write_common(struct omap_dss_device 
> *dssdev,
>   return r;
>  }
>  
> -static int dsi_vc_dcs_write(struct omap_dss_device *dssdev, int channel, u8 
> *data,
> - int len)
> +static int dsi_vc_dcs_write(struct omap_dss_device *dssdev, int channel,
> + const u8 *data, int len)
>  {
>   return dsi_vc_write_common(dssdev, channel, data, len,
>   DSS_DSI_CONTENT_DCS);
>  }
>  
> -static int dsi_vc_generic_write(struct omap_dss_device *dssdev, int channel, 
> u8 *data,
> - int len)
> +static int dsi_vc_generic_write(struct omap_dss_device *dssdev, int channel,
> + const u8 *data, int len)
>  {
>   return dsi_vc_write_common(dssdev, channel, data, len,
>   DSS_DSI_CONTENT_GENERIC);
> @@ -2810,7 +2810,7 @@ static int dsi_vc_dcs_send_read_request(struct dsi_data 
> *dsi, int channel,
>  }
>  
>  static int dsi_vc_generic_send_read_request(struct dsi_data *dsi, int 
> channel,
> - u8 *reqdata, int reqlen)
> + const u8 *reqdata, int reqlen)
>  {
>   u16 data;
>   u8 data_type;
> @@ -2983,7 +2983,7 @@ static int dsi_vc_dcs_read(struct omap_dss_device 
> *dssdev, int channel, u8 dcs_c
>  }
>  
>  static int dsi_vc_generic_read(struct omap_dss_device *dssdev, int channel,
> - u8 *reqdata, int reqlen, u8 *buf, int buflen)
> + const u8 *reqdata, int reqlen, u8 *buf, int buflen)
>  {
>   struct dsi_data *dsi = to_dsi_data(dssdev);
>   int r;
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index c4bc1f919ab4..8e96ab2f20b6 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -309,18 +309,18 @@ struct omapdss_dsi_ops {
>  
>   /* data transfer */
>   int (*dcs_write)(struct omap_dss_device *dssdev, int channel,
> - u8 *data, int len);
> + const u8 *data, int len);
>   int (*dcs_write_nosync)(struct omap_dss_device *dssdev, int channel,
> - u8 *data, int len);
> + const u8 *data, int len);
>   int (*dcs_read)(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd,
>

Re: [PATCH v3 04/56] drm/omap: dsi: use MIPI_DSI_FMT_* instead of OMAP_DSS_DSI_FMT_*

2020-11-05 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:41PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> This replaces OMAP specific enum for pixel format with
> common implementation.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 

Reviewed-by: Laurent Pinchart 

> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  2 +-
>  drivers/gpu/drm/omapdrm/dss/dsi.c | 55 ---
>  drivers/gpu/drm/omapdrm/dss/omapdss.h | 13 ++---
>  3 files changed, 28 insertions(+), 42 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index ff610d2a13fd..b8f3a7aacbf4 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -595,7 +595,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>   int r;
>   struct omap_dss_dsi_config dsi_config = {
>   .mode = OMAP_DSS_DSI_CMD_MODE,
> - .pixel_format = OMAP_DSS_DSI_FMT_RGB888,
> + .pixel_format = MIPI_DSI_FMT_RGB888,
>   .vm = >vm,
>   .hs_clk_min = 15000,
>   .hs_clk_max = 3,
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 5598fc8f91db..86b9d435fb94 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -33,6 +33,7 @@
>  #include 
>  #include 
>  
> +#include 
>  #include 
>  
>  #include "omapdss.h"
> @@ -410,7 +411,7 @@ struct dsi_data {
>  
>   struct dss_lcd_mgr_config mgr_config;
>   struct videomode vm;
> - enum omap_dss_dsi_pixel_format pix_fmt;
> + enum mipi_dsi_pixel_format pix_fmt;
>   enum omap_dss_dsi_mode mode;
>   struct omap_dss_dsi_videomode_timings vm_timings;
>  
> @@ -514,22 +515,6 @@ static inline bool wait_for_bit_change(struct dsi_data 
> *dsi,
>   return false;
>  }
>  
> -static u8 dsi_get_pixel_size(enum omap_dss_dsi_pixel_format fmt)
> -{
> - switch (fmt) {
> - case OMAP_DSS_DSI_FMT_RGB888:
> - case OMAP_DSS_DSI_FMT_RGB666:
> - return 24;
> - case OMAP_DSS_DSI_FMT_RGB666_PACKED:
> - return 18;
> - case OMAP_DSS_DSI_FMT_RGB565:
> - return 16;
> - default:
> - BUG();
> - return 0;
> - }
> -}
> -
>  #ifdef DSI_PERF_MEASURE
>  static void dsi_perf_mark_setup(struct dsi_data *dsi)
>  {
> @@ -3239,7 +3224,7 @@ static void dsi_config_vp_num_line_buffers(struct 
> dsi_data *dsi)
>   int num_line_buffers;
>  
>   if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE) {
> - int bpp = dsi_get_pixel_size(dsi->pix_fmt);
> + int bpp = mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt);
>   const struct videomode *vm = >vm;
>   /*
>* Don't use line buffers if width is greater than the video
> @@ -3370,7 +3355,7 @@ static void dsi_config_cmd_mode_interleaving(struct 
> dsi_data *dsi)
>   int tclk_trail, ths_exit, exiths_clk;
>   bool ddr_alwon;
>   const struct videomode *vm = >vm;
> - int bpp = dsi_get_pixel_size(dsi->pix_fmt);
> + int bpp = mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt);
>   int ndl = dsi->num_lanes_used - 1;
>   int dsi_fclk_hsdiv = dsi->user_dsi_cinfo.mX[HSDIV_DSI] + 1;
>   int hsa_interleave_hs = 0, hsa_interleave_lp = 0;
> @@ -3498,7 +3483,7 @@ static int dsi_proto_config(struct dsi_data *dsi)
>   dsi_set_lp_rx_timeout(dsi, 0x1fff, true, true);
>   dsi_set_hs_tx_timeout(dsi, 0x1fff, true, true);
>  
> - switch (dsi_get_pixel_size(dsi->pix_fmt)) {
> + switch (mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt)) {
>   case 16:
>   buswidth = 0;
>   break;
> @@ -3619,7 +3604,7 @@ static void dsi_proto_timings(struct dsi_data *dsi)
>   int window_sync = dsi->vm_timings.window_sync;
>   bool hsync_end;
>   const struct videomode *vm = >vm;
> - int bpp = dsi_get_pixel_size(dsi->pix_fmt);
> + int bpp = mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt);
>   int tl, t_he, width_bytes;
>  
>   hsync_end = dsi->vm_timings.trans_mode == 
> OMAP_DSS_DSI_PULSE_MODE;
> @@ -3726,7 +3711,7 @@ static int dsi_configure_pins(struct omap_dss_device 
> *dssdev,
>  static int dsi_enable_video_output(struct omap_dss_device *dssdev, int 
> channel)
>  {
>   struct dsi_data *dsi = to_dsi_data(dssdev);
> - int bpp = dsi_get_pixel_size(dsi->pix_fmt);
> + int bpp = mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt);
>   u8 data_type;
>   u16 word_count;
>   int r;
> @@ -3737,16 +3722,16 @@ static int dsi_enable_video_output(struct 
> omap_dss_device *dssdev, int channel)
>  
>   if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE) {
>   switch (dsi->pix_fmt) {
> - case OMAP_DSS_DSI_FMT_RGB888:
> + 

Re: [PATCH v3 03/56] drm/omap: drop unused dsi.configure_pins

2020-11-05 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:40PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> The panel-dsi-cm's ddata->pin_config is always NULL, so this
> callback is never called. Instead the DSI encoder gets the pin
> configuration directly from DT.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 11 ---
>  drivers/gpu/drm/omapdrm/dss/dsi.c   |  1 -
>  drivers/gpu/drm/omapdrm/dss/omapdss.h   |  2 --
>  3 files changed, 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index faca5c873bde..ff610d2a13fd 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -68,8 +68,6 @@ struct panel_drv_data {
>   int width_mm;
>   int height_mm;
>  
> - struct omap_dsi_pin_config pin_config;
> -
>   /* runtime variables */
>   bool enabled;
>  
> @@ -623,15 +621,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>   }
>   }
>  
> - if (ddata->pin_config.num_pins > 0) {
> - r = src->ops->dsi.configure_pins(src, >pin_config);
> - if (r) {
> - dev_err(>pdev->dev,
> - "failed to configure DSI pins\n");
> - goto err_vddi;
> - }
> - }
> -
>   r = src->ops->dsi.set_config(src, _config);
>   if (r) {
>   dev_err(>pdev->dev, "failed to configure DSI\n");
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index eeccf40bae41..5598fc8f91db 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -4892,7 +4892,6 @@ static const struct omap_dss_device_ops dsi_ops = {
>  
>   .enable_hs = dsi_vc_enable_hs,
>  
> - .configure_pins = dsi_configure_pins,
>   .set_config = dsi_set_config,
>  
>   .enable_video_output = dsi_enable_video_output,
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index cbbe10b2b60d..b0424daaceed 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -292,8 +292,6 @@ struct omapdss_dsi_ops {
>   /* bus configuration */
>   int (*set_config)(struct omap_dss_device *dssdev,
>   const struct omap_dss_dsi_config *cfg);
> - int (*configure_pins)(struct omap_dss_device *dssdev,
> - const struct omap_dsi_pin_config *pin_cfg);
>  
>   void (*enable_hs)(struct omap_dss_device *dssdev, int channel,
>   bool enable);

-- 
Regards,

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


Re: [PATCH v3 02/56] Revert "drm/omap: dss: Remove unused omap_dss_device operations"

2020-11-05 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:39PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> This reverts commit 4ff8e98879e6eeae9d125dfcf3b642075d00089d.

With this fixed as requested by Sam,

Reviewed-by: Laurent Pinchart 

> This is still needed by DSI. E.g. unloading modules without this will
> cause a crash.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 
> ---
>  drivers/gpu/drm/omapdrm/dss/base.c | 26 +++
>  drivers/gpu/drm/omapdrm/dss/omapdss.h  |  6 
>  drivers/gpu/drm/omapdrm/omap_encoder.c | 44 +++---
>  3 files changed, 71 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/base.c 
> b/drivers/gpu/drm/omapdrm/dss/base.c
> index c7650a7c155d..455b410f7401 100644
> --- a/drivers/gpu/drm/omapdrm/dss/base.c
> +++ b/drivers/gpu/drm/omapdrm/dss/base.c
> @@ -234,6 +234,18 @@ void omapdss_device_disconnect(struct omap_dss_device 
> *src,
>  }
>  EXPORT_SYMBOL_GPL(omapdss_device_disconnect);
>  
> +void omapdss_device_pre_enable(struct omap_dss_device *dssdev)
> +{
> + if (!dssdev)
> + return;
> +
> + omapdss_device_pre_enable(dssdev->next);
> +
> + if (dssdev->ops && dssdev->ops->pre_enable)
> + dssdev->ops->pre_enable(dssdev);
> +}
> +EXPORT_SYMBOL_GPL(omapdss_device_pre_enable);
> +
>  void omapdss_device_enable(struct omap_dss_device *dssdev)
>  {
>   if (!dssdev)
> @@ -260,6 +272,20 @@ void omapdss_device_disable(struct omap_dss_device 
> *dssdev)
>  }
>  EXPORT_SYMBOL_GPL(omapdss_device_disable);
>  
> +void omapdss_device_post_disable(struct omap_dss_device *dssdev)
> +{
> + if (!dssdev)
> + return;
> +
> + if (dssdev->ops && dssdev->ops->post_disable)
> + dssdev->ops->post_disable(dssdev);
> +
> + omapdss_device_post_disable(dssdev->next);
> +
> + dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
> +}
> +EXPORT_SYMBOL_GPL(omapdss_device_post_disable);
> +
>  /* 
> -
>   * Components Handling
>   */
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index ab19d4af8de7..cbbe10b2b60d 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -342,11 +342,15 @@ struct omap_dss_device_ops {
>   void (*disconnect)(struct omap_dss_device *dssdev,
>   struct omap_dss_device *dst);
>  
> + void (*pre_enable)(struct omap_dss_device *dssdev);
>   void (*enable)(struct omap_dss_device *dssdev);
>   void (*disable)(struct omap_dss_device *dssdev);
> + void (*post_disable)(struct omap_dss_device *dssdev);
>  
>   int (*check_timings)(struct omap_dss_device *dssdev,
>struct drm_display_mode *mode);
> + void (*set_timings)(struct omap_dss_device *dssdev,
> + const struct drm_display_mode *mode);
>  
>   int (*get_modes)(struct omap_dss_device *dssdev,
>struct drm_connector *connector);
> @@ -445,8 +449,10 @@ int omapdss_device_connect(struct dss_device *dss,
>  struct omap_dss_device *dst);
>  void omapdss_device_disconnect(struct omap_dss_device *src,
>  struct omap_dss_device *dst);
> +void omapdss_device_pre_enable(struct omap_dss_device *dssdev);
>  void omapdss_device_enable(struct omap_dss_device *dssdev);
>  void omapdss_device_disable(struct omap_dss_device *dssdev);
> +void omapdss_device_post_disable(struct omap_dss_device *dssdev);
>  
>  int omap_dss_get_num_overlay_managers(void);
>  
> diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c 
> b/drivers/gpu/drm/omapdrm/omap_encoder.c
> index ae4b867a67a3..18a79dde6815 100644
> --- a/drivers/gpu/drm/omapdrm/omap_encoder.c
> +++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
> @@ -113,8 +113,13 @@ static void omap_encoder_mode_set(struct drm_encoder 
> *encoder,
>   bus_flags = connector->display_info.bus_flags;
>   omap_encoder_update_videomode_flags(, bus_flags);
>  
> - /* Set timings for the dss manager. */
> + /* Set timings for all devices in the display pipeline. */
>   dss_mgr_set_timings(output, );
> +
> + for (dssdev = output; dssdev; dssdev = dssdev->next) {
> + if (dssdev->ops && dssdev->ops->set_timings)
> + dssdev->ops->set_timings(dssdev, adjusted_mode);
> + }
>  }
>  
>  static void omap_encoder_disable(struct drm_encoder *encoder)
> @@ -127,10 +132,26 @@ static void omap_encoder_disable(struct drm_encoder 
> *encoder)
>  
>   /*
>* Disable the chain of external devices, starting at the one at the
> -  * internal encoder's output. This is used for DSI outputs only, as
> -  * dssdev->next is NULL for all other outputs.
> +  * internal encoder's output.
>*/
>   omapdss_device_disable(dssdev->next);

Re: [PATCH v3 01/56] drm/dsi: add MIPI_DSI_MODE_ULPS_IDLE

2020-11-05 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:38PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> DSI command mode panels are self-refreshing displays, that
> can be updated very rarely for static images. For this kind
> of scenario some panels support, that the DSI bus switches
> into ULPS mode until the panel needs to be refreshed.
> 
> This is problematic on some panels, so introduce a flag to
> signal the DSI host implementation that the panel allows
> going into ULPS mode.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 

Reviewed-by: Laurent Pinchart 

> ---
>  include/drm/drm_mipi_dsi.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
> index 360e6377e84b..f36f89c14b4a 100644
> --- a/include/drm/drm_mipi_dsi.h
> +++ b/include/drm/drm_mipi_dsi.h
> @@ -132,6 +132,8 @@ struct mipi_dsi_host 
> *of_find_mipi_dsi_host_by_node(struct device_node *node);
>  #define MIPI_DSI_CLOCK_NON_CONTINUOUSBIT(10)
>  /* transmit data in low power */
>  #define MIPI_DSI_MODE_LPMBIT(11)
> +/* allow going into ULPS mode while command mode panel is not updated */
> +#define MIPI_DSI_MODE_ULPS_IDLE  BIT(12)
>  
>  enum mipi_dsi_pixel_format {
>   MIPI_DSI_FMT_RGB888,

-- 
Regards,

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


Re: [PATCH 08/19] gpu: drm: omapdrm: dss: dsi: Rework and remove a few unused variables

2020-11-05 Thread Laurent Pinchart
Hi Lee,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:45:06PM +, Lee Jones wrote:
> Fixes the following W=1 kernel build warning(s):
> 
>  drivers/gpu/drm/omapdrm/dss/dsi.c: In function ‘_dsi_print_reset_status’:
>  drivers/gpu/drm/omapdrm/dss/dsi.c:1131:6: warning: variable ‘l’ set but not 
> used [-Wunused-but-set-variable]
>  drivers/gpu/drm/omapdrm/dss/dsi.c: In function ‘dsi_update’:
>  drivers/gpu/drm/omapdrm/dss/dsi.c:3943:10: warning: variable ‘dh’ set but 
> not used [-Wunused-but-set-variable]
>  drivers/gpu/drm/omapdrm/dss/dsi.c:3943:6: warning: variable ‘dw’ set but not 
> used [-Wunused-but-set-variable]
> 
> Cc: Tomi Valkeinen 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: Laurent Pinchart 
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/gpu/drm/omapdrm/dss/dsi.c | 9 ++---
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index eeccf40bae416..5929b320b3cfa 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -1128,13 +1128,12 @@ static void dsi_runtime_put(struct dsi_data *dsi)
>  
>  static void _dsi_print_reset_status(struct dsi_data *dsi)
>  {
> - u32 l;
>   int b0, b1, b2;
>  
>   /* A dummy read using the SCP interface to any DSIPHY register is
>* required after DSIPHY reset to complete the reset of the DSI complex
>* I/O. */
> - l = dsi_read_reg(dsi, DSI_DSIPHY_CFG5);
> + dsi_read_reg(dsi, DSI_DSIPHY_CFG5);
>  
>   if (dsi->data->quirks & DSI_QUIRK_REVERSE_TXCLKESC) {
>   b0 = 28;
> @@ -3940,7 +3939,6 @@ static int dsi_update(struct omap_dss_device *dssdev, 
> int channel,
>   void (*callback)(int, void *), void *data)
>  {
>   struct dsi_data *dsi = to_dsi_data(dssdev);
> - u16 dw, dh;
>  
>   dsi_perf_mark_setup(dsi);
>  
> @@ -3949,11 +3947,8 @@ static int dsi_update(struct omap_dss_device *dssdev, 
> int channel,
>   dsi->framedone_callback = callback;
>   dsi->framedone_data = data;
>  
> - dw = dsi->vm.hactive;
> - dh = dsi->vm.vactive;
> -
>  #ifdef DSI_PERF_MEASURE
> - dsi->update_bytes = dw * dh *
> + dsi->update_bytes = dsi->vm.hactive * dsi->vm.vactive *
>   dsi_get_pixel_size(dsi->pix_fmt) / 8;
>  #endif
>   dsi_update_screen_dispc(dsi);

-- 
Regards,

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


[git pull] drm fixes for 5.10-rc3

2020-11-05 Thread Dave Airlie
Hey Linus,

It's Friday here so that means another installment of drm fixes to
distract you from the counting process.

Changes all over the place, the amdgpu changes contain support for a
new GPU that is close to current one already in the tree (Green
Sardine) so it shouldn't have much side effects.

Otherwise imx has a few cleanup patches and fixes, amdgpu and i915
have around the usual smattering of fixes, fonts got constified, and
vc4/panfrost has some minor fixes. All in all a fairly regular rc3.

I think we have an outstanding nouveau regression, but the author is
looking into the fix, so should be here next week.

I now return you to counting.
Dave.

drm-fixes-2020-11-06-1:
drm fixes for 5.10-rc3

fonts:
- constify font structures.

MAINTAINERS:
- Fix path for amdgpu power management

amdgpu:
- Add support for more navi1x SKUs
- Fix for suspend on CI dGPUs
- VCN DPG fix for Picasso
- Sienna Cichlid fixes
- Polaris DPM fix
- Add support for Green Sardine

amdkfd:
- Fix an allocation failure check

i915:
- Fix set domain's cache coherency
- Fixes around breadcrumbs
- Fix encoder lookup during PSR atomic
- Hold onto an explicit ref to i915_vma_work.pinned
- gvt: HWSP reset handling fix
- gvt: flush workaround
- gvt: vGPU context pin/unpin
- gvt: mmio cmd access fix for bxt/apl

imx:
- drop unused functions and callbacks
- reuse imx_drm_encoder_parse_of
- spinlock rework
- memory leak fix
- minor cleanups

vc4:
- resource cleanup fix

panfrost:
- madvise/shrinker fix
The following changes since commit 3cea11cd5e3b00d91caf0b4730194039b45c5891:

  Linux 5.10-rc2 (2020-11-01 14:43:51 -0800)

are available in the Git repository at:

  git://anongit.freedesktop.org/drm/drm tags/drm-fixes-2020-11-06-1

for you to fetch changes up to 356583b956e620a7ef8086f14bfe971986a320b3:

  Merge tag 'drm-misc-fixes-2020-11-05' of
git://anongit.freedesktop.org/drm/drm-misc into drm-fixes (2020-11-06
13:32:12 +1000)


drm fixes for 5.10-rc3

fonts:
- constify font structures.

MAINTAINERS:
- Fix path for amdgpu power management

amdgpu:
- Add support for more navi1x SKUs
- Fix for suspend on CI dGPUs
- VCN DPG fix for Picasso
- Sienna Cichlid fixes
- Polaris DPM fix
- Add support for Green Sardine

amdkfd:
- Fix an allocation failure check

i915:
- Fix set domain's cache coherency
- Fixes around breadcrumbs
- Fix encoder lookup during PSR atomic
- Hold onto an explicit ref to i915_vma_work.pinned
- gvt: HWSP reset handling fix
- gvt: flush workaround
- gvt: vGPU context pin/unpin
- gvt: mmio cmd access fix for bxt/apl

imx:
- drop unused functions and callbacks
- reuse imx_drm_encoder_parse_of
- spinlock rework
- memory leak fix
- minor cleanups

vc4:
- resource cleanup fix

panfrost:
- madvise/shrinker fix


Aaron Liu (1):
  drm/amdgpu: enable green_sardine_asd.bin loading (v2)

Alex Deucher (4):
  drm/amdgpu/powerplay: Only apply optimized mclk dpm policy on polaris
  drm/amdgpu/swsmu: remove duplicate call to smu_set_default_dpm_table
  drm/amdgpu: add Green_Sardine APU flag
  drm/amdgpu/display: remove DRM_AMD_DC_GREEN_SARDINE

Arnd Bergmann (1):
  drm/imx: tve remove extraneous type qualifier

Boris Brezillon (1):
  drm/panfrost: Fix a deadlock between the shrinker and madvise path

Chris Wilson (5):
  drm/i915/gem: Flush coherency domains on first set-domain-ioctl
  drm/i915/gt: Use the local HWSP offset during submission
  drm/i915/gt: Expose more parameters for emitting writes into the ring
  drm/i915/gt: Flush xcs before tgl breadcrumbs
  drm/i915: Hold onto an explicit ref to i915_vma_work.pinned

Colin Xu (4):
  drm/i915/gvt: Allow zero out HWSP addr on hws_pga_write
  drm/i915/gvt: Set SNOOP for PAT3 on BXT/APL to workaround GPU BB hang
  drm/i915/gvt: Only pin/unpin intel_context along with workload
  drm/i915/gvt: Fix mmio handler break on BXT/APL.

Dave Airlie (4):
  Merge tag 'imx-drm-next-2020-10-30' of
git://git.pengutronix.de/git/pza/linux into drm-fixes
  Merge tag 'drm-intel-fixes-2020-11-05' of
git://anongit.freedesktop.org/drm/drm-intel into drm-fixes
  Merge tag 'amd-drm-fixes-5.10-2020-11-04' of
git://people.freedesktop.org/~agd5f/linux into drm-fixes
  Merge tag 'drm-misc-fixes-2020-11-05' of
git://anongit.freedesktop.org/drm/drm-misc into drm-fixes

Evan Quan (5):
  drm/amdgpu: perform srbm soft reset always on SDMA resume
  drm/amd/pm: correct the baco reset sequence for CI ASICs
  drm/amd/pm: enable baco reset for Hawaii
  drm/amd/pm: perform SMC reset on suspend/hibernation
  drm/amd/pm: do not use ixFEATURE_STATUS for checking smc running

Flora Cui (2):
  drm/amdgpu: disable DCN and VCN for Navi14 0x7340/C9 SKU
  drm/amdgpu: rename nv_is_headless_sku()

Imre Deak (1):
  drm/i915: Fix encoder lookup during PSR atomic check

Joe Perches (1):
  

Re: [PATCH v5 05/15] mm/frame-vector: Use FOLL_LONGTERM

2020-11-05 Thread John Hubbard

On 11/5/20 4:49 AM, Jason Gunthorpe wrote:

On Thu, Nov 05, 2020 at 10:25:24AM +0100, Daniel Vetter wrote:

/*
  * If we can't determine whether or not a pte is special, then fail immediately
  * for ptes. Note, we can still pin HugeTLB and THP as these are guaranteed not
  * to be special.
  *
  * For a futex to be placed on a THP tail page, get_futex_key requires a
  * get_user_pages_fast_only implementation that can pin pages. Thus it's still
  * useful to have gup_huge_pmd even if we can't operate on ptes.
  */


We support hugepage faults in gpu drivers since recently, and I'm not
seeing a pud_mkhugespecial anywhere. So not sure this works, but probably
just me missing something again.


It means ioremap can't create an IO page PUD, it has to be broken up.

Does ioremap even create anything larger than PTEs?



From my reading, yes. See ioremap_try_huge_pmd().

thanks,
--
John Hubbard
NVIDIA
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 6/6] drm/amdgpu: Make struct drm_driver const

2020-11-05 Thread Luben Tuikov
On 2020-11-05 10:36, Daniel Vetter wrote:
> On Wed, Nov 04, 2020 at 11:04:25AM +0100, Daniel Vetter wrote:
>> From: Luben Tuikov 
>>
>> Make the definition of struct drm_driver
>> a constant, to follow the latest developments
>> in the DRM layer.
>>
>> Signed-off-by: Luben Tuikov 
>> [danvet: Rebase onto devm_drm_dev_alloc patch and drop the freesync
>> ioctl line again that escaped from internal trees.]
>> Signed-off-by: Daniel Vetter 
> 
> Entire series merged to drm-misc-next, with an irc ack from Alex for this
> one here. Thanks everyone who helped out with patches and reviews!
> -Daniel

Great! Thanks.

Regards,
Luben

> 
>> ---
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 31 +
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 24 +--
>>  2 files changed, 28 insertions(+), 27 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> index 8b30915aa972..d6fced7a9a03 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> @@ -40,6 +40,7 @@
>>  #include "amdgpu.h"
>>  #include "amdgpu_irq.h"
>>  #include "amdgpu_dma_buf.h"
>> +#include "amdgpu_sched.h"
>>  
>>  #include "amdgpu_amdkfd.h"
>>  
>> @@ -1094,7 +1095,7 @@ static const struct pci_device_id pciidlist[] = {
>>  
>>  MODULE_DEVICE_TABLE(pci, pciidlist);
>>  
>> -static struct drm_driver kms_driver;
>> +static const struct drm_driver amdgpu_kms_driver;
>>  
>>  static int amdgpu_pci_probe(struct pci_dev *pdev,
>>  const struct pci_device_id *ent)
>> @@ -1165,7 +1166,7 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
>>  if (ret)
>>  return ret;
>>  
>> -adev = devm_drm_dev_alloc(>dev, _driver, typeof(*adev), ddev);
>> +adev = devm_drm_dev_alloc(>dev, _kms_driver, 
>> typeof(*adev), ddev);
>>  if (IS_ERR(adev))
>>  return PTR_ERR(adev);
>>  
>> @@ -1509,7 +1510,29 @@ int amdgpu_file_to_fpriv(struct file *filp, struct 
>> amdgpu_fpriv **fpriv)
>>  return 0;
>>  }
>>  
>> -static struct drm_driver kms_driver = {
>> +int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file 
>> *filp);
>> +
>> +const struct drm_ioctl_desc amdgpu_ioctls_kms[] = {
>> +DRM_IOCTL_DEF_DRV(AMDGPU_GEM_CREATE, amdgpu_gem_create_ioctl, 
>> DRM_AUTH|DRM_RENDER_ALLOW),
>> +DRM_IOCTL_DEF_DRV(AMDGPU_CTX, amdgpu_ctx_ioctl, 
>> DRM_AUTH|DRM_RENDER_ALLOW),
>> +DRM_IOCTL_DEF_DRV(AMDGPU_VM, amdgpu_vm_ioctl, 
>> DRM_AUTH|DRM_RENDER_ALLOW),
>> +DRM_IOCTL_DEF_DRV(AMDGPU_SCHED, amdgpu_sched_ioctl, DRM_MASTER),
>> +DRM_IOCTL_DEF_DRV(AMDGPU_BO_LIST, amdgpu_bo_list_ioctl, 
>> DRM_AUTH|DRM_RENDER_ALLOW),
>> +DRM_IOCTL_DEF_DRV(AMDGPU_FENCE_TO_HANDLE, 
>> amdgpu_cs_fence_to_handle_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
>> +/* KMS */
>> +DRM_IOCTL_DEF_DRV(AMDGPU_GEM_MMAP, amdgpu_gem_mmap_ioctl, 
>> DRM_AUTH|DRM_RENDER_ALLOW),
>> +DRM_IOCTL_DEF_DRV(AMDGPU_GEM_WAIT_IDLE, amdgpu_gem_wait_idle_ioctl, 
>> DRM_AUTH|DRM_RENDER_ALLOW),
>> +DRM_IOCTL_DEF_DRV(AMDGPU_CS, amdgpu_cs_ioctl, 
>> DRM_AUTH|DRM_RENDER_ALLOW),
>> +DRM_IOCTL_DEF_DRV(AMDGPU_INFO, amdgpu_info_ioctl, 
>> DRM_AUTH|DRM_RENDER_ALLOW),
>> +DRM_IOCTL_DEF_DRV(AMDGPU_WAIT_CS, amdgpu_cs_wait_ioctl, 
>> DRM_AUTH|DRM_RENDER_ALLOW),
>> +DRM_IOCTL_DEF_DRV(AMDGPU_WAIT_FENCES, amdgpu_cs_wait_fences_ioctl, 
>> DRM_AUTH|DRM_RENDER_ALLOW),
>> +DRM_IOCTL_DEF_DRV(AMDGPU_GEM_METADATA, amdgpu_gem_metadata_ioctl, 
>> DRM_AUTH|DRM_RENDER_ALLOW),
>> +DRM_IOCTL_DEF_DRV(AMDGPU_GEM_VA, amdgpu_gem_va_ioctl, 
>> DRM_AUTH|DRM_RENDER_ALLOW),
>> +DRM_IOCTL_DEF_DRV(AMDGPU_GEM_OP, amdgpu_gem_op_ioctl, 
>> DRM_AUTH|DRM_RENDER_ALLOW),
>> +DRM_IOCTL_DEF_DRV(AMDGPU_GEM_USERPTR, amdgpu_gem_userptr_ioctl, 
>> DRM_AUTH|DRM_RENDER_ALLOW),
>> +};
>> +
>> +static const struct drm_driver amdgpu_kms_driver = {
>>  .driver_features =
>>  DRIVER_ATOMIC |
>>  DRIVER_GEM |
>> @@ -1520,6 +1543,7 @@ static struct drm_driver kms_driver = {
>>  .lastclose = amdgpu_driver_lastclose_kms,
>>  .irq_handler = amdgpu_irq_handler,
>>  .ioctls = amdgpu_ioctls_kms,
>> +.num_ioctls = ARRAY_SIZE(amdgpu_ioctls_kms),
>>  .dumb_create = amdgpu_mode_dumb_create,
>>  .dumb_map_offset = amdgpu_mode_dumb_mmap,
>>  .fops = _driver_kms_fops,
>> @@ -1572,7 +1596,6 @@ static int __init amdgpu_init(void)
>>  goto error_fence;
>>  
>>  DRM_INFO("amdgpu kernel modesetting enabled.\n");
>> -kms_driver.num_ioctls = amdgpu_max_kms_ioctl;
>>  amdgpu_register_atpx_handler();
>>  
>>  /* Ignore KFD init failures. Normal when CONFIG_HSA_AMD is not set. */
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c 
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
>> index efda38349a03..ab6d9f1186c2 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
>> @@ -29,7 +29,6 @@
>>  #include "amdgpu.h"
>>  

[PATCH 2/3] drm/nouveau: manage nouveau_drm lifetime with devres

2020-11-05 Thread Jeremy Cline
Make use of the devm_drm_dev_alloc() API to bind the lifetime of
nouveau_drm structure to the drm_device. This is important because a
reference to nouveau_drm is accessible from drm_device, which is
provided to a number of DRM layer callbacks that can run after the
deallocation of nouveau_drm currently occurs.

Signed-off-by: Jeremy Cline 
---
 drivers/gpu/drm/nouveau/nouveau_drm.c | 44 ---
 drivers/gpu/drm/nouveau/nouveau_drv.h | 10 --
 2 files changed, 26 insertions(+), 28 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c 
b/drivers/gpu/drm/nouveau/nouveau_drm.c
index bc6f51bf23b7..f750c25e92f9 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -30,9 +30,11 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -532,13 +534,8 @@ nouveau_parent = {
 static int
 nouveau_drm_device_init(struct drm_device *dev)
 {
-   struct nouveau_drm *drm;
int ret;
-
-   if (!(drm = kzalloc(sizeof(*drm), GFP_KERNEL)))
-   return -ENOMEM;
-   dev->dev_private = drm;
-   drm->dev = dev;
+   struct nouveau_drm *drm = nouveau_drm(dev);
 
nvif_parent_ctor(_parent, >parent);
drm->master.base.object.parent = >parent;
@@ -620,7 +617,6 @@ nouveau_drm_device_init(struct drm_device *dev)
nouveau_cli_fini(>master);
 fail_alloc:
nvif_parent_dtor(>parent);
-   kfree(drm);
return ret;
 }
 
@@ -654,7 +650,6 @@ nouveau_drm_device_fini(struct drm_device *dev)
nouveau_cli_fini(>client);
nouveau_cli_fini(>master);
nvif_parent_dtor(>parent);
-   kfree(drm);
 }
 
 /*
@@ -720,6 +715,7 @@ static int nouveau_drm_probe(struct pci_dev *pdev,
 {
struct nvkm_device *device;
struct drm_device *drm_dev;
+   struct nouveau_drm *nv_dev;
int ret;
 
if (vga_switcheroo_client_probe_defer(pdev))
@@ -750,15 +746,16 @@ static int nouveau_drm_probe(struct pci_dev *pdev,
if (nouveau_atomic)
driver_pci.driver_features |= DRIVER_ATOMIC;
 
-   drm_dev = drm_dev_alloc(_pci, >dev);
-   if (IS_ERR(drm_dev)) {
-   ret = PTR_ERR(drm_dev);
+   nv_dev = devm_drm_dev_alloc(>dev, _stub, typeof(*nv_dev), 
drm_dev);
+   if (IS_ERR(nv_dev)) {
+   ret = PTR_ERR(nv_dev);
goto fail_nvkm;
}
+   drm_dev = nouveau_to_drm_dev(nv_dev);
 
ret = pci_enable_device(pdev);
if (ret)
-   goto fail_drm;
+   goto fail_nvkm;
 
drm_dev->pdev = pdev;
pci_set_drvdata(pdev, drm_dev);
@@ -778,8 +775,6 @@ static int nouveau_drm_probe(struct pci_dev *pdev,
nouveau_drm_device_fini(drm_dev);
 fail_pci:
pci_disable_device(pdev);
-fail_drm:
-   drm_dev_put(drm_dev);
 fail_nvkm:
nvkm_device_del();
return ret;
@@ -799,7 +794,6 @@ nouveau_drm_device_remove(struct drm_device *dev)
device = nvkm_device_find(client->device);
 
nouveau_drm_device_fini(dev);
-   drm_dev_put(dev);
nvkm_device_del();
 }
 
@@ -1285,7 +1279,8 @@ nouveau_platform_device_create(const struct 
nvkm_device_tegra_func *func,
   struct platform_device *pdev,
   struct nvkm_device **pdevice)
 {
-   struct drm_device *drm;
+   struct nouveau_drm *nv_dev;
+   struct drm_device *drm_dev;
int err;
 
err = nvkm_device_tegra_new(func, pdev, nouveau_config, nouveau_debug,
@@ -1293,22 +1288,21 @@ nouveau_platform_device_create(const struct 
nvkm_device_tegra_func *func,
if (err)
goto err_free;
 
-   drm = drm_dev_alloc(_platform, >dev);
-   if (IS_ERR(drm)) {
-   err = PTR_ERR(drm);
+   nv_dev = devm_drm_dev_alloc(>dev, _platform, 
typeof(*nv_dev), drm_dev);
+   if (IS_ERR(nv_dev)) {
+   err = PTR_ERR(nv_dev);
goto err_free;
}
+   drm_dev = nouveau_to_drm_dev(nv_dev);
 
-   err = nouveau_drm_device_init(drm);
+   err = nouveau_drm_device_init(drm_dev);
if (err)
-   goto err_put;
+   goto err_free;
 
-   platform_set_drvdata(pdev, drm);
+   platform_set_drvdata(pdev, drm_dev);
 
-   return drm;
+   return drm_dev;
 
-err_put:
-   drm_dev_put(drm);
 err_free:
nvkm_device_del(pdevice);
 
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h 
b/drivers/gpu/drm/nouveau/nouveau_drv.h
index 3e2920a10099..cf6c33e52a5c 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
@@ -137,7 +137,11 @@ struct nouveau_drm {
struct nvif_parent parent;
struct nouveau_cli master;
struct nouveau_cli client;
-   struct drm_device *dev;
+
+   /**
+* @drm_dev: The parent DRM device object.
+*/
+   struct drm_device drm_dev;
 
struct list_head 

[PATCH 3/3] drm/nouveau: begin documenting core nouveau structures

2020-11-05 Thread Jeremy Cline
Start on documentation for the Nouveau device structure and the NVIF
client structure it uses. This documentation is not complete as the
structures are non-trivial and I am not familiar with large portions of
them.

Signed-off-by: Jeremy Cline 
---
 drivers/gpu/drm/nouveau/nouveau_drv.h | 67 +++
 1 file changed, 67 insertions(+)

diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h 
b/drivers/gpu/drm/nouveau/nouveau_drv.h
index cf6c33e52a5c..cf83d4bf3c6c 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
@@ -90,8 +90,20 @@ enum nouveau_drm_handle {
NVDRM_NVSW= 0x,
 };
 
+/**
+ * struct nouveau_cli - A DRM-specific NVIF client.
+ *
+ * This encapsulates a NVIF client and is intended to be the sole interface
+ * between the DRM APIs and NVKM. An instance of this structure is allocated
+ * for each userspace client when they open the device file. Additionally,
+ * there are several allocated strictly for the kernel's use.
+ */
 struct nouveau_cli {
struct nvif_client base;
+
+   /**
+* @drm: A reference to the device that the client is associated with.
+*/
struct nouveau_drm *drm;
struct mutex mutex;
 
@@ -101,6 +113,9 @@ struct nouveau_cli {
struct nouveau_vmm svm;
const struct nvif_mclass *mem;
 
+   /**
+* @head: The list entry for this client in the @drm device's list of 
clients.
+*/
struct list_head head;
void *abi16;
struct list_head objects;
@@ -108,13 +123,36 @@ struct nouveau_cli {
char name[32];
 
struct work_struct work;
+
+   /**
+* @worker: List of pending  nouveau_cli_work associated with 
this client.
+*/
struct list_head worker;
+
+   /**
+* @lock: Protects the @worker list. Additionally, this lock on the
+* @drm.master instance is used to serialize destruction of the @base
+* member in this structure, as well as the destruction of the 
+* nvif_mem embedded in  nouveau_mem instances.
+*/
struct mutex lock;
 };
 
+/**
+ * struct nouveau_cli_work - A pending work item for an NVIF client.
+ */
 struct nouveau_cli_work {
void (*func)(struct nouveau_cli_work *);
+
+   /**
+* @cli: Reference to the NVIF client this work belongs to.
+*/
struct nouveau_cli *cli;
+
+   /**
+* @head: The list entry for this work item in the  nouveau_cli
+* worker list.
+*/
struct list_head head;
 
struct dma_fence *fence;
@@ -133,9 +171,32 @@ nouveau_cli(struct drm_file *fpriv)
 #include 
 #include 
 
+/**
+ * struct nouveau_drm - The nouveau-specific device structure.
+ *
+ * This structure is allocated for a device when it is probed and keeps track
+ * of all the nouveau-specific device details. The lifetime of this structure
+ * is the same as the lifetime of a  drm_device and is managed by the
+ * DRM layer.
+ */
 struct nouveau_drm {
+   /**
+* @parent: Implementation of the interface required to use the 
NVIF_DEBUG
+* and NVIF_ERROR macros
+*/
struct nvif_parent parent;
+
+   /**
+* @master: This NVIF client is used to initialize the NVIF driver and 
used
+* for TTM memory allocations. It is the root of the NVIF object tree.
+*/
struct nouveau_cli master;
+
+   /**
+* @client: This NVIF client is used by the DRM layer to interact with
+* the NVKM layer for everything except TTM memory allocations. It, and
+* all other clients, are children of the primary (@master) client.
+*/
struct nouveau_cli client;
 
/**
@@ -143,6 +204,12 @@ struct nouveau_drm {
 */
struct drm_device drm_dev;
 
+   /**
+* @clients: List of all  nouveau_cli allocated for userspace
+* associated with this DRM device. Clients are allocated when the DRM
+* file is opened and deallocated when the file is closed. This list is
+* protected by the mutex in @client.
+*/
struct list_head clients;
 
u8 old_pm_cap;
-- 
2.28.0

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


[PATCH 1/3] drm/nouveau: Use helper to convert nouveau_drm to drm_device

2020-11-05 Thread Jeremy Cline
In order to use the resource-managed allocation of a struct drm_device
instance, it is recommended to embed the drm_device instance within the
driver-specific structure.

As there is already a helper to convert a drm_device to a nouveau_drm
struct, this adds an inverse function and changes all direct references
to the pointer within nouveau_drm to use the function. It also adds a
helper to convert directly to a generic device structure.

This allows us to switch from maintaining a pointer in nouveau_drm to
embedding the structure by simply altering the helper function
implementations.

This patch should introduce no functional changes.

Signed-off-by: Jeremy Cline 
---
 drivers/gpu/drm/nouveau/dispnv04/crtc.c | 10 +++---
 drivers/gpu/drm/nouveau/dispnv50/base.c |  2 +-
 drivers/gpu/drm/nouveau/dispnv50/base507c.c |  7 ++--
 drivers/gpu/drm/nouveau/dispnv50/core.c |  2 +-
 drivers/gpu/drm/nouveau/dispnv50/core507d.c |  2 +-
 drivers/gpu/drm/nouveau/dispnv50/curs.c |  2 +-
 drivers/gpu/drm/nouveau/dispnv50/curs507a.c |  5 +--
 drivers/gpu/drm/nouveau/dispnv50/disp.c | 17 +-
 drivers/gpu/drm/nouveau/dispnv50/oimm.c |  2 +-
 drivers/gpu/drm/nouveau/dispnv50/oimm507b.c |  2 +-
 drivers/gpu/drm/nouveau/dispnv50/ovly.c |  2 +-
 drivers/gpu/drm/nouveau/dispnv50/ovly507e.c |  5 +--
 drivers/gpu/drm/nouveau/dispnv50/wimm.c |  2 +-
 drivers/gpu/drm/nouveau/dispnv50/wimmc37b.c |  2 +-
 drivers/gpu/drm/nouveau/dispnv50/wndw.c |  2 +-
 drivers/gpu/drm/nouveau/dispnv50/wndwc37e.c |  5 +--
 drivers/gpu/drm/nouveau/nouveau_bo.c| 16 -
 drivers/gpu/drm/nouveau/nouveau_debugfs.c   |  9 +++---
 drivers/gpu/drm/nouveau/nouveau_display.c   | 16 -
 drivers/gpu/drm/nouveau/nouveau_dmem.c  | 17 +-
 drivers/gpu/drm/nouveau/nouveau_drm.c   |  2 +-
 drivers/gpu/drm/nouveau/nouveau_drv.h   | 36 -
 drivers/gpu/drm/nouveau/nouveau_fbcon.c | 19 +--
 drivers/gpu/drm/nouveau/nouveau_gem.c   |  8 ++---
 drivers/gpu/drm/nouveau/nouveau_svm.c   |  4 +--
 drivers/gpu/drm/nouveau/nouveau_ttm.c   |  4 +--
 drivers/gpu/drm/nouveau/nouveau_vga.c   |  8 ++---
 27 files changed, 124 insertions(+), 84 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c 
b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
index f9e962fd94d0..3e1b00f3086e 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
@@ -915,7 +915,7 @@ nv04_crtc_mode_set_base_atomic(struct drm_crtc *crtc,
   int x, int y, enum mode_set_atomic state)
 {
struct nouveau_drm *drm = nouveau_drm(crtc->dev);
-   struct drm_device *dev = drm->dev;
+   struct drm_device *dev = nouveau_to_drm_dev(drm);
 
if (state == ENTER_ATOMIC_MODE_SET)
nouveau_fbcon_accel_save_disable(dev);
@@ -990,7 +990,7 @@ nv04_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file 
*file_priv,
 uint32_t buffer_handle, uint32_t width, uint32_t height)
 {
struct nouveau_drm *drm = nouveau_drm(crtc->dev);
-   struct drm_device *dev = drm->dev;
+   struct drm_device *dev = nouveau_to_drm_dev(drm);
struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
struct nouveau_bo *cursor = NULL;
struct drm_gem_object *gem;
@@ -1050,7 +1050,7 @@ nv04_finish_page_flip(struct nouveau_channel *chan,
 {
struct nouveau_fence_chan *fctx = chan->fence;
struct nouveau_drm *drm = chan->drm;
-   struct drm_device *dev = drm->dev;
+   struct drm_device *dev = nouveau_to_drm_dev(drm);
struct nv04_page_flip_state *s;
unsigned long flags;
 
@@ -1088,7 +1088,7 @@ nv04_flip_complete(struct nvif_notify *notify)
struct nv04_page_flip_state state;
 
if (!nv04_finish_page_flip(chan, )) {
-   nv_set_crtc_base(drm->dev, drm_crtc_index(state.crtc),
+   nv_set_crtc_base(nouveau_to_drm_dev(drm), 
drm_crtc_index(state.crtc),
 state.offset + state.crtc->y *
 state.pitch + state.crtc->x *
 state.bpp / 8);
@@ -1106,7 +1106,7 @@ nv04_page_flip_emit(struct nouveau_channel *chan,
 {
struct nouveau_fence_chan *fctx = chan->fence;
struct nouveau_drm *drm = chan->drm;
-   struct drm_device *dev = drm->dev;
+   struct drm_device *dev = nouveau_to_drm_dev(drm);
struct nvif_push *push = chan->chan.push;
unsigned long flags;
int ret;
diff --git a/drivers/gpu/drm/nouveau/dispnv50/base.c 
b/drivers/gpu/drm/nouveau/dispnv50/base.c
index 7c752acf2b48..cd70456dd37f 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/base.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/base.c
@@ -40,7 +40,7 @@ nv50_base_new(struct nouveau_drm *drm, int head, struct 
nv50_wndw **pwndw)
{  NV50_DISP_BASE_CHANNEL_DMA, 0, base507c_new },
{}
};
-   struct 

[PATCH 0/3] drm/nouveau: extend the lifetime of nouveau_drm

2020-11-05 Thread Jeremy Cline
Hi folks,

Currently, when the device is removed (or the driver is unbound) the
nouveau_drm structure de-allocated. However, it's still accessible from
and used by some DRM layer callbacks. For example, file handles can be
closed after the device has been removed (physically or otherwise). This
series converts the Nouveau device structure to be allocated and
de-allocated with the devm_drm_dev_alloc() API.

In the future, additional resources that should be bound to the lifetime
of the drm_device can be added, and the drmm_add_action() APIs offer a
nice hook for arbitrary cleanup actions before the drm_device is
destroyed, so I suspect much of the current cleanup code in Nouveau
would benefit from some refactoring to use this.

Finally, although not *strictly* necessary for this series, I included
some documentation for structures I investigated for this work.

Jeremy Cline (3):
  drm/nouveau: Use helper to convert nouveau_drm to drm_device
  drm/nouveau: manage nouveau_drm lifetime with devres
  drm/nouveau: begin documenting core nouveau structures

 drivers/gpu/drm/nouveau/dispnv04/crtc.c |  10 +-
 drivers/gpu/drm/nouveau/dispnv50/base.c |   2 +-
 drivers/gpu/drm/nouveau/dispnv50/base507c.c |   7 +-
 drivers/gpu/drm/nouveau/dispnv50/core.c |   2 +-
 drivers/gpu/drm/nouveau/dispnv50/core507d.c |   2 +-
 drivers/gpu/drm/nouveau/dispnv50/curs.c |   2 +-
 drivers/gpu/drm/nouveau/dispnv50/curs507a.c |   5 +-
 drivers/gpu/drm/nouveau/dispnv50/disp.c |  17 +--
 drivers/gpu/drm/nouveau/dispnv50/oimm.c |   2 +-
 drivers/gpu/drm/nouveau/dispnv50/oimm507b.c |   2 +-
 drivers/gpu/drm/nouveau/dispnv50/ovly.c |   2 +-
 drivers/gpu/drm/nouveau/dispnv50/ovly507e.c |   5 +-
 drivers/gpu/drm/nouveau/dispnv50/wimm.c |   2 +-
 drivers/gpu/drm/nouveau/dispnv50/wimmc37b.c |   2 +-
 drivers/gpu/drm/nouveau/dispnv50/wndw.c |   2 +-
 drivers/gpu/drm/nouveau/dispnv50/wndwc37e.c |   5 +-
 drivers/gpu/drm/nouveau/nouveau_bo.c|  16 ++-
 drivers/gpu/drm/nouveau/nouveau_debugfs.c   |   9 +-
 drivers/gpu/drm/nouveau/nouveau_display.c   |  16 +--
 drivers/gpu/drm/nouveau/nouveau_dmem.c  |  17 +--
 drivers/gpu/drm/nouveau/nouveau_drm.c   |  41 
 drivers/gpu/drm/nouveau/nouveau_drv.h   | 111 +++-
 drivers/gpu/drm/nouveau/nouveau_fbcon.c |  19 ++--
 drivers/gpu/drm/nouveau/nouveau_gem.c   |   8 +-
 drivers/gpu/drm/nouveau/nouveau_svm.c   |   4 +-
 drivers/gpu/drm/nouveau/nouveau_ttm.c   |   4 +-
 drivers/gpu/drm/nouveau/nouveau_vga.c   |   8 +-
 27 files changed, 216 insertions(+), 106 deletions(-)

-- 
2.28.0

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


Re: [PATCH] drm/virtio: Fix a double free in virtio_gpu_cmd_map()

2020-11-05 Thread Gurchetan Singh
On Fri, Oct 30, 2020 at 4:48 AM Dan Carpenter 
wrote:

> This is freed both here and in the caller (virtio_gpu_vram_map()) so
> it's a double free.  The correct place is only in the caller.
>
> Fixes: 16845c5d5409 ("drm/virtio: implement blob resources: implement vram
> object")
> Signed-off-by: Dan Carpenter 
> ---
>  drivers/gpu/drm/virtio/virtgpu_vq.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c
> b/drivers/gpu/drm/virtio/virtgpu_vq.c
> index 72586cd8cc4c..3f200306c9d7 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_vq.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_vq.c
> @@ -1212,10 +1212,8 @@ int virtio_gpu_cmd_map(struct virtio_gpu_device
> *vgdev,
> struct virtio_gpu_resp_map_info *resp_buf;
>
> resp_buf = kzalloc(sizeof(*resp_buf), GFP_KERNEL);
> -   if (!resp_buf) {
> -   virtio_gpu_array_put_free(objs);
> +   if (!resp_buf)
> return -ENOMEM;
> -   }
>
> cmd_p = virtio_gpu_alloc_cmd_resp
> (vgdev, virtio_gpu_cmd_resource_map_cb, ,
> sizeof(*cmd_p),
> --
> 2.28.0
>
Reviewed-by: Gurchetan Singh 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


RE: [PATCH] drm/ast: Fixed 1920x1080 sync. polarity issue

2020-11-05 Thread Kuo-Hsiang Chou
To Sir,

Is the mail-address of "daniel.vet...@intel.com" correct for Daniel? 
Because, got the message of " The current directory does not appear to be a 
linux kernel source tree. " after running get_maintainers.pl
So, find Daniel out by gitk /drivers/gpu/drm/ast

Have a good day,
Kuo-Hsiang Chou

-Original Message-
From: Thomas Zimmermann [mailto:tzimmerm...@suse.de] 
Sent: Thursday, November 05, 2020 8:22 PM
To: Kuo-Hsiang Chou ; 
dri-devel@lists.freedesktop.org
Cc: Jenmin Yuan ; e...@suse.com; Tommy Huang 
; Arc Sung ; 
airl...@redhat.com
Subject: Re: [PATCH] drm/ast: Fixed 1920x1080 sync. polarity issue

Hi

Am 05.11.20 um 13:08 schrieb Thomas Zimmermann:
> Hi,
> 
> please follow the advise we're giving you. Had you run 
> scripts/checkpatch.pl on the patch file it would have told you
> 
> <<<
> ERROR: patch seems to be corrupt (line wrapped?)
> #102: FILE: drivers/gpu/drm/ast/ast_tables.h:294:
> 
> 
> ERROR: DOS line endings
> #106: FILE: drivers/gpu/drm/ast/ast_tables.h:297:
> +^I (SyncPP | Charx8Dot | LineCompareOff | WideScreenMode | 
> +NewModeInfo |^M$
> 
> ERROR: DOS line endings
> #110: FILE: drivers/gpu/drm/ast/ast_tables.h:300:
> +^I (SyncPP | Charx8Dot | LineCompareOff | WideScreenMode | 
> +NewModeInfo |^M$
> 
> total: 3 errors, 0 warnings, 19 lines checked

> 

This might not be your fault but the result of my mail client.

> As said before, the mail e...@suse.de is still not relevant any longer.
> But you did not add Daniel into CC. Did you run scripts/get_maintainers.pl?

This still applies.

Best regards
Thomas

> 
> Best regards
> Thomas
> 
> Am 05.11.20 um 10:47 schrieb KuoHsiang Chou:
>> [Bug] Change the vertical synchroous polary of 1920x1080 @60Hz
>>   from  Negtive to Positive
>>
>> Signed-off-by: KuoHsiang Chou 
>> ---
>>  drivers/gpu/drm/ast/ast_tables.h | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/ast/ast_tables.h 
>> b/drivers/gpu/drm/ast/ast_tables.h
>> index 8414e543f260..51efc5b4a55c 100644
>> --- a/drivers/gpu/drm/ast/ast_tables.h
>> +++ b/drivers/gpu/drm/ast/ast_tables.h
>> @@ -295,10 +295,10 @@ static const struct ast_vbios_enhtable 
>> res_1600x900[] = {
>>
>>  static const struct ast_vbios_enhtable res_1920x1080[] = {
>>  {2200, 1920, 88, 44, 1125, 1080, 4, 5, VCLK148_5,   /* 60Hz */
>> - (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo |
>> + (SyncPP | Charx8Dot | LineCompareOff | WideScreenMode | 
>> +NewModeInfo |
>>AST2500PreCatchCRT), 60, 1, 0x38 },
>>  {2200, 1920, 88, 44, 1125, 1080, 4, 5, VCLK148_5,   /* 60Hz */
>> - (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo |
>> + (SyncPP | Charx8Dot | LineCompareOff | WideScreenMode | 
>> +NewModeInfo |
>>AST2500PreCatchCRT), 0xFF, 1, 0x38 },  };
>>
>> --
>> 2.18.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
> 

--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


RE: [PATCH v8 4/5] RDMA/mlx5: Support dma-buf based userspace memory region

2020-11-05 Thread Xiong, Jianxin
> -Original Message-
> From: Jason Gunthorpe 
> Sent: Thursday, November 05, 2020 4:25 PM
> To: Xiong, Jianxin 
> Cc: linux-r...@vger.kernel.org; dri-devel@lists.freedesktop.org; Doug Ledford 
> ; Leon Romanovsky
> ; Sumit Semwal ; Christian Koenig 
> ; Vetter, Daniel
> 
> Subject: Re: [PATCH v8 4/5] RDMA/mlx5: Support dma-buf based userspace memory 
> region
> 
> On Thu, Nov 05, 2020 at 02:48:08PM -0800, Jianxin Xiong wrote:
> > @@ -966,7 +969,10 @@ static struct mlx5_ib_mr *alloc_mr_from_cache(struct 
> > ib_pd *pd,
> > struct mlx5_ib_mr *mr;
> > unsigned int page_size;
> >
> > -   page_size = mlx5_umem_find_best_pgsz(umem, mkc, log_page_size, 0, iova);
> > +   if (umem->is_dmabuf)
> > +   page_size = ib_umem_find_best_pgsz(umem, PAGE_SIZE, iova);
> 
> You said the sgl is not set here, why doesn't this crash? It is certainly 
> wrong to call this function without a SGL.

The sgl is NULL, and nmap is 0. The 'for_each_sg' loop is just skipped and 
won't crash.

> 
> > +/**
> > + * mlx5_ib_fence_dmabuf_mr - Stop all access to the dmabuf MR
> > + * @mr: to fence
> > + *
> > + * On return no parallel threads will be touching this MR and no DMA
> > +will be
> > + * active.
> > + */
> > +void mlx5_ib_fence_dmabuf_mr(struct mlx5_ib_mr *mr) {
> > +   struct ib_umem_dmabuf *umem_dmabuf = to_ib_umem_dmabuf(mr->umem);
> > +
> > +   /* Prevent new page faults and prefetch requests from succeeding */
> > +   xa_erase(>dev->odp_mkeys, mlx5_base_mkey(mr->mmkey.key));
> > +
> > +   /* Wait for all running page-fault handlers to finish. */
> > +   synchronize_srcu(>dev->odp_srcu);
> > +
> > +   wait_event(mr->q_deferred_work,
> > +!atomic_read(>num_deferred_work));
> > +
> > +   dma_resv_lock(umem_dmabuf->attach->dmabuf->resv, NULL);
> > +   mlx5_mr_cache_invalidate(mr);
> > +   umem_dmabuf->private = NULL;
> > +   dma_resv_unlock(umem_dmabuf->attach->dmabuf->resv);
> > +
> > +   if (!mr->cache_ent) {
> > +   mlx5_core_destroy_mkey(mr->dev->mdev, >mmkey);
> > +   WARN_ON(mr->descs);
> > +   }
> > +}
> 
> I would expect this to call ib_umem_dmabuf_unmap_pages() ?
> 
> Who calls it on the dereg path?
> 
> This looks quite strange to me, it calls ib_umem_dmabuf_unmap_pages() only 
> from the invalidate callback?
>

It is also called from ib_umem_dmabuf_release(). 
 
> I feel uneasy how this seems to assume everything works sanely, we can have 
> parallel page faults so pagefault_dmabuf_mr() can be called
> multiple times after an invalidation, and it doesn't protect itself against 
> calling ib_umem_dmabuf_map_pages() twice.
> 
> Perhaps the umem code should keep track of the current map state and exit if 
> there is already a sgl. NULL or not NULL sgl would do and
> seems quite reasonable.
> 

Ib_umem_dmabuf_map() already checks the sgl and will do nothing if it is 
already set.

> > @@ -810,22 +871,31 @@ static int pagefault_mr(struct mlx5_ib_mr *mr, u64 
> > io_virt, size_t bcnt,
> > u32 *bytes_mapped, u32 flags)
> >  {
> > struct ib_umem_odp *odp = to_ib_umem_odp(mr->umem);
> > +   struct ib_umem_dmabuf *umem_dmabuf = to_ib_umem_dmabuf(mr->umem);
> >
> > lockdep_assert_held(>dev->odp_srcu);
> > if (unlikely(io_virt < mr->mmkey.iova))
> > return -EFAULT;
> >
> > -   if (!odp->is_implicit_odp) {
> > +   if (is_dmabuf_mr(mr) || !odp->is_implicit_odp) {
> > u64 user_va;
> > +   u64 end;
> >
> > if (check_add_overflow(io_virt - mr->mmkey.iova,
> > -  (u64)odp->umem.address, _va))
> > +  (u64)mr->umem->address, _va))
> > return -EFAULT;
> > -   if (unlikely(user_va >= ib_umem_end(odp) ||
> > -ib_umem_end(odp) - user_va < bcnt))
> > +   if (is_dmabuf_mr(mr))
> > +   end = mr->umem->address + mr->umem->length;
> > +   else
> > +   end = ib_umem_end(odp);
> > +   if (unlikely(user_va >= end || end - user_va < bcnt))
> > return -EFAULT;
> > -   return pagefault_real_mr(mr, odp, user_va, bcnt, bytes_mapped,
> > -flags);
> > +   if (is_dmabuf_mr(mr))
> > +   return pagefault_dmabuf_mr(mr, umem_dmabuf, user_va,
> > +  bcnt, bytes_mapped, flags);
> 
> But this doesn't care about user_va or bcnt it just triggers the whole thing 
> to be remapped, so why calculate it?

The range check is still needed, in order to catch application errors of using 
incorrect address or count in verbs command. Passing the values further in is 
to allow pagefault_dmabuf_mr to
generate return value and set bytes_mapped in a way consistent with the page 
fault handler
chain.
  
> 
> Jason
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

RE: [PATCH] drm/ast: Fixed 1920x1080 sync. polarity issue

2020-11-05 Thread Kuo-Hsiang Chou
To Sir

Yes, I ran scripts/checkpatch.pl and cleared 3 errors about tailing spaces.

OK, would you please give me the mail-address of Daniel? And  
will be removed from CC. 
Because I ran get_maintainers.pl and got the result of " The current directory 
does not appear to be a linux kernel source tree. "
So, I got the information from MAINTAINERS by keyword of "/drm/ast", likes as:
DRM DRIVER FOR AST SERVER GRAPHICS CHIPS
M:  Dave Airlie 
R:  Thomas Zimmermann 
L:  dri-devel@lists.freedesktop.org
S:  Supported
T:  git git://anongit.freedesktop.org/drm/drm-misc
F:  drivers/gpu/drm/ast/

Thanks and Have a good day,
Kuo-Hsiang Chou

-Original Message-
From: Thomas Zimmermann [mailto:tzimmerm...@suse.de] 
Sent: Thursday, November 05, 2020 8:09 PM
To: Kuo-Hsiang Chou ; 
dri-devel@lists.freedesktop.org
Cc: e...@suse.com; Tommy Huang ; Jenmin Yuan 
; airl...@redhat.com; Arc Sung 

Subject: Re: [PATCH] drm/ast: Fixed 1920x1080 sync. polarity issue

Hi,

please follow the advise we're giving you. Had you run scripts/checkpatch.pl on 
the patch file it would have told you

<<<
ERROR: patch seems to be corrupt (line wrapped?)
#102: FILE: drivers/gpu/drm/ast/ast_tables.h:294:


ERROR: DOS line endings
#106: FILE: drivers/gpu/drm/ast/ast_tables.h:297:
+^I (SyncPP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo 
+|^M$

ERROR: DOS line endings
#110: FILE: drivers/gpu/drm/ast/ast_tables.h:300:
+^I (SyncPP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo 
+|^M$

total: 3 errors, 0 warnings, 19 lines checked
>>>

As said before, the mail e...@suse.de is still not relevant any longer.
But you did not add Daniel into CC. Did you run scripts/get_maintainers.pl?

Best regards
Thomas

Am 05.11.20 um 10:47 schrieb KuoHsiang Chou:
> [Bug] Change the vertical synchroous polary of 1920x1080 @60Hz
>   from  Negtive to Positive
> 
> Signed-off-by: KuoHsiang Chou 
> ---
>  drivers/gpu/drm/ast/ast_tables.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/ast/ast_tables.h 
> b/drivers/gpu/drm/ast/ast_tables.h
> index 8414e543f260..51efc5b4a55c 100644
> --- a/drivers/gpu/drm/ast/ast_tables.h
> +++ b/drivers/gpu/drm/ast/ast_tables.h
> @@ -295,10 +295,10 @@ static const struct ast_vbios_enhtable 
> res_1600x900[] = {
> 
>  static const struct ast_vbios_enhtable res_1920x1080[] = {
>   {2200, 1920, 88, 44, 1125, 1080, 4, 5, VCLK148_5,   /* 60Hz */
> -  (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo |
> +  (SyncPP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo 
> +|
> AST2500PreCatchCRT), 60, 1, 0x38 },
>   {2200, 1920, 88, 44, 1125, 1080, 4, 5, VCLK148_5,   /* 60Hz */
> -  (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo |
> +  (SyncPP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo 
> +|
> AST2500PreCatchCRT), 0xFF, 1, 0x38 },  };
> 
> --
> 2.18.4
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 

--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v3] drm/edid: Fix uninitialized variable in drm_cvt_modes()

2020-11-05 Thread Ilia Mirkin
On Thu, Nov 5, 2020 at 6:57 PM Lyude Paul  wrote:
>
> Noticed this when trying to compile with -Wall on a kernel fork. We 
> potentially
> don't set width here, which causes the compiler to complain about width
> potentially being uninitialized in drm_cvt_modes(). So, let's fix that.
>
> Changes since v1:
> * Don't emit an error as this code isn't reachable, just mark it as such
> Changes since v2:
> * Remove now unused variable
>
> Signed-off-by: Lyude Paul 
>
> Cc:  # v5.9+
> Fixes: 3f649ab728cd ("treewide: Remove uninitialized_var() usage")
> Signed-off-by: Lyude Paul 

For the very little it's worth,

Reviewed-by: Ilia Mirkin 

> ---
>  drivers/gpu/drm/drm_edid.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 631125b46e04..b84efd538a70 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -3114,6 +3114,8 @@ static int drm_cvt_modes(struct drm_connector 
> *connector,
> case 0x0c:
> width = height * 15 / 9;
> break;
> +   default:
> +   unreachable();
> }
>
> for (j = 1; j < 5; j++) {
> --
> 2.28.0
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3] drm/edid: Fix uninitialized variable in drm_cvt_modes()

2020-11-05 Thread Lyude Paul
Noticed this when trying to compile with -Wall on a kernel fork. We potentially
don't set width here, which causes the compiler to complain about width
potentially being uninitialized in drm_cvt_modes(). So, let's fix that.

Changes since v1:
* Don't emit an error as this code isn't reachable, just mark it as such
Changes since v2:
* Remove now unused variable

Signed-off-by: Lyude Paul 

Cc:  # v5.9+
Fixes: 3f649ab728cd ("treewide: Remove uninitialized_var() usage")
Signed-off-by: Lyude Paul 
---
 drivers/gpu/drm/drm_edid.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 631125b46e04..b84efd538a70 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -3114,6 +3114,8 @@ static int drm_cvt_modes(struct drm_connector *connector,
case 0x0c:
width = height * 15 / 9;
break;
+   default:
+   unreachable();
}
 
for (j = 1; j < 5; j++) {
-- 
2.28.0

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


[PATCH v8 2/5] RDMA/core: Add device method for registering dma-buf based memory region

2020-11-05 Thread Jianxin Xiong
Dma-buf based memory region requires one extra parameter and is processed
quite differently. Adding a separate method allows clean separation from
regular memory regions.

Signed-off-by: Jianxin Xiong 
Reviewed-by: Sean Hefty 
Acked-by: Michael J. Ruhl 
Acked-by: Christian Koenig 
Acked-by: Daniel Vetter 
---
 drivers/infiniband/core/device.c | 1 +
 include/rdma/ib_verbs.h  | 6 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index ce26564..6768a19 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -2689,6 +2689,7 @@ void ib_set_device_ops(struct ib_device *dev, const 
struct ib_device_ops *ops)
SET_DEVICE_OP(dev_ops, read_counters);
SET_DEVICE_OP(dev_ops, reg_dm_mr);
SET_DEVICE_OP(dev_ops, reg_user_mr);
+   SET_DEVICE_OP(dev_ops, reg_user_mr_dmabuf);
SET_DEVICE_OP(dev_ops, req_ncomp_notif);
SET_DEVICE_OP(dev_ops, req_notify_cq);
SET_DEVICE_OP(dev_ops, rereg_user_mr);
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 9420827..3d1d098 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -2,7 +2,7 @@
 /*
  * Copyright (c) 2004 Mellanox Technologies Ltd.  All rights reserved.
  * Copyright (c) 2004 Infinicon Corporation.  All rights reserved.
- * Copyright (c) 2004 Intel Corporation.  All rights reserved.
+ * Copyright (c) 2004, 2020 Intel Corporation.  All rights reserved.
  * Copyright (c) 2004 Topspin Corporation.  All rights reserved.
  * Copyright (c) 2004 Voltaire Corporation.  All rights reserved.
  * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
@@ -2433,6 +2433,10 @@ struct ib_device_ops {
struct ib_mr *(*reg_user_mr)(struct ib_pd *pd, u64 start, u64 length,
 u64 virt_addr, int mr_access_flags,
 struct ib_udata *udata);
+   struct ib_mr *(*reg_user_mr_dmabuf)(struct ib_pd *pd, u64 offset,
+u64 length, u64 virt_addr, int fd,
+int mr_access_flags,
+struct ib_udata *udata);
int (*rereg_user_mr)(struct ib_mr *mr, int flags, u64 start, u64 length,
 u64 virt_addr, int mr_access_flags,
 struct ib_pd *pd, struct ib_udata *udata);
-- 
1.8.3.1

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


[PATCH v8 5/5] dma-buf: Reject attach request from importers that use dma_virt_ops

2020-11-05 Thread Jianxin Xiong
dma_virt_ops is used by virtual devices that map pages / scatterlists to
virtual addresses for CPU access instead of performing DMA. This is not
the intended use of dma_buf_attach() and dma_buf_map_attachment(). CPU
access of dma-buf should use dma_buf_vmap() and related functions.

Signed-off-by: Jianxin Xiong 
---
 drivers/dma-buf/dma-buf.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
index 9a054fb5..ba2b877 100644
--- a/drivers/dma-buf/dma-buf.c
+++ b/drivers/dma-buf/dma-buf.c
@@ -686,6 +686,11 @@ struct dma_buf_attachment *
if (WARN_ON(importer_ops && !importer_ops->move_notify))
return ERR_PTR(-EINVAL);
 
+#ifdef CONFIG_DMA_VIRT_OPS
+   if (dev->dma_ops == _virt_ops)
+   return ERR_PTR(-EINVAL);
+#endif
+
attach = kzalloc(sizeof(*attach), GFP_KERNEL);
if (!attach)
return ERR_PTR(-ENOMEM);
-- 
1.8.3.1

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


[PATCH v8 0/5] RDMA: Add dma-buf support

2020-11-05 Thread Jianxin Xiong
This is the eighth version of the patch set. Changelog:

v8:
* Modify the dma-buf sg list in place to get a proper umem sg list and
  restore it before calling dma_buf_unmap_attachment()
* Validate the umem sg list with ib_umem_find_best_pgsz()
* Remove the logic for slicing the sg list at runtime

v7: https://www.spinics.net/lists/linux-rdma/msg97297.html
* Rebase on top of latest mlx5 MR patch series
* Slice dma-buf sg list at runtime instead of creating a new list
* Preload the buffer page mapping when the MR is created
* Move the 'dma_virt_ops' check into dma_buf_dynamic_attach()

v6: https://www.spinics.net/lists/linux-rdma/msg96923.html
* Move the dma-buf invalidation callback from the core to the device
  driver
* Move mapping update from work queue to pagefault handler
* Add dma-buf based MRs to the xarray of mmkeys so that the pagefault
  handler can be reached
* Update the new driver method and uverbs command signature by changing
  the paramter 'addr' to 'offset'
* Modify the sg list returned from dma_buf_map_attachment() based on
  the parameters 'offset' and 'length'
* Don't import dma-buf if 'dma_virt_ops' is used by the dma device
* The patch that clarifies dma-buf sg lists alignment has landed at
  https://cgit.freedesktop.org/drm/drm-misc/commit/?id=ac80cd17a615
  and thus is no longer included with this set

v5: https://www.spinics.net/lists/linux-rdma/msg96786.html
* Fix a few warnings reported by kernel test robot:
- no previous prototype for function 'ib_umem_dmabuf_release' 
- no previous prototype for function 'ib_umem_dmabuf_map_pages'
- comparison of distinct pointer types in 'check_add_overflow'
* Add comment for the wait between getting the dma-buf sg tagle and
  updating the NIC page table

v4: https://www.spinics.net/lists/linux-rdma/msg96767.html
* Add a new ib_device method reg_user_mr_dmabuf() instead of expanding
  the existing method reg_user_mr()
* Use a separate code flow for dma-buf instead of adding special cases
  to the ODP memory region code path
* In invalidation callback, new mapping is updated as whole using work
  queue instead of being updated in page granularity in the page fault
  handler
* Use dma_resv_get_excl() and dma_fence_wait() to ensure the content of
  the pages have been moved to the new location before the new mapping
  is programmed into the NIC
* Add code to the ODP page fault handler to check the mapping status
* The new access flag added in v3 is removed.
* The checking for on-demand paging support in the new uverbs command
  is removed because it is implied by implementing the new ib_device
  method
* Clarify that dma-buf sg lists are page aligned

v3: https://www.spinics.net/lists/linux-rdma/msg96330.html
* Use dma_buf_dynamic_attach() instead of dma_buf_attach()
* Use on-demand paging mechanism to avoid pinning the GPU memory
* Instead of adding a new parameter to the device method for memory
  registration, pass all the attributes including the file descriptor
  as a structure
* Define a new access flag for dma-buf based memory region
* Check for on-demand paging support in the new uverbs command

v2: https://www.spinics.net/lists/linux-rdma/msg93643.html
* The Kconfig option is removed. There is no dependence issue since
  dma-buf driver is always enabled.
* The declaration of new data structure and functions is reorganized to
  minimize the visibility of the changes.
* The new uverbs command now goes through ioctl() instead of write().
* The rereg functionality is removed.
* Instead of adding new device method for dma-buf specific registration,
  existing method is extended to accept an extra parameter. 
* The correct function is now used for address range checking. 

v1: https://www.spinics.net/lists/linux-rdma/msg90720.html
* The initial patch set
* Implement core functions for importing and mapping dma-buf
* Use dma-buf static attach interface
* Add two ib_device methods reg_user_mr_fd() and rereg_user_mr_fd()
* Add two uverbs commands via the write() interface
* Add Kconfig option
* Add dma-buf support to mlx5 device

When enabled, an RDMA capable NIC can perform peer-to-peer transactions
over PCIe to access the local memory located on another device. This can
often lead to better performance than using a system memory buffer for
RDMA and copying data between the buffer and device memory.

Current kernel RDMA stack uses get_user_pages() to pin the physical
pages backing the user buffer and uses dma_map_sg_attrs() to get the
dma addresses for memory access. This usually doesn't work for peer
device memory due to the lack of associated page structures.

Several mechanisms exist today to facilitate device memory access.

ZONE_DEVICE is a new zone for device memory in the memory management
subsystem. It allows pages from device memory being described with
specialized page structures, but what can be done with these page
structures may be different from system memory. ZONE_DEVICE is further
specialized into multiple memory 

[PATCH v8 4/5] RDMA/mlx5: Support dma-buf based userspace memory region

2020-11-05 Thread Jianxin Xiong
Implement the new driver method 'reg_user_mr_dmabuf'.  Utilize the core
functions to import dma-buf based memory region and update the mappings.

Add code to handle dma-buf related page fault.

Signed-off-by: Jianxin Xiong 
Reviewed-by: Sean Hefty 
Acked-by: Michael J. Ruhl 
Acked-by: Christian Koenig 
Acked-by: Daniel Vetter 
---
 drivers/infiniband/hw/mlx5/main.c|   2 +
 drivers/infiniband/hw/mlx5/mlx5_ib.h |  18 ++
 drivers/infiniband/hw/mlx5/mr.c  | 118 +--
 drivers/infiniband/hw/mlx5/odp.c |  97 +---
 4 files changed, 220 insertions(+), 15 deletions(-)

diff --git a/drivers/infiniband/hw/mlx5/main.c 
b/drivers/infiniband/hw/mlx5/main.c
index 36b15a0..e647ea4 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
 /*
  * Copyright (c) 2013-2020, Mellanox Technologies inc. All rights reserved.
+ * Copyright (c) 2020, Intel Corporation. All rights reserved.
  */
 
 #include 
@@ -4055,6 +4056,7 @@ static int mlx5_ib_enable_driver(struct ib_device *dev)
.query_srq = mlx5_ib_query_srq,
.query_ucontext = mlx5_ib_query_ucontext,
.reg_user_mr = mlx5_ib_reg_user_mr,
+   .reg_user_mr_dmabuf = mlx5_ib_reg_user_mr_dmabuf,
.req_notify_cq = mlx5_ib_arm_cq,
.rereg_user_mr = mlx5_ib_rereg_user_mr,
.resize_cq = mlx5_ib_resize_cq,
diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h 
b/drivers/infiniband/hw/mlx5/mlx5_ib.h
index bb44080..3ef6872 100644
--- a/drivers/infiniband/hw/mlx5/mlx5_ib.h
+++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
 /*
  * Copyright (c) 2013-2020, Mellanox Technologies inc. All rights reserved.
+ * Copyright (c) 2020, Intel Corporation. All rights reserved.
  */
 
 #ifndef MLX5_IB_H
@@ -665,6 +666,12 @@ static inline bool is_odp_mr(struct mlx5_ib_mr *mr)
   mr->umem->is_odp;
 }
 
+static inline bool is_dmabuf_mr(struct mlx5_ib_mr *mr)
+{
+   return IS_ENABLED(CONFIG_INFINIBAND_ON_DEMAND_PAGING) && mr->umem &&
+  mr->umem->is_dmabuf;
+}
+
 struct mlx5_ib_mw {
struct ib_mwibmw;
struct mlx5_core_mkey   mmkey;
@@ -1200,6 +1207,10 @@ int mlx5_ib_create_cq(struct ib_cq *ibcq, const struct 
ib_cq_init_attr *attr,
 struct ib_mr *mlx5_ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
  u64 virt_addr, int access_flags,
  struct ib_udata *udata);
+struct ib_mr *mlx5_ib_reg_user_mr_dmabuf(struct ib_pd *pd, u64 start,
+u64 length, u64 virt_addr,
+int fd, int access_flags,
+struct ib_udata *udata);
 int mlx5_ib_advise_mr(struct ib_pd *pd,
  enum ib_uverbs_advise_mr_advice advice,
  u32 flags,
@@ -1210,11 +1221,13 @@ int mlx5_ib_advise_mr(struct ib_pd *pd,
 int mlx5_ib_dealloc_mw(struct ib_mw *mw);
 int mlx5_ib_update_xlt(struct mlx5_ib_mr *mr, u64 idx, int npages,
   int page_shift, int flags);
+int mlx5_ib_update_mr_pas(struct mlx5_ib_mr *mr, unsigned int flags);
 struct mlx5_ib_mr *mlx5_ib_alloc_implicit_mr(struct mlx5_ib_pd *pd,
 struct ib_udata *udata,
 int access_flags);
 void mlx5_ib_free_implicit_mr(struct mlx5_ib_mr *mr);
 void mlx5_ib_fence_odp_mr(struct mlx5_ib_mr *mr);
+void mlx5_ib_fence_dmabuf_mr(struct mlx5_ib_mr *mr);
 int mlx5_ib_rereg_user_mr(struct ib_mr *ib_mr, int flags, u64 start,
  u64 length, u64 virt_addr, int access_flags,
  struct ib_pd *pd, struct ib_udata *udata);
@@ -1306,6 +1319,7 @@ int mlx5_ib_advise_mr_prefetch(struct ib_pd *pd,
   enum ib_uverbs_advise_mr_advice advice,
   u32 flags, struct ib_sge *sg_list, u32 num_sge);
 int mlx5_ib_init_odp_mr(struct mlx5_ib_mr *mr, bool enable);
+int mlx5_ib_init_dmabuf_mr(struct mlx5_ib_mr *mr);
 #else /* CONFIG_INFINIBAND_ON_DEMAND_PAGING */
 static inline void mlx5_ib_internal_fill_odp_caps(struct mlx5_ib_dev *dev)
 {
@@ -1331,6 +1345,10 @@ static inline int mlx5_ib_init_odp_mr(struct mlx5_ib_mr 
*mr, bool enable)
 {
return -EOPNOTSUPP;
 }
+static inline int mlx5_ib_init_dmabuf_mr(struct mlx5_ib_mr *mr)
+{
+   return -EOPNOTSUPP;
+}
 #endif /* CONFIG_INFINIBAND_ON_DEMAND_PAGING */
 
 extern const struct mmu_interval_notifier_ops mlx5_mn_ops;
diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
index 9f653b4..c7f2a01 100644
--- a/drivers/infiniband/hw/mlx5/mr.c
+++ b/drivers/infiniband/hw/mlx5/mr.c
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved.
+ * Copyright (c) 2020, Intel 

[PATCH v8 3/5] RDMA/uverbs: Add uverbs command for dma-buf based MR registration

2020-11-05 Thread Jianxin Xiong
Implement a new uverbs ioctl method for memory registration with file
descriptor as an extra parameter.

Signed-off-by: Jianxin Xiong 
Reviewed-by: Sean Hefty 
Acked-by: Michael J. Ruhl 
Acked-by: Christian Koenig 
Acked-by: Daniel Vetter 
---
 drivers/infiniband/core/uverbs_std_types_mr.c | 112 ++
 include/uapi/rdma/ib_user_ioctl_cmds.h|  14 
 2 files changed, 126 insertions(+)

diff --git a/drivers/infiniband/core/uverbs_std_types_mr.c 
b/drivers/infiniband/core/uverbs_std_types_mr.c
index 9b22bb5..f22e58b 100644
--- a/drivers/infiniband/core/uverbs_std_types_mr.c
+++ b/drivers/infiniband/core/uverbs_std_types_mr.c
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2018, Mellanox Technologies inc.  All rights reserved.
+ * Copyright (c) 2020, Intel Corporation.  All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -178,6 +179,85 @@ static int UVERBS_HANDLER(UVERBS_METHOD_QUERY_MR)(
return IS_UVERBS_COPY_ERR(ret) ? ret : 0;
 }
 
+static int UVERBS_HANDLER(UVERBS_METHOD_REG_DMABUF_MR)(
+   struct uverbs_attr_bundle *attrs)
+{
+   struct ib_uobject *uobj =
+   uverbs_attr_get_uobject(attrs, 
UVERBS_ATTR_REG_DMABUF_MR_HANDLE);
+   struct ib_pd *pd =
+   uverbs_attr_get_obj(attrs, UVERBS_ATTR_REG_DMABUF_MR_PD_HANDLE);
+   struct ib_device *ib_dev = pd->device;
+
+   u64 offset, length, virt_addr;
+   u32 fd, access_flags;
+   struct ib_mr *mr;
+   int ret;
+
+   if (!ib_dev->ops.reg_user_mr_dmabuf)
+   return -EOPNOTSUPP;
+
+   ret = uverbs_copy_from(, attrs,
+  UVERBS_ATTR_REG_DMABUF_MR_OFFSET);
+   if (ret)
+   return ret;
+
+   ret = uverbs_copy_from(, attrs,
+  UVERBS_ATTR_REG_DMABUF_MR_LENGTH);
+   if (ret)
+   return ret;
+
+   ret = uverbs_copy_from(_addr, attrs,
+  UVERBS_ATTR_REG_DMABUF_MR_IOVA);
+   if (ret)
+   return ret;
+
+   ret = uverbs_copy_from(, attrs,
+  UVERBS_ATTR_REG_DMABUF_MR_FD);
+   if (ret)
+   return ret;
+
+   ret = uverbs_get_flags32(_flags, attrs,
+UVERBS_ATTR_REG_DMABUF_MR_ACCESS_FLAGS,
+IB_ACCESS_SUPPORTED);
+   if (ret)
+   return ret;
+
+   ret = ib_check_mr_access(access_flags);
+   if (ret)
+   return ret;
+
+   mr = pd->device->ops.reg_user_mr_dmabuf(pd, offset, length, virt_addr,
+   fd, access_flags,
+   >driver_udata);
+   if (IS_ERR(mr))
+   return PTR_ERR(mr);
+
+   mr->device  = pd->device;
+   mr->pd  = pd;
+   mr->type= IB_MR_TYPE_USER;
+   mr->uobject = uobj;
+   atomic_inc(>usecnt);
+
+   uobj->object = mr;
+
+   ret = uverbs_copy_to(attrs, UVERBS_ATTR_REG_DMABUF_MR_RESP_LKEY,
+>lkey, sizeof(mr->lkey));
+   if (ret)
+   goto err_dereg;
+
+   ret = uverbs_copy_to(attrs, UVERBS_ATTR_REG_DMABUF_MR_RESP_RKEY,
+>rkey, sizeof(mr->rkey));
+   if (ret)
+   goto err_dereg;
+
+   return 0;
+
+err_dereg:
+   ib_dereg_mr_user(mr, uverbs_get_cleared_udata(attrs));
+
+   return ret;
+}
+
 DECLARE_UVERBS_NAMED_METHOD(
UVERBS_METHOD_ADVISE_MR,
UVERBS_ATTR_IDR(UVERBS_ATTR_ADVISE_MR_PD_HANDLE,
@@ -243,6 +323,37 @@ static int UVERBS_HANDLER(UVERBS_METHOD_QUERY_MR)(
UVERBS_ATTR_TYPE(u32),
UA_MANDATORY));
 
+DECLARE_UVERBS_NAMED_METHOD(
+   UVERBS_METHOD_REG_DMABUF_MR,
+   UVERBS_ATTR_IDR(UVERBS_ATTR_REG_DMABUF_MR_HANDLE,
+   UVERBS_OBJECT_MR,
+   UVERBS_ACCESS_NEW,
+   UA_MANDATORY),
+   UVERBS_ATTR_IDR(UVERBS_ATTR_REG_DMABUF_MR_PD_HANDLE,
+   UVERBS_OBJECT_PD,
+   UVERBS_ACCESS_READ,
+   UA_MANDATORY),
+   UVERBS_ATTR_PTR_IN(UVERBS_ATTR_REG_DMABUF_MR_OFFSET,
+  UVERBS_ATTR_TYPE(u64),
+  UA_MANDATORY),
+   UVERBS_ATTR_PTR_IN(UVERBS_ATTR_REG_DMABUF_MR_LENGTH,
+  UVERBS_ATTR_TYPE(u64),
+  UA_MANDATORY),
+   UVERBS_ATTR_PTR_IN(UVERBS_ATTR_REG_DMABUF_MR_IOVA,
+  UVERBS_ATTR_TYPE(u64),
+  UA_MANDATORY),
+   UVERBS_ATTR_PTR_IN(UVERBS_ATTR_REG_DMABUF_MR_FD,
+  UVERBS_ATTR_TYPE(u32),
+  UA_MANDATORY),
+   UVERBS_ATTR_FLAGS_IN(UVERBS_ATTR_REG_DMABUF_MR_ACCESS_FLAGS,
+enum ib_access_flags),
+   

[PATCH v8 1/5] RDMA/umem: Support importing dma-buf as user memory region

2020-11-05 Thread Jianxin Xiong
Dma-buf is a standard cross-driver buffer sharing mechanism that can be
used to support peer-to-peer access from RDMA devices.

Device memory exported via dma-buf is associated with a file descriptor.
This is passed to the user space as a property associated with the
buffer allocation. When the buffer is registered as a memory region,
the file descriptor is passed to the RDMA driver along with other
parameters.

Implement the common code for importing dma-buf object and mapping
dma-buf pages.

Signed-off-by: Jianxin Xiong 
Reviewed-by: Sean Hefty 
Acked-by: Michael J. Ruhl 
Acked-by: Christian Koenig 
Acked-by: Daniel Vetter 
---
 drivers/infiniband/core/Makefile  |   2 +-
 drivers/infiniband/core/umem.c|   4 +
 drivers/infiniband/core/umem_dmabuf.c | 193 ++
 drivers/infiniband/core/umem_dmabuf.h |  11 ++
 include/rdma/ib_umem.h|  39 ++-
 5 files changed, 247 insertions(+), 2 deletions(-)
 create mode 100644 drivers/infiniband/core/umem_dmabuf.c
 create mode 100644 drivers/infiniband/core/umem_dmabuf.h

diff --git a/drivers/infiniband/core/Makefile b/drivers/infiniband/core/Makefile
index ccf2670..8ab4eea 100644
--- a/drivers/infiniband/core/Makefile
+++ b/drivers/infiniband/core/Makefile
@@ -40,5 +40,5 @@ ib_uverbs-y :=uverbs_main.o 
uverbs_cmd.o uverbs_marshall.o \
uverbs_std_types_srq.o \
uverbs_std_types_wq.o \
uverbs_std_types_qp.o
-ib_uverbs-$(CONFIG_INFINIBAND_USER_MEM) += umem.o
+ib_uverbs-$(CONFIG_INFINIBAND_USER_MEM) += umem.o umem_dmabuf.o
 ib_uverbs-$(CONFIG_INFINIBAND_ON_DEMAND_PAGING) += umem_odp.o
diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c
index f1fc7e3..4bc455f 100644
--- a/drivers/infiniband/core/umem.c
+++ b/drivers/infiniband/core/umem.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2005 Topspin Communications.  All rights reserved.
  * Copyright (c) 2005 Cisco Systems.  All rights reserved.
  * Copyright (c) 2005 Mellanox Technologies. All rights reserved.
+ * Copyright (c) 2020 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -43,6 +44,7 @@
 #include 
 
 #include "uverbs.h"
+#include "umem_dmabuf.h"
 
 static void __ib_umem_release(struct ib_device *dev, struct ib_umem *umem, int 
dirty)
 {
@@ -278,6 +280,8 @@ void ib_umem_release(struct ib_umem *umem)
 {
if (!umem)
return;
+   if (umem->is_dmabuf)
+   return ib_umem_dmabuf_release(to_ib_umem_dmabuf(umem));
if (umem->is_odp)
return ib_umem_odp_release(to_ib_umem_odp(umem));
 
diff --git a/drivers/infiniband/core/umem_dmabuf.c 
b/drivers/infiniband/core/umem_dmabuf.c
new file mode 100644
index 000..ee82b7b
--- /dev/null
+++ b/drivers/infiniband/core/umem_dmabuf.c
@@ -0,0 +1,193 @@
+// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
+/*
+ * Copyright (c) 2020 Intel Corporation. All rights reserved.
+ */
+
+#include 
+#include 
+#include 
+
+#include "uverbs.h"
+#include "umem_dmabuf.h"
+
+int ib_umem_dmabuf_map_pages(struct ib_umem_dmabuf *umem_dmabuf)
+{
+   struct sg_table *sgt;
+   struct scatterlist *sg;
+   struct dma_fence *fence;
+   unsigned long start, end, cur;
+   unsigned int nmap;
+   unsigned int page_size;
+   int i;
+
+   dma_resv_assert_held(umem_dmabuf->attach->dmabuf->resv);
+
+   sgt = dma_buf_map_attachment(umem_dmabuf->attach,
+DMA_BIDIRECTIONAL);
+
+   if (IS_ERR(sgt))
+   return PTR_ERR(sgt);
+
+   /* modify the sgl in-place to match umem address and length */
+
+   start = ALIGN_DOWN(umem_dmabuf->umem.address, PAGE_SIZE);
+   end = ALIGN(umem_dmabuf->umem.address + umem_dmabuf->umem.length,
+   PAGE_SIZE);
+   cur = 0;
+   nmap = 0;
+   for_each_sgtable_dma_sg(sgt, sg, i) {
+   if (cur >= end)
+   break;
+   if (cur + sg_dma_len(sg) <= start) {
+   cur += sg_dma_len(sg);
+   continue;
+   }
+   if (cur <= start) {
+   unsigned long offset = start - cur;
+
+   umem_dmabuf->first_sg = sg;
+   umem_dmabuf->first_sg_offset = offset;
+   sg_dma_address(sg) += offset;
+   sg_dma_len(sg) -= offset;
+   if (_dma_len(sg) != >length)
+   sg->length -= offset;
+   cur += offset;
+   }
+   if (cur + sg_dma_len(sg) >= end) {
+   unsigned long trim = cur + sg_dma_len(sg) - end;
+
+   umem_dmabuf->last_sg = sg;
+   umem_dmabuf->last_sg_trim = 

Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel

2020-11-05 Thread Tomi Valkeinen
On 05/11/2020 20:14, H. Nikolaus Schaller wrote:
> 
>> Am 05.11.2020 um 18:36 schrieb Tomi Valkeinen :
>>
>> Hi,
>>
>> On 05/11/2020 19:15, H. Nikolaus Schaller wrote:
>>
>>> Next, I migrated my long waiting mipi_dsi/drm_panel driver conversion for
>>> the panel of the Pyra handheld (omap 5 based) to compile on 5.10-rc2. And
>>> I followed the latest existing panel-orisetech-otm8009a.c which uses a
>>> similar video mode controller and mipi-dsi.
>>>
>>> That one seems to be used by arch/arm/boot/dts/stm32f469-disco.dts.
>>>
>>> Unfortunately my panel driver is not even loaded by drm/omap so I can't
>>> debug. Does this set of drm/omap drivers need a modification of the device
>>> tree? If yes, which one?
>>
>> omapdrm doesn't load the panel drivers. If not even your panel's probe is 
>> called, then it hints at
>> DT and/or driver's compatible string issue. The panel's probe should get 
>> called even if omapdrm is
>> not loaded at all.
> 
> Well, I use the same device tree that loads the old driver...

Yeah, I was mistaken above. With DSI the panel (may be) a child of the DSI 
host, so it will affect.

Can you give pointers to the panel driver source and relevant dts files? BOE 
BTL507212-W677L?

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[pull] amdgpu, amdkfd, radeon amd-drm-next-5.11

2020-11-05 Thread Alex Deucher
Hi Dave, Daniel,

Updates for 5.11.  This should merge pretty cleanly.  I created a backmerge
branch[1] in case you run into any issues.

[1] https://cgit.freedesktop.org/~agd5f/linux/log/?h=drm-next-5.11-backmerge

The following changes since commit f2fa07b39fafb2a5f49c71a504862c5efa57d03e:

  drm/amd/amdkfd: Surface files in Sysfs to allow users to get number of 
compute units that are in use. (2020-09-30 15:26:27 -0400)

are available in the Git repository at:

  git://people.freedesktop.org/~agd5f/linux tags/amd-drm-next-5.11-2020-11-05

for you to fetch changes up to 514ad1b6bb6e2fa205b5511bd3d50e33457f6180:

  drm/amdgpu: Fix Arcturus fan speed reporting (2020-11-05 14:23:06 -0500)


amd-drm-next-5.11-2020-11-05:

amdgpu:
- Add initial support for Vangogh
- Add support for Green Sardine
- Add initial support for Dimgrey Cavefish
- Scatter/Gather display support for Renoir
- Updates for Sienna Cichlid
- Updates for Navy Flounder
- SMU7 power improvements
- Modifier support for gfx9+
- CI BACO fixes
- Arcturus SMU fixes
- Lots of code cleanups
- DC fixes
- Kernel doc fixes
- Add more GPU HW client information to page fault error logging
- MPO clock tuning for RV
- FP fixes for DCN3 on ARM and PPC

radeon:
- Expose voltage via hwmon on Sumo APUs

amdkfd:
- Fix unique id handling
- Misc fixes


Aaron Liu (1):
  drm/amdgpu: enable green_sardine_asd.bin loading (v2)

Alex Deucher (27):
  drm/amdgpu/swsmu: add interrupt work function
  drm/amdgpu/swsmu: add interrupt work handler for smu11 parts
  drm/amdgpu/gfx10: add updated register offsets for VGH
  drm/amdgpu: IP discovery table is not ready yet for VG
  drm/amdgpu/mmhub2.3: print client id string for mmhub
  drm/amdgpu/swsmu: fix ARC build errors
  drm/amdgpu: prevent spurious warning
  drm/amdgpu: add Green_Sardine APU flag
  drm/amdgpu/swsmu: clean up a bunch of stale interfaces
  drm/amdgpu/swsmu: init the baco mutex in early_init
  drm/amdgpu/display: DRM_AMD_DC_DCN3_02 depends on DRM_AMD_DC_DCN3_01
  drm/amdgpu: move amdgpu_num_kcq handling to a helper
  drm/amdgpu/gmc10: remove dummy read workaround for newer chips
  drm/amdgpu: add GC 10.3 NOALLOC registers
  drm/amdgpu/display: use kvzalloc again in dc_create_state
  drm/amdgpu/swsmu: drop smu i2c bus on navi1x
  drm/amdgpu/pm: fix the fan speed in fan1_input in manual mode for navi1x
  drm/amdgpu/display: re-add surface size calculation in dcn30_hwseq.c
  drm/amdgpu/display: fix indentation in defer_delay_converter_wa()
  drm/amdgpu/powerplay: Only apply optimized mclk dpm policy on polaris
  drm/amdgpu/display: remove DRM_AMD_DC_GREEN_SARDINE
  drm/amdgpu/display: remove dal_cmd_tbl_helper_dcn2_get_table2
  drm/amdgpu: drop CONFIG_DRM_AMD_DC_DCN3_01 from atomfirmware.h
  drm/amdgpu: allow TMZ on vangogh
  drm/amdgpu/display: fix warnings when CONFIG_DRM_AMD_DC_DCN is not set
  drm/amdgpu: fold CONFIG_DRM_AMD_DC_DCN3* into CONFIG_DRM_AMD_DC_DCN (v3)
  drm/amdgpu/display: FP fixes for DCN3.x (v4)

Alex Sierra (2):
  drm/amdgpu: align frag_end to covered address space
  drm/amdgpu: replace ih ip block for vega20 and arcturus

Alvin Lee (7):
  drm/amd/display: Don't allow pstate if no support in blank
  drm/amd/display: Program meta addresses correctly
  drm/amd/display: Only flush inst_fb if backdoor loading
  drm/amd/display: Set WM set A to 0 if full pstate not supported
  drm/amd/display: Update GSL state if leaving immediate flip
  drm/amd/display: Keep GSL for full updates with planes that flip VSYNC
  drm/amd/display: Reset flip_immediate to topmost plane

Andrey Grodzovsky (3):
  drm/amd/display: Revert "drm/amd/display: Fix a list corruption"
  drm/amd/display: Avoid MST manager resource leak.
  drm/amd/psp: Fix sysfs: cannot create duplicate filename

Anthony Koo (5):
  drm/amd/display: [FW Promotion] Release 0.0.36
  drm/amd/display: [FW Promotion] Release 0.0.37
  drm/amd/display: [FW Promotion] Release 0.0.38
  drm/amd/display: [FW Promotion] Release 0.0.39
  drm/amd/display: [FW Promotion] Release 0.0.40

Aric Cyr (9):
  drm/amd/display: 3.2.105
  drm/amd/display: Check for flip pending before locking pipes
  drm/amd/display: FreeSync not active near lower bound of non-LFC monitor 
range
  drm/amd/display: 3.2.106
  drm/amd/display: 3.2.107
  drm/amd/display: Don't trigger flip twice when ODM combine in use
  drm/amd/display: 3.2.108
  drm/amd/display: 3.2.109
  drm/amd/display: 3.2.110

Arnd Bergmann (2):
  drm/amdgpu: fix incorrect enum type
  drm/amdgpu: fix build_coefficients() argument

Ashley Thomas (2):
  drm/amd/display: Source minimum HBlank support
  drm/amd/display: fail instead of div by zero/bugcheck

Bas 

[PATCH v3 2/3] drm: panel: simple: Add BOE NV110WTM-N61

2020-11-05 Thread Douglas Anderson
Add support for the BOE NV110WTM-N61 panel.  The EDID lists two modes
(one for 60 Hz refresh rate and one for 40 Hz), so we'll list both of
them here.

Note that the panel datasheet requires 80 ms between HPD asserting and
the backlight power being turned on.  We'll use the new timing
constraints structure to do this cleanly.  This assumes that the
backlight will be enabled _after_ the panel enable finishes.  This is
how it works today and seems a sane assumption.

Signed-off-by: Douglas Anderson 
---

(no changes since v2)

Changes in v2:
- Adjust for shorter names in patch #1.

 drivers/gpu/drm/panel/panel-simple.c | 48 
 1 file changed, 48 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index bb1e3d15f793..db3f0e2b6001 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -1401,6 +1401,51 @@ static const struct panel_desc boe_nv101wxmn51 = {
},
 };
 
+static const struct drm_display_mode boe_nv110wtm_n61_modes[] = {
+   {
+   .clock = 207800,
+   .hdisplay = 2160,
+   .hsync_start = 2160 + 48,
+   .hsync_end = 2160 + 48 + 32,
+   .htotal = 2160 + 48 + 32 + 100,
+   .vdisplay = 1440,
+   .vsync_start = 1440 + 3,
+   .vsync_end = 1440 + 3 + 6,
+   .vtotal = 1440 + 3 + 6 + 31,
+   },
+   {
+   .clock = 138500,
+   .hdisplay = 2160,
+   .hsync_start = 2160 + 48,
+   .hsync_end = 2160 + 48 + 32,
+   .htotal = 2160 + 48 + 32 + 100,
+   .vdisplay = 1440,
+   .vsync_start = 1440 + 3,
+   .vsync_end = 1440 + 3 + 6,
+   .vtotal = 1440 + 3 + 6 + 31,
+   },
+};
+
+static const struct panel_desc boe_nv110wtm_n61 = {
+   .modes = boe_nv110wtm_n61_modes,
+   .num_modes = ARRAY_SIZE(boe_nv110wtm_n61_modes),
+   .bpc = 8,
+   .size = {
+   .width = 233,
+   .height = 155,
+   },
+   .delay = {
+   .hpd_absent_delay = 200,
+   },
+   .min_times = {
+   .prepare_to_enable = 80,
+   .unprepare_to_prepare = 500,
+   },
+   .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
+   .bus_flags = DRM_BUS_FLAG_DATA_MSB_TO_LSB,
+   .connector_type = DRM_MODE_CONNECTOR_eDP,
+};
+
 /* Also used for boe_nv133fhm_n62 */
 static const struct drm_display_mode boe_nv133fhm_n61_modes = {
.clock = 147840,
@@ -4063,6 +4108,9 @@ static const struct of_device_id platform_of_match[] = {
}, {
.compatible = "boe,nv101wxmn51",
.data = _nv101wxmn51,
+   }, {
+   .compatible = "boe,nv110wtm-n61",
+   .data = _nv110wtm_n61,
}, {
.compatible = "boe,nv133fhm-n61",
.data = _nv133fhm_n61,
-- 
2.29.1.341.ge80a0c044ae-goog

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


[PATCH v3 3/3] dt-bindings: dt-bindings: display: simple: Add BOE NV110WTM-N61

2020-11-05 Thread Douglas Anderson
Add yet another eDP panel.

Signed-off-by: Douglas Anderson 
Acked-by: Rob Herring 
---

(no changes since v1)

 .../devicetree/bindings/display/panel/panel-simple.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/display/panel/panel-simple.yaml 
b/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
index edb53ab0d9eb..93e244c67e8a 100644
--- a/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
+++ b/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
@@ -76,6 +76,8 @@ properties:
 # BOE OPTOELECTRONICS TECHNOLOGY 10.1" WXGA TFT LCD panel
   - boe,nv101wxmn51
 # BOE NV133FHM-N61 13.3" FHD (1920x1080) TFT LCD Panel
+  - boe,nv110wtm-n61
+# BOE NV110WTM-N61 11.0" 2160x1440 TFT LCD Panel
   - boe,nv133fhm-n61
 # BOE NV133FHM-N62 13.3" FHD (1920x1080) TFT LCD Panel
   - boe,nv133fhm-n62
-- 
2.29.1.341.ge80a0c044ae-goog

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


[PATCH v3 1/3] drm: panel: simple: Allow timing constraints, not fixed delays

2020-11-05 Thread Douglas Anderson
The simple panel code currently allows panels to define fixed delays
at certain stages of initialization.  These work OK, but they don't
really map all that clearly to the requirements presented in many
panel datasheets.  Instead of defining a fixed delay, those datasheets
provide a timing diagram and specify a minimum amount of time that
needs to pass from event A to event B.

Because of the way things are currently defined, most panels end up
over-delaying.  One prime example here is that a number of panels I've
looked at define the amount of time that must pass between turning a
panel off and turning it back on again.  Since there is no way to
specify this, many developers have listed this as the "unprepare"
delay.  However, if nobody ever tried to turn the panel on again in
the next 500 ms (or whatever the delay was) then this delay was
pointless.  It's better to do the delay only in the case that someone
tried to turn the panel on too quickly.

Let's support specifying delays as constraints.  We'll start with the
one above and also a second one: the minimum time between prepare
being done and doing the enable.  On the panel I'm looking at, there's
an 80 ms minimum time between HPD being asserted by the panel and
setting the backlight enable GPIO.  By specifying as a constraint we
can enforce this without over-delaying.  Specifically the link
training is allowed to happen in parallel with this delay so adding a
fixed 80 ms delay isn't ideal.

Signed-off-by: Douglas Anderson 
---

Changes in v3:
- Fixed totally backwards "if" tests.  :(

Changes in v2:
- Inline the kernel doc for the two new members.
- Beefed up kernel doc saying exactly when the delay happens.
- Removed "_ms" from the end of members to shorten them.
- Renamed "timing_constraints" to "min_times" to shorten it.
- Renamed "enforce_constraint()" to "wait_min_time()" to shorten it.
- Check "prepared_time" against 0 to see if we've been prepared.

 drivers/gpu/drm/panel/panel-simple.c | 99 ++--
 1 file changed, 92 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index 2be358fb46f7..bb1e3d15f793 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -92,6 +92,68 @@ struct panel_desc {
unsigned int unprepare;
} delay;
 
+   struct {
+   /**
+* @prepare_to_enable: Time between prepare and enable.
+*
+* The minimum time, in milliseconds, that needs to have passed
+* between when prepare finished and enable may begin. If at
+* enable time less time has passed since prepare finished,
+* the driver waits for the remaining time.
+*
+* If a fixed enable delay is also specified, we'll start
+* counting before delaying for the fixed delay.
+*
+* If a fixed prepare delay is also specified, we won't start
+* counting until after the fixed delay. We can't overlap this
+* fixed delay with the min time because the fixed delay
+* doesn't happen at the end of the function if a HPD GPIO was
+* specified.
+*
+* In other words:
+*   prepare()
+* ...
+* // do fixed prepare delay
+* // wait for HPD GPIO if applicable
+* // start counting for prepare_to_enable
+*
+*   enable()
+* // do fixed enable delay
+* // enforce prepare_to_enable min time
+*/
+   unsigned int prepare_to_enable;
+
+   /**
+* @unprepare_to_prepare: Time between unprepare and prepare.
+*
+* The minimum time, in milliseconds, that needs to have passed
+* between when unprepare finished and prepare may begin. If at
+* prepare time less time has passed since unprepare finished,
+* the driver waits for the remaining time.
+*
+* If a fixed unprepare delay is also specified, we'll start
+* counting before delaying for the fixed delay.
+*
+* If a fixed prepare delay is also specified, it will happen
+* separately and after we've enforced this minimum. We can't
+* overlap this fixed delay with the min time because the
+* fixed delay doesn't happen at the start of the function
+* if a regulator or enable GPIO was specified.
+*
+* In other words:
+*   unprepare():
+* ...
+* // start counting for unprepare_to_prepare
+* 

Re: [PATCH v2 1/3] drm: panel: simple: Allow timing constraints, not fixed delays

2020-11-05 Thread Doug Anderson
Hi,

On Wed, Oct 28, 2020 at 3:58 PM Douglas Anderson  wrote:
> @@ -249,18 +327,19 @@ static int panel_simple_unprepare(struct drm_panel 
> *panel)
>  {
> struct panel_simple *p = to_panel_simple(panel);
>
> -   if (!p->prepared)
> +   if (p->prepared_time != 0)

Though I swear I tested this, clearly I didn't test well enough.  I
was poking with this patch series some more and realized that I got
the above (and the one in _prepare) totally and utterly backwards.
I'll send out a v3 now...

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


Re: [PATCH v3 3/3] dt-bindings: panel: common: Add reference to graph schema

2020-11-05 Thread Sam Ravnborg
On Mon, Nov 02, 2020 at 02:36:56PM -0600, Rob Herring wrote:
> Now that we have a graph schema, reference it from the common panel
> schema.
> 
> Cc: Thierry Reding 
> Cc: Sam Ravnborg 
> Cc: Laurent Pinchart 
> Signed-off-by: Rob Herring 
Reviewed-by: Sam Ravnborg 

I expect you to apply the patch due to the dependencies.
We can start using graph.yaml in drm-misc-next after the merge
window and a backmerge.

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


Re: [PATCH v3 1/3] dt-bindings: Convert graph bindings to json-schema

2020-11-05 Thread Sam Ravnborg
Hi Rob/Sameer


On Mon, Nov 02, 2020 at 02:36:54PM -0600, Rob Herring wrote:
> From: Sameer Pujar 
> 
> Convert device tree bindings of graph to YAML format. Currently graph.txt
> doc is referenced in multiple files and all of these need to use schema
> references. For now graph.txt is updated to refer to graph.yaml.
> 
> For users of the graph binding, they should reference to the graph
> schema from either 'ports' or 'port' property:
> 
> properties:
>   ports:
> type: object
> $ref: graph.yaml#/properties/ports
Please fix so this example is correct - append /schemas/

> 
> properties:
>   port@0:
> description: What data this port has
> 
>   ...
> 
> Or:
> 
> properties:
>   port:
> description: What data this port has
> type: object
> $ref: graph.yaml#/properties/port
Likewise.

Otherwise I could be confused when looking it up later.

> 
> Signed-off-by: Sameer Pujar 
> Acked-by: Philipp Zabel 
> Signed-off-by: Rob Herring 

With the changelog fixed:
Reviewed-by: Sam Ravnborg 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel

2020-11-05 Thread Tomi Valkeinen
Hi,

On 05/11/2020 19:15, H. Nikolaus Schaller wrote:

> Next, I migrated my long waiting mipi_dsi/drm_panel driver conversion for
> the panel of the Pyra handheld (omap 5 based) to compile on 5.10-rc2. And
> I followed the latest existing panel-orisetech-otm8009a.c which uses a
> similar video mode controller and mipi-dsi.
> 
> That one seems to be used by arch/arm/boot/dts/stm32f469-disco.dts.
> 
> Unfortunately my panel driver is not even loaded by drm/omap so I can't
> debug. Does this set of drm/omap drivers need a modification of the device
> tree? If yes, which one?

omapdrm doesn't load the panel drivers. If not even your panel's probe is 
called, then it hints at
DT and/or driver's compatible string issue. The panel's probe should get called 
even if omapdrm is
not loaded at all.

Can you push your branch somewhere, so I can have a quick look?

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel

2020-11-05 Thread Sam Ravnborg
Hi Tomi

On Thu, Nov 05, 2020 at 02:02:37PM +0200, Tomi Valkeinen wrote:
> Hi,
> 
> This is third version of the series sent by Sebastian in February:
> 
> https://www.spinics.net/lists/linux-omap/msg153465.html
> 
> I took the patches from his git tree, and rebased on 5.10-rc2. There
> were some conflicts and compilation errors, and one bug that made dsi to
> not work (videomode variable was not initialized to 0).

I for one would be more than happy to see these patches go in.
I have looked at them before but was lost in all the conversions.
But the general impression is that the drivers are left in a much better
shape after the patch set. And the individual patches all looks good.

So I am all for getting the patches applied.
Perferably soonish so there is some time to fix any regressions that may
be reported.

Sam

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


Re: [PATCH v3 02/56] Revert "drm/omap: dss: Remove unused omap_dss_device operations"

2020-11-05 Thread Sam Ravnborg
Hi Tomi

On Thu, Nov 05, 2020 at 02:02:39PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> This reverts commit 4ff8e98879e6eeae9d125dfcf3b642075d00089d.

Please use proper commit reference like:
2f62f4990dca ("gpu: drm: bridge: bla bla)

The above commit-id does not exist in my drm-misc-next tree.

Sam

> 
> This is still needed by DSI. E.g. unloading modules without this will
> cause a crash.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 
> ---
>  drivers/gpu/drm/omapdrm/dss/base.c | 26 +++
>  drivers/gpu/drm/omapdrm/dss/omapdss.h  |  6 
>  drivers/gpu/drm/omapdrm/omap_encoder.c | 44 +++---
>  3 files changed, 71 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/base.c 
> b/drivers/gpu/drm/omapdrm/dss/base.c
> index c7650a7c155d..455b410f7401 100644
> --- a/drivers/gpu/drm/omapdrm/dss/base.c
> +++ b/drivers/gpu/drm/omapdrm/dss/base.c
> @@ -234,6 +234,18 @@ void omapdss_device_disconnect(struct omap_dss_device 
> *src,
>  }
>  EXPORT_SYMBOL_GPL(omapdss_device_disconnect);
>  
> +void omapdss_device_pre_enable(struct omap_dss_device *dssdev)
> +{
> + if (!dssdev)
> + return;
> +
> + omapdss_device_pre_enable(dssdev->next);
> +
> + if (dssdev->ops && dssdev->ops->pre_enable)
> + dssdev->ops->pre_enable(dssdev);
> +}
> +EXPORT_SYMBOL_GPL(omapdss_device_pre_enable);
> +
>  void omapdss_device_enable(struct omap_dss_device *dssdev)
>  {
>   if (!dssdev)
> @@ -260,6 +272,20 @@ void omapdss_device_disable(struct omap_dss_device 
> *dssdev)
>  }
>  EXPORT_SYMBOL_GPL(omapdss_device_disable);
>  
> +void omapdss_device_post_disable(struct omap_dss_device *dssdev)
> +{
> + if (!dssdev)
> + return;
> +
> + if (dssdev->ops && dssdev->ops->post_disable)
> + dssdev->ops->post_disable(dssdev);
> +
> + omapdss_device_post_disable(dssdev->next);
> +
> + dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
> +}
> +EXPORT_SYMBOL_GPL(omapdss_device_post_disable);
> +
>  /* 
> -
>   * Components Handling
>   */
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index ab19d4af8de7..cbbe10b2b60d 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -342,11 +342,15 @@ struct omap_dss_device_ops {
>   void (*disconnect)(struct omap_dss_device *dssdev,
>   struct omap_dss_device *dst);
>  
> + void (*pre_enable)(struct omap_dss_device *dssdev);
>   void (*enable)(struct omap_dss_device *dssdev);
>   void (*disable)(struct omap_dss_device *dssdev);
> + void (*post_disable)(struct omap_dss_device *dssdev);
>  
>   int (*check_timings)(struct omap_dss_device *dssdev,
>struct drm_display_mode *mode);
> + void (*set_timings)(struct omap_dss_device *dssdev,
> + const struct drm_display_mode *mode);
>  
>   int (*get_modes)(struct omap_dss_device *dssdev,
>struct drm_connector *connector);
> @@ -445,8 +449,10 @@ int omapdss_device_connect(struct dss_device *dss,
>  struct omap_dss_device *dst);
>  void omapdss_device_disconnect(struct omap_dss_device *src,
>  struct omap_dss_device *dst);
> +void omapdss_device_pre_enable(struct omap_dss_device *dssdev);
>  void omapdss_device_enable(struct omap_dss_device *dssdev);
>  void omapdss_device_disable(struct omap_dss_device *dssdev);
> +void omapdss_device_post_disable(struct omap_dss_device *dssdev);
>  
>  int omap_dss_get_num_overlay_managers(void);
>  
> diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c 
> b/drivers/gpu/drm/omapdrm/omap_encoder.c
> index ae4b867a67a3..18a79dde6815 100644
> --- a/drivers/gpu/drm/omapdrm/omap_encoder.c
> +++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
> @@ -113,8 +113,13 @@ static void omap_encoder_mode_set(struct drm_encoder 
> *encoder,
>   bus_flags = connector->display_info.bus_flags;
>   omap_encoder_update_videomode_flags(, bus_flags);
>  
> - /* Set timings for the dss manager. */
> + /* Set timings for all devices in the display pipeline. */
>   dss_mgr_set_timings(output, );
> +
> + for (dssdev = output; dssdev; dssdev = dssdev->next) {
> + if (dssdev->ops && dssdev->ops->set_timings)
> + dssdev->ops->set_timings(dssdev, adjusted_mode);
> + }
>  }
>  
>  static void omap_encoder_disable(struct drm_encoder *encoder)
> @@ -127,10 +132,26 @@ static void omap_encoder_disable(struct drm_encoder 
> *encoder)
>  
>   /*
>* Disable the chain of external devices, starting at the one at the
> -  * internal encoder's output. This is used for DSI outputs only, as
> -  * dssdev->next is NULL for all other outputs.
> +  * internal encoder's output.
>   

Re: [PATCH v2] drm/vc4: replace idr_init() by idr_init_base()

2020-11-05 Thread Eric Anholt
On Thu, Nov 5, 2020 at 12:21 PM Deepak R Varma  wrote:
>
> idr_init() uses base 0 which is an invalid identifier for this driver.
> The idr_alloc for this driver uses VC4_PERFMONID_MIN as start value for
> ID range and it is #defined to 1. The new function idr_init_base allows
> IDR to set the ID lookup from base 1. This avoids all lookups that
> otherwise starts from 0 since 0 is always unused / available.
>
> References: commit 6ce711f27500 ("idr: Make 1-based IDRs more efficient")
>
> Signed-off-by: Deepak R Varma 
> ---
> Changes since v1:
>- Change suggested by Eric Anholt
>  1. Use VC4_PERFMONID_MIN instead of magic number 1
>
>  drivers/gpu/drm/vc4/vc4_perfmon.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/vc4/vc4_perfmon.c 
> b/drivers/gpu/drm/vc4/vc4_perfmon.c
> index f4aa75efd16b..18abc06335c1 100644
> --- a/drivers/gpu/drm/vc4/vc4_perfmon.c
> +++ b/drivers/gpu/drm/vc4/vc4_perfmon.c
> @@ -77,7 +77,7 @@ struct vc4_perfmon *vc4_perfmon_find(struct vc4_file 
> *vc4file, int id)
>  void vc4_perfmon_open_file(struct vc4_file *vc4file)
>  {
> mutex_init(>perfmon.lock);
> -   idr_init(>perfmon.idr);
> +   idr_init_base(>perfmon.idr, VC4_PERFMONID_MIN);
>  }
>
>  static int vc4_perfmon_idr_del(int id, void *elem, void *data)
> --
> 2.25.1

Reviewed-by: Eric Anholt 

hopefully Maxime can apply it.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 12/19] gpu: drm: bridge: analogix: analogix_dp_reg: Remove unused function 'analogix_dp_write_byte_to_dpcd'

2020-11-05 Thread Sam Ravnborg
Hi Lee

On Thu, Nov 05, 2020 at 02:45:10PM +, Lee Jones wrote:
> Fixes the following W=1 kernel build warning(s):
> 
>  drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c:571:5: warning: no 
> previous prototype for ‘analogix_dp_write_byte_to_dpcd’ [-Wmissing-prototypes]
> 
> Cc: Andrzej Hajda 
> Cc: Neil Armstrong 
> Cc: Laurent Pinchart 
> Cc: Jonas Karlman 
> Cc: Jernej Skrabec 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: Jason Yan 
> Cc: Sam Ravnborg 
> Cc: Jingoo Han 
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 

I folded in the other analogix_dp_reg.c patch when I applied this.
So we have the full removal in one patch.

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


Re: [PATCH 16/19] gpu: drm: panel: panel-ilitek-ili9322: Demote non-conformant kernel-doc header

2020-11-05 Thread Sam Ravnborg
Hi Lee.

On Thu, Nov 05, 2020 at 02:45:14PM +, Lee Jones wrote:
> Fixes the following W=1 kernel build warning(s):
> 
>  drivers/gpu/drm/panel/panel-ilitek-ili9322.c:177: warning: Enum value 
> 'ILI9322_INPUT_SRGB_THROUGH' not described in enum 'ili9322_input'
>  drivers/gpu/drm/panel/panel-ilitek-ili9322.c:177: warning: Enum value 
> 'ILI9322_INPUT_SRGB_ALIGNED' not described in enum 'ili9322_input'
>  drivers/gpu/drm/panel/panel-ilitek-ili9322.c:177: warning: Enum value 
> 'ILI9322_INPUT_SRGB_DUMMY_320X240' not described in enum 'ili9322_input'
>  drivers/gpu/drm/panel/panel-ilitek-ili9322.c:177: warning: Enum value 
> 'ILI9322_INPUT_SRGB_DUMMY_360X240' not described in enum 'ili9322_input'
>  drivers/gpu/drm/panel/panel-ilitek-ili9322.c:177: warning: Enum value 
> 'ILI9322_INPUT_DISABLED_1' not described in enum 'ili9322_input'
>  drivers/gpu/drm/panel/panel-ilitek-ili9322.c:177: warning: Enum value 
> 'ILI9322_INPUT_PRGB_THROUGH' not described in enum 'ili9322_input'
>  drivers/gpu/drm/panel/panel-ilitek-ili9322.c:177: warning: Enum value 
> 'ILI9322_INPUT_PRGB_ALIGNED' not described in enum 'ili9322_input'
>  drivers/gpu/drm/panel/panel-ilitek-ili9322.c:177: warning: Enum value 
> 'ILI9322_INPUT_YUV_640X320_YCBCR' not described in enum 'ili9322_input'
>  drivers/gpu/drm/panel/panel-ilitek-ili9322.c:177: warning: Enum value 
> 'ILI9322_INPUT_YUV_720X360_YCBCR' not described in enum 'ili9322_input'
>  drivers/gpu/drm/panel/panel-ilitek-ili9322.c:177: warning: Enum value 
> 'ILI9322_INPUT_DISABLED_2' not described in enum 'ili9322_input'
>  drivers/gpu/drm/panel/panel-ilitek-ili9322.c:177: warning: Enum value 
> 'ILI9322_INPUT_ITU_R_BT656_720X360_YCBCR' not described in enum 
> 'ili9322_input'
>  drivers/gpu/drm/panel/panel-ilitek-ili9322.c:177: warning: Enum value 
> 'ILI9322_INPUT_ITU_R_BT656_640X320_YCBCR' not described in enum 
> 'ili9322_input'
>  drivers/gpu/drm/panel/panel-ilitek-ili9322.c:177: warning: Enum value 
> 'ILI9322_INPUT_UNKNOWN' not described in enum 'ili9322_input'
> 
> Cc: Thierry Reding 
> Cc: Sam Ravnborg 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: Linus Walleij 
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Applied to drm-misc-next.

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


Re: [PATCH 11/19] gpu: drm: panel: panel-simple: Fix 'struct panel_desc's header

2020-11-05 Thread Sam Ravnborg
Hi Lee

On Thu, Nov 05, 2020 at 02:45:09PM +, Lee Jones wrote:
> Struct headers should start with 'struct '
> 
> Fixes the following W=1 kernel build warning(s):
> 
>  drivers/gpu/drm/panel/panel-simple.c:42: warning: Cannot understand  * 
> @modes: Pointer to array of fixed modes appropriate for this panel.  If
> 
> Cc: Thierry Reding 
> Cc: Sam Ravnborg 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Despite my earlier comment I went ahead and applied this.
Then I can rebase my work on this later.

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


Re: [PATCH 01/19] gpu: host1x: bus: Add missing description for 'driver'

2020-11-05 Thread Sam Ravnborg
Hi Lee.
On Thu, Nov 05, 2020 at 02:44:59PM +, Lee Jones wrote:
> Fixes the following W=1 kernel build warning(s):
> 
>  drivers/gpu/host1x/bus.c:40: warning: Function parameter or member 'driver' 
> not described in 'host1x_subdev_add'
> 
> Cc: Thierry Reding 
> Cc: dri-devel@lists.freedesktop.org
> Cc: linux-te...@vger.kernel.org
> Signed-off-by: Lee Jones 

Applied to drm-misc-next - should appear in -next within a week.

Sam
> ---
>  drivers/gpu/host1x/bus.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/host1x/bus.c b/drivers/gpu/host1x/bus.c
> index e201f62d62c0c..347fb962b6c93 100644
> --- a/drivers/gpu/host1x/bus.c
> +++ b/drivers/gpu/host1x/bus.c
> @@ -32,6 +32,7 @@ struct host1x_subdev {
>  /**
>   * host1x_subdev_add() - add a new subdevice with an associated device node
>   * @device: host1x device to add the subdevice to
> + * @driver: host1x driver containing the subdevices
>   * @np: device node
>   */
>  static int host1x_subdev_add(struct host1x_device *device,
> -- 
> 2.25.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: [PATCH v2] drm/bridge: tpd12s015: Fix irq registering in tpd12s015_probe

2020-11-05 Thread Sam Ravnborg
Hi YueHaibing

On Mon, Nov 02, 2020 at 10:30:24PM +0800, YueHaibing wrote:
> gpiod_to_irq() return negative value in case of error,
> the existing code doesn't handle negative error codes.
> If the HPD gpio supports IRQs (gpiod_to_irq returns a
> valid number), we use the IRQ. If it doesn't (gpiod_to_irq
> returns an error), it gets polled via detect(). 
> 
> Fixes: cff5e6f7e83f ("drm/bridge: Add driver for the TI TPD12S015 HDMI level 
> shifter")
> Signed-off-by: YueHaibing 
> ---
> v2: Add checking for >= 0 and update commit message

Thanks, applied to drm-misc-next.

Sam

> ---
>  drivers/gpu/drm/bridge/ti-tpd12s015.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/bridge/ti-tpd12s015.c 
> b/drivers/gpu/drm/bridge/ti-tpd12s015.c
> index 514cbf0eac75..e0e015243a60 100644
> --- a/drivers/gpu/drm/bridge/ti-tpd12s015.c
> +++ b/drivers/gpu/drm/bridge/ti-tpd12s015.c
> @@ -160,7 +160,7 @@ static int tpd12s015_probe(struct platform_device *pdev)
>  
>   /* Register the IRQ if the HPD GPIO is IRQ-capable. */
>   tpd->hpd_irq = gpiod_to_irq(tpd->hpd_gpio);
> - if (tpd->hpd_irq) {
> + if (tpd->hpd_irq >= 0) {
>   ret = devm_request_threaded_irq(>dev, tpd->hpd_irq, NULL,
>   tpd12s015_hpd_isr,
>   IRQF_TRIGGER_RISING |
> -- 
> 2.17.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: [PATCH 04/19] gpu: drm: omapdrm: omap_irq: Fix a couple of doc-rot issues

2020-11-05 Thread Tomi Valkeinen
On 05/11/2020 16:45, Lee Jones wrote:
> The API has been updated, but the header was not.
> 
> Fixes the following W=1 kernel build warning(s):
> 
>  drivers/gpu/drm/omapdrm/omap_irq.c:115: warning: Function parameter or 
> member 'crtc' not described in 'omap_irq_enable_vblank'
>  drivers/gpu/drm/omapdrm/omap_irq.c:115: warning: Excess function parameter 
> 'dev' description in 'omap_irq_enable_vblank'
>  drivers/gpu/drm/omapdrm/omap_irq.c:115: warning: Excess function parameter 
> 'pipe' description in 'omap_irq_enable_vblank'
>  drivers/gpu/drm/omapdrm/omap_irq.c:142: warning: Function parameter or 
> member 'crtc' not described in 'omap_irq_disable_vblank'
>  drivers/gpu/drm/omapdrm/omap_irq.c:142: warning: Excess function parameter 
> 'dev' description in 'omap_irq_disable_vblank'
>  drivers/gpu/drm/omapdrm/omap_irq.c:142: warning: Excess function parameter 
> 'pipe' description in 'omap_irq_disable_vblank'
> 
> Cc: Tomi Valkeinen 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: Rob Clark 
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 
> ---
>  drivers/gpu/drm/omapdrm/omap_irq.c | 6 ++
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/omap_irq.c 
> b/drivers/gpu/drm/omapdrm/omap_irq.c
> index 382bcdc72ac06..8643871e23a83 100644
> --- a/drivers/gpu/drm/omapdrm/omap_irq.c
> +++ b/drivers/gpu/drm/omapdrm/omap_irq.c
> @@ -100,8 +100,7 @@ int omap_irq_enable_framedone(struct drm_crtc *crtc, bool 
> enable)
>  
>  /**
>   * enable_vblank - enable vblank interrupt events
> - * @dev: DRM device
> - * @pipe: which irq to enable
> + * @crtc: DRM CRTC
>   *
>   * Enable vblank interrupts for @crtc.  If the device doesn't have
>   * a hardware vblank counter, this routine should be a no-op, since
> @@ -131,8 +130,7 @@ int omap_irq_enable_vblank(struct drm_crtc *crtc)
>  
>  /**
>   * disable_vblank - disable vblank interrupt events
> - * @dev: DRM device
> - * @pipe: which irq to enable
> + * @crtc: DRM CRTC
>   *
>   * Disable vblank interrupts for @crtc.  If the device doesn't have
>   * a hardware vblank counter, this routine should be a no-op, since
> 

Hmm, I don't know why we have the doc texts there. These are omapdrm internal 
functions, and the
text sounds like it was copied from a framework function. I think we can drop 
the texts here.

But this patch is fine too, and I can drop the text later:

Reviewed-by: Tomi Valkeinen 

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 08/19] gpu: drm: omapdrm: dss: dsi: Rework and remove a few unused variables

2020-11-05 Thread Tomi Valkeinen
On 05/11/2020 16:45, Lee Jones wrote:
> Fixes the following W=1 kernel build warning(s):
> 
>  drivers/gpu/drm/omapdrm/dss/dsi.c: In function ‘_dsi_print_reset_status’:
>  drivers/gpu/drm/omapdrm/dss/dsi.c:1131:6: warning: variable ‘l’ set but not 
> used [-Wunused-but-set-variable]
>  drivers/gpu/drm/omapdrm/dss/dsi.c: In function ‘dsi_update’:
>  drivers/gpu/drm/omapdrm/dss/dsi.c:3943:10: warning: variable ‘dh’ set but 
> not used [-Wunused-but-set-variable]
>  drivers/gpu/drm/omapdrm/dss/dsi.c:3943:6: warning: variable ‘dw’ set but not 
> used [-Wunused-but-set-variable]
> 
> Cc: Tomi Valkeinen 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: Laurent Pinchart 
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 
> ---
>  drivers/gpu/drm/omapdrm/dss/dsi.c | 9 ++---
>  1 file changed, 2 insertions(+), 7 deletions(-)

I'd use "drm/omap: dsi: " subject prefix, the current one is fine too:

Reviewed-by: Tomi Valkeinen 

Should I pick this up or do you want to keep the series intact?

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v7 12/47] dt-bindings: memory: tegra124: mc: Document new interconnect property

2020-11-05 Thread Rob Herring
On Wed, 04 Nov 2020 19:48:48 +0300, Dmitry Osipenko wrote:
> Memory controller is interconnected with memory clients and with the
> External Memory Controller. Document new interconnect property which
> turns memory controller into interconnect provider.
> 
> Signed-off-by: Dmitry Osipenko 
> ---
>  .../bindings/memory-controllers/nvidia,tegra124-emc.yaml | 1 +
>  .../bindings/memory-controllers/nvidia,tegra124-mc.yaml  | 5 +
>  2 files changed, 6 insertions(+)
> 

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


Re: [PATCH v7 08/47] dt-bindings: memory: tegra20: emc: Document OPP table and voltage regulator

2020-11-05 Thread Rob Herring
On Wed, 04 Nov 2020 19:48:44 +0300, Dmitry Osipenko wrote:
> The SoC core voltage can't be changed without taking into account the
> clock rate of External Memory Controller. Document OPP table that will
> be used for dynamic voltage frequency scaling, taking into account EMC
> voltage requirement. Document optional core voltage regulator, which is
> optional because some boards may have a fixed core regulator and still
> frequency scaling may be desired to have.
> 
> Signed-off-by: Dmitry Osipenko 
> ---
>  .../memory-controllers/nvidia,tegra20-emc.txt| 16 
>  1 file changed, 16 insertions(+)
> 

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


Re: [PATCH v3 40/56] drm/panel: Move OMAP's DSI command mode panel driver

2020-11-05 Thread Tomi Valkeinen
On 05/11/2020 14:03, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> The panel driver is no longer using any OMAP specific APIs, so
> let's move it into the generic panel directory.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 
> Cc: Thierry Reding 
> Cc: Sam Ravnborg 
> ---
>  drivers/gpu/drm/omapdrm/Kconfig|  1 -
>  drivers/gpu/drm/omapdrm/Makefile   |  1 -
>  drivers/gpu/drm/omapdrm/displays/Kconfig   | 10 --
>  drivers/gpu/drm/omapdrm/displays/Makefile  |  2 --
>  drivers/gpu/drm/panel/Kconfig  |  9 +
>  drivers/gpu/drm/panel/Makefile |  1 +
>  .../gpu/drm/{omapdrm/displays => panel}/panel-dsi-cm.c |  0
>  7 files changed, 10 insertions(+), 14 deletions(-)
>  delete mode 100644 drivers/gpu/drm/omapdrm/displays/Kconfig
>  delete mode 100644 drivers/gpu/drm/omapdrm/displays/Makefile
>  rename drivers/gpu/drm/{omapdrm/displays => panel}/panel-dsi-cm.c (100%)

Just a note, I already have a few more cleanups for this driver. And I think we 
need to discuss how
to make this a properly generic DSI command mode driver, or should we just make 
this a driver for a
subset of drivers, used on OMAP platforms.

But I think that work is easier if the panel driver is in its proper place, as 
done in this patch.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/vc4: replace idr_init() by idr_init_base()

2020-11-05 Thread Eric Anholt
On Thu, Nov 5, 2020 at 10:25 AM Deepak R Varma  wrote:
>
> idr_init() uses base 0 which is an invalid identifier for this driver.
> The idr_alloc for this driver uses VC4_PERFMONID_MIN as start value for
> ID range and it is #defined to 1. The new function idr_init_base allows
> IDR to set the ID lookup from base 1. This avoids all lookups that
> otherwise starts from 0 since 0 is always unused / available.
>
> References: commit 6ce711f27500 ("idr: Make 1-based IDRs more efficient")
>
> Signed-off-by: Deepak R Varma 
> ---
>  drivers/gpu/drm/vc4/vc4_perfmon.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/vc4/vc4_perfmon.c 
> b/drivers/gpu/drm/vc4/vc4_perfmon.c
> index f4aa75efd16b..7d40f421d922 100644
> --- a/drivers/gpu/drm/vc4/vc4_perfmon.c
> +++ b/drivers/gpu/drm/vc4/vc4_perfmon.c
> @@ -77,7 +77,7 @@ struct vc4_perfmon *vc4_perfmon_find(struct vc4_file 
> *vc4file, int id)
>  void vc4_perfmon_open_file(struct vc4_file *vc4file)
>  {
> mutex_init(>perfmon.lock);
> -   idr_init(>perfmon.idr);
> +   idr_init_base(>perfmon.idr, 1);
>  }

Sounds like you should use VC4_PERFMONID_MIN instead of a magic 1 here.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 07/22] drm/msm: Do rpm get sooner in the submit path

2020-11-05 Thread Rob Clark
On Tue, Nov 3, 2020 at 7:04 PM Viresh Kumar  wrote:
>
> On 03-11-20, 08:50, Rob Clark wrote:
> > sorry, it didn't apply cleanly (which I guess is due to some other
> > dependencies that need to be picked back to v5.4 product kernel), and
> > due to some other things I'm in middle of debugging I didn't have time
> > yet to switch to v5.10-rc or look at what else needs to
> > cherry-picked..
> >
> > If you could, pushing a branch with this patch somewhere would be a
> > bit easier to work with (ie. fetch && cherry-pick is easier to deal
> > with than picking things from list)
>
> It has been in linux-next for a few days. Here is the HEAD to pick
> from. There are few patches there since rc1.
>
> commit 203e29749cc0 ("opp: Allocate the OPP table outside of opp_table_lock")
>

sorry for the delay, with that cherry-picked, I'm getting a whole lot of:

[   10.191497] WARNING: CPU: 7 PID: 52 at drivers/opp/of.c:115
_find_table_of_opp_np+0x8c/0x94
[   10.191502] Modules linked in:
[   10.191517] CPU: 7 PID: 52 Comm: kworker/7:1 Tainted: GW
 5.10.0-rc2+ #2
[   10.191522] Hardware name: Google Lazor (rev1+) with LTE (DT)
[   10.191537] Workqueue: events deferred_probe_work_func
[   10.191551] pstate: 60c9 (nZCv daif +PAN +UAO -TCO BTYPE=--)
[   10.202819] mmc0: CQHCI version 5.10
[   10.206038] pc : _find_table_of_opp_np+0x8c/0x94
[   10.206045] lr : _find_table_of_opp_np+0x34/0x94
[   10.206050] sp : ffc010373810
[   10.206054] x29: ffc010373810 x28: ff94c5a3d170
[   10.206070] x27: ff94c5a3d168
[   10.249098] mmc0: SDHCI controller on 7c4000.sdhci [7c4000.sdhci]
using ADMA 64-bit
[   10.251366] x26: ff94c580c000
[   10.251374] x25: 0001 x24: ff963f02c750
[   10.251385] x23:  x22: ff94c5aabc80
[   10.251397] x21: ff963f021c78 x20: ff94c5a75800
[   10.256963] sdhci_msm 7c4000.sdhci: mmc0: CQE init: success
[   10.260376]
[   10.260380] x19: ff963f02c750 x18: 0004
[   10.260392] x17: 002c x16: ffe2468e1e78
[   10.260404] x15: ffe246df3eb8 x14: 52f45308
[   10.311816] x13:  x12: ffe24541aef0
[   10.317298] x11: ffe246df3eb8 x10: fffefe60e678
[   10.322776] x9 :  x8 : ffb3f89a7000
[   10.328258] x7 : ffe245c5d9d0 x6 : 
[   10.333730] x5 : 0080 x4 : 0001
[   10.339206] x3 :  x2 : 0006
[   10.344684] x1 : ffe24684aa88 x0 : 
[   10.350158] Call trace:
[   10.352695]  _find_table_of_opp_np+0x8c/0x94
[   10.353507] mmc0: Command Queue Engine enabled
[   10.357095]  _of_init_opp_table+0x15c/0x1e4
[   10.357103]  _opp_get_opp_table+0x168/0x280
[   10.357110]  dev_pm_opp_set_clkname+0x28/0xcc
[   10.357119]  dpu_bind+0x50/0x1a4
[   10.357128]  component_bind_all+0xf4/0x20c
[   10.357138]  msm_drm_init+0x180/0x588
[   10.361815] mmc0: new HS400 Enhanced strobe MMC card at address 0001
[   10.366050]  msm_drm_bind+0x1c/0x24
[   10.366057]  try_to_bring_up_master+0x160/0x1a8
[   10.366065]  component_master_add_with_match+0xc4/0x108
[   10.366072]  msm_pdev_probe+0x214/0x2a4
[   10.366081]  platform_drv_probe+0x94/0xb4
[   10.374415] mmcblk0: mmc0:0001 DA4064 58.2 GiB
[   10.374871]  really_probe+0x138/0x348
[   10.374881]  driver_probe_device+0x80/0xb8
[   10.379483] mmcblk0boot0: mmc0:0001 DA4064 partition 1 4.00 MiB
[   10.382446]  __device_attach_driver+0x90/0xa8
[   10.382453]  bus_for_each_drv+0x84/0xcc
[   10.382459]  __device_attach+0xc0/0x148
[   10.382466]  device_initial_probe+0x18/0x20
[   10.382473]  bus_probe_device+0x38/0x98
[   10.382483]  deferred_probe_work_func+0x7c/0xb8
[   10.387402] mmcblk0boot1: mmc0:0001 DA4064 partition 2 4.00 MiB
[   10.392780]  process_one_work+0x314/0x60c
[   10.392786]  worker_thread+0x238/0x3e8
[   10.392793]  kthread+0x148/0x158
[   10.392800]  ret_from_fork+0x10/0x18
[   10.392809] CPU: 7 PID: 52 Comm: kworker/7:1 Tainted: GW
 5.10.0-rc2+ #2
[   10.397683] mmcblk0rpmb: mmc0:0001 DA4064 partition 3 16.0 MiB,
chardev (241:0)
[   10.401051] Hardware name: Google Lazor (rev1+) with LTE (DT)
[   10.401062] Workqueue: events deferred_probe_work_func
[   10.401069] Call trace:
[   10.401077]  dump_backtrace+0x0/0x1b4
[   10.401087]  show_stack+0x1c/0x24
[   10.427111]  mmcblk0: p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12
[   10.427156]  dump_stack+0xdc/0x158
[   10.427165]  __warn+0xd8/0x16c
[   10.427173]  report_bug+0x88/0xe0
[   10.427179]  bug_handler+0x24/0x6c
[   10.535574]  brk_handler+0x78/0xb4
[   10.539090]  do_debug_exception+0x1a4/0x208
[   10.543395]  el1_sync_handler+0x8c/0x110
[   10.547434]  el1_sync+0x7c/0x100
[   10.550762]  _find_table_of_opp_np+0x8c/0x94
[   10.555166]  _of_init_opp_table+0x15c/0x1e4
[   10.559472]  _opp_get_opp_table+0x168/0x280
[   10.563779]  dev_pm_opp_set_clkname+0x28/0xcc
[   10.568270]  dpu_bind+0x50/0x1a4
[   10.571607]  component_bind_all+0xf4/0x20c
[   10.575826]  

Re: [PATCH] drm/gma500: Fix out-of-bounds access to struct drm_device.vblank[]

2020-11-05 Thread Daniel Vetter
On Thu, Nov 05, 2020 at 08:02:56PM +0100, Thomas Zimmermann wrote:
> The gma500 driver expects 3 pipelines in several it's IRQ functions.
> Accessing struct drm_device.vblank[], this fails with devices that only
> have 2 pipelines. An example KASAN report is shown below.
> 
>   [   62.267688] 
> ==
>   [   62.268856] BUG: KASAN: slab-out-of-bounds in 
> psb_irq_postinstall+0x250/0x3c0 [gma500_gfx]
>   [   62.269450] Read of size 1 at addr 8880012bc6d0 by task 
> systemd-udevd/285
>   [   62.269949]
>   [   62.270192] CPU: 0 PID: 285 Comm: systemd-udevd Tainted: GE  
>5.10.0-rc1-1-default+ #572
>   [   62.270807] Hardware name:  /DN2800MT, BIOS 
> MTCDT10N.86A.0164.2012.1213.1024 12/13/2012
>   [   62.271366] Call Trace:
>   [   62.271705]  dump_stack+0xae/0xe5
>   [   62.272180]  print_address_description.constprop.0+0x17/0xf0
>   [   62.272987]  ? psb_irq_postinstall+0x250/0x3c0 [gma500_gfx]
>   [   62.273474]  __kasan_report.cold+0x20/0x38
>   [   62.273989]  ? psb_irq_postinstall+0x250/0x3c0 [gma500_gfx]
>   [   62.274460]  kasan_report+0x3a/0x50
>   [   62.274891]  psb_irq_postinstall+0x250/0x3c0 [gma500_gfx]
>   [   62.275380]  drm_irq_install+0x131/0x1f0
>   <...>
>   [   62.300751] Allocated by task 285:
>   [   62.301223]  kasan_save_stack+0x1b/0x40
>   [   62.301731]  __kasan_kmalloc.constprop.0+0xbf/0xd0
>   [   62.302293]  drmm_kmalloc+0x55/0x100
>   [   62.302773]  drm_vblank_init+0x77/0x210
> 
> Resolve the issue by only handling vblank entries up to the number of
> CRTCs.
> 
> I'm adding a Fixes tag for reference, although the bug has been present
> since the driver's initial commit.
> 
> Signed-off-by: Thomas Zimmermann 
> Fixes: 5c49fd3aa0ab ("gma500: Add the core DRM files and headers")
> Cc: Alan Cox 
> Cc: Dave Airlie 
> Cc: Patrik Jakobsson 
> Cc: dri-devel@lists.freedesktop.org
> Cc: sta...@vger.kernel.org#v3.3+

Reviewed-by: Daniel Vetter 

> ---
>  drivers/gpu/drm/gma500/psb_irq.c | 34 +++-
>  1 file changed, 12 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/gpu/drm/gma500/psb_irq.c 
> b/drivers/gpu/drm/gma500/psb_irq.c
> index 15eb3770d817..361e3a0c5ab6 100644
> --- a/drivers/gpu/drm/gma500/psb_irq.c
> +++ b/drivers/gpu/drm/gma500/psb_irq.c
> @@ -347,6 +347,7 @@ int psb_irq_postinstall(struct drm_device *dev)
>  {
>   struct drm_psb_private *dev_priv = dev->dev_private;
>   unsigned long irqflags;
> + unsigned int i;
>  
>   spin_lock_irqsave(_priv->irqmask_lock, irqflags);
>  
> @@ -359,20 +360,12 @@ int psb_irq_postinstall(struct drm_device *dev)
>   PSB_WVDC32(dev_priv->vdc_irq_mask, PSB_INT_ENABLE_R);
>   PSB_WVDC32(0x, PSB_HWSTAM);
>  
> - if (dev->vblank[0].enabled)
> - psb_enable_pipestat(dev_priv, 0, PIPE_VBLANK_INTERRUPT_ENABLE);
> - else
> - psb_disable_pipestat(dev_priv, 0, PIPE_VBLANK_INTERRUPT_ENABLE);
> -
> - if (dev->vblank[1].enabled)
> - psb_enable_pipestat(dev_priv, 1, PIPE_VBLANK_INTERRUPT_ENABLE);
> - else
> - psb_disable_pipestat(dev_priv, 1, PIPE_VBLANK_INTERRUPT_ENABLE);
> -
> - if (dev->vblank[2].enabled)
> - psb_enable_pipestat(dev_priv, 2, PIPE_VBLANK_INTERRUPT_ENABLE);
> - else
> - psb_disable_pipestat(dev_priv, 2, PIPE_VBLANK_INTERRUPT_ENABLE);
> + for (i = 0; i < dev->num_crtcs; ++i) {
> + if (dev->vblank[i].enabled)
> + psb_enable_pipestat(dev_priv, i, 
> PIPE_VBLANK_INTERRUPT_ENABLE);
> + else
> + psb_disable_pipestat(dev_priv, i, 
> PIPE_VBLANK_INTERRUPT_ENABLE);
> + }
>  
>   if (dev_priv->ops->hotplug_enable)
>   dev_priv->ops->hotplug_enable(dev, true);
> @@ -385,6 +378,7 @@ void psb_irq_uninstall(struct drm_device *dev)
>  {
>   struct drm_psb_private *dev_priv = dev->dev_private;
>   unsigned long irqflags;
> + unsigned int i;
>  
>   spin_lock_irqsave(_priv->irqmask_lock, irqflags);
>  
> @@ -393,14 +387,10 @@ void psb_irq_uninstall(struct drm_device *dev)
>  
>   PSB_WVDC32(0x, PSB_HWSTAM);
>  
> - if (dev->vblank[0].enabled)
> - psb_disable_pipestat(dev_priv, 0, PIPE_VBLANK_INTERRUPT_ENABLE);
> -
> - if (dev->vblank[1].enabled)
> - psb_disable_pipestat(dev_priv, 1, PIPE_VBLANK_INTERRUPT_ENABLE);
> -
> - if (dev->vblank[2].enabled)
> - psb_disable_pipestat(dev_priv, 2, PIPE_VBLANK_INTERRUPT_ENABLE);
> + for (i = 0; i < dev->num_crtcs; ++i) {
> + if (dev->vblank[i].enabled)
> + psb_disable_pipestat(dev_priv, i, 
> PIPE_VBLANK_INTERRUPT_ENABLE);
> + }
>  
>   dev_priv->vdc_irq_mask &= _PSB_IRQ_SGX_FLAG |
> _PSB_IRQ_MSVDX_FLAG |
> -- 
> 2.29.0
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

Re: [PATCH] drm: remove pgprot_decrypted() before calls to io_remap_pfn_range()

2020-11-05 Thread Daniel Vetter
On Thu, Nov 05, 2020 at 01:00:19PM -0400, Jason Gunthorpe wrote:
> commit f8f6ae5d077a ("mm: always have io_remap_pfn_range() set
> pgprot_decrypted()") moves the pgprot_decrypted() into
> io_remap_pfn_range(). Delete any, now confusing, open coded calls that
> directly precede io_remap_pfn_range():
> 
> - drm_io_prot() is only in drm_mmap_locked() to call io_remap_pfn_range()
> 
> - fb_mmap() immediately calls vm_iomap_memory() which is a convenience
>   wrapper for io_remap_pfn_range()
> 
> Signed-off-by: Jason Gunthorpe 
> ---
>  drivers/gpu/drm/drm_vm.c | 3 ---
>  drivers/video/fbdev/core/fbmem.c | 5 -
>  2 files changed, 8 deletions(-)
> 
> rc3 will have the dependent patch, this should not be merged to DRM until it
> has the rc3 commits.
> 
> There are three other pgprot_decrypted() calls in DRM, I could not figure out
> what was what there, but other than very special cases I would expect code to
> use io_remap_pfn_range() instead.

There's 4 now, I think linux-next added one. It's another io_remap_pfn

Of the three you mentioned we have:
- ttm and i915 use vm_insert_pfn (and ttm also can do also do pud_mkhuge
  entries)
- drm_gem is for all other drivers, some also use vm_insert_pfn, the
  others I think use dma_mmap_* and friends, which I think underneath
  boild down to io_remap_pfn. Or at least should be taking care of this
  already.

I'll try and remember to merge this after -rc3. Yell if it's not in by
-rc4 please.
-Daniel

> 
> diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c
> index 1a636963378947..6d5a03b3223800 100644
> --- a/drivers/gpu/drm/drm_vm.c
> +++ b/drivers/gpu/drm/drm_vm.c
> @@ -70,9 +70,6 @@ static pgprot_t drm_io_prot(struct drm_local_map *map,
>  {
>   pgprot_t tmp = vm_get_page_prot(vma->vm_flags);
>  
> - /* We don't want graphics memory to be mapped encrypted */
> - tmp = pgprot_decrypted(tmp);
> -
>  #if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || \
>  defined(__mips__)
>   if (map->type == _DRM_REGISTERS && !(map->flags & _DRM_WRITE_COMBINING))
> diff --git a/drivers/video/fbdev/core/fbmem.c 
> b/drivers/video/fbdev/core/fbmem.c
> index 8268bbee8cae11..63a27a67a05cfa 100644
> --- a/drivers/video/fbdev/core/fbmem.c
> +++ b/drivers/video/fbdev/core/fbmem.c
> @@ -1386,11 +1386,6 @@ fb_mmap(struct file *file, struct vm_area_struct * vma)
>   mutex_unlock(>mm_lock);
>  
>   vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
> - /*
> -  * The framebuffer needs to be accessed decrypted, be sure
> -  * SME protection is removed
> -  */
> - vma->vm_page_prot = pgprot_decrypted(vma->vm_page_prot);
>   fb_pgprotect(file, vma, start);
>  
>   return vm_iomap_memory(vma, start, len);
> -- 
> 2.29.2
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2] drm: Use state helper instead of CRTC state pointer

2020-11-05 Thread Thomas Zimmermann
Hi

Am 05.11.20 um 17:45 schrieb Maxime Ripard:
> Many drivers reference the crtc->pointer in order to get the current CRTC
> state in their atomic_begin or atomic_flush hooks, which would be the new
> CRTC state in the global atomic state since _swap_state happened when those
> hooks are run.
> 
> Use the drm_atomic_get_new_crtc_state helper to get that state to make it
> more obvious.
> 
> This was made using the coccinelle script below:
> 
> @ crtc_atomic_func @
> identifier helpers;
> identifier func;
> @@
> 
> (
> static struct drm_crtc_helper_funcs helpers = {
>   ...,
>   .atomic_begin = func,
>   ...,
> };
> |
> static struct drm_crtc_helper_funcs helpers = {
>   ...,
>   .atomic_flush = func,
>   ...,
> };
> )
> 
> @@
> identifier crtc_atomic_func.func;
> identifier crtc, state;
> symbol crtc_state;
> expression e;
> @@
> 
>   func(struct drm_crtc *crtc, struct drm_atomic_state *state) {
>   ...
> - struct tegra_dc_state *crtc_state = e;
> + struct tegra_dc_state *dc_state = e;
>   <+...
> -   crtc_state
> + dc_state
>   ...+>
>   }
> 
> @@
> identifier crtc_atomic_func.func;
> identifier crtc, state;
> symbol crtc_state;
> expression e;
> @@
> 
>   func(struct drm_crtc *crtc, struct drm_atomic_state *state) {
>   ...
> - struct mtk_crtc_state *crtc_state = e;
> + struct mtk_crtc_state *mtk_crtc_state = e;
>   <+...
> -   crtc_state
> + mtk_crtc_state
>   ...+>
>   }
> 
> @ replaces_new_state @
> identifier crtc_atomic_func.func;
> identifier crtc, state, crtc_state;
> @@
> 
>   func(struct drm_crtc *crtc, struct drm_atomic_state *state) {
>   ...
> - struct drm_crtc_state *crtc_state = crtc->state;
> + struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, 
> crtc);
>   ...
>  }
> 
> @@
> identifier crtc_atomic_func.func;
> identifier crtc, state, crtc_state;
> @@
> 
>   func(struct drm_crtc *crtc, struct drm_atomic_state *state) {
>   struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, 
> crtc);
>   ...
> - crtc->state
> + crtc_state
>   ...
>  }
> 
> @ adds_new_state @
> identifier crtc_atomic_func.func;
> identifier crtc, state;
> @@
> 
>   func(struct drm_crtc *crtc, struct drm_atomic_state *state) {
> + struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, 
> crtc);
>   ...
> - crtc->state
> + crtc_state
>   ...
>  }
> 
> @ include depends on adds_new_state || replaces_new_state @
> @@
> 
>  #include 
> 
> @ no_include depends on !include && (adds_new_state || replaces_new_state) @
> @@
> 
> + #include 
>   #include 
> 
> Cc: "James (Qian) Wang" 
> Cc: Liviu Dudau 
> Cc: Mihail Atanassov 
> Cc: Brian Starkey 
> Cc: Russell King 
> Cc: Paul Cercueil 
> Cc: Chun-Kuang Hu 
> Cc: Philipp Zabel 
> Cc: Sandy Huang 
> Cc: "Heiko Stübner" 
> Cc: Thierry Reding 
> Cc: Gerd Hoffmann 
> Reviewed-by: Ville Syrjälä 
> Suggested-by: Ville Syrjälä 
> Signed-off-by: Maxime Ripard 
Acked-by: Thomas Zimmermann 

> 
> ---
> 
> Changes from v1:
>   - Fixed checkpatch warnings
> ---
>  drivers/gpu/drm/arm/display/komeda/komeda_crtc.c |  4 +++-
>  drivers/gpu/drm/armada/armada_crtc.c |  8 ++--
>  drivers/gpu/drm/ast/ast_mode.c   |  4 +++-
>  drivers/gpu/drm/ingenic/ingenic-drm-drv.c|  7 +--
>  drivers/gpu/drm/mediatek/mtk_drm_crtc.c  | 15 +--
>  drivers/gpu/drm/rockchip/rockchip_drm_vop.c  |  6 --
>  drivers/gpu/drm/tegra/dc.c   |  8 +---
>  drivers/gpu/drm/virtio/virtgpu_display.c |  4 +++-
>  8 files changed, 38 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c 
> b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c
> index df0b9eeb8933..4b485eb512e2 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c
> @@ -387,10 +387,12 @@ static void
>  komeda_crtc_atomic_flush(struct drm_crtc *crtc,
>struct drm_atomic_state *state)
>  {
> + struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state,
> +   crtc);
>   struct drm_crtc_state *old = drm_atomic_get_old_crtc_state(state,
>  crtc);
>   /* commit with modeset will be handled in enable/disable */
> - if (drm_atomic_crtc_needs_modeset(crtc->state))
> + if (drm_atomic_crtc_needs_modeset(crtc_state))
>   return;
>  
>   komeda_crtc_do_flush(crtc, old);
> diff --git a/drivers/gpu/drm/armada/armada_crtc.c 
> b/drivers/gpu/drm/armada/armada_crtc.c
> index ca643f4e2064..3ebcf5a52c8b 100644
> --- a/drivers/gpu/drm/armada/armada_crtc.c
> +++ b/drivers/gpu/drm/armada/armada_crtc.c
> @@ -431,11 +431,13 @@ static int armada_drm_crtc_atomic_check(struct drm_crtc 
> *crtc,
>  static void armada_drm_crtc_atomic_begin(struct drm_crtc *crtc,
> 

[PATCH] drm/gma500: Fix out-of-bounds access to struct drm_device.vblank[]

2020-11-05 Thread Thomas Zimmermann
The gma500 driver expects 3 pipelines in several it's IRQ functions.
Accessing struct drm_device.vblank[], this fails with devices that only
have 2 pipelines. An example KASAN report is shown below.

  [   62.267688] 
==
  [   62.268856] BUG: KASAN: slab-out-of-bounds in 
psb_irq_postinstall+0x250/0x3c0 [gma500_gfx]
  [   62.269450] Read of size 1 at addr 8880012bc6d0 by task 
systemd-udevd/285
  [   62.269949]
  [   62.270192] CPU: 0 PID: 285 Comm: systemd-udevd Tainted: GE
 5.10.0-rc1-1-default+ #572
  [   62.270807] Hardware name:  /DN2800MT, BIOS 
MTCDT10N.86A.0164.2012.1213.1024 12/13/2012
  [   62.271366] Call Trace:
  [   62.271705]  dump_stack+0xae/0xe5
  [   62.272180]  print_address_description.constprop.0+0x17/0xf0
  [   62.272987]  ? psb_irq_postinstall+0x250/0x3c0 [gma500_gfx]
  [   62.273474]  __kasan_report.cold+0x20/0x38
  [   62.273989]  ? psb_irq_postinstall+0x250/0x3c0 [gma500_gfx]
  [   62.274460]  kasan_report+0x3a/0x50
  [   62.274891]  psb_irq_postinstall+0x250/0x3c0 [gma500_gfx]
  [   62.275380]  drm_irq_install+0x131/0x1f0
  <...>
  [   62.300751] Allocated by task 285:
  [   62.301223]  kasan_save_stack+0x1b/0x40
  [   62.301731]  __kasan_kmalloc.constprop.0+0xbf/0xd0
  [   62.302293]  drmm_kmalloc+0x55/0x100
  [   62.302773]  drm_vblank_init+0x77/0x210

Resolve the issue by only handling vblank entries up to the number of
CRTCs.

I'm adding a Fixes tag for reference, although the bug has been present
since the driver's initial commit.

Signed-off-by: Thomas Zimmermann 
Fixes: 5c49fd3aa0ab ("gma500: Add the core DRM files and headers")
Cc: Alan Cox 
Cc: Dave Airlie 
Cc: Patrik Jakobsson 
Cc: dri-devel@lists.freedesktop.org
Cc: sta...@vger.kernel.org#v3.3+
---
 drivers/gpu/drm/gma500/psb_irq.c | 34 +++-
 1 file changed, 12 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/gma500/psb_irq.c b/drivers/gpu/drm/gma500/psb_irq.c
index 15eb3770d817..361e3a0c5ab6 100644
--- a/drivers/gpu/drm/gma500/psb_irq.c
+++ b/drivers/gpu/drm/gma500/psb_irq.c
@@ -347,6 +347,7 @@ int psb_irq_postinstall(struct drm_device *dev)
 {
struct drm_psb_private *dev_priv = dev->dev_private;
unsigned long irqflags;
+   unsigned int i;
 
spin_lock_irqsave(_priv->irqmask_lock, irqflags);
 
@@ -359,20 +360,12 @@ int psb_irq_postinstall(struct drm_device *dev)
PSB_WVDC32(dev_priv->vdc_irq_mask, PSB_INT_ENABLE_R);
PSB_WVDC32(0x, PSB_HWSTAM);
 
-   if (dev->vblank[0].enabled)
-   psb_enable_pipestat(dev_priv, 0, PIPE_VBLANK_INTERRUPT_ENABLE);
-   else
-   psb_disable_pipestat(dev_priv, 0, PIPE_VBLANK_INTERRUPT_ENABLE);
-
-   if (dev->vblank[1].enabled)
-   psb_enable_pipestat(dev_priv, 1, PIPE_VBLANK_INTERRUPT_ENABLE);
-   else
-   psb_disable_pipestat(dev_priv, 1, PIPE_VBLANK_INTERRUPT_ENABLE);
-
-   if (dev->vblank[2].enabled)
-   psb_enable_pipestat(dev_priv, 2, PIPE_VBLANK_INTERRUPT_ENABLE);
-   else
-   psb_disable_pipestat(dev_priv, 2, PIPE_VBLANK_INTERRUPT_ENABLE);
+   for (i = 0; i < dev->num_crtcs; ++i) {
+   if (dev->vblank[i].enabled)
+   psb_enable_pipestat(dev_priv, i, 
PIPE_VBLANK_INTERRUPT_ENABLE);
+   else
+   psb_disable_pipestat(dev_priv, i, 
PIPE_VBLANK_INTERRUPT_ENABLE);
+   }
 
if (dev_priv->ops->hotplug_enable)
dev_priv->ops->hotplug_enable(dev, true);
@@ -385,6 +378,7 @@ void psb_irq_uninstall(struct drm_device *dev)
 {
struct drm_psb_private *dev_priv = dev->dev_private;
unsigned long irqflags;
+   unsigned int i;
 
spin_lock_irqsave(_priv->irqmask_lock, irqflags);
 
@@ -393,14 +387,10 @@ void psb_irq_uninstall(struct drm_device *dev)
 
PSB_WVDC32(0x, PSB_HWSTAM);
 
-   if (dev->vblank[0].enabled)
-   psb_disable_pipestat(dev_priv, 0, PIPE_VBLANK_INTERRUPT_ENABLE);
-
-   if (dev->vblank[1].enabled)
-   psb_disable_pipestat(dev_priv, 1, PIPE_VBLANK_INTERRUPT_ENABLE);
-
-   if (dev->vblank[2].enabled)
-   psb_disable_pipestat(dev_priv, 2, PIPE_VBLANK_INTERRUPT_ENABLE);
+   for (i = 0; i < dev->num_crtcs; ++i) {
+   if (dev->vblank[i].enabled)
+   psb_disable_pipestat(dev_priv, i, 
PIPE_VBLANK_INTERRUPT_ENABLE);
+   }
 
dev_priv->vdc_irq_mask &= _PSB_IRQ_SGX_FLAG |
  _PSB_IRQ_MSVDX_FLAG |
-- 
2.29.0

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


Re: [PATCH v13 0/7] Add support for KeemBay DRM drive

2020-11-05 Thread Sam Ravnborg
Hi Anitha.

On Wed, Nov 04, 2020 at 05:15:24PM -0800, Anitha Chrisanthus wrote:
> 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 reference 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.

Thanks for all you tiresome work dealing with the feedback from the
community and me and thank you for the cooperation so far.

You have managed to convert this display driver from something based on
a wrong abstraction to a driver that not only are using the latest DRM
infrastructure but also now have the correct structure and correct
bindings.

There are still things we can improve - but rather than doing it
alone we are better served with the driver applied to drm-misc-next
so we are more that can help and maybe even contribute.

Patches applied to drm-misc-next.

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


Re: [PATCH 00/19] [Set 1] Rid W=1 warnings from GPU

2020-11-05 Thread Lee Jones
On Thu, 05 Nov 2020, Daniel Vetter wrote:

> On Thu, Nov 5, 2020 at 7:10 PM Lee Jones  wrote:
> >
> > On Thu, 05 Nov 2020, Thierry Reding wrote:
> >
> > > On Thu, Nov 05, 2020 at 02:44:58PM +, Lee Jones wrote:
> > > > This set is part of a larger effort attempting to clean-up W=1
> > > > kernel builds, which are currently overwhelmingly riddled with
> > > > niggly little warnings.
> > > >
> > > > There are 5000 warnings to work through.
> > > >
> > > > It will take a couple more sets.
> > > >
> > > > Lee Jones (19):
> > > >   gpu: host1x: bus: Add missing description for 'driver'
> > > >   gpu: ipu-v3: ipu-di: Strip out 2 unused 'di_sync_config' entries
> > > >   gpu: drm: imx: ipuv3-plane: Mark 'crtc_state' as __always_unused
> > > >   gpu: drm: omapdrm: omap_irq: Fix a couple of doc-rot issues
> > > >   gpu: drm: selftests: test-drm_mm: Mark 'hole_end' as always_unused
> > > >   gpu: drm: scheduler: sched_main: Provide missing description for
> > > > 'sched' paramter
> > > >   gpu: drm: scheduler: sched_entity: Demote non-conformant kernel-doc
> > > > headers
> > > >   gpu: drm: omapdrm: dss: dsi: Rework and remove a few unused variables
> > > >   gpu: drm: selftests: test-drm_framebuffer: Remove set but unused
> > > > variable 'fb'
> > > >   gpu: drm: ttm: ttm_bo: Fix one function header - demote lots of
> > > > kernel-doc abuses
> > > >   gpu: drm: panel: panel-simple: Fix 'struct panel_desc's header
> > > >   gpu: drm: bridge: analogix: analogix_dp_reg: Remove unused function
> > > > 'analogix_dp_write_byte_to_dpcd'
> > > >   gpu: drm: ttm: ttm_tt: Demote kernel-doc header format abuses
> > > >   gpu: drm: selftests: test-drm_dp_mst_helper: Place 'struct
> > > > drm_dp_sideband_msg_req_body' onto the heap
> > > >   gpu: drm: radeon: radeon_drv: Remove unused variable 'ret'
> > > >   gpu: drm: panel: panel-ilitek-ili9322: Demote non-conformant
> > > > kernel-doc header
> > > >   gpu: drm: radeon: radeon_device: Fix a bunch of kernel-doc
> > > > misdemeanours
> > > >   gpu: drm: amd: amdgpu: amdgpu: Mark global variables as __maybe_unused
> > > >   gpu: drm: bridge: analogix: analogix_dp_reg: Remove unused function
> > > > 'analogix_dp_start_aux_transaction'
> > >
> > > As commented on the other patches, the subject prefixes on most of these
> > > look wrong, but it's generally a nice cleanup.
> >
> > The prefixes are automated.  I'll add this to my list of awkward
> > subsystems and go through them all manually again tomorrow. :D
> 
> tbh for autmoation they look really good :-)

Only the prefixes are automated unfortunately. :)

> I'd say if you replace the intermediate ": " with just a / you'll be
> perfectly in style for drivers/gpu. But really I think it's ok as-is,

It's up to you.  Make the call and I'll abide.

> imo no need to change since this is a giantic tree wide effort.

Yes, you're not kidding, and thanks for noticing.

Only 10,000 (from 18,000) more to go though. :D

GPU is a biggy (5,000), although one patch in [Set 2] fixes 2,000 in
one hit, which is great!  I'll probably submit that tomorrow.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 00/19] [Set 1] Rid W=1 warnings from GPU

2020-11-05 Thread Daniel Vetter
On Thu, Nov 5, 2020 at 7:10 PM Lee Jones  wrote:
>
> On Thu, 05 Nov 2020, Thierry Reding wrote:
>
> > On Thu, Nov 05, 2020 at 02:44:58PM +, Lee Jones wrote:
> > > This set is part of a larger effort attempting to clean-up W=1
> > > kernel builds, which are currently overwhelmingly riddled with
> > > niggly little warnings.
> > >
> > > There are 5000 warnings to work through.
> > >
> > > It will take a couple more sets.
> > >
> > > Lee Jones (19):
> > >   gpu: host1x: bus: Add missing description for 'driver'
> > >   gpu: ipu-v3: ipu-di: Strip out 2 unused 'di_sync_config' entries
> > >   gpu: drm: imx: ipuv3-plane: Mark 'crtc_state' as __always_unused
> > >   gpu: drm: omapdrm: omap_irq: Fix a couple of doc-rot issues
> > >   gpu: drm: selftests: test-drm_mm: Mark 'hole_end' as always_unused
> > >   gpu: drm: scheduler: sched_main: Provide missing description for
> > > 'sched' paramter
> > >   gpu: drm: scheduler: sched_entity: Demote non-conformant kernel-doc
> > > headers
> > >   gpu: drm: omapdrm: dss: dsi: Rework and remove a few unused variables
> > >   gpu: drm: selftests: test-drm_framebuffer: Remove set but unused
> > > variable 'fb'
> > >   gpu: drm: ttm: ttm_bo: Fix one function header - demote lots of
> > > kernel-doc abuses
> > >   gpu: drm: panel: panel-simple: Fix 'struct panel_desc's header
> > >   gpu: drm: bridge: analogix: analogix_dp_reg: Remove unused function
> > > 'analogix_dp_write_byte_to_dpcd'
> > >   gpu: drm: ttm: ttm_tt: Demote kernel-doc header format abuses
> > >   gpu: drm: selftests: test-drm_dp_mst_helper: Place 'struct
> > > drm_dp_sideband_msg_req_body' onto the heap
> > >   gpu: drm: radeon: radeon_drv: Remove unused variable 'ret'
> > >   gpu: drm: panel: panel-ilitek-ili9322: Demote non-conformant
> > > kernel-doc header
> > >   gpu: drm: radeon: radeon_device: Fix a bunch of kernel-doc
> > > misdemeanours
> > >   gpu: drm: amd: amdgpu: amdgpu: Mark global variables as __maybe_unused
> > >   gpu: drm: bridge: analogix: analogix_dp_reg: Remove unused function
> > > 'analogix_dp_start_aux_transaction'
> >
> > As commented on the other patches, the subject prefixes on most of these
> > look wrong, but it's generally a nice cleanup.
>
> The prefixes are automated.  I'll add this to my list of awkward
> subsystems and go through them all manually again tomorrow. :D

tbh for autmoation they look really good :-)

I'd say if you replace the intermediate ": " with just a / you'll be
perfectly in style for drivers/gpu. But really I think it's ok as-is,
imo no need to change since this is a giantic tree wide effort.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 00/19] [Set 1] Rid W=1 warnings from GPU

2020-11-05 Thread Lee Jones
On Thu, 05 Nov 2020, Sam Ravnborg wrote:

> Hi Lee.
> 
> On Thu, Nov 05, 2020 at 02:44:58PM +, Lee Jones wrote:
> > This set is part of a larger effort attempting to clean-up W=1
> > kernel builds, which are currently overwhelmingly riddled with
> > niggly little warnings.
> 
> Thanks for looking into this.
> 
> > There are 5000 warnings to work through.
> > 
> > It will take a couple more sets.
> :-)
> 
> >   gpu: drm: panel: panel-simple: Fix 'struct panel_desc's header
> I have a patch here that inline the comments - and fix the warning as a
> side effect. I will get it posted tonight as this is better.
> 
> >   gpu: drm: bridge: analogix: analogix_dp_reg: Remove unused function
> > 'analogix_dp_write_byte_to_dpcd'
> When I looked at his I had another unused function after removing the
> first.
> 
> >   gpu: drm: panel: panel-ilitek-ili9322: Demote non-conformant
> > kernel-doc header
> Agree on this simple approch, will apply.
> 
> >   gpu: drm: bridge: analogix: analogix_dp_reg: Remove unused function
> > 'analogix_dp_start_aux_transaction'
> OK, this was the one I referred to above. They should be squashed into
> one patch.

I can squash them if you prefer.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 00/19] [Set 1] Rid W=1 warnings from GPU

2020-11-05 Thread Lee Jones
On Thu, 05 Nov 2020, Thierry Reding wrote:

> On Thu, Nov 05, 2020 at 02:44:58PM +, Lee Jones wrote:
> > This set is part of a larger effort attempting to clean-up W=1
> > kernel builds, which are currently overwhelmingly riddled with
> > niggly little warnings.
> > 
> > There are 5000 warnings to work through.
> > 
> > It will take a couple more sets.
> > 
> > Lee Jones (19):
> >   gpu: host1x: bus: Add missing description for 'driver'
> >   gpu: ipu-v3: ipu-di: Strip out 2 unused 'di_sync_config' entries
> >   gpu: drm: imx: ipuv3-plane: Mark 'crtc_state' as __always_unused
> >   gpu: drm: omapdrm: omap_irq: Fix a couple of doc-rot issues
> >   gpu: drm: selftests: test-drm_mm: Mark 'hole_end' as always_unused
> >   gpu: drm: scheduler: sched_main: Provide missing description for
> > 'sched' paramter
> >   gpu: drm: scheduler: sched_entity: Demote non-conformant kernel-doc
> > headers
> >   gpu: drm: omapdrm: dss: dsi: Rework and remove a few unused variables
> >   gpu: drm: selftests: test-drm_framebuffer: Remove set but unused
> > variable 'fb'
> >   gpu: drm: ttm: ttm_bo: Fix one function header - demote lots of
> > kernel-doc abuses
> >   gpu: drm: panel: panel-simple: Fix 'struct panel_desc's header
> >   gpu: drm: bridge: analogix: analogix_dp_reg: Remove unused function
> > 'analogix_dp_write_byte_to_dpcd'
> >   gpu: drm: ttm: ttm_tt: Demote kernel-doc header format abuses
> >   gpu: drm: selftests: test-drm_dp_mst_helper: Place 'struct
> > drm_dp_sideband_msg_req_body' onto the heap
> >   gpu: drm: radeon: radeon_drv: Remove unused variable 'ret'
> >   gpu: drm: panel: panel-ilitek-ili9322: Demote non-conformant
> > kernel-doc header
> >   gpu: drm: radeon: radeon_device: Fix a bunch of kernel-doc
> > misdemeanours
> >   gpu: drm: amd: amdgpu: amdgpu: Mark global variables as __maybe_unused
> >   gpu: drm: bridge: analogix: analogix_dp_reg: Remove unused function
> > 'analogix_dp_start_aux_transaction'
> 
> As commented on the other patches, the subject prefixes on most of these
> look wrong, but it's generally a nice cleanup.

The prefixes are automated.  I'll add this to my list of awkward
subsystems and go through them all manually again tomorrow. :D

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 08/19] gpu: drm: omapdrm: dss: dsi: Rework and remove a few unused variables

2020-11-05 Thread Lee Jones
On Thu, 05 Nov 2020, Tomi Valkeinen wrote:

> On 05/11/2020 16:45, Lee Jones wrote:
> > Fixes the following W=1 kernel build warning(s):
> > 
> >  drivers/gpu/drm/omapdrm/dss/dsi.c: In function ‘_dsi_print_reset_status’:
> >  drivers/gpu/drm/omapdrm/dss/dsi.c:1131:6: warning: variable ‘l’ set but 
> > not used [-Wunused-but-set-variable]
> >  drivers/gpu/drm/omapdrm/dss/dsi.c: In function ‘dsi_update’:
> >  drivers/gpu/drm/omapdrm/dss/dsi.c:3943:10: warning: variable ‘dh’ set but 
> > not used [-Wunused-but-set-variable]
> >  drivers/gpu/drm/omapdrm/dss/dsi.c:3943:6: warning: variable ‘dw’ set but 
> > not used [-Wunused-but-set-variable]
> > 
> > Cc: Tomi Valkeinen 
> > Cc: David Airlie 
> > Cc: Daniel Vetter 
> > Cc: Laurent Pinchart 
> > Cc: dri-devel@lists.freedesktop.org
> > Signed-off-by: Lee Jones 
> > ---
> >  drivers/gpu/drm/omapdrm/dss/dsi.c | 9 ++---
> >  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> I'd use "drm/omap: dsi: " subject prefix, the current one is fine too:
> 
> Reviewed-by: Tomi Valkeinen 
> 
> Should I pick this up or do you want to keep the series intact?

If you are in a position to take it, please do so.

I rebase every day, so it will just vanish from my working set.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm: Pass the full state to connectors atomic functions

2020-11-05 Thread Harry Wentland

On 2020-11-05 12:30 p.m., Maxime Ripard wrote:

The current atomic helpers have either their object state being passed as
an argument or the full atomic state.

The former is the pattern that was done at first, before switching to the
latter for new hooks or when it was needed.

Now that the CRTCs have been converted, let's move forward with the
connectors to provide a consistent interface.

The conversion was done using the coccinelle script below, and built tested
on all the drivers.



Did you forget the coccinelle script?


Cc: Harry Wentland 
Cc: Leo Li 
Cc: Alex Deucher 
Cc: "Christian König" 
Cc: Jani Nikula 
Cc: Joonas Lahtinen 
Cc: Rodrigo Vivi 
Cc: Ben Skeggs 
Cc: Rodrigo Siqueira 
Cc: Melissa Wen 
Cc: Haneen Mohammed 
Signed-off-by: Maxime Ripard 


Mainly for the amdgpu portion this is:
Acked-by: Harry Wentland 

Harry


---
  .../drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c |  5 -
  drivers/gpu/drm/drm_atomic_helper.c |  8 
  drivers/gpu/drm/i915/display/intel_dp_mst.c |  7 +--
  drivers/gpu/drm/nouveau/dispnv50/disp.c |  5 -
  drivers/gpu/drm/vc4/vc4_txp.c   |  4 +++-
  drivers/gpu/drm/vkms/vkms_writeback.c   |  7 +--
  include/drm/drm_modeset_helper_vtables.h| 13 ++---
  7 files changed, 31 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
index eee19ed5..f346cc74387f 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
@@ -24,6 +24,7 @@
   */
  
  #include 

+#include 
  #include 
  #include 
  #include 
@@ -252,8 +253,10 @@ static int dm_dp_mst_get_modes(struct drm_connector 
*connector)
  
  static struct drm_encoder *

  dm_mst_atomic_best_encoder(struct drm_connector *connector,
-  struct drm_connector_state *connector_state)
+  struct drm_atomic_state *state)
  {
+   struct drm_connector_state *connector_state = 
drm_atomic_get_new_connector_state(state,
+   
 connector);
struct drm_device *dev = connector->dev;
struct amdgpu_device *adev = drm_to_adev(dev);
struct amdgpu_crtc *acrtc = to_amdgpu_crtc(connector_state->crtc);
diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
b/drivers/gpu/drm/drm_atomic_helper.c
index ddd0e3239150..ba1507036f26 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -122,7 +122,8 @@ static int handle_conflicting_encoders(struct 
drm_atomic_state *state,
continue;
  
  		if (funcs->atomic_best_encoder)

-   new_encoder = funcs->atomic_best_encoder(connector, 
new_conn_state);
+   new_encoder = funcs->atomic_best_encoder(connector,
+state);
else if (funcs->best_encoder)
new_encoder = funcs->best_encoder(connector);
else
@@ -345,8 +346,7 @@ update_connector_routing(struct drm_atomic_state *state,
funcs = connector->helper_private;
  
  	if (funcs->atomic_best_encoder)

-   new_encoder = funcs->atomic_best_encoder(connector,
-new_connector_state);
+   new_encoder = funcs->atomic_best_encoder(connector, state);
else if (funcs->best_encoder)
new_encoder = funcs->best_encoder(connector);
else
@@ -1313,7 +1313,7 @@ static void drm_atomic_helper_commit_writebacks(struct 
drm_device *dev,
  
  		if (new_conn_state->writeback_job && new_conn_state->writeback_job->fb) {

WARN_ON(connector->connector_type != 
DRM_MODE_CONNECTOR_WRITEBACK);
-   funcs->atomic_commit(connector, new_conn_state);
+   funcs->atomic_commit(connector, old_state);
}
}
  }
diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c 
b/drivers/gpu/drm/i915/display/intel_dp_mst.c
index 64d885539e94..b879a0622ada 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c
@@ -23,6 +23,7 @@
   *
   */
  
+#include 

  #include 
  #include 
  #include 
@@ -706,11 +707,13 @@ intel_dp_mst_mode_valid_ctx(struct drm_connector 
*connector,
  }
  
  static struct drm_encoder *intel_mst_atomic_best_encoder(struct drm_connector *connector,

-struct 
drm_connector_state *state)
+struct 
drm_atomic_state *state)
  {
+   struct drm_connector_state *connector_state = 
drm_atomic_get_new_connector_state(state,
+   

[PULL] drm-intel-fixes

2020-11-05 Thread Rodrigo Vivi
Hi Dave and Daniel,

This includes gvt-fixes that had come last week, now with clean tags
for dim.

Also, 306bb61d6bb3 ("drm/i915/gt: Expose more parameters for emitting writes 
into the ring") is only a dependency of its following patch.

In summary:

drm-intel-fixes-2020-11-05:
- GVT fixes including vGPU suspend/resume fixes and workaround for APL guest 
GPU hang.
- Fix set domain's cache coherency (Chris)
- Fixes around breadcrumbs (Chris)
- Fix encoder lookup during PSR atomic (Imre)
- Hold onto an explicit ref to i915_vma_work.pinned (Chris)

Thanks,
Rodrigo.

The following changes since commit 3cea11cd5e3b00d91caf0b4730194039b45c5891:

  Linux 5.10-rc2 (2020-11-01 14:43:51 -0800)

are available in the Git repository at:

  git://anongit.freedesktop.org/drm/drm-intel tags/drm-intel-fixes-2020-11-05

for you to fetch changes up to 537457a979a02a410b555fab289dcb28b588f33b:

  drm/i915: Hold onto an explicit ref to i915_vma_work.pinned (2020-11-03 
19:22:42 -0500)


- GVT fixes including vGPU suspend/resume fixes and workaround for APL guest 
GPU hang.
- Fix set domain's cache coherency (Chris)
- Fixes around breadcrumbs (Chris)
- Fix encoder lookup during PSR atomic (Imre)
- Hold onto an explicit ref to i915_vma_work.pinned (Chris)


Chris Wilson (5):
  drm/i915/gem: Flush coherency domains on first set-domain-ioctl
  drm/i915/gt: Use the local HWSP offset during submission
  drm/i915/gt: Expose more parameters for emitting writes into the ring
  drm/i915/gt: Flush xcs before tgl breadcrumbs
  drm/i915: Hold onto an explicit ref to i915_vma_work.pinned

Colin Xu (4):
  drm/i915/gvt: Allow zero out HWSP addr on hws_pga_write
  drm/i915/gvt: Set SNOOP for PAT3 on BXT/APL to workaround GPU BB hang
  drm/i915/gvt: Only pin/unpin intel_context along with workload
  drm/i915/gvt: Fix mmio handler break on BXT/APL.

Imre Deak (1):
  drm/i915: Fix encoder lookup during PSR atomic check

Rodrigo Vivi (1):
  Merge tag 'gvt-fixes-2020-10-30' of https://github.com/intel/gvt-linux 
into drm-intel-fixes

Zhenyu Wang (1):
  Merge tag 'drm-intel-fixes-2020-10-29' into gvt-fixes

 drivers/gpu/drm/i915/display/intel_psr.c   |  2 +-
 drivers/gpu/drm/i915/gem/i915_gem_domain.c | 28 ++---
 drivers/gpu/drm/i915/gt/intel_engine.h | 55 --
 drivers/gpu/drm/i915/gt/intel_lrc.c| 31 ++-
 drivers/gpu/drm/i915/gt/intel_timeline.c   | 18 +
 drivers/gpu/drm/i915/gt/intel_timeline_types.h |  2 +
 drivers/gpu/drm/i915/gvt/handlers.c| 47 --
 drivers/gpu/drm/i915/gvt/scheduler.c   | 15 +++
 drivers/gpu/drm/i915/i915_vma.c|  6 ++-
 9 files changed, 139 insertions(+), 65 deletions(-)
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 2/3] drm: Use state helper instead of CRTC state pointer

2020-11-05 Thread Ville Syrjälä
On Thu, Nov 05, 2020 at 05:35:28PM +0100, Maxime Ripard wrote:
> On Tue, Nov 03, 2020 at 06:28:24PM +0200, Ville Syrjälä wrote:
> > On Tue, Nov 03, 2020 at 05:15:51PM +0100, Maxime Ripard wrote:
> > > Hi Ville,
> > > 
> > > On Mon, Nov 02, 2020 at 06:04:06PM +0200, Ville Syrjälä wrote:
> > > > On Mon, Nov 02, 2020 at 02:38:33PM +0100, Maxime Ripard wrote:
> > > > > Many drivers reference the crtc->pointer in order to get the current 
> > > > > CRTC
> > > > > state in their atomic_begin or atomic_flush hooks, which would be the 
> > > > > new
> > > > > CRTC state in the global atomic state since _swap_state happened when 
> > > > > those
> > > > > hooks are run.
> > > > > 
> > > > > Use the drm_atomic_get_new_crtc_state helper to get that state to 
> > > > > make it
> > > > > more obvious.
> > > > > 
> > > > > This was made using the coccinelle script below:
> > > > > 
> > > > > @ crtc_atomic_func @
> > > > > identifier helpers;
> > > > > identifier func;
> > > > > @@
> > > > > 
> > > > > (
> > > > > static struct drm_crtc_helper_funcs helpers = {
> > > > >   ...,
> > > > >   .atomic_begin = func,
> > > > >   ...,
> > > > > };
> > > > > |
> > > > > static struct drm_crtc_helper_funcs helpers = {
> > > > >   ...,
> > > > >   .atomic_flush = func,
> > > > >   ...,
> > > > > };
> > > > > )
> > > > > 
> > > > > @@
> > > > > identifier crtc_atomic_func.func;
> > > > > identifier crtc, state;
> > > > > symbol crtc_state;
> > > > > expression e;
> > > > > @@
> > > > > 
> > > > >   func(struct drm_crtc *crtc, struct drm_atomic_state *state) {
> > > > >   ...
> > > > > - struct tegra_dc_state *crtc_state = e;
> > > > > + struct tegra_dc_state *dc_state = e;
> > > > >   <+...
> > > > > -   crtc_state
> > > > > + dc_state
> > > > >   ...+>
> > > > >   }
> > > > > 
> > > > > @@
> > > > > identifier crtc_atomic_func.func;
> > > > > identifier crtc, state;
> > > > > symbol crtc_state;
> > > > > expression e;
> > > > > @@
> > > > > 
> > > > >   func(struct drm_crtc *crtc, struct drm_atomic_state *state) {
> > > > >   ...
> > > > > - struct mtk_crtc_state *crtc_state = e;
> > > > > + struct mtk_crtc_state *mtk_crtc_state = e;
> > > > >   <+...
> > > > > -   crtc_state
> > > > > + mtk_crtc_state
> > > > >   ...+>
> > > > >   }
> > > > 
> > > > These reanames seem a bit out of scpe for this patch. But I guess you
> > > > needed then to get the rest of the cocci to work on some drivers?
> > > 
> > > Yeah, those two drivers already had a variable named crtc_state, calling
> > > container_of on crtc->state
> > > 
> > > It was cleaner to me to have an intermediate variable storing the result
> > > of drm_atomic_get_new_crtc_state, but then the most obvious name was
> > > taken so I had to rename those two variables before doing so.
> > > 
> > > > The basic idea looks good:
> > > > Reviewed-by: Ville Syrjälä 
> > > > 
> > > > But I guess up to the individual driver folks to bikeshed the variable
> > > > naming and whatnot.
> > > > 
> > > > One thing I spotted is that a few drivers now gained two aliasing crtc
> > > > state pointers in the function: one with the drm type, the other with
> > > > a driver specific type. That's something we've outlawed in i915 since
> > > > it was making life rather confusing. In i915 we now prefer to use only
> > > > the i915 specific types in most places.
> > > 
> > > I didn't spot any of those cases, do you have an example of where it
> > > happened?
> > 
> > eg. ast:
> > +   struct drm_crtc_state *crtc_state = 
> > drm_atomic_get_new_crtc_state(state,   
> > + 
> > crtc);   
> > struct drm_crtc_state *old_crtc_state = 
> > drm_atomic_get_old_crtc_state(state,   
> > 
> >   crtc);   
> > struct ast_private *ast = to_ast_private(crtc->dev);
> >
> > -   struct ast_crtc_state *ast_crtc_state = 
> > to_ast_crtc_state(crtc->state);
> > +   struct ast_crtc_state *ast_crtc_state = 
> > to_ast_crtc_state(crtc_state);   
> > 
> > So here both 'crtc_state' and 'ast_crtc_state' are basically the same
> > thing, which can get a bit confusing especially within larger functions
> > with lots of variables. 
> 
> Ah, that kind of aliasing, ok. So it's purely an issue with
> ergonomics/convenience?

Yeah, I got fed up with it in i915 because I had a hard time
reasoning how the state was being mutated when it was being
accesed through multiple pointers in the same function. And
didn't help that the variable names were all over the place.

> 
> It seems to be a widespread pattern (I know we're using it in vc4 and
> sun4i, and from those reworks I've seen a number of drivers doing so).
> I'm not entirely sure how we 

Re: [PATCH 00/19] [Set 1] Rid W=1 warnings from GPU

2020-11-05 Thread Thierry Reding
On Thu, Nov 05, 2020 at 02:44:58PM +, Lee Jones wrote:
> This set is part of a larger effort attempting to clean-up W=1
> kernel builds, which are currently overwhelmingly riddled with
> niggly little warnings.
> 
> There are 5000 warnings to work through.
> 
> It will take a couple more sets.
> 
> Lee Jones (19):
>   gpu: host1x: bus: Add missing description for 'driver'
>   gpu: ipu-v3: ipu-di: Strip out 2 unused 'di_sync_config' entries
>   gpu: drm: imx: ipuv3-plane: Mark 'crtc_state' as __always_unused
>   gpu: drm: omapdrm: omap_irq: Fix a couple of doc-rot issues
>   gpu: drm: selftests: test-drm_mm: Mark 'hole_end' as always_unused
>   gpu: drm: scheduler: sched_main: Provide missing description for
> 'sched' paramter
>   gpu: drm: scheduler: sched_entity: Demote non-conformant kernel-doc
> headers
>   gpu: drm: omapdrm: dss: dsi: Rework and remove a few unused variables
>   gpu: drm: selftests: test-drm_framebuffer: Remove set but unused
> variable 'fb'
>   gpu: drm: ttm: ttm_bo: Fix one function header - demote lots of
> kernel-doc abuses
>   gpu: drm: panel: panel-simple: Fix 'struct panel_desc's header
>   gpu: drm: bridge: analogix: analogix_dp_reg: Remove unused function
> 'analogix_dp_write_byte_to_dpcd'
>   gpu: drm: ttm: ttm_tt: Demote kernel-doc header format abuses
>   gpu: drm: selftests: test-drm_dp_mst_helper: Place 'struct
> drm_dp_sideband_msg_req_body' onto the heap
>   gpu: drm: radeon: radeon_drv: Remove unused variable 'ret'
>   gpu: drm: panel: panel-ilitek-ili9322: Demote non-conformant
> kernel-doc header
>   gpu: drm: radeon: radeon_device: Fix a bunch of kernel-doc
> misdemeanours
>   gpu: drm: amd: amdgpu: amdgpu: Mark global variables as __maybe_unused
>   gpu: drm: bridge: analogix: analogix_dp_reg: Remove unused function
> 'analogix_dp_start_aux_transaction'

As commented on the other patches, the subject prefixes on most of these
look wrong, but it's generally a nice cleanup.

Thanks!
Thierry


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


Re: [PATCH 16/19] gpu: drm: panel: panel-ilitek-ili9322: Demote non-conformant kernel-doc header

2020-11-05 Thread Thierry Reding
On Thu, Nov 05, 2020 at 02:45:14PM +, Lee Jones wrote:
> Fixes the following W=1 kernel build warning(s):
> 
>  drivers/gpu/drm/panel/panel-ilitek-ili9322.c:177: warning: Enum value 
> 'ILI9322_INPUT_SRGB_THROUGH' not described in enum 'ili9322_input'
>  drivers/gpu/drm/panel/panel-ilitek-ili9322.c:177: warning: Enum value 
> 'ILI9322_INPUT_SRGB_ALIGNED' not described in enum 'ili9322_input'
>  drivers/gpu/drm/panel/panel-ilitek-ili9322.c:177: warning: Enum value 
> 'ILI9322_INPUT_SRGB_DUMMY_320X240' not described in enum 'ili9322_input'
>  drivers/gpu/drm/panel/panel-ilitek-ili9322.c:177: warning: Enum value 
> 'ILI9322_INPUT_SRGB_DUMMY_360X240' not described in enum 'ili9322_input'
>  drivers/gpu/drm/panel/panel-ilitek-ili9322.c:177: warning: Enum value 
> 'ILI9322_INPUT_DISABLED_1' not described in enum 'ili9322_input'
>  drivers/gpu/drm/panel/panel-ilitek-ili9322.c:177: warning: Enum value 
> 'ILI9322_INPUT_PRGB_THROUGH' not described in enum 'ili9322_input'
>  drivers/gpu/drm/panel/panel-ilitek-ili9322.c:177: warning: Enum value 
> 'ILI9322_INPUT_PRGB_ALIGNED' not described in enum 'ili9322_input'
>  drivers/gpu/drm/panel/panel-ilitek-ili9322.c:177: warning: Enum value 
> 'ILI9322_INPUT_YUV_640X320_YCBCR' not described in enum 'ili9322_input'
>  drivers/gpu/drm/panel/panel-ilitek-ili9322.c:177: warning: Enum value 
> 'ILI9322_INPUT_YUV_720X360_YCBCR' not described in enum 'ili9322_input'
>  drivers/gpu/drm/panel/panel-ilitek-ili9322.c:177: warning: Enum value 
> 'ILI9322_INPUT_DISABLED_2' not described in enum 'ili9322_input'
>  drivers/gpu/drm/panel/panel-ilitek-ili9322.c:177: warning: Enum value 
> 'ILI9322_INPUT_ITU_R_BT656_720X360_YCBCR' not described in enum 
> 'ili9322_input'
>  drivers/gpu/drm/panel/panel-ilitek-ili9322.c:177: warning: Enum value 
> 'ILI9322_INPUT_ITU_R_BT656_640X320_YCBCR' not described in enum 
> 'ili9322_input'
>  drivers/gpu/drm/panel/panel-ilitek-ili9322.c:177: warning: Enum value 
> 'ILI9322_INPUT_UNKNOWN' not described in enum 'ili9322_input'
> 
> Cc: Thierry Reding 
> Cc: Sam Ravnborg 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: Linus Walleij 
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 
> ---
>  drivers/gpu/drm/panel/panel-ilitek-ili9322.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Again, for the subject prefix, this should probably be:

drm/panel: ili9322:

but otherwise this seems okay:

Acked-by: Thierry Reding 


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


Re: [PATCH v4 14/16] drm/i915/hdcp: Add HDCP 2.2 stream register

2020-11-05 Thread Ramalingam C
On 2020-10-27 at 22:12:06 +0530, Anshuman Gupta wrote:
> Add HDCP 2.2 DP MST HDCP2_STREAM_STATUS
> and HDCP2_AUTH_STREAM register in i915_reg header.

Reviewed-by: Ramalingam C 
> 
> Cc: Ramalingam C 
> Reviewed-by: Uma Shankar 
> Signed-off-by: Anshuman Gupta 
> ---
>  drivers/gpu/drm/i915/i915_reg.h | 30 ++
>  1 file changed, 30 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index 77461cde6549..c9678c77883d 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -9894,6 +9894,7 @@ enum skl_power_gate {
> _PORTD_HDCP2_BASE, \
> _PORTE_HDCP2_BASE, \
> _PORTF_HDCP2_BASE) + (x))
> +
>  #define PORT_HDCP2_AUTH(port)_PORT_HDCP2_BASE(port, 0x98)
>  #define _TRANSA_HDCP2_AUTH   0x66498
>  #define _TRANSB_HDCP2_AUTH   0x66598
> @@ -9933,6 +9934,35 @@ enum skl_power_gate {
>TRANS_HDCP2_STATUS(trans) : \
>PORT_HDCP2_STATUS(port))
>  
> +#define PORT_HDCP2_STREAM_STATUS(port)   _PORT_HDCP2_BASE(port, 
> 0xC0)
> +#define _TRANSA_HDCP2_STREAM_STATUS  0x664C0
> +#define _TRANSB_HDCP2_STREAM_STATUS  0x665C0
> +#define TRANS_HDCP2_STREAM_STATUS(trans) _MMIO_TRANS(trans, \
> + 
> _TRANSA_HDCP2_STREAM_STATUS, \
> + _TRANSB_HDCP2_STREAM_STATUS)
> +#define   STREAM_ENCRYPTION_STATUS   BIT(31)
> +#define   STREAM_TYPE_STATUS BIT(30)
> +#define HDCP2_STREAM_STATUS(dev_priv, trans, port) \
> + (INTEL_GEN(dev_priv) >= 12 ? \
> +  TRANS_HDCP2_STREAM_STATUS(trans) : \
> +  PORT_HDCP2_STREAM_STATUS(port))
> +
> +#define _PORTA_HDCP2_AUTH_STREAM 0x66F00
> +#define _PORTB_HDCP2_AUTH_STREAM 0x66F04
> +#define PORT_HDCP2_AUTH_STREAM(port) _MMIO_PORT(port, \
> +_PORTA_HDCP2_AUTH_STREAM, \
> +_PORTB_HDCP2_AUTH_STREAM)
> +#define _TRANSA_HDCP2_AUTH_STREAM0x66F00
> +#define _TRANSB_HDCP2_AUTH_STREAM0x66F04
> +#define TRANS_HDCP2_AUTH_STREAM(trans)   _MMIO_TRANS(trans, \
> + _TRANSA_HDCP2_AUTH_STREAM, \
> + _TRANSB_HDCP2_AUTH_STREAM)
> +#define   AUTH_STREAM_TYPE   BIT(31)
> +#define HDCP2_AUTH_STREAM(dev_priv, trans, port) \
> + (INTEL_GEN(dev_priv) >= 12 ? \
> +  TRANS_HDCP2_AUTH_STREAM(trans) : \
> +  PORT_HDCP2_AUTH_STREAM(port))
> +
>  /* Per-pipe DDI Function Control */
>  #define _TRANS_DDI_FUNC_CTL_A0x60400
>  #define _TRANS_DDI_FUNC_CTL_B0x61400
> -- 
> 2.26.2
> 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 01/19] gpu: host1x: bus: Add missing description for 'driver'

2020-11-05 Thread Thierry Reding
On Thu, Nov 05, 2020 at 02:44:59PM +, Lee Jones wrote:
> Fixes the following W=1 kernel build warning(s):
> 
>  drivers/gpu/host1x/bus.c:40: warning: Function parameter or member 'driver' 
> not described in 'host1x_subdev_add'
> 
> Cc: Thierry Reding 
> Cc: dri-devel@lists.freedesktop.org
> Cc: linux-te...@vger.kernel.org
> Signed-off-by: Lee Jones 
> ---
>  drivers/gpu/host1x/bus.c | 1 +
>  1 file changed, 1 insertion(+)

Acked-by: Thierry Reding 


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


Re: [PATCH 11/19] gpu: drm: panel: panel-simple: Fix 'struct panel_desc's header

2020-11-05 Thread Thierry Reding
On Thu, Nov 05, 2020 at 02:45:09PM +, Lee Jones wrote:
> Struct headers should start with 'struct '
> 
> Fixes the following W=1 kernel build warning(s):
> 
>  drivers/gpu/drm/panel/panel-simple.c:42: warning: Cannot understand  * 
> @modes: Pointer to array of fixed modes appropriate for this panel.  If
> 
> Cc: Thierry Reding 
> Cc: Sam Ravnborg 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 
> ---
>  drivers/gpu/drm/panel/panel-simple.c | 2 ++
>  1 file changed, 2 insertions(+)

I think a more common prefix for this file is:

drm/panel: simple:

Other than than:

Acked-by: Thierry Reding 


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


Re: [PATCH v4 13/16] drm/i915/hdcp: Pass connector to check_2_2_link

2020-11-05 Thread Ramalingam C
On 2020-10-27 at 22:12:05 +0530, Anshuman Gupta wrote:
> This requires for HDCP 2.2 MST check link.
> 
> Cc: Ramalingam C 
> Reviewed-by: Uma Shankar 
> Signed-off-by: Anshuman Gupta 
> ---
>  drivers/gpu/drm/i915/display/intel_display_types.h | 3 ++-
>  drivers/gpu/drm/i915/display/intel_dp_hdcp.c   | 3 ++-
>  drivers/gpu/drm/i915/display/intel_hdcp.c  | 2 +-
>  drivers/gpu/drm/i915/display/intel_hdmi.c  | 3 ++-
>  4 files changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h 
> b/drivers/gpu/drm/i915/display/intel_display_types.h
> index 24e0067c2e7c..dfb5be64e03a 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_types.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
> @@ -375,7 +375,8 @@ struct intel_hdcp_shim {
> bool is_repeater, u8 type);
>  
>   /* HDCP2.2 Link Integrity Check */
> - int (*check_2_2_link)(struct intel_digital_port *dig_port);
> + int (*check_2_2_link)(struct intel_digital_port *dig_port,
> +   struct intel_connector *connector);
do we need both of them?

-Ram.
>  };
>  
>  struct intel_hdcp {
> diff --git a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c 
> b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
> index 591b68e5de48..4be61e7fde4e 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
> @@ -585,7 +585,8 @@ int intel_dp_hdcp2_config_stream_type(struct 
> intel_digital_port *dig_port,
>  }
>  
>  static
> -int intel_dp_hdcp2_check_link(struct intel_digital_port *dig_port)
> +int intel_dp_hdcp2_check_link(struct intel_digital_port *dig_port,
> +   struct intel_connector *connector)
>  {
>   u8 rx_status;
>   int ret;
> diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c 
> b/drivers/gpu/drm/i915/display/intel_hdcp.c
> index 1df6d4a23476..87f7aaf3a319 100644
> --- a/drivers/gpu/drm/i915/display/intel_hdcp.c
> +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c
> @@ -1940,7 +1940,7 @@ static int intel_hdcp2_check_link(struct 
> intel_connector *connector)
>   goto out;
>   }
>  
> - ret = hdcp->shim->check_2_2_link(dig_port);
> + ret = hdcp->shim->check_2_2_link(dig_port, connector);
>   if (ret == HDCP_LINK_PROTECTED) {
>   if (hdcp->value != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) {
>   intel_hdcp_update_value(connector,
> diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c 
> b/drivers/gpu/drm/i915/display/intel_hdmi.c
> index 0788de04711b..bd0d91101464 100644
> --- a/drivers/gpu/drm/i915/display/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/display/intel_hdmi.c
> @@ -1734,7 +1734,8 @@ int intel_hdmi_hdcp2_read_msg(struct intel_digital_port 
> *dig_port,
>  }
>  
>  static
> -int intel_hdmi_hdcp2_check_link(struct intel_digital_port *dig_port)
> +int intel_hdmi_hdcp2_check_link(struct intel_digital_port *dig_port,
> + struct intel_connector *connector)
>  {
>   u8 rx_status[HDCP_2_2_HDMI_RXSTATUS_LEN];
>   int ret;
> -- 
> 2.26.2
> 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 00/19] [Set 1] Rid W=1 warnings from GPU

2020-11-05 Thread Sam Ravnborg
Hi Lee.

On Thu, Nov 05, 2020 at 02:44:58PM +, Lee Jones wrote:
> This set is part of a larger effort attempting to clean-up W=1
> kernel builds, which are currently overwhelmingly riddled with
> niggly little warnings.

Thanks for looking into this.

> There are 5000 warnings to work through.
> 
> It will take a couple more sets.
:-)

>   gpu: drm: panel: panel-simple: Fix 'struct panel_desc's header
I have a patch here that inline the comments - and fix the warning as a
side effect. I will get it posted tonight as this is better.

>   gpu: drm: bridge: analogix: analogix_dp_reg: Remove unused function
> 'analogix_dp_write_byte_to_dpcd'
When I looked at his I had another unused function after removing the
first.

>   gpu: drm: panel: panel-ilitek-ili9322: Demote non-conformant
> kernel-doc header
Agree on this simple approch, will apply.

>   gpu: drm: bridge: analogix: analogix_dp_reg: Remove unused function
> 'analogix_dp_start_aux_transaction'
OK, this was the one I referred to above. They should be squashed into
one patch.

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


Re: [PATCH v4 08/16] drm/i915/hdcp: Pass dig_port to intel_hdcp_init

2020-11-05 Thread Ramalingam C
On 2020-10-27 at 22:12:00 +0530, Anshuman Gupta wrote:
> Pass dig_port as an argument to intel_hdcp_init()
> and intel_hdcp2_init().
> This will be required for HDCP 2.2 stream encryption.
> 
> Cc: Ramalingam C 
> Reviewed-by: Uma Shankar 
> Signed-off-by: Anshuman Gupta 
> ---
>  drivers/gpu/drm/i915/display/intel_dp_hdcp.c |  4 ++--
>  drivers/gpu/drm/i915/display/intel_hdcp.c| 12 +++-
>  drivers/gpu/drm/i915/display/intel_hdcp.h|  4 +++-
>  drivers/gpu/drm/i915/display/intel_hdmi.c|  2 +-
>  4 files changed, 13 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c 
> b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
> index 6dcbfaffd2c5..591b68e5de48 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
> @@ -751,10 +751,10 @@ int intel_dp_init_hdcp(struct intel_digital_port 
> *dig_port,
>   return 0;
>  
>   if (intel_connector->mst_port)
> - return intel_hdcp_init(intel_connector, port,
> + return intel_hdcp_init(intel_connector, dig_port,
cant we retrieve the dig_port from connector?

-Ram
>  _dp_mst_hdcp_shim);
>   else if (!intel_dp_is_edp(intel_dp))
> - return intel_hdcp_init(intel_connector, port,
> + return intel_hdcp_init(intel_connector, dig_port,
>  _dp_hdcp_shim);
>  
>   return 0;
> diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c 
> b/drivers/gpu/drm/i915/display/intel_hdcp.c
> index 937af4aeaac2..b0f47687bc59 100644
> --- a/drivers/gpu/drm/i915/display/intel_hdcp.c
> +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c
> @@ -1982,12 +1982,13 @@ static enum mei_fw_tc intel_get_mei_fw_tc(enum 
> transcoder cpu_transcoder)
>  }
>  
>  static int initialize_hdcp_port_data(struct intel_connector *connector,
> -  enum port port,
> +  struct intel_digital_port *dig_port,
>const struct intel_hdcp_shim *shim)
>  {
>   struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
>   struct intel_hdcp *hdcp = >hdcp;
>   struct hdcp_port_data *data = >port_data;
> + enum port port = dig_port->base.port;
>  
>   if (INTEL_GEN(dev_priv) < 12)
>   data->fw_ddi = intel_get_mei_fw_ddi_index(port);
> @@ -2060,14 +2061,15 @@ void intel_hdcp_component_init(struct 
> drm_i915_private *dev_priv)
>   }
>  }
>  
> -static void intel_hdcp2_init(struct intel_connector *connector, enum port 
> port,
> +static void intel_hdcp2_init(struct intel_connector *connector,
> +  struct intel_digital_port *dig_port,
>const struct intel_hdcp_shim *shim)
>  {
>   struct drm_i915_private *i915 = to_i915(connector->base.dev);
>   struct intel_hdcp *hdcp = >hdcp;
>   int ret;
>  
> - ret = initialize_hdcp_port_data(connector, port, shim);
> + ret = initialize_hdcp_port_data(connector, dig_port, shim);
>   if (ret) {
>   drm_dbg_kms(>drm, "Mei hdcp data init failed\n");
>   return;
> @@ -2077,7 +2079,7 @@ static void intel_hdcp2_init(struct intel_connector 
> *connector, enum port port,
>  }
>  
>  int intel_hdcp_init(struct intel_connector *connector,
> - enum port port,
> + struct intel_digital_port *dig_port,
>   const struct intel_hdcp_shim *shim)
>  {
>   struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
> @@ -2088,7 +2090,7 @@ int intel_hdcp_init(struct intel_connector *connector,
>   return -EINVAL;
>  
>   if (is_hdcp2_supported(dev_priv) && !connector->mst_port)
> - intel_hdcp2_init(connector, port, shim);
> + intel_hdcp2_init(connector, dig_port, shim);
>  
>   ret =
>   drm_connector_attach_content_protection_property(>base,
> diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.h 
> b/drivers/gpu/drm/i915/display/intel_hdcp.h
> index b912a3a0f5b8..8f53b0c7fe5c 100644
> --- a/drivers/gpu/drm/i915/display/intel_hdcp.h
> +++ b/drivers/gpu/drm/i915/display/intel_hdcp.h
> @@ -18,13 +18,15 @@ struct intel_connector;
>  struct intel_crtc_state;
>  struct intel_encoder;
>  struct intel_hdcp_shim;
> +struct intel_digital_port;
>  enum port;
>  enum transcoder;
>  
>  void intel_hdcp_atomic_check(struct drm_connector *connector,
>struct drm_connector_state *old_state,
>struct drm_connector_state *new_state);
> -int intel_hdcp_init(struct intel_connector *connector, enum port port,
> +int intel_hdcp_init(struct intel_connector *connector,
> + struct intel_digital_port *dig_port,
>   const struct intel_hdcp_shim *hdcp_shim);
>  int intel_hdcp_enable(struct intel_connector *connector,
> const struct intel_crtc_state 

Re: [PATCH] drm/ttm: don't set page->mapping

2020-11-05 Thread Daniel Vetter
On Thu, Nov 5, 2020 at 4:15 PM Christian König  wrote:
>
> Am 05.11.20 um 15:38 schrieb Daniel Vetter:
> > On Thu, Nov 5, 2020 at 3:31 PM Daniel Vetter  wrote:
> >> On Thu, Nov 5, 2020 at 2:22 PM Christian König  
> >> wrote:
> >>> Am 05.11.20 um 14:20 schrieb Daniel Vetter:
>  On Thu, Nov 05, 2020 at 01:56:22PM +0100, Christian König wrote:
> > Am 05.11.20 um 13:50 schrieb Daniel Vetter:
> >> On Thu, Nov 05, 2020 at 01:29:50PM +0100, Christian König wrote:
> >>> Am 05.11.20 um 10:11 schrieb Daniel Vetter:
>  On Thu, Nov 5, 2020 at 9:00 AM Christian König 
>   wrote:
> > Am 04.11.20 um 17:50 schrieb Daniel Vetter:
> >> Random observation while trying to review Christian's patch series 
> >> to
> >> stop looking at struct page for dma-buf imports.
> >>
> >> This was originally added in
> >>
> >> commit 58aa6622d32af7d2c08d45085f44c54554a16ed7
> >> Author: Thomas Hellstrom 
> >> Date:   Fri Jan 3 11:47:23 2014 +0100
> >>
> >>  drm/ttm: Correctly set page mapping and -index members
> >>
> >>  Needed for some vm operations; most notably 
> >> unmap_mapping_range() with
> >>  even_cows = 0.
> >>
> >>  Signed-off-by: Thomas Hellstrom 
> >>  Reviewed-by: Brian Paul 
> >>
> >> but we do not have a single caller of unmap_mapping_range with
> >> even_cows == 0. And all the gem drivers don't do this, so another
> >> small thing we could standardize between drm and ttm drivers.
> >>
> >> Plus I don't really see a need for unamp_mapping_range where we 
> >> don't
> >> want to indiscriminately shoot down all ptes.
> > NAK, we use this to determine if a pages belongs to the driver or 
> > not in
> > amdgpu for example.
> >
> > Mostly used for debugging, but I would really like to keep that.
>  Can you pls point me at that code? A quick grep hasn't really found 
>  much at all.
> >>> See amdgpu_iomem_read() for an example:
> >> Why do you reject this?
> > When IOMMU is disabled or uses an 1 to 1 mapping we would otherwise 
> > give the
> > same access as /dev/mem to system memory and that is forbidden. But as I
> > noted this is just for the debugfs file.
>  Ah, there's a config option for that. Plus it's debugfs, anything goes in
>  debugfs, but if you're worried about that hole we should just disable the
>  entire debugfs file for CONFIG_STRICT_DEVMEM. I can perhaps throw that on
>  top, that follow_pfn patch series I'm baking is all about this kind of
>  fun.
> >>> And exactly that would get a NAK from us.
> >>>
> >>> We have specially created that debugfs file as an alternative when
> >>> CONFIG_STRICT_DEVMEM is set.
> >> Uh that doesn't work if you work around core restrictions with your
> >> own debugfs paths.
>
> That's why we have the restriction to check the mapping of the pages.
>
> This way we only expose the memory which was allocated by our driver and
> don't allow any uncontrolled access to the whole system memory.
>
> We have something similar for radeon as well, but there we have a global
> GART table which we can use for validating stuff.

The check doesn't take any locks over the check and copy*user, I don't
think it's protecting anything really against somewhat adverse
userspace.

I mean fundamentally locking down stuff like STRICT_DEVMEM or all the
others makes debugging harder, that's kinda the expected tradeoff.

> >>   Maybe you can do fun like this in your dkms, but
> >> not in upstream. Like if this was specifically created to work around
> >> CONFIG_STRICT_DEVMEM (and it sounds like that) then I think this
> >> should never have landed in upstream to begin with.
> > I'm also kinda confused that there's distros with CONFIG_STRICT_DEVMEM
> > which allow debugfs. debugfs is a pretty bad root hole all around, or
> > at least that's been the assumption all the time.
>
> Yeah, completely agree :) But that's not my problem.

I guess I'll do another rfc series and poke a pile of people ... seems
to be a habit I'm developing :-)
-Daniel

>
> Christian.
>
> > -Daniel
> >
> > When I tried a few years ago to not set the page->mapping I immediately 
> > ran
> > into issues with our eviction test. So I think that this is used 
> > elsewhere
> > as well.
>  That's the kind of interaction I'm worried about here tbh. If this does
>  some kind of shrinking of some sorts, I think a real shrinker should take
>  over.
> 
>  An improved grep shows nothing else, so the only the above is the only
>  thing I can think of. What kind of eviction test goes boom if you clear
>  ->mapping here? I'd be happy to type up the clever trick for the debugfs
>  files.
>  -Daniel
> 
> > 

Re: [PATCH v4 12/16] drm/i915/hdcp: MST streams support in hdcp port_data

2020-11-05 Thread Ramalingam C
On 2020-10-27 at 22:12:04 +0530, Anshuman Gupta wrote:
> Add support for multiple mst stream in hdcp port data
> which will be used by RepeaterAuthStreamManage msg and
> HDCP 2.2 security f/w for m' validation.
> 
> v2:
> Init the hdcp port data k for HDMI/DP SST strem.
> 
> v3:
> Cosmetic changes. [Uma]
> 
> Cc: Ramalingam C 
> Signed-off-by: Anshuman Gupta 
> ---
>  .../drm/i915/display/intel_display_types.h|   4 +-
>  drivers/gpu/drm/i915/display/intel_hdcp.c | 103 +++---
>  2 files changed, 92 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h 
> b/drivers/gpu/drm/i915/display/intel_display_types.h
> index 749c3a7e0b45..24e0067c2e7c 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_types.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
> @@ -1445,10 +1445,12 @@ struct intel_digital_port {
>   enum phy_fia tc_phy_fia;
>   u8 tc_phy_fia_idx;
>  
> - /* protects num_hdcp_streams reference count, port_data */
> + /* protects num_hdcp_streams reference count, port_data and port_auth */
>   struct mutex hdcp_mutex;
>   /* the number of pipes using HDCP signalling out of this port */
>   unsigned int num_hdcp_streams;
> + /* port HDCP auth status */
> + bool port_auth;
>   /* HDCP port data need to pass to security f/w */
>   struct hdcp_port_data port_data;
since this is no more in hdcp related struct, it will be better to be named as
hdcp_auth_status and hdcp_port_data !?

-Ram
>  
> diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c 
> b/drivers/gpu/drm/i915/display/intel_hdcp.c
> index a5ec4f72f50f..1df6d4a23476 100644
> --- a/drivers/gpu/drm/i915/display/intel_hdcp.c
> +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c
> @@ -26,6 +26,64 @@
>  #define KEY_LOAD_TRIES   5
>  #define HDCP2_LC_RETRY_CNT   3
>  
> +static int intel_conn_to_vcpi(struct intel_connector *connector)
> +{
> + /* For HDMI this is forced to be 0x0. For DP SST also this is 0x0. */
> + return connector->port  ? connector->port->vcpi.vcpi : 0;
> +}
> +
> +static int
> +intel_hdcp_required_content_stream(struct intel_digital_port *dig_port)
> +{
> + struct drm_connector_list_iter conn_iter;
> + struct intel_digital_port *conn_dig_port;
> + struct intel_connector *connector;
> + struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
> + struct hdcp_port_data *data = _port->port_data;
> + bool enforce_type0 = false;
> + int k;
> +
> + if (dig_port->port_auth)
> + return 0;
> +
> + drm_connector_list_iter_begin(>drm, _iter);
> + for_each_intel_connector_iter(connector, _iter) {
> + if (!intel_encoder_is_mst(intel_attached_encoder(connector)))
> + continue;
> +
> + conn_dig_port = intel_attached_dig_port(connector);
> + if (conn_dig_port != dig_port)
> + continue;
> +
> + if (connector->base.status == connector_status_disconnected)
> + continue;
> +
> + if (!enforce_type0 && !intel_hdcp2_capable(connector))
> + enforce_type0 = true;
> +
> + data->streams[data->k].stream_id = 
> intel_conn_to_vcpi(connector);
> + data->k++;
> +
> + /* if there is only one active stream */
> + if (dig_port->dp.active_mst_links <= 1)
> + break;
> + }
> + drm_connector_list_iter_end(_iter);
> +
> + if (drm_WARN_ON(>drm, data->k > INTEL_NUM_PIPES(i915) || data->k 
> == 0))
> + return -EINVAL;
> +
> + /*
> +  * Apply common protection level across all streams in DP MST Topology.
> +  * Use highest supported content type for all streams in DP MST 
> Topology.
> +  */
> + for (k = 0; k < data->k; k++)
> + data->streams[k].stream_type =
> + enforce_type0 ? DRM_MODE_HDCP_CONTENT_TYPE0 : 
> DRM_MODE_HDCP_CONTENT_TYPE1;
> +
> + return 0;
> +}
> +
>  static
>  bool intel_hdcp_is_ksv_valid(u8 *ksv)
>  {
> @@ -1474,13 +1532,14 @@ static
>  int _hdcp2_propagate_stream_management_info(struct intel_connector 
> *connector)
>  {
>   struct intel_digital_port *dig_port = 
> intel_attached_dig_port(connector);
> + struct hdcp_port_data *data = _port->port_data;
>   struct intel_hdcp *hdcp = >hdcp;
>   union {
>   struct hdcp2_rep_stream_manage stream_manage;
>   struct hdcp2_rep_stream_ready stream_ready;
>   } msgs;
>   const struct intel_hdcp_shim *shim = hdcp->shim;
> - int ret;
> + int ret, streams_size_delta, i;
>  
>   if (connector->hdcp.seq_num_m > HDCP_2_2_SEQ_NUM_MAX)
>   return -ERANGE;
> @@ -1489,16 +1548,18 @@ int _hdcp2_propagate_stream_management_info(struct 
> intel_connector *connector)
>   msgs.stream_manage.msg_id = HDCP_2_2_REP_STREAM_MANAGE;
>   

Re: [drm-drm-misc:for-linux-next 2/2] drivers/dma-buf/dma-buf.c:1186: undefined reference to `vma_set_file'

2020-11-05 Thread Christian König

Am 05.11.20 um 17:05 schrieb Christian König:

Am 05.11.20 um 17:04 schrieb Daniel Vetter:

On Thu, Nov 05, 2020 at 05:02:09PM +0100, Daniel Vetter wrote:

On Thu, Nov 05, 2020 at 04:41:00PM +0100, Christian König wrote:
Guys, can anybody help me out. Why is the kernel test robot 
complaining

here?

Thanks in advance,
Christian.

Am 05.11.20 um 16:26 schrieb kernel test robot:

tree: git://anongit.freedesktop.org/drm/drm-misc for-linux-next
head:   2b5b95b1ff3d70a95013a45e3b5b90f1daf42348
commit: 2b5b95b1ff3d70a95013a45e3b5b90f1daf42348 [2/2] mm: 
introduce vma_set_file function v4

config: h8300-randconfig-r031-20201105 (attached as .config)
compiler: h8300-linux-gcc (GCC) 9.3.0

nommu platform?

If you have a hard time finding a cross compiler for this, there's some
nommu arm platforms. I used that for compile teesting nommu support
recently.

If it's not that, then it's something specific with that config for 
sure.

Also looking a the tree, there's no ack from Andrew Morton. For merging
stuff that's not maintained in drm-misc (and definitely for stuff 
outside

of drm maintained tree) we need an ack from the right maintainer.


Ok, going to revert from drm-misc-next then.


Any objections that I use an Acked-by: Daniel Vetter 
 and the original Link tags for the revert?


Christian.



Thanks,
Christian.



I'd say make sure he's ok before we dig an even deeper hole here.
-Daniel


-Daniel


reproduce (this is a W=1 build):
  wget 
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fraw.githubusercontent.com%2Fintel%2Flkp-tests%2Fmaster%2Fsbin%2Fmake.crossdata=04%7C01%7Cchristian.koenig%40amd.com%7C4e238bfcb3c74ec4509b08d881a476b1%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637401890651814795%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000sdata=SwbnYEHBsw44Iy1yJdEqUp1BnLY%2BkMFKOuFcVrccisg%3Dreserved=0 
-O ~/bin/make.cross

  chmod +x ~/bin/make.cross
  git remote add drm-drm-misc 
git://anongit.freedesktop.org/drm/drm-misc

  git fetch --no-tags drm-drm-misc for-linux-next
  git checkout 2b5b95b1ff3d70a95013a45e3b5b90f1daf42348
  # save the attached .config to linux build tree
  COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 
make.cross ARCH=h8300


If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All errors (new ones prefixed by >>):

 h8300-linux-ld: section .init.text LMA 
[004da400,0051ebcb] overlaps section .text LMA 
[025c,01069997]
 h8300-linux-ld: section .data VMA 
[0040,004da3ff] overlaps section .text VMA 
[025c,01069997]
 h8300-linux-ld: drivers/dma-buf/dma-buf.o: in function 
`dma_buf_mmap':
drivers/dma-buf/dma-buf.c:1186: undefined reference to 
`vma_set_file'

vim +1186 drivers/dma-buf/dma-buf.c

    1150
    1151
    1152    /**
    1153 * dma_buf_mmap - Setup up a userspace mmap with the 
given vma

    1154 * @dmabuf:    [in]    buffer that should back the vma
    1155 * @vma:    [in]    vma for the mmap
    1156 * @pgoff:    [in]    offset in pages where this mmap 
should start within the

    1157 *    dma-buf buffer.
    1158 *
    1159 * This function adjusts the passed in vma so that it 
points at the file of the
    1160 * dma_buf operation. It also adjusts the starting 
pgoff and does bounds
    1161 * checking on the size of the vma. Then it calls the 
exporters mmap function to

    1162 * set up the mapping.
    1163 *
    1164 * Can return negative error values, returns 0 on 
success.

    1165 */
    1166    int dma_buf_mmap(struct dma_buf *dmabuf, struct 
vm_area_struct *vma,

    1167 unsigned long pgoff)
    1168    {
    1169    if (WARN_ON(!dmabuf || !vma))
    1170    return -EINVAL;
    1171
    1172    /* check if buffer supports mmap */
    1173    if (!dmabuf->ops->mmap)
    1174    return -EINVAL;
    1175
    1176    /* check for offset overflow */
    1177    if (pgoff + vma_pages(vma) < pgoff)
    1178    return -EOVERFLOW;
    1179
    1180    /* check for overflowing the buffer's size */
    1181    if (pgoff + vma_pages(vma) >
    1182    dmabuf->size >> PAGE_SHIFT)
    1183    return -EINVAL;
    1184
    1185    /* readjust the vma */

1186    vma_set_file(vma, dmabuf->file);

    1187    vma->vm_pgoff = pgoff;
    1188
    1189    return dmabuf->ops->mmap(dmabuf, vma);
    1190    }
    1191    EXPORT_SYMBOL_GPL(dma_buf_mmap);
    1192

---
0-DAY CI Kernel Test Service, Intel Corporation
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.01.org%2Fhyperkitty%2Flist%2Fkbuild-all%40lists.01.orgdata=04%7C01%7Cchristian.koenig%40amd.com%7C4e238bfcb3c74ec4509b08d881a476b1%7C3

Re: [PATCH v1 21/30] usb: host: ehci-tegra: Support OPP and SoC core voltage scaling

2020-11-05 Thread Alan Stern
On Thu, Nov 05, 2020 at 02:44:18AM +0300, Dmitry Osipenko wrote:
> Add initial OPP and SoC core voltage scaling support to the Tegra EHCI
> driver. This is required for enabling system-wide DVFS on older Tegra
> SoCs.
> 
> Tested-by: Peter Geis 
> Tested-by: Nicolas Chauvet 
> Signed-off-by: Dmitry Osipenko 
> ---

I'm no expert on OPP stuff, but some of what you have done here looks 
peculiar.

> diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
> index 869d9c4de5fc..0976577f54b4 100644
> --- a/drivers/usb/host/ehci-tegra.c
> +++ b/drivers/usb/host/ehci-tegra.c
> @@ -17,6 +17,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -364,6 +365,79 @@ static void tegra_ehci_unmap_urb_for_dma(struct usb_hcd 
> *hcd, struct urb *urb)
>   free_dma_aligned_buffer(urb);
>  }
>  
> +static void tegra_ehci_deinit_opp_table(void *data)
> +{
> + struct device *dev = data;
> + struct opp_table *opp_table;
> +
> + opp_table = dev_pm_opp_get_opp_table(dev);
> + dev_pm_opp_of_remove_table(dev);
> + dev_pm_opp_put_regulators(opp_table);
> + dev_pm_opp_put_opp_table(opp_table);
> +}
> +
> +static int devm_tegra_ehci_init_opp_table(struct device *dev)
> +{
> + unsigned long rate = ULONG_MAX;
> + struct opp_table *opp_table;
> + const char *rname = "core";
> + struct dev_pm_opp *opp;
> + int err;
> +
> + /* legacy device-trees don't have OPP table */
> + if (!device_property_present(dev, "operating-points-v2"))
> + return 0;
> +
> + /* voltage scaling is optional */
> + if (device_property_present(dev, "core-supply"))
> + opp_table = dev_pm_opp_set_regulators(dev, , 1);
> + else
> + opp_table = dev_pm_opp_get_opp_table(dev);
> +
> + if (IS_ERR(opp_table))
> + return dev_err_probe(dev, PTR_ERR(opp_table),
> +  "failed to prepare OPP table\n");
> +
> + err = dev_pm_opp_of_add_table(dev);
> + if (err) {
> + dev_err(dev, "failed to add OPP table: %d\n", err);
> + goto put_table;
> + }
> +
> + /* find suitable OPP for the maximum clock rate */
> + opp = dev_pm_opp_find_freq_floor(dev, );
> + err = PTR_ERR_OR_ZERO(opp);
> + if (err) {
> + dev_err(dev, "failed to get OPP: %d\n", err);
> + goto remove_table;
> + }
> +
> + dev_pm_opp_put(opp);
> +
> + /*
> +  * First dummy rate-set initializes voltage vote by setting voltage
> +  * in accordance to the clock rate.
> +  */
> + err = dev_pm_opp_set_rate(dev, rate);
> + if (err) {
> + dev_err(dev, "failed to initialize OPP clock: %d\n", err);
> + goto remove_table;
> + }
> +
> + err = devm_add_action(dev, tegra_ehci_deinit_opp_table, dev);
> + if (err)
> + goto remove_table;
> +
> + return 0;
> +
> +remove_table:
> + dev_pm_opp_of_remove_table(dev);
> +put_table:
> + dev_pm_opp_put_regulators(opp_table);

Do you really want to use the same error unwinding for opp_table values 
obtained from dev_pm_opp_set_regulators() as from 
dev_pm_opp_get_opp_table()?

> +
> + return err;
> +}
> +
>  static const struct tegra_ehci_soc_config tegra30_soc_config = {
>   .has_hostpc = true,
>  };
> @@ -431,6 +505,11 @@ static int tegra_ehci_probe(struct platform_device *pdev)
>   goto cleanup_hcd_create;
>   }
>  
> + err = devm_tegra_ehci_init_opp_table(>dev);
> + if (err)
> + return dev_err_probe(>dev, err,
> +  "Failed to initialize OPP\n");

Why log a second error message?  Just return err.

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


Re: [PATCH v4 11/16] drm/hdcp: Max MST content streams

2020-11-05 Thread Ramalingam C
On 2020-10-27 at 22:12:03 +0530, Anshuman Gupta wrote:
> Let's define Maximum MST content streams up to four
> generically which can be supported by modern display
> controllers.
> 
> Cc: Sean Paul 
> Cc: Ramalingam C 
> Acked-by: Maarten Lankhorst 
> Reviewed-by: Uma Shankar 
> Signed-off-by: Anshuman Gupta 
> ---
>  include/drm/drm_hdcp.h | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/include/drm/drm_hdcp.h b/include/drm/drm_hdcp.h
> index fe58dbb46962..ac22c246542a 100644
> --- a/include/drm/drm_hdcp.h
> +++ b/include/drm/drm_hdcp.h
> @@ -101,11 +101,11 @@
>  
>  /* Following Macros take a byte at a time for bit(s) masking */
>  /*
> - * TODO: This has to be changed for DP MST, as multiple stream on
> - * same port is possible.
> - * For HDCP2.2 on HDMI and DP SST this value is always 1.
> + * TODO: HDCP_2_2_MAX_CONTENT_STREAMS_CNT is based upon actual
> + * H/W MST streams capacity.
> + * This required to be moved out to platform specific header.
>   */
> -#define HDCP_2_2_MAX_CONTENT_STREAMS_CNT 1
> +#define HDCP_2_2_MAX_CONTENT_STREAMS_CNT 4
Reviewed-by: Ramalingam C 

>  #define HDCP_2_2_TXCAP_MASK_LEN  2
>  #define HDCP_2_2_RXCAPS_LEN  3
>  #define HDCP_2_2_RX_REPEATER(x)  ((x) & BIT(0))
> -- 
> 2.26.2
> 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 51/56] ARM: omap2plus_defconfig: Update for moved DSI command mode panel

2020-11-05 Thread Tomi Valkeinen
From: Sebastian Reichel 

The DSI command mode panel is no longer specific
to OMAP and thus the config option has been renamed
slightly.

Signed-off-by: Sebastian Reichel 
Signed-off-by: Tomi Valkeinen 
Cc: Tony Lindgren 
---
 arch/arm/configs/omap2plus_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/configs/omap2plus_defconfig 
b/arch/arm/configs/omap2plus_defconfig
index 34793aabdb65..d329d0829fce 100644
--- a/arch/arm/configs/omap2plus_defconfig
+++ b/arch/arm/configs/omap2plus_defconfig
@@ -369,7 +369,7 @@ CONFIG_DRM_OMAP=m
 CONFIG_OMAP5_DSS_HDMI=y
 CONFIG_OMAP2_DSS_SDI=y
 CONFIG_OMAP2_DSS_DSI=y
-CONFIG_DRM_OMAP_PANEL_DSI_CM=m
+CONFIG_DRM_PANEL_DSI_CM=m
 CONFIG_DRM_TILCDC=m
 CONFIG_DRM_PANEL_SIMPLE=m
 CONFIG_DRM_PANEL_LG_LB035Q02=m
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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


[PATCH v3 55/56] drm/omap: remove dispc_ops

2020-11-05 Thread Tomi Valkeinen
dispc_ops was created to help with the multi-module architecture and
giving us the possibility of multiple dispc implementations. Neither of
these is valid anymore, and we can remove dispc_ops and use direct
calls to dispc.

Signed-off-by: Tomi Valkeinen 
---
 drivers/gpu/drm/omapdrm/dss/base.c|   6 --
 drivers/gpu/drm/omapdrm/dss/dispc.c   | 101 +++---
 drivers/gpu/drm/omapdrm/dss/dss.h |  71 +-
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  71 --
 drivers/gpu/drm/omapdrm/omap_crtc.c   |  30 
 drivers/gpu/drm/omapdrm/omap_drv.c|  15 ++--
 drivers/gpu/drm/omapdrm/omap_drv.h|   2 +-
 drivers/gpu/drm/omapdrm/omap_irq.c|  34 -
 drivers/gpu/drm/omapdrm/omap_plane.c  |  12 +--
 9 files changed, 143 insertions(+), 199 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/base.c 
b/drivers/gpu/drm/omapdrm/dss/base.c
index 08c7c5024896..0aff16bf6edb 100644
--- a/drivers/gpu/drm/omapdrm/dss/base.c
+++ b/drivers/gpu/drm/omapdrm/dss/base.c
@@ -21,12 +21,6 @@ struct dispc_device *dispc_get_dispc(struct dss_device *dss)
return dss->dispc;
 }
 
-const struct dispc_ops *dispc_get_ops(struct dss_device *dss)
-{
-   return dss->dispc_ops;
-}
-
-
 /* 
-
  * OMAP DSS Devices Handling
  */
diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c 
b/drivers/gpu/drm/omapdrm/dss/dispc.c
index 48593932bddf..509bac99cb57 100644
--- a/drivers/gpu/drm/omapdrm/dss/dispc.c
+++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
@@ -351,8 +351,6 @@ static unsigned long dispc_plane_pclk_rate(struct 
dispc_device *dispc,
 static unsigned long dispc_plane_lclk_rate(struct dispc_device *dispc,
   enum omap_plane_id plane);
 
-static void dispc_clear_irqstatus(struct dispc_device *dispc, u32 mask);
-
 static inline void dispc_write_reg(struct dispc_device *dispc, u16 idx, u32 
val)
 {
__raw_writel(val, dispc->base + idx);
@@ -379,12 +377,12 @@ static void mgr_fld_write(struct dispc_device *dispc, 
enum omap_channel channel,
REG_FLD_MOD(dispc, rfld->reg, val, rfld->high, rfld->low);
 }
 
-static int dispc_get_num_ovls(struct dispc_device *dispc)
+int dispc_get_num_ovls(struct dispc_device *dispc)
 {
return dispc->feat->num_ovls;
 }
 
-static int dispc_get_num_mgrs(struct dispc_device *dispc)
+int dispc_get_num_mgrs(struct dispc_device *dispc)
 {
return dispc->feat->num_mgrs;
 }
@@ -667,13 +665,13 @@ void dispc_runtime_put(struct dispc_device *dispc)
WARN_ON(r < 0 && r != -ENOSYS);
 }
 
-static u32 dispc_mgr_get_vsync_irq(struct dispc_device *dispc,
+u32 dispc_mgr_get_vsync_irq(struct dispc_device *dispc,
   enum omap_channel channel)
 {
return mgr_desc[channel].vsync_irq;
 }
 
-static u32 dispc_mgr_get_framedone_irq(struct dispc_device *dispc,
+u32 dispc_mgr_get_framedone_irq(struct dispc_device *dispc,
   enum omap_channel channel)
 {
if (channel == OMAP_DSS_CHANNEL_DIGIT && dispc->feat->no_framedone_tv)
@@ -682,18 +680,18 @@ static u32 dispc_mgr_get_framedone_irq(struct 
dispc_device *dispc,
return mgr_desc[channel].framedone_irq;
 }
 
-static u32 dispc_mgr_get_sync_lost_irq(struct dispc_device *dispc,
+u32 dispc_mgr_get_sync_lost_irq(struct dispc_device *dispc,
   enum omap_channel channel)
 {
return mgr_desc[channel].sync_lost_irq;
 }
 
-static u32 dispc_wb_get_framedone_irq(struct dispc_device *dispc)
+u32 dispc_wb_get_framedone_irq(struct dispc_device *dispc)
 {
return DISPC_IRQ_FRAMEDONEWB;
 }
 
-static void dispc_mgr_enable(struct dispc_device *dispc,
+void dispc_mgr_enable(struct dispc_device *dispc,
 enum omap_channel channel, bool enable)
 {
mgr_fld_write(dispc, channel, DISPC_MGR_FLD_ENABLE, enable);
@@ -707,13 +705,13 @@ static bool dispc_mgr_is_enabled(struct dispc_device 
*dispc,
return !!mgr_fld_read(dispc, channel, DISPC_MGR_FLD_ENABLE);
 }
 
-static bool dispc_mgr_go_busy(struct dispc_device *dispc,
+bool dispc_mgr_go_busy(struct dispc_device *dispc,
  enum omap_channel channel)
 {
return mgr_fld_read(dispc, channel, DISPC_MGR_FLD_GO) == 1;
 }
 
-static void dispc_mgr_go(struct dispc_device *dispc, enum omap_channel channel)
+void dispc_mgr_go(struct dispc_device *dispc, enum omap_channel channel)
 {
WARN_ON(!dispc_mgr_is_enabled(dispc, channel));
WARN_ON(dispc_mgr_go_busy(dispc, channel));
@@ -723,12 +721,12 @@ static void dispc_mgr_go(struct dispc_device *dispc, enum 
omap_channel channel)
mgr_fld_write(dispc, channel, DISPC_MGR_FLD_GO, 1);
 }
 
-static bool dispc_wb_go_busy(struct dispc_device *dispc)
+bool dispc_wb_go_busy(struct dispc_device *dispc)
 {
return REG_GET(dispc, DISPC_CONTROL2, 6, 6) == 1;
 }
 
-static void dispc_wb_go(struct 

[PATCH v3 54/56] drm/omap: drop unused owner field

2020-11-05 Thread Tomi Valkeinen
dssdev->owner is set, but never used. We can drop the field.

Signed-off-by: Tomi Valkeinen 
---
 drivers/gpu/drm/omapdrm/dss/dpi.c | 1 -
 drivers/gpu/drm/omapdrm/dss/dsi.c | 1 -
 drivers/gpu/drm/omapdrm/dss/hdmi4.c   | 1 -
 drivers/gpu/drm/omapdrm/dss/hdmi5.c   | 1 -
 drivers/gpu/drm/omapdrm/dss/omapdss.h | 2 --
 drivers/gpu/drm/omapdrm/dss/sdi.c | 1 -
 drivers/gpu/drm/omapdrm/dss/venc.c| 1 -
 7 files changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dpi.c 
b/drivers/gpu/drm/omapdrm/dss/dpi.c
index 1d2992daef40..030f997eccd0 100644
--- a/drivers/gpu/drm/omapdrm/dss/dpi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dpi.c
@@ -641,7 +641,6 @@ static int dpi_init_output_port(struct dpi_data *dpi, 
struct device_node *port)
out->type = OMAP_DISPLAY_TYPE_DPI;
out->dispc_channel = dpi_get_channel(dpi);
out->of_port = port_num;
-   out->owner = THIS_MODULE;
 
r = omapdss_device_init_output(out, >bridge);
if (r < 0) {
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 76e4f607d8cf..22718a771d6d 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -5443,7 +5443,6 @@ static int dsi_init_output(struct dsi_data *dsi)
out->name = dsi->module_id == 0 ? "dsi.0" : "dsi.1";
out->dispc_channel = dsi_get_channel(dsi);
out->dsi_ops = _ops;
-   out->owner = THIS_MODULE;
out->of_port = 0;
out->bus_flags = DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE
   | DRM_BUS_FLAG_DE_HIGH
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c 
b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
index a14fbf06cb30..13701571d59b 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
@@ -707,7 +707,6 @@ static int hdmi4_init_output(struct omap_hdmi *hdmi)
out->type = OMAP_DISPLAY_TYPE_HDMI;
out->name = "hdmi.0";
out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
-   out->owner = THIS_MODULE;
out->of_port = 0;
 
r = omapdss_device_init_output(out, >bridge);
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi5.c 
b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
index b738d9750686..5d627caf90f2 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi5.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
@@ -681,7 +681,6 @@ static int hdmi5_init_output(struct omap_hdmi *hdmi)
out->type = OMAP_DISPLAY_TYPE_HDMI;
out->name = "hdmi.0";
out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
-   out->owner = THIS_MODULE;
out->of_port = 0;
 
r = omapdss_device_init_output(out, >bridge);
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 90e41c635e45..4442e49ffc5c 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -263,8 +263,6 @@ struct omapdss_dsi_ops {
 struct omap_dss_device {
struct device *dev;
 
-   struct module *owner;
-
struct dss_device *dss;
struct drm_bridge *bridge;
struct drm_bridge *next_bridge;
diff --git a/drivers/gpu/drm/omapdrm/dss/sdi.c 
b/drivers/gpu/drm/omapdrm/dss/sdi.c
index 033fd30074b0..35827b4487bd 100644
--- a/drivers/gpu/drm/omapdrm/dss/sdi.c
+++ b/drivers/gpu/drm/omapdrm/dss/sdi.c
@@ -314,7 +314,6 @@ static int sdi_init_output(struct sdi_device *sdi)
out->dispc_channel = OMAP_DSS_CHANNEL_LCD;
/* We have SDI only on OMAP3, where it's on port 1 */
out->of_port = 1;
-   out->owner = THIS_MODULE;
out->bus_flags = DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE /* 15.5.9.1.2 */
   | DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE;
 
diff --git a/drivers/gpu/drm/omapdrm/dss/venc.c 
b/drivers/gpu/drm/omapdrm/dss/venc.c
index 6e418a0f7572..8ecffe5bbd29 100644
--- a/drivers/gpu/drm/omapdrm/dss/venc.c
+++ b/drivers/gpu/drm/omapdrm/dss/venc.c
@@ -730,7 +730,6 @@ static int venc_init_output(struct venc_device *venc)
out->type = OMAP_DISPLAY_TYPE_VENC;
out->name = "venc.0";
out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
-   out->owner = THIS_MODULE;
out->of_port = 0;
 
r = omapdss_device_init_output(out, >bridge);
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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


[PATCH v3 56/56] drm/omap: remove dss_mgr_ops

2020-11-05 Thread Tomi Valkeinen
dss_mgr_ops was needed with the multi-module architecture, but is no
longer needed. We can thus remove it and use direct calls.

Signed-off-by: Tomi Valkeinen 
---
 drivers/gpu/drm/omapdrm/dss/dss.h |  1 -
 drivers/gpu/drm/omapdrm/dss/omapdss.h | 42 +++
 drivers/gpu/drm/omapdrm/dss/output.c  | 33 +
 drivers/gpu/drm/omapdrm/omap_crtc.c   | 38 +---
 drivers/gpu/drm/omapdrm/omap_crtc.h   |  2 --
 drivers/gpu/drm/omapdrm/omap_drv.c|  4 +--
 6 files changed, 33 insertions(+), 87 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dss.h 
b/drivers/gpu/drm/omapdrm/dss/dss.h
index 96f702314c8c..a547527bb2f3 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss.h
+++ b/drivers/gpu/drm/omapdrm/dss/dss.h
@@ -257,7 +257,6 @@ struct dss_device {
struct dss_pll  *video2_pll;
 
struct dispc_device *dispc;
-   const struct dss_mgr_ops *mgr_ops;
struct omap_drm_private *mgr_ops_priv;
 };
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index fba5f05e5e48..9df322ca467d 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -338,31 +338,23 @@ enum dss_writeback_channel {
DSS_WB_LCD3_MGR =   7,
 };
 
-struct dss_mgr_ops {
-   void (*start_update)(struct omap_drm_private *priv,
-enum omap_channel channel);
-   int (*enable)(struct omap_drm_private *priv,
- enum omap_channel channel);
-   void (*disable)(struct omap_drm_private *priv,
-   enum omap_channel channel);
-   void (*set_timings)(struct omap_drm_private *priv,
-   enum omap_channel channel,
-   const struct videomode *vm);
-   void (*set_lcd_config)(struct omap_drm_private *priv,
-  enum omap_channel channel,
-  const struct dss_lcd_mgr_config *config);
-   int (*register_framedone_handler)(struct omap_drm_private *priv,
-   enum omap_channel channel,
-   void (*handler)(void *), void *data);
-   void (*unregister_framedone_handler)(struct omap_drm_private *priv,
-   enum omap_channel channel,
-   void (*handler)(void *), void *data);
-};
-
-int dss_install_mgr_ops(struct dss_device *dss,
-   const struct dss_mgr_ops *mgr_ops,
-   struct omap_drm_private *priv);
-void dss_uninstall_mgr_ops(struct dss_device *dss);
+void omap_crtc_dss_start_update(struct omap_drm_private *priv,
+  enum omap_channel channel);
+void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable);
+int omap_crtc_dss_enable(struct omap_drm_private *priv, enum omap_channel 
channel);
+void omap_crtc_dss_disable(struct omap_drm_private *priv, enum omap_channel 
channel);
+void omap_crtc_dss_set_timings(struct omap_drm_private *priv,
+   enum omap_channel channel,
+   const struct videomode *vm);
+void omap_crtc_dss_set_lcd_config(struct omap_drm_private *priv,
+   enum omap_channel channel,
+   const struct dss_lcd_mgr_config *config);
+int omap_crtc_dss_register_framedone(
+   struct omap_drm_private *priv, enum omap_channel channel,
+   void (*handler)(void *), void *data);
+void omap_crtc_dss_unregister_framedone(
+   struct omap_drm_private *priv, enum omap_channel channel,
+   void (*handler)(void *), void *data);
 
 void dss_mgr_set_timings(struct omap_dss_device *dssdev,
const struct videomode *vm);
diff --git a/drivers/gpu/drm/omapdrm/dss/output.c 
b/drivers/gpu/drm/omapdrm/dss/output.c
index 7a14d2b5b2f7..2121c947947b 100644
--- a/drivers/gpu/drm/omapdrm/dss/output.c
+++ b/drivers/gpu/drm/omapdrm/dss/output.c
@@ -81,54 +81,35 @@ void omapdss_device_cleanup_output(struct omap_dss_device 
*out)
out->next_bridge : out->bridge);
 }
 
-int dss_install_mgr_ops(struct dss_device *dss,
-   const struct dss_mgr_ops *mgr_ops,
-   struct omap_drm_private *priv)
-{
-   if (dss->mgr_ops)
-   return -EBUSY;
-
-   dss->mgr_ops = mgr_ops;
-   dss->mgr_ops_priv = priv;
-
-   return 0;
-}
-
-void dss_uninstall_mgr_ops(struct dss_device *dss)
-{
-   dss->mgr_ops = NULL;
-   dss->mgr_ops_priv = NULL;
-}
-
 void dss_mgr_set_timings(struct omap_dss_device *dssdev,
 const struct videomode *vm)
 {
-   dssdev->dss->mgr_ops->set_timings(dssdev->dss->mgr_ops_priv,
+   omap_crtc_dss_set_timings(dssdev->dss->mgr_ops_priv,
  dssdev->dispc_channel, vm);
 }
 
 void dss_mgr_set_lcd_config(struct omap_dss_device *dssdev,
const struct dss_lcd_mgr_config *config)
 {
-   

[PATCH v3 53/56] drm/omap: remove unused display.c

2020-11-05 Thread Tomi Valkeinen
The functions in display.c are not used, so drop the file.

Signed-off-by: Tomi Valkeinen 
---
 drivers/gpu/drm/omapdrm/Makefile  |  2 +-
 drivers/gpu/drm/omapdrm/dss/display.c | 58 ---
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  4 --
 3 files changed, 1 insertion(+), 63 deletions(-)
 delete mode 100644 drivers/gpu/drm/omapdrm/dss/display.c

diff --git a/drivers/gpu/drm/omapdrm/Makefile b/drivers/gpu/drm/omapdrm/Makefile
index 33fe7e937680..21e8277ff88f 100644
--- a/drivers/gpu/drm/omapdrm/Makefile
+++ b/drivers/gpu/drm/omapdrm/Makefile
@@ -18,7 +18,7 @@ omapdrm-y := omap_drv.o \
 
 omapdrm-$(CONFIG_DRM_FBDEV_EMULATION) += omap_fbdev.o
 
-omapdrm-y += dss/base.o dss/display.o dss/output.o dss/dss.o dss/dispc.o \
+omapdrm-y += dss/base.o dss/output.o dss/dss.o dss/dispc.o \
dss/dispc_coefs.o dss/pll.o dss/video-pll.o
 omapdrm-$(CONFIG_OMAP2_DSS_DPI) += dss/dpi.o
 omapdrm-$(CONFIG_OMAP2_DSS_VENC) += dss/venc.o
diff --git a/drivers/gpu/drm/omapdrm/dss/display.c 
b/drivers/gpu/drm/omapdrm/dss/display.c
deleted file mode 100644
index 7b7ee2019eae..
--- a/drivers/gpu/drm/omapdrm/dss/display.c
+++ /dev/null
@@ -1,58 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2009 Nokia Corporation
- * Author: Tomi Valkeinen 
- *
- * Some code and ideas taken from drivers/video/omap/ driver
- * by Imre Deak.
- */
-
-#define DSS_SUBSYS_NAME "DISPLAY"
-
-#include 
-#include 
-
-#include 
-#include 
-
-#include "omapdss.h"
-
-static int disp_num_counter;
-
-void omapdss_display_init(struct omap_dss_device *dssdev)
-{
-   int id;
-
-   /*
-* Note: this presumes that all displays either have an DT alias, or
-* none has.
-*/
-   id = of_alias_get_id(dssdev->dev->of_node, "display");
-   if (id < 0)
-   id = disp_num_counter++;
-
-   /* Use 'label' property for name, if it exists */
-   of_property_read_string(dssdev->dev->of_node, "label", >name);
-
-   if (dssdev->name == NULL)
-   dssdev->name = devm_kasprintf(dssdev->dev, GFP_KERNEL,
- "display%u", id);
-}
-
-int omapdss_display_get_modes(struct drm_connector *connector,
- const struct videomode *vm)
-{
-   struct drm_display_mode *mode;
-
-   mode = drm_mode_create(connector->dev);
-   if (!mode)
-   return 0;
-
-   drm_display_mode_from_videomode(vm, mode);
-
-   mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
-   drm_mode_set_name(mode);
-   drm_mode_probed_add(connector, mode);
-
-   return 1;
-}
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 4e7ae164de4f..90e41c635e45 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -300,10 +300,6 @@ struct dss_pdata {
struct dss_device *dss;
 };
 
-void omapdss_display_init(struct omap_dss_device *dssdev);
-int omapdss_display_get_modes(struct drm_connector *connector,
- const struct videomode *vm);
-
 void omapdss_device_register(struct omap_dss_device *dssdev);
 void omapdss_device_unregister(struct omap_dss_device *dssdev);
 struct omap_dss_device *omapdss_device_get(struct omap_dss_device *dssdev);
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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


[PATCH v3 35/56] drm/omap: dsi: implement check timings

2020-11-05 Thread Tomi Valkeinen
From: Sebastian Reichel 

Implement check timings, which will check if its possible to
configure the clocks for the provided mode using the same code
as the set_config() hook.

Signed-off-by: Sebastian Reichel 
Signed-off-by: Tomi Valkeinen 
---
 drivers/gpu/drm/omapdrm/dss/dsi.c | 70 +++
 1 file changed, 44 insertions(+), 26 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
b/drivers/gpu/drm/omapdrm/dss/dsi.c
index a1a867a7d91d..f643321434e9 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -280,6 +280,11 @@ struct dsi_isr_tables {
struct dsi_isr_data isr_table_cio[DSI_MAX_NR_ISRS];
 };
 
+struct dsi_lp_clock_info {
+   unsigned long lp_clk;
+   u16 lp_clk_div;
+};
+
 struct dsi_clk_calc_ctx {
struct dsi_data *dsi;
struct dss_pll *pll;
@@ -294,16 +299,12 @@ struct dsi_clk_calc_ctx {
 
struct dss_pll_clock_info dsi_cinfo;
struct dispc_clock_info dispc_cinfo;
+   struct dsi_lp_clock_info user_lp_cinfo;
 
struct videomode vm;
struct omap_dss_dsi_videomode_timings dsi_vm;
 };
 
-struct dsi_lp_clock_info {
-   unsigned long lp_clk;
-   u16 lp_clk_div;
-};
-
 struct dsi_module_id_data {
u32 address;
int id;
@@ -4789,44 +4790,55 @@ static bool dsi_is_video_mode(struct omap_dss_device 
*dssdev)
return (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE);
 }
 
-static int dsi_set_config(struct omap_dss_device *dssdev,
-   const struct drm_display_mode *mode)
+static int __dsi_calc_config(struct dsi_data *dsi,
+   const struct drm_display_mode *mode,
+   struct dsi_clk_calc_ctx *ctx)
 {
-   struct dsi_data *dsi = to_dsi_data(dssdev);
-   struct dsi_clk_calc_ctx ctx;
-   struct videomode vm;
struct omap_dss_dsi_config cfg = dsi->config;
+   struct videomode vm;
bool ok;
int r;
 
drm_display_mode_to_videomode(mode, );
-   cfg.vm = 
-
-   mutex_lock(>lock);
 
+   cfg.vm = 
cfg.mode = dsi->mode;
cfg.pixel_format = dsi->pix_fmt;
 
if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE)
-   ok = dsi_vm_calc(dsi, , );
+   ok = dsi_vm_calc(dsi, , ctx);
else
-   ok = dsi_cm_calc(dsi, , );
+   ok = dsi_cm_calc(dsi, , ctx);
 
-   if (!ok) {
-   DSSERR("failed to find suitable DSI clock settings\n");
-   r = -EINVAL;
-   goto err;
-   }
+   if (!ok)
+   return -EINVAL;
+
+   dsi_pll_calc_dsi_fck(dsi, >dsi_cinfo);
 
-   dsi_pll_calc_dsi_fck(dsi, _cinfo);
+   r = dsi_lp_clock_calc(ctx->dsi_cinfo.clkout[HSDIV_DSI],
+   cfg.lp_clk_min, cfg.lp_clk_max, >user_lp_cinfo);
+   if (r)
+   return r;
+
+   return 0;
+}
 
-   r = dsi_lp_clock_calc(ctx.dsi_cinfo.clkout[HSDIV_DSI],
-   cfg.lp_clk_min, cfg.lp_clk_max, >user_lp_cinfo);
+static int dsi_set_config(struct omap_dss_device *dssdev,
+   const struct drm_display_mode *mode)
+{
+   struct dsi_data *dsi = to_dsi_data(dssdev);
+   struct dsi_clk_calc_ctx ctx;
+   int r;
+
+   mutex_lock(>lock);
+
+   r = __dsi_calc_config(dsi, mode, );
if (r) {
-   DSSERR("failed to find suitable DSI LP clock settings\n");
+   DSSERR("failed to find suitable DSI clock settings\n");
goto err;
}
 
+   dsi->user_lp_cinfo = ctx.user_lp_cinfo;
dsi->user_dsi_cinfo = ctx.dsi_cinfo;
dsi->user_dispc_cinfo = ctx.dispc_cinfo;
 
@@ -5004,11 +5016,17 @@ static void dsi_set_timings(struct omap_dss_device 
*dssdev,
 static int dsi_check_timings(struct omap_dss_device *dssdev,
 struct drm_display_mode *mode)
 {
+   struct dsi_data *dsi = to_dsi_data(dssdev);
+   struct dsi_clk_calc_ctx ctx;
+   int r;
+
DSSDBG("dsi_check_timings\n");
 
-   /* TODO */
+   mutex_lock(>lock);
+   r = __dsi_calc_config(dsi, mode, );
+   mutex_unlock(>lock);
 
-   return 0;
+   return r;
 }
 
 static int dsi_connect(struct omap_dss_device *src,
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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


[PATCH v3 30/56] drm/omap: dsi: move panel refresh function to host

2020-11-05 Thread Tomi Valkeinen
From: Sebastian Reichel 

This moves the panel refresh/update function from the panel
driver into the DSI host driver to prepare for common drm_panel
support.

Signed-off-by: Sebastian Reichel 
Signed-off-by: Tomi Valkeinen 
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  68 
 drivers/gpu/drm/omapdrm/dss/dsi.c | 101 --
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  13 +--
 drivers/gpu/drm/omapdrm/omap_crtc.c   |  11 +-
 4 files changed, 97 insertions(+), 96 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 030a8fa140db..1582960f9e90 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -177,27 +177,6 @@ static int dsicm_get_id(struct panel_drv_data *ddata, u8 
*id1, u8 *id2, u8 *id3)
return 0;
 }
 
-static int dsicm_set_update_window(struct panel_drv_data *ddata,
-   u16 x, u16 y, u16 w, u16 h)
-{
-   struct mipi_dsi_device *dsi = ddata->dsi;
-   int r;
-   u16 x1 = x;
-   u16 x2 = x + w - 1;
-   u16 y1 = y;
-   u16 y2 = y + h - 1;
-
-   r = mipi_dsi_dcs_set_column_address(dsi, x1, x2);
-   if (r < 0)
-   return r;
-
-   r = mipi_dsi_dcs_set_page_address(dsi, y1, y2);
-   if (r < 0)
-   return r;
-
-   return 0;
-}
-
 static int dsicm_bl_update_status(struct backlight_device *dev)
 {
struct panel_drv_data *ddata = dev_get_drvdata(>dev);
@@ -470,48 +449,6 @@ static void dsicm_disable(struct omap_dss_device *dssdev)
mutex_unlock(>lock);
 }
 
-static void dsicm_framedone_cb(int err, void *data)
-{
-   struct panel_drv_data *ddata = data;
-
-   dev_dbg(>dsi->dev, "framedone, err %d\n", err);
-   mutex_unlock(>lock);
-}
-
-static int dsicm_update(struct omap_dss_device *dssdev,
-   u16 x, u16 y, u16 w, u16 h)
-{
-   struct panel_drv_data *ddata = to_panel_data(dssdev);
-   struct omap_dss_device *src = ddata->src;
-   int r;
-
-   dev_dbg(>dsi->dev, "update %d, %d, %d x %d\n", x, y, w, h);
-
-   mutex_lock(>lock);
-
-   if (!ddata->enabled) {
-   r = 0;
-   goto err;
-   }
-
-   /* XXX no need to send this every frame, but dsi break if not done */
-   r = dsicm_set_update_window(ddata, 0, 0, ddata->vm.hactive,
-   ddata->vm.vactive);
-   if (r)
-   goto err;
-
-   r = src->ops->dsi.update(src, ddata->dsi->channel, dsicm_framedone_cb,
-   ddata);
-   if (r)
-   goto err;
-
-   /* note: no unlock here. unlock is src framedone_cb */
-   return 0;
-err:
-   mutex_unlock(>lock);
-   return r;
-}
-
 static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
 {
struct mipi_dsi_device *dsi = ddata->dsi;
@@ -572,10 +509,6 @@ static const struct omap_dss_device_ops dsicm_ops = {
.check_timings  = dsicm_check_timings,
 };
 
-static const struct omap_dss_driver dsicm_dss_driver = {
-   .update = dsicm_update,
-};
-
 static int dsicm_probe_of(struct mipi_dsi_device *dsi)
 {
struct device_node *node = dsi->dev.of_node;
@@ -658,7 +591,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
dssdev = >dssdev;
dssdev->dev = dev;
dssdev->ops = _ops;
-   dssdev->driver = _dss_driver;
dssdev->type = OMAP_DISPLAY_TYPE_DSI;
dssdev->display = true;
dssdev->owner = THIS_MODULE;
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 0f264654792d..0aa0d21cf896 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -214,6 +214,9 @@ static void dsi_display_uninit_dispc(struct dsi_data *dsi);
 
 static int dsi_vc_send_null(struct dsi_data *dsi, int channel);
 
+static ssize_t _omap_dsi_host_transfer(struct dsi_data *dsi,
+  const struct mipi_dsi_msg *msg);
+
 /* DSI PLL HSDIV indices */
 #define HSDIV_DISPC0
 #define HSDIV_DSI  1
@@ -383,9 +386,6 @@ struct dsi_data {
 
struct delayed_work ulps_work;
 
-   void (*framedone_callback)(int, void *);
-   void *framedone_data;
-
struct delayed_work framedone_timeout_work;
 
 #ifdef DSI_CATCH_MISSING_TE
@@ -3802,8 +3802,6 @@ static void dsi_handle_framedone(struct dsi_data *dsi, 
int error)
dsi_set_ulps_auto(dsi, true);
dsi_bus_unlock(dsi);
 
-   dsi->framedone_callback(error, dsi->framedone_data);
-
if (!error)
dsi_perf_show(dsi, "DISPC");
 }
@@ -3835,6 +3833,8 @@ static void dsi_framedone_irq_callback(void *data)
 
cancel_delayed_work(>framedone_timeout_work);
 
+   DSSDBG("Framedone received!\n");
+
dsi_handle_framedone(dsi, 0);
 }
 
@@ -3856,17 +3856,69 @@ static int _dsi_update(struct 

[PATCH v3 27/56] drm/omap: dsi: do bus locking in host driver

2020-11-05 Thread Tomi Valkeinen
From: Sebastian Reichel 

This moves the bus locking into the host driver and unexports
the custom API in preparation for drm_panel support.

Signed-off-by: Sebastian Reichel 
Signed-off-by: Tomi Valkeinen 
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 46 +--
 drivers/gpu/drm/omapdrm/dss/dsi.c | 33 -
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  3 --
 3 files changed, 23 insertions(+), 59 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index dc2c045cc6b0..4be0c9dbcc43 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -298,7 +298,6 @@ static int dsicm_wake_up(struct panel_drv_data *ddata)
 static int dsicm_bl_update_status(struct backlight_device *dev)
 {
struct panel_drv_data *ddata = dev_get_drvdata(>dev);
-   struct omap_dss_device *src = ddata->src;
int r = 0;
int level;
 
@@ -313,15 +312,11 @@ static int dsicm_bl_update_status(struct backlight_device 
*dev)
mutex_lock(>lock);
 
if (ddata->enabled) {
-   src->ops->dsi.bus_lock(src);
-
r = dsicm_wake_up(ddata);
if (!r) {
r = dsicm_dcs_write_1(ddata,
MIPI_DCS_SET_DISPLAY_BRIGHTNESS, level);
}
-
-   src->ops->dsi.bus_unlock(src);
}
 
mutex_unlock(>lock);
@@ -347,21 +342,16 @@ static ssize_t dsicm_num_errors_show(struct device *dev,
struct device_attribute *attr, char *buf)
 {
struct panel_drv_data *ddata = dev_get_drvdata(dev);
-   struct omap_dss_device *src = ddata->src;
u8 errors = 0;
int r;
 
mutex_lock(>lock);
 
if (ddata->enabled) {
-   src->ops->dsi.bus_lock(src);
-
r = dsicm_wake_up(ddata);
if (!r)
r = dsicm_dcs_read_1(ddata, DCS_READ_NUM_ERRORS,
);
-
-   src->ops->dsi.bus_unlock(src);
} else {
r = -ENODEV;
}
@@ -378,20 +368,15 @@ static ssize_t dsicm_hw_revision_show(struct device *dev,
struct device_attribute *attr, char *buf)
 {
struct panel_drv_data *ddata = dev_get_drvdata(dev);
-   struct omap_dss_device *src = ddata->src;
u8 id1, id2, id3;
int r;
 
mutex_lock(>lock);
 
if (ddata->enabled) {
-   src->ops->dsi.bus_lock(src);
-
r = dsicm_wake_up(ddata);
if (!r)
r = dsicm_get_id(ddata, , , );
-
-   src->ops->dsi.bus_unlock(src);
} else {
r = -ENODEV;
}
@@ -409,7 +394,6 @@ static ssize_t dsicm_store_ulps(struct device *dev,
const char *buf, size_t count)
 {
struct panel_drv_data *ddata = dev_get_drvdata(dev);
-   struct omap_dss_device *src = ddata->src;
unsigned long t;
int r;
 
@@ -420,14 +404,10 @@ static ssize_t dsicm_store_ulps(struct device *dev,
mutex_lock(>lock);
 
if (ddata->enabled) {
-   src->ops->dsi.bus_lock(src);
-
if (t)
r = dsicm_enter_ulps(ddata);
else
r = dsicm_wake_up(ddata);
-
-   src->ops->dsi.bus_unlock(src);
}
 
mutex_unlock(>lock);
@@ -457,7 +437,6 @@ static ssize_t dsicm_store_ulps_timeout(struct device *dev,
const char *buf, size_t count)
 {
struct panel_drv_data *ddata = dev_get_drvdata(dev);
-   struct omap_dss_device *src = ddata->src;
unsigned long t;
int r;
 
@@ -470,9 +449,7 @@ static ssize_t dsicm_store_ulps_timeout(struct device *dev,
 
if (ddata->enabled) {
/* dsicm_wake_up will restart the timer */
-   src->ops->dsi.bus_lock(src);
r = dsicm_wake_up(ddata);
-   src->ops->dsi.bus_unlock(src);
}
 
mutex_unlock(>lock);
@@ -673,17 +650,11 @@ static void dsicm_disconnect(struct omap_dss_device *src,
 static void dsicm_enable(struct omap_dss_device *dssdev)
 {
struct panel_drv_data *ddata = to_panel_data(dssdev);
-   struct omap_dss_device *src = ddata->src;
int r;
 
mutex_lock(>lock);
 
-   src->ops->dsi.bus_lock(src);
-
r = dsicm_power_on(ddata);
-
-   src->ops->dsi.bus_unlock(src);
-
if (r)
goto err;
 
@@ -700,7 +671,6 @@ static void dsicm_enable(struct omap_dss_device *dssdev)
 static void dsicm_disable(struct omap_dss_device *dssdev)
 {
struct panel_drv_data *ddata = to_panel_data(dssdev);
-   struct omap_dss_device *src = ddata->src;
int r;
 
dsicm_bl_power(ddata, false);
@@ -709,24 +679,19 @@ static void dsicm_disable(struct omap_dss_device *dssdev)
 

[PATCH v3 49/56] drm/omap: simplify DSI manual update code

2020-11-05 Thread Tomi Valkeinen
From: Sebastian Reichel 

Move dsi_ops into the main structure, since all other ops
are gone. Instead of checking the device type we can simply
check if dsi_ops are set.

Signed-off-by: Sebastian Reichel 
Signed-off-by: Tomi Valkeinen 
---
 drivers/gpu/drm/omapdrm/dss/dsi.c | 10 --
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  6 +-
 drivers/gpu/drm/omapdrm/omap_crtc.c   | 16 
 3 files changed, 9 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
b/drivers/gpu/drm/omapdrm/dss/dsi.c
index bbcdb62e1571..f47d7e3bb631 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -5011,11 +5011,9 @@ static int dsi_get_clocks(struct dsi_data *dsi)
return 0;
 }
 
-static const struct omap_dss_device_ops dsi_ops = {
-   .dsi = {
-   .update = dsi_update_all,
-   .is_video_mode = dsi_is_video_mode,
-   },
+static const struct omapdss_dsi_ops dsi_ops = {
+   .update = dsi_update_all,
+   .is_video_mode = dsi_is_video_mode,
 };
 
 static irqreturn_t omap_dsi_te_irq_handler(int irq, void *dev_id)
@@ -5450,7 +5448,7 @@ static int dsi_init_output(struct dsi_data *dsi)
out->type = OMAP_DISPLAY_TYPE_DSI;
out->name = dsi->module_id == 0 ? "dsi.0" : "dsi.1";
out->dispc_channel = dsi_get_channel(dsi);
-   out->ops = _ops;
+   out->dsi_ops = _ops;
out->owner = THIS_MODULE;
out->of_port = 0;
out->bus_flags = DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index c2199c4946ec..a1236b8ef7ea 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -275,10 +275,6 @@ struct omapdss_dsi_ops {
bool (*is_video_mode)(struct omap_dss_device *dssdev);
 };
 
-struct omap_dss_device_ops {
-   const struct omapdss_dsi_ops dsi;
-};
-
 struct omap_dss_device {
struct device *dev;
 
@@ -300,7 +296,7 @@ struct omap_dss_device {
 
const char *name;
 
-   const struct omap_dss_device_ops *ops;
+   const struct omapdss_dsi_ops *dsi_ops;
u32 bus_flags;
 
/* OMAP DSS output specific fields */
diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c 
b/drivers/gpu/drm/omapdrm/omap_crtc.c
index f6b968060cf0..5ab557c477ef 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -366,17 +366,10 @@ static void omap_crtc_manual_display_update(struct 
work_struct *data)
struct drm_device *dev = omap_crtc->base.dev;
int ret;
 
-   if (!dssdev) {
-   dev_err_once(dev->dev, "missing display dssdev!");
+   if (!dssdev || !dssdev->dsi_ops || !dssdev->dsi_ops->update)
return;
-   }
-
-   if (dssdev->type != OMAP_DISPLAY_TYPE_DSI || !dssdev->ops->dsi.update) {
-   dev_err_once(dev->dev, "no DSI update callback found!");
-   return;
-   }
 
-   ret = dssdev->ops->dsi.update(dssdev);
+   ret = dssdev->dsi_ops->update(dssdev);
if (ret < 0) {
spin_lock_irq(>event_lock);
omap_crtc->pending = false;
@@ -550,11 +543,10 @@ static bool omap_crtc_is_manually_updated(struct drm_crtc 
*crtc)
struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
struct omap_dss_device *dssdev = omap_crtc->pipe->output;
 
-   if (dssdev->type != OMAP_DISPLAY_TYPE_DSI ||
-   !dssdev->ops->dsi.is_video_mode)
+   if (!dssdev || !dssdev->dsi_ops || !dssdev->dsi_ops->is_video_mode)
return false;
 
-   if (dssdev->ops->dsi.is_video_mode(dssdev))
+   if (dssdev->dsi_ops->is_video_mode(dssdev))
return false;
 
DBG("detected manually updated display!");
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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


[PATCH v3 40/56] drm/panel: Move OMAP's DSI command mode panel driver

2020-11-05 Thread Tomi Valkeinen
From: Sebastian Reichel 

The panel driver is no longer using any OMAP specific APIs, so
let's move it into the generic panel directory.

Signed-off-by: Sebastian Reichel 
Signed-off-by: Tomi Valkeinen 
Cc: Thierry Reding 
Cc: Sam Ravnborg 
---
 drivers/gpu/drm/omapdrm/Kconfig|  1 -
 drivers/gpu/drm/omapdrm/Makefile   |  1 -
 drivers/gpu/drm/omapdrm/displays/Kconfig   | 10 --
 drivers/gpu/drm/omapdrm/displays/Makefile  |  2 --
 drivers/gpu/drm/panel/Kconfig  |  9 +
 drivers/gpu/drm/panel/Makefile |  1 +
 .../gpu/drm/{omapdrm/displays => panel}/panel-dsi-cm.c |  0
 7 files changed, 10 insertions(+), 14 deletions(-)
 delete mode 100644 drivers/gpu/drm/omapdrm/displays/Kconfig
 delete mode 100644 drivers/gpu/drm/omapdrm/displays/Makefile
 rename drivers/gpu/drm/{omapdrm/displays => panel}/panel-dsi-cm.c (100%)

diff --git a/drivers/gpu/drm/omapdrm/Kconfig b/drivers/gpu/drm/omapdrm/Kconfig
index 5417e7a47072..cea3f44ea6d4 100644
--- a/drivers/gpu/drm/omapdrm/Kconfig
+++ b/drivers/gpu/drm/omapdrm/Kconfig
@@ -12,6 +12,5 @@ config DRM_OMAP
 if DRM_OMAP
 
 source "drivers/gpu/drm/omapdrm/dss/Kconfig"
-source "drivers/gpu/drm/omapdrm/displays/Kconfig"
 
 endif
diff --git a/drivers/gpu/drm/omapdrm/Makefile b/drivers/gpu/drm/omapdrm/Makefile
index f115253115c5..66a73eae6f7c 100644
--- a/drivers/gpu/drm/omapdrm/Makefile
+++ b/drivers/gpu/drm/omapdrm/Makefile
@@ -5,7 +5,6 @@
 #
 
 obj-y += dss/
-obj-y += displays/
 
 omapdrm-y := omap_drv.o \
omap_irq.o \
diff --git a/drivers/gpu/drm/omapdrm/displays/Kconfig 
b/drivers/gpu/drm/omapdrm/displays/Kconfig
deleted file mode 100644
index f2be594c7eff..
--- a/drivers/gpu/drm/omapdrm/displays/Kconfig
+++ /dev/null
@@ -1,10 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-menu "OMAPDRM External Display Device Drivers"
-
-config DRM_OMAP_PANEL_DSI_CM
-   tristate "Generic DSI Command Mode Panel"
-   depends on BACKLIGHT_CLASS_DEVICE
-   help
- Driver for generic DSI command mode panels.
-
-endmenu
diff --git a/drivers/gpu/drm/omapdrm/displays/Makefile 
b/drivers/gpu/drm/omapdrm/displays/Makefile
deleted file mode 100644
index 488ddf153613..
--- a/drivers/gpu/drm/omapdrm/displays/Makefile
+++ /dev/null
@@ -1,2 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-obj-$(CONFIG_DRM_OMAP_PANEL_DSI_CM) += panel-dsi-cm.o
diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index b9dbedf8f15e..a71f95afc52e 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -48,6 +48,15 @@ config DRM_PANEL_BOE_TV101WUM_NL6
  Say Y here if you want to support for BOE TV101WUM and AUO KD101N80
  45NA WUXGA PANEL DSI Video Mode panel
 
+config DRM_PANEL_DSI_CM
+   tristate "Generic DSI command mode panels"
+   depends on OF
+   depends on DRM_MIPI_DSI
+   depends on BACKLIGHT_CLASS_DEVICE
+   help
+ DRM panel driver for DSI command mode panels with support for
+ embedded and external backlights.
+
 config DRM_PANEL_LVDS
tristate "Generic LVDS panel driver"
depends on OF
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index 2ba560bca61d..c553e968e9a9 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -3,6 +3,7 @@ obj-$(CONFIG_DRM_PANEL_ARM_VERSATILE) += panel-arm-versatile.o
 obj-$(CONFIG_DRM_PANEL_ASUS_Z00T_TM5P5_NT35596) += 
panel-asus-z00t-tm5p5-n35596.o
 obj-$(CONFIG_DRM_PANEL_BOE_HIMAX8279D) += panel-boe-himax8279d.o
 obj-$(CONFIG_DRM_PANEL_BOE_TV101WUM_NL6) += panel-boe-tv101wum-nl6.o
+obj-$(CONFIG_DRM_PANEL_DSI_CM) += panel-dsi-cm.o
 obj-$(CONFIG_DRM_PANEL_LVDS) += panel-lvds.o
 obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o
 obj-$(CONFIG_DRM_PANEL_ELIDA_KD35T133) += panel-elida-kd35t133.o
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/panel/panel-dsi-cm.c
similarity index 100%
rename from drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
rename to drivers/gpu/drm/panel/panel-dsi-cm.c
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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


[PATCH v3 29/56] drm/omap: dsi: do ULPS in host driver

2020-11-05 Thread Tomi Valkeinen
From: Sebastian Reichel 

Move ULPS handling into the DSI host controller, so that we
no longer need a custom API for the DSI client.

Signed-off-by: Sebastian Reichel 
Signed-off-by: Tomi Valkeinen 
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 273 +-
 drivers/gpu/drm/omapdrm/dss/dsi.c |  63 +++-
 drivers/gpu/drm/omapdrm/dss/omapdss.h |   2 -
 3 files changed, 62 insertions(+), 276 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 78247dcb1848..030a8fa140db 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -16,7 +16,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
@@ -69,21 +68,13 @@ struct panel_drv_data {
 
bool intro_printed;
 
-   struct workqueue_struct *workqueue;
-
bool ulps_enabled;
-   unsigned int ulps_timeout;
-   struct delayed_work ulps_work;
 };
 
 #define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev)
 
 static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable);
 
-static int dsicm_panel_reset(struct panel_drv_data *ddata);
-
-static void dsicm_ulps_work(struct work_struct *work);
-
 static void dsicm_bl_power(struct panel_drv_data *ddata, bool enable)
 {
struct backlight_device *backlight;
@@ -207,94 +198,6 @@ static int dsicm_set_update_window(struct panel_drv_data 
*ddata,
return 0;
 }
 
-static void dsicm_queue_ulps_work(struct panel_drv_data *ddata)
-{
-   if (ddata->ulps_timeout > 0)
-   queue_delayed_work(ddata->workqueue, >ulps_work,
-   msecs_to_jiffies(ddata->ulps_timeout));
-}
-
-static void dsicm_cancel_ulps_work(struct panel_drv_data *ddata)
-{
-   cancel_delayed_work(>ulps_work);
-}
-
-static int dsicm_enter_ulps(struct panel_drv_data *ddata)
-{
-   struct omap_dss_device *src = ddata->src;
-   int r;
-
-   if (ddata->ulps_enabled)
-   return 0;
-
-   dsicm_cancel_ulps_work(ddata);
-
-   r = _dsicm_enable_te(ddata, false);
-   if (r)
-   goto err;
-
-   src->ops->dsi.ulps(src, true);
-
-   ddata->ulps_enabled = true;
-
-   return 0;
-
-err:
-   dev_err(>dsi->dev, "enter ULPS failed");
-   dsicm_panel_reset(ddata);
-
-   ddata->ulps_enabled = false;
-
-   dsicm_queue_ulps_work(ddata);
-
-   return r;
-}
-
-static int dsicm_exit_ulps(struct panel_drv_data *ddata)
-{
-   struct omap_dss_device *src = ddata->src;
-   int r;
-
-   if (!ddata->ulps_enabled)
-   return 0;
-
-   src->ops->dsi.ulps(src, false);
-   ddata->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
-
-   r = _dsicm_enable_te(ddata, ddata->te_enabled);
-   if (r) {
-   dev_err(>dsi->dev, "failed to re-enable TE");
-   goto err2;
-   }
-
-   dsicm_queue_ulps_work(ddata);
-
-   ddata->ulps_enabled = false;
-
-   return 0;
-
-err2:
-   dev_err(>dsi->dev, "failed to exit ULPS");
-
-   r = dsicm_panel_reset(ddata);
-   if (!r)
-   ddata->ulps_enabled = false;
-
-   dsicm_queue_ulps_work(ddata);
-
-   return r;
-}
-
-static int dsicm_wake_up(struct panel_drv_data *ddata)
-{
-   if (ddata->ulps_enabled)
-   return dsicm_exit_ulps(ddata);
-
-   dsicm_cancel_ulps_work(ddata);
-   dsicm_queue_ulps_work(ddata);
-   return 0;
-}
-
 static int dsicm_bl_update_status(struct backlight_device *dev)
 {
struct panel_drv_data *ddata = dev_get_drvdata(>dev);
@@ -312,11 +215,8 @@ static int dsicm_bl_update_status(struct backlight_device 
*dev)
mutex_lock(>lock);
 
if (ddata->enabled) {
-   r = dsicm_wake_up(ddata);
-   if (!r) {
-   r = dsicm_dcs_write_1(ddata,
-   MIPI_DCS_SET_DISPLAY_BRIGHTNESS, level);
-   }
+   r = dsicm_dcs_write_1(ddata, MIPI_DCS_SET_DISPLAY_BRIGHTNESS,
+ level);
}
 
mutex_unlock(>lock);
@@ -343,18 +243,12 @@ static ssize_t dsicm_num_errors_show(struct device *dev,
 {
struct panel_drv_data *ddata = dev_get_drvdata(dev);
u8 errors = 0;
-   int r;
+   int r = -ENODEV;
 
mutex_lock(>lock);
 
-   if (ddata->enabled) {
-   r = dsicm_wake_up(ddata);
-   if (!r)
-   r = dsicm_dcs_read_1(ddata, DCS_READ_NUM_ERRORS,
-   );
-   } else {
-   r = -ENODEV;
-   }
+   if (ddata->enabled)
+   r = dsicm_dcs_read_1(ddata, DCS_READ_NUM_ERRORS, );
 
mutex_unlock(>lock);
 
@@ -369,17 +263,12 @@ static ssize_t dsicm_hw_revision_show(struct device *dev,
 {
struct panel_drv_data *ddata = dev_get_drvdata(dev);
u8 id1, id2, id3;
-   int r;
+   int r 

[PATCH v3 28/56] drm/omap: dsi: untangle ulps ops from enable/disable

2020-11-05 Thread Tomi Valkeinen
From: Sebastian Reichel 

Create a custom function pointer for ULPS and use it instead of
reusing disable/enable functions for ULPS mode switch. This allows
us to use the common disable/enable functions pointers for DSI.

Signed-off-by: Sebastian Reichel 
Signed-off-by: Tomi Valkeinen 
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  8 ++--
 drivers/gpu/drm/omapdrm/dss/dsi.c | 42 ++-
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  5 +--
 3 files changed, 38 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 4be0c9dbcc43..78247dcb1848 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -233,7 +233,7 @@ static int dsicm_enter_ulps(struct panel_drv_data *ddata)
if (r)
goto err;
 
-   src->ops->dsi.disable(src, false, true);
+   src->ops->dsi.ulps(src, true);
 
ddata->ulps_enabled = true;
 
@@ -258,7 +258,7 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
if (!ddata->ulps_enabled)
return 0;
 
-   src->ops->enable(src);
+   src->ops->dsi.ulps(src, false);
ddata->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
 
r = _dsicm_enable_te(ddata, ddata->te_enabled);
@@ -586,7 +586,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 
dsicm_hw_reset(ddata);
 
-   src->ops->dsi.disable(src, true, false);
+   src->ops->disable(src);
 err_regulators:
r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
if (r)
@@ -612,7 +612,7 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
dsicm_hw_reset(ddata);
}
 
-   src->ops->dsi.disable(src, true, false);
+   src->ops->disable(src);
 
r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
if (r)
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
b/drivers/gpu/drm/omapdrm/dss/dsi.c
index d54b743c2b48..937362ade4b4 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -4055,13 +4055,10 @@ static void dsi_display_uninit_dsi(struct dsi_data 
*dsi, bool disconnect_lanes,
}
 }
 
-static void dsi_display_enable(struct omap_dss_device *dssdev)
+static void dsi_display_ulps_enable(struct dsi_data *dsi)
 {
-   struct dsi_data *dsi = to_dsi_data(dssdev);
int r;
 
-   DSSDBG("dsi_display_enable\n");
-
WARN_ON(!dsi_bus_is_locked(dsi));
 
mutex_lock(>lock);
@@ -4084,16 +4081,19 @@ static void dsi_display_enable(struct omap_dss_device 
*dssdev)
dsi_runtime_put(dsi);
 err_get_dsi:
mutex_unlock(>lock);
-   DSSDBG("dsi_display_enable FAILED\n");
+   DSSDBG("dsi_display_ulps_enable FAILED\n");
 }
 
-static void dsi_display_disable(struct omap_dss_device *dssdev,
-   bool disconnect_lanes, bool enter_ulps)
+static void dsi_display_enable(struct omap_dss_device *dssdev)
 {
struct dsi_data *dsi = to_dsi_data(dssdev);
+   DSSDBG("dsi_display_enable\n");
+   dsi_display_ulps_enable(dsi);
+}
 
-   DSSDBG("dsi_display_disable\n");
-
+static void dsi_display_ulps_disable(struct dsi_data *dsi,
+   bool disconnect_lanes, bool enter_ulps)
+{
WARN_ON(!dsi_bus_is_locked(dsi));
 
mutex_lock(>lock);
@@ -4110,6 +4110,27 @@ static void dsi_display_disable(struct omap_dss_device 
*dssdev,
mutex_unlock(>lock);
 }
 
+static void dsi_display_disable(struct omap_dss_device *dssdev)
+{
+   struct dsi_data *dsi = to_dsi_data(dssdev);
+
+   DSSDBG("dsi_display_disable\n");
+
+   dsi_display_ulps_disable(dsi, true, false);
+}
+
+static void dsi_ulps(struct omap_dss_device *dssdev, bool enable)
+{
+   struct dsi_data *dsi = to_dsi_data(dssdev);
+
+   DSSDBG("dsi_ulps\n");
+
+   if (enable)
+   dsi_display_ulps_disable(dsi, false, true);
+   else
+   dsi_display_ulps_enable(dsi);
+}
+
 static int dsi_enable_te(struct dsi_data *dsi, bool enable)
 {
dsi->te_enabled = enable;
@@ -4812,9 +4833,10 @@ static const struct omap_dss_device_ops dsi_ops = {
.connect = dsi_connect,
.disconnect = dsi_disconnect,
.enable = dsi_display_enable,
+   .disable = dsi_display_disable,
 
.dsi = {
-   .disable = dsi_display_disable,
+   .ulps = dsi_ulps,
 
.set_config = dsi_set_config,
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 43eba2ea1f96..0d82ba34ca89 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -281,10 +281,9 @@ struct omap_dss_writeback_info {
 };
 
 struct omapdss_dsi_ops {
-   void (*disable)(struct omap_dss_device *dssdev, bool disconnect_lanes,
-   bool enter_ulps);
-
/* bus configuration */

  1   2   3   4   >