Unverified Commit 353042d5 authored by David E. Box's avatar David E. Box Committed by Ilpo Järvinen
Browse files

platform/x86/intel/vsec: Switch exported helpers from pci_dev to device



Preparatory refactor for ACPI-enumerated PMT endpoints. Several exported
PMT/VSEC interfaces and structs carried struct pci_dev * even though
callers only need a generic struct device. Move those to struct device * so
the same APIs work for PCI and ACPI parents.

Acked-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: default avatarDavid E. Box <david.e.box@linux.intel.com>
Link: https://patch.msgid.link/20260313015202.3660072-5-david.e.box@linux.intel.com


Reviewed-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
parent c62fd96a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ static void read_residency_counter(struct xe_device *xe, struct xe_mmio *mmio,
	u64 residency = 0;
	int ret;

	ret = xe_pmt_telem_read(to_pci_dev(xe->drm.dev),
	ret = xe_pmt_telem_read(xe->drm.dev,
				xe_mmio_read32(mmio, PUNIT_TELEMETRY_GUID),
				&residency, offset, sizeof(residency));
	if (ret != sizeof(residency)) {
+1 −1
Original line number Diff line number Diff line
@@ -506,7 +506,7 @@ xe_hwmon_energy_get(struct xe_hwmon *hwmon, int channel, long *energy)
	if (hwmon->xe->info.platform == XE_BATTLEMAGE) {
		u64 pmt_val;

		ret = xe_pmt_telem_read(to_pci_dev(hwmon->xe->drm.dev),
		ret = xe_pmt_telem_read(hwmon->xe->drm.dev,
					xe_mmio_read32(mmio, PUNIT_TELEMETRY_GUID),
					&pmt_val, BMG_ENERGY_STATUS_PMT_OFFSET,	sizeof(pmt_val));
		if (ret != sizeof(pmt_val)) {
+3 −4
Original line number Diff line number Diff line
@@ -140,10 +140,10 @@ static int xe_guid_decode(u32 guid, int *index, u32 *offset)
	return 0;
}

int xe_pmt_telem_read(struct pci_dev *pdev, u32 guid, u64 *data, loff_t user_offset,
int xe_pmt_telem_read(struct device *dev, u32 guid, u64 *data, loff_t user_offset,
		      u32 count)
{
	struct xe_device *xe = pdev_to_xe_device(pdev);
	struct xe_device *xe = kdev_to_xe_device(dev);
	void __iomem *telem_addr = xe->mmio.regs + BMG_TELEMETRY_OFFSET;
	u32 mem_region;
	u32 offset;
@@ -198,7 +198,6 @@ void xe_vsec_init(struct xe_device *xe)
{
	struct intel_vsec_platform_info *info;
	struct device *dev = xe->drm.dev;
	struct pci_dev *pdev = to_pci_dev(dev);
	enum xe_vsec platform;

	platform = get_platform_info(xe);
@@ -221,6 +220,6 @@ void xe_vsec_init(struct xe_device *xe)
	 * Register a VSEC. Cleanup is handled using device managed
	 * resources.
	 */
	intel_vsec_register(pdev, info);
	intel_vsec_register(dev, info);
}
MODULE_IMPORT_NS("INTEL_VSEC");
+2 −2
Original line number Diff line number Diff line
@@ -6,10 +6,10 @@

#include <linux/types.h>

struct pci_dev;
struct device;
struct xe_device;

void xe_vsec_init(struct xe_device *xe);
int xe_pmt_telem_read(struct pci_dev *pdev, u32 guid, u64 *data, loff_t user_offset, u32 count);
int xe_pmt_telem_read(struct device *dev, u32 guid, u64 *data, loff_t user_offset, u32 count);

#endif
+2 −2
Original line number Diff line number Diff line
@@ -1315,7 +1315,7 @@ static struct telem_endpoint *pmc_core_register_endpoint(struct pci_dev *pcidev,
	unsigned int i;

	for (i = 0; guids[i]; i++) {
		ep = pmt_telem_find_and_register_endpoint(pcidev, guids[i], 0);
		ep = pmt_telem_find_and_register_endpoint(&pcidev->dev, guids[i], 0);
		if (!IS_ERR(ep))
			return ep;
	}
@@ -1600,7 +1600,7 @@ static int pmc_core_get_telem_info(struct pmc_dev *pmcdev, struct pmc_dev_info *
		if (!pmc->map->lpm_req_guid)
			return -ENXIO;

		ep = pmt_telem_find_and_register_endpoint(pcidev, pmc->map->lpm_req_guid, 0);
		ep = pmt_telem_find_and_register_endpoint(&pcidev->dev, pmc->map->lpm_req_guid, 0);
		if (IS_ERR(ep)) {
			dev_dbg(&pmcdev->pdev->dev, "couldn't get telem endpoint %pe", ep);
			return -EPROBE_DEFER;
Loading