Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Mallesh Koujalagi" <mallesh.koujalagi@intel.com>,
	intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v2 4/4] drm/xe/cper: Add PCI ID to GUID mapping verification in KUnit
Date: Mon, 30 Nov 2026 14:16:23 +0000	[thread overview]
Message-ID: <sashiko-outbox-241368@kernel.org> (raw)
In-Reply-To: <20261130140815.2227101-10-mallesh.koujalagi@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] drm/xe/cper: cper_test_guid_matches_pci_id() duplicates
  xe_device_guids table
--

commit 176ab22f8c81e3c66e0ddfd127c0940356bbfeeb
Author: Mallesh Koujalagi <mallesh.koujalagi@intel.com>

drm/xe/cper: Add PCI ID to GUID mapping verification in KUnit

This commit adds a KUnit test case to verify that each supported PCI
device ID maps to its expected CPER GUID.

> diff --git a/drivers/gpu/drm/xe/tests/xe_cper_kunit.c b/drivers/gpu/drm/xe/tests/xe_cper_kunit.c
> index 5bd0bbcef566f..72c86b7ea3772 100644
> --- a/drivers/gpu/drm/xe/tests/xe_cper_kunit.c
> +++ b/drivers/gpu/drm/xe/tests/xe_cper_kunit.c
> @@ -18,6 +18,32 @@ static const u16 cper_test_pci_ids[] = {
>  
>  #undef CPER_TEST_PCI_ID
>  
> +/* UUIDv5 outputs for "platform/8086:<device_id>". */
> +static const struct xe_device_guid_entry cper_test_expected_guids[] = {
> +	{ 0x674C, GUID_INIT(0x9046afe5, 0x9041, 0x5124,
> +			    0x86, 0x14, 0x92, 0x55, 0x0d, 0x9e, 0x9d, 0xa6) },
> +	{ 0x674D, GUID_INIT(0xf95911b8, 0x6564, 0x5905,
> +			    0xa6, 0xa7, 0xb9, 0xbf, 0x54, 0xab, 0x6c, 0x27) },
> +	{ 0x674E, GUID_INIT(0xb8d24106, 0x0108, 0x59f1,
> +			    0x8f, 0xfc, 0x9f, 0xc4, 0xa9, 0xc9, 0xb7, 0xb0) },
> +	{ 0x674F, GUID_INIT(0xdd8dd88e, 0xef2f, 0x59b1,
> +			    0x99, 0x15, 0xdb, 0x6f, 0x1d, 0xc9, 0xb4, 0x5d) },
> +	{ 0x6750, GUID_INIT(0x1dd66c44, 0x87d5, 0x524a,
> +			    0xad, 0x6e, 0xfc, 0x18, 0x9d, 0x42, 0x6f, 0x1a) },
> +	{ 0x6751, GUID_INIT(0x17d0dd04, 0x2fad, 0x5400,
> +			    0x99, 0xc8, 0x9b, 0x45, 0x51, 0x3b, 0x67, 0xe3) },
> +	{ 0x6752, GUID_INIT(0xb778ead8, 0x0009, 0x59a7,
> +			    0xa1, 0x3a, 0x78, 0xce, 0x4d, 0xdd, 0xae, 0xf5) },
> +	{ 0x6753, GUID_INIT(0x7fcd80a7, 0xca5a, 0x5d21,
> +			    0x97, 0x0f, 0xe7, 0x6a, 0xc0, 0x27, 0xbb, 0x76) },
> +	{ 0x6754, GUID_INIT(0xf87c6f75, 0x96c1, 0x5ce4,
> +			    0x86, 0x75, 0xc7, 0xaa, 0x04, 0xbc, 0xc6, 0xd8) },
> +	{ 0x6755, GUID_INIT(0x839514b4, 0xf269, 0x5e61,
> +			    0xba, 0x2f, 0x79, 0x08, 0xa7, 0x59, 0x06, 0x5f) },
> +	{ 0x6756, GUID_INIT(0x5003ffda, 0xab3f, 0x5ae1,
> +			    0xb3, 0xbd, 0x19, 0x60, 0x0e, 0x0d, 0x4c, 0xc2) },
> +};
> +
>  static bool cper_test_pci_id_known(u16 device_id)
>  {
>  	unsigned int i;
> @@ -40,6 +66,17 @@ static const struct xe_device_guid_entry *cper_test_guid_entry(u16 device_id)
>  	return NULL;
>  }
>  
> +static const struct xe_device_guid_entry *cper_test_expected_guid_entry(u16 device_id)
> +{
> +	unsigned int i;
> +
> +	for (i = 0; i < ARRAY_SIZE(cper_test_expected_guids); i++)
> +		if (cper_test_expected_guids[i].device_id == device_id)
> +			return &cper_test_expected_guids[i];
> +
> +	return NULL;
> +}
> +
>  static void cper_test_pci_ids_have_guid(struct kunit *test)
>  {
>  	unsigned int i;
> @@ -52,6 +89,31 @@ static void cper_test_pci_ids_have_guid(struct kunit *test)
>  					  cper_test_pci_ids[i]);
>  }
>  
> +static void cper_test_guid_matches_pci_id(struct kunit *test)
> +{
> +	unsigned int i;
> +
> +	KUNIT_ASSERT_EQ(test, ARRAY_SIZE(cper_test_expected_guids),
> +			ARRAY_SIZE(cper_test_pci_ids));
> +
> +	for (i = 0; i < ARRAY_SIZE(cper_test_pci_ids); i++) {
> +		u16 device_id = cper_test_pci_ids[i];
> +		const struct xe_device_guid_entry *actual = cper_test_guid_entry(device_id);
> +		const struct xe_device_guid_entry *expected =
> +			cper_test_expected_guid_entry(device_id);
> +
> +		KUNIT_ASSERT_NOT_NULL_MSG(test, expected,
> +					  "PCI ID %#06x has no expected GUID",
> +					  device_id);
> +		KUNIT_ASSERT_NOT_NULL_MSG(test, actual,
> +					  "PCI ID %#06x has no GUID entry",
> +					  device_id);
> +		KUNIT_EXPECT_TRUE_MSG(test, guid_equal(&actual->guid, &expected->guid),
> +				      "PCI ID %#06x has GUID %pUl, expected %pUl",
> +				      device_id, &actual->guid, &expected->guid);
> +	}
> +}

[Severity: Low]
Does cper_test_guid_matches_pci_id() just compare xe_device_guids[]
against a verbatim copy of itself?

cper_test_expected_guids[] duplicates the static xe_device_guids[] table
defined in drivers/gpu/drm/xe/xe_cper.c, and
cper_test_expected_guid_entry() duplicates the linear search in
cper_test_guid_entry().  Because the test compares these two hardcoded
tables using test-local helpers, it requires keeping two identical tables
in sync without exercising lookup_device_guid() or computing the expected
UUIDv5 from "platform/8086:<device_id>".

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261130140815.2227101-6-mallesh.koujalagi@intel.com?part=4

      reply	other threads:[~2026-11-30 14:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 14:08 [PATCH v2 0/4] Add KUnit tests for CPER GUID mappings Mallesh Koujalagi
2026-11-30 14:08 ` [PATCH v2 1/4] drm/xe/cper: " Mallesh Koujalagi
2026-11-30 14:25   ` sashiko-bot
2026-11-30 14:08 ` [PATCH v2 2/4] drm/xe/cper: Add KUnit tests for GUID uniqueness Mallesh Koujalagi
2026-11-30 14:08 ` [PATCH v2 3/4] drm/xe/cper: Validate platform GUIDs in KUnit tests Mallesh Koujalagi
2026-11-30 14:08 ` [PATCH v2 4/4] drm/xe/cper: Add PCI ID to GUID mapping verification in KUnit Mallesh Koujalagi
2026-11-30 14:16   ` sashiko-bot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-241368@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=mallesh.koujalagi@intel.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox