Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp377655rdb; Tue, 31 Oct 2023 09:53:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IESsYM8VTp88WxAQh4PPt1M1XVTJWAINc1QlniZrscZmL6gh+C+zEoKlaKqtNZv2y00wIul X-Received: by 2002:aa7:8894:0:b0:6be:b7c:f703 with SMTP id z20-20020aa78894000000b006be0b7cf703mr11972948pfe.5.1698771210274; Tue, 31 Oct 2023 09:53:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698771210; cv=pass; d=google.com; s=arc-20160816; b=01R+B5kV3h362SXej6SlpyT62id57d77XMzmhtwn03pQHsdU+r4zf2tGA1uz9Xqhjc Kil/U0Ewz7EC/pN8OwMp/StjVDJm4lcBQhc26XBQurhQJYmNqI3RPbOFRJhA02vJ3G65 xuSUgMin/Huf8KRUFZrHK0ApzdBm0q3IqDFYQbMpjSbvC81uTv2CMFE3sFh7Fdj5GWOp 9qCUCbAsMLc3e7NA0da68UoSGtASpnHog2hprHCPn489ibov4QORwU8GGGcN3AErWBzX +pvy7++wvJjsR/s+G3drEFXlZ4iOlYUjpmUPeA3JCobK5GNPl+vZuvFjy7TYKA60gMlT +LNw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zivLEPzK2yPb03tjtLC8DJTk3RiZnwMaBX5KORprkw0=; fh=AE0jPXmH2uGjUWldeEmzGgVvVSJ9pNBsdVXkQhnqn70=; b=B3vYkIVXUF1T/5m73g9sXdR7dBi6HfpkzWg1QZ+XgVK7sZe40uX3RgoWcjhtcvdSx7 owQ8KPeX6YGHv7VE9lDg2Y54d09qwiXn8wOTE9cBU7lDTkPC/yzByV1fhc/ET5DmcljW +vR+PFcbSWa8BcIqZLo8TZ6A7OrpoqEr2vJ9GdYfK077F91LZgEBblLN2v3y89DcYjyf DiSweVtqh/DI9BpFV37rGARgk/IDvrRvJR45743MgeMg9I2abImnXG7ulwoXMH6SscJb 3Sn6q16bkhuB13xuk850eMxtaCD2QbsJD+jp4e6l8kpEaC+/1pfH/M498uxc7frIp0Am a5bQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@syrmia.com header.s=selector1 header.b="aakof/Cb"; arc=pass (i=1 spf=pass spfdomain=syrmia.com dkim=pass dkdomain=syrmia.com dmarc=pass fromdomain=syrmia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id p14-20020a056a000a0e00b006933caa6f03si1213673pfh.165.2023.10.31.09.53.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 09:53:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@syrmia.com header.s=selector1 header.b="aakof/Cb"; arc=pass (i=1 spf=pass spfdomain=syrmia.com dkim=pass dkdomain=syrmia.com dmarc=pass fromdomain=syrmia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 8C161801C1AD; Tue, 31 Oct 2023 09:53:25 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347056AbjJaQxP (ORCPT + 99 others); Tue, 31 Oct 2023 12:53:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346906AbjJaQwR (ORCPT ); Tue, 31 Oct 2023 12:52:17 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2093.outbound.protection.outlook.com [40.107.21.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C05D3D44; Tue, 31 Oct 2023 09:49:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kQnz0uJk59Ttrs69uQDCKEdeXXzv8FyH5EUYBoFghVn/iH3T6Vq0DbdSdAPAQHCzRx8QjHMfpM3XiIBWB5WrFGhxh0aKrNNzLoqY1hgy0VamF4eSiI/T6zxrxJkO4xwtg+iQZf8X+/7rzmO/9+ileMnGsrkvW0cxr4boIYNqQT3dYPhrAquEh2vsTHP9OttkW2Uhuv82BoluYDgz9VWCooVGOg1qNsijc3E239/1dlFgTfzhsVANAuixrz3/q0MLu8qbEL++zZ7Mafn1EiMopM7q6OD5Tw9OOpMNj4Vkp/aHIzyOlMu7i+hXBJrZSCHscZVjjSw4CzdPLaBH41nJmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=zivLEPzK2yPb03tjtLC8DJTk3RiZnwMaBX5KORprkw0=; b=B6oCupeF0DrNLNrWRM+cbs7kwI/KK9MODUTjnTBA91MqldBqX7JsdgUihOmR7j09eIg4dPuslgpKn/ISCLvPqYAgvh6qyrhWJOmXRQsB0gV1M5Ea41HGbE3waTpPsPVwkaMBYSoQoDkFW6Jc2jh+V8N8aD6Z/+XKdKK4nVI92wCQqA79zkKamII5n6MV4rNxSPksaxd+ZlcpUonQuGO0yqF17sCkrhOtvx9ZvqEw9Bm0M4WwF00/e6QDgbVsE0Li1GdlZVpIssJMyr+fIxF/lw3hlzwTfn2SPMEw44awhSIgkNbHIynPw6eZqbshbZI5rNfXoPwdB3z4UlJDSsYLig== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=syrmia.com; dmarc=pass action=none header.from=syrmia.com; dkim=pass header.d=syrmia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=syrmia.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zivLEPzK2yPb03tjtLC8DJTk3RiZnwMaBX5KORprkw0=; b=aakof/Cb0duhsJ9WXHxO8ZDr2G0A4EKVQpG2w5cD6hQ5jv4KIr6WHP+xEWVl9itx37aR1Vd3vIbz2n7AlkGkeetQBhwZ1ts8gKxM9XclRxuzpVTUA6GAZHGJ7zCkw/9MQNESCbOuJhHiYbDEv2Qd733YvFri2HoXAk1A5y0g97U= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=syrmia.com; Received: from VI1PR0302MB3486.eurprd03.prod.outlook.com (2603:10a6:803:1e::32) by AM9PR03MB7187.eurprd03.prod.outlook.com (2603:10a6:20b:26f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.19; Tue, 31 Oct 2023 16:49:43 +0000 Received: from VI1PR0302MB3486.eurprd03.prod.outlook.com ([fe80::59be:1f7c:f22b:baaa]) by VI1PR0302MB3486.eurprd03.prod.outlook.com ([fe80::59be:1f7c:f22b:baaa%4]) with mapi id 15.20.6907.032; Tue, 31 Oct 2023 16:49:43 +0000 From: Aleksandar Rikalo To: Thomas Bogendoerfer Cc: Aleksandar Rikalo , Chao-ying Fu , Daniel Lezcano , Dragan Mladjenovic , Geert Uytterhoeven , Greg Ungerer , Hauke Mehrtens , Ilya Lipnitskiy , Jiaxun Yang , linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, Marc Zyngier , Paul Burton , Peter Zijlstra , Serge Semin , Thomas Gleixner , Tiezhu Yang Subject: [PATCH v3 04/11] irqchip: mips-gic: Support multi-cluster in for_each_online_cpu_gic() Date: Tue, 31 Oct 2023 17:49:20 +0100 Message-Id: <20231031164927.371663-5-aleksandar.rikalo@syrmia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231031164927.371663-1-aleksandar.rikalo@syrmia.com> References: <20231031164927.371663-1-aleksandar.rikalo@syrmia.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: AM0PR10CA0065.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:15::18) To VI1PR0302MB3486.eurprd03.prod.outlook.com (2603:10a6:803:1e::32) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR0302MB3486:EE_|AM9PR03MB7187:EE_ X-MS-Office365-Filtering-Correlation-Id: eb3e7f4a-3b39-4b8b-b8c6-08dbda3161bb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AF7NbW9PLdqL9aw1/uWuzP/DdQdp/ZcNGKk+INBm+7X3rL1BvD/R+X2t6+eBqpOUSxuNMob5PFQzzpTtazWWk3GrFrXbA/J/etpl1qqOtQeQVG44S9a8s2zG99vfPioeF05G/gQ16bRgwduJuoUADRq+K1f78BtqyXYQIUMNlEWgeGIkcKMj7C37spj9K3K67XwZGKaEvKYnJHFBRJYyML78uM+lJJiR3BLyzbh9W8JrdjtVTiu179ixDCw2l7ct7XbLx7+9OvPIzBnbWfZeXYOyt+y5H+v+OX/WZbBaqyCzzmKAYHpkQqEaJuWzX5ZcE/bt6xFT5wbyyXZwxsLfGTVTL7xR944NqtmdW7qQ21PpmZocnWMocktAx72+hUEMSMHytb8WWWk05TmiEPJBmAyXul2prRuES6mmTMdo5gxg9ETA3zhP7SSJDevAZU0PffLAQ15it6afAWiVcvNz8IuAT3mDj8ctwpKzNSuuEZNRQFZQKGdp3/1zh/xKMW+tmIl7v1Que7Kol1dWBDt084slrPF2A4xfL5m6tVLlXcOnSz6Rbkjc899DVNVhXcq6UAlip6sSgItCJ781dYRwqgKi4aE5cZDmx4kAugpH3gW5xbfTDnejQeLE0JIHlYyE X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR0302MB3486.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(366004)(376002)(136003)(346002)(39840400004)(230922051799003)(1800799009)(64100799003)(451199024)(186009)(41300700001)(44832011)(316002)(54906003)(6916009)(66946007)(66556008)(66476007)(8936002)(7416002)(478600001)(2906002)(4326008)(5660300002)(8676002)(6486002)(26005)(52116002)(6512007)(6506007)(2616005)(83380400001)(36756003)(1076003)(38350700005)(38100700002)(6666004)(86362001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?x0R3kE8UgxS3Fi6zSkA2SdKRmmW3AzyGwX9TII5HLgW1QUM06SzVW6LhKToe?= =?us-ascii?Q?oIgbCtsjwLcEjVOJgemzFlc3cFTx1Xmt6EJ/11zkBDJhHWHeExOZ4brI0qCH?= =?us-ascii?Q?UbMJBtjgAtOA06oAsRVJRBZXiuy4uF0JzxUw7k12902niRM+hS9ZdeUjyvQZ?= =?us-ascii?Q?uevoHKodX0skFGz18gEEadDQDDDgKvdFGxW/yo7yEY34LUFpCWjCzwEx9SoX?= =?us-ascii?Q?TgwQJ/VnQX+WxTg7Rs5moA/Gyg2i0JYqjdEIo3ab/HLOe3YI+nxDWjG9wXqL?= =?us-ascii?Q?zdSFD9gYFgVahxX7O4setuXZp8WXE2Y659blgijQkaIIgbWeWcBszyGHpdV2?= =?us-ascii?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daRZiKpd/QEwkF5jJFliO/Vex64aDY?= =?us-ascii?Q?vRYKpHUonbeK2p0vXPusTJlbwj84U8eFxFJ1hntRiQ5z1io6iz2GSQTCG/gN?= =?us-ascii?Q?1QxlO7gKuElbqzwyCB+qa1ZEXVxp+5OArqqZTT/WKL0acPiCY1rHzq3Ub3+B?= =?us-ascii?Q?W03MXABo6wPV/R0hIzkrvjcvOsXB+BXLbMPhmPb7A0tjCqG1qtmQlekWraen?= =?us-ascii?Q?FYpxaYY/i+ZhaCzAXmzDlDLXRyjD9E/UaE8K6xs6bgK+kK8xVc6KgJISBTEa?= =?us-ascii?Q?qea7L8yPHs/r+yBQ2pIEbQ5TMIvRa1PZboW3z7YRM/fDTQbqLbH8JB3GlB14?= =?us-ascii?Q?DUHPL/s5iUNZEYB88qWBRCi2HFM6+aiMIwEDQ18kXUQJk3PDGSMNPqP0QS4x?= =?us-ascii?Q?4w=3D=3D?= X-OriginatorOrg: syrmia.com X-MS-Exchange-CrossTenant-Network-Message-Id: eb3e7f4a-3b39-4b8b-b8c6-08dbda3161bb X-MS-Exchange-CrossTenant-AuthSource: VI1PR0302MB3486.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2023 16:49:43.2572 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 19214a73-c1ab-4e19-8f59-14bdcb09a66e X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 8chkTFbEuC5q2LC+w3S30s5jf7gpb1FxPlF8zoZEKhPUsSJNfebhcMJzV3H2g/ut0Suu8In7BULBbEYHJ2BQfjjI3baOQKbBk+FzShRHlTk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR03MB7187 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Tue, 31 Oct 2023 09:53:25 -0700 (PDT) From: Paul Burton Introduce support for multi-cluster GIC register access in __gic_with_next_online_cpu(), and therefore in its user for_each_online_cpu_gic(). We access registers in remote clusters using the CM's GCR_CL_REDIRECT register, and so here we delegate to mips_cm_lock_other() in order to configure this access. With this done, users of gic_with_each_online_cpu() gain support for multi-cluster with no further changes. Signed-off-by: Paul Burton Signed-off-by: Chao-ying Fu Signed-off-by: Dragan Mladjenovic Signed-off-by: Aleksandar Rikalo --- drivers/irqchip/irq-mips-gic.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-mips-gic.c b/drivers/irqchip/irq-mips-gic.c index 9e7182150b5c..317ccc2593d1 100644 --- a/drivers/irqchip/irq-mips-gic.c +++ b/drivers/irqchip/irq-mips-gic.c @@ -70,6 +70,20 @@ static int __gic_with_next_online_cpu(int prev) { unsigned int cpu; + /* + * Unlock access to the previous CPU's GIC local register block. + * + * Delegate to the CM locking code in the multi-cluster case, since + * other clusters can only be accessed using GCR_CL_REDIRECT. + * + * In the single cluster case we don't need to do anything; the caller + * is responsible for maintaining gic_lock & nothing should be + * expecting any particular value of GIC_VL_OTHER so we can leave it + * as-is. + */ + if ((prev != -1) && mips_cps_multicluster_cpus()) + mips_cm_unlock_other(); + /* Discover the next online CPU */ cpu = cpumask_next(prev, cpu_online_mask); @@ -80,10 +94,16 @@ static int __gic_with_next_online_cpu(int prev) /* * Lock access to the next CPU's GIC local register block. * + * Delegate to the CM locking code in the multi-cluster case, since + * other clusters can only be accessed using GCR_CL_REDIRECT. + * * In the single cluster case we simply set GIC_VL_OTHER. The caller * holds gic_lock so nothing can clobber the value we write. */ - write_gic_vl_other(mips_cm_vp_id(cpu)); + if (mips_cps_multicluster_cpus()) + mips_cm_lock_other_cpu(cpu, CM_GCR_Cx_OTHER_BLOCK_LOCAL); + else + write_gic_vl_other(mips_cm_vp_id(cpu)); return cpu; } @@ -105,6 +125,9 @@ static inline void __lockdep_assert_held(raw_spinlock_t *gic_lock) * * The caller must hold gic_lock throughout the loop, such that GIC_VL_OTHER * cannot be clobbered. + * + * Please note that if you start a loop this way, it must be completed to the + * end, otherwise, GIC local register block will remain locked. */ #define for_each_online_cpu_gic(cpu, gic_lock) \ for (__lockdep_assert_held(gic_lock), \ -- 2.25.1