Received: by 10.223.176.5 with SMTP id f5csp1234560wra; Wed, 7 Feb 2018 15:22:57 -0800 (PST) X-Google-Smtp-Source: AH8x225jW8dCbvES96lm/CL6tKdlkBJFvgOc7CQEOLBxV4KZsf8L9DHvydk/jxEwTHiwzWMwZ7xX X-Received: by 10.99.176.69 with SMTP id z5mr6017944pgo.74.1518045777536; Wed, 07 Feb 2018 15:22:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518045777; cv=none; d=google.com; s=arc-20160816; b=jtDP3jW23xfYRsyWCY5CzcsBIC4SY3dv21ET+YUWeW1xq/wnNL7itHSgF5BgQcCXn5 P2qRHykNvKI5+NHoYG6r2lSZM9ndwYX88+E+UN8I9VR+Q3baX6kRxdxw3zpQsDGyFuKJ sm56H6/xaIgFAxCEg0pNRNFcRiP2lYY50lpFF3S1TGfqLGS/QkTbUOYoq9bJyzFXq/41 DxBXTJtmWjrkH/r3HVQ1ouj2WEXX3Z6womxRZ+A2dN64SJJMSIXdw3eLVV2mMYZgh1XS DLor0/2Lt4b8oyveQHCaPMGXfYlbc9t0QDstiaf8CgMdNWi1Pg1V5nXy8y5z9hK4gP1L fgRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=9uac5A4DAYMOm1PWqHtxdk6j63K1dhy+4MTLmrvebVM=; b=Rsh341UlMshaobTVp/8K0Gc0OwFzUxOQ5br/NTl/lw7BPnaLHk/9aJa89PhoVWwGQz fjHl3TSqSC+H77SWDlr0gIcj4Z7uGhVtI2mVrzTyEXQf7MozfXGR6ckOsSWIpI1HNNpM 41qH55HLrU6c5dbuoCgraM1W7NvktaP8l5iu8LFG8VmEb+kmEklX7kq058UtYPvAcUcC 3katxnz9rwvpRo5hsNHcMwpxwyFFTs5o5uKLyyegeLwu+mCwugor4mlIbrs/QXivshMx cwyGEzSsGjh2NKPWFhqSiWYbBNv7IooptYG65CHSCqYNEHAw4jL8P6jaswGV6QCMDFhp aZkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=K4q18Evf; 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=pass (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 x3-v6si1792787plr.586.2018.02.07.15.22.43; Wed, 07 Feb 2018 15:22:57 -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=pass header.i=@chromium.org header.s=google header.b=K4q18Evf; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751396AbeBGXWI (ORCPT + 99 others); Wed, 7 Feb 2018 18:22:08 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:36414 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750806AbeBGXWG (ORCPT ); Wed, 7 Feb 2018 18:22:06 -0500 Received: by mail-pg0-f67.google.com with SMTP id x25so926673pge.3 for ; Wed, 07 Feb 2018 15:22:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=9uac5A4DAYMOm1PWqHtxdk6j63K1dhy+4MTLmrvebVM=; b=K4q18EvfyNQaM4f4kDzugNSir71rAFvSyKktVGQIYNv6CgbS5SRjh5zmLZ6UgIvtVD 2V22A0fyOnsi7KyQJacoOVyRtSwQD7KABafsAo0j7cvdxfH88QfQ4YgtEQyNsMbJGf9D hvjeGhw9ZKHoHBIZMFaaAs/gOuYTXHGzjzUIw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=9uac5A4DAYMOm1PWqHtxdk6j63K1dhy+4MTLmrvebVM=; b=Kk53ZIGy2bL1auFVPfgOWuyH8dc2Gk4chl10H7hcPMBnBnKaxJohLKa7AtqIdLDJqG X1/hEG5C5hatMIQK8rT7GK2GDAI37tS01SHAzu9Fr0LKwooQEu3GjLhaAjCwtkY34cz3 5gufLirEw3EEPSpPXlOHeqIz8tl9/k4Vd21p/zPhz7CKaTJC8lyCJEXLghmjgUtwVY9h icdFHtmpGPDv6mayNpWhfdQ21fd3PdzeyBa72zgcTPzbphCeQ0I45dQWGrDweq8gKHFE 5el8xq68fZ4FRULFljR1PqEmTllr/ZaJePnq5Ek0PXV3iZGvVXPCX80N3JmIwKoczXUj l30g== X-Gm-Message-State: APf1xPAvL34GwEqLt662VqoJTQwTFm0ZF8ekgrSw4RZYo/hQiIjC1dXi ld4RhEbXTF8p0Ua1i/GQKSN2mA== X-Received: by 10.98.227.8 with SMTP id g8mr6075715pfh.200.1518045725626; Wed, 07 Feb 2018 15:22:05 -0800 (PST) Received: from ban.mtv.corp.google.com ([172.22.113.17]) by smtp.gmail.com with ESMTPSA id o62sm6232207pfk.177.2018.02.07.15.22.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 07 Feb 2018 15:22:05 -0800 (PST) Date: Wed, 7 Feb 2018 15:22:02 -0800 From: Brian Norris To: Marc Zyngier Cc: Derek Basehore , linux-kernel@vger.kernel.org, Soby.Mathew@arm.com, sudeep.holla@arm.com, devicetree@vger.kernel.org, robh+dt@kernel.org, mark.rutland@arm.com, linux-pm@vger.kernel.org, rafael.j.wysocki@intel.com, tglx@linutronix.de Subject: Re: [PATCH v5 4/4] irqchip/gic-v3-its: add ability to resend MAPC on resume Message-ID: <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8276f426-e4a0-c400-9f87-31be3d6b1733@arm.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? Brian