From nobody Sat Apr 20 05:37:05 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1675432957; cv=none; d=zohomail.com; s=zohoarc; b=S9t6oqvGBh0rmBuDLsr3XcjUr+W6rdbmMyMY3MZ3g6PuFKGDDTDE8pc5z8QW1YR64I2Hh5MSWQ7gVfLVGg57ecRJ5IMHKdGInLqyX5LylFhnJpe+wkTNGaH/zUvfqEtjwWKfIi5yof851HgmIQXTax9N05aAcMYPOxCbjI6n/NI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1675432957; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=tAuIyQmV7ZBYjPYRCFEefK0kSf5i0udrwT737+bHbO4=; b=oCwwvzR8ie/wDur+gsZ+nwNErovkDMnKqu3P9Bsz3B7/2OScFWCKVU7Dm+P3vybimPLUtJItBK/mASu1s4qSBHVtciGCKSDEIIxWsgFxL8ZwB12R+ZdROkOTSHDznvqWQcJWqVyZNpLizikrAW4cSdXNyIpy9bJiulBX+37uP70= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1675432957507340.0519850307411; Fri, 3 Feb 2023 06:02:37 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNwdc-0001w8-SI; Fri, 03 Feb 2023 09:02:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNwUC-0006ln-Dq; Fri, 03 Feb 2023 08:52:18 -0500 Received: from forward105j.mail.yandex.net ([2a02:6b8:0:801:2::108]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNwUA-0001FX-2E; Fri, 03 Feb 2023 08:52:16 -0500 Received: from myt6-65ee53fe8ed8.qloud-c.yandex.net (myt6-65ee53fe8ed8.qloud-c.yandex.net [IPv6:2a02:6b8:c12:1d8e:0:640:65ee:53fe]) by forward105j.mail.yandex.net (Yandex) with ESMTP id 5AD9E4EC9665; Fri, 3 Feb 2023 16:52:05 +0300 (MSK) Received: by myt6-65ee53fe8ed8.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id 3qYwoclYY0U1-0ivTrp5r; Fri, 03 Feb 2023 16:52:04 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=syntacore.com; s=mail; t=1675432324; bh=tAuIyQmV7ZBYjPYRCFEefK0kSf5i0udrwT737+bHbO4=; h=Message-Id:Date:Cc:Subject:To:From; b=xP78BLqjnhJOEV57uL6YYJdfydm9yk4YqVi2LvkWJX5vHiDvuhuuxbgX2E+m1QJYH wvAtQOKPe1MgZ2YumIy8RywIQrH66NKKkXc259u3diha3qsO/yvby0UnjjWX/zTIbJ iYIxFc9LrtxrizUikJKg2wxkTUBesAY1qnW1piCo= Authentication-Results: myt6-65ee53fe8ed8.qloud-c.yandex.net; dkim=pass header.i=@syntacore.com From: Vladimir Isaev To: qemu-riscv@nongnu.org, pbonzini@redhat.com, bin.meng@windriver.com, alistair.francis@wdc.com, palmer@dabbelt.com Cc: qemu-devel@nongnu.org, Vladimir Isaev Subject: [PATCH] target/riscv: fix SBI getchar handler for KVM Date: Fri, 3 Feb 2023 16:51:55 +0300 Message-Id: <20230203135155.12449-1-vladimir.isaev@syntacore.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a02:6b8:0:801:2::108; envelope-from=vladimir.isaev@syntacore.com; helo=forward105j.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Fri, 03 Feb 2023 09:01:21 -0500 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @syntacore.com) X-ZM-MESSAGEID: 1675432959936100003 Content-Type: text/plain; charset="utf-8" Character must be returned via ret[0] field (copied to a0 by KVM). Return value should be set to 0 to indicate successful processing. Signed-off-by: Vladimir Isaev Reviewed-by: Alistair Francis --- target/riscv/kvm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/target/riscv/kvm.c b/target/riscv/kvm.c index 30f21453d69c..0f932a5b966e 100644 --- a/target/riscv/kvm.c +++ b/target/riscv/kvm.c @@ -467,10 +467,11 @@ static int kvm_riscv_handle_sbi(CPUState *cs, struct = kvm_run *run) case SBI_EXT_0_1_CONSOLE_GETCHAR: ret =3D qemu_chr_fe_read_all(serial_hd(0)->be, &ch, sizeof(ch)); if (ret =3D=3D sizeof(ch)) { - run->riscv_sbi.args[0] =3D ch; + run->riscv_sbi.ret[0] =3D ch; } else { - run->riscv_sbi.args[0] =3D -1; + run->riscv_sbi.ret[0] =3D -1; } + ret =3D 0; break; default: qemu_log_mask(LOG_UNIMP, --=20 2.39.1