mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-24 09:06:34 +07:00
2157e7b82f
The existing implementation accounts the whole DMA window in the locked_vm counter. This is going to be worse with multiple containers and huge DMA windows. Also, real-time accounting would requite additional tracking of accounted pages due to the page size difference - IOMMU uses 4K pages and system uses 4K or 64K pages. Another issue is that actual pages pinning/unpinning happens on every DMA map/unmap request. This does not affect the performance much now as we spend way too much time now on switching context between guest/userspace/host but this will start to matter when we add in-kernel DMA map/unmap acceleration. This introduces a new IOMMU type for SPAPR - VFIO_SPAPR_TCE_v2_IOMMU. New IOMMU deprecates VFIO_IOMMU_ENABLE/VFIO_IOMMU_DISABLE and introduces 2 new ioctls to register/unregister DMA memory - VFIO_IOMMU_SPAPR_REGISTER_MEMORY and VFIO_IOMMU_SPAPR_UNREGISTER_MEMORY - which receive user space address and size of a memory region which needs to be pinned/unpinned and counted in locked_vm. New IOMMU splits physical pages pinning and TCE table update into 2 different operations. It requires: 1) guest pages to be registered first 2) consequent map/unmap requests to work only with pre-registered memory. For the default single window case this means that the entire guest (instead of 2GB) needs to be pinned before using VFIO. When a huge DMA window is added, no additional pinning will be required, otherwise it would be guest RAM + 2GB. The new memory registration ioctls are not supported by VFIO_SPAPR_TCE_IOMMU. Dynamic DMA window and in-kernel acceleration will require memory to be preregistered in order to work. The accounting is done per the user process. This advertises v2 SPAPR TCE IOMMU and restricts what the userspace can do with v1 or v2 IOMMUs. In order to support memory pre-registration, we need a way to track the use of every registered memory region and only allow unregistration if a region is not in use anymore. So we need a way to tell from what region the just cleared TCE was from. This adds a userspace view of the TCE table into iommu_table struct. It contains userspace address, one per TCE entry. The table is only allocated when the ownership over an IOMMU group is taken which means it is only used from outside of the powernv code (such as VFIO). As v2 IOMMU supports IODA2 and pre-IODA2 IOMMUs (which do not support DDW API), this creates a default DMA window for IODA2 for consistency. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> [aw: for the vfio related changes] Acked-by: Alex Williamson <alex.williamson@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> |
||
---|---|---|
.. | ||
8xx_immap.h | ||
agp.h | ||
archrandom.h | ||
asm-compat.h | ||
asm-offsets.h | ||
async_tx.h | ||
atomic.h | ||
backlight.h | ||
barrier.h | ||
bitops.h | ||
bootx.h | ||
btext.h | ||
bug.h | ||
bugs.h | ||
cache.h | ||
cacheflush.h | ||
cell-pmu.h | ||
cell-regs.h | ||
checksum.h | ||
cmpxchg.h | ||
code-patching.h | ||
compat.h | ||
context_tracking.h | ||
copro.h | ||
cpm1.h | ||
cpm2.h | ||
cpm.h | ||
cpuidle.h | ||
cputable.h | ||
cputhreads.h | ||
cputime.h | ||
current.h | ||
dbdma.h | ||
dbell.h | ||
dcr-generic.h | ||
dcr-mmio.h | ||
dcr-native.h | ||
dcr-regs.h | ||
dcr.h | ||
debug.h | ||
delay.h | ||
device.h | ||
disassemble.h | ||
dma-mapping.h | ||
dma.h | ||
edac.h | ||
eeh_event.h | ||
eeh.h | ||
ehv_pic.h | ||
elf.h | ||
emergency-restart.h | ||
emulated_ops.h | ||
epapr_hcalls.h | ||
exception-64e.h | ||
exception-64s.h | ||
exec.h | ||
fadump.h | ||
fb.h | ||
feature-fixups.h | ||
firmware.h | ||
fixmap.h | ||
floppy.h | ||
fs_pd.h | ||
fsl_85xx_cache_sram.h | ||
fsl_gtm.h | ||
fsl_guts.h | ||
fsl_hcalls.h | ||
fsl_lbc.h | ||
fsl_pamu_stash.h | ||
ftrace.h | ||
futex.h | ||
gpio.h | ||
grackle.h | ||
hardirq.h | ||
heathrow.h | ||
highmem.h | ||
hugetlb.h | ||
hvcall.h | ||
hvconsole.h | ||
hvcserver.h | ||
hvsi.h | ||
hw_breakpoint.h | ||
hw_irq.h | ||
hydra.h | ||
i8259.h | ||
ibmebus.h | ||
ide.h | ||
immap_cpm2.h | ||
immap_qe.h | ||
io_event_irq.h | ||
io-defs.h | ||
io-workarounds.h | ||
io.h | ||
iommu.h | ||
ipic.h | ||
irq_work.h | ||
irq.h | ||
irqflags.h | ||
jump_label.h | ||
Kbuild | ||
kdebug.h | ||
kdump.h | ||
kexec.h | ||
keylargo.h | ||
kgdb.h | ||
kmap_types.h | ||
kprobes.h | ||
kvm_asm.h | ||
kvm_book3s_32.h | ||
kvm_book3s_64.h | ||
kvm_book3s_asm.h | ||
kvm_book3s.h | ||
kvm_booke_hv_asm.h | ||
kvm_booke.h | ||
kvm_fpu.h | ||
kvm_host.h | ||
kvm_para.h | ||
kvm_ppc.h | ||
libata-portmap.h | ||
linkage.h | ||
local.h | ||
lppaca.h | ||
lv1call.h | ||
machdep.h | ||
macio.h | ||
mc146818rtc.h | ||
mce.h | ||
mediabay.h | ||
mman.h | ||
mmu_context.h | ||
mmu-8xx.h | ||
mmu-40x.h | ||
mmu-44x.h | ||
mmu-book3e.h | ||
mmu-hash32.h | ||
mmu-hash64.h | ||
mmu.h | ||
mmzone.h | ||
module.h | ||
mpc5xxx.h | ||
mpc6xx.h | ||
mpc52xx_psc.h | ||
mpc52xx.h | ||
mpc85xx.h | ||
mpc5121.h | ||
mpc8260.h | ||
mpic_msgr.h | ||
mpic_timer.h | ||
mpic.h | ||
msi_bitmap.h | ||
mutex.h | ||
nmi.h | ||
nvram.h | ||
ohare.h | ||
opal-api.h | ||
opal.h | ||
oprofile_impl.h | ||
paca.h | ||
page_32.h | ||
page_64.h | ||
page.h | ||
parport.h | ||
pasemi_dma.h | ||
pci-bridge.h | ||
pci.h | ||
percpu.h | ||
perf_event_fsl_emb.h | ||
perf_event_server.h | ||
perf_event.h | ||
pgalloc-32.h | ||
pgalloc-64.h | ||
pgalloc.h | ||
pgtable-ppc32.h | ||
pgtable-ppc64-4k.h | ||
pgtable-ppc64-64k.h | ||
pgtable-ppc64.h | ||
pgtable.h | ||
plpar_wrappers.h | ||
pmac_feature.h | ||
pmac_low_i2c.h | ||
pmac_pfunc.h | ||
pmc.h | ||
pmi.h | ||
pnv-pci.h | ||
ppc4xx_ocm.h | ||
ppc4xx.h | ||
ppc_asm.h | ||
ppc-opcode.h | ||
ppc-pci.h | ||
probes.h | ||
processor.h | ||
prom.h | ||
ps3.h | ||
ps3av.h | ||
ps3gpu.h | ||
ps3stor.h | ||
pte-8xx.h | ||
pte-40x.h | ||
pte-44x.h | ||
pte-book3e.h | ||
pte-common.h | ||
pte-fsl-booke.h | ||
pte-hash32.h | ||
pte-hash64-4k.h | ||
pte-hash64-64k.h | ||
pte-hash64.h | ||
ptrace.h | ||
qe_ic.h | ||
qe.h | ||
reg_8xx.h | ||
reg_a2.h | ||
reg_booke.h | ||
reg_fsl_emb.h | ||
reg.h | ||
rheap.h | ||
rio.h | ||
rtas.h | ||
rtc.h | ||
runlatch.h | ||
scom.h | ||
seccomp.h | ||
sections.h | ||
serial.h | ||
setjmp.h | ||
setup.h | ||
sfp-machine.h | ||
shmparam.h | ||
signal.h | ||
smp.h | ||
smu.h | ||
sparsemem.h | ||
spinlock_types.h | ||
spinlock.h | ||
spu_csa.h | ||
spu_info.h | ||
spu_priv1.h | ||
spu.h | ||
sstep.h | ||
string.h | ||
swab.h | ||
swiotlb.h | ||
switch_to.h | ||
synch.h | ||
syscall.h | ||
syscalls.h | ||
systbl.h | ||
tce.h | ||
termios.h | ||
thread_info.h | ||
time.h | ||
timex.h | ||
tlb.h | ||
tlbflush.h | ||
tm.h | ||
topology.h | ||
trace.h | ||
tsi108_irq.h | ||
tsi108_pci.h | ||
tsi108.h | ||
types.h | ||
uaccess.h | ||
ucc_fast.h | ||
ucc_slow.h | ||
ucc.h | ||
udbg.h | ||
uic.h | ||
unaligned.h | ||
uninorth.h | ||
unistd.h | ||
uprobes.h | ||
user.h | ||
vdso_datapage.h | ||
vdso.h | ||
vga.h | ||
vio.h | ||
word-at-a-time.h | ||
xics.h | ||
xilinx_intc.h | ||
xilinx_pci.h | ||
xmon.h | ||
xor.h |