Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 12400f1f authored by Chris Metcalf's avatar Chris Metcalf
Browse files

arch/tile: don't set the homecache of a PTE unless appropriate



We make sure not to try to set the home for an MMIO PTE (on tilegx)
or a PTE that isn't referencing memory managed by Linux.

Signed-off-by: default avatarChris Metcalf <cmetcalf@tilera.com>
parent 48292738
Loading
Loading
Loading
Loading
+12 −4
Original line number Original line Diff line number Diff line
@@ -469,10 +469,18 @@ void __set_pte(pte_t *ptep, pte_t pte)


void set_pte(pte_t *ptep, pte_t pte)
void set_pte(pte_t *ptep, pte_t pte)
{
{
	struct page *page = pfn_to_page(pte_pfn(pte));
	if (pte_present(pte) &&

	    (!CHIP_HAS_MMIO() || hv_pte_get_mode(pte) != HV_PTE_MODE_MMIO)) {
	/* Update the home of a PTE if necessary */
		/* The PTE actually references physical memory. */
	pte = pte_set_home(pte, page_home(page));
		unsigned long pfn = pte_pfn(pte);
		if (pfn_valid(pfn)) {
			/* Update the home of the PTE from the struct page. */
			pte = pte_set_home(pte, page_home(pfn_to_page(pfn)));
		} else if (hv_pte_get_mode(pte) == 0) {
			/* remap_pfn_range(), etc, must supply PTE mode. */
			panic("set_pte(): out-of-range PFN and mode 0\n");
		}
	}


	__set_pte(ptep, pte);
	__set_pte(ptep, pte);
}
}