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 smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (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 199EDC001B6 for ; Sat, 27 Nov 2021 01:20:43 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id D0C2182BF5; Sat, 27 Nov 2021 01:20:42 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rEsbsskgD9tI; Sat, 27 Nov 2021 01:20:42 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp1.osuosl.org (Postfix) with ESMTPS id BE9D982C18; Sat, 27 Nov 2021 01:20:41 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id A9945C001C; Sat, 27 Nov 2021 01:20:41 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 2F07BC000A for ; Sat, 27 Nov 2021 01:20:41 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 66F0582B94 for ; Sat, 27 Nov 2021 01:20:40 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IMC8CsfsAPYL for ; Sat, 27 Nov 2021 01:20:39 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by smtp1.osuosl.org (Postfix) with ESMTPS id B23DE82BF5 for ; Sat, 27 Nov 2021 01:20:39 +0000 (UTC) Message-ID: <20211126230525.076279841@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1637976037; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=gZLgk03W9BPqX4Y47drAtN3rUO/Oc3l0uTHU4EywtJI=; b=haWzMt4KR9DWFpGWdGE1l1s2+vs+6A08HfUC3wCsW3ct8bY8hzzw5Zksb1QAtSqqKXiTLV 90HL8F+IY3f388igePB9oG82ZtrhY+pUqOOsbCmR2UT/4VVzeLQMGXQ7XBpjTJVwJYV4gI WYrto37nJcH9GJjyMqoKYfnwaCKd3a9/AJtrxjeb2TiAS5tmTf34lQJzwzHb8XlIXVJWOr i65Z3V0NA6W4UMX3WRllvGzZNGYs2fwg6buB6N3fX2WBKGLJIFIaq0bn5EZ88rtrKujv++ Pb6chN5PsN34skBdrvROx5hCigMHTKQgd0gRtXaVoWnySgsBCrEuicXBelakSw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1637976038; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=gZLgk03W9BPqX4Y47drAtN3rUO/Oc3l0uTHU4EywtJI=; b=pmIRurktZCqaSiTjEwau1BH/cen1Z4IWsZYOdf1qJ4Pt16qpjmgbTpo368LzRvhdZG1dgu sjE9naEhMlft7uAw== From: Thomas Gleixner To: LKML Subject: [patch 19/37] genirq/msi: Add msi_device_data::properties References: <20211126224100.303046749@linutronix.de> MIME-Version: 1.0 Date: Sat, 27 Nov 2021 02:20:37 +0100 (CET) Cc: Nishanth Menon , Mark Rutland , Stuart Yoder , linux-pci@vger.kernel.org, Will Deacon , Ashok Raj , Marc Zygnier , x86@kernel.org, Sinan Kaya , iommu@lists.linux-foundation.org, Bjorn Helgaas , Megha Dey , Jason Gunthorpe , Kevin Tian , Alex Williamson , Santosh Shilimkar , linux-arm-kernel@lists.infradead.org, Tero Kristo , Greg Kroah-Hartman , Vinod Koul , dmaengine@vger.kernel.org X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" Add a properties field which allows core code to store information for easy retrieval in order to replace MSI descriptor fiddling. Signed-off-by: Thomas Gleixner --- include/linux/msi.h | 17 +++++++++++++++++ kernel/irq/msi.c | 12 ++++++++++++ 2 files changed, 29 insertions(+) --- a/include/linux/msi.h +++ b/include/linux/msi.h @@ -4,6 +4,7 @@ #include #include +#include #include /* Dummy shadow structures if an architecture does not define them */ @@ -141,17 +142,33 @@ struct msi_desc { /** * msi_device_data - MSI per device data * @lock: Spinlock to protect register access + * @properties: MSI properties which are interesting to drivers * @attrs: Pointer to the sysfs attribute group * @platform_data: Platform-MSI specific data */ struct msi_device_data { raw_spinlock_t lock; + unsigned long properties; const struct attribute_group **attrs; struct platform_msi_priv_data *platform_data; }; int msi_setup_device_data(struct device *dev); +/* MSI device properties */ +#define MSI_PROP_PCI_MSI BIT(0) +#define MSI_PROP_PCI_MSIX BIT(1) +#define MSI_PROP_64BIT BIT(2) + +#ifdef CONFIG_GENERIC_MSI_IRQ +bool msi_device_has_property(struct device *dev, unsigned long prop); +#else +static inline bool msi_device_has_property(struct device *dev, unsigned long prop) +{ + return false; +} +#endif + /* Helpers to hide struct msi_desc implementation details */ #define msi_desc_to_dev(desc) ((desc)->dev) #define dev_to_msi_list(dev) (&(dev)->msi_list) --- a/kernel/irq/msi.c +++ b/kernel/irq/msi.c @@ -60,6 +60,18 @@ void free_msi_entry(struct msi_desc *ent kfree(entry); } +/** + * msi_device_has_property - Check whether a device has a specific MSI property + * @dev: Pointer to the device which is queried + * @prop: Property to check for + */ +bool msi_device_has_property(struct device *dev, unsigned long prop) +{ + if (!dev->msi.data) + return false; + return !!(dev->msi.data->properties & prop); +} + void __get_cached_msi_msg(struct msi_desc *entry, struct msi_msg *msg) { *msg = entry->msg; _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu 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 smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (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 86AD8C001B6 for ; Sat, 27 Nov 2021 01:21:54 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 388D882D75; Sat, 27 Nov 2021 01:21:54 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7QwgQxpz2YrF; Sat, 27 Nov 2021 01:21:53 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id 35B1B82D0F; Sat, 27 Nov 2021 01:21:53 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 0F3ADC001C; Sat, 27 Nov 2021 01:21:53 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id D63FFC0039 for ; Sat, 27 Nov 2021 01:21:50 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id B3409409BD for ; Sat, 27 Nov 2021 01:21:50 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp4.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=linutronix.de header.b="xp79dIyG"; dkim=neutral reason="invalid (unsupported algorithm ed25519-sha256)" header.d=linutronix.de header.b="n0jcCggl" Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fro3HkJ9c2V5 for ; Sat, 27 Nov 2021 01:21:50 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by smtp4.osuosl.org (Postfix) with ESMTPS id 147DF405EE for ; Sat, 27 Nov 2021 01:21:50 +0000 (UTC) Message-ID: <20211126230525.076279841@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1637976108; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=gZLgk03W9BPqX4Y47drAtN3rUO/Oc3l0uTHU4EywtJI=; b=xp79dIyGNDgmTEJjXN71Z8Xfu7At14n49J40mMbvfv8nGIsQqoHvql5Jc+iobCd6GL6ZRV KkXT+95Pj+0tGBUbgnMYwczfD+qvOeuU8eOohmnhF67bZ8F6PuRkyidQjnFrSfZoVmAhPI KI/cH+sYqlqcwDiJjYLlyXDwqW1xPIh4gkzj+2bP0ckGHxkFUeH0ChgrNxmedJbT4e95U2 bzTGR8SdP9gbYpejENS+BVQAZ0bOLgAwBR9G21uKf3jEVK9GmjS915gLQ75mnUIUWtV6W2 qn3fSFpz26z9PmGtVSfv9yCUyz+FU/BFP74/7Dz3eiCfjlxnO0Ai8aij76Usxg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1637976108; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=gZLgk03W9BPqX4Y47drAtN3rUO/Oc3l0uTHU4EywtJI=; b=n0jcCgglyPxdujvHRkzGdijwiCCbyDbNbX4G0/wEb9NPhuiMspG0Yspf+c+g1FjbewuoTB xyO9gV4w5SWJ/LAQ== From: Thomas Gleixner To: LKML Subject: [patch 19/37] genirq/msi: Add msi_device_data::properties References: <20211126224100.303046749@linutronix.de> MIME-Version: 1.0 Date: Sat, 27 Nov 2021 02:21:47 +0100 (CET) Cc: Nishanth Menon , Mark Rutland , Stuart Yoder , linux-pci@vger.kernel.org, Will Deacon , Ashok Raj , Marc Zygnier , x86@kernel.org, Sinan Kaya , iommu@lists.linux-foundation.org, Bjorn Helgaas , Megha Dey , Jason Gunthorpe , Kevin Tian , Alex Williamson , Santosh Shilimkar , linux-arm-kernel@lists.infradead.org, Tero Kristo , Greg Kroah-Hartman , Vinod Koul , dmaengine@vger.kernel.org X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" Message-ID: <20211127012147.HMSTniDWDBJ_rD1onO4FvbICXsvLoL6jB1ERaYQZKnY@z> Add a properties field which allows core code to store information for easy retrieval in order to replace MSI descriptor fiddling. Signed-off-by: Thomas Gleixner --- include/linux/msi.h | 17 +++++++++++++++++ kernel/irq/msi.c | 12 ++++++++++++ 2 files changed, 29 insertions(+) --- a/include/linux/msi.h +++ b/include/linux/msi.h @@ -4,6 +4,7 @@ #include #include +#include #include /* Dummy shadow structures if an architecture does not define them */ @@ -141,17 +142,33 @@ struct msi_desc { /** * msi_device_data - MSI per device data * @lock: Spinlock to protect register access + * @properties: MSI properties which are interesting to drivers * @attrs: Pointer to the sysfs attribute group * @platform_data: Platform-MSI specific data */ struct msi_device_data { raw_spinlock_t lock; + unsigned long properties; const struct attribute_group **attrs; struct platform_msi_priv_data *platform_data; }; int msi_setup_device_data(struct device *dev); +/* MSI device properties */ +#define MSI_PROP_PCI_MSI BIT(0) +#define MSI_PROP_PCI_MSIX BIT(1) +#define MSI_PROP_64BIT BIT(2) + +#ifdef CONFIG_GENERIC_MSI_IRQ +bool msi_device_has_property(struct device *dev, unsigned long prop); +#else +static inline bool msi_device_has_property(struct device *dev, unsigned long prop) +{ + return false; +} +#endif + /* Helpers to hide struct msi_desc implementation details */ #define msi_desc_to_dev(desc) ((desc)->dev) #define dev_to_msi_list(dev) (&(dev)->msi_list) --- a/kernel/irq/msi.c +++ b/kernel/irq/msi.c @@ -60,6 +60,18 @@ void free_msi_entry(struct msi_desc *ent kfree(entry); } +/** + * msi_device_has_property - Check whether a device has a specific MSI property + * @dev: Pointer to the device which is queried + * @prop: Property to check for + */ +bool msi_device_has_property(struct device *dev, unsigned long prop) +{ + if (!dev->msi.data) + return false; + return !!(dev->msi.data->properties & prop); +} + void __get_cached_msi_msg(struct msi_desc *entry, struct msi_msg *msg) { *msg = entry->msg; _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu