From 2d0664b2e26d1f2599a3dfae2f5c035749a30884 Mon Sep 17 00:00:00 2001 From: Aaron Li Date: Tue, 24 Feb 2026 13:50:53 +0800 Subject: [PATCH] PCIE IDE: add new case Test.KeyRefreshKs1 fix #348 Signed-off-by: Aaron Li --- teeio-validator/include/ide_test.h | 2 +- .../include/pcie_ide_common.h | 11 ++++-- .../pcie_ide_test_lib/pcie_ide_common.c | 5 +-- .../test_case/test_case_full_keyrefresh.c | 35 ++++++++++++++++--- 4 files changed, 42 insertions(+), 11 deletions(-) diff --git a/teeio-validator/include/ide_test.h b/teeio-validator/include/ide_test.h index e9f4a98..e72706f 100644 --- a/teeio-validator/include/ide_test.h +++ b/teeio-validator/include/ide_test.h @@ -60,7 +60,7 @@ #define MAX_KSETGO_CASE_ID 4 #define MAX_KSETSTOP_CASE_ID 4 #define MAX_SPDMSESSION_CASE_ID 2 -#define MAX_FULL_CASE_ID 2 +#define MAX_FULL_CASE_ID 3 #define INVALID_PORT_ID 0 diff --git a/teeio-validator/library/pcie_ide_test_lib/include/pcie_ide_common.h b/teeio-validator/library/pcie_ide_test_lib/include/pcie_ide_common.h index 42ef1ae..c60c30d 100644 --- a/teeio-validator/library/pcie_ide_test_lib/include/pcie_ide_common.h +++ b/teeio-validator/library/pcie_ide_test_lib/include/pcie_ide_common.h @@ -106,9 +106,14 @@ void pcie_ide_test_full_1_run(void *test_context); void pcie_ide_test_full_1_teardown(void *test_context); // Full case - KeyRefresh -bool pcie_ide_test_full_keyrefresh_setup(void *test_context); -void pcie_ide_test_full_keyrefresh_run(void *test_context); -void pcie_ide_test_full_keyrefresh_teardown(void *test_context); +bool pcie_ide_test_full_keyrefresh_ks0_setup(void *test_context); +void pcie_ide_test_full_keyrefresh_ks0_run(void *test_context); +void pcie_ide_test_full_keyrefresh_ks0_teardown(void *test_context); + +// Full case - KeyRefreshKs1 +bool pcie_ide_test_full_keyrefresh_ks1_setup(void *test_context); +void pcie_ide_test_full_keyrefresh_ks1_run(void *test_context); +void pcie_ide_test_full_keyrefresh_ks1_teardown(void *test_context); // // PCIE_IDE Test Config diff --git a/teeio-validator/library/pcie_ide_test_lib/pcie_ide_common.c b/teeio-validator/library/pcie_ide_test_lib/pcie_ide_common.c index 4cfe267..efb8d80 100644 --- a/teeio-validator/library/pcie_ide_test_lib/pcie_ide_common.c +++ b/teeio-validator/library/pcie_ide_test_lib/pcie_ide_common.c @@ -135,7 +135,7 @@ ide_test_group_funcs_t m_group_funcs[IDE_TEST_TOPOLOGY_TYPE_NUM] = { } }; -#define TEST_CLASS_CASE_NAMES "IdeStream,KeyRefresh" +#define TEST_CLASS_CASE_NAMES "IdeStream,KeyRefresh,KeyRefreshKs1" ide_test_case_name_t m_test_case_names[] = { {"Query", "1,2", IDE_COMMON_TEST_CASE_QUERY}, @@ -182,7 +182,8 @@ ide_test_case_funcs_t m_pcie_ide_spdm_session_cases[MAX_SPDMSESSION_CASE_ID] = { ide_test_case_funcs_t m_pcie_ide_test_full_cases[MAX_FULL_CASE_ID] = { { pcie_ide_test_full_1_setup, pcie_ide_test_full_1_run, pcie_ide_test_full_1_teardown, false }, // IdeStream - { pcie_ide_test_full_keyrefresh_setup, pcie_ide_test_full_keyrefresh_run, pcie_ide_test_full_keyrefresh_teardown, false } // KeyRefresh + { pcie_ide_test_full_keyrefresh_ks0_setup, pcie_ide_test_full_keyrefresh_ks0_run, pcie_ide_test_full_keyrefresh_ks0_teardown, false }, // KeyRefresh + { pcie_ide_test_full_keyrefresh_ks1_setup, pcie_ide_test_full_keyrefresh_ks1_run, pcie_ide_test_full_keyrefresh_ks1_teardown, false } // KeyRefreshKs1 }; TEEIO_TEST_CASES m_pcie_ide_test_case_funcs[IDE_COMMON_TEST_CASE_NUM] = { diff --git a/teeio-validator/library/pcie_ide_test_lib/test_case/test_case_full_keyrefresh.c b/teeio-validator/library/pcie_ide_test_lib/test_case/test_case_full_keyrefresh.c index d942578..9c550ab 100644 --- a/teeio-validator/library/pcie_ide_test_lib/test_case/test_case_full_keyrefresh.c +++ b/teeio-validator/library/pcie_ide_test_lib/test_case/test_case_full_keyrefresh.c @@ -27,7 +27,7 @@ extern int g_test_rounds; static uint8_t mKeySet = 0; -bool pcie_ide_test_full_keyrefresh_setup(void *test_context) +bool pcie_ide_keyrefresh_setup_common(void *test_context) { ide_common_test_case_context_t *case_context = (ide_common_test_case_context_t *)test_context; TEEIO_ASSERT(case_context); @@ -40,8 +40,6 @@ bool pcie_ide_test_full_keyrefresh_setup(void *test_context) ide_common_test_port_context_t* upper_port = &group_context->common.upper_port; ide_common_test_port_context_t* lower_port = &group_context->common.lower_port; - mKeySet = PCI_IDE_KM_KEY_SET_K0; - // An ide_stream is first setup so that key_refresh can be tested in run. return setup_ide_stream(group_context->spdm_doe.doe_context, group_context->spdm_doe.spdm_context, &group_context->spdm_doe.session_id, upper_port->mapped_kcbar_addr, group_context->stream_id, mKeySet, @@ -50,7 +48,7 @@ bool pcie_ide_test_full_keyrefresh_setup(void *test_context) group_context->common.top->type, upper_port, lower_port, false); } -void pcie_ide_test_full_keyrefresh_run(void *test_context) +void pcie_ide_keyrefresh_run_common(void *test_context) { ide_common_test_case_context_t *case_context = (ide_common_test_case_context_t *)test_context; TEEIO_ASSERT(case_context); @@ -143,7 +141,34 @@ void pcie_ide_test_full_keyrefresh_run(void *test_context) res ? "PCIE-IDE KeyRefresh succeeded." : "PCIE-IDE KeyRefresh failed."); } -void pcie_ide_test_full_keyrefresh_teardown(void *test_context) +bool pcie_ide_test_full_keyrefresh_ks0_setup(void *test_context) +{ + mKeySet = PCI_IDE_KM_KEY_SET_K0; + return pcie_ide_keyrefresh_setup_common(test_context); +} + +void pcie_ide_test_full_keyrefresh_ks0_run(void *test_context) +{ + pcie_ide_keyrefresh_run_common(test_context); +} + +void pcie_ide_test_full_keyrefresh_ks0_teardown(void *test_context) +{ + pcie_ide_teardown_common(test_context, mKeySet); +} + +bool pcie_ide_test_full_keyrefresh_ks1_setup(void *test_context) +{ + mKeySet = PCI_IDE_KM_KEY_SET_K1; + return pcie_ide_keyrefresh_setup_common(test_context); +} + +void pcie_ide_test_full_keyrefresh_ks1_run(void *test_context) +{ + pcie_ide_keyrefresh_run_common(test_context); +} + +void pcie_ide_test_full_keyrefresh_ks1_teardown(void *test_context) { pcie_ide_teardown_common(test_context, mKeySet); }