From patchwork Fri May 31 04:30:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nikunj A. Dadhania" X-Patchwork-Id: 13681129 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2072.outbound.protection.outlook.com [40.107.220.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 697E4187572; Fri, 31 May 2024 04:34:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.72 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717130098; cv=fail; b=J7Y/PwEdgBy/7j07wb4KG4L49oxUXqrwGOon9+RzoeIXSS61tGaNGzEevHQXW0xBLasrd+HY+aSiwy/msbnwPOJLLVUwG/SPY3BZ9aLPrvgIpei9ZBvn7BF4yU/7xcZRzZWU7i8ZYNU1AhmaAojTHplLgeFL1ZFo8c6fldUHJhA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717130098; c=relaxed/simple; bh=wjgsaMYeT1GD78TxdoMUeB43JDwnow8CRuB1a5G31SY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=p3V3bot4ueScWZzSXLg3TzSDjr0fdGUj+FRFcSWy+JKql+nfO0t8pAXuW6J/DNjAgqb4Fu8W9dkqnlm23rjKrtp5UIGyPr+8TSQj8rx+ZFYisSRP98h5M4gRIZelnj0W8et/3RWZgiAKiAcS2davPkuGcmGh/Qv+9KzYtTnOs+w= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=hhJHTjZO; arc=fail smtp.client-ip=40.107.220.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="hhJHTjZO" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AI9XakDAJccOJtmrh6ibu5CuDsCEtx85uAYJJtQlmrHjCHSkZ6/KORSOV9mb1Up1F4iGd7O3Gbhns8XpPtb6tx7OCjBViYRavh0c26gX6ZjYdKLjF599X5wR3AzN4d7vsyJUw+d+MF07Y9IzFht5W+roduSqhfNYop+Sc9P9HIlUQNhFybb9+yyOiiLf2cfVHKP6/Du0tI8K4QgTWTDiN+xZTx9RxvSQkzr5Qh1eGBYx+imsA2H/Aw8Xa/A3kf2ssmML6IHptJBBC85Yy0fxiMYlqxVJGUdaqXbsC0TjfLOG5rdKNoR1J22qGvTWnjE4LEtP6kAAUBZoglhB6aWlNw== 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=UAaAbe3aro4EM2xBQdGp/o69Ah/mnZD76EyvwIMZKr0=; b=lzGnVYNlV3vKtV3sgvcKgcgleSuzke4Ov5G0lN4+3uZyvO7NZhAPSRotPrdHx3ME+4htsfq48sRArLAgkyXMF2gn5oMD62lWdTYhtAssovfVb1fG+s04JTnRgbTx4YIFYpQWz3pDhNwZw/vw2KQ6tV0CFDkn+z2fIV+zkfUYgXCLQABCWrtpmkXt8Qv4qiO/BGf7Mtbtg4wx4tZiZPEC49ieP78oQ9fsm5MESgi88ry2XgoVLOAWej0ZSbSX3CpbA62lLjlMfBrDSc3QzX4DlHFZTE0GOHCiR37/Pjo7jBlHC7wT2ncr56UOQekbCHNb/lyr5YhFqByCnRH0WVEJZA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) 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=UAaAbe3aro4EM2xBQdGp/o69Ah/mnZD76EyvwIMZKr0=; b=hhJHTjZOPJ4M9uFVgC26T9YdfNr+I3hNJ/9qYfaX0G3ZToUtCe5RJ3h/R7uVOlKjjY0Kg8Ab7fnRbfLKBnobh1cq+dRyKy2JvzCFv5ksJ5j7daCwAaKh9gdUspDNEaQ2Y0Mg3BPZ06TMVSj2MBDPaydiqhbb8E4Gn//mozGO8+0= Received: from DM6PR08CA0054.namprd08.prod.outlook.com (2603:10b6:5:1e0::28) by LV2PR12MB5893.namprd12.prod.outlook.com (2603:10b6:408:175::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.21; Fri, 31 May 2024 04:34:50 +0000 Received: from DS3PEPF000099D7.namprd04.prod.outlook.com (2603:10b6:5:1e0:cafe::a6) by DM6PR08CA0054.outlook.office365.com (2603:10b6:5:1e0::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.22 via Frontend Transport; Fri, 31 May 2024 04:34:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS3PEPF000099D7.mail.protection.outlook.com (10.167.17.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7633.15 via Frontend Transport; Fri, 31 May 2024 04:34:50 +0000 Received: from gomati.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 30 May 2024 23:34:46 -0500 From: Nikunj A Dadhania To: , , , , CC: , , , , , , Subject: [PATCH v9 21/24] x86/kvmclock: Skip kvmclock when Secure TSC is available Date: Fri, 31 May 2024 10:00:35 +0530 Message-ID: <20240531043038.3370793-22-nikunj@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240531043038.3370793-1-nikunj@amd.com> References: <20240531043038.3370793-1-nikunj@amd.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099D7:EE_|LV2PR12MB5893:EE_ X-MS-Office365-Filtering-Correlation-Id: 9d9619f1-44d7-43d5-c642-08dc812b02ae X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|82310400017|1800799015|36860700004|7416005|376005; X-Microsoft-Antispam-Message-Info: vMqFn3yiNJCkV1Gr1r+o8GqsAE3DJGcERatRsHP09qqqHfgtrdT5TYAzgkHeuXV9UITW+6rlOEMcwvlovMweQ4vcOw8hjHsrBa/b3OT1IyW2v2W0NMTz24DeEJUTcqZYdGzz/PvGl+TSRHyo0X3oP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+IjvQJ1BjQfxNFIAIetfnE90X/Dnr3YV2HZ32IfrFiyfmzLVOuJrfB8YSx8cJDmh2+L+d8//LBXZo5Pbn2tOeQQJkmSQg/471s4vKh7ExeLEmcrICztpL6wSSyl7hLOkixWoLGGhOkS5W9BBFZC4TIvOxDsuAS2k95SCubO3mr56 X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(82310400017)(1800799015)(36860700004)(7416005)(376005);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 May 2024 04:34:50.7571 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9d9619f1-44d7-43d5-c642-08dc812b02ae X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF000099D7.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR12MB5893 For AMD SNP guests having Secure TSC enabled, skip using the kvmclock. The guest kernel will fallback and use Secure TSC based clocksource. Signed-off-by: Nikunj A Dadhania Tested-by: Peter Gonda --- arch/x86/kernel/kvmclock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c index 5b2c15214a6b..3d03b4c937b9 100644 --- a/arch/x86/kernel/kvmclock.c +++ b/arch/x86/kernel/kvmclock.c @@ -289,7 +289,7 @@ void __init kvmclock_init(void) { u8 flags; - if (!kvm_para_available() || !kvmclock) + if (!kvm_para_available() || !kvmclock || cc_platform_has(CC_ATTR_GUEST_SECURE_TSC)) return; if (kvm_para_has_feature(KVM_FEATURE_CLOCKSOURCE2)) {