diff options
author | Alyssa Ross <hi@alyssa.is> | 2020-05-23 17:11:39 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2020-05-24 22:44:30 +0000 |
commit | f24d310275909265de32cbc831d5832cbccc68ee (patch) | |
tree | ee8ce96b061f406147fd2c64ad9705aca9c342f8 | |
parent | c5c894f4f357344c411b8419b14ee9cb61e020fa (diff) | |
download | nixpkgs-f24d310275909265de32cbc831d5832cbccc68ee.tar nixpkgs-f24d310275909265de32cbc831d5832cbccc68ee.tar.gz nixpkgs-f24d310275909265de32cbc831d5832cbccc68ee.tar.bz2 nixpkgs-f24d310275909265de32cbc831d5832cbccc68ee.tar.lz nixpkgs-f24d310275909265de32cbc831d5832cbccc68ee.tar.xz nixpkgs-f24d310275909265de32cbc831d5832cbccc68ee.tar.zst nixpkgs-f24d310275909265de32cbc831d5832cbccc68ee.zip |
linux_cros: virtwl: Support multiple host sockets
This is necessary to be able to provide a memfd server in addition to the main socket.
3 files changed, 135 insertions, 2 deletions
diff --git a/pkgs/os-specific/linux/chromium-os/default.nix b/pkgs/os-specific/linux/chromium-os/default.nix index 1bed1ff7b46..f75891fee9b 100644 --- a/pkgs/os-specific/linux/chromium-os/default.nix +++ b/pkgs/os-specific/linux/chromium-os/default.nix @@ -30,13 +30,15 @@ let }; linux_5_4 = callPackage ../kernel/linux-cros.nix { - inherit (linux_5_4) kernelPatches; + kernelPatches = linux_5_4.kernelPatches ++ (with kernelPatches; [ + virtwl_multiple_sockets + ]); }; linux = self.linux_5_4; linuxHeaders = (makeLinuxHeaders { - inherit (linux) version src; + inherit (linux) version src patches; }); minigbm = callPackage ./minigbm { }; diff --git a/pkgs/os-specific/linux/kernel/0001-CHROMIUM-virtwl-Support-multiple-host-sockets.patch b/pkgs/os-specific/linux/kernel/0001-CHROMIUM-virtwl-Support-multiple-host-sockets.patch new file mode 100644 index 00000000000..3e4e504978c --- /dev/null +++ b/pkgs/os-specific/linux/kernel/0001-CHROMIUM-virtwl-Support-multiple-host-sockets.patch @@ -0,0 +1,126 @@ +From 7f7629cc680bf3c22d547fb5333e521af58c6c9e Mon Sep 17 00:00:00 2001 +From: Ryo Hashimoto <hashimoto@google.com> +Date: Wed, 11 Dec 2019 18:32:03 +0900 +Subject: [PATCH] CHROMIUM: virtwl: Support multiple host sockets + +Add a new argument to VIRTWL_IOCTL_NEW_CTX. +This CL doesn't change the size of structs. + +Guest can use this parameter to create a context connected to a host +process other than the compositor. + +BUG=b:146100044, b:140202859 +TEST=Camera works + +Change-Id: I1c6b1a256002a336774a36caf0fe8d18f08c0f56 +Signed-off-by: Ryo Hashimoto <hashimoto@chromium.org> +Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/1962108 +Reviewed-by: Dmitry Torokhov <dtor@chromium.org> +Reviewed-by: Zach Reizner <zachr@chromium.org> +(cherry picked from commit 5d641a7b7b64664230d2fd2aa1e74dd792b8b7bf) +Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2035921 +Tested-by: Chirantan Ekbote <chirantan@chromium.org> +Commit-Queue: Chirantan Ekbote <chirantan@chromium.org> +Auto-Submit: Chirantan Ekbote <chirantan@chromium.org> +Signed-off-by: Alyssa Ross <hi@alyssa.is> +--- + drivers/virtio/virtio_wl.c | 6 ++++++ + include/uapi/linux/virtio_wl.h | 29 +++++++++++++++++------------ + include/uapi/linux/virtwl.h | 3 +++ + 3 files changed, 26 insertions(+), 12 deletions(-) + +diff --git a/drivers/virtio/virtio_wl.c b/drivers/virtio/virtio_wl.c +index 1b3f8926519a7..80cf799bed464 100644 +--- a/drivers/virtio/virtio_wl.c ++++ b/drivers/virtio/virtio_wl.c +@@ -1024,6 +1024,7 @@ static struct virtwl_vfd *do_new(struct virtwl_info *vi, + int ret = 0; + + if (ioctl_new->type != VIRTWL_IOCTL_NEW_CTX && ++ ioctl_new->type != VIRTWL_IOCTL_NEW_CTX_NAMED && + ioctl_new->type != VIRTWL_IOCTL_NEW_ALLOC && + ioctl_new->type != VIRTWL_IOCTL_NEW_PIPE_READ && + ioctl_new->type != VIRTWL_IOCTL_NEW_PIPE_WRITE && +@@ -1060,6 +1061,11 @@ static struct virtwl_vfd *do_new(struct virtwl_info *vi, + ctrl_new->hdr.type = VIRTIO_WL_CMD_VFD_NEW_CTX; + ctrl_new->flags = VIRTIO_WL_VFD_WRITE | VIRTIO_WL_VFD_READ; + break; ++ case VIRTWL_IOCTL_NEW_CTX_NAMED: ++ ctrl_new->hdr.type = VIRTIO_WL_CMD_VFD_NEW_CTX_NAMED; ++ ctrl_new->flags = VIRTIO_WL_VFD_WRITE | VIRTIO_WL_VFD_READ; ++ memcpy(ctrl_new->name, ioctl_new->name, sizeof(ctrl_new->name)); ++ break; + case VIRTWL_IOCTL_NEW_ALLOC: + ctrl_new->hdr.type = VIRTIO_WL_CMD_VFD_NEW; + ctrl_new->size = PAGE_ALIGN(ioctl_new->size); +diff --git a/include/uapi/linux/virtio_wl.h b/include/uapi/linux/virtio_wl.h +index 1d3ec6b31d4d3..ad9b6dfcd3263 100644 +--- a/include/uapi/linux/virtio_wl.h ++++ b/include/uapi/linux/virtio_wl.h +@@ -37,6 +37,7 @@ enum virtio_wl_ctrl_type { + VIRTIO_WL_CMD_VFD_NEW_DMABUF, /* virtio_wl_ctrl_vfd_new */ + VIRTIO_WL_CMD_VFD_DMABUF_SYNC, /* virtio_wl_ctrl_vfd_dmabuf_sync */ + VIRTIO_WL_CMD_VFD_SEND_FOREIGN_ID, /* virtio_wl_ctrl_vfd_send + data */ ++ VIRTIO_WL_CMD_VFD_NEW_CTX_NAMED, /* virtio_wl_ctrl_vfd_new */ + + VIRTIO_WL_RESP_OK = 0x1000, + VIRTIO_WL_RESP_VFD_NEW = 0x1001, /* virtio_wl_ctrl_vfd_new */ +@@ -78,18 +79,22 @@ struct virtio_wl_ctrl_vfd_new { + __le32 flags; /* virtio_wl_vfd_flags */ + __le64 pfn; /* first guest physical page frame number if VFD_MAP */ + __le32 size; /* size in bytes if VIRTIO_WL_CMD_VFD_NEW* */ +- /* buffer description if VIRTIO_WL_CMD_VFD_NEW_DMABUF */ +- struct { +- __le32 width; /* width in pixels */ +- __le32 height; /* height in pixels */ +- __le32 format; /* fourcc format */ +- __le32 stride0; /* return stride0 */ +- __le32 stride1; /* return stride1 */ +- __le32 stride2; /* return stride2 */ +- __le32 offset0; /* return offset0 */ +- __le32 offset1; /* return offset1 */ +- __le32 offset2; /* return offset2 */ +- } dmabuf; ++ union { ++ /* buffer description if VIRTIO_WL_CMD_VFD_NEW_DMABUF */ ++ struct { ++ __le32 width; /* width in pixels */ ++ __le32 height; /* height in pixels */ ++ __le32 format; /* fourcc format */ ++ __le32 stride0; /* return stride0 */ ++ __le32 stride1; /* return stride1 */ ++ __le32 stride2; /* return stride2 */ ++ __le32 offset0; /* return offset0 */ ++ __le32 offset1; /* return offset1 */ ++ __le32 offset2; /* return offset2 */ ++ } dmabuf; ++ /* name of socket if VIRTIO_WL_CMD_VFD_NEW_CTX_NAMED */ ++ char name[32]; ++ }; + }; + + +diff --git a/include/uapi/linux/virtwl.h b/include/uapi/linux/virtwl.h +index 939041389b403..baa9b341377a5 100644 +--- a/include/uapi/linux/virtwl.h ++++ b/include/uapi/linux/virtwl.h +@@ -21,6 +21,7 @@ enum virtwl_ioctl_new_type { + VIRTWL_IOCTL_NEW_PIPE_WRITE, + /* create a new virtwl dmabuf that is writable via the returned fd */ + VIRTWL_IOCTL_NEW_DMABUF, ++ VIRTWL_IOCTL_NEW_CTX_NAMED, /* open a new named connection context */ + }; + + struct virtwl_ioctl_new { +@@ -42,6 +43,8 @@ struct virtwl_ioctl_new { + __u32 offset1; /* return offset1 */ + __u32 offset2; /* return offset2 */ + } dmabuf; ++ /* name of socket if type == VIRTIO_WL_CMD_VFD_NEW_CTX_NAMED */ ++ char name[32]; + }; + }; + +-- +2.26.2 + diff --git a/pkgs/os-specific/linux/kernel/patches.nix b/pkgs/os-specific/linux/kernel/patches.nix index 8ce1ac2b587..66cbdbb36fa 100644 --- a/pkgs/os-specific/linux/kernel/patches.nix +++ b/pkgs/os-specific/linux/kernel/patches.nix @@ -92,4 +92,9 @@ name = "mac_nvme_t2"; patch = ./mac-nvme-t2.patch; }; + + virtwl_multiple_sockets = { + name = "virtwl_multiple_sockets"; + patch = ./0001-CHROMIUM-virtwl-Support-multiple-host-sockets.patch; + }; } |