Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D216BC4332F for ; Tue, 20 Dec 2022 00:03:54 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7Q6Q-00055l-13; Mon, 19 Dec 2022 19:03:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7Q6D-0004rC-CU for qemu-devel@nongnu.org; Mon, 19 Dec 2022 19:03:13 -0500 Received: from szxga03-in.huawei.com ([45.249.212.189]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7Q6A-0004w1-Eh for qemu-devel@nongnu.org; Mon, 19 Dec 2022 19:03:13 -0500 Received: from kwepemi100025.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4NbcB51xJqzHqV4; Tue, 20 Dec 2022 07:59:09 +0800 (CST) Received: from [10.174.148.223] (10.174.148.223) by kwepemi100025.china.huawei.com (7.221.188.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Tue, 20 Dec 2022 08:02:52 +0800 Message-ID: <607f5e9e-710f-1436-0fc4-eb32d30e0c3a@huawei.com> Date: Tue, 20 Dec 2022 08:02:51 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH v11 5/5] docs: Add generic vhost-vdpa device documentation To: "Michael S. Tsirkin" , Jason Wang CC: , , , , , , , References: <20221215134944.2809-1-longpeng2@huawei.com> <20221215134944.2809-6-longpeng2@huawei.com> <20221219163711-mutt-send-email-mst@kernel.org> In-Reply-To: <20221219163711-mutt-send-email-mst@kernel.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.148.223] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemi100025.china.huawei.com (7.221.188.158) X-CFilter-Loop: Reflected Received-SPF: pass client-ip=45.249.212.189; envelope-from=longpeng2@huawei.com; helo=szxga03-in.huawei.com X-Spam_score_int: -52 X-Spam_score: -5.3 X-Spam_bar: ----- X-Spam_report: (-5.3 / 5.0 requ) BAYES_00=-1.9, NICE_REPLY_A=-1.149, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: "Longpeng (Mike, Cloud Infrastructure Service Product Dept.)" From: longpeng2--- via Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 在 2022/12/20 5:37, Michael S. Tsirkin 写道: > On Fri, Dec 16, 2022 at 11:33:49AM +0800, Jason Wang wrote: >> On Thu, Dec 15, 2022 at 9:50 PM Longpeng(Mike) wrote: >>> >>> From: Longpeng >>> >>> Signed-off-by: Longpeng >>> --- >>> .../devices/vhost-vdpa-generic-device.rst | 68 +++++++++++++++++++ >>> 1 file changed, 68 insertions(+) >>> create mode 100644 docs/system/devices/vhost-vdpa-generic-device.rst >>> >>> diff --git a/docs/system/devices/vhost-vdpa-generic-device.rst b/docs/system/devices/vhost-vdpa-generic-device.rst >>> new file mode 100644 >>> index 0000000000..24c825ef1a >>> --- /dev/null >>> +++ b/docs/system/devices/vhost-vdpa-generic-device.rst >>> @@ -0,0 +1,68 @@ >>> + >>> +========================= >>> +vhost-vDPA generic device >>> +========================= >>> + >>> +This document explains the usage of the vhost-vDPA generic device. >>> + >>> + >>> +Description >>> +----------- >>> + >>> +vDPA(virtio data path acceleration) device is a device that uses a datapath >>> +which complies with the virtio specifications with vendor specific control >>> +path. >>> + >>> +QEMU provides two types of vhost-vDPA devices to enable the vDPA device, one >>> +is type sensitive which means QEMU needs to know the actual device type >>> +(e.g. net, blk, scsi) and another is called "vhost-vDPA generic device" which >>> +is type insensitive. >>> + >>> +The vhost-vDPA generic device builds on the vhost-vdpa subsystem and virtio >>> +subsystem. It is quite small, but it can support any type of virtio device. >>> + >>> + >>> +Requirements >>> +------------ >>> +Linux 5.18+ >>> +iproute2/vdpa 5.12.0+ >>> + >>> + >>> +Examples >>> +-------- >>> + >>> +1. Prepare the vhost-vDPA backends, here is an example using vdpa_sim_blk >>> + device: >>> + >>> +:: >>> + host# modprobe vhost_vdpa >>> + host# modprobe vdpa_sim_blk >> >> Nit: it's probably better to add driver binding steps here. >> >>> + host# vdpa dev add mgmtdev vdpasim_blk name blk0 >>> + (...you can see the vhost-vDPA device under /dev directory now...) >> >> And then the vhost char dev name could be fetch via >> >> ls /sys/bus/vdpa/device/blk0/vhost-vdpa* >> >> With the above changes. >> >> Acked-by: Jason Wang >> >> Thanks > > > Sounds minor enough, I'll queue, pls fix with a patch on top. > OK, thanks. I'll send when I'm free. >>> + host# ls -l /dev/vhost-vdpa-* >>> + crw------- 1 root root 236, 0 Nov 2 00:49 /dev/vhost-vdpa-0 >>> + >>> +Note: >>> +It needs some vendor-specific steps to provision the vDPA device if you're >>> +using real HW devices, such as loading the vendor-specific vDPA driver and >>> +binding the device to the driver. >>> + >>> + >>> +2. Start the virtual machine: >>> + >>> +Start QEMU with virtio-mmio bus: >>> + >>> +:: >>> + host# qemu-system \ >>> + -M microvm -m 512 -smp 2 -kernel ... -initrd ... \ >>> + -device vhost-vdpa-device,vhostdev=/dev/vhost-vdpa-0 \ >>> + ... >>> + >>> + >>> +Start QEMU with virtio-pci bus: >>> + >>> +:: >>> + host# qemu-system \ >>> + -M pc -m 512 -smp 2 \ >>> + -device vhost-vdpa-device-pci,vhostdev=/dev/vhost-vdpa-0 \ >>> + ... >>> -- >>> 2.23.0 >>> > > .