cregit-Linux how code gets into the kernel

Release 4.14 arch/x86/kernel/pci-iommu_table.c

Directory: arch/x86/kernel
// SPDX-License-Identifier: GPL-2.0
#include <linux/dma-mapping.h>
#include <asm/iommu_table.h>
#include <linux/string.h>
#include <linux/kallsyms.h>



#define DEBUG 1


static struct iommu_table_entry * __init find_dependents_of(struct iommu_table_entry *start, struct iommu_table_entry *finish, struct iommu_table_entry *q) { struct iommu_table_entry *p; if (!q) return NULL; for (p = start; p < finish; p++) if (p->detect == q->depend) return p; return NULL; }

Contributors

PersonTokensPropCommitsCommitProp
Konrad Rzeszutek Wilk66100.00%1100.00%
Total66100.00%1100.00%


void __init sort_iommu_table(struct iommu_table_entry *start, struct iommu_table_entry *finish) { struct iommu_table_entry *p, *q, tmp; for (p = start; p < finish; p++) { again: q = find_dependents_of(start, finish, p); /* We are bit sneaky here. We use the memory address to figure * out if the node we depend on is past our point, if so, swap. */ if (q > p) { tmp = *p; memmove(p, q, sizeof(*p)); *q = tmp; goto again; } } }

Contributors

PersonTokensPropCommitsCommitProp
Konrad Rzeszutek Wilk89100.00%1100.00%
Total89100.00%1100.00%

#ifdef DEBUG
void __init check_iommu_entries(struct iommu_table_entry *start, struct iommu_table_entry *finish) { struct iommu_table_entry *p, *q, *x; /* Simple cyclic dependency checker. */ for (p = start; p < finish; p++) { q = find_dependents_of(start, finish, p); x = find_dependents_of(start, finish, q); if (p == x) { printk(KERN_ERR "CYCLIC DEPENDENCY FOUND! %pS depends on %pS and vice-versa. BREAKING IT.\n", p->detect, q->detect); /* Heavy handed way..*/ x->depend = 0; } } for (p = start; p < finish; p++) { q = find_dependents_of(p, finish, p); if (q && q > p) { printk(KERN_ERR "EXECUTION ORDER INVALID! %pS should be called before %pS!\n", p->detect, q->detect); } } }

Contributors

PersonTokensPropCommitsCommitProp
Konrad Rzeszutek Wilk13895.83%150.00%
Joe Perches64.17%150.00%
Total144100.00%2100.00%

#else
void __init check_iommu_entries(struct iommu_table_entry *start, struct iommu_table_entry *finish) { }

Contributors

PersonTokensPropCommitsCommitProp
Konrad Rzeszutek Wilk1493.33%150.00%
Denys Vlasenko16.67%150.00%
Total15100.00%2100.00%

#endif

Overall Contributors

PersonTokensPropCommitsCommitProp
Konrad Rzeszutek Wilk33097.63%125.00%
Joe Perches61.78%125.00%
Greg Kroah-Hartman10.30%125.00%
Denys Vlasenko10.30%125.00%
Total338100.00%4100.00%
Directory: arch/x86/kernel
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.