Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp328996rdb; Thu, 22 Feb 2024 05:16:21 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWDfysIrWiOrpTtPOFpZ9mhvkzw7evppHf3aKTSEK5xDcxBEPhsvv3+2702L6lZfk3A7LWgVb0z4fqzd2VY6QB2jUocPD3v4WZvMsuGXA== X-Google-Smtp-Source: AGHT+IHVrgJVzMClrCvTx55/M8F0tHC3aoJf6mOm0VM5mR6YJ8LcKAKDW5IgDEDdKPPqCiKmrCxZ X-Received: by 2002:a81:8d45:0:b0:607:f50f:3770 with SMTP id w5-20020a818d45000000b00607f50f3770mr7840153ywj.41.1708607780695; Thu, 22 Feb 2024 05:16:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708607780; cv=pass; d=google.com; s=arc-20160816; b=ccbqL8jItJpzzrOfxW3Lp7zs0/hKeKqvgsVtfudN/AKQyYdGeFA/uEMjCQ7/dWRslP RnCjc4kgqSWeuW1eEYhF+uyP8F5ViK2QkDOCF4YrbQO5rIuMhXZ0JLeXgvICxzJvTiC3 j7YwVoYeCHjcoFqcm4cn5Eyn2eAk9zDqqPne0DoSU1yUmJzH7GfznbPk7W8frNLNNA3r LnEmxbbCe5UDdwi2FcfEi7880rXsbtllvrDUODZEWCATt+WNulgShz8uujMVKGTPY37Z jrxOU4+VWcejvycvuODpXnnJOdtCum3By+YSfLWFbIKsYbqq0oW+QrmsrWpldELttTTJ ULwA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=Fa4VTv5v/L5lpBnYsaqkIzYKm7XUYovDgpLTiYnYpEg=; fh=JaQJYaCAJsVX9TkA4radO8KhddMM32Tk84nB9Z29qMg=; b=Fwcj7eQA1odR564wZEnzuVKy2+YRJ7PXiZ010HHMK57jkXHAAAQ+eqLQIvnNEVKKQj PxEXqxKStJefOLGIUmPSFfsrA3mp8iXFKEA0tEdEBU3Bl13QQYjVica6phfV+igMfYLW Z+0MT/SV/PtlY41z6fmncClC8ok+v4OfQqzDgN/ktZgGZxqfMRHqR7KqI+/TFAHQDOja ppodFej2IpXfOLvIzyYqPnoAZCbOgkYDwmpETTFAGveYlond6UjxxY7Rk6XjWvZEcgSk lEWcIJin0nZCtBUVbv2n/n8PlZ1bfvSomGeu3C2FCxII60a3/Ivx7I0lMZG8plXzIfQ2 7gOg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sbwSqzTB; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-76576-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76576-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id b12-20020ac87fcc000000b0042e39a45831si3454556qtk.206.2024.02.22.05.16.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 05:16:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76576-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sbwSqzTB; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-76576-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76576-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 72C871C21C3E for ; Thu, 22 Feb 2024 13:16:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D23351332B5; Thu, 22 Feb 2024 13:15:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="sbwSqzTB" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F365312E1D3; Thu, 22 Feb 2024 13:15:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708607723; cv=none; b=N3qvZCxuEvRDXxj14CKtRJ7s9tKdtdUU8+CnaWVet1r5v0oDI+NSpvg+qbH9125YvmuB0nU62wMuSRrJC6zHRGwBKOv8l5jj8mHrD/RlepKH2oQ95TJAim3rAMmdHXocM0l5ZhqkSIO6d8YW+E6DN4N8CR0eZ9CqHWr8XoA+AI4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708607723; c=relaxed/simple; bh=UEVsSZcGmV67zShBBFj0j5CNp24EUBflBXO5GRus0Ec=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=oQfNsfA7xkq//Ok23fpF3HfsCVn7dlnnjqhccTBEYyXTmsIytn0voH2Eu6DEFS1miJi4PpnZPj/m+LfRqgCkQ/5RXDz6t+BpHST3Ya+faGvjyeanDUfTzklz8UDE6UIbmG9GB7WCJ/FY9xGQeeapHUKBi4iCSh6fZKvTzCU5eAg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sbwSqzTB; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24331C43390; Thu, 22 Feb 2024 13:15:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708607722; bh=UEVsSZcGmV67zShBBFj0j5CNp24EUBflBXO5GRus0Ec=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=sbwSqzTBz+kazip5qwYb+U1jMEnSqGzy5vHiXeKWKcWlRSgm8X8DNJ+PKwtj8Ztoe qz7KBevpyREnT4+f44BDEwa58ymwlnjcLgM7SJuziRwmnI4xxQA+PlbTH6CLxI0y57 lD0P9DdG2UgCQpqWWmPO1lpDYV2sc8g6caiaOTA0ZcpBPKOVAjavq6XVmoJr47Mky9 OD/L4VncVcJvkD+jZhTgl4ko6IvJjrtMOOH8k8zO8pqh8Zr6AMTF7UPgMYNQs8w2BY grNCBSSSWkwcrVpm8rWaj9jPDJ+7W8dxYhTDoKot8c1c/UZTgXAMK2Zus0i/q5s8IE O2f8ff7S9Et3w== From: =?utf-8?B?QmrDtnJuIFTDtnBlbA==?= To: Anup Patel , Palmer Dabbelt , Paul Walmsley , Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Frank Rowand , Conor Dooley Cc: Anup Patel , devicetree@vger.kernel.org, Saravana Kannan , Marc Zyngier , Anup Patel , linux-kernel@vger.kernel.org, Atish Patra , linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Andrew Jones Subject: Re: [PATCH v14 12/18] irqchip/riscv-imsic: Add device MSI domain support for platform devices In-Reply-To: <20240222094006.1030709-13-apatel@ventanamicro.com> References: <20240222094006.1030709-1-apatel@ventanamicro.com> <20240222094006.1030709-13-apatel@ventanamicro.com> Date: Thu, 22 Feb 2024 14:15:19 +0100 Message-ID: <87jzmwtzbs.fsf@all.your.base.are.belong.to.us> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Anup Patel writes: > The Linux platform MSI support allows per-device MSI domains so add > a platform irqchip driver for RISC-V IMSIC which provides a base IRQ > domain with MSI parent support for platform device domains. > > The IMSIC platform driver assumes that the IMSIC state is already > initialized by the IMSIC early driver. > > Signed-off-by: Anup Patel > --- > drivers/irqchip/Makefile | 2 +- > drivers/irqchip/irq-riscv-imsic-platform.c | 344 +++++++++++++++++++++ > drivers/irqchip/irq-riscv-imsic-state.h | 1 + > 3 files changed, 346 insertions(+), 1 deletion(-) > create mode 100644 drivers/irqchip/irq-riscv-imsic-platform.c > > diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile > index d714724387ce..abca445a3229 100644 > --- a/drivers/irqchip/Makefile > +++ b/drivers/irqchip/Makefile > @@ -95,7 +95,7 @@ obj-$(CONFIG_QCOM_MPM) +=3D irq-qcom-mpm.o > obj-$(CONFIG_CSKY_MPINTC) +=3D irq-csky-mpintc.o > obj-$(CONFIG_CSKY_APB_INTC) +=3D irq-csky-apb-intc.o > obj-$(CONFIG_RISCV_INTC) +=3D irq-riscv-intc.o > -obj-$(CONFIG_RISCV_IMSIC) +=3D irq-riscv-imsic-state.o irq-riscv-imsic-= early.o > +obj-$(CONFIG_RISCV_IMSIC) +=3D irq-riscv-imsic-state.o irq-riscv-imsic-= early.o irq-riscv-imsic-platform.o > obj-$(CONFIG_SIFIVE_PLIC) +=3D irq-sifive-plic.o > obj-$(CONFIG_IMX_IRQSTEER) +=3D irq-imx-irqsteer.o > obj-$(CONFIG_IMX_INTMUX) +=3D irq-imx-intmux.o > diff --git a/drivers/irqchip/irq-riscv-imsic-platform.c b/drivers/irqchip= /irq-riscv-imsic-platform.c > new file mode 100644 > index 000000000000..e2344fc08dca > --- /dev/null > +++ b/drivers/irqchip/irq-riscv-imsic-platform.c > @@ -0,0 +1,344 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Copyright (C) 2021 Western Digital Corporation or its affiliates. > + * Copyright (C) 2022 Ventana Micro Systems Inc. > + */ > + > +#define pr_fmt(fmt) "riscv-imsic: " fmt > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "irq-riscv-imsic-state.h" > + > +static bool imsic_cpu_page_phys(unsigned int cpu, unsigned int guest_ind= ex, > + phys_addr_t *out_msi_pa) > +{ > + struct imsic_global_config *global; > + struct imsic_local_config *local; > + > + global =3D &imsic->global; > + local =3D per_cpu_ptr(global->local, cpu); > + > + if (BIT(global->guest_index_bits) <=3D guest_index) > + return false; > + > + if (out_msi_pa) > + *out_msi_pa =3D local->msi_pa + > + (guest_index * IMSIC_MMIO_PAGE_SZ); Nit: And one more redundant parenthesis and 100 char! ;-) Bj=C3=B6rn