Skip to contentSkip to conversation

drm_vm.c: many arches equate remap_pfn_range() and io_remap_pfn_range()

DISCUSSION Robert P. J. Day 2 participants 4 messages Aug 29, 2012 – Aug 30, 2012

lore
Share & tools
lore
#0 lore raw

a pedantic observation, you can do with it what you wish (i'm not a
list subscriber). in drivers/gpu/drm/drm_vm.c, we read (line 629):

#if !defined(__arm__)
                if (io_remap_pfn_range(vma, vma->vm_start,
                                       (map->offset + offset) >> PAGE_SHIFT,
                                       vma->vm_end - vma->vm_start,
                                       vma->vm_page_prot))
                        return -EAGAIN;
#else
                if (remap_pfn_range(vma, vma->vm_start,
                                        (map->offset + offset) >> PAGE_SHIFT,
                                        vma->vm_end - vma->vm_start,
                                        vma->vm_page_prot))
                        return -EAGAIN;

#endif

suggesting that only with ARM need we distinguish between those two routines. but for various architectures, in pgtable.h, you can see:

#define io_remap_pfn_range remap_pfn_range

even the arm file contains:

#define io_remap_pfn_range(vma,from,pfn,size,prot) \
remap_pfn_range(vma, from, pfn, size, prot)

so it's not clear what the preprocessor test is for. admittedly, it should work, it just seems unnecessary. and it makes the code more confusing than it needs to be, but perhaps i've just misread something.

rday

Signature · 7 lines
========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================
#1 lore raw
Quoted 16 lines · Robert P. J. Day

a pedantic observation, you can do with it what you wish (i'm not a
list subscriber). in drivers/gpu/drm/drm_vm.c, we read (line 629):

#if !defined(__arm__)
                if (io_remap_pfn_range(vma, vma->vm_start,
                                       (map->offset + offset) >> PAGE_SHIFT,
                                       vma->vm_end - vma->vm_start,
                                       vma->vm_page_prot))
                        return -EAGAIN;
#else
                if (remap_pfn_range(vma, vma->vm_start,
                                        (map->offset + offset) >> PAGE_SHIFT,
                                        vma->vm_end - vma->vm_start,
                                        vma->vm_page_prot))
                        return -EAGAIN;
Quoted 1 line

#endif

This code goes down to:

commit 4b7fb9b5746554d460e7bc986341d4b2db01e0b6

Author: Jordan Crouse <[email protected]>
Date:   Thu May 27 13:40:26 2010 -0600

drm: Add __arm defines to DRM

Add __arm defines to specify behavior specific for an ARM processor.

Even at that time io_remap_pfn_range on arm was defined as:

Quoted 8 lines

#define io_remap_pfn_range(vma,from,pfn,size,prot) \
remap_pfn_range(vma, from, pfn, size, prot)

so it's not clear what the preprocessor test is for. admittedly, it should work, it just seems unnecessary. and it makes the code more confusing than it needs to be, but perhaps i've just misread something.

I agree that this shouldn't be necessary.

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#2 lore raw
Quoted 39 lines · Sascha Hauer
Quoted 16 lines · Robert P. J. Day

a pedantic observation, you can do with it what you wish (i'm not a
list subscriber). in drivers/gpu/drm/drm_vm.c, we read (line 629):

#if !defined(__arm__)
                if (io_remap_pfn_range(vma, vma->vm_start,
                                       (map->offset + offset) >> PAGE_SHIFT,
                                       vma->vm_end - vma->vm_start,
                                       vma->vm_page_prot))
                        return -EAGAIN;
#else
                if (remap_pfn_range(vma, vma->vm_start,
                                        (map->offset + offset) >> PAGE_SHIFT,
                                        vma->vm_end - vma->vm_start,
                                        vma->vm_page_prot))
                        return -EAGAIN;
Quoted 1 line

#endif

This code goes down to:

commit 4b7fb9b5746554d460e7bc986341d4b2db01e0b6

Author: Jordan Crouse <[email protected]>
Date:   Thu May 27 13:40:26 2010 -0600

drm: Add __arm defines to DRM

Add __arm defines to specify behavior specific for an ARM processor.

Even at that time io_remap_pfn_range on arm was defined as:

Quoted 4 lines

#define io_remap_pfn_range(vma,from,pfn,size,prot) \
remap_pfn_range(vma, from, pfn, size, prot)

Quoted 6 lines
Quoted 4 lines

so it's not clear what the preprocessor test is for. admittedly, it should work, it just seems unnecessary. and it makes the code more confusing than it needs to be, but perhaps i've just misread something.

I agree that this shouldn't be necessary.

for simplicity, i can submit a patch that just does a straight call
to remap_pfn_range(), unless someone can recognize something really subtle happening here.

rday

Signature · 7 lines
========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================
#3 lore raw
Quoted 46 lines · Robert P. J. Day
Quoted 44 lines · Sascha Hauer
Quoted 16 lines · Robert P. J. Day

a pedantic observation, you can do with it what you wish (i'm not a
list subscriber). in drivers/gpu/drm/drm_vm.c, we read (line 629):

#if !defined(__arm__)
                if (io_remap_pfn_range(vma, vma->vm_start,
                                       (map->offset + offset) >> PAGE_SHIFT,
                                       vma->vm_end - vma->vm_start,
                                       vma->vm_page_prot))
                        return -EAGAIN;
#else
                if (remap_pfn_range(vma, vma->vm_start,
                                        (map->offset + offset) >> PAGE_SHIFT,
                                        vma->vm_end - vma->vm_start,
                                        vma->vm_page_prot))
                        return -EAGAIN;
Quoted 1 line

#endif

This code goes down to:

commit 4b7fb9b5746554d460e7bc986341d4b2db01e0b6

Author: Jordan Crouse <[email protected]>
Date:   Thu May 27 13:40:26 2010 -0600

drm: Add __arm defines to DRM

Add __arm defines to specify behavior specific for an ARM processor.

Even at that time io_remap_pfn_range on arm was defined as:

Quoted 8 lines

#define io_remap_pfn_range(vma,from,pfn,size,prot) \
remap_pfn_range(vma, from, pfn, size, prot)

so it's not clear what the preprocessor test is for. admittedly, it should work, it just seems unnecessary. and it makes the code more confusing than it needs to be, but perhaps i've just misread something.

Quoted 5 lines
Quoted 1 line

I agree that this shouldn't be necessary.

for simplicity, i can submit a patch that just does a straight call
to remap_pfn_range(), unless someone can recognize something really subtle happening here.

sorry, that should have been a straight call to io_remap_pfn_range()
since that is the call invoked for all but ARM. i'll post a patch shortly and someone else can decide whether or not to apply it.

rday

Signature · 7 lines
========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================