intel/dev: Allow setting FORCE_PROBE for intel PCI IDs

For example:

CHIPSET(0x56a0, dg2_g10, "DG2", "Intel(R) Arc(tm) A770 Graphics", FORCE_PROBE)

For now if a PCI ID has FORCE_PROBE set, then we refuse to start the
device.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29273>
This commit is contained in:
Jordan Justen
2023-09-28 02:23:47 -07:00
committed by Marge Bot
parent 8d098ecfea
commit c967b38c7c
2 changed files with 21 additions and 4 deletions

View File

@@ -1333,14 +1333,28 @@ intel_device_info_update_cs_workgroup_threads(struct intel_device_info *devinfo)
MIN2(devinfo->max_cs_threads, 64); MIN2(devinfo->max_cs_threads, 64);
} }
struct device_init_config {
bool require_force_probe;
};
/* Example PCI ID entry using FORCE_PROBE:
*
* CHIPSET(0x1234, foo, "FOO", "Intel(R) Graphics", FORCE_PROBE)
*/
#define FORCE_PROBE .require_force_probe = true
static bool static bool
intel_device_info_init_common(int pci_id, intel_device_info_init_common(int pci_id,
struct intel_device_info *devinfo) struct intel_device_info *devinfo)
{ {
struct device_init_config device_config = { 0 };
switch (pci_id) { switch (pci_id) {
#undef CHIPSET #undef CHIPSET
#define CHIPSET(id, family, fam_str, name) \ #define CHIPSET(id, family, fam_str, name, ...) \
case id: *devinfo = intel_device_info_##family; break; case id: \
*devinfo = intel_device_info_##family; \
device_config = *&(struct device_init_config) { __VA_ARGS__ }; \
break;
#include "pci_ids/crocus_pci_ids.h" #include "pci_ids/crocus_pci_ids.h"
#include "pci_ids/iris_pci_ids.h" #include "pci_ids/iris_pci_ids.h"
@@ -1356,7 +1370,7 @@ intel_device_info_init_common(int pci_id,
switch (pci_id) { switch (pci_id) {
#undef CHIPSET #undef CHIPSET
#define CHIPSET(_id, _family, _fam_str, _name) \ #define CHIPSET(_id, _family, _fam_str, _name, ...) \
case _id: \ case _id: \
/* sizeof(str_literal) includes the null */ \ /* sizeof(str_literal) includes the null */ \
STATIC_ASSERT(sizeof(_name) + sizeof(_fam_str) + 2 <= \ STATIC_ASSERT(sizeof(_name) + sizeof(_fam_str) + 2 <= \
@@ -1369,6 +1383,9 @@ intel_device_info_init_common(int pci_id,
strncpy(devinfo->name, "Intel Unknown", sizeof(devinfo->name)); strncpy(devinfo->name, "Intel Unknown", sizeof(devinfo->name));
} }
if (device_config.require_force_probe)
return false;
devinfo->pci_device_id = pci_id; devinfo->pci_device_id = pci_id;
fill_masks(devinfo); fill_masks(devinfo);

View File

@@ -14,7 +14,7 @@ main(int argc, char *argv[])
const char *name; const char *name;
} chipsets[] = { } chipsets[] = {
#undef CHIPSET #undef CHIPSET
#define CHIPSET(id, family, family_str, str_name) { .pci_id = id, .name = str_name, }, #define CHIPSET(id, family, family_str, str_name, ...) { .pci_id = id, .name = str_name, },
#include "pci_ids/iris_pci_ids.h" #include "pci_ids/iris_pci_ids.h"
#include "pci_ids/crocus_pci_ids.h" #include "pci_ids/crocus_pci_ids.h"
}; };