public inbox for linux-cxl@vger.kernel.org
 help / color / mirror / Atom feed
From: Ravis OpenSrc <Ravis.OpenSrc@micron.com>
To: "linux-cxl@vger.kernel.org" <linux-cxl@vger.kernel.org>,
	"dan.j.williams@intel.com" <dan.j.williams@intel.com>,
	"dave.jiang@intel.com" <dave.jiang@intel.com>,
	"jonathan.cameron@huawei.com" <jonathan.cameron@huawei.com>
Cc: Srinivasulu Opensrc <sthanneeru.opensrc@micron.com>,
	"john@jagalactic.com" <john@jagalactic.com>,
	Ajay Joshi <ajayjoshi@micron.com>
Subject: [RFC PATCH v2 1/4] cxl: Enable mailbox ops with background only if request abort operation is supported.
Date: Wed, 16 Oct 2024 04:59:56 +0000	[thread overview]
Message-ID: <6e6cc093f70442e792c05e779393442a@micron.com> (raw)
In-Reply-To: <20241015205633.127333-2-ravis.opensrc@micron.com>

Enabling mailbox commands only if background operation and
request abort cancellation are both supported.

This check is to allow user space commands to initiate
background commands responsibly while complying with any
default background timeout implemented in kernel.

Link:
https://lore.kernel.org/linux-cxl/66035c2e8ba17_770232948b@dwillia2-xfh.jf.intel.com.notmuch/

Suggested-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Ajay Joshi <ajay.opensrc@micron.com>
Signed-off-by: Ravi Shankar <ravis.opensrc@micron.com>
---
 drivers/cxl/core/mbox.c | 12 ++++++++++--
 drivers/cxl/cxlmem.h    | 16 ++++++++++++++++
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
index 5175138c4fb7..8c0144913b9e 100644
--- a/drivers/cxl/core/mbox.c
+++ b/drivers/cxl/core/mbox.c
@@ -733,12 +733,20 @@ static void cxl_walk_cel(struct cxl_memdev_state *mds, size_t size, u8 *cel)
 
         for (i = 0; i < cel_entries; i++) {
                 u16 opcode = le16_to_cpu(cel_entry[i].opcode);
+               u16 effect = le16_to_cpu(cel_entry[i].effect);
                 struct cxl_mem_command *cmd = cxl_mem_find_command(opcode);
                 int enabled = 0;
 
                 if (cmd) {
-                       set_bit(cmd->info.id, mds->enabled_cmds);
-                       enabled++;
+                       /*
+                        * For background operation commands, enable only if
+                        * Request abort background operation is supported.
+                        */
+                       if (!(effect & CXL_CEL_FLAG_BACKGROUND_OPERATION) ||
+                          (effect & CXL_CEL_FLAG_REQ_ABORT_BACKGROUND_SUPPORTED)) {
+                               set_bit(cmd->info.id, mds->enabled_cmds);
+                               enabled++;
+                       }
                 }
 
                 if (cxl_is_poison_command(opcode)) {
diff --git a/drivers/cxl/cxlmem.h b/drivers/cxl/cxlmem.h
index 2a25d1957ddb..d8c0894797ac 100644
--- a/drivers/cxl/cxlmem.h
+++ b/drivers/cxl/cxlmem.h
@@ -579,6 +579,22 @@ struct cxl_cel_entry {
         __le16 effect;
 } __packed;
 
+/*
+ * CEL Entry Effects
+ * CXL rev 3.1 Section 8.2.9.5.2.1; Table 8-75
+ */
+#define        CXL_CEL_FLAG_CFG_CHANGE_AFTER_RESET BIT(0)
+#define        CXL_CEL_FLAG_CFG_CHANGE_IMMEDIATE BIT(1)
+#define        CXL_CEL_FLAG_DATA_CHANGE_IMMEDIATE BIT(2)
+#define        CXL_CEL_FLAG_POLICY_CHANGE_IMMEDIATE BIT(3)
+#define        CXL_CEL_FLAG_LOG_CHANGE_IMMEDIATE BIT(4)
+#define        CXL_CEL_FLAG_SECURITY_CHANGE BIT(5)
+#define        CXL_CEL_FLAG_BACKGROUND_OPERATION BIT(6)
+#define        CXL_CEL_FLAG_SECONDARY_MAILBOX_SUPPORTED BIT(7)
+#define        CXL_CEL_FLAG_REQ_ABORT_BACKGROUND_SUPPORTED BIT(8)
+#define        CXL_CEL_FLAG_CFG_CHANGE_AFTER_CONV_RESET BIT(10)
+#define        CXL_CEL_FLAG_CFG_CHANGE_AFTER_CXL_RESET BIT(11)
+
 struct cxl_mbox_get_log {
         uuid_t uuid;
         __le32 offset;
-- 
2.43.0

    

  parent reply	other threads:[~2024-10-16  5:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20241015205633.127333-1-ravis.opensrc@micron.com>
2024-10-16  4:31 ` [RFC 0/4] cxl: Support for mailbox background abort operation Ravis OpenSrc
     [not found] ` <20241015205633.127333-3-ravis.opensrc@micron.com>
2024-10-16  4:32   ` [RFC PATCH 2/4] cxl: Add default timeout for bg mailbox commands Ravis OpenSrc
2024-10-16  4:59   ` [RFC PATCH v2 " Ravis OpenSrc
2024-10-17 15:32     ` Jonathan Cameron
2024-10-17 17:25       ` [EXT] " Srinivasulu Opensrc
     [not found] ` <20241015205633.127333-4-ravis.opensrc@micron.com>
2024-10-16  4:32   ` [RFC PATCH 3/4] cxl: Abort background operation in case of timeout Ravis OpenSrc
2024-10-16  5:00   ` [RFC PATCH v2 " Ravis OpenSrc
2024-10-17 15:36     ` Jonathan Cameron
2024-10-18  6:39       ` Ravis OpenSrc
2024-10-18 16:14         ` Jonathan Cameron
     [not found] ` <20241015205633.127333-5-ravis.opensrc@micron.com>
2024-10-16  4:32   ` [RFC PATCH 4/4] cxl/mbox: Add Populate Log support Ravis OpenSrc
2024-10-16  5:00     ` [RFC PATCH v2 " Ravis OpenSrc
2024-10-17 15:37       ` Jonathan Cameron
2024-10-16  4:59 ` [RFC v2 0/4] cxl: Support for mailbox background abort operation Ravis OpenSrc
     [not found] ` <20241015205633.127333-2-ravis.opensrc@micron.com>
2024-10-16  4:31   ` [RFC PATCH 1/4] cxl: Enable mailbox ops with background only if request abort operation is supported Ravis OpenSrc
2024-10-16  4:59   ` Ravis OpenSrc [this message]
2024-10-17 15:27     ` [RFC PATCH v2 " Jonathan Cameron

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=6e6cc093f70442e792c05e779393442a@micron.com \
    --to=ravis.opensrc@micron.com \
    --cc=ajayjoshi@micron.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=john@jagalactic.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=sthanneeru.opensrc@micron.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