[radeon-alex:amd-staging-drm-next 593/598] drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:5374:5: warning: no previous prototype for function 'amdgpu_dm_crtc_atomic_set_property'

2020-11-16 Thread kernel test robot
tree:   git://people.freedesktop.org/~agd5f/linux.git amd-staging-drm-next
head:   11e500d2892a2b18e438c12e1e992b241aaf1c8b
commit: 110d586ba77ed573eb7464ca69b6490ec0b70c5f [593/598] drm/amd/display: 
Expose new CRC window property
config: arm64-randconfig-r034-20201115 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 
ace9653c11c6308401dcda2e8b26bf97e6e66e30)
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
git remote add radeon-alex git://people.freedesktop.org/~agd5f/linux.git
git fetch --no-tags radeon-alex amd-staging-drm-next
git checkout 110d586ba77ed573eb7464ca69b6490ec0b70c5f
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 

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

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:5374:5: warning: 
>> no previous prototype for function 'amdgpu_dm_crtc_atomic_set_property' 
>> [-Wmissing-prototypes]
   int amdgpu_dm_crtc_atomic_set_property(struct drm_crtc *crtc,
   ^
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:5374:1: note: 
declare 'static' if the function is not intended to be used outside of this 
translation unit
   int amdgpu_dm_crtc_atomic_set_property(struct drm_crtc *crtc,
   ^
   static 
>> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:5398:5: warning: 
>> no previous prototype for function 'amdgpu_dm_crtc_atomic_get_property' 
>> [-Wmissing-prototypes]
   int amdgpu_dm_crtc_atomic_get_property(struct drm_crtc *crtc,
   ^
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:5398:1: note: 
declare 'static' if the function is not intended to be used outside of this 
translation unit
   int amdgpu_dm_crtc_atomic_get_property(struct drm_crtc *crtc,
   ^
   static 
   2 warnings generated.

vim +/amdgpu_dm_crtc_atomic_set_property +5374 
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c

  5372  
  5373  #ifdef CONFIG_DEBUG_FS
> 5374  int amdgpu_dm_crtc_atomic_set_property(struct drm_crtc *crtc,
  5375  struct drm_crtc_state 
*crtc_state,
  5376  struct drm_property 
*property,
  5377  uint64_t val)
  5378  {
  5379  struct drm_device *dev = crtc->dev;
  5380  struct amdgpu_device *adev = drm_to_adev(dev);
  5381  struct dm_crtc_state *dm_new_state =
  5382  to_dm_crtc_state(crtc_state);
  5383  
  5384  if (property == adev->dm.crc_win_x_start_property)
  5385  dm_new_state->crc_window.x_start = val;
  5386  else if (property == adev->dm.crc_win_y_start_property)
  5387  dm_new_state->crc_window.y_start = val;
  5388  else if (property == adev->dm.crc_win_x_end_property)
  5389  dm_new_state->crc_window.x_end = val;
  5390  else if (property == adev->dm.crc_win_y_end_property)
  5391  dm_new_state->crc_window.y_end = val;
  5392  else
  5393  return -EINVAL;
  5394  
  5395  return 0;
  5396  }
  5397  
> 5398  int amdgpu_dm_crtc_atomic_get_property(struct drm_crtc *crtc,
  5399  const struct drm_crtc_state 
*state,
  5400  struct drm_property 
*property,
  5401  uint64_t *val)
  5402  {
  5403  struct drm_device *dev = crtc->dev;
  5404  struct amdgpu_device *adev = drm_to_adev(dev);
  5405  struct dm_crtc_state *dm_state =
  5406  to_dm_crtc_state(state);
  5407  
  5408  if (property == adev->dm.crc_win_x_start_property)
  5409  *val = dm_state->crc_window.x_start;
  5410  else if (property == adev->dm.crc_win_y_start_property)
  5411  *val = dm_state->crc_window.y_start;
  5412  else if (property == adev->dm.crc_win_x_end_property)
  5413  *val = dm_state->crc_window.x_end;
  5414  else if (property == adev->dm.crc_win_y_end_property)
  5415  *val = dm_state->crc_window.y_end;
  5416  else
  5417  return -EINVAL;
  5418  
  5419  return 0;
  5420  }
  5421  #endif
  5422  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org


.config.gz
Description: application/gzip
___
dri-devel mailing list

[PATCH] drm/kmb: Fix possible oops in probe error handling

2020-11-16 Thread Dan Carpenter
If kmb_dsi_init() fails the error handling will dereference an error
pointer which will cause an Oops.

Fixes: 7f7b96a8a0a1 ("drm/kmb: Add support for KeemBay Display")
Signed-off-by: Dan Carpenter 
---
 drivers/gpu/drm/kmb/kmb_drv.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/kmb/kmb_drv.c b/drivers/gpu/drm/kmb/kmb_drv.c
index a31a840ce634..8c43b136765c 100644
--- a/drivers/gpu/drm/kmb/kmb_drv.c
+++ b/drivers/gpu/drm/kmb/kmb_drv.c
@@ -504,7 +504,7 @@ static int kmb_probe(struct platform_device *pdev)
if (IS_ERR(kmb->kmb_dsi)) {
drm_err(>drm, "failed to initialize DSI\n");
ret = PTR_ERR(kmb->kmb_dsi);
-   goto err_free1;
+   goto err_clear_drvdata;
}
 
kmb->kmb_dsi->dev = _pdev->dev;
@@ -540,8 +540,9 @@ static int kmb_probe(struct platform_device *pdev)
drm_crtc_cleanup(>crtc);
drm_mode_config_cleanup(>drm);
  err_free1:
-   dev_set_drvdata(dev, NULL);
kmb_dsi_host_unregister(kmb->kmb_dsi);
+ err_clear_drvdata:
+   dev_set_drvdata(dev, NULL);
 
return ret;
 }
-- 
2.28.0

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


[PATCH] drm/kmb: Remove an unnecessary NULL check

2020-11-16 Thread Dan Carpenter
The NULL checking isn't done consistently in this function and it leads
to a static checker warning:

drivers/gpu/drm/kmb/kmb_drv.c:561 kmb_pm_suspend()
error: we previously assumed 'drm' could be null (see line 559)

Fortunately "drm" cannot be NULL at this point so the check can just be
removed.

Signed-off-by: Dan Carpenter 
---
 drivers/gpu/drm/kmb/kmb_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/kmb/kmb_drv.c b/drivers/gpu/drm/kmb/kmb_drv.c
index 8c43b136765c..5ff392644603 100644
--- a/drivers/gpu/drm/kmb/kmb_drv.c
+++ b/drivers/gpu/drm/kmb/kmb_drv.c
@@ -557,7 +557,7 @@ MODULE_DEVICE_TABLE(of, kmb_of_match);
 static int __maybe_unused kmb_pm_suspend(struct device *dev)
 {
struct drm_device *drm = dev_get_drvdata(dev);
-   struct kmb_drm_private *kmb = drm ? to_kmb(drm) : NULL;
+   struct kmb_drm_private *kmb = to_kmb(drm);
 
drm_kms_helper_poll_disable(drm);
 
-- 
2.28.0

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


[radeon-alex:amd-staging-drm-next 576/598] drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/vangogh_ppt.c:764:5: warning: no previous prototype for function 'vangogh_set_default_dpm_tables'

2020-11-16 Thread kernel test robot
Hi Xiaojian,

FYI, the error/warning still remains.

tree:   git://people.freedesktop.org/~agd5f/linux.git amd-staging-drm-next
head:   11e500d2892a2b18e438c12e1e992b241aaf1c8b
commit: 53501c771afda638485683d189a2b2e2ad776d38 [576/598] drm/amd/pm: add the 
fine grain tuning function for vangogh
config: x86_64-randconfig-a004-20201115 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 
ace9653c11c6308401dcda2e8b26bf97e6e66e30)
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
git remote add radeon-alex git://people.freedesktop.org/~agd5f/linux.git
git fetch --no-tags radeon-alex amd-staging-drm-next
git checkout 53501c771afda638485683d189a2b2e2ad776d38
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

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

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/vangogh_ppt.c:764:5: warning: 
>> no previous prototype for function 'vangogh_set_default_dpm_tables' 
>> [-Wmissing-prototypes]
   int vangogh_set_default_dpm_tables(struct smu_context *smu)
   ^
   drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/vangogh_ppt.c:764:1: note: 
declare 'static' if the function is not intended to be used outside of this 
translation unit
   int vangogh_set_default_dpm_tables(struct smu_context *smu)
   ^
   static 
   1 warning generated.

vim +/vangogh_set_default_dpm_tables +764 
drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/vangogh_ppt.c

   763  
 > 764  int vangogh_set_default_dpm_tables(struct smu_context *smu)
   765  {
   766  struct smu_table_context *smu_table = >smu_table;
   767  
   768  return smu_cmn_update_table(smu, SMU_TABLE_DPMCLOCKS, 0, 
smu_table->clocks_table, false);
   769  }
   770  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org


.config.gz
Description: application/gzip
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v3 0/5] console: Miscellaneous clean-ups, do not use FNTCHARCNT() in fbcon.c

2020-11-16 Thread Peilin Ye
On Mon, Nov 16, 2020 at 11:09:49AM +0100, Daniel Vetter wrote:
> On Sat, Nov 14, 2020 at 07:47:16AM -0500, Peilin Ye wrote:
> > On Sat, Nov 14, 2020 at 01:22:22PM +0100, Greg Kroah-Hartman wrote:
> > > On Sat, Nov 14, 2020 at 01:18:06PM +0100, Greg Kroah-Hartman wrote:
> > > > On Sat, Nov 14, 2020 at 03:10:21AM -0500, Peilin Ye wrote:
> > > > > Thanks for reviewing!  Questions about the last patch [5/5] though, it
> > > > > depends on the following assumption:
> > > > > 
> > > > > """
> > > > > For each console `idx`, `vc_cons[idx].d->vc_font.data` and
> > > > > `fb_display[idx].fontdata` always point to the same buffer.
> > > > > """
> > > > > 
> > > > > Is this true?  I think it is true by grepping for `fontdata`.  I also
> > > > > noticed that fbcon.c is using `vc->vc_font.data` and `p->fontdata`
> > > > > interchangeably, see fbcon_get_requirement():
> > > > > 
> > > > >   vc = vc_cons[fg_console].d;
> > > > >   [...]
> > > > >   p = _display[fg_console];
> > > > >   caps->x = 1 << (vc->vc_font.width - 1);
> > > > >   ^^^
> > > > >   caps->y = 1 << (vc->vc_font.height - 1);
> > > > >   ^^^
> > > > >   caps->len = (p->userfont) ?
> > > > >   FNTCHARCNT(p->fontdata) : 256;
> > > > >  ^^^
> > > > > 
> > > > > If it is true, then what is the point of using `fontdata` in `struct
> > > > > fbcon_display`?  Just for the `userfont` flag?  Should we delete
> > > > > `fontdata`, when we no longer need the `userfont` flag?
> > > > 
> > > > Yes, after a quick look, I think your analysis here is correct.  So if
> > > > you can delete that, it would be nice if possible.
> > 
> > I see, at the moment we still need `userfont` for refcount handling, I
> > will try to delete both `fontdata` and `userfont` after refcount is
> > taken care of.
> 
> +1 on sunsetting fondata. I think there's a bunch of these in fbcon code,
> because the console subsystem is older than the standard "allow drivers to
> embed the subsystem struct into their own private struct" subclassing
> model. So lots of global arrays indexed by the console id :-/

Yeah, I saw your comments about registered_fb[] :(

> We're also trying to start some kind of test suite for fbdev chardev ioctl
> interface in the gpu test suite. fbcon tests are maybe more related to
> tty/vt, and I have no idea whether anything exists there already.
> 
> But if you want to do some automated testcases for fbcon and there's
> absolutely no other home for them, the gpu test suite might be an option
> of last resort too:
> 
> https://dri.freedesktop.org/docs/drm/gpu/drm-uapi.html#testing-and-validation

Oh, I didn't know about igt-gpu-tools, thanks for the pointer!  Now,
since charcount is taken care of, and font_desc now contains all fields
of console_font, I think it is a good time to replace console_font with
font_desc in vc_data.  Then we can get rid of FNTSUM(), FNTSIZE(), then
(finally) REFCOUNT().

I will start working on vc_data, after done enough testing on [5/5],
ofc. Thanks,

Peilin Ye

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


[radeon-alex:amd-staging-drm-next 576/598] drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/vangogh_ppt.c:764:5: warning: no previous prototype for function 'vangogh_set_default_dpm_tables'

2020-11-16 Thread kernel test robot
tree:   git://people.freedesktop.org/~agd5f/linux.git amd-staging-drm-next
head:   11e500d2892a2b18e438c12e1e992b241aaf1c8b
commit: 53501c771afda638485683d189a2b2e2ad776d38 [576/598] drm/amd/pm: add the 
fine grain tuning function for vangogh
config: arm64-randconfig-r034-20201115 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 
ace9653c11c6308401dcda2e8b26bf97e6e66e30)
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
git remote add radeon-alex git://people.freedesktop.org/~agd5f/linux.git
git fetch --no-tags radeon-alex amd-staging-drm-next
git checkout 53501c771afda638485683d189a2b2e2ad776d38
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 

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

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/vangogh_ppt.c:764:5: warning: 
>> no previous prototype for function 'vangogh_set_default_dpm_tables' 
>> [-Wmissing-prototypes]
   int vangogh_set_default_dpm_tables(struct smu_context *smu)
   ^
   drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/vangogh_ppt.c:764:1: note: 
declare 'static' if the function is not intended to be used outside of this 
translation unit
   int vangogh_set_default_dpm_tables(struct smu_context *smu)
   ^
   static 
   1 warning generated.

vim +/vangogh_set_default_dpm_tables +764 
drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/vangogh_ppt.c

   763  
 > 764  int vangogh_set_default_dpm_tables(struct smu_context *smu)
   765  {
   766  struct smu_table_context *smu_table = >smu_table;
   767  
   768  return smu_cmn_update_table(smu, SMU_TABLE_DPMCLOCKS, 0, 
smu_table->clocks_table, false);
   769  }
   770  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org


.config.gz
Description: application/gzip
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] dt-bindings: display: Use OF graph schema

2020-11-16 Thread Rob Herring
Now that we have a graph schema, rework the display related schemas to use
it. Mostly this is adding a reference to graph.yaml and dropping duplicate
parts from schemas.

Cc: Thierry Reding 
Cc: Sam Ravnborg 
Cc: Laurent Pinchart 
Cc: Maxime Ripard 
Cc: Maarten Lankhorst 
Cc: Thomas Zimmermann 
Signed-off-by: Rob Herring 
---
graph.yaml is in the dtschema repo, so this can go into drm-misc and 
hopefully anything afterwards be fixed up to use graph.yaml.

 .../allwinner,sun4i-a10-display-backend.yaml  | 14 +---
 .../allwinner,sun4i-a10-display-frontend.yaml | 16 +
 .../display/allwinner,sun4i-a10-hdmi.yaml | 16 +
 .../display/allwinner,sun4i-a10-tcon.yaml | 16 +
 .../allwinner,sun4i-a10-tv-encoder.yaml   |  2 +-
 .../display/allwinner,sun6i-a31-drc.yaml  | 16 +
 .../display/allwinner,sun6i-a31-mipi-dsi.yaml |  6 +-
 .../allwinner,sun8i-a83t-de2-mixer.yaml   | 16 +
 .../display/allwinner,sun8i-a83t-dw-hdmi.yaml | 16 +
 .../display/allwinner,sun8i-r40-tcon-top.yaml | 19 +-
 .../display/allwinner,sun9i-a80-deu.yaml  | 16 +
 .../bindings/display/brcm,bcm2835-dpi.yaml|  7 +-
 .../display/bridge/analogix,anx7625.yaml  |  5 +-
 .../display/bridge/analogix,anx7814.yaml  | 18 +
 .../bindings/display/bridge/anx6345.yaml  | 15 ++--
 .../display/bridge/cdns,mhdp8546.yaml | 18 +
 .../display/bridge/chrontel,ch7033.yaml   |  3 +
 .../display/bridge/intel,keembay-dsi.yaml |  9 +--
 .../bindings/display/bridge/ite,it6505.yaml   |  2 +-
 .../display/bridge/lontium,lt9611.yaml| 68 ++-
 .../bindings/display/bridge/lvds-codec.yaml   | 15 +---
 .../bindings/display/bridge/nwl-dsi.yaml  | 17 +
 .../bindings/display/bridge/ps8640.yaml   | 21 ++
 .../bindings/display/bridge/renesas,lvds.yaml | 15 +---
 .../display/bridge/simple-bridge.yaml | 15 +---
 .../display/bridge/snps,dw-mipi-dsi.yaml  |  5 +-
 .../display/bridge/thine,thc63lvd1024.yaml| 16 +
 .../bindings/display/bridge/ti,sn65dsi86.yaml | 27 +---
 .../bindings/display/bridge/ti,tfp410.yaml| 15 +---
 .../display/bridge/toshiba,tc358762.yaml  | 51 ++
 .../display/bridge/toshiba,tc358768.yaml  | 11 +--
 .../display/bridge/toshiba,tc358775.yaml  | 17 ++---
 .../connector/analog-tv-connector.yaml|  1 +
 .../display/connector/dvi-connector.yaml  |  1 +
 .../display/connector/hdmi-connector.yaml |  1 +
 .../display/connector/vga-connector.yaml  |  1 +
 .../bindings/display/imx/nxp,imx8mq-dcss.yaml |  2 +-
 .../bindings/display/ingenic,lcd.yaml |  7 +-
 .../display/intel,keembay-display.yaml|  2 +-
 .../display/panel/advantech,idk-2121wr.yaml   |  5 ++
 .../bindings/display/panel/panel-common.yaml  | 11 +--
 .../rockchip/rockchip,rk3066-hdmi.yaml| 13 +---
 .../display/rockchip/rockchip-vop.yaml|  5 +-
 .../bindings/display/st,stm32-dsi.yaml| 13 ++--
 .../bindings/display/st,stm32-ltdc.yaml   |  7 +-
 .../bindings/display/ti/ti,am65x-dss.yaml | 16 +
 .../bindings/display/ti/ti,j721e-dss.yaml | 18 +
 .../bindings/display/ti/ti,k2g-dss.yaml   |  4 +-
 48 files changed, 121 insertions(+), 509 deletions(-)

diff --git 
a/Documentation/devicetree/bindings/display/allwinner,sun4i-a10-display-backend.yaml
 
b/Documentation/devicetree/bindings/display/allwinner,sun4i-a10-display-backend.yaml
index 86057d541065..7e8798b43c2a 100644
--- 
a/Documentation/devicetree/bindings/display/allwinner,sun4i-a10-display-backend.yaml
+++ 
b/Documentation/devicetree/bindings/display/allwinner,sun4i-a10-display-backend.yaml
@@ -85,17 +85,9 @@ properties:
 
   ports:
 type: object
-description: |
-  A ports node with endpoint definitions as defined in
-  Documentation/devicetree/bindings/media/video-interfaces.txt.
+$ref: /schemas/graph.yaml#/properties/ports
 
 properties:
-  "#address-cells":
-const: 1
-
-  "#size-cells":
-const: 0
-
   port@0:
 type: object
 description: |
@@ -107,12 +99,10 @@ properties:
   Output endpoints of the controller.
 
 required:
-  - "#address-cells"
-  - "#size-cells"
   - port@0
   - port@1
 
-additionalProperties: false
+unevaluatedProperties: false
 
 required:
   - compatible
diff --git 
a/Documentation/devicetree/bindings/display/allwinner,sun4i-a10-display-frontend.yaml
 
b/Documentation/devicetree/bindings/display/allwinner,sun4i-a10-display-frontend.yaml
index 3eb1c2bbf4e7..005a550d7226 100644
--- 
a/Documentation/devicetree/bindings/display/allwinner,sun4i-a10-display-frontend.yaml
+++ 
b/Documentation/devicetree/bindings/display/allwinner,sun4i-a10-display-frontend.yaml
@@ -58,33 +58,21 @@ properties:
 
   ports:
 type: object
-description: |
-  A ports node with endpoint definitions as defined in
-  Documentation/devicetree/bindings/media/video-interfaces.txt.
+$ref: 

linux-next: manual merge of the amdgpu tree with the drm tree

2020-11-16 Thread Stephen Rothwell
Hi all,

Today's linux-next merge of the amdgpu tree got a conflict in:

  drivers/gpu/drm/radeon/radeon_drv.c

between commit:

  384bc5e059d4 ("drm/radeon: Stop changing the drm_driver struct")

from the drm tree and commits:

  4d3efadd374a ("drm/radeon/radeon: Move prototype into shared header")
  0a2e8d51e4da ("drm/radeon/radeon_drv: Move 'radeon_mmap()'s prototype to 
shared header")
  f3723ad110c5 ("drm/radeon/radeon_drv: Move 'radeon_driver_irq_handler_kms's 
prototype into shared header")
  4138b62b8a79 ("drm/radeon/radeon_drv: Move 
'radeon_gem_prime_import_sg_table()'s prototype to shared header")

from the amdgpu tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc drivers/gpu/drm/radeon/radeon_drv.c
index bfadb799d6a3,84f5d56528ee..
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@@ -51,7 -51,10 +51,11 @@@
  #include 
  
  #include "radeon_drv.h"
 +#include "radeon.h"
+ #include "radeon_kms.h"
+ #include "radeon_ttm.h"
+ #include "radeon_device.h"
+ #include "radeon_prime.h"
  
  /*
   * KMS wrapper.
@@@ -130,7 -123,8 +124,6 @@@ extern int radeon_get_crtc_scanoutpos(s
  ktime_t *stime, ktime_t *etime,
  const struct drm_display_mode *mode);
  extern bool radeon_is_px(struct drm_device *dev);
- int radeon_mmap(struct file *filp, struct vm_area_struct *vma);
 -extern const struct drm_ioctl_desc radeon_ioctls_kms[];
 -extern int radeon_max_kms_ioctl;
  int radeon_mode_dumb_mmap(struct drm_file *filp,
  struct drm_device *dev,
  uint32_t handle, uint64_t *offset_p);
@@@ -297,10 -288,8 +287,8 @@@ static struct pci_device_id pciidlist[
  
  MODULE_DEVICE_TABLE(pci, pciidlist);
  
 -static struct drm_driver kms_driver;
 +static const struct drm_driver kms_driver;
  
- bool radeon_device_is_virtual(void);
- 
  static int radeon_pci_probe(struct pci_dev *pdev,
const struct pci_device_id *ent)
  {


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


[RESEND PATCH 1/3] drm/mediatek: Separate mtk_mipi_tx to an independent module

2020-11-16 Thread Chun-Kuang Hu
mtk_mipi_tx is a part of mtk_drm module, but phy driver should be an
independent module rather than be part of drm module, so separate the phy
driver to an independent module.

Signed-off-by: Chun-Kuang Hu 
---
 drivers/gpu/drm/mediatek/Kconfig   | 8 
 drivers/gpu/drm/mediatek/Makefile  | 9 ++---
 drivers/gpu/drm/mediatek/mtk_drm_drv.c | 1 -
 drivers/gpu/drm/mediatek/mtk_drm_drv.h | 1 -
 drivers/gpu/drm/mediatek/mtk_mipi_tx.c | 3 +++
 5 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/Kconfig b/drivers/gpu/drm/mediatek/Kconfig
index 65cd03a4be29..24c4890a6e65 100644
--- a/drivers/gpu/drm/mediatek/Kconfig
+++ b/drivers/gpu/drm/mediatek/Kconfig
@@ -13,6 +13,7 @@ config DRM_MEDIATEK
select DRM_PANEL
select MEMORY
select MTK_SMI
+   select PHY_MTK_MIPI_DSI
select VIDEOMODE_HELPERS
help
  Choose this option if you have a Mediatek SoCs.
@@ -27,3 +28,10 @@ config DRM_MEDIATEK_HDMI
select PHY_MTK_HDMI
help
  DRM/KMS HDMI driver for Mediatek SoCs
+
+config PHY_MTK_MIPI_DSI
+   tristate "Mediatek MIPI-DSI-PHY Driver"
+   depends on ARCH_MEDIATEK && OF
+   select GENERIC_PHY
+   help
+ Support MIPI DSI PHY for Mediatek SoCs.
diff --git a/drivers/gpu/drm/mediatek/Makefile 
b/drivers/gpu/drm/mediatek/Makefile
index 77b0fd86063d..baa188000543 100644
--- a/drivers/gpu/drm/mediatek/Makefile
+++ b/drivers/gpu/drm/mediatek/Makefile
@@ -10,9 +10,6 @@ mediatek-drm-y := mtk_disp_color.o \
  mtk_drm_gem.o \
  mtk_drm_plane.o \
  mtk_dsi.o \
- mtk_mipi_tx.o \
- mtk_mt8173_mipi_tx.o \
- mtk_mt8183_mipi_tx.o \
  mtk_dpi.o
 
 obj-$(CONFIG_DRM_MEDIATEK) += mediatek-drm.o
@@ -22,3 +19,9 @@ mediatek-drm-hdmi-objs := mtk_cec.o \
  mtk_hdmi_ddc.o
 
 obj-$(CONFIG_DRM_MEDIATEK_HDMI) += mediatek-drm-hdmi.o
+
+phy-mtk-mipi-dsi-drv-objs := mtk_mipi_tx.o \
+mtk_mt8173_mipi_tx.o \
+mtk_mt8183_mipi_tx.o
+
+obj-$(CONFIG_PHY_MTK_MIPI_DSI) += phy-mtk-mipi-dsi-drv.o
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c 
b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
index 59c85c63b7cc..bad75c5be090 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -636,7 +636,6 @@ static struct platform_driver * const mtk_drm_drivers[] = {
_disp_rdma_driver,
_dpi_driver,
_drm_platform_driver,
-   _mipi_tx_driver,
_dsi_driver,
 };
 
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.h 
b/drivers/gpu/drm/mediatek/mtk_drm_drv.h
index b5be63e53176..6ff98a68444b 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.h
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.h
@@ -54,6 +54,5 @@ extern struct platform_driver mtk_disp_ovl_driver;
 extern struct platform_driver mtk_disp_rdma_driver;
 extern struct platform_driver mtk_dpi_driver;
 extern struct platform_driver mtk_dsi_driver;
-extern struct platform_driver mtk_mipi_tx_driver;
 
 #endif /* MTK_DRM_DRV_H */
diff --git a/drivers/gpu/drm/mediatek/mtk_mipi_tx.c 
b/drivers/gpu/drm/mediatek/mtk_mipi_tx.c
index 8cee2591e728..f2a892e16c27 100644
--- a/drivers/gpu/drm/mediatek/mtk_mipi_tx.c
+++ b/drivers/gpu/drm/mediatek/mtk_mipi_tx.c
@@ -242,4 +242,7 @@ struct platform_driver mtk_mipi_tx_driver = {
.of_match_table = mtk_mipi_tx_match,
},
 };
+module_platform_driver(mtk_mipi_tx_driver);
 
+MODULE_DESCRIPTION("MediaTek MIPI TX Driver");
+MODULE_LICENSE("GPL v2");
-- 
2.17.1

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


[RESEND PATCH 2/3] phy: mediatek: Move mtk_mipi_dsi_phy driver into drivers/phy/mediatek folder

2020-11-16 Thread Chun-Kuang Hu
mtk_mipi_dsi_phy is currently placed inside mediatek drm driver, but it's
more suitable to place a phy driver into phy driver folder, so move
mtk_mipi_dsi_phy driver into phy driver folder.

Signed-off-by: Chun-Kuang Hu 
---
 drivers/gpu/drm/mediatek/Kconfig   | 7 ---
 drivers/gpu/drm/mediatek/Makefile  | 6 --
 drivers/phy/mediatek/Kconfig   | 7 +++
 drivers/phy/mediatek/Makefile  | 5 +
 .../mediatek/phy-mtk-mipi-dsi-mt8173.c}| 2 +-
 .../mediatek/phy-mtk-mipi-dsi-mt8183.c}| 2 +-
 .../mtk_mipi_tx.c => phy/mediatek/phy-mtk-mipi-dsi.c}  | 2 +-
 .../mtk_mipi_tx.h => phy/mediatek/phy-mtk-mipi-dsi.h}  | 0
 8 files changed, 15 insertions(+), 16 deletions(-)
 rename drivers/{gpu/drm/mediatek/mtk_mt8173_mipi_tx.c => 
phy/mediatek/phy-mtk-mipi-dsi-mt8173.c} (99%)
 rename drivers/{gpu/drm/mediatek/mtk_mt8183_mipi_tx.c => 
phy/mediatek/phy-mtk-mipi-dsi-mt8183.c} (99%)
 rename drivers/{gpu/drm/mediatek/mtk_mipi_tx.c => 
phy/mediatek/phy-mtk-mipi-dsi.c} (99%)
 rename drivers/{gpu/drm/mediatek/mtk_mipi_tx.h => 
phy/mediatek/phy-mtk-mipi-dsi.h} (100%)

diff --git a/drivers/gpu/drm/mediatek/Kconfig b/drivers/gpu/drm/mediatek/Kconfig
index 24c4890a6e65..2976d21e9a34 100644
--- a/drivers/gpu/drm/mediatek/Kconfig
+++ b/drivers/gpu/drm/mediatek/Kconfig
@@ -28,10 +28,3 @@ config DRM_MEDIATEK_HDMI
select PHY_MTK_HDMI
help
  DRM/KMS HDMI driver for Mediatek SoCs
-
-config PHY_MTK_MIPI_DSI
-   tristate "Mediatek MIPI-DSI-PHY Driver"
-   depends on ARCH_MEDIATEK && OF
-   select GENERIC_PHY
-   help
- Support MIPI DSI PHY for Mediatek SoCs.
diff --git a/drivers/gpu/drm/mediatek/Makefile 
b/drivers/gpu/drm/mediatek/Makefile
index baa188000543..a892edec5563 100644
--- a/drivers/gpu/drm/mediatek/Makefile
+++ b/drivers/gpu/drm/mediatek/Makefile
@@ -19,9 +19,3 @@ mediatek-drm-hdmi-objs := mtk_cec.o \
  mtk_hdmi_ddc.o
 
 obj-$(CONFIG_DRM_MEDIATEK_HDMI) += mediatek-drm-hdmi.o
-
-phy-mtk-mipi-dsi-drv-objs := mtk_mipi_tx.o \
-mtk_mt8173_mipi_tx.o \
-mtk_mt8183_mipi_tx.o
-
-obj-$(CONFIG_PHY_MTK_MIPI_DSI) += phy-mtk-mipi-dsi-drv.o
diff --git a/drivers/phy/mediatek/Kconfig b/drivers/phy/mediatek/Kconfig
index 50c5e9306e19..574b8e6398d2 100644
--- a/drivers/phy/mediatek/Kconfig
+++ b/drivers/phy/mediatek/Kconfig
@@ -42,3 +42,10 @@ config PHY_MTK_HDMI
select GENERIC_PHY
help
  Support HDMI PHY for Mediatek SoCs.
+
+config PHY_MTK_MIPI_DSI
+   tristate "MediaTek MIPI-DSI Driver"
+   depends on ARCH_MEDIATEK && OF
+   select GENERIC_PHY
+   help
+ Support MIPI DSI for Mediatek SoCs.
diff --git a/drivers/phy/mediatek/Makefile b/drivers/phy/mediatek/Makefile
index 6325e38709ed..ace660fbed3a 100644
--- a/drivers/phy/mediatek/Makefile
+++ b/drivers/phy/mediatek/Makefile
@@ -11,3 +11,8 @@ phy-mtk-hdmi-drv-y:= phy-mtk-hdmi.o
 phy-mtk-hdmi-drv-y += phy-mtk-hdmi-mt2701.o
 phy-mtk-hdmi-drv-y += phy-mtk-hdmi-mt8173.o
 obj-$(CONFIG_PHY_MTK_HDMI) += phy-mtk-hdmi-drv.o
+
+phy-mtk-mipi-dsi-drv-y := phy-mtk-mipi-dsi.o
+phy-mtk-mipi-dsi-drv-y += phy-mtk-mipi-dsi-mt8173.o
+phy-mtk-mipi-dsi-drv-y += phy-mtk-mipi-dsi-mt8183.o
+obj-$(CONFIG_PHY_MTK_MIPI_DSI) += phy-mtk-mipi-dsi-drv.o
diff --git a/drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c 
b/drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8173.c
similarity index 99%
rename from drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c
rename to drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8173.c
index f18db14d8b63..7a847954594f 100644
--- a/drivers/gpu/drm/mediatek/mtk_mt8173_mipi_tx.c
+++ b/drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8173.c
@@ -4,7 +4,7 @@
  * Author: jitao.shi 
  */
 
-#include "mtk_mipi_tx.h"
+#include "phy-mtk-mipi-dsi.h"
 
 #define MIPITX_DSI_CON 0x00
 #define RG_DSI_LDOCORE_EN  BIT(0)
diff --git a/drivers/gpu/drm/mediatek/mtk_mt8183_mipi_tx.c 
b/drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8183.c
similarity index 99%
rename from drivers/gpu/drm/mediatek/mtk_mt8183_mipi_tx.c
rename to drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8183.c
index 9f3e55aeebb2..99108426d57c 100644
--- a/drivers/gpu/drm/mediatek/mtk_mt8183_mipi_tx.c
+++ b/drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8183.c
@@ -4,7 +4,7 @@
  * Author: jitao.shi 
  */
 
-#include "mtk_mipi_tx.h"
+#include "phy-mtk-mipi-dsi.h"
 
 #define MIPITX_LANE_CON0x000c
 #define RG_DSI_CPHY_T1DRV_EN   BIT(0)
diff --git a/drivers/gpu/drm/mediatek/mtk_mipi_tx.c 
b/drivers/phy/mediatek/phy-mtk-mipi-dsi.c
similarity index 99%
rename from drivers/gpu/drm/mediatek/mtk_mipi_tx.c
rename to drivers/phy/mediatek/phy-mtk-mipi-dsi.c
index f2a892e16c27..18c481251f04 100644
--- 

[RESEND PATCH 3/3] MAINTAINERS: add files for Mediatek DRM drivers

2020-11-16 Thread Chun-Kuang Hu
Mediatek MIPI DSI phy driver is moved from drivers/gpu/drm/mediatek to
drivers/phy/mediatek, so add the new folder to the Mediatek DRM drivers'
information.

Signed-off-by: Chun-Kuang Hu 
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index e73636b75f29..14f5018c01b6 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5867,6 +5867,7 @@ S:Supported
 F: Documentation/devicetree/bindings/display/mediatek/
 F: drivers/gpu/drm/mediatek/
 F: drivers/phy/mediatek/phy-mtk-hdmi*
+F: drivers/phy/mediatek/phy-mtk-mipi*
 
 DRM DRIVERS FOR NVIDIA TEGRA
 M: Thierry Reding 
-- 
2.17.1

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


[RESEND PATCH 0/3] Move Mediatek MIPI DSI PHY driver from DRM folder to PHY folder

2020-11-16 Thread Chun-Kuang Hu
mtk_mipi_dsi_phy is currently placed inside mediatek drm driver, but it's
more suitable to place a phy driver into phy driver folder, so move
mtk_mipi_dsi_phy driver into phy driver folder.

Chun-Kuang Hu (3):
  drm/mediatek: Separate mtk_mipi_tx to an independent module
  phy: mediatek: Move mtk_mipi_dsi_phy driver into drivers/phy/mediatek
folder
  MAINTAINERS: add files for Mediatek DRM drivers

 MAINTAINERS| 1 +
 drivers/gpu/drm/mediatek/Kconfig   | 1 +
 drivers/gpu/drm/mediatek/Makefile  | 3 ---
 drivers/gpu/drm/mediatek/mtk_drm_drv.c | 1 -
 drivers/gpu/drm/mediatek/mtk_drm_drv.h | 1 -
 drivers/phy/mediatek/Kconfig   | 7 +++
 drivers/phy/mediatek/Makefile  | 5 +
 .../mediatek/phy-mtk-mipi-dsi-mt8173.c}| 2 +-
 .../mediatek/phy-mtk-mipi-dsi-mt8183.c}| 2 +-
 .../mtk_mipi_tx.c => phy/mediatek/phy-mtk-mipi-dsi.c}  | 5 -
 .../mtk_mipi_tx.h => phy/mediatek/phy-mtk-mipi-dsi.h}  | 0
 11 files changed, 20 insertions(+), 8 deletions(-)
 rename drivers/{gpu/drm/mediatek/mtk_mt8173_mipi_tx.c => 
phy/mediatek/phy-mtk-mipi-dsi-mt8173.c} (99%)
 rename drivers/{gpu/drm/mediatek/mtk_mt8183_mipi_tx.c => 
phy/mediatek/phy-mtk-mipi-dsi-mt8183.c} (99%)
 rename drivers/{gpu/drm/mediatek/mtk_mipi_tx.c => 
phy/mediatek/phy-mtk-mipi-dsi.c} (97%)
 rename drivers/{gpu/drm/mediatek/mtk_mipi_tx.h => 
phy/mediatek/phy-mtk-mipi-dsi.h} (100%)

-- 
2.17.1

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


Re: [PATCH 29/42] drm/selftests/test-drm_dp_mst_helper: Place 'struct drm_dp_sideband_msg_req_body' onto the heap

2020-11-16 Thread Lyude Paul
Huh-could have sworn I had reviewed this one already.

Reviewed-by: Lyude Paul 

On Mon, 2020-11-16 at 17:40 +, Lee Jones wrote:
> The stack is too full.
> 
> Fixes the following W=1 kernel build warning(s):
> 
>  drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c: In function
> ‘sideband_msg_req_encode_decode’:
>  drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c:161:1: warning: the
> frame size of 1176 bytes is larger than 1024 bytes [-Wframe-larger-than=]
> 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: Lyude Paul 
> Cc: David Francis 
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 
> ---
>  .../drm/selftests/test-drm_dp_mst_helper.c    | 31 ---
>  1 file changed, 20 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c
> b/drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c
> index 1d696ec001cff..e00bdc557f880 100644
> --- a/drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c
> +++ b/drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c
> @@ -120,44 +120,53 @@ sideband_msg_req_equal(const struct
> drm_dp_sideband_msg_req_body *in,
>  static bool
>  sideband_msg_req_encode_decode(struct drm_dp_sideband_msg_req_body *in)
>  {
> -   struct drm_dp_sideband_msg_req_body out = {0};
> +   struct drm_dp_sideband_msg_req_body *out;
> struct drm_printer p = drm_err_printer(PREFIX_STR);
> struct drm_dp_sideband_msg_tx txmsg;
> int i, ret;
> +   bool result = true;
> +
> +   out = kzalloc(sizeof(*out), GFP_KERNEL);
> +   if (!out)
> +   return false;
>  
> drm_dp_encode_sideband_req(in, );
> -   ret = drm_dp_decode_sideband_req(, );
> +   ret = drm_dp_decode_sideband_req(, out);
> if (ret < 0) {
> drm_printf(, "Failed to decode sideband request: %d\n",
>    ret);
> -   return false;
> +   result = false;
> +   goto out;
> }
>  
> -   if (!sideband_msg_req_equal(in, )) {
> +   if (!sideband_msg_req_equal(in, out)) {
> drm_printf(, "Encode/decode failed, expected:\n");
> drm_dp_dump_sideband_msg_req_body(in, 1, );
> drm_printf(, "Got:\n");
> -   drm_dp_dump_sideband_msg_req_body(, 1, );
> -   return false;
> +   drm_dp_dump_sideband_msg_req_body(out, 1, );
> +   result = false;
> +   goto out;
> }
>  
> switch (in->req_type) {
> case DP_REMOTE_DPCD_WRITE:
> -   kfree(out.u.dpcd_write.bytes);
> +   kfree(out->u.dpcd_write.bytes);
> break;
> case DP_REMOTE_I2C_READ:
> -   for (i = 0; i < out.u.i2c_read.num_transactions; i++)
> -   kfree(out.u.i2c_read.transactions[i].bytes);
> +   for (i = 0; i < out->u.i2c_read.num_transactions; i++)
> +   kfree(out->u.i2c_read.transactions[i].bytes);
> break;
> case DP_REMOTE_I2C_WRITE:
> -   kfree(out.u.i2c_write.bytes);
> +   kfree(out->u.i2c_write.bytes);
> break;
> }
>  
> /* Clear everything but the req_type for the input */
> memset(>u, 0, sizeof(in->u));
>  
> -   return true;
> +out:
> +   kfree(out);
> +   return result;
>  }
>  
>  int igt_dp_mst_sideband_msg_req_decode(void *unused)

-- 
Cheers,
 Lyude Paul (she/her)
 Software Engineer at Red Hat

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


Re: [PATCH 08/10] drm/fb-helper: Restore damage area upon errors

2020-11-16 Thread Daniel Vetter
On Mon, Nov 16, 2020 at 09:04:35PM +0100, Thomas Zimmermann wrote:
> If the damage handling fails, restore the damage area. The next invocation
> of the damage worker will then perform the update.
> 
> Signed-off-by: Thomas Zimmermann 
> ---
>  drivers/gpu/drm/drm_fb_helper.c | 23 ---
>  1 file changed, 20 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index 2e1a335bafd2..13b65dad2ca8 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -431,11 +431,28 @@ static void drm_fb_helper_damage_work(struct 
> work_struct *work)
>   if (helper->buffer) {
>   ret = drm_fb_helper_damage_blit(helper, _copy);
>   if (ret)
> - return;
> + goto err;
>   }
>  
> - if (helper->fb->funcs->dirty)
> - helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, _copy, 1);
> + if (helper->fb->funcs->dirty) {
> + ret = helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, 
> _copy, 1);
> + if (ret)
> + goto err;

I think this is unexpected enough that we should put some drm error
printing here I think.
-Daniel

> + }
> +
> + return;
> +
> +err:
> + /*
> +  * Restore damage clip rectangle on errors. Next instance of damage
> +  * worker will perform the update.
> +  */
> + spin_lock_irqsave(>damage_lock, flags);
> + clip->x1 = min_t(u32, clip->x1, clip_copy.x1);
> + clip->y1 = min_t(u32, clip->y1, clip_copy.y1);
> + clip->x2 = max_t(u32, clip->x2, clip_copy.x2);
> + clip->y2 = max_t(u32, clip->y2, clip_copy.y2);
> + spin_unlock_irqrestore(>damage_lock, flags);
>  }
>  
>  /**
> -- 
> 2.29.2
> 

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


Re: [PATCH 01/42] drm/amd/amdgpu/atombios_encoders: Remove set but unused variable 'backlight_level'

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:41 PM Lee Jones  wrote:
>
> Also removing the call to 
> amdgpu_atombios_encoder_get_backlight_level_from_reg()
> since, according to Alex Deucher, "We call it again below indirectly".
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/amd/amdgpu/atombios_encoders.c: In function 
> ‘amdgpu_atombios_encoder_init_backlight’:
>  drivers/gpu/drm/amd/amdgpu/atombios_encoders.c:174:5: warning: variable 
> ‘backlight_level’ set but not used [-Wunused-but-set-variable]
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: Luben Tuikov 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/amd/amdgpu/atombios_encoders.c | 3 ---
>  1 file changed, 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c 
> b/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c
> index fa817ebff9804..6134ed9640279 100644
> --- a/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c
> +++ b/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c
> @@ -171,7 +171,6 @@ void amdgpu_atombios_encoder_init_backlight(struct 
> amdgpu_encoder *amdgpu_encode
> struct backlight_properties props;
> struct amdgpu_backlight_privdata *pdata;
> struct amdgpu_encoder_atom_dig *dig;
> -   u8 backlight_level;
> char bl_name[16];
>
> /* Mac laptops with multiple GPUs use the gmux driver for backlight
> @@ -207,8 +206,6 @@ void amdgpu_atombios_encoder_init_backlight(struct 
> amdgpu_encoder *amdgpu_encode
>
> pdata->encoder = amdgpu_encoder;
>
> -   backlight_level = 
> amdgpu_atombios_encoder_get_backlight_level_from_reg(adev);
> -
> dig = amdgpu_encoder->enc_priv;
> dig->bl_dev = bd;
>
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 43/43] drm/radeon/radeon_drv: Move 'radeon_gem_prime_import_sg_table()'s prototype to shared header

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:38 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/radeon_prime.c:43:24: warning: no previous prototype 
> for ‘radeon_gem_prime_import_sg_table’ [-Wmissing-prototypes]
>  43 | struct drm_gem_object *radeon_gem_prime_import_sg_table(struct 
> drm_device *dev,
>  | ^~~~
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: Gareth Hughes 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/radeon_drv.c   | 4 +---
>  drivers/gpu/drm/radeon/radeon_prime.h | 3 +++
>  2 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c 
> b/drivers/gpu/drm/radeon/radeon_drv.c
> index 211932d73b191..7a0989b397da1 100644
> --- a/drivers/gpu/drm/radeon/radeon_drv.c
> +++ b/drivers/gpu/drm/radeon/radeon_drv.c
> @@ -55,6 +55,7 @@
>  #include "radeon_ttm.h"
>  #include "radeon.h"
>  #include "radeon_device.h"
> +#include "radeon_prime.h"
>
>  /*
>   * KMS wrapper.
> @@ -129,9 +130,6 @@ int radeon_mode_dumb_mmap(struct drm_file *filp,
>  int radeon_mode_dumb_create(struct drm_file *file_priv,
> struct drm_device *dev,
> struct drm_mode_create_dumb *args);
> -struct drm_gem_object *radeon_gem_prime_import_sg_table(struct drm_device 
> *dev,
> -   struct 
> dma_buf_attachment *,
> -   struct sg_table *sg);
>
>  /* atpx handler */
>  #if defined(CONFIG_VGA_SWITCHEROO)
> diff --git a/drivers/gpu/drm/radeon/radeon_prime.h 
> b/drivers/gpu/drm/radeon/radeon_prime.h
> index 11b7f80987834..24ddfd4b48a6d 100644
> --- a/drivers/gpu/drm/radeon/radeon_prime.h
> +++ b/drivers/gpu/drm/radeon/radeon_prime.h
> @@ -35,5 +35,8 @@ int radeon_gem_prime_pin(struct drm_gem_object *obj);
>  void radeon_gem_prime_unpin(struct drm_gem_object *obj);
>  void *radeon_gem_prime_vmap(struct drm_gem_object *obj);
>  void radeon_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr);
> +struct drm_gem_object *radeon_gem_prime_import_sg_table(struct drm_device 
> *dev,
> +   struct 
> dma_buf_attachment *,
> +   struct sg_table *sg);
>
>  #endif /* __RADEON_PRIME_H__ */
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 10/10] drm/fb-helper: Acquire modeset lock around shadow-buffer flushing

2020-11-16 Thread Daniel Vetter
On Mon, Nov 16, 2020 at 09:04:37PM +0100, Thomas Zimmermann wrote:
> Flushing the fbdev's shadow buffer requires vmap'ing the BO memory, which
> in turn requires pinning the BO. While being pinned, the BO cannot be moved
> into VRAM for scanout. Consequently, a concurrent modeset operation that
> involves the fbdev framebuffer would likely fail.
> 
> Resolve this problem be acquiring the modeset lock of the planes that use
> the fbdev framebuffer. On non-atomic drivers, also acquire the mode-config
> lock. This serializes the flushing of the framebuffer with concurrent
> modeset operations.
> 
> Signed-off-by: Thomas Zimmermann 

I think this is the wrong lock. What you want is the buffer lock, the
dma_resv lock of the underlying gem_bo underneath the fb we have. And hold
that from _vmap to the end of _vunmap.

Unfortuantely that's going to be one nasty refactoring adventure :-/

So I think for plan B we need something nasty like this, but this here has
disadvantage that fbdev activity in the background can seriously hurt the
native kms client (despite that you're trying to filter a bit, you're
creating a big lock across all planes and we've really worked hard to make
those stand-alone as much as possible).

I think we can do better here, since we're only worried about modesets
from fbdev itself. Nothing else needs to be able to pull the buffer from
system memory into vram while we have it pinned here.

Holding mutex_lock(fb_helper->lock) here instead, with a big comment
explaining why that's enough, and that the clean fix would be holding the
dma_resv_lock, should  do the trick.
-Daniel

> ---
>  drivers/gpu/drm/drm_fb_helper.c | 43 +++--
>  1 file changed, 41 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index 5a22c744378c..af485c71a42a 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -394,20 +394,59 @@ static void drm_fb_helper_damage_blit_real(struct 
> drm_fb_helper *fb_helper,
>  static int drm_fb_helper_damage_blit(struct drm_fb_helper *fb_helper,
>struct drm_clip_rect *clip)
>  {
> + struct drm_device *dev = fb_helper->dev;
> + struct drm_framebuffer *fb = fb_helper->fb;
>   struct drm_client_buffer *buffer = fb_helper->buffer;
> + struct drm_modeset_acquire_ctx ctx;
> + struct drm_framebuffer *plane_fb;
> + struct drm_plane *plane;
>   struct dma_buf_map map, dst;
>   int ret;
>  
> + if (!drm_drv_uses_atomic_modeset(dev))
> + mutex_lock(>mode_config.mutex);
> +
> + drm_modeset_acquire_init(, 0);
> +
> +retry:
> + drm_for_each_plane(plane, dev) {
> + ret = drm_modeset_lock(>mutex, );
> + if (ret == -EDEADLK) {
> + ret = drm_modeset_backoff();
> + if (!ret)
> + goto retry;
> + } else if (ret) {
> + goto out;
> + }
> +
> + if (drm_drv_uses_atomic_modeset(dev))
> + plane_fb = plane->state->fb;
> + else
> + plane_fb = plane->fb;
> +
> + if (plane_fb != fb) {
> + drm_modeset_unlock(>mutex);
> + continue;
> + }
> + }
> +
>   ret = drm_client_buffer_vmap(buffer, );
>   if (ret)
> - return ret;
> + goto out;
>  
>   dst = map;
>   drm_fb_helper_damage_blit_real(fb_helper, clip, );
>  
>   drm_client_buffer_vunmap(buffer);
>  
> - return 0;
> +out:
> + drm_modeset_drop_locks();
> + drm_modeset_acquire_fini();
> +
> + if (!drm_drv_uses_atomic_modeset(dev))
> + mutex_unlock(>mode_config.mutex);
> +
> + return ret;
>  }
>  
>  static void drm_fb_helper_damage_work(struct work_struct *work)
> -- 
> 2.29.2
> 

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


Re: [PATCH 42/43] drm/radeon/radeon_audio: Move 'r600_*' prototypes into shared header

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:38 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/r600_hdmi.c:177:6: warning: no previous prototype for 
> ‘r600_hdmi_update_acr’ [-Wmissing-prototypes]
>  177 | void r600_hdmi_update_acr(struct drm_encoder *encoder, long offset,
>  | ^~~~
>  drivers/gpu/drm/radeon/r600_hdmi.c:217:6: warning: no previous prototype for 
> ‘r600_set_avi_packet’ [-Wmissing-prototypes]
>  217 | void r600_set_avi_packet(struct radeon_device *rdev, u32 offset,
>  | ^~~
>  drivers/gpu/drm/radeon/r600_hdmi.c:314:6: warning: no previous prototype for 
> ‘r600_hdmi_audio_set_dto’ [-Wmissing-prototypes]
>  314 | void r600_hdmi_audio_set_dto(struct radeon_device *rdev,
>  | ^~~
>  drivers/gpu/drm/radeon/r600_hdmi.c:340:6: warning: no previous prototype for 
> ‘r600_set_vbi_packet’ [-Wmissing-prototypes]
>  340 | void r600_set_vbi_packet(struct drm_encoder *encoder, u32 offset)
>  | ^~~
>  drivers/gpu/drm/radeon/r600_hdmi.c:351:6: warning: no previous prototype for 
> ‘r600_set_audio_packet’ [-Wmissing-prototypes]
>  351 | void r600_set_audio_packet(struct drm_encoder *encoder, u32 offset)
>  | ^
>  drivers/gpu/drm/radeon/r600_hdmi.c:393:6: warning: no previous prototype for 
> ‘r600_set_mute’ [-Wmissing-prototypes]
>  393 | void r600_set_mute(struct drm_encoder *encoder, u32 offset, bool mute)
>  | ^
>  drivers/gpu/drm/radeon/r600_hdmi.c:469:6: warning: no previous prototype for 
> ‘r600_hdmi_enable’ [-Wmissing-prototypes]
>  469 | void r600_hdmi_enable(struct drm_encoder *encoder, bool enable)
>  | ^~~~
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/r600.h | 17 +
>  drivers/gpu/drm/radeon/r600_hdmi.c|  1 +
>  drivers/gpu/drm/radeon/radeon_audio.c | 13 +
>  3 files changed, 19 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/r600.h b/drivers/gpu/drm/radeon/r600.h
> index dbdff4568516b..22db13b256195 100644
> --- a/drivers/gpu/drm/radeon/r600.h
> +++ b/drivers/gpu/drm/radeon/r600.h
> @@ -30,12 +30,29 @@
>
>  struct radeon_bo_list;
>  struct radeon_cs_parser;
> +struct r600_audio_pin;
> +struct radeon_crtc;
>  struct radeon_device;
> +struct radeon_hdmi_acr;
>
>  u32 r600_gpu_check_soft_reset(struct radeon_device *rdev);
>  int r600_ih_ring_alloc(struct radeon_device *rdev);
>  void r600_ih_ring_fini(struct radeon_device *rdev);
>
> +void r600_audio_enable(struct radeon_device *rdev, struct r600_audio_pin 
> *pin,
> +  u8 enable_mask);
> +void r600_set_audio_packet(struct drm_encoder *encoder, u32 offset);
> +void r600_set_mute(struct drm_encoder *encoder, u32 offset, bool mute);
> +void r600_hdmi_audio_set_dto(struct radeon_device *rdev,
> +struct radeon_crtc *crtc, unsigned int clock);
> +void r600_set_avi_packet(struct radeon_device *rdev, u32 offset,
> +unsigned char *buffer, size_t size);
> +void r600_hdmi_update_acr(struct drm_encoder *encoder, long offset,
> + const struct radeon_hdmi_acr *acr);
> +void r600_set_vbi_packet(struct drm_encoder *encoder, u32 offset);
> +void r600_hdmi_enable(struct drm_encoder *encoder, bool enable);
> +
>  int r600_dma_cs_next_reloc(struct radeon_cs_parser *p,
>struct radeon_bo_list **cs_reloc);
> +
>  #endif /* __R600_H__ */
> diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c 
> b/drivers/gpu/drm/radeon/r600_hdmi.c
> index c09549d785b54..f3551ebaa2f08 100644
> --- a/drivers/gpu/drm/radeon/r600_hdmi.c
> +++ b/drivers/gpu/drm/radeon/r600_hdmi.c
> @@ -30,6 +30,7 @@
>  #include "radeon.h"
>  #include "radeon_asic.h"
>  #include "radeon_audio.h"
> +#include "r600.h"
>  #include "r600d.h"
>  #include "atom.h"
>
> diff --git a/drivers/gpu/drm/radeon/radeon_audio.c 
> b/drivers/gpu/drm/radeon/radeon_audio.c
> index 785c23cb30589..7c5e80d03fc90 100644
> --- a/drivers/gpu/drm/radeon/radeon_audio.c
> +++ b/drivers/gpu/drm/radeon/radeon_audio.c
> @@ -29,28 +29,17 @@
>  #include "evergreen_hdmi.h"
>  #include "radeon.h"
>  #include "atom.h"
> +#include "r600.h"
>  #include "radeon_audio.h"
>
> -void r600_audio_enable(struct radeon_device *rdev, struct r600_audio_pin 
> *pin,
> -   u8 enable_mask);
>  void dce6_audio_enable(struct radeon_device *rdev, struct r600_audio_pin 
> *pin,
> u8 enable_mask);
>  struct r600_audio_pin* r600_audio_get_pin(struct radeon_device *rdev);
>  struct r600_audio_pin* dce6_audio_get_pin(struct radeon_device *rdev);
> -void r600_hdmi_audio_set_dto(struct radeon_device *rdev,
> -   struct radeon_crtc *crtc, unsigned int clock);
> -void 

Re: [PATCH 41/43] drm/radeon/evergreen_cs: Move 'r600_dma_cs_next_reloc()'s prototype to shared header

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:38 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/r600_cs.c:2343:5: warning: no previous prototype for 
> ‘r600_dma_cs_next_reloc’ [-Wmissing-prototypes]
>  2343 | int r600_dma_cs_next_reloc(struct radeon_cs_parser *p,
>  | ^~
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/evergreen_cs.c | 3 +--
>  drivers/gpu/drm/radeon/r600.h | 4 
>  drivers/gpu/drm/radeon/r600_cs.c  | 1 +
>  3 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c 
> b/drivers/gpu/drm/radeon/evergreen_cs.c
> index 53b75cf201958..0de79f3a7e3ff 100644
> --- a/drivers/gpu/drm/radeon/evergreen_cs.c
> +++ b/drivers/gpu/drm/radeon/evergreen_cs.c
> @@ -28,6 +28,7 @@
>
>  #include "radeon.h"
>  #include "radeon_asic.h"
> +#include "r600.h"
>  #include "evergreend.h"
>  #include "evergreen_reg_safe.h"
>  #include "cayman_reg_safe.h"
> @@ -37,8 +38,6 @@
>
>  #define REG_SAFE_BM_SIZE ARRAY_SIZE(evergreen_reg_safe_bm)
>
> -int r600_dma_cs_next_reloc(struct radeon_cs_parser *p,
> -  struct radeon_bo_list **cs_reloc);
>  struct evergreen_cs_track {
> u32 group_size;
> u32 nbanks;
> diff --git a/drivers/gpu/drm/radeon/r600.h b/drivers/gpu/drm/radeon/r600.h
> index e66ef58706cd8..dbdff4568516b 100644
> --- a/drivers/gpu/drm/radeon/r600.h
> +++ b/drivers/gpu/drm/radeon/r600.h
> @@ -28,10 +28,14 @@
>  #ifndef __R600_H__
>  #define __R600_H__
>
> +struct radeon_bo_list;
> +struct radeon_cs_parser;
>  struct radeon_device;
>
>  u32 r600_gpu_check_soft_reset(struct radeon_device *rdev);
>  int r600_ih_ring_alloc(struct radeon_device *rdev);
>  void r600_ih_ring_fini(struct radeon_device *rdev);
>
> +int r600_dma_cs_next_reloc(struct radeon_cs_parser *p,
> +  struct radeon_bo_list **cs_reloc);
>  #endif /* __R600_H__ */
> diff --git a/drivers/gpu/drm/radeon/r600_cs.c 
> b/drivers/gpu/drm/radeon/r600_cs.c
> index f20b619466816..dc68e538d5a97 100644
> --- a/drivers/gpu/drm/radeon/r600_cs.c
> +++ b/drivers/gpu/drm/radeon/r600_cs.c
> @@ -29,6 +29,7 @@
>
>  #include "radeon.h"
>  #include "radeon_asic.h"
> +#include "r600.h"
>  #include "r600d.h"
>  #include "r600_reg_safe.h"
>
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 40/43] drm/radeon/cik: Move 'vce_v2_0_enable_mgcg()'s prototype to shared header

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:38 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/vce_v2_0.c:111:6: warning: no previous prototype for 
> ‘vce_v2_0_enable_mgcg’ [-Wmissing-prototypes]
>  111 | void vce_v2_0_enable_mgcg(struct radeon_device *rdev, bool enable)
>  | ^~~~
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: Sumit Semwal 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Cc: linux-me...@vger.kernel.org
> Cc: linaro-mm-...@lists.linaro.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/cik.c  | 2 +-
>  drivers/gpu/drm/radeon/vce.h  | 1 +
>  drivers/gpu/drm/radeon/vce_v2_0.c | 1 +
>  3 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
> index 2af76463906ad..8b7a4f7b75766 100644
> --- a/drivers/gpu/drm/radeon/cik.c
> +++ b/drivers/gpu/drm/radeon/cik.c
> @@ -41,6 +41,7 @@
>  #include "radeon_audio.h"
>  #include "radeon_ucode.h"
>  #include "si.h"
> +#include "vce.h"
>
>  #define SH_MEM_CONFIG_GFX_DEFAULT \
> ALIGNMENT_MODE(SH_MEM_ALIGNMENT_MODE_UNALIGNED)
> @@ -129,7 +130,6 @@ MODULE_FIRMWARE("radeon/mullins_rlc.bin");
>  MODULE_FIRMWARE("radeon/mullins_sdma.bin");
>
>  static u32 cik_get_cu_active_bitmap(struct radeon_device *rdev, u32 se, u32 
> sh);
> -extern void vce_v2_0_enable_mgcg(struct radeon_device *rdev, bool enable);
>  static void cik_rlc_stop(struct radeon_device *rdev);
>  static void cik_pcie_gen3_enable(struct radeon_device *rdev);
>  static void cik_program_aspm(struct radeon_device *rdev);
> diff --git a/drivers/gpu/drm/radeon/vce.h b/drivers/gpu/drm/radeon/vce.h
> index 1eb4f5715202e..ccc9c00f0d02c 100644
> --- a/drivers/gpu/drm/radeon/vce.h
> +++ b/drivers/gpu/drm/radeon/vce.h
> @@ -30,5 +30,6 @@
>  struct radeon_device;
>
>  void vce_v1_0_enable_mgcg(struct radeon_device *rdev, bool enable);
> +void vce_v2_0_enable_mgcg(struct radeon_device *rdev, bool enable);
>
>  #endif /* __VCE_H__ */
> diff --git a/drivers/gpu/drm/radeon/vce_v2_0.c 
> b/drivers/gpu/drm/radeon/vce_v2_0.c
> index d6fde3659e65f..163c9bfc03da8 100644
> --- a/drivers/gpu/drm/radeon/vce_v2_0.c
> +++ b/drivers/gpu/drm/radeon/vce_v2_0.c
> @@ -30,6 +30,7 @@
>  #include "radeon.h"
>  #include "radeon_asic.h"
>  #include "cikd.h"
> +#include "vce.h"
>
>  #define VCE_V2_0_FW_SIZE   (256 * 1024)
>  #define VCE_V2_0_STACK_SIZE(64 * 1024)
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 1/8] drm: Add dummy page per device or GEM object

2020-11-16 Thread Andrey Grodzovsky


On 11/16/20 3:36 PM, Christian König wrote:

Am 16.11.20 um 20:00 schrieb Andrey Grodzovsky:


On 11/16/20 4:48 AM, Christian König wrote:

Am 15.11.20 um 07:34 schrieb Andrey Grodzovsky:


On 11/14/20 4:51 AM, Daniel Vetter wrote:

On Sat, Nov 14, 2020 at 9:41 AM Christian König
 wrote:

Am 13.11.20 um 21:52 schrieb Andrey Grodzovsky:

On 6/22/20 1:50 PM, Daniel Vetter wrote:

On Mon, Jun 22, 2020 at 7:45 PM Christian König
 wrote:

Am 22.06.20 um 16:32 schrieb Andrey Grodzovsky:

On 6/22/20 9:18 AM, Christian König wrote:

Am 21.06.20 um 08:03 schrieb Andrey Grodzovsky:

Will be used to reroute CPU mapped BO's page faults once
device is removed.

Signed-off-by: Andrey Grodzovsky 
---
    drivers/gpu/drm/drm_file.c  |  8 
    drivers/gpu/drm/drm_prime.c | 10 ++
    include/drm/drm_file.h  |  2 ++
    include/drm/drm_gem.h   |  2 ++
    4 files changed, 22 insertions(+)

diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c
index c4c704e..67c0770 100644
--- a/drivers/gpu/drm/drm_file.c
+++ b/drivers/gpu/drm/drm_file.c
@@ -188,6 +188,12 @@ struct drm_file *drm_file_alloc(struct
drm_minor *minor)
    goto out_prime_destroy;
    }
    +    file->dummy_page = alloc_page(GFP_KERNEL | __GFP_ZERO);
+    if (!file->dummy_page) {
+    ret = -ENOMEM;
+    goto out_prime_destroy;
+    }
+
    return file;
  out_prime_destroy:
@@ -284,6 +290,8 @@ void drm_file_free(struct drm_file *file)
    if (dev->driver->postclose)
dev->driver->postclose(dev, file);
    +    __free_page(file->dummy_page);
+
drm_prime_destroy_file_private(>prime);
WARN_ON(!list_empty(>event_list));
diff --git a/drivers/gpu/drm/drm_prime.c
b/drivers/gpu/drm/drm_prime.c
index 1de2cde..c482e9c 100644
--- a/drivers/gpu/drm/drm_prime.c
+++ b/drivers/gpu/drm/drm_prime.c
@@ -335,6 +335,13 @@ int drm_gem_prime_fd_to_handle(struct
drm_device *dev,
  ret = drm_prime_add_buf_handle(_priv->prime,
    dma_buf, *handle);
+
+    if (!ret) {
+    obj->dummy_page = alloc_page(GFP_KERNEL | __GFP_ZERO);
+    if (!obj->dummy_page)
+    ret = -ENOMEM;
+    }
+

While the per file case still looks acceptable this is a clear NAK
since it will massively increase the memory needed for a prime
exported object.

I think that this is quite overkill in the first place and for the
hot unplug case we can just use the global dummy page as well.

Christian.

Global dummy page is good for read access, what do you do on write
access ? My first approach was indeed to map at first global dummy
page as read only and mark the vma->vm_flags as !VM_SHARED assuming
that this would trigger Copy On Write flow in core mm
(https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Felixir.bootlin.com%2Flinux%2Fv5.7-rc7%2Fsource%2Fmm%2Fmemory.c%23L3977data=04%7C01%7CAndrey.Grodzovsky%40amd.com%7C00053e9d983041ed63ae08d2ed87%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637409443224016377%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000sdata=kghiG3VpCJod6YefExoDVPl9X03zNhw3SN5GAxgbnmU%3Dreserved=0) 



on the next page fault to same address triggered by a write access but
then i realized a new COW page will be allocated for each such mapping
and this is much more wasteful then having a dedicated page per GEM
object.

Yeah, but this is only for a very very small corner cases. What we need
to prevent is increasing the memory usage during normal operation to
much.

Using memory during the unplug is completely unproblematic because we
just released quite a bunch of it by releasing all those system memory
buffers.

And I'm pretty sure that COWed pages are correctly accounted towards
the
used memory of a process.

So I think if that approach works as intended and the COW pages are
released again on unmapping it would be the perfect solution to the
problem.

Daniel what do you think?

If COW works, sure sounds reasonable. And if we can make sure we
managed to drop all the system allocations (otherwise suddenly 2x
memory usage, worst case). But I have no idea whether we can
retroshoehorn that into an established vma, you might have fun stuff
like a mkwrite handler there (which I thought is the COW handler
thing, but really no idea).

If we need to massively change stuff then I think rw dummy page,
allocated on first fault after hotunplug (maybe just make it one per
object, that's simplest) seems like the much safer option. Much less
code that can go wrong.
-Daniel


Regarding COW, i was looking into how to properly implement it from
within the fault handler (i.e. ttm_bo_vm_fault)
and the main obstacle I hit is that of exclusive access to the
vm_area_struct, i need to be able to modify
vma->vm_flags (and vm_page_prot)  to remove VM_SHARED bit so COW can
be triggered on subsequent write access
fault (here

Re: [PATCH 39/43] drm/radeon/si_dpm: Move 'vce_v1_0_enable_mgcg()'s prototype to shared header

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:38 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/vce_v1_0.c:102:6: warning: no previous prototype for 
> ‘vce_v1_0_enable_mgcg’ [-Wmissing-prototypes]
>  102 | void vce_v1_0_enable_mgcg(struct radeon_device *rdev, bool enable)
>  | ^~~~
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/si_dpm.c  |  3 +--
>  drivers/gpu/drm/radeon/trinity_dpm.c |  2 +-
>  drivers/gpu/drm/radeon/vce.h | 34 
>  drivers/gpu/drm/radeon/vce_v1_0.c|  1 +
>  4 files changed, 37 insertions(+), 3 deletions(-)
>  create mode 100644 drivers/gpu/drm/radeon/vce.h
>
> diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c
> index b4581392fbce9..cd07b06301b44 100644
> --- a/drivers/gpu/drm/radeon/si_dpm.c
> +++ b/drivers/gpu/drm/radeon/si_dpm.c
> @@ -35,6 +35,7 @@
>  #include "si_dpm.h"
>  #include "si.h"
>  #include "sid.h"
> +#include "vce.h"
>
>  #define MC_CG_ARB_FREQ_F0   0x0a
>  #define MC_CG_ARB_FREQ_F1   0x0b
> @@ -1721,8 +1722,6 @@ static const struct si_powertune_data 
> powertune_data_hainan =
> true
>  };
>
> -extern void vce_v1_0_enable_mgcg(struct radeon_device *rdev, bool enable);
> -
>  static int si_populate_voltage_value(struct radeon_device *rdev,
>  const struct atom_voltage_table *table,
>  u16 value, SISLANDS_SMC_VOLTAGE_VALUE 
> *voltage);
> diff --git a/drivers/gpu/drm/radeon/trinity_dpm.c 
> b/drivers/gpu/drm/radeon/trinity_dpm.c
> index e005c18aac00e..08ea1c864cb23 100644
> --- a/drivers/gpu/drm/radeon/trinity_dpm.c
> +++ b/drivers/gpu/drm/radeon/trinity_dpm.c
> @@ -29,6 +29,7 @@
>  #include "radeon_asic.h"
>  #include "trinity_dpm.h"
>  #include "trinityd.h"
> +#include "vce.h"
>
>  #define TRINITY_MAX_DEEPSLEEP_DIVIDER_ID 5
>  #define TRINITY_MINIMUM_ENGINE_CLOCK 800
> @@ -293,7 +294,6 @@ static const u32 trinity_override_mgpg_sequences[] =
> 0x0204, 0x,
>  };
>
> -extern void vce_v1_0_enable_mgcg(struct radeon_device *rdev, bool enable);
>  static void trinity_program_clk_gating_hw_sequence(struct radeon_device 
> *rdev,
>const u32 *seq, u32 count);
>  static void trinity_override_dynamic_mg_powergating(struct radeon_device 
> *rdev);
> diff --git a/drivers/gpu/drm/radeon/vce.h b/drivers/gpu/drm/radeon/vce.h
> new file mode 100644
> index 0..1eb4f5715202e
> --- /dev/null
> +++ b/drivers/gpu/drm/radeon/vce.h
> @@ -0,0 +1,34 @@
> +/* vce.h -- Private header for radeon driver -*- linux-c -*-
> + *
> + * Copyright 2013 Advanced Micro Devices, Inc.
> + * All Rights Reserved.
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the
> + * "Software"), to deal in the Software without restriction, including
> + * without limitation the rights to use, copy, modify, merge, publish,
> + * distribute, sub license, and/or sell copies of the Software, and to
> + * permit persons to whom the Software is furnished to do so, subject to
> + * the following conditions:
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
> + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY 
> CLAIM,
> + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
> + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
> + * USE OR OTHER DEALINGS IN THE SOFTWARE.
> + *
> + * The above copyright notice and this permission notice (including the
> + * next paragraph) shall be included in all copies or substantial portions
> + * of the Software.
> + */
> +
> +#ifndef __VCE_H__
> +#define __VCE_H__
> +
> +struct radeon_device;
> +
> +void vce_v1_0_enable_mgcg(struct radeon_device *rdev, bool enable);
> +
> +#endif /* __VCE_H__ */
> diff --git a/drivers/gpu/drm/radeon/vce_v1_0.c 
> b/drivers/gpu/drm/radeon/vce_v1_0.c
> index bd75bbcf5bf63..70c5da2141d75 100644
> --- a/drivers/gpu/drm/radeon/vce_v1_0.c
> +++ b/drivers/gpu/drm/radeon/vce_v1_0.c
> @@ -30,6 +30,7 @@
>  #include "radeon.h"
>  #include "radeon_asic.h"
>  #include "sid.h"
> +#include "vce.h"
>
>  #define VCE_V1_0_FW_SIZE   (256 * 1024)
>  #define VCE_V1_0_STACK_SIZE(64 * 1024)
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH 38/43] drm/radeon/cik: Move 'Move 'cik_sdma_*()'s prototypes to shared header

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:38 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/cik_sdma.c:331:6: warning: no previous prototype for 
> ‘cik_sdma_enable’ [-Wmissing-prototypes]
>  331 | void cik_sdma_enable(struct radeon_device *rdev, bool enable)
>  | ^~~
>  drivers/gpu/drm/radeon/cik_sdma.c:528:5: warning: no previous prototype for 
> ‘cik_sdma_resume’ [-Wmissing-prototypes]
>  528 | int cik_sdma_resume(struct radeon_device *rdev)
>  | ^~~
>  drivers/gpu/drm/radeon/cik_sdma.c:557:6: warning: no previous prototype for 
> ‘cik_sdma_fini’ [-Wmissing-prototypes]
>  557 | void cik_sdma_fini(struct radeon_device *rdev)
>  | ^
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: Sumit Semwal 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Cc: linux-me...@vger.kernel.org
> Cc: linaro-mm-...@lists.linaro.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/cik.c | 3 ---
>  drivers/gpu/drm/radeon/cik.h | 3 +++
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
> index cef0f3111cd3a..2af76463906ad 100644
> --- a/drivers/gpu/drm/radeon/cik.c
> +++ b/drivers/gpu/drm/radeon/cik.c
> @@ -129,9 +129,6 @@ MODULE_FIRMWARE("radeon/mullins_rlc.bin");
>  MODULE_FIRMWARE("radeon/mullins_sdma.bin");
>
>  static u32 cik_get_cu_active_bitmap(struct radeon_device *rdev, u32 se, u32 
> sh);
> -extern int cik_sdma_resume(struct radeon_device *rdev);
> -extern void cik_sdma_enable(struct radeon_device *rdev, bool enable);
> -extern void cik_sdma_fini(struct radeon_device *rdev);
>  extern void vce_v2_0_enable_mgcg(struct radeon_device *rdev, bool enable);
>  static void cik_rlc_stop(struct radeon_device *rdev);
>  static void cik_pcie_gen3_enable(struct radeon_device *rdev);
> diff --git a/drivers/gpu/drm/radeon/cik.h b/drivers/gpu/drm/radeon/cik.h
> index 420207d19de52..d1bf541da5923 100644
> --- a/drivers/gpu/drm/radeon/cik.h
> +++ b/drivers/gpu/drm/radeon/cik.h
> @@ -34,4 +34,7 @@ void cik_init_cp_pg_table(struct radeon_device *rdev);
>  u32 cik_get_csb_size(struct radeon_device *rdev);
>  void cik_get_csb_buffer(struct radeon_device *rdev, volatile u32 *buffer);
>
> +int cik_sdma_resume(struct radeon_device *rdev);
> +void cik_sdma_enable(struct radeon_device *rdev, bool enable);
> +void cik_sdma_fini(struct radeon_device *rdev);
>  #endif /* __CIK_H__ */
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 1/8] drm: Add dummy page per device or GEM object

2020-11-16 Thread Christian König

Am 16.11.20 um 20:00 schrieb Andrey Grodzovsky:


On 11/16/20 4:48 AM, Christian König wrote:

Am 15.11.20 um 07:34 schrieb Andrey Grodzovsky:


On 11/14/20 4:51 AM, Daniel Vetter wrote:

On Sat, Nov 14, 2020 at 9:41 AM Christian König
 wrote:

Am 13.11.20 um 21:52 schrieb Andrey Grodzovsky:

On 6/22/20 1:50 PM, Daniel Vetter wrote:

On Mon, Jun 22, 2020 at 7:45 PM Christian König
 wrote:

Am 22.06.20 um 16:32 schrieb Andrey Grodzovsky:

On 6/22/20 9:18 AM, Christian König wrote:

Am 21.06.20 um 08:03 schrieb Andrey Grodzovsky:

Will be used to reroute CPU mapped BO's page faults once
device is removed.

Signed-off-by: Andrey Grodzovsky 
---
    drivers/gpu/drm/drm_file.c  |  8 
    drivers/gpu/drm/drm_prime.c | 10 ++
    include/drm/drm_file.h  |  2 ++
    include/drm/drm_gem.h   |  2 ++
    4 files changed, 22 insertions(+)

diff --git a/drivers/gpu/drm/drm_file.c 
b/drivers/gpu/drm/drm_file.c

index c4c704e..67c0770 100644
--- a/drivers/gpu/drm/drm_file.c
+++ b/drivers/gpu/drm/drm_file.c
@@ -188,6 +188,12 @@ struct drm_file *drm_file_alloc(struct
drm_minor *minor)
    goto out_prime_destroy;
    }
    +    file->dummy_page = alloc_page(GFP_KERNEL | 
__GFP_ZERO);

+    if (!file->dummy_page) {
+    ret = -ENOMEM;
+    goto out_prime_destroy;
+    }
+
    return file;
  out_prime_destroy:
@@ -284,6 +290,8 @@ void drm_file_free(struct drm_file *file)
    if (dev->driver->postclose)
    dev->driver->postclose(dev, file);
    +    __free_page(file->dummy_page);
+
drm_prime_destroy_file_private(>prime);
WARN_ON(!list_empty(>event_list));
diff --git a/drivers/gpu/drm/drm_prime.c
b/drivers/gpu/drm/drm_prime.c
index 1de2cde..c482e9c 100644
--- a/drivers/gpu/drm/drm_prime.c
+++ b/drivers/gpu/drm/drm_prime.c
@@ -335,6 +335,13 @@ int drm_gem_prime_fd_to_handle(struct
drm_device *dev,
  ret = drm_prime_add_buf_handle(_priv->prime,
    dma_buf, *handle);
+
+    if (!ret) {
+    obj->dummy_page = alloc_page(GFP_KERNEL | __GFP_ZERO);
+    if (!obj->dummy_page)
+    ret = -ENOMEM;
+    }
+
While the per file case still looks acceptable this is a 
clear NAK

since it will massively increase the memory needed for a prime
exported object.

I think that this is quite overkill in the first place and 
for the

hot unplug case we can just use the global dummy page as well.

Christian.
Global dummy page is good for read access, what do you do on 
write
access ? My first approach was indeed to map at first global 
dummy
page as read only and mark the vma->vm_flags as !VM_SHARED 
assuming

that this would trigger Copy On Write flow in core mm
(https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Felixir.bootlin.com%2Flinux%2Fv5.7-rc7%2Fsource%2Fmm%2Fmemory.c%23L3977data=04%7C01%7CAndrey.Grodzovsky%40amd.com%7C00053e9d983041ed63ae08d2ed87%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637409443224016377%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000sdata=kghiG3VpCJod6YefExoDVPl9X03zNhw3SN5GAxgbnmU%3Dreserved=0) 



on the next page fault to same address triggered by a write 
access but
then i realized a new COW page will be allocated for each such 
mapping
and this is much more wasteful then having a dedicated page 
per GEM

object.
Yeah, but this is only for a very very small corner cases. What 
we need
to prevent is increasing the memory usage during normal 
operation to

much.

Using memory during the unplug is completely unproblematic 
because we
just released quite a bunch of it by releasing all those system 
memory

buffers.

And I'm pretty sure that COWed pages are correctly accounted 
towards

the
used memory of a process.

So I think if that approach works as intended and the COW pages 
are
released again on unmapping it would be the perfect solution to 
the

problem.

Daniel what do you think?

If COW works, sure sounds reasonable. And if we can make sure we
managed to drop all the system allocations (otherwise suddenly 2x
memory usage, worst case). But I have no idea whether we can
retroshoehorn that into an established vma, you might have fun 
stuff

like a mkwrite handler there (which I thought is the COW handler
thing, but really no idea).

If we need to massively change stuff then I think rw dummy page,
allocated on first fault after hotunplug (maybe just make it one 
per
object, that's simplest) seems like the much safer option. Much 
less

code that can go wrong.
-Daniel


Regarding COW, i was looking into how to properly implement it from
within the fault handler (i.e. ttm_bo_vm_fault)
and the main obstacle I hit is that of exclusive access to the
vm_area_struct, i need to be able to modify
vma->vm_flags (and vm_page_prot)  to remove VM_SHARED bit so COW can
be triggered on subsequent write access
fault (here

Re: [PATCH 33/42] drm/ttm/ttm_range_manager: Demote non-conformant kernel-doc header

2020-11-16 Thread Christian König

Am 16.11.20 um 18:41 schrieb Lee Jones:

Fixes the following W=1 kernel build warning(s):

  drivers/gpu/drm/ttm/ttm_range_manager.c:46: warning: cannot understand 
function prototype: 'struct ttm_range_manager '

Cc: Christian Koenig 
Cc: Huang Rui 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Lee Jones 


Reviewed-by: Christian König 


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

diff --git a/drivers/gpu/drm/ttm/ttm_range_manager.c 
b/drivers/gpu/drm/ttm/ttm_range_manager.c
index ea77919569a2e..e0952444cea93 100644
--- a/drivers/gpu/drm/ttm/ttm_range_manager.c
+++ b/drivers/gpu/drm/ttm/ttm_range_manager.c
@@ -37,7 +37,7 @@
  #include 
  #include 
  
-/**

+/*
   * Currently we use a spinlock for the lock, but a mutex *may* be
   * more appropriate to reduce scheduling latency if the range manager
   * ends up with very fragmented allocation patterns.


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


Re: [PATCH 31/42] drm/ttm/ttm_bo: Fix one function header - demote lots of kernel-doc abuses

2020-11-16 Thread Christian König

Am 16.11.20 um 18:41 schrieb Lee Jones:

Fixes the following W=1 kernel build warning(s):

  drivers/gpu/drm/ttm/ttm_bo.c:51: warning: Function parameter or member 
'ttm_global_mutex' not described in 'DEFINE_MUTEX'
  drivers/gpu/drm/ttm/ttm_bo.c:286: warning: Function parameter or member 'bo' 
not described in 'ttm_bo_cleanup_memtype_use'
  drivers/gpu/drm/ttm/ttm_bo.c:359: warning: Function parameter or member 'bo' 
not described in 'ttm_bo_cleanup_refs'
  drivers/gpu/drm/ttm/ttm_bo.c:359: warning: Function parameter or member 
'interruptible' not described in 'ttm_bo_cleanup_refs'
  drivers/gpu/drm/ttm/ttm_bo.c:359: warning: Function parameter or member 
'no_wait_gpu' not described in 'ttm_bo_cleanup_refs'
  drivers/gpu/drm/ttm/ttm_bo.c:359: warning: Function parameter or member 
'unlock_resv' not described in 'ttm_bo_cleanup_refs'
  drivers/gpu/drm/ttm/ttm_bo.c:424: warning: Function parameter or member 
'bdev' not described in 'ttm_bo_delayed_delete'
  drivers/gpu/drm/ttm/ttm_bo.c:424: warning: Function parameter or member 
'remove_all' not described in 'ttm_bo_delayed_delete'
  drivers/gpu/drm/ttm/ttm_bo.c:635: warning: Function parameter or member 'bo' 
not described in 'ttm_bo_evict_swapout_allowable'
  drivers/gpu/drm/ttm/ttm_bo.c:635: warning: Function parameter or member 'ctx' 
not described in 'ttm_bo_evict_swapout_allowable'
  drivers/gpu/drm/ttm/ttm_bo.c:635: warning: Function parameter or member 
'locked' not described in 'ttm_bo_evict_swapout_allowable'
  drivers/gpu/drm/ttm/ttm_bo.c:635: warning: Function parameter or member 
'busy' not described in 'ttm_bo_evict_swapout_allowable'
  drivers/gpu/drm/ttm/ttm_bo.c:769: warning: Function parameter or member 'bo' 
not described in 'ttm_bo_add_move_fence'
  drivers/gpu/drm/ttm/ttm_bo.c:769: warning: Function parameter or member 'man' 
not described in 'ttm_bo_add_move_fence'
  drivers/gpu/drm/ttm/ttm_bo.c:769: warning: Function parameter or member 'mem' 
not described in 'ttm_bo_add_move_fence'
  drivers/gpu/drm/ttm/ttm_bo.c:769: warning: Function parameter or member 
'no_wait_gpu' not described in 'ttm_bo_add_move_fence'
  drivers/gpu/drm/ttm/ttm_bo.c:806: warning: Function parameter or member 'bo' 
not described in 'ttm_bo_mem_force_space'
  drivers/gpu/drm/ttm/ttm_bo.c:806: warning: Function parameter or member 
'place' not described in 'ttm_bo_mem_force_space'
  drivers/gpu/drm/ttm/ttm_bo.c:806: warning: Function parameter or member 'mem' 
not described in 'ttm_bo_mem_force_space'
  drivers/gpu/drm/ttm/ttm_bo.c:806: warning: Function parameter or member 'ctx' 
not described in 'ttm_bo_mem_force_space'
  drivers/gpu/drm/ttm/ttm_bo.c:872: warning: Function parameter or member 'bo' 
not described in 'ttm_bo_mem_space'
  drivers/gpu/drm/ttm/ttm_bo.c:872: warning: Function parameter or member 
'placement' not described in 'ttm_bo_mem_space'
  drivers/gpu/drm/ttm/ttm_bo.c:872: warning: Function parameter or member 'mem' 
not described in 'ttm_bo_mem_space'
  drivers/gpu/drm/ttm/ttm_bo.c:872: warning: Function parameter or member 'ctx' 
not described in 'ttm_bo_mem_space'
  drivers/gpu/drm/ttm/ttm_bo.c:1387: warning: Function parameter or member 
'ctx' not described in 'ttm_bo_swapout'

Cc: Christian Koenig 
Cc: Huang Rui 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Sumit Semwal 
Cc: dri-devel@lists.freedesktop.org
Cc: linux-me...@vger.kernel.org
Cc: linaro-mm-...@lists.linaro.org
Signed-off-by: Lee Jones 


Reviewed-by: Christian König 

Going to pick that one up for upstreaming.

Thanks,
Christian.


---
  drivers/gpu/drm/ttm/ttm_bo.c | 23 ---
  1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index e6bcbfe530ecc..9a03c7834b1ed 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -45,7 +45,7 @@
  
  static void ttm_bo_global_kobj_release(struct kobject *kobj);
  
-/**

+/*
   * ttm_global_mutex - protecting the global BO state
   */
  DEFINE_MUTEX(ttm_global_mutex);
@@ -278,7 +278,7 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object 
*bo,
return ret;
  }
  
-/**

+/*
   * Call bo::reserved.
   * Will release GPU memory type usage on destruction.
   * This is the place to put in driver specific hooks to release
@@ -352,9 +352,10 @@ static void ttm_bo_flush_all_fences(struct 
ttm_buffer_object *bo)
   * Must be called with lru_lock and reservation held, this function
   * will drop the lru lock and optionally the reservation lock before 
returning.
   *
- * @interruptible Any sleeps should occur interruptibly.
- * @no_wait_gpu   Never wait for gpu. Return -EBUSY instead.
- * @unlock_resv   Unlock the reservation lock as well.
+ * @bo:The buffer object to clean-up
+ * @interruptible: Any sleeps should occur interruptibly.
+ * @no_wait_gpu:   Never wait for gpu. Return -EBUSY instead.
+ * @unlock_resv:   Unlock the reservation lock as well.
   

Re: [PATCH 37/43] drm/radeon/ci_dpm: Move 'si_*()'s prototypes to shared header

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:38 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/si_dpm.c:3802:4: warning: no previous prototype for 
> ‘si_get_ddr3_mclk_frequency_ratio’ [-Wmissing-prototypes]
>  3802 | u8 si_get_ddr3_mclk_frequency_ratio(u32 memory_clock)
>  | ^~~~
>  drivers/gpu/drm/radeon/si_dpm.c:3815:4: warning: no previous prototype for 
> ‘si_get_mclk_frequency_ratio’ [-Wmissing-prototypes]
>  3815 | u8 si_get_mclk_frequency_ratio(u32 memory_clock, bool strobe_mode)
>  | ^~~
>  drivers/gpu/drm/radeon/si_dpm.c:3897:6: warning: no previous prototype for 
> ‘si_trim_voltage_table_to_fit_state_table’ [-Wmissing-prototypes]
>  3897 | void si_trim_voltage_table_to_fit_state_table(struct radeon_device 
> *rdev,
>  | ^~~~
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/ci_dpm.c | 6 +-
>  drivers/gpu/drm/radeon/si_dpm.h | 5 +
>  2 files changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/ci_dpm.c b/drivers/gpu/drm/radeon/ci_dpm.c
> index a9fc0a552736c..0dfb0ed9af89d 100644
> --- a/drivers/gpu/drm/radeon/ci_dpm.c
> +++ b/drivers/gpu/drm/radeon/ci_dpm.c
> @@ -33,6 +33,7 @@
>  #include "radeon.h"
>  #include "radeon_asic.h"
>  #include "radeon_ucode.h"
> +#include "si_dpm.h"
>
>  #define MC_CG_ARB_FREQ_F0   0x0a
>  #define MC_CG_ARB_FREQ_F1   0x0b
> @@ -153,11 +154,6 @@ static const struct ci_pt_config_reg didt_config_ci[] =
>  extern u8 rv770_get_memory_module_index(struct radeon_device *rdev);
>  extern int ni_copy_and_switch_arb_sets(struct radeon_device *rdev,
>u32 arb_freq_src, u32 arb_freq_dest);
> -extern u8 si_get_ddr3_mclk_frequency_ratio(u32 memory_clock);
> -extern u8 si_get_mclk_frequency_ratio(u32 memory_clock, bool strobe_mode);
> -extern void si_trim_voltage_table_to_fit_state_table(struct radeon_device 
> *rdev,
> -u32 max_voltage_steps,
> -struct 
> atom_voltage_table *voltage_table);
>  static int ci_get_std_voltage_value_sidd(struct radeon_device *rdev,
>  struct atom_voltage_table_entry 
> *voltage_table,
>  u16 *std_voltage_hi_sidd, u16 
> *std_voltage_lo_sidd);
> diff --git a/drivers/gpu/drm/radeon/si_dpm.h b/drivers/gpu/drm/radeon/si_dpm.h
> index 1032a68be792b..aa857906ef93d 100644
> --- a/drivers/gpu/drm/radeon/si_dpm.h
> +++ b/drivers/gpu/drm/radeon/si_dpm.h
> @@ -234,5 +234,10 @@ struct si_power_info {
>  #define SISLANDS_CGULVPARAMETER_DFLT0x00040035
>  #define SISLANDS_CGULVCONTROL_DFLT  0x1f007550
>
> +u8 si_get_ddr3_mclk_frequency_ratio(u32 memory_clock);
> +u8 si_get_mclk_frequency_ratio(u32 memory_clock, bool strobe_mode);
> +void si_trim_voltage_table_to_fit_state_table(struct radeon_device *rdev,
> + u32 max_voltage_steps,
> + struct atom_voltage_table 
> *voltage_table);
>
>  #endif
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 36/43] drm/radeon/evergreen: Move 'cik_*()'s prototypes to shared header

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:38 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/cik.c:6413:6: warning: no previous prototype for 
> ‘cik_init_cp_pg_table’ [-Wmissing-prototypes]
>  6413 | void cik_init_cp_pg_table(struct radeon_device *rdev)
>  | ^~~~
>  drivers/gpu/drm/radeon/cik.c:6670:5: warning: no previous prototype for 
> ‘cik_get_csb_size’ [-Wmissing-prototypes]
>  6670 | u32 cik_get_csb_size(struct radeon_device *rdev)
>  | ^~~~
>  drivers/gpu/drm/radeon/cik.c:6702:6: warning: no previous prototype for 
> ‘cik_get_csb_buffer’ [-Wmissing-prototypes]
>  6702 | void cik_get_csb_buffer(struct radeon_device *rdev, volatile u32 
> *buffer)
>  | ^~
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex


> ---
>  drivers/gpu/drm/radeon/cik.h   | 3 +++
>  drivers/gpu/drm/radeon/evergreen.c | 5 +
>  2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/cik.h b/drivers/gpu/drm/radeon/cik.h
> index 6630b9da9e7aa..420207d19de52 100644
> --- a/drivers/gpu/drm/radeon/cik.h
> +++ b/drivers/gpu/drm/radeon/cik.h
> @@ -30,5 +30,8 @@ void cik_exit_rlc_safe_mode(struct radeon_device *rdev);
>  int ci_mc_load_microcode(struct radeon_device *rdev);
>  void cik_update_cg(struct radeon_device *rdev, u32 block, bool enable);
>  u32 cik_gpu_check_soft_reset(struct radeon_device *rdev);
> +void cik_init_cp_pg_table(struct radeon_device *rdev);
> +u32 cik_get_csb_size(struct radeon_device *rdev);
> +void cik_get_csb_buffer(struct radeon_device *rdev, volatile u32 *buffer);
>
>  #endif /* __CIK_H__ */
> diff --git a/drivers/gpu/drm/radeon/evergreen.c 
> b/drivers/gpu/drm/radeon/evergreen.c
> index 4575e448e59df..8e9e88bf1f43d 100644
> --- a/drivers/gpu/drm/radeon/evergreen.c
> +++ b/drivers/gpu/drm/radeon/evergreen.c
> @@ -31,6 +31,7 @@
>
>  #include "atom.h"
>  #include "avivod.h"
> +#include "cik.h"
>  #include "ni.h"
>  #include "rv770.h"
>  #include "evergreen.h"
> @@ -217,10 +218,6 @@ static void evergreen_gpu_init(struct radeon_device 
> *rdev);
>  void evergreen_fini(struct radeon_device *rdev);
>  void evergreen_pcie_gen2_enable(struct radeon_device *rdev);
>  void evergreen_program_aspm(struct radeon_device *rdev);
> -void cik_init_cp_pg_table(struct radeon_device *rdev);
> -
> -extern u32 cik_get_csb_size(struct radeon_device *rdev);
> -extern void cik_get_csb_buffer(struct radeon_device *rdev, volatile u32 
> *buffer);
>
>  static const u32 evergreen_golden_registers[] =
>  {
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 35/43] drm/radeon/cik_sdma: Move 'amdgpu_cik_gpu_check_soft_reset()'s prototype to shared header

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:38 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/cik.c:4845:5: warning: no previous prototype for 
> ‘cik_gpu_check_soft_reset’ [-Wmissing-prototypes]
>  4845 | u32 cik_gpu_check_soft_reset(struct radeon_device *rdev)
>  | ^~~~
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/cik.h  | 1 +
>  drivers/gpu/drm/radeon/cik_sdma.c | 3 +--
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/cik.h b/drivers/gpu/drm/radeon/cik.h
> index 297b3c1ff804f..6630b9da9e7aa 100644
> --- a/drivers/gpu/drm/radeon/cik.h
> +++ b/drivers/gpu/drm/radeon/cik.h
> @@ -29,5 +29,6 @@ void cik_enter_rlc_safe_mode(struct radeon_device *rdev);
>  void cik_exit_rlc_safe_mode(struct radeon_device *rdev);
>  int ci_mc_load_microcode(struct radeon_device *rdev);
>  void cik_update_cg(struct radeon_device *rdev, u32 block, bool enable);
> +u32 cik_gpu_check_soft_reset(struct radeon_device *rdev);
>
>  #endif /* __CIK_H__ */
> diff --git a/drivers/gpu/drm/radeon/cik_sdma.c 
> b/drivers/gpu/drm/radeon/cik_sdma.c
> index 3c709ebe8d1ab..919b14845c3c7 100644
> --- a/drivers/gpu/drm/radeon/cik_sdma.c
> +++ b/drivers/gpu/drm/radeon/cik_sdma.c
> @@ -27,14 +27,13 @@
>  #include "radeon_ucode.h"
>  #include "radeon_asic.h"
>  #include "radeon_trace.h"
> +#include "cik.h"
>  #include "cikd.h"
>
>  /* sdma */
>  #define CIK_SDMA_UCODE_SIZE 1050
>  #define CIK_SDMA_UCODE_VERSION 64
>
> -u32 cik_gpu_check_soft_reset(struct radeon_device *rdev);
> -
>  /*
>   * sDMA - System DMA
>   * Starting with CIK, the GPU has new asynchronous
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 32/42] drm/ttm/ttm_tt: Demote kernel-doc header format abuses

2020-11-16 Thread Christian König

Am 16.11.20 um 18:41 schrieb Lee Jones:

Fixes the following W=1 kernel build warning(s):

  drivers/gpu/drm/ttm/ttm_tt.c:45: warning: Function parameter or member 'bo' 
not described in 'ttm_tt_create'
  drivers/gpu/drm/ttm/ttm_tt.c:45: warning: Function parameter or member 
'zero_alloc' not described in 'ttm_tt_create'
  drivers/gpu/drm/ttm/ttm_tt.c:83: warning: Function parameter or member 'ttm' 
not described in 'ttm_tt_alloc_page_directory'


Couldn't we rather describe the missing parameters? Shouldn't be much work.

Regards,
Christian.



Cc: Christian Koenig 
Cc: Huang Rui 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Lee Jones 
---
  drivers/gpu/drm/ttm/ttm_tt.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
index cfd633c7e7643..da9eeffe0c6d7 100644
--- a/drivers/gpu/drm/ttm/ttm_tt.c
+++ b/drivers/gpu/drm/ttm/ttm_tt.c
@@ -38,7 +38,7 @@
  #include 
  #include 
  
-/**

+/*
   * Allocates a ttm structure for the given BO.
   */
  int ttm_tt_create(struct ttm_buffer_object *bo, bool zero_alloc)
@@ -73,7 +73,7 @@ int ttm_tt_create(struct ttm_buffer_object *bo, bool 
zero_alloc)
return 0;
  }
  
-/**

+/*
   * Allocates storage for pointers to the pages that back the ttm.
   */
  static int ttm_tt_alloc_page_directory(struct ttm_tt *ttm)


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


Re: [PATCH 34/43] drm/radeon/evergreen: Move 'si_get_csb_*()'s prototypes to shared header

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:37 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/si.c:5678:5: warning: no previous prototype for 
> ‘si_get_csb_size’ [-Wmissing-prototypes]
>  5678 | u32 si_get_csb_size(struct radeon_device *rdev)
>  | ^~~
>  drivers/gpu/drm/radeon/si.c:5710:6: warning: no previous prototype for 
> ‘si_get_csb_buffer’ [-Wmissing-prototypes]
>  5710 | void si_get_csb_buffer(struct radeon_device *rdev, volatile u32 
> *buffer)
>  | ^
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/evergreen.c | 3 +--
>  drivers/gpu/drm/radeon/si.h| 2 ++
>  2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/evergreen.c 
> b/drivers/gpu/drm/radeon/evergreen.c
> index 8fb0b8c3db5b5..4575e448e59df 100644
> --- a/drivers/gpu/drm/radeon/evergreen.c
> +++ b/drivers/gpu/drm/radeon/evergreen.c
> @@ -41,6 +41,7 @@
>  #include "radeon_asic.h"
>  #include "radeon_audio.h"
>  #include "radeon_ucode.h"
> +#include "si.h"
>
>  #define DC_HPDx_CONTROL(x)(DC_HPD1_CONTROL + (x * 0xc))
>  #define DC_HPDx_INT_CONTROL(x)(DC_HPD1_INT_CONTROL + (x * 0xc))
> @@ -218,8 +219,6 @@ void evergreen_pcie_gen2_enable(struct radeon_device 
> *rdev);
>  void evergreen_program_aspm(struct radeon_device *rdev);
>  void cik_init_cp_pg_table(struct radeon_device *rdev);
>
> -extern u32 si_get_csb_size(struct radeon_device *rdev);
> -extern void si_get_csb_buffer(struct radeon_device *rdev, volatile u32 
> *buffer);
>  extern u32 cik_get_csb_size(struct radeon_device *rdev);
>  extern void cik_get_csb_buffer(struct radeon_device *rdev, volatile u32 
> *buffer);
>
> diff --git a/drivers/gpu/drm/radeon/si.h b/drivers/gpu/drm/radeon/si.h
> index f483a64d17050..310c58376f927 100644
> --- a/drivers/gpu/drm/radeon/si.h
> +++ b/drivers/gpu/drm/radeon/si.h
> @@ -32,5 +32,7 @@ u32 si_gpu_check_soft_reset(struct radeon_device *rdev);
>  void si_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc);
>  void si_rlc_reset(struct radeon_device *rdev);
>  void si_init_uvd_internal_cg(struct radeon_device *rdev);
> +u32 si_get_csb_size(struct radeon_device *rdev);
> +void si_get_csb_buffer(struct radeon_device *rdev, volatile u32 *buffer);
>
>  #endif /* __SI_H__ */
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 33/43] drm/radeon/radeon_audio: Move 'dce6_*()'s prototypes to shared header

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:38 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/dce6_afmt.c:32:5: warning: no previous prototype for 
> ‘dce6_endpoint_rreg’ [-Wmissing-prototypes]
>  32 | u32 dce6_endpoint_rreg(struct radeon_device *rdev,
>  | ^~
>  drivers/gpu/drm/radeon/dce6_afmt.c:46:6: warning: no previous prototype for 
> ‘dce6_endpoint_wreg’ [-Wmissing-prototypes]
>  46 | void dce6_endpoint_wreg(struct radeon_device *rdev,
>  | ^~
>  drivers/gpu/drm/radeon/dce6_afmt.c:110:6: warning: no previous prototype for 
> ‘dce6_afmt_select_pin’ [-Wmissing-prototypes]
>  110 | void dce6_afmt_select_pin(struct drm_encoder *encoder)
>  | ^~~~
>  drivers/gpu/drm/radeon/dce6_afmt.c:123:6: warning: no previous prototype for 
> ‘dce6_afmt_write_latency_fields’ [-Wmissing-prototypes]
>  123 | void dce6_afmt_write_latency_fields(struct drm_encoder *encoder,
>  | ^~
>  drivers/gpu/drm/radeon/dce6_afmt.c:152:6: warning: no previous prototype for 
> ‘dce6_afmt_hdmi_write_speaker_allocation’ [-Wmissing-prototypes]
>  152 | void dce6_afmt_hdmi_write_speaker_allocation(struct drm_encoder 
> *encoder,
>  | ^~~
>  drivers/gpu/drm/radeon/dce6_afmt.c:177:6: warning: no previous prototype for 
> ‘dce6_afmt_dp_write_speaker_allocation’ [-Wmissing-prototypes]
>  177 | void dce6_afmt_dp_write_speaker_allocation(struct drm_encoder *encoder,
>  | ^
>  drivers/gpu/drm/radeon/dce6_afmt.c:202:6: warning: no previous prototype for 
> ‘dce6_afmt_write_sad_regs’ [-Wmissing-prototypes]
>  202 | void dce6_afmt_write_sad_regs(struct drm_encoder *encoder,
>  | ^~~~
>  drivers/gpu/drm/radeon/dce6_afmt.c:268:6: warning: no previous prototype for 
> ‘dce6_hdmi_audio_set_dto’ [-Wmissing-prototypes]
>  268 | void dce6_hdmi_audio_set_dto(struct radeon_device *rdev,
>  | ^~~
>  drivers/gpu/drm/radeon/dce6_afmt.c:287:6: warning: no previous prototype for 
> ‘dce6_dp_audio_set_dto’ [-Wmissing-prototypes]
>  287 | void dce6_dp_audio_set_dto(struct radeo_device *rdev,
>  | ^
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: Slava Grigorev 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex


> ---
>  drivers/gpu/drm/radeon/dce6_afmt.c|  1 +
>  drivers/gpu/drm/radeon/dce6_afmt.h| 52 +++
>  drivers/gpu/drm/radeon/radeon_audio.c | 17 +
>  3 files changed, 54 insertions(+), 16 deletions(-)
>  create mode 100644 drivers/gpu/drm/radeon/dce6_afmt.h
>
> diff --git a/drivers/gpu/drm/radeon/dce6_afmt.c 
> b/drivers/gpu/drm/radeon/dce6_afmt.c
> index eec5d7a627388..4a1d5447eac17 100644
> --- a/drivers/gpu/drm/radeon/dce6_afmt.c
> +++ b/drivers/gpu/drm/radeon/dce6_afmt.c
> @@ -22,6 +22,7 @@
>   */
>  #include 
>
> +#include "dce6_afmt.h"
>  #include "radeon.h"
>  #include "radeon_audio.h"
>  #include "sid.h"
> diff --git a/drivers/gpu/drm/radeon/dce6_afmt.h 
> b/drivers/gpu/drm/radeon/dce6_afmt.h
> new file mode 100644
> index 0..176a538664a27
> --- /dev/null
> +++ b/drivers/gpu/drm/radeon/dce6_afmt.h
> @@ -0,0 +1,52 @@
> +/* dce6_afmt.h -- Private header for radeon driver -*- linux-c -*-
> + *
> + * Copyright 2013 Advanced Micro Devices, Inc.
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice shall be included in
> + * all copies or substantial portions of the Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
> + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
> + * OTHER DEALINGS IN THE SOFTWARE.
> + *
> + */
> +
> +#ifndef __DCE6_AFMT_H__
> +#define __DCE6_AFMT_H__
> +
> +struct cea_sad;
> +struct drm_connector;
> +struct drm_display_mode;
> +struct drm_encoder;
> +struct radeon_crtc;
> +struct radeon_device;
> +
> +u32 dce6_endpoint_rreg(struct radeon_device *rdev, u32 offset, u32 reg);
> +void dce6_endpoint_wreg(struct radeon_device *rdev, u32 offset, u32 reg, u32 
> v);
> +void 

Re: [PATCH 32/43] drm/radeon/btc_dpm: Move 'evergreen_get_pi's prototype to shared header

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:38 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/rv770_dpm.c:62:30: warning: no previous prototype for 
> ‘evergreen_get_pi’ [-Wmissing-prototypes]
>  62 | struct evergreen_power_info *evergreen_get_pi(struct radeon_device 
> *rdev)
>  | ^~~~
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/btc_dpm.c | 3 +--
>  drivers/gpu/drm/radeon/cypress_dpm.c | 3 +--
>  drivers/gpu/drm/radeon/evergreen.h   | 2 ++
>  drivers/gpu/drm/radeon/ni_dpm.c  | 3 +--
>  drivers/gpu/drm/radeon/rv770_dpm.c   | 1 +
>  drivers/gpu/drm/radeon/si_dpm.c  | 3 +--
>  6 files changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/btc_dpm.c 
> b/drivers/gpu/drm/radeon/btc_dpm.c
> index 018949668536e..4e64ed38c439f 100644
> --- a/drivers/gpu/drm/radeon/btc_dpm.c
> +++ b/drivers/gpu/drm/radeon/btc_dpm.c
> @@ -29,6 +29,7 @@
>  #include "btc_dpm.h"
>  #include "btcd.h"
>  #include "cypress_dpm.h"
> +#include "evergreen.h"
>  #include "r600_dpm.h"
>  #include "rv770.h"
>  #include "radeon.h"
> @@ -49,8 +50,6 @@
>  #ifndef BTC_MGCG_SEQUENCE
>  #define BTC_MGCG_SEQUENCE  300
>
> -struct evergreen_power_info *evergreen_get_pi(struct radeon_device *rdev);
> -
>  extern int ni_mc_load_microcode(struct radeon_device *rdev);
>
>  //* BARTS **//
> diff --git a/drivers/gpu/drm/radeon/cypress_dpm.c 
> b/drivers/gpu/drm/radeon/cypress_dpm.c
> index 6d3690bcca2d2..fdddbbaecbb74 100644
> --- a/drivers/gpu/drm/radeon/cypress_dpm.c
> +++ b/drivers/gpu/drm/radeon/cypress_dpm.c
> @@ -26,6 +26,7 @@
>
>  #include "atom.h"
>  #include "cypress_dpm.h"
> +#include "evergreen.h"
>  #include "evergreend.h"
>  #include "r600_dpm.h"
>  #include "rv770.h"
> @@ -44,8 +45,6 @@
>  #define MC_CG_SEQ_YCLK_SUSPEND  0x04
>  #define MC_CG_SEQ_YCLK_RESUME   0x0a
>
> -struct evergreen_power_info *evergreen_get_pi(struct radeon_device *rdev);
> -
>  static void cypress_enable_bif_dynamic_pcie_gen2(struct radeon_device *rdev,
>  bool enable)
>  {
> diff --git a/drivers/gpu/drm/radeon/evergreen.h 
> b/drivers/gpu/drm/radeon/evergreen.h
> index f8d772e612a48..a829deb8b078a 100644
> --- a/drivers/gpu/drm/radeon/evergreen.h
> +++ b/drivers/gpu/drm/radeon/evergreen.h
> @@ -29,6 +29,7 @@
>  #define __RADEON_EVERGREEN_H__
>
>  struct evergreen_mc_save;
> +struct evergreen_power_info;
>  struct radeon_device;
>
>  bool evergreen_is_display_hung(struct radeon_device *rdev);
> @@ -49,5 +50,6 @@ u32 evergreen_get_number_of_dram_channels(struct 
> radeon_device *rdev);
>  void evergreen_print_gpu_status_regs(struct radeon_device *rdev);
>  u32 evergreen_gpu_check_soft_reset(struct radeon_device *rdev);
>  int evergreen_rlc_resume(struct radeon_device *rdev);
> +struct evergreen_power_info *evergreen_get_pi(struct radeon_device *rdev);
>
>  #endif /* __RADEON_EVERGREEN_H__ */
> diff --git a/drivers/gpu/drm/radeon/ni_dpm.c b/drivers/gpu/drm/radeon/ni_dpm.c
> index d39bbd9793cc2..dd5ef64937230 100644
> --- a/drivers/gpu/drm/radeon/ni_dpm.c
> +++ b/drivers/gpu/drm/radeon/ni_dpm.c
> @@ -26,6 +26,7 @@
>  #include 
>
>  #include "atom.h"
> +#include "evergreen.h"
>  #include "ni_dpm.h"
>  #include "nid.h"
>  #include "r600_dpm.h"
> @@ -720,8 +721,6 @@ static const u32 cayman_sysls_enable[] =
>  };
>  #define CAYMAN_SYSLS_ENABLE_LENGTH sizeof(cayman_sysls_enable) / (3 * 
> sizeof(u32))
>
> -struct evergreen_power_info *evergreen_get_pi(struct radeon_device *rdev);
> -
>  extern int ni_mc_load_microcode(struct radeon_device *rdev);
>
>  struct ni_power_info *ni_get_pi(struct radeon_device *rdev)
> diff --git a/drivers/gpu/drm/radeon/rv770_dpm.c 
> b/drivers/gpu/drm/radeon/rv770_dpm.c
> index badd8ac6e038f..ef2f1a048cfed 100644
> --- a/drivers/gpu/drm/radeon/rv770_dpm.c
> +++ b/drivers/gpu/drm/radeon/rv770_dpm.c
> @@ -30,6 +30,7 @@
>  #include "rv770_dpm.h"
>  #include "cypress_dpm.h"
>  #include "atom.h"
> +#include "evergreen.h"
>  #include 
>
>  #define MC_CG_ARB_FREQ_F0   0x0a
> diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c
> index 32b697965c064..b4581392fbce9 100644
> --- a/drivers/gpu/drm/radeon/si_dpm.c
> +++ b/drivers/gpu/drm/radeon/si_dpm.c
> @@ -26,6 +26,7 @@
>  #include 
>
>  #include "atom.h"
> +#include "evergreen.h"
>  #include "r600_dpm.h"
>  #include "rv770.h"
>  #include "radeon.h"
> @@ -1720,8 +1721,6 @@ static const struct si_powertune_data 
> powertune_data_hainan =
> true
>  };
>
> -struct evergreen_power_info *evergreen_get_pi(struct radeon_device *rdev);
> -
>  extern void vce_v1_0_enable_mgcg(struct radeon_device *rdev, bool enable);
>
>  static int si_populate_voltage_value(struct radeon_device *rdev,
> --

Re: [PATCH 31/43] drm/radeon/cik: Move 'si_*()'s prototypes to shared header

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:38 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/si.c:4186:6: warning: no previous prototype for 
> ‘si_vram_gtt_location’ [-Wmissing-prototypes]
>  4186 | void si_vram_gtt_location(struct radeon_device *rdev,
>  | ^~~~
>  drivers/gpu/drm/radeon/si.c:5186:6: warning: no previous prototype for 
> ‘si_init_uvd_internal_cg’ [-Wmissing-prototypes]
>  5186 | void si_init_uvd_internal_cg(struct radeon_device *rdev)
>  | ^~~
>  drivers/gpu/drm/radeon/si.c:5801:6: warning: no previous prototype for 
> ‘si_rlc_reset’ [-Wmissing-prototypes]
>  5801 | void si_rlc_reset(struct radeon_device *rdev)
>  | ^~~~
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: Sumit Semwal 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Cc: linux-me...@vger.kernel.org
> Cc: linaro-mm-...@lists.linaro.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/cik.c | 4 +---
>  drivers/gpu/drm/radeon/si.h  | 4 
>  2 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
> index ae020ad7b3185..cef0f3111cd3a 100644
> --- a/drivers/gpu/drm/radeon/cik.c
> +++ b/drivers/gpu/drm/radeon/cik.c
> @@ -40,6 +40,7 @@
>  #include "radeon_asic.h"
>  #include "radeon_audio.h"
>  #include "radeon_ucode.h"
> +#include "si.h"
>
>  #define SH_MEM_CONFIG_GFX_DEFAULT \
> ALIGNMENT_MODE(SH_MEM_ALIGNMENT_MODE_UNALIGNED)
> @@ -127,9 +128,6 @@ MODULE_FIRMWARE("radeon/mullins_mec.bin");
>  MODULE_FIRMWARE("radeon/mullins_rlc.bin");
>  MODULE_FIRMWARE("radeon/mullins_sdma.bin");
>
> -extern void si_vram_gtt_location(struct radeon_device *rdev, struct 
> radeon_mc *mc);
> -extern void si_rlc_reset(struct radeon_device *rdev);
> -extern void si_init_uvd_internal_cg(struct radeon_device *rdev);
>  static u32 cik_get_cu_active_bitmap(struct radeon_device *rdev, u32 se, u32 
> sh);
>  extern int cik_sdma_resume(struct radeon_device *rdev);
>  extern void cik_sdma_enable(struct radeon_device *rdev, bool enable);
> diff --git a/drivers/gpu/drm/radeon/si.h b/drivers/gpu/drm/radeon/si.h
> index a1751ae560f02..f483a64d17050 100644
> --- a/drivers/gpu/drm/radeon/si.h
> +++ b/drivers/gpu/drm/radeon/si.h
> @@ -25,8 +25,12 @@
>  #define __SI_H__
>
>  struct radeon_device;
> +struct radeon_mc;
>
>  int si_mc_load_microcode(struct radeon_device *rdev);
>  u32 si_gpu_check_soft_reset(struct radeon_device *rdev);
> +void si_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc);
> +void si_rlc_reset(struct radeon_device *rdev);
> +void si_init_uvd_internal_cg(struct radeon_device *rdev);
>
>  #endif /* __SI_H__ */
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 30/43] drm/radeon/si_dma: Move 'si_gpu_check_soft_reset()'s prototype to shared header

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:38 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/si.c:3768:5: warning: no previous prototype for 
> ‘si_gpu_check_soft_reset’ [-Wmissing-prototypes]
>  3768 | u32 si_gpu_check_soft_reset(struct radeon_device *rdev)
>  | ^~~
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/si.h | 1 +
>  drivers/gpu/drm/radeon/si_dma.c | 3 +--
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/si.h b/drivers/gpu/drm/radeon/si.h
> index 0a5018ef166e2..a1751ae560f02 100644
> --- a/drivers/gpu/drm/radeon/si.h
> +++ b/drivers/gpu/drm/radeon/si.h
> @@ -27,5 +27,6 @@
>  struct radeon_device;
>
>  int si_mc_load_microcode(struct radeon_device *rdev);
> +u32 si_gpu_check_soft_reset(struct radeon_device *rdev);
>
>  #endif /* __SI_H__ */
> diff --git a/drivers/gpu/drm/radeon/si_dma.c b/drivers/gpu/drm/radeon/si_dma.c
> index d2fa302a5be9f..645897d1bfc31 100644
> --- a/drivers/gpu/drm/radeon/si_dma.c
> +++ b/drivers/gpu/drm/radeon/si_dma.c
> @@ -25,10 +25,9 @@
>  #include "radeon.h"
>  #include "radeon_asic.h"
>  #include "radeon_trace.h"
> +#include "si.h"
>  #include "sid.h"
>
> -u32 si_gpu_check_soft_reset(struct radeon_device *rdev);
> -
>  /**
>   * si_dma_is_lockup - Check if the DMA engine is locked up
>   *
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 29/43] drm/radeon/si_dpm: Move 'si_mc_load_microcode()'s prototype to shared header

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:38 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/si.c:1570:5: warning: no previous prototype for 
> ‘si_mc_load_microcode’ [-Wmissing-prototypes]
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/si.c |  1 +
>  drivers/gpu/drm/radeon/si.h | 31 +++
>  drivers/gpu/drm/radeon/si_dpm.c |  2 +-
>  3 files changed, 33 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/gpu/drm/radeon/si.h
>
> diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c
> index d0407145c07b5..88731b79c8f57 100644
> --- a/drivers/gpu/drm/radeon/si.c
> +++ b/drivers/gpu/drm/radeon/si.c
> @@ -39,6 +39,7 @@
>  #include "radeon_audio.h"
>  #include "radeon_ucode.h"
>  #include "si_blit_shaders.h"
> +#include "si.h"
>  #include "sid.h"
>
>
> diff --git a/drivers/gpu/drm/radeon/si.h b/drivers/gpu/drm/radeon/si.h
> new file mode 100644
> index 0..0a5018ef166e2
> --- /dev/null
> +++ b/drivers/gpu/drm/radeon/si.h
> @@ -0,0 +1,31 @@
> +/* si.h -- Private header for radeon driver -*- linux-c -*-
> + *
> + * Copyright 2011 Advanced Micro Devices, Inc.
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice shall be included in
> + * all copies or substantial portions of the Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
> + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
> + * OTHER DEALINGS IN THE SOFTWARE.
> + */
> +
> +#ifndef __SI_H__
> +#define __SI_H__
> +
> +struct radeon_device;
> +
> +int si_mc_load_microcode(struct radeon_device *rdev);
> +
> +#endif /* __SI_H__ */
> diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c
> index c68ab2fb1ac23..32b697965c064 100644
> --- a/drivers/gpu/drm/radeon/si_dpm.c
> +++ b/drivers/gpu/drm/radeon/si_dpm.c
> @@ -32,6 +32,7 @@
>  #include "radeon_asic.h"
>  #include "ni_dpm.h"
>  #include "si_dpm.h"
> +#include "si.h"
>  #include "sid.h"
>
>  #define MC_CG_ARB_FREQ_F0   0x0a
> @@ -1721,7 +1722,6 @@ static const struct si_powertune_data 
> powertune_data_hainan =
>
>  struct evergreen_power_info *evergreen_get_pi(struct radeon_device *rdev);
>
> -extern int si_mc_load_microcode(struct radeon_device *rdev);
>  extern void vce_v1_0_enable_mgcg(struct radeon_device *rdev, bool enable);
>
>  static int si_populate_voltage_value(struct radeon_device *rdev,
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 28/43] drm/radeon/ci_dpm: Move 'ci_*()'s prototypes to shared header

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:38 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/cik.c:1868:5: warning: no previous prototype for 
> ‘ci_mc_load_microcode’ [-Wmissing-prototypes]
>  1868 | int ci_mc_load_microcode(struct radeon_device *rdev)
>  | ^~~~
>  drivers/gpu/drm/radeon/cik.c:5847:6: warning: no previous prototype for 
> ‘cik_enter_rlc_safe_mode’ [-Wmissing-prototypes]
>  5847 | void cik_enter_rlc_safe_mode(struct radeon_device *rdev)
>  | ^~~
>  drivers/gpu/drm/radeon/cik.c:5868:6: warning: no previous prototype for 
> ‘cik_exit_rlc_safe_mode’ [-Wmissing-prototypes]
>  5868 | void cik_exit_rlc_safe_mode(struct radeon_device *rdev)
>  | ^~
>  drivers/gpu/drm/radeon/cik.c:6286:6: warning: no previous prototype for 
> ‘cik_update_cg’ [-Wmissing-prototypes]
>  6286 | void cik_update_cg(struct radeon_device *rdev,
>  | ^
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/ci_dpm.c |  7 +--
>  drivers/gpu/drm/radeon/cik.c|  1 +
>  drivers/gpu/drm/radeon/cik.h| 33 +
>  3 files changed, 35 insertions(+), 6 deletions(-)
>  create mode 100644 drivers/gpu/drm/radeon/cik.h
>
> diff --git a/drivers/gpu/drm/radeon/ci_dpm.c b/drivers/gpu/drm/radeon/ci_dpm.c
> index 8324aca5fd006..a9fc0a552736c 100644
> --- a/drivers/gpu/drm/radeon/ci_dpm.c
> +++ b/drivers/gpu/drm/radeon/ci_dpm.c
> @@ -27,6 +27,7 @@
>
>  #include "atom.h"
>  #include "ci_dpm.h"
> +#include "cik.h"
>  #include "cikd.h"
>  #include "r600_dpm.h"
>  #include "radeon.h"
> @@ -157,12 +158,6 @@ extern u8 si_get_mclk_frequency_ratio(u32 memory_clock, 
> bool strobe_mode);
>  extern void si_trim_voltage_table_to_fit_state_table(struct radeon_device 
> *rdev,
>  u32 max_voltage_steps,
>  struct 
> atom_voltage_table *voltage_table);
> -extern void cik_enter_rlc_safe_mode(struct radeon_device *rdev);
> -extern void cik_exit_rlc_safe_mode(struct radeon_device *rdev);
> -extern int ci_mc_load_microcode(struct radeon_device *rdev);
> -extern void cik_update_cg(struct radeon_device *rdev,
> - u32 block, bool enable);
> -
>  static int ci_get_std_voltage_value_sidd(struct radeon_device *rdev,
>  struct atom_voltage_table_entry 
> *voltage_table,
>  u16 *std_voltage_hi_sidd, u16 
> *std_voltage_lo_sidd);
> diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
> index 980b50d046cbc..ae020ad7b3185 100644
> --- a/drivers/gpu/drm/radeon/cik.c
> +++ b/drivers/gpu/drm/radeon/cik.c
> @@ -32,6 +32,7 @@
>  #include "atom.h"
>  #include "evergreen.h"
>  #include "cik_blit_shaders.h"
> +#include "cik.h"
>  #include "cikd.h"
>  #include "clearstate_ci.h"
>  #include "r600.h"
> diff --git a/drivers/gpu/drm/radeon/cik.h b/drivers/gpu/drm/radeon/cik.h
> new file mode 100644
> index 0..297b3c1ff804f
> --- /dev/null
> +++ b/drivers/gpu/drm/radeon/cik.h
> @@ -0,0 +1,33 @@
> +/* cik.h -- Private header for radeon driver -*- linux-c -*-
> + * Copyright 2012 Advanced Micro Devices, Inc.
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice shall be included in
> + * all copies or substantial portions of the Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
> + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
> + * OTHER DEALINGS IN THE SOFTWARE.
> + */
> +
> +#ifndef __CIK_H__
> +#define __CIK_H__
> +
> +struct radeon_device;
> +
> +void cik_enter_rlc_safe_mode(struct radeon_device *rdev);
> +void cik_exit_rlc_safe_mode(struct radeon_device *rdev);
> +int ci_mc_load_microcode(struct radeon_device *rdev);
> +void cik_update_cg(struct radeon_device *rdev, u32 block, bool enable);
> +
> +#endif /* __CIK_H__ */
> --
> 2.25.1

Re: [PATCH 27/43] drm/radeon/radeon_encoders: Move 'radeon_atom_backlight_init's prototype to shared header

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:37 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/atombios_encoders.c:186:6: warning: no previous 
> prototype for ‘radeon_atom_backlight_init’ [-Wmissing-prototypes]
>  186 | void radeon_atom_backlight_init(struct radeon_encoder *radeon_encoder,
>  | ^~
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/radeon_atombios.h | 4 
>  drivers/gpu/drm/radeon/radeon_encoders.c | 6 +-
>  2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_atombios.h 
> b/drivers/gpu/drm/radeon/radeon_atombios.h
> index a895a7002c3d3..fd03755e6fa2c 100644
> --- a/drivers/gpu/drm/radeon/radeon_atombios.h
> +++ b/drivers/gpu/drm/radeon/radeon_atombios.h
> @@ -28,14 +28,18 @@
>  #ifndef __RADEON_ATOMBIOS_H__
>  #define __RADEON_ATOMBIOS_H__
>
> +struct drm_connector;
>  struct drm_device;
>  struct drm_display_mode;
>  struct radeon_device;
> +struct radeon_encoder;
>
>  bool radeon_atom_get_tv_timings(struct radeon_device *rdev, int index,
> struct drm_display_mode *mode);
>  void radeon_add_atom_encoder(struct drm_device *dev, uint32_t encoder_enum,
>  uint32_t supported_device, u16 caps);
> +void radeon_atom_backlight_init(struct radeon_encoder *radeon_encoder,
> +   struct drm_connector *drm_connector);
>
>
>  #endif /* __RADEON_ATOMBIOS_H__ */
> diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c 
> b/drivers/gpu/drm/radeon/radeon_encoders.c
> index b60a373d3ead3..46549d5179ee9 100644
> --- a/drivers/gpu/drm/radeon/radeon_encoders.c
> +++ b/drivers/gpu/drm/radeon/radeon_encoders.c
> @@ -31,14 +31,10 @@
>  #include 
>
>  #include "radeon.h"
> +#include "radeon_atombios.h"
>  #include "radeon_legacy_encoders.h"
>  #include "atom.h"
>
> -extern void
> -radeon_atom_backlight_init(struct radeon_encoder *radeon_encoder,
> -  struct drm_connector *drm_connector);
> -
> -
>  static uint32_t radeon_encoder_clones(struct drm_encoder *encoder)
>  {
> struct drm_device *dev = encoder->dev;
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 26/43] drm/radeon/radeon_atombios: Move 'radeon_add_atom_encoder()'s prototype to shared header

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:38 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/atombios_encoders.c:2721:1: warning: no previous 
> prototype for ‘radeon_add_atom_encoder’ [-Wmissing-prototypes]
>  2721 | radeon_add_atom_encoder(struct drm_device *dev,
>  | ^~~
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/radeon_atombios.c | 4 
>  drivers/gpu/drm/radeon/radeon_atombios.h | 4 
>  2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c 
> b/drivers/gpu/drm/radeon/radeon_atombios.c
> index cc80651b25773..be96d9b64e43b 100644
> --- a/drivers/gpu/drm/radeon/radeon_atombios.c
> +++ b/drivers/gpu/drm/radeon/radeon_atombios.c
> @@ -37,10 +37,6 @@
>  #include "radeon_atombios.h"
>  #include "radeon_legacy_encoders.h"
>
> -extern void
> -radeon_add_atom_encoder(struct drm_device *dev, uint32_t encoder_enum,
> -   uint32_t supported_device, u16 caps);
> -
>  union atom_supported_devices {
> struct _ATOM_SUPPORTED_DEVICES_INFO info;
> struct _ATOM_SUPPORTED_DEVICES_INFO_2 info_2;
> diff --git a/drivers/gpu/drm/radeon/radeon_atombios.h 
> b/drivers/gpu/drm/radeon/radeon_atombios.h
> index b7c76920feb7d..a895a7002c3d3 100644
> --- a/drivers/gpu/drm/radeon/radeon_atombios.h
> +++ b/drivers/gpu/drm/radeon/radeon_atombios.h
> @@ -28,10 +28,14 @@
>  #ifndef __RADEON_ATOMBIOS_H__
>  #define __RADEON_ATOMBIOS_H__
>
> +struct drm_device;
>  struct drm_display_mode;
>  struct radeon_device;
>
>  bool radeon_atom_get_tv_timings(struct radeon_device *rdev, int index,
> struct drm_display_mode *mode);
> +void radeon_add_atom_encoder(struct drm_device *dev, uint32_t encoder_enum,
> +uint32_t supported_device, u16 caps);
> +
>
>  #endif /* __RADEON_ATOMBIOS_H__ */
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 25/43] drm/radeon/ni_dma: Move 'cayman_gpu_check_soft_reset()'s prototype to shared header

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:37 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/ni.c:1733:5: warning: no previous prototype for 
> ‘cayman_gpu_check_soft_reset’ [-Wmissing-prototypes]
>  1733 | u32 cayman_gpu_check_soft_reset(struct radeon_device *rdev)
>  | ^~~
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/ni.h | 1 +
>  drivers/gpu/drm/radeon/ni_dma.c | 3 +--
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/ni.h b/drivers/gpu/drm/radeon/ni.h
> index d63be1c88c0f1..9a5f31a05e68f 100644
> --- a/drivers/gpu/drm/radeon/ni.h
> +++ b/drivers/gpu/drm/radeon/ni.h
> @@ -34,5 +34,6 @@ void cayman_cp_int_cntl_setup(struct radeon_device *rdev,
>   int ring, u32 cp_int_cntl);
>  void cayman_vm_decode_fault(struct radeon_device *rdev,
> u32 status, u32 addr);
> +u32 cayman_gpu_check_soft_reset(struct radeon_device *rdev);
>
>  #endif /* __NI_H__ */
> diff --git a/drivers/gpu/drm/radeon/ni_dma.c b/drivers/gpu/drm/radeon/ni_dma.c
> index c56136848360e..bd515ad4fe4cc 100644
> --- a/drivers/gpu/drm/radeon/ni_dma.c
> +++ b/drivers/gpu/drm/radeon/ni_dma.c
> @@ -25,10 +25,9 @@
>  #include "radeon.h"
>  #include "radeon_asic.h"
>  #include "radeon_trace.h"
> +#include "ni.h"
>  #include "nid.h"
>
> -u32 cayman_gpu_check_soft_reset(struct radeon_device *rdev);
> -
>  /*
>   * DMA
>   * Starting with R600, the GPU has an asynchronous
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 24/43] drm/radeon/r600: Move 'evergreen_rlc_resume()'s prototype to shared header

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:38 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/evergreen.c:4380:5: warning: no previous prototype 
> for ‘evergreen_rlc_resume’ [-Wmissing-prototypes]
>  4380 | int evergreen_rlc_resume(struct radeon_device *rdev)
>  | ^~~~
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/evergreen.h | 1 +
>  drivers/gpu/drm/radeon/r600.c  | 2 +-
>  2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/radeon/evergreen.h 
> b/drivers/gpu/drm/radeon/evergreen.h
> index eb46ac7776951..f8d772e612a48 100644
> --- a/drivers/gpu/drm/radeon/evergreen.h
> +++ b/drivers/gpu/drm/radeon/evergreen.h
> @@ -48,5 +48,6 @@ void evergreen_gpu_pci_config_reset(struct radeon_device 
> *rdev);
>  u32 evergreen_get_number_of_dram_channels(struct radeon_device *rdev);
>  void evergreen_print_gpu_status_regs(struct radeon_device *rdev);
>  u32 evergreen_gpu_check_soft_reset(struct radeon_device *rdev);
> +int evergreen_rlc_resume(struct radeon_device *rdev);
>
>  #endif /* __RADEON_EVERGREEN_H__ */
> diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
> index 94e8815e5067d..b44e0c607b1b1 100644
> --- a/drivers/gpu/drm/radeon/r600.c
> +++ b/drivers/gpu/drm/radeon/r600.c
> @@ -39,6 +39,7 @@
>
>  #include "atom.h"
>  #include "avivod.h"
> +#include "evergreen.h"
>  #include "r600.h"
>  #include "r600d.h"
>  #include "rv770.h"
> @@ -113,7 +114,6 @@ static void r600_gpu_init(struct radeon_device *rdev);
>  void r600_fini(struct radeon_device *rdev);
>  void r600_irq_disable(struct radeon_device *rdev);
>  static void r600_pcie_gen2_enable(struct radeon_device *rdev);
> -extern int evergreen_rlc_resume(struct radeon_device *rdev);
>
>  /*
>   * Indirect registers accessor
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 23/43] drm/radeon/evergreen_dma: Move 'evergreen_gpu_check_soft_reset()'s prototype to shared header

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:38 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/evergreen.c:3825:5: warning: no previous prototype 
> for ‘evergreen_gpu_check_soft_reset’ [-Wmissing-prototypes]
>  3825 | u32 evergreen_gpu_check_soft_reset(struct radeon_device *rdev)
>  | ^~
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/evergreen.h | 1 +
>  drivers/gpu/drm/radeon/evergreen_dma.c | 3 +--
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/evergreen.h 
> b/drivers/gpu/drm/radeon/evergreen.h
> index 30c9ca99ced90..eb46ac7776951 100644
> --- a/drivers/gpu/drm/radeon/evergreen.h
> +++ b/drivers/gpu/drm/radeon/evergreen.h
> @@ -47,5 +47,6 @@ int sumo_rlc_init(struct radeon_device *rdev);
>  void evergreen_gpu_pci_config_reset(struct radeon_device *rdev);
>  u32 evergreen_get_number_of_dram_channels(struct radeon_device *rdev);
>  void evergreen_print_gpu_status_regs(struct radeon_device *rdev);
> +u32 evergreen_gpu_check_soft_reset(struct radeon_device *rdev);
>
>  #endif /* __RADEON_EVERGREEN_H__ */
> diff --git a/drivers/gpu/drm/radeon/evergreen_dma.c 
> b/drivers/gpu/drm/radeon/evergreen_dma.c
> index 767857d4a8c5c..52c79da1ecf57 100644
> --- a/drivers/gpu/drm/radeon/evergreen_dma.c
> +++ b/drivers/gpu/drm/radeon/evergreen_dma.c
> @@ -24,10 +24,9 @@
>
>  #include "radeon.h"
>  #include "radeon_asic.h"
> +#include "evergreen.h"
>  #include "evergreend.h"
>
> -u32 evergreen_gpu_check_soft_reset(struct radeon_device *rdev);
> -
>  /**
>   * evergreen_dma_fence_ring_emit - emit a fence on the DMA ring
>   *
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 22/43] drm/radeon/cik: Move 'r600_ih_ring_{alloc, fini}()'s prototypes to shared header

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:38 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/r600.c:3480:5: warning: no previous prototype for 
> ‘r600_ih_ring_alloc’ [-Wmissing-prototypes]
>  3480 | int r600_ih_ring_alloc(struct radeon_device *rdev)
>  | ^~
>  drivers/gpu/drm/radeon/r600.c:3516:6: warning: no previous prototype for 
> ‘r600_ih_ring_fini’ [-Wmissing-prototypes]
>  3516 | void r600_ih_ring_fini(struct radeon_device *rdev)
>  | ^
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: Sumit Semwal 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Cc: linux-me...@vger.kernel.org
> Cc: linaro-mm-...@lists.linaro.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/cik.c  | 3 +--
>  drivers/gpu/drm/radeon/r600.h | 2 ++
>  drivers/gpu/drm/radeon/si.c   | 3 +--
>  3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
> index 315c4f3df3656..980b50d046cbc 100644
> --- a/drivers/gpu/drm/radeon/cik.c
> +++ b/drivers/gpu/drm/radeon/cik.c
> @@ -34,6 +34,7 @@
>  #include "cik_blit_shaders.h"
>  #include "cikd.h"
>  #include "clearstate_ci.h"
> +#include "r600.h"
>  #include "radeon.h"
>  #include "radeon_asic.h"
>  #include "radeon_audio.h"
> @@ -125,8 +126,6 @@ MODULE_FIRMWARE("radeon/mullins_mec.bin");
>  MODULE_FIRMWARE("radeon/mullins_rlc.bin");
>  MODULE_FIRMWARE("radeon/mullins_sdma.bin");
>
> -extern int r600_ih_ring_alloc(struct radeon_device *rdev);
> -extern void r600_ih_ring_fini(struct radeon_device *rdev);
>  extern void si_vram_gtt_location(struct radeon_device *rdev, struct 
> radeon_mc *mc);
>  extern void si_rlc_reset(struct radeon_device *rdev);
>  extern void si_init_uvd_internal_cg(struct radeon_device *rdev);
> diff --git a/drivers/gpu/drm/radeon/r600.h b/drivers/gpu/drm/radeon/r600.h
> index 2a3915f0039e4..e66ef58706cd8 100644
> --- a/drivers/gpu/drm/radeon/r600.h
> +++ b/drivers/gpu/drm/radeon/r600.h
> @@ -31,5 +31,7 @@
>  struct radeon_device;
>
>  u32 r600_gpu_check_soft_reset(struct radeon_device *rdev);
> +int r600_ih_ring_alloc(struct radeon_device *rdev);
> +void r600_ih_ring_fini(struct radeon_device *rdev);
>
>  #endif /* __R600_H__ */
> diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c
> index 45076c27d7ded..d0407145c07b5 100644
> --- a/drivers/gpu/drm/radeon/si.c
> +++ b/drivers/gpu/drm/radeon/si.c
> @@ -33,6 +33,7 @@
>  #include "atom.h"
>  #include "clearstate_si.h"
>  #include "evergreen.h"
> +#include "r600.h"
>  #include "radeon.h"
>  #include "radeon_asic.h"
>  #include "radeon_audio.h"
> @@ -128,8 +129,6 @@ static void si_pcie_gen3_enable(struct radeon_device 
> *rdev);
>  static void si_program_aspm(struct radeon_device *rdev);
>  extern void sumo_rlc_fini(struct radeon_device *rdev);
>  extern int sumo_rlc_init(struct radeon_device *rdev);
> -extern int r600_ih_ring_alloc(struct radeon_device *rdev);
> -extern void r600_ih_ring_fini(struct radeon_device *rdev);
>  static void si_enable_gui_idle_interrupt(struct radeon_device *rdev,
>  bool enable);
>  static void si_init_pg(struct radeon_device *rdev);
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 21/43] drm/radeon/r600_dma: Move 'r600_gpu_check_soft_reset()'s prototype to shared location

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:38 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/r600.c:1615:5: warning: no previous prototype for 
> ‘r600_gpu_check_soft_reset’ [-Wmissing-prototypes]
>  1615 | u32 r600_gpu_check_soft_reset(struct radeon_device *rdev)
>  | ^
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: Sumit Semwal 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Cc: linux-me...@vger.kernel.org
> Cc: linaro-mm-...@lists.linaro.org
> Signed-off-by: Lee Jones 

Applied with minor changes.  Thanks!

Alex


> ---
>  drivers/gpu/drm/radeon/r600.c |  1 +
>  drivers/gpu/drm/radeon/r600.h | 35 +++
>  drivers/gpu/drm/radeon/r600_dma.c |  3 +--
>  3 files changed, 37 insertions(+), 2 deletions(-)
>  create mode 100644 drivers/gpu/drm/radeon/r600.h
>
> diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
> index f09b6dc5cbeb3..94e8815e5067d 100644
> --- a/drivers/gpu/drm/radeon/r600.c
> +++ b/drivers/gpu/drm/radeon/r600.c
> @@ -39,6 +39,7 @@
>
>  #include "atom.h"
>  #include "avivod.h"
> +#include "r600.h"
>  #include "r600d.h"
>  #include "rv770.h"
>  #include "radeon.h"
> diff --git a/drivers/gpu/drm/radeon/r600.h b/drivers/gpu/drm/radeon/r600.h
> new file mode 100644
> index 0..2a3915f0039e4
> --- /dev/null
> +++ b/drivers/gpu/drm/radeon/r600.h
> @@ -0,0 +1,35 @@
> +/* r600.h -- Private header for radeon driver -*- linux-c -*-
> + *
> + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
> + * Copyright 2000 VA Linux Systems, Inc., Fremont, California.
> + * All rights reserved.
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
> + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 
> OTHER
> + * DEALINGS IN THE SOFTWARE.
> + *
> + */
> +
> +#ifndef __R600_H__
> +#define __R600_H__
> +
> +struct radeon_device;
> +
> +u32 r600_gpu_check_soft_reset(struct radeon_device *rdev);
> +
> +#endif /* __R600_H__ */
> diff --git a/drivers/gpu/drm/radeon/r600_dma.c 
> b/drivers/gpu/drm/radeon/r600_dma.c
> index af6c0da45f28a..89ca2738c5d4c 100644
> --- a/drivers/gpu/drm/radeon/r600_dma.c
> +++ b/drivers/gpu/drm/radeon/r600_dma.c
> @@ -24,10 +24,9 @@
>
>  #include "radeon.h"
>  #include "radeon_asic.h"
> +#include "r600.h"
>  #include "r600d.h"
>
> -u32 r600_gpu_check_soft_reset(struct radeon_device *rdev);
> -
>  /*
>   * DMA
>   * Starting with R600, the GPU has an asynchronous
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 20/43] drm/radeon/evergreen: Move 'cayman_*()'s prototypes to shared header

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:38 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/ni.c:1378:6: warning: no previous prototype for 
> ‘cayman_cp_int_cntl_setup’ [-Wmissing-prototypes]
>  1378 | void cayman_cp_int_cntl_setup(struct radeon_device *rdev,
>  | ^~~~
>  drivers/gpu/drm/radeon/ni.c:1732:5: warning: no previous prototype for 
> ‘cayman_gpu_check_soft_reset’ [-Wmissing-prototypes]
>  1732 | u32 cayman_gpu_check_soft_reset(struct radeon_device *rdev)
>  | ^~~
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Applied with minor changes.  Thanks!

Alex


> ---
>  drivers/gpu/drm/radeon/evergreen.c |  5 +---
>  drivers/gpu/drm/radeon/ni.c|  1 +
>  drivers/gpu/drm/radeon/ni.h| 38 ++
>  3 files changed, 40 insertions(+), 4 deletions(-)
>  create mode 100644 drivers/gpu/drm/radeon/ni.h
>
> diff --git a/drivers/gpu/drm/radeon/evergreen.c 
> b/drivers/gpu/drm/radeon/evergreen.c
> index f860f5ef2df88..8fb0b8c3db5b5 100644
> --- a/drivers/gpu/drm/radeon/evergreen.c
> +++ b/drivers/gpu/drm/radeon/evergreen.c
> @@ -31,6 +31,7 @@
>
>  #include "atom.h"
>  #include "avivod.h"
> +#include "ni.h"
>  #include "rv770.h"
>  #include "evergreen.h"
>  #include "evergreen_blit_shaders.h"
> @@ -215,10 +216,6 @@ static void evergreen_gpu_init(struct radeon_device 
> *rdev);
>  void evergreen_fini(struct radeon_device *rdev);
>  void evergreen_pcie_gen2_enable(struct radeon_device *rdev);
>  void evergreen_program_aspm(struct radeon_device *rdev);
> -extern void cayman_cp_int_cntl_setup(struct radeon_device *rdev,
> -int ring, u32 cp_int_cntl);
> -extern void cayman_vm_decode_fault(struct radeon_device *rdev,
> -  u32 status, u32 addr);
>  void cik_init_cp_pg_table(struct radeon_device *rdev);
>
>  extern u32 si_get_csb_size(struct radeon_device *rdev);
> diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c
> index 1c9030a4631b8..ab7bd30802176 100644
> --- a/drivers/gpu/drm/radeon/ni.c
> +++ b/drivers/gpu/drm/radeon/ni.c
> @@ -33,6 +33,7 @@
>  #include "cayman_blit_shaders.h"
>  #include "clearstate_cayman.h"
>  #include "evergreen.h"
> +#include "ni.h"
>  #include "ni_reg.h"
>  #include "nid.h"
>  #include "radeon.h"
> diff --git a/drivers/gpu/drm/radeon/ni.h b/drivers/gpu/drm/radeon/ni.h
> new file mode 100644
> index 0..d63be1c88c0f1
> --- /dev/null
> +++ b/drivers/gpu/drm/radeon/ni.h
> @@ -0,0 +1,38 @@
> +/* ni.h -- Private header for radeon driver -*- linux-c -*-
> + *
> + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
> + * Copyright 2000 VA Linux Systems, Inc., Fremont, California.
> + * All rights reserved.
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
> + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 
> OTHER
> + * DEALINGS IN THE SOFTWARE.
> + *
> + */
> +
> +#ifndef __NI_H__
> +#define __NI_H__
> +
> +struct radeon_device;
> +
> +void cayman_cp_int_cntl_setup(struct radeon_device *rdev,
> + int ring, u32 cp_int_cntl);
> +void cayman_vm_decode_fault(struct radeon_device *rdev,
> +   u32 status, u32 addr);
> +
> +#endif /* __NI_H__ */
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 19/43] drm/radeon/ni_dpm: Move 'ni_get_{pi, ps}()'s into shared header

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:38 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/ni_dpm.c:727:23: warning: no previous prototype for 
> ‘ni_get_pi’ [-Wmissing-prototypes]
>  727 | struct ni_power_info *ni_get_pi(struct radeon_device *rdev)
>  | ^
>  drivers/gpu/drm/radeon/ni_dpm.c:734:15: warning: no previous prototype for 
> ‘ni_get_ps’ [-Wmissing-prototypes]
>  734 | struct ni_ps *ni_get_ps(struct radeon_ps *rps)
>  | ^
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/ni_dpm.h | 3 +++
>  drivers/gpu/drm/radeon/si_dpm.c | 3 +--
>  2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/ni_dpm.h b/drivers/gpu/drm/radeon/ni_dpm.h
> index 6bbee9180909e..74e3019369063 100644
> --- a/drivers/gpu/drm/radeon/ni_dpm.h
> +++ b/drivers/gpu/drm/radeon/ni_dpm.h
> @@ -247,4 +247,7 @@ void ni_set_uvd_clock_after_set_eng_clock(struct 
> radeon_device *rdev,
>
>  bool ni_dpm_vblank_too_short(struct radeon_device *rdev);
>
> +struct ni_power_info *ni_get_pi(struct radeon_device *rdev);
> +struct ni_ps *ni_get_ps(struct radeon_ps *rps);
> +
>  #endif
> diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c
> index a80a21447a76d..c68ab2fb1ac23 100644
> --- a/drivers/gpu/drm/radeon/si_dpm.c
> +++ b/drivers/gpu/drm/radeon/si_dpm.c
> @@ -30,6 +30,7 @@
>  #include "rv770.h"
>  #include "radeon.h"
>  #include "radeon_asic.h"
> +#include "ni_dpm.h"
>  #include "si_dpm.h"
>  #include "sid.h"
>
> @@ -1719,8 +1720,6 @@ static const struct si_powertune_data 
> powertune_data_hainan =
>  };
>
>  struct evergreen_power_info *evergreen_get_pi(struct radeon_device *rdev);
> -struct ni_power_info *ni_get_pi(struct radeon_device *rdev);
> -struct ni_ps *ni_get_ps(struct radeon_ps *rps);
>
>  extern int si_mc_load_microcode(struct radeon_device *rdev);
>  extern void vce_v1_0_enable_mgcg(struct radeon_device *rdev, bool enable);
> --
> 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 2/4] drm/meson: Unbind all connectors on module removal

2020-11-16 Thread Marc Zyngier
Removing the meson DRM module results in the following splats:

[   42.689228] WARNING: CPU: 0 PID: 572 at drivers/gpu/drm/drm_irq.c:192 
drm_irq_uninstall+0x130/0x160 [drm]
[...]
[   42.812820] Hardware name:  , BIOS 2021.01-rc2-00012-gde865f7ee1 11/16/2020
[   42.819723] pstate: 80400089 (Nzcv daIf +PAN -UAO -TCO BTYPE=--)
[   42.825737] pc : drm_irq_uninstall+0x130/0x160 [drm]
[   42.830647] lr : drm_irq_uninstall+0xc4/0x160 [drm]
[...]
[   42.917614] Call trace:
[   42.920086]  drm_irq_uninstall+0x130/0x160 [drm]
[   42.924612]  meson_drv_unbind+0x68/0xa4 [meson_drm]
[   42.929436]  component_del+0xc0/0x180
[   42.933058]  meson_dw_hdmi_remove+0x28/0x40 [meson_dw_hdmi]
[   42.938576]  platform_drv_remove+0x38/0x60
[   42.942628]  __device_release_driver+0x190/0x23c
[   42.947198]  driver_detach+0xcc/0x160
[   42.950822]  bus_remove_driver+0x68/0xe0
[   42.954702]  driver_unregister+0x3c/0x6c
[   42.958583]  platform_driver_unregister+0x20/0x2c
[   42.963243]  meson_dw_hdmi_platform_driver_exit+0x18/0x4a8 [meson_dw_hdmi]
[   42.970057]  __arm64_sys_delete_module+0x1bc/0x294
[   42.974801]  el0_svc_common.constprop.0+0x80/0x240
[   42.979542]  do_el0_svc+0x30/0xa0
[   42.982821]  el0_svc+0x18/0x50
[   42.985839]  el0_sync_handler+0x198/0x404
[   42.989806]  el0_sync+0x158/0x180

immediatelly followed by

[   43.002296] WARNING: CPU: 0 PID: 572 at 
drivers/gpu/drm/drm_mode_config.c:504 drm_mode_config_cleanup+0x2a8/0x304 [drm]
[...]
[   43.128150] Hardware name:  , BIOS 2021.01-rc2-00012-gde865f7ee1 11/16/2020
[   43.135052] pstate: 8049 (Nzcv daif +PAN -UAO -TCO BTYPE=--)
[   43.141062] pc : drm_mode_config_cleanup+0x2a8/0x304 [drm]
[   43.146492] lr : drm_mode_config_cleanup+0xac/0x304 [drm]
[...]
[   43.233979] Call trace:
[   43.236451]  drm_mode_config_cleanup+0x2a8/0x304 [drm]
[   43.241538]  drm_mode_config_init_release+0x1c/0x2c [drm]
[   43.246886]  drm_managed_release+0xa8/0x120 [drm]
[   43.251543]  drm_dev_put+0x94/0xc0 [drm]
[   43.255380]  meson_drv_unbind+0x78/0xa4 [meson_drm]
[   43.260204]  component_del+0xc0/0x180
[   43.263829]  meson_dw_hdmi_remove+0x28/0x40 [meson_dw_hdmi]
[   43.269344]  platform_drv_remove+0x38/0x60
[   43.273398]  __device_release_driver+0x190/0x23c
[   43.277967]  driver_detach+0xcc/0x160
[   43.281590]  bus_remove_driver+0x68/0xe0
[   43.285471]  driver_unregister+0x3c/0x6c
[   43.289352]  platform_driver_unregister+0x20/0x2c
[   43.294011]  meson_dw_hdmi_platform_driver_exit+0x18/0x4a8 [meson_dw_hdmi]
[   43.300826]  __arm64_sys_delete_module+0x1bc/0x294
[   43.305570]  el0_svc_common.constprop.0+0x80/0x240
[   43.310312]  do_el0_svc+0x30/0xa0
[   43.313590]  el0_svc+0x18/0x50
[   43.316608]  el0_sync_handler+0x198/0x404
[   43.320574]  el0_sync+0x158/0x180
[   43.323852] ---[ end trace d796a3072dab01da ]---
[   43.328561] [drm:drm_mode_config_cleanup [drm]] *ERROR* connector HDMI-A-1 
leaked!

both triggered by the fact that the HDMI subsystem is still active,
and the DRM removal doesn't result in the connectors being torn down.

Call drm_atomic_helper_shutdown() and component_unbind_all() to safely
tear the module down.

Signed-off-by: Marc Zyngier 
---
 drivers/gpu/drm/meson/meson_drv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/meson/meson_drv.c 
b/drivers/gpu/drm/meson/meson_drv.c
index 324fa489f1c4..3d1de9cbb1c8 100644
--- a/drivers/gpu/drm/meson/meson_drv.c
+++ b/drivers/gpu/drm/meson/meson_drv.c
@@ -390,8 +390,10 @@ static void meson_drv_unbind(struct device *dev)
}
 
drm_dev_unregister(drm);
-   drm_irq_uninstall(drm);
drm_kms_helper_poll_fini(drm);
+   drm_atomic_helper_shutdown(drm);
+   component_unbind_all(dev, drm);
+   drm_irq_uninstall(drm);
drm_dev_put(drm);
 
if (priv->afbcd.ops) {
-- 
2.28.0

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


[PATCH 3/4] drm/meson: dw-hdmi: Register a callback to disable the regulator

2020-11-16 Thread Marc Zyngier
Removing the meson-dw-hdmi module results in the following splat:

i[   43.340509] WARNING: CPU: 0 PID: 572 at drivers/regulator/core.c:2125 
_regulator_put.part.0+0x16c/0x174
[...]
[   43.454870] CPU: 0 PID: 572 Comm: modprobe Tainted: GW   E 
5.10.0-rc4-00049-gd274813a4de3-dirty #2147
[   43.465042] Hardware name:  , BIOS 2021.01-rc2-00012-gde865f7ee1 11/16/2020
[   43.471945] pstate: 8049 (Nzcv daif +PAN -UAO -TCO BTYPE=--)
[   43.477896] pc : _regulator_put.part.0+0x16c/0x174
[   43.482638] lr : regulator_put+0x44/0x60
[...]
[   43.568715] Call trace:
[   43.571132]  _regulator_put.part.0+0x16c/0x174
[   43.575529]  regulator_put+0x44/0x60
[   43.579067]  devm_regulator_release+0x20/0x2c
[   43.583380]  release_nodes+0x1c8/0x2b4
[   43.587087]  devres_release_all+0x44/0x6c
[   43.591056]  __device_release_driver+0x1a0/0x23c
[   43.595626]  driver_detach+0xcc/0x160
[   43.599249]  bus_remove_driver+0x68/0xe0
[   43.603130]  driver_unregister+0x3c/0x6c
[   43.607011]  platform_driver_unregister+0x20/0x2c
[   43.611678]  meson_dw_hdmi_platform_driver_exit+0x18/0x4a8 [meson_dw_hdmi]
[   43.618485]  __arm64_sys_delete_module+0x1bc/0x294

as the HDMI regulator is still enabled on release.

In order to address this, register a callback that will deal with
the disabling when the driver is unbound, solving the problem.

Signed-off-by: Marc Zyngier 
---
 drivers/gpu/drm/meson/meson_dw_hdmi.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c 
b/drivers/gpu/drm/meson/meson_dw_hdmi.c
index 29a8ff41595d..68826cf9993f 100644
--- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
+++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
@@ -941,6 +941,11 @@ static void meson_dw_hdmi_init(struct meson_dw_hdmi 
*meson_dw_hdmi)
 
 }
 
+static void meson_disable_regulator(void *data)
+{
+   regulator_disable(data);
+}
+
 static int meson_dw_hdmi_bind(struct device *dev, struct device *master,
void *data)
 {
@@ -989,6 +994,10 @@ static int meson_dw_hdmi_bind(struct device *dev, struct 
device *master,
ret = regulator_enable(meson_dw_hdmi->hdmi_supply);
if (ret)
return ret;
+   ret = devm_add_action_or_reset(dev, meson_disable_regulator,
+  meson_dw_hdmi->hdmi_supply);
+   if (ret)
+   return ret;
}
 
meson_dw_hdmi->hdmitx_apb = devm_reset_control_get_exclusive(dev,
-- 
2.28.0

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


[PATCH 0/4] drm/meson: Module removal fixes

2020-11-16 Thread Marc Zyngier
Hi all,

Having recently moved over to a top-of-the-tree u-boot on one of my
VIM3L systems in order to benefit from unrelated improvements
(automatic PCIe detection, EFI...), I faced the issue that my kernel
would hang like this:

[  OK  ] Finished Helper to synchronize boot up for ifupdown.
[  OK  ] Started Rule-based Manager for Device Events and Files.
[7.114516] VDDCPU: supplied by regulator-dummy
[  OK  ] Found device /dev/ttyAML0.
[7.146862] meson-drm ff90.vpu: Queued 2 outputs on vpu
[7.169630] fb0: switching to meson-drm-fb from simple
[7.169944] Console: switching to colour dummy device 80x25
[7.179250] meson-drm ff90.vpu: CVBS Output connector not available

and that's it.

After some poking around, I figured out that it is in the
meson-dw-hdmi module that the CPU was hanging...

Reverting to the kernel DT instead of u-boot's papered over it
somehow, but it turned out that removing the module (modprobe -r)
resulted in a firework. And for every issue I was fixing, another
followed. Much fun for a rainy Monday in the basement!

I ended up with the following 4 patches, which solve all my problems:
I can now boot with the u-boot provided DT, and the hdmi and DRM
drivers can be removed and re-inserted at will.

The first patch is a straightforward use-after-free, causing a NULL
pointer dereference. Moving things around fixes it.

The second patch shows that I have no clue about the DRM subsystem
whatsoever. I mimicked what my Rockchip systems are doing, and the two
warnings disappeared. It can't completely be wrong (famous last
words...).

The third patch fixes a *very* common issue with regulators (I've
fixed at least 3 drivers with a similar issue). I guess the devm
subsystem needs to grow a new helper at some point.

The last patch finally fixes the issue I was seeing: the HDMI driver
hangs when accessing a register with clocks disabled, which they are
on module removal. It also fixes my u-boot booting for similar
reasons, I guess.

I went as far as reaching out for a HDMI cable and verifying that I
was getting a working display. Total dedication.

Feedback much appreciated.

M.

Marc Zyngier (4):
  drm/meson: Free RDMA resources after tearing down DRM
  drm/meson: Unbind all connectors on module removal
  drm/meson: dw-hdmi: Register a callback to disable the regulator
  drm/meson: dw-hdmi: Ensure that clocks are enabled before touching the
TOP registers

 drivers/gpu/drm/meson/meson_drv.c | 12 +++-
 drivers/gpu/drm/meson/meson_dw_hdmi.c | 13 +++--
 2 files changed, 18 insertions(+), 7 deletions(-)

-- 
2.28.0

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


[PATCH 4/4] drm/meson: dw-hdmi: Ensure that clocks are enabled before touching the TOP registers

2020-11-16 Thread Marc Zyngier
Removing the meson-dw-hdmi module and re-inserting it results in a hang
as the driver writes to HDMITX_TOP_SW_RESET. Similar effects can be seen
when booting with mainline u-boot and using the u-boot provided DT (which
is highly desirable).

The reason for the hang seem to be that the clocks are not always
enabled by the time we enter meson_dw_hdmi_init(). Moving this call
*after* dw_hdmi_probe() ensures that the clocks are enabled.

Signed-off-by: Marc Zyngier 
---
 drivers/gpu/drm/meson/meson_dw_hdmi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c 
b/drivers/gpu/drm/meson/meson_dw_hdmi.c
index 68826cf9993f..7f8eea494147 100644
--- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
+++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
@@ -1073,8 +1073,6 @@ static int meson_dw_hdmi_bind(struct device *dev, struct 
device *master,
 
DRM_DEBUG_DRIVER("encoder initialized\n");
 
-   meson_dw_hdmi_init(meson_dw_hdmi);
-
/* Bridge / Connector */
 
dw_plat_data->priv_data = meson_dw_hdmi;
@@ -1097,6 +1095,8 @@ static int meson_dw_hdmi_bind(struct device *dev, struct 
device *master,
if (IS_ERR(meson_dw_hdmi->hdmi))
return PTR_ERR(meson_dw_hdmi->hdmi);
 
+   meson_dw_hdmi_init(meson_dw_hdmi);
+
next_bridge = of_drm_find_bridge(pdev->dev.of_node);
if (next_bridge)
drm_bridge_attach(encoder, next_bridge,
-- 
2.28.0

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


[PATCH 1/4] drm/meson: Free RDMA resources after tearing down DRM

2020-11-16 Thread Marc Zyngier
Removing the meson DRM module results in the following splat:

[ 2179.451346] Hardware name:  , BIOS 2021.01-rc2-00012-gde865f7ee1 11/16/2020
[ 2179.458316] Workqueue: events drm_mode_rmfb_work_fn [drm]
[ 2179.463597] pstate: 80c9 (Nzcv daif +PAN +UAO -TCO BTYPE=--)
[ 2179.469558] pc : meson_rdma_writel_sync+0x44/0xb0 [meson_drm]
[ 2179.475243] lr : meson_g12a_afbcd_reset+0x34/0x60 [meson_drm]
[ 2179.480930] sp : ffc01212bb70
[ 2179.484207] x29: ffc01212bb70 x28: ff8044f66f00
[ 2179.489469] x27: ff8045b13800 x26: 0001
[ 2179.494730] x25:  x24: 0001
[ 2179.41] x23:  x22: 
[ 2179.505252] x21: 0028 x20: 1a01
[ 2179.510513] x19: ff8046029480 x18: 
[ 2179.515775] x17:  x16: 
[ 2179.521036] x15:  x14: 
[ 2179.526297] x13: 00400326 x12: 0309030303260300
[ 2179.531558] x11: 0300054004a0 x10: 0418054004000400
[ 2179.536820] x9 : ffc008fe4914 x8 : ff8040a1adc0
[ 2179.542081] x7 :  x6 : ff8042aa0080
[ 2179.547342] x5 : ff8044f66f00 x4 : ffc008fe5bc8
[ 2179.552603] x3 : 00010101 x2 : 0001
[ 2179.557865] x1 :  x0 : 
[ 2179.563127] Call trace:
[ 2179.565548]  meson_rdma_writel_sync+0x44/0xb0 [meson_drm]
[ 2179.570894]  meson_g12a_afbcd_reset+0x34/0x60 [meson_drm]
[ 2179.576241]  meson_plane_atomic_disable+0x38/0xb0 [meson_drm]
[ 2179.581966]  drm_atomic_helper_commit_planes+0x1e0/0x21c [drm_kms_helper]
[ 2179.588684]  drm_atomic_helper_commit_tail_rpm+0x68/0xb0 [drm_kms_helper]
[ 2179.595410]  commit_tail+0xac/0x190 [drm_kms_helper]
[ 2179.600326]  drm_atomic_helper_commit+0x16c/0x390 [drm_kms_helper]
[ 2179.606484]  drm_atomic_commit+0x58/0x70 [drm]
[ 2179.610880]  drm_framebuffer_remove+0x398/0x434 [drm]
[ 2179.615881]  drm_mode_rmfb_work_fn+0x68/0x8c [drm]
[ 2179.620575]  process_one_work+0x1cc/0x49c
[ 2179.624538]  worker_thread+0x200/0x444
[ 2179.628246]  kthread+0x14c/0x160
[ 2179.631439]  ret_from_fork+0x10/0x38

caused by the fact that the RDMA buffer has already been freed,
resulting in meson_rdma_writel_sync() getting a NULL pointer.

Move the afbcd reset and meson_rdma_free calls after the DRM
unregistration is complete so that the teardown can safely complete.

Signed-off-by: Marc Zyngier 
---
 drivers/gpu/drm/meson/meson_drv.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/meson/meson_drv.c 
b/drivers/gpu/drm/meson/meson_drv.c
index 8b9c8dd788c4..324fa489f1c4 100644
--- a/drivers/gpu/drm/meson/meson_drv.c
+++ b/drivers/gpu/drm/meson/meson_drv.c
@@ -389,15 +389,15 @@ static void meson_drv_unbind(struct device *dev)
meson_canvas_free(priv->canvas, priv->canvas_id_vd1_2);
}
 
-   if (priv->afbcd.ops) {
-   priv->afbcd.ops->reset(priv);
-   meson_rdma_free(priv);
-   }
-
drm_dev_unregister(drm);
drm_irq_uninstall(drm);
drm_kms_helper_poll_fini(drm);
drm_dev_put(drm);
+
+   if (priv->afbcd.ops) {
+   priv->afbcd.ops->reset(priv);
+   meson_rdma_free(priv);
+   }
 }
 
 static const struct component_master_ops meson_drv_master_ops = {
-- 
2.28.0

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


Re: [PATCH 4/7] drm/radeon: Pin buffers while they are vmap'ed

2020-11-16 Thread Thomas Zimmermann
Hi

Am 16.11.20 um 12:28 schrieb Christian König:
> Am 13.11.20 um 08:59 schrieb Thomas Zimmermann:
>> Hi Christian
>>
>> Am 12.11.20 um 18:16 schrieb Christian König:
>>> Am 12.11.20 um 14:21 schrieb Thomas Zimmermann:
 In order to avoid eviction of vmap'ed buffers, pin them in their GEM
 object's vmap implementation. Unpin them in the vunmap implementation.
 This is needed to make generic fbdev support work reliably. Without,
 the buffer object could be evicted while fbdev flushed its shadow
 buffer.

 In difference to the PRIME pin/unpin functions, the vmap code does not
 modify the BOs prime_shared_count, so a vmap-pinned BO does not
 count as
 shared.

 The actual pin location is not important as the vmap call returns
 information on how to access the buffer. Callers that require a
 specific location should explicitly pin the BO before vmapping it.
>>> Well is the buffer supposed to be scanned out?
>> No, not by the fbdev helper.
> 
> Ok in this case that should work.
> 
>>> If yes then the pin location is actually rather important since the
>>> hardware can only scan out from VRAM.
>> For relocatable BOs, fbdev uses a shadow buffer that makes all any
>> relocation transparent to userspace. It flushes the shadow fb into the
>> BO's memory if there are updates. The code is in
>> drm_fb_helper_dirty_work(). [1] During the flush operation, the vmap
>> call now pins the BO to wherever it is. The actual location does not
>> matter. It's vunmap'ed immediately afterwards.
> 
> The problem is what happens when it is prepared for scanout, but can't
> be moved to VRAM because it is vmapped?
> 
> When the shadow is never scanned out that isn't a problem, but we need
> to keep that in mind.

I sent out a patchset that addresses the issue in it's final patch. [1]
I'd appreciate your feedback. It also tested the patches with the
converted radeon driver.

Best regards
Thomas

[1] https://patchwork.freedesktop.org/series/83918/

> 
> Regards,
> Christian.
> 
>>
>> For dma-buf sharing, the regular procedure of pin + vmap still apply.
>> This should always move the BO into GTT-managed memory.
>>
>> Best regards
>> Thomas
>>
>> [1]
>> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.kernel.org%2Fpub%2Fscm%2Flinux%2Fkernel%2Fgit%2Ftorvalds%2Flinux.git%2Ftree%2Fdrivers%2Fgpu%2Fdrm%2Fdrm_fb_helper.c%23n432data=04%7C01%7Cchristian.koenig%40amd.com%7C31b890664ca7429fc45808d887aa0842%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637408511650629569%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000sdata=RLauuAuXkcl0rXwWWJ%2FrKP%2BsCr2wAzU1ejGV1bnQ80w%3Dreserved=0
>>
>>
>>> Regards,
>>> Christian.
>>>
 Signed-off-by: Thomas Zimmermann 
 ---
    drivers/gpu/drm/radeon/radeon_gem.c | 51
 +++--
    1 file changed, 49 insertions(+), 2 deletions(-)

 diff --git a/drivers/gpu/drm/radeon/radeon_gem.c
 b/drivers/gpu/drm/radeon/radeon_gem.c
 index d2876ce3bc9e..eaf7fc9a7b07 100644
 --- a/drivers/gpu/drm/radeon/radeon_gem.c
 +++ b/drivers/gpu/drm/radeon/radeon_gem.c
 @@ -226,6 +226,53 @@ static int radeon_gem_handle_lockup(struct
 radeon_device *rdev, int r)
    return r;
    }
    +static int radeon_gem_object_vmap(struct drm_gem_object *obj,
 struct dma_buf_map *map)
 +{
 +    static const uint32_t any_domain = RADEON_GEM_DOMAIN_VRAM |
 +   RADEON_GEM_DOMAIN_GTT |
 +   RADEON_GEM_DOMAIN_CPU;
 +
 +    struct radeon_bo *bo = gem_to_radeon_bo(obj);
 +    int ret;
 +
 +    ret = radeon_bo_reserve(bo, false);
 +    if (ret)
 +    return ret;
 +
 +    /* pin buffer at its current location */
 +    ret = radeon_bo_pin(bo, any_domain, NULL);
 +    if (ret)
 +    goto err_radeon_bo_unreserve;
 +
 +    ret = drm_gem_ttm_vmap(obj, map);
 +    if (ret)
 +    goto err_radeon_bo_unpin;
 +
 +    radeon_bo_unreserve(bo);
 +
 +    return 0;
 +
 +err_radeon_bo_unpin:
 +    radeon_bo_unpin(bo);
 +err_radeon_bo_unreserve:
 +    radeon_bo_unreserve(bo);
 +    return ret;
 +}
 +
 +static void radeon_gem_object_vunmap(struct drm_gem_object *obj,
 struct dma_buf_map *map)
 +{
 +    struct radeon_bo *bo = gem_to_radeon_bo(obj);
 +    int ret;
 +
 +    ret = radeon_bo_reserve(bo, false);
 +    if (ret)
 +    return;
 +
 +    drm_gem_ttm_vunmap(obj, map);
 +    radeon_bo_unpin(bo);
 +    radeon_bo_unreserve(bo);
 +}
 +
    static const struct drm_gem_object_funcs radeon_gem_object_funcs = {
    .free = radeon_gem_object_free,
    .open = radeon_gem_object_open,
 @@ -234,8 +281,8 @@ static const struct drm_gem_object_funcs
 radeon_gem_object_funcs = {
    .pin = 

Re: [PATCH 18/43] drm/radeon/rv770: Move 'rv770_get_*()'s prototypes to shared header

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:37 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/rv770_dpm.c:47:18: warning: no previous prototype for 
> ‘rv770_get_ps’ [-Wmissing-prototypes]
>  47 | struct rv7xx_ps *rv770_get_ps(struct radeon_ps *rps)
>  | ^~~~
>  drivers/gpu/drm/radeon/rv770_dpm.c:54:26: warning: no previous prototype for 
> ‘rv770_get_pi’ [-Wmissing-prototypes]
>  54 | struct rv7xx_power_info *rv770_get_pi(struct radeon_device *rdev)
>  | ^~~~
>
> Cc: Evan Quan 
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex


> ---
>  drivers/gpu/drm/radeon/btc_dpm.c | 3 +--
>  drivers/gpu/drm/radeon/cypress_dpm.c | 3 +--
>  drivers/gpu/drm/radeon/ni_dpm.c  | 2 +-
>  drivers/gpu/drm/radeon/rv730_dpm.c   | 4 +---
>  drivers/gpu/drm/radeon/rv740_dpm.c   | 3 +--
>  drivers/gpu/drm/radeon/rv770.h   | 4 
>  drivers/gpu/drm/radeon/rv770_dpm.c   | 1 +
>  drivers/gpu/drm/radeon/si_dpm.c  | 2 +-
>  8 files changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/btc_dpm.c 
> b/drivers/gpu/drm/radeon/btc_dpm.c
> index d1d8aaf8323c2..018949668536e 100644
> --- a/drivers/gpu/drm/radeon/btc_dpm.c
> +++ b/drivers/gpu/drm/radeon/btc_dpm.c
> @@ -30,6 +30,7 @@
>  #include "btcd.h"
>  #include "cypress_dpm.h"
>  #include "r600_dpm.h"
> +#include "rv770.h"
>  #include "radeon.h"
>  #include "radeon_asic.h"
>
> @@ -48,8 +49,6 @@
>  #ifndef BTC_MGCG_SEQUENCE
>  #define BTC_MGCG_SEQUENCE  300
>
> -struct rv7xx_ps *rv770_get_ps(struct radeon_ps *rps);
> -struct rv7xx_power_info *rv770_get_pi(struct radeon_device *rdev);
>  struct evergreen_power_info *evergreen_get_pi(struct radeon_device *rdev);
>
>  extern int ni_mc_load_microcode(struct radeon_device *rdev);
> diff --git a/drivers/gpu/drm/radeon/cypress_dpm.c 
> b/drivers/gpu/drm/radeon/cypress_dpm.c
> index 35b177d777913..6d3690bcca2d2 100644
> --- a/drivers/gpu/drm/radeon/cypress_dpm.c
> +++ b/drivers/gpu/drm/radeon/cypress_dpm.c
> @@ -28,6 +28,7 @@
>  #include "cypress_dpm.h"
>  #include "evergreend.h"
>  #include "r600_dpm.h"
> +#include "rv770.h"
>  #include "radeon.h"
>  #include "radeon_asic.h"
>
> @@ -43,8 +44,6 @@
>  #define MC_CG_SEQ_YCLK_SUSPEND  0x04
>  #define MC_CG_SEQ_YCLK_RESUME   0x0a
>
> -struct rv7xx_ps *rv770_get_ps(struct radeon_ps *rps);
> -struct rv7xx_power_info *rv770_get_pi(struct radeon_device *rdev);
>  struct evergreen_power_info *evergreen_get_pi(struct radeon_device *rdev);
>
>  static void cypress_enable_bif_dynamic_pcie_gen2(struct radeon_device *rdev,
> diff --git a/drivers/gpu/drm/radeon/ni_dpm.c b/drivers/gpu/drm/radeon/ni_dpm.c
> index 59cdadcece159..d39bbd9793cc2 100644
> --- a/drivers/gpu/drm/radeon/ni_dpm.c
> +++ b/drivers/gpu/drm/radeon/ni_dpm.c
> @@ -29,6 +29,7 @@
>  #include "ni_dpm.h"
>  #include "nid.h"
>  #include "r600_dpm.h"
> +#include "rv770.h"
>  #include "radeon.h"
>  #include "radeon_asic.h"
>
> @@ -719,7 +720,6 @@ static const u32 cayman_sysls_enable[] =
>  };
>  #define CAYMAN_SYSLS_ENABLE_LENGTH sizeof(cayman_sysls_enable) / (3 * 
> sizeof(u32))
>
> -struct rv7xx_power_info *rv770_get_pi(struct radeon_device *rdev);
>  struct evergreen_power_info *evergreen_get_pi(struct radeon_device *rdev);
>
>  extern int ni_mc_load_microcode(struct radeon_device *rdev);
> diff --git a/drivers/gpu/drm/radeon/rv730_dpm.c 
> b/drivers/gpu/drm/radeon/rv730_dpm.c
> index 84a3d6d724866..a9de5c953396a 100644
> --- a/drivers/gpu/drm/radeon/rv730_dpm.c
> +++ b/drivers/gpu/drm/radeon/rv730_dpm.c
> @@ -25,6 +25,7 @@
>  #include "radeon.h"
>  #include "rv730d.h"
>  #include "r600_dpm.h"
> +#include "rv770.h"
>  #include "rv770_dpm.h"
>  #include "atom.h"
>
> @@ -33,9 +34,6 @@
>  #define MC_CG_ARB_FREQ_F2   0x0c
>  #define MC_CG_ARB_FREQ_F3   0x0d
>
> -struct rv7xx_ps *rv770_get_ps(struct radeon_ps *rps);
> -struct rv7xx_power_info *rv770_get_pi(struct radeon_device *rdev);
> -
>  int rv730_populate_sclk_value(struct radeon_device *rdev,
>   u32 engine_clock,
>   RV770_SMC_SCLK_VALUE *sclk)
> diff --git a/drivers/gpu/drm/radeon/rv740_dpm.c 
> b/drivers/gpu/drm/radeon/rv740_dpm.c
> index 327d65a76e1f4..d57a3e1df8d63 100644
> --- a/drivers/gpu/drm/radeon/rv740_dpm.c
> +++ b/drivers/gpu/drm/radeon/rv740_dpm.c
> @@ -25,11 +25,10 @@
>  #include "radeon.h"
>  #include "rv740d.h"
>  #include "r600_dpm.h"
> +#include "rv770.h"
>  #include "rv770_dpm.h"
>  #include "atom.h"
>
> -struct rv7xx_power_info *rv770_get_pi(struct radeon_device *rdev);
> -
>  u32 rv740_get_decoded_reference_divider(u32 encoded_ref)
>  {
> u32 ref = 0;
> diff --git a/drivers/gpu/drm/radeon/rv770.h b/drivers/gpu/drm/radeon/rv770.h
> index a3f2bb44979fe..0e15916d0a948 100644
> --- a/drivers/gpu/drm/radeon/rv770.h
> +++ 

[PATCH 08/10] drm/fb-helper: Restore damage area upon errors

2020-11-16 Thread Thomas Zimmermann
If the damage handling fails, restore the damage area. The next invocation
of the damage worker will then perform the update.

Signed-off-by: Thomas Zimmermann 
---
 drivers/gpu/drm/drm_fb_helper.c | 23 ---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 2e1a335bafd2..13b65dad2ca8 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -431,11 +431,28 @@ static void drm_fb_helper_damage_work(struct work_struct 
*work)
if (helper->buffer) {
ret = drm_fb_helper_damage_blit(helper, _copy);
if (ret)
-   return;
+   goto err;
}
 
-   if (helper->fb->funcs->dirty)
-   helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, _copy, 1);
+   if (helper->fb->funcs->dirty) {
+   ret = helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, 
_copy, 1);
+   if (ret)
+   goto err;
+   }
+
+   return;
+
+err:
+   /*
+* Restore damage clip rectangle on errors. Next instance of damage
+* worker will perform the update.
+*/
+   spin_lock_irqsave(>damage_lock, flags);
+   clip->x1 = min_t(u32, clip->x1, clip_copy.x1);
+   clip->y1 = min_t(u32, clip->y1, clip_copy.y1);
+   clip->x2 = max_t(u32, clip->x2, clip_copy.x2);
+   clip->y2 = max_t(u32, clip->y2, clip_copy.y2);
+   spin_unlock_irqrestore(>damage_lock, flags);
 }
 
 /**
-- 
2.29.2

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


[PATCH 06/10] drm/fb-helper: Separate shadow-buffer flushing and calling dirty callback

2020-11-16 Thread Thomas Zimmermann
Flushing the shadow framebuffer and invoking the dirty callback are two
separate operations, so do them seprately. The flush operation is paired
with calls to vmap and vunmap. They are not needed for the dirty callback,
which performs its own invocations if necessary.

Signed-off-by: Thomas Zimmermann 
---
 drivers/gpu/drm/drm_fb_helper.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 741ac8254a6e..213c6aa4bfa4 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -417,13 +417,11 @@ static void drm_fb_helper_damage_work(struct work_struct 
*work)
if (ret)
return;
drm_fb_helper_damage_blit_real(helper, _copy, );
+   drm_client_buffer_vunmap(helper->buffer);
}
 
if (helper->fb->funcs->dirty)
helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, _copy, 1);
-
-   if (helper->buffer)
-   drm_client_buffer_vunmap(helper->buffer);
 }
 
 /**
-- 
2.29.2

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


[PATCH 03/10] drm/client: Depend on GEM object kmap ref-counting

2020-11-16 Thread Thomas Zimmermann
DRM client's vmap/vunmap functions don't allow for multiple vmap
operations. Calling drm_client_buffer_vmap() twice returns the same
mapping, then calling drm_client_buffer_vunmap() twice already unmaps
on the first call. This leads to unbalanced vmap refcounts. Fix this
by calling drm_gem_vmap() unconditionally in drm_client_buffer_vmap().

All drivers that support DRM clients have to implement correct ref-
counting for their vmap operations, or not vunmap at all. This is the
case for drivers that use CMA, SHMEM and VRAM helpers, and QXL. Other
drivers are not affected.

Signed-off-by: Thomas Zimmermann 
---
 drivers/gpu/drm/drm_client.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_client.c b/drivers/gpu/drm/drm_client.c
index fe573acf1067..ce45e380f4a2 100644
--- a/drivers/gpu/drm/drm_client.c
+++ b/drivers/gpu/drm/drm_client.c
@@ -314,9 +314,6 @@ drm_client_buffer_vmap(struct drm_client_buffer *buffer, 
struct dma_buf_map *map
struct dma_buf_map *map = >map;
int ret;
 
-   if (dma_buf_map_is_set(map))
-   goto out;
-
/*
 * FIXME: The dependency on GEM here isn't required, we could
 * convert the driver handle to a dma-buf instead and use the
@@ -329,7 +326,6 @@ drm_client_buffer_vmap(struct drm_client_buffer *buffer, 
struct dma_buf_map *map
if (ret)
return ret;
 
-out:
*map_copy = *map;
 
return 0;
-- 
2.29.2

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


[PATCH 01/10] drm/fb-helper: Call dirty helper after writing to fbdev

2020-11-16 Thread Thomas Zimmermann
If fbdev uses a shadow framebuffer, call the damage handler. Otherwise
the update might not make it to the screen.

Signed-off-by: Thomas Zimmermann 
Fixes: 222ec45f4c69 ("drm/fb_helper: Support framebuffers in I/O memory")
Cc: Thomas Zimmermann 
Cc: Daniel Vetter 
Cc: Sam Ravnborg 
Cc: Maarten Lankhorst 
Cc: Maxime Ripard 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Gerd Hoffmann 
Cc: dri-devel@lists.freedesktop.org
Cc: virtualizat...@lists.linux-foundation.org
---
 drivers/gpu/drm/drm_fb_helper.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 25edf670867c..ee1a19e22df2 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -2189,6 +2189,9 @@ static ssize_t drm_fbdev_fb_write(struct fb_info *info, 
const char __user *buf,
if (ret > 0)
*ppos += ret;
 
+   if (ret > 0)
+   drm_fb_helper_dirty(info, 0, 0, info->var.xres, info->var.yres);
+
return ret ? ret : err;
 }
 
-- 
2.29.2

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


[PATCH 05/10] drm/fb-helper: Return early in dirty worker

2020-11-16 Thread Thomas Zimmermann
Returning early in the dirty worker if no update is required makes the
code more readable. No functional changes are made.

Signed-off-by: Thomas Zimmermann 
---
 drivers/gpu/drm/drm_fb_helper.c | 31 +++
 1 file changed, 15 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 58db64cdbfa1..741ac8254a6e 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -407,24 +407,23 @@ static void drm_fb_helper_damage_work(struct work_struct 
*work)
clip->x2 = clip->y2 = 0;
spin_unlock_irqrestore(>damage_lock, flags);
 
-   /* call dirty callback only when it has been really touched */
-   if (clip_copy.x1 < clip_copy.x2 && clip_copy.y1 < clip_copy.y2) {
-
-   /* Generic fbdev uses a shadow buffer */
-   if (helper->buffer) {
-   ret = drm_client_buffer_vmap(helper->buffer, );
-   if (ret)
-   return;
-   drm_fb_helper_damage_blit_real(helper, _copy, 
);
-   }
-
-   if (helper->fb->funcs->dirty)
-   helper->fb->funcs->dirty(helper->fb, NULL, 0, 0,
-_copy, 1);
+   /* Call damage handlers only if necessary */
+   if (!(clip_copy.x1 < clip_copy.x2 && clip_copy.y1 < clip_copy.y2))
+   return;
 
-   if (helper->buffer)
-   drm_client_buffer_vunmap(helper->buffer);
+   /* Generic fbdev uses a shadow buffer */
+   if (helper->buffer) {
+   ret = drm_client_buffer_vmap(helper->buffer, );
+   if (ret)
+   return;
+   drm_fb_helper_damage_blit_real(helper, _copy, );
}
+
+   if (helper->fb->funcs->dirty)
+   helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, _copy, 1);
+
+   if (helper->buffer)
+   drm_client_buffer_vunmap(helper->buffer);
 }
 
 /**
-- 
2.29.2

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


[PATCH 02/10] drm/fb-helper: Unmap client buffer during shutdown

2020-11-16 Thread Thomas Zimmermann
The fbdev helper's generic probe function establishes a mapping for
framebuffers without shadow buffer. The clean-up function did not unmap
the buffer object. Add the unmap operation.

As fbdev devices are usally released during system shutdown, this has
not been a problem in practice.

Signed-off-by: Thomas Zimmermann 
---
 drivers/gpu/drm/drm_fb_helper.c | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index ee1a19e22df2..bdc6c9382f8c 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -1988,14 +1988,19 @@ static void drm_fbdev_cleanup(struct drm_fb_helper 
*fb_helper)
if (!fb_helper->dev)
return;
 
-   if (fbi && fbi->fbdefio) {
-   fb_deferred_io_cleanup(fbi);
-   shadow = fbi->screen_buffer;
+   if (fbi) {
+   if (fbi->fbdefio)
+   fb_deferred_io_cleanup(fbi);
+   if (drm_fbdev_use_shadow_fb(fb_helper))
+   shadow = fbi->screen_buffer;
}
 
drm_fb_helper_fini(fb_helper);
 
-   vfree(shadow);
+   if (shadow)
+   vfree(shadow);
+   else
+   drm_client_buffer_vunmap(fb_helper->buffer);
 
drm_client_framebuffer_delete(fb_helper->buffer);
 }
-- 
2.29.2

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


[PATCH 09/10] drm/fb-helper: Copy dma-buf map before flushing shadow fb

2020-11-16 Thread Thomas Zimmermann
Copy the vmap()'ed instance of struct dma_buf_map before modifying it,
in case the implementation of vunmap() depends on the exact address.

Signed-off-by: Thomas Zimmermann 
---
 drivers/gpu/drm/drm_fb_helper.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 13b65dad2ca8..5a22c744378c 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -395,14 +395,15 @@ static int drm_fb_helper_damage_blit(struct drm_fb_helper 
*fb_helper,
 struct drm_clip_rect *clip)
 {
struct drm_client_buffer *buffer = fb_helper->buffer;
-   struct dma_buf_map map;
+   struct dma_buf_map map, dst;
int ret;
 
ret = drm_client_buffer_vmap(buffer, );
if (ret)
return ret;
 
-   drm_fb_helper_damage_blit_real(fb_helper, clip, );
+   dst = map;
+   drm_fb_helper_damage_blit_real(fb_helper, clip, );
 
drm_client_buffer_vunmap(buffer);
 
-- 
2.29.2

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


[PATCH 07/10] drm/fb-helper: Move damage blit code and its setup into separate routine

2020-11-16 Thread Thomas Zimmermann
Introduce a separate function for the blit code and its vmap setup. Done
in preparation of additional changes. No functional changes are made.

Signed-off-by: Thomas Zimmermann 
---
 drivers/gpu/drm/drm_fb_helper.c | 24 +++-
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 213c6aa4bfa4..2e1a335bafd2 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -391,6 +391,24 @@ static void drm_fb_helper_damage_blit_real(struct 
drm_fb_helper *fb_helper,
}
 }
 
+static int drm_fb_helper_damage_blit(struct drm_fb_helper *fb_helper,
+struct drm_clip_rect *clip)
+{
+   struct drm_client_buffer *buffer = fb_helper->buffer;
+   struct dma_buf_map map;
+   int ret;
+
+   ret = drm_client_buffer_vmap(buffer, );
+   if (ret)
+   return ret;
+
+   drm_fb_helper_damage_blit_real(fb_helper, clip, );
+
+   drm_client_buffer_vunmap(buffer);
+
+   return 0;
+}
+
 static void drm_fb_helper_damage_work(struct work_struct *work)
 {
struct drm_fb_helper *helper = container_of(work, struct drm_fb_helper,
@@ -398,7 +416,6 @@ static void drm_fb_helper_damage_work(struct work_struct 
*work)
struct drm_clip_rect *clip = >damage_clip;
struct drm_clip_rect clip_copy;
unsigned long flags;
-   struct dma_buf_map map;
int ret;
 
spin_lock_irqsave(>damage_lock, flags);
@@ -411,13 +428,10 @@ static void drm_fb_helper_damage_work(struct work_struct 
*work)
if (!(clip_copy.x1 < clip_copy.x2 && clip_copy.y1 < clip_copy.y2))
return;
 
-   /* Generic fbdev uses a shadow buffer */
if (helper->buffer) {
-   ret = drm_client_buffer_vmap(helper->buffer, );
+   ret = drm_fb_helper_damage_blit(helper, _copy);
if (ret)
return;
-   drm_fb_helper_damage_blit_real(helper, _copy, );
-   drm_client_buffer_vunmap(helper->buffer);
}
 
if (helper->fb->funcs->dirty)
-- 
2.29.2

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


[PATCH 00/10] drm/fb-helper: Various fixes and cleanups

2020-11-16 Thread Thomas Zimmermann
Here's a number of fb-helper patches that have been piling up recently.

Patches 1 to 3 fix bugs that I spotted while going through the code.
Because of the way the fbdev code works, they have been avoided so far.

Patches 4 to 7 cleanup damage handling for fbdev's shadow buffer and
fix a few issues.

Specifically, the final patch adds locking to the code that flushes the
shadow framebuffer into BO memory. During the conversion of radeon to
generic fbdev, the question came up about interference with concurrent
modesets. If fbdev has the BO pinned in system memory for flushing while
the modeset wants to pin it to VRAM for scanout, the modeset would
most likely fail. We haven't seen that so far, but it's possible at
least. Acquiring modeset locks during the flush operation prevents
concurrent modesets from taking place.

The code has been tested with SHMEM and TTM BOs; with atomic and non-
atomic modesetting.

[1] https://patchwork.freedesktop.org/patch/400054/?series=83765=1

Thomas Zimmermann (10):
  drm/fb-helper: Call dirty helper after writing to fbdev
  drm/fb-helper: Unmap client buffer during shutdown
  drm/client: Depend on GEM object kmap ref-counting
  drm/fb-helper: Rename dirty worker to damage worker
  drm/fb-helper: Return early in dirty worker
  drm/fb-helper: Separate shadow-buffer flushing and calling dirty
callback
  drm/fb-helper: Move damage blit code and its setup into separate
routine
  drm/fb-helper: Restore damage area upon errors
  drm/fb-helper: Copy dma-buf map before flushing shadow fb
  drm/fb-helper: Acquire modeset lock around shadow-buffer flushing

 drivers/gpu/drm/drm_client.c|   4 -
 drivers/gpu/drm/drm_fb_helper.c | 177 ++--
 include/drm/drm_fb_helper.h |  14 +--
 3 files changed, 130 insertions(+), 65 deletions(-)

--
2.29.2

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


[PATCH 10/10] drm/fb-helper: Acquire modeset lock around shadow-buffer flushing

2020-11-16 Thread Thomas Zimmermann
Flushing the fbdev's shadow buffer requires vmap'ing the BO memory, which
in turn requires pinning the BO. While being pinned, the BO cannot be moved
into VRAM for scanout. Consequently, a concurrent modeset operation that
involves the fbdev framebuffer would likely fail.

Resolve this problem be acquiring the modeset lock of the planes that use
the fbdev framebuffer. On non-atomic drivers, also acquire the mode-config
lock. This serializes the flushing of the framebuffer with concurrent
modeset operations.

Signed-off-by: Thomas Zimmermann 
---
 drivers/gpu/drm/drm_fb_helper.c | 43 +++--
 1 file changed, 41 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 5a22c744378c..af485c71a42a 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -394,20 +394,59 @@ static void drm_fb_helper_damage_blit_real(struct 
drm_fb_helper *fb_helper,
 static int drm_fb_helper_damage_blit(struct drm_fb_helper *fb_helper,
 struct drm_clip_rect *clip)
 {
+   struct drm_device *dev = fb_helper->dev;
+   struct drm_framebuffer *fb = fb_helper->fb;
struct drm_client_buffer *buffer = fb_helper->buffer;
+   struct drm_modeset_acquire_ctx ctx;
+   struct drm_framebuffer *plane_fb;
+   struct drm_plane *plane;
struct dma_buf_map map, dst;
int ret;
 
+   if (!drm_drv_uses_atomic_modeset(dev))
+   mutex_lock(>mode_config.mutex);
+
+   drm_modeset_acquire_init(, 0);
+
+retry:
+   drm_for_each_plane(plane, dev) {
+   ret = drm_modeset_lock(>mutex, );
+   if (ret == -EDEADLK) {
+   ret = drm_modeset_backoff();
+   if (!ret)
+   goto retry;
+   } else if (ret) {
+   goto out;
+   }
+
+   if (drm_drv_uses_atomic_modeset(dev))
+   plane_fb = plane->state->fb;
+   else
+   plane_fb = plane->fb;
+
+   if (plane_fb != fb) {
+   drm_modeset_unlock(>mutex);
+   continue;
+   }
+   }
+
ret = drm_client_buffer_vmap(buffer, );
if (ret)
-   return ret;
+   goto out;
 
dst = map;
drm_fb_helper_damage_blit_real(fb_helper, clip, );
 
drm_client_buffer_vunmap(buffer);
 
-   return 0;
+out:
+   drm_modeset_drop_locks();
+   drm_modeset_acquire_fini();
+
+   if (!drm_drv_uses_atomic_modeset(dev))
+   mutex_unlock(>mode_config.mutex);
+
+   return ret;
 }
 
 static void drm_fb_helper_damage_work(struct work_struct *work)
-- 
2.29.2

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


[PATCH 04/10] drm/fb-helper: Rename dirty worker to damage worker

2020-11-16 Thread Thomas Zimmermann
The dirty worker handles all damage updates, instead of just calling
the framebuffer's dirty callback. Rename it to damage worker. Also
rename related variables accordingly. No functional changes are made.

Signed-off-by: Thomas Zimmermann 
---
 drivers/gpu/drm/drm_fb_helper.c | 65 +++--
 include/drm/drm_fb_helper.h | 14 +++
 2 files changed, 36 insertions(+), 43 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index bdc6c9382f8c..58db64cdbfa1 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -371,9 +371,9 @@ static void drm_fb_helper_resume_worker(struct work_struct 
*work)
console_unlock();
 }
 
-static void drm_fb_helper_dirty_blit_real(struct drm_fb_helper *fb_helper,
- struct drm_clip_rect *clip,
- struct dma_buf_map *dst)
+static void drm_fb_helper_damage_blit_real(struct drm_fb_helper *fb_helper,
+  struct drm_clip_rect *clip,
+  struct dma_buf_map *dst)
 {
struct drm_framebuffer *fb = fb_helper->fb;
unsigned int cpp = fb->format->cpp[0];
@@ -391,21 +391,21 @@ static void drm_fb_helper_dirty_blit_real(struct 
drm_fb_helper *fb_helper,
}
 }
 
-static void drm_fb_helper_dirty_work(struct work_struct *work)
+static void drm_fb_helper_damage_work(struct work_struct *work)
 {
struct drm_fb_helper *helper = container_of(work, struct drm_fb_helper,
-   dirty_work);
-   struct drm_clip_rect *clip = >dirty_clip;
+   damage_work);
+   struct drm_clip_rect *clip = >damage_clip;
struct drm_clip_rect clip_copy;
unsigned long flags;
struct dma_buf_map map;
int ret;
 
-   spin_lock_irqsave(>dirty_lock, flags);
+   spin_lock_irqsave(>damage_lock, flags);
clip_copy = *clip;
clip->x1 = clip->y1 = ~0;
clip->x2 = clip->y2 = 0;
-   spin_unlock_irqrestore(>dirty_lock, flags);
+   spin_unlock_irqrestore(>damage_lock, flags);
 
/* call dirty callback only when it has been really touched */
if (clip_copy.x1 < clip_copy.x2 && clip_copy.y1 < clip_copy.y2) {
@@ -415,7 +415,7 @@ static void drm_fb_helper_dirty_work(struct work_struct 
*work)
ret = drm_client_buffer_vmap(helper->buffer, );
if (ret)
return;
-   drm_fb_helper_dirty_blit_real(helper, _copy, );
+   drm_fb_helper_damage_blit_real(helper, _copy, 
);
}
 
if (helper->fb->funcs->dirty)
@@ -440,10 +440,10 @@ void drm_fb_helper_prepare(struct drm_device *dev, struct 
drm_fb_helper *helper,
   const struct drm_fb_helper_funcs *funcs)
 {
INIT_LIST_HEAD(>kernel_fb_list);
-   spin_lock_init(>dirty_lock);
+   spin_lock_init(>damage_lock);
INIT_WORK(>resume_work, drm_fb_helper_resume_worker);
-   INIT_WORK(>dirty_work, drm_fb_helper_dirty_work);
-   helper->dirty_clip.x1 = helper->dirty_clip.y1 = ~0;
+   INIT_WORK(>damage_work, drm_fb_helper_damage_work);
+   helper->damage_clip.x1 = helper->damage_clip.y1 = ~0;
mutex_init(>lock);
helper->funcs = funcs;
helper->dev = dev;
@@ -579,7 +579,7 @@ void drm_fb_helper_fini(struct drm_fb_helper *fb_helper)
return;
 
cancel_work_sync(_helper->resume_work);
-   cancel_work_sync(_helper->dirty_work);
+   cancel_work_sync(_helper->damage_work);
 
info = fb_helper->fbdev;
if (info) {
@@ -614,30 +614,30 @@ static bool drm_fbdev_use_shadow_fb(struct drm_fb_helper 
*fb_helper)
   fb->funcs->dirty;
 }
 
-static void drm_fb_helper_dirty(struct fb_info *info, u32 x, u32 y,
-   u32 width, u32 height)
+static void drm_fb_helper_damage(struct fb_info *info, u32 x, u32 y,
+u32 width, u32 height)
 {
struct drm_fb_helper *helper = info->par;
-   struct drm_clip_rect *clip = >dirty_clip;
+   struct drm_clip_rect *clip = >damage_clip;
unsigned long flags;
 
if (!drm_fbdev_use_shadow_fb(helper))
return;
 
-   spin_lock_irqsave(>dirty_lock, flags);
+   spin_lock_irqsave(>damage_lock, flags);
clip->x1 = min_t(u32, clip->x1, x);
clip->y1 = min_t(u32, clip->y1, y);
clip->x2 = max_t(u32, clip->x2, x + width);
clip->y2 = max_t(u32, clip->y2, y + height);
-   spin_unlock_irqrestore(>dirty_lock, flags);
+   spin_unlock_irqrestore(>damage_lock, flags);
 
-   schedule_work(>dirty_work);
+   schedule_work(>damage_work);
 }
 
 /**
  * drm_fb_helper_deferred_io() - fbdev deferred_io callback function
  * @info: 

Re: [PATCH 17/43] drm/radeon/evergreen_hdmi: Move 'evergreen_*()' and 'dce4_*()' HDMI prototypes to shared header

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:37 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/evergreen_hdmi.c:37:6: warning: no previous prototype 
> for ‘dce4_audio_enable’ [-Wmissing-prototypes]
>  drivers/gpu/drm/radeon/evergreen_hdmi.c:67:6: warning: no previous prototype 
> for ‘evergreen_hdmi_update_acr’ [-Wmissing-prototypes]
>  drivers/gpu/drm/radeon/evergreen_hdmi.c:97:6: warning: no previous prototype 
> for ‘dce4_afmt_write_latency_fields’ [-Wmissing-prototypes]
>  drivers/gpu/drm/radeon/evergreen_hdmi.c:119:6: warning: no previous 
> prototype for ‘dce4_afmt_hdmi_write_speaker_allocation’ [-Wmissing-prototypes]
>  drivers/gpu/drm/radeon/evergreen_hdmi.c:137:6: warning: no previous 
> prototype for ‘dce4_afmt_dp_write_speaker_allocation’ [-Wmissing-prototypes]
>  drivers/gpu/drm/radeon/evergreen_hdmi.c:155:6: warning: no previous 
> prototype for ‘evergreen_hdmi_write_sad_regs’ [-Wmissing-prototypes]
>  drivers/gpu/drm/radeon/evergreen_hdmi.c:208:6: warning: no previous 
> prototype for ‘evergreen_set_avi_packet’ [-Wmissing-prototypes]
>  drivers/gpu/drm/radeon/evergreen_hdmi.c:227:6: warning: no previous 
> prototype for ‘dce4_hdmi_audio_set_dto’ [-Wmissing-prototypes]
>  drivers/gpu/drm/radeon/evergreen_hdmi.c:270:6: warning: no previous 
> prototype for ‘dce4_dp_audio_set_dto’ [-Wmissing-prototypes]
>  drivers/gpu/drm/radeon/evergreen_hdmi.c:306:6: warning: no previous 
> prototype for ‘dce4_set_vbi_packet’ [-Wmissing-prototypes]
>  drivers/gpu/drm/radeon/evergreen_hdmi.c:317:6: warning: no previous 
> prototype for ‘dce4_hdmi_set_color_depth’ [-Wmissing-prototypes]
>  drivers/gpu/drm/radeon/evergreen_hdmi.c:354:6: warning: no previous 
> prototype for ‘dce4_set_audio_packet’ [-Wmissing-prototypes]
>  drivers/gpu/drm/radeon/evergreen_hdmi.c:389:6: warning: no previous 
> prototype for ‘dce4_set_mute’ [-Wmissing-prototypes]
>  drivers/gpu/drm/radeon/evergreen_hdmi.c:400:6: warning: no previous 
> prototype for ‘evergreen_hdmi_enable’ [-Wmissing-prototypes]
>  drivers/gpu/drm/radeon/evergreen_hdmi.c:440:6: warning: no previous 
> prototype for ‘evergreen_dp_enable’ [-Wmissing-prototypes]
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Applied with minor changes.  Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/evergreen_hdmi.c |  1 +
>  drivers/gpu/drm/radeon/evergreen_hdmi.h | 69 +
>  drivers/gpu/drm/radeon/radeon_audio.c   | 26 +-
>  3 files changed, 71 insertions(+), 25 deletions(-)
>  create mode 100644 drivers/gpu/drm/radeon/evergreen_hdmi.h
>
> diff --git a/drivers/gpu/drm/radeon/evergreen_hdmi.c 
> b/drivers/gpu/drm/radeon/evergreen_hdmi.c
> index 739336a48d085..5f3078f8ab950 100644
> --- a/drivers/gpu/drm/radeon/evergreen_hdmi.c
> +++ b/drivers/gpu/drm/radeon/evergreen_hdmi.c
> @@ -27,6 +27,7 @@
>  #include 
>
>  #include 
> +#include "evergreen_hdmi.h"
>  #include "radeon.h"
>  #include "radeon_asic.h"
>  #include "radeon_audio.h"
> diff --git a/drivers/gpu/drm/radeon/evergreen_hdmi.h 
> b/drivers/gpu/drm/radeon/evergreen_hdmi.h
> new file mode 100644
> index 0..c86276b8d7f58
> --- /dev/null
> +++ b/drivers/gpu/drm/radeon/evergreen_hdmi.h
> @@ -0,0 +1,69 @@
> +/* evergreen_hdmi.h -- Private header for radeon driver -*- linux-c -*-
> + *
> + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
> + * Copyright 2000 VA Linux Systems, Inc., Fremont, California.
> + * All rights reserved.
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
> + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 
> OTHER
> + * DEALINGS IN THE SOFTWARE.
> + *
> + */
> +
> +#ifndef __EVERGREEN_HDMI_H__
> +#define __EVERGREEN_HDMI_H__
> +
> +struct cea_sa;
> +struct cea_sad;
> +struct drm_connector;
> +struct drm_display_mode;
> +struct drm_encoder;
> +struct r600_audio_pin;

Re: [PATCH 16/43] drm/radeon/radeon_gem: Move 'radeon_gem_prime_*()'s prototypes to shared header

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:37 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/radeon_prime.c:34:18: warning: no previous prototype 
> for ‘radeon_gem_prime_get_sg_table’ [-Wmissing-prototypes]
>  34 | struct sg_table *radeon_gem_prime_get_sg_table(struct drm_gem_object 
> *obj)
>  | ^
>  drivers/gpu/drm/radeon/radeon_prime.c:42:7: warning: no previous prototype 
> for ‘radeon_gem_prime_vmap’ [-Wmissing-prototypes]
>  42 | void *radeon_gem_prime_vmap(struct drm_gem_object *obj)
>  | ^
>  drivers/gpu/drm/radeon/radeon_prime.c:55:6: warning: no previous prototype 
> for ‘radeon_gem_prime_vunmap’ [-Wmissing-prototypes]
>  55 | void radeon_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr)
>  | ^~~
>  drivers/gpu/drm/radeon/radeon_prime.c:62:24: warning: no previous prototype 
> for ‘radeon_gem_prime_import_sg_table’ [-Wmissing-prototypes]
>  62 | struct drm_gem_object *radeon_gem_prime_import_sg_table(struct 
> drm_device *dev,
>  | ^~~~
>  drivers/gpu/drm/radeon/radeon_prime.c:86:5: warning: no previous prototype 
> for ‘radeon_gem_prime_pin’ [-Wmissing-prototypes]
>  86 | int radeon_gem_prime_pin(struct drm_gem_object *obj)
>  | ^~~~
>  drivers/gpu/drm/radeon/radeon_prime.c:104:6: warning: no previous prototype 
> for ‘radeon_gem_prime_unpin’ [-Wmissing-prototypes]
>  104 | void radeon_gem_prime_unpin(struct drm_gem_object *obj)
>  | ^~
>  drivers/gpu/drm/radeon/radeon_prime.c:120:17: warning: no previous prototype 
> for ‘radeon_gem_prime_export’ [-Wmissing-prototypes]
>  120 | struct dma_buf *radeon_gem_prime_export(struct drm_gem_object *gobj,
>  | ^~~
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Applied with minor changes.  Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/radeon_gem.c   |  1 +
>  drivers/gpu/drm/radeon/radeon_prime.c |  1 +
>  drivers/gpu/drm/radeon/radeon_prime.h | 39 +++
>  3 files changed, 41 insertions(+)
>  create mode 100644 drivers/gpu/drm/radeon/radeon_prime.h
>
> diff --git a/drivers/gpu/drm/radeon/radeon_gem.c 
> b/drivers/gpu/drm/radeon/radeon_gem.c
> index d2876ce3bc9e2..b6b21d2e72624 100644
> --- a/drivers/gpu/drm/radeon/radeon_gem.c
> +++ b/drivers/gpu/drm/radeon/radeon_gem.c
> @@ -35,6 +35,7 @@
>  #include 
>
>  #include "radeon.h"
> +#include "radeon_prime.h"
>
>  struct dma_buf *radeon_gem_prime_export(struct drm_gem_object *gobj,
> int flags);
> diff --git a/drivers/gpu/drm/radeon/radeon_prime.c 
> b/drivers/gpu/drm/radeon/radeon_prime.c
> index 088d39a51c0d2..dd482edc819c5 100644
> --- a/drivers/gpu/drm/radeon/radeon_prime.c
> +++ b/drivers/gpu/drm/radeon/radeon_prime.c
> @@ -30,6 +30,7 @@
>  #include 
>
>  #include "radeon.h"
> +#include "radeon_prime.h"
>
>  struct sg_table *radeon_gem_prime_get_sg_table(struct drm_gem_object *obj)
>  {
> diff --git a/drivers/gpu/drm/radeon/radeon_prime.h 
> b/drivers/gpu/drm/radeon/radeon_prime.h
> new file mode 100644
> index 0..11b7f80987834
> --- /dev/null
> +++ b/drivers/gpu/drm/radeon/radeon_prime.h
> @@ -0,0 +1,39 @@
> +/* radeon_prime.h -- Private header for radeon driver -*- linux-c -*-
> + *
> + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
> + * Copyright 2000 VA Linux Systems, Inc., Fremont, California.
> + * All rights reserved.
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
> + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 
> OTHER
> + * DEALINGS IN THE SOFTWARE.
> + *
> + */
> +
> +#ifndef __RADEON_PRIME_H__
> +#define __RADEON_PRIME_H__
> +
> +struct dma_buf *radeon_gem_prime_export(struct drm_gem_object *gobj,
> +   int 

Re: [PATCH 15/43] drm/radeon/atom: Move 'radeon_atom_hw_i2c_*()'s prototypes into shared header

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:37 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/atombios_i2c.c:100:5: warning: no previous prototype 
> for ‘radeon_atom_hw_i2c_xfer’ [-Wmissing-prototypes]
>  100 | int radeon_atom_hw_i2c_xfer(struct i2c_adapter *i2c_adap,
>  | ^~~
>  drivers/gpu/drm/radeon/atombios_i2c.c:150:5: warning: no previous prototype 
> for ‘radeon_atom_hw_i2c_func’ [-Wmissing-prototypes]
>  150 | u32 radeon_atom_hw_i2c_func(struct i2c_adapter *adap)
>  | ^~~
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/atom.h   | 7 +++
>  drivers/gpu/drm/radeon/radeon_i2c.c | 4 
>  2 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/atom.h b/drivers/gpu/drm/radeon/atom.h
> index 1bf06c91cd959..5de0563b63d2e 100644
> --- a/drivers/gpu/drm/radeon/atom.h
> +++ b/drivers/gpu/drm/radeon/atom.h
> @@ -154,6 +154,13 @@ bool atom_parse_data_header(struct atom_context *ctx, 
> int index, uint16_t *size,
>  bool atom_parse_cmd_header(struct atom_context *ctx, int index,
>uint8_t *frev, uint8_t *crev);
>  int atom_allocate_fb_scratch(struct atom_context *ctx);
> +
> +struct i2c_msg;
> +struct i2c_adapter;
> +int radeon_atom_hw_i2c_xfer(struct i2c_adapter *i2c_adap,
> +   struct i2c_msg *msgs, int num);
> +u32 radeon_atom_hw_i2c_func(struct i2c_adapter *adap);
> +
>  #include "atom-types.h"
>  #include "atombios.h"
>  #include "ObjectID.h"
> diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c 
> b/drivers/gpu/drm/radeon/radeon_i2c.c
> index aa61b3cb4049c..e543d993f73ee 100644
> --- a/drivers/gpu/drm/radeon/radeon_i2c.c
> +++ b/drivers/gpu/drm/radeon/radeon_i2c.c
> @@ -34,10 +34,6 @@
>  #include "radeon.h"
>  #include "atom.h"
>
> -extern int radeon_atom_hw_i2c_xfer(struct i2c_adapter *i2c_adap,
> -  struct i2c_msg *msgs, int num);
> -extern u32 radeon_atom_hw_i2c_func(struct i2c_adapter *adap);
> -
>  bool radeon_ddc_probe(struct radeon_connector *radeon_connector, bool 
> use_aux)
>  {
> u8 out = 0x0;
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 14/43] drm/radeon/radeon_drv: Move 'radeon_driver_irq_handler_kms's prototype into shared header

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:37 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/radeon_irq_kms.c:53:13: warning: no previous 
> prototype for ‘radeon_driver_irq_handler_kms’ [-Wmissing-prototypes]
>  53 | irqreturn_t radeon_driver_irq_handler_kms(int irq, void *arg)
>  | ^
>  drivers/gpu/drm/radeon/radeon_irq_kms.c:120:6: warning: no previous 
> prototype for ‘radeon_driver_irq_preinstall_kms’ [-Wmissing-prototypes]
>  120 | void radeon_driver_irq_preinstall_kms(struct drm_device *dev)
>  | ^~~~
>  drivers/gpu/drm/radeon/radeon_irq_kms.c:152:5: warning: no previous 
> prototype for ‘radeon_driver_irq_postinstall_kms’ [-Wmissing-prototypes]
>  152 | int radeon_driver_irq_postinstall_kms(struct drm_device *dev)
>  | ^
>  drivers/gpu/drm/radeon/radeon_irq_kms.c:171:6: warning: no previous 
> prototype for ‘radeon_driver_irq_uninstall_kms’ [-Wmissing-prototypes]
>  171 | void radeon_driver_irq_uninstall_kms(struct drm_device *dev)
>  | ^~~
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: Gareth Hughes 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/radeon_drv.c | 5 +
>  drivers/gpu/drm/radeon/radeon_irq_kms.c | 1 +
>  drivers/gpu/drm/radeon/radeon_kms.h | 5 +
>  3 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c 
> b/drivers/gpu/drm/radeon/radeon_drv.c
> index 2b9deaead99b2..211932d73b191 100644
> --- a/drivers/gpu/drm/radeon/radeon_drv.c
> +++ b/drivers/gpu/drm/radeon/radeon_drv.c
> @@ -51,6 +51,7 @@
>  #include 
>
>  #include "radeon_drv.h"
> +#include "radeon_kms.h"
>  #include "radeon_ttm.h"
>  #include "radeon.h"
>  #include "radeon_device.h"
> @@ -117,10 +118,6 @@
>  int radeon_suspend_kms(struct drm_device *dev, bool suspend,
>bool fbcon, bool freeze);
>  int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon);
> -void radeon_driver_irq_preinstall_kms(struct drm_device *dev);
> -int radeon_driver_irq_postinstall_kms(struct drm_device *dev);
> -void radeon_driver_irq_uninstall_kms(struct drm_device *dev);
> -irqreturn_t radeon_driver_irq_handler_kms(int irq, void *arg);
>  extern int radeon_get_crtc_scanoutpos(struct drm_device *dev, unsigned int 
> crtc,
>   unsigned int flags, int *vpos, int 
> *hpos,
>   ktime_t *stime, ktime_t *etime,
> diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c 
> b/drivers/gpu/drm/radeon/radeon_irq_kms.c
> index a242b6053d47e..b8b7f627f0a9c 100644
> --- a/drivers/gpu/drm/radeon/radeon_irq_kms.c
> +++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c
> @@ -38,6 +38,7 @@
>
>  #include "atom.h"
>  #include "radeon.h"
> +#include "radeon_kms.h"
>  #include "radeon_reg.h"
>
>
> diff --git a/drivers/gpu/drm/radeon/radeon_kms.h 
> b/drivers/gpu/drm/radeon/radeon_kms.h
> index 36e73cea92154..913c8239d5d8d 100644
> --- a/drivers/gpu/drm/radeon/radeon_kms.h
> +++ b/drivers/gpu/drm/radeon/radeon_kms.h
> @@ -32,4 +32,9 @@ u32 radeon_get_vblank_counter_kms(struct drm_crtc *crtc);
>  int radeon_enable_vblank_kms(struct drm_crtc *crtc);
>  void radeon_disable_vblank_kms(struct drm_crtc *crtc);
>
> +irqreturn_t radeon_driver_irq_handler_kms(int irq, void *arg);
> +void radeon_driver_irq_preinstall_kms(struct drm_device *dev);
> +int radeon_driver_irq_postinstall_kms(struct drm_device *dev);
> +void radeon_driver_irq_uninstall_kms(struct drm_device *dev);
> +
>  #endif /* __RADEON_KMS_H__ */
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 13/43] drm/radeon/radeon_drv: Move 'radeon_mmap()'s prototype to shared header

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:37 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/radeon_ttm.c:931:5: warning: no previous prototype 
> for ‘radeon_mmap’ [-Wmissing-prototypes]
>  931 | int radeon_mmap(struct file *filp, struct vm_area_struct *vma)
>  | ^~~
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: Gareth Hughes 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/radeon_drv.c | 2 +-
>  drivers/gpu/drm/radeon/radeon_ttm.h | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c 
> b/drivers/gpu/drm/radeon/radeon_drv.c
> index 536b246b9a6aa..2b9deaead99b2 100644
> --- a/drivers/gpu/drm/radeon/radeon_drv.c
> +++ b/drivers/gpu/drm/radeon/radeon_drv.c
> @@ -51,6 +51,7 @@
>  #include 
>
>  #include "radeon_drv.h"
> +#include "radeon_ttm.h"
>  #include "radeon.h"
>  #include "radeon_device.h"
>
> @@ -125,7 +126,6 @@ extern int radeon_get_crtc_scanoutpos(struct drm_device 
> *dev, unsigned int crtc,
>   ktime_t *stime, ktime_t *etime,
>   const struct drm_display_mode *mode);
>  extern bool radeon_is_px(struct drm_device *dev);
> -int radeon_mmap(struct file *filp, struct vm_area_struct *vma);
>  int radeon_mode_dumb_mmap(struct drm_file *filp,
>   struct drm_device *dev,
>   uint32_t handle, uint64_t *offset_p);
> diff --git a/drivers/gpu/drm/radeon/radeon_ttm.h 
> b/drivers/gpu/drm/radeon/radeon_ttm.h
> index 91ea7141bc812..4d7b90ee27740 100644
> --- a/drivers/gpu/drm/radeon/radeon_ttm.h
> +++ b/drivers/gpu/drm/radeon/radeon_ttm.h
> @@ -32,5 +32,6 @@ struct radeon_device;
>
>  int radeon_ttm_init(struct radeon_device *rdev);
>  void radeon_ttm_fini(struct radeon_device *rdev);
> +int radeon_mmap(struct file *filp, struct vm_area_struct *vma);
>
>  #endif /* __RADEON_TTM_H__ */
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v4 05/27] drm: fix some kernel-doc markups

2020-11-16 Thread Daniel Vetter
On Mon, Nov 16, 2020 at 01:37:11PM +0200, Jani Nikula wrote:
> On Mon, 16 Nov 2020, Mauro Carvalho Chehab  wrote:
> > Some identifiers have different names between their prototypes
> > and the kernel-doc markup.
> >
> > Others need to be fixed, as kernel-doc markups should use this format:
> > identifier - description
> >
> > Signed-off-by: Mauro Carvalho Chehab 
> > ---
> >  drivers/gpu/drm/drm_atomic_state_helper.c | 2 +-
> >  drivers/gpu/drm/drm_connector.c   | 3 ++-
> >  drivers/gpu/drm/drm_dp_helper.c   | 2 +-
> >  drivers/gpu/drm/drm_framebuffer.c | 2 +-
> >  drivers/gpu/drm/drm_gem.c | 4 ++--
> >  drivers/gpu/drm/drm_gem_vram_helper.c | 2 +-
> >  drivers/gpu/drm/drm_mode_object.c | 2 +-
> >  drivers/gpu/drm/drm_modes.c   | 4 ++--
> >  drivers/gpu/drm/drm_scdc_helper.c | 2 +-
> >  drivers/gpu/drm/i915/display/intel_dpll_mgr.c | 2 +-
> >  drivers/gpu/drm/i915/i915_gem_evict.c | 2 +-
> >  drivers/gpu/drm/i915/i915_perf.c  | 8 +---
> 
> For the i915 parts,
> 
> Acked-by: Jani Nikula 
> 
> for merging via whichever tree.

Smashed into drm-misc-next.
-Daniel

> 
> >  drivers/gpu/drm/scheduler/sched_main.c| 2 +-
> >  drivers/gpu/drm/v3d/v3d_sched.c   | 2 +-
> >  drivers/gpu/drm/vc4/vc4_bo.c  | 2 +-
> >  include/drm/drm_atomic_helper.h   | 4 ++--
> >  include/drm/drm_connector.h   | 2 +-
> >  include/drm/drm_device.h  | 2 +-
> >  include/drm/drm_dsc.h | 3 ++-
> >  include/drm/drm_gem_vram_helper.h | 8 
> >  20 files changed, 32 insertions(+), 28 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c 
> > b/drivers/gpu/drm/drm_atomic_state_helper.c
> > index 9ad74045158e..ddcf5c2c8e6a 100644
> > --- a/drivers/gpu/drm/drm_atomic_state_helper.c
> > +++ b/drivers/gpu/drm/drm_atomic_state_helper.c
> > @@ -526,41 +526,41 @@ __drm_atomic_helper_connector_destroy_state(struct 
> > drm_connector_state *state)
> >  }
> >  EXPORT_SYMBOL(__drm_atomic_helper_connector_destroy_state);
> >  
> >  /**
> >   * drm_atomic_helper_connector_destroy_state - default state destroy hook
> >   * @connector: drm connector
> >   * @state: connector state object to release
> >   *
> >   * Default connector state destroy hook for drivers which don't have their 
> > own
> >   * subclassed connector state structure.
> >   */
> >  void drm_atomic_helper_connector_destroy_state(struct drm_connector 
> > *connector,
> >   struct drm_connector_state *state)
> >  {
> > __drm_atomic_helper_connector_destroy_state(state);
> > kfree(state);
> >  }
> >  EXPORT_SYMBOL(drm_atomic_helper_connector_destroy_state);
> >  
> >  /**
> > - * __drm_atomic_helper_private_duplicate_state - copy atomic private state
> > + * __drm_atomic_helper_private_obj_duplicate_state - copy atomic private 
> > state
> >   * @obj: CRTC object
> >   * @state: new private object state
> >   *
> >   * Copies atomic state from a private objects's current state and resets 
> > inferred values.
> >   * This is useful for drivers that subclass the private state.
> >   */
> >  void __drm_atomic_helper_private_obj_duplicate_state(struct 
> > drm_private_obj *obj,
> >  struct drm_private_state 
> > *state)
> >  {
> > memcpy(state, obj->state, sizeof(*state));
> >  }
> >  EXPORT_SYMBOL(__drm_atomic_helper_private_obj_duplicate_state);
> >  
> >  /**
> >   * __drm_atomic_helper_bridge_duplicate_state() - Copy atomic bridge state
> >   * @bridge: bridge object
> >   * @state: atomic bridge state
> >   *
> >   * Copies atomic state from a bridge's current state and resets inferred 
> > values.
> >   * This is useful for drivers that subclass the bridge state.
> > diff --git a/drivers/gpu/drm/drm_connector.c 
> > b/drivers/gpu/drm/drm_connector.c
> > index 1913d8b4e16a..98b6ec45ef96 100644
> > --- a/drivers/gpu/drm/drm_connector.c
> > +++ b/drivers/gpu/drm/drm_connector.c
> > @@ -1415,41 +1415,42 @@ void drm_hdmi_avi_infoframe_content_type(struct 
> > hdmi_avi_infoframe *frame,
> > break;
> > case DRM_MODE_CONTENT_TYPE_CINEMA:
> > frame->content_type = HDMI_CONTENT_TYPE_CINEMA;
> > break;
> > case DRM_MODE_CONTENT_TYPE_GAME:
> > frame->content_type = HDMI_CONTENT_TYPE_GAME;
> > break;
> > case DRM_MODE_CONTENT_TYPE_PHOTO:
> > frame->content_type = HDMI_CONTENT_TYPE_PHOTO;
> > break;
> > default:
> > /* Graphics is the default(0) */
> > frame->content_type = HDMI_CONTENT_TYPE_GRAPHICS;
> > }
> >  
> > frame->itc = conn_state->content_type != DRM_MODE_CONTENT_TYPE_NO_DATA;
> >  }
> >  EXPORT_SYMBOL(drm_hdmi_avi_infoframe_content_type);
> >  
> >  /**
> > - * 

Re: [PATCH 12/43] drm/radeon/evergreen: Move 'evergreen_*' and 'sumo_*' prototypes out to shared location

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:30 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/evergreen.c:1281:6: warning: no previous prototype 
> for ‘evergreen_fix_pci_max_read_req_size’ [-Wmissing-prototypes]
>  1281 | void evergreen_fix_pci_max_read_req_size(struct radeon_device *rdev)
>  | ^~~
>  drivers/gpu/drm/radeon/evergreen.c:2664:6: warning: no previous prototype 
> for ‘evergreen_mc_stop’ [-Wmissing-prototypes]
>  2664 | void evergreen_mc_stop(struct radeon_device *rdev, struct 
> evergreen_mc_save *save)
>  | ^
>  drivers/gpu/drm/radeon/evergreen.c:2762:6: warning: no previous prototype 
> for ‘evergreen_mc_resume’ [-Wmissing-prototypes]
>  2762 | void evergreen_mc_resume(struct radeon_device *rdev, struct 
> evergreen_mc_save *save)
>  | ^~~
>  drivers/gpu/drm/radeon/evergreen.c:2850:6: warning: no previous prototype 
> for ‘evergreen_mc_program’ [-Wmissing-prototypes]
>  2850 | void evergreen_mc_program(struct radeon_device *rdev)
>  | ^~~~
>  drivers/gpu/drm/radeon/evergreen.c:3710:5: warning: no previous prototype 
> for ‘evergreen_mc_init’ [-Wmissing-prototypes]
>  3710 | int evergreen_mc_init(struct radeon_device *rdev)
>  | ^
>  drivers/gpu/drm/radeon/evergreen.c:3769:6: warning: no previous prototype 
> for ‘evergreen_print_gpu_status_regs’ [-Wmissing-prototypes]
>  3769 | void evergreen_print_gpu_status_regs(struct radeon_device *rdev)
>  | ^~~
>  drivers/gpu/drm/radeon/evergreen.c:3797:6: warning: no previous prototype 
> for ‘evergreen_is_display_hung’ [-Wmissing-prototypes]
>  3797 | bool evergreen_is_display_hung(struct radeon_device *rdev)
>  | ^
>  drivers/gpu/drm/radeon/evergreen.c:4009:6: warning: no previous prototype 
> for ‘evergreen_gpu_pci_config_reset’ [-Wmissing-prototypes]
>  4009 | void evergreen_gpu_pci_config_reset(struct radeon_device *rdev)
>  | ^~
>  drivers/gpu/drm/radeon/evergreen.c:4110:6: warning: no previous prototype 
> for ‘sumo_rlc_fini’ [-Wmissing-prototypes]
>  4110 | void sumo_rlc_fini(struct radeon_device *rdev)
>  | ^
>  drivers/gpu/drm/radeon/evergreen.c:4153:5: warning: no previous prototype 
> for ‘sumo_rlc_init’ [-Wmissing-prototypes]
>  4153 | int sumo_rlc_init(struct radeon_device *rdev)
>  | ^
>  drivers/gpu/drm/radeon/evergreen.c:4381:5: warning: no previous prototype 
> for ‘evergreen_rlc_resume’ [-Wmissing-prototypes]
>  4381 | int evergreen_rlc_resume(struct radeon_device *rdev)
>  | ^
>  drivers/gpu/drm/radeon/evergreen.c:4670:6: warning: no previous prototype 
> for ‘evergreen_irq_suspend’ [-Wmissing-prototypes]
>  4670 | void evergreen_irq_suspend(struct radeon_device *rdev)
>  | ^
>
> NB: Lots more of these - snipped for brevity
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Applied with minor changes.  Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/cik.c   |  6 +---
>  drivers/gpu/drm/radeon/evergreen.c |  1 +
>  drivers/gpu/drm/radeon/evergreen.h | 51 ++
>  drivers/gpu/drm/radeon/ni.c| 16 +-
>  drivers/gpu/drm/radeon/si.c|  7 +---
>  5 files changed, 55 insertions(+), 26 deletions(-)
>  create mode 100644 drivers/gpu/drm/radeon/evergreen.h
>
> diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
> index abf370e16bd9f..315c4f3df3656 100644
> --- a/drivers/gpu/drm/radeon/cik.c
> +++ b/drivers/gpu/drm/radeon/cik.c
> @@ -30,6 +30,7 @@
>  #include 
>
>  #include "atom.h"
> +#include "evergreen.h"
>  #include "cik_blit_shaders.h"
>  #include "cikd.h"
>  #include "clearstate_ci.h"
> @@ -126,11 +127,6 @@ MODULE_FIRMWARE("radeon/mullins_sdma.bin");
>
>  extern int r600_ih_ring_alloc(struct radeon_device *rdev);
>  extern void r600_ih_ring_fini(struct radeon_device *rdev);
> -extern void evergreen_mc_stop(struct radeon_device *rdev, struct 
> evergreen_mc_save *save);
> -extern void evergreen_mc_resume(struct radeon_device *rdev, struct 
> evergreen_mc_save *save);
> -extern bool evergreen_is_display_hung(struct radeon_device *rdev);
> -extern void sumo_rlc_fini(struct radeon_device *rdev);
> -extern int sumo_rlc_init(struct radeon_device *rdev);
>  extern void si_vram_gtt_location(struct radeon_device *rdev, struct 
> radeon_mc *mc);
>  extern void si_rlc_reset(struct radeon_device *rdev);
>  extern void si_init_uvd_internal_cg(struct radeon_device *rdev);
> diff --git a/drivers/gpu/drm/radeon/evergreen.c 
> b/drivers/gpu/drm/radeon/evergreen.c
> index 9a1e240b07234..f860f5ef2df88 100644
> --- a/drivers/gpu/drm/radeon/evergreen.c
> +++ b/drivers/gpu/drm/radeon/evergreen.c
> @@ -32,6 +32,7 @@
>  #include "atom.h"
>  #include "avivod.h"
>  #include "rv770.h"
> 

Re: [PATCH 11/43] drm/radeon/radeon_audio: Move 'dce3_2_*' prototypes to shared location

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:30 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/dce3_1_afmt.c:30:6: warning: no previous prototype 
> for ‘dce3_2_afmt_hdmi_write_speaker_allocation’ [-Wmissing-prototypes]
>  30 | void dce3_2_afmt_hdmi_write_speaker_allocation(struct drm_encoder 
> *encoder,
>  | ^
>  drivers/gpu/drm/radeon/dce3_1_afmt.c:48:6: warning: no previous prototype 
> for ‘dce3_2_afmt_dp_write_speaker_allocation’ [-Wmissing-prototypes]
>  48 | void dce3_2_afmt_dp_write_speaker_allocation(struct drm_encoder 
> *encoder,
>  | ^~~
>  drivers/gpu/drm/radeon/dce3_1_afmt.c:66:6: warning: no previous prototype 
> for ‘dce3_2_afmt_write_sad_regs’ [-Wmissing-prototypes]
>  66 | void dce3_2_afmt_write_sad_regs(struct drm_encoder *encoder,
>  | ^~
>  drivers/gpu/drm/radeon/dce3_1_afmt.c:116:6: warning: no previous prototype 
> for ‘dce3_2_audio_set_dto’ [-Wmissing-prototypes]
>  116 | void dce3_2_audio_set_dto(struct radeon_device *rdev,
>  | ^~~~
>  drivers/gpu/drm/radeon/dce3_1_afmt.c:170:6: warning: no previous prototype 
> for ‘dce3_2_hdmi_update_acr’ [-Wmissing-prototypes]
>  170 | void dce3_2_hdmi_update_acr(struct drm_encoder *encoder, long offset,
>  | ^~
>  drivers/gpu/drm/radeon/dce3_1_afmt.c:202:6: warning: no previous prototype 
> for ‘dce3_2_set_audio_packet’ [-Wmissing-prototypes]
>  202 | void dce3_2_set_audio_packet(struct drm_encoder *encoder, u32 offset)
>  | ^~~
>  drivers/gpu/drm/radeon/dce3_1_afmt.c:223:6: warning: no previous prototype 
> for ‘dce3_2_set_mute’ [-Wmissing-prototypes]
>  223 | void dce3_2_set_mute(struct drm_encoder *encoder, u32 offset, bool 
> mute)
>  | ^~~
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: Slava Grigorev 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/radeon_audio.c | 12 
>  drivers/gpu/drm/radeon/radeon_audio.h | 12 
>  2 files changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_audio.c 
> b/drivers/gpu/drm/radeon/radeon_audio.c
> index 8c63ccb8b6235..f6c783e19c988 100644
> --- a/drivers/gpu/drm/radeon/radeon_audio.c
> +++ b/drivers/gpu/drm/radeon/radeon_audio.c
> @@ -38,16 +38,10 @@ void dce6_audio_enable(struct radeon_device *rdev, struct 
> r600_audio_pin *pin,
>  u32 dce6_endpoint_rreg(struct radeon_device *rdev, u32 offset, u32 reg);
>  void dce6_endpoint_wreg(struct radeon_device *rdev,
> u32 offset, u32 reg, u32 v);
> -void dce3_2_afmt_write_sad_regs(struct drm_encoder *encoder,
> -   struct cea_sad *sads, int sad_count);
>  void evergreen_hdmi_write_sad_regs(struct drm_encoder *encoder,
> struct cea_sad *sads, int sad_count);
>  void dce6_afmt_write_sad_regs(struct drm_encoder *encoder,
> struct cea_sad *sads, int sad_count);
> -void dce3_2_afmt_hdmi_write_speaker_allocation(struct drm_encoder *encoder,
> -   u8 *sadb, int sad_count);
> -void dce3_2_afmt_dp_write_speaker_allocation(struct drm_encoder *encoder,
> -   u8 *sadb, int sad_count);
>  void dce4_afmt_hdmi_write_speaker_allocation(struct drm_encoder *encoder,
> u8 *sadb, int sad_count);
>  void dce4_afmt_dp_write_speaker_allocation(struct drm_encoder *encoder,
> @@ -65,8 +59,6 @@ struct r600_audio_pin* dce6_audio_get_pin(struct 
> radeon_device *rdev);
>  void dce6_afmt_select_pin(struct drm_encoder *encoder);
>  void r600_hdmi_audio_set_dto(struct radeon_device *rdev,
> struct radeon_crtc *crtc, unsigned int clock);
> -void dce3_2_audio_set_dto(struct radeon_device *rdev,
> -   struct radeon_crtc *crtc, unsigned int clock);
>  void dce4_hdmi_audio_set_dto(struct radeon_device *rdev,
> struct radeon_crtc *crtc, unsigned int clock);
>  void dce4_dp_audio_set_dto(struct radeon_device *rdev,
> @@ -81,8 +73,6 @@ void evergreen_set_avi_packet(struct radeon_device *rdev, 
> u32 offset,
> unsigned char *buffer, size_t size);
>  void r600_hdmi_update_acr(struct drm_encoder *encoder, long offset,
> const struct radeon_hdmi_acr *acr);
> -void dce3_2_hdmi_update_acr(struct drm_encoder *encoder, long offset,
> -   const struct radeon_hdmi_acr *acr);
>  void evergreen_hdmi_update_acr(struct drm_encoder *encoder, long offset,
> const struct radeon_hdmi_acr *acr);
>  void r600_set_vbi_packet(struct drm_encoder *encoder, u32 offset);
> @@ -90,10 +80,8 @@ void dce4_set_vbi_packet(struct drm_encoder *encoder, u32 
> offset);
>  void dce4_hdmi_set_color_depth(struct drm_encoder *encoder,
> u32 offset, int bpc);
>  void r600_set_audio_packet(struct drm_encoder *encoder, u32 offset);
> -void dce3_2_set_audio_packet(struct 

Re: [PATCH 10/43] drm/radeon/radeon_pm: Move 'radeon_pm_acpi_event_handler' prototype into shared header

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:30 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/radeon_pm.c:74:6: warning: no previous prototype for 
> ‘radeon_pm_acpi_event_handler’ [-Wmissing-prototypes]
>  74 | void radeon_pm_acpi_event_handler(struct radeon_device *rdev)
>  | ^~~~
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: Sumit Semwal 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Cc: linux-me...@vger.kernel.org
> Cc: linaro-mm-...@lists.linaro.org
> Signed-off-by: Lee Jones 

Applied with minor changes.  Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/radeon_acpi.c |  3 +--
>  drivers/gpu/drm/radeon/radeon_pm.c   |  1 +
>  drivers/gpu/drm/radeon/radeon_pm.h   | 33 
>  3 files changed, 35 insertions(+), 2 deletions(-)
>  create mode 100644 drivers/gpu/drm/radeon/radeon_pm.h
>
> diff --git a/drivers/gpu/drm/radeon/radeon_acpi.c 
> b/drivers/gpu/drm/radeon/radeon_acpi.c
> index 6cf1645e7a1a8..1baef7b493def 100644
> --- a/drivers/gpu/drm/radeon/radeon_acpi.c
> +++ b/drivers/gpu/drm/radeon/radeon_acpi.c
> @@ -36,6 +36,7 @@
>  #include "atom.h"
>  #include "radeon.h"
>  #include "radeon_acpi.h"
> +#include "radeon_pm.h"
>
>  #if defined(CONFIG_VGA_SWITCHEROO)
>  bool radeon_atpx_dgpu_req_power_for_displays(void);
> @@ -45,8 +46,6 @@ static inline bool 
> radeon_atpx_dgpu_req_power_for_displays(void) { return false;
>
>  #define ACPI_AC_CLASS   "ac_adapter"
>
> -extern void radeon_pm_acpi_event_handler(struct radeon_device *rdev);
> -
>  struct atif_verify_interface {
> u16 size;   /* structure size in bytes (includes size 
> field) */
> u16 version;/* version */
> diff --git a/drivers/gpu/drm/radeon/radeon_pm.c 
> b/drivers/gpu/drm/radeon/radeon_pm.c
> index 65d172b13e065..1995dad59dd09 100644
> --- a/drivers/gpu/drm/radeon/radeon_pm.c
> +++ b/drivers/gpu/drm/radeon/radeon_pm.c
> @@ -33,6 +33,7 @@
>  #include "avivod.h"
>  #include "r600_dpm.h"
>  #include "radeon.h"
> +#include "radeon_pm.h"
>
>  #define RADEON_IDLE_LOOP_MS 100
>  #define RADEON_RECLOCK_DELAY_MS 200
> diff --git a/drivers/gpu/drm/radeon/radeon_pm.h 
> b/drivers/gpu/drm/radeon/radeon_pm.h
> new file mode 100644
> index 0..5ef147785e815
> --- /dev/null
> +++ b/drivers/gpu/drm/radeon/radeon_pm.h
> @@ -0,0 +1,33 @@
> +/* radeon_pm.h -- Private header for radeon driver -*- linux-c -*-
> + *
> + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
> + * Copyright 2000 VA Linux Systems, Inc., Fremont, California.
> + * All rights reserved.
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
> + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 
> OTHER
> + * DEALINGS IN THE SOFTWARE.
> + *
> + */
> +
> +#ifndef __RADEON_PM_H__
> +#define __RADEON_PM_H__
> +
> +void radeon_pm_acpi_event_handler(struct radeon_device *rdev);
> +
> +#endif /* __RADEON_PM_H__ */
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v4 10/27] video: fix some kernel-doc markups

2020-11-16 Thread Daniel Vetter
On Mon, Nov 16, 2020 at 07:11:12PM +0100, Sam Ravnborg wrote:
> Hi Daniel
> > > Feel free to just merge it via your tree. Patches here are pretty
> > > much independent ;-)
> > 
> > Ok I put it into drm-misc-next. I kinda assumed since there's also a huge
> > effort going on to shut up warnings, plus I think kerneldoc issues are
> > reported by a bunch of build bots nowadays. So assumed you pile this all
> > up.
> 
> Any reason "drm: fix some kernel-doc markups" was not applied?

Oh somehow I thought that one was only for i915 issues. I guess I'll take
a look.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 09/43] drm/radeon/rv770: Move 'rv770_set_clk_bypass_mode' prototype to shared location

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:30 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/rv770.c:1138:6: warning: no previous prototype for 
> ‘rv770_set_clk_bypass_mode’ [-Wmissing-prototypes]
>  1138 | void rv770_set_clk_bypass_mode(struct radeon_device *rdev)
>  | ^
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Applied with minor changes.

Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/evergreen.c |  2 +-
>  drivers/gpu/drm/radeon/r600.c  |  2 +-
>  drivers/gpu/drm/radeon/rv770.c |  1 +
>  drivers/gpu/drm/radeon/rv770.h | 35 ++
>  4 files changed, 38 insertions(+), 2 deletions(-)
>  create mode 100644 drivers/gpu/drm/radeon/rv770.h
>
> diff --git a/drivers/gpu/drm/radeon/evergreen.c 
> b/drivers/gpu/drm/radeon/evergreen.c
> index 1f2acca437abd..9a1e240b07234 100644
> --- a/drivers/gpu/drm/radeon/evergreen.c
> +++ b/drivers/gpu/drm/radeon/evergreen.c
> @@ -31,6 +31,7 @@
>
>  #include "atom.h"
>  #include "avivod.h"
> +#include "rv770.h"
>  #include "evergreen_blit_shaders.h"
>  #include "evergreen_reg.h"
>  #include "evergreend.h"
> @@ -223,7 +224,6 @@ extern u32 si_get_csb_size(struct radeon_device *rdev);
>  extern void si_get_csb_buffer(struct radeon_device *rdev, volatile u32 
> *buffer);
>  extern u32 cik_get_csb_size(struct radeon_device *rdev);
>  extern void cik_get_csb_buffer(struct radeon_device *rdev, volatile u32 
> *buffer);
> -extern void rv770_set_clk_bypass_mode(struct radeon_device *rdev);
>
>  static const u32 evergreen_golden_registers[] =
>  {
> diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
> index 12a918335ac7b..f09b6dc5cbeb3 100644
> --- a/drivers/gpu/drm/radeon/r600.c
> +++ b/drivers/gpu/drm/radeon/r600.c
> @@ -40,6 +40,7 @@
>  #include "atom.h"
>  #include "avivod.h"
>  #include "r600d.h"
> +#include "rv770.h"
>  #include "radeon.h"
>  #include "radeon_asic.h"
>  #include "radeon_audio.h"
> @@ -112,7 +113,6 @@ void r600_fini(struct radeon_device *rdev);
>  void r600_irq_disable(struct radeon_device *rdev);
>  static void r600_pcie_gen2_enable(struct radeon_device *rdev);
>  extern int evergreen_rlc_resume(struct radeon_device *rdev);
> -extern void rv770_set_clk_bypass_mode(struct radeon_device *rdev);
>
>  /*
>   * Indirect registers accessor
> diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
> index 21f653ae1e1bb..88e29ebaad467 100644
> --- a/drivers/gpu/drm/radeon/rv770.c
> +++ b/drivers/gpu/drm/radeon/rv770.c
> @@ -39,6 +39,7 @@
>  #include "radeon_asic.h"
>  #include "radeon_audio.h"
>  #include "rv770d.h"
> +#include "rv770.h"
>
>  #define R700_PFP_UCODE_SIZE 848
>  #define R700_PM4_UCODE_SIZE 1360
> diff --git a/drivers/gpu/drm/radeon/rv770.h b/drivers/gpu/drm/radeon/rv770.h
> new file mode 100644
> index 0..a3f2bb44979fe
> --- /dev/null
> +++ b/drivers/gpu/drm/radeon/rv770.h
> @@ -0,0 +1,35 @@
> +/* radeon_rv770.h -- Private header for radeon driver -*- linux-c -*-
> + *
> + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
> + * Copyright 2000 VA Linux Systems, Inc., Fremont, California.
> + * All rights reserved.
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
> + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 
> OTHER
> + * DEALINGS IN THE SOFTWARE.
> + *
> + */
> +
> +#ifndef __RADEON_RV770_H__
> +#define __RADEON_RV770_H__
> +
> +struct radeon_device;
> +
> +void rv770_set_clk_bypass_mode(struct radeon_device *rdev);
> +
> +#endif /* __RADEON_RV770_H__ */
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing 

Re: [PATCH 08/43] drm/radeon/radeon_irq_kms: Demote non-conformant kernel-doc fix another

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:30 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/radeon_irq_kms.c:56: warning: Function parameter or 
> member 'irq' not described in 'radeon_driver_irq_handler_kms'
>  drivers/gpu/drm/radeon/radeon_irq_kms.c:56: warning: Function parameter or 
> member 'arg' not described in 'radeon_driver_irq_handler_kms'
>  drivers/gpu/drm/radeon/radeon_irq_kms.c:571: warning: Function parameter or 
> member 'n' not described in 'radeon_irq_kms_set_irq_n_enabled'
>  drivers/gpu/drm/radeon/radeon_irq_kms.c:571: warning: Excess function 
> parameter 'num' description in 'radeon_irq_kms_set_irq_n_enabled'
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex


> ---
>  drivers/gpu/drm/radeon/radeon_irq_kms.c | 8 +++-
>  1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c 
> b/drivers/gpu/drm/radeon/radeon_irq_kms.c
> index b86bc88ad4308..a242b6053d47e 100644
> --- a/drivers/gpu/drm/radeon/radeon_irq_kms.c
> +++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c
> @@ -43,11 +43,9 @@
>
>  #define RADEON_WAIT_IDLE_TIMEOUT 200
>
> -/**
> +/*
>   * radeon_driver_irq_handler_kms - irq handler for KMS
>   *
> - * @int irq, void *arg: args
> - *
>   * This is the irq handler for the radeon KMS driver (all asics).
>   * radeon_irq_process is a macro that points to the per-asic
>   * irq handler callback.
> @@ -549,14 +547,14 @@ void radeon_irq_kms_disable_hpd(struct radeon_device 
> *rdev, unsigned hpd_mask)
>  }
>
>  /**
> - * radeon_irq_kms_update_int_n - helper for updating interrupt enable 
> registers
> + * radeon_irq_kms_set_irq_n_enabled - helper for updating interrupt enable 
> registers
>   *
>   * @rdev: radeon device pointer
>   * @reg: the register to write to enable/disable interrupts
>   * @mask: the mask that enables the interrupts
>   * @enable: whether to enable or disable the interrupt register
>   * @name: the name of the interrupt register to print to the kernel log
> - * @num: the number of the interrupt register to print to the kernel log
> + * @n: the number of the interrupt register to print to the kernel log
>   *
>   * Helper for updating the enable state of interrupt registers. Checks 
> whether
>   * or not the interrupt matches the enable state we want. If it doesn't, then
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 07/43] drm/radeon/radeon_legacy_encoders: Move 'radeon_add_legacy_encoder's prototype to shared location

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:30 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/radeon_legacy_encoders.c:1746:1: warning: no previous 
> prototype for ‘radeon_add_legacy_encoder’ [-Wmissing-prototypes]
>  1746 | radeon_add_legacy_encoder(struct drm_device *dev, uint32_t 
> encoder_enum, uint32_t supported_device)
>  | ^
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: Sumit Semwal 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Cc: linux-me...@vger.kernel.org
> Cc: linaro-mm-...@lists.linaro.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/radeon_atombios.c| 6 +-
>  drivers/gpu/drm/radeon/radeon_combios.c | 6 +-
>  drivers/gpu/drm/radeon/radeon_legacy_encoders.h | 2 ++
>  3 files changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c 
> b/drivers/gpu/drm/radeon/radeon_atombios.c
> index 71bf2ed172697..cc80651b25773 100644
> --- a/drivers/gpu/drm/radeon/radeon_atombios.c
> +++ b/drivers/gpu/drm/radeon/radeon_atombios.c
> @@ -35,16 +35,12 @@
>  #include "atom-bits.h"
>  #include "radeon_asic.h"
>  #include "radeon_atombios.h"
> +#include "radeon_legacy_encoders.h"
>
>  extern void
>  radeon_add_atom_encoder(struct drm_device *dev, uint32_t encoder_enum,
> uint32_t supported_device, u16 caps);
>
> -/* from radeon_legacy_encoder.c */
> -extern void
> -radeon_add_legacy_encoder(struct drm_device *dev, uint32_t encoder_enum,
> - uint32_t supported_device);
> -
>  union atom_supported_devices {
> struct _ATOM_SUPPORTED_DEVICES_INFO info;
> struct _ATOM_SUPPORTED_DEVICES_INFO_2 info_2;
> diff --git a/drivers/gpu/drm/radeon/radeon_combios.c 
> b/drivers/gpu/drm/radeon/radeon_combios.c
> index d3c04df7e75d7..ff2135059c071 100644
> --- a/drivers/gpu/drm/radeon/radeon_combios.c
> +++ b/drivers/gpu/drm/radeon/radeon_combios.c
> @@ -31,6 +31,7 @@
>  #include 
>
>  #include "radeon.h"
> +#include "radeon_legacy_encoders.h"
>  #include "atom.h"
>
>  #ifdef CONFIG_PPC_PMAC
> @@ -40,11 +41,6 @@
>  #include 
>  #endif /* CONFIG_PPC_PMAC */
>
> -/* from radeon_legacy_encoder.c */
> -extern void
> -radeon_add_legacy_encoder(struct drm_device *dev, uint32_t encoder_enum,
> - uint32_t supported_device);
> -
>  /* old legacy ATI BIOS routines */
>
>  /* COMBIOS table offsets */
> diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.h 
> b/drivers/gpu/drm/radeon/radeon_legacy_encoders.h
> index a80b387559d4d..f4c7432267e67 100644
> --- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.h
> +++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.h
> @@ -30,5 +30,7 @@
>
>  void radeon_legacy_backlight_init(struct radeon_encoder *radeon_encoder,
>   struct drm_connector *drm_connector);
> +void radeon_add_legacy_encoder(struct drm_device *dev, uint32_t encoder_enum,
> +  uint32_t supported_device);
>
>  #endif /* __RADEON_LEGACY_ENCODERS_H__ */
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 06/43] drm/radeon/radeon_legacy_encoders: Move 'radeon_add_legacy_encoder' prototype to shared header

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:30 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>   drivers/gpu/drm/radeon/radeon_legacy_encoders.c:1745:1: warning: no 
> previous prototype for ‘radeon_add_legacy_encoder’ [-Wmissing-prototypes]
>  1745 | radeon_add_legacy_encoder(struct drm_device *dev, uint32_t 
> encoder_enum, uint32_t supported_device)
>  | ^
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: Sumit Semwal 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Cc: linux-me...@vger.kernel.org
> Cc: linaro-mm-...@lists.linaro.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/radeon_encoders.c  |  4 +--
>  .../gpu/drm/radeon/radeon_legacy_encoders.c   |  1 +
>  .../gpu/drm/radeon/radeon_legacy_encoders.h   | 34 +++
>  3 files changed, 36 insertions(+), 3 deletions(-)
>  create mode 100644 drivers/gpu/drm/radeon/radeon_legacy_encoders.h
>
> diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c 
> b/drivers/gpu/drm/radeon/radeon_encoders.c
> index ced022fae19d7..b60a373d3ead3 100644
> --- a/drivers/gpu/drm/radeon/radeon_encoders.c
> +++ b/drivers/gpu/drm/radeon/radeon_encoders.c
> @@ -31,11 +31,9 @@
>  #include 
>
>  #include "radeon.h"
> +#include "radeon_legacy_encoders.h"
>  #include "atom.h"
>
> -extern void
> -radeon_legacy_backlight_init(struct radeon_encoder *radeon_encoder,
> -struct drm_connector *drm_connector);
>  extern void
>  radeon_atom_backlight_init(struct radeon_encoder *radeon_encoder,
>struct drm_connector *drm_connector);
> diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c 
> b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
> index 44d060f75318e..e64fd0ce67070 100644
> --- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
> +++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
> @@ -35,6 +35,7 @@
>
>  #include "radeon.h"
>  #include "radeon_asic.h"
> +#include "radeon_legacy_encoders.h"
>  #include "atom.h"
>  #ifdef CONFIG_PMAC_BACKLIGHT
>  #include 
> diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.h 
> b/drivers/gpu/drm/radeon/radeon_legacy_encoders.h
> new file mode 100644
> index 0..a80b387559d4d
> --- /dev/null
> +++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.h
> @@ -0,0 +1,34 @@
> +/* radeon_legacy_encoders.h -- Private header for radeon driver -*- linux-c 
> -*-
> + *
> + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
> + * Copyright 2000 VA Linux Systems, Inc., Fremont, California.
> + * All rights reserved.
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
> + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 
> OTHER
> + * DEALINGS IN THE SOFTWARE.
> + *
> + */
> +
> +#ifndef __RADEON_LEGACY_ENCODERS_H__
> +#define __RADEON_LEGACY_ENCODERS_H__
> +
> +void radeon_legacy_backlight_init(struct radeon_encoder *radeon_encoder,
> + struct drm_connector *drm_connector);
> +
> +#endif /* __RADEON_LEGACY_ENCODERS_H__ */
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 05/43] drm/radeon: Move radeon_ttm{init, fini} to shared location

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:30 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/radeon_ttm.c: At top level:
>  drivers/gpu/drm/radeon/radeon_ttm.c:817:5: warning: no previous prototype 
> for ‘radeon_ttm_init’ [-Wmissing-prototypes]
>  817 | int radeon_ttm_init(struct radeon_device *rdev)
>  | ^~~
>  drivers/gpu/drm/radeon/radeon_ttm.c:878:6: warning: no previous prototype 
> for ‘radeon_ttm_fini’ [-Wmissing-prototypes]
>  878 | void radeon_ttm_fini(struct radeon_device *rdev)
>  | ^~~
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: Sumit Semwal 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Cc: linux-me...@vger.kernel.org
> Cc: linaro-mm-...@lists.linaro.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex


> ---
>  drivers/gpu/drm/radeon/radeon_object.c |  3 +--
>  drivers/gpu/drm/radeon/radeon_ttm.c|  1 +
>  drivers/gpu/drm/radeon/radeon_ttm.h| 36 ++
>  3 files changed, 38 insertions(+), 2 deletions(-)
>  create mode 100644 drivers/gpu/drm/radeon/radeon_ttm.h
>
> diff --git a/drivers/gpu/drm/radeon/radeon_object.c 
> b/drivers/gpu/drm/radeon/radeon_object.c
> index ab81e35cb0606..8bc5ad1d65857 100644
> --- a/drivers/gpu/drm/radeon/radeon_object.c
> +++ b/drivers/gpu/drm/radeon/radeon_object.c
> @@ -40,9 +40,8 @@
>
>  #include "radeon.h"
>  #include "radeon_trace.h"
> +#include "radeon_ttm.h"
>
> -int radeon_ttm_init(struct radeon_device *rdev);
> -void radeon_ttm_fini(struct radeon_device *rdev);
>  static void radeon_bo_clear_surface_reg(struct radeon_bo *bo);
>
>  /*
> diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c 
> b/drivers/gpu/drm/radeon/radeon_ttm.c
> index 2939e71ceb700..28b300ed200ea 100644
> --- a/drivers/gpu/drm/radeon/radeon_ttm.c
> +++ b/drivers/gpu/drm/radeon/radeon_ttm.c
> @@ -51,6 +51,7 @@
>
>  #include "radeon_reg.h"
>  #include "radeon.h"
> +#include "radeon_ttm.h"
>
>  static int radeon_ttm_debugfs_init(struct radeon_device *rdev);
>  static void radeon_ttm_debugfs_fini(struct radeon_device *rdev);
> diff --git a/drivers/gpu/drm/radeon/radeon_ttm.h 
> b/drivers/gpu/drm/radeon/radeon_ttm.h
> new file mode 100644
> index 0..91ea7141bc812
> --- /dev/null
> +++ b/drivers/gpu/drm/radeon/radeon_ttm.h
> @@ -0,0 +1,36 @@
> +/* radeon_ttm.h -- Private header for radeon driver -*- linux-c -*-
> + *
> + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
> + * Copyright 2000 VA Linux Systems, Inc., Fremont, California.
> + * All rights reserved.
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
> + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 
> OTHER
> + * DEALINGS IN THE SOFTWARE.
> + *
> + */
> +
> +#ifndef __RADEON_TTM_H__
> +#define __RADEON_TTM_H__
> +
> +struct radeon_device;
> +
> +int radeon_ttm_init(struct radeon_device *rdev);
> +void radeon_ttm_fini(struct radeon_device *rdev);
> +
> +#endif /* __RADEON_TTM_H__ */
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 04/43] drm/radeon/radeon_kms: Fix misnaming of 'radeon_info_ioctl's dev param

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:30 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/radeon_kms.c:226: warning: Function parameter or 
> member 'dev' not described in 'radeon_info_ioctl'
>  drivers/gpu/drm/radeon/radeon_kms.c:226: warning: Excess function parameter 
> 'rdev' description in 'radeon_info_ioctl'
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/radeon_kms.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_kms.c 
> b/drivers/gpu/drm/radeon/radeon_kms.c
> index 001940bca90a6..50cee4880bb46 100644
> --- a/drivers/gpu/drm/radeon/radeon_kms.c
> +++ b/drivers/gpu/drm/radeon/radeon_kms.c
> @@ -214,7 +214,7 @@ static void radeon_set_filp_rights(struct drm_device *dev,
>  /**
>   * radeon_info_ioctl - answer a device specific request.
>   *
> - * @rdev: radeon device pointer
> + * @dev: drm device pointer
>   * @data: request object
>   * @filp: drm filp
>   *
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 03/43] drm/radeon/radeon_kms: Move 'radeon_*_kms' prototypes to shared header

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:30 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/radeon_kms.c:756:5: warning: no previous prototype 
> for ‘radeon_get_vblank_counter_kms’ [-Wmissing-prototypes]
>  756 | u32 radeon_get_vblank_counter_kms(struct drm_crtc *crtc)
>  | ^
>  drivers/gpu/drm/radeon/radeon_kms.c:826:5: warning: no previous prototype 
> for ‘radeon_enable_vblank_kms’ [-Wmissing-prototypes]
>  826 | int radeon_enable_vblank_kms(struct drm_crtc *crtc)
>  | ^~~~
>  drivers/gpu/drm/radeon/radeon_kms.c:853:6: warning: no previous prototype 
> for ‘radeon_disable_vblank_kms’ [-Wmissing-prototypes]
>  853 | void radeon_disable_vblank_kms(struct drm_crtc *crtc)
>  | ^
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: Sumit Semwal 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Cc: linux-me...@vger.kernel.org
> Cc: linaro-mm-...@lists.linaro.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/radeon_display.c |  1 +
>  drivers/gpu/drm/radeon/radeon_kms.c |  1 +
>  drivers/gpu/drm/radeon/radeon_kms.h | 35 +
>  3 files changed, 37 insertions(+)
>  create mode 100644 drivers/gpu/drm/radeon/radeon_kms.h
>
> diff --git a/drivers/gpu/drm/radeon/radeon_display.c 
> b/drivers/gpu/drm/radeon/radeon_display.c
> index eb0d4cb95f0a6..3a6fedad002d7 100644
> --- a/drivers/gpu/drm/radeon/radeon_display.c
> +++ b/drivers/gpu/drm/radeon/radeon_display.c
> @@ -44,6 +44,7 @@
>
>  #include "atom.h"
>  #include "radeon.h"
> +#include "radeon_kms.h"
>
>  static void avivo_crtc_load_lut(struct drm_crtc *crtc)
>  {
> diff --git a/drivers/gpu/drm/radeon/radeon_kms.c 
> b/drivers/gpu/drm/radeon/radeon_kms.c
> index 3d31c04e4b3db..001940bca90a6 100644
> --- a/drivers/gpu/drm/radeon/radeon_kms.c
> +++ b/drivers/gpu/drm/radeon/radeon_kms.c
> @@ -41,6 +41,7 @@
>  #include "radeon.h"
>  #include "radeon_asic.h"
>  #include "radeon_drv.h"
> +#include "radeon_kms.h"
>
>  #if defined(CONFIG_VGA_SWITCHEROO)
>  bool radeon_has_atpx(void);
> diff --git a/drivers/gpu/drm/radeon/radeon_kms.h 
> b/drivers/gpu/drm/radeon/radeon_kms.h
> new file mode 100644
> index 0..36e73cea92154
> --- /dev/null
> +++ b/drivers/gpu/drm/radeon/radeon_kms.h
> @@ -0,0 +1,35 @@
> +/* radeon_kms.h -- Private header for radeon driver -*- linux-c -*-
> + *
> + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
> + * Copyright 2000 VA Linux Systems, Inc., Fremont, California.
> + * All rights reserved.
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
> + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 
> OTHER
> + * DEALINGS IN THE SOFTWARE.
> + *
> + */
> +
> +#ifndef __RADEON_KMS_H__
> +#define __RADEON_KMS_H__
> +
> +u32 radeon_get_vblank_counter_kms(struct drm_crtc *crtc);
> +int radeon_enable_vblank_kms(struct drm_crtc *crtc);
> +void radeon_disable_vblank_kms(struct drm_crtc *crtc);
> +
> +#endif /* __RADEON_KMS_H__ */
> --
> 2.25.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 02/43] drm/radeon/radeon: Move prototype into shared header

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:30 PM Lee Jones  wrote:
>
> Unfortunately, a suitable one didn't already exist.
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/radeon_device.c:637:6: warning: no previous prototype 
> for ‘radeon_device_is_virtual’ [-Wmissing-prototypes]
>  637 | bool radeon_device_is_virtual(void)
>  | ^~~~
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: Sumit Semwal 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Cc: linux-me...@vger.kernel.org
> Cc: linaro-mm-...@lists.linaro.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/radeon_device.c |  1 +
>  drivers/gpu/drm/radeon/radeon_device.h | 32 ++
>  drivers/gpu/drm/radeon/radeon_drv.c|  3 +--
>  3 files changed, 34 insertions(+), 2 deletions(-)
>  create mode 100644 drivers/gpu/drm/radeon/radeon_device.h
>
> diff --git a/drivers/gpu/drm/radeon/radeon_device.c 
> b/drivers/gpu/drm/radeon/radeon_device.c
> index 7f384ffe848a7..ad572f965190b 100644
> --- a/drivers/gpu/drm/radeon/radeon_device.c
> +++ b/drivers/gpu/drm/radeon/radeon_device.c
> @@ -42,6 +42,7 @@
>  #include 
>  #include 
>
> +#include "radeon_device.h"
>  #include "radeon_reg.h"
>  #include "radeon.h"
>  #include "atom.h"
> diff --git a/drivers/gpu/drm/radeon/radeon_device.h 
> b/drivers/gpu/drm/radeon/radeon_device.h
> new file mode 100644
> index 0..3112b99ae36f1
> --- /dev/null
> +++ b/drivers/gpu/drm/radeon/radeon_device.h
> @@ -0,0 +1,32 @@
> +/* radeon_device.h -- Private header for radeon device -*- linux-c -*-
> + *
> + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
> + * Copyright 2000 VA Linux Systems, Inc., Fremont, California.
> + * All rights reserved.
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
> + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 
> OTHER
> + * DEALINGS IN THE SOFTWARE.
> + */
> +
> +#ifndef __RADEON_DEVICE_H__
> +#define __RADEON_DEVICE_H__
> +
> +bool radeon_device_is_virtual(void);
> +
> +#endif /* __RADEON_DEVICE_H__ */
> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c 
> b/drivers/gpu/drm/radeon/radeon_drv.c
> index f813eb5e140dd..536b246b9a6aa 100644
> --- a/drivers/gpu/drm/radeon/radeon_drv.c
> +++ b/drivers/gpu/drm/radeon/radeon_drv.c
> @@ -52,6 +52,7 @@
>
>  #include "radeon_drv.h"
>  #include "radeon.h"
> +#include "radeon_device.h"
>
>  /*
>   * KMS wrapper.
> @@ -293,8 +294,6 @@ MODULE_DEVICE_TABLE(pci, pciidlist);
>
>  static const struct drm_driver kms_driver;
>
> -bool radeon_device_is_virtual(void);
> -
>  static int radeon_pci_probe(struct pci_dev *pdev,
> const struct pci_device_id *ent)
>  {
> --
> 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 "drm/gma500: Fix out-of-bounds access to struct drm_device.vblank[]" has been added to the 4.9-stable tree

2020-11-16 Thread gregkh


This is a note to let you know that I've just added the patch titled

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

to the 4.9-stable tree which can be found at:

http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
 drm-gma500-fix-out-of-bounds-access-to-struct-drm_device.vblank.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let  know about it.


>From 06ad8d339524bf94b89859047822c31df6ace239 Mon Sep 17 00:00:00 2001
From: Thomas Zimmermann 
Date: Thu, 5 Nov 2020 20:02:56 +0100
Subject: drm/gma500: Fix out-of-bounds access to struct drm_device.vblank[]

From: Thomas Zimmermann 

commit 06ad8d339524bf94b89859047822c31df6ace239 upstream.

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

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

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

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

Signed-off-by: Thomas Zimmermann 
Reviewed-by: Daniel Vetter 
Fixes: 5c49fd3aa0ab ("gma500: Add the core DRM files and headers")
Cc: Alan Cox 
Cc: Dave Airlie 
Cc: Patrik Jakobsson 
Cc: dri-devel@lists.freedesktop.org
Cc: sta...@vger.kernel.org#v3.3+
Link: 
https://patchwork.freedesktop.org/patch/msgid/20201105190256.3893-1-tzimmerm...@suse.de
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/gpu/drm/gma500/psb_irq.c |   34 --
 1 file changed, 12 insertions(+), 22 deletions(-)

--- a/drivers/gpu/drm/gma500/psb_irq.c
+++ b/drivers/gpu/drm/gma500/psb_irq.c
@@ -350,6 +350,7 @@ int psb_irq_postinstall(struct drm_devic
 {
struct drm_psb_private *dev_priv = dev->dev_private;
unsigned long irqflags;
+   unsigned int i;
 
spin_lock_irqsave(_priv->irqmask_lock, irqflags);
 
@@ -362,20 +363,12 @@ int psb_irq_postinstall(struct drm_devic
PSB_WVDC32(dev_priv->vdc_irq_mask, PSB_INT_ENABLE_R);
PSB_WVDC32(0x, PSB_HWSTAM);
 
-   if (dev->vblank[0].enabled)
-   psb_enable_pipestat(dev_priv, 0, PIPE_VBLANK_INTERRUPT_ENABLE);
-   else
-   psb_disable_pipestat(dev_priv, 0, PIPE_VBLANK_INTERRUPT_ENABLE);
-
-   if (dev->vblank[1].enabled)
-   psb_enable_pipestat(dev_priv, 1, PIPE_VBLANK_INTERRUPT_ENABLE);
-   else
-   psb_disable_pipestat(dev_priv, 1, PIPE_VBLANK_INTERRUPT_ENABLE);
-
-   if (dev->vblank[2].enabled)
-   psb_enable_pipestat(dev_priv, 2, PIPE_VBLANK_INTERRUPT_ENABLE);
-   else
-   psb_disable_pipestat(dev_priv, 2, PIPE_VBLANK_INTERRUPT_ENABLE);
+   for (i = 0; i < dev->num_crtcs; ++i) {
+   if (dev->vblank[i].enabled)
+   psb_enable_pipestat(dev_priv, i, 
PIPE_VBLANK_INTERRUPT_ENABLE);
+   else
+   psb_disable_pipestat(dev_priv, i, 
PIPE_VBLANK_INTERRUPT_ENABLE);
+   }
 
if (dev_priv->ops->hotplug_enable)
dev_priv->ops->hotplug_enable(dev, true);
@@ -388,6 +381,7 @@ void psb_irq_uninstall(struct drm_device
 {
struct drm_psb_private *dev_priv = dev->dev_private;
unsigned long irqflags;
+   unsigned int i;
 
spin_lock_irqsave(_priv->irqmask_lock, irqflags);
 
@@ -396,14 +390,10 @@ void psb_irq_uninstall(struct drm_device
 
PSB_WVDC32(0x, PSB_HWSTAM);
 
-   if (dev->vblank[0].enabled)
-   psb_disable_pipestat(dev_priv, 0, PIPE_VBLANK_INTERRUPT_ENABLE);
-
-   if (dev->vblank[1].enabled)
-   

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

2020-11-16 Thread Dave Airlie
>
> Christ. It's been two weeks. I'm doing -rc4 today, and I still don't
> have the fix.
>
> The problem seems entirely obvious, as reported by Kirill: the nv50
> code unconditionally calls the "atomic_{dis,en}able()" functions, even
> when not everybody was converted.
>
> The fix seems to be to either just do the conversion of the remaining
> cases (which looks like just adding an argument to the remaining
> functions, and using that for the "atomic" callback), or the trivial
> suggestion by Kirill from two weeks ago:
>
> > I hacked up patch to use help->disable/help->enable if atomic_ versions
> > are NULL. It worked.
>
> Kirill, since the nouveau people aren't fixing this, can you just send
> me your tested patch?
>
> Lyude/Ben - let me just say that I think this is all a huge disgrace.
>
> You had a problem report with a bisected commit, a suggested fix, and
> two weeks later there's absolutely _nothing_.

I would like to say when you sent this, there was patches on the
mailing lists with Kirill cc'ed, a pull request outstanding to me on
the mailing list from Ben, with the patches reviewed in it.

Maybe you weren't cc'ed on it, but stuff has certainly happened, in
the timeframe, and I was keeping track of it from falling down a hole.

_nothing_ is a lot more a reflection on your research than the ongoing
process, there was some delays here and maybe we need to communicate
when we are flat out dealing with other more urgent tasks that pay the
actual wages.

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


Re: [PATCH 01/43] drm/radeon/atombios_encoders: Move 'radeon_atom_get_tv_timings()'s prototype into shared location

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 12:30 PM Lee Jones  wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/gpu/drm/radeon/radeon_atombios.c:1791:6: warning: no previous 
> prototype for ‘radeon_atom_get_tv_timings’ [-Wmissing-prototypes]
>  1791 | bool radeon_atom_get_tv_timings(struct radeon_device *rdev, int index,
>  | ^~
>
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/atombios_encoders.c |  5 +--
>  drivers/gpu/drm/radeon/radeon_atombios.c   |  1 +
>  drivers/gpu/drm/radeon/radeon_atombios.h   | 37 ++
>  3 files changed, 39 insertions(+), 4 deletions(-)
>  create mode 100644 drivers/gpu/drm/radeon/radeon_atombios.h
>
> diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c 
> b/drivers/gpu/drm/radeon/atombios_encoders.c
> index cc5ee1b3af84f..683de198e18d9 100644
> --- a/drivers/gpu/drm/radeon/atombios_encoders.c
> +++ b/drivers/gpu/drm/radeon/atombios_encoders.c
> @@ -33,6 +33,7 @@
>  #include 
>
>  #include "atom.h"
> +#include "radeon_atombios.h"
>  #include "radeon.h"
>  #include "radeon_asic.h"
>  #include "radeon_audio.h"
> @@ -296,10 +297,6 @@ static void radeon_atom_backlight_exit(struct 
> radeon_encoder *encoder)
>
>  #endif
>
> -/* evil but including atombios.h is much worse */
> -bool radeon_atom_get_tv_timings(struct radeon_device *rdev, int index,
> -   struct drm_display_mode *mode);
> -
>  static bool radeon_atom_mode_fixup(struct drm_encoder *encoder,
>const struct drm_display_mode *mode,
>struct drm_display_mode *adjusted_mode)
> diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c 
> b/drivers/gpu/drm/radeon/radeon_atombios.c
> index 5d25917251892..71bf2ed172697 100644
> --- a/drivers/gpu/drm/radeon/radeon_atombios.c
> +++ b/drivers/gpu/drm/radeon/radeon_atombios.c
> @@ -34,6 +34,7 @@
>  #include "atom.h"
>  #include "atom-bits.h"
>  #include "radeon_asic.h"
> +#include "radeon_atombios.h"
>
>  extern void
>  radeon_add_atom_encoder(struct drm_device *dev, uint32_t encoder_enum,
> diff --git a/drivers/gpu/drm/radeon/radeon_atombios.h 
> b/drivers/gpu/drm/radeon/radeon_atombios.h
> new file mode 100644
> index 0..b7c76920feb7d
> --- /dev/null
> +++ b/drivers/gpu/drm/radeon/radeon_atombios.h
> @@ -0,0 +1,37 @@
> +/* radeon_atombios.h -- Private header for radeon driver -*- linux-c -*-
> + *
> + * Copyright 2007-8 Advanced Micro Devices, Inc.
> + * Copyright 2008 Red Hat Inc.
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice shall be included in
> + * all copies or substantial portions of the Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
> + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
> + * OTHER DEALINGS IN THE SOFTWARE.
> + *
> + * Authors: Dave Airlie
> + *  Alex Deucher
> + */
> +
> +#ifndef __RADEON_ATOMBIOS_H__
> +#define __RADEON_ATOMBIOS_H__
> +
> +struct drm_display_mode;
> +struct radeon_device;
> +
> +bool radeon_atom_get_tv_timings(struct radeon_device *rdev, int index,
> +   struct drm_display_mode *mode);
> +
> +#endif /* __RADEON_ATOMBIOS_H__ */
> --
> 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 "drm/gma500: Fix out-of-bounds access to struct drm_device.vblank[]" has been added to the 4.4-stable tree

2020-11-16 Thread gregkh


This is a note to let you know that I've just added the patch titled

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

to the 4.4-stable tree which can be found at:

http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
 drm-gma500-fix-out-of-bounds-access-to-struct-drm_device.vblank.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let  know about it.


>From 06ad8d339524bf94b89859047822c31df6ace239 Mon Sep 17 00:00:00 2001
From: Thomas Zimmermann 
Date: Thu, 5 Nov 2020 20:02:56 +0100
Subject: drm/gma500: Fix out-of-bounds access to struct drm_device.vblank[]

From: Thomas Zimmermann 

commit 06ad8d339524bf94b89859047822c31df6ace239 upstream.

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

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

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

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

Signed-off-by: Thomas Zimmermann 
Reviewed-by: Daniel Vetter 
Fixes: 5c49fd3aa0ab ("gma500: Add the core DRM files and headers")
Cc: Alan Cox 
Cc: Dave Airlie 
Cc: Patrik Jakobsson 
Cc: dri-devel@lists.freedesktop.org
Cc: sta...@vger.kernel.org#v3.3+
Link: 
https://patchwork.freedesktop.org/patch/msgid/20201105190256.3893-1-tzimmerm...@suse.de
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/gpu/drm/gma500/psb_irq.c |   34 --
 1 file changed, 12 insertions(+), 22 deletions(-)

--- a/drivers/gpu/drm/gma500/psb_irq.c
+++ b/drivers/gpu/drm/gma500/psb_irq.c
@@ -350,6 +350,7 @@ int psb_irq_postinstall(struct drm_devic
 {
struct drm_psb_private *dev_priv = dev->dev_private;
unsigned long irqflags;
+   unsigned int i;
 
spin_lock_irqsave(_priv->irqmask_lock, irqflags);
 
@@ -362,20 +363,12 @@ int psb_irq_postinstall(struct drm_devic
PSB_WVDC32(dev_priv->vdc_irq_mask, PSB_INT_ENABLE_R);
PSB_WVDC32(0x, PSB_HWSTAM);
 
-   if (dev->vblank[0].enabled)
-   psb_enable_pipestat(dev_priv, 0, PIPE_VBLANK_INTERRUPT_ENABLE);
-   else
-   psb_disable_pipestat(dev_priv, 0, PIPE_VBLANK_INTERRUPT_ENABLE);
-
-   if (dev->vblank[1].enabled)
-   psb_enable_pipestat(dev_priv, 1, PIPE_VBLANK_INTERRUPT_ENABLE);
-   else
-   psb_disable_pipestat(dev_priv, 1, PIPE_VBLANK_INTERRUPT_ENABLE);
-
-   if (dev->vblank[2].enabled)
-   psb_enable_pipestat(dev_priv, 2, PIPE_VBLANK_INTERRUPT_ENABLE);
-   else
-   psb_disable_pipestat(dev_priv, 2, PIPE_VBLANK_INTERRUPT_ENABLE);
+   for (i = 0; i < dev->num_crtcs; ++i) {
+   if (dev->vblank[i].enabled)
+   psb_enable_pipestat(dev_priv, i, 
PIPE_VBLANK_INTERRUPT_ENABLE);
+   else
+   psb_disable_pipestat(dev_priv, i, 
PIPE_VBLANK_INTERRUPT_ENABLE);
+   }
 
if (dev_priv->ops->hotplug_enable)
dev_priv->ops->hotplug_enable(dev, true);
@@ -388,6 +381,7 @@ void psb_irq_uninstall(struct drm_device
 {
struct drm_psb_private *dev_priv = dev->dev_private;
unsigned long irqflags;
+   unsigned int i;
 
spin_lock_irqsave(_priv->irqmask_lock, irqflags);
 
@@ -396,14 +390,10 @@ void psb_irq_uninstall(struct drm_device
 
PSB_WVDC32(0x, PSB_HWSTAM);
 
-   if (dev->vblank[0].enabled)
-   psb_disable_pipestat(dev_priv, 0, PIPE_VBLANK_INTERRUPT_ENABLE);
-
-   if (dev->vblank[1].enabled)
-   

Re: [PATCH v3] dt-bindings: display: panel: one file of all simple LVDS panels with dual ports

2020-11-16 Thread Rob Herring
On Thu, Nov 12, 2020 at 02:17:11PM +0800, Liu Ying wrote:
> To complement panel-simple.yaml, create panel-simple-lvds-dual-ports.yaml.
> panel-simple-lvds-dual-ports.yaml is for all simple LVDS panels that
> have dual LVDS ports and require only a single power-supply.
> The first port receives odd pixels, and the second port receives even pixels.
> Optionally, a backlight and an enable GPIO can be specified as properties.
> 
> Panels with swapped pixel order, if any, need dedicated bindings.
> 
> Migrate 'auo,g133han01', 'auo,g185han01', 'auo,g190ean01',
> 'koe,tx26d202vm0bwa' and 'nlt,nl192108ac18-02d' over to the new file.
> 
> The objectives with one file for all the simple LVDS panels with dual ports 
> are:
> - Make it simpler to add bindings for this kind of LVDS panels
> - Keep the number of bindings file lower
> - Keep the binding documentation for this kind of LVDS panels more consistent
> - Make it possible for drivers to get pixel order via
>   drm_of_lvds_get_dual_link_pixel_order(), as the optional 'ports' property is
>   allowed
> 
> Suggested-by: Sam Ravnborg 
> Cc: Thierry Reding 
> Cc: Sam Ravnborg 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: Rob Herring 
> Cc: Lucas Stach 
> Cc: Sebastian Reichel 
> Signed-off-by: Liu Ying 
> ---
> v2->v3:
> * Do not allow 'port' property. (Rob)
> * Define port number. (Rob)
> * Specify 'dual-lvds-odd-pixels' and 'dual-lvds-even-pixels' properties. (Rob)
> 
> v1->v2:
> * Correct pixel order in example LVDS panel node.
> 
>  .../panel/panel-simple-lvds-dual-ports.yaml| 126 
> +
>  .../bindings/display/panel/panel-simple.yaml   |  10 --
>  2 files changed, 126 insertions(+), 10 deletions(-)
>  create mode 100644 
> Documentation/devicetree/bindings/display/panel/panel-simple-lvds-dual-ports.yaml
> 
> diff --git 
> a/Documentation/devicetree/bindings/display/panel/panel-simple-lvds-dual-ports.yaml
>  
> b/Documentation/devicetree/bindings/display/panel/panel-simple-lvds-dual-ports.yaml
> new file mode 100644
> index ..d30ae82
> --- /dev/null
> +++ 
> b/Documentation/devicetree/bindings/display/panel/panel-simple-lvds-dual-ports.yaml
> @@ -0,0 +1,126 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: 
> http://devicetree.org/schemas/display/panel/panel-simple-lvds-dual-ports.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Simple LVDS panels with one power supply and dual LVDS ports
> +
> +maintainers:
> +  - Liu Ying 
> +  - Thierry Reding 
> +  - Sam Ravnborg 
> +
> +description: |
> +  This binding file is a collection of the LVDS panels that
> +  has dual LVDS ports and requires only a single power-supply.
> +  The first port receives odd pixels, and the second port receives even 
> pixels.
> +  There are optionally a backlight and an enable GPIO.
> +  The panel may use an OF graph binding for the association to the display,
> +  or it may be a direct child node of the display.
> +
> +  If the panel is more advanced a dedicated binding file is required.
> +
> +allOf:
> +  - $ref: panel-common.yaml#
> +
> +properties:
> +
> +  compatible:
> +enum:
> +# compatible must be listed in alphabetical order, ordered by compatible.
> +# The description in the comment is mandatory for each compatible.
> +
> +# AU Optronics Corporation 13.3" FHD (1920x1080) TFT LCD panel
> +  - auo,g133han01
> +# AU Optronics Corporation 18.5" FHD (1920x1080) TFT LCD panel
> +  - auo,g185han01
> +# AU Optronics Corporation 19.0" (1280x1024) TFT LCD panel
> +  - auo,g190ean01
> +# Kaohsiung Opto-Electronics Inc. 10.1" WUXGA (1920 x 1200) LVDS TFT 
> LCD panel
> +  - koe,tx26d202vm0bwa
> +# NLT Technologies, Ltd. 15.6" FHD (1920x1080) LVDS TFT LCD panel
> +  - nlt,nl192108ac18-02d
> +
> +  ports:
> +type: object
> +properties:
> +  '#address-cells':
> +const: 1
> +
> +  '#size-cells':
> +const: 0
> +
> +  port@0:
> +type: object
> +description: The sink for odd pixels.
> +properties:
> +  reg:
> +const: 0
> +
> +  dual-lvds-odd-pixels: true

Needs a type and description.

> +
> +required:
> +  - reg
> +  - dual-lvds-odd-pixels
> +
> +  port@1:
> +type: object
> +description: The sink for even pixels.
> +properties:
> +  reg:
> +const: 1
> +
> +  dual-lvds-even-pixels: true

Needs a type and description.

> +
> +required:
> +  - reg
> +  - dual-lvds-even-pixels
> +
> +required:
> +  - "#address-cells"
> +  - "#size-cells"
> +  - port@0
> +  - port@1
> +
> +additionalProperties: false
> +
> +  backlight: true
> +  enable-gpios: true
> +  power-supply: true
> +
> +additionalProperties: false
> +
> +required:
> +  - compatible
> +  - power-supply
> +
> +examples:
> +  - |
> +panel: 

Re: [PATCH] drm/amdgpu: fix check oder in amdgpu_bo_move

2020-11-16 Thread Alex Deucher
On Mon, Nov 16, 2020 at 2:14 PM Christian König
 wrote:
>
> Reorder the code to fix checking if blitting is available.
>
> Signed-off-by: Christian König 
> Fixes: f5a89a5cae81 drm/amdgpu/ttm: use multihop

Typo in the subject (oder -> order).  With that fixes the patch is:
Acked-by: Alex Deucher 

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 53 +++--
>  1 file changed, 23 insertions(+), 30 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index 676fb520e044..c438d290a6db 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -551,25 +551,12 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, 
> bool evict,
> struct ttm_resource *old_mem = >mem;
> int r;
>
> -   if ((old_mem->mem_type == TTM_PL_SYSTEM &&
> -new_mem->mem_type == TTM_PL_VRAM) ||
> -   (old_mem->mem_type == TTM_PL_VRAM &&
> -new_mem->mem_type == TTM_PL_SYSTEM)) {
> -   hop->fpfn = 0;
> -   hop->lpfn = 0;
> -   hop->mem_type = TTM_PL_TT;
> -   hop->flags = 0;
> -   return -EMULTIHOP;
> -   }
> -
> if (new_mem->mem_type == TTM_PL_TT) {
> r = amdgpu_ttm_backend_bind(bo->bdev, bo->ttm, new_mem);
> if (r)
> return r;
> }
>
> -   amdgpu_bo_move_notify(bo, evict, new_mem);
> -
> /* Can't move a pinned BO */
> abo = ttm_to_amdgpu_bo(bo);
> if (WARN_ON_ONCE(abo->tbo.pin_count > 0))
> @@ -579,24 +566,23 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, 
> bool evict,
>
> if (old_mem->mem_type == TTM_PL_SYSTEM && bo->ttm == NULL) {
> ttm_bo_move_null(bo, new_mem);
> -   return 0;
> +   goto out;
> }
> if (old_mem->mem_type == TTM_PL_SYSTEM &&
> new_mem->mem_type == TTM_PL_TT) {
> ttm_bo_move_null(bo, new_mem);
> -   return 0;
> +   goto out;
> }
> -
> if (old_mem->mem_type == TTM_PL_TT &&
> new_mem->mem_type == TTM_PL_SYSTEM) {
> r = ttm_bo_wait_ctx(bo, ctx);
> if (r)
> -   goto fail;
> +   return r;
>
> amdgpu_ttm_backend_unbind(bo->bdev, bo->ttm);
> ttm_resource_free(bo, >mem);
> ttm_bo_assign_mem(bo, new_mem);
> -   return 0;
> +   goto out;
> }
>
> if (old_mem->mem_type == AMDGPU_PL_GDS ||
> @@ -607,27 +593,37 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, 
> bool evict,
> new_mem->mem_type == AMDGPU_PL_OA) {
> /* Nothing to save here */
> ttm_bo_move_null(bo, new_mem);
> -   return 0;
> +   goto out;
> }
>
> -   if (!adev->mman.buffer_funcs_enabled) {
> +   if (adev->mman.buffer_funcs_enabled) {
> +   if (((old_mem->mem_type == TTM_PL_SYSTEM &&
> + new_mem->mem_type == TTM_PL_VRAM) ||
> +(old_mem->mem_type == TTM_PL_VRAM &&
> + new_mem->mem_type == TTM_PL_SYSTEM))) {
> +   hop->fpfn = 0;
> +   hop->lpfn = 0;
> +   hop->mem_type = TTM_PL_TT;
> +   hop->flags = 0;
> +   return -EMULTIHOP;
> +   }
> +
> +   r = amdgpu_move_blit(bo, evict, new_mem, old_mem);
> +   } else {
> r = -ENODEV;
> -   goto memcpy;
> }
>
> -   r = amdgpu_move_blit(bo, evict, new_mem, old_mem);
> if (r) {
> -memcpy:
> /* Check that all memory is CPU accessible */
> if (!amdgpu_mem_visible(adev, old_mem) ||
> !amdgpu_mem_visible(adev, new_mem)) {
> pr_err("Move buffer fallback to memcpy 
> unavailable\n");
> -   goto fail;
> +   return r;
> }
>
> r = ttm_bo_move_memcpy(bo, ctx, new_mem);
> if (r)
> -   goto fail;
> +   return r;
> }
>
> if (bo->type == ttm_bo_type_device &&
> @@ -639,14 +635,11 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, 
> bool evict,
> abo->flags &= ~AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
> }
>
> +out:
> /* update statistics */
> atomic64_add((u64)bo->num_pages << PAGE_SHIFT, 
> >num_bytes_moved);
> +   amdgpu_bo_move_notify(bo, evict, new_mem);
> return 0;
> -fail:
> -   swap(*new_mem, bo->mem);
> -   amdgpu_bo_move_notify(bo, false, new_mem);
> -   swap(*new_mem, bo->mem);
> -   return r;
>  }
>
>  /**
> --
> 2.25.1
>
> 

[PATCH] drm/amdgpu: fix check oder in amdgpu_bo_move

2020-11-16 Thread Christian König
Reorder the code to fix checking if blitting is available.

Signed-off-by: Christian König 
Fixes: f5a89a5cae81 drm/amdgpu/ttm: use multihop
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 53 +++--
 1 file changed, 23 insertions(+), 30 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 676fb520e044..c438d290a6db 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -551,25 +551,12 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, 
bool evict,
struct ttm_resource *old_mem = >mem;
int r;
 
-   if ((old_mem->mem_type == TTM_PL_SYSTEM &&
-new_mem->mem_type == TTM_PL_VRAM) ||
-   (old_mem->mem_type == TTM_PL_VRAM &&
-new_mem->mem_type == TTM_PL_SYSTEM)) {
-   hop->fpfn = 0;
-   hop->lpfn = 0;
-   hop->mem_type = TTM_PL_TT;
-   hop->flags = 0;
-   return -EMULTIHOP;
-   }
-
if (new_mem->mem_type == TTM_PL_TT) {
r = amdgpu_ttm_backend_bind(bo->bdev, bo->ttm, new_mem);
if (r)
return r;
}
 
-   amdgpu_bo_move_notify(bo, evict, new_mem);
-
/* Can't move a pinned BO */
abo = ttm_to_amdgpu_bo(bo);
if (WARN_ON_ONCE(abo->tbo.pin_count > 0))
@@ -579,24 +566,23 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, 
bool evict,
 
if (old_mem->mem_type == TTM_PL_SYSTEM && bo->ttm == NULL) {
ttm_bo_move_null(bo, new_mem);
-   return 0;
+   goto out;
}
if (old_mem->mem_type == TTM_PL_SYSTEM &&
new_mem->mem_type == TTM_PL_TT) {
ttm_bo_move_null(bo, new_mem);
-   return 0;
+   goto out;
}
-
if (old_mem->mem_type == TTM_PL_TT &&
new_mem->mem_type == TTM_PL_SYSTEM) {
r = ttm_bo_wait_ctx(bo, ctx);
if (r)
-   goto fail;
+   return r;
 
amdgpu_ttm_backend_unbind(bo->bdev, bo->ttm);
ttm_resource_free(bo, >mem);
ttm_bo_assign_mem(bo, new_mem);
-   return 0;
+   goto out;
}
 
if (old_mem->mem_type == AMDGPU_PL_GDS ||
@@ -607,27 +593,37 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, 
bool evict,
new_mem->mem_type == AMDGPU_PL_OA) {
/* Nothing to save here */
ttm_bo_move_null(bo, new_mem);
-   return 0;
+   goto out;
}
 
-   if (!adev->mman.buffer_funcs_enabled) {
+   if (adev->mman.buffer_funcs_enabled) {
+   if (((old_mem->mem_type == TTM_PL_SYSTEM &&
+ new_mem->mem_type == TTM_PL_VRAM) ||
+(old_mem->mem_type == TTM_PL_VRAM &&
+ new_mem->mem_type == TTM_PL_SYSTEM))) {
+   hop->fpfn = 0;
+   hop->lpfn = 0;
+   hop->mem_type = TTM_PL_TT;
+   hop->flags = 0;
+   return -EMULTIHOP;
+   }
+
+   r = amdgpu_move_blit(bo, evict, new_mem, old_mem);
+   } else {
r = -ENODEV;
-   goto memcpy;
}
 
-   r = amdgpu_move_blit(bo, evict, new_mem, old_mem);
if (r) {
-memcpy:
/* Check that all memory is CPU accessible */
if (!amdgpu_mem_visible(adev, old_mem) ||
!amdgpu_mem_visible(adev, new_mem)) {
pr_err("Move buffer fallback to memcpy unavailable\n");
-   goto fail;
+   return r;
}
 
r = ttm_bo_move_memcpy(bo, ctx, new_mem);
if (r)
-   goto fail;
+   return r;
}
 
if (bo->type == ttm_bo_type_device &&
@@ -639,14 +635,11 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, 
bool evict,
abo->flags &= ~AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
}
 
+out:
/* update statistics */
atomic64_add((u64)bo->num_pages << PAGE_SHIFT, >num_bytes_moved);
+   amdgpu_bo_move_notify(bo, evict, new_mem);
return 0;
-fail:
-   swap(*new_mem, bo->mem);
-   amdgpu_bo_move_notify(bo, false, new_mem);
-   swap(*new_mem, bo->mem);
-   return r;
 }
 
 /**
-- 
2.25.1

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


Re: [PATCH v2 1/8] drm: Add dummy page per device or GEM object

2020-11-16 Thread Andrey Grodzovsky


On 11/16/20 4:48 AM, Christian König wrote:

Am 15.11.20 um 07:34 schrieb Andrey Grodzovsky:


On 11/14/20 4:51 AM, Daniel Vetter wrote:

On Sat, Nov 14, 2020 at 9:41 AM Christian König
 wrote:

Am 13.11.20 um 21:52 schrieb Andrey Grodzovsky:

On 6/22/20 1:50 PM, Daniel Vetter wrote:

On Mon, Jun 22, 2020 at 7:45 PM Christian König
 wrote:

Am 22.06.20 um 16:32 schrieb Andrey Grodzovsky:

On 6/22/20 9:18 AM, Christian König wrote:

Am 21.06.20 um 08:03 schrieb Andrey Grodzovsky:

Will be used to reroute CPU mapped BO's page faults once
device is removed.

Signed-off-by: Andrey Grodzovsky 
---
    drivers/gpu/drm/drm_file.c  |  8 
    drivers/gpu/drm/drm_prime.c | 10 ++
    include/drm/drm_file.h  |  2 ++
    include/drm/drm_gem.h   |  2 ++
    4 files changed, 22 insertions(+)

diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c
index c4c704e..67c0770 100644
--- a/drivers/gpu/drm/drm_file.c
+++ b/drivers/gpu/drm/drm_file.c
@@ -188,6 +188,12 @@ struct drm_file *drm_file_alloc(struct
drm_minor *minor)
    goto out_prime_destroy;
    }
    +    file->dummy_page = alloc_page(GFP_KERNEL | __GFP_ZERO);
+    if (!file->dummy_page) {
+    ret = -ENOMEM;
+    goto out_prime_destroy;
+    }
+
    return file;
  out_prime_destroy:
@@ -284,6 +290,8 @@ void drm_file_free(struct drm_file *file)
    if (dev->driver->postclose)
    dev->driver->postclose(dev, file);
    +    __free_page(file->dummy_page);
+
drm_prime_destroy_file_private(>prime);
WARN_ON(!list_empty(>event_list));
diff --git a/drivers/gpu/drm/drm_prime.c
b/drivers/gpu/drm/drm_prime.c
index 1de2cde..c482e9c 100644
--- a/drivers/gpu/drm/drm_prime.c
+++ b/drivers/gpu/drm/drm_prime.c
@@ -335,6 +335,13 @@ int drm_gem_prime_fd_to_handle(struct
drm_device *dev,
  ret = drm_prime_add_buf_handle(_priv->prime,
    dma_buf, *handle);
+
+    if (!ret) {
+    obj->dummy_page = alloc_page(GFP_KERNEL | __GFP_ZERO);
+    if (!obj->dummy_page)
+    ret = -ENOMEM;
+    }
+

While the per file case still looks acceptable this is a clear NAK
since it will massively increase the memory needed for a prime
exported object.

I think that this is quite overkill in the first place and for the
hot unplug case we can just use the global dummy page as well.

Christian.

Global dummy page is good for read access, what do you do on write
access ? My first approach was indeed to map at first global dummy
page as read only and mark the vma->vm_flags as !VM_SHARED assuming
that this would trigger Copy On Write flow in core mm
(https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Felixir.bootlin.com%2Flinux%2Fv5.7-rc7%2Fsource%2Fmm%2Fmemory.c%23L3977data=04%7C01%7CAndrey.Grodzovsky%40amd.com%7C00053e9d983041ed63ae08d2ed87%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637409443224016377%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000sdata=kghiG3VpCJod6YefExoDVPl9X03zNhw3SN5GAxgbnmU%3Dreserved=0) 



on the next page fault to same address triggered by a write access but
then i realized a new COW page will be allocated for each such mapping
and this is much more wasteful then having a dedicated page per GEM
object.

Yeah, but this is only for a very very small corner cases. What we need
to prevent is increasing the memory usage during normal operation to
much.

Using memory during the unplug is completely unproblematic because we
just released quite a bunch of it by releasing all those system memory
buffers.

And I'm pretty sure that COWed pages are correctly accounted towards
the
used memory of a process.

So I think if that approach works as intended and the COW pages are
released again on unmapping it would be the perfect solution to the
problem.

Daniel what do you think?

If COW works, sure sounds reasonable. And if we can make sure we
managed to drop all the system allocations (otherwise suddenly 2x
memory usage, worst case). But I have no idea whether we can
retroshoehorn that into an established vma, you might have fun stuff
like a mkwrite handler there (which I thought is the COW handler
thing, but really no idea).

If we need to massively change stuff then I think rw dummy page,
allocated on first fault after hotunplug (maybe just make it one per
object, that's simplest) seems like the much safer option. Much less
code that can go wrong.
-Daniel


Regarding COW, i was looking into how to properly implement it from
within the fault handler (i.e. ttm_bo_vm_fault)
and the main obstacle I hit is that of exclusive access to the
vm_area_struct, i need to be able to modify
vma->vm_flags (and vm_page_prot)  to remove VM_SHARED bit so COW can
be triggered on subsequent write access
fault (here

Re: [PATCH v4 10/27] video: fix some kernel-doc markups

2020-11-16 Thread Mauro Carvalho Chehab
Em Mon, 16 Nov 2020 18:24:04 +0100
Daniel Vetter  escreveu:

> On Mon, Nov 16, 2020 at 05:38:04PM +0100, Mauro Carvalho Chehab wrote:
> > Em Mon, 16 Nov 2020 16:36:06 +0100
> > Daniel Vetter  escreveu:
> >   
> > > On Mon, Nov 16, 2020 at 11:18:06AM +0100, Mauro Carvalho Chehab wrote:  
> > > > Some identifiers have different names between their prototypes
> > > > and the kernel-doc markup.
> > > > 
> > > > Signed-off-by: Mauro Carvalho Chehab 
> > > 
> > > Acked-by: Daniel Vetter 
> > > 
> > > I'm assuming you're sending a pull request for this.  
> > 
> > Feel free to just merge it via your tree. Patches here are pretty
> > much independent ;-)  
> 
> Ok I put it into drm-misc-next. I kinda assumed since there's also a huge
> effort going on to shut up warnings, plus I think kerneldoc issues are
> reported by a bunch of build bots nowadays. So assumed you pile this all
> up.

Currently, this doesn't generate any warnings (which, IMHO, it is a
very bad thing). The final patch on this series actually such warning. 
My plan is to have the final patch merged for Kernel 5.11.

So, at least from PoV of shut up warnings[1], this patch be either
be merged for 5.11 or earlier.

Regards,
Mauro

-

[1] Basically, if you do:

/**
 * foo - some foo func
 */
int bar(...)

the documentation will be for "bar()" function, instead of
"foo()", as Kernel-doc currently simply ignores "foo".

On several places, this is due to a typo or a function
rename, but there are a few places where a "bar()" function
got added between the kernel-doc markup and "foo()" function,
thus producing wrong docs. Don't remember if are there any
such issues under drivers/video or drivers/gpu.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v1 0/4] Add bus format negotiation support for Cadence MHDP8546 driver

2020-11-16 Thread Tomi Valkeinen
Hi,

On 13/11/2020 11:46, Yuti Amonkar wrote:
> This patch series add bus format negotiation support for Cadence MHDP8546 
> bridge
> driver.
> 
> The patch series has four patches in the below sequence:
> 1. drm: bridge: cdns-mhdp8546: Add output bus format negotiation
> Add minimal output bus format negotiation support.
> 2. drm: bridge: cdns-mhdp8546: Modify atomic_get_input_bus_format bridge 
> function.
> Get the input format based on output format supported.
> 3. drm: bridge: cdns-mhdp8546: Remove setting of bus format using connector 
> info
> Remove the bus format configuration using connector info structure.
> 4. drm: bridge: cdns-mhdp8546: Retrieve the pixel format and bpc based on bus 
> format
> Get the pixel format and bpc based on negotiated output bus format.
> 
> This patch series is dependent on tidss series [1] for the new connector 
> model support.
> 
> [1]
> https://patchwork.kernel.org/project/dri-devel/cover/20201109170601.21557-1-nikhil...@ti.com/
>  

Can you explain how this works?

Afaics, what we should be doing is:

- We don't have proper bus formats for DP output, so we need to use 
MEDIA_BUS_FMT_FIXED as the
output format. This is what you do in the first patch. (But is that patch even 
needed, if
MEDIA_BUS_FMT_FIXED is the default anyway)

- In cdns_mhdp_get_input_bus_fmts, the function should exit if the given output 
format is not
MEDIA_BUS_FMT_FIXED.

- In cdns_mhdp_get_input_bus_fmts, the driver should return all the RGB bus 
formats, if MHDP is able
to upscale/downscale RGB (e.g. RGB 8-bpc to RGB 12-bpc).

- If the monitor supports YUV modes according to the display_info, 
cdns_mhdp_get_input_bus_fmts can
also return those.

- Then later, in atomic_check and commit, mhdp driver has the negotiated bus 
format, which it should
use to program the registers.

 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/imx: depend on COMMON_CLK to fix compile tests

2020-11-16 Thread Krzysztof Kozlowski
The iMX DRM drivers use Common Clock Framework thus they cannot be built
on platforms without it (e.g. compile test on MIPS with RALINK and
SOC_RT305X):

/usr/bin/mips-linux-gnu-ld: drivers/gpu/drm/imx/imx-ldb.o: in function 
`imx_ldb_encoder_disable':
imx-ldb.c:(.text+0x400): undefined reference to `clk_set_parent'

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/gpu/drm/imx/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/imx/Kconfig b/drivers/gpu/drm/imx/Kconfig
index 6231048aa5aa..65f9ef625337 100644
--- a/drivers/gpu/drm/imx/Kconfig
+++ b/drivers/gpu/drm/imx/Kconfig
@@ -5,7 +5,8 @@ config DRM_IMX
select VIDEOMODE_HELPERS
select DRM_GEM_CMA_HELPER
select DRM_KMS_CMA_HELPER
-   depends on DRM && (ARCH_MXC || ARCH_MULTIPLATFORM || COMPILE_TEST)
+   depends on DRM
+   depends on ARCH_MXC || ARCH_MULTIPLATFORM || COMPILE_TEST && COMMON_CLK
depends on IMX_IPUV3_CORE
help
  enable i.MX graphics support
-- 
2.25.1

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


Re: [PATCH v4 10/27] video: fix some kernel-doc markups

2020-11-16 Thread Sam Ravnborg
Hi Daniel
> > Feel free to just merge it via your tree. Patches here are pretty
> > much independent ;-)
> 
> Ok I put it into drm-misc-next. I kinda assumed since there's also a huge
> effort going on to shut up warnings, plus I think kerneldoc issues are
> reported by a bunch of build bots nowadays. So assumed you pile this all
> up.

Any reason "drm: fix some kernel-doc markups" was not applied?

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


[PATCH 1/2] drm/exynos: depend on COMMON_CLK to fix compile tests

2020-11-16 Thread Krzysztof Kozlowski
The Exynos DRM uses Common Clock Framework thus it cannot be built on
platforms without it (e.g. compile test on MIPS with RALINK and
SOC_RT305X):

/usr/bin/mips-linux-gnu-ld: drivers/gpu/drm/exynos/exynos_mixer.o: in 
function `mixer_bind':
exynos_mixer.c:(.text+0x958): undefined reference to `clk_set_parent'

Reported-by: kernel test robot 
Signed-off-by: Krzysztof Kozlowski 
---
 drivers/gpu/drm/exynos/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig
index 6417f374b923..951d5f708e92 100644
--- a/drivers/gpu/drm/exynos/Kconfig
+++ b/drivers/gpu/drm/exynos/Kconfig
@@ -1,7 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0-only
 config DRM_EXYNOS
tristate "DRM Support for Samsung SoC Exynos Series"
-   depends on OF && DRM && (ARCH_S3C64XX || ARCH_S5PV210 || ARCH_EXYNOS || 
ARCH_MULTIPLATFORM || COMPILE_TEST)
+   depends on OF && DRM && COMMON_CLK
+   depends on ARCH_S3C64XX || ARCH_S5PV210 || ARCH_EXYNOS || 
ARCH_MULTIPLATFORM || COMPILE_TEST
depends on MMU
select DRM_KMS_HELPER
select VIDEOMODE_HELPERS
-- 
2.25.1

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


[PATCH 2/2] drm/ingenic: depend on COMMON_CLK to fix compile tests

2020-11-16 Thread Krzysztof Kozlowski
The Ingenic DRM uses Common Clock Framework thus it cannot be built on
platforms without it (e.g. compile test on MIPS with RALINK and
SOC_RT305X):

/usr/bin/mips-linux-gnu-ld: drivers/gpu/drm/ingenic/ingenic-drm-drv.o: in 
function `ingenic_drm_bind.isra.0':
ingenic-drm-drv.c:(.text+0x1600): undefined reference to `clk_get_parent'
/usr/bin/mips-linux-gnu-ld: ingenic-drm-drv.c:(.text+0x16b0): undefined 
reference to `clk_get_parent'

Reported-by: kernel test robot 
Signed-off-by: Krzysztof Kozlowski 
---
 drivers/gpu/drm/ingenic/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/ingenic/Kconfig b/drivers/gpu/drm/ingenic/Kconfig
index 477d5387e43e..3b57f8be007c 100644
--- a/drivers/gpu/drm/ingenic/Kconfig
+++ b/drivers/gpu/drm/ingenic/Kconfig
@@ -4,6 +4,7 @@ config DRM_INGENIC
depends on DRM
depends on CMA
depends on OF
+   depends on COMMON_CLK
select DRM_BRIDGE
select DRM_PANEL_BRIDGE
select DRM_KMS_HELPER
-- 
2.25.1

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


Re: [RESEND PATCH v2 4/5] drm/msm: add DRM_MSM_GEM_SYNC_CACHE for non-coherent cache maintenance

2020-11-16 Thread Rob Clark
On Mon, Nov 16, 2020 at 9:33 AM Christoph Hellwig  wrote:
>
> On Sat, Nov 14, 2020 at 03:07:20PM -0500, Jonathan Marek wrote:
> > qcom's vulkan driver has nonCoherentAtomSize=1, and it looks like
> > dma_sync_single_for_cpu() does deal in some way with the partial cache line
> > case, although I'm not sure that means we can have a nonCoherentAtomSize=1.
>
> No, it doesn't.  You need to ensure ownership is managed at
> dma_get_cache_alignment() granularity.

my guess is nonCoherentAtomSize=1 only works in the case of cache
coherent buffers

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


[PATCH v2 0/3] drm/msm: Shrinker fixes and opts

2020-11-16 Thread Rob Clark
From: Rob Clark 

The last patch is the main thing, motivated by some cases where we would
spend a lot of time in msm_gem_shrinker_count().  First two are fixes I
noticed along the way.

Rob Clark (3):
  drm/msm: Protect obj->active_count under obj lock
  drm/msm/shrinker: We can vmap shrink active_list too
  drm/msm/shrinker: Only iterate dontneed objs

 drivers/gpu/drm/msm/msm_debugfs.c  |  3 +-
 drivers/gpu/drm/msm/msm_drv.c  |  3 +-
 drivers/gpu/drm/msm/msm_drv.h  |  8 ++--
 drivers/gpu/drm/msm/msm_gem.c  | 45 --
 drivers/gpu/drm/msm/msm_gem.h  |  5 ++-
 drivers/gpu/drm/msm/msm_gem_shrinker.c | 52 +++---
 drivers/gpu/drm/msm/msm_gpu.c  | 10 +++--
 7 files changed, 89 insertions(+), 37 deletions(-)

-- 
2.28.0

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


[PATCH v2 3/3] drm/msm/shrinker: Only iterate dontneed objs

2020-11-16 Thread Rob Clark
From: Rob Clark 

In situations where the GPU is mostly idle, all or nearly all buffer
objects will be in the inactive list.  But if the system is under memory
pressure (from something other than GPU), we could still get a lot of
shrinker calls.  Which results in traversing a list of thousands of objs
and in the end finding nothing to shrink.  Which isn't so efficient.

Instead split the inactive_list into two lists, one inactive objs which
are shrinkable, and a second one for those that are not.  This way we
can avoid traversing objs which we know are not shrinker candidates.

v2: Fix inverted logic think-o

Signed-off-by: Rob Clark 
---
 drivers/gpu/drm/msm/msm_debugfs.c  |  3 ++-
 drivers/gpu/drm/msm/msm_drv.c  |  3 ++-
 drivers/gpu/drm/msm/msm_drv.h  |  8 +++---
 drivers/gpu/drm/msm/msm_gem.c  | 34 --
 drivers/gpu/drm/msm/msm_gem_shrinker.c |  7 +++---
 5 files changed, 40 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_debugfs.c 
b/drivers/gpu/drm/msm/msm_debugfs.c
index 64afbed89821..85ad0babc326 100644
--- a/drivers/gpu/drm/msm/msm_debugfs.c
+++ b/drivers/gpu/drm/msm/msm_debugfs.c
@@ -124,7 +124,8 @@ static int msm_gem_show(struct drm_device *dev, struct 
seq_file *m)
}
 
seq_printf(m, "Inactive Objects:\n");
-   msm_gem_describe_objects(>inactive_list, m);
+   msm_gem_describe_objects(>inactive_dontneed, m);
+   msm_gem_describe_objects(>inactive_willneed, m);
 
mutex_unlock(>mm_lock);
 
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index 4d808769e6ed..39a54f364aa8 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -465,7 +465,8 @@ static int msm_drm_init(struct device *dev, struct 
drm_driver *drv)
 
priv->wq = alloc_ordered_workqueue("msm", 0);
 
-   INIT_LIST_HEAD(>inactive_list);
+   INIT_LIST_HEAD(>inactive_willneed);
+   INIT_LIST_HEAD(>inactive_dontneed);
mutex_init(>mm_lock);
 
/* Teach lockdep about lock ordering wrt. shrinker: */
diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index f869ed67b5da..ed18c5bed10f 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -175,8 +175,9 @@ struct msm_drm_private {
struct msm_perf_state *perf;
 
/*
-* List of inactive GEM objects.  Every bo is either in the 
inactive_list
-* or gpu->active_list (for the gpu it is active on[1])
+* Lists of inactive GEM objects.  Every bo is either in one of the
+* inactive lists (depending on whether or not it is shrinkable) or
+* gpu->active_list (for the gpu it is active on[1])
 *
 * These lists are protected by mm_lock.  If struct_mutex is involved, 
it
 * should be aquired prior to mm_lock.  One should *not* hold mm_lock in
@@ -185,7 +186,8 @@ struct msm_drm_private {
 * [1] if someone ever added support for the old 2d cores, there could 
be
 * more than one gpu object
 */
-   struct list_head inactive_list;
+   struct list_head inactive_willneed;  /* inactive + !shrinkable */
+   struct list_head inactive_dontneed;  /* inactive +  shrinkable */
struct mutex mm_lock;
 
struct workqueue_struct *wq;
diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c
index 2795288b0a95..318ccc2fae86 100644
--- a/drivers/gpu/drm/msm/msm_gem.c
+++ b/drivers/gpu/drm/msm/msm_gem.c
@@ -17,6 +17,7 @@
 #include "msm_gpu.h"
 #include "msm_mmu.h"
 
+static void update_inactive(struct msm_gem_object *msm_obj);
 
 static dma_addr_t physaddr(struct drm_gem_object *obj)
 {
@@ -678,6 +679,12 @@ int msm_gem_madvise(struct drm_gem_object *obj, unsigned 
madv)
 
madv = msm_obj->madv;
 
+   /* If the obj is inactive, we might need to move it
+* between inactive lists
+*/
+   if (msm_obj->active_count == 0)
+   update_inactive(msm_obj);
+
msm_gem_unlock(obj);
 
return (madv != __MSM_MADV_PURGED);
@@ -781,19 +788,31 @@ void msm_gem_active_get(struct drm_gem_object *obj, 
struct msm_gpu *gpu)
 void msm_gem_active_put(struct drm_gem_object *obj)
 {
struct msm_gem_object *msm_obj = to_msm_bo(obj);
-   struct msm_drm_private *priv = obj->dev->dev_private;
 
might_sleep();
WARN_ON(!msm_gem_is_locked(obj));
 
if (--msm_obj->active_count == 0) {
-   mutex_lock(>mm_lock);
-   list_del_init(_obj->mm_list);
-   list_add_tail(_obj->mm_list, >inactive_list);
-   mutex_unlock(>mm_lock);
+   update_inactive(msm_obj);
}
 }
 
+static void update_inactive(struct msm_gem_object *msm_obj)
+{
+   struct msm_drm_private *priv = msm_obj->base.dev->dev_private;
+
+   mutex_lock(>mm_lock);
+   WARN_ON(msm_obj->active_count != 0);
+
+   list_del_init(_obj->mm_list);
+   if 

[PATCH v2 2/3] drm/msm/shrinker: We can vmap shrink active_list too

2020-11-16 Thread Rob Clark
From: Rob Clark 

Just because a obj is active, if the vmap_count is zero, we can still
tear down the vmap.

Signed-off-by: Rob Clark 
---
 drivers/gpu/drm/msm/msm_gem_shrinker.c | 47 +++---
 1 file changed, 35 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_gem_shrinker.c 
b/drivers/gpu/drm/msm/msm_gem_shrinker.c
index 6f4b1355725f..9d51c1eb808d 100644
--- a/drivers/gpu/drm/msm/msm_gem_shrinker.c
+++ b/drivers/gpu/drm/msm/msm_gem_shrinker.c
@@ -6,6 +6,7 @@
 
 #include "msm_drv.h"
 #include "msm_gem.h"
+#include "msm_gpu.h"
 #include "msm_gpu_trace.h"
 
 static unsigned long
@@ -61,17 +62,19 @@ msm_gem_shrinker_scan(struct shrinker *shrinker, struct 
shrink_control *sc)
return freed;
 }
 
-static int
-msm_gem_shrinker_vmap(struct notifier_block *nb, unsigned long event, void 
*ptr)
+/* since we don't know any better, lets bail after a few
+ * and if necessary the shrinker will be invoked again.
+ * Seems better than unmapping *everything*
+ */
+static const int vmap_shrink_limit = 15;
+
+static unsigned
+vmap_shrink(struct list_head *mm_list)
 {
-   struct msm_drm_private *priv =
-   container_of(nb, struct msm_drm_private, vmap_notifier);
struct msm_gem_object *msm_obj;
unsigned unmapped = 0;
 
-   mutex_lock(>mm_lock);
-
-   list_for_each_entry(msm_obj, >inactive_list, mm_list) {
+   list_for_each_entry(msm_obj, mm_list, mm_list) {
if (!msm_gem_trylock(_obj->base))
continue;
if (is_vunmapable(msm_obj)) {
@@ -80,11 +83,31 @@ msm_gem_shrinker_vmap(struct notifier_block *nb, unsigned 
long event, void *ptr)
}
msm_gem_unlock(_obj->base);
 
-   /* since we don't know any better, lets bail after a few
-* and if necessary the shrinker will be invoked again.
-* Seems better than unmapping *everything*
-*/
-   if (++unmapped >= 15)
+   if (++unmapped >= vmap_shrink_limit)
+   break;
+   }
+
+   return unmapped;
+}
+
+static int
+msm_gem_shrinker_vmap(struct notifier_block *nb, unsigned long event, void 
*ptr)
+{
+   struct msm_drm_private *priv =
+   container_of(nb, struct msm_drm_private, vmap_notifier);
+   struct list_head *mm_lists[] = {
+   >inactive_list,
+   priv->gpu ? >gpu->active_list : NULL,
+   NULL,
+   };
+   unsigned idx, unmapped = 0;
+
+   mutex_lock(>mm_lock);
+
+   for (idx = 0; mm_lists[idx]; idx++) {
+   unmapped += vmap_shrink(mm_lists[idx]);
+
+   if (unmapped >= vmap_shrink_limit)
break;
}
 
-- 
2.28.0

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


  1   2   3   >