Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1060293pxf; Thu, 8 Apr 2021 21:49:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJygHTeWjjURG1cZyeWMWU2SoViYoKQetTN4UxbZlj2+mTnllNux1J4221zCg5rawjLcPvhB X-Received: by 2002:a17:90a:1d4b:: with SMTP id u11mr11751232pju.74.1617943743842; Thu, 08 Apr 2021 21:49:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617943743; cv=none; d=google.com; s=arc-20160816; b=X1m/r1R0c42HpDNBqVasR35MptzZwADy0NdZP0M47O/F9er/aJd9wmYBSIhrHgT65i gc1GzKwlz3d4dJDDQvpgT7mLfJ9Vi3heyt1hcNybw+jUN0tL0HybozzwRyxGRrEW9VjH Pmz2l9vvSlxk4wrujHD6RqJxuFYVzCTzkB+2YGrMnOFWA/LnjwcEN2KEUeOFwzIiwXdo Ti4WPy7tF22CGXyOWz+eE46b1mhv1VLWXnSzOjV6Iy4BTIqQqDZ/LJVIBUwZa4rs1OoX 1giiFUMf5jdEmEAtiKxCVtA1kcHgyFNbNYTMcJpLTpxQPwlTQlD/OCzXUkksfTQPn0Bx Y0OA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject:dkim-signature; bh=Lr7bSaeCS5k9NdjAFj7VzPTVSXRHhHksxSYeZxBEhok=; b=TsdRhQbpWDcn3yRg+dyZrUd084VweSJ7l+buRzcUkdp8cfuG8POUmcdRgxb8ZLeSla YJ9cCeaGBLpVRRAeyFXBltHX7SUiVQqcAQPmT5KA9DMU0sNrSfdVbG22bqwNrdJRe8jr N685aytVmyFNslwIOlyWE8ndDRUZ9xlrAw8EcADqvY2Jm34M3prXd2a9Op42C94oH0EY LSwgjOpzEohKcOPBZIhcT8qHoLQjCCOZ6Ex9Spe1yt0DiDFsCuYtrQ+04NKtkUltD21I fK/zFjzEV/j1JmsWp6gCIDbSDnEhHJ328I0Lz7hw/oVCBEcN9RrWzeMuZNfdUkuEFHFj ASxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GLWA7zyr; 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 g5si1725621pgc.99.2021.04.08.21.48.51; Thu, 08 Apr 2021 21:49:03 -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=GLWA7zyr; 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 S229840AbhDIEs3 (ORCPT + 99 others); Fri, 9 Apr 2021 00:48:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:55627 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229715AbhDIEs1 (ORCPT ); Fri, 9 Apr 2021 00:48:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617943685; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Lr7bSaeCS5k9NdjAFj7VzPTVSXRHhHksxSYeZxBEhok=; b=GLWA7zyrkbxzgFMl6zSi7kjtq1UNxWec9jit8gvigcoc44KlPJXkpw31obpufBpx9a/jTZ oE0NZJJTGFg8Dm6sae52ZYFyLC8+6OUi7J4eim2dWfRCKjhY0ne1kf3EWFWc8QQin/PmHY CS0WZ96/RH44OCmivsn651w2bSipFYc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-281-nyENpqnlOoK5mGYgUCFRFA-1; Fri, 09 Apr 2021 00:48:03 -0400 X-MC-Unique: nyENpqnlOoK5mGYgUCFRFA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5554D51A4; Fri, 9 Apr 2021 04:48:02 +0000 (UTC) Received: from wangxiaodeMacBook-Air.local (ovpn-13-155.pek2.redhat.com [10.72.13.155]) by smtp.corp.redhat.com (Postfix) with ESMTP id 45ABC5D9DC; Fri, 9 Apr 2021 04:47:57 +0000 (UTC) Subject: Re: [RFC PATCH] vdpa: mandate 1.0 device To: "Michael S. Tsirkin" Cc: virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, parav@nvidia.com, elic@nvidia.com References: <20210408082648.20145-1-jasowang@redhat.com> <20210408115834-mutt-send-email-mst@kernel.org> From: Jason Wang Message-ID: Date: Fri, 9 Apr 2021 12:47:55 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: <20210408115834-mutt-send-email-mst@kernel.org> Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ?? 2021/4/8 ????11:59, Michael S. Tsirkin ะด??: > On Thu, Apr 08, 2021 at 04:26:48PM +0800, Jason Wang wrote: >> This patch mandates 1.0 for vDPA devices. The goal is to have the >> semantic of normative statement in the virtio spec and eliminate the >> burden of transitional device for both vDPA bus and vDPA parent. >> >> uAPI seems fine since all the vDPA parent mandates >> VIRTIO_F_ACCESS_PLATFORM which implies 1.0 devices. >> >> For legacy guests, it can still work since Qemu will mediate when >> necessary (e.g doing the endian conversion). >> >> Signed-off-by: Jason Wang > Hmm. If we do this, don't we still have a problem with > legacy drivers which don't ack 1.0? Yes, but it's not something that is introduced in this commit. The legacy driver never work ... > Note 1.0 affects ring endianness which is not mediated in QEMU > so QEMU can't pretend to device guest is 1.0. Right, I plan to send patches to do mediation in the Qemu to unbreak legacy drivers. Thanks > > > > > >> --- >> include/linux/vdpa.h | 6 ++++++ >> 1 file changed, 6 insertions(+) >> >> diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h >> index 0fefeb976877..cfde4ec999b4 100644 >> --- a/include/linux/vdpa.h >> +++ b/include/linux/vdpa.h >> @@ -6,6 +6,7 @@ >> #include >> #include >> #include >> +#include >> >> /** >> * vDPA callback definition. >> @@ -317,6 +318,11 @@ static inline int vdpa_set_features(struct vdpa_device *vdev, u64 features) >> { >> const struct vdpa_config_ops *ops = vdev->config; >> >> + /* Mandating 1.0 to have semantics of normative statements in >> + * the spec. */ >> + if (!(features & BIT_ULL(VIRTIO_F_VERSION_1))) >> + return -EINVAL; >> + >> vdev->features_valid = true; >> return ops->set_features(vdev, features); >> } >> -- >> 2.25.1