Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp6228583ybe; Tue, 17 Sep 2019 23:22:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqwKmmgYd6sdZkXy+PaGLEw6YOeICdKCagsXHymB7+T8F9UfT0LyQSuVjXeOt9hcnT5rBcg6 X-Received: by 2002:a50:91d0:: with SMTP id h16mr8908141eda.152.1568787778469; Tue, 17 Sep 2019 23:22:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568787778; cv=none; d=google.com; s=arc-20160816; b=HlnqiPcZ92XsGDazzPxRIGdn8DgcY1QdcIeYt5MeL7M6BcWF/rbwsagAqENXdAc+Lw ZZWHdccCE+nB+VzUTat1pgqudKkckGav74WqBGIyM66tEbSjnnknHvVyn/UNzWJwAvpu eJJXW236iFuJ3p6UN7+YkvbfipDskaV4i59VDsyrttYU/neEpiq8NxlxFgrLeOK5tgli 6JHW+Yxh8itLDPEnrDGqY9LpTnplTpPh2WQPLZ+w0lLN+pVaKcTTJ+mUq9F/iweN1NKk kuMDOn7noHtlm/gO0Pz0LHe/Fsr3CQSiwf0TVqAmk/a1+dNYs4eiLgfrZbeEK/RrE1Gn uHKQ== 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; bh=d3pSlmWDvQ+kDj56fHKss8LdbBurRLB2S6gb/85KiiI=; b=OgpDrmP1p3IZEWqlOpmiDby8lhungyQzbyMnGCxLJv3XFakHqYjsLbd/PsZGVheCeA YkRdz5itFsu4fHgyT27rAmWNDQhlL1nI2bDkqCbihYdA/b8riSMe0zWdhtoUVA0/mlJp 3vmorNnobDkFi8/XLKG7gUh5iSdS2hWXmPwl7TVxEm5mCp0wBRTrvjhGe7PKye+eLlb2 16d1CP47d4PoAZKGkL4nFC55wip/gyhymjvn7q1GMuOE02hEvPz4KlPwEj/1mnX7ZplP Gbni7dluU4QDIUMQrTg6vE8j7KbN/s9MBYPuEl6B/FMPE3WmJRp8ubk1zNc4Pe5gq0qI YdOw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (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 op27si2313191ejb.253.2019.09.17.23.22.35; Tue, 17 Sep 2019 23:22:58 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727123AbfIRF65 (ORCPT + 99 others); Wed, 18 Sep 2019 01:58:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35540 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725834AbfIRF65 (ORCPT ); Wed, 18 Sep 2019 01:58:57 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 98E773083363; Wed, 18 Sep 2019 05:58:56 +0000 (UTC) Received: from [10.72.12.111] (ovpn-12-111.pek2.redhat.com [10.72.12.111]) by smtp.corp.redhat.com (Postfix) with ESMTP id 72118600C8; Wed, 18 Sep 2019 05:58:44 +0000 (UTC) Subject: Re: [RFC PATCH 2/4] mdev: introduce helper to set per device dma ops To: Alex Williamson Cc: mst@redhat.com, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kwankhede@nvidia.com, cohuck@redhat.com, tiwei.bie@intel.com, maxime.coquelin@redhat.com, cunming.liang@intel.com, zhihong.wang@intel.com, rob.miller@broadcom.com, idos@mellanox.com, xiao.w.wang@intel.com, haotian.wang@sifive.com References: <20190910081935.30516-1-jasowang@redhat.com> <20190910081935.30516-3-jasowang@redhat.com> <20190917130044.4fb97637@x1.home> From: Jason Wang Message-ID: Date: Wed, 18 Sep 2019 13:58:42 +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: <20190917130044.4fb97637@x1.home> 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Wed, 18 Sep 2019 05:58:56 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/9/18 上午3:00, Alex Williamson wrote: > On Tue, 10 Sep 2019 16:19:33 +0800 > Jason Wang wrote: > >> This patch introduces mdev_set_dma_ops() which allows parent to set >> per device DMA ops. This help for the kernel driver to setup a correct >> DMA mappings. >> >> Signed-off-by: Jason Wang >> --- >> drivers/vfio/mdev/mdev_core.c | 7 +++++++ >> include/linux/mdev.h | 2 ++ >> 2 files changed, 9 insertions(+) >> >> diff --git a/drivers/vfio/mdev/mdev_core.c b/drivers/vfio/mdev/mdev_core.c >> index b558d4cfd082..eb28552082d7 100644 >> --- a/drivers/vfio/mdev/mdev_core.c >> +++ b/drivers/vfio/mdev/mdev_core.c >> @@ -13,6 +13,7 @@ >> #include >> #include >> #include >> +#include >> >> #include "mdev_private.h" >> >> @@ -27,6 +28,12 @@ static struct class_compat *mdev_bus_compat_class; >> static LIST_HEAD(mdev_list); >> static DEFINE_MUTEX(mdev_list_lock); >> >> +void mdev_set_dma_ops(struct mdev_device *mdev, struct dma_map_ops *ops) >> +{ >> + set_dma_ops(&mdev->dev, ops); >> +} >> +EXPORT_SYMBOL(mdev_set_dma_ops); >> + > Why does mdev need to be involved here? Your sample driver in 4/4 calls > this from its create callback, where it could just as easily call: > > set_dma_ops(mdev_dev(mdev), ops); > > Thanks, > Alex Yes, let me withdraw this patch. Thanks