* [PATCH 12/14] powerpc/VAS: Return credits after handling fault
@ 2019-11-27 1:13 ` Haren Myneni
0 siblings, 0 replies; 2+ messages in thread
From: Haren Myneni @ 2019-11-27 1:13 UTC (permalink / raw)
To: linuxppc-dev, devicetree, mpe, npiggin, mikey, herbert; +Cc: sukadev, hbabu
NX expects OS to return credit for send window after processing each
fault. Also credit has to be returned even for fault window.
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Haren Myneni <haren@us.ibm.com>
---
arch/powerpc/platforms/powernv/vas-fault.c | 9 +++++++++
arch/powerpc/platforms/powernv/vas-window.c | 17 +++++++++++++++++
arch/powerpc/platforms/powernv/vas.h | 1 +
3 files changed, 27 insertions(+)
diff --git a/arch/powerpc/platforms/powernv/vas-fault.c b/arch/powerpc/platforms/powernv/vas-fault.c
index ad594c8..2a3ee9f 100644
--- a/arch/powerpc/platforms/powernv/vas-fault.c
+++ b/arch/powerpc/platforms/powernv/vas-fault.c
@@ -244,6 +244,10 @@ static void process_fault_crbs(struct vas_instance *vinst)
memset(fifo, 0, CRB_SIZE);
mutex_unlock(&vinst->mutex);
+ /*
+ * Return credit for the fault window.
+ */
+ vas_return_credit(vinst->fault_win, 0);
pr_devel("VAS[%d] fault_fifo %p, fifo %p, fault_crbs %d pending %d\n",
vinst->vas_id, vinst->fault_fifo, fifo,
vinst->fault_crbs,
@@ -270,6 +274,11 @@ static void process_fault_crbs(struct vas_instance *vinst)
}
update_csb(window, crb);
+ /*
+ * Return credit for send window after processing
+ * fault CRB.
+ */
+ vas_return_credit(window, 1);
} while (true);
}
diff --git a/arch/powerpc/platforms/powernv/vas-window.c b/arch/powerpc/platforms/powernv/vas-window.c
index ca208a3..1c0788c 100644
--- a/arch/powerpc/platforms/powernv/vas-window.c
+++ b/arch/powerpc/platforms/powernv/vas-window.c
@@ -1323,6 +1323,23 @@ int vas_win_close(struct vas_window *window)
EXPORT_SYMBOL_GPL(vas_win_close);
/*
+ * Return credit for the given window.
+ */
+void vas_return_credit(struct vas_window *window, bool tx)
+{
+ uint64_t val;
+
+ val = 0ULL;
+ if (tx) { /* send window */
+ val = SET_FIELD(VAS_TX_WCRED, val, 1);
+ write_hvwc_reg(window, VREG(TX_WCRED_ADDER), val);
+ } else {
+ val = SET_FIELD(VAS_LRX_WCRED, val, 1);
+ write_hvwc_reg(window, VREG(LRX_WCRED_ADDER), val);
+ }
+}
+
+/*
* Return a system-wide unique window id for the window @win.
*/
u32 vas_win_id(struct vas_window *win)
diff --git a/arch/powerpc/platforms/powernv/vas.h b/arch/powerpc/platforms/powernv/vas.h
index 75bea1d..b8b90f3 100644
--- a/arch/powerpc/platforms/powernv/vas.h
+++ b/arch/powerpc/platforms/powernv/vas.h
@@ -421,6 +421,7 @@ struct vas_winctx {
extern void vas_wakeup_fault_handler(int virq, void *arg);
extern int vas_setup_fault_handler(struct vas_instance *vinst);
extern void vas_cleanup_fault_handler(struct vas_instance *vinst);
+extern void vas_return_credit(struct vas_window *window, bool tx);
extern struct vas_window *vas_pswid_to_window(struct vas_instance *vinst,
uint32_t pswid);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 12/14] powerpc/VAS: Return credits after handling fault
@ 2019-11-27 1:13 ` Haren Myneni
0 siblings, 0 replies; 2+ messages in thread
From: Haren Myneni @ 2019-11-27 1:13 UTC (permalink / raw)
To: linuxppc-dev, devicetree, mpe, npiggin, mikey, herbert; +Cc: sukadev
NX expects OS to return credit for send window after processing each
fault. Also credit has to be returned even for fault window.
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Haren Myneni <haren@us.ibm.com>
---
arch/powerpc/platforms/powernv/vas-fault.c | 9 +++++++++
arch/powerpc/platforms/powernv/vas-window.c | 17 +++++++++++++++++
arch/powerpc/platforms/powernv/vas.h | 1 +
3 files changed, 27 insertions(+)
diff --git a/arch/powerpc/platforms/powernv/vas-fault.c b/arch/powerpc/platforms/powernv/vas-fault.c
index ad594c8..2a3ee9f 100644
--- a/arch/powerpc/platforms/powernv/vas-fault.c
+++ b/arch/powerpc/platforms/powernv/vas-fault.c
@@ -244,6 +244,10 @@ static void process_fault_crbs(struct vas_instance *vinst)
memset(fifo, 0, CRB_SIZE);
mutex_unlock(&vinst->mutex);
+ /*
+ * Return credit for the fault window.
+ */
+ vas_return_credit(vinst->fault_win, 0);
pr_devel("VAS[%d] fault_fifo %p, fifo %p, fault_crbs %d pending %d\n",
vinst->vas_id, vinst->fault_fifo, fifo,
vinst->fault_crbs,
@@ -270,6 +274,11 @@ static void process_fault_crbs(struct vas_instance *vinst)
}
update_csb(window, crb);
+ /*
+ * Return credit for send window after processing
+ * fault CRB.
+ */
+ vas_return_credit(window, 1);
} while (true);
}
diff --git a/arch/powerpc/platforms/powernv/vas-window.c b/arch/powerpc/platforms/powernv/vas-window.c
index ca208a3..1c0788c 100644
--- a/arch/powerpc/platforms/powernv/vas-window.c
+++ b/arch/powerpc/platforms/powernv/vas-window.c
@@ -1323,6 +1323,23 @@ int vas_win_close(struct vas_window *window)
EXPORT_SYMBOL_GPL(vas_win_close);
/*
+ * Return credit for the given window.
+ */
+void vas_return_credit(struct vas_window *window, bool tx)
+{
+ uint64_t val;
+
+ val = 0ULL;
+ if (tx) { /* send window */
+ val = SET_FIELD(VAS_TX_WCRED, val, 1);
+ write_hvwc_reg(window, VREG(TX_WCRED_ADDER), val);
+ } else {
+ val = SET_FIELD(VAS_LRX_WCRED, val, 1);
+ write_hvwc_reg(window, VREG(LRX_WCRED_ADDER), val);
+ }
+}
+
+/*
* Return a system-wide unique window id for the window @win.
*/
u32 vas_win_id(struct vas_window *win)
diff --git a/arch/powerpc/platforms/powernv/vas.h b/arch/powerpc/platforms/powernv/vas.h
index 75bea1d..b8b90f3 100644
--- a/arch/powerpc/platforms/powernv/vas.h
+++ b/arch/powerpc/platforms/powernv/vas.h
@@ -421,6 +421,7 @@ struct vas_winctx {
extern void vas_wakeup_fault_handler(int virq, void *arg);
extern int vas_setup_fault_handler(struct vas_instance *vinst);
extern void vas_cleanup_fault_handler(struct vas_instance *vinst);
+extern void vas_return_credit(struct vas_window *window, bool tx);
extern struct vas_window *vas_pswid_to_window(struct vas_instance *vinst,
uint32_t pswid);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-11-27 1:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-27 1:13 [PATCH 12/14] powerpc/VAS: Return credits after handling fault Haren Myneni
2019-11-27 1:13 ` Haren Myneni
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.