<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Am 17.07.2014 14:30, schrieb Oded
Gabbay:<br>
</div>
<blockquote cite="mid:53C7C1EA.3080002@amd.com" type="cite">On
17/07/14 15:29, Christian König wrote:
<br>
<blockquote type="cite">Am 17.07.2014 13:57, schrieb Oded Gabbay:
<br>
<blockquote type="cite">On 11/07/14 19:36, Jerome Glisse wrote:
<br>
<blockquote type="cite">On Fri, Jul 11, 2014 at 12:50:08AM
+0300, Oded Gabbay wrote:
<br>
<blockquote type="cite">The KFD driver should be loaded when
the radeon driver is loaded and
<br>
should be finalized when the radeon driver is removed.
<br>
<br>
This patch adds a function call to initialize kfd from
radeon_init
<br>
and a function call to finalize kfd from radeon_exit.
<br>
<br>
If the KFD driver is not present in the system, the
initialize call
<br>
fails and the radeon driver continues normally.
<br>
<br>
This patch also adds calls to probe, initialize and
finalize a kfd device
<br>
per radeon device using the kgd-->kfd interface.
<br>
<br>
Signed-off-by: Oded Gabbay <a class="moz-txt-link-rfc2396E" href="mailto:oded.gabbay@amd.com"><oded.gabbay@amd.com></a>
<br>
</blockquote>
<br>
It might be nice to allow to build radeon without HSA so i
think an
<br>
CONFIG_HSA should be added and have other thing depends on
it.
<br>
Otherwise this one is.
<br>
<br>
Reviewed-by: Jérôme Glisse <a class="moz-txt-link-rfc2396E" href="mailto:jglisse@redhat.com"><jglisse@redhat.com></a>
<br>
<br>
</blockquote>
We do allow it :)
<br>
There is no problem building radeon without the kfd. In that
case, when radeon
<br>
finds out that kfd is not available, it simply moves on with
its
<br>
initialization procedure.
<br>
</blockquote>
<br>
At least off hand I don't see how this should work. Radeon
directly calls
<br>
radeon_kfd_(probe|init|fini) and so has a direct dependency on
it.
<br>
<br>
Christian.
<br>
</blockquote>
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.
<br>
</blockquote>
<br>
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.<br>
<br>
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.<br>
<br>
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. <br>
<br>
Essentially you need to handle all different combination of module
vs. builtin like this:<br>
<blockquote type="cite">
<pre><a name="L1660" href="http://lxr.free-electrons.com/source/sound/pci/hda/hda_codec.c#L1660">1660</a> #if <a href="http://lxr.free-electrons.com/ident?i=IS_MODULE">IS_MODULE</a>(CONFIG_SND_HDA_GENERIC)
<a name="L1661" href="http://lxr.free-electrons.com/source/sound/pci/hda/hda_codec.c#L1661">1661</a> <a href="http://lxr.free-electrons.com/ident?i=patch">patch</a> = <a href="http://lxr.free-electrons.com/ident?i=load_parser">load_parser</a>(<a href="http://lxr.free-electrons.com/ident?i=codec">codec</a>, <a href="http://lxr.free-electrons.com/ident?i=snd_hda_parse_generic_codec">snd_hda_parse_generic_codec</a>);
<a name="L1662" href="http://lxr.free-electrons.com/source/sound/pci/hda/hda_codec.c#L1662">1662</a> #elif <a href="http://lxr.free-electrons.com/ident?i=IS_BUILTIN">IS_BUILTIN</a>(CONFIG_SND_HDA_GENERIC)
<a name="L1663" href="http://lxr.free-electrons.com/source/sound/pci/hda/hda_codec.c#L1663">1663</a> <a href="http://lxr.free-electrons.com/ident?i=patch">patch</a> = <a href="http://lxr.free-electrons.com/ident?i=snd_hda_parse_generic_codec">snd_hda_parse_generic_codec</a>;
<a name="L1664" href="http://lxr.free-electrons.com/source/sound/pci/hda/hda_codec.c#L1664">1664</a> #endif</pre>
</blockquote>
<br>
I strongly suggest to just make the radeon module depend directly on
the KFD module through a CONFIG_RADEON_KFD option.<br>
<br>
Regards,<br>
Christian.<br>
<br>
<blockquote cite="mid:53C7C1EA.3080002@amd.com" type="cite"> Oded
<br>
<blockquote type="cite">
<br>
<blockquote type="cite">
<br>
Oded
<br>
<blockquote type="cite">
<br>
<blockquote type="cite">---
<br>
drivers/gpu/drm/radeon/radeon_drv.c | 6 ++++++
<br>
drivers/gpu/drm/radeon/radeon_kms.c | 9 +++++++++
<br>
2 files changed, 15 insertions(+)
<br>
<br>
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c
<br>
b/drivers/gpu/drm/radeon/radeon_drv.c
<br>
index cb14213..88a45a0 100644
<br>
--- a/drivers/gpu/drm/radeon/radeon_drv.c
<br>
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
<br>
@@ -151,6 +151,9 @@ static inline void
radeon_register_atpx_handler(void) {}
<br>
static inline void radeon_unregister_atpx_handler(void)
{}
<br>
#endif
<br>
<br>
+extern bool radeon_kfd_init(void);
<br>
+extern void radeon_kfd_fini(void);
<br>
+
<br>
int radeon_no_wb;
<br>
int radeon_modeset = -1;
<br>
int radeon_dynclks = -1;
<br>
@@ -630,12 +633,15 @@ static int __init radeon_init(void)
<br>
#endif
<br>
}
<br>
<br>
+ radeon_kfd_init();
<br>
+
<br>
/* let modprobe override vga console setting */
<br>
return drm_pci_init(driver, pdriver);
<br>
}
<br>
<br>
static void __exit radeon_exit(void)
<br>
{
<br>
+ radeon_kfd_fini();
<br>
drm_pci_exit(driver, pdriver);
<br>
radeon_unregister_atpx_handler();
<br>
}
<br>
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c
<br>
b/drivers/gpu/drm/radeon/radeon_kms.c
<br>
index 35d9318..0748284 100644
<br>
--- a/drivers/gpu/drm/radeon/radeon_kms.c
<br>
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
<br>
@@ -34,6 +34,10 @@
<br>
#include <linux/slab.h>
<br>
#include <linux/pm_runtime.h>
<br>
<br>
+extern void radeon_kfd_device_probe(struct radeon_device
*rdev);
<br>
+extern void radeon_kfd_device_init(struct radeon_device
*rdev);
<br>
+extern void radeon_kfd_device_fini(struct radeon_device
*rdev);
<br>
+
<br>
#if defined(CONFIG_VGA_SWITCHEROO)
<br>
bool radeon_has_atpx(void);
<br>
#else
<br>
@@ -63,6 +67,8 @@ int radeon_driver_unload_kms(struct
drm_device *dev)
<br>
<br>
pm_runtime_get_sync(dev->dev);
<br>
<br>
+ radeon_kfd_device_fini(rdev);
<br>
+
<br>
radeon_acpi_fini(rdev);
<br>
<br>
radeon_modeset_fini(rdev);
<br>
@@ -142,6 +148,9 @@ int radeon_driver_load_kms(struct
drm_device *dev,
<br>
unsigned long flags)
<br>
"Error during ACPI methods call\n");
<br>
}
<br>
<br>
+ radeon_kfd_device_probe(rdev);
<br>
+ radeon_kfd_device_init(rdev);
<br>
+
<br>
if (radeon_is_px(dev)) {
<br>
pm_runtime_use_autosuspend(dev->dev);
<br>
pm_runtime_set_autosuspend_delay(dev->dev,
5000);
<br>
--
<br>
1.9.1
<br>
<br>
</blockquote>
</blockquote>
<br>
</blockquote>
<br>
</blockquote>
<br>
</blockquote>
<br>
</body>
</html>