Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Jun 2018 14:39:28 +0000 (UTC)
From:      =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= <royger@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r335666 - head/sys/x86/xen
Message-ID:  <201806261439.w5QEdS9c059507@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: royger
Date: Tue Jun 26 14:39:27 2018
New Revision: 335666
URL: https://svnweb.freebsd.org/changeset/base/335666

Log:
  xen: limit the number of hypercall pages to 1
  
  The interface already guarantees that the number of hypercall pages is
  always going to be 1, see the comment in interface/arch-x86/cpuid.h
  
  Sponsored by: Citrix Systems R&D

Modified:
  head/sys/x86/xen/hvm.c

Modified: head/sys/x86/xen/hvm.c
==============================================================================
--- head/sys/x86/xen/hvm.c	Tue Jun 26 14:30:33 2018	(r335665)
+++ head/sys/x86/xen/hvm.c	Tue Jun 26 14:39:27 2018	(r335666)
@@ -124,7 +124,6 @@ static int
 xen_hvm_init_hypercall_stubs(enum xen_hvm_init_type init_type)
 {
 	uint32_t base, regs[4];
-	int i;
 
 	if (xen_pv_domain()) {
 		/* hypercall page is already set in the PV case */
@@ -167,9 +166,10 @@ xen_hvm_init_hypercall_stubs(enum xen_hvm_init_type in
 	 * Find the hypercall pages.
 	 */
 	do_cpuid(base + 2, regs);
+	if (regs[0] != 1)
+		return (EINVAL);
 
-	for (i = 0; i < regs[0]; i++)
-		wrmsr(regs[1], vtophys(&hypercall_page + i * PAGE_SIZE) + i);
+	wrmsr(regs[1], vtophys(&hypercall_page));
 
 	return (0);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806261439.w5QEdS9c059507>