From patchwork Wed Feb 22 19:21:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaldo Carvalho de Melo X-Patchwork-Id: 60660 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp766293wrd; Wed, 22 Feb 2023 11:23:31 -0800 (PST) X-Google-Smtp-Source: AK7set9R6oR47qBMEcvwW5IQCULH3xt/pjVH4GFmmvjCZxQqtUIVuSY+iX3aHJV/8j3gYulbbySM X-Received: by 2002:a17:907:1dcc:b0:879:2a5:dc3c with SMTP id og12-20020a1709071dcc00b0087902a5dc3cmr15626545ejc.40.1677093811831; Wed, 22 Feb 2023 11:23:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677093811; cv=none; d=google.com; s=arc-20160816; b=KEkD/1XOVjmNAArqpqcGZ7Q9OZ8G8EMQz0zJQuTrscZII+IP+HPtJz64VKCnrEB1p9 23tFTKmYvhWb5T8LF0KfNBzl6NSR4pr/2ohu9lBrpP4T/771bReKmZOeyFeVCWN3Jglt w605zRpLfHnr8EiwR9y4Novu1BhBm4/H/Bav5RhhEAKImmQn+tedVP6iawKt2Evw7KwN sZdN/FMR3STTK12Suw8ZW4noYiCUFeOgBvMm/GGzGOq9F+QKrGhyxiONpRXwYLIh+whb 6M6OwxUitLUfAz/7yR9fOo24krq12rOOwnmndl7RSm5xCW5Qja09hs7trrnaSk3jxiuW v+tQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=X0PpHPNObCn9HyDyMrq3jXyPvn3ElmlTPhrUUR/qsAY=; b=I/RxcjgSXSkVtwv+NrDGVbHHP8iRf1e1l3r30GyqLsCon30HJoGWBEUgHgiXAyHBF4 2f9s8V32x/WHjokmCmKHzoJy9ywozt8Dc5p0EZ24y6KLwE45yJuFa0XfVVMdKIGWEMrC t8N4pnIMLQzWKW0YUmlR2LohG3LQJFNb3zo7iPf9h0P+AwYC617Vm7jXTcTSgZEYWOds PZU0S5B0RSwvuul4hB0sqskiVdtAKXI4srgAhv1Wqn4/77G3onxpkXZ1AtdFnM5Flesw YCBwz1qt5jVmJ6A419vEchSbsQFtYMOo7hi7AwL0q5/6MOEJkthCptwei2GY74JSMW6R Zp8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PQneXKkN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ka6-20020a170907920600b008e1475a1053si5831329ejb.61.2023.02.22.11.23.09; Wed, 22 Feb 2023 11:23:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PQneXKkN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232484AbjBVTVl (ORCPT + 99 others); Wed, 22 Feb 2023 14:21:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230402AbjBVTVj (ORCPT ); Wed, 22 Feb 2023 14:21:39 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A86F3C7B7 for ; Wed, 22 Feb 2023 11:21:32 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4C54BB816E1 for ; Wed, 22 Feb 2023 19:21:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BEAE2C433EF; Wed, 22 Feb 2023 19:21:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1677093689; bh=mDjv/o253jvXahGDTgTOJofKGYC8C8hd0t9FxiY82zw=; h=Date:From:To:Cc:Subject:From; b=PQneXKkNmO9grF7vI/9nY0lFMYvLNb9Ed70d31sWfR/hTT2l72nTNDWj707SZb47J 6gg1OTH233XXi31HOB+U4+UBnc04rD5XDBT1Dee/VNz0O3s0j7jgAWC7Nv/YxdoV2W S2lXZ8SZK8RF7W/1JMMcE3r4gdMopkRH+Jdap+7yJ/TU8xOGnefv7wZkWW5DDRudoY 4rBBUtxVfSBBegIcce8ufWhMJkXV3T8VDR1v+7JyNkrZHKY+QBZKF6AqwWCK1JuDri JLCeDVPJx4W211tE8UaLZQBiuZ5tvbCxXG48CBCXd0owWR/QkX5aQJvEBBF20B2+Ht 6jSI8M9T1H3jw== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id A41104049F; Wed, 22 Feb 2023 16:21:26 -0300 (-03) Date: Wed, 22 Feb 2023 16:21:26 -0300 From: Arnaldo Carvalho de Melo To: linux-kernel@vger.kernel.org Cc: Borislav Petkov , Nikunj A Dadhania Subject: [FYI PATCH 1/1] tools arch x86: Sync the msr-index.h copy with the kernel sources Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758560321069581754?= X-GMAIL-MSGID: =?utf-8?q?1758560321069581754?= tldr; Just FYI, I'm carrying this on the perf tools tree. - Arnaldo Full explanation: There used to be no copies, with tools/ code using kernel headers directly. From time to time tools/perf/ broke due to legitimate kernel hacking. At some point Linus complained about such direct usage. Then we adopted the current model. The way these headers are used in perf are not restricted to just including them to compile something. There are sometimes used in scripts that convert defines into string tables, etc, so some change may break one of these scripts, or new MSRs may use some different #define pattern, etc. E.g.: $ ls -1 tools/perf/trace/beauty/*.sh | head -5 tools/perf/trace/beauty/arch_errno_names.sh tools/perf/trace/beauty/drm_ioctl.sh tools/perf/trace/beauty/fadvise.sh tools/perf/trace/beauty/fsconfig.sh tools/perf/trace/beauty/fsmount.sh $ $ tools/perf/trace/beauty/fadvise.sh static const char *fadvise_advices[] = { [0] = "NORMAL", [1] = "RANDOM", [2] = "SEQUENTIAL", [3] = "WILLNEED", [4] = "DONTNEED", [5] = "NOREUSE", }; $ The tools/perf/check-headers.sh script, part of the tools/ build process, points out changes in the original files. So its important not to touch the copies in tools/ when doing changes in the original kernel headers, that will be done later, when check-headers.sh inform about the change to the perf tools hackers. --- To pick up the changes from these csets: 8c29f01654053258 ("x86/sev: Add SEV-SNP guest feature negotiation support") That cause no changes to tooling: $ tools/perf/trace/beauty/tracepoints/x86_msr.sh > before $ cp arch/x86/include/asm/msr-index.h tools/arch/x86/include/asm/msr-index.h $ tools/perf/trace/beauty/tracepoints/x86_msr.sh > after $ diff -u before after $ Just silences this perf build warning: Warning: Kernel ABI header at 'tools/arch/x86/include/asm/msr-index.h' differs from latest version at 'arch/x86/include/asm/msr-index.h' diff -u tools/arch/x86/include/asm/msr-index.h arch/x86/include/asm/msr-index.h Cc: Borislav Petkov (AMD) Cc: Nikunj A Dadhania Link: https://lore.kernel.org/lkml/ Signed-off-by: Arnaldo Carvalho de Melo --- tools/arch/x86/include/asm/msr-index.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tools/arch/x86/include/asm/msr-index.h b/tools/arch/x86/include/asm/msr-index.h index 37ff47552bcb7b57..d3fe82c5d6b660d1 100644 --- a/tools/arch/x86/include/asm/msr-index.h +++ b/tools/arch/x86/include/asm/msr-index.h @@ -566,6 +566,26 @@ #define MSR_AMD64_SEV_ES_ENABLED BIT_ULL(MSR_AMD64_SEV_ES_ENABLED_BIT) #define MSR_AMD64_SEV_SNP_ENABLED BIT_ULL(MSR_AMD64_SEV_SNP_ENABLED_BIT) +/* SNP feature bits enabled by the hypervisor */ +#define MSR_AMD64_SNP_VTOM BIT_ULL(3) +#define MSR_AMD64_SNP_REFLECT_VC BIT_ULL(4) +#define MSR_AMD64_SNP_RESTRICTED_INJ BIT_ULL(5) +#define MSR_AMD64_SNP_ALT_INJ BIT_ULL(6) +#define MSR_AMD64_SNP_DEBUG_SWAP BIT_ULL(7) +#define MSR_AMD64_SNP_PREVENT_HOST_IBS BIT_ULL(8) +#define MSR_AMD64_SNP_BTB_ISOLATION BIT_ULL(9) +#define MSR_AMD64_SNP_VMPL_SSS BIT_ULL(10) +#define MSR_AMD64_SNP_SECURE_TSC BIT_ULL(11) +#define MSR_AMD64_SNP_VMGEXIT_PARAM BIT_ULL(12) +#define MSR_AMD64_SNP_IBS_VIRT BIT_ULL(14) +#define MSR_AMD64_SNP_VMSA_REG_PROTECTION BIT_ULL(16) +#define MSR_AMD64_SNP_SMT_PROTECTION BIT_ULL(17) + +/* SNP feature bits reserved for future use. */ +#define MSR_AMD64_SNP_RESERVED_BIT13 BIT_ULL(13) +#define MSR_AMD64_SNP_RESERVED_BIT15 BIT_ULL(15) +#define MSR_AMD64_SNP_RESERVED_MASK GENMASK_ULL(63, 18) + #define MSR_AMD64_VIRT_SPEC_CTRL 0xc001011f /* AMD Collaborative Processor Performance Control MSRs */