mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
cxl: Add kernel API to allow a context to operate with relocate disabled
cxl devices typically access memory using an MMU in much the same way as the CPU, and each context includes a state register much like the MSR in the CPU. Like the CPU, the state register includes a bit to enable relocation, which we currently always enable. In some cases, it may be desirable to allow a device to access memory using real addresses instead of effective addresses, so this adds a new API, cxl_set_translation_mode, that can be used to disable relocation on a given kernel context. This can allow for the creation of a special privileged context that the device can use if it needs relocation disabled, and can use regular contexts at times when it needs relocation enabled. This interface is only available to users of the kernel API for obvious reasons, and will never be supported in a virtualised environment. This will be used by the upcoming cxl support in the mlx5 driver. Signed-off-by: Ian Munsie <imunsie@au1.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:
parent
3c206fa77a
commit
7a0d85d313
5 changed files with 34 additions and 2 deletions
|
@ -617,6 +617,9 @@ static int guest_attach_process(struct cxl_context *ctx, bool kernel, u64 wed, u
|
|||
{
|
||||
pr_devel("in %s\n", __func__);
|
||||
|
||||
if (ctx->real_mode)
|
||||
return -EPERM;
|
||||
|
||||
ctx->kernel = kernel;
|
||||
if (ctx->afu->current_mode == CXL_MODE_DIRECTED)
|
||||
return attach_afu_directed(ctx, wed, amr);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue