mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-11 00:08:50 +00:00
clocksource: hyper-v: Use TSC PFN getter to map vvar page
Instead of converting the virtual address to physical directly. This is a precursor patch for the upcoming support for TSC page mapping into Microsoft Hypervisor root partition, where TSC PFN will be defined by the hypervisor and thus can't be obtained by linear translation of the physical address. Signed-off-by: Stanislav Kinsburskiy <stanislav.kinsburskiy@gmail.com> CC: Andy Lutomirski <luto@kernel.org> CC: Thomas Gleixner <tglx@linutronix.de> CC: Ingo Molnar <mingo@redhat.com> CC: Borislav Petkov <bp@alien8.de> CC: Dave Hansen <dave.hansen@linux.intel.com> CC: x86@kernel.org CC: "H. Peter Anvin" <hpa@zytor.com> CC: "K. Y. Srinivasan" <kys@microsoft.com> CC: Haiyang Zhang <haiyangz@microsoft.com> CC: Wei Liu <wei.liu@kernel.org> CC: Dexuan Cui <decui@microsoft.com> CC: Daniel Lezcano <daniel.lezcano@linaro.org> CC: linux-kernel@vger.kernel.org CC: linux-hyperv@vger.kernel.org Reviewed-by: Michael Kelley <mikelley@microsoft.com> Reviewed-by: Anirudh Rayabharam <anrayabh@linux.microsoft.com> Link: https://lore.kernel.org/r/166749833939.218190.14095015146003109462.stgit@skinsburskii-cloud-desktop.internal.cloudapp.net Signed-off-by: Wei Liu <wei.liu@kernel.org>
This commit is contained in:
parent
e1f5c66db8
commit
364adc45e9
@ -210,11 +210,10 @@ static vm_fault_t vvar_fault(const struct vm_special_mapping *sm,
|
||||
pgprot_decrypted(vma->vm_page_prot));
|
||||
}
|
||||
} else if (sym_offset == image->sym_hvclock_page) {
|
||||
struct ms_hyperv_tsc_page *tsc_pg = hv_get_tsc_page();
|
||||
pfn = hv_get_tsc_pfn();
|
||||
|
||||
if (tsc_pg && vclock_was_used(VDSO_CLOCKMODE_HVCLOCK))
|
||||
return vmf_insert_pfn(vma, vmf->address,
|
||||
virt_to_phys(tsc_pg) >> PAGE_SHIFT);
|
||||
if (pfn && vclock_was_used(VDSO_CLOCKMODE_HVCLOCK))
|
||||
return vmf_insert_pfn(vma, vmf->address, pfn);
|
||||
} else if (sym_offset == image->sym_timens_page) {
|
||||
struct page *timens_page = find_timens_vvar_page(vma);
|
||||
|
||||
|
@ -370,10 +370,11 @@ static union {
|
||||
static struct ms_hyperv_tsc_page *tsc_page = &tsc_pg.page;
|
||||
static unsigned long tsc_pfn;
|
||||
|
||||
static unsigned long hv_get_tsc_pfn(void)
|
||||
unsigned long hv_get_tsc_pfn(void)
|
||||
{
|
||||
return tsc_pfn;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(hv_get_tsc_pfn);
|
||||
|
||||
struct ms_hyperv_tsc_page *hv_get_tsc_page(void)
|
||||
{
|
||||
|
@ -32,6 +32,7 @@ extern void hv_stimer0_isr(void);
|
||||
|
||||
extern void hv_init_clocksource(void);
|
||||
|
||||
extern unsigned long hv_get_tsc_pfn(void);
|
||||
extern struct ms_hyperv_tsc_page *hv_get_tsc_page(void);
|
||||
|
||||
static inline notrace u64
|
||||
@ -90,6 +91,11 @@ hv_read_tsc_page(const struct ms_hyperv_tsc_page *tsc_pg)
|
||||
}
|
||||
|
||||
#else /* CONFIG_HYPERV_TIMER */
|
||||
static inline unsigned long hv_get_tsc_pfn(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline struct ms_hyperv_tsc_page *hv_get_tsc_page(void)
|
||||
{
|
||||
return NULL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user