Update kernel to 6.1.8

This commit is contained in:
Bruce Leidl 2023-01-26 15:25:28 -05:00
parent 7f3b3aa409
commit 65052aac7a
6 changed files with 1927 additions and 7148 deletions

View File

@ -1,8 +1,8 @@
LINUX_VERSION = 5.3 LINUX_VERSION = 6.1.8
KERNEL_VERSION = linux-$(LINUX_VERSION) KERNEL_VERSION = linux-$(LINUX_VERSION)
KERNEL_DOWNLOAD = https://cdn.kernel.org/pub/linux/kernel/v5.x/$(KERNEL_VERSION) KERNEL_DOWNLOAD = https://cdn.kernel.org/pub/linux/kernel/v6.x/$(KERNEL_VERSION)
PWD = $(shell pwd) PWD = $(shell pwd)
NPROC = $(shell nproc) NPROC = $(shell nproc)
@ -50,7 +50,7 @@ $(PH_LINUX_VER): $(KERNEL_BUILD_OUTPUT)
ln -s $(PWD)/$(PH_LINUX_VER) $(PH_LINUX) ln -s $(PWD)/$(PH_LINUX_VER) $(PH_LINUX)
$(KERNEL_BUILD_OUTPUT): $(KERNEL_BUILD_PATH) $(KERNEL_BUILD_OUTPUT): $(KERNEL_BUILD_PATH)
cd $(KERNEL_VERSION); make -j$(NPROC) cd $(KERNEL_VERSION); make -j$(NPROC) vmlinux
clean: clean:
rm -rf $(KERNEL_BUILD_PATH) $(SHA256_SENTINEL) $(PH_LINUX_VER) $(PH_LINUX) .work rm -rf $(KERNEL_BUILD_PATH) $(SHA256_SENTINEL) $(PH_LINUX_VER) $(PH_LINUX) .work

File diff suppressed because it is too large Load Diff

View File

@ -1,33 +1,31 @@
diff -uprN linux-5.3/drivers/virtio/Kconfig linux-5.3-wl/drivers/virtio/Kconfig diff -uprN linux-6.0.12/drivers/virtio/Kconfig linux-6.0.12-wl/drivers/virtio/Kconfig
--- linux-5.3/drivers/virtio/Kconfig 2019-09-15 17:19:32.000000000 -0400 --- linux-6.0.12/drivers/virtio/Kconfig 2022-12-08 05:30:22.000000000 -0500
+++ linux-5.3-wl/drivers/virtio/Kconfig 2019-09-19 23:04:23.616276643 -0400 +++ linux-6.0.12-wl/drivers/virtio/Kconfig 2022-12-30 13:24:24.416282173 -0500
@@ -74,6 +74,14 @@ config VIRTIO_INPUT @@ -173,4 +173,12 @@ config VIRTIO_DMA_SHARED_BUFFER
This option adds a flavor of dma buffers that are backed by
If unsure, say M. virtio resources.
+config VIRTIO_WL +config VIRTIO_WL
+ bool "Virtio Wayland driver" + bool "Virtio Wayland driver"
+ depends on VIRTIO + depends on VIRTIO && MMU
+ ---help--- + help
+ This driver supports proxying of a wayland socket from host to guest. + This driver supports proxying of a wayland socket from host to guest.
+ +
+ If unsure, say 'N'. + If unsure, say 'N'.
+ +
config VIRTIO_MMIO endif # VIRTIO_MENU
tristate "Platform bus driver for memory mapped virtio devices" diff -uprN linux-6.0.12/drivers/virtio/Makefile linux-6.0.12-wl/drivers/virtio/Makefile
depends on HAS_IOMEM && HAS_DMA --- linux-6.0.12/drivers/virtio/Makefile 2022-12-08 05:30:22.000000000 -0500
diff -uprN linux-5.3/drivers/virtio/Makefile linux-5.3-wl/drivers/virtio/Makefile +++ linux-6.0.12-wl/drivers/virtio/Makefile 2022-12-30 13:25:03.886404257 -0500
--- linux-5.3/drivers/virtio/Makefile 2019-09-15 17:19:32.000000000 -0400 @@ -12,3 +12,4 @@ obj-$(CONFIG_VIRTIO_INPUT) += virtio_inp
+++ linux-5.3-wl/drivers/virtio/Makefile 2019-09-19 23:01:36.338268667 -0400 obj-$(CONFIG_VIRTIO_VDPA) += virtio_vdpa.o
@@ -6,3 +6,4 @@ virtio_pci-y := virtio_pci_modern.o virt obj-$(CONFIG_VIRTIO_MEM) += virtio_mem.o
virtio_pci-$(CONFIG_VIRTIO_PCI_LEGACY) += virtio_pci_legacy.o obj-$(CONFIG_VIRTIO_DMA_SHARED_BUFFER) += virtio_dma_buf.o
obj-$(CONFIG_VIRTIO_BALLOON) += virtio_balloon.o
obj-$(CONFIG_VIRTIO_INPUT) += virtio_input.o
+obj-$(CONFIG_VIRTIO_WL) += virtio_wl.o +obj-$(CONFIG_VIRTIO_WL) += virtio_wl.o
diff -uprN linux-5.3/drivers/virtio/virtio_wl.c linux-5.3-wl/drivers/virtio/virtio_wl.c diff -uprN linux-6.0.12/drivers/virtio/virtio_wl.c linux-6.0.12-wl/drivers/virtio/virtio_wl.c
--- linux-5.3/drivers/virtio/virtio_wl.c 1969-12-31 19:00:00.000000000 -0500 --- linux-6.0.12/drivers/virtio/virtio_wl.c 1969-12-31 19:00:00.000000000 -0500
+++ linux-5.3-wl/drivers/virtio/virtio_wl.c 2019-09-19 23:08:03.337287120 -0400 +++ linux-6.0.12-wl/drivers/virtio/virtio_wl.c 2022-12-30 13:15:37.000000000 -0500
@@ -0,0 +1,1482 @@ @@ -0,0 +1,1598 @@
+/* +/*
+ * Wayland Virtio Driver + * Wayland Virtio Driver
+ * Copyright (C) 2017 Google, Inc. + * Copyright (C) 2017 Google, Inc.
@ -87,13 +85,15 @@ diff -uprN linux-5.3/drivers/virtio/virtio_wl.c linux-5.3-wl/drivers/virtio/virt
+#include <linux/syscalls.h> +#include <linux/syscalls.h>
+#include <linux/uaccess.h> +#include <linux/uaccess.h>
+#include <linux/virtio.h> +#include <linux/virtio.h>
+#include <linux/virtio_dma_buf.h>
+#include <linux/virtio_wl.h> +#include <linux/virtio_wl.h>
+#include <linux/vmalloc.h>
+ +
+#include <drm/virtio_drm.h>
+#include <uapi/linux/dma-buf.h> +#include <uapi/linux/dma-buf.h>
+ +
+#ifdef CONFIG_DRM_VIRTIO_GPU +#ifdef CONFIG_DRM_VIRTIO_GPU
+#define SEND_VIRTGPU_RESOURCES +#define SEND_VIRTGPU_RESOURCES
+#include <linux/sync_file.h>
+#endif +#endif
+ +
+#define VFD_ILLEGAL_SIGN_BIT 0x80000000 +#define VFD_ILLEGAL_SIGN_BIT 0x80000000
@ -137,6 +137,8 @@ diff -uprN linux-5.3/drivers/virtio/virtio_wl.c linux-5.3-wl/drivers/virtio/virt
+ +
+ struct mutex vfds_lock; + struct mutex vfds_lock;
+ struct idr vfds; + struct idr vfds;
+
+ bool use_send_vfd_v2;
+}; +};
+ +
+static struct virtwl_vfd *virtwl_vfd_alloc(struct virtwl_info *vi); +static struct virtwl_vfd *virtwl_vfd_alloc(struct virtwl_info *vi);
@ -736,28 +738,78 @@ diff -uprN linux-5.3/drivers/virtio/virtio_wl.c linux-5.3-wl/drivers/virtio/virt
+} +}
+ +
+#ifdef SEND_VIRTGPU_RESOURCES +#ifdef SEND_VIRTGPU_RESOURCES
+static int get_dma_buf_id(struct dma_buf *dma_buf, u32 *id)
+{
+ uuid_t uuid;
+ int ret = 0;
+
+ ret = virtio_dma_buf_get_uuid(dma_buf, &uuid);
+ *id = be32_to_cpu(*(__be32 *)(uuid.b + 12));
+
+ return ret;
+}
+
+static int encode_fence(struct dma_fence *fence,
+ struct virtio_wl_ctrl_vfd_send_vfd_v2 *vfd_id)
+{
+ const char *name = fence->ops->get_driver_name(fence);
+
+ // We only support virtgpu based fences. Since all virtgpu fences are
+ // in the same context, merging sync_files will always reduce to a
+ // single virtgpu fence.
+ if (strcmp(name, "virtio_gpu") != 0)
+ return -EBADFD;
+
+ if (dma_fence_is_signaled(fence)) {
+ vfd_id->kind =
+ VIRTIO_WL_CTRL_VFD_SEND_KIND_VIRTGPU_SIGNALED_FENCE;
+ } else {
+ vfd_id->kind = VIRTIO_WL_CTRL_VFD_SEND_KIND_VIRTGPU_FENCE;
+ vfd_id->seqno = cpu_to_le32(fence->seqno);
+ }
+ return 0;
+}
+
+static int encode_vfd_ids_foreign(struct virtwl_vfd **vfds, +static int encode_vfd_ids_foreign(struct virtwl_vfd **vfds,
+ struct dma_buf **virtgpu_dma_bufs, + struct dma_buf **virtgpu_dma_bufs,
+ struct dma_fence **virtgpu_dma_fence,
+ size_t vfd_count, + size_t vfd_count,
+ struct virtio_wl_ctrl_vfd_send_vfd *vfd_ids) + struct virtio_wl_ctrl_vfd_send_vfd *ids,
+ struct virtio_wl_ctrl_vfd_send_vfd_v2 *ids_v2)
+{ +{
+ size_t i; + size_t i;
+ int ret; + int ret;
+ +
+ for (i = 0; i < vfd_count; i++) { + for (i = 0; i < vfd_count; i++) {
+ uint32_t kind = UINT_MAX;
+ uint32_t id = 0;
+
+ if (vfds[i]) { + if (vfds[i]) {
+ vfd_ids[i].kind = VIRTIO_WL_CTRL_VFD_SEND_KIND_LOCAL; + kind = VIRTIO_WL_CTRL_VFD_SEND_KIND_LOCAL;
+ vfd_ids[i].id = cpu_to_le32(vfds[i]->id); + id = vfds[i]->id;
+ } else if (virtgpu_dma_bufs[i]) { + } else if (virtgpu_dma_bufs[i]) {
+ ret = virtio_gpu_dma_buf_to_handle(virtgpu_dma_bufs[i], + ret = get_dma_buf_id(virtgpu_dma_bufs[i],
+ false, + &id);
+ &vfd_ids[i].id); + if (ret)
+ return ret;
+ kind = VIRTIO_WL_CTRL_VFD_SEND_KIND_VIRTGPU;
+ } else if (virtgpu_dma_fence[i]) {
+ ret = encode_fence(virtgpu_dma_fence[i],
+ ids_v2 + i);
+ if (ret) + if (ret)
+ return ret; + return ret;
+ vfd_ids[i].kind = VIRTIO_WL_CTRL_VFD_SEND_KIND_VIRTGPU;
+ } else { + } else {
+ return -EBADFD; + return -EBADFD;
+ } + }
+ if (kind != UINT_MAX) {
+ if (ids) {
+ ids[i].kind = kind;
+ ids[i].id = cpu_to_le32(id);
+ } else {
+ ids_v2[i].kind = kind;
+ ids_v2[i].id = cpu_to_le32(id);
+ }
+ }
+ } + }
+ return 0; + return 0;
+} +}
@ -772,6 +824,7 @@ diff -uprN linux-5.3/drivers/virtio/virtio_wl.c linux-5.3-wl/drivers/virtio/virt
+ struct virtwl_vfd *vfds[VIRTWL_SEND_MAX_ALLOCS] = { 0 }; + struct virtwl_vfd *vfds[VIRTWL_SEND_MAX_ALLOCS] = { 0 };
+#ifdef SEND_VIRTGPU_RESOURCES +#ifdef SEND_VIRTGPU_RESOURCES
+ struct dma_buf *virtgpu_dma_bufs[VIRTWL_SEND_MAX_ALLOCS] = { 0 }; + struct dma_buf *virtgpu_dma_bufs[VIRTWL_SEND_MAX_ALLOCS] = { 0 };
+ struct dma_fence *virtgpu_dma_fence[VIRTWL_SEND_MAX_ALLOCS] = { 0 };
+ bool foreign_id = false; + bool foreign_id = false;
+#endif +#endif
+ size_t vfd_count = 0; + size_t vfd_count = 0;
@ -783,6 +836,9 @@ diff -uprN linux-5.3/drivers/virtio/virtio_wl.c linux-5.3-wl/drivers/virtio/virt
+ struct completion finish_completion; + struct completion finish_completion;
+ struct scatterlist out_sg; + struct scatterlist out_sg;
+ struct scatterlist in_sg; + struct scatterlist in_sg;
+ struct sg_table sgt;
+ struct vm_struct *area;
+ bool vmalloced;
+ int ret; + int ret;
+ int i; + int i;
+ +
@ -813,19 +869,33 @@ diff -uprN linux-5.3/drivers/virtio/virtio_wl.c linux-5.3-wl/drivers/virtio/virt
+ goto put_files; + goto put_files;
+ } else { + } else {
+ struct dma_buf *dma_buf = ERR_PTR(-EINVAL); + struct dma_buf *dma_buf = ERR_PTR(-EINVAL);
+ struct dma_fence *dma_fence = ERR_PTR(-EINVAL);
+ bool handled = false;
+
+#ifdef SEND_VIRTGPU_RESOURCES +#ifdef SEND_VIRTGPU_RESOURCES
+ dma_buf = dma_buf_get(vfd_fds[i]); + dma_buf = dma_buf_get(vfd_fds[i]);
+ dma_fence = vi->use_send_vfd_v2
+ ? sync_file_get_fence(vfd_fds[i])
+ : ERR_PTR(-EINVAL);
+ handled = !IS_ERR(dma_buf) ||
+ !IS_ERR(dma_fence);
+
+ if (!IS_ERR(dma_buf)) { + if (!IS_ERR(dma_buf)) {
+ fdput(vfd_file);
+ virtgpu_dma_bufs[i] = dma_buf; + virtgpu_dma_bufs[i] = dma_buf;
+ foreign_id = true; + } else {
+ vfd_count++; + virtgpu_dma_fence[i] = dma_fence;
+ continue;
+ } + }
+
+ foreign_id = true;
+ vfd_count++;
+#endif +#endif
+ fdput(vfd_file); + fdput(vfd_file);
+ ret = PTR_ERR(dma_buf); + if (!handled) {
+ goto put_files; + ret = IS_ERR(dma_buf) ?
+ PTR_ERR(dma_buf) :
+ PTR_ERR(dma_fence);
+ goto put_files;
+ }
+ } + }
+ } + }
+ } + }
@ -837,12 +907,19 @@ diff -uprN linux-5.3/drivers/virtio/virtio_wl.c linux-5.3-wl/drivers/virtio/virt
+ vfd_ids_size = vfd_count * sizeof(__le32); + vfd_ids_size = vfd_count * sizeof(__le32);
+#ifdef SEND_VIRTGPU_RESOURCES +#ifdef SEND_VIRTGPU_RESOURCES
+ if (foreign_id) { + if (foreign_id) {
+ vfd_ids_size = vfd_count * + vfd_ids_size = vfd_count * (vi->use_send_vfd_v2
+ sizeof(struct virtio_wl_ctrl_vfd_send_vfd); + ? sizeof(struct virtio_wl_ctrl_vfd_send_vfd_v2)
+ : sizeof(struct virtio_wl_ctrl_vfd_send_vfd));
+ } + }
+#endif +#endif
+ ctrl_send_size = sizeof(*ctrl_send) + vfd_ids_size + len; + ctrl_send_size = sizeof(*ctrl_send) + vfd_ids_size + len;
+ ctrl_send = kzalloc(ctrl_send_size, GFP_KERNEL); + vmalloced = false;
+ if (ctrl_send_size < PAGE_SIZE)
+ ctrl_send = kzalloc(ctrl_send_size, GFP_KERNEL);
+ else {
+ vmalloced = true;
+ ctrl_send = vzalloc(ctrl_send_size);
+ }
+ if (!ctrl_send) { + if (!ctrl_send) {
+ ret = -ENOMEM; + ret = -ENOMEM;
+ goto put_files; + goto put_files;
@ -854,9 +931,18 @@ diff -uprN linux-5.3/drivers/virtio/virtio_wl.c linux-5.3-wl/drivers/virtio/virt
+ ctrl_send->hdr.type = VIRTIO_WL_CMD_VFD_SEND; + ctrl_send->hdr.type = VIRTIO_WL_CMD_VFD_SEND;
+#ifdef SEND_VIRTGPU_RESOURCES +#ifdef SEND_VIRTGPU_RESOURCES
+ if (foreign_id) { + if (foreign_id) {
+ struct virtio_wl_ctrl_vfd_send_vfd *v1 = NULL;
+ struct virtio_wl_ctrl_vfd_send_vfd_v2 *v2 = NULL;
+
+ if (vi->use_send_vfd_v2)
+ v2 = (struct virtio_wl_ctrl_vfd_send_vfd_v2 *) vfd_ids;
+ else
+ v1 = (struct virtio_wl_ctrl_vfd_send_vfd *) vfd_ids;
+
+ ctrl_send->hdr.type = VIRTIO_WL_CMD_VFD_SEND_FOREIGN_ID; + ctrl_send->hdr.type = VIRTIO_WL_CMD_VFD_SEND_FOREIGN_ID;
+ ret = encode_vfd_ids_foreign(vfds, virtgpu_dma_bufs, vfd_count, + ret = encode_vfd_ids_foreign(vfds,
+ (struct virtio_wl_ctrl_vfd_send_vfd *)vfd_ids); + virtgpu_dma_bufs, virtgpu_dma_fence, vfd_count,
+ v1, v2);
+ } else { + } else {
+ ret = encode_vfd_ids(vfds, vfd_count, (__le32 *)vfd_ids); + ret = encode_vfd_ids(vfds, vfd_count, (__le32 *)vfd_ids);
+ } + }
@ -874,20 +960,38 @@ diff -uprN linux-5.3/drivers/virtio/virtio_wl.c linux-5.3-wl/drivers/virtio/virt
+ } + }
+ +
+ init_completion(&finish_completion); + init_completion(&finish_completion);
+ sg_init_one(&out_sg, ctrl_send, ctrl_send_size); + if (!vmalloced) {
+ sg_init_one(&in_sg, ctrl_send, sizeof(struct virtio_wl_ctrl_hdr)); + sg_init_one(&out_sg, ctrl_send, ctrl_send_size);
+ sg_init_one(&in_sg, ctrl_send,
+ sizeof(struct virtio_wl_ctrl_hdr));
+ ret = vq_queue_out(vi, &out_sg, &in_sg, &finish_completion,
+ filp->f_flags & O_NONBLOCK);
+ } else {
+ area = find_vm_area(ctrl_send);
+ ret = sg_alloc_table_from_pages(&sgt, area->pages,
+ area->nr_pages, 0, ctrl_send_size, GFP_KERNEL);
+ if (ret)
+ goto free_ctrl_send;
+ +
+ ret = vq_queue_out(vi, &out_sg, &in_sg, &finish_completion, + sg_init_table(&in_sg, 1);
+ filp->f_flags & O_NONBLOCK); + sg_set_page(&in_sg, area->pages[0],
+ sizeof(struct virtio_wl_ctrl_hdr), 0);
+
+ ret = vq_queue_out(vi, sgt.sgl, &in_sg, &finish_completion,
+ filp->f_flags & O_NONBLOCK);
+ }
+ if (ret) + if (ret)
+ goto free_ctrl_send; + goto free_sgt;
+ +
+ wait_for_completion(&finish_completion); + wait_for_completion(&finish_completion);
+ +
+ ret = virtwl_resp_err(ctrl_send->hdr.type); + ret = virtwl_resp_err(ctrl_send->hdr.type);
+ +
+free_sgt:
+ if (vmalloced)
+ sg_free_table(&sgt);
+free_ctrl_send: +free_ctrl_send:
+ kfree(ctrl_send); + kvfree(ctrl_send);
+put_files: +put_files:
+ for (i = 0; i < VIRTWL_SEND_MAX_ALLOCS; i++) { + for (i = 0; i < VIRTWL_SEND_MAX_ALLOCS; i++) {
+ if (vfd_files[i].file) + if (vfd_files[i].file)
@ -895,6 +999,8 @@ diff -uprN linux-5.3/drivers/virtio/virtio_wl.c linux-5.3-wl/drivers/virtio/virt
+#ifdef SEND_VIRTGPU_RESOURCES +#ifdef SEND_VIRTGPU_RESOURCES
+ if (virtgpu_dma_bufs[i]) + if (virtgpu_dma_bufs[i])
+ dma_buf_put(virtgpu_dma_bufs[i]); + dma_buf_put(virtgpu_dma_bufs[i]);
+ if (virtgpu_dma_fence[i])
+ dma_fence_put(virtgpu_dma_fence[i]);
+#endif +#endif
+ } + }
+ return ret; + return ret;
@ -1054,6 +1160,7 @@ diff -uprN linux-5.3/drivers/virtio/virtio_wl.c linux-5.3-wl/drivers/virtio/virt
+ int ret = 0; + int ret = 0;
+ +
+ if (ioctl_new->type != VIRTWL_IOCTL_NEW_CTX && + 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_ALLOC &&
+ ioctl_new->type != VIRTWL_IOCTL_NEW_PIPE_READ && + ioctl_new->type != VIRTWL_IOCTL_NEW_PIPE_READ &&
+ ioctl_new->type != VIRTWL_IOCTL_NEW_PIPE_WRITE && + ioctl_new->type != VIRTWL_IOCTL_NEW_PIPE_WRITE &&
@ -1090,6 +1197,11 @@ diff -uprN linux-5.3/drivers/virtio/virtio_wl.c linux-5.3-wl/drivers/virtio/virt
+ ctrl_new->hdr.type = VIRTIO_WL_CMD_VFD_NEW_CTX; + ctrl_new->hdr.type = VIRTIO_WL_CMD_VFD_NEW_CTX;
+ ctrl_new->flags = VIRTIO_WL_VFD_WRITE | VIRTIO_WL_VFD_READ; + ctrl_new->flags = VIRTIO_WL_VFD_WRITE | VIRTIO_WL_VFD_READ;
+ break; + 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: + case VIRTWL_IOCTL_NEW_ALLOC:
+ ctrl_new->hdr.type = VIRTIO_WL_CMD_VFD_NEW; + ctrl_new->hdr.type = VIRTIO_WL_CMD_VFD_NEW;
+ ctrl_new->size = PAGE_ALIGN(ioctl_new->size); + ctrl_new->size = PAGE_ALIGN(ioctl_new->size);
@ -1111,7 +1223,7 @@ diff -uprN linux-5.3/drivers/virtio/virtio_wl.c linux-5.3-wl/drivers/virtio/virt
+ sizeof(ioctl_new->dmabuf)); + sizeof(ioctl_new->dmabuf));
+ break; + break;
+ } + }
+ /* fall-through */ + fallthrough;
+ default: + default:
+ ret = -EINVAL; + ret = -EINVAL;
+ goto remove_vfd; + goto remove_vfd;
@ -1238,7 +1350,7 @@ diff -uprN linux-5.3/drivers/virtio/virtio_wl.c linux-5.3-wl/drivers/virtio/virt
+ if (vfds[i]) + if (vfds[i])
+ do_vfd_close(vfds[i]); + do_vfd_close(vfds[i]);
+ if (fds[i] >= 0) + if (fds[i] >= 0)
+ __close_fd(current->files, fds[i]); + close_fd(fds[i]);
+ } + }
+ return ret; + return ret;
+} +}
@ -1284,7 +1396,7 @@ diff -uprN linux-5.3/drivers/virtio/virtio_wl.c linux-5.3-wl/drivers/virtio/virt
+ int ret; + int ret;
+ +
+ /* Early check for user error. */ + /* Early check for user error. */
+ ret = !access_ok( ptr, size); + ret = !access_ok(ptr, size);
+ if (ret) + if (ret)
+ return -EFAULT; + return -EFAULT;
+ +
@ -1307,7 +1419,7 @@ diff -uprN linux-5.3/drivers/virtio/virtio_wl.c linux-5.3-wl/drivers/virtio/virt
+ ret = copy_to_user(ptr, &ioctl_new, size); + ret = copy_to_user(ptr, &ioctl_new, size);
+ if (ret) { + if (ret) {
+ /* The release operation will handle freeing this alloc */ + /* The release operation will handle freeing this alloc */
+ ksys_close(ioctl_new.fd); + close_fd(ioctl_new.fd);
+ return -EFAULT; + return -EFAULT;
+ } + }
+ +
@ -1413,8 +1525,8 @@ diff -uprN linux-5.3/drivers/virtio/virtio_wl.c linux-5.3-wl/drivers/virtio/virt
+ for (i = 0; i < VIRTWL_QUEUE_COUNT; i++) + for (i = 0; i < VIRTWL_QUEUE_COUNT; i++)
+ mutex_init(&vi->vq_locks[i]); + mutex_init(&vi->vq_locks[i]);
+ +
+ ret = virtio_find_vqs(vdev, VIRTWL_QUEUE_COUNT, vi->vqs, + ret = virtio_find_vqs(vdev, VIRTWL_QUEUE_COUNT, vi->vqs, vq_callbacks,
+ vq_callbacks, vq_names, NULL); + vq_names, NULL);
+ if (ret) { + if (ret) {
+ pr_warn("virtwl: failed to find virtio wayland queues: %d\n", + pr_warn("virtwl: failed to find virtio wayland queues: %d\n",
+ ret); + ret);
@ -1428,6 +1540,8 @@ diff -uprN linux-5.3/drivers/virtio/virtio_wl.c linux-5.3-wl/drivers/virtio/virt
+ mutex_init(&vi->vfds_lock); + mutex_init(&vi->vfds_lock);
+ idr_init(&vi->vfds); + idr_init(&vi->vfds);
+ +
+ vi->use_send_vfd_v2 = virtio_has_feature(vdev, VIRTIO_WL_F_SEND_FENCES);
+
+ /* lock is unneeded as we have unique ownership */ + /* lock is unneeded as we have unique ownership */
+ ret = vq_fill_locked(vi->vqs[VIRTWL_VQ_IN]); + ret = vq_fill_locked(vi->vqs[VIRTWL_VQ_IN]);
+ if (ret) { + if (ret) {
@ -1479,7 +1593,6 @@ diff -uprN linux-5.3/drivers/virtio/virtio_wl.c linux-5.3-wl/drivers/virtio/virt
+{ +{
+} +}
+ +
+
+static struct virtio_device_id id_table[] = { +static struct virtio_device_id id_table[] = {
+ { VIRTIO_ID_WL, VIRTIO_DEV_ANY_ID }, + { VIRTIO_ID_WL, VIRTIO_DEV_ANY_ID },
+ { 0 }, + { 0 },
@ -1490,7 +1603,8 @@ diff -uprN linux-5.3/drivers/virtio/virtio_wl.c linux-5.3-wl/drivers/virtio/virt
+}; +};
+ +
+static unsigned int features[] = { +static unsigned int features[] = {
+ VIRTIO_WL_F_TRANS_FLAGS + VIRTIO_WL_F_TRANS_FLAGS,
+ VIRTIO_WL_F_SEND_FENCES,
+}; +};
+ +
+static struct virtio_driver virtio_wl_driver = { +static struct virtio_driver virtio_wl_driver = {
@ -1510,48 +1624,21 @@ diff -uprN linux-5.3/drivers/virtio/virtio_wl.c linux-5.3-wl/drivers/virtio/virt
+MODULE_DEVICE_TABLE(virtio, id_table); +MODULE_DEVICE_TABLE(virtio, id_table);
+MODULE_DESCRIPTION("Virtio wayland driver"); +MODULE_DESCRIPTION("Virtio wayland driver");
+MODULE_LICENSE("GPL"); +MODULE_LICENSE("GPL");
diff -uprN linux-5.3/include/drm/virtio_drm.h linux-5.3-wl/include/drm/virtio_drm.h diff -uprN linux-6.0.12/include/uapi/linux/virtio_ids.h linux-6.0.12-wl/include/uapi/linux/virtio_ids.h
--- linux-5.3/include/drm/virtio_drm.h 1969-12-31 19:00:00.000000000 -0500 --- linux-6.0.12/include/uapi/linux/virtio_ids.h 2022-12-08 05:30:22.000000000 -0500
+++ linux-5.3-wl/include/drm/virtio_drm.h 2019-09-19 23:01:36.339268667 -0400 +++ linux-6.0.12-wl/include/uapi/linux/virtio_ids.h 2022-12-30 13:31:58.237086721 -0500
@@ -0,0 +1,24 @@ @@ -81,4 +81,7 @@
+/* SPDX-License-Identifier: GPL-2.0 */ #define VIRTIO_TRANS_ID_RNG 0x1005 /* transitional virtio rng */
+/* #define VIRTIO_TRANS_ID_9P 0x1009 /* transitional virtio 9p console */
+ * Virtio GPU interfaces for sharing data.
+ *
+ * Copyright (C) 2018 Google, Inc.
+ */
+
+#ifndef _VIRTIO_DRM_H
+#define _VIRTIO_DRM_H
+
+/*
+ * The following methods are to share dma bufs with a host via the
+ * virtio Wayland (virtwl) device.
+ */
+
+/*
+ * Converts the given dma_buf to the virtio-gpu specific resource handle
+ * backing the dma_buf, waiting for creation to be confirmed by the host
+ * if necessary.
+ */
+extern int virtio_gpu_dma_buf_to_handle(struct dma_buf *buf, bool no_wait,
+ uint32_t *handle);
+
+#endif /* _VIRTIO_DRM_H */
diff -uprN linux-5.3/include/uapi/linux/virtio_ids.h linux-5.3-wl/include/uapi/linux/virtio_ids.h
--- linux-5.3/include/uapi/linux/virtio_ids.h 2019-09-15 17:19:32.000000000 -0400
+++ linux-5.3-wl/include/uapi/linux/virtio_ids.h 2019-09-19 23:02:44.442271914 -0400
@@ -45,5 +45,6 @@
#define VIRTIO_ID_CRYPTO 20 /* virtio crypto */
#define VIRTIO_ID_IOMMU 23 /* virtio IOMMU */
#define VIRTIO_ID_PMEM 27 /* virtio pmem */
+#define VIRTIO_ID_WL 30 /* virtio wayland */
+#define VIRTIO_ID_WL 63 /* virtio wayland */
+
+
#endif /* _LINUX_VIRTIO_IDS_H */ #endif /* _LINUX_VIRTIO_IDS_H */
diff -uprN linux-5.3/include/uapi/linux/virtio_wl.h linux-5.3-wl/include/uapi/linux/virtio_wl.h diff -uprN linux-6.0.12/include/uapi/linux/virtio_wl.h linux-6.0.12-wl/include/uapi/linux/virtio_wl.h
--- linux-5.3/include/uapi/linux/virtio_wl.h 1969-12-31 19:00:00.000000000 -0500 --- linux-6.0.12/include/uapi/linux/virtio_wl.h 1969-12-31 19:00:00.000000000 -0500
+++ linux-5.3-wl/include/uapi/linux/virtio_wl.h 2019-09-19 23:01:36.340268667 -0400 +++ linux-6.0.12-wl/include/uapi/linux/virtio_wl.h 2022-12-30 13:15:42.000000000 -0500
@@ -0,0 +1,135 @@ @@ -0,0 +1,154 @@
+#ifndef _LINUX_VIRTIO_WL_H +#ifndef _LINUX_VIRTIO_WL_H
+#define _LINUX_VIRTIO_WL_H +#define _LINUX_VIRTIO_WL_H
+/* +/*
@ -1572,6 +1659,8 @@ diff -uprN linux-5.3/include/uapi/linux/virtio_wl.h linux-5.3-wl/include/uapi/li
+ +
+/* Enables the transition to new flag semantics */ +/* Enables the transition to new flag semantics */
+#define VIRTIO_WL_F_TRANS_FLAGS 1 +#define VIRTIO_WL_F_TRANS_FLAGS 1
+/* Enables send fence support with virtio_wl_ctrl_vfd_send_vfd_v2 */
+#define VIRTIO_WL_F_SEND_FENCES 2
+ +
+struct virtio_wl_config { +struct virtio_wl_config {
+}; +};
@ -1591,6 +1680,7 @@ diff -uprN linux-5.3/include/uapi/linux/virtio_wl.h linux-5.3-wl/include/uapi/li
+ VIRTIO_WL_CMD_VFD_NEW_DMABUF, /* virtio_wl_ctrl_vfd_new */ + 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_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_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_OK = 0x1000,
+ VIRTIO_WL_RESP_VFD_NEW = 0x1001, /* virtio_wl_ctrl_vfd_new */ + VIRTIO_WL_RESP_VFD_NEW = 0x1001, /* virtio_wl_ctrl_vfd_new */
@ -1632,18 +1722,22 @@ diff -uprN linux-5.3/include/uapi/linux/virtio_wl.h linux-5.3-wl/include/uapi/li
+ __le32 flags; /* virtio_wl_vfd_flags */ + __le32 flags; /* virtio_wl_vfd_flags */
+ __le64 pfn; /* first guest physical page frame number if VFD_MAP */ + __le64 pfn; /* first guest physical page frame number if VFD_MAP */
+ __le32 size; /* size in bytes if VIRTIO_WL_CMD_VFD_NEW* */ + __le32 size; /* size in bytes if VIRTIO_WL_CMD_VFD_NEW* */
+ /* buffer description if VIRTIO_WL_CMD_VFD_NEW_DMABUF */ + union {
+ struct { + /* buffer description if VIRTIO_WL_CMD_VFD_NEW_DMABUF */
+ __le32 width; /* width in pixels */ + struct {
+ __le32 height; /* height in pixels */ + __le32 width; /* width in pixels */
+ __le32 format; /* fourcc format */ + __le32 height; /* height in pixels */
+ __le32 stride0; /* return stride0 */ + __le32 format; /* fourcc format */
+ __le32 stride1; /* return stride1 */ + __le32 stride0; /* return stride0 */
+ __le32 stride2; /* return stride2 */ + __le32 stride1; /* return stride1 */
+ __le32 offset0; /* return offset0 */ + __le32 stride2; /* return stride2 */
+ __le32 offset1; /* return offset1 */ + __le32 offset0; /* return offset0 */
+ __le32 offset2; /* return offset2 */ + __le32 offset1; /* return offset1 */
+ } dmabuf; + __le32 offset2; /* return offset2 */
+ } dmabuf;
+ /* name of socket if VIRTIO_WL_CMD_VFD_NEW_CTX_NAMED */
+ char name[32];
+ };
+}; +};
+ +
+ +
@ -1652,6 +1746,8 @@ diff -uprN linux-5.3/include/uapi/linux/virtio_wl.h linux-5.3-wl/include/uapi/li
+ VIRTIO_WL_CTRL_VFD_SEND_KIND_LOCAL, + VIRTIO_WL_CTRL_VFD_SEND_KIND_LOCAL,
+ /* The id after this one is a virtio-gpu resource id. */ + /* The id after this one is a virtio-gpu resource id. */
+ VIRTIO_WL_CTRL_VFD_SEND_KIND_VIRTGPU, + VIRTIO_WL_CTRL_VFD_SEND_KIND_VIRTGPU,
+ VIRTIO_WL_CTRL_VFD_SEND_KIND_VIRTGPU_FENCE,
+ VIRTIO_WL_CTRL_VFD_SEND_KIND_VIRTGPU_SIGNALED_FENCE,
+}; +};
+ +
+struct virtio_wl_ctrl_vfd_send_vfd { +struct virtio_wl_ctrl_vfd_send_vfd {
@ -1659,6 +1755,16 @@ diff -uprN linux-5.3/include/uapi/linux/virtio_wl.h linux-5.3-wl/include/uapi/li
+ __le32 id; + __le32 id;
+}; +};
+ +
+struct virtio_wl_ctrl_vfd_send_vfd_v2 {
+ __le32 kind; /* virtio_wl_ctrl_vfd_send_kind */
+ union {
+ /* For KIND_LOCAL and KIND_VIRTGPU */
+ __le32 id;
+ /* For KIND_VIRTGPU_FENCE */
+ __le64 seqno;
+ };
+};
+
+struct virtio_wl_ctrl_vfd_send { +struct virtio_wl_ctrl_vfd_send {
+ struct virtio_wl_ctrl_hdr hdr; + struct virtio_wl_ctrl_hdr hdr;
+ __le32 vfd_id; + __le32 vfd_id;
@ -1687,10 +1793,10 @@ diff -uprN linux-5.3/include/uapi/linux/virtio_wl.h linux-5.3-wl/include/uapi/li
+}; +};
+ +
+#endif /* _LINUX_VIRTIO_WL_H */ +#endif /* _LINUX_VIRTIO_WL_H */
diff -uprN linux-5.3/include/uapi/linux/virtwl.h linux-5.3-wl/include/uapi/linux/virtwl.h diff -uprN linux-6.0.12/include/uapi/linux/virtwl.h linux-6.0.12-wl/include/uapi/linux/virtwl.h
--- linux-5.3/include/uapi/linux/virtwl.h 1969-12-31 19:00:00.000000000 -0500 --- linux-6.0.12/include/uapi/linux/virtwl.h 1969-12-31 19:00:00.000000000 -0500
+++ linux-5.3-wl/include/uapi/linux/virtwl.h 2019-09-19 23:01:36.340268667 -0400 +++ linux-6.0.12-wl/include/uapi/linux/virtwl.h 2022-12-30 13:15:42.000000000 -0500
@@ -0,0 +1,64 @@ @@ -0,0 +1,67 @@
+#ifndef _LINUX_VIRTWL_H +#ifndef _LINUX_VIRTWL_H
+#define _LINUX_VIRTWL_H +#define _LINUX_VIRTWL_H
+ +
@ -1714,6 +1820,7 @@ diff -uprN linux-5.3/include/uapi/linux/virtwl.h linux-5.3-wl/include/uapi/linux
+ VIRTWL_IOCTL_NEW_PIPE_WRITE, + VIRTWL_IOCTL_NEW_PIPE_WRITE,
+ /* create a new virtwl dmabuf that is writable via the returned fd */ + /* create a new virtwl dmabuf that is writable via the returned fd */
+ VIRTWL_IOCTL_NEW_DMABUF, + VIRTWL_IOCTL_NEW_DMABUF,
+ VIRTWL_IOCTL_NEW_CTX_NAMED, /* open a new named connection context */
+}; +};
+ +
+struct virtwl_ioctl_new { +struct virtwl_ioctl_new {
@ -1735,6 +1842,8 @@ diff -uprN linux-5.3/include/uapi/linux/virtwl.h linux-5.3-wl/include/uapi/linux
+ __u32 offset1; /* return offset1 */ + __u32 offset1; /* return offset1 */
+ __u32 offset2; /* return offset2 */ + __u32 offset2; /* return offset2 */
+ } dmabuf; + } dmabuf;
+ /* name of socket if type == VIRTIO_WL_CMD_VFD_NEW_CTX_NAMED */
+ char name[32];
+ }; + };
+}; +};
+ +

File diff suppressed because it is too large Load Diff

View File

@ -1 +0,0 @@
d6434bf06da20d6954efdf7639d9fc105ca3b1fb01338ab5d9b6deae4bf72e15 downloads/linux-5.3.tar

1
kernel/v6.1.8.sha256 Normal file
View File

@ -0,0 +1 @@
89db3fb6406df8c439c1fd92f20a7006e5f31f289e16e012672c899478f99f3f downloads/linux-6.1.8.tar