Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp3232149imc; Wed, 13 Mar 2019 12:14:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqwoHeZZEcRMWF8JkDwuA7MDoIH1TZ+O+ZpwoYu2j585s4rYOA6lhmXnfTHatnuDjlnhsyCW X-Received: by 2002:a65:47ca:: with SMTP id f10mr41449105pgs.124.1552504489891; Wed, 13 Mar 2019 12:14:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552504489; cv=none; d=google.com; s=arc-20160816; b=mh6EnO5vdJdUFSDuMwY73FF9xhXY/hALW8f4K/ot72zL5lTezGo/CvtBH28KKutyVx lY1PtrogJ5PX5WOZoytGWVckRv+24vIH/p8XOelZ9JeBsYXUmcVm8PvBzL+dDQbUCGGu RRrC8U4JnritANHzBb8WTRCXAPBbEsYpJNkQTJ/vepmh6UoXPLNqsJyEi7BIqed59FKX wniQWQpDRrO6CUIfnlu6N6TMgyrddNMBQk1UVYWMQzqR6fbHNjw1hY0UPOStvcIBBcOF ILJUkLdkkh3kmuL1IsENFRGs482iEk/5u6q70JFkb4aRHDx2ukNQmwMbOOo8n7RYFHtV M4Pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vBqWxdhAro+t4HmgXokiNh+vM6aI3ymOM8W3C6b52s0=; b=F5AsvxtjK6K+wE05WpuVDSGpbg/qDhLLFvlsZUuI7zBouJacamcM0uQsL4tAK0Q1F7 N7FZ5wufgKQVKkQSTuz8x26hS17qWVpyG+G2hgrgFJZ2mubnTZfxxvVh72XR6cEluxAE Ms44sXe2xuX0bJoWc6UUt27i6T9CyFunQwWlXDJa1rHQ7ocxwEgf287Wu4jZu0Rx6gsD S1YYrSRJtHUfi2I5jioRCIBhwlzn8vuV24eG/yFa2J8cH8RlnuwewPE6BvN2OveOj5Fc whJyRi0ZDZF1eORmMd4jn3W5W9i10Y44TUHi70G6DNRbK5pCeTV63QjXK7ciwMH+k7z/ PTGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=W0bya6Nb; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z88si11361008pfl.65.2019.03.13.12.14.34; Wed, 13 Mar 2019 12:14:49 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=W0bya6Nb; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727694AbfCMTMW (ORCPT + 99 others); Wed, 13 Mar 2019 15:12:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:42934 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727177AbfCMTMV (ORCPT ); Wed, 13 Mar 2019 15:12:21 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2078620693; Wed, 13 Mar 2019 19:12:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1552504340; bh=nq9Bko9S1CKLAk3t+egy2xB9qjrwqSKS65N9awoqub4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W0bya6NbGbmo2Gd9nIiK6AHoz01maSGlsXqEqph1s2i5r/N1KJcynBqBXmTFyucaa H71NNca/VeLiJy2xSGewT5TuCDNOObNOdMdJMYMAsjAgxUEQtJmmCdxlb14o3/diJ/ 2kYZREGZuCRbh7Aj1aQHNmx9hujdsxoIyqzK5YBw= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Vineet Gupta , Sasha Levin , linux-snps-arc@lists.infradead.org Subject: [PATCH AUTOSEL 4.20 48/60] ARCv2: don't assume core 0x54 has dual issue Date: Wed, 13 Mar 2019 15:10:09 -0400 Message-Id: <20190313191021.158171-48-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190313191021.158171-1-sashal@kernel.org> References: <20190313191021.158171-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vineet Gupta [ Upstream commit 7b2e932f633bcb7b190fc7031ce6dac75f8c3472 ] The first release of core4 (0x54) was dual issue only (HS4x). Newer releases allow hardware to be configured as single issue (HS3x) or dual issue. Prevent accessing a HS4x only aux register in HS3x, which otherwise leads to illegal instruction exceptions Signed-off-by: Vineet Gupta Signed-off-by: Sasha Levin --- arch/arc/include/asm/arcregs.h | 8 ++++++++ arch/arc/kernel/setup.c | 26 +++++++++++++++++++++----- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/arch/arc/include/asm/arcregs.h b/arch/arc/include/asm/arcregs.h index 49bfbd879caa..bdbdaef902eb 100644 --- a/arch/arc/include/asm/arcregs.h +++ b/arch/arc/include/asm/arcregs.h @@ -151,6 +151,14 @@ struct bcr_isa_arcv2 { #endif }; +struct bcr_uarch_build_arcv2 { +#ifdef CONFIG_CPU_BIG_ENDIAN + unsigned int pad:8, prod:8, maj:8, min:8; +#else + unsigned int min:8, maj:8, prod:8, pad:8; +#endif +}; + struct bcr_mpy { #ifdef CONFIG_CPU_BIG_ENDIAN unsigned int pad:8, x1616:8, dsp:4, cycles:2, type:2, ver:8; diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c index 80dd1a716ca7..184a5d1bf28d 100644 --- a/arch/arc/kernel/setup.c +++ b/arch/arc/kernel/setup.c @@ -196,13 +196,29 @@ static void read_arc_build_cfg_regs(void) cpu->bpu.num_pred = 2048 << bpu.pte; if (cpu->core.family >= 0x54) { - unsigned int exec_ctrl; - READ_BCR(AUX_EXEC_CTRL, exec_ctrl); - cpu->extn.dual_enb = !(exec_ctrl & 1); + struct bcr_uarch_build_arcv2 uarch; - /* dual issue always present for this core */ - cpu->extn.dual = 1; + /* + * The first 0x54 core (uarch maj:min 0:1 or 0:2) was + * dual issue only (HS4x). But next uarch rev (1:0) + * allows it be configured for single issue (HS3x) + * Ensure we fiddle with dual issue only on HS4x + */ + READ_BCR(ARC_REG_MICRO_ARCH_BCR, uarch); + + if (uarch.prod == 4) { + unsigned int exec_ctrl; + + /* dual issue hardware always present */ + cpu->extn.dual = 1; + + READ_BCR(AUX_EXEC_CTRL, exec_ctrl); + + /* dual issue hardware enabled ? */ + cpu->extn.dual_enb = !(exec_ctrl & 1); + + } } } -- 2.19.1