Mailing List Archive

[PATCH 2/4] docs/html/hcall: Annotations for two hypercalls
Add annotations for a couple of the hypercalls:
HYPERVISOR_set_trap_table
HYPERVISOR_mmu_update

We do this by
* annotating the list of #defines for hypercall numbers
* annotating the list of error values
* providing a function prototype for the systematically-named functions
The header generator does the rest.

This exercise revealed a couple of infelicities:
* In the actual source code, do_mmu_update is defined to return an int
and do_set_trap_table a long. However both functions return either
-Efoo (on error) or 0 for success.
* The error numbers are defined only in the private header file
xen/include/xen/errno.h and then only with names which will
typically clash with other projects. It would be nice to include a
public version of this header which defines XEN_E*. But for now
we run xen-headers on errno.h too.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
docs/Makefile | 2 +-
xen/include/public/arch-x86/xen.h | 6 ++++++
xen/include/public/xen.h | 11 +++++++++--
xen/include/xen/errno.h | 5 +++++
4 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/docs/Makefile b/docs/Makefile
index fc42859..01e59cb 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -134,7 +134,7 @@ html/hcall/stamp:
./xen-headers -O $(@D) \
-T 'arch-x86_64 - Xen public headers' \
-X arch-ia64 -X arch-x86_32 -X xen-x86_32 \
- ../xen include/public
+ ../xen include/public include/xen/errno.h
touch $@

txt/%.txt: %.txt
diff --git a/xen/include/public/arch-x86/xen.h b/xen/include/public/arch-x86/xen.h
index 79ec633..d663cef 100644
--- a/xen/include/public/arch-x86/xen.h
+++ b/xen/include/public/arch-x86/xen.h
@@ -82,7 +82,13 @@ typedef unsigned long xen_pfn_t;
typedef unsigned long xen_ulong_t;

/*
+ * ` enum neg_errnoval
+ * ` HYPERVISOR_set_trap_table(const struct trap_info traps[]);
+ * `
+ */
+/*
* Send an array of these to HYPERVISOR_set_trap_table().
+ * Terminate the array with a sentinel entry, with traps[].address==0.
* The privilege level specifies which modes may enter a trap via a software
* interrupt. On x86/64, since rings 1 and 2 are unavailable, we allocate
* privilege levels as follows:
diff --git a/xen/include/public/xen.h b/xen/include/public/xen.h
index fde9fa5..f2c9e6f 100644
--- a/xen/include/public/xen.h
+++ b/xen/include/public/xen.h
@@ -55,6 +55,8 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
* HYPERCALLS
*/

+/* ` enum hypercall_num { // __HYPERVISOR_* => HYPERVISOR_*() */
+
#define __HYPERVISOR_set_trap_table 0
#define __HYPERVISOR_mmu_update 1
#define __HYPERVISOR_set_gdt 2
@@ -105,6 +107,8 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
#define __HYPERVISOR_arch_6 54
#define __HYPERVISOR_arch_7 55

+/* ` } */
+
/*
* HYPERCALL COMPATIBILITY.
*/
@@ -163,8 +167,11 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
#define NR_VIRQS 24

/*
- * HYPERVISOR_mmu_update(reqs, count, pdone, foreigndom)
- *
+ * ` enum neg_errnoval
+ * ` HYPERVISOR_mmu_update(const struct mmu_update reqs[],
+ * ` unsigned count, unsigned *done_out,
+ * ` unsigned foreigndom)
+ * `
* @reqs is an array of mmu_update_t structures ((ptr, val) pairs).
* @count is the length of the above array.
* @pdone is an output parameter indicating number of completed operations
diff --git a/xen/include/xen/errno.h b/xen/include/xen/errno.h
index 7cf599f..c2eb5d3 100644
--- a/xen/include/xen/errno.h
+++ b/xen/include/xen/errno.h
@@ -1,6 +1,9 @@
#ifndef _I386_ERRNO_H
#define _I386_ERRNO_H

+/* ` enum neg_errnoval { /* -Efoo for each Efoo in the list below } */
+/* ` enum errnoval { */
+
#define EPERM 1 /* Operation not permitted */
#define ENOENT 2 /* No such file or directory */
#define ESRCH 3 /* No such process */
@@ -129,4 +132,6 @@
#define ENOMEDIUM 123 /* No medium found */
#define EMEDIUMTYPE 124 /* Wrong medium type */

+/* } */
+
#endif
--
1.7.2.5


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Re: [PATCH 2/4] docs/html/hcall: Annotations for two hypercalls [ In reply to ]
On Sun, 2011-11-13 at 19:21 +0000, Ian Jackson wrote:
> diff --git a/xen/include/xen/errno.h b/xen/include/xen/errno.h
> index 7cf599f..c2eb5d3 100644
> --- a/xen/include/xen/errno.h
> +++ b/xen/include/xen/errno.h
> @@ -1,6 +1,9 @@
> #ifndef _I386_ERRNO_H
> #define _I386_ERRNO_H
>
> +/* ` enum neg_errnoval { /* -Efoo for each Efoo in the list below } */

Do we pass -Wcomment (or something which includes it)? If so gcc might
warn:
/home/ianc/t.c:5:26: warning: "/*" within comment
(and we use -Werror, so...).

Is this syntax trying to encode some meaning or was it just a typo?

> +/* ` enum errnoval { */
> +
> #define EPERM 1 /* Operation not permitted */
> #define ENOENT 2 /* No such file or directory */
> #define ESRCH 3 /* No such process */
> @@ -129,4 +132,6 @@
> #define ENOMEDIUM 123 /* No medium found */
> #define EMEDIUMTYPE 124 /* Wrong medium type */
>
> +/* } */

Is the ` supposed to be required here or is omitting it fine?

> +
> #endif



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Re: [PATCH 2/4] docs/html/hcall: Annotations for two hypercalls [ In reply to ]
Ian Campbell writes ("Re: [Xen-devel] [PATCH 2/4] docs/html/hcall: Annotations for two hypercalls"):
> On Sun, 2011-11-13 at 19:21 +0000, Ian Jackson wrote:
> > +/* ` enum neg_errnoval { /* -Efoo for each Efoo in the list below } */
>
> Do we pass -Wcomment (or something which includes it)? If so gcc might
> warn:
> /home/ianc/t.c:5:26: warning: "/*" within comment
> (and we use -Werror, so...).

Good point. I don't think we pass that now - I would have noticed.
But we probably should do so I should change the comment there to [ ]
or something.

> Is this syntax trying to encode some meaning or was it just a typo?

Ideally it would have had a matching */ but obv. that wouldn't have
worked :-).

> > +/* ` enum errnoval { */
> > +
> > #define EPERM 1 /* Operation not permitted */
> > #define ENOENT 2 /* No such file or directory */
> > #define ESRCH 3 /* No such process */
> > @@ -129,4 +132,6 @@
> > #define ENOMEDIUM 123 /* No medium found */
> > #define EMEDIUMTYPE 124 /* Wrong medium type */
> >
> > +/* } */
>
> Is the ` supposed to be required here or is omitting it fine?

Omitting the ` means the processor doesn't see that which means the
remaining #defines in that file would count as part of the enum -
except there aren't any. So it's a bug.

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Re: [PATCH 2/4] docs/html/hcall: Annotations for two hypercalls [ In reply to ]
On Sun, Nov 13, 2011 at 07:21:04PM +0000, Ian Jackson wrote:
> Add annotations for a couple of the hypercalls:
> HYPERVISOR_set_trap_table
> HYPERVISOR_mmu_update

So I've some comments on the affects of what this hypercall expects
in some details. Where would I put those? In the header file or should
I do it somewhere else?


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Re: [PATCH 2/4] docs/html/hcall: Annotations for two hypercalls [ In reply to ]
Konrad Rzeszutek Wilk writes ("Re: [Xen-devel] [PATCH 2/4] docs/html/hcall: Annotations for two hypercalls"):
> On Sun, Nov 13, 2011 at 07:21:04PM +0000, Ian Jackson wrote:
> > Add annotations for a couple of the hypercalls:
> > HYPERVISOR_set_trap_table
> > HYPERVISOR_mmu_update
>
> So I've some comments on the affects of what this hypercall expects
> in some details. Where would I put those? In the header file or should
> I do it somewhere else?

In the header file.

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Re: [PATCH 2/4] docs/html/hcall: Annotations for two hypercalls [ In reply to ]
On Tue, Nov 15, 2011 at 02:47:09PM +0000, Ian Jackson wrote:
> Konrad Rzeszutek Wilk writes ("Re: [Xen-devel] [PATCH 2/4] docs/html/hcall: Annotations for two hypercalls"):
> > On Sun, Nov 13, 2011 at 07:21:04PM +0000, Ian Jackson wrote:
> > > Add annotations for a couple of the hypercalls:
> > > HYPERVISOR_set_trap_table
> > > HYPERVISOR_mmu_update
> >
> > So I've some comments on the affects of what this hypercall expects
> > in some details. Where would I put those? In the header file or should
> > I do it somewhere else?
>
> In the header file.

Is it OK if it runs on for pages?

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Re: [PATCH 2/4] docs/html/hcall: Annotations for two hypercalls [ In reply to ]
Konrad Rzeszutek Wilk writes ("Re: [Xen-devel] [PATCH 2/4] docs/html/hcall: Annotations for two hypercalls"):
> On Tue, Nov 15, 2011 at 02:47:09PM +0000, Ian Jackson wrote:
> > Konrad Rzeszutek Wilk writes ("Re: [Xen-devel] [PATCH 2/4] docs/html/hcall: Annotations for two hypercalls"):
> > > On Sun, Nov 13, 2011 at 07:21:04PM +0000, Ian Jackson wrote:
> > > > Add annotations for a couple of the hypercalls:
> > > > HYPERVISOR_set_trap_table
> > > > HYPERVISOR_mmu_update
> > >
> > > So I've some comments on the affects of what this hypercall expects
> > > in some details. Where would I put those? In the header file or should
> > > I do it somewhere else?
> >
> > In the header file.
>
> Is it OK if it runs on for pages?

Yes. See also the approach we're taking in libxl.h.

If it really gets too long you can take it out and put it in a text or
markdown or pod file in docs/, leaving behind a reference.

Ian.

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