All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu@kernel.org>
To: "Michael Kelley (LINUX)" <mikelley@microsoft.com>
Cc: Anirudh Rayabharam <anrayabh@linux.microsoft.com>,
	KY Srinivasan <kys@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	Wei Liu <wei.liu@kernel.org>, Dexuan Cui <decui@microsoft.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	"mail@anirudhrb.com" <mail@anirudhrb.com>,
	"kumarpraveen@linux.microsoft.com"
	<kumarpraveen@linux.microsoft.com>,
	"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] clocksource/drivers/hyperv: use Hyper-V's page size to calculate PFN
Date: Thu, 3 Nov 2022 15:48:24 +0000	[thread overview]
Message-ID: <Y2PiyAEJZitd3LS8@liuwe-devbox-debian-v2> (raw)
In-Reply-To: <BYAPR21MB1688743DD4507008D33499B0D7389@BYAPR21MB1688.namprd21.prod.outlook.com>

On Thu, Nov 03, 2022 at 03:34:23PM +0000, Michael Kelley (LINUX) wrote:
> From: Anirudh Rayabharam <anrayabh@linux.microsoft.com> Sent: Thursday, November 3, 2022 8:24 AM
> > 
> > __phys_to_pfn() will return a PFN based on the guest page size, which might
> > be different from Hyper-V's page size that is always 4K. The PFN for the
> > TSC page always needs to be a Hyper-V PFN.
> > 
> > Use HVPFN_DOWN() to calculate the PFN of the TSC page from the physical
> > address.
> > 
> > Reported-by: Michael Kelley (LINUX) <mikelley@microsoft.com>
> > Signed-off-by: Anirudh Rayabharam <anrayabh@linux.microsoft.com>
> > ---
> >  drivers/clocksource/hyperv_timer.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/clocksource/hyperv_timer.c b/drivers/clocksource/hyperv_timer.c
> > index 11332c82d1af..18de1f439ffd 100644
> > --- a/drivers/clocksource/hyperv_timer.c
> > +++ b/drivers/clocksource/hyperv_timer.c
> > @@ -21,6 +21,7 @@
> >  #include <linux/interrupt.h>
> >  #include <linux/irq.h>
> >  #include <linux/acpi.h>
> > +#include <linux/hyperv.h>
> >  #include <clocksource/hyperv_timer.h>
> >  #include <asm/hyperv-tlfs.h>
> >  #include <asm/mshyperv.h>
> > @@ -412,7 +413,7 @@ static void resume_hv_clock_tsc(struct clocksource *arg)
> >  	/* Re-enable the TSC page */
> >  	tsc_msr.as_uint64 = hv_get_register(HV_REGISTER_REFERENCE_TSC);
> >  	tsc_msr.enable = 1;
> > -	tsc_msr.pfn = __phys_to_pfn(phys_addr);
> > +	tsc_msr.pfn = HVPFN_DOWN(phys_addr);
> >  	hv_set_register(HV_REGISTER_REFERENCE_TSC, tsc_msr.as_uint64);
> >  }
> > 
> > @@ -532,7 +533,7 @@ static bool __init hv_init_tsc_clocksource(void)
> >  	 */
> >  	tsc_msr.as_uint64 = hv_get_register(HV_REGISTER_REFERENCE_TSC);
> >  	tsc_msr.enable = 1;
> > -	tsc_msr.pfn = __phys_to_pfn(phys_addr);
> > +	tsc_msr.pfn = HVPFN_DOWN(phys_addr);
> >  	hv_set_register(HV_REGISTER_REFERENCE_TSC, tsc_msr.as_uint64);
> > 
> >  	clocksource_register_hz(&hyperv_cs_tsc, NSEC_PER_SEC/100);
> > --
> > 2.34.1
> 
> Reviewed-by: Michael Kelley <mikelley@microsoft.com>

Thank you both for the quick turnaround. I will just squash this patch
into the previous one.

  reply	other threads:[~2022-11-03 15:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-03 15:23 [PATCH] clocksource/drivers/hyperv: use Hyper-V's page size to calculate PFN Anirudh Rayabharam
2022-11-03 15:34 ` Michael Kelley (LINUX)
2022-11-03 15:48   ` Wei Liu [this message]
2022-12-02 12:33     ` Daniel Lezcano
2022-12-02 18:14       ` Wei Liu
2022-12-02 18:34         ` Daniel Lezcano

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=Y2PiyAEJZitd3LS8@liuwe-devbox-debian-v2 \
    --to=wei.liu@kernel.org \
    --cc=anrayabh@linux.microsoft.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=kumarpraveen@linux.microsoft.com \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mail@anirudhrb.com \
    --cc=mikelley@microsoft.com \
    --cc=tglx@linutronix.de \
    /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.