platform/x86/intel/vsec: Add PMT read callbacks
authorDavid E. Box <david.e.box@linux.intel.com>
Thu, 25 Jul 2024 12:23:41 +0000 (08:23 -0400)
committerHans de Goede <hdegoede@redhat.com>
Mon, 12 Aug 2024 14:21:31 +0000 (16:21 +0200)
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>
drivers/platform/x86/intel/vsec.c
include/linux/intel_vsec.h

index 2b46807..7b5cc99 100644 (file)
@@ -212,6 +212,7 @@ static int intel_vsec_add_dev(struct pci_dev *pdev, struct intel_vsec_header *he
        intel_vsec_dev->num_resources = header->num_entries;
        intel_vsec_dev->quirks = info->quirks;
        intel_vsec_dev->base_addr = info->base_addr;
+       intel_vsec_dev->priv_data = info->priv_data;
 
        if (header->id == VSEC_ID_SDSI)
                intel_vsec_dev->ida = &intel_vsec_sdsi_ida;
index 6495e37..11ee185 100644 (file)
@@ -67,10 +67,24 @@ enum intel_vsec_quirks {
        VSEC_QUIRK_EARLY_HW     = BIT(4),
 };
 
+/**
+ * struct pmt_callbacks - Callback infrastructure for PMT devices
+ * ->read_telem() when specified, called by client driver to access PMT data (instead
+ * of direct copy).
+ * @pdev:  PCI device reference for the callback's use
+ * @guid:  ID of data to acccss
+ * @data:  buffer for the data to be copied
+ * @count: size of buffer
+ */
+struct pmt_callbacks {
+       int (*read_telem)(struct pci_dev *pdev, u32 guid, u64 *data, u32 count);
+};
+
 /**
  * struct intel_vsec_platform_info - Platform specific data
  * @parent:    parent device in the auxbus chain
  * @headers:   list of headers to define the PMT client devices to create
+ * @priv_data: private data, usable by parent devices, currently a callback
  * @caps:      bitmask of PMT capabilities for the given headers
  * @quirks:    bitmask of VSEC device quirks
  * @base_addr: allow a base address to be specified (rather than derived)
@@ -78,6 +92,7 @@ enum intel_vsec_quirks {
 struct intel_vsec_platform_info {
        struct device *parent;
        struct intel_vsec_header **headers;
+       void *priv_data;
        unsigned long caps;
        unsigned long quirks;
        u64 base_addr;