Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp1062757lqo; Sat, 11 May 2024 06:05:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW1wDzwxrEqiY8lXe2n9d1uwUqZ0iSOu8c+Nclhvyt9+prsrxp0Yl27K+Wl3C0RtQZfj5heu/P1y4Z0gEB5+beloEkvB8V8seq2XrFnAA== X-Google-Smtp-Source: AGHT+IFIFjOl41MGruvRq5X5Mud/K1N8l128HGq+/1mmplw53EErtTW/Cp+U97Bs5TqvDIzxyIF1 X-Received: by 2002:a17:906:4a95:b0:a5a:1df:a0b1 with SMTP id a640c23a62f3a-a5a2d536ba6mr359935266b.1.1715432704586; Sat, 11 May 2024 06:05:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715432704; cv=pass; d=google.com; s=arc-20160816; b=nJa0XKC3bdgploMdjxmqSN/Q60uG+6awdnJiU/3yonU/59hQ7qI6yIfpWag+Fa8y8a IO8BucuC9lysenghCeFTJGIgFYVeIPSJdBA9aqCFcFL2buYRbl+8Icf/XHjLwcZ/CYB0 l9kdYSGIVNV/F2eoQ8sSEgrTRQNZ4e+wwioeaVJAnDVHtFhAnc/crUKlQ16eqA8bEJog Da00dlFR6NjHLXeDwgDiPLM7ksW8CoBaeTwyi9RXNDKfIg5YbILW0RkcMms9bf4wSKyE OmjebPLRHYYF+2KsDnUeuxOakbW8SR98RTn3OxsM7cxRvjfDlH/+lTXriaawVXYbyuPc p3xw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=CrwA2vIrlWfZjdips+U6g09WGPgGGcS7uLLAmHynIVM=; fh=aFFQxwCp43BD6Fv3Gbdr57qLOfB8xAJYdfl6YwHDj2k=; b=DsytTU+5C75ywc3coiJVUCgSfoRV372gINbdSXzDfrRe5fhPJgkSUftH98NQaEaG/n fUlZD7VZhtU8euqZIvbtEScNmgCFvm6OHutGO8B47q59K34FUp0MDPOwKWxpSUB1vgrp XP8dMJIgzO7RB6dgmbZSMwbV+P+CyzW0+L/ddx9kT4yMIGU1YsmUMtoomh00cVxHrDRP Zw2C+UgHqQGSWUfD8sy0t1PgpcIN4KnhWOU/L57zOOZVt6CdfcigfuMqCK1YEMs1mXYL TQlQCNn+Hng8SGLGog2efb2OT1VVTpBRPv944lL/kugwRZbCQ4QyCzWY/7DL6gu9Z+Da 4+6w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=RcO22sk9; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-176553-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176553-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17945d2fsi309257566b.67.2024.05.11.06.05.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 May 2024 06:05:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-176553-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=RcO22sk9; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-176553-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176553-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 51A6D1F21887 for ; Sat, 11 May 2024 13:05:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DDDAF56773; Sat, 11 May 2024 13:04:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RcO22sk9" Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 53A7053368; Sat, 11 May 2024 13:04:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715432656; cv=none; b=l+6pmfykZWIrXv2vWdf2j+IdemI2hE7VOI/y+/y3LPjYh1Q+VpwBEAR9oX8N0Jp841gCnqno9cJ9tdUvWIstyctsSF4ZWdgpFFtLmegSdr+PvwdkZIXdyhGXw+SBykn22NhgGOaJApd6+LTOg70uqGkgIDGU9Kigbrv3RQDkIEo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715432656; c=relaxed/simple; bh=yxOj5YfSwj2DTCNzCutbgmJ5WuKiiT3kbxTl71R4Wu4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=UO7S1wnTqNZa4YwSwpQEwj99AB7Q0Mt4PK/Qcpj7XvJW8+Vrh7fDzrfQuVV/vv/w4xiUmN1WmKT7eT4IEbzVZBSVP3kmmY1FW0LxyfjPbAg/6sx7yHEdrZHmHZGEhqUXqTgUDqGITQoQyD4bJ/qjRjUefuCBjuUS4GK5kd9L/Js= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=RcO22sk9; arc=none smtp.client-ip=209.85.128.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-4200ee47de7so3826155e9.2; Sat, 11 May 2024 06:04:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715432653; x=1716037453; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CrwA2vIrlWfZjdips+U6g09WGPgGGcS7uLLAmHynIVM=; b=RcO22sk9GxqkwZ3rck1Uwsj9MCll4+QgD/Q15jfXjqZpDbtJ+Oepj6hTiSpBWaT/1z 75p/NOabouYwV90TrlLfxHJHqMMTBdnEDJyv38bPz3TR9Ft+VlHjNekwFlrAL2PvODgG SQ7Tq6+/v2ZyiTD0U+1fGek/xqP09XIlFo0+MS7/OcWiZtSsp0Qx3xAHrHc0ebhRByaJ JmtwnsAgbFt0KI4UWrLR+W9YDLECzNmFhg1y1uzcCkVwExPvUygI0jDPfdsrcIGR7HXQ g/jqjpBGMff+3supla9V4+1lWr17MyniwGSbQRhE6fs0U/NOvbG7wNnNU5p1vipUUIH8 f1ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715432653; x=1716037453; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CrwA2vIrlWfZjdips+U6g09WGPgGGcS7uLLAmHynIVM=; b=totQPlaEJhe5CnhhNefhXv7NjAiXfT9rbJH3Lisk8GLpvXZu8TUm0wFqQeMIAK56iu d4rvwFuDpC804/SoDYo/KHiVKnnbNYVn/KcTFdGXM8Da76UP1hNkY8gF0w1fSvr0oK+P u2d9aya2SGPeM9GQpIHJ582ZFZY6OFrSQLimyLWo/vksXUdm+9ji/4pB/pPOc/FRkmiP anzRMD3LSffZVzIkIlRvdWY6wMYFVzDoh1unGQ3KnANxn6wnTpYMurAEMQZ6New4+VQY rDTSjw/NYI//bRwPJXEFfPHJzaKMXZJu+xLX+BmMJr26pgJCDTiO7F6T6VPenb+Mrzn2 4qmA== X-Forwarded-Encrypted: i=1; AJvYcCVs6TY97YuvMdfqjkEt/mzK0VfFlH64RfUYFOq65HF6CmXWugPiVtY6OxgNsL2OGuEERs4gXGlfG9e5wTPCEV+PctZG0jmKKeWkRoKD4svmL0lCgKijhqP95xfe13EC0FkINEX7FFCp+Zv/P+mpxsDncmwHnP2Zbi/Y8TVdegGShFTMojU= X-Gm-Message-State: AOJu0YxzyYYiBVmClSx5S0D1mXgGdMGL2TV5hdVYR6Jt+BLInMehZAja wpF+NG+JUfMu9UirD4PGBmk51YLh9FiuWDZ4bhp2cBI0hHB1o3Sb X-Received: by 2002:a05:600c:4286:b0:418:fe93:22d0 with SMTP id 5b1f17b1804b1-41feaa397f7mr35465605e9.11.1715432652606; Sat, 11 May 2024 06:04:12 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-42010ca475asm15995495e9.16.2024.05.11.06.04.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 May 2024 06:04:12 -0700 (PDT) From: Christian Marangi To: Hauke Mehrtens , =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= , Thomas Bogendoerfer , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Christian Marangi , linux-mips@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Daniel=20Gonz=C3=A1lez=20Cabanelas?= , =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Subject: [PATCH v5 4/4] mips: bmips: enable RAC on BMIPS4350 Date: Sat, 11 May 2024 15:03:48 +0200 Message-ID: <20240511130349.23409-5-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240511130349.23409-1-ansuelsmth@gmail.com> References: <20240511130349.23409-1-ansuelsmth@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Daniel González Cabanelas The data RAC is left disabled by the bootloader in some SoCs, at least in the core it boots from. Enabling this feature increases the performance up to +30% depending on the task. Signed-off-by: Daniel González Cabanelas Signed-off-by: Álvaro Fernández Rojas [ rework code and reduce code duplication ] Signed-off-by: Christian Marangi Acked-by: Florian Fainelli --- arch/mips/kernel/smp-bmips.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c index 20e2fb10022d..52324738cbb3 100644 --- a/arch/mips/kernel/smp-bmips.c +++ b/arch/mips/kernel/smp-bmips.c @@ -626,6 +626,23 @@ void bmips_cpu_setup(void) __raw_readl(cbr + BMIPS_RAC_ADDRESS_RANGE); break; + case CPU_BMIPS4350: + u32 rac_addr = BMIPS_RAC_CONFIG_1; + + if (!(read_c0_brcm_cmt_local() & (1 << 31))) + rac_addr = BMIPS_RAC_CONFIG; + + /* Enable data RAC */ + cfg = __raw_readl(cbr + rac_addr); + __raw_writel(cfg | 0xf, cbr + rac_addr); + __raw_readl(cbr + rac_addr); + + /* Flush stale data out of the readahead cache */ + cfg = __raw_readl(cbr + BMIPS_RAC_CONFIG); + __raw_writel(cfg | 0x100, cbr + BMIPS_RAC_CONFIG); + __raw_readl(cbr + BMIPS_RAC_CONFIG); + break; + case CPU_BMIPS4380: /* CBG workaround for early BMIPS4380 CPUs */ switch (read_c0_prid()) { -- 2.43.0