xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@arm.com>
To: Stefano Stabellini <sstabellini@kernel.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Jan Beulich <JBeulich@suse.com>,
	Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH 1/9] x86/hypercall: Move some of the hvm hypercall infrastructure into hypercall.h
Date: Thu, 4 Aug 2016 12:27:44 +0100	[thread overview]
Message-ID: <2c4382bd-b7aa-89cd-ac27-8cbc1f14a4e5@arm.com> (raw)
In-Reply-To: <alpine.DEB.2.10.1608031101430.2382@sstabellini-ThinkPad-X260>



On 03/08/16 19:20, Stefano Stabellini wrote:
> On Wed, 3 Aug 2016, Julien Grall wrote:
>> Hi Jan,
>>
>> On 03/08/16 09:53, Jan Beulich wrote:
>>>>>> On 02.08.16 at 20:43, <sstabellini@kernel.org> wrote:
>>>> On Tue, 2 Aug 2016, Jan Beulich wrote:
>>>>>>>> On 02.08.16 at 16:59, <andrew.cooper3@citrix.com> wrote:
>>>>>> On 02/08/16 15:54, Jan Beulich wrote:
>>>>>>>>>> On 02.08.16 at 16:26, <julien.grall@arm.com> wrote:
>>>>>>>> On 02/08/16 15:17, Jan Beulich wrote:
>>>>>>>>> Well, I find it quite odd for hypercall argument counts to
>>>>>>>>> differ
>>>>>>>>> between arches. I.e. I'd conclude the ABI was mis-specified.
>>>>>>>> Is it documented somewhere for the x86 code? Looking at Linux, the
>>>>>>>> privcmd call is only passing 5 arguments on both ARM and x86.
>>>>>>> arch-x86/xen-x86_32.h has
>>>>>>>
>>>>>>>  * Hypercall interface:
>>>>>>>  *  Input:  %ebx, %ecx, %edx, %esi, %edi, %ebp (arguments 1-6)
>>>>>>>  *  Output: %eax
>>>>>>>
>>>>>>> while arch-x86/xen-x86_64.h has
>>>>>>>
>>>>>>>  * Hypercall interface:
>>>>>>>  *  Input:  %rdi, %rsi, %rdx, %r10, %r8, %r9 (arguments 1-6)
>>>>>>>  *  Output: %rax
>>>>>>
>>>>>> The only actual 6 argument hypercall is the v4v hypercall, better
>>>>>> known
>>>>>> as __HYPERVISOR_xc_reserved_op at index 39, but that isn't implemented
>>>>>> anywhere upstream.
>>>>>
>>>>> But it serves as an example what now wouldn't work on ARM.
>>>>
>>>> At the time the arm hypercall ABI was published, it matched the x86
>>>> hypercall ABI, which had only 5 hypercall arguments.
>>>>
>>>> The issue is that the x86 hypercall ABI changed, and now is out of sync
>>>> with ARM. The faulty commit being:
>>>
>>> That's one way of viewing it, but I don't think an appropriate one.
>>> 6-argument hypercalls had always been possible on x86, just that
>>> they might not have been documented in the public headers (but
>>> instead only in the actual hypercall implementation).
>>
>> I would tend to say that anything not documented in the public header is not
>> part of the ABI regardless how it has been implemented before hand.
>
> I agree. What is documented (or not documented) in the public headers
> is the golden standard.
>
>
>> Anyway, I looked at the hypercall implementation on ARM and it seems that we
>> half support the 6th argument. For instance hypercall_create_continuation is
>> clobbering r5/x5 which is not part of the ABI.
>>
>> However do_trap_hypercall is only supporting up to 5 argument.
>>
>> I don't think it would be an issue to support 6 arguments on ARM. Stefano,
>> what do you think?
>
> I am OK with supporting 6 arguments hypercalls and it would be good to
> have both architectures match. The 32bit guest-side implementation needs
> special caring, but it should be OK (see HYPERCALL5 in Linux).

It seems that Linux only handle 5 arguments for both x86 (see 
arch/x86/asm/xen/hypercall.h) and ARM.

The funny part is the x86 code has:

"The result certainly isn't pretty, and it really shows up cpp's
weakness as as macro language.  Sorry.  (But let's just give thanks
there aren't more than 5 arguments...)"

Anyway, I will add this in my todo list, I don't think it is really 
important to have this change right now.

> Fortunately xen/include/public/arch-arm.h states that only arguments
> used by an hypercall can be clobbered.

Regards,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2016-08-04 11:27 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-18  9:51 [PATCH 0/9] x86: Move the pv hypercall into C Andrew Cooper
2016-07-18  9:51 ` [PATCH 1/9] x86/hypercall: Move some of the hvm hypercall infrastructure into hypercall.h Andrew Cooper
2016-08-02 12:50   ` Jan Beulich
2016-08-02 13:14     ` Andrew Cooper
2016-08-02 13:28       ` Jan Beulich
2016-08-02 14:04         ` Julien Grall
2016-08-02 14:17           ` Jan Beulich
2016-08-02 14:26             ` Julien Grall
2016-08-02 14:54               ` Jan Beulich
2016-08-02 14:59                 ` Andrew Cooper
2016-08-02 15:05                   ` Jan Beulich
2016-08-02 18:43                     ` Stefano Stabellini
2016-08-03  8:53                       ` Jan Beulich
2016-08-03 10:55                         ` Julien Grall
2016-08-03 18:20                           ` Stefano Stabellini
2016-08-04 11:27                             ` Julien Grall [this message]
2016-07-18  9:51 ` [PATCH 2/9] x86/pv: Support do_set_segment_base() for compat guests Andrew Cooper
2016-08-02 12:52   ` Jan Beulich
2016-08-02 13:25     ` Andrew Cooper
2016-08-02 13:31       ` Jan Beulich
2016-08-02 13:39         ` Andrew Cooper
2016-08-02 13:47           ` Jan Beulich
2016-07-18  9:51 ` [PATCH 3/9] x86/hypercall: Move the hypercall arg tables into C Andrew Cooper
2016-08-02 12:59   ` Jan Beulich
2016-07-18  9:51 ` [PATCH 4/9] x86/pv: Implement pv_hypercall() in C Andrew Cooper
2016-08-02 13:12   ` Jan Beulich
2016-08-02 14:06     ` Andrew Cooper
2016-08-02 14:19       ` Jan Beulich
2016-08-11 11:57     ` Andrew Cooper
2016-08-11 12:20       ` Jan Beulich
2016-07-18  9:51 ` [PATCH 5/9] x86/hypercall: Move the hypercall tables into C Andrew Cooper
2016-08-02 13:23   ` Jan Beulich
2016-08-02 13:30     ` Andrew Cooper
2016-08-02 13:40       ` Jan Beulich
2016-08-11 12:00         ` Andrew Cooper
2016-07-18  9:51 ` [PATCH 6/9] xen/multicall: Rework arch multicall handling Andrew Cooper
2016-07-20 12:35   ` Julien Grall
2016-08-03 15:02   ` Jan Beulich
2016-08-03 15:12     ` Andrew Cooper
2016-07-18  9:51 ` [PATCH 7/9] x86/pv: Merge the pv hypercall tables Andrew Cooper
2016-08-03 15:07   ` Jan Beulich
2016-08-11 12:36     ` Andrew Cooper
2016-07-18  9:51 ` [PATCH 8/9] x86/hypercall: Merge the hypercall arg tables Andrew Cooper
2016-08-03 15:12   ` Jan Beulich
2016-08-03 15:15     ` Andrew Cooper
2016-08-03 15:28       ` Jan Beulich
2016-07-18  9:51 ` [PATCH 9/9] x86/hypercall: Reduce the size of the hypercall tables Andrew Cooper
2016-08-03 15:17   ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2c4382bd-b7aa-89cd-ac27-8cbc1f14a4e5@arm.com \
    --to=julien.grall@arm.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).