From patchwork Wed Jun 14 18:15:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurabh Singh Sengar X-Patchwork-Id: 10783 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp153716vqr; Wed, 14 Jun 2023 11:40:28 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6k/8TLCWdXCWrxQpPn4bs893YsOGjmJyVFmUthHbI9umJcRA4WVVC06IcwLQfz36oCH181 X-Received: by 2002:a17:902:f542:b0:1b3:e2f9:20ec with SMTP id h2-20020a170902f54200b001b3e2f920ecmr3247268plf.1.1686768027911; Wed, 14 Jun 2023 11:40:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686768027; cv=none; d=google.com; s=arc-20160816; b=QPp3bUPXbqfvh2HaXKu8vK8XW8+Wm2Utp+V4htieDu6CZx3N5kxc6dC2xjeRRpY8VJ b77234AwR9fRn5H7+ukxZMeFspVtd2iDrCrHYt8dMQNsLJUZjU4jAQ0RKVTffaL6oP0D YuHmHLJ1B5x1uR/NedCyizu7Cqz3AmC5oNi4sF7QzEJCLUynCGyx+NpoK44ryeW9nqka lNONCmlbzgrUMVtNLnRsRxwFgEu/TAUrbd5p8rTYi8gqcK7i9z8PEBrX875CRwkfqRQe ZKT0HEDB2vIzX+0vUgywvqK+yD+qZX3JhxIvl1dMcypRYhTMx3KSuJHSUfU9EmRS7MGp 92Cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:to:from:dkim-signature :dkim-filter; bh=P4/LsegbU0ZnJYipJHaEnVLb8YhEnuCaEclVr3qm9DQ=; b=hDy6k+Jg0bW5Hdo/qPZqyuHSUMa+KhEdNqBv7//ZoNizY8qgh0cu0Hw1SYDFFAB8CB gKEGS4M8nQcQCxnMrm7geZh4C1z1qXi91UYGRVbrOzTGMzcr2yufCmbaI3tBGoVLsYXd tAmLvxzpJvEjpoikkZNf9p20fbShtwChzGhfhL2rBhMiw6bLbYaIIyvp18ntzeftNZvg mO+z1ObKTHN8jZyzv+m7uS0YdK4GLGcqq6PHGl3UzZRvUnkdtii8JWCf/0SjMethQ4tk 0LgFiBJ4yCEuyWukwFCAVoZbMemn+gc5n/JnVIFREMD7imflPswJDvJdb/apRGrDjKrL qxrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=gIAqO0De; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w4-20020a170902904400b001b3d5ec6739si5095772plz.481.2023.06.14.11.40.14; Wed, 14 Jun 2023 11:40:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=gIAqO0De; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241786AbjFNSQp (ORCPT + 99 others); Wed, 14 Jun 2023 14:16:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243174AbjFNSPV (ORCPT ); Wed, 14 Jun 2023 14:15:21 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1A47426BF; Wed, 14 Jun 2023 11:15:17 -0700 (PDT) Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id 8A6B720FE871; Wed, 14 Jun 2023 11:15:16 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 8A6B720FE871 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1686766516; bh=P4/LsegbU0ZnJYipJHaEnVLb8YhEnuCaEclVr3qm9DQ=; h=From:To:Subject:Date:From; b=gIAqO0DeiZnxdnWILAk4/Jz2l/XGtReoT+t6sQG+NaKAPjqZbzCuLaB9G8tRv5GuL wCNv8Azx8pvcCBGpKpYO7lTtJLOP/j4vsftKUMLwIbfTF1k4JbSjVD2TafiWY1TI/v eEzGKZFSZKRiesM7wCGLCZ+kQ0zpEvkq/vIa8czA= From: Saurabh Sengar To: kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, mikelley@microsoft.com, gregkh@linuxfoundation.org, corbet@lwn.net, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH v2 0/5] UIO driver for low speed Hyper-V devices Date: Wed, 14 Jun 2023 11:15:07 -0700 Message-Id: <1686766512-2589-1-git-send-email-ssengar@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 X-Spam-Status: No, score=-19.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768704471721456105?= X-GMAIL-MSGID: =?utf-8?q?1768704471721456105?= Hyper-V is adding some low speed "specialty" synthetic devices. This patch series propose the solution to support these devices. Instead of writing new kernel-level VMBus drivers for all of these devices, we propose a solution wherein these devices are made accessible to user space through a dedicated UIO-based hv_vmbus_client driver, allowing for efficient device handling via user space drivers. This solution aims to optimize the development process by eliminating the need to create individual kernel-level VMBus drivers for each device and provide flexibility to user space applications to control the ring buffer independently. Since all these new synthetic devices are low speed devices, they don't support monitor bits and we must use vmbus_setevent() to enable interrupts from the host. The new uio driver supports all these requirements effectively. Additionally, this new driver also provide the support for having smaller/cutom ringbuffer size. Furthermore, this patch series includes a revision of the fcopy application to leverage the new interface seamlessly along with removal of old driver and application. However, please note that the development of other similar drivers is still a work in progress, and will be shared as they become available. [V2] 1. Update driver info in Documentation/driver-api/uio-howto.rst 2. Update ring_size sysfs info in Documentation/ABI/stable/sysfs-bus-vmbus 3. Remove DRIVER_VERSION 4. Remove refcnt 5. scnprintf -> sysfs_emit 6. sysfs_create_file -> ATTRIBUTE_GROUPS + ".driver.groups"; 7. sysfs_create_bin_file -> device_create_bin_file 8. dev_notice -> dev_err 9. Removed invalid free of devm_ allocated data 10. Updated application with simpler sysfs path Saurabh Sengar (5): uio: Add hv_vmbus_client driver tools: hv: Add vmbus_bufring tools: hv: Add new fcopy application based on uio driver tools: hv: Remove hv_fcopy_daemon Drivers: hv: Remove fcopy driver Documentation/ABI/stable/sysfs-bus-vmbus | 7 + Documentation/driver-api/uio-howto.rst | 46 +++ drivers/hv/Makefile | 2 +- drivers/hv/hv_fcopy.c | 427 -------------------- drivers/hv/hv_util.c | 12 - drivers/uio/Kconfig | 12 + drivers/uio/Makefile | 1 + drivers/uio/uio_hv_vmbus_client.c | 217 ++++++++++ tools/hv/Build | 3 +- tools/hv/Makefile | 10 +- tools/hv/hv_fcopy_daemon.c | 266 ------------ tools/hv/hv_fcopy_uio_daemon.c | 489 +++++++++++++++++++++++ tools/hv/vmbus_bufring.c | 322 +++++++++++++++ tools/hv/vmbus_bufring.h | 158 ++++++++ 14 files changed, 1260 insertions(+), 712 deletions(-) delete mode 100644 drivers/hv/hv_fcopy.c create mode 100644 drivers/uio/uio_hv_vmbus_client.c delete mode 100644 tools/hv/hv_fcopy_daemon.c create mode 100644 tools/hv/hv_fcopy_uio_daemon.c create mode 100644 tools/hv/vmbus_bufring.c create mode 100644 tools/hv/vmbus_bufring.h