diff options
author | Christophe Lombard <clombard@linux.vnet.ibm.com> | 2021-10-14 17:57:04 +0200 |
---|---|---|
committer | Vasant Hegde <hegdevasant@linux.vnet.ibm.com> | 2021-10-19 12:26:02 +0530 |
commit | 4c1add1fb20fe07b827227ca34f63f176774d51c (patch) | |
tree | 6f191cb95c848d7bbf2268231cc62f7d8719f0d0 /hw/npu-opal.c | |
parent | 2d89dd334756d19a9ffc3e4c784406177f46c053 (diff) | |
download | skiboot-4c1add1fb20fe07b827227ca34f63f176774d51c.zip skiboot-4c1add1fb20fe07b827227ca34f63f176774d51c.tar.gz skiboot-4c1add1fb20fe07b827227ca34f63f176774d51c.tar.bz2 |
pau: Add support for OpenCAPI Persistent Memory devices.
Lowest Point of Coherency (LPC) memory allows the host to access memory on
an OpenCAPI device.
When the P10 chip accesses memory addresses on the AFU, the Real Address
on the PowerBus must hit a BAR in the PAU such as GPU-Memory BAR. The BAR
defines the range of Real Addresses that represent AFU memory.
The two existing OPAL calls, OPAL_NPU_MEM_ALLOC and OPAL_NPU_MEM_RELEASE
are used to manage the AFU momory.
Signed-off-by: Christophe Lombard <clombard@linux.vnet.ibm.com>
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Diffstat (limited to 'hw/npu-opal.c')
-rw-r--r-- | hw/npu-opal.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/hw/npu-opal.c b/hw/npu-opal.c index 2e455dc..1b66857 100644 --- a/hw/npu-opal.c +++ b/hw/npu-opal.c @@ -239,3 +239,38 @@ static int64_t opal_npu_tl_set(uint64_t phb_id, uint32_t bdfn, return OPAL_PARAMETER; } opal_call(OPAL_NPU_TL_SET, opal_npu_tl_set, 5); + +static int64_t opal_npu_mem_alloc(uint64_t phb_id, uint32_t bdfn, + uint64_t size, uint64_t *bar) +{ + struct phb *phb = pci_get_phb(phb_id); + + if (!phb) + return OPAL_PARAMETER; + + if (phb->phb_type == phb_type_npu_v2_opencapi) + return npu2_opencapi_mem_alloc(phb, bdfn, size, bar); + + if (phb->phb_type == phb_type_pau_opencapi) + return pau_opencapi_mem_alloc(phb, bdfn, size, bar); + + return OPAL_PARAMETER; +} +opal_call(OPAL_NPU_MEM_ALLOC, opal_npu_mem_alloc, 4); + +static int64_t opal_npu_mem_release(uint64_t phb_id, uint32_t bdfn) +{ + struct phb *phb = pci_get_phb(phb_id);; + + if (!phb) + return OPAL_PARAMETER; + + if (phb->phb_type == phb_type_npu_v2_opencapi) + return npu2_opencapi_mem_release(phb, bdfn); + + if (phb->phb_type == phb_type_pau_opencapi) + return pau_opencapi_mem_release(phb, bdfn); + + return OPAL_PARAMETER; +} +opal_call(OPAL_NPU_MEM_RELEASE, opal_npu_mem_release, 2); |