@@ -118,12 +118,11 @@ static inline int __memcpy_toio_inuser(void __iomem *dst,
118
118
SYSCALL_DEFINE3 (s390_pci_mmio_write , unsigned long , mmio_addr ,
119
119
const void __user * , user_buffer , size_t , length )
120
120
{
121
+ struct follow_pfnmap_args args = { };
121
122
u8 local_buf [64 ];
122
123
void __iomem * io_addr ;
123
124
void * buf ;
124
125
struct vm_area_struct * vma ;
125
- pte_t * ptep ;
126
- spinlock_t * ptl ;
127
126
long ret ;
128
127
129
128
if (!zpci_is_enabled ())
@@ -169,19 +168,21 @@ SYSCALL_DEFINE3(s390_pci_mmio_write, unsigned long, mmio_addr,
169
168
if (!(vma -> vm_flags & VM_WRITE ))
170
169
goto out_unlock_mmap ;
171
170
172
- ret = follow_pte (vma , mmio_addr , & ptep , & ptl );
171
+ args .address = mmio_addr ;
172
+ args .vma = vma ;
173
+ ret = follow_pfnmap_start (& args );
173
174
if (ret )
174
175
goto out_unlock_mmap ;
175
176
176
- io_addr = (void __iomem * )((pte_pfn ( * ptep ) << PAGE_SHIFT ) |
177
+ io_addr = (void __iomem * )((args . pfn << PAGE_SHIFT ) |
177
178
(mmio_addr & ~PAGE_MASK ));
178
179
179
180
if ((unsigned long ) io_addr < ZPCI_IOMAP_ADDR_BASE )
180
181
goto out_unlock_pt ;
181
182
182
183
ret = zpci_memcpy_toio (io_addr , buf , length );
183
184
out_unlock_pt :
184
- pte_unmap_unlock ( ptep , ptl );
185
+ follow_pfnmap_end ( & args );
185
186
out_unlock_mmap :
186
187
mmap_read_unlock (current -> mm );
187
188
out_free :
@@ -260,12 +261,11 @@ static inline int __memcpy_fromio_inuser(void __user *dst,
260
261
SYSCALL_DEFINE3 (s390_pci_mmio_read , unsigned long , mmio_addr ,
261
262
void __user * , user_buffer , size_t , length )
262
263
{
264
+ struct follow_pfnmap_args args = { };
263
265
u8 local_buf [64 ];
264
266
void __iomem * io_addr ;
265
267
void * buf ;
266
268
struct vm_area_struct * vma ;
267
- pte_t * ptep ;
268
- spinlock_t * ptl ;
269
269
long ret ;
270
270
271
271
if (!zpci_is_enabled ())
@@ -308,11 +308,13 @@ SYSCALL_DEFINE3(s390_pci_mmio_read, unsigned long, mmio_addr,
308
308
if (!(vma -> vm_flags & VM_WRITE ))
309
309
goto out_unlock_mmap ;
310
310
311
- ret = follow_pte (vma , mmio_addr , & ptep , & ptl );
311
+ args .vma = vma ;
312
+ args .address = mmio_addr ;
313
+ ret = follow_pfnmap_start (& args );
312
314
if (ret )
313
315
goto out_unlock_mmap ;
314
316
315
- io_addr = (void __iomem * )((pte_pfn ( * ptep ) << PAGE_SHIFT ) |
317
+ io_addr = (void __iomem * )((args . pfn << PAGE_SHIFT ) |
316
318
(mmio_addr & ~PAGE_MASK ));
317
319
318
320
if ((unsigned long ) io_addr < ZPCI_IOMAP_ADDR_BASE ) {
@@ -322,7 +324,7 @@ SYSCALL_DEFINE3(s390_pci_mmio_read, unsigned long, mmio_addr,
322
324
ret = zpci_memcpy_fromio (buf , io_addr , length );
323
325
324
326
out_unlock_pt :
325
- pte_unmap_unlock ( ptep , ptl );
327
+ follow_pfnmap_end ( & args );
326
328
out_unlock_mmap :
327
329
mmap_read_unlock (current -> mm );
328
330
0 commit comments