RE: [PATCH 4/4 v6] iommu/fsl: Freescale PAMU driver and IOMMU API implementation.
-Original Message- From: Tabi Timur-B04825 Sent: Tuesday, December 04, 2012 1:33 AM To: Sethi Varun-B16395 Cc: joerg.roe...@amd.com; io...@lists.linux-foundation.org; linuxppc- d...@lists.ozlabs.org; linux-ker...@vger.kernel.org; Wood Scott-B07421 Subject: Re: [PATCH 4/4 v6] iommu/fsl: Freescale PAMU driver and IOMMU API implementation. Varun Sethi wrote: + out_be32(pamu_regs-ppbah, ((u64)ppaact_phys) 32); + out_be32(pamu_regs-ppbal, ppaact_phys); + ppaact_phys = ppaact_phys + PAACT_SIZE; + out_be32(pamu_regs-pplah, ((u64)ppaact_phys) 32); + out_be32(pamu_regs-pplal, ppaact_phys); Instead of ((u64)ppaact_phys) 32, use upper_32_bits() and lower_32_bits(). +#define PAACE_NUMBER_ENTRIES0xFF This is going to break with large LIODNs. Instead of hard-coding the size of the PPAACT, you need to scan the device tree for the largest LIODN, and make the array dynamically sized. This would in any case change with the new LIODN allocation scheme. I intend on introducing the new scheme as a separate patch. -Varun ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 4/4 v6] iommu/fsl: Freescale PAMU driver and IOMMU API implementation.
Sethi Varun-B16395 wrote: This would in any case change with the new LIODN allocation scheme. I intend on introducing the new scheme as a separate patch. At the very least, you should detect when an LIODN is too large and print an error message. -- Timur Tabi Linux kernel developer at Freescale ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 4/4 v6] iommu/fsl: Freescale PAMU driver and IOMMU API implementation.
Varun Sethi wrote: + out_be32(pamu_regs-ppbah, ((u64)ppaact_phys) 32); + out_be32(pamu_regs-ppbal, ppaact_phys); + ppaact_phys = ppaact_phys + PAACT_SIZE; + out_be32(pamu_regs-pplah, ((u64)ppaact_phys) 32); + out_be32(pamu_regs-pplal, ppaact_phys); Instead of ((u64)ppaact_phys) 32, use upper_32_bits() and lower_32_bits(). +#define PAACE_NUMBER_ENTRIES0xFF This is going to break with large LIODNs. Instead of hard-coding the size of the PPAACT, you need to scan the device tree for the largest LIODN, and make the array dynamically sized. -- Timur Tabi Linux kernel developer at Freescale ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 4/4 v6] iommu/fsl: Freescale PAMU driver and IOMMU API implementation.
Varun Sethi wrote: Following is a brief description of the PAMU hardware: PAMU determines what action to take and whether to authorize the action on the basis of the memory address, a Logical IO Device Number (LIODN), and PAACT table (logically) indexed by LIODN and address. Hardware devices which need to access memory must provide an LIODN in addition to the memory address. Peripheral Access Authorization and Control Tables (PAACTs) are the primary data structures used by PAMU. A PAACT is a table of peripheral access authorization and control entries (PAACE).Each PAACE defines the range of I/O bus address space that is accessible by the LIOD and the associated access capabilities. There are two types of PAACTs: primary PAACT (PPAACT) and secondary PAACT (SPAACT).A given physical I/O device may be able to act as one or more independent logical I/O devices (LIODs). Each such logical I/O device is assigned an identifier called logical I/O device number (LIODN). A LIODN is allocated a contiguous portion of the I/O bus address space called the DSA window for performing DSA operations. The DSA window may optionally be divided into multiple sub-windows, each of which may be used to map to a region in system storage space. The first sub-window is referred to as the primary sub-window and the remaining are called secondary sub-windows. This patch provides the PAMU driver (fsl_pamu.c) and the corresponding IOMMU API implementation (fsl_pamu_domain.c). The PAMU hardware driver (fsl_pamu.c) has been derived from the work done by Ashish Kalra and Timur Tabi (ti...@freescale.com). Signed-off-by: Timur Tabiti...@freescale.com Signed-off-by: Varun Sethivarun.se...@freescale.com --- Acked-by: Timur Tabi ti...@freescale.com -- Timur Tabi Linux kernel developer at Freescale ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev