linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Uma Krishnan <ukrishn@linux.vnet.ibm.com>
To: linux-scsi@vger.kernel.org,
	James Bottomley <jejb@linux.vnet.ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	"Matthew R. Ochs" <mrochs@linux.vnet.ibm.com>,
	"Manoj N. Kumar" <manoj@linux.vnet.ibm.com>
Cc: linuxppc-dev@lists.ozlabs.org,
	Andrew Donnellan <andrew.donnellan@au1.ibm.com>,
	Frederic Barrat <fbarrat@linux.vnet.ibm.com>,
	Christophe Lombard <clombard@linux.vnet.ibm.com>
Subject: [PATCH v2 32/38] cxlflash: Setup LISNs for user contexts
Date: Mon, 26 Feb 2018 16:24:20 -0600	[thread overview]
Message-ID: <1519683860-17908-1-git-send-email-ukrishn@linux.vnet.ibm.com> (raw)
In-Reply-To: <1519683513-16731-1-git-send-email-ukrishn@linux.vnet.ibm.com>

The SISLite specification has been updated for OCXL to support
communicating data to generate AFU interrupts to the AFU. This includes
a new capability bit that is advertised for OCXL AFUs and new registers
to hold the object handle and translation PASID of each interrupt. For
Power, the object handle is the mapped trigger page. Note that because
these mappings are kernel only, the PASID of a kernel context must be
used to satisfy the translation.

Signed-off-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com>
Acked-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
---
 drivers/scsi/cxlflash/common.h    |  5 +++++
 drivers/scsi/cxlflash/sislite.h   |  5 +++++
 drivers/scsi/cxlflash/superpipe.c | 14 ++++++++++++++
 3 files changed, 24 insertions(+)

diff --git a/drivers/scsi/cxlflash/common.h b/drivers/scsi/cxlflash/common.h
index d7fccea..b69fd32 100644
--- a/drivers/scsi/cxlflash/common.h
+++ b/drivers/scsi/cxlflash/common.h
@@ -273,6 +273,11 @@ static inline bool afu_has_cap(struct afu *afu, u64 cap)
 	return afu_cap & cap;
 }
 
+static inline bool afu_is_ocxl_lisn(struct afu *afu)
+{
+	return afu_has_cap(afu, SISL_INTVER_CAP_OCXL_LISN);
+}
+
 static inline bool afu_is_afu_debug(struct afu *afu)
 {
 	return afu_has_cap(afu, SISL_INTVER_CAP_AFU_DEBUG);
diff --git a/drivers/scsi/cxlflash/sislite.h b/drivers/scsi/cxlflash/sislite.h
index d8940f1..c08b9d3 100644
--- a/drivers/scsi/cxlflash/sislite.h
+++ b/drivers/scsi/cxlflash/sislite.h
@@ -310,6 +310,10 @@ struct sisl_ctrl_map {
 #define SISL_CTX_CAP_WRITE_CMD         0x0000000000000002ULL /* afu_rc 0x21 */
 #define SISL_CTX_CAP_READ_CMD          0x0000000000000001ULL /* afu_rc 0x21 */
 	__be64 mbox_r;
+	__be64 lisn_pasid[2];
+	/* pasid _a arg must be ULL */
+#define SISL_LISN_PASID(_a, _b)	(((_a) << 32) | (_b))
+	__be64 lisn_ea[3];
 };
 
 /* single copy global regs */
@@ -416,6 +420,7 @@ struct sisl_global_regs {
 #define SISL_INTVER_CAP_RESERVED_CMD_MODE_B	0x100000000000ULL
 #define SISL_INTVER_CAP_LUN_PROVISION		0x080000000000ULL
 #define SISL_INTVER_CAP_AFU_DEBUG		0x040000000000ULL
+#define SISL_INTVER_CAP_OCXL_LISN		0x020000000000ULL
 };
 
 #define CXLFLASH_NUM_FC_PORTS_PER_BANK	2	/* fixed # of ports per bank */
diff --git a/drivers/scsi/cxlflash/superpipe.c b/drivers/scsi/cxlflash/superpipe.c
index 2fe79df..04a3bf9 100644
--- a/drivers/scsi/cxlflash/superpipe.c
+++ b/drivers/scsi/cxlflash/superpipe.c
@@ -269,6 +269,7 @@ static int afu_attach(struct cxlflash_cfg *cfg, struct ctx_info *ctxi)
 	int rc = 0;
 	struct hwq *hwq = get_hwq(afu, PRIMARY_HWQ);
 	u64 val;
+	int i;
 
 	/* Unlock cap and restrict user to read/write cmds in translated mode */
 	readq_be(&ctrl_map->mbox_r);
@@ -282,6 +283,19 @@ static int afu_attach(struct cxlflash_cfg *cfg, struct ctx_info *ctxi)
 		goto out;
 	}
 
+	if (afu_is_ocxl_lisn(afu)) {
+		/* Set up the LISN effective address for each interrupt */
+		for (i = 0; i < ctxi->irqs; i++) {
+			val = cfg->ops->get_irq_objhndl(ctxi->ctx, i);
+			writeq_be(val, &ctrl_map->lisn_ea[i]);
+		}
+
+		/* Use primary HWQ PASID as identifier for all interrupts */
+		val = hwq->ctx_hndl;
+		writeq_be(SISL_LISN_PASID(val, val), &ctrl_map->lisn_pasid[0]);
+		writeq_be(SISL_LISN_PASID(0UL, val), &ctrl_map->lisn_pasid[1]);
+	}
+
 	/* Set up MMIO registers pointing to the RHT */
 	writeq_be((u64)ctxi->rht_start, &ctrl_map->rht_start);
 	val = SISL_RHT_CNT_ID((u64)MAX_RHT_PER_CONTEXT, (u64)(hwq->ctx_hndl));
-- 
2.1.0

  parent reply	other threads:[~2018-02-26 22:24 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-26 22:18 [PATCH v2 00/38] cxlflash: OCXL transport support Uma Krishnan
2018-02-26 22:19 ` [PATCH v2 01/38] cxlflash: Preserve number of interrupts for master contexts Uma Krishnan
2018-02-26 22:19 ` [PATCH v2 02/38] cxlflash: Avoid clobbering context control register value Uma Krishnan
2018-02-26 22:20 ` [PATCH v2 03/38] cxlflash: Add argument identifier names Uma Krishnan
2018-02-26 22:20 ` [PATCH v2 04/38] cxlflash: Introduce OCXL backend Uma Krishnan
2018-03-07  4:44   ` Andrew Donnellan
2018-02-26 22:20 ` [PATCH v2 05/38] cxlflash: Hardware AFU for OCXL Uma Krishnan
2018-03-07  5:47   ` Andrew Donnellan
2018-02-26 22:20 ` [PATCH v2 06/38] cxlflash: Read host function configuration Uma Krishnan
2018-03-07  6:37   ` Andrew Donnellan
2018-03-22 15:43   ` Frederic Barrat
2018-02-26 22:20 ` [PATCH v2 07/38] cxlflash: Setup function acTag range Uma Krishnan
2018-03-09  3:51   ` Andrew Donnellan
2018-03-22 15:48   ` Frederic Barrat
2018-02-26 22:21 ` [PATCH v2 08/38] cxlflash: Read host AFU configuration Uma Krishnan
2018-03-09  4:10   ` Andrew Donnellan
2018-03-22 15:52   ` Frederic Barrat
2018-03-22 16:08   ` Frederic Barrat
2018-02-26 22:21 ` [PATCH v2 09/38] cxlflash: Setup AFU acTag range Uma Krishnan
2018-03-09  4:19   ` Andrew Donnellan
2018-03-22 16:12   ` Frederic Barrat
2018-02-26 22:21 ` [PATCH v2 10/38] cxlflash: Setup AFU PASID Uma Krishnan
2018-03-09  4:29   ` Andrew Donnellan
2018-03-22 16:23   ` Frederic Barrat
2018-02-26 22:21 ` [PATCH v2 11/38] cxlflash: Adapter context support for OCXL Uma Krishnan
2018-03-22 16:32   ` Frederic Barrat
2018-02-26 22:21 ` [PATCH v2 12/38] cxlflash: Use IDR to manage adapter contexts Uma Krishnan
2018-03-22 16:40   ` Frederic Barrat
2018-03-22 22:26     ` Uma Krishnan
2018-02-26 22:21 ` [PATCH v2 13/38] cxlflash: Support adapter file descriptors for OCXL Uma Krishnan
2018-03-22 17:12   ` Frederic Barrat
2018-03-23 17:45     ` Uma Krishnan
2018-02-26 22:22 ` [PATCH v2 14/38] cxlflash: Support adapter context discovery Uma Krishnan
2018-02-26 22:22 ` [PATCH v2 15/38] cxlflash: Support image reload policy modification Uma Krishnan
2018-02-26 22:22 ` [PATCH v2 16/38] cxlflash: MMIO map the AFU Uma Krishnan
2018-03-22 17:19   ` Frederic Barrat
2018-02-26 22:22 ` [PATCH v2 17/38] cxlflash: Support starting an adapter context Uma Krishnan
2018-02-26 22:22 ` [PATCH v2 18/38] cxlflash: Support process specific mappings Uma Krishnan
2018-02-26 22:22 ` [PATCH v2 19/38] cxlflash: Support AFU state toggling Uma Krishnan
2018-03-22 17:26   ` Frederic Barrat
2018-02-26 22:22 ` [PATCH v2 20/38] cxlflash: Support reading adapter VPD data Uma Krishnan
2018-02-26 22:22 ` [PATCH v2 21/38] cxlflash: Setup function OCXL link Uma Krishnan
2018-03-22 17:31   ` Frederic Barrat
2018-02-26 22:23 ` [PATCH v2 22/38] cxlflash: Setup OCXL transaction layer Uma Krishnan
2018-02-26 22:23 ` [PATCH v2 23/38] cxlflash: Support process element lifecycle Uma Krishnan
2018-02-26 22:23 ` [PATCH v2 24/38] cxlflash: Support AFU interrupt management Uma Krishnan
2018-02-26 22:23 ` [PATCH v2 25/38] cxlflash: Support AFU interrupt mapping and registration Uma Krishnan
2018-02-26 22:23 ` [PATCH v2 26/38] cxlflash: Support starting user contexts Uma Krishnan
2018-02-26 22:23 ` [PATCH v2 27/38] cxlflash: Support adapter context polling Uma Krishnan
2018-02-26 22:23 ` [PATCH v2 28/38] cxlflash: Support adapter context reading Uma Krishnan
2018-02-26 22:23 ` [PATCH v2 29/38] cxlflash: Support adapter context mmap and release Uma Krishnan
2018-02-26 22:24 ` [PATCH v2 30/38] cxlflash: Support file descriptor mapping Uma Krishnan
2018-02-26 22:24 ` [PATCH v2 31/38] cxlflash: Introduce object handle fop Uma Krishnan
2018-02-26 22:24 ` Uma Krishnan [this message]
2018-02-26 22:24 ` [PATCH v2 33/38] cxlflash: Setup LISNs for master contexts Uma Krishnan
2018-02-26 22:24 ` [PATCH v2 34/38] cxlflash: Update synchronous interrupt status bits Uma Krishnan
2018-02-26 22:24 ` [PATCH v2 35/38] cxlflash: Introduce OCXL context state machine Uma Krishnan
2018-02-26 22:24 ` [PATCH v2 36/38] cxlflash: Register for translation errors Uma Krishnan
2018-02-26 22:24 ` [PATCH v2 37/38] cxlflash: Support AFU reset Uma Krishnan
2018-02-26 22:25 ` [PATCH v2 38/38] cxlflash: Enable OCXL operations Uma Krishnan
2018-03-06 18:01 ` [PATCH v2 00/38] cxlflash: OCXL transport support Martin K. Petersen
2018-03-09  5:08   ` Andrew Donnellan

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=1519683860-17908-1-git-send-email-ukrishn@linux.vnet.ibm.com \
    --to=ukrishn@linux.vnet.ibm.com \
    --cc=andrew.donnellan@au1.ibm.com \
    --cc=clombard@linux.vnet.ibm.com \
    --cc=fbarrat@linux.vnet.ibm.com \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=manoj@linux.vnet.ibm.com \
    --cc=martin.petersen@oracle.com \
    --cc=mrochs@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).