Re: [PATCH v4 5/5] x86/hyperv: VTL support for Hyper-V

From: Saurabh Singh Sengar
Date: Sat Apr 08 2023 - 01:03:47 EST


On Fri, Apr 07, 2023 at 08:56:29PM +0000, Michael Kelley (LINUX) wrote:
> From: Stanislav Kinsburskii <skinsburskii@xxxxxxxxxxxxxxxxxxx> Sent: Thursday, April 6, 2023 7:08 AM
> >
> > On Tue, Apr 04, 2023 at 02:01:04AM -0700, Saurabh Sengar wrote:
>
> [snip]
>
> > > --- /dev/null
> > > +++ b/arch/x86/hyperv/hv_vtl.c
> > > @@ -0,0 +1,227 @@
> > > +// SPDX-License-Identifier: GPL-2.0
> > > +/*
> > > + * Copyright (c) 2023, Microsoft Corporation.
> > > + *
> > > + * Author:
> > > + * Saurabh Sengar <ssengar@xxxxxxxxxxxxx>
> > > + */
> > > +
> > > +#include <asm/apic.h>
> > > +#include <asm/boot.h>
> > > +#include <asm/desc.h>
> > > +#include <asm/i8259.h>
> > > +#include <asm/mshyperv.h>
> > > +#include <asm/realmode.h>
> > > +
> > > +extern struct boot_params boot_params;
> > > +static struct real_mode_header hv_vtl_real_mode_header;
> > > +
> > > +void __init hv_vtl_init_platform(void)
> > > +{
> > > + pr_info("Linux runs in Hyper-V Virtual Trust Level\n");
> > > +
> > > + x86_init.irqs.pre_vector_init = x86_init_noop;
> > > + x86_init.timers.timer_init = x86_init_noop;
> > > +
> > > + x86_platform.get_wallclock = get_rtc_noop;
> > > + x86_platform.set_wallclock = set_rtc_noop;
> >
> > Nit: this code is VTL feature and hypevisor specific.
> > Defining vtl_get_rtc_noop instead of exporting get_rtc_noop would allow to make
> > this series less intrusive to the rest of x86 generic code.
> >
> > Reviewed-by: Stanislav Kinsburskii <stanislav.kinsburskii@xxxxxxxxx>
> >
>
> Saurabh's initial version of the code did define its own version of
> get/set_rtc_noop(). I had suggested that he use the existing functions
> from x86 generic code, and KY had also commented about re-using
> existing code wherever possible. :-) My suggestion was partly because
> the VTL code is already re-using x86_init_noop(), and then just to avoid
> code duplication. Admittedly, there's not much code being duplicated
> in these stub functions. I slightly prefer re-using the existing functions,
> but don't feel strongly about it.

Thank you, Stanislav and Michael, for your comments.
Since the function is not doing anything significant, I think it's best to
minimize its effect on x86 generic code in this series.

I would like to redefine these functions in VTL code. Unless there are
compelling reasons against it, I plan to incorporate this change in the next
version.

- Saurabh

> Michael