From nobody Mon Nov 25 04:54:37 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=1718242271; cv=none; d=zohomail.com; s=zohoarc; b=EyCdGjjuMoW7/QQ4kggIy6Swo9NQQWfUmPKXlsZBWpXSlrZwkdsddxURfOB48EGjT/e6NtFJwvxn6jCUQyEIbsWdcbdZ2KRUyuf784Uba00yu/wEH5rp4UoweFEOw1Gzo9MLeknPh0YRAFywph4WFdMzqpPdPPk/sAuuMgiwidc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718242271; 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=FSgSboXA87fcEYyH6cTuI3ALJ/H52TgRNw67u+11yropwposuohvGhsKIcBHhugf15EQIzX0Zn1OfkSndyO/laIAsY3uOsCrD2MYuMRK//VUJPDq2BPfu1gv4nwK766scbxdGuCGICdY5/ID1nEB0yoZwH2p280oND/mYCQSKzA= 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 1718242271957487.02263924329225; Wed, 12 Jun 2024 18:31:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sHZHt-0001tP-3s; Wed, 12 Jun 2024 21:30:01 -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 1sHZHs-0001sO-4z for qemu-devel@nongnu.org; Wed, 12 Jun 2024 21:30:00 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sHZHp-00089W-V9 for qemu-devel@nongnu.org; Wed, 12 Jun 2024 21:29:59 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1f70c457823so4167475ad.3 for ; Wed, 12 Jun 2024 18:29:57 -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 d9443c01a7336-1f855e723fasm1264155ad.97.2024.06.12.18.29.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 18:29:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1718242196; x=1718846996; 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=mHRVZj3rkDhzoSyr0ESZyHfBVR9QcI3Al7vW/DCpaL2/oSYSuBB9gwqummXQbGtgwH wn2a5fkBNdgUMbw3zly0sP62aPdQPAqu0waE+MbQ3IJye88DgigMhJEQ76DByn3/DJZc cQ8BSQICjhl77ULa7uYRGcGIv84eh53m668Cqe5mkNXxuNFtP1DSHEGPzjedHdsBYnp3 0VlVtlKvMX62yQS9d9djKIVNfB5f8TOOHxcawWEUWR+Cg2TlKiiwcTlG4BMHC3DPUgY/ cPg4RmvtV5iTmMpYj/rNNBCSzJNIryVQ1GtRbHi9W2NTrrGID4C+/ByIWJoDhhCosW+t UkjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718242196; x=1718846996; 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=DlJ4Y/T371N7isr0OQRJ7ETrzPRCywwJlxA9lV+LGhDKv7Q7QoP8mmn252r9ncOoMU Civ9vPuLnkt18cTgrOTmqcsr+IDQcnb8ogfrUHS29rJ9YribqiRQ6JlTe/lo42Xx/G31 KM3kUvaSwsWPB9kRDTnN/bagtoKdbGMudTNwSskz2X6Fkvheci+w4WTrGNKu+RkYcyqs ueUR1m9UDOtVGU0OK/uaq5ApZjTveC4DJ2GkBOiXai+4mpPo0PTniP3KaLMicP33CpBN M7ecNSQC+S/IkUd4OdeFlsj2Dt9xRj17Lu94/PY1/8t4H4AxZI3sh8OkmujMZho2lt95 6PZQ== X-Gm-Message-State: AOJu0Yye0gvbNu9twTWLgFzuXkFVNi9xOHEzbMpAZ9Rx/7c1zAwzOqWf x8++981li0y5myDqAAv7B927Lqt+wDJykTPS5ovzPjm3XeUz5BMjAlKfMhSQqc6UH+sXIbp3H7x vxuLYfPDoLcLVcKGvQOCxJSqNnmXvunqjpLUurex8l46vrLofqvHzJ7FVyPCI777y425jgHmFet v/j3hVnw4HRKo+gQc+eecUrxuLv7H30gevRF8= X-Google-Smtp-Source: AGHT+IEi1HPMZ9NzQqEfmQPReCnDoxjnDejhtbIx8XTp5yJtqII1z4JIArhntGtUalSIAABAAYJRuQ== X-Received: by 2002:a17:902:d50b:b0:1f7:38a2:f1ec with SMTP id d9443c01a7336-1f83b67a940mr43752995ad.36.1718242196123; Wed, 12 Jun 2024 18:29:56 -0700 (PDT) From: "Fea.Wang" To: qemu-devel@nongnu.org, qemu-riscv@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 v3 1/3] hw/dma: Enhance error handling in loading description Date: Thu, 13 Jun 2024 09:34:59 +0800 Message-Id: <20240613013501.426905-2-fea.wang@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240613013501.426905-1-fea.wang@sifive.com> References: <20240613013501.426905-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::634; envelope-from=fea.wang@sifive.com; helo=mail-pl1-x634.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: 1718242273587100006 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 --- 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:54:37 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=1718242302; cv=none; d=zohomail.com; s=zohoarc; b=GolYlX4Cx4mcMSQMV21lv75/jg6k9074bt0zmTxDbdbdJweKEjId+bV9EIlqRQAC3TNKEFZL3qKVJ38NY3sp9NIpRgUa0jxfGHLylV4qyiZSGv6t/mH5kPT0MI/6WGoV05ENP/sPkTE6HFiBIuBsX+Vv3466B/6Q3ixaAQQg6oQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718242302; 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=sx46nwLh6y0cuModMm/z+J15eC8XVVvw74Hv/Q7DVvE=; b=AXBnNq2hBTUNxEIBLp/fuNKeqp5LjFmkXph91QSTjZpHXSRaVYdFszoY+3g6mFQFnondJN4WzzJabcqUUTm+xRReJHEs5Qs8RUIyRBPTNg2XRXnmCSdRQ/Qlui+azLTtWJB3h7kg7iVbetVLvK59cm70ETgcA3QVLd4bDK7kfPQ= 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 1718242302014678.7121052135324; Wed, 12 Jun 2024 18:31:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sHZHx-0001vq-Fn; Wed, 12 Jun 2024 21:30:05 -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 1sHZHv-0001uz-Sy for qemu-devel@nongnu.org; Wed, 12 Jun 2024 21:30:03 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sHZHt-0008AM-71 for qemu-devel@nongnu.org; Wed, 12 Jun 2024 21:30:03 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1f480624d0fso4024165ad.1 for ; Wed, 12 Jun 2024 18:30:00 -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 d9443c01a7336-1f855e723fasm1264155ad.97.2024.06.12.18.29.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 18:29:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1718242199; x=1718846999; 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=sx46nwLh6y0cuModMm/z+J15eC8XVVvw74Hv/Q7DVvE=; b=nvLu/oXRvOge2DO8OB33m9hIICKFPnQWR+EVddR5PP5o4i6IzEDH0gjft0N1rB7qDF lPl2jn+3bt6yyTmlR2pjrqVjH01/4remEvOOKsI6ofvmqJXlWuEv+En1ipx/ulPG2mxe s1PWJ7kYXwW5sskF1bhSAU8gqfseUK0h6PTujmm5v3C41PTCl85cQfhttTNJfnu4Kch2 rS9gwt0SlZK56a1EHCE2EK4mAz3DOmORN4K6girzYEHlEi/RXmpi+ItkT1Vhxze2PgBt MtPxSKyCPe+wKBkpYRuQ2zZ0YMuWGjS7WHn7oLcwM56BvnwcFW+kHqPKvM6K7yh5PnYc urhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718242200; x=1718847000; 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=sx46nwLh6y0cuModMm/z+J15eC8XVVvw74Hv/Q7DVvE=; b=k3EsK08PMolb5J2uMiKy2F+nrdviyDxwbb5n2xlid3NhRXnaGuPvWZZ6+YC/FeRDvW v8mhj1Hh7pwEcTrrfgCCT9OP4KpTxwMqbA8xUsubwLf6XQO6unkjt+qMjeFrWrUnFfM1 t65RPcXAiI5CZXqhGTC3EFJSIOAYNKMPRSOQzoOSY23oiRBKxUIOJSWgltug5QKty3sP IMinLX9pvRUUFotB0Twwq9qDJkk/rnZ2W86sS/t6666587BLA+eywAnYK9LDA1FDhKVg 5tFFL71WTv0QSX/VxRwMKLVPfLqiEVuSnqWBA2Jai1ItE+hlWwE/bLpA5i1zdw5bOB1q rO7Q== X-Gm-Message-State: AOJu0YzLFqWV0tbYQobcyYLi8f/PRgHTGDqhLNqi6vwDh2FwhMD+6o1h nxX/Zf+/aujr/CAvJgk28Lq7NnsiSk8rTkJU3952jrqonypoPJSMAUko/sKzgqD8lLsKQrRjzjc moa4+XIfHIXbubfuxMv5lUR/LhaOEeFCVxzn5PTtjqHK5aIKLyHT7GIgBmFrx3pqe4yBbaPOg7H r0N/l3OK11i9JIAtg8t6C43X0H5KKDNfEhUK0= X-Google-Smtp-Source: AGHT+IEmITS+CQS0QJeigLbS7hQQShRngttRzLJuJxiaUiqRaQghIJE781PjUcsjM6nBVj4TtP9p6A== X-Received: by 2002:a17:902:ec83:b0:1f8:3639:653e with SMTP id d9443c01a7336-1f83b6f31e0mr34795585ad.45.1718242199422; Wed, 12 Jun 2024 18:29:59 -0700 (PDT) From: "Fea.Wang" To: qemu-devel@nongnu.org, qemu-riscv@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 v3 2/3] hw/dma: Add a trace log for a description loading failure Date: Thu, 13 Jun 2024 09:35:00 +0800 Message-Id: <20240613013501.426905-3-fea.wang@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240613013501.426905-1-fea.wang@sifive.com> References: <20240613013501.426905-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::634; envelope-from=fea.wang@sifive.com; helo=mail-pl1-x634.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: 1718242302633100001 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 Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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..4c09790f9a 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:%u" 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:54:37 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=1718242273; cv=none; d=zohomail.com; s=zohoarc; b=Yi+jSB7YEznQPWb8yhQEnCaKMqzMSiWEa/UAMdFEMcp7DZX2FTCZvQ+jR4UKdhUpmo9Wa8RwGfSAb/Yn9uNGczRKeVeHmpNW7KmI5ygWNM2G6cm8rqn97FI3wzB2oVDHCYB+pkgVE2iHfpGuprx1P36I0YKBVNOwDi3gGn0/640= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718242273; 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=FAAiqvx38rygy3wevSwl1etyCAIIOAJBBiffllT0VQLqU3g8LVboYweu0907xf0IbUjz03xQ6vBztHsKmt31hBKRpkrVpiDSgmkIZbb2VpOEP0QuvSWDox+8AkPeBhLA8FP22lrbSasRnHqPWsDfopM/1lbDkLDQp6y5S6F/So4= 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 1718242273635803.3330285160529; Wed, 12 Jun 2024 18:31:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sHZI7-00020Y-HX; Wed, 12 Jun 2024 21:30:15 -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 1sHZHy-0001wH-8g for qemu-devel@nongnu.org; Wed, 12 Jun 2024 21:30:09 -0400 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sHZHw-0008I4-62 for qemu-devel@nongnu.org; Wed, 12 Jun 2024 21:30:06 -0400 Received: by mail-pg1-x52f.google.com with SMTP id 41be03b00d2f7-6c4926bf9bbso309264a12.2 for ; Wed, 12 Jun 2024 18:30:03 -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 d9443c01a7336-1f855e723fasm1264155ad.97.2024.06.12.18.30.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 18:30:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1718242202; x=1718847002; 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=Rov1rsbJdg0OSKfC8G/xvxY1dLR7g3pddeG/OKTLoeZrOGHC28wxYRCBaTzLtJZqXi zKS2DILs3rAfBU74LnYz75RKTMTgG3TcWqf64kMmmdoAy38brmrk89m2cOduLeGoPHma D4dCRRJUjYsnqAn6X/bxzpWEFg/BCSqET8qpwOfy93m3H0KIKa51lhXtCo0w0xqHFqXB u/SzIYajWA0M3sz+6wAzdsVH3tgO8qN5bLJz3zX1FP3XNO0Yk2AgvRPmSAObRM7VDTIo C0tDblw1BKho738oZePPEgLmLno5otUqbYYAo5k4Q6fc5Z7h2XHSKX1Ge9e/0O14rFq3 3OUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718242202; x=1718847002; 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=mLgf4aB7QcRIjzgGra1qo+KogwSIKBGb3OdR5kywcdNn8tDhwcIceFoq2Q3IyZT/z7 AJ0Uk1CKTH2xms3ad8pT3cqgNqAxdx6MPTq6kY23nPhC9Fxb9FWJTS6XazJgaPIQgS18 aA9bo9FVk2rB7F/o4L2kE0AzPN9vOaOtk6hW7cFxIT+wgbTAQmcAxhG3qV3s4gdDq8QM 2dk+ZkRKEgBn9Jy7mtgre2MmdVR/tVlcp/xTkinxQvcINNQ+dezCUtymGfCft+GWi/50 pXjgLQPAk9b9FMCd4HqtzYFUCEjhwHk3xrlUtjN/o+eYfePILuZAoNoGIWZLL3lM8b8Z c4Dw== X-Gm-Message-State: AOJu0YyVqlyvL0XeMr4JKf5ispH35cPKXZg8xWaaiOI3kmcenyFUG2ew END2jC+/ohPFlD0jNd+1IgvTbDushqrFFzZJP9dunkFB5XGBdS9EbrutAPBxNPAz504iFoYsVNM +EJD5muZre6wwcw7LvGDD0LuJ0qd22kf3pU5Ru5LSa1KdKJFuBBvEGlSI4qhPH73Nd+dpwfTDit Q0xqZLh4pdcZYo6CykT/n5r76SWWRnLraGsn0= X-Google-Smtp-Source: AGHT+IEIm5KyI5vCn8sVO7D3GSrJORUnbs5AB/aRH/spttJR0DR4FaKE7mCo7Zlx8rJV0IGbVA2H6g== X-Received: by 2002:a05:6a20:43a3:b0:1af:939b:d477 with SMTP id adf61e73a8af0-1b8a9b8dfbamr4030446637.36.1718242202296; Wed, 12 Jun 2024 18:30:02 -0700 (PDT) From: "Fea.Wang" To: qemu-devel@nongnu.org, qemu-riscv@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 v3 3/3] hw/net: Fix the transmission return size Date: Thu, 13 Jun 2024 09:35:01 +0800 Message-Id: <20240613013501.426905-4-fea.wang@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240613013501.426905-1-fea.wang@sifive.com> References: <20240613013501.426905-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::52f; envelope-from=fea.wang@sifive.com; helo=mail-pg1-x52f.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: 1718242274416100009 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