Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1247331ybl; Tue, 13 Aug 2019 09:31:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqx3dCiPg4eGA8TcL/FBTGVV+f2YoAv9VMBmfrp6IuCMMV8vuMwDI0uwAMa9L5YUuMSz8Rul X-Received: by 2002:a17:902:59c3:: with SMTP id d3mr37290618plj.22.1565713913217; Tue, 13 Aug 2019 09:31:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565713913; cv=none; d=google.com; s=arc-20160816; b=v93lb5Zc3L7/NEePbE3bsFhgkKTkM2p9vzOBEluxb2HyiVXOinApvNeXGM+iEw4Mhi e8OfYyG+o5IsiM6XVv/vCoxQEd2y0YgDNbndktS82SchvwXY6SDIi7nrBN0E9KYGZ6/W 6mp8/88qDjjLAewDdNHqHeG53sEywuF5xjUfvmaIuGcXuv+tVfvXDML4ZeiNmWjwFraK kosgCcxU4/n5FNeo/gzhia0cRK6cuSRe+hyFp8Imf9YLCVw+pQ7ZMmgaSwUpXhiAuiSP rpzHJkEKflQSgJsZIQc0iPQRktXN3a6lDiXlJngB5+PvbnmwoXjT7vMrP49vKopNiedP VGNQ== 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; bh=T4Y9qzttOenTLRxs3E9Nx/AVZ1DInWGFpAehPSKF9YE=; b=b2McFIlTTcLhLc7doRyyrONVCm8s6T/ef3p1c94NxSqQthhx9JwSZhsNNa5easpX3c zwxa9FVx51LtUuOnPl5YMRmwSxv8XoLUC0BiSYEO1NJJHvk7XFWCtvgO+cofrUeSyHJ/ kNSyLypuXVLU4NmJK6gi+HEJcwvHXMziOgNleBEeTam86cOOLhz9tHYLGUQT/kuApcRN 1fNzZwXMtxVNV/AB7vwXC5qFsEs0cbce6XIYr2157sl9UW+YhM2OYW93Kr2xdU+aM97v 3joKEkxY/uYKnog/OwPFH6hnv4oCYzw164eS/G9aw5AVCROosSubZhP0ma7IPKG+xFeh iwOw== 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 h31si49141741pgb.67.2019.08.13.09.31.36; Tue, 13 Aug 2019 09:31:53 -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 S1727528AbfHMQaG (ORCPT + 99 others); Tue, 13 Aug 2019 12:30:06 -0400 Received: from foss.arm.com ([217.140.110.172]:40328 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726975AbfHMQaG (ORCPT ); Tue, 13 Aug 2019 12:30:06 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8E7FC337; Tue, 13 Aug 2019 09:30:05 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A59463F706; Tue, 13 Aug 2019 09:30:04 -0700 (PDT) Date: Tue, 13 Aug 2019 17:29:58 +0100 From: Mark Rutland To: Christoph Hellwig Cc: Palmer Dabbelt , Paul Walmsley , Damien Le Moal , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 08/15] riscv: provide native clint access for M-mode Message-ID: <20190813162958.GA27821@lakrids.cambridge.arm.com> References: <20190813154747.24256-1-hch@lst.de> <20190813154747.24256-9-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190813154747.24256-9-hch@lst.de> User-Agent: Mutt/1.11.1+11 (2f07cb52) (2018-12-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 13, 2019 at 05:47:40PM +0200, Christoph Hellwig wrote: > RISC-V has the concept of a cpu level interrupt controller. Part of it > is expose as bits in the status registers, and 2 new CSRs per privilege > level in the instruction set, but the machanisms to trigger IPIs and > timer events, as well as reading the actual timer value are not > specified in the RISC-V spec but usually delegated to a block of MMIO > registers. This patch adds support for those MMIO registers in the > timer and IPI code. For now only the SiFive layout also supported by > a few other implementations is supported, but the code should be > easily extensible to others in the future. > > Signed-off-by: Christoph Hellwig > +/* > + * This is the layout used by the SiFive clint, which is also shared by the qemu > + * virt platform, and the Kendryte KD210 at least. > + */ > +#define CLINT_IPI_OFF 0 > +#define CLINT_TIME_VAL_OFF 0xbff8 > +#define CLINT_TIME_CMP_OFF 0x4000; > + > +u32 __iomem *clint_ipi_base; > +u64 __iomem *clint_time_val; > +u64 __iomem *clint_time_cmp; > + > +void clint_init_boot_cpu(void) > +{ > + struct device_node *np; > + void __iomem *base; > + > + np = of_find_compatible_node(NULL, NULL, "riscv,clint0"); Since the MMIO layout is that of the SiFive clint, the compatible string should be specific to that. e.g. "sifive,clint". That way it will be possible to distinguish it from other implementations. What exactly is the "0" suffix for? Is that a version number? If that's a CPU index, then I don't think that's the right way to encode this unless the programming interface actually differs across CPUs. It would be better to use an explicit phandle to express the affinity. Thanks, Mark.