Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp170454pxy; Wed, 28 Apr 2021 01:42:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZnmumHR5ZDpI3we5a2FF0NM0ag2kdStRY/hYsadQQuuRqKOYa2gFf/VBEjk7Et9UGLOSs X-Received: by 2002:a17:90a:2e03:: with SMTP id q3mr2818302pjd.206.1619599360523; Wed, 28 Apr 2021 01:42:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619599360; cv=none; d=google.com; s=arc-20160816; b=B886MTnhye46bhQLOfObwaG3KUf39u6lfQSr+n+jAY33zubmhOxS2x7BT2tTQfFz4L G2dAhQbGcI2g6ap+C/71Bgnba7IthvBmB8uVrzCUAGwZ/DFrZNyZp9o9Qj+Re9JkRgM+ XSLn2df3t7OYCDSZ1FbfJIcUIZkpdss9gL8XFEzhXZuapp1mN4oWK3mptOIYN10HI1qM DKkNCbS+9L0DVkghgLTnssbapJaL2t9E0Qybqetz0dI52hOqHnbp8ZDmWLaG0vriCB+7 qznvFnLUuXIhwVAglpkS45E0MdZxnqFBQ6Z+uDXKhiq5Cwa06Xagnlyon+kO6P6VgVkf jDkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=A4Dnz/Lf18H3ZKwSnBLQNLUl5d7cF3q99QAsHoXknb0=; b=GhUJmAKkQafVOCctuRYwSlM2Mlbon4ic4NujM8zgVfvc92Ib6+C7s4wA3limL6uq7+ 7b10AMS8OVOooo47llb+YhF7zn/KXA81UMUKGAOAn0aRnqLhKSSOrdu1RFe83+WNFkAv vJ9HgfhFI5Rkw60lgZMETUb/D5P0n8gAlLcbONpxZ2J5TfZJzwhph52Mas3QhTsryNH9 8kDjdnwSfFZggg41g0mwi8SlV4bn3GCokUDNhSx7xMEbYHTosDyvp37zEj/reeK5OjSj AtSiwiuK0u4OKVoce5r4yEWLTjWDHfYHggW/BCvaOJ2ktDDRgaSh2iXp2mh74I9HSwcX kH9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QY5zqVXb; 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 l6si5961268pff.253.2021.04.28.01.42.27; Wed, 28 Apr 2021 01:42:40 -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=QY5zqVXb; 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 S237348AbhD1Ikr (ORCPT + 99 others); Wed, 28 Apr 2021 04:40:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:39749 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237148AbhD1Ikq (ORCPT ); Wed, 28 Apr 2021 04:40:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619599201; 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=QY5zqVXbgzme8Ac7LV87mg7GfDtgYS8+blFsPAxhrPEHMh/pKmhJJvYNokUaSt7SpZwYKk g4lKmeCt8kHsCEnD3uh16X05jgu1/cTeH56CCeqBwF1Qt2vHkpkooJk2hyqEyJEykjL1tg LbROTtrK7ai14adfDmCfmFF1XkYLkes= 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: linux-kernel@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 {