Re: [PATCH v3 2/2] OMAP: IOMMU: add support to callback during fault handling

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

 



On Mon, Feb 21, 2011 at 10:22 AM, Felipe Balbi <balbi@xxxxxx> wrote:
> Hi,
>
> On Mon, Feb 21, 2011 at 10:18:56AM +0200, Hiroshi DOYU wrote:
>> From: David Cohen <dacohen@xxxxxxxxx>
>> Subject: [PATCH v3 2/2] OMAP: IOMMU: add support to callback during fault handling
>> Date: Wed, 16 Feb 2011 21:35:51 +0200
>>
>> > Add support to register an isr for IOMMU fault situations and adapt it
>> > to allow such (*isr)() to be used as fault callback. Drivers using IOMMU
>> > module might want to be informed when errors happen in order to debug it
>> > or react.
>> >
>> > Signed-off-by: David Cohen <dacohen@xxxxxxxxx>
>> > ---
>> > Âarch/arm/mach-omap2/iommu2.c      Â|  17 +++++++++-
>> > Âarch/arm/plat-omap/include/plat/iommu.h | Â 14 ++++++++-
>> > Âarch/arm/plat-omap/iommu.c       Â|  52 ++++++++++++++++++++++---------
>> > Â3 files changed, 65 insertions(+), 18 deletions(-)
>> >
>> > diff --git a/arch/arm/mach-omap2/iommu2.c b/arch/arm/mach-omap2/iommu2.c
>> > index 49a1e5e..adb083e 100644
>> > --- a/arch/arm/mach-omap2/iommu2.c
>> > +++ b/arch/arm/mach-omap2/iommu2.c
>> > @@ -146,18 +146,31 @@ static void omap2_iommu_set_twl(struct iommu *obj, bool on)
>> > Âstatic u32 omap2_iommu_fault_isr(struct iommu *obj, u32 *ra)
>> > Â{
>> > Â Â u32 stat, da;
>> > + Â u32 errs = 0;
>> >
>> > Â Â stat = iommu_read_reg(obj, MMU_IRQSTATUS);
>> > Â Â stat &= MMU_IRQ_MASK;
>> > - Â if (!stat)
>> > + Â if (!stat) {
>> > + Â Â Â Â Â *ra = 0;
>> > Â Â Â Â Â Â return 0;
>> > + Â }
>> >
>> > Â Â da = iommu_read_reg(obj, MMU_FAULT_AD);
>> > Â Â *ra = da;
>> >
>> > + Â if (stat & MMU_IRQ_TLBMISS)
>> > + Â Â Â Â Â errs |= OMAP_IOMMU_ERR_TLB_MISS;
>> > + Â if (stat & MMU_IRQ_TRANSLATIONFAULT)
>> > + Â Â Â Â Â errs |= OMAP_IOMMU_ERR_TRANS_FAULT;
>> > + Â if (stat & MMU_IRQ_EMUMISS)
>> > + Â Â Â Â Â errs |= OMAP_IOMMU_ERR_EMU_MISS;
>> > + Â if (stat & MMU_IRQ_TABLEWALKFAULT)
>> > + Â Â Â Â Â errs |= OMAP_IOMMU_ERR_TBLWALK_FAULT;
>> > + Â if (stat & MMU_IRQ_MULTIHITFAULT)
>> > + Â Â Â Â Â errs |= OMAP_IOMMU_ERR_MULTIHIT_FAULT;
>> > Â Â iommu_write_reg(obj, stat, MMU_IRQSTATUS);
>> >
>> > - Â return stat;
>> > + Â return errs;
>> > Â}
>> >
>> > Âstatic void omap2_tlb_read_cr(struct iommu *obj, struct cr_regs *cr)
>> > diff --git a/arch/arm/plat-omap/include/plat/iommu.h b/arch/arm/plat-omap/include/plat/iommu.h
>> > index 19cbb5e..174f1b9 100644
>> > --- a/arch/arm/plat-omap/include/plat/iommu.h
>> > +++ b/arch/arm/plat-omap/include/plat/iommu.h
>> > @@ -31,6 +31,7 @@ struct iommu {
>> >   struct clk   Â*clk;
>> >   void __iomem  Â*regbase;
>> >   struct device  *dev;
>> > +  void      Â*isr_priv;
>>
>> Ideally I'd like to avoid having "isr_priv" in iommu since it's not
>> used for iommu but client needs the place to pass its info to its
>> custom handler. Any better idea?
>
> I'm not sure if it makes sense as I don't know the mailbox block, but
> maybe moving to GENIRQ ? Then IRQ subsystem would take care of the
> "dev_id"

Not sure if it fits in this case. It's a different module (IOMMU user)
which needs to get a callback from IOMMU when a fault happens.
Is there any GENIRQ usage currently in this scenario?

Br,

David

>
> --
> balbi
>
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux