From patchwork Sun Mar 31 12:34:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hawa, Hanna" X-Patchwork-Id: 10878725 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CFCB4922 for ; Sun, 31 Mar 2019 12:35:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B45A7287D1 for ; Sun, 31 Mar 2019 12:35:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A56DC28952; Sun, 31 Mar 2019 12:35:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.4 required=2.0 tests=BAYES_00,DKIM_ADSP_ALL, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 49517287D1 for ; Sun, 31 Mar 2019 12:35:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; 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=m8CSAYcNgR+4R2FA4GxLEMNFeiaFtlk5kQRKLhR4QGg=; b=AbSRFhwfG4xUKq qyXZZKdKA5evOvIbTq3tP/Ay8Up4y8OVODWspzwnSPTHSq1WCmz67mdyKiE4Mew/tElGFLmiS3zMM RLR0/51R+aSRTd2BVSjTVWw8BPTQvjkxZzTixMmwI2564bNl9Q7mzrVI7tVKl2zLQspBsgpICT0x2 sVH7mTswNTWJwqg4z9M6DM+RDtmIlTJ5L89DWHYKgI2LvlgwjnCSdGpNToqhTEyjAbENhHszJHchL 1hkfAAhKrHBk2zBqQ1WaU7ZgScr7dbtQx9MoYlPptsz+GNjuermgKFwfNAmHeYw27hAlR6qa8qySN 8epQHmllhi1XmTs3kHIg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hAZgL-0006Tt-2r; Sun, 31 Mar 2019 12:35:25 +0000 Received: from smtp-fw-33001.amazon.com ([207.171.190.10]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hAZg5-00069A-Cs for linux-arm-kernel@lists.infradead.org; Sun, 31 Mar 2019 12:35:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1554035709; x=1585571709; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=UZvniym4k0zMasC4ZjUS54wGm2H/8Ph+7ayxg+KlP/U=; b=ClTjJ4l2nbKMDoMdVZt2IfucriGWTsSzB0MScLAou4geGIEewc6W5hfC +xh7pfvd8zQzz4wMeho6WA1GB66fd+O9M5fj2gSIfV8rouEHyxbVfvf4K jT579QoFzr2l1OQAo4DFGNhBFcjZ/Kb7FOAsM6X2BtTDuDeuxfromqMZr o=; X-IronPort-AV: E=Sophos;i="5.60,292,1549929600"; d="scan'208";a="791784885" Received: from sea3-co-svc-lb6-vlan2.sea.amazon.com (HELO email-inbound-relay-2a-f14f4a47.us-west-2.amazon.com) ([10.47.22.34]) by smtp-border-fw-out-33001.sea14.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 31 Mar 2019 12:35:05 +0000 Received: from EX13MTAUEA001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan3.pdx.amazon.com [10.236.137.198]) by email-inbound-relay-2a-f14f4a47.us-west-2.amazon.com (8.14.7/8.14.7) with ESMTP id x2VCZ0xH106428 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Sun, 31 Mar 2019 12:35:03 GMT Received: from EX13D19EUB003.ant.amazon.com (10.43.166.69) by EX13MTAUEA001.ant.amazon.com (10.43.61.243) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Sun, 31 Mar 2019 12:35:03 +0000 Received: from ub6d44c9ce3e25c.ant.amazon.com (10.43.160.69) by EX13D19EUB003.ant.amazon.com (10.43.166.69) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Sun, 31 Mar 2019 12:34:53 +0000 From: Hanna Hawa To: , , , , , , , , , Subject: [PATCH 1/7] irqchip/alpine-msi: Call IOMMU DMA mapping MSI message hook Date: Sun, 31 Mar 2019 15:34:09 +0300 Message-ID: <1554035655-11352-2-git-send-email-hhhawa@amazon.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1554035655-11352-1-git-send-email-hhhawa@amazon.com> References: <1554035655-11352-1-git-send-email-hhhawa@amazon.com> MIME-Version: 1.0 X-Originating-IP: [10.43.160.69] X-ClientProxiedBy: EX13P01UWA003.ant.amazon.com (10.43.160.197) To EX13D19EUB003.ant.amazon.com (10.43.166.69) Precedence: Bulk X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190331_053509_713404_EBC4A1E6 X-CRM114-Status: UNSURE ( 9.89 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, barakw@amazon.com, hhhawa@amazon.com, vaerov@amazon.com, linux-kernel@vger.kernel.org, hanochu@amazon.com, linux-acpi@vger.kernel.org, zeev@amazon.com, dwmw@amazon.co.uk, jonnyc@amazon.com, ronenk@amazon.com, talel@amazon.com, alisaidi@amazon.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add missing IOMMU DMA mapping MSI message hook in compose_msi_msg() callback for Alpine MSIx driver, to map the MSI physical address to IOMMU IOVA for any device attached to IOMMU DMA ops domains. Signed-off-by: Hanna Hawa Co-developed-by: Vladimir Aerov Signed-off-by: Vladimir Aerov --- drivers/irqchip/irq-alpine-msi.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/irqchip/irq-alpine-msi.c b/drivers/irqchip/irq-alpine-msi.c index 23a3b87..ae2fca7 100644 --- a/drivers/irqchip/irq-alpine-msi.c +++ b/drivers/irqchip/irq-alpine-msi.c @@ -12,6 +12,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#include #include #include #include @@ -99,6 +100,12 @@ static void alpine_msix_compose_msi_msg(struct irq_data *data, msg->address_hi = upper_32_bits(msg_addr); msg->address_lo = lower_32_bits(msg_addr); msg->data = 0; + + /* + * Mapping MSI address to IOMMU IOVA, relevant for devices associated + * with IOMMU DMA ops domain. + */ + iommu_dma_map_msi_msg(data->irq, msg); } static struct msi_domain_info alpine_msix_domain_info = { From patchwork Sun Mar 31 12:34:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hawa, Hanna" X-Patchwork-Id: 10878731 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 26DA2922 for ; Sun, 31 Mar 2019 12:35:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0CF9A2894E for ; Sun, 31 Mar 2019 12:35:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0106228952; Sun, 31 Mar 2019 12:35:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.4 required=2.0 tests=BAYES_00,DKIM_ADSP_ALL, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A8C602894E for ; Sun, 31 Mar 2019 12:35:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; 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=kkmkn7vSaaTVH94NGQpovleas6f0WOjMeaIyNRQz1EA=; b=Jk/Bk4T64xQ1HZ Oo3tdorehuwnGqgudglghU4gU62WYPFMt2NraUSvPs1aMh3Bc/GlG506gq+6+deWGkZbMfnmB7EY+ FipmYK6k3HhrMv8AsbSEFFqhXjsBQVRNhr76dhAcX3b50PJLbtH714Hq848Q0JSMk8DzwcmiIg24R p6RpiNAw2tZd5TsJ3NpyxyN28HDzucl7w6PeS4n8+mQWqGmX2uJfNCKedgb3tERz8+ckbU9HFlMKP OctyI5dNlPh2rkQjnP9VJE7DLJXtZQcvhagh7hd6laspjyYYeLvi/mpnBMz36/tC/nA5hGVWPChY5 5YrN6l+2Q1ZXK6Chkb7g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hAZgW-0006lG-Az; Sun, 31 Mar 2019 12:35:36 +0000 Received: from smtp-fw-2101.amazon.com ([72.21.196.25]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hAZgE-0006Md-H4 for linux-arm-kernel@lists.infradead.org; Sun, 31 Mar 2019 12:35:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1554035718; x=1585571718; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=LueygheUPaw1ZNGW0jWSI/Ox4qFaUKEx0YKfhzY7I28=; b=HRORoOUsvKBGCgnuOTRjYOzV2wmdEmq2OTPiL+htKZy21k3EE1fykHjM 3KOPEQzS/LozKvdHNBI2Pxdtt9ko7PgrjJ/H4VOn5woC3+h8GBiPJEUm2 kAI+pYP4FcnbBslt7GxVR+UZkC5/CP6qWVyD4eGmF1kAiSksRXaC0C38r 0=; X-IronPort-AV: E=Sophos;i="5.60,292,1549929600"; d="scan'208";a="725131730" Received: from iad6-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-2c-1968f9fa.us-west-2.amazon.com) ([10.124.125.2]) by smtp-border-fw-out-2101.iad2.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 31 Mar 2019 12:35:14 +0000 Received: from EX13MTAUEA001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan2.pdx.amazon.com [10.236.137.194]) by email-inbound-relay-2c-1968f9fa.us-west-2.amazon.com (8.14.7/8.14.7) with ESMTP id x2VCZ40g055233 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Sun, 31 Mar 2019 12:35:13 GMT Received: from EX13D19EUB003.ant.amazon.com (10.43.166.69) by EX13MTAUEA001.ant.amazon.com (10.43.61.243) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Sun, 31 Mar 2019 12:35:12 +0000 Received: from ub6d44c9ce3e25c.ant.amazon.com (10.43.160.69) by EX13D19EUB003.ant.amazon.com (10.43.166.69) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Sun, 31 Mar 2019 12:35:02 +0000 From: Hanna Hawa To: , , , , , , , , , Subject: [PATCH 2/7] irqchip/alpine-msi: Update driver license to use SPDX Date: Sun, 31 Mar 2019 15:34:10 +0300 Message-ID: <1554035655-11352-3-git-send-email-hhhawa@amazon.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1554035655-11352-1-git-send-email-hhhawa@amazon.com> References: <1554035655-11352-1-git-send-email-hhhawa@amazon.com> MIME-Version: 1.0 X-Originating-IP: [10.43.160.69] X-ClientProxiedBy: EX13P01UWA003.ant.amazon.com (10.43.160.197) To EX13D19EUB003.ant.amazon.com (10.43.166.69) Precedence: Bulk X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190331_053518_716623_FD79B48F X-CRM114-Status: GOOD ( 10.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, barakw@amazon.com, hhhawa@amazon.com, vaerov@amazon.com, linux-kernel@vger.kernel.org, hanochu@amazon.com, linux-acpi@vger.kernel.org, zeev@amazon.com, dwmw@amazon.co.uk, jonnyc@amazon.com, ronenk@amazon.com, talel@amazon.com, alisaidi@amazon.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Update driver license to be in-line with Linux conventions. Signed-off-by: Hanna Hawa --- drivers/irqchip/irq-alpine-msi.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/irqchip/irq-alpine-msi.c b/drivers/irqchip/irq-alpine-msi.c index ae2fca7..ec6a606 100644 --- a/drivers/irqchip/irq-alpine-msi.c +++ b/drivers/irqchip/irq-alpine-msi.c @@ -1,13 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Annapurna Labs MSIX support services * * Copyright (C) 2016, Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Antoine Tenart - * - * This file is licensed under the terms of the GNU General Public - * License version 2. This program is licensed "as is" without any - * warranty of any kind, whether express or implied. */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt From patchwork Sun Mar 31 12:34:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hawa, Hanna" X-Patchwork-Id: 10878735 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E4A6D922 for ; Sun, 31 Mar 2019 12:36:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CAA00287D1 for ; Sun, 31 Mar 2019 12:36:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BE84B28958; Sun, 31 Mar 2019 12:36:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.4 required=2.0 tests=BAYES_00,DKIM_ADSP_ALL, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 06CC3287D1 for ; Sun, 31 Mar 2019 12:36:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; 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=zcnqFStojmrDfbVOKxzdlB8BCle0ZXG6NAYWFBrye4A=; b=UzRtTf2IaNbYGe FdzsvTI02mTe93E1X4p6UAUEswciROgydS6pWNpIfgUGpwI6HU7hx8zj+B2ZF1MHZmhui4DiB7ewo HW19G/dl+/i+XefsuyVm3YN+fhQ2m+aqI+nPqPxUEed6CgTjsKRMeDqrpZp/MTILgTt3FuY2zPJpp 2T9uK+u3/wZcp6p+18cjjsY/oYwXibbEtUgN5Lr+h2K3DDmy1aL8enEY43L+wte70vK46cj7sLeTp /1YDcySatYUDd5Svb2yDGGj23RSoLb6LbVzue3BpaIflhonYtFjFPIvq0rJdazs6uXCDzAFdlKptO pOjifWvi07p7aRVEnOaA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hAZgu-00077N-L6; Sun, 31 Mar 2019 12:36:00 +0000 Received: from smtp-fw-33001.amazon.com ([207.171.190.10]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hAZgK-0006Tq-TG for linux-arm-kernel@lists.infradead.org; Sun, 31 Mar 2019 12:35:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1554035724; x=1585571724; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=aK/dwqxRLolKxmXgGMOppvigoDjjh6QbhPfu/gXZ3uo=; b=KcOxNljK4bxht5q50PGOWQ4+UGvQWfJ57O+mIcrM/9DdT+NrNlGQGEk8 eE57wpdB7+SMtenyPZil4tqyCnZrjm7VB5ygD4IkymLJFkruwJ05kX9Gc gXxc9jWKsBAOi9wuP4aYBkWveKy7sbXZKygcLTBXvSG/DKA6aYxWBab4K g=; X-IronPort-AV: E=Sophos;i="5.60,292,1549929600"; d="scan'208";a="791784899" Received: from sea3-co-svc-lb6-vlan2.sea.amazon.com (HELO email-inbound-relay-2a-538b0bfb.us-west-2.amazon.com) ([10.47.22.34]) by smtp-border-fw-out-33001.sea14.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 31 Mar 2019 12:35:24 +0000 Received: from EX13MTAUEA001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan2.pdx.amazon.com [10.236.137.194]) by email-inbound-relay-2a-538b0bfb.us-west-2.amazon.com (8.14.7/8.14.7) with ESMTP id x2VCZJHl072025 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Sun, 31 Mar 2019 12:35:22 GMT Received: from EX13D19EUB003.ant.amazon.com (10.43.166.69) by EX13MTAUEA001.ant.amazon.com (10.43.61.243) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Sun, 31 Mar 2019 12:35:22 +0000 Received: from ub6d44c9ce3e25c.ant.amazon.com (10.43.160.69) by EX13D19EUB003.ant.amazon.com (10.43.166.69) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Sun, 31 Mar 2019 12:35:12 +0000 From: Hanna Hawa To: , , , , , , , , , Subject: [PATCH 3/7] irqchip/al-msi: Rename AL-MSIx driver Date: Sun, 31 Mar 2019 15:34:11 +0300 Message-ID: <1554035655-11352-4-git-send-email-hhhawa@amazon.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1554035655-11352-1-git-send-email-hhhawa@amazon.com> References: <1554035655-11352-1-git-send-email-hhhawa@amazon.com> MIME-Version: 1.0 X-Originating-IP: [10.43.160.69] X-ClientProxiedBy: EX13P01UWA003.ant.amazon.com (10.43.160.197) To EX13D19EUB003.ant.amazon.com (10.43.166.69) Precedence: Bulk X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190331_053525_246586_835F0CBD X-CRM114-Status: GOOD ( 18.20 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, barakw@amazon.com, hhhawa@amazon.com, vaerov@amazon.com, linux-kernel@vger.kernel.org, hanochu@amazon.com, linux-acpi@vger.kernel.org, zeev@amazon.com, dwmw@amazon.co.uk, jonnyc@amazon.com, ronenk@amazon.com, talel@amazon.com, alisaidi@amazon.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Alpine is the name of the SoC family, while AL stands for Annapurna Labs. Rename to the latter since the driver will appear in other SoC families other than Alpine. Add device tree match for "amazon/al-msix". Signed-off-by: Hanna Hawa --- arch/arm/mach-alpine/Kconfig | 2 +- arch/arm64/Kconfig.platforms | 2 +- drivers/irqchip/Kconfig | 2 +- drivers/irqchip/Makefile | 2 +- drivers/irqchip/{irq-alpine-msi.c => irq-al-msi.c} | 93 +++++++++++----------- 5 files changed, 49 insertions(+), 52 deletions(-) rename drivers/irqchip/{irq-alpine-msi.c => irq-al-msi.c} (68%) diff --git a/arch/arm/mach-alpine/Kconfig b/arch/arm/mach-alpine/Kconfig index bc04c91..2d9879a 100644 --- a/arch/arm/mach-alpine/Kconfig +++ b/arch/arm/mach-alpine/Kconfig @@ -2,7 +2,7 @@ config ARCH_ALPINE bool "Annapurna Labs Alpine platform" depends on ARCH_MULTI_V7 - select ALPINE_MSI + select AL_MSI select ARM_AMBA select ARM_GIC select GENERIC_IRQ_CHIP diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms index 251ecf3..e3e4c3c 100644 --- a/arch/arm64/Kconfig.platforms +++ b/arch/arm64/Kconfig.platforms @@ -18,7 +18,7 @@ config ARCH_SUNXI config ARCH_ALPINE bool "Annapurna Labs Alpine platform" - select ALPINE_MSI if PCI + select AL_MSI if PCI help This enables support for the Annapurna Labs Alpine Soc family. diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig index 5dcb545..79683cd 100644 --- a/drivers/irqchip/Kconfig +++ b/drivers/irqchip/Kconfig @@ -83,7 +83,7 @@ config ARMADA_370_XP_IRQ select PCI_MSI if PCI select GENERIC_IRQ_EFFECTIVE_AFF_MASK -config ALPINE_MSI +config AL_MSI bool depends on PCI select PCI_MSI diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile index 7acd0e3..c718ffc 100644 --- a/drivers/irqchip/Makefile +++ b/drivers/irqchip/Makefile @@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_IRQCHIP) += irqchip.o -obj-$(CONFIG_ALPINE_MSI) += irq-alpine-msi.o +obj-$(CONFIG_AL_MSI) += irq-al-msi.o obj-$(CONFIG_ATH79) += irq-ath79-cpu.o obj-$(CONFIG_ATH79) += irq-ath79-misc.o obj-$(CONFIG_ARCH_BCM2835) += irq-bcm2835.o diff --git a/drivers/irqchip/irq-alpine-msi.c b/drivers/irqchip/irq-al-msi.c similarity index 68% rename from drivers/irqchip/irq-alpine-msi.c rename to drivers/irqchip/irq-al-msi.c index ec6a606..a1bbefc 100644 --- a/drivers/irqchip/irq-alpine-msi.c +++ b/drivers/irqchip/irq-al-msi.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* - * Annapurna Labs MSIX support services + * Amazon's Annapurna Labs MSIX support services. * * Copyright (C) 2016, Amazon.com, Inc. or its affiliates. All Rights Reserved. * @@ -21,12 +21,11 @@ #include #include -#include /* MSIX message address format: local GIC target */ -#define ALPINE_MSIX_SPI_TARGET_CLUSTER0 BIT(16) +#define AL_MSIX_SPI_TARGET_CLUSTER0 BIT(16) -struct alpine_msix_data { +struct al_msix_data { spinlock_t msi_map_lock; phys_addr_t addr; u32 spi_first; /* The SGI number that MSIs start */ @@ -34,27 +33,27 @@ struct alpine_msix_data { unsigned long *msi_map; }; -static void alpine_msix_mask_msi_irq(struct irq_data *d) +static void al_msix_mask_msi_irq(struct irq_data *d) { pci_msi_mask_irq(d); irq_chip_mask_parent(d); } -static void alpine_msix_unmask_msi_irq(struct irq_data *d) +static void al_msix_unmask_msi_irq(struct irq_data *d) { pci_msi_unmask_irq(d); irq_chip_unmask_parent(d); } -static struct irq_chip alpine_msix_irq_chip = { +static struct irq_chip al_msix_irq_chip = { .name = "MSIx", - .irq_mask = alpine_msix_mask_msi_irq, - .irq_unmask = alpine_msix_unmask_msi_irq, + .irq_mask = al_msix_mask_msi_irq, + .irq_unmask = al_msix_unmask_msi_irq, .irq_eoi = irq_chip_eoi_parent, .irq_set_affinity = irq_chip_set_affinity_parent, }; -static int alpine_msix_allocate_sgi(struct alpine_msix_data *priv, int num_req) +static int al_msix_allocate_sgi(struct al_msix_data *priv, int num_req) { int first; @@ -74,8 +73,8 @@ static int alpine_msix_allocate_sgi(struct alpine_msix_data *priv, int num_req) return priv->spi_first + first; } -static void alpine_msix_free_sgi(struct alpine_msix_data *priv, unsigned sgi, - int num_req) +static void al_msix_free_sgi(struct al_msix_data *priv, unsigned int sgi, + int num_req) { int first = sgi - priv->spi_first; @@ -86,10 +85,9 @@ static void alpine_msix_free_sgi(struct alpine_msix_data *priv, unsigned sgi, spin_unlock(&priv->msi_map_lock); } -static void alpine_msix_compose_msi_msg(struct irq_data *data, - struct msi_msg *msg) +static void al_msix_compose_msi_msg(struct irq_data *data, struct msi_msg *msg) { - struct alpine_msix_data *priv = irq_data_get_irq_chip_data(data); + struct al_msix_data *priv = irq_data_get_irq_chip_data(data); phys_addr_t msg_addr = priv->addr; msg_addr |= (data->hwirq << 3); @@ -105,23 +103,23 @@ static void alpine_msix_compose_msi_msg(struct irq_data *data, iommu_dma_map_msi_msg(data->irq, msg); } -static struct msi_domain_info alpine_msix_domain_info = { +static struct msi_domain_info al_msix_domain_info = { .flags = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS | MSI_FLAG_PCI_MSIX, - .chip = &alpine_msix_irq_chip, + .chip = &al_msix_irq_chip, }; static struct irq_chip middle_irq_chip = { - .name = "alpine_msix_middle", + .name = "al_msix_middle", .irq_mask = irq_chip_mask_parent, .irq_unmask = irq_chip_unmask_parent, .irq_eoi = irq_chip_eoi_parent, .irq_set_affinity = irq_chip_set_affinity_parent, - .irq_compose_msi_msg = alpine_msix_compose_msi_msg, + .irq_compose_msi_msg = al_msix_compose_msi_msg, }; -static int alpine_msix_gic_domain_alloc(struct irq_domain *domain, - unsigned int virq, int sgi) +static int al_msix_gic_domain_alloc(struct irq_domain *domain, + unsigned int virq, int sgi) { struct irq_fwspec fwspec; struct irq_data *d; @@ -146,19 +144,19 @@ static int alpine_msix_gic_domain_alloc(struct irq_domain *domain, return 0; } -static int alpine_msix_middle_domain_alloc(struct irq_domain *domain, - unsigned int virq, - unsigned int nr_irqs, void *args) +static int al_msix_middle_domain_alloc(struct irq_domain *domain, + unsigned int virq, + unsigned int nr_irqs, void *args) { - struct alpine_msix_data *priv = domain->host_data; + struct al_msix_data *priv = domain->host_data; int sgi, err, i; - sgi = alpine_msix_allocate_sgi(priv, nr_irqs); + sgi = al_msix_allocate_sgi(priv, nr_irqs); if (sgi < 0) return sgi; for (i = 0; i < nr_irqs; i++) { - err = alpine_msix_gic_domain_alloc(domain, virq + i, sgi + i); + err = al_msix_gic_domain_alloc(domain, virq + i, sgi + i); if (err) goto err_sgi; @@ -171,28 +169,28 @@ static int alpine_msix_middle_domain_alloc(struct irq_domain *domain, err_sgi: while (--i >= 0) irq_domain_free_irqs_parent(domain, virq, i); - alpine_msix_free_sgi(priv, sgi, nr_irqs); + al_msix_free_sgi(priv, sgi, nr_irqs); return err; } -static void alpine_msix_middle_domain_free(struct irq_domain *domain, - unsigned int virq, - unsigned int nr_irqs) +static void al_msix_middle_domain_free(struct irq_domain *domain, + unsigned int virq, + unsigned int nr_irqs) { struct irq_data *d = irq_domain_get_irq_data(domain, virq); - struct alpine_msix_data *priv = irq_data_get_irq_chip_data(d); + struct al_msix_data *priv = irq_data_get_irq_chip_data(d); irq_domain_free_irqs_parent(domain, virq, nr_irqs); - alpine_msix_free_sgi(priv, d->hwirq, nr_irqs); + al_msix_free_sgi(priv, d->hwirq, nr_irqs); } -static const struct irq_domain_ops alpine_msix_middle_domain_ops = { - .alloc = alpine_msix_middle_domain_alloc, - .free = alpine_msix_middle_domain_free, +static const struct irq_domain_ops al_msix_middle_domain_ops = { + .alloc = al_msix_middle_domain_alloc, + .free = al_msix_middle_domain_free, }; -static int alpine_msix_init_domains(struct alpine_msix_data *priv, - struct device_node *node) +static int al_msix_init_domains(struct al_msix_data *priv, + struct device_node *node) { struct irq_domain *middle_domain, *msi_domain, *gic_domain; struct device_node *gic_node; @@ -209,8 +207,7 @@ static int alpine_msix_init_domains(struct alpine_msix_data *priv, return -ENXIO; } - middle_domain = irq_domain_add_tree(NULL, - &alpine_msix_middle_domain_ops, + middle_domain = irq_domain_add_tree(NULL, &al_msix_middle_domain_ops, priv); if (!middle_domain) { pr_err("Failed to create the MSIX middle domain\n"); @@ -220,7 +217,7 @@ static int alpine_msix_init_domains(struct alpine_msix_data *priv, middle_domain->parent = gic_domain; msi_domain = pci_msi_create_irq_domain(of_node_to_fwnode(node), - &alpine_msix_domain_info, + &al_msix_domain_info, middle_domain); if (!msi_domain) { pr_err("Failed to create MSI domain\n"); @@ -231,10 +228,9 @@ static int alpine_msix_init_domains(struct alpine_msix_data *priv, return 0; } -static int alpine_msix_init(struct device_node *node, - struct device_node *parent) +static int al_msix_init(struct device_node *node, struct device_node *parent) { - struct alpine_msix_data *priv; + struct al_msix_data *priv; struct resource res; int ret; @@ -257,8 +253,8 @@ static int alpine_msix_init(struct device_node *node, * To select the primary GIC as the target GIC, bits [18:17] must be set * to 0x0. In this case, bit 16 (SPI_TARGET_CLUSTER0) must be set. */ - priv->addr = res.start & GENMASK_ULL(63,20); - priv->addr |= ALPINE_MSIX_SPI_TARGET_CLUSTER0; + priv->addr = res.start & GENMASK_ULL(63, 20); + priv->addr |= AL_MSIX_SPI_TARGET_CLUSTER0; if (of_property_read_u32(node, "al,msi-base-spi", &priv->spi_first)) { pr_err("Unable to parse MSI base\n"); @@ -283,7 +279,7 @@ static int alpine_msix_init(struct device_node *node, pr_debug("Registering %d msixs, starting at %d\n", priv->num_spis, priv->spi_first); - ret = alpine_msix_init_domains(priv, node); + ret = al_msix_init_domains(priv, node); if (ret) goto err_map; @@ -295,4 +291,5 @@ static int alpine_msix_init(struct device_node *node, kfree(priv); return ret; } -IRQCHIP_DECLARE(alpine_msix, "al,alpine-msix", alpine_msix_init); +IRQCHIP_DECLARE(alpine_msix, "al,alpine-msix", al_msix_init); +IRQCHIP_DECLARE(al_msix, "amazon,al-msix", al_msix_init); From patchwork Sun Mar 31 12:34:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hawa, Hanna" X-Patchwork-Id: 10878739 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6BF291390 for ; Sun, 31 Mar 2019 12:36:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 50D5628956 for ; Sun, 31 Mar 2019 12:36:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 43F9828952; Sun, 31 Mar 2019 12:36:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.4 required=2.0 tests=BAYES_00,DKIM_ADSP_ALL, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DE34128952 for ; Sun, 31 Mar 2019 12:36:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; 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=H5FlyUc0/LDHADbDAZNIPcCDCPSGrez4aDN69KqmRbI=; b=WAX/nfPnwbV0f3 9ZgLOE3hpV+vjWrw/CfQ3CWIiSN9yp7vGq7ZaH++iEpRyJz3WD4kwr+8mSBjl3ig9EDLIxTaG6OQc vLMurJFmhr9E/U7nFQUN+bSIhz42fT4eRDSJPWweGt6X4FGtU+3yT4EQ+8XMZweCFaxgr+sAg6/R3 eolYLUVX8O633W9w7ZTL42RLDmGOi/amtuI+Sdtl9XY9Ypbjbvor7PXlb0XchLg0hbfcdm4lY8zGw u99aiqXgqTuf2vbYzlcZH4agWFWltBiJi7n7EZr5Pn2pQ+CTmygibAhMV3TEdrBj7pdjGsF30AmPZ kzSprPf5ViWNmeWD4raQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hAZh3-0007Gi-EZ; Sun, 31 Mar 2019 12:36:09 +0000 Received: from smtp-fw-9101.amazon.com ([207.171.184.25]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hAZgU-0006lv-Su for linux-arm-kernel@lists.infradead.org; Sun, 31 Mar 2019 12:35:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1554035734; x=1585571734; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=6IZK+5tanW/xUNL8pm7VpvQzsJDgY+GHrhJhRxnWkmQ=; b=LpSUkQYu5MieB+DRlw9YhVMDpeE6iGM7l3s68ej131YZrpxs4pxwmrJU 70l68HQcOo8BUXQlSzeTkoy7MoxUO8HyrWlzQOzc44NCdUSf6FW21qWzR R1kBlZESkIl7oGdsuWXHjHdIak1zwqshw//sCEe3SHuMBFFaeFtGv+Q87 c=; X-IronPort-AV: E=Sophos;i="5.60,292,1549929600"; d="scan'208";a="796653353" Received: from sea3-co-svc-lb6-vlan3.sea.amazon.com (HELO email-inbound-relay-2a-69849ee2.us-west-2.amazon.com) ([10.47.22.38]) by smtp-border-fw-out-9101.sea19.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 31 Mar 2019 12:35:34 +0000 Received: from EX13MTAUEA001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan3.pdx.amazon.com [10.236.137.198]) by email-inbound-relay-2a-69849ee2.us-west-2.amazon.com (8.14.7/8.14.7) with ESMTP id x2VCZR9r093438 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Sun, 31 Mar 2019 12:35:32 GMT Received: from EX13D19EUB003.ant.amazon.com (10.43.166.69) by EX13MTAUEA001.ant.amazon.com (10.43.61.243) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Sun, 31 Mar 2019 12:35:31 +0000 Received: from ub6d44c9ce3e25c.ant.amazon.com (10.43.160.69) by EX13D19EUB003.ant.amazon.com (10.43.166.69) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Sun, 31 Mar 2019 12:35:21 +0000 From: Hanna Hawa To: , , , , , , , , , Subject: [PATCH 4/7] irqchip/al-msi: Update wrong parameter naming Date: Sun, 31 Mar 2019 15:34:12 +0300 Message-ID: <1554035655-11352-5-git-send-email-hhhawa@amazon.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1554035655-11352-1-git-send-email-hhhawa@amazon.com> References: <1554035655-11352-1-git-send-email-hhhawa@amazon.com> MIME-Version: 1.0 X-Originating-IP: [10.43.160.69] X-ClientProxiedBy: EX13P01UWA003.ant.amazon.com (10.43.160.197) To EX13D19EUB003.ant.amazon.com (10.43.166.69) Precedence: Bulk X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190331_053535_438045_C94EAFD5 X-CRM114-Status: GOOD ( 15.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, barakw@amazon.com, hhhawa@amazon.com, vaerov@amazon.com, linux-kernel@vger.kernel.org, hanochu@amazon.com, linux-acpi@vger.kernel.org, zeev@amazon.com, dwmw@amazon.co.uk, jonnyc@amazon.com, ronenk@amazon.com, talel@amazon.com, alisaidi@amazon.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Update the naming of sgi parameter to be spi, and fix comments. The message interrupts target the SPIs in the target GIC, and not the SGIs. No functional change in this patch. Signed-off-by: Hanna Hawa --- drivers/irqchip/irq-al-msi.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/irqchip/irq-al-msi.c b/drivers/irqchip/irq-al-msi.c index a1bbefc..f04a311c 100644 --- a/drivers/irqchip/irq-al-msi.c +++ b/drivers/irqchip/irq-al-msi.c @@ -28,8 +28,8 @@ struct al_msix_data { spinlock_t msi_map_lock; phys_addr_t addr; - u32 spi_first; /* The SGI number that MSIs start */ - u32 num_spis; /* The number of SGIs for MSIs */ + u32 spi_first; /* The SPI number that MSIs start */ + u32 num_spis; /* The number of SPIs for MSIs */ unsigned long *msi_map; }; @@ -53,7 +53,7 @@ static struct irq_chip al_msix_irq_chip = { .irq_set_affinity = irq_chip_set_affinity_parent, }; -static int al_msix_allocate_sgi(struct al_msix_data *priv, int num_req) +static int al_msix_allocate_spi(struct al_msix_data *priv, int num_req) { int first; @@ -73,10 +73,10 @@ static int al_msix_allocate_sgi(struct al_msix_data *priv, int num_req) return priv->spi_first + first; } -static void al_msix_free_sgi(struct al_msix_data *priv, unsigned int sgi, +static void al_msix_free_spi(struct al_msix_data *priv, unsigned int spi, int num_req) { - int first = sgi - priv->spi_first; + int first = spi - priv->spi_first; spin_lock(&priv->msi_map_lock); @@ -119,7 +119,7 @@ static struct irq_chip middle_irq_chip = { }; static int al_msix_gic_domain_alloc(struct irq_domain *domain, - unsigned int virq, int sgi) + unsigned int virq, int spi) { struct irq_fwspec fwspec; struct irq_data *d; @@ -131,7 +131,7 @@ static int al_msix_gic_domain_alloc(struct irq_domain *domain, fwspec.fwnode = domain->parent->fwnode; fwspec.param_count = 3; fwspec.param[0] = 0; - fwspec.param[1] = sgi; + fwspec.param[1] = spi; fwspec.param[2] = IRQ_TYPE_EDGE_RISING; ret = irq_domain_alloc_irqs_parent(domain, virq, 1, &fwspec); @@ -149,27 +149,27 @@ static int al_msix_middle_domain_alloc(struct irq_domain *domain, unsigned int nr_irqs, void *args) { struct al_msix_data *priv = domain->host_data; - int sgi, err, i; + int spi, err, i; - sgi = al_msix_allocate_sgi(priv, nr_irqs); - if (sgi < 0) - return sgi; + spi = al_msix_allocate_spi(priv, nr_irqs); + if (spi < 0) + return spi; for (i = 0; i < nr_irqs; i++) { - err = al_msix_gic_domain_alloc(domain, virq + i, sgi + i); + err = al_msix_gic_domain_alloc(domain, virq + i, spi + i); if (err) - goto err_sgi; + goto err_spi; - irq_domain_set_hwirq_and_chip(domain, virq + i, sgi + i, + irq_domain_set_hwirq_and_chip(domain, virq + i, spi + i, &middle_irq_chip, priv); } return 0; -err_sgi: +err_spi: while (--i >= 0) irq_domain_free_irqs_parent(domain, virq, i); - al_msix_free_sgi(priv, sgi, nr_irqs); + al_msix_free_spi(priv, spi, nr_irqs); return err; } @@ -181,7 +181,7 @@ static void al_msix_middle_domain_free(struct irq_domain *domain, struct al_msix_data *priv = irq_data_get_irq_chip_data(d); irq_domain_free_irqs_parent(domain, virq, nr_irqs); - al_msix_free_sgi(priv, d->hwirq, nr_irqs); + al_msix_free_spi(priv, d->hwirq, nr_irqs); } static const struct irq_domain_ops al_msix_middle_domain_ops = { From patchwork Sun Mar 31 12:35:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hawa, Hanna" X-Patchwork-Id: 10878743 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D0682922 for ; Sun, 31 Mar 2019 12:36:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B4325287D1 for ; Sun, 31 Mar 2019 12:36:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A672728956; Sun, 31 Mar 2019 12:36:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.4 required=2.0 tests=BAYES_00,DKIM_ADSP_ALL, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 55BB9287D1 for ; Sun, 31 Mar 2019 12:36:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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:In-Reply-To:References: List-Owner; bh=lmeFVvF6sqh5nYESYnAZA9FGg7U0c5zQ2y4lIdA8MT8=; b=uXRa57rceNRqDJ vQj8gkC1HW4ieK7Szq+yfTyD/zS5+nmfMpRvjgu9PU7qCyAJAv3HHYjLDCYF2Aqc5gyBEITY0aQSm p2qqwj25O/4Okvc+TJ/DidEz5Vdzl4LgDWJ8bBnQE1ql/aWBZvHIOGOZKYPVEroX8m9hKRtmaarcn PcHGcaLWmsuo6gR+G2Mvgxm7x4Fyy1yqeKjRwfyvE9S3ywR2xmHXC0jDuZNKWeMzha6IkLdhkK1Kf f39JMeAwD47tSq4UCcq3L0bqkOEv3h+L5DpxsgRMFN+LkAWuM8sOYCRYY2yxDJVo4Sf5xR09ct1/s pyGQx+s7qdj02dEtyE2Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hAZhS-0007dV-8L; Sun, 31 Mar 2019 12:36:34 +0000 Received: from smtp-fw-9102.amazon.com ([207.171.184.29]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hAZgs-000770-FX for linux-arm-kernel@lists.infradead.org; Sun, 31 Mar 2019 12:35:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1554035758; x=1585571758; h=from:to:cc:subject:date:message-id:mime-version; bh=q0g7/L6Mk+kz0ZZ51WeqH5kQRFucRKUZKixxtnoztbA=; b=B96YOzA5HSZiiWs+1u2Ss4i3/FSPL5YdGJdTTVq/edfdOLaoceRSaXw6 sm+dyEPr1MLsn/t7Ou0iDqDN5ZxFchZTflLLnN38ZJR0abfQKM5H4Tu6C //LCot3Vig+O79vSiPKQP9Q+3DXN9NgWBzekgFjoxM0Cp0HJfATfM6qnv E=; X-IronPort-AV: E=Sophos;i="5.60,292,1549929600"; d="scan'208";a="668330398" Received: from sea3-co-svc-lb6-vlan3.sea.amazon.com (HELO email-inbound-relay-2a-e7be2041.us-west-2.amazon.com) ([10.47.22.38]) by smtp-border-fw-out-9102.sea19.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 31 Mar 2019 12:35:57 +0000 Received: from EX13MTAUEA001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan3.pdx.amazon.com [10.236.137.198]) by email-inbound-relay-2a-e7be2041.us-west-2.amazon.com (8.14.7/8.14.7) with ESMTP id x2VCZrFu111365 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Sun, 31 Mar 2019 12:35:56 GMT Received: from EX13D19EUB003.ant.amazon.com (10.43.166.69) by EX13MTAUEA001.ant.amazon.com (10.43.61.243) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Sun, 31 Mar 2019 12:35:55 +0000 Received: from ub6d44c9ce3e25c.ant.amazon.com (10.43.161.164) by EX13D19EUB003.ant.amazon.com (10.43.166.69) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Sun, 31 Mar 2019 12:35:46 +0000 From: Hanna Hawa To: , , , , , , , , , Subject: [PATCH 5/7] ACPI / irq: Add GSI IRQ domain getter function Date: Sun, 31 Mar 2019 15:35:31 +0300 Message-ID: <1554035733-11827-1-git-send-email-hhhawa@amazon.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [10.43.161.164] X-ClientProxiedBy: EX13D20UWC002.ant.amazon.com (10.43.162.163) To EX13D19EUB003.ant.amazon.com (10.43.166.69) Precedence: Bulk X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190331_053558_677407_36C4468E X-CRM114-Status: UNSURE ( 9.39 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, barakw@amazon.com, hhhawa@amazon.com, vaerov@amazon.com, linux-kernel@vger.kernel.org, hanochu@amazon.com, linux-acpi@vger.kernel.org, zeev@amazon.com, dwmw@amazon.co.uk, jonnyc@amazon.com, ronenk@amazon.com, talel@amazon.com, alisaidi@amazon.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add GSI IRQ domain getter function (acpi_get_gsi_domain_id), for IRQ drivers that use ACPI and need the IRQ parent domain to register their irq-chip device. Signed-off-by: Hanna Hawa Co-developed-by: Vladimir Aerov Signed-off-by: Vladimir Aerov --- drivers/acpi/irq.c | 13 +++++++++++++ include/linux/acpi.h | 1 + 2 files changed, 14 insertions(+) diff --git a/drivers/acpi/irq.c b/drivers/acpi/irq.c index 7c352cb..efc57b1 100644 --- a/drivers/acpi/irq.c +++ b/drivers/acpi/irq.c @@ -295,3 +295,16 @@ void __init acpi_set_irq_model(enum acpi_irq_model_id model, acpi_irq_model = model; acpi_gsi_domain_id = fwnode; } + +/** + * acpi_get_gsi_domain_id - getter for the GSI irqdomain information + * + * return: + * @fwnode: return the irq_domain identifier for mapping and looking up + * GSI interrupts + */ +struct fwnode_handle *acpi_get_gsi_domain_id(void) +{ + return acpi_gsi_domain_id; +} +EXPORT_SYMBOL_GPL(acpi_get_gsi_domain_id); diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 87715f2..642c2e2 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -322,6 +322,7 @@ int acpi_isa_irq_to_gsi (unsigned isa_irq, u32 *gsi); void acpi_set_irq_model(enum acpi_irq_model_id model, struct fwnode_handle *fwnode); +struct fwnode_handle *acpi_get_gsi_domain_id(void); #ifdef CONFIG_X86_IO_APIC extern int acpi_get_override_irq(u32 gsi, int *trigger, int *polarity); From patchwork Sun Mar 31 12:35:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hawa, Hanna" X-Patchwork-Id: 10878745 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 39CA81390 for ; Sun, 31 Mar 2019 12:36:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1B5F5287D1 for ; Sun, 31 Mar 2019 12:36:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0EB7828956; Sun, 31 Mar 2019 12:36:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.4 required=2.0 tests=BAYES_00,DKIM_ADSP_ALL, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A3350287D1 for ; Sun, 31 Mar 2019 12:36:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; 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=gsuH06gXTOkJcWq2miNxMG9Vn9+joS2OBt1AcGbvW/I=; b=BoKxzF5wQO3biN MGnKYsVAlpOoh968/wlqJVPeqJbwlsDE4vjD1CUnvwFe2bwbf5p6P6YFeiCOaJtrJw3ApKXrLYzw/ 4Sv048rHEBLVB2WQqpFNJe4DhuCpec9R3yrwhZv6E3Fp5up01EmAdnTc1B3qe9kYIYpOxfdMq2ku1 zgVB8Olb3LT3fmygkkiPh8XHlZ4v0sfao3/YtpHivwnL3qA0ndPGHfY2Dhg5v6yn3S6f4GUT1BSyu O+dViwxH+Rlr48DJw/NuTy1xKnIqEzw2MpFIMbP34nDSmD0YTq6oSiZHo/r8LuJVlkaU/HQpgvMfs +SetPS4r8HqD+9CxeZdw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hAZhb-0007my-2v; Sun, 31 Mar 2019 12:36:43 +0000 Received: from smtp-fw-9101.amazon.com ([207.171.184.25]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hAZh1-0007Fb-8F for linux-arm-kernel@lists.infradead.org; Sun, 31 Mar 2019 12:36:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1554035767; x=1585571767; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=f75KH28fv28tMQnTi4YCDX6svGZMrzqSuQYdRGpSroY=; b=TQjsvR+MGpFDKSiBPB5p/Jh6nCuDCdtd18ooTJkhiDh4/0x9suJQ2MPy uGTOofAbkyJG7f7e8YgplhZbf4Gmww0ANwGTnqzBpUS3IcFb2/VQYlFJA XJ7QUvKpkATGJWkOGdHHqj0YurhOXDBJUZSgmA71UPVZXIXyGJxZ2u1UP U=; X-IronPort-AV: E=Sophos;i="5.60,292,1549929600"; d="scan'208";a="796653386" Received: from sea3-co-svc-lb6-vlan3.sea.amazon.com (HELO email-inbound-relay-2b-5bdc5131.us-west-2.amazon.com) ([10.47.22.38]) by smtp-border-fw-out-9101.sea19.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 31 Mar 2019 12:36:06 +0000 Received: from EX13MTAUEA001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan2.pdx.amazon.com [10.236.137.194]) by email-inbound-relay-2b-5bdc5131.us-west-2.amazon.com (8.14.7/8.14.7) with ESMTP id x2VCa1fM066769 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Sun, 31 Mar 2019 12:36:06 GMT Received: from EX13D19EUB003.ant.amazon.com (10.43.166.69) by EX13MTAUEA001.ant.amazon.com (10.43.61.243) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Sun, 31 Mar 2019 12:36:05 +0000 Received: from ub6d44c9ce3e25c.ant.amazon.com (10.43.161.164) by EX13D19EUB003.ant.amazon.com (10.43.166.69) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Sun, 31 Mar 2019 12:35:55 +0000 From: Hanna Hawa To: , , , , , , , , , Subject: [PATCH 6/7] irqchip/al-msi: Refactor in preparation to add ACPI support Date: Sun, 31 Mar 2019 15:35:32 +0300 Message-ID: <1554035733-11827-2-git-send-email-hhhawa@amazon.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1554035733-11827-1-git-send-email-hhhawa@amazon.com> References: <1554035733-11827-1-git-send-email-hhhawa@amazon.com> MIME-Version: 1.0 X-Originating-IP: [10.43.161.164] X-ClientProxiedBy: EX13D20UWC002.ant.amazon.com (10.43.162.163) To EX13D19EUB003.ant.amazon.com (10.43.166.69) Precedence: Bulk X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190331_053607_878658_3EDF521A X-CRM114-Status: GOOD ( 14.69 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, barakw@amazon.com, hhhawa@amazon.com, vaerov@amazon.com, linux-kernel@vger.kernel.org, hanochu@amazon.com, linux-acpi@vger.kernel.org, zeev@amazon.com, dwmw@amazon.co.uk, jonnyc@amazon.com, ronenk@amazon.com, talel@amazon.com, alisaidi@amazon.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Move common parts which will be shared between DT and ACPI parsing, to a common function. Signed-off-by: Hanna Hawa --- drivers/irqchip/irq-al-msi.c | 87 +++++++++++++++++++++++++------------------- 1 file changed, 49 insertions(+), 38 deletions(-) diff --git a/drivers/irqchip/irq-al-msi.c b/drivers/irqchip/irq-al-msi.c index f04a311c..ec27455 100644 --- a/drivers/irqchip/irq-al-msi.c +++ b/drivers/irqchip/irq-al-msi.c @@ -26,6 +26,7 @@ #define AL_MSIX_SPI_TARGET_CLUSTER0 BIT(16) struct al_msix_data { + struct fwnode_handle *msi_domain_handle; spinlock_t msi_map_lock; phys_addr_t addr; u32 spi_first; /* The SPI number that MSIs start */ @@ -190,22 +191,9 @@ static const struct irq_domain_ops al_msix_middle_domain_ops = { }; static int al_msix_init_domains(struct al_msix_data *priv, - struct device_node *node) + struct irq_domain *gic_domain) { - struct irq_domain *middle_domain, *msi_domain, *gic_domain; - struct device_node *gic_node; - - gic_node = of_irq_find_parent(node); - if (!gic_node) { - pr_err("Failed to find the GIC node\n"); - return -ENODEV; - } - - gic_domain = irq_find_host(gic_node); - if (!gic_domain) { - pr_err("Failed to find the GIC domain\n"); - return -ENXIO; - } + struct irq_domain *middle_domain, *msi_domain; middle_domain = irq_domain_add_tree(NULL, &al_msix_middle_domain_ops, priv); @@ -216,7 +204,7 @@ static int al_msix_init_domains(struct al_msix_data *priv, middle_domain->parent = gic_domain; - msi_domain = pci_msi_create_irq_domain(of_node_to_fwnode(node), + msi_domain = pci_msi_create_irq_domain(priv->msi_domain_handle, &al_msix_domain_info, middle_domain); if (!msi_domain) { @@ -228,34 +216,62 @@ static int al_msix_init_domains(struct al_msix_data *priv, return 0; } +static int al_msix_init_common(struct al_msix_data *priv, u64 base_address) +{ + spin_lock_init(&priv->msi_map_lock); + + /* + * The 20 least significant bits of addr provide direct information + * regarding the interrupt destination. + * + * To select the primary GIC as the target GIC, bits [18:17] must be set + * to 0x0. In this case, bit 16 (SPI_TARGET_CLUSTER0) must be set. + */ + priv->addr = base_address & GENMASK_ULL(63, 20); + priv->addr |= AL_MSIX_SPI_TARGET_CLUSTER0; + + priv->msi_map = kcalloc(BITS_TO_LONGS(priv->num_spis), + sizeof(*priv->msi_map), + GFP_KERNEL); + if (!priv->msi_map) + return -ENOMEM; + + pr_debug("Registering %d msixs, starting at %d\n", priv->num_spis, + priv->spi_first); + + return 0; +} + static int al_msix_init(struct device_node *node, struct device_node *parent) { struct al_msix_data *priv; struct resource res; + struct device_node *gic_node; + struct irq_domain *gic_domain; int ret; + gic_node = of_irq_find_parent(node); + if (!gic_node) { + pr_err("Failed to find the GIC node\n"); + return -ENODEV; + } + + gic_domain = irq_find_host(gic_node); + if (!gic_domain) { + pr_err("Failed to find the GIC domain\n"); + return -ENXIO; + } + priv = kzalloc(sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; - spin_lock_init(&priv->msi_map_lock); - ret = of_address_to_resource(node, 0, &res); if (ret) { pr_err("Failed to allocate resource\n"); goto err_priv; } - /* - * The 20 least significant bits of addr provide direct information - * regarding the interrupt destination. - * - * To select the primary GIC as the target GIC, bits [18:17] must be set - * to 0x0. In this case, bit 16 (SPI_TARGET_CLUSTER0) must be set. - */ - priv->addr = res.start & GENMASK_ULL(63, 20); - priv->addr |= AL_MSIX_SPI_TARGET_CLUSTER0; - if (of_property_read_u32(node, "al,msi-base-spi", &priv->spi_first)) { pr_err("Unable to parse MSI base\n"); ret = -EINVAL; @@ -268,18 +284,13 @@ static int al_msix_init(struct device_node *node, struct device_node *parent) goto err_priv; } - priv->msi_map = kcalloc(BITS_TO_LONGS(priv->num_spis), - sizeof(*priv->msi_map), - GFP_KERNEL); - if (!priv->msi_map) { - ret = -ENOMEM; - goto err_priv; - } + priv->msi_domain_handle = of_node_to_fwnode(node); - pr_debug("Registering %d msixs, starting at %d\n", - priv->num_spis, priv->spi_first); + ret = al_msix_init_common(priv, res.start); + if (ret) + goto err_priv; - ret = al_msix_init_domains(priv, node); + ret = al_msix_init_domains(priv, gic_domain); if (ret) goto err_map; From patchwork Sun Mar 31 12:35:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hawa, Hanna" X-Patchwork-Id: 10878747 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 70929922 for ; Sun, 31 Mar 2019 12:36:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5573B287D1 for ; Sun, 31 Mar 2019 12:36:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 48F7728956; Sun, 31 Mar 2019 12:36:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.4 required=2.0 tests=BAYES_00,DKIM_ADSP_ALL, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D1A2D287D1 for ; Sun, 31 Mar 2019 12:36:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; 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=2A/CCTCt4WEybu41PKs68sALMImv+f34FdrkJJI99mQ=; b=Sxe/mb0YUvvulZ mt1QiCuWYSx6Dhny5E6oPRyEYhZbqrsG9qi+BtRY6uc4VyM/bje/S4qiG+UDyqXMqK17XFQjFSHcb kQtnecWwCePhohr+UORScDBmVbbjeNLnstCrBjCYFnQoHWJO13JGucygXcpp2otgT67z6+e1u2cXm EdF+yAj/wSnoSBBWx2DLhR7cX+iMMhrUpPGdf6IiU1CxofsM/4siKCJc/we2LhLNz2d4MSkFZVDIL wIsE9DyFGpxgi7PkElJe2btFWmkUbarJAjBDqOZU618112J7VAtWNuz9is9fMFZbSQWfF5V3Ppuc4 groSAyR3i68SOPRBfJJg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hAZhk-00081r-Kb; Sun, 31 Mar 2019 12:36:52 +0000 Received: from smtp-fw-9101.amazon.com ([207.171.184.25]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hAZhA-0007Fb-Nc for linux-arm-kernel@lists.infradead.org; Sun, 31 Mar 2019 12:36:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1554035776; x=1585571776; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=Xxf/XCRLhaUzHncFkuCeHY/pyfBo0qcyLkgrrUxQFzg=; b=NJDPQrfOeHudUiXbEEcd9ZczhlFZ6t/+RICtfT70CcbLIAoQilJ4nHy8 sh/GXicqglI/OWtHbSFPUM6bQx8UQumHgguW1aBJlH3PvpyopKBO6io+f qvj+6ddRPr5O80C1mUU5AUhtR1sOXMNtj0DHuMfMKlvWwEhN4dhvv+sYh w=; X-IronPort-AV: E=Sophos;i="5.60,292,1549929600"; d="scan'208";a="796653391" Received: from sea3-co-svc-lb6-vlan3.sea.amazon.com (HELO email-inbound-relay-2a-119b4f96.us-west-2.amazon.com) ([10.47.22.38]) by smtp-border-fw-out-9101.sea19.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 31 Mar 2019 12:36:16 +0000 Received: from EX13MTAUEA001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan3.pdx.amazon.com [10.236.137.198]) by email-inbound-relay-2a-119b4f96.us-west-2.amazon.com (8.14.7/8.14.7) with ESMTP id x2VCaCrb130523 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Sun, 31 Mar 2019 12:36:15 GMT Received: from EX13D19EUB003.ant.amazon.com (10.43.166.69) by EX13MTAUEA001.ant.amazon.com (10.43.61.243) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Sun, 31 Mar 2019 12:36:14 +0000 Received: from ub6d44c9ce3e25c.ant.amazon.com (10.43.161.164) by EX13D19EUB003.ant.amazon.com (10.43.166.69) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Sun, 31 Mar 2019 12:36:04 +0000 From: Hanna Hawa To: , , , , , , , , , Subject: [PATCH 7/7] irqchip/al-msi: Add ACPI support Date: Sun, 31 Mar 2019 15:35:33 +0300 Message-ID: <1554035733-11827-3-git-send-email-hhhawa@amazon.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1554035733-11827-1-git-send-email-hhhawa@amazon.com> References: <1554035733-11827-1-git-send-email-hhhawa@amazon.com> MIME-Version: 1.0 X-Originating-IP: [10.43.161.164] X-ClientProxiedBy: EX13D20UWC002.ant.amazon.com (10.43.162.163) To EX13D19EUB003.ant.amazon.com (10.43.166.69) Precedence: Bulk X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190331_053617_382776_BA8885C4 X-CRM114-Status: GOOD ( 15.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, barakw@amazon.com, hhhawa@amazon.com, vaerov@amazon.com, linux-kernel@vger.kernel.org, hanochu@amazon.com, linux-acpi@vger.kernel.org, zeev@amazon.com, dwmw@amazon.co.uk, jonnyc@amazon.com, ronenk@amazon.com, talel@amazon.com, alisaidi@amazon.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds ACPI support for AL-MSIx driver. The AL-MSIx controller is not standard, is not included in the UEFI specification, and will not be added. The driver ACPI binding is performed when the following conditions are true: - OEM ID is AMAZON - MADT table type is 0x80 (part of the OEM reserved range). Signed-off-by: Hanna Hawa Co-developed-by: Vladimir Aerov Signed-off-by: Vladimir Aerov --- drivers/irqchip/irq-al-msi.c | 118 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 111 insertions(+), 7 deletions(-) diff --git a/drivers/irqchip/irq-al-msi.c b/drivers/irqchip/irq-al-msi.c index ec27455..cb80c1e 100644 --- a/drivers/irqchip/irq-al-msi.c +++ b/drivers/irqchip/irq-al-msi.c @@ -9,6 +9,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#include #include #include #include @@ -126,14 +127,20 @@ static int al_msix_gic_domain_alloc(struct irq_domain *domain, struct irq_data *d; int ret; - if (!is_of_node(domain->parent->fwnode)) + if (is_of_node(domain->parent->fwnode)) { + fwspec.fwnode = domain->parent->fwnode; + fwspec.param_count = 3; + fwspec.param[0] = 0; + fwspec.param[1] = spi; + fwspec.param[2] = IRQ_TYPE_EDGE_RISING; + } else if (is_fwnode_irqchip(domain->parent->fwnode)) { + fwspec.fwnode = domain->parent->fwnode; + fwspec.param_count = 2; + fwspec.param[0] = spi + 32; + fwspec.param[1] = IRQ_TYPE_EDGE_RISING; + } else { return -EINVAL; - - fwspec.fwnode = domain->parent->fwnode; - fwspec.param_count = 3; - fwspec.param[0] = 0; - fwspec.param[1] = spi; - fwspec.param[2] = IRQ_TYPE_EDGE_RISING; + } ret = irq_domain_alloc_irqs_parent(domain, virq, 1, &fwspec); if (ret) @@ -304,3 +311,100 @@ static int al_msix_init(struct device_node *node, struct device_node *parent) } IRQCHIP_DECLARE(alpine_msix, "al,alpine-msix", al_msix_init); IRQCHIP_DECLARE(al_msix, "amazon,al-msix", al_msix_init); + +#ifdef CONFIG_ACPI +static struct al_msix_data *priv; + +#define ACPI_AMZN_MADT_OEM_TYPE 0x80 +#define ACPI_AMZN_OEM_ID "AMAZON" + +struct acpi_madt_msix_oem_frame { + struct acpi_subtable_header header; + u64 base_address; + u32 base_address_len; + u16 spi_count; + u16 spi_base; +}; + +static struct fwnode_handle *al_msi_get_fwnode(struct device *dev) +{ + return priv->msi_domain_handle; +} + +static int __init al_msix_acpi_probe(struct acpi_subtable_header *header, + const unsigned long end) +{ + struct irq_domain *gic_domain; + struct fwnode_handle *gic_domain_handle; + struct acpi_madt_msix_oem_frame *m; + int ret; + + m = container_of(header, struct acpi_madt_msix_oem_frame, header); + if (BAD_MADT_ENTRY(m, end)) + return -EINVAL; + + gic_domain_handle = acpi_get_gsi_domain_id(); + if (!gic_domain_handle) { + pr_err("Failed to find the GIC domain handle\n"); + return -ENXIO; + } + + gic_domain = irq_find_matching_fwnode(gic_domain_handle, + DOMAIN_BUS_ANY); + if (!gic_domain) { + pr_err("Failed to find the GIC domain\n"); + return -ENXIO; + } + + priv = kzalloc(sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + priv->spi_first = m->spi_base; + priv->num_spis = m->spi_count; + + priv->msi_domain_handle = irq_domain_alloc_fwnode((void *) + m->base_address); + if (!priv->msi_domain_handle) { + pr_err("Unable to allocate msi domain token\n"); + ret = -EINVAL; + goto err_acpi_priv; + } + + ret = al_msix_init_common(priv, m->base_address); + if (ret) + goto err_acpi_priv; + + ret = al_msix_init_domains(priv, gic_domain); + if (ret) + goto err_acpi_map; + + pci_msi_register_fwnode_provider(&al_msi_get_fwnode); + + return 0; + +err_acpi_map: + kfree(priv->msi_map); +err_acpi_priv: + kfree(priv); + return ret; +} + +static int __init al_msix_acpi_init(void) +{ + static struct acpi_table_madt *madt; + acpi_status status; + + /* if ACPI MADT table is not Amazon defined return */ + status = acpi_get_table(ACPI_SIG_MADT, 0, + (struct acpi_table_header **)&madt); + if (ACPI_FAILURE(status) || (madt && memcmp(madt->header.oem_id, + ACPI_AMZN_OEM_ID, + ACPI_OEM_ID_SIZE))) + return -ENODEV; + + return acpi_table_parse_madt(ACPI_AMZN_MADT_OEM_TYPE, + al_msix_acpi_probe, 0); +} +early_initcall(al_msix_acpi_init); +#endif /* CONFIG_ACPI */