diff options
| author | Andrew Donnellan <andrew.donnellan@au1.ibm.com> | 2018-09-14 13:46:25 +1000 |
|---|---|---|
| committer | Stewart Smith <stewart@linux.ibm.com> | 2018-09-17 21:39:01 -0500 |
| commit | b6cc82cb39c4d891799f4d7a9f8e76fdf8a16125 (patch) | |
| tree | c4d041ba07a43591e72eebcbaecd02fca217717e /include | |
| parent | 68415d5e38ef04e647ad36d59f90c008a0414f56 (diff) | |
| download | blackbird-skiboot-b6cc82cb39c4d891799f4d7a9f8e76fdf8a16125.tar.gz blackbird-skiboot-b6cc82cb39c4d891799f4d7a9f8e76fdf8a16125.zip | |
hw/npu2, platform: Add NPU2 platform device detection callback
There is no standardised way to determine the presence and type of devices
connected to an NPU on POWER9.
Currently, we hardcode device types based on platform type (as no platform
currently supports both OpenCAPI and NVLink), and for OpenCAPI platforms
we use I2C to detect presence.
Witherspoon (and potentially other platforms later on) supports both
NVLink and OpenCAPI, and additionally uses SXM2 connectors which can carry
more than one link, rather than the SlimSAS connectors used for OpenCAPI on
Zaius and ZZ. This necessitates some special handling.
Add a platform callback for NPU device detection. In a later patch, we
will use this to implement Witherspoon-specific device detection. For now,
add a Witherspoon stub that sets all links to NVLink (i.e. current
behaviour).
Move the existing I2C-based presence detection for OpenCAPI devices on
Zaius/ZZ into common code, which we use by default for platforms which do
not define a callback. Clean up the use of the ibm,npu-link-type property,
which will now be exposed solely for debugging and not consumed internally.
Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'include')
| -rw-r--r-- | include/npu2.h | 14 | ||||
| -rw-r--r-- | include/platform.h | 4 |
2 files changed, 16 insertions, 2 deletions
diff --git a/include/npu2.h b/include/npu2.h index 0e07d77b..1de963d1 100644 --- a/include/npu2.h +++ b/include/npu2.h @@ -17,6 +17,7 @@ #ifndef __NPU2_H #define __NPU2_H +#include <pci.h> #include <phys-map.h> /* Debugging options */ @@ -36,6 +37,14 @@ #define NPU2DEVINF(p, fmt, a...) NPU2DEVLOG(PR_INFO, p, fmt, ##a) #define NPU2DEVERR(p, fmt, a...) NPU2DEVLOG(PR_ERR, p, fmt, ##a) +#define OCAPIDBG(dev, fmt, a...) prlog(PR_DEBUG, "OCAPI[%d:%d]: " fmt, \ + dev->npu->chip_id, dev->brick_index, ## a) +#define OCAPIINF(dev, fmt, a...) prlog(PR_INFO, "OCAPI[%d:%d]: " fmt, \ + dev->npu->chip_id, dev->brick_index, ## a) +#define OCAPIERR(dev, fmt, a...) prlog(PR_ERR, "OCAPI[%d:%d]: " fmt, \ + dev->npu->chip_id, dev->brick_index, ## a) + + /* Number of PEs supported */ #define NPU2_MAX_PE_NUM 16 #define NPU2_RESERVED_PE_NUM 15 @@ -136,7 +145,6 @@ struct npu2_dev { /* OpenCAPI */ struct phb phb_ocapi; - uint64_t i2c_port_id_ocapi; bool train_need_fence; bool train_fenced; }; @@ -168,6 +176,8 @@ struct npu2 { /* NVLink */ struct phb phb_nvlink; uint32_t phb_index; + + uint64_t i2c_port_id_ocapi; }; static inline struct npu2 *phb_to_npu2_nvlink(struct phb *phb) @@ -194,11 +204,11 @@ static inline struct phb *npu2_dev_to_phb(struct npu2_dev *ndev) } } +void npu2_i2c_presence_detect(struct npu2 *npu); int npu2_opencapi_init_npu(struct npu2 *npu); int npu2_nvlink_init_npu(struct npu2 *npu); void npu2_nvlink_create_phb(struct npu2 *npu, struct dt_node *dn); -enum npu2_dev_type npu2_dt_link_dev_type(struct dt_node *link); void npu2_write_4b(struct npu2 *p, uint64_t reg, uint32_t val); uint32_t npu2_read_4b(struct npu2 *p, uint64_t reg); void npu2_write(struct npu2 *p, uint64_t reg, uint64_t val); diff --git a/include/platform.h b/include/platform.h index 1a35a86a..efafbd22 100644 --- a/include/platform.h +++ b/include/platform.h @@ -22,6 +22,7 @@ struct phb; struct pci_device; struct pci_slot; struct errorlog; +struct npu2; enum resource_id { RESOURCE_ID_KERNEL, @@ -76,6 +77,9 @@ struct platform { /* OpenCAPI platform-specific I2C information */ const struct platform_ocapi *ocapi; + /* NPU2 device detection */ + void (*npu2_device_detect)(struct npu2 *npu); + /* * Probe platform, return true on a match, called before * any allocation has been performed outside of the heap |

