Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp797906ybl; Mon, 2 Dec 2019 18:24:18 -0800 (PST) X-Google-Smtp-Source: APXvYqxy6pwRFEyEaNMJf5JSMT6ySm59fIUe1eAb5ZWF6eVWxul88lYvgkwOB10hFuLQP2keFnL3 X-Received: by 2002:a54:4482:: with SMTP id v2mr1803505oiv.0.1575339858733; Mon, 02 Dec 2019 18:24:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575339858; cv=none; d=google.com; s=arc-20160816; b=TyOojJmDU/ptw1lqW3JIIJ/PRXQfWawOafXfjq1QATvQdAdXvmAKVF4Seay3OI0B/H mhxvI3mjBqEoj18/ThSfUuoCLQPcjjpBo7ObW/JUjtfD9FKtlJ8enruOfW3y3x0isgCT 1WTi3PPhbUERHFXRUNAPxPFjYxAH76krPk15+v2WUze4WrqHs3A8wzblZal+7I8G2myT kB41qM9KgrrIgiAaLh98xURpAsP4MvvkeVgifmWzTx01OK4sRQT942ILAXxcHYf8kfmj yJqOfrzJ6l3x+580HClCzdP7ahWcZ8riC1TTQIuvCsZxf6KN9LbQyuwd2fYInvfGm5tO vu9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=6Cyd6GGcIyBmoLjx8/tOvUA7UNg5H6MsKqglP/D+s0A=; b=fAWtuSgA/rknb/zzE0/Ph63XKmDAgImGpPt3NaAHsrGE6Mlc5yP7L30vSwtvflFavu UH+RWwwmarmGo6NOZK549v/SqV3rNqBvPDx19CWdeFfzcLstY3C9w9IeihWX3OPS7s1z Yl0wqOoGDdxfBw1i++hEjoFoGPgsNiMqm81DsUV+5vgVAwirqYMw8NbQ1dqZmdcVHdfj axNv0KIU1a2l7VddZUJfz6NX7vnbfHyK0xsVpGDGZJ8bRKd6VUuqeuU9y6u54D+uth7E xCUY5q53nxsyX+7EEnf4UO7IJCF6aHIBMxMoZZffpa4STmcO9ZoC7bakBTl6+UQkX5J3 /LFw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d68si561765oib.194.2019.12.02.18.24.06; Mon, 02 Dec 2019 18:24:18 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726214AbfLCCXR (ORCPT + 99 others); Mon, 2 Dec 2019 21:23:17 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:6738 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725954AbfLCCXR (ORCPT ); Mon, 2 Dec 2019 21:23:17 -0500 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id D3460D6C91A6AB2F5720; Tue, 3 Dec 2019 10:23:15 +0800 (CST) Received: from [127.0.0.1] (10.57.71.8) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.439.0; Tue, 3 Dec 2019 10:23:10 +0800 Subject: Re: ITS restore/save state when HCC == 0 To: Marc Zyngier CC: "Guohanjun (Hanjun Guo)" , Yangyingliang , Linuxarm , References: From: Yao HongBo Message-ID: Date: Tue, 3 Dec 2019 10:23:12 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.57.71.8] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/2/2019 9:22 PM, Marc Zyngier wrote: > Hi Yaohongbo, > > In the future, please refrain from sending HTML emails, they > don't render very well and force me to reformat your email > by hand. Sorry. I'll pay attention to this next time. > On 2019-12-02 12:52, yaohongbo wrote: >> Hi, marc. >> >> I met a problem with GIC ITS when I try to power off gic logic in >> suspend. >> >> In hisilicon hip08, the value of GIC_TYPER.HCC is zero, so that >> ITS_FLAGS_SAVE_SUSPEND_STATE will have no chance to be set to 1. > > And that's a good thing. HCC indicates that you have collections that > are backed by registers, and not memory. Which means that once the GIC > is powered off, the state is lost. > >> It goes well for s4, when I simply remove the condition judgement in >> the code. > > What is "s4"? Doing so means you are reprogramming the ITS with mappings > that already exist in the tables, and that is UNPRED territory. Sorry, I didn't describe it clearly. S4 means "suspend to disk". In s4, The its will reinit and malloc an new its address. My expectation is to reprogram the ITS with original mappings. If ITS_FLAGS_SAVE_SUSPEND_STATE is not set, i'll have no chance to use the original its table mappings. What should i do if i want to restore its state with hcc == 0? Thanks, Hongbo. > > Behavior is unpredictable if there are interrupts that are mapped to the > specified collection and the collection is currently mapped to a Redistributor > [...] > > >> --- a/drivers/irqchip/irq-gic-v3-its.c >> >> +++ b/drivers/irqchip/irq-gic-v3-its.c >> >> @@ -3670,8 +3670,8 @@ static int __init its_probe_one(struct resource >> *res, >> >>  ctlr |= GITS_CTLR_ImDe; >> >>  writel_relaxed(ctlr, its->base + GITS_CTLR); >> >> - if (GITS_TYPER_HCC(typer)) >> >> - its->flags |= ITS_FLAGS_SAVE_SUSPEND_STATE; >> >> + its->flags |= ITS_FLAGS_SAVE_SUSPEND_STATE; >> >>  err = its_init_domain(handle, its); >> >>  if (err) >> >> @@ -4005,3 +4005,17 @@ int __init its_init(struct fwnode_handle >> *handle, struct rdists *rdists, >> >>  return 0; >> >> } >> >> Do you have any suggestion for this case? > > The expectations are that across a GIC power-off, the firmware > will restore the state of the GIC (recondiguring the various > memory tables), and that this is enough for the ITS to be > functional again, having reloaded its state from memory. > > Does firmware perform this on your machine? Or are there > implementation-specific issues that require the ITS to be > reprogrammed? > > Thanks, > >         M.