All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aleksei Filippov <alexei.filippov@syntacore.com>
To: <ajones@ventanamicro.com>
Cc: <alistair.francis@wdc.com>, <alistair23@gmail.com>,
	<apatel@ventanamicro.com>, <bin.meng@windriver.com>,
	<dbarboza@ventanamicro.com>, <liwei1518@gmail.com>,
	<palmer@dabbelt.com>, <qemu-devel@nongnu.org>,
	<qemu-riscv@nongnu.org>, <zhiwei_liu@linux.alibaba.com>
Subject: Re: [PATCH v5] target/riscv/kvm/kvm-cpu.c: kvm_riscv_handle_sbi() fail with vendor-specific sbi.
Date: Mon, 22 Apr 2024 14:40:34 +0300	[thread overview]
Message-ID: <ecbda674-791d-4064-b48e-398cbf34b603@syntacore.com> (raw)
In-Reply-To: <20240422112437.11079-1-alexei.filippov@syntacore.com>



On 22.04.2024 14:24, Alexei Filippov wrote:
> kvm_riscv_handle_sbi() may return not supported return code to not
> trigger qemu abort with vendor-specific sbi.
> 
> Add new error path to provide proper error in case of
> qemu_chr_fe_read_all() may not return sizeof(ch).
> 
> Added SBI related return code's defines.
> 
> Signed-off-by: Alexei Filippov <alexei.filippov@syntacore.com>
> ---
>   target/riscv/kvm/kvm-cpu.c         | 9 +++++----
>   target/riscv/sbi_ecall_interface.h | 1 +
>   2 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/target/riscv/kvm/kvm-cpu.c b/target/riscv/kvm/kvm-cpu.c
> index aeca1e3e83..5bb7b74d03 100644
> --- a/target/riscv/kvm/kvm-cpu.c
> +++ b/target/riscv/kvm/kvm-cpu.c
> @@ -1173,17 +1173,18 @@ static int kvm_riscv_handle_sbi(CPUState *cs, struct kvm_run *run)
>           ret = qemu_chr_fe_read_all(serial_hd(0)->be, &ch, sizeof(ch));
>           if (ret == sizeof(ch)) {
>               run->riscv_sbi.ret[0] = ch;
> -        } else {
> +            ret = 0;
> +        } else if (ret == 0) {
>               run->riscv_sbi.ret[0] = SBI_ERR_FAILURE;
> +        } else {
> +            ret = -1;
>           }
> -        ret = 0;
>           break;
>       default:
>           qemu_log_mask(LOG_UNIMP,
> -                      "%s: un-handled SBI EXIT, specific reasons is %lu\n",
> +                      "%s: Unhandled SBI exit with extension-id %lu\n"
>                         __func__, run->riscv_sbi.extension_id);
>           run->riscv_sbi.ret[0] = SBI_ERR_NOT_SUPPORTED;
> -        ret = 0;
>           break;
>       }
>       return ret;
> diff --git a/target/riscv/sbi_ecall_interface.h b/target/riscv/sbi_ecall_interface.h
> index 0279e92a36..a2e21d9b8c 100644
> --- a/target/riscv/sbi_ecall_interface.h
> +++ b/target/riscv/sbi_ecall_interface.h
> @@ -79,5 +79,6 @@
>   #define SBI_ERR_ALREADY_AVAILABLE   -6
>   #define SBI_ERR_ALREADY_STARTED     -7
>   #define SBI_ERR_ALREADY_STOPPED     -8
> +#define SBI_ERR_NO_SHMEM            -9
>   
>   #endif

Oh, my bad, wrong patch. Will resend properly.
-- 
Sincerely,
Aleksei Filippov


  reply	other threads:[~2024-04-22 11:41 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-25 10:14 [PATCH] target/riscv/kvm/kvm-cpu.c: kvm_riscv_handle_sbi() fail with vendor-specific SBI Alexei Filippov
2024-03-25 11:51 ` Daniel Henrique Barboza
2024-03-25 13:01   ` [PATCH v2] " Alexei Filippov
2024-03-26  4:54     ` Alistair Francis
2024-03-27 12:57       ` [PATCH v3] " Alexei Filippov
2024-03-26  9:50     ` [PATCH v2] " Andrew Jones
2024-04-13 11:25       ` [PATCH v4] " Alexei Filippov
2024-04-15 14:03         ` Andrew Jones
2024-04-22  3:55         ` Alistair Francis
2024-04-22  8:12           ` Andrew Jones
2024-04-22 11:24             ` [PATCH v5] target/riscv/kvm/kvm-cpu.c: kvm_riscv_handle_sbi() fail with vendor-specific sbi Alexei Filippov
2024-04-22 11:40               ` Aleksei Filippov [this message]
2024-04-22 11:42             ` [PATCH v6] target/riscv/kvm/kvm-cpu.c: kvm_riscv_handle_sbi() fail with vendor-specific SBI Alexei Filippov
2024-04-22 12:31               ` Andrew Jones
2024-04-25  9:21                 ` Andrew Jones
2024-05-03 10:39                   ` Aleksei Filippov
2024-05-03 11:55                     ` Andrew Jones
2024-05-27 13:48                       ` [PATCH v7] " Alexei Filippov
2024-05-27 15:03                         ` Andrew Jones
2024-06-25 15:02                           ` [PATCH v8] " Alexei Filippov
2024-06-26 15:18                             ` Andrew Jones
2024-09-17 11:54                               ` [PATCH v9] " Alexei Filippov
2024-09-17 12:29                                 ` Andrew Jones
2024-09-17 13:10                                   ` Andrew Jones
2024-09-18 13:37                                     ` Aleksei Filippov
2024-09-18 13:41                                       ` Andrew Jones

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=ecbda674-791d-4064-b48e-398cbf34b603@syntacore.com \
    --to=alexei.filippov@syntacore.com \
    --cc=ajones@ventanamicro.com \
    --cc=alistair.francis@wdc.com \
    --cc=alistair23@gmail.com \
    --cc=apatel@ventanamicro.com \
    --cc=bin.meng@windriver.com \
    --cc=dbarboza@ventanamicro.com \
    --cc=liwei1518@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=zhiwei_liu@linux.alibaba.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.