Re: [PATCH 2/3] iommu/arm-smmu: Add initial driver support for ARM SMMUv3 devices

2015-06-02 Thread Joerg Roedel
On Tue, Jun 02, 2015 at 10:47:46AM +0100, Will Deacon wrote: > On Tue, Jun 02, 2015 at 08:39:56AM +0100, Joerg Roedel wrote: > > I don't think we need to postpone anything. Domains returned by > > iommu_domain_alloc() need to work for all groups. If there are multiple > > IOMMUs in the system with

Re: [PATCH 2/3] iommu/arm-smmu: Add initial driver support for ARM SMMUv3 devices

2015-06-02 Thread Will Deacon
On Tue, Jun 02, 2015 at 08:39:56AM +0100, Joerg Roedel wrote: > On Mon, Jun 01, 2015 at 10:40:14AM +0100, Will Deacon wrote: > > I like this proposal. The only remaining part is that the pgsize bitmap > > inherited by the domain can only truly be finalised once the page table > > is allocated, whic

Re: [PATCH 2/3] iommu/arm-smmu: Add initial driver support for ARM SMMUv3 devices

2015-06-02 Thread Joerg Roedel
Hi Will, On Mon, Jun 01, 2015 at 10:40:14AM +0100, Will Deacon wrote: > I like this proposal. The only remaining part is that the pgsize bitmap > inherited by the domain can only truly be finalised once the page table > is allocated, which in turn can only happen once we've identified the > IOMMU

Re: [PATCH 2/3] iommu/arm-smmu: Add initial driver support for ARM SMMUv3 devices

2015-06-01 Thread Will Deacon
Hi Joerg, On Fri, May 29, 2015 at 03:40:43PM +0100, Joerg Roedel wrote: > On Fri, May 29, 2015 at 12:35:56PM +0100, Robin Murphy wrote: > > The trouble with this is, what about the CPU page size? Say you have > > some multimedia subsystem with its own integrated SMMU and for that > > they've only

Re: [PATCH 2/3] iommu/arm-smmu: Add initial driver support for ARM SMMUv3 devices

2015-05-29 Thread Joerg Roedel
On Fri, May 29, 2015 at 12:35:56PM +0100, Robin Murphy wrote: > The trouble with this is, what about the CPU page size? Say you have > some multimedia subsystem with its own integrated SMMU and for that > they've only implemented the 16K granule scheme because it works > best for the video hardware

Re: [PATCH 2/3] iommu/arm-smmu: Add initial driver support for ARM SMMUv3 devices

2015-05-29 Thread Robin Murphy
Hi Joerg, On 29/05/15 07:43, Joerg Roedel wrote: Hi Will, On Wed, May 20, 2015 at 06:09:26PM +0100, Will Deacon wrote: On Tue, May 19, 2015 at 04:24:35PM +0100, Joerg Roedel wrote: + /* Page sizes */ + if (reg & IDR5_GRAN64K) + pgsize_bitmap |= SZ_64K | SZ_512M; +

Re: [PATCH 2/3] iommu/arm-smmu: Add initial driver support for ARM SMMUv3 devices

2015-05-28 Thread Joerg Roedel
Hi Will, On Wed, May 20, 2015 at 06:09:26PM +0100, Will Deacon wrote: > On Tue, May 19, 2015 at 04:24:35PM +0100, Joerg Roedel wrote: > > > + /* Page sizes */ > > > + if (reg & IDR5_GRAN64K) > > > + pgsize_bitmap |= SZ_64K | SZ_512M; > > > + if (reg & IDR5_GRAN16K) > > > + pgsize_b

Re: [PATCH 2/3] iommu/arm-smmu: Add initial driver support for ARM SMMUv3 devices

2015-05-27 Thread leizhen
On 2015/5/27 0:12, Will Deacon wrote: > On Mon, May 25, 2015 at 03:07:17AM +0100, leizhen wrote: >> On 2015/5/21 19:25, Will Deacon wrote: >>> On Wed, May 13, 2015 at 09:33:19AM +0100, leizhen wrote: If SMMU_IDR1.SIDSIZE = 32 really exist(or too big), we need dynamic choose Lv2 table size

Re: [PATCH 2/3] iommu/arm-smmu: Add initial driver support for ARM SMMUv3 devices

2015-05-26 Thread Will Deacon
On Mon, May 25, 2015 at 03:07:17AM +0100, leizhen wrote: > On 2015/5/21 19:25, Will Deacon wrote: > > On Wed, May 13, 2015 at 09:33:19AM +0100, leizhen wrote: > >> If SMMU_IDR1.SIDSIZE = 32 really exist(or too big), we need dynamic choose > >> Lv2 table size(4K,16K,64K). Because Lv1 table maybe to

Re: [PATCH 2/3] iommu/arm-smmu: Add initial driver support for ARM SMMUv3 devices

2015-05-24 Thread leizhen
On 2015/5/21 19:25, Will Deacon wrote: > Hi again, > > Sorry for the delay in replying, I've been tied up with other stuff. > > On Wed, May 13, 2015 at 09:33:19AM +0100, leizhen wrote: >> On 2015/5/13 0:55, Will Deacon wrote: >>> The purpose of the two level approach isn't to save memory; it's to

Re: [PATCH 2/3] iommu/arm-smmu: Add initial driver support for ARM SMMUv3 devices

2015-05-21 Thread Will Deacon
Hi again, Sorry for the delay in replying, I've been tied up with other stuff. On Wed, May 13, 2015 at 09:33:19AM +0100, leizhen wrote: > On 2015/5/13 0:55, Will Deacon wrote: > > The purpose of the two level approach isn't to save memory; it's to remove > > the need for a single (large) contiguo

Re: [PATCH 2/3] iommu/arm-smmu: Add initial driver support for ARM SMMUv3 devices

2015-05-20 Thread Will Deacon
On Tue, May 19, 2015 at 04:24:35PM +0100, Joerg Roedel wrote: > Hi Will, Hi Joerg, > the code looks good overall, I just have some questions below. Great, thanks for having a look. I'll still need to post a v2 to address some of the other comments I've had. > On Fri, May 08, 2015 at 07:00:45PM

Re: [PATCH 2/3] iommu/arm-smmu: Add initial driver support for ARM SMMUv3 devices

2015-05-19 Thread Joerg Roedel
Hi Will, the code looks good overall, I just have some questions below. On Fri, May 08, 2015 at 07:00:45PM +0100, Will Deacon wrote: > +static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device > *dev) > +{ > + int ret = 0; > + struct arm_smmu_device *smmu; > + struct

Re: [PATCH 2/3] iommu/arm-smmu: Add initial driver support for ARM SMMUv3 devices

2015-05-13 Thread leizhen
On 2015/5/13 0:55, Will Deacon wrote: > Hi Leizhen, > > Thanks for the review! > > On Tue, May 12, 2015 at 08:40:06AM +0100, leizhen wrote: >> >>> + >>> +static int queue_poll_cons(struct arm_smmu_queue *q, u32 until, bool wfe) >>> +{ >>> + ktime_t timeout = ktime_add_us(ktime_get(), ARM_SMMU

Re: [PATCH 2/3] iommu/arm-smmu: Add initial driver support for ARM SMMUv3 devices

2015-05-12 Thread Will Deacon
Hi Leizhen, Thanks for the review! On Tue, May 12, 2015 at 08:40:06AM +0100, leizhen wrote: > > > + > > +static int queue_poll_cons(struct arm_smmu_queue *q, u32 until, bool wfe) > > +{ > > + ktime_t timeout = ktime_add_us(ktime_get(), ARM_SMMU_POLL_TIMEOUT_US); > > + > > + while (queue_

Re: [PATCH 2/3] iommu/arm-smmu: Add initial driver support for ARM SMMUv3 devices

2015-05-12 Thread leizhen
> + > +static int queue_poll_cons(struct arm_smmu_queue *q, u32 until, bool wfe) > +{ > + ktime_t timeout = ktime_add_us(ktime_get(), ARM_SMMU_POLL_TIMEOUT_US); > + > + while (queue_sync_cons(q), __queue_cons_before(q, until)) { > + if (ktime_compare(ktime_get(), timeout) > 0)

[PATCH 2/3] iommu/arm-smmu: Add initial driver support for ARM SMMUv3 devices

2015-05-08 Thread Will Deacon
Version three of the ARM SMMU architecture introduces significant changes and improvements over previous versions of the specification, necessitating a new driver in the Linux kernel. The main change to the programming interface is that the majority of the configuration data has been moved from MM