tools/testing/selftests/kvm/s390/cpumodel_subfuncs_test.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/kvm/s390/cpumodel_subfuncs_test.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/kvm/s390/cpumodel_subfuncs_test.c- Extension
.c- Size
- 8554 bytes
- Lines
- 302
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
stdio.hstdlib.hstring.hsys/ioctl.hfacility.hkvm_util.h
Detected Declarations
struct testdeffunction get_cpu_machine_subfuntionsfunction plo_test_bitfunction test_plo_asm_blockfunction test_kmac_asm_blockfunction test_kmc_asm_blockfunction test_km_asm_blockfunction test_kimd_asm_blockfunction test_klmd_asm_blockfunction test_kmctr_asm_blockfunction test_kmf_asm_blockfunction test_kmo_asm_blockfunction test_pcc_asm_blockfunction test_prno_asm_blockfunction test_kma_asm_blockfunction test_kdsa_asm_blockfunction test_sortl_asm_blockfunction test_dfltcc_asm_blockfunction Resultsfunction main
Annotated Snippet
struct testdef {
const char *subfunc_name;
u8 *subfunc_array;
size_t array_size;
testfunc_t test;
int facility_bit;
} testlist[] = {
/*
* PLO was introduced in the very first 64-bit machine generation.
* Hence it is assumed PLO is always installed in Z Arch.
*/
{ "PLO", cpu_subfunc.plo, sizeof(cpu_subfunc.plo), test_plo_asm_block, 1 },
/* MSA - Facility bit 17 */
{ "KMAC", cpu_subfunc.kmac, sizeof(cpu_subfunc.kmac), test_kmac_asm_block, 17 },
{ "KMC", cpu_subfunc.kmc, sizeof(cpu_subfunc.kmc), test_kmc_asm_block, 17 },
{ "KM", cpu_subfunc.km, sizeof(cpu_subfunc.km), test_km_asm_block, 17 },
{ "KIMD", cpu_subfunc.kimd, sizeof(cpu_subfunc.kimd), test_kimd_asm_block, 17 },
{ "KLMD", cpu_subfunc.klmd, sizeof(cpu_subfunc.klmd), test_klmd_asm_block, 17 },
/* MSA - Facility bit 77 */
{ "KMCTR", cpu_subfunc.kmctr, sizeof(cpu_subfunc.kmctr), test_kmctr_asm_block, 77 },
{ "KMF", cpu_subfunc.kmf, sizeof(cpu_subfunc.kmf), test_kmf_asm_block, 77 },
{ "KMO", cpu_subfunc.kmo, sizeof(cpu_subfunc.kmo), test_kmo_asm_block, 77 },
{ "PCC", cpu_subfunc.pcc, sizeof(cpu_subfunc.pcc), test_pcc_asm_block, 77 },
/* MSA5 - Facility bit 57 */
{ "PPNO", cpu_subfunc.ppno, sizeof(cpu_subfunc.ppno), test_prno_asm_block, 57 },
/* MSA8 - Facility bit 146 */
{ "KMA", cpu_subfunc.kma, sizeof(cpu_subfunc.kma), test_kma_asm_block, 146 },
/* MSA9 - Facility bit 155 */
{ "KDSA", cpu_subfunc.kdsa, sizeof(cpu_subfunc.kdsa), test_kdsa_asm_block, 155 },
/* SORTL - Facility bit 150 */
{ "SORTL", cpu_subfunc.sortl, sizeof(cpu_subfunc.sortl), test_sortl_asm_block, 150 },
/* DFLTCC - Facility bit 151 */
{ "DFLTCC", cpu_subfunc.dfltcc, sizeof(cpu_subfunc.dfltcc), test_dfltcc_asm_block, 151 },
/* Concurrent-function facility - Facility bit 201 */
{ "PFCR", cpu_subfunc.pfcr, sizeof(cpu_subfunc.pfcr), test_pfcr_asm_block, 201 },
};
int main(int argc, char *argv[])
{
struct kvm_vm *vm;
int idx;
ksft_print_header();
vm = vm_create(1);
memset(&cpu_subfunc, 0, sizeof(cpu_subfunc));
get_cpu_machine_subfuntions(vm, &cpu_subfunc);
ksft_set_plan(ARRAY_SIZE(testlist));
for (idx = 0; idx < ARRAY_SIZE(testlist); idx++) {
if (test_facility(testlist[idx].facility_bit)) {
u8 *array = malloc(testlist[idx].array_size);
testlist[idx].test((u8 (*)[testlist[idx].array_size])array);
TEST_ASSERT_EQ(memcmp(testlist[idx].subfunc_array,
array, testlist[idx].array_size), 0);
ksft_test_result_pass("%s\n", testlist[idx].subfunc_name);
free(array);
} else {
ksft_test_result_skip("%s feature is not available\n",
testlist[idx].subfunc_name);
}
}
kvm_vm_free(vm);
ksft_finished();
}
Annotation
- Immediate include surface: `stdio.h`, `stdlib.h`, `string.h`, `sys/ioctl.h`, `facility.h`, `kvm_util.h`.
- Detected declarations: `struct testdef`, `function get_cpu_machine_subfuntions`, `function plo_test_bit`, `function test_plo_asm_block`, `function test_kmac_asm_block`, `function test_kmc_asm_block`, `function test_km_asm_block`, `function test_kimd_asm_block`, `function test_klmd_asm_block`, `function test_kmctr_asm_block`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.