From patchwork Mon Feb 26 10:54:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 206566 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp1998457dyb; Mon, 26 Feb 2024 03:08:36 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXkR6l83gOQerZl8d1Ixu6tZuFUgbo/fiTlu5WzvMhJnsTfqhcGAP8LKSTj7pzORH0+d+ZXKxnpnKFVBw6qIgvMOIQWug== X-Google-Smtp-Source: AGHT+IGyIen3nJ46OQeMSCW3MrOtvvK5pKsMOKZ7GRJdYXVWEckkYRub9Ft+h1OrmJPZOpe1drR2 X-Received: by 2002:a17:906:5609:b0:a43:7df:1ad0 with SMTP id f9-20020a170906560900b00a4307df1ad0mr2824051ejq.10.1708945715810; Mon, 26 Feb 2024 03:08:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708945715; cv=pass; d=google.com; s=arc-20160816; b=dKgyZhkOp5lsamrEdRrd0F5GzFuQrql333DoECJ/vxpPq5OikJapMLwTZPFzj7YaBY KkdnN+y3kptfJYUJg9FmetkGhDsRbnuOJ6gM6zLUHc0JYA6hQ3roueSClTvJ1QSp/fjV GAJCtmg09HOl3D0L6TwTnvPxTseRpTfLZDHaoVm5no9hkEldI3C5nxWqgbivhl3E5FQl VCHTtEkGTSwwO/NVBQ2CttiyKZ9DeVYKR3P0HahLv7TDJBOMMmhylI50oxMP2qZG/Ajq DBk58QHYuIFV3nEP3OQWQIJXzP7gJCz4Nlv6ulhqXcy5WLzXaQfIXRixv7Cf3Q1McVFo e4gA== 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=4x/fx2FWKopaj90n/fZEYnFZHtx6vndtcet4O9jVerY=; fh=Gh8SYfUXJUiSiNd0KUj8nxYq1lHQ1vmBxsPn0S79QeQ=; b=V6FFrWSQs9Z1rm0STlTvQ8V6311sD9JCBbvIjAZBtng8Rlk5bv/d5PNCN184kgyRhu hcXeG7zjrPwgdyJEcyl6lGsdoCtHQXsmzNLB0SKD+vWsnpf18xwleqvt0AV9nxcS/Dxo +XbwlcmYoLoYJH1h30X5e7cLXta4xeoMKEmK40RNsGJz4IzuZIwJPuDMF2tGctZDFWgz CIFd7azap9fRXj2mxbaNOSwbngGO2xVCdKkXkvhQnt4C+R1oSikJbXbWtJtaKbZUpfA8 9xal+bkSddLE6OOyrLccweFPY9cZtxE6ZFu5XuQ+B99WRcMaYrQATO/Ct5l88l388IBy SeSA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=h3OdbtUg; 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-81227-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81227-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id m22-20020a17090607d600b00a42e3c23413si1956923ejc.226.2024.02.26.03.08.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 03:08:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-81227-ouuuleilei=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=h3OdbtUg; 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-81227-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81227-ouuuleilei=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 18EEB1F2D73C for ; Mon, 26 Feb 2024 10:57:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E5A23347A2; Mon, 26 Feb 2024 10:54:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="h3OdbtUg" Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.170]) (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 0F6201CD1A; Mon, 26 Feb 2024 10:54:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708944875; cv=none; b=GRht3uwCzrcyJcyyT9PuY+1nkKXS2Kh3odADHW/FydOv7x2ei4KprO7ffMe0oDlwizaLJtnPBFTq8yJH5CdJQAEWEG2oBvKEAeoMggGgMPU0tyrmZgwM+1DyXRzIdKvhojkJ2KmeUthMcUnw6raIA8Cm0bOXshUm2/Gu+zu+DgE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708944875; c=relaxed/simple; bh=UEyFZtlmbEFsxxE3dYm/WsIXOQgVd7MY92XcjEi7gfc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Pciu1fF54yo1yJ0I0uA6IIQ8weKv7fa447b0aiRODC7X9RhmGfXEXjztOKk3NGSOJFP7tH0m9xcNw5lWIO7a/ZCSpIDM73nahRprOrrrboi1PBCc6GwPxZbfNoWL+lsg0w4zaV70ueVSUc8tG+xRhVJfLiC/HPKNy4eb0yv69+Y= 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=h3OdbtUg; arc=none smtp.client-ip=209.85.208.170 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-lj1-f170.google.com with SMTP id 38308e7fff4ca-2d275e63590so33974761fa.2; Mon, 26 Feb 2024 02:54:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708944872; x=1709549672; 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=4x/fx2FWKopaj90n/fZEYnFZHtx6vndtcet4O9jVerY=; b=h3OdbtUgB7cYsnKso8eKu7ueKRlvHE5d7HEdvFgOOcc956/mO/n5A2K9fIJS3gXAMV wxA9D7yJWyF32JIyjI93dp22zqbzs/pHzoXn32pqmKJijqH8XX4JWtkvmK5H4XQEJfsM v3GQ/ZInkqsUfTzmfbMnERgY2xptuGvh8ET0B9cmH4cm3TG6/2IKvwNLqmOFgZrqwE34 fUBLj1A++0guGupCyQZ41ggLEd8lyLJsWTtGDOHh21ZyQTK/eBD4HN9zhoz/ms8/5P2E Qb+MpyYzftEf+hfom7PhNPyvywPl/I2PsktFINx8AbFq63mx0s57bLDQQveQZjANgruL wZGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708944872; x=1709549672; 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=4x/fx2FWKopaj90n/fZEYnFZHtx6vndtcet4O9jVerY=; b=bd/o5zRYpsMmtTtveut3j4HU1TCox77wcmRPfJHl35hTBLf2BRh/x7W2swa/mKCMWx wf/tPIit9X1jgzi/qOwk4pj4jnZ5uIrFFUG6BJ3YcflKXS51XW1EYXidVKOg73pSxMhO 3hDgSMHIKSpBv1xe1iY9e48JcJVWAQ4NDMEvQLZdKTRpFPuknRopSOiTfZruyhvNHIi5 Jq5Hjs6J6Ynb+JZBbZBY7CVnebFLoYdY8HUAgOtTJfo5fa+Q7BNq6rqA4eH9s+fFGfZ8 ahmURVx8kp6WwgMhXEtvfRMWl4gmVOlJ2d9wLeOcIx9bDXwBohMPLwrS+H/7a4HCbrcc YMTQ== X-Forwarded-Encrypted: i=1; AJvYcCUKF3pZzBlJnx+rj2EKjuwF0e3JartK/8WO5nLE5FZ+6+NQOyuUvuKoHBqCuqeJhnK8zGYPVlWVRX30Q5Q44+ENgx79ziEx1AzC+vg05GA0uQhpYgtyHqnLyC5a8fyBKUnZEgKrS4aVZg== X-Gm-Message-State: AOJu0YycsGVOgJ+Thya1b0ob4oISQql+ohGbiOqBz2Kicf0amcJkhOKi Zb5cEbbeToHCXezqZY7jg7sL3qobUijo3jBS3ip2o2Ss4Nb6Mbh1 X-Received: by 2002:a2e:9ccf:0:b0:2d2:8bdb:4aea with SMTP id g15-20020a2e9ccf000000b002d28bdb4aeamr1219045ljj.5.1708944872241; Mon, 26 Feb 2024 02:54:32 -0800 (PST) Received: from localhost ([178.176.56.174]) by smtp.gmail.com with ESMTPSA id b18-20020a2e4952000000b002d244bb2f99sm802946ljd.62.2024.02.26.02.54.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 02:54:31 -0800 (PST) From: Serge Semin To: Thomas Bogendoerfer , Arnd Bergmann , Jiaxun Yang , Andrew Morton Cc: Serge Semin , Alexey Malahov , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/2] mips: cm: Convert __mips_cm_l2sync_phys_base() to weak function Date: Mon, 26 Feb 2024 13:54:21 +0300 Message-ID: <20240226105427.7191-2-fancer.lancer@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240226105427.7191-1-fancer.lancer@gmail.com> References: <20240226105427.7191-1-fancer.lancer@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791959236287648650 X-GMAIL-MSGID: 1791959463307514833 The __mips_cm_l2sync_phys_base() and mips_cm_l2sync_phys_base() couple was introduced in commit 9f98f3dd0c51 ("MIPS: Add generic CM probe & access code") where the former method was a weak implementation of the later function. Such design pattern permitted to re-define the original method and to use the weak implementation in the new function. A similar approach was introduced in the framework of another arch-specific programmable interface: mips_cm_phys_base() and __mips_cm_phys_base(). The only difference is that the underscored method of the later couple was declared in the "asm/mips-cm.h" header file, but it wasn't done for the CM L2-sync methods in the subject. Due to the missing global function declaration the "missing prototype" warning was spotted in the framework of the commit 9a2036724cd6 ("mips: mark local function static if possible") and fixed just be re-qualifying the weak method as static. Doing that broke what was originally implied by having the weak implementation globally defined. Let's fix the broken CM2 L2-sync arch-interface by dropping the static qualifier and, seeing the implemented pattern hasn't been used for over 10 years but will be required soon (see the link for the discussion around it), converting it to a single weakly defined method: mips_cm_l2sync_phys_base(). Fixes: 9a2036724cd6 ("mips: mark local function static if possible") Link: https://lore.kernel.org/linux-mips/20240215171740.14550-3-fancer.lancer@gmail.com Signed-off-by: Serge Semin --- Changelog v2: - Convert the underscored method to a single weakly defined function. --- arch/mips/include/asm/mips-cm.h | 13 +++++++++++++ arch/mips/kernel/mips-cm.c | 5 +---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/arch/mips/include/asm/mips-cm.h b/arch/mips/include/asm/mips-cm.h index 23c67c0871b1..6cc79296c8ef 100644 --- a/arch/mips/include/asm/mips-cm.h +++ b/arch/mips/include/asm/mips-cm.h @@ -33,6 +33,19 @@ extern void __iomem *mips_cm_l2sync_base; */ extern phys_addr_t __mips_cm_phys_base(void); +/** + * mips_cm_l2sync_phys_base - retrieve the physical base address of the CM + * L2-sync region + * + * This function returns the physical base address of the Coherence Manager + * L2-cache only region. It provides a default implementation which reads the + * CMGCRL2OnlySyncBase register where available or returns a 4K region just + * behind the CM GCR base address. It may be overridden by platforms which + * determine this address in a different way by defining a function with the + * same prototype. + */ +extern phys_addr_t mips_cm_l2sync_phys_base(void); + /* * mips_cm_is64 - determine CM register width * diff --git a/arch/mips/kernel/mips-cm.c b/arch/mips/kernel/mips-cm.c index 84b3affb9de8..268ac0b811e3 100644 --- a/arch/mips/kernel/mips-cm.c +++ b/arch/mips/kernel/mips-cm.c @@ -201,7 +201,7 @@ phys_addr_t __mips_cm_phys_base(void) phys_addr_t mips_cm_phys_base(void) __attribute__((weak, alias("__mips_cm_phys_base"))); -static phys_addr_t __mips_cm_l2sync_phys_base(void) +phys_addr_t __weak mips_cm_l2sync_phys_base(void) { u32 base_reg; @@ -217,9 +217,6 @@ static phys_addr_t __mips_cm_l2sync_phys_base(void) return mips_cm_phys_base() + MIPS_CM_GCR_SIZE; } -phys_addr_t mips_cm_l2sync_phys_base(void) - __attribute__((weak, alias("__mips_cm_l2sync_phys_base"))); - static void mips_cm_probe_l2sync(void) { unsigned major_rev; From patchwork Mon Feb 26 10:54:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 206568 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp1998871dyb; Mon, 26 Feb 2024 03:09:17 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWJ4HwNQrZgTTm8f7BpmcSsmbMI/eHEEcWoPk8cLaH3Kj0vPec2CR2wzW+/CboFpf38BjDlXeEWDEQha2gmW+vH5dk06Q== X-Google-Smtp-Source: AGHT+IEX3ouziaVwHSIOaKwoZs/H1G6JpCq9VgMLOEbTjUtVYRZA0oSbZXrU0RDZ7fOgv7h/RqB/ X-Received: by 2002:a17:906:52cd:b0:a3f:c32:7b0c with SMTP id w13-20020a17090652cd00b00a3f0c327b0cmr6336188ejn.22.1708945757728; Mon, 26 Feb 2024 03:09:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708945757; cv=pass; d=google.com; s=arc-20160816; b=q7OdjWS1+k74tfRenYsTpg1LAW1RhIHjIRdSkaJ9FUi/THckzyXxqzpvmTpVJzh592 idmImlOv3EnxTD3zwuneGFd/fL+UYyEzdP2LjdPB0DMfuQfHVwY2fHBZn3HbBxgv6LQl dfulN8SDTnzQ3xBtl8caHgKRBJgnUYb/3swKAC1e2OsVzDZgI3xyzZcPU24ofSBnL6j5 tnBNgL8GLqlxWUHFbkVQvtbyNnkqnsz4XGIviwPxayGtKBOzVh7ASt2OZG07SSEWrG70 fVMPsLQCOOdlx8M3qr1G3g+vaEhVR4DkiBVAwoDlIZfmGi+g7pBK36F7JpE11/Bl5SOL CuLA== 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=CYVbCLcMxay+zfpwGmsXhfLKgVTaAV17WjEUbbfo6ys=; fh=nXxslmo3tgnl7gSPhRQHoYCqbkax+xnJD4B/t0hyVEo=; b=p2qL7BcsG/bAfSRgQa8QLasQyUqAQAZRNBR85jKuwBT5H8FMmD+ueRP7RPa/sygWSe PazSX5O7Sm0tmTw8tPNkDVVsrlRvB7bSPLEhZGXeVYqGJgUWq/qE0d8CQPFZlbhSIo6b njb4G0x8zULsrbgNRkUZ/AtIu44DOwjOR860fZ8Is5N8RLAiitYCyLtJhXc/+IwDlj5c Qwp4E2MRcWSZfN6Xb/B3bV52MonPtnB5L6auDFldxVYd2PWgNBBgGUnjgteMLsZWM9Qd +8/yt0LkeeGztZoipjSfteI7re42wwRZB2KOHwg+STiPyRG1WvcHb/UyC9JmHoOjXKT7 FdAA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=jQVJPwDn; 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-81228-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81228-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id bt1-20020a170906b14100b00a3e99e702d8si2026246ejb.721.2024.02.26.03.09.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 03:09:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-81228-ouuuleilei=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=jQVJPwDn; 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-81228-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81228-ouuuleilei=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 3F4CC1F25781 for ; Mon, 26 Feb 2024 10:57:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 71F9D3D0D2; Mon, 26 Feb 2024 10:54:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jQVJPwDn" Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) (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 E5F3B2206B; Mon, 26 Feb 2024 10:54:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708944877; cv=none; b=r6HUqhuomQTes6CT6Rfln6SNDx4LGuTf8ANbL3SLdIwxV1AG+JbMbAz3DPXLn7aefVNV0ofcX7+GNUUpGbF6MQg4CUKLFNi4ARLwx/X5NsffbI1qTGoFoptp7RL0za/AEfPQRS34gvRPe6XPbUikrRf1O3A1dFLNPX3GhmhGSuU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708944877; c=relaxed/simple; bh=8xB3k09RSJts2z0NK9alSi0oCp0ekNEmZOpK3Mqg9FA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PIIBZJkL8GqhE1IynOabLMIojnlVIii6viRmYyjsNF27Rl9ASlYpbXIJl92qQYWV1s/JKr4ojO0eNoCY4aBHV1/PlVkTS8dzAgfM20fYQpOkSJ1ke2EKG7W28sMVCZZbmDQ5XipC6wmeU+pultQJs2Bx3ct9CHEu8ZXKSTBb9hs= 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=jQVJPwDn; arc=none smtp.client-ip=209.85.167.46 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-lf1-f46.google.com with SMTP id 2adb3069b0e04-512fe342841so543196e87.0; Mon, 26 Feb 2024 02:54:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708944874; x=1709549674; 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=CYVbCLcMxay+zfpwGmsXhfLKgVTaAV17WjEUbbfo6ys=; b=jQVJPwDntnf2yUUogwJ+dz94dBMp5v0uq1PFEsT65KGD2hClSwddORzshuDqABvVJX dSqOws/TUeiQqfqt9w5FlxEkt5M0YTFY+ew1XVCjp2pAwQ2mMcXLz6XuANrutqnawy/m gulv+q9xoeQQUOP/oLdZg5zauG1HJY0vdeQBMpHdjHA1kCDtB5xiF++jG/JMJT7xWDuw ajLRPAc4swrYVCUpq9lYl5Ki4YoqC8rctxHHMN5dp96IOBL/OvAUDfmaV5kBxgJpIYvQ 3fsNsB5Z/AQ+msYDIMqPKPzG933jDdLK93+BVgzjjgerTlvyuBzyePS48yZ5BK2K400I Bnww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708944874; x=1709549674; 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=CYVbCLcMxay+zfpwGmsXhfLKgVTaAV17WjEUbbfo6ys=; b=NMewOk4PS8OaFlXME5AU7zzjJCzhDOEIWrGUBdynsPwPS4es9TLAerhvPU+WJhu6NQ aQGvN9/uRr3Kyj4sc7KkkQvnSIFOD2fvjaWP01IeFtpohVxnBJaVI4925pi5zSuOWIwi TwCCjxyPzJR/XXWMbDcTMyRiruAoy4D11Msw3tfoBqK7zqzgmCcqPwH41goZ7e+dep7V kIGgL3Q7huOcyS6zMhyUdd9Jt+74PYX5oh3KyVoUv4qdLoBhv/GrgT0GqES7/MNyDGKD BgKhXihdb40YCdkVFMzH7jFQK044sDtbbkNuiXbF0zDSAA3wAd3jnXP+h1mHVLeao+ll mA6Q== X-Forwarded-Encrypted: i=1; AJvYcCVq5/V81yUQVhoutyAUAQ37CtRCb1zyLe+sxo5Ytsd59HwhxmiZb2axETjJB2pNxJM6q99Od2ESKplsG4EQG4RzODxjusUmqcwtYUnzkEtG7br6eJxaujiTR/t8PoKUnfo9tcB1ZAdAHQ== X-Gm-Message-State: AOJu0Yy6OCWx0RzI72xHXSQJIV168UT7NoSGPPMcVmtOJgRSxTi5HDnR OpUsbA2FvxAQx+Y+tZUvIkrW83dk5nyYiPPxijMQeEbtdrgzXO9W X-Received: by 2002:ac2:5e75:0:b0:512:b2b0:89d with SMTP id a21-20020ac25e75000000b00512b2b0089dmr1895157lfr.28.1708944873988; Mon, 26 Feb 2024 02:54:33 -0800 (PST) Received: from localhost ([178.176.56.174]) by smtp.gmail.com with ESMTPSA id b25-20020ac25639000000b00512ffcdcde8sm171626lff.1.2024.02.26.02.54.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 02:54:33 -0800 (PST) From: Serge Semin To: Thomas Bogendoerfer , Arnd Bergmann , Jiaxun Yang Cc: Serge Semin , Alexey Malahov , Andrew Morton , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] mips: cm: Convert __mips_cm_phys_base() to weak function Date: Mon, 26 Feb 2024 13:54:22 +0300 Message-ID: <20240226105427.7191-3-fancer.lancer@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240226105427.7191-1-fancer.lancer@gmail.com> References: <20240226105427.7191-1-fancer.lancer@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791959507258006433 X-GMAIL-MSGID: 1791959507258006433 Based on the design pattern utilized in the CM GCR base address getter implementation, the platform-specific code is capable to re-define the getter and re-use the weakly defined initial version. But since the pattern hasn't been used for over 10 years and another similar case (CM L2-sync only base address getter) has just been fixed, let's unify the interface and convert it to a more traditional single weakly defined method: mips_cm_phys_base() (see the link below for the discussion around this). Link: https://lore.kernel.org/linux-mips/20240215171740.14550-3-fancer.lancer@gmail.com Signed-off-by: Serge Semin --- Changelog v2: - Convert the underscored method to a single weakly defined function. --- arch/mips/include/asm/mips-cm.h | 7 +++---- arch/mips/kernel/mips-cm.c | 5 +---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/arch/mips/include/asm/mips-cm.h b/arch/mips/include/asm/mips-cm.h index 6cc79296c8ef..c4e27970d88f 100644 --- a/arch/mips/include/asm/mips-cm.h +++ b/arch/mips/include/asm/mips-cm.h @@ -22,16 +22,15 @@ extern void __iomem *mips_gcr_base; extern void __iomem *mips_cm_l2sync_base; /** - * __mips_cm_phys_base - retrieve the physical base address of the CM + * mips_cm_phys_base - retrieve the physical base address of the CM * * This function returns the physical base address of the Coherence Manager * global control block, or 0 if no Coherence Manager is present. It provides * a default implementation which reads the CMGCRBase register where available, * and may be overridden by platforms which determine this address in a - * different way by defining a function with the same prototype except for the - * name mips_cm_phys_base (without underscores). + * different way by defining a function with the same prototype. */ -extern phys_addr_t __mips_cm_phys_base(void); +extern phys_addr_t mips_cm_phys_base(void); /** * mips_cm_l2sync_phys_base - retrieve the physical base address of the CM diff --git a/arch/mips/kernel/mips-cm.c b/arch/mips/kernel/mips-cm.c index 268ac0b811e3..3a115fab5573 100644 --- a/arch/mips/kernel/mips-cm.c +++ b/arch/mips/kernel/mips-cm.c @@ -179,7 +179,7 @@ static char *cm3_causes[32] = { static DEFINE_PER_CPU_ALIGNED(spinlock_t, cm_core_lock); static DEFINE_PER_CPU_ALIGNED(unsigned long, cm_core_lock_flags); -phys_addr_t __mips_cm_phys_base(void) +phys_addr_t __weak mips_cm_phys_base(void) { unsigned long cmgcr; @@ -198,9 +198,6 @@ phys_addr_t __mips_cm_phys_base(void) return (cmgcr & MIPS_CMGCRF_BASE) << (36 - 32); } -phys_addr_t mips_cm_phys_base(void) - __attribute__((weak, alias("__mips_cm_phys_base"))); - phys_addr_t __weak mips_cm_l2sync_phys_base(void) { u32 base_reg;