Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp379046pxu; Fri, 23 Oct 2020 03:19:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7BCEqwt7DaPdom2rTMj+gfNvo8DVseDVsjwdyUSKOPFs72SwYeuQmW8uv9r7D84JiPP08 X-Received: by 2002:a17:906:bc93:: with SMTP id lv19mr1204024ejb.147.1603448387496; Fri, 23 Oct 2020 03:19:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603448387; cv=none; d=google.com; s=arc-20160816; b=tDku4rkwqfFMOPxF5sKnaq9Vl1B9DbCIF5Lb9QE8npLroWM1wrL39O/bnGH6f+iSpq kg1Z0JHgqjY8lecDKKHVmD0OrNV+f3YcUEYYjHMnkyf44TWkb0hjF79BkEyx2l2ow4Yx nFXKx1aODzHAbSPZauMYeVE3YK5GYg6AGLadgaQQK5J5FyzprgwIJEe5w3buuVthoW9c tta88zt5fWaGNiRJBF5OUuBwvCjVDwrUP/qFVjWo3TJFPqN+kGELuu0A9o8KVIAlcHY7 b7SCFd0mxQvEG16rUxdIrp6eWp10IeawyWcwA9m3ac3w/dMLvw+YgfB5NCB4gODZuOo3 fS5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=AEW9JJAuj6dNn21ae1TMkOD7EoOylW9yTEg0gndYE6Q=; b=In1AW9LAdZY3FAuckyLfz+kZSyzaLTVP0nFr1GbN4tTOKtU58BR38MscpjxXeY0g5E /+ApFj63LKFXE5Sr5kOdQEzgug1MYTHEs/LquTiQsRzImvA9gKbyrWS8/MdgbDd5Hz+l p+XFqkeInRV/VZS9GZ1IdeR06xTZ32J3/LSm/Au/LLFj5wDL/XNSaBciIH1eeWNciGMr VSi0xoQMpy/Q7usIxchX/cdOK0GpKQZtdKINzEEOejtTk474BT2LjJWHH4CkkE18Uu3D tiX4vaJE3ghjcafwihoroNDhJQDrDF0idFYDT/5fMGiuMql3IW7k9aE025j/u+kPHRUv 0YeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FXVNjYYN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u7si460876edo.531.2020.10.23.03.19.25; Fri, 23 Oct 2020 03:19:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FXVNjYYN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S462020AbgJWKSS (ORCPT + 99 others); Fri, 23 Oct 2020 06:18:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:45106 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S461902AbgJWKSS (ORCPT ); Fri, 23 Oct 2020 06:18:18 -0400 Received: from localhost.localdomain (unknown [42.120.72.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 708DE20936; Fri, 23 Oct 2020 10:18:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603448297; bh=BV1tH2U1Lsosw+Ugkhs7glTIjtqVDoAJop9TuiKHT44=; h=From:To:Cc:Subject:Date:From; b=FXVNjYYNeEGZSvIhl4SuHitDKUsn6hlGW8Wg42BMzw7N0bBGFCQQcXhfA83VUXfh9 PWbmy5NXe2PNDWiHSzBy2/Ktf60A1UV7UDxoKHO6LjuY2r1O41pscRE2LB20gp4Wkb MSAAeYE9mUg2sG/WR0ot+g2CIOxzKRiblzgHdqDM= From: guoren@kernel.org To: palmerdabbelt@google.com, paul.walmsley@sifive.com, anup@brainfault.org, greentime.hu@sifive.com, zong.li@sifive.com, atish.patra@wdc.com, tglx@linutronix.de, jason@lakedaemon.net, maz@kernel.org, wesley@sifive.com, yash.shah@sifive.com, hch@lst.de Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, guoren@kernel.org, Guo Ren Subject: [PATCH 1/3] irqchip/irq-sifive-plic: Fixup wrong size of xxx_PER_HART and reg base Date: Fri, 23 Oct 2020 10:17:23 +0000 Message-Id: <1603448245-79429-1-git-send-email-guoren@kernel.org> X-Mailer: git-send-email 2.7.4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Guo Ren ENABLE and CONTEXT registers contain M & S status for per-hart, so ref to the specification the correct definition is double to the current value. The value of hart_base and enable_base should be calculated by real physical hartid not software id. Sometimes the CPU node's from dts is not equal to the sequence index. Signed-off-by: Guo Ren --- drivers/irqchip/irq-sifive-plic.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c index eaa3e9f..2e56576 100644 --- a/drivers/irqchip/irq-sifive-plic.c +++ b/drivers/irqchip/irq-sifive-plic.c @@ -44,16 +44,16 @@ * Each hart context has a vector of interrupt enable bits associated with it. * There's one bit for each interrupt source. */ -#define ENABLE_BASE 0x2000 -#define ENABLE_PER_HART 0x80 +#define ENABLE_BASE 0x2080 +#define ENABLE_PER_HART 0x100 /* * Each hart context has a set of control registers associated with it. Right * now there's only two: a source priority threshold over which the hart will * take an interrupt, and a register to claim interrupts. */ -#define CONTEXT_BASE 0x200000 -#define CONTEXT_PER_HART 0x1000 +#define CONTEXT_BASE 0x201000 +#define CONTEXT_PER_HART 0x2000 #define CONTEXT_THRESHOLD 0x00 #define CONTEXT_CLAIM 0x04 @@ -358,10 +358,10 @@ static int __init plic_init(struct device_node *node, cpumask_set_cpu(cpu, &priv->lmask); handler->present = true; handler->hart_base = - priv->regs + CONTEXT_BASE + i * CONTEXT_PER_HART; + priv->regs + CONTEXT_BASE + hartid * CONTEXT_PER_HART; raw_spin_lock_init(&handler->enable_lock); handler->enable_base = - priv->regs + ENABLE_BASE + i * ENABLE_PER_HART; + priv->regs + ENABLE_BASE + hartid * ENABLE_PER_HART; handler->priv = priv; done: for (hwirq = 1; hwirq <= nr_irqs; hwirq++) -- 2.7.4