Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <marc.zyngier@arm.com>
To: Dave Martin <Dave.Martin@arm.com>, Geoff Levand <geoff@infradead.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	AKASHI Takahiro <takahiro.akashi@linaro.org>,
	James Morse <james.morse@arm.com>,
	kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v15 03/20] arm64: Convert hcalls to use HVC immediate value
Date: Wed, 16 Mar 2016 14:09:36 +0000	[thread overview]
Message-ID: <56E96920.3090701@arm.com> (raw)
In-Reply-To: <20160316135031.GB3701@e103592.cambridge.arm.com>

On 16/03/16 13:50, Dave Martin wrote:
> On Tue, Mar 15, 2016 at 11:15:10AM -0700, Geoff Levand wrote:
>> Hi,
>>
>> On Tue, 2016-03-15 at 13:50 +0000, Dave Martin wrote:
>>> On Mon, Mar 14, 2016 at 05:48:00PM +0000, Geoff Levand wrote:
>>>> The existing arm64 hcall implementations are limited in that they only
>>>> allow for two distinct hcalls; with the x0 register either zero or not
>>>> zero.  Also, the API of the hyp-stub exception vector routines and the
>>>> KVM exception vector routines differ; hyp-stub uses a non-zero value in
>>>> x0 to implement __hyp_set_vectors, whereas KVM uses it to implement
>>>> kvm_call_hyp.
>>>>
>>>> To allow for additional hcalls to be defined and to make the arm64 hcall
>>>> API more consistent across exception vector routines, change the hcall
>>>> implementations to use the 16 bit immediate value of the HVC instruction
>>>> to specify the hcall type.
>>>
>>> I'm a bit concerned about namespace pollution on the HVC immediate here.
>>> Existing users tend allocate a single "random" number to identify the
>>> API -- Xen and Jailhouse do this for example.
>>>
>>> If we start using the HVC immediate to select functions, not just APIs,
>>> the space is going to fill up a lot faster, if we have a multiplex
>>> multiple APIs through it.
>>
>> This was discussed and concluded that we have 16 bits to fill up,
>> and that is enough.  Functions can still be multiplexed through a
> 
> Enough for what?
> 
>> single HVC immediate if the user chooses to do so.
> 
> But KVM can't?
> 
> The HVC #imm space doesn't seem to be managed, which implies that
> discovery and/or renumbering mechanisms would be needed if we end up
> wanting to mux multiple ABIs through there.  The tighter limitation
> on immediate size, and the need for code patching if translation of
> HVC numbers is needed, mean that this can be harder when using the HVC
> immediate for demux rather than an ordinary register.
> 
> Currently, the only other ABI muxed through HVC is PSCI, but it
> already looks like there is a potential collision -- HVC #0 from EL1 is
> already KVM_CALL_HYP or a PSCI call, and we rely on knowing whether
> the call came from the host or guest to demux it properly.
> 
> This kind of problem is likely to proliferate over time.
> 
>>> (We don't currently seem to multiplex APIs much here, except that we
>>> do use HVC for PSCI calls from the guest, and it could be used for
>>> additional paravirtualised services in the future).
>>>
>>>> Define three new preprocessor macros HVC_CALL_HYP, HVC_GET_VECTORS, and
>>>> HVC_SET_VECTORS to be used as hcall type specifiers and convert the
>>>> existing __hyp_get_vectors(), __hyp_set_vectors() and kvm_call_hyp()
>>>> routines to use these new macros when executing an HVC call.  Also,
>>>> change the corresponding hyp-stub and KVM el1_sync exception vector
>>>> routines to use these new macros.
>>>
>>> It would also be preferable to keep the 32-bit and 64-bit APIs the same;
>>> we should avoid having them different unless there's a clinching
>>> technical reason...
>>
>> Please expand on why you see it as preferable.  What problems do
>> you see?
> 
> Fragmentation avoidance is the main argument I see.  The architectural
> constraints and the problem to be solved are basically the same between
> 32- and 64-bit, AFAICT.

+1. I never quite understood why we went from a single HVC immediate + a
register indicating the operation to a proliferation of immediate values
(and still the need for a register to indicate the operation in most cases).

This seems to go in a direction that is diametrically opposite the the
"normal" ARM way. That doesn't make it an invalid approach, but
uniformity with other APIs (PSCI for example) and the 32bit KVM code
seems a highly desirable feature (given that I'll end up maintaining
that code).

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  reply	other threads:[~2016-03-16 14:09 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-14 17:47 [PATCH v15 00/20] arm64 kexec kernel patches v15 Geoff Levand
2016-03-14 17:48 ` [PATCH v15 09/20] arm64: Add back cpu_reset routines Geoff Levand
2016-03-14 17:48 ` [PATCH v15 05/20] arm64: kvm: allows kvm cpu hotplug Geoff Levand
2016-03-14 17:48 ` [PATCH v15 11/20] Revert "arm64: remove dead code" Geoff Levand
2016-03-14 17:48 ` [PATCH v15 02/20] arm64: Cleanup SCTLR flags Geoff Levand
2016-03-14 17:48 ` [PATCH v15 07/20] arm64: Promote KERNEL_START/KERNEL_END definitions to a header file Geoff Levand
2016-03-14 17:48 ` [PATCH v15 03/20] arm64: Convert hcalls to use HVC immediate value Geoff Levand
2016-03-15 13:50   ` Dave Martin
2016-03-15 18:15     ` Geoff Levand
2016-03-16 13:50       ` Dave Martin
2016-03-16 14:09         ` Marc Zyngier [this message]
2016-03-17 16:47           ` Geoff Levand
2016-03-14 17:48 ` [PATCH v15 10/20] Revert "arm64: mm: remove unused cpu_set_idmap_tcr_t0sz function" Geoff Levand
2016-03-14 17:48 ` [PATCH v15 08/20] arm64: Add new asm macro copy_page Geoff Levand
2016-03-14 17:48 ` [PATCH v15 06/20] arm64: kernel: Include _AC definition in page.h Geoff Levand
2016-03-14 17:48 ` [PATCH v15 04/20] arm64: Add new hcall HVC_CALL_FUNC Geoff Levand
2016-03-14 17:48 ` [PATCH v15 12/20] arm64/kexec: Add core kexec support Geoff Levand
2016-03-14 17:48 ` [PATCH v15 13/20] arm64/kexec: Enable kexec in the arm64 defconfig Geoff Levand
2016-03-14 17:48 ` [PATCH v15 01/20] arm64: Fold proc-macros.S into assembler.h Geoff Levand
2016-03-14 17:48 ` [PATCH v15 14/20] arm64/kexec: Add pr_debug output Geoff Levand
2016-03-14 17:48 ` [PATCH v15 16/20] arm64: limit memory regions based on DT property, usable-memory Geoff Levand
2016-03-14 17:48 ` [PATCH v15 18/20] arm64: kdump: add kdump support Geoff Levand
2016-03-14 17:48 ` [PATCH v15 20/20] arm64: kdump: update a kernel doc Geoff Levand
2016-03-14 17:48 ` [PATCH v15 15/20] arm64: kdump: reserve memory for crash dump kernel Geoff Levand
2016-03-18 18:08   ` James Morse
2016-03-31  7:19     ` AKASHI Takahiro
2016-04-01  6:16       ` AKASHI Takahiro
2016-03-14 17:48 ` [PATCH v15 19/20] arm64: kdump: enable kdump in the arm64 defconfig Geoff Levand
2016-03-14 17:48 ` [PATCH v15 17/20] arm64: kdump: implement machine_crash_shutdown() Geoff Levand
2016-03-18 18:08   ` James Morse
2016-03-21 13:29     ` James Morse
2016-03-31  7:57       ` AKASHI Takahiro
2016-03-31  8:12         ` Marc Zyngier
2016-03-31 10:10           ` Mark Rutland
2016-04-01  8:45             ` AKASHI Takahiro
2016-04-01  9:36               ` Mark Rutland
2016-04-04  9:27                 ` AKASHI Takahiro
2016-03-31  7:46     ` AKASHI Takahiro
2016-03-31 10:22       ` James Morse
2016-04-01  1:59 ` [PATCH v15 00/20] arm64 kexec kernel patches v15 Dave Young
2016-04-01 18:39   ` Geoff Levand
2016-05-17  5:42     ` Dave Young
2016-05-17  8:06       ` Marc Zyngier
2016-05-17  9:07         ` AKASHI Takahiro
2016-05-18  2:09         ` Dave Young

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=56E96920.3090701@arm.com \
    --to=marc.zyngier@arm.com \
    --cc=Dave.Martin@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=geoff@infradead.org \
    --cc=james.morse@arm.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=takahiro.akashi@linaro.org \
    --cc=will.deacon@arm.com \
    /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