Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/iommu: Add ppc_md.tce_get() callback for use by VFIO

The upcoming VFIO support requires a way to know which
entry in the TCE map is not empty in order to do cleanup
at QEMU exit/crash. This patch adds such functionality
to POWERNV platform code.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

authored by

Alexey Kardashevskiy and committed by
Benjamin Herrenschmidt
11f63d3f 4715fed6

+6
+6
arch/powerpc/platforms/powernv/pci.c
··· 446 446 pnv_tce_invalidate(tbl, tces, tcep - 1); 447 447 } 448 448 449 + static unsigned long pnv_tce_get(struct iommu_table *tbl, long index) 450 + { 451 + return ((u64 *)tbl->it_base)[index - tbl->it_offset]; 452 + } 453 + 449 454 void pnv_pci_setup_iommu_table(struct iommu_table *tbl, 450 455 void *tce_mem, u64 tce_size, 451 456 u64 dma_offset) ··· 601 596 ppc_md.pci_dma_dev_setup = pnv_pci_dma_dev_setup; 602 597 ppc_md.tce_build = pnv_tce_build; 603 598 ppc_md.tce_free = pnv_tce_free; 599 + ppc_md.tce_get = pnv_tce_get; 604 600 ppc_md.pci_probe_mode = pnv_pci_probe_mode; 605 601 set_pci_dma_ops(&dma_iommu_ops); 606 602