From: Darcy Watkins <dwatkins@tranzeo.com>
To: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Cc: linuxppc-embedded@ozlabs.org
Subject: Re: PPC to PowerPC Migration
Date: Thu, 12 Jun 2008 08:58:57 -0700 [thread overview]
Message-ID: <1213286337.32716.32.camel@localhost> (raw)
In-Reply-To: <20080611135618.001db94d@zod.rchland.ibm.com>
Hello,
I am posting these patches mainly to test that my Linux email client can
handle preformat properly (without breaking the lines), but it may be of
use to anyone using 2.6.24 or 2.6.25 kernel with RT-Preemption on a 4xx
processor that has a UIC (just so I don't clutter the list with a
useless test post). This is all that was left to carry forward from
some much larger patches I received a while back for use with 2.6.23.
Use this patch with kernel 2.6.24
Index: linux-2.6.24.4/arch/powerpc/sysdev/uic.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- linux-2.6.24.4.orig/arch/powerpc/sysdev/uic.c
+++ linux-2.6.24.4/arch/powerpc/sysdev/uic.c
@@ -49,7 +49,7 @@ struct uic {
int index;
int dcrbase;
=20
- spinlock_t lock;
+ raw_spinlock_t lock;
=20
/* The remapper for this UIC */
struct irq_host *irqhost;
@@ -60,14 +60,19 @@ struct uic {
=20
static void uic_unmask_irq(unsigned int virq)
{
+ struct irq_desc *desc =3D get_irq_desc(virq);
struct uic *uic =3D get_irq_chip_data(virq);
unsigned int src =3D uic_irq_to_hw(virq);
unsigned long flags;
- u32 er;
+ u32 er, sr;
=20
+ sr =3D 1 << (31-src);
spin_lock_irqsave(&uic->lock, flags);
+ /* ack level-triggered interrupts here */
+ if (desc->status & IRQ_LEVEL)
+ mtdcr(uic->dcrbase + UIC_SR, sr);
er =3D mfdcr(uic->dcrbase + UIC_ER);
- er |=3D 1 << (31 - src);
+ er |=3D sr;
mtdcr(uic->dcrbase + UIC_ER, er);
spin_unlock_irqrestore(&uic->lock, flags);
}
@@ -99,6 +104,7 @@ static void uic_ack_irq(unsigned int vir
=20
static void uic_mask_ack_irq(unsigned int virq)
{
+ struct irq_desc *desc =3D get_irq_desc(virq);
struct uic *uic =3D get_irq_chip_data(virq);
unsigned int src =3D uic_irq_to_hw(virq);
unsigned long flags;
@@ -109,7 +115,16 @@ static void uic_mask_ack_irq(unsigned in
er =3D mfdcr(uic->dcrbase + UIC_ER);
er &=3D ~sr;
mtdcr(uic->dcrbase + UIC_ER, er);
- mtdcr(uic->dcrbase + UIC_SR, sr);
+ /* On the UIC, acking (i.e. clearing the SR bit)
+ * a level irq will have no effect if the interrupt
+ * is still asserted by the device, even if
+ * the interrupt is already masked. Therefore
+ * we only ack the egde interrupts here, while
+ * level interrupts are ack'ed after the actual
+ * isr call in the uic_unmask_irq()
+ */
+ if (!(desc->status & IRQ_LEVEL))
+ mtdcr(uic->dcrbase + UIC_SR, sr);
spin_unlock_irqrestore(&uic->lock, flags);
}
=20
@@ -173,6 +188,7 @@ static struct irq_chip uic_irq_chip =3D {
.set_type =3D uic_set_irq_type,
};
=20
+#if 0
/**
* handle_uic_irq - irq flow handler for UIC
* @irq: the interrupt number
@@ -230,6 +246,7 @@ void fastcall handle_uic_irq(unsigned in
out_unlock:
spin_unlock(&desc->lock);
}
+#endif
=20
static int uic_host_map(struct irq_host *h, unsigned int virq,
irq_hw_number_t hw)
@@ -239,7 +256,7 @@ static int uic_host_map(struct irq_host=20
set_irq_chip_data(virq, uic);
/* Despite the name, handle_level_irq() works for both level
* and edge irqs on UIC. FIXME: check this is correct */
- set_irq_chip_and_handler(virq, &uic_irq_chip, handle_uic_irq);
+ set_irq_chip_and_handler(virq, &uic_irq_chip, handle_level_irq);
=20
/* Set default irq type */
set_irq_type(virq, IRQ_TYPE_NONE);
Use this patch if using kernel 2.6.25
--- linux-2.6.25.4/arch/powerpc/sysdev/uic.c.theorig 2008-05-15 08:00:12.00=
0000000 -0700
+++ linux-2.6.25.4/arch/powerpc/sysdev/uic.c 2008-05-20 12:37:39.000000000 =
-0700
@@ -49,7 +49,7 @@ struct uic {
int index;
int dcrbase;
=20
- spinlock_t lock;
+ raw_spinlock_t lock;
=20
/* The remapper for this UIC */
struct irq_host *irqhost;
=EF=BB=BFApply the selected patch after applying the RT-Preemption patch to=
your
kernel.
In terms of upstream projects - the 2.6.25 patch should eventually make
its way up into the RT preemption project patches (if not done already
for next release) but should not go to kernel.org since I don't know how
it would affect the kernel without RT-Preemption. Why the change above
didn't make it with the rest of the changes, I don't know - perhaps the
kernel oops it solves affected only a narrow range of processors (e.g.
PPC405EP).
--=20
Regards,
Darcy
--------------
Darcy L. Watkins - Senior Software Developer
Tranzeo Wireless Technologies, Inc.
19273 Fraser Way, Pitt Meadows, BC, Canada V3Y 2V4
T:604-460-6002 ext:410
http://www.tranzeo.com
next prev parent reply other threads:[~2008-06-12 15:58 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-10 17:48 PPC to PowerPC Migration Andy Schmidt
2008-06-10 23:59 ` John Linn
2008-06-11 1:19 ` Mike Timmons
2008-06-11 13:55 ` vb
2008-06-11 14:03 ` Jon Loeliger
2008-06-11 15:33 ` vb
2008-06-11 15:45 ` Darcy Watkins
2008-06-11 16:03 ` vb
2008-06-11 16:07 ` Scott Wood
2008-06-11 14:38 ` Darcy Watkins
2008-06-11 16:32 ` Josh Boyer
2008-06-11 17:15 ` Darcy Watkins
2008-06-11 17:32 ` Josh Boyer
2008-06-11 17:52 ` Darcy Watkins
2008-06-11 17:56 ` Josh Boyer
2008-06-12 15:58 ` Darcy Watkins [this message]
2008-06-11 19:36 ` Andrew Schmidt
2008-06-12 8:14 ` Jens Wirth
2008-06-12 16:02 ` Grant Likely
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1213286337.32716.32.camel@localhost \
--to=dwatkins@tranzeo.com \
--cc=jwboyer@linux.vnet.ibm.com \
--cc=linuxppc-embedded@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).