From: Ashish Kalra <Ashish.Kalra@amd.com>
To: <seanjc@google.com>, <pbonzini@redhat.com>, <tglx@linutronix.de>,
<mingo@redhat.com>, <bp@alien8.de>, <dave.hansen@linux.intel.com>,
<x86@kernel.org>, <hpa@zytor.com>, <thomas.lendacky@amd.com>,
<john.allen@amd.com>, <herbert@gondor.apana.org.au>,
<davem@davemloft.net>, <joro@8bytes.org>,
<suravee.suthikulpanit@amd.com>, <will@kernel.org>,
<robin.murphy@arm.com>
Cc: <michael.roth@amd.com>, <dionnaglaze@google.com>,
<nikunj@amd.com>, <ardb@kernel.org>, <kevinloughlin@google.com>,
<Neeraj.Upadhyay@amd.com>, <kvm@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <linux-crypto@vger.kernel.org>,
<linux-coco@lists.linux.dev>, <iommu@lists.linux.dev>
Subject: [PATCH v3 0/3] Fix broken SNP support with KVM module built-in
Date: Mon, 3 Feb 2025 21:56:07 +0000 [thread overview]
Message-ID: <cover.1738618801.git.ashish.kalra@amd.com> (raw)
From: Ashish Kalra <ashish.kalra@amd.com>
This patch-set fixes the current SNP host enabling code and effectively SNP
which is broken with respect to the KVM module being built-in.
Essentially SNP host enabling code should be invoked before KVM
initialization, which is currently not the case when KVM is built-in.
SNP host support is currently enabled in snp_rmptable_init() which is
invoked as a device_initcall(). Here device_initcall() is used as
snp_rmptable_init() expects AMD IOMMU SNP support to be enabled prior
to it and the AMD IOMMU driver enables SNP support after PCI bus enumeration.
This patch-set adds support to call snp_rmptable_init() early and
directly from iommu_snp_enable() (after checking and enabling IOMMU
SNP support) which enables SNP host support before KVM initialization
with kvm_amd module built-in.
Additionally the patch-set adds support to initialize PSP SEV driver
during KVM module probe time.
This patch-set has been tested with the following cases/scenarios:
1). kvm_amd module built-in.
2). kvm_amd module built-in with intremap=off kernel command line.
3). kvm_amd module built-in with iommu=off kernel command line.
4). kvm_amd built as a module.
5). kvm_amd built as module with iommu=off kernel command line.
v3:
- Ensure that dropping the device_initcall() happens in the same
patch that wires up the IOMMU code to invoke snp_rmptable_init()
which then makes sure that snp_rmptable_init() is still getting
called and also merge patches 3 & 4.
- Fix commit logs.
v2:
- Drop calling iommu_snp_enable() early before enabling IOMMUs as
IOMMU subsystem gets initialized via subsys_initcall() and hence
snp_rmptable_init() cannot be invoked via subsys_initcall().
- Instead add support to call snp_rmptable_init() early and
directly via iommu_snp_enable().
- Fix commit logs.
Fixes: c3b86e61b756 ("x86/cpufeatures: Enable/unmask SEV-SNP CPU feature")
Ashish Kalra (1):
x86/sev: Fix broken SNP support with KVM module built-in
Sean Christopherson (2):
crypto: ccp: Add external API interface for PSP module initialization
KVM: SVM: Ensure PSP module is initialized if KVM module is built-in
arch/x86/include/asm/sev.h | 2 ++
arch/x86/kvm/svm/sev.c | 10 ++++++++++
arch/x86/virt/svm/sev.c | 23 +++++++----------------
drivers/crypto/ccp/sp-dev.c | 14 ++++++++++++++
drivers/iommu/amd/init.c | 24 ++++++++++++++++++++----
include/linux/psp-sev.h | 9 +++++++++
6 files changed, 62 insertions(+), 20 deletions(-)
--
2.34.1
next reply other threads:[~2025-02-03 21:56 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-03 21:56 Ashish Kalra [this message]
2025-02-03 21:56 ` [PATCH v3 1/3] crypto: ccp: Add external API interface for PSP module initialization Ashish Kalra
2025-02-07 21:45 ` Tom Lendacky
2025-02-08 4:52 ` Kalra, Ashish
2025-02-03 21:56 ` [PATCH v3 2/3] KVM: SVM: Ensure PSP module is initialized if KVM module is built-in Ashish Kalra
2025-02-07 21:46 ` Tom Lendacky
2025-02-03 21:56 ` [PATCH v3 3/3] x86/sev: Fix broken SNP support with KVM module built-in Ashish Kalra
2025-02-05 9:51 ` Vasant Hegde
2025-02-05 15:17 ` Sean Christopherson
2025-02-05 16:55 ` Vasant Hegde
2025-02-05 19:31 ` Sean Christopherson
2025-02-05 22:54 ` Kalra, Ashish
2025-02-07 15:52 ` Sean Christopherson
2025-02-07 21:45 ` Kalra, Ashish
2025-02-06 5:41 ` Vasant Hegde
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=cover.1738618801.git.ashish.kalra@amd.com \
--to=ashish.kalra@amd.com \
--cc=Neeraj.Upadhyay@amd.com \
--cc=ardb@kernel.org \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=davem@davemloft.net \
--cc=dionnaglaze@google.com \
--cc=herbert@gondor.apana.org.au \
--cc=hpa@zytor.com \
--cc=iommu@lists.linux.dev \
--cc=john.allen@amd.com \
--cc=joro@8bytes.org \
--cc=kevinloughlin@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-coco@lists.linux.dev \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.roth@amd.com \
--cc=mingo@redhat.com \
--cc=nikunj@amd.com \
--cc=pbonzini@redhat.com \
--cc=robin.murphy@arm.com \
--cc=seanjc@google.com \
--cc=suravee.suthikulpanit@amd.com \
--cc=tglx@linutronix.de \
--cc=thomas.lendacky@amd.com \
--cc=will@kernel.org \
--cc=x86@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).