Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp310975pxb; Thu, 9 Sep 2021 01:14:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPqHUqsB032ZmD9Jpwetm7dwuZz/mI+ksY1b+Jrlk64qYChMSd+57lW9pjb7/5yq+OgwVP X-Received: by 2002:a50:9e0f:: with SMTP id z15mr1958823ede.40.1631175268296; Thu, 09 Sep 2021 01:14:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631175268; cv=none; d=google.com; s=arc-20160816; b=lhGNK2ajri+QrEkos9pbtb2ROoJc4/5bDvJ2EBXYJF+Qe7CC7sN47ktA1AphB5QdWB OyOAupwAuJu4sby+nIfgUHxypFH5cANR5fp3lN2Nq9Cf1XZ58y5n0EbY5GxSX7D93wsI eRhCdfG8iuLjs/8VSYL1tBoyIcKQ7/ySyFwTzbVYn9Lcj7TbCZeXbIZ2Jc0nQVHKUt1x BXblEW54Z/eR9bhqHK7SC/0cpeaDG8tPY3Gdm7t5WIr0EQHZgykNU+EI9qDIXMso51we Tks0MhzjufQswKmPZKjeq6NyNSd5i1s3VNroaXCw4iIoPP9ucXvadwycpBPaH8Y0H+3H 9xkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:reply-to:message-id:subject:cc:to:from:date; bh=EN81YGY0X9TBcWoBpwdg0IWtwLS2UNf8hot2gIaD/Ik=; b=ir2S2ttMSuEbNp8iHbYNG9aZA39P2FWecGuofXDXgG2gY+J13Kh1SAFgKBuvuuDowO ccDTkh2yfIptZKMbeCEU4iXWkdJeYyLyPMQBSEtWyzXsP1WDcEoJvL4gUhfn66i0Nu2y bh80BEX3rI0ioSKM0R0Zw6Xktd0zfCS0LPaexbLXJn/rFPnYlo5MqCzIg1tTDZpBAsAT VolfrgWrJCktcyiYa+MQAf26yOzf3NUOvyzXcWmAiEOCgvLjMaMBn1wfmjlcNYQLDK12 LfARWwVpucMJy55AsDa2fj49ZhkLQWVEg8TRTodOUR+SljZQb5UlZ+Upsl7VtIOGsynp DkZQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i25si1188226eds.119.2021.09.09.01.14.04; Thu, 09 Sep 2021 01:14:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231161AbhIIINW (ORCPT + 99 others); Thu, 9 Sep 2021 04:13:22 -0400 Received: from out30-130.freemail.mail.aliyun.com ([115.124.30.130]:43850 "EHLO out30-130.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231143AbhIIINV (ORCPT ); Thu, 9 Sep 2021 04:13:21 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R601e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04395;MF=wuzongyong@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0UnmES0O_1631175130; Received: from localhost(mailfrom:wuzongyong@linux.alibaba.com fp:SMTPD_---0UnmES0O_1631175130) by smtp.aliyun-inc.com(127.0.0.1); Thu, 09 Sep 2021 16:12:10 +0800 Date: Thu, 9 Sep 2021 16:12:11 +0800 From: Wu Zongyong To: Jason Wang Cc: virtualization , linux-kernel , mst , wei.yang1@linux.alibaba.com Subject: Re: [PATCH 0/6] vDPA driver for legacy virtio-pci device Message-ID: <20210909081211.GB17383@L-PF27918B-1352.localdomain> Reply-To: Wu Zongyong References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 09, 2021 at 11:05:06AM +0800, Jason Wang wrote: > On Wed, Sep 8, 2021 at 8:22 PM Wu Zongyong wrote: > > > > This series implements the vDPA driver for legacy virtio-pci device. > > Currently we already have the vDPA driver for modern virtio-pci device > > only, but there are some legacy virtio-pci devices conforming to the > > virtio-pci specifications of 0.9.x or older versions. For example, > > ENI(Elastic Network Interface) of Alibaba ECS baremetal instance is a > > hardware virtio network device which follows the Virtio PCI Card 0.9.5 > > Draft specification. Such legacy virtio-pci devices have some > > inconsistent behaviour with modern virtio-pci devices, so some common > > codes are split out and modern device specific codes are moved to a > > separated file. > > What worries me a little bit are: > > 1) vDPA requires IOMMU_PLATFORM to be supported by the device to work, > if I understand ENI correctly, it's a legacy device so it can't > support ACCESS_PLATFORM. Or is it a legacy device that supports > ACCESS_PLATFORM implicitly. > 2) vDPA tries to present a 1.0 device, in this case the behavior could > be ruled by the spec. If we tries to present an 1.0 device on top of > legacy device we may suffer a lot of issues: > > - endian issue: 1.0 use le but legacy may use native endian > - queue_enable semantic which is missed in the legacy Writting the queue_address is regarded as enable queue in the legacy. Right? > - virtqueue size, as you mentioned below > > I guess what the device(ENI) supports are: > > 1) semantic of ACCESS_PLATFORM without a feature > 2) little endian > 3) but a legacy device > > So I think it might be better: > > 1) introduce the library for legacy as you did in this patch > 2) having a dedicated ENI vDPA driver > > 3) live migration support, though it was not supported by the spec > yet, but we are working on the support, and we know legacy device can > support this. > > Thanks > I agree. It's better to implement a dedicated vDPA driver for ENI only. ENI is not a standard legacy virtio-pci device. > > > > For legacy devices, it is not supported to negotiate the virtqueue size > > by the specification. So a new callback get_vq_num_unchangeable is > > introduced to indicate user not to try change the virtqueue size of the > > legacy vdpa device. For example, QEMU should not allocate memory for > > virtqueue according to the properties tx_queue_size and rx_queue_size if > > we use legacy virtio-pci device as the vhost-vdpa backend. Instead, QEMU > > should use the new callback get_vq_num_unchangeable first to check if > > the vdpa device support to change virtqueue size. If not, QEMU should > > call the callback get_vq_num_max to get the static virtqueue size then > > allocate the same size memory for the virtqueue. > > > > This series have been tested with the ENI in Alibaba ECS baremetal > > instance. > > > > These patches may under consideration, welcome for comments. > > > > > > Wu Zongyong (6): > > virtio-pci: introduce legacy device module > > vdpa: fix typo > > vp_vdpa: add vq irq offloading support > > vp_vdpa: split out reusable and device specific codes to separate file > > vdpa: add get_vq_num_unchangeable callback in vdpa_config_ops > > vp_vdpa: introduce legacy virtio pci driver > > > > drivers/vdpa/Kconfig | 7 + > > drivers/vdpa/virtio_pci/Makefile | 3 + > > drivers/vdpa/virtio_pci/vp_vdpa.c | 8 + > > drivers/vdpa/virtio_pci/vp_vdpa_common.c | 220 ++++++++++++++ > > drivers/vdpa/virtio_pci/vp_vdpa_common.h | 67 +++++ > > drivers/vdpa/virtio_pci/vp_vdpa_legacy.c | 346 +++++++++++++++++++++++ > > drivers/vdpa/virtio_pci/vp_vdpa_modern.c | 327 +++++++++++++++++++++ > > drivers/vhost/vdpa.c | 19 ++ > > drivers/virtio/Kconfig | 10 + > > drivers/virtio/Makefile | 1 + > > drivers/virtio/virtio_pci_common.c | 10 +- > > drivers/virtio/virtio_pci_common.h | 9 +- > > drivers/virtio/virtio_pci_legacy.c | 101 ++----- > > drivers/virtio/virtio_pci_legacy_dev.c | 220 ++++++++++++++ > > drivers/virtio/virtio_vdpa.c | 5 +- > > include/linux/vdpa.h | 6 +- > > include/linux/virtio_pci_legacy.h | 44 +++ > > include/uapi/linux/vhost.h | 2 + > > 18 files changed, 1320 insertions(+), 85 deletions(-) > > create mode 100644 drivers/vdpa/virtio_pci/vp_vdpa_common.c > > create mode 100644 drivers/vdpa/virtio_pci/vp_vdpa_common.h > > create mode 100644 drivers/vdpa/virtio_pci/vp_vdpa_legacy.c > > create mode 100644 drivers/vdpa/virtio_pci/vp_vdpa_modern.c > > create mode 100644 drivers/virtio/virtio_pci_legacy_dev.c > > create mode 100644 include/linux/virtio_pci_legacy.h > > > > -- > > 2.31.1 > >