From owner-svn-src-projects@FreeBSD.ORG Mon Jan 16 17:08:09 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4154E106564A; Mon, 16 Jan 2012 17:08:09 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 15ADE8FC15; Mon, 16 Jan 2012 17:08:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0GH88Tu043324; Mon, 16 Jan 2012 17:08:08 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0GH88Fs043322; Mon, 16 Jan 2012 17:08:08 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201201161708.q0GH88Fs043322@svn.freebsd.org> From: Nathan Whitehorn Date: Mon, 16 Jan 2012 17:08:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230222 - projects/pseries/powerpc/pseries X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jan 2012 17:08:09 -0000 Author: nwhitehorn Date: Mon Jan 16 17:08:08 2012 New Revision: 230222 URL: http://svn.freebsd.org/changeset/base/230222 Log: Fix calling convention for RTAS calls in this driver as well as a misunderstanding of the cpu server argument to ibm,set-xive. As a result, devices interrupts now work as well as IPIs. Modified: projects/pseries/powerpc/pseries/xics.c Modified: projects/pseries/powerpc/pseries/xics.c ============================================================================== --- projects/pseries/powerpc/pseries/xics.c Mon Jan 16 15:47:42 2012 (r230221) +++ projects/pseries/powerpc/pseries/xics.c Mon Jan 16 17:08:08 2012 (r230222) @@ -146,14 +146,17 @@ static void xics_bind(device_t dev, u_int irq, cpuset_t cpumask) { struct xics_softc *sc = device_get_softc(dev); - uint64_t status; + cell_t status, cpu; /* - * XXX: This is very special and just needs a mask. - * For the moment, just play dirty and get the first word. + * This doesn't appear to actually support affinity groups, so just + * use the first CPU. */ - rtas_call_method(sc->ibm_set_xive, 3, 1, (uint64_t)irq, - cpumask.__bits[0], XICS_PRIORITY, &status); + CPU_FOREACH(cpu) + if (CPU_ISSET(cpu, &cpumask)) break; + + rtas_call_method(sc->ibm_set_xive, 3, 1, irq, cpu, XICS_PRIORITY, + &status); } static void @@ -194,8 +197,7 @@ static void xics_enable(device_t dev, u_int irq, u_int vector) { struct xics_softc *sc; - uint64_t status, cpumask; - int i; + cell_t status, cpu; sc = device_get_softc(dev); @@ -213,13 +215,10 @@ xics_enable(device_t dev, u_int irq, u_i if (irq == MAX_XICS_IRQS) return; - /* Bind to all CPUs to start */ - cpumask = 0; - CPU_FOREACH(i) - cpumask |= (1ULL << i); - - rtas_call_method(sc->ibm_set_xive, 3, 1, (uint64_t)irq, cpumask, - XICS_PRIORITY, &status); + /* Bind to this CPU to start: distrib. ID is last entry in gserver# */ + cpu = PCPU_GET(cpuid); + rtas_call_method(sc->ibm_set_xive, 3, 1, irq, cpu, XICS_PRIORITY, + &status); xics_unmask(dev, irq); } @@ -246,22 +245,22 @@ static void xics_mask(device_t dev, u_int irq) { struct xics_softc *sc = device_get_softc(dev); - uint64_t status; + cell_t status; if (irq == MAX_XICS_IRQS) return; - rtas_call_method(sc->ibm_int_off, 1, 1, (uint64_t)irq, &status); + rtas_call_method(sc->ibm_int_off, 1, 1, irq, &status); } static void xics_unmask(device_t dev, u_int irq) { struct xics_softc *sc = device_get_softc(dev); - uint64_t status; + cell_t status; if (irq == MAX_XICS_IRQS) return; - rtas_call_method(sc->ibm_int_on, 1, 1, (uint64_t)irq, &status); + rtas_call_method(sc->ibm_int_on, 1, 1, irq, &status); }