From 1c0663380cec9ae6d01e189dbe963f76f92fd5a0 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 19 Nov 2010 18:50:07 +0000 Subject: [PATCH] passthrough: support PV on HVM MSI remapping If the guest enables an MSI passing 0 as vector number, then read the address and use it as pirq number for the following mapping request to Xen. Signed-off-by: Stefano Stabellini --- hw/pt-msi.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hw/pt-msi.c b/hw/pt-msi.c index b59b4faae..f0fb3e31d 100644 --- a/hw/pt-msi.c +++ b/hw/pt-msi.c @@ -65,6 +65,7 @@ static void msix_set_enable(struct pt_dev *dev, int en) int pt_msi_setup(struct pt_dev *dev) { int pirq = -1; + uint8_t gvec = 0; if ( !(dev->msi->flags & MSI_FLAG_UNINIT) ) { @@ -72,6 +73,15 @@ int pt_msi_setup(struct pt_dev *dev) return -1; } + gvec = dev->msi->data & 0xFF; + if (!gvec) { + /* if gvec is 0, the guest is asking for a particular pirq that + * is passed as dest_id */ + pirq = (dev->msi->addr_hi & 0xffffff00) | + ((dev->msi->addr_lo >> MSI_TARGET_CPU_SHIFT) & 0xff); + PT_LOG("pt_msi_setup requested pirq = %d\n", pirq); + } + if ( xc_physdev_map_pirq_msi(xc_handle, domid, AUTO_ASSIGN, &pirq, PCI_DEVFN(dev->pci_dev->dev, dev->pci_dev->func), -- 2.39.5