Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1511217

Re: [PATCH v2 5/6] sparc64: Enable sun4v dma ops to use IOMMU v2 APIs

From tndave <tushar.n.dave@oracle.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 5/6] sparc64: Enable sun4v dma ops to use IOMMU v2 APIs
Date 2016-10-28 18:20 +0200
Message-ID <sxi2R-2c2-11@gated-at.bofh.it> (permalink)
References <sx3dv-Ji-5@gated-at.bofh.it> <sx3dw-Ji-41@gated-at.bofh.it> <sx3wS-PN-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On 10/27/2016 05:41 PM, Joe Perches wrote:
> 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.
Okay. I will make the change and send v3 soon.

-Tushar
>
> 				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);
>
>

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/6] sparc: Enable sun4v hypervisor PCI IOMMU v2 APIs and ATU Tushar Dave <tushar.n.dave@oracle.com> - 2016-10-28 02:30 +0200
  [PATCH v2 5/6] sparc64: Enable sun4v dma ops to use IOMMU v2 APIs Tushar Dave <tushar.n.dave@oracle.com> - 2016-10-28 02:30 +0200
    Re: [PATCH v2 5/6] sparc64: Enable sun4v dma ops to use IOMMU v2  APIs Joe Perches <joe@perches.com> - 2016-10-28 02:50 +0200
      Re: [PATCH v2 5/6] sparc64: Enable sun4v dma ops to use IOMMU v2 APIs tndave <tushar.n.dave@oracle.com> - 2016-10-28 18:20 +0200

csiph-web