MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / msi_affinity_init

Function msi_affinity_init

components/drivers/pci/msi/msi.c:128–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126}
127
128static void msi_affinity_init(struct rt_pci_msi_desc *desc, int msi_index,
129 rt_bitmap_t *cpumasks)
130{
131 int irq;
132 struct rt_pic_irq *pirq;
133 struct rt_pci_device *pdev = desc->pdev;
134 struct rt_pic *msi_pic = pdev->msi_pic;
135
136 irq = desc->irq + desc->is_msix ? 0 : msi_index;
137 pirq = rt_pic_find_pirq(msi_pic, irq);
138
139 /* Save affinity */
140 if (desc->is_msix)
141 {
142 desc->affinity = pirq->affinity;
143 }
144 else
145 {
146 desc->affinities[msi_index] = pirq->affinity;
147 }
148
149 if ((void *)cpumasks > (void *)msi_affinity_default &&
150 (void *)cpumasks < (void *)msi_affinity_default + sizeof(msi_affinity_default))
151 {
152 rt_uint64_t data_address;
153
154 /* Get MSI/MSI-X write data adddress */
155 data_address = desc->msg.address_hi;
156 data_address <<= 32;
157 data_address |= desc->msg.address_lo;
158
159 /* Prepare affinity */
160 cpumasks = pirq->affinity;
161
162 rt_numa_memory_affinity(data_address, cpumasks);
163 }
164 else if (rt_bitmap_next_set_bit(cpumasks, 0, RT_CPUS_NR) >= RT_CPUS_NR)
165 {
166 /* No affinity info found, give up */
167 return;
168 }
169
170 if (!rt_pic_irq_set_affinity(irq, cpumasks))
171 {
172 if (msi_pic->ops->irq_write_msi_msg)
173 {
174 msi_pic->ops->irq_write_msi_msg(pirq, &desc->msg);
175 }
176 }
177}
178
179void rt_pci_msi_shutdown(struct rt_pci_device *pdev)
180{

Callers 2

msi_capability_initFunction · 0.85
msix_capability_initFunction · 0.85

Calls 4

rt_pic_find_pirqFunction · 0.85
rt_numa_memory_affinityFunction · 0.85
rt_bitmap_next_set_bitFunction · 0.85
rt_pic_irq_set_affinityFunction · 0.85

Tested by

no test coverage detected