Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp279090lqp; Tue, 11 Jun 2024 04:32:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWVofZ0lJWMxPz6wwByAcXvPbW4KXY5rhfdV3Qrva8Vab6sRD44X5nwqh7vJJ+nVuIrHqSaoDuVcBqq+CquLv2CalTsgR9vVR3MfXsYvg== X-Google-Smtp-Source: AGHT+IFzuYS9AMyOd1Io6+AnR0v6fWZcCdo+zp9pGcN7ho9cON4K8myQJQhKCAuw0iaC2jUXKzaz X-Received: by 2002:a05:620a:45a0:b0:795:d19b:5e4b with SMTP id af79cd13be357-795d19b614cmr606390985a.52.1718105549074; Tue, 11 Jun 2024 04:32:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718105549; cv=pass; d=google.com; s=arc-20160816; b=bTyFG5q42TCVqhrIHLkqnVtAqFH4zya5SUO0Il802mnOqPBpsn6Pahmqon6Cn5043i yJ75LsO9/38v6GTVFedToBmgwwKK+3OOd6PYHfgoaY3uADPFtebzFQJtXimhb9tDPvTb 8qey+JihKNwnJHm0Xq4+n9kWk2UxdHviqKvea3hN4KVxCFs9pEo3r2VOWR8d2unI9482 H1ONvWTsfdArkCMl2DY2MZbkzvdHr89RYC1uWSEWEVSCJBhY3fivTL0pXv8J81md4kkX ZS3hK/u9d3sKWqdKBVhx7FxJL+qOI3n+vqLwY0wXauPp+fRyeTDntK85UPxpRtBmhD63 yMTg== 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=iAmwsFns9JAnMUeW6MOSQ6NrqNWyIGTK87/ABQlpO6A=; fh=/JE/X4STRhx64Mb0mXd9ZUC+5TwAJSMCaBaZCozRgIk=; b=Abp3e9qGWpf5VHCNT87f1x/oZkdpHfyLKF9oQTmgQ3Kx4reCiqpaLqw67hk6E7yUka XRrDjEGnYhoT8BJSdQBR/UrgNyJzU4yZu80naV/ad+emlTBNrs34rhDOEqkUdMxKEfSn pH5MqZJdN2eN2b80jBaakJXOdRbrozU26oHhvjUygVWKbF2d0hCaj1S7+S5Ut1Nnj0B9 Ufxtuil55iQ+ulzs1lCb4DV9iBTNEKFXdhHnZMLfXkF/7X/6P/G3tyi+29bVXux9IgF5 KPahYWRHUh8NtTJb1asx0qnIX2CysjoL1XxhmzZVEqfiWEFlX5JAWVcsX4yXfDbkXElR qm/A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=TaOvJfi9; 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-209743-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209743-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-795504aa0efsi946952285a.79.2024.06.11.04.32.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 04:32:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-209743-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=TaOvJfi9; 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-209743-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209743-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id B648B1C21F2F for ; Tue, 11 Jun 2024 11:32:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 927B217B500; Tue, 11 Jun 2024 11:32:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TaOvJfi9" Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (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 0FBCB171644; Tue, 11 Jun 2024 11:32:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718105537; cv=none; b=UDihHFFiigH+RuRqebJjkWCq2wAvRwSW7A3lCpHbj5WZ33XvAJmsRlVzemO44pZxP/UQ3bou42fbjwuevhrsbogwEsXGEiMRzHysAJMzhEiW/LFRyWF7I8AGqU/MmO28D4TRwGk01ftXVEB7VW716jDy4oVH1xl0ZCP8OcTkOGc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718105537; c=relaxed/simple; bh=R5AWGqF7+0BvYL3AmgE6VyRPPP37Za3cS2p/DkO8jjw=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=EnTugtMHr3qZWlc1MOKom6tZUoD8WGLL4Sb9cEqEgzDVPvKyhKxooLQGEu97UeuJ7vfjavw4RKUC4AI4MtlLV8vvI97D5fVDqka0qrqqSCAejYkphu2g//vSJaO3zsW6miiS+SuCyYxziQigqGP768qG5POgv9CLU63RFm5Jugk= 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=TaOvJfi9; arc=none smtp.client-ip=209.85.128.44 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-f44.google.com with SMTP id 5b1f17b1804b1-421a1b834acso17601485e9.3; Tue, 11 Jun 2024 04:32:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718105534; x=1718710334; 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=iAmwsFns9JAnMUeW6MOSQ6NrqNWyIGTK87/ABQlpO6A=; b=TaOvJfi9aYox+64Pu4BTmwCn5ceMRpM+2NGx+vdMXIZmzxvGMH9TAoemM2TjXlsB37 PT60YsKKSHe10vNvAm8lp6LB3d45sEOxKbkMTPpZR1V/Yi+bq3u9wCjl0fjXuWzWKMWQ hSqNivu/hAQW9a89LBT74J5iFzpQjexJSS/GJEmURi54M6w2DAYtWZM1F18jfDdGcp0o ZfwHh75Ao7S0KhyZdKwo5D1+EktcdbaWVH3ZoXMMseNQ6g0uTAmtCGLl7YveV2nFhyWD 4y/DI9mIG6QVOnEranJTgBhljGdX1W1L1nDzw/gUQ8Cm7j+xgQK+sJp/3yfaOAx9bwkQ MARQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718105534; x=1718710334; 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=iAmwsFns9JAnMUeW6MOSQ6NrqNWyIGTK87/ABQlpO6A=; b=MkWHDA2nzbMBZptw/M3hMREYkZvaRPy2LYWgxkVHgOjUzKq5KkBfz+szA7IGfOAyNh mZqwuiThdBCo2pYXCpMmYKmwwUBgHJTt+bDM1Ftj9XbwgKej0cCKq7oPTBDGxD7hx5Of iLGzRhysnz6JGuIQWYvy6FJk2xsVI0iHzQmo3CcPzh6QGYFy+8NCIyQWBZLl9nZ+gon+ 4p+u6MXuco8gnN8PgFwyoSuzbWjAsVQSYsMhP2UVvvzmahrb61pP2U0Xw8Y6MKUg2IEw Rhv48yuZWjrwmb/TrrhJ7clYqjMIYaqTzPMHNUwRIIQfHeLMj/OLRzXRNGEmajTbXAIA CTDw== X-Forwarded-Encrypted: i=1; AJvYcCUmsD7hb47a0GBBt7NjCO5OnvzZSLyACFcxC7oK0wc1RxFd87QKogd4EUFs3zxJWcefaocw+dd2dss/Jp2/pFkE/nhqKJZi/1htpY6U6LFsk6u7Y23foTUYTko8+lsdwAvjn70Qnnn0PJxQUACdg0tm2a6ztdBDaaMjyytITYglvdf2f54= X-Gm-Message-State: AOJu0YwsF1sXL5RtIsU3AjlIE2v5WTpZEzcHA7/o13Vdp+nWKWkBBN1b UuYyQ0D5s92mZ9b23plkpyo4wKpF2CHsAZhe1If06Czc4eMtd3Fq X-Received: by 2002:a05:600c:3ba0:b0:421:78c3:9d11 with SMTP id 5b1f17b1804b1-42178c39f55mr71836115e9.1.1718105534028; Tue, 11 Jun 2024 04:32:14 -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-4227467990csm2473505e9.1.2024.06.11.04.32.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 04:32:13 -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 Subject: [PATCH v6 0/5] mips: bmips: improve handling of RAC and CBR addr Date: Tue, 11 Jun 2024 13:32:03 +0200 Message-ID: <20240611113209.8142-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 4th patch enable RAC on BMIPS4350. These has been tested on BCM6358 (HG556a) and BCM6368 (VH4032N) and reported correct functionality. Changes v6: - Add missing patch that got lost in v5 - Fix missing header for legacy bcm47xx - Fix compilation error with gcc 10.2.1 Changes v5: - Add Ack tags - Improve DT descriptions as suggested by Conor Changes v4: - Fix compilation error with legacy brcm target - Improve property description in DT commit (give CBR meaning and drop reference to linux functions) - Use only __read_mostly as we can't add variable to multiple data sections - In patch 4 use local cbr variable instead of global one. Changes v3: - Drop broken-cbr-reg property - Fix anyOf+const with enum 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 | 24 +++++++++++++++ arch/mips/bcm47xx/prom.c | 3 ++ arch/mips/bcm63xx/prom.c | 3 ++ arch/mips/bmips/dma.c | 2 +- arch/mips/bmips/setup.c | 29 +++++++++++++++++-- arch/mips/include/asm/bmips.h | 1 + arch/mips/kernel/smp-bmips.c | 28 ++++++++++++++++-- 7 files changed, 85 insertions(+), 5 deletions(-) -- 2.43.0