From: David Rheinsberg <david@readahead.eu>
To: rust-for-linux@vger.kernel.org
Cc: teg@jklm.no, Miguel Ojeda <ojeda@kernel.org>,
David Rheinsberg <david@readahead.eu>
Subject: [RFC 06/16] bus1: add the user-space API
Date: Tue, 31 Mar 2026 21:02:58 +0200 [thread overview]
Message-ID: <20260331190308.141622-7-david@readahead.eu> (raw)
In-Reply-To: <20260331190308.141622-1-david@readahead.eu>
Add the user-space API of bus1. Everything is contained in linux/bus1.h
for now, and exposed via a character-device. This allows hotloading of
the module during development.
In the future, a syscall based API, as demanded previously, can be added
as well. The ioctls on the character device are designed with this in
mind, and can be easily translated into syscalls, as is already
documented in the man-page.
The API has no inline documentation. Instead, documentation is provided
in ./Documentation/bus1/bus1.7.rst.
Signed-off-by: David Rheinsberg <david@readahead.eu>
---
include/uapi/linux/bus1.h | 77 +++++++++++++++++++++++++++++++++++++++
1 file changed, 77 insertions(+)
diff --git a/include/uapi/linux/bus1.h b/include/uapi/linux/bus1.h
index 4297e7a00ab9..b4317675475e 100644
--- a/include/uapi/linux/bus1.h
+++ b/include/uapi/linux/bus1.h
@@ -2,4 +2,81 @@
#ifndef _UAPI_LINUX_BUS1_H
#define _UAPI_LINUX_BUS1_H
+#include <linux/ioctl.h>
+#include <linux/types.h>
+
+#define BUS1_IOCTL_MAGIC (0x97)
+#define BUS1_INVALID ((__u64)-1)
+#define BUS1_MANAGED ((__u64)0x1)
+
+#define BUS1_FROM_PTR(_v) ((__u64)(void *)(_v))
+#define BUS1_TO_PTR(_v) ((void *)(__u64)(_v))
+
+#define BUS1_TRANSFER_FLAG_CREATE (((__u64)1) << 0)
+
+struct bus1_transfer {
+ __u64 flags;
+ __u64 id;
+} __attribute__((__aligned__(8)));
+
+struct bus1_metadata {
+ __u64 flags;
+ __u64 id;
+ __u64 account;
+} __attribute__((__aligned__(8)));
+
+enum bus1_message_type: __u64 {
+ BUS1_MESSAGE_TYPE_USER = 0,
+ BUS1_MESSAGE_TYPE_NODE_RELEASE = 1,
+ BUS1_MESSAGE_TYPE_HANDLE_RELEASE = 2,
+ _BUS1_MESSAGE_TYPE_N,
+};
+
+struct bus1_message {
+ __u64 flags;
+ __u64 type;
+ __u64 n_transfers;
+ __u64 ptr_transfers;
+ __u64 n_data;
+ __u64 n_data_vecs;
+ __u64 ptr_data_vecs;
+} __attribute__((__aligned__(8)));
+
+struct bus1_cmd_transfer {
+ __u64 flags;
+ __u64 to;
+ __u64 n_transfers;
+ __u64 ptr_src;
+ __u64 ptr_dst;
+} __attribute__((__aligned__(8)));
+
+struct bus1_cmd_release {
+ __u64 flags;
+ __u64 n_ids;
+ __u64 ptr_ids;
+} __attribute__((__aligned__(8)));
+
+struct bus1_cmd_send {
+ __u64 flags;
+ __u64 n_destinations;
+ __u64 ptr_destinations;
+ __u64 ptr_errors;
+ __u64 ptr_message;
+} __attribute__((__aligned__(8)));
+
+struct bus1_cmd_recv {
+ __u64 flags;
+ __u64 ptr_metadata;
+ __u64 ptr_message;
+} __attribute__((__aligned__(8)));
+
+#define BUS1_CMD_TRANSFER \
+ (_IOWR(BUS1_IOCTL_MAGIC, 0x00, struct bus1_cmd_transfer))
+#define BUS1_CMD_RELEASE \
+ (_IOWR(BUS1_IOCTL_MAGIC, 0x01, struct bus1_cmd_release))
+#define BUS1_CMD_SEND \
+ (_IOWR(BUS1_IOCTL_MAGIC, 0x02, struct bus1_cmd_send))
+#define BUS1_CMD_RECV \
+ (_IOWR(BUS1_IOCTL_MAGIC, 0x03, struct bus1_cmd_recv))
+
#endif /* _UAPI_LINUX_BUS1_H */
--
2.53.0
next prev parent reply other threads:[~2026-03-31 19:05 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-31 19:02 [RFC 00/16] bus1: Capability-based IPC for Linux David Rheinsberg
2026-03-31 19:02 ` [RFC 01/16] rust/sync: add LockedBy::access_mut_unchecked() David Rheinsberg
2026-03-31 19:29 ` Miguel Ojeda
2026-03-31 19:02 ` [RFC 02/16] rust/sync: add Arc::drop_unless_unique() David Rheinsberg
2026-03-31 19:02 ` [RFC 03/16] rust/alloc: add Vec::into_boxed_slice() David Rheinsberg
2026-03-31 19:28 ` Miguel Ojeda
2026-03-31 21:10 ` Gary Guo
2026-03-31 22:07 ` Danilo Krummrich
2026-04-01 9:28 ` David Rheinsberg
2026-03-31 19:02 ` [RFC 04/16] rust/error: add EXFULL, EBADRQC, EDQUOT, ENOTRECOVERABLE David Rheinsberg
2026-03-31 19:02 ` [RFC 05/16] bus1: add module scaffolding David Rheinsberg
2026-03-31 19:02 ` David Rheinsberg [this message]
2026-03-31 19:02 ` [RFC 07/16] bus1: add man-page David Rheinsberg
2026-04-01 16:30 ` Jonathan Corbet
2026-04-01 18:01 ` David Rheinsberg
2026-04-01 18:06 ` David Rheinsberg
2026-04-04 15:30 ` Thomas Meyer
2026-03-31 19:03 ` [RFC 08/16] bus1/util: add basic utilities David Rheinsberg
2026-03-31 19:35 ` Miguel Ojeda
2026-04-01 11:05 ` David Rheinsberg
2026-04-01 11:25 ` Miguel Ojeda
2026-03-31 19:03 ` [RFC 09/16] bus1/util: add field projections David Rheinsberg
2026-03-31 19:38 ` Miguel Ojeda
2026-03-31 19:03 ` [RFC 10/16] bus1/util: add IntoDeref/FromDeref David Rheinsberg
2026-03-31 19:44 ` Miguel Ojeda
2026-03-31 19:03 ` [RFC 11/16] bus1/util: add intrusive data-type helpers David Rheinsberg
2026-03-31 19:03 ` [RFC 12/16] bus1/util: add intrusive single linked lists David Rheinsberg
2026-03-31 19:03 ` [RFC 13/16] bus1/util: add intrusive rb-tree David Rheinsberg
2026-03-31 19:43 ` Miguel Ojeda
2026-03-31 19:03 ` [RFC 14/16] bus1/acct: add resouce accounting David Rheinsberg
2026-03-31 19:03 ` [RFC 15/16] bus1: introduce peers, handles, and nodes David Rheinsberg
2026-03-31 19:03 ` [RFC 16/16] bus1: implement the uapi David Rheinsberg
2026-03-31 19:46 ` [RFC 00/16] bus1: Capability-based IPC for Linux Miguel Ojeda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260331190308.141622-7-david@readahead.eu \
--to=david@readahead.eu \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=teg@jklm.no \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox