Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp189712ybv; Tue, 4 Feb 2020 19:16:44 -0800 (PST) X-Google-Smtp-Source: APXvYqyXoSC1i0h3CjKvbeKTYCRKZtZT+tfpmZ7Tv0ZAeq1hhGmLz6zFw7i/YEywkEtD5rS/lXWG X-Received: by 2002:a9d:6290:: with SMTP id x16mr23719909otk.343.1580872603941; Tue, 04 Feb 2020 19:16:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580872603; cv=none; d=google.com; s=arc-20160816; b=GqXMc67a2v2sJCc0jk67JSfh7WFbhh+6j5k61F3nw3E6Zo5y4J7/fxkD0RwQU9IGFx /zspkX1Jzxpv/mazNWoO7nIzZQeOfxgQifWzvj6gSmgPyrR0EHVnpneXocwS5L8UfUJk EaxxZd2/9GXuYMazr/vqmDp6WY9myiS4EFHvpgFCUvcVE04znNPOk6gPlcO1b8NuG9v3 BI9xXvTClTUmtegVXYeXgsIDyOLF49tCUUak/C8ucS4xqRld/fszik9hn6DcTMb/EPnG icxsrQ8tELcTDouafFt7jq/+2OGcy4mdIdZdzhBZTzwXB8FhshsJPFwV1QlA2ns3tLeU fG7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=fkacgs1jrvXkTMH7lk8Z4tp9p1PLEK8Yl3rboqahklw=; b=bs4VxN/pc0fmlfv1c6iFTPOMKZFrFAlyuC8bthU+v7Np1RQAG1uz8vHCEV/5e12OcV FkuFTCdADicMEIWfWAYQzzPRQP4UbgedNBf5FwWvg81N3pgV+rbu4QhntC8Nhv4caP4g pBFju1L/uiMolgFFIArkLPMqUwsogqrc3TI6TB3f6mBsQFqB+UFh0z3oxJVmEXuuhYQx UmwqdeaQ/IenV/Os18crBFj84000sUP/DEI2sGSpkdhWWCU3grqGcRxedjpjxmumvtVJ ujqKzAn5AQTOPJJCjOiJtPsd77FquxErwqSPnHKSzxSHAlKXbUeabvkNgED03mNdF72l 2k+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=G22icPb5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id q6si12884852oth.26.2020.02.04.19.16.31; Tue, 04 Feb 2020 19:16:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=G22icPb5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1727714AbgBEDOb (ORCPT + 99 others); Tue, 4 Feb 2020 22:14:31 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:32772 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727820AbgBEDOa (ORCPT ); Tue, 4 Feb 2020 22:14:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580872469; 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=fkacgs1jrvXkTMH7lk8Z4tp9p1PLEK8Yl3rboqahklw=; b=G22icPb5DWFZSEeaM9QNbdRgczVdka1QvP7DzBryyar9KOTTt9naxnAxxkXhz28EJ7RS4Y onq4eq+zwpCD5s1Eh2LWpRHa/bcAPMR3cc/Htpsjrl26Ocw2APSugrrSZYsw8muDERh4cl zsb7lOeHJED3fNpClUrIsKWf4pN0J40= 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-34-hLQ79f0CMWWDZK02RejDGw-1; Tue, 04 Feb 2020 22:14:27 -0500 X-MC-Unique: hLQ79f0CMWWDZK02RejDGw-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 DDABA1137841; Wed, 5 Feb 2020 03:14:24 +0000 (UTC) Received: from [10.72.13.188] (ovpn-13-188.pek2.redhat.com [10.72.13.188]) by smtp.corp.redhat.com (Postfix) with ESMTP id E38BF5D9E2; Wed, 5 Feb 2020 03:14:05 +0000 (UTC) Subject: Re: [PATCH 5/5] vdpasim: vDPA device simulator To: Jason Gunthorpe Cc: Zhu Lingshan , mst@redhat.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, tiwei.bie@intel.com, maxime.coquelin@redhat.com, cunming.liang@intel.com, zhihong.wang@intel.com, rob.miller@broadcom.com, xiao.w.wang@intel.com, haotian.wang@sifive.com, lingshan.zhu@intel.com, eperezma@redhat.com, lulu@redhat.com, parav@mellanox.com, kevin.tian@intel.com, stefanha@redhat.com, rdunlap@infradead.org, hch@infradead.org, aadam@redhat.com, jakub.kicinski@netronome.com, jiri@mellanox.com, shahafs@mellanox.com, hanand@xilinx.com, mhabets@solarflare.com References: <20200116124231.20253-1-jasowang@redhat.com> <20200116124231.20253-6-jasowang@redhat.com> <1b86d188-0666-f6ab-e3b3-bec1cfbd0c76@linux.intel.com> <20200204125204.GS23346@mellanox.com> From: Jason Wang Message-ID: <920de1cf-a4ee-2d02-a30b-741bfed18ffb@redhat.com> Date: Wed, 5 Feb 2020 11:14:04 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20200204125204.GS23346@mellanox.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/2/4 =E4=B8=8B=E5=8D=888:52, Jason Gunthorpe wrote: > On Tue, Feb 04, 2020 at 04:28:27PM +0800, Jason Wang wrote: >> On 2020/2/4 =E4=B8=8B=E5=8D=884:21, Zhu Lingshan wrote: >>>> +static const struct dma_map_ops vdpasim_dma_ops =3D { >>>> +=C2=A0=C2=A0=C2=A0 .map_page =3D vdpasim_map_page, >>>> +=C2=A0=C2=A0=C2=A0 .unmap_page =3D vdpasim_unmap_page, >>>> +=C2=A0=C2=A0=C2=A0 .alloc =3D vdpasim_alloc_coherent, >>>> +=C2=A0=C2=A0=C2=A0 .free =3D vdpasim_free_coherent, >>>> +}; >>>> + >>> Hey Jason, >>> >>> IMHO, it would be nice if dma_ops of the parent device could be re-us= ed. >>> vdpa_device is expecting to represent a physical device except this >>> simulator, however, there are not enough information in vdpa_device.d= ev >>> to indicating which kind physical device it attached to. Namely >>> get_arch_dma_ops(struct bus type) can not work on vdpa_device.dev. Th= en >>> it seems device drivers need to implement a wrap of dma_ops of parent >>> devices. Can this work be done in the vdpa framework since it looks l= ike >>> a common task? Can "vd_dev->vdev.dev.parent =3D vdpa->dev->parent;" i= n >>> virtio_vdpa_probe() do the work? >>> >>> Thanks, >>> BR >>> Zhu Lingshan >> >> Good catch. >> >> I think we can. > IMHO you need to specify some 'dma_device', not try and play tricks > with dma_ops, or assuming the parent is always the device used for > dma. > > Jason Right, this is what in my mind and discussed in the vhost-vdpa thread. Will go this way. Thanks