From: Jeremi Piotrowski <jpiotrowski@linux.microsoft.com>
To: linux-kernel@vger.kernel.org
Cc: Jeremi Piotrowski <jpiotrowski@linux.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
Subject: [RFC PATCH v2 5/7] iommu/amd: Don't fail snp_enable when running virtualized
Date: Mon, 13 Feb 2023 10:34:00 +0000 [thread overview]
Message-ID: <20230213103402.1189285-6-jpiotrowski@linux.microsoft.com> (raw)
In-Reply-To: <20230213103402.1189285-1-jpiotrowski@linux.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.
--
2.25.1
next prev parent reply other threads:[~2023-02-13 10:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-13 10:33 [RFC PATCH v2 0/7] Support nested SNP KVM guests on Hyper-V Jeremi Piotrowski
2023-02-13 10:33 ` [RFC PATCH v2 1/7] x86/hyperv: Allocate RMP table during boot Jeremi Piotrowski
2023-02-13 10:33 ` [RFC PATCH v2 2/7] x86/sev: Add support for NestedVirtSnpMsr Jeremi Piotrowski
2023-02-13 10:33 ` [RFC PATCH v2 3/7] x86/sev: Maintain shadow rmptable on Hyper-V Jeremi Piotrowski
2023-02-13 10:33 ` [RFC PATCH v2 4/7] x86/amd: Configure necessary MSRs for SNP during CPU init when running as a guest Jeremi Piotrowski
2023-02-13 10:34 ` Jeremi Piotrowski [this message]
2023-02-13 10:34 ` [RFC PATCH v2 6/7] crypto: ccp - Introduce quirk to always reclaim pages after SEV-legacy commands Jeremi Piotrowski
2023-02-13 10:34 ` [RFC PATCH v2 7/7] x86/fault: Handle RMP faults with 0 address when nested Jeremi Piotrowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230213103402.1189285-6-jpiotrowski@linux.microsoft.com \
--to=jpiotrowski@linux.microsoft.com \
--cc=Tianyu.Lan@microsoft.com \
--cc=ashish.kalra@amd.com \
--cc=brijesh.singh@amd.com \
--cc=decui@microsoft.com \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.roth@amd.com \
--cc=mikelley@microsoft.com \
--cc=suravee.suthikulpanit@amd.com \
--cc=thomas.lendacky@amd.com \
--cc=wei.liu@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.