Skip to content

Commit 07db5bd

Browse files
aalteresdceraolo
authored andcommitted
drm/i915/pxp: Separate PXP FW interface structures for both v42 and 43
Previously, we only used PXP FW interface version-42 structures for PXP arbitration session on ADL/TGL products and version-43 for HuC authentication on DG2. That worked fine despite not differentiating such versioning of the PXP firmware interaction structures. This was okay back then because the only commands used via version 42 was not used via version 43 and vice versa. With MTL, we'll need both these versions side by side for the same commands (PXP-session) with the older platform feature support. That said, let's create separate files to define the structures and definitions for both version-42 and 43 of PXP FW interfaces. Signed-off-by: Alan Previn <[email protected]> Reviewed-by: Daniele Ceraolo Spurio <[email protected]> Signed-off-by: Daniele Ceraolo Spurio <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 5524b5e commit 07db5bd

File tree

6 files changed

+100
-68
lines changed

6 files changed

+100
-68
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/* SPDX-License-Identifier: MIT */
2+
/*
3+
* Copyright(c) 2020, Intel Corporation. All rights reserved.
4+
*/
5+
6+
#ifndef __INTEL_PXP_FW_INTERFACE_42_H__
7+
#define __INTEL_PXP_FW_INTERFACE_42_H__
8+
9+
#include <linux/types.h>
10+
#include "intel_pxp_cmd_interface_cmn.h"
11+
12+
/* PXP-Opcode for Init Session */
13+
#define PXP42_CMDID_INIT_SESSION 0x1e
14+
15+
/* PXP-Input-Packet: Init Session (Arb-Session) */
16+
struct pxp42_create_arb_in {
17+
struct pxp_cmd_header header;
18+
u32 protection_mode;
19+
#define PXP42_ARB_SESSION_MODE_HEAVY 0x2
20+
u32 session_id;
21+
} __packed;
22+
23+
/* PXP-Output-Packet: Init Session */
24+
struct pxp42_create_arb_out {
25+
struct pxp_cmd_header header;
26+
} __packed;
27+
28+
#endif /* __INTEL_PXP_FW_INTERFACE_42_H__ */
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/* SPDX-License-Identifier: MIT */
2+
/*
3+
* Copyright(c) 2022, Intel Corporation. All rights reserved.
4+
*/
5+
6+
#ifndef __INTEL_PXP_FW_INTERFACE_43_H__
7+
#define __INTEL_PXP_FW_INTERFACE_43_H__
8+
9+
#include <linux/types.h>
10+
#include "intel_pxp_cmd_interface_cmn.h"
11+
12+
/* PXP-Cmd-Op definitions */
13+
#define PXP43_CMDID_START_HUC_AUTH 0x0000003A
14+
15+
/* PXP-Input-Packet: HUC-Authentication */
16+
struct pxp43_start_huc_auth_in {
17+
struct pxp_cmd_header header;
18+
__le64 huc_base_address;
19+
} __packed;
20+
21+
/* PXP-Output-Packet: HUC-Authentication */
22+
struct pxp43_start_huc_auth_out {
23+
struct pxp_cmd_header header;
24+
} __packed;
25+
26+
#endif /* __INTEL_PXP_FW_INTERFACE_43_H__ */
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/* SPDX-License-Identifier: MIT */
2+
/*
3+
* Copyright(c) 2022, Intel Corporation. All rights reserved.
4+
*/
5+
6+
#ifndef __INTEL_PXP_FW_INTERFACE_CMN_H__
7+
#define __INTEL_PXP_FW_INTERFACE_CMN_H__
8+
9+
#include <linux/types.h>
10+
11+
#define PXP_APIVER(x, y) (((x) & 0xFFFF) << 16 | ((y) & 0xFFFF))
12+
13+
/*
14+
* there are a lot of status codes for PXP, but we only define the cross-API
15+
* common ones that we actually can handle in the kernel driver. Other failure
16+
* codes should be printed to error msg for debug.
17+
*/
18+
enum pxp_status {
19+
PXP_STATUS_SUCCESS = 0x0,
20+
PXP_STATUS_OP_NOT_PERMITTED = 0x4013
21+
};
22+
23+
/* Common PXP FW message header */
24+
struct pxp_cmd_header {
25+
u32 api_version;
26+
u32 command_id;
27+
union {
28+
u32 status; /* out */
29+
u32 stream_id; /* in */
30+
};
31+
/* Length of the message (excluding the header) */
32+
u32 buffer_len;
33+
} __packed;
34+
35+
#endif /* __INTEL_PXP_FW_INTERFACE_CMN_H__ */

drivers/gpu/drm/i915/pxp/intel_pxp_huc.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
#include "intel_pxp_huc.h"
1515
#include "intel_pxp_tee.h"
1616
#include "intel_pxp_types.h"
17-
#include "intel_pxp_tee_interface.h"
17+
#include "intel_pxp_cmd_interface_43.h"
1818

1919
int intel_pxp_huc_load_and_auth(struct intel_pxp *pxp)
2020
{
2121
struct intel_gt *gt = pxp_to_gt(pxp);
2222
struct intel_huc *huc = &gt->uc.huc;
23-
struct pxp_tee_start_huc_auth_in huc_in = {0};
24-
struct pxp_tee_start_huc_auth_out huc_out = {0};
23+
struct pxp43_start_huc_auth_in huc_in = {0};
24+
struct pxp43_start_huc_auth_out huc_out = {0};
2525
dma_addr_t huc_phys_addr;
2626
u8 client_id = 0;
2727
u8 fence_id = 0;
@@ -33,8 +33,8 @@ int intel_pxp_huc_load_and_auth(struct intel_pxp *pxp)
3333
huc_phys_addr = i915_gem_object_get_dma_address(huc->fw.obj, 0);
3434

3535
/* write the PXP message into the lmem (the sg list) */
36-
huc_in.header.api_version = PXP_TEE_43_APIVER;
37-
huc_in.header.command_id = PXP_TEE_43_START_HUC_AUTH;
36+
huc_in.header.api_version = PXP_APIVER(4, 3);
37+
huc_in.header.command_id = PXP43_CMDID_START_HUC_AUTH;
3838
huc_in.header.status = 0;
3939
huc_in.header.buffer_len = sizeof(huc_in.huc_base_address);
4040
huc_in.huc_base_address = huc_phys_addr;

drivers/gpu/drm/i915/pxp/intel_pxp_tee.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include "intel_pxp.h"
1515
#include "intel_pxp_session.h"
1616
#include "intel_pxp_tee.h"
17-
#include "intel_pxp_tee_interface.h"
17+
#include "intel_pxp_cmd_interface_42.h"
1818
#include "intel_pxp_huc.h"
1919

2020
static inline struct intel_pxp *i915_dev_to_pxp(struct device *i915_kdev)
@@ -286,14 +286,14 @@ int intel_pxp_tee_cmd_create_arb_session(struct intel_pxp *pxp,
286286
int arb_session_id)
287287
{
288288
struct drm_i915_private *i915 = pxp_to_gt(pxp)->i915;
289-
struct pxp_tee_create_arb_in msg_in = {0};
290-
struct pxp_tee_create_arb_out msg_out = {0};
289+
struct pxp42_create_arb_in msg_in = {0};
290+
struct pxp42_create_arb_out msg_out = {0};
291291
int ret;
292292

293-
msg_in.header.api_version = PXP_TEE_APIVER;
294-
msg_in.header.command_id = PXP_TEE_ARB_CMDID;
293+
msg_in.header.api_version = PXP_APIVER(4, 2);
294+
msg_in.header.command_id = PXP42_CMDID_INIT_SESSION;
295295
msg_in.header.buffer_len = sizeof(msg_in) - sizeof(msg_in.header);
296-
msg_in.protection_mode = PXP_TEE_ARB_PROTECTION_MODE;
296+
msg_in.protection_mode = PXP42_ARB_SESSION_MODE_HEAVY;
297297
msg_in.session_id = arb_session_id;
298298

299299
ret = intel_pxp_tee_io_message(pxp,

drivers/gpu/drm/i915/pxp/intel_pxp_tee_interface.h

Lines changed: 0 additions & 57 deletions
This file was deleted.

0 commit comments

Comments
 (0)