^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (C) 2016 ARM Limited, All Rights Reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Author: Marc Zyngier <marc.zyngier@arm.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #include <linux/bitops.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/irqchip.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/irqchip/chained_irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/irqchip/irq-partition-percpu.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/irqdomain.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/seq_file.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) struct partition_desc {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) int nr_parts;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) struct partition_affinity *parts;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) struct irq_domain *domain;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) struct irq_desc *chained_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) unsigned long *bitmap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) struct irq_domain_ops ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) static bool partition_check_cpu(struct partition_desc *part,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) unsigned int cpu, unsigned int hwirq)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) return cpumask_test_cpu(cpu, &part->parts[hwirq].mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) static void partition_irq_mask(struct irq_data *d)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) struct partition_desc *part = irq_data_get_irq_chip_data(d);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) struct irq_chip *chip = irq_desc_get_chip(part->chained_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) struct irq_data *data = irq_desc_get_irq_data(part->chained_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) if (partition_check_cpu(part, smp_processor_id(), d->hwirq) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) chip->irq_mask)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) chip->irq_mask(data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) static void partition_irq_unmask(struct irq_data *d)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) struct partition_desc *part = irq_data_get_irq_chip_data(d);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) struct irq_chip *chip = irq_desc_get_chip(part->chained_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) struct irq_data *data = irq_desc_get_irq_data(part->chained_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) if (partition_check_cpu(part, smp_processor_id(), d->hwirq) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) chip->irq_unmask)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) chip->irq_unmask(data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) static int partition_irq_set_irqchip_state(struct irq_data *d,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) enum irqchip_irq_state which,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) bool val)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) struct partition_desc *part = irq_data_get_irq_chip_data(d);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) struct irq_chip *chip = irq_desc_get_chip(part->chained_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) struct irq_data *data = irq_desc_get_irq_data(part->chained_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) if (partition_check_cpu(part, smp_processor_id(), d->hwirq) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) chip->irq_set_irqchip_state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) return chip->irq_set_irqchip_state(data, which, val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) static int partition_irq_get_irqchip_state(struct irq_data *d,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) enum irqchip_irq_state which,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) bool *val)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) struct partition_desc *part = irq_data_get_irq_chip_data(d);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) struct irq_chip *chip = irq_desc_get_chip(part->chained_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) struct irq_data *data = irq_desc_get_irq_data(part->chained_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) if (partition_check_cpu(part, smp_processor_id(), d->hwirq) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) chip->irq_get_irqchip_state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) return chip->irq_get_irqchip_state(data, which, val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) static int partition_irq_set_type(struct irq_data *d, unsigned int type)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) struct partition_desc *part = irq_data_get_irq_chip_data(d);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) struct irq_chip *chip = irq_desc_get_chip(part->chained_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) struct irq_data *data = irq_desc_get_irq_data(part->chained_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) if (chip->irq_set_type)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) return chip->irq_set_type(data, type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) static void partition_irq_print_chip(struct irq_data *d, struct seq_file *p)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) struct partition_desc *part = irq_data_get_irq_chip_data(d);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) struct irq_chip *chip = irq_desc_get_chip(part->chained_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) struct irq_data *data = irq_desc_get_irq_data(part->chained_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) seq_printf(p, " %5s-%lu", chip->name, data->hwirq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) static struct irq_chip partition_irq_chip = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) .irq_mask = partition_irq_mask,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) .irq_unmask = partition_irq_unmask,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) .irq_set_type = partition_irq_set_type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) .irq_get_irqchip_state = partition_irq_get_irqchip_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) .irq_set_irqchip_state = partition_irq_set_irqchip_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) .irq_print_chip = partition_irq_print_chip,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) static void partition_handle_irq(struct irq_desc *desc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) struct partition_desc *part = irq_desc_get_handler_data(desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) struct irq_chip *chip = irq_desc_get_chip(desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) int cpu = smp_processor_id();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) int hwirq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) chained_irq_enter(chip, desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) for_each_set_bit(hwirq, part->bitmap, part->nr_parts) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) if (partition_check_cpu(part, cpu, hwirq))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) if (unlikely(hwirq == part->nr_parts)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) handle_bad_irq(desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) unsigned int irq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) irq = irq_find_mapping(part->domain, hwirq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) generic_handle_irq(irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) chained_irq_exit(chip, desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) static int partition_domain_alloc(struct irq_domain *domain, unsigned int virq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) unsigned int nr_irqs, void *arg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) irq_hw_number_t hwirq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) unsigned int type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) struct irq_fwspec *fwspec = arg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) struct partition_desc *part;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) BUG_ON(nr_irqs != 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) ret = domain->ops->translate(domain, fwspec, &hwirq, &type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) part = domain->host_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) set_bit(hwirq, part->bitmap);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) irq_set_chained_handler_and_data(irq_desc_get_irq(part->chained_desc),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) partition_handle_irq, part);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) irq_set_percpu_devid_partition(virq, &part->parts[hwirq].mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) irq_domain_set_info(domain, virq, hwirq, &partition_irq_chip, part,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) handle_percpu_devid_irq, NULL, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) irq_set_status_flags(virq, IRQ_NOAUTOEN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) static void partition_domain_free(struct irq_domain *domain, unsigned int virq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) unsigned int nr_irqs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) struct irq_data *d;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) BUG_ON(nr_irqs != 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) d = irq_domain_get_irq_data(domain, virq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) irq_set_handler(virq, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) irq_domain_reset_irq_data(d);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) int partition_translate_id(struct partition_desc *desc, void *partition_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) struct partition_affinity *part = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) for (i = 0; i < desc->nr_parts; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) if (desc->parts[i].partition_id == partition_id) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) part = &desc->parts[i];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) if (WARN_ON(!part)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) pr_err("Failed to find partition\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) return i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) struct partition_desc *partition_create_desc(struct fwnode_handle *fwnode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) struct partition_affinity *parts,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) int nr_parts,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) int chained_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) const struct irq_domain_ops *ops)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) struct partition_desc *desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) struct irq_domain *d;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) BUG_ON(!ops->select || !ops->translate);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) desc = kzalloc(sizeof(*desc), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) if (!desc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) desc->ops = *ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) desc->ops.free = partition_domain_free;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) desc->ops.alloc = partition_domain_alloc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) d = irq_domain_create_linear(fwnode, nr_parts, &desc->ops, desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) if (!d)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) desc->domain = d;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) desc->bitmap = kcalloc(BITS_TO_LONGS(nr_parts), sizeof(long),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) if (WARN_ON(!desc->bitmap))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) desc->chained_desc = irq_to_desc(chained_irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) desc->nr_parts = nr_parts;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) desc->parts = parts;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) return desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) if (d)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) irq_domain_remove(d);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) kfree(desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) struct irq_domain *partition_get_domain(struct partition_desc *dsc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) if (dsc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) return dsc->domain;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) }