Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp328673rdb; Thu, 22 Feb 2024 05:15:54 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUA4a9fJMZ+1jMO9Rp5Ih5othRvRFR0VGtvMm13o0gZNzYmiu8wiFYx3ajuuCNRYI/RjX34bEhXilffUNPSmtgJEMR+OxR9LwXOTP1z3Q== X-Google-Smtp-Source: AGHT+IFBYMB2SeNCba2PBw02tNIlngLIcebgSyzre66f/afe3LHG/yPcSHthUErwG7F/qprJMg31 X-Received: by 2002:a05:6214:2421:b0:68f:8bff:f0bc with SMTP id gy1-20020a056214242100b0068f8bfff0bcmr11182969qvb.63.1708607754095; Thu, 22 Feb 2024 05:15:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708607754; cv=pass; d=google.com; s=arc-20160816; b=f37i2okLoKg3CiD3J6EN30S53UhWubt7Xc9MPnZCH5CYnrWxceDMeVSFT5+0MrE7jR o4Cahz68Ru9eyjY40D5EZkQYatqPWdthT0xTOEQXjPFJE5c+Fy4mvrALOrVWJrbmcqxn 3fe9fo4KXcwjfsbh+7VDVB1LnBk+p4CkS87V3QM9eOGUT9xNtGvs4juXtUwM4BqOUFER 06eL2pyI7xrYZz4a1aj/QxlDuetK6fcfYnqT/7EjpSKZ2XZYTkhpd7aUKQoPZMsl8v7g fdvWXtA7ny+rxTjXnuQ5JGVfwJAEZ/EciPug/V3XvmTV9pABE0o+AtWXSXYwKCJy4YDr YFog== 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=uYMKHBuE+EiUL6oM3Cuyf8HqNMD4tKbLsi2f860Hr+o=; fh=JaQJYaCAJsVX9TkA4radO8KhddMM32Tk84nB9Z29qMg=; b=u5bdgJiZTwdoo3TJCy35gI/U7wyvyBxXGEU3DSkdz0sSMrvGNrMhZmYH7vcwuZf36Q /ObJizQIUqPNnbJP28f3ZQAmVXrzIQHNYwsISOj4yg8R24VNgC6ASYn2yFiRDlc3YCig Kc9KAoBGTCbip0eViXH6dnHuCXbyoUBFUHHsXt4y8Fw2fCz06iSKamtuBrcdyeLfENL6 rH3wzBT3yw9cAfabWN6rnGhVOyQH4woPXIFLzlxbBp7i1yRP3zSiNV2LnzbEKIMmK4nX rAvpgJT6z6yJvaoV0X985YQBog5QMvRh6JAIsV/daUXHksRHOuv5Fly1eJz5Md2t4Y/o +4ww==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LP+bYP4u; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-76574-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76574-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 8-20020a0562140d6800b0068cb0d39be6si12864603qvs.521.2024.02.22.05.15.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 05:15:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76574-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=LP+bYP4u; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-76574-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76574-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 3DA521C221F7 for ; Thu, 22 Feb 2024 13:15:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C739C135A59; Thu, 22 Feb 2024 13:14:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LP+bYP4u" 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 ED1E71350E8; Thu, 22 Feb 2024 13:14:55 +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=1708607696; cv=none; b=GmmeJR2bN1w6xo80CfsNOIJevuySCVe5SCgVDVMxqc9Ublzt3EO6E6RJ5la3GAI6o4sTsc5+NT8oVJQfgieJZXV5CoDv1sMzKHVWMik5tHkF+iNZ81k7ddvzqKhfskA74am7fc91YUNanLepAS+q5wocS01tcSlvMQvq2WE8pgQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708607696; c=relaxed/simple; bh=RS33a5NAXMYkmcGbonHNshPN7xX7MMKFPNs6Cwp2KpU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=m8cHf6IkSihq77zTB9i6gBl+JqPv721WCwEP96u1wcyAgLL+twi0I0WF6BEQBcLmAABX/GdhUNTjSWzNaLzsBQ8nLELPpwKH4Itlrw0Cp4bkkEFZCTD2Y5s7j59IHiuTe33bPjikYwaM3FsWkherYpruVvdEZJ0tsLKuSzTNsFc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LP+bYP4u; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7CAAC43390; Thu, 22 Feb 2024 13:14:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708607695; bh=RS33a5NAXMYkmcGbonHNshPN7xX7MMKFPNs6Cwp2KpU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=LP+bYP4uecGnPP5dkdkYukDVfPWQu8dMR5Jkrs1trXr09+T71XWJ9Mn01c5F/o/Xv F64RIvknhyXCGIFa3lK7RsVyAQiHSiLpdp43kcUNHfbWI6njNz2Rj0FY74Iu8sr7W1 QX2+JPEb0Ro1m9xCA/Lx9f7x9BYgYbcb9mgF1xeMmc15QKS4jBXntIzpvWro7H2MkW HdWFX6B0b598v9jWqFV+992oA4904XMhgnMzhsM5LMV3eoGz4vtYmOODe7nS+cisn0 4IJs1BYIxbUU9E6D8+o2GKvBkneaFpq3vXHnngjZ96TG1ZmaBaGsU29N4FpiTZfFXK Uo8DErPX+JbDg== 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 13/18] irqchip/riscv-imsic: Add device MSI domain support for PCI devices In-Reply-To: <20240222094006.1030709-14-apatel@ventanamicro.com> References: <20240222094006.1030709-1-apatel@ventanamicro.com> <20240222094006.1030709-14-apatel@ventanamicro.com> Date: Thu, 22 Feb 2024 14:14:51 +0100 Message-ID: <87msrstzck.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 PCI framework supports per-device MSI domains for PCI devices > so extend the IMSIC driver to allow PCI per-device MSI domains. > > Signed-off-by: Anup Patel > --- > drivers/irqchip/Kconfig | 7 +++++ > drivers/irqchip/irq-riscv-imsic-platform.c | 35 ++++++++++++++++++++-- > 2 files changed, 40 insertions(+), 2 deletions(-) > > diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig > index 85f86e31c996..2fc0cb32341a 100644 > --- a/drivers/irqchip/Kconfig > +++ b/drivers/irqchip/Kconfig > @@ -553,6 +553,13 @@ config RISCV_IMSIC > select GENERIC_IRQ_MATRIX_ALLOCATOR > select GENERIC_MSI_IRQ >=20=20 > +config RISCV_IMSIC_PCI > + bool > + depends on RISCV_IMSIC > + depends on PCI > + depends on PCI_MSI > + default RISCV_IMSIC > + > config EXYNOS_IRQ_COMBINER > bool "Samsung Exynos IRQ combiner support" if COMPILE_TEST > depends on (ARCH_EXYNOS && ARM) || COMPILE_TEST > diff --git a/drivers/irqchip/irq-riscv-imsic-platform.c b/drivers/irqchip= /irq-riscv-imsic-platform.c > index e2344fc08dca..90ddcdd0bba5 100644 > --- a/drivers/irqchip/irq-riscv-imsic-platform.c > +++ b/drivers/irqchip/irq-riscv-imsic-platform.c > @@ -14,6 +14,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -208,6 +209,28 @@ static const struct irq_domain_ops imsic_base_domain= _ops =3D { > #endif > }; >=20=20 > +#ifdef CONFIG_RISCV_IMSIC_PCI > + > +static void imsic_pci_mask_irq(struct irq_data *d) > +{ > + pci_msi_mask_irq(d); > + irq_chip_mask_parent(d); > +} > + > +static void imsic_pci_unmask_irq(struct irq_data *d) > +{ > + irq_chip_unmask_parent(d); > + pci_msi_unmask_irq(d); > +} > + > +#define MATCH_PCI_MSI BIT(DOMAIN_BUS_PCI_MSI) > + > +#else > + > +#define MATCH_PCI_MSI 0 > + > +#endif > + > static bool imsic_init_dev_msi_info(struct device *dev, > struct irq_domain *domain, > struct irq_domain *real_parent, > @@ -231,6 +254,13 @@ static bool imsic_init_dev_msi_info(struct device *d= ev, >=20=20 > /* Is the target supported? */ > switch (info->bus_token) { > +#ifdef CONFIG_RISCV_IMSIC_PCI > + case DOMAIN_BUS_PCI_DEVICE_MSI: > + case DOMAIN_BUS_PCI_DEVICE_MSIX: > + info->chip->irq_mask =3D imsic_pci_mask_irq; > + info->chip->irq_unmask =3D imsic_pci_unmask_irq; irq_set_affinity()? Bj=C3=B6rn