Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp640015lqo; Wed, 8 May 2024 10:08:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU2nOlXbZqesNqFy/mnLqnsOBGkjrAjCST+QZfZpZmO8lg3T/646yompD0cSVQHrSEVsmBj5pbdKbPKdZGUJFTsov6PmK2hC8VLCMyktw== X-Google-Smtp-Source: AGHT+IGtm4ss29DA09Ck+HX2XO1GZJ3TGRQHlzXGuE6V002zngvi+wvsrL5ATCCyOHZzcu6Z3ayz X-Received: by 2002:a17:907:3f92:b0:a59:bc9d:a0a3 with SMTP id a640c23a62f3a-a59fb9f21bdmr241489066b.75.1715188080773; Wed, 08 May 2024 10:08:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715188080; cv=pass; d=google.com; s=arc-20160816; b=IZFB/pfQRkFTomIn+clINDeLEtfArCLb9p7XzQtCnuu/OJq1qyDsnI6kTTtkRTyDPB qKWrZdmgQPyl+o/H8iit1ACn/UzAEflFX82tVOZPw3QW5GCGz0XmO2m1vRThUMqa0+5y MmFv+uNjptquxGUIveqSRS+X2xVrS1+B4Wc/qNh8HYu7GvY4gXl5GuFs6K5jl6ASQyUG 6HsQGZImOwMt1o7XRmScc2WvFRgadWRGP7kgVmwraXM4F7QdbRH+XFUZJQRzj+ESs9Bq IF9MAb3rNRJi7sUzA2y4SXUNyLfh1OztsY/qxddBh8AMAmt9XqZSia24K0qbMkfcBjMn nptQ== 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:to:from:dkim-signature; bh=q8wJith1dOaln4BQF3p/J9UrFdwNlAWTgu+nGSZR/0o=; fh=x26SUobW1tV3pNDTloheZ+HncvT+WzPtVfupoh/EVGk=; b=ohmUJfJllnqQZMlFANuJsIcrCzTectKouswBk0tyOZizf7kRICHB1Ou36qoJ5HmcqV PRrtQeupp2ffXjq8Zg2UcPzPaA/L5oX9DOyaK2YMniqVFRkiR3+uHnrR0ZE55Pbc+CMM kqHqrLFqeYH8McsgR3lyJTBmodXmohzUhmQgMTrTtANo6WgMKiVY3hHvvaE2WcKSc0MU BcJ17RLgxRXiVcQhxQyYGYiTGSs2mnE5ekMJlogT3EsFAwPT2mrTKRd8/7eRFgg9izMD AI2V09PBnZqfR2dCnkHdNQpwbkvGyfiI3bGO3cBkgUOVpP6pyrfIT5ZxzIuEWZeNSd9A RlNQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=HTBzu9FC; 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-173595-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-173595-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. [147.75.80.249]) by mx.google.com with ESMTPS id ca2-20020a170906a3c200b00a599a66eed9si5841216ejb.679.2024.05.08.10.08.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 May 2024 10:08:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-173595-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=HTBzu9FC; 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-173595-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-173595-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 EC3EF1F23547 for ; Wed, 8 May 2024 17:07:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4D4F96D1CC; Wed, 8 May 2024 17:07:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HTBzu9FC" Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (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 A84F01095A; Wed, 8 May 2024 17:07:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715188062; cv=none; b=E8elsQfI9oy1zLA0U8hBZUVROCkONJ/DtAo4M1KQj8Cta117rFwwlCEFRLqNeFWFgHQd3rexCaPl56PAaeMVa6as3mI9NTjo6QUFyuiw9M4YG8wbwOOIIyNs8FxT4pK8nXzJPW4W33I1ddwJsHf8FQoRrzCV/Pv6kSAlvkj+kPk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715188062; c=relaxed/simple; bh=RT8p3uFckkui+p7FFp8Hb2ZN6oMPg87akgldE74Rzpc=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iC26QL4710bcvDFD5WNGtyh+7/H8e9dshIec/uuDg9VhqgqUyxbY8dboh3j3czd3QSwntfNkNxdNaXjo966IeNqfRbFKbr3vwlkWT0xh2jdWBA9ocsKKmLHgsNA31Tk34N73gx1l8F53GaZJRDVkBRazstYh+CI1e4LfZfHca6M= 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=HTBzu9FC; arc=none smtp.client-ip=209.85.128.43 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-f43.google.com with SMTP id 5b1f17b1804b1-41b7a26326eso33278595e9.3; Wed, 08 May 2024 10:07:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715188059; x=1715792859; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=q8wJith1dOaln4BQF3p/J9UrFdwNlAWTgu+nGSZR/0o=; b=HTBzu9FC6IMkH3oL92k0SSayo5Dja909DVtP4k8HgpCOPcTyLvAdhf18Ke0zOUxsMc dnBIvtz+28SsmWcYvvGZ5NCLNaynt0WzXd7ukMZt/tnRUWH83MQxldn6sznP9j1XtsE9 gjdFJb6FqlnAB0BiC8AME0+RI4V7PoyuwuP1sbu90lsxICcJ7vCoD5LTP6gV9+FYFCgF 4AMuvEgHTmnL/1pX42CouKoQV5VUvjTpR6GHkF7o7+Z3zhzmqfjarKtD92gRb9K3fKgM TYE2BHCbTM/n0DxYqD+ZpBJTX865ow7pWuljRO0qr3Xtsa6Sp7qrhj3DmFXriHJuOy91 OApw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715188059; x=1715792859; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=q8wJith1dOaln4BQF3p/J9UrFdwNlAWTgu+nGSZR/0o=; b=fidZUUNwUfnMwbDkfOxYGjvoS9yEF9wXgx8aoVFOs93UOfbJChbztUcViC2A+cojO/ M6jX0SZnhoOPQfpUPRMPkQvFmO6kxztBQ3tew4hD0Y97ERFDSXF19/U1N0jx1pybjxFJ yngnV/lC/TvxNg8mel0Aq51bQE3xOrSaoEfaIjE7iHzHvr7bfSmUaO3ARdSzzZkOVa77 nwMOpt7e+8CB3Jngn1IjZIWlgB3UhbLBMQNTnn1/3WPKp69my+9aySDLkbwaSsfKnlU8 6hvMV1MKrcZWbZIdJsj1bWbyS753rJAaf6xQnv81j61D4/CxNCEGM9LES+3a46kxbPQ7 ty3w== X-Forwarded-Encrypted: i=1; AJvYcCVrw/mnFo2e52icCH6xIrF+yQIICBbEeE+rQxIWxfbhRS1DuVgWtT5YGXawbOQY4OUiMeHc+g+4erZVg4P31yTm4KZkQ7N7YqbkyBAHubfTNMYclxNs2FoJHaN4omDL1VFbga9CN1TnsS1gCYF/xY+wPXC6E11id/McyFn/zYK3s9gwLU8= X-Gm-Message-State: AOJu0Yw6LVABbu1Tkp0XyyFvdLeUmRWLFGjWOIx3jfOTpBhXOVX30b3l z2/CslZqjCnY1diGafyKZ4mO1NCLU/XOLpzTn0u2sxGK7sGUdOyg X-Received: by 2002:a05:600c:4f46:b0:41b:fea6:6526 with SMTP id 5b1f17b1804b1-41f72592ec8mr23692265e9.33.1715188058847; Wed, 08 May 2024 10:07:38 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id fk12-20020a05600c0ccc00b0041c130520fbsm2921555wmb.46.2024.05.08.10.07.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 May 2024 10:07:38 -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 Subject: [PATCH v3 1/4] mips: bmips: rework and cache CBR addr handling Date: Wed, 8 May 2024 19:07:17 +0200 Message-ID: <20240508170721.3023-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240508170721.3023-1-ansuelsmth@gmail.com> References: <20240508170721.3023-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-Transfer-Encoding: 8bit Rework the handling of the CBR address and cache it. This address doesn't change and can be cached instead of reading the register every time. This is in preparation of permitting to tweak the CBR address in DT with broken SoC or bootloader. Signed-off-by: Christian Marangi Acked-by: Florian Fainelli --- arch/mips/bmips/dma.c | 2 +- arch/mips/bmips/setup.c | 6 +++++- arch/mips/include/asm/bmips.h | 1 + arch/mips/kernel/smp-bmips.c | 4 ++-- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/arch/mips/bmips/dma.c b/arch/mips/bmips/dma.c index 3779e7855bd7..2bc9c0d4402f 100644 --- a/arch/mips/bmips/dma.c +++ b/arch/mips/bmips/dma.c @@ -9,7 +9,7 @@ bool bmips_rac_flush_disable; void arch_sync_dma_for_cpu_all(void) { - void __iomem *cbr = BMIPS_GET_CBR(); + void __iomem *cbr = bmips_cbr_addr; u32 cfg; if (boot_cpu_type() != CPU_BMIPS3300 && diff --git a/arch/mips/bmips/setup.c b/arch/mips/bmips/setup.c index 66a8ba19c287..5e024399222f 100644 --- a/arch/mips/bmips/setup.c +++ b/arch/mips/bmips/setup.c @@ -34,6 +34,8 @@ #define REG_BCM6328_OTP ((void __iomem *)CKSEG1ADDR(0x1000062c)) #define BCM6328_TP1_DISABLED BIT(9) +/* CBR addr doesn't change and we can cache it */ +void __iomem *bmips_cbr_addr __ro_after_init __read_mostly; extern bool bmips_rac_flush_disable; static const unsigned long kbase = VMLINUX_LOAD_ADDRESS & 0xfff00000; @@ -111,7 +113,7 @@ static void bcm6358_quirks(void) * because the bootloader is not initializing it properly. */ bmips_rac_flush_disable = !!(read_c0_brcm_cmt_local() & (1 << 31)) || - !!BMIPS_GET_CBR(); + !!bmips_cbr_addr; } static void bcm6368_quirks(void) @@ -144,6 +146,8 @@ static void __init bmips_init_cfe(void) void __init prom_init(void) { + /* Cache CBR addr before CPU/DMA setup */ + bmips_cbr_addr = BMIPS_GET_CBR(); bmips_init_cfe(); bmips_cpu_setup(); register_bmips_smp_ops(); diff --git a/arch/mips/include/asm/bmips.h b/arch/mips/include/asm/bmips.h index 581a6a3c66e4..3a1cdfddb987 100644 --- a/arch/mips/include/asm/bmips.h +++ b/arch/mips/include/asm/bmips.h @@ -81,6 +81,7 @@ extern char bmips_smp_movevec[]; extern char bmips_smp_int_vec[]; extern char bmips_smp_int_vec_end[]; +extern void __iomem *bmips_cbr_addr; extern int bmips_smp_enabled; extern int bmips_cpu_offset; extern cpumask_t bmips_booted_mask; diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c index b3dbf9ecb0d6..a4f84667a901 100644 --- a/arch/mips/kernel/smp-bmips.c +++ b/arch/mips/kernel/smp-bmips.c @@ -518,7 +518,7 @@ static void bmips_set_reset_vec(int cpu, u32 val) info.val = val; bmips_set_reset_vec_remote(&info); } else { - void __iomem *cbr = BMIPS_GET_CBR(); + void __iomem *cbr = bmips_cbr_addr; if (cpu == 0) __raw_writel(val, cbr + BMIPS_RELO_VECTOR_CONTROL_0); @@ -591,7 +591,7 @@ asmlinkage void __weak plat_wired_tlb_setup(void) void bmips_cpu_setup(void) { - void __iomem __maybe_unused *cbr = BMIPS_GET_CBR(); + void __iomem __maybe_unused *cbr = bmips_cbr_addr; u32 __maybe_unused cfg; switch (current_cpu_type()) { -- 2.43.0