Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 May 2016 11:46:31 -0700
From:      "Ngie Cooper (yaneurabeya)" <yaneurabeya@gmail.com>
To:        =?utf-8?Q?Roger_Pau_Monn=C3=A9?= <royger@FreeBSD.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r298929 - head/sys/dev/xen/timer
Message-ID:  <337D6745-6821-4035-B1CB-F22C6A96E568@gmail.com>
In-Reply-To: <201605021615.u42GFSeR052375@repo.freebsd.org>
References:  <201605021615.u42GFSeR052375@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

> On May 2, 2016, at 09:15, Roger Pau Monn=C3=A9 <royger@FreeBSD.org> =
wrote:
>=20
> Author: royger
> Date: Mon May  2 16:15:28 2016
> New Revision: 298929
> URL: https://svnweb.freebsd.org/changeset/base/298929
>=20
> Log:
>  xen/time: allow Dom0 to set the host time
>=20
>  Dom0 should be able to set the host time. This is implemented by =
first
>  writing to the RTC (as would be done on bare metal), and then using =
the
>  XENPF_settime64 hypercall in order to force Xen to update the =
wallclock
>  shared page of all domains.
>=20
>  Sponsored by: Citrix Systems R&D
>=20
> Modified:
>  head/sys/dev/xen/timer/timer.c
>=20
> Modified: head/sys/dev/xen/timer/timer.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/dev/xen/timer/timer.c	Mon May  2 16:14:55 2016	=
(r298928)
> +++ head/sys/dev/xen/timer/timer.c	Mon May  2 16:15:28 2016	=
(r298929)
> @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
> #include <xen/hypervisor.h>
> #include <xen/interface/io/xenbus.h>
> #include <xen/interface/vcpu.h>
> +#include <xen/error.h>
>=20
> #include <machine/cpu.h>
> #include <machine/cpufunc.h>
> @@ -63,6 +64,8 @@ __FBSDID("$FreeBSD$");
>=20
> #include <dev/xen/timer/timer.h>
>=20
> +#include <isa/rtc.h>
> +
> #include "clock_if.h"
>=20
> static devclass_t xentimer_devclass;
> @@ -211,11 +214,32 @@ xen_fetch_uptime(struct timespec *ts)
> static int
> xentimer_settime(device_t dev __unused, struct timespec *ts)
> {
> +	struct xen_platform_op settime;
> +	int ret;
> +
> 	/*
> 	 * Don't return EINVAL here; just silently fail if the domain =
isn't
> 	 * privileged enough to set the TOD.
> 	 */
> -	return (0);
> +	if (!xen_initial_domain())
> +		return (0);
> +
> +	/* Set the native RTC. */
> +	atrtc_set(ts);
> +
> +	settime.cmd =3D XENPF_settime64;
> +	settime.u.settime64.mbz =3D 0;
> +	settime.u.settime64.secs =3D ts->tv_sec;
> +	settime.u.settime64.nsecs =3D ts->tv_nsec;
> +	settime.u.settime64.system_time =3D
> +		xen_fetch_vcpu_time(DPCPU_GET(vcpu_info));
> +
> +	ret =3D HYPERVISOR_platform_op(&settime);
> +	ret =3D ret !=3D 0 ? xen_translate_error(ret) : 0;
> +	if (ret !=3D 0 && bootverbose)
> +		device_printf(dev, "failed to set Xen PV clock: %d\n", =
ret);
> +
> +	return (ret);
> }

This broke the build on i386 with clang: =
https://jenkins.freebsd.org/job/FreeBSD_HEAD_i386/3028/=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?337D6745-6821-4035-B1CB-F22C6A96E568>