Skip to content

Commit 3f95ecf

Browse files
debox1jwrdegoede
authored andcommitted
platform/x86/intel: vsec: Explicitly enable capabilities
Discovered Intel VSEC/DVSEC capabilities are enabled by default and only get disabled by quirk. Instead, remove such quirks and only enable support for capabilities that have been explicitly added to a new capabilities field. While here, also reorder the device info structures alphabetically. Signed-off-by: David E. Box <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
1 parent d7b2b93 commit 3f95ecf

File tree

2 files changed

+38
-40
lines changed

2 files changed

+38
-40
lines changed

drivers/platform/x86/intel/vsec.c

Lines changed: 30 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,6 @@ enum intel_vsec_id {
6767
VSEC_ID_TPMI = 66,
6868
};
6969

70-
static enum intel_vsec_id intel_vsec_allow_list[] = {
71-
VSEC_ID_TELEMETRY,
72-
VSEC_ID_WATCHER,
73-
VSEC_ID_CRASHLOG,
74-
VSEC_ID_SDSI,
75-
VSEC_ID_TPMI,
76-
};
77-
7870
static const char *intel_vsec_name(enum intel_vsec_id id)
7971
{
8072
switch (id) {
@@ -98,26 +90,19 @@ static const char *intel_vsec_name(enum intel_vsec_id id)
9890
}
9991
}
10092

101-
static bool intel_vsec_allowed(u16 id)
102-
{
103-
int i;
104-
105-
for (i = 0; i < ARRAY_SIZE(intel_vsec_allow_list); i++)
106-
if (intel_vsec_allow_list[i] == id)
107-
return true;
108-
109-
return false;
110-
}
111-
112-
static bool intel_vsec_disabled(u16 id, unsigned long quirks)
93+
static bool intel_vsec_supported(u16 id, unsigned long caps)
11394
{
11495
switch (id) {
96+
case VSEC_ID_TELEMETRY:
97+
return !!(caps & VSEC_CAP_TELEMETRY);
11598
case VSEC_ID_WATCHER:
116-
return !!(quirks & VSEC_QUIRK_NO_WATCHER);
117-
99+
return !!(caps & VSEC_CAP_WATCHER);
118100
case VSEC_ID_CRASHLOG:
119-
return !!(quirks & VSEC_QUIRK_NO_CRASHLOG);
120-
101+
return !!(caps & VSEC_CAP_CRASHLOG);
102+
case VSEC_ID_SDSI:
103+
return !!(caps & VSEC_CAP_SDSI);
104+
case VSEC_ID_TPMI:
105+
return !!(caps & VSEC_CAP_TPMI);
121106
default:
122107
return false;
123108
}
@@ -205,7 +190,7 @@ static int intel_vsec_add_dev(struct pci_dev *pdev, struct intel_vsec_header *he
205190
unsigned long quirks = info->quirks;
206191
int i;
207192

208-
if (!intel_vsec_allowed(header->id) || intel_vsec_disabled(header->id, quirks))
193+
if (!intel_vsec_supported(header->id, info->caps))
209194
return -EINVAL;
210195

211196
if (!header->num_entries) {
@@ -260,14 +245,14 @@ static int intel_vsec_add_dev(struct pci_dev *pdev, struct intel_vsec_header *he
260245
static bool intel_vsec_walk_header(struct pci_dev *pdev,
261246
struct intel_vsec_platform_info *info)
262247
{
263-
struct intel_vsec_header **header = info->capabilities;
248+
struct intel_vsec_header **header = info->headers;
264249
bool have_devices = false;
265250
int ret;
266251

267252
for ( ; *header; header++) {
268253
ret = intel_vsec_add_dev(pdev, *header, info);
269254
if (ret)
270-
dev_info(&pdev->dev, "Could not add device for DVSEC id %d\n",
255+
dev_info(&pdev->dev, "Could not add device for VSEC id %d\n",
271256
(*header)->id);
272257
else
273258
have_devices = true;
@@ -402,14 +387,8 @@ static int intel_vsec_pci_probe(struct pci_dev *pdev, const struct pci_device_id
402387
return 0;
403388
}
404389

405-
/* TGL info */
406-
static const struct intel_vsec_platform_info tgl_info = {
407-
.quirks = VSEC_QUIRK_NO_WATCHER | VSEC_QUIRK_NO_CRASHLOG |
408-
VSEC_QUIRK_TABLE_SHIFT | VSEC_QUIRK_EARLY_HW,
409-
};
410-
411390
/* DG1 info */
412-
static struct intel_vsec_header dg1_telemetry = {
391+
static struct intel_vsec_header dg1_header = {
413392
.length = 0x10,
414393
.id = 2,
415394
.num_entries = 1,
@@ -418,19 +397,31 @@ static struct intel_vsec_header dg1_telemetry = {
418397
.offset = 0x466000,
419398
};
420399

421-
static struct intel_vsec_header *dg1_capabilities[] = {
422-
&dg1_telemetry,
400+
static struct intel_vsec_header *dg1_headers[] = {
401+
&dg1_header,
423402
NULL
424403
};
425404

426405
static const struct intel_vsec_platform_info dg1_info = {
427-
.capabilities = dg1_capabilities,
406+
.caps = VSEC_CAP_TELEMETRY,
407+
.headers = dg1_headers,
428408
.quirks = VSEC_QUIRK_NO_DVSEC | VSEC_QUIRK_EARLY_HW,
429409
};
430410

431411
/* MTL info */
432412
static const struct intel_vsec_platform_info mtl_info = {
433-
.quirks = VSEC_QUIRK_NO_WATCHER | VSEC_QUIRK_NO_CRASHLOG,
413+
.caps = VSEC_CAP_TELEMETRY,
414+
};
415+
416+
/* OOBMSM info */
417+
static const struct intel_vsec_platform_info oobmsm_info = {
418+
.caps = VSEC_CAP_TELEMETRY | VSEC_CAP_SDSI | VSEC_CAP_TPMI,
419+
};
420+
421+
/* TGL info */
422+
static const struct intel_vsec_platform_info tgl_info = {
423+
.caps = VSEC_CAP_TELEMETRY,
424+
.quirks = VSEC_QUIRK_TABLE_SHIFT | VSEC_QUIRK_EARLY_HW,
434425
};
435426

436427
#define PCI_DEVICE_ID_INTEL_VSEC_ADL 0x467d
@@ -445,7 +436,7 @@ static const struct pci_device_id intel_vsec_pci_ids[] = {
445436
{ PCI_DEVICE_DATA(INTEL, VSEC_DG1, &dg1_info) },
446437
{ PCI_DEVICE_DATA(INTEL, VSEC_MTL_M, &mtl_info) },
447438
{ PCI_DEVICE_DATA(INTEL, VSEC_MTL_S, &mtl_info) },
448-
{ PCI_DEVICE_DATA(INTEL, VSEC_OOBMSM, &(struct intel_vsec_platform_info) {}) },
439+
{ PCI_DEVICE_DATA(INTEL, VSEC_OOBMSM, &oobmsm_info) },
449440
{ PCI_DEVICE_DATA(INTEL, VSEC_RPL, &tgl_info) },
450441
{ PCI_DEVICE_DATA(INTEL, VSEC_TGL, &tgl_info) },
451442
{ }

drivers/platform/x86/intel/vsec.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
#include <linux/auxiliary_bus.h>
66
#include <linux/bits.h>
77

8+
#define VSEC_CAP_TELEMETRY BIT(0)
9+
#define VSEC_CAP_WATCHER BIT(1)
10+
#define VSEC_CAP_CRASHLOG BIT(2)
11+
#define VSEC_CAP_SDSI BIT(3)
12+
#define VSEC_CAP_TPMI BIT(4)
13+
814
struct pci_dev;
915
struct resource;
1016

@@ -27,7 +33,8 @@ enum intel_vsec_quirks {
2733

2834
/* Platform specific data */
2935
struct intel_vsec_platform_info {
30-
struct intel_vsec_header **capabilities;
36+
struct intel_vsec_header **headers;
37+
unsigned long caps;
3138
unsigned long quirks;
3239
};
3340

0 commit comments

Comments
 (0)