From patchwork Wed Sep 28 18:21:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Tull X-Patchwork-Id: 9354701 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B215860757 for ; Wed, 28 Sep 2016 18:36:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A0100295E7 for ; Wed, 28 Sep 2016 18:36:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 901D32964D; Wed, 28 Sep 2016 18:36:06 +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.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A7C45295E7 for ; Wed, 28 Sep 2016 18:36:05 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bpJgX-0001qJ-55; Wed, 28 Sep 2016 18:34:25 +0000 Received: from mail-bl2nam02on0078.outbound.protection.outlook.com ([104.47.38.78] helo=NAM02-BL2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bpJVT-0000na-Ol for linux-arm-kernel@lists.infradead.org; Wed, 28 Sep 2016 18:23:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=altera.onmicrosoft.com; s=selector1-opensource-altera-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=JBEEoH9g3ZJiHWrJ34i9EkuaQCqkJ0E2/DLrfYoEPoM=; b=PmEwZ7uJdQ0dbe3f1y28SZa0ok5r2qLt2p/X1zJl/+2UxP6+pgsCSaOuvKjqfWgF+A3O2AdybR/pKBUEQ5yN2At9fk8ewk8iYjh3/wDICMo4oTv9JKYeCkH5s4GAqIDiMzwcbA7nGc0GPl9sRch1EsG7ePRsl2wFnmalv5UGb54= Received: from BLUPR0301CA0039.namprd03.prod.outlook.com (10.162.113.177) by DM2PR03MB495.namprd03.prod.outlook.com (10.141.85.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.639.5; Wed, 28 Sep 2016 18:22:33 +0000 Received: from BY2FFO11FD040.protection.gbl (2a01:111:f400:7c0c::121) by BLUPR0301CA0039.outlook.office365.com (2a01:111:e400:5259::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.639.5 via Frontend Transport; Wed, 28 Sep 2016 18:22:32 +0000 Authentication-Results: spf=fail (sender IP is 66.35.236.236) smtp.mailfrom=opensource.altera.com; ni.com; dkim=pass (signature was verified) header.d=altera.onmicrosoft.com; ni.com; dmarc=none action=none header.from=opensource.altera.com; Received-SPF: Fail (protection.outlook.com: domain of opensource.altera.com does not designate 66.35.236.236 as permitted sender) receiver=protection.outlook.com; client-ip=66.35.236.236; helo=sj-itexedge04.altera.priv.altera.com; Received: from sj-itexedge04.altera.priv.altera.com (66.35.236.236) by BY2FFO11FD040.mail.protection.outlook.com (10.1.14.225) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.629.5 via Frontend Transport; Wed, 28 Sep 2016 18:22:32 +0000 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (207.46.163.88) by webmail.altera.com (66.35.236.236) with Microsoft SMTP Server (TLS) id 14.3.174.1; Wed, 28 Sep 2016 11:21:34 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=altera.onmicrosoft.com; s=selector1-opensource-altera-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=JBEEoH9g3ZJiHWrJ34i9EkuaQCqkJ0E2/DLrfYoEPoM=; b=PmEwZ7uJdQ0dbe3f1y28SZa0ok5r2qLt2p/X1zJl/+2UxP6+pgsCSaOuvKjqfWgF+A3O2AdybR/pKBUEQ5yN2At9fk8ewk8iYjh3/wDICMo4oTv9JKYeCkH5s4GAqIDiMzwcbA7nGc0GPl9sRch1EsG7ePRsl2wFnmalv5UGb54= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=atull@opensource.altera.com; Received: from linuxheads99.altera.com (64.129.157.38) by BLUPR03MB1508.namprd03.prod.outlook.com (10.163.81.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.639.5; Wed, 28 Sep 2016 18:21:56 +0000 From: Alan Tull To: Rob Herring Subject: [PATCH v19 08/12] fpga: add fpga bridge framework Date: Wed, 28 Sep 2016 13:21:56 -0500 Message-ID: <20160928182200.15800-9-atull@opensource.altera.com> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20160928182200.15800-1-atull@opensource.altera.com> References: <20160928182200.15800-1-atull@opensource.altera.com> MIME-Version: 1.0 X-Originating-IP: [64.129.157.38] X-ClientProxiedBy: BY2PR1001CA0078.namprd10.prod.outlook.com (10.164.163.46) To BLUPR03MB1508.namprd03.prod.outlook.com (10.163.81.26) X-MS-Office365-Filtering-Correlation-Id: c28070e6-9fdd-47f3-34df-08d3e7cc6a14 X-Microsoft-Exchange-Diagnostics-untrusted: 1; BLUPR03MB1508; 2:dPhFAC0UMHwWfCxzIErIK/dC3XDvcMlh+d4seU+3A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0xR7ytOchX7+6EvqBIWfbMbdXlHvO9ap7SjuvBmpH18euep9fAJuGmGmk/xUBYW4PNFtXcxs8xaJbOQUOByMmnoSnxzprVhKOPuQlTT6qYu0J0sJg+pxaVQI6bCYfLRPg1my0ziu8F6elIrTrxxkqNkgLdHHHitGG9wE=; 4:3NE5GrcznO2yzfBQTJpW56uX+LITCiDvPI3SLHQ39DV8GC+XVgpmdilFlvP5YU9xXLl98aaukRmc20zhFsvS7c9OKDYPI4mGShFu3KwYt86BE+OMN5S8x+ldKCWXd5ihZL9C0SBMNUGz7z0WHFwOX19TsEcQkB2Ec3ESr48BMyAvaAmvMoYhwZ8rIHs3SFqHJ0ldp/ZtC5wi7ITx92zMx/RYyPJWtt0M2F+pWSvHr66gIKxPfw/LFeKogblgP3nQ+gotuES9D7vYXuEk/YX86r89+QefS09/1WBRGbgyXycqoF0KarpaXzvNksfvvlJGw0I+yAjB+0rqleUshqtyqjT0FJvJiMH08FfS6lzaD7Ddy0Wfv16OmKTHatK/GSDjWH44Ft+WmCK6fpvmwNrH3pbVuze5khO1AKhd8/PFcHFApyFXNcpErRkLdDfYflb55WBHISG0/XjTHN253B31AT1290AE9Z6X/kHJs10kMvCWbUq95UW9UIa2pv1hXca5yG/Wsdit0XQepUb6bLq8TA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(250305191791016)(22074186197030)(80048183373757); UriScan:(250305191791016)(22074186197030)(80048183373757); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6055026); SRVR:BLUPR03MB1508; BCL:0; PCL:0; RULEID:; SRVR:BLUPR03MB1508; BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(13018025)(13023025)(13024025)(13017025)(13015025)(3002001)(10201501046)(6055026); SRVR:DM2PR03MB495; BCL:0; PCL:0; RULEID:; SRVR:DM2PR03MB495; X-Forefront-PRVS: 0079056367 X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(199003)(189002)(53416004)(97736004)(189998001)(107886002)(19580405001)(86362001)(33646002)(19580395003)(5660300001)(7416002)(2950100002)(42882006)(76176999)(110136003)(15975445007)(101416001)(77096005)(5003940100001)(4326007)(106356001)(92566002)(50986999)(66066001)(2906002)(42186005)(48376002)(1076002)(105586002)(50466002)(47776003)(586003)(6116002)(3846002)(50226002)(229853001)(69596002)(4001430100002)(81156014)(81166006)(7736002)(7846002)(305945005)(8676002)(8666005)(68736007)(7059030)(2004002); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR03MB1508; H:linuxheads99.altera.com; FPR:; SPF:None; PTR:InfoNoRecords; A:0; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: opensource.altera.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics-untrusted: =?us-ascii?Q?1; BLUPR03MB1508; 23:gumWXLmrwh/vy34LUnT5f4JymkguXoJigyeTi4/DH?= =?us-ascii?Q?1sYYhVt4e5p5GddZm6wBYZPDS/Qr+YZl8XmKovnWCMZw608URxc8UEsDJT/f?= =?us-ascii?Q?+oxG29sVyUKDcg+8yRQL4RY9G5snOqUDEGxGqrmXCF0CrcQR/2E7X9uYncpY?= =?us-ascii?Q?V4wyS5l0e0+uCKX7VwZLWOhQHj+f+/7ci0mc3r+Dl/jsWbPx77NMk1b65Mqr?= =?us-ascii?Q?bUuKhqA+kLp4YOs4QtdzNBoe4fYz5CQMAkyog5Rq8MmHuLVxud6bdLVVlF8z?= =?us-ascii?Q?7Oy8f2s/7vgc1A5iYB0uDtYf9qEJdaGlJVIx+7FBWRPJMwz1nymTyUFCORaM?= =?us-ascii?Q?2zVJRJS4eCQCwLU0QWtJ5sFyWxuLk/mm59swgpFzrL1hMu7TDvnkIMSwAQVH?= =?us-ascii?Q?+nNRnV1BM4IoJonDkckv3AhRekG3sFm482XBtthz0kC+FthHaql71SNvin5K?= =?us-ascii?Q?+cHaKmF8BinCGPSh4pkAgnpkLJkYe+P2kgh+VU95NDhouX7iWSk3nbAP5CsD?= =?us-ascii?Q?L1zAsItWeXunak47RGr+92klxZbSt2+POSjwaIDeVWw0rYHZTLKlltLiGmj2?= =?us-ascii?Q?tGICotHaVadpODkYetLvv8nAMbSjWIeJFJaof7bnkf80zaxKkS2D2Upyp/nu?= =?us-ascii?Q?2DkEknk2awIG7O2tenCNPmadPNC7zfSSJUT03ztAGNl8EJntDpQSWJt7AKVb?= =?us-ascii?Q?RyoknizZbHyx+6ZT6J7+LkFgWWeY88owoAO7JnbWZoOi5NNMtlYcRCigsKgM?= =?us-ascii?Q?QAKzxO3Yf2Fq4W0JDNoUmX+faRPECXSxShlWZoop0s8gPnFxsE4HNnqxouJy?= =?us-ascii?Q?8b1OPUjB3y8vKqZsYWgYnh2XfUI8J3GuwrGv3PCuSh9YP6Q7wgeGg5D0pIVy?= =?us-ascii?Q?jXJo6vxQS7HQcOGXoXX57Q++P3DHIJgaLBvuaoixAsK+ESiTyN9u7juW/lLr?= =?us-ascii?Q?qITPAIazcoOfHECSvdQZm03OZSB+fHLXeAMLfbjCj+pdeTPfxf9xPPPXHgaZ?= =?us-ascii?Q?ghsacrzXrReeByGbOlwqT8MtNOF8kRbHhmo0KVC22VXGzLT5uJVMkJbvhoQg?= =?us-ascii?Q?kTfCs9ENTz3DXxEEOdLMaNiHI2rVs92D5rSv2wAILJbKLWGYKOsUj4KfUPMv?= =?us-ascii?Q?0aUsdTn4RIw5ji8WWIpah6ENYYDk1gWUWE+9JVo+DqDRmk3LBjK5Vvql7Nnk?= =?us-ascii?Q?pEu9KdsoE7sRhgQKuL+J+agg3NlvT1//nECbZEn8ymI5hLMhmbiX5gLYdftY?= =?us-ascii?Q?rBIbWEoQjEmCM99uDM=3D?= X-Microsoft-Exchange-Diagnostics-untrusted: 1; BLUPR03MB1508; 6:EbYj2/Vc9X1fV3MtxK+5Fgr3EqQ4Z5mP5nyWM7k+wbRc/EiYGoQf82kqOfyj4LOFuNENQWlkFo4EOu6tCP2Cju4HZCwBo0Y/5w2DeXt5i6Tq3R/K4vFHM33eJwSYxxkt11AAjcYhhrZe2he4+V5ujMUo7vR2lbX9HMRKukAHoC0HexV2IsZ6U/Lp7SXDfu1r3D2GcttzTPHTJU7i1ZxVGXmsU/Y4kPOi5S4m/XwrkFErCqPvelGXPeWfwcYaf3o3H06ZRiLZc1j6OuNyt8wfaAbndaEbyX5mSXmz/dTqx6EM7OlFkWCJu6vSAkbhaXfNX4ig2+c9pWm6YLAxM6BTWw==; 5:g8YKOfIsDWHL3Y2ascQkaqyDNL3kcvZ8bAlrVBZI2WKa7i3uIX+CzEfBkyHPoJiGiRVIJ95GXCxoeE03O07VFDy8Sd/Pl7xuNgk+jlNOy/NUBkuAJ2tw6UvAI+xsih+PhbTOWPoL4jbboBtAfwL1Nw==; 24:IGkSECoWrmU0UXHwubbhp9ryoCRW/reKgO4WMtRyXsrj9bGcxqkPy8zvqtN1yIVwfMNrG0WbSr+dDgyrAqf01JPtEo2rasXHvRgY9cpuXEA=; 7:lOQb6ka4pIjdPU3+S+RZDNvXezBIDnor/FlDNamg191GI09qRppl6xXTjakT3j4hBQLD85/RaC9ivbZ2Wpm6BYWnqGkmCFze3qkpoHN3YB6FsreXwY3vt0nm3kiW3tksrSSM1/ocmoQIQh+NllseHDSGvQf73hpBebtI9ycs1kYtoOCdwdK1TIeWrN8EHyV32qjpgwuCeyziP1d9wdVQPTqVJb81V512zea3daVpnXP4s2VGRMFF8kbX2/2F36whiiRkw3dKNQfQoeOBu9Wgo2U886A+knOO+ECkvTyOvqnjaVH8MtETVuQRi8EYXC/a SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR03MB1508 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:66.35.236.236; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(5003940100001)(33646002)(105606002)(4326007)(8676002)(11100500001)(2906002)(50226002)(6116002)(68736007)(1076002)(229853001)(586003)(53416004)(3846002)(76176999)(50986999)(7416002)(2950100002)(626004)(42882006)(106466001)(85426001)(336002)(77096005)(47776003)(6070500001)(8936002)(356003)(4001430100002)(16796002)(3720700001)(87936001)(8666005)(66066001)(107886002)(50466002)(956001)(189998001)(86362001)(92566002)(5660300001)(15975445007)(81156014)(81166006)(305945005)(7846002)(48376002)(7736002)(19580395003)(110136003)(19580405001)(97736004)(7099028)(7059030)(2004002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR03MB495; H:sj-itexedge04.altera.priv.altera.com; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:0; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD040; 1:7XPYshf0bQXFGGDni+yGADrMfG8D5zLiB0lBVG4a7CUsHkCE244VfDyuiwwcyVjy1iF1Kb1d+2Fxhr4a37slrXsACTJdH8Tbf0K8sFCI6h2MvC9Jbg4Fo8EhKdDyvJal6I0Nwm8AX/gMPYVz7EK63o7f7Z+2O5LMZ92WlEQoFeXYQUyIfWumN/xB3gEmZNwOFqThGqA2nokPtOzjoAo/LWHcCfkSZH9UM9z+ceJnkLKgc4c/XmH7RdJd8T81n5vttRMzN6vJS8+Eh+l66nLQ6SL2Thy/lRtMyyu+N+8SsCw1N0osEBAo7Db6z5Kpeezc5zjo3a4r63WGFR1WSdkJLrM6VxFqfQ6ak3k6aRpw9RmhD7IIGnibXkmU1SAWTtg8c4x51T9KbhMPhsw2h7mVNWk3lcTbS+9ZqmRAeGvM42LRkgIZ3RUMVMBMTuOkhy5vs7LtsQ6gk0BFMGG05o/30hMY4O1sRGrVRilV5y/3QfoiRe9TD2CEZBnyqP0BlPWz178TTxwlup/rDGIL2VbT+e8yDkbjA5mh8EChXoLZiTke0ddcY9yVbSNuf7EG7IgH1HnhYaqo7cpMBNRvlMSi4rJj47GOsHU2sJNdLBF9xa8= X-MS-Exchange-Transport-CrossTenantHeadersStripped: BY2FFO11FD040.protection.gbl X-Microsoft-Exchange-Diagnostics: 1; DM2PR03MB495; 2:zefon5akmo/upHZkz2V6Ku+FMk+odQmU922drK3jbj+iYGnAwhSgRuxQ6FvHTCgmZhJAO2mmpZ3P5qOQfDRALw7+Q9wXeQz/fko2aJEQc1iuXjqJWPM9YFqwfNwERcxbYiAjgddZtDCMFuP7bxFwYGWf1WxLo6qNvgf+z1kcCeS0YQeNgOksDOv07dbW7t4q; 3:t7j2TutwgTruu25Ovk6VSlacH/3EwlZt8zzveCYjxzZU5NvT+Zs/hIOwFctiyrmgTkUIw+gvHh40Sb0pcmHQ4xVqpcVdKIhjiMZccklWjmhdLEpVVXx8a4oer1hm0X8OUG/MadwaAHIMJswAer9eV9QuxrkWHmLOsOkrzT9bDXpREneeMpGeiOSCLYLhTSocyaMK8W0e5KyEUaM7Ok0b3Z645LkzLqN2QLsGeM9jBhXys7I5xjbaBoALHnr9lWwu; 25:gjt3yLZgYuAozVTUYtwenQsv71eA0NmEtD/zGz22eLmORrheG16ITT3wmBHafXReHtstszxsuJcKK/EmVuMi9J9Hq0ExBOurl//e7pM7Ni+zw3TfKhRcwFmMZvzEHoczpdwhl+YETdPyhOpaowEz/4ldCo094VaZ/UqhTObOHqCPJEgq1OY641QoaHkk4Fj4QklviUjlcd+bEkjt51x2AeRqKUUePgfXdxWHK9lnSB8rDxP1DLMi5mrmwVCpUOm2gfHyXUPTbxiZHJO+Y/ja9fRPn3B1OO92ebllg8DvQVp9SlJauLVBvTVjGYYXxRAsUkT6/905vTLqD+vkAtjxva6oFbyIVwCdMfPtMBRJ6sMLKRITTA+VQljD1DBM+ETSzDFmjQ3jIHGkwhQp2gbXHZaHf5Id5bm3iWdW8hEshzQ= X-DkimResult-Test: Passed X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(3001016); SRVR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b97Hd9szbo+1Pdf2OBjyJ1D8QPA8G0yHg0DxmTFgEmHv7jImmr5DJ9cUIbAoQ8+1m7rcnYNJJvTVxz3OL2g3luGsN309rP6ptv3cBTCzW1XANkBUWkisXkYHt1sbJBq6+JGJGUKC68sREQU/AvRJinQPIZmbmsMhG/nrvZ8MbI0sAiigMtd2L6t2WV+KUqChjSOjRpSMQ==; 5:ZGEEikC5DsOK0j307uC9wWuCrgH7X6cpvNODu+beJMQA9jEKL9lgpnzpOAj2LKmkbFO1Orh+eOYBLweV0CXdy4l5Iap7/TTwZym3/bbJ4hM+W8wdbMzbKYB17r7XXjmf2Hx4ptux/DTzvLBzRcsqcw==; 24:LHnHcb27zxdqbsOBXJVKdR/KyGM7Zsr3+B4Z12PUAsXRd+zb7lw/rGx2M8eqwYPECYLW7q4tMUikwauVMQqX8dQ9H/fF/6l1lHOmNzwDRXM=; 7:MwLdVzW0Zwe5jPiWjgP4YSfIF4yw9iGlLhO1bFpA0YzDF6rHm7OC6fZ2hoe2nNahIqloZUgq7wOmPA9nXtyOQ1fWOtVg4kIWHxdWXrPH1APnczSWZYdcCgro3qtdSwpaGoCzb6SJKXPpC/7yy2z8GFUj0E89y7S6Y5jn59MVzSrysQmlicaYzXig3EPmBNVXYegIcuvlTNMzwqIapffXvZNG6qT+eNX1iY1Ka2Se8Ov1//CTZ4SweJjdg2aaN9QrFX34eLPZSJFiYBV9dblYMA== X-OriginatorOrg: opensource.altera.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Sep 2016 18:22:32.3589 (UTC) X-MS-Exchange-CrossTenant-Id: fbd72e03-d4a5-4110-adce-614d51f2077a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fbd72e03-d4a5-4110-adce-614d51f2077a; Ip=[66.35.236.236]; Helo=[sj-itexedge04.altera.priv.altera.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR03MB495 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160928_112300_715640_9C45F14B X-CRM114-Status: UNSURE ( 5.21 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Moritz Fischer , delicious.quinoa@gmail.com, Ian Campbell , Alan Tull , Greg Kroah-Hartman , Josh Cartwright , Michal Simek , linux-kernel@vger.kernel.org, Cyril Chemparathy , devicetree@vger.kernel.org, Dinh Nguyen , Jon Masters , Matthew Gerlach , Frank Rowand , Walter Goossens , linux-arm-kernel@lists.infradead.org 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 framework adds API functions for enabling/ disabling FPGA bridges under kernel control. This allows the Linux kernel to disable FPGA bridges during FPGA reprogramming and to enable FPGA bridges when FPGA reprogramming is done. This framework is be manufacturer-agnostic, allowing it to be used in interfaces that use the FPGA Manager Framework to reprogram FPGA's. The functions are: * of_fpga_bridge_get * fpga_bridge_put Get/put an exclusive reference to a FPGA bridge. * fpga_bridge_enable * fpga_bridge_disable Enable/Disable traffic through a bridge. * fpga_bridge_register * fpga_bridge_unregister Register/unregister a device-specific low level FPGA Bridge driver. Get an exclusive reference to a bridge and add it to a list: * fpga_bridge_get_to_list To enable/disable/put a set of bridges that are on a list: * fpga_bridges_enable * fpga_bridges_disable * fpga_bridges_put Signed-off-by: Alan Tull --- v2: Minor cleanup v12: Bump version to line up with simple fpga bus Remove sysfs Improve get/put functions, get the low level driver too. Clean up class implementation Add kernel doc documentation Rename (un)register_fpga_bridge -> fpga_bridge_(un)register v13: Add inlined empty functions for if not CONFIG_FPGA_BRIDGE Clean up debugging Remove unneeded #include in .h Remove unnecessary prints Remove 'label' DT binding. Document the mutex v14: Allow bridges with no ops *const* struct fpga_bridge_ops Add functions to git/put/enable/disable list of bridges Add list node to struct fpga_bridge Do of_node_get/put in of_fpga_bridge_get() Add r/o attributes: name and state v15: No change in this patch for v15 of this patch set v16: Remove of_get_fpga_bus function v17: No change to this patch in v17 of patch set v18: No change to this patch in v18 of patch set v19: Use fpga image info struct Support fpga image specific timeouts Support child fpga-regions by doing of_platform_populate make a tristate in Kconfig --- drivers/fpga/Kconfig | 7 + drivers/fpga/Makefile | 3 + drivers/fpga/fpga-bridge.c | 398 +++++++++++++++++++++++++++++++++++++++ include/linux/fpga/fpga-bridge.h | 60 ++++++ 4 files changed, 468 insertions(+) create mode 100644 drivers/fpga/fpga-bridge.c create mode 100644 include/linux/fpga/fpga-bridge.h diff --git a/drivers/fpga/Kconfig b/drivers/fpga/Kconfig index d614102..fe87d44 100644 --- a/drivers/fpga/Kconfig +++ b/drivers/fpga/Kconfig @@ -25,6 +25,13 @@ config FPGA_MGR_ZYNQ_FPGA help FPGA manager driver support for Xilinx Zynq FPGAs. +config FPGA_BRIDGE + tristate "FPGA Bridge Framework" + depends on OF + help + Say Y here if you want to support bridges connected between host + processors and FPGAs or between FPGAs. + endif # FPGA endmenu diff --git a/drivers/fpga/Makefile b/drivers/fpga/Makefile index 8d83fc6..4baef00 100644 --- a/drivers/fpga/Makefile +++ b/drivers/fpga/Makefile @@ -8,3 +8,6 @@ obj-$(CONFIG_FPGA) += fpga-mgr.o # FPGA Manager Drivers obj-$(CONFIG_FPGA_MGR_SOCFPGA) += socfpga.o obj-$(CONFIG_FPGA_MGR_ZYNQ_FPGA) += zynq-fpga.o + +# FPGA Bridge Drivers +obj-$(CONFIG_FPGA_BRIDGE) += fpga-bridge.o diff --git a/drivers/fpga/fpga-bridge.c b/drivers/fpga/fpga-bridge.c new file mode 100644 index 0000000..5a733c8 --- /dev/null +++ b/drivers/fpga/fpga-bridge.c @@ -0,0 +1,398 @@ +/* + * FPGA Bridge Framework Driver + * + * Copyright (C) 2013-2016 Altera Corporation, All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . + */ +#include +#include +#include +#include +#include +#include +#include + +static DEFINE_IDA(fpga_bridge_ida); +static struct class *fpga_bridge_class; + +/* Lock for adding/removing bridges to linked lists*/ +spinlock_t bridge_list_lock; + +static int fpga_bridge_of_node_match(struct device *dev, const void *data) +{ + return dev->of_node == data; +} + +/** + * fpga_bridge_enable - Enable transactions on the bridge + * + * @bridge: FPGA bridge + * + * Return: 0 for success, error code otherwise. + */ +int fpga_bridge_enable(struct fpga_bridge *bridge) +{ + dev_dbg(&bridge->dev, "enable\n"); + + if (bridge->br_ops && bridge->br_ops->enable_set) + return bridge->br_ops->enable_set(bridge, 1); + + return 0; +} +EXPORT_SYMBOL_GPL(fpga_bridge_enable); + +/** + * fpga_bridge_disable - Disable transactions on the bridge + * + * @bridge: FPGA bridge + * + * Return: 0 for success, error code otherwise. + */ +int fpga_bridge_disable(struct fpga_bridge *bridge) +{ + dev_dbg(&bridge->dev, "disable\n"); + + if (bridge->br_ops && bridge->br_ops->enable_set) + return bridge->br_ops->enable_set(bridge, 0); + + return 0; +} +EXPORT_SYMBOL_GPL(fpga_bridge_disable); + +/** + * of_fpga_bridge_get - get an exclusive reference to a fpga bridge + * + * @np: node pointer of a FPGA bridge + * @info: fpga image specific information + * + * Return fpga_bridge struct if successful. + * Return -EBUSY if someone already has a reference to the bridge. + * Return -ENODEV if @np is not a FPGA Bridge. + */ +struct fpga_bridge *of_fpga_bridge_get(struct device_node *np, + struct fpga_image_info *info) + +{ + struct device *dev; + struct fpga_bridge *bridge; + int ret = -ENODEV; + + of_node_get(np); + + dev = class_find_device(fpga_bridge_class, NULL, np, + fpga_bridge_of_node_match); + if (!dev) + goto err_dev; + + bridge = to_fpga_bridge(dev); + if (!bridge) + goto err_dev; + + bridge->info = info; + + if (!mutex_trylock(&bridge->mutex)) { + ret = -EBUSY; + goto err_dev; + } + + if (!try_module_get(dev->parent->driver->owner)) + goto err_ll_mod; + + dev_dbg(&bridge->dev, "get\n"); + + return bridge; + +err_ll_mod: + mutex_unlock(&bridge->mutex); +err_dev: + put_device(dev); + of_node_put(np); + return ERR_PTR(ret); +} +EXPORT_SYMBOL_GPL(of_fpga_bridge_get); + +/** + * fpga_bridge_put - release a reference to a bridge + * + * @bridge: FPGA bridge + */ +void fpga_bridge_put(struct fpga_bridge *bridge) +{ + dev_dbg(&bridge->dev, "put\n"); + + bridge->info = NULL; + module_put(bridge->dev.parent->driver->owner); + mutex_unlock(&bridge->mutex); + put_device(&bridge->dev); +} +EXPORT_SYMBOL_GPL(fpga_bridge_put); + +/** + * fpga_bridges_enable - enable bridges in a list + * @bridge_list: list of FPGA bridges + * + * Enable each bridge in the list. If list is empty, do nothing. + * + * Return 0 for success or empty bridge list; return error code otherwise. + */ +int fpga_bridges_enable(struct list_head *bridge_list) +{ + struct fpga_bridge *bridge; + struct list_head *node; + int ret; + + list_for_each(node, bridge_list) { + bridge = list_entry(node, struct fpga_bridge, node); + ret = fpga_bridge_enable(bridge); + if (ret) + return ret; + } + + return 0; +} +EXPORT_SYMBOL_GPL(fpga_bridges_enable); + +/** + * fpga_bridges_disable - disable bridges in a list + * + * @bridge_list: list of FPGA bridges + * + * Disable each bridge in the list. If list is empty, do nothing. + * + * Return 0 for success or empty bridge list; return error code otherwise. + */ +int fpga_bridges_disable(struct list_head *bridge_list) +{ + struct fpga_bridge *bridge; + struct list_head *node; + int ret; + + list_for_each(node, bridge_list) { + bridge = list_entry(node, struct fpga_bridge, node); + ret = fpga_bridge_disable(bridge); + if (ret) + return ret; + } + + return 0; +} +EXPORT_SYMBOL_GPL(fpga_bridges_disable); + +/** + * fpga_bridges_put - put bridges + * + * @bridge_list: list of FPGA bridges + * + * For each bridge in the list, put the bridge and remove it from the list. + * If list is empty, do nothing. + */ +void fpga_bridges_put(struct list_head *bridge_list) +{ + struct fpga_bridge *bridge; + struct list_head *node, *next; + unsigned long flags; + + list_for_each_safe(node, next, bridge_list) { + bridge = list_entry(node, struct fpga_bridge, node); + + fpga_bridge_put(bridge); + + spin_lock_irqsave(&bridge_list_lock, flags); + list_del(&bridge->node); + spin_unlock_irqrestore(&bridge_list_lock, flags); + } +} +EXPORT_SYMBOL_GPL(fpga_bridges_put); + +/** + * fpga_bridges_get_to_list - get a bridge, add it to a list + * + * @np: node pointer of a FPGA bridge + * @info: fpga image specific information + * @bridge_list: list of FPGA bridges + * + * Get an exclusive reference to the bridge and and it to the list. + * + * Return 0 for success, error code from of_fpga_bridge_get() othewise. + */ +int fpga_bridge_get_to_list(struct device_node *np, + struct fpga_image_info *info, + struct list_head *bridge_list) +{ + struct fpga_bridge *bridge; + unsigned long flags; + + bridge = of_fpga_bridge_get(np, info); + if (IS_ERR(bridge)) + return PTR_ERR(bridge); + + spin_lock_irqsave(&bridge_list_lock, flags); + list_add(&bridge->node, bridge_list); + spin_unlock_irqrestore(&bridge_list_lock, flags); + + return 0; +} +EXPORT_SYMBOL_GPL(fpga_bridge_get_to_list); + +static ssize_t name_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct fpga_bridge *bridge = to_fpga_bridge(dev); + + return sprintf(buf, "%s\n", bridge->name); +} + +static ssize_t state_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct fpga_bridge *bridge = to_fpga_bridge(dev); + int enable = 1; + + if (bridge->br_ops && bridge->br_ops->enable_show) + enable = bridge->br_ops->enable_show(bridge); + + return sprintf(buf, "%s\n", enable ? "enabled" : "disabled"); +} + +static DEVICE_ATTR_RO(name); +static DEVICE_ATTR_RO(state); + +static struct attribute *fpga_bridge_attrs[] = { + &dev_attr_name.attr, + &dev_attr_state.attr, + NULL, +}; +ATTRIBUTE_GROUPS(fpga_bridge); + +/** + * fpga_bridge_register - register a fpga bridge driver + * @dev: FPGA bridge device from pdev + * @name: FPGA bridge name + * @br_ops: pointer to structure of fpga bridge ops + * @priv: FPGA bridge private data + * + * Return: 0 for success, error code otherwise. + */ +int fpga_bridge_register(struct device *dev, const char *name, + const struct fpga_bridge_ops *br_ops, void *priv) +{ + struct fpga_bridge *bridge; + int id, ret = 0; + + if (!name || !strlen(name)) { + dev_err(dev, "Attempt to register with no name!\n"); + return -EINVAL; + } + + bridge = kzalloc(sizeof(*bridge), GFP_KERNEL); + if (!bridge) + return -ENOMEM; + + id = ida_simple_get(&fpga_bridge_ida, 0, 0, GFP_KERNEL); + if (id < 0) { + ret = id; + goto error_kfree; + } + + mutex_init(&bridge->mutex); + INIT_LIST_HEAD(&bridge->node); + + bridge->name = name; + bridge->br_ops = br_ops; + bridge->priv = priv; + + device_initialize(&bridge->dev); + bridge->dev.class = fpga_bridge_class; + bridge->dev.parent = dev; + bridge->dev.of_node = dev->of_node; + bridge->dev.id = id; + dev_set_drvdata(dev, bridge); + + ret = dev_set_name(&bridge->dev, "br%d", id); + if (ret) + goto error_device; + + ret = device_add(&bridge->dev); + if (ret) + goto error_device; + + of_platform_populate(dev->of_node, NULL, NULL, dev); + + dev_info(bridge->dev.parent, "fpga bridge [%s] registered\n", + bridge->name); + + return 0; + +error_device: + ida_simple_remove(&fpga_bridge_ida, id); +error_kfree: + kfree(bridge); + + return ret; +} +EXPORT_SYMBOL_GPL(fpga_bridge_register); + +/** + * fpga_bridge_unregister - unregister a fpga bridge driver + * @dev: FPGA bridge device from pdev + */ +void fpga_bridge_unregister(struct device *dev) +{ + struct fpga_bridge *bridge = dev_get_drvdata(dev); + + /* + * If the low level driver provides a method for putting bridge into + * a desired state upon unregister, do it. + */ + if (bridge->br_ops && bridge->br_ops->fpga_bridge_remove) + bridge->br_ops->fpga_bridge_remove(bridge); + + device_unregister(&bridge->dev); +} +EXPORT_SYMBOL_GPL(fpga_bridge_unregister); + +static void fpga_bridge_dev_release(struct device *dev) +{ + struct fpga_bridge *bridge = to_fpga_bridge(dev); + + ida_simple_remove(&fpga_bridge_ida, bridge->dev.id); + kfree(bridge); +} + +static int __init fpga_bridge_dev_init(void) +{ + spin_lock_init(&bridge_list_lock); + + fpga_bridge_class = class_create(THIS_MODULE, "fpga_bridge"); + if (IS_ERR(fpga_bridge_class)) + return PTR_ERR(fpga_bridge_class); + + fpga_bridge_class->dev_groups = fpga_bridge_groups; + fpga_bridge_class->dev_release = fpga_bridge_dev_release; + + return 0; +} + +static void __exit fpga_bridge_dev_exit(void) +{ + class_destroy(fpga_bridge_class); + ida_destroy(&fpga_bridge_ida); +} + +MODULE_DESCRIPTION("FPGA Bridge Driver"); +MODULE_AUTHOR("Alan Tull "); +MODULE_LICENSE("GPL v2"); + +subsys_initcall(fpga_bridge_dev_init); +module_exit(fpga_bridge_dev_exit); diff --git a/include/linux/fpga/fpga-bridge.h b/include/linux/fpga/fpga-bridge.h new file mode 100644 index 0000000..dba6e3c --- /dev/null +++ b/include/linux/fpga/fpga-bridge.h @@ -0,0 +1,60 @@ +#include +#include + +#ifndef _LINUX_FPGA_BRIDGE_H +#define _LINUX_FPGA_BRIDGE_H + +struct fpga_bridge; + +/** + * struct fpga_bridge_ops - ops for low level FPGA bridge drivers + * @enable_show: returns the FPGA bridge's status + * @enable_set: set a FPGA bridge as enabled or disabled + * @fpga_bridge_remove: set FPGA into a specific state during driver remove + */ +struct fpga_bridge_ops { + int (*enable_show)(struct fpga_bridge *bridge); + int (*enable_set)(struct fpga_bridge *bridge, bool enable); + void (*fpga_bridge_remove)(struct fpga_bridge *bridge); +}; + +/** + * struct fpga_bridge - FPGA bridge structure + * @name: name of low level FPGA bridge + * @dev: FPGA bridge device + * @mutex: enforces exclusive reference to bridge + * @br_ops: pointer to struct of FPGA bridge ops + * @info: fpga image specific information + * @node: FPGA bridge list node + * @priv: low level driver private date + */ +struct fpga_bridge { + const char *name; + struct device dev; + struct mutex mutex; /* for exclusive reference to bridge */ + const struct fpga_bridge_ops *br_ops; + struct fpga_image_info *info; + struct list_head node; + void *priv; +}; + +#define to_fpga_bridge(d) container_of(d, struct fpga_bridge, dev) + +struct fpga_bridge *of_fpga_bridge_get(struct device_node *node, + struct fpga_image_info *info); +void fpga_bridge_put(struct fpga_bridge *bridge); +int fpga_bridge_enable(struct fpga_bridge *bridge); +int fpga_bridge_disable(struct fpga_bridge *bridge); + +int fpga_bridges_enable(struct list_head *bridge_list); +int fpga_bridges_disable(struct list_head *bridge_list); +void fpga_bridges_put(struct list_head *bridge_list); +int fpga_bridge_get_to_list(struct device_node *np, + struct fpga_image_info *info, + struct list_head *bridge_list); + +int fpga_bridge_register(struct device *dev, const char *name, + const struct fpga_bridge_ops *br_ops, void *priv); +void fpga_bridge_unregister(struct device *dev); + +#endif /* _LINUX_FPGA_BRIDGE_H */