From patchwork Thu Nov 16 10:53:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joshua Yeong X-Patchwork-Id: 165756 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp3126656vqg; Thu, 16 Nov 2023 02:54:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IGm8zbvrD35iiAHSxZQEmHk9y5+0X/GeVLE06RKAqcer3pO8ksgUiFGppOcjs1cHLPZSVsf X-Received: by 2002:a05:6358:cd15:b0:16b:fa53:9fa6 with SMTP id gv21-20020a056358cd1500b0016bfa539fa6mr6280846rwb.30.1700132071498; Thu, 16 Nov 2023 02:54:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700132071; cv=none; d=google.com; s=arc-20160816; b=EWUZJMkGeFFovYbKIpgCKCrLs6VII84Pv+jl0LxOuu4C0wZXxCaxsZR6RFLIk287F3 AnrUWRe2nv/At9YAZSANQTgCfcTjD8QBOb1GC0KHRblMqT4+wHNIkrJjtaK2pG3IUHk5 PZ8tSBuRfpwHHlcFng3YZzBP7RGc/dHOI2z7K17Bzmd5EwHaO8acQ2XSYfgPv662dlaS 9o/jdQUSmp8N09E60d1cPT2FscxAGUy+iqXSAS0TWlONEzStqJts6Dib2TRTY9S4uJxL 3WGnX7/w/ZpLO4kYg0knGEhXJqSsBfdP6cClgyBNbaehv8aIQ3MXKMRX2ocYliGrcjRI j5ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=8Ijt5qzEoOhsErqZBpzAVUY/ua97B8nzSlZy1SVOa1k=; fh=dDWVdWxoxdu1HIuuzfPrwpYb/Ru/vsdmeSAG6aE0X68=; b=unEkC9+d2r/TqKQUPRITfrYhhGSCMz5SmiUiPb+9SPazV2AZWMynquiRHAdFaKgNJD sFBGPklGKoPVBpZCl28lcyAxDlRGiY+8n9ANk0UCC1/TPh7OUOvtTWxEQC0LODR2XYDe qtu6Xa2KOjoNkNcdhbi6JKxhNbncSEquoPeWHDM1s1oPQBFJtqHX8FLPqT85/p13UZj0 caaUEcaLTqROE3lDskW4N7zgmboiHLYbDw5Tlhc47cS4kIhFXarvUYJg4j0IjIdvyeSR aY8Z+F8z0kNakWpa026BKJD0/ffGTVtxjLQvg0s1ffWKLtj9Gphmo0LEH+QiHt2akiY7 bqSw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id j63-20020a638042000000b005b106cd44casi12181369pgd.145.2023.11.16.02.54.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 02:54:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 6D9F180D6506; Thu, 16 Nov 2023 02:54:28 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345069AbjKPKyT convert rfc822-to-8bit (ORCPT + 29 others); Thu, 16 Nov 2023 05:54:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345060AbjKPKyQ (ORCPT ); Thu, 16 Nov 2023 05:54:16 -0500 Received: from fd01.gateway.ufhost.com (fd01.gateway.ufhost.com [61.152.239.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D67B918B for ; Thu, 16 Nov 2023 02:54:00 -0800 (PST) Received: from EXMBX166.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX166", Issuer "EXMBX166" (not verified)) by fd01.gateway.ufhost.com (Postfix) with ESMTP id F0CDE80C7; Thu, 16 Nov 2023 18:53:47 +0800 (CST) Received: from EXMBX066.cuchost.com (172.16.7.66) by EXMBX166.cuchost.com (172.16.6.76) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Thu, 16 Nov 2023 18:53:48 +0800 Received: from localhost.localdomain (161.142.156.149) by EXMBX066.cuchost.com (172.16.6.66) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Thu, 16 Nov 2023 18:53:39 +0800 From: Joshua Yeong To: , , , , CC: , , , Joshua Yeong Subject: [PATCH v3 1/1] clocksource/timer-riscv: Add riscv_clock_shutdown callback Date: Thu, 16 Nov 2023 18:53:12 +0800 Message-ID: <20231116105312.4800-1-joshua.yeong@starfivetech.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [161.142.156.149] X-ClientProxiedBy: EXCAS062.cuchost.com (172.16.6.22) To EXMBX066.cuchost.com (172.16.6.66) X-YovoleRuleAgent: yovoleflag X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 16 Nov 2023 02:54:28 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782717687045568530 X-GMAIL-MSGID: 1782717687045568530 Add clocksource detach/shutdown callback to disable RISC-V timer interrupt when switching out riscv timer as clock source Signed-off-by: Joshua Yeong Reviewed-by: Anup Patel --- drivers/clocksource/timer-riscv.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/clocksource/timer-riscv.c b/drivers/clocksource/timer-riscv.c index 57857c0dfba9..e66dcbd66566 100644 --- a/drivers/clocksource/timer-riscv.c +++ b/drivers/clocksource/timer-riscv.c @@ -61,12 +61,19 @@ static int riscv_clock_next_event(unsigned long delta, return 0; } +static int riscv_clock_shutdown(struct clock_event_device *evt) +{ + riscv_clock_event_stop(); + return 0; +} + static unsigned int riscv_clock_event_irq; static DEFINE_PER_CPU(struct clock_event_device, riscv_clock_event) = { .name = "riscv_timer_clockevent", .features = CLOCK_EVT_FEAT_ONESHOT, .rating = 100, .set_next_event = riscv_clock_next_event, + .set_state_shutdown = riscv_clock_shutdown, }; /*