From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5779EC433DF for ; Mon, 19 Oct 2020 15:48:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 87FBB22283 for ; Mon, 19 Oct 2020 15:48:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=bytedance-com.20150623.gappssmtp.com header.i=@bytedance-com.20150623.gappssmtp.com header.b="K8N2QxE8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 87FBB22283 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bytedance.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 080106B0072; Mon, 19 Oct 2020 11:48:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 00C256B0078; Mon, 19 Oct 2020 11:48:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E444E6B0072; Mon, 19 Oct 2020 11:48:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0184.hostedemail.com [216.40.44.184]) by kanga.kvack.org (Postfix) with ESMTP id ABDBC6B0072 for ; Mon, 19 Oct 2020 11:48:27 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 42FBF181AC9BF for ; Mon, 19 Oct 2020 15:48:27 +0000 (UTC) X-FDA: 77389107054.15.mint20_020daf027238 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin15.hostedemail.com (Postfix) with ESMTP id 09A1B1814B0C7 for ; Mon, 19 Oct 2020 15:48:27 +0000 (UTC) X-HE-Tag: mint20_020daf027238 X-Filterd-Recvd-Size: 10838 Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) by imf06.hostedemail.com (Postfix) with ESMTP for ; Mon, 19 Oct 2020 15:48:26 +0000 (UTC) Received: by mail-ed1-f54.google.com with SMTP id 33so10732636edq.13 for ; Mon, 19 Oct 2020 08:48:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Tusw4LJI9WQleO8byXr9oWdBCI6HuTwPpa5n0aa6ukY=; b=K8N2QxE8qeJfDdpp2BQvHQnudAczv+ybr1z1PoT4Ruc8mYYfA4RZ7rsAMOnamvMsrn Nffxm4J6mOIm6+5jewlTEFa6zZW4cxh0/3eERrMaDfjJ0mTSFRq0QhKRYD2K32xWOp7t p7I9WNeGu+e7fcPz780kI6EWc2s1s699l38dHrlHCIRmap8k7kLnHZsASw9Y25ux4FYu qC++SkpPEwH64SYMFtJwIANxq/VJPPEOsOZ6B0+ohaReROYb+rxT4ab7sVj8e8xXpmVq G0SbETnUZe4hXoS3y0Ws8BPmaM0Hf615QzshO2gf5jGH8ED6xZlW0Y/5PG/HfO4a72tY +Pdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Tusw4LJI9WQleO8byXr9oWdBCI6HuTwPpa5n0aa6ukY=; b=Z+mqDJNzl61xNGAggzv8XvH2Mo1Rr1PqW5kI/+hZ/cnb9Fy2vHR72Kik+5iJ5StroJ F0yffx+Evk1ftX7fHsSXM3Q3We5yoMamccw/+2J/WdYs5a45eueWURp6BoPD0jloghXe BdgC49MahpNqEJM+RFlVjjRxGY9DCQTvGbZkW7ftY8ZqgrVdpqUaUcatH6R7rdAKoEmS uLJEr4UbpC8TB+WZjmz/PZLqTAIgxkCpXTGmglXIvU2RkMVdB2bTucK6n3kC89EwQIFp du3txzmelfZOlBgd9vUeosqblmP9K6wZ1m2GFEgMt+3bsmp4ZUSuHao5XglxP65Lecqd h7MA== X-Gm-Message-State: AOAM532daSFW27tz9V1/GBwYd7SYvOEA06BuNtCmdrmV7508Nf8K9zkt T4p4Bm3zE5ctwcjec77A8xt5VdqO66i2nJTrf+cq X-Google-Smtp-Source: ABdhPJx5d1CneyInciRMx3lxoBsxQzzznzwKH3Moo08qypW1BHX5e7L+J99zHbAw9VVjmMsZn8YL5/dEDdkmQHIjnH4= X-Received: by 2002:aa7:d759:: with SMTP id a25mr426553eds.344.1603122505103; Mon, 19 Oct 2020 08:48:25 -0700 (PDT) MIME-Version: 1.0 References: <20201019145623.671-1-xieyongji@bytedance.com> <20201019145623.671-3-xieyongji@bytedance.com> <20201019110740-mutt-send-email-mst@kernel.org> In-Reply-To: <20201019110740-mutt-send-email-mst@kernel.org> From: =?UTF-8?B?6LCi5rC45ZCJ?= Date: Mon, 19 Oct 2020 23:48:14 +0800 Message-ID: Subject: Re: [External] Re: [RFC 2/4] vduse: Introduce VDUSE - vDPA Device in Userspace To: "Michael S. Tsirkin" Cc: jasowang@redhat.com, akpm@linux-foundation.org, linux-mm@kvack.org, virtualization@lists.linux-foundation.org Content-Type: multipart/alternative; boundary="00000000000072e44c05b2080bb3" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: --00000000000072e44c05b2080bb3 Content-Type: text/plain; charset="UTF-8" On Mon, Oct 19, 2020 at 11:09 PM Michael S. Tsirkin wrote: > On Mon, Oct 19, 2020 at 10:56:21PM +0800, Xie Yongji wrote: > > diff --git a/include/uapi/linux/vduse.h b/include/uapi/linux/vduse.h > > new file mode 100644 > > index 000000000000..855d2116b3a6 > > --- /dev/null > > +++ b/include/uapi/linux/vduse.h > > @@ -0,0 +1,85 @@ > > +/* SPDX-License-Identifier: GPL-2.0 */ > > +#ifndef _UAPI_VDUSE_H_ > > +#define _UAPI_VDUSE_H_ > > + > > +#include > > + > > +#define VDUSE_CONFIG_DATA_LEN 8 > > + > > +enum vduse_req_type { > > + VDUSE_SET_VQ_STATE, > > + VDUSE_SET_FEATURES, > > + VDUSE_GET_FEATURES, > > + VDUSE_SET_STATUS, > > + VDUSE_GET_STATUS, > > + VDUSE_SET_CONFIG, > > + VDUSE_GET_CONFIG, > > +}; > > + > > +struct vduse_vq_state { > > + __u32 index; > > + __u32 num; > > + __u64 desc_addr; > > + __u64 driver_addr; > > + __u64 device_addr; > > + __u8 ready; > > +}; > > + > > +struct vduse_dev_config_data { > > + __u32 offset; > > + __u32 len; > > + __u8 data[VDUSE_CONFIG_DATA_LEN]; > > +}; > > + > > +struct vduse_dev_request { > > + __u32 type; > > + __u32 unique; > > + __u32 flags; > > + __u32 size; > > + union { > > + struct vduse_vq_state vq_state; > > + struct vduse_dev_config_data config; > > + __u64 features; > > + __u8 status; > > + }; > > +}; > > + > > +struct vduse_dev_response { > > + __u32 unique; > > + __s32 result; > > + union { > > + struct vduse_dev_config_data config; > > + __u64 features; > > + __u8 status; > > + }; > > +}; > > + > > +/* ioctl */ > > + > > +struct vduse_dev_config { > > + __u32 id; > > + __u32 vendor_id; > > + __u32 device_id; > > + __u64 iova_size; > > + __u16 vq_num; > > + __u16 vq_size_max; > > + __u32 vq_align; > > +}; > > + > > +struct vduse_vq_eventfd { > > + __u32 index; > > + __u32 fd; > > +}; > > + > > +#define VDUSE_BASE 'V' > > + > > +#define VDUSE_CREATE_DEV _IOW(VDUSE_BASE, 0x01, struct > vduse_dev_config) > > +#define VDUSE_GET_DEV _IO(VDUSE_BASE, 0x02) > > +#define VDUSE_DESTROY_DEV _IO(VDUSE_BASE, 0x03) > > + > > +#define VDUSE_DEV_START _IO(VDUSE_BASE, 0x04) > > +#define VDUSE_DEV_STOP _IO(VDUSE_BASE, 0x05) > > +#define VDUSE_VQ_SETUP_KICKFD _IOW(VDUSE_BASE, 0x06, struct > vduse_vq_eventfd) > > +#define VDUSE_VQ_SETUP_IRQFD _IOW(VDUSE_BASE, 0x07, struct > vduse_vq_eventfd) > > + > > +#endif /* _UAPI_VDUSE_H_ */ > > > Could we see some documentation about the user interface of this module > please? > > Sure. Will do it! Thanks, Yongji > > -- > > 2.25.1 > > --00000000000072e44c05b2080bb3 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Mon, Oct 19, 2020 at 11:09 PM Mich= ael S. Tsirkin <mst@redhat.com>= wrote:
On Mon, = Oct 19, 2020 at 10:56:21PM +0800, Xie Yongji wrote:
> diff --git a/include/uapi/linux/vduse.h b/include/uapi/linux/vduse.h > new file mode 100644
> index 000000000000..855d2116b3a6
> --- /dev/null
> +++ b/include/uapi/linux/vduse.h
> @@ -0,0 +1,85 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef _UAPI_VDUSE_H_
> +#define _UAPI_VDUSE_H_
> +
> +#include <linux/types.h>
> +
> +#define VDUSE_CONFIG_DATA_LEN=C2=A0 =C2=A0 =C2=A0 =C2=A0 8
> +
> +enum vduse_req_type {
> +=C2=A0 =C2=A0 =C2=A0VDUSE_SET_VQ_STATE,
> +=C2=A0 =C2=A0 =C2=A0VDUSE_SET_FEATURES,
> +=C2=A0 =C2=A0 =C2=A0VDUSE_GET_FEATURES,
> +=C2=A0 =C2=A0 =C2=A0VDUSE_SET_STATUS,
> +=C2=A0 =C2=A0 =C2=A0VDUSE_GET_STATUS,
> +=C2=A0 =C2=A0 =C2=A0VDUSE_SET_CONFIG,
> +=C2=A0 =C2=A0 =C2=A0VDUSE_GET_CONFIG,
> +};
> +
> +struct vduse_vq_state {
> +=C2=A0 =C2=A0 =C2=A0__u32 index;
> +=C2=A0 =C2=A0 =C2=A0__u32 num;
> +=C2=A0 =C2=A0 =C2=A0__u64 desc_addr;
> +=C2=A0 =C2=A0 =C2=A0__u64 driver_addr;
> +=C2=A0 =C2=A0 =C2=A0__u64 device_addr;
> +=C2=A0 =C2=A0 =C2=A0__u8 ready;
> +};
> +
> +struct vduse_dev_config_data {
> +=C2=A0 =C2=A0 =C2=A0__u32 offset;
> +=C2=A0 =C2=A0 =C2=A0__u32 len;
> +=C2=A0 =C2=A0 =C2=A0__u8 data[VDUSE_CONFIG_DATA_LEN];
> +};
> +
> +struct vduse_dev_request {
> +=C2=A0 =C2=A0 =C2=A0__u32 type;
> +=C2=A0 =C2=A0 =C2=A0__u32 unique;
> +=C2=A0 =C2=A0 =C2=A0__u32 flags;
> +=C2=A0 =C2=A0 =C2=A0__u32 size;
> +=C2=A0 =C2=A0 =C2=A0union {
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0struct vduse_vq_state= vq_state;
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0struct vduse_dev_conf= ig_data config;
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__u64 features;
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__u8 status;
> +=C2=A0 =C2=A0 =C2=A0};
> +};
> +
> +struct vduse_dev_response {
> +=C2=A0 =C2=A0 =C2=A0__u32 unique;
> +=C2=A0 =C2=A0 =C2=A0__s32 result;
> +=C2=A0 =C2=A0 =C2=A0union {
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0struct vduse_dev_conf= ig_data config;
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__u64 features;
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__u8 status;
> +=C2=A0 =C2=A0 =C2=A0};
> +};
> +
> +/* ioctl */
> +
> +struct vduse_dev_config {
> +=C2=A0 =C2=A0 =C2=A0__u32 id;
> +=C2=A0 =C2=A0 =C2=A0__u32 vendor_id;
> +=C2=A0 =C2=A0 =C2=A0__u32 device_id;
> +=C2=A0 =C2=A0 =C2=A0__u64 iova_size;
> +=C2=A0 =C2=A0 =C2=A0__u16 vq_num;
> +=C2=A0 =C2=A0 =C2=A0__u16 vq_size_max;
> +=C2=A0 =C2=A0 =C2=A0__u32 vq_align;
> +};
> +
> +struct vduse_vq_eventfd {
> +=C2=A0 =C2=A0 =C2=A0__u32 index;
> +=C2=A0 =C2=A0 =C2=A0__u32 fd;
> +};
> +
> +#define VDUSE_BASE=C2=A0 =C2=A0'V'
> +
> +#define VDUSE_CREATE_DEV=C2=A0 =C2=A0 =C2=A0_IOW(VDUSE_BASE, 0x01, st= ruct vduse_dev_config)
> +#define VDUSE_GET_DEV=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 _IO(VDUSE_BASE, 0x02)
> +#define VDUSE_DESTROY_DEV=C2=A0 =C2=A0 _IO(VDUSE_BASE, 0x03)
> +
> +#define VDUSE_DEV_START=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 _IO(VDUSE_BASE, 0x04)
> +#define VDUSE_DEV_STOP=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0_IO(VDUSE_BASE, 0x05)
> +#define VDUSE_VQ_SETUP_KICKFD=C2=A0 =C2=A0 =C2=A0 =C2=A0 _IOW(VDUSE_B= ASE, 0x06, struct vduse_vq_eventfd)
> +#define VDUSE_VQ_SETUP_IRQFD _IOW(VDUSE_BASE, 0x07, struct vduse_vq_e= ventfd)
> +
> +#endif /* _UAPI_VDUSE_H_ */


Could we see some documentation about the user interface of this module ple= ase?


Sure.=C2=A0Will do it!

<= /div>
Thanks,
Yongji
=C2=A0
> --
> 2.25.1

--00000000000072e44c05b2080bb3--