Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1296770lql; Tue, 12 Mar 2024 12:48:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW2OXcB5vAkt3irFrkln16K4fw8AZ7oelqLeHsiBPT1zgwEno0dxMTuuPp6oih2BXWJlBKnpX1d+esOQUAbt/6ZTty9/PKYjI9lC1thFQ== X-Google-Smtp-Source: AGHT+IEfOktftvuRXuUWs3PFToKPxmxLGY+sboWhumNiy2M3wBNtW4TgT/j4oQPPrtQkOJgTbB7a X-Received: by 2002:adf:e98e:0:b0:33e:7062:4c9 with SMTP id h14-20020adfe98e000000b0033e706204c9mr376562wrm.3.1710272920949; Tue, 12 Mar 2024 12:48:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710272920; cv=pass; d=google.com; s=arc-20160816; b=FFuBrxZiqASzdiQwMcRDVSJf7XysypHuoPj/kHGC6xXKieeAhsSVyYKSDMwhxIXFrx OlHfFjzTW1H5kGnpih/3zalMf/YN3j7ISrrL3U7TR7laml/fSJzGIqYkNCvBUKwAhTKB Ouw1lACh5txRgAcEsoy9XpcNQLitaH4BFpoSGIggZjMcNxLI0PcI4BPP43kL6YcihKMD bgt/rjG/fqmSzwaIq51K1rAqk4TyIY/QljrtTciDHJSmmWkSc7ZMN2PE2yTtt8rHMS/1 U68CXvwEDcDvlAe/SdxA62KiV9l2ZxtLlsLzm57NwSLtXlnVMoIyzF4ELTNqFo73Y8+3 EzVw== 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=k4XSa/PSXORT4uTdUR+bw2OZtjIlaWQWlwg5OyZv4ig=; fh=K/RoPk2+Jgh2bJ8F7I5QX3h7HI9p7q73CmC3/YbkgqM=; b=nrruu9omu3A6H60vc+NEB5in6w6S1+jOb7/59ATCNhE28ewt/8IMopnfd5Ne68SNNJ M39qrArbPqYKLSjckze4LbwTt/EwfViYXsjzA+Ct2Kr8HlCJIJqhSHGMT6T2tx2PL4Z5 MC18uUfm4pjKVg/RLB38270uRbq6L3Zz2fzPaN96r2eUimzahn2hOfSuyEaMAbuMJDqa qpCP3lL0gnqISoDFHFZmgNCqCY36nrqE8Ae2J6PILP7lduquTT7ke4ERBns+QvxhqcFf aabTBHBd6ipFXHgrcJcWLwJGEGm//hkx3Vsxd/5mNK9tK96C6qjaNgk+RGbpLeKv/nMt 65VA==; 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=3H5ZUf6R; 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-100727-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-100727-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a24-20020a50c318000000b005683094c7e1si3649338edb.540.2024.03.12.12.48.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 12:48:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-100727-linux.lists.archive=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=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=3H5ZUf6R; 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-100727-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-100727-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 am.mirrors.kernel.org (Postfix) with ESMTPS id A78011F23EFA for ; Tue, 12 Mar 2024 19:48:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 42AF714373F; Tue, 12 Mar 2024 19:48:02 +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="3H5ZUf6R" Received: from mail-oo1-f44.google.com (mail-oo1-f44.google.com [209.85.161.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 E0ED514290B for ; Tue, 12 Mar 2024 19:47:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710272881; cv=none; b=kiJtaIfaN5i8VAZ1t3QLoEVXg37S2PvlBxQPb0uReRhU06cw0ZLfhwBRAFC+hHLt2GhNdRn0/CeWfxAfzGm+kzvycAziU7kmgV49Gr14HZJi56/B7r7BkYVLL4Scc3hYWlamn43jHr84toV0kV2PDbn1x8+l8cat7Y400uEWu/g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710272881; c=relaxed/simple; bh=BFOeXqJe9VyECGMuWiCNLoTZwBpuu0T2u1Mq+P/cqDo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RdmffKgz/i4cKypxg1LnSK9sXHFNCLHI6wSwr3g9r4uY3fWJP3LZdOB6NnIjfVPSjle7/L96TxOv8bKr+M4E08ZFbeq+DrHP51h1HGkyy2J3hIjilMoCfPJL5Sghp+7q78p0fuvP+Fz/KRqnyDhboiFYCn5+pNTzlPa4ItTQm7A= 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=3H5ZUf6R; arc=none smtp.client-ip=209.85.161.44 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-oo1-f44.google.com with SMTP id 006d021491bc7-5a22d940ff4so462291eaf.1 for ; Tue, 12 Mar 2024 12:47:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1710272879; x=1710877679; 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=k4XSa/PSXORT4uTdUR+bw2OZtjIlaWQWlwg5OyZv4ig=; b=3H5ZUf6RU1lQQGj/bvMwxqw2skT0BM2V1JAvhbJWo3pFIADpfHK69fFU3QwTjE//IH RuTZZp/foAv6eTPyrIiWUJ4lrOAEBPHqNQzGdlMiwykUNBmlhKZ3KA3dJK/ZmcWdJ2W6 YcOFyt638PyoLlYPXWybdKbK0kwz5Hp5jJy8G8n9/kTwxNArZwGAZDDq4EJ+zmqt4jKj odx7M6PcT/c/a2NOhu1ZFYYAIzhYQEyeCv0g34GmkI35rjkERxxsZqEH5yWPAV2rASRr bEqAhKy2PGOux2RCXvKQQnpDHqiaeIygOlcOV4Ht2bayTsdH1c2JhrsQ/pRL/yYE4Gmz 3rJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710272879; x=1710877679; 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=k4XSa/PSXORT4uTdUR+bw2OZtjIlaWQWlwg5OyZv4ig=; b=arZk0ztWD4YBJ+Go+hhIkOeM49GLega5Qid9lUNIwvGD9XgzE6lNQ4xmYwLSxYVcCD vMC7pK6DZ05uLTXnRBV2vNmcH85cnuxsahkaDj/8SNJHjXrLObvUP6fSovH2vA78Ur23 gHJDhYAclQGN9uu2bt2WI0V6ya6ls3JAWFB6D2n34jZhJDDUO+kd4sukhUgrN3Qc0rYP JqW4g9zaRTgVl2psEDr6ZzhoVMmG9S15dfVu0pGiTdRjuzgxhf/UhliSdik1mDp/dtId kX+jWF024zA5jqU05n7+X6Kmx+QyWhXoQK0CZbKhozGF1OSsjCPM+qIhmeOdAiS3P0L/ 5PDg== X-Forwarded-Encrypted: i=1; AJvYcCWXL63JmtHexceV/Ut5zYirb/iZMkVSZkzyWjQRO1oyYFe5FViK61qfEMD+qxDAnWslUppeEULPH8mFxJfy1pmufxTxxAZ+7vdWz0iw X-Gm-Message-State: AOJu0Yy8msJTRYRGOl5pCAC63KTRqGkCVLBf1UcfFMAB8T073U2q+ljG vr0YVAgd0RTlhMALyVcdcuH8id0g3ERl+54R5PwMjlH6HiwUNP5jsuagkNv55EA= X-Received: by 2002:a05:6359:5f9f:b0:17b:88c2:5c13 with SMTP id lh31-20020a0563595f9f00b0017b88c25c13mr12958442rwc.7.1710272878964; Tue, 12 Mar 2024 12:47:58 -0700 (PDT) Received: from charlie.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id z69-20020a633348000000b005dc884e9f5bsm6433495pgz.38.2024.03.12.12.47.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 12:47:58 -0700 (PDT) From: Charlie Jenkins Date: Tue, 12 Mar 2024 12:47:54 -0700 Subject: [PATCH v12 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-v12-4-0f340f004ce7@rivosinc.com> References: <20240312-fencei-v12-0-0f340f004ce7@rivosinc.com> In-Reply-To: <20240312-fencei-v12-0-0f340f004ce7@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=1710272871; l=1746; i=charlie@rivosinc.com; s=20231120; h=from:subject:message-id; bh=BFOeXqJe9VyECGMuWiCNLoTZwBpuu0T2u1Mq+P/cqDo=; b=dUaXZnD9VQ8vsLYsKXOkCevPuNYqjQqs4wBvroTCyGKXR0MwtTqi+kVmNS6cpmRfvj+9eBpTV UJ9TU9gIUSeDYCpY+ggkBt8sv4yB1OqY2YjqtfD0d/3rv858ooSwNYg 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 329b95529580..2e16ed19e957 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; default: return -EINVAL; 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