qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Corvin Köhne" <corvin.koehne@gmail.com>
To: qemu-devel@nongnu.org
Cc: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Alistair Francis" <alistair@alistair23.me>,
	qemu-arm@nongnu.org, "Peter Maydell" <peter.maydell@linaro.org>,
	"Kevin Wolf" <kwolf@redhat.com>,
	qemu-block@nongnu.org, "Corvin Köhne" <c.koehne@beckhoff.com>,
	"Hanna Reitz" <hreitz@redhat.com>,
	"Yannick Voßen" <y.vossen@beckhoff.com>,
	YannickV <Y.Vossen@beckhoff.com>,
	"Edgar E. Iglesias" <edgar.iglesias@amd.com>
Subject: [PATCH v5 03/15] hw/dma/zynq-devcfg: Handle bitstream loading via DMA to 0xffffffff
Date: Thu,  4 Dec 2025 10:34:50 +0100	[thread overview]
Message-ID: <20251204093502.50582-4-corvin.koehne@gmail.com> (raw)
In-Reply-To: <20251204093502.50582-1-corvin.koehne@gmail.com>

From: YannickV <Y.Vossen@beckhoff.com>

A DMA transfer to destination address `0xffffffff` should trigger a
bitstream load via the PCAP interface. Currently, this case is not
intercepted, causing loaders to enter an infinite loop when polling
the status register.

This commit adds a check for `0xffffffff` as the destination address.
If detected, the relevant status register bits (`DMA_DONE`,
`DMA_P_DONE`, and `PCFG_DONE`) are set to indicate a successful
bitstream load. If the address is different, the DMA transfer proceeds
as usual. A successful load is indicated but nothing is actually
done. Guests relying on FPGA functions are still known to fail.

This feature is required for the integration of the Beckhoff
CX7200 model.

Signed-off-by: YannickV <Y.Vossen@beckhoff.com>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
---
 hw/dma/xlnx-zynq-devcfg.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/hw/dma/xlnx-zynq-devcfg.c b/hw/dma/xlnx-zynq-devcfg.c
index 8141d46033..2430d70bf7 100644
--- a/hw/dma/xlnx-zynq-devcfg.c
+++ b/hw/dma/xlnx-zynq-devcfg.c
@@ -247,7 +247,14 @@ static uint64_t r_lock_pre_write(RegisterInfo *reg, uint64_t val)
 static void r_dma_dst_len_post_write(RegisterInfo *reg, uint64_t val)
 {
     XlnxZynqDevcfg *s = XLNX_ZYNQ_DEVCFG(reg->opaque);
-
+    if ((s->regs[R_DMA_DST_ADDR]) == 0xffffffff) {
+        DB_PRINT("bitstream loading detected\n");
+        s->regs[R_INT_STS] |= R_INT_STS_DMA_DONE_MASK |
+                                R_INT_STS_DMA_P_DONE_MASK |
+                                R_INT_STS_PCFG_DONE_MASK;
+        xlnx_zynq_devcfg_update_ixr(s);
+        return;
+    }
     s->dma_cmd_fifo[s->dma_cmd_fifo_num] = (XlnxZynqDevcfgDMACmd) {
             .src_addr = s->regs[R_DMA_SRC_ADDR] & ~0x3UL,
             .dest_addr = s->regs[R_DMA_DST_ADDR] & ~0x3UL,
-- 
2.47.3



  parent reply	other threads:[~2025-12-04  9:37 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-04  9:34 [PATCH v5 00/15] hw/arm: add Beckhoff CX7200 board Corvin Köhne
2025-12-04  9:34 ` [PATCH v5 01/15] hw/timer: Make frequency configurable Corvin Köhne
2025-12-04  9:34 ` [PATCH v5 02/15] hw/timer: Make PERIPHCLK divider configurable Corvin Köhne
2025-12-04  9:34 ` Corvin Köhne [this message]
2025-12-04  9:34 ` [PATCH v5 04/15] hw/arm/zynq-devcfg: Prevent unintended unlock during initialization Corvin Köhne
2025-12-04  9:34 ` [PATCH v5 05/15] hw/dma/zynq: Ensure PCFG_DONE bit remains set to indicate PL is in user mode Corvin Köhne
2025-12-04  9:34 ` [PATCH v5 06/15] hw/dma/zynq-devcfg: Simulate dummy PL reset Corvin Köhne
2025-12-04  9:34 ` [PATCH v5 07/15] hw/dma/zynq-devcfg: Indicate power-up status of PL Corvin Köhne
2025-12-04  9:34 ` [PATCH v5 08/15] hw/misc: Add dummy ZYNQ DDR controller Corvin Köhne
2025-12-04  9:34 ` [PATCH v5 09/15] hw/misc/zynq_slcr: Add logic for DCI configuration Corvin Köhne
2025-12-04  9:34 ` [PATCH v5 10/15] hw/misc: Add Beckhoff CCAT device Corvin Köhne
2025-12-04  9:34 ` [PATCH v5 11/15] hw/block/m25p80: Add HAS_SR_TB flag for is25lp016d Corvin Köhne
2025-12-04  9:34 ` [PATCH v5 12/15] hw/arm/xilinx_zynq: Split xilinx_zynq into header and implementation files Corvin Köhne
2025-12-04  9:35 ` [PATCH v5 13/15] hw/arm/xilinx_zynq: Add flash-type property Corvin Köhne
2025-12-04  9:35 ` [PATCH v5 14/15] hw/arm: Add new machine based on xilinx-zynq-a9 for Beckhoff CX7200 Corvin Köhne
2025-12-04  9:35 ` [PATCH v5 15/15] docs/system/arm: Add support " Corvin Köhne
2025-12-04 10:47 ` [PATCH v5 00/15] hw/arm: add Beckhoff CX7200 board Thomas Huth

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=20251204093502.50582-4-corvin.koehne@gmail.com \
    --to=corvin.koehne@gmail.com \
    --cc=alistair@alistair23.me \
    --cc=c.koehne@beckhoff.com \
    --cc=edgar.iglesias@amd.com \
    --cc=edgar.iglesias@gmail.com \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=y.vossen@beckhoff.com \
    /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).