Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp716048pxu; Fri, 11 Dec 2020 12:29:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJzNp1d+f0/RdfkVsrTipEqXRt9hlqZG74zuJArchVXcUD0dKFjscUmLjYnz5aLqKUB8LAHb X-Received: by 2002:a05:6402:2070:: with SMTP id bd16mr13171288edb.107.1607718587433; Fri, 11 Dec 2020 12:29:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1607718587; cv=pass; d=google.com; s=arc-20160816; b=g5SYGsa/jwPehqp6OcUfqjRZRcaTzuddkbinHacKKKs/7Zb+Lcc4nhR0EK+AzOHUgL Kx1cgZ6+qLKd2Vjk1Seg0+Y5X+xAT/MWJ5d8MUxY5MA7Kiy5tWOZyjD7+WQhLzn7OOda u/8VnD2q5cVEAbThCBfgZ0mEt+yHrA97fyHXuPtMsgwe/V3Y8WKSzUYOc8udpHCIUx4Q gxr9ggt8mbSB63muZAQ0ZxkWaRVVzCFMQx2whcST73PghaX9hARh2JGjzxBGDg+MPyWt iWLbb5fb1TU6PHCAhiiTqrbDNj1prAWcoztiLWiI7Uq8ayuiNAqv2mWd2yNymUQ3w0h2 2sXg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dezrM75SgkRzYWh4Ln72KARkco3Iwy+sJTmsje+sres=; b=Ugdddsi2hQWbkxeyqNmwUSrFdoYndlLML9EwZ3pacYHiGSEoxVEqhKwqPGjoHbDjz4 2Lzta+UoPRUtJj5LUZ3i0hVGtIgrJZDyc98U7oiohV8VK1peB3f9L+xgkskC92IYB5cO THYJCcw3gH7ermAMssfQpqOeh1Aulu9UMBEjJ5CGxYUpLuhl037wbPTPNqTpXLheRh/y VvIeeBlT7UdVKHqocQsytvxl0u/1UJRQIh9m0ogMMZ77KORtmXcrVzSgDrBScT3mK5wa T+UMBSwiYuwzu5nVW0IEZn1djS98Y7026dqLyom6xzQC0UaEt5i27hKzglSAJePfQThc +gvg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=hpGOCcNC; 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 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=amd.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z41si5380147ede.411.2020.12.11.12.29.24; Fri, 11 Dec 2020 12:29:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=hpGOCcNC; 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 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392488AbgLJRJC (ORCPT + 99 others); Thu, 10 Dec 2020 12:09:02 -0500 Received: from mail-bn8nam12on2064.outbound.protection.outlook.com ([40.107.237.64]:38097 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2391374AbgLJRIz (ORCPT ); Thu, 10 Dec 2020 12:08:55 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iodZAQJ6R8BQDFw7uZKbS76J4SzQryu8hM81b6yJP5DShhmDzkqs6HaioYMpPRI9d1EDkb3OYNyNSI8LTv5+DMLAr7mDtuwrUNlLmBaIZ5TlYNDiT+iWHsEa5HMAbXNu3rEl6tNqX2Z1MPh/cqPoMYl9oZpHEHFL5hWpTS0eXiVz+5Ij3+Lr4hXrv9s+tbJEvclO2+hCMBqoZpjjUWCZ4je3Iri90w5xhd6wLDfqfkgsA5iBGtr9ZKA7yDBB8SnLWa3OZrgMDPPtfX7z1QSooqa3JkYbxfcOCZ1rJi+sfkK7kectLgLysw7tfLdxaWj/lMocnIN/pHz/6aZF961Qhw== 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=dezrM75SgkRzYWh4Ln72KARkco3Iwy+sJTmsje+sres=; b=R3H646wn8VRREH9Oeai/rQ/DtuIvjOrLlyr477wNxifYxF5aJ+h24fNbxpFdT64O+biga9iVLPqo93FFQH8gqb8ZhBv9RyJ+7AIl4s/DdnzU8PGqGXDU/rUPJTo5RIY9InKW5CFVKFkJmrbJJ7KLPstrfmVTl4utE3pVA+et0ii5Tx5WOinrrfpwSfJ2rvUiMZiKSCQ+Cg/suc6GGKALpA1ziA0wt7qq1EO8Ns95LkLV8a0FtMb2YvtUDNUQkIXVAuRIEbTgecInvmK9PMfrWeayFwapzPqJ8rjbhvYawOomycZqt12rID6u8ys7+7uWF6Hvp1affJ6akR9/qkivwQ== 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=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dezrM75SgkRzYWh4Ln72KARkco3Iwy+sJTmsje+sres=; b=hpGOCcNCAhEfY97iwwcS0bsSsHWmUptYEZImvZSQ6h6Yx3+tIrqkeUMWQdsTtQWr4O5kud3JH0QN8EeoR4gHa8T5UO84/Tvqid08oyK/XucOa+yOvd7RZabqUTx40GwPsrtS1CrPQexbPL1jrzZtsHLU5fU7bp50ehyO5tAwbBs= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=amd.com; Received: from CY4PR12MB1352.namprd12.prod.outlook.com (2603:10b6:903:3a::13) by CY4PR12MB1493.namprd12.prod.outlook.com (2603:10b6:910:11::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.12; Thu, 10 Dec 2020 17:07:52 +0000 Received: from CY4PR12MB1352.namprd12.prod.outlook.com ([fe80::a10a:295e:908d:550d]) by CY4PR12MB1352.namprd12.prod.outlook.com ([fe80::a10a:295e:908d:550d%8]) with mapi id 15.20.3632.021; Thu, 10 Dec 2020 17:07:52 +0000 From: Tom Lendacky To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org Cc: Paolo Bonzini , Jim Mattson , Joerg Roedel , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Borislav Petkov , Ingo Molnar , Thomas Gleixner , Brijesh Singh Subject: [PATCH v5 02/34] KVM: SVM: Remove the call to sev_platform_status() during setup Date: Thu, 10 Dec 2020 11:06:46 -0600 Message-Id: <618380488358b56af558f2682203786f09a49483.1607620037.git.thomas.lendacky@amd.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: References: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: CH2PR03CA0015.namprd03.prod.outlook.com (2603:10b6:610:59::25) To CY4PR12MB1352.namprd12.prod.outlook.com (2603:10b6:903:3a::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from tlendack-t1.amd.com (165.204.77.1) by CH2PR03CA0015.namprd03.prod.outlook.com (2603:10b6:610:59::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.12 via Frontend Transport; Thu, 10 Dec 2020 17:07:50 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: cd976015-2c88-42c1-098e-08d89d2e20ff X-MS-TrafficTypeDiagnostic: CY4PR12MB1493: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QziQro2RXCI/BanbiGpiyx3rXmHVKz/j3kGPZpSELzku+NnESom2recatIkXHf9WDqpe8glwjmVIQVKIYw0rH8tG5Dx6CbzapReVV4tH4j0UAINhBmpkvdaECQonhP68VmZTdKMjGs+YoQ70n9Bswl7CcI86ieNU5qulVh/ibyQ2rIarY6T/Rchv+8leAFPnQesDCogFGVcfA96l2/OnqHfHIn7yZ+JquNoo93MchQQ/o1uYOp17dfR8N50wiqomr898Dscz4idyKkWgFmyU4CeWjm9nVuQ7yBmqsH/EhPP5JL0uQfCcm+x1Sdb6VXrcVdDd4n8APVqpRtcLmlDrbc+hBAdeswZcdSomSocb1yRFj4NaNn6wimRt12Eb0ybK X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY4PR12MB1352.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(136003)(376002)(346002)(5660300002)(66476007)(186003)(52116002)(8676002)(36756003)(8936002)(4326008)(86362001)(2906002)(66946007)(6666004)(66556008)(26005)(508600001)(34490700003)(7416002)(2616005)(16526019)(54906003)(7696005)(83380400001)(956004)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?xxtxgu+UmhJPsPapv3B6ZFidWs09UIrgXmr5Cnks+syF7vXjfRHEA7zqy/1L?= =?us-ascii?Q?nxbYVE5yJ/UD7jyEORMcaI/jMLLg5y1FCZAgCVKzLIKj9ZF+/ZCRslZ/VFoK?= =?us-ascii?Q?Gt4K6W5Q58yCizzfqzlihwuaI4aN0fT1+jV3d7Q314JTm61XuVwUJW3IFZKF?= =?us-ascii?Q?n6C/4Ggg/xKMxqXfc+PmcbDQmIxELvjYFZPbGi726bQp5pdPsllRn3x2HDMn?= =?us-ascii?Q?od8EwewG2nh6McaNZsE78npOqWaefj3Ep0bO9uSdI5eszPUvKYhAU6HgIT2V?= =?us-ascii?Q?0SGbeqq0AeWytlSVohiXliqro88bvPd66potLvKi4VdYe4uxyrurPTwQXSsd?= =?us-ascii?Q?7/Uq9AOB1cjKSkPOJOwcnracSCyrTV5uXKnvGhoHWUVB8tcVacgwXXXVpRW9?= =?us-ascii?Q?Rt4jQlnqPcOTprtYSlKC8r7A3w0HsDH5JHmWmzYXa3VS2RZsQKqxneuXZhmA?= =?us-ascii?Q?iCTtHNdU77NEcWi0pHLWU+cecktztzT3GPLBl975AA1iJD62QnlcwtvpaDh7?= =?us-ascii?Q?0BGZUrwJR615KIrS1yQsVa9XSNhd+LwyywbGwGeFUreWxx4/DO37rQXnARdl?= =?us-ascii?Q?TIy6OQo/oNg4lzqJ5k4UM+Oyqtt27vj0pPF7LNqkZVEXF6rFTBhk0WWFu9F4?= =?us-ascii?Q?ENVzDan3H5msxmPz/OkiEJ2i5NsRmInON92zVUbzb+2/SesbOlF8CQiC5l2m?= =?us-ascii?Q?ueljTxF+KjBdyYpOAVsacjT+ORAvGSFoBpCVIzf21X5XMkkeY2ZkO9mYNwXD?= =?us-ascii?Q?2l2qXdnmzsQbNm+WN5Sj3xw+8kiMNVf6P5RYfpDncJ2hleOdQduFhwqFdzIX?= =?us-ascii?Q?kXYN5y0+aaLGeAWp7iUoJn7+WtEoKxGHQwZPG2kLJJ5J4sd+xE9DDbmyGdTD?= =?us-ascii?Q?ORYj9OzFUZHwzqJtXTQMQTCIK+va+nb0di9E672pvuaRSFAC2t4/JwQzIjQV?= =?us-ascii?Q?krbidbqGWRVG2e9kiplstczZpBBJKKF9yXjdHNoIROfPGtLS0bDZSnrItirF?= =?us-ascii?Q?SQsQ?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthSource: CY4PR12MB1352.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Dec 2020 17:07:51.9627 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-Network-Message-Id: cd976015-2c88-42c1-098e-08d89d2e20ff X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: G/v7hvbOP/TKMR0b8Gqt2YtiHVHfOpCzURBg1Di7R4t/oHhzFJ+BT5CA4KolKmuxKwBbc6oOJ41bTH+CbhHovA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1493 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tom Lendacky When both KVM support and the CCP driver are built into the kernel instead of as modules, KVM initialization can happen before CCP initialization. As a result, sev_platform_status() will return a failure when it is called from sev_hardware_setup(), when this isn't really an error condition. Since sev_platform_status() doesn't need to be called at this time anyway, remove the invocation from sev_hardware_setup(). Signed-off-by: Tom Lendacky --- arch/x86/kvm/svm/sev.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c index c0b14106258a..a4ba5476bf42 100644 --- a/arch/x86/kvm/svm/sev.c +++ b/arch/x86/kvm/svm/sev.c @@ -1127,9 +1127,6 @@ void sev_vm_destroy(struct kvm *kvm) int __init sev_hardware_setup(void) { - struct sev_user_data_status *status; - int rc; - /* Maximum number of encrypted guests supported simultaneously */ max_sev_asid = cpuid_ecx(0x8000001F); @@ -1148,26 +1145,9 @@ int __init sev_hardware_setup(void) if (!sev_reclaim_asid_bitmap) return 1; - status = kmalloc(sizeof(*status), GFP_KERNEL); - if (!status) - return 1; - - /* - * Check SEV platform status. - * - * PLATFORM_STATUS can be called in any state, if we failed to query - * the PLATFORM status then either PSP firmware does not support SEV - * feature or SEV firmware is dead. - */ - rc = sev_platform_status(status, NULL); - if (rc) - goto err; - pr_info("SEV supported\n"); -err: - kfree(status); - return rc; + return 0; } void sev_hardware_teardown(void) -- 2.28.0