Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4717574ybl; Tue, 4 Feb 2020 00:30:16 -0800 (PST) X-Google-Smtp-Source: APXvYqxM7sXvAdquj3LVQwfHZKrX/WvXF2ScxTacXpI0fE8Yf0lCma8dj3pWScmBK9SdtM9xbe4U X-Received: by 2002:a9d:f45:: with SMTP id 63mr22154658ott.0.1580805015861; Tue, 04 Feb 2020 00:30:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580805015; cv=none; d=google.com; s=arc-20160816; b=n4nSJB0vqUVszblwSFbzXQithBzyl0OYtCqLIS8V0wHbMU1XuA0bmM+CNfRtEYGRkb YW9ooCWFCmG+JkLxGhVcX0THCr5iABIkFGiT8pBK3IoD01GCUC6f98XFUf4pUl3l20aC ZsMlxc/1GjrMZ0a9OjUako6GPK1QLPQK521XNLTw+qa/eqXJaD+ZgjkmPBXMIcq/Lf29 ZUyNdoyqKiNpZTSe4X14psCEEqGyebNn5rUNOLHwGsbSp/9fidaek/1hWGKkLZ2oAUXw zy9YJwa0OQcd/NRMWpjydIYZcGuhW52aiO1XQXnniGrtpdbiSvyH4hxXVIP/Zmo+yG8x WaXA== 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=JipmoOe2nr0hGxD7C+f101bb7FTOHzYyEwpTEYgv7tg=; b=VwkfHDtJgtTIKqYW83wuP3nX2uDGKom9n62ev9E69GMCDJLq79mnBJg9PNov7w8qpT fOgNfL3mkebDpLHL53JZiL3IkwKXptPfyW+cPiEWsNWnRfXLXUlxOrJx+EJgJRS+pod4 IHZVfYCrdtsxGR+uclkaMw1tiPWbeTcDTpBqECUF+U5Fmpc1HhCu23cI8fR2T5WpwF3P x1ef/dk3yaeKgQMRYee9TCuiSIXQz8sohOg4KGXRlsDC2r9QZWRbSGCooI7ElQ0OeMTp 1jPXfQnEsBUhg9BUkLNyvm4ru+nMYYEyJz+JpooZudrUmfuA39QvVByLn9VAjA0gTGwS jIkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fcqkr51i; 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 s7si11292265otd.280.2020.02.04.00.30.01; Tue, 04 Feb 2020 00:30:15 -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=fcqkr51i; 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 S1727197AbgBDI2v (ORCPT + 99 others); Tue, 4 Feb 2020 03:28:51 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:55053 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727124AbgBDI2v (ORCPT ); Tue, 4 Feb 2020 03:28:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580804930; 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=JipmoOe2nr0hGxD7C+f101bb7FTOHzYyEwpTEYgv7tg=; b=fcqkr51i4XIx1miBuekqjS7AzBreBOE17Z77lH4I447ZVrALMhWuJCSZQ5m2dH+dZ8m/zd kqWBHzIjzPUUhw94RinUWbgv0cp8DwLCS9/4widvBxm+g2+DA+IHo4qTdz0KHvhpA4W3Zi pFgG0KTIXgg4dZ6ehlPHl+S9uHcfZQ4= 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-121-Dqa5HkEuOly10_ZneL--TQ-1; Tue, 04 Feb 2020 03:28:48 -0500 X-MC-Unique: Dqa5HkEuOly10_ZneL--TQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BBA80800D54; Tue, 4 Feb 2020 08:28:45 +0000 (UTC) Received: from [10.72.12.170] (ovpn-12-170.pek2.redhat.com [10.72.12.170]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0B4F290F49; Tue, 4 Feb 2020 08:28:28 +0000 (UTC) Subject: Re: [PATCH 5/5] vdpasim: vDPA device simulator To: Zhu Lingshan , mst@redhat.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org Cc: tiwei.bie@intel.com, jgg@mellanox.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> From: Jason Wang Message-ID: Date: Tue, 4 Feb 2020 16:28:27 +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: <1b86d188-0666-f6ab-e3b3-bec1cfbd0c76@linux.intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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=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=20 > re-used. vdpa_device is expecting to represent a physical device=20 > except this simulator, however, there are not enough information in=20 > vdpa_device.dev to indicating which kind physical device it attached=20 > to. Namely get_arch_dma_ops(struct bus type) can not work on=20 > vdpa_device.dev. Then it seems device drivers need to implement a wrap=20 > of dma_ops of parent devices. Can this work be done in the vdpa=20 > framework since it looks like a common task? Can=20 > "vd_dev->vdev.dev.parent =3D vdpa->dev->parent;" in virtio_vdpa_probe()= =20 > do the work? > > Thanks, > BR > Zhu Lingshan=20 Good catch. I think we can. Thanks