Message ID | 20230803175916.3174453-22-sunilvl@ventanamicro.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp1382801vqx; Thu, 3 Aug 2023 13:14:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHAq3eRHKXVN/rgA2/Ek5hWsb/lFMIj11MpYJPzn03k5LcSl/Y9BqkWzgFipLXx/pi4Ep5P X-Received: by 2002:a17:902:a703:b0:1bc:3f9b:2d57 with SMTP id w3-20020a170902a70300b001bc3f9b2d57mr3038964plq.37.1691093673752; Thu, 03 Aug 2023 13:14:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691093673; cv=none; d=google.com; s=arc-20160816; b=BMFtNsavcbv9GnzDm0aLWTH2t8WDP3dto3FQs32LlQamhB7CaGXIUIv43RwlVWc3nT Lk+zEuGiSlVfjtWDUM4T1wZLzGaV8kcsUScNg0eN+rqvIq3OmIOxNUapJFdoXBfRFVHt CJbnSsFJ4+IfQEqKj0oETcPkzBO8e1Un19foHEbdTYMFPw03Xh9kFSaIKHrlYst7HgKC ttSby21+r7Z5qpv7+hMLISmzwbb6t2g6RylgoZtSiM4ccjxIBtAsPL8WHcxU+mI3J+MU WHBDy+ZoZMdClKKUqSmn3vm3SOyAtN3Ak10bWGEGX3eUSEdyfmYFL3mLSJGwSKHcwVfU +lfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6v/OYLYVQR57/X+MrAxBhstfGEPE9Vxe5lIE5dFdYi8=; fh=dzn7FZXuyjRD/SsADoLVmv8ajN6bypv0shpvYBNDmUc=; b=OBKOwWGFz52t5WBS7VlDuWEnus4D5PqMBaufOjw3Ztd2EupgfDd0KQk0fuAPQksb6K U+1tsSJEA8hP9/RUCuCZ2+ijux17/skf5h7NpJov3ca5EAO+Rh7o/+5vYVWO25J1PDL7 FXV/n2pMFxy2WXWoTtZdrMdfyOU0wXXQmpMywePDdd5fKdofUMxeDbr/Z9136sJu25ZF KGIsNDxbqIjLKojYw8rE03D8qHfEaAbt92kY7OzhY4PU0xB2dUX/kiW8goqcqO/gjuSZ yLl8dm1vhgT92HzRWwFgyWtUHIk3HhaTYDwe6rQ4Br3zLqR846LXPAtycUYw/l2mq+M+ EMhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=AeOusJd6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 12-20020a170902e9cc00b001bbaa5e95fcsi471156plk.589.2023.08.03.13.14.19; Thu, 03 Aug 2023 13:14:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=AeOusJd6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230106AbjHCSEQ (ORCPT <rfc822;guoshuai5156@gmail.com> + 99 others); Thu, 3 Aug 2023 14:04:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229974AbjHCSDb (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 3 Aug 2023 14:03:31 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCFE6423A for <linux-kernel@vger.kernel.org>; Thu, 3 Aug 2023 11:02:16 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-686f090310dso1142111b3a.0 for <linux-kernel@vger.kernel.org>; Thu, 03 Aug 2023 11:02:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1691085731; x=1691690531; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6v/OYLYVQR57/X+MrAxBhstfGEPE9Vxe5lIE5dFdYi8=; b=AeOusJd65H1nN1T0NetBGmbqBfBlOSImAu7Uelx9yA3pASs2f7sefFvXswRe4EVo2O CvUG6NJ6T0Pauy/FEY1z5ifwQKaQ06fZ/QslUnSfxbFdlQQHr+pvPalyXWSwjuG3lGFe N1LN4E6rnrgXD+zSMCTdgWsdIH0dBVzy56DIMSqXW0LgorqgduoErF2Wbz+QyBps81Ai wV5S04bojOgDVv2obMHVmqCVcIR+bI4vWpp49wguFw5PN1QGxBVRCxnEyACKDFScpqmP f1VlfC3SCiQWQ3gVN3KnKCA9ctwnKV1CBt9CVqeVS5hcazcDOMedqZBolJmK3o+QT4M9 R8QA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691085731; x=1691690531; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6v/OYLYVQR57/X+MrAxBhstfGEPE9Vxe5lIE5dFdYi8=; b=TNEhVXD0ylksXXsD4G8a+KxgiV7quvD3LgbCfRUurP6e10k2YzWou42tMepw955ZVY gYKitQEJJGY1CvGSnrmla1v3kkrcsjgSuF2ioTePlwt9t4bDervFpMmUOon5y4lal5rP 9rw2sCwaZmUrnOe1GjAn4bkDLOmKjEPXiJ8o4Y/xxImcVIj9oIvfvhzwUH45XZMjVaim dEcCpI0Mjwr0/TDJGzalABEs9ObIjwLEtv9+OELCnPJpfBh97QEHTLgHeHoOmYaep1Go dp6zNaz8ONgfFCzyPr7vQtNK+NIvBSyVQS/5D/1Q4B+WqoAs8RmCudliTn9UvhQ4kQ03 X1pQ== X-Gm-Message-State: ABy/qLY+Aan1XeSmHSNhVhA90xt98BgAivB8De1xVjHYCkAHI+MCfvQ0 gg8UaRrKqCq8C1JXtNISRSV/Zg== X-Received: by 2002:a05:6a20:938b:b0:13e:f5b5:48ee with SMTP id x11-20020a056a20938b00b0013ef5b548eemr7542379pzh.59.1691085731121; Thu, 03 Aug 2023 11:02:11 -0700 (PDT) Received: from sunil-pc.Dlink ([106.51.190.143]) by smtp.gmail.com with ESMTPSA id s8-20020aa78d48000000b0065a1b05193asm134952pfe.185.2023.08.03.11.02.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Aug 2023 11:02:10 -0700 (PDT) From: Sunil V L <sunilvl@ventanamicro.com> To: linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org, linux-pci@vger.kernel.org Cc: Jonathan Corbet <corbet@lwn.net>, Paul Walmsley <paul.walmsley@sifive.com>, Palmer Dabbelt <palmer@dabbelt.com>, Albert Ou <aou@eecs.berkeley.edu>, Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will@kernel.org>, "Rafael J . Wysocki" <rafael@kernel.org>, Len Brown <lenb@kernel.org>, Andy Shevchenko <andriy.shevchenko@linux.intel.com>, Daniel Scally <djrscally@gmail.com>, Heikki Krogerus <heikki.krogerus@linux.intel.com>, Sakari Ailus <sakari.ailus@linux.intel.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Daniel Lezcano <daniel.lezcano@linaro.org>, Thomas Gleixner <tglx@linutronix.de>, Anup Patel <anup@brainfault.org>, Marc Zyngier <maz@kernel.org>, Bjorn Helgaas <bhelgaas@google.com>, Robert Moore <robert.moore@intel.com>, Haibo Xu <haibo1.xu@intel.com>, Andrew Jones <ajones@ventanamicro.com>, Conor Dooley <conor.dooley@microchip.com>, Atish Kumar Patra <atishp@rivosinc.com>, Sunil V L <sunilvl@ventanamicro.com> Subject: [RFC PATCH v1 21/21] irqchip/sifive-plic: Add GSI conversion support Date: Thu, 3 Aug 2023 23:29:16 +0530 Message-Id: <20230803175916.3174453-22-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230803175916.3174453-1-sunilvl@ventanamicro.com> References: <20230803175916.3174453-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773240240117450157 X-GMAIL-MSGID: 1773240240117450157 |
Series |
RISC-V: ACPI: Add external interrupt controller support
|
|
Commit Message
Sunil V L
Aug. 3, 2023, 5:59 p.m. UTC
ACPI uses flat Global System Interrupt Vector space and
hence the GSI number needs to be converted to corresponding
local IRQ number of the interrupt controller. Add a new
gsi_base field in the priv structure to handle this which
will be 0 on DT based systems.
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
---
drivers/irqchip/irq-sifive-plic.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c index 72d6e06ef52b..1c22070e9cdd 100644 --- a/drivers/irqchip/irq-sifive-plic.c +++ b/drivers/irqchip/irq-sifive-plic.c @@ -68,6 +68,7 @@ struct plic_priv { unsigned long plic_quirks; unsigned int nr_irqs; unsigned long *prio_save; + u32 gsi_base; }; struct plic_handler { @@ -314,6 +315,10 @@ static int plic_irq_domain_translate(struct irq_domain *d, { struct plic_priv *priv = d->host_data; + /* For DT, gsi_base is always zero. */ + if (fwspec->param[0] >= priv->gsi_base) + fwspec->param[0] = fwspec->param[0] - priv->gsi_base; + if (test_bit(PLIC_QUIRK_EDGE_INTERRUPT, &priv->plic_quirks)) return irq_domain_translate_twocell(d, fwspec, hwirq, type); @@ -453,6 +458,17 @@ static int plic_probe(struct platform_device *pdev) return -EIO; } + /* + * Find out GSI base number + * + * Note: DT does not define "riscv,gsi-base" property so GSI + * base is always zero for DT. + */ + rc = fwnode_property_read_u32_array(dev->fwnode, "riscv,gsi-base", + &priv->gsi_base, 1); + if (rc) + priv->gsi_base = 0; + rc = fwnode_property_read_u32_array(dev->fwnode, "riscv,ndev", &nr_irqs, 1); if (rc) {