From patchwork Mon Jul 20 03:37:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: KY Srinivasan X-Patchwork-Id: 51266 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4083D228F7 for ; Mon, 20 Jul 2015 02:14:02 +0000 (UTC) Received: by wibuw6 with SMTP id uw6sf3662232wib.3 for ; Sun, 19 Jul 2015 19:14:01 -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=QQte5L7TsvdnWyLofVaL726g1C+mbnIUDdr1+fHpG8o0jONYt8ob5TO2V0kXld0r9q PwalbXe/6+nj3ElYzGAwIsDucbon9eVmwKamq3ymC6HKRUA3O8t2AJ4fUSfv6Ao/Kwlp FFQhAfgIbbsd8DZjhUbO4Gev0rbufmtDghxrBkpnaieM4IDsM0/Lh6627vNPJzbLPnVy CWK0Jll/9iJWJ46e2GvKjFq6eUIPNOrpNdzkXQMHhBzc281asuBGgQwRL5jBh3NWPf91 ApliQYd+C3aiBLn3FEkIV6xDM00AZvTyrNuNSuLt0u+p8/QZzbX7HxwFNnDODBGvMHYZ 8/bg== X-Gm-Message-State: ALoCoQkCFYMFnyloQogvdwJAE5UCDLhWcSOF+w7qLfeNga/YO8YMc2M3CENvKUfTewX75eXSud9S X-Received: by 10.180.35.162 with SMTP id i2mr5060466wij.6.1437358441595; Sun, 19 Jul 2015 19:14:01 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.120.3 with SMTP id ky3ls724774lab.70.gmail; Sun, 19 Jul 2015 19:14:01 -0700 (PDT) X-Received: by 10.152.23.234 with SMTP id p10mr25362039laf.52.1437358441400; Sun, 19 Jul 2015 19:14:01 -0700 (PDT) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com. [209.85.217.171]) by mx.google.com with ESMTPS id ky3si16565633lab.173.2015.07.19.19.14.01 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 Jul 2015 19:14:01 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) client-ip=209.85.217.171; Received: by lbbzr7 with SMTP id zr7so87336968lbb.1 for ; Sun, 19 Jul 2015 19:14:00 -0700 (PDT) X-Received: by 10.152.6.69 with SMTP id y5mr25137183lay.72.1437358440632; Sun, 19 Jul 2015 19:14:00 -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 l6csp525497lba; Sun, 19 Jul 2015 19:13:59 -0700 (PDT) X-Received: by 10.66.121.163 with SMTP id ll3mr55630996pab.100.1437358438578; Sun, 19 Jul 2015 19:13:58 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id rl7si32098713pab.173.2015.07.19.19.13.57; Sun, 19 Jul 2015 19:13:58 -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 S1754910AbbGTCNj (ORCPT + 28 others); Sun, 19 Jul 2015 22:13:39 -0400 Received: from p3plsmtps2ded03.prod.phx3.secureserver.net ([208.109.80.60]:33592 "EHLO p3plsmtps2ded03.prod.phx3.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754416AbbGTCNN (ORCPT ); Sun, 19 Jul 2015 22:13:13 -0400 Received: from linuxonhyperv.com ([72.167.245.219]) by p3plsmtps2ded03.prod.phx3.secureserver.net with : DED : id uSDC1q00a4kklxU01SDCZQ; Sun, 19 Jul 2015 19:13:13 -0700 x-originating-ip: 72.167.245.219 Received: by linuxonhyperv.com (Postfix, from userid 507) id 3746B190246; Sun, 19 Jul 2015 20:37:29 -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 4/5] drivers/hv: Migrate to new 'set-state' interface Date: Sun, 19 Jul 2015 20:37:26 -0700 Message-Id: <1437363447-3554-4-git-send-email-kys@microsoft.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1437363447-3554-1-git-send-email-kys@microsoft.com> References: <1437363419-3511-1-git-send-email-kys@microsoft.com> <1437363447-3554-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.171 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);