Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 Oct 2019 15:16:10 +0000 (UTC)
From:      Marcin Wojtas <mw@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r354217 - head/sys/arm64/arm64
Message-ID:  <201910311516.x9VFGAhK041522@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mw
Date: Thu Oct 31 15:16:10 2019
New Revision: 354217
URL: https://svnweb.freebsd.org/changeset/base/354217

Log:
  Fix pmap_change_attr() on arm64 to allow KV addresses
  
  Altough in the comment above the pmap_change_attr() it was mentioned
  that VA could be in KV or DMAP memory space. However,
  pmap_change_attr_locked() was accepting only the values inside the DMAP
  memory range.
  
  To fix that, the condition check was changed so also the va inside the
  KV memory range would be accepted.
  
  The sample use case that wasn't supported is the PCI Device that has the
  BAR which should me mapped with the Write Combine attribute - for
  example BAR2 of the ENA network controller on the A1 instances on AWS.
  
  Tested on A1 AWS instance and changed ENA BAR2 mapped resource to be
  write-combined memory region.
  
  Differential Revision: https://reviews.freebsd.org/D22055
  MFC after: 2 weeks
  Submitted by: Michal Krawczyk <mk@semihalf.com>
  Obtained from: Semihalf
  Sponsored by: Amazon, Inc.

Modified:
  head/sys/arm64/arm64/pmap.c

Modified: head/sys/arm64/arm64/pmap.c
==============================================================================
--- head/sys/arm64/arm64/pmap.c	Thu Oct 31 14:49:30 2019	(r354216)
+++ head/sys/arm64/arm64/pmap.c	Thu Oct 31 15:16:10 2019	(r354217)
@@ -5291,7 +5291,8 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size
 	offset = va & PAGE_MASK;
 	size = round_page(offset + size);
 
-	if (!VIRT_IN_DMAP(base))
+	if (!VIRT_IN_DMAP(base) &&
+	    !(base >= VM_MIN_KERNEL_ADDRESS && base < VM_MAX_KERNEL_ADDRESS))
 		return (EINVAL);
 
 	for (tmpva = base; tmpva < base + size; ) {



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