Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 19 Jan 2019 04:54:13 +0000 (UTC)
From:      Justin Hibbits <jhibbits@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r343168 - head/sys/contrib/ncsw/user/env
Message-ID:  <201901190454.x0J4sDiV076384@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhibbits
Date: Sat Jan 19 04:54:12 2019
New Revision: 343168
URL: https://svnweb.freebsd.org/changeset/base/343168

Log:
  powerpc/dpaa: Handle DMAP virtual addresses in DPAA
  
  sendfile(2) appears to now use DMAP wherever possible.  These addresses are not
  managed by pmap, so pmap_kextract() returns a 0 physical address, causing
  failure.
  
  This change fixes nginx running on P5020 SoC.
  
  MFC after:	3 weeks

Modified:
  head/sys/contrib/ncsw/user/env/xx.c

Modified: head/sys/contrib/ncsw/user/env/xx.c
==============================================================================
--- head/sys/contrib/ncsw/user/env/xx.c	Sat Jan 19 04:47:19 2019	(r343167)
+++ head/sys/contrib/ncsw/user/env/xx.c	Sat Jan 19 04:54:12 2019	(r343168)
@@ -701,7 +701,12 @@ XX_VirtToPhys(void *addr)
 		return (XX_PInfo.portal_ci_pa[QM_PORTAL][cpu] +
 		    (vm_offset_t)addr - XX_PInfo.portal_ci_va[QM_PORTAL]);
 
-	paddr = pmap_kextract((vm_offset_t)addr);
+	if (PMAP_HAS_DMAP && (vm_offset_t)addr >= DMAP_BASE_ADDRESS &&
+	    (vm_offset_t)addr <= DMAP_MAX_ADDRESS)
+		return (DMAP_TO_PHYS((vm_offset_t)addr));
+	else
+		paddr = pmap_kextract((vm_offset_t)addr);
+
 	if (paddr == 0)
 		printf("NetCommSW: "
 		    "Unable to translate virtual address %p!\n", addr);
@@ -756,6 +761,9 @@ XX_PhysToVirt(physAddress_t addr)
 
 	if (pv != NULL)
 		return ((void *)(pv->pv_va + ((vm_offset_t)addr & PAGE_MASK)));
+
+	if (PMAP_HAS_DMAP)
+		return ((void *)PHYS_TO_DMAP(addr));
 
 	printf("NetCommSW: "
 	    "Unable to translate physical address 0x%09jx!\n", (uintmax_t)addr);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201901190454.x0J4sDiV076384>