Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/cortex Fail gracefully if gicv3_its_set_affinit...



details:   https://anonhg.NetBSD.org/src/rev/4ec272219ef7
branches:  trunk
changeset: 451924:4ec272219ef7
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Wed Jun 12 10:00:09 2019 +0000

description:
Fail gracefully if gicv3_its_set_affinity is called before a cpu is
brought online.

diffstat:

 sys/arch/arm/cortex/gicv3_its.c |  8 ++++++--
 sys/arch/arm/cortex/gicv3_its.h |  3 ++-
 2 files changed, 8 insertions(+), 3 deletions(-)

diffs (53 lines):

diff -r 4bc60a9c263b -r 4ec272219ef7 sys/arch/arm/cortex/gicv3_its.c
--- a/sys/arch/arm/cortex/gicv3_its.c   Wed Jun 12 09:03:31 2019 +0000
+++ b/sys/arch/arm/cortex/gicv3_its.c   Wed Jun 12 10:00:09 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gicv3_its.c,v 1.10 2018/12/08 15:04:40 jmcneill Exp $ */
+/* $NetBSD: gicv3_its.c,v 1.11 2019/06/12 10:00:09 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #define _INTR_PRIVATE
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gicv3_its.c,v 1.10 2018/12/08 15:04:40 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gicv3_its.c,v 1.11 2019/06/12 10:00:09 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/kmem.h>
@@ -719,6 +719,8 @@
        gits_command_mapc(its, cpu_index(ci), rdbase, true);
        gits_command_invall(its, cpu_index(ci));
        gits_wait(its);
+
+       its->its_cpuonline[cpu_index(ci)] = true;
 }
 
 static void
@@ -749,6 +751,8 @@
                return EINVAL;
 
        ci = cpu_lookup(kcpuset_ffs(affinity) - 1);
+       if (its->its_cpuonline[cpu_index(ci)] == false)
+               return ENXIO;
 
        const uint32_t devid = gicv3_its_devid(pa->pa_pc, pa->pa_tag);
        gits_command_movi(its, devid, devid, cpu_index(ci));
diff -r 4bc60a9c263b -r 4ec272219ef7 sys/arch/arm/cortex/gicv3_its.h
--- a/sys/arch/arm/cortex/gicv3_its.h   Wed Jun 12 09:03:31 2019 +0000
+++ b/sys/arch/arm/cortex/gicv3_its.h   Wed Jun 12 10:00:09 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gicv3_its.h,v 1.4 2018/11/28 22:54:11 jmcneill Exp $ */
+/* $NetBSD: gicv3_its.h,v 1.5 2019/06/12 10:00:09 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -53,6 +53,7 @@
        uint32_t                its_id;
        uint64_t                its_base;
        uint64_t                its_rdbase[MAXCPUS];
+       bool                    its_cpuonline[MAXCPUS];
 
        struct gicv3_softc      *its_gic;
        struct gicv3_lpi_callback its_cb;



Home | Main Index | Thread Index | Old Index