From patchwork Tue Apr 20 21:31:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kanigeri, Hari" X-Patchwork-Id: 93739 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o3KLVjNW014164 for ; Tue, 20 Apr 2010 21:31:45 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755445Ab0DTVbo (ORCPT ); Tue, 20 Apr 2010 17:31:44 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:51118 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755379Ab0DTVbo (ORCPT ); Tue, 20 Apr 2010 17:31:44 -0400 Received: from dlep33.itg.ti.com ([157.170.170.112]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id o3KLVaOM004187 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 20 Apr 2010 16:31:36 -0500 Received: from dlep26.itg.ti.com (localhost [127.0.0.1]) by dlep33.itg.ti.com (8.13.7/8.13.7) with ESMTP id o3KLVZKf026692; Tue, 20 Apr 2010 16:31:35 -0500 (CDT) Received: from dsbe71.ent.ti.com (localhost [127.0.0.1]) by dlep26.itg.ti.com (8.13.8/8.13.8) with ESMTP id o3KLVZBN005757; Tue, 20 Apr 2010 16:31:35 -0500 (CDT) Received: from dlee03.ent.ti.com ([157.170.170.18]) by dsbe71.ent.ti.com ([156.117.232.23]) with mapi; Tue, 20 Apr 2010 16:31:35 -0500 From: "Kanigeri, Hari" To: "linux-omap@vger.kernel.org" CC: "Shilimkar, Santosh" , Felipe Contreras , Hiroshi DOYU , "tony@atomide.com" Date: Tue, 20 Apr 2010 16:31:34 -0500 Subject: [PATCH 3/3][v2] OMAP:iommu- add TLB preservation support Thread-Topic: [PATCH 3/3][v2] OMAP:iommu- add TLB preservation support Thread-Index: Acrg0NntWc05tiRsQFe7lhX/Akkz4Q== Message-ID: <8F7AF80515AF0D4D93307E594F3CB40E4B3445EB@dlee03.ent.ti.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 20 Apr 2010 21:31:46 +0000 (UTC) diff --git a/arch/arm/mach-omap2/iommu2.c b/arch/arm/mach-omap2/iommu2.c index f01f985..5ce76e4 100644 --- a/arch/arm/mach-omap2/iommu2.c +++ b/arch/arm/mach-omap2/iommu2.c @@ -146,6 +146,7 @@ static u32 omap2_iommu_fault_isr(struct iommu *obj, u32 *ra) printk("\n"); iommu_write_reg(obj, stat, MMU_IRQSTATUS); + omap2_iommu_disable(obj); return stat; } @@ -211,7 +212,8 @@ static ssize_t omap2_dump_cr(struct iommu *obj, struct cr_regs *cr, char *buf) char *p = buf; /* FIXME: Need more detail analysis of cam/ram */ - p += sprintf(p, "%08x %08x\n", cr->cam, cr->ram); + p += sprintf(p, "%08x %08x %01x\n", cr->cam, cr->ram, + (cr->cam & MMU_CAM_P) ? 1 : 0); return p - buf; } diff --git a/arch/arm/plat-omap/iommu.c b/arch/arm/plat-omap/iommu.c index 463d638..a1d4ccf 100644 --- a/arch/arm/plat-omap/iommu.c +++ b/arch/arm/plat-omap/iommu.c @@ -171,15 +171,12 @@ static void iotlb_lock_get(struct iommu *obj, struct iotlb_lock *l) l->base = MMU_LOCK_BASE(val); l->vict = MMU_LOCK_VICT(val); - BUG_ON(l->base != 0); /* Currently no preservation is used */ } static void iotlb_lock_set(struct iommu *obj, struct iotlb_lock *l) { u32 val; - BUG_ON(l->base != 0); /* Currently no preservation is used */ - val = (l->base << MMU_LOCK_BASE_SHIFT); val |= (l->vict << MMU_LOCK_VICT_SHIFT); @@ -241,6 +238,11 @@ int load_iotlb_entry(struct iommu *obj, struct iotlb_entry *e) break; } + if (l.base == obj->nr_tlb_entries) { + dev_dbg(obj->dev, "%s: preserve entries full\n", __func__); + err = -EBUSY; + goto out; + } if (i == obj->nr_tlb_entries) { dev_dbg(obj->dev, "%s: full: no entry\n", __func__); err = -EBUSY; @@ -256,9 +258,11 @@ int load_iotlb_entry(struct iommu *obj, struct iotlb_entry *e) iotlb_load_cr(obj, cr); kfree(cr); + if (e->prsvd) + l.base++; /* increment victim for next tlb load */ if (++l.vict == obj->nr_tlb_entries) - l.vict = 0; + l.vict = l.base; iotlb_lock_set(obj, &l); out: clk_disable(obj->clk);