From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Tianrui Zhao <zhaotianrui@loongson.cn>,
qemu-devel@nongnu.org, kvm@vger.kernel.org,
Paolo Bonzini <pbonzini@redhat.com>,
gaosong@loongson.cn
Cc: "Michael S . Tsirkin" <mst@redhat.com>,
Cornelia Huck <cohuck@redhat.com>,
maobibo@loongson.cn
Subject: Re: [PATCH RFC v1 07/10] target/loongarch: Implement kvm_arch_handle_exit
Date: Thu, 20 Apr 2023 12:00:04 +0200 [thread overview]
Message-ID: <bbc4bf1b-9855-db6f-05d4-aa3baac96ee2@linaro.org> (raw)
In-Reply-To: <20230420093606.3366969-8-zhaotianrui@loongson.cn>
On 20/4/23 11:36, Tianrui Zhao wrote:
> Implement kvm_arch_handle_exit for loongarch. In this
> function, the KVM_EXIT_LOONGARCH_IOCSR is handled,
> we read or write the iocsr address space by the addr,
> length and is_write argument in kvm_run.
>
> Signed-off-by: Tianrui Zhao <zhaotianrui@loongson.cn>
> ---
> target/loongarch/kvm.c | 24 +++++++++++++++++++++++-
> 1 file changed, 23 insertions(+), 1 deletion(-)
>
> diff --git a/target/loongarch/kvm.c b/target/loongarch/kvm.c
> index f8772bbb27..4ce343d276 100644
> --- a/target/loongarch/kvm.c
> +++ b/target/loongarch/kvm.c
> @@ -499,7 +499,29 @@ bool kvm_arch_cpu_check_are_resettable(void)
>
> int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run)
> {
> - return 0;
> + int ret = 0;
> + LoongArchCPU *cpu = LOONGARCH_CPU(cs);
> + CPULoongArchState *env = &cpu->env;
> + MemTxAttrs attrs = {};
> +
> + attrs.requester_id = env_cpu(env)->cpu_index;
> +
> + DPRINTF("%s\n", __func__);
Please use trace events instead of DPRINTF(), as we are trying to remove
these.
> + switch (run->exit_reason) {
> + case KVM_EXIT_LOONGARCH_IOCSR:
> + address_space_rw(&env->address_space_iocsr,
> + run->iocsr_io.phys_addr,
> + attrs,
> + run->iocsr_io.data,
> + run->iocsr_io.len,
> + run->iocsr_io.is_write);
> + break;
> + default:
> + ret = -1;
> + fprintf(stderr, "KVM: unknown exit reason %d\n", run->exit_reason);
Would warn_report() be more appropriate here?
> + break;
> + }
> + return ret;
> }
>
> void kvm_arch_accel_class_init(ObjectClass *oc)
next prev parent reply other threads:[~2023-04-20 10:00 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-20 9:35 [PATCH RFC v1 00/10] Add loongarch kvm accel support Tianrui Zhao
2023-04-20 9:35 ` [PATCH RFC v1 01/10] linux-headers: Add KVM headers for loongarch Tianrui Zhao
2023-04-20 9:49 ` Cornelia Huck
2023-04-20 12:59 ` Tianrui Zhao
2023-04-23 6:59 ` Tianrui Zhao
2023-04-20 9:35 ` [PATCH RFC v1 02/10] target/loongarch: Define some kvm_arch interfaces Tianrui Zhao
2023-04-20 9:35 ` [PATCH RFC v1 03/10] target/loongarch: Supplement vcpu env initial when vcpu reset Tianrui Zhao
2023-04-20 9:36 ` [PATCH RFC v1 04/10] target/loongarch: Implement kvm get/set registers Tianrui Zhao
2023-04-20 9:36 ` [PATCH RFC v1 05/10] target/loongarch: Implement kvm_arch_init function Tianrui Zhao
2023-04-20 9:36 ` [PATCH RFC v1 06/10] target/loongarch: Implement kvm_arch_init_vcpu Tianrui Zhao
2023-04-20 9:36 ` [PATCH RFC v1 07/10] target/loongarch: Implement kvm_arch_handle_exit Tianrui Zhao
2023-04-20 10:00 ` Philippe Mathieu-Daudé [this message]
2023-04-20 11:06 ` Tianrui Zhao
2023-04-20 9:36 ` [PATCH RFC v1 08/10] target/loongarch: Implement set vcpu intr for kvm Tianrui Zhao
2023-04-20 9:36 ` [PATCH RFC v1 09/10] target/loongarch: Add kvm-stub.c Tianrui Zhao
2023-04-20 10:04 ` Philippe Mathieu-Daudé
2023-04-20 11:13 ` Tianrui Zhao
2023-04-20 9:36 ` [PATCH RFC v1 10/10] target/loongarch: Add kvm file into meson build Tianrui Zhao
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=bbc4bf1b-9855-db6f-05d4-aa3baac96ee2@linaro.org \
--to=philmd@linaro.org \
--cc=cohuck@redhat.com \
--cc=gaosong@loongson.cn \
--cc=kvm@vger.kernel.org \
--cc=maobibo@loongson.cn \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=zhaotianrui@loongson.cn \
/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).