Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S943088AbcJ1Ald (ORCPT ); Thu, 27 Oct 2016 20:41:33 -0400 Received: from smtprelay0163.hostedemail.com ([216.40.44.163]:36093 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S941772AbcJ1Alc (ORCPT ); Thu, 27 Oct 2016 20:41:32 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:960:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1381:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2828:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3870:3871:3872:4250:4321:5007:6737:10004:10400:10848:11026:11232:11473:11658:11783:11914:12043:12048:12296:12438:12740:13069:13311:13357:13439:13894:14659:14721:21080:30012:30029:30046:30054:30064:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: wire35_2a1522d22135f X-Filterd-Recvd-Size: 2839 Message-ID: <1477615287.1961.4.camel@perches.com> Subject: Re: [PATCH v2 5/6] sparc64: Enable sun4v dma ops to use IOMMU v2 APIs From: Joe Perches To: Tushar Dave , davem@davemloft.net, chris.hyser@oracle.com, sowmini.varadhan@oracle.com, vgupta@synopsys.com, jroedel@suse.de, egtvedt@samfundet.no, robin.murphy@arm.com, m.szyprowski@samsung.com, krzk@kernel.org, sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org Date: Thu, 27 Oct 2016 17:41:27 -0700 In-Reply-To: <1477614212-13466-6-git-send-email-tushar.n.dave@oracle.com> References: <1477614212-13466-1-git-send-email-tushar.n.dave@oracle.com> <1477614212-13466-6-git-send-email-tushar.n.dave@oracle.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.22.1-0ubuntu2 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1729 Lines: 50 On Thu, 2016-10-27 at 17:23 -0700, Tushar Dave wrote: > Add Hypervisor IOMMU v2 APIs pci_iotsb_map(), pci_iotsb_demap() and > enable sun4v dma ops to use IOMMU v2 API for all PCIe devices with > 64bit DMA mask. trivia: > diff --git a/arch/sparc/kernel/pci_sun4v.c b/arch/sparc/kernel/pci_sun4v.c [] > @@ -72,34 +72,55 @@ static inline void iommu_batch_start(struct device *dev, unsigned long prot, uns > } > > /* Interrupts must be disabled. */ > -static long iommu_batch_flush(struct iommu_batch *p) > +static long iommu_batch_flush(struct iommu_batch *p, u64 mask) > { > [] > + if (unlikely(num < 0)) { > + pr_err_ratelimited("iommu_batch_flush: IOMMU map of [%08lx:%08llx:%lx:%lx:%lx] failed with status %ld\n", > + devhandle, > + HV_PCI_TSBID(0, entry), > + npages, prot, __pa(pglist), > + num); > + return -1; > + } > + } else { > + index_count = HV_PCI_IOTSB_INDEX_COUNT(npages, entry), > + iotsb_num = pbm->iommu->atu->iotsb->iotsb_num; > + ret = pci_sun4v_iotsb_map(devhandle, > + iotsb_num, > + index_count, > + prot, > + __pa(pglist), > + &num); > + if (unlikely(ret != HV_EOK)) { > + pr_err_ratelimited("iommu_batch_flush: ATU map of [%08lx:%lx:%llx:%lx:%lx] failed with status %ld\n", > + devhandle, iotsb_num, > + index_count, prot, > + __pa(pglist), ret); Here and above, it's nicer to use %s, __func__ instead of embedding the function name in the format in case the code is ever refactored. pr_err_ratelimited("%s: ATU map of [%08lx:%lx:%llx:%lx:%lx] failed with status %ld\n", ???__func__, devhandle, iotsb_num, ???index_count, prot, ???__pa(pglist), ret);