diff mbox

[v2] gpu: drm: armada: Adding new typedef vm_fault_t

Message ID 20180510150448.GA26306@jordon-HP-15-Notebook-PC (mailing list archive)
State New, archived
Headers show

Commit Message

Souptick Joarder May 10, 2018, 3:04 p.m. UTC
Use new return type vm_fault_t for fault handler in
struct vm_operations_struct. For now, this is just
documenting that the function returns a VM_FAULT
value rather than an errno. Once all instances are
converted, vm_fault_t will become a distinct type.

commit 1c8f422059ae ("mm: change return type to vm_fault_t")

Previously vm_insert_pfn() returns err which driver
mapped into VM_FAULT_* type. The new function
vmf_insert_pfn() will replace this inefficiency by
returning VM_FAULT_* type.

Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
Reviewed-by: Matthew Wilcox <mawilcox@microsoft.com>
---
v2: Updated the change log

 drivers/gpu/drm/armada/armada_gem.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

--
1.9.1

Comments

Russell King (Oracle) May 11, 2018, 9:22 a.m. UTC | #1
On Thu, May 10, 2018 at 08:34:48PM +0530, Souptick Joarder wrote:
> Use new return type vm_fault_t for fault handler in
> struct vm_operations_struct. For now, this is just
> documenting that the function returns a VM_FAULT
> value rather than an errno. Once all instances are
> converted, vm_fault_t will become a distinct type.
> 
> commit 1c8f422059ae ("mm: change return type to vm_fault_t")
> 
> Previously vm_insert_pfn() returns err which driver
> mapped into VM_FAULT_* type. The new function
> vmf_insert_pfn() will replace this inefficiency by
> returning VM_FAULT_* type.
> 
> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
> Reviewed-by: Matthew Wilcox <mawilcox@microsoft.com>

Acked-by: Russell King <rmk+kernel@armlinux.org.uk>

Thanks.

> ---
> v2: Updated the change log
> 
>  drivers/gpu/drm/armada/armada_gem.c | 15 ++-------------
>  1 file changed, 2 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/armada/armada_gem.c b/drivers/gpu/drm/armada/armada_gem.c
> index a97f509..81a55b7 100644
> --- a/drivers/gpu/drm/armada/armada_gem.c
> +++ b/drivers/gpu/drm/armada/armada_gem.c
> @@ -13,25 +13,14 @@
>  #include <drm/armada_drm.h>
>  #include "armada_ioctlP.h"
> 
> -static int armada_gem_vm_fault(struct vm_fault *vmf)
> +static vm_fault_t armada_gem_vm_fault(struct vm_fault *vmf)
>  {
>  	struct drm_gem_object *gobj = vmf->vma->vm_private_data;
>  	struct armada_gem_object *obj = drm_to_armada_gem(gobj);
>  	unsigned long pfn = obj->phys_addr >> PAGE_SHIFT;
> -	int ret;
> 
>  	pfn += (vmf->address - vmf->vma->vm_start) >> PAGE_SHIFT;
> -	ret = vm_insert_pfn(vmf->vma, vmf->address, pfn);
> -
> -	switch (ret) {
> -	case 0:
> -	case -EBUSY:
> -		return VM_FAULT_NOPAGE;
> -	case -ENOMEM:
> -		return VM_FAULT_OOM;
> -	default:
> -		return VM_FAULT_SIGBUS;
> -	}
> +	return vmf_insert_pfn(vmf->vma, vmf->address, pfn);
>  }
> 
>  const struct vm_operations_struct armada_gem_vm_ops = {
> --
> 1.9.1
>
Souptick Joarder May 16, 2018, 4:35 a.m. UTC | #2
On Fri, May 11, 2018 at 2:52 PM, Russell King - ARM Linux
<linux@armlinux.org.uk> wrote:
> On Thu, May 10, 2018 at 08:34:48PM +0530, Souptick Joarder wrote:
>> Use new return type vm_fault_t for fault handler in
>> struct vm_operations_struct. For now, this is just
>> documenting that the function returns a VM_FAULT
>> value rather than an errno. Once all instances are
>> converted, vm_fault_t will become a distinct type.
>>
>> commit 1c8f422059ae ("mm: change return type to vm_fault_t")
>>
>> Previously vm_insert_pfn() returns err which driver
>> mapped into VM_FAULT_* type. The new function
>> vmf_insert_pfn() will replace this inefficiency by
>> returning VM_FAULT_* type.
>>
>> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
>> Reviewed-by: Matthew Wilcox <mawilcox@microsoft.com>
>
> Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
>
> Thanks.

If no further comment, we would like to get this patch in queue
for 4.18.
Souptick Joarder May 23, 2018, 9:39 a.m. UTC | #3
On Wed, May 16, 2018 at 10:05 AM, Souptick Joarder <jrdr.linux@gmail.com> wrote:
> On Fri, May 11, 2018 at 2:52 PM, Russell King - ARM Linux
> <linux@armlinux.org.uk> wrote:
>> On Thu, May 10, 2018 at 08:34:48PM +0530, Souptick Joarder wrote:
>>> Use new return type vm_fault_t for fault handler in
>>> struct vm_operations_struct. For now, this is just
>>> documenting that the function returns a VM_FAULT
>>> value rather than an errno. Once all instances are
>>> converted, vm_fault_t will become a distinct type.
>>>
>>> commit 1c8f422059ae ("mm: change return type to vm_fault_t")
>>>
>>> Previously vm_insert_pfn() returns err which driver
>>> mapped into VM_FAULT_* type. The new function
>>> vmf_insert_pfn() will replace this inefficiency by
>>> returning VM_FAULT_* type.
>>>
>>> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
>>> Reviewed-by: Matthew Wilcox <mawilcox@microsoft.com>
>>
>> Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
>>
>> Thanks.
>
> If no further comment, we would like to get this patch in queue
> for 4.18.

We would like to get this patch in queue
for 4.18.
Souptick Joarder June 4, 2018, 5:16 a.m. UTC | #4
On Wed, May 23, 2018 at 3:09 PM, Souptick Joarder <jrdr.linux@gmail.com> wrote:
> On Wed, May 16, 2018 at 10:05 AM, Souptick Joarder <jrdr.linux@gmail.com> wrote:
>> On Fri, May 11, 2018 at 2:52 PM, Russell King - ARM Linux
>> <linux@armlinux.org.uk> wrote:
>>> On Thu, May 10, 2018 at 08:34:48PM +0530, Souptick Joarder wrote:
>>>> Use new return type vm_fault_t for fault handler in
>>>> struct vm_operations_struct. For now, this is just
>>>> documenting that the function returns a VM_FAULT
>>>> value rather than an errno. Once all instances are
>>>> converted, vm_fault_t will become a distinct type.
>>>>
>>>> commit 1c8f422059ae ("mm: change return type to vm_fault_t")
>>>>
>>>> Previously vm_insert_pfn() returns err which driver
>>>> mapped into VM_FAULT_* type. The new function
>>>> vmf_insert_pfn() will replace this inefficiency by
>>>> returning VM_FAULT_* type.
>>>>
>>>> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
>>>> Reviewed-by: Matthew Wilcox <mawilcox@microsoft.com>
>>>
>>> Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
>>>
>>> Thanks.
>>
>> If no further comment, we would like to get this patch in queue
>> for 4.18.
>
> We would like to get this patch in queue
> for 4.18.

We  would like to get this patch in 4.18.
Souptick Joarder June 19, 2018, 5:12 a.m. UTC | #5
On Mon, Jun 4, 2018 at 10:46 AM, Souptick Joarder <jrdr.linux@gmail.com> wrote:
> On Wed, May 23, 2018 at 3:09 PM, Souptick Joarder <jrdr.linux@gmail.com> wrote:
>> On Wed, May 16, 2018 at 10:05 AM, Souptick Joarder <jrdr.linux@gmail.com> wrote:
>>> On Fri, May 11, 2018 at 2:52 PM, Russell King - ARM Linux
>>> <linux@armlinux.org.uk> wrote:
>>>> On Thu, May 10, 2018 at 08:34:48PM +0530, Souptick Joarder wrote:
>>>>> Use new return type vm_fault_t for fault handler in
>>>>> struct vm_operations_struct. For now, this is just
>>>>> documenting that the function returns a VM_FAULT
>>>>> value rather than an errno. Once all instances are
>>>>> converted, vm_fault_t will become a distinct type.
>>>>>
>>>>> commit 1c8f422059ae ("mm: change return type to vm_fault_t")
>>>>>
>>>>> Previously vm_insert_pfn() returns err which driver
>>>>> mapped into VM_FAULT_* type. The new function
>>>>> vmf_insert_pfn() will replace this inefficiency by
>>>>> returning VM_FAULT_* type.
>>>>>
>>>>> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
>>>>> Reviewed-by: Matthew Wilcox <mawilcox@microsoft.com>
>>>>
>>>> Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
>>>>
>>>> Thanks.
>>>
>>> If no further comment, we would like to get this patch in queue
>>> for 4.18.
>>
>> We would like to get this patch in queue
>> for 4.18.
>
> We  would like to get this patch in 4.18.

Russell, This patch is not merged in 4.18-rc-1.
Russell King (Oracle) June 26, 2018, 3:37 p.m. UTC | #6
On Tue, Jun 19, 2018 at 10:42:15AM +0530, Souptick Joarder wrote:
> On Mon, Jun 4, 2018 at 10:46 AM, Souptick Joarder <jrdr.linux@gmail.com> wrote:
> > On Wed, May 23, 2018 at 3:09 PM, Souptick Joarder <jrdr.linux@gmail.com> wrote:
> >> On Wed, May 16, 2018 at 10:05 AM, Souptick Joarder <jrdr.linux@gmail.com> wrote:
> >>> On Fri, May 11, 2018 at 2:52 PM, Russell King - ARM Linux
> >>> <linux@armlinux.org.uk> wrote:
> >>>> On Thu, May 10, 2018 at 08:34:48PM +0530, Souptick Joarder wrote:
> >>>>> Use new return type vm_fault_t for fault handler in
> >>>>> struct vm_operations_struct. For now, this is just
> >>>>> documenting that the function returns a VM_FAULT
> >>>>> value rather than an errno. Once all instances are
> >>>>> converted, vm_fault_t will become a distinct type.
> >>>>>
> >>>>> commit 1c8f422059ae ("mm: change return type to vm_fault_t")
> >>>>>
> >>>>> Previously vm_insert_pfn() returns err which driver
> >>>>> mapped into VM_FAULT_* type. The new function
> >>>>> vmf_insert_pfn() will replace this inefficiency by
> >>>>> returning VM_FAULT_* type.
> >>>>>
> >>>>> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
> >>>>> Reviewed-by: Matthew Wilcox <mawilcox@microsoft.com>
> >>>>
> >>>> Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
> >>>>
> >>>> Thanks.
> >>>
> >>> If no further comment, we would like to get this patch in queue
> >>> for 4.18.
> >>
> >> We would like to get this patch in queue
> >> for 4.18.
> >
> > We  would like to get this patch in 4.18.
> 
> Russell, This patch is not merged in 4.18-rc-1.

Correct, I wasn't able to add it to my tree because David Airlie hadn't
pulled the previous merge request, so it missed the 4.18 merge window.

The reason for me acking the patch was so that /someone else/ could
pick it up instead, and that obviously also didn't happen - maybe the
drm-misc tree was closed for new work at the point you sent the patch.

I've picked this patch up now, thanks.
Souptick Joarder June 26, 2018, 4:07 p.m. UTC | #7
On Tue, Jun 26, 2018 at 9:07 PM, Russell King - ARM Linux
<linux@armlinux.org.uk> wrote:
> On Tue, Jun 19, 2018 at 10:42:15AM +0530, Souptick Joarder wrote:
>> On Mon, Jun 4, 2018 at 10:46 AM, Souptick Joarder <jrdr.linux@gmail.com> wrote:
>> > On Wed, May 23, 2018 at 3:09 PM, Souptick Joarder <jrdr.linux@gmail.com> wrote:
>> >> On Wed, May 16, 2018 at 10:05 AM, Souptick Joarder <jrdr.linux@gmail.com> wrote:
>> >>> On Fri, May 11, 2018 at 2:52 PM, Russell King - ARM Linux
>> >>> <linux@armlinux.org.uk> wrote:
>> >>>> On Thu, May 10, 2018 at 08:34:48PM +0530, Souptick Joarder wrote:
>> >>>>> Use new return type vm_fault_t for fault handler in
>> >>>>> struct vm_operations_struct. For now, this is just
>> >>>>> documenting that the function returns a VM_FAULT
>> >>>>> value rather than an errno. Once all instances are
>> >>>>> converted, vm_fault_t will become a distinct type.
>> >>>>>
>> >>>>> commit 1c8f422059ae ("mm: change return type to vm_fault_t")
>> >>>>>
>> >>>>> Previously vm_insert_pfn() returns err which driver
>> >>>>> mapped into VM_FAULT_* type. The new function
>> >>>>> vmf_insert_pfn() will replace this inefficiency by
>> >>>>> returning VM_FAULT_* type.
>> >>>>>
>> >>>>> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
>> >>>>> Reviewed-by: Matthew Wilcox <mawilcox@microsoft.com>
>> >>>>
>> >>>> Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
>> >>>>
>> >>>> Thanks.
>> >>>
>> >>> If no further comment, we would like to get this patch in queue
>> >>> for 4.18.
>> >>
>> >> We would like to get this patch in queue
>> >> for 4.18.
>> >
>> > We  would like to get this patch in 4.18.
>>
>> Russell, This patch is not merged in 4.18-rc-1.
>
> Correct, I wasn't able to add it to my tree because David Airlie hadn't
> pulled the previous merge request, so it missed the 4.18 merge window.
>
> The reason for me acking the patch was so that /someone else/ could
> pick it up instead, and that obviously also didn't happen - maybe the
> drm-misc tree was closed for new work at the point you sent the patch.
>
> I've picked this patch up now, thanks.
>

Thanks. Queued for 4.19 merge window ?
diff mbox

Patch

diff --git a/drivers/gpu/drm/armada/armada_gem.c b/drivers/gpu/drm/armada/armada_gem.c
index a97f509..81a55b7 100644
--- a/drivers/gpu/drm/armada/armada_gem.c
+++ b/drivers/gpu/drm/armada/armada_gem.c
@@ -13,25 +13,14 @@ 
 #include <drm/armada_drm.h>
 #include "armada_ioctlP.h"

-static int armada_gem_vm_fault(struct vm_fault *vmf)
+static vm_fault_t armada_gem_vm_fault(struct vm_fault *vmf)
 {
 	struct drm_gem_object *gobj = vmf->vma->vm_private_data;
 	struct armada_gem_object *obj = drm_to_armada_gem(gobj);
 	unsigned long pfn = obj->phys_addr >> PAGE_SHIFT;
-	int ret;

 	pfn += (vmf->address - vmf->vma->vm_start) >> PAGE_SHIFT;
-	ret = vm_insert_pfn(vmf->vma, vmf->address, pfn);
-
-	switch (ret) {
-	case 0:
-	case -EBUSY:
-		return VM_FAULT_NOPAGE;
-	case -ENOMEM:
-		return VM_FAULT_OOM;
-	default:
-		return VM_FAULT_SIGBUS;
-	}
+	return vmf_insert_pfn(vmf->vma, vmf->address, pfn);
 }

 const struct vm_operations_struct armada_gem_vm_ops = {