RE: [PATCH 1/2] drm/print: drop include debugfs.h and include where needed

2024-04-24 Thread Deucher, Alexander
[Public]

> -Original Message-
> From: Jani Nikula 
> Sent: Wednesday, April 24, 2024 9:55 AM
> To: dri-de...@lists.freedesktop.org
> Cc: Andrzej Hajda ; Maxime Ripard
> ; Jacek Lawrynowicz
> ; Stanislaw Gruszka
> ; Oded Gabbay ;
> Russell King ; David Airlie ; Daniel
> Vetter ; Neil Armstrong ; Robert
> Foss ; Laurent Pinchart
> ; Jonas Karlman ;
> Jernej Skrabec ; Maarten Lankhorst
> ; Thomas Zimmermann
> ; Rodrigo Vivi ; Joonas
> Lahtinen ; Tvrtko Ursulin
> ; Frank Binns ; Matt Coster
> ; Rob Clark ; Abhinav
> Kumar ; Dmitry Baryshkov
> ; Sean Paul ; Marijn Suijten
> ; Karol Herbst ; Lyude
> Paul ; Danilo Krummrich ; Deucher,
> Alexander ; Koenig, Christian
> ; Pan, Xinhui ; Alain
> Volmat ; Huang, Ray ;
> Zack Rusin ; Broadcom internal kernel review list
> ; Lucas De Marchi
> ; Thomas Hellström
> ; intel-...@lists.freedesktop.org; intel-
> x...@lists.freedesktop.org; linux-arm-...@vger.kernel.org;
> freedr...@lists.freedesktop.org; nouveau@lists.freedesktop.org; amd-
> g...@lists.freedesktop.org
> Subject: Re: [PATCH 1/2] drm/print: drop include debugfs.h and include where
> needed
>
> On Mon, 22 Apr 2024, Jani Nikula  wrote:
> > Surprisingly many places depend on debugfs.h to be included via
> > drm_print.h. Fix them.
> >
> > v3: Also fix armada, ite-it6505, imagination, msm, sti, vc4, and xe
> >
> > v2: Also fix ivpu and vmwgfx
> >
> > Reviewed-by: Andrzej Hajda 
> > Acked-by: Maxime Ripard 
> > Link:
> >
> https://patchwork.freedesktop.org/patch/msgid/20240410141434.157908
> -1-
> > jani.nik...@intel.com
> > Signed-off-by: Jani Nikula 
>
> While the changes all over the place are small, mostly just adding the
> debugfs.h include, please consider acking. I've sent this a few times already.
>

For radeon:
Acked-by: Alex Deucher 

> Otherwise, I'll merge this by the end of the week, acks or not.
>
> Thanks,
> Jani.
>
>
>
> >
> > ---
> >
> > Cc: Jacek Lawrynowicz 
> > Cc: Stanislaw Gruszka 
> > Cc: Oded Gabbay 
> > Cc: Russell King 
> > Cc: David Airlie 
> > Cc: Daniel Vetter 
> > Cc: Andrzej Hajda 
> > Cc: Neil Armstrong 
> > Cc: Robert Foss 
> > Cc: Laurent Pinchart 
> > Cc: Jonas Karlman 
> > Cc: Jernej Skrabec 
> > Cc: Maarten Lankhorst 
> > Cc: Maxime Ripard 
> > Cc: Thomas Zimmermann 
> > Cc: Jani Nikula 
> > Cc: Rodrigo Vivi 
> > Cc: Joonas Lahtinen 
> > Cc: Tvrtko Ursulin 
> > Cc: Frank Binns 
> > Cc: Matt Coster 
> > Cc: Rob Clark 
> > Cc: Abhinav Kumar 
> > Cc: Dmitry Baryshkov 
> > Cc: Sean Paul 
> > Cc: Marijn Suijten 
> > Cc: Karol Herbst 
> > Cc: Lyude Paul 
> > Cc: Danilo Krummrich 
> > Cc: Alex Deucher 
> > Cc: "Christian König" 
> > Cc: "Pan, Xinhui" 
> > Cc: Alain Volmat 
> > Cc: Huang Rui 
> > Cc: Zack Rusin 
> > Cc: Broadcom internal kernel review list
> > 
> > Cc: Lucas De Marchi 
> > Cc: "Thomas Hellström" 
> > Cc: dri-de...@lists.freedesktop.org
> > Cc: intel-...@lists.freedesktop.org
> > Cc: intel...@lists.freedesktop.org
> > Cc: linux-arm-...@vger.kernel.org
> > Cc: freedr...@lists.freedesktop.org
> > Cc: nouveau@lists.freedesktop.org
> > Cc: amd-...@lists.freedesktop.org
> > ---
> >  drivers/accel/ivpu/ivpu_debugfs.c   | 2 ++
> >  drivers/gpu/drm/armada/armada_debugfs.c | 1 +
> >  drivers/gpu/drm/bridge/ite-it6505.c | 1 +
> >  drivers/gpu/drm/bridge/panel.c  | 2 ++
> >  drivers/gpu/drm/drm_print.c | 6 +++---
> >  drivers/gpu/drm/i915/display/intel_dmc.c| 1 +
> >  drivers/gpu/drm/imagination/pvr_fw_trace.c  | 1 +
> > drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | 2 ++
> >  drivers/gpu/drm/nouveau/dispnv50/crc.c  | 2 ++
> >  drivers/gpu/drm/radeon/r100.c   | 1 +
> >  drivers/gpu/drm/radeon/r300.c   | 1 +
> >  drivers/gpu/drm/radeon/r420.c   | 1 +
> >  drivers/gpu/drm/radeon/r600.c   | 3 ++-
> >  drivers/gpu/drm/radeon/radeon_fence.c   | 1 +
> >  drivers/gpu/drm/radeon/radeon_gem.c | 1 +
> >  drivers/gpu/drm/radeon/radeon_ib.c  | 2 ++
> >  drivers/gpu/drm/radeon/radeon_pm.c  | 1 +
> >  drivers/gpu/drm/radeon/radeon_ring.c| 2 ++
> >  drivers/gpu/drm/radeon/radeon_ttm.c | 1 +
> >  drivers/gpu/drm/radeon/rs400.c  | 1 +
> >  drivers/gpu/drm/radeon/rv515.c  | 1 +
> >  drivers/gpu/drm/sti/sti_drv.c   | 1 +
> >  d

Re: [Nouveau] [PATCH 0/5] Add the pci_get_base_class() helper and use it

2023-08-25 Thread Deucher, Alexander
[Public]

> -Original Message-
> From: amd-gfx  On Behalf Of Sui
> Jingfeng
> Sent: Friday, August 25, 2023 2:27 AM
> To: Bjorn Helgaas 
> Cc: alsa-de...@alsa-project.org; Sui Jingfeng ;
> nouveau@lists.freedesktop.org; linux-ker...@vger.kernel.org; dri-
> de...@lists.freedesktop.org; amd-...@lists.freedesktop.org; linux-
> p...@vger.kernel.org
> Subject: [PATCH 0/5] Add the pci_get_base_class() helper and use it
>
> From: Sui Jingfeng 
>
> There is no function that can be used to get all PCI(e) devices in a system by
> matching against its the PCI base class code only, while keep the sub-class 
> code
> and the programming interface ignored. Therefore, add the
> pci_get_base_class() function to suit the need.
>
> For example, if an application want to process all PCI(e) display devices in a
> system, it can achieve such goal by writing the code as following:
>
> pdev = NULL;
> do {
> pdev = pci_get_base_class(PCI_BASE_CLASS_DISPLAY, pdev);
> if (!pdev)
> break;
>
> do_something_for_pci_display_device(pdev);
> } while (1);
>
> Sui Jingfeng (5):
>   PCI: Add the pci_get_base_class() helper
>   ALSA: hda/intel: Use pci_get_base_class() to reduce duplicated code
>   drm/nouveau: Use pci_get_base_class() to reduce duplicated code
>   drm/amdgpu: Use pci_get_base_class() to reduce duplicated code
>   drm/radeon: Use pci_get_base_class() to reduce duplicated code
>

Series is:
Reviewed-by: Alex Deucher 

>  drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 11 +++--
> drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 20 ---
>  drivers/gpu/drm/nouveau/nouveau_acpi.c   | 11 +++--
>  drivers/gpu/drm/radeon/radeon_bios.c | 20 ---
>  drivers/pci/search.c | 31 
>  include/linux/pci.h  |  5 
>  sound/pci/hda/hda_intel.c| 16 
>  7 files changed, 59 insertions(+), 55 deletions(-)
>
> --
> 2.34.1



Re: [Nouveau] [PATCH v3 01/20] drm/amdgpu: Add error handling to amdgpu_dm_initialize_dp_connector()

2021-04-21 Thread Deucher, Alexander
[AMD Official Use Only - Internal Distribution Only]

I'm fine with having these changes go through drm-misc.

Alex


From: Lipski, Mikita 
Sent: Wednesday, April 21, 2021 10:23 AM
To: Lyude Paul ; dri-de...@lists.freedesktop.org 
; intel-...@lists.freedesktop.org 
; nouveau@lists.freedesktop.org 
; amd-...@lists.freedesktop.org 
; Ville Syrjälä ; 
Jani Nikula ; Rodrigo Vivi 
; Thomas Zimmermann ; Thierry 
Reding 
Cc: Wang, Chao-kai (Stylon) ; Lipski, Mikita 
; Park, Chris ; Brol, Eryk 
; Li, Sun peng (Leo) ; Lakha, 
Bhawanpreet ; Lin, Wayne ; 
Siqueira, Rodrigo ; open list 
; Kazlauskas, Nicholas 
; Somasundaram, Meenakshikumar 
; David Airlie ; Pillai, 
Aurabindo ; Daniel Vetter ; Bas 
Nieuwenhuizen ; Deucher, Alexander 
; Cornij, Nikola ; Wentland, 
Harry ; Koenig, Christian 
Subject: Re: [PATCH v3 01/20] drm/amdgpu: Add error handling to 
amdgpu_dm_initialize_dp_connector()

Thanks for the change!

Reviewed-by: Mikita Lipski 

On 2021-04-19 6:55 p.m., Lyude Paul wrote:
> While working on moving i2c device registration into drm_dp_aux_init() - I
> realized that in order to do so we need to make sure that drivers calling
> drm_dp_aux_init() handle any errors it could possibly return. In the
> process of doing that, I noticed that the majority of AMD's code for DP
> connector creation doesn't attempt to do any real error handling.
>
> So, let's fix this and also cleanup amdgpu_dm_initialize_dp_connector()
> while we're at it. This way we can handle the error codes from
> drm_dp_aux_init().
>
> Signed-off-by: Lyude Paul 
> ---
>   .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 29 +++-
>   .../display/amdgpu_dm/amdgpu_dm_mst_types.c   | 44 +++
>   .../display/amdgpu_dm/amdgpu_dm_mst_types.h   |  6 +--
>   3 files changed, 45 insertions(+), 34 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index a0c8c41e4e57..fc5d315bbb05 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -7608,10 +7608,9 @@ static int amdgpu_dm_connector_init(struct 
> amdgpu_display_manager *dm,
>
>aconnector->i2c = i2c;
>res = i2c_add_adapter(>base);
> -
>if (res) {
>DRM_ERROR("Failed to register hw i2c %d\n", link->link_index);
> - goto out_free;
> + goto fail_free;
>}
>
>connector_type = to_drm_connector_type(link->connector_signal);
> @@ -7625,8 +7624,7 @@ static int amdgpu_dm_connector_init(struct 
> amdgpu_display_manager *dm,
>
>if (res) {
>DRM_ERROR("connector_init failed\n");
> - aconnector->connector_id = -1;
> - goto out_free;
> + goto fail_id;
>}
>
>drm_connector_helper_add(
> @@ -7643,15 +7641,22 @@ static int amdgpu_dm_connector_init(struct 
> amdgpu_display_manager *dm,
>drm_connector_attach_encoder(
>>base, >base);
>
> - if (connector_type == DRM_MODE_CONNECTOR_DisplayPort
> - || connector_type == DRM_MODE_CONNECTOR_eDP)
> - amdgpu_dm_initialize_dp_connector(dm, aconnector, 
> link->link_index);
> -
> -out_free:
> - if (res) {
> - kfree(i2c);
> - aconnector->i2c = NULL;
> + if (connector_type == DRM_MODE_CONNECTOR_DisplayPort ||
> + connector_type == DRM_MODE_CONNECTOR_eDP) {
> + res = amdgpu_dm_initialize_dp_connector(dm, aconnector, 
> link->link_index);
> + if (res)
> + goto fail_cleanup;
>}
> +
> + return 0;
> +fail_cleanup:
> + drm_connector_cleanup(>base);
> +fail_id:
> + aconnector->connector_id = -1;
> +fail_free:
> + kfree(i2c);
> + aconnector->i2c = NULL;
> +
>return res;
>   }
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c 
> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
> index 73cdb9fe981a..3dee9cce9c9e 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
> @@ -425,33 +425,39 @@ static const struct drm_dp_mst_topology_cbs dm_mst_cbs 
> = {
>.add_connector = dm_dp_add_mst_connector,
>   };
>
> -void amdgpu_dm_initialize_dp_connector(struct amdgpu_display_manager *dm,
> -struct amdgpu_dm_connector *aconnector,
> -int link_index)
> +int amdgpu_dm_initialize_dp_connector(struct amdgpu_display_manager *dm,
> 

Re: [Nouveau] [PATCH v3] PCI: Use ioremap(), not phys_to_virt() for platform ROM

2020-03-30 Thread Deucher, Alexander
[AMD Public Use]

> -Original Message-
> From: Bjorn Helgaas 
> Sent: Saturday, March 28, 2020 4:19 PM
> To: Mikel Rychliski 
> Cc: amd-...@lists.freedesktop.org; linux-...@vger.kernel.org;
> nouveau@lists.freedesktop.org; Deucher, Alexander
> ; Koenig, Christian
> ; Zhou, David(ChunMing)
> ; Matthew Garrett
> ; Ben Skeggs ;
> Christoph Hellwig 
> Subject: Re: [PATCH v3] PCI: Use ioremap(), not phys_to_virt() for platform
> ROM
> 
> On Wed, Mar 18, 2020 at 10:16:23PM -0400, Mikel Rychliski wrote:
> > On some EFI systems, the video BIOS is provided by the EFI firmware.
> > The boot stub code stores the physical address of the ROM image in pdev-
> >rom.
> > Currently we attempt to access this pointer using phys_to_virt(),
> > which doesn't work with CONFIG_HIGHMEM.
> >
> > On these systems, attempting to load the radeon module on a x86_32
> > kernel can result in the following:
> >
> > BUG: unable to handle page fault for address: 3e8ed03c
> > #PF: supervisor read access in kernel mode
> > #PF: error_code(0x) - not-present page
> > *pde = 
> > Oops:  [#1] PREEMPT SMP
> > CPU: 0 PID: 317 Comm: systemd-udevd Not tainted 5.6.0-rc3-next-
> 20200228 #2
> > Hardware name: Apple Computer, Inc. MacPro1,1/Mac-F4208DC8, BIOS
> MP11.88Z.005C.B08.0707021221 07/02/07
> > EIP: radeon_get_bios+0x5ed/0xe50 [radeon]
> > Code: 00 00 84 c0 0f 85 12 fd ff ff c7 87 64 01 00 00 00 00 00 00 8b 47 
> > 08 8b
> 55 b0 e8 1e 83 e1 d6 85 c0 74 1a 8b 55 c0 85 d2 74 13 <80> 38 55 75 0e 80 78 
> 01
> aa 0f 84 a4 03 00 00 8d 74 26 00 68 dc 06
> > EAX: 3e8ed03c EBX:  ECX: 3e8ed03c EDX: 0001
> > ESI: 0004 EDI: eec04000 EBP: eef3fc60 ESP: eef3fbe0
> > DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 EFLAGS: 00010206
> > CR0: 80050033 CR2: 3e8ed03c CR3: 2ec77000 CR4: 06d0
> > Call Trace:
> >  ? register_client+0x34/0xe0
> >  ? register_client+0xab/0xe0
> >  r520_init+0x26/0x240 [radeon]
> >  radeon_device_init+0x533/0xa50 [radeon]
> >  radeon_driver_load_kms+0x80/0x220 [radeon]
> >  drm_dev_register+0xa7/0x180 [drm]
> >  radeon_pci_probe+0x10f/0x1a0 [radeon]
> >  pci_device_probe+0xd4/0x140
> >  really_probe+0x13d/0x3b0
> >  driver_probe_device+0x56/0xd0
> >  device_driver_attach+0x49/0x50
> >  __driver_attach+0x79/0x130
> >  ? device_driver_attach+0x50/0x50
> >  bus_for_each_dev+0x5b/0xa0
> >  driver_attach+0x19/0x20
> >  ? device_driver_attach+0x50/0x50
> >  bus_add_driver+0x117/0x1d0
> >  ? pci_bus_num_vf+0x20/0x20
> >  driver_register+0x66/0xb0
> >  ? 0xf80f4000
> >  __pci_register_driver+0x3d/0x40
> >  radeon_init+0x82/0x1000 [radeon]
> >  do_one_initcall+0x42/0x200
> >  ? kvfree+0x25/0x30
> >  ? __vunmap+0x206/0x230
> >  ? kmem_cache_alloc_trace+0x16f/0x220
> >  ? do_init_module+0x21/0x220
> >  do_init_module+0x50/0x220
> >  load_module+0x1f26/0x2200
> >  sys_init_module+0x12d/0x160
> >  do_fast_syscall_32+0x82/0x250
> >  entry_SYSENTER_32+0xa5/0xf8
> >
> > Fix the issue by updating all drivers which can access a platform
> > provided ROM. Instead of calling the helper function
> > pci_platform_rom() which uses phys_to_virt(), call ioremap() directly on
> the pdev->rom.
> >
> > radeon_read_platform_bios() previously directly accessed an __iomem
> > pointer. Avoid this by calling memcpy_fromio() instead of kmemdup().
> >
> > pci_platform_rom() now has no remaining callers, so remove it.
> >
> > Signed-off-by: Mikel Rychliski 
> 
> I applied this to pci/resource for v5.7.  I would feel better if some of the
> graphics guys chimed in, or even applied it via the DRM tree since most of the
> changes are actually in drivers/gpu.

Feel free to take it through the PCI tree.  These areas of radeon and amdgpu 
don't really change much at all so, I'm not too concerned about a conflict.

Acked-by: Alex Deucher 

> 
> Feel free to add my
> 
>   Acked-by: Bjorn Helgaas 
> 
> and let me know if you do that.
> 
> > ---
> >
> > Tested on a MacPro 1,1 with a Radeon X1900 XT card and 32-bit kernel.
> >
> > Changes in v3:
> >  - Inline pci_platform_rom()
> >
> > Changes in v2:
> >  - Add iounmap() call in nouveau
> >  - Update function comment for pci_platform_rom()
> >  - Minor changes to commit messages
> >
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c  

Re: [Nouveau] [PATCH v7 1/9] drm_dp_cec: add connector info support.

2019-08-25 Thread Deucher, Alexander
Acked-by: Alex Deucher 

From: Hans Verkuil 
Sent: Thursday, August 22, 2019 4:08 AM
To: Dariusz Marcinkiewicz ; dri-de...@lists.freedesktop.org 
; linux-me...@vger.kernel.org 

Cc: David Airlie ; nouveau@lists.freedesktop.org 
; Dhinakaran Pandiyan 
; Koo, Anthony ; Francis, 
David ; amd-...@lists.freedesktop.org 
; Zuo, Jerry ; Ben Skeggs 
; Li, Sun peng (Leo) ; 
intel-...@lists.freedesktop.org ; Maxime 
Ripard ; Rodrigo Vivi ; Sean Paul 
; Thomas Lim ; 
linux-ker...@vger.kernel.org ; Manasi Navare 
; Deucher, Alexander ; 
Koenig, Christian ; Ville Syrjälä 

Subject: Re: [PATCH v7 1/9] drm_dp_cec: add connector info support.

Alex, Ville/Rodrigo, Ben,

Can you (hopefully) Ack this patch so that I can merge it?

Thank you!

Hans

On 8/14/19 12:44 PM, Dariusz Marcinkiewicz wrote:
> Pass the connector info to the CEC adapter. This makes it possible
> to associate the CEC adapter with the corresponding drm connector.
>
> Signed-off-by: Dariusz Marcinkiewicz 
> Signed-off-by: Hans Verkuil 
> Tested-by: Hans Verkuil 
> ---
>  .../display/amdgpu_dm/amdgpu_dm_mst_types.c   |  2 +-
>  drivers/gpu/drm/drm_dp_cec.c  | 25 ---
>  drivers/gpu/drm/i915/display/intel_dp.c   |  4 +--
>  drivers/gpu/drm/nouveau/nouveau_connector.c   |  3 +--
>  include/drm/drm_dp_helper.h   | 17 ++---
>  5 files changed, 27 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c 
> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
> index 16218a202b591..5ec14efd4d8cb 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
> @@ -416,7 +416,7 @@ void amdgpu_dm_initialize_dp_connector(struct 
> amdgpu_display_manager *dm,
>
>drm_dp_aux_register(>dm_dp_aux.aux);
>drm_dp_cec_register_connector(>dm_dp_aux.aux,
> -   aconnector->base.name, dm->adev->dev);
> +   >base);
>aconnector->mst_mgr.cbs = _mst_cbs;
>drm_dp_mst_topology_mgr_init(
>>mst_mgr,
> diff --git a/drivers/gpu/drm/drm_dp_cec.c b/drivers/gpu/drm/drm_dp_cec.c
> index b15cee85b702b..b457c16c3a8bb 100644
> --- a/drivers/gpu/drm/drm_dp_cec.c
> +++ b/drivers/gpu/drm/drm_dp_cec.c
> @@ -8,7 +8,9 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
> +#include 
>  #include 
>
>  /*
> @@ -295,7 +297,10 @@ static void drm_dp_cec_unregister_work(struct 
> work_struct *work)
>   */
>  void drm_dp_cec_set_edid(struct drm_dp_aux *aux, const struct edid *edid)
>  {
> - u32 cec_caps = CEC_CAP_DEFAULTS | CEC_CAP_NEEDS_HPD;
> + struct drm_connector *connector = aux->cec.connector;
> + u32 cec_caps = CEC_CAP_DEFAULTS | CEC_CAP_NEEDS_HPD |
> +CEC_CAP_CONNECTOR_INFO;
> + struct cec_connector_info conn_info;
>unsigned int num_las = 1;
>u8 cap;
>
> @@ -344,13 +349,17 @@ void drm_dp_cec_set_edid(struct drm_dp_aux *aux, const 
> struct edid *edid)
>
>/* Create a new adapter */
>aux->cec.adap = cec_allocate_adapter(_dp_cec_adap_ops,
> -  aux, aux->cec.name, cec_caps,
> +  aux, connector->name, cec_caps,
> num_las);
>if (IS_ERR(aux->cec.adap)) {
>aux->cec.adap = NULL;
>goto unlock;
>}
> - if (cec_register_adapter(aux->cec.adap, aux->cec.parent)) {
> +
> + cec_fill_conn_info_from_drm(_info, connector);
> + cec_s_conn_info(aux->cec.adap, _info);
> +
> + if (cec_register_adapter(aux->cec.adap, connector->dev->dev)) {
>cec_delete_adapter(aux->cec.adap);
>aux->cec.adap = NULL;
>} else {
> @@ -406,22 +415,20 @@ EXPORT_SYMBOL(drm_dp_cec_unset_edid);
>  /**
>   * drm_dp_cec_register_connector() - register a new connector
>   * @aux: DisplayPort AUX channel
> - * @name: name of the CEC device
> - * @parent: parent device
> + * @connector: drm connector
>   *
>   * A new connector was registered with associated CEC adapter name and
>   * CEC adapter parent device. After registering the name and parent
>   * drm_dp_cec_set_edid() is called to check if the connector supports
>   * CEC and to register a CEC adapter if that is the case.
>   */
> -void drm_dp_cec_register_connector(struct drm_dp_aux *aux, const char *name,
> -struct device *parent)
> +void drm_dp_cec_register_connector

Re: [Nouveau] [PATCH 09/17] drm/radeon: use common fence implementation for fences

2014-07-09 Thread Deucher, Alexander


 -Original Message-
 From: Maarten Lankhorst [mailto:maarten.lankho...@canonical.com]
 Sent: Wednesday, July 09, 2014 8:30 AM
 To: airl...@linux.ie
 Cc: thellst...@vmware.com; nouveau@lists.freedesktop.org; linux-
 ker...@vger.kernel.org; dri-de...@lists.freedesktop.org;
 bske...@redhat.com; Deucher, Alexander; Koenig, Christian
 Subject: [PATCH 09/17] drm/radeon: use common fence implementation for
 fences
 
 Signed-off-by: Maarten Lankhorst maarten.lankho...@canonical.com
 ---
  drivers/gpu/drm/radeon/radeon.h|   15 +-
  drivers/gpu/drm/radeon/radeon_device.c |   60 -
  drivers/gpu/drm/radeon/radeon_fence.c  |  223
 ++--
  3 files changed, 248 insertions(+), 50 deletions(-)
 
 diff --git a/drivers/gpu/drm/radeon/radeon.h
 b/drivers/gpu/drm/radeon/radeon.h
 index 29d9cc04c04e..03a5567f2c2f 100644
 --- a/drivers/gpu/drm/radeon/radeon.h
 +++ b/drivers/gpu/drm/radeon/radeon.h
 @@ -64,6 +64,7 @@
  #include linux/wait.h
  #include linux/list.h
  #include linux/kref.h
 +#include linux/fence.h
 
  #include ttm/ttm_bo_api.h
  #include ttm/ttm_bo_driver.h
 @@ -116,9 +117,6 @@ extern int radeon_deep_color;
  #define RADEONFB_CONN_LIMIT  4
  #define RADEON_BIOS_NUM_SCRATCH  8
 
 -/* fence seq are set to this number when signaled */
 -#define RADEON_FENCE_SIGNALED_SEQ0LL
 -
  /* internal ring indices */
  /* r1xx+ has gfx CP ring */
  #define RADEON_RING_TYPE_GFX_INDEX   0
 @@ -350,12 +348,15 @@ struct radeon_fence_driver {
  };
 
  struct radeon_fence {
 + struct fence base;
 +
   struct radeon_device*rdev;
 - struct kref kref;
   /* protected by radeon_fence.lock */
   uint64_tseq;
   /* RB, DMA, etc. */
   unsignedring;
 +
 + wait_queue_t fence_wake;
  };
 
  int radeon_fence_driver_start_ring(struct radeon_device *rdev, int ring);
 @@ -2268,6 +2269,7 @@ struct radeon_device {
   struct radeon_mman  mman;
   struct radeon_fence_driver  fence_drv[RADEON_NUM_RINGS];
   wait_queue_head_t   fence_queue;
 + unsignedfence_context;
   struct mutexring_lock;
   struct radeon_ring  ring[RADEON_NUM_RINGS];
   boolib_pool_ready;
 @@ -2358,11 +2360,6 @@ u32 cik_mm_rdoorbell(struct radeon_device
 *rdev, u32 index);
  void cik_mm_wdoorbell(struct radeon_device *rdev, u32 index, u32 v);
 
  /*
 - * Cast helper
 - */
 -#define to_radeon_fence(p) ((struct radeon_fence *)(p))
 -
 -/*
   * Registers read  write functions.
   */
  #define RREG8(reg) readb((rdev-rmmio) + (reg))
 diff --git a/drivers/gpu/drm/radeon/radeon_device.c
 b/drivers/gpu/drm/radeon/radeon_device.c
 index 03686fab842d..86699df7c8f3 100644
 --- a/drivers/gpu/drm/radeon/radeon_device.c
 +++ b/drivers/gpu/drm/radeon/radeon_device.c
 @@ -1213,6 +1213,7 @@ int radeon_device_init(struct radeon_device
 *rdev,
   for (i = 0; i  RADEON_NUM_RINGS; i++) {
   rdev-ring[i].idx = i;
   }
 + rdev-fence_context =
 fence_context_alloc(RADEON_NUM_RINGS);
 
   DRM_INFO(initializing kernel modesetting (%s 0x%04X:0x%04X
 0x%04X:0x%04X).\n,
   radeon_family_name[rdev-family], pdev-vendor, pdev-
 device,
 @@ -1607,6 +1608,54 @@ int radeon_resume_kms(struct drm_device *dev,
 bool resume, bool fbcon)
   return 0;
  }
 
 +static uint32_t radeon_gpu_mask_sw_irq(struct radeon_device *rdev)
 +{
 + uint32_t mask = 0;
 + int i;
 +
 + if (!rdev-ddev-irq_enabled)
 + return mask;
 +
 + /*
 +  * increase refcount on sw interrupts for all rings to stop
 +  * enabling interrupts in radeon_fence_enable_signaling during
 +  * gpu reset.
 +  */
 +
 + for (i = 0; i  RADEON_NUM_RINGS; ++i) {
 + if (!rdev-ring[i].ready)
 + continue;
 +
 + atomic_inc(rdev-irq.ring_int[i]);
 + mask |= 1  i;
 + }
 + return mask;
 +}
 +
 +static void radeon_gpu_unmask_sw_irq(struct radeon_device *rdev,
 uint32_t mask)
 +{
 + unsigned long irqflags;
 + int i;
 +
 + if (!mask)
 + return;
 +
 + /*
 +  * undo refcount increase, and reset irqs to correct value.
 +  */
 +
 + for (i = 0; i  RADEON_NUM_RINGS; ++i) {
 + if (!(mask  (1  i)))
 + continue;
 +
 + atomic_dec(rdev-irq.ring_int[i]);
 + }
 +
 + spin_lock_irqsave(rdev-irq.lock, irqflags);
 + radeon_irq_set(rdev);
 + spin_unlock_irqrestore(rdev-irq.lock, irqflags);
 +}
 +
  /**
   * radeon_gpu_reset - reset the asic
   *
 @@ -1624,6 +1673,7 @@ int radeon_gpu_reset(struct radeon_device *rdev)
 
   int i, r;
   int resched;
 + uint32_t sw_mask;
 
   down_write(rdev-exclusive_lock);
 
 @@ -1637,6 +1687,7 @@ int radeon_gpu_reset(struct radeon_device *rdev