This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


Re: [Xen-devel] PRIVCMD in HVM DomU

To: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
Subject: Re: [Xen-devel] PRIVCMD in HVM DomU
From: Srujan Kotikela <ksrujandas@xxxxxxxxx>
Date: Tue, 21 Jun 2011 17:35:24 -0500
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <Stefano.Stabellini@xxxxxxxxxxxxx>
Delivery-date: Tue, 21 Jun 2011 15:36:15 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=ngxhCIUy5fSQY6CzFE/eVEf0uTLvxiRfmvXJPrAOCds=; b=jQsoH1B6iv10Llg2PvSPyo5LoYdQnJNHuJ5JyiUIGApxbZ35+5Q/lwfum/Pg3uMwx4 1Zvl2bDy7YNphKcizBEbvGtYEKytPZM2y86w6vvlrlr1QwirOx8Zr3dFkQeCfSXqz1kp gnTw9qVx+Z5mRUHO/Yua7IkkrRQVmsoP7xa+g=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=hE2LZxz/aQ2JQ0fqwfpVCTPtypcteInSnllbMArRt894CAd1M9XekK116kVwWp0ASH 2JzfgS1PaR5B4JQMqexAo9xyNeOdrrMOkzraEVjmEPFQaTLXgX6TYwTJikljvEszB6Fg nOuYfhENHi3YGIRlJ7JfoD/vDWUxakZdBv0zQ=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1308671995.6920.98.camel@xxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <BANLkTin46u5E=i-Qfyqvayof+Yw9hiWH+w@xxxxxxxxxxxxxx> <alpine.DEB.2.00.1106211508491.12963@kaball-desktop> <BANLkTinSouSZQcZuyeZcA+-xjnAyY3Y-6A@xxxxxxxxxxxxxx> <1308671995.6920.98.camel@xxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Tue, Jun 21, 2011 at 10:59 AM, Ian Campbell <Ian.Campbell@xxxxxxxxxx> 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 (>=

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.


> --
> Srujan D. Kotikela
> On Tue, Jun 21, 2011 at 9:12 AM, Stefano Stabellini
> <stefano.stabellini@xxxxxxxxxxxxx> 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.


I installed 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.


Xen-devel mailing list
<Prev in Thread] Current Thread [Next in Thread>