Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2001579imm; Thu, 2 Aug 2018 04:48:28 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfkfr/vpEbhjqG5QrUJJAZNlsdG30s6q25m4uk9+jPF7dw+djUvyPniMuhvt0/sE789B2ZA X-Received: by 2002:a65:520d:: with SMTP id o13-v6mr2441391pgp.282.1533210508036; Thu, 02 Aug 2018 04:48:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533210508; cv=none; d=google.com; s=arc-20160816; b=Ats9t0gABzNIR8O67Ls8Er24URVs3cPXJ06cW6aZ+sDPhw0l+qsfM5I4wjiYOrnEib VXYf91W0DzB+xm1CP3DEN7UlTccZM7YjmfIOiTa9wmY2kG1/VXuvMYjkRdlbG7PDg80T CcGDSMov2jEGx7QiFCeqjpmgIX8Ua//gqdAQWkTbRpy4XsqS7b9TOvgEVYNeIfVNi64y zqrGyZFivVLWHsSrMtXdI8Kodh4ZjwY0AbB0GLiWO5ZZMATgaDIR6wFmvW7S2qnNAKDq 1b+NO1GlFJmr0NgJucMmiq+U04uVL3t5y4nO/UYCqlaviMHtNXI80G9GMngxrvVQvoMi yffA== 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:arc-authentication-results; bh=ZqLCsuixXzWZ2mS8HxPj3VrUF4FMf1x6fVo25+lxSzc=; b=aRg7vsAPZ2Bp4vsn3rTu0v+OcnwA6Tm4aWdS0LwjY77Wi/C7t0LXN/OYOIIU183VEo qkZpReJYMnVAO1um9TREcASeFIvzD7uRFEuDbFTK3rjQSYNSJnUHEInJ7RSvWeNYF+zL y4X1JVbfVhuUBSKfYqigbDxp3PVt89iVBxIP1uGutgSFBVlE7DHFH0jCQM9kJL9+l+0o QxonM5pjX1yjEDHpffjbe6sL8ftHKGSR9YlBeF9IM2MxPwVp/tlcXJLhKToGFgSRULFp VcI7CGCNpGo/aiiGircbwFd+Ch3SRSjSw/lBW+AjHivlDfTfASXC8fwPAK3vX9Hz0Bzg t20w== 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 b7-v6si1963338pfj.245.2018.08.02.04.48.13; Thu, 02 Aug 2018 04:48:28 -0700 (PDT) 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 S1732294AbeHBNh0 (ORCPT + 99 others); Thu, 2 Aug 2018 09:37:26 -0400 Received: from verein.lst.de ([213.95.11.211]:39327 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728685AbeHBNhZ (ORCPT ); Thu, 2 Aug 2018 09:37:25 -0400 Received: by newverein.lst.de (Postfix, from userid 2407) id 357206FD12; Thu, 2 Aug 2018 13:51:18 +0200 (CEST) Date: Thu, 2 Aug 2018 13:51:18 +0200 From: Christoph Hellwig To: Thomas Gleixner Cc: Christoph Hellwig , palmer@sifive.com, jason@lakedaemon.net, marc.zyngier@arm.com, robh+dt@kernel.org, mark.rutland@arm.com, anup@brainfault.org, atish.patra@wdc.com, devicetree@vger.kernel.org, aou@eecs.berkeley.edu, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, shorne@gmail.com Subject: Re: [PATCH 7/9] irqchip: add a RISC-V PLIC driver Message-ID: <20180802115118.GB21984@lst.de> References: <20180726143723.16585-1-hch@lst.de> <20180726143723.16585-8-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 02, 2018 at 12:04:04PM +0200, Thomas Gleixner wrote: > > On Thu, 26 Jul 2018, Christoph Hellwig wrote: > > > This patch adds a driver for the Platform Level Interrupt Controller (PLIC) > > See Documentation/process/submitting-patches.rst and search for 'This patch' Fixed. > > +static DEFINE_SPINLOCK(plic_toggle_lock); > > RAW_SPINLOCK please. Done. > > +static inline void plic_irq_toggle(struct irq_data *d, int enable) > > +{ > > + int cpu; > > + > > + writel(enable, plic_regs + PRIORITY_BASE + d->hwirq * PRIORITY_PER_ID); > > + for_each_present_cpu(cpu) > > + plic_toggle(cpu, d->hwirq, enable); > > I suggest to make that: > > for_each_cpu(cpu, irq_data_get_affinity_mask(d)) > plic_toggle(cpu, d->hwirq, enable); Done. > That gives you immediately support for interrupt affinity. And then it's > trivial to do the actual irq_chip::irq_set_affinity() magic as well. I'll defer that to an incremental patch (added to my todo list). > > +static void plic_handle_irq(struct pt_regs *regs) > > +{ > > + void __iomem *claim = > > + plic_hart_offset(smp_processor_id()) + CONTEXT_CLAIM; > > Either ignore the 80 char thing or just move the assignment into the code > section please. That line break is horrible to read. That area has been rewritten anyway as we need a cpuid to context lookup to cover real SOCs vs just qemu.