Permalink
Browse files

[PV PCI passthrough]: use Xenlight for PV PCI passthrough (but not HV…

…M for now). This makes PV PCI passthrough work properly.

The xenops/ code for PV PCI passthrough is broken. At the very least it's
missing a call to xc_physdev_map_pirq, which itself is missing from the
Xenctrl library.

Since the xenlight PCI passthrough code is genuinely better than the xenops/
code, we should use it rather than fork it.

Note that PV PCI passthrough is still considered experimental, unlike the
HVM PCI passthrough codepath which is heavily used.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
  • Loading branch information...
1 parent 43809f3 commit 7f8813635ede7de6d1f48e1c0607ed81eddf22a8 David Scott committed Nov 26, 2011
Showing with 28 additions and 1 deletion.
  1. +28 −1 ocaml/xenops/device.ml
View
@@ -1099,8 +1099,35 @@ let add_noexn ~xc ~xs ~hvm ~msitranslate ~pci_power_mgmt ?(flrscript=None) pcide
Generic.add_device ~xs device (others @ xsdevs @ backendlist) frontendlist [];
()
+let add_xl ~msitranslate ~pci_power_mgmt pcidevs domid =
+ List.iter
+ (fun (domain, bus, dev, func) ->
+ Xenlight.pci_add {
+ (* XXX: I don't think we can guarantee how the C compiler will
+ lay out bitfields.
+ unsigned int reserved1:2;
+ unsigned int reg:6;
+ unsigned int func:3;
+ unsigned int dev:5;
+ unsigned int bus:8;
+ unsigned int reserved2:7;
+ unsigned int enable:1;
+ *)
+ Xenlight.v = (func lsl 8) lor (dev lsl 11) lor (bus lsl 16);
+ domain = domain;
+ vdevfn = 0;
+ msitranslate = msitranslate = 1;
+ power_mgmt = pci_power_mgmt = 1;
+ } domid
+ ) pcidevs
+
let add ~xc ~xs ~hvm ~msitranslate ~pci_power_mgmt ?flrscript pcidevs domid devid =
- try add_noexn ~xc ~xs ~hvm ~msitranslate ~pci_power_mgmt ?flrscript pcidevs domid devid
+ try
+ if hvm
+ then add_noexn ~xc ~xs ~hvm ~msitranslate ~pci_power_mgmt ?flrscript pcidevs domid devid
+ else
+ (* Switch the PV path over to libxl since the code is better *)
+ add_xl ~msitranslate ~pci_power_mgmt pcidevs domid
with exn ->
raise (Cannot_add (pcidevs, exn))

0 comments on commit 7f88136

Please sign in to comment.