Re: [PATCH] powerpc/papr_scm: Move duplicate definitions to common header files
On 1/26/24 02:46, Christophe Leroy wrote: Le 18/04/2022 à 06:38, Shivaprasad G Bhat a écrit : papr_scm and ndtest share common PDSM payload structs like nd_papr_pdsm_health. Presently these structs are duplicated across papr_pdsm.h and ndtest.h header files. Since 'ndtest' is essentially arch independent and can run on platforms other than PPC64, a way needs to be deviced to avoid redundancy and duplication of PDSM structs in future. So the patch proposes moving the PDSM header from arch/powerpc/include- -/uapi/ to the generic include/uapi/linux directory. Also, there are some #defines common between papr_scm and ndtest which are not exported to the user space. So, move them to a header file which can be shared across ndtest and papr_scm via newly introduced include/linux/papr_scm.h. Signed-off-by: Shivaprasad G Bhat Signed-off-by: Vaibhav Jain Suggested-by: "Aneesh Kumar K.V" This patch doesn't apply, if still relevant can you please rebase and re-submit ? Thanks for taking a look. I have rebased and reposted the patch here https://lore.kernel.org/nvdimm/170638176942.112443.2937254675538057083.st...@ltcd48-lp2.aus.stglab.ibm.com/T/#u Thanks! Shivaprasad
Re: [PATCH] powerpc/papr_scm: Move duplicate definitions to common header files
Le 18/04/2022 à 06:38, Shivaprasad G Bhat a écrit : > papr_scm and ndtest share common PDSM payload structs like > nd_papr_pdsm_health. Presently these structs are duplicated across > papr_pdsm.h and ndtest.h header files. Since 'ndtest' is essentially > arch independent and can run on platforms other than PPC64, a way > needs to be deviced to avoid redundancy and duplication of PDSM > structs in future. > > So the patch proposes moving the PDSM header from arch/powerpc/include- > -/uapi/ to the generic include/uapi/linux directory. Also, there are > some #defines common between papr_scm and ndtest which are not exported > to the user space. So, move them to a header file which can be shared > across ndtest and papr_scm via newly introduced include/linux/papr_scm.h. > > Signed-off-by: Shivaprasad G Bhat > Signed-off-by: Vaibhav Jain > Suggested-by: "Aneesh Kumar K.V" This patch doesn't apply, if still relevant can you please rebase and re-submit ? Thanks Christophe > --- > Changelog: > Since v2: > Link: > https://patchwork.kernel.org/project/linux-nvdimm/patch/163454440296.431294.2368481747380790011.st...@lep8c.aus.stglabs.ibm.com/ > * Made it like v1, and rebased. > * Fixed repeating words in comments of the header file papr_scm.h > > Since v1: > Link: > https://patchwork.kernel.org/project/linux-nvdimm/patch/162505488483.72147.12741153746322191381.stgit@56e104a48989/ > * Removed dependency on this patch for the other patches > > MAINTAINERS |2 > arch/powerpc/include/uapi/asm/papr_pdsm.h | 165 > - > arch/powerpc/platforms/pseries/papr_scm.c | 43 > include/linux/papr_scm.h | 49 + > include/uapi/linux/papr_pdsm.h| 165 > + > tools/testing/nvdimm/test/ndtest.c|2 > tools/testing/nvdimm/test/ndtest.h| 31 - > 7 files changed, 220 insertions(+), 237 deletions(-) > delete mode 100644 arch/powerpc/include/uapi/asm/papr_pdsm.h > create mode 100644 include/linux/papr_scm.h > create mode 100644 include/uapi/linux/papr_pdsm.h > > diff --git a/MAINTAINERS b/MAINTAINERS > index 1699bb7cc867..03685b074dda 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -11254,6 +11254,8 @@ F:drivers/rtc/rtc-opal.c > F: drivers/scsi/ibmvscsi/ > F: drivers/tty/hvc/hvc_opal.c > F: drivers/watchdog/wdrtas.c > +F: include/linux/papr_scm.h > +F: include/uapi/linux/papr_pdsm.h > F: tools/testing/selftests/powerpc > N: /pmac > N: powermac > diff --git a/arch/powerpc/include/uapi/asm/papr_pdsm.h > b/arch/powerpc/include/uapi/asm/papr_pdsm.h > deleted file mode 100644 > index 17439925045c.. > --- a/arch/powerpc/include/uapi/asm/papr_pdsm.h > +++ /dev/null > @@ -1,165 +0,0 @@ > -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ > -/* > - * PAPR nvDimm Specific Methods (PDSM) and structs for libndctl > - * > - * (C) Copyright IBM 2020 > - * > - * Author: Vaibhav Jain > - */ > - > -#ifndef _UAPI_ASM_POWERPC_PAPR_PDSM_H_ > -#define _UAPI_ASM_POWERPC_PAPR_PDSM_H_ > - > -#include > -#include > - > -/* > - * PDSM Envelope: > - * > - * The ioctl ND_CMD_CALL exchange data between user-space and kernel via > - * envelope which consists of 2 headers sections and payload sections as > - * illustrated below: > - * +-+---+---+ > - * | 64-Bytes | 8-Bytes | Max 184-Bytes | > - * +-+---+---+ > - * | ND-HEADER | PDSM-HEADER | PDSM-PAYLOAD | > - * +-+---+---+ > - * | nd_family | | | > - * | nd_size_out | cmd_status| | > - * | nd_size_in | reserved | nd_pdsm_payload | > - * | nd_command | payload --> | | > - * | nd_fw_size | | | > - * | nd_payload ---> | | | > - * +---+-+---+ > - * > - * ND Header: > - * This is the generic libnvdimm header described as 'struct nd_cmd_pkg' > - * which is interpreted by libnvdimm before passed on to papr_scm. Important > - * member fields used are: > - * 'nd_family' : (In) NVDIMM_FAMILY_PAPR_SCM > - * 'nd_size_in' : (In) PDSM-HEADER + PDSM-IN-PAYLOAD (usually 0) > - * 'nd_size_out': (In) PDSM-HEADER + PDSM-RETURN-PAYLOAD > - * 'nd_command' : (In) One of PAPR_PDSM_XXX > - * 'nd_fw_size' : (Out) PDSM-HEADER + size of actual payload returned > - * > - * PDSM Header: > - * This is papr-scm specific header that precedes the payload. This is > defined > - * as nd_cmd_pdsm_pkg. Following fields aare available in this header: > - * > - * 'cmd_status'
[PATCH] powerpc/papr_scm: Move duplicate definitions to common header files
papr_scm and ndtest share common PDSM payload structs like nd_papr_pdsm_health. Presently these structs are duplicated across papr_pdsm.h and ndtest.h header files. Since 'ndtest' is essentially arch independent and can run on platforms other than PPC64, a way needs to be deviced to avoid redundancy and duplication of PDSM structs in future. So the patch proposes moving the PDSM header from arch/powerpc/include- -/uapi/ to the generic include/uapi/linux directory. Also, there are some #defines common between papr_scm and ndtest which are not exported to the user space. So, move them to a header file which can be shared across ndtest and papr_scm via newly introduced include/linux/papr_scm.h. Signed-off-by: Shivaprasad G Bhat Signed-off-by: Vaibhav Jain Suggested-by: "Aneesh Kumar K.V" --- Changelog: Since v2: Link: https://patchwork.kernel.org/project/linux-nvdimm/patch/163454440296.431294.2368481747380790011.st...@lep8c.aus.stglabs.ibm.com/ * Made it like v1, and rebased. * Fixed repeating words in comments of the header file papr_scm.h Since v1: Link: https://patchwork.kernel.org/project/linux-nvdimm/patch/162505488483.72147.12741153746322191381.stgit@56e104a48989/ * Removed dependency on this patch for the other patches MAINTAINERS |2 arch/powerpc/include/uapi/asm/papr_pdsm.h | 165 - arch/powerpc/platforms/pseries/papr_scm.c | 43 include/linux/papr_scm.h | 49 + include/uapi/linux/papr_pdsm.h| 165 + tools/testing/nvdimm/test/ndtest.c|2 tools/testing/nvdimm/test/ndtest.h| 31 - 7 files changed, 220 insertions(+), 237 deletions(-) delete mode 100644 arch/powerpc/include/uapi/asm/papr_pdsm.h create mode 100644 include/linux/papr_scm.h create mode 100644 include/uapi/linux/papr_pdsm.h diff --git a/MAINTAINERS b/MAINTAINERS index 1699bb7cc867..03685b074dda 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -11254,6 +11254,8 @@ F: drivers/rtc/rtc-opal.c F: drivers/scsi/ibmvscsi/ F: drivers/tty/hvc/hvc_opal.c F: drivers/watchdog/wdrtas.c +F: include/linux/papr_scm.h +F: include/uapi/linux/papr_pdsm.h F: tools/testing/selftests/powerpc N: /pmac N: powermac diff --git a/arch/powerpc/include/uapi/asm/papr_pdsm.h b/arch/powerpc/include/uapi/asm/papr_pdsm.h deleted file mode 100644 index 17439925045c.. --- a/arch/powerpc/include/uapi/asm/papr_pdsm.h +++ /dev/null @@ -1,165 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -/* - * PAPR nvDimm Specific Methods (PDSM) and structs for libndctl - * - * (C) Copyright IBM 2020 - * - * Author: Vaibhav Jain - */ - -#ifndef _UAPI_ASM_POWERPC_PAPR_PDSM_H_ -#define _UAPI_ASM_POWERPC_PAPR_PDSM_H_ - -#include -#include - -/* - * PDSM Envelope: - * - * The ioctl ND_CMD_CALL exchange data between user-space and kernel via - * envelope which consists of 2 headers sections and payload sections as - * illustrated below: - * +-+---+---+ - * | 64-Bytes | 8-Bytes | Max 184-Bytes | - * +-+---+---+ - * | ND-HEADER | PDSM-HEADER | PDSM-PAYLOAD | - * +-+---+---+ - * | nd_family | | | - * | nd_size_out | cmd_status| | - * | nd_size_in | reserved | nd_pdsm_payload | - * | nd_command | payload --> | | - * | nd_fw_size | | | - * | nd_payload ---> | | | - * +---+-+---+ - * - * ND Header: - * This is the generic libnvdimm header described as 'struct nd_cmd_pkg' - * which is interpreted by libnvdimm before passed on to papr_scm. Important - * member fields used are: - * 'nd_family' : (In) NVDIMM_FAMILY_PAPR_SCM - * 'nd_size_in': (In) PDSM-HEADER + PDSM-IN-PAYLOAD (usually 0) - * 'nd_size_out': (In) PDSM-HEADER + PDSM-RETURN-PAYLOAD - * 'nd_command' : (In) One of PAPR_PDSM_XXX - * 'nd_fw_size' : (Out) PDSM-HEADER + size of actual payload returned - * - * PDSM Header: - * This is papr-scm specific header that precedes the payload. This is defined - * as nd_cmd_pdsm_pkg. Following fields aare available in this header: - * - * 'cmd_status': (Out) Errors if any encountered while servicing PDSM. - * 'reserved' : Not used, reserved for future and should be set to 0. - * 'payload': A union of all the possible payload structs - * - * PDSM Payload: - * - * The layout of the PDSM Payload is defined by various structs shared between - * papr_scm and libndctl so that contents of payload