Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp87302lqh; Fri, 3 May 2024 14:22:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUihJaEFeK3iSM3hA+D9xt4HMS1QonKpEb3PtdgLGHqj5cuVbk8Hl7funBdAztNdysh7HVbcWX1fU76HX6o8gvaZashnCBESp+nLnn95Q== X-Google-Smtp-Source: AGHT+IEzXYZ0aOhTVbn+cAdDlKgioM6OWO/XGSIrrmRThMr4zuxSLNNEPzQJL28jUMR6+nON41E2 X-Received: by 2002:a5d:4709:0:b0:34d:b51a:c63c with SMTP id y9-20020a5d4709000000b0034db51ac63cmr2592865wrq.18.1714771378785; Fri, 03 May 2024 14:22:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714771378; cv=pass; d=google.com; s=arc-20160816; b=gz6xlpAYJ/ATn7VxEKYKS9EARNBfP9FslAWuLh7qLDZxAVLH7G8PwME+1P4FZPCl2T E35/WG/swJtt91y1DL4UIY8WlA7PCldZoIhU/aG56gah0/c18pZUz8fo0C1Jhb2vsMtZ TpXliSlBNKfdIEBpNkMqsxP2ZN1BIqVDzKmq3R3eI314Jm5Cag+RjHnY1voO7ZQjEbev jD8Os05Rmpz27PgsmsxlYfx37ogXE5bwOk4Cwkh5+5VCbZrw4O8IDnkIjTxJcVHKVQrm ophsmwNuA6sS45jMLIt9WejjZOAFwv9HQgYdxHwZDvGUW/T30cgiM/T0i6U/qVUTMnew 1dug== 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:message-id:date:subject:to:from :dkim-signature; bh=W4l8CQe9oejxI5JdTjIuaJLl4CrUfKfLhE5Q/q4k4MI=; fh=AgWnwxM4w+Arejabw0ZAS74AcP4tHaJmYVcBEPRkNUk=; b=RAZzuv1q2Kl1FLiXenvh7C+k+SDhB6HPU8kF3ec2GhM91iN6vs3s79HPYKXI3YX7pL sB4Va0EzLIEkCxKFZPJvAJgH2wI5Gxfy2a4IY/RT9pmCENB33hdBuBXzekp536UR80Ky I6tSxfd3xzlMHJzHxOg1tQiK8lLhJquqd/cFFogDmsjO2mqxgfnomXaO7JiU7gap/rkJ jz2JtcwKdTWeQGjSYtMm6jvwtr7B5cHcyaFIZfA5DmxkHA/FJZ/BPrSu9Vgf9yPcXU8X 4evgr6d302KrTF1n9V+ymYUVLzsEU/dFZmNwB5TXt84zbSATfUOj7pugndaGsmLVAZKt 2xfw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=SDDhOSk8; 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-168237-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-168237-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 xo22-20020a170907bb9600b00a599f472637si415069ejc.551.2024.05.03.14.22.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:22:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-168237-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=SDDhOSk8; 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-168237-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-168237-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 585871F2385C for ; Fri, 3 May 2024 21:22:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 789A753E16; Fri, 3 May 2024 21:22:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SDDhOSk8" Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (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 0FD8F1E4B2; Fri, 3 May 2024 21:22:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714771368; cv=none; b=C0ZCEtTfVnmbCYFC33AnXodutPqYmaoV45LD1dIzhB/Ju0e+it4ACELgWThaDXA4YG+7yoUBKhktnxTiCHPGDvW8oIHXpNZ4psgw81KyrPk1ZdtAfW4L06yfLA1aVbxzNdMfgIgcg7BqWWEhtjj0pVJ/PHmqEJ9vXnJdpPZImQA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714771368; c=relaxed/simple; bh=cr9DQeqBtzT4TPir/4vvyekzi9fAbf2qdIhn9FjlAng=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=S/36jKXwuehtN3jaKPgZOKYbN2tPpvK8K7az7UN47kaYZ5CkqE2dF5lSzF56LigmSbsB4Nd2vVxITmL2Mvw5gZo8MN5INDbKxFu3dB7OV8kSE2ym/mdAuDX41kFP5YwmpAdarEDxJjQgCSQoWsfePqIH7iz+qe8W2trZuv2RKGM= 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=SDDhOSk8; arc=none smtp.client-ip=209.85.221.53 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-f53.google.com with SMTP id ffacd0b85a97d-347e635b1fcso89116f8f.1; Fri, 03 May 2024 14:22:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714771365; x=1715376165; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=W4l8CQe9oejxI5JdTjIuaJLl4CrUfKfLhE5Q/q4k4MI=; b=SDDhOSk8ejrAf6lZYv8tsK3u3rHy7nm9dE0rseg4Jy5+hsM0bpTF8GR/NdTkI+BVjy ZHgntiS0raJxqvPhUkoB0+oS0YMUEqWx1CFu11SLSODjXrIMwLNvCQVrWU0VHp5I4XKb BpqCa8jGHiNWvIZhQFLVKfuoGwSL28NUr9t9c/o4EZXKuBaYloMGwh/2W+sABNtOZeR9 dqsG9fI8qtjtpKzW02aSpqUxuxX+LpTKyMfxikRcTRXY5lTRi8meuKdVrE+kxZzSNY1K ggEpqApdN01PLRn9P+tckwoppJRo7IHGrCmEo6wZdYKVQtmcxbJfn4w2Q0qIQ74eOOtG xyTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714771365; x=1715376165; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=W4l8CQe9oejxI5JdTjIuaJLl4CrUfKfLhE5Q/q4k4MI=; b=B/a6IH9zCBkDhZPddRNwpFz5heonLFvEDjRG+zktagRil7lrHyIHghUAamQ30Fzygo JcBNTqTEOGeiL+ebaVbXEtvp9+pTZacXmYgKNtgWHo/kD7nY8p2CSL+IfPbHGMixUJoj 4kWNHbcYSFoDw0UTEv2omA9EdnRf19RNPvam0SIo3nTGRzwOL1DlbB2gVX/4FW04Sa6q 4qHGuMUkc1pk1UvUMMJeuMtBMBH3dyLTqiFJw97jXv4JC0W1ZYunBK+mNE9WJ1wYLY8E 6yptbAoaDHjt3CTY0xYcg/q8e6fuEL68FGM/SEdCy/kZSfCD9FwoTf7d/dcYVKkF+WfE U44A== X-Forwarded-Encrypted: i=1; AJvYcCUlatkWpOD3Nzc9CDfi+6PnGwEUcMe1gjZe2L1yDSp6D+nJqUCq+hbjxUj4Rwl2Zp4eYPXCWQER1ZUWNzpcDyrPkv2J0UZuvfIFFliog6GwKlEWAl9hbdVMjge8+Ahhz7C1th5uBphKkbbt67ROoDQgMJnNpkUVoX1Yeh9oisuBWDdpmks= X-Gm-Message-State: AOJu0YxospUvLHjkLQ3disg4xeLtG1Pa0pXShtCakdLKjTxqQEuzz24o ajGVvQn4DOPyDXYLwSMnq1okntCxiUbBnyIYmRCrQQgQ9oYfYhyh X-Received: by 2002:adf:f88a:0:b0:34b:e2a:499d with SMTP id u10-20020adff88a000000b0034b0e2a499dmr2920956wrp.19.1714771365159; Fri, 03 May 2024 14:22:45 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id g7-20020a05600c4ec700b0041902ebc87esm6918729wmq.35.2024.05.03.14.22.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 14:22:44 -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 , =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= , linux-mips@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Daniel=20Gonz=C3=A1lez=20Cabanelas?= Subject: [PATCH v2 0/5] mips: bmips: improve handling of RAC and CBR addr Date: Fri, 3 May 2024 23:20:56 +0200 Message-ID: <20240503212139.5811-1-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 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 Hi, this simple series improve handling of RAC and CBR address and try to upstream these simple patch we have in OpenWrt for a while. The first patch fix a straight kernel panic where some Bootloader might enable RAC but misconfigure the CBR address. The current logic only check if RAC is enabled but doesn't verify if the CBR address is usable. The DMA sync function cause a kernel panic for invalid write. (as CBR is 0 or something like 0xa) The second is preparation for making the CBR address configurable in DT. Since this address doesn't change, we can cache it and reference it with a local variable instead of calling the register to access the value. The 4th patch make it configurable with 2 DT property, one to actually set the reg and the other to force set it. The first property is used when CBR is set to 0. The second property is to force it if the Bootloader sets it to something wrong. If the CBR value is not 0 and is not forced with the second property a WARN is printed and the DT value is ignored. The 5th patch enable RAC on BMIPS4350 and the 5th patch is a micro optimization to skip more call on DMA sync to save as resource as possible on low spec devices. (since DMA sync is called many times for the Ethernet Switch and we can reference the bool instead of checking the CPU type everytime) These has been tested on BCM6358 (HG556a) and BCM6368 (VH4032N) and reported correct functionality. Changes v2: - Prefix brcm vendor in the added property - Drop last patch (cpu switch from DMA sync) - Validate CBR addr from DT to be outside DRAM - Reduce indentation in DT CBR check - Reduce delta and use local variable for CBR where possible - Fix and improve typo and spelling mistake - Use 0xf instead of 0xa for BCM6358 RAC enable Christian Marangi (4): mips: bmips: BCM6358: make sure CBR is correctly set mips: bmips: rework and cache CBR addr handling dt-bindings: mips: brcm: Document brcm,bmips-cbr-reg property mips: bmips: setup: make CBR address configurable Daniel González Cabanelas (1): mips: bmips: enable RAC on BMIPS4350 .../devicetree/bindings/mips/brcm/soc.yaml | 32 ++++++++++++++ arch/mips/bmips/dma.c | 2 +- arch/mips/bmips/setup.c | 42 ++++++++++++++++++- arch/mips/include/asm/bmips.h | 1 + arch/mips/kernel/smp-bmips.c | 21 +++++++++- 5 files changed, 93 insertions(+), 5 deletions(-) -- 2.43.0