powerpc/powernv: Add opal calls for opencapi
authorFrederic Barrat <fbarrat@linux.vnet.ibm.com>
Tue, 23 Jan 2018 11:31:38 +0000 (12:31 +0100)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 24 Jan 2018 00:42:56 +0000 (11:42 +1100)
Add opal calls to interact with the NPU:

OPAL_NPU_SPA_SETUP: set the Shared Process Area (SPA)
The SPA is a table containing one entry (Process Element) per memory
context which can be accessed by the opencapi device.

OPAL_NPU_SPA_CLEAR_CACHE: clear the context cache
The NPU keeps a cache of recently accessed memory contexts. When a
Process Element is removed from the SPA, the cache for the link must
be cleared.

OPAL_NPU_TL_SET: configure the Transaction Layer
The Transaction Layer specification defines several templates for
messages to be exchanged on the link. During link setup, the host and
device must negotiate what templates are supported on both sides and
at what rates those messages can be sent.

Signed-off-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
Acked-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/opal-api.h
arch/powerpc/include/asm/opal.h
arch/powerpc/platforms/powernv/opal-wrappers.S

index 233c750..24c73f5 100644 (file)
 #define OPAL_SET_POWER_SHIFT_RATIO             155
 #define OPAL_SENSOR_GROUP_CLEAR                        156
 #define OPAL_PCI_SET_P2P                       157
-#define OPAL_LAST                              157
+#define OPAL_NPU_SPA_SETUP                     159
+#define OPAL_NPU_SPA_CLEAR_CACHE               160
+#define OPAL_NPU_TL_SET                                161
+#define OPAL_LAST                              161
 
 /* Device tree flags */
 
index 0c545f7..12e70fb 100644 (file)
@@ -34,6 +34,12 @@ int64_t opal_npu_init_context(uint64_t phb_id, int pasid, uint64_t msr,
                        uint64_t bdf);
 int64_t opal_npu_map_lpar(uint64_t phb_id, uint64_t bdf, uint64_t lparid,
                        uint64_t lpcr);
+int64_t opal_npu_spa_setup(uint64_t phb_id, uint32_t bdfn,
+                       uint64_t addr, uint64_t PE_mask);
+int64_t opal_npu_spa_clear_cache(uint64_t phb_id, uint32_t bdfn,
+                               uint64_t PE_handle);
+int64_t opal_npu_tl_set(uint64_t phb_id, uint32_t bdfn, long cap,
+                       uint64_t rate_phys, uint32_t size);
 int64_t opal_console_write(int64_t term_number, __be64 *length,
                           const uint8_t *buffer);
 int64_t opal_console_read(int64_t term_number, __be64 *length,
index 6f4b00a..1b2936b 100644 (file)
@@ -320,3 +320,6 @@ OPAL_CALL(opal_set_powercap,                        OPAL_SET_POWERCAP);
 OPAL_CALL(opal_get_power_shift_ratio,          OPAL_GET_POWER_SHIFT_RATIO);
 OPAL_CALL(opal_set_power_shift_ratio,          OPAL_SET_POWER_SHIFT_RATIO);
 OPAL_CALL(opal_sensor_group_clear,             OPAL_SENSOR_GROUP_CLEAR);
+OPAL_CALL(opal_npu_spa_setup,                  OPAL_NPU_SPA_SETUP);
+OPAL_CALL(opal_npu_spa_clear_cache,            OPAL_NPU_SPA_CLEAR_CACHE);
+OPAL_CALL(opal_npu_tl_set,                     OPAL_NPU_TL_SET);