Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10417970ybi; Wed, 24 Jul 2019 22:52:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqxvPh2GZG361czF8w2l7Ah+Irko5zGoOYRW9XzSZ3kMre3pZ6i0lZDTnPD1yx3b7vZ3Ms8h X-Received: by 2002:a65:64c6:: with SMTP id t6mr86339257pgv.323.1564033920151; Wed, 24 Jul 2019 22:52:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564033920; cv=none; d=google.com; s=arc-20160816; b=r2/HQnkV5hYF9WhVCgEtviL6wkqo0h6pgl5ivZ/eYrBWBdBFtuoJ6/z/GOiacXxsZd TfqLPZLMCCKwkQeQbs3n3PGJ1bRZOXcrkMKckw1GWvdT9K/umFO73hKa/66KqQ3k5L28 wLDY+tTWArgcN9JHlfecB3vzSN9ziR1kQnQ0LOeUYTPXXvhTGUfsRws0Z/7PA+baEjZu r3t9opEgI6FeovLeqMsY+dq9AKdBZ0xy51TVmi3sJ4XhnpOODwirV6KGWwXtHkEf4Aln a8eTak9sKqF9h+FkO/zhX6QYK3bh66G5aJ9Y8DJUiqW5A9MCT0gktAgP4477vH8Z2YOG ALXg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=ZClIlxQHDoZwcWywOLbFHID80yVsfDEESlYYD3vTm1A=; b=jZLPQXG71zkbdu8Ht4ouqmM/EG81+U2MXTIwKn7FqRq89jelae37etPINCII4EUKJp QQ1MBCPcwM1nigF+b6w4uB7D6/L6n2G1mWLl0+HMJEAb2RNvULF2g4tM9KzWzWo7LuBU YXX13HYLCgpb3ktj7EJX9yRcAlBBNv2N6xJcIOPgcv6SapfeXWNUU+3Z31rDeMMDTp35 fzjZ6xKOo1itVJZmUS/sD2cBezBZ7Hldn6aN4MpIHq3VEZu4yIvzP+9k3CXYLI6kQlH1 bq42GQiEcn5pqPFm3e+M0RKVjMFDuYG2ru+8LHIDKs6eDftLUmHpUL2dGHoZp44SBeI0 /Tcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@crapouillou.net header.s=mail header.b=ApP73zZi; 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=crapouillou.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i6si16867236pfb.122.2019.07.24.22.51.45; Wed, 24 Jul 2019 22:52:00 -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=fail header.i=@crapouillou.net header.s=mail header.b=ApP73zZi; 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=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388436AbfGXXrI (ORCPT + 99 others); Wed, 24 Jul 2019 19:47:08 -0400 Received: from outils.crapouillou.net ([89.234.176.41]:37232 "EHLO crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726431AbfGXXrH (ORCPT ); Wed, 24 Jul 2019 19:47:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1564012025; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references; bh=ZClIlxQHDoZwcWywOLbFHID80yVsfDEESlYYD3vTm1A=; b=ApP73zZikTLAiqk3L+2+k7tcfe7Oy0F93dpanKKpYQ9eOIf1BFR2c8T6TK8xLY5ii8SHC2 jqsL07t2ynNn55vpEnHLP7fbCQ/u5bbSxzPYH2u+dT0emt82vFieQOzYWVzhirGtdIHpiP cRQs2hfAfpQFUvnuO22kwHJC8/VzQ3Q= From: Paul Cercueil To: Ralf Baechle , Paul Burton , James Hogan Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, od@zcrc.me, Paul Cercueil Subject: [PATCH] MIPS: Add support for partial kernel mode on Xburst CPUs Date: Wed, 24 Jul 2019 19:46:54 -0400 Message-Id: <20190724234654.16555-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Support partial kernel mode of Xburst CPUs found in Ingenic SoCs. Partial kernel mode means the userspace applications have access to the TCSM0 banks of the VPU, and can execute cache instructions. Signed-off-by: Paul Cercueil --- arch/mips/Kconfig | 7 +++++++ arch/mips/include/asm/mipsregs.h | 1 + arch/mips/kernel/cpu-probe.c | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index ac9ed08a7fff..02831908d676 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -2986,6 +2986,13 @@ config MIPS_O32_FP64_SUPPORT If unsure, say N. +config MIPS_XBURST_PARTIAL_KERNEL_MODE + bool "Partial kernel mode for Xburst CPUs" if MACH_INGENIC + help + Support partial kernel mode of Xburst CPUs found in Ingenic SoCs. + Partial kernel mode means the userspace applications have access to + the TCSM0 banks of the VPU, and can execute cache instructions. + config USE_OF bool select OF diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h index 1e6966e8527e..01e0fcb1d4c2 100644 --- a/arch/mips/include/asm/mipsregs.h +++ b/arch/mips/include/asm/mipsregs.h @@ -2813,6 +2813,7 @@ __BUILD_SET_C0(status) __BUILD_SET_C0(cause) __BUILD_SET_C0(config) __BUILD_SET_C0(config5) +__BUILD_SET_C0(config7) __BUILD_SET_C0(intcontrol) __BUILD_SET_C0(intctl) __BUILD_SET_C0(srsmap) diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c index a9c82338396a..fd275f37cb7c 100644 --- a/arch/mips/kernel/cpu-probe.c +++ b/arch/mips/kernel/cpu-probe.c @@ -1985,6 +1985,10 @@ static inline void cpu_probe_ingenic(struct cpuinfo_mips *c, unsigned int cpu) */ if ((c->processor_id & PRID_COMP_MASK) == PRID_COMP_INGENIC_D0) c->isa_level &= ~MIPS_CPU_ISA_M32R2; + + /* config7 bit 6 controls the "partial kernel mode" */ + if (IS_ENABLED(CONFIG_MIPS_XBURST_PARTIAL_KERNEL_MODE)) + set_c0_config7(BIT(6)); } static inline void cpu_probe_netlogic(struct cpuinfo_mips *c, int cpu) -- 2.21.0.593.g511ec345e18