From nobody Mon Nov 25 04:52:45 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=sifive.com ARC-Seal: i=1; a=rsa-sha256; t=1717485083; cv=none; d=zohomail.com; s=zohoarc; b=SU3fKieZTkH0XExlWe7IBEStlJSH6GMFq4ACe1Jr67z0faWl6kyDkNfuV+khEIRMOCW/pH/UriJ6CtwW+bEBGw1uZNtySDwuP0v2WNIuqwnyLTu98xDsM0zQazgk3tAy3JK6fyVek5LOVXByEPzIb+viAZTbn1hOa+hjNEBYcNo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1717485083; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=pKkT300tlD3TQh5kFCyDOARg3WfWGx7ttZZNCCqlZ5k=; b=Fp9HDyysRHBTQnhJBy39b7wNEz36uLIHx6MFLXZzzcE99FjF8KpiWnf9CVrVNa0D2GW/13ZTu+HCoLZVmFt7+6fbR4NqHAiCxJ9FxLte06Xt8h9WsuYXvTgst6ZN3lxEM+ZwjU1eutBGNtKT/IDQimTWAQ7sdXCbMGzpDTHcSLw= 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+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1717485083502620.5221209991693; Tue, 4 Jun 2024 00:11:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sEOJY-0005JV-OW; Tue, 04 Jun 2024 03:10:36 -0400 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 1sEOJU-0005FP-EL for qemu-devel@nongnu.org; Tue, 04 Jun 2024 03:10:33 -0400 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sEOJR-0000Us-Hb for qemu-devel@nongnu.org; Tue, 04 Jun 2024 03:10:32 -0400 Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-6c4926bf9bbso2619509a12.2 for ; Tue, 04 Jun 2024 00:10:28 -0700 (PDT) Received: from hsinchu36-syssw02.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2c1a775d68dsm9237943a91.6.2024.06.04.00.10.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 00:10:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1717485027; x=1718089827; darn=nongnu.org; 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=pKkT300tlD3TQh5kFCyDOARg3WfWGx7ttZZNCCqlZ5k=; b=FutteiJlNQtowCt3mYu3lbQkFyvXJgv5grMA5BEiJGehaMgYLGq6GC6wJOuVqMld4N 0IR8YtF4CyarysAdwvjRb2flTf3W/HOsWwJQkSBYXPOa/k6oUBVUAkYpnOvbq+KFgUdI AMhfiVBSNvuoglswVZ58pLaOSjCq+D/XLlhIIhiYvdtP9zbw8yCoXfzMXO6MNLvf5kCc hdpon7LEcyUvpyyhrPWvQXsX7J5hFb+pTf311FyVmZygOOS3/eB0NAjmtOh6+8C5n8iW DbHiB1W7HILSqBVcmBDUyhIaYf5Pxu72CX50dbX80to/Q9CI6TIwBl4KSAYjqBvjmzF1 ZLYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717485027; x=1718089827; 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=pKkT300tlD3TQh5kFCyDOARg3WfWGx7ttZZNCCqlZ5k=; b=BufPlgZ4Dz9djSwwvsT1cb6ghNnt1goQdeWHigDP1dKNRXmQyRoYGlDbhQ4RmHvr5X POZf5qk/770hMl5TXmYP109Ua3mlRM3/5qaWcaTxTn8ae1yPnn8khMnNAiRe0lbBUDNe kawBU/4k/ERZcobOxUGgxemZ4VHJRVFfCYyeMpkh/IR8XzPHQ5UKfhUnceaQdS80ayt0 owmF27a/WMdTBtpPiggN3eDegGMuTUGOez08aERrItSCw1XHh6vHUeNeh0GHrAzFqgOP +nPPi7sompSrhoQq4XWPj4YY1I0Pr/ore4eW9HLmAt1x2+owu554iQKkSIFocsCpEcOv JFWA== X-Gm-Message-State: AOJu0YzlG68Ed+0aTEZewYLIwDLk+0XUXcmBfWWs878w7EErZeslD5xL qNrhAzizq1YTzsEDk2fR5n6Z+9Dm1XX7A3lBCp0qNMdkD92y7b3uIeRjRIFGyyvEmRO+sAOD/fB iUvflW/R+DC0JalhOOLevMyc7SxQxen05mJkHpx9edlsGVmMlvnRt6nYVo0ItVTzBqjE8UdgMwc WkkeKMWtn1KPf99MrnZf1LSajrftQfXJXdrFc= X-Google-Smtp-Source: AGHT+IEph1ovAjNTcsGX4Cf4PHFeYX4SzRN+q4nOM1RvaPQvCCKXZiDzk89z1LY4LiTEyOYTqMkOTg== X-Received: by 2002:a17:90b:4ac9:b0:2bd:ebd5:8bf0 with SMTP id 98e67ed59e1d1-2c1dc5d8bbemr10451632a91.42.1717485026681; Tue, 04 Jun 2024 00:10:26 -0700 (PDT) From: "Fea.Wang" To: qemu-devel@nongnu.org Cc: "Edgar E. Iglesias" , Alistair Francis , Peter Maydell , Jason Wang , qemu-arm@nongnu.org (open list:Xilinx Zynq), "Fea.Wang" , Frank Chang Subject: [PATCH v2 1/3] hw/dma: Enhance error handling in loading description Date: Tue, 4 Jun 2024 15:15:38 +0800 Message-Id: <20240604071540.18138-2-fea.wang@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240604071540.18138-1-fea.wang@sifive.com> References: <20240604071540.18138-1-fea.wang@sifive.com> 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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::532; envelope-from=fea.wang@sifive.com; helo=mail-pg1-x532.google.com 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @sifive.com) X-ZM-MESSAGEID: 1717485084558100005 Content-Type: text/plain; charset="utf-8" Loading a description from memory may cause a bus-error. In this case, the DMA should stop working, set the error flag, and return the failure value. When calling the loading a description function, it should be noticed that the function may return a failure value. Breaking the loop in this case is one of the possible ways to handle it. Signed-off-by: Fea.Wang Reviewed-by: Frank Chang Reviewed-by: Edgar E. Iglesias --- hw/dma/xilinx_axidma.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/hw/dma/xilinx_axidma.c b/hw/dma/xilinx_axidma.c index 0ae056ed06..ad307994c2 100644 --- a/hw/dma/xilinx_axidma.c +++ b/hw/dma/xilinx_axidma.c @@ -71,8 +71,11 @@ enum { enum { DMASR_HALTED =3D 1, DMASR_IDLE =3D 2, + DMASR_SLVERR =3D 1 << 5, + DMASR_DECERR =3D 1 << 6, DMASR_IOC_IRQ =3D 1 << 12, DMASR_DLY_IRQ =3D 1 << 13, + DMASR_ERR_IRQ =3D 1 << 14, =20 DMASR_IRQ_MASK =3D 7 << 12 }; @@ -190,17 +193,32 @@ static inline int streamid_from_addr(hwaddr addr) return sid; } =20 -static void stream_desc_load(struct Stream *s, hwaddr addr) +static MemTxResult stream_desc_load(struct Stream *s, hwaddr addr) { struct SDesc *d =3D &s->desc; =20 - address_space_read(&s->dma->as, addr, MEMTXATTRS_UNSPECIFIED, d, sizeo= f *d); + MemTxResult result =3D address_space_read(&s->dma->as, + addr, MEMTXATTRS_UNSPECIFIED, + d, sizeof *d); + if (result !=3D MEMTX_OK) { + if (result =3D=3D MEMTX_DECODE_ERROR) { + s->regs[R_DMASR] |=3D DMASR_DECERR; + } else { + s->regs[R_DMASR] |=3D DMASR_SLVERR; + } + + s->regs[R_DMACR] &=3D ~DMACR_RUNSTOP; + s->regs[R_DMASR] |=3D DMASR_HALTED; + s->regs[R_DMASR] |=3D DMASR_ERR_IRQ; + return result; + } =20 /* Convert from LE into host endianness. */ d->buffer_address =3D le64_to_cpu(d->buffer_address); d->nxtdesc =3D le64_to_cpu(d->nxtdesc); d->control =3D le32_to_cpu(d->control); d->status =3D le32_to_cpu(d->status); + return result; } =20 static void stream_desc_store(struct Stream *s, hwaddr addr) @@ -279,7 +297,9 @@ static void stream_process_mem2s(struct Stream *s, Stre= amSink *tx_data_dev, } =20 while (1) { - stream_desc_load(s, s->regs[R_CURDESC]); + if (MEMTX_OK !=3D stream_desc_load(s, s->regs[R_CURDESC])) { + break; + } =20 if (s->desc.status & SDESC_STATUS_COMPLETE) { s->regs[R_DMASR] |=3D DMASR_HALTED; @@ -336,7 +356,9 @@ static size_t stream_process_s2mem(struct Stream *s, un= signed char *buf, } =20 while (len) { - stream_desc_load(s, s->regs[R_CURDESC]); + if (MEMTX_OK !=3D stream_desc_load(s, s->regs[R_CURDESC])) { + break; + } =20 if (s->desc.status & SDESC_STATUS_COMPLETE) { s->regs[R_DMASR] |=3D DMASR_HALTED; --=20 2.34.1 From nobody Mon Nov 25 04:52:45 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=sifive.com ARC-Seal: i=1; a=rsa-sha256; t=1717485089; cv=none; d=zohomail.com; s=zohoarc; b=bSVBocqUN01hMBa0iEfyV5U/4elPxwCXYDKXmB+RxMc++S/K9VaWws2YNSZwC4/IVIWfQ5PTrnb+DnS6G59kKEZ2eL6X0AcLEEymmhdZlcSq44P/t/Um12aUkQQN7sfmOsEplx8nbD49qXHptvSRYVKlSbNHCvrSyed7nFDe3Gk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1717485089; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Sbuv/MOyNIQ6l5m1LicrtKm3mCmCzjFzQu45Z/Y7Z5s=; b=SHMBpawV+h115Xshja4nA+ySt47oUGvqHiuVm8ccmutmEXfaniIxGzq1RCuN1VzM4A5QdmwCEykmT6ZnzqgZMXOrOKJzxDgmZRVC8Wsd/4L1Wa2PVXo/XaFyR7gu65v5uT+8JrNvPj4UG+XIvsjwzvNgPVBZgo/o0dcviMyAB94= 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+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1717485089277166.15251647135187; Tue, 4 Jun 2024 00:11:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sEOJZ-0005JW-4V; Tue, 04 Jun 2024 03:10:37 -0400 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 1sEOJW-0005IJ-Bi for qemu-devel@nongnu.org; Tue, 04 Jun 2024 03:10:35 -0400 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sEOJT-0000WY-GJ for qemu-devel@nongnu.org; Tue, 04 Jun 2024 03:10:32 -0400 Received: by mail-pg1-x534.google.com with SMTP id 41be03b00d2f7-681bc7f50d0so3745453a12.0 for ; Tue, 04 Jun 2024 00:10:31 -0700 (PDT) Received: from hsinchu36-syssw02.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2c1a775d68dsm9237943a91.6.2024.06.04.00.10.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 00:10:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1717485030; x=1718089830; darn=nongnu.org; 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=Sbuv/MOyNIQ6l5m1LicrtKm3mCmCzjFzQu45Z/Y7Z5s=; b=OimBvCpPPeyaFBtPU2hmyFUHI06pyTHUQtoLp5YSv6SYXbxE33SKBQlyk3Z7YFKxWS b18jYWVM6fUBaIOCkh1tSGx82kjee81Y2NdSpdgatHcKBvmfVlgveP27XrBa3tbor/30 SiyEsg8hBKHJJOgMxdhDFDBFo5zg+H945ZTVvHGd2WSAlp8JI6YKI2Xz83nWP6t3VJvy 0CMJT1E949osNKWd/voDA5gY12xAbEmvlJT6Z9O4bA78NJRbBS63a4qDJkrepycM12Cu U4uWmurQH4r+qWYfBjL6LUTMSfplL3xLDDeK15IWj27L9O9EMMNItnrZ7ySpW+979lV6 OrpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717485030; x=1718089830; 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=Sbuv/MOyNIQ6l5m1LicrtKm3mCmCzjFzQu45Z/Y7Z5s=; b=HT1W1NTC3nDOjnlfBQAOsRBL+fX3XioOAOIy5Zflu5AgZSWTHkyHLqSQHmnKgrp1EU gUQ8AKeDUkk+2uOJB9/Eex/J2XDvrVKUXs68bE/IO7KcLRO/Lx9temkUnFdDLzYMJ8nA yCXTP2AIj4Nmiw27LHncjAMPyZR3BNVneYK2/lOVWt0hb05yUtgk5JRYx2kO8RNk4txZ 6mXMK2hxvO0Ew9rrs26P1bAswWPBjxtx2oXqyK7KtQdf4ZyPhP8XyPD9NKYj63FWhFgi xHixbTXLcDokrdzYHPoc4AhCVboioDOjH8SDbv/hqTo/GwzfVFLcjaCHhm59ucLh+LQD Silw== X-Gm-Message-State: AOJu0YzrzY29H4SUIhl/rBAVilYGAxKGGGnbJ7qQyTTtMLxgj+rWPf1w u56caXE8Rtl07VzhuKhzj2+vqPmKMCBLoERh8w99JI2VoXIhBv16r4VCt3cqm3OuLv0E/v5cbK/ HBXG9AQudWNd85MVW1xr1ieJJ5tcksrN1sO1dw9EA1y707UTz7efoegb9yRMXr1Ckk+0uwx4ZW5 aBiJApdZIPZotna1Wu+6fKj+UnqDRtGDsl+xc= X-Google-Smtp-Source: AGHT+IEPgaeswxzBB5snUh1+YbFPKiwckJaobiKav0mUxgKPqYReHYWFGvksxgN4Rkz3isbcm0kcjA== X-Received: by 2002:a17:90b:4d87:b0:2c1:ad50:5e1b with SMTP id 98e67ed59e1d1-2c2530789a2mr2691816a91.8.1717485029538; Tue, 04 Jun 2024 00:10:29 -0700 (PDT) From: "Fea.Wang" To: qemu-devel@nongnu.org Cc: "Edgar E. Iglesias" , Alistair Francis , Peter Maydell , Jason Wang , qemu-arm@nongnu.org (open list:Xilinx Zynq), "Fea.Wang" , "Edgar E . Iglesias" , Frank Chang Subject: [PATCH v2 2/3] hw/dma: Add a trace log for a description loading failure Date: Tue, 4 Jun 2024 15:15:39 +0800 Message-Id: <20240604071540.18138-3-fea.wang@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240604071540.18138-1-fea.wang@sifive.com> References: <20240604071540.18138-1-fea.wang@sifive.com> 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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::534; envelope-from=fea.wang@sifive.com; helo=mail-pg1-x534.google.com 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @sifive.com) X-ZM-MESSAGEID: 1717485090551100001 Content-Type: text/plain; charset="utf-8" Due to a description loading failure, adding a trace log makes observing the DMA behavior easy. Signed-off-by: Fea.Wang Reviewed-by: Edgar E. Iglesias Reviewed-by: Frank Chang --- hw/dma/trace-events | 3 +++ hw/dma/xilinx_axidma.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/hw/dma/trace-events b/hw/dma/trace-events index 3c47df54e4..95db083be4 100644 --- a/hw/dma/trace-events +++ b/hw/dma/trace-events @@ -44,3 +44,6 @@ pl330_debug_exec_stall(void) "stall of debug instruction = not implemented" pl330_iomem_write(uint32_t offset, uint32_t value) "addr: 0x%08"PRIx32" da= ta: 0x%08"PRIx32 pl330_iomem_write_clr(int i) "event interrupt lowered %d" pl330_iomem_read(uint32_t addr, uint32_t data) "addr: 0x%08"PRIx32" data: = 0x%08"PRIx32 + +# xilinx_axidma.c +xilinx_axidma_loading_desc_fail(uint32_t res) "error:%d" diff --git a/hw/dma/xilinx_axidma.c b/hw/dma/xilinx_axidma.c index ad307994c2..c9cfc3169b 100644 --- a/hw/dma/xilinx_axidma.c +++ b/hw/dma/xilinx_axidma.c @@ -36,6 +36,7 @@ #include "sysemu/dma.h" #include "hw/stream.h" #include "qom/object.h" +#include "trace.h" =20 #define D(x) =20 @@ -201,6 +202,8 @@ static MemTxResult stream_desc_load(struct Stream *s, h= waddr addr) addr, MEMTXATTRS_UNSPECIFIED, d, sizeof *d); if (result !=3D MEMTX_OK) { + trace_xilinx_axidma_loading_desc_fail(result); + if (result =3D=3D MEMTX_DECODE_ERROR) { s->regs[R_DMASR] |=3D DMASR_DECERR; } else { --=20 2.34.1 From nobody Mon Nov 25 04:52:45 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=sifive.com ARC-Seal: i=1; a=rsa-sha256; t=1717485068; cv=none; d=zohomail.com; s=zohoarc; b=bq57c5OzEUUr0L1EQmTpxs+WZYM2ewkkjljVqLFYXwjAb1vVUrP+iUCKLhl+IxqWwxyMEGxNR7YBiRm1I7aqGcgtTfP4L9d2iMz49Sr4laUEyGaTjxExCQ8KiJuWapQ4xbJKwsaWL0ijLOpCHyQObVApEtyhln29lFnNYsx4pLk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1717485068; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=wMVIvPPDyIsXb0IIrUQL6wLJN2o+AMmh9m6vpVCxHFY=; b=F0U8O6tR0ujYlNTXuHsxDhCDr3PpgQbE5x+bJbdbAVM8slyp7Iz5LZWmrgFZgNiNj5xY+4h/wMwS1sRdDFNwUPiz7Hn/AdGOA8GdPrJiZiS3pDD+unnA7s3+8jzVMsR/K5X2oSymV8rfoAXeeI3C+fH0TE034+SL2o/BLHfvW7Y= 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+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1717485068595369.36846958853073; Tue, 4 Jun 2024 00:11:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sEOJa-0005KZ-5b; Tue, 04 Jun 2024 03:10:38 -0400 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 1sEOJX-0005IQ-QT for qemu-devel@nongnu.org; Tue, 04 Jun 2024 03:10:35 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sEOJW-0000YA-9p for qemu-devel@nongnu.org; Tue, 04 Jun 2024 03:10:35 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-70249faa853so748448b3a.3 for ; Tue, 04 Jun 2024 00:10:33 -0700 (PDT) Received: from hsinchu36-syssw02.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2c1a775d68dsm9237943a91.6.2024.06.04.00.10.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 00:10:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1717485032; x=1718089832; darn=nongnu.org; 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=wMVIvPPDyIsXb0IIrUQL6wLJN2o+AMmh9m6vpVCxHFY=; b=OYMgmQN9myQF42XPOgWwko684GYNTl8z3MEbidxK9OJ+pSDF3IdFkh4iiEd47t1V4Q aVZjwDZ8WsEnJjjM0veOH6s+GZpYMlcZoDGBp/ZJFWG/CyNmi3UBCiYEAwYvimxAB6Q2 Z9IY4DqSrHxjkgkBZJzrroT9e3rwIBYKFNSyvhBA5/6js4K7gC9oLrJqZDHTqjWmjSP1 KozTCk+jMqxX7/DGFqKilABi7i+QQ7TDuc0OvN3xlq+Wp+QdZIqMd+/NlAeHPqs0WzyK XGbZMHLfWj+17XZZsRkmK3VQK/Km/IENwwM73305ppozpdDyoKaWhnCtI48VBpe7638D XNRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717485032; x=1718089832; 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=wMVIvPPDyIsXb0IIrUQL6wLJN2o+AMmh9m6vpVCxHFY=; b=bN+XILkoJ1z3JouK1Kpp+dTC66bgr53vpRwtDQ5T0DtE8HLByPEQVfMkER9s+HNPXe ZkVCOphORzJSTWdrcLJTon0T1QABoBZAAAm7a+QcKtPt8S3rj8fVCsSzvfoYZdLmYnof 0AmSsER8rXuQ3kkSEivBcTOlOZj8eS9v/4E6njP6XFe2ue614OQHnQVsvJ7WJldyUqf7 rNVsIJBVuwhs9rJo9UAMAs6FRc0bygHX/vsuWTpwxlkFyzEz4YXCD704EeRYDTbKFkIx rCQ2ucDSAACWgseX0II7a13R6E4YLme2SJmYGI52LBKxjEAM+ih6xE2iQirz4MjrNaTd RSjA== X-Gm-Message-State: AOJu0YzC11PKDPT+0MBpqfkAMShI9IwaxTySynnQFrpHAH0LYzPYZwbQ 6Hg+M8q72RkSgoccUD4GxjdxQLnNpoiliE9SUPHBiJgNDkOUdwKajy8Ow6rBo25YGHD87fHwupF dX5lUxYDmdEnTnCc+E2xf85P730dHr71ljEiCyAxQWByhPwzDrDA3XMn/VSkLruhdV465vxnGuU ZPCkIjeiJn6NTNrd50ZnrFbqqJ1MW4V5QhJF4= X-Google-Smtp-Source: AGHT+IFNBNbFFNI0Z2FXtpy156m8R+OwbriW2NDurDgUcGysUlw5Z5W6yvC4uYHvhytzETUa4sHAFg== X-Received: by 2002:a05:6a21:339c:b0:1af:af89:ed71 with SMTP id adf61e73a8af0-1b26f117905mr12281701637.19.1717485032298; Tue, 04 Jun 2024 00:10:32 -0700 (PDT) From: "Fea.Wang" To: qemu-devel@nongnu.org Cc: "Edgar E. Iglesias" , Alistair Francis , Peter Maydell , Jason Wang , qemu-arm@nongnu.org (open list:Xilinx Zynq), "Fea.Wang" , "Edgar E . Iglesias" , Frank Chang Subject: [PATCH v2 3/3] hw/net: Fix the transmission return size Date: Tue, 4 Jun 2024 15:15:40 +0800 Message-Id: <20240604071540.18138-4-fea.wang@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240604071540.18138-1-fea.wang@sifive.com> References: <20240604071540.18138-1-fea.wang@sifive.com> 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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=fea.wang@sifive.com; helo=mail-pf1-x432.google.com 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @sifive.com) X-ZM-MESSAGEID: 1717485070503100003 Content-Type: text/plain; charset="utf-8" Fix the transmission return size because not all bytes could be transmitted successfully. So, return a successful length instead of a constant value. Signed-off-by: Fea.Wang Reviewed-by: Edgar E. Iglesias Reviewed-by: Frank Chang --- hw/net/xilinx_axienet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/net/xilinx_axienet.c b/hw/net/xilinx_axienet.c index 7d1fd37b4a..05d41bd548 100644 --- a/hw/net/xilinx_axienet.c +++ b/hw/net/xilinx_axienet.c @@ -847,7 +847,7 @@ static ssize_t eth_rx(NetClientState *nc, const uint8_t= *buf, size_t size) axienet_eth_rx_notify(s); =20 enet_update_irq(s); - return size; + return s->rxpos; } =20 static size_t --=20 2.34.1