Message ID | 20230123165128.28185-6-jpiotrowski@linux.microsoft.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1718125wrn; Mon, 23 Jan 2023 09:10:22 -0800 (PST) X-Google-Smtp-Source: AMrXdXslCySKP0sTLGfImUWb3jSFg3kzcBhAHTjQn0uYbtxJMpYM36b60qqr2TsU2WTYRWeazT0C X-Received: by 2002:a17:90a:194e:b0:22b:b9ad:9207 with SMTP id 14-20020a17090a194e00b0022bb9ad9207mr11654775pjh.43.1674493821757; Mon, 23 Jan 2023 09:10:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674493821; cv=none; d=google.com; s=arc-20160816; b=gxOT4bUsvXRN5bAOUCp5z8lLkw3NOBGEk+goMlZxfevmuyqyIfIEDMr3PaXBptVJjW j/JXFi09OsmZTff5nBYjPc7DNgH61shj/3geSup1q8InL3ZZb5KGFi0vCbl9u8A2kdk3 RK4Jbz1ttyR/hQtIzt8EzKFvi0FuNjG9JT9sUj+7atGKxv8ahuhzHmSnuL6pJiXW4451 Igpjs7bECOmvfSo8Kt4Fsw5GI2GoULdIfUPhgYkkUJkqdMKPOaZ+f8yo3qWskiBdKoUw CxkQp9wXpEPvTTkVoscaiqA9mECCOZf4sCk5G8co12kAvh4+7wK45ZK2TYg2blOJrOAo xfCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=i0eNBC8geNLV8JqFCv2fcWa+3Po0NQl3CMraZjyG/Mc=; b=RaOAWq9NDUQblGU2HUGH5WzVW8odJtfM5i5tBNsNQC8sNxv/SNiEWjU2pdjf8itM9p igYIO0lZQYntBwlyn7UabvI1AJgn1zUKV9PfwvBLhP87B31gZCtwthiKVnvZWY/tpdzu Hmo1DwEiBgb2/GKyVs6Yh9KdxvB6VQdY2FRxCM1wfWWAjLRXjAXymzdM5HmAg5rw8xQq DlnV5ZiDjKpn9VqjXvDoMQN13iBOT4EfM7BoCI/1n9RzOFs3jmPLJd5nzNdTy8qNAq6X JvOgLXjSA17B69jcrNfmV0OVGwAdo7uFjVuMiSO8O9d4t+IKzprB9O46YBNIkbXoyYgC V5lQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=dO2HSdBd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q24-20020a17090aa01800b00229f44370c4si11530180pjp.189.2023.01.23.09.10.08; Mon, 23 Jan 2023 09:10:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=dO2HSdBd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231468AbjAWQwN (ORCPT <rfc822;rust.linux@gmail.com> + 99 others); Mon, 23 Jan 2023 11:52:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232515AbjAWQwJ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 23 Jan 2023 11:52:09 -0500 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 95B462DE42; Mon, 23 Jan 2023 08:52:02 -0800 (PST) Received: from vm02.corp.microsoft.com (unknown [167.220.196.155]) by linux.microsoft.com (Postfix) with ESMTPSA id B136320E1ABC; Mon, 23 Jan 2023 08:51:59 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com B136320E1ABC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1674492722; bh=i0eNBC8geNLV8JqFCv2fcWa+3Po0NQl3CMraZjyG/Mc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dO2HSdBdZIJS/Y+jT+0mTPO/b066+d6d8bahWzMpmk+tj1pybEaX3acD7STrMRqYs CSrpN0FGXUsyxKKfPJEd4MAPNa/JoTd4A0zxzsaOAHx56uxZkU8QvzKBR3TeA4EsxY +Eo+MAtUvYWGlE274l3mnSlEBX873JB4mL7mfDSA= From: Jeremi Piotrowski <jpiotrowski@linux.microsoft.com> To: linux-kernel@vger.kernel.org Cc: Jeremi Piotrowski <jpiotrowski@microsoft.com>, Wei Liu <wei.liu@kernel.org>, Dexuan Cui <decui@microsoft.com>, Tianyu Lan <Tianyu.Lan@microsoft.com>, Michael Kelley <mikelley@microsoft.com>, linux-hyperv@vger.kernel.org, Brijesh Singh <brijesh.singh@amd.com>, Michael Roth <michael.roth@amd.com>, Ashish Kalra <ashish.kalra@amd.com>, Tom Lendacky <thomas.lendacky@amd.com>, Joerg Roedel <joro@8bytes.org>, Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>, iommu@lists.linux.dev, Jeremi Piotrowski <jpiotrowski@linux.microsoft.com> Subject: [RFC PATCH v1 5/6] iommu/amd: Don't fail snp_enable when running virtualized Date: Mon, 23 Jan 2023 16:51:27 +0000 Message-Id: <20230123165128.28185-6-jpiotrowski@linux.microsoft.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230123165128.28185-1-jpiotrowski@linux.microsoft.com> References: <20230123165128.28185-1-jpiotrowski@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-19.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755834033583887974?= X-GMAIL-MSGID: =?utf-8?q?1755834033583887974?= |
Series |
Support nested SNP KVM guests on Hyper-V
|
|
Commit Message
Jeremi Piotrowski
Jan. 23, 2023, 4:51 p.m. UTC
From: Jeremi Piotrowski <jpiotrowski@microsoft.com> Hyper-V VMs do not have access to an IOMMU but can support hosting SNP VMs. amd_iommu_snp_enable() is on the SNP init path and should not fail in that case. Signed-off-by: Jeremi Piotrowski <jpiotrowski@linux.microsoft.com> --- drivers/iommu/amd/init.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c index d1270e3c5baf..8049dbe78a27 100644 --- a/drivers/iommu/amd/init.c +++ b/drivers/iommu/amd/init.c @@ -3619,6 +3619,12 @@ int amd_iommu_pc_set_reg(struct amd_iommu *iommu, u8 bank, u8 cntr, u8 fxn, u64 #ifdef CONFIG_AMD_MEM_ENCRYPT int amd_iommu_snp_enable(void) { + /* + * If we're running virtualized there doesn't have to be an IOMMU for SNP to work. + */ + if (init_state == IOMMU_NOT_FOUND && boot_cpu_has(X86_FEATURE_HYPERVISOR)) + return 0; + /* * The SNP support requires that IOMMU must be enabled, and is * not configured in the passthrough mode.