[pull] amdgpu, amdkfd, radeon, scheduler drm-next-5.10

2020-09-18 Thread Alex Deucher
Hi Dave, Daniel,

More new stuff for 5.10.

The following changes since commit 818280d5adf1d80e78f95821815148abe9407e14:

  Merge v5.9-rc5 into drm-next (2020-09-14 17:19:11 +0200)

are available in the Git repository at:

  git://people.freedesktop.org/~agd5f/linux tags/amd-drm-next-5.10-2020-09-18

for you to fetch changes up to 911d5bd5e7b8531b39301c2c27e5b90d7bd71b88:

  drm/amd/pm: Skip smu_post_init in SRIOV (2020-09-18 16:14:56 -0400)


amd-drm-next-5.10-2020-09-18:

amdgpu:
- Support for PCIe DPC recovery
- Sienna Cichlid updates
- Navy Flounder updates
- RAS fixes
- Refactor DC interrupt handling
- Display fixes
- Fix issues with OLED panels
- Mclk fixes for navi1x
- Watermark fixes for renoir and raven2
- Misc code cleanups
- Misc bug fixes

amdkfd:
- Fix a memory leak
- Fix a crach in GPU reset
- Add process eviction counters

radeon:
- expose sclk via sysfs hwmon interface
- Revert bad PLL fix

scheduler:
- Kernel doc fixes


Aidan Gratton (1):
  drm/amd/display: Increase Max EDID Size Constant

Alex Deucher (7):
  drm/amdgpu: Fail to load on RAVEN if SME is active
  drm/amdgpu/gmc9: remove mmhub client duplicated case
  drm/amdgpu: unmap register bar on device init failure
  drm/amdgpu: add the GC 10.3 VRS registers
  drm/amdgpu: add VCN 3.0 AV1 registers
  drm/amdgpu: use the AV1 defines for VCN 3.0
  drm/amdgpu: remove experimental flag from navi12

Alvin Lee (1):
  drm/amd/display: Compare plane when looking for pipe split being lost

Andrey Grodzovsky (9):
  drm/amdgpu: Implement DPC recovery
  drm/amdgpu: Avoid accessing HW when suspending SW state
  drm/amdgpu: Block all job scheduling activity during DPC recovery
  drm/amdgpu: Fix SMU error failure
  drm/amdgpu: Fix consecutive DPC recovery failures.
  drm/amdgpu: Trim amdgpu_pci_slot_reset by reusing code.
  drm/amdgpu: Disable DPC for XGMI for now.
  drm/amdgpu: Minor checkpatch fix
  drm/amdgpu: Include sienna_cichlid in USBC PD FW support.

Anthony Koo (3):
  drm/amd/display: [FW Promotion] Release 0.0.30
  drm/amd/display: [FW Promotion] Release 0.0.31
  drm/amd/display: [FW Promotion] Release 0.0.32

Aric Cyr (6):
  drm/amd/display: 3.2.100
  drm/amd/display: Triplebuffering should not be used by default
  drm/amd/display: 3.2.101
  drm/amd/display: Flip pending check timeout due to disabled hubp
  drm/amd/display: Multi display cause system lag on mode change
  drm/amd/display: 3.2.102

Ashley Thomas (1):
  drm/amd/display: Power eDP panel back ON before link training retry

Aurabindo Pillai (3):
  drm/amdgpu: Move existing pflip fields into separate struct
  drm/amd/display: Refactor to prevent crtc state access in DM IRQ handler
  drm/amd/display: Move disable interrupt into commit tail

Bernard Zhao (1):
  drm/amd/display: optimize code runtime a bit

Bhawanpreet Lakha (3):
  drm/amd/display: Don't use DRM_ERROR() for DTM add topology
  drm/amd/display: Don't log hdcp module warnings in dmesg
  drm/amd/display: Add missing "Copy GSL groups when committing a new 
context"

Changfeng (1):
  drm/amdgpu: add ta DTM/HDCP print in amdgpu_firmware_info for apu

Chen Zhou (1):
  drm/amd/display: Remove duplicate include

Christian König (1):
  drm/radeon: revert "Prefer lower feedback dividers"

Dennis Li (2):
  drm/kfd: fix a system crash issue during GPU recovery
  drm/amdkfd: fix a memory leak issue

Dmytro Laktyushkin (2):
  drm/amd/display: make dcn20 stream_gating use a pointer for dsc_pg_control
  drm/amd/display: update dcn30_optc header with missing declarations

Eric Yang (1):
  drm/amd/display: implement notify stream mask

Eryk Brol (5):
  drm/amd/display: Add DSC force disable to dsc_clock_en debugfs entry
  drm/amd/display: Add trigger connector unplug
  drm/amd/display: Return the number of bytes parsed than allocated
  drm/amd/display: Calculate DSC number of slices in debugfs when forced
  drm/amd/display: Add connector to the state if DSC debugfs is set

Evan Quan (23):
  drm/amd/pm: wrapper for postponing some setup job after DAL 
initializatioa(V2)
  drm/amd/pm: postpone SOCCLK/UCLK enablement after DAL initialization(V2)
  drm/amd/pm: put Navi1X umc cdr workaround in post_smu_init
  drm/amd/pm: revise the umc hybrid cdr workaround
  drm/amd/pm: allocate a new buffer for pstate dummy reading
  drm/amd/pm: implement a new umc cdr workaround
  drm/amd/pm: apply the CDR workarounds only with some specific UMC 
firmwares(V2)
  drm/amd/pm: correct the requirement for umc cdr workaround
  drm/amd/pm: make namings and comments more readable
  drm/amd/pm: drop unnecessary feature->mutex lock protections(V2)
  drm/amd/pm: drop unnecessary smu_baco->mutex lock 

[PATCH] drm/i915/selftests: align more to real device lifetimes

2020-09-18 Thread Daniel Vetter
To avoid having to create all the device and driver scaffolding we
just manually create and destroy a devres_group.

v2: Rebased

v3: use devres_open/release_group so we can use devm without real
hacks in the driver core or having to create an entire fake bus for
testing drivers. Might want to extract this into helpers eventually,
maybe as a mock_drm_dev_alloc or test_drm_dev_alloc.

v4:
- Fix IS_ERR handling (Matt)
- Delete surplus put_device() in mock_device_release (intel-gfx-ci)

v5:
- do not switch to device_add - it breaks runtime pm in the tests and
  with the devres_group_add/release no longer needed for automatic
  cleanup (CI). Update commit message to match.
- print correct error in pr_err (Matt)

Cc: Matthew Auld 
Reviewed-by: Maarten Lankhorst  (v3)
Cc: Maarten Lankhorst 
Reviewed-by: Matthew Auld  (v4)
Signed-off-by: Daniel Vetter 
---
 .../gpu/drm/i915/selftests/mock_gem_device.c  | 38 +--
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/i915/selftests/mock_gem_device.c 
b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
index ac600d395c8f..3b574597cd7f 100644
--- a/drivers/gpu/drm/i915/selftests/mock_gem_device.c
+++ b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
@@ -79,8 +79,6 @@ static void mock_device_release(struct drm_device *dev)
 
 out:
i915_params_free(>params);
-   put_device(>drm.pdev->dev);
-   i915->drm.pdev = NULL;
 }
 
 static struct drm_driver mock_driver = {
@@ -128,12 +126,6 @@ struct drm_i915_private *mock_gem_device(void)
pdev = kzalloc(sizeof(*pdev), GFP_KERNEL);
if (!pdev)
return NULL;
-   i915 = kzalloc(sizeof(*i915), GFP_KERNEL);
-   if (!i915) {
-   kfree(pdev);
-   return NULL;
-   }
-
device_initialize(>dev);
pdev->class = PCI_BASE_CLASS_DISPLAY << 16;
pdev->dev.release = release_dev;
@@ -144,8 +136,23 @@ struct drm_i915_private *mock_gem_device(void)
/* HACK to disable iommu for the fake device; force identity mapping */
pdev->dev.iommu = _iommu;
 #endif
+   if (!devres_open_group(>dev, NULL, GFP_KERNEL)) {
+   put_device(>dev);
+   return NULL;
+   }
+
+   i915 = devm_drm_dev_alloc(>dev, _driver,
+ struct drm_i915_private, drm);
+   if (IS_ERR(i915)) {
+   pr_err("Failed to allocate mock GEM device: err=%d\n", 
PTR_ERR(i915));
+   devres_release_group(>dev, NULL);
+   put_device(>dev);
+
+   return NULL;
+   }
 
pci_set_drvdata(pdev, i915);
+   i915->drm.pdev = pdev;
 
dev_pm_domain_set(>dev, _domain);
pm_runtime_enable(>dev);
@@ -153,16 +160,6 @@ struct drm_i915_private *mock_gem_device(void)
if (pm_runtime_enabled(>dev))
WARN_ON(pm_runtime_get_sync(>dev));
 
-   err = drm_dev_init(>drm, _driver, >dev);
-   if (err) {
-   pr_err("Failed to initialise mock GEM device: err=%d\n", err);
-   put_device(>dev);
-   kfree(i915);
-
-   return NULL;
-   }
-   i915->drm.pdev = pdev;
-   drmm_add_final_kfree(>drm, i915);
 
i915_params_copy(>params, _modparams);
 
@@ -229,5 +226,8 @@ struct drm_i915_private *mock_gem_device(void)
 
 void mock_destroy_device(struct drm_i915_private *i915)
 {
-   drm_dev_put(>drm);
+   struct device *dev = i915->drm.dev;
+
+   devres_release_group(dev, NULL);
+   put_device(dev);
 }
-- 
2.28.0

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


Re: [PATCH 2/2] drm/dp: add a number of DP 2.0 DPCD definitions

2020-09-18 Thread Navare, Manasi
On Fri, Sep 18, 2020 at 02:40:17PM +0300, Jani Nikula wrote:
> Prepare for future with DP 2.0 DPCD definitions, with a couple of
> related drive-by cleanups. No functional changes.
> 
> v2: Send the version that actually builds.
> 
> Signed-off-by: Jani Nikula 

Verified the below DP 2.0 DPCD registers from the DP 2.0 spec

Reviewed-by: Manasi Navare 

Manasi

> ---
>  include/drm/drm_dp_helper.h | 52 -
>  1 file changed, 45 insertions(+), 7 deletions(-)
> 
> diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
> index 388083b4716b..e144b4b9d79a 100644
> --- a/include/drm/drm_dp_helper.h
> +++ b/include/drm/drm_dp_helper.h
> @@ -125,6 +125,7 @@ struct drm_device;
>  
>  #define DP_MAX_DOWNSPREAD   0x003
>  # define DP_MAX_DOWNSPREAD_0_5   (1 << 0)
> +# define DP_STREAM_REGENERATION_STATUS_CAP  (1 << 1) /* 2.0 */
>  # define DP_NO_AUX_HANDSHAKE_LINK_TRAINING  (1 << 6)
>  # define DP_TPS4_SUPPORTED  (1 << 7)
>  
> @@ -142,6 +143,7 @@ struct drm_device;
>  
>  #define DP_MAIN_LINK_CHANNEL_CODING 0x006
>  # define DP_CAP_ANSI_8B10B   (1 << 0)
> +# define DP_CAP_ANSI_128B132B   (1 << 1) /* 2.0 */
>  
>  #define DP_DOWN_STREAM_PORT_COUNT0x007
>  # define DP_PORT_COUNT_MASK  0x0f
> @@ -185,8 +187,14 @@ struct drm_device;
>  #define DP_FAUX_CAP  0x020   /* 1.2 */
>  # define DP_FAUX_CAP_1   (1 << 0)
>  
> +#define DP_SINK_VIDEO_FALLBACK_FORMATS  0x020   /* 2.0 */
> +# define DP_FALLBACK_1024x768_60HZ_24BPP(1 << 0)
> +# define DP_FALLBACK_1280x720_60HZ_24BPP(1 << 1)
> +# define DP_FALLBACK_1920x1080_60HZ_24BPP   (1 << 2)
> +
>  #define DP_MSTM_CAP  0x021   /* 1.2 */
>  # define DP_MST_CAP  (1 << 0)
> +# define DP_SINGLE_STREAM_SIDEBAND_MSG  (1 << 1) /* 2.0 */
>  
>  #define DP_NUMBER_OF_AUDIO_ENDPOINTS 0x022   /* 1.2 */
>  
> @@ -434,6 +442,9 @@ struct drm_device;
>  # define DP_LINK_BW_2_7  0x0a
>  # define DP_LINK_BW_5_4  0x14/* 1.2 */
>  # define DP_LINK_BW_8_1  0x1e/* 1.4 */
> +# define DP_LINK_BW_10  0x01/* 2.0 128b/132b Link 
> Layer */
> +# define DP_LINK_BW_13_50x04/* 2.0 128b/132b Link 
> Layer */
> +# define DP_LINK_BW_20  0x02/* 2.0 128b/132b Link 
> Layer */
>  
>  #define DP_LANE_COUNT_SET0x101
>  # define DP_LANE_COUNT_MASK  0x0f
> @@ -485,12 +496,15 @@ struct drm_device;
>  # define DP_TRAIN_PRE_EMPHASIS_SHIFT 3
>  # define DP_TRAIN_MAX_PRE_EMPHASIS_REACHED  (1 << 5)
>  
> +# define DP_TX_FFE_PRESET_VALUE_MASK(0xf << 0) /* 2.0 128b/132b Link 
> Layer */
> +
>  #define DP_DOWNSPREAD_CTRL   0x107
>  # define DP_SPREAD_AMP_0_5   (1 << 4)
>  # define DP_MSA_TIMING_PAR_IGNORE_EN (1 << 7) /* eDP */
>  
>  #define DP_MAIN_LINK_CHANNEL_CODING_SET  0x108
>  # define DP_SET_ANSI_8B10B   (1 << 0)
> +# define DP_SET_ANSI_128B132B   (1 << 1)
>  
>  #define DP_I2C_SPEED_CONTROL_STATUS  0x109   /* DPI */
>  /* bitmask as for DP_I2C_SPEED_CAP */
> @@ -509,8 +523,19 @@ struct drm_device;
>  # define DP_LINK_QUAL_PATTERN_ERROR_RATE2
>  # define DP_LINK_QUAL_PATTERN_PRBS7  3
>  # define DP_LINK_QUAL_PATTERN_80BIT_CUSTOM  4
> -# define DP_LINK_QUAL_PATTERN_HBR2_EYE  5
> -# define DP_LINK_QUAL_PATTERN_MASK   7
> +# define DP_LINK_QUAL_PATTERN_CP2520_PAT_1  5
> +# define DP_LINK_QUAL_PATTERN_CP2520_PAT_2  6
> +# define DP_LINK_QUAL_PATTERN_CP2520_PAT_3  7
> +/* DP 2.0 UHBR10, UHBR13.5, UHBR20 */
> +# define DP_LINK_QUAL_PATTERN_128B132B_TPS1 0x08
> +# define DP_LINK_QUAL_PATTERN_128B132B_TPS2 0x10
> +# define DP_LINK_QUAL_PATTERN_PRSBS90x18
> +# define DP_LINK_QUAL_PATTERN_PRSBS11   0x20
> +# define DP_LINK_QUAL_PATTERN_PRSBS15   0x28
> +# define DP_LINK_QUAL_PATTERN_PRSBS23   0x30
> +# define DP_LINK_QUAL_PATTERN_PRSBS31   0x38
> +# define DP_LINK_QUAL_PATTERN_CUSTOM0x40
> +# define DP_LINK_QUAL_PATTERN_SQUARE0x48
>  
>  #define DP_TRAINING_LANE0_1_SET2 0x10f
>  #define DP_TRAINING_LANE2_3_SET2 0x110
> @@ -613,9 +638,9 @@ struct drm_device;
>  #define DP_LINK_STATUS_UPDATED   (1 << 7)
>  
>  #define DP_SINK_STATUS   0x205
> -
> -#define DP_RECEIVE_PORT_0_STATUS (1 << 0)
> -#define DP_RECEIVE_PORT_1_STATUS (1 << 1)
> +# define DP_RECEIVE_PORT_0_STATUS(1 << 0)
> +# define DP_RECEIVE_PORT_1_STATUS(1 << 1)
> +# define DP_STREAM_REGENERATION_STATUS  (1 << 2) /* 2.0 */
>  
>  #define DP_ADJUST_REQUEST_LANE0_10x206
>  #define DP_ADJUST_REQUEST_LANE2_30x207
> @@ -628,6 +653,12 @@ struct drm_device;
>  # define DP_ADJUST_PRE_EMPHASIS_LANE1_MASK   0xc0
>  # define 

Re: [PATCH 1/2] drm/dp: add subheadings to DPCD address definitions

2020-09-18 Thread Navare, Manasi
On Fri, Sep 18, 2020 at 02:40:16PM +0300, Jani Nikula wrote:
> Add the subheadings from the DP spec. No functional changes.
> 
> Signed-off-by: Jani Nikula 

Looks good to me

Reviewed-by: Manasi Navare 

Manasi

> ---
>  include/drm/drm_dp_helper.h | 22 ++
>  1 file changed, 18 insertions(+), 4 deletions(-)
> 
> diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
> index c9f2851904d0..388083b4716b 100644
> --- a/include/drm/drm_dp_helper.h
> +++ b/include/drm/drm_dp_helper.h
> @@ -106,8 +106,9 @@ struct drm_device;
>  #define DP_AUX_I2C_REPLY_DEFER   (0x2 << 2)
>  #define DP_AUX_I2C_REPLY_MASK(0x3 << 2)
>  
> -/* AUX CH addresses */
> -/* DPCD */
> +/* DPCD Field Address Mapping */
> +
> +/* Receiver Capability */
>  #define DP_DPCD_REV 0x000
>  # define DP_DPCD_REV_10 0x10
>  # define DP_DPCD_REV_11 0x11
> @@ -426,7 +427,7 @@ struct drm_device;
>  #define DP_DSC_BRANCH_OVERALL_THROUGHPUT_1  0x0a1
>  #define DP_DSC_BRANCH_MAX_LINE_WIDTH0x0a2
>  
> -/* link configuration */
> +/* Link Configuration */
>  #define  DP_LINK_BW_SET  0x100
>  # define DP_LINK_RATE_TABLE  0x00/* eDP 1.4 */
>  # define DP_LINK_BW_1_62 0x06
> @@ -580,6 +581,7 @@ struct drm_device;
>  #define DP_PAYLOAD_ALLOCATE_START_TIME_SLOT 0x1c1
>  #define DP_PAYLOAD_ALLOCATE_TIME_SLOT_COUNT 0x1c2
>  
> +/* Link/Sink Device Status */
>  #define DP_SINK_COUNT0x200
>  /* prior to 1.2 bit 7 was reserved mbz */
>  # define DP_GET_SINK_COUNT(x)x) & 0x80) >> 1) | ((x) 
> & 0x3f))
> @@ -779,20 +781,27 @@ struct drm_device;
>  #define DP_VC_PAYLOAD_ID_SLOT_1 0x2c1   /* 1.2 MST */
>  /* up to ID_SLOT_63 at 0x2ff */
>  
> +/* Source Device-specific */
>  #define DP_SOURCE_OUI0x300
> +
> +/* Sink Device-specific */
>  #define DP_SINK_OUI  0x400
> +
> +/* Branch Device-specific */
>  #define DP_BRANCH_OUI0x500
>  #define DP_BRANCH_ID0x503
>  #define DP_BRANCH_REVISION_START0x509
>  #define DP_BRANCH_HW_REV0x509
>  #define DP_BRANCH_SW_REV0x50A
>  
> +/* Link/Sink Device Power Control */
>  #define DP_SET_POWER0x600
>  # define DP_SET_POWER_D00x1
>  # define DP_SET_POWER_D30x2
>  # define DP_SET_POWER_MASK  0x3
>  # define DP_SET_POWER_D3_AUX_ON 0x5
>  
> +/* eDP-specific */
>  #define DP_EDP_DPCD_REV  0x700/* eDP 1.2 */
>  # define DP_EDP_11   0x00
>  # define DP_EDP_12   0x01
> @@ -876,11 +885,13 @@ struct drm_device;
>  #define DP_EDP_REGIONAL_BACKLIGHT_BASE  0x740/* eDP 1.4 */
>  #define DP_EDP_REGIONAL_BACKLIGHT_0  0x741/* eDP 1.4 */
>  
> +/* Sideband MSG Buffers */
>  #define DP_SIDEBAND_MSG_DOWN_REQ_BASE0x1000   /* 1.2 MST */
>  #define DP_SIDEBAND_MSG_UP_REP_BASE  0x1200   /* 1.2 MST */
>  #define DP_SIDEBAND_MSG_DOWN_REP_BASE0x1400   /* 1.2 MST */
>  #define DP_SIDEBAND_MSG_UP_REQ_BASE  0x1600   /* 1.2 MST */
>  
> +/* DPRX Event Status Indicator */
>  #define DP_SINK_COUNT_ESI0x2002   /* 1.2 */
>  /* 0-5 sink count */
>  # define DP_SINK_COUNT_CP_READY (1 << 6)
> @@ -934,6 +945,7 @@ struct drm_device;
>  #define DP_LANE_ALIGN_STATUS_UPDATED_ESI   0x200e /* status same as 
> 0x204 */
>  #define DP_SINK_STATUS_ESI 0x200f /* status same as 
> 0x205 */
>  
> +/* Extended Receiver Capability */
>  #define DP_DP13_DPCD_REV0x2200
>  #define DP_DP13_MAX_LINK_RATE   0x2201
>  
> @@ -947,6 +959,7 @@ struct drm_device;
>  # define DP_VSC_EXT_CEA_SDP_SUPPORTED(1 << 6)  /* DP 
> 1.4 */
>  # define DP_VSC_EXT_CEA_SDP_CHAINING_SUPPORTED   (1 << 7)  /* DP 
> 1.4 */
>  
> +/* Protocol Converter Extension */
>  /* HDMI CEC tunneling over AUX DP 1.3 section 5.3.3.3.1 DPCD 1.4+ */
>  #define DP_CEC_TUNNELING_CAPABILITY0x3000
>  # define DP_CEC_TUNNELING_CAPABLE   (1 << 0)
> @@ -1013,6 +1026,7 @@ struct drm_device;
>  #define DP_PROTOCOL_CONVERTER_CONTROL_2  0x3052 /* DP 1.3 */
>  # define DP_CONVERSION_TO_YCBCR422_ENABLE(1 << 0) /* DP 1.3 */
>  
> +/* HDCP 1.3 and HDCP 2.2 */
>  #define DP_AUX_HDCP_BKSV 0x68000
>  #define DP_AUX_HDCP_RI_PRIME 0x68005
>  #define DP_AUX_HDCP_AKSV 0x68007
> @@ -1058,7 +1072,7 @@ struct drm_device;
>  #define DP_HDCP_2_2_REG_STREAM_TYPE_OFFSET   0x69494
>  #define DP_HDCP_2_2_REG_DBG_OFFSET   0x69518
>  
> -/* Link Training (LT)-tunable PHY Repeaters */
> +/* LTTPR: Link Training (LT)-tunable PHY Repeaters */
>  #define 

Re: [PATCH 2/4] drm/i915/selftests: align more to real device lifetimes

2020-09-18 Thread Daniel Vetter
On Fri, Sep 18, 2020 at 8:31 PM Matthew Auld
 wrote:
>
> On Fri, 18 Sep 2020 at 19:22, Daniel Vetter  wrote:
> >
> > On Fri, Sep 18, 2020 at 7:50 PM Matthew Auld
> >  wrote:
> > >
> > > On Fri, 18 Sep 2020 at 14:25, Daniel Vetter  
> > > wrote:
> > > >
> > > > The big change is device_add so that device_del can auto-cleanup
> > > > devres resources. This allows us to use devm_drm_dev_alloc, which
> > > > removes the last user of drm_dev_init.
> > > >
> > > > v2: Rebased
> > > >
> > > > v3: use devres_open/release_group so we can use devm without real
> > > > hacks in the driver core or having to create an entire fake bus for
> > > > testing drivers. Might want to extract this into helpers eventually,
> > > > maybe as a mock_drm_dev_alloc or test_drm_dev_alloc.
> > > >
> > > > v4:
> > > > - Fix IS_ERR handling (Matt)
> > > > - Delete surplus put_device() in mock_device_release (intel-gfx-ci)
> > > >
> > > > Cc: Matthew Auld 
> > > > Reviewed-by: Maarten Lankhorst  (v3)
> > > > Cc: Maarten Lankhorst 
> > > > Signed-off-by: Daniel Vetter 
> > > > ---
> > > >  .../gpu/drm/i915/selftests/mock_gem_device.c  | 44 +++
> > > >  1 file changed, 25 insertions(+), 19 deletions(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/i915/selftests/mock_gem_device.c 
> > > > b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> > > > index ac600d395c8f..816f9af15fb3 100644
> > > > --- a/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> > > > +++ b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> > > > @@ -79,8 +79,6 @@ static void mock_device_release(struct drm_device 
> > > > *dev)
> > > >
> > > >  out:
> > > > i915_params_free(>params);
> > > > -   put_device(>drm.pdev->dev);
> > > > -   i915->drm.pdev = NULL;
> > > >  }
> > > >
> > > >  static struct drm_driver mock_driver = {
> > > > @@ -128,12 +126,6 @@ struct drm_i915_private *mock_gem_device(void)
> > > > pdev = kzalloc(sizeof(*pdev), GFP_KERNEL);
> > > > if (!pdev)
> > > > return NULL;
> > > > -   i915 = kzalloc(sizeof(*i915), GFP_KERNEL);
> > > > -   if (!i915) {
> > > > -   kfree(pdev);
> > > > -   return NULL;
> > > > -   }
> > > > -
> > > > device_initialize(>dev);
> > > > pdev->class = PCI_BASE_CLASS_DISPLAY << 16;
> > > > pdev->dev.release = release_dev;
> > > > @@ -144,8 +136,29 @@ struct drm_i915_private *mock_gem_device(void)
> > > > /* HACK to disable iommu for the fake device; force identity 
> > > > mapping */
> > > > pdev->dev.iommu = _iommu;
> > > >  #endif
> > > > +   err = device_add(>dev);
> > > > +   if (err) {
> > > > +   kfree(pdev);
> > > > +   return NULL;
> > > > +   }
> > > > +
> > > > +   if (!devres_open_group(>dev, NULL, GFP_KERNEL)) {
> > > > +   device_del(>dev);
> > > > +   return NULL;
> > > > +   }
> > > > +
> > > > +   i915 = devm_drm_dev_alloc(>dev, _driver,
> > > > + struct drm_i915_private, drm);
> > > > +   if (IS_ERR(i915)) {
> > > > +   pr_err("Failed to allocate mock GEM device: err=%d\n", 
> > > > err);
> > >
> > > err = PTR_ERR(i915)
> >
> > Are you sure? We return a pointer here, and callers just expect NULL
> > when stuff fails (so neither errno nor ptr-encoded errno).
>
> I just meant for the pr_err() which is printing the err(from the
> copy-paste), but it will always be zero without the above.

Ah right, I missed that when applying your previous comment, thanks
for pointing it out.
-Daniel

>
> > -Daniel
> >
> > > Reviewed-by: Matthew Auld 
> >
> >
> >
> > --
> > Daniel Vetter
> > Software Engineer, Intel Corporation
> > http://blog.ffwll.ch



-- 
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 2/4] drm/i915/selftests: align more to real device lifetimes

2020-09-18 Thread Matthew Auld
On Fri, 18 Sep 2020 at 19:22, Daniel Vetter  wrote:
>
> On Fri, Sep 18, 2020 at 7:50 PM Matthew Auld
>  wrote:
> >
> > On Fri, 18 Sep 2020 at 14:25, Daniel Vetter  wrote:
> > >
> > > The big change is device_add so that device_del can auto-cleanup
> > > devres resources. This allows us to use devm_drm_dev_alloc, which
> > > removes the last user of drm_dev_init.
> > >
> > > v2: Rebased
> > >
> > > v3: use devres_open/release_group so we can use devm without real
> > > hacks in the driver core or having to create an entire fake bus for
> > > testing drivers. Might want to extract this into helpers eventually,
> > > maybe as a mock_drm_dev_alloc or test_drm_dev_alloc.
> > >
> > > v4:
> > > - Fix IS_ERR handling (Matt)
> > > - Delete surplus put_device() in mock_device_release (intel-gfx-ci)
> > >
> > > Cc: Matthew Auld 
> > > Reviewed-by: Maarten Lankhorst  (v3)
> > > Cc: Maarten Lankhorst 
> > > Signed-off-by: Daniel Vetter 
> > > ---
> > >  .../gpu/drm/i915/selftests/mock_gem_device.c  | 44 +++
> > >  1 file changed, 25 insertions(+), 19 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/i915/selftests/mock_gem_device.c 
> > > b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> > > index ac600d395c8f..816f9af15fb3 100644
> > > --- a/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> > > +++ b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> > > @@ -79,8 +79,6 @@ static void mock_device_release(struct drm_device *dev)
> > >
> > >  out:
> > > i915_params_free(>params);
> > > -   put_device(>drm.pdev->dev);
> > > -   i915->drm.pdev = NULL;
> > >  }
> > >
> > >  static struct drm_driver mock_driver = {
> > > @@ -128,12 +126,6 @@ struct drm_i915_private *mock_gem_device(void)
> > > pdev = kzalloc(sizeof(*pdev), GFP_KERNEL);
> > > if (!pdev)
> > > return NULL;
> > > -   i915 = kzalloc(sizeof(*i915), GFP_KERNEL);
> > > -   if (!i915) {
> > > -   kfree(pdev);
> > > -   return NULL;
> > > -   }
> > > -
> > > device_initialize(>dev);
> > > pdev->class = PCI_BASE_CLASS_DISPLAY << 16;
> > > pdev->dev.release = release_dev;
> > > @@ -144,8 +136,29 @@ struct drm_i915_private *mock_gem_device(void)
> > > /* HACK to disable iommu for the fake device; force identity 
> > > mapping */
> > > pdev->dev.iommu = _iommu;
> > >  #endif
> > > +   err = device_add(>dev);
> > > +   if (err) {
> > > +   kfree(pdev);
> > > +   return NULL;
> > > +   }
> > > +
> > > +   if (!devres_open_group(>dev, NULL, GFP_KERNEL)) {
> > > +   device_del(>dev);
> > > +   return NULL;
> > > +   }
> > > +
> > > +   i915 = devm_drm_dev_alloc(>dev, _driver,
> > > + struct drm_i915_private, drm);
> > > +   if (IS_ERR(i915)) {
> > > +   pr_err("Failed to allocate mock GEM device: err=%d\n", 
> > > err);
> >
> > err = PTR_ERR(i915)
>
> Are you sure? We return a pointer here, and callers just expect NULL
> when stuff fails (so neither errno nor ptr-encoded errno).

I just meant for the pr_err() which is printing the err(from the
copy-paste), but it will always be zero without the above.

> -Daniel
>
> > Reviewed-by: Matthew Auld 
>
>
>
> --
> 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 2/4] drm/i915/selftests: align more to real device lifetimes

2020-09-18 Thread Daniel Vetter
On Fri, Sep 18, 2020 at 7:50 PM Matthew Auld
 wrote:
>
> On Fri, 18 Sep 2020 at 14:25, Daniel Vetter  wrote:
> >
> > The big change is device_add so that device_del can auto-cleanup
> > devres resources. This allows us to use devm_drm_dev_alloc, which
> > removes the last user of drm_dev_init.
> >
> > v2: Rebased
> >
> > v3: use devres_open/release_group so we can use devm without real
> > hacks in the driver core or having to create an entire fake bus for
> > testing drivers. Might want to extract this into helpers eventually,
> > maybe as a mock_drm_dev_alloc or test_drm_dev_alloc.
> >
> > v4:
> > - Fix IS_ERR handling (Matt)
> > - Delete surplus put_device() in mock_device_release (intel-gfx-ci)
> >
> > Cc: Matthew Auld 
> > Reviewed-by: Maarten Lankhorst  (v3)
> > Cc: Maarten Lankhorst 
> > Signed-off-by: Daniel Vetter 
> > ---
> >  .../gpu/drm/i915/selftests/mock_gem_device.c  | 44 +++
> >  1 file changed, 25 insertions(+), 19 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/selftests/mock_gem_device.c 
> > b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> > index ac600d395c8f..816f9af15fb3 100644
> > --- a/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> > +++ b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> > @@ -79,8 +79,6 @@ static void mock_device_release(struct drm_device *dev)
> >
> >  out:
> > i915_params_free(>params);
> > -   put_device(>drm.pdev->dev);
> > -   i915->drm.pdev = NULL;
> >  }
> >
> >  static struct drm_driver mock_driver = {
> > @@ -128,12 +126,6 @@ struct drm_i915_private *mock_gem_device(void)
> > pdev = kzalloc(sizeof(*pdev), GFP_KERNEL);
> > if (!pdev)
> > return NULL;
> > -   i915 = kzalloc(sizeof(*i915), GFP_KERNEL);
> > -   if (!i915) {
> > -   kfree(pdev);
> > -   return NULL;
> > -   }
> > -
> > device_initialize(>dev);
> > pdev->class = PCI_BASE_CLASS_DISPLAY << 16;
> > pdev->dev.release = release_dev;
> > @@ -144,8 +136,29 @@ struct drm_i915_private *mock_gem_device(void)
> > /* HACK to disable iommu for the fake device; force identity 
> > mapping */
> > pdev->dev.iommu = _iommu;
> >  #endif
> > +   err = device_add(>dev);
> > +   if (err) {
> > +   kfree(pdev);
> > +   return NULL;
> > +   }
> > +
> > +   if (!devres_open_group(>dev, NULL, GFP_KERNEL)) {
> > +   device_del(>dev);
> > +   return NULL;
> > +   }
> > +
> > +   i915 = devm_drm_dev_alloc(>dev, _driver,
> > + struct drm_i915_private, drm);
> > +   if (IS_ERR(i915)) {
> > +   pr_err("Failed to allocate mock GEM device: err=%d\n", err);
>
> err = PTR_ERR(i915)

Are you sure? We return a pointer here, and callers just expect NULL
when stuff fails (so neither errno nor ptr-encoded errno).
-Daniel

> Reviewed-by: Matthew Auld 



-- 
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 2/4] drm/i915/selftests: align more to real device lifetimes

2020-09-18 Thread Matthew Auld
On Fri, 18 Sep 2020 at 14:25, Daniel Vetter  wrote:
>
> The big change is device_add so that device_del can auto-cleanup
> devres resources. This allows us to use devm_drm_dev_alloc, which
> removes the last user of drm_dev_init.
>
> v2: Rebased
>
> v3: use devres_open/release_group so we can use devm without real
> hacks in the driver core or having to create an entire fake bus for
> testing drivers. Might want to extract this into helpers eventually,
> maybe as a mock_drm_dev_alloc or test_drm_dev_alloc.
>
> v4:
> - Fix IS_ERR handling (Matt)
> - Delete surplus put_device() in mock_device_release (intel-gfx-ci)
>
> Cc: Matthew Auld 
> Reviewed-by: Maarten Lankhorst  (v3)
> Cc: Maarten Lankhorst 
> Signed-off-by: Daniel Vetter 
> ---
>  .../gpu/drm/i915/selftests/mock_gem_device.c  | 44 +++
>  1 file changed, 25 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/selftests/mock_gem_device.c 
> b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> index ac600d395c8f..816f9af15fb3 100644
> --- a/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> +++ b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> @@ -79,8 +79,6 @@ static void mock_device_release(struct drm_device *dev)
>
>  out:
> i915_params_free(>params);
> -   put_device(>drm.pdev->dev);
> -   i915->drm.pdev = NULL;
>  }
>
>  static struct drm_driver mock_driver = {
> @@ -128,12 +126,6 @@ struct drm_i915_private *mock_gem_device(void)
> pdev = kzalloc(sizeof(*pdev), GFP_KERNEL);
> if (!pdev)
> return NULL;
> -   i915 = kzalloc(sizeof(*i915), GFP_KERNEL);
> -   if (!i915) {
> -   kfree(pdev);
> -   return NULL;
> -   }
> -
> device_initialize(>dev);
> pdev->class = PCI_BASE_CLASS_DISPLAY << 16;
> pdev->dev.release = release_dev;
> @@ -144,8 +136,29 @@ struct drm_i915_private *mock_gem_device(void)
> /* HACK to disable iommu for the fake device; force identity mapping 
> */
> pdev->dev.iommu = _iommu;
>  #endif
> +   err = device_add(>dev);
> +   if (err) {
> +   kfree(pdev);
> +   return NULL;
> +   }
> +
> +   if (!devres_open_group(>dev, NULL, GFP_KERNEL)) {
> +   device_del(>dev);
> +   return NULL;
> +   }
> +
> +   i915 = devm_drm_dev_alloc(>dev, _driver,
> + struct drm_i915_private, drm);
> +   if (IS_ERR(i915)) {
> +   pr_err("Failed to allocate mock GEM device: err=%d\n", err);

err = PTR_ERR(i915)

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


[PULL] drm-intel-next

2020-09-18 Thread Rodrigo Vivi
Hi Dave and Daniel,

here goes our last pull request targeting 5.10.

drm-intel-next-2020-09-17:
Driver Changes:

- Reduce INTEL_DISPLAY_ENABLED to just removed outputs treating it as 
disconnected (Ville)
- Introducing new AUX, DVO, and TC ports and refactoring code around hot plug 
interrupts for those. (Ville)
- Centralize PLL_ENABLE register lookup (Anusha)
- Improvements around DP downstream facing ports (DFP). (Ville)
- Enable YCbCr 444->420 conversion for HDMI DFPs. Ville
- Remove the old global state on Display's atomic modeset (Ville)
- Nuke force_min_cdclk_changed (Ville)
- Extend a TGL W/A to all SKUs and to RKL (Swathi)
drm-intel-next-2020-09-14-1:
GVT changes:

- Cleanup command access flag (Yan)
- New workaround cmd access fix (Colin)
- MIA reset state fix (Colin)

Cross-subsystem Changes:

- ACPI / LPSS: Cherry Trail PWM controller fixes for suspend/resume. (Hans)
- pwm lpss: changes for remove suspend/resume handers. (Hans)
- pwm crc: Fixes for better handling of pwm crcs. (Hans)

Driver Changes:

- HDCP improvements (Anshuman)
- Gen12 W/A addition and fixes (Clint, Jose)
- Spelling fixes (Colin)
- DRRS improvements (Jose)
- EHL and TGL voltage swing table fixes (Jose)
- Fix on returns and errors handling (Nathan)
- TGL PCI ID split for perf queries (Lionel)
- HDCP refactor with the addition of 1.4 support for MST connectors (Sean)
- Fix GLK display audio regression (Kai)
- More display refactor for better split away from gem (Jani)
- Honor the VBT PWM values for better backlight handling. (Hans)
- Disable all display features when no display and other changes around it 
(Jani)
- Some code clean up removing unused stuff (Ville)
- Some g4x+ changes for better sprite upscaling and color format (Ville)
drm-intel-next-2020-09-14:
UAPI Changes:

Cross-subsystem Changes:

Core Changes:

Driver Changes:
The following changes since commit 166774a2c2c6b82da5d984f587567071ff00c1f3:

  drm/i915: Fix slightly botched merge in __reloc_entry_gpu (2020-09-10 
15:19:10 +0200)

are available in the Git repository at:

  git://anongit.freedesktop.org/drm/drm-intel tags/drm-intel-next-2020-09-17

for you to fetch changes up to 8fea92536e3efff14fa4cde7ed37c595b40a52b5:

  drm/i915: Update DRIVER_DATE to 20200917 (2020-09-17 16:43:57 -0400)


Driver Changes:

- Reduce INTEL_DISPLAY_ENABLED to just removed outputs treating it as 
disconnected (Ville)
- Introducing new AUX, DVO, and TC ports and refactoring code around hot plug 
interrupts for those. (Ville)
- Centralize PLL_ENABLE register lookup (Anusha)
- Improvements around DP downstream facing ports (DFP). (Ville)
- Enable YCbCr 444->420 conversion for HDMI DFPs. Ville
- Remove the old global state on Display's atomic modeset (Ville)
- Nuke force_min_cdclk_changed (Ville)
- Extend a TGL W/A to all SKUs and to RKL (Swathi)


Anshuman Gupta (2):
  drm/i915/hdcp: Add update_pipe early return
  drm/i915/hdcp: No direct access to power_well desc

Anusha Srivatsa (1):
  drm/i915/pll: Centralize PLL_ENABLE register lookup

Chris Wilson (2):
  drm/i915: Initialise outparam for error return from wait_for_register
  drm/i915/selftests: Push the fake iommu device from the stack to data

Clint Taylor (1):
  drm/i915/gt: Implement WA_1406941453

Colin Ian King (1):
  drm/i915/vlv_dsi_pll: fix spelling mistake "Cant" -> "Can't"

Colin Xu (2):
  drm/i915/gvt: Add F_CMD_ACCESS for some GEN9 SKU WA MMIO access
  drm/i915/gvt: Init vreg GUC_STATUS to GS_MIA_IN_RESET

Hans de Goede (17):
  ACPI / LPSS: Resume Cherry Trail PWM controller in no-irq phase
  ACPI / LPSS: Save Cherry Trail PWM ctx registers only once (at activation)
  pwm: lpss: Fix off by one error in base_unit math in pwm_lpss_prepare()
  pwm: lpss: Add range limit check for the base_unit register value
  pwm: lpss: Add pwm_lpss_prepare_enable() helper
  pwm: lpss: Make pwm_lpss_apply() not rely on existing hardware state
  pwm: lpss: Remove suspend/resume handlers
  pwm: crc: Fix period / duty_cycle times being off by a factor of 256
  pwm: crc: Fix off-by-one error in the clock-divider calculations
  pwm: crc: Fix period changes not having any effect
  pwm: crc: Enable/disable PWM output on enable/disable
  pwm: crc: Implement apply() method to support the new atomic PWM API
  pwm: crc: Implement get_state() method
  drm/i915: panel: Add get_vbt_pwm_freq() helper
  drm/i915: panel: Honor the VBT PWM frequency for devs with an external 
PWM controller
  drm/i915: panel: Honor the VBT PWM min setting for devs with an external 
PWM controller
  drm/i915: panel: Use atomic PWM API for devs with an external PWM 
controller

Jani Nikula (7):
  drm/i915: split intel_modeset_init() pre/post gem init
  drm/i915: move more display related probe to intel_modeset_init_noirq()
  

[GIT PULL] cdns-mhdp bridge for 5.10

2020-09-18 Thread Tomi Valkeinen
Hi Dave, Daniel,

Here's a pull requests for Cadence MHDP DisplayPort bridge driver. It's almost
-rc6, but I'd like to see this merged in 5.10 to make it easier to get the last
bits (mainly dts files) merged in 5.11.

The MHDP driver compile-time-depends on two PHY patches (queued in phy tree),
for which there's a stable git branch based on -rc1 provided by Vinod:

git://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy phy-attrs-5.10

I have merged this stable branch here to keep MHDP compiling.

This is based on latest drm-next.

 Tomi   

The following changes since commit b40be05ed255d9a0257fb66ab2728ecca2c9d597:

  Merge branch 'for-5.10-drm-sg-fix' of https://github.com/mszyprow/linux into 
drm-next (2020-09-17 16:07:11 +1000)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux.git 
tags/cdns-mhdp-5.10

for you to fetch changes up to afba7e6c5fc190b687f3d87bc6d1029d1500c059:

  drm: bridge: cdns-mhdp8546: Add TI J721E wrapper (2020-09-18 15:16:02 +0300)


Cadence MHDP8546 DisplayPort bridge driver


Swapnil Jakhade (4):
  phy: Add new PHY attribute max_link_rate
  phy: cadence-torrent: Set Torrent PHY attributes
  drm: bridge: Add support for Cadence MHDP8546 DPI/DP bridge
  drm: bridge: cdns-mhdp8546: Add TI J721E wrapper

Tomi Valkeinen (1):
  Merge tag 'phy-attrs-5.10' of git://git.kernel.org/.../phy/linux-phy into 
5.10/dp-pull

Yuti Amonkar (1):
  dt-bindings: drm/bridge: Document Cadence MHDP8546 bridge bindings

 .../bindings/display/bridge/cdns,mhdp8546.yaml |  169 ++
 drivers/gpu/drm/bridge/Kconfig |2 +
 drivers/gpu/drm/bridge/Makefile|1 +
 drivers/gpu/drm/bridge/cadence/Kconfig |   24 +
 drivers/gpu/drm/bridge/cadence/Makefile|4 +
 .../gpu/drm/bridge/cadence/cdns-mhdp8546-core.c| 2532 
 .../gpu/drm/bridge/cadence/cdns-mhdp8546-core.h|  400 
 .../gpu/drm/bridge/cadence/cdns-mhdp8546-j721e.c   |   78 +
 .../gpu/drm/bridge/cadence/cdns-mhdp8546-j721e.h   |   19 +
 drivers/phy/cadence/phy-cadence-torrent.c  |4 +
 include/linux/phy/phy.h|2 +
 11 files changed, 3235 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/cdns,mhdp8546.yaml
 create mode 100644 drivers/gpu/drm/bridge/cadence/Kconfig
 create mode 100644 drivers/gpu/drm/bridge/cadence/Makefile
 create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c
 create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.h
 create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-j721e.c
 create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-j721e.h


-- 
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: [Intel-gfx] [PATCH 0/4] managed drm_device, absolute final leftover bits

2020-09-18 Thread Rodrigo Vivi
On Fri, Sep 18, 2020 at 11:03:12AM -0400, Alex Deucher wrote:
> On Fri, Sep 18, 2020 at 9:25 AM Daniel Vetter  wrote:
> >
> > Hi all,
> >
> > These are the leftovers of the leftovers of my initial drmm series to
> > manage drm_device.
> >
> > Changes:
> > - bugfixed i915 selftests
> > - patch from Luben to finalize the admgpu conversion
> >
> > Alex & i915 maintainers, pls ack for merging this all through
> > drm-misc-next since otherwise the final patch (and the resulting confusion
> > with outdated docs) is held up another round.
> 
> Acked-by: Alex Deucher 


Acked-by: Rodrigo Vivi 

> 
> >
> > Cheers, Daniel
> >
> > Daniel Vetter (3):
> >   drm/i915/selftest: Create mock_destroy_device
> >   drm/i915/selftests: align more to real device lifetimes
> >   drm/dev: Remove drm_dev_init
> >
> > Luben Tuikov (1):
> >   drm/amdgpu: Convert to using devm_drm_dev_alloc() (v2)
> >
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c   | 16 ++
> >  drivers/gpu/drm/drm_drv.c | 41 ++--
> >  drivers/gpu/drm/drm_internal.h|  1 +
> >  drivers/gpu/drm/drm_managed.c | 13 -
> >  .../gpu/drm/i915/gem/selftests/huge_pages.c   |  2 +-
> >  .../drm/i915/gem/selftests/i915_gem_context.c |  2 +-
> >  .../drm/i915/gem/selftests/i915_gem_dmabuf.c  |  2 +-
> >  .../drm/i915/gem/selftests/i915_gem_object.c  |  2 +-
> >  .../drm/i915/gem/selftests/i915_gem_phys.c|  2 +-
> >  drivers/gpu/drm/i915/gt/selftest_timeline.c   |  2 +-
> >  .../gpu/drm/i915/selftests/i915_gem_evict.c   |  2 +-
> >  drivers/gpu/drm/i915/selftests/i915_gem_gtt.c |  2 +-
> >  drivers/gpu/drm/i915/selftests/i915_request.c |  2 +-
> >  drivers/gpu/drm/i915/selftests/i915_vma.c |  2 +-
> >  .../drm/i915/selftests/intel_memory_region.c  |  2 +-
> >  .../gpu/drm/i915/selftests/mock_gem_device.c  | 49 ---
> >  .../gpu/drm/i915/selftests/mock_gem_device.h  |  2 +
> >  include/drm/drm_drv.h |  4 --
> >  18 files changed, 51 insertions(+), 97 deletions(-)
> >
> > --
> > 2.28.0
> >
> > ___
> > amd-gfx mailing list
> > amd-...@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/amd-gfx
> ___
> Intel-gfx mailing list
> intel-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 2/2] drm/vc4: crtc: Keep the previously assigned HVS FIFO

2020-09-18 Thread Dave Stevenson
Hi Maxime

Thanks for the patch - it makes mode switching reliable for me! :-)

On Fri, 18 Sep 2020 at 15:59, Maxime Ripard  wrote:
>
> The HVS FIFOs are currently assigned each time we have an atomic_check
> for all the enabled CRTCs.
>
> However, if we are running multiple outputs in parallel and we happen to
> disable the first (by index) CRTC, we end up changing the assigned FIFO
> of the second CRTC without disabling and reenabling the pixelvalve which
> ends up in a stall and eventually a VBLANK timeout.
>
> In order to fix this, we can create a special value for our assigned
> channel to mark it as disabled, and if our CRTC already had an assigned
> channel in its previous state, we keep on using it.
>
> Fixes: 87ebcd42fb7b ("drm/vc4: crtc: Assign output to channel automatically")
> Signed-off-by: Maxime Ripard 

Tested-by: Dave Stevenson 

Review comments below though.

> ---
>  drivers/gpu/drm/vc4/vc4_crtc.c | 13 ++---
>  drivers/gpu/drm/vc4/vc4_drv.h  |  1 +
>  drivers/gpu/drm/vc4/vc4_kms.c  | 21 +++--
>  3 files changed, 26 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
> index a393f93390a2..be754120faa8 100644
> --- a/drivers/gpu/drm/vc4/vc4_crtc.c
> +++ b/drivers/gpu/drm/vc4/vc4_crtc.c
> @@ -852,11 +852,18 @@ void vc4_crtc_destroy_state(struct drm_crtc *crtc,
>
>  void vc4_crtc_reset(struct drm_crtc *crtc)
>  {
> +   struct vc4_crtc_state *vc4_crtc_state;
> +
> if (crtc->state)
> vc4_crtc_destroy_state(crtc, crtc->state);
> -   crtc->state = kzalloc(sizeof(struct vc4_crtc_state), GFP_KERNEL);
> -   if (crtc->state)
> -   __drm_atomic_helper_crtc_reset(crtc, crtc->state);
> +
> +   vc4_crtc_state = kzalloc(sizeof(*vc4_crtc_state), GFP_KERNEL);
> +   if (!vc4_crtc_state)
> +   return;

This error path has me worried, but I may have missed it.

If crtc->state was set then it's been freed via
vc4_crtc_destroy_state. However I don't see anything that has reset
crtc->state to NULL.
If the new alloc fails then I believe we exit with crtc->state still
set to the old freed pointer.

The old code directly set crtc->state, so it got reset to NULL by the failure.

> +
> +   vc4_crtc_state->assigned_channel = VC4_HVS_CHANNEL_DISABLED;
> +   crtc->state = _crtc_state->base;
> +   __drm_atomic_helper_crtc_reset(crtc, crtc->state);
>  }
>
>  static const struct drm_crtc_funcs vc4_crtc_funcs = {
> diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h
> index 8c8d96b6289f..2b13f2126f13 100644
> --- a/drivers/gpu/drm/vc4/vc4_drv.h
> +++ b/drivers/gpu/drm/vc4/vc4_drv.h
> @@ -531,6 +531,7 @@ struct vc4_crtc_state {
> unsigned int bottom;
> } margins;
>  };
> +#define VC4_HVS_CHANNEL_DISABLED ((unsigned int) -1)

Checkpatch whinge on that
CHECK: No space is necessary after a cast
#55: FILE: drivers/gpu/drm/vc4/vc4_drv.h:539:
+#define VC4_HVS_CHANNEL_DISABLED ((unsigned int) -1)

CHECK: Please use a blank line after function/struct/union/enum declarations
#55: FILE: drivers/gpu/drm/vc4/vc4_drv.h:539:
 };
+#define VC4_HVS_CHANNEL_DISABLED ((unsigned int) -1)

>  static inline struct vc4_crtc_state *
>  to_vc4_crtc_state(struct drm_crtc_state *crtc_state)
> diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c
> index 01fa60844695..f452dad50c22 100644
> --- a/drivers/gpu/drm/vc4/vc4_kms.c
> +++ b/drivers/gpu/drm/vc4/vc4_kms.c
> @@ -616,7 +616,7 @@ static int
>  vc4_atomic_check(struct drm_device *dev, struct drm_atomic_state *state)
>  {
> unsigned long unassigned_channels = GENMASK(NUM_CHANNELS - 1, 0);
> -   struct drm_crtc_state *crtc_state;
> +   struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> struct drm_crtc *crtc;
> int i, ret;
>
> @@ -629,6 +629,7 @@ vc4_atomic_check(struct drm_device *dev, struct 
> drm_atomic_state *state)
>  * modified.
>  */
> list_for_each_entry(crtc, >mode_config.crtc_list, head) {
> +   struct drm_crtc_state *crtc_state;

Blank line between variables and code, or not in this subsystem?
Checkpatch hasn't complained to me here.

> if (!crtc->state->enable)
> continue;
>
> @@ -637,15 +638,23 @@ vc4_atomic_check(struct drm_device *dev, struct 
> drm_atomic_state *state)
> return PTR_ERR(crtc_state);
> }
>
> -   for_each_new_crtc_in_state(state, crtc, crtc_state, i) {
> -   struct vc4_crtc_state *vc4_crtc_state =
> -   to_vc4_crtc_state(crtc_state);
> +   for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, 
> new_crtc_state, i) {
> +   struct vc4_crtc_state *new_vc4_crtc_state =
> +   to_vc4_crtc_state(new_crtc_state);
> struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc);
> unsigned int matching_channels;
>
> - 

Re: [PATCH][next] drm/panel: fix null pointer dereference on pointer mode

2020-09-18 Thread Colin Ian King
On 18/09/2020 17:22, Guido Günther wrote:
> Hi,
> On Fri, Sep 18, 2020 at 04:51:36PM +0100, Colin King wrote:
>> From: Colin Ian King 
>>
>> Currently a null pointer check on pointer mode is passing mode to
>> function drm_mode_vrefresh and this causes a null pointer dereference
>> on mode.  Fix this by not calling drm_mode_vrefresh since the call
>> is only required for error reporting.
>>
>> Addresses-Coverity: ("Dereference after null check")
>> Fixes: 72967d5616d3 ("drm/panel: Add panel driver for the Mantix 
>> MLAF057WE51-X DSI panel")
>> Signed-off-by: Colin Ian King 
>> ---
>>  drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c | 5 ++---
>>  1 file changed, 2 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c 
>> b/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c
>> index 3482e28e30fc..be4761a643f9 100644
>> --- a/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c
>> +++ b/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c
>> @@ -202,9 +202,8 @@ static int mantix_get_modes(struct drm_panel *panel,
>>  
>>  mode = drm_mode_duplicate(connector->dev, _mode);
>>  if (!mode) {
>> -dev_err(ctx->dev, "Failed to add mode %ux%u@%u\n",
>> -default_mode.hdisplay, default_mode.vdisplay,
>> -drm_mode_vrefresh(mode));
>> +dev_err(ctx->dev, "Failed to add mode %ux%u\n",
>> +default_mode.hdisplay, default_mode.vdisplay);
>>  return -ENOMEM;
>>  }
> 
> drm_mode_vrefresh(_mode) gives some more clue what's going on -
> I have had a fix queued up in my tree already but if you send a v2
> that's fine.

I'll defer to your queued up fix.
> 
> Thanks!
>  -- Guido
> 
>>  
>> -- 
>> 2.27.0
>>

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


Re: [PATCH][next] drm/panel: fix null pointer dereference on pointer mode

2020-09-18 Thread Guido Günther
Hi,
On Fri, Sep 18, 2020 at 04:51:36PM +0100, Colin King wrote:
> From: Colin Ian King 
> 
> Currently a null pointer check on pointer mode is passing mode to
> function drm_mode_vrefresh and this causes a null pointer dereference
> on mode.  Fix this by not calling drm_mode_vrefresh since the call
> is only required for error reporting.
> 
> Addresses-Coverity: ("Dereference after null check")
> Fixes: 72967d5616d3 ("drm/panel: Add panel driver for the Mantix 
> MLAF057WE51-X DSI panel")
> Signed-off-by: Colin Ian King 
> ---
>  drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c 
> b/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c
> index 3482e28e30fc..be4761a643f9 100644
> --- a/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c
> +++ b/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c
> @@ -202,9 +202,8 @@ static int mantix_get_modes(struct drm_panel *panel,
>  
>   mode = drm_mode_duplicate(connector->dev, _mode);
>   if (!mode) {
> - dev_err(ctx->dev, "Failed to add mode %ux%u@%u\n",
> - default_mode.hdisplay, default_mode.vdisplay,
> - drm_mode_vrefresh(mode));
> + dev_err(ctx->dev, "Failed to add mode %ux%u\n",
> + default_mode.hdisplay, default_mode.vdisplay);
>   return -ENOMEM;
>   }

drm_mode_vrefresh(_mode) gives some more clue what's going on -
I have had a fix queued up in my tree already but if you send a v2
that's fine.

Thanks!
 -- Guido

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


[PATCH][next] drm/panel: fix null pointer dereference on pointer mode

2020-09-18 Thread Colin King
From: Colin Ian King 

Currently a null pointer check on pointer mode is passing mode to
function drm_mode_vrefresh and this causes a null pointer dereference
on mode.  Fix this by not calling drm_mode_vrefresh since the call
is only required for error reporting.

Addresses-Coverity: ("Dereference after null check")
Fixes: 72967d5616d3 ("drm/panel: Add panel driver for the Mantix MLAF057WE51-X 
DSI panel")
Signed-off-by: Colin Ian King 
---
 drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c 
b/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c
index 3482e28e30fc..be4761a643f9 100644
--- a/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c
+++ b/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c
@@ -202,9 +202,8 @@ static int mantix_get_modes(struct drm_panel *panel,
 
mode = drm_mode_duplicate(connector->dev, _mode);
if (!mode) {
-   dev_err(ctx->dev, "Failed to add mode %ux%u@%u\n",
-   default_mode.hdisplay, default_mode.vdisplay,
-   drm_mode_vrefresh(mode));
+   dev_err(ctx->dev, "Failed to add mode %ux%u\n",
+   default_mode.hdisplay, default_mode.vdisplay);
return -ENOMEM;
}
 
-- 
2.27.0

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


Re: [PATCH 1/2] drm/vc4: kms: Assign a FIFO to enabled CRTCs instead of active

2020-09-18 Thread Dave Stevenson
Hi Maxime

Thanks for the patch.

On Fri, 18 Sep 2020 at 15:59, Maxime Ripard  wrote:
>
> The HVS has three FIFOs that can be assigned to a number of PixelValves
> through a mux.
>
> However, changing that FIFO requires that we disable and then enable the
> pixelvalve, so we want to assign FIFOs to all the enabled CRTCs, and not
> just the active ones.
>
> Fixes: 87ebcd42fb7b ("drm/vc4: crtc: Assign output to channel automatically")
> Signed-off-by: Maxime Ripard 

Tested-by: Dave Stevenson 
Reviewed-by: Dave Stevenson 

> ---
>  drivers/gpu/drm/vc4/vc4_kms.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c
> index af3ee3dcdab6..01fa60844695 100644
> --- a/drivers/gpu/drm/vc4/vc4_kms.c
> +++ b/drivers/gpu/drm/vc4/vc4_kms.c
> @@ -643,7 +643,7 @@ vc4_atomic_check(struct drm_device *dev, struct 
> drm_atomic_state *state)
> struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc);
> unsigned int matching_channels;
>
> -   if (!crtc_state->active)
> +   if (!crtc_state->enable)
> continue;
>
> /*
> --
> 2.26.2
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 00/18] Convert arch/arm to use iommu-dma

2020-09-18 Thread Marek Szyprowski
Hi all,

On 24.08.2020 13:40, Marek Szyprowski wrote:
> On 20.08.2020 17:08, Robin Murphy wrote:
>> After 5 years or so of intending to get round to this, finally the
>> time comes! The changes themselves actualy turn out to be relatively
>> mechanical; the bigger concern appears to be how to get everything
>> merged across about 5 diffferent trees given the dependencies.
>>
>> I've lightly boot-tested things on Rockchip RK3288 and Exynos 4412
>> (Odroid-U3), to the degree that their display drivers should be using
>> IOMMU-backed buffers and don't explode (the Odroid doesn't manage to
>> send a working HDMI signal to the one monitor I have that it actually
>> detects, but that's a pre-existing condition...) Confirmation that the
>> Mediatek, OMAP and Tegra changes work will be most welcome.
>>
>> Patches are based on 5.9-rc1, branch available here:
>>
>>    git://linux-arm.org/linux-rm arm/dma
>
> Well, my first proposal for the ARM and ARM64 DMA-mapping unification 
> has been posted long time ago: https://lkml.org/lkml/2016/2/19/79
>
> Thanks for resurrecting it! :)
>
> I've tested this patchset on various ARM32bit Exynos based boards (not 
> only Exynos4412) and most of them works fine after your conversion. 
> However there are issues you cannot learn from the code.
>
> Conversion of the Exynos DRM was straightforward (thanks!), but there 
> are other Exynos drivers that depends on the old ARM implementation. 
> The S5P-MFC (only for the v5 hardware) and Exynos4 FIMC-ISP drivers 
> depends on the first-fit IOVA allocation algorithm in the old ARM 
> DMA-mapping. This was the main reason I've didn't continue my initial 
> conversion attempt.
>
> Both drivers allocate a buffer for their firmware and then in the 
> hardware registers address video buffers as an offset from the 
> begginning of the firmware. This doesn't work when underlying 
> DMA-mapping allocates IOVA with the last-fit algorithm, what the 
> drivers/iommu/dma-iommu.c does. So far I didn't find a good solution 
> for that issue.
>
> I'm open for suggestions. One more limitation for the S5P-MFC driver 
> is that the hardware is capable only for addressing 128MiB. They will 
> probably need to call IOMMU API directly, but I would like to keep as 
> much from the IOMMU/DMA-mapping code as possible.

Just for the record. I've finally managed to add needed workarounds to 
the both problematic Exynos4 drivers, so they work fine with this 
patchset. It turned out that it wasn't that hard:

https://lore.kernel.org/linux-samsung-soc/20200918144833.14618-1-m.szyprow...@samsung.com/T/#t

So from my side you have a green light to go ahead and switch ARM 32bit 
to generic code. Time to say good bye to the one of my biggest 
architecture related things merged once to mainline Linux. ;)

Best regards
-- 
Marek Szyprowski, PhD
Samsung R Institute Poland

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


Re: [PATCH 0/4] managed drm_device, absolute final leftover bits

2020-09-18 Thread Alex Deucher
On Fri, Sep 18, 2020 at 9:25 AM Daniel Vetter  wrote:
>
> Hi all,
>
> These are the leftovers of the leftovers of my initial drmm series to
> manage drm_device.
>
> Changes:
> - bugfixed i915 selftests
> - patch from Luben to finalize the admgpu conversion
>
> Alex & i915 maintainers, pls ack for merging this all through
> drm-misc-next since otherwise the final patch (and the resulting confusion
> with outdated docs) is held up another round.

Acked-by: Alex Deucher 

>
> Cheers, Daniel
>
> Daniel Vetter (3):
>   drm/i915/selftest: Create mock_destroy_device
>   drm/i915/selftests: align more to real device lifetimes
>   drm/dev: Remove drm_dev_init
>
> Luben Tuikov (1):
>   drm/amdgpu: Convert to using devm_drm_dev_alloc() (v2)
>
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c   | 16 ++
>  drivers/gpu/drm/drm_drv.c | 41 ++--
>  drivers/gpu/drm/drm_internal.h|  1 +
>  drivers/gpu/drm/drm_managed.c | 13 -
>  .../gpu/drm/i915/gem/selftests/huge_pages.c   |  2 +-
>  .../drm/i915/gem/selftests/i915_gem_context.c |  2 +-
>  .../drm/i915/gem/selftests/i915_gem_dmabuf.c  |  2 +-
>  .../drm/i915/gem/selftests/i915_gem_object.c  |  2 +-
>  .../drm/i915/gem/selftests/i915_gem_phys.c|  2 +-
>  drivers/gpu/drm/i915/gt/selftest_timeline.c   |  2 +-
>  .../gpu/drm/i915/selftests/i915_gem_evict.c   |  2 +-
>  drivers/gpu/drm/i915/selftests/i915_gem_gtt.c |  2 +-
>  drivers/gpu/drm/i915/selftests/i915_request.c |  2 +-
>  drivers/gpu/drm/i915/selftests/i915_vma.c |  2 +-
>  .../drm/i915/selftests/intel_memory_region.c  |  2 +-
>  .../gpu/drm/i915/selftests/mock_gem_device.c  | 49 ---
>  .../gpu/drm/i915/selftests/mock_gem_device.h  |  2 +
>  include/drm/drm_drv.h |  4 --
>  18 files changed, 51 insertions(+), 97 deletions(-)
>
> --
> 2.28.0
>
> ___
> amd-gfx mailing list
> amd-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 1/2] drm/ttm: remove nonsense AGP handling

2020-09-18 Thread Christian König
map_page_into_agp() and unmap_page_from_agp() are only defined on x86.

On all other platforms they are defined as noops. So this code doesn't has any 
effect at all.

Signed-off-by: Christian König 
---
 include/drm/ttm/ttm_set_memory.h | 44 
 1 file changed, 44 deletions(-)

diff --git a/include/drm/ttm/ttm_set_memory.h b/include/drm/ttm/ttm_set_memory.h
index 7c492b49e38c..3966655b72f1 100644
--- a/include/drm/ttm/ttm_set_memory.h
+++ b/include/drm/ttm/ttm_set_memory.h
@@ -71,48 +71,6 @@ static inline int ttm_set_pages_uc(struct page *page, int 
numpages)
 
 #else /* for CONFIG_X86 */
 
-#if IS_ENABLED(CONFIG_AGP)
-
-#include 
-
-static inline int ttm_set_pages_array_wb(struct page **pages, int addrinarray)
-{
-   int i;
-
-   for (i = 0; i < addrinarray; i++)
-   unmap_page_from_agp(pages[i]);
-   return 0;
-}
-
-static inline int ttm_set_pages_array_wc(struct page **pages, int addrinarray)
-{
-   int i;
-
-   for (i = 0; i < addrinarray; i++)
-   map_page_into_agp(pages[i]);
-   return 0;
-}
-
-static inline int ttm_set_pages_array_uc(struct page **pages, int addrinarray)
-{
-   int i;
-
-   for (i = 0; i < addrinarray; i++)
-   map_page_into_agp(pages[i]);
-   return 0;
-}
-
-static inline int ttm_set_pages_wb(struct page *page, int numpages)
-{
-   int i;
-
-   for (i = 0; i < numpages; i++)
-   unmap_page_from_agp(page++);
-   return 0;
-}
-
-#else /* for CONFIG_AGP */
-
 static inline int ttm_set_pages_array_wb(struct page **pages, int addrinarray)
 {
return 0;
@@ -133,8 +91,6 @@ static inline int ttm_set_pages_wb(struct page *page, int 
numpages)
return 0;
 }
 
-#endif /* for CONFIG_AGP */
-
 static inline int ttm_set_pages_wc(struct page *page, int numpages)
 {
return 0;
-- 
2.17.1

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


[PATCH 2/2] drm/ttm: stop dangerous caching attribute change

2020-09-18 Thread Christian König
When we swapout/in a BO we try to change the caching
attributes of the pages before/after doing the copy.

On x86 this is done by calling set_pages_uc(),
set_memory_wc() or set_pages_wb() for not highmem pages
to update the linear mapping of the page.

On all other platforms we do exactly nothing.

Now on x86 this is unnecessary because copy_highpage() will
either create a temporary mapping of the page which is wb
anyway and destroyed immediately again or use the linear
mapping with the correct caching attributes.

So stop this nonsense and just keep the caching as it is and
return an error when a driver tries to change the caching of
an already populated TT object.

This is much more defensive since changing caching
attributes is platform and driver specific and usually
doesn't work after the page was initially allocated.

Signed-off-by: Christian König 
---
 drivers/gpu/drm/ttm/ttm_bo.c |  5 +--
 drivers/gpu/drm/ttm/ttm_tt.c | 71 ++--
 include/drm/ttm/ttm_set_memory.h | 22 --
 3 files changed, 5 insertions(+), 93 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 1441bc86ac1c..1fa8d87c13ce 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -1555,14 +1555,13 @@ int ttm_bo_swapout(struct ttm_bo_global *glob, struct 
ttm_operation_ctx *ctx)
 * Move to system cached
 */
 
-   if (bo->mem.mem_type != TTM_PL_SYSTEM ||
-   bo->ttm->caching_state != tt_cached) {
+   if (bo->mem.mem_type != TTM_PL_SYSTEM) {
struct ttm_operation_ctx ctx = { false, false };
struct ttm_resource evict_mem;
 
evict_mem = bo->mem;
evict_mem.mm_node = NULL;
-   evict_mem.placement = TTM_PL_FLAG_CACHED;
+   evict_mem.placement = TTM_PL_MASK_CACHING;
evict_mem.mem_type = TTM_PL_SYSTEM;
 
ret = ttm_bo_handle_move_mem(bo, _mem, true, );
diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
index 014fb3656407..7c278216a188 100644
--- a/drivers/gpu/drm/ttm/ttm_tt.c
+++ b/drivers/gpu/drm/ttm/ttm_tt.c
@@ -38,7 +38,6 @@
 #include 
 #include 
 #include 
-#include 
 
 /**
  * Allocates a ttm structure for the given BO.
@@ -115,81 +114,19 @@ static int ttm_sg_tt_alloc_page_directory(struct 
ttm_dma_tt *ttm)
return 0;
 }
 
-static int ttm_tt_set_page_caching(struct page *p,
-  enum ttm_caching_state c_old,
-  enum ttm_caching_state c_new)
-{
-   int ret = 0;
-
-   if (PageHighMem(p))
-   return 0;
-
-   if (c_old != tt_cached) {
-   /* p isn't in the default caching state, set it to
-* writeback first to free its current memtype. */
-
-   ret = ttm_set_pages_wb(p, 1);
-   if (ret)
-   return ret;
-   }
-
-   if (c_new == tt_wc)
-   ret = ttm_set_pages_wc(p, 1);
-   else if (c_new == tt_uncached)
-   ret = ttm_set_pages_uc(p, 1);
-
-   return ret;
-}
-
-/*
- * Change caching policy for the linear kernel map
- * for range of pages in a ttm.
- */
-
 static int ttm_tt_set_caching(struct ttm_tt *ttm,
  enum ttm_caching_state c_state)
 {
-   int i, j;
-   struct page *cur_page;
-   int ret;
-
if (ttm->caching_state == c_state)
return 0;
 
-   if (!ttm_tt_is_populated(ttm)) {
-   /* Change caching but don't populate */
-   ttm->caching_state = c_state;
-   return 0;
-   }
-
-   if (ttm->caching_state == tt_cached)
-   drm_clflush_pages(ttm->pages, ttm->num_pages);
-
-   for (i = 0; i < ttm->num_pages; ++i) {
-   cur_page = ttm->pages[i];
-   if (likely(cur_page != NULL)) {
-   ret = ttm_tt_set_page_caching(cur_page,
- ttm->caching_state,
- c_state);
-   if (unlikely(ret != 0))
-   goto out_err;
-   }
-   }
+   /* Can't change the caching state after TT is populated */
+   if (WARN_ON_ONCE(ttm_tt_is_populated(ttm)))
+   return -EINVAL;
 
ttm->caching_state = c_state;
 
return 0;
-
-out_err:
-   for (j = 0; j < i; ++j) {
-   cur_page = ttm->pages[j];
-   if (likely(cur_page != NULL)) {
-   (void)ttm_tt_set_page_caching(cur_page, c_state,
- ttm->caching_state);
-   }
-   }
-
-   return ret;
 }
 
 int ttm_tt_set_placement_caching(struct ttm_tt *ttm, uint32_t placement)
@@ -353,8 +290,6 @@ int ttm_tt_swapout(struct ttm_bo_device *bdev, struct 
ttm_tt *ttm)
gfp_t gfp_mask;

Re: [PATCH] drm/vc4: hvs: Pull the state of all the CRTCs prior to PV muxing

2020-09-18 Thread Dave Stevenson
Hi Maxime

On Thu, 17 Sep 2020 at 13:16, Maxime Ripard  wrote:
>
> The vc4 display engine has a first controller called the HVS that will
> perform the composition of the planes. That HVS has 3 FIFOs and can
> therefore compose planes for up to three outputs. The timings part is
> generated through a component called the Pixel Valve, and the BCM2711 has 6
> of them.
>
> Thus, the HVS has some bits to control which FIFO gets output to which
> Pixel Valve. The current code supports that muxing by looking at all the
> CRTCs in a new DRM atomic state in atomic_check, and given the set of
> contraints that we have, assigns FIFOs to CRTCs or reject the mode

s/contraints/constraints

> entirely. The actual muxing will occur during atomic_commit.
>
> However, that doesn't work if only a fraction of the CRTCs' state is
> updated in that state, since it will ignore the CRTCs that are kept running
> unmodified, and will thus unassign its associated FIFO, and later disable
> it.

Yup, that would surely mess things up :)

> In order to make the code work as expected, let's pull the CRTC state of
> all the enabled CRTC in our atomic_check so that we can operate on all the
> running CRTCs, no matter whether they are affected by the new state or not.
>
> Cc: Hoegeun Kwon 
> Fixes: 87ebcd42fb7b ("drm/vc4: crtc: Assign output to channel automatically")
> Signed-off-by: Maxime Ripard 

Tested-by: Dave Stevenson 
Reviewed-by: Dave Stevenson 

Thanks
  Dave

> ---
>  drivers/gpu/drm/vc4/vc4_kms.c | 17 +
>  1 file changed, 17 insertions(+)
>
> diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c
> index 16e233e1406e..af3ee3dcdab6 100644
> --- a/drivers/gpu/drm/vc4/vc4_kms.c
> +++ b/drivers/gpu/drm/vc4/vc4_kms.c
> @@ -620,6 +620,23 @@ vc4_atomic_check(struct drm_device *dev, struct 
> drm_atomic_state *state)
> struct drm_crtc *crtc;
> int i, ret;
>
> +   /*
> +* Since the HVS FIFOs are shared across all the pixelvalves and
> +* the TXP (and thus all the CRTCs), we need to pull the current
> +* state of all the enabled CRTCs so that an update to a single
> +* CRTC still keeps the previous FIFOs enabled and assigned to
> +* the same CRTCs, instead of evaluating only the CRTC being
> +* modified.
> +*/
> +   list_for_each_entry(crtc, >mode_config.crtc_list, head) {
> +   if (!crtc->state->enable)
> +   continue;
> +
> +   crtc_state = drm_atomic_get_crtc_state(state, crtc);
> +   if (IS_ERR(crtc_state))
> +   return PTR_ERR(crtc_state);
> +   }
> +
> for_each_new_crtc_in_state(state, crtc, crtc_state, i) {
> struct vc4_crtc_state *vc4_crtc_state =
> to_vc4_crtc_state(crtc_state);
> --
> 2.26.2
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 14/18] drm/exynos: Consolidate IOMMU mapping code

2020-09-18 Thread Marek Szyprowski
Hi Robin,

On 20.08.2020 17:08, Robin Murphy wrote:
> Now that arch/arm is wired up for default domains and iommu-dma, we can
> consolidate the shared mapping code onto the generic IOMMU API version,
> and retire the arch-specific implementation.
>
> Signed-off-by: Robin Murphy 
>
> ---
> This is a cheeky revert of 07dc3678bacc ("drm/exynos: Fix cleanup of
> IOMMU related objects"), plus removal of the remaining arm_iommu_*
> references on top.

I have one more suggestion to this patch. Please rename 
exynos_drm_private->mapping to exynos_drm_private->domain and change its 
type from "void *" to "struct iommu_domain *". The "void *" was there to 
support both old-ARM and ARM64 IOMMU/DMA-mapping frameworks, but now we 
can use the proper pointer types.

> ---
>   drivers/gpu/drm/exynos/exynos5433_drm_decon.c |  5 +-
>   drivers/gpu/drm/exynos/exynos7_drm_decon.c|  5 +-
>   drivers/gpu/drm/exynos/exynos_drm_dma.c   | 61 +++
>   drivers/gpu/drm/exynos/exynos_drm_drv.h   |  6 +-
>   drivers/gpu/drm/exynos/exynos_drm_fimc.c  |  5 +-
>   drivers/gpu/drm/exynos/exynos_drm_fimd.c  |  5 +-
>   drivers/gpu/drm/exynos/exynos_drm_g2d.c   |  5 +-
>   drivers/gpu/drm/exynos/exynos_drm_gsc.c   |  5 +-
>   drivers/gpu/drm/exynos/exynos_drm_rotator.c   |  5 +-
>   drivers/gpu/drm/exynos/exynos_drm_scaler.c|  6 +-
>   drivers/gpu/drm/exynos/exynos_mixer.c |  7 +--
>   11 files changed, 29 insertions(+), 86 deletions(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c 
> b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
> index 1f79bc2a881e..8428ae12dfa5 100644
> --- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
> +++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
> @@ -55,7 +55,6 @@ static const char * const decon_clks_name[] = {
>   struct decon_context {
>   struct device   *dev;
>   struct drm_device   *drm_dev;
> - void*dma_priv;
>   struct exynos_drm_crtc  *crtc;
>   struct exynos_drm_plane planes[WINDOWS_NR];
>   struct exynos_drm_plane_config  configs[WINDOWS_NR];
> @@ -645,7 +644,7 @@ static int decon_bind(struct device *dev, struct device 
> *master, void *data)
>   
>   decon_clear_channels(ctx->crtc);
>   
> - return exynos_drm_register_dma(drm_dev, dev, >dma_priv);
> + return exynos_drm_register_dma(drm_dev, dev);
>   }
>   
>   static void decon_unbind(struct device *dev, struct device *master, void 
> *data)
> @@ -655,7 +654,7 @@ static void decon_unbind(struct device *dev, struct 
> device *master, void *data)
>   decon_atomic_disable(ctx->crtc);
>   
>   /* detach this sub driver from iommu mapping if supported. */
> - exynos_drm_unregister_dma(ctx->drm_dev, ctx->dev, >dma_priv);
> + exynos_drm_unregister_dma(ctx->drm_dev, ctx->dev);
>   }
>   
>   static const struct component_ops decon_component_ops = {
> diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c 
> b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
> index f2d87a7445c7..e7b58097ccdc 100644
> --- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
> +++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
> @@ -40,7 +40,6 @@
>   struct decon_context {
>   struct device   *dev;
>   struct drm_device   *drm_dev;
> - void*dma_priv;
>   struct exynos_drm_crtc  *crtc;
>   struct exynos_drm_plane planes[WINDOWS_NR];
>   struct exynos_drm_plane_config  configs[WINDOWS_NR];
> @@ -128,13 +127,13 @@ static int decon_ctx_initialize(struct decon_context 
> *ctx,
>   
>   decon_clear_channels(ctx->crtc);
>   
> - return exynos_drm_register_dma(drm_dev, ctx->dev, >dma_priv);
> + return exynos_drm_register_dma(drm_dev, ctx->dev);
>   }
>   
>   static void decon_ctx_remove(struct decon_context *ctx)
>   {
>   /* detach this sub driver from iommu mapping if supported. */
> - exynos_drm_unregister_dma(ctx->drm_dev, ctx->dev, >dma_priv);
> + exynos_drm_unregister_dma(ctx->drm_dev, ctx->dev);
>   }
>   
>   static u32 decon_calc_clkdiv(struct decon_context *ctx,
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_dma.c 
> b/drivers/gpu/drm/exynos/exynos_drm_dma.c
> index 58b89ec11b0e..fd5f9bcf1857 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_dma.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_dma.c
> @@ -14,19 +14,6 @@
>   
>   #include "exynos_drm_drv.h"
>   
> -#if defined(CONFIG_ARM_DMA_USE_IOMMU)
> -#include 
> -#else
> -#define arm_iommu_create_mapping(...)({ NULL; })
> -#define arm_iommu_attach_device(...) ({ -ENODEV; })
> -#define arm_iommu_release_mapping(...)   ({ })
> -#define arm_iommu_detach_device(...) ({ })
> -#define to_dma_iommu_mapping(dev) NULL
> -#endif
> -
> -#if !defined(CONFIG_IOMMU_DMA)
> -#define iommu_dma_init_domain(...) ({ -EINVAL; })
> -#endif
>   
>   #define EXYNOS_DEV_ADDR_START   0x2000
>   #define EXYNOS_DEV_ADDR_SIZE  

Re: [PATCH 4/4] drm/dev: Remove drm_dev_init

2020-09-18 Thread Thomas Zimmermann


Am 18.09.20 um 15:25 schrieb Daniel Vetter:
> We can now also delete drm_dev_init, now that vkms, vgem and i915
> selftests are resolved.
> 
> Signed-off-by: Daniel Vetter 

Reviewed-by: Thomas Zimmermann 

> ---
>  drivers/gpu/drm/drm_drv.c  | 41 +++---
>  drivers/gpu/drm/drm_internal.h |  1 +
>  drivers/gpu/drm/drm_managed.c  | 13 ---
>  include/drm/drm_drv.h  |  4 
>  4 files changed, 4 insertions(+), 55 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index 7c1689842ec0..457ac0f82be2 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -573,43 +573,9 @@ static void drm_dev_init_release(struct drm_device *dev, 
> void *res)
>   drm_legacy_destroy_members(dev);
>  }
>  
> -/**
> - * drm_dev_init - Initialise new DRM device
> - * @dev: DRM device
> - * @driver: DRM driver
> - * @parent: Parent device object
> - *
> - * Initialize a new DRM device. No device registration is done.
> - * Call drm_dev_register() to advertice the device to user space and 
> register it
> - * with other core subsystems. This should be done last in the device
> - * initialization sequence to make sure userspace can't access an 
> inconsistent
> - * state.
> - *
> - * The initial ref-count of the object is 1. Use drm_dev_get() and
> - * drm_dev_put() to take and drop further ref-counts.
> - *
> - * It is recommended that drivers embed  drm_device into their own 
> device
> - * structure.
> - *
> - * Drivers that do not want to allocate their own device struct
> - * embedding  drm_device can call drm_dev_alloc() instead. For drivers
> - * that do embed  drm_device it must be placed first in the overall
> - * structure, and the overall structure must be allocated using kmalloc(): 
> The
> - * drm core's release function unconditionally calls kfree() on the @dev 
> pointer
> - * when the final reference is released. To override this behaviour, and so
> - * allow embedding of the drm_device inside the driver's device struct at an
> - * arbitrary offset, you must supply a _driver.release callback and 
> control
> - * the finalization explicitly.
> - *
> - * Note that drivers must call drmm_add_final_kfree() after this function has
> - * completed successfully.
> - *
> - * RETURNS:
> - * 0 on success, or error code on failure.
> - */
> -int drm_dev_init(struct drm_device *dev,
> -  struct drm_driver *driver,
> -  struct device *parent)
> +static int drm_dev_init(struct drm_device *dev,
> + struct drm_driver *driver,
> + struct device *parent)
>  {
>   int ret;
>  
> @@ -689,7 +655,6 @@ int drm_dev_init(struct drm_device *dev,
>  
>   return ret;
>  }
> -EXPORT_SYMBOL(drm_dev_init);
>  
>  static void devm_drm_dev_init_release(void *data)
>  {
> diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h
> index 8e01caaf95cc..b65865c630b0 100644
> --- a/drivers/gpu/drm/drm_internal.h
> +++ b/drivers/gpu/drm/drm_internal.h
> @@ -95,6 +95,7 @@ void drm_minor_release(struct drm_minor *minor);
>  
>  /* drm_managed.c */
>  void drm_managed_release(struct drm_device *dev);
> +void drmm_add_final_kfree(struct drm_device *dev, void *container);
>  
>  /* drm_vblank.c */
>  static inline bool drm_vblank_passed(u64 seq, u64 ref)
> diff --git a/drivers/gpu/drm/drm_managed.c b/drivers/gpu/drm/drm_managed.c
> index c36e3d98fd71..37d7db6223be 100644
> --- a/drivers/gpu/drm/drm_managed.c
> +++ b/drivers/gpu/drm/drm_managed.c
> @@ -125,18 +125,6 @@ static void add_dr(struct drm_device *dev, struct drmres 
> *dr)
>  dr, dr->node.name, (unsigned long) dr->node.size);
>  }
>  
> -/**
> - * drmm_add_final_kfree - add release action for the final kfree()
> - * @dev: DRM device
> - * @container: pointer to the kmalloc allocation containing @dev
> - *
> - * Since the allocation containing the struct _device must be allocated
> - * before it can be initialized with drm_dev_init() there's no way to 
> allocate
> - * that memory with drmm_kmalloc(). To side-step this chicken-egg problem the
> - * pointer for this final kfree() must be specified by calling this 
> function. It
> - * will be released in the final drm_dev_put() for @dev, after all other 
> release
> - * actions installed through drmm_add_action() have been processed.
> - */
>  void drmm_add_final_kfree(struct drm_device *dev, void *container)
>  {
>   WARN_ON(dev->managed.final_kfree);
> @@ -144,7 +132,6 @@ void drmm_add_final_kfree(struct drm_device *dev, void 
> *container)
>   WARN_ON(dev + 1 > (struct drm_device *) (container + ksize(container)));
>   dev->managed.final_kfree = container;
>  }
> -EXPORT_SYMBOL(drmm_add_final_kfree);
>  
>  int __drmm_add_action(struct drm_device *dev,
> drmres_release_t action,
> diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
> index 533c6e1a5a95..b8ce9147c9a6 100644
> --- 

Re: [PATCH AUTOSEL 5.4 265/330] drm/amd/powerplay: try to do a graceful shutdown on SW CTF

2020-09-18 Thread Alex Deucher
On Fri, Sep 18, 2020 at 3:17 AM Quan, Evan  wrote:
>
> [AMD Official Use Only - Internal Distribution Only]
>
> Hi @Sasha Levin @Deucher, Alexander,
>
> The following changes need to be applied also.
> Otherwise, you may see unexpected shutdown on stress gpu loading on Vega10.
>
> drm/amd/pm: avoid false alarm due to confusing softwareshutdowntemp setting
> drm/amd/pm: correct the thermal alert temperature limit settings
> drm/amd/pm: correct Vega20 swctf limit setting
> drm/amd/pm: correct Vega12 swctf limit setting
> drm/amd/pm: correct Vega10 swctf limit setting

I would suggest we just drop this patch for kernels prior to 5.8
(where it was introduced).

Alex


>
> BR
> Evan
> -Original Message-
> From: Sasha Levin 
> Sent: Friday, September 18, 2020 10:00 AM
> To: linux-ker...@vger.kernel.org; sta...@vger.kernel.org
> Cc: Quan, Evan ; Deucher, Alexander 
> ; Sasha Levin ; 
> dri-devel@lists.freedesktop.org
> Subject: [PATCH AUTOSEL 5.4 265/330] drm/amd/powerplay: try to do a graceful 
> shutdown on SW CTF
>
> From: Evan Quan 
>
> [ Upstream commit 9495220577416632675959caf122e968469ffd16 ]
>
> Normally this(SW CTF) should not happen. And by doing graceful shutdown we 
> can prevent further damage.
>
> Signed-off-by: Evan Quan 
> Reviewed-by: Alex Deucher 
> Signed-off-by: Alex Deucher 
> Signed-off-by: Sasha Levin 
> ---
>  .../gpu/drm/amd/powerplay/hwmgr/smu_helper.c  | 21 +++
>  drivers/gpu/drm/amd/powerplay/smu_v11_0.c |  7 +++
>  2 files changed, 24 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu_helper.c 
> b/drivers/gpu/drm/amd/powerplay/hwmgr/smu_helper.c
> index d09690fca4520..414added3d02c 100644
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu_helper.c
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu_helper.c
> @@ -22,6 +22,7 @@
>   */
>
>  #include 
> +#include 
>
>  #include "hwmgr.h"
>  #include "pp_debug.h"
> @@ -593,12 +594,18 @@ int phm_irq_process(struct amdgpu_device *adev,
>  uint32_t src_id = entry->src_id;
>
>  if (client_id == AMDGPU_IRQ_CLIENTID_LEGACY) {
> -if (src_id == VISLANDS30_IV_SRCID_CG_TSS_THERMAL_LOW_TO_HIGH)
> +if (src_id == VISLANDS30_IV_SRCID_CG_TSS_THERMAL_LOW_TO_HIGH) {
>  pr_warn("GPU over temperature range detected on PCIe %d:%d.%d!\n",
>  PCI_BUS_NUM(adev->pdev->devfn),
>  PCI_SLOT(adev->pdev->devfn),
>  PCI_FUNC(adev->pdev->devfn));
> -else if (src_id == VISLANDS30_IV_SRCID_CG_TSS_THERMAL_HIGH_TO_LOW)
> +/*
> + * SW CTF just occurred.
> + * Try to do a graceful shutdown to prevent further damage.
> + */
> +dev_emerg(adev->dev, "System is going to shutdown due to SW CTF!\n");
> +orderly_poweroff(true);
> +} else if (src_id == VISLANDS30_IV_SRCID_CG_TSS_THERMAL_HIGH_TO_LOW)
>  pr_warn("GPU under temperature range detected on PCIe %d:%d.%d!\n",
>  PCI_BUS_NUM(adev->pdev->devfn),
>  PCI_SLOT(adev->pdev->devfn),
> @@ -609,12 +616,18 @@ int phm_irq_process(struct amdgpu_device *adev,
>  PCI_SLOT(adev->pdev->devfn),
>  PCI_FUNC(adev->pdev->devfn));
>  } else if (client_id == SOC15_IH_CLIENTID_THM) {
> -if (src_id == 0)
> +if (src_id == 0) {
>  pr_warn("GPU over temperature range detected on PCIe %d:%d.%d!\n",
>  PCI_BUS_NUM(adev->pdev->devfn),
>  PCI_SLOT(adev->pdev->devfn),
>  PCI_FUNC(adev->pdev->devfn));
> -else
> +/*
> + * SW CTF just occurred.
> + * Try to do a graceful shutdown to prevent further damage.
> + */
> +dev_emerg(adev->dev, "System is going to shutdown due to SW CTF!\n");
> +orderly_poweroff(true);
> +} else
>  pr_warn("GPU under temperature range detected on PCIe %d:%d.%d!\n",
>  PCI_BUS_NUM(adev->pdev->devfn),
>  PCI_SLOT(adev->pdev->devfn),
> diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c 
> b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
> index c4d8c52c6b9ca..6c4405622c9bb 100644
> --- a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
> +++ b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
> @@ -23,6 +23,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>
>  #include "pp_debug.h"
>  #include "amdgpu.h"
> @@ -1538,6 +1539,12 @@ static int smu_v11_0_irq_process(struct amdgpu_device 
> *adev,
>  PCI_BUS_NUM(adev->pdev->devfn),
>  PCI_SLOT(adev->pdev->devfn),
>  PCI_FUNC(adev->pdev->devfn));
> +/*
> + * SW CTF just occurred.
> + * Try to do a graceful shutdown to prevent further damage.
> + */
> +dev_emerg(adev->dev, "System is going to shutdown due to SW CTF!\n");
> +orderly_poweroff(true);
>  break;
>  case THM_11_0__SRCID__THM_DIG_THERM_H2L:
>  pr_warn("GPU under temperature range detected on PCIe %d:%d.%d!\n",
> --
> 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


[PATCH 3/4] drm/amdgpu: Convert to using devm_drm_dev_alloc() (v2)

2020-09-18 Thread Daniel Vetter
From: Luben Tuikov 

Convert to using devm_drm_dev_alloc(),
as drm_dev_init() is going away.

v2: Remove drm_dev_put() since
a) devres doesn't do refcounting, see
Documentation/driver-api/driver-model/devres.rst,
Section 4, paragraph 1; and since
b) devres acts as garbage collector when
the DRM device's parent's devres "action" callback
is called to free the container device (amdgpu_device),
which embeds the DRM dev.

Signed-off-by: Luben Tuikov 
Reviewed-by: Alex Deucher 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 16 
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 6edde2b9e402..3ded6f43f982 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -1142,25 +1142,20 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
if (ret)
return ret;
 
-   adev = kzalloc(sizeof(*adev), GFP_KERNEL);
-   if (!adev)
-   return -ENOMEM;
+   adev = devm_drm_dev_alloc(>dev, _driver, typeof(*adev), ddev);
+   if (IS_ERR(adev))
+   return PTR_ERR(adev);
 
adev->dev  = >dev;
adev->pdev = pdev;
ddev = adev_to_drm(adev);
-   ret = drm_dev_init(ddev, _driver, >dev);
-   if (ret)
-   goto err_free;
-
-   drmm_add_final_kfree(ddev, adev);
 
if (!supports_atomic)
ddev->driver_features &= ~DRIVER_ATOMIC;
 
ret = pci_enable_device(pdev);
if (ret)
-   goto err_free;
+   return ret;
 
ddev->pdev = pdev;
pci_set_drvdata(pdev, ddev);
@@ -1188,8 +1183,6 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
 
 err_pci:
pci_disable_device(pdev);
-err_free:
-   drm_dev_put(ddev);
return ret;
 }
 
@@ -1206,7 +1199,6 @@ amdgpu_pci_remove(struct pci_dev *pdev)
amdgpu_driver_unload_kms(dev);
pci_disable_device(pdev);
pci_set_drvdata(pdev, NULL);
-   drm_dev_put(dev);
 }
 
 static void
-- 
2.28.0

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


[PATCH 4/4] drm/dev: Remove drm_dev_init

2020-09-18 Thread Daniel Vetter
We can now also delete drm_dev_init, now that vkms, vgem and i915
selftests are resolved.

Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_drv.c  | 41 +++---
 drivers/gpu/drm/drm_internal.h |  1 +
 drivers/gpu/drm/drm_managed.c  | 13 ---
 include/drm/drm_drv.h  |  4 
 4 files changed, 4 insertions(+), 55 deletions(-)

diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 7c1689842ec0..457ac0f82be2 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -573,43 +573,9 @@ static void drm_dev_init_release(struct drm_device *dev, 
void *res)
drm_legacy_destroy_members(dev);
 }
 
-/**
- * drm_dev_init - Initialise new DRM device
- * @dev: DRM device
- * @driver: DRM driver
- * @parent: Parent device object
- *
- * Initialize a new DRM device. No device registration is done.
- * Call drm_dev_register() to advertice the device to user space and register 
it
- * with other core subsystems. This should be done last in the device
- * initialization sequence to make sure userspace can't access an inconsistent
- * state.
- *
- * The initial ref-count of the object is 1. Use drm_dev_get() and
- * drm_dev_put() to take and drop further ref-counts.
- *
- * It is recommended that drivers embed  drm_device into their own 
device
- * structure.
- *
- * Drivers that do not want to allocate their own device struct
- * embedding  drm_device can call drm_dev_alloc() instead. For drivers
- * that do embed  drm_device it must be placed first in the overall
- * structure, and the overall structure must be allocated using kmalloc(): The
- * drm core's release function unconditionally calls kfree() on the @dev 
pointer
- * when the final reference is released. To override this behaviour, and so
- * allow embedding of the drm_device inside the driver's device struct at an
- * arbitrary offset, you must supply a _driver.release callback and control
- * the finalization explicitly.
- *
- * Note that drivers must call drmm_add_final_kfree() after this function has
- * completed successfully.
- *
- * RETURNS:
- * 0 on success, or error code on failure.
- */
-int drm_dev_init(struct drm_device *dev,
-struct drm_driver *driver,
-struct device *parent)
+static int drm_dev_init(struct drm_device *dev,
+   struct drm_driver *driver,
+   struct device *parent)
 {
int ret;
 
@@ -689,7 +655,6 @@ int drm_dev_init(struct drm_device *dev,
 
return ret;
 }
-EXPORT_SYMBOL(drm_dev_init);
 
 static void devm_drm_dev_init_release(void *data)
 {
diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h
index 8e01caaf95cc..b65865c630b0 100644
--- a/drivers/gpu/drm/drm_internal.h
+++ b/drivers/gpu/drm/drm_internal.h
@@ -95,6 +95,7 @@ void drm_minor_release(struct drm_minor *minor);
 
 /* drm_managed.c */
 void drm_managed_release(struct drm_device *dev);
+void drmm_add_final_kfree(struct drm_device *dev, void *container);
 
 /* drm_vblank.c */
 static inline bool drm_vblank_passed(u64 seq, u64 ref)
diff --git a/drivers/gpu/drm/drm_managed.c b/drivers/gpu/drm/drm_managed.c
index c36e3d98fd71..37d7db6223be 100644
--- a/drivers/gpu/drm/drm_managed.c
+++ b/drivers/gpu/drm/drm_managed.c
@@ -125,18 +125,6 @@ static void add_dr(struct drm_device *dev, struct drmres 
*dr)
   dr, dr->node.name, (unsigned long) dr->node.size);
 }
 
-/**
- * drmm_add_final_kfree - add release action for the final kfree()
- * @dev: DRM device
- * @container: pointer to the kmalloc allocation containing @dev
- *
- * Since the allocation containing the struct _device must be allocated
- * before it can be initialized with drm_dev_init() there's no way to allocate
- * that memory with drmm_kmalloc(). To side-step this chicken-egg problem the
- * pointer for this final kfree() must be specified by calling this function. 
It
- * will be released in the final drm_dev_put() for @dev, after all other 
release
- * actions installed through drmm_add_action() have been processed.
- */
 void drmm_add_final_kfree(struct drm_device *dev, void *container)
 {
WARN_ON(dev->managed.final_kfree);
@@ -144,7 +132,6 @@ void drmm_add_final_kfree(struct drm_device *dev, void 
*container)
WARN_ON(dev + 1 > (struct drm_device *) (container + ksize(container)));
dev->managed.final_kfree = container;
 }
-EXPORT_SYMBOL(drmm_add_final_kfree);
 
 int __drmm_add_action(struct drm_device *dev,
  drmres_release_t action,
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index 533c6e1a5a95..b8ce9147c9a6 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -591,10 +591,6 @@ struct drm_driver {
int dev_priv_size;
 };
 
-int drm_dev_init(struct drm_device *dev,
-struct drm_driver *driver,
-struct device *parent);
-
 void *__devm_drm_dev_alloc(struct device *parent, struct drm_driver 

[PATCH 2/4] drm/i915/selftests: align more to real device lifetimes

2020-09-18 Thread Daniel Vetter
The big change is device_add so that device_del can auto-cleanup
devres resources. This allows us to use devm_drm_dev_alloc, which
removes the last user of drm_dev_init.

v2: Rebased

v3: use devres_open/release_group so we can use devm without real
hacks in the driver core or having to create an entire fake bus for
testing drivers. Might want to extract this into helpers eventually,
maybe as a mock_drm_dev_alloc or test_drm_dev_alloc.

v4:
- Fix IS_ERR handling (Matt)
- Delete surplus put_device() in mock_device_release (intel-gfx-ci)

Cc: Matthew Auld 
Reviewed-by: Maarten Lankhorst  (v3)
Cc: Maarten Lankhorst 
Signed-off-by: Daniel Vetter 
---
 .../gpu/drm/i915/selftests/mock_gem_device.c  | 44 +++
 1 file changed, 25 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/i915/selftests/mock_gem_device.c 
b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
index ac600d395c8f..816f9af15fb3 100644
--- a/drivers/gpu/drm/i915/selftests/mock_gem_device.c
+++ b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
@@ -79,8 +79,6 @@ static void mock_device_release(struct drm_device *dev)
 
 out:
i915_params_free(>params);
-   put_device(>drm.pdev->dev);
-   i915->drm.pdev = NULL;
 }
 
 static struct drm_driver mock_driver = {
@@ -128,12 +126,6 @@ struct drm_i915_private *mock_gem_device(void)
pdev = kzalloc(sizeof(*pdev), GFP_KERNEL);
if (!pdev)
return NULL;
-   i915 = kzalloc(sizeof(*i915), GFP_KERNEL);
-   if (!i915) {
-   kfree(pdev);
-   return NULL;
-   }
-
device_initialize(>dev);
pdev->class = PCI_BASE_CLASS_DISPLAY << 16;
pdev->dev.release = release_dev;
@@ -144,8 +136,29 @@ struct drm_i915_private *mock_gem_device(void)
/* HACK to disable iommu for the fake device; force identity mapping */
pdev->dev.iommu = _iommu;
 #endif
+   err = device_add(>dev);
+   if (err) {
+   kfree(pdev);
+   return NULL;
+   }
+
+   if (!devres_open_group(>dev, NULL, GFP_KERNEL)) {
+   device_del(>dev);
+   return NULL;
+   }
+
+   i915 = devm_drm_dev_alloc(>dev, _driver,
+ struct drm_i915_private, drm);
+   if (IS_ERR(i915)) {
+   pr_err("Failed to allocate mock GEM device: err=%d\n", err);
+   devres_release_group(>dev, NULL);
+   device_del(>dev);
+
+   return NULL;
+   }
 
pci_set_drvdata(pdev, i915);
+   i915->drm.pdev = pdev;
 
dev_pm_domain_set(>dev, _domain);
pm_runtime_enable(>dev);
@@ -153,16 +166,6 @@ struct drm_i915_private *mock_gem_device(void)
if (pm_runtime_enabled(>dev))
WARN_ON(pm_runtime_get_sync(>dev));
 
-   err = drm_dev_init(>drm, _driver, >dev);
-   if (err) {
-   pr_err("Failed to initialise mock GEM device: err=%d\n", err);
-   put_device(>dev);
-   kfree(i915);
-
-   return NULL;
-   }
-   i915->drm.pdev = pdev;
-   drmm_add_final_kfree(>drm, i915);
 
i915_params_copy(>params, _modparams);
 
@@ -229,5 +232,8 @@ struct drm_i915_private *mock_gem_device(void)
 
 void mock_destroy_device(struct drm_i915_private *i915)
 {
-   drm_dev_put(>drm);
+   struct device *dev = i915->drm.dev;
+
+   devres_release_group(dev, NULL);
+   device_del(dev);
 }
-- 
2.28.0

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


[PATCH 1/4] drm/i915/selftest: Create mock_destroy_device

2020-09-18 Thread Daniel Vetter
Just some prep work before we rework the lifetime handling, which
requires replacing all the drm_dev_put in selftests by something else.

v2: Don't go with a static inline, upsets the header tests and
separation.

Reviewed-by: Maarten Lankhorst 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/i915/gem/selftests/huge_pages.c   | 2 +-
 drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c | 2 +-
 drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c  | 2 +-
 drivers/gpu/drm/i915/gem/selftests/i915_gem_object.c  | 2 +-
 drivers/gpu/drm/i915/gem/selftests/i915_gem_phys.c| 2 +-
 drivers/gpu/drm/i915/gt/selftest_timeline.c   | 2 +-
 drivers/gpu/drm/i915/selftests/i915_gem_evict.c   | 2 +-
 drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 2 +-
 drivers/gpu/drm/i915/selftests/i915_request.c | 2 +-
 drivers/gpu/drm/i915/selftests/i915_vma.c | 2 +-
 drivers/gpu/drm/i915/selftests/intel_memory_region.c  | 2 +-
 drivers/gpu/drm/i915/selftests/mock_gem_device.c  | 7 ++-
 drivers/gpu/drm/i915/selftests/mock_gem_device.h  | 2 ++
 13 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/selftests/huge_pages.c 
b/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
index 5daf4a2be422..1f35e71429b4 100644
--- a/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
+++ b/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
@@ -1617,7 +1617,7 @@ int i915_gem_huge_page_mock_selftests(void)
 out_put:
i915_vm_put(>vm);
 out_unlock:
-   drm_dev_put(_priv->drm);
+   mock_destroy_device(dev_priv);
return err;
 }
 
diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c 
b/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c
index 99becb86abd3..d3f87dc4eda3 100644
--- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c
@@ -1997,7 +1997,7 @@ int i915_gem_context_mock_selftests(void)
 
err = i915_subtests(tests, i915);
 
-   drm_dev_put(>drm);
+   mock_destroy_device(i915);
return err;
 }
 
diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c 
b/drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c
index 2a52b92586b9..0845ce1ae37c 100644
--- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c
+++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c
@@ -272,7 +272,7 @@ int i915_gem_dmabuf_mock_selftests(void)
 
err = i915_subtests(tests, i915);
 
-   drm_dev_put(>drm);
+   mock_destroy_device(i915);
return err;
 }
 
diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_object.c 
b/drivers/gpu/drm/i915/gem/selftests/i915_gem_object.c
index faa5b6d91795..bf853c40ec65 100644
--- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_object.c
+++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_object.c
@@ -85,7 +85,7 @@ int i915_gem_object_mock_selftests(void)
 
err = i915_subtests(tests, i915);
 
-   drm_dev_put(>drm);
+   mock_destroy_device(i915);
return err;
 }
 
diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_phys.c 
b/drivers/gpu/drm/i915/gem/selftests/i915_gem_phys.c
index a94243dc4c5c..8cee68c6a6dc 100644
--- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_phys.c
+++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_phys.c
@@ -73,6 +73,6 @@ int i915_gem_phys_mock_selftests(void)
 
err = i915_subtests(tests, i915);
 
-   drm_dev_put(>drm);
+   mock_destroy_device(i915);
return err;
 }
diff --git a/drivers/gpu/drm/i915/gt/selftest_timeline.c 
b/drivers/gpu/drm/i915/gt/selftest_timeline.c
index 96d164a3841d..19c2cb166e7c 100644
--- a/drivers/gpu/drm/i915/gt/selftest_timeline.c
+++ b/drivers/gpu/drm/i915/gt/selftest_timeline.c
@@ -158,7 +158,7 @@ static int mock_hwsp_freelist(void *arg)
__mock_hwsp_record(, na, NULL);
kfree(state.history);
 err_put:
-   drm_dev_put(>drm);
+   mock_destroy_device(i915);
return err;
 }
 
diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_evict.c 
b/drivers/gpu/drm/i915/selftests/i915_gem_evict.c
index 028baae9631f..f88473d396f4 100644
--- a/drivers/gpu/drm/i915/selftests/i915_gem_evict.c
+++ b/drivers/gpu/drm/i915/selftests/i915_gem_evict.c
@@ -536,7 +536,7 @@ int i915_gem_evict_mock_selftests(void)
with_intel_runtime_pm(>runtime_pm, wakeref)
err = i915_subtests(tests, >gt);
 
-   drm_dev_put(>drm);
+   mock_destroy_device(i915);
return err;
 }
 
diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c 
b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
index af8205a2bd8f..c53a222e3dec 100644
--- a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
@@ -1727,7 +1727,7 @@ int i915_gem_gtt_mock_selftests(void)
mock_fini_ggtt(ggtt);
kfree(ggtt);
 out_put:
-   drm_dev_put(>drm);
+   mock_destroy_device(i915);
return err;
 }
 
diff --git 

[PATCH 0/4] managed drm_device, absolute final leftover bits

2020-09-18 Thread Daniel Vetter
Hi all,

These are the leftovers of the leftovers of my initial drmm series to
manage drm_device.

Changes:
- bugfixed i915 selftests
- patch from Luben to finalize the admgpu conversion

Alex & i915 maintainers, pls ack for merging this all through
drm-misc-next since otherwise the final patch (and the resulting confusion
with outdated docs) is held up another round.

Cheers, Daniel

Daniel Vetter (3):
  drm/i915/selftest: Create mock_destroy_device
  drm/i915/selftests: align more to real device lifetimes
  drm/dev: Remove drm_dev_init

Luben Tuikov (1):
  drm/amdgpu: Convert to using devm_drm_dev_alloc() (v2)

 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c   | 16 ++
 drivers/gpu/drm/drm_drv.c | 41 ++--
 drivers/gpu/drm/drm_internal.h|  1 +
 drivers/gpu/drm/drm_managed.c | 13 -
 .../gpu/drm/i915/gem/selftests/huge_pages.c   |  2 +-
 .../drm/i915/gem/selftests/i915_gem_context.c |  2 +-
 .../drm/i915/gem/selftests/i915_gem_dmabuf.c  |  2 +-
 .../drm/i915/gem/selftests/i915_gem_object.c  |  2 +-
 .../drm/i915/gem/selftests/i915_gem_phys.c|  2 +-
 drivers/gpu/drm/i915/gt/selftest_timeline.c   |  2 +-
 .../gpu/drm/i915/selftests/i915_gem_evict.c   |  2 +-
 drivers/gpu/drm/i915/selftests/i915_gem_gtt.c |  2 +-
 drivers/gpu/drm/i915/selftests/i915_request.c |  2 +-
 drivers/gpu/drm/i915/selftests/i915_vma.c |  2 +-
 .../drm/i915/selftests/intel_memory_region.c  |  2 +-
 .../gpu/drm/i915/selftests/mock_gem_device.c  | 49 ---
 .../gpu/drm/i915/selftests/mock_gem_device.h  |  2 +
 include/drm/drm_drv.h |  4 --
 18 files changed, 51 insertions(+), 97 deletions(-)

-- 
2.28.0

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


Re: [PATCH] drm/ttm: update kernel-doc line comments

2020-09-18 Thread Christian König

Am 18.09.20 um 14:46 schrieb Daniel Vetter:

On Fri, Sep 18, 2020 at 06:44:25PM +0800, Huang Rui wrote:

On Fri, Sep 18, 2020 at 05:52:58PM +0800, Tian Tao wrote:

Update kernel-doc line comments to fix warnings reported by make W=1.

drivers/gpu/drm/ttm/ttm_memory.c:271: warning: Function parameter or
member 'glob' not described in 'ttm_shrink'
drivers/gpu/drm/ttm/ttm_memory.c:271: warning: Function parameter or
member 'from_wq' not described in 'ttm_shrink'
drivers/gpu/drm/ttm/ttm_memory.c:271: warning: Function parameter or
member 'extra' not described in 'ttm_shrink'
drivers/gpu/drm/ttm/ttm_memory.c:271: warning: Function parameter or
member 'ctx' not described in 'ttm_shrink'

Signed-off-by: Tian Tao 

Acked-by: Huang Rui 

It would be nice to go through ttm docs and polish them so their proper.
This patch here just shuts up the warning without fixing any of the
documentation issues. Fixing the docs would be much better.


Yeah, but I would do this only after Dave and I are done with re-writing 
this :)


Otherwise it is just a waste of time.

Christian.


-Daniel


---
  drivers/gpu/drm/ttm/ttm_memory.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/ttm/ttm_memory.c b/drivers/gpu/drm/ttm/ttm_memory.c
index acd63b7..0b51773 100644
--- a/drivers/gpu/drm/ttm/ttm_memory.c
+++ b/drivers/gpu/drm/ttm/ttm_memory.c
@@ -259,7 +259,7 @@ static bool ttm_zones_above_swap_target(struct 
ttm_mem_global *glob,
return false;
  }
  
-/**

+/*
   * At this point we only support a single shrink callback.
   * Extend this if needed, perhaps using a linked list of callbacks.
   * Note that this function is reentrant:
--
2.7.4



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


Re: [PATCH] drm/panel: otm8009a: remove hack to force commands in HS

2020-09-18 Thread Daniel Vetter
On Fri, Sep 18, 2020 at 01:47:18PM +0200, Yannick Fertre wrote:
> From: Antonio Borneo 
> 
> The panel is able to receive commands in LP. The current hack to
> force backlight commands in HS was due to workaround an incorrect
> settings on DSI controller that prevents sending LP commands while
> video out was active.
> 
> Remove the hack that forces HS commands.
> 
> Signed-off-by: Antonio Borneo 

This and the next are missing your s-o-b line. Also you've done a bunch of
gpu patches arlready, want drm-misc commit rights so you can make sure
they all do land?

https://drm.pages.freedesktop.org/maintainer-tools/getting-started.html

There's tons more docs about how the tooling and process works.

Cheers, Daniel

> ---
>  .../gpu/drm/panel/panel-orisetech-otm8009a.c   | 18 ++
>  1 file changed, 2 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c 
> b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
> index 6ac1accade80..f80b44a8a700 100644
> --- a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
> +++ b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
> @@ -99,20 +99,6 @@ static void otm8009a_dcs_write_buf(struct otm8009a *ctx, 
> const void *data,
>   dev_warn(ctx->dev, "mipi dsi dcs write buffer failed\n");
>  }
>  
> -static void otm8009a_dcs_write_buf_hs(struct otm8009a *ctx, const void *data,
> -   size_t len)
> -{
> - struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
> -
> - /* data will be sent in dsi hs mode (ie. no lpm) */
> - dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
> -
> - otm8009a_dcs_write_buf(ctx, data, len);
> -
> - /* restore back the dsi lpm mode */
> - dsi->mode_flags |= MIPI_DSI_MODE_LPM;
> -}
> -
>  #define dcs_write_seq(ctx, seq...)   \
>  ({   \
>   static const u8 d[] = { seq };  \
> @@ -400,7 +386,7 @@ static int otm8009a_backlight_update_status(struct 
> backlight_device *bd)
>*/
>   data[0] = MIPI_DCS_SET_DISPLAY_BRIGHTNESS;
>   data[1] = bd->props.brightness;
> - otm8009a_dcs_write_buf_hs(ctx, data, ARRAY_SIZE(data));
> + otm8009a_dcs_write_buf(ctx, data, ARRAY_SIZE(data));
>  
>   /* set Brightness Control & Backlight on */
>   data[1] = 0x24;
> @@ -412,7 +398,7 @@ static int otm8009a_backlight_update_status(struct 
> backlight_device *bd)
>  
>   /* Update Brightness Control & Backlight */
>   data[0] = MIPI_DCS_WRITE_CONTROL_DISPLAY;
> - otm8009a_dcs_write_buf_hs(ctx, data, ARRAY_SIZE(data));
> + otm8009a_dcs_write_buf(ctx, data, ARRAY_SIZE(data));
>  
>   return 0;
>  }
> -- 
> 2.17.1
> 

-- 
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] dmabuf: fix NULL pointer dereference in dma_buf_release()

2020-09-18 Thread Daniel Vetter
On Fri, Sep 18, 2020 at 01:16:16PM +0200, Christian König wrote:
> Am 18.09.20 um 12:32 schrieb Charan Teja Reddy:
> > NULL pointer dereference is observed while exporting the dmabuf but
> > failed to allocate the 'struct file' which results into the dropping of
> > the allocated dentry corresponding to this file in the dmabuf fs, which
> > is ending up in dma_buf_release() and accessing the uninitialzed
> > dentry->d_fsdata.
> > 
> > Call stack on 5.4 is below:
> >   dma_buf_release+0x2c/0x254 drivers/dma-buf/dma-buf.c:88
> >   __dentry_kill+0x294/0x31c fs/dcache.c:584
> >   dentry_kill fs/dcache.c:673 [inline]
> >   dput+0x250/0x380 fs/dcache.c:859
> >   path_put+0x24/0x40 fs/namei.c:485
> >   alloc_file_pseudo+0x1a4/0x200 fs/file_table.c:235
> >   dma_buf_getfile drivers/dma-buf/dma-buf.c:473 [inline]
> >   dma_buf_export+0x25c/0x3ec drivers/dma-buf/dma-buf.c:585
> > 
> > Fix this by checking for the valid pointer in the dentry->d_fsdata.
> > 
> > Fixes: 4ab59c3c638c ("dma-buf: Move dma_buf_release() from fops to 
> > dentry_ops")
> > Cc:  [5.7+]
> > Signed-off-by: Charan Teja Reddy 
> 
> Reviewed-by: Christian König 
> 
> Going to pick this up for inclusion into drm-misc-next as well.

drm-misc-fixes since this is a bugfix that needs to be backported.
-Daniel

> 
> > ---
> >   drivers/dma-buf/dma-buf.c | 2 ++
> >   1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
> > index 58564d82..844967f 100644
> > --- a/drivers/dma-buf/dma-buf.c
> > +++ b/drivers/dma-buf/dma-buf.c
> > @@ -59,6 +59,8 @@ static void dma_buf_release(struct dentry *dentry)
> > struct dma_buf *dmabuf;
> > dmabuf = dentry->d_fsdata;
> > +   if (unlikely(!dmabuf))
> > +   return;
> > BUG_ON(dmabuf->vmapping_counter);
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
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 0/3] fbdev: stop using compat_alloc_user_space

2020-09-18 Thread Daniel Vetter
On Fri, Sep 18, 2020 at 12:08:10PM +0200, Arnd Bergmann wrote:
> The fbdev code uses compat_alloc_user_space in a few of its
> compat_ioctl handlers, which tends to be a bit more complicated
> and error-prone than calling the underlying handlers directly,
> so I would like to remove it completely.
> 
> This modifies two such functions in fbdev, and removes another
> one that is completely unused.
> 
> Arnd
> 
> Arnd Bergmann (3):
>   fbdev: simplify fb_getput_cmap()
>   fbdev: sbuslib: remove unused FBIOSCURSOR32 helper
>   fbdev: sbuslib: remove compat_alloc_user_space usage

Looks all good, but we're also kinda looking for a new volunteer for
handling fbdev patches ... drm-misc commit rights, still not interested?
-Daniel

> 
>  drivers/video/fbdev/core/fbmem.c |  44 +--
>  drivers/video/fbdev/sbuslib.c| 124 ++-
>  2 files changed, 90 insertions(+), 78 deletions(-)
> 
> -- 
> 2.27.0
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
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] drm/ttm: update kernel-doc line comments

2020-09-18 Thread Daniel Vetter
On Fri, Sep 18, 2020 at 06:44:25PM +0800, Huang Rui wrote:
> On Fri, Sep 18, 2020 at 05:52:58PM +0800, Tian Tao wrote:
> > Update kernel-doc line comments to fix warnings reported by make W=1.
> > 
> > drivers/gpu/drm/ttm/ttm_memory.c:271: warning: Function parameter or
> > member 'glob' not described in 'ttm_shrink'
> > drivers/gpu/drm/ttm/ttm_memory.c:271: warning: Function parameter or
> > member 'from_wq' not described in 'ttm_shrink'
> > drivers/gpu/drm/ttm/ttm_memory.c:271: warning: Function parameter or
> > member 'extra' not described in 'ttm_shrink'
> > drivers/gpu/drm/ttm/ttm_memory.c:271: warning: Function parameter or
> > member 'ctx' not described in 'ttm_shrink'
> > 
> > Signed-off-by: Tian Tao 
> 
> Acked-by: Huang Rui 

It would be nice to go through ttm docs and polish them so their proper.
This patch here just shuts up the warning without fixing any of the
documentation issues. Fixing the docs would be much better.
-Daniel

> 
> > ---
> >  drivers/gpu/drm/ttm/ttm_memory.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/ttm/ttm_memory.c 
> > b/drivers/gpu/drm/ttm/ttm_memory.c
> > index acd63b7..0b51773 100644
> > --- a/drivers/gpu/drm/ttm/ttm_memory.c
> > +++ b/drivers/gpu/drm/ttm/ttm_memory.c
> > @@ -259,7 +259,7 @@ static bool ttm_zones_above_swap_target(struct 
> > ttm_mem_global *glob,
> > return false;
> >  }
> >  
> > -/**
> > +/*
> >   * At this point we only support a single shrink callback.
> >   * Extend this if needed, perhaps using a linked list of callbacks.
> >   * Note that this function is reentrant:
> > -- 
> > 2.7.4
> > 

-- 
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] dma-fence: add get_signaled_timestamp to fence ops

2020-09-18 Thread Daniel Vetter
On Thu, Sep 17, 2020 at 02:45:38PM -0700, Veera Sundaram Sankaran wrote:
> Add an optional fence ops to allow drivers to be able to set the
> timestamp for a fence. Some drivers have hardware capability to get
> the precise timestamp of certain events based on which the fences
> are triggered. This allows it to set accurate timestamp factoring
> out any software and IRQ latencies. The get_signaled_timestamp ops,
> if defined by the driver would be used during fence signaling to set
> the timestamp, before setting the flag DMA_FENCE_FLAG_TIMESTAMP_BIT.
> If the callback is not defined, ktime_get is used to set the fence
> timestamp.
> 
> Signed-off-by: Veera Sundaram Sankaran 

We don't add hooks without implementations, please submit a complete patch
series (and yes that would need to be with upstream drm/msm drivers if
this is for qcom platforms).

Thanks, Daniel

> ---
>  drivers/dma-buf/dma-fence.c |  6 +-
>  include/linux/dma-fence.h   | 13 +
>  2 files changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c
> index 43624b4..95c6ab0 100644
> --- a/drivers/dma-buf/dma-fence.c
> +++ b/drivers/dma-buf/dma-fence.c
> @@ -4,6 +4,7 @@
>   *
>   * Copyright (C) 2012 Canonical Ltd
>   * Copyright (C) 2012 Texas Instruments
> + * Copyright (c) 2020 The Linux Foundation. All rights reserved.
>   *
>   * Authors:
>   * Rob Clark 
> @@ -340,7 +341,10 @@ int dma_fence_signal_locked(struct dma_fence *fence)
>   /* Stash the cb_list before replacing it with the timestamp */
>   list_replace(>cb_list, _list);
>  
> - fence->timestamp = ktime_get();
> + if (fence->ops->get_signaled_timestamp)
> + fence->timestamp = fence->ops->get_signaled_timestamp(fence);
> + else
> + fence->timestamp = ktime_get();
>   set_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, >flags);
>   trace_dma_fence_signaled(fence);
>  
> diff --git a/include/linux/dma-fence.h b/include/linux/dma-fence.h
> index 09e23ad..ce73aba 100644
> --- a/include/linux/dma-fence.h
> +++ b/include/linux/dma-fence.h
> @@ -4,6 +4,7 @@
>   *
>   * Copyright (C) 2012 Canonical Ltd
>   * Copyright (C) 2012 Texas Instruments
> + * Copyright (c) 2020 The Linux Foundation. All rights reserved.
>   *
>   * Authors:
>   * Rob Clark 
> @@ -261,6 +262,18 @@ struct dma_fence_ops {
>*/
>   void (*timeline_value_str)(struct dma_fence *fence,
>  char *str, int size);
> +
> + /**
> +  * @get_signaled_timestamp:
> +  *
> +  * Allows the driver to fill in precise timestamp for a fence.
> +  * This ops would be used during fence signalling to set the timestamp,
> +  * before setting the flag DMA_FENCE_FLAG_TIMESTAMP_BIT.
> +  *
> +  * This callback is optional. If this callback is not present,
> +  * ktime_get is used to fill in the timestamp.
> +  */
> + ktime_t (*get_signaled_timestamp)(struct dma_fence *fence);
>  };
>  
>  void dma_fence_init(struct dma_fence *fence, const struct dma_fence_ops *ops,
> -- 
> 2.7.4
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
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] fbcon: Remove the superfluous break

2020-09-18 Thread Daniel Vetter
On Fri, Sep 18, 2020 at 09:05:21AM +0800, Jing Xiangfeng wrote:
> Remove the superfluous break, as there is a 'return' before it.
> 
> Fixes: bad07ff74c32 ("fbcon: smart blitter usage for scrolling")
> Signed-off-by: Jing Xiangfeng 
> Reviewed-by: Nick Desaulniers 
> Reviewed-by: Gustavo A. R. Silva 

Applied to drm-misc-next, thanks.
-Daniel

> ---
>  drivers/video/fbdev/core/fbcon.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/video/fbdev/core/fbcon.c 
> b/drivers/video/fbdev/core/fbcon.c
> index 0b49b0f44edf..623359aadd1e 100644
> --- a/drivers/video/fbdev/core/fbcon.c
> +++ b/drivers/video/fbdev/core/fbcon.c
> @@ -1727,7 +1727,6 @@ static bool fbcon_scroll(struct vc_data *vc, unsigned 
> int t, unsigned int b,
>   vc->vc_video_erase_char,
>   vc->vc_size_row * count);
>   return true;
> - break;
>  
>   case SCROLL_WRAP_MOVE:
>   if (b - t - count > 3 * vc->vc_rows >> 2) {
> @@ -1818,7 +1817,6 @@ static bool fbcon_scroll(struct vc_data *vc, unsigned 
> int t, unsigned int b,
>   vc->vc_video_erase_char,
>   vc->vc_size_row * count);
>   return true;
> - break;
>  
>   case SCROLL_WRAP_MOVE:
>   if (b - t - count > 3 * vc->vc_rows >> 2) {
> -- 
> 2.17.1
> 

-- 
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] fbcon: Remove the superfluous break

2020-09-18 Thread Daniel Vetter
On Fri, Sep 18, 2020 at 08:52:02AM +0800, Jing Xiangfeng wrote:
> 
> 
> On 2020/9/18 2:52, Gustavo A. R. Silva wrote:
> > 
> > 
> > On 9/17/20 08:15, Jing Xiangfeng wrote:
> > > Remove the superfuous break, as there is a 'return' before it.
> > > 
> > > Signed-off-by: Jing Xiangfeng 
> > 
> > Reviewed-by: Gustavo A. R. Silva 
> > 
> > Also, the following Fixes tag should be included in the changelog text:
> > 
> > Fixes: bad07ff74c32 ("fbcon: smart blitter usage for scrolling")
> 
> OK, I'll send a v2 with this tag.

Please also collect all the r-b tags you received so I can just apply
everything.
-Daniel

> 
> > 
> > Thanks
> > --
> > Gustavo
> > 
> > > ---
> > >   drivers/video/fbdev/core/fbcon.c | 2 --
> > >   1 file changed, 2 deletions(-)
> > > 
> > > diff --git a/drivers/video/fbdev/core/fbcon.c 
> > > b/drivers/video/fbdev/core/fbcon.c
> > > index 0b49b0f44edf..623359aadd1e 100644
> > > --- a/drivers/video/fbdev/core/fbcon.c
> > > +++ b/drivers/video/fbdev/core/fbcon.c
> > > @@ -1727,7 +1727,6 @@ static bool fbcon_scroll(struct vc_data *vc, 
> > > unsigned int t, unsigned int b,
> > >   vc->vc_video_erase_char,
> > >   vc->vc_size_row * count);
> > >   return true;
> > > - break;
> > > 
> > >   case SCROLL_WRAP_MOVE:
> > >   if (b - t - count > 3 * vc->vc_rows >> 2) {
> > > @@ -1818,7 +1817,6 @@ static bool fbcon_scroll(struct vc_data *vc, 
> > > unsigned int t, unsigned int b,
> > >   vc->vc_video_erase_char,
> > >   vc->vc_size_row * count);
> > >   return true;
> > > - break;
> > > 
> > >   case SCROLL_WRAP_MOVE:
> > >   if (b - t - count > 3 * vc->vc_rows >> 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 v1] fbdev: aty: remove CONFIG_PM container

2020-09-18 Thread Daniel Vetter
On Thu, Sep 17, 2020 at 05:23:14PM +0530, Vaibhav Gupta wrote:
> The changes made in below mentioned commit removed CONFIG_PM containers
> from drivers/video/fbdev/aty/atyfb_base.c but not from
> drivers/video/fbdev/aty/atyfb.h for respective callbacks.
> 
> This resulted in error for implicit declaration for those callbacks.
> 
> Fixes: 348b2956d5e6 ("fbdev: aty: use generic power management")
> 
> Signed-off-by: Vaibhav Gupta 
> Reported-by: kernel test robot 

Applied, thanks.
-Daniel

> ---
>  drivers/video/fbdev/aty/atyfb.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/video/fbdev/aty/atyfb.h b/drivers/video/fbdev/aty/atyfb.h
> index a7833bc98225..551372f9b9aa 100644
> --- a/drivers/video/fbdev/aty/atyfb.h
> +++ b/drivers/video/fbdev/aty/atyfb.h
> @@ -287,8 +287,8 @@ static inline void aty_st_8(int regindex, u8 val, const 
> struct atyfb_par *par)
>  #endif
>  }
>  
> -#if defined(CONFIG_PM) || defined(CONFIG_PMAC_BACKLIGHT) || \
> -defined (CONFIG_FB_ATY_GENERIC_LCD) || defined (CONFIG_FB_ATY_BACKLIGHT)
> +#if defined(CONFIG_PMAC_BACKLIGHT) || defined (CONFIG_FB_ATY_GENERIC_LCD) || 
> \
> +defined (CONFIG_FB_ATY_BACKLIGHT)
>  extern void aty_st_lcd(int index, u32 val, const struct atyfb_par *par);
>  extern u32 aty_ld_lcd(int index, const struct atyfb_par *par);
>  #endif
> -- 
> 2.28.0
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
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


[PATCH] drm/panel: rm68200: allow using non-continuous dsi clock

2020-09-18 Thread Yannick Fertre
The panel is able to work when dsi clock is non-continuous, thus
the system power consumption can be reduced using such feature.

Add MIPI_DSI_CLOCK_NON_CONTINUOUS to panel's mode_flags.

Signed-off-by: Antonio Borneo 
Signed-off-by: Yannick Fertre 
---
 drivers/gpu/drm/panel/panel-raydium-rm68200.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-raydium-rm68200.c 
b/drivers/gpu/drm/panel/panel-raydium-rm68200.c
index f908eeafb1af..2b9e48b0a491 100644
--- a/drivers/gpu/drm/panel/panel-raydium-rm68200.c
+++ b/drivers/gpu/drm/panel/panel-raydium-rm68200.c
@@ -391,7 +391,7 @@ static int rm68200_probe(struct mipi_dsi_device *dsi)
dsi->lanes = 2;
dsi->format = MIPI_DSI_FMT_RGB888;
dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
- MIPI_DSI_MODE_LPM;
+ MIPI_DSI_MODE_LPM | MIPI_DSI_CLOCK_NON_CONTINUOUS;
 
drm_panel_init(>panel, dev, _drm_funcs,
   DRM_MODE_CONNECTOR_DSI);
-- 
2.17.1

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


[PATCH] drm/bridge/synopsys: dsi: fix initialization sequence

2020-09-18 Thread Yannick Fertre
The current driver calls drm_bridge_add(), to add the dsi bridge
to the global bridge list, in dw_mipi_dsi_host_attach().
Thus, it relies on the probing of panel or bridge sub-nodes to
trigger the execution of dsi host attach() that will, in turn,
call dw_mipi_dsi_host_attach().
This causes an incomplete driver initialization if the panel or
the next bridge is not present as sub-node, e.g. because it is an
i2c device, thus sub-node of the respective i2c controller.

Move the relevant code from host attach() to probe(), and the
corresponding code from detach() to remove().

Signed-off-by: Antonio Borneo 
Signed-off-by: Yannick Fertre 
---
 drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 73 ---
 1 file changed, 48 insertions(+), 25 deletions(-)

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c 
b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
index 6b268f9445b3..aa74abddc79f 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
@@ -314,9 +314,7 @@ static int dw_mipi_dsi_host_attach(struct mipi_dsi_host 
*host,
 {
struct dw_mipi_dsi *dsi = host_to_dsi(host);
const struct dw_mipi_dsi_plat_data *pdata = dsi->plat_data;
-   struct drm_bridge *bridge;
-   struct drm_panel *panel;
-   int ret;
+   int ret = -ENODEV;
 
if (device->lanes > dsi->plat_data->max_data_lanes) {
dev_err(dsi->dev, "the number of data lanes(%u) is too many\n",
@@ -329,22 +327,6 @@ static int dw_mipi_dsi_host_attach(struct mipi_dsi_host 
*host,
dsi->format = device->format;
dsi->mode_flags = device->mode_flags;
 
-   ret = drm_of_find_panel_or_bridge(host->dev->of_node, 1, 0,
- , );
-   if (ret)
-   return ret;
-
-   if (panel) {
-   bridge = drm_panel_bridge_add_typed(panel,
-   DRM_MODE_CONNECTOR_DSI);
-   if (IS_ERR(bridge))
-   return PTR_ERR(bridge);
-   }
-
-   dsi->panel_bridge = bridge;
-
-   drm_bridge_add(>bridge);
-
if (pdata->host_ops && pdata->host_ops->attach) {
ret = pdata->host_ops->attach(pdata->priv_data, device);
if (ret < 0)
@@ -367,10 +349,6 @@ static int dw_mipi_dsi_host_detach(struct mipi_dsi_host 
*host,
return ret;
}
 
-   drm_of_panel_bridge_remove(host->dev->of_node, 1, 0);
-
-   drm_bridge_remove(>bridge);
-
return 0;
 }
 
@@ -1105,6 +1083,9 @@ __dw_mipi_dsi_probe(struct platform_device *pdev,
struct device *dev = >dev;
struct reset_control *apb_rst;
struct dw_mipi_dsi *dsi;
+   struct drm_bridge *bridge;
+   struct drm_panel *panel;
+   int i, nb_endpoints;
int ret;
 
dsi = devm_kzalloc(dev, sizeof(*dsi), GFP_KERNEL);
@@ -1172,8 +1153,7 @@ __dw_mipi_dsi_probe(struct platform_device *pdev,
ret = mipi_dsi_host_register(>dsi_host);
if (ret) {
dev_err(dev, "Failed to register MIPI host: %d\n", ret);
-   dw_mipi_dsi_debugfs_remove(dsi);
-   return ERR_PTR(ret);
+   goto err_pmr_enable;
}
 
dsi->bridge.driver_private = dsi;
@@ -1182,11 +1162,54 @@ __dw_mipi_dsi_probe(struct platform_device *pdev,
dsi->bridge.of_node = pdev->dev.of_node;
 #endif
 
+   /* Get number of endpoints */
+   nb_endpoints = of_graph_get_endpoint_count(pdev->dev.of_node);
+   if (!nb_endpoints) {
+   ret = -ENODEV;
+   goto err_host_reg;
+   }
+
+   for (i = 1; i < nb_endpoints; i++) {
+   ret = drm_of_find_panel_or_bridge(pdev->dev.of_node, i, 0,
+ , );
+   if (!ret)
+   break;
+   else if (ret == -EPROBE_DEFER)
+   goto err_host_reg;
+   }
+
+   /* check if an error is returned >> no panel or bridge detected */
+   if (ret)
+   goto err_host_reg;
+
+   if (panel) {
+   bridge = drm_panel_bridge_add_typed(panel, 
DRM_MODE_CONNECTOR_DSI);
+   if (IS_ERR(bridge)) {
+   ret = PTR_ERR(bridge);
+   goto err_host_reg;
+   }
+   }
+
+   dsi->panel_bridge = bridge;
+
+   drm_bridge_add(>bridge);
+
return dsi;
+
+err_host_reg:
+   mipi_dsi_host_unregister(>dsi_host);
+
+err_pmr_enable:
+   pm_runtime_disable(dev);
+   dw_mipi_dsi_debugfs_remove(dsi);
+
+   return ERR_PTR(ret);
 }
 
 static void __dw_mipi_dsi_remove(struct dw_mipi_dsi *dsi)
 {
+   drm_bridge_remove(>bridge);
+   drm_panel_bridge_remove(dsi->panel_bridge);
mipi_dsi_host_unregister(>dsi_host);
 
pm_runtime_disable(dsi->dev);
-- 
2.17.1

___
dri-devel mailing list

[PATCH] drm/panel: otm8009a: remove hack to force commands in HS

2020-09-18 Thread Yannick Fertre
From: Antonio Borneo 

The panel is able to receive commands in LP. The current hack to
force backlight commands in HS was due to workaround an incorrect
settings on DSI controller that prevents sending LP commands while
video out was active.

Remove the hack that forces HS commands.

Signed-off-by: Antonio Borneo 
---
 .../gpu/drm/panel/panel-orisetech-otm8009a.c   | 18 ++
 1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c 
b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
index 6ac1accade80..f80b44a8a700 100644
--- a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
+++ b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
@@ -99,20 +99,6 @@ static void otm8009a_dcs_write_buf(struct otm8009a *ctx, 
const void *data,
dev_warn(ctx->dev, "mipi dsi dcs write buffer failed\n");
 }
 
-static void otm8009a_dcs_write_buf_hs(struct otm8009a *ctx, const void *data,
- size_t len)
-{
-   struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
-
-   /* data will be sent in dsi hs mode (ie. no lpm) */
-   dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
-
-   otm8009a_dcs_write_buf(ctx, data, len);
-
-   /* restore back the dsi lpm mode */
-   dsi->mode_flags |= MIPI_DSI_MODE_LPM;
-}
-
 #define dcs_write_seq(ctx, seq...) \
 ({ \
static const u8 d[] = { seq };  \
@@ -400,7 +386,7 @@ static int otm8009a_backlight_update_status(struct 
backlight_device *bd)
 */
data[0] = MIPI_DCS_SET_DISPLAY_BRIGHTNESS;
data[1] = bd->props.brightness;
-   otm8009a_dcs_write_buf_hs(ctx, data, ARRAY_SIZE(data));
+   otm8009a_dcs_write_buf(ctx, data, ARRAY_SIZE(data));
 
/* set Brightness Control & Backlight on */
data[1] = 0x24;
@@ -412,7 +398,7 @@ static int otm8009a_backlight_update_status(struct 
backlight_device *bd)
 
/* Update Brightness Control & Backlight */
data[0] = MIPI_DCS_WRITE_CONTROL_DISPLAY;
-   otm8009a_dcs_write_buf_hs(ctx, data, ARRAY_SIZE(data));
+   otm8009a_dcs_write_buf(ctx, data, ARRAY_SIZE(data));
 
return 0;
 }
-- 
2.17.1

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


Re: [PATCH v3 1/2] dt-bindings: display: ti,am65x-dss: add missing properties to dt-schema

2020-09-18 Thread Tomi Valkeinen
On 18/09/2020 04:18, Laurent Pinchart wrote:
> Hi Tomi,
> 
> Thank you for the patch.
> 
> On Wed, Sep 16, 2020 at 04:10:08PM +0300, Tomi Valkeinen wrote:
>> Add assigned-clocks, assigned-clock-parents and dma-coherent optional
>> properties.
>>
>> Signed-off-by: Tomi Valkeinen 
>> Reviewed-by: Rob Herring 
>> ---
>>  .../devicetree/bindings/display/ti/ti,am65x-dss.yaml  | 11 +++
>>  1 file changed, 11 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml 
>> b/Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml
>> index 4f9185462ed3..4dc30738ee57 100644
>> --- a/Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml
>> +++ b/Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml
>> @@ -55,6 +55,14 @@ properties:
>>- const: vp1
>>- const: vp2
>>  
>> +  assigned-clocks:
>> +minItems: 1
>> +maxItems: 3
>> +
>> +  assigned-clock-parents:
>> +minItems: 1
>> +maxItems: 3
>> +
> 
> Those properties can occur in any node that has clocks. Do we need to
> specify them explicitly in every schema ?

I don't really know the dt-schema stuff well enough yet to have a good answer, 
but if this
information would come from somewhere else, it would somehow need to know:

- are there clocks in this schema (i.e. is assigned-clocks allowed or not)
- how many clocks there are (for min and max items)

This would also apply to assigned-clock-rates.

 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


[PATCH] drm/panel: otm8009a: allow using non-continuous dsi clock

2020-09-18 Thread Yannick Fertre
From: Antonio Borneo 

The panel is able to work when dsi clock is non-continuous, thus
the system power consumption can be reduced using such feature.

Add MIPI_DSI_CLOCK_NON_CONTINUOUS to panel's mode_flags.

Signed-off-by: Antonio Borneo 
---
 drivers/gpu/drm/panel/panel-orisetech-otm8009a.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c 
b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
index b6e377aa1131..6ac1accade80 100644
--- a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
+++ b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
@@ -452,7 +452,7 @@ static int otm8009a_probe(struct mipi_dsi_device *dsi)
dsi->lanes = 2;
dsi->format = MIPI_DSI_FMT_RGB888;
dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
- MIPI_DSI_MODE_LPM;
+ MIPI_DSI_MODE_LPM | MIPI_DSI_CLOCK_NON_CONTINUOUS;
 
drm_panel_init(>panel, dev, _drm_funcs,
   DRM_MODE_CONNECTOR_DSI);
-- 
2.17.1

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


[PATCH] drm/stm: dsi: Avoid printing errors for -EPROBE_DEFER

2020-09-18 Thread Yannick Fertre
Don't print error when probe deferred error is returned.

Signed-off-by: Yannick Fertre 
---
 drivers/gpu/drm/stm/dw_mipi_dsi-stm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c 
b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c
index 2e1f2664495d..164f79ef6269 100644
--- a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c
+++ b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c
@@ -419,7 +419,8 @@ static int dw_mipi_dsi_stm_probe(struct platform_device 
*pdev)
dsi->dsi = dw_mipi_dsi_probe(pdev, _mipi_dsi_stm_plat_data);
if (IS_ERR(dsi->dsi)) {
ret = PTR_ERR(dsi->dsi);
-   DRM_ERROR("Failed to initialize mipi dsi host: %d\n", ret);
+   if (ret != -EPROBE_DEFER)
+   DRM_ERROR("Failed to initialize mipi dsi host: %d\n", 
ret);
goto err_dsi_probe;
}
 
-- 
2.17.1

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


Re: [PATCH v9 8/8] drm/i915: Enable async flips in i915

2020-09-18 Thread Ville Syrjälä
On Wed, Sep 16, 2020 at 08:38:24PM +0530, Karthik B S wrote:
> Enable asynchronous flips in i915 for gen9+ platforms.
> 
> v2: -Async flip enablement should be a stand alone patch (Paulo)
> 
> v3: -Move the patch to the end of the series (Paulo)
> 
> v4: -Rebased.
> 
> v5: -Rebased.
> 
> v6: -Rebased.
> 
> v7: -Rebased.
> 
> v8: -Rebased.
> 
> v9: -Rebased.
> 
> Signed-off-by: Karthik B S 
> Signed-off-by: Vandita Kulkarni 
> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
> b/drivers/gpu/drm/i915/display/intel_display.c
> index 6f6edc581e14..e31abf5f1a9d 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -18021,6 +18021,9 @@ static void intel_mode_config_init(struct 
> drm_i915_private *i915)
>  
>   mode_config->funcs = _mode_funcs;
>  
> + if (INTEL_GEN(i915) >= 9)
> + mode_config->async_page_flip = true;
> +

Should have all we need for those platforms I think.

Reviewed-by: Ville Syrjälä 

The followup to enable it for ilk+ would require a slight change to
bump X-tiled surface alignment to 256KiB. Apart from the actual regiser
smashing part that should be all we need really.

Oh, and the double buffer bit w/a will also be needed on bdw.
I've now tested snb/ivb/hsw/bdw and only bdw needs it. I guess
that's not entirely unsurpising since bdw did introduce one other
fail for the flip done interrupt (the interupt fires immediately 
when the plane was disabled, so can't use flip done to determine
when the plane has actually become visible). Fortunately that
other fail should have no impact on using it for async flip
completion.

>   /*
>* Maximum framebuffer dimensions, chosen to match
>* the maximum render engine surface size on gen4+.
> -- 
> 2.22.0

-- 
Ville Syrjälä
Intel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v9 7/8] Documentation/gpu: Add asynchronous flip documentation for i915

2020-09-18 Thread Ville Syrjälä
On Wed, Sep 16, 2020 at 08:38:23PM +0530, Karthik B S wrote:
> Add the details of the implementation of asynchronous flips for i915.
> 
> v7: -Rebased.
> 
> v8: -Rebased.
> 
> v9: -Rebased.
> 
> Signed-off-by: Karthik B S 
> Signed-off-by: Vandita Kulkarni 
> ---
>  Documentation/gpu/i915.rst | 6 ++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/Documentation/gpu/i915.rst b/Documentation/gpu/i915.rst
> index 33cc6ddf8f64..84ead508f7ad 100644
> --- a/Documentation/gpu/i915.rst
> +++ b/Documentation/gpu/i915.rst
> @@ -118,6 +118,12 @@ Atomic Plane Helpers
>  .. kernel-doc:: drivers/gpu/drm/i915/display/intel_atomic_plane.c
> :internal:
>  
> +Asynchronous Page Flip
> +--
> +
> +.. kernel-doc:: drivers/gpu/drm/i915/display/intel_display.c
> +   :doc: asynchronous flip implementation

A bit weird having this in one patch but the actual docs in the other.
I guess just squash them together, or extract the docs from the other
patch into this one?

Either way
Reviewed-by: Ville Syrjälä 

> +
>  Output Probing
>  --
>  
> -- 
> 2.22.0

-- 
Ville Syrjälä
Intel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v9 6/8] drm/i915: WA for platforms with double buffered address update enable bit

2020-09-18 Thread Ville Syrjälä
On Wed, Sep 16, 2020 at 08:38:22PM +0530, Karthik B S wrote:
> In Gen 9 and Gen 10 platforms, async address update enable bit is
> double buffered. Due to this, during the transition from async flip
> to sync flip we have to wait until this bit is updated before continuing
> with the normal commit for sync flip.
> 
> v9: -Rename skl_toggle_async_sync() to skl_disable_async_flip_wa(). (Ville)
> -Place the declarations appropriately as per need. (Ville)
> -Take the lock before the reg read. (Ville)
> -Fix comment and formatting. (Ville)
> -Use IS_GEN_RANGE() for gen check. (Ville)
> -Move skl_disable_async_flip_wa() to intel_pre_plane_update(). (Ville)
> 
> Signed-off-by: Karthik B S 
> Signed-off-by: Vandita Kulkarni 

Reviewed-by: Ville Syrjälä 

> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 46 
>  1 file changed, 46 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
> b/drivers/gpu/drm/i915/display/intel_display.c
> index 0f0bcbb00c7f..6f6edc581e14 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -6562,6 +6562,43 @@ static void intel_post_plane_update(struct 
> intel_atomic_state *state,
>   icl_wa_scalerclkgating(dev_priv, pipe, false);
>  }
>  
> +static void skl_disable_async_flip_wa(struct intel_atomic_state *state,
> +   struct intel_crtc *crtc,
> +   const struct intel_crtc_state 
> *new_crtc_state)
> +{
> + struct drm_i915_private *dev_priv = to_i915(state->base.dev);
> + struct intel_plane *plane;
> + struct intel_plane_state *new_plane_state;
> + int i;
> +
> + for_each_new_intel_plane_in_state(state, plane, new_plane_state, i) {
> + u32 update_mask = new_crtc_state->update_planes;
> + u32 plane_ctl, surf_addr;
> + enum plane_id plane_id;
> + unsigned long irqflags;
> + enum pipe pipe;
> +
> + if (crtc->pipe != plane->pipe ||
> + !(update_mask & BIT(plane->id)))
> + continue;
> +
> + plane_id = plane->id;
> + pipe = plane->pipe;
> +
> + spin_lock_irqsave(_priv->uncore.lock, irqflags);
> + plane_ctl = intel_de_read_fw(dev_priv, PLANE_CTL(pipe, 
> plane_id));
> + surf_addr = intel_de_read_fw(dev_priv, PLANE_SURF(pipe, 
> plane_id));
> +
> + plane_ctl &= ~PLANE_CTL_ASYNC_FLIP;
> +
> + intel_de_write_fw(dev_priv, PLANE_CTL(pipe, plane_id), 
> plane_ctl);
> + intel_de_write_fw(dev_priv, PLANE_SURF(pipe, plane_id), 
> surf_addr);
> + spin_unlock_irqrestore(_priv->uncore.lock, irqflags);
> + }
> +
> + intel_wait_for_vblank(dev_priv, crtc->pipe);
> +}
> +
>  static void intel_pre_plane_update(struct intel_atomic_state *state,
>  struct intel_crtc *crtc)
>  {
> @@ -6647,6 +6684,15 @@ static void intel_pre_plane_update(struct 
> intel_atomic_state *state,
>*/
>   if (IS_GEN(dev_priv, 2) && planes_disabling(old_crtc_state, 
> new_crtc_state))
>   intel_set_cpu_fifo_underrun_reporting(dev_priv, pipe, false);
> +
> + /*
> +  * WA for platforms where async address update enable bit
> +  * is double buffered and only latched at start of vblank.
> +  */
> + if (old_crtc_state->uapi.async_flip &&
> + !new_crtc_state->uapi.async_flip &&
> + IS_GEN_RANGE(dev_priv, 9, 10))
> + skl_disable_async_flip_wa(state, crtc, new_crtc_state);
>  }
>  
>  static void intel_crtc_disable_planes(struct intel_atomic_state *state,
> -- 
> 2.22.0

-- 
Ville Syrjälä
Intel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v10 5/8] drm/i915: Add dedicated plane hook for async flip case

2020-09-18 Thread Ville Syrjälä
On Fri, Sep 18, 2020 at 12:30:45PM +0530, Karthik B S wrote:
> This hook is added to avoid writing other plane registers in case of
> async flips, so that we do not write the double buffered registers
> during async surface address update.
> 
> v7: -Plane ctl needs bits from skl_plane_ctl_crtc as well. (Ville)
> -Add a vfunc for skl_program_async_surface_address
>  and call it from intel_update_plane. (Ville)
> 
> v8: -Rebased.
> 
> v9: -Use if-else instead of return in intel_update_plane(). (Ville)
> -Rename 'program_async_surface_address' to 'async_flip'. (Ville)
> 
> v10: -Check if async_flip hook is present before calling it.
>   Otherwise it will OOPS during legacy cursor updates. (Ville)
> 
> Signed-off-by: Karthik B S 
> Signed-off-by: Vandita Kulkarni 
> ---
>  .../gpu/drm/i915/display/intel_atomic_plane.c |  6 -
>  .../drm/i915/display/intel_display_types.h|  3 +++
>  drivers/gpu/drm/i915/display/intel_sprite.c   | 24 +++
>  3 files changed, 32 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_atomic_plane.c 
> b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> index 79032701873a..6bd8e6cdd477 100644
> --- a/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> +++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> @@ -408,7 +408,11 @@ void intel_update_plane(struct intel_plane *plane,
>   struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
>  
>   trace_intel_update_plane(>base, crtc);
> - plane->update_plane(plane, crtc_state, plane_state);
> +
> + if (crtc_state->uapi.async_flip && plane->async_flip)
> + plane->async_flip(plane, crtc_state, plane_state);
> + else
> + plane->update_plane(plane, crtc_state, plane_state);
>  }
>  
>  void intel_disable_plane(struct intel_plane *plane,
> diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h 
> b/drivers/gpu/drm/i915/display/intel_display_types.h
> index 3d4bf9b6a0a2..e3339e41ddf7 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_types.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
> @@ -1183,6 +1183,9 @@ struct intel_plane {
>  struct intel_plane_state *plane_state);
>   int (*min_cdclk)(const struct intel_crtc_state *crtc_state,
>const struct intel_plane_state *plane_state);
> + void (*async_flip)(struct intel_plane *plane,
> +const struct intel_crtc_state *crtc_state,
> +const struct intel_plane_state *plane_state);
>  };
>  
>  struct intel_watermark_params {
> diff --git a/drivers/gpu/drm/i915/display/intel_sprite.c 
> b/drivers/gpu/drm/i915/display/intel_sprite.c
> index 76a3d9bfe0de..3634e98b04c1 100644
> --- a/drivers/gpu/drm/i915/display/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/display/intel_sprite.c
> @@ -609,6 +609,29 @@ icl_program_input_csc(struct intel_plane *plane,
> PLANE_INPUT_CSC_POSTOFF(pipe, plane_id, 2), 0x0);
>  }
>  
> +static void
> +skl_program_async_surface_address(struct intel_plane *plane,
> +   const struct intel_crtc_state *crtc_state,
> +   const struct intel_plane_state *plane_state)

Pls rename this to skl_plane_async_flip() as well.

With that
Reviewed-by: Ville Syrjälä 

> +{
> + struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
> + unsigned long irqflags;
> + enum plane_id plane_id = plane->id;
> + enum pipe pipe = plane->pipe;
> + u32 surf_addr = plane_state->color_plane[0].offset;
> + u32 plane_ctl = plane_state->ctl;
> +
> + plane_ctl |= skl_plane_ctl_crtc(crtc_state);
> +
> + spin_lock_irqsave(_priv->uncore.lock, irqflags);
> +
> + intel_de_write_fw(dev_priv, PLANE_CTL(pipe, plane_id), plane_ctl);
> + intel_de_write_fw(dev_priv, PLANE_SURF(pipe, plane_id),
> +   intel_plane_ggtt_offset(plane_state) + surf_addr);
> +
> + spin_unlock_irqrestore(_priv->uncore.lock, irqflags);
> +}
> +
>  static void
>  skl_program_plane(struct intel_plane *plane,
> const struct intel_crtc_state *crtc_state,
> @@ -3095,6 +3118,7 @@ skl_universal_plane_create(struct drm_i915_private 
> *dev_priv,
>   plane->get_hw_state = skl_plane_get_hw_state;
>   plane->check_plane = skl_plane_check;
>   plane->min_cdclk = skl_plane_min_cdclk;
> + plane->async_flip = skl_program_async_surface_address;
>  
>   if (INTEL_GEN(dev_priv) >= 11)
>   formats = icl_get_plane_formats(dev_priv, pipe,
> -- 
> 2.22.0

-- 
Ville Syrjälä
Intel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v10 3/8] drm/i915: Add checks specific to async flips

2020-09-18 Thread Ville Syrjälä
On Fri, Sep 18, 2020 at 02:32:34PM +0530, Karthik B S wrote:
> If flip is requested on any other plane, reject it.
> 
> Make sure there is no change in fbc, offset and framebuffer modifiers
> when async flip is requested.
> 
> If any of these are modified, reject async flip.
> 
> v2: -Replace DRM_ERROR (Paulo)
> -Add check for changes in OFFSET, FBC, RC(Paulo)
> 
> v3: -Removed TODO as benchmarking tests have been run now.
> 
> v4: -Added more state checks for async flip (Ville)
> -Moved intel_atomic_check_async to the end of intel_atomic_check
>  as the plane checks needs to pass before this. (Ville)
> -Removed crtc_state->enable_fbc check. (Ville)
> -Set the I915_MODE_FLAG_GET_SCANLINE_FROM_TIMESTAMP flag for async
>  flip case as scanline counter is not reliable here.
> 
> v5: -Fix typo and other check patch errors seen in CI
>  in 'intel_atomic_check_async' function.
> 
> v6: -Don't call intel_atomic_check_async multiple times. (Ville)
> -Remove the check for n_planes in intel_atomic_check_async
> -Added documentation for async flips. (Paulo)
> 
> v7: -Replace 'intel_plane' with 'plane'. (Ville)
> -Replace all uapi.foo as hw.foo. (Ville)
> -Do not use intel_wm_need_update function. (Ville)
> -Add destination coordinate check. (Ville)
> -Do not allow async flip with linear buffer
>  on older hw as it has issues with this. (Ville)
> -Remove break after intel_atomic_check_async. (Ville)
> 
> v8: -Rebased.
> 
> v9: -Replace DRM_DEBUG_KMS with drm_dbg_kms(). (Ville)
> -Fix comment formatting. (Ville)
> -Remove gen specific checks. (Ville)
> -Remove irrelevant FB size check. (Ville)
> -Add missing stride check. (Ville)
> -Use drm_rect_equals() instead of individual checks. (Ville)
> -Call intel_atomic_check_async before state dump. (Ville)
> 
> v10: -Fix the checkpatch errors seen on CI.
> 
> Signed-off-by: Karthik B S 
> Signed-off-by: Vandita Kulkarni 
> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 137 +++
>  1 file changed, 137 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
> b/drivers/gpu/drm/i915/display/intel_display.c
> index 30e8908ee263..7327ed4a04f8 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -14877,6 +14877,137 @@ static bool 
> intel_cpu_transcoders_need_modeset(struct intel_atomic_state *state,
>   return false;
>  }
>  
> +/**
> + * DOC: asynchronous flip implementation
> + *
> + * Asynchronous page flip is the implementation for the 
> DRM_MODE_PAGE_FLIP_ASYNC
> + * flag. Currently async flip is only supported via the drmModePageFlip 
> IOCTL.
> + * Correspondingly, support is currently added for primary plane only.
> + *
> + * Async flip can only change the plane surface address, so anything else
> + * changing is rejected from the intel_atomic_check_async() function.
> + * Once this check is cleared, flip done interrupt is enabled using
> + * the skl_enable_flip_done() function.
> + *
> + * As soon as the surface address register is written, flip done interrupt is
> + * generated and the requested events are sent to the usersapce in the 
> interrupt
> + * handler itself. The timestamp and sequence sent during the flip done event
> + * correspond to the last vblank and have no relation to the actual time when
> + * the flip done event was sent.
> + */
> +
> +static int intel_atomic_check_async(struct intel_atomic_state *state)
> +{
> + struct drm_i915_private *i915 = to_i915(state->base.dev);
> + struct intel_crtc_state *old_crtc_state, *new_crtc_state;
> + struct intel_plane_state *new_plane_state, *old_plane_state;a

All plane/crtc states can be const I believe.

> + struct intel_crtc *crtc;
> + struct intel_plane *plane;
> + int i;
> +
> + for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
> + new_crtc_state, i) {
> + if (needs_modeset(new_crtc_state)) {
> + drm_dbg_kms(>drm, "Modeset Required. Async flip 
> not supported\n");
> + return -EINVAL;
> + }
> +
> + if (!new_crtc_state->hw.active) {
> + drm_dbg_kms(>drm, "CRTC inactive\n");
> + return -EINVAL;
> + }
> + if (old_crtc_state->active_planes != 
> new_crtc_state->active_planes) {
> + drm_dbg_kms(>drm,
> + "Active planes cannot be changed during 
> async flip\n");
> + return -EINVAL;
> + }
> + }
> +
> + for_each_oldnew_intel_plane_in_state(state, plane, old_plane_state,
> +  new_plane_state, i) {
> + /*
> +  * TODO: Async flip is only supported through the page flip 
> IOCTL
> +  * as of now. So support currently added for primary plane 

[PATCH 2/2] drm/dp: add a number of DP 2.0 DPCD definitions

2020-09-18 Thread Jani Nikula
Prepare for future with DP 2.0 DPCD definitions, with a couple of
related drive-by cleanups. No functional changes.

v2: Send the version that actually builds.

Signed-off-by: Jani Nikula 
---
 include/drm/drm_dp_helper.h | 52 -
 1 file changed, 45 insertions(+), 7 deletions(-)

diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index 388083b4716b..e144b4b9d79a 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -125,6 +125,7 @@ struct drm_device;
 
 #define DP_MAX_DOWNSPREAD   0x003
 # define DP_MAX_DOWNSPREAD_0_5 (1 << 0)
+# define DP_STREAM_REGENERATION_STATUS_CAP  (1 << 1) /* 2.0 */
 # define DP_NO_AUX_HANDSHAKE_LINK_TRAINING  (1 << 6)
 # define DP_TPS4_SUPPORTED  (1 << 7)
 
@@ -142,6 +143,7 @@ struct drm_device;
 
 #define DP_MAIN_LINK_CHANNEL_CODING 0x006
 # define DP_CAP_ANSI_8B10B (1 << 0)
+# define DP_CAP_ANSI_128B132B   (1 << 1) /* 2.0 */
 
 #define DP_DOWN_STREAM_PORT_COUNT  0x007
 # define DP_PORT_COUNT_MASK0x0f
@@ -185,8 +187,14 @@ struct drm_device;
 #define DP_FAUX_CAP0x020   /* 1.2 */
 # define DP_FAUX_CAP_1 (1 << 0)
 
+#define DP_SINK_VIDEO_FALLBACK_FORMATS  0x020   /* 2.0 */
+# define DP_FALLBACK_1024x768_60HZ_24BPP(1 << 0)
+# define DP_FALLBACK_1280x720_60HZ_24BPP(1 << 1)
+# define DP_FALLBACK_1920x1080_60HZ_24BPP   (1 << 2)
+
 #define DP_MSTM_CAP0x021   /* 1.2 */
 # define DP_MST_CAP(1 << 0)
+# define DP_SINGLE_STREAM_SIDEBAND_MSG  (1 << 1) /* 2.0 */
 
 #define DP_NUMBER_OF_AUDIO_ENDPOINTS   0x022   /* 1.2 */
 
@@ -434,6 +442,9 @@ struct drm_device;
 # define DP_LINK_BW_2_70x0a
 # define DP_LINK_BW_5_40x14/* 1.2 */
 # define DP_LINK_BW_8_10x1e/* 1.4 */
+# define DP_LINK_BW_10  0x01/* 2.0 128b/132b Link 
Layer */
+# define DP_LINK_BW_13_50x04/* 2.0 128b/132b Link 
Layer */
+# define DP_LINK_BW_20  0x02/* 2.0 128b/132b Link 
Layer */
 
 #define DP_LANE_COUNT_SET  0x101
 # define DP_LANE_COUNT_MASK0x0f
@@ -485,12 +496,15 @@ struct drm_device;
 # define DP_TRAIN_PRE_EMPHASIS_SHIFT   3
 # define DP_TRAIN_MAX_PRE_EMPHASIS_REACHED  (1 << 5)
 
+# define DP_TX_FFE_PRESET_VALUE_MASK(0xf << 0) /* 2.0 128b/132b Link 
Layer */
+
 #define DP_DOWNSPREAD_CTRL 0x107
 # define DP_SPREAD_AMP_0_5 (1 << 4)
 # define DP_MSA_TIMING_PAR_IGNORE_EN   (1 << 7) /* eDP */
 
 #define DP_MAIN_LINK_CHANNEL_CODING_SET0x108
 # define DP_SET_ANSI_8B10B (1 << 0)
+# define DP_SET_ANSI_128B132B   (1 << 1)
 
 #define DP_I2C_SPEED_CONTROL_STATUS0x109   /* DPI */
 /* bitmask as for DP_I2C_SPEED_CAP */
@@ -509,8 +523,19 @@ struct drm_device;
 # define DP_LINK_QUAL_PATTERN_ERROR_RATE2
 # define DP_LINK_QUAL_PATTERN_PRBS73
 # define DP_LINK_QUAL_PATTERN_80BIT_CUSTOM  4
-# define DP_LINK_QUAL_PATTERN_HBR2_EYE  5
-# define DP_LINK_QUAL_PATTERN_MASK 7
+# define DP_LINK_QUAL_PATTERN_CP2520_PAT_1  5
+# define DP_LINK_QUAL_PATTERN_CP2520_PAT_2  6
+# define DP_LINK_QUAL_PATTERN_CP2520_PAT_3  7
+/* DP 2.0 UHBR10, UHBR13.5, UHBR20 */
+# define DP_LINK_QUAL_PATTERN_128B132B_TPS1 0x08
+# define DP_LINK_QUAL_PATTERN_128B132B_TPS2 0x10
+# define DP_LINK_QUAL_PATTERN_PRSBS90x18
+# define DP_LINK_QUAL_PATTERN_PRSBS11   0x20
+# define DP_LINK_QUAL_PATTERN_PRSBS15   0x28
+# define DP_LINK_QUAL_PATTERN_PRSBS23   0x30
+# define DP_LINK_QUAL_PATTERN_PRSBS31   0x38
+# define DP_LINK_QUAL_PATTERN_CUSTOM0x40
+# define DP_LINK_QUAL_PATTERN_SQUARE0x48
 
 #define DP_TRAINING_LANE0_1_SET2   0x10f
 #define DP_TRAINING_LANE2_3_SET2   0x110
@@ -613,9 +638,9 @@ struct drm_device;
 #define DP_LINK_STATUS_UPDATED (1 << 7)
 
 #define DP_SINK_STATUS 0x205
-
-#define DP_RECEIVE_PORT_0_STATUS   (1 << 0)
-#define DP_RECEIVE_PORT_1_STATUS   (1 << 1)
+# define DP_RECEIVE_PORT_0_STATUS  (1 << 0)
+# define DP_RECEIVE_PORT_1_STATUS  (1 << 1)
+# define DP_STREAM_REGENERATION_STATUS  (1 << 2) /* 2.0 */
 
 #define DP_ADJUST_REQUEST_LANE0_1  0x206
 #define DP_ADJUST_REQUEST_LANE2_3  0x207
@@ -628,6 +653,12 @@ struct drm_device;
 # define DP_ADJUST_PRE_EMPHASIS_LANE1_MASK   0xc0
 # define DP_ADJUST_PRE_EMPHASIS_LANE1_SHIFT  6
 
+/* DP 2.0 128b/132b Link Layer */
+# define DP_ADJUST_TX_FFE_PRESET_LANE0_MASK  (0xf << 0)
+# define DP_ADJUST_TX_FFE_PRESET_LANE0_SHIFT 0
+# define DP_ADJUST_TX_FFE_PRESET_LANE1_MASK  (0xf << 4)
+# define DP_ADJUST_TX_FFE_PRESET_LANE1_SHIFT 4
+
 #define DP_ADJUST_REQUEST_POST_CURSOR2  0x20c
 # define 

[PATCH 1/2] drm/dp: add subheadings to DPCD address definitions

2020-09-18 Thread Jani Nikula
Add the subheadings from the DP spec. No functional changes.

Signed-off-by: Jani Nikula 
---
 include/drm/drm_dp_helper.h | 22 ++
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index c9f2851904d0..388083b4716b 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -106,8 +106,9 @@ struct drm_device;
 #define DP_AUX_I2C_REPLY_DEFER (0x2 << 2)
 #define DP_AUX_I2C_REPLY_MASK  (0x3 << 2)
 
-/* AUX CH addresses */
-/* DPCD */
+/* DPCD Field Address Mapping */
+
+/* Receiver Capability */
 #define DP_DPCD_REV 0x000
 # define DP_DPCD_REV_10 0x10
 # define DP_DPCD_REV_11 0x11
@@ -426,7 +427,7 @@ struct drm_device;
 #define DP_DSC_BRANCH_OVERALL_THROUGHPUT_1  0x0a1
 #define DP_DSC_BRANCH_MAX_LINE_WIDTH0x0a2
 
-/* link configuration */
+/* Link Configuration */
 #defineDP_LINK_BW_SET  0x100
 # define DP_LINK_RATE_TABLE0x00/* eDP 1.4 */
 # define DP_LINK_BW_1_62   0x06
@@ -580,6 +581,7 @@ struct drm_device;
 #define DP_PAYLOAD_ALLOCATE_START_TIME_SLOT 0x1c1
 #define DP_PAYLOAD_ALLOCATE_TIME_SLOT_COUNT 0x1c2
 
+/* Link/Sink Device Status */
 #define DP_SINK_COUNT  0x200
 /* prior to 1.2 bit 7 was reserved mbz */
 # define DP_GET_SINK_COUNT(x)  x) & 0x80) >> 1) | ((x) & 0x3f))
@@ -779,20 +781,27 @@ struct drm_device;
 #define DP_VC_PAYLOAD_ID_SLOT_1 0x2c1   /* 1.2 MST */
 /* up to ID_SLOT_63 at 0x2ff */
 
+/* Source Device-specific */
 #define DP_SOURCE_OUI  0x300
+
+/* Sink Device-specific */
 #define DP_SINK_OUI0x400
+
+/* Branch Device-specific */
 #define DP_BRANCH_OUI  0x500
 #define DP_BRANCH_ID0x503
 #define DP_BRANCH_REVISION_START0x509
 #define DP_BRANCH_HW_REV0x509
 #define DP_BRANCH_SW_REV0x50A
 
+/* Link/Sink Device Power Control */
 #define DP_SET_POWER0x600
 # define DP_SET_POWER_D00x1
 # define DP_SET_POWER_D30x2
 # define DP_SET_POWER_MASK  0x3
 # define DP_SET_POWER_D3_AUX_ON 0x5
 
+/* eDP-specific */
 #define DP_EDP_DPCD_REV0x700/* eDP 1.2 */
 # define DP_EDP_11 0x00
 # define DP_EDP_12 0x01
@@ -876,11 +885,13 @@ struct drm_device;
 #define DP_EDP_REGIONAL_BACKLIGHT_BASE  0x740/* eDP 1.4 */
 #define DP_EDP_REGIONAL_BACKLIGHT_00x741/* eDP 1.4 */
 
+/* Sideband MSG Buffers */
 #define DP_SIDEBAND_MSG_DOWN_REQ_BASE  0x1000   /* 1.2 MST */
 #define DP_SIDEBAND_MSG_UP_REP_BASE0x1200   /* 1.2 MST */
 #define DP_SIDEBAND_MSG_DOWN_REP_BASE  0x1400   /* 1.2 MST */
 #define DP_SIDEBAND_MSG_UP_REQ_BASE0x1600   /* 1.2 MST */
 
+/* DPRX Event Status Indicator */
 #define DP_SINK_COUNT_ESI  0x2002   /* 1.2 */
 /* 0-5 sink count */
 # define DP_SINK_COUNT_CP_READY (1 << 6)
@@ -934,6 +945,7 @@ struct drm_device;
 #define DP_LANE_ALIGN_STATUS_UPDATED_ESI   0x200e /* status same as 0x204 
*/
 #define DP_SINK_STATUS_ESI 0x200f /* status same as 0x205 
*/
 
+/* Extended Receiver Capability */
 #define DP_DP13_DPCD_REV0x2200
 #define DP_DP13_MAX_LINK_RATE   0x2201
 
@@ -947,6 +959,7 @@ struct drm_device;
 # define DP_VSC_EXT_CEA_SDP_SUPPORTED  (1 << 6)  /* DP 1.4 */
 # define DP_VSC_EXT_CEA_SDP_CHAINING_SUPPORTED (1 << 7)  /* DP 1.4 */
 
+/* Protocol Converter Extension */
 /* HDMI CEC tunneling over AUX DP 1.3 section 5.3.3.3.1 DPCD 1.4+ */
 #define DP_CEC_TUNNELING_CAPABILITY0x3000
 # define DP_CEC_TUNNELING_CAPABLE   (1 << 0)
@@ -1013,6 +1026,7 @@ struct drm_device;
 #define DP_PROTOCOL_CONVERTER_CONTROL_20x3052 /* DP 1.3 */
 # define DP_CONVERSION_TO_YCBCR422_ENABLE  (1 << 0) /* DP 1.3 */
 
+/* HDCP 1.3 and HDCP 2.2 */
 #define DP_AUX_HDCP_BKSV   0x68000
 #define DP_AUX_HDCP_RI_PRIME   0x68005
 #define DP_AUX_HDCP_AKSV   0x68007
@@ -1058,7 +1072,7 @@ struct drm_device;
 #define DP_HDCP_2_2_REG_STREAM_TYPE_OFFSET 0x69494
 #define DP_HDCP_2_2_REG_DBG_OFFSET 0x69518
 
-/* Link Training (LT)-tunable PHY Repeaters */
+/* LTTPR: Link Training (LT)-tunable PHY Repeaters */
 #define DP_LT_TUNABLE_PHY_REPEATER_FIELD_DATA_STRUCTURE_REV 0xf /* 1.3 */
 #define DP_MAX_LINK_RATE_PHY_REPEATER  0xf0001 /* 1.4a */
 #define DP_PHY_REPEATER_CNT0xf0002 /* 1.3 */
-- 
2.20.1

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

Re: [PATCH] dmabuf: fix NULL pointer dereference in dma_buf_release()

2020-09-18 Thread Christian König

Am 18.09.20 um 12:32 schrieb Charan Teja Reddy:

NULL pointer dereference is observed while exporting the dmabuf but
failed to allocate the 'struct file' which results into the dropping of
the allocated dentry corresponding to this file in the dmabuf fs, which
is ending up in dma_buf_release() and accessing the uninitialzed
dentry->d_fsdata.

Call stack on 5.4 is below:
  dma_buf_release+0x2c/0x254 drivers/dma-buf/dma-buf.c:88
  __dentry_kill+0x294/0x31c fs/dcache.c:584
  dentry_kill fs/dcache.c:673 [inline]
  dput+0x250/0x380 fs/dcache.c:859
  path_put+0x24/0x40 fs/namei.c:485
  alloc_file_pseudo+0x1a4/0x200 fs/file_table.c:235
  dma_buf_getfile drivers/dma-buf/dma-buf.c:473 [inline]
  dma_buf_export+0x25c/0x3ec drivers/dma-buf/dma-buf.c:585

Fix this by checking for the valid pointer in the dentry->d_fsdata.

Fixes: 4ab59c3c638c ("dma-buf: Move dma_buf_release() from fops to dentry_ops")
Cc:  [5.7+]
Signed-off-by: Charan Teja Reddy 


Reviewed-by: Christian König 

Going to pick this up for inclusion into drm-misc-next as well.


---
  drivers/dma-buf/dma-buf.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
index 58564d82..844967f 100644
--- a/drivers/dma-buf/dma-buf.c
+++ b/drivers/dma-buf/dma-buf.c
@@ -59,6 +59,8 @@ static void dma_buf_release(struct dentry *dentry)
struct dma_buf *dmabuf;
  
  	dmabuf = dentry->d_fsdata;

+   if (unlikely(!dmabuf))
+   return;
  
  	BUG_ON(dmabuf->vmapping_counter);
  


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


[PULL] drm-misc-fixes

2020-09-18 Thread Maarten Lankhorst
drm-misc-fixes-2020-09-18:
drm-misc-fixes for v5.9-rc6:
- Fill asoc card owner in vc4.
- Program secondary CSC correctly in sun4i, and extend
  register mapping to cover secondary CSC registers.
The following changes since commit fc7f148feb8975784bd40e41fff875d33f698be8:

  drm/virtio: drop virtio_gpu_output->enabled (2020-09-04 13:11:32 +0200)

are available in the Git repository at:

  git://anongit.freedesktop.org/drm/drm-misc tags/drm-misc-fixes-2020-09-18

for you to fetch changes up to 74ea06164cda81dc80e97790164ca533fd7e3087:

  drm/sun4i: mixer: Extend regmap max_register (2020-09-10 13:08:48 +0200)


drm-misc-fixes for v5.9-rc6:
- Fill asoc card owner in vc4.
- Program secondary CSC correctly in sun4i, and extend
  register mapping to cover secondary CSC registers.


Marek Szyprowski (1):
  drm/vc4/vc4_hdmi: fill ASoC card owner

Martin Cerveny (2):
  drm/sun4i: sun8i-csc: Secondary CSC register correction
  drm/sun4i: mixer: Extend regmap max_register

 drivers/gpu/drm/sun4i/sun8i_csc.h   | 2 +-
 drivers/gpu/drm/sun4i/sun8i_mixer.c | 2 +-
 drivers/gpu/drm/vc4/vc4_hdmi.c  | 1 +
 3 files changed, 3 insertions(+), 2 deletions(-)
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/ttm: update kernel-doc line comments

2020-09-18 Thread Huang Rui
On Fri, Sep 18, 2020 at 05:52:58PM +0800, Tian Tao wrote:
> Update kernel-doc line comments to fix warnings reported by make W=1.
> 
> drivers/gpu/drm/ttm/ttm_memory.c:271: warning: Function parameter or
> member 'glob' not described in 'ttm_shrink'
> drivers/gpu/drm/ttm/ttm_memory.c:271: warning: Function parameter or
> member 'from_wq' not described in 'ttm_shrink'
> drivers/gpu/drm/ttm/ttm_memory.c:271: warning: Function parameter or
> member 'extra' not described in 'ttm_shrink'
> drivers/gpu/drm/ttm/ttm_memory.c:271: warning: Function parameter or
> member 'ctx' not described in 'ttm_shrink'
> 
> Signed-off-by: Tian Tao 

Acked-by: Huang Rui 

> ---
>  drivers/gpu/drm/ttm/ttm_memory.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/ttm/ttm_memory.c 
> b/drivers/gpu/drm/ttm/ttm_memory.c
> index acd63b7..0b51773 100644
> --- a/drivers/gpu/drm/ttm/ttm_memory.c
> +++ b/drivers/gpu/drm/ttm/ttm_memory.c
> @@ -259,7 +259,7 @@ static bool ttm_zones_above_swap_target(struct 
> ttm_mem_global *glob,
>   return false;
>  }
>  
> -/**
> +/*
>   * At this point we only support a single shrink callback.
>   * Extend this if needed, perhaps using a linked list of callbacks.
>   * Note that this function is reentrant:
> -- 
> 2.7.4
> 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 3/3] fbdev: sbuslib: remove compat_alloc_user_space usage

2020-09-18 Thread Arnd Bergmann
This is one of the last users of compat_alloc_user_space()
and copy_in_user(). The actual handler is implemented in the
same file and could be shared, but as I couldn't test this
properly I leave the native case alone and just make a straight
copy of it for the compat case, with a minimum set of
modifications.

Signed-off-by: Arnd Bergmann 
---
 drivers/video/fbdev/sbuslib.c | 95 ++-
 1 file changed, 70 insertions(+), 25 deletions(-)

diff --git a/drivers/video/fbdev/sbuslib.c b/drivers/video/fbdev/sbuslib.c
index f728db9bcff8..da28c279a54b 100644
--- a/drivers/video/fbdev/sbuslib.c
+++ b/drivers/video/fbdev/sbuslib.c
@@ -192,28 +192,6 @@ int sbusfb_ioctl_helper(unsigned long cmd, unsigned long 
arg,
 EXPORT_SYMBOL(sbusfb_ioctl_helper);
 
 #ifdef CONFIG_COMPAT
-static int fbiogetputcmap(struct fb_info *info, unsigned int cmd, unsigned 
long arg)
-{
-   struct fbcmap32 __user *argp = (void __user *)arg;
-   struct fbcmap __user *p = compat_alloc_user_space(sizeof(*p));
-   u32 addr;
-   int ret;
-
-   ret = copy_in_user(p, argp, 2 * sizeof(int));
-   ret |= get_user(addr, >red);
-   ret |= put_user(compat_ptr(addr), >red);
-   ret |= get_user(addr, >green);
-   ret |= put_user(compat_ptr(addr), >green);
-   ret |= get_user(addr, >blue);
-   ret |= put_user(compat_ptr(addr), >blue);
-   if (ret)
-   return -EFAULT;
-   return info->fbops->fb_ioctl(info,
-   (cmd == FBIOPUTCMAP32) ?
-   FBIOPUTCMAP_SPARC : FBIOGETCMAP_SPARC,
-   (unsigned long)p);
-}
-
 int sbusfb_compat_ioctl(struct fb_info *info, unsigned int cmd, unsigned long 
arg)
 {
switch (cmd) {
@@ -230,9 +208,76 @@ int sbusfb_compat_ioctl(struct fb_info *info, unsigned int 
cmd, unsigned long ar
case FBIOGCURMAX:
return info->fbops->fb_ioctl(info, cmd, arg);
case FBIOPUTCMAP32:
-   return fbiogetputcmap(info, cmd, arg);
-   case FBIOGETCMAP32:
-   return fbiogetputcmap(info, cmd, arg);
+   case FBIOPUTCMAP_SPARC: {
+   struct fbcmap32 c;
+   struct fb_cmap cmap;
+   u16 red, green, blue;
+   u8 red8, green8, blue8;
+   unsigned char __user *ured;
+   unsigned char __user *ugreen;
+   unsigned char __user *ublue;
+   unsigned int i;
+
+   if (copy_from_user(, compat_ptr(arg), sizeof(c)))
+  return -EFAULT;
+   ured = compat_ptr(c.red);
+   ugreen = compat_ptr(c.green);
+   ublue = compat_ptr(c.blue);
+
+   cmap.len = 1;
+   cmap.red = 
+   cmap.green = 
+   cmap.blue = 
+   cmap.transp = NULL;
+   for (i = 0; i < c.count; i++) {
+   int err;
+
+   if (get_user(red8, [i]) ||
+   get_user(green8, [i]) ||
+   get_user(blue8, [i]))
+   return -EFAULT;
+
+   red = red8 << 8;
+   green = green8 << 8;
+   blue = blue8 << 8;
+
+   cmap.start = c.index + i;
+   err = fb_set_cmap(, info);
+   if (err)
+   return err;
+   }
+   return 0;
+   }
+   case FBIOGETCMAP32: {
+   struct fbcmap32 c;
+   unsigned char __user *ured;
+   unsigned char __user *ugreen;
+   unsigned char __user *ublue;
+   struct fb_cmap *cmap = >cmap;
+   unsigned int index, i;
+   u8 red, green, blue;
+
+   if (copy_from_user(, compat_ptr(arg), sizeof(c)))
+  return -EFAULT;
+   index = c.index;
+   ured = compat_ptr(c.red);
+   ugreen = compat_ptr(c.green);
+   ublue = compat_ptr(c.blue);
+
+   if (index > cmap->len || c.count > cmap->len - index)
+   return -EINVAL;
+
+   for (i = 0; i < c.count; i++) {
+   red = cmap->red[index + i] >> 8;
+   green = cmap->green[index + i] >> 8;
+   blue = cmap->blue[index + i] >> 8;
+   if (put_user(red, [i]) ||
+   put_user(green, [i]) ||
+   put_user(blue, [i]))
+   return -EFAULT;
+   }
+   return 0;
+   }
default:
return -ENOIOCTLCMD;
}
-- 
2.27.0

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


[PATCH 1/3] fbdev: simplify fb_getput_cmap()

2020-09-18 Thread Arnd Bergmann
This function is one of the remaining users of compat_alloc_user_space()
and copy_in_user().

Clean it up by copying to a local data structure copy instead,
which also leads to more readable code.

Signed-off-by: Arnd Bergmann 
---
 drivers/video/fbdev/core/fbmem.c | 44 ++--
 1 file changed, 19 insertions(+), 25 deletions(-)

diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index da7c88ffaa6a..4e162e3d3538 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -1211,36 +1211,30 @@ struct fb_cmap32 {
 static int fb_getput_cmap(struct fb_info *info, unsigned int cmd,
  unsigned long arg)
 {
-   struct fb_cmap_user __user *cmap;
-   struct fb_cmap32 __user *cmap32;
-   __u32 data;
-   int err;
-
-   cmap = compat_alloc_user_space(sizeof(*cmap));
-   cmap32 = compat_ptr(arg);
+   struct fb_cmap32 cmap32;
+   struct fb_cmap cmap_from;
+   struct fb_cmap_user cmap;
 
-   if (copy_in_user(>start, >start, 2 * sizeof(__u32)))
+   if (copy_from_user(, compat_ptr(arg), sizeof(cmap32)))
return -EFAULT;
 
-   if (get_user(data, >red) ||
-   put_user(compat_ptr(data), >red) ||
-   get_user(data, >green) ||
-   put_user(compat_ptr(data), >green) ||
-   get_user(data, >blue) ||
-   put_user(compat_ptr(data), >blue) ||
-   get_user(data, >transp) ||
-   put_user(compat_ptr(data), >transp))
-   return -EFAULT;
+   cmap = (struct fb_cmap_user) {
+   .start  = cmap32.start,
+   .len= cmap32.len,
+   .red= compat_ptr(cmap32.red),
+   .green  = compat_ptr(cmap32.green),
+   .blue   = compat_ptr(cmap32.blue),
+   .transp = compat_ptr(cmap32.transp),
+   };
 
-   err = do_fb_ioctl(info, cmd, (unsigned long) cmap);
+   if (cmd == FBIOPUTCMAP)
+   return fb_set_user_cmap(, info);
 
-   if (!err) {
-   if (copy_in_user(>start,
->start,
-2 * sizeof(__u32)))
-   err = -EFAULT;
-   }
-   return err;
+   lock_fb_info(info);
+   cmap_from = info->cmap;
+   unlock_fb_info(info);
+
+   return fb_cmap_to_user(_from, );
 }
 
 static int do_fscreeninfo_to_user(struct fb_fix_screeninfo *fix,
-- 
2.27.0

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


[PATCH 2/3] fbdev: sbuslib: remove unused FBIOSCURSOR32 helper

2020-09-18 Thread Arnd Bergmann
No driver implements FBIOSCURSOR, so this function has no purpose
and can be removed. Apparently it was added in linux-2.1.44 to handle
compatibility for drivers/sbus/char/sunfb.c but lost its purpose when
that driver got rewritten in linux-2.5.63.

Signed-off-by: Arnd Bergmann 
---
 drivers/video/fbdev/sbuslib.c | 29 +
 1 file changed, 1 insertion(+), 28 deletions(-)

diff --git a/drivers/video/fbdev/sbuslib.c b/drivers/video/fbdev/sbuslib.c
index 01a7110e61a7..f728db9bcff8 100644
--- a/drivers/video/fbdev/sbuslib.c
+++ b/drivers/video/fbdev/sbuslib.c
@@ -214,32 +214,6 @@ static int fbiogetputcmap(struct fb_info *info, unsigned 
int cmd, unsigned long
(unsigned long)p);
 }
 
-static int fbiogscursor(struct fb_info *info, unsigned long arg)
-{
-   struct fbcursor __user *p = compat_alloc_user_space(sizeof(*p));
-   struct fbcursor32 __user *argp =  (void __user *)arg;
-   compat_uptr_t addr;
-   int ret;
-
-   ret = copy_in_user(p, argp,
- 2 * sizeof (short) + 2 * sizeof(struct fbcurpos));
-   ret |= copy_in_user(>size, >size, sizeof(struct fbcurpos));
-   ret |= copy_in_user(>cmap, >cmap, 2 * sizeof(int));
-   ret |= get_user(addr, >cmap.red);
-   ret |= put_user(compat_ptr(addr), >cmap.red);
-   ret |= get_user(addr, >cmap.green);
-   ret |= put_user(compat_ptr(addr), >cmap.green);
-   ret |= get_user(addr, >cmap.blue);
-   ret |= put_user(compat_ptr(addr), >cmap.blue);
-   ret |= get_user(addr, >mask);
-   ret |= put_user(compat_ptr(addr), >mask);
-   ret |= get_user(addr, >image);
-   ret |= put_user(compat_ptr(addr), >image);
-   if (ret)
-   return -EFAULT;
-   return info->fbops->fb_ioctl(info, FBIOSCURSOR, (unsigned long)p);
-}
-
 int sbusfb_compat_ioctl(struct fb_info *info, unsigned int cmd, unsigned long 
arg)
 {
switch (cmd) {
@@ -248,6 +222,7 @@ int sbusfb_compat_ioctl(struct fb_info *info, unsigned int 
cmd, unsigned long ar
case FBIOGATTR:
case FBIOSVIDEO:
case FBIOGVIDEO:
+   case FBIOSCURSOR32:
case FBIOGCURSOR32: /* This is not implemented yet.
   Later it should be converted... */
case FBIOSCURPOS:
@@ -258,8 +233,6 @@ int sbusfb_compat_ioctl(struct fb_info *info, unsigned int 
cmd, unsigned long ar
return fbiogetputcmap(info, cmd, arg);
case FBIOGETCMAP32:
return fbiogetputcmap(info, cmd, arg);
-   case FBIOSCURSOR32:
-   return fbiogscursor(info, arg);
default:
return -ENOIOCTLCMD;
}
-- 
2.27.0

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


[PATCH 0/3] fbdev: stop using compat_alloc_user_space

2020-09-18 Thread Arnd Bergmann
The fbdev code uses compat_alloc_user_space in a few of its
compat_ioctl handlers, which tends to be a bit more complicated
and error-prone than calling the underlying handlers directly,
so I would like to remove it completely.

This modifies two such functions in fbdev, and removes another
one that is completely unused.

Arnd

Arnd Bergmann (3):
  fbdev: simplify fb_getput_cmap()
  fbdev: sbuslib: remove unused FBIOSCURSOR32 helper
  fbdev: sbuslib: remove compat_alloc_user_space usage

 drivers/video/fbdev/core/fbmem.c |  44 +--
 drivers/video/fbdev/sbuslib.c| 124 ++-
 2 files changed, 90 insertions(+), 78 deletions(-)

-- 
2.27.0

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


[PATCH v10 3/8] drm/i915: Add checks specific to async flips

2020-09-18 Thread Karthik B S
If flip is requested on any other plane, reject it.

Make sure there is no change in fbc, offset and framebuffer modifiers
when async flip is requested.

If any of these are modified, reject async flip.

v2: -Replace DRM_ERROR (Paulo)
-Add check for changes in OFFSET, FBC, RC(Paulo)

v3: -Removed TODO as benchmarking tests have been run now.

v4: -Added more state checks for async flip (Ville)
-Moved intel_atomic_check_async to the end of intel_atomic_check
 as the plane checks needs to pass before this. (Ville)
-Removed crtc_state->enable_fbc check. (Ville)
-Set the I915_MODE_FLAG_GET_SCANLINE_FROM_TIMESTAMP flag for async
 flip case as scanline counter is not reliable here.

v5: -Fix typo and other check patch errors seen in CI
 in 'intel_atomic_check_async' function.

v6: -Don't call intel_atomic_check_async multiple times. (Ville)
-Remove the check for n_planes in intel_atomic_check_async
-Added documentation for async flips. (Paulo)

v7: -Replace 'intel_plane' with 'plane'. (Ville)
-Replace all uapi.foo as hw.foo. (Ville)
-Do not use intel_wm_need_update function. (Ville)
-Add destination coordinate check. (Ville)
-Do not allow async flip with linear buffer
 on older hw as it has issues with this. (Ville)
-Remove break after intel_atomic_check_async. (Ville)

v8: -Rebased.

v9: -Replace DRM_DEBUG_KMS with drm_dbg_kms(). (Ville)
-Fix comment formatting. (Ville)
-Remove gen specific checks. (Ville)
-Remove irrelevant FB size check. (Ville)
-Add missing stride check. (Ville)
-Use drm_rect_equals() instead of individual checks. (Ville)
-Call intel_atomic_check_async before state dump. (Ville)

v10: -Fix the checkpatch errors seen on CI.

Signed-off-by: Karthik B S 
Signed-off-by: Vandita Kulkarni 
---
 drivers/gpu/drm/i915/display/intel_display.c | 137 +++
 1 file changed, 137 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
b/drivers/gpu/drm/i915/display/intel_display.c
index 30e8908ee263..7327ed4a04f8 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -14877,6 +14877,137 @@ static bool intel_cpu_transcoders_need_modeset(struct 
intel_atomic_state *state,
return false;
 }
 
+/**
+ * DOC: asynchronous flip implementation
+ *
+ * Asynchronous page flip is the implementation for the 
DRM_MODE_PAGE_FLIP_ASYNC
+ * flag. Currently async flip is only supported via the drmModePageFlip IOCTL.
+ * Correspondingly, support is currently added for primary plane only.
+ *
+ * Async flip can only change the plane surface address, so anything else
+ * changing is rejected from the intel_atomic_check_async() function.
+ * Once this check is cleared, flip done interrupt is enabled using
+ * the skl_enable_flip_done() function.
+ *
+ * As soon as the surface address register is written, flip done interrupt is
+ * generated and the requested events are sent to the usersapce in the 
interrupt
+ * handler itself. The timestamp and sequence sent during the flip done event
+ * correspond to the last vblank and have no relation to the actual time when
+ * the flip done event was sent.
+ */
+
+static int intel_atomic_check_async(struct intel_atomic_state *state)
+{
+   struct drm_i915_private *i915 = to_i915(state->base.dev);
+   struct intel_crtc_state *old_crtc_state, *new_crtc_state;
+   struct intel_plane_state *new_plane_state, *old_plane_state;
+   struct intel_crtc *crtc;
+   struct intel_plane *plane;
+   int i;
+
+   for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
+   new_crtc_state, i) {
+   if (needs_modeset(new_crtc_state)) {
+   drm_dbg_kms(>drm, "Modeset Required. Async flip 
not supported\n");
+   return -EINVAL;
+   }
+
+   if (!new_crtc_state->hw.active) {
+   drm_dbg_kms(>drm, "CRTC inactive\n");
+   return -EINVAL;
+   }
+   if (old_crtc_state->active_planes != 
new_crtc_state->active_planes) {
+   drm_dbg_kms(>drm,
+   "Active planes cannot be changed during 
async flip\n");
+   return -EINVAL;
+   }
+   }
+
+   for_each_oldnew_intel_plane_in_state(state, plane, old_plane_state,
+new_plane_state, i) {
+   /*
+* TODO: Async flip is only supported through the page flip 
IOCTL
+* as of now. So support currently added for primary plane only.
+* Support for other planes on platforms on which supports
+* this(vlv/chv and icl+) should be added when async flip is
+* enabled in the atomic IOCTL path.
+*/
+   if (plane->id != PLANE_PRIMARY)
+

Re: [PATCH 0/3] dma-buf: Flag vmap'ed memory as system or I/O memory

2020-09-18 Thread Sumit Semwal
Hi Thomas,

On Fri, 18 Sep 2020 at 11:36, Sumit Semwal  wrote:
>
> Hello Thomas,
>
> On Mon, 14 Sep 2020 at 16:55, Thomas Zimmermann  wrote:
> >
> > Dma-buf provides vmap() and vunmap() for retrieving and releasing mappings
> > of dma-buf memory in kernel address space. The functions operate with plain
> > addresses and the assumption is that the memory can be accessed with load
> > and store operations. This is not the case on some architectures (e.g.,
> > sparc64) where I/O memory can only be accessed with dedicated instructions.
> >
> > This patchset introduces struct dma_buf_map, which contains the address of
> > a buffer and a flag that tells whether system- or I/O-memory instructions
> > are required.
>
> Thank you for the patchset - it is a really nice, clean bit to add!
> >
> > Some background: updating the DRM framebuffer console on sparc64 makes the
> > kernel panic. This is because the framebuffer memory cannot be accessed with
> > system-memory instructions. We currently employ a workaround in DRM to
> > address this specific problem. [1]
> >
> > To resolve the problem, we'd like to address it at the most common point,
> > which is the dma-buf framework. The dma-buf mapping ideally knows if I/O
> > instructions are required and exports this information to it's users. The
> > new structure struct dma_buf_map stores the buffer address and a flag that
> > signals I/O memory. Affected users of the buffer (e.g., drivers, frameworks)
> > can then access the memory accordingly.
> >
> > This patchset only introduces struct dma_buf_map, and updates struct dma_buf
> > and it's interfaces. Further patches can update dma-buf users. For example,
> > there's a prototype patchset for DRM that fixes the framebuffer problem. [2]
> >
> > Further work: TTM, one of DRM's memory managers, already exports an
> > is_iomem flag of its own. It could later be switched over to exporting 
> > struct
> > dma_buf_map, thus simplifying some code. Several DRM drivers expect their
> > fbdev console to operate on I/O memory. These could possibly be switched 
> > over
> > to the generic fbdev emulation, as soon as the generic code uses struct
> > dma_buf_map.
> >
> > [1] https://lore.kernel.org/dri-devel/20200725191012.ga434...@ravnborg.org/
> > [2] 
> > https://lore.kernel.org/dri-devel/20200806085239.4606-1-tzimmerm...@suse.de/
> >
> > Thomas Zimmermann (3):
> >   dma-buf: Add struct dma-buf-map for storing struct dma_buf.vaddr_ptr
> >   dma-buf: Use struct dma_buf_map in dma_buf_vmap() interfaces
> >   dma-buf: Use struct dma_buf_map in dma_buf_vunmap() interfaces
>
> FWIW, for the series, please feel free to add my
> Acked-by: Sumit Semwal 
Of course, once the errors found by kernel test robot are fixed :).
>
> >
> >  Documentation/driver-api/dma-buf.rst  |   3 +
> >  drivers/dma-buf/dma-buf.c |  40 +++---
> >  drivers/gpu/drm/drm_gem_cma_helper.c  |  16 ++-
> >  drivers/gpu/drm/drm_gem_shmem_helper.c|  17 ++-
> >  drivers/gpu/drm/drm_prime.c   |  14 +-
> >  drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c   |  13 +-
> >  drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c|  13 +-
> >  .../drm/i915/gem/selftests/i915_gem_dmabuf.c  |  18 ++-
> >  drivers/gpu/drm/tegra/gem.c   |  23 ++--
> >  .../common/videobuf2/videobuf2-dma-contig.c   |  17 ++-
> >  .../media/common/videobuf2/videobuf2-dma-sg.c |  19 ++-
> >  .../common/videobuf2/videobuf2-vmalloc.c  |  21 ++-
> >  include/drm/drm_prime.h   |   5 +-
> >  include/linux/dma-buf-map.h   | 126 ++
> >  include/linux/dma-buf.h   |  11 +-
> >  15 files changed, 274 insertions(+), 82 deletions(-)
> >  create mode 100644 include/linux/dma-buf-map.h
> >
> > --
> > 2.28.0
> >
>
> Best,
> Sumit.

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


Re: [PATCH AUTOSEL 5.4 265/330] drm/amd/powerplay: try to do a graceful shutdown on SW CTF

2020-09-18 Thread Greg KH
On Fri, Sep 18, 2020 at 07:17:10AM +, Quan, Evan wrote:
> [AMD Official Use Only - Internal Distribution Only]

That didn't work :)
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v10 5/8] drm/i915: Add dedicated plane hook for async flip case

2020-09-18 Thread Karthik B S
This hook is added to avoid writing other plane registers in case of
async flips, so that we do not write the double buffered registers
during async surface address update.

v7: -Plane ctl needs bits from skl_plane_ctl_crtc as well. (Ville)
-Add a vfunc for skl_program_async_surface_address
 and call it from intel_update_plane. (Ville)

v8: -Rebased.

v9: -Use if-else instead of return in intel_update_plane(). (Ville)
-Rename 'program_async_surface_address' to 'async_flip'. (Ville)

v10: -Check if async_flip hook is present before calling it.
  Otherwise it will OOPS during legacy cursor updates. (Ville)

Signed-off-by: Karthik B S 
Signed-off-by: Vandita Kulkarni 
---
 .../gpu/drm/i915/display/intel_atomic_plane.c |  6 -
 .../drm/i915/display/intel_display_types.h|  3 +++
 drivers/gpu/drm/i915/display/intel_sprite.c   | 24 +++
 3 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_atomic_plane.c 
b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
index 79032701873a..6bd8e6cdd477 100644
--- a/drivers/gpu/drm/i915/display/intel_atomic_plane.c
+++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
@@ -408,7 +408,11 @@ void intel_update_plane(struct intel_plane *plane,
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
 
trace_intel_update_plane(>base, crtc);
-   plane->update_plane(plane, crtc_state, plane_state);
+
+   if (crtc_state->uapi.async_flip && plane->async_flip)
+   plane->async_flip(plane, crtc_state, plane_state);
+   else
+   plane->update_plane(plane, crtc_state, plane_state);
 }
 
 void intel_disable_plane(struct intel_plane *plane,
diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h 
b/drivers/gpu/drm/i915/display/intel_display_types.h
index 3d4bf9b6a0a2..e3339e41ddf7 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -1183,6 +1183,9 @@ struct intel_plane {
   struct intel_plane_state *plane_state);
int (*min_cdclk)(const struct intel_crtc_state *crtc_state,
 const struct intel_plane_state *plane_state);
+   void (*async_flip)(struct intel_plane *plane,
+  const struct intel_crtc_state *crtc_state,
+  const struct intel_plane_state *plane_state);
 };
 
 struct intel_watermark_params {
diff --git a/drivers/gpu/drm/i915/display/intel_sprite.c 
b/drivers/gpu/drm/i915/display/intel_sprite.c
index 76a3d9bfe0de..3634e98b04c1 100644
--- a/drivers/gpu/drm/i915/display/intel_sprite.c
+++ b/drivers/gpu/drm/i915/display/intel_sprite.c
@@ -609,6 +609,29 @@ icl_program_input_csc(struct intel_plane *plane,
  PLANE_INPUT_CSC_POSTOFF(pipe, plane_id, 2), 0x0);
 }
 
+static void
+skl_program_async_surface_address(struct intel_plane *plane,
+ const struct intel_crtc_state *crtc_state,
+ const struct intel_plane_state *plane_state)
+{
+   struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
+   unsigned long irqflags;
+   enum plane_id plane_id = plane->id;
+   enum pipe pipe = plane->pipe;
+   u32 surf_addr = plane_state->color_plane[0].offset;
+   u32 plane_ctl = plane_state->ctl;
+
+   plane_ctl |= skl_plane_ctl_crtc(crtc_state);
+
+   spin_lock_irqsave(_priv->uncore.lock, irqflags);
+
+   intel_de_write_fw(dev_priv, PLANE_CTL(pipe, plane_id), plane_ctl);
+   intel_de_write_fw(dev_priv, PLANE_SURF(pipe, plane_id),
+ intel_plane_ggtt_offset(plane_state) + surf_addr);
+
+   spin_unlock_irqrestore(_priv->uncore.lock, irqflags);
+}
+
 static void
 skl_program_plane(struct intel_plane *plane,
  const struct intel_crtc_state *crtc_state,
@@ -3095,6 +3118,7 @@ skl_universal_plane_create(struct drm_i915_private 
*dev_priv,
plane->get_hw_state = skl_plane_get_hw_state;
plane->check_plane = skl_plane_check;
plane->min_cdclk = skl_plane_min_cdclk;
+   plane->async_flip = skl_program_async_surface_address;
 
if (INTEL_GEN(dev_priv) >= 11)
formats = icl_get_plane_formats(dev_priv, pipe,
-- 
2.22.0

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


[PATCH v2] fbcon: Remove the superfluous break

2020-09-18 Thread Jing Xiangfeng
Remove the superfluous break, as there is a 'return' before it.

Fixes: bad07ff74c32 ("fbcon: smart blitter usage for scrolling")
Signed-off-by: Jing Xiangfeng 
Reviewed-by: Nick Desaulniers 
Reviewed-by: Gustavo A. R. Silva 
---
 drivers/video/fbdev/core/fbcon.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index 0b49b0f44edf..623359aadd1e 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -1727,7 +1727,6 @@ static bool fbcon_scroll(struct vc_data *vc, unsigned int 
t, unsigned int b,
vc->vc_video_erase_char,
vc->vc_size_row * count);
return true;
-   break;
 
case SCROLL_WRAP_MOVE:
if (b - t - count > 3 * vc->vc_rows >> 2) {
@@ -1818,7 +1817,6 @@ static bool fbcon_scroll(struct vc_data *vc, unsigned int 
t, unsigned int b,
vc->vc_video_erase_char,
vc->vc_size_row * count);
return true;
-   break;
 
case SCROLL_WRAP_MOVE:
if (b - t - count > 3 * vc->vc_rows >> 2) {
-- 
2.17.1

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


RE: [PATCH v3] drm/bridge: add it6505 driver

2020-09-18 Thread allen.chen
It has been about two weeks since I posted v3 and haven't heard anything.
Consider this a gentle ping.

If there is something need to fix. I will fix and upstream again.

Thanks.

-Original Message-
From: Allen Chen (陳柏宇) 
Sent: Friday, September 04, 2020 10:10 AM
Cc: Allen Chen (陳柏宇); Kenneth Hung (洪家倫); Jau-Chih Tseng (曾昭智); Hermes Wu 
(吳佳宏); Pi-Hsun Shih; Jitao Shi; Yilun Lin; Hermes Wu (吳佳宏); kernel test robot; 
Andrzej Hajda; Neil Armstrong; Laurent Pinchart; Jonas Karlman; Jernej Skrabec; 
David Airlie; Daniel Vetter; Matthias Brugger; open list; open list:DRM 
DRIVERS; moderated list:ARM/Mediatek SoC support; moderated list:ARM/Mediatek 
SoC support
Subject: [PATCH v3] drm/bridge: add it6505 driver

This adds support for the iTE IT6505.
This device can convert DPI signal to DP output.

From: Allen Chen 
Signed-off-by: Jitao Shi 
Signed-off-by: Pi-Hsun Shih 
Signed-off-by: Yilun Lin 
Signed-off-by: Hermes Wu 
Signed-off-by: Allen Chen 
Reported-by: kernel test robot 
---
 drivers/gpu/drm/bridge/Kconfig  |7 +
 drivers/gpu/drm/bridge/Makefile |1 +
 drivers/gpu/drm/bridge/ite-it6505.c | 3338 +++
 3 files changed, 3346 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/ite-it6505.c

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 3e11af4e9f63e..f21dce3fabeb9 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -61,6 +61,13 @@ config DRM_LONTIUM_LT9611
  HDMI signals
  Please say Y if you have such hardware.
 
+config DRM_ITE_IT6505
+   tristate "ITE IT6505 DisplayPort bridge"
+   depends on OF
+   select DRM_KMS_HELPER
+   help
+ ITE IT6505 DisplayPort bridge chip driver.
+
 config DRM_LVDS_CODEC
tristate "Transparent LVDS encoders and decoders support"
depends on OF
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index c589a6a7cbe1d..8a118fd901ad7 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -3,6 +3,7 @@ obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
 obj-$(CONFIG_DRM_CHRONTEL_CH7033) += chrontel-ch7033.o
 obj-$(CONFIG_DRM_DISPLAY_CONNECTOR) += display-connector.o
 obj-$(CONFIG_DRM_LONTIUM_LT9611) += lontium-lt9611.o
+obj-$(CONFIG_DRM_ITE_IT6505) += ite-it6505.o
 obj-$(CONFIG_DRM_LVDS_CODEC) += lvds-codec.o
 obj-$(CONFIG_DRM_MEGACHIPS_STDP_GE_B850V3_FW) += 
megachips-stdp-ge-b850v3-fw.o
 obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c 
b/drivers/gpu/drm/bridge/ite-it6505.c
new file mode 100644
index 0..0ed19673431ee
--- /dev/null
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -0,0 +1,3338 @@
+// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+/*
+ * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#define REG_IC_VER 0x04
+
+#define REG_RESET_CTRL 0x05
+#define VIDEO_RESET BIT(0)
+#define AUDIO_RESET BIT(1)
+#define ALL_LOGIC_RESET BIT(2)
+#define AUX_RESET BIT(3)
+#define HDCP_RESET BIT(4)
+
+#define INT_STATUS_01 0x06
+#define INT_MASK_01 0x09
+#define INT_HPD_CHANGE BIT(0)
+#define INT_RECEIVE_HPD_IRQ BIT(1)
+#define INT_SCDT_CHANGE BIT(2)
+#define INT_HDCP_FAIL BIT(3)
+#define INT_HDCP_DONE BIT(4)
+
+#define INT_STATUS_02 0x07
+#define INT_MASK_02 0x0A
+#define INT_AUX_CMD_FAIL BIT(0)
+#define INT_HDCP_KSV_CHECK BIT(1)
+#define INT_AUDIO_FIFO_ERROR BIT(2)
+
+#define INT_STATUS_03 0x08
+#define INT_MASK_03 0x0B
+#define INT_LINK_TRAIN_FAIL BIT(4)
+#define INT_VID_FIFO_ERROR BIT(5)
+#define INT_IO_LATCH_FIFO_OVERFLOW BIT(7)
+
+#define REG_SYSTEM_STS 0x0D
+#define INT_STS BIT(0)
+#define HPD_STS BIT(1)
+#define VIDEO_STB BIT(2)
+
+#define REG_LINK_TRAIN_STS 0x0E
+#define LINK_STATE_CR BIT(2)
+#define LINK_STATE_EQ BIT(3)
+#define LINK_STATE_NORP BIT(4)
+
+#define REG_BANK_SEL 0x0F
+#define REG_CLK_CTRL0 0x10
+#define M_PCLK_DELAY 0x03
+
+#define REG_AUX_OPT 0x11
+#define AUX_AUTO_RST BIT(0)
+#define AUX_FIX_FREQ BIT(3)
+
+#define REG_DATA_CTRL0 0x12
+#define VIDEO_LATCH_EDGE BIT(4)
+#define ENABLE_PCLK_COUNTER BIT(7)
+
+#define REG_PCLK_COUNTER_VALUE 0x13
+
+#define REG_501_FIFO_CTRL 0x15
+#define RST_501_FIFO BIT(1)
+
+#define REG_TRAIN_CTRL0 0x16
+#define FORCE_LBR BIT(0)
+#define LANE_COUNT_MASK 0x06
+#define LANE_SWAP BIT(3)
+#define SPREAD_AMP_5 BIT(4)
+#define FORCE_CR_DONE BIT(5)
+#define FORCE_EQ_DONE BIT(6)
+
+#define REG_TRAIN_CTRL1 0x17
+#define AUTO_TRAIN BIT(0)
+#define MANUAL_TRAIN BIT(1)
+#define FORCE_RETRAIN BIT(2)
+
+#define REG_AUX_CTRL 0x23
+#define CLR_EDID_FIFO BIT(0)
+#define AUX_USER_MODE BIT(1)
+#define AUX_NO_SEGMENT_WR BIT(6)
+#define 

[PATCH] drm/msm/dp: Sleep properly in dp_hpd_handler kthread

2020-09-18 Thread Stephen Boyd
We shouldn't be waiting for an event here with a timeout of 100ms when
we're not in the 'timeout' arm of the if condition. Instead we should be
sleeping in the interruptible state (S) until something happens and we
need to wakeup. Right now this kthread is running almost all the time
because it sleeps for 100ms, wakes up, sees there's nothing to do, and
then starts the process all over again. Looking at top it shows up in
the D state (uninterruptible) because it uses wait_event_timeout(). FIx
this up.

Cc: Tanmay Shah 
Cc: Kuogee Hsieh 
Reported-by: Douglas Anderson 
Fixes: 8ede2ecc3e5e ("drm/msm/dp: Add DP compliance tests on Snapdragon 
Chipsets")
Signed-off-by: Stephen Boyd 
---

Based on msm-next-dp of https://gitlab.freedesktop.org/drm/msm.git

 drivers/gpu/drm/msm/dp/dp_display.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/msm/dp/dp_display.c 
b/drivers/gpu/drm/msm/dp/dp_display.c
index 05a97e097edf..e175aa3fd3a9 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.c
+++ b/drivers/gpu/drm/msm/dp/dp_display.c
@@ -970,9 +970,8 @@ static int hpd_event_thread(void *data)
(dp_priv->event_pndx == dp_priv->event_gndx),
EVENT_TIMEOUT);
} else {
-   wait_event_timeout(dp_priv->event_q,
-   (dp_priv->event_pndx != dp_priv->event_gndx),
-   EVENT_TIMEOUT);
+   wait_event_interruptible(dp_priv->event_q,
+   (dp_priv->event_pndx != dp_priv->event_gndx));
}
spin_lock_irqsave(_priv->event_lock, flag);
todo = _priv->event_list[dp_priv->event_gndx];

base-commit: 937f941ca06f2f3ab64baebf31be2c16d57ae7b8
-- 
Sent by a computer, using git, on the internet

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


Re: [PATCH] fbcon: Remove the superfluous break

2020-09-18 Thread Jing Xiangfeng




On 2020/9/18 2:52, Gustavo A. R. Silva wrote:



On 9/17/20 08:15, Jing Xiangfeng wrote:

Remove the superfuous break, as there is a 'return' before it.

Signed-off-by: Jing Xiangfeng 


Reviewed-by: Gustavo A. R. Silva 

Also, the following Fixes tag should be included in the changelog text:

Fixes: bad07ff74c32 ("fbcon: smart blitter usage for scrolling")


OK, I'll send a v2 with this tag.



Thanks
--
Gustavo


---
  drivers/video/fbdev/core/fbcon.c | 2 --
  1 file changed, 2 deletions(-)

diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index 0b49b0f44edf..623359aadd1e 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -1727,7 +1727,6 @@ static bool fbcon_scroll(struct vc_data *vc, unsigned int 
t, unsigned int b,
vc->vc_video_erase_char,
vc->vc_size_row * count);
return true;
-   break;

case SCROLL_WRAP_MOVE:
if (b - t - count > 3 * vc->vc_rows >> 2) {
@@ -1818,7 +1817,6 @@ static bool fbcon_scroll(struct vc_data *vc, unsigned int 
t, unsigned int b,
vc->vc_video_erase_char,
vc->vc_size_row * count);
return true;
-   break;

case SCROLL_WRAP_MOVE:
if (b - t - count > 3 * vc->vc_rows >> 2) {


.


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


Re: [PATCH] fbcon: Remove the superfluous break

2020-09-18 Thread Jing Xiangfeng




On 2020/9/18 1:36, Nick Desaulniers wrote:

On Thu, Sep 17, 2020 at 6:15 AM Jing Xiangfeng  wrote:


Remove the superfuous break, as there is a 'return' before it.


superfluous (missed "l")


Thanks for correcting!




Signed-off-by: Jing Xiangfeng 


Reviewed-by: Nick Desaulniers 

Thanks for the patch; I audited the rest of the switch statements in
this translation unit; LGTM.


---
  drivers/video/fbdev/core/fbcon.c | 2 --
  1 file changed, 2 deletions(-)

diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index 0b49b0f44edf..623359aadd1e 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -1727,7 +1727,6 @@ static bool fbcon_scroll(struct vc_data *vc, unsigned int 
t, unsigned int b,
 vc->vc_video_erase_char,
 vc->vc_size_row * count);
 return true;
-   break;

 case SCROLL_WRAP_MOVE:
 if (b - t - count > 3 * vc->vc_rows >> 2) {
@@ -1818,7 +1817,6 @@ static bool fbcon_scroll(struct vc_data *vc, unsigned int 
t, unsigned int b,
 vc->vc_video_erase_char,
 vc->vc_size_row * count);
 return true;
-   break;

 case SCROLL_WRAP_MOVE:
 if (b - t - count > 3 * vc->vc_rows >> 2) {
--
2.17.1





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


Re: [PATCH] drm/msm/dp: Sleep properly in dp_hpd_handler kthread

2020-09-18 Thread khsieh

On 2020-09-17 15:44, Stephen Boyd wrote:

We shouldn't be waiting for an event here with a timeout of 100ms when
we're not in the 'timeout' arm of the if condition. Instead we should 
be

sleeping in the interruptible state (S) until something happens and we
need to wakeup. Right now this kthread is running almost all the time
because it sleeps for 100ms, wakes up, sees there's nothing to do, and
then starts the process all over again. Looking at top it shows up in
the D state (uninterruptible) because it uses wait_event_timeout(). FIx
this up.

Cc: Tanmay Shah 
Cc: Kuogee Hsieh 
Reported-by: Douglas Anderson 
Fixes: 8ede2ecc3e5e ("drm/msm/dp: Add DP compliance tests on
Snapdragon Chipsets")
Signed-off-by: Stephen Boyd 

Reviewed-by: Kuogee Hsieh 

---

Based on msm-next-dp of https://gitlab.freedesktop.org/drm/msm.git

 drivers/gpu/drm/msm/dp/dp_display.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/msm/dp/dp_display.c
b/drivers/gpu/drm/msm/dp/dp_display.c
index 05a97e097edf..e175aa3fd3a9 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.c
+++ b/drivers/gpu/drm/msm/dp/dp_display.c
@@ -970,9 +970,8 @@ static int hpd_event_thread(void *data)
(dp_priv->event_pndx == dp_priv->event_gndx),
EVENT_TIMEOUT);
} else {
-   wait_event_timeout(dp_priv->event_q,
-   (dp_priv->event_pndx != dp_priv->event_gndx),
-   EVENT_TIMEOUT);
+   wait_event_interruptible(dp_priv->event_q,
+   (dp_priv->event_pndx != dp_priv->event_gndx));
}
spin_lock_irqsave(_priv->event_lock, flag);
todo = _priv->event_list[dp_priv->event_gndx];

base-commit: 937f941ca06f2f3ab64baebf31be2c16d57ae7b8

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


RE: [PATCH AUTOSEL 5.4 265/330] drm/amd/powerplay: try to do a graceful shutdown on SW CTF

2020-09-18 Thread Quan, Evan
[AMD Official Use Only - Internal Distribution Only]

Hi @Sasha Levin @Deucher, Alexander,

The following changes need to be applied also.
Otherwise, you may see unexpected shutdown on stress gpu loading on Vega10.

drm/amd/pm: avoid false alarm due to confusing softwareshutdowntemp setting
drm/amd/pm: correct the thermal alert temperature limit settings
drm/amd/pm: correct Vega20 swctf limit setting
drm/amd/pm: correct Vega12 swctf limit setting
drm/amd/pm: correct Vega10 swctf limit setting

BR
Evan
-Original Message-
From: Sasha Levin 
Sent: Friday, September 18, 2020 10:00 AM
To: linux-ker...@vger.kernel.org; sta...@vger.kernel.org
Cc: Quan, Evan ; Deucher, Alexander 
; Sasha Levin ; 
dri-devel@lists.freedesktop.org
Subject: [PATCH AUTOSEL 5.4 265/330] drm/amd/powerplay: try to do a graceful 
shutdown on SW CTF

From: Evan Quan 

[ Upstream commit 9495220577416632675959caf122e968469ffd16 ]

Normally this(SW CTF) should not happen. And by doing graceful shutdown we can 
prevent further damage.

Signed-off-by: Evan Quan 
Reviewed-by: Alex Deucher 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 .../gpu/drm/amd/powerplay/hwmgr/smu_helper.c  | 21 +++
 drivers/gpu/drm/amd/powerplay/smu_v11_0.c |  7 +++
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu_helper.c 
b/drivers/gpu/drm/amd/powerplay/hwmgr/smu_helper.c
index d09690fca4520..414added3d02c 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu_helper.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu_helper.c
@@ -22,6 +22,7 @@
  */

 #include 
+#include 

 #include "hwmgr.h"
 #include "pp_debug.h"
@@ -593,12 +594,18 @@ int phm_irq_process(struct amdgpu_device *adev,
 uint32_t src_id = entry->src_id;

 if (client_id == AMDGPU_IRQ_CLIENTID_LEGACY) {
-if (src_id == VISLANDS30_IV_SRCID_CG_TSS_THERMAL_LOW_TO_HIGH)
+if (src_id == VISLANDS30_IV_SRCID_CG_TSS_THERMAL_LOW_TO_HIGH) {
 pr_warn("GPU over temperature range detected on PCIe %d:%d.%d!\n",
 PCI_BUS_NUM(adev->pdev->devfn),
 PCI_SLOT(adev->pdev->devfn),
 PCI_FUNC(adev->pdev->devfn));
-else if (src_id == VISLANDS30_IV_SRCID_CG_TSS_THERMAL_HIGH_TO_LOW)
+/*
+ * SW CTF just occurred.
+ * Try to do a graceful shutdown to prevent further damage.
+ */
+dev_emerg(adev->dev, "System is going to shutdown due to SW CTF!\n");
+orderly_poweroff(true);
+} else if (src_id == VISLANDS30_IV_SRCID_CG_TSS_THERMAL_HIGH_TO_LOW)
 pr_warn("GPU under temperature range detected on PCIe %d:%d.%d!\n",
 PCI_BUS_NUM(adev->pdev->devfn),
 PCI_SLOT(adev->pdev->devfn),
@@ -609,12 +616,18 @@ int phm_irq_process(struct amdgpu_device *adev,
 PCI_SLOT(adev->pdev->devfn),
 PCI_FUNC(adev->pdev->devfn));
 } else if (client_id == SOC15_IH_CLIENTID_THM) {
-if (src_id == 0)
+if (src_id == 0) {
 pr_warn("GPU over temperature range detected on PCIe %d:%d.%d!\n",
 PCI_BUS_NUM(adev->pdev->devfn),
 PCI_SLOT(adev->pdev->devfn),
 PCI_FUNC(adev->pdev->devfn));
-else
+/*
+ * SW CTF just occurred.
+ * Try to do a graceful shutdown to prevent further damage.
+ */
+dev_emerg(adev->dev, "System is going to shutdown due to SW CTF!\n");
+orderly_poweroff(true);
+} else
 pr_warn("GPU under temperature range detected on PCIe %d:%d.%d!\n",
 PCI_BUS_NUM(adev->pdev->devfn),
 PCI_SLOT(adev->pdev->devfn),
diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c 
b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
index c4d8c52c6b9ca..6c4405622c9bb 100644
--- a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
+++ b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 

 #include "pp_debug.h"
 #include "amdgpu.h"
@@ -1538,6 +1539,12 @@ static int smu_v11_0_irq_process(struct amdgpu_device 
*adev,
 PCI_BUS_NUM(adev->pdev->devfn),
 PCI_SLOT(adev->pdev->devfn),
 PCI_FUNC(adev->pdev->devfn));
+/*
+ * SW CTF just occurred.
+ * Try to do a graceful shutdown to prevent further damage.
+ */
+dev_emerg(adev->dev, "System is going to shutdown due to SW CTF!\n");
+orderly_poweroff(true);
 break;
 case THM_11_0__SRCID__THM_DIG_THERM_H2L:
 pr_warn("GPU under temperature range detected on PCIe %d:%d.%d!\n",
--
2.25.1

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


Re: [PATCH] drm/vc4: hvs: Pull the state of all the CRTCs prior to PV muxing

2020-09-18 Thread Hoegeun Kwon
Hi Maxime,

On 9/17/20 9:16 PM, Maxime Ripard wrote:
> The vc4 display engine has a first controller called the HVS that will
> perform the composition of the planes. That HVS has 3 FIFOs and can
> therefore compose planes for up to three outputs. The timings part is
> generated through a component called the Pixel Valve, and the BCM2711 has 6
> of them.
>
> Thus, the HVS has some bits to control which FIFO gets output to which
> Pixel Valve. The current code supports that muxing by looking at all the
> CRTCs in a new DRM atomic state in atomic_check, and given the set of
> contraints that we have, assigns FIFOs to CRTCs or reject the mode
> entirely. The actual muxing will occur during atomic_commit.
>
> However, that doesn't work if only a fraction of the CRTCs' state is
> updated in that state, since it will ignore the CRTCs that are kept running
> unmodified, and will thus unassign its associated FIFO, and later disable
> it.
>
> In order to make the code work as expected, let's pull the CRTC state of
> all the enabled CRTC in our atomic_check so that we can operate on all the
> running CRTCs, no matter whether they are affected by the new state or not.
>
> Cc: Hoegeun Kwon 
> Fixes: 87ebcd42fb7b ("drm/vc4: crtc: Assign output to channel automatically")
> Signed-off-by: Maxime Ripard 

Thanks for the quick patch and detailed explanation.

Tested-by: Hoegeun Kwon 
Reviewed-by: Hoegeun Kwon 


Best regards,
Hoegeun

> ---
>   drivers/gpu/drm/vc4/vc4_kms.c | 17 +
>   1 file changed, 17 insertions(+)
>
> diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c
> index 16e233e1406e..af3ee3dcdab6 100644
> --- a/drivers/gpu/drm/vc4/vc4_kms.c
> +++ b/drivers/gpu/drm/vc4/vc4_kms.c
> @@ -620,6 +620,23 @@ vc4_atomic_check(struct drm_device *dev, struct 
> drm_atomic_state *state)
>   struct drm_crtc *crtc;
>   int i, ret;
>   
> + /*
> +  * Since the HVS FIFOs are shared across all the pixelvalves and
> +  * the TXP (and thus all the CRTCs), we need to pull the current
> +  * state of all the enabled CRTCs so that an update to a single
> +  * CRTC still keeps the previous FIFOs enabled and assigned to
> +  * the same CRTCs, instead of evaluating only the CRTC being
> +  * modified.
> +  */
> + list_for_each_entry(crtc, >mode_config.crtc_list, head) {
> + if (!crtc->state->enable)
> + continue;
> +
> + crtc_state = drm_atomic_get_crtc_state(state, crtc);
> + if (IS_ERR(crtc_state))
> + return PTR_ERR(crtc_state);
> + }
> +
>   for_each_new_crtc_in_state(state, crtc, crtc_state, i) {
>   struct vc4_crtc_state *vc4_crtc_state =
>   to_vc4_crtc_state(crtc_state);
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 0/3] dma-buf: Flag vmap'ed memory as system or I/O memory

2020-09-18 Thread Sumit Semwal
Hello Thomas,

On Mon, 14 Sep 2020 at 16:55, Thomas Zimmermann  wrote:
>
> Dma-buf provides vmap() and vunmap() for retrieving and releasing mappings
> of dma-buf memory in kernel address space. The functions operate with plain
> addresses and the assumption is that the memory can be accessed with load
> and store operations. This is not the case on some architectures (e.g.,
> sparc64) where I/O memory can only be accessed with dedicated instructions.
>
> This patchset introduces struct dma_buf_map, which contains the address of
> a buffer and a flag that tells whether system- or I/O-memory instructions
> are required.

Thank you for the patchset - it is a really nice, clean bit to add!
>
> Some background: updating the DRM framebuffer console on sparc64 makes the
> kernel panic. This is because the framebuffer memory cannot be accessed with
> system-memory instructions. We currently employ a workaround in DRM to
> address this specific problem. [1]
>
> To resolve the problem, we'd like to address it at the most common point,
> which is the dma-buf framework. The dma-buf mapping ideally knows if I/O
> instructions are required and exports this information to it's users. The
> new structure struct dma_buf_map stores the buffer address and a flag that
> signals I/O memory. Affected users of the buffer (e.g., drivers, frameworks)
> can then access the memory accordingly.
>
> This patchset only introduces struct dma_buf_map, and updates struct dma_buf
> and it's interfaces. Further patches can update dma-buf users. For example,
> there's a prototype patchset for DRM that fixes the framebuffer problem. [2]
>
> Further work: TTM, one of DRM's memory managers, already exports an
> is_iomem flag of its own. It could later be switched over to exporting struct
> dma_buf_map, thus simplifying some code. Several DRM drivers expect their
> fbdev console to operate on I/O memory. These could possibly be switched over
> to the generic fbdev emulation, as soon as the generic code uses struct
> dma_buf_map.
>
> [1] https://lore.kernel.org/dri-devel/20200725191012.ga434...@ravnborg.org/
> [2] 
> https://lore.kernel.org/dri-devel/20200806085239.4606-1-tzimmerm...@suse.de/
>
> Thomas Zimmermann (3):
>   dma-buf: Add struct dma-buf-map for storing struct dma_buf.vaddr_ptr
>   dma-buf: Use struct dma_buf_map in dma_buf_vmap() interfaces
>   dma-buf: Use struct dma_buf_map in dma_buf_vunmap() interfaces

FWIW, for the series, please feel free to add my
Acked-by: Sumit Semwal 

>
>  Documentation/driver-api/dma-buf.rst  |   3 +
>  drivers/dma-buf/dma-buf.c |  40 +++---
>  drivers/gpu/drm/drm_gem_cma_helper.c  |  16 ++-
>  drivers/gpu/drm/drm_gem_shmem_helper.c|  17 ++-
>  drivers/gpu/drm/drm_prime.c   |  14 +-
>  drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c   |  13 +-
>  drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c|  13 +-
>  .../drm/i915/gem/selftests/i915_gem_dmabuf.c  |  18 ++-
>  drivers/gpu/drm/tegra/gem.c   |  23 ++--
>  .../common/videobuf2/videobuf2-dma-contig.c   |  17 ++-
>  .../media/common/videobuf2/videobuf2-dma-sg.c |  19 ++-
>  .../common/videobuf2/videobuf2-vmalloc.c  |  21 ++-
>  include/drm/drm_prime.h   |   5 +-
>  include/linux/dma-buf-map.h   | 126 ++
>  include/linux/dma-buf.h   |  11 +-
>  15 files changed, 274 insertions(+), 82 deletions(-)
>  create mode 100644 include/linux/dma-buf-map.h
>
> --
> 2.28.0
>

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