Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp2458946imd; Fri, 2 Nov 2018 11:46:00 -0700 (PDT) X-Google-Smtp-Source: AJdET5fOD24WIUzEDp542GLlhkymihRscrXqebYGf3KFGKKEBMizrqoS4SuN9j1EpiDgI9uT5fA4 X-Received: by 2002:a63:1f1c:: with SMTP id f28mr11879397pgf.193.1541184360172; Fri, 02 Nov 2018 11:46:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541184360; cv=none; d=google.com; s=arc-20160816; b=lMB5nxFVW4If6bTeL2NN9Mgz1gLEc9RxjxrvyMjGrcqCT0xStWWuppCjNcpiT6C24o 944fBHeEyvHvp+d2GblXWDvmlsyfPTjWaYxJNxLLQxKKIo/TEHtGDP+Z5xcmrL6x3aVV k1alKXg2VIhyT4Wprl9a1+y9M5GaW5MfryQqjcMUiavzYZObXDBywk8M0/4++PLPAAIA sqrC+wYFE86TaxOC96MmXzLHyNK18u4MqcbKAUyYUWp0quYzpn8RZvjo/hFKGjlyLGiJ xbSdtVEmceVy8dCV1U9FNipwsh4XNoMjyEoaUmojxbBsYI6KRtReVYNwznZLwKfyzf4w fNmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xpJOXvj9wXtObCrCc14MomfaSeRjKRX527OvjnPWtRg=; b=fAlxTvXCNhyb6bs+PsMiaTryPlnnCNcbrDyzRm2US/BQvYtSo7AgO2ICks+IYZG2Gj 9dtK0u4MMwfl08WoNbbtdFapPfPsl2cm5rAYlQgPrv0lUVUs39akWFufC4yZHaE5zcXl dvd7ysWzwZu8HB+GWNqHcSO1fs9Hr+UDAQqlINO+9j8yLEWP1JlcVYiFVuKeqfnAkVXd rbroBLu+lgbqyL9RsQl0UyJnVpGrF0FYazzsOWJNURFL09S82ouGYFzWnOoUOlugdHfv RqsFf2k3Wncnf4En9LSaBQfr4IA0xw80hhVStfaiYyeYQDFi4qSnFoGzcD6Pszp3OpYg p4Uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RfznrV8j; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z5-v6si4242613pln.42.2018.11.02.11.45.45; Fri, 02 Nov 2018 11:46:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RfznrV8j; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729819AbeKCDwu (ORCPT + 99 others); Fri, 2 Nov 2018 23:52:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:48110 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726849AbeKCDwt (ORCPT ); Fri, 2 Nov 2018 23:52:49 -0400 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 11EFD20847; Fri, 2 Nov 2018 18:44:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541184276; bh=AHwcKnbHe3R7oTji2ieRPEmiiK1pBY5RkvwuWFLLlIg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RfznrV8j1w6aIjDJO5x26M/27MqEAjCTeiynDm5vCoQmfjCM2qUjHM+PEUo7R63ut WKdb/L4fsr5MXF/w9O0PgAID/wbHxv7Fw0p7uy3dozxRn2eEKtnTzpyIAf0zZp4GuA hOteZ5gZUk2JpAlwDmXNOI2Io6Z8gQbcBRpe+WX4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guenter Roeck , Paolo Bonzini , Sasha Levin Subject: [PATCH 4.18 087/150] KVM: x86: support CONFIG_KVM_AMD=y with CONFIG_CRYPTO_DEV_CCP_DD=m Date: Fri, 2 Nov 2018 19:34:09 +0100 Message-Id: <20181102182909.567471217@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181102182902.250560510@linuxfoundation.org> References: <20181102182902.250560510@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 853c110982eaff0d99dace3f66f1ba58b5bfd9d5 ] SEV requires access to the AMD cryptographic device APIs, and this does not work when KVM is builtin and the crypto driver is a module. Actually the Kconfig conditions for CONFIG_KVM_AMD_SEV try to disable SEV in that case, but it does not work because the actual crypto calls are not culled, only sev_hardware_setup() is. This patch adds two CONFIG_KVM_AMD_SEV checks that gate all the remaining SEV code; it fixes this particular configuration, and drops 5 KiB of code when CONFIG_KVM_AMD_SEV=n. Reported-by: Guenter Roeck Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin --- arch/x86/kvm/svm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index ef772e5634d4..3e59a187fe30 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -436,14 +436,18 @@ static inline struct kvm_svm *to_kvm_svm(struct kvm *kvm) static inline bool svm_sev_enabled(void) { - return max_sev_asid; + return IS_ENABLED(CONFIG_KVM_AMD_SEV) ? max_sev_asid : 0; } static inline bool sev_guest(struct kvm *kvm) { +#ifdef CONFIG_KVM_AMD_SEV struct kvm_sev_info *sev = &to_kvm_svm(kvm)->sev_info; return sev->active; +#else + return false; +#endif } static inline int sev_get_asid(struct kvm *kvm) -- 2.17.1