Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 02 Jun 2012 18:06:28 +0200
From:      Zbyszek Bodek <zbb@semihalf.com>
To:        Nathan Whitehorn <nwhitehorn@freebsd.org>
Cc:        powerpc@freebsd.org, =?UTF-8?B?UGlvdHIgWmnEmWNpaw==?= <kosmo@semihalf.com>
Subject:   Re: RFC: OpenPIC IPI patch
Message-ID:  <4FCA3A04.3010702@semihalf.com>
In-Reply-To: <4FC74BDC.4050806@freebsd.org>
References:  <0362C399-CB54-451E-A879-E836EF13CE72@semihalf.com> <4FC74BDC.4050806@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------040405080709010608060704
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

On 31.05.2012 12:45, Nathan Whitehorn wrote:
> On 05/30/12 22:13, Rafal Jaworowski wrote:
>> Can you please have a look at this patch and let us know about any
>> comments / objections? We identified a problem with IPI on the recent
>> FSL eOpenPIC, description in the patch:
>>
>> http://people.freebsd.org/~raj/patches/powerpc/openpic.diff
>> <http://people.freebsd.org/%7Eraj/patches/powerpc/openpic.diff>;
>>
>> Rafal
>>
>

Hello.
As Rafal noticed, when we've changed pic_ipi method, ps3pic_ipi() ought 
to be adjusted too.

@@ -203,12 +204,17 @@ ps3pic_eoi(device_t dev, u_int irq)
  }

  static void
-ps3pic_ipi(device_t dev, u_int cpu)
+ps3pic_ipi(device_t dev, cpuset_t cpumask)
  {
  	struct ps3pic_softc *sc;
+	u_int cpu;
+
  	sc = device_get_softc(dev);

-	lv1_send_event_locally(sc->sc_ipi_outlet[cpu]);
+	for (cpu = 0; cpu < 2; cpu++) {
+		if (CPU_ISSET(cpu, &cpumask))
+			lv1_send_event_locally(sc->sc_ipi_outlet[cpu]);
+	}
  }

I've made a modification but it requires some overview.
I have used a hard-coded value of 2 to sweep the mask of CPUs because
sc_ipi_outlet has two fields anyway. Don't know if that approach isn't 
too "far-reaching" or should I use mp_ncpus instead.

The patch is available in the email's attachment.
Please send your comments.

Best regards
Zbyszek Bodek

--------------040405080709010608060704
Content-Type: text/x-patch;
 name="ps3pic_ipi.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="ps3pic_ipi.patch"

diff --git a/sys/powerpc/ps3/ps3pic.c b/sys/powerpc/ps3/ps3pic.c
index 8022cf8..b803f64 100644
--- a/sys/powerpc/ps3/ps3pic.c
+++ b/sys/powerpc/ps3/ps3pic.c
@@ -30,6 +30,7 @@
 #include <sys/module.h>
 #include <sys/bus.h>
 #include <sys/conf.h>
+#include <sys/cpuset.h>
 #include <sys/kernel.h>
 #include <sys/malloc.h>
 
@@ -51,7 +52,7 @@ static int	ps3pic_attach(device_t);
 static void	ps3pic_dispatch(device_t, struct trapframe *);
 static void	ps3pic_enable(device_t, u_int, u_int);
 static void	ps3pic_eoi(device_t, u_int);
-static void	ps3pic_ipi(device_t, u_int);
+static void	ps3pic_ipi(device_t, cpuset_t);
 static void	ps3pic_mask(device_t, u_int);
 static void	ps3pic_unmask(device_t, u_int);
 
@@ -203,12 +204,17 @@ ps3pic_eoi(device_t dev, u_int irq)
 }
 
 static void
-ps3pic_ipi(device_t dev, u_int cpu)
+ps3pic_ipi(device_t dev, cpuset_t cpumask)
 {
 	struct ps3pic_softc *sc;
+	u_int cpu;
+
 	sc = device_get_softc(dev);
 
-	lv1_send_event_locally(sc->sc_ipi_outlet[cpu]);
+	for (cpu = 0; cpu < 2; cpu++) {
+		if (CPU_ISSET(cpu, &cpumask))
+			lv1_send_event_locally(sc->sc_ipi_outlet[cpu]);
+	}
 }
 
 static void

--------------040405080709010608060704--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4FCA3A04.3010702>