Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp817572pxk; Mon, 31 Aug 2020 01:40:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz794BR+BHzfNAVcwlY+oa1vE7J5IM0q/kmPjfbW+u1SBdeEbfMVYAEhP3jB9xRmGx04VlZ X-Received: by 2002:aa7:de8f:: with SMTP id j15mr186814edv.135.1598863235430; Mon, 31 Aug 2020 01:40:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598863235; cv=none; d=google.com; s=arc-20160816; b=FW88cP4I2xTUyqYXbefvmSOu2ZGlwRY82S7AmzvKgLMDaSPOCh1LHkQUJZ+YPja43P bWJEcSmdI9H/yvOQ/D/GO5//iuMBxOp5jZ61et/c2rzWU46VHYROxxvjAADmZHzYWMFo yJLRS5CuhyG9xcENL8i6NLctqykrfs44IKf2UXWQJYkYA4jVeyfXTcTvd4Y3BdK8tVt6 nWzCaoTb6Laa7TwAf6JZH3+m8SJPQ2mJU1Jwms7NJ3BHlnKnN0Fh8/d3nu7sT8OzA5p4 rfjlu4b9tbTx20f5Hf0+I7q8gXJohI/XN+Pwq3SGpmh47zLhlLss7cmkITwekHGeFHZD DivQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=avRjm611h0EKFc/MNTXSAgeSYlfF4ysYrjX8e+z/BRg=; b=xo+8eejPlqYY+eCkYQCZetERroYwoFmhNs0OrAEnJD3aPUQ4XL48ZPHrJK7PbtLwnK YjTyuwl3qaWk0LHN3z5KRtKcmHxAdxexTRRKHgwVjMfHD2gTNua+7/CZ+XiTIFmCGOSu KTMJEQLXYFcmMoLCXX9ocKlhs4xBS16Bek2N8lrs4lV8aktpjJ3u3/93i6yDuFoisMSC Lc3tPgDd9rohJcej0/1CF+qeQXgeQ0SpBQstI831B68fJAU6iby/oFzxJcoZJsUYHZnJ TIvSotlLZJnEeyn99dB/1iuh5fLxYHrddsqP1iwQuvrKZxBe6TrW2bE93bQ/JOLjM/2v SvVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="dYldlu5/"; 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 bh4si5196646ejb.629.2020.08.31.01.40.12; Mon, 31 Aug 2020 01:40:35 -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="dYldlu5/"; 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 S1728240AbgHaIjO (ORCPT + 99 others); Mon, 31 Aug 2020 04:39:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:47425 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725978AbgHaIjN (ORCPT ); Mon, 31 Aug 2020 04:39:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598863151; 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=avRjm611h0EKFc/MNTXSAgeSYlfF4ysYrjX8e+z/BRg=; b=dYldlu5/WQ0Sj/ow+Kw1NKjvd8FOFtTqnjlWB0DY0HJT9CCbht4vIZeeeqc0xA6OogM86d K0K1m+KKcpBhjLBCnmqeckx3HXRe74rfRL+hbUJvkRtsTbjRsi6mmNzyy0tJMMlRG7w3SN x+bVO/oYd+3iajhyELVKFJJZk6+9NYM= 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-471-N0n83FllNkSj5RFaVoTyEA-1; Mon, 31 Aug 2020 04:39:09 -0400 X-MC-Unique: N0n83FllNkSj5RFaVoTyEA-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 B8104802B6C; Mon, 31 Aug 2020 08:39:07 +0000 (UTC) Received: from [10.72.12.88] (ovpn-12-88.pek2.redhat.com [10.72.12.88]) by smtp.corp.redhat.com (Postfix) with ESMTP id 13B795C22B; Mon, 31 Aug 2020 08:38:43 +0000 (UTC) Subject: Re: [PATCH V2 2/3] vhost: vdpa: report iova range To: Eli Cohen Cc: mst@redhat.com, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, rob.miller@broadcom.com, lingshan.zhu@intel.com, eperezma@redhat.com, lulu@redhat.com, shahafs@mellanox.com, hanand@xilinx.com, mhabets@solarflare.com, gdawar@xilinx.com, saugatm@xilinx.com, vmireyno@marvell.com, zhangweining@ruijie.com.cn, eli@mellanox.com References: <20200821092813.8952-1-jasowang@redhat.com> <20200821092813.8952-3-jasowang@redhat.com> <20200823064035.GB147797@mtl-vdi-166.wap.labs.mlnx> From: Jason Wang Message-ID: <96f2367e-8b9f-9ee7-a45e-56e9162e92c6@redhat.com> Date: Mon, 31 Aug 2020 16:38:40 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200823064035.GB147797@mtl-vdi-166.wap.labs.mlnx> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/8/23 下午2:40, Eli Cohen wrote: >> +static void vhost_vdpa_set_iova_range(struct vhost_vdpa *v) >> +{ >> + struct vdpa_iova_range *range = &v->range; >> + struct iommu_domain_geometry geo; >> + struct vdpa_device *vdpa = v->vdpa; >> + const struct vdpa_config_ops *ops = vdpa->config; >> + >> + if (ops->get_iova_range) { >> + *range = ops->get_iova_range(vdpa); >> + } else if (v->domain && >> + !iommu_domain_get_attr(v->domain, >> + DOMAIN_ATTR_GEOMETRY, &geo) && >> + geo.force_aperture) { >> + range->first = geo.aperture_start; >> + range->last = geo.aperture_end; >> + } else { >> + range->first = 0; >> + range->last = ULLONG_MAX; >> + } > Shouldn't we require drivers that publish VIRTIO_F_ACCESS_PLATFORM to > implement get_iova_range? Probably not, since ACCESS_PLATFORM does not exclude the device that depends on the chipset IOMMU to work. So in that case, we should query IOMMU driver instead of vDPA device driver. Thanks > >> +}