From patchwork Mon Aug 28 01:37:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jordan Niethe X-Patchwork-Id: 1826588 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=CW1HhHJD; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=slof-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=patchwork.ozlabs.org) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RYtVJ4trnz1yfX for ; Mon, 28 Aug 2023 11:38:00 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=CW1HhHJD; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4RYtVJ3zJdz30P3 for ; Mon, 28 Aug 2023 11:38:00 +1000 (AEST) X-Original-To: slof@lists.ozlabs.org Delivered-To: slof@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=CW1HhHJD; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::633; helo=mail-pl1-x633.google.com; envelope-from=jniethe5@gmail.com; receiver=lists.ozlabs.org) Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4RYtV70rpgz2yw0 for ; Mon, 28 Aug 2023 11:37:50 +1000 (AEST) Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-1bdbf10333bso21177295ad.1 for ; Sun, 27 Aug 2023 18:37:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693186668; x=1693791468; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=85qEiz75H8B8yGxcydz+sE/gsYwW1LM7p9acc1uppFU=; b=CW1HhHJD7q70sMjAOF19ET/WA5NNtFBBpUnsKKU5cnfFCebnL7R7m00ybvZXSd/a4l 29put2vzNkjud73dwXRN7EBl2kQRwuigKfqgfwmgEMj1byqYZ7AK7lA6ddzTp/dJIdYL DZBttYUbtleKOuRWKn06KSWuWQC1VnBULOg5NsPuO43CP5OLVACDN4KZjpnOhu1yGjB0 MmbqUCrMjOPHvlmhC1LT3uD9slWrUXcyHbgZRw4ka4+mNl/kIKTYlPuHkK23xW1A+NTP YewUOHMyPVL5Wdw1cuzXGqD+eH1vpfuf8zpAUfMKPb/8ln5LcXnzw6oNW9+On+ufkgtF bnrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693186668; x=1693791468; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=85qEiz75H8B8yGxcydz+sE/gsYwW1LM7p9acc1uppFU=; b=lJFq6u03yVmVE/7M+iJV/bCA/KUtPb0Gt9VsmY2ycJKRKm1yPPoDtU5k1ZfPeWEGYA juJOUyoK2zO6OGyCb4xLkXYQJUaMpn1E0A8HsgJN+S24K0U1yQwpq657HdGm9y90jJoL CqC0u3jpfACD148Us1kVZ9JNFh+jw8v8gcRL0OgUMiXrtLiRX0uR0b5y8lXdYeQ18B6E 6UBnd4YScAM++MpK3i6Qw3MyFgu1MenvzQ/o9E4LFJCEvljx5lBUrFa/mXwiBB3PJzTP D9JCuDdpaYsTVuw1V/CB3BA4mTe+pUxVmu53LMHKS4baRW5DyKEs+4zlY0AyKPO4ruVQ Dw9Q== X-Gm-Message-State: AOJu0YzVreb5Aw5B98fsSRdfZ8bDiqcYHSDFDenLbVpLdtKwkn7L/eBX WU+khoZF5OUp06FqSPvOJDC59SoEUwbL+g== X-Google-Smtp-Source: AGHT+IG3vHBexTKDsChBINOc4gDc9uq0fG0JSLMP+hl0S7SERJlWMMT9Rk73TEdtDj9+prOSbvbZ4w== X-Received: by 2002:a17:903:230e:b0:1bf:6a06:7b60 with SMTP id d14-20020a170903230e00b001bf6a067b60mr26206865plh.66.1693186668066; Sun, 27 Aug 2023 18:37:48 -0700 (PDT) Received: from pwon.ibmuc.com (159-196-117-139.9fc475.syd.nbn.aussiebb.net. [159.196.117.139]) by smtp.gmail.com with ESMTPSA id 21-20020a170902c25500b001b89536974bsm5934364plg.202.2023.08.27.18.37.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Aug 2023 18:37:47 -0700 (PDT) From: Jordan Niethe To: slof@lists.ozlabs.org Date: Mon, 28 Aug 2023 11:37:35 +1000 Message-Id: <20230828013736.18414-2-jniethe5@gmail.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20230828013736.18414-1-jniethe5@gmail.com> References: <20230828013736.18414-1-jniethe5@gmail.com> MIME-Version: 1.0 Subject: [SLOF] [PATCH 2/3] virtio-serial: Make read and write methods report failure X-BeenThere: slof@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Patches for https://github.com/aik/SLOF" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kconsul@linux.vnet.ibm.com, groug@kaod.org Errors-To: slof-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "SLOF" From: Kautuk Consul The read and write methods return as though they were successfully even if the virtio device is closed (virtiodev is 0) and it is not able to send or receive any characters. Make the read and write methods return 0 to indicate they did not succeed in this case. Signed-off-by: Kautuk Consul Signed-off-by: Jordan Niethe --- board-qemu/slof/virtio-serial.fs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/board-qemu/slof/virtio-serial.fs b/board-qemu/slof/virtio-serial.fs index a67a310..41e2e04 100644 --- a/board-qemu/slof/virtio-serial.fs +++ b/board-qemu/slof/virtio-serial.fs @@ -67,7 +67,7 @@ virtiodev virtio-serial-init drop ; : write ( addr len -- actual ) - virtiodev 0= IF nip EXIT THEN + virtiodev 0= IF 2drop 0 EXIT THEN tuck 0 ?DO dup c@ virtiodev SWAP virtio-serial-putchar @@ -78,7 +78,7 @@ virtiodev virtio-serial-init drop : read ( addr len -- actual ) 0= IF drop 0 EXIT THEN - virtiodev 0= IF drop 1 EXIT THEN + virtiodev 0= IF drop 0 EXIT THEN virtiodev virtio-serial-haschar 0= IF 0 swap c! -2 EXIT THEN virtiodev virtio-serial-getchar swap c! 1 ;