Lines Matching +full:max +full:- +full:cur

1 // SPDX-License-Identifier: GPL-2.0-or-later
35 afu->guest->handle = addr; in read_phys_addr()
38 afu->guest->p2n_phys += addr; in read_phys_addr()
39 afu->guest->p2n_size = size; in read_phys_addr()
42 afu->psn_phys += addr; in read_phys_addr()
43 afu->adapter->ps_size = size; in read_phys_addr()
48 return -EINVAL; in read_phys_addr()
77 return of_property_read_reg(afu_np, 0, &afu->guest->handle, NULL); in cxl_of_read_afu_handle()
92 rc = read_phys_addr(np, "assigned-addresses", afu); in cxl_of_read_afu_properties()
96 if (afu->psn_phys == 0) in cxl_of_read_afu_properties()
97 afu->psa = false; in cxl_of_read_afu_properties()
99 afu->psa = true; in cxl_of_read_afu_properties()
101 of_property_read_u32(np, "ibm,#processes", &afu->max_procs_virtualised); in cxl_of_read_afu_properties()
106 of_property_read_u32(np, "ibm,max-ints-per-process", &afu->guest->max_ints); in cxl_of_read_afu_properties()
107 afu->irqs_max = afu->guest->max_ints; in cxl_of_read_afu_properties()
109 if (!of_property_read_u32(np, "ibm,min-ints-per-process", &afu->pp_irqs)) { in cxl_of_read_afu_properties()
114 afu->pp_irqs--; in cxl_of_read_afu_properties()
117 of_property_read_u64(np, "ibm,error-buffer-size", &afu->eb_len); in cxl_of_read_afu_properties()
118 afu->eb_offset = 0; in cxl_of_read_afu_properties()
120 of_property_read_u64(np, "ibm,config-record-size", &afu->crs_len); in cxl_of_read_afu_properties()
121 afu->crs_offset = 0; in cxl_of_read_afu_properties()
123 of_property_read_u32(np, "ibm,#config-records", &afu->crs_num); in cxl_of_read_afu_properties()
126 for (i = 0; i < afu->crs_num; i++) { in cxl_of_read_afu_properties()
127 rc = cxl_ops->afu_cr_read16(afu, i, PCI_DEVICE_ID, in cxl_of_read_afu_properties()
130 pr_info("record %d - device-id: %#x\n", in cxl_of_read_afu_properties()
132 rc = cxl_ops->afu_cr_read16(afu, i, PCI_VENDOR_ID, in cxl_of_read_afu_properties()
135 pr_info("record %d - vendor-id: %#x\n", in cxl_of_read_afu_properties()
137 rc = cxl_ops->afu_cr_read32(afu, i, PCI_CLASS_REVISION, in cxl_of_read_afu_properties()
141 pr_info("record %d - class-code: %#x\n", in cxl_of_read_afu_properties()
147 * if "ibm,process-mmio" doesn't exist then per-process mmio is in cxl_of_read_afu_properties()
151 if (!of_property_read_u32(np, "ibm,process-mmio", &val) && val == 1) in cxl_of_read_afu_properties()
152 afu->pp_psa = true; in cxl_of_read_afu_properties()
154 afu->pp_psa = false; in cxl_of_read_afu_properties()
156 if (!of_property_read_u32(np, "ibm,function-error-interrupt", &val)) in cxl_of_read_afu_properties()
157 afu->serr_hwirq = val; in cxl_of_read_afu_properties()
159 pr_devel("AFU handle: %#llx\n", afu->guest->handle); in cxl_of_read_afu_properties()
161 afu->guest->p2n_phys, afu->guest->p2n_size); in cxl_of_read_afu_properties()
163 afu->psn_phys, afu->adapter->ps_size); in cxl_of_read_afu_properties()
164 pr_devel("Max number of processes virtualised=%i\n", in cxl_of_read_afu_properties()
165 afu->max_procs_virtualised); in cxl_of_read_afu_properties()
166 pr_devel("Per-process irqs min=%i, max=%i\n", afu->pp_irqs, in cxl_of_read_afu_properties()
167 afu->irqs_max); in cxl_of_read_afu_properties()
168 pr_devel("Slice error interrupt=%#lx\n", afu->serr_hwirq); in cxl_of_read_afu_properties()
177 struct irq_avail *cur; in read_adapter_irq_config() local
179 ranges = of_get_property(np, "interrupt-ranges", &len); in read_adapter_irq_config()
181 return -EINVAL; in read_adapter_irq_config()
185 * with encode-int in read_adapter_irq_config()
189 return -EINVAL; in read_adapter_irq_config()
191 adapter->guest->irq_avail = kcalloc(nranges, sizeof(struct irq_avail), in read_adapter_irq_config()
193 if (adapter->guest->irq_avail == NULL) in read_adapter_irq_config()
194 return -ENOMEM; in read_adapter_irq_config()
196 adapter->guest->irq_base_offset = be32_to_cpu(ranges[0]); in read_adapter_irq_config()
198 cur = &adapter->guest->irq_avail[i]; in read_adapter_irq_config()
199 cur->offset = be32_to_cpu(ranges[i * 2]); in read_adapter_irq_config()
200 cur->range = be32_to_cpu(ranges[i * 2 + 1]); in read_adapter_irq_config()
201 cur->bitmap = bitmap_zalloc(cur->range, GFP_KERNEL); in read_adapter_irq_config()
202 if (cur->bitmap == NULL) in read_adapter_irq_config()
204 if (cur->offset < adapter->guest->irq_base_offset) in read_adapter_irq_config()
205 adapter->guest->irq_base_offset = cur->offset; in read_adapter_irq_config()
207 pr_info("available IRQ range: %#lx-%#lx (%lu)\n", in read_adapter_irq_config()
208 cur->offset, cur->offset + cur->range - 1, in read_adapter_irq_config()
209 cur->range); in read_adapter_irq_config()
211 adapter->guest->irq_nranges = nranges; in read_adapter_irq_config()
212 spin_lock_init(&adapter->guest->irq_alloc_lock); in read_adapter_irq_config()
216 for (i--; i >= 0; i--) { in read_adapter_irq_config()
217 cur = &adapter->guest->irq_avail[i]; in read_adapter_irq_config()
218 bitmap_free(cur->bitmap); in read_adapter_irq_config()
220 kfree(adapter->guest->irq_avail); in read_adapter_irq_config()
221 adapter->guest->irq_avail = NULL; in read_adapter_irq_config()
222 return -ENOMEM; in read_adapter_irq_config()
227 return of_property_read_reg(np, 0, &adapter->guest->handle, NULL); in cxl_of_read_adapter_handle()
241 if (!of_property_read_u32(np, "ibm,caia-version", &val)) { in cxl_of_read_adapter_properties()
242 adapter->caia_major = (val & 0xFF00) >> 8; in cxl_of_read_adapter_properties()
243 adapter->caia_minor = val & 0xFF; in cxl_of_read_adapter_properties()
246 if (!of_property_read_u32(np, "ibm,psl-revision", &val)) in cxl_of_read_adapter_properties()
247 adapter->psl_rev = val; in cxl_of_read_adapter_properties()
250 adapter->guest->status = kasprintf(GFP_KERNEL, "%s", p); in cxl_of_read_adapter_properties()
251 if (adapter->guest->status == NULL) in cxl_of_read_adapter_properties()
252 return -ENOMEM; in cxl_of_read_adapter_properties()
255 if (!of_property_read_u32(np, "vendor-id", &val)) in cxl_of_read_adapter_properties()
256 adapter->guest->vendor = val; in cxl_of_read_adapter_properties()
258 if (!of_property_read_u32(np, "device-id", &val)) in cxl_of_read_adapter_properties()
259 adapter->guest->device = val; in cxl_of_read_adapter_properties()
261 if (!of_property_read_u32(np, "subsystem-vendor-id", &val)) in cxl_of_read_adapter_properties()
262 adapter->guest->subsystem_vendor = val; in cxl_of_read_adapter_properties()
264 if (!of_property_read_u32(np, "subsystem-id", &val)) in cxl_of_read_adapter_properties()
265 adapter->guest->subsystem = val; in cxl_of_read_adapter_properties()
278 adapter = dev_get_drvdata(&pdev->dev); in cxl_of_remove()
279 for (afu = 0; afu < adapter->slices; afu++) in cxl_of_remove()
280 cxl_guest_remove_afu(adapter->afu[afu]); in cxl_of_remove()
298 …dev_err_once(&pdev->dev, "DEPRECATION: cxl is deprecated and will be removed in a future kernel re… in cxl_of_probe()
302 np = pdev->dev.of_node; in cxl_of_probe()
304 return -ENODEV; in cxl_of_probe()
309 dev_err(&pdev->dev, "guest_init_adapter failed: %li\n", PTR_ERR(adapter)); in cxl_of_probe()
316 dev_err(&pdev->dev, "AFU %i failed to initialise: %i\n", in cxl_of_probe()
324 dev_info(&pdev->dev, "No active AFU"); in cxl_of_probe()
325 adapter->slices = 0; in cxl_of_probe()
332 { .compatible = "ibm,coherent-platform-facility",},