Mailing List Archive

[qemu-xen-unstable] passthrough: always use hw intx and always get it from the same place
commit d2c66581e5941c75cae1bd0d652be217008cce4c
Author: Ian Jackson <ian.jackson@eu.citrix.com>
Date: Mon Jan 4 17:48:14 2010 +0000

passthrough: always use hw intx and always get it from the same place

The assumption that function zero always uses INTA tuns out not
to be true in the wild. This leaves us with three options.

1) Always use INTA

This was the case before multi-function pass-through was possible.
But with the advent of multi-function pass-through this may lead
to excessive virtual GSI sharing.

2) Fix emulation to use INTA for function zero

3) Always use the hardware value for INTx

There doesn't seem to be much between 2) and 3) but the latter seems
slightly cleaner so I advocate that approach.

Cc: Tom Rotenberg <tom.rotenberg@gmail.com>
Cc: Edwin Zhai <edwin.zhai@intel.com>
Signed-off-by: Simon Horman <horms@verge.net.au>

[patch 2/2] qemu-xen: pass-through: always use hw intx

From:

[patch 0/2] qemu-xen: pass-through: always use hw intx
pass-through: always use hw intx and always get it from the same place

The assumption that function zero always uses INTA tuns out not
to be true in the wild. This leaves us with three options.

1) Always use INTA

This was the case before multi-function pass-through was possible.
But with the advent of multi-function pass-through this may lead
to excessive virtual GSI sharing.

2) Fix emulation to use INTA for function zero

3) Always use the hardware value for INTx

There doesn't seem to be much between 2) and 3) but the latter seems
slightly cleaner so I advocate that approach.
---
hw/pass-through.c | 22 ++++++++--------------
1 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/hw/pass-through.c b/hw/pass-through.c
index bda908a..9371a39 100644
--- a/hw/pass-through.c
+++ b/hw/pass-through.c
@@ -1021,6 +1021,11 @@ int bdf_to_devfn(char *bdf_str)
return -1;
}

+static uint8_t pci_read_intx(struct pt_dev *ptdev)
+{
+ return pci_read_byte(ptdev->pci_dev, PCI_INTERRUPT_PIN);
+}
+
/* The PCI Local Bus Specification, Rev. 3.0,
* Section 6.2.4 Miscellaneous Registers, pp 223
* outlines 5 valid values for the intertupt pin (intx).
@@ -1049,9 +1054,9 @@ int bdf_to_devfn(char *bdf_str)
* 4 | 3 | INTD#
* any other value | 0 | This should never happen, log error message
*/
-static uint8_t pci_read_intx(struct pt_dev *ptdev)
+uint8_t pci_intx(struct pt_dev *ptdev)
{
- uint8_t r_val = pci_read_byte(ptdev->pci_dev, PCI_INTERRUPT_PIN);
+ uint8_t r_val = pci_read_intx(ptdev);

PT_LOG("intx=%i\n", r_val);
if (r_val < 1 || r_val > 4)
@@ -1068,17 +1073,6 @@ static uint8_t pci_read_intx(struct pt_dev *ptdev)
return r_val;
}

-/*
- * For virtual function 0, always use INTA#,
- * otherwise use the hardware value
- */
-uint8_t pci_intx(struct pt_dev *ptdev)
-{
- if (!PCI_FUNC(ptdev->dev.devfn))
- return 0;
- return pci_read_intx(ptdev);
-}
-
/* Being called each time a mmio region has been updated */
static void pt_iomem_map(PCIDevice *d, int i, uint32_t e_phys, uint32_t e_size,
int type)
@@ -2768,7 +2762,7 @@ static uint32_t pt_status_reg_init(struct pt_dev *ptdev,
static uint32_t pt_irqpin_reg_init(struct pt_dev *ptdev,
struct pt_reg_info_tbl *reg, uint32_t real_offset)
{
- return ptdev->dev.config[real_offset];
+ return pci_read_intx(ptdev);
}

/* initialize BAR */
--
generated by git-patchbot for /home/xen/git/qemu-xen-unstable.git

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog