aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuergen Gross <jgross@suse.com>2014-11-28 05:53:54 -0500
committerDavid Vrabel <david.vrabel@citrix.com>2014-12-04 09:08:53 -0500
commit97f4533a60ce5d0cb35ff44a190111f81a987620 (patch)
tree779408afdaad29ec09264f17fcc9ded004c9f44e
parent1f3ac86b4c45a146e090d24bf66c49b95e72f071 (diff)
xen: Delay m2p_override initialization
The m2p overrides are used to be able to find the local pfn for a foreign mfn mapped into the domain. They are used by driver backends having to access frontend data. As this functionality isn't used in early boot it makes no sense to initialize the m2p override functions very early. It can be done later without doing any harm, removing the need for allocating memory via extend_brk(). While at it make some m2p override functions static as they are only used internally. Signed-off-by: Juergen Gross <jgross@suse.com> Reviewed-by: David Vrabel <david.vrabel@citrix.com> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Signed-off-by: David Vrabel <david.vrabel@citrix.com>
-rw-r--r--arch/x86/xen/p2m.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index 24cd9d17f57f..8676f3566fe3 100644
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -428,8 +428,6 @@ void __init xen_build_dynamic_phys_to_machine(void)
428 } 428 }
429 p2m_top[topidx][mididx] = &mfn_list[pfn]; 429 p2m_top[topidx][mididx] = &mfn_list[pfn];
430 } 430 }
431
432 m2p_override_init();
433} 431}
434#ifdef CONFIG_X86_64 432#ifdef CONFIG_X86_64
435unsigned long __init xen_revector_p2m_tree(void) 433unsigned long __init xen_revector_p2m_tree(void)
@@ -500,13 +498,15 @@ unsigned long __init xen_revector_p2m_tree(void)
500 } 498 }
501 /* This should be the leafs allocated for identity from _brk. */ 499 /* This should be the leafs allocated for identity from _brk. */
502 } 500 }
503 return (unsigned long)mfn_list;
504 501
502 m2p_override_init();
503 return (unsigned long)mfn_list;
505} 504}
506#else 505#else
507unsigned long __init xen_revector_p2m_tree(void) 506unsigned long __init xen_revector_p2m_tree(void)
508{ 507{
509 use_brk = 0; 508 use_brk = 0;
509 m2p_override_init();
510 return 0; 510 return 0;
511} 511}
512#endif 512#endif
@@ -796,15 +796,16 @@ bool set_phys_to_machine(unsigned long pfn, unsigned long mfn)
796#define M2P_OVERRIDE_HASH_SHIFT 10 796#define M2P_OVERRIDE_HASH_SHIFT 10
797#define M2P_OVERRIDE_HASH (1 << M2P_OVERRIDE_HASH_SHIFT) 797#define M2P_OVERRIDE_HASH (1 << M2P_OVERRIDE_HASH_SHIFT)
798 798
799static RESERVE_BRK_ARRAY(struct list_head, m2p_overrides, M2P_OVERRIDE_HASH); 799static struct list_head *m2p_overrides;
800static DEFINE_SPINLOCK(m2p_override_lock); 800static DEFINE_SPINLOCK(m2p_override_lock);
801 801
802static void __init m2p_override_init(void) 802static void __init m2p_override_init(void)
803{ 803{
804 unsigned i; 804 unsigned i;
805 805
806 m2p_overrides = extend_brk(sizeof(*m2p_overrides) * M2P_OVERRIDE_HASH, 806 m2p_overrides = alloc_bootmem_align(
807 sizeof(unsigned long)); 807 sizeof(*m2p_overrides) * M2P_OVERRIDE_HASH,
808 sizeof(unsigned long));
808 809
809 for (i = 0; i < M2P_OVERRIDE_HASH; i++) 810 for (i = 0; i < M2P_OVERRIDE_HASH; i++)
810 INIT_LIST_HEAD(&m2p_overrides[i]); 811 INIT_LIST_HEAD(&m2p_overrides[i]);
@@ -932,10 +933,14 @@ EXPORT_SYMBOL_GPL(set_foreign_p2m_mapping);
932static struct page *m2p_find_override(unsigned long mfn) 933static struct page *m2p_find_override(unsigned long mfn)
933{ 934{
934 unsigned long flags; 935 unsigned long flags;
935 struct list_head *bucket = &m2p_overrides[mfn_hash(mfn)]; 936 struct list_head *bucket;
936 struct page *p, *ret; 937 struct page *p, *ret;
937 938
939 if (unlikely(!m2p_overrides))
940 return NULL;
941
938 ret = NULL; 942 ret = NULL;
943 bucket = &m2p_overrides[mfn_hash(mfn)];
939 944
940 spin_lock_irqsave(&m2p_override_lock, flags); 945 spin_lock_irqsave(&m2p_override_lock, flags);
941 946