qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
To: qemu-devel@nongnu.org
Cc: damien.hedde@greensocs.com, peter.maydell@linaro.org,
	sstabellini@kernel.org, edgar.iglesias@xilinx.com,
	sai.pavan.boddu@xilinx.com, frasse.iglesias@gmail.com,
	jasowang@redhat.com, alistair@alistair23.me,
	frederic.konrad@adacore.com, qemu-arm@nongnu.org,
	philmd@redhat.com, luc.michel@greensocs.com, figlesia@xilinx.com
Subject: [PATCH v1 8/9] hw/dma/xilinx_axidma: s2mm: Support stream fragments
Date: Thu, 30 Apr 2020 18:24:38 +0200	[thread overview]
Message-ID: <20200430162439.2659-9-edgar.iglesias@gmail.com> (raw)
In-Reply-To: <20200430162439.2659-1-edgar.iglesias@gmail.com>

From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>

Add support for stream fragments.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
---
 hw/dma/xilinx_axidma.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/hw/dma/xilinx_axidma.c b/hw/dma/xilinx_axidma.c
index 101d32a965..87be9cade7 100644
--- a/hw/dma/xilinx_axidma.c
+++ b/hw/dma/xilinx_axidma.c
@@ -110,6 +110,7 @@ struct Stream {
 
     int nr;
 
+    bool sof;
     struct SDesc desc;
     unsigned int complete_cnt;
     uint32_t regs[R_MAX];
@@ -174,6 +175,7 @@ static void stream_reset(struct Stream *s)
 {
     s->regs[R_DMASR] = DMASR_HALTED;  /* starts up halted.  */
     s->regs[R_DMACR] = 1 << 16; /* Starts with one in compl threshold.  */
+    s->sof = true;
 }
 
 /* Map an offset addr into a channel index.  */
@@ -321,12 +323,11 @@ static void stream_process_mem2s(struct Stream *s, StreamSlave *tx_data_dev,
 }
 
 static size_t stream_process_s2mem(struct Stream *s, unsigned char *buf,
-                                   size_t len)
+                                   size_t len, bool eop)
 {
     uint32_t prev_d;
     unsigned int rxlen;
     size_t pos = 0;
-    int sof = 1;
 
     if (!stream_running(s) || stream_idle(s)) {
         return 0;
@@ -352,16 +353,16 @@ static size_t stream_process_s2mem(struct Stream *s, unsigned char *buf,
         pos += rxlen;
 
         /* Update the descriptor.  */
-        if (!len) {
+        if (eop) {
             stream_complete(s);
             memcpy(s->desc.app, s->app, sizeof(s->desc.app));
             s->desc.status |= SDESC_STATUS_EOF;
         }
 
-        s->desc.status |= sof << SDESC_STATUS_SOF_BIT;
+        s->desc.status |= s->sof << SDESC_STATUS_SOF_BIT;
         s->desc.status |= SDESC_STATUS_COMPLETE;
         stream_desc_store(s, s->regs[R_CURDESC]);
-        sof = 0;
+        s->sof = eop;
 
         /* Advance.  */
         prev_d = s->regs[R_CURDESC];
@@ -426,8 +427,7 @@ xilinx_axidma_data_stream_push(StreamSlave *obj, unsigned char *buf, size_t len,
     struct Stream *s = &ds->dma->streams[1];
     size_t ret;
 
-    assert(eop);
-    ret = stream_process_s2mem(s, buf, len);
+    ret = stream_process_s2mem(s, buf, len, eop);
     stream_update_irq(s);
     return ret;
 }
-- 
2.20.1



  parent reply	other threads:[~2020-04-30 16:32 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-30 16:24 [PATCH v1 0/9] hw/core: stream: Add end-of-packet flag Edgar E. Iglesias
2020-04-30 16:24 ` [PATCH v1 1/9] hw/net/xilinx_axienet: Auto-clear PHY Autoneg Edgar E. Iglesias
2020-05-04 15:29   ` Francisco Iglesias
2020-04-30 16:24 ` [PATCH v1 2/9] hw/net/xilinx_axienet: Cleanup stream->push assignment Edgar E. Iglesias
2020-05-04 15:29   ` Francisco Iglesias
2020-05-05 16:30   ` Alistair Francis
2020-04-30 16:24 ` [PATCH v1 3/9] hw/net/xilinx_axienet: Remove unncessary cast Edgar E. Iglesias
2020-05-04 15:30   ` Francisco Iglesias
2020-05-05 16:30   ` Alistair Francis
2020-04-30 16:24 ` [PATCH v1 4/9] hw/dma/xilinx_axidma: Add DMA memory-region property Edgar E. Iglesias
2020-05-04 15:30   ` Francisco Iglesias
2020-05-05 16:32   ` Alistair Francis
2020-04-30 16:24 ` [PATCH v1 5/9] hw/core: stream: Add an end-of-packet flag Edgar E. Iglesias
2020-05-05 14:20   ` Francisco Iglesias
2020-05-05 16:35   ` Alistair Francis
2020-04-30 16:24 ` [PATCH v1 6/9] hw/net/xilinx_axienet: Handle fragmented packets from DMA Edgar E. Iglesias
2020-05-05 14:20   ` Francisco Iglesias
2020-05-05 14:52   ` Edgar E. Iglesias
2020-04-30 16:24 ` [PATCH v1 7/9] hw/dma/xilinx_axidma: mm2s: Stream descriptor by descriptor Edgar E. Iglesias
2020-05-05 19:57   ` Alistair Francis
2020-04-30 16:24 ` Edgar E. Iglesias [this message]
2020-05-05 19:59   ` [PATCH v1 8/9] hw/dma/xilinx_axidma: s2mm: Support stream fragments Alistair Francis
2020-04-30 16:24 ` [PATCH v1 9/9] MAINTAINERS: Add myself as streams maintainer Edgar E. Iglesias
2020-05-05 19:57   ` Alistair Francis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200430162439.2659-9-edgar.iglesias@gmail.com \
    --to=edgar.iglesias@gmail.com \
    --cc=alistair@alistair23.me \
    --cc=damien.hedde@greensocs.com \
    --cc=edgar.iglesias@xilinx.com \
    --cc=figlesia@xilinx.com \
    --cc=frasse.iglesias@gmail.com \
    --cc=frederic.konrad@adacore.com \
    --cc=jasowang@redhat.com \
    --cc=luc.michel@greensocs.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@redhat.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=sai.pavan.boddu@xilinx.com \
    --cc=sstabellini@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).