From patchwork Thu Jul 16 10:58:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 51149 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9940722A8A for ; Thu, 16 Jul 2015 10:59:46 +0000 (UTC) Received: by lbcjf8 with SMTP id jf8sf17440059lbc.0 for ; Thu, 16 Jul 2015 03:59:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=RCcJFuaW6I91w5ixFomuvDUACDDkUbaSwm8yvCE8OvM=; b=ka+lLb139oza6a9VtPDpp1FXeG2SdH/Ju+3AOek/7Lit/0jrC6FxuH8R37iu52XKPo uQmuumXJN06Qw+F4zc6Ii9HWqu7zhRyrnW8uWnwu7lEbG1NpteIiDOOw1aoB8mR7+5RF gDkFg3ByfJhUu1JmKjaesLC+fGLaQjelGv/g9+MswUain2SsV+O2PEKTyX/76DX//LBa cCUqzga9ahk4EIf2iLUBB3T7B1eb6GmWviG4mqfBAxJ7tYeeg6NoTdhf/GbsK8vwaPS3 pNp5d2Iu2hwRX9yuzMSxN8cmDrdyBawfSC3MCd8rQ3QYchjdn1qqzIrJzmL3GxkgwO90 v8kg== X-Gm-Message-State: ALoCoQmekT3lE6IhUNZJ/sDOckIPopp+PAnkoiNkoxno43Bgt88XfLMHO/3wOxb+QmgEzU1dB2lR X-Received: by 10.152.27.130 with SMTP id t2mr4593020lag.2.1437044385618; Thu, 16 Jul 2015 03:59:45 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.7.136 with SMTP id dc8ls371027lad.101.gmail; Thu, 16 Jul 2015 03:59:45 -0700 (PDT) X-Received: by 10.152.42.205 with SMTP id q13mr8656361lal.119.1437044385422; Thu, 16 Jul 2015 03:59:45 -0700 (PDT) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id n4si6646072laj.18.2015.07.16.03.59.45 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Jul 2015 03:59:45 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by lbbzr7 with SMTP id zr7so41411479lbb.1 for ; Thu, 16 Jul 2015 03:59:45 -0700 (PDT) X-Received: by 10.152.22.99 with SMTP id c3mr9009541laf.32.1437044385312; Thu, 16 Jul 2015 03:59:45 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp175511lbb; Thu, 16 Jul 2015 03:59:44 -0700 (PDT) X-Received: by 10.68.167.197 with SMTP id zq5mr17536279pbb.85.1437044383548; Thu, 16 Jul 2015 03:59:43 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ki8si12417687pdb.218.2015.07.16.03.59.42; Thu, 16 Jul 2015 03:59:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754572AbbGPK7f (ORCPT + 26 others); Thu, 16 Jul 2015 06:59:35 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:33065 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754458AbbGPK7c (ORCPT ); Thu, 16 Jul 2015 06:59:32 -0400 Received: by padck2 with SMTP id ck2so41000184pad.0 for ; Thu, 16 Jul 2015 03:59:31 -0700 (PDT) X-Received: by 10.67.11.9 with SMTP id ee9mr17725447pad.83.1437044371858; Thu, 16 Jul 2015 03:59:31 -0700 (PDT) Received: from localhost ([122.171.186.190]) by smtp.gmail.com with ESMTPSA id fb3sm7532160pbd.91.2015.07.16.03.59.30 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 16 Jul 2015 03:59:31 -0700 (PDT) From: Viresh Kumar To: Thomas Gleixner , Ingo Molnar Cc: linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, x86@kernel.org, hpa@zytor.com, Viresh Kumar , Konrad Rzeszutek Wilk , Boris Ostrovsky , David Vrabel , xen-devel@lists.xenproject.org (moderated list:XEN HYPERVISOR INTERFACE) Subject: [PATCH 5/5] x86/xen/time: Migrate to new 'set-state' interface Date: Thu, 16 Jul 2015 16:28:48 +0530 Message-Id: <881eea6e1a3d483cd33e044cd34827cce26a57fd.1437042675.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.4.0 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Migrate xen driver to the new 'set-state' interface provided by clockevents core, the earlier 'set-mode' interface is marked obsolete now. This also enables us to implement callbacks for new states of clockevent devices, for example: ONESHOT_STOPPED. Callbacks aren't implemented for modes where we weren't doing anything. Signed-off-by: Viresh Kumar --- arch/x86/xen/time.c | 63 +++++++++++++++++++---------------------------------- 1 file changed, 23 insertions(+), 40 deletions(-) diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c index 55da33b1d51c..4b5ed547daa3 100644 --- a/arch/x86/xen/time.c +++ b/arch/x86/xen/time.c @@ -274,30 +274,17 @@ static s64 get_abs_timeout(unsigned long delta) return xen_clocksource_read() + delta; } -static void xen_timerop_set_mode(enum clock_event_mode mode, - struct clock_event_device *evt) +static int xen_timerop_shutdown(struct clock_event_device *evt) { - switch (mode) { - case CLOCK_EVT_MODE_PERIODIC: - /* unsupported */ - WARN_ON(1); - break; - - case CLOCK_EVT_MODE_ONESHOT: - case CLOCK_EVT_MODE_RESUME: - break; - - case CLOCK_EVT_MODE_UNUSED: - case CLOCK_EVT_MODE_SHUTDOWN: - HYPERVISOR_set_timer_op(0); /* cancel timeout */ - break; - } + HYPERVISOR_set_timer_op(0); /* cancel timeout */ + + return 0; } static int xen_timerop_set_next_event(unsigned long delta, struct clock_event_device *evt) { - WARN_ON(evt->mode != CLOCK_EVT_MODE_ONESHOT); + WARN_ON(!clockevent_state_oneshot(evt)); if (HYPERVISOR_set_timer_op(get_abs_timeout(delta)) < 0) BUG(); @@ -320,36 +307,31 @@ static const struct clock_event_device xen_timerop_clockevent = { .shift = 0, .rating = 500, - .set_mode = xen_timerop_set_mode, + .set_state_shutdown = xen_timerop_shutdown, .set_next_event = xen_timerop_set_next_event, }; -static void xen_vcpuop_set_mode(enum clock_event_mode mode, - struct clock_event_device *evt) +static int xen_vcpuop_shutdown(struct clock_event_device *evt) { int cpu = smp_processor_id(); - switch (mode) { - case CLOCK_EVT_MODE_PERIODIC: - WARN_ON(1); /* unsupported */ - break; + if (HYPERVISOR_vcpu_op(VCPUOP_stop_singleshot_timer, cpu, NULL) || + HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer, cpu, NULL)) + BUG(); - case CLOCK_EVT_MODE_ONESHOT: - if (HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer, cpu, NULL)) - BUG(); - break; + return 0; +} - case CLOCK_EVT_MODE_UNUSED: - case CLOCK_EVT_MODE_SHUTDOWN: - if (HYPERVISOR_vcpu_op(VCPUOP_stop_singleshot_timer, cpu, NULL) || - HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer, cpu, NULL)) - BUG(); - break; - case CLOCK_EVT_MODE_RESUME: - break; - } +static int xen_vcpuop_set_oneshot(struct clock_event_device *evt) +{ + int cpu = smp_processor_id(); + + if (HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer, cpu, NULL)) + BUG(); + + return 0; } static int xen_vcpuop_set_next_event(unsigned long delta, @@ -359,7 +341,7 @@ static int xen_vcpuop_set_next_event(unsigned long delta, struct vcpu_set_singleshot_timer single; int ret; - WARN_ON(evt->mode != CLOCK_EVT_MODE_ONESHOT); + WARN_ON(!clockevent_state_oneshot(evt)); single.timeout_abs_ns = get_abs_timeout(delta); single.flags = VCPU_SSHOTTMR_future; @@ -382,7 +364,8 @@ static const struct clock_event_device xen_vcpuop_clockevent = { .shift = 0, .rating = 500, - .set_mode = xen_vcpuop_set_mode, + .set_state_shutdown = xen_vcpuop_shutdown, + .set_state_oneshot = xen_vcpuop_set_oneshot, .set_next_event = xen_vcpuop_set_next_event, };