Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1402600lql; Tue, 12 Mar 2024 16:54:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU5lCG+APRlOu5SOWmgemvuqjqWi5moikN3U8+wa+c7+BQB5LiAj4HDG5LcMolJ5NpU6Bj6BNLz5Pq67RnkNsBgUBvkDzyV7EMNuojaYg== X-Google-Smtp-Source: AGHT+IFaHgrEs4qK1lv3DohMCZYdDrg/q6n5jkgjYKPZeYKH3lsb8s4LgYq86R/Slrpf3d0Pa2br X-Received: by 2002:ac8:5888:0:b0:42e:e136:2198 with SMTP id t8-20020ac85888000000b0042ee1362198mr15494753qta.62.1710287680539; Tue, 12 Mar 2024 16:54:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710287680; cv=pass; d=google.com; s=arc-20160816; b=vs4nxmVBCPajyXFh2ygwenytnuorQYfAq2lhTXqAQA+8DcAQCT/K7v3qr8+vFju0en 6wwnNDhq+rNAaEAP0j08ajoFvYOThKMOiAap55x5npiulVLgaxG+3Ba5im9sABGT2XMz aK8S/iUs7UcYoNzH2lImjjB1Iks26ARfB8wjXNeYHcBUiUvC1GgHVQvUfPSBIm6ArV/R fJ8lAyqwtenIBAmmTjrMmTaPKL1YL4owNrEkqk3bFRn4Ujqhehasord75UO90L09eyEJ Ya5OMCVS1TNydrLHKkDXIibZyaWBFFcDL/93UPYW2zUcjS1J8s4ewYYKi2hyj53+3X7q BdfQ== 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=7WqC9EYNMp24I0Ah4fci0KUqmT8EqoN79+NZmIklXBM=; fh=6RhT850c4qZi5AiNa5ovBZreAPCBADTZhwYAEiq+D3I=; b=JtIXleXfYkEgzzRqu7KBwtqnixmzzF3y5AHzWm42kuPtb4EvVzQxsGpbVuBIqN+b9o ERyf1vKj33o/JVsEnTIZjStBHsENs4i4at0KUJnLjy1vpWX0rm9WEoHulamZCM+CQBlf nBl9yyVStu6FAEi+CJ40l7VxumV8Fv2qabjilPdnicAhXdUJ8U7dr0Pvqwtbed7NR9q/ rfKLlBXr3r0fGejHEXMj8Ml1IYbf4XQMK62WcB2iVfeoRY03U0xDXcNsOHqnaVVDsJ1i jWmacKw1pjki26Y3cbC70CDGv0FI4AuNjdpHziyAoQm5We1Ym9O/ZfHrdr2N+Br41mir E3VA==; 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=kpcjM1NY; 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-100945-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-100945-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id n8-20020ac85a08000000b0042ec9b05d21si8755604qta.734.2024.03.12.16.54.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 16:54:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-100945-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=kpcjM1NY; 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-100945-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-100945-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 448521C20B05 for ; Tue, 12 Mar 2024 23:54:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 541E057312; Tue, 12 Mar 2024 23:53:51 +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="kpcjM1NY" Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.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 D009750A8F for ; Tue, 12 Mar 2024 23:53:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710287630; cv=none; b=M+ZK6q/DwNfm7xIJSgiq5A4E1HykohOSDEXqvceJ6fbPWYvGs50pDUaUoOdjc3QJJ8pFnzogfGv5lhioaObhuZQf8oxA7rliahmd1oGay8IflhbZA397KCukzxbJja+YsGUo3ahkItmMxOjNYBgGE/3JkjetYeKmeD4Ri/Wrh0g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710287630; c=relaxed/simple; bh=6GJ6p7yMdN+ouzHCZ+tS6sWbsz3sQSlgY1DwzMvWuUA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YmQZg6B0YGEjMBXpPTDrHtaQytvlmLb5Scb1S+kmhW3ywTEtREXYTz65TioeNDDAy62h6QvWI5H34QFMcYELhXvf+6iU2wP19B3+K08ob1UOrOteXqoMxkH8WXP1hfMY64R2hg1hiL4z0M0YJPdoKEOXFl+PFjXJRhRvdHwNY9k= 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=kpcjM1NY; arc=none smtp.client-ip=209.85.215.170 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-pg1-f170.google.com with SMTP id 41be03b00d2f7-5ca29c131ebso4907622a12.0 for ; Tue, 12 Mar 2024 16:53:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1710287628; x=1710892428; 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=7WqC9EYNMp24I0Ah4fci0KUqmT8EqoN79+NZmIklXBM=; b=kpcjM1NYWJfzoyhcm33MAO1RHEFYP9BGkke/bgGTwNbKOGRr0gXG4KrNh1RM9yFkGp nVnHcePmY7aywF7UscF7cuLJtBWWuZK13HRyGbBzLEXr4icJa4rVaED7CfJJxGfeSPEL 13V89pVcVuyQHn3sQI8KKA7UqVfMp2H7lGoGDRR+TOIIcT9uPY2mWMCn2nqAZgGz2gfK udNSrujjE5yacYYquALQ1ubntfZKsIJAZ8Cnk/CUE8fXqxeEDpYrYxScyigUwrDwUTI1 9VV2ADveMauBMBjnomQF7GrLFFGDuztBlYwQyPagbjDLkw3mpqputMRVD3mRBLL/8ZxP dNJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710287628; x=1710892428; 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=7WqC9EYNMp24I0Ah4fci0KUqmT8EqoN79+NZmIklXBM=; b=Nq8NKwii7bCuXPT+N6c9YN+KtQtNHknZBXV6wx6c/Q5mexpxFMN5dWoL8fBFKWN/4a YLjInpJiTgMCVXKihr+7Cu9HK1HrqfoXbx7CD83EWwR2+KrQd9U/ARKL5T875tg41ewE znwjZ14SRYTlai4t8Cv3BEwzDsj9Xf09TnN1ELm8xOjTL8kSGobKtXI0hzMmxSo3Xzd7 sQHo9zWC7OOjAs5RDpj6ybX9IsxJULxnLEqjPU82dZ5Qav/xowM8oHFDHjhsVILGbUMv QTKw0x5mVPKTe6IvEjIdwaK4yUJYlaIczqzXR6S07/6SyGNvZtmtHjFe0wBYYR9LNuls e8Cw== X-Forwarded-Encrypted: i=1; AJvYcCVTJ/tZlW3Cn14qfriA51kdw2SlSnok3mrWwtqcbty2Ty1JRroMc8vbgHqJh1anGGKa1t8CPp94Wr8VfAsJNmaMgjFv3FDOr5DxIz70 X-Gm-Message-State: AOJu0Yz53e285/d/FsPn7BRiLOSDXl23PG0YgkDCsLle0LIIxUsbdajl UijshsfYWcFfw2Y5dUTLHX1H41ZkLtrpFm2G6vFwMBOiqd993r5rTnKMqyanvFs= X-Received: by 2002:a17:902:ea0e:b0:1dc:ce6e:bf06 with SMTP id s14-20020a170902ea0e00b001dcce6ebf06mr13980467plg.0.1710287628171; Tue, 12 Mar 2024 16:53:48 -0700 (PDT) Received: from charlie.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id h9-20020a170902f7c900b001dcad9cbf8bsm7282844plw.239.2024.03.12.16.53.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 16:53:47 -0700 (PDT) From: Charlie Jenkins Date: Tue, 12 Mar 2024 16:53:43 -0700 Subject: [PATCH v13 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: <20240312-fencei-v13-4-4b6bdc2bbf32@rivosinc.com> References: <20240312-fencei-v13-0-4b6bdc2bbf32@rivosinc.com> In-Reply-To: <20240312-fencei-v13-0-4b6bdc2bbf32@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 , Samuel Holland 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=1710287621; l=1674; i=charlie@rivosinc.com; s=20231120; h=from:subject:message-id; bh=6GJ6p7yMdN+ouzHCZ+tS6sWbsz3sQSlgY1DwzMvWuUA=; b=VgSJhrp/XA7/5Nj4l4UWBqCdsrn4rRXnIv9+QzM7vEeIgZHPzHCs2KUaHtvu93Hal0LPGPw1M 73ATSwpKcf4AF3ewBvQne6ZnvAPUXPu0x9vXxZvQMNWILesdQgSr+Or 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 9b74861000ae..0927df96c0e9 100644 --- a/arch/riscv/mm/cacheflush.c +++ b/arch/riscv/mm/cacheflush.c @@ -169,7 +169,7 @@ static void set_icache_stale_mask(void) 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); } /** 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.2