Re: [PATCH] powerpc: powernv: Remove unneeded variable: "rc"
On 26/3/21 10:53 pm, dingsen...@163.com wrote: From: dingsenjie Remove unneeded variable: "rc". Signed-off-by: dingsenjie This looks obviously correct and doesn't raise any checkpatch warnings. Reviewed-by: Andrew Donnellan -- Andrew Donnellan OzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited
Re: [PATCH] cxl: Fix couple of spellings
On 22/3/21 1:33 pm, Bhaskar Chowdhury wrote: s/filesytem/filesystem/ s/symantics/semantics/ Signed-off-by: Bhaskar Chowdhury Acked-by: Andrew Donnellan --- drivers/misc/cxl/context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/cxl/context.c b/drivers/misc/cxl/context.c index fb2eff69e449..e627b4056623 100644 --- a/drivers/misc/cxl/context.c +++ b/drivers/misc/cxl/context.c @@ -52,7 +52,7 @@ int cxl_context_init(struct cxl_context *ctx, struct cxl_afu *afu, bool master) * can always access it when dereferenced from IDR. For the same * reason, the segment table is only destroyed after the context is * removed from the IDR. Access to this in the IOCTL is protected by -* Linux filesytem symantics (can't IOCTL until open is complete). +* Linux filesystem semantics (can't IOCTL until open is complete). */ i = cxl_alloc_sst(ctx); if (i) -- 2.31.0 -- Andrew Donnellan OzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited
Re: [PATCH] cxl: don't manipulate the mm.mm_users field directly
On 11/3/21 4:44 am, Laurent Dufour wrote: It is better to rely on the API provided by the MM layer instead of directly manipulating the mm_users field. Signed-off-by: Laurent Dufour LGTM, thanks for picking this up Acked-by: Andrew Donnellan -- Andrew Donnellan OzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited
Re: linux-next: Fixes tag needs some work in the jc_docs tree
On 26/2/21 8:39 am, Jonathan Corbet wrote: Stephen Rothwell writes: Hi all, In commit 36eaf08fc283 ("docs: powerpc: Fix tables in syscall64-abi.rst") Fixes tag Fixes: 209b44c804c ("docs: powerpc: syscall64-abi.rst: fix a malformed table") has these problem(s): - SHA1 should be at least 12 digits long I don't think this is worth rebasing for, but in the future it can be fixed by setting core.abbrev to 12 (or more) or (for git v2.11 or later) just making sure it is not set (or set to "auto"). I made that tag by hand while "fixing" the changlog on that commit, which included the full ID. Obviously, counting to 12 is a challenging task for a slow guy like me...:) No, no, my local tree tells me that *I* made that tag by hand and failed to count properly... sorry for the noise! -- Andrew Donnellan OzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited
Re: [PATCH] cxl: Simplify bool conversion
On 29/1/21 7:25 pm, Yang Li wrote: Fix the following coccicheck warning: ./drivers/misc/cxl/sysfs.c:181:48-53: WARNING: conversion to bool not needed here Reported-by: Abaci Robot Signed-off-by: Yang Li Reviewed-by: Andrew Donnellan Thanks! --- drivers/misc/cxl/sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/cxl/sysfs.c b/drivers/misc/cxl/sysfs.c index d97a243..c173a5e 100644 --- a/drivers/misc/cxl/sysfs.c +++ b/drivers/misc/cxl/sysfs.c @@ -178,7 +178,7 @@ static ssize_t perst_reloads_same_image_store(struct device *device, if ((rc != 1) || !(val == 1 || val == 0)) return -EINVAL; - adapter->perst_same_image = (val == 1 ? true : false); + adapter->perst_same_image = (val == 1); return count; } -- Andrew Donnellan OzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited
Re: [PATCH 01/13] powerpc/powernv: remove get_cxl_module
On 21/1/21 6:49 pm, Christoph Hellwig wrote: The static inline get_cxl_module function is entirely unused, remove it. Signed-off-by: Christoph Hellwig The one user of this was removed in 8bf6b91a5125a ("Revert "powerpc/powernv: Add support for the cxl kernel api on the real phb"). Thanks for picking this up. Reviewed-by: Andrew Donnellan -- Andrew Donnellan OzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited
Re: [PATCH v2 -next] misc: ocxl: use DEFINE_MUTEX() for mutex lock
On 25/12/20 12:24 am, Zheng Yongjun wrote: mutex lock can be initialized automatically with DEFINE_MUTEX() rather than explicitly calling mutex_init(). Signed-off-by: Zheng Yongjun Acked-by: Andrew Donnellan -- Andrew Donnellan OzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited
Re: [ANNOUNCE] [CFP] Call for Sessions - linux.conf.au Online 2021 Kernel Miniconf
On 30/11/20 1:45 pm, Andrew Donnellan wrote: LCA2021 Kernel Miniconf - Online - 2021-01-23 - LCA Kernel Miniconf submissions now open! (Ever wanted to present at LCA, but couldn't justify flying to Australia? Well, 2021 is your chance - we're going online-only for reasons you're probably aware of.) Submissions close: 2020-12-18, 23:59 AoE/UTC-12 Submissions: https://linux.conf.au/proposals/submit/kernel-miniconf/ More info: https://lca-kernel.ozlabs.org/2021-cfs.html The deadline has been extended until January 7 - we're looking for talks on a broad range of kernel topics, so please feel free to submit a proposal about anything kernel-related! *** linux.conf.au 2021 will be held at the Australian National University, Canberra^W^W^W^W^W^Win the comfort of your own homes, by the magic of the internet, from 23-25 January 2021. The Kernel Miniconf is a single-day miniconf track, held on Saturday 23 January, about everything related to the kernel and low-level systems programming. The Kernel Miniconf will focus on a variety of kernel-related topics - technical presentations on up-and-coming kernel developments, the future direction of the kernel, and kernel development community and process matters. Past Kernel Miniconfs have included technical talks on topics such as memory management, RCU, scheduling and filesystems, as well as talks on Linux kernel community topics such as licensing and Linux kernel development process. We invite submissions on anything related to kernel and low-level systems programming. We welcome submissions from developers of all levels of experience in the kernel community, covering a broad range of topics. The focus of the miniconf will primarily be on Linux, however non-Linux talks of sufficient interest to a primarily Linux audience will be considered. -- Andrew Donnellan OzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited
Re: [PATCH] powerpc/rtas: fix typo of ibm,open-errinjct in rtas filter
On 9/12/20 6:54 am, Tyrel Datwyler wrote: Commit bd59380c5ba4 ("powerpc/rtas: Restrict RTAS requests from userspace") introduced the following error when invoking the errinjct userspace tool. [root@ltcalpine2-lp5 librtas]# errinjct open [327884.071171] sys_rtas: RTAS call blocked - exploit attempt? [327884.071186] sys_rtas: token=0x26, nargs=0 (called by errinjct) errinjct: Could not open RTAS error injection facility errinjct: librtas: open: Unexpected I/O error The entry for ibm,open-errinjct in rtas_filter array has a typo where the "j" is omitted in the rtas call name. After fixing this typo the errinjct tool functions again as expected. [root@ltcalpine2-lp5 linux]# errinjct open RTAS error injection facility open, token = 1 fixes: bd59380c5ba4 ("powerpc/rtas: Restrict RTAS requests from userspace") Signed-off-by: Tyrel Datwyler Thanks for catching this! Acked-by: Andrew Donnellan -- Andrew Donnellan OzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited
Re: [ANNOUNCE] [CFP] Call for Sessions - linux.conf.au Online 2021 Kernel Miniconf
On 30/11/20 2:46 pm, Andrew Donnellan wrote: On 30/11/20 2:38 pm, CRISTIAN ANDRES VARGAS GONZALEZ wrote: > More info: https://lca-kernel.ozlabs.org/2021-cfs.html <https://lca-kernel.ozlabs.org/2021-cfs.html> Hi, this link no working. :c Ugh, let me fix my TLS setup. In the meantime, try plain old unencrypted HTTP: http://lca-kernel.ozlabs.org/2021-cfs.html Thanks for reporting! Should be all fixed. -- Andrew Donnellan OzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited
Re: [ANNOUNCE] [CFP] Call for Sessions - linux.conf.au Online 2021 Kernel Miniconf
On 30/11/20 2:38 pm, CRISTIAN ANDRES VARGAS GONZALEZ wrote: > More info: https://lca-kernel.ozlabs.org/2021-cfs.html <https://lca-kernel.ozlabs.org/2021-cfs.html> Hi, this link no working. :c Ugh, let me fix my TLS setup. In the meantime, try plain old unencrypted HTTP: http://lca-kernel.ozlabs.org/2021-cfs.html Thanks for reporting! Andrew -- Andrew Donnellan OzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited
[ANNOUNCE] [CFP] Call for Sessions - linux.conf.au Online 2021 Kernel Miniconf
LCA2021 Kernel Miniconf - Online - 2021-01-23 - LCA Kernel Miniconf submissions now open! (Ever wanted to present at LCA, but couldn't justify flying to Australia? Well, 2021 is your chance - we're going online-only for reasons you're probably aware of.) Submissions close: 2020-12-18, 23:59 AoE/UTC-12 Submissions: https://linux.conf.au/proposals/submit/kernel-miniconf/ More info: https://lca-kernel.ozlabs.org/2021-cfs.html *** linux.conf.au 2021 will be held at the Australian National University, Canberra^W^W^W^W^W^Win the comfort of your own homes, by the magic of the internet, from 23-25 January 2021. The Kernel Miniconf is a single-day miniconf track, held on Saturday 23 January, about everything related to the kernel and low-level systems programming. The Kernel Miniconf will focus on a variety of kernel-related topics - technical presentations on up-and-coming kernel developments, the future direction of the kernel, and kernel development community and process matters. Past Kernel Miniconfs have included technical talks on topics such as memory management, RCU, scheduling and filesystems, as well as talks on Linux kernel community topics such as licensing and Linux kernel development process. We invite submissions on anything related to kernel and low-level systems programming. We welcome submissions from developers of all levels of experience in the kernel community, covering a broad range of topics. The focus of the miniconf will primarily be on Linux, however non-Linux talks of sufficient interest to a primarily Linux audience will be considered. -- Andrew Donnellan OzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited
Re: [PATCH] powerpc/powernv/sriov: fix unsigned int win compared to less than zero
On 10/11/20 10:19 pm, xiakaixu1...@gmail.com wrote: From: Kaixu Xia Fix coccicheck warning: ./arch/powerpc/platforms/powernv/pci-sriov.c:443:7-10: WARNING: Unsigned expression compared with zero: win < 0 ./arch/powerpc/platforms/powernv/pci-sriov.c:462:7-10: WARNING: Unsigned expression compared with zero: win < 0 Reported-by: Tosk Robot Signed-off-by: Kaixu Xia This seems like the right fix, the value assigned to win can indeed be -1 so it should be signed. Thanks for sending the patch. Reviewed-by: Andrew Donnellan --- arch/powerpc/platforms/powernv/pci-sriov.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/powernv/pci-sriov.c b/arch/powerpc/platforms/powernv/pci-sriov.c index c4434f20f42f..92fc861c528f 100644 --- a/arch/powerpc/platforms/powernv/pci-sriov.c +++ b/arch/powerpc/platforms/powernv/pci-sriov.c @@ -422,7 +422,7 @@ static int pnv_pci_vf_assign_m64(struct pci_dev *pdev, u16 num_vfs) { struct pnv_iov_data *iov; struct pnv_phb*phb; - unsigned int win; + intwin; struct resource *res; inti, j; int64_trc; -- Andrew Donnellan OzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited
Re: [PATCH v2 2/2] misc: ocxl: config: Rename function attribute description
On 3/11/20 1:20 am, Lee Jones wrote: Fixes the following W=1 kernel build warning(s): drivers/misc/ocxl/config.c:81: warning: Function parameter or member 'dev' not described in 'get_function_0' drivers/misc/ocxl/config.c:81: warning: Excess function parameter 'device' description in 'get_function_0' Cc: Frederic Barrat Cc: Andrew Donnellan Cc: Arnd Bergmann Cc: Greg Kroah-Hartman Cc: linuxppc-...@lists.ozlabs.org Signed-off-by: Lee Jones Thanks! Acked-by: Andrew Donnellan -- Andrew Donnellan OzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited
Re: [PATCH -next] ocxl: simplify the return expression of free_function_dev()
On 21/9/20 11:10 pm, Qinglang Miao wrote: Simplify the return expression. Signed-off-by: Qinglang Miao Looks good Acked-by: Andrew Donnellan -- Andrew Donnellan OzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited
Re: [PATCH] ocxl: Replace HTTP links with HTTPS ones
On 14/7/20 3:55 am, Alexander A. Klimov wrote: Rationale: Reduces attack surface on kernel devs opening the links for MITM as HTTPS traffic is much harder to manipulate. Deterministic algorithm: For each file: If not .svg: For each line: If doesn't contain `\bxmlns\b`: For each link, `\bhttp://[^# \t\r\n]*(?:\w|/)`: If neither `\bgnu\.org/license`, nor `\bmozilla\.org/MPL\b`: If both the HTTP and HTTPS versions return 200 OK and serve the same content: Replace HTTP with HTTPS. Signed-off-by: Alexander A. Klimov Thanks. Acked-by: Andrew Donnellan -- Andrew Donnellan OzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited
Re: [PATCH v2 3/3] misc: cxl: flash: Remove unused variable 'drc_index'
On 9/7/20 4:56 pm, Lee Jones wrote: Keeping the pointer increment though. Fixes the following W=1 kernel build warning: drivers/misc/cxl/flash.c: In function ‘update_devicetree’: drivers/misc/cxl/flash.c:178:16: warning: variable ‘drc_index’ set but not used [-Wunused-but-set-variable] 178 | __be32 *data, drc_index, phandle; | ^ Cc: Frederic Barrat Cc: Andrew Donnellan Cc: linuxppc-...@lists.ozlabs.org Signed-off-by: Lee Jones Acked-by: Andrew Donnellan -- Andrew Donnellan OzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited
Re: [PATCH 3/3] misc: cxl: flash: Remove unused variable 'drc_index'
On 8/7/20 10:57 pm, Lee Jones wrote: Keeping the pointer increment though. Fixes the following W=1 kernel build warning: drivers/misc/cxl/flash.c: In function ‘update_devicetree’: drivers/misc/cxl/flash.c:178:16: warning: variable ‘drc_index’ set but not used [-Wunused-but-set-variable] 178 | __be32 *data, drc_index, phandle; | ^ Cc: Frederic Barrat Cc: Andrew Donnellan Cc: linuxppc-...@lists.ozlabs.org Signed-off-by: Lee Jones Acked-by: Andrew Donnellan -- Andrew Donnellan OzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited
Re: [PATCH] cxl: Fix kobject memleak
On 3/6/20 9:57 pm, wanghai (M) wrote: kfree(cr) can be called when kobject_put()-->kobject_release()-->kobject_cleanup()-->kobj_type->release() is called. The kobj_type here is afu_config_record_type Of course, I missed that. In that case Acked-by: Andrew Donnellan Thanks for the fix! -- Andrew Donnellan OzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited
Re: [PATCH] cxl: Fix kobject memleak
On 2/6/20 10:07 pm, Wang Hai wrote: Currently the error return path from kobject_init_and_add() is not followed by a call to kobject_put() - which means we are leaking the kobject. Fix it by adding a call to kobject_put() in the error path of kobject_init_and_add(). Fixes: b087e6190ddc ("cxl: Export optional AFU configuration record in sysfs") Reported-by: Hulk Robot Signed-off-by: Wang Hai Thanks for the fix! I note that the err1 label returns without calling kfree(cr) and I can't see a reason why we do that - so perhaps we should remove the return statement in err1: so it falls through? -- Andrew Donnellan OzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited
Re: [PATCH v3 06/15] powerpc/32: prepare for CONFIG_VMAP_STACK
On 18/10/19 5:46 pm, Christophe Leroy wrote: Le 17/10/2019 à 09:36, Andrew Donnellan a écrit : On 10/9/19 7:16 pm, Christophe Leroy wrote: +#if defined(CONFIG_VMAP_STACK) && CONFIG_THREAD_SHIFT < PAGE_SHIFT +#define THREAD_SHIFT PAGE_SHIFT +#else #define THREAD_SHIFT CONFIG_THREAD_SHIFT +#endif #define THREAD_SIZE (1 << THREAD_SHIFT) Looking at 64-bit book3s: with 64K pages, this results in a THREAD_SIZE that's too large for immediate mode arithmetic operations, which is annoying. Hmm. Which operation are you thinking about ? For instance, 'addi' can't be used anymore, but 'addis' can. Right, I didn't look too closely - yes, they're "addi"s. But also DS-form stores: stdur1,THREAD_SIZE-STACK_FRAME_OVERHEAD(r3) Anyway, this is just the first thing that broke when I wondered whether a ppc64le_defconfig would even build if I just switched on VMAP_STACK, I'll work around it -- Andrew Donnellan OzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited
Re: [PATCH v3 06/15] powerpc/32: prepare for CONFIG_VMAP_STACK
On 10/9/19 7:16 pm, Christophe Leroy wrote: +#if defined(CONFIG_VMAP_STACK) && CONFIG_THREAD_SHIFT < PAGE_SHIFT +#define THREAD_SHIFT PAGE_SHIFT +#else #define THREAD_SHIFT CONFIG_THREAD_SHIFT +#endif #define THREAD_SIZE (1 << THREAD_SHIFT) Looking at 64-bit book3s: with 64K pages, this results in a THREAD_SIZE that's too large for immediate mode arithmetic operations, which is annoying. Hmm. -- Andrew Donnellan OzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited
[ANNOUNCE] Call for Sessions - linux.conf.au 2020 Kernel Miniconf
LCA2020 Kernel Miniconf - Gold Coast, Queensland, Australia - 2020-01-14 ** LCA Kernel Miniconf submissions open! Submissions close: 2019-12-08 (early submissions until 2019-11-17) Submissions: https://linux.conf.au/proposals/submit/kernel-miniconf/ More info: https://lca-kernel.ozlabs.org/2020-cfs.html ** linux.conf.au 2020 will be held at the Gold Coast Convention and Exhibition Centre, from 13-17 January 2020. The Kernel Miniconf is returning once again to discuss all things kernel. The Kernel Miniconf is a single-day miniconf track about everything related to the kernel and low-level systems programming. The Kernel Miniconf will focus on a variety of kernel-related topics - technical presentations on up-and-coming kernel developments, the future direction of the kernel, and kernel development community and process matters. Past Kernel Miniconfs have included technical talks on topics such as memory management, RCU, scheduling and filesystems, as well as talks on Linux kernel community topics such as licensing and Linux kernel development process. We invite submissions on anything related to kernel and low-level systems programming. We welcome submissions from developers of all levels of experience in the kernel community, covering a broad range of topics. The focus of the miniconf will primarily be on Linux, however non-Linux talks of sufficient interest to a primarily Linux audience will be considered. Early Close Date: 2019-11-17, midnight Anywhere on Earth (UTC-12) Final Close Date: 2019-12-08, midnight Anywhere on Earth (UTC-12) Submissions: https://linux.conf.au/proposals/submit/kernel-miniconf/ ** For more information: http://lca-kernel.ozlabs.org/2020-cfs.html ** -- Andrew Donnellan OzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited
Re: [PATCH 1/5] powerpc: Add OPAL calls for LPC memory alloc/release
On 17/9/19 3:42 am, Alastair D'Silva wrote: From: Alastair D'Silva Add OPAL calls for LPC memory alloc/release Signed-off-by: Alastair D'Silva This needs rebasing, but apart from that. Acked-by: Andrew Donnellan --- arch/powerpc/include/asm/opal-api.h| 4 +++- arch/powerpc/include/asm/opal.h| 3 +++ arch/powerpc/platforms/powernv/opal-call.c | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/opal-api.h b/arch/powerpc/include/asm/opal-api.h index 383242eb0dea..c58161cd7cfb 100644 --- a/arch/powerpc/include/asm/opal-api.h +++ b/arch/powerpc/include/asm/opal-api.h @@ -208,7 +208,9 @@ #define OPAL_HANDLE_HMI2 166 #define OPAL_NX_COPROC_INIT 167 #define OPAL_XIVE_GET_VP_STATE170 -#define OPAL_LAST 170 +#define OPAL_NPU_MEM_ALLOC 171 +#define OPAL_NPU_MEM_RELEASE 172 +#define OPAL_LAST 172 #define QUIESCE_HOLD 1 /* Spin all calls at entry */ #define QUIESCE_REJECT2 /* Fail all calls with OPAL_BUSY */ diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h index 57bd029c715e..8c957a003be4 100644 --- a/arch/powerpc/include/asm/opal.h +++ b/arch/powerpc/include/asm/opal.h @@ -39,6 +39,9 @@ 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_npu_mem_alloc(uint64_t phb_id, uint32_t bdfn, + uint64_t size, uint64_t *bar); +int64_t opal_npu_mem_release(uint64_t phb_id, uint32_t bdfn); 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, diff --git a/arch/powerpc/platforms/powernv/opal-call.c b/arch/powerpc/platforms/powernv/opal-call.c index 29ca523c1c79..09a280446507 100644 --- a/arch/powerpc/platforms/powernv/opal-call.c +++ b/arch/powerpc/platforms/powernv/opal-call.c @@ -287,3 +287,5 @@ OPAL_CALL(opal_pci_set_pbcq_tunnel_bar, OPAL_PCI_SET_PBCQ_TUNNEL_BAR); OPAL_CALL(opal_sensor_read_u64, OPAL_SENSOR_READ_U64); OPAL_CALL(opal_sensor_group_enable, OPAL_SENSOR_GROUP_ENABLE); OPAL_CALL(opal_nx_coproc_init,OPAL_NX_COPROC_INIT); +OPAL_CALL(opal_npu_mem_alloc, OPAL_NPU_MEM_ALLOC); +OPAL_CALL(opal_npu_mem_release,OPAL_NPU_MEM_RELEASE); -- Andrew Donnellan OzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited
Re: [PATCH] ocxl: Use the correct style for SPDX License Identifier
On 20/9/19 6:18 pm, Nishad Kamdar wrote: This patch corrects the SPDX License Identifier style in header files for Open Coherent Accelerator (OCXL) compatible device drivers. For C header files Documentation/process/license-rules.rst mandates C-like comments (opposed to C source files where C++ style should be used) Changes made by using a script provided by Joe Perches here: https://lkml.org/lkml/2019/2/7/46. Suggested-by: Joe Perches Signed-off-by: Nishad Kamdar Thanks. Acked-by: Andrew Donnellan --- drivers/misc/ocxl/ocxl_internal.h | 2 +- drivers/misc/ocxl/trace.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/misc/ocxl/ocxl_internal.h b/drivers/misc/ocxl/ocxl_internal.h index 97415afd79f3..345bf843a38e 100644 --- a/drivers/misc/ocxl/ocxl_internal.h +++ b/drivers/misc/ocxl/ocxl_internal.h @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: GPL-2.0+ +/* SPDX-License-Identifier: GPL-2.0+ */ // Copyright 2017 IBM Corp. #ifndef _OCXL_INTERNAL_H_ #define _OCXL_INTERNAL_H_ diff --git a/drivers/misc/ocxl/trace.h b/drivers/misc/ocxl/trace.h index 024f417e7e01..17e21cb2addd 100644 --- a/drivers/misc/ocxl/trace.h +++ b/drivers/misc/ocxl/trace.h @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: GPL-2.0+ +/* SPDX-License-Identifier: GPL-2.0+ */ // Copyright 2017 IBM Corp. #undef TRACE_SYSTEM #define TRACE_SYSTEM ocxl -- Andrew Donnellan OzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited
Re: [PATCH 22/39] docs: ocxl.rst: add it to the uAPI book
On 28/6/19 10:30 pm, Mauro Carvalho Chehab wrote: The content of this file is user-faced. Signed-off-by: Mauro Carvalho Chehab Acked-by: Andrew Donnellan --- Documentation/{ => userspace-api}/accelerators/ocxl.rst | 2 -- Documentation/userspace-api/index.rst | 1 + MAINTAINERS | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) rename Documentation/{ => userspace-api}/accelerators/ocxl.rst (99%) diff --git a/Documentation/accelerators/ocxl.rst b/Documentation/userspace-api/accelerators/ocxl.rst similarity index 99% rename from Documentation/accelerators/ocxl.rst rename to Documentation/userspace-api/accelerators/ocxl.rst index b1cea19a90f5..14cefc020e2d 100644 --- a/Documentation/accelerators/ocxl.rst +++ b/Documentation/userspace-api/accelerators/ocxl.rst @@ -1,5 +1,3 @@ -:orphan: - OpenCAPI (Open Coherent Accelerator Processor Interface) diff --git a/Documentation/userspace-api/index.rst b/Documentation/userspace-api/index.rst index a3233da7fa88..ad494da40009 100644 --- a/Documentation/userspace-api/index.rst +++ b/Documentation/userspace-api/index.rst @@ -20,6 +20,7 @@ place where this information is gathered. seccomp_filter unshare spec_ctrl + accelerators/ocxl .. only:: subproject and html diff --git a/MAINTAINERS b/MAINTAINERS index 29d1498ad39d..f723371dccd0 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -11483,7 +11483,7 @@ F: arch/powerpc/include/asm/pnv-ocxl.h F:drivers/misc/ocxl/ F:include/misc/ocxl* F:include/uapi/misc/ocxl.h -F: Documentation/accelerators/ocxl.rst +F: Documentation/userspace-api/accelerators/ocxl.rst OMAP AUDIO SUPPORT M:Peter Ujfalusi -- Andrew Donnellan OzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited
Re: [PATCH v2] ocxl: Allow contexts to be attached with a NULL mm
On 20/6/19 2:12 pm, Alastair D'Silva wrote: From: Alastair D'Silva If an OpenCAPI context is to be used directly by a kernel driver, there may not be a suitable mm to use. The patch makes the mm parameter to ocxl_context_attach optional. Signed-off-by: Alastair D'Silva Acked-by: Andrew Donnellan --- arch/powerpc/mm/book3s64/radix_tlb.c | 5 + drivers/misc/ocxl/context.c | 9 ++--- drivers/misc/ocxl/link.c | 28 3 files changed, 35 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/mm/book3s64/radix_tlb.c b/arch/powerpc/mm/book3s64/radix_tlb.c index bb9835681315..ce8a77fae6a7 100644 --- a/arch/powerpc/mm/book3s64/radix_tlb.c +++ b/arch/powerpc/mm/book3s64/radix_tlb.c @@ -666,6 +666,11 @@ EXPORT_SYMBOL(radix__flush_tlb_page); #define radix__flush_all_mm radix__local_flush_all_mm #endif /* CONFIG_SMP */ +/* + * If kernel TLBIs ever become local rather than global, then + * drivers/misc/ocxl/link.c:ocxl_link_add_pe will need some work, as it + * assumes kernel TLBIs are global. + */ void radix__flush_tlb_kernel_range(unsigned long start, unsigned long end) { _tlbie_pid(0, RIC_FLUSH_ALL); diff --git a/drivers/misc/ocxl/context.c b/drivers/misc/ocxl/context.c index bab9c9364184..994563a078eb 100644 --- a/drivers/misc/ocxl/context.c +++ b/drivers/misc/ocxl/context.c @@ -69,6 +69,7 @@ static void xsl_fault_error(void *data, u64 addr, u64 dsisr) int ocxl_context_attach(struct ocxl_context *ctx, u64 amr, struct mm_struct *mm) { int rc; + unsigned long pidr = 0; // Locks both status & tidr mutex_lock(>status_mutex); @@ -77,9 +78,11 @@ int ocxl_context_attach(struct ocxl_context *ctx, u64 amr, struct mm_struct *mm) goto out; } - rc = ocxl_link_add_pe(ctx->afu->fn->link, ctx->pasid, - mm->context.id, ctx->tidr, amr, mm, - xsl_fault_error, ctx); + if (mm) + pidr = mm->context.id; + + rc = ocxl_link_add_pe(ctx->afu->fn->link, ctx->pasid, pidr, ctx->tidr, + amr, mm, xsl_fault_error, ctx); if (rc) goto out; diff --git a/drivers/misc/ocxl/link.c b/drivers/misc/ocxl/link.c index cce5b0d64505..58d111afd9f6 100644 --- a/drivers/misc/ocxl/link.c +++ b/drivers/misc/ocxl/link.c @@ -224,6 +224,17 @@ static irqreturn_t xsl_fault_handler(int irq, void *data) ack_irq(spa, ADDRESS_ERROR); return IRQ_HANDLED; } + + if (!pe_data->mm) { + /* +* translation fault from a kernel context - an OpenCAPI +* device tried to access a bad kernel address +*/ + rcu_read_unlock(); + pr_warn("Unresolved OpenCAPI xsl fault in kernel context\n"); + ack_irq(spa, ADDRESS_ERROR); + return IRQ_HANDLED; + } WARN_ON(pe_data->mm->context.id != pid); if (mmget_not_zero(pe_data->mm)) { @@ -523,7 +534,13 @@ int ocxl_link_add_pe(void *link_handle, int pasid, u32 pidr, u32 tidr, pe->amr = cpu_to_be64(amr); pe->software_state = cpu_to_be32(SPA_PE_VALID); - mm_context_add_copro(mm); + /* +* For user contexts, register a copro so that TLBIs are seen +* by the nest MMU. If we have a kernel context, TLBIs are +* already global. +*/ + if (mm) + mm_context_add_copro(mm); /* * Barrier is to make sure PE is visible in the SPA before it * is used by the device. It also helps with the global TLBI @@ -546,7 +563,8 @@ int ocxl_link_add_pe(void *link_handle, int pasid, u32 pidr, u32 tidr, * have a reference on mm_users. Incrementing mm_count solves * the problem. */ - mmgrab(mm); + if (mm) + mmgrab(mm); trace_ocxl_context_add(current->pid, spa->spa_mem, pasid, pidr, tidr); unlock: mutex_unlock(>spa_lock); @@ -652,8 +670,10 @@ int ocxl_link_remove_pe(void *link_handle, int pasid) if (!pe_data) { WARN(1, "Couldn't find pe data when removing PE\n"); } else { - mm_context_remove_copro(pe_data->mm); - mmdrop(pe_data->mm); + if (pe_data->mm) { + mm_context_remove_copro(pe_data->mm); + mmdrop(pe_data->mm); + } kfree_rcu(pe_data, rcu); } unlock: -- Andrew Donnellan OzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited
Re: [PATCH] ocxl: Allow contexts to be attached with a NULL mm
On 17/6/19 2:41 pm, Alastair D'Silva wrote: From: Alastair D'Silva If an OpenCAPI context is to be used directly by a kernel driver, there may not be a suitable mm to use. The patch makes the mm parameter to ocxl_context_attach optional. Signed-off-by: Alastair D'Silva The one issue I can see here is that using mm == NULL bypasses our method of enabling/disabling global TLBIs in mm_context_add_copro(). Discussing this privately with Alastair and Fred - this should be fine, but perhaps we should document that. --- drivers/misc/ocxl/context.c | 9 ++--- drivers/misc/ocxl/link.c| 12 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/misc/ocxl/context.c b/drivers/misc/ocxl/context.c index bab9c9364184..994563a078eb 100644 --- a/drivers/misc/ocxl/context.c +++ b/drivers/misc/ocxl/context.c @@ -69,6 +69,7 @@ static void xsl_fault_error(void *data, u64 addr, u64 dsisr) int ocxl_context_attach(struct ocxl_context *ctx, u64 amr, struct mm_struct *mm) { int rc; + unsigned long pidr = 0; // Locks both status & tidr mutex_lock(>status_mutex); @@ -77,9 +78,11 @@ int ocxl_context_attach(struct ocxl_context *ctx, u64 amr, struct mm_struct *mm) goto out; } - rc = ocxl_link_add_pe(ctx->afu->fn->link, ctx->pasid, - mm->context.id, ctx->tidr, amr, mm, - xsl_fault_error, ctx); + if (mm) + pidr = mm->context.id; + + rc = ocxl_link_add_pe(ctx->afu->fn->link, ctx->pasid, pidr, ctx->tidr, + amr, mm, xsl_fault_error, ctx); if (rc) goto out; diff --git a/drivers/misc/ocxl/link.c b/drivers/misc/ocxl/link.c index cce5b0d64505..43542f124807 100644 --- a/drivers/misc/ocxl/link.c +++ b/drivers/misc/ocxl/link.c @@ -523,7 +523,8 @@ int ocxl_link_add_pe(void *link_handle, int pasid, u32 pidr, u32 tidr, pe->amr = cpu_to_be64(amr); pe->software_state = cpu_to_be32(SPA_PE_VALID); - mm_context_add_copro(mm); + if (mm) + mm_context_add_copro(mm); /* * Barrier is to make sure PE is visible in the SPA before it * is used by the device. It also helps with the global TLBI @@ -546,7 +547,8 @@ int ocxl_link_add_pe(void *link_handle, int pasid, u32 pidr, u32 tidr, * have a reference on mm_users. Incrementing mm_count solves * the problem. */ - mmgrab(mm); + if (mm) + mmgrab(mm); trace_ocxl_context_add(current->pid, spa->spa_mem, pasid, pidr, tidr); unlock: mutex_unlock(>spa_lock); @@ -652,8 +654,10 @@ int ocxl_link_remove_pe(void *link_handle, int pasid) if (!pe_data) { WARN(1, "Couldn't find pe data when removing PE\n"); } else { - mm_context_remove_copro(pe_data->mm); - mmdrop(pe_data->mm); + if (pe_data->mm) { + mm_context_remove_copro(pe_data->mm); + mmdrop(pe_data->mm); + } kfree_rcu(pe_data, rcu); } unlock: -- Andrew Donnellan OzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited
Re: [PATCH] ocxl: do not use C++ style comments in uapi header
On 4/6/19 10:12 pm, Masahiro Yamada wrote: On Tue, Jun 4, 2019 at 8:54 PM Frederic Barrat wrote: Le 04/06/2019 à 13:16, Masahiro Yamada a écrit : Linux kernel tolerates C++ style comments these days. Actually, the SPDX License tags for .c files start with //. On the other hand, uapi headers are written in more strict C, where the C++ comment style is forbidden. Signed-off-by: Masahiro Yamada --- Thanks! Acked-by: Frederic Barrat Please hold on this patch until we get consensus about the C++ comment style. Discussion just started here: https://lore.kernel.org/patchwork/patch/1083801/ If you choose to proceed with this patch: Acked-by: Andrew Donnellan -- Andrew Donnellan OzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited
Re: [PATCH v4 1/7] ocxl: Split pci.c
On 27/3/19 4:31 pm, Alastair D'Silva wrote: From: Alastair D'Silva In preparation for making core code available for external drivers, move the core code out of pci.c and into core.c Signed-off-by: Alastair D'Silva There doesn't seem to be much left in pci.c, is there? Acked-by: Andrew Donnellan --- drivers/misc/ocxl/Makefile| 1 + drivers/misc/ocxl/core.c | 517 + drivers/misc/ocxl/ocxl_internal.h | 5 + drivers/misc/ocxl/pci.c | 519 +- 4 files changed, 524 insertions(+), 518 deletions(-) create mode 100644 drivers/misc/ocxl/core.c diff --git a/drivers/misc/ocxl/Makefile b/drivers/misc/ocxl/Makefile index 5229dcda8297..bc4e39bfda7b 100644 --- a/drivers/misc/ocxl/Makefile +++ b/drivers/misc/ocxl/Makefile @@ -3,6 +3,7 @@ ccflags-$(CONFIG_PPC_WERROR)+= -Werror ocxl-y+= main.o pci.o config.o file.o pasid.o ocxl-y+= link.o context.o afu_irq.o sysfs.o trace.o +ocxl-y += core.o obj-$(CONFIG_OCXL)+= ocxl.o # For tracepoints to include our trace.h from tracepoint infrastructure: diff --git a/drivers/misc/ocxl/core.c b/drivers/misc/ocxl/core.c new file mode 100644 index ..1a4411b72d35 --- /dev/null +++ b/drivers/misc/ocxl/core.c @@ -0,0 +1,517 @@ +// SPDX-License-Identifier: GPL-2.0+ +// Copyright 2019 IBM Corp. +#include +#include "ocxl_internal.h" + +static struct ocxl_fn *ocxl_fn_get(struct ocxl_fn *fn) +{ + return (get_device(>dev) == NULL) ? NULL : fn; +} + +static void ocxl_fn_put(struct ocxl_fn *fn) +{ + put_device(>dev); +} + +struct ocxl_afu *ocxl_afu_get(struct ocxl_afu *afu) +{ + return (get_device(>dev) == NULL) ? NULL : afu; +} + +void ocxl_afu_put(struct ocxl_afu *afu) +{ + put_device(>dev); +} + +static struct ocxl_afu *alloc_afu(struct ocxl_fn *fn) +{ + struct ocxl_afu *afu; + + afu = kzalloc(sizeof(struct ocxl_afu), GFP_KERNEL); + if (!afu) + return NULL; + + mutex_init(>contexts_lock); + mutex_init(>afu_control_lock); + idr_init(>contexts_idr); + afu->fn = fn; + ocxl_fn_get(fn); + return afu; +} + +static void free_afu(struct ocxl_afu *afu) +{ + idr_destroy(>contexts_idr); + ocxl_fn_put(afu->fn); + kfree(afu); +} + +static void free_afu_dev(struct device *dev) +{ + struct ocxl_afu *afu = to_ocxl_afu(dev); + + ocxl_unregister_afu(afu); + free_afu(afu); +} + +static int set_afu_device(struct ocxl_afu *afu, const char *location) +{ + struct ocxl_fn *fn = afu->fn; + int rc; + + afu->dev.parent = >dev; + afu->dev.release = free_afu_dev; + rc = dev_set_name(>dev, "%s.%s.%hhu", afu->config.name, location, + afu->config.idx); + return rc; +} + +static int assign_afu_actag(struct ocxl_afu *afu, struct pci_dev *dev) +{ + struct ocxl_fn *fn = afu->fn; + int actag_count, actag_offset; + + /* +* if there were not enough actags for the function, each afu +* reduces its count as well +*/ + actag_count = afu->config.actag_supported * + fn->actag_enabled / fn->actag_supported; + actag_offset = ocxl_actag_afu_alloc(fn, actag_count); + if (actag_offset < 0) { + dev_err(>dev, "Can't allocate %d actags for AFU: %d\n", + actag_count, actag_offset); + return actag_offset; + } + afu->actag_base = fn->actag_base + actag_offset; + afu->actag_enabled = actag_count; + + ocxl_config_set_afu_actag(dev, afu->config.dvsec_afu_control_pos, + afu->actag_base, afu->actag_enabled); + dev_dbg(>dev, "actag base=%d enabled=%d\n", + afu->actag_base, afu->actag_enabled); + return 0; +} + +static void reclaim_afu_actag(struct ocxl_afu *afu) +{ + struct ocxl_fn *fn = afu->fn; + int start_offset, size; + + start_offset = afu->actag_base - fn->actag_base; + size = afu->actag_enabled; + ocxl_actag_afu_free(afu->fn, start_offset, size); +} + +static int assign_afu_pasid(struct ocxl_afu *afu, struct pci_dev *dev) +{ + struct ocxl_fn *fn = afu->fn; + int pasid_count, pasid_offset; + + /* +* We only support the case where the function configuration +* requested enough PASIDs to cover all AFUs. +*/ + pasid_count = 1 << afu->config.pasid_supported_log; + pasid_offset = ocxl_pasid_afu_alloc(fn, pasid_count); + if (pasid_offset < 0) { + dev_err(>dev, "Can't allocate %d PASIDs for AFU: %d\n", + pasid_count, pasid_offset); + return pasid_offset;
Re: [PATCH v3 3/5] powerpc: Use the correct style for SPDX License Identifier
On 17/4/19 1:28 am, Nishad Kamdar wrote: This patch corrects the SPDX License Identifier style in the powerpc Hardware Architecture related files. Suggested-by: Joe Perches Signed-off-by: Nishad Kamdar --- TIL there's a different style for source vs headers... sigh. :( Thanks for fixing. Acked-by: Andrew Donnellan arch/powerpc/include/asm/pnv-ocxl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/pnv-ocxl.h b/arch/powerpc/include/asm/pnv-ocxl.h index 208b5503f4ed..7de82647e761 100644 --- a/arch/powerpc/include/asm/pnv-ocxl.h +++ b/arch/powerpc/include/asm/pnv-ocxl.h @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: GPL-2.0+ +/* SPDX-License-Identifier: GPL-2.0+ */ // Copyright 2017 IBM Corp. #ifndef _ASM_PNV_OCXL_H #define _ASM_PNV_OCXL_H -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH 5/5] ocxl: Remove some unused exported symbols
On 15/3/19 3:49 pm, Andrew Donnellan wrote: On 13/3/19 3:07 pm, Alastair D'Silva wrote: From: Alastair D'Silva Remove some unused exported symbols. Signed-off-by: Alastair D'Silva See comments on v1 Also a couple of sparse warnings at https://openpower.xyz/job/snowpatch/job/snowpatch-linux-sparse/4474//artifact/linux/actual_sparse_diff.txt --- drivers/misc/ocxl/config.c | 2 -- drivers/misc/ocxl/ocxl_internal.h | 23 +++ include/misc/ocxl.h | 23 --- 3 files changed, 23 insertions(+), 25 deletions(-) diff --git a/drivers/misc/ocxl/config.c b/drivers/misc/ocxl/config.c index 026ac2ac4f9c..c90c2e4875bf 100644 --- a/drivers/misc/ocxl/config.c +++ b/drivers/misc/ocxl/config.c @@ -299,7 +299,6 @@ int ocxl_config_check_afu_index(struct pci_dev *dev, } return 1; } -EXPORT_SYMBOL_GPL(ocxl_config_check_afu_index); static int read_afu_name(struct pci_dev *dev, struct ocxl_fn_config *fn, struct ocxl_afu_config *afu) @@ -535,7 +534,6 @@ int ocxl_config_get_pasid_info(struct pci_dev *dev, int *count) { return pnv_ocxl_get_pasid_count(dev, count); } -EXPORT_SYMBOL_GPL(ocxl_config_get_pasid_info); void ocxl_config_set_afu_pasid(struct pci_dev *dev, int pos, int pasid_base, u32 pasid_count_log) diff --git a/drivers/misc/ocxl/ocxl_internal.h b/drivers/misc/ocxl/ocxl_internal.h index 321b29e77f45..06fd98c989c8 100644 --- a/drivers/misc/ocxl/ocxl_internal.h +++ b/drivers/misc/ocxl/ocxl_internal.h @@ -107,6 +107,29 @@ void ocxl_pasid_afu_free(struct ocxl_fn *fn, u32 start, u32 size); int ocxl_actag_afu_alloc(struct ocxl_fn *fn, u32 size); void ocxl_actag_afu_free(struct ocxl_fn *fn, u32 start, u32 size); +/* + * Get the max PASID value that can be used by the function + */ +int ocxl_config_get_pasid_info(struct pci_dev *dev, int *count); + +/* + * Check if an AFU index is valid for the given function. + * + * AFU indexes can be sparse, so a driver should check all indexes up + * to the maximum found in the function description + */ +int ocxl_config_check_afu_index(struct pci_dev *dev, + struct ocxl_fn_config *fn, int afu_idx); + +/** + * Update values within a Process Element + * + * link_handle: the link handle associated with the process element + * pasid: the PASID for the AFU context + * tid: the new thread id for the process element + */ +int ocxl_link_update_pe(void *link_handle, int pasid, __u16 tid); + struct ocxl_context *ocxl_context_alloc(void); int ocxl_context_init(struct ocxl_context *ctx, struct ocxl_afu *afu, struct address_space *mapping); diff --git a/include/misc/ocxl.h b/include/misc/ocxl.h index 4544573cc93c..9530d3be1b30 100644 --- a/include/misc/ocxl.h +++ b/include/misc/ocxl.h @@ -56,15 +56,6 @@ struct ocxl_fn_config { int ocxl_config_read_function(struct pci_dev *dev, struct ocxl_fn_config *fn); -/* - * Check if an AFU index is valid for the given function. - * - * AFU indexes can be sparse, so a driver should check all indexes up - * to the maximum found in the function description - */ -int ocxl_config_check_afu_index(struct pci_dev *dev, - struct ocxl_fn_config *fn, int afu_idx); - /* * Read the configuration space of a function for the AFU specified by * the index 'afu_idx'. Fills in a ocxl_afu_config structure @@ -74,11 +65,6 @@ int ocxl_config_read_afu(struct pci_dev *dev, struct ocxl_afu_config *afu, u8 afu_idx); -/* - * Get the max PASID value that can be used by the function - */ -int ocxl_config_get_pasid_info(struct pci_dev *dev, int *count); - /* * Tell an AFU, by writing in the configuration space, the PASIDs that * it can use. Range starts at 'pasid_base' and its size is a multiple @@ -188,15 +174,6 @@ int ocxl_link_add_pe(void *link_handle, int pasid, u32 pidr, u32 tidr, void (*xsl_err_cb)(void *data, u64 addr, u64 dsisr), void *xsl_err_data); -/** - * Update values within a Process Element - * - * link_handle: the link handle associated with the process element - * pasid: the PASID for the AFU context - * tid: the new thread id for the process element - */ -int ocxl_link_update_pe(void *link_handle, int pasid, __u16 tid); - /* * Remove a Process Element from the Shared Process Area for a link */ -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH 5/5] ocxl: Remove some unused exported symbols
On 13/3/19 3:07 pm, Alastair D'Silva wrote: From: Alastair D'Silva Remove some unused exported symbols. Signed-off-by: Alastair D'Silva See comments on v1 --- drivers/misc/ocxl/config.c| 2 -- drivers/misc/ocxl/ocxl_internal.h | 23 +++ include/misc/ocxl.h | 23 --- 3 files changed, 23 insertions(+), 25 deletions(-) diff --git a/drivers/misc/ocxl/config.c b/drivers/misc/ocxl/config.c index 026ac2ac4f9c..c90c2e4875bf 100644 --- a/drivers/misc/ocxl/config.c +++ b/drivers/misc/ocxl/config.c @@ -299,7 +299,6 @@ int ocxl_config_check_afu_index(struct pci_dev *dev, } return 1; } -EXPORT_SYMBOL_GPL(ocxl_config_check_afu_index); static int read_afu_name(struct pci_dev *dev, struct ocxl_fn_config *fn, struct ocxl_afu_config *afu) @@ -535,7 +534,6 @@ int ocxl_config_get_pasid_info(struct pci_dev *dev, int *count) { return pnv_ocxl_get_pasid_count(dev, count); } -EXPORT_SYMBOL_GPL(ocxl_config_get_pasid_info); void ocxl_config_set_afu_pasid(struct pci_dev *dev, int pos, int pasid_base, u32 pasid_count_log) diff --git a/drivers/misc/ocxl/ocxl_internal.h b/drivers/misc/ocxl/ocxl_internal.h index 321b29e77f45..06fd98c989c8 100644 --- a/drivers/misc/ocxl/ocxl_internal.h +++ b/drivers/misc/ocxl/ocxl_internal.h @@ -107,6 +107,29 @@ void ocxl_pasid_afu_free(struct ocxl_fn *fn, u32 start, u32 size); int ocxl_actag_afu_alloc(struct ocxl_fn *fn, u32 size); void ocxl_actag_afu_free(struct ocxl_fn *fn, u32 start, u32 size); +/* + * Get the max PASID value that can be used by the function + */ +int ocxl_config_get_pasid_info(struct pci_dev *dev, int *count); + +/* + * Check if an AFU index is valid for the given function. + * + * AFU indexes can be sparse, so a driver should check all indexes up + * to the maximum found in the function description + */ +int ocxl_config_check_afu_index(struct pci_dev *dev, + struct ocxl_fn_config *fn, int afu_idx); + +/** + * Update values within a Process Element + * + * link_handle: the link handle associated with the process element + * pasid: the PASID for the AFU context + * tid: the new thread id for the process element + */ +int ocxl_link_update_pe(void *link_handle, int pasid, __u16 tid); + struct ocxl_context *ocxl_context_alloc(void); int ocxl_context_init(struct ocxl_context *ctx, struct ocxl_afu *afu, struct address_space *mapping); diff --git a/include/misc/ocxl.h b/include/misc/ocxl.h index 4544573cc93c..9530d3be1b30 100644 --- a/include/misc/ocxl.h +++ b/include/misc/ocxl.h @@ -56,15 +56,6 @@ struct ocxl_fn_config { int ocxl_config_read_function(struct pci_dev *dev, struct ocxl_fn_config *fn); -/* - * Check if an AFU index is valid for the given function. - * - * AFU indexes can be sparse, so a driver should check all indexes up - * to the maximum found in the function description - */ -int ocxl_config_check_afu_index(struct pci_dev *dev, - struct ocxl_fn_config *fn, int afu_idx); - /* * Read the configuration space of a function for the AFU specified by * the index 'afu_idx'. Fills in a ocxl_afu_config structure @@ -74,11 +65,6 @@ int ocxl_config_read_afu(struct pci_dev *dev, struct ocxl_afu_config *afu, u8 afu_idx); -/* - * Get the max PASID value that can be used by the function - */ -int ocxl_config_get_pasid_info(struct pci_dev *dev, int *count); - /* * Tell an AFU, by writing in the configuration space, the PASIDs that * it can use. Range starts at 'pasid_base' and its size is a multiple @@ -188,15 +174,6 @@ int ocxl_link_add_pe(void *link_handle, int pasid, u32 pidr, u32 tidr, void (*xsl_err_cb)(void *data, u64 addr, u64 dsisr), void *xsl_err_data); -/** - * Update values within a Process Element - * - * link_handle: the link handle associated with the process element - * pasid: the PASID for the AFU context - * tid: the new thread id for the process element - */ -int ocxl_link_update_pe(void *link_handle, int pasid, __u16 tid); - /* * Remove a Process Element from the Shared Process Area for a link */ -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH 5/5] ocxl: Remove some unused exported symbols
On 27/2/19 3:57 pm, Alastair D'Silva wrote: From: Alastair D'Silva Remove some unused exported symbols. Signed-off-by: Alastair D'Silva > --- drivers/misc/ocxl/config.c| 2 -- drivers/misc/ocxl/ocxl_internal.h | 26 +- include/misc/ocxl.h | 23 --- 3 files changed, 25 insertions(+), 26 deletions(-) diff --git a/drivers/misc/ocxl/config.c b/drivers/misc/ocxl/config.c index 026ac2ac4f9c..c90c2e4875bf 100644 --- a/drivers/misc/ocxl/config.c +++ b/drivers/misc/ocxl/config.c @@ -299,7 +299,6 @@ int ocxl_config_check_afu_index(struct pci_dev *dev, } return 1; } -EXPORT_SYMBOL_GPL(ocxl_config_check_afu_index); static int read_afu_name(struct pci_dev *dev, struct ocxl_fn_config *fn, struct ocxl_afu_config *afu) @@ -535,7 +534,6 @@ int ocxl_config_get_pasid_info(struct pci_dev *dev, int *count) { return pnv_ocxl_get_pasid_count(dev, count); } -EXPORT_SYMBOL_GPL(ocxl_config_get_pasid_info); void ocxl_config_set_afu_pasid(struct pci_dev *dev, int pos, int pasid_base, u32 pasid_count_log) diff --git a/drivers/misc/ocxl/ocxl_internal.h b/drivers/misc/ocxl/ocxl_internal.h index 321b29e77f45..cd5a1e3cc950 100644 --- a/drivers/misc/ocxl/ocxl_internal.h +++ b/drivers/misc/ocxl/ocxl_internal.h @@ -107,10 +107,34 @@ void ocxl_pasid_afu_free(struct ocxl_fn *fn, u32 start, u32 size); int ocxl_actag_afu_alloc(struct ocxl_fn *fn, u32 size); void ocxl_actag_afu_free(struct ocxl_fn *fn, u32 start, u32 size); +/* + * Get the max PASID value that can be used by the function + */ +int ocxl_config_get_pasid_info(struct pci_dev *dev, int *count); + +int ocxl_context_attach(struct ocxl_context *ctx, u64 amr); + +/* + * Check if an AFU index is valid for the given function. + * + * AFU indexes can be sparse, so a driver should check all indexes up + * to the maximum found in the function description + */ +int ocxl_config_check_afu_index(struct pci_dev *dev, + struct ocxl_fn_config *fn, int afu_idx); + +/** + * Update values within a Process Element + * + * link_handle: the link handle associated with the process element + * pasid: the PASID for the AFU context + * tid: the new thread id for the process element + */ +int ocxl_link_update_pe(void *link_handle, int pasid, __u16 tid); + This isn't actually exported, so if you spin a v2 do that separately from this patch or document the change. Otherwise Acked-by: Andrew Donnellan struct ocxl_context *ocxl_context_alloc(void); int ocxl_context_init(struct ocxl_context *ctx, struct ocxl_afu *afu, struct address_space *mapping); -int ocxl_context_attach(struct ocxl_context *ctx, u64 amr); int ocxl_context_mmap(struct ocxl_context *ctx, struct vm_area_struct *vma); int ocxl_context_detach(struct ocxl_context *ctx); diff --git a/include/misc/ocxl.h b/include/misc/ocxl.h index 4544573cc93c..9530d3be1b30 100644 --- a/include/misc/ocxl.h +++ b/include/misc/ocxl.h @@ -56,15 +56,6 @@ struct ocxl_fn_config { int ocxl_config_read_function(struct pci_dev *dev, struct ocxl_fn_config *fn); -/* - * Check if an AFU index is valid for the given function. - * - * AFU indexes can be sparse, so a driver should check all indexes up - * to the maximum found in the function description - */ -int ocxl_config_check_afu_index(struct pci_dev *dev, - struct ocxl_fn_config *fn, int afu_idx); - /* * Read the configuration space of a function for the AFU specified by * the index 'afu_idx'. Fills in a ocxl_afu_config structure @@ -74,11 +65,6 @@ int ocxl_config_read_afu(struct pci_dev *dev, struct ocxl_afu_config *afu, u8 afu_idx); -/* - * Get the max PASID value that can be used by the function - */ -int ocxl_config_get_pasid_info(struct pci_dev *dev, int *count); - /* * Tell an AFU, by writing in the configuration space, the PASIDs that * it can use. Range starts at 'pasid_base' and its size is a multiple @@ -188,15 +174,6 @@ int ocxl_link_add_pe(void *link_handle, int pasid, u32 pidr, u32 tidr, void (*xsl_err_cb)(void *data, u64 addr, u64 dsisr), void *xsl_err_data); -/** - * Update values within a Process Element - * - * link_handle: the link handle associated with the process element - * pasid: the PASID for the AFU context - * tid: the new thread id for the process element - */ -int ocxl_link_update_pe(void *link_handle, int pasid, __u16 tid); - /* * Remove a Process Element from the Shared Process Area for a link */ -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH 4/5] ocxl: Remove superfluous 'extern' from headers
On 27/2/19 3:57 pm, Alastair D'Silva wrote: From: Alastair D'Silva The 'extern' keyword adds no value here. Signed-off-by: Alastair D'Silva Acked-by: Andrew Donnellan --- drivers/misc/ocxl/ocxl_internal.h | 54 +++ include/misc/ocxl.h | 36 ++--- 2 files changed, 44 insertions(+), 46 deletions(-) diff --git a/drivers/misc/ocxl/ocxl_internal.h b/drivers/misc/ocxl/ocxl_internal.h index a32f2151029f..321b29e77f45 100644 --- a/drivers/misc/ocxl/ocxl_internal.h +++ b/drivers/misc/ocxl/ocxl_internal.h @@ -16,7 +16,6 @@ extern struct pci_driver ocxl_pci_driver; - struct ocxl_fn { struct device dev; int bar_used[3]; @@ -92,41 +91,40 @@ struct ocxl_process_element { __be32 software_state; }; +struct ocxl_afu *ocxl_afu_get(struct ocxl_afu *afu); +void ocxl_afu_put(struct ocxl_afu *afu); -extern struct ocxl_afu *ocxl_afu_get(struct ocxl_afu *afu); -extern void ocxl_afu_put(struct ocxl_afu *afu); - -extern int ocxl_create_cdev(struct ocxl_afu *afu); -extern void ocxl_destroy_cdev(struct ocxl_afu *afu); -extern int ocxl_register_afu(struct ocxl_afu *afu); -extern void ocxl_unregister_afu(struct ocxl_afu *afu); +int ocxl_create_cdev(struct ocxl_afu *afu); +void ocxl_destroy_cdev(struct ocxl_afu *afu); +int ocxl_register_afu(struct ocxl_afu *afu); +void ocxl_unregister_afu(struct ocxl_afu *afu); -extern int ocxl_file_init(void); -extern void ocxl_file_exit(void); +int ocxl_file_init(void); +void ocxl_file_exit(void); -extern int ocxl_pasid_afu_alloc(struct ocxl_fn *fn, u32 size); -extern void ocxl_pasid_afu_free(struct ocxl_fn *fn, u32 start, u32 size); -extern int ocxl_actag_afu_alloc(struct ocxl_fn *fn, u32 size); -extern void ocxl_actag_afu_free(struct ocxl_fn *fn, u32 start, u32 size); +int ocxl_pasid_afu_alloc(struct ocxl_fn *fn, u32 size); +void ocxl_pasid_afu_free(struct ocxl_fn *fn, u32 start, u32 size); +int ocxl_actag_afu_alloc(struct ocxl_fn *fn, u32 size); +void ocxl_actag_afu_free(struct ocxl_fn *fn, u32 start, u32 size); -extern struct ocxl_context *ocxl_context_alloc(void); -extern int ocxl_context_init(struct ocxl_context *ctx, struct ocxl_afu *afu, +struct ocxl_context *ocxl_context_alloc(void); +int ocxl_context_init(struct ocxl_context *ctx, struct ocxl_afu *afu, struct address_space *mapping); -extern int ocxl_context_attach(struct ocxl_context *ctx, u64 amr); -extern int ocxl_context_mmap(struct ocxl_context *ctx, +int ocxl_context_attach(struct ocxl_context *ctx, u64 amr); +int ocxl_context_mmap(struct ocxl_context *ctx, struct vm_area_struct *vma); -extern int ocxl_context_detach(struct ocxl_context *ctx); -extern void ocxl_context_detach_all(struct ocxl_afu *afu); -extern void ocxl_context_free(struct ocxl_context *ctx); +int ocxl_context_detach(struct ocxl_context *ctx); +void ocxl_context_detach_all(struct ocxl_afu *afu); +void ocxl_context_free(struct ocxl_context *ctx); -extern int ocxl_sysfs_add_afu(struct ocxl_afu *afu); -extern void ocxl_sysfs_remove_afu(struct ocxl_afu *afu); +int ocxl_sysfs_add_afu(struct ocxl_afu *afu); +void ocxl_sysfs_remove_afu(struct ocxl_afu *afu); -extern int ocxl_afu_irq_alloc(struct ocxl_context *ctx, u64 *irq_offset); -extern int ocxl_afu_irq_free(struct ocxl_context *ctx, u64 irq_offset); -extern void ocxl_afu_irq_free_all(struct ocxl_context *ctx); -extern int ocxl_afu_irq_set_fd(struct ocxl_context *ctx, u64 irq_offset, +int ocxl_afu_irq_alloc(struct ocxl_context *ctx, u64 *irq_offset); +int ocxl_afu_irq_free(struct ocxl_context *ctx, u64 irq_offset); +void ocxl_afu_irq_free_all(struct ocxl_context *ctx); +int ocxl_afu_irq_set_fd(struct ocxl_context *ctx, u64 irq_offset, int eventfd); -extern u64 ocxl_afu_irq_get_addr(struct ocxl_context *ctx, u64 irq_offset); +u64 ocxl_afu_irq_get_addr(struct ocxl_context *ctx, u64 irq_offset); #endif /* _OCXL_INTERNAL_H_ */ diff --git a/include/misc/ocxl.h b/include/misc/ocxl.h index 9ff6ddc28e22..4544573cc93c 100644 --- a/include/misc/ocxl.h +++ b/include/misc/ocxl.h @@ -53,7 +53,7 @@ struct ocxl_fn_config { * Read the configuration space of a function and fill in a * ocxl_fn_config structure with all the function details */ -extern int ocxl_config_read_function(struct pci_dev *dev, +int ocxl_config_read_function(struct pci_dev *dev, struct ocxl_fn_config *fn); /* @@ -62,14 +62,14 @@ extern int ocxl_config_read_function(struct pci_dev *dev, * AFU indexes can be sparse, so a driver should check all indexes up * to the maximum found in the function description */ -extern int ocxl_config_check_afu_index(struct pci_dev *dev, +int ocxl_config_check_afu_index(struct pci_dev *dev, struct ocxl_fn_config *fn, int afu_idx); /* * Read the configuration space of a function for the AFU specified by * the index 'afu_idx
Re: [PATCH 3/5] ocxl: read_pasid never returns an error, so make it void
On 27/2/19 3:57 pm, Alastair D'Silva wrote: From: Alastair D'Silva No need for a return value in read_pasid as it only returns 0. Signed-off-by: Alastair D'Silva Reviewed-by: Greg Kurz Acked-by: Andrew Donnellan --- drivers/misc/ocxl/config.c | 9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/misc/ocxl/config.c b/drivers/misc/ocxl/config.c index 0ee7856b033d..026ac2ac4f9c 100644 --- a/drivers/misc/ocxl/config.c +++ b/drivers/misc/ocxl/config.c @@ -68,7 +68,7 @@ static int find_dvsec_afu_ctrl(struct pci_dev *dev, u8 afu_idx) return 0; } -static int read_pasid(struct pci_dev *dev, struct ocxl_fn_config *fn) +static void read_pasid(struct pci_dev *dev, struct ocxl_fn_config *fn) { u16 val; int pos; @@ -89,7 +89,6 @@ static int read_pasid(struct pci_dev *dev, struct ocxl_fn_config *fn) out: dev_dbg(>dev, "PASID capability:\n"); dev_dbg(>dev, " Max PASID log = %d\n", fn->max_pasid_log); - return 0; } static int read_dvsec_tl(struct pci_dev *dev, struct ocxl_fn_config *fn) @@ -205,11 +204,7 @@ int ocxl_config_read_function(struct pci_dev *dev, struct ocxl_fn_config *fn) { int rc; - rc = read_pasid(dev, fn); - if (rc) { - dev_err(>dev, "Invalid PASID configuration: %d\n", rc); - return -ENODEV; - } + read_pasid(dev, fn); rc = read_dvsec_tl(dev, fn); if (rc) { -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH 2/5] ocxl: Clean up printf formats
On 27/2/19 3:57 pm, Alastair D'Silva wrote: From: Alastair D'Silva Use %# instead of using a literal '0x' Signed-off-by: Alastair D'Silva Not hugely fussed either way, but today I learned about %#... Acked-by: Andrew Donnellan --- drivers/misc/ocxl/config.c | 6 +++--- drivers/misc/ocxl/context.c | 2 +- drivers/misc/ocxl/trace.h | 10 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/misc/ocxl/config.c b/drivers/misc/ocxl/config.c index 8f2c5d8bd2ee..0ee7856b033d 100644 --- a/drivers/misc/ocxl/config.c +++ b/drivers/misc/ocxl/config.c @@ -178,9 +178,9 @@ static int read_dvsec_vendor(struct pci_dev *dev) pci_read_config_dword(dev, pos + OCXL_DVSEC_VENDOR_DLX_VERS, ); dev_dbg(>dev, "Vendor specific DVSEC:\n"); - dev_dbg(>dev, " CFG version = 0x%x\n", cfg); - dev_dbg(>dev, " TLX version = 0x%x\n", tlx); - dev_dbg(>dev, " DLX version = 0x%x\n", dlx); + dev_dbg(>dev, " CFG version = %#x\n", cfg); + dev_dbg(>dev, " TLX version = %#x\n", tlx); + dev_dbg(>dev, " DLX version = %#x\n", dlx); return 0; } diff --git a/drivers/misc/ocxl/context.c b/drivers/misc/ocxl/context.c index c10a940e3b38..3498a0199bde 100644 --- a/drivers/misc/ocxl/context.c +++ b/drivers/misc/ocxl/context.c @@ -134,7 +134,7 @@ static vm_fault_t ocxl_mmap_fault(struct vm_fault *vmf) vm_fault_t ret; offset = vmf->pgoff << PAGE_SHIFT; - pr_debug("%s: pasid %d address 0x%lx offset 0x%llx\n", __func__, + pr_debug("%s: pasid %d address %#lx offset %#llx\n", __func__, ctx->pasid, vmf->address, offset); if (offset < ctx->afu->irq_base_offset) diff --git a/drivers/misc/ocxl/trace.h b/drivers/misc/ocxl/trace.h index bcb7ff330c1e..8d2f53812edd 100644 --- a/drivers/misc/ocxl/trace.h +++ b/drivers/misc/ocxl/trace.h @@ -28,7 +28,7 @@ DECLARE_EVENT_CLASS(ocxl_context, __entry->tidr = tidr; ), - TP_printk("linux pid=%d spa=0x%p pasid=0x%x pidr=0x%x tidr=0x%x", + TP_printk("linux pid=%d spa=%p pasid=%#x pidr=%#x tidr=%#x", __entry->pid, __entry->spa, __entry->pasid, @@ -61,7 +61,7 @@ TRACE_EVENT(ocxl_terminate_pasid, __entry->rc = rc; ), - TP_printk("pasid=0x%x rc=%d", + TP_printk("pasid=%#x rc=%d", __entry->pasid, __entry->rc ) @@ -87,7 +87,7 @@ DECLARE_EVENT_CLASS(ocxl_fault_handler, __entry->tfc = tfc; ), - TP_printk("spa=%p pe=0x%llx dsisr=0x%llx dar=0x%llx tfc=0x%llx", + TP_printk("spa=%p pe=%#llx dsisr=%#llx dar=%#llx tfc=%#llx", __entry->spa, __entry->pe, __entry->dsisr, @@ -127,7 +127,7 @@ TRACE_EVENT(ocxl_afu_irq_alloc, __entry->irq_offset = irq_offset; ), - TP_printk("pasid=0x%x irq_id=%d virq=%u hw_irq=%d irq_offset=0x%llx", + TP_printk("pasid=%#x irq_id=%d virq=%u hw_irq=%d irq_offset=0x%llx", __entry->pasid, __entry->irq_id, __entry->virq, @@ -150,7 +150,7 @@ TRACE_EVENT(ocxl_afu_irq_free, __entry->irq_id = irq_id; ), - TP_printk("pasid=0x%x irq_id=%d", + TP_printk("pasid=%#x irq_id=%d", __entry->pasid, __entry->irq_id ) -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH 1/5] ocxl: Rename struct link to ocxl_link
On 27/2/19 7:04 pm, Alastair D'Silva wrote: -Original Message- From: Andrew Donnellan Sent: Wednesday, 27 February 2019 6:55 PM To: Alastair D'Silva ; 'Alastair D'Silva' Cc: 'Greg Kurz' ; 'Frederic Barrat' ; 'Arnd Bergmann' ; 'Greg Kroah- Hartman' ; linuxppc-...@lists.ozlabs.org; linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/5] ocxl: Rename struct link to ocxl_link On 27/2/19 6:34 pm, Alastair D'Silva wrote:>>> diff --git a/drivers/misc/ocxl/file.c b/drivers/misc/ocxl/file.c index e6a607488f8a..16eb8a60d5c7 100644 --- a/drivers/misc/ocxl/file.c +++ b/drivers/misc/ocxl/file.c @@ -152,7 +152,7 @@ static long afu_ioctl_enable_p9_wait(struct ocxl_context *ctx, if (status == ATTACHED) { int rc; - struct link *link = ctx->afu->fn->link; + void *link = ctx->afu->fn->link; This doesn't look like a rename... That corrects the type to what the member (and prototype for ocxl_link_update_pe) declare it as. The struct link there is bogus, it shouldn't even compile (since the intended struct link is defined in a different compilation unit), but instead picks up a different definition of 'struct link' from elsewhere. Given there's only a handful of struct links defined across the entire kernel, I'm going to guess that the definition it's picking up is in fact the ocxl one. Unlikely, since that's never in a header. It wasn't caught since it was assigned to/from a void*. Ah, yeah that'd explain it... and it's a pointer so it never needs to know its size. I'm clearly not very good at C. I think the better solution here is to move struct ocxl_link into ocxl_internal.h, change ocxl_fn::link to be struct ocxl_link * rather than void *, and update the function signature for ocxl_link_update_pe() as well. Not move it, but we could have an opaque declaration there. Putting it there would fit with all the other ocxl_* structs, but either way, we definitely need a declaration in there and get rid of the void*, t -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH 1/5] ocxl: Rename struct link to ocxl_link
On 27/2/19 6:34 pm, Alastair D'Silva wrote:>>> diff --git a/drivers/misc/ocxl/file.c b/drivers/misc/ocxl/file.c index e6a607488f8a..16eb8a60d5c7 100644 --- a/drivers/misc/ocxl/file.c +++ b/drivers/misc/ocxl/file.c @@ -152,7 +152,7 @@ static long afu_ioctl_enable_p9_wait(struct ocxl_context *ctx, if (status == ATTACHED) { int rc; - struct link *link = ctx->afu->fn->link; + void *link = ctx->afu->fn->link; This doesn't look like a rename... That corrects the type to what the member (and prototype for ocxl_link_update_pe) declare it as. The struct link there is bogus, it shouldn't even compile (since the intended struct link is defined in a different compilation unit), but instead picks up a different definition of 'struct link' from elsewhere. Given there's only a handful of struct links defined across the entire kernel, I'm going to guess that the definition it's picking up is in fact the ocxl one. I think the better solution here is to move struct ocxl_link into ocxl_internal.h, change ocxl_fn::link to be struct ocxl_link * rather than void *, and update the function signature for ocxl_link_update_pe() as well. -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH 1/5] ocxl: Rename struct link to ocxl_link
struct spa *spa = link->spa; struct ocxl_process_element *pe; int pe_handle, rc = 0; @@ -558,7 +558,7 @@ EXPORT_SYMBOL_GPL(ocxl_link_add_pe); int ocxl_link_update_pe(void *link_handle, int pasid, __u16 tid) { - struct link *link = (struct link *) link_handle; + struct ocxl_link *link = (struct ocxl_link *) link_handle; struct spa *spa = link->spa; struct ocxl_process_element *pe; int pe_handle, rc; @@ -594,7 +594,7 @@ int ocxl_link_update_pe(void *link_handle, int pasid, __u16 tid) int ocxl_link_remove_pe(void *link_handle, int pasid) { - struct link *link = (struct link *) link_handle; + struct ocxl_link *link = (struct ocxl_link *) link_handle; struct spa *spa = link->spa; struct ocxl_process_element *pe; struct pe_data *pe_data; @@ -666,7 +666,7 @@ EXPORT_SYMBOL_GPL(ocxl_link_remove_pe); int ocxl_link_irq_alloc(void *link_handle, int *hw_irq, u64 *trigger_addr) { - struct link *link = (struct link *) link_handle; + struct ocxl_link *link = (struct ocxl_link *) link_handle; int rc, irq; u64 addr; @@ -687,7 +687,7 @@ EXPORT_SYMBOL_GPL(ocxl_link_irq_alloc); void ocxl_link_free_irq(void *link_handle, int hw_irq) { - struct link *link = (struct link *) link_handle; + struct ocxl_link *link = (struct ocxl_link *) link_handle; pnv_ocxl_free_xive_irq(hw_irq); atomic_inc(>irq_available); -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH v2 1/5] drivers/accel: Introduce subsystem
[+ linuxppc-dev, because cxl/ocxl are handled through powerpc - please cc on future versions of this series] On 26/1/19 8:13 am, Olof Johansson wrote: We're starting to see more of these kind of devices, the current upcoming wave will likely be around machine learning and inference engines. A few drivers have been added to drivers/misc for this, but it's timely to make it into a separate group of drivers/subsystem, to make it easier to find them, and to encourage collaboration between contributors. Over time, we expect to build shared frameworks that the drivers will make use of, but how that framework needs to look like to fill the needs is still unclear, and the best way to gain that knowledge is to give the disparate implementations a shared location. There has been some controversy around expectations for userspace stacks being open. The clear preference is to see that happen, and any driver and platform stack that is delivered like that will be given preferential treatment, and at some point in the future it might become the requirement. Until then, the bare minimum we need is an open low-level userspace such that the driver and HW interfaces can be exercised if someone is modifying the driver, even if the full details of the workload are not always available. Bootstrapping this with myself and Greg as maintainers (since the current drivers will be moving out of drivers/misc). Looking forward to expanding that group over time. [snip] + +Hardware offload accelerator subsystem +== + +This is a brief overview of the subsystem (grouping) of hardware +accelerators kept under drivers/accel + +Types of hardware supported +--- + + The general types of hardware supported are hardware devices that has + general interactions of sending commands and buffers to the hardware, + returning completions and possible filled buffers back, together + with the usual driver pieces around hardware control, setup, error + handling, etc. + + Drivers that fit into other subsystems are expected to be merged + there, and use the appropriate userspace interfaces of said functional + areas. We don't expect to see drivers for network, storage, graphics + and similar hardware implemented by drivers here. + +Expectations for contributions +-- + + - Platforms and hardware that has fully open stacks, from Firmware to + Userspace, are always going to be given preferential treatment. These + platforms give the best insight for behavior and interaction of all + layers, including ability to improve implementation across the stack + over time. + + - If a platform is partially proprietary, it is still expected that the + portions that interact the driver can be shared in a form that allows + for exercising the hardware/driver and evolution of the interface over + time. This could be separated into a shared library and test/sample + programs, for example. + + - Over time, there is an expectation to converge drivers over to shared + frameworks and interfaces. Until then, the general rule is that no + more than one driver per vendor will be acceptable. For vendors that + aren't participating in the work towards shared frameworks over time, + we reserve the right to phase out support for the hardware. How exactly do generic drivers for interconnect protocols, such as cxl/ocxl, fit in here? cxl and ocxl are not drivers for a specific device, they are generic drivers which can be used with any device implementing the CAPI or OpenCAPI protocol respectively - many of which will be FPGA boards flashed with customer-designed accelerator cores for specific workloads, some will be accelerators using ASICs or using FPGA images supplied by vendors, some will be driven from userspace, others using the cxl/ocxl kernel API, etc. -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH 00/15] Habana Labs kernel driver
On 24/1/19 8:52 am, Olof Johansson wrote: But, I think the largest question I have (for a broader audience) is: I predict that we will see a handful of these kind of devices over the upcoming future -- definitely from ML accelerators but maybe also for other kinds of processing, where there's a command-based, buffer-based setup sending workloads to an offload engine and getting results back. While the first waves will all look different due to design trade-offs made in isolation, I think it makes sense to group them in one bucket instead of merging them through drivers/misc, if nothing else to encourage more cross-collaboration over time. First steps in figuring out long-term suitable frameworks is to get a survey of a few non-shared implementations. So, I'd like to propose a drivers/accel drivers subtree, and I'd be happy to bootstrap it with a small group (@Dave Airlie: I think your input from GPU land be very useful, want to join in?). Individual drivers maintained by existing maintainers, of course. I think it might make sense to move the CAPI/OpenCAPI drivers over as well -- not necessarily to change those drivers, but to group them with the rest as more show up. For cxl/ocxl, I have no objection to moving to this new subtree if that's what we all agree to do. (what do people do about UAPI headers in this situation? keep them where they are in misc/?) If we do go ahead and set up this new subtree, perhaps we can use the mailing list I set up at linux-accelerat...@lists.ozlabs.org but we haven't really started using... -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH] docs: Bump version to 5.x
On 14/1/19 5:12 pm, Joel Stanley wrote: This shows up in the index of https://www.kernel.org/doc/html/latest/ so I figured it should be updated. Fixes: bfeffd15528 ("Linux 5.0-rc1") Signed-off-by: Joel Stanley -- We could also remove the version number instead of applying this patch. You missed all the 4.x references in "Installing the kernel source" :) I also don't think the README matches the contemporary understanding of "release notes" so perhaps that phrase should be dropped too. --- Documentation/admin-guide/README.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Documentation/admin-guide/README.rst b/Documentation/admin-guide/README.rst index 0797eec76be1..a09baa324951 100644 --- a/Documentation/admin-guide/README.rst +++ b/Documentation/admin-guide/README.rst @@ -1,9 +1,9 @@ .. _readme: -Linux kernel release 4.x <http://kernel.org/> +Linux kernel release 5.x <http://kernel.org/> = -These are the release notes for Linux version 4. Read them carefully, +These are the release notes for Linux version 5. Read them carefully, as they tell you what this is all about, explain how to install the kernel, and what to do if something goes wrong. @@ -406,3 +406,4 @@ If something goes wrong gdb'ing a non-running kernel currently fails because ``gdb`` (wrongly) disregards the starting offset for which the kernel is compiled. + -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [ANNOUNCE] Call for Papers - linux.conf.au Kernel Miniconf, Christchurch NZ, 21-25 Jan 2019
On 21/10/18 12:10 pm, Andrew Donnellan wrote: The linux.conf.au Kernel Miniconf is happening once again, this time in Christchurch on 22 Jan 2019. *** Submissions close on 2018-12-16, 23:59 AoE, with early submissions (before 2018-11-16, 23:59 AoE) given priority. *** This deadline is in just under 53 hours, and will not be extended. *** Submission details: http://lca-kernel.ozlabs.org/2019-cfp.html *** The Kernel Miniconf is a 1 day stream alongside the main LCA conference to talk about kernel stuff. We invite submissions on anything related to kernel and low-level systems programming. We welcome submissions from developers of all levels of experience in the kernel community, covering a broad range of topics. Past Kernel Miniconfs have included technical talks on topics such as memory management, RCU, scheduling and filesystems, as well as talks on Linux kernel community topics such as licensing and Linux kernel development process. We strongly encourage both first-time and seasoned speakers from all backgrounds, ages, genders, nationalities, ethnicities, religions and abilities. Like the main LCA conference itself, we respect and encourage diversity at our miniconf. Speakers will need to purchase an LCA ticket to attend. See http://lca-kernel.ozlabs.org/2019-cfp.html for full details and the submission form. -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
[ANNOUNCE] Call for Papers - linux.conf.au Kernel Miniconf, Christchurch NZ, 21-25 Jan 2019
The linux.conf.au Kernel Miniconf is happening once again, this time in Christchurch on 22 Jan 2019. *** Submissions close on 2018-12-16, 23:59 AoE, with early submissions (before 2018-11-16, 23:59 AoE) given priority. *** *** Submission details: http://lca-kernel.ozlabs.org/2019-cfp.html *** The Kernel Miniconf is a 1 day stream alongside the main LCA conference to talk about kernel stuff. We invite submissions on anything related to kernel and low-level systems programming. We welcome submissions from developers of all levels of experience in the kernel community, covering a broad range of topics. Past Kernel Miniconfs have included technical talks on topics such as memory management, RCU, scheduling and filesystems, as well as talks on Linux kernel community topics such as licensing and Linux kernel development process. We strongly encourage both first-time and seasoned speakers from all backgrounds, ages, genders, nationalities, ethnicities, religions and abilities. Like the main LCA conference itself, we respect and encourage diversity at our miniconf. Speakers will need to purchase an LCA ticket to attend. See http://lca-kernel.ozlabs.org/2019-cfp.html for full details and the submission form. -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
[ANNOUNCE] Call for Papers - linux.conf.au Kernel Miniconf, Christchurch NZ, 21-25 Jan 2019
The linux.conf.au Kernel Miniconf is happening once again, this time in Christchurch on 22 Jan 2019. *** Submissions close on 2018-12-16, 23:59 AoE, with early submissions (before 2018-11-16, 23:59 AoE) given priority. *** *** Submission details: http://lca-kernel.ozlabs.org/2019-cfp.html *** The Kernel Miniconf is a 1 day stream alongside the main LCA conference to talk about kernel stuff. We invite submissions on anything related to kernel and low-level systems programming. We welcome submissions from developers of all levels of experience in the kernel community, covering a broad range of topics. Past Kernel Miniconfs have included technical talks on topics such as memory management, RCU, scheduling and filesystems, as well as talks on Linux kernel community topics such as licensing and Linux kernel development process. We strongly encourage both first-time and seasoned speakers from all backgrounds, ages, genders, nationalities, ethnicities, religions and abilities. Like the main LCA conference itself, we respect and encourage diversity at our miniconf. Speakers will need to purchase an LCA ticket to attend. See http://lca-kernel.ozlabs.org/2019-cfp.html for full details and the submission form. -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [RESEND PATCHv2] misc: cxl: Fix possible null pointer dereference
On 4/10/18 3:02 pm, zhong jiang wrote: It is not safe to dereference an object before a null test. It is not needed and just remove them. Ftrace can be used instead. Signed-off-by: zhong jiang Acked-by: Andrew Donnellan --- drivers/misc/cxl/guest.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/misc/cxl/guest.c b/drivers/misc/cxl/guest.c index 3bc0c15..5d28d9e 100644 --- a/drivers/misc/cxl/guest.c +++ b/drivers/misc/cxl/guest.c @@ -1018,8 +1018,6 @@ int cxl_guest_init_afu(struct cxl *adapter, int slice, struct device_node *afu_n void cxl_guest_remove_afu(struct cxl_afu *afu) { - pr_devel("in %s - AFU(%d)\n", __func__, afu->slice); - if (!afu) return; -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [RESEND PATCHv2] misc: cxl: Fix possible null pointer dereference
On 4/10/18 3:02 pm, zhong jiang wrote: It is not safe to dereference an object before a null test. It is not needed and just remove them. Ftrace can be used instead. Signed-off-by: zhong jiang Acked-by: Andrew Donnellan --- drivers/misc/cxl/guest.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/misc/cxl/guest.c b/drivers/misc/cxl/guest.c index 3bc0c15..5d28d9e 100644 --- a/drivers/misc/cxl/guest.c +++ b/drivers/misc/cxl/guest.c @@ -1018,8 +1018,6 @@ int cxl_guest_init_afu(struct cxl *adapter, int slice, struct device_node *afu_n void cxl_guest_remove_afu(struct cxl_afu *afu) { - pr_devel("in %s - AFU(%d)\n", __func__, afu->slice); - if (!afu) return; -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH] misc: cxl: Move a deference below a NULL test
On 26/9/18 9:41 pm, zhong jiang wrote: It is safe to move a deference below a NULL test. Signed-off-by: zhong jiang Thanks for catching this. Acked-by: Andrew Donnellan --- drivers/misc/cxl/guest.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/misc/cxl/guest.c b/drivers/misc/cxl/guest.c index 3bc0c15..559e835 100644 --- a/drivers/misc/cxl/guest.c +++ b/drivers/misc/cxl/guest.c @@ -1018,11 +1018,11 @@ int cxl_guest_init_afu(struct cxl *adapter, int slice, struct device_node *afu_n void cxl_guest_remove_afu(struct cxl_afu *afu) { - pr_devel("in %s - AFU(%d)\n", __func__, afu->slice); - if (!afu) return; + pr_devel("in %s - AFU(%d)\n", __func__, afu->slice); + /* flush and stop pending job */ afu->guest->handle_err = false; flush_delayed_work(>guest->work_err); -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH] misc: cxl: Move a deference below a NULL test
On 26/9/18 9:41 pm, zhong jiang wrote: It is safe to move a deference below a NULL test. Signed-off-by: zhong jiang Thanks for catching this. Acked-by: Andrew Donnellan --- drivers/misc/cxl/guest.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/misc/cxl/guest.c b/drivers/misc/cxl/guest.c index 3bc0c15..559e835 100644 --- a/drivers/misc/cxl/guest.c +++ b/drivers/misc/cxl/guest.c @@ -1018,11 +1018,11 @@ int cxl_guest_init_afu(struct cxl *adapter, int slice, struct device_node *afu_n void cxl_guest_remove_afu(struct cxl_afu *afu) { - pr_devel("in %s - AFU(%d)\n", __func__, afu->slice); - if (!afu) return; + pr_devel("in %s - AFU(%d)\n", __func__, afu->slice); + /* flush and stop pending job */ afu->guest->handle_err = false; flush_delayed_work(>guest->work_err); -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH v2 03/17] compat_ioctl: use correct compat_ptr() translation in drivers
On 13/09/18 01:01, Arnd Bergmann wrote: A handful of drivers all have a trivial wrapper around their ioctl handler, but don't call the compat_ptr() conversion function at the moment. In practice this does not matter, since none of them are used on the s390 architecture and for all other architectures, compat_ptr() does not do anything, but using the new generic_compat_ioctl_ptrarg helper makes it more correct in theory, and simplifies the code. Signed-off-by: Arnd Bergmann For cxl: Acked-by: Andrew Donnellan -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH v2 03/17] compat_ioctl: use correct compat_ptr() translation in drivers
On 13/09/18 01:01, Arnd Bergmann wrote: A handful of drivers all have a trivial wrapper around their ioctl handler, but don't call the compat_ptr() conversion function at the moment. In practice this does not matter, since none of them are used on the s390 architecture and for all other architectures, compat_ptr() does not do anything, but using the new generic_compat_ioctl_ptrarg helper makes it more correct in theory, and simplifies the code. Signed-off-by: Arnd Bergmann For cxl: Acked-by: Andrew Donnellan -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [RFC PATCH 1/2] checkpatch: Correctly detect git commit references that span 3 lines
On 06/08/18 15:07, Joe Perches wrote: The multiple line block code can be difficult to read. I 100% agree! My suggestion is to instead write a subroutine to get the commit description and compare that against the returned git commit description. I'll try and do it up more neatly when I've got some spare time over the next few days and send a v2. Thanks, -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [RFC PATCH 1/2] checkpatch: Correctly detect git commit references that span 3 lines
On 06/08/18 15:07, Joe Perches wrote: The multiple line block code can be difficult to read. I 100% agree! My suggestion is to instead write a subroutine to get the commit description and compare that against the returned git commit description. I'll try and do it up more neatly when I've got some spare time over the next few days and send a v2. Thanks, -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
[RFC PATCH 2/2] checkpatch: Fix commit ID test when "commit" and hash on different lines
Signed-off-by: Andrew Donnellan --- RFC because I'm bad at Perl --- scripts/checkpatch.pl | 32 +++- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index aca4d758112a..ae7a54287db7 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2662,40 +2662,46 @@ sub process { my $id = '0123456789ab'; my $orig_desc = "commit description"; my $description = ""; + my $ref_line = $line; - if ($line =~ /\b(c)ommit\s+([0-9a-f]{5,})\b/i) { + if ($ref_line =~ /\b(c)ommit\s+([0-9a-f]{5,})\b/i) { $init_char = $1; $orig_commit = lc($2); - } elsif ($line =~ /\b([0-9a-f]{12,40})\b/i) { + } elsif ($ref_line =~ /\b([0-9a-f]{12,40})\b/i) { $orig_commit = lc($1); + if (defined $rawlines[$linenr - 2] && + $rawlines[$linenr - 2] =~ /\bcommit$/) { + $ref_line = "commit " . $ref_line; + } } - $short = 0 if ($line =~ /\bcommit\s+[0-9a-f]{12,40}/i); - $long = 1 if ($line =~ /\bcommit\s+[0-9a-f]{41,}/i); - $space = 0 if ($line =~ /\bcommit [0-9a-f]/i); - $case = 0 if ($line =~ /\b[Cc]ommit\s+[0-9a-f]{5,40}[^A-F]/); - if ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)"\)/i) { + $short = 0 if ($ref_line =~ /\bcommit\s+[0-9a-f]{12,40}/i); + $long = 1 if ($ref_line =~ /\bcommit\s+[0-9a-f]{41,}/i); + $space = 0 if ($ref_line =~ /\bcommit [0-9a-f]/i); + $case = 0 if ($ref_line =~ /\b[Cc]ommit\s+[0-9a-f]{5,40}[^A-F]/); + + if ($ref_line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)"\)/i) { # Reference fits on 1 line $orig_desc = $1; $hasparens = 1; - } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s*$/i && + } elsif ($ref_line =~ /\bcommit\s+[0-9a-f]{5,}\s*$/i && defined $rawlines[$linenr] && $rawlines[$linenr] =~ /^\s*\("([^"]+)"\)/) { # line 1: 'commit ', # line 2: '("description")' $orig_desc = $1; $hasparens = 1; - } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("[^"]+$/i && + } elsif ($ref_line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("[^"]+$/i && defined $rawlines[$linenr] && $rawlines[$linenr] =~ /^\s*[^"]+"\)/) { # line 1: 'commit ("description', # line 2: 'description continued")' - $line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)$/i; + $ref_line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)$/i; $orig_desc = $1; $rawlines[$linenr] =~ /^\s*([^"]+)"\)/; $orig_desc .= " " . $1; $hasparens = 1; - } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s*$/i && + } elsif ($ref_line =~ /\bcommit\s+[0-9a-f]{5,}\s*$/i && defined $rawlines[$linenr] && defined $rawlines[$linenr + 1] && $rawlines[$linenr] =~ /^\s*\("[^"]+/ && @@ -2708,7 +2714,7 @@ sub process { $rawlines[$linenr + 1] =~ /^\s*([^"]+)"\)/; $orig_desc .= " " . $1; $hasparens = 1; - } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("[^"]+$/i && + } elsif ($ref_line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("[^"]+$/i && defined $rawlines[$linenr] && defined $rawlines[$linenr + 1] && $rawlines[$linenr] =~ /^\s*[^"]+$/ && @@ -2716,7 +2722,7 @@ sub process {
[RFC PATCH 1/2] checkpatch: Correctly detect git commit references that span 3 lines
If a patch contains a commit reference that happens to span 3 lines, e.g.: === With the optimizations for TLB invalidation from commit 0cef77c7798a ("powerpc/64s/radix: flush remote CPUs out of single-threaded mm_cpumask"), the scope of a TLBI (global vs. local) can now be influenced by the value of the 'copros' counter of the memory context. === checkpatch will return a GIT_COMMIT_ID error even though the reference actually follows the correct format. Fix the GIT_COMMIT_ID test so it can match against a reference that spans 3 lines. Reported-by: Frederic Barrat Signed-off-by: Andrew Donnellan --- Sending this as an RFC because I don't actually know how to Perl or regex, this whole test looks pretty gross and this patch just makes it gross-er, and it's only lightly tested. Suggestions on how to do this more neatly are welcome. We currently have checkpatch running on every incoming patch on linuxppc-dev, and we've already hit this bug at least twice in the past couple of weeks. --- scripts/checkpatch.pl | 35 ++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 447857ffaf6b..aca4d758112a 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2669,27 +2669,60 @@ sub process { } elsif ($line =~ /\b([0-9a-f]{12,40})\b/i) { $orig_commit = lc($1); } - $short = 0 if ($line =~ /\bcommit\s+[0-9a-f]{12,40}/i); $long = 1 if ($line =~ /\bcommit\s+[0-9a-f]{41,}/i); $space = 0 if ($line =~ /\bcommit [0-9a-f]/i); $case = 0 if ($line =~ /\b[Cc]ommit\s+[0-9a-f]{5,40}[^A-F]/); + if ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)"\)/i) { + # Reference fits on 1 line $orig_desc = $1; $hasparens = 1; } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s*$/i && defined $rawlines[$linenr] && $rawlines[$linenr] =~ /^\s*\("([^"]+)"\)/) { + # line 1: 'commit ', + # line 2: '("description")' $orig_desc = $1; $hasparens = 1; } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("[^"]+$/i && defined $rawlines[$linenr] && $rawlines[$linenr] =~ /^\s*[^"]+"\)/) { + # line 1: 'commit ("description', + # line 2: 'description continued")' $line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)$/i; $orig_desc = $1; $rawlines[$linenr] =~ /^\s*([^"]+)"\)/; $orig_desc .= " " . $1; $hasparens = 1; + } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s*$/i && +defined $rawlines[$linenr] && +defined $rawlines[$linenr + 1] && +$rawlines[$linenr] =~ /^\s*\("[^"]+/ && +$rawlines[$linenr + 1] =~ /^\s*[^"]+"\)/) { + # line 1: 'commit ', + # line 2: '("description' + # line 3: 'description continued")' + $rawlines[$linenr] =~ /^\s*\("([^"]+)/; + $orig_desc = $1; + $rawlines[$linenr + 1] =~ /^\s*([^"]+)"\)/; + $orig_desc .= " " . $1; + $hasparens = 1; + } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("[^"]+$/i && +defined $rawlines[$linenr] && +defined $rawlines[$linenr + 1] && +$rawlines[$linenr] =~ /^\s*[^"]+$/ && +$rawlines[$linenr + 1] =~ /^\s*[^"]+"\)/) { + # line 1: 'commit ("description', + # line 2: 'description continued' + # line 3: 'description continued")' + $line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)$/i; + $orig_desc
[RFC PATCH 2/2] checkpatch: Fix commit ID test when "commit" and hash on different lines
Signed-off-by: Andrew Donnellan --- RFC because I'm bad at Perl --- scripts/checkpatch.pl | 32 +++- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index aca4d758112a..ae7a54287db7 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2662,40 +2662,46 @@ sub process { my $id = '0123456789ab'; my $orig_desc = "commit description"; my $description = ""; + my $ref_line = $line; - if ($line =~ /\b(c)ommit\s+([0-9a-f]{5,})\b/i) { + if ($ref_line =~ /\b(c)ommit\s+([0-9a-f]{5,})\b/i) { $init_char = $1; $orig_commit = lc($2); - } elsif ($line =~ /\b([0-9a-f]{12,40})\b/i) { + } elsif ($ref_line =~ /\b([0-9a-f]{12,40})\b/i) { $orig_commit = lc($1); + if (defined $rawlines[$linenr - 2] && + $rawlines[$linenr - 2] =~ /\bcommit$/) { + $ref_line = "commit " . $ref_line; + } } - $short = 0 if ($line =~ /\bcommit\s+[0-9a-f]{12,40}/i); - $long = 1 if ($line =~ /\bcommit\s+[0-9a-f]{41,}/i); - $space = 0 if ($line =~ /\bcommit [0-9a-f]/i); - $case = 0 if ($line =~ /\b[Cc]ommit\s+[0-9a-f]{5,40}[^A-F]/); - if ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)"\)/i) { + $short = 0 if ($ref_line =~ /\bcommit\s+[0-9a-f]{12,40}/i); + $long = 1 if ($ref_line =~ /\bcommit\s+[0-9a-f]{41,}/i); + $space = 0 if ($ref_line =~ /\bcommit [0-9a-f]/i); + $case = 0 if ($ref_line =~ /\b[Cc]ommit\s+[0-9a-f]{5,40}[^A-F]/); + + if ($ref_line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)"\)/i) { # Reference fits on 1 line $orig_desc = $1; $hasparens = 1; - } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s*$/i && + } elsif ($ref_line =~ /\bcommit\s+[0-9a-f]{5,}\s*$/i && defined $rawlines[$linenr] && $rawlines[$linenr] =~ /^\s*\("([^"]+)"\)/) { # line 1: 'commit ', # line 2: '("description")' $orig_desc = $1; $hasparens = 1; - } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("[^"]+$/i && + } elsif ($ref_line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("[^"]+$/i && defined $rawlines[$linenr] && $rawlines[$linenr] =~ /^\s*[^"]+"\)/) { # line 1: 'commit ("description', # line 2: 'description continued")' - $line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)$/i; + $ref_line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)$/i; $orig_desc = $1; $rawlines[$linenr] =~ /^\s*([^"]+)"\)/; $orig_desc .= " " . $1; $hasparens = 1; - } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s*$/i && + } elsif ($ref_line =~ /\bcommit\s+[0-9a-f]{5,}\s*$/i && defined $rawlines[$linenr] && defined $rawlines[$linenr + 1] && $rawlines[$linenr] =~ /^\s*\("[^"]+/ && @@ -2708,7 +2714,7 @@ sub process { $rawlines[$linenr + 1] =~ /^\s*([^"]+)"\)/; $orig_desc .= " " . $1; $hasparens = 1; - } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("[^"]+$/i && + } elsif ($ref_line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("[^"]+$/i && defined $rawlines[$linenr] && defined $rawlines[$linenr + 1] && $rawlines[$linenr] =~ /^\s*[^"]+$/ && @@ -2716,7 +2722,7 @@ sub process {
[RFC PATCH 1/2] checkpatch: Correctly detect git commit references that span 3 lines
If a patch contains a commit reference that happens to span 3 lines, e.g.: === With the optimizations for TLB invalidation from commit 0cef77c7798a ("powerpc/64s/radix: flush remote CPUs out of single-threaded mm_cpumask"), the scope of a TLBI (global vs. local) can now be influenced by the value of the 'copros' counter of the memory context. === checkpatch will return a GIT_COMMIT_ID error even though the reference actually follows the correct format. Fix the GIT_COMMIT_ID test so it can match against a reference that spans 3 lines. Reported-by: Frederic Barrat Signed-off-by: Andrew Donnellan --- Sending this as an RFC because I don't actually know how to Perl or regex, this whole test looks pretty gross and this patch just makes it gross-er, and it's only lightly tested. Suggestions on how to do this more neatly are welcome. We currently have checkpatch running on every incoming patch on linuxppc-dev, and we've already hit this bug at least twice in the past couple of weeks. --- scripts/checkpatch.pl | 35 ++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 447857ffaf6b..aca4d758112a 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2669,27 +2669,60 @@ sub process { } elsif ($line =~ /\b([0-9a-f]{12,40})\b/i) { $orig_commit = lc($1); } - $short = 0 if ($line =~ /\bcommit\s+[0-9a-f]{12,40}/i); $long = 1 if ($line =~ /\bcommit\s+[0-9a-f]{41,}/i); $space = 0 if ($line =~ /\bcommit [0-9a-f]/i); $case = 0 if ($line =~ /\b[Cc]ommit\s+[0-9a-f]{5,40}[^A-F]/); + if ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)"\)/i) { + # Reference fits on 1 line $orig_desc = $1; $hasparens = 1; } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s*$/i && defined $rawlines[$linenr] && $rawlines[$linenr] =~ /^\s*\("([^"]+)"\)/) { + # line 1: 'commit ', + # line 2: '("description")' $orig_desc = $1; $hasparens = 1; } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("[^"]+$/i && defined $rawlines[$linenr] && $rawlines[$linenr] =~ /^\s*[^"]+"\)/) { + # line 1: 'commit ("description', + # line 2: 'description continued")' $line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)$/i; $orig_desc = $1; $rawlines[$linenr] =~ /^\s*([^"]+)"\)/; $orig_desc .= " " . $1; $hasparens = 1; + } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s*$/i && +defined $rawlines[$linenr] && +defined $rawlines[$linenr + 1] && +$rawlines[$linenr] =~ /^\s*\("[^"]+/ && +$rawlines[$linenr + 1] =~ /^\s*[^"]+"\)/) { + # line 1: 'commit ', + # line 2: '("description' + # line 3: 'description continued")' + $rawlines[$linenr] =~ /^\s*\("([^"]+)/; + $orig_desc = $1; + $rawlines[$linenr + 1] =~ /^\s*([^"]+)"\)/; + $orig_desc .= " " . $1; + $hasparens = 1; + } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("[^"]+$/i && +defined $rawlines[$linenr] && +defined $rawlines[$linenr + 1] && +$rawlines[$linenr] =~ /^\s*[^"]+$/ && +$rawlines[$linenr + 1] =~ /^\s*[^"]+"\)/) { + # line 1: 'commit ("description', + # line 2: 'description continued' + # line 3: 'description continued")' + $line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)$/i; + $orig_desc
Re: [PATCH] misc: cxl: changed asterisk position
On 03/08/18 20:20, Parth Y Shah wrote: Resolved <"foo* bar" should be "foo *bar"> error Signed-off-by: Parth Y Shah Thanks for picking this up. Acked-by: Andrew Donnellan --- drivers/misc/cxl/fault.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/cxl/fault.c b/drivers/misc/cxl/fault.c index 70dbb6d..d45f3e6 100644 --- a/drivers/misc/cxl/fault.c +++ b/drivers/misc/cxl/fault.c @@ -33,7 +33,7 @@ static bool sste_matches(struct cxl_sste *sste, struct copro_slb *slb) * This finds a free SSTE for the given SLB, or returns NULL if it's already in * the segment table. */ -static struct cxl_sste* find_free_sste(struct cxl_context *ctx, +static struct cxl_sste *find_free_sste(struct cxl_context *ctx, struct copro_slb *slb) { struct cxl_sste *primary, *sste, *ret = NULL; -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH] misc: cxl: changed asterisk position
On 03/08/18 20:20, Parth Y Shah wrote: Resolved <"foo* bar" should be "foo *bar"> error Signed-off-by: Parth Y Shah Thanks for picking this up. Acked-by: Andrew Donnellan --- drivers/misc/cxl/fault.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/cxl/fault.c b/drivers/misc/cxl/fault.c index 70dbb6d..d45f3e6 100644 --- a/drivers/misc/cxl/fault.c +++ b/drivers/misc/cxl/fault.c @@ -33,7 +33,7 @@ static bool sste_matches(struct cxl_sste *sste, struct copro_slb *slb) * This finds a free SSTE for the given SLB, or returns NULL if it's already in * the segment table. */ -static struct cxl_sste* find_free_sste(struct cxl_context *ctx, +static struct cxl_sste *find_free_sste(struct cxl_context *ctx, struct copro_slb *slb) { struct cxl_sste *primary, *sste, *ret = NULL; -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH v5 2/7] powerpc: Use TIDR CPU feature to control TIDR allocation
On 11/05/18 16:12, Alastair D'Silva wrote: From: Alastair D'Silva Switch the use of TIDR on it's CPU feature, rather than assuming it is available based on architecture. Signed-off-by: Alastair D'Silva Reviewed-by: Andrew Donnellan -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH v5 2/7] powerpc: Use TIDR CPU feature to control TIDR allocation
On 11/05/18 16:12, Alastair D'Silva wrote: From: Alastair D'Silva Switch the use of TIDR on it's CPU feature, rather than assuming it is available based on architecture. Signed-off-by: Alastair D'Silva Reviewed-by: Andrew Donnellan -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH v2 3/7] powerpc: use task_pid_nr() for TID allocation
On 25/04/18 07:12, Sukadev Bhattiprolu wrote: Yes. Like with PIDR, was trying to assign TIDR initially to all threads. But since only a subset of threads need/use TIDR, we can assign the value later (when set_thread_tidr() is called). So we should be able to use task_pid_nr() then. OK. Alastair has also confirmed with me that truncating the pid to a u16 should be safe, so therefore: Reviewed-by: Andrew Donnellan <andrew.donnel...@au1.ibm.com> -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH v2 3/7] powerpc: use task_pid_nr() for TID allocation
On 25/04/18 07:12, Sukadev Bhattiprolu wrote: Yes. Like with PIDR, was trying to assign TIDR initially to all threads. But since only a subset of threads need/use TIDR, we can assign the value later (when set_thread_tidr() is called). So we should be able to use task_pid_nr() then. OK. Alastair has also confirmed with me that truncating the pid to a u16 should be safe, so therefore: Reviewed-by: Andrew Donnellan -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH v2 5/7] ocxl: Expose the thread_id needed for wait on p9
On 18/04/18 11:08, Alastair D'Silva wrote: From: Alastair D'Silva <alast...@d-silva.org> In order to successfully issue as_notify, an AFU needs to know the TID to notify, which in turn means that this information should be available in userspace so it can be communicated to the AFU. Signed-off-by: Alastair D'Silva <alast...@d-silva.org> nitpicks below Acked-by: Andrew Donnellan <andrew.donnel...@au1.ibm.com> --- drivers/misc/ocxl/context.c | 5 +++- drivers/misc/ocxl/file.c | 53 +++ drivers/misc/ocxl/link.c | 36 ++ drivers/misc/ocxl/ocxl_internal.h | 1 + include/misc/ocxl.h | 9 +++ include/uapi/misc/ocxl.h | 10 6 files changed, 113 insertions(+), 1 deletion(-) diff --git a/drivers/misc/ocxl/context.c b/drivers/misc/ocxl/context.c index 909e8807824a..95f74623113e 100644 --- a/drivers/misc/ocxl/context.c +++ b/drivers/misc/ocxl/context.c @@ -34,6 +34,8 @@ int ocxl_context_init(struct ocxl_context *ctx, struct ocxl_afu *afu, mutex_init(>xsl_error_lock); mutex_init(>irq_lock); idr_init(>irq_idr); + ctx->tidr = 0; + /* * Keep a reference on the AFU to make sure it's valid for the * duration of the life of the context @@ -65,6 +67,7 @@ int ocxl_context_attach(struct ocxl_context *ctx, u64 amr) { int rc; + // Locks both status & tidr mutex_lock(>status_mutex); if (ctx->status != OPENED) { rc = -EIO; @@ -72,7 +75,7 @@ int ocxl_context_attach(struct ocxl_context *ctx, u64 amr) } rc = ocxl_link_add_pe(ctx->afu->fn->link, ctx->pasid, - current->mm->context.id, 0, amr, current->mm, + current->mm->context.id, ctx->tidr, amr, current->mm, xsl_fault_error, ctx); if (rc) goto out; diff --git a/drivers/misc/ocxl/file.c b/drivers/misc/ocxl/file.c index 038509e5d031..eb409a469f21 100644 --- a/drivers/misc/ocxl/file.c +++ b/drivers/misc/ocxl/file.c @@ -5,6 +5,8 @@ #include #include #include +#include +#include #include "ocxl_internal.h" @@ -123,11 +125,55 @@ static long afu_ioctl_get_metadata(struct ocxl_context *ctx, return 0; } +#ifdef CONFIG_PPC64 +static long afu_ioctl_enable_p9_wait(struct ocxl_context *ctx, + struct ocxl_ioctl_p9_wait __user *uarg) +{ + struct ocxl_ioctl_p9_wait arg; + + memset(, 0, sizeof(arg)); + + if (cpu_has_feature(CPU_FTR_P9_TIDR)) { + enum ocxl_context_status status; + + // Locks both status & tidr + mutex_lock(>status_mutex); + if (!ctx->tidr) { + if (set_thread_tidr(current)) + return -ENOENT; + + ctx->tidr = current->thread.tidr; + } + + status = ctx->status; + mutex_unlock(>status_mutex); + + if (status == ATTACHED) { + int rc; + struct link *link = ctx->afu->fn->link; Declarations at the top + + rc = ocxl_link_update_pe(link, ctx->pasid, ctx->tidr); + if (rc) + return rc; + } + + arg.thread_id = ctx->tidr; + } else + return -ENOENT; + + if (copy_to_user(uarg, , sizeof(arg))) + return -EFAULT; + + return 0; +} +#endif + #define CMD_STR(x) (x == OCXL_IOCTL_ATTACH ? "ATTACH" : \ x == OCXL_IOCTL_IRQ_ALLOC ? "IRQ_ALLOC" : \ x == OCXL_IOCTL_IRQ_FREE ? "IRQ_FREE" : \ x == OCXL_IOCTL_IRQ_SET_FD ? "IRQ_SET_FD" : \ x == OCXL_IOCTL_GET_METADATA ? "GET_METADATA" : \ + x == OCXL_IOCTL_ENABLE_P9_WAIT ? "ENABLE_P9_WAIT" : \ "UNKNOWN") static long afu_ioctl(struct file *file, unsigned int cmd, @@ -186,6 +232,13 @@ static long afu_ioctl(struct file *file, unsigned int cmd, (struct ocxl_ioctl_metadata __user *) args); break; +#ifdef CONFIG_PPC64 + case OCXL_IOCTL_ENABLE_P9_WAIT: + rc = afu_ioctl_enable_p9_wait(ctx, + (struct ocxl_ioctl_p9_wait __user *) args); + break; +#endif + default: rc = -EINVAL; } diff --git a/drivers/misc/ocxl/link.c b/drivers/misc/ocxl/link.c index 656e8610eec2..88876ae8f330 100644 --- a/drivers/misc/ocxl/link.c +++ b/drivers/misc/ocxl/link.c @@ -544,6
Re: [PATCH v2 5/7] ocxl: Expose the thread_id needed for wait on p9
On 18/04/18 11:08, Alastair D'Silva wrote: From: Alastair D'Silva In order to successfully issue as_notify, an AFU needs to know the TID to notify, which in turn means that this information should be available in userspace so it can be communicated to the AFU. Signed-off-by: Alastair D'Silva nitpicks below Acked-by: Andrew Donnellan --- drivers/misc/ocxl/context.c | 5 +++- drivers/misc/ocxl/file.c | 53 +++ drivers/misc/ocxl/link.c | 36 ++ drivers/misc/ocxl/ocxl_internal.h | 1 + include/misc/ocxl.h | 9 +++ include/uapi/misc/ocxl.h | 10 6 files changed, 113 insertions(+), 1 deletion(-) diff --git a/drivers/misc/ocxl/context.c b/drivers/misc/ocxl/context.c index 909e8807824a..95f74623113e 100644 --- a/drivers/misc/ocxl/context.c +++ b/drivers/misc/ocxl/context.c @@ -34,6 +34,8 @@ int ocxl_context_init(struct ocxl_context *ctx, struct ocxl_afu *afu, mutex_init(>xsl_error_lock); mutex_init(>irq_lock); idr_init(>irq_idr); + ctx->tidr = 0; + /* * Keep a reference on the AFU to make sure it's valid for the * duration of the life of the context @@ -65,6 +67,7 @@ int ocxl_context_attach(struct ocxl_context *ctx, u64 amr) { int rc; + // Locks both status & tidr mutex_lock(>status_mutex); if (ctx->status != OPENED) { rc = -EIO; @@ -72,7 +75,7 @@ int ocxl_context_attach(struct ocxl_context *ctx, u64 amr) } rc = ocxl_link_add_pe(ctx->afu->fn->link, ctx->pasid, - current->mm->context.id, 0, amr, current->mm, + current->mm->context.id, ctx->tidr, amr, current->mm, xsl_fault_error, ctx); if (rc) goto out; diff --git a/drivers/misc/ocxl/file.c b/drivers/misc/ocxl/file.c index 038509e5d031..eb409a469f21 100644 --- a/drivers/misc/ocxl/file.c +++ b/drivers/misc/ocxl/file.c @@ -5,6 +5,8 @@ #include #include #include +#include +#include #include "ocxl_internal.h" @@ -123,11 +125,55 @@ static long afu_ioctl_get_metadata(struct ocxl_context *ctx, return 0; } +#ifdef CONFIG_PPC64 +static long afu_ioctl_enable_p9_wait(struct ocxl_context *ctx, + struct ocxl_ioctl_p9_wait __user *uarg) +{ + struct ocxl_ioctl_p9_wait arg; + + memset(, 0, sizeof(arg)); + + if (cpu_has_feature(CPU_FTR_P9_TIDR)) { + enum ocxl_context_status status; + + // Locks both status & tidr + mutex_lock(>status_mutex); + if (!ctx->tidr) { + if (set_thread_tidr(current)) + return -ENOENT; + + ctx->tidr = current->thread.tidr; + } + + status = ctx->status; + mutex_unlock(>status_mutex); + + if (status == ATTACHED) { + int rc; + struct link *link = ctx->afu->fn->link; Declarations at the top + + rc = ocxl_link_update_pe(link, ctx->pasid, ctx->tidr); + if (rc) + return rc; + } + + arg.thread_id = ctx->tidr; + } else + return -ENOENT; + + if (copy_to_user(uarg, , sizeof(arg))) + return -EFAULT; + + return 0; +} +#endif + #define CMD_STR(x) (x == OCXL_IOCTL_ATTACH ? "ATTACH" : \ x == OCXL_IOCTL_IRQ_ALLOC ? "IRQ_ALLOC" : \ x == OCXL_IOCTL_IRQ_FREE ? "IRQ_FREE" : \ x == OCXL_IOCTL_IRQ_SET_FD ? "IRQ_SET_FD" : \ x == OCXL_IOCTL_GET_METADATA ? "GET_METADATA" : \ + x == OCXL_IOCTL_ENABLE_P9_WAIT ? "ENABLE_P9_WAIT" : \ "UNKNOWN") static long afu_ioctl(struct file *file, unsigned int cmd, @@ -186,6 +232,13 @@ static long afu_ioctl(struct file *file, unsigned int cmd, (struct ocxl_ioctl_metadata __user *) args); break; +#ifdef CONFIG_PPC64 + case OCXL_IOCTL_ENABLE_P9_WAIT: + rc = afu_ioctl_enable_p9_wait(ctx, + (struct ocxl_ioctl_p9_wait __user *) args); + break; +#endif + default: rc = -EINVAL; } diff --git a/drivers/misc/ocxl/link.c b/drivers/misc/ocxl/link.c index 656e8610eec2..88876ae8f330 100644 --- a/drivers/misc/ocxl/link.c +++ b/drivers/misc/ocxl/link.c @@ -544,6 +544,42 @@ int ocxl_link_add_pe(void *link_handle, int pasid, u32 pidr, u32 tidr, } EXPORT_SYMBOL_G
Re: [PATCH v2 3/7] powerpc: use task_pid_nr() for TID allocation
dr = 0; -} - -void arch_release_task_struct(struct task_struct *t) -{ - clear_thread_tidr(t); -} - /* * Assign a unique TIDR (thread id) for task @t and set it in the thread * structure. For now, we only support setting TIDR for 'current' task. */ int set_thread_tidr(struct task_struct *t) { - int rc; - if (!cpu_has_feature(CPU_FTR_P9_TIDR)) return -EINVAL; @@ -1602,11 +1511,7 @@ int set_thread_tidr(struct task_struct *t) if (t->thread.tidr) return 0; - rc = assign_thread_tidr(); - if (rc < 0) - return rc; - - t->thread.tidr = rc; + t->thread.tidr = (u16)task_pid_nr(t); mtspr(SPRN_TIDR, t->thread.tidr); return 0; -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH v2 3/7] powerpc: use task_pid_nr() for TID allocation
sk_struct(struct task_struct *t) -{ - clear_thread_tidr(t); -} - /* * Assign a unique TIDR (thread id) for task @t and set it in the thread * structure. For now, we only support setting TIDR for 'current' task. */ int set_thread_tidr(struct task_struct *t) { - int rc; - if (!cpu_has_feature(CPU_FTR_P9_TIDR)) return -EINVAL; @@ -1602,11 +1511,7 @@ int set_thread_tidr(struct task_struct *t) if (t->thread.tidr) return 0; - rc = assign_thread_tidr(); - if (rc < 0) - return rc; - - t->thread.tidr = rc; + t->thread.tidr = (u16)task_pid_nr(t); mtspr(SPRN_TIDR, t->thread.tidr); return 0; -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH v2 6/7] ocxl: Add an IOCTL so userspace knows what CPU features are available
On 18/04/18 11:08, Alastair D'Silva wrote: From: Alastair D'Silva <alast...@d-silva.org> In order for a userspace AFU driver to call the Power9 specific OCXL_IOCTL_ENABLE_P9_WAIT, it needs to verify that it can actually make that call. Signed-off-by: Alastair D'Silva <alast...@d-silva.org> Looks good to me Acked-by: Andrew Donnellan <andrew.donnel...@au1.ibm.com> --- Documentation/accelerators/ocxl.rst | 1 - drivers/misc/ocxl/file.c| 25 + include/uapi/misc/ocxl.h| 4 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/Documentation/accelerators/ocxl.rst b/Documentation/accelerators/ocxl.rst index ddcc58d01cfb..7904adcc07fd 100644 --- a/Documentation/accelerators/ocxl.rst +++ b/Documentation/accelerators/ocxl.rst @@ -157,7 +157,6 @@ OCXL_IOCTL_GET_METADATA: Obtains configuration information from the card, such at the size of MMIO areas, the AFU version, and the PASID for the current context. - This is stray -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH v2 6/7] ocxl: Add an IOCTL so userspace knows what CPU features are available
On 18/04/18 11:08, Alastair D'Silva wrote: From: Alastair D'Silva In order for a userspace AFU driver to call the Power9 specific OCXL_IOCTL_ENABLE_P9_WAIT, it needs to verify that it can actually make that call. Signed-off-by: Alastair D'Silva Looks good to me Acked-by: Andrew Donnellan --- Documentation/accelerators/ocxl.rst | 1 - drivers/misc/ocxl/file.c| 25 + include/uapi/misc/ocxl.h| 4 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/Documentation/accelerators/ocxl.rst b/Documentation/accelerators/ocxl.rst index ddcc58d01cfb..7904adcc07fd 100644 --- a/Documentation/accelerators/ocxl.rst +++ b/Documentation/accelerators/ocxl.rst @@ -157,7 +157,6 @@ OCXL_IOCTL_GET_METADATA: Obtains configuration information from the card, such at the size of MMIO areas, the AFU version, and the PASID for the current context. - This is stray -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH v2 7/7] ocxl: Document new OCXL IOCTLs
On 18/04/18 11:08, Alastair D'Silva wrote: From: Alastair D'Silva <alast...@d-silva.org> Signed-off-by: Alastair D'Silva <alast...@d-silva.org> This looks better. Acked-by: Andrew Donnellan <andrew.donnel...@au1.ibm.com> --- Documentation/accelerators/ocxl.rst | 11 +++ 1 file changed, 11 insertions(+) diff --git a/Documentation/accelerators/ocxl.rst b/Documentation/accelerators/ocxl.rst index 7904adcc07fd..3b8d3b99795c 100644 --- a/Documentation/accelerators/ocxl.rst +++ b/Documentation/accelerators/ocxl.rst @@ -157,6 +157,17 @@ OCXL_IOCTL_GET_METADATA: Obtains configuration information from the card, such at the size of MMIO areas, the AFU version, and the PASID for the current context. +OCXL_IOCTL_ENABLE_P9_WAIT: + + Allows the AFU to wake a userspace thread executing 'wait'. Returns + information to userspace to allow it to configure the AFU. Note that + this is only available on Power 9. Nitpicking time, if you do a v3 you should stay on brand and call it POWER9. :D + +OCXL_IOCTL_GET_FEATURES: + + Reports on which CPU features that affect OpenCAPI are usable from + userspace. + mmap ---- -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH v2 7/7] ocxl: Document new OCXL IOCTLs
On 18/04/18 11:08, Alastair D'Silva wrote: From: Alastair D'Silva Signed-off-by: Alastair D'Silva This looks better. Acked-by: Andrew Donnellan --- Documentation/accelerators/ocxl.rst | 11 +++ 1 file changed, 11 insertions(+) diff --git a/Documentation/accelerators/ocxl.rst b/Documentation/accelerators/ocxl.rst index 7904adcc07fd..3b8d3b99795c 100644 --- a/Documentation/accelerators/ocxl.rst +++ b/Documentation/accelerators/ocxl.rst @@ -157,6 +157,17 @@ OCXL_IOCTL_GET_METADATA: Obtains configuration information from the card, such at the size of MMIO areas, the AFU version, and the PASID for the current context. +OCXL_IOCTL_ENABLE_P9_WAIT: + + Allows the AFU to wake a userspace thread executing 'wait'. Returns + information to userspace to allow it to configure the AFU. Note that + this is only available on Power 9. Nitpicking time, if you do a v3 you should stay on brand and call it POWER9. :D + +OCXL_IOCTL_GET_FEATURES: + + Reports on which CPU features that affect OpenCAPI are usable from + userspace. + mmap -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH v2 2/7] powerpc: Use TIDR CPU feature to control TIDR allocation
On 18/04/18 11:08, Alastair D'Silva wrote: From: Alastair D'Silva <alast...@d-silva.org> Switch the use of TIDR on it's CPU feature, rather than assuming it is available based on architecture. Signed-off-by: Alastair D'Silva <alast...@d-silva.org> Reviewed-by: Andrew Donnellan <andrew.donnel...@au1.ibm.com> -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH v2 2/7] powerpc: Use TIDR CPU feature to control TIDR allocation
On 18/04/18 11:08, Alastair D'Silva wrote: From: Alastair D'Silva Switch the use of TIDR on it's CPU feature, rather than assuming it is available based on architecture. Signed-off-by: Alastair D'Silva Reviewed-by: Andrew Donnellan -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH v2 1/7] powerpc: Add TIDR CPU feature for Power9
On 18/04/18 11:08, Alastair D'Silva wrote: From: Alastair D'Silva <alast...@d-silva.org> This patch adds a CPU feature bit to show whether the CPU has the TIDR register available, enabling as_notify/wait in userspace. Signed-off-by: Alastair D'Silva <alast...@d-silva.org> Per my previous email: Reviewed-by: Andrew Donnellan <andrew.donnel...@au1.ibm.com> -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH v2 1/7] powerpc: Add TIDR CPU feature for Power9
On 18/04/18 11:08, Alastair D'Silva wrote: From: Alastair D'Silva This patch adds a CPU feature bit to show whether the CPU has the TIDR register available, enabling as_notify/wait in userspace. Signed-off-by: Alastair D'Silva Per my previous email: Reviewed-by: Andrew Donnellan -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH] misc: cxl: Change return type to vm_fault_t
On 18/04/18 00:53, Souptick Joarder wrote: Use new return type vm_fault_t for fault handler. For now, this is just documenting that the function returns a VM_FAULT value rather than an errno. Once all instances are converted, vm_fault_t will become a distinct type. Reference id -> 1c8f422059ae ("mm: change return type to vm_fault_t") previously cxl_mmap_fault returns VM_FAULT_NOPAGE as default value irrespective of vm_insert_pfn() return value. This bug is fixed with new vmf_insert_pfn() which will return VM_FAULT_ type based on err. Signed-off-by: Souptick Joarder <jrdr.li...@gmail.com> This looks good to me Acked-by: Andrew Donnellan <andrew.donnel...@au1.ibm.com> -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH] misc: cxl: Change return type to vm_fault_t
On 18/04/18 00:53, Souptick Joarder wrote: Use new return type vm_fault_t for fault handler. For now, this is just documenting that the function returns a VM_FAULT value rather than an errno. Once all instances are converted, vm_fault_t will become a distinct type. Reference id -> 1c8f422059ae ("mm: change return type to vm_fault_t") previously cxl_mmap_fault returns VM_FAULT_NOPAGE as default value irrespective of vm_insert_pfn() return value. This bug is fixed with new vmf_insert_pfn() which will return VM_FAULT_ type based on err. Signed-off-by: Souptick Joarder This looks good to me Acked-by: Andrew Donnellan -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH 4/7] ocxl: Rename pnv_ocxl_spa_remove_pe to clarify it's action
On 17/04/18 12:09, Alastair D'Silva wrote: From: Alastair D'Silva <alast...@d-silva.org> The function removes the process element from NPU cache. Signed-off-by: Alastair D'Silva <alast...@d-silva.org> Hmm, personally I'd suggest pnv_ocxl_spa_clear_cache() because it's just a wrapper around the OPAL call of a similar name. But I don't feel strongly about this at all, so: Acked-by: Andrew Donnellan <andrew.donnel...@au1.ibm.com> -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH 4/7] ocxl: Rename pnv_ocxl_spa_remove_pe to clarify it's action
On 17/04/18 12:09, Alastair D'Silva wrote: From: Alastair D'Silva The function removes the process element from NPU cache. Signed-off-by: Alastair D'Silva Hmm, personally I'd suggest pnv_ocxl_spa_clear_cache() because it's just a wrapper around the OPAL call of a similar name. But I don't feel strongly about this at all, so: Acked-by: Andrew Donnellan -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH 2/7] powerpc: Use TIDR CPU feature to control TIDR allocation
On 17/04/18 12:09, Alastair D'Silva wrote: From: Alastair D'Silva <alast...@d-silva.org> Switch the use of TIDR on it's CPU feature, rather than assuming it is available based on architecture. Signed-off-by: Alastair D'Silva <alast...@d-silva.org> There's a use of TIDR in restore_sprs() that's behind the ARCH_300 flag as well, ideally it should never trigger in the !P9_TIDR case, but you might want to update that too for clarity? --- arch/powerpc/kernel/process.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index 1237f13fed51..a3e0a3e06d5a 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c @@ -1570,7 +1570,7 @@ void clear_thread_tidr(struct task_struct *t) if (!t->thread.tidr) return; - if (!cpu_has_feature(CPU_FTR_ARCH_300)) { + if (!cpu_has_feature(CPU_FTR_P9_TIDR)) { WARN_ON_ONCE(1); return; } @@ -1593,7 +1593,7 @@ int set_thread_tidr(struct task_struct *t) { int rc; - if (!cpu_has_feature(CPU_FTR_ARCH_300)) + if (!cpu_has_feature(CPU_FTR_P9_TIDR)) return -EINVAL; if (t != current) -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH 2/7] powerpc: Use TIDR CPU feature to control TIDR allocation
On 17/04/18 12:09, Alastair D'Silva wrote: From: Alastair D'Silva Switch the use of TIDR on it's CPU feature, rather than assuming it is available based on architecture. Signed-off-by: Alastair D'Silva There's a use of TIDR in restore_sprs() that's behind the ARCH_300 flag as well, ideally it should never trigger in the !P9_TIDR case, but you might want to update that too for clarity? --- arch/powerpc/kernel/process.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index 1237f13fed51..a3e0a3e06d5a 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c @@ -1570,7 +1570,7 @@ void clear_thread_tidr(struct task_struct *t) if (!t->thread.tidr) return; - if (!cpu_has_feature(CPU_FTR_ARCH_300)) { + if (!cpu_has_feature(CPU_FTR_P9_TIDR)) { WARN_ON_ONCE(1); return; } @@ -1593,7 +1593,7 @@ int set_thread_tidr(struct task_struct *t) { int rc; - if (!cpu_has_feature(CPU_FTR_ARCH_300)) + if (!cpu_has_feature(CPU_FTR_P9_TIDR)) return -EINVAL; if (t != current) -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH 1/7] powerpc: Add TIDR CPU feature for Power9
On 17/04/18 12:09, Alastair D'Silva wrote: diff --git a/arch/powerpc/include/asm/switch_to.h b/arch/powerpc/include/asm/switch_to.h index be8c9fa23983..5b03d8a82409 100644 --- a/arch/powerpc/include/asm/switch_to.h +++ b/arch/powerpc/include/asm/switch_to.h @@ -94,6 +94,5 @@ static inline void clear_task_ebb(struct task_struct *t) extern int set_thread_uses_vas(void); extern int set_thread_tidr(struct task_struct *t); -extern void clear_thread_tidr(struct task_struct *t); This hunk looks like it really belongs in patch 3. Apart from that, I'm not really familiar with the CPU features code but nothing seems overly wrong... Reviewed-by: Andrew Donnellan <andrew.donnel...@au1.ibm.com> -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH 1/7] powerpc: Add TIDR CPU feature for Power9
On 17/04/18 12:09, Alastair D'Silva wrote: diff --git a/arch/powerpc/include/asm/switch_to.h b/arch/powerpc/include/asm/switch_to.h index be8c9fa23983..5b03d8a82409 100644 --- a/arch/powerpc/include/asm/switch_to.h +++ b/arch/powerpc/include/asm/switch_to.h @@ -94,6 +94,5 @@ static inline void clear_task_ebb(struct task_struct *t) extern int set_thread_uses_vas(void); extern int set_thread_tidr(struct task_struct *t); -extern void clear_thread_tidr(struct task_struct *t); This hunk looks like it really belongs in patch 3. Apart from that, I'm not really familiar with the CPU features code but nothing seems overly wrong... Reviewed-by: Andrew Donnellan -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH 7/7] ocxl: Document new OCXL IOCTLs
On 17/04/18 12:09, Alastair D'Silva wrote: From: Alastair D'Silva <alast...@d-silva.org> Signed-off-by: Alastair D'Silva <alast...@d-silva.org> --- Documentation/accelerators/ocxl.rst | 10 ++ 1 file changed, 10 insertions(+) diff --git a/Documentation/accelerators/ocxl.rst b/Documentation/accelerators/ocxl.rst index ddcc58d01cfb..144595a80a1c 100644 --- a/Documentation/accelerators/ocxl.rst +++ b/Documentation/accelerators/ocxl.rst @@ -157,6 +157,16 @@ OCXL_IOCTL_GET_METADATA: Obtains configuration information from the card, such at the size of MMIO areas, the AFU version, and the PASID for the current context. +OCXL_IOCTL_ENABLE_P9_WAIT: + + Allows the AFU to wake a userspace thread executing 'wait'. Returns + information to userspace to allow it to configure the AFU. Note that this is only available on POWER9. + +OCXL_IOCTL_GET_PLATFORM: + + Notifies userspace as to the platform the kernel believes we are on, + which may differ from what userspace believes. Also reports on which CPU + features which are usable from userspace. The first sentence here doesn't seem to relate to anything that GET_PLATFORM actually does - afaict you're just passing flags which I suppose imply what the correct platform is, but really they're just feature flags? -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH 7/7] ocxl: Document new OCXL IOCTLs
On 17/04/18 12:09, Alastair D'Silva wrote: From: Alastair D'Silva Signed-off-by: Alastair D'Silva --- Documentation/accelerators/ocxl.rst | 10 ++ 1 file changed, 10 insertions(+) diff --git a/Documentation/accelerators/ocxl.rst b/Documentation/accelerators/ocxl.rst index ddcc58d01cfb..144595a80a1c 100644 --- a/Documentation/accelerators/ocxl.rst +++ b/Documentation/accelerators/ocxl.rst @@ -157,6 +157,16 @@ OCXL_IOCTL_GET_METADATA: Obtains configuration information from the card, such at the size of MMIO areas, the AFU version, and the PASID for the current context. +OCXL_IOCTL_ENABLE_P9_WAIT: + + Allows the AFU to wake a userspace thread executing 'wait'. Returns + information to userspace to allow it to configure the AFU. Note that this is only available on POWER9. + +OCXL_IOCTL_GET_PLATFORM: + + Notifies userspace as to the platform the kernel believes we are on, + which may differ from what userspace believes. Also reports on which CPU + features which are usable from userspace. The first sentence here doesn't seem to relate to anything that GET_PLATFORM actually does - afaict you're just passing flags which I suppose imply what the correct platform is, but really they're just feature flags? -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH 2/2] misc: ocxl: use put_device() instead of device_unregister()
On 12/03/18 22:36, Arvind Yadav wrote: if device_register() returned an error! Always use put_device() to give up the reference initialized. Signed-off-by: Arvind Yadav <arvind.yadav...@gmail.com> This looks right, thanks for picking it up. Acked-by: Andrew Donnellan <andrew.donnel...@au1.ibm.com> -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH 2/2] misc: ocxl: use put_device() instead of device_unregister()
On 12/03/18 22:36, Arvind Yadav wrote: if device_register() returned an error! Always use put_device() to give up the reference initialized. Signed-off-by: Arvind Yadav This looks right, thanks for picking it up. Acked-by: Andrew Donnellan -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH v3 2/2] ocxl: Document the OCXL_IOCTL_GET_METADATA IOCTL
On 22/02/18 15:17, Alastair D'Silva wrote: From: Alastair D'Silva <alast...@d-silva.org> Signed-off-by: Alastair D'Silva <alast...@d-silva.org> Acked-by: Andrew Donnellan <andrew.donnel...@au1.ibm.com> -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH v3 2/2] ocxl: Document the OCXL_IOCTL_GET_METADATA IOCTL
On 22/02/18 15:17, Alastair D'Silva wrote: From: Alastair D'Silva Signed-off-by: Alastair D'Silva Acked-by: Andrew Donnellan -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH v3 1/2] ocxl: Add get_metadata IOCTL to share OCXL information to userspace
On 22/02/18 15:17, Alastair D'Silva wrote: From: Alastair D'Silva <alast...@d-silva.org> Some required information is not exposed to userspace currently (eg. the PASID), pass this information back, along with other information which is currently communicated via sysfs, which saves some parsing effort in userspace. Signed-off-by: Alastair D'Silva <alast...@d-silva.org> Acked-by: Andrew Donnellan <andrew.donnel...@au1.ibm.com> -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH v3 1/2] ocxl: Add get_metadata IOCTL to share OCXL information to userspace
On 22/02/18 15:17, Alastair D'Silva wrote: From: Alastair D'Silva Some required information is not exposed to userspace currently (eg. the PASID), pass this information back, along with other information which is currently communicated via sysfs, which saves some parsing effort in userspace. Signed-off-by: Alastair D'Silva Acked-by: Andrew Donnellan -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH 21/23] gcc-plugins: move GCC version check for PowerPC to Kconfig
On 17/02/18 05:38, Masahiro Yamada wrote: For PowerPC, GCC 5.2 is the requirement for GCC plugins. Move the version check to Kconfig, and remove the ugly checker. Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com> The old checker was as non-ugly as I could make it. :) Acked-by: Andrew Donnellan <andrew.donnel...@au1.ibm.com> -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH 21/23] gcc-plugins: move GCC version check for PowerPC to Kconfig
On 17/02/18 05:38, Masahiro Yamada wrote: For PowerPC, GCC 5.2 is the requirement for GCC plugins. Move the version check to Kconfig, and remove the ugly checker. Signed-off-by: Masahiro Yamada The old checker was as non-ugly as I could make it. :) Acked-by: Andrew Donnellan -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH] ocxl: Add get_metadata IOCTL to share OCXL information to userspace
On 22/02/18 14:41, Balbir Singh wrote: Setting it to 0 is for the reader, not the compiler. I'm not clear on the benefit of starting the version at 1, could you clarify? How do I distinguish between version number never set and 0? The ioctl won't exist without a version number set. -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH] ocxl: Add get_metadata IOCTL to share OCXL information to userspace
On 22/02/18 14:41, Balbir Singh wrote: Setting it to 0 is for the reader, not the compiler. I'm not clear on the benefit of starting the version at 1, could you clarify? How do I distinguish between version number never set and 0? The ioctl won't exist without a version number set. -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH] ocxl: Add get_metadata IOCTL to share OCXL information to userspace
On 21/02/18 15:57, Alastair D'Silva wrote: From: Alastair D'Silva <alast...@d-silva.org> Some required information is not exposed to userspace currently (eg. the PASID), pass this information back, along with other information which is currently communicated via sysfs, which saves some parsing effort in userspace. Signed-off-by: Alastair D'Silva <alast...@d-silva.org> Seems fine. Acked-by: Andrew Donnellan <andrew.donnel...@au1.ibm.com> -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH] ocxl: Add get_metadata IOCTL to share OCXL information to userspace
On 21/02/18 15:57, Alastair D'Silva wrote: From: Alastair D'Silva Some required information is not exposed to userspace currently (eg. the PASID), pass this information back, along with other information which is currently communicated via sysfs, which saves some parsing effort in userspace. Signed-off-by: Alastair D'Silva Seems fine. Acked-by: Andrew Donnellan -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH] ocxl: fix signed comparison with less than zero
On 31/01/18 02:11, Colin King wrote: From: Colin Ian King <colin.k...@canonical.com> Currently the comparison of used < 0 is always false because uses is a size_t. Fix this by making used a ssize_t type. Detected by Coccinelle: drivers/misc/ocxl/file.c:320:6-10: WARNING: Unsigned expression compared with zero: used < 0 Fixes: 5ef3166e8a32 ("ocxl: Driver code for 'generic' opencapi devices") Signed-off-by: Colin Ian King <colin.k...@canonical.com> Thanks for picking this up! Acked-by: Andrew Donnellan <andrew.donnel...@au1.ibm.com> --- drivers/misc/ocxl/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/ocxl/file.c b/drivers/misc/ocxl/file.c index c90c1a578d2f..1287e4430e6b 100644 --- a/drivers/misc/ocxl/file.c +++ b/drivers/misc/ocxl/file.c @@ -277,7 +277,7 @@ static ssize_t afu_read(struct file *file, char __user *buf, size_t count, struct ocxl_context *ctx = file->private_data; struct ocxl_kernel_event_header header; ssize_t rc; - size_t used = 0; + ssize_t used = 0; DEFINE_WAIT(event_wait); memset(, 0, sizeof(header)); -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH] ocxl: fix signed comparison with less than zero
On 31/01/18 02:11, Colin King wrote: From: Colin Ian King Currently the comparison of used < 0 is always false because uses is a size_t. Fix this by making used a ssize_t type. Detected by Coccinelle: drivers/misc/ocxl/file.c:320:6-10: WARNING: Unsigned expression compared with zero: used < 0 Fixes: 5ef3166e8a32 ("ocxl: Driver code for 'generic' opencapi devices") Signed-off-by: Colin Ian King Thanks for picking this up! Acked-by: Andrew Donnellan --- drivers/misc/ocxl/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/ocxl/file.c b/drivers/misc/ocxl/file.c index c90c1a578d2f..1287e4430e6b 100644 --- a/drivers/misc/ocxl/file.c +++ b/drivers/misc/ocxl/file.c @@ -277,7 +277,7 @@ static ssize_t afu_read(struct file *file, char __user *buf, size_t count, struct ocxl_context *ctx = file->private_data; struct ocxl_kernel_event_header header; ssize_t rc; - size_t used = 0; + ssize_t used = 0; DEFINE_WAIT(event_wait); memset(, 0, sizeof(header)); -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited