powerpc and powerpc64's <machine/pmap.h> include <sys/mutex.h> too late
and accidentally rely on other code to pull in the header. If the mutex
header is removed from the <machine/softintr.h>, 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 mutex pm_mtx;
^
The following diff fixes the above. Also, it adds <sys/queue.h> in
powerpc's pmap.h for consistency with powerpc64 (struct vm_page_md uses
LIST_HEAD() after all). powerpc64's <machine/intr.h> appears to have
a hidden dependency on <sys/queue.h>.
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 -0000 1.59
+++ arch/powerpc/include/pmap.h 30 May 2021 04:28:46 -0000
@@ -77,6 +77,9 @@ typedef u_int sr_t;
#define PMAP_CACHE_WT 2 /* writethru */
#define PMAP_CACHE_WB 3 /* writeback */
+#include <sys/mutex.h>
+#include <sys/queue.h>
+
#ifdef _KERNEL
/*
@@ -164,8 +167,6 @@ int reserve_dumppages(caddr_t p);
#endif /* _KERNEL */
-#include <sys/mutex.h>
-
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 -0000 1.13
+++ arch/powerpc64/include/intr.h 30 May 2021 04:28:46 -0000
@@ -19,6 +19,8 @@
#ifndef _MACHINE_INTR_H_
#define _MACHINE_INTR_H_
+#include <sys/queue.h>
+
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 -0000 1.16
+++ arch/powerpc64/include/pmap.h 30 May 2021 04:28:46 -0000
@@ -19,6 +19,9 @@
#ifndef _MACHINE_PMAP_H_
#define _MACHINE_PMAP_H_
+#include <sys/mutex.h>
+#include <sys/queue.h>
+
#ifdef _KERNEL
#include <machine/pte.h>
@@ -80,9 +83,6 @@ struct pte *pmap_get_kernel_pte(vaddr_t)
#endif /* _KERNEL */
-#include <sys/mutex.h>
-#include <sys/queue.h>
-
struct vm_page_md {
struct mutex pv_mtx;
LIST_HEAD(,pte_desc) pv_list;