The TTM module today uses a hack to be able to set a different page protection than struct vm_area_struct::vm_page_prot. To be able to do this properly, add the needed vm functionality as vmf_insert_mixed_prot().
Showing the changes to include/linux (2 of 3 files). Show all
Unified · Split
| @@ -2533,6 +2533,8 @@ vm_fault_t vmf_insert_pfn_prot(struct vm_area_struct *vma, unsigned long addr, · 2532 unmodified lines | ||
| 2533 | 2533 | unsigned long pfn, pgprot_t pgprot); |
| 2534 | 2534 | vm_fault_t vmf_insert_mixed(struct vm_area_struct *vma, unsigned long addr, |
| 2535 | 2535 | pfn_t pfn); |
| 2536 | +vm_fault_t vmf_insert_mixed_prot(struct vm_area_struct *vma, unsigned long addr, | |
| 2537 | + pfn_t pfn, pgprot_t pgprot); | |
| 2536 | 2538 | vm_fault_t vmf_insert_mixed_mkwrite(struct vm_area_struct *vma, |
| 2537 | 2539 | unsigned long addr, pfn_t pfn); |
| 2538 | 2540 | int vm_iomap_memory(struct vm_area_struct *vma, phys_addr_t start, unsigned long len); |
| @@ -312,7 +312,12 @@ struct vm_area_struct { · 311 unmodified lines | ||
| 312 | 312 | /* Second cache line starts here. */ |
| 313 | 313 | |
| 314 | 314 | struct mm_struct *vm_mm; /* The address space we belong to. */ |
| 315 | − pgprot_t vm_page_prot; /* Access permissions of this VMA. */ | |
| 315 | + | |
| 316 | + /* | |
| 317 | + * Access permissions of this VMA. | |
| 318 | + * See vmf_insert_mixed_prot() for discussion. | |
| 319 | + */ | |
| 320 | + pgprot_t vm_page_prot; | |
| 316 | 321 | unsigned long vm_flags; /* Flags, see mm.h. */ |
| 317 | 322 | |
| 318 | 323 | /* |