diff mbox

[v3,6/9] tools/xen-access: add test-case for ARM SMC

Message ID 1462373480-20206-6-git-send-email-tamas@tklengyel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tamas K Lengyel May 4, 2016, 2:51 p.m. UTC
Signed-off-by: Tamas K Lengyel <tamas@tklengyel.com>
---
Cc: Razvan Cojocaru <rcojocaru@bitdefender.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
 tools/tests/xen-access/xen-access.c | 32 ++++++++++++++++++++++++++++++--
 1 file changed, 30 insertions(+), 2 deletions(-)

Comments

Jan Beulich May 4, 2016, 3:35 p.m. UTC | #1
>>> On 04.05.16 at 16:51, <tamas@tklengyel.com> wrote:
> --- a/tools/tests/xen-access/xen-access.c
> +++ b/tools/tests/xen-access/xen-access.c
> @@ -1,4 +1,3 @@
> -/*
>   * xen-access.c
>   *
>   * Exercises the basic per-page access mechanisms

Are you saying this still builds with such a change?

Jan
Tamas K Lengyel May 4, 2016, 5:16 p.m. UTC | #2
On May 4, 2016 09:35, "Jan Beulich" <JBeulich@suse.com> wrote:
>
> >>> On 04.05.16 at 16:51, <tamas@tklengyel.com> wrote:
> > --- a/tools/tests/xen-access/xen-access.c
> > +++ b/tools/tests/xen-access/xen-access.c
> > @@ -1,4 +1,3 @@
> > -/*
> >   * xen-access.c
> >   *
> >   * Exercises the basic per-page access mechanisms
>
> Are you saying this still builds with such a change?
>

It builds fine, so not sure what you mean.

Tamas
Wei Liu May 4, 2016, 5:33 p.m. UTC | #3
On Wed, May 04, 2016 at 11:16:24AM -0600, Tamas K Lengyel wrote:
> On May 4, 2016 09:35, "Jan Beulich" <JBeulich@suse.com> wrote:
> >
> > >>> On 04.05.16 at 16:51, <tamas@tklengyel.com> wrote:
> > > --- a/tools/tests/xen-access/xen-access.c
> > > +++ b/tools/tests/xen-access/xen-access.c
> > > @@ -1,4 +1,3 @@
> > > -/*

This line -- you seemed to have removed "/*". I think that's what Jan
meant.

Wei.

> > >   * xen-access.c
> > >   *
> > >   * Exercises the basic per-page access mechanisms
> >
> > Are you saying this still builds with such a change?
> >
> 
> It builds fine, so not sure what you mean.
> 
> Tamas
Tamas K Lengyel May 4, 2016, 5:42 p.m. UTC | #4
On May 4, 2016 11:34, "Wei Liu" <wei.liu2@citrix.com> wrote:
>
> On Wed, May 04, 2016 at 11:16:24AM -0600, Tamas K Lengyel wrote:
> > On May 4, 2016 09:35, "Jan Beulich" <JBeulich@suse.com> wrote:
> > >
> > > >>> On 04.05.16 at 16:51, <tamas@tklengyel.com> wrote:
> > > > --- a/tools/tests/xen-access/xen-access.c
> > > > +++ b/tools/tests/xen-access/xen-access.c
> > > > @@ -1,4 +1,3 @@
> > > > -/*
>
> This line -- you seemed to have removed "/*". I think that's what Jan
> meant.
>

Oops, that must be a typo from --annotate.

Tamas
Razvan Cojocaru May 5, 2016, 9:37 a.m. UTC | #5
On 05/04/2016 05:51 PM, Tamas K Lengyel wrote:
> Signed-off-by: Tamas K Lengyel <tamas@tklengyel.com>
> ---
> Cc: Razvan Cojocaru <rcojocaru@bitdefender.com>
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> Cc: Wei Liu <wei.liu2@citrix.com>
> ---
>  tools/tests/xen-access/xen-access.c | 32 ++++++++++++++++++++++++++++++--
>  1 file changed, 30 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/tests/xen-access/xen-access.c b/tools/tests/xen-access/xen-access.c
> index f26e723..db65846 100644
> --- a/tools/tests/xen-access/xen-access.c
> +++ b/tools/tests/xen-access/xen-access.c
> @@ -1,4 +1,3 @@
> -/*
>   * xen-access.c

With the above fixed as per Jan's comment:

Acked-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
Jan Beulich May 5, 2016, 4:25 p.m. UTC | #6
i.A. Jan Beulich
Software Engineering Consultant
Attachmate Group
Nördlicher Zubringer 9-11
40470 Düsseldorf
jbeulich@suse.com
SUSE
 
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)

>>> Tamas K Lengyel <tamas@tklengyel.com> 05/04/16 7:18 PM >>>
>On May 4, 2016 09:35, "Jan Beulich" <JBeulich@suse.com> wrote:
>>
>> >>> On 04.05.16 at 16:51, <tamas@tklengyel.com> wrote:
>> > --- a/tools/tests/xen-access/xen-access.c
>> > +++ b/tools/tests/xen-access/xen-access.c
>> > @@ -1,4 +1,3 @@
>> > -/*
>> >   * xen-access.c
>> >   *
>> >   * Exercises the basic per-page access mechanisms
>>
>> Are you saying this still builds with such a change?
>
>It builds fine, so not sure what you mean.

Perhaps the patch here isn't what you test? I can't see how a file with the
beginning of a comment removed can build.

Jan
Tamas K Lengyel May 5, 2016, 6:25 p.m. UTC | #7
On May 5, 2016 10:29, "Jan Beulich" <jbeulich@suse.com> wrote:
>
>
> i.A. Jan Beulich
> Software Engineering Consultant
> Attachmate Group
> Nördlicher Zubringer 9-11
> 40470 Düsseldorf
> jbeulich@suse.com
> SUSE
>
> SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB
21284 (AG Nürnberg)
>
> >>> Tamas K Lengyel <tamas@tklengyel.com> 05/04/16 7:18 PM >>>
> >On May 4, 2016 09:35, "Jan Beulich" <JBeulich@suse.com> wrote:
> >>
> >> >>> On 04.05.16 at 16:51, <tamas@tklengyel.com> wrote:
> >> > --- a/tools/tests/xen-access/xen-access.c
> >> > +++ b/tools/tests/xen-access/xen-access.c
> >> > @@ -1,4 +1,3 @@
> >> > -/*
> >> >   * xen-access.c
> >> >   *
> >> >   * Exercises the basic per-page access mechanisms
> >>
> >> Are you saying this still builds with such a change?
> >
> >It builds fine, so not sure what you mean.
>
> Perhaps the patch here isn't what you test? I can't see how a file with
the
> beginning of a comment removed can build.
>
> Jan

Yea, the typo was introduced somewhere midway in the process.. Oh well,
will resend.

Tamas
diff mbox

Patch

diff --git a/tools/tests/xen-access/xen-access.c b/tools/tests/xen-access/xen-access.c
index f26e723..db65846 100644
--- a/tools/tests/xen-access/xen-access.c
+++ b/tools/tests/xen-access/xen-access.c
@@ -1,4 +1,3 @@ 
-/*
  * xen-access.c
  *
  * Exercises the basic per-page access mechanisms
@@ -334,6 +333,8 @@  void usage(char* progname)
     fprintf(stderr, "Usage: %s [-m] <domain_id> write|exec", progname);
 #if defined(__i386__) || defined(__x86_64__)
             fprintf(stderr, "|breakpoint|altp2m_write|altp2m_exec");
+#elif defined(__arm__) || defined(__aarch64__)
+            fprintf(stderr, "|privcall");
 #endif
             fprintf(stderr,
             "\n"
@@ -357,6 +358,7 @@  int main(int argc, char *argv[])
     int required = 0;
     int breakpoint = 0;
     int shutting_down = 0;
+    int privcall = 0;
     int altp2m = 0;
     uint16_t altp2m_view_id = 0;
 
@@ -412,6 +414,11 @@  int main(int argc, char *argv[])
         default_access = XENMEM_access_rw;
         altp2m = 1;
     }
+#elif defined(__arm__) || defined(__aarch64__)
+    else if ( !strcmp(argv[0], "privcall") )
+    {
+        privcall = 1;
+    }
 #endif
     else
     {
@@ -524,6 +531,16 @@  int main(int argc, char *argv[])
         }
     }
 
+    if ( privcall )
+    {
+        rc = xc_monitor_privileged_call(xch, domain_id, 1);
+        if ( rc < 0 )
+        {
+            ERROR("Error %d setting privileged call trapping with vm_event\n", rc);
+            goto exit;
+        }
+    }
+
     /* Wait for access */
     for (;;)
     {
@@ -535,6 +552,9 @@  int main(int argc, char *argv[])
             if ( breakpoint )
                 rc = xc_monitor_software_breakpoint(xch, domain_id, 0);
 
+            if ( privcall )
+                rc = xc_monitor_privileged_call(xch, domain_id, 0);
+
             if ( altp2m )
             {
                 rc = xc_altp2m_switch_to_view( xch, domain_id, 0 );
@@ -635,7 +655,7 @@  int main(int argc, char *argv[])
                 rsp.u.mem_access = req.u.mem_access;
                 break;
             case VM_EVENT_REASON_SOFTWARE_BREAKPOINT:
-                printf("Breakpoint: rip=%016"PRIx64", gfn=%"PRIx64" (vcpu %d)\n",
+                printf("Breakpoint: rip=%"PRIx64" gfn=%"PRIx64" (vcpu %d)\n",
                        req.data.regs.x86.rip,
                        req.u.software_breakpoint.gfn,
                        req.vcpu_id);
@@ -650,7 +670,15 @@  int main(int argc, char *argv[])
                     interrupted = -1;
                     continue;
                 }
+                break;
+            case VM_EVENT_REASON_PRIVILEGED_CALL:
+                printf("Privileged call: pc=%"PRIx32" (vcpu %d)\n",
+                       req.data.regs.arm32.pc,
+                       req.vcpu_id);
 
+                rsp.data.regs.arm32 = req.data.regs.arm32;
+                rsp.data.regs.arm32.pc += 4;
+                rsp.flags |= VM_EVENT_FLAG_SET_REGISTERS;
                 break;
             case VM_EVENT_REASON_SINGLESTEP:
                 printf("Singlestep: rip=%016"PRIx64", vcpu %d, altp2m %u\n",