Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp185088pxb; Thu, 21 Jan 2021 04:49:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJyGw63Z3VP0vTpYRXf6YP2JtiqSSPzD6mG68OFmEqkHERamwKm6XasT5buJbi1O493rHivT X-Received: by 2002:a17:907:9716:: with SMTP id jg22mr9453180ejc.126.1611233372938; Thu, 21 Jan 2021 04:49:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611233372; cv=none; d=google.com; s=arc-20160816; b=x4/9XuyDxMwT2eDnHjgprolw9PNKbL5fAzRvab+exqLU3Vu0nC202NTubievRteUOm 2yBIp282jsogngkGroyOhIABJz58oOX1nAuVE8MEz6DjynTMeMobfc8my7z4uN/RXksF 1P2k72ngASK1DVjeWOL8EWYlA2yt8TxetRFNga9jBonYNRNcsnMRfhEDO8SxbNV3Zi3T 04l1l9mCzDMyl1nEXMFUwCAIaQkDpJsjY5x57f/kt8wMkXJ2dA9udAfZU07JiNluBZVP nT3SD8iEGFmwlTmV1SjUs4MzdgIAs6siOMVVAycY1CCPEHNdmx//n9lRdQSk3L5oPjdZ WNJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:subject:from :references:cc:to; bh=KFpSDn90hGHtPr6sKoP28y+zbnRgRT8damA6CTR6cKw=; b=g+FYpUemcpXg+J54pTw6+sVzvBzF0eZZ/sjqH4Lnz66CVJmF8aoJsXXPw3F9Lg59wY DswEvP/777tH7uUGc+rFLJyROzko3jrOTHb9z8JqgSwujwjiaXuvkXJEAWdNrAZMGfPn h6o1M3gpdR3fTpRspfnKgB13HYlUW6BI9R9VXOoMqhsC+HSQi9KnQ6lmwwBkkCeeyr3y eztTvP2Po/Z37v5Ce97oN/ZQuHk5SZWTornWj94snqpnOdkz8x82RNmvMI0DjAA4DWwO SExJxnU5tXiIf/7K1S992A0GIAkvrTun2svUKFc9CR/bhHltoNHPdN9eRb71/FCs9QR7 CarQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v25si2062216edt.63.2021.01.21.04.49.09; Thu, 21 Jan 2021 04:49:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730652AbhAUMr2 (ORCPT + 99 others); Thu, 21 Jan 2021 07:47:28 -0500 Received: from marcansoft.com ([212.63.210.85]:41290 "EHLO mail.marcansoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731345AbhAUMpd (ORCPT ); Thu, 21 Jan 2021 07:45:33 -0500 X-Greylist: delayed 632 seconds by postgrey-1.27 at vger.kernel.org; Thu, 21 Jan 2021 07:45:31 EST Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: marcan@marcan.st) by mail.marcansoft.com (Postfix) with ESMTPSA id 5D94441F12; Thu, 21 Jan 2021 12:33:49 +0000 (UTC) To: Mohamed Mediouni , Alexander Graf Cc: linux-arm-kernel@lists.infradead.org, Catalin Marinas , Will Deacon , Mark Rutland , Marc Zyngier , linux-kernel@vger.kernel.org, Stan Skowronek References: <20210120132717.395873-1-mohamed.mediouni@caramail.com> <20210120132717.395873-3-mohamed.mediouni@caramail.com> <94C20F55-D3B8-4349-B26F-9EA8AAEBF639@caramail.com> From: Hector Martin 'marcan' Subject: Re: [RFC PATCH 2/7] arm64: kernel: Add a WFI hook. Message-ID: Date: Thu, 21 Jan 2021 21:33:46 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <94C20F55-D3B8-4349-B26F-9EA8AAEBF639@caramail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: es-ES Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I already mentioned this privately, but for the benefit of the ML: On 21/01/2021 09.48, Mohamed Mediouni wrote: > If we explicitly use the hardware override registers for this, then > we'll be unable to use the deep sleep support provided by wfi on > Apple SoCs later on without touching Apple-specific MSRs. > > Our current policy is to avoid having those modified inside the kernel > at all costs, considering it to be a job for the bootloader instead. I don't think there is any particular reason to do this; the bootloader should be responsible for setting up all the chicken bits that make the CPU work properly, including doing so for all SMP cores before entering the kernel, but that's not the same thing as power management bits. It seems entirely reasonable to me to configure WFI as clockgate only (so it keeps state), not touch this part of kernel code at all, and then in the cpuidle driver (which can come later) just do: - switch to powerdown mode - save state - wfi - restore state - switch to clockgate mode -- Hector Martin "marcan" (marcan@marcan.st) Public Key: https://mrcn.st/pub