Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp153095pxb; Wed, 8 Sep 2021 20:22:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvOVqLR4FpjPkOiXYFA4h9iR/a1ucsP/zdinLgr9CR2e57o97zjOxbsth51tU9zV6hKMwH X-Received: by 2002:a6b:b4d3:: with SMTP id d202mr795100iof.8.1631157747639; Wed, 08 Sep 2021 20:22:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631157747; cv=none; d=google.com; s=arc-20160816; b=K9dZaMN8xzNi5645xDQ17LF1+uDBKsShH15pUwzEzki2Q5dIYzoNoazv72T3fYJmoY F8WRhaSjVP/JtZepEtJQ/55+HXJ24Y3kW62pjyvxRAsw00Cpn6wB5p5+CwbDdampRv1w B4lXYlniIriyjG04NDR8FX4Zq0mV4HdplATxU4feIh4893qg8I8kf3+CU8V5Axd9UP5r c5kUWVISVRWdA06i7kivtxJRQSkmSecoFY5wmDdf/+/c5j0vhds2ZpLYaSCtkDxoJoAX cPAC5hQzjSTB1mdVPFLd8RKxJ1BFrA+dBoRAeVNh9Ord0OQI9pLbxuOSIslPrZ3Tu0aN IGOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=yQzc286DxauIBI+q8ayiXXtP3+iTz1b0WX+FNU4A+rg=; b=Z9G7urDhC4en4fSwbCvt5KjL2V4UlpLyorBSIUWcykLxU3dlvIext72GSoFlA5BgHd ONboqVdqlxwL8NlWtYAM/qyxca3/r3HsevJSRGMnmdmp0ObRfY7TWmVBbESbrSOQTktz Bm3OCzYmHus5T/dgzK9bbZ1NZsGSyzTcOggFMfGRFJxCZYz8WTvaXW44Ihb2zngkL2gF QNETu+PmNP+BfJ07oCfriMMGJlTnQbfFMrM/J6AI4oSfKI5P6bHB8D/UGXalw0qY++Nl l5/qqI5eHfRy9P3Zd6otW4jnkCSGUpoWm7lXUz0wd0J35Q9kXj5t3pLhdPoJmhpo4+eA qSrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iKXdJjow; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n14si550700ilm.165.2021.09.08.20.22.13; Wed, 08 Sep 2021 20:22:27 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iKXdJjow; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347815AbhIIDVn (ORCPT + 99 others); Wed, 8 Sep 2021 23:21:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:53402 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231310AbhIIDVm (ORCPT ); Wed, 8 Sep 2021 23:21:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631157632; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=yQzc286DxauIBI+q8ayiXXtP3+iTz1b0WX+FNU4A+rg=; b=iKXdJjowDsKVK4JqiBR9/Jkts5+9Ey2PnwV+G8EEnUJkeOHqQ4T7kCpQMrgedf2arQ5H6Q BZinaHlaZcuTWszke774pg9knKYPWC7LFpjE89g6g8cgPC2uyPpoc6yYcHNna0/XSp6qlR nZtuAOfxuCS/Pgbzlwz69RtII0AxipQ= Received: from mail-lf1-f69.google.com (mail-lf1-f69.google.com [209.85.167.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-169-Sqqeioq4OIKRYQ_JKxrKuQ-1; Wed, 08 Sep 2021 23:20:29 -0400 X-MC-Unique: Sqqeioq4OIKRYQ_JKxrKuQ-1 Received: by mail-lf1-f69.google.com with SMTP id x33-20020a0565121321b02903ac51262781so188859lfu.9 for ; Wed, 08 Sep 2021 20:20:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=yQzc286DxauIBI+q8ayiXXtP3+iTz1b0WX+FNU4A+rg=; b=1rM4Hbs3QsdsBMyLO8gAblSyKDMkcsGdUcxIHo50ZFZFBDwCQHt5UZ9y8c1vOZUEJs QrLI4jj9l9nA2H9L8Gw8H/SdLV+MYrudeCKyn5TKYRiYtj1c9HvWEU1Q+qibIlPVP9cf APrwXz/JfOgVZWrijM0tni8oLGPUDFXH/5OtZYqu8QkJTkI2jKLa+g1YrxsSxCKKPOoa ftvrT6d0BvzTbXv3Sn/NMFlFjAwAyomnI2FnbzEUiIjwGYlGRJZxhXxZzggv49eHjAh8 VpFNk5ylCBu1OoDPeSOI5AZBfyVMtnxqQAUVOXvHLSCcylM5CN9zXJ2kVfRtFlWAQwlS ldbg== X-Gm-Message-State: AOAM531iZXgyl9YVp0WywL0kTW+4mtgFdeI2Vda2REf6uMp6liXsES5H /kjlFwHWSua0G+VKbgaF2lnYL2DUUauUTYr0P5GcEAcVrMutt2Zlu3aRA5HsmkIMUiGv8IYbyOh maxk8RQTnykj+2AULoAkinHs7dHmXRPrPcpE7oKEH X-Received: by 2002:a05:651c:b09:: with SMTP id b9mr483918ljr.307.1631157627814; Wed, 08 Sep 2021 20:20:27 -0700 (PDT) X-Received: by 2002:a05:651c:b09:: with SMTP id b9mr483910ljr.307.1631157627568; Wed, 08 Sep 2021 20:20:27 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Jason Wang Date: Thu, 9 Sep 2021 11:20:16 +0800 Message-ID: Subject: Re: [PATCH 0/6] vDPA driver for legacy virtio-pci device To: Wu Zongyong Cc: virtualization , linux-kernel , mst , wei.yang1@linux.alibaba.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 9, 2021 at 11:05 AM 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 > > 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 I meant "can't" actually. Thanks > 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 > >