Re: [PATCH] tracing/treewide: Remove second parameter of __assign_str()

2024-05-17 Thread Guenter Roeck

On 5/17/24 11:00, Guenter Roeck wrote:

On 5/17/24 10:48, Steven Rostedt wrote:

On Fri, 17 May 2024 10:36:37 -0700
Guenter Roeck  wrote:


Building csky:allmodconfig (and others) ... failed
--
Error log:
In file included from include/trace/trace_events.h:419,
  from include/trace/define_trace.h:102,
  from drivers/cxl/core/trace.h:737,
  from drivers/cxl/core/trace.c:8:
drivers/cxl/core/./trace.h:383:1: error: macro "__assign_str" passed 2 
arguments, but takes just 1

This is with the patch applied on top of v6.9-8410-gff2632d7d08e.
So far that seems to be the only build failure.
Introduced with commit 6aec00139d3a8 ("cxl/core: Add region info to
cxl_general_media and cxl_dram events"). Guess we'll see more of those
towards the end of the commit window.


Looks like I made this patch just before this commit was pulled into
Linus's tree.

Which is why I'll apply and rerun the above again probably on Tuesday of
next week against Linus's latest.

This patch made it through both an allyesconfig and an allmodconfig, but on
the commit I had applied it to, which was:

   1b294a1f3561 ("Merge tag 'net-next-6.10' of 
git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next")

I'll be compiling those two builds after I update it then.



I am currently repeating my test builds with the above errors fixed.
That should take a couple of hours. I'll let you know how it goes.



There are no more build failures caused by this patch after fixing the above
errors.

Tested-by: Guenter Roeck 

Guenter



Re: [PATCH] tracing/treewide: Remove second parameter of __assign_str()

2024-05-17 Thread Guenter Roeck

On 5/17/24 10:48, Steven Rostedt wrote:

On Fri, 17 May 2024 10:36:37 -0700
Guenter Roeck  wrote:


Building csky:allmodconfig (and others) ... failed
--
Error log:
In file included from include/trace/trace_events.h:419,
  from include/trace/define_trace.h:102,
  from drivers/cxl/core/trace.h:737,
  from drivers/cxl/core/trace.c:8:
drivers/cxl/core/./trace.h:383:1: error: macro "__assign_str" passed 2 
arguments, but takes just 1

This is with the patch applied on top of v6.9-8410-gff2632d7d08e.
So far that seems to be the only build failure.
Introduced with commit 6aec00139d3a8 ("cxl/core: Add region info to
cxl_general_media and cxl_dram events"). Guess we'll see more of those
towards the end of the commit window.


Looks like I made this patch just before this commit was pulled into
Linus's tree.

Which is why I'll apply and rerun the above again probably on Tuesday of
next week against Linus's latest.

This patch made it through both an allyesconfig and an allmodconfig, but on
the commit I had applied it to, which was:

   1b294a1f3561 ("Merge tag 'net-next-6.10' of 
git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next")

I'll be compiling those two builds after I update it then.



I am currently repeating my test builds with the above errors fixed.
That should take a couple of hours. I'll let you know how it goes.

Guenter



Re: [PATCH] tracing/treewide: Remove second parameter of __assign_str()

2024-05-17 Thread Guenter Roeck
On Thu, May 16, 2024 at 01:34:54PM -0400, Steven Rostedt wrote:
> From: "Steven Rostedt (Google)" 
> 
> [
>This is a treewide change. I will likely re-create this patch again in
>the second week of the merge window of v6.10 and submit it then. Hoping
>to keep the conflicts that it will cause to a minimum.
> ]
> 
> With the rework of how the __string() handles dynamic strings where it
> saves off the source string in field in the helper structure[1], the
> assignment of that value to the trace event field is stored in the helper
> value and does not need to be passed in again.
> 
> This means that with:
> 
>   __string(field, mystring)
> 
> Which use to be assigned with __assign_str(field, mystring), no longer
> needs the second parameter and it is unused. With this, __assign_str()
> will now only get a single parameter.
> 
> There's over 700 users of __assign_str() and because coccinelle does not
> handle the TRACE_EVENT() macro I ended up using the following sed script:
> 
>   git grep -l __assign_str | while read a ; do
>   sed -e 's/\(__assign_str([^,]*[^ ,]\) *,[^;]*/\1)/' $a > /tmp/test-file;
>   mv /tmp/test-file $a;
>   done
> 
> I then searched for __assign_str() that did not end with ';' as those
> were multi line assignments that the sed script above would fail to catch.
> 

Building csky:allmodconfig (and others) ... failed
--
Error log:
In file included from include/trace/trace_events.h:419,
 from include/trace/define_trace.h:102,
 from drivers/cxl/core/trace.h:737,
 from drivers/cxl/core/trace.c:8:
drivers/cxl/core/./trace.h:383:1: error: macro "__assign_str" passed 2 
arguments, but takes just 1

This is with the patch applied on top of v6.9-8410-gff2632d7d08e.
So far that seems to be the only build failure.
Introduced with commit 6aec00139d3a8 ("cxl/core: Add region info to
cxl_general_media and cxl_dram events"). Guess we'll see more of those
towards the end of the commit window.

Guenter


Re: [PATCH v2 1/4] drm/msm/dp: Avoid a long timeout for AUX transfer if nothing connected

2024-03-15 Thread Guenter Roeck
On Fri, Mar 15, 2024 at 2:37 PM Douglas Anderson  wrote:
>
> As documented in the description of the transfer() function of
> "struct drm_dp_aux", the transfer() function can be called at any time
> regardless of the state of the DP port. Specifically if the kernel has
> the DP AUX character device enabled and userspace accesses
> "/dev/drm_dp_auxN" directly then the AUX transfer function will be
> called regardless of whether a DP device is connected.
>
> For eDP panels we have a special rule where we wait (with a 5 second
> timeout) for HPD to go high. This rule was important before all panels
> drivers were converted to call wait_hpd_asserted() and actually can be
> removed in a future commit.
>
> For external DP devices we never checked for HPD. That means that
> trying to access the DP AUX character device (AKA `hexdump -C
> /dev/drm_dp_auxN`) would very, very slowly timeout. Specifically on my
> system:
>   $ time hexdump -C /dev/drm_dp_aux0
>   hexdump: /dev/drm_dp_aux0: Connection timed out
>   real0m8.200s
> We want access to the drm_dp_auxN character device to fail faster than
> 8 seconds when no DP cable is plugged in.
>
> Let's add a test to make transfers fail right away if a device isn't
> plugged in. Rather than testing the HPD line directly, we have the
> dp_display module tell us when AUX transfers should be enabled so we
> can handle cases where HPD is signaled out of band like with Type C.
>
> Fixes: c943b4948b58 ("drm/msm/dp: add displayPort driver support")
> Signed-off-by: Douglas Anderson 

Reviewed-by: Guenter Roeck 

> ---
>
> Changes in v2:
> - Don't look at the HPD line directly; have dp_display call us.
>
>  drivers/gpu/drm/msm/dp/dp_aux.c | 20 
>  drivers/gpu/drm/msm/dp/dp_aux.h |  1 +
>  drivers/gpu/drm/msm/dp/dp_display.c |  4 
>  3 files changed, 25 insertions(+)
>
> diff --git a/drivers/gpu/drm/msm/dp/dp_aux.c b/drivers/gpu/drm/msm/dp/dp_aux.c
> index 03f4951c49f4..e67a80d56948 100644
> --- a/drivers/gpu/drm/msm/dp/dp_aux.c
> +++ b/drivers/gpu/drm/msm/dp/dp_aux.c
> @@ -35,6 +35,7 @@ struct dp_aux_private {
> bool no_send_stop;
> bool initted;
> bool is_edp;
> +   bool enable_xfers;
> u32 offset;
> u32 segment;
>
> @@ -301,6 +302,17 @@ static ssize_t dp_aux_transfer(struct drm_dp_aux *dp_aux,
> goto exit;
> }
>
> +   /*
> +* If we're using DP and an external display isn't connected then the
> +* transfer won't succeed. Return right away. If we don't do this we
> +* can end up with long timeouts if someone tries to access the DP AUX
> +* character device when no DP device is connected.
> +*/
> +   if (!aux->is_edp && !aux->enable_xfers) {
> +   ret = -ENXIO;
> +   goto exit;
> +   }
> +
> /*
>  * For eDP it's important to give a reasonably long wait here for HPD
>  * to be asserted. This is because the panel driver may have _just_
> @@ -433,6 +445,14 @@ irqreturn_t dp_aux_isr(struct drm_dp_aux *dp_aux)
> return IRQ_HANDLED;
>  }
>
> +void dp_aux_enable_xfers(struct drm_dp_aux *dp_aux, bool enabled)
> +{
> +   struct dp_aux_private *aux;
> +
> +   aux = container_of(dp_aux, struct dp_aux_private, dp_aux);
> +   aux->enable_xfers = enabled;
> +}
> +
>  void dp_aux_reconfig(struct drm_dp_aux *dp_aux)
>  {
> struct dp_aux_private *aux;
> diff --git a/drivers/gpu/drm/msm/dp/dp_aux.h b/drivers/gpu/drm/msm/dp/dp_aux.h
> index 511305da4f66..f3052cb43306 100644
> --- a/drivers/gpu/drm/msm/dp/dp_aux.h
> +++ b/drivers/gpu/drm/msm/dp/dp_aux.h
> @@ -12,6 +12,7 @@
>  int dp_aux_register(struct drm_dp_aux *dp_aux);
>  void dp_aux_unregister(struct drm_dp_aux *dp_aux);
>  irqreturn_t dp_aux_isr(struct drm_dp_aux *dp_aux);
> +void dp_aux_enable_xfers(struct drm_dp_aux *dp_aux, bool enabled);
>  void dp_aux_init(struct drm_dp_aux *dp_aux);
>  void dp_aux_deinit(struct drm_dp_aux *dp_aux);
>  void dp_aux_reconfig(struct drm_dp_aux *dp_aux);
> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c 
> b/drivers/gpu/drm/msm/dp/dp_display.c
> index 4c72124ffb5d..b0f3e2ef5a6b 100644
> --- a/drivers/gpu/drm/msm/dp/dp_display.c
> +++ b/drivers/gpu/drm/msm/dp/dp_display.c
> @@ -565,6 +565,8 @@ static int dp_hpd_plug_handle(struct dp_display_private 
> *dp, u32 data)
> int ret;
> struct platform_device *pdev = dp->dp_display.pdev;
>
> +   dp_aux_enable_xfers(dp->aux, true);
> +
> mutex_lock(>event_mutex);
>
> state =  dp->hpd_state;
> @@ -629,6 +631,8 @@ static int dp_hpd_unplug_handle(struct dp_display_private 
> *dp, u32 data)
> u32 state;
> struct platform_device *pdev = dp->dp_display.pdev;
>
> +   dp_aux_enable_xfers(dp->aux, false);
> +
> mutex_lock(>event_mutex);
>
> state = dp->hpd_state;
> --
> 2.44.0.291.gc1ea87d7ee-goog
>


Re: [PATCH 1/3] drm/msm/dp: Avoid a long timeout for AUX transfer if nothing connected

2024-03-12 Thread Guenter Roeck
On Tue, Mar 12, 2024 at 5:14 PM Douglas Anderson  wrote:
>
> As documented in the description of the transfer() function of
> "struct drm_dp_aux", the transfer() function can be called at any time
> regardless of the state of the DP port. Specifically if the kernel has
> the DP AUX character device enabled and userspace accesses
> "/dev/drm_dp_auxN" directly then the AUX transfer function will be
> called regardless of whether a DP device is connected.
>
> For eDP panels we have a special rule where we wait (with a 5 second
> timeout) for HPD to go high. This rule was important before all panels
> drivers were converted to call wait_hpd_asserted() and actually can be
> removed in a future commit.
>
> For external DP devices we never checked for HPD. That means that
> trying to access the DP AUX character device (AKA `hexdump -C
> /dev/drm_dp_auxN`) would very, very slowly timeout. Specifically on my
> system:
>   $ time hexdump -C /dev/drm_dp_aux0
>   hexdump: /dev/drm_dp_aux0: Connection timed out
>
>   real0m8.200s
>
> Let's add a check for HPD to avoid the slow timeout. This matches
> what, for instance, the intel_dp_aux_xfer() function does when it
> calls intel_tc_port_connected_locked(). That call has a document by it
> explaining that it's important to avoid the long timeouts.
>
> Fixes: c943b4948b58 ("drm/msm/dp: add displayPort driver support")
> Signed-off-by: Douglas Anderson 
> ---
>
>  drivers/gpu/drm/msm/dp/dp_aux.c |  8 +++-
>  drivers/gpu/drm/msm/dp/dp_catalog.c | 10 ++
>  drivers/gpu/drm/msm/dp/dp_catalog.h |  1 +
>  3 files changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/msm/dp/dp_aux.c b/drivers/gpu/drm/msm/dp/dp_aux.c
> index 03f4951c49f4..de0b0eabced9 100644
> --- a/drivers/gpu/drm/msm/dp/dp_aux.c
> +++ b/drivers/gpu/drm/msm/dp/dp_aux.c
> @@ -307,7 +307,8 @@ static ssize_t dp_aux_transfer(struct drm_dp_aux *dp_aux,
>  * turned on the panel and then tried to do an AUX transfer. The panel
>  * driver has no way of knowing when the panel is ready, so it's up
>  * to us to wait. For DP we never get into this situation so let's
> -* avoid ever doing the extra long wait for DP.
> +* avoid ever doing the extra long wait for DP and just query HPD
> +* directly.
>  */
> if (aux->is_edp) {
> ret = dp_catalog_aux_wait_for_hpd_connect_state(aux->catalog);
> @@ -315,6 +316,11 @@ static ssize_t dp_aux_transfer(struct drm_dp_aux *dp_aux,
> DRM_DEBUG_DP("Panel not ready for aux 
> transactions\n");
> goto exit;
> }
> +   } else {
> +   if (!dp_catalog_aux_is_hpd_connected(aux->catalog)) {
> +   ret = -ENXIO;
> +   goto exit;
> +   }
> }
>
> dp_aux_update_offset_and_segment(aux, msg);
> diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.c 
> b/drivers/gpu/drm/msm/dp/dp_catalog.c
> index 5142aeb705a4..93e2d413a1e7 100644
> --- a/drivers/gpu/drm/msm/dp/dp_catalog.c
> +++ b/drivers/gpu/drm/msm/dp/dp_catalog.c
> @@ -266,6 +266,16 @@ int dp_catalog_aux_wait_for_hpd_connect_state(struct 
> dp_catalog *dp_catalog)
> 2000, 50);
>  }
>
> +bool dp_catalog_aux_is_hpd_connected(struct dp_catalog *dp_catalog)
> +{
> +   struct dp_catalog_private *catalog = container_of(dp_catalog,
> +   struct dp_catalog_private, dp_catalog);
> +
> +   /* poll for hpd connected status every 2ms and timeout after 500ms */

Maybe I am missing something, but the comment doesn't seem to match
the code below.

Guenter

> +   return readl(catalog->io->dp_controller.aux.base + 
> REG_DP_DP_HPD_INT_STATUS) &
> +  DP_DP_HPD_STATE_STATUS_CONNECTED;
> +}
> +
>  static void dump_regs(void __iomem *base, int len)
>  {
> int i;
> diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.h 
> b/drivers/gpu/drm/msm/dp/dp_catalog.h
> index 38786e855b51..1694040c530f 100644
> --- a/drivers/gpu/drm/msm/dp/dp_catalog.h
> +++ b/drivers/gpu/drm/msm/dp/dp_catalog.h
> @@ -86,6 +86,7 @@ void dp_catalog_aux_reset(struct dp_catalog *dp_catalog);
>  void dp_catalog_aux_enable(struct dp_catalog *dp_catalog, bool enable);
>  void dp_catalog_aux_update_cfg(struct dp_catalog *dp_catalog);
>  int dp_catalog_aux_wait_for_hpd_connect_state(struct dp_catalog *dp_catalog);
> +bool dp_catalog_aux_is_hpd_connected(struct dp_catalog *dp_catalog);
>  u32 dp_catalog_aux_get_irq(struct dp_catalog *dp_catalog);
>
>  /* DP Controller APIs */
> --
> 2.44.0.278.ge034bb2e1d-goog
>


Re: [Freedreno] [PATCH] drm/msm: Remove redundant check for 'submit'

2022-10-11 Thread Guenter Roeck
On Tue, Oct 11, 2022 at 12:55 AM Aashish Sharma  wrote:
>
> Rectify the below smatch warning:
> drivers/gpu/drm/msm/msm_gem_submit.c:963 msm_ioctl_gem_submit() warn:
> variable dereferenced before check 'submit'
>
> 'submit' is normally error pointer or valid, so remove its NULL
> initializer as it's confusing and also remove a redundant check for it's
> value.
>
> Signed-off-by: Aashish Sharma 
> Reported-by: kernel test robot 
> Reported-by: Dan Carpenter 

Reviewed-by: Guenter Roeck 

> ---
>  drivers/gpu/drm/msm/msm_gem_submit.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c 
> b/drivers/gpu/drm/msm/msm_gem_submit.c
> index 5599d93ec0d2..74fe1c56cd65 100644
> --- a/drivers/gpu/drm/msm/msm_gem_submit.c
> +++ b/drivers/gpu/drm/msm/msm_gem_submit.c
> @@ -706,7 +706,7 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void 
> *data,
> struct msm_drm_private *priv = dev->dev_private;
> struct drm_msm_gem_submit *args = data;
> struct msm_file_private *ctx = file->driver_priv;
> -   struct msm_gem_submit *submit = NULL;
> +   struct msm_gem_submit *submit;
> struct msm_gpu *gpu = priv->gpu;
> struct msm_gpu_submitqueue *queue;
> struct msm_ringbuffer *ring;
> @@ -946,8 +946,7 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void 
> *data,
> put_unused_fd(out_fence_fd);
> mutex_unlock(>lock);
>  out_post_unlock:
> -   if (submit)
> -   msm_gem_submit_put(submit);
> +   msm_gem_submit_put(submit);
> if (!IS_ERR_OR_NULL(post_deps)) {
> for (i = 0; i < args->nr_out_syncobjs; ++i) {
> kfree(post_deps[i].chain);
> --
> 2.38.0.rc2.412.g84df46c1b4-goog
>


Re: [Freedreno] [PATCH] drm/msm/adreno: Do not propagate void return values

2022-05-20 Thread Guenter Roeck

On 5/20/22 05:53, Geert Uytterhoeven wrote:

With sparse ("make C=2"), lots of

   error: return expression in void function

messages are seen.

Fix this by removing the return statements to propagate void return
values.

Signed-off-by: Geert Uytterhoeven 


Reviewed-by: Guenter Roeck 


---
  drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 2 +-
  drivers/gpu/drm/msm/adreno/a6xx_gmu.h | 4 ++--
  drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 2 +-
  3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c 
b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
index 3e325e2a2b1b68eb..d137136d93f3b4ca 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
@@ -504,7 +504,7 @@ static void a6xx_rpmh_stop(struct a6xx_gmu *gmu)
  
  static inline void pdc_write(void __iomem *ptr, u32 offset, u32 value)

  {
-   return msm_writel(value, ptr + (offset << 2));
+   msm_writel(value, ptr + (offset << 2));
  }
  
  static void __iomem *a6xx_gmu_get_mmio(struct platform_device *pdev,

diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.h 
b/drivers/gpu/drm/msm/adreno/a6xx_gmu.h
index 84bd516f01e895b2..e034935b3986f9f2 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.h
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.h
@@ -98,7 +98,7 @@ static inline u32 gmu_read(struct a6xx_gmu *gmu, u32 offset)
  
  static inline void gmu_write(struct a6xx_gmu *gmu, u32 offset, u32 value)

  {
-   return msm_writel(value, gmu->mmio + (offset << 2));
+   msm_writel(value, gmu->mmio + (offset << 2));
  }
  
  static inline void

@@ -138,7 +138,7 @@ static inline u32 gmu_read_rscc(struct a6xx_gmu *gmu, u32 
offset)
  
  static inline void gmu_write_rscc(struct a6xx_gmu *gmu, u32 offset, u32 value)

  {
-   return msm_writel(value, gmu->rscc + (offset << 2));
+   msm_writel(value, gmu->rscc + (offset << 2));
  }
  
  #define gmu_poll_timeout_rscc(gmu, addr, val, cond, interval, timeout) \

diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
index ccc4fcf7a630f49a..d671b75f3289fdff 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
@@ -1446,7 +1446,7 @@ static void a6xx_llc_rmw(struct a6xx_gpu *a6xx_gpu, u32 
reg, u32 mask, u32 or)
  
  static void a6xx_llc_write(struct a6xx_gpu *a6xx_gpu, u32 reg, u32 value)

  {
-   return msm_writel(value, a6xx_gpu->llc_mmio + (reg << 2));
+   msm_writel(value, a6xx_gpu->llc_mmio + (reg << 2));
  }
  
  static void a6xx_llc_deactivate(struct a6xx_gpu *a6xx_gpu)




Re: [Freedreno] [PATCH] dt-bindings: More use 'enum' instead of 'oneOf' plus 'const' entries

2021-09-10 Thread Guenter Roeck

On 9/10/21 9:51 AM, Rob Herring wrote:

'enum' is equivalent to 'oneOf' with a list of 'const' entries, but 'enum'
is more concise and yields better error messages.

Fix a couple more cases which have appeared.

Cc: Rob Clark 
Cc: Sean Paul 
Cc: Mark Brown 
Cc: Wim Van Sebroeck 
Cc: Guenter Roeck 
Cc: Jonathan Marek 
Cc: Aswath Govindraju 
Cc: Marc Zyngier 
Cc: Linus Walleij 
Cc: dri-de...@lists.freedesktop.org
Cc: freedreno@lists.freedesktop.org
Cc: linux-...@vger.kernel.org
Cc: linux-watch...@vger.kernel.org
Signed-off-by: Rob Herring 
---
  .../bindings/display/msm/dsi-phy-7nm.yaml  |  8 
  .../devicetree/bindings/spi/omap-spi.yaml  |  6 +++---
  .../bindings/watchdog/maxim,max63xx.yaml   | 14 +++---


For watchdog:

Acked-by: Guenter Roeck 


  3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/Documentation/devicetree/bindings/display/msm/dsi-phy-7nm.yaml 
b/Documentation/devicetree/bindings/display/msm/dsi-phy-7nm.yaml
index 4265399bb154..c851770bbdf2 100644
--- a/Documentation/devicetree/bindings/display/msm/dsi-phy-7nm.yaml
+++ b/Documentation/devicetree/bindings/display/msm/dsi-phy-7nm.yaml
@@ -14,10 +14,10 @@ allOf:
  
  properties:

compatible:
-oneOf:
-  - const: qcom,dsi-phy-7nm
-  - const: qcom,dsi-phy-7nm-8150
-  - const: qcom,sc7280-dsi-phy-7nm
+enum:
+  - qcom,dsi-phy-7nm
+  - qcom,dsi-phy-7nm-8150
+  - qcom,sc7280-dsi-phy-7nm
  
reg:

  items:
diff --git a/Documentation/devicetree/bindings/spi/omap-spi.yaml 
b/Documentation/devicetree/bindings/spi/omap-spi.yaml
index e55538186cf6..9952199cae11 100644
--- a/Documentation/devicetree/bindings/spi/omap-spi.yaml
+++ b/Documentation/devicetree/bindings/spi/omap-spi.yaml
@@ -84,9 +84,9 @@ unevaluatedProperties: false
  if:
properties:
  compatible:
-  oneOf:
-- const: ti,omap2-mcspi
-- const: ti,omap4-mcspi
+  enum:
+- ti,omap2-mcspi
+- ti,omap4-mcspi
  
  then:

properties:
diff --git a/Documentation/devicetree/bindings/watchdog/maxim,max63xx.yaml 
b/Documentation/devicetree/bindings/watchdog/maxim,max63xx.yaml
index f2105eedac2c..ab9641e845db 100644
--- a/Documentation/devicetree/bindings/watchdog/maxim,max63xx.yaml
+++ b/Documentation/devicetree/bindings/watchdog/maxim,max63xx.yaml
@@ -15,13 +15,13 @@ maintainers:
  
  properties:

compatible:
-oneOf:
-  - const: maxim,max6369
-  - const: maxim,max6370
-  - const: maxim,max6371
-  - const: maxim,max6372
-  - const: maxim,max6373
-  - const: maxim,max6374
+enum:
+  - maxim,max6369
+  - maxim,max6370
+  - maxim,max6371
+  - maxim,max6372
+  - maxim,max6373
+  - maxim,max6374
  
reg:

  description: This is a 1-byte memory-mapped address





[Freedreno] [PATCH] drm/msm/disp/dpu1/dpu_encoder: Drop unnecessary NULL checks after container_of

2021-05-25 Thread Guenter Roeck
The result of container_of() operations is never NULL unless the embedded
element is the first element of the structure. This is not the case here.
The NULL checks on the result of container_of() are therefore unnecessary
and misleading. Remove them.

This change was made automatically with the following Coccinelle script.

@@
type t;
identifier v;
statement s;
@@

<+...
(
  t v = container_of(...);
|
  v = container_of(...);
)
  ...
  when != v
- if (\( !v \| v == NULL \) ) s
...+>

Signed-off-by: Guenter Roeck 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 10 --
 1 file changed, 10 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
index 8d942052db8a..a573fe211375 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
@@ -1453,11 +1453,6 @@ static void dpu_encoder_off_work(struct work_struct 
*work)
struct dpu_encoder_virt *dpu_enc = container_of(work,
struct dpu_encoder_virt, delayed_off_work.work);
 
-   if (!dpu_enc) {
-   DPU_ERROR("invalid dpu encoder\n");
-   return;
-   }
-
dpu_encoder_resource_control(_enc->base,
DPU_ENC_RC_EVENT_ENTER_IDLE);
 
@@ -1797,11 +1792,6 @@ static void dpu_encoder_vsync_event_work_handler(struct 
kthread_work *work)
struct dpu_encoder_virt, vsync_event_work);
ktime_t wakeup_time;
 
-   if (!dpu_enc) {
-   DPU_ERROR("invalid dpu encoder\n");
-   return;
-   }
-
if (dpu_encoder_vsync_time(_enc->base, _time))
return;
 
-- 
2.25.1

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [PATCH] drm/msm/dp: Drop unnecessary NULL checks after container_of

2021-05-24 Thread Guenter Roeck
The result of container_of() operations is never NULL unless the embedded
element is the first element of the structure. This is not the case here.
The NULL check on the result of container_of() is therefore unnecessary
and misleading. Remove it.

This change was made automatically with the following Coccinelle script.

@@
type t;
identifier v;
statement s;
@@

<+...
(
  t v = container_of(...);
|
  v = container_of(...);
)
  ...
  when != v
- if (\( !v \| v == NULL \) ) s
...+>

While at it, remove unused but assigned variable hpd in
dp_display_usbpd_attention_cb().

Signed-off-by: Guenter Roeck 
---
 drivers/gpu/drm/msm/dp/dp_display.c | 25 -
 1 file changed, 25 deletions(-)

diff --git a/drivers/gpu/drm/msm/dp/dp_display.c 
b/drivers/gpu/drm/msm/dp/dp_display.c
index 1784e119269b..a74e7ef96fcf 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.c
+++ b/drivers/gpu/drm/msm/dp/dp_display.c
@@ -208,10 +208,6 @@ static int dp_display_bind(struct device *dev, struct 
device *master,
 
dp = container_of(g_dp_display,
struct dp_display_private, dp_display);
-   if (!dp) {
-   DRM_ERROR("DP driver bind failed. Invalid driver data\n");
-   return -EINVAL;
-   }
 
dp->dp_display.drm_dev = drm;
priv = drm->dev_private;
@@ -252,10 +248,6 @@ static void dp_display_unbind(struct device *dev, struct 
device *master,
 
dp = container_of(g_dp_display,
struct dp_display_private, dp_display);
-   if (!dp) {
-   DRM_ERROR("Invalid DP driver data\n");
-   return;
-   }
 
dp_power_client_deinit(dp->power);
dp_aux_unregister(dp->aux);
@@ -406,11 +398,6 @@ static int dp_display_usbpd_configure_cb(struct device 
*dev)
 
dp = container_of(g_dp_display,
struct dp_display_private, dp_display);
-   if (!dp) {
-   DRM_ERROR("no driver data found\n");
-   rc = -ENODEV;
-   goto end;
-   }
 
dp_display_host_init(dp, false);
 
@@ -437,11 +424,6 @@ static int dp_display_usbpd_disconnect_cb(struct device 
*dev)
 
dp = container_of(g_dp_display,
struct dp_display_private, dp_display);
-   if (!dp) {
-   DRM_ERROR("no driver data found\n");
-   rc = -ENODEV;
-   return rc;
-   }
 
dp_add_event(dp, EV_USER_NOTIFICATION, false, 0);
 
@@ -502,7 +484,6 @@ static int dp_display_usbpd_attention_cb(struct device *dev)
int rc = 0;
u32 sink_request;
struct dp_display_private *dp;
-   struct dp_usbpd *hpd;
 
if (!dev) {
DRM_ERROR("invalid dev\n");
@@ -511,12 +492,6 @@ static int dp_display_usbpd_attention_cb(struct device 
*dev)
 
dp = container_of(g_dp_display,
struct dp_display_private, dp_display);
-   if (!dp) {
-   DRM_ERROR("no driver data found\n");
-   return -ENODEV;
-   }
-
-   hpd = dp->usbpd;
 
/* check for any test request issued by sink */
rc = dp_link_process_request(dp->link);
-- 
2.25.1

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


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

2020-08-23 Thread Guenter Roeck
On Mon, Aug 10, 2020 at 04:26:53PM -0600, Jordan Crouse wrote:
> Add support to create a io-pgtable for use by targets that support
> per-instance pagetables. In order to support per-instance pagetables the
> GPU SMMU device needs to have the qcom,adreno-smmu compatible string and
> split pagetables enabled.
> 
> Signed-off-by: Jordan Crouse 

This patch adds a hard dependency on IOMMU_IO_PGTABLE (for
alloc_io_pgtable_ops and free_io_pgtable_ops).

Guenter

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

Re: [Freedreno] [PATCH v6 19/24] drm/bridge: dumb-vga-dac: Provide ddc symlink in connector sysfs directory

2019-08-07 Thread Guenter Roeck
On Fri, Jul 26, 2019 at 07:23:13PM +0200, Andrzej Pietrasiewicz wrote:
> Use the ddc pointer provided by the generic connector.
> 
> Signed-off-by: Andrzej Pietrasiewicz 
> Reviewed-by: Neil Armstrong 

This patch results in a crash when running qemu:versatilepb.

Unable to handle kernel NULL pointer dereference at virtual address 00c5
pgd = (ptrval)
[00c5] *pgd=
Internal error: Oops: 5 [#1] ARM
Modules linked in:
CPU: 0 PID: 1 Comm: swapper Not tainted 5.3.0-rc1+ #1
Hardware name: ARM-Versatile (Device Tree Support)
PC is at sysfs_do_create_link_sd+0x38/0xd8
LR is at sysfs_do_create_link_sd+0x38/0xd8
pc : []lr : []psr: a153
sp : c783bd18  ip :   fp : c783bde8
r10: c7ef5ea8  r9 : 0001  r8 : c0955dc0
r7 : c73cb5b0  r6 : c73cd800  r5 : 00ad  r4 : 
r3 : c7838ae0  r2 :   r1 : 0008  r0 : c0aa2898
Flags: NzCv  IRQs on  FIQs off  Mode SVC_32  ISA ARM  Segment none
Control: 00093177  Table: 4000  DAC: 0053
Process swapper (pid: 1, stack limit = 0x(ptrval))
Stack: (0xc783bd18 to 0xc783c000)
bd00:   c73ccc48 c73ccc74
bd20: c73cd800 c0ac7c88  c729cc80 c7ef5ea8 c04c7fc0 c73ccc48 c0a73068
bd40: c73cd800 c0ac7c88  c04c87e0 0001  c04cefcc c04dc3f8
bd60: c73a9030 c73cd800 c73ccc48 7fc2ce37  c73cd800  c04cefcc
bd80: c73cd800   c04b4ebc c0a73068 c7ef5ea8 c783bde8 c049ffcc
bda0: c73a9020 c73cd800 c78e6000 c73a9020  c73a9020 c0a73068 c04df2f8
bdc0: c783bde8 c095a76c c73a9020 c0065744 c73ccc20 c73a9020  0001
bde0: c7838ae0  c73ccc20 7fc2ce37  c78e6000  c0ac7c34
be00: c07dc1f8   c0a6b384 c0a59858 c045e8d8 c78e6000 c1173a78
be20:  c0ac7c34  c04e77c4 c78e6000 c0ac7c34 c0ac7c34 c0a73068
be40:  e000 c0a6b384 c04e7a34 c0ac7c34 c0ac7c34 c0a73068 c78e6000
be60:  c0ac7c34 c0a73068  e000 c0a6b384 c0a59858 c04e7cf0
be80:  c0ac7c34 c78e6000 c04e7d7c  c0ac7c34 c04e7cf8 c04e5928
bea0: c73b2800 c78d88a0 c78dd110 7fc2ce37 e000 c0ac7c34 c73b2800 c0ac16e0
bec0:  c04e6b28 c095a73c c0af0a60 c0a73068 c0ac7c34 c0af0a60 c0a73068
bee0: c0a401c4 c04e8968 e000 c0af0a60 c0a73068 c000b3bc 0115 
bf00: c7ffce6c c7ffce00 c09e15b0 0115 0115 c0048844 c09e000c c097cfd4
bf20:  0006 0006   c7ffce6c e000 c006954c
bf40: e000 7fc2ce37 c0afb000 c0af0a60 0115 c0afb000 0007 c0a59850
bf60: e000 c0a111e8 0006 0006  c0a10678  7fc2ce37
bf80:   c07824cc     
bfa0:  c07824d4  c00090b0    
bfc0:        
bfe0:     0013   
[] (sysfs_do_create_link_sd) from [] 
(drm_connector_register.part.1+0x40/0xa0)
[] (drm_connector_register.part.1) from [] 
(drm_connector_register_all+0x90/0xb8)
[] (drm_connector_register_all) from [] 
(drm_modeset_register_all+0x44/0x6c)
[] (drm_modeset_register_all) from [] 
(drm_dev_register+0x15c/0x1c0)
[] (drm_dev_register) from [] (pl111_amba_probe+0x2e0/0x4ac)
[] (pl111_amba_probe) from [] (amba_probe+0x9c/0x118)
[] (amba_probe) from [] (really_probe+0x1c0/0x2bc)
[] (really_probe) from [] (driver_probe_device+0x5c/0x170)
[] (driver_probe_device) from [] 
(device_driver_attach+0x58/0x60)
[] (device_driver_attach) from [] 
(__driver_attach+0x84/0xc0)
[] (__driver_attach) from [] (bus_for_each_dev+0x70/0xb4)
[] (bus_for_each_dev) from [] (bus_add_driver+0x154/0x1e0)
[] (bus_add_driver) from [] (driver_register+0x74/0x108)
[] (driver_register) from [] (do_one_initcall+0x84/0x2e4)
[] (do_one_initcall) from [] 
(kernel_init_freeable+0x2bc/0x394)
[] (kernel_init_freeable) from [] (kernel_init+0x8/0xf0)
[] (kernel_init) from [] (ret_from_fork+0x14/0x24)
Exception stack(0xc783bfb0 to 0xc783bff8)
bfa0:    
bfc0:        
bfe0:     0013 
Code: e59f00a0 e1a09003 e1a08002 eb176e54 (e5955018) 
---[ end trace f503b374936886c5 ]---

Bisect log attached.

Guenter

---
# bad: [3880be629e26f6c407593602398c6651860d5fae] Add linux-next specific files 
for 20190807
# good: [e21a712a9685488f5ce80495b37b9fdbe96c230d] Linux 5.3-rc3
git bisect start 'HEAD' 'v5.3-rc3'
# good: [83d74da9e6d2ca78b32e9e794c6bcbd433d5efaa] Merge remote-tracking branch 
'crypto/master'
git bisect good 83d74da9e6d2ca78b32e9e794c6bcbd433d5efaa
# bad: [3add021bff629f1792a5e4268afe13b3047b5523] Merge remote-tracking branch 
'sound/for-next'
git bisect bad 3add021bff629f1792a5e4268afe13b3047b5523
# good: [4ef58ee18a654b1992d00281501d6eff051a0c5e] Merge remote-tracking branch 
'amdgpu/drm-next'

Re: [Freedreno] [PATCH] qcom-scm: Include header

2019-01-04 Thread Guenter Roeck
On Wed, Dec 26, 2018 at 10:06:19AM -0200, Fabio Estevam wrote:
> Since commit e6f6d63ed14c ("drm/msm: add headless gpu device for imx5")
> the DRM_MSM symbol can be selected by SOC_IMX5 causing the following
> error when building imx_v6_v7_defconfig:
> 
> In file included from ../drivers/gpu/drm/msm/adreno/a5xx_gpu.c:17:0:
> ../include/linux/qcom_scm.h: In function 'qcom_scm_set_cold_boot_addr':
> ../include/linux/qcom_scm.h:73:10: error: 'ENODEV' undeclared (first use in 
> this function)
>   return -ENODEV;
> 
> Include the  header file to fix this problem.
> 
> Reported-by: kernelci.org bot 
> Fixes: e6f6d63ed14c ("drm/msm: add headless gpu device for imx5")
> Signed-off-by: Fabio Estevam 
> Reviewed-by: Bjorn Andersson 

Tested-by: Guenter Roeck 

Still broken upstream, and the commit window is about to close.
Any chance to send this patch upstream anytime soon ?

Guenter

> ---
>  include/linux/qcom_scm.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/include/linux/qcom_scm.h b/include/linux/qcom_scm.h
> index 06996ad4f2bc..ce5a476fd733 100644
> --- a/include/linux/qcom_scm.h
> +++ b/include/linux/qcom_scm.h
> @@ -13,6 +13,7 @@
>  #ifndef __QCOM_SCM_H
>  #define __QCOM_SCM_H
>  
> +#include 
>  #include 
>  #include 
>  
___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno