forked from mirrors/linux
Add support to manage power limits using pcode mailbox commands
for supported platforms.
v2:
- Address review comments. (Badal)
- Use mailbox commands instead of registers to manage power limits
for BMG.
- Clamp the maximum power limit to GPU firmware default value.
v3:
- Clamp power limit in write also for platforms with mailbox support.
v4:
- Remove unnecessary debug prints. (Badal)
v5:
- Update description of variable pl1_on_boot to fix kernel-doc error.
v6:
- Improve commit message, refer to BIOS as GPU firmware.
- Change macro READ_PL_FROM_BIOS to READ_PL_FROM_FW.
- Rectify drm_warn to drm_info.
Signed-off-by: Karthik Poosa <karthik.poosa@intel.com>
Fixes: e90f7a58e6 ("drm/xe/hwmon: Add HWMON support for BMG")
Reviewed-by: Badal Nilawar <badal.nilawar@intel.com>
Link: https://lore.kernel.org/r/20250529163458.2354509-2-karthik.poosa@intel.com
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
(cherry picked from commit 7596d839f6228757fe17a810da2d1c5f3305078c)
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
35 lines
1 KiB
C
35 lines
1 KiB
C
/* SPDX-License-Identifier: MIT */
|
|
/*
|
|
* Copyright © 2022 Intel Corporation
|
|
*/
|
|
|
|
#ifndef _XE_PCODE_H_
|
|
#define _XE_PCODE_H_
|
|
|
|
#include <linux/types.h>
|
|
struct xe_tile;
|
|
struct xe_device;
|
|
|
|
void xe_pcode_init(struct xe_tile *tile);
|
|
int xe_pcode_probe_early(struct xe_device *xe);
|
|
int xe_pcode_ready(struct xe_device *xe, bool locked);
|
|
int xe_pcode_init_min_freq_table(struct xe_tile *tile, u32 min_gt_freq,
|
|
u32 max_gt_freq);
|
|
int xe_pcode_read(struct xe_tile *tile, u32 mbox, u32 *val, u32 *val1);
|
|
int xe_pcode_write_timeout(struct xe_tile *tile, u32 mbox, u32 val,
|
|
int timeout_ms);
|
|
int xe_pcode_write64_timeout(struct xe_tile *tile, u32 mbox, u32 data0,
|
|
u32 data1, int timeout);
|
|
|
|
#define xe_pcode_write(tile, mbox, val) \
|
|
xe_pcode_write_timeout(tile, mbox, val, 1)
|
|
|
|
int xe_pcode_request(struct xe_tile *tile, u32 mbox, u32 request,
|
|
u32 reply_mask, u32 reply, int timeout_ms);
|
|
|
|
#define PCODE_MBOX(mbcmd, param1, param2)\
|
|
(FIELD_PREP(PCODE_MB_COMMAND, mbcmd)\
|
|
| FIELD_PREP(PCODE_MB_PARAM1, param1)\
|
|
| FIELD_PREP(PCODE_MB_PARAM2, param2))
|
|
|
|
#endif
|