linux-hyperv.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tianyu Lan <ltykernel@gmail.com>
To: Borislav Petkov <bp@alien8.de>
Cc: kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org,
	 decui@microsoft.com, tglx@linutronix.de, mingo@redhat.com,
	 dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com,
	arnd@arndb.de,  Neeraj.Upadhyay@amd.com, tiala@microsoft.com,
	kvijayab@amd.com,  romank@linux.microsoft.com,
	linux-arch@vger.kernel.org,  linux-hyperv@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	 Michael Kelley <mhklinux@outlook.com>
Subject: Re: [PATCH 5/5] x86/Hyper-V: Add Hyper-V specific hvcall to set backing page
Date: Fri, 19 Sep 2025 01:11:02 +0800	[thread overview]
Message-ID: <CAMvTesBwkFr7VYoEYq5hc7NJi5xdiz037bmzoaEV2eG__h-kTg@mail.gmail.com> (raw)
In-Reply-To: <20250918150959.GEaMwgx78CGCxjGce8@fat_crate.local>

On Thu, Sep 18, 2025 at 11:10 PM Borislav Petkov <bp@alien8.de> wrote:
>
> On Thu, Sep 18, 2025 at 11:00:23AM -0400, Tianyu Lan wrote:
> > Secure AVIC hardware provides APIC backing page
> > to aid the guest in limiting which interrupt
> > vectors can be injected into the guest. Hyper-V
> > introduces a new register HV_X64_REGISTER_SEV_GPA_PAGE
> > to notify hypervisor with APIC backing page and call
> > it in Secure AVIC driver.
>
> Why does hyperv needs special handling again and cannot simply adhere to the
> secure AVIC spec?
>
> None of that text explains *why* it is absolutely necessary to do something
> hyperv-special...

Hyper-V uses a different hvcall to register an APIC backing page.

>
> > @@ -361,7 +364,11 @@ static void savic_setup(void)
> >        * VMRUN, the hypervisor makes use of this information to make sure
> >        * the APIC backing page is mapped in NPT.
> >        */
> > -     res = savic_register_gpa(gpa);
> > +     if (hv_isolation_type_snp())
> > +             res = hv_set_savic_backing_page(gfn);
> > +     else
> > +             res = savic_register_gpa(gpa);
> > +
>
> This is ugly and doesn't belong here.
>

Could I move the check into savic_register_gpa() or add a stub function
to check guest runs on Hyper-V  or not and then call associated function
to register APIC backing page?

--
Thanks

Tianyu Lan

  reply	other threads:[~2025-09-18 17:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-18 15:00 [PATCH 0/5] x86/Hyper-V: Add AMD Secure AVIC for Hyper-V platform Tianyu Lan
2025-09-18 15:00 ` [PATCH 1/5] x86/hyperv: Don't use hv apic driver when Secure AVIC is available Tianyu Lan
2025-09-18 15:00 ` [PATCH 2/5] drivers: hv: Allow vmbus message synic interrupt injected from Hyper-V Tianyu Lan
2025-09-18 15:00 ` [PATCH 3/5] x86/hyperv: Don't use auto-eoi when Secure AVIC is available Tianyu Lan
2025-09-18 15:00 ` [PATCH 4/5] x86/hyperv: Allow Hyper-V to inject STIMER0 interrupts Tianyu Lan
2025-09-18 15:00 ` [PATCH 5/5] x86/Hyper-V: Add Hyper-V specific hvcall to set backing page Tianyu Lan
2025-09-18 15:09   ` Borislav Petkov
2025-09-18 17:11     ` Tianyu Lan [this message]
2025-09-18 19:59       ` Borislav Petkov
2025-09-30 23:05 ` [PATCH 0/5] x86/Hyper-V: Add AMD Secure AVIC for Hyper-V platform Wei Liu
2025-10-13 17:18   ` Wei Liu

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=CAMvTesBwkFr7VYoEYq5hc7NJi5xdiz037bmzoaEV2eG__h-kTg@mail.gmail.com \
    --to=ltykernel@gmail.com \
    --cc=Neeraj.Upadhyay@amd.com \
    --cc=arnd@arndb.de \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=hpa@zytor.com \
    --cc=kvijayab@amd.com \
    --cc=kys@microsoft.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhklinux@outlook.com \
    --cc=mingo@redhat.com \
    --cc=romank@linux.microsoft.com \
    --cc=tglx@linutronix.de \
    --cc=tiala@microsoft.com \
    --cc=wei.liu@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).