Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp6310813imb; Fri, 8 Mar 2019 14:33:22 -0800 (PST) X-Google-Smtp-Source: APXvYqwI23PW2l7FBn+DPYL3Smk4sSWGYWO/tBYN6wNCncgATvV7iG7PAzUcpd8OaP4pmZ3KwPB4 X-Received: by 2002:a62:465d:: with SMTP id t90mr21454997pfa.181.1552084402683; Fri, 08 Mar 2019 14:33:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1552084402; cv=none; d=google.com; s=arc-20160816; b=hF6fg0yvP71r0GHMjQkYLFE4M9tgqw+sNitoYLmrQHCgPXVVsfpejgrxMIRDn05glB eRs3gdqPxnykbdfRV3OfoWKLIyqhsdClXm4F1K/aNRt9iSdOHopQE1XzQaQJwlzDRWlG Tg658axoHu5jX58wTPuJyRrbtvMJ5aCaVwBsFnejo+q60Bs3Jnil907VEs32YvSpzTYo kDhgsVWP4PfgbkUGtHKzwmEs1f+WyU5ij1CbwsBFDv45Z2kh04JThS3YufLV8HdAijHA aihGYEVoriDlsFWf7hW9af/BUQeRrS2+E9hqlKlxBor7+hBEYvvB+C4LdN58rCiJo0Om h63w== 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:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=miC3/CMiFHB7ZXhijezHQHmmj4Y1IhRPCAwLz98pOhU=; b=CxutCvEynM/jwvH7+/vYudnFYTg/x0SePz19MCxNIs56bwLBTaVlBrZ2RKG98jCddZ 00Ekh0wSIVfcsQsHL73R1egK9L1d9HLrxI/lBfRz+lWEzKz7jyOOUTtkY9NIYNxxrftB o+Xbh57hXMC87UBolfTJXy95FwqpkugizA7Pm4r9O3EUyBrGE83yP6w6kLafJGbydT+a zMn0wBmA7It0SPnRu3Y7/oRRoRKATzAO3z7lBpnaT0I7SCRlwooYnZUHGjvPxNs3Avv6 X3DfsiWFzR8jsdOVPd+jHD4i96k3WEMeTkMbEzt4g4eiSzZY/hYc6/kZre4+g7jJer3f CkIQ== 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 a17si7787040pfi.125.2019.03.08.14.33.07; Fri, 08 Mar 2019 14:33:22 -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; 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 S1726512AbfCHWco (ORCPT + 99 others); Fri, 8 Mar 2019 17:32:44 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34046 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726286AbfCHWco (ORCPT ); Fri, 8 Mar 2019 17:32:44 -0500 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 mx1.redhat.com (Postfix) with ESMTPS id 70D0A58E51; Fri, 8 Mar 2019 22:32:44 +0000 (UTC) Received: from x1.home (ovpn-116-24.phx2.redhat.com [10.3.116.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id 67B7160BE7; Fri, 8 Mar 2019 22:32:43 +0000 (UTC) Date: Fri, 8 Mar 2019 15:32:43 -0700 From: Alex Williamson To: Parav Pandit Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, michal.lkml@markovi.net, davem@davemloft.net, gregkh@linuxfoundation.org, jiri@mellanox.com, kwankhede@nvidia.com, vuhuong@mellanox.com, yuvalav@mellanox.com, jakub.kicinski@netronome.com, kvm@vger.kernel.org Subject: Re: [RFC net-next v1 1/3] vfio/mdev: Inherit dma masks of parent device Message-ID: <20190308153243.49a31e1e@x1.home> In-Reply-To: <1552082876-60228-2-git-send-email-parav@mellanox.com> References: <1552082876-60228-1-git-send-email-parav@mellanox.com> <1552082876-60228-2-git-send-email-parav@mellanox.com> Organization: Red Hat MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 08 Mar 2019 22:32:44 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 8 Mar 2019 16:07:54 -0600 Parav Pandit wrote: > Inherit dma mask of parent device in child mdev devices, so that > protocol stack can use right dma mask while doing dma mappings. > > Signed-off-by: Parav Pandit > --- > drivers/vfio/mdev/mdev_core.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/vfio/mdev/mdev_core.c b/drivers/vfio/mdev/mdev_core.c > index 0212f0e..9b8bdc9 100644 > --- a/drivers/vfio/mdev/mdev_core.c > +++ b/drivers/vfio/mdev/mdev_core.c > @@ -315,6 +315,10 @@ int mdev_device_create(struct kobject *kobj, struct device *dev, uuid_le uuid) > mdev->dev.parent = dev; > mdev->dev.bus = &mdev_bus_type; > mdev->dev.release = mdev_device_release; > + mdev->dev.dma_mask = dev->dma_mask; > + mdev->dev.dma_parms = dev->dma_parms; > + mdev->dev.coherent_dma_mask = dev->coherent_dma_mask; > + > dev_set_name(&mdev->dev, "%pUl", uuid.b); > > ret = device_register(&mdev->dev); This seems like a rather large assumption and none of the existing mdev drivers even make use of DMA ops. Why shouldn't this be done in mdev_parent_ops.create? Thanks, Alex