* [PATCH 1 of 2] Ocaml/libxc bindings: Fix SBDF encoding @ 2013-01-03 22:49 Andrew Cooper 2013-01-03 22:49 ` [PATCH 2 of 2] Ocaml/libxc bindings: Correct PCI terminology Andrew Cooper ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: Andrew Cooper @ 2013-01-03 22:49 UTC (permalink / raw) To: xen-devel; +Cc: Ian Jackson, Ian Campbell, Jan Beulich Changeset 23861:ec7c81fbe0de alters the SBDF encoding expected by the DOMCTL_{de,}assign_device hypercalls. While it updates libxl, libxc and the python bindings, the ocaml bindings got missed. As a result, any attempt to use PCI Passthrough with Xen-4.2 and later will fail. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> diff -r c4114a042410 -r 22e7cb73b4ad tools/ocaml/libs/xc/xenctrl_stubs.c --- a/tools/ocaml/libs/xc/xenctrl_stubs.c +++ b/tools/ocaml/libs/xc/xenctrl_stubs.c @@ -1085,11 +1085,10 @@ CAMLprim value stub_xc_domain_irq_permis static uint32_t pci_dev_to_bdf(int domain, int bus, int slot, int func) { - uint32_t bdf = 0; - bdf |= (bus & 0xff) << 16; - bdf |= (slot & 0x1f) << 11; - bdf |= (func & 0x7) << 8; - return bdf; + return ((uint32_t)domain & 0xffff) << 16 | + ((uint32_t)bus & 0xff) << 8 | + ((uint32_t)slot & 0x1f) << 3 | + ((uint32_t)func & 0x7); } CAMLprim value stub_xc_domain_test_assign_device(value xch, value domid, value desc) ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2 of 2] Ocaml/libxc bindings: Correct PCI terminology 2013-01-03 22:49 [PATCH 1 of 2] Ocaml/libxc bindings: Fix SBDF encoding Andrew Cooper @ 2013-01-03 22:49 ` Andrew Cooper 2013-01-09 13:42 ` [PATCH 1 of 2] Ocaml/libxc bindings: Fix SBDF encoding Andrew Cooper 2013-01-11 12:25 ` Ian Campbell 2 siblings, 0 replies; 4+ messages in thread From: Andrew Cooper @ 2013-01-03 22:49 UTC (permalink / raw) To: xen-devel; +Cc: Ian Jackson, Ian Campbell, Jan Beulich Some renaming to correct the PCI and SBDF terminology. No functional change. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> diff -r 22e7cb73b4ad -r a1d119fe7872 tools/ocaml/libs/xc/xenctrl_stubs.c --- a/tools/ocaml/libs/xc/xenctrl_stubs.c +++ b/tools/ocaml/libs/xc/xenctrl_stubs.c @@ -1083,11 +1083,11 @@ CAMLprim value stub_xc_domain_irq_permis CAMLreturn(Val_unit); } -static uint32_t pci_dev_to_bdf(int domain, int bus, int slot, int func) +static uint32_t encode_sbdf(int domain, int bus, int dev, int func) { return ((uint32_t)domain & 0xffff) << 16 | ((uint32_t)bus & 0xff) << 8 | - ((uint32_t)slot & 0x1f) << 3 | + ((uint32_t)dev & 0x1f) << 3 | ((uint32_t)func & 0x7); } @@ -1095,16 +1095,16 @@ CAMLprim value stub_xc_domain_test_assig { CAMLparam3(xch, domid, desc); int ret; - int domain, bus, slot, func; - uint32_t bdf; + int domain, bus, dev, func; + uint32_t sbdf; domain = Int_val(Field(desc, 0)); bus = Int_val(Field(desc, 1)); - slot = Int_val(Field(desc, 2)); + dev = Int_val(Field(desc, 2)); func = Int_val(Field(desc, 3)); - bdf = pci_dev_to_bdf(domain, bus, slot, func); + sbdf = encode_sbdf(domain, bus, dev, func); - ret = xc_test_assign_device(_H(xch), _D(domid), bdf); + ret = xc_test_assign_device(_H(xch), _D(domid), sbdf); CAMLreturn(Val_bool(ret == 0)); } @@ -1113,16 +1113,16 @@ CAMLprim value stub_xc_domain_assign_dev { CAMLparam3(xch, domid, desc); int ret; - int domain, bus, slot, func; - uint32_t bdf; + int domain, bus, dev, func; + uint32_t sbdf; domain = Int_val(Field(desc, 0)); bus = Int_val(Field(desc, 1)); - slot = Int_val(Field(desc, 2)); + dev = Int_val(Field(desc, 2)); func = Int_val(Field(desc, 3)); - bdf = pci_dev_to_bdf(domain, bus, slot, func); + sbdf = encode_sbdf(domain, bus, dev, func); - ret = xc_assign_device(_H(xch), _D(domid), bdf); + ret = xc_assign_device(_H(xch), _D(domid), sbdf); if (ret < 0) failwith_xc(_H(xch)); @@ -1133,16 +1133,16 @@ CAMLprim value stub_xc_domain_deassign_d { CAMLparam3(xch, domid, desc); int ret; - int domain, bus, slot, func; - uint32_t bdf; + int domain, bus, dev, func; + uint32_t sbdf; domain = Int_val(Field(desc, 0)); bus = Int_val(Field(desc, 1)); - slot = Int_val(Field(desc, 2)); + dev = Int_val(Field(desc, 2)); func = Int_val(Field(desc, 3)); - bdf = pci_dev_to_bdf(domain, bus, slot, func); + sbdf = encode_sbdf(domain, bus, dev, func); - ret = xc_deassign_device(_H(xch), _D(domid), bdf); + ret = xc_deassign_device(_H(xch), _D(domid), sbdf); if (ret < 0) failwith_xc(_H(xch)); ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1 of 2] Ocaml/libxc bindings: Fix SBDF encoding 2013-01-03 22:49 [PATCH 1 of 2] Ocaml/libxc bindings: Fix SBDF encoding Andrew Cooper 2013-01-03 22:49 ` [PATCH 2 of 2] Ocaml/libxc bindings: Correct PCI terminology Andrew Cooper @ 2013-01-09 13:42 ` Andrew Cooper 2013-01-11 12:25 ` Ian Campbell 2 siblings, 0 replies; 4+ messages in thread From: Andrew Cooper @ 2013-01-09 13:42 UTC (permalink / raw) To: xen-devel@lists.xen.org; +Cc: Ian Jackson, Ian Campbell, Jan Beulich Ping? On 03/01/13 22:49, Andrew Cooper wrote: > Changeset 23861:ec7c81fbe0de alters the SBDF encoding expected by the > DOMCTL_{de,}assign_device hypercalls. > > While it updates libxl, libxc and the python bindings, the ocaml > bindings got missed. As a result, any attempt to use PCI Passthrough > with Xen-4.2 and later will fail. > > Signed-off-by: Andrew Cooper<andrew.cooper3@citrix.com> > > diff -r c4114a042410 -r 22e7cb73b4ad tools/ocaml/libs/xc/xenctrl_stubs.c > --- a/tools/ocaml/libs/xc/xenctrl_stubs.c > +++ b/tools/ocaml/libs/xc/xenctrl_stubs.c > @@ -1085,11 +1085,10 @@ CAMLprim value stub_xc_domain_irq_permis > > static uint32_t pci_dev_to_bdf(int domain, int bus, int slot, int func) > { > - uint32_t bdf = 0; > - bdf |= (bus& 0xff)<< 16; > - bdf |= (slot& 0x1f)<< 11; > - bdf |= (func& 0x7)<< 8; > - return bdf; > + return ((uint32_t)domain& 0xffff)<< 16 | > + ((uint32_t)bus& 0xff)<< 8 | > + ((uint32_t)slot& 0x1f)<< 3 | > + ((uint32_t)func& 0x7); > } > > CAMLprim value stub_xc_domain_test_assign_device(value xch, value domid, value desc) > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1 of 2] Ocaml/libxc bindings: Fix SBDF encoding 2013-01-03 22:49 [PATCH 1 of 2] Ocaml/libxc bindings: Fix SBDF encoding Andrew Cooper 2013-01-03 22:49 ` [PATCH 2 of 2] Ocaml/libxc bindings: Correct PCI terminology Andrew Cooper 2013-01-09 13:42 ` [PATCH 1 of 2] Ocaml/libxc bindings: Fix SBDF encoding Andrew Cooper @ 2013-01-11 12:25 ` Ian Campbell 2 siblings, 0 replies; 4+ messages in thread From: Ian Campbell @ 2013-01-11 12:25 UTC (permalink / raw) To: Andrew Cooper; +Cc: Ian Jackson, Jan Beulich, xen-devel@lists.xen.org On Thu, 2013-01-03 at 22:49 +0000, Andrew Cooper wrote: > Changeset 23861:ec7c81fbe0de alters the SBDF encoding expected by the > DOMCTL_{de,}assign_device hypercalls. > > While it updates libxl, libxc and the python bindings, the ocaml > bindings got missed. As a result, any attempt to use PCI Passthrough > with Xen-4.2 and later will fail. > > Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked + applied both this and the 2nd patch. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-01-11 12:25 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-01-03 22:49 [PATCH 1 of 2] Ocaml/libxc bindings: Fix SBDF encoding Andrew Cooper 2013-01-03 22:49 ` [PATCH 2 of 2] Ocaml/libxc bindings: Correct PCI terminology Andrew Cooper 2013-01-09 13:42 ` [PATCH 1 of 2] Ocaml/libxc bindings: Fix SBDF encoding Andrew Cooper 2013-01-11 12:25 ` Ian Campbell
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).