dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Oded Gabbay <oded.gabbay@amd.com>, Jerome Glisse <j.glisse@gmail.com>
Cc: Andrew Lewycky <Andrew.Lewycky@amd.com>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	Alex Deucher <alexander.deucher@amd.com>
Subject: Re: [PATCH 08/83] drm/radeon: Add calls to initialize and finalize kfd from radeon
Date: Thu, 17 Jul 2014 14:45:09 +0200	[thread overview]
Message-ID: <53C7C555.8040402@amd.com> (raw)
In-Reply-To: <53C7C1EA.3080002@amd.com>


[-- Attachment #1.1: Type: text/plain, Size: 6238 bytes --]

Am 17.07.2014 14:30, schrieb Oded Gabbay:
> On 17/07/14 15:29, Christian König wrote:
>> Am 17.07.2014 13:57, schrieb Oded Gabbay:
>>> On 11/07/14 19:36, Jerome Glisse wrote:
>>>> On Fri, Jul 11, 2014 at 12:50:08AM +0300, Oded Gabbay wrote:
>>>>> The KFD driver should be loaded when the radeon driver is loaded and
>>>>> should be finalized when the radeon driver is removed.
>>>>>
>>>>> This patch adds a function call to initialize kfd from radeon_init
>>>>> and a function call to finalize kfd from radeon_exit.
>>>>>
>>>>> If the KFD driver is not present in the system, the initialize call
>>>>> fails and the radeon driver continues normally.
>>>>>
>>>>> This patch also adds calls to probe, initialize and finalize a kfd 
>>>>> device
>>>>> per radeon device using the kgd-->kfd interface.
>>>>>
>>>>> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
>>>>
>>>> It might be nice to allow to build radeon without HSA so i think an
>>>> CONFIG_HSA should be added and have other thing depends on it.
>>>> Otherwise this one is.
>>>>
>>>> Reviewed-by: Jérôme Glisse <jglisse@redhat.com>
>>>>
>>> We do allow it :)
>>> There is no problem building radeon without the kfd. In that case, 
>>> when radeon
>>> finds out that kfd is not available, it simply moves on with its
>>> initialization procedure.
>>
>> At least off hand I don't see how this should work. Radeon directly 
>> calls
>> radeon_kfd_(probe|init|fini) and so has a direct dependency on it.
>>
>> Christian.
> But radeon_kfd.c is now a permanent part of the radeon driver. I 
> talked with Alex about it and we both agreed on that. So radeon_kfd_* 
> functions are *always* there when you build radeon.

Ah, I see. So radeon_kfd_init then tries to load the other module 
through symbol_request(). Long story short that's a bad idea for a 
couple of reasons.

First of all it only works when you build everything as module and 
second by doing so the radeon<->kfd interface must be handled as 
internal stable interface.

Only a very few drivers/subsystem do use symbol_request() and to see how 
to use it correctly please take a look at (for example) 
sound/pci/hda/hda_codec.c.

Essentially you need to handle all different combination of module vs. 
builtin like this:
> 1660  <http://lxr.free-electrons.com/source/sound/pci/hda/hda_codec.c#L1660>  #ifIS_MODULE  <http://lxr.free-electrons.com/ident?i=IS_MODULE>(CONFIG_SND_HDA_GENERIC)
> 1661  <http://lxr.free-electrons.com/source/sound/pci/hda/hda_codec.c#L1661>                          patch  <http://lxr.free-electrons.com/ident?i=patch>  =load_parser  <http://lxr.free-electrons.com/ident?i=load_parser>(codec  <http://lxr.free-electrons.com/ident?i=codec>,snd_hda_parse_generic_codec  <http://lxr.free-electrons.com/ident?i=snd_hda_parse_generic_codec>);
> 1662  <http://lxr.free-electrons.com/source/sound/pci/hda/hda_codec.c#L1662>  #elifIS_BUILTIN  <http://lxr.free-electrons.com/ident?i=IS_BUILTIN>(CONFIG_SND_HDA_GENERIC)
> 1663  <http://lxr.free-electrons.com/source/sound/pci/hda/hda_codec.c#L1663>                          patch  <http://lxr.free-electrons.com/ident?i=patch>  =snd_hda_parse_generic_codec  <http://lxr.free-electrons.com/ident?i=snd_hda_parse_generic_codec>;
> 1664  <http://lxr.free-electrons.com/source/sound/pci/hda/hda_codec.c#L1664>  #endif

I strongly suggest to just make the radeon module depend directly on the 
KFD module through a CONFIG_RADEON_KFD option.

Regards,
Christian.

>     Oded
>>
>>>
>>>     Oded
>>>>
>>>>> ---
>>>>>   drivers/gpu/drm/radeon/radeon_drv.c | 6 ++++++
>>>>>   drivers/gpu/drm/radeon/radeon_kms.c | 9 +++++++++
>>>>>   2 files changed, 15 insertions(+)
>>>>>
>>>>> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c
>>>>> b/drivers/gpu/drm/radeon/radeon_drv.c
>>>>> index cb14213..88a45a0 100644
>>>>> --- a/drivers/gpu/drm/radeon/radeon_drv.c
>>>>> +++ b/drivers/gpu/drm/radeon/radeon_drv.c
>>>>> @@ -151,6 +151,9 @@ static inline void 
>>>>> radeon_register_atpx_handler(void) {}
>>>>>   static inline void radeon_unregister_atpx_handler(void) {}
>>>>>   #endif
>>>>>
>>>>> +extern bool radeon_kfd_init(void);
>>>>> +extern void radeon_kfd_fini(void);
>>>>> +
>>>>>   int radeon_no_wb;
>>>>>   int radeon_modeset = -1;
>>>>>   int radeon_dynclks = -1;
>>>>> @@ -630,12 +633,15 @@ static int __init radeon_init(void)
>>>>>   #endif
>>>>>       }
>>>>>
>>>>> +    radeon_kfd_init();
>>>>> +
>>>>>       /* let modprobe override vga console setting */
>>>>>       return drm_pci_init(driver, pdriver);
>>>>>   }
>>>>>
>>>>>   static void __exit radeon_exit(void)
>>>>>   {
>>>>> +    radeon_kfd_fini();
>>>>>       drm_pci_exit(driver, pdriver);
>>>>>       radeon_unregister_atpx_handler();
>>>>>   }
>>>>> diff --git a/drivers/gpu/drm/radeon/radeon_kms.c
>>>>> b/drivers/gpu/drm/radeon/radeon_kms.c
>>>>> index 35d9318..0748284 100644
>>>>> --- a/drivers/gpu/drm/radeon/radeon_kms.c
>>>>> +++ b/drivers/gpu/drm/radeon/radeon_kms.c
>>>>> @@ -34,6 +34,10 @@
>>>>>   #include <linux/slab.h>
>>>>>   #include <linux/pm_runtime.h>
>>>>>
>>>>> +extern void radeon_kfd_device_probe(struct radeon_device *rdev);
>>>>> +extern void radeon_kfd_device_init(struct radeon_device *rdev);
>>>>> +extern void radeon_kfd_device_fini(struct radeon_device *rdev);
>>>>> +
>>>>>   #if defined(CONFIG_VGA_SWITCHEROO)
>>>>>   bool radeon_has_atpx(void);
>>>>>   #else
>>>>> @@ -63,6 +67,8 @@ int radeon_driver_unload_kms(struct drm_device 
>>>>> *dev)
>>>>>
>>>>>       pm_runtime_get_sync(dev->dev);
>>>>>
>>>>> +    radeon_kfd_device_fini(rdev);
>>>>> +
>>>>>       radeon_acpi_fini(rdev);
>>>>>
>>>>>       radeon_modeset_fini(rdev);
>>>>> @@ -142,6 +148,9 @@ int radeon_driver_load_kms(struct drm_device 
>>>>> *dev,
>>>>> unsigned long flags)
>>>>>                   "Error during ACPI methods call\n");
>>>>>       }
>>>>>
>>>>> +    radeon_kfd_device_probe(rdev);
>>>>> +    radeon_kfd_device_init(rdev);
>>>>> +
>>>>>       if (radeon_is_px(dev)) {
>>>>>           pm_runtime_use_autosuspend(dev->dev);
>>>>>           pm_runtime_set_autosuspend_delay(dev->dev, 5000);
>>>>> -- 
>>>>> 1.9.1
>>>>>
>>>
>>
>


[-- Attachment #1.2: Type: text/html, Size: 10959 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2014-07-17 12:45 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-10 21:50 [PATCH 02/83] drm/radeon: reduce number of free VMIDs and pipes in KV Oded Gabbay
2014-07-10 21:50 ` [PATCH 03/83] drm/radeon: Report doorbell configuration to kfd Oded Gabbay
2014-07-11 16:16   ` Jerome Glisse
2014-07-10 21:50 ` [PATCH 04/83] drm/radeon: Add radeon <--> kfd interface Oded Gabbay
2014-07-10 22:38   ` Joe Perches
2014-07-11 16:24     ` Jerome Glisse
2014-07-17 11:55       ` Oded Gabbay
2014-07-10 21:50 ` [PATCH 05/83] drm/radeon: Add kfd-->kgd interface to get virtual ram size Oded Gabbay
2014-07-11 16:27   ` Jerome Glisse
2014-07-10 21:50 ` [PATCH 06/83] drm/radeon: Add kfd-->kgd interfaces of memory allocation/mapping Oded Gabbay
2014-07-11 16:32   ` Jerome Glisse
2014-07-10 21:50 ` [PATCH 07/83] drm/radeon: Add kfd-->kgd interface of locking srbm_gfx_cntl register Oded Gabbay
2014-07-11 16:34   ` Jerome Glisse
2014-07-11 17:48     ` Bridgman, John
2014-07-12  0:36       ` Bridgman, John
2014-07-12  0:37       ` Bridgman, John
2014-07-10 21:50 ` [PATCH 08/83] drm/radeon: Add calls to initialize and finalize kfd from radeon Oded Gabbay
2014-07-11 16:36   ` Jerome Glisse
2014-07-17 11:57     ` Oded Gabbay
2014-07-17 12:29       ` Christian König
2014-07-17 12:30         ` Oded Gabbay
2014-07-17 12:45           ` Christian König [this message]
2014-07-17 13:31             ` Daniel Vetter
2014-07-10 21:50 ` [PATCH 09/83] hsa/radeon: Add code base of hsa driver for AMD's GPUs Oded Gabbay
2014-07-11 17:04   ` Jerome Glisse
2014-07-11 17:28     ` Joe Perches
2014-07-17 11:51       ` Oded Gabbay
2014-07-11 17:40     ` Daniel Vetter
2014-07-11 18:02     ` Bridgman, John
2014-07-11 18:10       ` Jerome Glisse
2014-07-11 18:46         ` Bridgman, John
2014-07-11 18:51           ` Jerome Glisse
2014-07-11 18:56             ` Bridgman, John
2014-07-11 19:22               ` Jerome Glisse
2014-07-11 19:38                 ` Joe Perches
2014-07-17 11:51                 ` Oded Gabbay
2014-07-10 21:50 ` [PATCH 10/83] hsa/radeon: Add initialization and unmapping of doorbell aperture Oded Gabbay
2014-07-10 21:50 ` [PATCH 11/83] hsa/radeon: Add scheduler code Oded Gabbay
2014-07-11 18:25   ` Jerome Glisse
2014-07-17 11:57     ` Oded Gabbay
2014-07-10 21:50 ` [PATCH 12/83] hsa/radeon: Add kfd mmap handler Oded Gabbay
2014-07-11 18:47   ` Jerome Glisse
2014-07-10 21:50 ` [PATCH 13/83] hsa/radeon: Add 2 new IOCTL to kfd, CREATE_QUEUE and DESTROY_QUEUE Oded Gabbay
2014-07-11 19:19   ` Jerome Glisse
2014-07-11 21:01   ` Jerome Glisse
2014-07-11 21:42   ` Dave Airlie
2014-07-14  7:33     ` Gabbay, Oded
2014-07-10 21:50 ` [PATCH 14/83] hsa/radeon: Update MAINTAINERS and CREDITS files Oded Gabbay
2014-07-10 21:50 ` [PATCH 15/83] hsa/radeon: Add interrupt handling module Oded Gabbay
2014-07-11 19:57   ` Jerome Glisse
2014-07-10 21:50 ` [PATCH 16/83] hsa/radeon: Add the isr function of the KFD scehduler Oded Gabbay
2014-07-10 21:50 ` [PATCH 17/83] hsa/radeon: Handle deactivation of queues using interrupts Oded Gabbay
2014-07-10 21:50 ` [PATCH 18/83] hsa/radeon: Enable interrupts in KFD scheduler Oded Gabbay
2014-07-10 21:50 ` [PATCH 19/83] hsa/radeon: Enable/Disable KFD interrupt module Oded Gabbay
2014-07-10 21:50 ` [PATCH 20/83] hsa/radeon: Add interrupt callback function to kgd2kfd interface Oded Gabbay
2014-07-10 21:50 ` [PATCH 21/83] hsa/radeon: Add kgd-->kfd interfaces for suspend and resume Oded Gabbay
2014-07-10 21:50 ` [PATCH 22/83] drm/radeon: Add calls to suspend and resume of kfd driver Oded Gabbay
2014-07-10 21:50 ` [PATCH 23/83] drm/radeon/cik: Don't touch int of pipes 1-7 Oded Gabbay
2014-07-10 21:50 ` [PATCH 24/83] drm/radeon/cik: Call kfd isr function Oded Gabbay
2014-07-10 21:50 ` [PATCH 25/83] hsa/radeon: fix the OEMID assignment in kfd_topology Oded Gabbay
2014-07-10 21:50 ` [PATCH 26/83] hsa/radeon: Make binding of process to device permanent Oded Gabbay
     [not found] ` <1405029027-6085-1-git-send-email-oded.gabbay-5C7GfCeVMHo@public.gmane.org>
2014-07-10 21:50   ` [PATCH 27/83] hsa/radeon: Implement hsaKmtSetMemoryPolicy Oded Gabbay
2014-07-11 16:05 ` [PATCH 02/83] drm/radeon: reduce number of free VMIDs and pipes in KV Jerome Glisse
2014-07-11 16:18   ` Christian König
2014-07-11 16:22     ` Alex Deucher
2014-07-11 17:07       ` Bridgman, John
2014-07-11 17:59         ` Ilyes Gouta
2014-07-11 22:54           ` Bridgman, John
2014-07-12  9:00       ` Christian König
2014-07-14  7:31         ` Michel Dänzer
2014-07-14  7:38 ` Michel Dänzer
2014-07-14  7:58   ` Christian König
2014-07-17 11:47     ` Oded Gabbay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53C7C555.8040402@amd.com \
    --to=christian.koenig@amd.com \
    --cc=Andrew.Lewycky@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=j.glisse@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oded.gabbay@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox