From 7864380b190351f7abe439af2c6b96029b94744c Mon Sep 17 00:00:00 2001 From: Julio Faracco Date: Sun, 1 Mar 2020 21:54:13 -0300 Subject: [PATCH] lxc: Add HPET device into allowed devices This commit is related to RTC timer device too. HPET is being shared from host device through `localtime` clock. This timer is available creating a new timer using `hpet` name. Signed-off-by: Julio Faracco Signed-off-by: Michal Privoznik Reviewed-by: Michal Privoznik --- docs/formatdomain.html.in | 2 +- src/lxc/lxc_cgroup.c | 4 +++- src/lxc/lxc_controller.c | 6 +++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 180afe4333..0d229386eb 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -2464,7 +2464,7 @@ The name attribute selects which timer is being modified, and can be one of "platform" (currently unsupported), - "hpet" (libxl, xen, qemu), "kvmclock" (qemu), + "hpet" (libxl, xen, qemu, lxc), "kvmclock" (qemu), "pit" (qemu), "rtc" (qemu, lxc), "tsc" (libxl, qemu - since 3.2.0), "hypervclock" (qemu - since 1.2.2) or diff --git a/src/lxc/lxc_cgroup.c b/src/lxc/lxc_cgroup.c index 06605cb9ba..7df723a4da 100644 --- a/src/lxc/lxc_cgroup.c +++ b/src/lxc/lxc_cgroup.c @@ -350,13 +350,15 @@ static int virLXCCgroupSetupDeviceACL(virDomainDefPtr def, case VIR_DOMAIN_TIMER_NAME_KVMCLOCK: case VIR_DOMAIN_TIMER_NAME_HYPERVCLOCK: case VIR_DOMAIN_TIMER_NAME_PIT: - case VIR_DOMAIN_TIMER_NAME_HPET: case VIR_DOMAIN_TIMER_NAME_ARMVTIMER: case VIR_DOMAIN_TIMER_NAME_LAST: break; case VIR_DOMAIN_TIMER_NAME_RTC: dev = "/dev/rtc0"; break; + case VIR_DOMAIN_TIMER_NAME_HPET: + dev = "/dev/hpet"; + break; } if (!dev) diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c index 85986babb8..453b435dd6 100644 --- a/src/lxc/lxc_controller.c +++ b/src/lxc/lxc_controller.c @@ -1557,7 +1557,6 @@ virLXCControllerSetupTimers(virLXCControllerPtr ctrl) case VIR_DOMAIN_TIMER_NAME_KVMCLOCK: case VIR_DOMAIN_TIMER_NAME_HYPERVCLOCK: case VIR_DOMAIN_TIMER_NAME_PIT: - case VIR_DOMAIN_TIMER_NAME_HPET: case VIR_DOMAIN_TIMER_NAME_ARMVTIMER: case VIR_DOMAIN_TIMER_NAME_LAST: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -1569,6 +1568,11 @@ virLXCControllerSetupTimers(virLXCControllerPtr ctrl) path = g_strdup_printf("/%s/%s.dev/%s", LXC_STATE_DIR, def->name, "/rtc"); break; + case VIR_DOMAIN_TIMER_NAME_HPET: + timer_dev = "/dev/hpet"; + path = g_strdup_printf("/%s/%s.dev/%s", LXC_STATE_DIR, + ctrl->def->name, "/hpet"); + break; } if (!timer_dev)