Received: by 10.223.164.202 with SMTP id h10csp680301wrb; Mon, 6 Nov 2017 13:34:02 -0800 (PST) X-Google-Smtp-Source: ABhQp+S/8FtHr+Oh3C4rbT+QiAn/RRSot5HTsxUeXlZDVL8P8LzSjrS2Npv+OA8wm79/YXkPDD8w X-Received: by 10.84.132.98 with SMTP id 89mr15744342ple.98.1510004042129; Mon, 06 Nov 2017 13:34:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510004042; cv=none; d=google.com; s=arc-20160816; b=BeIiZz6tEo6X6rqrtHdg/nYnewfUCc5jq9PRz3/gsj3c6BE2xLLGsd3Bd/kccNb/oy BpNEgBelyNYfL+6I7ZQcQMDG0qWa2TwA4x56dcyp0LzVcYMG9k5ipN0cV5ZilDl5LHcp cXrbH8SOGAZ1PjscgaV5kPjs1OM6cJ3BIlRNZTljDgZEAAvw0XhPuT6wuVl5j1a5nNQ7 LFSqaP2Q0JyEjH2iK78ulXqJYTKI8Jwxonu1/uhFqOW0c0rNk4s7B+Blt1WihUUG/in9 WUhgy1rxgGJJj8PDQ1pGUXQLjt1ve7KpX47vRZoLZO4Ky6kMjJyAoiWJcYs0ovOfug5Q +AfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:arc-authentication-results; bh=Z5uQknlxayC4J7KsWZg83IDdROwouWPQ4WpGnjhxMy4=; b=Oo678HSBX1GlFC4k8uuua30e1srbq3c/LsSofrAe3LeLu1iMED087GE6St2ebXCIvF +qicNM/kzQ1biDYwyHr7p5wimPNfzpIINIvs6D9ljECeNznBTo0+iNZszWoHqinb3Q7s e7HvADX9MFNgdBIgY6ewhaVs/Q+6TgqTuuDLqtoxcCrZWa6z0e9cCP5PiJKbvDD0fQ1M BO9AyjC2pJPWS+ymoqeXjFigTMJCCrRLgea2xsobnCjWhSZId9rQ5ZsWBExAMkVdvor+ 7ibBS5RRbrh1v5cYe6dz49vTdiZkWFLvtMPIylPKd//7TxEFAHdSuVj5GEp+tkXquXm8 ql2Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 32si11012853plg.399.2017.11.06.13.33.46; Mon, 06 Nov 2017 13:34:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933178AbdKFTbD (ORCPT + 95 others); Mon, 6 Nov 2017 14:31:03 -0500 Received: from us01smtprelay-2.synopsys.com ([198.182.60.111]:54942 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752058AbdKFTbC (ORCPT ); Mon, 6 Nov 2017 14:31:02 -0500 Received: from mailhost.synopsys.com (mailhost1.synopsys.com [10.12.238.239]) by smtprelay.synopsys.com (Postfix) with ESMTP id 7785910C173F; Mon, 6 Nov 2017 11:31:01 -0800 (PST) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 5CE0193D; Mon, 6 Nov 2017 11:31:01 -0800 (PST) Received: from US01WXQAHTC1.internal.synopsys.com (us01wxqahtc1.internal.synopsys.com [10.12.238.230]) by mailhost.synopsys.com (Postfix) with ESMTP id 5028093B; Mon, 6 Nov 2017 11:31:01 -0800 (PST) Received: from IN01WEHTCA.internal.synopsys.com (10.144.199.104) by US01WXQAHTC1.internal.synopsys.com (10.12.238.230) with Microsoft SMTP Server (TLS) id 14.3.266.1; Mon, 6 Nov 2017 11:31:01 -0800 Received: from IN01WEHTCB.internal.synopsys.com (10.144.199.105) by IN01WEHTCA.internal.synopsys.com (10.144.199.103) with Microsoft SMTP Server (TLS) id 14.3.266.1; Tue, 7 Nov 2017 01:01:00 +0530 Received: from vineetg-Latitude-E7450.internal.synopsys.com (10.10.161.69) by IN01WEHTCB.internal.synopsys.com (10.144.199.243) with Microsoft SMTP Server (TLS) id 14.3.266.1; Tue, 7 Nov 2017 01:01:00 +0530 From: Vineet Gupta To: CC: , Vineet Gupta Subject: [PATCH] ARCv2: Accomodate NS48 MMUv5 by releaxing MMU ver checking Date: Mon, 6 Nov 2017 11:30:51 -0800 Message-ID: <1509996651-7174-1-git-send-email-vgupta@synopsys.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.10.161.69] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org HS48 cpus will have a new MMUv5, although Linux is currently not explicitly supporting the newer features (so remains at V4). The existing software/hardware version check is very tight and causes boot abort. Given that the MMUv5 hardware is backwards compatible, relax the boot check to allow current kernel support level to work with new hardware. Also while at it, move the ancient MMU related code to under ARCompact builds as baseline MMU for HS cpus is v4. Signed-off-by: Vineet Gupta --- arch/arc/mm/tlb.c | 57 ++++++++++++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/arch/arc/mm/tlb.c b/arch/arc/mm/tlb.c index 8ceefbf72fb0..4097764fea23 100644 --- a/arch/arc/mm/tlb.c +++ b/arch/arc/mm/tlb.c @@ -762,21 +762,23 @@ void read_decode_mmu_bcr(void) tmp = read_aux_reg(ARC_REG_MMU_BCR); mmu->ver = (tmp >> 24); - if (mmu->ver <= 2) { - mmu2 = (struct bcr_mmu_1_2 *)&tmp; - mmu->pg_sz_k = TO_KB(0x2000); - mmu->sets = 1 << mmu2->sets; - mmu->ways = 1 << mmu2->ways; - mmu->u_dtlb = mmu2->u_dtlb; - mmu->u_itlb = mmu2->u_itlb; - } else if (mmu->ver == 3) { - mmu3 = (struct bcr_mmu_3 *)&tmp; - mmu->pg_sz_k = 1 << (mmu3->pg_sz - 1); - mmu->sets = 1 << mmu3->sets; - mmu->ways = 1 << mmu3->ways; - mmu->u_dtlb = mmu3->u_dtlb; - mmu->u_itlb = mmu3->u_itlb; - mmu->sasid = mmu3->sasid; + if (is_isa_arcompact()) { + if (mmu->ver <= 2) { + mmu2 = (struct bcr_mmu_1_2 *)&tmp; + mmu->pg_sz_k = TO_KB(0x2000); + mmu->sets = 1 << mmu2->sets; + mmu->ways = 1 << mmu2->ways; + mmu->u_dtlb = mmu2->u_dtlb; + mmu->u_itlb = mmu2->u_itlb; + } else { + mmu3 = (struct bcr_mmu_3 *)&tmp; + mmu->pg_sz_k = 1 << (mmu3->pg_sz - 1); + mmu->sets = 1 << mmu3->sets; + mmu->ways = 1 << mmu3->ways; + mmu->u_dtlb = mmu3->u_dtlb; + mmu->u_itlb = mmu3->u_itlb; + mmu->sasid = mmu3->sasid; + } } else { mmu4 = (struct bcr_mmu_4 *)&tmp; mmu->pg_sz_k = 1 << (mmu4->sz0 - 1); @@ -818,8 +820,9 @@ int pae40_exist_but_not_enab(void) void arc_mmu_init(void) { - char str[256]; struct cpuinfo_arc_mmu *mmu = &cpuinfo_arc700[smp_processor_id()].mmu; + char str[256]; + int compat = 0; pr_info("%s", arc_mmu_mumbojumbo(0, str, sizeof(str))); @@ -834,15 +837,21 @@ void arc_mmu_init(void) */ BUILD_BUG_ON(!IS_ALIGNED(STACK_TOP, PMD_SIZE)); - /* For efficiency sake, kernel is compile time built for a MMU ver - * This must match the hardware it is running on. - * Linux built for MMU V2, if run on MMU V1 will break down because V1 - * hardware doesn't understand cmds such as WriteNI, or IVUTLB - * On the other hand, Linux built for V1 if run on MMU V2 will do - * un-needed workarounds to prevent memcpy thrashing. - * Similarly MMU V3 has new features which won't work on older MMU + /* + * Ensure that MMU features assumed by kernel exist in hardware. + * For older ARC700 cpus, it has to be exact match, since the MMU + * revisions were not backwards compatible (MMUv3 TLB layout changed + * so even if kernel for v2 didn't use any new cmds of v3, it would + * still not work. + * For HS cpus, MMUv4 was baseline and v5 is backwards compatible + * (will run older software). */ - if (mmu->ver != CONFIG_ARC_MMU_VER) { + if (is_isa_arcompact() && mmu->ver == CONFIG_ARC_MMU_VER) + compat = 1; + else if (is_isa_arcv2() && mmu->ver >= CONFIG_ARC_MMU_VER) + compat = 1; + + if (!compat) { panic("MMU ver %d doesn't match kernel built for %d...\n", mmu->ver, CONFIG_ARC_MMU_VER); } -- 2.7.4 From 1585308307995051092@xxx Tue Nov 28 11:16:56 +0000 2017 X-GM-THRID: 1585304964605808180 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread