Commit 41bb2115 authored by Thomas Gleixner's avatar Thomas Gleixner

x86/pci/xen: Use msi_msg shadow structs

Use the msi_msg shadow structs and compose the message with named bitfields
instead of the unreadable macro maze.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarDavid Woodhouse <dwmw@amazon.co.uk>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20201024213535.443185-18-dwmw2@infradead.org
parent 485940e0
...@@ -152,7 +152,6 @@ static int acpi_register_gsi_xen(struct device *dev, u32 gsi, ...@@ -152,7 +152,6 @@ static int acpi_register_gsi_xen(struct device *dev, u32 gsi,
#if defined(CONFIG_PCI_MSI) #if defined(CONFIG_PCI_MSI)
#include <linux/msi.h> #include <linux/msi.h>
#include <asm/msidef.h>
struct xen_pci_frontend_ops *xen_pci_frontend; struct xen_pci_frontend_ops *xen_pci_frontend;
EXPORT_SYMBOL_GPL(xen_pci_frontend); EXPORT_SYMBOL_GPL(xen_pci_frontend);
...@@ -210,23 +209,20 @@ static int xen_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) ...@@ -210,23 +209,20 @@ static int xen_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
return ret; return ret;
} }
#define XEN_PIRQ_MSI_DATA (MSI_DATA_TRIGGER_EDGE | \
MSI_DATA_LEVEL_ASSERT | (3 << 8) | MSI_DATA_VECTOR(0))
static void xen_msi_compose_msg(struct pci_dev *pdev, unsigned int pirq, static void xen_msi_compose_msg(struct pci_dev *pdev, unsigned int pirq,
struct msi_msg *msg) struct msi_msg *msg)
{ {
/* We set vector == 0 to tell the hypervisor we don't care about it, /*
* but we want a pirq setup instead. * We set vector == 0 to tell the hypervisor we don't care about
* We use the dest_id field to pass the pirq that we want. */ * it, but we want a pirq setup instead. We use the dest_id fields
msg->address_hi = MSI_ADDR_BASE_HI | MSI_ADDR_EXT_DEST_ID(pirq); * to pass the pirq that we want.
msg->address_lo = */
MSI_ADDR_BASE_LO | memset(msg, 0, sizeof(*msg));
MSI_ADDR_DEST_MODE_PHYSICAL | msg->address_hi = X86_MSI_BASE_ADDRESS_HIGH;
MSI_ADDR_REDIRECTION_CPU | msg->arch_addr_hi.destid_8_31 = pirq >> 8;
MSI_ADDR_DEST_ID(pirq); msg->arch_addr_lo.destid_0_7 = pirq & 0xFF;
msg->arch_addr_lo.base_address = X86_MSI_BASE_ADDRESS_LOW;
msg->data = XEN_PIRQ_MSI_DATA; msg->arch_data.delivery_mode = APIC_DELIVERY_MODE_EXTINT;
} }
static int xen_hvm_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) static int xen_hvm_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment