mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-22 16:06:04 -05:00
VFIO fixes for v6.13-rc7
- Fix a missed order alignment requirement of the pfn when inserting mappings through the new huge fault handler introduced in v6.12. (Alex Williamson) -----BEGIN PGP SIGNATURE----- iQJPBAABCAA5FiEEQvbATlQL0amee4qQI5ubbjuwiyIFAmd76s8bHGFsZXgud2ls bGlhbXNvbkByZWRoYXQuY29tAAoJECObm247sIsigSYQAIXc8nWiSeiPpNR7piLS 4FsAWLytBcS/R9bV0QYiDMR3JmgVedr8JU5d2veCKPoRFRgN7Hpr8OOzuKiNYeYi 95D9tKU2qV6QsFrInIOAF1VgpexrIYi0rVYDLpPO74DEHdlr1wj7Rb1bBmWbvFey MFB3rYaA7jvwMm4AHziz0T3veo51wXLvnNmvYSk4t+b1lDKHtlXv9lYzQg7e9kzm dSWfR73extxeClkcV/pm/qEj17mhBW2yzQXNOCTSXVjjYBA/hIvTJbuaSJhZBg1u i+5+lXtKA25RgoeuKUJaR3kf7WzEHJNjBcszDkzYe1a9gek64tUokwwQleFIgDJD oXDFvucUXJjoGqSp54QPyuJ+zuTPAC2aoczvmQLoHSKIFdRmcim5a2qFeCzg+7vz kqKXyUB+urUOimGj83mHYtnadFwQQA+/znQecCGCTy7VcaesxdGEkIUs4f1WZNkJ ScYGA9C6EBKAgUAQ83I65zQEv6ThxG4xZt0Zg5+io81GDAlz3jVyxIG+Mlc0J9C/ ODGKetF17N4UZNFndLsn1TekrlPor6oqySJIDMTddhO/Cje8ezApPGTBAonK3Xaa 3gaezLFE7qpoAg3s3356Vqvakhl7jWw/mo8jBNU1PEY482eXanUllcgVyjgultg2 blihqWocO+5kSvRrvTzaXkY7 =CX0v -----END PGP SIGNATURE----- Merge tag 'vfio-v6.13-rc7' of https://github.com/awilliam/linux-vfio Pull vfio fix from Alex Williamson: - Fix a missed order alignment requirement of the pfn when inserting mappings through the new huge fault handler introduced in v6.12 (Alex Williamson) * tag 'vfio-v6.13-rc7' of https://github.com/awilliam/linux-vfio: vfio/pci: Fallback huge faults for unaligned pfn
This commit is contained in:
commit
13563da6ff
1 changed files with 9 additions and 8 deletions
|
@ -1661,14 +1661,15 @@ static vm_fault_t vfio_pci_mmap_huge_fault(struct vm_fault *vmf,
|
|||
unsigned long pfn, pgoff = vmf->pgoff - vma->vm_pgoff;
|
||||
vm_fault_t ret = VM_FAULT_SIGBUS;
|
||||
|
||||
if (order && (vmf->address & ((PAGE_SIZE << order) - 1) ||
|
||||
pfn = vma_to_pfn(vma) + pgoff;
|
||||
|
||||
if (order && (pfn & ((1 << order) - 1) ||
|
||||
vmf->address & ((PAGE_SIZE << order) - 1) ||
|
||||
vmf->address + (PAGE_SIZE << order) > vma->vm_end)) {
|
||||
ret = VM_FAULT_FALLBACK;
|
||||
goto out;
|
||||
}
|
||||
|
||||
pfn = vma_to_pfn(vma);
|
||||
|
||||
down_read(&vdev->memory_lock);
|
||||
|
||||
if (vdev->pm_runtime_engaged || !__vfio_pci_memory_enabled(vdev))
|
||||
|
@ -1676,18 +1677,18 @@ static vm_fault_t vfio_pci_mmap_huge_fault(struct vm_fault *vmf,
|
|||
|
||||
switch (order) {
|
||||
case 0:
|
||||
ret = vmf_insert_pfn(vma, vmf->address, pfn + pgoff);
|
||||
ret = vmf_insert_pfn(vma, vmf->address, pfn);
|
||||
break;
|
||||
#ifdef CONFIG_ARCH_SUPPORTS_PMD_PFNMAP
|
||||
case PMD_ORDER:
|
||||
ret = vmf_insert_pfn_pmd(vmf, __pfn_to_pfn_t(pfn + pgoff,
|
||||
PFN_DEV), false);
|
||||
ret = vmf_insert_pfn_pmd(vmf,
|
||||
__pfn_to_pfn_t(pfn, PFN_DEV), false);
|
||||
break;
|
||||
#endif
|
||||
#ifdef CONFIG_ARCH_SUPPORTS_PUD_PFNMAP
|
||||
case PUD_ORDER:
|
||||
ret = vmf_insert_pfn_pud(vmf, __pfn_to_pfn_t(pfn + pgoff,
|
||||
PFN_DEV), false);
|
||||
ret = vmf_insert_pfn_pud(vmf,
|
||||
__pfn_to_pfn_t(pfn, PFN_DEV), false);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
|
|
Loading…
Reference in a new issue