Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752345AbdHHMX2 (ORCPT ); Tue, 8 Aug 2017 08:23:28 -0400 Received: from mail-by2nam03on0083.outbound.protection.outlook.com ([104.47.42.83]:38208 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752075AbdHHMXY (ORCPT ); Tue, 8 Aug 2017 08:23:24 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Robert.Richter@cavium.com; From: Robert Richter To: Thomas Gleixner , Jason Cooper , Marc Zyngier Cc: Shanker Donthineni , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Robert Richter Subject: [PATCH v3 0/8] irqchip/gic-v3-its: Implement ITS nodes as kernel devices and use CMA Date: Tue, 8 Aug 2017 14:22:50 +0200 Message-Id: <20170808122259.6299-1-rrichter@cavium.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [78.55.120.224] X-ClientProxiedBy: AM5PR06CA0030.eurprd06.prod.outlook.com (10.167.168.43) To CY1PR07MB2346.namprd07.prod.outlook.com (10.166.194.145) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9a933eb2-60b7-43e9-51db-08d4de584291 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:CY1PR07MB2346; X-Microsoft-Exchange-Diagnostics: 1;CY1PR07MB2346;3:+QPL1R54SqpILaWmtvayylvs/vVt/AknRYNer9m2sOywmRo3c3J0mpC6wjGv5a7j2UK0VGk5rO5Nlap0c4223KK8ryjBTAEa4RzalDFuLxPk43lKCG3Da5UqjK84ZSUTGhvYNfpHi1M8DjOnOfklNiubg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WIqIX2MUOfLa9WHtU3Z1ka+24wExU0xRL0AJdK8tbjql6+Ojj0aG5qm+qar+7FrK1vg+lPlGrX59SRsX311NTJlXCaom/AGtv1u1J3ov661bedcfKXsZFRtevR365ckaFKGp+k5+BTqilj1XLsPJpfGpRKtZampNZGdkLEIxUPHWDzCuVbR;4:XsB0bEmsfmHGdR0ThG3PJXpyPJp/WK/Mi8UdsXpTyOAuiyykJjFnTq7HT7vPqJJ3/z0AMmSGiaZeJr+zI3EcTKFtwydMxGgTNk/SZ8iL633ZplQufN98Nv32w/30kxmefz3xjsYZx4syU5wVSvaTZN5M7T/wc0YTLgwxdIB4mooIjgHeLXFyeM+EyTWy7hTVHWx6gDWETXfbVdgjQxHrMBpHiyde4vLQ75Mw3PufYdyxwOv9xnFafB+g2omz968n X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(100000703101)(100105400095)(93006095)(93001095)(10201501046)(3002001)(6041248)(20161123558100)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123560025)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:CY1PR07MB2346;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:CY1PR07MB2346; X-Forefront-PRVS: 03932714EB X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(7370300001)(4630300001)(6009001)(39840400002)(39410400002)(39850400002)(39400400002)(39450400003)(199003)(189002)(33646002)(66066001)(106356001)(68736007)(6306002)(189998001)(54906002)(6116002)(3846002)(97736004)(72206003)(6666003)(81166006)(50226002)(6486002)(25786009)(5003940100001)(966005)(107886003)(38730400002)(4326008)(305945005)(50986999)(101416001)(5660300001)(42186005)(81156014)(230783001)(2906002)(7736002)(6512007)(36756003)(1076002)(105586002)(7350300001)(6506006)(48376002)(47776003)(478600001)(53936002)(50466002)(8676002)(6606295002);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR07MB2346;H:rric.localdomain;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY1PR07MB2346;23:RSTl4VgJYcbAX8ffPhQrcWvo6H5RhiKuyLVb6HInN?= =?us-ascii?Q?S0vohWzoSnYi2XH67JoePpd7j7b9R+4wRtf2eHP6b86JNaybyFocoTNXoJHa?= =?us-ascii?Q?NInTdIQymBWzJw/M2NSQxpf3myYijdocxus/L6zmru9f+VMcd2NrKsIh1MKY?= =?us-ascii?Q?QKuo/P4KjydPGCe5xMbDFlBFIDg20q9vVukHaDuM8FIM+0F+yTrYGzB9M6sN?= =?us-ascii?Q?guAnq25IIMQj8VI7b0x1n3NieqnjkLEH61adCisIobQOKkUeNqSDFnHXAtFp?= =?us-ascii?Q?vna5WzIP4P5y2MOdoALDEO4fudBQdTDMDI8Lw16/yCTaYutdyGWLQh/V8zBJ?= =?us-ascii?Q?z3yTCAXMkNCK+i0ANs5YLqAw0mr/LTvGwTUVZLj+Ys5r6EWBArtIQQzDXbl5?= =?us-ascii?Q?Hs76Np6Ys5vFWGP5iryoy4zYpJl7V20j0her7M1TGBFIe3cNQAWp4NSgkKIO?= =?us-ascii?Q?Dl3mlP/Cb7HaWmOzMXsiaxo8jEdTTqqD0ddsWXz2nnqGyub1h2i3a6TEHqWx?= =?us-ascii?Q?GWrTXf/srhZaTOy8wBBieBBLqufR8fJGANSXCv5IctoK6eB+M9TcITMb92mU?= =?us-ascii?Q?qYw207nji/Pe7AvyurobysV+dOEVPiwqlc8tQMk0hA05PETtMMrV9B2iedi9?= =?us-ascii?Q?UhkmcIjzPjcBLT5O5f9sDM0vH0QxiPzgmMw/PDlK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Mz4r6bse181GGqMcBQb8xMnQNTbviOhTXqskwl7uIScOhIq/E+RKqIjaslnVj3+TStJpEQ5oXKP0C06ELw==;5:PJhFXbNgk6Xq/6kkRf486a5EOXdp9KV/ZrvrmQUWXs7meW+agYZcKnG9ekEBqs082of1SPHWTuPYAM5UiBkMtYtk3P6RxOTi6b+wspWsIgochR2SgdVWzHlIqX/Yuk3bScLvY6FHhQjhVMJwE/tHWQ==;24:31VrPHxGT2rmzcTGB1TMBn8oAA9YlC07BnoDMPQXwbwf2vG/QIMOSpza9+xP53Q1e9UIaifdDNmA27xZcWlQAbhCKt6WVS0A6uIM0heAO/A=;7:HTrBuuYUmHQEVCgIOO/PEcOOuycDa2O6HfIrZw1rht0XfbTf7C60ZwChrBUM5RUwjH/j4qUblexOMKZ+fyOzUhjBJzyL0fdAa++1wcG88sWIPhMOczjeJ899DHdMZZl+hQ27KO0Qc3gfYgTMUCeuBgjekYeoyV+dn87Wq+ygSnAMBPwlAu12KIKG90QRLSfyKheC0TTc11rQqIxpLrz2H6eSR1JHCa0Q8pNDestkBbQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2017 12:23:20.5921 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2346 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2320 Lines: 61 This patch series implements ITS nodes as kernel devices. The advantage of that is that CMA can be used to allocate large ITS tables, where standard memory and page allocation fails (above MAX_ORDER - 1). This approach was suggested first here: https://marc.info/?i=56D44812.6000309%40arm.com Another advantage is that all memory resources of the device are now device managed, thus the code for releasing the device becomes much easier. The following is required to implement this: * each ITS node must be assigned to a struct device each, * the ITS initialization must be moved to a later point during boot, * the ITS enablement must be separated from the GIC code (the GIC still needs to be enabled early), * the early ITS node probing by DT or ACPI must be separated from the ITS initialization, * ITS table allocation must be changed to use dma_alloc_coherent() which uses CMA for allocation of large memory ranges. This is an update of my last patch submission here: https://lkml.org/lkml/2017/3/6/570 V3: * rebased onto v4.13-rc1, * fixed use after free in error path in its_init_one(), * added comment for arch_setup_dma_ops() to describe coherency, V2: * rebased onto v4.11-rc1, * fixed syntax error in its_init() function (split probing patch), * added comment in its_create_device(), * fixed GITS_BASER_PAGE_SIZE_MASK usage in its_setup_baser() Robert Richter (8): irqchip/gic-v3-its: Initialize its nodes in probe order irqchip/gic-v3-its: Initialize MSIs with subsys_initcalls irqchip/gic-v3-its: Split probing from its node initialization irqchip/gic-v3-its: Decouple its initialization from gic irqchip/gic-v3-its: Prevent its init ordering dependencies irqchip/gic-v3-its: Initialize its nodes later irqchip/gic-v3-its: Handle its nodes as kernel devices irqchip, gicv3-its, cma: Use CMA for allocation of large device tables drivers/irqchip/irq-gic-v3-its-pci-msi.c | 6 +- drivers/irqchip/irq-gic-v3-its-platform-msi.c | 6 +- drivers/irqchip/irq-gic-v3-its.c | 285 ++++++++++++++++---------- drivers/irqchip/irq-gic-v3.c | 8 +- include/linux/cpuhotplug.h | 1 + include/linux/irqchip/arm-gic-v3.h | 5 +- 6 files changed, 195 insertions(+), 116 deletions(-) -- 2.11.0