Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1781029imm; Thu, 2 Aug 2018 00:31:16 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfdy7BX9NAjkY/jgY/+aYLgdRMr1EVtxWE0Gkzh2CTUdeb5pBpkIpe3pD73tNjC9x7tj7DD X-Received: by 2002:a62:1d49:: with SMTP id d70-v6mr1738496pfd.101.1533195076237; Thu, 02 Aug 2018 00:31:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533195076; cv=none; d=google.com; s=arc-20160816; b=aRPFBNG4Ke0qj2fXNg8E7HFTUYE4HAgpq0TrfWCBbykH5kZhMySEghD/hK3u4g/Q/o 26DGE32jB1i5/qEhfOLbGZGcuh7aUVJaDPqLlUdceX4XVtTKe55NINptNnP17AiWu2aT YcAoB56K8F1aqc6ZcM6qMQHKzuFxmt7lhg/nkNmTnMHPQLiRELL5q9geLNZ8N2+nrJM8 a/0zdc09UYzaF+j6E/H6vCKi7I4Dw3Iz4CCItDryTLDNha5hbfM1UuwU9bm2GeATzQV+ whjiy0PSmzFa0uF8Tktf8vdoHeE+jhvBmRMz0TYuFtpaLMf/fxHPet21AmzZKjmqa2zH wWwA== 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=ia/Ylwnng9wa4HOOR3p4S3K8W2yVEVoQjbHgBHUqrFg=; b=cgYlCObwRnZJf3VmtSxLFeAJ8p72U3kdakbUw+6PrRTmyyFHhx7bn3z7qj8g4nBiX6 qB9HRjed/Vxx7QuAnRK+HJ9d0P2EnPp3AtnPKgcqHKHXqlT2UNlibey1/+RKvZnznpHh uyuJ2Rr3N9OwaPQFxjyXGXcrSGuCaiq9LUKwIakU5n0EbgTalL9yPetP7PZsKQomEl98 s7MxV0au7ndnmt1yZow7h/91YV5weY+OY8lMPExBwaAOgWydmcWaJpxRZUJGiI5ckgFd 5VeDuAdr7P784DiyOodxtT2Jm9YSvjAJNm0ediw9Svq5H+YVhVd6hSbfVP9xAfWLls7C yrNA== 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 y2-v6si1431014pga.141.2018.08.02.00.31.01; Thu, 02 Aug 2018 00:31:16 -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 S1726971AbeHBJUE (ORCPT + 99 others); Thu, 2 Aug 2018 05:20:04 -0400 Received: from verein.lst.de ([213.95.11.211]:38291 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726260AbeHBJUE (ORCPT ); Thu, 2 Aug 2018 05:20:04 -0400 Received: by newverein.lst.de (Postfix, from userid 2407) id 9573868D64; Thu, 2 Aug 2018 09:34:52 +0200 (CEST) Date: Thu, 2 Aug 2018 09:34:52 +0200 From: Christoph Hellwig To: Thomas Gleixner Cc: Christoph Hellwig , Marc Zyngier , palmer@sifive.com, jason@lakedaemon.net, robh+dt@kernel.org, mark.rutland@arm.com, devicetree@vger.kernel.org, aou@eecs.berkeley.edu, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, shorne@gmail.com, Palmer Dabbelt Subject: Re: [PATCH 3/6] irqchip: RISC-V Local Interrupt Controller Driver Message-ID: <20180802073452.GA11693@lst.de> References: <20180725093649.32332-1-hch@lst.de> <20180725093649.32332-4-hch@lst.de> <20180725112457.GA24502@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 Wed, Aug 01, 2018 at 08:55:06PM +0200, Thomas Gleixner wrote: > Confused. The timer and the IPI are separate causes and have nothing to do > with the per cpu irq domain. That's what the low level interrupt handling > code tells me. Yes. > If I understand correctly then the per cpu irq domain is for device > interrupts, right? If so, then this simply cannot work and there is no way > to make it work with per cpu interrupts either. Actually I don't think we even need the per cpu irq domain, see my latest version of these patches here (which I'll send out again after fixing up the remaining device tree binding review comments): http://git.infradead.org/users/hch/riscv.git/shortlog/refs/heads/riscv-irq-simple.2 > Is there some high level documentation about the design (or the lack of) or > can someone give a concise explanation how this stuff is supposed to work? All of the current RISC-V irq handling concepts are document in the RISC-V privile spec: https://content.riscv.org/wp-content/uploads/2017/05/riscv-privileged-v1.10.pdf The cpu local interrupt handling, which was irq-riscv-intc.c in this series and has been moved to arch/riscv/kernel/irq.c in my new series is split over a few control registers (CSRs in RISC-V speak): The exception handler, which includes the delivery of interrupts to the CPU is set up using the stvec CSR (Section 4.1.4). The vector mode mentioned there is not supported by Linux (and not by any hardware known to me), so ignore it. Once an exception has been triggered Linux reads the scause CSR (Section 4.1.10) to check the exception cause. If the interrupt bit is set we have three possible exception causes that matter for the kernel: Supervisor software interrupt, Supervisor timer interrupt, Supervisor external interrupt (ignore the user versions, I'm not even sure they are implementable, and they certainly are not at the moment). To enable / disable any of these logical interrupt sources the sie CSR (Section 4.1.5) has a bit for each kind thast can be set/cleared. Also there is the sip CSR (also section 4.1.5) which tells if any of those is pending at the moment. The PLIC itself is only described logically in the RISC-V privileged spec (Section 7), the actual register layout is left to implementations. The one implemented here is documented in Chaper 5 of this document: https://static.dev.sifive.com/SiFive-E3-Coreplex-v1.2.pdf