Hi Ahmed, kernel test robot noticed the following build errors: [auto build test ERROR on 89be9a83ccf1f88522317ce02f854f30d6115c41] url: https://github.com/intel-lab-lkp/linux/commits/Ahmed-S-Darwish/x86-cpuid-Remove-transitional-asm-cpuid-h-header/20250724-014828 base: 89be9a83ccf1f88522317ce02f854f30d6115c41 patch link: https://lore.kernel.org/r/20250723173644.33568-5-darwi%40linutronix.de patch subject: [PATCH v4 4/4] x86/cpu: <asm/processor.h>: Do not include the CPUID API header config: x86_64-rhel-9.4-rust (https://download.01.org/0day-ci/archive/20250724/202507241752.gju4meHj-lkp@xxxxxxxxx/config) compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261) rustc: rustc 1.88.0 (6b00bc388 2025-06-23) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250724/202507241752.gju4meHj-lkp@xxxxxxxxx/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@xxxxxxxxx> | Closes: https://lore.kernel.org/oe-kbuild-all/202507241752.gju4meHj-lkp@xxxxxxxxx/ All errors (new ones prefixed by >>): >> arch/x86/kvm/svm/sev.c:2939:2: error: call to undeclared function 'cpuid'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 2939 | cpuid(0x8000001f, &eax, &ebx, &ecx, &edx); | ^ 1 error generated. vim +/cpuid +2939 arch/x86/kvm/svm/sev.c 179a8427fcbffe Ashish Kalra 2025-05-12 2904 916391a2d1dc22 Tom Lendacky 2020-12-10 2905 void __init sev_hardware_setup(void) eaf78265a4ab33 Joerg Roedel 2020-03-24 2906 { 7aef27f0b2a8a5 Vipin Sharma 2021-03-29 2907 unsigned int eax, ebx, ecx, edx, sev_asid_count, sev_es_asid_count; 6f1d5a3513c237 Ashish Kalra 2025-03-24 2908 struct sev_platform_init_args init_args = {0}; 1dfe571c12cf99 Brijesh Singh 2024-05-01 2909 bool sev_snp_supported = false; 916391a2d1dc22 Tom Lendacky 2020-12-10 2910 bool sev_es_supported = false; 916391a2d1dc22 Tom Lendacky 2020-12-10 2911 bool sev_supported = false; 916391a2d1dc22 Tom Lendacky 2020-12-10 2912 80d0f521d59e08 Sean Christopherson 2023-08-24 2913 if (!sev_enabled || !npt_enabled || !nrips) e8126bdaf19400 Sean Christopherson 2021-04-21 2914 goto out; e8126bdaf19400 Sean Christopherson 2021-04-21 2915 c532f2903b69b7 Sean Christopherson 2022-01-20 2916 /* c532f2903b69b7 Sean Christopherson 2022-01-20 2917 * SEV must obviously be supported in hardware. Sanity check that the c532f2903b69b7 Sean Christopherson 2022-01-20 2918 * CPU supports decode assists, which is mandatory for SEV guests to 770d6aa2e416fd Sean Christopherson 2023-10-18 2919 * support instruction emulation. Ditto for flushing by ASID, as SEV 770d6aa2e416fd Sean Christopherson 2023-10-18 2920 * guests are bound to a single ASID, i.e. KVM can't rotate to a new 770d6aa2e416fd Sean Christopherson 2023-10-18 2921 * ASID to effect a TLB flush. c532f2903b69b7 Sean Christopherson 2022-01-20 2922 */ c532f2903b69b7 Sean Christopherson 2022-01-20 2923 if (!boot_cpu_has(X86_FEATURE_SEV) || 770d6aa2e416fd Sean Christopherson 2023-10-18 2924 WARN_ON_ONCE(!boot_cpu_has(X86_FEATURE_DECODEASSISTS)) || 770d6aa2e416fd Sean Christopherson 2023-10-18 2925 WARN_ON_ONCE(!boot_cpu_has(X86_FEATURE_FLUSHBYASID))) 916391a2d1dc22 Tom Lendacky 2020-12-10 2926 goto out; 916391a2d1dc22 Tom Lendacky 2020-12-10 2927 44e70718df4fc2 Sean Christopherson 2025-02-10 2928 /* 44e70718df4fc2 Sean Christopherson 2025-02-10 2929 * The kernel's initcall infrastructure lacks the ability to express 44e70718df4fc2 Sean Christopherson 2025-02-10 2930 * dependencies between initcalls, whereas the modules infrastructure 44e70718df4fc2 Sean Christopherson 2025-02-10 2931 * automatically handles dependencies via symbol loading. Ensure the 44e70718df4fc2 Sean Christopherson 2025-02-10 2932 * PSP SEV driver is initialized before proceeding if KVM is built-in, 44e70718df4fc2 Sean Christopherson 2025-02-10 2933 * as the dependency isn't handled by the initcall infrastructure. 44e70718df4fc2 Sean Christopherson 2025-02-10 2934 */ 44e70718df4fc2 Sean Christopherson 2025-02-10 2935 if (IS_BUILTIN(CONFIG_KVM_AMD) && sev_module_init()) 44e70718df4fc2 Sean Christopherson 2025-02-10 2936 goto out; 44e70718df4fc2 Sean Christopherson 2025-02-10 2937 916391a2d1dc22 Tom Lendacky 2020-12-10 2938 /* Retrieve SEV CPUID information */ 916391a2d1dc22 Tom Lendacky 2020-12-10 @2939 cpuid(0x8000001f, &eax, &ebx, &ecx, &edx); 916391a2d1dc22 Tom Lendacky 2020-12-10 2940 1edc14599e06fd Tom Lendacky 2020-12-10 2941 /* Set encryption bit location for SEV-ES guests */ 1edc14599e06fd Tom Lendacky 2020-12-10 2942 sev_enc_bit = ebx & 0x3f; 1edc14599e06fd Tom Lendacky 2020-12-10 2943 eaf78265a4ab33 Joerg Roedel 2020-03-24 2944 /* Maximum number of encrypted guests supported simultaneously */ 916391a2d1dc22 Tom Lendacky 2020-12-10 2945 max_sev_asid = ecx; 8cb756b7bdcc6e Sean Christopherson 2021-04-21 2946 if (!max_sev_asid) 916391a2d1dc22 Tom Lendacky 2020-12-10 2947 goto out; eaf78265a4ab33 Joerg Roedel 2020-03-24 2948 eaf78265a4ab33 Joerg Roedel 2020-03-24 2949 /* Minimum ASID value that should be used for SEV guest */ 916391a2d1dc22 Tom Lendacky 2020-12-10 2950 min_sev_asid = edx; d3d1af85e2c75b Brijesh Singh 2021-04-15 2951 sev_me_mask = 1UL << (ebx & 0x3f); eaf78265a4ab33 Joerg Roedel 2020-03-24 2952 bb2baeb214a71c Mingwei Zhang 2021-08-02 2953 /* bb2baeb214a71c Mingwei Zhang 2021-08-02 2954 * Initialize SEV ASID bitmaps. Allocate space for ASID 0 in the bitmap, bb2baeb214a71c Mingwei Zhang 2021-08-02 2955 * even though it's never used, so that the bitmap is indexed by the bb2baeb214a71c Mingwei Zhang 2021-08-02 2956 * actual ASID. bb2baeb214a71c Mingwei Zhang 2021-08-02 2957 */ bb2baeb214a71c Mingwei Zhang 2021-08-02 2958 nr_asids = max_sev_asid + 1; bb2baeb214a71c Mingwei Zhang 2021-08-02 2959 sev_asid_bitmap = bitmap_zalloc(nr_asids, GFP_KERNEL); eaf78265a4ab33 Joerg Roedel 2020-03-24 2960 if (!sev_asid_bitmap) 916391a2d1dc22 Tom Lendacky 2020-12-10 2961 goto out; eaf78265a4ab33 Joerg Roedel 2020-03-24 2962 bb2baeb214a71c Mingwei Zhang 2021-08-02 2963 sev_reclaim_asid_bitmap = bitmap_zalloc(nr_asids, GFP_KERNEL); f31b88b35f90f6 Sean Christopherson 2021-04-21 2964 if (!sev_reclaim_asid_bitmap) { f31b88b35f90f6 Sean Christopherson 2021-04-21 2965 bitmap_free(sev_asid_bitmap); f31b88b35f90f6 Sean Christopherson 2021-04-21 2966 sev_asid_bitmap = NULL; 916391a2d1dc22 Tom Lendacky 2020-12-10 2967 goto out; f31b88b35f90f6 Sean Christopherson 2021-04-21 2968 } eaf78265a4ab33 Joerg Roedel 2020-03-24 2969 0aa6b90ef9d75b Ashish Kalra 2024-01-31 2970 if (min_sev_asid <= max_sev_asid) { 7aef27f0b2a8a5 Vipin Sharma 2021-03-29 2971 sev_asid_count = max_sev_asid - min_sev_asid + 1; 106ed2cad9f7bd Sean Christopherson 2023-06-06 2972 WARN_ON_ONCE(misc_cg_set_capacity(MISC_CG_RES_SEV, sev_asid_count)); 0aa6b90ef9d75b Ashish Kalra 2024-01-31 2973 } 916391a2d1dc22 Tom Lendacky 2020-12-10 2974 sev_supported = true; eaf78265a4ab33 Joerg Roedel 2020-03-24 2975 916391a2d1dc22 Tom Lendacky 2020-12-10 2976 /* SEV-ES support requested? */ 8d364a0792dd95 Sean Christopherson 2021-04-21 2977 if (!sev_es_enabled) 916391a2d1dc22 Tom Lendacky 2020-12-10 2978 goto out; 916391a2d1dc22 Tom Lendacky 2020-12-10 2979 0c29397ac1fdd6 Sean Christopherson 2022-08-03 2980 /* 0c29397ac1fdd6 Sean Christopherson 2022-08-03 2981 * SEV-ES requires MMIO caching as KVM doesn't have access to the guest 0c29397ac1fdd6 Sean Christopherson 2022-08-03 2982 * instruction stream, i.e. can't emulate in response to a #NPF and 0c29397ac1fdd6 Sean Christopherson 2022-08-03 2983 * instead relies on #NPF(RSVD) being reflected into the guest as #VC 0c29397ac1fdd6 Sean Christopherson 2022-08-03 2984 * (the guest can then do a #VMGEXIT to request MMIO emulation). 0c29397ac1fdd6 Sean Christopherson 2022-08-03 2985 */ 0c29397ac1fdd6 Sean Christopherson 2022-08-03 2986 if (!enable_mmio_caching) 0c29397ac1fdd6 Sean Christopherson 2022-08-03 2987 goto out; 0c29397ac1fdd6 Sean Christopherson 2022-08-03 2988 916391a2d1dc22 Tom Lendacky 2020-12-10 2989 /* Does the CPU support SEV-ES? */ 916391a2d1dc22 Tom Lendacky 2020-12-10 2990 if (!boot_cpu_has(X86_FEATURE_SEV_ES)) 916391a2d1dc22 Tom Lendacky 2020-12-10 2991 goto out; 916391a2d1dc22 Tom Lendacky 2020-12-10 2992 d922056215617e Ravi Bangoria 2024-05-31 2993 if (!lbrv) { d922056215617e Ravi Bangoria 2024-05-31 2994 WARN_ONCE(!boot_cpu_has(X86_FEATURE_LBRV), d922056215617e Ravi Bangoria 2024-05-31 2995 "LBRV must be present for SEV-ES support"); d922056215617e Ravi Bangoria 2024-05-31 2996 goto out; d922056215617e Ravi Bangoria 2024-05-31 2997 } d922056215617e Ravi Bangoria 2024-05-31 2998 916391a2d1dc22 Tom Lendacky 2020-12-10 2999 /* Has the system been allocated ASIDs for SEV-ES? */ 916391a2d1dc22 Tom Lendacky 2020-12-10 3000 if (min_sev_asid == 1) 916391a2d1dc22 Tom Lendacky 2020-12-10 3001 goto out; 916391a2d1dc22 Tom Lendacky 2020-12-10 3002 7aef27f0b2a8a5 Vipin Sharma 2021-03-29 3003 sev_es_asid_count = min_sev_asid - 1; 106ed2cad9f7bd Sean Christopherson 2023-06-06 3004 WARN_ON_ONCE(misc_cg_set_capacity(MISC_CG_RES_SEV_ES, sev_es_asid_count)); 916391a2d1dc22 Tom Lendacky 2020-12-10 3005 sev_es_supported = true; 1dfe571c12cf99 Brijesh Singh 2024-05-01 3006 sev_snp_supported = sev_snp_enabled && cc_platform_has(CC_ATTR_HOST_SEV_SNP); 916391a2d1dc22 Tom Lendacky 2020-12-10 3007 916391a2d1dc22 Tom Lendacky 2020-12-10 3008 out: 179a8427fcbffe Ashish Kalra 2025-05-12 3009 if (sev_enabled) { 179a8427fcbffe Ashish Kalra 2025-05-12 3010 init_args.probe = true; 179a8427fcbffe Ashish Kalra 2025-05-12 3011 if (sev_platform_init(&init_args)) 179a8427fcbffe Ashish Kalra 2025-05-12 3012 sev_supported = sev_es_supported = sev_snp_supported = false; 179a8427fcbffe Ashish Kalra 2025-05-12 3013 else if (sev_snp_supported) 179a8427fcbffe Ashish Kalra 2025-05-12 3014 sev_snp_supported = is_sev_snp_initialized(); 179a8427fcbffe Ashish Kalra 2025-05-12 3015 } 179a8427fcbffe Ashish Kalra 2025-05-12 3016 6d1bc9754b0407 Alexander Mikhalitsyn 2023-05-22 3017 if (boot_cpu_has(X86_FEATURE_SEV)) 6d1bc9754b0407 Alexander Mikhalitsyn 2023-05-22 3018 pr_info("SEV %s (ASIDs %u - %u)\n", 0aa6b90ef9d75b Ashish Kalra 2024-01-31 3019 sev_supported ? min_sev_asid <= max_sev_asid ? "enabled" : 0aa6b90ef9d75b Ashish Kalra 2024-01-31 3020 "unusable" : 0aa6b90ef9d75b Ashish Kalra 2024-01-31 3021 "disabled", 6d1bc9754b0407 Alexander Mikhalitsyn 2023-05-22 3022 min_sev_asid, max_sev_asid); 6d1bc9754b0407 Alexander Mikhalitsyn 2023-05-22 3023 if (boot_cpu_has(X86_FEATURE_SEV_ES)) 6d1bc9754b0407 Alexander Mikhalitsyn 2023-05-22 3024 pr_info("SEV-ES %s (ASIDs %u - %u)\n", 800173cf7560e0 Thorsten Blum 2024-12-27 3025 str_enabled_disabled(sev_es_supported), 6d1bc9754b0407 Alexander Mikhalitsyn 2023-05-22 3026 min_sev_asid > 1 ? 1 : 0, min_sev_asid - 1); 1dfe571c12cf99 Brijesh Singh 2024-05-01 3027 if (boot_cpu_has(X86_FEATURE_SEV_SNP)) 1dfe571c12cf99 Brijesh Singh 2024-05-01 3028 pr_info("SEV-SNP %s (ASIDs %u - %u)\n", 800173cf7560e0 Thorsten Blum 2024-12-27 3029 str_enabled_disabled(sev_snp_supported), 1dfe571c12cf99 Brijesh Singh 2024-05-01 3030 min_sev_asid > 1 ? 1 : 0, min_sev_asid - 1); 6d1bc9754b0407 Alexander Mikhalitsyn 2023-05-22 3031 8d364a0792dd95 Sean Christopherson 2021-04-21 3032 sev_enabled = sev_supported; 8d364a0792dd95 Sean Christopherson 2021-04-21 3033 sev_es_enabled = sev_es_supported; 1dfe571c12cf99 Brijesh Singh 2024-05-01 3034 sev_snp_enabled = sev_snp_supported; 1dfe571c12cf99 Brijesh Singh 2024-05-01 3035 d1f85fbe836e61 Alexey Kardashevskiy 2023-06-15 3036 if (!sev_es_enabled || !cpu_feature_enabled(X86_FEATURE_DEBUG_SWAP) || d1f85fbe836e61 Alexey Kardashevskiy 2023-06-15 3037 !cpu_feature_enabled(X86_FEATURE_NO_NESTED_DATA_BP)) d1f85fbe836e61 Alexey Kardashevskiy 2023-06-15 3038 sev_es_debug_swap_enabled = false; ac5c48027bacb1 Paolo Bonzini 2024-04-04 3039 ac5c48027bacb1 Paolo Bonzini 2024-04-04 3040 sev_supported_vmsa_features = 0; ac5c48027bacb1 Paolo Bonzini 2024-04-04 3041 if (sev_es_debug_swap_enabled) ac5c48027bacb1 Paolo Bonzini 2024-04-04 3042 sev_supported_vmsa_features |= SVM_SEV_FEAT_DEBUG_SWAP; eaf78265a4ab33 Joerg Roedel 2020-03-24 3043 } eaf78265a4ab33 Joerg Roedel 2020-03-24 3044 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki