Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5377843imm; Tue, 31 Jul 2018 09:55:01 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcugVnhp0v/m/qWDfPehUQBv9FlYI8Ee/KJHgl5G32d5M+4MeerXLTTu0tT3PSXyFYAxPui X-Received: by 2002:a62:3a9d:: with SMTP id v29-v6mr23062811pfj.215.1533056101214; Tue, 31 Jul 2018 09:55:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533056101; cv=none; d=google.com; s=arc-20160816; b=IPDtvyzdLUPr1/7eqcWkVBoiAEmZBHVJkQu4oHntIPOJ5vTdL7ju731YlwiMTa+VMb 6n6yKuT23BsBb0mgMKGv/Fkg+osM6PAEyVboCLEffKUlJSBwBW4OIjwC04DrPCSfd8j1 wwi4I/d+xTb4m0OZXAZSa5v/INgt1VdPbFgIsQvt93lcwUuQtbG8h8VtNRHXIqWMB6VQ Nzjad8t6wD8OaBaNwaVU3lAq4IhZfel1MkuXf5/DWMWKPWIehC3gR9lB/gO2OZusDZg4 r3MMHjqVS3MwbUdzKlPhNdjBTiJbrUbocbkKZ0CjcPUCgTO/ia1TnX0ur0XEGkHhLVcy 7zGQ== 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=A0v6YyEHGUfhqfuSoR+dS0PBj0GnnWjCZZwmWQ+mNoI=; b=V8ub0t0qAN3J4mWDLOdLQkXyxdDrT1Otw9BW8VFL4iPp5d+E4gr/65QT9Ccsd7nWmB gDRIFI9AOgmmxpj6Nmh7Qji/VADoejNCXiXeAQ8HTeYgSyTSnBC5yAv71a109Tbt9W4a YHmahUp1C3WVcBl284fBXE7x3CvpkRu4OVyoV7BGb9bFp8eBNC/JL6Mo7rSYQzxqzAaP Ol41Ih9OuHetHvD8jY5vqs/KZJnW88vqUFkoeNOOpkzAfYaXr9zeIUU6RR8VZWV/PcBu Pmw/dCAPr9HynDPkYxkSiVtitkxBCcaUk74HVMZ9oCqZB0zLkMCRVYJLy2DIog2KKbzp hPRA== 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 d27-v6si12342496pgm.67.2018.07.31.09.54.46; Tue, 31 Jul 2018 09:55:01 -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 S1731981AbeGaSd6 (ORCPT + 99 others); Tue, 31 Jul 2018 14:33:58 -0400 Received: from verein.lst.de ([213.95.11.211]:58173 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727471AbeGaSd6 (ORCPT ); Tue, 31 Jul 2018 14:33:58 -0400 Received: by newverein.lst.de (Postfix, from userid 2407) id 8632768D64; Tue, 31 Jul 2018 18:57:12 +0200 (CEST) Date: Tue, 31 Jul 2018 18:57:12 +0200 From: Christoph Hellwig To: Atish Patra Cc: Christoph Hellwig , "tglx@linutronix.de" , "palmer@sifive.com" , "jason@lakedaemon.net" , "marc.zyngier@arm.com" , "robh+dt@kernel.org" , "mark.rutland@arm.com" , "anup@brainfault.org" , "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: <20180731165712.GA2521@lst.de> References: <20180726143723.16585-1-hch@lst.de> <20180726143723.16585-8-hch@lst.de> <1b3f6066-0c7c-a5f5-75ad-559fe81091ee@wdc.com> 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 Mon, Jul 30, 2018 at 08:21:33PM -0700, Atish Patra wrote: > I found the issue. As per PLIC documentation, a hart context is a given > privilege mode on a given hart. Thus, cpu context ID & cpu numbers are not > same. Here is the PLIC register Maps in U54 core: > > Ref: https://static.dev.sifive.com/U54-MC-RVCoreIP.pdf > > Memory address for Interrupt enable > Address > 0x0C00-2080 Hart 1 M-mode enables > 0x0C00 2094 End of Hart 1 M-mode enables > > 0x0C00-2100 Hart 1 S-mode enables > 0x0C00-2114 End of Hart 1 S-mode enables > > Memory map Claim/Threshold > Address > 0x0C20-1000 4B M-mode priority threshold > 0x0C20-1004 4B M-mode claim/complete > 0x0C20-2000 4B S-mode priority threshold > 0x0C20-2004 4B S-mode claim/complete > > The original PLIC patch was calculating based on handle->contextid which > will assume numbers on a HighFive Unleashed board as 2 4 6 8. > > In this patch, context id is assigned as cpu numbers which will be 1 2 3 4. > Thus it will lead to incorrect plic address access as shown below. Indeed. Can you try this branch, which puts back the OF contextid parsing from the original code: git://git.infradead.org/users/hch/riscv.git riscv-irq-simple.2 Gitweb: http://git.infradead.org/users/hch/riscv.git/shortlog/refs/heads/riscv-irq-simple.2