Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
2
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
80f77e5
Documentation
arch
alpha
arc
arm
arm64
blackfin
c6x
cris
frv
h8300
hexagon
ia64
m32r
m68k
metag
microblaze
mips
mn10300
nios2
openrisc
parisc
powerpc
s390
score
sh
sparc
tile
um
unicore32
x86
boot
configs
crypto
entry
events
hyperv
ia32
include
kernel
acpi
apic
Makefile
apic.c
apic_flat_64.c
apic_noop.c
apic_numachip.c
bigsmp_32.c
htirq.c
hw_nmi.c
io_apic.c
ipi.c
msi.c
probe_32.c
probe_64.c
vector.c
x2apic_cluster.c
x2apic_phys.c
x2apic_uv_x.c
cpu
fpu
kprobes
.gitignore
Makefile
alternative.c
amd_gart_64.c
amd_nb.c
apb_timer.c
aperture_64.c
apm_32.c
asm-offsets.c
asm-offsets_32.c
asm-offsets_64.c
audit_64.c
bootflag.c
check.c
cpuid.c
crash.c
crash_dump_32.c
crash_dump_64.c
devicetree.c
doublefault.c
dumpstack.c
dumpstack_32.c
dumpstack_64.c
e820.c
early-quirks.c
early_printk.c
ebda.c
eisa.c
espfix_64.c
ftrace.c
ftrace_32.S
ftrace_64.S
head32.c
head64.c
head_32.S
head_64.S
hpet.c
hw_breakpoint.c
i8237.c
i8253.c
i8259.c
idt.c
io_delay.c
ioport.c
irq.c
irq_32.c
irq_64.c
irq_work.c
irqinit.c
itmt.c
jump_label.c
kdebugfs.c
kexec-bzimage64.c
kgdb.c
ksysfs.c
kvm.c
kvmclock.c
ldt.c
livepatch.c
machine_kexec_32.c
machine_kexec_64.c
mmconf-fam10h_64.c
module.c
mpparse.c
msr.c
nmi.c
nmi_selftest.c
paravirt-spinlocks.c
paravirt.c
paravirt_patch_32.c
paravirt_patch_64.c
pci-calgary_64.c
pci-dma.c
pci-iommu_table.c
pci-nommu.c
pci-swiotlb.c
pcspeaker.c
perf_regs.c
platform-quirks.c
pmem.c
probe_roms.c
process.c
process_32.c
process_64.c
ptrace.c
pvclock.c
quirks.c
reboot.c
reboot_fixups_32.c
relocate_kernel_32.S
relocate_kernel_64.S
resource.c
rtc.c
setup.c
setup_percpu.c
signal.c
signal_compat.c
smp.c
smpboot.c
stacktrace.c
step.c
sys_x86_64.c
sysfb.c
sysfb_efi.c
sysfb_simplefb.c
tboot.c
tce_64.c
time.c
tls.c
tls.h
topology.c
trace_clock.c
tracepoint.c
traps.c
tsc.c
tsc_msr.c
tsc_sync.c
unwind_frame.c
unwind_guess.c
unwind_orc.c
uprobes.c
verify_cpu.S
vm86_32.c
vmlinux.lds.S
vsmp_64.c
x86_init.c
kvm
lib
math-emu
mm
net
oprofile
pci
platform
power
purgatory
ras
realmode
tools
um
video
xen
.gitignore
Kbuild
Kconfig
Kconfig.cpu
Kconfig.debug
Makefile
Makefile.um
Makefile_32.cpu
xtensa
.gitignore
Kconfig
block
certs
crypto
drivers
firmware
fs
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
tools
usr
virt
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
Breadcrumbs
linux
/
arch
/
x86
/
kernel
/
apic
/
htirq.c
Blame
Blame
Latest commit
History
History
198 lines (167 loc) · 4.92 KB
Breadcrumbs
linux
/
arch
/
x86
/
kernel
/
apic
/
htirq.c
Top
File metadata and controls
Code
Blame
198 lines (167 loc) · 4.92 KB
Raw
/* * Support Hypertransport IRQ * * Copyright (C) 1997, 1998, 1999, 2000, 2009 Ingo Molnar, Hajnalka Szabo * Moved from arch/x86/kernel/apic/io_apic.c. * Jiang Liu <jiang.liu@linux.intel.com> * Add support of hierarchical irqdomain * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #include <linux/mm.h> #include <linux/interrupt.h> #include <linux/init.h> #include <linux/device.h> #include <linux/pci.h> #include <linux/htirq.h> #include <asm/irqdomain.h> #include <asm/hw_irq.h> #include <asm/apic.h> #include <asm/hypertransport.h> static struct irq_domain *htirq_domain; /* * Hypertransport interrupt support */ static int ht_set_affinity(struct irq_data *data, const struct cpumask *mask, bool force) { struct irq_data *parent = data->parent_data; int ret; ret = parent->chip->irq_set_affinity(parent, mask, force); if (ret >= 0) { struct ht_irq_msg msg; struct irq_cfg *cfg = irqd_cfg(data); fetch_ht_irq_msg(data->irq, &msg); msg.address_lo &= ~(HT_IRQ_LOW_VECTOR_MASK | HT_IRQ_LOW_DEST_ID_MASK); msg.address_lo |= HT_IRQ_LOW_VECTOR(cfg->vector) | HT_IRQ_LOW_DEST_ID(cfg->dest_apicid); msg.address_hi &= ~(HT_IRQ_HIGH_DEST_ID_MASK); msg.address_hi |= HT_IRQ_HIGH_DEST_ID(cfg->dest_apicid); write_ht_irq_msg(data->irq, &msg); } return ret; } static struct irq_chip ht_irq_chip = { .name = "PCI-HT", .irq_mask = mask_ht_irq, .irq_unmask = unmask_ht_irq, .irq_ack = irq_chip_ack_parent, .irq_set_affinity = ht_set_affinity, .irq_retrigger = irq_chip_retrigger_hierarchy, .flags = IRQCHIP_SKIP_SET_WAKE, }; static int htirq_domain_alloc(struct irq_domain *domain, unsigned int virq, unsigned int nr_irqs, void *arg) { struct ht_irq_cfg *ht_cfg; struct irq_alloc_info *info = arg; struct pci_dev *dev; irq_hw_number_t hwirq; int ret; if (nr_irqs > 1 || !info) return -EINVAL; dev = info->ht_dev; hwirq = (info->ht_idx & 0xFF) | PCI_DEVID(dev->bus->number, dev->devfn) << 8 | (pci_domain_nr(dev->bus) & 0xFFFFFFFF) << 24; if (irq_find_mapping(domain, hwirq) > 0) return -EEXIST; ht_cfg = kmalloc(sizeof(*ht_cfg), GFP_KERNEL); if (!ht_cfg) return -ENOMEM; ret = irq_domain_alloc_irqs_parent(domain, virq, nr_irqs, info); if (ret < 0) { kfree(ht_cfg); return ret; } /* Initialize msg to a value that will never match the first write. */ ht_cfg->msg.address_lo = 0xffffffff; ht_cfg->msg.address_hi = 0xffffffff; ht_cfg->dev = info->ht_dev; ht_cfg->update = info->ht_update; ht_cfg->pos = info->ht_pos; ht_cfg->idx = 0x10 + (info->ht_idx * 2); irq_domain_set_info(domain, virq, hwirq, &ht_irq_chip, ht_cfg, handle_edge_irq, ht_cfg, "edge"); return 0; } static void htirq_domain_free(struct irq_domain *domain, unsigned int virq, unsigned int nr_irqs) { struct irq_data *irq_data = irq_domain_get_irq_data(domain, virq); BUG_ON(nr_irqs != 1); kfree(irq_data->chip_data); irq_domain_free_irqs_top(domain, virq, nr_irqs); } static int htirq_domain_activate(struct irq_domain *domain, struct irq_data *irq_data, bool early) { struct ht_irq_msg msg; struct irq_cfg *cfg = irqd_cfg(irq_data); msg.address_hi = HT_IRQ_HIGH_DEST_ID(cfg->dest_apicid); msg.address_lo = HT_IRQ_LOW_BASE | HT_IRQ_LOW_DEST_ID(cfg->dest_apicid) | HT_IRQ_LOW_VECTOR(cfg->vector) | ((apic->irq_dest_mode == 0) ? HT_IRQ_LOW_DM_PHYSICAL : HT_IRQ_LOW_DM_LOGICAL) | HT_IRQ_LOW_RQEOI_EDGE | ((apic->irq_delivery_mode != dest_LowestPrio) ? HT_IRQ_LOW_MT_FIXED : HT_IRQ_LOW_MT_ARBITRATED) | HT_IRQ_LOW_IRQ_MASKED; write_ht_irq_msg(irq_data->irq, &msg); return 0; } static void htirq_domain_deactivate(struct irq_domain *domain, struct irq_data *irq_data) { struct ht_irq_msg msg; memset(&msg, 0, sizeof(msg)); write_ht_irq_msg(irq_data->irq, &msg); } static const struct irq_domain_ops htirq_domain_ops = { .alloc = htirq_domain_alloc, .free = htirq_domain_free, .activate = htirq_domain_activate, .deactivate = htirq_domain_deactivate, }; void __init arch_init_htirq_domain(struct irq_domain *parent) { struct fwnode_handle *fn; if (disable_apic) return; fn = irq_domain_alloc_named_fwnode("PCI-HT"); if (!fn) goto warn; htirq_domain = irq_domain_create_tree(fn, &htirq_domain_ops, NULL); irq_domain_free_fwnode(fn); if (!htirq_domain) goto warn; htirq_domain->parent = parent; return; warn: pr_warn("Failed to initialize irqdomain for HTIRQ.\n"); } int arch_setup_ht_irq(int idx, int pos, struct pci_dev *dev, ht_irq_update_t *update) { struct irq_alloc_info info; if (!htirq_domain) return -ENOSYS; init_irq_alloc_info(&info, NULL); info.ht_idx = idx; info.ht_pos = pos; info.ht_dev = dev; info.ht_update = update; return irq_domain_alloc_irqs(htirq_domain, 1, dev_to_node(&dev->dev), &info); } void arch_teardown_ht_irq(unsigned int irq) { irq_domain_free_irqs(irq, 1); }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
You can’t perform that action at this time.