OSDN Git Service

cxl: Enable global TLBIs for cxl contexts
authorFrederic Barrat <fbarrat@linux.vnet.ibm.com>
Sun, 3 Sep 2017 18:15:13 +0000 (20:15 +0200)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 28 Sep 2017 07:09:16 +0000 (17:09 +1000)
commit03b8abedf4f4965e7e9e0d4f92877c42c07ce19f
tree477b0118aedfca952b43149def528bcefbf8a8c8
parent6110236b9bbd177debc045c5fc29224444686ece
cxl: Enable global TLBIs for cxl contexts

The PSL and nMMU need to see all TLB invalidations for the memory
contexts used on the adapter. For the hash memory model, it is done by
making all TLBIs global as soon as the cxl driver is in use. For
radix, we need something similar, but we can refine and only convert
to global the invalidations for contexts actually used by the device.

The new mm_context_add_copro() API increments the 'active_cpus' count
for the contexts attached to the cxl adapter. As soon as there's more
than 1 active cpu, the TLBIs for the context become global. Active cpu
count must be decremented when detaching to restore locality if
possible and to avoid overflowing the counter.

The hash memory model support is somewhat limited, as we can't
decrement the active cpus count when mm_context_remove_copro() is
called, because we can't flush the TLB for a mm on hash. So TLBIs
remain global on hash.

Signed-off-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
Fixes: f24be42aab37 ("cxl: Add psl9 specific code")
Tested-by: Alistair Popple <alistair@popple.id.au>
[mpe: Fold in updated comment on the barrier from Fred]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/mmu_context.h
arch/powerpc/mm/mmu_context.c
drivers/misc/cxl/api.c
drivers/misc/cxl/context.c
drivers/misc/cxl/file.c