diff mbox series

[v7,2/6] drm/i915: Unregister in-kernel clients

Message ID 20240301134448.31289-3-tzimmermann@suse.de (mailing list archive)
State New, archived
Headers show
Series drm/i915: Convert fbdev to DRM client | expand

Commit Message

Thomas Zimmermann March 1, 2024, 1:42 p.m. UTC
Unregister all in-kernel clients before unloading the i915 driver. For
other drivers, drm_dev_unregister() does this automatically. As i915
does not use this helper, it has to perform the call by itself. For xe,
do the same in xe_device_remove()

Note that there are currently no in-kernel clients in i915 or xe. The
patch prepares the drivers for a related update of their fbdev support.

v7:
	* update xe driver

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/i915/i915_driver.c | 3 +++
 drivers/gpu/drm/xe/xe_device.c     | 3 +++
 2 files changed, 6 insertions(+)

Comments

Rodrigo Vivi March 5, 2024, 4:06 p.m. UTC | #1
On Fri, Mar 01, 2024 at 02:42:55PM +0100, Thomas Zimmermann wrote:
> Unregister all in-kernel clients before unloading the i915 driver. For
> other drivers, drm_dev_unregister() does this automatically. As i915
> does not use this helper, it has to perform the call by itself. For xe,
> do the same in xe_device_remove()
> 
> Note that there are currently no in-kernel clients in i915 or xe. The
> patch prepares the drivers for a related update of their fbdev support.
> 
> v7:
> 	* update xe driver
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/i915/i915_driver.c | 3 +++
>  drivers/gpu/drm/xe/xe_device.c     | 3 +++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
> index 9ee902d5b72c4..97910a85e3917 100644
> --- a/drivers/gpu/drm/i915/i915_driver.c
> +++ b/drivers/gpu/drm/i915/i915_driver.c
> @@ -41,6 +41,7 @@
>  
>  #include <drm/drm_aperture.h>
>  #include <drm/drm_atomic_helper.h>
> +#include <drm/drm_client.h>
>  #include <drm/drm_ioctl.h>
>  #include <drm/drm_managed.h>
>  #include <drm/drm_probe_helper.h>
> @@ -852,6 +853,8 @@ void i915_driver_remove(struct drm_i915_private *i915)
>  {
>  	intel_wakeref_t wakeref;
>  
> +	drm_client_dev_unregister(&i915->drm);
> +
>  	wakeref = intel_runtime_pm_get(&i915->runtime_pm);
>  
>  	i915_driver_unregister(i915);
> diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
> index 919ad88f0495a..7f41f0ec819f0 100644
> --- a/drivers/gpu/drm/xe/xe_device.c
> +++ b/drivers/gpu/drm/xe/xe_device.c

probably deserves a separate patch since this is one here is named 'drm/i915:'

> @@ -9,6 +9,7 @@
>  
>  #include <drm/drm_aperture.h>
>  #include <drm/drm_atomic_helper.h>
> +#include <drm/drm_client.h>
>  #include <drm/drm_gem_ttm_helper.h>
>  #include <drm/drm_ioctl.h>
>  #include <drm/drm_managed.h>
> @@ -614,6 +615,8 @@ void xe_device_remove(struct xe_device *xe)
>  	struct xe_gt *gt;
>  	u8 id;
>  
> +	drm_client_dev_unregister(&xe->drm);
> +
>  	xe_device_remove_display(xe);
>  
>  	xe_display_fini(xe);
> -- 
> 2.43.2
>
Jani Nikula March 5, 2024, 4:25 p.m. UTC | #2
On Tue, 05 Mar 2024, Rodrigo Vivi <rodrigo.vivi@intel.com> wrote:
> On Fri, Mar 01, 2024 at 02:42:55PM +0100, Thomas Zimmermann wrote:
>> Unregister all in-kernel clients before unloading the i915 driver. For
>> other drivers, drm_dev_unregister() does this automatically. As i915
>> does not use this helper, it has to perform the call by itself. For xe,
>> do the same in xe_device_remove()
>> 
>> Note that there are currently no in-kernel clients in i915 or xe. The
>> patch prepares the drivers for a related update of their fbdev support.
>> 
>> v7:
>> 	* update xe driver
>> 
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>>  drivers/gpu/drm/i915/i915_driver.c | 3 +++
>>  drivers/gpu/drm/xe/xe_device.c     | 3 +++
>>  2 files changed, 6 insertions(+)
>> 
>> diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
>> index 9ee902d5b72c4..97910a85e3917 100644
>> --- a/drivers/gpu/drm/i915/i915_driver.c
>> +++ b/drivers/gpu/drm/i915/i915_driver.c
>> @@ -41,6 +41,7 @@
>>  
>>  #include <drm/drm_aperture.h>
>>  #include <drm/drm_atomic_helper.h>
>> +#include <drm/drm_client.h>
>>  #include <drm/drm_ioctl.h>
>>  #include <drm/drm_managed.h>
>>  #include <drm/drm_probe_helper.h>
>> @@ -852,6 +853,8 @@ void i915_driver_remove(struct drm_i915_private *i915)
>>  {
>>  	intel_wakeref_t wakeref;
>>  
>> +	drm_client_dev_unregister(&i915->drm);
>> +
>>  	wakeref = intel_runtime_pm_get(&i915->runtime_pm);
>>  
>>  	i915_driver_unregister(i915);
>> diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
>> index 919ad88f0495a..7f41f0ec819f0 100644
>> --- a/drivers/gpu/drm/xe/xe_device.c
>> +++ b/drivers/gpu/drm/xe/xe_device.c
>
> probably deserves a separate patch since this is one here is named 'drm/i915:'

Or do this for both in intel_display_driver_unregister()?

BR,
Jani.


>
>> @@ -9,6 +9,7 @@
>>  
>>  #include <drm/drm_aperture.h>
>>  #include <drm/drm_atomic_helper.h>
>> +#include <drm/drm_client.h>
>>  #include <drm/drm_gem_ttm_helper.h>
>>  #include <drm/drm_ioctl.h>
>>  #include <drm/drm_managed.h>
>> @@ -614,6 +615,8 @@ void xe_device_remove(struct xe_device *xe)
>>  	struct xe_gt *gt;
>>  	u8 id;
>>  
>> +	drm_client_dev_unregister(&xe->drm);
>> +
>>  	xe_device_remove_display(xe);
>>  
>>  	xe_display_fini(xe);
>> -- 
>> 2.43.2
>>
Thomas Zimmermann March 6, 2024, 3:11 p.m. UTC | #3
Hi

Am 05.03.24 um 17:25 schrieb Jani Nikula:
> On Tue, 05 Mar 2024, Rodrigo Vivi <rodrigo.vivi@intel.com> wrote:
>> On Fri, Mar 01, 2024 at 02:42:55PM +0100, Thomas Zimmermann wrote:
>>> Unregister all in-kernel clients before unloading the i915 driver. For
>>> other drivers, drm_dev_unregister() does this automatically. As i915
>>> does not use this helper, it has to perform the call by itself. For xe,
>>> do the same in xe_device_remove()
>>>
>>> Note that there are currently no in-kernel clients in i915 or xe. The
>>> patch prepares the drivers for a related update of their fbdev support.
>>>
>>> v7:
>>> 	* update xe driver
>>>
>>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>>> ---
>>>   drivers/gpu/drm/i915/i915_driver.c | 3 +++
>>>   drivers/gpu/drm/xe/xe_device.c     | 3 +++
>>>   2 files changed, 6 insertions(+)
>>>
>>> diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
>>> index 9ee902d5b72c4..97910a85e3917 100644
>>> --- a/drivers/gpu/drm/i915/i915_driver.c
>>> +++ b/drivers/gpu/drm/i915/i915_driver.c
>>> @@ -41,6 +41,7 @@
>>>   
>>>   #include <drm/drm_aperture.h>
>>>   #include <drm/drm_atomic_helper.h>
>>> +#include <drm/drm_client.h>
>>>   #include <drm/drm_ioctl.h>
>>>   #include <drm/drm_managed.h>
>>>   #include <drm/drm_probe_helper.h>
>>> @@ -852,6 +853,8 @@ void i915_driver_remove(struct drm_i915_private *i915)
>>>   {
>>>   	intel_wakeref_t wakeref;
>>>   
>>> +	drm_client_dev_unregister(&i915->drm);
>>> +
>>>   	wakeref = intel_runtime_pm_get(&i915->runtime_pm);
>>>   
>>>   	i915_driver_unregister(i915);
>>> diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
>>> index 919ad88f0495a..7f41f0ec819f0 100644
>>> --- a/drivers/gpu/drm/xe/xe_device.c
>>> +++ b/drivers/gpu/drm/xe/xe_device.c
>> probably deserves a separate patch since this is one here is named 'drm/i915:'
> Or do this for both in intel_display_driver_unregister()?

Ok, sure. I'll update this. I also have to update i915 and xe in patches 
5 and 6. I don't see how I can change them individually. How would I 
best log against both of them? drm/{i915,xe}? or drm/intel?

Best regards
Thomas

>
> BR,
> Jani.
>
>
>>> @@ -9,6 +9,7 @@
>>>   
>>>   #include <drm/drm_aperture.h>
>>>   #include <drm/drm_atomic_helper.h>
>>> +#include <drm/drm_client.h>
>>>   #include <drm/drm_gem_ttm_helper.h>
>>>   #include <drm/drm_ioctl.h>
>>>   #include <drm/drm_managed.h>
>>> @@ -614,6 +615,8 @@ void xe_device_remove(struct xe_device *xe)
>>>   	struct xe_gt *gt;
>>>   	u8 id;
>>>   
>>> +	drm_client_dev_unregister(&xe->drm);
>>> +
>>>   	xe_device_remove_display(xe);
>>>   
>>>   	xe_display_fini(xe);
>>> -- 
>>> 2.43.2
>>>
Rodrigo Vivi March 8, 2024, 3:28 p.m. UTC | #4
On Wed, Mar 06, 2024 at 04:11:54PM +0100, Thomas Zimmermann wrote:
> Hi
> 
> Am 05.03.24 um 17:25 schrieb Jani Nikula:
> > On Tue, 05 Mar 2024, Rodrigo Vivi <rodrigo.vivi@intel.com> wrote:
> > > On Fri, Mar 01, 2024 at 02:42:55PM +0100, Thomas Zimmermann wrote:
> > > > Unregister all in-kernel clients before unloading the i915 driver. For
> > > > other drivers, drm_dev_unregister() does this automatically. As i915
> > > > does not use this helper, it has to perform the call by itself. For xe,
> > > > do the same in xe_device_remove()
> > > > 
> > > > Note that there are currently no in-kernel clients in i915 or xe. The
> > > > patch prepares the drivers for a related update of their fbdev support.
> > > > 
> > > > v7:
> > > > 	* update xe driver
> > > > 
> > > > Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> > > > ---
> > > >   drivers/gpu/drm/i915/i915_driver.c | 3 +++
> > > >   drivers/gpu/drm/xe/xe_device.c     | 3 +++
> > > >   2 files changed, 6 insertions(+)
> > > > 
> > > > diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
> > > > index 9ee902d5b72c4..97910a85e3917 100644
> > > > --- a/drivers/gpu/drm/i915/i915_driver.c
> > > > +++ b/drivers/gpu/drm/i915/i915_driver.c
> > > > @@ -41,6 +41,7 @@
> > > >   #include <drm/drm_aperture.h>
> > > >   #include <drm/drm_atomic_helper.h>
> > > > +#include <drm/drm_client.h>
> > > >   #include <drm/drm_ioctl.h>
> > > >   #include <drm/drm_managed.h>
> > > >   #include <drm/drm_probe_helper.h>
> > > > @@ -852,6 +853,8 @@ void i915_driver_remove(struct drm_i915_private *i915)
> > > >   {
> > > >   	intel_wakeref_t wakeref;
> > > > +	drm_client_dev_unregister(&i915->drm);
> > > > +
> > > >   	wakeref = intel_runtime_pm_get(&i915->runtime_pm);
> > > >   	i915_driver_unregister(i915);
> > > > diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
> > > > index 919ad88f0495a..7f41f0ec819f0 100644
> > > > --- a/drivers/gpu/drm/xe/xe_device.c
> > > > +++ b/drivers/gpu/drm/xe/xe_device.c
> > > probably deserves a separate patch since this is one here is named 'drm/i915:'
> > Or do this for both in intel_display_driver_unregister()?
> 
> Ok, sure. I'll update this. I also have to update i915 and xe in patches 5
> and 6. I don't see how I can change them individually. How would I best log
> against both of them? drm/{i915,xe}? or drm/intel?

hmmm... though one...

drm-intel is the name of the i915 repository

well, perhaps drm/{i915,xe} works
or maybe just drm/i915/display: because since display is shared, that
kind of "tag" would be an indication that xe needs it as well anyway.

> 
> Best regards
> Thomas
> 
> > 
> > BR,
> > Jani.
> > 
> > 
> > > > @@ -9,6 +9,7 @@
> > > >   #include <drm/drm_aperture.h>
> > > >   #include <drm/drm_atomic_helper.h>
> > > > +#include <drm/drm_client.h>
> > > >   #include <drm/drm_gem_ttm_helper.h>
> > > >   #include <drm/drm_ioctl.h>
> > > >   #include <drm/drm_managed.h>
> > > > @@ -614,6 +615,8 @@ void xe_device_remove(struct xe_device *xe)
> > > >   	struct xe_gt *gt;
> > > >   	u8 id;
> > > > +	drm_client_dev_unregister(&xe->drm);
> > > > +
> > > >   	xe_device_remove_display(xe);
> > > >   	xe_display_fini(xe);
> > > > -- 
> > > > 2.43.2
> > > > 
> 
> -- 
> --
> Thomas Zimmermann
> Graphics Driver Developer
> SUSE Software Solutions Germany GmbH
> Frankenstrasse 146, 90461 Nuernberg, Germany
> GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
> HRB 36809 (AG Nuernberg)
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
index 9ee902d5b72c4..97910a85e3917 100644
--- a/drivers/gpu/drm/i915/i915_driver.c
+++ b/drivers/gpu/drm/i915/i915_driver.c
@@ -41,6 +41,7 @@ 
 
 #include <drm/drm_aperture.h>
 #include <drm/drm_atomic_helper.h>
+#include <drm/drm_client.h>
 #include <drm/drm_ioctl.h>
 #include <drm/drm_managed.h>
 #include <drm/drm_probe_helper.h>
@@ -852,6 +853,8 @@  void i915_driver_remove(struct drm_i915_private *i915)
 {
 	intel_wakeref_t wakeref;
 
+	drm_client_dev_unregister(&i915->drm);
+
 	wakeref = intel_runtime_pm_get(&i915->runtime_pm);
 
 	i915_driver_unregister(i915);
diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
index 919ad88f0495a..7f41f0ec819f0 100644
--- a/drivers/gpu/drm/xe/xe_device.c
+++ b/drivers/gpu/drm/xe/xe_device.c
@@ -9,6 +9,7 @@ 
 
 #include <drm/drm_aperture.h>
 #include <drm/drm_atomic_helper.h>
+#include <drm/drm_client.h>
 #include <drm/drm_gem_ttm_helper.h>
 #include <drm/drm_ioctl.h>
 #include <drm/drm_managed.h>
@@ -614,6 +615,8 @@  void xe_device_remove(struct xe_device *xe)
 	struct xe_gt *gt;
 	u8 id;
 
+	drm_client_dev_unregister(&xe->drm);
+
 	xe_device_remove_display(xe);
 
 	xe_display_fini(xe);