Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp509420pxb; Thu, 9 Sep 2021 06:08:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwwUeFvI7EQE0a1moRK62hR42CNd+UaQabtwRGJK66K/eVcOScToMj/u7fiK0AybJjRBAE+ X-Received: by 2002:a05:6e02:ee1:: with SMTP id j1mr2276487ilk.61.1631192899118; Thu, 09 Sep 2021 06:08:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631192899; cv=none; d=google.com; s=arc-20160816; b=lXXVssXgOAe1CguxYppxlTCiK1C5d/quOPgjb8tzCKA1I9FEjzDFIxKVLmro+zXCS3 j16EQx/JCqJL6RZvnfliRxE8NqhWRXK5GkH5XaeRfJFk61eVN7xvIbq2YXa8qX57xfXW y85TBTQ+OD8u3Y1ThWySfSTEYGi6+UW6jB5GXLRvhJ1QzqlO3PFo7R3bmyBdPzQOjAYd DtROPk6pmsYFPjJ+s+Vq68ToE0/KykAzRhEUZ5loMV7xkJ4CP4wqN009Su61oRlLpyHz jgpJXmN1BomYmV+t6zFJMMKpnyGwKJJaTgAmWgPBSYCx62mOa1SWsl9J135/AiffT/Ow 6MBw== 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=B3UIciIcGDpGeWqgXns0+XmItR/0tUKkMgbNpaR7yDM=; b=W1s2tIhg6GTtw7i4j3CXV93VLwR3PrRi1SPX5LtOXZPildhZRFkGa14bKcJBPfsO2g BjNKp6dvHdKo0V+LYuStqBjHsv+JReLEMV3zUb1b2/EVsIR3tsz81Zcz+deCoyuK0zpm Xuhj9Xt4myqGta1RTrJsvJMYjnKPxQ5x47F8wcSvtvOppDPBNWCFoKnVtQfVCEf1X6nQ UgETgV7MILNrYUfUDzcqD/b9aMrSeyMq298QETYQO71fWnUJ7x7hr/8jPOh569DXuuC1 D9DaqHQ6Jp/ewQiZgeMUTok66Lyd9MQDok6CRteaMHal4xuSL7eQhEZBEQQo+JengbSm SCgA== 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 w16si2046863iol.0.2021.09.09.06.08.00; Thu, 09 Sep 2021 06:08:19 -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 S1358550AbhIINHk (ORCPT + 99 others); Thu, 9 Sep 2021 09:07:40 -0400 Received: from out30-44.freemail.mail.aliyun.com ([115.124.30.44]:33245 "EHLO out30-44.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356333AbhIIMys (ORCPT ); Thu, 9 Sep 2021 08:54:48 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=alimailimapcm10staff010182156082;MF=wuzongyong@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0UnoEUsl_1631192017; Received: from localhost(mailfrom:wuzongyong@linux.alibaba.com fp:SMTPD_---0UnoEUsl_1631192017) by smtp.aliyun-inc.com(127.0.0.1); Thu, 09 Sep 2021 20:53:38 +0800 Date: Thu, 9 Sep 2021 20:53:38 +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: <20210909125338.GA17535@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 > - 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 Would you mind I place the ENI vDPA driver inside virtio_pci folder? Or should I create a new folder for it? > > 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 > > > > > 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 > >