aboutsummaryrefslogtreecommitdiffstats
path: root/arch/tile/mm/pgtable.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/tile/mm/pgtable.c')
-rw-r--r--arch/tile/mm/pgtable.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/arch/tile/mm/pgtable.c b/arch/tile/mm/pgtable.c
index 87303693a072..6b9a109c3e31 100644
--- a/arch/tile/mm/pgtable.c
+++ b/arch/tile/mm/pgtable.c
@@ -469,10 +469,18 @@ void __set_pte(pte_t *ptep, pte_t pte)
469 469
470void set_pte(pte_t *ptep, pte_t pte) 470void set_pte(pte_t *ptep, pte_t pte)
471{ 471{
472 struct page *page = pfn_to_page(pte_pfn(pte)); 472 if (pte_present(pte) &&
473 473 (!CHIP_HAS_MMIO() || hv_pte_get_mode(pte) != HV_PTE_MODE_MMIO)) {
474 /* Update the home of a PTE if necessary */ 474 /* The PTE actually references physical memory. */
475 pte = pte_set_home(pte, page_home(page)); 475 unsigned long pfn = pte_pfn(pte);
476 if (pfn_valid(pfn)) {
477 /* Update the home of the PTE from the struct page. */
478 pte = pte_set_home(pte, page_home(pfn_to_page(pfn)));
479 } else if (hv_pte_get_mode(pte) == 0) {
480 /* remap_pfn_range(), etc, must supply PTE mode. */
481 panic("set_pte(): out-of-range PFN and mode 0\n");
482 }
483 }
476 484
477 __set_pte(ptep, pte); 485 __set_pte(ptep, pte);
478} 486}