VSEC

Some GPUs support the PMT feature. For those that do, this API provides probe, discovery and usage (control and access) for GPUs that have PMT.

PMT is usually accessed through a PCI function. However, that is not always available, so the PMT intel_vsec_register() function can be used to set up PMT usage.

Internal API

int xe_pmt_telem_read(struct device *dev, u32 guid, u64 *data, loff_t user_offset, u32 count)

Given a device and a PMT GUID, read data into a buffer

Parameters

struct device *dev

valid Xe device

u32 guid

PMT GUID (from the PMT discovery struct)

u64 *data

buffer to place data in

loff_t user_offset

a user offset relative to the beginning of the data to read

u32 count

bytes to read

Description

This is a callback API. I.e this can be accessed external to the XE driver (PMT driver scope). Because of this, DRM hotplug needs to be verified (drm_dev_enter()).

Return

  • -ENODEV device is not available (hotplug)

  • -EAGAIN base_offset has not been set, so init path has not yet been done.

  • -ENODATA for incorrect power state

  • -EINVAL for unsupported PMT feature

  • count number of bytes read on success

int xe_pmt_discovery_read(struct device *dev, unsigned long cap_id, u32 element, u32 *disc_data)

Given a device and an index, read discovery data into a buffer

Parameters

struct device *dev

valid Xe device

unsigned long cap_id

PMT type

u32 element

element to access

u32 *disc_data

buffer for discovery data

Description

This is a callback API. I.e this can be accessed external to the XE driver (PMT driver scope). Because of this, DRM hotplug needs to be verified (drm_dev_enter()).

Runtime is required to be active. Calling this out of that scope is not a correct use case (probe, late-bind probe).

Return

  • -ENODEV device is not available (hotplug)

  • -EINVAL for unsupported device or PMT feature

  • -ENODATA incorrect power state

  • 0 on success

int xe_pmt_read_reg(struct device *dev, u32 guid, u32 *reg, u32 offset)

read a crashlog register

Parameters

struct device *dev

the xe device that registered the callback

u32 guid

PMT guid of the crashlog instance

u32 *reg

data read from the PMT data structure

u32 offset

which data to read from the PMT data structure

Description

Read the requested PMT register based on the pcie device and guid. The supported struct is the Crashlog Type1 Version2.

Currently this is for CRI only.

Return

  • -ENODEV device is not available (hotplug)

  • -EINVAL invalid guid

  • 0 success

int xe_vsec_get_guid(struct xe_device *xe, u32 *guid)

Get and cache the PUNIT guid value

Parameters

struct xe_device *xe

valid xe device

u32 *guid

returned guid

Return

  • -ENODATA device is not active

  • -EINVAL unsupported platform

  • 0 success

void xe_vsec_init(struct xe_device *xe)

Initialize resources and add intel_vsec auxiliary interface

Parameters

struct xe_device *xe

valid xe instance

void xe_vsec_remove(struct xe_device *xe)

cleanup any outstanding resources

Parameters

struct xe_device *xe

valid xe instance