Commit 258edb7
committed
vfio/type1: Use vfio_batch for vaddr_get_pfns()
jira LE-3557
Rebuild_History Non-Buildable kernel-5.14.0-570.26.1.el9_6
commit-author Alex Williamson <[email protected]>
commit eb996ee
Passing the vfio_batch to vaddr_get_pfns() allows for greater
distinction between page backed pfns and pfnmaps. In the case of page
backed pfns, vfio_batch.size is set to a positive value matching the
number of pages filled in vfio_batch.pages. For a pfnmap,
vfio_batch.size remains zero as vfio_batch.pages are not used. In both
cases the return value continues to indicate the number of pfns and the
provided pfn arg is set to the initial pfn value.
This allows us to shortcut the pfnmap case, which is detected by the
zero vfio_batch.size. pfnmaps do not contribute to locked memory
accounting, therefore we can update counters and continue directly,
which also enables a future where vaddr_get_pfns() can return a value
greater than one for consecutive pfnmaps.
NB. Now that we're not guessing whether the initial pfn is page backed
or pfnmap, we no longer need to special case the put_pfn() and batch
size reset. It's safe for vfio_batch_unpin() to handle this case.
Reviewed-by: Peter Xu <[email protected]>
Reviewed-by: Mitchell Augustin <[email protected]>
Tested-by: Mitchell Augustin <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alex Williamson <[email protected]>
(cherry picked from commit eb996ee)
Signed-off-by: Jonathan Maple <[email protected]>1 parent 7ce8549 commit 258edb7
1 file changed
+35
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
562 | 562 | | |
563 | 563 | | |
564 | 564 | | |
565 | | - | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
566 | 569 | | |
567 | 570 | | |
568 | 571 | | |
569 | | - | |
| 572 | + | |
570 | 573 | | |
| 574 | + | |
571 | 575 | | |
572 | 576 | | |
573 | 577 | | |
| |||
576 | 580 | | |
577 | 581 | | |
578 | 582 | | |
579 | | - | |
580 | | - | |
| 583 | + | |
| 584 | + | |
581 | 585 | | |
582 | | - | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
583 | 589 | | |
584 | 590 | | |
585 | 591 | | |
| |||
635 | 641 | | |
636 | 642 | | |
637 | 643 | | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
638 | 647 | | |
639 | 648 | | |
640 | 649 | | |
641 | | - | |
642 | | - | |
643 | | - | |
644 | | - | |
| 650 | + | |
| 651 | + | |
645 | 652 | | |
646 | 653 | | |
647 | 654 | | |
648 | | - | |
649 | | - | |
650 | | - | |
651 | 655 | | |
652 | 656 | | |
653 | 657 | | |
654 | 658 | | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
655 | 671 | | |
656 | 672 | | |
657 | 673 | | |
658 | | - | |
659 | | - | |
660 | | - | |
661 | | - | |
662 | | - | |
663 | | - | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
664 | 680 | | |
665 | 681 | | |
666 | 682 | | |
| |||
695 | 711 | | |
696 | 712 | | |
697 | 713 | | |
698 | | - | |
699 | | - | |
700 | | - | |
701 | 714 | | |
702 | 715 | | |
703 | 716 | | |
704 | 717 | | |
705 | 718 | | |
706 | 719 | | |
707 | | - | |
708 | | - | |
709 | | - | |
710 | | - | |
711 | | - | |
712 | | - | |
713 | 720 | | |
714 | 721 | | |
715 | 722 | | |
| |||
757 | 764 | | |
758 | 765 | | |
759 | 766 | | |
760 | | - | |
| 767 | + | |
761 | 768 | | |
762 | 769 | | |
763 | 770 | | |
| |||
0 commit comments