From patchwork Wed Aug 5 07:52:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: KY Srinivasan X-Patchwork-Id: 51944 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by patches.linaro.org (Postfix) with ESMTPS id 4980522E8E for ; Wed, 5 Aug 2015 06:29:09 +0000 (UTC) Received: by wibdx1 with SMTP id dx1sf13269720wib.2 for ; Tue, 04 Aug 2015 23:29:08 -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=t4ghdlXtrBFDoTNsINRPci4p3gNLKJ67zaSaOLAhILk=; b=jECA+Rr254cD6JPk1m4WUmv97DuXIMREvyRlLNH3bC/Qj6JWNqy1M3prXbwoG2i7Il PnuwHA7KxqeHdEAG7lL2nJZ6TDQzxqoCRMGfcUEzVWSDh063jAwknNWI6v4p4GIXTZWI 3NrnYUI0jbdUpCO5mBlGfjIxsH4G9njAp4GrhetNSOiv2q7V4KeylWQXA9SuYxlo8wkQ Z4gwbgnhlbxgsmsMfhlVIChyt1XSOsxm64lOt1j5bgFzZEC/XpedAVIRQxaALE4bO95L 8tdVy9mZ4QBkVf+J44FCfzjoK72v2APqIS19eSDnkvL42SWdesD2GcuFDNXdIC5uXcH6 vU7g== X-Gm-Message-State: ALoCoQlkr97BVlKNwtck0fbPk0hvP+K11/Z0gAWglvg3EoV98ul+IxQumAHKrYrqtMyz8CV20nKv X-Received: by 10.112.51.177 with SMTP id l17mr2212835lbo.1.1438756148573; Tue, 04 Aug 2015 23:29:08 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.37.7 with SMTP id u7ls118394laj.105.gmail; Tue, 04 Aug 2015 23:29:08 -0700 (PDT) X-Received: by 10.152.225.165 with SMTP id rl5mr7872015lac.1.1438756148386; Tue, 04 Aug 2015 23:29:08 -0700 (PDT) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com. [209.85.217.170]) by mx.google.com with ESMTPS id c4si1502696laf.113.2015.08.04.23.29.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Aug 2015 23:29:07 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.170 as permitted sender) client-ip=209.85.217.170; Received: by lbbvv8 with SMTP id vv8so16174394lbb.1 for ; Tue, 04 Aug 2015 23:29:07 -0700 (PDT) X-Received: by 10.152.36.161 with SMTP id r1mr7890068laj.88.1438756147808; Tue, 04 Aug 2015 23:29:07 -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 l6csp177871lba; Tue, 4 Aug 2015 23:29:06 -0700 (PDT) X-Received: by 10.70.20.5 with SMTP id j5mr16318637pde.40.1438756146281; Tue, 04 Aug 2015 23:29:06 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fl3si3639838pad.107.2015.08.04.23.29.05; Tue, 04 Aug 2015 23:29:06 -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 S1751856AbbHEG1r (ORCPT + 28 others); Wed, 5 Aug 2015 02:27:47 -0400 Received: from p3plsmtps2ded03.prod.phx3.secureserver.net ([208.109.80.60]:49489 "EHLO p3plsmtps2ded03.prod.phx3.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751278AbbHEG1d (ORCPT ); Wed, 5 Aug 2015 02:27:33 -0400 Received: from linuxonhyperv.com ([72.167.245.219]) by p3plsmtps2ded03.prod.phx3.secureserver.net with : DED : id 0uTY1r02Y4kklxU01uTYtY; Tue, 04 Aug 2015 23:27:32 -0700 x-originating-ip: 72.167.245.219 Received: by linuxonhyperv.com (Postfix, from userid 507) id 366DE1905CA; Wed, 5 Aug 2015 00:52:50 -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 06/13] drivers/hv: Migrate to new 'set-state' interface Date: Wed, 5 Aug 2015 00:52:41 -0700 Message-Id: <1438761168-17134-6-git-send-email-kys@microsoft.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1438761168-17134-1-git-send-email-kys@microsoft.com> References: <1438761140-17093-1-git-send-email-kys@microsoft.com> <1438761168-17134-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.170 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 fd93cfd..c641faf 100644 --- a/drivers/hv/hv.c +++ b/drivers/hv/hv.c @@ -274,7 +274,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; @@ -282,31 +282,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) @@ -321,7 +314,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; } @@ -515,8 +509,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);