Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4813033imm; Tue, 31 Jul 2018 00:02:02 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdne1SF4tinhHolxW5XZwI+Q6EUPXcdLZafTp/1D52y0Z+ywx9iKE1TAosS9RAKoO9JqwnQ X-Received: by 2002:a17:902:28a6:: with SMTP id f35-v6mr8274558plb.240.1533020522023; Tue, 31 Jul 2018 00:02:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533020522; cv=none; d=google.com; s=arc-20160816; b=YMTqmmGmP3iW/4JONtvo3pTryC5BYANVF2JpbPAhO+j2Se460cd/SjAH0f7PyGBeOq KyjxN1raz0bnmD3RtWjKes99SyxXTO4UO+L4F0qZuQ8WwAMF6rFzCnr8qX8HY5SerPE4 UaC5kUw2HpRArbBcnwpWmvSN3WM0Odc9DCUohu/yArcvSBnm0NXzU5RxPPZ5k56gDAjE Gqbp1nsD+yhkijYuy4WNWo4bn4kBFD3AnW+PbH3zV9CgYH3FVm5afUfNjY5mM+0s9+7c CS8QROTQR4wUJ91JbO01kge818eRobiTXNjCShTHkhg75l0WjWWU1l52GJ7VSk+RRJ7w jLgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:from:cc:references:to :subject:arc-authentication-results; bh=Lg+C+JPKInruGX+qWP6jgPyvlaGnk6jmjHHfQUaJMgA=; b=KEyB5dqaDTxpx7NQUJguIOLpLja4ggCw+oRcFhgzgTGL2OeBCH+c6ef/mEVTmswfyd fwW+ijTTKYs2FZ0vLUZPsGcY7hbVsG4vuPP3ZEAvgkSjDsNWavoK5N7v0lDSOGpBjwdt 5hAHf244LHDOhtnDDP98FjcNxnBnQY/RRITEVrdJ1iZlaqXmV4Z8kxAr0nuZbZNj0a25 m3x3wwwgUTokl00MSR87qM2e/sLXX5kPZpu3bXLFcfz0NdzYGtTRyoFYZkApl223BtzM ikQtpv+4EAUkMoQ2Ihko1YSIZPS2mg3lHP5sYOm9MJ0GnWSBvbpRZ2Ksk+kDVn/1B4jA yOKw== 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=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m13-v6si5129568pgk.251.2018.07.31.00.01.47; Tue, 31 Jul 2018 00:02:02 -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=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729099AbeGaIj2 (ORCPT + 99 others); Tue, 31 Jul 2018 04:39:28 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:46626 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726591AbeGaIj2 (ORCPT ); Tue, 31 Jul 2018 04:39:28 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w6V6xJIk134392 for ; Tue, 31 Jul 2018 03:00:37 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0b-001b2d01.pphosted.com with ESMTP id 2kjg2pe52g-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 31 Jul 2018 03:00:37 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 31 Jul 2018 08:00:35 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 31 Jul 2018 08:00:32 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w6V70VeW10027010 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 31 Jul 2018 07:00:31 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C8AB611C05B; Tue, 31 Jul 2018 10:00:42 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 05DFC11C066; Tue, 31 Jul 2018 10:00:32 +0100 (BST) Received: from [9.202.14.95] (unknown [9.202.14.95]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 31 Jul 2018 10:00:31 +0100 (BST) Subject: Re: [RFC 2/4] virtio: Override device's DMA OPS with virtio_direct_dma_ops selectively To: Christoph Hellwig References: <20180720035941.6844-1-khandual@linux.vnet.ibm.com> <20180720035941.6844-3-khandual@linux.vnet.ibm.com> <20180730092551.GB26245@infradead.org> Cc: robh@kernel.org, srikar@linux.vnet.ibm.com, mst@redhat.com, aik@ozlabs.ru, jasowang@redhat.com, linuxram@us.ibm.com, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, paulus@samba.org, joe@perches.com, linuxppc-dev@lists.ozlabs.org, elfring@users.sourceforge.net, haren@linux.vnet.ibm.com, david@gibson.dropbear.id.au From: Anshuman Khandual Date: Tue, 31 Jul 2018 12:30:19 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20180730092551.GB26245@infradead.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 18073107-4275-0000-0000-000002A11C00 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18073107-4276-0000-0000-000037A92B60 Message-Id: <1e197586-4e11-48e1-a0dd-c2c440c64f9e@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-07-31_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=840 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807310076 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/30/2018 02:55 PM, Christoph Hellwig wrote: >> +const struct dma_map_ops virtio_direct_dma_ops; > > This belongs into a header if it is non-static. If you only > use it in this file anyway please mark it static and avoid a forward > declaration. Sure, will make it static, move the definition up in the file to avoid forward declaration. > >> + >> int virtio_finalize_features(struct virtio_device *dev) >> { >> int ret = dev->config->finalize_features(dev); >> @@ -174,6 +176,9 @@ int virtio_finalize_features(struct virtio_device *dev) >> if (ret) >> return ret; >> >> + if (virtio_has_iommu_quirk(dev)) >> + set_dma_ops(dev->dev.parent, &virtio_direct_dma_ops); > > This needs a big fat comment explaining what is going on here. Sure, will do. Also talk about the XEN domain exception as well once that goes into this conditional statement. > > Also not new, but I find the existance of virtio_has_iommu_quirk and its > name horribly confusing. It might be better to open code it here once > only a single caller is left. Sure will do. There is one definition in the tools directory which can be removed and then this will be the only one left.