diff options
author | Zoltan Kiss <zoltan.kiss@citrix.com> | 2014-02-27 10:55:30 -0500 |
---|---|---|
committer | David Vrabel <david.vrabel@citrix.com> | 2014-03-18 10:40:19 -0400 |
commit | 1429d46df4c538d28460d0b493997006a62a1093 (patch) | |
tree | 81e177be951fd3134d2e475307af278a1951061a /arch/arm/xen | |
parent | 395edbb80b049884df075be54ef46cc742c3e266 (diff) |
xen/grant-table: Refactor gnttab_[un]map_refs to avoid m2p_override
The grant mapping API does m2p_override unnecessarily: only gntdev needs it,
for blkback and future netback patches it just cause a lock contention, as
those pages never go to userspace. Therefore this series does the following:
- the bulk of the original function (everything after the mapping hypercall)
is moved to arch-dependent set/clear_foreign_p2m_mapping
- the "if (xen_feature(XENFEAT_auto_translated_physmap))" branch goes to ARM
- therefore the ARM function could be much smaller, the m2p_override stubs
could be also removed
- on x86 the set_phys_to_machine calls were moved up to this new funcion
from m2p_override functions
- and m2p_override functions are only called when there is a kmap_ops param
It also removes a stray space from arch/x86/include/asm/xen/page.h.
Signed-off-by: Zoltan Kiss <zoltan.kiss@citrix.com>
Suggested-by: Anthony Liguori <aliguori@amazon.com>
Suggested-by: David Vrabel <david.vrabel@citrix.com>
Suggested-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Diffstat (limited to 'arch/arm/xen')
-rw-r--r-- | arch/arm/xen/p2m.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/arch/arm/xen/p2m.c b/arch/arm/xen/p2m.c index b31ee1b275b0..97baf4427817 100644 --- a/arch/arm/xen/p2m.c +++ b/arch/arm/xen/p2m.c | |||
@@ -146,6 +146,38 @@ unsigned long __mfn_to_pfn(unsigned long mfn) | |||
146 | } | 146 | } |
147 | EXPORT_SYMBOL_GPL(__mfn_to_pfn); | 147 | EXPORT_SYMBOL_GPL(__mfn_to_pfn); |
148 | 148 | ||
149 | int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops, | ||
150 | struct gnttab_map_grant_ref *kmap_ops, | ||
151 | struct page **pages, unsigned int count) | ||
152 | { | ||
153 | int i; | ||
154 | |||
155 | for (i = 0; i < count; i++) { | ||
156 | if (map_ops[i].status) | ||
157 | continue; | ||
158 | set_phys_to_machine(map_ops[i].host_addr >> PAGE_SHIFT, | ||
159 | map_ops[i].dev_bus_addr >> PAGE_SHIFT); | ||
160 | } | ||
161 | |||
162 | return 0; | ||
163 | } | ||
164 | EXPORT_SYMBOL_GPL(set_foreign_p2m_mapping); | ||
165 | |||
166 | int clear_foreign_p2m_mapping(struct gnttab_unmap_grant_ref *unmap_ops, | ||
167 | struct gnttab_map_grant_ref *kmap_ops, | ||
168 | struct page **pages, unsigned int count) | ||
169 | { | ||
170 | int i; | ||
171 | |||
172 | for (i = 0; i < count; i++) { | ||
173 | set_phys_to_machine(unmap_ops[i].host_addr >> PAGE_SHIFT, | ||
174 | INVALID_P2M_ENTRY); | ||
175 | } | ||
176 | |||
177 | return 0; | ||
178 | } | ||
179 | EXPORT_SYMBOL_GPL(clear_foreign_p2m_mapping); | ||
180 | |||
149 | bool __set_phys_to_machine_multi(unsigned long pfn, | 181 | bool __set_phys_to_machine_multi(unsigned long pfn, |
150 | unsigned long mfn, unsigned long nr_pages) | 182 | unsigned long mfn, unsigned long nr_pages) |
151 | { | 183 | { |