]> xenbits.xensource.com Git - people/julieng/freebsd.git/commitdiff
Block secondary ITS instances from attaching on ARM64
authorzbb <zbb@FreeBSD.org>
Wed, 16 Sep 2015 23:59:45 +0000 (23:59 +0000)
committerzbb <zbb@FreeBSD.org>
Wed, 16 Sep 2015 23:59:45 +0000 (23:59 +0000)
Currently FreeBSD supports only single PIC controller. Some systems
that have more than one (like ThunderX dual-socket) fails to boot.
Disable other PICes until proper handling is implemented in the
generic interrupt code.

Reviewed by:   imp
Obtained from: Semihalf
Sponsored by:  The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3682

sys/arm64/arm64/gic_v3_its.c
sys/arm64/arm64/gic_v3_var.h
sys/arm64/include/cpu.h

index d3e9ab720f664446d99615f73ebae6e182709d54..cb8a4887e90b1c48ee04a9d78a70767ef5479055 100644 (file)
@@ -179,6 +179,19 @@ gic_v3_its_attach(device_t dev)
 
        sc = device_get_softc(dev);
 
+       /*
+        * XXX ARM64TODO: Avoid configuration of more than one ITS
+        * device. To be removed when multi-PIC support is added
+        * to FreeBSD (or at least multi-ITS is implemented). Limit
+        * supported ITS sockets to '0' only.
+        */
+       if (device_get_unit(dev) != 0) {
+               device_printf(dev,
+                   "Only single instance of ITS is supported, exitting...\n");
+               return (ENXIO);
+       }
+       sc->its_socket = 0;
+
        /*
         * Initialize sleep & spin mutex for ITS
         */
@@ -558,6 +571,10 @@ its_init_cpu(struct gic_v3_its_softc *sc)
                        sc = its_sc;
                } else
                        return (ENXIO);
+
+               /* Skip if running secondary init on a wrong socket */
+               if (sc->its_socket != CPU_CURRENT_SOCKET)
+                       return (ENXIO);
        }
 
        /*
index c8519b0ac856d555667606a27548e4e138505fb2..7bcd068a7fdc1bc7143650ea296a37613c6a1f48 100644 (file)
@@ -232,6 +232,8 @@ struct gic_v3_its_softc {
 
        struct mtx              its_mtx;
        struct mtx              its_spin_mtx;
+
+       uint32_t                its_socket;     /* Socket number ITS is attached to */
 };
 
 /* Stuff that is specific to the vendor's implementation */
index f979af5c27412687d2e95163d0b8b2eef0ce6143..14bffbc1f5369cbebb61b17cb2b93ffeb49d4ac8 100644 (file)
@@ -148,6 +148,8 @@ void        identify_cpu(void);
 void   swi_vm(void *v);
 
 #define        CPU_AFFINITY(cpu)       __cpu_affinity[(cpu)]
+#define        CPU_CURRENT_SOCKET                              \
+    (CPU_AFF2(CPU_AFFINITY(PCPU_GET(cpuid))))
 
 static __inline uint64_t
 get_cyclecount(void)