From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D6861C48BF6 for ; Thu, 7 Mar 2024 14:04:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=HzgniybiGMefTOhQ136QDyCQbPXosB+CrKq+NBWuPx8=; b=ew9DbqX6i5p2U0 Tsk0oprCe0f+Zh5CuE4uCeXImbnFbHQgIDN1Iwb3289t+L6Sz4OWadP4tVSMmLJBQareujJkii1yV IEbd0LPWRsuSl+3p7Bl5bYHmAlwLckMuDHPcySenswnFA/hvXfqrxCafPyiTIofGHkv4Lfn/LhuYJ yWmrKleeb+jzRwwYZJhIkA4JNCO1+WNFjZJTPSJIBOLXW7bync2BVa/xq9mHJWKeMtj+9UI3oYbUF 3flS4sNAGD0Ey1M7ao8NzkbnzVG2ZexE6p2w/Y9q5skz2t+X6Da39hu2IR3lPl850MYyqOExVmpHb ofW46nX3wf1TeYzTFkiQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1riEM0-00000004w1O-1K64; Thu, 07 Mar 2024 14:04:12 +0000 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1riELY-00000004vdF-2Tgb for linux-riscv@lists.infradead.org; Thu, 07 Mar 2024 14:03:55 +0000 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-1dbae7b8ff2so7720375ad.3 for ; Thu, 07 Mar 2024 06:03:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1709820223; x=1710425023; darn=lists.infradead.org; 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=7jRh4tMvuYcqr95qV4EQU7BolCnIgD6A0sDxFfSdHTU=; b=lXyH/ycDnmuzm3I/vfiMNSw6NwKWi6HYHPB0exD/Dp+qS8KHIufnpS9pLLDVrI6udv mUR2HmqphFjciLJ+1X78TCDriXPBQZZGVJcV1Qt3dYC2vCvaX1zB63D74pfztYOfTsJI g3TcTkmkQwet0TU9G0qRv53ssDVP3Ym+uIMwkBY8rguNxq73eof6A/nfVqXbOzDxJcf7 hpXY79zQAhi6x5QuZ6pRc/BUOr6y0D68hmqCsbzTSZaH4ykBVKah1zIR2YCQLLSTrgFA /wDuLp4hHLES4Gu7MI0NEeD5guD5QyYAk77t9g7+jszgFipxGXA5m8vDLe5LaJ456YbH 2JaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709820223; x=1710425023; 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=7jRh4tMvuYcqr95qV4EQU7BolCnIgD6A0sDxFfSdHTU=; b=B8ApRrne8IhfNKf0H3UUGjcpztx6my1y02XVXoVVVck9RDUEbHm1Vsk77Aa4RiI1OM O+k1GBVLmXUxpk8I0A6ji8kbRRI8vEVLAPG4KA+H9timkri/uSaCPW4rELcTE+g7hfGa fZYS5Gp3shPTME1iXPl48AbM/CzgXDnB4noSoqi5R9sLg4RhGvOq2GXabL+Jf7BlhPT5 gyJ35f0sxPJwmDNPOxN8kDJIniIROqgY8zK1NXL/Z2eA05O0Ty6JVlxnVHM1/nBx2pKP 68UK1QWK8VphkjWzJ7nHbql7JAWcwspvVL9EQTgDnkEhLQdnrA7DRsub7GRiDrMDmREh miaQ== X-Forwarded-Encrypted: i=1; AJvYcCWWSlH9w2TCVP++/sybiZ+5DlueqfFJvLpLqtv2bNCLPHgqqLMICH4lU7Q7YnNIL1f2/mU7cFhHZI7hoaBc6tieivg/2LamfyrbLc28TWTK X-Gm-Message-State: AOJu0YyP5Wunc2TH7k27UsjOPOqZWztqPmQcFdopi3vy6dkumj1dha3R RqJfeHp++J95Rdcryy2gWcyeME0lFRNY+mrd/0r88NMpM+kWCCjyUvLKmcCpCw0= X-Google-Smtp-Source: AGHT+IHGmxFeZ72Q590ilBqOWS3an5Vyy6hLjQbRDQ0n1Sbt0i2JyCIRAP1shhfNGwpiSrO/aex5oA== X-Received: by 2002:a17:903:2305:b0:1dc:6fec:15d8 with SMTP id d5-20020a170903230500b001dc6fec15d8mr9709155plh.47.1709820223228; Thu, 07 Mar 2024 06:03:43 -0800 (PST) Received: from anup-ubuntu-vm.localdomain ([171.76.84.79]) by smtp.gmail.com with ESMTPSA id w1-20020a1709026f0100b001dd6174c651sm386228plk.149.2024.03.07.06.03.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 06:03:42 -0800 (PST) From: Anup Patel To: Palmer Dabbelt , Paul Walmsley , Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Frank Rowand , Conor Dooley Subject: [PATCH v16 4/9] irqchip/riscv-imsic: Add device MSI domain support for PCI devices Date: Thu, 7 Mar 2024 19:33:02 +0530 Message-Id: <20240307140307.646078-5-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240307140307.646078-1-apatel@ventanamicro.com> References: <20240307140307.646078-1-apatel@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240307_060344_883984_54DBE8A9 X-CRM114-Status: GOOD ( 14.59 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , devicetree@vger.kernel.org, Saravana Kannan , Marc Zyngier , Anup Patel , linux-kernel@vger.kernel.org, =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Atish Patra , linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Andrew Jones Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org 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/irqchip/irq-riscv-imsic-platform.c index 35291bf90d65..1e6dddfd3046 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 @@ -207,6 +208,28 @@ static const struct irq_domain_ops imsic_base_domain_ops = { #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, @@ -230,6 +253,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 = imsic_pci_mask_irq; + info->chip->irq_unmask = imsic_pci_unmask_irq; + break; +#endif case DOMAIN_BUS_DEVICE_MSI: /* * Per-device MSI should never have any MSI feature bits @@ -269,11 +299,12 @@ static bool imsic_init_dev_msi_info(struct device *dev, #define MATCH_PLATFORM_MSI BIT(DOMAIN_BUS_PLATFORM_MSI) static const struct msi_parent_ops imsic_msi_parent_ops = { - .supported_flags = MSI_GENERIC_FLAGS_MASK, + .supported_flags = MSI_GENERIC_FLAGS_MASK | + MSI_FLAG_PCI_MSIX, .required_flags = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS, .bus_select_token = DOMAIN_BUS_NEXUS, - .bus_select_mask = MATCH_PLATFORM_MSI, + .bus_select_mask = MATCH_PCI_MSI | MATCH_PLATFORM_MSI, .init_dev_msi_info = imsic_init_dev_msi_info, }; -- 2.34.1 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 20BB7C54798 for ; Thu, 7 Mar 2024 15:06:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=IErKfdUmnm2EkUPmVfHFivflgJRQiOItr1VlT3ouM9w=; b=twd9SaaalS1DKO JgtPZ3Ii/4oKllcVDckLZdRDIXOXA8MHbRWshONnXx3zO23E7rfx8q3VmfruLZAntWxzDeqHdEFre NlBB2xAQC5c3X39rsQ2u4wXsphOkombPHg/HcXqQAm1OzgScP/6y6GIxnP5TVk9tgd6c8j4E97u6w u5wH0qdomBTU1uYv+8RZ6832fqjco/9xlBITFA2O7CuC6lhOXNSF9RvnKVf1WNFBh+BcyQKjyH6NC dXM39U54KPyQljVQLqFXl049sumR3BC+B/WlBL9WybI0EUlOCGIcVRH29u3S+DvOk9bDf4WCUvF/O yK2YxEy4DyvNUbTDyQkg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1riFKR-00000005BxH-0Ojj; Thu, 07 Mar 2024 15:06:39 +0000 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1riELY-00000004vdE-2Z7X for linux-arm-kernel@lists.infradead.org; Thu, 07 Mar 2024 14:03:52 +0000 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1dbae7b8ff2so7720335ad.3 for ; Thu, 07 Mar 2024 06:03:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1709820223; x=1710425023; darn=lists.infradead.org; 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=7jRh4tMvuYcqr95qV4EQU7BolCnIgD6A0sDxFfSdHTU=; b=lXyH/ycDnmuzm3I/vfiMNSw6NwKWi6HYHPB0exD/Dp+qS8KHIufnpS9pLLDVrI6udv mUR2HmqphFjciLJ+1X78TCDriXPBQZZGVJcV1Qt3dYC2vCvaX1zB63D74pfztYOfTsJI g3TcTkmkQwet0TU9G0qRv53ssDVP3Ym+uIMwkBY8rguNxq73eof6A/nfVqXbOzDxJcf7 hpXY79zQAhi6x5QuZ6pRc/BUOr6y0D68hmqCsbzTSZaH4ykBVKah1zIR2YCQLLSTrgFA /wDuLp4hHLES4Gu7MI0NEeD5guD5QyYAk77t9g7+jszgFipxGXA5m8vDLe5LaJ456YbH 2JaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709820223; x=1710425023; 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=7jRh4tMvuYcqr95qV4EQU7BolCnIgD6A0sDxFfSdHTU=; b=dfumYqSmShkSgAwPWL3g2M1U4/XuAlvxJiFxh6rzk4bbmF1Xg5T8hvHnkc4MBMvobf 38YdYfkivC9qra4HB4yaQiOM7lPV00UAsdaWMdtD705zKHQQJWcaAFnjENn1F8spLxNO dWE8VlFmV0f8kPwtrZeY/aXmNf8LZxSXkzJJWxkXH+fwcFP5SQYE8GSyf4Pdpb7ToQcn pmQ1N0L/+9PcDGJGfn5U8xX0IgVRdYBHJQdPLPiFNzqYbcJJvpbcCrFmg9z4aQafvQfm kH3AsbCXnmwLUPSEtjjGiX0oG8ST7pJK9amNo7Z9RIeJGgjfvHvNztP4wwTuNfXsQI0c /7ig== X-Forwarded-Encrypted: i=1; AJvYcCWsNDH9zCfGGZiztuEC7+HWs0PJ5rN+TyqI9HugAsAD4Ed5bhK9cYFgGddcQ3paYklN9Pfh8+PrTiqooMiF/udVWwz7dS6/soer656tF/zNwLO9uPE= X-Gm-Message-State: AOJu0Yxu0LnofWByxcy+DqU0ivx3iBFltLv+jhfso16X+vUq4xgG1TJF 7/HHAthB9+jNbg54yLhyN5ZckiVp4a/9O09BoCVHTHaqfe5DlTNtBAPaR7fOCHo= X-Google-Smtp-Source: AGHT+IHGmxFeZ72Q590ilBqOWS3an5Vyy6hLjQbRDQ0n1Sbt0i2JyCIRAP1shhfNGwpiSrO/aex5oA== X-Received: by 2002:a17:903:2305:b0:1dc:6fec:15d8 with SMTP id d5-20020a170903230500b001dc6fec15d8mr9709155plh.47.1709820223228; Thu, 07 Mar 2024 06:03:43 -0800 (PST) Received: from anup-ubuntu-vm.localdomain ([171.76.84.79]) by smtp.gmail.com with ESMTPSA id w1-20020a1709026f0100b001dd6174c651sm386228plk.149.2024.03.07.06.03.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 06:03:42 -0800 (PST) From: Anup Patel To: Palmer Dabbelt , Paul Walmsley , Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Frank Rowand , Conor Dooley Cc: Marc Zyngier , =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Atish Patra , Andrew Jones , Sunil V L , Saravana Kannan , Anup Patel , linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Anup Patel Subject: [PATCH v16 4/9] irqchip/riscv-imsic: Add device MSI domain support for PCI devices Date: Thu, 7 Mar 2024 19:33:02 +0530 Message-Id: <20240307140307.646078-5-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240307140307.646078-1-apatel@ventanamicro.com> References: <20240307140307.646078-1-apatel@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240307_060344_935349_C953474C X-CRM114-Status: GOOD ( 16.17 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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/irqchip/irq-riscv-imsic-platform.c index 35291bf90d65..1e6dddfd3046 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 @@ -207,6 +208,28 @@ static const struct irq_domain_ops imsic_base_domain_ops = { #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, @@ -230,6 +253,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 = imsic_pci_mask_irq; + info->chip->irq_unmask = imsic_pci_unmask_irq; + break; +#endif case DOMAIN_BUS_DEVICE_MSI: /* * Per-device MSI should never have any MSI feature bits @@ -269,11 +299,12 @@ static bool imsic_init_dev_msi_info(struct device *dev, #define MATCH_PLATFORM_MSI BIT(DOMAIN_BUS_PLATFORM_MSI) static const struct msi_parent_ops imsic_msi_parent_ops = { - .supported_flags = MSI_GENERIC_FLAGS_MASK, + .supported_flags = MSI_GENERIC_FLAGS_MASK | + MSI_FLAG_PCI_MSIX, .required_flags = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS, .bus_select_token = DOMAIN_BUS_NEXUS, - .bus_select_mask = MATCH_PLATFORM_MSI, + .bus_select_mask = MATCH_PCI_MSI | MATCH_PLATFORM_MSI, .init_dev_msi_info = imsic_init_dev_msi_info, }; -- 2.34.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 23D7812FB26 for ; Thu, 7 Mar 2024 14:03:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709820225; cv=none; b=LKherqhmSgoCATmU8q2+eNY5TYg7oqVL5WABEED68+gLPnwc8azmHw167Y/Qn8qUX+x0rEVcIeID2QatlppTdun0mZV4ccLdUj4fQSpfY6uswGXe74AlGqjcbBVNSO/0tXDCOCprDzhBFZyWw6j8cTvOZcgnsJFvaOlBDCKI+3M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709820225; c=relaxed/simple; bh=1EX8L1zE26OQw962MFbAys4CFWP3ww+6xmUKKdVPt6M=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=oKoBw/6+CKCGgowkvOIjKZLAs5Hxy5++l5sA8WG/mV0bv3VfvS+ZnjBwZvPCPg9wKIgGjjdP5qCbhN8/LtH6EwwCfp+rLGxo1Cj1wttywP5RnZFh5B9wyFgRsfNoQMww8DVNThYR7u2DxvA7oVSicCRUTUvGUqCGOFcc7f8fiu8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com; spf=pass smtp.mailfrom=ventanamicro.com; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b=DNNuBKbm; arc=none smtp.client-ip=209.85.214.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="DNNuBKbm" Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1dd1d9daf02so5912855ad.1 for ; Thu, 07 Mar 2024 06:03:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1709820223; x=1710425023; darn=vger.kernel.org; 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=7jRh4tMvuYcqr95qV4EQU7BolCnIgD6A0sDxFfSdHTU=; b=DNNuBKbmwN1VVcdUTPogTr+dhdA+Ow3h5WIV4WP1kHzxFC2m2aBfMBpSO249uaqIu5 Y9aGMrK6qLe+ZKGcuWuU0OeBSe2Be7DOzQ8JIp49fCkoKeiucAcz/PN5AwI7vsjOvYOd YN+AUgA74CZcgqRAWpdl1dY9Othag/wHa1ev8gCDQUjSNN3797do+QU865+KiScUlWwT spSgjycvgsdNn+89z7V9OAYrZ4kQxE334Lz+FAANlHG1P0sBICI3zmZsN/fXRE31XDfC U1H4hkiLj4ai1HnezmkpC47Zt+4M6MLkAhi2jqR1wi65hicrQl09Da8nytG4egnwG7UX 0F5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709820223; x=1710425023; 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=7jRh4tMvuYcqr95qV4EQU7BolCnIgD6A0sDxFfSdHTU=; b=jk49E6BcYAoMeTIrIVXg4Ym6fTTfu8Df5LHL3PMg86rbPTXuenVLWbv0GOJ+Qg20L7 bBWND3W8NuHTxL/ZOYuFJFamhvKFIlbqhfWLuY1WckU4ofpogVtKrLxzWliwLWogVAje DRQ+LOvc6SkH3Jh1dBTNXPHJ5yOrsAX3K2EnPl5/2wFAtFaRx3ZaMTVUMsT+G+7dL83C C1TzuMUUsQiRugLMmBpFcMMZf2aGNTK/9rsMLMbxP0oNXhul5Kzi6LSTFiNIGE8N41dF GWdQDtpQemwYgFgkXXZ9scHAJerkPtC8AgGaxKmXP5gBQ7/h/0W5u8X4SV/WjOKhU0IX gRGg== X-Forwarded-Encrypted: i=1; AJvYcCVN4dzPNZCVXvExxuKNZw9+0onwMnzSkSfrhkohVTcva/qiiDxN7v7DzwMJQGDSb8Rt2nPFdHw10vZtLLT+/IAodLy/jfsba1tFTg== X-Gm-Message-State: AOJu0YzWErkT7Z7KmhThe6mTAvriesfbudzdfVgJZ1IFQ6y+mqv33n91 M0uMSHVEUqBL9Z4QyGuYQvXcH3ZoRb/cnprukzTRX9anhjr/s77wmBOY0sRGw0s= X-Google-Smtp-Source: AGHT+IHGmxFeZ72Q590ilBqOWS3an5Vyy6hLjQbRDQ0n1Sbt0i2JyCIRAP1shhfNGwpiSrO/aex5oA== X-Received: by 2002:a17:903:2305:b0:1dc:6fec:15d8 with SMTP id d5-20020a170903230500b001dc6fec15d8mr9709155plh.47.1709820223228; Thu, 07 Mar 2024 06:03:43 -0800 (PST) Received: from anup-ubuntu-vm.localdomain ([171.76.84.79]) by smtp.gmail.com with ESMTPSA id w1-20020a1709026f0100b001dd6174c651sm386228plk.149.2024.03.07.06.03.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 06:03:42 -0800 (PST) From: Anup Patel To: Palmer Dabbelt , Paul Walmsley , Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Frank Rowand , Conor Dooley Cc: Marc Zyngier , =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Atish Patra , Andrew Jones , Sunil V L , Saravana Kannan , Anup Patel , linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Anup Patel Subject: [PATCH v16 4/9] irqchip/riscv-imsic: Add device MSI domain support for PCI devices Date: Thu, 7 Mar 2024 19:33:02 +0530 Message-Id: <20240307140307.646078-5-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240307140307.646078-1-apatel@ventanamicro.com> References: <20240307140307.646078-1-apatel@ventanamicro.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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/irqchip/irq-riscv-imsic-platform.c index 35291bf90d65..1e6dddfd3046 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 @@ -207,6 +208,28 @@ static const struct irq_domain_ops imsic_base_domain_ops = { #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, @@ -230,6 +253,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 = imsic_pci_mask_irq; + info->chip->irq_unmask = imsic_pci_unmask_irq; + break; +#endif case DOMAIN_BUS_DEVICE_MSI: /* * Per-device MSI should never have any MSI feature bits @@ -269,11 +299,12 @@ static bool imsic_init_dev_msi_info(struct device *dev, #define MATCH_PLATFORM_MSI BIT(DOMAIN_BUS_PLATFORM_MSI) static const struct msi_parent_ops imsic_msi_parent_ops = { - .supported_flags = MSI_GENERIC_FLAGS_MASK, + .supported_flags = MSI_GENERIC_FLAGS_MASK | + MSI_FLAG_PCI_MSIX, .required_flags = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS, .bus_select_token = DOMAIN_BUS_NEXUS, - .bus_select_mask = MATCH_PLATFORM_MSI, + .bus_select_mask = MATCH_PCI_MSI | MATCH_PLATFORM_MSI, .init_dev_msi_info = imsic_init_dev_msi_info, }; -- 2.34.1