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=unavailable 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 A4306C433ED for ; Wed, 28 Apr 2021 08:40:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6E9F2613DA for ; Wed, 28 Apr 2021 08:40:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231635AbhD1Ikr (ORCPT ); Wed, 28 Apr 2021 04:40:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:46606 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229643AbhD1Ikp (ORCPT ); Wed, 28 Apr 2021 04:40:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619599200; 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=A4Dnz/Lf18H3ZKwSnBLQNLUl5d7cF3q99QAsHoXknb0=; b=Nfv3QIRNL0x4SNcRR/fBNGdTQuU4/tmuFlJBdU+QKirCzSXse8k/ZrnVq8xGUxnuqS6Uee e29WkbUE90ydDYbRu9JeWlSO8FaKpjcHkVZm/eS1G9cUhoW3VrPovff0RJRCfq4PMe2MyC /ycp6AEQRMCmBvzgrN2iAxTZHQ6jgOY= 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-443-uwjuNaFVNZq6ZBOFYppThQ-1; Wed, 28 Apr 2021 04:39:57 -0400 X-MC-Unique: uwjuNaFVNZq6ZBOFYppThQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 42C241008062; Wed, 28 Apr 2021 08:39:56 +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 64BC560CC6; Wed, 28 Apr 2021 08:39:49 +0000 (UTC) Subject: Re: [PATCH 1/2] vDPA/ifcvf: record virtio notify base 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-2-lingshan.zhu@intel.com> From: Jason Wang Message-ID: <55217869-b456-f3bc-0b5a-6beaf34c19f8@redhat.com> Date: Wed, 28 Apr 2021 16:39:47 +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-2-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.12 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org ÔÚ 2021/4/28 ÏÂÎç4:21, Zhu Lingshan дµÀ: > This commit records virtio notify base addr to implemente > doorbell mapping feature > > Signed-off-by: Zhu Lingshan > --- > drivers/vdpa/ifcvf/ifcvf_base.c | 1 + > drivers/vdpa/ifcvf/ifcvf_base.h | 1 + > 2 files changed, 2 insertions(+) > > diff --git a/drivers/vdpa/ifcvf/ifcvf_base.c b/drivers/vdpa/ifcvf/ifcvf_base.c > index 1a661ab45af5..cc61a5bfc5b1 100644 > --- a/drivers/vdpa/ifcvf/ifcvf_base.c > +++ b/drivers/vdpa/ifcvf/ifcvf_base.c > @@ -133,6 +133,7 @@ int ifcvf_init_hw(struct ifcvf_hw *hw, struct pci_dev *pdev) > &hw->notify_off_multiplier); > hw->notify_bar = cap.bar; > hw->notify_base = get_cap_addr(hw, &cap); > + hw->notify_pa = pci_resource_start(pdev, cap.bar) + cap.offset; To be more generic and avoid future changes, let's use the math defined in the virtio spec. You may refer how it is implemented in virtio_pci vdpa driver[1]. Thanks [1] https://lore.kernel.org/virtualization/20210415073147.19331-5-jasowang@redhat.com/T/ > IFCVF_DBG(pdev, "hw->notify_base = %p\n", > hw->notify_base); > break; > diff --git a/drivers/vdpa/ifcvf/ifcvf_base.h b/drivers/vdpa/ifcvf/ifcvf_base.h > index 0111bfdeb342..bcca7c1669dd 100644 > --- a/drivers/vdpa/ifcvf/ifcvf_base.h > +++ b/drivers/vdpa/ifcvf/ifcvf_base.h > @@ -98,6 +98,7 @@ struct ifcvf_hw { > char config_msix_name[256]; > struct vdpa_callback config_cb; > unsigned int config_irq; > + phys_addr_t notify_pa; > }; > > struct ifcvf_adapter {