From nobody Mon Nov 25 05:37:43 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=1717393751; cv=none; d=zohomail.com; s=zohoarc; b=W8V2PN65IK6/SWEDU8w0g1+RSGxtrsfTquIMO6aStoTjvtrk6r722j/u5/gi80yudM4G4ZBiPWI71kcygG8Y2zly0kOD+FsgQykxviz32PjRwAZGrWqBN4F/PRH3Qp7UEKBRB8oclToqaqkqlfBi0DuTBEcdp8sj1tlx2e9WNwM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1717393751; 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=GEhvW8mMXGFmnN1YikczckSrxHyJV9SouAqt0p1mFPM=; b=llahSdrsPiTWQejOj9RPFYrPa4aCmed9A2aFTDraZ+xDbWC8qnGPvlM/0+CXDNbsRDsfHfxXOHj+PRFLM70lbTp0EpMegeUN+9cktavRImHdhRnbJyau5oCOD+UmdRbxGnvhdqdY+JppHztDlOaNcKpYGg3XT3eScCH2B+HSwfA= 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 171739375153999.5822448594364; Sun, 2 Jun 2024 22:49:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sE0Xx-0008Sf-NX; Mon, 03 Jun 2024 01:47:53 -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 1sE0Xw-0008RY-6z for qemu-devel@nongnu.org; Mon, 03 Jun 2024 01:47:52 -0400 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sE0Xt-0005BK-JY for qemu-devel@nongnu.org; Mon, 03 Jun 2024 01:47:51 -0400 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1f47f07aceaso23721075ad.0 for ; Sun, 02 Jun 2024 22:47:49 -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-1f63241e085sm55824135ad.299.2024.06.02.22.47.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 22:47:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1717393668; x=1717998468; 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=GEhvW8mMXGFmnN1YikczckSrxHyJV9SouAqt0p1mFPM=; b=OV7FobpQpqeLVKtgsJn72Byc/xzLgtjGYN+WnypUL0sG5fIMo+0ECDssba+g4AcKTK Jgsolf2cHA+v9u0nGAQYjkiHk/wzvH3/7SvCabVLrRxBABkW6QfVZiFC4vTDBoxhFs5l YzW9M4fD6J4rW7sRx2nMDBZEGW1z0IxlvLN5sgcKz97uYbFHXrurQicKSi7M+WXbIq8R Col/+CO43qqUqDtsW3vbiY+LXLYrQefnAAgZ3lU3cc7RRDUiC5YxId3g3FbAXsFoz8CP 44CBb+hLKvUFCgHKy7ggNepaj9nPSDztk5OpHRzO8jvCuzY5DxFtrn6LALtQp+i53+OW hc2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717393668; x=1717998468; 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=GEhvW8mMXGFmnN1YikczckSrxHyJV9SouAqt0p1mFPM=; b=ZmDxRyNMUg0JAAr0cEUbo06hdKdcRnYwrqozgVjZC6ap1UUltLAbBomZWM2cLUbaPG NE/0x012MeIICHfxeMcqIM9LUQIP3tBhpGF5PwNmlGcIFNGlyXzy5h2h9kiKdBWdadzq JUlh/W5EoBhTgX77bbRgNEzVSjHjpDaEcxYLO2z94neKDDnOM+bzYjFc1cHEUj/9MWVs 9YPj9pGGEUQyz5TXKQF4/YKdngaYE41ogDBHD61AP4PxOQTkBXwL+uX3GiYRfYrdf/jK 0eBXWrnsaotA2LAsqBykFIHTiEru9TALdosPnKY3UkJLro+GpqBzEqYVcIrtI6wrbsKe ELKg== X-Gm-Message-State: AOJu0YxTvBAsxP4+9MhCb4HOTDYyTGPr7n1iOC7DqqFT9XMZyAZN6kOu iRYh1eTdge2AOLRP5t3kByQztiLrVMDg2avqh6vV/yoOgFsEKYso5d7fcECrQJuAqz+TWavw2xO papFLGHNW7wCpYAeBZVlZfhGY5r9o4pJ6bn/k8s/IauxpIhYck5mb1X+lpI/NYk/Zl7pK2z1LdR YHu9jBdlV97qE/M1Ect2mSUMyqp2bnFSAoeE8= X-Google-Smtp-Source: AGHT+IHmdBM6KFnJn5VK2xewRuucEsqZ8fKEK414IFJ+RE/5x+5oq1s2Q8A+zMWE3drGYrCkgzyjgA== X-Received: by 2002:a17:902:ea03:b0:1f4:a45b:8429 with SMTP id d9443c01a7336-1f636ffde39mr95009475ad.27.1717393667593; Sun, 02 Jun 2024 22:47:47 -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" Subject: [PATCH 1/4] hw/dma: Enhance error handling in loading description Date: Mon, 3 Jun 2024 13:52:45 +0800 Message-Id: <20240603055248.3928469-2-fea.wang@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240603055248.3928469-1-fea.wang@sifive.com> References: <20240603055248.3928469-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::630; envelope-from=fea.wang@sifive.com; helo=mail-pl1-x630.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: 1717393753001100007 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 error value. Signed-off-by: Fea.Wang Reviewed-by: Frank Chang --- hw/dma/xilinx_axidma.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/hw/dma/xilinx_axidma.c b/hw/dma/xilinx_axidma.c index 0ae056ed06..4b475e5484 100644 --- a/hw/dma/xilinx_axidma.c +++ b/hw/dma/xilinx_axidma.c @@ -71,8 +71,10 @@ enum { enum { DMASR_HALTED =3D 1, DMASR_IDLE =3D 2, + DMASR_SLVERR =3D 1 << 5, 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 +192,27 @@ 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) { + s->regs[R_DMACR] &=3D ~DMACR_RUNSTOP; + s->regs[R_DMASR] |=3D DMASR_HALTED; + s->regs[R_DMASR] |=3D DMASR_SLVERR; + 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) --=20 2.34.1 From nobody Mon Nov 25 05:37:43 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=1717393750; cv=none; d=zohomail.com; s=zohoarc; b=dxU1rfprQQt9vSRvl1AR5Vh9pE6NIQwLz3JuUBjJtdlqRYRJH1MTvUbLH3ASNG9MqCo7GE6mqEOg0tGe/TivPDTiRDsGIohplqibXYul7h8HJCdsqnz0NqsepYl5Oos/DAyr/VKOTIXwnnJJBGUekZrxsym+GYsC21BvalSLoQM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1717393750; 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=cIMV2nOWBCTz/Oo6LeglZMbxXhMl+MsC5E+aszYQKEM=; b=Gxu7byl5Tf1E7sNgpL2NLQJXi89U7OosPIEcnTwkXGmxMcI/McY5nn+kWKeuR1h78DD/CiyV3H22Clg6X6klgIetHZGxZeyrDlBuXUJjPn+SO7TrkvkOz6KrGAntVGkjqGx7I8qZz0rT/g6a14p6f3e22o+OIrYzCtJoyMqSBYE= 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 1717393750297651.562199241138; Sun, 2 Jun 2024 22:49:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sE0YH-00008q-Ed; Mon, 03 Jun 2024 01:48:13 -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 1sE0YF-000088-K2 for qemu-devel@nongnu.org; Mon, 03 Jun 2024 01:48:11 -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 1sE0YD-0005Hs-3C for qemu-devel@nongnu.org; Mon, 03 Jun 2024 01:48:11 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1f4c7b022f8so36082905ad.1 for ; Sun, 02 Jun 2024 22:48:08 -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-1f63241e085sm55824135ad.299.2024.06.02.22.48.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 22:48:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1717393687; x=1717998487; 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=cIMV2nOWBCTz/Oo6LeglZMbxXhMl+MsC5E+aszYQKEM=; b=ABMpQgkximJF4pdY0/0yqQ4X1Wq55FXsv8VWPfGkbL0/qi5Tg0g+u7DPtYaLbhFTqZ 4j/T5yDY8BJ416mk9DCh7i5/p2QZtXpkpdiiSqBu5Wqu8zNtg1jfik7/OXa9sDX3/ELe A32jh1f96EITmVeyxQ/RXNPLmWlzF5rKg9sJEo1Gu9gDU6BJF1ZssLpntiAmOqECQwdG p5zUdaBOXnd+dYqUAnoTMFtEN+ry89YuYp3fwWgRp11XNiqMldiKnQFqVNYx4pSCvXXf /H0vI8NadFGkwEK0TeXCNTH/wX0JDGMjzeGKn21t02mBdO4uuw7M6waqzH731CWRKKNI ixjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717393687; x=1717998487; 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=cIMV2nOWBCTz/Oo6LeglZMbxXhMl+MsC5E+aszYQKEM=; b=J76HqRg7vlJfYLv/fQORtA6yyx024rl3PEHWsmit5xMvUZfMFBgPjcPP4jLgPpXyV1 sS5sbwl+Exq1sacs60PCR7/tK8b6dEZqSK/JBisIS7h33Tj4op6y1reXXzsR3V+m/qJJ rADNOOjq4IC/535MfMwdMRNjpS3DW3mFUxLh0CUj4M+P7cpwGkwNoSohgX0xunKtctRI 2qvIHHweN57PYZCXtVB6uMP2LcdXnM3pOOSIMchMBAKHHaOhmsnKX9L7XbW0oKtN+vE9 3MNoBM+0Oy51p7PyAGt7Ky5GY6tJYW03lLHDArHAZCuroF3acrRcws4ounqovDunykdu XiQw== X-Gm-Message-State: AOJu0YxoeJi94f6cXIUvjodIDS2gUd0FF0Ivq46xL2XXRvuDjO5a4+85 EN7Dv7L/dYH3ZllKaxcYoDIvmF9vAPrA14Z5GQ9H9YhdAn42WTrrTPwT+uxNEzLkPSK4rHeh099 ScqE2xiJKX/pcolEESdUn3Js5we0Acdzca4sQ835KX5YszddvwM6G3Eg0lKOgRx9PRoIsjrRFYj ryREzp82KN4il3i0JyaSredeSoxRz/K9XoG5o= X-Google-Smtp-Source: AGHT+IG9sR3Lbk0P2DrcGCvVv+0dBNBdvurAmpPa/q3lq8CpggaeU1psBMaEZu7/E42HSZVYjCLTrQ== X-Received: by 2002:a17:903:30cd:b0:1f4:7d47:b889 with SMTP id d9443c01a7336-1f6370209femr66241885ad.30.1717393686959; Sun, 02 Jun 2024 22:48:06 -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" Subject: [PATCH 2/4] hw/dma: Break the loop when loading descriptions fails Date: Mon, 3 Jun 2024 13:52:46 +0800 Message-Id: <20240603055248.3928469-3-fea.wang@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240603055248.3928469-1-fea.wang@sifive.com> References: <20240603055248.3928469-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: 1717393751021100001 Content-Type: text/plain; charset="utf-8" When calling the loading a description function, it should be noticed that the function may return a failure value. Breaking the loop is one of the possible ways to handle it. Signed-off-by: Fea.Wang Reviewed-by: Frank Chang --- hw/dma/xilinx_axidma.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/dma/xilinx_axidma.c b/hw/dma/xilinx_axidma.c index 4b475e5484..b8ab5a423d 100644 --- a/hw/dma/xilinx_axidma.c +++ b/hw/dma/xilinx_axidma.c @@ -291,7 +291,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; @@ -348,7 +350,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 05:37:43 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=1717393721; cv=none; d=zohomail.com; s=zohoarc; b=ZxU+VVJgDGzcL7df17FZF34an//hrD7ClIoY7W3IO3wjgOzT9pI9zIlBWFiOxQ5WliXNkqe02HcgnAv2CL2iESd0CBDZoAYlTGa69LrlyJocgA6LM5rX1eiQ7DHSWq+rHgd6khPjCtXQnzazv8vTv7yDTK1yC3dI6MdK0LoSTR0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1717393721; 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=McpFXNhXQ6r1MNyJ82Ek29bT+aje/zAXSGKXI9ScW+E=; b=U/szbVsr6deidt02dM1EYp+DLVR32JpwmaJOss8NgEJQZnb/fAwmnApGjtB0ZdtShiy7+9xVtjzT/6UKRmfdCXSi+cpWZbGqMRVPV672qjrdPP89SiTqt2VnXeT5wouWOqaYXMYeNjz5gkt7o1e9H0/H6+Ux2JHVv1lkv37AF5c= 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 1717393721211205.72074783871847; Sun, 2 Jun 2024 22:48:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sE0YJ-00009s-GZ; Mon, 03 Jun 2024 01:48: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 1sE0YI-00009P-FW for qemu-devel@nongnu.org; Mon, 03 Jun 2024 01:48:14 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sE0YG-0005MG-1N for qemu-devel@nongnu.org; Mon, 03 Jun 2024 01:48:14 -0400 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1f44b4404dfso34436535ad.0 for ; Sun, 02 Jun 2024 22:48:11 -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-1f63241e085sm55824135ad.299.2024.06.02.22.48.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 22:48:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1717393690; x=1717998490; 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=McpFXNhXQ6r1MNyJ82Ek29bT+aje/zAXSGKXI9ScW+E=; b=d2x3bJtezAPJlffpv73Go8BwCm0pa2ueTI01LKzWRs+cXUuVIXD8JbtMtwV9dFbBVo 0c0QRVN7nqRQXrhZYwXxQD2pXexPrVJEtUnOhBXd7b5Wc5xnt1vZ7qzQlfgff3tpI+h+ c35t3Mdo8DnvdvBIFtWwrQnFDbuu50Hwl1aOj4noWBbAYL1FSgMyCGZiJJ6K5UnKUNgx fYKFREbUz9ReRHRHI0Px0CmnluBeul2q+Bt6Aniq4DkTTXiyTCjdndBlWtUSDjGx5zU8 VuyVvTqBxuMuGmZ+D4DVhd4bhQ4V8KfvO/7TgUjha3sgGmmri3HCut7daMd5hyonSnR5 95FQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717393690; x=1717998490; 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=McpFXNhXQ6r1MNyJ82Ek29bT+aje/zAXSGKXI9ScW+E=; b=aOg0HItTpe8k04TDJ3bFwO+ine+0taUJS2lC5dYA4sn2Nm9ihi8mClvkePgzyrmzKJ +nhqcD7O0HerBEkzm5qM6t2Dch5d1rVya98EEPQo6QHsWGMZ/pFvJiydB/k29cRatni1 SOTV1ENOqn4VEtGrgvISRJfH7/PUrsA9izBU0X3QPsaZe7+t5l+4FcvI59BjhQJpso7p IGYCFJjuI9W2wySc8nAUmk37Y89iZ39ObFe4c+8pH94usiCVTZ03sGGtYZ6CKSsarKef lwil0JinMrvlClXxWo0PMlNCiTtV87zOJihjTPysgvaBpsyKpN9e6h579qB1ChyfZzuC spJg== X-Gm-Message-State: AOJu0YyixrhMI1WBjntVJE+SChqfiZ3R0ZD9FXljxPpR61ecrRMAhPdp 2NdhmizaJiIp8gvabp+KxE6Moyw11+CO8B6vTk4RMIn1HvjzQElaMX4Lnc4Hod8ELHFUQ6Oa/wY pLvb3nowFI+6B2mntFd4bHHuewlQWBLq3X5zEJ3LZ8ERlis+Hi4IRRG9Y4Gy9p8pecKBIiZBA4s u2ej90sXsTL3VrOe8sMXzdLagZNxb4u8YGw4o= X-Google-Smtp-Source: AGHT+IFR1U1ZOSOfadGguID18mp4TvEKbUOV/xOfXx08gTjQJyS2skjFsgpd7XSyiLQKEW4NXgp/Kw== X-Received: by 2002:a17:902:c40f:b0:1f3:121e:e3de with SMTP id d9443c01a7336-1f636fdebbfmr92073695ad.14.1717393690275; Sun, 02 Jun 2024 22:48:10 -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" Subject: [PATCH 3/4] hw/dma: Add a trace log for a description loading failure Date: Mon, 3 Jun 2024 13:52:47 +0800 Message-Id: <20240603055248.3928469-4-fea.wang@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240603055248.3928469-1-fea.wang@sifive.com> References: <20240603055248.3928469-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::636; envelope-from=fea.wang@sifive.com; helo=mail-pl1-x636.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: 1717393723076100003 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 b8ab5a423d..1bbb9d6c4c 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 @@ -200,6 +201,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); + s->regs[R_DMACR] &=3D ~DMACR_RUNSTOP; s->regs[R_DMASR] |=3D DMASR_HALTED; s->regs[R_DMASR] |=3D DMASR_SLVERR; --=20 2.34.1 From nobody Mon Nov 25 05:37:43 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=1717393763; cv=none; d=zohomail.com; s=zohoarc; b=aKAIUw0qHNFCWCyu6XBRNNgkYQ6/GK0iuSe+teA4mQ57ebEL/G+X+3bgG3NKtoPdbI3uwNU4E2AVHG4UdH+iblBfDd/Rs1qPiERb5AnLhvxv0YOWOxiUHdDoQUZzX6B6Bj2FhR31Ks/5KuOp13ZCEt1ewVdY8PzEmuzEXUUvKwI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1717393763; 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=GVZpJhKtEcd9YCJGkGQF9gaW6VhHFLErv6FyXahbmsc=; b=lpSHvh7UYzqONfG5CmILG34iliEC5V1D5AeDM7bRZWWTlkzO7Nz14/5dBY8cQSphljAsnB/Tz67YDkm3YYVOahVck/TQBSmIv4XKhK585C7aNtZWfTGjUmpTp0TESLlKwufkQNMmnW66Jw+C2wPA2Zl43RW8OuW2TJOCONgMKxo= 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 1717393763079842.3579061571754; Sun, 2 Jun 2024 22:49:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sE0YL-0000BT-84; Mon, 03 Jun 2024 01:48:17 -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 1sE0YK-0000B9-C0 for qemu-devel@nongnu.org; Mon, 03 Jun 2024 01:48:16 -0400 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sE0YI-0005OH-Sq for qemu-devel@nongnu.org; Mon, 03 Jun 2024 01:48:16 -0400 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1f62fae8c1aso24071915ad.3 for ; Sun, 02 Jun 2024 22:48:14 -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-1f63241e085sm55824135ad.299.2024.06.02.22.48.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 22:48:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1717393693; x=1717998493; 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=GVZpJhKtEcd9YCJGkGQF9gaW6VhHFLErv6FyXahbmsc=; b=DtdQalAwp3XkTppTR1nIifPAc7lC7PDZiJeVE07pXmA+CGa0cMTIvfBQbgA9XXZu9C GqHXtXB8JgU5ShZLZCdVIRb2HdxdQb5VzZ9u/0VK1XK6BNgjqEVIhfSLfkXZq47lLBwM z63zjrwJ/dkr8yWEwKEcN9IPa6Lb2PPaer6zHcq1/axOHlDqy+HYd+WZN86qd8PFoM6y lUCv1bC8wkAmYIzQGzoppTbN1Ao7wIuLc2qqdz7Pjvb8srdCSdPyIqn1up3wC0KrgVia p8pyhokf9JyuMZEz+VjExw1KGDYb16TstlsQI+omQpIWTTDg9LSudc4UxUaRPBqAlHrJ E6mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717393693; x=1717998493; 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=GVZpJhKtEcd9YCJGkGQF9gaW6VhHFLErv6FyXahbmsc=; b=aob6qz7VoTMUFC+dhkAYV7GXhHVQeXlB1fiZAU4ixPZUV/yJ2xZPqhZaJE3RTRuuYO ERk3UXwC/x+gz1zfwVFy7MnzB4PJ8M6Esn0MQuGoF3mqBC6FF994xNlpSpAGsdOFLyuF W6DNdb3EYmNy9dVKsQaohbAilSguJSoDHU5EjcWpycluQWW3Zc1EyrGptvM+7bSDNs52 AWHjrTZ2NQnkD/5eksBzX+C21T6v0ydPl0atUUplpzFnvZV7MBa2Gj3Go/1B6kRIX7oF Fee/b1Ss7Ws2Wt4No9Db8u8IcdqNLa07Pe9UQae1wapOeLI2o2nOpXiE/E+2sKvak4fW hM2g== X-Gm-Message-State: AOJu0YzD6VogInyun3bgjR//uR4Vs5RynIqBGDpK0NGLauj3Eza75ptu JY4rCSnDq6xXgv09JilC0pLNcNBKC5R7+AyxaFmDLhxA1p7Nu60wa2RELGm/e8wO61qT6Aw1ua2 UlrWibZv3J99qQyZ8sV0KMMWOk7X/PyCLJSAam3GfLPeeYjYQxRlULfG2bU6ajkABZkTwpks/tC k+lp6VaGtSP3ZPYTM8IfpEQNr0mIDhVS3qhwU= X-Google-Smtp-Source: AGHT+IF/NhAHUv5NOzJAxHVrM0NCdw27QFO4bXQgcjKCUBHyY61JMxxZUcQGLtEgnjIVyb5Iua3rDg== X-Received: by 2002:a17:902:f908:b0:1f4:8faa:cd68 with SMTP id d9443c01a7336-1f63702346cmr69194085ad.29.1717393693229; Sun, 02 Jun 2024 22:48:13 -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" Subject: [PATCH 4/4] hw/net: Fix the transmission return size Date: Mon, 3 Jun 2024 13:52:48 +0800 Message-Id: <20240603055248.3928469-5-fea.wang@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240603055248.3928469-1-fea.wang@sifive.com> References: <20240603055248.3928469-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::630; envelope-from=fea.wang@sifive.com; helo=mail-pl1-x630.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: 1717393765045100003 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