Re: Fix and includes on powerpc*

2021-05-29 Thread Jonathan Gray
On Sun, May 30, 2021 at 05:03:47AM +, Visa Hankala wrote:
> powerpc and powerpc64's  include  too late
> and accidentally rely on other code to pull in the header. If the mutex
> header is removed from the , the build fails:
> 
> In file included from src/sys/dev/rnd.c:84:
> In file included from src/sys/uvm/uvm_extern.h:180:
> In file included from src/sys/uvm/uvm_pmap.h:86:
> src/sys/arch/powerpc64/compile/GENERIC/obj/machine/pmap.h:38:16: error: field 
> has incomplete type 'struct mutex'
> struct mutexpm_mtx;
> ^
> 
> The following diff fixes the above. Also, it adds  in
> powerpc's pmap.h for consistency with powerpc64 (struct vm_page_md uses
> LIST_HEAD() after all). powerpc64's  appears to have
> a hidden dependency on .
> 
> OK?

ok jsg@

> 
> Index: arch/powerpc/include/pmap.h
> ===
> RCS file: src/sys/arch/powerpc/include/pmap.h,v
> retrieving revision 1.59
> diff -u -p -r1.59 pmap.h
> --- arch/powerpc/include/pmap.h   8 Oct 2015 10:20:14 -   1.59
> +++ arch/powerpc/include/pmap.h   30 May 2021 04:28:46 -
> @@ -77,6 +77,9 @@ typedef u_int sr_t;
>  #define PMAP_CACHE_WT2   /* writethru */
>  #define PMAP_CACHE_WB3   /* writeback */
>  
> +#include 
> +#include 
> +
>  #ifdef   _KERNEL
>  
>  /*
> @@ -164,8 +167,6 @@ int reserve_dumppages(caddr_t p);
>  
>  #endif   /* _KERNEL */
>  
> -#include 
> -
>  struct vm_page_md {
>   struct mutex pv_mtx;
>   LIST_HEAD(,pte_desc) pv_list;
> Index: arch/powerpc64/include/intr.h
> ===
> RCS file: src/sys/arch/powerpc64/include/intr.h,v
> retrieving revision 1.13
> diff -u -p -r1.13 intr.h
> --- arch/powerpc64/include/intr.h 24 Oct 2020 21:42:10 -  1.13
> +++ arch/powerpc64/include/intr.h 30 May 2021 04:28:46 -
> @@ -19,6 +19,8 @@
>  #ifndef _MACHINE_INTR_H_
>  #define _MACHINE_INTR_H_
>  
> +#include 
> +
>  struct cpu_info;
>  struct trapframe;
>  
> Index: arch/powerpc64/include/pmap.h
> ===
> RCS file: src/sys/arch/powerpc64/include/pmap.h,v
> retrieving revision 1.16
> diff -u -p -r1.16 pmap.h
> --- arch/powerpc64/include/pmap.h 11 May 2021 18:21:12 -  1.16
> +++ arch/powerpc64/include/pmap.h 30 May 2021 04:28:46 -
> @@ -19,6 +19,9 @@
>  #ifndef _MACHINE_PMAP_H_
>  #define _MACHINE_PMAP_H_
>  
> +#include 
> +#include 
> +
>  #ifdef _KERNEL
>  
>  #include 
> @@ -80,9 +83,6 @@ struct pte *pmap_get_kernel_pte(vaddr_t)
>  
>  #endif   /* _KERNEL */
>  
> -#include 
> -#include 
> -
>  struct vm_page_md {
>   struct mutex pv_mtx;
>   LIST_HEAD(,pte_desc) pv_list;
> 
> 



Fix and includes on powerpc*

2021-05-29 Thread Visa Hankala
powerpc and powerpc64's  include  too late
and accidentally rely on other code to pull in the header. If the mutex
header is removed from the , the build fails:

In file included from src/sys/dev/rnd.c:84:
In file included from src/sys/uvm/uvm_extern.h:180:
In file included from src/sys/uvm/uvm_pmap.h:86:
src/sys/arch/powerpc64/compile/GENERIC/obj/machine/pmap.h:38:16: error: field 
has incomplete type 'struct mutex'
struct mutexpm_mtx;
^

The following diff fixes the above. Also, it adds  in
powerpc's pmap.h for consistency with powerpc64 (struct vm_page_md uses
LIST_HEAD() after all). powerpc64's  appears to have
a hidden dependency on .

OK?

Index: arch/powerpc/include/pmap.h
===
RCS file: src/sys/arch/powerpc/include/pmap.h,v
retrieving revision 1.59
diff -u -p -r1.59 pmap.h
--- arch/powerpc/include/pmap.h 8 Oct 2015 10:20:14 -   1.59
+++ arch/powerpc/include/pmap.h 30 May 2021 04:28:46 -
@@ -77,6 +77,9 @@ typedef u_int sr_t;
 #define PMAP_CACHE_WT  2   /* writethru */
 #define PMAP_CACHE_WB  3   /* writeback */
 
+#include 
+#include 
+
 #ifdef _KERNEL
 
 /*
@@ -164,8 +167,6 @@ int reserve_dumppages(caddr_t p);
 
 #endif /* _KERNEL */
 
-#include 
-
 struct vm_page_md {
struct mutex pv_mtx;
LIST_HEAD(,pte_desc) pv_list;
Index: arch/powerpc64/include/intr.h
===
RCS file: src/sys/arch/powerpc64/include/intr.h,v
retrieving revision 1.13
diff -u -p -r1.13 intr.h
--- arch/powerpc64/include/intr.h   24 Oct 2020 21:42:10 -  1.13
+++ arch/powerpc64/include/intr.h   30 May 2021 04:28:46 -
@@ -19,6 +19,8 @@
 #ifndef _MACHINE_INTR_H_
 #define _MACHINE_INTR_H_
 
+#include 
+
 struct cpu_info;
 struct trapframe;
 
Index: arch/powerpc64/include/pmap.h
===
RCS file: src/sys/arch/powerpc64/include/pmap.h,v
retrieving revision 1.16
diff -u -p -r1.16 pmap.h
--- arch/powerpc64/include/pmap.h   11 May 2021 18:21:12 -  1.16
+++ arch/powerpc64/include/pmap.h   30 May 2021 04:28:46 -
@@ -19,6 +19,9 @@
 #ifndef _MACHINE_PMAP_H_
 #define _MACHINE_PMAP_H_
 
+#include 
+#include 
+
 #ifdef _KERNEL
 
 #include 
@@ -80,9 +83,6 @@ struct pte *pmap_get_kernel_pte(vaddr_t)
 
 #endif /* _KERNEL */
 
-#include 
-#include 
-
 struct vm_page_md {
struct mutex pv_mtx;
LIST_HEAD(,pte_desc) pv_list;