Commit 7d17e84bb8356b1d9f4402dd82a0e270a3d59a4f
Committed by
Konrad Rzeszutek Wilk
1 parent
2946a52ac7
Exists in
master
and in
6 other branches
xen/grant-table: Support mappings required by blkback
Add support for mappings without GNTMAP_contains_pte. This was not supported because the unmap operation assumed that this flag was being used; adding a parameter to the unmap operation to allow the PTE clearing to be disabled is sufficient to make unmap capable of supporting either mapping type. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> [v1: Fix cleanpatch warnings] Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Showing 3 changed files with 8 additions and 21 deletions Side-by-side Diff
drivers/xen/gntdev.c
drivers/xen/grant-table.c
... | ... | @@ -761,24 +761,10 @@ |
761 | 761 | (map_ops[i].host_addr & ~PAGE_MASK)); |
762 | 762 | mfn = pte_mfn(*pte); |
763 | 763 | } else { |
764 | - /* If you really wanted to do this: | |
765 | - * mfn = PFN_DOWN(map_ops[i].dev_bus_addr); | |
766 | - * | |
767 | - * The reason we do not implement it is b/c on the | |
768 | - * unmap path (gnttab_unmap_refs) we have no means of | |
769 | - * checking whether the page is !GNTMAP_contains_pte. | |
770 | - * | |
771 | - * That is without some extra data-structure to carry | |
772 | - * the struct page, bool clear_pte, and list_head next | |
773 | - * tuples and deal with allocation/delallocation, etc. | |
774 | - * | |
775 | - * The users of this API set the GNTMAP_contains_pte | |
776 | - * flag so lets just return not supported until it | |
777 | - * becomes neccessary to implement. | |
778 | - */ | |
779 | - return -EOPNOTSUPP; | |
764 | + mfn = PFN_DOWN(map_ops[i].dev_bus_addr); | |
780 | 765 | } |
781 | - ret = m2p_add_override(mfn, pages[i], &kmap_ops[i]); | |
766 | + ret = m2p_add_override(mfn, pages[i], kmap_ops ? | |
767 | + &kmap_ops[i] : NULL); | |
782 | 768 | if (ret) |
783 | 769 | return ret; |
784 | 770 | } |
... | ... | @@ -788,7 +774,7 @@ |
788 | 774 | EXPORT_SYMBOL_GPL(gnttab_map_refs); |
789 | 775 | |
790 | 776 | int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops, |
791 | - struct page **pages, unsigned int count) | |
777 | + struct page **pages, unsigned int count, bool clear_pte) | |
792 | 778 | { |
793 | 779 | int i, ret; |
794 | 780 | |
... | ... | @@ -800,7 +786,7 @@ |
800 | 786 | return ret; |
801 | 787 | |
802 | 788 | for (i = 0; i < count; i++) { |
803 | - ret = m2p_remove_override(pages[i], true /* clear the PTE */); | |
789 | + ret = m2p_remove_override(pages[i], clear_pte); | |
804 | 790 | if (ret) |
805 | 791 | return ret; |
806 | 792 | } |
include/xen/grant_table.h
... | ... | @@ -185,7 +185,7 @@ |
185 | 185 | struct gnttab_map_grant_ref *kmap_ops, |
186 | 186 | struct page **pages, unsigned int count); |
187 | 187 | int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops, |
188 | - struct page **pages, unsigned int count); | |
188 | + struct page **pages, unsigned int count, bool clear_pte); | |
189 | 189 | |
190 | 190 | #endif /* __ASM_GNTTAB_H__ */ |