Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3206229imu; Thu, 29 Nov 2018 17:58:28 -0800 (PST) X-Google-Smtp-Source: AFSGD/VYxbP7b58QQgOHYTZc1yui5BpDz7d3yRRF9vCceEagp4+ChGpwmQdWIn9Z4ymP8VNuCJZd X-Received: by 2002:a63:3d03:: with SMTP id k3mr3239699pga.191.1543543108534; Thu, 29 Nov 2018 17:58:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543543108; cv=none; d=google.com; s=arc-20160816; b=vOCJS261b2iyXs8iGlJOIBQ3ihRhi9yxcV7+9acCr4Mtx1Zrf+zCWzPnswE9i2OHtZ 4ZVlpc58EuVPEYN6i8wAkRY+eE+K+DsFMEHnm2vt01F8XQ6GePyDpwCJq7vi5bssd5SP rcGT5580VvREa9A1DK6ANEdNHRPd/1GH+DZT0TU4cjuCxF5aboVsA1OcT7y0sigZcYlX 4PX/GybvCS5X8WG6q91t3eTQ8A1S8aCv5suJSonWhuT9+Fzj+N6K63bMwLp1boqW9IQ8 S34bBEM2Nc1ROodaHBsBB68M5oGeMtEBHtmf/g8nZBYC4OmZ0RJG2GT1mu6c8yq7ja/r aICQ== 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:dkim-signature; bh=WBsRc26AhxP364RvHJwB1J18+bS1A9ewnkSWZ8WupWs=; b=a79vnK8+Q7855pRfgYGHXClQg8aSurucZwLyDNPpbwhFz6sLuEiZghsRilfSOAu41L m4Ou1e6ckMO0Bc5TDvo+4xBcOd9WrMBxYvw/c0TgtxwTCtW4NG1xyzc9BJaQgPUSBVgw qRAlDi3RM5y3K3KquovuH3ogm/KhV2rJKcqLEIaj560hQoyqYAYMa+X+060JdeqnhaOk sU1ZpBS9a0lsZ6W0gr0f2KmeaRsMYY7m5Xjy1g83OAxzjEkKNo3UdS6msrIx46yvfkBb Q+coK1ISksyyAkAUvrm7wnkkF8ggrS8WeqlREi8BmFIu0QbJTrb6qmWueFOS/Sh2TH6B MAMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=JomXrF9U; 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=wdc.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p5si3426934pga.352.2018.11.29.17.58.13; Thu, 29 Nov 2018 17:58:28 -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=@wdc.com header.s=dkim.wdc.com header.b=JomXrF9U; 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=wdc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726732AbeK3NFN (ORCPT + 99 others); Fri, 30 Nov 2018 08:05:13 -0500 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:60172 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726161AbeK3NFN (ORCPT ); Fri, 30 Nov 2018 08:05:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1543543058; x=1575079058; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=FUgCmVQ2VKNgaCsb1HVvTlj5dWNTY50OFk8kPVfHZIc=; b=JomXrF9UurDFwvs12d9eH8FHKOFjJlVpTyvCVsbLPCuMweD1Z48lkFNy Va+0TyYNpdJhy1xUlZ8CXr+JrvD4KIFs0hYBLNaeSe/sd4XVfrUM2C2v9 TMqANhpTogb+N7rTKoAFurtoPn8Ltuefx60HomjZNovfxw4wn3q5rQ9Tq Ef0a1ys5m6dzVXXMk3dCjw21PCxhgBH7B0tEwhBt/AjDjFgRhg/bElO0R YIZuEOhh0CskRyyzJpkcA/WnAVNxR7YlNRLIH6BNLFn9GeezIniC2aspG Ca7si+Zovzf652oIEvDFBgfHn8tSIhTEclmSsTfQSlbmJ4B+W8nqjm+IW Q==; X-IronPort-AV: E=Sophos;i="5.56,297,1539619200"; d="scan'208";a="96654545" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 30 Nov 2018 09:57:38 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 29 Nov 2018 17:40:33 -0800 Received: from c02v91rdhtd5.sdcorp.global.sandisk.com (HELO [10.111.72.98]) ([10.111.72.98]) by uls-op-cesaip01.wdc.com with ESMTP; 29 Nov 2018 17:57:38 -0800 Subject: Re: [PATCH v2 3/4] irqchip: sifive-plic: Differentiate between PLIC handler and context To: Anup Patel , Palmer Dabbelt , Albert Ou , Daniel Lezcano , Thomas Gleixner , Jason Cooper , Marc Zyngier Cc: Christoph Hellwig , "linux-riscv@lists.infradead.org" , "linux-kernel@vger.kernel.org" References: <20181127100317.12809-1-anup@brainfault.org> <20181127100317.12809-4-anup@brainfault.org> From: Atish Patra Message-ID: <93356e4f-ccd9-39ba-6afe-88dcdc72945d@wdc.com> Date: Thu, 29 Nov 2018 17:57:36 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: <20181127100317.12809-4-anup@brainfault.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/27/18 2:04 AM, Anup Patel wrote: > We explicitly differentiate between PLIC handler and context because > PLIC context is for given mode of HART whereas PLIC handler is per-CPU > software construct meant for handling interrupts from a particular > PLIC context. > > Signed-off-by: Anup Patel > --- > drivers/irqchip/irq-sifive-plic.c | 21 +++++++++++++-------- > 1 file changed, 13 insertions(+), 8 deletions(-) > > diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c > index 95b4b92ca9b8..ffd4deaca057 100644 > --- a/drivers/irqchip/irq-sifive-plic.c > +++ b/drivers/irqchip/irq-sifive-plic.c > @@ -66,8 +66,8 @@ static DEFINE_PER_CPU(struct plic_handler, plic_handlers); > > struct plic_hw { > u32 nr_irqs; > + u32 nr_contexts; > u32 nr_handlers; > - u32 nr_mapped; > void __iomem *regs; > struct irq_domain *irqdomain; > }; > @@ -191,10 +191,10 @@ static int __init plic_init(struct device_node *node, > if (WARN_ON(!plic.nr_irqs)) > goto out_iounmap; > > - plic.nr_handlers = of_irq_count(node); > - if (WARN_ON(!plic.nr_handlers)) > + plic.nr_contexts = of_irq_count(node); > + if (WARN_ON(!plic.nr_contexts)) > goto out_iounmap; > - if (WARN_ON(plic.nr_handlers < num_possible_cpus())) > + if (WARN_ON(plic.nr_contexts < num_possible_cpus())) > goto out_iounmap; > > plic.irqdomain = irq_domain_add_linear(node, plic.nr_irqs + 1, > @@ -202,7 +202,7 @@ static int __init plic_init(struct device_node *node, > if (WARN_ON(!plic.irqdomain)) > goto out_iounmap; > > - for (i = 0; i < plic.nr_handlers; i++) { > + for (i = 0; i < plic.nr_contexts; i++) { > struct of_phandle_args parent; > struct plic_handler *handler; > irq_hw_number_t hwirq; > @@ -225,6 +225,11 @@ static int __init plic_init(struct device_node *node, > > cpu = riscv_hartid_to_cpuid(hartid); > handler = per_cpu_ptr(&plic_handlers, cpu); > + if (handler->present) { > + pr_warn("handler not available for context %d.\n", i); > + continue; > + } > + Ahh you have the handler->present check here in this patch. This should be in the 2nd patch. This change doesn't match the commit text anyways. Everything else just variable renaming which can be separated. nr_handlers->nr_contexts nr_mapped->nr_handlers Regards, Atish > handler->present = true; > handler->hart_base = > plic.regs + CONTEXT_BASE + i * CONTEXT_PER_HART; > @@ -237,11 +242,11 @@ static int __init plic_init(struct device_node *node, > for (hwirq = 1; hwirq <= plic.nr_irqs; hwirq++) > plic_toggle(handler, hwirq, 0); > > - plic.nr_mapped++; > + plic.nr_handlers++; > } > > - pr_info("mapped %d interrupts to %d (out of %d) handlers.\n", > - plic.nr_irqs, plic.nr_mapped, plic.nr_handlers); > + pr_info("mapped %d interrupts with %d handlers for %d contexts.\n", > + plic.nr_irqs, plic.nr_handlers, plic.nr_contexts); > set_handle_irq(plic_handle_irq); > return 0; > >