Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1726830ybg; Sat, 19 Oct 2019 01:10:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqxGg7g35Ez3T+KStXwP/M4N70HiS27KDaNdpzs5BrsiUoAqwwU5R5CcjkeJOjEPtKayxkAk X-Received: by 2002:a50:fa42:: with SMTP id c2mr454800edq.112.1571472652584; Sat, 19 Oct 2019 01:10:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571472652; cv=none; d=google.com; s=arc-20160816; b=WHKNDWtKvoLNJ+dcgagkta8arAtOE1Ja1Xp2qhsuIJ6O1hW5cluUq6tEZ4RlFdNFYf A/r1F0t2yeWE6oPx+rgTnwSC0wQPVvKfvpx6crDTx5ONBLHY0qmZjC+STyvhMlBZhtWM 6Acje9upW+u74YRvOfdYxAyve/uGxuZuzmIYZvZiz/cJQlqtLwEEmOTbSPZ0+ZBbPzb7 rAPEzi4XNnNz+McP1WAY8owzLWHX1pyQg1Tz+cFrvZMTzQOGnH3dOkOCrZdWtPBH3cQQ DwplkjbJ1QoVueyo72w3isbZvmJrgQoOsGUtN8JPjzLwVYBHzceEyddt1yDxUP0yqMw5 mplA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=vvM9V7dmzx7Sa9wDqbmrq44KmyvvfOVwQz7hb9b2CAA=; b=xFgSXeGqp/xzBrKkPLHZ1Iz/qXPJ1WrGFztvReqaGNUfGWWZBpHgsqPpwEG010j/18 CP0PyATV/JvZGmFaiWFCBJd+umyw93zzQ38ibS9UBctgbiSKWJBLje912WKtpzbHL2Rq 35FekZLL2prcMbSjePZpTMaLSpqMNdRbBx/puC8b97UaKbda+Ws8ZOdCs1E3tyRzUKzb 2HGdJGQ9L/cep18iiw3NquP/KGfi13rfVOC7jcB66jnzs8jBnIRMTw/hJsBHp5Hifoeo 4Eqw2ds49LYoSSRFORKbUBQtjCloz65egdLfTIpO4rOWVLNKy5hiYBxcLdj5eFsjtl5k 80PQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p5si1086596eja.141.2019.10.19.01.10.29; Sat, 19 Oct 2019 01:10:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2437338AbfJRJuI (ORCPT + 99 others); Fri, 18 Oct 2019 05:50:08 -0400 Received: from mga02.intel.com ([134.134.136.20]:27222 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730808AbfJRJuI (ORCPT ); Fri, 18 Oct 2019 05:50:08 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Oct 2019 02:50:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,311,1566889200"; d="scan'208";a="195420728" Received: from dpdk-virtio-tbie-2.sh.intel.com (HELO ___) ([10.67.104.74]) by fmsmga008.fm.intel.com with ESMTP; 18 Oct 2019 02:50:00 -0700 Date: Fri, 18 Oct 2019 17:46:56 +0800 From: Tiwei Bie To: Jason Wang Cc: kvm@vger.kernel.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, kwankhede@nvidia.com, alex.williamson@redhat.com, mst@redhat.com, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, cohuck@redhat.com, maxime.coquelin@redhat.com, cunming.liang@intel.com, zhihong.wang@intel.com, rob.miller@broadcom.com, xiao.w.wang@intel.com, haotian.wang@sifive.com, zhenyuw@linux.intel.com, zhi.a.wang@intel.com, jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com, airlied@linux.ie, daniel@ffwll.ch, farman@linux.ibm.com, pasic@linux.ibm.com, sebott@linux.ibm.com, oberpar@linux.ibm.com, heiko.carstens@de.ibm.com, gor@linux.ibm.com, borntraeger@de.ibm.com, akrowiak@linux.ibm.com, freude@linux.ibm.com, lingshan.zhu@intel.com, idos@mellanox.com, eperezma@redhat.com, lulu@redhat.com, parav@mellanox.com, christophe.de.dinechin@gmail.com, kevin.tian@intel.com, stefanha@redhat.com Subject: Re: [PATCH V4 4/6] mdev: introduce virtio device and its device ops Message-ID: <20191018094655.GA4200@___> References: <20191017104836.32464-1-jasowang@redhat.com> <20191017104836.32464-5-jasowang@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20191017104836.32464-5-jasowang@redhat.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 17, 2019 at 06:48:34PM +0800, Jason Wang wrote: > + * @get_vq_state: Get the state for a virtqueue > + * @mdev: mediated device > + * @idx: virtqueue index > + * Returns virtqueue state (last_avail_idx) > + * @get_vq_align: Get the virtqueue align requirement > + * for the device > + * @mdev: mediated device > + * Returns virtqueue algin requirement > + * @get_features: Get virtio features supported by the device > + * @mdev: mediated device > + * Returns the virtio features support by the > + * device > + * @get_features: Set virtio features supported by the driver s/get_features/set_features/ > + * configration space > + * @get_mdev_features: Get the feature of virtio mdev device > + * @mdev: mediated device > + * Returns the mdev features (API) support by > + * the device. > + * @get_generation: Get device generaton > + * @mdev: mediated device > + * Returns u32: device generation > + */ > +struct virtio_mdev_device_ops { > + /* Virtqueue ops */ > + int (*set_vq_address)(struct mdev_device *mdev, > + u16 idx, u64 desc_area, u64 driver_area, > + u64 device_area); > + void (*set_vq_num)(struct mdev_device *mdev, u16 idx, u32 num); > + void (*kick_vq)(struct mdev_device *mdev, u16 idx); > + void (*set_vq_cb)(struct mdev_device *mdev, u16 idx, > + struct virtio_mdev_callback *cb); > + void (*set_vq_ready)(struct mdev_device *mdev, u16 idx, bool ready); > + bool (*get_vq_ready)(struct mdev_device *mdev, u16 idx); > + int (*set_vq_state)(struct mdev_device *mdev, u16 idx, u64 state); > + u64 (*get_vq_state)(struct mdev_device *mdev, u16 idx); > + > + /* Device ops */ > + u16 (*get_vq_align)(struct mdev_device *mdev); > + u64 (*get_features)(struct mdev_device *mdev); > + int (*set_features)(struct mdev_device *mdev, u64 features); > + void (*set_config_cb)(struct mdev_device *mdev, > + struct virtio_mdev_callback *cb); > + u16 (*get_vq_num_max)(struct mdev_device *mdev); > + u32 (*get_device_id)(struct mdev_device *mdev); > + u32 (*get_vendor_id)(struct mdev_device *mdev); > + u8 (*get_status)(struct mdev_device *mdev); > + void (*set_status)(struct mdev_device *mdev, u8 status); > + void (*get_config)(struct mdev_device *mdev, unsigned int offset, > + void *buf, unsigned int len); > + void (*set_config)(struct mdev_device *mdev, unsigned int offset, > + const void *buf, unsigned int len); > + u64 (*get_mdev_features)(struct mdev_device *mdev); Do we need a .set_mdev_features method as well? It's not very clear what does mdev_features mean. Does it mean the vhost backend features? https://github.com/torvalds/linux/blob/0e2adab6cf285c41e825b6c74a3aa61324d1132c/include/uapi/linux/vhost.h#L93-L94 > + u32 (*get_generation)(struct mdev_device *mdev); > +}; > + > +void mdev_set_virtio_ops(struct mdev_device *mdev, > + const struct virtio_mdev_device_ops *virtio_ops); > + > +#endif > -- > 2.19.1 >