diff mbox

[V3,1/3] opal-msg: Add support to increase async completions and msg_free_list

Message ID 1498454253-5383-2-git-send-email-shilpa.bhat@linux.vnet.ibm.com
State Superseded
Headers show

Commit Message

Shilpasri G Bhat June 26, 2017, 5:17 a.m. UTC
Add support to increase the maximum async completions passed to kernel
and also add helpers to increase the pre-allocation of free buffers in
msg_free_list.

Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>
---
 core/init.c        |  2 ++
 core/opal-msg.c    | 22 ++++++++++++++++++++--
 core/opal.c        |  1 -
 include/opal-msg.h |  3 +++
 4 files changed, 25 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/core/init.c b/core/init.c
index b5f4f3d..3eb25d8 100644
--- a/core/init.c
+++ b/core/init.c
@@ -1044,6 +1044,8 @@  void __noreturn __nomcount main_cpu_entry(const void *fdt)
 
 	prd_register_reserved_memory();
 
+	add_dt_max_async_completions();
+
 	load_and_boot_kernel(false);
 }
 
diff --git a/core/opal-msg.c b/core/opal-msg.c
index 1971467..0ac891d 100644
--- a/core/opal-msg.c
+++ b/core/opal-msg.c
@@ -19,9 +19,12 @@ 
 #include <opal-msg.h>
 #include <opal-api.h>
 #include <lock.h>
+#include <device.h>
 
 #define OPAL_MAX_MSGS		(OPAL_MSG_TYPE_MAX + OPAL_MAX_ASYNC_COMP - 1)
 
+static int max_async_comp;
+
 struct opal_msg_entry {
 	struct list_node link;
 	void (*consumed)(void *data);
@@ -149,12 +152,12 @@  static int64_t opal_check_completion(uint64_t *buffer, uint64_t size,
 }
 opal_call(OPAL_CHECK_ASYNC_COMPLETION, opal_check_completion, 3);
 
-void opal_init_msg(void)
+void alloc_opal_msg_list(int num)
 {
 	struct opal_msg_entry *entry;
 	int i;
 
-	for (i = 0; i < OPAL_MAX_MSGS; i++, entry++) {
+	for (i = 0; i < num; i++, entry++) {
                 entry = zalloc(sizeof(*entry));
                 if (!entry)
                         goto err;
@@ -170,3 +173,18 @@  err:
         }
 }
 
+void add_dt_max_async_completions(void)
+{
+	dt_add_property_cells(opal_node, "opal-msg-async-num", max_async_comp);
+}
+
+void update_max_async_completions(int num)
+{
+	max_async_comp += num;
+}
+
+void opal_init_msg(void)
+{
+	max_async_comp = OPAL_MAX_ASYNC_COMP;
+	alloc_opal_msg_list(OPAL_MAX_MSGS);
+}
diff --git a/core/opal.c b/core/opal.c
index 14357cc..a48c9a7 100644
--- a/core/opal.c
+++ b/core/opal.c
@@ -201,7 +201,6 @@  void add_opal_node(void)
 	else
 		dt_add_property_strings(opal_node, "compatible", "ibm,opal-v3");
 
-	dt_add_property_cells(opal_node, "opal-msg-async-num", OPAL_MAX_ASYNC_COMP);
 	dt_add_property_cells(opal_node, "opal-msg-size", sizeof(struct opal_msg));
 	dt_add_property_u64(opal_node, "opal-base-address", base);
 	dt_add_property_u64(opal_node, "opal-entry-address", entry);
diff --git a/include/opal-msg.h b/include/opal-msg.h
index a75bc4e..982026e 100644
--- a/include/opal-msg.h
+++ b/include/opal-msg.h
@@ -37,5 +37,8 @@  int _opal_queue_msg(enum opal_msg_type msg_type, void *data,
 			(u64[]) {__VA_ARGS__});
 
 void opal_init_msg(void);
+void alloc_opal_msg_list(int num);
+void update_max_async_completions(int num);
+void add_dt_max_async_completions(void);
 
 #endif /* __OPALMSG_H */