Lines Matching defs:pfn

55  * PFN is that we could find ourselves where pfn_to_mfn(pfn)==pfn for a
56 * non-identity pfn. To protect ourselves against we elect to set (and get) the
80 * aligned on 512^2*PAGE_SIZE (1GB) we loop on aligned 1GB PFNs from start pfn
81 * to end pfn. We reserve_brk top leaf pages if they are missing (means they
89 * on the 4MB (or 2MB depending on architecture) off the start and end pfn's.
90 * We check if the start pfn and end pfn violate that boundary check, and if
103 * The next step is to walk from the start pfn to the end pfn setting
197 static inline unsigned p2m_top_index(unsigned long pfn)
199 BUG_ON(pfn >= MAX_P2M_PFN);
200 return pfn / (P2M_MID_PER_PAGE * P2M_PER_PAGE);
203 static inline unsigned p2m_mid_index(unsigned long pfn)
205 return (pfn / P2M_PER_PAGE) % P2M_MID_PER_PAGE;
208 static inline unsigned p2m_index(unsigned long pfn)
210 return pfn % P2M_PER_PAGE;
273 unsigned long pfn;
290 for (pfn = 0; pfn < xen_max_p2m_pfn; pfn += P2M_PER_PAGE) {
291 unsigned topidx = p2m_top_index(pfn);
292 unsigned mididx = p2m_mid_index(pfn);
307 pfn += (P2M_MID_PER_PAGE - 1) * P2M_PER_PAGE;
343 unsigned long pfn;
364 for (pfn = 0; pfn < max_pfn; pfn += P2M_PER_PAGE) {
365 unsigned topidx = p2m_top_index(pfn);
366 unsigned mididx = p2m_mid_index(pfn);
378 * not the entries beyond the last pfn will be undefined.
380 if (unlikely(pfn + P2M_PER_PAGE > max_pfn)) {
385 mfn_list[pfn + p2midx] = INVALID_P2M_ENTRY;
387 p2m_top[topidx][mididx] = &mfn_list[pfn];
393 unsigned long get_phys_to_machine(unsigned long pfn)
397 if (unlikely(pfn >= MAX_P2M_PFN))
400 topidx = p2m_top_index(pfn);
401 mididx = p2m_mid_index(pfn);
402 idx = p2m_index(pfn);
410 return IDENTITY_FRAME(pfn);
427 * Fully allocate the p2m structure for a given pfn. We need to check
433 static bool alloc_p2m(unsigned long pfn)
439 topidx = p2m_top_index(pfn);
440 mididx = p2m_mid_index(pfn);
502 static bool __init __early_alloc_p2m(unsigned long pfn)
506 topidx = p2m_top_index(pfn);
507 mididx = p2m_mid_index(pfn);
508 idx = p2m_index(pfn);
547 unsigned long pfn;
558 for (pfn = (pfn_s & ~(P2M_MID_PER_PAGE * P2M_PER_PAGE - 1));
559 pfn < ALIGN(pfn_e, (P2M_MID_PER_PAGE * P2M_PER_PAGE));
560 pfn += P2M_MID_PER_PAGE * P2M_PER_PAGE)
562 unsigned topidx = p2m_top_index(pfn);
592 for (pfn = pfn_s; pfn < pfn_e; pfn++)
593 if (!__set_phys_to_machine(pfn, IDENTITY_FRAME(pfn)))
596 if (!WARN((pfn - pfn_s) != (pfn_e - pfn_s),
598 (pfn_e - pfn_s) - (pfn - pfn_s)))
599 printk(KERN_DEBUG "1-1 mapping on %lx->%lx\n", pfn_s, pfn);
601 return pfn - pfn_s;
605 bool __set_phys_to_machine(unsigned long pfn, unsigned long mfn)
610 BUG_ON(pfn != mfn && mfn != INVALID_P2M_ENTRY);
613 if (unlikely(pfn >= MAX_P2M_PFN)) {
618 topidx = p2m_top_index(pfn);
619 mididx = p2m_mid_index(pfn);
620 idx = p2m_index(pfn);
645 bool set_phys_to_machine(unsigned long pfn, unsigned long mfn)
647 if (unlikely(!__set_phys_to_machine(pfn, mfn))) {
648 if (!alloc_p2m(pfn))
651 if (!__set_phys_to_machine(pfn, mfn))
685 unsigned long pfn;
690 pfn = page_to_pfn(page);
692 address = (unsigned long)__va(pfn << PAGE_SHIFT);
695 "m2p_add_override: pfn %lx not mapped", pfn))
701 page->index = pfn_to_mfn(pfn);
703 if (unlikely(!set_phys_to_machine(pfn, FOREIGN_FRAME(mfn))))
731 unsigned long pfn;
736 pfn = page_to_pfn(page);
737 mfn = get_phys_to_machine(pfn);
742 address = (unsigned long)__va(pfn << PAGE_SHIFT);
746 "m2p_remove_override: pfn %lx not mapped", pfn))
759 set_phys_to_machine(pfn, map_op->dev_bus_addr);
779 "pfn %lx mfn %lx, failed to modify kernel mappings",
780 pfn, mfn);
797 pfn_pte(pfn, PAGE_KERNEL));
802 set_phys_to_machine(pfn, page->index);
830 unsigned long m2p_find_override_pfn(unsigned long mfn, unsigned long pfn)
833 unsigned long ret = pfn;
856 [TYPE_PFN] = "pfn",
858 unsigned long pfn, prev_pfn_type = 0, prev_pfn_level = 0;
865 for (pfn = 0; pfn < MAX_DOMAIN_PAGES; pfn++) {
866 unsigned topidx = p2m_top_index(pfn);
867 unsigned mididx = p2m_mid_index(pfn);
868 unsigned idx = p2m_index(pfn);
885 } else if (p2m_top[topidx][mididx][idx] == IDENTITY_FRAME(pfn)) {
889 } else if (p2m_top[topidx][mididx][idx] == pfn) {
891 } else if (p2m_top[topidx][mididx][idx] != pfn) {
894 if (pfn == 0) {
898 if (pfn == MAX_DOMAIN_PAGES-1) {
904 prev_pfn_type, pfn, type_name[prev_type]);
905 prev_pfn_type = pfn;
910 prev_pfn_level, pfn, level_name[prev_level]);
911 prev_pfn_level = pfn;