From: Tom Lendacky <thomas.lendacky@amd.com>
To: Melody Wang <huibo.wang@amd.com>, x86@kernel.org
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/7] x86/sev: Allow the guest to configure interrupt vectors for the hypervisor
Date: Fri, 31 Jul 2026 12:52:39 -0500 [thread overview]
Message-ID: <fbc719cb-54d6-4f81-a00e-1675f0e357b9@amd.com> (raw)
In-Reply-To: <e605b609b56c86e4e307d3edcccb39859048cf4e.1785375271.git.huibo.wang@amd.com>
On 7/29/26 20:48, Melody Wang wrote:
> The SVSM APIC protocol supports 5 API calls. SVSM_APIC_CONFIGURE_VECTOR
> (shortened to SVSM_APIC_CONFIG_VECTOR for brevity), call 4, provides for
> the guest to configure an interrupt vector which the guest allows and
> the hypervisor can use to signal interrupts for it.
>
> Implement this call, and make the default interrupt setting permissive
> when detecting an SVSM.
Maybe expand on this to say that you are allowing all interrupts. And its
not when you detect only an SVSM, it is when you detect that and Alternate
Injection is enabled.
>
> Signed-off-by: Melody Wang <huibo.wang@amd.com>
> ---
> arch/x86/boot/startup/sev-startup.c | 15 +++++++++++++++
> arch/x86/boot/startup/sme.c | 3 +++
> arch/x86/include/asm/sev.h | 9 +++++++++
> 3 files changed, 27 insertions(+)
>
> diff --git a/arch/x86/boot/startup/sev-startup.c b/arch/x86/boot/startup/sev-startup.c
> index 789e99d38d17..8dea0548e004 100644
> --- a/arch/x86/boot/startup/sev-startup.c
> +++ b/arch/x86/boot/startup/sev-startup.c
> @@ -191,6 +191,21 @@ static void __init svsm_setup(struct cc_blob_sev_info *cc_info)
> boot_svsm_caa_pa = pa;
> }
>
> +/* Configure the APIC IRQ vectors with Alternate Injection */
> +void __init svsm_config_vectors(void)
s/svsm_config_vectors/svsm_config_alt_inj_vectors/
> +{
> + struct svsm_call call = {};
> +
> + if (sev_status & MSR_AMD64_SNP_ALTERNATE_INJ) {
Might as well include the check for snp_vmpl here or put this check below
where this function is called so that you don't have two spread out checks.
> + call.caa = rip_rel_ptr(&boot_svsm_ca_page);
> + call.rax = SVSM_APIC_CALL(SVSM_APIC_CONFIG_VECTOR);
> + call.rcx = SVSM_IRQ_ENABLE_ALL << 8;
Why isn't the shift part of the enum so that you don't have to do it here?
> +
> + if (svsm_call_msr_protocol(&call))
> + sev_es_terminate(SEV_TERM_SET_GEN, GHCB_SNP_UNSUPPORTED);
New SEV_TERM_SET_LINUX value?
> + }
> +}
> +
> bool __init snp_init(struct boot_params *bp)
> {
> struct cc_blob_sev_info *cc_info;
> diff --git a/arch/x86/boot/startup/sme.c b/arch/x86/boot/startup/sme.c
> index c07a2c381ed1..664e7a549b34 100644
> --- a/arch/x86/boot/startup/sme.c
> +++ b/arch/x86/boot/startup/sme.c
> @@ -566,6 +566,9 @@ void __init sme_enable(struct boot_params *bp)
> physical_mask &= ~me_mask;
> cc_vendor = CC_VENDOR_AMD;
> cc_set_mask(me_mask);
> +
> + if (snp_vmpl)
> + svsm_config_vectors();
Add a comment before the if as to why this is being done.
Thanks,
Tom
> }
>
> #ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION
> diff --git a/arch/x86/include/asm/sev.h b/arch/x86/include/asm/sev.h
> index f958f78e1db8..f8a5b5cf939a 100644
> --- a/arch/x86/include/asm/sev.h
> +++ b/arch/x86/include/asm/sev.h
> @@ -34,6 +34,13 @@ enum es_result {
> ES_RETRY, /* Retry instruction emulation */
> };
>
> +enum svsm_vec_enable {
> + SVSM_IRQ_DISABLE_SINGLE,
> + SVSM_IRQ_ENABLE_SINGLE,
> + SVSM_IRQ_DISABLE_ALL,
> + SVSM_IRQ_ENABLE_ALL,
> +};
> +
> struct es_fault_info {
> unsigned long vector;
> unsigned long error_code;
> @@ -518,6 +525,7 @@ void snp_set_memory_shared(unsigned long vaddr, unsigned long npages);
> void snp_set_memory_private(unsigned long vaddr, unsigned long npages);
> void snp_set_wakeup_secondary_cpu(void);
> bool snp_init(struct boot_params *bp);
> +void svsm_config_vectors(void);
> void snp_dmi_setup(void);
> int snp_issue_svsm_attest_req(u64 call_id, struct svsm_call *call, struct svsm_attest_call *input);
> void snp_accept_memory(phys_addr_t start, phys_addr_t end);
> @@ -626,6 +634,7 @@ static inline void snp_set_memory_shared(unsigned long vaddr, unsigned long npag
> static inline void snp_set_memory_private(unsigned long vaddr, unsigned long npages) { }
> static inline void snp_set_wakeup_secondary_cpu(void) { }
> static inline bool snp_init(struct boot_params *bp) { return false; }
> +static inline void svsm_config_vectors(void) { }
> static inline void snp_dmi_setup(void) { }
> static inline int snp_issue_svsm_attest_req(u64 call_id, struct svsm_call *call, struct svsm_attest_call *input)
> {
next prev parent reply other threads:[~2026-07-31 17:52 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-30 1:48 [PATCH 0/7] Alternate Injection: Secure Interrupt Delivery for SEV-SNP Guests - Guest Support Melody Wang
2026-07-30 1:48 ` [PATCH 1/7] x86/sev: Add support for Alternate Injection Melody Wang
2026-07-31 15:27 ` Tom Lendacky
2026-07-30 1:48 ` [PATCH 2/7] x86/apic: Add an SVSM APIC driver Melody Wang
2026-07-31 17:39 ` Tom Lendacky
2026-07-30 1:48 ` [PATCH 3/7] x86/sev: Allow the guest to configure interrupt vectors for the hypervisor Melody Wang
2026-07-31 17:52 ` Tom Lendacky [this message]
2026-07-30 1:48 ` [PATCH 4/7] x86/sev: Route unsupported APIC register accesses to the hypervisor APIC emulation Melody Wang
2026-07-31 18:37 ` Tom Lendacky
2026-07-30 1:48 ` [PATCH 5/7] x86/sev: Add a function to contain all SEV-specific setup operations Melody Wang
2026-07-31 19:15 ` Tom Lendacky
2026-07-30 1:48 ` [PATCH 6/7] x86/sev: Register the guest with the SVSM APIC protocol Melody Wang
2026-07-31 19:18 ` Tom Lendacky
2026-07-30 1:48 ` [PATCH 7/7] x86/sev: Indicate that Alternate Injection is supported in the guest Melody Wang
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=fbc719cb-54d6-4f81-a00e-1675f0e357b9@amd.com \
--to=thomas.lendacky@amd.com \
--cc=huibo.wang@amd.com \
--cc=linux-kernel@vger.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 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.