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 3/4] cxl: Abort background operation in case of timeout
Date: Wed, 16 Oct 2024 05:00:00 +0000	[thread overview]
Message-ID: <00a0aa82ae12450a8c690e11440c4101@micron.com> (raw)
In-Reply-To: <20241015205633.127333-4-ravis.opensrc@micron.com>

Adding support for aborting timed out background operations

CXL r3.1 8.2.9.1.5 Request Abort Background Operation.

If the status of a mailbox command is identified as timedout,
an abort background operation request is sent to the device.

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/cxlmem.h |  1 +
 drivers/cxl/pci.c    | 11 +++++++++++
 2 files changed, 12 insertions(+)

diff --git a/drivers/cxl/cxlmem.h b/drivers/cxl/cxlmem.h
index d8c0894797ac..808fb8712145 100644
--- a/drivers/cxl/cxlmem.h
+++ b/drivers/cxl/cxlmem.h
@@ -516,6 +516,7 @@ to_cxl_memdev_state(struct cxl_dev_state *cxlds)
 enum cxl_opcode {
         CXL_MBOX_OP_INVALID             = 0x0000,
         CXL_MBOX_OP_RAW                 = CXL_MBOX_OP_INVALID,
+       CXL_MBOX_OP_REQ_ABRT_BACKGROUND_OPERATION    = 0x0005,
         CXL_MBOX_OP_GET_EVENT_RECORD    = 0x0100,
         CXL_MBOX_OP_CLEAR_EVENT_RECORD  = 0x0101,
         CXL_MBOX_OP_GET_EVT_INT_POLICY  = 0x0102,
diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c
index d5d6142f6aa3..95c1f329bca2 100644
--- a/drivers/cxl/pci.c
+++ b/drivers/cxl/pci.c
@@ -394,6 +394,17 @@ static int cxl_pci_mbox_send(struct cxl_mailbox *cxl_mbox,
 
         mutex_lock_io(&cxl_mbox->mbox_mutex);
         rc = __cxl_pci_mbox_send_cmd(cxl_mbox, cmd);
+       if (rc == -ETIMEDOUT &&
+               cmd->return_code == CXL_MBOX_CMD_RC_BACKGROUND) {
+               struct cxl_mbox_cmd abort_cmd = {
+                       .opcode = CXL_MBOX_OP_REQ_ABRT_BACKGROUND_OPERATION
+               };
+
+               rc = __cxl_pci_mbox_send_cmd(cxl_mbox, &abort_cmd);
+               if (!rc)
+                       rc = -ECANCELED;
+       }
+
         mutex_unlock(&cxl_mbox->mbox_mutex);
 
         return rc;
-- 
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-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   ` [RFC PATCH v2 " Ravis OpenSrc
2024-10-17 15:27     ` Jonathan Cameron
     [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   ` Ravis OpenSrc [this message]
2024-10-17 15:36     ` [RFC PATCH v2 " Jonathan Cameron
2024-10-18  6:39       ` Ravis OpenSrc
2024-10-18 16:14         ` 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=00a0aa82ae12450a8c690e11440c4101@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