From 62ccf2d2efefa01d0eb92cd6ecbb45ea0499fb1c Mon Sep 17 00:00:00 2001 From: Ian Munsie Date: Thu, 14 Jul 2016 07:17:03 +1000 Subject: cxl: Move cxl_afu_get / cxl_afu_put to base The Mellanox CX4 uses a model where the AFU is one physical function of the device, and is used by other peer physical functions of the same device. This will require those other devices to grab a reference on the AFU when they are initialised to make sure that it does not go away during their lifetime. Move the AFU refcount functions to base.c so they can be called from the PHB code. Signed-off-by: Ian Munsie Reviewed-by: Andrew Donnellan Reviewed-by: Frederic Barrat Signed-off-by: Michael Ellerman --- include/misc/cxl-base.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/misc') diff --git a/include/misc/cxl-base.h b/include/misc/cxl-base.h index 5ae962512fb8..f53808fa638a 100644 --- a/include/misc/cxl-base.h +++ b/include/misc/cxl-base.h @@ -36,11 +36,15 @@ static inline void cxl_ctx_put(void) atomic_dec(&cxl_use_count); } +struct cxl_afu *cxl_afu_get(struct cxl_afu *afu); +void cxl_afu_put(struct cxl_afu *afu); void cxl_slbia(struct mm_struct *mm); #else /* CONFIG_CXL_BASE */ static inline bool cxl_ctx_in_use(void) { return false; } +static inline struct cxl_afu *cxl_afu_get(struct cxl_afu *afu) { return NULL; } +static inline void cxl_afu_put(struct cxl_afu *afu) {} static inline void cxl_slbia(struct mm_struct *mm) {} #endif /* CONFIG_CXL_BASE */ -- cgit v1.2.3-59-g8ed1b