From patchwork Tue Jan 26 17:36:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Lendacky X-Patchwork-Id: 12047635 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B64DC433E0 for ; Tue, 26 Jan 2021 17:43:39 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C202722210 for ; Tue, 26 Jan 2021 17:43:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C202722210 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:45890 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l4SNN-0007p0-Lu for qemu-devel@archiver.kernel.org; Tue, 26 Jan 2021 12:43:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40926) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l4SJ4-0003mB-NS for qemu-devel@nongnu.org; Tue, 26 Jan 2021 12:39:11 -0500 Received: from mail-co1nam11on2056.outbound.protection.outlook.com ([40.107.220.56]:47575 helo=NAM11-CO1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l4SJ3-0007TT-52 for qemu-devel@nongnu.org; Tue, 26 Jan 2021 12:39:10 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NyO7g6AuOfzx60F4myI/dNpPsx58eSAoJdUvEUNE06xBKa1tD2MAz6IFxi9JAv7w32aftRkTrItPmjvFzNarKknj/GPV+8WXa7xHb2bdKlbyVUp9/KfaurkTBWDcKn5+ku0gh5Y3+22DyyeX1xLKrnVk3/j7hrd+N0ch6Fr80/AnYw13WIWke6hCS1zp5H5bgoOlzUwlOanOKCpTBNrkPYgRq+Dsp594CQth7UmihJr04uIZ2BcjIEK4NF59gS3ATYTo4D/fudzfDAbN6kV+4RBCfmWdPlMXUg8T8vOEUugdzkSqwsUY/WPgM7q3/bsdAYvhMn9NhaNutFbP2GKhNw== 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-SenderADCheck; bh=uR4/S7ATo2WmVto3ZLWqLM2d/h/9jnloCS7eA9/vH1Q=; b=SnqQ/3+vt27xJWQC+Mvf+WdNlMs1n1ittorc1+cYsd/tXGqCBPTWFN3jNsVY23OqKbeKiU6sdeaBp63uYlILZkQ8zhQsW8RQi3uThgKwY6VFzDQUs07lJOv4sZohR0zG6CqT9CV1m2nE88NSqp4uCWxboVmqpqeG9yhA68pdXjZoM5uyL+yP9YkERkdli96JaPQOOcmeYaDvebl2+/4/F2Rq9HzkrQlgZ5hCGuAU8KBOD5w6AUp+1EDM7YVsv8BB+5xvcSyIeIBsSVPE64pfWWhvgERexIoDenBo5FnlXA2T/y6vAL+J+kqZMdIyOE78yopSd8uQLXgLZuSWlzlHfA== 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=uR4/S7ATo2WmVto3ZLWqLM2d/h/9jnloCS7eA9/vH1Q=; b=VfvVpS9m9K108GYu0E9fEgszASr2gaoGQ7cyzKDiSTz6z/gJ5Lp6m3aIYemuFZQ5ABxZC0qFSwwBpXDUSffjiGAroQcLzMGIiH+1VM9ibchERp1zzLEly9AEBieUET6KrMO0cmzyspRVAmVDAWB4rCDrPnALiFDyOzD82kt6jyc= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=amd.com; Received: from DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) by DM6PR12MB4153.namprd12.prod.outlook.com (2603:10b6:5:212::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.13; Tue, 26 Jan 2021 17:39:06 +0000 Received: from DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::cc15:4b1f:9f84:6914]) by DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::cc15:4b1f:9f84:6914%4]) with mapi id 15.20.3784.019; Tue, 26 Jan 2021 17:39:06 +0000 From: Tom Lendacky To: qemu-devel@nongnu.org, kvm@vger.kernel.org Subject: [PATCH v6 5/6] kvm/i386: Use a per-VM check for SMM capability Date: Tue, 26 Jan 2021 11:36:48 -0600 Message-Id: X-Mailer: git-send-email 2.30.0 In-Reply-To: References: X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: SA9PR13CA0014.namprd13.prod.outlook.com (2603:10b6:806:21::19) To DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from tlendack-t1.amd.com (165.204.77.1) by SA9PR13CA0014.namprd13.prod.outlook.com (2603:10b6:806:21::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3805.5 via Frontend Transport; Tue, 26 Jan 2021 17:39:05 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 825499ae-2a78-47f9-5e60-08d8c2214756 X-MS-TrafficTypeDiagnostic: DM6PR12MB4153: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4502; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iZd3QygK4iXsLpxrUm9u0mOWbk2s38gHNtuSMIEzou/bLnnIri0KNEFm991ZJK0dH9aVmkbvLSZYIWCDU2/vZ6+aG2n0l+97lZdHHovq9JSgibbEqd8QCwZ2PUgq+im5p1UK5M16EYdQuZ4p5pa1l9mFCMJRBrLamAg71e1rHhuE4j9xdz9jEB4ZpXgNg94qkZHomJuMLrhfHUEifvohW2NBG/uldFWxeRLoA7ZyJ/8F/+9MLPf92LohV1Y7t7FFFCnFZ6kJlDBU0oCvH6XW8wAsjWNgld4ur/1mqZyG8CTedIwzhi/XmDQcvt41TF21dI1vZ5cSyBV4ClGIlq9jzwYTSFtsdZqsOitWDZm2N81p0pxKwP0NyCE6yjznZ2Jn X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR12MB1355.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(39860400002)(376002)(396003)(346002)(136003)(8676002)(7696005)(52116002)(478600001)(6666004)(7416002)(4326008)(2906002)(4744005)(66476007)(316002)(54906003)(5660300002)(26005)(2616005)(956004)(86362001)(83380400001)(36756003)(186003)(16526019)(6486002)(66946007)(8936002)(66556008); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: wZk2ilCrcRTKsOA4/XjJvTLN51eDfeS7XDIa+lsWC7Xszq3sei+Y+UthpOk+jicOStTpF3BNwWUxlfWVY50SHzYNusaPAqaRLmgro4BkB4/tj8bW5T+DZBRSDdojrnIHs5NC3b3h57zZ7om3vcTqzX20V2WeEr/TuKaGTCBJ4D/G/20+/e8M/s64IsQupBUukye4GxLxpTS27qjwebtIb2xWb0KAxuwS9WtvNCTuBjKxsVQxSO0XaAEfWxJBNEeYSYNsNqWFlRPjDn1ypHof5ANknn4eiFbBG6RUOpIR1eYAYibYhf3NS7od9NyIHgUohOS1DpEmFg+bDxFPey5als72bOOdIQJRMCn2VmX3Y7DiMCg7xVZUT+jzBGYf3QV4lTTlpH3xwXvaKwThpfO0RdqmZDLTw1LmbY5/EAKpfikWisFcdmIxda/hu/o62aa/JCK4KXba3RlcdMdz7JpZFuF/yoDC0s8tCVDKZ3YthfowUjrRBP6nCPqUKMzQ4aDixc0rxtae8Rym4jpOF6ri4Q1e/BGUVv0hra8/D12xDfR6RMnF3aMohFVp1J86ZWGjo+WE0+GKvoPDrXJef9jC5iVHiCMpTWrIWw9vjzmYO/FQFGru370b8BaxO9LXDgFY76kQlw+ryEMPFK1sSw86X3Ljzsf63NhIZWxMnsvAnYTesOEUpPckkOroc9Ke/aP6b0OTxw8rL3D4pZBrJBfFciMtDeLaG6gO7jtrq7jedjEEfyQdCF/yIAVe1aDF5KlAcaAhTkef7GB6y4+qb/SYbkFQFhr5T6nr/nIuZtww8FaVdaZcD9avaskq5wf/lBLi86PUD9xnqkSmeCagvtPlOzm0NZCDF7Xv7gFAJu5q7SF4WrcOMPd+fF8qxvrquHGG/H9G1sWBXSDVGGml1da0c2yBq5AxyJNl25/u1PEai9oEY1NLmkUVNx8emZRgPl9GK3wQ2t+P7sm0oh29GmF9ZSwoIRG4dcaYec6MEiS4xY4jf1wRZA7q+5CFYjmq08qn0TnwsYzAfS3+Xq6YnuU546OhbJd3+IodDYs5v2tNvVJ+e10xvscj9mEDB0wTecqf X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 825499ae-2a78-47f9-5e60-08d8c2214756 X-MS-Exchange-CrossTenant-AuthSource: DM5PR12MB1355.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2021 17:39:06.1356 (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: 2iMu9RsTyVbaZRAgCitJ5kHELpxkfXO/xGdwuZPVqLm+mEBq4b0ahkVeUeRzT8fQ6v+XlI8VLoSD0z2aj6CpaA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4153 Received-SPF: softfail client-ip=40.107.220.56; envelope-from=Thomas.Lendacky@amd.com; helo=NAM11-CO1-obe.outbound.protection.outlook.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , Eduardo Habkost , "Michael S. Tsirkin" , Connor Kuehl , Sean Christopherson , Marcelo Tosatti , Richard Henderson , "Dr. David Alan Gilbert" , Paolo Bonzini , Jiri Slaby , Richard Henderson Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Tom Lendacky SMM is not currently supported for an SEV-ES guest by KVM. Change the SMM capability check from a KVM-wide check to a per-VM check in order to have a finer-grained SMM capability check. Cc: Paolo Bonzini Cc: Richard Henderson Cc: Eduardo Habkost Suggested-by: Sean Christopherson Signed-off-by: Tom Lendacky Reviewed-by: Venu Busireddy --- target/i386/kvm/kvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index bb6bfc19de..37fca43cd9 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -135,7 +135,7 @@ int kvm_has_pit_state2(void) bool kvm_has_smm(void) { - return kvm_check_extension(kvm_state, KVM_CAP_X86_SMM); + return kvm_vm_check_extension(kvm_state, KVM_CAP_X86_SMM); } bool kvm_has_adjust_clock_stable(void)