|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v02 1/7] arm: introduce remoteprocessor iommu module
Hi Andrii, On 26/06/14 12:07, Andrii Tseglytskyi wrote: This is a fisrst patch from patch series which was s/firsrst/first/Although I don't think you have to say that this is the first patch :). This is not useful for the commit message. developed to handle remote (external) processors memory management units. Remote processors are typically used for graphic rendering (GPUs) and high quality video decoding (IPUs). They are typically installed on such multimedia SoCs as OMAP4 / OMAP5. As soon as remoteprocessor MMU typically works with pagetables filled by physical addresses, which are allocated by domU kernel, it is almost impossible to use them under Xen, intermediate physical addresses allocated by kernel, need to be translated to machine addresses. This patch introduces a simple framework to perform pfn -> mfn translation for external MMUs. It introduces basic data structures and algorithms needed for translation. Typically, when MMU is configured, some it registers are updated by new values. Introduced frameworks uses traps as starting point of remoteproc MMUs pagetables translation. Change-Id: Ia4d311a40289df46a003f5ae8706c150bee1885d Signed-off-by: Andrii Tseglytskyi <andrii.tseglytskyi@xxxxxxxxxxxxxxx> [..] Using _res |= will result to a wrong errno at the end. See the usage in iommu mmu_init_all. I would use __res = pfunc(...) if ( !__res ) break; And therefore modify mmu_check to return 1 if failing, 0 otherwise. This will also avoid to continue to browse all the MMU for nothing. This solution leads any guest to access to the MMU and therefore program it. If you plan to use for passthrough, you have to find a way to say that a specific domain is able to use the MMU, maybe an hypercall. Otherwise this is a security issue. IIRC I have already raised this concern on V1 :). It would be nice if you resolve it ASAP, because I suspect it will need some rework in the way you handle MMNU. ioremap_* should only be used to map device memory. For the guest memory you have to use copy_from_guest helper. +struct mmu_pagetable *mmu_pagetable_lookup(struct mmu_info *mmu, u32 addr, bool is_maddr) you have to use paddr_t for addr. The number of bit for the physical address can be greater than 40 bits. The remark is the same everywhere within this file. [..] The function mmu_alloc_pagetable can return NULL. But you never check the return value and dereference it just below. + } + } + + pgt->maddr = MMU_INVALID_ADDRESS; [..] The ASSERT is pointless, select_user_reg will never return NULL. [..] Same here. + /* dom0 should not access remoteproc MMU */ + if ( 0 == current->domain->domain_id ) + return 1; Why this restriction? I guess this restriction is because you are using current in mmu_trap_translate_pagetable? So, the iohandler is usually call on the current VCPU, there is no need to worry about it. Futhermore, I would pass the vcpu/domain in argument of the next function. It looks like there is a hard tab here. [..] Hmmm... do_initcalls doesn't check the return value. How your code behave we one of the MMU has not been initialized? I think do_initcalls & co should check the return, but as it's the common code I don't know how x86 respect this convention to return 0 if succeded. Ian, Stefano, any thoughs? [..] diff --git a/xen/include/xen/remoteproc_iommu.h b/xen/include/xen/remoteproc_iommu.h I think this file as new file mode 100644 index 0000000..22e2951 --- /dev/null +++ b/xen/include/xen/remoteproc_iommu.h The remoteproc things is ARM specific, right? If so, this header should be moved in include/asm-arm. + +#define MMU_INVALID_ADDRESS ((u32)(-1)) You should not assume that the MMU ADDRESS is always 32 bits. Please use paddr_t here. Hmmm, you are assuming that mmu is existing within the function. You should pass the mmu in parameter of this macro. Also, most of the usage are for an error (except the one in mmu_page_alloc). I would prefix it by XENLOG_ERROR. No hard tab in Xen. Please remove them. Same here. Same here. Regards, -- Julien Grall _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |