Received: by 10.223.176.46 with SMTP id f43csp2774818wra; Thu, 25 Jan 2018 15:08:06 -0800 (PST) X-Google-Smtp-Source: AH8x225w3zgwxTLiGa5IUwXXys863Abny/YotugnjMyIsqg3+MoGVgs8/i78O+9NuXsP++wSzl9P X-Received: by 2002:a17:902:261:: with SMTP id 88-v6mr13179908plc.384.1516921686307; Thu, 25 Jan 2018 15:08:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516921686; cv=none; d=google.com; s=arc-20160816; b=KVPNzO/hbrvbHNp0iwosSq0EUwf7gU+T3+VeB/UK4T/8gN2qfa3L5KLQ/JnyHL4wMW jJDkFishVw6PqsA9iABTbUkPVTPjf0yfm1cvERBv2M3Elk6sIhufPa0szc6xW1kKXIqQ FRh2ci2GwEE8p6mAMBXHj8VWFfXCJMSBwMMh9IO5eDomZcznALVYQue8410HC736IVUC Raoi8d1Ntbg6CaRuGEor8S1iODXZutHUur1HgmGBPbs4EVrqLMHvumfeOSZL+mS18sJI P3rQ2+PuL7abgIHfsgkhvbX+G9bVQ2nbjJjXOmy21Y9pAXOLCLeBlp56tB/ZzuZLhUcL DMyw== 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=tk5xue9+Tsq/d73Gx9Qm7Wjxc+Nq1v0cMiJjnxhndQc=; b=aQEkp4B4ySdrzzkBiHqqYN62xc5/51rOZLEuRweM2bspAjWXgWUD+PSmydvYum6VVx gP4VXoy7Q0oTzPGSQBIQ+o4OFDSYoiExiSn/jMoT1ryh2v8U6KlxX5plxua24RO3NW3t 6Sq6y+0H37y8TJz73uL9qnZ0Y2G+GEA6cTYibO0gh42+l6TqhuyD1qBOJOHCzJrZbUdR TD995LP3Ek/6wbIxhyP9vUkFum/Ew0M+aEI2yvQ9aj6nlUAJwhB0guNw1C+rBmcRdR/K ra3lqiDgqUwyXv6a3yr1HCaAaEFbV2BHJWJ6J3sZndlbeO4D57pOsKtSr+9aowThdXPN CPAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@google.com header.s=20161025 header.b=ZWNRB0br; dkim=fail header.i=@chromium.org header.s=google header.b=jw3NZpdp; 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 s82si5297812pfg.317.2018.01.25.15.07.51; Thu, 25 Jan 2018 15:08:06 -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=ZWNRB0br; dkim=fail header.i=@chromium.org header.s=google header.b=jw3NZpdp; 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 S1751565AbeAYXHV (ORCPT + 99 others); Thu, 25 Jan 2018 18:07:21 -0500 Received: from mail-wr0-f195.google.com ([209.85.128.195]:35477 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751535AbeAYXHR (ORCPT ); Thu, 25 Jan 2018 18:07:17 -0500 Received: by mail-wr0-f195.google.com with SMTP id w50so3780137wrc.2 for ; Thu, 25 Jan 2018 15:07:17 -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=tk5xue9+Tsq/d73Gx9Qm7Wjxc+Nq1v0cMiJjnxhndQc=; b=ZWNRB0brgJE1d/FjXD6yPJOIZj8hJ4Tn3BK/Rq6no9EQ2cXaHk2Z2TisXjrtSDSqsl iWa347NVxUe81ION33UnSmHnn8jEjrgZZYteETirQlfZUsG6bM+vJ8zIo7fgSmv3PIcO c7Iu71C8YfPqSkRKT132l1xNZ8MOJtu5x4Si4tE0AZWbo3UTpTxmM0ZWNwjrIsdbASb7 wzL2UEEWn/DeZDoJnFIkj+N3ATa9Ze325/uImrr2PuIzcAkhr5r0k+zFCh95XqFNRa9n HX8ECksRHrtiReixbFM2XVSWqL0+5wajSM/RyU8dnFELajgaj0+PDBTByj3ntE6FPa+f a7Eg== 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=tk5xue9+Tsq/d73Gx9Qm7Wjxc+Nq1v0cMiJjnxhndQc=; b=jw3NZpdpiiJS7pVTYlImG+dWwddT/uUstIjOLANArSyBYcq/mHqnrI7yZEiGurWqJ5 4f/2oCLmgp+jopTPTdadtvaKWJv1RaUIgHyDhfo1yBKPsxsuz/PjxqEPRtnVyAfr8VVl mHgpAbrUICdt29gue99uQjito5/eFWUvw2mI4= 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=tk5xue9+Tsq/d73Gx9Qm7Wjxc+Nq1v0cMiJjnxhndQc=; b=aly5BOCK9lnMQuibeJ0Jfrmm3StBNV8UeCRwAiagUZuWQ16SSPRizxwVtxVk9zCfAI B2px8CaXyb6phiCzT9avUigHI6fwxJzgvVXbTAmJm4uIrUxQsYF7VZ0ChFXk88BEjoGY rar++V02YrSQ1v4Jsj8B4Wq9RDz0zYEeTKpijWUQOcs870kjSR8KNHkNKFmTIO3C9Bze BHvcImdReQ6I3qplsC213BfobyuP9cO6AfeRny/mqEnD6/en0qPfnGG3E5NC85stHTfo 30BVgLXmufOVFE6HXFOp9lRzm5l87Au3yfNEPgMD4tEzgAVEd5pVso2hQ2IRXCSh1ijj +7Dw== X-Gm-Message-State: AKwxytfHuoG2dPMYA8Hp2uowpM2AcZinZ0py2yUK4QM83V6f3Tfa1PIN 7kckgYN7JIWliOOFQH8Mznd6Rw8awK+Y6QZF1AXwzw== X-Received: by 10.223.150.172 with SMTP id u41mr10017604wrb.193.1516921636175; Thu, 25 Jan 2018 15:07:16 -0800 (PST) MIME-Version: 1.0 Received: by 10.28.124.6 with HTTP; Thu, 25 Jan 2018 15:07:15 -0800 (PST) In-Reply-To: <86d12cg13b.wl-marc.zyngier@arm.com> References: <20180112212422.148625-1-dbasehore@chromium.org> <20180112212422.148625-7-dbasehore@chromium.org> <86d12cg13b.wl-marc.zyngier@arm.com> From: "dbasehore ." Date: Thu, 25 Jan 2018 15:07:15 -0800 X-Google-Sender-Auth: D_9H8_tdf_wZdw3LcLo8VGFBMMQ Message-ID: Subject: Re: [PATCH 6/8] irqchip/gic-v3-its: add ability to resend MAPC on resume To: Marc Zyngier Cc: linux-kernel , 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 Sun, Jan 14, 2018 at 2:56 AM, Marc Zyngier wrote: > On Fri, 12 Jan 2018 21:24:20 +0000, > Derek Basehore wrote: >> >> This adds a DT-binding to resend the MAPC command to an ITS node on > > This isn't a DT binding. That's the driver implementation. The binding > is what you put in Documentation/device-tree... > >> 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. >> >> Change-Id: I4fe7f3f16500e1d3b14368262f03a43509c0049b >> Signed-off-by: Derek Basehore >> --- >> drivers/irqchip/irq-gic-v3-its.c | 85 ++++++++++++++++++++++------------------ >> 1 file changed, 47 insertions(+), 38 deletions(-) >> >> diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c >> index 5cb808e3d0bf..6d2688a2ee67 100644 >> --- a/drivers/irqchip/irq-gic-v3-its.c >> +++ b/drivers/irqchip/irq-gic-v3-its.c >> @@ -46,6 +46,7 @@ >> #define ITS_FLAGS_CMDQ_NEEDS_FLUSHING (1ULL << 0) >> #define ITS_FLAGS_WORKAROUND_CAVIUM_22375 (1ULL << 1) >> #define ITS_FLAGS_WORKAROUND_CAVIUM_23144 (1ULL << 2) >> +#define ITS_FLAGS_RESEND_MAPC_ON_RESUME (1ULL << 3) >> >> #define RDIST_FLAGS_PROPBASE_NEEDS_FLUSHING (1 << 0) >> >> @@ -1949,52 +1950,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) >> { >> - struct its_node *its; >> - int cpu; >> - >> - spin_lock(&its_lock); >> - cpu = smp_processor_id(); >> - >> - list_for_each_entry(its, &its_nodes, entry) { >> - u64 target; >> + int cpu = smp_processor_id(); >> + u64 target; >> >> - /* avoid cross node collections and its mapping */ >> - if (its->flags & ITS_FLAGS_WORKAROUND_CAVIUM_23144) { >> - struct device_node *cpu_node; >> + /* avoid cross node collections and its mapping */ >> + if (its->flags & ITS_FLAGS_WORKAROUND_CAVIUM_23144) { >> + struct device_node *cpu_node; >> >> - cpu_node = of_get_cpu_node(cpu, NULL); >> - if (its->numa_node != NUMA_NO_NODE && >> - its->numa_node != of_node_to_nid(cpu_node)) >> - continue; >> - } >> + cpu_node = of_get_cpu_node(cpu, NULL); >> + if (its->numa_node != NUMA_NO_NODE && >> + its->numa_node != of_node_to_nid(cpu_node)) >> + return; >> + } >> >> + /* >> + * We now have to bind each collection to its target >> + * redistributor. >> + */ >> + if (gic_read_typer(its->base + GITS_TYPER) & GITS_TYPER_PTA) { >> /* >> - * We now have to bind each collection to its target >> + * This ITS wants the physical address of the >> * redistributor. >> */ >> - if (gic_read_typer(its->base + GITS_TYPER) & GITS_TYPER_PTA) { >> - /* >> - * This ITS wants the physical address of the >> - * redistributor. >> - */ >> - target = gic_data_rdist()->phys_base; >> - } else { >> - /* >> - * This ITS wants a linear CPU number. >> - */ >> - target = gic_read_typer(gic_data_rdist_rd_base() + GICR_TYPER); >> - target = GICR_TYPER_CPU_NUMBER(target) << 16; >> - } >> + target = gic_data_rdist()->phys_base; >> + } else { >> + /* This ITS wants a linear CPU number. */ >> + target = gic_read_typer(gic_data_rdist_rd_base() + GICR_TYPER); >> + target = GICR_TYPER_CPU_NUMBER(target) << 16; >> + } >> >> - /* Perform collection mapping */ >> - its->collections[cpu].target_address = target; >> - its->collections[cpu].col_id = cpu; >> + /* Perform collection mapping */ >> + its->collections[cpu].target_address = target; >> + its->collections[cpu].col_id = cpu; >> >> - its_send_mapc(its, &its->collections[cpu], 1); >> - its_send_invall(its, &its->collections[cpu]); >> - } >> + its_send_mapc(its, &its->collections[cpu], 1); >> + its_send_invall(its, &its->collections[cpu]); >> +} >> + >> +static void its_cpu_init_collections(void) >> +{ >> + struct its_node *its; >> + >> + spin_lock(&its_lock); >> + >> + list_for_each_entry(its, &its_nodes, entry) >> + its_cpu_init_collection(its); >> >> spin_unlock(&its_lock); >> } >> @@ -3089,6 +3091,9 @@ void its_restore_enable(void) >> its_write_baser(its, &its->tables[i], >> its->tables[i].val); >> writel_relaxed(ctx->ctlr, base + GITS_CTLR); >> + >> + if (its->flags & ITS_FLAGS_RESEND_MAPC_ON_RESUME) >> + its_cpu_init_collection(its); >> } >> spin_unlock(&its_lock); >> } >> @@ -3312,6 +3317,10 @@ static int __init its_probe_one(struct resource *res, >> ctlr |= GITS_CTLR_ImDe; >> writel_relaxed(ctlr, its->base + GITS_CTLR); >> >> + if (fwnode_property_present(its->fwnode_handle, >> + "resend-mapc-on-resume")) >> + its->flags |= ITS_FLAGS_RESEND_MAPC_ON_RESUME; > > This function is firmware agnostic, and I really don't want to make > this thing a general purpose property. > > Please set this as a quirk when you detect some particular combination > of HW and firmware (in your case, GIC500 + this property). And again, > the property name is totally backward. IT should be something like > "collection-state-lost-on-suspend". So name it ITS_FLAGS_WORKAROUND_GIC500_MAPC or should there be a quirk number for it? > >> + >> err = its_init_domain(handle, its); >> if (err) >> goto out_free_tables; >> @@ -3347,7 +3356,7 @@ int its_cpu_init(void) >> return -ENXIO; >> } >> its_cpu_init_lpis(); >> - its_cpu_init_collection(); >> + its_cpu_init_collections(); >> } >> >> return 0; >> -- >> 2.16.0.rc1.238.g530d649a79-goog >> > > Thanks, > > M.