Re: [PATCH v3 3/6] iommu: add ARM short descriptor page table allocator.

2015-09-16 Thread Yong Wu
On Wed, 2015-09-16 at 13:55 +0100, Will Deacon wrote: > Hello Yong, > > On Mon, Sep 14, 2015 at 01:25:00PM +0100, Yong Wu wrote: > > On Tue, 2015-07-21 at 18:11 +0100, Will Deacon wrote: > > > > + ret = _arm_short_map(data, iova, paddr, pgdprot, pteprot, > > > > large); > > > > + > > > > +

Re: [PATCH v3 3/6] iommu: add ARM short descriptor page table allocator.

2015-09-16 Thread Will Deacon
Hello Yong, On Mon, Sep 14, 2015 at 01:25:00PM +0100, Yong Wu wrote: > On Tue, 2015-07-21 at 18:11 +0100, Will Deacon wrote: > > > + ret = _arm_short_map(data, iova, paddr, pgdprot, pteprot, large); > > > + > > > + tlb->tlb_add_flush(iova, size, true, data->iop.cookie); > > > +

Re: [PATCH v3 3/6] iommu: add ARM short descriptor page table allocator.

2015-09-16 Thread Will Deacon
Hello Yong, On Mon, Sep 14, 2015 at 01:25:00PM +0100, Yong Wu wrote: > On Tue, 2015-07-21 at 18:11 +0100, Will Deacon wrote: > > > + ret = _arm_short_map(data, iova, paddr, pgdprot, pteprot, large); > > > + > > > + tlb->tlb_add_flush(iova, size, true, data->iop.cookie); > > > +

Re: [PATCH v3 3/6] iommu: add ARM short descriptor page table allocator.

2015-09-16 Thread Yong Wu
On Wed, 2015-09-16 at 13:55 +0100, Will Deacon wrote: > Hello Yong, > > On Mon, Sep 14, 2015 at 01:25:00PM +0100, Yong Wu wrote: > > On Tue, 2015-07-21 at 18:11 +0100, Will Deacon wrote: > > > > + ret = _arm_short_map(data, iova, paddr, pgdprot, pteprot, > > > > large); > > > > + > > > > +

Re: [PATCH v3 3/6] iommu: add ARM short descriptor page table allocator.

2015-09-14 Thread Yong Wu
On Tue, 2015-07-21 at 18:11 +0100, Will Deacon wrote: [...] > > +static int arm_short_map(struct io_pgtable_ops *ops, unsigned long iova, > > +phys_addr_t paddr, size_t size, int prot) > > +{ > > + struct arm_short_io_pgtable *data = io_pgtable_ops_to_data(ops); > > +

Re: [PATCH v3 3/6] iommu: add ARM short descriptor page table allocator.

2015-09-14 Thread Yong Wu
On Tue, 2015-07-21 at 18:11 +0100, Will Deacon wrote: [...] > > +static int arm_short_map(struct io_pgtable_ops *ops, unsigned long iova, > > +phys_addr_t paddr, size_t size, int prot) > > +{ > > + struct arm_short_io_pgtable *data = io_pgtable_ops_to_data(ops); > > +

Re: [PATCH v3 3/6] iommu: add ARM short descriptor page table allocator.

2015-07-31 Thread Will Deacon
On Fri, Jul 31, 2015 at 08:55:37AM +0100, Yong Wu wrote: > About the AP bits, I may have to add a new quirk for it... > > Current I add AP in pte like this: > #define ARM_SHORT_PTE_RD_WR(3 << 4) > #define ARM_SHORT_PTE_RDONLY BIT(9) > > pteprot |= ARM_SHORT_PTE_RD_WR; > >

Re: [PATCH v3 3/6] iommu: add ARM short descriptor page table allocator.

2015-07-31 Thread Will Deacon
On Fri, Jul 31, 2015 at 08:55:37AM +0100, Yong Wu wrote: About the AP bits, I may have to add a new quirk for it... Current I add AP in pte like this: #define ARM_SHORT_PTE_RD_WR(3 4) #define ARM_SHORT_PTE_RDONLY BIT(9) pteprot |= ARM_SHORT_PTE_RD_WR; If(!(prot

Re: [PATCH v3 3/6] iommu: add ARM short descriptor page table allocator.

2015-07-28 Thread Will Deacon
On Tue, Jul 28, 2015 at 02:37:43PM +0100, Yong Wu wrote: > On Tue, 2015-07-28 at 12:00 +0100, Will Deacon wrote: > > On Tue, Jul 28, 2015 at 06:08:14AM +0100, Yong Wu wrote: > > > On Mon, 2015-07-27 at 15:11 +0100, Will Deacon wrote: > > > > On Mon, Jul 27, 2015 at 03:05:38PM +0100, Robin Murphy

Re: [PATCH v3 3/6] iommu: add ARM short descriptor page table allocator.

2015-07-28 Thread Yong Wu
On Tue, 2015-07-28 at 12:00 +0100, Will Deacon wrote: > On Tue, Jul 28, 2015 at 06:08:14AM +0100, Yong Wu wrote: > > On Mon, 2015-07-27 at 15:11 +0100, Will Deacon wrote: > > > On Mon, Jul 27, 2015 at 03:05:38PM +0100, Robin Murphy wrote: > > > > On 27/07/15 05:21, Yong Wu wrote: > > > > > +

Re: [PATCH v3 3/6] iommu: add ARM short descriptor page table allocator.

2015-07-28 Thread Will Deacon
On Tue, Jul 28, 2015 at 06:08:14AM +0100, Yong Wu wrote: > On Mon, 2015-07-27 at 15:11 +0100, Will Deacon wrote: > > On Mon, Jul 27, 2015 at 03:05:38PM +0100, Robin Murphy wrote: > > > On 27/07/15 05:21, Yong Wu wrote: > > > > + } else {/* page or largepage */ > > > > +

Re: [PATCH v3 3/6] iommu: add ARM short descriptor page table allocator.

2015-07-28 Thread Will Deacon
On Tue, Jul 28, 2015 at 02:37:43PM +0100, Yong Wu wrote: On Tue, 2015-07-28 at 12:00 +0100, Will Deacon wrote: On Tue, Jul 28, 2015 at 06:08:14AM +0100, Yong Wu wrote: On Mon, 2015-07-27 at 15:11 +0100, Will Deacon wrote: On Mon, Jul 27, 2015 at 03:05:38PM +0100, Robin Murphy wrote:

Re: [PATCH v3 3/6] iommu: add ARM short descriptor page table allocator.

2015-07-28 Thread Yong Wu
On Tue, 2015-07-28 at 12:00 +0100, Will Deacon wrote: On Tue, Jul 28, 2015 at 06:08:14AM +0100, Yong Wu wrote: On Mon, 2015-07-27 at 15:11 +0100, Will Deacon wrote: On Mon, Jul 27, 2015 at 03:05:38PM +0100, Robin Murphy wrote: On 27/07/15 05:21, Yong Wu wrote: + } else {

Re: [PATCH v3 3/6] iommu: add ARM short descriptor page table allocator.

2015-07-28 Thread Will Deacon
On Tue, Jul 28, 2015 at 06:08:14AM +0100, Yong Wu wrote: On Mon, 2015-07-27 at 15:11 +0100, Will Deacon wrote: On Mon, Jul 27, 2015 at 03:05:38PM +0100, Robin Murphy wrote: On 27/07/15 05:21, Yong Wu wrote: + } else {/* page or largepage */ + if (quirk

Re: [PATCH v3 3/6] iommu: add ARM short descriptor page table allocator.

2015-07-27 Thread Yong Wu
On Mon, 2015-07-27 at 15:11 +0100, Will Deacon wrote: > On Mon, Jul 27, 2015 at 03:05:38PM +0100, Robin Murphy wrote: > > On 27/07/15 05:21, Yong Wu wrote: > > > + } else {/* page or largepage */ > > > + if (quirk & IO_PGTABLE_QUIRK_SHORT_MTK) { > > > +

Re: [PATCH v3 3/6] iommu: add ARM short descriptor page table allocator.

2015-07-27 Thread Will Deacon
On Mon, Jul 27, 2015 at 03:05:38PM +0100, Robin Murphy wrote: > On 27/07/15 05:21, Yong Wu wrote: > > + } else {/* page or largepage */ > > + if (quirk & IO_PGTABLE_QUIRK_SHORT_MTK) { > > + if (large) { /* special Bit */ > >

Re: [PATCH v3 3/6] iommu: add ARM short descriptor page table allocator.

2015-07-27 Thread Robin Murphy
On 27/07/15 05:21, Yong Wu wrote: [...] +static arm_short_iopte +__arm_short_pte_prot(struct arm_short_io_pgtable *data, int prot, bool large) +{ + arm_short_iopte pteprot; + + pteprot = ARM_SHORT_PTE_S | ARM_SHORT_PTE_nG; + pteprot |= large ? ARM_SHORT_PTE_TYPE_LARGE : +

Re: [PATCH v3 3/6] iommu: add ARM short descriptor page table allocator.

2015-07-27 Thread Robin Murphy
On 27/07/15 05:21, Yong Wu wrote: [...] +static arm_short_iopte +__arm_short_pte_prot(struct arm_short_io_pgtable *data, int prot, bool large) +{ + arm_short_iopte pteprot; + + pteprot = ARM_SHORT_PTE_S | ARM_SHORT_PTE_nG; + pteprot |= large ? ARM_SHORT_PTE_TYPE_LARGE : +

Re: [PATCH v3 3/6] iommu: add ARM short descriptor page table allocator.

2015-07-27 Thread Will Deacon
On Mon, Jul 27, 2015 at 03:05:38PM +0100, Robin Murphy wrote: On 27/07/15 05:21, Yong Wu wrote: + } else {/* page or largepage */ + if (quirk IO_PGTABLE_QUIRK_SHORT_MTK) { + if (large) { /* special Bit */ This definitely needs a better

Re: [PATCH v3 3/6] iommu: add ARM short descriptor page table allocator.

2015-07-27 Thread Yong Wu
On Mon, 2015-07-27 at 15:11 +0100, Will Deacon wrote: On Mon, Jul 27, 2015 at 03:05:38PM +0100, Robin Murphy wrote: On 27/07/15 05:21, Yong Wu wrote: + } else {/* page or largepage */ + if (quirk IO_PGTABLE_QUIRK_SHORT_MTK) { + if

Re: [PATCH v3 3/6] iommu: add ARM short descriptor page table allocator.

2015-07-26 Thread Yong Wu
On Fri, 2015-07-24 at 17:53 +0100, Will Deacon wrote: > On Fri, Jul 24, 2015 at 06:24:26AM +0100, Yong Wu wrote: > > On Tue, 2015-07-21 at 18:11 +0100, Will Deacon wrote: > > > On Thu, Jul 16, 2015 at 10:04:32AM +0100, Yong Wu wrote: > > > > +/* level 2 pagetable */ > > > > +#define

Re: [PATCH v3 3/6] iommu: add ARM short descriptor page table allocator.

2015-07-26 Thread Yong Wu
On Fri, 2015-07-24 at 17:53 +0100, Will Deacon wrote: On Fri, Jul 24, 2015 at 06:24:26AM +0100, Yong Wu wrote: On Tue, 2015-07-21 at 18:11 +0100, Will Deacon wrote: On Thu, Jul 16, 2015 at 10:04:32AM +0100, Yong Wu wrote: +/* level 2 pagetable */ +#define ARM_SHORT_PTE_TYPE_LARGE

Re: [PATCH v3 3/6] iommu: add ARM short descriptor page table allocator.

2015-07-24 Thread Will Deacon
On Fri, Jul 24, 2015 at 06:24:26AM +0100, Yong Wu wrote: > On Tue, 2015-07-21 at 18:11 +0100, Will Deacon wrote: > > On Thu, Jul 16, 2015 at 10:04:32AM +0100, Yong Wu wrote: > > > +/* level 2 pagetable */ > > > +#define ARM_SHORT_PTE_TYPE_LARGE BIT(0) > > > +#define

Re: [PATCH v3 3/6] iommu: add ARM short descriptor page table allocator.

2015-07-24 Thread Will Deacon
On Fri, Jul 24, 2015 at 06:24:26AM +0100, Yong Wu wrote: On Tue, 2015-07-21 at 18:11 +0100, Will Deacon wrote: On Thu, Jul 16, 2015 at 10:04:32AM +0100, Yong Wu wrote: +/* level 2 pagetable */ +#define ARM_SHORT_PTE_TYPE_LARGE BIT(0) +#define ARM_SHORT_PTE_SMALL_XN

Re: [PATCH v3 3/6] iommu: add ARM short descriptor page table allocator.

2015-07-23 Thread Yong Wu
Hi Will, Thanks for your review so detail. When you are free, please help me check whether it's ok if it's changed like below. Thanks very much. On Tue, 2015-07-21 at 18:11 +0100, Will Deacon wrote: > Hello, > > This is looking better, but I still have some concerns. > > On Thu, Jul

Re: [PATCH v3 3/6] iommu: add ARM short descriptor page table allocator.

2015-07-23 Thread Yong Wu
Hi Will, Thanks for your review so detail. When you are free, please help me check whether it's ok if it's changed like below. Thanks very much. On Tue, 2015-07-21 at 18:11 +0100, Will Deacon wrote: Hello, This is looking better, but I still have some concerns. On Thu, Jul 16,

Re: [PATCH v3 3/6] iommu: add ARM short descriptor page table allocator.

2015-07-21 Thread Will Deacon
Hello, This is looking better, but I still have some concerns. On Thu, Jul 16, 2015 at 10:04:32AM +0100, Yong Wu wrote: > This patch is for ARM Short Descriptor Format. > > Signed-off-by: Yong Wu > --- > drivers/iommu/Kconfig| 18 + > drivers/iommu/Makefile |

Re: [PATCH v3 3/6] iommu: add ARM short descriptor page table allocator.

2015-07-21 Thread Will Deacon
Hello, This is looking better, but I still have some concerns. On Thu, Jul 16, 2015 at 10:04:32AM +0100, Yong Wu wrote: This patch is for ARM Short Descriptor Format. Signed-off-by: Yong Wu yong...@mediatek.com --- drivers/iommu/Kconfig| 18 + drivers/iommu/Makefile

[PATCH v3 3/6] iommu: add ARM short descriptor page table allocator.

2015-07-16 Thread Yong Wu
This patch is for ARM Short Descriptor Format. Signed-off-by: Yong Wu --- drivers/iommu/Kconfig| 18 + drivers/iommu/Makefile |1 + drivers/iommu/io-pgtable-arm-short.c | 742 ++ drivers/iommu/io-pgtable-arm.c |3 -

[PATCH v3 3/6] iommu: add ARM short descriptor page table allocator.

2015-07-16 Thread Yong Wu
This patch is for ARM Short Descriptor Format. Signed-off-by: Yong Wu yong...@mediatek.com --- drivers/iommu/Kconfig| 18 + drivers/iommu/Makefile |1 + drivers/iommu/io-pgtable-arm-short.c | 742 ++