mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Melody Wang <huibo.wang@amd.com>
To: Tom Lendacky <thomas.lendacky@amd.com>, x86@kernel.org
Cc: LKML <linux-kernel@vger.kernel.org>, ardb@kernel.org
Subject: Re: [PATCH v6 2/7] x86/apic: Add an SVSM APIC driver
Date: Sat, 5 Dec 2026 18:50:11 -0800	[thread overview]
Message-ID: <c5d8f69e-1d2a-4169-876f-6cd8b8740c29@amd.com> (raw)
In-Reply-To: <65f8c473-8931-4e94-9d03-29175ade5fbd@amd.com>

Hi Tom,

On 11/20/26 12:47 PM, Tom Lendacky wrote:
>> +
>> +static int svsm_apic_probe(void)
>> +{
>> +	if (!cc_platform_has(CC_ATTR_SNP_ALTERNATE_INJECTION)) {
>> +		return 0;
>> +	} else {
> 
> No need for an else here if the "if" above has a return.
> 
>> +		if (!snp_vmpl) {
>> +			pr_err("Alternate Injection in VMPL0 impossible. Terminating.\n");
>> +			goto terminate;
>> +		}
>> +	}
>> +
>> +	if (!x2apic_mode) {
>> +		pr_err("Alternate Injection in non x2APIC mode impossible. Terminating.\n");
>> +		goto terminate;
>> +	}
>> +
>> +	pr_info("Alternate Injection SVSM APIC enabled\n");
>> +
>> +	return 1;
>> +
>> +terminate:
>> +	sev_es_terminate(SEV_TERM_SET_LINUX, GHCB_TERM_ALT_INJ_FAIL);
> 
> Should you come up with individual fail codes for each of the above?
>
It seems too many fail codes for Alternate Injection itself while there 
are only 255 values total.

>> +static u64 __svsm_apic_icr_rw(u32 low, u32 id, bool write)
>> +{
>> +	struct svsm_call call = {};
>> +	const char *call_reg_str;
>> +	unsigned int call_reg;
>> +	u32 reg;
>> +	int ret;
>> +
>> +	reg = APIC_ICR;
>> +
>> +	call_reg = write ? SVSM_APIC_WRITE_REGISTER
>> +			 : SVSM_APIC_READ_REGISTER;
>> +
>> +	call_reg_str = write ? "SVSM_APIC_WRITE_REGISTER"
>> +			     : "SVSM_APIC_READ_REGISTER";
> 
> You only use call_reg and call_reg_str in one place each, no need to
> create variables.

Sure.

>> +	
>> +	.get_apic_id			= svsm_apic_get_apic_id,
> 
> Should this just use x2apic_get_apic_id ?

Sure.

Thanks,
Melody


  reply	other threads:[~2026-12-06  2:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06  1:25 [PATCH v6 0/7] Alternate Injection: Secure Interrupt Delivery for SEV-SNP Guests - Guest Support Melody Wang
2026-11-06  1:25 ` [PATCH v6 1/7] x86/sev: Add support for Alternate Injection Melody Wang
2026-11-08  2:12   ` Borislav Petkov
2026-11-20 17:04   ` Tom Lendacky
2026-11-06  1:25 ` [PATCH v6 2/7] x86/apic: Add an SVSM APIC driver Melody Wang
2026-11-20 20:47   ` Tom Lendacky
2026-12-06  2:50     ` Melody Wang [this message]
2026-11-06  1:25 ` [PATCH v6 3/7] x86/sev: Route unsupported APIC register accesses to the hypervisor APIC emulation Melody Wang
2026-11-19  6:19   ` Borislav Petkov
2026-11-20 20:56   ` Tom Lendacky
2026-11-06  1:25 ` [PATCH v6 4/7] x86/sev: Add a function to contain all SEV-specific setup operations Melody Wang
2026-11-06  1:25 ` [PATCH v6 5/7] x86/sev: Register Alternate Injection protocol during OVMF boot Melody Wang
2026-11-21  3:30   ` Borislav Petkov
2026-11-06  1:25 ` [PATCH v6 6/7] x86/sev: Allow the guest to configure interrupt vectors for the hypervisor Melody Wang
2026-11-21 23:20   ` Borislav Petkov
2026-11-06  1:25 ` [PATCH v6 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=c5d8f69e-1d2a-4169-876f-6cd8b8740c29@amd.com \
    --to=huibo.wang@amd.com \
    --cc=ardb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thomas.lendacky@amd.com \
    --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

all inboxes | Powered by JetHome®