Lines Matching refs:pfn

59  * PFN is that we could find ourselves where pfn_to_mfn(pfn)==pfn for a
60 * non-identity pfn. To protect ourselves against we elect to set (and get) the
126 static inline unsigned p2m_top_index(unsigned long pfn)
128 BUG_ON(pfn >= MAX_P2M_PFN);
129 return pfn / (P2M_MID_PER_PAGE * P2M_PER_PAGE);
132 static inline unsigned p2m_mid_index(unsigned long pfn)
134 return (pfn / P2M_PER_PAGE) % P2M_MID_PER_PAGE;
169 static void p2m_init_identity(unsigned long *p2m, unsigned long pfn)
174 p2m[i] = IDENTITY_FRAME(pfn + i);
214 unsigned long pfn, mfn;
237 for (pfn = 0; pfn < xen_max_p2m_pfn && pfn < MAX_P2M_PFN;
238 pfn += P2M_PER_PAGE) {
239 topidx = p2m_top_index(pfn);
240 mididx = p2m_mid_index(pfn);
243 ptep = lookup_address((unsigned long)(xen_p2m_addr + pfn),
257 pfn += (P2M_MID_PER_PAGE - 1) * P2M_PER_PAGE;
292 unsigned long pfn;
297 for (pfn = xen_start_info->nr_pages; pfn < xen_p2m_size; pfn++)
298 xen_p2m_addr[pfn] = INVALID_P2M_ENTRY;
308 static int xen_p2m_elem_type(unsigned long pfn)
312 if (pfn >= xen_p2m_size)
315 mfn = xen_p2m_addr[pfn];
329 unsigned long pfn;
351 for (pfn = 0; pfn < xen_max_p2m_pfn; pfn += chunk) {
362 chunk = (pfn & (P2M_PER_PAGE * P2M_MID_PER_PAGE - 1)) ?
365 type = xen_p2m_elem_type(pfn);
369 if (xen_p2m_elem_type(pfn + i) != type)
378 copy_page(mfns, xen_p2m_addr + pfn);
379 ptep = populate_extra_pte((unsigned long)(p2m + pfn));
389 ptep = populate_extra_pte((unsigned long)(p2m + pfn));
400 (unsigned long)(p2m + pfn) + i * PMD_SIZE);
430 unsigned long get_phys_to_machine(unsigned long pfn)
435 if (unlikely(pfn >= xen_p2m_size)) {
436 if (pfn < xen_max_p2m_pfn)
437 return xen_chk_extra_mem(pfn);
439 return IDENTITY_FRAME(pfn);
442 ptep = lookup_address((unsigned long)(xen_p2m_addr + pfn), &level);
451 return IDENTITY_FRAME(pfn);
453 return xen_p2m_addr[pfn];
520 * Fully allocate the p2m structure for a given pfn. We need to check
526 int xen_alloc_p2m_entry(unsigned long pfn)
533 unsigned long addr = (unsigned long)(xen_p2m_addr + pfn);
547 if (p2m_top_mfn && pfn < MAX_P2M_PFN) {
548 topidx = p2m_top_index(pfn);
593 p2m_init_identity(p2m, pfn & ~(P2M_PER_PAGE - 1));
605 mid_mfn[p2m_mid_index(pfn)] = virt_to_mfn(p2m);
616 if (pfn >= xen_p2m_last_pfn) {
617 xen_p2m_last_pfn = ALIGN(pfn + 1, P2M_PER_PAGE);
628 unsigned long pfn;
639 for (pfn = pfn_s; pfn < pfn_e; pfn++)
640 xen_p2m_addr[pfn] = IDENTITY_FRAME(pfn);
642 return pfn - pfn_s;
645 bool __set_phys_to_machine(unsigned long pfn, unsigned long mfn)
651 if (unlikely(pfn >= xen_p2m_size))
658 if (likely(!xen_safe_write_ulong(xen_p2m_addr + pfn, mfn)))
661 ptep = lookup_address((unsigned long)(xen_p2m_addr + pfn), &level);
668 return mfn == IDENTITY_FRAME(pfn);
673 bool set_phys_to_machine(unsigned long pfn, unsigned long mfn)
675 if (unlikely(!__set_phys_to_machine(pfn, mfn))) {
678 ret = xen_alloc_p2m_entry(pfn);
682 return __set_phys_to_machine(pfn, mfn);
706 unsigned long mfn, pfn;
722 pfn = page_to_pfn(pages[i]);
724 WARN(pfn_to_mfn(pfn) != INVALID_P2M_ENTRY, "page must be ballooned");
726 if (likely(set_phys_to_machine(pfn, FOREIGN_FRAME(mfn))))
783 unsigned long pfn = page_to_pfn(pages[i]);
786 set_phys_to_machine(pfn, INVALID_P2M_ENTRY);
805 [P2M_TYPE_PFN] = "pfn",
807 unsigned long pfn, first_pfn;
813 for (pfn = 0; pfn < xen_p2m_size; pfn++) {
814 type = xen_p2m_elem_type(pfn);
816 seq_printf(m, " [0x%lx->0x%lx] %s\n", first_pfn, pfn,
819 first_pfn = pfn;
822 seq_printf(m, " [0x%lx->0x%lx] %s\n", first_pfn, pfn,