From nobody Mon Dec 15 21:20:08 2025 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (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 CBDF923A575 for ; Mon, 13 Jan 2025 11:23:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736767433; cv=none; b=n/wEz5RC78PH9IQOBCmgmtkZTw9jUcd39gBY8DAnAHE7ah5GjzQBnZpObk7VanNOCQl4dbw4gbX2rZc7zLj9YQsCRItFh0727dmBpBlXZl7Qg11rz54LxmIchyG1sepM/JlYnFNKbISTX8icRCUWnraRaz+r6l/lapRiFaPIusk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736767433; c=relaxed/simple; bh=zpYDXqsOf66H5oUlZfzc8U4T3Ym6DA5SpJV3ddgDOqM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=WMYjev1zbuQ5QHshyPV+Vw8tcoZtwOwez9ux0dvPa6/TplsJrldeQj2OBml5RnJYGpYRRaoyDLq2QSQkqqmvx/xnDSFMqxuIeS9VqoWZxyCD0/m9oEBWEV/LKFjuyVQM73M/Epn0T5lBY5jKrSzEaa68SQKEP00fgt5z7GRKBbk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=bfRBwU6z; arc=none smtp.client-ip=209.85.214.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="bfRBwU6z" Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-21670dce0a7so86474585ad.1 for ; Mon, 13 Jan 2025 03:23:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736767431; x=1737372231; 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=6pq5lDpyHLAZUwHZL3qfvRqj8bZ5lnU8jFdny8YX3GE=; b=bfRBwU6z8Kn6jFtS42kbw6bXFOLddaA5LWH0bKWeb5vLVwycl94DItaHPlemQ18CKh zrBAKVKpPyNEhvl3wpiHZnbDZN9TOd6cYLwIfcHbyGJVA0NPrr9DPV2YsD3nt+DhS6Cn a3AxVjNvRyneCani2PgMDtFZU44XzJrL+llO7qBYV0kvSwwrkhenDQrKzfrQJaHkGwnW TQoPqGL5PBWxFumNaKMkujGhMMtkWZ9J69+p20VvMqMaicmcFKgosfJcxBmBoWKMjhnC 95xhRvAMxwHeFa0qReX/zJi6LRRhFrJ7n53TArofUsBfJWuWhsW9AoRFgbw/WgxS/T+t 4wIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736767431; x=1737372231; 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=6pq5lDpyHLAZUwHZL3qfvRqj8bZ5lnU8jFdny8YX3GE=; b=mL/exquj11mm53fDP9luSYErOrvWimo/J5bjHbz9piBgwmbo5cQ1o7wlhOngW2qGTQ cD7T18w7n3giUfkyt/Nj3Lc7tjTHkYDRLRrUIxiV5eqxhzMeVnq8DUhWSnYtwcT4Kadk ZcHXLoDylaorsAQ6qczjGjF1Ig67B5z1vm0ieOuae7ql8/WS7eYjtOJ0Ngm4phneYvmu jmr05STZn7LLUt5kZ+xAOgOO8+AqKzinuT3VJIF663GucNAngwlXSlXuRuGsRIZMxMW5 kCngPEQU7x8crVAe8vz4cHSrYwJmEKqP0WGUMvW1Jcun8EvrVap65impfUAFSVPCC50x SzvA== X-Forwarded-Encrypted: i=1; AJvYcCVR3uz50iur42AfIQGWzSIKAOB+dkzSkDDAqYo27IXXw8nrofOHiDZKBYIvbtuvpkGA7N1TmkxhcEmPriA=@vger.kernel.org X-Gm-Message-State: AOJu0YyDvGXCmCvOJL2e8dxQgSAerrGcZ9hyxCxUePK2MD4tlY2zJYpD x8R7SoAnsdncRGNx9325EdCAM8M/27VuRusF4KqPIW8hl9ZxdzUu3ZhBS5V57cE= X-Gm-Gg: ASbGncvUJd8b/XgtEJ4mjYzp3Lx5MYkB7oPskFs17afgm/hk2DmHTw8lnabK7nFlZ9o YUk5OWkeZlm1UCzefoF5eWQdJ2VMrKZ8ePsHveyW7o5xGDS65Xe2VqMvp8XQga/vcq2gmxWD1yT OvZDS9KIiQwaFtb4dYx/wrdwbkeYF5/bgAwywKbBALKKIfecwpP6i3HnQaC89ZWvKGgnsUu9tXv ZNKZ/TdQgMbI5Z09UDKJmDxg8FbBHv2NwRTBjQyeU//YwPklS4vJr4oCGU= X-Google-Smtp-Source: AGHT+IEOjxJGVr7HBQVa0jzU1CKfFnjVBIzuSJp/j9DkYQxsSgo0CuPg7K6fdft0Ynvn0NGP+sGtsQ== X-Received: by 2002:a05:6a00:10d2:b0:725:9d70:6ace with SMTP id d2e1a72fcca58-72d21f5c141mr27897173b3a.6.1736767431251; Mon, 13 Jan 2025 03:23:51 -0800 (PST) Received: from localhost ([122.172.84.139]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72d40681b3dsm5683664b3a.153.2025.01.13.03.23.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jan 2025 03:23:50 -0800 (PST) From: Viresh Kumar To: "Rafael J. Wysocki" , Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org Subject: [PATCH V7 05/16] rust: Add cpumask helpers Date: Mon, 13 Jan 2025 16:53:00 +0530 Message-Id: <5260b6f0308b67ca5cff002e95108504f04cf923.1736766672.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" In order to prepare for adding Rust abstractions for cpumask, this patch adds cpumask helpers. Signed-off-by: Viresh Kumar --- rust/bindings/bindings_helper.h | 1 + rust/helpers/cpumask.c | 35 +++++++++++++++++++++++++++++++++ rust/helpers/helpers.c | 1 + 3 files changed, 37 insertions(+) create mode 100644 rust/helpers/cpumask.c diff --git a/rust/bindings/bindings_helper.h b/rust/bindings/bindings_helpe= r.h index fda1e0d8f376..59b4bc49d039 100644 --- a/rust/bindings/bindings_helper.h +++ b/rust/bindings/bindings_helper.h @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include diff --git a/rust/helpers/cpumask.c b/rust/helpers/cpumask.c new file mode 100644 index 000000000000..0b371826a13c --- /dev/null +++ b/rust/helpers/cpumask.c @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include + +void rust_helper_cpumask_set_cpu(unsigned int cpu, struct cpumask *dstp) +{ + cpumask_set_cpu(cpu, dstp); +} + +void rust_helper_cpumask_clear_cpu(int cpu, struct cpumask *dstp) +{ + cpumask_clear_cpu(cpu, dstp); +} + +void rust_helper_cpumask_setall(struct cpumask *dstp) +{ + cpumask_setall(dstp); +} + +void rust_helper_cpumask_copy(struct cpumask *dstp, const struct cpumask *= srcp) +{ + cpumask_copy(dstp, srcp); +} + +bool rust_helper_zalloc_cpumask_var(cpumask_var_t *mask, gfp_t flags) +{ + return zalloc_cpumask_var(mask, flags); +} + +#ifndef CONFIG_CPUMASK_OFFSTACK +void rust_helper_free_cpumask_var(cpumask_var_t mask) +{ + free_cpumask_var(mask); +} +#endif diff --git a/rust/helpers/helpers.c b/rust/helpers/helpers.c index 0640b7e115be..de2341cfd917 100644 --- a/rust/helpers/helpers.c +++ b/rust/helpers/helpers.c @@ -11,6 +11,7 @@ #include "bug.c" #include "build_assert.c" #include "build_bug.c" +#include "cpumask.c" #include "cred.c" #include "device.c" #include "err.c" --=20 2.31.1.272.g89b43f80a514