* [PATCH] gpu: drm: gma500: Change return type to vm_fault_t
@ 2018-04-14 16:10 Souptick Joarder
2018-04-16 10:31 ` kbuild test robot
0 siblings, 1 reply; 3+ messages in thread
From: Souptick Joarder @ 2018-04-14 16:10 UTC (permalink / raw)
To: patrik.r.jakobsson; +Cc: dri-devel, willy
Use new return type vm_fault_t for fault handler
in struct vm_operations_struct.
Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
Reviewed-by: Matthew Wilcox <mawilcox@microsoft.com>
---
drivers/gpu/drm/gma500/framebuffer.c | 14 +++++---------
drivers/gpu/drm/gma500/gem.c | 27 ++++++++++-----------------
drivers/gpu/drm/gma500/psb_drv.h | 3 ++-
3 files changed, 17 insertions(+), 27 deletions(-)
diff --git a/drivers/gpu/drm/gma500/framebuffer.c b/drivers/gpu/drm/gma500/framebuffer.c
index cb0a2ae..7635ce8 100644
--- a/drivers/gpu/drm/gma500/framebuffer.c
+++ b/drivers/gpu/drm/gma500/framebuffer.c
@@ -111,7 +111,7 @@ static int psbfb_pan(struct fb_var_screeninfo *var, struct fb_info *info)
return 0;
}
-static int psbfb_vm_fault(struct vm_fault *vmf)
+static vm_fault_t psbfb_vm_fault(struct vm_fault *vmf)
{
struct vm_area_struct *vma = vmf->vma;
struct psb_framebuffer *psbfb = vma->vm_private_data;
@@ -120,7 +120,7 @@ static int psbfb_vm_fault(struct vm_fault *vmf)
int page_num;
int i;
unsigned long address;
- int ret;
+ vm_fault_t ret;
unsigned long pfn;
unsigned long phys_addr = (unsigned long)dev_priv->stolen_base +
psbfb->gtt->offset;
@@ -133,18 +133,14 @@ static int psbfb_vm_fault(struct vm_fault *vmf)
for (i = 0; i < page_num; i++) {
pfn = (phys_addr >> PAGE_SHIFT);
- ret = vm_insert_mixed(vma, address,
+ ret = vmf_insert_mixed(vma, address,
__pfn_to_pfn_t(pfn, PFN_DEV));
- if (unlikely((ret == -EBUSY) || (ret != 0 && i > 0)))
+ if (unlikely(ret & VM_FAULT_ERROR))
break;
- else if (unlikely(ret != 0)) {
- ret = (ret == -ENOMEM) ? VM_FAULT_OOM : VM_FAULT_SIGBUS;
- return ret;
- }
address += PAGE_SIZE;
phys_addr += PAGE_SIZE;
}
- return VM_FAULT_NOPAGE;
+ return ret;
}
static void psbfb_vm_open(struct vm_area_struct *vma)
diff --git a/drivers/gpu/drm/gma500/gem.c b/drivers/gpu/drm/gma500/gem.c
index 1312397..e7be5c9 100644
--- a/drivers/gpu/drm/gma500/gem.c
+++ b/drivers/gpu/drm/gma500/gem.c
@@ -134,12 +134,13 @@ int psb_gem_dumb_create(struct drm_file *file, struct drm_device *dev,
* vma->vm_private_data points to the GEM object that is backing this
* mapping.
*/
-int psb_gem_fault(struct vm_fault *vmf)
+vm_fault_t psb_gem_fault(struct vm_fault *vmf)
{
struct vm_area_struct *vma = vmf->vma;
struct drm_gem_object *obj;
struct gtt_range *r;
- int ret;
+ int err;
+ vm_fault_t ret;
unsigned long pfn;
pgoff_t page_offset;
struct drm_device *dev;
@@ -158,9 +159,10 @@ int psb_gem_fault(struct vm_fault *vmf)
/* For now the mmap pins the object and it stays pinned. As things
stand that will do us no harm */
if (r->mmapping == 0) {
- ret = psb_gtt_pin(r);
- if (ret < 0) {
- dev_err(dev->dev, "gma500: pin failed: %d\n", ret);
+ err = psb_gtt_pin(r);
+ if (err < 0) {
+ dev_err(dev->dev, "gma500: pin failed: %d\n", err);
+ ret = vmf_error(err);
goto fail;
}
r->mmapping = 1;
@@ -175,18 +177,9 @@ int psb_gem_fault(struct vm_fault *vmf)
pfn = (dev_priv->stolen_base + r->offset) >> PAGE_SHIFT;
else
pfn = page_to_pfn(r->pages[page_offset]);
- ret = vm_insert_pfn(vma, vmf->address, pfn);
-
+ ret = vmf_insert_pfn(vma, vmf->address, pfn);
fail:
mutex_unlock(&dev_priv->mmap_mutex);
- switch (ret) {
- case 0:
- case -ERESTARTSYS:
- case -EINTR:
- return VM_FAULT_NOPAGE;
- case -ENOMEM:
- return VM_FAULT_OOM;
- default:
- return VM_FAULT_SIGBUS;
- }
+
+ return ret;
}
diff --git a/drivers/gpu/drm/gma500/psb_drv.h b/drivers/gpu/drm/gma500/psb_drv.h
index e8300f5..93d2f40 100644
--- a/drivers/gpu/drm/gma500/psb_drv.h
+++ b/drivers/gpu/drm/gma500/psb_drv.h
@@ -21,6 +21,7 @@
#define _PSB_DRV_H_
#include <linux/kref.h>
+#include <linux/mm_types.h>
#include <drm/drmP.h>
#include <drm/drm_global.h>
@@ -749,7 +750,7 @@ extern int psb_gem_get_aperture(struct drm_device *dev, void *data,
struct drm_file *file);
extern int psb_gem_dumb_create(struct drm_file *file, struct drm_device *dev,
struct drm_mode_create_dumb *args);
-extern int psb_gem_fault(struct vm_fault *vmf);
+extern vm_fault_t psb_gem_fault(struct vm_fault *vmf);
/* psb_device.c */
extern const struct psb_ops psb_chip_ops;
--
1.9.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] gpu: drm: gma500: Change return type to vm_fault_t
2018-04-14 16:10 [PATCH] gpu: drm: gma500: Change return type to vm_fault_t Souptick Joarder
@ 2018-04-16 10:31 ` kbuild test robot
2018-04-16 11:22 ` Souptick Joarder
0 siblings, 1 reply; 3+ messages in thread
From: kbuild test robot @ 2018-04-16 10:31 UTC (permalink / raw)
To: Souptick Joarder; +Cc: dri-devel, willy, kbuild-all
[-- Attachment #1: Type: text/plain, Size: 3622 bytes --]
Hi Souptick,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on drm/drm-next]
[also build test ERROR on v4.17-rc1 next-20180413]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Souptick-Joarder/gpu-drm-gma500-Change-return-type-to-vm_fault_t/20180416-155538
base: git://people.freedesktop.org/~airlied/linux.git drm-next
config: i386-randconfig-x078-201815 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All errors (new ones prefixed by >>):
In file included from drivers/gpu/drm/gma500/intel_i2c.c:24:0:
>> drivers/gpu/drm/gma500/psb_drv.h:753:8: error: unknown type name 'vm_fault_t'
extern vm_fault_t psb_gem_fault(struct vm_fault *vmf);
^~~~~~~~~~
--
In file included from drivers/gpu/drm/gma500/framebuffer.c:37:0:
>> drivers/gpu/drm/gma500/psb_drv.h:753:8: error: unknown type name 'vm_fault_t'
extern vm_fault_t psb_gem_fault(struct vm_fault *vmf);
^~~~~~~~~~
>> drivers/gpu/drm/gma500/framebuffer.c:114:8: error: unknown type name 'vm_fault_t'
static vm_fault_t psbfb_vm_fault(struct vm_fault *vmf)
^~~~~~~~~~
drivers/gpu/drm/gma500/framebuffer.c: In function 'psbfb_vm_fault':
>> drivers/gpu/drm/gma500/framebuffer.c:123:2: error: unknown type name 'vm_fault_t'; did you mean 'vm_flags_t'?
vm_fault_t ret;
^~~~~~~~~~
vm_flags_t
>> drivers/gpu/drm/gma500/framebuffer.c:136:9: error: implicit declaration of function 'vmf_insert_mixed'; did you mean 'vm_insert_mixed'? [-Werror=implicit-function-declaration]
ret = vmf_insert_mixed(vma, address,
^~~~~~~~~~~~~~~~
vm_insert_mixed
cc1: some warnings being treated as errors
--
In file included from drivers/gpu/drm/gma500/gem.c:30:0:
>> drivers/gpu/drm/gma500/psb_drv.h:753:8: error: unknown type name 'vm_fault_t'
extern vm_fault_t psb_gem_fault(struct vm_fault *vmf);
^~~~~~~~~~
>> drivers/gpu/drm/gma500/gem.c:137:1: error: unknown type name 'vm_fault_t'; did you mean 'vm_flags_t'?
vm_fault_t psb_gem_fault(struct vm_fault *vmf)
^~~~~~~~~~
vm_flags_t
drivers/gpu/drm/gma500/gem.c: In function 'psb_gem_fault':
drivers/gpu/drm/gma500/gem.c:143:2: error: unknown type name 'vm_fault_t'; did you mean 'vm_flags_t'?
vm_fault_t ret;
^~~~~~~~~~
vm_flags_t
>> drivers/gpu/drm/gma500/gem.c:165:10: error: implicit declaration of function 'vmf_error' [-Werror=implicit-function-declaration]
ret = vmf_error(err);
^~~~~~~~~
>> drivers/gpu/drm/gma500/gem.c:180:8: error: implicit declaration of function 'vmf_insert_pfn'; did you mean 'vm_insert_pfn'? [-Werror=implicit-function-declaration]
ret = vmf_insert_pfn(vma, vmf->address, pfn);
^~~~~~~~~~~~~~
vm_insert_pfn
cc1: some warnings being treated as errors
vim +/vm_fault_t +753 drivers/gpu/drm/gma500/psb_drv.h
746
747 /* gem.c */
748 extern void psb_gem_free_object(struct drm_gem_object *obj);
749 extern int psb_gem_get_aperture(struct drm_device *dev, void *data,
750 struct drm_file *file);
751 extern int psb_gem_dumb_create(struct drm_file *file, struct drm_device *dev,
752 struct drm_mode_create_dumb *args);
> 753 extern vm_fault_t psb_gem_fault(struct vm_fault *vmf);
754
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 32362 bytes --]
[-- Attachment #3: Type: text/plain, Size: 160 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gpu: drm: gma500: Change return type to vm_fault_t
2018-04-16 10:31 ` kbuild test robot
@ 2018-04-16 11:22 ` Souptick Joarder
0 siblings, 0 replies; 3+ messages in thread
From: Souptick Joarder @ 2018-04-16 11:22 UTC (permalink / raw)
To: kbuild test robot; +Cc: dri-devel, Matthew Wilcox, kbuild-all
>>> drivers/gpu/drm/gma500/framebuffer.c:136:9: error: implicit declaration of function 'vmf_insert_mixed'; did you mean 'vm_insert_mixed'? [-Werror=implicit-function-declaration]
> ret = vmf_insert_mixed(vma, address,
> ^~~~~~~~~~~~~~~~
> cc1: some warnings being treated as errors
> --
>>> drivers/gpu/drm/gma500/gem.c:165:10: error: implicit declaration of function 'vmf_error' [-Werror=implicit-function-declaration]
> ret = vmf_error(err);
Sorry about it. vmf_error() is not yet merged in linus tree and
it break the build.
>>> drivers/gpu/drm/gma500/gem.c:180:8: error: implicit declaration of function 'vmf_insert_pfn'; did you mean 'vm_insert_pfn'? [-Werror=implicit-function-declaration]
> ret = vmf_insert_pfn(vma, vmf->address, pfn);
vm_insert_mixed() , vmf_insert_pfn() is defined in <linux/mm.h>
and vm_fault_t is defined in vm_fault_t in <linux/mm_types.h>
and merged in both 4.17-rc1 and next-20180413.
So these shouldn't break the build.
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-04-16 11:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-14 16:10 [PATCH] gpu: drm: gma500: Change return type to vm_fault_t Souptick Joarder
2018-04-16 10:31 ` kbuild test robot
2018-04-16 11:22 ` Souptick Joarder
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.