From 3be9c61b78ef6251ee8680a5a560825083c7e0ec Mon Sep 17 00:00:00 2001 From: Erik Schilling Date: Wed, 19 Jul 2023 20:31:20 +0200 Subject: [PATCH 1/3] bindings: de-duplicate header mentions We list the headers in the script snippet already. No need to do the same here and force everyone to update two places. Signed-off-by: Erik Schilling --- crates/virtio-bindings/CONTRIBUTING.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/crates/virtio-bindings/CONTRIBUTING.md b/crates/virtio-bindings/CONTRIBUTING.md index 2dabef0d..b3ff305f 100644 --- a/crates/virtio-bindings/CONTRIBUTING.md +++ b/crates/virtio-bindings/CONTRIBUTING.md @@ -28,10 +28,9 @@ cd linux # Step 1: Checkout the version you want to generate the bindings for. git checkout v5.0 -# Step 2: Generate the bindings from the kernel headers. We need to -# generate a file for each one of the virtio headers we're interested on. -# For the moment, we're generating "virtio_blk", "virtio_gpu", "virtio_mmio", -# "virtio_net", "virtio_ring" and "virtio_scsi". Feel free to add additional header files if +# Step 2: Generate the bindings from the kernel headers. We need to generate a +# file for each one of the virtio headers. For the moment, we are only picking +# headers that we are interested in. Feel free to add additional header files if # you need them for your project. make headers_install INSTALL_HDR_PATH=v5_0_headers cd v5_0_headers From e4125c8e9787a2ff8d59f265ec09f6ee7b69b4fa Mon Sep 17 00:00:00 2001 From: Erik Schilling Date: Wed, 19 Jul 2023 20:35:07 +0200 Subject: [PATCH 2/3] bindings: wrap header list This prevents it from getting longer every time we extend this. Also, it allows sorting the lines a bit easier. Signed-off-by: Erik Schilling --- crates/virtio-bindings/CONTRIBUTING.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/virtio-bindings/CONTRIBUTING.md b/crates/virtio-bindings/CONTRIBUTING.md index b3ff305f..03243cef 100644 --- a/crates/virtio-bindings/CONTRIBUTING.md +++ b/crates/virtio-bindings/CONTRIBUTING.md @@ -34,7 +34,15 @@ git checkout v5.0 # you need them for your project. make headers_install INSTALL_HDR_PATH=v5_0_headers cd v5_0_headers -for i in virtio_blk virtio_config virtio_gpu virtio_mmio virtio_net virtio_ring virtio_scsi ; do \ +for i in \ + virtio_blk \ + virtio_config \ + virtio_gpu \ + virtio_mmio \ + virtio_net \ + virtio_ring \ + virtio_scsi \ + ; do \ bindgen include/linux/$i.h -o $i.rs \ --allowlist-file include/linux/$i.h \ --with-derive-default \ From 09d367eb9fe15ae46e519c5fe0c5aa0ce223d648 Mon Sep 17 00:00:00 2001 From: Erik Schilling Date: Wed, 19 Jul 2023 20:43:29 +0200 Subject: [PATCH 3/3] bindings: add bindings for virtio_ids.h Generated from Linux v6.4.3. Signed-off-by: Erik Schilling --- crates/virtio-bindings/CHANGELOG.md | 1 + crates/virtio-bindings/CONTRIBUTING.md | 1 + crates/virtio-bindings/src/virtio_ids.rs | 48 ++++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 crates/virtio-bindings/src/virtio_ids.rs diff --git a/crates/virtio-bindings/CHANGELOG.md b/crates/virtio-bindings/CHANGELOG.md index 8d3e4157..b4b18eb7 100644 --- a/crates/virtio-bindings/CHANGELOG.md +++ b/crates/virtio-bindings/CHANGELOG.md @@ -1,6 +1,7 @@ # Upcoming Release - Regenerate bindings with Linux 6.4. +- Added bindings for virtio_ids.h # v0.2.1 diff --git a/crates/virtio-bindings/CONTRIBUTING.md b/crates/virtio-bindings/CONTRIBUTING.md index 03243cef..b0d98eec 100644 --- a/crates/virtio-bindings/CONTRIBUTING.md +++ b/crates/virtio-bindings/CONTRIBUTING.md @@ -38,6 +38,7 @@ for i in \ virtio_blk \ virtio_config \ virtio_gpu \ + virtio_ids \ virtio_mmio \ virtio_net \ virtio_ring \ diff --git a/crates/virtio-bindings/src/virtio_ids.rs b/crates/virtio-bindings/src/virtio_ids.rs new file mode 100644 index 00000000..71dab814 --- /dev/null +++ b/crates/virtio-bindings/src/virtio_ids.rs @@ -0,0 +1,48 @@ +/* automatically generated by rust-bindgen 0.63.0 */ + +pub const VIRTIO_ID_NET: u32 = 1; +pub const VIRTIO_ID_BLOCK: u32 = 2; +pub const VIRTIO_ID_CONSOLE: u32 = 3; +pub const VIRTIO_ID_RNG: u32 = 4; +pub const VIRTIO_ID_BALLOON: u32 = 5; +pub const VIRTIO_ID_IOMEM: u32 = 6; +pub const VIRTIO_ID_RPMSG: u32 = 7; +pub const VIRTIO_ID_SCSI: u32 = 8; +pub const VIRTIO_ID_9P: u32 = 9; +pub const VIRTIO_ID_MAC80211_WLAN: u32 = 10; +pub const VIRTIO_ID_RPROC_SERIAL: u32 = 11; +pub const VIRTIO_ID_CAIF: u32 = 12; +pub const VIRTIO_ID_MEMORY_BALLOON: u32 = 13; +pub const VIRTIO_ID_GPU: u32 = 16; +pub const VIRTIO_ID_CLOCK: u32 = 17; +pub const VIRTIO_ID_INPUT: u32 = 18; +pub const VIRTIO_ID_VSOCK: u32 = 19; +pub const VIRTIO_ID_CRYPTO: u32 = 20; +pub const VIRTIO_ID_SIGNAL_DIST: u32 = 21; +pub const VIRTIO_ID_PSTORE: u32 = 22; +pub const VIRTIO_ID_IOMMU: u32 = 23; +pub const VIRTIO_ID_MEM: u32 = 24; +pub const VIRTIO_ID_SOUND: u32 = 25; +pub const VIRTIO_ID_FS: u32 = 26; +pub const VIRTIO_ID_PMEM: u32 = 27; +pub const VIRTIO_ID_RPMB: u32 = 28; +pub const VIRTIO_ID_MAC80211_HWSIM: u32 = 29; +pub const VIRTIO_ID_VIDEO_ENCODER: u32 = 30; +pub const VIRTIO_ID_VIDEO_DECODER: u32 = 31; +pub const VIRTIO_ID_SCMI: u32 = 32; +pub const VIRTIO_ID_NITRO_SEC_MOD: u32 = 33; +pub const VIRTIO_ID_I2C_ADAPTER: u32 = 34; +pub const VIRTIO_ID_WATCHDOG: u32 = 35; +pub const VIRTIO_ID_CAN: u32 = 36; +pub const VIRTIO_ID_DMABUF: u32 = 37; +pub const VIRTIO_ID_PARAM_SERV: u32 = 38; +pub const VIRTIO_ID_AUDIO_POLICY: u32 = 39; +pub const VIRTIO_ID_BT: u32 = 40; +pub const VIRTIO_ID_GPIO: u32 = 41; +pub const VIRTIO_TRANS_ID_NET: u32 = 4096; +pub const VIRTIO_TRANS_ID_BLOCK: u32 = 4097; +pub const VIRTIO_TRANS_ID_BALLOON: u32 = 4098; +pub const VIRTIO_TRANS_ID_CONSOLE: u32 = 4099; +pub const VIRTIO_TRANS_ID_SCSI: u32 = 4100; +pub const VIRTIO_TRANS_ID_RNG: u32 = 4101; +pub const VIRTIO_TRANS_ID_9P: u32 = 4105;