Received: by 10.213.65.68 with SMTP id h4csp1388217imn; Wed, 14 Mar 2018 20:06:06 -0700 (PDT) X-Google-Smtp-Source: AG47ELtjAyzKDJEWlFUaE6piT4LzTcfMDuYZTqNXh3VKknQA6LbKJZbtCr0h3xhJLe4ofaE7KY+S X-Received: by 2002:a17:902:8a89:: with SMTP id p9-v6mr6324558plo.379.1521083166719; Wed, 14 Mar 2018 20:06:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521083166; cv=none; d=google.com; s=arc-20160816; b=pJFe+1BVHi+7Lxqn8WzmSlJBSBGp28HEy+16w5G7NjRHbE9EwQQ72D90+Vvx3orqIT 8u//olRi9BT5RAzL5UkzaqDqXAhBo1+vhmSgi9O2QH81x2UI2mMtAqLAKsb8fwkaKRUB Kbqve1STIR/oEMN/KkELE9/Zs9N7iikLu1W/YrlTwiSSxuTrNOD3P/fSU6zHih8ccniq GI5DmZEU42nD3KekBM2NQsg2CosEKYKiNOoBDSgQHlOL5GSPkl1yAciDPpq2Lod0KeYL gwKeyV1bLTHMOTEzYWHAjQyop1cp7os3tE0nPkd/D2/GK2U49+53wl8S/zj7fD/8w0rm SaKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature:dkim-signature :arc-authentication-results; bh=toIBRIpUVX2synq3NrkMrn4OUM8sjPThqz7fQUtd49w=; b=fwLBlxcBtz5wopiLS+hkIvmmNEMe7xjDy4JNgk0ep5oDG5nYXYdsGAP2eVOP/10MDk vajVF0c0z9ikKmKrI3muB9unoqQjf4nZMcNBa8zSLDSfzhdakMiyo34LiTjQu+ElFpxs KS3GtyQ5PAqspvxaeotMgl+j4rpbGYvESEGu9LcYa7EMH2LSoVRhcNXmHmh34AQBKYjG ToCf+CuUm49uHgylynagkbpi8LwcZVdnW6P/41ZhwLeNJCranFZUZgKWuf72kDl5gxV7 O5w7e1uehWQmyD21Q2Zd/+rt5jLLbhS+9K6xT0n9z3h0XVtjKmAMDVOTJaqORQQHVhk+ OVnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@google.com header.s=20161025 header.b=OZiYzanj; dkim=fail header.i=@chromium.org header.s=google header.b=HEP1WqPc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d6si2818447pgt.558.2018.03.14.20.05.51; Wed, 14 Mar 2018 20:06: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; Authentication-Results: mx.google.com; dkim=fail header.i=@google.com header.s=20161025 header.b=OZiYzanj; dkim=fail header.i=@chromium.org header.s=google header.b=HEP1WqPc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752003AbeCODE7 (ORCPT + 99 others); Wed, 14 Mar 2018 23:04:59 -0400 Received: from mail-wr0-f171.google.com ([209.85.128.171]:37407 "EHLO mail-wr0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751679AbeCODE6 (ORCPT ); Wed, 14 Mar 2018 23:04:58 -0400 Received: by mail-wr0-f171.google.com with SMTP id z12so6764100wrg.4 for ; Wed, 14 Mar 2018 20:04:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=toIBRIpUVX2synq3NrkMrn4OUM8sjPThqz7fQUtd49w=; b=OZiYzanjjetOyiJtd+L5WN4iAgteu97Z5IWT7OzkFEFrdRN/lNsDMJ5LkH+1fTv5fu uBjaPkugZy7UWJCYlGNebr7IlFfRHY0nmqwIXqRF4KZjO8BIGsVfsvLHbc9V074kPwFc Q5pRnto+QgFfH1NyBzNqtyOQ9yrCaO84V9GuRa41kAN46erEVD3XzdzxiiJmCzA2HKJO gYuY4URjJ4vhAMa2c4tcJ5/Whp2EbSKsuJjdGQge7loRISnG5YQYseinQI2r8c6QGasO JNr6cGkLSDwKuPNyErtHJiv44Ggluvl1WJMiUFONc2m1BLgtGh7CvUZZXrzrlPF84sIA UmfQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=toIBRIpUVX2synq3NrkMrn4OUM8sjPThqz7fQUtd49w=; b=HEP1WqPcD5yk+wn5JhU4NLhHMWdgFidhTrxj5H9qr8xrQ8sYxGl4A6mAaYDZTbSCPD JHeD3t7lbEAcaVOJNxgk9at2lkqCLTaFV0MncysYsUsAgUv3GPcZjmgEMqk/pXCe5lqH BAkl34eWXYOVQQ3FPaiw95s8N2CmDZiquhAw8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=toIBRIpUVX2synq3NrkMrn4OUM8sjPThqz7fQUtd49w=; b=dmwJ9lMlU/5fjLLQqu0L1nvzMY9BXJuvB3XB5DTKm2d95alS6AD6udzjXJDfyvekFz fnHYrUl7NMhOWOHNxlwOzOWHYp+AioFAPD5gCDOxS2hIXFK7885rn0NyPuux2LDTqznp WG98302R47hyWUyQllPhEBC8VwXOH8dWSspPoLWtYZfplvtkO86BkKgeAkXUiEn7NrBN mIpjYTRC9xQ+Gd2tsKxTYn4se+RkScgZDq567XIONJKxFkf1YLgtIwqRk1BvhHAUDSkV 4TukRY1L2o9fLVVDcaddCajjpb6wn0ZdYC2A1xoaDiiK1JOEIdW22TXuFcYagqyTdyw5 Lr8A== X-Gm-Message-State: AElRT7FUkEeFtEfvEFp4D9q1yenhJJUsVjtQeAkEQVCs8R4WTSPOucnR fYABcIvDC1gI93b0SWH3tWkmVjHm87db+AY3YB8FTw== X-Received: by 10.223.189.8 with SMTP id j8mr6005819wrh.20.1521083096652; Wed, 14 Mar 2018 20:04:56 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.160.10 with HTTP; Wed, 14 Mar 2018 20:04:55 -0700 (PDT) In-Reply-To: References: <20180301054820.42847-1-dbasehore@chromium.org> <20180301054820.42847-2-dbasehore@chromium.org> <20180301114144.nmwu4qtslvj7ogj5@lakrids.cambridge.arm.com> <0a74f87a-027a-df7d-ca2d-fc164ec9cdf7@arm.com> <6a5b5723-85bb-e46f-f621-eab17a01f1f0@arm.com> From: "dbasehore ." Date: Wed, 14 Mar 2018 20:04:55 -0700 X-Google-Sender-Auth: Ln7ICeMjOI6kBDQIXi-TyuKMwfs Message-ID: Subject: Re: [PATCH v7 1/3] irqchip/gic-v3-its: add ability to save/restore ITS state To: Marc Zyngier Cc: Mark Rutland , linux-kernel , Soby Mathew , Sudeep Holla , devicetree@vger.kernel.org, robh+dt@kernel.org, Linux-pm mailing list , "Wysocki, Rafael J" , Thomas Gleixner , Brian Norris Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 14, 2018 at 2:44 PM, dbasehore . wrote: > On Wed, Mar 14, 2018 at 3:22 AM, Marc Zyngier wrote: >> On 02/03/18 02:08, dbasehore . wrote: >>> On Thu, Mar 1, 2018 at 4:29 AM, Marc Zyngier wrote: >>>> Hi Mark, >>>> >>>> On 01/03/18 11:41, Mark Rutland wrote: >>>>> On Wed, Feb 28, 2018 at 09:48:18PM -0800, Derek Basehore wrote: >>>>>> Some platforms power off GIC logic in suspend, so we need to >>>>>> save/restore state. The distributor and redistributor registers need >>>>>> to be handled in platform code due to access permissions on those >>>>>> registers, but the ITS registers can be restored in the kernel. >>>>>> >>>>>> Signed-off-by: Derek Basehore >>>>> >>>>> How much state do we have to save/restore? >>>>> >>>>> Given we can apparently read all this state, couldn't we *always* save >>>>> the state, then upon resume detect if the state has been lost, restoring >>>>> it if so? >>>>> >>>>> That way, we don't need a property in FW tables for DT or ACPI. >>>> >>>> That's a good point. I guess that we could just compare the saved >>>> GITS_CTLR register and restore the full state only if the ITS comes back >>>> as disabled. >>>> >>>> I'm just a bit worried that it makes it an implicit convention between >>>> kernel an FW, which could change in funny ways. Importantly, the PSCI >>>> spec says states FW should restore *the whole state*. Obviously, it >>>> cannot to that on HW that doesn't allow you to read out the state, hence >>>> the DT flag that outlines the departure from the expected behaviour. >>>> >>>> I'm happy to go either way, but then I have the feeling that we should >>>> go back to quirking it on the actual implementation (GIC500 in this >>>> case) if we're to from the property. >>>> >>>>> >>>>> [...] >>>>> >>>>>> @@ -3261,6 +3363,9 @@ static int __init its_probe_one(struct resource *res, >>>>>> ctlr |= GITS_CTLR_ImDe; >>>>>> writel_relaxed(ctlr, its->base + GITS_CTLR); >>>>>> >>>>>> + if (fwnode_property_present(handle, "reset-on-suspend")) >>>>>> + its->flags |= ITS_FLAGS_SAVE_SUSPEND_STATE; >>>>> >>>>> Does this allow this property on an ACPI system? >>>>> >>>>> If we need this on ACPI, we need a spec update to handle this properly, >>>>> and shouldn't use device properties like this. >>>> >>>> Well spotted. I guess that dropping the property would fix that >>>> altogether, assuming we feel that the above is safe enough. >>>> >>>> Thoughts? >>> >>> I'm fine changing it to get rid of the devicetree property. >>> >>> What's the reason for quirking the behavior though? It's not that much >>> code + data and nothing else relies on the state of the ITS getting >>> disabled across suspend/resume. Even if something did, we'd have to >>> resolve it with this feature anyways. >> >> The reason we do this is to cope with GIC500 having the collection state >> in registers instead of memory. If we didn't have this extraordinary >> misfeature, FW could do a full save/restore of the ITS, and we wouldn't >> have to do anything (which is what the driver currently expects). >> >> A middle ground approach is to limit the feature to systems where >> GITS_TYPER.HCC is non-zero instead of limiting it to GIC500. Pretty easy >> to fix. This should have the same effect, as GIC500 is the only >> implementation I'm aware of with HCC!=0. >> >> Given that we're already at -rc5 and that I'd like to queue things for >> 4.17, I've made this change myself and queued patches 1 and 3 here[1]. >> >> Can you please have a look at let me know if that works for you? >> > > Assuming that your fine with only having the GIC500 implementations > that have HCC as non-zero getting ITS registers restored in the > kernel. As far as I can tell, this can happen in firmware for all > implementations. It's only the code to resend that MAPC on resume that > needs to be in the kernel. Actually, I guess we can't tell if we need to resend MAPC on resume if the firmware restores the state. Assuming it's a problem to just resend MAPC all the time, only restoring the ITS registers in the kernel when HCC != 0 makes sense. > >> Thanks, >> >> M. >> >> [1] git://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git >> irq/irqchip-next >> -- >> Jazz is not dead. It just smells funny...