Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp619398lqp; Fri, 5 Apr 2024 04:09:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWzzWvC2YKWEIsHDuxavFuyZbDybkZQZm6UrtO0kcFEhjZ7cnNnW6I1znW6eC9kU+d9hds98wb8M/6ohi+VDCHdCAnCDoD9pe1iMoWHVA== X-Google-Smtp-Source: AGHT+IEURHy0UgXojF6A4k/qgbeYPQ32COgEN04TsQNHwgLMtO3UTA5Nmh5Kcn9LDVqgZORzXffk X-Received: by 2002:a05:6a20:2585:b0:1a7:231e:3db with SMTP id k5-20020a056a20258500b001a7231e03dbmr1373136pzd.15.1712315399344; Fri, 05 Apr 2024 04:09:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712315399; cv=pass; d=google.com; s=arc-20160816; b=CZBUaXgqJHjTSJMAzdHuGWbubZyTjSJjTY4nemdEKh8+905nYFZSJj0MjWLVfJP4WB DTxy01ld1StA+RdaAELIafhXEwJH7fxqnF35alJZrLJ+nbF3bVqi2duvgeCCDmWlkDG8 0h0026lupQcOPTYPJP38SvyCHEsfgysMkD6d9ycJ4OytdRHWejDjH4mrfUBV6D8YEi3a /zCcyUTH6SRK2VQh0jvqQi1uDJf1tk7ul/GAkEBwBM1jYvJi3Pd0rEDTk18CVJNFPqwR RQMD+76d/U1wG4RXVzcK++zGDqG8wEqooGq2OzehONPLGP4g+x+6VVJkMGG8J3C+e1Oh F0/g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=ilEskIN8tKWZMsYnEfjH123xoWAuOl7U7IF0t8VdrT4=; fh=A8d4WOi2Hi1jRKpbF2bGtagodafvvHUHXxatUKJHPNI=; b=Mu5i/9gwnUQ3rZXmlT+ETvOXsZl1MlGwrNEZee0IsMzJy67Apscu5Fjha8TeimP/DW D2esORWFNAwUnbp2Y8LtuBGYHKALIzaQMJhLhh1ww/69ckM7nF1XTRrBeZhaDStXqcsp mp+Ct7Wb5vmaTZm1XpSwwvC9Wv12g+AJj4Iv6bOmAjWw6OEpKVJjDFxGzR955uVIb/uR mcvTNLM/O88NZiNzvASh4i+5Lq3KcoBL8xqQ8ohcyc027iPUkzo4PpYdpDksu1VqAWG0 fsWPs3nzOV5FWRXUmu4HelfopQo9L09VoWQZHlv7y+6Y6tp7yRA+Vj9SQmJpiWWhoSBN +xGg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EEdF2skc; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-132891-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132891-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id ct27-20020a056a000f9b00b006eceae2b946si1216208pfb.315.2024.04.05.04.09.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 04:09:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-132891-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EEdF2skc; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-132891-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132891-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 07BF428539F for ; Fri, 5 Apr 2024 11:09:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A83D816C420; Fri, 5 Apr 2024 11:09:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="EEdF2skc" Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (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 499E216C427 for ; Fri, 5 Apr 2024 11:09:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712315391; cv=none; b=f0WcVixRT/B6qkkGWOq56fbRJRDWUnK/RqUgHxFFz6pEDwMEOQwROMqI8p2fJW9Iven1FQKcLYMEwLrBiCx7RXHlZDfdQbO5KL1Vo/tzApIdu/3uj6vySJHL4jezYwKgTe65uG6FBiu3tX+V5J8pM31PXVRFO8xlICucot4SR/k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712315391; c=relaxed/simple; bh=TugG3AB0lsWMh7jn+aDBl+S6sWBQPDYKMwxIi40RiBY=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=KpvVNS1I38VE07olmZD5cp7+Govs9zKpsXHNRcnaOtR0ZoyiBlEJ3aVRRraDTF94wm1jbgQAJhXPg7pWSCaQ4lo0MQ/TWaEaw4jNo1XXaawN99drqydNW2ntsYmkcen6eHtQJAp4+fJQ55D011fN3sa1tlDb4kvPs52nRoxTC4o= 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=EEdF2skc; arc=none smtp.client-ip=209.85.210.173 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 Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-6ece8991654so1671557b3a.3 for ; Fri, 05 Apr 2024 04:09:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712315389; x=1712920189; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=ilEskIN8tKWZMsYnEfjH123xoWAuOl7U7IF0t8VdrT4=; b=EEdF2skcPry7IYyyN+2FRDV95aQPsAGTsAI1mOISkCM2bNN70Nu4LJ9jr1SBwg4125 yL9+sgeKbWkJ8MSMZjNwmGDijUjb6KIDOsqKs+YsOq+ii64W0epFyeKz1Z4TGmJFXS/T OOSEw140MbN7ROWcaEZUbdx99/vZjy3G9M6QBXm4eyn2voshxJXzBk9VNJ3JGWL8cUBK axfez5OTm8lxebt5G47QESsOUhIA21un2fH1HSJ33Q931JLUgtEpQ/pa/uy1CNQo95qo L6z5rO8NXqMozrTp7UOnLVfS3gmveGb3lzjpmC6hPldKYGViaD2cCFy2U75o2NXBKwst y29A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712315389; x=1712920189; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ilEskIN8tKWZMsYnEfjH123xoWAuOl7U7IF0t8VdrT4=; b=rO1rsN32uYV1w3CbVAzNn7eLj21Is5r5GeEGPf8Ncs05pYYzFERVFUEux5EmWHMdc6 uHwArs6YjDM2j4kCzSSeyvSThJ/4nVVJfpalf1KyES6ZnO1jwqsJKXXM+X6sqKbNaA9w AFrSo/aVjAWyxySzMVviggHwyBuF+awAeioF4DN7G9xp7RwhFQ4Rpfp+JwXENI6cGUuz lUDjrIANoiWZ4Gk5TvzX6cp+D+z+ezQUbhkHnNThq028wAVfNuTMoiPncMFbqSXLb7zC FYDD6jW0fDgQzzzNUNjPSykCo5uAE07EY90GHxwPNmI+WvkVOT92gWlojlig1AsUvenl FTBg== X-Forwarded-Encrypted: i=1; AJvYcCVIPJvUQGMFqxYYak1WA0oNcxdxTaIadl8sY/uJw0Sdj6FiG4d3NG7XeoIJqHXGZuVHcI7RfdnxfPgiIEsjfO/A4tVWwQ92w7ApWkLo X-Gm-Message-State: AOJu0Yy+Timw2kKqdbgtBPX7wgJIXwRw6a1V4v6Pr1De42+jdNVfMXTM L8d5/4ds5GPgP8Ex5JLmRJDMPPMaH9vYZUAiXSb/h3ynI6nJJfeBVDyUVl0oZ54= X-Received: by 2002:a05:6a00:1803:b0:6eb:3c2d:76e0 with SMTP id y3-20020a056a00180300b006eb3c2d76e0mr1328344pfa.11.1712315389286; Fri, 05 Apr 2024 04:09:49 -0700 (PDT) Received: from localhost ([122.172.85.136]) by smtp.gmail.com with ESMTPSA id b187-20020a62cfc4000000b006e6b7124b33sm1262793pfg.209.2024.04.05.04.09.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 04:09:48 -0700 (PDT) From: Viresh Kumar To: "Rafael J. Wysocki" , Miguel Ojeda , Alex Gaynor , Alice Ryhl , Andreas Hindborg , Benno Lossin , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Boqun Feng , Gary Guo , Miguel Ojeda , Viresh Kumar , Wedson Almeida Filho Cc: linux-pm@vger.kernel.org, Vincent Guittot , Stephen Boyd , Nishanth Menon , rust-for-linux@vger.kernel.org, Manos Pitsidianakis , Erik Schilling , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Joakim Bech , linux-kernel@vger.kernel.org Subject: [RFC PATCH 0/3] Rust bindings for cpufreq and OPP core + sample driver Date: Fri, 5 Apr 2024 16:39:37 +0530 Message-Id: X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Hello, This RFC adds initial rust bindings for two subsystems, cpufreq and operating performance points (OPP). The bindings are provided for most of the interface these subsystems expose. This series also provides a sample cpufreq driver rcpufreq-dt, which is a duplicate of the merged cpufreq-dt driver (A generic platform agnostic device tree based cpufreq driver) used on most of the ARM platforms. This is tested with the help of QEMU for now and frequency transitions and configurations work as expected. No performance measurement is done as of now with this. These patches (along with a lot of other dependencies) are pushed here for anyone to give them a try: git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/linux.git rust/cpufreq-dt I understand that there is a long road ahead before these patches can get merged as a lot of other stuff needs to get in first, i.e. Rust bindings for: - generic device / driver - platform device / driver - clk, regulator, OF, cpumask, etc Because of the missing bindings for above APIs, lot of calls are made directly into the bindgen generated bindings for now, to make this work. Hopefully we can have a lot less unsafe code once we get all those things merged. Based over v6.9-rc1. Thanks. Viresh Kumar (3): rust: Add bindings for OPP framework rust: Add bindings for cpufreq framework cpufreq: Add Rust based cpufreq-dt driver drivers/cpufreq/Kconfig | 12 + drivers/cpufreq/Makefile | 1 + drivers/cpufreq/rcpufreq_dt.rs | 264 ++++++++ rust/bindings/bindings_helper.h | 2 + rust/helpers.c | 15 + rust/kernel/cpufreq.rs | 1090 +++++++++++++++++++++++++++++++ rust/kernel/lib.rs | 4 + rust/kernel/opp.rs | 895 +++++++++++++++++++++++++ 8 files changed, 2283 insertions(+) create mode 100644 drivers/cpufreq/rcpufreq_dt.rs create mode 100644 rust/kernel/cpufreq.rs create mode 100644 rust/kernel/opp.rs -- 2.31.1.272.g89b43f80a514