Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp359063rdb; Thu, 22 Feb 2024 06:08:02 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUWLN8d3K6EL8Vh1tufcBoZ9pyGnZG26IDrLoaBLCd7+fzKFZuHAQxpZbTu36tC2wckKDR5le7/Dl8nB7SkQqztN7GrXRQciH7geMvQCw== X-Google-Smtp-Source: AGHT+IHR6EAaVo/ql8yBprTI9PhAFziDPBgyUxhcrdMHWfOjGLHDyPKWAcH2hN17syG7UdT0zJhP X-Received: by 2002:a92:c5c2:0:b0:365:27e7:4b51 with SMTP id s2-20020a92c5c2000000b0036527e74b51mr13016280ilt.8.1708610882749; Thu, 22 Feb 2024 06:08:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708610882; cv=pass; d=google.com; s=arc-20160816; b=r0lXBsVPXM861Kc1ywzyuTPwfzDtcx8tV1+dlbsf2ncozaUk2HbACFIpAv3mDVYzy2 PDYzrVdBtLCeWxVxvLYsaVvqs/CAJnwo833dpNrLxLUpMREv3ZZAom+MSSnz3mLB9703 qLwI9qUu3x6l89GA6vFM3d+/kAveVxCBLzxL5UwWPYF2MYWnKeQ8Ffm30uE/r7zx5Vvf dxhVHAWA3tAfZsqNovCYT+60PdnvyfpRj7zGBKwqufxcVTBRZijeD+Ki9kVA5/L5WeJW W+4HyrJya6T0GujjVPqXG9P1QV2vnTa2g4QBhdIeo4uOuqM4/JqDoufzQhJncanXohms jVAg== 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=KIahrOyZOI6MW9UF8vwXIgs/Byg09Q+2+EwkkI8kfog=; fh=mNdg52fuhQsqZWDSZieH+XyLeVfIrdtu+I/xof3LTzc=; b=cubk9FOXcgRW0nCl5oOWFwSKtoDPME6oQ7tmV+dJ1lLKAb9++cK66xT6cKOIseCyd7 tJuZC55onVEKKdvPJcv5zqTWPgdjWk+u+BuRqtTAM4v9ro8ejApcqyb0sUKi3KSZ+yOx KqygoAV5eXP0CC3PZaZBti3Cog0x1HWPzndn1j+rnG9oGg5HDRiPvMI6cu7Dg+Wdb8+p +xxHGfzIn6UpE81ZAIvtjk0GHEH6u/D74HeCEvD7azqoQKNZwkaxk5QkAXDD46+DF91H kc0tPe+iWGf7LpEhcaKOxlgydoZNGD9wUegoemwKh6vkyrfPQIlK7D145adPcEvaIGhS J9Jw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GIWgfYuU; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-76672-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76672-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id s2-20020a92cb02000000b003642c039234si4380871ilo.35.2024.02.22.06.08.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 06:08:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76672-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GIWgfYuU; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-76672-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76672-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id A2C6B2857CF for ; Thu, 22 Feb 2024 14:07:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 40B171474C2; Thu, 22 Feb 2024 14:05:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GIWgfYuU" 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 640221482F7; Thu, 22 Feb 2024 14:05:45 +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=1708610745; cv=none; b=IrMxD3XOXlqHptKebO+wOMK8FBYaIM8V0I68fGfuj8y9ULnebZ5LxC7Sz5GPhpdrDHuPeKQbKW5AzzolVGMd6H9TfgYq1xfZbp+uuBR2GkqQvbMmBqNiD3mzVk9H0fYwaPWufQnxTzi6LfN8PbjIdzG96ckW8elVakslpjgAcvk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708610745; c=relaxed/simple; bh=3oLeLa6rd2L74GgGe1DmbMXwWVI+cNrH91RsxvM/HdU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=CtkgZQ/YiORuA4eCX3u9uUjOlFrHHpIXsECMFEGBsTQ8CnjpTPa4IO6ARj+CMbIkmJKv9t6uwHFPn0iSyttimd9MwYTQ2W0dlFujEJ4RpnBto8XVFRUsLWEg6il8TNtN3bSyUGztFueZvRKL9MdpyjCGHvsHegO5YyBijcWrS0Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GIWgfYuU; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5DFFAC43390; Thu, 22 Feb 2024 14:05:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708610745; bh=3oLeLa6rd2L74GgGe1DmbMXwWVI+cNrH91RsxvM/HdU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=GIWgfYuUsPS4XvVO2lTxlI17U35koeY34HM6mt79Jdy7hxI109bKBGWOs/zgGbOwj c5G4vORDQGBHPM/buap+bKoyjEnq1COlebNehisFZdyb7KMz14Vaw6pGu427gsqxoB ze8LKrgoEqYOuxTFFufpQJuOqjel2fpCpj4LSQGKlV9xbWSptu/UmoyicZdGThVqHN BmqMWhQc3A9RCrxc1M/13CwnB0Me43A1TV3WAtYkKDBnHrDUpTS5M8NP6JBNDyVVVB pyX/9/tKgD7jyxA620LQigX1ApQ7KfH5puEh+QMQgDYgALF12EIuWct9Ev4v9A0IGw 9fNADVe3cCeaA== From: =?utf-8?B?QmrDtnJuIFTDtnBlbA==?= To: Anup Patel Cc: Anup Patel , Palmer Dabbelt , Paul Walmsley , Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Frank Rowand , Conor Dooley , devicetree@vger.kernel.org, Saravana Kannan , Marc Zyngier , 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: References: <20240222094006.1030709-1-apatel@ventanamicro.com> <20240222094006.1030709-14-apatel@ventanamicro.com> <87msrstzck.fsf@all.your.base.are.belong.to.us> Date: Thu, 22 Feb 2024 15:05:41 +0100 Message-ID: <87edd4twzu.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: > On Thu, Feb 22, 2024 at 6:44=E2=80=AFPM Bj=C3=B6rn T=C3=B6pel wrote: >> >> 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 >> > >> > +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/irqc= hip/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_dom= ain_ops =3D { >> > #endif >> > }; >> > >> > +#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= *dev, >> > >> > /* 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()? > > It's already set by the switch-case above. Ah, right -- the new .bus_select_token! Thank you!