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


Groups > linux.kernel > #1303508 > unrolled thread

Re: [PATCH 6/6] iommu/amd: Manage iommu_group for non-pci devices

Started byJoerg Roedel <joro@8bytes.org>
First post2016-01-07 13:10 +0100
Last post2016-01-08 02:50 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 6/6] iommu/amd: Manage iommu_group for non-pci devices Joerg Roedel <joro@8bytes.org> - 2016-01-07 13:10 +0100
    Re: [PATCH 6/6] iommu/amd: Manage iommu_group for non-pci devices Wan ZongShun <mcuos.com@gmail.com> - 2016-01-08 02:50 +0100

#1303508 — Re: [PATCH 6/6] iommu/amd: Manage iommu_group for non-pci devices

FromJoerg Roedel <joro@8bytes.org>
Date2016-01-07 13:10 +0100
SubjectRe: [PATCH 6/6] iommu/amd: Manage iommu_group for non-pci devices
Message-ID<qOhy9-7Vb-5@gated-at.bofh.it>
On Tue, Jan 05, 2016 at 05:07:24AM -0500, Wan Zongshun wrote:
> +static struct iommu_group *amd_iommu_device_group(struct device *dev)
> +{
> +	if (dev_is_pci(dev))
> +		return pci_device_group(dev);
> +
> +	return acpihid_device_group(dev);
> +}
> +
>  /*****************************************************************************
>   *
>   * The next functions belong to the dma_ops mapping/unmapping code.
> @@ -3202,7 +3233,7 @@ static const struct iommu_ops amd_iommu_ops = {
>  	.iova_to_phys = amd_iommu_iova_to_phys,
>  	.add_device = amd_iommu_add_device,
>  	.remove_device = amd_iommu_remove_device,
> -	.device_group = pci_device_group,
> +	.device_group = amd_iommu_device_group,

Does this work? Which bus do the ACPIHID devices belong to (what does
dev->bus point to)? If it is not &pci_bus_type, then the iommu core code
will not create an iommu group for the devices.


	Joerg

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1304108

FromWan ZongShun <mcuos.com@gmail.com>
Date2016-01-08 02:50 +0100
Message-ID<qOulI-7ZL-3@gated-at.bofh.it>
In reply to#1303508
2016-01-07 20:06 GMT+08:00 Joerg Roedel <joro@8bytes.org>:
> On Tue, Jan 05, 2016 at 05:07:24AM -0500, Wan Zongshun wrote:
>> +static struct iommu_group *amd_iommu_device_group(struct device *dev)
>> +{
>> +     if (dev_is_pci(dev))
>> +             return pci_device_group(dev);
>> +
>> +     return acpihid_device_group(dev);
>> +}
>> +
>>  /*****************************************************************************
>>   *
>>   * The next functions belong to the dma_ops mapping/unmapping code.
>> @@ -3202,7 +3233,7 @@ static const struct iommu_ops amd_iommu_ops = {
>>       .iova_to_phys = amd_iommu_iova_to_phys,
>>       .add_device = amd_iommu_add_device,
>>       .remove_device = amd_iommu_remove_device,
>> -     .device_group = pci_device_group,
>> +     .device_group = amd_iommu_device_group,
>
> Does this work? Which bus do the ACPIHID devices belong to (what does
> dev->bus point to)? If it is not &pci_bus_type, then the iommu core code
> will not create an iommu group for the devices.

Yes, it works, we have already done validation on AMD platform.
Please refer to my previous patch :
[PATCH] iommu/amd: set AMD iommu-callbacks for the amba bus.

Currently, The UART DMA is the use case of ACPIHID device, the
dev->bus is amba_bus, so I add bus_set_iommu for this bus type.

We will do create iommu group in acpihid_device_group which will call
generic_device_group to alloc group.

>
>
>         Joerg
>
> _______________________________________________
> iommu mailing list
> iommu@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/iommu



-- 
---
Vincent Wan(Zongshun)
www.mcuos.com

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web