lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250820154638.GOaKXt3vTcSd2320tm@fat_crate.local>
Date: Wed, 20 Aug 2025 17:46:38 +0200
From: Borislav Petkov <bp@...en8.de>
To: Neeraj Upadhyay <Neeraj.Upadhyay@....com>
Cc: linux-kernel@...r.kernel.org, tglx@...utronix.de, mingo@...hat.com,
	dave.hansen@...ux.intel.com, Thomas.Lendacky@....com,
	nikunj@....com, Santosh.Shukla@....com, Vasant.Hegde@....com,
	Suravee.Suthikulpanit@....com, David.Kaplan@....com, x86@...nel.org,
	hpa@...or.com, peterz@...radead.org, seanjc@...gle.com,
	pbonzini@...hat.com, kvm@...r.kernel.org,
	kirill.shutemov@...ux.intel.com, huibo.wang@....com,
	naveen.rao@....com, francescolavra.fl@...il.com,
	tiala@...rosoft.com
Subject: Re: [PATCH v9 07/18] x86/apic: Add support to send IPI for Secure
 AVIC

On Mon, Aug 11, 2025 at 03:14:33PM +0530, Neeraj Upadhyay wrote:
> With Secure AVIC only Self-IPI is accelerated. To handle all the
> other IPIs, add new callbacks for sending IPI. These callbacks write
> to the IRR of the target guest vCPU's APIC backing page and issue
> GHCB protocol MSR write event for the hypervisor to notify the
> target vCPU about the new interrupt request.
> 
> For Secure AVIC GHCB APIC MSR writes, reuse GHCB msr handling code in
	     ^^^^^^^^^^^^^^^^^^

say what now?!

> +void savic_ghcb_msr_write(u32 reg, u64 value)

I guess this belongs into x2apic_savic.c.

> +{
> +	u64 msr = APIC_BASE_MSR + (reg >> 4);
> +	struct pt_regs regs = {
> +		.cx = msr,
> +		.ax = lower_32_bits(value),
> +		.dx = upper_32_bits(value)
> +	};
> +	struct es_em_ctxt ctxt = { .regs = &regs };
> +	struct ghcb_state state;
> +	enum es_result res;
> +	struct ghcb *ghcb;
> +
> +	guard(irqsave)();
> +
> +	ghcb = __sev_get_ghcb(&state);
> +	vc_ghcb_invalidate(ghcb);
> +
> +	res = sev_es_ghcb_handle_msr(ghcb, &ctxt, true);
> +	if (res != ES_OK) {
> +		pr_err("Secure AVIC msr (0x%llx) write returned error (%d)\n", msr, res);
> +		/* MSR writes should never fail. Any failure is fatal error for SNP guest */
> +		snp_abort();
> +	}
> +
> +	__sev_put_ghcb(&state);
> +}

...

> +static inline void self_ipi_reg_write(unsigned int vector)
> +{
> +	/*
> +	 * Secure AVIC hardware accelerates guest's MSR write to SELF_IPI
> +	 * register. It updates the IRR in the APIC backing page, evaluates
> +	 * the new IRR for interrupt injection and continues with guest
> +	 * code execution.
> +	 */

Why is that comment here? It is above a WRMSR write. What acceleration is it
talking about?

> +	native_apic_msr_write(APIC_SELF_IPI, vector);
> +}

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ