From: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
To: mpe@ellerman.id.au, aneesh.kumar@linux.vnet.ibm.com,
bsingharora@gmail.com, linuxppc-dev@lists.ozlabs.org
Cc: clombard@linux.vnet.ibm.com, alistair@popple.id.au,
vaibhav@linux.vnet.ibm.com
Subject: [PATCH v3 2/3] cxl: Mark context requiring global TLBIs
Date: Wed, 2 Aug 2017 22:29:29 +0200 [thread overview]
Message-ID: <20170802202930.5616-3-fbarrat@linux.vnet.ibm.com> (raw)
In-Reply-To: <20170802202930.5616-1-fbarrat@linux.vnet.ibm.com>
The PSL and XSL need to see all TLBIs pertinent to 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.
So mark the contexts being attached to the cxl adapter as requiring
global TLBIs.
Signed-off-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
---
drivers/misc/cxl/api.c | 12 ++++++++++--
drivers/misc/cxl/cxllib.c | 7 +++++++
drivers/misc/cxl/file.c | 12 ++++++++++--
3 files changed, 27 insertions(+), 4 deletions(-)
diff --git a/drivers/misc/cxl/api.c b/drivers/misc/cxl/api.c
index 1a138c83f877..d3f3fdede755 100644
--- a/drivers/misc/cxl/api.c
+++ b/drivers/misc/cxl/api.c
@@ -332,8 +332,17 @@ int cxl_start_context(struct cxl_context *ctx, u64 wed,
cxl_context_mm_count_get(ctx);
/* decrement the use count */
- if (ctx->mm)
+ if (ctx->mm) {
mmput(ctx->mm);
+#ifdef CONFIG_PPC_BOOK3S_64
+ mm_context_set_global_tlbi(&ctx->mm->context);
+ /*
+ * Barrier guarantees that the device will
+ * receive all TLBIs from that point on
+ */
+ wmb();
+#endif
+ }
}
cxl_ctx_get();
@@ -347,7 +356,6 @@ int cxl_start_context(struct cxl_context *ctx, u64 wed,
cxl_context_mm_count_put(ctx);
goto out;
}
-
ctx->status = STARTED;
out:
mutex_unlock(&ctx->status_mutex);
diff --git a/drivers/misc/cxl/cxllib.c b/drivers/misc/cxl/cxllib.c
index 5dba23ca2e5f..00b8125752d9 100644
--- a/drivers/misc/cxl/cxllib.c
+++ b/drivers/misc/cxl/cxllib.c
@@ -198,6 +198,13 @@ int cxllib_get_PE_attributes(struct task_struct *task,
* as XSL uses the memory context
*/
attr->pid = mm->context.id;
+#ifdef CONFIG_PPC_BOOK3S_64
+ mm_context_set_global_tlbi(&mm->context);
+ /*
+ * barrier guarantees that XSL receives all invalidations
+ */
+ wmb();
+#endif
mmput(mm);
} else {
attr->pid = 0;
diff --git a/drivers/misc/cxl/file.c b/drivers/misc/cxl/file.c
index 0761271d68c5..efdf9483275c 100644
--- a/drivers/misc/cxl/file.c
+++ b/drivers/misc/cxl/file.c
@@ -222,8 +222,17 @@ static long afu_ioctl_start_work(struct cxl_context *ctx,
cxl_context_mm_count_get(ctx);
/* decrement the use count */
- if (ctx->mm)
+ if (ctx->mm) {
mmput(ctx->mm);
+#ifdef CONFIG_PPC_BOOK3S_64
+ mm_context_set_global_tlbi(&ctx->mm->context);
+ /*
+ * Barrier guarantees that the device will receive all
+ * TLBIs from that point on
+ */
+ wmb();
+#endif
+ }
trace_cxl_attach(ctx, work.work_element_descriptor, work.num_interrupts, amr);
@@ -236,7 +245,6 @@ static long afu_ioctl_start_work(struct cxl_context *ctx,
cxl_context_mm_count_put(ctx);
goto out;
}
-
ctx->status = STARTED;
rc = 0;
out:
--
2.11.0
next prev parent reply other threads:[~2017-08-02 20:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-02 20:29 [PATCH v3 0/3] powerpc/mm: Mark memory contexts requiring global TLBIs Frederic Barrat
2017-08-02 20:29 ` [PATCH v3 1/3] powerpc/mm: Add marker for contexts requiring global TLB invalidations Frederic Barrat
2017-08-03 7:16 ` Balbir Singh
2017-08-22 3:11 ` Alistair Popple
2017-08-02 20:29 ` Frederic Barrat [this message]
2017-08-03 7:22 ` [PATCH v3 2/3] cxl: Mark context requiring global TLBIs Balbir Singh
2017-08-22 3:09 ` Alistair Popple
2017-08-02 20:29 ` [PATCH v3 3/3] cxl: Add memory barrier to guarantee TLBI scope Frederic Barrat
2017-08-30 13:29 ` [PATCH v3 0/3] powerpc/mm: Mark memory contexts requiring global TLBIs Frederic Barrat
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170802202930.5616-3-fbarrat@linux.vnet.ibm.com \
--to=fbarrat@linux.vnet.ibm.com \
--cc=alistair@popple.id.au \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=bsingharora@gmail.com \
--cc=clombard@linux.vnet.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=vaibhav@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).