Received: by 10.213.65.68 with SMTP id h4csp1261724imn; Wed, 14 Mar 2018 14:47:06 -0700 (PDT) X-Google-Smtp-Source: AG47ELvaj65ImGIoG0rG5tvTcRyP3LqimCyK4aHjG7LmUYRBa+ZyKSpoX/0Y6+fzgnk9Hqe+qrvn X-Received: by 10.101.65.5 with SMTP id w5mr4945762pgp.214.1521064026317; Wed, 14 Mar 2018 14:47:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521064026; cv=none; d=google.com; s=arc-20160816; b=PiBgB6Prj5YPzn+q0ZpycYNHO4MT7Klkes1a1O69896r9C+AjjpbUWZihQuYXdpED3 SNGZvlYDTKEEWiuQxsCWrZ/VwCm8nKA+sYMkCkHvS7wjbRtwGkbueDajIEnbJ4Ypu7gm si62ndYoNjAYgnqya/TwgaU8CBQa1Vm7YwFFC8vRhF4an2XnCjgTnj4g/kOsZUWGXYhz KqARavYWEEA71vE17DlLahvPi9yuYdwUm177PFiCbyqmdwgcGXaMAKXErkRyW5h4ciRD +YcjOysewZtLG/uQGjWm9c6BsIoJDvsfc4zw7YAdHyut+F/Tw5J9d+YLRXWGFvxHED+j 9LJw== 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=FKkRBusEkM2FEkiOlxdJhye8N0ZRzkwZH9NuVZ+7ddo=; b=IlOuPKM+dBc5EEd5OT8mP5plXq/4uWDv6uP7zl9/Vzn/zSnwLuDQRzk/8F44PiR0zZ vGDi73MHH+7NVE3AomPmqfi2Zo+/QcSPNCntNJgUGHsnuCTyFilXHqGm0R9MIECukd+D JGqxwsMC8aRdnJ5T7XtYBcoYyU63G8ZtrFmy2iRHP4Yhw7bZY26TjyCmG12d//OyVgSw SQo8QXbwlhk2WXCN5kB6JypyikxGpbEdCpWxlFiXKlL2p8DKVROECFRHV0BLnBzbWoBj wOSrWmItxA1AKKr1lZuHZcGQAjFVT7fIumL0T4qDAneGdSwbu2I1Wutk7tSJ2xgM5w7p dGhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@google.com header.s=20161025 header.b=KHuaN3XV; dkim=fail header.i=@chromium.org header.s=google header.b=E8Bb4FqP; 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 y16-v6si647994plr.174.2018.03.14.14.46.51; Wed, 14 Mar 2018 14:47: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=KHuaN3XV; dkim=fail header.i=@chromium.org header.s=google header.b=E8Bb4FqP; 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 S1752065AbeCNVpH (ORCPT + 99 others); Wed, 14 Mar 2018 17:45:07 -0400 Received: from mail-wr0-f177.google.com ([209.85.128.177]:37931 "EHLO mail-wr0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751957AbeCNVpA (ORCPT ); Wed, 14 Mar 2018 17:45:00 -0400 Received: by mail-wr0-f177.google.com with SMTP id l8so6260543wrg.5 for ; Wed, 14 Mar 2018 14:44:59 -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=FKkRBusEkM2FEkiOlxdJhye8N0ZRzkwZH9NuVZ+7ddo=; b=KHuaN3XVNZj4jvRpoLc9OwtcA5dAD+hQnFuz9yW0X5XQMkiXNxMCoc8Q8lD0ArmVwr /aG5J+X3GFOC0evjnyYIuZFUJhcwPdiwiyS201Ik76asQ2mB8AGaX8GzH73FAO0YTuli EhIY75YBa6zvh14JqcbWF6UG/M5zTpU4awEbg+J0tZ6d/GlvE2D/TlVGt8wU3JvQ7nBb YP4FBGpyhklKs0Ltx4hXU9BrGODtvJ+CsuOp16jRU39tr2c3vDA4PCC3rbnnYGK9OIwD DUXicL8jhPHzFcsUANcOll0WjdZM3DKF3CpMgVcpd7FFIZSFTzOEXEPiHrZgsu7bGm/p fTLw== 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=FKkRBusEkM2FEkiOlxdJhye8N0ZRzkwZH9NuVZ+7ddo=; b=E8Bb4FqPiR6ZyGZBh9wP3YEEvZJDG6n3lG0xnvhRmk5JAOrPenpALBbp4jZecpIij6 3ZfR3l/dfmU0vS+XQEq4B2N4MEHSYSCNP9NPjBn3vQ0J5dYcrLDPhP8pYK2l6MOXLQ4I A8f+PpGdtbdMm5RU5tuR+5hAqRZGCDnRZ500o= 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=FKkRBusEkM2FEkiOlxdJhye8N0ZRzkwZH9NuVZ+7ddo=; b=nwAeyE2wRXDhSU6EGs5nKaBjR6rv4hI5t7WHYAOQlwi2z/V/UGgWC1u4b3KC+a/jmP 5KOy36+L8BdJcRvaZTUjgWqUdeVkZm5netoc+pTDt3XRfu8tbLI5UUBzjDeoWlVe1wcL 2u5gMFqjC9HS4Puk/7tDDHfjTkHqfMLJaLGObnUG3+NETat9iq6QsmRh1uiB2vD3Foww N39U09ZuXo+E0YiCz19BXjldWlrJeRn/vTYNyPOqF6YZXRaSw+igS0gXArKm7ce9wn1z QQCb43LoIMhaWAy5HPIFsEgFDBmfQx68mJadd6SFFl6cbenG7XzmaCJO7aErm0dFHzJR yqfQ== X-Gm-Message-State: AElRT7EVMLI/B9RDLzSCn/OCKbMUmBSEUrxwAlhCwf6GGE6J6fyAY5RA v2uWrY7dLtK7G5Km8cJi2YNWWpLc51w93EPvv3qJ1Gcj X-Received: by 10.223.139.68 with SMTP id v4mr5332153wra.23.1521063898216; Wed, 14 Mar 2018 14:44:58 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.160.10 with HTTP; Wed, 14 Mar 2018 14:44:57 -0700 (PDT) In-Reply-To: <6a5b5723-85bb-e46f-f621-eab17a01f1f0@arm.com> 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 14:44:57 -0700 X-Google-Sender-Auth: AbTAGKdWC9FdfPwzoI9lvovgSQc 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 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. > 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...