kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: "Alex Bennée" <alex.bennee@linaro.org>, qemu-devel@nongnu.org
Cc: Cornelia Huck <cohuck@redhat.com>,
	qemu-arm@nongnu.org, Mark Burton <mburton@qti.qualcomm.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Alexander Graf <graf@amazon.com>,
	kvm@vger.kernel.org, Peter Maydell <peter.maydell@linaro.org>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [RFC PATCH 10/11] kvm/arm: implement a basic hypercall handler
Date: Fri, 22 Aug 2025 09:15:55 +0200	[thread overview]
Message-ID: <01997d1f-178a-4113-873e-bf9ab7977e2f@linaro.org> (raw)
In-Reply-To: <20250617163351.2640572-11-alex.bennee@linaro.org>

On 17/6/25 18:33, Alex Bennée wrote:
> For now just deal with the basic version probe we see during startup.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>   target/arm/kvm.c        | 44 +++++++++++++++++++++++++++++++++++++++++
>   target/arm/trace-events |  1 +
>   2 files changed, 45 insertions(+)


> +/*
> + * The guest is making a hypercall or firmware call. We can handle a
> + * limited number of them (e.g. PSCI) but we can't emulate a true
> + * firmware. This is an abbreviated version of
> + * kvm_smccc_call_handler() in the kernel and the TCG only arm_handle_psci_call().
> + *
> + * In the SplitAccel case we would be transitioning to execute EL2+
> + * under TCG.
> + */
> +static int kvm_arm_handle_hypercall(ARMCPU *cpu,
> +                                    int esr_ec)
> +{
> +    CPUARMState *env = &cpu->env;
> +    int32_t ret = 0;
> +
> +    trace_kvm_hypercall(esr_ec, env->xregs[0]);
> +

Should we make arm_is_psci_call() generic to be able to use it here?

> +    switch (env->xregs[0]) {
> +    case QEMU_PSCI_0_2_FN_PSCI_VERSION:
> +        ret = QEMU_PSCI_VERSION_1_1;
> +        break;
> +    case QEMU_PSCI_0_2_FN_MIGRATE_INFO_TYPE:
> +        ret = QEMU_PSCI_0_2_RET_TOS_MIGRATION_NOT_REQUIRED; /* No trusted OS */
> +        break;
> +    case QEMU_PSCI_1_0_FN_PSCI_FEATURES:
> +        ret = QEMU_PSCI_RET_NOT_SUPPORTED;
> +        break;
> +    default:
> +        qemu_log_mask(LOG_UNIMP, "%s: unhandled hypercall %"PRIx64"\n",
> +                      __func__, env->xregs[0]);
> +        return -1;
> +    }
> +
> +    env->xregs[0] = ret;
> +    return 0;
> +}


  parent reply	other threads:[~2025-08-22  7:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-17 16:33 [RFC PATCH 00/11] kvm/arm: trap-me-harder implementation Alex Bennée
2025-06-17 16:33 ` [RFC PATCH 01/11] target/arm: allow gdb to read ARM_CP_NORAW regs (!upstream) Alex Bennée
2025-06-17 16:33 ` [RFC PATCH 02/11] target/arm: re-arrange debug_cp_reginfo Alex Bennée
2025-06-17 16:33 ` [RFC PATCH 03/11] linux-headers: Update to Linux 6.15.1 with trap-mem-harder (WIP) Alex Bennée
2025-06-17 16:33 ` [RFC PATCH 04/11] kvm: expose a trap-harder option to the command line Alex Bennée
2025-06-17 16:33 ` [RFC PATCH 05/11] target/arm: enable KVM_VM_TYPE_ARM_TRAP_ALL when asked Alex Bennée
2025-06-17 16:33 ` [RFC PATCH 06/11] kvm/arm: allow out-of kernel GICv3 to work with KVM Alex Bennée
2025-06-17 16:33 ` [RFC PATCH 07/11] target/arm: clamp value on icc_bpr_write to account for RES0 fields Alex Bennée
2025-06-17 16:33 ` [RFC PATCH 08/11] kvm/arm: plumb in a basic trap harder handler Alex Bennée
2025-06-17 16:33 ` [RFC PATCH 09/11] kvm/arm: implement sysreg trap handler Alex Bennée
2025-06-17 16:33 ` [RFC PATCH 10/11] kvm/arm: implement a basic hypercall handler Alex Bennée
2025-08-22  7:12   ` Philippe Mathieu-Daudé
2025-08-22  7:55     ` Manos Pitsidianakis
2025-08-22  7:15   ` Philippe Mathieu-Daudé [this message]
2025-06-17 16:33 ` [RFC PATCH 11/11] kvm/arm: implement WFx traps for KVM Alex Bennée

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=01997d1f-178a-4113-873e-bf9ab7977e2f@linaro.org \
    --to=philmd@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=cohuck@redhat.com \
    --cc=graf@amazon.com \
    --cc=kvm@vger.kernel.org \
    --cc=mburton@qti.qualcomm.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.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).