From patchwork Mon Jul 20 23:45:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: KY Srinivasan X-Patchwork-Id: 51292 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by patches.linaro.org (Postfix) with ESMTPS id CDC2C20323 for ; Mon, 20 Jul 2015 22:21:48 +0000 (UTC) Received: by lbcjj5 with SMTP id jj5sf8819418lbc.1 for ; Mon, 20 Jul 2015 15:21:47 -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:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=URG9Ul0SromR86ceYBSbj2sDxUs0cjJVp3oyx7ykSWs=; b=N9tiTD0l2R1A+/XPG0yniUTg34ctPmodmLe6isGtSCni9n3YloMUScI+J/UY5yYck8 fVeyBE9snJRAPKN28HS/QkH0ftVbpTUSJNuo69F5xMjMhUd3I+19SMmlMoJahqAXDcTQ xlPfG+tLUCFxsPwYKbODWWmMj2iERVKCbdnypFE5Lcjuf62NqkfIqGdJU4ky5xLYPrdL FhF0YS99P+DNyolOk1NQAjDCFzaJ7sDR2yWM7QoeO7nZQHlmPaNK/GmhqJkhGMQLWhUh PXe3jK/bHx9CjrctEJoH1iaOKdkvtwu3x9G31I1eFBwKbSr2FQatI6RtXolW6c4G+Vbz t3PQ== X-Gm-Message-State: ALoCoQmetCSv4pptGJ+Dx8i7LzOgIFjyzb3Z/aQ/OMKJ5SB91BKNiNhTc48Z+61+slpZZlb3EW+s X-Received: by 10.180.97.9 with SMTP id dw9mr7349913wib.2.1437430907798; Mon, 20 Jul 2015 15:21:47 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.230 with SMTP id y6ls899861lae.20.gmail; Mon, 20 Jul 2015 15:21:47 -0700 (PDT) X-Received: by 10.112.137.1 with SMTP id qe1mr29171266lbb.22.1437430907511; Mon, 20 Jul 2015 15:21:47 -0700 (PDT) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com. [209.85.217.173]) by mx.google.com with ESMTPS id oq3si19073397lbb.125.2015.07.20.15.21.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Jul 2015 15:21:47 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) client-ip=209.85.217.173; Received: by lbbzr7 with SMTP id zr7so103954583lbb.1 for ; Mon, 20 Jul 2015 15:21:47 -0700 (PDT) X-Received: by 10.112.131.98 with SMTP id ol2mr30525038lbb.56.1437430907006; Mon, 20 Jul 2015 15:21:47 -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.7.198 with SMTP id l6csp1040878lba; Mon, 20 Jul 2015 15:21:45 -0700 (PDT) X-Received: by 10.70.92.41 with SMTP id cj9mr7859548pdb.64.1437430905070; Mon, 20 Jul 2015 15:21:45 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id nr12si6958901pdb.138.2015.07.20.15.21.44; Mon, 20 Jul 2015 15:21:45 -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 S1757306AbbGTWVm (ORCPT + 28 others); Mon, 20 Jul 2015 18:21:42 -0400 Received: from p3plsmtps2ded04.prod.phx3.secureserver.net ([208.109.80.198]:33340 "EHLO p3plsmtps2ded04.prod.phx3.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754058AbbGTWVk (ORCPT ); Mon, 20 Jul 2015 18:21:40 -0400 Received: from linuxonhyperv.com ([72.167.245.219]) by p3plsmtps2ded04.prod.phx3.secureserver.net with : DED : id umMf1q00R4kklxU01mMf2c; Mon, 20 Jul 2015 15:21:39 -0700 x-originating-ip: 72.167.245.219 Received: by linuxonhyperv.com (Postfix, from userid 507) id 81D5F190246; Mon, 20 Jul 2015 16:45:59 -0700 (PDT) From: "K. Y. Srinivasan" To: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, olaf@aepfle.de, apw@canonical.com, vkuznets@redhat.com, jasowang@redhat.com Cc: Viresh Kumar , "K. Y. Srinivasan" , Haiyang Zhang Subject: [PATCH V2 4/5] drivers/hv: Migrate to new 'set-state' interface Date: Mon, 20 Jul 2015 16:45:57 -0700 Message-Id: <1437435958-15421-4-git-send-email-kys@microsoft.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1437435958-15421-1-git-send-email-kys@microsoft.com> References: <1437435933-15382-1-git-send-email-kys@microsoft.com> <1437435958-15421-1-git-send-email-kys@microsoft.com> 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: kys@microsoft.com 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.173 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dmarc=fail (p=NONE dis=NONE) header.from=microsoft.com 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: , From: Viresh Kumar 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 Signed-off-by: K. Y. Srinivasan --- drivers/hv/hv.c | 45 +++++++++++++++++++-------------------------- 1 files changed, 19 insertions(+), 26 deletions(-) diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c index 85498a7..b9dd5e8 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; } @@ -512,8 +506,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);