Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp101553lqo; Thu, 9 May 2024 14:02:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVp516M8N9/0XQi1iHSbVQH7CqCfYIdCk9etwnkb27qauaU0LjXHhXpSgF8iwilDaZkoy2qD+P/ephiJIjtIsJ17o9ClXqxtmcG0TraFQ== X-Google-Smtp-Source: AGHT+IEnwbsDVS3ZcV5MqGI8HplvZplY+qPT+g/XRBR5TFkk9eYEb8BJJrpTrHSQRe9RH3+hbTyI X-Received: by 2002:a05:6358:33a5:b0:183:fb08:7fcf with SMTP id e5c5f4694b2df-193baee5995mr79576855d.7.1715288532789; Thu, 09 May 2024 14:02:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715288532; cv=pass; d=google.com; s=arc-20160816; b=MQaHFM9cNIQv5OnLX2dGxTqk7vVmsiPo4sZP1+nucE80j/chUvk9fTMzHj8NtfCBuP JMO27ULS0z1pOP/nPmP9B/jvj8VbDEA6MnO713cjCK3iRcc0eFbAKzS6rcJGvWztWnF/ 8qdAdHbiVlbbrrzxR0TG/5uj9CVHdz3ziANZK6YYtdunWA8WCnfETKWWd3XMw2OuWl4U 1jIfoocAwagR2aLGgGAP4lJHKPIm3zSppFf7/2jztoT2In/NLSR5R0cLJwfa4QSkEpj8 I4ntCTKjQjcDEZS6kRlzGv4OM1nieLPuz/qD/I6YI0JaJxBNP3w0YxqFeazkiBYUYF4b ENhA== 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=E2+dfK9Nu664e2MfBtbLS/hECslf24cHjexymTvboPQ=; b=l1/lPn5B1ozVgrvsHqx+eAEW6s4CwcJfNBkoxoYfgmY3BwFsNzk7sNYMkq6XDT8uhc ptALPFrNGt6k1iCQt+L7/KUD/v9e/Cahk60Q+2idJ4v6B4HO7/roZfgBJzBTXTOPPr/C wYX7ZITNtHfujZxH9deLY/4n+jsSYxVkXUCstS/KVGDrINT5ftcYS+bjwF6CZ9INpWXP AdDzBnMBOLwhqm/p6IcBXf8bfuE9NHZecUjk95oXz6FKRwpquYk4DPjKScLR4v7i08ww E/kzjcACFGrPa0naDNJe5ErMoibZC1Oe4onY93OVNcBRZn9l1fxZfQ1DJ5IDP6nwaesG ziXA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=iUNKQap1; 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-174952-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-174952-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 41be03b00d2f7-6341404f9b0si2007491a12.873.2024.05.09.14.02.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 May 2024 14:02:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-174952-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=iUNKQap1; 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-174952-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-174952-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 5F24FB2464D for ; Thu, 9 May 2024 20:49:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CA1368626A; Thu, 9 May 2024 20:48:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="iUNKQap1" Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (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 399F085264; Thu, 9 May 2024 20:48:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715287690; cv=none; b=p9aFaPiiA7mhdcxa3TSPR1oflFa8TmqwbUhy1AiUNc8n+JQ4IMNQOZ7OY0WdWgR7yD/I51lpnAEmGuBkr5Lehf2gc7L+EQ/mKMylRfd0kZ9/luUSDcVLafCjfpTw8IU8chYoNx7DNvzNXW52kjK5N1sv/FUnCgxvrpSzfxJairE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715287690; c=relaxed/simple; bh=yxOj5YfSwj2DTCNzCutbgmJ5WuKiiT3kbxTl71R4Wu4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=nbzrkwahbbCQa5RFCY3DbLyL1hEdH61vVRiAJB/JwPLVkCZL7E8/Wfbw40JYpfEoZAfPWnQTYTbbt8J7oQFkeSAZTX4Q6cbIsRzqshhdIj3bxIUhhvDKxfnzbIPXNOPfIZhkevwjZJDKhJRqmQSa1WXXWXKqVqU908pZ5/ZuFTA= 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=iUNKQap1; arc=none smtp.client-ip=209.85.221.50 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-wr1-f50.google.com with SMTP id ffacd0b85a97d-3504f34a086so124023f8f.1; Thu, 09 May 2024 13:48:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715287687; x=1715892487; 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=iUNKQap1Aa10dPNN79LVaKNnBoCMrqCSaSYgREGfufDqrRxbZUrn9SjGGpDd+OJmuy LrO+Pviiw+XBFXuvH7L02gt4OnNyUwfVbNrGzkfYJddp1HvutmqjpegdK+Eau0/CNE1W CrRPsy5WS3zEdLbsXd4eNaT1pU+I9mWG3yEdrMjmcgoHbypaktDNfq7kjmOzKuRWyNPa 1JGXABMjzMEdPeSpsliCV2DuZlAeBwL8hILY+dfhRb5x84vZVfDTK7nkhVtTjCn8ExgD +n9gJhCbOQIMXxKno6mamXsubRHJtoyHTRKra14UEPq9upQiEmAzHj29VS/GH2GuxbmQ IElw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715287687; x=1715892487; 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=aWvrUmGHUhNLHMMPNOrE9bNq5B3tYUf8tyvYzUXnSdZYOMhec0/b/iviD6nY68QVWV 6Mk/jNO7BRtyih3Sv0ECEu9GTF9Qb4DPCimIZXQk9T0AeLiwfanY/tzD348dI9aPQaMX qMLxqK8KHemwjXmTToRMd9CZevdOopFrOobCC3mPk5KqzZEuBnIvbzqoWpZLTLMd30q4 gts0+xAFJo5CwRDDo+2gop98t/O7yeNQAa6Y+Nor112vyp0GXt7vzdmuYJcJ37LQp2tu vAqAhRZJPqxOf2IeY0Wp5Rpdj2drBqJTdn7AZ4QQS2/jvx0uhETK3o0mHFhPwmVcQakt dM1A== X-Forwarded-Encrypted: i=1; AJvYcCXdbe+QQcS9s+dyJE4gclTuIViVoVA9Man3VK49ZnsvtjsBT+C2H5BVGuK9C9zDk1Vlw9zhTZ3YaUuHTBzGc4lipJnwfUX9FUSwFGgJIvHXPwRIPd7BtMIM0f02hG/ZhPtfLJMPUC/47magDJTzdg7DUXw7Vl4ywsN6afLPyEBqY2YyYpg= X-Gm-Message-State: AOJu0Yzd0FK0WkL7qCvNWRtqrkdJ7IRzxcCwKQmW8hocqV9NRt549qmL RU62s2ZSBEfijuGKdxt38YXicNaLpdl72Z/DfjHY0FHcg4DANkwX X-Received: by 2002:adf:eb12:0:b0:347:9bec:9ba3 with SMTP id ffacd0b85a97d-3504aa64997mr464045f8f.66.1715287687547; Thu, 09 May 2024 13:48:07 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-3502bbbbf08sm2588185f8f.96.2024.05.09.13.48.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 May 2024 13:48:07 -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 v4 4/4] mips: bmips: enable RAC on BMIPS4350 Date: Thu, 9 May 2024 22:47:48 +0200 Message-ID: <20240509204750.1538-5-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240509204750.1538-1-ansuelsmth@gmail.com> References: <20240509204750.1538-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