[Skiboot] [PATCH 1/2] SBE: Add passthrough command support

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Wed Apr 19 14:33:36 AEST 2017


SBE sends passthrough command. We have to capture this interrupt and
send event HBRT via opal-prd.

This patch enables OPAL to capture interrupt and send event to kernel.
Next patch will add opal-prd (user space) support.

Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
Reviewed-by: Mahesh Salgaonkar <mahesh at linux.vnet.ibm.com>
---
This patch works on top of my SBE patchset [1].
[1] https://lists.ozlabs.org/pipermail/skiboot/2017-April/006984.html

-Vasant

 hw/prd.c           | 13 +++++++++++++
 hw/sbe-p9.c        |  5 +++++
 include/opal-api.h |  4 ++++
 include/sbe-p9.h   |  1 +
 include/skiboot.h  |  1 +
 5 files changed, 24 insertions(+)

diff --git a/hw/prd.c b/hw/prd.c
index a44faa9..e19074e 100644
--- a/hw/prd.c
+++ b/hw/prd.c
@@ -27,6 +27,7 @@ enum events {
 	EVENT_ATTN	= 1 << 0,
 	EVENT_OCC_ERROR	= 1 << 1,
 	EVENT_OCC_RESET	= 1 << 2,
+	EVENT_SBE_PASSTHROUGH = 1 << 3,
 };
 
 static uint8_t events[MAX_CHIPS];
@@ -112,6 +113,10 @@ static void prd_msg_consumed(void *data)
 		proc = msg->occ_reset.chip;
 		event = EVENT_OCC_RESET;
 		break;
+	case OPAL_PRD_MSG_TYPE_SBE_PASSTHROUGH:
+		proc = msg->sbe_passthrough.chip;
+		event = EVENT_SBE_PASSTHROUGH;
+		break;
 	default:
 		prlog(PR_ERR, "PRD: invalid msg consumed, type: 0x%x\n",
 				msg->hdr.type);
@@ -183,6 +188,9 @@ static void send_next_pending_event(void)
 		prd_msg.hdr.type = OPAL_PRD_MSG_TYPE_OCC_RESET;
 		prd_msg.occ_reset.chip = proc;
 		occ_msg_queue_occ_reset();
+	} else if (event & EVENT_SBE_PASSTHROUGH) {
+		prd_msg.hdr.type = OPAL_PRD_MSG_TYPE_SBE_PASSTHROUGH;
+		prd_msg.sbe_passthrough.chip = proc;
 	}
 
 	queue_prd_msg(&prd_msg, prd_msg_consumed);
@@ -263,6 +271,11 @@ void prd_occ_reset(uint32_t proc)
 	prd_event(proc, EVENT_OCC_RESET);
 }
 
+void prd_sbe_passthrough(uint32_t proc)
+{
+	prd_event(proc, EVENT_SBE_PASSTHROUGH);
+}
+
 /* incoming message handlers */
 static int prd_msg_handle_attn_ack(struct opal_prd_msg *msg)
 {
diff --git a/hw/sbe-p9.c b/hw/sbe-p9.c
index 527e8ca..31bc885 100644
--- a/hw/sbe-p9.c
+++ b/hw/sbe-p9.c
@@ -546,6 +546,11 @@ void sbe_interrupt(uint32_t chip_id)
 		goto clr_interrupt;
 	}
 
+	/* SBE passtrhough command, call prd handler */
+	if (data & SBE_HOST_PASSTHROUGH) {
+		prd_sbe_passthrough(sbe->chip_id);
+	}
+
 	/* Handle SBE response */
 	if (data & SBE_HOST_RESPONSE_WAITING) {
 		lock(&sbe->lock);
diff --git a/include/opal-api.h b/include/opal-api.h
index 7966200..80915ac 100644
--- a/include/opal-api.h
+++ b/include/opal-api.h
@@ -962,6 +962,7 @@ enum opal_prd_msg_type {
 	OPAL_PRD_MSG_TYPE_OCC_ERROR,	/* HBRT <-- OPAL */
 	OPAL_PRD_MSG_TYPE_OCC_RESET,	/* HBRT <-- OPAL */
 	OPAL_PRD_MSG_TYPE_OCC_RESET_NOTIFY, /* HBRT --> OPAL */
+	OPAL_PRD_MSG_TYPE_SBE_PASSTHROUGH, /* HBRT <-- OPAL */
 };
 
 struct opal_prd_msg_header {
@@ -993,6 +994,9 @@ struct opal_prd_msg {
 		struct {
 			__be64	chip;
 		} occ_reset;
+		struct {
+			__be64	chip;
+		} sbe_passthrough;
 	};
 };
 
diff --git a/include/sbe-p9.h b/include/sbe-p9.h
index 3017003..2bc28f4 100644
--- a/include/sbe-p9.h
+++ b/include/sbe-p9.h
@@ -92,6 +92,7 @@
 #define SBE_HOST_MSG_READ		PPC_BIT(1)
 #define SBE_HOST_STOP15_EXIT		PPC_BIT(2)
 #define SBE_HOST_RESET			PPC_BIT(3)
+#define SBE_HOST_PASSTHROUGH		PPC_BIT(4)
 #define SBE_HOST_TIMER_EXPIRY		PPC_BIT(14)
 #define SBE_HOST_RESPONSE_CLEAR		0x00
 
diff --git a/include/skiboot.h b/include/skiboot.h
index eb05951..f966549 100644
--- a/include/skiboot.h
+++ b/include/skiboot.h
@@ -275,6 +275,7 @@ extern void occ_pnor_set_owner(enum pnor_owner owner);
 extern void prd_psi_interrupt(uint32_t proc);
 extern void prd_tmgt_interrupt(uint32_t proc);
 extern void prd_occ_reset(uint32_t proc);
+extern void prd_sbe_passthrough(uint32_t proc);
 extern void prd_init(void);
 extern void prd_register_reserved_memory(void);
 
-- 
2.9.3



More information about the Skiboot mailing list