* [PATCH 4/6] powerpc/pseries: Add ibm,set-dynamic-indicator RTAS call support
2025-01-04 20:46 [PATCH 0/6] Add character devices for indices and platform-dump RTAS Haren Myneni
@ 2025-01-04 20:46 ` Haren Myneni
2025-01-09 7:38 ` Dan Carpenter
0 siblings, 1 reply; 4+ messages in thread
From: Haren Myneni @ 2025-01-04 20:46 UTC (permalink / raw)
To: linuxppc-dev; +Cc: maddy, mpe, npiggin, msuchanek, mahesh, tyreld, hbabu, haren
The RTAS call ibm,set-dynamic-indicator is used to set the new
indicator state identified by a location code. The current
implementation uses rtas_set_dynamic_indicator() API provided by
librtas library which allocates RMO buffer and issue this RTAS
call in the user space. But /dev/mem access by the user space
is prohibited under system lockdown.
This patch provides an interface with new ioctl
PAPR_DYNAMIC_INDICATOR_IOC_SET to the papr-indices character
driver and expose this interface to the user space that is
compatible with lockdown.
Refer PAPR 7.3.18 ibm,set-dynamic-indicator for more
information on this RTAS call.
- User input parameters to the RTAS call: location code
string, indicator token and new state
Expose these interfaces to user space with a /dev/papr-indices
character device using the following programming model:
int fd = open("/dev/papr-indices", O_RDWR);
int ret = ioctl(fd, PAPR_DYNAMIC_INDICATOR_IOC_SET,
struct papr_indices_io_block)
- The user space passes input parameters in papr_indices_io_block
struct
Signed-off-by: Haren Myneni <haren@linux.ibm.com>
---
arch/powerpc/include/asm/rtas.h | 1 +
arch/powerpc/kernel/rtas.c | 2 +-
arch/powerpc/platforms/pseries/papr-indices.c | 119 ++++++++++++++++++
3 files changed, 121 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/include/asm/rtas.h b/arch/powerpc/include/asm/rtas.h
index 7dc527a5aaac..2da52f59e4c6 100644
--- a/arch/powerpc/include/asm/rtas.h
+++ b/arch/powerpc/include/asm/rtas.h
@@ -516,6 +516,7 @@ extern unsigned long rtas_rmo_buf;
extern struct mutex rtas_ibm_get_vpd_lock;
extern struct mutex rtas_ibm_get_indices_lock;
+extern struct mutex rtas_ibm_set_dynamic_indicator_lock;
#define GLOBAL_INTERRUPT_QUEUE 9005
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 76c634b92cb2..88fa416730af 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -95,9 +95,9 @@ static DEFINE_MUTEX(rtas_ibm_activate_firmware_lock);
static DEFINE_MUTEX(rtas_ibm_get_dynamic_sensor_state_lock);
static DEFINE_MUTEX(rtas_ibm_lpar_perftools_lock);
static DEFINE_MUTEX(rtas_ibm_physical_attestation_lock);
-static DEFINE_MUTEX(rtas_ibm_set_dynamic_indicator_lock);
DEFINE_MUTEX(rtas_ibm_get_vpd_lock);
DEFINE_MUTEX(rtas_ibm_get_indices_lock);
+DEFINE_MUTEX(rtas_ibm_set_dynamic_indicator_lock);
static struct rtas_function rtas_function_table[] __ro_after_init = {
[RTAS_FNIDX__CHECK_EXCEPTION] = {
diff --git a/arch/powerpc/platforms/pseries/papr-indices.c b/arch/powerpc/platforms/pseries/papr-indices.c
index d73aa329bd70..30dfd928d192 100644
--- a/arch/powerpc/platforms/pseries/papr-indices.c
+++ b/arch/powerpc/platforms/pseries/papr-indices.c
@@ -27,6 +27,15 @@
#define RTAS_IBM_GET_INDICES_MORE_DATA 1 /* More data is available. */
#define RTAS_IBM_GET_INDICES_START_OVER -4 /* Indices list changed, restart call sequence. */
+/*
+ * Function-specific return values for ibm,set-dynamic-indicator and
+ * ibm,get-dynamic-sensor-state RTAS calls, drived from PAPR+
+ * v2.13 7.3.18 and 7.3.19.
+ */
+#define RTAS_IBM_DYNAMIC_INDICE_SUCCESS 0
+#define RTAS_IBM_DYNAMIC_INDICE_HW_ERROR -1
+#define RTAS_IBM_DYNAMIC_INDICE_NO_INDICATOR -3
+
/**
* struct rtas_ibm_get_indices_params - Parameters (in and out) for
* ibm,get-indices.
@@ -328,6 +337,107 @@ static long papr_indices_create_handle(struct papr_indices_io_block __user *ubuf
return fd;
}
+/**
+ * Create work area with the input parameters. This function is used
+ * for both ibm,set-dynamic-indicator and ibm,get-dynamic-sensor-state
+ * RTAS Calls.
+ */
+static struct rtas_work_area *
+papr_dynamic_indice_buf_from_user(struct papr_indices_io_block __user *ubuf,
+ struct papr_indices_io_block *kbuf)
+{
+ struct rtas_work_area *work_area;
+ u32 length;
+ __be32 len_be;
+
+ if (copy_from_user(kbuf, ubuf, sizeof(*kbuf)))
+ return ERR_PTR(-EFAULT);
+
+
+ if (!string_is_terminated(kbuf->dynamic_param.location_code_str,
+ ARRAY_SIZE(kbuf->dynamic_param.location_code_str)))
+ return ERR_PTR(-EINVAL);
+
+ /*
+ * The input data in the work area should be as follows:
+ * - 32-bit integer length of the location code string,
+ * including NULL.
+ * - Location code string, NULL terminated, identifying the
+ * token (sensor or indicator).
+ * PAPR 2.13 - R1–7.3.18–5 ibm,set-dynamic-indicator
+ * - R1–7.3.19–5 ibm,get-dynamic-sensor-state
+ */
+ /*
+ * Length that user space passed should also include NULL
+ * terminator.
+ */
+ length = strlen(kbuf->dynamic_param.location_code_str) + 1;
+ if (length > LOC_CODE_SIZE)
+ return ERR_PTR(-EINVAL);
+
+ len_be = cpu_to_be32(length);
+
+ work_area = rtas_work_area_alloc(LOC_CODE_SIZE + sizeof(u32));
+ memcpy(rtas_work_area_raw_buf(work_area), &len_be, sizeof(u32));
+ memcpy((rtas_work_area_raw_buf(work_area) + sizeof(u32)),
+ &kbuf->dynamic_param.location_code_str, length);
+
+ return work_area;
+}
+
+/**
+ * papr_dynamic_indicator_ioc_set - ibm,set-dynamic-indicator RTAS Call
+ * PAPR 2.13 7.3.18
+ *
+ * @ubuf: Input parameters to RTAS call such as indicator token and
+ * new state.
+ *
+ * Returns success or -errno.
+ */
+static long papr_dynamic_indicator_ioc_set(struct papr_indices_io_block __user *ubuf)
+{
+ struct papr_indices_io_block kbuf;
+ struct rtas_work_area *work_area;
+ s32 fwrc, token, ret;
+
+ token = rtas_function_token(RTAS_FN_IBM_SET_DYNAMIC_INDICATOR);
+ if (token == RTAS_UNKNOWN_SERVICE)
+ return -ENOENT;
+
+ mutex_lock(&rtas_ibm_set_dynamic_indicator_lock);
+ work_area = papr_dynamic_indice_buf_from_user(ubuf, &kbuf);
+ if (IS_ERR(work_area))
+ return PTR_ERR(work_area);
+
+ do {
+ fwrc = rtas_call(token, 3, 1, NULL,
+ kbuf.dynamic_param.token,
+ kbuf.dynamic_param.state,
+ rtas_work_area_phys(work_area));
+ } while (rtas_busy_delay(fwrc));
+
+ rtas_work_area_free(work_area);
+ mutex_unlock(&rtas_ibm_set_dynamic_indicator_lock);
+
+ switch (fwrc) {
+ case RTAS_IBM_DYNAMIC_INDICE_SUCCESS:
+ ret = 0;
+ break;
+ case RTAS_IBM_DYNAMIC_INDICE_NO_INDICATOR: /* No such indicator */
+ ret = -EOPNOTSUPP;
+ break;
+ default:
+ pr_err("unexpected ibm,set-dynamic-indicator result %d\n",
+ fwrc);
+ fallthrough;
+ case RTAS_IBM_DYNAMIC_INDICE_HW_ERROR: /* Hardware/platform error */
+ ret = -EIO;
+ break;
+ }
+
+ return ret;
+}
+
/*
* Top-level ioctl handler for /dev/papr-indices.
*/
@@ -341,6 +451,12 @@ static long papr_indices_dev_ioctl(struct file *filp, unsigned int ioctl,
case PAPR_INDICES_IOC_GET:
ret = papr_indices_create_handle(argp);
break;
+ case PAPR_DYNAMIC_INDICATOR_IOC_SET:
+ if (filp->f_mode & FMODE_WRITE)
+ ret = papr_dynamic_indicator_ioc_set(argp);
+ else
+ ret = -EBADF;
+ break;
default:
ret = -ENOIOCTLCMD;
break;
@@ -364,6 +480,9 @@ static __init int papr_indices_init(void)
if (!rtas_function_implemented(RTAS_FN_IBM_GET_INDICES))
return -ENODEV;
+ if (!rtas_function_implemented(RTAS_FN_IBM_SET_DYNAMIC_INDICATOR))
+ return -ENODEV;
+
return misc_register(&papr_indices_dev);
}
machine_device_initcall(pseries, papr_indices_init);
--
2.43.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 4/6] powerpc/pseries: Add ibm,set-dynamic-indicator RTAS call support
@ 2025-01-07 1:31 kernel test robot
0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2025-01-07 1:31 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp, Julia Lawall
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20250104204652.388720-5-haren@linux.ibm.com>
References: <20250104204652.388720-5-haren@linux.ibm.com>
TO: Haren Myneni <haren@linux.ibm.com>
TO: linuxppc-dev@lists.ozlabs.org
CC: maddy@linux.ibm.com
CC: mpe@ellerman.id.au
CC: npiggin@gmail.com
CC: msuchanek@suse.de
CC: mahesh@linux.ibm.com
CC: tyreld@linux.ibm.com
CC: hbabu@us.ibm.com
CC: haren@linux.ibm.com
Hi Haren,
kernel test robot noticed the following build warnings:
[auto build test WARNING on powerpc/next]
[also build test WARNING on powerpc/fixes linus/master v6.13-rc6 next-20250106]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Haren-Myneni/powerpc-pseries-Define-common-functions-for-RTAS-sequence-HCALLs/20250105-045010
base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
patch link: https://lore.kernel.org/r/20250104204652.388720-5-haren%40linux.ibm.com
patch subject: [PATCH 4/6] powerpc/pseries: Add ibm,set-dynamic-indicator RTAS call support
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: powerpc64-randconfig-r061-20250107 (https://download.01.org/0day-ci/archive/20250107/202501070900.m80uMe9o-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 096551537b2a747a3387726ca618ceeb3950e9bc)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Julia Lawall <julia.lawall@inria.fr>
| Closes: https://lore.kernel.org/r/202501070900.m80uMe9o-lkp@intel.com/
cocci warnings: (new ones prefixed by >>)
>> arch/powerpc/platforms/pseries/papr-indices.c:410:2-8: preceding lock on line 407
vim +410 arch/powerpc/platforms/pseries/papr-indices.c
3f48afd07934e4 Haren Myneni 2025-01-04 387
3f48afd07934e4 Haren Myneni 2025-01-04 388 /**
3f48afd07934e4 Haren Myneni 2025-01-04 389 * papr_dynamic_indicator_ioc_set - ibm,set-dynamic-indicator RTAS Call
3f48afd07934e4 Haren Myneni 2025-01-04 390 * PAPR 2.13 7.3.18
3f48afd07934e4 Haren Myneni 2025-01-04 391 *
3f48afd07934e4 Haren Myneni 2025-01-04 392 * @ubuf: Input parameters to RTAS call such as indicator token and
3f48afd07934e4 Haren Myneni 2025-01-04 393 * new state.
3f48afd07934e4 Haren Myneni 2025-01-04 394 *
3f48afd07934e4 Haren Myneni 2025-01-04 395 * Returns success or -errno.
3f48afd07934e4 Haren Myneni 2025-01-04 396 */
3f48afd07934e4 Haren Myneni 2025-01-04 397 static long papr_dynamic_indicator_ioc_set(struct papr_indices_io_block __user *ubuf)
3f48afd07934e4 Haren Myneni 2025-01-04 398 {
3f48afd07934e4 Haren Myneni 2025-01-04 399 struct papr_indices_io_block kbuf;
3f48afd07934e4 Haren Myneni 2025-01-04 400 struct rtas_work_area *work_area;
3f48afd07934e4 Haren Myneni 2025-01-04 401 s32 fwrc, token, ret;
3f48afd07934e4 Haren Myneni 2025-01-04 402
3f48afd07934e4 Haren Myneni 2025-01-04 403 token = rtas_function_token(RTAS_FN_IBM_SET_DYNAMIC_INDICATOR);
3f48afd07934e4 Haren Myneni 2025-01-04 404 if (token == RTAS_UNKNOWN_SERVICE)
3f48afd07934e4 Haren Myneni 2025-01-04 405 return -ENOENT;
3f48afd07934e4 Haren Myneni 2025-01-04 406
3f48afd07934e4 Haren Myneni 2025-01-04 @407 mutex_lock(&rtas_ibm_set_dynamic_indicator_lock);
3f48afd07934e4 Haren Myneni 2025-01-04 408 work_area = papr_dynamic_indice_buf_from_user(ubuf, &kbuf);
3f48afd07934e4 Haren Myneni 2025-01-04 409 if (IS_ERR(work_area))
3f48afd07934e4 Haren Myneni 2025-01-04 @410 return PTR_ERR(work_area);
3f48afd07934e4 Haren Myneni 2025-01-04 411
3f48afd07934e4 Haren Myneni 2025-01-04 412 do {
3f48afd07934e4 Haren Myneni 2025-01-04 413 fwrc = rtas_call(token, 3, 1, NULL,
3f48afd07934e4 Haren Myneni 2025-01-04 414 kbuf.dynamic_param.token,
3f48afd07934e4 Haren Myneni 2025-01-04 415 kbuf.dynamic_param.state,
3f48afd07934e4 Haren Myneni 2025-01-04 416 rtas_work_area_phys(work_area));
3f48afd07934e4 Haren Myneni 2025-01-04 417 } while (rtas_busy_delay(fwrc));
3f48afd07934e4 Haren Myneni 2025-01-04 418
3f48afd07934e4 Haren Myneni 2025-01-04 419 rtas_work_area_free(work_area);
3f48afd07934e4 Haren Myneni 2025-01-04 420 mutex_unlock(&rtas_ibm_set_dynamic_indicator_lock);
3f48afd07934e4 Haren Myneni 2025-01-04 421
3f48afd07934e4 Haren Myneni 2025-01-04 422 switch (fwrc) {
3f48afd07934e4 Haren Myneni 2025-01-04 423 case RTAS_IBM_DYNAMIC_INDICE_SUCCESS:
3f48afd07934e4 Haren Myneni 2025-01-04 424 ret = 0;
3f48afd07934e4 Haren Myneni 2025-01-04 425 break;
3f48afd07934e4 Haren Myneni 2025-01-04 426 case RTAS_IBM_DYNAMIC_INDICE_NO_INDICATOR: /* No such indicator */
3f48afd07934e4 Haren Myneni 2025-01-04 427 ret = -EOPNOTSUPP;
3f48afd07934e4 Haren Myneni 2025-01-04 428 break;
3f48afd07934e4 Haren Myneni 2025-01-04 429 default:
3f48afd07934e4 Haren Myneni 2025-01-04 430 pr_err("unexpected ibm,set-dynamic-indicator result %d\n",
3f48afd07934e4 Haren Myneni 2025-01-04 431 fwrc);
3f48afd07934e4 Haren Myneni 2025-01-04 432 fallthrough;
3f48afd07934e4 Haren Myneni 2025-01-04 433 case RTAS_IBM_DYNAMIC_INDICE_HW_ERROR: /* Hardware/platform error */
3f48afd07934e4 Haren Myneni 2025-01-04 434 ret = -EIO;
3f48afd07934e4 Haren Myneni 2025-01-04 435 break;
3f48afd07934e4 Haren Myneni 2025-01-04 436 }
3f48afd07934e4 Haren Myneni 2025-01-04 437
3f48afd07934e4 Haren Myneni 2025-01-04 438 return ret;
3f48afd07934e4 Haren Myneni 2025-01-04 439 }
3f48afd07934e4 Haren Myneni 2025-01-04 440
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 4/6] powerpc/pseries: Add ibm,set-dynamic-indicator RTAS call support
@ 2025-01-08 19:46 kernel test robot
0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2025-01-08 19:46 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp, Dan Carpenter
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20250104204652.388720-5-haren@linux.ibm.com>
References: <20250104204652.388720-5-haren@linux.ibm.com>
TO: Haren Myneni <haren@linux.ibm.com>
TO: linuxppc-dev@lists.ozlabs.org
CC: maddy@linux.ibm.com
CC: mpe@ellerman.id.au
CC: npiggin@gmail.com
CC: msuchanek@suse.de
CC: mahesh@linux.ibm.com
CC: tyreld@linux.ibm.com
CC: hbabu@us.ibm.com
CC: haren@linux.ibm.com
Hi Haren,
kernel test robot noticed the following build warnings:
[auto build test WARNING on powerpc/next]
[also build test WARNING on powerpc/fixes linus/master v6.13-rc6 next-20250108]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Haren-Myneni/powerpc-pseries-Define-common-functions-for-RTAS-sequence-HCALLs/20250105-045010
base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
patch link: https://lore.kernel.org/r/20250104204652.388720-5-haren%40linux.ibm.com
patch subject: [PATCH 4/6] powerpc/pseries: Add ibm,set-dynamic-indicator RTAS call support
:::::: branch date: 4 days ago
:::::: commit date: 4 days ago
config: powerpc64-randconfig-r071-20250108 (https://download.01.org/0day-ci/archive/20250109/202501090337.xKCGrblc-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 096551537b2a747a3387726ca618ceeb3950e9bc)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202501090337.xKCGrblc-lkp@intel.com/
smatch warnings:
arch/powerpc/platforms/pseries/papr-indices.c:438 papr_dynamic_indicator_ioc_set() warn: inconsistent returns 'global &rtas_ibm_set_dynamic_indicator_lock'.
vim +438 arch/powerpc/platforms/pseries/papr-indices.c
3f48afd07934e4 Haren Myneni 2025-01-04 387
3f48afd07934e4 Haren Myneni 2025-01-04 388 /**
3f48afd07934e4 Haren Myneni 2025-01-04 389 * papr_dynamic_indicator_ioc_set - ibm,set-dynamic-indicator RTAS Call
3f48afd07934e4 Haren Myneni 2025-01-04 390 * PAPR 2.13 7.3.18
3f48afd07934e4 Haren Myneni 2025-01-04 391 *
3f48afd07934e4 Haren Myneni 2025-01-04 392 * @ubuf: Input parameters to RTAS call such as indicator token and
3f48afd07934e4 Haren Myneni 2025-01-04 393 * new state.
3f48afd07934e4 Haren Myneni 2025-01-04 394 *
3f48afd07934e4 Haren Myneni 2025-01-04 395 * Returns success or -errno.
3f48afd07934e4 Haren Myneni 2025-01-04 396 */
3f48afd07934e4 Haren Myneni 2025-01-04 397 static long papr_dynamic_indicator_ioc_set(struct papr_indices_io_block __user *ubuf)
3f48afd07934e4 Haren Myneni 2025-01-04 398 {
3f48afd07934e4 Haren Myneni 2025-01-04 399 struct papr_indices_io_block kbuf;
3f48afd07934e4 Haren Myneni 2025-01-04 400 struct rtas_work_area *work_area;
3f48afd07934e4 Haren Myneni 2025-01-04 401 s32 fwrc, token, ret;
3f48afd07934e4 Haren Myneni 2025-01-04 402
3f48afd07934e4 Haren Myneni 2025-01-04 403 token = rtas_function_token(RTAS_FN_IBM_SET_DYNAMIC_INDICATOR);
3f48afd07934e4 Haren Myneni 2025-01-04 404 if (token == RTAS_UNKNOWN_SERVICE)
3f48afd07934e4 Haren Myneni 2025-01-04 405 return -ENOENT;
3f48afd07934e4 Haren Myneni 2025-01-04 406
3f48afd07934e4 Haren Myneni 2025-01-04 407 mutex_lock(&rtas_ibm_set_dynamic_indicator_lock);
3f48afd07934e4 Haren Myneni 2025-01-04 408 work_area = papr_dynamic_indice_buf_from_user(ubuf, &kbuf);
3f48afd07934e4 Haren Myneni 2025-01-04 409 if (IS_ERR(work_area))
3f48afd07934e4 Haren Myneni 2025-01-04 410 return PTR_ERR(work_area);
3f48afd07934e4 Haren Myneni 2025-01-04 411
3f48afd07934e4 Haren Myneni 2025-01-04 412 do {
3f48afd07934e4 Haren Myneni 2025-01-04 413 fwrc = rtas_call(token, 3, 1, NULL,
3f48afd07934e4 Haren Myneni 2025-01-04 414 kbuf.dynamic_param.token,
3f48afd07934e4 Haren Myneni 2025-01-04 415 kbuf.dynamic_param.state,
3f48afd07934e4 Haren Myneni 2025-01-04 416 rtas_work_area_phys(work_area));
3f48afd07934e4 Haren Myneni 2025-01-04 417 } while (rtas_busy_delay(fwrc));
3f48afd07934e4 Haren Myneni 2025-01-04 418
3f48afd07934e4 Haren Myneni 2025-01-04 419 rtas_work_area_free(work_area);
3f48afd07934e4 Haren Myneni 2025-01-04 420 mutex_unlock(&rtas_ibm_set_dynamic_indicator_lock);
3f48afd07934e4 Haren Myneni 2025-01-04 421
3f48afd07934e4 Haren Myneni 2025-01-04 422 switch (fwrc) {
3f48afd07934e4 Haren Myneni 2025-01-04 423 case RTAS_IBM_DYNAMIC_INDICE_SUCCESS:
3f48afd07934e4 Haren Myneni 2025-01-04 424 ret = 0;
3f48afd07934e4 Haren Myneni 2025-01-04 425 break;
3f48afd07934e4 Haren Myneni 2025-01-04 426 case RTAS_IBM_DYNAMIC_INDICE_NO_INDICATOR: /* No such indicator */
3f48afd07934e4 Haren Myneni 2025-01-04 427 ret = -EOPNOTSUPP;
3f48afd07934e4 Haren Myneni 2025-01-04 428 break;
3f48afd07934e4 Haren Myneni 2025-01-04 429 default:
3f48afd07934e4 Haren Myneni 2025-01-04 430 pr_err("unexpected ibm,set-dynamic-indicator result %d\n",
3f48afd07934e4 Haren Myneni 2025-01-04 431 fwrc);
3f48afd07934e4 Haren Myneni 2025-01-04 432 fallthrough;
3f48afd07934e4 Haren Myneni 2025-01-04 433 case RTAS_IBM_DYNAMIC_INDICE_HW_ERROR: /* Hardware/platform error */
3f48afd07934e4 Haren Myneni 2025-01-04 434 ret = -EIO;
3f48afd07934e4 Haren Myneni 2025-01-04 435 break;
3f48afd07934e4 Haren Myneni 2025-01-04 436 }
3f48afd07934e4 Haren Myneni 2025-01-04 437
3f48afd07934e4 Haren Myneni 2025-01-04 @438 return ret;
3f48afd07934e4 Haren Myneni 2025-01-04 439 }
3f48afd07934e4 Haren Myneni 2025-01-04 440
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 4/6] powerpc/pseries: Add ibm,set-dynamic-indicator RTAS call support
2025-01-04 20:46 ` [PATCH 4/6] powerpc/pseries: Add ibm,set-dynamic-indicator RTAS call support Haren Myneni
@ 2025-01-09 7:38 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2025-01-09 7:38 UTC (permalink / raw)
To: oe-kbuild, Haren Myneni, linuxppc-dev
Cc: lkp, oe-kbuild-all, maddy, mpe, npiggin, msuchanek, mahesh,
tyreld, hbabu, haren
Hi Haren,
kernel test robot noticed the following build warnings:
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Haren-Myneni/powerpc-pseries-Define-common-functions-for-RTAS-sequence-HCALLs/20250105-045010
base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
patch link: https://lore.kernel.org/r/20250104204652.388720-5-haren%40linux.ibm.com
patch subject: [PATCH 4/6] powerpc/pseries: Add ibm,set-dynamic-indicator RTAS call support
config: powerpc64-randconfig-r071-20250108 (https://download.01.org/0day-ci/archive/20250109/202501090337.xKCGrblc-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 096551537b2a747a3387726ca618ceeb3950e9bc)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202501090337.xKCGrblc-lkp@intel.com/
smatch warnings:
arch/powerpc/platforms/pseries/papr-indices.c:438 papr_dynamic_indicator_ioc_set() warn: inconsistent returns 'global &rtas_ibm_set_dynamic_indicator_lock'.
vim +438 arch/powerpc/platforms/pseries/papr-indices.c
3f48afd07934e4 Haren Myneni 2025-01-04 397 static long papr_dynamic_indicator_ioc_set(struct papr_indices_io_block __user *ubuf)
3f48afd07934e4 Haren Myneni 2025-01-04 398 {
3f48afd07934e4 Haren Myneni 2025-01-04 399 struct papr_indices_io_block kbuf;
3f48afd07934e4 Haren Myneni 2025-01-04 400 struct rtas_work_area *work_area;
3f48afd07934e4 Haren Myneni 2025-01-04 401 s32 fwrc, token, ret;
3f48afd07934e4 Haren Myneni 2025-01-04 402
3f48afd07934e4 Haren Myneni 2025-01-04 403 token = rtas_function_token(RTAS_FN_IBM_SET_DYNAMIC_INDICATOR);
3f48afd07934e4 Haren Myneni 2025-01-04 404 if (token == RTAS_UNKNOWN_SERVICE)
3f48afd07934e4 Haren Myneni 2025-01-04 405 return -ENOENT;
3f48afd07934e4 Haren Myneni 2025-01-04 406
3f48afd07934e4 Haren Myneni 2025-01-04 407 mutex_lock(&rtas_ibm_set_dynamic_indicator_lock);
3f48afd07934e4 Haren Myneni 2025-01-04 408 work_area = papr_dynamic_indice_buf_from_user(ubuf, &kbuf);
3f48afd07934e4 Haren Myneni 2025-01-04 409 if (IS_ERR(work_area))
3f48afd07934e4 Haren Myneni 2025-01-04 410 return PTR_ERR(work_area);
mutex_unlock(&rtas_ibm_set_dynamic_indicator_lock); before returning
3f48afd07934e4 Haren Myneni 2025-01-04 411
3f48afd07934e4 Haren Myneni 2025-01-04 412 do {
3f48afd07934e4 Haren Myneni 2025-01-04 413 fwrc = rtas_call(token, 3, 1, NULL,
3f48afd07934e4 Haren Myneni 2025-01-04 414 kbuf.dynamic_param.token,
3f48afd07934e4 Haren Myneni 2025-01-04 415 kbuf.dynamic_param.state,
3f48afd07934e4 Haren Myneni 2025-01-04 416 rtas_work_area_phys(work_area));
3f48afd07934e4 Haren Myneni 2025-01-04 417 } while (rtas_busy_delay(fwrc));
3f48afd07934e4 Haren Myneni 2025-01-04 418
3f48afd07934e4 Haren Myneni 2025-01-04 419 rtas_work_area_free(work_area);
3f48afd07934e4 Haren Myneni 2025-01-04 420 mutex_unlock(&rtas_ibm_set_dynamic_indicator_lock);
3f48afd07934e4 Haren Myneni 2025-01-04 421
3f48afd07934e4 Haren Myneni 2025-01-04 422 switch (fwrc) {
3f48afd07934e4 Haren Myneni 2025-01-04 423 case RTAS_IBM_DYNAMIC_INDICE_SUCCESS:
3f48afd07934e4 Haren Myneni 2025-01-04 424 ret = 0;
3f48afd07934e4 Haren Myneni 2025-01-04 425 break;
3f48afd07934e4 Haren Myneni 2025-01-04 426 case RTAS_IBM_DYNAMIC_INDICE_NO_INDICATOR: /* No such indicator */
3f48afd07934e4 Haren Myneni 2025-01-04 427 ret = -EOPNOTSUPP;
3f48afd07934e4 Haren Myneni 2025-01-04 428 break;
3f48afd07934e4 Haren Myneni 2025-01-04 429 default:
3f48afd07934e4 Haren Myneni 2025-01-04 430 pr_err("unexpected ibm,set-dynamic-indicator result %d\n",
3f48afd07934e4 Haren Myneni 2025-01-04 431 fwrc);
3f48afd07934e4 Haren Myneni 2025-01-04 432 fallthrough;
3f48afd07934e4 Haren Myneni 2025-01-04 433 case RTAS_IBM_DYNAMIC_INDICE_HW_ERROR: /* Hardware/platform error */
3f48afd07934e4 Haren Myneni 2025-01-04 434 ret = -EIO;
3f48afd07934e4 Haren Myneni 2025-01-04 435 break;
3f48afd07934e4 Haren Myneni 2025-01-04 436 }
3f48afd07934e4 Haren Myneni 2025-01-04 437
3f48afd07934e4 Haren Myneni 2025-01-04 @438 return ret;
3f48afd07934e4 Haren Myneni 2025-01-04 439 }
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-01-09 7:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-08 19:46 [PATCH 4/6] powerpc/pseries: Add ibm,set-dynamic-indicator RTAS call support kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2025-01-07 1:31 kernel test robot
2025-01-04 20:46 [PATCH 0/6] Add character devices for indices and platform-dump RTAS Haren Myneni
2025-01-04 20:46 ` [PATCH 4/6] powerpc/pseries: Add ibm,set-dynamic-indicator RTAS call support Haren Myneni
2025-01-09 7:38 ` Dan Carpenter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.