Re: svn commit: r322403 - head/sys/x86/acpica

2017-08-11 Thread John Baldwin
On Friday, August 11, 2017 02:19:55 PM Roger Pau Monné wrote:
> Author: royger
> Date: Fri Aug 11 14:19:55 2017
> New Revision: 322403
> URL: https://svnweb.freebsd.org/changeset/base/322403
> 
> Log:
>   acpi/srat: fix build without DMAP
>   
>   Use pmap_mapbios to map memory used to store the cpus array.
>   
>   Reported by:lwhsu
>   X-MFC-with: r322348
> 
> Modified:
>   head/sys/x86/acpica/srat.c
> 
> Modified: head/sys/x86/acpica/srat.c
> ==
> --- head/sys/x86/acpica/srat.cFri Aug 11 14:19:31 2017
> (r322402)
> +++ head/sys/x86/acpica/srat.cFri Aug 11 14:19:55 2017
> (r322403)
> @@ -443,7 +443,12 @@ parse_srat(void)
>   ("Not enough memory for SRAT table items"));
>   phys_avail[idx + 1] = addr - 1;
>  
> - cpus = (struct cpu_info *)PHYS_TO_DMAP(addr);
> + /*
> +  * We cannot rely on PHYS_TO_DMAP because this code is also used in
> +  * i386, so use pmap_mapbios to map the memory, this will end up using
> +  * the default memory attribute (WB), and the DMAP when available.
> +  */
> + cpus = (struct cpu_info *)pmap_mapbios(addr, size);
>  
>   /*
>* Make a pass over the table to populate the cpus[] and
> @@ -529,6 +534,10 @@ srat_set_cpus(void *dummy)
>   printf("SRAT: CPU %u has memory domain %d\n", i,
>   cpu->domain);
>   }
> +
> + /* Last usage of the cpus array, unmap it. */
> + pmap_unmapdev((vm_offset_t)cpus, sizeof(*cpus) * (max_apic_id + 1));

Please pair pmap_mapbios with pmap_unmapbios.

-- 
John Baldwin
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r322403 - head/sys/x86/acpica

2017-08-11 Thread Roger Pau Monné
Author: royger
Date: Fri Aug 11 14:19:55 2017
New Revision: 322403
URL: https://svnweb.freebsd.org/changeset/base/322403

Log:
  acpi/srat: fix build without DMAP
  
  Use pmap_mapbios to map memory used to store the cpus array.
  
  Reported by:  lwhsu
  X-MFC-with:   r322348

Modified:
  head/sys/x86/acpica/srat.c

Modified: head/sys/x86/acpica/srat.c
==
--- head/sys/x86/acpica/srat.c  Fri Aug 11 14:19:31 2017(r322402)
+++ head/sys/x86/acpica/srat.c  Fri Aug 11 14:19:55 2017(r322403)
@@ -443,7 +443,12 @@ parse_srat(void)
("Not enough memory for SRAT table items"));
phys_avail[idx + 1] = addr - 1;
 
-   cpus = (struct cpu_info *)PHYS_TO_DMAP(addr);
+   /*
+* We cannot rely on PHYS_TO_DMAP because this code is also used in
+* i386, so use pmap_mapbios to map the memory, this will end up using
+* the default memory attribute (WB), and the DMAP when available.
+*/
+   cpus = (struct cpu_info *)pmap_mapbios(addr, size);
 
/*
 * Make a pass over the table to populate the cpus[] and
@@ -529,6 +534,10 @@ srat_set_cpus(void *dummy)
printf("SRAT: CPU %u has memory domain %d\n", i,
cpu->domain);
}
+
+   /* Last usage of the cpus array, unmap it. */
+   pmap_unmapdev((vm_offset_t)cpus, sizeof(*cpus) * (max_apic_id + 1));
+   cpus = NULL;
 }
 SYSINIT(srat_set_cpus, SI_SUB_CPU, SI_ORDER_ANY, srat_set_cpus, NULL);
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"