|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: privcmd.c not calling set_phys_to_machine
On 14.10.22 23:04, Stefano Stabellini wrote: Hi Juergen and all, I am writing again to ask a question about privcmd.c in PV dom0 x86. This is related to the previous pin_user_pages_fast issue: https://marc.info/?l=xen-devel&m=166268914727630 https://marc.info/?l=xen-devel&m=166322385912052 In summary this is the situation: 1. domU (HVM) kernel space: a. pages allocation with get_free_pages() b. get dma_handle by calling dma_map_page() on the pages allocated in (1.a) c. send dma_handle to dom0 (PV) using virtio queue 2. dom0 userspace (QEMU): a. read dma_handle from virtio queue b. map dma_handle using QEMU dma_memory_map(), which calls xenforeignmemory_map2, which is IOCTL_PRIVCMD_MMAPBATCH_V2, which ends up calling drivers/xen/privcmd.c:privcmd_ioctl_mmap_batch [this is verified to work correctly, the mapping works] c. open /dev/tee node and make an ioctl call to register the virtual address (from step 2.b) with TEE. 3. dom0 kernel space: a. AMD TEE driver get the virtual address passed by userspace b. AMD TEE driver get the list of pages corresponding to the virtual address (3.a) and calls dma_map_page() on them I'm rather sure "AMD TEE driver get the list of pages corresponding to the virtual address" is the problem. The PTEs should have the "special" flag set, meaning that there is no struct page associated with this virtual area. Not for special memory pages. I think this might be a little bit more complicated. This could work, if there is really a struct page available for the PFN. OTOH this might be not the case quite often, as we are using zone device memory for foreign mappings per default for some time now. Solving this might require something like dma_map_pfn() instead of dma_map_page(), which sounds a little bit like dma_direct_mmap(). Juergen Attachment:
OpenPGP_0xB0DE9DD628BF132F.asc Attachment:
OpenPGP_signature
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |