From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44A82C433DB for ; Thu, 21 Jan 2021 10:56:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E9B0D238A0 for ; Thu, 21 Jan 2021 10:56:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729869AbhAUK4J (ORCPT ); Thu, 21 Jan 2021 05:56:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:37990 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729948AbhAUKxL (ORCPT ); Thu, 21 Jan 2021 05:53:11 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id CE79B2388E for ; Thu, 21 Jan 2021 10:52:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611226350; bh=joXsWySRbCpeXgJGWvfjkk3B0A5HawAKQzOPNL63CWI=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=ZgToFo4Z6b3rZGEfKnksUIMOEMU896mS5dkbtosDale+jNDOa4zSMZ0ZTSNiSJVw7 1TkS9aYFpwlpoQJ07MkLeeYPEjIqoLLzcfJ3vsyeOFskCKErUOXvjCUOvFqVznHUdM RJhlYdEAnhf/AoZ9xEAs8a1gy/Ibw6lCRvASJMIUzSCMbbwSJSa/c/jClR4ZrkURjE P+5SgF2QP4anEhglLAxhnGtG0CtvZH9CQIBjN5GVmJs7Fame+e3194mAMZPJ/BbLSz 7GeCgOseuJUBCOJChbLEyV+33vS+eFrfsdEf7c13+HmV8yqD5Km+0ZWDvE0eBuf05y dK4geQLiKIgjw== Received: by mail-ot1-f47.google.com with SMTP id f6so1172180ots.9 for ; Thu, 21 Jan 2021 02:52:30 -0800 (PST) X-Gm-Message-State: AOAM5300A1tPw45p2CWGgq+BFQiRTbJ4nvU25GAag9NWoDSR/Vv2ok2F Zwqnzh6+gvuQ9W1cboN3ER6Upryp8NI6Y6D4J4M= X-Google-Smtp-Source: ABdhPJwaHE5gSoHcTUdZ3ZuMwiZ7NxU8/eegCE5gziTqwjhe6YZnkMo10U6Zy2pwRh0EBA+I9+S80KTz3j0JOtmlzQI= X-Received: by 2002:a05:6830:139a:: with SMTP id d26mr9994046otq.305.1611226350006; Thu, 21 Jan 2021 02:52:30 -0800 (PST) MIME-Version: 1.0 References: <20210120132717.395873-1-mohamed.mediouni@caramail.com> <20210120132717.395873-3-mohamed.mediouni@caramail.com> In-Reply-To: <20210120132717.395873-3-mohamed.mediouni@caramail.com> From: Arnd Bergmann Date: Thu, 21 Jan 2021 11:52:13 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH 2/7] arm64: kernel: Add a WFI hook. To: Mohamed Mediouni Cc: Linux ARM , Mark Rutland , Catalin Marinas , Hector Martin , "linux-kernel@vger.kernel.org" , Marc Zyngier , Will Deacon , Stan Skowronek Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 20, 2021 at 2:27 PM Mohamed Mediouni wrote: > --- a/arch/arm64/kernel/cpu_ops.c > +++ b/arch/arm64/kernel/cpu_ops.c > #if defined(CONFIG_STACKPROTECTOR) && !defined(CONFIG_STACKPROTECTOR_PER_TASK) > #include > @@ -74,8 +75,14 @@ void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd); > > static void noinstr __cpu_do_idle(void) > { > - dsb(sy); > - wfi(); > + const struct cpu_operations *ops = get_cpu_ops(task_cpu(current)); > + > + if (ops->cpu_wfi) { > + ops->cpu_wfi(); > + } else { > + dsb(sy); > + wfi(); > + } > } I think the correct place to put this would be a platform specific driver in drivers/cpuidle/ instead of an added low-level callback in the default idle function and a custom cpu_operations structure. Arnd From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CEC01C433DB for ; Thu, 21 Jan 2021 10:54:12 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 67C5523787 for ; Thu, 21 Jan 2021 10:54:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 67C5523787 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=SYTLmPeS/nONyadqzW+LsiMS4V9WAOgPxnUoeNDXBNw=; b=3ehx67xYfnfUBKYJJAouvkPJs 25Kt4OVELTYDHSW6DOukIMyZCTQEKhf31W2fMTz3KTtmGw/JvAKlWXMk7LiQx1sKwd2+E+uHFIMiZ jB2HHv2bHstQU1YbcTOowg0ShHaorFE4+YpCT5vygGz1FmrYJAl9UBF23myLteaWKrFpkGnP7QQnB qK43aPKepgmQxtwSUJ6Zwhrkqux1i3o2IZ4QAK6XLBP1h0YZQaS6LeoxMNmC1IsWCgm46itd66Anm Yncgd+aRWt2KW/SmRSaGJXQB1Uft5b6JF9O8UcqnxeUnnbLpngpR4gW3AaGTomjIM81NiA+V0TsvQ aL6C4yZKA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2XZq-0000fg-MT; Thu, 21 Jan 2021 10:52:34 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2XZo-0000fM-8B for linux-arm-kernel@lists.infradead.org; Thu, 21 Jan 2021 10:52:32 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id CBAE123888 for ; Thu, 21 Jan 2021 10:52:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611226350; bh=joXsWySRbCpeXgJGWvfjkk3B0A5HawAKQzOPNL63CWI=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=ZgToFo4Z6b3rZGEfKnksUIMOEMU896mS5dkbtosDale+jNDOa4zSMZ0ZTSNiSJVw7 1TkS9aYFpwlpoQJ07MkLeeYPEjIqoLLzcfJ3vsyeOFskCKErUOXvjCUOvFqVznHUdM RJhlYdEAnhf/AoZ9xEAs8a1gy/Ibw6lCRvASJMIUzSCMbbwSJSa/c/jClR4ZrkURjE P+5SgF2QP4anEhglLAxhnGtG0CtvZH9CQIBjN5GVmJs7Fame+e3194mAMZPJ/BbLSz 7GeCgOseuJUBCOJChbLEyV+33vS+eFrfsdEf7c13+HmV8yqD5Km+0ZWDvE0eBuf05y dK4geQLiKIgjw== Received: by mail-ot1-f45.google.com with SMTP id i20so1175717otl.7 for ; Thu, 21 Jan 2021 02:52:30 -0800 (PST) X-Gm-Message-State: AOAM533/+BjDMzBiRZUWmwVdVS8+Y6tsK6K5YOa+dzazzN6AoSJhMp8S XZusKcx+KkCd2TU0VEFlxWq7Sp19zLbxs9fLPcY= X-Google-Smtp-Source: ABdhPJwaHE5gSoHcTUdZ3ZuMwiZ7NxU8/eegCE5gziTqwjhe6YZnkMo10U6Zy2pwRh0EBA+I9+S80KTz3j0JOtmlzQI= X-Received: by 2002:a05:6830:139a:: with SMTP id d26mr9994046otq.305.1611226350006; Thu, 21 Jan 2021 02:52:30 -0800 (PST) MIME-Version: 1.0 References: <20210120132717.395873-1-mohamed.mediouni@caramail.com> <20210120132717.395873-3-mohamed.mediouni@caramail.com> In-Reply-To: <20210120132717.395873-3-mohamed.mediouni@caramail.com> From: Arnd Bergmann Date: Thu, 21 Jan 2021 11:52:13 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH 2/7] arm64: kernel: Add a WFI hook. To: Mohamed Mediouni X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210121_055232_373638_D361D31F X-CRM114-Status: GOOD ( 14.38 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Catalin Marinas , Hector Martin , "linux-kernel@vger.kernel.org" , Marc Zyngier , Will Deacon , Linux ARM , Stan Skowronek Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Jan 20, 2021 at 2:27 PM Mohamed Mediouni wrote: > --- a/arch/arm64/kernel/cpu_ops.c > +++ b/arch/arm64/kernel/cpu_ops.c > #if defined(CONFIG_STACKPROTECTOR) && !defined(CONFIG_STACKPROTECTOR_PER_TASK) > #include > @@ -74,8 +75,14 @@ void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd); > > static void noinstr __cpu_do_idle(void) > { > - dsb(sy); > - wfi(); > + const struct cpu_operations *ops = get_cpu_ops(task_cpu(current)); > + > + if (ops->cpu_wfi) { > + ops->cpu_wfi(); > + } else { > + dsb(sy); > + wfi(); > + } > } I think the correct place to put this would be a platform specific driver in drivers/cpuidle/ instead of an added low-level callback in the default idle function and a custom cpu_operations structure. Arnd _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel