Received: by 10.223.176.5 with SMTP id f5csp1263690wra; Wed, 7 Feb 2018 16:01:59 -0800 (PST) X-Google-Smtp-Source: AH8x225f/NO9CtMeAEhpnH4dyUQNlz2FgJtji2YnBAXa6qtNZbgMWonOrLvKnZnbqrp5vSAaTmTg X-Received: by 10.99.172.2 with SMTP id v2mr946220pge.204.1518048119112; Wed, 07 Feb 2018 16:01:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518048119; cv=none; d=google.com; s=arc-20160816; b=ir9RZwUNy2R3yxbB0qMLOxUWTNUk4uYPae6MT+QPOLdzNi724OmG5zoGLLm8x8WdE3 oQ07ei7L1FYrm8KT67UXcxByMziayAYrWVeKMlr+KH++o18jMuA/VFB+tpwZ2grnUjBg Q1jDNAlouqE5cZbGiP8z/SCf7tuT9s+Vw9fUAQkvtCQe7rNojxCOWvcuNxAmiQhOxMIl 7Hxt1DEllb+jjyHktD/+zguhmzpf4r5WgJNNNcO8ql/pJ77gPyca4G71lMXSxESfMzrR 46wi3fgjqnE67Sutu1RXRe5PWFEMtpQWHyo3eAAP86lyZsGcWCoXqI/rtl3VNQqelR5C ALIg== 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=QejZIezdVWHbtuKCq4SiwApE3L+t4i+r0ZF4wNxxknc=; b=EZJA38+pI+qT+3RhIJ7eAXkmZYqZnsUtgv5WFdu4ZhJKntfkz4nLdx8qvZ829d6X+R lDv9i+tOwSeM2SHgi/NDEVbPz5l0YR5AldDXybzgAB0Zo2IM4GHcpPBdLascVqXlNcVT L6cHPN6QMslik+NkCLa+zMu3NnTTuzpra232PI9ofupnHDTULURLnYGxN4WVJBgMqd8B bXay/aCZYjaZlc5PqrcDCX8wQ3n5aNZP3BE1ZefZW5Nth3bJgcSrowWRgalyvWFGM94e OTSr0yNfCc0o13At8GQDyOOeaBZPeYfjSV7EZ2s7PTszZa+lcVzfKkhbv+mMF7yz+fIl Vwrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@google.com header.s=20161025 header.b=deM1oVnd; dkim=fail header.i=@chromium.org header.s=google header.b=AG9RuUYU; 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 m11-v6si1826030pln.763.2018.02.07.16.01.45; Wed, 07 Feb 2018 16:01:59 -0800 (PST) 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=deM1oVnd; dkim=fail header.i=@chromium.org header.s=google header.b=AG9RuUYU; 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 S1751993AbeBHAA6 (ORCPT + 99 others); Wed, 7 Feb 2018 19:00:58 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:36008 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751756AbeBHAAz (ORCPT ); Wed, 7 Feb 2018 19:00:55 -0500 Received: by mail-wr0-f194.google.com with SMTP id y3so2928120wrh.3 for ; Wed, 07 Feb 2018 16:00:55 -0800 (PST) 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=QejZIezdVWHbtuKCq4SiwApE3L+t4i+r0ZF4wNxxknc=; b=deM1oVndKvlgKwYyvA2R7wAy/O5duZDd0aO8I8Sn74zV+UKl1JE0AMakxu1t3ozeqo BkUcuBneLYma5XRKadcekLer1oUCPJNHkHDX9qQObUXKV4XgqlFdM46R0/OjWH+wptzJ RjXOfJ0ywY6dPjSJDI49Kw8OAHTdhoYNP2IGZ8yduI3bmjvdFDhhuTWqy4y22PT1aZK9 DSZvj7YEg7wejthPmleYpI/UC73uQM0fjFG+RXnxwBlYZ6eIL2gGSgDTm2e9UvIt+rr5 1mvwH5t5CkcOhNgm7Nx52QIGC4wDSA/WEBI1+r+PKjbABG68nDsYRvDLFxJlUy2SmzXM p20w== 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=QejZIezdVWHbtuKCq4SiwApE3L+t4i+r0ZF4wNxxknc=; b=AG9RuUYUgipznhQP0DWBdUMfUvCqc7Kf1wMYeVZHxj1OY8qyGV4wfyPMLYZAm3mIWy sdTYKOe/MEQGCjYbbdoqKVJRPRrdlrpoKwm+NY9ewIWYnwy1WvokhSqzuJ/2SKP5dLPG +VrUSNpXtIKDg55LgeybpCrDG9F0U26IM+Mv8= 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=QejZIezdVWHbtuKCq4SiwApE3L+t4i+r0ZF4wNxxknc=; b=Ekxhc4TUhGfzis3zojJ5cbdLaqLlTCRR6SrvEPlbeIXK1XiZMOVXwlTAD/qwiEwWJQ Npc754MdW1o6t8+rtvslT7X44zSBCxbgYwwyrFS4hGt2gR1iCK//FOqErD/G+EB2+vP3 7tNXlSZ9RjTldXi2eqpnfqZw0wcY3BwuVrzFjSjOZYXx2gt6F7Rgu7PKtrZVynIu1szU zxtZA6DQzOL2QuehKD1bnjQ5cCAuCdUtBmYl+avo4rSlrhGnwq8lWPEfx0qMBUPFkv4D vtPO8eUr/v1251Mf3TyFRbODl6qaFw31wn9XL6qe6XvF/GOw9Rr3/NLe8EFlCNpFG8jG pOyg== X-Gm-Message-State: APf1xPA/aBgZnUr+TFpLnvU/JfMMuIWgbm0jJUo0fcoEnd4omN7iYyFn PDrGeKfLpzF8I0cp2rX8BFpHoJGBYFBxZ0uJZ4Br4/a1 X-Received: by 10.223.178.87 with SMTP id y23mr188978wra.249.1518048054166; Wed, 07 Feb 2018 16:00:54 -0800 (PST) MIME-Version: 1.0 Received: by 10.28.124.6 with HTTP; Wed, 7 Feb 2018 16:00:53 -0800 (PST) In-Reply-To: <20180207232201.GB106856@ban.mtv.corp.google.com> References: <20180207014117.62611-1-dbasehore@chromium.org> <20180207014117.62611-5-dbasehore@chromium.org> <8276f426-e4a0-c400-9f87-31be3d6b1733@arm.com> <20180207232201.GB106856@ban.mtv.corp.google.com> From: "dbasehore ." Date: Wed, 7 Feb 2018 16:00:53 -0800 X-Google-Sender-Auth: yRoVR4itInqSa-NvRrq3aEW2Imk Message-ID: Subject: Re: [PATCH v5 4/4] irqchip/gic-v3-its: add ability to resend MAPC on resume To: Brian Norris Cc: Marc Zyngier , linux-kernel , Soby Mathew , Sudeep Holla , devicetree@vger.kernel.org, robh+dt@kernel.org, Mark Rutland , Linux-pm mailing list , "Wysocki, Rafael J" , Thomas Gleixner 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, Feb 7, 2018 at 3:22 PM, Brian Norris wrote: > Hi Marc, > > I'm really not an expert on this, so take my observations with a large > grain of salt: > > On Wed, Feb 07, 2018 at 08:46:42AM +0000, Marc Zyngier wrote: >> On 07/02/18 01:41, Derek Basehore wrote: >> > This adds functionality to resend the MAPC command to an ITS node on >> > resume. If the ITS is powered down during suspend and the collections >> > are not backed by memory, the ITS will lose that state. This just sets >> > up the known state for the collections after the ITS is restored. >> > >> > This is enabled via the reset-on-suspend flag in the DTS for an ITS >> > that has a non-zero number of collections stored in it. >> > >> > Signed-off-by: Derek Basehore >> > --- >> > drivers/irqchip/irq-gic-v3-its.c | 80 ++++++++++++++++++++------------------ >> > include/linux/irqchip/arm-gic-v3.h | 1 + >> > 2 files changed, 43 insertions(+), 38 deletions(-) >> > >> > diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c >> > index 5e63635e2a7b..dd6cd6e68ed0 100644 >> > --- a/drivers/irqchip/irq-gic-v3-its.c >> > +++ b/drivers/irqchip/irq-gic-v3-its.c >> > @@ -1942,52 +1942,53 @@ static void its_cpu_init_lpis(void) >> > dsb(sy); >> > } >> > >> > -static void its_cpu_init_collection(void) >> > +static void its_cpu_init_collection(struct its_node *its) > > ... > >> > @@ -3127,6 +3128,9 @@ static void its_restore_enable(void) >> > its_write_baser(its, baser, baser->val); >> > } >> > writel_relaxed(its->ctlr_save, base + GITS_CTLR); >> > + >> > + if (GITS_TYPER_HWCOLLCNT(gic_read_typer(base + GITS_TYPER)) > 0) >> > + its_cpu_init_collection(its); >> >> This isn't correct. Think of a system where half the collections are in >> HW, and the other half memory based (nothing in the spec forbids this). >> You must evaluate the CID of each collection and replay the MAPC *only* >> if it falls into the range [0..HCC-1]. The memory-based collections are >> already mapped, and remapping an already mapped collection requires >> extra care (see MAPC and the UNPREDICTABLE behaviour when V=1), so don't >> go there. > > IIUC, this is only run on CPU0 (it's in syscore resume), so implicitly, > CID is 0. Thus, the current condition is already doing what you ask: > > HCC > 0 == CID > > which is equivalent to: > > HCC - 1 >= CID > > Or should we really double check what CPU we're running on? There seems to be the edge case where you hotplug CPU 0 before suspending. In that case, I believe you're on the lowest number CPU left? It seems that all of the CPUs that are disabled have the ITS reinitialized from scratch via enable_nonboot_cpus(). This code runs on only the CPU that firmware resumes with. If that CPU isn't CPU 0 for whatever reason, we need to make sure that it's processor ID is less than HCC. > > Brian