2 * Copyright (C) 2013, 2014 ARM Limited, All Rights Reserved.
3 * Author: Marc Zyngier <marc.zyngier@arm.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #include <linux/bitmap.h>
19 #include <linux/cpu.h>
20 #include <linux/delay.h>
21 #include <linux/interrupt.h>
22 #include <linux/log2.h>
24 #include <linux/msi.h>
26 #include <linux/of_address.h>
27 #include <linux/of_irq.h>
28 #include <linux/of_pci.h>
29 #include <linux/of_platform.h>
30 #include <linux/percpu.h>
31 #include <linux/slab.h>
33 #include <linux/irqchip/arm-gic-v3.h>
35 #include <asm/cacheflush.h>
36 #include <asm/cputype.h>
37 #include <asm/exception.h>
41 #define ITS_FLAGS_CMDQ_NEEDS_FLUSHING (1 << 0)
43 #define RDIST_FLAGS_PROPBASE_NEEDS_FLUSHING (1 << 0)
46 * Collection structure - just an ID, and a redistributor address to
47 * ping. We use one per CPU as a bag of interrupts assigned to this
50 struct its_collection
{
56 * The ITS structure - contains most of the infrastructure, with the
57 * msi_controller, the command queue, the collections, and the list of
58 * devices writing to it.
62 struct list_head entry
;
63 struct msi_controller msi_chip
;
64 struct irq_domain
*domain
;
66 unsigned long phys_base
;
67 struct its_cmd_block
*cmd_base
;
68 struct its_cmd_block
*cmd_write
;
69 void *tables
[GITS_BASER_NR_REGS
];
70 struct its_collection
*collections
;
71 struct list_head its_device_list
;
76 #define ITS_ITT_ALIGN SZ_256
78 struct event_lpi_map
{
79 unsigned long *lpi_map
;
81 irq_hw_number_t lpi_base
;
86 * The ITS view of a device - belongs to an ITS, a collection, owns an
87 * interrupt translation table, and a list of interrupts.
90 struct list_head entry
;
92 struct event_lpi_map event_map
;
98 static LIST_HEAD(its_nodes
);
99 static DEFINE_SPINLOCK(its_lock
);
100 static struct device_node
*gic_root_node
;
101 static struct rdists
*gic_rdists
;
103 #define gic_data_rdist() (raw_cpu_ptr(gic_rdists->rdist))
104 #define gic_data_rdist_rd_base() (gic_data_rdist()->rd_base)
106 static struct its_collection
*dev_event_to_col(struct its_device
*its_dev
,
109 struct its_node
*its
= its_dev
->its
;
111 return its
->collections
+ its_dev
->event_map
.col_map
[event
];
115 * ITS command descriptors - parameters to be encoded in a command
118 struct its_cmd_desc
{
121 struct its_device
*dev
;
126 struct its_device
*dev
;
131 struct its_device
*dev
;
136 struct its_collection
*col
;
141 struct its_device
*dev
;
147 struct its_device
*dev
;
148 struct its_collection
*col
;
153 struct its_device
*dev
;
158 struct its_collection
*col
;
164 * The ITS command block, which is what the ITS actually parses.
166 struct its_cmd_block
{
170 #define ITS_CMD_QUEUE_SZ SZ_64K
171 #define ITS_CMD_QUEUE_NR_ENTRIES (ITS_CMD_QUEUE_SZ / sizeof(struct its_cmd_block))
173 typedef struct its_collection
*(*its_cmd_builder_t
)(struct its_cmd_block
*,
174 struct its_cmd_desc
*);
176 static void its_encode_cmd(struct its_cmd_block
*cmd
, u8 cmd_nr
)
178 cmd
->raw_cmd
[0] &= ~0xffUL
;
179 cmd
->raw_cmd
[0] |= cmd_nr
;
182 static void its_encode_devid(struct its_cmd_block
*cmd
, u32 devid
)
184 cmd
->raw_cmd
[0] &= BIT_ULL(32) - 1;
185 cmd
->raw_cmd
[0] |= ((u64
)devid
) << 32;
188 static void its_encode_event_id(struct its_cmd_block
*cmd
, u32 id
)
190 cmd
->raw_cmd
[1] &= ~0xffffffffUL
;
191 cmd
->raw_cmd
[1] |= id
;
194 static void its_encode_phys_id(struct its_cmd_block
*cmd
, u32 phys_id
)
196 cmd
->raw_cmd
[1] &= 0xffffffffUL
;
197 cmd
->raw_cmd
[1] |= ((u64
)phys_id
) << 32;
200 static void its_encode_size(struct its_cmd_block
*cmd
, u8 size
)
202 cmd
->raw_cmd
[1] &= ~0x1fUL
;
203 cmd
->raw_cmd
[1] |= size
& 0x1f;
206 static void its_encode_itt(struct its_cmd_block
*cmd
, u64 itt_addr
)
208 cmd
->raw_cmd
[2] &= ~0xffffffffffffUL
;
209 cmd
->raw_cmd
[2] |= itt_addr
& 0xffffffffff00UL
;
212 static void its_encode_valid(struct its_cmd_block
*cmd
, int valid
)
214 cmd
->raw_cmd
[2] &= ~(1UL << 63);
215 cmd
->raw_cmd
[2] |= ((u64
)!!valid
) << 63;
218 static void its_encode_target(struct its_cmd_block
*cmd
, u64 target_addr
)
220 cmd
->raw_cmd
[2] &= ~(0xffffffffUL
<< 16);
221 cmd
->raw_cmd
[2] |= (target_addr
& (0xffffffffUL
<< 16));
224 static void its_encode_collection(struct its_cmd_block
*cmd
, u16 col
)
226 cmd
->raw_cmd
[2] &= ~0xffffUL
;
227 cmd
->raw_cmd
[2] |= col
;
230 static inline void its_fixup_cmd(struct its_cmd_block
*cmd
)
232 /* Let's fixup BE commands */
233 cmd
->raw_cmd
[0] = cpu_to_le64(cmd
->raw_cmd
[0]);
234 cmd
->raw_cmd
[1] = cpu_to_le64(cmd
->raw_cmd
[1]);
235 cmd
->raw_cmd
[2] = cpu_to_le64(cmd
->raw_cmd
[2]);
236 cmd
->raw_cmd
[3] = cpu_to_le64(cmd
->raw_cmd
[3]);
239 static struct its_collection
*its_build_mapd_cmd(struct its_cmd_block
*cmd
,
240 struct its_cmd_desc
*desc
)
242 unsigned long itt_addr
;
243 u8 size
= ilog2(desc
->its_mapd_cmd
.dev
->nr_ites
);
245 itt_addr
= virt_to_phys(desc
->its_mapd_cmd
.dev
->itt
);
246 itt_addr
= ALIGN(itt_addr
, ITS_ITT_ALIGN
);
248 its_encode_cmd(cmd
, GITS_CMD_MAPD
);
249 its_encode_devid(cmd
, desc
->its_mapd_cmd
.dev
->device_id
);
250 its_encode_size(cmd
, size
- 1);
251 its_encode_itt(cmd
, itt_addr
);
252 its_encode_valid(cmd
, desc
->its_mapd_cmd
.valid
);
259 static struct its_collection
*its_build_mapc_cmd(struct its_cmd_block
*cmd
,
260 struct its_cmd_desc
*desc
)
262 its_encode_cmd(cmd
, GITS_CMD_MAPC
);
263 its_encode_collection(cmd
, desc
->its_mapc_cmd
.col
->col_id
);
264 its_encode_target(cmd
, desc
->its_mapc_cmd
.col
->target_address
);
265 its_encode_valid(cmd
, desc
->its_mapc_cmd
.valid
);
269 return desc
->its_mapc_cmd
.col
;
272 static struct its_collection
*its_build_mapvi_cmd(struct its_cmd_block
*cmd
,
273 struct its_cmd_desc
*desc
)
275 struct its_collection
*col
;
277 col
= dev_event_to_col(desc
->its_mapvi_cmd
.dev
,
278 desc
->its_mapvi_cmd
.event_id
);
280 its_encode_cmd(cmd
, GITS_CMD_MAPVI
);
281 its_encode_devid(cmd
, desc
->its_mapvi_cmd
.dev
->device_id
);
282 its_encode_event_id(cmd
, desc
->its_mapvi_cmd
.event_id
);
283 its_encode_phys_id(cmd
, desc
->its_mapvi_cmd
.phys_id
);
284 its_encode_collection(cmd
, col
->col_id
);
291 static struct its_collection
*its_build_movi_cmd(struct its_cmd_block
*cmd
,
292 struct its_cmd_desc
*desc
)
294 struct its_collection
*col
;
296 col
= dev_event_to_col(desc
->its_movi_cmd
.dev
,
297 desc
->its_movi_cmd
.event_id
);
299 its_encode_cmd(cmd
, GITS_CMD_MOVI
);
300 its_encode_devid(cmd
, desc
->its_movi_cmd
.dev
->device_id
);
301 its_encode_event_id(cmd
, desc
->its_movi_cmd
.event_id
);
302 its_encode_collection(cmd
, desc
->its_movi_cmd
.col
->col_id
);
309 static struct its_collection
*its_build_discard_cmd(struct its_cmd_block
*cmd
,
310 struct its_cmd_desc
*desc
)
312 struct its_collection
*col
;
314 col
= dev_event_to_col(desc
->its_discard_cmd
.dev
,
315 desc
->its_discard_cmd
.event_id
);
317 its_encode_cmd(cmd
, GITS_CMD_DISCARD
);
318 its_encode_devid(cmd
, desc
->its_discard_cmd
.dev
->device_id
);
319 its_encode_event_id(cmd
, desc
->its_discard_cmd
.event_id
);
326 static struct its_collection
*its_build_inv_cmd(struct its_cmd_block
*cmd
,
327 struct its_cmd_desc
*desc
)
329 struct its_collection
*col
;
331 col
= dev_event_to_col(desc
->its_inv_cmd
.dev
,
332 desc
->its_inv_cmd
.event_id
);
334 its_encode_cmd(cmd
, GITS_CMD_INV
);
335 its_encode_devid(cmd
, desc
->its_inv_cmd
.dev
->device_id
);
336 its_encode_event_id(cmd
, desc
->its_inv_cmd
.event_id
);
343 static struct its_collection
*its_build_invall_cmd(struct its_cmd_block
*cmd
,
344 struct its_cmd_desc
*desc
)
346 its_encode_cmd(cmd
, GITS_CMD_INVALL
);
347 its_encode_collection(cmd
, desc
->its_mapc_cmd
.col
->col_id
);
354 static u64
its_cmd_ptr_to_offset(struct its_node
*its
,
355 struct its_cmd_block
*ptr
)
357 return (ptr
- its
->cmd_base
) * sizeof(*ptr
);
360 static int its_queue_full(struct its_node
*its
)
365 widx
= its
->cmd_write
- its
->cmd_base
;
366 ridx
= readl_relaxed(its
->base
+ GITS_CREADR
) / sizeof(struct its_cmd_block
);
368 /* This is incredibly unlikely to happen, unless the ITS locks up. */
369 if (((widx
+ 1) % ITS_CMD_QUEUE_NR_ENTRIES
) == ridx
)
375 static struct its_cmd_block
*its_allocate_entry(struct its_node
*its
)
377 struct its_cmd_block
*cmd
;
378 u32 count
= 1000000; /* 1s! */
380 while (its_queue_full(its
)) {
383 pr_err_ratelimited("ITS queue not draining\n");
390 cmd
= its
->cmd_write
++;
392 /* Handle queue wrapping */
393 if (its
->cmd_write
== (its
->cmd_base
+ ITS_CMD_QUEUE_NR_ENTRIES
))
394 its
->cmd_write
= its
->cmd_base
;
399 static struct its_cmd_block
*its_post_commands(struct its_node
*its
)
401 u64 wr
= its_cmd_ptr_to_offset(its
, its
->cmd_write
);
403 writel_relaxed(wr
, its
->base
+ GITS_CWRITER
);
405 return its
->cmd_write
;
408 static void its_flush_cmd(struct its_node
*its
, struct its_cmd_block
*cmd
)
411 * Make sure the commands written to memory are observable by
414 if (its
->flags
& ITS_FLAGS_CMDQ_NEEDS_FLUSHING
)
415 __flush_dcache_area(cmd
, sizeof(*cmd
));
420 static void its_wait_for_range_completion(struct its_node
*its
,
421 struct its_cmd_block
*from
,
422 struct its_cmd_block
*to
)
424 u64 rd_idx
, from_idx
, to_idx
;
425 u32 count
= 1000000; /* 1s! */
427 from_idx
= its_cmd_ptr_to_offset(its
, from
);
428 to_idx
= its_cmd_ptr_to_offset(its
, to
);
431 rd_idx
= readl_relaxed(its
->base
+ GITS_CREADR
);
432 if (rd_idx
>= to_idx
|| rd_idx
< from_idx
)
437 pr_err_ratelimited("ITS queue timeout\n");
445 static void its_send_single_command(struct its_node
*its
,
446 its_cmd_builder_t builder
,
447 struct its_cmd_desc
*desc
)
449 struct its_cmd_block
*cmd
, *sync_cmd
, *next_cmd
;
450 struct its_collection
*sync_col
;
453 raw_spin_lock_irqsave(&its
->lock
, flags
);
455 cmd
= its_allocate_entry(its
);
456 if (!cmd
) { /* We're soooooo screewed... */
457 pr_err_ratelimited("ITS can't allocate, dropping command\n");
458 raw_spin_unlock_irqrestore(&its
->lock
, flags
);
461 sync_col
= builder(cmd
, desc
);
462 its_flush_cmd(its
, cmd
);
465 sync_cmd
= its_allocate_entry(its
);
467 pr_err_ratelimited("ITS can't SYNC, skipping\n");
470 its_encode_cmd(sync_cmd
, GITS_CMD_SYNC
);
471 its_encode_target(sync_cmd
, sync_col
->target_address
);
472 its_fixup_cmd(sync_cmd
);
473 its_flush_cmd(its
, sync_cmd
);
477 next_cmd
= its_post_commands(its
);
478 raw_spin_unlock_irqrestore(&its
->lock
, flags
);
480 its_wait_for_range_completion(its
, cmd
, next_cmd
);
483 static void its_send_inv(struct its_device
*dev
, u32 event_id
)
485 struct its_cmd_desc desc
;
487 desc
.its_inv_cmd
.dev
= dev
;
488 desc
.its_inv_cmd
.event_id
= event_id
;
490 its_send_single_command(dev
->its
, its_build_inv_cmd
, &desc
);
493 static void its_send_mapd(struct its_device
*dev
, int valid
)
495 struct its_cmd_desc desc
;
497 desc
.its_mapd_cmd
.dev
= dev
;
498 desc
.its_mapd_cmd
.valid
= !!valid
;
500 its_send_single_command(dev
->its
, its_build_mapd_cmd
, &desc
);
503 static void its_send_mapc(struct its_node
*its
, struct its_collection
*col
,
506 struct its_cmd_desc desc
;
508 desc
.its_mapc_cmd
.col
= col
;
509 desc
.its_mapc_cmd
.valid
= !!valid
;
511 its_send_single_command(its
, its_build_mapc_cmd
, &desc
);
514 static void its_send_mapvi(struct its_device
*dev
, u32 irq_id
, u32 id
)
516 struct its_cmd_desc desc
;
518 desc
.its_mapvi_cmd
.dev
= dev
;
519 desc
.its_mapvi_cmd
.phys_id
= irq_id
;
520 desc
.its_mapvi_cmd
.event_id
= id
;
522 its_send_single_command(dev
->its
, its_build_mapvi_cmd
, &desc
);
525 static void its_send_movi(struct its_device
*dev
,
526 struct its_collection
*col
, u32 id
)
528 struct its_cmd_desc desc
;
530 desc
.its_movi_cmd
.dev
= dev
;
531 desc
.its_movi_cmd
.col
= col
;
532 desc
.its_movi_cmd
.event_id
= id
;
534 its_send_single_command(dev
->its
, its_build_movi_cmd
, &desc
);
537 static void its_send_discard(struct its_device
*dev
, u32 id
)
539 struct its_cmd_desc desc
;
541 desc
.its_discard_cmd
.dev
= dev
;
542 desc
.its_discard_cmd
.event_id
= id
;
544 its_send_single_command(dev
->its
, its_build_discard_cmd
, &desc
);
547 static void its_send_invall(struct its_node
*its
, struct its_collection
*col
)
549 struct its_cmd_desc desc
;
551 desc
.its_invall_cmd
.col
= col
;
553 its_send_single_command(its
, its_build_invall_cmd
, &desc
);
557 * irqchip functions - assumes MSI, mostly.
560 static inline u32
its_get_event_id(struct irq_data
*d
)
562 struct its_device
*its_dev
= irq_data_get_irq_chip_data(d
);
563 return d
->hwirq
- its_dev
->event_map
.lpi_base
;
566 static void lpi_set_config(struct irq_data
*d
, bool enable
)
568 struct its_device
*its_dev
= irq_data_get_irq_chip_data(d
);
569 irq_hw_number_t hwirq
= d
->hwirq
;
570 u32 id
= its_get_event_id(d
);
571 u8
*cfg
= page_address(gic_rdists
->prop_page
) + hwirq
- 8192;
574 *cfg
|= LPI_PROP_ENABLED
;
576 *cfg
&= ~LPI_PROP_ENABLED
;
579 * Make the above write visible to the redistributors.
580 * And yes, we're flushing exactly: One. Single. Byte.
583 if (gic_rdists
->flags
& RDIST_FLAGS_PROPBASE_NEEDS_FLUSHING
)
584 __flush_dcache_area(cfg
, sizeof(*cfg
));
587 its_send_inv(its_dev
, id
);
590 static void its_mask_irq(struct irq_data
*d
)
592 lpi_set_config(d
, false);
595 static void its_unmask_irq(struct irq_data
*d
)
597 lpi_set_config(d
, true);
600 static void its_eoi_irq(struct irq_data
*d
)
602 gic_write_eoir(d
->hwirq
);
605 static int its_set_affinity(struct irq_data
*d
, const struct cpumask
*mask_val
,
608 unsigned int cpu
= cpumask_any_and(mask_val
, cpu_online_mask
);
609 struct its_device
*its_dev
= irq_data_get_irq_chip_data(d
);
610 struct its_collection
*target_col
;
611 u32 id
= its_get_event_id(d
);
613 if (cpu
>= nr_cpu_ids
)
616 target_col
= &its_dev
->its
->collections
[cpu
];
617 its_send_movi(its_dev
, target_col
, id
);
618 its_dev
->event_map
.col_map
[id
] = cpu
;
620 return IRQ_SET_MASK_OK_DONE
;
623 static void its_irq_compose_msi_msg(struct irq_data
*d
, struct msi_msg
*msg
)
625 struct its_device
*its_dev
= irq_data_get_irq_chip_data(d
);
626 struct its_node
*its
;
630 addr
= its
->phys_base
+ GITS_TRANSLATER
;
632 msg
->address_lo
= addr
& ((1UL << 32) - 1);
633 msg
->address_hi
= addr
>> 32;
634 msg
->data
= its_get_event_id(d
);
637 static struct irq_chip its_irq_chip
= {
639 .irq_mask
= its_mask_irq
,
640 .irq_unmask
= its_unmask_irq
,
641 .irq_eoi
= its_eoi_irq
,
642 .irq_set_affinity
= its_set_affinity
,
643 .irq_compose_msi_msg
= its_irq_compose_msi_msg
,
646 static void its_mask_msi_irq(struct irq_data
*d
)
649 irq_chip_mask_parent(d
);
652 static void its_unmask_msi_irq(struct irq_data
*d
)
654 pci_msi_unmask_irq(d
);
655 irq_chip_unmask_parent(d
);
658 static struct irq_chip its_msi_irq_chip
= {
660 .irq_unmask
= its_unmask_msi_irq
,
661 .irq_mask
= its_mask_msi_irq
,
662 .irq_eoi
= irq_chip_eoi_parent
,
663 .irq_write_msi_msg
= pci_msi_domain_write_msg
,
667 * How we allocate LPIs:
669 * The GIC has id_bits bits for interrupt identifiers. From there, we
670 * must subtract 8192 which are reserved for SGIs/PPIs/SPIs. Then, as
671 * we allocate LPIs by chunks of 32, we can shift the whole thing by 5
674 * This gives us (((1UL << id_bits) - 8192) >> 5) possible allocations.
676 #define IRQS_PER_CHUNK_SHIFT 5
677 #define IRQS_PER_CHUNK (1 << IRQS_PER_CHUNK_SHIFT)
679 static unsigned long *lpi_bitmap
;
680 static u32 lpi_chunks
;
681 static DEFINE_SPINLOCK(lpi_lock
);
683 static int its_lpi_to_chunk(int lpi
)
685 return (lpi
- 8192) >> IRQS_PER_CHUNK_SHIFT
;
688 static int its_chunk_to_lpi(int chunk
)
690 return (chunk
<< IRQS_PER_CHUNK_SHIFT
) + 8192;
693 static int its_lpi_init(u32 id_bits
)
695 lpi_chunks
= its_lpi_to_chunk(1UL << id_bits
);
697 lpi_bitmap
= kzalloc(BITS_TO_LONGS(lpi_chunks
) * sizeof(long),
704 pr_info("ITS: Allocated %d chunks for LPIs\n", (int)lpi_chunks
);
708 static unsigned long *its_lpi_alloc_chunks(int nr_irqs
, int *base
, int *nr_ids
)
710 unsigned long *bitmap
= NULL
;
715 nr_chunks
= DIV_ROUND_UP(nr_irqs
, IRQS_PER_CHUNK
);
717 spin_lock(&lpi_lock
);
720 chunk_id
= bitmap_find_next_zero_area(lpi_bitmap
, lpi_chunks
,
722 if (chunk_id
< lpi_chunks
)
726 } while (nr_chunks
> 0);
731 bitmap
= kzalloc(BITS_TO_LONGS(nr_chunks
* IRQS_PER_CHUNK
) * sizeof (long),
736 for (i
= 0; i
< nr_chunks
; i
++)
737 set_bit(chunk_id
+ i
, lpi_bitmap
);
739 *base
= its_chunk_to_lpi(chunk_id
);
740 *nr_ids
= nr_chunks
* IRQS_PER_CHUNK
;
743 spin_unlock(&lpi_lock
);
748 static void its_lpi_free(struct event_lpi_map
*map
)
750 int base
= map
->lpi_base
;
751 int nr_ids
= map
->nr_lpis
;
754 spin_lock(&lpi_lock
);
756 for (lpi
= base
; lpi
< (base
+ nr_ids
); lpi
+= IRQS_PER_CHUNK
) {
757 int chunk
= its_lpi_to_chunk(lpi
);
758 BUG_ON(chunk
> lpi_chunks
);
759 if (test_bit(chunk
, lpi_bitmap
)) {
760 clear_bit(chunk
, lpi_bitmap
);
762 pr_err("Bad LPI chunk %d\n", chunk
);
766 spin_unlock(&lpi_lock
);
773 * We allocate 64kB for PROPBASE. That gives us at most 64K LPIs to
774 * deal with (one configuration byte per interrupt). PENDBASE has to
775 * be 64kB aligned (one bit per LPI, plus 8192 bits for SPI/PPI/SGI).
777 #define LPI_PROPBASE_SZ SZ_64K
778 #define LPI_PENDBASE_SZ (LPI_PROPBASE_SZ / 8 + SZ_1K)
781 * This is how many bits of ID we need, including the useless ones.
783 #define LPI_NRBITS ilog2(LPI_PROPBASE_SZ + SZ_8K)
785 #define LPI_PROP_DEFAULT_PRIO 0xa0
787 static int __init
its_alloc_lpi_tables(void)
791 gic_rdists
->prop_page
= alloc_pages(GFP_NOWAIT
,
792 get_order(LPI_PROPBASE_SZ
));
793 if (!gic_rdists
->prop_page
) {
794 pr_err("Failed to allocate PROPBASE\n");
798 paddr
= page_to_phys(gic_rdists
->prop_page
);
799 pr_info("GIC: using LPI property table @%pa\n", &paddr
);
801 /* Priority 0xa0, Group-1, disabled */
802 memset(page_address(gic_rdists
->prop_page
),
803 LPI_PROP_DEFAULT_PRIO
| LPI_PROP_GROUP1
,
806 /* Make sure the GIC will observe the written configuration */
807 __flush_dcache_area(page_address(gic_rdists
->prop_page
), LPI_PROPBASE_SZ
);
812 static const char *its_base_type_string
[] = {
813 [GITS_BASER_TYPE_DEVICE
] = "Devices",
814 [GITS_BASER_TYPE_VCPU
] = "Virtual CPUs",
815 [GITS_BASER_TYPE_CPU
] = "Physical CPUs",
816 [GITS_BASER_TYPE_COLLECTION
] = "Interrupt Collections",
817 [GITS_BASER_TYPE_RESERVED5
] = "Reserved (5)",
818 [GITS_BASER_TYPE_RESERVED6
] = "Reserved (6)",
819 [GITS_BASER_TYPE_RESERVED7
] = "Reserved (7)",
822 static void its_free_tables(struct its_node
*its
)
826 for (i
= 0; i
< GITS_BASER_NR_REGS
; i
++) {
827 if (its
->tables
[i
]) {
828 free_page((unsigned long)its
->tables
[i
]);
829 its
->tables
[i
] = NULL
;
834 static int its_alloc_tables(struct its_node
*its
)
839 u64 shr
= GITS_BASER_InnerShareable
;
840 u64 cache
= GITS_BASER_WaWb
;
842 for (i
= 0; i
< GITS_BASER_NR_REGS
; i
++) {
843 u64 val
= readq_relaxed(its
->base
+ GITS_BASER
+ i
* 8);
844 u64 type
= GITS_BASER_TYPE(val
);
845 u64 entry_size
= GITS_BASER_ENTRY_SIZE(val
);
846 int order
= get_order(psz
);
851 if (type
== GITS_BASER_TYPE_NONE
)
855 * Allocate as many entries as required to fit the
856 * range of device IDs that the ITS can grok... The ID
857 * space being incredibly sparse, this results in a
858 * massive waste of memory.
860 * For other tables, only allocate a single page.
862 if (type
== GITS_BASER_TYPE_DEVICE
) {
863 u64 typer
= readq_relaxed(its
->base
+ GITS_TYPER
);
864 u32 ids
= GITS_TYPER_DEVBITS(typer
);
867 * 'order' was initialized earlier to the default page
868 * granule of the the ITS. We can't have an allocation
869 * smaller than that. If the requested allocation
870 * is smaller, round up to the default page granule.
872 order
= max(get_order((1UL << ids
) * entry_size
),
874 if (order
>= MAX_ORDER
) {
875 order
= MAX_ORDER
- 1;
876 pr_warn("%s: Device Table too large, reduce its page order to %u\n",
877 its
->msi_chip
.of_node
->full_name
, order
);
881 alloc_size
= (1 << order
) * PAGE_SIZE
;
882 base
= (void *)__get_free_pages(GFP_KERNEL
| __GFP_ZERO
, order
);
888 its
->tables
[i
] = base
;
891 val
= (virt_to_phys(base
) |
892 (type
<< GITS_BASER_TYPE_SHIFT
) |
893 ((entry_size
- 1) << GITS_BASER_ENTRY_SIZE_SHIFT
) |
900 val
|= GITS_BASER_PAGE_SIZE_4K
;
903 val
|= GITS_BASER_PAGE_SIZE_16K
;
906 val
|= GITS_BASER_PAGE_SIZE_64K
;
910 val
|= (alloc_size
/ psz
) - 1;
912 writeq_relaxed(val
, its
->base
+ GITS_BASER
+ i
* 8);
913 tmp
= readq_relaxed(its
->base
+ GITS_BASER
+ i
* 8);
915 if ((val
^ tmp
) & GITS_BASER_SHAREABILITY_MASK
) {
917 * Shareability didn't stick. Just use
918 * whatever the read reported, which is likely
919 * to be the only thing this redistributor
920 * supports. If that's zero, make it
921 * non-cacheable as well.
923 shr
= tmp
& GITS_BASER_SHAREABILITY_MASK
;
925 cache
= GITS_BASER_nC
;
929 if ((val
^ tmp
) & GITS_BASER_PAGE_SIZE_MASK
) {
931 * Page size didn't stick. Let's try a smaller
932 * size and retry. If we reach 4K, then
933 * something is horribly wrong...
946 pr_err("ITS: %s: GITS_BASER%d doesn't stick: %lx %lx\n",
947 its
->msi_chip
.of_node
->full_name
, i
,
948 (unsigned long) val
, (unsigned long) tmp
);
953 pr_info("ITS: allocated %d %s @%lx (psz %dK, shr %d)\n",
954 (int)(alloc_size
/ entry_size
),
955 its_base_type_string
[type
],
956 (unsigned long)virt_to_phys(base
),
957 psz
/ SZ_1K
, (int)shr
>> GITS_BASER_SHAREABILITY_SHIFT
);
963 its_free_tables(its
);
968 static int its_alloc_collections(struct its_node
*its
)
970 its
->collections
= kzalloc(nr_cpu_ids
* sizeof(*its
->collections
),
972 if (!its
->collections
)
978 static void its_cpu_init_lpis(void)
980 void __iomem
*rbase
= gic_data_rdist_rd_base();
981 struct page
*pend_page
;
984 /* If we didn't allocate the pending table yet, do it now */
985 pend_page
= gic_data_rdist()->pend_page
;
989 * The pending pages have to be at least 64kB aligned,
990 * hence the 'max(LPI_PENDBASE_SZ, SZ_64K)' below.
992 pend_page
= alloc_pages(GFP_NOWAIT
| __GFP_ZERO
,
993 get_order(max(LPI_PENDBASE_SZ
, SZ_64K
)));
995 pr_err("Failed to allocate PENDBASE for CPU%d\n",
1000 /* Make sure the GIC will observe the zero-ed page */
1001 __flush_dcache_area(page_address(pend_page
), LPI_PENDBASE_SZ
);
1003 paddr
= page_to_phys(pend_page
);
1004 pr_info("CPU%d: using LPI pending table @%pa\n",
1005 smp_processor_id(), &paddr
);
1006 gic_data_rdist()->pend_page
= pend_page
;
1010 val
= readl_relaxed(rbase
+ GICR_CTLR
);
1011 val
&= ~GICR_CTLR_ENABLE_LPIS
;
1012 writel_relaxed(val
, rbase
+ GICR_CTLR
);
1015 * Make sure any change to the table is observable by the GIC.
1020 val
= (page_to_phys(gic_rdists
->prop_page
) |
1021 GICR_PROPBASER_InnerShareable
|
1022 GICR_PROPBASER_WaWb
|
1023 ((LPI_NRBITS
- 1) & GICR_PROPBASER_IDBITS_MASK
));
1025 writeq_relaxed(val
, rbase
+ GICR_PROPBASER
);
1026 tmp
= readq_relaxed(rbase
+ GICR_PROPBASER
);
1028 if ((tmp
^ val
) & GICR_PROPBASER_SHAREABILITY_MASK
) {
1029 if (!(tmp
& GICR_PROPBASER_SHAREABILITY_MASK
)) {
1031 * The HW reports non-shareable, we must
1032 * remove the cacheability attributes as
1035 val
&= ~(GICR_PROPBASER_SHAREABILITY_MASK
|
1036 GICR_PROPBASER_CACHEABILITY_MASK
);
1037 val
|= GICR_PROPBASER_nC
;
1038 writeq_relaxed(val
, rbase
+ GICR_PROPBASER
);
1040 pr_info_once("GIC: using cache flushing for LPI property table\n");
1041 gic_rdists
->flags
|= RDIST_FLAGS_PROPBASE_NEEDS_FLUSHING
;
1045 val
= (page_to_phys(pend_page
) |
1046 GICR_PENDBASER_InnerShareable
|
1047 GICR_PENDBASER_WaWb
);
1049 writeq_relaxed(val
, rbase
+ GICR_PENDBASER
);
1050 tmp
= readq_relaxed(rbase
+ GICR_PENDBASER
);
1052 if (!(tmp
& GICR_PENDBASER_SHAREABILITY_MASK
)) {
1054 * The HW reports non-shareable, we must remove the
1055 * cacheability attributes as well.
1057 val
&= ~(GICR_PENDBASER_SHAREABILITY_MASK
|
1058 GICR_PENDBASER_CACHEABILITY_MASK
);
1059 val
|= GICR_PENDBASER_nC
;
1060 writeq_relaxed(val
, rbase
+ GICR_PENDBASER
);
1064 val
= readl_relaxed(rbase
+ GICR_CTLR
);
1065 val
|= GICR_CTLR_ENABLE_LPIS
;
1066 writel_relaxed(val
, rbase
+ GICR_CTLR
);
1068 /* Make sure the GIC has seen the above */
1072 static void its_cpu_init_collection(void)
1074 struct its_node
*its
;
1077 spin_lock(&its_lock
);
1078 cpu
= smp_processor_id();
1080 list_for_each_entry(its
, &its_nodes
, entry
) {
1084 * We now have to bind each collection to its target
1087 if (readq_relaxed(its
->base
+ GITS_TYPER
) & GITS_TYPER_PTA
) {
1089 * This ITS wants the physical address of the
1092 target
= gic_data_rdist()->phys_base
;
1095 * This ITS wants a linear CPU number.
1097 target
= readq_relaxed(gic_data_rdist_rd_base() + GICR_TYPER
);
1098 target
= GICR_TYPER_CPU_NUMBER(target
) << 16;
1101 /* Perform collection mapping */
1102 its
->collections
[cpu
].target_address
= target
;
1103 its
->collections
[cpu
].col_id
= cpu
;
1105 its_send_mapc(its
, &its
->collections
[cpu
], 1);
1106 its_send_invall(its
, &its
->collections
[cpu
]);
1109 spin_unlock(&its_lock
);
1112 static struct its_device
*its_find_device(struct its_node
*its
, u32 dev_id
)
1114 struct its_device
*its_dev
= NULL
, *tmp
;
1115 unsigned long flags
;
1117 raw_spin_lock_irqsave(&its
->lock
, flags
);
1119 list_for_each_entry(tmp
, &its
->its_device_list
, entry
) {
1120 if (tmp
->device_id
== dev_id
) {
1126 raw_spin_unlock_irqrestore(&its
->lock
, flags
);
1131 static struct its_device
*its_create_device(struct its_node
*its
, u32 dev_id
,
1134 struct its_device
*dev
;
1135 unsigned long *lpi_map
;
1136 unsigned long flags
;
1137 u16
*col_map
= NULL
;
1144 dev
= kzalloc(sizeof(*dev
), GFP_KERNEL
);
1146 * At least one bit of EventID is being used, hence a minimum
1147 * of two entries. No, the architecture doesn't let you
1148 * express an ITT with a single entry.
1150 nr_ites
= max(2UL, roundup_pow_of_two(nvecs
));
1151 sz
= nr_ites
* its
->ite_size
;
1152 sz
= max(sz
, ITS_ITT_ALIGN
) + ITS_ITT_ALIGN
- 1;
1153 itt
= kzalloc(sz
, GFP_KERNEL
);
1154 lpi_map
= its_lpi_alloc_chunks(nvecs
, &lpi_base
, &nr_lpis
);
1156 col_map
= kzalloc(sizeof(*col_map
) * nr_lpis
, GFP_KERNEL
);
1158 if (!dev
|| !itt
|| !lpi_map
|| !col_map
) {
1168 dev
->nr_ites
= nr_ites
;
1169 dev
->event_map
.lpi_map
= lpi_map
;
1170 dev
->event_map
.col_map
= col_map
;
1171 dev
->event_map
.lpi_base
= lpi_base
;
1172 dev
->event_map
.nr_lpis
= nr_lpis
;
1173 dev
->device_id
= dev_id
;
1174 INIT_LIST_HEAD(&dev
->entry
);
1176 raw_spin_lock_irqsave(&its
->lock
, flags
);
1177 list_add(&dev
->entry
, &its
->its_device_list
);
1178 raw_spin_unlock_irqrestore(&its
->lock
, flags
);
1180 /* Map device to its ITT */
1181 its_send_mapd(dev
, 1);
1186 static void its_free_device(struct its_device
*its_dev
)
1188 unsigned long flags
;
1190 raw_spin_lock_irqsave(&its_dev
->its
->lock
, flags
);
1191 list_del(&its_dev
->entry
);
1192 raw_spin_unlock_irqrestore(&its_dev
->its
->lock
, flags
);
1193 kfree(its_dev
->itt
);
1197 static int its_alloc_device_irq(struct its_device
*dev
, irq_hw_number_t
*hwirq
)
1201 idx
= find_first_zero_bit(dev
->event_map
.lpi_map
,
1202 dev
->event_map
.nr_lpis
);
1203 if (idx
== dev
->event_map
.nr_lpis
)
1206 *hwirq
= dev
->event_map
.lpi_base
+ idx
;
1207 set_bit(idx
, dev
->event_map
.lpi_map
);
1212 struct its_pci_alias
{
1213 struct pci_dev
*pdev
;
1218 static int its_pci_msi_vec_count(struct pci_dev
*pdev
)
1222 msi
= max(pci_msi_vec_count(pdev
), 0);
1223 msix
= max(pci_msix_vec_count(pdev
), 0);
1225 return max(msi
, msix
);
1228 static int its_get_pci_alias(struct pci_dev
*pdev
, u16 alias
, void *data
)
1230 struct its_pci_alias
*dev_alias
= data
;
1232 dev_alias
->dev_id
= alias
;
1233 if (pdev
!= dev_alias
->pdev
)
1234 dev_alias
->count
+= its_pci_msi_vec_count(dev_alias
->pdev
);
1239 static int its_msi_prepare(struct irq_domain
*domain
, struct device
*dev
,
1240 int nvec
, msi_alloc_info_t
*info
)
1242 struct pci_dev
*pdev
;
1243 struct its_node
*its
;
1244 struct its_device
*its_dev
;
1245 struct its_pci_alias dev_alias
;
1247 if (!dev_is_pci(dev
))
1250 pdev
= to_pci_dev(dev
);
1251 dev_alias
.pdev
= pdev
;
1252 dev_alias
.count
= nvec
;
1254 pci_for_each_dma_alias(pdev
, its_get_pci_alias
, &dev_alias
);
1255 its
= domain
->parent
->host_data
;
1257 its_dev
= its_find_device(its
, dev_alias
.dev_id
);
1260 * We already have seen this ID, probably through
1261 * another alias (PCI bridge of some sort). No need to
1262 * create the device.
1264 dev_dbg(dev
, "Reusing ITT for devID %x\n", dev_alias
.dev_id
);
1268 its_dev
= its_create_device(its
, dev_alias
.dev_id
, dev_alias
.count
);
1272 dev_dbg(&pdev
->dev
, "ITT %d entries, %d bits\n",
1273 dev_alias
.count
, ilog2(dev_alias
.count
));
1275 info
->scratchpad
[0].ptr
= its_dev
;
1276 info
->scratchpad
[1].ptr
= dev
;
1280 static struct msi_domain_ops its_pci_msi_ops
= {
1281 .msi_prepare
= its_msi_prepare
,
1284 static struct msi_domain_info its_pci_msi_domain_info
= {
1285 .flags
= (MSI_FLAG_USE_DEF_DOM_OPS
| MSI_FLAG_USE_DEF_CHIP_OPS
|
1286 MSI_FLAG_MULTI_PCI_MSI
| MSI_FLAG_PCI_MSIX
),
1287 .ops
= &its_pci_msi_ops
,
1288 .chip
= &its_msi_irq_chip
,
1291 static int its_irq_gic_domain_alloc(struct irq_domain
*domain
,
1293 irq_hw_number_t hwirq
)
1295 struct of_phandle_args args
;
1297 args
.np
= domain
->parent
->of_node
;
1298 args
.args_count
= 3;
1299 args
.args
[0] = GIC_IRQ_TYPE_LPI
;
1300 args
.args
[1] = hwirq
;
1301 args
.args
[2] = IRQ_TYPE_EDGE_RISING
;
1303 return irq_domain_alloc_irqs_parent(domain
, virq
, 1, &args
);
1306 static int its_irq_domain_alloc(struct irq_domain
*domain
, unsigned int virq
,
1307 unsigned int nr_irqs
, void *args
)
1309 msi_alloc_info_t
*info
= args
;
1310 struct its_device
*its_dev
= info
->scratchpad
[0].ptr
;
1311 irq_hw_number_t hwirq
;
1315 for (i
= 0; i
< nr_irqs
; i
++) {
1316 err
= its_alloc_device_irq(its_dev
, &hwirq
);
1320 err
= its_irq_gic_domain_alloc(domain
, virq
+ i
, hwirq
);
1324 irq_domain_set_hwirq_and_chip(domain
, virq
+ i
,
1325 hwirq
, &its_irq_chip
, its_dev
);
1326 dev_dbg(info
->scratchpad
[1].ptr
, "ID:%d pID:%d vID:%d\n",
1327 (int)(hwirq
- its_dev
->event_map
.lpi_base
),
1328 (int)hwirq
, virq
+ i
);
1334 static void its_irq_domain_activate(struct irq_domain
*domain
,
1337 struct its_device
*its_dev
= irq_data_get_irq_chip_data(d
);
1338 u32 event
= its_get_event_id(d
);
1340 /* Bind the LPI to the first possible CPU */
1341 its_dev
->event_map
.col_map
[event
] = cpumask_first(cpu_online_mask
);
1343 /* Map the GIC IRQ and event to the device */
1344 its_send_mapvi(its_dev
, d
->hwirq
, event
);
1347 static void its_irq_domain_deactivate(struct irq_domain
*domain
,
1350 struct its_device
*its_dev
= irq_data_get_irq_chip_data(d
);
1351 u32 event
= its_get_event_id(d
);
1353 /* Stop the delivery of interrupts */
1354 its_send_discard(its_dev
, event
);
1357 static void its_irq_domain_free(struct irq_domain
*domain
, unsigned int virq
,
1358 unsigned int nr_irqs
)
1360 struct irq_data
*d
= irq_domain_get_irq_data(domain
, virq
);
1361 struct its_device
*its_dev
= irq_data_get_irq_chip_data(d
);
1364 for (i
= 0; i
< nr_irqs
; i
++) {
1365 struct irq_data
*data
= irq_domain_get_irq_data(domain
,
1367 u32 event
= its_get_event_id(data
);
1369 /* Mark interrupt index as unused */
1370 clear_bit(event
, its_dev
->event_map
.lpi_map
);
1372 /* Nuke the entry in the domain */
1373 irq_domain_reset_irq_data(data
);
1376 /* If all interrupts have been freed, start mopping the floor */
1377 if (bitmap_empty(its_dev
->event_map
.lpi_map
,
1378 its_dev
->event_map
.nr_lpis
)) {
1379 its_lpi_free(&its_dev
->event_map
);
1381 /* Unmap device/itt */
1382 its_send_mapd(its_dev
, 0);
1383 its_free_device(its_dev
);
1386 irq_domain_free_irqs_parent(domain
, virq
, nr_irqs
);
1389 static const struct irq_domain_ops its_domain_ops
= {
1390 .alloc
= its_irq_domain_alloc
,
1391 .free
= its_irq_domain_free
,
1392 .activate
= its_irq_domain_activate
,
1393 .deactivate
= its_irq_domain_deactivate
,
1396 static int its_force_quiescent(void __iomem
*base
)
1398 u32 count
= 1000000; /* 1s */
1401 val
= readl_relaxed(base
+ GITS_CTLR
);
1402 if (val
& GITS_CTLR_QUIESCENT
)
1405 /* Disable the generation of all interrupts to this ITS */
1406 val
&= ~GITS_CTLR_ENABLE
;
1407 writel_relaxed(val
, base
+ GITS_CTLR
);
1409 /* Poll GITS_CTLR and wait until ITS becomes quiescent */
1411 val
= readl_relaxed(base
+ GITS_CTLR
);
1412 if (val
& GITS_CTLR_QUIESCENT
)
1424 static int its_probe(struct device_node
*node
, struct irq_domain
*parent
)
1426 struct resource res
;
1427 struct its_node
*its
;
1428 void __iomem
*its_base
;
1433 err
= of_address_to_resource(node
, 0, &res
);
1435 pr_warn("%s: no regs?\n", node
->full_name
);
1439 its_base
= ioremap(res
.start
, resource_size(&res
));
1441 pr_warn("%s: unable to map registers\n", node
->full_name
);
1445 val
= readl_relaxed(its_base
+ GITS_PIDR2
) & GIC_PIDR2_ARCH_MASK
;
1446 if (val
!= 0x30 && val
!= 0x40) {
1447 pr_warn("%s: no ITS detected, giving up\n", node
->full_name
);
1452 err
= its_force_quiescent(its_base
);
1454 pr_warn("%s: failed to quiesce, giving up\n",
1459 pr_info("ITS: %s\n", node
->full_name
);
1461 its
= kzalloc(sizeof(*its
), GFP_KERNEL
);
1467 raw_spin_lock_init(&its
->lock
);
1468 INIT_LIST_HEAD(&its
->entry
);
1469 INIT_LIST_HEAD(&its
->its_device_list
);
1470 its
->base
= its_base
;
1471 its
->phys_base
= res
.start
;
1472 its
->msi_chip
.of_node
= node
;
1473 its
->ite_size
= ((readl_relaxed(its_base
+ GITS_TYPER
) >> 4) & 0xf) + 1;
1475 its
->cmd_base
= kzalloc(ITS_CMD_QUEUE_SZ
, GFP_KERNEL
);
1476 if (!its
->cmd_base
) {
1480 its
->cmd_write
= its
->cmd_base
;
1482 err
= its_alloc_tables(its
);
1486 err
= its_alloc_collections(its
);
1488 goto out_free_tables
;
1490 baser
= (virt_to_phys(its
->cmd_base
) |
1492 GITS_CBASER_InnerShareable
|
1493 (ITS_CMD_QUEUE_SZ
/ SZ_4K
- 1) |
1496 writeq_relaxed(baser
, its
->base
+ GITS_CBASER
);
1497 tmp
= readq_relaxed(its
->base
+ GITS_CBASER
);
1499 if ((tmp
^ baser
) & GITS_CBASER_SHAREABILITY_MASK
) {
1500 if (!(tmp
& GITS_CBASER_SHAREABILITY_MASK
)) {
1502 * The HW reports non-shareable, we must
1503 * remove the cacheability attributes as
1506 baser
&= ~(GITS_CBASER_SHAREABILITY_MASK
|
1507 GITS_CBASER_CACHEABILITY_MASK
);
1508 baser
|= GITS_CBASER_nC
;
1509 writeq_relaxed(baser
, its
->base
+ GITS_CBASER
);
1511 pr_info("ITS: using cache flushing for cmd queue\n");
1512 its
->flags
|= ITS_FLAGS_CMDQ_NEEDS_FLUSHING
;
1515 writeq_relaxed(0, its
->base
+ GITS_CWRITER
);
1516 writel_relaxed(GITS_CTLR_ENABLE
, its
->base
+ GITS_CTLR
);
1518 if (of_property_read_bool(its
->msi_chip
.of_node
, "msi-controller")) {
1519 its
->domain
= irq_domain_add_tree(NULL
, &its_domain_ops
, its
);
1522 goto out_free_tables
;
1525 its
->domain
->parent
= parent
;
1527 its
->msi_chip
.domain
= pci_msi_create_irq_domain(node
,
1528 &its_pci_msi_domain_info
,
1530 if (!its
->msi_chip
.domain
) {
1532 goto out_free_domains
;
1535 err
= of_pci_msi_chip_add(&its
->msi_chip
);
1537 goto out_free_domains
;
1540 spin_lock(&its_lock
);
1541 list_add(&its
->entry
, &its_nodes
);
1542 spin_unlock(&its_lock
);
1547 if (its
->msi_chip
.domain
)
1548 irq_domain_remove(its
->msi_chip
.domain
);
1550 irq_domain_remove(its
->domain
);
1552 its_free_tables(its
);
1554 kfree(its
->cmd_base
);
1559 pr_err("ITS: failed probing %s (%d)\n", node
->full_name
, err
);
1563 static bool gic_rdists_supports_plpis(void)
1565 return !!(readl_relaxed(gic_data_rdist_rd_base() + GICR_TYPER
) & GICR_TYPER_PLPIS
);
1568 int its_cpu_init(void)
1570 if (!list_empty(&its_nodes
)) {
1571 if (!gic_rdists_supports_plpis()) {
1572 pr_info("CPU%d: LPIs not supported\n", smp_processor_id());
1575 its_cpu_init_lpis();
1576 its_cpu_init_collection();
1582 static struct of_device_id its_device_id
[] = {
1583 { .compatible
= "arm,gic-v3-its", },
1587 int its_init(struct device_node
*node
, struct rdists
*rdists
,
1588 struct irq_domain
*parent_domain
)
1590 struct device_node
*np
;
1592 for (np
= of_find_matching_node(node
, its_device_id
); np
;
1593 np
= of_find_matching_node(np
, its_device_id
)) {
1594 its_probe(np
, parent_domain
);
1597 if (list_empty(&its_nodes
)) {
1598 pr_warn("ITS: No ITS available, not enabling LPIs\n");
1602 gic_rdists
= rdists
;
1603 gic_root_node
= node
;
1605 its_alloc_lpi_tables();
1606 its_lpi_init(rdists
->id_bits
);