]> www.infradead.org Git - users/hch/misc.git/commitdiff
powerpc/pseries: Enable hvpipe with ibm,set-system-parameter RTAS
authorHaren Myneni <haren@linux.ibm.com>
Tue, 9 Sep 2025 08:44:00 +0000 (01:44 -0700)
committerMadhavan Srinivasan <maddy@linux.ibm.com>
Mon, 15 Sep 2025 08:08:40 +0000 (13:38 +0530)
The partition uses “Hypervisor Pipe OS Enablement Notification”
system parameter token (value = 64) to enable / disable hvpipe in
the hypervisor. Once hvpipe is enabled, the hypervisor notifies
OS if the payload is pending for that partition from any source.
This system parameter token takes 1 byte length of data with
1 = Enable and 0 = Disable.

Enable hvpipe in the hypervisor with ibm,set-system-parameter
RTAS after registering hvpipe event source interrupt.

Signed-off-by: Haren Myneni <haren@linux.ibm.com>
Tested-by: Shashank MS <shashank.gowda@in.ibm.com>
Reviewed-by: Mahesh Salgaonkar <mahesh@linux.ibm.com>
Reviewed-by: Tyrel Datwyler <tyreld@linux.ibm.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20250909084402.1488456-9-haren@linux.ibm.com
arch/powerpc/include/asm/papr-sysparm.h
arch/powerpc/platforms/pseries/papr-hvpipe.c

index c3cd5b131033eb3ef5c8fc1e99f0a8da0b78157a..a3b5a0d05db6fced4ea4e4b8ededb5ca8e0d2093 100644 (file)
@@ -21,6 +21,7 @@ typedef struct {
 #define PAPR_SYSPARM_COOP_MEM_OVERCOMMIT_ATTRS     mk_papr_sysparm(44)
 #define PAPR_SYSPARM_TLB_BLOCK_INVALIDATE_ATTRS    mk_papr_sysparm(50)
 #define PAPR_SYSPARM_LPAR_NAME                     mk_papr_sysparm(55)
+#define PAPR_SYSPARM_HVPIPE_ENABLE                 mk_papr_sysparm(64)
 
 /**
  * struct papr_sysparm_buf - RTAS work area layout for system parameter functions.
index eb312594b1f02ba5860e2570ae0aac1478f1b3c9..65368dbb134b6828ff43a316ebbd825327d8a72b 100644 (file)
@@ -15,6 +15,7 @@
 #include <asm/machdep.h>
 #include <asm/rtas.h>
 #include <asm/rtas-work-area.h>
+#include <asm/papr-sysparm.h>
 #include <uapi/asm/papr-hvpipe.h>
 #include "pseries.h"
 #include "papr-hvpipe.h"
@@ -648,6 +649,32 @@ static irqreturn_t hvpipe_event_interrupt(int irq, void *dev_id)
        return IRQ_HANDLED;
 }
 
+/*
+ * Enable hvpipe by system parameter set with parameter
+ * token = 64 and with 1 byte buffer data:
+ * 0 = hvpipe not in use/disable
+ * 1 = hvpipe in use/enable
+ */
+static int set_hvpipe_sys_param(u8 val)
+{
+       struct papr_sysparm_buf *buf;
+       int ret;
+
+       buf = papr_sysparm_buf_alloc();
+       if (!buf)
+               return -ENOMEM;
+
+       buf->len = cpu_to_be16(1);
+       buf->val[0] = val;
+       ret = papr_sysparm_set(PAPR_SYSPARM_HVPIPE_ENABLE, buf);
+       if (ret)
+               pr_err("Can not enable hvpipe %d\n", ret);
+
+       papr_sysparm_buf_free(buf);
+
+       return ret;
+}
+
 static int __init enable_hvpipe_IRQ(void)
 {
        struct device_node *np;
@@ -705,8 +732,11 @@ static int __init papr_hvpipe_init(void)
        }
 
        ret = enable_hvpipe_IRQ();
-       if (!ret)
-               ret = misc_register(&papr_hvpipe_dev);
+       if (!ret) {
+               ret = set_hvpipe_sys_param(1);
+               if (!ret)
+                       ret = misc_register(&papr_hvpipe_dev);
+       }
 
        if (!ret) {
                pr_info("hvpipe feature is enabled\n");