Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp2033283rdf; Mon, 6 Nov 2023 02:46:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IEd/5+qNVSBGhBWt69OJWnu8q73N0vGbav8/E1OZWGRai4rEOnHCnQr1pW9AY5i15IWH0CG X-Received: by 2002:a17:903:786:b0:1cc:3ac9:7189 with SMTP id kn6-20020a170903078600b001cc3ac97189mr16467472plb.7.1699267600518; Mon, 06 Nov 2023 02:46:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1699267600; cv=pass; d=google.com; s=arc-20160816; b=ogHBbwDJhdVGBdUOqd5ZHH7lLkT8hnZjjCJLwiJta5MOFZmgjoKX1N578vrt0fIN3Q Gg6C5504AcBLOuUDYsNNsYaozAzTcVau1a+qqHAQMYZFp5gWus7Aj1C+kH645ahm3yBO m7TjnMzm0ZlaQQZ+qFmiMACjURxJxIARCIS5k8IeH1rUETlzh+OHi84WS07bGfGy7LjN jr8SRuyqPvVUBV2/4HhsFHPFrvvs7LYkFjReVwomWPVVQO/eLJYot/lh4C9naryvvcOP E0GGAkoiKw2lmqwyoIE8pJ1V7+DC4sR4FUAcJ9bX+yvwFwPv8K+XeL3WUqnGU/7KJAgS If7A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:content-language:references:cc:to:subject:reply-to :user-agent:date:message-id:dkim-signature; bh=uULAWIoFdKd4fHFLheJLLul05NZqoVH4DUVdnTsRU5Y=; fh=Gs+F8C4xZMKjTUjtRW1HdBgeQAM66lLf6U9BHyFqyvI=; b=ug5mlxY6qlEHONwHOLWsJAAOw8k7qMI2kycMXClgB8p6GNp8oobciI0z/6ZIWeFY1u oeNM5tqSmfSJUoylkTpfmK5cim4H2tr/ap0IHEe1hJ0zBprzH8M/JJzVA1UWbvE/t5BI VfhPh3TbIfj66zC9SdzovG8XCLgf6OtCxSUpWWAk9LfeYnPESSs2D3+ac18vnosPbt4H KM9nhKppaw9KxcYMzKkOR8o48HW0+ErKNvqmdNyaD6TAzB8UK2oA6zlrrKeaxlZd7+GD pthgJdJkPDPBxXVrPi9CxyBinELWNVkAOwjfKc/Oob5skrFjKzX0RifOzBnFmdiTvhxe mSFg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=v7s14S2h; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id z17-20020a170903019100b001c73f364120si8277728plg.407.2023.11.06.02.46.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 02:46:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=v7s14S2h; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 3E64B807E839; Mon, 6 Nov 2023 02:46:37 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230308AbjKFKqY (ORCPT + 99 others); Mon, 6 Nov 2023 05:46:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229478AbjKFKqW (ORCPT ); Mon, 6 Nov 2023 05:46:22 -0500 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2069.outbound.protection.outlook.com [40.107.237.69]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3CBDBD; Mon, 6 Nov 2023 02:46:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hDHbmricIHQcJUfe8GngZ0yeCY+h3FjmehE8jpKCCAnkE20HYlru0g8EDuYfU2I6qBTcucpDzAKZXtcs0WXlRLckvSYvNg8/c8hMFfRC/AIBNvDSGJNAhp1/NG9MK4kCrFMknNSkqpLZiwC9RIyHg3lZQ0PHsbZK3F6IDf9hh/mCeQKbIJo4tSrWArHXsaMMXpXpaLoqexwyvteh0zQt+vS3f4v1GU6VHNkhc02NoDEH4UIimI2hwqETmwgsG6lhj2FmCTyNGdPXYwx04ks7t1vJwxgzH54iZaaWDf7OlQi9Bz3/q3TljAXKHT2LP8sJ4rM7NIy1jZadco91JK5YHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=uULAWIoFdKd4fHFLheJLLul05NZqoVH4DUVdnTsRU5Y=; b=H3k7sle6w7//DKC+YFHxvkGj6JL1Zyhx4HJYFdEbTZ7+JrZaryFL4Pr6+QJziYOgkqlNwp7Bz9az618voEsdfuKtdlPHSO9i2RRwI2wPnXlKV99vNf/IIwSXGU9cAZXtWLE7vmZMfeHizgN/xjq+26Z+hrTdFrLclVCKYYzqjoK84qPYv+3VlFXuVPe+7kb2+vdZJAP5O4EHNUKiyHAb9N0maR32j0ALQGaROhcivyghMK6od/KCUKK31u4Nv6fVP/vwjAkDZqSlDd+CoLbjO39LQWHc6nRw1KWKzwg/91kOMFGosVWKpTJceFJ1WB2nkpbxJhj4gSr38fBMKqT9zQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uULAWIoFdKd4fHFLheJLLul05NZqoVH4DUVdnTsRU5Y=; b=v7s14S2hmEXCxJlFgpyx+1nobMyIayg/WtGyvF+xZVQ2sAiEBtucArZ8IqA1VA9tzOMs0OYn4C489Ym6CZyHjBNGvxsogf5BJYXxneCnENiptHXpBHNwozOk/9p2WT+8u2m1u/mAzH7VetaULncpsDowjgzKPcbkswsvmO2rgNw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from DS7PR12MB6309.namprd12.prod.outlook.com (2603:10b6:8:96::19) by SJ1PR12MB6292.namprd12.prod.outlook.com (2603:10b6:a03:455::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.28; Mon, 6 Nov 2023 10:46:16 +0000 Received: from DS7PR12MB6309.namprd12.prod.outlook.com ([fe80::93cc:c27:4af6:b78c]) by DS7PR12MB6309.namprd12.prod.outlook.com ([fe80::93cc:c27:4af6:b78c%2]) with mapi id 15.20.6954.028; Mon, 6 Nov 2023 10:46:16 +0000 Message-ID: Date: Mon, 6 Nov 2023 16:15:59 +0530 User-Agent: Mozilla Thunderbird Reply-To: nikunj@amd.com Subject: Re: [PATCH v5 09/14] x86/sev: Add Secure TSC support for SNP guests To: "Kirill A. Shutemov" Cc: Tom Lendacky , linux-kernel@vger.kernel.org, x86@kernel.org, kvm@vger.kernel.org, bp@alien8.de, mingo@redhat.com, tglx@linutronix.de, dave.hansen@linux.intel.com, dionnaglaze@google.com, pgonda@google.com, seanjc@google.com, pbonzini@redhat.com References: <20231030063652.68675-1-nikunj@amd.com> <20231030063652.68675-10-nikunj@amd.com> <55de810b-66f9-49e3-8459-b7cac1532a0c@amd.com> <20231102103649.3lsl25vqdquwequd@box.shutemov.name> Content-Language: en-US From: "Nikunj A. Dadhania" In-Reply-To: <20231102103649.3lsl25vqdquwequd@box.shutemov.name> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: BMXPR01CA0081.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:54::21) To DS7PR12MB6309.namprd12.prod.outlook.com (2603:10b6:8:96::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR12MB6309:EE_|SJ1PR12MB6292:EE_ X-MS-Office365-Filtering-Correlation-Id: 0e0de175-d46e-4c87-e4a1-08dbdeb599db X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kO3sn8+Aixvvk8G2/Bex5uIK77DTlGHqj/sKKj/uvG/0CNAAkRJibA9KSkV8mEhUKo/L+qw7+sRYDp3ZtOv8kzkdqytLaJVcEQTpH2tksNPw0vgqqc7tWL8GJHe9KN1hSCCsS4UR7SO+17EJyAwMhODEO+iIlMBtb5cIRDZQN4X/YW7b5tDD731Q+paY8xVLIzT+FsDzHM+9LlTYeqD1MXuxvx6CTsFPYWtGYniGp+s09wvlKAjLrEj98cJwz7ooyTauLyd28G0qXg7yXflUntrCoJqi6+UodY4ifTZu+BmrERtGvqfO8jh5+riLcl97V/JmpwULf4vKOzNTzVnsA9uoW3rKnFB6bTlH+UkJuNfe9h6rhL9Tbd50Xt4UdtJ9B3NtCyJV+SMo0yIzT6aDefYiuW0mv8EoW8lg6++Jz60Z9vf98vbROTsGsNCJgRDSl/zJsoEDZc9iUWMOxnZvPjE7DQsDJ6qpEWUpHEc/kJDIxurNTbXYo8OUqqIGtpjsmNEz5UyNTue2c7XH2/oJzc/AwsKg72R7GcDqcbKcskS1oIlVTwfeIkSqzPwzyUDYRNSfdTYtq0HPOmWQGGJj7eKIKLMbrk8EQ+hkZUKq2ItWfkAyq+Q38zmhctjEaEeAIMIhvY+GMKHOpuABMRYgjQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR12MB6309.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376002)(346002)(136003)(39860400002)(366004)(396003)(230922051799003)(64100799003)(451199024)(186009)(1800799009)(31686004)(6506007)(478600001)(53546011)(2616005)(6512007)(6486002)(6666004)(36756003)(38100700002)(31696002)(5660300002)(66946007)(66556008)(66476007)(316002)(7416002)(41300700001)(83380400001)(2906002)(3450700001)(26005)(8676002)(4326008)(8936002)(6916009)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?N0EycTVuZlN0RVFKN2pFSUhQS0YxcW9uSW5rMERBT2ZlVm5DRS96ZnZiVTE2?= =?utf-8?B?N01mekdoRWlMLzVrdWRvbmdKSG5DM0IzR3J1MDdCc2I2ZnNTaElLQ1l6MEVG?= =?utf-8?B?T1ozcDFleHEyU3VKWldtU3MrUXZBcEd6SDkvYjRRa0RBUzdralFxVU1ENVd4?= =?utf-8?B?T3hyT29rdFBISkdrM3lXbCt1RmFiVjdXR2tjaVd1ODJJYW1iVFhmTmI0L1Jj?= =?utf-8?B?MzFXOGdyNXQrMTlVYUZEWHEwUjl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Wx2S2lYNWZNSWZBVFJrVVQ2N0NBZEtEUnRkV2oyeU9HL3Yz?= =?utf-8?Q?f3B7WLFMHWYEDJ5Ep3qNPK/iI?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0e0de175-d46e-4c87-e4a1-08dbdeb599db X-MS-Exchange-CrossTenant-AuthSource: DS7PR12MB6309.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Nov 2023 10:46:15.8936 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: aIDCl8JVSeRg1ke9sau94iIF/o0jZmImS0+0KBIZT6eZKzwjvCmj5rjkOwoGjMocEfzG0KIHjV2BzMJWdKfG+A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR12MB6292 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 06 Nov 2023 02:46:37 -0800 (PST) On 11/2/2023 4:06 PM, Kirill A. Shutemov wrote: > On Thu, Nov 02, 2023 at 11:11:52AM +0530, Nikunj A. Dadhania wrote: >> On 10/31/2023 1:56 AM, Tom Lendacky wrote: >>>> diff --git a/include/linux/cc_platform.h b/include/linux/cc_platform.h >>>> index cb0d6cd1c12f..e081ca4d5da2 100644 >>>> --- a/include/linux/cc_platform.h >>>> +++ b/include/linux/cc_platform.h >>>> @@ -90,6 +90,14 @@ enum cc_attr { >>>>        * Examples include TDX Guest. >>>>        */ >>>>       CC_ATTR_HOTPLUG_DISABLED, >>>> + >>>> +    /** >>>> +     * @CC_ATTR_GUEST_SECURE_TSC: Secure TSC is active. >>>> +     * >>>> +     * The platform/OS is running as a guest/virtual machine and actively >>>> +     * using AMD SEV-SNP Secure TSC feature. >>> >>> I think TDX also has a secure TSC like feature, so can this be generic? >> >> Yes, we can do that. In SNP case SecureTSC is an optional feature, not sure if that is the case for TDX as well. >> >> Kirill any inputs ? > > We have several X86_FEATURE_ flags to indicate quality of TSC. Do we > really need a CC_ATTR on top of that? Maybe SEV code could just set > X86_FEATURE_ according to what its TSC can do? For SEV-SNP, SEV_STATUS MSR has the information of various features that have been enabled by the hypervisor. We will need a CC_ATTR for these optional features. Regards Nikunj