Hi, I am trying to make a hypercall from a HVM guest. I tried by copying all the xen-libs from Dom0 to DomU. I am getting an error PRIV_CMD not found (obviously). I have searched online and found installing PV on HVM drivers is a way to go about it. However, this won''t guarantee that I can make all the hypercalls (correct me if I am wrong). I am trying to invoke a custom hypercall (done by modifying xen_source in dom0). So, is it not possible to have just the priv cmd interface in the DomU and invoke a hypercall with xen libraries copied from Dom0 (these libs have my custom hypercall included)? -- Srujan D. Kotikela _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On Mon, 20 Jun 2011, Srujan Kotikela wrote:> Hi, > > I am trying to make a hypercall from a HVM guest. I tried by copying all the xen-libs from Dom0 to DomU. I am getting an > error PRIV_CMD not found (obviously). I have searched online and found installing PV on HVM drivers is a way to go about > it. However, this won''t guarantee that I can make all the hypercalls (correct me if I am wrong). > > I am trying to invoke a custom hypercall (done by modifying xen_source in dom0). So, is it not possible to have just the > priv cmd interface in the DomU and invoke a hypercall with xen libraries copied from Dom0 (these libs have my custom > hypercall included)?What kernel version are you using? If you make sure CONFIG_XEN_PVHVM is enabled in your kernel config, you should have all the mechanisms in place in the kernel to issue hypercalls. At that point if you also make sure CONFIG_XENFS is enabled, you should also be able to issue hypercalls from userland. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Hi, I am using 2.6.18 kernel. I am going to try with a newer kernel (>2.6.36.7). Meanwhile I was looking at the following code in tools/firmware/hvmloader/hypercall.h 44 <http://rswiki.csie.org/lxr/http/source/tools/firmware/hvmloader/hypercall.h?v=xen-4.0.0;a=ppc#L44> #define _hypercall0 <http://rswiki.csie.org/lxr/http/ident?v=xen-4.0.0;a=ppc;i=_hypercall0>(type <http://rswiki.csie.org/lxr/http/ident?v=xen-4.0.0;a=ppc;i=type>, name <http://rswiki.csie.org/lxr/http/ident?v=xen-4.0.0;a=ppc;i=name>) \ 45 <http://rswiki.csie.org/lxr/http/source/tools/firmware/hvmloader/hypercall.h?v=xen-4.0.0;a=ppc#L45> ({ \ 46 <http://rswiki.csie.org/lxr/http/source/tools/firmware/hvmloader/hypercall.h?v=xen-4.0.0;a=ppc#L46> long __res; \ 47 <http://rswiki.csie.org/lxr/http/source/tools/firmware/hvmloader/hypercall.h?v=xen-4.0.0;a=ppc#L47> asm volatile ( \ 48 <http://rswiki.csie.org/lxr/http/source/tools/firmware/hvmloader/hypercall.h?v=xen-4.0.0;a=ppc#L48> *"call "*hypercall_pa <http://rswiki.csie.org/lxr/http/ident?v=xen-4.0.0;a=ppc;i=hypercall_pa>*" + "* STR <http://rswiki.csie.org/lxr/http/ident?v=xen-4.0.0;a=ppc;i=STR>(__HYPERVISOR_##name * 32) \ 49 <http://rswiki.csie.org/lxr/http/source/tools/firmware/hvmloader/hypercall.h?v=xen-4.0.0;a=ppc#L49> : *"=a"* (__res) \ 50 <http://rswiki.csie.org/lxr/http/source/tools/firmware/hvmloader/hypercall.h?v=xen-4.0.0;a=ppc#L50> : \ 51 <http://rswiki.csie.org/lxr/http/source/tools/firmware/hvmloader/hypercall.h?v=xen-4.0.0;a=ppc#L51> : *"memory"* ); \ 52 <http://rswiki.csie.org/lxr/http/source/tools/firmware/hvmloader/hypercall.h?v=xen-4.0.0;a=ppc#L52> (type <http://rswiki.csie.org/lxr/http/ident?v=xen-4.0.0;a=ppc;i=type>)__res; \ 53 <http://rswiki.csie.org/lxr/http/source/tools/firmware/hvmloader/hypercall.h?v=xen-4.0.0;a=ppc#L53> }) I have few doubts in the code. The name argument in the above macro referes to the name(string type) of the hypercall like: do_vcpu_op, is it correct? What does the type argument refering to? Should this code be invoked from kernel-space or user-space (if CONFIG_XENFS is enabled). -- Srujan D. Kotikela On Tue, Jun 21, 2011 at 9:12 AM, Stefano Stabellini < stefano.stabellini@eu.citrix.com> wrote:> On Mon, 20 Jun 2011, Srujan Kotikela wrote: > > Hi, > > > > I am trying to make a hypercall from a HVM guest. I tried by copying all > the xen-libs from Dom0 to DomU. I am getting an > > error PRIV_CMD not found (obviously). I have searched online and found > installing PV on HVM drivers is a way to go about > > it. However, this won''t guarantee that I can make all the hypercalls > (correct me if I am wrong). > > > > I am trying to invoke a custom hypercall (done by modifying xen_source in > dom0). So, is it not possible to have just the > > priv cmd interface in the DomU and invoke a hypercall with xen libraries > copied from Dom0 (these libs have my custom > > hypercall included)? > > What kernel version are you using? > If you make sure CONFIG_XEN_PVHVM is enabled in your kernel config, you > should have all the mechanisms in place in the kernel to issue > hypercalls. > At that point if you also make sure CONFIG_XENFS is enabled, you should > also be able to issue hypercalls from userland. >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On Tue, 2011-06-21 at 16:53 +0100, Srujan Kotikela wrote:> Hi, > > I am using 2.6.18 kernel. I am going to try with a newer kernel (>> 2.6.36.7).I''m not sure, but I don''t think the privcmd stuff works from HVM domU in that kernel. Or at least I''d be very surprised if it did.> > Meanwhile I was looking at the following code in > tools/firmware/hvmloader/hypercall.h > > 44 #define _hypercall0(type, name) \ > > 45 ({ \ > 46 long __res; \ > > 47 asm volatile ( \ > 48 "call "hypercall_pa" + " STR(__HYPERVISOR_##name * 32) \ > > 49 : "=a" (__res) \ > > 50 : \ > 51 : "memory" ); \ > > 52 (type)__res; \ > > 53 }) > > I have few doubts in the code. > > > The name argument in the above macro referes to the name(string type) of the hypercall like: do_vcpu_op, is it correct?It is pasted onto "__HYPERVISOR_" (line 48) see include/xen/interface/xen.h for the definitions of these hypercall numbers. So it would be just vcpu_op in the example you give.> > What does the type argument refering to?Line 52 makes it pretty obvious it is the return type of the hypercall. Note you should never really be using these macros directly -- they are used internally as part of the implementation the actual hypercall-specific functions.> Should this code be invoked from kernel-space or user-space (if CONFIG_XENFS is enabled).Only the kernel can make a hypercall. Userspace requires a driver (privcmd) to allow it to make hypercalls. Ian.> > -- > Srujan D. Kotikela > > > On Tue, Jun 21, 2011 at 9:12 AM, Stefano Stabellini > <stefano.stabellini@eu.citrix.com> wrote: > > On Mon, 20 Jun 2011, Srujan Kotikela wrote: > > Hi, > > > > I am trying to make a hypercall from a HVM guest. I tried by > copying all the xen-libs from Dom0 to DomU. I am getting an > > error PRIV_CMD not found (obviously). I have searched online > and found installing PV on HVM drivers is a way to go about > > it. However, this won''t guarantee that I can make all the > hypercalls (correct me if I am wrong). > > > > I am trying to invoke a custom hypercall (done by modifying > xen_source in dom0). So, is it not possible to have just the > > priv cmd interface in the DomU and invoke a hypercall with > xen libraries copied from Dom0 (these libs have my custom > > hypercall included)? > > > What kernel version are you using? > If you make sure CONFIG_XEN_PVHVM is enabled in your kernel > config, you > should have all the mechanisms in place in the kernel to issue > hypercalls. > At that point if you also make sure CONFIG_XENFS is enabled, > you should > also be able to issue hypercalls from userland. >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On Tue, Jun 21, 2011 at 10:59 AM, Ian Campbell <Ian.Campbell@citrix.com>wrote:> On Tue, 2011-06-21 at 16:53 +0100, Srujan Kotikela wrote: > > Hi, > > > > I am using 2.6.18 kernel. I am going to try with a newer kernel (>> > 2.6.36.7). > > I''m not sure, but I don''t think the privcmd stuff works from HVM domU in > that kernel. Or at least I''d be very surprised if it did. > > > > > Meanwhile I was looking at the following code in > > tools/firmware/hvmloader/hypercall.h > > > > 44 #define _hypercall0(type, name) > \ > > > > 45 ({ > \ > > 46 long __res; > \ > > > > 47 asm volatile ( > \ > > 48 "call "hypercall_pa" + " STR(__HYPERVISOR_##name * > 32) \ > > > > 49 : "=a" (__res) > \ > > > > 50 : > \ > > 51 : "memory" ); > \ > > > > 52 (type)__res; > \ > > > > 53 }) > > > > I have few doubts in the code. > > > > > > The name argument in the above macro referes to the name(string type) of > the hypercall like: do_vcpu_op, is it correct? > > It is pasted onto "__HYPERVISOR_" (line 48) see > include/xen/interface/xen.h for the definitions of these hypercall > numbers. So it would be just vcpu_op in the example you give. > > > > What does the type argument refering to? > > Line 52 makes it pretty obvious it is the return type of the hypercall. > > Note you should never really be using these macros directly -- they are > used internally as part of the implementation the actual > hypercall-specific functions. > > > Should this code be invoked from kernel-space or user-space (if > CONFIG_XENFS is enabled). > > Only the kernel can make a hypercall. Userspace requires a driver > (privcmd) to allow it to make hypercalls. > > Ian. > > > > > -- > > Srujan D. Kotikela > > > > > > On Tue, Jun 21, 2011 at 9:12 AM, Stefano Stabellini > > <stefano.stabellini@eu.citrix.com> wrote: > > > > On Mon, 20 Jun 2011, Srujan Kotikela wrote: > > > Hi, > > > > > > I am trying to make a hypercall from a HVM guest. I tried by > > copying all the xen-libs from Dom0 to DomU. I am getting an > > > error PRIV_CMD not found (obviously). I have searched online > > and found installing PV on HVM drivers is a way to go about > > > it. However, this won''t guarantee that I can make all the > > hypercalls (correct me if I am wrong). > > > > > > I am trying to invoke a custom hypercall (done by modifying > > xen_source in dom0). So, is it not possible to have just the > > > priv cmd interface in the DomU and invoke a hypercall with > > xen libraries copied from Dom0 (these libs have my custom > > > hypercall included)? > > > > > > What kernel version are you using? > > If you make sure CONFIG_XEN_PVHVM is enabled in your kernel > > config, you > > should have all the mechanisms in place in the kernel to issue > > hypercalls. > > At that point if you also make sure CONFIG_XENFS is enabled, > > you should > > also be able to issue hypercalls from userland. > > > > >Hi, I installed 2.6.38.8 with CONFIG_XEN, CONFIG_XEN_PVHVM and CONFIG_XENFS. Then I copied all the libraries (from /usr/include/xen* and /usr/libxen*) from Dom0 to DomU. I still get the ERROR Internal error: Could not obtain handle on privileged command interface (2 = No such file or directory) I checked the /proc/xen. There is no privcmd present there. _SDK _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On Tue, 2011-06-21 at 23:35 +0100, Srujan Kotikela wrote:> I installed 2.6.38.8 with CONFIG_XEN, CONFIG_XEN_PVHVM and > CONFIG_XENFS. Then I copied all the libraries (from /usr/include/xen* > and /usr/libxen*) from Dom0 to DomU. I still get the > > ERROR Internal error: Could not obtain handle on privileged command > interface (2 = No such file or directory) > > I checked the /proc/xen. There is no privcmd present there.Is anything present in that directory at all? Did you arrange for xenfs to be mounted? You will need CONFIG_XEN_COMPAT_XENFS in order for the mount-point to be present. privcmd was exposed to domU in commit 9387377eb79a44f453fd27c3d00a2e5da587e369 Author: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> Date: Wed Oct 6 08:51:32 2010 -0700 xen/privcmd: make privcmd visible in domU so it should be in v2.6.38.8. Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
From: Srujan Kotikela <ksrujandas@gmail.com> Date: Wed, Jun 22, 2011 at 12:14 PM Subject: Re: [Xen-devel] PRIVCMD in HVM DomU To: Ian Campbell <Ian.Campbell@eu.citrix.com> On Wed, Jun 22, 2011 at 3:11 AM, Ian Campbell <Ian.Campbell@eu.citrix.com>wrote:> On Tue, 2011-06-21 at 23:35 +0100, Srujan Kotikela wrote: > > > > I installed 2.6.38.8 with CONFIG_XEN, CONFIG_XEN_PVHVM and > > CONFIG_XENFS. Then I copied all the libraries (from /usr/include/xen* > > and /usr/libxen*) from Dom0 to DomU. I still get the > > > > ERROR Internal error: Could not obtain handle on privileged command > > interface (2 = No such file or directory) > > > > I checked the /proc/xen. There is no privcmd present there. > > Is anything present in that directory at all? Did you arrange for xenfs > to be mounted? You will need CONFIG_XEN_COMPAT_XENFS in order for the > mount-point to be present. > > privcmd was exposed to domU in > commit 9387377eb79a44f453fd27c3d00a2e5da587e369 > Author: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> > Date: Wed Oct 6 08:51:32 2010 -0700 > > xen/privcmd: make privcmd visible in domU > so it should be in v2.6.38.8. > > Ian. > >Hi, The CONFIG_XEN_COMPAT_XENFS = y And there is nothing present in the /proc/xen directory. _SDK _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On Wed, 22 Jun 2011, Srujan Kotikela wrote:> From: Srujan Kotikela <ksrujandas@gmail.com> > Date: Wed, Jun 22, 2011 at 12:14 PM > Subject: Re: [Xen-devel] PRIVCMD in HVM DomU > To: Ian Campbell <Ian.Campbell@eu.citrix.com> > > > > On Wed, Jun 22, 2011 at 3:11 AM, Ian Campbell <Ian.Campbell@eu.citrix.com> wrote: > On Tue, 2011-06-21 at 23:35 +0100, Srujan Kotikela wrote: > > > > I installed 2.6.38.8 with CONFIG_XEN, CONFIG_XEN_PVHVM and > > CONFIG_XENFS. Then I copied all the libraries (from /usr/include/xen* > > and /usr/libxen*) from Dom0 to DomU. I still get the > > > > ERROR Internal error: Could not obtain handle on privileged command > > interface (2 = No such file or directory) > > > > I checked the /proc/xen. There is no privcmd present there. > > Is anything present in that directory at all? Did you arrange for xenfs > to be mounted? You will need CONFIG_XEN_COMPAT_XENFS in order for the > mount-point to be present. > > privcmd was exposed to domU in > commit 9387377eb79a44f453fd27c3d00a2e5da587e369 > Author: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> > Date: Wed Oct 6 08:51:32 2010 -0700 > > xen/privcmd: make privcmd visible in domU > so it should be in v2.6.38.8. > > Ian. > > > Hi, > > The CONFIG_XEN_COMPAT_XENFS = y > And there is nothing present in the /proc/xen directory. >try mount -t xenfs xenfs /proc/xen --8323329-693875712-1308764218=:12963 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --8323329-693875712-1308764218=:12963--
On Wed, Jun 22, 2011 at 12:36 PM, Stefano Stabellini < stefano.stabellini@eu.citrix.com> wrote:> On Wed, 22 Jun 2011, Srujan Kotikela wrote: > > From: Srujan Kotikela <ksrujandas@gmail.com> > > Date: Wed, Jun 22, 2011 at 12:14 PM > > Subject: Re: [Xen-devel] PRIVCMD in HVM DomU > > To: Ian Campbell <Ian.Campbell@eu.citrix.com> > > > > > > > > On Wed, Jun 22, 2011 at 3:11 AM, Ian Campbell < > Ian.Campbell@eu.citrix.com> wrote: > > On Tue, 2011-06-21 at 23:35 +0100, Srujan Kotikela wrote: > > > > > > > I installed 2.6.38.8 with CONFIG_XEN, CONFIG_XEN_PVHVM and > > > CONFIG_XENFS. Then I copied all the libraries (from > /usr/include/xen* > > > and /usr/libxen*) from Dom0 to DomU. I still get the > > > > > > ERROR Internal error: Could not obtain handle on privileged > command > > > interface (2 = No such file or directory) > > > > > > I checked the /proc/xen. There is no privcmd present there. > > > > Is anything present in that directory at all? Did you arrange for xenfs > > to be mounted? You will need CONFIG_XEN_COMPAT_XENFS in order for the > > mount-point to be present. > > > > privcmd was exposed to domU in > > commit 9387377eb79a44f453fd27c3d00a2e5da587e369 > > Author: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> > > Date: Wed Oct 6 08:51:32 2010 -0700 > > > > xen/privcmd: make privcmd visible in domU > > so it should be in v2.6.38.8. > > > > Ian. > > > > > > Hi, > > > > The CONFIG_XEN_COMPAT_XENFS = y > > And there is nothing present in the /proc/xen directory. > > > > try > > mount -t xenfs xenfs /proc/xenIt worked. I was able to do a hypercall from the user-level. Thanks for your help. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On Wed, Jun 22, 2011 at 12:36 PM, Stefano Stabellini < stefano.stabellini@eu.citrix.com> wrote:> On Wed, 22 Jun 2011, Srujan Kotikela wrote: > > From: Srujan Kotikela <ksrujandas@gmail.com> > > Date: Wed, Jun 22, 2011 at 12:14 PM > > Subject: Re: [Xen-devel] PRIVCMD in HVM DomU > > To: Ian Campbell <Ian.Campbell@eu.citrix.com> > > > > > > > > On Wed, Jun 22, 2011 at 3:11 AM, Ian Campbell < > Ian.Campbell@eu.citrix.com> wrote: > > On Tue, 2011-06-21 at 23:35 +0100, Srujan Kotikela wrote: > > > > > > > I installed 2.6.38.8 with CONFIG_XEN, CONFIG_XEN_PVHVM and > > > CONFIG_XENFS. Then I copied all the libraries (from > /usr/include/xen* > > > and /usr/libxen*) from Dom0 to DomU. I still get the > > > > > > ERROR Internal error: Could not obtain handle on privileged > command > > > interface (2 = No such file or directory) > > > > > > I checked the /proc/xen. There is no privcmd present there. > > > > Is anything present in that directory at all? Did you arrange for xenfs > > to be mounted? You will need CONFIG_XEN_COMPAT_XENFS in order for the > > mount-point to be present. > > > > privcmd was exposed to domU in > > commit 9387377eb79a44f453fd27c3d00a2e5da587e369 > > Author: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> > > Date: Wed Oct 6 08:51:32 2010 -0700 > > > > xen/privcmd: make privcmd visible in domU > > so it should be in v2.6.38.8. > > > > Ian. > > > > > > Hi, > > > > The CONFIG_XEN_COMPAT_XENFS = y > > And there is nothing present in the /proc/xen directory. > > > > try > > mount -t xenfs xenfs /proc/xenBut in the xm dmesg, I see this output: (XEN) hvm.c:2812:d3 Bad HVM op 9. (XEN) hvm.c:2812:d4 Bad HVM op 9. (XEN) hvm.c:2812:d6 Bad HVM op 9. (XEN) hvm.c:2812:d7 Bad HVM op 9. (XEN) hvm.c:2812:d8 Bad HVM op 9. Is it because I am trying to call my own hypercall? How can I my hypercall callable from a HVM (or PVHVM) domain? _SDK _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel