From patchwork Thu Jul 16 11:26:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 51166 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3EBE122A28 for ; Thu, 16 Jul 2015 11:29:53 +0000 (UTC) Received: by lagx9 with SMTP id x9sf17940593lag.2 for ; Thu, 16 Jul 2015 04:29:52 -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=J6sek8ctI3F4zg2qNemJHr+kDh1wR/V66k2jNx9A8eM=; b=FRnVeS6lDR1rIswSTQ620rLn1J2O1KLV5hAqw4j0U6dRmnwJpqMiDzPygSnLYX2ffR sszb8aK4DY4K2yXxhTNqp78ztoRQkXLKg03+5GjQsq9HbBqGoRfG1uN79PogDC4AHlb9 60KbQe1Wrm1AohkfGOcGbJzPdu6xZMxFK9zZlTw3AFzDd5gMOHimvmYuA5IGBqdVhB/6 JMutNnEQbyA6L9rQabJUp+gATDr3CVCg81xnln6rBfb5cavHnYpxlDHgNzjf5J0B8KQ4 Q7lcxomtd18Z/kxJkvPUwa4UIh+Wkn7pCURBSwlur+8FFjvQJ79jnoZ53FS3onX9hkqc BPYQ== X-Gm-Message-State: ALoCoQkJB4vPt8cf+BF4Wi9Ih0SqxJpvr97djve2JcDOfOkhXxE1TMV6NdBwwzKwmbqhNSj3Reyh X-Received: by 10.152.88.111 with SMTP id bf15mr1397791lab.9.1437046192244; Thu, 16 Jul 2015 04:29:52 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.67 with SMTP id q3ls317419laq.78.gmail; Thu, 16 Jul 2015 04:29:51 -0700 (PDT) X-Received: by 10.112.39.71 with SMTP id n7mr8943157lbk.44.1437046191901; Thu, 16 Jul 2015 04:29:51 -0700 (PDT) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com. [209.85.215.53]) by mx.google.com with ESMTPS id o2si6668053lah.162.2015.07.16.04.29.51 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Jul 2015 04:29:51 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by lahh5 with SMTP id h5so41594942lah.2 for ; Thu, 16 Jul 2015 04:29:51 -0700 (PDT) X-Received: by 10.112.55.207 with SMTP id u15mr8887190lbp.88.1437046191747; Thu, 16 Jul 2015 04:29:51 -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 hn6csp192347lbb; Thu, 16 Jul 2015 04:29:50 -0700 (PDT) X-Received: by 10.70.126.133 with SMTP id my5mr10394456pdb.14.1437046189785; Thu, 16 Jul 2015 04:29:49 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ot9si12591142pab.79.2015.07.16.04.29.48; Thu, 16 Jul 2015 04:29:49 -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 S1755494AbbGPL3c (ORCPT + 27 others); Thu, 16 Jul 2015 07:29:32 -0400 Received: from mail-pa0-f43.google.com ([209.85.220.43]:34782 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752199AbbGPL32 (ORCPT ); Thu, 16 Jul 2015 07:29:28 -0400 Received: by pacan13 with SMTP id an13so41741035pac.1 for ; Thu, 16 Jul 2015 04:29:27 -0700 (PDT) X-Received: by 10.70.35.16 with SMTP id d16mr17948875pdj.66.1437046167747; Thu, 16 Jul 2015 04:29:27 -0700 (PDT) Received: from localhost ([122.171.186.190]) by smtp.gmail.com with ESMTPSA id ze3sm7683647pbb.32.2015.07.16.04.29.25 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 16 Jul 2015 04:29:26 -0700 (PDT) From: Viresh Kumar To: Thomas Gleixner , Daniel Lezcano Cc: linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, Viresh Kumar , "K. Y. Srinivasan" , Haiyang Zhang , devel@linuxdriverproject.org Subject: [PATCH 22/23] drivers/hv: Migrate to new 'set-state' interface Date: Thu, 16 Jul 2015 16:56:34 +0530 Message-Id: <1bbc5313c955d8c24b52aa0007de5f27ab744053.1437044518.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.215.53 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 hv 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. Cc: "K. Y. Srinivasan" Cc: Haiyang Zhang Cc: devel@linuxdriverproject.org Signed-off-by: Viresh Kumar --- drivers/hv/hv.c | 45 +++++++++++++++++++-------------------------- 1 file changed, 19 insertions(+), 26 deletions(-) diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c index d3943bceecc3..76e519ec2e51 100644 --- a/drivers/hv/hv.c +++ b/drivers/hv/hv.c @@ -271,7 +271,7 @@ static int hv_ce_set_next_event(unsigned long delta, { cycle_t current_tick; - WARN_ON(evt->mode != CLOCK_EVT_MODE_ONESHOT); + WARN_ON(!clockevent_state_oneshot(evt)); rdmsrl(HV_X64_MSR_TIME_REF_COUNT, current_tick); current_tick += delta; @@ -279,31 +279,24 @@ static int hv_ce_set_next_event(unsigned long delta, return 0; } -static void hv_ce_setmode(enum clock_event_mode mode, - struct clock_event_device *evt) +static int hv_ce_shutdown(struct clock_event_device *evt) +{ + wrmsrl(HV_X64_MSR_STIMER0_COUNT, 0); + wrmsrl(HV_X64_MSR_STIMER0_CONFIG, 0); + + return 0; +} + +static int hv_ce_set_oneshot(struct clock_event_device *evt) { union hv_timer_config timer_cfg; - switch (mode) { - case CLOCK_EVT_MODE_PERIODIC: - /* unsupported */ - break; - - case CLOCK_EVT_MODE_ONESHOT: - timer_cfg.enable = 1; - timer_cfg.auto_enable = 1; - timer_cfg.sintx = VMBUS_MESSAGE_SINT; - wrmsrl(HV_X64_MSR_STIMER0_CONFIG, timer_cfg.as_uint64); - break; - - case CLOCK_EVT_MODE_UNUSED: - case CLOCK_EVT_MODE_SHUTDOWN: - wrmsrl(HV_X64_MSR_STIMER0_COUNT, 0); - wrmsrl(HV_X64_MSR_STIMER0_CONFIG, 0); - break; - case CLOCK_EVT_MODE_RESUME: - break; - } + timer_cfg.enable = 1; + timer_cfg.auto_enable = 1; + timer_cfg.sintx = VMBUS_MESSAGE_SINT; + wrmsrl(HV_X64_MSR_STIMER0_CONFIG, timer_cfg.as_uint64); + + return 0; } static void hv_init_clockevent_device(struct clock_event_device *dev, int cpu) @@ -318,7 +311,8 @@ static void hv_init_clockevent_device(struct clock_event_device *dev, int cpu) * references to the hv_vmbus module making it impossible to unload. */ - dev->set_mode = hv_ce_setmode; + dev->set_state_shutdown = hv_ce_shutdown; + dev->set_state_oneshot = hv_ce_set_oneshot; dev->set_next_event = hv_ce_set_next_event; } @@ -503,8 +497,7 @@ void hv_synic_cleanup(void *arg) /* Turn off clockevent device */ if (ms_hyperv.features & HV_X64_MSR_SYNTIMER_AVAILABLE) - hv_ce_setmode(CLOCK_EVT_MODE_SHUTDOWN, - hv_context.clk_evt[cpu]); + hv_ce_shutdown(hv_context.clk_evt[cpu]); rdmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, shared_sint.as_uint64);