Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2746272rdb; Mon, 12 Feb 2024 15:37:23 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUx3GptRoKTmfWg70vSzVlMj/5n77sa40fx+wiBgGBY6Iwjk3H5xdnh1f9pEdNlbwfQFL6t+RmXvWYj80rL0xaZyIiWPu6jpGUOJHniCQ== X-Google-Smtp-Source: AGHT+IHhBLuEIEnE7US1gcU+iDYgedkCZKvQUQUtrtsS4J6KLNt7U3tnUH1zw63BuS/lkRowFAdk X-Received: by 2002:ac8:7eda:0:b0:42c:66d7:bc06 with SMTP id x26-20020ac87eda000000b0042c66d7bc06mr8202509qtj.32.1707781043500; Mon, 12 Feb 2024 15:37:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707781043; cv=pass; d=google.com; s=arc-20160816; b=Jud+JvFJRDfuEBYBio/R2lFtw0qAfwoeQikIxvBksTImHnnSiQe/+YJWf4MrSUJcwe x028W/P/tFWMLuyOHJDKAlbFCO2ba1qkFOVqWLxdqiHCn7tBbhfDCARKR/Nv6BFCGRBn +FnpBTEUOCiB8ZJ11Jb4j1AkVyfUXwNJBb/Dd+Di7NK5ddKhxV/yrBToMJYSqwFKUIcv b1uJ9w3NX29FCqmSXpP+XEnfFKKmTwX5oMJ20eGYWd2996OYvyzzHi1MmD/6mYN4iu9C Y64w4a77p3X4rDzLuut0t/wdFLeOzNcQGMHBS3yrElFkiDgx1j+vWCEoQGeqlng2p495 ZBEg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=XqFsnYbayaROauH/yeBk3F9rNPdoEfeRLt6dO0Xr65g=; fh=33DhJ8qQ5GZ6wg5nalKtfeiEw9Nnan/lKLnntBUmkOM=; b=s4zUTaInUko14jxMUd4MUzhPj6CGIbxtsZqpJJmRuM4BKc/+cGbmoeg0n2Uhz4sh09 efyMs2u+xKdEy0JH37TkhnLqZwGlil40X0QrtrSFI1rkpJzhUHh+vu7YATLSvlImC6eO HAAD7sKlA8ljFmuBZ9nyQppk1tf2Woc6ZCBxIwxwAlN7TGzsg0avNzs5LqwLc+eqRz0g PkXBTMpmlV5aH7+F2xZj/Ud47CDEP8GEJ+F7dJOh/ApN9zpMssPp3X5Ww0tFfadIsBRn 2xUy0LGDFecQ62jpzdmvj77ouJhWqaY6+Mc2OWkIugx6ClFYW0i9N5v1fMvPtz6ozo7M ml7Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=Q35k1rqB; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-62546-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62546-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCW7/ipCAy/PK1bz5FP0/7rFgHaGuslvKjiMpBBK4Ef2omzAo/yLDUNK4HQTRJkyoY1p6dGoPcfgud7/x40xwJFHz0RHT79Vw36u07nmkA== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id v22-20020ac85796000000b0042c06c69168si1756638qta.622.2024.02.12.15.37.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 15:37:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62546-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=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=Q35k1rqB; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-62546-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62546-linux.lists.archive=gmail.com@vger.kernel.org" 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 35FEE1C221D8 for ; Mon, 12 Feb 2024 23:37:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C9E56524C4; Mon, 12 Feb 2024 23:36:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b="Q35k1rqB" Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) (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 685F651C31 for ; Mon, 12 Feb 2024 23:36:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707780998; cv=none; b=XTx7XeUw35by2SWkhpjdfML93WoJ+R0xvpGyA4HUdeJ5Cm7j5EuB954P9/ZxDseCL3F8HVQrCnCw3KBScYLQzohdVwPc1a2WbfY/xCriEC+RMmV5VEnynstv1KCIhitHWhGyEJ8c3eZ/lb6ho8EOohfFOud5T7K/8TkkDkLJ/Pg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707780998; c=relaxed/simple; bh=teNltxEe5ATnvQPKeLgPp6b3k0t1rOkLmnDUUB6OJdA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ekSE7LNiTs/Y9P41nvP9mJR6NhyWIaQ9f2xCmIDItJCy6Z1G6mnKdASUH+VHZ0TeNLgidjHTKrMhCGGXUmJvjdlk0iqw0Nx0JfcCFjqm0z0K4ewn9hq2ulNSARV4mb2xNMkTon16R5fVA6OEOwAdm51IHXRXBXW8JihgB7pw4wg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com; spf=pass smtp.mailfrom=rivosinc.com; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b=Q35k1rqB; arc=none smtp.client-ip=209.85.214.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-1d70b0e521eso28788425ad.1 for ; Mon, 12 Feb 2024 15:36:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1707780996; x=1708385796; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=XqFsnYbayaROauH/yeBk3F9rNPdoEfeRLt6dO0Xr65g=; b=Q35k1rqB4YpMTGpKAqZt4kbWTfOmhg2zYuJUOvj36dLLgAXt9kV9jorYIu0+StBmQR xKVI+uL5b9WL02m1HijiMafaYxzXoG7N6unUh3nCvxGrduvMXh49gmZQDmBbfF7Lv6or UutyATMyanVGpvgko86IVXA+UeMLd8hqycxxYBR6Wx+WbnBdvLPp47cVwa8VgQw81bGb YUbOlZnL2iUdAMlk3KNB2JsyCN8MO6aI5cE56oFb4pN2VHZjM8rkFw1Jsa6ZNZHLvDby x7MzBJrqxuPpf2crusLzy7BkeG4BuyJ9yUnUWBFnl7F3AAwwKxMCQpw6MkDrPin4QhS7 /mGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707780997; x=1708385797; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XqFsnYbayaROauH/yeBk3F9rNPdoEfeRLt6dO0Xr65g=; b=L8KICoPf4c4s62JOrHklgEKmjNYKa5pCm0tBFIA9aFRuN2HYFPp+gPvqshE8ABEVcA v9WedOjPEcC1i0pTBlTHqnHaz8MSftVKuNuClb0b6UuIK3CbBZ3wKWBp+TzTJnFQtv1H CntHfa6JQ9TOeJh2cUhOWzxMl6b46J90gSYsof/N5aD7+KIz13B2X2r8JbBZhi9Y1/G5 TdqrddKZaxzECQvXqKLDcvUKPZUeOWX/8wapfmDPDXhKAqknnIwHRVbYxhAbHdeJFLTH dYmw7APJ3W7cA4BqCpUWKYvbwqvnryF/R/bHUXzrAUnHZGoY9kW8fIGoEv/16+0E45ru TqyA== X-Forwarded-Encrypted: i=1; AJvYcCUNErQfvIXmpL66YlHHZq7QN5W+wcbuMk2j8JTmVY2oSKuZHp8DvDIwgeVe6Zed6Pqqu8W0y+eDRP0+CGnWCuGoMLcIA+/jdUFOZnl5 X-Gm-Message-State: AOJu0Yxb73RrMd0JLLTlk8/fqaN2vaHtDta87K5MjhjddT3dR5H4Z4Fz N++cWF1BVDuFyKxrc7GjPacFNAWxPAXaqqrRTDFnafLwD0Ntlbz5eFmbtOqF0cQ= X-Received: by 2002:a17:902:ecc1:b0:1d7:b1f:be9e with SMTP id a1-20020a170902ecc100b001d70b1fbe9emr9547643plh.66.1707780996763; Mon, 12 Feb 2024 15:36:36 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXmhahLkBycaRs+zzoTPL0pP1/Wbhljlk09mGvZl2U3BYlRz5afgzfA4K6oqUcu0CEflM4zj5+TqIePAEv1u9fURwIXrlf9AzC8VlXIv3fVP2DyI2ElWKkAeanWCs3jfOGB55CzBhMOKNK7t91AFuCyfpr4hG54nAJds3f4sSV/prcfAWmcrnbBMVlm49hPtTlMiLw3bu4G8rxu4OuobxGyLSqhOg50X9uwZDi/69PwQrtG4GAJTMhS1bmhY8NjeEdYt7zKMUFhPBN5NmfRWbF3Ci7F2uELrXj92QbZKRN/KTacsTyfNLYjc/k9bL7lSTdk+FXPauBA/9p9ZxViYmvh+WCSf4bb33CHZnad4402Ud3kDU2e9RlKDluUzWsPPLzK4MwXbl4= Received: from charlie.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id b5-20020a170902650500b001da153682c5sm888693plk.261.2024.02.12.15.36.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 15:36:36 -0800 (PST) From: Charlie Jenkins Date: Mon, 12 Feb 2024 15:36:29 -0800 Subject: [PATCH v11 4/4] cpumask: Add assign cpu 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: 7bit Message-Id: <20240212-fencei-v11-4-e1327f25fe10@rivosinc.com> References: <20240212-fencei-v11-0-e1327f25fe10@rivosinc.com> In-Reply-To: <20240212-fencei-v11-0-e1327f25fe10@rivosinc.com> To: Paul Walmsley , Palmer Dabbelt , Albert Ou , Jonathan Corbet , Conor Dooley , =?utf-8?q?Cl=C3=A9ment_L=C3=A9ger?= , Atish Patra , Randy Dunlap , Alexandre Ghiti Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Charlie Jenkins X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1707780989; l=1797; i=charlie@rivosinc.com; s=20231120; h=from:subject:message-id; bh=teNltxEe5ATnvQPKeLgPp6b3k0t1rOkLmnDUUB6OJdA=; b=EiKlcL1ulk4DvUiCSUgvbFtR389U08UGs9J+Mx1NjicMNyA7ytjbg4bgirWaWZZtdE5HGgwHU EVUxZnpx4C/A+JHiRo45OTnP3oYSGtoMtT2ZFchA7WKDMysLkz7sWPx X-Developer-Key: i=charlie@rivosinc.com; a=ed25519; pk=t4RSWpMV1q5lf/NWIeR9z58bcje60/dbtxxmoSfBEcs= Standardize an assign_cpu function for cpumasks. Signed-off-by: Charlie Jenkins --- arch/riscv/mm/cacheflush.c | 2 +- include/linux/cpumask.h | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/arch/riscv/mm/cacheflush.c b/arch/riscv/mm/cacheflush.c index 6513a0ab8655..d10c2cba8aff 100644 --- a/arch/riscv/mm/cacheflush.c +++ b/arch/riscv/mm/cacheflush.c @@ -234,7 +234,7 @@ int riscv_set_icache_flush_ctx(unsigned long ctx, unsigned long scope) stale_cpu = cpumask_test_cpu(smp_processor_id(), mask); cpumask_setall(mask); - assign_bit(cpumask_check(smp_processor_id()), cpumask_bits(mask), stale_cpu); + cpumask_assign_cpu(smp_processor_id(), mask, stale_cpu); break; case PR_RISCV_SCOPE_PER_THREAD: current->thread.force_icache_flush = false; diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index cfb545841a2c..1b85e09c4ba5 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h @@ -492,6 +492,22 @@ static __always_inline void __cpumask_clear_cpu(int cpu, struct cpumask *dstp) __clear_bit(cpumask_check(cpu), cpumask_bits(dstp)); } +/** + * cpumask_assign_cpu - assign a cpu in a cpumask + * @cpu: cpu number (< nr_cpu_ids) + * @dstp: the cpumask pointer + * @bool: the value to assign + */ +static __always_inline void cpumask_assign_cpu(int cpu, struct cpumask *dstp, bool value) +{ + assign_bit(cpumask_check(cpu), cpumask_bits(dstp), value); +} + +static __always_inline void __cpumask_assign_cpu(int cpu, struct cpumask *dstp, bool value) +{ + __assign_bit(cpumask_check(cpu), cpumask_bits(dstp), value); +} + /** * cpumask_test_cpu - test for a cpu in a cpumask * @cpu: cpu number (< nr_cpu_ids) -- 2.43.0