From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F09CC433B4 for ; Wed, 28 Apr 2021 08:43:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E778F613DC for ; Wed, 28 Apr 2021 08:43:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237677AbhD1Inu (ORCPT ); Wed, 28 Apr 2021 04:43:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:35784 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237110AbhD1Int (ORCPT ); Wed, 28 Apr 2021 04:43:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619599384; 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=1W52g62U8eu7kNC+tsNnm2qSHOwqXQwpPJN3IreWZiE=; b=cwi67XmjvwxkEk4XMIok8DS5StW6CphISuv2vS3m+0VaXGIXg9H0wEgSjeOPLY3NyGurnB xV58E4rzVSbVELwHghBLP6qUSpa+nTmzRyoSIJDKIpwKnsEL8IXswV3/ni8cJqeoAhYGIN PYPjhETr8Pn6g373Z3kd4fT8oHF7Mpo= 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-408-hAMRtaRlN_isfdaq7ctq8w-1; Wed, 28 Apr 2021 04:43:02 -0400 X-MC-Unique: hAMRtaRlN_isfdaq7ctq8w-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 09BF710054F6; Wed, 28 Apr 2021 08:43:01 +0000 (UTC) Received: from wangxiaodeMacBook-Air.local (ovpn-13-52.pek2.redhat.com [10.72.13.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id 87E205F9C5; Wed, 28 Apr 2021 08:42:55 +0000 (UTC) Subject: Re: [PATCH 2/2] vDPA/ifcvf: implement doorbell mapping for ifcvf To: Zhu Lingshan , mst@redhat.com Cc: virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210428082133.6766-1-lingshan.zhu@intel.com> <20210428082133.6766-3-lingshan.zhu@intel.com> From: Jason Wang Message-ID: Date: Wed, 28 Apr 2021 16:42:53 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <20210428082133.6766-3-lingshan.zhu@intel.com> Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ÔÚ 2021/4/28 ÏÂÎç4:21, Zhu Lingshan дµÀ: > This commit implements doorbell mapping feature for ifcvf. > This feature maps the notify page to userspace, to eliminate > vmexit when kick a vq. > > Signed-off-by: Zhu Lingshan > --- > drivers/vdpa/ifcvf/ifcvf_main.c | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > > diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c > index e48e6b74fe2e..afcb71bc0f51 100644 > --- a/drivers/vdpa/ifcvf/ifcvf_main.c > +++ b/drivers/vdpa/ifcvf/ifcvf_main.c > @@ -413,6 +413,23 @@ static int ifcvf_vdpa_get_vq_irq(struct vdpa_device *vdpa_dev, > return vf->vring[qid].irq; > } > > +static struct vdpa_notification_area ifcvf_get_vq_notification(struct vdpa_device *vdpa_dev, > + u16 idx) > +{ > + struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev); > + struct vdpa_notification_area area; > + > + if (vf->notify_pa % PAGE_SIZE) { > + area.addr = 0; > + area.size = 0; We don't need this since: 1) there's a check in the vhost vDPA 2) device is unaware of the bound driver, non page aligned doorbell doesn't necessarily meant it can be used Let's leave those polices to the driver. Thanks > + } else { > + area.addr = vf->notify_pa; > + area.size = PAGE_SIZE; > + } > + > + return area; > +} > + > /* > * IFCVF currently does't have on-chip IOMMU, so not > * implemented set_map()/dma_map()/dma_unmap() > @@ -440,6 +457,7 @@ static const struct vdpa_config_ops ifc_vdpa_ops = { > .get_config = ifcvf_vdpa_get_config, > .set_config = ifcvf_vdpa_set_config, > .set_config_cb = ifcvf_vdpa_set_config_cb, > + .get_vq_notification = ifcvf_get_vq_notification, > }; > > static int ifcvf_probe(struct pci_dev *pdev, const struct pci_device_id *id) From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1020FC433ED for ; Wed, 28 Apr 2021 08:43:12 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 878A16141F for ; Wed, 28 Apr 2021 08:43:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 878A16141F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=virtualization-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 1F7E940561; Wed, 28 Apr 2021 08:43:09 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ktcsLgi9lGOO; Wed, 28 Apr 2021 08:43:08 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTP id B043440551; Wed, 28 Apr 2021 08:43:07 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 9A27DC001C; Wed, 28 Apr 2021 08:43:07 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 51B1EC0001 for ; Wed, 28 Apr 2021 08:43:06 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 4022A60A52 for ; Wed, 28 Apr 2021 08:43:06 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp3.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jXECuy8YD1QW for ; Wed, 28 Apr 2021 08:43:05 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id 91A99605DA for ; Wed, 28 Apr 2021 08:43:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619599384; 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=1W52g62U8eu7kNC+tsNnm2qSHOwqXQwpPJN3IreWZiE=; b=cwi67XmjvwxkEk4XMIok8DS5StW6CphISuv2vS3m+0VaXGIXg9H0wEgSjeOPLY3NyGurnB xV58E4rzVSbVELwHghBLP6qUSpa+nTmzRyoSIJDKIpwKnsEL8IXswV3/ni8cJqeoAhYGIN PYPjhETr8Pn6g373Z3kd4fT8oHF7Mpo= 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-408-hAMRtaRlN_isfdaq7ctq8w-1; Wed, 28 Apr 2021 04:43:02 -0400 X-MC-Unique: hAMRtaRlN_isfdaq7ctq8w-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 09BF710054F6; Wed, 28 Apr 2021 08:43:01 +0000 (UTC) Received: from wangxiaodeMacBook-Air.local (ovpn-13-52.pek2.redhat.com [10.72.13.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id 87E205F9C5; Wed, 28 Apr 2021 08:42:55 +0000 (UTC) Subject: Re: [PATCH 2/2] vDPA/ifcvf: implement doorbell mapping for ifcvf To: Zhu Lingshan , mst@redhat.com References: <20210428082133.6766-1-lingshan.zhu@intel.com> <20210428082133.6766-3-lingshan.zhu@intel.com> From: Jason Wang Message-ID: Date: Wed, 28 Apr 2021 16:42:53 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <20210428082133.6766-3-lingshan.zhu@intel.com> Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org X-BeenThere: virtualization@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux virtualization List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: base64 Content-Type: text/plain; charset="gbk"; Format="flowed" Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" CtTaIDIwMjEvNC8yOCDPws7nNDoyMSwgWmh1IExpbmdzaGFuINC0tcA6Cj4gVGhpcyBjb21taXQg aW1wbGVtZW50cyBkb29yYmVsbCBtYXBwaW5nIGZlYXR1cmUgZm9yIGlmY3ZmLgo+IFRoaXMgZmVh dHVyZSBtYXBzIHRoZSBub3RpZnkgcGFnZSB0byB1c2Vyc3BhY2UsIHRvIGVsaW1pbmF0ZQo+IHZt ZXhpdCB3aGVuIGtpY2sgYSB2cS4KPgo+IFNpZ25lZC1vZmYtYnk6IFpodSBMaW5nc2hhbiA8bGlu Z3NoYW4uemh1QGludGVsLmNvbT4KP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