Re: [PATCH] misc: vmw_zerocopy: Add VMware zero-copy buffer sharing driver
From: Greg KH
Date: Thu Jun 18 2026 - 06:29:39 EST
On Wed, Jun 17, 2026 at 01:31:25PM -0700, Rishi Chhibber wrote:
> This driver implements a character device (/dev/vmw_zc) that allows
> guest userspace applications to share pinned memory buffers with a
> VMware hypervisor-side peer using the VMCI datagram interface.
Why is this a new char device, don't we already have virtio apis for
this type of thing?
> The driver pins user pages via get_user_pages_fast(), transmits their
> physical page frame numbers to the hypervisor peer over VMCI, and
> avoids an intermediate copy between the guest workload VM and the
> hypervisor.
>
> Signed-off-by: Rishi Chhibber <rishi.chhibber@xxxxxxxxxxxx>
> ---
> MAINTAINERS | 8 +
> drivers/misc/Kconfig | 1 +
> drivers/misc/Makefile | 1 +
> drivers/misc/vmw_zerocopy/Kconfig | 16 +
> drivers/misc/vmw_zerocopy/Makefile | 17 +
> .../misc/vmw_zerocopy/vmw_zerocopy_driver.c | 490 ++++++++++++++++++
> .../misc/vmw_zerocopy/vmw_zerocopy_driver.h | 51 ++
> .../uapi/linux/vmw_zerocopy_ioctl_common.h | 66 +++
> 8 files changed, 650 insertions(+)
> create mode 100644 drivers/misc/vmw_zerocopy/Kconfig
> create mode 100644 drivers/misc/vmw_zerocopy/Makefile
> create mode 100644 drivers/misc/vmw_zerocopy/vmw_zerocopy_driver.c
> create mode 100644 drivers/misc/vmw_zerocopy/vmw_zerocopy_driver.h
> create mode 100644 include/uapi/linux/vmw_zerocopy_ioctl_common.h
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index efd1fa7d66f0..59ee66158486 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -24790,6 +24790,14 @@ L: linux-kernel@xxxxxxxxxxxxxxx
> S: Supported
> F: net/vmw_vsock/vmci_transport*
>
> +VMWARE ZEROCOPY DRIVER
> +M: Rishi Chhibber <rishi.chhibber@xxxxxxxxxxxx>
> +R: Broadcom internal kernel review list <bcm-kernel-feedback-list@xxxxxxxxxxxx>
Please don't put closed lists in the MAINTAINERS file, that just causes
bounces.
> +static int vmw_zc_release(struct inode *inode, struct file *file)
> +{
> + pr_debug(LGPFX "release\n");
> + return 0;
> +}
If you do nothing in a function, no need to have it at all, right?
> +static int __init vmw_zc_init(void)
> +{
> + dev_t dev;
> + int ret;
> + struct device *mydev;
> +
> + pr_info(LGPFX "loading\n");
When drivers work properly, they are quiet.
> +
> + ret = alloc_chrdev_region(&dev, 0, 1, VMW_ZC_DEVICE_NAME);
As you only want one char device, why not use miscdev instead?
> + if (ret) {
> + pr_err(LGPFX "alloc_chrdev_region failed: %d\n", ret);
No need for the LGPFX stuff everywhere, you all do know about pr_fmt(),
right?
> --- /dev/null
> +++ b/drivers/misc/vmw_zerocopy/vmw_zerocopy_driver.h
> @@ -0,0 +1,51 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later */
I have to ask, are you sure about "or later"?
> +/*
> + * Copyright (c) 2026 Broadcom. All Rights Reserved. The term
> + * "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
> + *
> + * Wire-format messages sent to the peer over VMCI (driver private).
> + * Limits and raw size must stay in sync with include/uapi/linux/vmw_zerocopy_ioctl_common.h
How is that going to happen? Why not just keep everything in one file?
> + */
> +
> +#ifndef _VMW_ZC_HOST_H
> +#define _VMW_ZC_HOST_H
> +
> +#include <linux/mm.h>
> +#include <linux/types.h>
> +
> +#include <linux/vmw_zerocopy_ioctl_common.h>
> +
> +#define VMW_ZC_MAX_METADATA_SIZE 1024
> +#define VMW_ZC_MAX_BUFFER_SIZE (64 * 1024UL)
> +#define VMW_ZC_MAX_PAGES \
> + (((VMW_ZC_MAX_BUFFER_SIZE) + (PAGE_SIZE - 1)) / PAGE_SIZE + 1)
> +
> +struct vmw_zc_msg_unit {
> + __u32 offset;
> + __u32 length;
> + __u32 num_pages;
> + __u32 padding1;
> + __u64 page_pfns[VMW_ZC_MAX_PAGES];
Why do you have an internal structure defined with __u32 and the like?
That's only a type that crosses the user/kernel boundry, and it would be
implied this would be defined in the uapi .h file, right?
thanks,
greg k-h