Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3287344imu; Thu, 29 Nov 2018 19:56:03 -0800 (PST) X-Google-Smtp-Source: AFSGD/Uw0PPORG9eyWcRQ5qBQ6IHn9UdY11CBTF2wmJ1whgwjds1+NX9h4cyVDzhIumu2wOrwgT4 X-Received: by 2002:a17:902:690c:: with SMTP id j12mr4092776plk.206.1543550163522; Thu, 29 Nov 2018 19:56:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543550163; cv=none; d=google.com; s=arc-20160816; b=vwobnM7Cd6ff687pqnfj9z3i/kGzpGNmyqJcTBNmExKEdE7zeXBfWPn2MtpKf17X7x CQb4gt1nhFkl80qeL4etkssgyObwCoXFR9j87ivJWPx/lFi3NL5h3ytWqbPr4is56Hdb xmbbts5Hz9fcKCaXU3M2IAx7MPRbg6hm2Tm/ZuR3DFxGB1ll6INRaI/CUC9Rkmpni3Ko NGjMbkL3lGHI4UiPFRmdtl3LZoOSXFGNYRzg99TQ7HrDh+U8rQVNwHadk5Pnw+j7ngx2 m2Nobm0td9uRqWpG1CB8Rk9R50SmMlXIYIIEihm2CsZRDKWFgNXYuTOLem2b8oufM5uB m7tg== 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 :in-reply-to:references:mime-version:dkim-signature; bh=vLB7EVU44M/0Thoz+hWTouq1G+WRlY7ECvA7v+w6x2c=; b=V5JK//sFsjoxQ895CAI2priZG4t+LiAwzC+orm1BYJgOStX+8zaEpEWUyNcIfpjHDh 3DTFl23xyFEoaTJ2jeTnl3A4VNVUBV6EU/qYT5dEzdt9qVKFyN1UTed3tHJQv8nT97uW YvRNqqWMJlRYzqGWNfFKsSISsjlq6B/DYQi649jJ/t5/YUIdMgRP3SuJagDSbnpR8SZR Ke/LEdeIlTcq4g+HQv55c/lmE7wCxoStasDfNn/wGrd0X//3jkSiNmgjFMdcLoqr5gcJ fP8otC6QaTdLK3zOhFLgT+SZBUhIOEVqWDFZG3+6suvu7X0WXWdky9Mfzel5E+YiZaSw C4fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=tKOEoENU; 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 y21si3670417pga.192.2018.11.29.19.55.48; Thu, 29 Nov 2018 19:56:03 -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=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=tKOEoENU; 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 S1726459AbeK3PDG (ORCPT + 99 others); Fri, 30 Nov 2018 10:03:06 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:43687 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726351AbeK3PDG (ORCPT ); Fri, 30 Nov 2018 10:03:06 -0500 Received: by mail-wr1-f68.google.com with SMTP id r10so3898937wrs.10 for ; Thu, 29 Nov 2018 19:55:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vLB7EVU44M/0Thoz+hWTouq1G+WRlY7ECvA7v+w6x2c=; b=tKOEoENUgC1N4ZfPi/5P8+yD8PCwxnIPPWi2bTKzeoCwj8Md+N+uVeNriXjKxIZs52 1pfLR+nd7IdSH+tk/iPcHdKRcpRikNoLv5sbz0c8R4W717FUX1XA86shpb5WJsf3iEWJ 1X4NJ4u8o6BgpaCpbyRdHf+MbWoNznWgbREVb3Lhnq3aIIDzaypMoeTChhByHG3X72lN PXPFfN+JfaAo0BBQoI2ePjEMA+FA1ZV2YbUgQdu1L2lzNpU12TyXfCvQNWtDWmwvRZYc 0QseBXht50pW4ncVyYiXmELLmQquVgkrgCkAZg7Nw4mlrRAlEMwOvQeQ0nttiRYBXy9O RfaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=vLB7EVU44M/0Thoz+hWTouq1G+WRlY7ECvA7v+w6x2c=; b=Oi+PRWbsQk9sSPm9XFOtCE12U5Wg0Paj8DSRs7MOw5rux1+X6FRXA9G7Ka026X+XZC ycchl5F6uCWeKNK75RD86zU3H/51DBZRCVjBe9POoAk4biIptoG0uC5y/Ogp2zZBTJqG wJ6bTnFAj2+0tgJ3AkgwbkrfuZGF9RIF7Il4Ki0P4X0G2pqhqsc+oLjhvIvZO+zmRbwF +qQb3jBdqnqAZSsAZ9eL2Ax3HrtLWoJ28+TkiX20RXM123J4bplG1EqThC2YdR3XvQjH oHFkGP6Qb+uPvA4m5gM0VP+EiyOF4d6k2wKwXSqDhT4G+A3C+P/npkm4gpbbsQWY/OuQ /L6w== X-Gm-Message-State: AA+aEWaJIvwE+NKnFQRewyqJaVDHJ/FpJDIdLUFcoIi2C88blbXNErCL xzEfEfheYo/oVp5cjSlTTtEdx9zu8bnlDzwiCy5W1pbE X-Received: by 2002:adf:91a3:: with SMTP id 32mr3186865wri.99.1543550110977; Thu, 29 Nov 2018 19:55:10 -0800 (PST) MIME-Version: 1.0 References: <20181127100317.12809-1-anup@brainfault.org> <20181127100317.12809-4-anup@brainfault.org> <93356e4f-ccd9-39ba-6afe-88dcdc72945d@wdc.com> In-Reply-To: <93356e4f-ccd9-39ba-6afe-88dcdc72945d@wdc.com> From: Anup Patel Date: Fri, 30 Nov 2018 09:25:06 +0530 Message-ID: Subject: Re: [PATCH v2 3/4] irqchip: sifive-plic: Differentiate between PLIC handler and context To: Atish Patra Cc: Palmer Dabbelt , Albert Ou , Daniel Lezcano , Thomas Gleixner , Jason Cooper , Marc Zyngier , Christoph Hellwig , linux-riscv@lists.infradead.org, "linux-kernel@vger.kernel.org List" 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 Fri, Nov 30, 2018 at 7:27 AM Atish Patra wrote: > > 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. Sure, will do. > > Everything else just variable renaming which can be separated. > nr_handlers->nr_contexts > nr_mapped->nr_handlers > Sure, will update commit text. Thanks, Anup