linux-coco.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] Fix broken SNP support with KVM module built-in
@ 2025-01-31  1:08 Ashish Kalra
  2025-01-31  1:10 ` [PATCH v2 1/4] crypto: ccp: Add external API interface for PSP module initialization Ashish Kalra
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Ashish Kalra @ 2025-01-31  1:08 UTC (permalink / raw)
  To: seanjc, pbonzini, tglx, mingo, bp, dave.hansen, x86, hpa,
	thomas.lendacky, john.allen, herbert, davem, joro,
	suravee.suthikulpanit, will, robin.murphy
  Cc: michael.roth, dionnaglaze, nikunj, ardb, kevinloughlin,
	Neeraj.Upadhyay, kvm, linux-kernel, linux-crypto, linux-coco,
	iommu

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.

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 (3):
  crypto: ccp: Add external API interface for PSP module initialization
  KVM: SVM: Ensure PSP module is initialized if KVM module is built-in
  iommu/amd: Enable Host SNP support after enabling IOMMU SNP support

 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    | 18 ++++++++++++++----
 include/linux/psp-sev.h     |  9 +++++++++
 6 files changed, 56 insertions(+), 20 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2025-02-05 15:15 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-31  1:08 [PATCH v2 0/4] Fix broken SNP support with KVM module built-in Ashish Kalra
2025-01-31  1:10 ` [PATCH v2 1/4] crypto: ccp: Add external API interface for PSP module initialization Ashish Kalra
2025-01-31  1:11 ` [PATCH v2 2/4] KVM: SVM: Ensure PSP module is initialized if KVM module is built-in Ashish Kalra
2025-01-31  1:11 ` [PATCH v2 3/4] x86/sev: Fix broken SNP support with KVM module built-in Ashish Kalra
2025-01-31  1:41   ` Sean Christopherson
2025-01-31  3:18     ` Kalra, Ashish
2025-01-31 18:34       ` Sean Christopherson
2025-01-31  1:11 ` [PATCH v2 4/4] iommu/amd: Enable Host SNP support after enabling IOMMU SNP support Ashish Kalra
2025-01-31  1:48   ` Sean Christopherson
2025-01-31 22:53     ` Kalra, Ashish
2025-02-05  9:46     ` Vasant Hegde
2025-02-05 15:15       ` Sean Christopherson

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).