Skip to content

Commit 944bd9b

Browse files
author
CKI KWF Bot
committed
Merge: powerpc/pseries: Define common functions for RTAS sequence calls
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/1553 Description: Define common functions for RTAS sequence calls JIRA: https://issues.redhat.com/browse/RHEL-101977 Build Info: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=68856817 Tested: Verified Brew build test kernel RPMs and confirmed issue is resovled Signed-off-by: Mamatha Inamdar <minamdar@redhat.com> Approved-by: Steve Best <sbest@redhat.com> Approved-by: Tony Camuso <tcamuso@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: CKI GitLab Kmaint Pipeline Bot <26919896-cki-kmaint-pipeline-bot@users.noreply.gitlab.com>
2 parents f00c9fd + 1a9d08c commit 944bd9b

File tree

13 files changed

+1707
-312
lines changed

13 files changed

+1707
-312
lines changed

Documentation/userspace-api/ioctl/ioctl-number.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,12 @@ Code Seq# Include File Comments
364364
<mailto:linuxppc-dev>
365365
0xB2 01-02 arch/powerpc/include/uapi/asm/papr-sysparm.h powerpc/pseries system parameter API
366366
<mailto:linuxppc-dev>
367+
0xB2 03-05 arch/powerpc/include/uapi/asm/papr-indices.h powerpc/pseries indices API
368+
<mailto:linuxppc-dev>
369+
0xB2 06-07 arch/powerpc/include/uapi/asm/papr-platform-dump.h powerpc/pseries Platform Dump API
370+
<mailto:linuxppc-dev>
371+
0xB2 08 powerpc/include/uapi/asm/papr-physical-attestation.h powerpc/pseries Physical Attestation API
372+
<mailto:linuxppc-dev>
367373
0xB3 00 linux/mmc/ioctl.h
368374
0xB4 00-0F linux/gpio.h <mailto:linux-gpio@vger.kernel.org>
369375
0xB5 00-0F uapi/linux/rpmsg.h <mailto:linux-remoteproc@vger.kernel.org>

arch/powerpc/include/asm/rtas.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,10 @@ extern char rtas_data_buf[RTAS_DATA_BUF_SIZE];
515515
extern unsigned long rtas_rmo_buf;
516516

517517
extern struct mutex rtas_ibm_get_vpd_lock;
518+
extern struct mutex rtas_ibm_get_indices_lock;
519+
extern struct mutex rtas_ibm_set_dynamic_indicator_lock;
520+
extern struct mutex rtas_ibm_get_dynamic_sensor_state_lock;
521+
extern struct mutex rtas_ibm_physical_attestation_lock;
518522

519523
#define GLOBAL_INTERRUPT_QUEUE 9005
520524

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2+
#ifndef _UAPI_PAPR_INDICES_H_
3+
#define _UAPI_PAPR_INDICES_H_
4+
5+
#include <linux/types.h>
6+
#include <asm/ioctl.h>
7+
#include <asm/papr-miscdev.h>
8+
9+
#define LOC_CODE_SIZE 80
10+
#define RTAS_GET_INDICES_BUF_SIZE SZ_4K
11+
12+
struct papr_indices_io_block {
13+
union {
14+
struct {
15+
__u8 is_sensor; /* 0 for indicator and 1 for sensor */
16+
__u32 indice_type;
17+
} indices;
18+
struct {
19+
__u32 token; /* Sensor or indicator token */
20+
__u32 state; /* get / set state */
21+
/*
22+
* PAPR+ 12.3.2.4 Converged Location Code Rules - Length
23+
* Restrictions. 79 characters plus null.
24+
*/
25+
char location_code_str[LOC_CODE_SIZE]; /* location code */
26+
} dynamic_param;
27+
};
28+
};
29+
30+
/*
31+
* ioctls for /dev/papr-indices.
32+
* PAPR_INDICES_IOC_GET: Returns a get-indices handle fd to read data
33+
* PAPR_DYNAMIC_SENSOR_IOC_GET: Gets the state of the input sensor
34+
* PAPR_DYNAMIC_INDICATOR_IOC_SET: Sets the new state for the input indicator
35+
*/
36+
#define PAPR_INDICES_IOC_GET _IOW(PAPR_MISCDEV_IOC_ID, 3, struct papr_indices_io_block)
37+
#define PAPR_DYNAMIC_SENSOR_IOC_GET _IOWR(PAPR_MISCDEV_IOC_ID, 4, struct papr_indices_io_block)
38+
#define PAPR_DYNAMIC_INDICATOR_IOC_SET _IOW(PAPR_MISCDEV_IOC_ID, 5, struct papr_indices_io_block)
39+
40+
41+
#endif /* _UAPI_PAPR_INDICES_H_ */
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2+
#ifndef _UAPI_PAPR_PHYSICAL_ATTESTATION_H_
3+
#define _UAPI_PAPR_PHYSICAL_ATTESTATION_H_
4+
5+
#include <linux/types.h>
6+
#include <asm/ioctl.h>
7+
#include <asm/papr-miscdev.h>
8+
9+
#define PAPR_PHYATTEST_MAX_INPUT 4084 /* Max 4K buffer: 4K-12 */
10+
11+
/*
12+
* Defined in PAPR 2.13+ 21.6 Attestation Command Structures.
13+
* User space pass this struct and the max size should be 4K.
14+
*/
15+
struct papr_phy_attest_io_block {
16+
__u8 version;
17+
__u8 command;
18+
__u8 TCG_major_ver;
19+
__u8 TCG_minor_ver;
20+
__be32 length;
21+
__be32 correlator;
22+
__u8 payload[PAPR_PHYATTEST_MAX_INPUT];
23+
};
24+
25+
/*
26+
* ioctl for /dev/papr-physical-attestation. Returns a attestation
27+
* command fd handle
28+
*/
29+
#define PAPR_PHY_ATTEST_IOC_HANDLE _IOW(PAPR_MISCDEV_IOC_ID, 8, struct papr_phy_attest_io_block)
30+
31+
#endif /* _UAPI_PAPR_PHYSICAL_ATTESTATION_H_ */
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2+
#ifndef _UAPI_PAPR_PLATFORM_DUMP_H_
3+
#define _UAPI_PAPR_PLATFORM_DUMP_H_
4+
5+
#include <linux/types.h>
6+
#include <asm/ioctl.h>
7+
#include <asm/papr-miscdev.h>
8+
9+
/*
10+
* ioctl for /dev/papr-platform-dump. Returns a platform-dump handle fd
11+
* corresponding to dump tag.
12+
*/
13+
#define PAPR_PLATFORM_DUMP_IOC_CREATE_HANDLE _IOW(PAPR_MISCDEV_IOC_ID, 6, __u64)
14+
#define PAPR_PLATFORM_DUMP_IOC_INVALIDATE _IOW(PAPR_MISCDEV_IOC_ID, 7, __u64)
15+
16+
#endif /* _UAPI_PAPR_PLATFORM_DUMP_H_ */

arch/powerpc/kernel/rtas.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,12 @@ struct rtas_function {
9292
* Per-function locks for sequence-based RTAS functions.
9393
*/
9494
static DEFINE_MUTEX(rtas_ibm_activate_firmware_lock);
95-
static DEFINE_MUTEX(rtas_ibm_get_dynamic_sensor_state_lock);
96-
static DEFINE_MUTEX(rtas_ibm_get_indices_lock);
9795
static DEFINE_MUTEX(rtas_ibm_lpar_perftools_lock);
98-
static DEFINE_MUTEX(rtas_ibm_physical_attestation_lock);
99-
static DEFINE_MUTEX(rtas_ibm_set_dynamic_indicator_lock);
96+
DEFINE_MUTEX(rtas_ibm_physical_attestation_lock);
10097
DEFINE_MUTEX(rtas_ibm_get_vpd_lock);
98+
DEFINE_MUTEX(rtas_ibm_get_indices_lock);
99+
DEFINE_MUTEX(rtas_ibm_set_dynamic_indicator_lock);
100+
DEFINE_MUTEX(rtas_ibm_get_dynamic_sensor_state_lock);
101101

102102
static struct rtas_function rtas_function_table[] __ro_after_init = {
103103
[RTAS_FNIDX__CHECK_EXCEPTION] = {

arch/powerpc/platforms/pseries/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ ccflags-$(CONFIG_PPC_PSERIES_DEBUG) += -DDEBUG
33

44
obj-y := lpar.o hvCall.o nvram.o reconfig.o \
55
of_helpers.o rtas-work-area.o papr-sysparm.o \
6-
papr-vpd.o \
6+
papr-rtas-common.o papr-vpd.o papr-indices.o \
7+
papr-platform-dump.o papr-phy-attest.o \
78
setup.o iommu.o event_sources.o ras.o \
89
firmware.o power.o dlpar.o mobility.o rng.o \
910
pci.o pci_dlpar.o eeh_pseries.o msi.o \

0 commit comments

Comments
 (0)