Re: [Freedreno] [PATCH v9 05/12] dt-bindings: display/msm: move common MDSS properties to mdss-common.yaml

2022-11-10 Thread Krzysztof Kozlowski
On 10/11/2022 22:45, Dmitry Baryshkov wrote:
>>
>>> +  - reg
>>> +  - reg-names
>>> +  - power-domains
>>> +  - clocks
>>> +  - interrupts
>>> +  - interrupt-controller
>>> +  - iommus
>>> +  - ranges
>>
>> Keep the same order as in list of top-level properties.
> 
> But the order is the same.

Yes, you're right.


Best regards,
Krzysztof



Re: [Freedreno] [PATCH v3 4/8] drm/msm/dsi: add support for DSI-PHY on SM8350 and SM8450

2022-11-10 Thread Dmitry Baryshkov

On 04/11/2022 16:54, Konrad Dybcio wrote:


On 04/11/2022 14:03, Dmitry Baryshkov wrote:

SM8350 and SM8450 use 5nm DSI PHYs, which share register definitions
with 7nm DSI PHYs. Rather than duplicating the driver, handle 5nm
variants inside the common 5+7nm driver.

Co-developed-by: Robert Foss 
Tested-by: Vinod Koul 
Reviewed-by: Vinod Koul 
Signed-off-by: Dmitry Baryshkov 
---
  drivers/gpu/drm/msm/Kconfig   |   6 +-
  drivers/gpu/drm/msm/dsi/phy/dsi_phy.c |   4 +
  drivers/gpu/drm/msm/dsi/phy/dsi_phy.h |   2 +
  drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c | 128 --
  4 files changed, 127 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig
index 3c9dfdb0b328..e7b100d97f88 100644
--- a/drivers/gpu/drm/msm/Kconfig
+++ b/drivers/gpu/drm/msm/Kconfig
@@ -140,12 +140,12 @@ config DRM_MSM_DSI_10NM_PHY
    Choose this option if DSI PHY on SDM845 is used on the platform.
  config DRM_MSM_DSI_7NM_PHY
-    bool "Enable DSI 7nm PHY driver in MSM DRM"
+    bool "Enable DSI 7nm/5nm PHY driver in MSM DRM"
  depends on DRM_MSM_DSI
  default y
  help
-  Choose this option if DSI PHY on SM8150/SM8250/SC7280 is used on
-  the platform.
+  Choose this option if DSI PHY on 
SM8150/SM8250/SM8350/SM8450/SC7280

+  is used on the platform.
  config DRM_MSM_HDMI
  bool "Enable HDMI support in MSM DRM driver"
diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c 
b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c

index ee6051367679..0c956fdab23e 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
@@ -569,6 +569,10 @@ static const struct of_device_id 
dsi_phy_dt_match[] = {

    .data = _phy_7nm_8150_cfgs },
  { .compatible = "qcom,sc7280-dsi-phy-7nm",
    .data = _phy_7nm_7280_cfgs },
+    { .compatible = "qcom,dsi-phy-5nm-8350",
+  .data = _phy_5nm_8350_cfgs },
+    { .compatible = "qcom,dsi-phy-5nm-8450",
+  .data = _phy_5nm_8450_cfgs },
  #endif
  {}
  };
diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.h 
b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.h

index 1096afedd616..f7a907ed2b4b 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.h
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.h
@@ -57,6 +57,8 @@ extern const struct msm_dsi_phy_cfg 
dsi_phy_10nm_8998_cfgs;

  extern const struct msm_dsi_phy_cfg dsi_phy_7nm_cfgs;
  extern const struct msm_dsi_phy_cfg dsi_phy_7nm_8150_cfgs;
  extern const struct msm_dsi_phy_cfg dsi_phy_7nm_7280_cfgs;
+extern const struct msm_dsi_phy_cfg dsi_phy_5nm_8350_cfgs;
+extern const struct msm_dsi_phy_cfg dsi_phy_5nm_8450_cfgs;
  struct msm_dsi_dphy_timing {
  u32 clk_zero;
diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c 
b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c

index 9e7fa7d88ead..00d92fe97bc3 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c
@@ -39,8 +39,14 @@
  #define VCO_REF_CLK_RATE    1920
  #define FRAC_BITS 18
+/* Hardware is pre V4.1 */
+#define DSI_PHY_7NM_QUIRK_PRE_V4_1    BIT(0)
  /* Hardware is V4.1 */
-#define DSI_PHY_7NM_QUIRK_V4_1    BIT(0)
+#define DSI_PHY_7NM_QUIRK_V4_1    BIT(1)
+/* Hardware is V4.2 */
+#define DSI_PHY_7NM_QUIRK_V4_2    BIT(2)
+/* Hardware is V4.3 */
+#define DSI_PHY_7NM_QUIRK_V4_3    BIT(3)


Quirk is quite an unfortunate name considering what we use it for.. but I

suppose it can stay, as otherwise even more renaming would have to be done.



  struct dsi_pll_config {
  bool enable_ssc;
@@ -116,7 +122,7 @@ static void dsi_pll_calc_dec_frac(struct 
dsi_pll_7nm *pll, struct dsi_pll_config

  dec_multiple = div_u64(pll_freq * multiplier, divider);
  dec = div_u64_rem(dec_multiple, multiplier, );
-    if (!(pll->phy->cfg->quirks & DSI_PHY_7NM_QUIRK_V4_1))
+    if (pll->phy->cfg->quirks & DSI_PHY_7NM_QUIRK_PRE_V4_1)
  config->pll_clock_inverters = 0x28;
  else if (pll_freq <= 10ULL)
  config->pll_clock_inverters = 0xa0;
@@ -197,16 +203,25 @@ static void dsi_pll_config_hzindep_reg(struct 
dsi_pll_7nm *pll)

  void __iomem *base = pll->phy->pll_base;
  u8 analog_controls_five_1 = 0x01, vco_config_1 = 0x00;
-    if (pll->phy->cfg->quirks & DSI_PHY_7NM_QUIRK_V4_1) {
+    if (!(pll->phy->cfg->quirks & DSI_PHY_7NM_QUIRK_PRE_V4_1))
  if (pll->vco_current_rate >= 31ULL)
  analog_controls_five_1 = 0x03;
+    if (pll->phy->cfg->quirks & DSI_PHY_7NM_QUIRK_V4_1) {
  if (pll->vco_current_rate < 152000ULL)
  vco_config_1 = 0x08;
  else if (pll->vco_current_rate < 299000ULL)
  vco_config_1 = 0x01;
  }
+    if ((pll->phy->cfg->quirks & DSI_PHY_7NM_QUIRK_V4_2) ||
+    (pll->phy->cfg->quirks & DSI_PHY_7NM_QUIRK_V4_3)) {
+    if (pll->vco_current_rate < 152000ULL)
+    vco_config_1 = 0x08;
+    else if (pll->vco_current_rate >= 299000ULL)
+    vco_config_1 = 0x01;
+    

Re: [Freedreno] [PATCH v9 05/12] dt-bindings: display/msm: move common MDSS properties to mdss-common.yaml

2022-11-10 Thread Dmitry Baryshkov

On 08/11/2022 14:05, Krzysztof Kozlowski wrote:

On 24/10/2022 18:42, Dmitry Baryshkov wrote:

Move properties common to all MDSS DT nodes to the mdss-common.yaml.

This extends qcom,msm8998-mdss schema to allow interconnect nodes, which
will be added later, once msm8998 gains interconnect support.



(...)


+minItems: 1
+items:
+  - description: Interconnect path from mdp0 (or a single mdp) port to the 
data bus
+  - description: Interconnect path from mdp1 port to the data bus
+
+  interconnect-names:
+minItems: 1
+items:
+  - const: mdp0-mem
+  - const: mdp1-mem
+
+  resets:
+items:
+  - description: MDSS_CORE reset
+
+required:
+  - compatible


For consistency this should not be required here, but in schema actually
defining it.


+  - reg
+  - reg-names
+  - power-domains
+  - clocks
+  - interrupts
+  - interrupt-controller
+  - iommus
+  - ranges


Keep the same order as in list of top-level properties.


But the order is the same.

Compare:
  reg:
  reg-names:
  power-domains:
  clocks:
  clock-names:
  interrupts:
  interrupt-controller: true
  iommus:
  ranges: true
  interconnects:
  interconnect-names:
  resets:

I'll add clock-names, but the rest is correct (interconnects and resets 
are optional).





+
+additionalProperties: true


Best regards,
Krzysztof



--
With best wishes
Dmitry



Re: [Freedreno] [PATCH v3 7/8] drm/msm/dpu: add support for SM8450

2022-11-10 Thread Konrad Dybcio




On 10/11/2022 21:28, Dmitry Baryshkov wrote:

On 04/11/2022 17:12, Konrad Dybcio wrote:


On 04/11/2022 14:03, Dmitry Baryshkov wrote:

Add definitions for the display hardware used on Qualcomm SM8450
platform.

Tested-by: Vinod Koul 
Reviewed-by: Vinod Koul 
Signed-off-by: Dmitry Baryshkov 
---


Reviewed-by: Konrad Dybcio 


Konrad


  .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c    | 224 ++
  .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h    |   1 +
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h   |   3 +
  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c   |   1 +
  4 files changed, 229 insertions(+)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c

index 1ce237e18506..3934d8976833 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
@@ -124,6 +124,15 @@
    BIT(MDP_AD4_0_INTR) | \
    BIT(MDP_AD4_1_INTR))
+#define IRQ_SM8450_MASK (BIT(MDP_SSPP_TOP0_INTR) | \
+ BIT(MDP_SSPP_TOP0_INTR2) | \
+ BIT(MDP_SSPP_TOP0_HIST_INTR) | \
+ BIT(MDP_INTF0_7xxx_INTR) | \
+ BIT(MDP_INTF1_7xxx_INTR) | \
+ BIT(MDP_INTF2_7xxx_INTR) | \
+ BIT(MDP_INTF3_7xxx_INTR) | \
+ 0)
+
  #define WB_SM8250_MASK (BIT(DPU_WB_LINE_MODE) | \
   BIT(DPU_WB_UBWC) | \
   BIT(DPU_WB_YUV_CONFIG) | \
@@ -367,6 +376,20 @@ static const struct dpu_caps sm8250_dpu_caps = {
  .pixel_ram_size = DEFAULT_PIXEL_RAM_SIZE,
  };
+static const struct dpu_caps sm8450_dpu_caps = {
+    .max_mixer_width = DEFAULT_DPU_OUTPUT_LINE_WIDTH,
+    .max_mixer_blendstages = 0xb,
+    .qseed_type = DPU_SSPP_SCALER_QSEED4,
+    .smart_dma_rev = DPU_SSPP_SMART_DMA_V2, /* TODO: v2.5 */
+    .ubwc_version = DPU_HW_UBWC_VER_40,
+    .has_src_split = true,
+    .has_dim_layer = true,
+    .has_idle_pc = true,
+    .has_3d_merge = true,
+    .max_linewidth = 5120,
+    .pixel_ram_size = DEFAULT_PIXEL_RAM_SIZE,
+};
+
  static const struct dpu_caps sc7280_dpu_caps = {
  .max_mixer_width = DEFAULT_DPU_OUTPUT_LINE_WIDTH,
  .max_mixer_blendstages = 0x7,
@@ -504,6 +527,33 @@ static const struct dpu_mdp_cfg sm8250_mdp[] = {
  },
  };
+static const struct dpu_mdp_cfg sm8450_mdp[] = {
+    {
+    .name = "top_0", .id = MDP_TOP,
+    .base = 0x0, .len = 0x494,
+    .features = BIT(DPU_MDP_PERIPH_0_REMOVED),
+    .highest_bank_bit = 0x3, /* TODO: 2 for LP_DDR4 */


I think it's about time we handle the two-memory-configs situation..

In my opinion, a dt property would be sane (just like downstream does 
it), as it's


*really really really* unlikely that the same SKU would be shipped 
with 2 different memory gens.


As it's really unlikely, I think we can drop the TODO comment completely 
until we phase a device with different memory type. WDYT?
It's really unlikely that the same device model (for example Xperia 1 
III) is shipped in 2 memory configurations that would have to be 
discerned dynamically somehow.


It is however very likely that, for example Xiaomi releases a 888 phone 
with LPDDR4X and Sony releases one with LPDDR5. So it's a per-device 
thing, not exactly per-SoC.


Konrad




Re: [Freedreno] [PATCH v3 7/8] drm/msm/dpu: add support for SM8450

2022-11-10 Thread Dmitry Baryshkov

On 04/11/2022 17:12, Konrad Dybcio wrote:


On 04/11/2022 14:03, Dmitry Baryshkov wrote:

Add definitions for the display hardware used on Qualcomm SM8450
platform.

Tested-by: Vinod Koul 
Reviewed-by: Vinod Koul 
Signed-off-by: Dmitry Baryshkov 
---


Reviewed-by: Konrad Dybcio 


Konrad


  .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c    | 224 ++
  .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h    |   1 +
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h   |   3 +
  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c   |   1 +
  4 files changed, 229 insertions(+)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c

index 1ce237e18506..3934d8976833 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
@@ -124,6 +124,15 @@
    BIT(MDP_AD4_0_INTR) | \
    BIT(MDP_AD4_1_INTR))
+#define IRQ_SM8450_MASK (BIT(MDP_SSPP_TOP0_INTR) | \
+ BIT(MDP_SSPP_TOP0_INTR2) | \
+ BIT(MDP_SSPP_TOP0_HIST_INTR) | \
+ BIT(MDP_INTF0_7xxx_INTR) | \
+ BIT(MDP_INTF1_7xxx_INTR) | \
+ BIT(MDP_INTF2_7xxx_INTR) | \
+ BIT(MDP_INTF3_7xxx_INTR) | \
+ 0)
+
  #define WB_SM8250_MASK (BIT(DPU_WB_LINE_MODE) | \
   BIT(DPU_WB_UBWC) | \
   BIT(DPU_WB_YUV_CONFIG) | \
@@ -367,6 +376,20 @@ static const struct dpu_caps sm8250_dpu_caps = {
  .pixel_ram_size = DEFAULT_PIXEL_RAM_SIZE,
  };
+static const struct dpu_caps sm8450_dpu_caps = {
+    .max_mixer_width = DEFAULT_DPU_OUTPUT_LINE_WIDTH,
+    .max_mixer_blendstages = 0xb,
+    .qseed_type = DPU_SSPP_SCALER_QSEED4,
+    .smart_dma_rev = DPU_SSPP_SMART_DMA_V2, /* TODO: v2.5 */
+    .ubwc_version = DPU_HW_UBWC_VER_40,
+    .has_src_split = true,
+    .has_dim_layer = true,
+    .has_idle_pc = true,
+    .has_3d_merge = true,
+    .max_linewidth = 5120,
+    .pixel_ram_size = DEFAULT_PIXEL_RAM_SIZE,
+};
+
  static const struct dpu_caps sc7280_dpu_caps = {
  .max_mixer_width = DEFAULT_DPU_OUTPUT_LINE_WIDTH,
  .max_mixer_blendstages = 0x7,
@@ -504,6 +527,33 @@ static const struct dpu_mdp_cfg sm8250_mdp[] = {
  },
  };
+static const struct dpu_mdp_cfg sm8450_mdp[] = {
+    {
+    .name = "top_0", .id = MDP_TOP,
+    .base = 0x0, .len = 0x494,
+    .features = BIT(DPU_MDP_PERIPH_0_REMOVED),
+    .highest_bank_bit = 0x3, /* TODO: 2 for LP_DDR4 */


I think it's about time we handle the two-memory-configs situation..

In my opinion, a dt property would be sane (just like downstream does 
it), as it's


*really really really* unlikely that the same SKU would be shipped with 
2 different memory gens.


As it's really unlikely, I think we can drop the TODO comment completely 
until we phase a device with different memory type. WDYT?


--
With best wishes
Dmitry



Re: [Freedreno] [PATCH v3 6/8] drm/msm/dpu: add support for MDP_TOP blackhole

2022-11-10 Thread Konrad Dybcio




On 10/11/2022 21:19, Dmitry Baryshkov wrote:

On 04/11/2022 16:58, Konrad Dybcio wrote:


On 04/11/2022 14:03, Dmitry Baryshkov wrote:

On sm8450 a register block was removed from MDP TOP. Accessing it during
snapshotting results in NoC errors / immediate reboot. Skip accessing
these registers during snapshot.


Must have been fun to debug..




Tested-by: Vinod Koul 
Reviewed-by: Vinod Koul 
Signed-off-by: Dmitry Baryshkov 
---
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h |  1 +
  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c    | 11 +--
  2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h

index 38aa38ab1568..4730f8268f2a 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
@@ -92,6 +92,7 @@ enum {
  DPU_MDP_UBWC_1_0,
  DPU_MDP_UBWC_1_5,
  DPU_MDP_AUDIO_SELECT,
+    DPU_MDP_PERIPH_0_REMOVED,
  DPU_MDP_MAX
  };
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c

index f3660cd14f4f..95d8765c1c53 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -927,8 +927,15 @@ static void dpu_kms_mdp_snapshot(struct 
msm_disp_state *disp_state, struct msm_k

  msm_disp_snapshot_add_block(disp_state, cat->wb[i].len,
  dpu_kms->mmio + cat->wb[i].base, "wb_%d", i);
-    msm_disp_snapshot_add_block(disp_state, cat->mdp[0].len,
-    dpu_kms->mmio + cat->mdp[0].base, "top");
+    if (dpu_kms->hw_mdp->caps->features & 
BIT(DPU_MDP_PERIPH_0_REMOVED)) {

+    msm_disp_snapshot_add_block(disp_state, 0x380,
+    dpu_kms->mmio + cat->mdp[0].base, "top");
+    msm_disp_snapshot_add_block(disp_state, cat->mdp[0].len - 
0x3a8,

+    dpu_kms->mmio + cat->mdp[0].base + 0x3a8, "top_2");


Are these values expected to stay the same on different new-gen SoCs? 
Maybe it would


be worth making it dynamic.


I do not want to overcomplicate this. Let's make it dynamic once there 
is need for that. For now I expect this will be static.

Let's roll with that.

Reviewed-by: Konrad Dybcio 

Konrad





Konrad


+    } else {
+    msm_disp_snapshot_add_block(disp_state, cat->mdp[0].len,
+    dpu_kms->mmio + cat->mdp[0].base, "top");
+    }
  pm_runtime_put_sync(_kms->pdev->dev);
  }




Re: [Freedreno] [PATCH v3 6/8] drm/msm/dpu: add support for MDP_TOP blackhole

2022-11-10 Thread Dmitry Baryshkov

On 04/11/2022 16:58, Konrad Dybcio wrote:


On 04/11/2022 14:03, Dmitry Baryshkov wrote:

On sm8450 a register block was removed from MDP TOP. Accessing it during
snapshotting results in NoC errors / immediate reboot. Skip accessing
these registers during snapshot.


Must have been fun to debug..




Tested-by: Vinod Koul 
Reviewed-by: Vinod Koul 
Signed-off-by: Dmitry Baryshkov 
---
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h |  1 +
  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c    | 11 +--
  2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h

index 38aa38ab1568..4730f8268f2a 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
@@ -92,6 +92,7 @@ enum {
  DPU_MDP_UBWC_1_0,
  DPU_MDP_UBWC_1_5,
  DPU_MDP_AUDIO_SELECT,
+    DPU_MDP_PERIPH_0_REMOVED,
  DPU_MDP_MAX
  };
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c

index f3660cd14f4f..95d8765c1c53 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -927,8 +927,15 @@ static void dpu_kms_mdp_snapshot(struct 
msm_disp_state *disp_state, struct msm_k

  msm_disp_snapshot_add_block(disp_state, cat->wb[i].len,
  dpu_kms->mmio + cat->wb[i].base, "wb_%d", i);
-    msm_disp_snapshot_add_block(disp_state, cat->mdp[0].len,
-    dpu_kms->mmio + cat->mdp[0].base, "top");
+    if (dpu_kms->hw_mdp->caps->features & 
BIT(DPU_MDP_PERIPH_0_REMOVED)) {

+    msm_disp_snapshot_add_block(disp_state, 0x380,
+    dpu_kms->mmio + cat->mdp[0].base, "top");
+    msm_disp_snapshot_add_block(disp_state, cat->mdp[0].len - 0x3a8,
+    dpu_kms->mmio + cat->mdp[0].base + 0x3a8, "top_2");


Are these values expected to stay the same on different new-gen SoCs? 
Maybe it would


be worth making it dynamic.


I do not want to overcomplicate this. Let's make it dynamic once there 
is need for that. For now I expect this will be static.





Konrad


+    } else {
+    msm_disp_snapshot_add_block(disp_state, cat->mdp[0].len,
+    dpu_kms->mmio + cat->mdp[0].base, "top");
+    }
  pm_runtime_put_sync(_kms->pdev->dev);
  }


--
With best wishes
Dmitry



Re: [Freedreno] [PATCH 4/5] drm/komeda: Fix IS_ERR() vs NULL check in komeda_component_get_avail_scaler()

2022-11-10 Thread Liviu Dudau
On Thu, Nov 10, 2022 at 05:44:44PM +0800, Gaosheng Cui wrote:
> The komeda_pipeline_get_state() returns an ERR_PTR() on failure, we should
> use IS_ERR() to check the return value.
> 
> Fixes: 502932a03fce ("drm/komeda: Add the initial scaler support for CORE")
> Signed-off-by: Gaosheng Cui 

Acked-by: Liviu Dudau 

Thanks for the fix!

Best regards,
Liviu

> ---
>  drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c 
> b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
> index 3276a3e82c62..e9c92439398d 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
> @@ -259,7 +259,7 @@ komeda_component_get_avail_scaler(struct komeda_component 
> *c,
>   u32 avail_scalers;
>  
>   pipe_st = komeda_pipeline_get_state(c->pipeline, state);
> - if (!pipe_st)
> + if (IS_ERR(pipe_st))
>   return NULL;
>  
>   avail_scalers = (pipe_st->active_comps & KOMEDA_PIPELINE_SCALERS) ^
> -- 
> 2.25.1
> 

-- 

| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---
¯\_(ツ)_/¯


Re: [Freedreno] (subset) [PATCH 5/5] drm/vc4: kms: Fix IS_ERR() vs NULL check for vc4_kms

2022-11-10 Thread Maxime Ripard
On Thu, 10 Nov 2022 17:44:45 +0800, Gaosheng Cui wrote:
> The drm_atomic_get_new_private_obj_state() function returns NULL
> on error path, drm_atomic_get_old_private_obj_state() function
> returns NULL on error path, too, they does not return error pointers.
> 
> By the way, vc4_hvs_get_new/old_global_state() should return
> ERR_PTR(-EINVAL), otherwise there will be null-ptr-defer issue,
> such as follows:
> 
> [...]

Applied to drm/drm-misc (drm-misc-fixes).

Thanks!
Maxime


[Freedreno] [PATCH 3/5] drm/msm: Fix IS_ERR_OR_NULL() vs NULL check in msm_icc_get()

2022-11-10 Thread Gaosheng Cui
The of_icc_get() function returns NULL or error pointers on error path,
so we should use IS_ERR_OR_NULL() to check the return value.

Fixes: 5ccdcecaf8f7 ("drm/msm: lookup the ICC paths in both mdp5/dpu and mdss 
devices")
Signed-off-by: Gaosheng Cui 
---
 drivers/gpu/drm/msm/msm_io_utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/msm_io_utils.c 
b/drivers/gpu/drm/msm/msm_io_utils.c
index d02cd29ce829..950083b2f092 100644
--- a/drivers/gpu/drm/msm/msm_io_utils.c
+++ b/drivers/gpu/drm/msm/msm_io_utils.c
@@ -133,7 +133,7 @@ struct icc_path *msm_icc_get(struct device *dev, const char 
*name)
struct icc_path *path;
 
path = of_icc_get(dev, name);
-   if (path)
+   if (IS_ERR_OR_NULL(path))
return path;
 
/*
-- 
2.25.1



[Freedreno] [PATCH 5/5] drm/vc4: kms: Fix IS_ERR() vs NULL check for vc4_kms

2022-11-10 Thread Gaosheng Cui
The drm_atomic_get_new_private_obj_state() function returns NULL
on error path, drm_atomic_get_old_private_obj_state() function
returns NULL on error path, too, they does not return error pointers.

By the way, vc4_hvs_get_new/old_global_state() should return
ERR_PTR(-EINVAL), otherwise there will be null-ptr-defer issue,
such as follows:

In function vc4_atomic_commit_tail():
  |-- old_hvs_state = vc4_hvs_get_old_global_state(state); <-- return NULL
  |-- if (WARN_ON(IS_ERR(old_hvs_state))) <-- no return
  |-- unsigned long state_rate = max(old_hvs_state->core_clock_rate,
new_hvs_state->core_clock_rate); <-- null-ptr-defer

Fixes: 9ec03d7f1ed3 ("drm/vc4: kms: Wait on previous FIFO users before a 
commit")
Signed-off-by: Gaosheng Cui 
---
 drivers/gpu/drm/vc4/vc4_kms.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c
index 5c97642ed66a..8fbeecdf2ec4 100644
--- a/drivers/gpu/drm/vc4/vc4_kms.c
+++ b/drivers/gpu/drm/vc4/vc4_kms.c
@@ -197,8 +197,8 @@ vc4_hvs_get_new_global_state(struct drm_atomic_state *state)
struct drm_private_state *priv_state;
 
priv_state = drm_atomic_get_new_private_obj_state(state, 
>hvs_channels);
-   if (IS_ERR(priv_state))
-   return ERR_CAST(priv_state);
+   if (!priv_state)
+   return ERR_PTR(-EINVAL);
 
return to_vc4_hvs_state(priv_state);
 }
@@ -210,8 +210,8 @@ vc4_hvs_get_old_global_state(struct drm_atomic_state *state)
struct drm_private_state *priv_state;
 
priv_state = drm_atomic_get_old_private_obj_state(state, 
>hvs_channels);
-   if (IS_ERR(priv_state))
-   return ERR_CAST(priv_state);
+   if (!priv_state)
+   return ERR_PTR(-EINVAL);
 
return to_vc4_hvs_state(priv_state);
 }
-- 
2.25.1



[Freedreno] [PATCH 1/5] drm/panel: Fix IS_ERR() vs NULL check in nt35950_probe()

2022-11-10 Thread Gaosheng Cui
The mipi_dsi_device_register_full() returns an ERR_PTR() on failure,
we should use IS_ERR() to check the return value.

Fixes: 623a3531e9cf ("drm/panel: Add driver for Novatek NT35950 DSI DriverIC 
panels")
Signed-off-by: Gaosheng Cui 
---
 drivers/gpu/drm/panel/panel-novatek-nt35950.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-novatek-nt35950.c 
b/drivers/gpu/drm/panel/panel-novatek-nt35950.c
index 3a844917da07..6304fe5b9038 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt35950.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt35950.c
@@ -579,7 +579,7 @@ static int nt35950_probe(struct mipi_dsi_device *dsi)
}
 
nt->dsi[1] = mipi_dsi_device_register_full(dsi_r_host, info);
-   if (!nt->dsi[1]) {
+   if (IS_ERR(nt->dsi[1])) {
dev_err(dev, "Cannot get secondary DSI node\n");
return -ENODEV;
}
-- 
2.25.1



[Freedreno] [PATCH 4/5] drm/komeda: Fix IS_ERR() vs NULL check in komeda_component_get_avail_scaler()

2022-11-10 Thread Gaosheng Cui
The komeda_pipeline_get_state() returns an ERR_PTR() on failure, we should
use IS_ERR() to check the return value.

Fixes: 502932a03fce ("drm/komeda: Add the initial scaler support for CORE")
Signed-off-by: Gaosheng Cui 
---
 drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c 
b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
index 3276a3e82c62..e9c92439398d 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
@@ -259,7 +259,7 @@ komeda_component_get_avail_scaler(struct komeda_component 
*c,
u32 avail_scalers;
 
pipe_st = komeda_pipeline_get_state(c->pipeline, state);
-   if (!pipe_st)
+   if (IS_ERR(pipe_st))
return NULL;
 
avail_scalers = (pipe_st->active_comps & KOMEDA_PIPELINE_SCALERS) ^
-- 
2.25.1



[Freedreno] [PATCH 2/5] drm/msm: Fix IS_ERR() vs NULL check in a5xx_submit_in_rb()

2022-11-10 Thread Gaosheng Cui
The msm_gem_get_vaddr() returns an ERR_PTR() on failure, we should
use IS_ERR() to check the return value.

Fixes: 6a8bd08d0465 ("drm/msm: add sudo flag to submit ioctl")
Signed-off-by: Gaosheng Cui 
---
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
index 3c537c0016fa..0abc802e8d5f 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
@@ -89,7 +89,7 @@ static void a5xx_submit_in_rb(struct msm_gpu *gpu, struct 
msm_gem_submit *submit
 * since we've already mapped it once in
 * submit_reloc()
 */
-   if (WARN_ON(!ptr))
+   if (WARN_ON(IS_ERR(ptr)))
return;
 
for (i = 0; i < dwords; i++) {
-- 
2.25.1



[Freedreno] [PATCH 0/5] Fix IS_ERR() vs NULL check for drm

2022-11-10 Thread Gaosheng Cui
This series contains a few fixup patches, to fix IS_ERR() vs NULL check
for drm, and avoid a potential null-ptr-defer issue, too. Thanks!

Gaosheng Cui (5):
  drm/panel: Fix IS_ERR() vs NULL check in nt35950_probe()
  drm/msm: Fix IS_ERR() vs NULL check in a5xx_submit_in_rb()
  drm/msm: Fix IS_ERR_OR_NULL() vs NULL check in msm_icc_get()
  drm/komeda: Fix IS_ERR() vs NULL check in
komeda_component_get_avail_scaler()
  drm/vc4: kms: Fix IS_ERR() vs NULL check for vc4_kms

 .../gpu/drm/arm/display/komeda/komeda_pipeline_state.c| 2 +-
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 2 +-
 drivers/gpu/drm/msm/msm_io_utils.c| 2 +-
 drivers/gpu/drm/panel/panel-novatek-nt35950.c | 2 +-
 drivers/gpu/drm/vc4/vc4_kms.c | 8 
 5 files changed, 8 insertions(+), 8 deletions(-)

-- 
2.25.1