Lines Matching +full:irqs +full:- +full:reserved
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright 2014-2016 IBM Corp.
7 #include <asm/pnv-pci.h>
14 struct pci_controller *hose = pci_bus_to_host(dev->bus); in pnv_phb_to_cxl_mode()
15 struct pnv_phb *phb = hose->private_data; in pnv_phb_to_cxl_mode()
21 return -ENODEV; in pnv_phb_to_cxl_mode()
25 rc = opal_pci_set_phb_cxl_mode(phb->opal_id, mode, pe->pe_number); in pnv_phb_to_cxl_mode()
27 dev_err(&dev->dev, "Required cxl mode not supported by firmware - update skiboot\n"); in pnv_phb_to_cxl_mode()
29 dev_err(&dev->dev, "opal_pci_set_phb_cxl_mode failed: %i\n", rc); in pnv_phb_to_cxl_mode()
40 struct pci_controller *hose = pci_bus_to_host(dev->bus); in pnv_cxl_alloc_hwirqs()
41 struct pnv_phb *phb = hose->private_data; in pnv_cxl_alloc_hwirqs()
42 int hwirq = msi_bitmap_alloc_hwirqs(&phb->msi_bmp, num); in pnv_cxl_alloc_hwirqs()
45 dev_warn(&dev->dev, "Failed to find a free MSI\n"); in pnv_cxl_alloc_hwirqs()
46 return -ENOSPC; in pnv_cxl_alloc_hwirqs()
49 return phb->msi_base + hwirq; in pnv_cxl_alloc_hwirqs()
55 struct pci_controller *hose = pci_bus_to_host(dev->bus); in pnv_cxl_release_hwirqs()
56 struct pnv_phb *phb = hose->private_data; in pnv_cxl_release_hwirqs()
58 msi_bitmap_free_hwirqs(&phb->msi_bmp, hwirq - phb->msi_base, num); in pnv_cxl_release_hwirqs()
62 void pnv_cxl_release_hwirq_ranges(struct cxl_irq_ranges *irqs, in pnv_cxl_release_hwirq_ranges() argument
65 struct pci_controller *hose = pci_bus_to_host(dev->bus); in pnv_cxl_release_hwirq_ranges()
66 struct pnv_phb *phb = hose->private_data; in pnv_cxl_release_hwirq_ranges()
70 if (!irqs->range[i]) in pnv_cxl_release_hwirq_ranges()
73 i, irqs->offset[i], in pnv_cxl_release_hwirq_ranges()
74 irqs->range[i]); in pnv_cxl_release_hwirq_ranges()
75 hwirq = irqs->offset[i] - phb->msi_base; in pnv_cxl_release_hwirq_ranges()
76 msi_bitmap_free_hwirqs(&phb->msi_bmp, hwirq, in pnv_cxl_release_hwirq_ranges()
77 irqs->range[i]); in pnv_cxl_release_hwirq_ranges()
82 int pnv_cxl_alloc_hwirq_ranges(struct cxl_irq_ranges *irqs, in pnv_cxl_alloc_hwirq_ranges() argument
85 struct pci_controller *hose = pci_bus_to_host(dev->bus); in pnv_cxl_alloc_hwirq_ranges()
86 struct pnv_phb *phb = hose->private_data; in pnv_cxl_alloc_hwirq_ranges()
89 memset(irqs, 0, sizeof(struct cxl_irq_ranges)); in pnv_cxl_alloc_hwirq_ranges()
91 /* 0 is reserved for the multiplexed PSL DSI interrupt */ in pnv_cxl_alloc_hwirq_ranges()
95 hwirq = msi_bitmap_alloc_hwirqs(&phb->msi_bmp, try); in pnv_cxl_alloc_hwirq_ranges()
103 irqs->offset[i] = phb->msi_base + hwirq; in pnv_cxl_alloc_hwirq_ranges()
104 irqs->range[i] = try; in pnv_cxl_alloc_hwirq_ranges()
106 i, irqs->offset[i], irqs->range[i]); in pnv_cxl_alloc_hwirq_ranges()
107 num -= try; in pnv_cxl_alloc_hwirq_ranges()
114 pnv_cxl_release_hwirq_ranges(irqs, dev); in pnv_cxl_alloc_hwirq_ranges()
115 return -ENOSPC; in pnv_cxl_alloc_hwirq_ranges()
121 struct pci_controller *hose = pci_bus_to_host(dev->bus); in pnv_cxl_get_irq_count()
122 struct pnv_phb *phb = hose->private_data; in pnv_cxl_get_irq_count()
124 return phb->msi_bmp.irq_count; in pnv_cxl_get_irq_count()
131 struct pci_controller *hose = pci_bus_to_host(dev->bus); in pnv_cxl_ioda_msi_setup()
132 struct pnv_phb *phb = hose->private_data; in pnv_cxl_ioda_msi_setup()
133 unsigned int xive_num = hwirq - phb->msi_base; in pnv_cxl_ioda_msi_setup()
138 return -ENODEV; in pnv_cxl_ioda_msi_setup()
141 rc = opal_pci_set_xive_pe(phb->opal_id, pe->pe_number, xive_num); in pnv_cxl_ioda_msi_setup()
145 pci_name(dev), rc, phb->msi_base, hwirq, xive_num); in pnv_cxl_ioda_msi_setup()
146 return -EIO; in pnv_cxl_ioda_msi_setup()
168 return -ENODEV; in get_cxl_module()