From nobody Sat May 30 18:35:07 2026 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1778669807; cv=none; d=zohomail.com; s=zohoarc; b=QtywZCgczT3UNCq3YfdFA76TsVHOOLWPZmtk2Ze2RFy/HtcvNPsT/FNq3nqjnGi1d0aaPmTIPMtuZfE7sIHeNcaPKplJrZ29ci2Ykc2W3UX7abgyjjnh4SLb9NkW+3IVX6TaT3wcHz0z9WvL+vTNFx1mrU1N74x4D4gtZwQ7zHE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1778669807; 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=Aoto7sWRwkvdYQ7EeipOLEozah24d4tm9ReeE9yn5cE=; b=it2eY9myhZRD5SCQerBNiyHzK4NeFsiF4iZ1o6/ELFgKY1rgVJLhSFhy5XOHOLHxxOE7hqYhRIQq6dX/mSrt0mwJhEirH2Ex/ZFy5A1sO4QSsCNSfCSAzNHdQknlkF0WiMfSE8gPhDUqi+QnM4TEK+3BGrugSv/jcrQ3MUYrqpU= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 177866980768852.88557141907779; Wed, 13 May 2026 03:56:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wN7Fr-0003F4-Rf; Wed, 13 May 2026 06:55:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wN7FX-00037z-9l for qemu-devel@nongnu.org; Wed, 13 May 2026 06:55:39 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wN7FO-0001Mw-Ih for qemu-devel@nongnu.org; Wed, 13 May 2026 06:55:31 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-48896199cbaso58377475e9.1 for ; Wed, 13 May 2026 03:55:21 -0700 (PDT) Received: from PC-DA2D10.beckhoff.com ([195.226.174.196]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48e8f410d9fsm56062295e9.6.2026.05.13.03.55.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2026 03:55:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778669721; x=1779274521; 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=Aoto7sWRwkvdYQ7EeipOLEozah24d4tm9ReeE9yn5cE=; b=UIQ67yTUasNV7UXQ6hJfDxgVE5Bdt2VI4UxKOpryYqoBvo0W3kpXjphpXkeG+mXmfR QM/K4fojzNhzaIEZfo8wCcNuSs7GIdpVw6PyM5VC1a8iNqYvKOV54Thf6Ce81q3xRg0v NziJYYjzSyWcN9I+V4iani3aayT0xbsWoz5q1Kmx5C+VagBwhKsS3AD1AWJfqeYFi+LJ 99Qw3pN5oTyiS0RcwdxkDW0OqP1I+HiDIdUFHhaGodosPIPN3A8uth7C1wvdL3B3NrkB dYJ0Px30W5LP3tFBX/MgmEgJbnG4hsvUyfH3wzHyRiGWWc3z1/SdQmEUM6GKBquNvGs8 pbuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778669721; x=1779274521; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Aoto7sWRwkvdYQ7EeipOLEozah24d4tm9ReeE9yn5cE=; b=pChuBfyQYSdwmZniDSj2k+MDQT4/ag8FIZCBXxhJgJRzNy+TLNXfm9Av6K8usVmJ2N r3PKGjyc1PhHDLgPuEcP8G0xNf1rtfHmw7sF61uXfdXgetmD66wL4hVCTWvP4wkAE5dH BgQLQxzjH5W4mI1qNv7Mg5x+V6MrqQy5Ks1pt2awbrrtfHE689XyxYaxZI5MZ0gVbJfM fFJkqeCgAZXboX+XyPMFfCi29Dd7nlxbTnE/1DJ274dFKxKZz8Ccey757kBdhnmoqVbK pdzW3w0dg24KaD0jVs9MsQtzFvMrdXF4jE5GcXjc9Auu12YkMlprrEQrz6vEJoZNAud3 t8TA== X-Gm-Message-State: AOJu0Yxlicj/4SqWR1a94MDgV91Lou0OrwPgJGTO7+Cg7pe5J1X9sY7L 0nEWGS0SzrnBuILZCvfqEilT8+HVyvwIcZVtOupj2F6i9M/6L2Sz2hvKjlX8xByl X-Gm-Gg: Acq92OGKa6pB5A6BfqfOXPVDI7KUA+nRe0cZh463bQ+pkzyXGuPKZBcDU82YVAMdj7l rwkLV6wszhZzisTmX8ufU9rgqEdS1IpFLXfWx1jhwPxwEWadXhxqNwxsKq+PMv3RIaE5mEOMwX/ NfLeEcZB8Tbed01XAP1MFQ3zEb74hMDPW5hvDb31+g/BzzH0u80Z6UDqI5h6l35314B5UxrZt9J brkgnYqVCA/UOBhSqyK/A8m+wG5bfP9oKJk19z0Iet9D3j6Utn3sGHlkQwfxGwjUyP01um/fmmx nIUeXRv8S/vqmN0dE138sgm5OiWI+wNAmBxLqTp78j5oL1hbfgUHs5e/Wi5Ni1aRzD0IJ2Hfv6f mnN277hWMsC/kM8bp9HMBhf45BtLdPbZWPLTxvU4tZSoVWX3Ok5M64OMRFRWCLNU2ZMPddjj8/R bLHPlMem2BYnIGdxqTGlHwYOQ7o3S9MHyO9j9ZeVgRHYxh X-Received: by 2002:a05:600c:3107:b0:48a:89d9:a419 with SMTP id 5b1f17b1804b1-48fc9a09fedmr39022605e9.11.1778669720593; Wed, 13 May 2026 03:55:20 -0700 (PDT) From: =?UTF-8?q?Corvin=20K=C3=B6hne?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Hanna Reitz , Kevin Wolf , qemu-arm@nongnu.org, =?UTF-8?q?Corvin=20K=C3=B6hne?= , Peter Maydell , Paolo Bonzini , Pierrick Bouvier , =?UTF-8?q?Yannick=20Vo=C3=9Fen?= , Alistair Francis , "Edgar E. Iglesias" , YannickV Subject: [PATCH v6 01/15] hw/timer: Make frequency configurable Date: Wed, 13 May 2026 12:55:03 +0200 Message-ID: <20260513105517.146706-2-corvin.koehne@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260513105517.146706-1-corvin.koehne@gmail.com> References: <20260513105517.146706-1-corvin.koehne@gmail.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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=corvin.koehne@gmail.com; helo=mail-wm1-x336.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @gmail.com) X-ZM-MESSAGEID: 1778669810394158500 Content-Type: text/plain; charset="utf-8" From: YannickV The a9 global timer and arm mp timers rely on the PERIPHCLK as their clock source. The current implementation does not take that into account. That causes problems for applications assuming other frequencies than 1 GHz. We can now configure frequencies for the a9 global timer and arm mp timer. By allowing these values to be set according to the application's needs, we ensure that the timers behave consistently with the expected system configuration. The SoC configures the device correctly. Information can be found in the Zynq 7000 SoC Technical Reference Manual under Timers. https://docs.amd.com/r/en-US/ug585-zynq-7000-SoC-TRM Signed-off-by: YannickV Reviewed-by: Peter Maydell --- hw/timer/a9gtimer.c | 9 ++++++--- hw/timer/arm_mptimer.c | 15 +++++++++++---- include/hw/timer/a9gtimer.h | 1 + include/hw/timer/arm_mptimer.h | 2 ++ 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/hw/timer/a9gtimer.c b/hw/timer/a9gtimer.c index 3a086915c8..699cea8c89 100644 --- a/hw/timer/a9gtimer.c +++ b/hw/timer/a9gtimer.c @@ -63,9 +63,9 @@ static inline int a9_gtimer_get_current_cpu(A9GTimerState= *s) static inline uint64_t a9_gtimer_get_conv(A9GTimerState *s) { uint64_t prescale =3D extract32(s->control, R_CONTROL_PRESCALER_SHIFT, - R_CONTROL_PRESCALER_LEN); - - return (prescale + 1) * 10; + R_CONTROL_PRESCALER_LEN) + 1; + uint64_t scaled_prescaler =3D prescale * 10; + return muldiv64(scaled_prescaler, NANOSECONDS_PER_SECOND, s->freq_hz); } =20 static A9GTimerUpdate a9_gtimer_get_update(A9GTimerState *s) @@ -374,6 +374,9 @@ static const VMStateDescription vmstate_a9_gtimer =3D { }; =20 static const Property a9_gtimer_properties[] =3D { + /* Default clock-frequency is 1GHz (NANOSECONDS_PER_SECOND) */ + DEFINE_PROP_UINT64("clock-frequency", A9GTimerState, freq_hz, + NANOSECONDS_PER_SECOND), DEFINE_PROP_UINT32("num-cpu", A9GTimerState, num_cpu, 0), }; =20 diff --git a/hw/timer/arm_mptimer.c b/hw/timer/arm_mptimer.c index 88158144b2..f67f26ad9a 100644 --- a/hw/timer/arm_mptimer.c +++ b/hw/timer/arm_mptimer.c @@ -59,9 +59,11 @@ static inline void timerblock_update_irq(TimerBlock *tb) } =20 /* Return conversion factor from mpcore timer ticks to qemu timer ticks. = */ -static inline uint32_t timerblock_scale(uint32_t control) +static inline uint32_t timerblock_scale(TimerBlock *tb, uint32_t control) { - return (((control >> 8) & 0xff) + 1) * 10; + uint64_t prescale =3D (((control >> 8) & 0xff) + 1); + uint64_t scaled_prescaler =3D prescale * 10; + return muldiv64(scaled_prescaler, NANOSECONDS_PER_SECOND, tb->freq_hz); } =20 /* Must be called within a ptimer transaction block */ @@ -155,7 +157,7 @@ static void timerblock_write(void *opaque, hwaddr addr, ptimer_stop(tb->timer); } if ((control & 0xff00) !=3D (value & 0xff00)) { - ptimer_set_period(tb->timer, timerblock_scale(value)); + ptimer_set_period(tb->timer, timerblock_scale(tb, value)); } if (value & 1) { uint64_t count =3D ptimer_get_count(tb->timer); @@ -222,7 +224,8 @@ static void timerblock_reset(TimerBlock *tb) ptimer_transaction_begin(tb->timer); ptimer_stop(tb->timer); ptimer_set_limit(tb->timer, 0, 1); - ptimer_set_period(tb->timer, timerblock_scale(0)); + ptimer_set_period(tb->timer, + timerblock_scale(tb, tb->control)); ptimer_transaction_commit(tb->timer); } } @@ -269,6 +272,7 @@ static void arm_mptimer_realize(DeviceState *dev, Error= **errp) */ for (i =3D 0; i < s->num_cpu; i++) { TimerBlock *tb =3D &s->timerblock[i]; + tb->freq_hz =3D s->freq_hz; tb->timer =3D ptimer_init(timerblock_tick, tb, PTIMER_POLICY); sysbus_init_irq(sbd, &tb->irq); memory_region_init_io(&tb->iomem, OBJECT(s), &timerblock_ops, tb, @@ -301,6 +305,9 @@ static const VMStateDescription vmstate_arm_mptimer =3D= { }; =20 static const Property arm_mptimer_properties[] =3D { + /* Default clock-frequency is 1GHz (NANOSECONDS_PER_SECOND) */ + DEFINE_PROP_UINT64("clock-frequency", ARMMPTimerState, freq_hz, + NANOSECONDS_PER_SECOND), DEFINE_PROP_UINT32("num-cpu", ARMMPTimerState, num_cpu, 0), }; =20 diff --git a/include/hw/timer/a9gtimer.h b/include/hw/timer/a9gtimer.h index 5c9b048b95..571c05f638 100644 --- a/include/hw/timer/a9gtimer.h +++ b/include/hw/timer/a9gtimer.h @@ -76,6 +76,7 @@ struct A9GTimerState { =20 MemoryRegion iomem; /* static props */ + uint64_t freq_hz; uint32_t num_cpu; =20 QEMUTimer *timer; diff --git a/include/hw/timer/arm_mptimer.h b/include/hw/timer/arm_mptimer.h index 4c6f569631..93ae532c9a 100644 --- a/include/hw/timer/arm_mptimer.h +++ b/include/hw/timer/arm_mptimer.h @@ -31,6 +31,7 @@ typedef struct { uint32_t control; uint32_t status; struct ptimer_state *timer; + uint64_t freq_hz; qemu_irq irq; MemoryRegion iomem; } TimerBlock; @@ -43,6 +44,7 @@ struct ARMMPTimerState { SysBusDevice parent_obj; /*< public >*/ =20 + uint64_t freq_hz; uint32_t num_cpu; TimerBlock timerblock[ARM_MPTIMER_MAX_CPUS]; MemoryRegion iomem; --=20 2.47.3 From nobody Sat May 30 18:35:07 2026 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1778669859; cv=none; d=zohomail.com; s=zohoarc; b=BWyrVoSshJTWQON9ipX7eWy+JwWOWNoK6Ihof2UjgbP6lfNheKooyd+EL4VWJKSMF5Xsy1OcIdT/lQI8NIjrNqLf2Vebt6rNYO7ChSvmTF4QYxDJcBQRqMB61Bdc5s5N/qlOGJ9dutd2OjBIV8fgQcx59EX3YNUw5M01QOcHVRU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1778669859; h=Content-Type: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=XTomJ8d/soqsaSE8O3gG0DgzgBSQSKl73BuiKRWsZCc=; b=f4mFZzC5w+ZpK1fo1ob/R25mR/1QVByVdkIpufSm+lrsvTH4kBXiEsXJmHLjKRtlhBQvdD68uxXXcOYKKK+YgbM77/fl/Nw+PJwrUpoNax2yO1No/ogi/FUyQIk5/OA5aU10/aYLT19CZWH2V+6alBxKXGGig3mdj7WUQZkdsV0= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1778669859370872.1353289073171; Wed, 13 May 2026 03:57:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wN7Gv-0003fZ-PA; Wed, 13 May 2026 06:57:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wN7FX-00037v-6j for qemu-devel@nongnu.org; Wed, 13 May 2026 06:55:39 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wN7FO-0001NJ-Ig for qemu-devel@nongnu.org; Wed, 13 May 2026 06:55:33 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-48a563e4ef7so60389995e9.0 for ; Wed, 13 May 2026 03:55:23 -0700 (PDT) Received: from PC-DA2D10.beckhoff.com ([195.226.174.196]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48e8f410d9fsm56062295e9.6.2026.05.13.03.55.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2026 03:55:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778669722; x=1779274522; 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=XTomJ8d/soqsaSE8O3gG0DgzgBSQSKl73BuiKRWsZCc=; b=Mh3gPyYakQ+f95pC1tRiWpDTjCZ9gC9WRpWzIxqEx24RcCOAwflWduiE74UnZgCue1 IpoULZUR8wYufZ1ZJL2GdFQA82CwGRmIK+zi7OYT61dlF/XpirP7uLdKvXqen25LT/rq 27pivVYijgHdn9FVgUhhKq7MHZkRWml9QYbWRUsCtrwzXfscNrWAr/b9QUehtEd8TbBD UMY6WUsv6qtRshhnA1mjgI1bZSRtn1TaumKB62J7/1CNkO9yl7fv3lAo7J4zbMXo4jtE ATvld/nwD9VsOAlFiv8f7WjAw83kq0StpEpDb1M+iHdZJx+o9d2E0bKgGU16EI4of1PW /BDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778669722; x=1779274522; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=XTomJ8d/soqsaSE8O3gG0DgzgBSQSKl73BuiKRWsZCc=; b=VXKq/LSj0XzQpJRA7xqvRFDlBHM3wGcoLuka6yhMz7pSv7HFqPLr1f+PLquipiXq19 3LuEwYLVh2LRqwHMRNLmsE8ljxMYcRbJl5HIiQ/5ZlkbIrSHg/RoDKW9ngffuL0KYv9E i/81kuoEHFqfX1W7ykAQDQymnmFpGAFgz5Yvj5Gb6MgRD5khTi5umbjgnYyu6cKSJHLe L+XVRvDG+sI4Qxqp+8wM23LvPXrQn08LnoRktw+NACFYIyHilQWC3i2SzAmeSclXI0mH EEfcY4IywMcExQRA0oYK0tdnFxyptTeR2/WJQB/y1pkhC7IonrpeqRQiaeVyzlaABIrb wudQ== X-Gm-Message-State: AOJu0YxyZQB00m0OqgiF+I7d6HmEB18zfp/eOuJDs/vxa5B/ZXa044DD QB9z7Z5csjBwwTzGY6tG7uB2MCxZyDRbW4ReGuyEC5ouZ+sAjjU5rwK1RmeTkxPx X-Gm-Gg: Acq92OHj3jL8ZPgCWsdPaZVN8dsqPX99ekWTa/yPXeOYBwWDTNKMV2090xZfL1jJ6LR 5yR3LXBToamqg7v2b85JyfggEOAaKdgx3vN9/TefSri3K02+mZSFsPEW0JhhMRqufMdTPQ7eC6T l5fhX2rLMXZFAtte0Kx2L4uO/j3sLQT0x8Cuzx6EArP/QNiWebqs3/D8t6zA8r1Dv8jjnvXS3bf eZv7u8ndvNfvcYoADoIc2ycTtDDuuXvYk5nuxiCJVDngXBFscFqd/hYNXAehk0MZNPJ+dQBtTS8 LmKEtxaUIkaSoJVBEoifwXKtE0E4P9HFkHxzh2g3vgOPPKB6Tx9149yjCSqwlTQp0aTj4iuYDBi sRh+M3SLJj+4fAFQ8VseS7HO/LQb7CNMXAs8MEcdQTguL1jn2PNLTl5wtmqhN56dsJ/oCTuK1mB TezXGB8JbQrtBW5HYgiK8Y/ya3NP+/arU9kK5q6zVPHNkO X-Received: by 2002:a05:600c:5397:b0:48a:7aad:4425 with SMTP id 5b1f17b1804b1-48fc9a089c8mr34237715e9.3.1778669721779; Wed, 13 May 2026 03:55:21 -0700 (PDT) From: =?UTF-8?q?Corvin=20K=C3=B6hne?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Hanna Reitz , Kevin Wolf , qemu-arm@nongnu.org, =?UTF-8?q?Corvin=20K=C3=B6hne?= , Peter Maydell , Paolo Bonzini , Pierrick Bouvier , =?UTF-8?q?Yannick=20Vo=C3=9Fen?= , Alistair Francis , "Edgar E. Iglesias" , YannickV , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v6 02/15] hw/timer: Make PERIPHCLK divider configurable Date: Wed, 13 May 2026 12:55:04 +0200 Message-ID: <20260513105517.146706-3-corvin.koehne@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260513105517.146706-1-corvin.koehne@gmail.com> References: <20260513105517.146706-1-corvin.koehne@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=corvin.koehne@gmail.com; helo=mail-wm1-x32e.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: qemu development 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 @gmail.com) X-ZM-MESSAGEID: 1778669860348158500 From: YannickV The A9 global timer and ARM MP timer use PERIPHCLK as their clock source. The frequency of PERIPHCLK is derived by dividing the main clock (CLK) by a configurable divider (must be at least 2). Previously, the PERIPHCLK divider was not configurable, which could lead to unexspected behavior if the application exspected a different PERIPHCLK rate. The property periphclk-divider specifies by which value the main clock is divided to generate PERIPHCLK. This allows flexible configuration of the timer clocks to match application requirements. Information can be found in the Zynq 7000 Soc Technical Reference Manual under Timers. https://docs.amd.com/r/en-US/ug585-zynq-7000-SoC-TRM Signed-off-by: YannickV Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/timer/a9gtimer.c | 19 ++++++++++++++++++- hw/timer/arm_mptimer.c | 19 ++++++++++++++++++- include/hw/timer/a9gtimer.h | 1 + include/hw/timer/arm_mptimer.h | 2 ++ 4 files changed, 39 insertions(+), 2 deletions(-) diff --git a/hw/timer/a9gtimer.c b/hw/timer/a9gtimer.c index 699cea8c89..5fb3aa6c77 100644 --- a/hw/timer/a9gtimer.c +++ b/hw/timer/a9gtimer.c @@ -27,6 +27,7 @@ #include "hw/timer/a9gtimer.h" #include "migration/vmstate.h" #include "qapi/error.h" +#include "qemu/error-report.h" #include "qemu/timer.h" #include "qemu/bitops.h" #include "qemu/log.h" @@ -62,9 +63,17 @@ static inline int a9_gtimer_get_current_cpu(A9GTimerStat= e *s) =20 static inline uint64_t a9_gtimer_get_conv(A9GTimerState *s) { + /* + * Referring to the ARM-Cortex-A9 MPCore TRM + * + * The a9 global timer relies on the PERIPHCLK as its clock source. + * The PERIPHCLK clock period must be configured as a multiple of the + * main clock CLK. The conversion from the qemu clock (1GHz) to a9 + * gtimer ticks can be calculated like this: + */ uint64_t prescale =3D extract32(s->control, R_CONTROL_PRESCALER_SHIFT, R_CONTROL_PRESCALER_LEN) + 1; - uint64_t scaled_prescaler =3D prescale * 10; + uint64_t scaled_prescaler =3D prescale * s->periphclk_divider; return muldiv64(scaled_prescaler, NANOSECONDS_PER_SECOND, s->freq_hz); } =20 @@ -312,6 +321,12 @@ static void a9_gtimer_realize(DeviceState *dev, Error = **errp) sysbus_init_mmio(sbd, &s->iomem); s->timer =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, a9_gtimer_update_no_sync= , s); =20 + if (s->periphclk_divider < 2) { + error_setg(errp, "Invalid periphclk-divider (%lu), must be >=3D 2", + s->periphclk_divider); + return; + } + for (i =3D 0; i < s->num_cpu; i++) { A9GTimerPerCPU *gtb =3D &s->per_cpu[i]; =20 @@ -378,6 +393,8 @@ static const Property a9_gtimer_properties[] =3D { DEFINE_PROP_UINT64("clock-frequency", A9GTimerState, freq_hz, NANOSECONDS_PER_SECOND), DEFINE_PROP_UINT32("num-cpu", A9GTimerState, num_cpu, 0), + DEFINE_PROP_UINT64("periphclk-divider", A9GTimerState, + periphclk_divider, 10), }; =20 static void a9_gtimer_class_init(ObjectClass *klass, const void *data) diff --git a/hw/timer/arm_mptimer.c b/hw/timer/arm_mptimer.c index f67f26ad9a..6a5bc62422 100644 --- a/hw/timer/arm_mptimer.c +++ b/hw/timer/arm_mptimer.c @@ -27,6 +27,7 @@ #include "hw/timer/arm_mptimer.h" #include "migration/vmstate.h" #include "qapi/error.h" +#include "qemu/error-report.h" #include "qemu/module.h" #include "hw/core/cpu.h" =20 @@ -61,8 +62,16 @@ static inline void timerblock_update_irq(TimerBlock *tb) /* Return conversion factor from mpcore timer ticks to qemu timer ticks. = */ static inline uint32_t timerblock_scale(TimerBlock *tb, uint32_t control) { + /* + * Referring to the ARM-Cortex-A9 MPCore TRM + * + * The arm mp timer relies on the PERIPHCLK as its clock source. + * The PERIPHCLK clock period must be configured as a multiple of the + * main clock CLK. The conversion from the qemu clock (1GHz) to arm mp + * timer ticks can be calculated like this: + */ uint64_t prescale =3D (((control >> 8) & 0xff) + 1); - uint64_t scaled_prescaler =3D prescale * 10; + uint64_t scaled_prescaler =3D prescale * tb->periphclk_divider; return muldiv64(scaled_prescaler, NANOSECONDS_PER_SECOND, tb->freq_hz); } =20 @@ -273,6 +282,12 @@ static void arm_mptimer_realize(DeviceState *dev, Erro= r **errp) for (i =3D 0; i < s->num_cpu; i++) { TimerBlock *tb =3D &s->timerblock[i]; tb->freq_hz =3D s->freq_hz; + if (s->periphclk_divider < 2) { + error_setg(errp, "Invalid periphclk-divider (%lu), must be >= =3D 2", + s->periphclk_divider); + return; + } + tb->periphclk_divider =3D s->periphclk_divider; tb->timer =3D ptimer_init(timerblock_tick, tb, PTIMER_POLICY); sysbus_init_irq(sbd, &tb->irq); memory_region_init_io(&tb->iomem, OBJECT(s), &timerblock_ops, tb, @@ -309,6 +324,8 @@ static const Property arm_mptimer_properties[] =3D { DEFINE_PROP_UINT64("clock-frequency", ARMMPTimerState, freq_hz, NANOSECONDS_PER_SECOND), DEFINE_PROP_UINT32("num-cpu", ARMMPTimerState, num_cpu, 0), + DEFINE_PROP_UINT64("periphclk-divider", ARMMPTimerState, + periphclk_divider, 10), }; =20 static void arm_mptimer_class_init(ObjectClass *klass, const void *data) diff --git a/include/hw/timer/a9gtimer.h b/include/hw/timer/a9gtimer.h index 571c05f638..1c65cec914 100644 --- a/include/hw/timer/a9gtimer.h +++ b/include/hw/timer/a9gtimer.h @@ -77,6 +77,7 @@ struct A9GTimerState { MemoryRegion iomem; /* static props */ uint64_t freq_hz; + uint64_t periphclk_divider; uint32_t num_cpu; =20 QEMUTimer *timer; diff --git a/include/hw/timer/arm_mptimer.h b/include/hw/timer/arm_mptimer.h index 93ae532c9a..6eb0cedc90 100644 --- a/include/hw/timer/arm_mptimer.h +++ b/include/hw/timer/arm_mptimer.h @@ -32,6 +32,7 @@ typedef struct { uint32_t status; struct ptimer_state *timer; uint64_t freq_hz; + uint64_t periphclk_divider; qemu_irq irq; MemoryRegion iomem; } TimerBlock; @@ -45,6 +46,7 @@ struct ARMMPTimerState { /*< public >*/ =20 uint64_t freq_hz; + uint64_t periphclk_divider; uint32_t num_cpu; TimerBlock timerblock[ARM_MPTIMER_MAX_CPUS]; MemoryRegion iomem; --=20 2.47.3 From nobody Sat May 30 18:35:07 2026 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1778669895; cv=none; d=zohomail.com; s=zohoarc; b=C82Dk6DC1TyY6KnWIKXFUqcPh80e4WoEdOrlC/uFS0lUdNXFtqq5xr1CGLa7TbfbsKG5HbeR8WCm4Y9VoPOtSjSuY9zBGtqVzj8gYcuUPC9+tQ0x3ctlTvt/LX4RfEcRqFLRXb1tkyOJkM+wKWtBkBV/lPMCxOvpL3VIvLVDAFA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1778669895; 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=bGVucTk00lHJOoHDxhxqBmDjYYXRIxmmMPGfNidYBio=; b=bdxNExt1YbxcQmYQsFxFrf2A4YD16ZqZtcey6O58+HUvEoDg7n5xDRiTwWTMarbzhshwN5ehJQgwCmtsOsMlIahAqlg1KJkF77e55vXkE1bfwzVk1FJmStdXpsWZGh4lYhIyNkQk93zu5JV9qUAwuJ4Ma1iOtkpg5ok+dv4ji10= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1778669895615199.4237986619396; Wed, 13 May 2026 03:58:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wN7Gq-0003WA-KF; Wed, 13 May 2026 06:56:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wN7FX-000382-BX for qemu-devel@nongnu.org; Wed, 13 May 2026 06:55:39 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wN7FO-0001NZ-Ih for qemu-devel@nongnu.org; Wed, 13 May 2026 06:55:32 -0400 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-44c350a5b87so4147854f8f.3 for ; Wed, 13 May 2026 03:55:24 -0700 (PDT) Received: from PC-DA2D10.beckhoff.com ([195.226.174.196]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48e8f410d9fsm56062295e9.6.2026.05.13.03.55.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2026 03:55:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778669723; x=1779274523; 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=bGVucTk00lHJOoHDxhxqBmDjYYXRIxmmMPGfNidYBio=; b=kkSgijcYM4DiZ6FTouIJdOQbD2xU9K7AXrrIQ1hzbUJ71CABOzzA37FI4cADfYBnJK RhND/qweTkj+Jqmvl0m34u6PlZj7/YBu/WyR9dj98h4170fHOj65F14DFji3NPqS4qic g95o+jJBAg/qmxPYvJYvnSoVbvEFvGRcB8DtGDJ7H7AppJCgI7NkaHZW2yZjdGloUrIS ldbUhMq5VSEzKFeOrimpStBztAc/0t69SBLpNhssu9NeM5SSK56IpnuryGA166/b9+o1 KD1GwD4Hpj7SQG1AJTcV0TrLFecwhb840/Jt9CSuwDsuVxSIW8+H0RGAw5ICUCUDiNE/ m93g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778669723; x=1779274523; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=bGVucTk00lHJOoHDxhxqBmDjYYXRIxmmMPGfNidYBio=; b=Gdgfm3/8qn62ALjt8vYwUQ/1nV0/tcJwzwx0bCO0sWPRpXfERK7Ycn8DSZ6M8KiETp +SqK5Surem8GfLZqUPrXnClFI5toYbx2ERT+SSuIim92HcXuAAQTettTXoxZnWEhPXh6 IyX13S4zZLMsjfXGNgSvI6kp8V98CfQSnEyOjsZlYeU+MOaUq5/dx3/kYcjvjzfQMgBr F2k1L3POdhiIhBsjansfEpIlTcs1+c6qdltICSr+NBFdw8/NzOZzuuhTiPNMSGfftouv 6QfWvgOhdwe3xkaVO/PC7p39ui67jxXCccDMDBaT/2lRUOw2PH1rScdl7FEo0ev/lGTA fy5A== X-Gm-Message-State: AOJu0YxudAK36i0HuIU9oDA4xZTEVE7+hze7cpBCyipK9CTnOsFnC0Rs b6Outh2omygSUVX+ow0L5zPYt1/6mqE/XuPXVgc6XvnVAj86tg8e1aQojXKSV6zT X-Gm-Gg: Acq92OE4SlDjdP5KjySSFF6de6gSjcsD6qNxM4+d430jlcjbozrwKGyLafGRzIoH+Ci MQfVztSdCD4XTWhv9353fyFKzzAIWpIOMX5xlLKKz9/nIEXAtvPlZKgpN9K/HRDEJjWKyQJom1n E0NVqXQD3+eqWgH+n51BTKDVx14TSM8r121A7v82slF2hTh0W6yqjbkPcZzFQ/HPLQNJPryRYrc DFyr3poErTc8nf6l/w2e9Vgx/veFTUQ3JgW2SJ2Uz49vOWX+X5jnZ7i75Iq/xlSqfBzmyhnmK6N AJBc6u7oNE5Y7hUbwiudEfplG/5F3Gx77V+RM7EgQVr623PvLzYCTyhB6lXwDGRAVNLZRYse4QL yHTSF9tB59bWfjAqc/PuuPF0RsIN0zr41PrYgseWZFBDIg80RuQVIMIHSfr0/ImcToX7MQz3Qe0 HcM/9cXzr9IxsuLUONFzK2tMoOHoix0wo/56kgliCTlbmFkGYjoQsUhR8= X-Received: by 2002:a05:600c:45cd:b0:488:ffb1:494c with SMTP id 5b1f17b1804b1-48fc9a1bacbmr39171285e9.12.1778669723059; Wed, 13 May 2026 03:55:23 -0700 (PDT) From: =?UTF-8?q?Corvin=20K=C3=B6hne?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Hanna Reitz , Kevin Wolf , qemu-arm@nongnu.org, =?UTF-8?q?Corvin=20K=C3=B6hne?= , Peter Maydell , Paolo Bonzini , Pierrick Bouvier , =?UTF-8?q?Yannick=20Vo=C3=9Fen?= , Alistair Francis , "Edgar E. Iglesias" , YannickV , "Edgar E. Iglesias" Subject: [PATCH v6 03/15] hw/dma/zynq-devcfg: Handle bitstream loading via DMA to 0xffffffff Date: Wed, 13 May 2026 12:55:05 +0200 Message-ID: <20260513105517.146706-4-corvin.koehne@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260513105517.146706-1-corvin.koehne@gmail.com> References: <20260513105517.146706-1-corvin.koehne@gmail.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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=corvin.koehne@gmail.com; helo=mail-wr1-x42e.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @gmail.com) X-ZM-MESSAGEID: 1778669896382158500 Content-Type: text/plain; charset="utf-8" From: YannickV 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 Reviewed-by: Edgar E. Iglesias --- 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 cf00aa863d..9708200760 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, ui= nt64_t val) static void r_dma_dst_len_post_write(RegisterInfo *reg, uint64_t val) { XlnxZynqDevcfg *s =3D XLNX_ZYNQ_DEVCFG(reg->opaque); - + if ((s->regs[R_DMA_DST_ADDR]) =3D=3D 0xffffffff) { + DB_PRINT("bitstream loading detected\n"); + s->regs[R_INT_STS] |=3D 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] =3D (XlnxZynqDevcfgDMACmd) { .src_addr =3D s->regs[R_DMA_SRC_ADDR] & ~0x3UL, .dest_addr =3D s->regs[R_DMA_DST_ADDR] & ~0x3UL, --=20 2.47.3 From nobody Sat May 30 18:35:07 2026 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1778669823; cv=none; d=zohomail.com; s=zohoarc; b=dW/tJJ4mlm61DeE5NCU/nXAPCqAXy2X2ULRwofLlUTVQ2W9mIvkRaDpGCSS9BNLPrn5LllLOF/+8dLKJ8rZsG0tJMH7k8vst8o8pLt5FSzU4tGRIkXEt8Ak2OFr2H7hoJI0Ls24JzM7XQWpUcHirFVrH/s4Liq4hGyxftOWcjow= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1778669823; 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=QGkrVLFS7cW0IKrQNJ4/JeWHeoQPDU3gaIf/fmkwr+c=; b=Y+E3fM3L5nyVPzU87k0qIKx5FFn1Zfw+PQuN+z4+r89kWy30PUSN4QhhhXgYwHbw6v9h0tfiNS2l6vGfc3pUWyavjxBsGVks4110lBwmpqeUGmX+Aex9mzAPvdtsgvXqHB7lzxTFgxPvgF4KzSeh5l48EBIbM55o9pnAVeZ+aUE= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1778669823451192.3880905530766; Wed, 13 May 2026 03:57:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wN7Fr-0003DT-1Z; Wed, 13 May 2026 06:55:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wN7FX-00037t-7k for qemu-devel@nongnu.org; Wed, 13 May 2026 06:55:39 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wN7FO-0001Nu-Ih for qemu-devel@nongnu.org; Wed, 13 May 2026 06:55:31 -0400 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-4891b0786beso42147915e9.1 for ; Wed, 13 May 2026 03:55:25 -0700 (PDT) Received: from PC-DA2D10.beckhoff.com ([195.226.174.196]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48e8f410d9fsm56062295e9.6.2026.05.13.03.55.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2026 03:55:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778669724; x=1779274524; 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=QGkrVLFS7cW0IKrQNJ4/JeWHeoQPDU3gaIf/fmkwr+c=; b=tCvm3JZhCWvrVP3kstQQZTpQL4KFEEeV9a67zkRz2+r7NJnOom+74W1ButUhCK3qjZ sMZL3CmrzDxSd5LqxVPFBJ//1V+rh8Gfz3crfIbY3lKYl4zQvkzAGdMDWzRWr2drCLPn qGMrdhb0kdup4jyMez12ulUdmxJVkuC02Mxa9PAhonuJjMrYNUxDVuqwTpMA5vZBo8J8 uJBAcm6XYRmdb4FOnetGitlOAHwJEsfc4IlCcA7QY/Ne5tcut9wfLabJpIFGNEb7D96Z iBSsUjjC8QJ46sPy7QS8ZL2Vvp50NpXtzzuxCZRHrDF9EZB/04rJCPgiC1KWNZXEh7Hp e9PQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778669724; x=1779274524; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=QGkrVLFS7cW0IKrQNJ4/JeWHeoQPDU3gaIf/fmkwr+c=; b=KoowcNZ6FWjren9nTqXAtcw/O7MNOfZFUvM8byzpYwAEw4yjgozmbb5BAGeAbQp++n 4SDfdANDnQO4vwASwByhcEybZhAeWIGPtzkaRFuhOkLFy72wPfBuIBoGpz76MVLlnj99 SXqRRutxk9Q/Bexg34u4Lao/F+85Q900j+MSyG/UiNxkEa6et6aI8tjW8dat0bcu7kT8 2pSF3H0XtsDbKkgGQ0xa67S/VK5maZRqe3XEWynMkA3q/CiNPPIbrDhqYTH6hjfKhKbD lduf9Gaul6v0zI9w60UwHLQ5U4eijg/ck1F/jM+hjEg8dITPVjW8yjMXx+CGVCqzdLWQ KqQw== X-Gm-Message-State: AOJu0YyonLXqdYG2gUx7aJ4LbGFGevnKyBYgVnoxpD3L1a+uvCyhq76c lXat1EUmENdpzH38LgSzIryrT/bcXm1PJ7DNJRzjTCXF8e9FNoxGGVS8HVVuX9un X-Gm-Gg: Acq92OFxlwZCbkAZMPyF16digLc8zuPZ6iwHPeNCvsth5+S0RFdDzr8A+BMUbRfHtug EFJC9a2XhIiUgWP8qtViMBOoDqM0VIo44hdXSu5N3Lch42aYjuFNhDbkNw2777/9RBspRj7BwOc vjzb8815Qxa92L9WId+oQCOIp0vUl5nXFP4+jQuczWcq6ocVUm5CVt/2qf7aicrTJ0mJqcirWx9 CniBHyJN4wa2OQLJ8m24iqNVekei9/z8uIbtmuvChhIi0bkSbsByGwmki4heYW3QCRM81Dn1lBY Wz3H48v3GOdCTUdddlQ2/zyGoVIYlm4Mm6UDzpJJolP588ECI72P2smNIF5gy1d/xoSnzeOWQc0 BYn8GkNjM/7cr1ue7V0xd4ONbWpvzPj//z+I1QoW4IZqhYO8BdJ2+pxLqR+IYJXDP4akgceZq+J Gu/vu0o/67fOy4/NEpqz0eNqb/KqjuPaWaKy5jaOX/N+Ik X-Received: by 2002:a05:600c:8b57:b0:485:4eaf:eb53 with SMTP id 5b1f17b1804b1-48fce9f71c5mr34992345e9.19.1778669724357; Wed, 13 May 2026 03:55:24 -0700 (PDT) From: =?UTF-8?q?Corvin=20K=C3=B6hne?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Hanna Reitz , Kevin Wolf , qemu-arm@nongnu.org, =?UTF-8?q?Corvin=20K=C3=B6hne?= , Peter Maydell , Paolo Bonzini , Pierrick Bouvier , =?UTF-8?q?Yannick=20Vo=C3=9Fen?= , Alistair Francis , "Edgar E. Iglesias" , YannickV , "Edgar E. Iglesias" Subject: [PATCH v6 04/15] hw/arm/zynq-devcfg: Prevent unintended unlock during initialization Date: Wed, 13 May 2026 12:55:06 +0200 Message-ID: <20260513105517.146706-5-corvin.koehne@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260513105517.146706-1-corvin.koehne@gmail.com> References: <20260513105517.146706-1-corvin.koehne@gmail.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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=corvin.koehne@gmail.com; helo=mail-wm1-x333.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @gmail.com) X-ZM-MESSAGEID: 1778669823884158500 Content-Type: text/plain; charset="utf-8" From: YannickV During the emulation startup, all registers are reset, which triggers the `r_unlock_post_write` function with a value of 0. This led to an unintended memory access disable, making the devcfg unusable. During startup, the memory space no longer gets locked. Signed-off-by: YannickV Reviewed-by: Edgar E. Iglesias --- hw/dma/xlnx-zynq-devcfg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/dma/xlnx-zynq-devcfg.c b/hw/dma/xlnx-zynq-devcfg.c index 9708200760..afe6ffd326 100644 --- a/hw/dma/xlnx-zynq-devcfg.c +++ b/hw/dma/xlnx-zynq-devcfg.c @@ -221,7 +221,9 @@ static void r_unlock_post_write(RegisterInfo *reg, uint= 64_t val) { XlnxZynqDevcfg *s =3D XLNX_ZYNQ_DEVCFG(reg->opaque); const char *device_prefix =3D object_get_typename(OBJECT(s)); - + if (device_is_in_reset(DEVICE(s))) { + return; + } if (val =3D=3D R_UNLOCK_MAGIC) { DB_PRINT("successful unlock\n"); s->regs[R_CTRL] |=3D R_CTRL_PCAP_PR_MASK; --=20 2.47.3 From nobody Sat May 30 18:35:07 2026 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1778669966; cv=none; d=zohomail.com; s=zohoarc; b=h0XixSi2fM8PEfQBX5e/1pov3tR6igGtkfrLXZD6nu7Ae2y3VgpX69cvgKVyv4GeR/TzkSqxV5NjBJHmUcXUiJh9x9+pleVm1mY8/6zsXK89Z/i19VQPiiMBSsSLnUMX/slMZzyUG7y9MR9PBEgZAwGFpymy/cPK7b/tBR0wBso= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1778669966; 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=k2UZAwblmFCL8Lm8n5wVmaatXyzHPE9hb4BFthu5ZrY=; b=Jd1N2y/kSpTak0ceDvqBL2LN9T23Og8Hx3u+P6LWS4t0B8zjik1UfSrKtbSEpKfi4NvzSNzbTdfN//IjcxG8CBW2TIdBNqhFrH+iUp6jChJmzu/nuVZ1UUd+5DMjlnj0iafEMAuBc/aHXEgtXKZ/fq4t30AHDg/CDnO9ZhJ9Fm0= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1778669966793981.0207735102448; Wed, 13 May 2026 03:59:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wN7J1-0006EY-GO; Wed, 13 May 2026 06:59:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wN7FZ-00038G-AL for qemu-devel@nongnu.org; Wed, 13 May 2026 06:55:41 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wN7FS-0001OA-MH for qemu-devel@nongnu.org; Wed, 13 May 2026 06:55:36 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-48374014a77so59308755e9.3 for ; Wed, 13 May 2026 03:55:26 -0700 (PDT) Received: from PC-DA2D10.beckhoff.com ([195.226.174.196]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48e8f410d9fsm56062295e9.6.2026.05.13.03.55.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2026 03:55:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778669725; x=1779274525; 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=k2UZAwblmFCL8Lm8n5wVmaatXyzHPE9hb4BFthu5ZrY=; b=JJ1N8334iwK5UFps/J4cB3IxFdxZjBFO/wWUcsIVF/V7D0Yu12a54uV41osK9yLdLy h3gpSiG/a+rNolkIOpbSxQKcySUiSIvVq18q+MtP5Z217hkl9TBfjzyh4jonsgkC27Y7 fUw9KYn60VYmsVYh5OhSZdFaxAArVbL+InMVEAh49iktmxPHeuWVyEn0Yvmla4dy/sa/ IqtyB7UaqLaAwlPCRvJNLfc1UYWT17w/kUkVlV7XERnH5kY2ZwvCvoHOG+X6orpMcZmA ogQBsciBqfMqvyUeXH6dP5NmFOCiGZWtRQgUaO8gzESUPEFqomShdWSYk/k4Sf9FBerw hlvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778669725; x=1779274525; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=k2UZAwblmFCL8Lm8n5wVmaatXyzHPE9hb4BFthu5ZrY=; b=RJzUwn7U6i2oGuZ+TdiI9k9qUxw4RUQD89p9rYCLxpYr/m4UshY+BW8AxzxUVD5lxJ MH2e46uJP/akTycwRtpb05iHE3Z7yEXmI57R+UqnTp5O7LyCGxhaZF3QnKrWgVI6BOF6 S6OH538HW4SRLQxumyoddPtL3THqdAFvHkO52bRhxvUCfz+gNCb9T34koXq+PmhXhW+Q EswjFzS7r/YNHHhe8nRXmVwA0diJt/q7pnfrJjH4wU+G11toFhaFf0opybOi2nBskvYQ 0xqQm0eeqJab6AZKQHFwXtRa0cytFS6HVWzXPGCnkU4LPr2lTzniSkw3ObaqGmjAehOz /fIA== X-Gm-Message-State: AOJu0YzlIkkGC/q5YzNUJ4wmDjvvWM6sBOMk2wAVIzgOwbre1FQsuyNd Xc9s+qL8mg2dtcEb/nh89kLuv8/MASIqEqVFz4L3l8Ys0QGkvEwOclaEA1Weoxyt X-Gm-Gg: Acq92OGhCEDSzmanVj4BgZQbn6F48c2fDX9Fb7iWOxpibDXkF/QEeXf7fKX2qy7LjJw ilLJg6CeTlGdeYak25W+Lnczd0IVneDgG17IiPZwc6eot7YpUyh/Jgqcd3jcyDPEltuQPkeDHUT p0SKGrOZ2N1XAZJ0dlUe59NwDdD1qgpxlMW/LDbBRuvmeqGPuy4+vKi0CKpWptZBlc+HsfGAQG5 IvmWB8JYniV8x6FpvIhVcBTggM88Pc3oYnklKtrsy2zTUeOWpFYMhzfBcufq44XRqa7KAvMWVYv gsJHLrQwbWHnr8Mczn1joDFHljWadXt63wsUq1Xy1kBgS8S8vIHCOZR/nRslkSDknpFAECqX4xU MoDfF61PayR9x9jW4W0pt2qvbM6OOvQ4rIQzJJzl7D8Aq//0v/+uEUy8cEjp5AeEaHEHyv148tv bB7NY0vihSS5l2U9sXl3JuZTCTROMdFpUfZJmiyM4q+2zD X-Received: by 2002:a05:600c:1d06:b0:483:2c98:4368 with SMTP id 5b1f17b1804b1-48fc9a3122amr44055015e9.18.1778669725465; Wed, 13 May 2026 03:55:25 -0700 (PDT) From: =?UTF-8?q?Corvin=20K=C3=B6hne?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Hanna Reitz , Kevin Wolf , qemu-arm@nongnu.org, =?UTF-8?q?Corvin=20K=C3=B6hne?= , Peter Maydell , Paolo Bonzini , Pierrick Bouvier , =?UTF-8?q?Yannick=20Vo=C3=9Fen?= , Alistair Francis , "Edgar E. Iglesias" , YannickV , "Edgar E. Iglesias" Subject: [PATCH v6 05/15] hw/dma/zynq: Ensure PCFG_DONE bit remains set to indicate PL is in user mode Date: Wed, 13 May 2026 12:55:07 +0200 Message-ID: <20260513105517.146706-6-corvin.koehne@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260513105517.146706-1-corvin.koehne@gmail.com> References: <20260513105517.146706-1-corvin.koehne@gmail.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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=corvin.koehne@gmail.com; helo=mail-wm1-x32f.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: qemu development 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 @gmail.com) X-ZM-MESSAGEID: 1778669968752158500 Content-Type: text/plain; charset="utf-8" From: YannickV All register bits are clear on write by writing 1s to those bits, however the register bits will only be cleared if the condition that sets the interrupt flag is no longer true. Since we can assume that programming is always done, the `PCFG_DONE` flag is always set to 1, so it will not never be cleared. Signed-off-by: YannickV Reviewed-by: Edgar E. Iglesias --- hw/dma/xlnx-zynq-devcfg.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/dma/xlnx-zynq-devcfg.c b/hw/dma/xlnx-zynq-devcfg.c index afe6ffd326..7370ab941f 100644 --- a/hw/dma/xlnx-zynq-devcfg.c +++ b/hw/dma/xlnx-zynq-devcfg.c @@ -188,6 +188,8 @@ static void r_ixr_post_write(RegisterInfo *reg, uint64_= t val) { XlnxZynqDevcfg *s =3D XLNX_ZYNQ_DEVCFG(reg->opaque); =20 + s->regs[R_INT_STS] |=3D R_INT_STS_PCFG_DONE_MASK; + xlnx_zynq_devcfg_update_ixr(s); } =20 --=20 2.47.3 From nobody Sat May 30 18:35:07 2026 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1778669929; cv=none; d=zohomail.com; s=zohoarc; b=DX1mP5IGpFEGXW/8jF2AWN62uV6tB5JUhYeCqI5bi/2Re/8peGturDBB/OrN4agHoqugLp4/M+LT6NRd2zMtT80g2elEuJald2z8KKyqPBtfYYGRUY7l9wr5/Tqg6+/AI+W5lw0A69PkV8W7FUELxSMOAN8JBcL2JqQTnJ/OHlo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1778669929; 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=O2EpYJqPevmVbNmKK1CIfcbHlQchiIQzYHZXdo1sFgo=; b=X4S9mETVW0j2O8OvLqEPvxev533tvDgd2yfXHqcEBQlugbXnureD1AJFgZP3AymMk5Z7iHG2eiGOBUpb710TjOv2zxRoVWNlPeWhUcegHXrYc9ywWy5yg/PSz1xMLiVbUO22FeJlWKRcgLkCm/WknXLhfdSu6GpU2z09c1LBhtw= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17786699298423.395151492541004; Wed, 13 May 2026 03:58:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wN7Gx-0003ka-6q; Wed, 13 May 2026 06:57:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wN7FZ-00038D-66 for qemu-devel@nongnu.org; Wed, 13 May 2026 06:55:41 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wN7FS-0001Od-Hr for qemu-devel@nongnu.org; Wed, 13 May 2026 06:55:36 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-48984d29fe3so70483625e9.0 for ; Wed, 13 May 2026 03:55:28 -0700 (PDT) Received: from PC-DA2D10.beckhoff.com ([195.226.174.196]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48e8f410d9fsm56062295e9.6.2026.05.13.03.55.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2026 03:55:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778669727; x=1779274527; 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=O2EpYJqPevmVbNmKK1CIfcbHlQchiIQzYHZXdo1sFgo=; b=jYSb5phDyVZv/Szw0Pal1B5osvqNpPEckHi5SV7C9GM3BLAthJabDizSxwLZDE8wEZ jUzO85NGn7bFHo4K/tqhWnpSRvsjyzmy24MZtP3u3h91wRMPTy3uQm1A2MyBVudwuaf/ v+ohy5hRPIVXXjtkpVGNKP5nkJmycO6jpOljEtUNEiHILIpJnusjXXKhGgnIG/DW2BNX lPy5r7Qkjm8x567egNaewT//8senE8e9g5PZO0tijwDICNGr1ZqfXhHbxYxYNnY8o8nZ wf/BWaV/GjRZeWWCWIrCGKfsKOgcsgSvHDWLzMnteSuoRBkWQ9F2LNB7CH6LVz8mbkDd C+5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778669727; x=1779274527; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=O2EpYJqPevmVbNmKK1CIfcbHlQchiIQzYHZXdo1sFgo=; b=oNTnp95vcHAvJl4vj/qKR1p/EnvIPtBv+NxNerJeaWlT8fVxaguvmWVWB5xEw+NZIf pIrrcJLK7C3t6aDLsNtc0oZoXdKZkg3IbH1kaysMFirv01WFipBi1c5gbOVVzSIbENU/ KInku25Wi6jAyKwltVZ6kk6DGB8y6rvSdEG0YOaey+viHmRxFT9ylpm35sgaJx4laBHu cFtbsCHIY43v+aS6VgPltGoxHhz/XHlPkhztuwlBO4Z7/4Nfnsp+BJFWZJSi24AnyaK0 jZxe4ywy1VoPT8Dw5Mrmbe28cety1KGe0F58YmWvHuc8WlCrEPPhTtOoBEs/NZXprvGZ DKnQ== X-Gm-Message-State: AOJu0YzRHd0YLjGJZB08nQaxz3aXR4DB6n0fH2SWzunFPfTap+4Vm6sS a6EuaYeyUXDsnNIzjEUccXs26BE3m6iW4kNIMmqLhY9ngcq16SODhj4UXfNnMcvi X-Gm-Gg: Acq92OFpDNM10mtRtR9epUep4NLEaBw2RwoQwwDP/njBDN1SOMiHD4vyCMeVYq2GzjR u+1WHfImM0eU5oumC/y598lkoxvdUq3/l6Gm0dciXRLh+7hldJfliWTZazVLddkAm8DWkb8nfWI cEadOUZW+KY7I0uQmBV9HW6WcqauFrnOCC12jvuKamXI76FerKQdlePxL5nb9o2meXQF0+2bxPZ l7fNpRys20cjzqVM1JTW8Z3KVimHM8yHq1gkZhrdMYJrrJrw6SFmUlt5Ow8EVshx5jvlmy0XNJl mK8IDmTlKIcOKdIAdWw1+X4wXnjcL3ec2sgCKphYaLVHSMlwmy+xeBl0GQZWf2+WL2CiZ0u9y1Q ZuBfKfXHCAk9LWrHJvli78kOZqXvljw6OZjeABUmO9K4WCfxENX3MfFMAKyfnxAbGJK8K0qqXcP CnqSM4cIWAzdFO7iSrPtYEGdX1hiUVZAIlZVnme96zh/Pe X-Received: by 2002:a05:600c:8b12:b0:48e:978f:c45a with SMTP id 5b1f17b1804b1-48fc9a3ba11mr43545795e9.19.1778669727341; Wed, 13 May 2026 03:55:27 -0700 (PDT) From: =?UTF-8?q?Corvin=20K=C3=B6hne?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Hanna Reitz , Kevin Wolf , qemu-arm@nongnu.org, =?UTF-8?q?Corvin=20K=C3=B6hne?= , Peter Maydell , Paolo Bonzini , Pierrick Bouvier , =?UTF-8?q?Yannick=20Vo=C3=9Fen?= , Alistair Francis , "Edgar E. Iglesias" , YannickV , "Edgar E. Iglesias" Subject: [PATCH v6 06/15] hw/dma/zynq-devcfg: Simulate dummy PL reset Date: Wed, 13 May 2026 12:55:08 +0200 Message-ID: <20260513105517.146706-7-corvin.koehne@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260513105517.146706-1-corvin.koehne@gmail.com> References: <20260513105517.146706-1-corvin.koehne@gmail.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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=corvin.koehne@gmail.com; helo=mail-wm1-x32a.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: qemu development 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 @gmail.com) X-ZM-MESSAGEID: 1778669930548158500 Content-Type: text/plain; charset="utf-8" From: YannickV Setting PCFG_PROG_B should reset the PL. After a reset PCFG_INIT should indicate that the reset is finished successfully. In order to add a MMIO-Device as part of the PL in the Zynq, the reset logic must succeed. The PCFG_INIT flag is now set when the PL reset is triggered by PCFG_PROG_B. Indicating the reset was successful. Signed-off-by: YannickV Reviewed-by: Edgar E. Iglesias --- hw/dma/xlnx-zynq-devcfg.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hw/dma/xlnx-zynq-devcfg.c b/hw/dma/xlnx-zynq-devcfg.c index 7370ab941f..6b1d96ff80 100644 --- a/hw/dma/xlnx-zynq-devcfg.c +++ b/hw/dma/xlnx-zynq-devcfg.c @@ -49,6 +49,7 @@ =20 REG32(CTRL, 0x00) FIELD(CTRL, FORCE_RST, 31, 1) /* Not supported, wr ignor= ed */ + FIELD(CTRL, PCFG_PROG_B, 30, 1) FIELD(CTRL, PCAP_PR, 27, 1) /* Forced to 0 on bad unlo= ck */ FIELD(CTRL, PCAP_MODE, 26, 1) FIELD(CTRL, MULTIBOOT_EN, 24, 1) @@ -116,6 +117,7 @@ REG32(STATUS, 0x14) FIELD(STATUS, PSS_GTS_USR_B, 11, 1) FIELD(STATUS, PSS_FST_CFG_B, 10, 1) FIELD(STATUS, PSS_CFG_RESET_B, 5, 1) + FIELD(STATUS, PCFG_INIT, 4, 1) =20 REG32(DMA_SRC_ADDR, 0x18) REG32(DMA_DST_ADDR, 0x1C) @@ -204,6 +206,13 @@ static uint64_t r_ctrl_pre_write(RegisterInfo *reg, ui= nt64_t val) val |=3D lock_ctrl_map[i] & s->regs[R_CTRL]; } } + + if (FIELD_EX32(val, CTRL, PCFG_PROG_B)) { + s->regs[R_STATUS] |=3D R_STATUS_PCFG_INIT_MASK; + } else { + s->regs[R_STATUS] &=3D ~R_STATUS_PCFG_INIT_MASK; + } + return val; } =20 --=20 2.47.3 From nobody Sat May 30 18:35:07 2026 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1778669969; cv=none; d=zohomail.com; s=zohoarc; b=aYK96UC1lClo5z/hrAYAryxp/IoLm92uunIvryxJ3whBj/Li9Yjx3ws7t77f53Z8lGjXPmE9hAeyBibznv2z+ss2HyW57CJ/6aGG2kyyvkR7X8WM4unUT+s8V326uyRVHmfhqWLtzkZiFXcz65XEFPB78VSUD1b/UW8aqSlModU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1778669969; 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=1JNG0WpLJF3nkTQNm/OVMSOxMuYSpcxBZJPbT2YaBCM=; b=KNAlimgRHbNSaxq/0mvAgL6DJtYMLO7IH6dAoW/5D0+ViQfOoJ+R4JTN/VLSf6snpy2BiPTtkmPpW9nabyn1xfpKvAjFwBcAfjqlcwfrTPA/g3Z6nXeC/OezJLtMoURVlFGsv+8J08sKuqvGohCagnsY/VFWvrpzYNpNw+DmjXI= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1778669969605372.4715270773305; Wed, 13 May 2026 03:59:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wN7Iz-00065S-7j; Wed, 13 May 2026 06:59:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wN7Fd-0003Av-RS for qemu-devel@nongnu.org; Wed, 13 May 2026 06:55:45 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wN7FW-0001Oy-NX for qemu-devel@nongnu.org; Wed, 13 May 2026 06:55:38 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-488af9fdaa7so37684665e9.1 for ; Wed, 13 May 2026 03:55:30 -0700 (PDT) Received: from PC-DA2D10.beckhoff.com ([195.226.174.196]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48e8f410d9fsm56062295e9.6.2026.05.13.03.55.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2026 03:55:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778669729; x=1779274529; 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=1JNG0WpLJF3nkTQNm/OVMSOxMuYSpcxBZJPbT2YaBCM=; b=qDNkY8LQSOSQnlU28PnQXbaeYQJpszEiJkDjX6P3jIlG27w5GOf6rnCJr52YZCowm6 aofp8W9O24vec7bFUx3hFAtOQvyPou1ENzeZDqnmdgVNhMEKp1lI8g+k1z+EFNqz4wZW t0SUhXfqwL65Q2KGZsrPbAcjEPaffOYegZPNex0jJZtEgHrDDH8h9PeZZ6Od9cTFfKmM QhwYMyKVRSpCkY3FAvs1PVZhSpTY7shmmErd8U0IteCoLsnKKXojy9acCcd7NdAUE8ZH mOgNobqGXWAfiUn0VbbijNGP628qXvlUJNTsuUCy4qFTLOwMkYYRAfrEv60f5f+3ku9Y iIgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778669729; x=1779274529; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=1JNG0WpLJF3nkTQNm/OVMSOxMuYSpcxBZJPbT2YaBCM=; b=g5MJQ48QETrIBtK6gRNFc8UBFJkLuXg9sPyTRxkw7LL1x1vf9eHgbn0bgti0UwO0FC qs2iIwW5o8RfnXLAmo8u7W2Vy7qjGHESSZYzq7QB0osobKqYxU55OqEeZpiji5C7WFS7 Ge2vT68ERk+4wte9MmTYp6dDrgk4ZLQhtR+vJh+u9UEw11bl/5ciTO17AAkVv0LEajyo dQ31IkHJ6I9d8A+/JE0hcFRCmuTg0E3WtPjV8aUaCBPRckR8HhuDnVQPSQqQyvASTCVw 28pqf8941D5Z7T/r3t55ji4wSvmaDO7Y9/5yLJJUGet5Y16hcobxwO3n/sVJ6RWMg+BF 2hkw== X-Gm-Message-State: AOJu0YysaUEYl//8nNG5wyljzmk4MH++YzKUAKjruQw4m7JbIRlx1hvo q0dK0aXXc5m9KQc6haTUQSXaQn9qvL82i4v0VbNLey7dqnjYtGIt2IY2PsRi9LTt X-Gm-Gg: Acq92OHMb7Lf26aKjzc8x8C5qj8FWfX8+x8Yz5pkVTij9SYdtgSc1vkzmLIo5dCgJuN vdSEDMFZFAAJDDv3F0wpwWuSGXuflH2tvVZcfSqlVVPG7A63/yNwD5JxA/sv5XmENS0xeoVNJIN 3SOuPW7xPwduU3VA85zt87oVjKwJ05idnbt+mB6xyWYT5eO6SP60SP7nRoRK7Tq89eKth2evTWq nXkEKvFS5TRePvdJRTtRI9rLbV3PQETCFeBIOiMnWaBwZnepZdzNgGZWLf6yXhtXAnXMyx9SvHa 5u9ewk4IcfgyvQ6WDUWBpTWLI4Yfaj9moBgD8NCpIuBGVts4MdyAZNZTM0BX2elXqdambrcGZbM sxXxQi8kYi0o7jA/BeSHuP6WHpxt2RsWVGmIBU2BbLC3KHU1rJ8bBvF7kVKZiUm4QD5rTfPYlMJ GTHdSkD6AyLlwYdzbaaJYdifGd4aUtjqqiDviklQuKQqF5 X-Received: by 2002:a05:600c:4595:b0:48e:706b:53e8 with SMTP id 5b1f17b1804b1-48fc9a1b9famr39261065e9.11.1778669729442; Wed, 13 May 2026 03:55:29 -0700 (PDT) From: =?UTF-8?q?Corvin=20K=C3=B6hne?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Hanna Reitz , Kevin Wolf , qemu-arm@nongnu.org, =?UTF-8?q?Corvin=20K=C3=B6hne?= , Peter Maydell , Paolo Bonzini , Pierrick Bouvier , =?UTF-8?q?Yannick=20Vo=C3=9Fen?= , Alistair Francis , "Edgar E. Iglesias" , YannickV , "Edgar E. Iglesias" Subject: [PATCH v6 07/15] hw/dma/zynq-devcfg: Indicate power-up status of PL Date: Wed, 13 May 2026 12:55:09 +0200 Message-ID: <20260513105517.146706-8-corvin.koehne@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260513105517.146706-1-corvin.koehne@gmail.com> References: <20260513105517.146706-1-corvin.koehne@gmail.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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=corvin.koehne@gmail.com; helo=mail-wm1-x32c.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: qemu development 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 @gmail.com) X-ZM-MESSAGEID: 1778669970910158500 Content-Type: text/plain; charset="utf-8" From: YannickV It is assumed, that the programmable logic (PL) is always powered during emulation. Therefor the PCFG_POR_B bit in the MCTRL register is set. Signed-off-by: YannickV Reviewed-by: Edgar E. Iglesias --- hw/dma/xlnx-zynq-devcfg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/dma/xlnx-zynq-devcfg.c b/hw/dma/xlnx-zynq-devcfg.c index 6b1d96ff80..5608460dc7 100644 --- a/hw/dma/xlnx-zynq-devcfg.c +++ b/hw/dma/xlnx-zynq-devcfg.c @@ -333,7 +333,8 @@ static const RegisterAccessInfo xlnx_zynq_devcfg_regs_i= nfo[] =3D { /* Silicon 3.0 for version field, the mysterious reserved bit 23 * and QEMU platform identifier. */ - .reset =3D 0x2 << R_MCTRL_PS_VERSION_SHIFT | 1 << 23 | R_MCTRL_QEMU= _MASK, + .reset =3D 0x2 << R_MCTRL_PS_VERSION_SHIFT | 1 << 23 | + R_MCTRL_PCFG_POR_B_MASK | R_MCTRL_QEMU_MASK, .ro =3D ~R_MCTRL_INT_PCAP_LPBK_MASK, .rsvd =3D 0x00f00303, }, --=20 2.47.3 From nobody Sat May 30 18:35:07 2026 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1778669939; cv=none; d=zohomail.com; s=zohoarc; b=Cr2e9XT/VZZl13UQH2IGpPgDSWC+H3m7uitoa1tO35MUwUW2k10CfQidEIzkRh5EN915CSUkPym0X6pNfWLKHwJ5I09KtpVT3kLvFrAfdI3o/rPXG3ShQM5eL8d1LKhwFSqUzSgL8vf/Mp9PIvBa5Q/w/s1YnLimBDim59847Kc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1778669939; 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=GS/wUy7boJDog0agfUbFYttKDqh3+z3QUYK5SWkB2fc=; b=X1uLW3Cbb7i/fAVBFjOW98oYM+Y475J92b9sQeTWIhj5eqr36O2FKyKfJ6nIF1rNVb0+wRaCekZTgL/282PpIjZK2LZ9HGP8ipSLQZhhHXDZ8QJ/Aiq7oyW8F0KIPqzVZTNXoNHLbzYUlLMmkU3dMO9chH0qaVrBldRcYt3avBI= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1778669939577804.1411992405633; Wed, 13 May 2026 03:58:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wN7Ht-0004dt-N8; Wed, 13 May 2026 06:58:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wN7Fd-0003B0-S9 for qemu-devel@nongnu.org; Wed, 13 May 2026 06:55:45 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wN7FW-0001Pn-ML for qemu-devel@nongnu.org; Wed, 13 May 2026 06:55:39 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-4891b0786beso42148655e9.1 for ; Wed, 13 May 2026 03:55:32 -0700 (PDT) Received: from PC-DA2D10.beckhoff.com ([195.226.174.196]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48e8f410d9fsm56062295e9.6.2026.05.13.03.55.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2026 03:55:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778669731; x=1779274531; 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=GS/wUy7boJDog0agfUbFYttKDqh3+z3QUYK5SWkB2fc=; b=lGto6SktLl18uolYVhfQ6c6/GilVFND7Uypp54bhEIi6kwcnwepCKLeUBGDPP/pZkU vPU4HMZCKJGeJI86RGx1l3E0igPuQtBYuKuGvcVE4PgYs8kNHDgCbiYXy4AXeEbxzg1y 5x/jkoEA3RvtYGIkhXSaavNM0MGUAtpqLOpcrAIkJCKP/FojIhayjadd6gvmbEbnfT17 4DzRBxnOEpDj+3by8obPGjugHw9EI6Nv9hjRUA66thqRocA2z+mrJNmCn/JDDZNtPxc3 ZTbZjP+KsPK4I4r7x+Smcyo+fnXKGH6zfJexO6rGoKDdVnDPCt07YjZ7jmvIAnur2F3e J76Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778669731; x=1779274531; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=GS/wUy7boJDog0agfUbFYttKDqh3+z3QUYK5SWkB2fc=; b=ER45I8+jr0T/A5rGPvBpa/yF5d3Jc1riItzemhy+wj/35c9v5Ohec10bSVUqOAatXy ZXClajUHFAWwKCeMLqykIZxc63zXznbOg8hX2vXLBf0FcasgG4GC7TmQPcvJVSBanjVZ KLC8TRwP6TbMR9TKYaxbI4UN7DwgM9Y30DvWYnn9eveWGegfzCBQRKjc9G4k7O+VUgUn VoTcMFYe80oqEfE7S4e4K2IBRYKAQoMpxJPGQ17RiHoeEXT1DVBB/9izd9pPYj/xG/wz DtMrKKkJWKxwLjZChUc60/RgAld+0gbelWVXLQcFLXEGSTRWQpR66IqXiO5Nyf5AyCBI EqHw== X-Gm-Message-State: AOJu0Yzok8JqAVLtmBBV1hqDJofCRyh1NL/W0dtw3/xYhA1UchJPa0Ul KoirBcEJHXu2ZYQDJW1WzDKgSGtXmg0qlL2+REtum/A6i4hCP+nnoH5jT8S5NL+R X-Gm-Gg: Acq92OGpOiEvN3J1at6JMnFq1oQvK2YelR5A9gPY8JCO4890GMRWMeC2LdLNTW5wYQI ZheNkol+33R5eqvkS2kcwf4FdjDl2VmjBSaTmK6DpQEJlFYmJmAUMTRiok3B5AcCXa7iN1GPOHL YWUXRexiBHxdOKC7oFgYATMsBV3sjDtxCFDrE2wv6oUWenrTzUdO7qbL1qZk5R1aAffFn23JtF4 bteRY1g984sFy2bM5f+KGnuGus5/xI2/Icy6NUaL4QNNTECgfEtBjwpPfTislTFIvPiUAYkHFj/ NNeK1RU3RSHz/JZxlrgoAbkLMBvmBkmVEkhz01n02gWSzoMA+g4yBVoMgKTVrwZjGCO+UetFguC Ry0c2mTv4w7om3jC8xHvPgWgJOmT2IhyKkaMXENidNk7Lfn02oT0PLJESsvwb0nlTRedKK9gZD+ F2i02V3axGPhYOeD/UeVw5muSs7fEFf/667l+GwrK9fAiP X-Received: by 2002:a05:600c:474a:b0:48a:5501:7995 with SMTP id 5b1f17b1804b1-48fce9ef1c3mr30788205e9.18.1778669731330; Wed, 13 May 2026 03:55:31 -0700 (PDT) From: =?UTF-8?q?Corvin=20K=C3=B6hne?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Hanna Reitz , Kevin Wolf , qemu-arm@nongnu.org, =?UTF-8?q?Corvin=20K=C3=B6hne?= , Peter Maydell , Paolo Bonzini , Pierrick Bouvier , =?UTF-8?q?Yannick=20Vo=C3=9Fen?= , Alistair Francis , "Edgar E. Iglesias" , YannickV Subject: [PATCH v6 08/15] hw/misc: Add dummy ZYNQ DDR controller Date: Wed, 13 May 2026 12:55:10 +0200 Message-ID: <20260513105517.146706-9-corvin.koehne@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260513105517.146706-1-corvin.koehne@gmail.com> References: <20260513105517.146706-1-corvin.koehne@gmail.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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=corvin.koehne@gmail.com; helo=mail-wm1-x32d.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @gmail.com) X-ZM-MESSAGEID: 1778669940686158500 Content-Type: text/plain; charset="utf-8" From: YannickV A dummy DDR controller for ZYNQ has been added. While all registers are pre= sent, not all are functional. Read and write access is validated, and the user mo= de can be set. This provides a basic DDR controller initialization, preventing system hangs due to endless polling or similar issues. Signed-off-by: YannickV --- hw/arm/xilinx_zynq.c | 16 +- hw/misc/Kconfig | 3 + hw/misc/meson.build | 1 + hw/misc/xlnx-zynq-ddrc.c | 413 +++++++++++++++++++++++++++++++ include/hw/misc/xlnx-zynq-ddrc.h | 148 +++++++++++ 5 files changed, 578 insertions(+), 3 deletions(-) create mode 100644 hw/misc/xlnx-zynq-ddrc.c create mode 100644 include/hw/misc/xlnx-zynq-ddrc.h diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c index 9dcded9219..66a4480cc8 100644 --- a/hw/arm/xilinx_zynq.c +++ b/hw/arm/xilinx_zynq.c @@ -201,6 +201,17 @@ static void zynq_set_boot_mode(Object *obj, const char= *str, m->boot_mode =3D mode; } =20 +static void ddr_ctrl_init(uint32_t base) +{ + DeviceState *dev; + SysBusDevice *busdev; + + dev =3D qdev_new("zynq.ddr-ctlr"); + busdev =3D SYS_BUS_DEVICE(dev); + sysbus_realize_and_unref(busdev, &error_fatal); + sysbus_mmio_map(busdev, 0, base); +} + static void zynq_init(MachineState *machine) { ZynqMachineState *zynq_machine =3D ZYNQ_MACHINE(machine); @@ -312,6 +323,8 @@ static void zynq_init(MachineState *machine) sysbus_create_varargs("cadence_ttc", 0xF8002000, pic[69-GIC_INTERNAL], pic[70-GIC_INTERNAL], pic[71-GIC_INTERNA= L], NULL); =20 + ddr_ctrl_init(0xF8006000); + gem_init(0xE000B000, pic[54 - GIC_INTERNAL]); gem_init(0xE000C000, pic[77 - GIC_INTERNAL]); =20 @@ -393,9 +406,6 @@ static void zynq_init(MachineState *machine) /* System Watchdog Timer Registers */ create_unimplemented_device("zynq.swdt", 0xF8005000, 4 * KiB); =20 - /* DDR memory controller */ - create_unimplemented_device("zynq.ddrc", 0xF8006000, 4 * KiB); - /* AXI_HP Interface (AFI) */ create_unimplemented_device("zynq.axi_hp0", 0xF8008000, 0x28); create_unimplemented_device("zynq.axi_hp1", 0xF8009000, 0x28); diff --git a/hw/misc/Kconfig b/hw/misc/Kconfig index 99bdf09219..1543ee6653 100644 --- a/hw/misc/Kconfig +++ b/hw/misc/Kconfig @@ -254,4 +254,7 @@ config IOSB config XLNX_VERSAL_TRNG bool =20 +config XLNX_ZYNQ_DDRC + bool + source macio/Kconfig diff --git a/hw/misc/meson.build b/hw/misc/meson.build index fa6a961ac9..3b7f908d9d 100644 --- a/hw/misc/meson.build +++ b/hw/misc/meson.build @@ -97,6 +97,7 @@ system_ss.add(when: 'CONFIG_RASPI', if_true: files( )) system_ss.add(when: 'CONFIG_SLAVIO', if_true: files('slavio_misc.c')) system_ss.add(when: 'CONFIG_ZYNQ', if_true: files('zynq_slcr.c')) +system_ss.add(when: 'CONFIG_ZYNQ', if_true: files('xlnx-zynq-ddrc.c')) system_ss.add(when: 'CONFIG_XLNX_ZYNQMP_ARM', if_true: files('xlnx-zynqmp-= crf.c')) system_ss.add(when: 'CONFIG_XLNX_ZYNQMP_ARM', if_true: files('xlnx-zynqmp-= apu-ctrl.c')) system_ss.add(when: 'CONFIG_XLNX_VERSAL', if_true: files( diff --git a/hw/misc/xlnx-zynq-ddrc.c b/hw/misc/xlnx-zynq-ddrc.c new file mode 100644 index 0000000000..3a41180f5c --- /dev/null +++ b/hw/misc/xlnx-zynq-ddrc.c @@ -0,0 +1,413 @@ +/* + * QEMU model of the Xilinx Zynq Double Data Rate Controller + * + * Copyright (c) Beckhoff Automation GmbH. & Co. KG + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "hw/core/sysbus.h" +#include "hw/core/register.h" +#include "qemu/bitops.h" +#include "qemu/log.h" +#include "qapi/error.h" +#include "hw/core/registerfields.h" +#include "system/block-backend.h" +#include "system/address-spaces.h" +#include "system/memory.h" +#include "system/dma.h" +#include "hw/misc/xlnx-zynq-ddrc.h" +#include "migration/vmstate.h" + +#ifndef DDRCTRL_ERR_DEBUG +#define DDRCTRL_ERR_DEBUG 0 +#endif + +static void zynq_ddrctrl_post_write(RegisterInfo *reg, uint64_t val) +{ + DDRCTRLState *s =3D DDRCTRL(reg->opaque); + if (reg->access->addr =3D=3D A_DDRC_CTRL) { + if (val & 0x1) { + s->reg[R_MODE_STS_REG] |=3D + (R_MODE_STS_REG_DDR_REG_OPERATING_MODE_MASK & 0x1); + } else { + s->reg[R_MODE_STS_REG] &=3D + ~R_MODE_STS_REG_DDR_REG_OPERATING_MODE_MASK; + } + } +} + +static const RegisterAccessInfo xlnx_zynq_ddrc_regs_info[] =3D { + /* 0x00 - 0x3C: Basic DDRC control and config */ + { .name =3D "DDRC_CTRL", + .addr =3D A_DDRC_CTRL, + .reset =3D 0x00000200, + .post_write =3D zynq_ddrctrl_post_write }, + { .name =3D "TWO_RANK_CFG", + .addr =3D A_TWO_RANK_CFG, + .reset =3D 0x000C1076 }, + { .name =3D "HPR_REG", + .addr =3D A_HPR_REG, + .reset =3D 0x03C0780F }, + { .name =3D "LPR_REG", + .addr =3D A_LPR_REG, + .reset =3D 0x03C0780F }, + { .name =3D "WR_REG", + .addr =3D A_WR_REG, + .reset =3D 0x0007F80F }, + { .name =3D "DRAM_PARAM_REG0", + .addr =3D A_DRAM_PARAM_REG0, + .reset =3D 0x00041016 }, + { .name =3D "DRAM_PARAM_REG1", + .addr =3D A_DRAM_PARAM_REG1, + .reset =3D 0x351B48D9 }, + { .name =3D "DRAM_PARAM_REG2", + .addr =3D A_DRAM_PARAM_REG2, + .reset =3D 0x83015904 }, + { .name =3D "DRAM_PARAM_REG3", + .addr =3D A_DRAM_PARAM_REG3, + .reset =3D 0x250882D0 }, + { .name =3D "DRAM_PARAM_REG4", + .addr =3D A_DRAM_PARAM_REG4, + .reset =3D 0x0000003C }, + { .name =3D "DRAM_INIT_PARAM", + .addr =3D A_DRAM_INIT_PARAM, + .reset =3D 0x00002007 }, + { .name =3D "DRAM_EMR_REG", + .addr =3D A_DRAM_EMR_REG, + .reset =3D 0x00000008 }, + { .name =3D "DRAM_EMR_MR_REG", + .addr =3D A_DRAM_EMR_MR_REG, + .reset =3D 0x00000940 }, + { .name =3D "DRAM_BURST8_RDWR", + .addr =3D A_DRAM_BURST8_RDWR, + .reset =3D 0x00020034 }, + { .name =3D "DRAM_DISABLE_DQ", + .addr =3D A_DRAM_DISABLE_DQ }, + { .name =3D "DRAM_ADDR_MAP_BANK", + .addr =3D A_DRAM_ADDR_MAP_BANK, + .reset =3D 0x00000F77 }, + { .name =3D "DRAM_ADDR_MAP_COL", + .addr =3D A_DRAM_ADDR_MAP_COL, + .reset =3D 0xFFF00000 }, + { .name =3D "DRAM_ADDR_MAP_ROW", + .addr =3D A_DRAM_ADDR_MAP_ROW, + .reset =3D 0x0FF55555 }, + { .name =3D "DRAM_ODT_REG", + .addr =3D A_DRAM_ODT_REG, + .reset =3D 0x00000249 }, + + /* 0x4C - 0x5C: PHY and DLL */ + { .name =3D "PHY_DBG_REG", + .addr =3D A_PHY_DBG_REG }, + { .name =3D "PHY_CMD_TIMEOUT_RDDATA_CPT", + .addr =3D A_PHY_CMD_TIMEOUT_RDDATA_CPT, + .reset =3D 0x00010200 }, + { .name =3D "MODE_STS_REG", + .addr =3D A_MODE_STS_REG }, + { .name =3D "DLL_CALIB", + .addr =3D A_DLL_CALIB, + .reset =3D 0x00000101 }, + { .name =3D "ODT_DELAY_HOLD", + .addr =3D A_ODT_DELAY_HOLD, + .reset =3D 0x00000023 }, + + /* 0x60 - 0x7C: Control registers */ + { .name =3D "CTRL_REG1", + .addr =3D A_CTRL_REG1, + .reset =3D 0x0000003E }, + { .name =3D "CTRL_REG2", + .addr =3D A_CTRL_REG2, + .reset =3D 0x00020000 }, + { .name =3D "CTRL_REG3", + .addr =3D A_CTRL_REG3, + .reset =3D 0x00284027 }, + { .name =3D "CTRL_REG4", + .addr =3D A_CTRL_REG4, + .reset =3D 0x00001610 }, + { .name =3D "CTRL_REG5", + .addr =3D A_CTRL_REG5, + .reset =3D 0x00455111 }, + { .name =3D "CTRL_REG6", + .addr =3D A_CTRL_REG6, + .reset =3D 0x00032222 }, + + /* 0xA0 - 0xB4: Refresh, ZQ, powerdown, misc */ + { .name =3D "CHE_REFRESH_TIMER0", + .addr =3D A_CHE_REFRESH_TIMER0, + .reset =3D 0x00008000 }, + { .name =3D "CHE_T_ZQ", + .addr =3D A_CHE_T_ZQ, + .reset =3D 0x10300802 }, + { .name =3D "CHE_T_ZQ_SHORT_INTERVAL_REG", + .addr =3D A_CHE_T_ZQ_SHORT_INTERVAL_REG, + .reset =3D 0x0020003A }, + { .name =3D "DEEP_PWRDWN_REG", + .addr =3D A_DEEP_PWRDWN_REG }, + { .name =3D "REG_2C", + .addr =3D A_REG_2C }, + { .name =3D "REG_2D", + .addr =3D A_REG_2D, + .reset =3D 0x00000200 }, + + /* 0xB8 - 0xF8: ECC, DFI, etc. */ + { .name =3D "DFI_TIMING", + .addr =3D A_DFI_TIMING, + .reset =3D 0x00200067 }, + { .name =3D "CHE_ECC_CONTROL_REG_OFFSET", + .addr =3D A_CHE_ECC_CONTROL_REG_OFFSET }, + { .name =3D "CHE_CORR_ECC_LOG_REG_OFFSET", + .addr =3D A_CHE_CORR_ECC_LOG_REG_OFFSET }, + { .name =3D "CHE_CORR_ECC_ADDR_REG_OFFSET", + .addr =3D A_CHE_CORR_ECC_ADDR_REG_OFFSET }, + { .name =3D "CHE_CORR_ECC_DATA_31_0_REG_OFFSET", + .addr =3D A_CHE_CORR_ECC_DATA_31_0_REG_OFFSET }, + { .name =3D "CHE_CORR_ECC_DATA_63_32_REG_OFFSET", + .addr =3D A_CHE_CORR_ECC_DATA_63_32_REG_OFFSET }, + { .name =3D "CHE_CORR_ECC_DATA_71_64_REG_OFFSET", + .addr =3D A_CHE_CORR_ECC_DATA_71_64_REG_OFFSET }, + { .name =3D "CHE_UNCORR_ECC_LOG_REG_OFFSET", + .addr =3D A_CHE_UNCORR_ECC_LOG_REG_OFFSET }, + { .name =3D "CHE_UNCORR_ECC_ADDR_REG_OFFSET", + .addr =3D A_CHE_UNCORR_ECC_ADDR_REG_OFFSET }, + { .name =3D "CHE_UNCORR_ECC_DATA_31_0_REG_OFFSET", + .addr =3D A_CHE_UNCORR_ECC_DATA_31_0_REG_OFFSET }, + { .name =3D "CHE_UNCORR_ECC_DATA_63_32_REG_OFFSET", + .addr =3D A_CHE_UNCORR_ECC_DATA_63_32_REG_OFFSET }, + { .name =3D "CHE_UNCORR_ECC_DATA_71_64_REG_OFFSET", + .addr =3D A_CHE_UNCORR_ECC_DATA_71_64_REG_OFFSET }, + { .name =3D "CHE_ECC_STATS_REG_OFFSET", + .addr =3D A_CHE_ECC_STATS_REG_OFFSET }, + { .name =3D "ECC_SCRUB", + .addr =3D A_ECC_SCRUB, + .reset =3D 0x00000008 }, + { .name =3D "CHE_ECC_CORR_BIT_MASK_31_0_REG_OFFSET", + .addr =3D A_CHE_ECC_CORR_BIT_MASK_31_0_REG_OFFSET }, + { .name =3D "CHE_ECC_CORR_BIT_MASK_63_32_REG_OFFSET", + .addr =3D A_CHE_ECC_CORR_BIT_MASK_63_32_REG_OFFSET }, + + /* 0x114 - 0x174: PHY config, ratios, DQS, WE */ + { .name =3D "PHY_RCVER_ENABLE", + .addr =3D A_PHY_RCVER_ENABLE }, + { .name =3D "PHY_CONFIG0", + .addr =3D A_PHY_CONFIG0, + .reset =3D 0x40000001 }, + { .name =3D "PHY_CONFIG1", + .addr =3D A_PHY_CONFIG1, + .reset =3D 0x40000001 }, + { .name =3D "PHY_CONFIG2", + .addr =3D A_PHY_CONFIG2, + .reset =3D 0x40000001 }, + { .name =3D "PHY_CONFIG3", + .addr =3D A_PHY_CONFIG3, + .reset =3D 0x40000001 }, + { .name =3D "PHY_INIT_RATIO0", + .addr =3D A_PHY_INIT_RATIO0 }, + { .name =3D "PHY_INIT_RATIO1", + .addr =3D A_PHY_INIT_RATIO1 }, + { .name =3D "PHY_INIT_RATIO2", + .addr =3D A_PHY_INIT_RATIO2 }, + { .name =3D "PHY_INIT_RATIO3", + .addr =3D A_PHY_INIT_RATIO3 }, + { .name =3D "PHY_RD_DQS_CFG0", + .addr =3D A_PHY_RD_DQS_CFG0, + .reset =3D 0x00000040 }, + { .name =3D "PHY_RD_DQS_CFG1", + .addr =3D A_PHY_RD_DQS_CFG1, + .reset =3D 0x00000040 }, + { .name =3D "PHY_RD_DQS_CFG2", + .addr =3D A_PHY_RD_DQS_CFG2, + .reset =3D 0x00000040 }, + { .name =3D "PHY_RD_DQS_CFG3", + .addr =3D A_PHY_RD_DQS_CFG3, + .reset =3D 0x00000040 }, + { .name =3D "PHY_WR_DQS_CFG0", + .addr =3D A_PHY_WR_DQS_CFG0 }, + { .name =3D "PHY_WR_DQS_CFG1", + .addr =3D A_PHY_WR_DQS_CFG1 }, + { .name =3D "PHY_WR_DQS_CFG2", + .addr =3D A_PHY_WR_DQS_CFG2 }, + { .name =3D "PHY_WR_DQS_CFG3", + .addr =3D A_PHY_WR_DQS_CFG3 }, + { .name =3D "PHY_WE_CFG0", + .addr =3D A_PHY_WE_CFG0, + .reset =3D 0x00000040 }, + { .name =3D "PHY_WE_CFG1", + .addr =3D A_PHY_WE_CFG1, + .reset =3D 0x00000040 }, + { .name =3D "PHY_WE_CFG2", + .addr =3D A_PHY_WE_CFG2, + .reset =3D 0x00000040 }, + { .name =3D "PHY_WE_CFG3", + .addr =3D A_PHY_WE_CFG3, + .reset =3D 0x00000040 }, + + /* 0x17C - 0x194: Write data slaves, misc */ + { .name =3D "WR_DATA_SLV0", + .addr =3D A_WR_DATA_SLV0, + .reset =3D 0x00000080 }, + { .name =3D "WR_DATA_SLV1", + .addr =3D A_WR_DATA_SLV1, + .reset =3D 0x00000080 }, + { .name =3D "WR_DATA_SLV2", + .addr =3D A_WR_DATA_SLV2, + .reset =3D 0x00000080 }, + { .name =3D "WR_DATA_SLV3", + .addr =3D A_WR_DATA_SLV3, + .reset =3D 0x00000080 }, + { .name =3D "REG_64", + .addr =3D A_REG_64, + .reset =3D 0x10020000 }, + { .name =3D "REG_65", + .addr =3D A_REG_65 }, + + /* 0x1A4 - 0x1C4: Misc registers */ + { .name =3D "REG69_6A0", + .addr =3D A_REG69_6A0 }, + { .name =3D "REG69_6A1", + .addr =3D A_REG69_6A1 }, + { .name =3D "REG6C_6D2", + .addr =3D A_REG6C_6D2 }, + { .name =3D "REG6C_6D3", + .addr =3D A_REG6C_6D3 }, + { .name =3D "REG6E_710", + .addr =3D A_REG6E_710 }, + { .name =3D "REG6E_711", + .addr =3D A_REG6E_711 }, + { .name =3D "REG6E_712", + .addr =3D A_REG6E_712 }, + { .name =3D "REG6E_713", + .addr =3D A_REG6E_713 }, + + /* 0x1CC - 0x1E8: DLL, PHY status */ + { .name =3D "PHY_DLL_STS0", + .addr =3D A_PHY_DLL_STS0 }, + { .name =3D "PHY_DLL_STS1", + .addr =3D A_PHY_DLL_STS1 }, + { .name =3D "PHY_DLL_STS2", + .addr =3D A_PHY_DLL_STS2 }, + { .name =3D "PHY_DLL_STS3", + .addr =3D A_PHY_DLL_STS3 }, + { .name =3D "DLL_LOCK_STS", + .addr =3D A_DLL_LOCK_STS }, + { .name =3D "PHY_CTRL_STS", + .addr =3D A_PHY_CTRL_STS }, + { .name =3D "PHY_CTRL_STS_REG2", + .addr =3D A_PHY_CTRL_STS_REG2 }, + + /* 0x200 - 0x2B4: AXI, LPDDR, misc */ + { .name =3D "AXI_ID", + .addr =3D A_AXI_ID }, + { .name =3D "PAGE_MASK", + .addr =3D A_PAGE_MASK }, + { .name =3D "AXI_PRIORITY_WR_PORT0", + .addr =3D A_AXI_PRIORITY_WR_PORT0, + .reset =3D 0x000803FF }, + { .name =3D "AXI_PRIORITY_WR_PORT1", + .addr =3D A_AXI_PRIORITY_WR_PORT1, + .reset =3D 0x000803FF }, + { .name =3D "AXI_PRIORITY_WR_PORT2", + .addr =3D A_AXI_PRIORITY_WR_PORT2, + .reset =3D 0x000803FF }, + { .name =3D "AXI_PRIORITY_WR_PORT3", + .addr =3D A_AXI_PRIORITY_WR_PORT3, + .reset =3D 0x000803FF }, + { .name =3D "AXI_PRIORITY_RD_PORT0", + .addr =3D A_AXI_PRIORITY_RD_PORT0, + .reset =3D 0x000003FF }, + { .name =3D "AXI_PRIORITY_RD_PORT1", + .addr =3D A_AXI_PRIORITY_RD_PORT1, + .reset =3D 0x000003FF }, + { .name =3D "AXI_PRIORITY_RD_PORT2", + .addr =3D A_AXI_PRIORITY_RD_PORT2, + .reset =3D 0x000003FF }, + { .name =3D "AXI_PRIORITY_RD_PORT3", + .addr =3D A_AXI_PRIORITY_RD_PORT3, + .reset =3D 0x000003FF }, + { .name =3D "EXCL_ACCESS_CFG0", + .addr =3D A_EXCL_ACCESS_CFG0 }, + { .name =3D "EXCL_ACCESS_CFG1", + .addr =3D A_EXCL_ACCESS_CFG1 }, + { .name =3D "EXCL_ACCESS_CFG2", + .addr =3D A_EXCL_ACCESS_CFG2 }, + { .name =3D "EXCL_ACCESS_CFG3", + .addr =3D A_EXCL_ACCESS_CFG3 }, + { .name =3D "MODE_REG_READ", + .addr =3D A_MODE_REG_READ }, + { .name =3D "LPDDR_CTRL0", + .addr =3D A_LPDDR_CTRL0 }, + { .name =3D "LPDDR_CTRL1", + .addr =3D A_LPDDR_CTRL1 }, + { .name =3D "LPDDR_CTRL2", + .addr =3D A_LPDDR_CTRL2, + .reset =3D 0x003C0015 }, + { .name =3D "LPDDR_CTRL3", + .addr =3D A_LPDDR_CTRL3, + .reset =3D 0x00000601 }, +}; + +static void zynq_ddrctrl_reset(DeviceState *dev) +{ + DDRCTRLState *s =3D DDRCTRL(dev); + int i; + + for (i =3D 0; i < ZYNQ_DDRCTRL_NUM_REG; ++i) { + register_reset(&s->regs_info[i]); + } +} + +static const MemoryRegionOps ddrctrl_ops =3D { + .read =3D register_read_memory, + .write =3D register_write_memory, + .endianness =3D DEVICE_LITTLE_ENDIAN, +}; + +static const VMStateDescription vmstate_zynq_ddrctrl =3D { + .name =3D "zynq_ddrc", + .version_id =3D 1, + .minimum_version_id =3D 1, + .fields =3D (const VMStateField[]) { + VMSTATE_UINT32_ARRAY(reg, DDRCTRLState, ZYNQ_DDRCTRL_NUM_REG), + VMSTATE_END_OF_LIST() + } +}; + +static void zynq_ddrctrl_init(Object *obj) +{ + SysBusDevice *sbd =3D SYS_BUS_DEVICE(obj); + DDRCTRLState *s =3D DDRCTRL(obj); + + s->reg_array =3D + register_init_block32(DEVICE(obj), xlnx_zynq_ddrc_regs_info, + ARRAY_SIZE(xlnx_zynq_ddrc_regs_info), + s->regs_info, s->reg, + &ddrctrl_ops, + DDRCTRL_ERR_DEBUG, + ZYNQ_DDRCTRL_MMIO_SIZE); + + sysbus_init_mmio(sbd, &s->reg_array->mem); +} + +static void zynq_ddrctrl_class_init(ObjectClass *klass, const void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + + device_class_set_legacy_reset(dc, zynq_ddrctrl_reset); + dc->vmsd =3D &vmstate_zynq_ddrctrl; +} + +static const TypeInfo ddrctrl_info =3D { + .name =3D TYPE_DDRCTRL, + .parent =3D TYPE_SYS_BUS_DEVICE, + .instance_size =3D sizeof(DDRCTRLState), + .instance_init =3D zynq_ddrctrl_init, + .class_init =3D zynq_ddrctrl_class_init, +}; + +static void ddrctrl_register_types(void) +{ + type_register_static(&ddrctrl_info); +} + +type_init(ddrctrl_register_types) diff --git a/include/hw/misc/xlnx-zynq-ddrc.h b/include/hw/misc/xlnx-zynq-d= drc.h new file mode 100644 index 0000000000..9f9bb31c69 --- /dev/null +++ b/include/hw/misc/xlnx-zynq-ddrc.h @@ -0,0 +1,148 @@ +/* + * QEMU model of the Xilinx Zynq Double Data Rate Controller + * + * Copyright (c) Beckhoff Automation GmbH. & Co. KG + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef XLNX_ZYNQ_DDRC_H +#define XLNX_ZYNQ_DDRC_H + +#include "hw/core/sysbus.h" +#include "hw/core/register.h" + +#define TYPE_DDRCTRL "zynq.ddr-ctlr" +#define DDRCTRL(obj) \ + OBJECT_CHECK(DDRCTRLState, (obj), TYPE_DDRCTRL) + +REG32(DDRC_CTRL, 0x00) +REG32(TWO_RANK_CFG, 0x04) +REG32(HPR_REG, 0x08) +REG32(LPR_REG, 0x0C) +REG32(WR_REG, 0x10) +REG32(DRAM_PARAM_REG0, 0x14) +REG32(DRAM_PARAM_REG1, 0x18) +REG32(DRAM_PARAM_REG2, 0x1C) +REG32(DRAM_PARAM_REG3, 0x20) +REG32(DRAM_PARAM_REG4, 0x24) +REG32(DRAM_INIT_PARAM, 0x28) +REG32(DRAM_EMR_REG, 0x2C) +REG32(DRAM_EMR_MR_REG, 0x30) +REG32(DRAM_BURST8_RDWR, 0x34) +REG32(DRAM_DISABLE_DQ, 0x38) +REG32(DRAM_ADDR_MAP_BANK, 0x3C) +REG32(DRAM_ADDR_MAP_COL, 0x40) +REG32(DRAM_ADDR_MAP_ROW, 0x44) +REG32(DRAM_ODT_REG, 0x48) +REG32(PHY_DBG_REG, 0x4C) +REG32(PHY_CMD_TIMEOUT_RDDATA_CPT, 0x50) +REG32(MODE_STS_REG, 0x54) + FIELD(MODE_STS_REG, DDR_REG_DBG_STALL, 3, 3) + FIELD(MODE_STS_REG, DDR_REG_OPERATING_MODE, 0, 2) +REG32(DLL_CALIB, 0x58) +REG32(ODT_DELAY_HOLD, 0x5C) +REG32(CTRL_REG1, 0x60) +REG32(CTRL_REG2, 0x64) +REG32(CTRL_REG3, 0x68) +REG32(CTRL_REG4, 0x6C) +REG32(CTRL_REG5, 0x78) +REG32(CTRL_REG6, 0x7C) +REG32(CHE_REFRESH_TIMER0, 0xA0) +REG32(CHE_T_ZQ, 0xA4) +REG32(CHE_T_ZQ_SHORT_INTERVAL_REG, 0xA8) +REG32(DEEP_PWRDWN_REG, 0xAC) +REG32(REG_2C, 0xB0) +REG32(REG_2D, 0xB4) +REG32(DFI_TIMING, 0xB8) +REG32(CHE_ECC_CONTROL_REG_OFFSET, 0xC4) +REG32(CHE_CORR_ECC_LOG_REG_OFFSET, 0xC8) +REG32(CHE_CORR_ECC_ADDR_REG_OFFSET, 0xCC) +REG32(CHE_CORR_ECC_DATA_31_0_REG_OFFSET, 0xD0) +REG32(CHE_CORR_ECC_DATA_63_32_REG_OFFSET, 0xD4) +REG32(CHE_CORR_ECC_DATA_71_64_REG_OFFSET, 0xD8) +REG32(CHE_UNCORR_ECC_LOG_REG_OFFSET, 0xDC) +REG32(CHE_UNCORR_ECC_ADDR_REG_OFFSET, 0xE0) +REG32(CHE_UNCORR_ECC_DATA_31_0_REG_OFFSET, 0xE4) +REG32(CHE_UNCORR_ECC_DATA_63_32_REG_OFFSET, 0xE8) +REG32(CHE_UNCORR_ECC_DATA_71_64_REG_OFFSET, 0xEC) +REG32(CHE_ECC_STATS_REG_OFFSET, 0xF0) +REG32(ECC_SCRUB, 0xF4) +REG32(CHE_ECC_CORR_BIT_MASK_31_0_REG_OFFSET, 0xF8) +REG32(CHE_ECC_CORR_BIT_MASK_63_32_REG_OFFSET, 0xFC) +REG32(PHY_RCVER_ENABLE, 0x114) +REG32(PHY_CONFIG0, 0x118) +REG32(PHY_CONFIG1, 0x11C) +REG32(PHY_CONFIG2, 0x120) +REG32(PHY_CONFIG3, 0x124) +REG32(PHY_INIT_RATIO0, 0x12C) +REG32(PHY_INIT_RATIO1, 0x130) +REG32(PHY_INIT_RATIO2, 0x134) +REG32(PHY_INIT_RATIO3, 0x138) +REG32(PHY_RD_DQS_CFG0, 0x140) +REG32(PHY_RD_DQS_CFG1, 0x144) +REG32(PHY_RD_DQS_CFG2, 0x148) +REG32(PHY_RD_DQS_CFG3, 0x14C) +REG32(PHY_WR_DQS_CFG0, 0x154) +REG32(PHY_WR_DQS_CFG1, 0x158) +REG32(PHY_WR_DQS_CFG2, 0x15C) +REG32(PHY_WR_DQS_CFG3, 0x160) +REG32(PHY_WE_CFG0, 0x168) +REG32(PHY_WE_CFG1, 0x16C) +REG32(PHY_WE_CFG2, 0x170) +REG32(PHY_WE_CFG3, 0x174) +REG32(WR_DATA_SLV0, 0x17C) +REG32(WR_DATA_SLV1, 0x180) +REG32(WR_DATA_SLV2, 0x184) +REG32(WR_DATA_SLV3, 0x188) +REG32(REG_64, 0x190) +REG32(REG_65, 0x194) +REG32(REG69_6A0, 0x1A4) +REG32(REG69_6A1, 0x1A8) +REG32(REG6C_6D2, 0x1B0) +REG32(REG6C_6D3, 0x1B4) +REG32(REG6E_710, 0x1B8) +REG32(REG6E_711, 0x1BC) +REG32(REG6E_712, 0x1C0) +REG32(REG6E_713, 0x1C4) +REG32(PHY_DLL_STS0, 0x1CC) +REG32(PHY_DLL_STS1, 0x1D0) +REG32(PHY_DLL_STS2, 0x1D4) +REG32(PHY_DLL_STS3, 0x1D8) +REG32(DLL_LOCK_STS, 0x1E0) +REG32(PHY_CTRL_STS, 0x1E4) +REG32(PHY_CTRL_STS_REG2, 0x1E8) +REG32(AXI_ID, 0x200) +REG32(PAGE_MASK, 0x204) +REG32(AXI_PRIORITY_WR_PORT0, 0x208) +REG32(AXI_PRIORITY_WR_PORT1, 0x20C) +REG32(AXI_PRIORITY_WR_PORT2, 0x210) +REG32(AXI_PRIORITY_WR_PORT3, 0x214) +REG32(AXI_PRIORITY_RD_PORT0, 0x218) +REG32(AXI_PRIORITY_RD_PORT1, 0x21C) +REG32(AXI_PRIORITY_RD_PORT2, 0x220) +REG32(AXI_PRIORITY_RD_PORT3, 0x224) +REG32(EXCL_ACCESS_CFG0, 0x294) +REG32(EXCL_ACCESS_CFG1, 0x298) +REG32(EXCL_ACCESS_CFG2, 0x29C) +REG32(EXCL_ACCESS_CFG3, 0x2A0) +REG32(MODE_REG_READ, 0x2A4) +REG32(LPDDR_CTRL0, 0x2A8) +REG32(LPDDR_CTRL1, 0x2AC) +REG32(LPDDR_CTRL2, 0x2B0) +REG32(LPDDR_CTRL3, 0x2B4) + + +#define ZYNQ_DDRCTRL_MMIO_SIZE 0x400 +#define ZYNQ_DDRCTRL_NUM_REG (ZYNQ_DDRCTRL_MMIO_SIZE / 4) + +typedef struct DDRCTRLState { + SysBusDevice parent_obj; + + MemoryRegion iomem; + + RegisterInfoArray *reg_array; + uint32_t reg[ZYNQ_DDRCTRL_NUM_REG]; + RegisterInfo regs_info[ZYNQ_DDRCTRL_NUM_REG]; +} DDRCTRLState; +#endif --=20 2.47.3 From nobody Sat May 30 18:35:07 2026 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1778669956; cv=none; d=zohomail.com; s=zohoarc; b=blGqqtkvG/1VpR6HEkn5lGU6nWnBPLAbWzk9Fq/uLeJnycgJpPa5PGlsz+AVCKAn989Q/qk4gcEFxIzb7oc4sO+PvaYERaCUYbUueVcUxW1RXtAZtJ8LcTgBy/slrBaMGvSZ3GtqTbjEMWatVKUvoCTaTod7sD2SMPDTsAxzVOw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1778669956; 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=k6VI4nokCfZ+LKIGnO4eT2U19gP+31CsGFQKC59urGA=; b=mLZNKdeB7DO0UjppxQj+WF98Iacfgs84m1K3PHccjrEPTwaMiCHX++UHhs21bKwKkwcFaWEEXbbqhAl7WKgpDkwngLA8jvIKuue0zYkF/nUH3aFhEKqKCD5034KlslEpHJsczrxUD5Ge1nmcCcSdPazcP2jLUA47Oi20MxuEpKI= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1778669956483287.18548878457614; Wed, 13 May 2026 03:59:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wN7J2-0006PP-7Q; Wed, 13 May 2026 06:59:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wN7Fd-0003B2-SH for qemu-devel@nongnu.org; Wed, 13 May 2026 06:55:47 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wN7FX-0001QC-89 for qemu-devel@nongnu.org; Wed, 13 May 2026 06:55:40 -0400 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-48e56c1bf5dso40004105e9.3 for ; Wed, 13 May 2026 03:55:33 -0700 (PDT) Received: from PC-DA2D10.beckhoff.com ([195.226.174.196]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48e8f410d9fsm56062295e9.6.2026.05.13.03.55.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2026 03:55:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778669732; x=1779274532; 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=k6VI4nokCfZ+LKIGnO4eT2U19gP+31CsGFQKC59urGA=; b=BPJEblvT00vyWHz5mhhlHbPWsskL0sM/jlFYPx/QIs9+mWe3VmjicMJpUlP7ny1eTI WGPqR0cXcHzxSniovnnahHd5KnrIgeJDPauEDZNWjS3i1JKdZv5TsqPehGZR4TjkRP2K 23wQEnwlmauWuk9LoPIbE8an81Q/LW7k3wSK/JtWC5vVLWUT/HzOBOZSIkkeWPW6fqKQ 7uFGW/XgEpt5qJ93sw0bqOmisEN/kEDtA4k1aiIbpULoxDburA0nncq5Vu2QiaB1VNFm JqM0YMvfc6PsfJY9a0qo7eLRaHKgzt7HMARP0DCRkqirnKAiMFr0ombaPvhUBIu7ho+v NJug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778669732; x=1779274532; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=k6VI4nokCfZ+LKIGnO4eT2U19gP+31CsGFQKC59urGA=; b=kvzlltKONWA+HS/Ku++twVrDD2YLSmJUQ/1nTh3VK0KVMlyNuTznzH5L++U6oTOlu9 FiNnMQUZnBJ1eD+sBEaEF5jYtqq5K8V/dwQS/E2NlslQfQquZa/nEdNpfE4sPVZnhkrA gErFvJrYv6aq8XOGnrc5W1HZtOcAx+d96EOtTbY3LzpMugFjioBsi+gwHo8PURbWCWuK QtA44Qi9funvYvP9mjg5I2bTdBcz+zyRLy5zq7Ux5NHdcVHp23YVIAPl131HY4eGu7k4 zDA6Hc/X/Yj8IgUhj6MT2H/aiH3vgeVVQCSxokO7dOUDfv9LSii5uiNT05ReMSNj5KbH c57g== X-Gm-Message-State: AOJu0Yz2lU3ER9x87u1abudty+5V4GVtJ8sL5HuKiLJlh+hYYwIG8Ixp BkqRARQ0ZBXp1CJ2bPt7t2Or2ucDlanBvJq0twj+MB6ENug3mzEsq8D8uOBEbgQy X-Gm-Gg: Acq92OHPj3cN6apam9s849y9+3orfepqPEzDaTgmu9WO52+LGtNsHudkrtuoPUby1vw 3kPOAJnipv0RqaF4RJIuC2IHKBKj34kL2kG/FW4NvB3N5rFoLzvlyQtJFROLGGHgdr41ko39AHH 8c37HGNg3cYShcz5kMQyel/D3qxkUAlq6P35/iVL6CEh/md98Ip1fCAxNWJ7H+QlpFOCDu4U0aU EAO7Nm0Y+W2y71VtvQV+WqUXNuNtLPXGx22l8FL8BfkleyVAtSiRVOfr/1wboNaSrFZAQcVjK/J rtSfWcwW9BYJiQ9xbzWiC5yKypMLjcpD3sYBap7tdWgI3fHTP2cIqVfCqc7NAk+NEQQFL8NJyZu 5h1NLNosvLS2LWwpRoYdo5eJ94C48xIodxhSolaNLr8zJSym6ssSSH4yIQmyjkTIuBytpsu0Uc0 qOu886oqwbhXw1l00Hlg3TuWtAdxTiz4MR6iNp56xQh5E3 X-Received: by 2002:a05:600c:468e:b0:48a:6fd4:d3d3 with SMTP id 5b1f17b1804b1-48fc9a3d8c5mr36985055e9.20.1778669732417; Wed, 13 May 2026 03:55:32 -0700 (PDT) From: =?UTF-8?q?Corvin=20K=C3=B6hne?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Hanna Reitz , Kevin Wolf , qemu-arm@nongnu.org, =?UTF-8?q?Corvin=20K=C3=B6hne?= , Peter Maydell , Paolo Bonzini , Pierrick Bouvier , =?UTF-8?q?Yannick=20Vo=C3=9Fen?= , Alistair Francis , "Edgar E. Iglesias" , YannickV , "Edgar E. Iglesias" Subject: [PATCH v6 09/15] hw/misc/zynq_slcr: Add logic for DCI configuration Date: Wed, 13 May 2026 12:55:11 +0200 Message-ID: <20260513105517.146706-10-corvin.koehne@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260513105517.146706-1-corvin.koehne@gmail.com> References: <20260513105517.146706-1-corvin.koehne@gmail.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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=corvin.koehne@gmail.com; helo=mail-wm1-x330.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: qemu development 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 @gmail.com) X-ZM-MESSAGEID: 1778669956730158500 Content-Type: text/plain; charset="utf-8" From: YannickV The registers for the digitally controlled impedance (DCI) clock are part of the system level control registers (SLCR). The DONE bit in the status register indicates a successfull DCI calibration. An description of the calibration process can be found here: https://docs.amd.com/r/en-US/ug585-zynq-7000-SoC-TRM/DDR-IOB-Impedance-Cali= bration The DCI control register and status register have been added. As soon as the ENABLE and RESET bit are set, the RESET bit has also been toggled to 0 before and the UPDATE_CONTROL is not set, the DONE bit in the status register is set. If these bits change the DONE bit is reset. Note that the option bits are not taken into consideration. Signed-off-by: YannickV Reviewed-by: Edgar E. Iglesias --- hw/misc/zynq_slcr.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/hw/misc/zynq_slcr.c b/hw/misc/zynq_slcr.c index faae98fa02..0ae5d607be 100644 --- a/hw/misc/zynq_slcr.c +++ b/hw/misc/zynq_slcr.c @@ -180,6 +180,12 @@ REG32(GPIOB_CFG_HSTL, 0xb14) REG32(GPIOB_DRVR_BIAS_CTRL, 0xb18) =20 REG32(DDRIOB, 0xb40) +REG32(DDRIOB_DCI_CTRL, 0xb70) + FIELD(DDRIOB_DCI_CTRL, RESET, 0, 1) + FIELD(DDRIOB_DCI_CTRL, ENABLE, 1, 1) + FIELD(DDRIOB_DCI_CTRL, UPDATE_CONTROL, 20, 1) +REG32(DDRIOB_DCI_STATUS, 0xb74) + FIELD(DDRIOB_DCI_STATUS, DONE, 13, 1) #define DDRIOB_LENGTH 14 =20 #define ZYNQ_SLCR_MMIO_SIZE 0x1000 @@ -193,6 +199,8 @@ struct ZynqSLCRState { =20 MemoryRegion iomem; =20 + bool ddriob_dci_ctrl_reset_toggled; + uint32_t regs[ZYNQ_SLCR_NUM_REGS]; =20 Clock *ps_clk; @@ -331,6 +339,8 @@ static void zynq_slcr_reset_init(Object *obj, ResetType= type) =20 DB_PRINT("RESET\n"); =20 + s->ddriob_dci_ctrl_reset_toggled =3D false; + s->regs[R_LOCKSTA] =3D 1; /* 0x100 - 0x11C */ s->regs[R_ARM_PLL_CTRL] =3D 0x0001A008; @@ -418,6 +428,8 @@ static void zynq_slcr_reset_init(Object *obj, ResetType= type) s->regs[R_DDRIOB + 4] =3D s->regs[R_DDRIOB + 5] =3D s->regs[R_DDRIOB += 6] =3D 0x00000e00; s->regs[R_DDRIOB + 12] =3D 0x00000021; + + s->regs[R_DDRIOB_DCI_CTRL] =3D 0x00000020; } =20 static void zynq_slcr_reset_hold(Object *obj, ResetType type) @@ -554,6 +566,25 @@ static void zynq_slcr_write(void *opaque, hwaddr offse= t, (int)offset, (unsigned)val & 0xFFFF); } return; + + case R_DDRIOB_DCI_CTRL: + if (!FIELD_EX32(val, DDRIOB_DCI_CTRL, RESET) && + FIELD_EX32(s->regs[R_DDRIOB_DCI_CTRL], DDRIOB_DCI_CTRL, RESET)= ) { + + s->ddriob_dci_ctrl_reset_toggled =3D true; + DB_PRINT("DDRIOB DCI CTRL RESET was toggled\n"); + } + + if (FIELD_EX32(val, DDRIOB_DCI_CTRL, ENABLE) && + FIELD_EX32(val, DDRIOB_DCI_CTRL, RESET) && + !FIELD_EX32(val, DDRIOB_DCI_CTRL, UPDATE_CONTROL) && + s->ddriob_dci_ctrl_reset_toggled) { + + s->regs[R_DDRIOB_DCI_STATUS] |=3D R_DDRIOB_DCI_STATUS_DONE_MAS= K; + } else { + s->regs[R_DDRIOB_DCI_STATUS] &=3D ~R_DDRIOB_DCI_STATUS_DONE_MA= SK; + } + break; } =20 if (s->regs[R_LOCKSTA]) { --=20 2.47.3 From nobody Sat May 30 18:35:07 2026 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1778669860; cv=none; d=zohomail.com; s=zohoarc; b=TdPxYd0mgZG9SGJjNaxNgxE1qF07cfgLRLdKAj4o99WDqZsHcufZpj5DXGu0EIwFKBP8a76boyDq24BVJDyYm5QYL5lrVnBiCg5DG69SlbJOrE3xnHZvoRfKudjDAOJpU9tz5IdLjz+L6C3KQP4mBHIbVs51JzeJFRX24vu2sFk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1778669860; 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=fFbMJnTEsCC1r8PkjEmqH4GX8V4YsZPmK0Ug1b+QLeY=; b=CbiHr76o961KcUeExeiuZQZEuX60F+hRHrlL40aXHpKnF/JBFynSKHVJFQx/I9B2l4DxlVqUG5W5jej7yHzf9KcDtjyYIJgAM+VsqXJmFWaopPXkSv3IULZNjFuoOPxDb6OqgXrL7CmwYxDijmydy9Ls4PJUgHbd74noGt4m0ZA= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1778669860956248.25911210758943; Wed, 13 May 2026 03:57:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wN7H2-0003oP-4F; Wed, 13 May 2026 06:57:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wN7Fe-0003BB-Hm for qemu-devel@nongnu.org; Wed, 13 May 2026 06:55:47 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wN7FY-0001Qc-Sa for qemu-devel@nongnu.org; Wed, 13 May 2026 06:55:41 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4890d945eb4so42472065e9.0 for ; Wed, 13 May 2026 03:55:34 -0700 (PDT) Received: from PC-DA2D10.beckhoff.com ([195.226.174.196]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48e8f410d9fsm56062295e9.6.2026.05.13.03.55.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2026 03:55:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778669733; x=1779274533; 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=fFbMJnTEsCC1r8PkjEmqH4GX8V4YsZPmK0Ug1b+QLeY=; b=SnsxL7iLISQa5MltajR+eCkOQ24C6dkEPVhB+Zkr45gu4vJb5BCFIP4AGL/47Y7z2S jGK61io4ZE8DZagwJvmA+51Ue1MvIB7zgTV0Vx5yTDVBdihrFub2TosFclMcBONVI7sm kM6hYXI77m+3+LTsvRapHz+TP2M9uD1mMzV+8S0CRSjw0dEBPtzvVc2eFyzRlt07FnUL awzqFtEoSiTraehiZf8I8yQGaaMUH2wU1Zc1slj8kY7SUDuxZqGSVj1CrTFS9D0rx4g0 i9JJkhNyCPCQ+v8WjHdh+H4p2qSpwm/ThC/ZIXyculGPdpWeZGaGGEn2l3Y0fisnnGt+ 90rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778669733; x=1779274533; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=fFbMJnTEsCC1r8PkjEmqH4GX8V4YsZPmK0Ug1b+QLeY=; b=hyKY5NkijEJr57O1JfA2isg3zVSfuKA3UAv9s6NX/ocal+6xGibI9cqOVTddf+R6o9 8Nh573Wo6L3MPJlBZ3ng8pqfXlJfyi6tZ/9w6muOuRrJHD/QABCme7JYEXDSe3PdhEaw 3FaUEfY2mXjMIRSj+QrZp8FLK/9Xu1MsH+hohcutTy0Pgs1hePweqBRab4z5tM4izCEc IjDJ4cIv+HBinnU/Qi++lHDYs8p+SoKU2v+Ye2Y2y5iToFZJ3Eu9RXJcFLChplZcir+S p4/1WbzXyiAGEx9kvz8DQWxWeKVAr5e/kWWWS//GWk0w6FFwJmLCkUIDExJn6eHLQ0yO WslQ== X-Gm-Message-State: AOJu0Yy8ezFaFNFW4Aorp1Jr/8z8eOEp19n10Yk5CMVhxr1MuqrdIhbk rPY5f1HzyEia9bfJ4JEVc8X7r8PLm/7A1wtdCg9uVDKhFeUxr1QdFw3Hbj6UNH3O X-Gm-Gg: Acq92OHXa10wUso1vRqoHqj/Z7j2wBmOh9Fb4qD3fmSfFL169Rx21sccktI2zGcNxG2 aum2jdGi7jqYEXjVBxhi4/YMlIvouDDcwD3FdYoRfLScCcELYv7x/zZ3Dkk94eIpbPJEGxKrZDp /8pk9x9Q578aH4uWLsFto+K4+q8RY6kcDI2seN1tEjH5Ml3+yM3jDgJQ0uk+65PjNOyewqLroSi sWBdX9JJCMCWpOkYzIZdMBU5LGuj1G6yqA8spBxTwMzbrAbPSYHjCPnvB6dhfm/MM2kT7UYB6+H SzwkYG6xtjp4Eoelx4PIY+7NMJDGlGH9yyj4+/F1RA3Sz6+nKPD65fLYVHXKOqNbaZm1e5Q6jRI oEPYfv3SJYoPBwBw4sLB/UcB/vuRxdm+skM2If33zHkkVU7efFt311IYD/rV5O7t5AVF7e1cSyz s03gesaG1H1KwYJg7l3ykBOa6NCGY3sooa1e095Lyn9F4w X-Received: by 2002:a05:600c:45cd:b0:485:3c2e:60d5 with SMTP id 5b1f17b1804b1-48fc971f0ecmr39912515e9.2.1778669733523; Wed, 13 May 2026 03:55:33 -0700 (PDT) From: =?UTF-8?q?Corvin=20K=C3=B6hne?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Hanna Reitz , Kevin Wolf , qemu-arm@nongnu.org, =?UTF-8?q?Corvin=20K=C3=B6hne?= , Peter Maydell , Paolo Bonzini , Pierrick Bouvier , =?UTF-8?q?Yannick=20Vo=C3=9Fen?= , Alistair Francis , "Edgar E. Iglesias" , YannickV Subject: [PATCH v6 10/15] hw/misc: Add Beckhoff CCAT device Date: Wed, 13 May 2026 12:55:12 +0200 Message-ID: <20260513105517.146706-11-corvin.koehne@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260513105517.146706-1-corvin.koehne@gmail.com> References: <20260513105517.146706-1-corvin.koehne@gmail.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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=corvin.koehne@gmail.com; helo=mail-wm1-x32e.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @gmail.com) X-ZM-MESSAGEID: 1778669862224158500 Content-Type: text/plain; charset="utf-8" From: YannickV This adds the Beckhoff Communication Controller (CCAT). The information block, EEPROM interface and DMA controller are currently implemented. The EEPROM provides production information for Beckhoff Devices. An EEPORM binary must therefor be handed over. It should be aligned to a power of two. If no EEPROM binary is handed over an empty EEPROM of size 4096 is initialized. This device is needed for the Beckhoff CX7200 board emulation. Signed-off-by: YannickV --- hw/misc/Kconfig | 3 + hw/misc/beckhoff_ccat.c | 339 ++++++++++++++++++++++++++++++++++++++++ hw/misc/meson.build | 1 + 3 files changed, 343 insertions(+) create mode 100644 hw/misc/beckhoff_ccat.c diff --git a/hw/misc/Kconfig b/hw/misc/Kconfig index 1543ee6653..2217b2005b 100644 --- a/hw/misc/Kconfig +++ b/hw/misc/Kconfig @@ -257,4 +257,7 @@ config XLNX_VERSAL_TRNG config XLNX_ZYNQ_DDRC bool =20 +config BECKHOFF_CCAT + bool + source macio/Kconfig diff --git a/hw/misc/beckhoff_ccat.c b/hw/misc/beckhoff_ccat.c new file mode 100644 index 0000000000..a29e9f6166 --- /dev/null +++ b/hw/misc/beckhoff_ccat.c @@ -0,0 +1,339 @@ +/* + * Beckhoff Communication Controller Emulation + * + * Copyright (c) Beckhoff Automation GmbH. & Co. KG + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "hw/core/sysbus.h" +#include "qemu/units.h" +#include "hw/core/register.h" +#include "qemu/bitops.h" +#include "qemu/log.h" +#include "qapi/error.h" +#include "system/block-backend.h" +#include "system/address-spaces.h" +#include "system/memory.h" +#include "system/dma.h" +#include "qemu/error-report.h" +#include "block/block.h" +#include "block/block_int.h" +#include "block/qdict.h" +#include "hw/block/block.h" +#include "migration/vmstate.h" +#include "qemu/bswap.h" + +#ifndef CCAT_ERR_DEBUG +#define CCAT_ERR_DEBUG 0 +#endif + +#define TYPE_BECKHOFF_CCAT "beckhoff-ccat" +OBJECT_DECLARE_SIMPLE_TYPE(BeckhoffCcat, BECKHOFF_CCAT) + +#define MAX_NUM_SLOTS 32 +#define CCAT_FUNCTION_BLOCK_SIZE 16 + +#define CCAT_EEPROM_OFFSET 0x100 +#define CCAT_DMA_OFFSET 0x8000 + +#define CCAT_MEM_SIZE (64 * KiB) +#define CCAT_DMA_SIZE 0x800 +#define CCAT_EEPROM_SIZE 0x20 + +#define EEPROM_MEMORY_SIZE 0x1000 + +#define EEPROM_CMD_OFFSET (CCAT_EEPROM_OFFSET + 0x00) + #define EEPROM_CMD_WRITE_MASK 0x2 + #define EEPROM_CMD_READ_MASK 0x1 +#define EEPROM_ADR_OFFSET (CCAT_EEPROM_OFFSET + 0x04) +#define EEPROM_DATA_OFFSET (CCAT_EEPROM_OFFSET + 0x08) + +#define DMA_BUFFER_OFFSET (CCAT_DMA_OFFSET + 0x00) +#define DMA_DIRECTION_OFFSET (CCAT_DMA_OFFSET + 0x7c0) + #define DMA_DIRECTION_MASK 1 +#define DMA_TRANSFER_OFFSET (CCAT_DMA_OFFSET + 0x7c4) +#define DMA_HOST_ADR_OFFSET (CCAT_DMA_OFFSET + 0x7c8) +#define DMA_TRANSFER_LENGTH_OFFSET (CCAT_DMA_OFFSET + 0x7cc) + +/* + * The informationblock is always located at address 0x0. + * Address and size are therefor replaced by two identifiers. + * The Parameter give information about the maximal number of + * function slots and the creation date (in this case 01.01.2001) + */ +#define CCAT_ID_1 0x88a4 +#define CCAT_ID_2 0x54414343 +#define CCAT_INFO_BLOCK_PARAMS ((MAX_NUM_SLOTS << 0) | (0x1 << 8) | \ + (0x1 << 16) | (0x1 << 24)) + +#define CCAT_FUN_TYPE_ENTRY 0x0001 +#define CCAT_FUN_TYPE_EEPROM 0x0012 +#define CCAT_FUN_TYPE_DMA 0x0013 + +typedef struct BeckhoffCcat { + SysBusDevice parent_obj; + + MemoryRegion iomem; + + uint8_t mem[CCAT_MEM_SIZE]; + + BlockBackend *eeprom_blk; + uint8_t *eeprom_storage; + uint32_t eeprom_size; +} BeckhoffCcat; + +static void sync_eeprom(BeckhoffCcat *s) +{ + if (!s->eeprom_blk) { + return; + } + blk_pwrite(s->eeprom_blk, 0, s->eeprom_size, s->eeprom_storage, 0); +} + +static uint64_t beckhoff_ccat_eeprom_read(void *opaque, hwaddr addr, + unsigned size) +{ + BeckhoffCcat *s =3D opaque; + return ldn_le_p(&s->mem[addr], size); +} + +static void beckhoff_ccat_eeprom_write(void *opaque, hwaddr addr, uint64_t= val, + unsigned size) +{ + BeckhoffCcat *s =3D opaque; + uint64_t eeprom_adr; + uint64_t buf; + uint32_t bytes_to_read; + + switch (addr) { + case EEPROM_CMD_OFFSET: + eeprom_adr =3D ldl_le_p(&s->mem[EEPROM_ADR_OFFSET]); + eeprom_adr =3D (eeprom_adr * 2) % s->eeprom_size; + if (val & EEPROM_CMD_READ_MASK) { + buf =3D 0; + bytes_to_read =3D 8; + if (eeprom_adr > s->eeprom_size - 8) { + bytes_to_read =3D s->eeprom_size - eeprom_adr; + } + buf =3D ldn_le_p(s->eeprom_storage + eeprom_adr, bytes_to_read= ); + stq_le_p(&s->mem[EEPROM_DATA_OFFSET], buf); + } else if (val & EEPROM_CMD_WRITE_MASK) { + buf =3D ldl_le_p(&s->mem[EEPROM_DATA_OFFSET]); + stw_le_p((uint16_t *)(s->eeprom_storage + eeprom_adr), buf); + sync_eeprom(s); + } + break; + default: + stn_le_p(&s->mem[addr], size, val); + } +} + +static uint64_t beckhoff_ccat_dma_read(void *opaque, hwaddr addr, unsigned= size) +{ + BeckhoffCcat *s =3D opaque; + + switch (addr) { + case DMA_TRANSFER_OFFSET: + if (s->mem[DMA_TRANSFER_OFFSET] & 0x1) { + s->mem[DMA_TRANSFER_OFFSET] =3D 0; + } + break; + } + return ldn_le_p(&s->mem[addr], size); +} + +static void beckhoff_ccat_dma_write(void *opaque, hwaddr addr, uint64_t va= l, + unsigned size) +{ + BeckhoffCcat *s =3D opaque; + dma_addr_t dmaAddr; + uint8_t len; + uint8_t *mem_buf; + + switch (addr) { + case DMA_TRANSFER_OFFSET: + len =3D s->mem[DMA_TRANSFER_LENGTH_OFFSET]; + mem_buf =3D &s->mem[DMA_BUFFER_OFFSET]; + dmaAddr =3D ldl_le_p(&s->mem[DMA_HOST_ADR_OFFSET]); + if (s->mem[DMA_DIRECTION_OFFSET] & DMA_DIRECTION_MASK) { + dma_memory_read(&address_space_memory, dmaAddr, + mem_buf, len * 8, MEMTXATTRS_UNSPECIFIED); + } else { + /* + * The write transfer uses Host DMA Address + 8 as the target + * offset, as described in the CCAT manual Version 0.0.41 + * section 20.2. + */ + dma_memory_write(&address_space_memory, dmaAddr + 8, + mem_buf, len * 8, MEMTXATTRS_UNSPECIFIED); + } + break; + } + stn_le_p(&s->mem[addr], size, val); +} + +static uint64_t beckhoff_ccat_read(void *opaque, hwaddr addr, unsigned siz= e) +{ + BeckhoffCcat *s =3D opaque; + uint64_t val =3D 0; + + assert(addr <=3D CCAT_MEM_SIZE - size); + + if (addr >=3D CCAT_EEPROM_OFFSET && + addr <=3D CCAT_EEPROM_OFFSET + s->eeprom_size) { + return beckhoff_ccat_eeprom_read(opaque, addr, size); + } else if (addr >=3D CCAT_DMA_OFFSET && + addr <=3D CCAT_DMA_OFFSET + CCAT_DMA_SIZE) { + return beckhoff_ccat_dma_read(opaque, addr, size); + } else { + val =3D ldn_le_p(&s->mem[addr], size); + } + + return val; +} + +static void beckhoff_ccat_write(void *opaque, hwaddr addr, uint64_t val, + unsigned size) +{ + BeckhoffCcat *s =3D opaque; + + assert(addr <=3D CCAT_MEM_SIZE - size); + + if (addr >=3D CCAT_EEPROM_OFFSET && + addr <=3D CCAT_EEPROM_OFFSET + s->eeprom_size) { + beckhoff_ccat_eeprom_write(opaque, addr, val, size); + } else if (addr >=3D CCAT_DMA_OFFSET && + addr <=3D CCAT_DMA_OFFSET + CCAT_DMA_SIZE) { + beckhoff_ccat_dma_write(opaque, addr, val, size); + } else { + stn_le_p(&s->mem[addr], size, val); + } +} + +static const MemoryRegionOps beckhoff_ccat_ops =3D { + .read =3D beckhoff_ccat_read, + .write =3D beckhoff_ccat_write, + .endianness =3D DEVICE_LITTLE_ENDIAN, + .valid =3D { + .min_access_size =3D 1, + .max_access_size =3D 8, + }, +}; + +static void beckhoff_ccat_reset(DeviceState *dev) +{ + BeckhoffCcat *s =3D BECKHOFF_CCAT(dev); + + memset(&s->mem[0], 0, MAX_NUM_SLOTS * CCAT_FUNCTION_BLOCK_SIZE); + + size_t offset =3D 0 * CCAT_FUNCTION_BLOCK_SIZE; + stw_le_p(&s->mem[offset + 0], CCAT_FUN_TYPE_ENTRY); + stw_le_p(&s->mem[offset + 2], 0x0001); + stl_le_p(&s->mem[offset + 4], CCAT_INFO_BLOCK_PARAMS); + stl_le_p(&s->mem[offset + 8], CCAT_ID_1); + stl_le_p(&s->mem[offset + 12], CCAT_ID_2); + + offset =3D 11 * CCAT_FUNCTION_BLOCK_SIZE; + stw_le_p(&s->mem[offset + 0], CCAT_FUN_TYPE_EEPROM); + stw_le_p(&s->mem[offset + 2], 0x0001); + stl_le_p(&s->mem[offset + 4], 0); + stl_le_p(&s->mem[offset + 8], CCAT_EEPROM_OFFSET); + stl_le_p(&s->mem[offset + 12], CCAT_EEPROM_SIZE); + + offset =3D 15 * CCAT_FUNCTION_BLOCK_SIZE; + stw_le_p(&s->mem[offset + 0], CCAT_FUN_TYPE_DMA); + stw_le_p(&s->mem[offset + 2], 0x0000); + stl_le_p(&s->mem[offset + 4], 0); + stl_le_p(&s->mem[offset + 8], CCAT_DMA_OFFSET); + stl_le_p(&s->mem[offset + 12], CCAT_DMA_SIZE); +} + +static void beckhoff_ccat_realize(DeviceState *dev, Error **errp) +{ + BeckhoffCcat *s =3D BECKHOFF_CCAT(dev); + BlockBackend *blk; + + blk =3D s->eeprom_blk; + + if (blk) { + uint64_t blk_size =3D blk_getlength(blk); + if (!is_power_of_2(blk_size)) { + error_setg(errp, "Blockend size is not a power of two."); + return; + } + + if (blk_size < 512) { + error_setg(errp, "Blockend size is too small."); + return; + } else { + blk_set_perm(blk, BLK_PERM_WRITE, BLK_PERM_ALL, errp); + + s->eeprom_size =3D blk_size; + s->eeprom_blk =3D blk; + s->eeprom_storage =3D blk_blockalign(s->eeprom_blk, s->eeprom_= size); + + if (!blk_check_size_and_read_all(s->eeprom_blk, DEVICE(s), + s->eeprom_storage, s->eeprom_= size, + errp)) { + return; + } + } + } else { + s->eeprom_size =3D EEPROM_MEMORY_SIZE; + s->eeprom_storage =3D blk_blockalign(NULL, s->eeprom_size); + memset(s->eeprom_storage, 0x00, s->eeprom_size); + } +} + +static void beckhoff_ccat_init(Object *obj) +{ + BeckhoffCcat *s =3D BECKHOFF_CCAT(obj); + SysBusDevice *sbd =3D SYS_BUS_DEVICE(obj); + + memory_region_init_io(&s->iomem, obj, &beckhoff_ccat_ops, s, + TYPE_BECKHOFF_CCAT, CCAT_MEM_SIZE); + sysbus_init_mmio(sbd, &s->iomem); +} + +static const VMStateDescription vmstate_beckhoff_ccat =3D { + .name =3D "beckhoff-ccat", + .version_id =3D 1, + .minimum_version_id =3D 1, + .fields =3D (const VMStateField[]) { + VMSTATE_UINT8_ARRAY(mem, BeckhoffCcat, CCAT_MEM_SIZE), + VMSTATE_UINT32(eeprom_size, BeckhoffCcat), + VMSTATE_VBUFFER_UINT32(eeprom_storage, BeckhoffCcat, 1, NULL, + eeprom_size), + VMSTATE_END_OF_LIST() + } +}; + +static const Property beckhoff_ccat_properties[] =3D { + DEFINE_PROP_DRIVE("eeprom", BeckhoffCcat, eeprom_blk), +}; + +static void beckhoff_ccat_class_init(ObjectClass *klass, const void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + dc->realize =3D beckhoff_ccat_realize; + device_class_set_legacy_reset(dc, beckhoff_ccat_reset); + dc->vmsd =3D &vmstate_beckhoff_ccat; + device_class_set_props(dc, beckhoff_ccat_properties); +} + +static const TypeInfo beckhoff_ccat_info =3D { + .name =3D TYPE_BECKHOFF_CCAT, + .parent =3D TYPE_SYS_BUS_DEVICE, + .instance_size =3D sizeof(BeckhoffCcat), + .instance_init =3D beckhoff_ccat_init, + .class_init =3D beckhoff_ccat_class_init, +}; + +static void beckhoff_ccat_register_types(void) +{ + type_register_static(&beckhoff_ccat_info); +} + +type_init(beckhoff_ccat_register_types) diff --git a/hw/misc/meson.build b/hw/misc/meson.build index 3b7f908d9d..d313e87ed1 100644 --- a/hw/misc/meson.build +++ b/hw/misc/meson.build @@ -15,6 +15,7 @@ system_ss.add(when: 'CONFIG_PL310', if_true: files('arm_l= 2x0.c')) system_ss.add(when: 'CONFIG_INTEGRATOR_DEBUG', if_true: files('arm_integra= tor_debug.c')) system_ss.add(when: 'CONFIG_A9SCU', if_true: files('a9scu.c')) system_ss.add(when: 'CONFIG_ARM11SCU', if_true: files('arm11scu.c')) +system_ss.add(when: 'CONFIG_BECKHOFF_CCAT', if_true: files('beckhoff_ccat.= c')) =20 system_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('armv7m_ras.c')) =20 --=20 2.47.3 From nobody Sat May 30 18:35:07 2026 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1778669890; cv=none; d=zohomail.com; s=zohoarc; b=Lp2PqOAEvHvOcH7N4lE0Jv7I+HRFj7GnNNh6SZzvMDInCKJkzPwKimD3f60Sq5hHRn2mmKyOGR+fVs3fWwAKoW/HM4ZPCsXjT+PTV4uLPCdVPAEl5F6kHnbMsZbxvzluN8XHTvXK1A/IQ8mFhBDaCGGGJkOfbeHIZpvI2ECaFKQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1778669890; 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=4pF8Avu0vc4X7fk20J7cLa1Br/gq+YuCxe6Pf3cPpIE=; b=itnoliSNVMYxo3JtTzUiQLZpnjaH7CirA+jufkjuUyBj3ImjyK/Bi6cnAd/rmExSXrtOhlCyh+62F+wcNxabdmMy3dXgye98VJWobgf8c7drfylKTEEiyuHStjbnhdF8WQ4hzBBWpeF99I0WHzlK5tG3ywKVEYJtb0ah2p43U0E= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1778669890736232.7845604686471; Wed, 13 May 2026 03:58:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wN7H2-0003oQ-3q; Wed, 13 May 2026 06:57:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wN7Fe-0003BD-JN for qemu-devel@nongnu.org; Wed, 13 May 2026 06:55:47 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wN7FY-0001S3-Si for qemu-devel@nongnu.org; Wed, 13 May 2026 06:55:41 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-4891e86fabeso75840505e9.1 for ; Wed, 13 May 2026 03:55:35 -0700 (PDT) Received: from PC-DA2D10.beckhoff.com ([195.226.174.196]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48e8f410d9fsm56062295e9.6.2026.05.13.03.55.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2026 03:55:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778669735; x=1779274535; 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=4pF8Avu0vc4X7fk20J7cLa1Br/gq+YuCxe6Pf3cPpIE=; b=a65f97hWhfCcXBMkRE9jRRLZeP3EvCiH8HYB7ImclGdxDS7ubwPVR+Ar27ogm/eC49 e10G2x1/x6eswmkfqU1E3HJdnEM9ojIj1cGUoFWkdKwremsio85p0TpFpZLzAF6+u5A2 oiPbzMIEBCN828+zsqGCSyDE8aLwoJrEmSKdaifMgEzsaMXgfhU/SPbNAVhjKz8IFIRv tD48GFibDd+lqY+je5JvnL2kkF1VGw0TAEmCb/4jgOrdYGZQrBHOVIjf2N4hnuNRHrxM DB0zeDMMhhY2IIyYoXa+lGFADLZIRnQ9pe2vzqhclcS90KBDrfBw2ECOv5MVjo6nj41f GCLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778669735; x=1779274535; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=4pF8Avu0vc4X7fk20J7cLa1Br/gq+YuCxe6Pf3cPpIE=; b=PyjxVDHerQz2/tMmVq8AWMHsEisxGtV6aGW1y4gdwdv624FGSB5L7qxpVKuMDZ1I/W ZQDUp+lEPZ6bkwKHKgRr7V53bgbwGozC0q6TpsGu3BTgeysR0R1tpnW3BzCG+3F3/rEC XRb4Md9M3Gs19JAVq9NqGDpqU53vBvl44/I6drwUVo8OP/WDanV61TXpcf6f+Iz6qEin idhsWGi/cI5V5eQ/w7wPcDne/u083rN3Ng9o+77Cdm67r9gLXHzf+mq7WaP4gfedgKyx uET3ZKy5dGovdg/0PAGAVrzEp8jdTDUAeZKswr/fcITFFPrWQv7X7zn7gLridENgv1wP UzhQ== X-Gm-Message-State: AOJu0Yy+qC+TXwPCizgiUjItgwiWKWtVGdCcs8qyTAuO1Rgv/Ke7p5t4 GO8c/8vIHu5BYPX0okjNztVmkHk16OjTv7PGYLZPNN5eYJZC5QkQwpIZWKLeYFJ3 X-Gm-Gg: Acq92OHyvSIuF6WPsWi+vLZi2bt8H2b/iQC57/x0Vfj7A8JuJBUKw72wIEhlblw4L0V 6GknjOwW+NMRYgIuMQhSLL2hY1SMncBRB2WOe5f5zFe4vh3wWBHpadA1p9ofKaNMqILxKCcPmrO tp9dRIi3aZ+10D4M14xlntWqtpDfHWbH76VfSOpe+oxfSSGgo1/jG9ppDvk2TgNbvhH3PPlFocl 8lsPNipQiAO1FG6Gb08ZRbp7OhzQBn5ZlWS5JrV+XHudlyjkJ0k0Aget6KHMeHEfIlEv+RzZH69 fZwDrWUGpt50TbMc7X3oA7S0oKMATDicnW9EM10/w9eWnQZ+FESiK6hsmjb0WmPhRIFmO3h6EA+ yYETbzymsOhFaWxsH2q4dnPKSTWOXZ3udzoSHIrPOAso/BrTgXniN+6ztkbh/oPFgwzIHgmvkkq cUEEqwGp/uKilBzqA9ugBWiUe1aR392u0LmxTsJMU770pY X-Received: by 2002:a05:600c:458a:b0:48d:35e:82cb with SMTP id 5b1f17b1804b1-48fcea00b19mr26649975e9.28.1778669734664; Wed, 13 May 2026 03:55:34 -0700 (PDT) From: =?UTF-8?q?Corvin=20K=C3=B6hne?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Hanna Reitz , Kevin Wolf , qemu-arm@nongnu.org, =?UTF-8?q?Corvin=20K=C3=B6hne?= , Peter Maydell , Paolo Bonzini , Pierrick Bouvier , =?UTF-8?q?Yannick=20Vo=C3=9Fen?= , Alistair Francis , "Edgar E. Iglesias" , YannickV Subject: [PATCH v6 11/15] hw/block/m25p80: Add HAS_SR_TB flag for is25lp016d Date: Wed, 13 May 2026 12:55:13 +0200 Message-ID: <20260513105517.146706-12-corvin.koehne@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260513105517.146706-1-corvin.koehne@gmail.com> References: <20260513105517.146706-1-corvin.koehne@gmail.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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=corvin.koehne@gmail.com; helo=mail-wm1-x32d.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: qemu development 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 @gmail.com) X-ZM-MESSAGEID: 1778669892327158500 Content-Type: text/plain; charset="utf-8" From: YannickV The is25lp016d has 4 Block Write Protect Bits. BP3 specifies whether the upper or lower range should be protected. Therefore, we add the HAS_SR_TB flag to the is25lp016d flags. Signed-off-by: YannickV Reviewed-by: Peter Maydell --- hw/block/m25p80.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c index b8a2543c0b..4a4cda6602 100644 --- a/hw/block/m25p80.c +++ b/hw/block/m25p80.c @@ -217,7 +217,8 @@ static const FlashPartInfo known_devices[] =3D { /* ISSI */ { INFO("is25lq040b", 0x9d4013, 0, 64 << 10, 8, ER_4K) }, { INFO("is25lp080d", 0x9d6014, 0, 64 << 10, 16, ER_4K) }, - { INFO("is25lp016d", 0x9d6015, 0, 64 << 10, 32, ER_4K) }, + { INFO("is25lp016d", 0x9d6015, 0, 64 << 10, 32, + ER_4K | HAS_SR_TB) }, { INFO("is25lp032", 0x9d6016, 0, 64 << 10, 64, ER_4K) }, { INFO("is25lp064", 0x9d6017, 0, 64 << 10, 128, ER_4K) }, { INFO("is25lp128", 0x9d6018, 0, 64 << 10, 256, ER_4K) }, --=20 2.47.3 From nobody Sat May 30 18:35:07 2026 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1778670068; cv=none; d=zohomail.com; s=zohoarc; b=ArMulY4WZcc5hncDnhUWvX5k1CL6PO+3QFkkAc1u7liUmpdD/R1EHeje2Q8VfKtUtUQhUcq1q2qirzitb5hhv28jX6zs4yg3hbEGhpgrKeFvlAFLxdt2doJ07tx9lxZRXTEFvp75VnewbBn+Sn3P6GSbgoVP8l4iTQ6iJTjj2Ak= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1778670068; 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=31uAyBAt0YBaO7HX9hDUa25jYs4P+S8BQjl4K/ghWPQ=; b=c2PnM4oVDoLSaodMYV69l0aqBwO50D8QdH38hn+ezhRI5GHFzG75eXSQ9PDIgeLtEARRMQ3L21vAIzN4afH23pJTUTZWVa5JRiDshVta9crEKeXb7AHOFuUeAaReojIEHNDW5bg57GkfTTQ3z/b58UfPabka9v0rKYydTTlkZ3A= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1778670068234311.0499512691687; Wed, 13 May 2026 04:01:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wN7Kp-00015f-Na; Wed, 13 May 2026 07:01:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wN7Fj-0003Bf-NS for qemu-devel@nongnu.org; Wed, 13 May 2026 06:55:48 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wN7Fd-0001Sx-Qn for qemu-devel@nongnu.org; Wed, 13 May 2026 06:55:47 -0400 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-4891d7164ddso36632645e9.3 for ; Wed, 13 May 2026 03:55:37 -0700 (PDT) Received: from PC-DA2D10.beckhoff.com ([195.226.174.196]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48e8f410d9fsm56062295e9.6.2026.05.13.03.55.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2026 03:55:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778669736; x=1779274536; 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=31uAyBAt0YBaO7HX9hDUa25jYs4P+S8BQjl4K/ghWPQ=; b=Uzvgmd58fkca9X8Xx8YWmnr53zy3pXKP8v+Oxt91a57ZYlZqPrIboAzKxbsMJOCQ6Y o0B8WC659QVkLjCx3d1yMWpy9AK6yFsGpNRnWAUZtu2Ij93u3/q4UN7o8ewZW58RTRbm xaBubAbmhyTmPDpfkluiixfLZ3pJYRqphrywBXSLPAMsaDRAWTs0858HoJKrEI5rUNwY Kn57S1YLRg5dE3WrtqawSOn09AqCHwBHnnF8KdM8u2007amVWiIYAls9zVPLUaN9EjlY 9H5NG1rltPzzWraovSo8djnKO5UKcjaA1PU/D3+qrj9dOjHNFbyHvlfyRhCDyPx8KxUx Te8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778669736; x=1779274536; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=31uAyBAt0YBaO7HX9hDUa25jYs4P+S8BQjl4K/ghWPQ=; b=RiDY6P5FVo+xYVcnTzco2uRXBy0RSJs3EuE0jiNT89kU0Rnv9iAwhXRha4vmXHyFw3 AGZDgn2WGqQC1/KgJkfxE0AdEEqL1ucohcugL30sGlJlxV19tIhof9/fewwwV1UX3HgX f1+TAdRbfs7GMvHDTHED/+LobiDVqF5wp+WqSNZ3qi5l9fnIPTOMeI/SAfjgCuuJp362 S+WLWK6i5t0sx0+HfsnWd5oc5JFnpS6B2IX0iDb1ObT0jWhFh8SckhXSPVmawl/KvQTF Pb+6ItOC4rnRitKpykxZ9uLaETBbbQcfu5PZCoVOw8H9oGvkWRxLSX8WyoE9IA2AA4Ab fr8g== X-Gm-Message-State: AOJu0YxbdBh2cC6voduXfrYYICHgzyUkOqZim+S3rFzpM6aRlYNIVR7u CiesqGRjyqdRqRp6T2YxpxgzbotgejB9tVNWfDmNNIyxqGKQwIHO5hw5qUXV/3Qm X-Gm-Gg: Acq92OF1GaFFVxaollAosGnZwmpT9DjkO9VbHBAYom4bDf8eFWmEF9CKU2llDiPvHeK WWEFUCAIxBKBJ40QYd8Fy8eBm3qaMkP41L+TquOvaoqto8Wyk1Q6G51lXthcy50bi7GUIyy7IYQ OrEYStZrdV0TSyHHPjUCwdM9+gnWMGWSjD0BPoHe+vAvysoq+vjUFwyQ9bFUv+ewwfhj47X+8Ui Wpl5aSmwrGpnJ6yBPCTSfqs4SyHnv6cIxDJGg2Y6tjbNDJMMigQAEpYg+dQ9DkCLO4gL0x3XCFs KYkBggZEXxC8OYHSCa1EI8bxOi/MpCZPSeany/k9mkMhPmWc968KR3Q5lU0p7df24DWJbEI5V1h qkYIr/BeVPSAWRNSfVNh3ktW3/piCLHt9PT140ACVgBrMCCqhyabFR0QLFkhiG0r9Rwis9Tyytd M5ul3roWVfDeOm2Sxb5SUifrGhxzOY+DE7THiT3b5DhCxS X-Received: by 2002:a05:600c:3144:b0:48e:82af:d9 with SMTP id 5b1f17b1804b1-48fcea18dfbmr31076885e9.29.1778669736002; Wed, 13 May 2026 03:55:36 -0700 (PDT) From: =?UTF-8?q?Corvin=20K=C3=B6hne?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Hanna Reitz , Kevin Wolf , qemu-arm@nongnu.org, =?UTF-8?q?Corvin=20K=C3=B6hne?= , Peter Maydell , Paolo Bonzini , Pierrick Bouvier , =?UTF-8?q?Yannick=20Vo=C3=9Fen?= , Alistair Francis , "Edgar E. Iglesias" , YannickV Subject: [PATCH v6 12/15] hw/arm/xilinx_zynq: Split xilinx_zynq into header and implementation files Date: Wed, 13 May 2026 12:55:14 +0200 Message-ID: <20260513105517.146706-13-corvin.koehne@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260513105517.146706-1-corvin.koehne@gmail.com> References: <20260513105517.146706-1-corvin.koehne@gmail.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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=corvin.koehne@gmail.com; helo=mail-wm1-x333.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: qemu development 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 @gmail.com) X-ZM-MESSAGEID: 1778670070068158500 Content-Type: text/plain; charset="utf-8" From: YannickV Create xilinx_zynq.h header file to expose ZynqMachineState and related definitions for machine inheritance. This enables creation of derived machines based on the Zynq platform. Signed-off-by: YannickV Reviewed-by: Peter Maydell --- hw/arm/xilinx_zynq.c | 13 +------------ include/hw/arm/xilinx_zynq.h | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 12 deletions(-) create mode 100644 include/hw/arm/xilinx_zynq.h diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c index 66a4480cc8..6c83439017 100644 --- a/hw/arm/xilinx_zynq.c +++ b/hw/arm/xilinx_zynq.c @@ -41,9 +41,7 @@ #include "exec/tswap.h" #include "target/arm/cpu-qom.h" #include "qapi/visitor.h" - -#define TYPE_ZYNQ_MACHINE MACHINE_TYPE_NAME("xilinx-zynq-a9") -OBJECT_DECLARE_SIMPLE_TYPE(ZynqMachineState, ZYNQ_MACHINE) +#include "hw/arm/xilinx_zynq.h" =20 /* board base frequency: 33.333333 MHz */ #define PS_CLK_FREQUENCY (100 * 1000 * 1000 / 3) @@ -87,15 +85,6 @@ static const int dma_irqs[8] =3D { 0xe3401000 + ARMV7_IMM16(extract32((val), 16, 16)), /* movt r1 ... */ \ 0xe5801000 + (addr) =20 -#define ZYNQ_MAX_CPUS 2 - -struct ZynqMachineState { - MachineState parent; - Clock *ps_clk; - ARMCPU *cpu[ZYNQ_MAX_CPUS]; - uint8_t boot_mode; -}; - static void zynq_write_board_setup(ARMCPU *cpu, const struct arm_boot_info *info) { diff --git a/include/hw/arm/xilinx_zynq.h b/include/hw/arm/xilinx_zynq.h new file mode 100644 index 0000000000..0337d238ea --- /dev/null +++ b/include/hw/arm/xilinx_zynq.h @@ -0,0 +1,36 @@ +/* + * Xilinx Zynq Baseboard System emulation. + * + * Copyright (c) 2010 Xilinx. + * Copyright (c) 2012 Peter A.G. Crosthwaite (peter.croshtwaite@petalogix.= com) + * Copyright (c) 2012 Petalogix Pty Ltd. + * Written by Haibing Ma + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, see . + */ + +#ifndef QEMU_ARM_ZYNQ_H +#define QEMU_ARM_ZYNQ_H + +#include "target/arm/cpu-qom.h" +#include "hw/core/qdev-clock.h" + +#define TYPE_ZYNQ_MACHINE MACHINE_TYPE_NAME("xilinx-zynq-a9") +OBJECT_DECLARE_SIMPLE_TYPE(ZynqMachineState, ZYNQ_MACHINE) + +#define ZYNQ_MAX_CPUS 2 + +struct ZynqMachineState { + MachineState parent; + Clock *ps_clk; + ARMCPU *cpu[ZYNQ_MAX_CPUS]; + uint8_t boot_mode; +}; + +#endif /* QEMU_ARM_ZYNQ_H */ --=20 2.47.3 From nobody Sat May 30 18:35:07 2026 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1778669941; cv=none; d=zohomail.com; s=zohoarc; b=ew1UBq/Dde4KFJUOVwU69urUsnccLRKCougeSimzEps7WyGQObzHrsDIRIWF08/GeDoovBPP3qbvokAYDKq5Abbn+7YFH1Fvhfuic04tvwxVzWeLSqEFy3WHa6UUn+wNS08DQpZiBLiTa9s9fxdr1MXjggmxjBgP1QxLNrT5eJ4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1778669941; 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=bN8pCQefCtNsnBDpXB7hEGPTq2VEcqB0gokfyFY1mgk=; b=nDqlO13+BXSKMs5TA9vNFVTFGIej/V4lfQyLFJ2XxkjOpQZGylY7+0n9KzheTTu+6DI6o97nhf14hzjLAX9jcNuxSFACCMaN2QC8g7QYT8c7M8vC2bPraYp5U1a1m26ryHBW0o5t+56ljEoPnaMv36Vg6lzdrDkBiPwJnle9iGg= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1778669941200432.1449542304433; Wed, 13 May 2026 03:59:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wN7Hx-0004gR-Ty; Wed, 13 May 2026 06:58:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wN7Fi-0003BZ-6Z for qemu-devel@nongnu.org; Wed, 13 May 2026 06:55:47 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wN7Fd-0001Ty-A9 for qemu-devel@nongnu.org; Wed, 13 May 2026 06:55:45 -0400 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-488a88aeec9so73871015e9.2 for ; Wed, 13 May 2026 03:55:38 -0700 (PDT) Received: from PC-DA2D10.beckhoff.com ([195.226.174.196]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48e8f410d9fsm56062295e9.6.2026.05.13.03.55.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2026 03:55:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778669737; x=1779274537; 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=bN8pCQefCtNsnBDpXB7hEGPTq2VEcqB0gokfyFY1mgk=; b=cTdjvhpL9e+wMZGfwSoA1GiXt8hTDchNr0HtzgDPwnjxvDAXDs3qgqyZT+SV/CnSu3 mo39pdtgNcmhICb4ADpW24JPT2tfyXnSH8WrWN1OiHqC0Un4ZxBDGmBpu3Ntb8xdoqkm DRcGAudtf8OVgL2zJu25HtqX7CjqA20IyVvtIc5L09npwd3WGwmYkteXQNCYRzl0m75E qoLyPmuzzJKTo79SIzoyUUKW36nIbWhc7Nz4J3vby2kpip9TbrMvDjV5qWzaJBU8HUeC N2b+pxh7cmK6nnikfvu1hlzmaRidbpYID05JnzjB/IrFZUQlqc4nzIcxIlqNInmtU7rA vP+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778669737; x=1779274537; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=bN8pCQefCtNsnBDpXB7hEGPTq2VEcqB0gokfyFY1mgk=; b=ePknB5pG/aaf06ieW4yA2/BLMgEUevwmvbrSaEoW18S2JUmrlqNFEngiN205xUHXUp rPFCo2AnuLgcDz4nNmHGHw2jggVZO13CE8JYeFIOuWMk7Z618i9qvRkRIOQfDDJvvI4d S1d8RZ3jeNcWcMDoYpVU3lEuqmYgP1qlrm/yKdl9hbdIWgvb+uWPRrRVmccNDuw6exvu gxAO7j0l557112i/CtSrwWhGtf6KZHyDawmsaal5RfMLB4CfMavLMuXGNTJAWk+MG3QS ARmsrrlhb4yCm9ALqg8Qgcz2OW+iv7FOehc/gYePgIC83K0AKw36aXCIB40+jAWybAwm jhzw== X-Gm-Message-State: AOJu0YzfaBejnlO+d9Mx6NY1B//xT63S2aSF5tF2izhArNiZXt3yWx4X BMfp32F+u6Y64sIOE8f0i0f3XmzxzergzdjAMPS3dEzUy3v16GM+2hIFmqLDGRYr X-Gm-Gg: Acq92OGcclMpZQgQgNv5wKBKXeroLkCpg0+W4z2pwn79+ge1hUN/lmsw7XU4D/xQdVY DhqQwgiqFzEC3Tt0xLKP2rWaYTmgpVv8O34iMPlx90JHZIMPedmZ+4FdvX5iKo2WqqhnYiPnmy4 CRmMLsGZTWHHwzAtyIWmdim8ei6AYfHhgmAbDEY2bYKI+ENyBrSj9kqVZCG8E+LJwo4/n/pPZ2r isEh3IUXagwImPT03STOPZugt8+1Y7DxdBiOuxaLe1eMmCJzrL2u6PxKwmqZpsXydowqDxeXbtE gtwtP/f7kl5BeE3ZLZzwnBsQiWkSFqH9znbl9cokfVXlk+H/nZ1SvQNTSVaGR5E+i6uMw27u56T Tc43/+tlSC561ZzL7lX6scXq/7N5Q32ONHSbWCXnHTG/TLxzqomSvEliIsFPFqb3dGkiQYP/YIw NUkqNVSQRo65n0iTZIOAFtK1eydQh8VhbcPQYo+nLAqzO1 X-Received: by 2002:a05:600c:a48:b0:48a:52ee:5776 with SMTP id 5b1f17b1804b1-48fc9a0ef80mr40843965e9.11.1778669737373; Wed, 13 May 2026 03:55:37 -0700 (PDT) From: =?UTF-8?q?Corvin=20K=C3=B6hne?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Hanna Reitz , Kevin Wolf , qemu-arm@nongnu.org, =?UTF-8?q?Corvin=20K=C3=B6hne?= , Peter Maydell , Paolo Bonzini , Pierrick Bouvier , =?UTF-8?q?Yannick=20Vo=C3=9Fen?= , Alistair Francis , "Edgar E. Iglesias" , YannickV Subject: [PATCH v6 13/15] hw/arm/xilinx_zynq: Add flash-type property Date: Wed, 13 May 2026 12:55:15 +0200 Message-ID: <20260513105517.146706-14-corvin.koehne@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260513105517.146706-1-corvin.koehne@gmail.com> References: <20260513105517.146706-1-corvin.koehne@gmail.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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=corvin.koehne@gmail.com; helo=mail-wm1-x331.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: qemu development 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 @gmail.com) X-ZM-MESSAGEID: 1778669942604158500 Content-Type: text/plain; charset="utf-8" From: YannickV Read flash-type value as machine property and set the flash type accordingly. Signed-off-by: YannickV --- hw/arm/xilinx_zynq.c | 25 ++++++++++++++++++++----- include/hw/arm/xilinx_zynq.h | 1 + 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c index 6c83439017..41085a3127 100644 --- a/hw/arm/xilinx_zynq.c +++ b/hw/arm/xilinx_zynq.c @@ -120,7 +120,8 @@ static void gem_init(uint32_t base, qemu_irq irq) } =20 static inline int zynq_init_spi_flashes(uint32_t base_addr, qemu_irq irq, - bool is_qspi, int unit0) + bool is_qspi, int unit0, + const char *flash_type) { int unit =3D unit0; DeviceState *dev; @@ -152,7 +153,7 @@ static inline int zynq_init_spi_flashes(uint32_t base_a= ddr, qemu_irq irq, =20 for (j =3D 0; j < num_ss; ++j) { DriveInfo *dinfo =3D drive_get(IF_MTD, 0, unit++); - flash_dev =3D qdev_new("n25q128"); + flash_dev =3D qdev_new(flash_type); if (dinfo) { qdev_prop_set_drive_err(flash_dev, "drive", blk_by_legacy_dinfo(dinfo), @@ -190,6 +191,14 @@ static void zynq_set_boot_mode(Object *obj, const char= *str, m->boot_mode =3D mode; } =20 +static void zynq_set_flash_type(Object *obj, const char *str, + Error **errp) +{ + ZynqMachineState *m =3D ZYNQ_MACHINE(obj); + g_free(m->flash_type); + m->flash_type =3D g_strdup(str); +} + static void ddr_ctrl_init(uint32_t base) { DeviceState *dev; @@ -283,9 +292,12 @@ static void zynq_init(MachineState *machine) pic[n] =3D qdev_get_gpio_in(dev, n); } =20 - n =3D zynq_init_spi_flashes(0xE0006000, pic[58 - GIC_INTERNAL], false,= 0); - n =3D zynq_init_spi_flashes(0xE0007000, pic[81 - GIC_INTERNAL], false,= n); - n =3D zynq_init_spi_flashes(0xE000D000, pic[51 - GIC_INTERNAL], true, = n); + n =3D zynq_init_spi_flashes(0xE0006000, pic[58 - GIC_INTERNAL], false,= 0, + zynq_machine->flash_type); + n =3D zynq_init_spi_flashes(0xE0007000, pic[81 - GIC_INTERNAL], false,= n, + zynq_machine->flash_type); + n =3D zynq_init_spi_flashes(0xE000D000, pic[51 - GIC_INTERNAL], true, = n, + zynq_machine->flash_type); =20 sysbus_create_simple(TYPE_CHIPIDEA, 0xE0002000, pic[53 - GIC_INTERNAL]= ); sysbus_create_simple(TYPE_CHIPIDEA, 0xE0003000, pic[76 - GIC_INTERNAL]= ); @@ -473,6 +485,9 @@ static void zynq_machine_class_init(ObjectClass *oc, co= nst void *data) "Supported boot modes:" " jtag qspi sd nor"); object_property_set_default_str(prop, "qspi"); + + prop =3D object_class_property_add_str(oc, "flash-type", NULL, zynq_se= t_flash_type); + object_property_set_default_str(prop, "n25q128"); } =20 static const TypeInfo zynq_machine_type =3D { diff --git a/include/hw/arm/xilinx_zynq.h b/include/hw/arm/xilinx_zynq.h index 0337d238ea..1720ca0db7 100644 --- a/include/hw/arm/xilinx_zynq.h +++ b/include/hw/arm/xilinx_zynq.h @@ -31,6 +31,7 @@ struct ZynqMachineState { Clock *ps_clk; ARMCPU *cpu[ZYNQ_MAX_CPUS]; uint8_t boot_mode; + char *flash_type; }; =20 #endif /* QEMU_ARM_ZYNQ_H */ --=20 2.47.3 From nobody Sat May 30 18:35:07 2026 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1778669955; cv=none; d=zohomail.com; s=zohoarc; b=io7+lkpa0DO4NPTnCqUp7ftMJWkFjFQ4949BM76Iyzf1bf/qsFyLG0V+QaJjo3uEYnPeFskLiGFcI5vBMHGyhUC8C6m2Ytos2X9SmAS8nIZCXiDSsSmNzxlXdyGnGlN/YyxksSo/Pr/8Zdf6vNAHV7mGmCV9ZsXdL66DW7JwnqA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1778669955; 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=o2t7PZDF9vUDOSmBWfSaV5aVfQQ9dcmhkK2nrRvQItQ=; b=PO+nAKy0ALR38i4cQ1/tk3Hdg9kqXsTpwawbF/IycgtB8gWtTkhRDaAnUsj/rvTvCu7ALwHRZ7SEjoFSt7vyrIKqnZT/JUEASKPSaQ0u3r2WNrPYLIsXIDfdkRF+tFuPEF9SHj+tgCyK9fLByYKiJvFnpw5yv2rWAQgLnWaWY4Q= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1778669955036174.61090622269842; Wed, 13 May 2026 03:59:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wN7Ik-000588-6G; Wed, 13 May 2026 06:58:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wN7Fi-0003Ba-Id for qemu-devel@nongnu.org; Wed, 13 May 2026 06:55:47 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wN7Fd-0001UD-Cc for qemu-devel@nongnu.org; Wed, 13 May 2026 06:55:46 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-48d102471a4so65831065e9.2 for ; Wed, 13 May 2026 03:55:39 -0700 (PDT) Received: from PC-DA2D10.beckhoff.com ([195.226.174.196]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48e8f410d9fsm56062295e9.6.2026.05.13.03.55.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2026 03:55:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778669738; x=1779274538; 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=o2t7PZDF9vUDOSmBWfSaV5aVfQQ9dcmhkK2nrRvQItQ=; b=BX57nFcXS+I7RUzA+MvABfbbBf0M+kpYyZtHlwTVbXp3gc3Om0/HeS2RttTxdMsmnj XCyOge1RmgL4bUsvBhbSKrZ1izPFl3EJ7m+nQ6VzSW9xmR1FF2pW1uzLh5Xb5ejhhkYV L2NeSta+L5+wIf0noSZHEkg4UjkUfziiFDB+a/gl7z8pKExmfsGWsGFMMLWvtchm1cIV 40qMTobQhyAAcKCM2N/ZzwQZ4w4IckWpAJ0YjfJPZCZQOpUD84cIYkN6BNsUo+/LS7FK myKFBmD+Vkkgm8RDdl4h3WW+PkGUvfLKMwahLwrNbEqnAFHDwgimz8FbDYC1eQexllJ1 7Isg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778669738; x=1779274538; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=o2t7PZDF9vUDOSmBWfSaV5aVfQQ9dcmhkK2nrRvQItQ=; b=XtwkEBRRj2z7wgCkD8jwlJIH6YKr5ukDxJi15cArXX8Nxbo4sTF4lwdw/2O6mepvbZ MTvTsj3MjqKInVvo1vcpj4/oCDV4MhTgMnA3QWeQni9msiK9UIYz5rgAR2/RnJi1J2YT yCzpAzgiq/n4GD5BRMQgLwl5JzaekepEhtsGVa4m/pOaRJFeZ27RTdQYe8FsNu3jKPkd 6M4Uirr8hhWa6ineWOo/C4DKqx/Ogd3b5x7scOSq6tWwdoCSUeQDsfgOjQKRC7BgPlYI rGn7B3ndA6giah2b+8NwtNROvxt5SLoE8Pev1HOT1Dx13ViE9+LHl8cfrKDigMnJl02U 0TwQ== X-Gm-Message-State: AOJu0Yy8YlYuAWjZliRd0cCX1f1wFG8o0wxskuqzo8orDlMgLO6EB7BR 3OM9EDzLdzeqp/H/VQJh23WXvz5YYe4/Wq6YbrWg8nLpT+rShYLoO2tDCXA4uX+c X-Gm-Gg: Acq92OF86Y4ZUyUviAF+qefGLjwHHL5FI6G7cW5T07xDMsKCEf4VT7vbfa5k1mFXApR C4/IA5pfVvyzF7oFC7cPtUq3GCna9GagXY6wIo/1EBIE54DIMgrpKr6xS/39YthWyQpHfgZKQ8J Am7taRzm+PsmLk5d97ZVAiGRKt/u0C66BQFacGMnno7X1iSMxpyJ4e/A+s6+f0VzAyFw+63qHnS BKHwlspZ2jHYPDZgCupvSLD4GQcRq6Vh/xd2X/FMSTqKaLrPKQRoQ9yVXDro8tsjKcuvN2In+BM z+KwK6+GFsMNesl5FkusBpdrNnN+wKLqWvd7VYxY4omnS6aA/obcr43VxRDpc1eOYQsjiYtMHrT 2VquNohYoYiO0MBzZb/KCG3UtnMranFSPD2fG1TDyV2I99ykaXSl3oVqa3gqtvyCpFHqs8mLmsE M9+iRLfMRN+WmweFyBgb6dA0K1dv7WBQaXrlASFNnO7pk8vWd5fnnszPs= X-Received: by 2002:a05:600c:c4ac:b0:488:936a:6220 with SMTP id 5b1f17b1804b1-48fc9a3a9c1mr39734435e9.21.1778669738403; Wed, 13 May 2026 03:55:38 -0700 (PDT) From: =?UTF-8?q?Corvin=20K=C3=B6hne?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Hanna Reitz , Kevin Wolf , qemu-arm@nongnu.org, =?UTF-8?q?Corvin=20K=C3=B6hne?= , Peter Maydell , Paolo Bonzini , Pierrick Bouvier , =?UTF-8?q?Yannick=20Vo=C3=9Fen?= , Alistair Francis , "Edgar E. Iglesias" , YannickV Subject: [PATCH v6 14/15] hw/arm: Add new machine based on xilinx-zynq-a9 for Beckhoff CX7200 Date: Wed, 13 May 2026 12:55:16 +0200 Message-ID: <20260513105517.146706-15-corvin.koehne@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260513105517.146706-1-corvin.koehne@gmail.com> References: <20260513105517.146706-1-corvin.koehne@gmail.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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=corvin.koehne@gmail.com; helo=mail-wm1-x329.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: qemu development 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 @gmail.com) X-ZM-MESSAGEID: 1778669956751158500 Content-Type: text/plain; charset="utf-8" From: YannickV Introduce a new machine type 'beckhoff-cx7200' that inherits from the xilinx-zynq-a9 machine. The CX7200 is an industrial PC based on the Xilinx Zynq-7000 SoC. The machine preserves all standard Zynq features (boot-mode selection, SPI, UART, Ethernet, etc.) while adding CX7200-specific hardware components. Signed-off-by: YannickV --- hw/arm/Kconfig | 7 +++ hw/arm/beckhoff_CX7200.c | 104 +++++++++++++++++++++++++++++++++++++++ hw/arm/meson.build | 1 + 3 files changed, 112 insertions(+) create mode 100644 hw/arm/beckhoff_CX7200.c diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig index 5b198402d5..ecb1729768 100644 --- a/hw/arm/Kconfig +++ b/hw/arm/Kconfig @@ -291,6 +291,13 @@ config ZYNQ select XILINX_SPIPS select ZYNQ_DEVCFG =20 +config BECKHOFF_CX7200 + bool + default y + depends on TCG && ARM + select ZYNQ + select BECKHOFF_CCAT + config ARM_V7M bool # currently v7M must be included in a TCG build due to translate.c diff --git a/hw/arm/beckhoff_CX7200.c b/hw/arm/beckhoff_CX7200.c new file mode 100644 index 0000000000..2edca63267 --- /dev/null +++ b/hw/arm/beckhoff_CX7200.c @@ -0,0 +1,104 @@ + +/* + * Modified Xilinx Zynq Baseboard System emulation for Beckhoff CX7200. + * + * Copyright (c) 2024 Beckhoff Automation GmbH & Co. KG + * + * Based on /hw/arm/xilinx_zynq.c: + * Copyright (c) 2010 Xilinx. + * Copyright (c) 2012 Peter A.G. Crosthwaite (peter.croshtwaite@petalogix.= com) + * Copyright (c) 2012 Petalogix Pty Ltd. + * Original code by Haibing Ma. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "hw/core/boards.h" +#include "hw/block/block.h" +#include "hw/core/loader.h" +#include "qemu/error-report.h" +#include "hw/arm/xilinx_zynq.h" /* For ZynqMachineState */ +#include "hw/cpu/a9mpcore.h" +#include "qom/object.h" + +#define TYPE_CX7200_MACHINE MACHINE_TYPE_NAME("beckhoff-cx7200") + +#define CX7200_PERIPHCLK_DIVIDER 2 +#define CX7200_PS7_CPU_CLK_FREQUENCY 720000000 + +static void ccat_init(uint32_t base, BlockBackend *eeprom_blk) +{ + DeviceState *dev; + SysBusDevice *busdev; + + dev =3D qdev_new("beckhoff-ccat"); + if (eeprom_blk) { + qdev_prop_set_drive_err(dev, "eeprom", eeprom_blk, &error_fatal); + } + busdev =3D SYS_BUS_DEVICE(dev); + sysbus_realize_and_unref(busdev, &error_fatal); + sysbus_mmio_map(busdev, 0, base); +} + +static void beckhoff_cx7200_init(MachineState *machine) +{ + DriveInfo *di; + BlockBackend *blk; + MachineClass *parent_mc; + DeviceState *a9mpcore_dev; + A9MPPrivState *a9mp_priv_state; + + object_property_set_str(OBJECT(machine), "flash-type", "is25lp016d", + &error_fatal); + + parent_mc =3D MACHINE_CLASS(object_class_get_parent( + object_get_class(OBJECT(machine)))); + parent_mc->init(machine); + + /* Find A9MPCore and set timer frequencies directly */ + a9mpcore_dev =3D DEVICE(object_resolve_path_type("", TYPE_A9MPCORE_PRI= V, + NULL)); + if (a9mpcore_dev) { + a9mp_priv_state =3D A9MPCORE_PRIV(a9mpcore_dev); + + /* Direct struct access - devices are already realized */ + a9mp_priv_state->gtimer.freq_hz =3D CX7200_PS7_CPU_CLK_FREQUENCY; + a9mp_priv_state->gtimer.periphclk_divider =3D CX7200_PERIPHCLK_DIV= IDER; + a9mp_priv_state->mptimer.freq_hz =3D CX7200_PS7_CPU_CLK_FREQUENCY; + a9mp_priv_state->mptimer.periphclk_divider =3D CX7200_PERIPHCLK_DI= VIDER; + a9mp_priv_state->wdt.freq_hz =3D CX7200_PS7_CPU_CLK_FREQUENCY; + a9mp_priv_state->wdt.periphclk_divider =3D CX7200_PERIPHCLK_DIVIDE= R; + } else { + error_setg(&error_fatal, "Could not find A9MPCore device " + "for CX7200 timer configuration"); + } + + di =3D drive_get(IF_NONE, 0, 0); + blk =3D di ? blk_by_legacy_dinfo(di) : NULL; + ccat_init(0x40000000, blk); +} + +static void beckhoff_cx7200_machine_class_init(ObjectClass *oc, + const void *data) +{ + MachineClass *mc =3D MACHINE_CLASS(oc); + + mc->desc =3D "Beckhoff CX7200 Industrial PC (Zynq-based)"; + mc->init =3D beckhoff_cx7200_init; +} + +static const TypeInfo beckhoff_cx7200_machine_type =3D { + .name =3D TYPE_CX7200_MACHINE, + .parent =3D TYPE_ZYNQ_MACHINE, + .class_init =3D beckhoff_cx7200_machine_class_init, + .instance_size =3D sizeof(ZynqMachineState), +}; + +static void beckhoff_cx7200_machine_register_types(void) +{ + type_register_static(&beckhoff_cx7200_machine_type); +} + +type_init(beckhoff_cx7200_machine_register_types) diff --git a/hw/arm/meson.build b/hw/arm/meson.build index 84b8ec5fb5..cb51d8a484 100644 --- a/hw/arm/meson.build +++ b/hw/arm/meson.build @@ -2,6 +2,7 @@ arm_ss =3D ss.source_set() arm_common_ss =3D ss.source_set() arm_common_ss.add(when: 'CONFIG_ARM_VIRT', if_true: files('virt.c')) arm_common_ss.add(when: 'CONFIG_ACPI', if_true: files('virt-acpi-build.c')) +arm_common_ss.add(when: 'CONFIG_BECKHOFF_CX7200', if_true: files('beckhoff= _CX7200.c')) arm_common_ss.add(when: 'CONFIG_DIGIC', if_true: files('digic_boards.c')) arm_common_ss.add(when: 'CONFIG_EMCRAFT_SF2', if_true: files('msf2-som.c')) arm_common_ss.add(when: 'CONFIG_INTEGRATOR', if_true: files('integratorcp.= c')) --=20 2.47.3 From nobody Sat May 30 18:35:07 2026 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1778669966; cv=none; d=zohomail.com; s=zohoarc; b=CXODBs/CcyyPq4rzG2TIYXie+02CV/jux6n2dGa7TLKVZGx8YPj2g0nruzi9LwnFzfacqjWbMws1B4tprKNYA4O811XQVvKDsWelneUnjM9dziqCB8ipJPGvQdAHvKNv6B0//41PJP2Dj7LFOmjfOe990kLIxOjgHTeFSvmaOKw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1778669966; 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=GoZtt2lK0yUwG4pPWSgeKyahL320UQGIppVE1LDSKSc=; b=OB8UTx6Vqqlr9r8BhWZkKev7sh1KIrTkpSF2i4URNUQcXf8xAugEX4gPeJhLwWiXWoso2MCoo2VknnEtBJYUFDeUauQLTYSJi6c5Tr55D9GmNGTKZ1rRhNpCi2LsUCMnqnXVHalH7hT9MO5yfzztx6o5PuYGiwhTYP54cMIfD+0= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1778669966982681.7804785175892; Wed, 13 May 2026 03:59:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wN7JB-0006zQ-5r; Wed, 13 May 2026 06:59:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wN7Fi-0003Bc-SO for qemu-devel@nongnu.org; Wed, 13 May 2026 06:55:47 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wN7Fd-0001UY-I0 for qemu-devel@nongnu.org; Wed, 13 May 2026 06:55:46 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-488b150559bso51712265e9.1 for ; Wed, 13 May 2026 03:55:40 -0700 (PDT) Received: from PC-DA2D10.beckhoff.com ([195.226.174.196]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48e8f410d9fsm56062295e9.6.2026.05.13.03.55.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2026 03:55:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778669739; x=1779274539; 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=GoZtt2lK0yUwG4pPWSgeKyahL320UQGIppVE1LDSKSc=; b=F9ccWNLDfM+DYN5txf/quuaVrjM46nkHX2TqPG8sSdEqnZAgerMrTceuX9Y77EjNKk tTJtGtBoTGaZByTxVvZIT/1iSU1stX537v4zJnbrzYGoP2h5MlghRhKaC1aaqIi1J0a+ Z1jvviaeU222UQsXnueYFvHMWYachhEs8kRV75YMylh7hqHcdxm2/H+rhVE8q7FYG5lB AP7c4LSt2InpYa9QPrinZR9CioxJB6TGUg1Ul0kvFJIXpj4Z8+cTUtI5JMbIyR3gw0xe gPn/2s59Hr5PfV5U57KerazmcQw/7bAfGzRqoFW8a7PusLdy3GSwA1HnGqASlycqE87D Tx+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778669739; x=1779274539; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=GoZtt2lK0yUwG4pPWSgeKyahL320UQGIppVE1LDSKSc=; b=rUc1qweD9QuIkaomhYncwAZVeaINlr+KMD93vmxvac/4Ekr444Qo5JlTTlK1lnj5D4 uRARiPHWWMk8Qwb91tr4a08qVpQm4uXjKTSMFoNKM6pYDLtXy16kh2biIC8TVCfGjZDW nXciDF41eb7Y7ytbzUerCNoJCqkf7aDUXgy5FPsFylcreweWWP++7reqEnvFlskUyaRf gUDbLuJiOMAK8zSzbAmR+fGPeJ8JYVQsMmeh1egCiYXfq4/gO+OxBaakHzBLKliuHhwm 9T6LMLY+xW5MhE7h7iY7olpQEbCsKUjCs46kr+pcy74yBTl5dChVI3d04QePUMA8L5fd q6Bg== X-Gm-Message-State: AOJu0YxeNpEP8QvdIyyGgh9lv/aTeKp/s3KnmPWQbC2QrEbarGHvCddP nRLHqTpkhGXqtGHgyvEEAAMD2W/MxZTJJRC2HTbfcplCGQf69DsfDpCk8MuJxUA2 X-Gm-Gg: Acq92OEU3zGXG1adnLTvoCb9hcheQqfOD/RGcotQFuHkK1vLjIyqqHqPpGRPWDdYbIT Z3RgCbdFqOXIN4MAwJwuiPeDp5lGYEG8Zif5zLdMbdtl6EheANSEVlsMy0QbiyEDF+1YpNp++Tb DzIAQJt0jgBl/KoclA9qPIE4xOQdgUnCg8TmfulGoqlitS2jiZsrOWLnFu9dOt5Zn2jZ2e6tXx4 8HdLnqkEw5fC+tc7EXgNwJdQUMV9EPBXmCwB30oz3pF9a7YBG4pvjJzQ2X05WM1/WyGAHX81+3P k3R3fj82zXbH8+b31gt6PpxB4qlhO2LQFw1LKDDwobaYK1mN0f34BY39gY36EKYK+EsRy0Dmiur IKE1kZYNZMomYCSkAWj72x5gGxgYVIGYXs3pzkKi96xn2G+myYMu6Dk0ZsieYjldi2Ao2aYcz11 HsWMe3FyiZsbqHfL0eAE1BXD6mCfLtHyA5SmHQFWNaZBwn X-Received: by 2002:a05:600c:8b13:b0:48a:6315:da26 with SMTP id 5b1f17b1804b1-48fc9a53bdbmr40751085e9.26.1778669739592; Wed, 13 May 2026 03:55:39 -0700 (PDT) From: =?UTF-8?q?Corvin=20K=C3=B6hne?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Hanna Reitz , Kevin Wolf , qemu-arm@nongnu.org, =?UTF-8?q?Corvin=20K=C3=B6hne?= , Peter Maydell , Paolo Bonzini , Pierrick Bouvier , =?UTF-8?q?Yannick=20Vo=C3=9Fen?= , Alistair Francis , "Edgar E. Iglesias" , YannickV Subject: [PATCH v6 15/15] docs/system/arm: Add support for Beckhoff CX7200 Date: Wed, 13 May 2026 12:55:17 +0200 Message-ID: <20260513105517.146706-16-corvin.koehne@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260513105517.146706-1-corvin.koehne@gmail.com> References: <20260513105517.146706-1-corvin.koehne@gmail.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=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=corvin.koehne@gmail.com; helo=mail-wm1-x335.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, WEIRD_QUOTING=0.001 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: qemu development 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 @gmail.com) X-ZM-MESSAGEID: 1778669968770158500 Content-Type: text/plain; charset="utf-8" From: YannickV This commit offers some documentation on the Beckhoff CX7200 qemu emulation. Signed-off-by: YannickV --- docs/system/arm/beckhoff-cx7200.rst | 57 +++++++++++++++++++++++++++++ docs/system/target-arm.rst | 1 + 2 files changed, 58 insertions(+) create mode 100644 docs/system/arm/beckhoff-cx7200.rst diff --git a/docs/system/arm/beckhoff-cx7200.rst b/docs/system/arm/beckhoff= -cx7200.rst new file mode 100644 index 0000000000..f060319b0f --- /dev/null +++ b/docs/system/arm/beckhoff-cx7200.rst @@ -0,0 +1,57 @@ +Beckhoff CX7200 (``beckhoff-cx7200``) +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +The Beckhoff CX7200 is based on the same architecture as the Xilinx Zynq A= 9. +The Zynq 7000 family is based on the AMD SoC architecture. These products +integrate a feature-rich dual or single-core Arm Cortex-A9 MPCore based +processing system (PS) and AMD programmable logic (PL) in a single device. +The Beckhoff Communication Controller (CCAT) can be found in the PL of Zyn= q. + +More details here: +https://docs.amd.com/r/en-US/ug585-zynq-7000-SoC-TRM/Zynq-7000-SoC-Technic= al-Reference-Manual +https://www.beckhoff.com/de-de/produkte/ipc/embedded-pcs/cx7000-arm-r-cort= ex-r/cx7293.html + +The CX7200 supports following devices: + - A9 MPCORE + - cortex-a9 + - GIC v1 + - Generic timer + - wdt + - OCM 256KB + - SMC SRAM@0xe2000000 64MB + - Zynq SLCR + - SPI x2 + - QSPI + - UART + - TTC x2 + - Gigabit Ethernet Controller + - SD Controller + - XADC + - Arm PrimeCell DMA Controller + - DDR Memory + - DDR Controller + - Beckhoff Communication Controller (CCAT) + - EEPROM Interface + - DMA Controller + +Following devices are not supported: + - I2C + +Running +""""""" +Directly loading an ELF file to the CPU of the CX7200 to run f.e. TC/RTOS = (based on FreeRTOS): + +.. code-block:: bash + + $ qemu-system-arm -M beckhoff-cx7200 \ + -device loader,file=3DCX7200_Zynq_Fsbl.elf \ + -display none \ + -icount shift=3Dauto \ + + +For setting the EEPROM content of the CCAT provide the following on the co= mmand line: + +.. code-block:: bash + + -drive file=3Deeprom.bin,format=3Draw,id=3Dccat-eeprom + +The size of eeprom.bin must be aligned to a power of 2 and bigger than 256= bytes. diff --git a/docs/system/target-arm.rst b/docs/system/target-arm.rst index c57102a414..fbe8ef5584 100644 --- a/docs/system/target-arm.rst +++ b/docs/system/target-arm.rst @@ -82,6 +82,7 @@ Board-specific documentation arm/aspeed arm/bananapi_m2u.rst arm/b-l475e-iot01a.rst + arm/beckhoff-cx7200 arm/sabrelite arm/digic arm/cubieboard --=20 2.47.3