Skip to content

Commit e92affc

Browse files
debox1jwrdegoede
authored andcommitted
platform/x86/intel/vsec: Add PMT read callbacks
Some PMT providers require device specific actions before their telemetry can be read. Provide assignable PMT read callbacks to allow providers to perform those actions. Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com> Signed-off-by: David E. Box <david.e.box@linux.intel.com> Link: https://lore.kernel.org/r/20240725122346.4063913-3-michael.j.ruhl@intel.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
1 parent fc9aef4 commit e92affc

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

drivers/platform/x86/intel/vsec.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ static int intel_vsec_add_dev(struct pci_dev *pdev, struct intel_vsec_header *he
212212
intel_vsec_dev->num_resources = header->num_entries;
213213
intel_vsec_dev->quirks = info->quirks;
214214
intel_vsec_dev->base_addr = info->base_addr;
215+
intel_vsec_dev->priv_data = info->priv_data;
215216

216217
if (header->id == VSEC_ID_SDSI)
217218
intel_vsec_dev->ida = &intel_vsec_sdsi_ida;

include/linux/intel_vsec.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,32 @@ enum intel_vsec_quirks {
6767
VSEC_QUIRK_EARLY_HW = BIT(4),
6868
};
6969

70+
/**
71+
* struct pmt_callbacks - Callback infrastructure for PMT devices
72+
* ->read_telem() when specified, called by client driver to access PMT data (instead
73+
* of direct copy).
74+
* @pdev: PCI device reference for the callback's use
75+
* @guid: ID of data to acccss
76+
* @data: buffer for the data to be copied
77+
* @count: size of buffer
78+
*/
79+
struct pmt_callbacks {
80+
int (*read_telem)(struct pci_dev *pdev, u32 guid, u64 *data, u32 count);
81+
};
82+
7083
/**
7184
* struct intel_vsec_platform_info - Platform specific data
7285
* @parent: parent device in the auxbus chain
7386
* @headers: list of headers to define the PMT client devices to create
87+
* @priv_data: private data, usable by parent devices, currently a callback
7488
* @caps: bitmask of PMT capabilities for the given headers
7589
* @quirks: bitmask of VSEC device quirks
7690
* @base_addr: allow a base address to be specified (rather than derived)
7791
*/
7892
struct intel_vsec_platform_info {
7993
struct device *parent;
8094
struct intel_vsec_header **headers;
95+
void *priv_data;
8196
unsigned long caps;
8297
unsigned long quirks;
8398
u64 base_addr;

0 commit comments

Comments
 (0)