Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

x86/hyperv: Expose hv_map_msi_interrupt()

Move some of the logic of hv_irq_compose_irq_message() into
hv_map_msi_interrupt(). Make hv_map_msi_interrupt() a globally-available
helper function, which will be used to map PCI interrupts when running
in the root partition.

Signed-off-by: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com>
Signed-off-by: Nuno Das Neves <nunodasneves@linux.microsoft.com>
Reviewed-by: Roman Kisel <romank@linux.microsoft.com>
Reviewed-by: Michael Kelley <mhklinux@outlook.com>
Link: https://lore.kernel.org/r/1752261532-7225-3-git-send-email-nunodasneves@linux.microsoft.com
Signed-off-by: Wei Liu <wei.liu@kernel.org>
Message-ID: <1752261532-7225-3-git-send-email-nunodasneves@linux.microsoft.com>

authored by

Stanislav Kinsburskii and committed by
Wei Liu
52a45f87 36c46e64

+31 -11
+29 -11
arch/x86/hyperv/irqdomain.c
··· 173 173 return dev_id; 174 174 } 175 175 176 - static int hv_map_msi_interrupt(struct pci_dev *dev, int cpu, int vector, 177 - struct hv_interrupt_entry *entry) 176 + /** 177 + * hv_map_msi_interrupt() - "Map" the MSI IRQ in the hypervisor. 178 + * @data: Describes the IRQ 179 + * @out_entry: Hypervisor (MSI) interrupt entry (can be NULL) 180 + * 181 + * Map the IRQ in the hypervisor by issuing a MAP_DEVICE_INTERRUPT hypercall. 182 + * 183 + * Return: 0 on success, -errno on failure 184 + */ 185 + int hv_map_msi_interrupt(struct irq_data *data, 186 + struct hv_interrupt_entry *out_entry) 178 187 { 179 - union hv_device_id device_id = hv_build_pci_dev_id(dev); 188 + struct irq_cfg *cfg = irqd_cfg(data); 189 + struct hv_interrupt_entry dummy; 190 + union hv_device_id device_id; 191 + struct msi_desc *msidesc; 192 + struct pci_dev *dev; 193 + int cpu; 180 194 181 - return hv_map_interrupt(device_id, false, cpu, vector, entry); 195 + msidesc = irq_data_get_msi_desc(data); 196 + dev = msi_desc_to_pci_dev(msidesc); 197 + device_id = hv_build_pci_dev_id(dev); 198 + cpu = cpumask_first(irq_data_get_effective_affinity_mask(data)); 199 + 200 + return hv_map_interrupt(device_id, false, cpu, cfg->vector, 201 + out_entry ? out_entry : &dummy); 182 202 } 203 + EXPORT_SYMBOL_GPL(hv_map_msi_interrupt); 183 204 184 205 static inline void entry_to_msi_msg(struct hv_interrupt_entry *entry, struct msi_msg *msg) 185 206 { ··· 213 192 static int hv_unmap_msi_interrupt(struct pci_dev *dev, struct hv_interrupt_entry *old_entry); 214 193 static void hv_irq_compose_msi_msg(struct irq_data *data, struct msi_msg *msg) 215 194 { 216 - struct hv_interrupt_entry out_entry, *stored_entry; 195 + struct hv_interrupt_entry *stored_entry; 217 196 struct irq_cfg *cfg = irqd_cfg(data); 218 197 struct msi_desc *msidesc; 219 198 struct pci_dev *dev; 220 - int cpu, ret; 199 + int ret; 221 200 222 201 msidesc = irq_data_get_msi_desc(data); 223 202 dev = msi_desc_to_pci_dev(msidesc); ··· 226 205 pr_debug("%s: cfg is NULL", __func__); 227 206 return; 228 207 } 229 - 230 - cpu = cpumask_first(irq_data_get_effective_affinity_mask(data)); 231 208 232 209 if (data->chip_data) { 233 210 /* ··· 253 234 return; 254 235 } 255 236 256 - ret = hv_map_msi_interrupt(dev, cpu, cfg->vector, &out_entry); 237 + ret = hv_map_msi_interrupt(data, stored_entry); 257 238 if (ret) { 258 239 kfree(stored_entry); 259 240 return; 260 241 } 261 242 262 - *stored_entry = out_entry; 263 243 data->chip_data = stored_entry; 264 - entry_to_msi_msg(&out_entry, msg); 244 + entry_to_msi_msg(data->chip_data, msg); 265 245 266 246 return; 267 247 }
+2
arch/x86/include/asm/mshyperv.h
··· 242 242 243 243 struct irq_domain *hv_create_pci_msi_domain(void); 244 244 245 + int hv_map_msi_interrupt(struct irq_data *data, 246 + struct hv_interrupt_entry *out_entry); 245 247 int hv_map_ioapic_interrupt(int ioapic_id, bool level, int vcpu, int vector, 246 248 struct hv_interrupt_entry *entry); 247 249 int hv_unmap_ioapic_interrupt(int ioapic_id, struct hv_interrupt_entry *entry);