From nobody Thu Apr 3 11:35:53 2025 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=1742310691; cv=none; d=zohomail.com; s=zohoarc; b=ZYbTWsd5BzaX+LwJpEI94EmFseRGU5Z5Q7MizTVvkx9Fsu58DPkQhC+ISuQVVkW/l924yib4JGsZEg5yy5EhCqDPQ+VZFhqQbFSEadPp3NeIQTYfXNPj04qjigP/n25a7MtbgEiTC4/BKCkVvPxOPchD6O+yBotMOJxY0fTAgkI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742310691; 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=mCS//sQC/Pd3mJsOjU1j+UGkPkKFk8gzbUC/mzKDYOc=; b=lqiWFwgadY9EGb8/56ACQscSXlTA8RCUPtcD3hACK5ODcXMdeCiE9UM8XrsmLttYmpXrFHpjvddlw1yRJOy6I2P2i73I30SWL6PsyAD71qe/JmpAMsoy6tUAxP/0SXPEQrJ40NTk/806P4kEFGK27MetfWRnQ6L7qEit4oSFibg= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1742310691843842.3612859072564; Tue, 18 Mar 2025 08:11:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tuWgv-00062t-AY; Tue, 18 Mar 2025 09:09:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tuWgq-0005mN-0H; Tue, 18 Mar 2025 09:09:04 -0400 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tuWgm-00037E-Uz; Tue, 18 Mar 2025 09:09:03 -0400 Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-aaf0f1adef8so513033066b.3; Tue, 18 Mar 2025 06:09:00 -0700 (PDT) Received: from corvink-nb.beckhoff.com ([195.226.174.194]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ac3147f3101sm850678066b.69.2025.03.18.06.08.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Mar 2025 06:08:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742303339; x=1742908139; 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=mCS//sQC/Pd3mJsOjU1j+UGkPkKFk8gzbUC/mzKDYOc=; b=kgHvL0MYi4zAf/Dk0++e8t+MubG60EzFUHfEGen7OrfenXx6hrvk8z0hEPNeqJOGR6 MZCQOvkVvOIXtWDQ6B6mY1xRGLslIpu+hiDXrC/sAYdmNrnKEer7KfSHWB49/E/4Ea1L W9/4eqWMFwo3HtmqDaUnH8MeTXT1DgISEZlpBt85EX2XEkLE0MBuCx+D1OnS3U4NP1Wc nnurCUtPNK4JMT469VZ+bs24cE4eleVoz0AEk7xeTaoZ7i6dedpSTwCUoDweWwmLBgMg 4e9Tbi/FZsc3twwix4kGW88G5xlG++l2iUIkjCfP+KP7rTUse2XEe5oH8okIiCqSNEDw tsyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742303339; x=1742908139; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mCS//sQC/Pd3mJsOjU1j+UGkPkKFk8gzbUC/mzKDYOc=; b=p0r1W+pUB6oAHGiJD+KuZCwRCAOiAmzxjwcu0Uqvpyqq3lN8/soyC5wO06zjUAIRko QLH3PyCMBm3ihRQ9t14uobWW0WaZItOQhf5U7WVSjZ0O7zKiHuPlpW2XXIF4G2dIzYJg Up99bpITXYNzWDkl2AyvRXGhME1gh30OaeeDK+ju4vUS4n88V5OP73wZ/U5Ao1oqCVPb 23wxzilmH7SDM4EuuVfP2q9p1r3zcIRxCMQ3Hd9QPx9BUV2ZpN1vsnrBE2EPCxOUxBho xt+fhoZcQ/FodBhJC95E4eXHA40otW1XUpqf/xvwsh9GWDgWnHi1umDxMQOgtdp2Hw4K R66Q== X-Forwarded-Encrypted: i=1; AJvYcCWtUCJYtjNE5+0XJdB3z1CLrqOCp31NExDvQkIZiQTh44SCNhcMtlovCA7XrMBKbEftqYhVEJXpYA==@nongnu.org X-Gm-Message-State: AOJu0YzDO3s5z0hB8UklA2yBR1AUbBHM3+QvGbVSsIvvBOesHoPKfsY8 ozkBfGMtE6Szck3tGiUB+oLgVkFdPLXTFXintTkVuZrAaNFnRMyTZU+YJg8S X-Gm-Gg: ASbGncuc2cCdWsOjxxhX1crc93L/Ho5N5LRsfaQMSNGsDAbNPdaOnWQoRAq7qdQ+4Js AJ3iz6tRaYd2oCrEkFZpBlea73nL6wqnPEbwCdWWREjV5VerOxpFniqxtK/YU90NvEPuoGFYGSv FRCrO9p1WxRFZ8T4aQcBCUuIbqZsnlYmDz4MCYsj+8XcfMNAwnpP31ujyzrlKRskbfmzHhvgE+d 3TNgUL9oZaxWBl9Ly2EGMLCZJK3DjSUaLTTHYK4AaoLT8KgFxpbGFLbwcetlRn/nHOtT6nE0sJA MF+dkF+IHE9+p63Cxb+Sqx0qUJS375hCRnC5NeoqqqQ7DUR0rj/87Uls0U89PIcuoAGhU0XzuBr qog== X-Google-Smtp-Source: AGHT+IGthgh2JCMge8aKmPYzXb+hQCwzKN1UHgrNMMhr8esvu9jlzrLtxc/TLtb9yAmLVo8MDZIXLg== X-Received: by 2002:a17:906:6a27:b0:ac2:7be7:95c5 with SMTP id a640c23a62f3a-ac3303225c3mr1741297866b.33.1742303327933; Tue, 18 Mar 2025 06:08:47 -0700 (PDT) From: =?UTF-8?q?Corvin=20K=C3=B6hne?= To: qemu-devel@nongnu.org, qemu-arm@nongnu.org Cc: =?UTF-8?q?Yannick=20Vo=C3=9Fen?= , "Edgar E. Iglesias" , Peter Maydell , Alistair Francis , =?UTF-8?q?Corvin=20K=C3=B6hne?= , Paolo Bonzini , YannickV Subject: [PATCH 01/21] hw/timer: Make frequency configurable Date: Tue, 18 Mar 2025 14:07:52 +0100 Message-ID: <20250318130817.119636-2-corvin.koehne@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250318130817.119636-1-corvin.koehne@gmail.com> References: <20250318130817.119636-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=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::630; envelope-from=corvin.koehne@gmail.com; helo=mail-ej1-x630.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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: 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: 1742310693089019100 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 frequency can also be set via the command line, for example for the a9 global timer: -global driver=3Darm.cortex-a9-global-timer, property=3Dcpu-freq,value=3D1000000000 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: Yannick Vo=C3=9Fen --- hw/timer/a9gtimer.c | 8 +++++--- hw/timer/arm_mptimer.c | 15 +++++++++++---- include/hw/timer/a9gtimer.h | 1 + include/hw/timer/arm_mptimer.h | 2 ++ 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/hw/timer/a9gtimer.c b/hw/timer/a9gtimer.c index 9835c35483..a1f5540e75 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 ret =3D NANOSECONDS_PER_SECOND * prescale * 10; + return (uint32_t) (ret / s->cpu_clk_freq_hz); } =20 static A9GTimerUpdate a9_gtimer_get_update(A9GTimerState *s) @@ -374,6 +374,8 @@ static const VMStateDescription vmstate_a9_gtimer =3D { }; =20 static const Property a9_gtimer_properties[] =3D { + DEFINE_PROP_UINT64("cpu-freq", A9GTimerState, cpu_clk_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 803dad1e8a..a748b6ab1a 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 ret =3D NANOSECONDS_PER_SECOND * prescale * 10; + return (uint32_t) (ret / 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->clk_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, @@ -283,6 +287,7 @@ static const VMStateDescription vmstate_timerblock =3D { .minimum_version_id =3D 3, .fields =3D (const VMStateField[]) { VMSTATE_UINT32(control, TimerBlock), + VMSTATE_UINT64(freq_hz, TimerBlock), VMSTATE_UINT32(status, TimerBlock), VMSTATE_PTIMER(timer, TimerBlock), VMSTATE_END_OF_LIST() @@ -301,6 +306,8 @@ static const VMStateDescription vmstate_arm_mptimer =3D= { }; =20 static const Property arm_mptimer_properties[] =3D { + DEFINE_PROP_UINT64("clk-freq", ARMMPTimerState, clk_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 6ae9122e4b..8ce507a793 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 cpu_clk_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 65a96e2a0d..8b936cceac 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 clk_freq_hz; uint32_t num_cpu; TimerBlock timerblock[ARM_MPTIMER_MAX_CPUS]; MemoryRegion iomem; --=20 2.49.0 From nobody Thu Apr 3 11:35:53 2025 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=1742306950; cv=none; d=zohomail.com; s=zohoarc; b=YwnuVkHFItBWLaI/iSMdFnCDCUN7YKPvHfYK0rlAFma4DwSr8S2yrkxyLkDJQTkKFrlwFlMXxoRSegh3BJwINXPJkiohpNJy2tm5iebPr9fOY330TOyrd8ctISyk6zJw000b+7SIfNOq1sWNHcAfQ2ELGWuwtt+XX/FaALxZ68A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742306950; 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=xSqhzaN+M9hdNsbBzriOUGWRrnB6G7MJ7OrsPut7pwk=; b=AeLnNkU17bJ/emp33dI/ECx6btXr0xk27VhunMkw3CiGzkQxwY2jL8SIsKhlijJxfmq2rzBXInBfdiV+ylXPMEVBd/Gl014HNS0stgzhwJj74Oq4fNjp7brM67OZNunOzRPK/PsaEYt/6ydpHUPX7ggxxrS7X80xujknseYEYcI= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 174230695088991.2912308526752; Tue, 18 Mar 2025 07:09:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tuWho-00072W-3u; Tue, 18 Mar 2025 09:10:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tuWh3-0006Ro-Ve; Tue, 18 Mar 2025 09:09:23 -0400 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tuWh1-0003B6-Ck; Tue, 18 Mar 2025 09:09:17 -0400 Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-ac25d2b2354so956144366b.1; Tue, 18 Mar 2025 06:09:14 -0700 (PDT) Received: from corvink-nb.beckhoff.com ([195.226.174.194]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ac3147f3101sm850678066b.69.2025.03.18.06.08.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Mar 2025 06:08:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742303353; x=1742908153; 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=xSqhzaN+M9hdNsbBzriOUGWRrnB6G7MJ7OrsPut7pwk=; b=JIter+l3AchIETleV+OG7GmB28f9PThHGIOD7nKSK5SkfibsDh3sCBj2X2sS9DpYbN /nmMhBl6r5KKU8YrlNT6XaeRta6eYw9Wgyjy6wMTJV+ReO02M6Un6WZMhMEZfHjmbqGS TeWuyOz7uYYoxSd5UQ6/8f5jjYvV/Q9QbATt4RIbp4C3lFphXRqsOsAW2WCcbcHuC2kx ATHLcMQ/QhFsMGtHET/jXXvHYwRmoB3OJUjqzCxpns8zgifzRc+PeUowWndf4rEq2EdI LXVQQ2jyMnqg/bzc7wo09nv+PsvosUZd1q3vVY/5gz65hL840el5mCD08SvT4bxsy+Oa kaTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742303353; x=1742908153; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xSqhzaN+M9hdNsbBzriOUGWRrnB6G7MJ7OrsPut7pwk=; b=GicRI1q2YROdOKVnTMf7uPBhdSsQ/cjHrYLy8h4mJVcHulk1N41dDmC1QGNaVoQ5yk P6r1g/V/oAd0ufPq2P5I/Gq/6usF5O/eWHYvSveGduAr2onmnUHb51ZucEDE8LNn0nSf rCqxtTTAslkbRmZ/4XxSS7PFDprwFr7zCtceH5m7hdOfbr/RMD13FqpyAtd/AD8SmwTn WONEGgRHckUn9UZDRYl4a7tLpTQZEcZKix7Xcl02y69nNFSfysyxGswDGB6+5cer1+fo O06lj8WpMwuN3FpUJuX3PxXthJZfdyCD02JVsdfLnMtDOSWKPZhExeBIpUWxpjEI6WRf Be9g== X-Forwarded-Encrypted: i=1; AJvYcCXkKFOIIWCgBLU33P6o/0eHLlU3kwBRyyMeb/t07NwPX7+McOYcJi7tKZKxZqn3iluSGK1XNLYTQw==@nongnu.org X-Gm-Message-State: AOJu0YyfxR5OmULA9J3rXWvrEa2IQ+0GwMKgSr4KWPgrdTnGewi/doCU yy9q3FJgpEH2TNZ/P5NH8fdhEO4D474EYdKBRyx/G1WSEiu1tFlh7qAuLf9/ X-Gm-Gg: ASbGncsANJrXAcdL0tT2JGAYSTxjrOQYuA2B/b9v7I8EI1YRn89yDt4HxYD1SsPo1Ut Qb0Web9mNhlAhzjoA3rnpp+kz3DowsBIb+016NpA8unp9BkR64HXkYPeuIIAZ9XG2VHOXNVlIVG dGQ7zxxLItVlI3K0ouwIfLyWaHAUCTFzWTuGIhnh1UtYOwCpdx1wJt9wnCFBSqJWrkNq8c0G8aA L8zn0xoqA65u4XQTTdcW/2hioQQ6WQzA5EsMTA9WNQGDNV8wRAyJQ8u/SCIxfc2iFIFcrNRTJk5 i5clT8/8qRn7Uctzjd3tdl99hFTnJPr5pBzxN8rxjizifkPnxcxm0uFt55wT+7czPYo= X-Google-Smtp-Source: AGHT+IFV5Fk2KtlA54F4IdB0wl0hXoN/YP2bAza4Zc5oy8tbYdixl24f+aM8TGdNnpt1gQI1or2JtA== X-Received: by 2002:a17:907:9495:b0:abe:c81a:985d with SMTP id a640c23a62f3a-ac3304d6112mr1439830366b.48.1742303342285; Tue, 18 Mar 2025 06:09:02 -0700 (PDT) From: =?UTF-8?q?Corvin=20K=C3=B6hne?= To: qemu-devel@nongnu.org, qemu-arm@nongnu.org Cc: =?UTF-8?q?Yannick=20Vo=C3=9Fen?= , "Edgar E. Iglesias" , Peter Maydell , Alistair Francis , =?UTF-8?q?Corvin=20K=C3=B6hne?= , Paolo Bonzini , YannickV Subject: [PATCH 02/21] hw/timer: Make PERIPHCLK period configurable Date: Tue, 18 Mar 2025 14:07:53 +0100 Message-ID: <20250318130817.119636-3-corvin.koehne@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250318130817.119636-1-corvin.koehne@gmail.com> References: <20250318130817.119636-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=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::631; envelope-from=corvin.koehne@gmail.com; helo=mail-ej1-x631.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: 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: 1742306952894019100 From: YannickV The a9 global timer and arm mp timer rely on the PERIPHCLK as their clock source. The period of PERIPHCLK (denoted as N) must be a multiple of the core CLK period, with N being equal to or greater than two. However, the current implementation does not take the PERIPHCLK period into account, leading to unexpected behavior in systems where the application assumes PERIPHCLK is clocked differently. The property periphclk-period represents the period N, the CLK is devided by to get the peripheral clock PERIPHCLK. We can now configure clock properties for the a9 global timer and arm mp timer. That ensures timers can behave according to the applications needs. The PERIPHCLK period can also be set via the command line, for example for the a9 global timer: -global driver=3Darm.cortex-a9-global-timer, property=3Dperiphclk-period,value=3D2 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: Yannick Vo=C3=9Fen --- hw/timer/a9gtimer.c | 19 ++++++++++++++++++- hw/timer/arm_mptimer.c | 20 +++++++++++++++++++- include/hw/timer/a9gtimer.h | 1 + include/hw/timer/arm_mptimer.h | 2 ++ 4 files changed, 40 insertions(+), 2 deletions(-) diff --git a/hw/timer/a9gtimer.c b/hw/timer/a9gtimer.c index a1f5540e75..83aa75889e 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 + *=20 + * 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 ret =3D NANOSECONDS_PER_SECOND * prescale * 10; + uint64_t ret =3D NANOSECONDS_PER_SECOND * prescale * s->periphclk_peri= od; return (uint32_t) (ret / s->cpu_clk_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_period < 2) { + error_report("Invalid periphclk-period (%lu), must be >=3D 2", + s->periphclk_period); + exit(1); + } + for (i =3D 0; i < s->num_cpu; i++) { A9GTimerPerCPU *gtb =3D &s->per_cpu[i]; =20 @@ -377,6 +392,8 @@ static const Property a9_gtimer_properties[] =3D { DEFINE_PROP_UINT64("cpu-freq", A9GTimerState, cpu_clk_freq_hz, NANOSECONDS_PER_SECOND), DEFINE_PROP_UINT32("num-cpu", A9GTimerState, num_cpu, 0), + DEFINE_PROP_UINT64("periphclk-period", A9GTimerState, + periphclk_period, 10), }; =20 static void a9_gtimer_class_init(ObjectClass *klass, void *data) diff --git a/hw/timer/arm_mptimer.c b/hw/timer/arm_mptimer.c index a748b6ab1a..767413c77a 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 + *=20 + * 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 ret =3D NANOSECONDS_PER_SECOND * prescale * 10; + uint64_t ret =3D NANOSECONDS_PER_SECOND * prescale * tb->periphclk_per= iod; return (uint32_t) (ret / 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->clk_freq_hz; + if (s->periphclk_period < 2) { + error_report("Invalid periphclk-period (%lu), must be >=3D 2", + s->periphclk_period); + exit(1); + } + tb->periphclk_period =3D s->periphclk_period; 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, @@ -288,6 +303,7 @@ static const VMStateDescription vmstate_timerblock =3D { .fields =3D (const VMStateField[]) { VMSTATE_UINT32(control, TimerBlock), VMSTATE_UINT64(freq_hz, TimerBlock), + VMSTATE_UINT64(periphclk_period, TimerBlock), VMSTATE_UINT32(status, TimerBlock), VMSTATE_PTIMER(timer, TimerBlock), VMSTATE_END_OF_LIST() @@ -309,6 +325,8 @@ static const Property arm_mptimer_properties[] =3D { DEFINE_PROP_UINT64("clk-freq", ARMMPTimerState, clk_freq_hz, NANOSECONDS_PER_SECOND), DEFINE_PROP_UINT32("num-cpu", ARMMPTimerState, num_cpu, 0), + DEFINE_PROP_UINT64("periphclk-period", ARMMPTimerState, + periphclk_period, 10), }; =20 static void arm_mptimer_class_init(ObjectClass *klass, void *data) diff --git a/include/hw/timer/a9gtimer.h b/include/hw/timer/a9gtimer.h index 8ce507a793..edb51f91e3 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 cpu_clk_freq_hz; + uint64_t periphclk_period; uint32_t num_cpu; =20 QEMUTimer *timer; diff --git a/include/hw/timer/arm_mptimer.h b/include/hw/timer/arm_mptimer.h index 8b936cceac..2c4cb5c1c3 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_period; qemu_irq irq; MemoryRegion iomem; } TimerBlock; @@ -45,6 +46,7 @@ struct ARMMPTimerState { /*< public >*/ =20 uint64_t clk_freq_hz; + uint64_t periphclk_period; uint32_t num_cpu; TimerBlock timerblock[ARM_MPTIMER_MAX_CPUS]; MemoryRegion iomem; --=20 2.49.0 From nobody Thu Apr 3 11:35:53 2025 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=1742304887; cv=none; d=zohomail.com; s=zohoarc; b=VQiTB3qDK7Ul4cbkODd5JoMnlI8dN/kZkQTmYDd1duno35tHFYc4moXQhAhZCKqIXWdC+22WNF/JvK2eIJsraNZXfx8vHkdSZQpkjSZXrXv3TIiEfK64SzjlT4wRZ5E5GXx0QEQu1P5uOxnKdE3vUtUw9QNRSnXneQYeqiQF0hU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742304887; 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=uXgguamS/88zT4sb5yhR3Coxq4Lng1O5rbRFwYp/Un8=; b=bhiizJ8ly8TIpvazF1VFLwMVGP420MXeZASCr1w7Qd9TP5Y7AHbN6ArLZZtnD6F/gpXLefXZkHPO1xyYUz7Zi0OpxgFSnKPsp+fXJCx4DsRBJwKK1Jja9NNDkK7Y6HFlQ15iavX+0ItPEIUg13uEHyOyr5LZfLQSXeACuHtDE2Y= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1742304887731683.7720502627001; Tue, 18 Mar 2025 06:34:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tuWhw-0007T6-PM; Tue, 18 Mar 2025 09:10:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tuWhn-00077R-2H; Tue, 18 Mar 2025 09:10:05 -0400 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tuWhk-0003KR-GZ; Tue, 18 Mar 2025 09:10:01 -0400 Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-ac25d2b2354so956375166b.1; Tue, 18 Mar 2025 06:09:58 -0700 (PDT) Received: from corvink-nb.beckhoff.com ([195.226.174.194]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ac3147f3101sm850678066b.69.2025.03.18.06.09.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Mar 2025 06:09:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742303397; x=1742908197; 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=uXgguamS/88zT4sb5yhR3Coxq4Lng1O5rbRFwYp/Un8=; b=R9o6ebsbhkP9cLWOYzX4g5UNnY3sYBbKu4KAB7bK/mZb+rq2AmFjfNlYhk4r4S99cq bMqtYa5ok/mKEsMIS3Au/Nu/wfejOMYvX2mXEhD1TVkCWK5DzjiP3m42HTipFrmIM6SK ZOac1/cuFaz3hXmoLT5297owLVoxT7ws84mN9Ltj2+d3HwHBUt6M4OO4Bzz+fhGb0mEU uxqCNEkO9IoYDz31TPFZwwG+XpLnnHYbrLqE5boeFGGYLbZaU+Dif7M41kh4eMZ/MEQ4 zMTdxJTQYyzGP2jJ/eszVZo5zYhzk93MO1uvl1/BvFIOhRhVG9M2+IvLIxC/4qqTD+aS zpVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742303397; x=1742908197; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uXgguamS/88zT4sb5yhR3Coxq4Lng1O5rbRFwYp/Un8=; b=unfc83ZhUBBaqJzZsMEqYFzlMULN7MzUPSBdtLX4vAIszfRuJxlk1cefDVMd1p2/Ag DL27nwrxyLc580+Y68OjK5pgn7SJSjJFa3gnfytEcZXEWMc/fHsINsxW2XODO1c/wbfp kOaDmcUeItqN8atnIcZDFKO8iOVS6aEQPtichnxOAgxAu4/Pa3pZK0II+2yp6W66sGjq It6LLmbD2O3DpXIXGqPRK9L3+Kv2fwYvQ6dM0s16iQvoXWomPoVvWyfrXPnLXIbRdQ+G qa6wg2rz0g+NCHOCA/3BsgGOv3CrCUv38dbF41upJHQ+z2tiZKbBMgxSYXPjY2KIroPR 1OfQ== X-Forwarded-Encrypted: i=1; AJvYcCUT9nRpbhCCvekZQvyCdgYXJAWKKX/v6myOfrXOjy7w0fzYgw8V3iKfSqJ0ln/kbwUy/NOfuP4yWA==@nongnu.org X-Gm-Message-State: AOJu0Yxrn8J9vAdR5PYClOI6+pQN3MuDcEfBCqrweSLGcUpg3RxfpbOU jO+pFvg44iHCXD9nhnTslh0MMbcYlMzYu/C6NeyWl8qhx/+v55EyknOxDzql X-Gm-Gg: ASbGncvCeKe5DSWQzbh1nt2wg8MzMGPTHeTiQOlBFzgQQkCfPOq3+j4MxYJtxiURJHH U+U4Gd+h11ChbOoCtBmF7cgm7GF2ukQdRWbXrs/nVj3Y09049Awrx2Uef8lqp/3BFwUXb5bn8Z0 5C1+v2EvDxi2du6l5sirEMx/bmnCM9NwpJqlOuKfpo86Ybe4T8k2YiMFHFsMBejcotnAplhDb63 TZKBg7QLD+h3DrAg4C9XrnX+qPzsqcx9xluurh/l3beRyv6pTWxVdEvOB6F6FkAnuKasgcpBZ0V i410SlNddAjCQKyyLfAaiGEA7V8GlBGn3VQ29+nD1IFxjiU5HxP3fdjmzLxoGTkw479C2nDSkIQ pbA== X-Google-Smtp-Source: AGHT+IEUHCao1moDe4xUw1JRQqtzI2KYGrcDyrTPXHrOUnbQQlbrcxN18uKXc08Ao4MDif8gNNFUhQ== X-Received: by 2002:a17:907:2d89:b0:abf:6cc9:7ef5 with SMTP id a640c23a62f3a-ac3304d6079mr1804692866b.47.1742303393389; Tue, 18 Mar 2025 06:09:53 -0700 (PDT) From: =?UTF-8?q?Corvin=20K=C3=B6hne?= To: qemu-devel@nongnu.org, qemu-arm@nongnu.org Cc: =?UTF-8?q?Yannick=20Vo=C3=9Fen?= , "Edgar E. Iglesias" , Peter Maydell , Alistair Francis , =?UTF-8?q?Corvin=20K=C3=B6hne?= , Paolo Bonzini , YannickV Subject: [PATCH 03/21] hw/dma/zynq-devcfg: Handle bitstream loading via DMA to 0xffffffff Date: Tue, 18 Mar 2025 14:07:54 +0100 Message-ID: <20250318130817.119636-4-corvin.koehne@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250318130817.119636-1-corvin.koehne@gmail.com> References: <20250318130817.119636-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=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::630; envelope-from=corvin.koehne@gmail.com; helo=mail-ej1-x630.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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: 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: 1742304889323019000 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: Yannick Vo=C3=9Fen --- 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 0fd0d23f57..b838c1c0d0 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.49.0 From nobody Thu Apr 3 11:35:53 2025 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=1742306940; cv=none; d=zohomail.com; s=zohoarc; b=Sy+9osn9Nw5VkuO3WxkGpxGFfVGyxYJRBFCPy9ALV2yCr4cPPE0FU5/EmsZki9mHdyNXNeR/M7bG/AT1FfOjXWl04zZEUoC+YRQZryt5M+T3eFp5aSFxxgd7yKzhfggLfB3/aFXJW1/JSASsu7xlElS5tcYyMic32dsTweFx/p0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742306940; 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=mggqB81grCqRlFJug6lfjJdqHWYTQWBu9Z0EKFmQF74=; b=hnJhk6vN48cm87Szur0WCWs1d4ES9y1JP2Cfrn6SyGUsFqlh8hPSrKTn8f4g2RlHWaP/wN7Kmr0pZFaqqBjPoFCBDjYq68+2N9iDBAi6QJ5KIdEoZlmC+6DwezHYZZ9ZydS5EoSx1PzFs6NDa5v2lKj0759IenzsaIbZh2Lnivw= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1742306940442945.1069482653461; Tue, 18 Mar 2025 07:09:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tuWiW-0008Pd-Ng; Tue, 18 Mar 2025 09:10:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tuWiE-00083h-Gy; Tue, 18 Mar 2025 09:10:41 -0400 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tuWiB-0003f9-3C; Tue, 18 Mar 2025 09:10:30 -0400 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-ac25d2b2354so956551266b.1; Tue, 18 Mar 2025 06:10:25 -0700 (PDT) Received: from corvink-nb.beckhoff.com ([195.226.174.194]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ac3147f3101sm850678066b.69.2025.03.18.06.09.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Mar 2025 06:09:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742303424; x=1742908224; 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=mggqB81grCqRlFJug6lfjJdqHWYTQWBu9Z0EKFmQF74=; b=Da2N9IWkV5mD4hbrTGHJGRlb2qWphmlol0ymnU0pEBCy3tGaVLt4RXYe/dwPHCOVNB w5cGQedJvsuo/4ANxSZzTv2QO9fhltI3S8dXVTL9LEhfgS0/N8PVNeFagx1M3npPkaOT QDCBNO31zLXh597UT4UUKhE3IXhi/fZXHrRSisbQPolevJ+FvGKaapWrOvOq3DFhfjpx SczLKrPs3jfQkrGQqYPadcnUeC3pJ7NCg9gcr/ETBMqTIQCy+zcYQTl6NbKpeZLOHLiq m3/TM/aTIw3W++4eg6QUijjJKK2289UXbz+xSJGvimAe4htCtK6UDW+zMUzDdcwY6EKD gIRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742303424; x=1742908224; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mggqB81grCqRlFJug6lfjJdqHWYTQWBu9Z0EKFmQF74=; b=ERffCxemPuFF5t98FmQOuXNYlJo/OTJS4Bmsa4ZJfNQKUzv/ix4SGq+fhhh8nV3dnK zPAwDMD90o+N9cMC8h2uMwuTpjQdAdesBmB+uRRFCr9zAduqAbmOMHJV0zybpxm3G/bo 4D25m30YSkukDrEPkIgTlx0rv/tXrDK7GMyb+wvG/+lWyuiJU+C0S156IF7t0SFl/wXs BCrx7KsFYhpz4vO9i2G2KzRImdioBcWpaU8U0x6W1jsjvabHR0z19uQIfaKAeBf1+p68 ywor5FG4onY/omQaCcj75SAyUPeXcS06IogeO3nNRV91Go+Oc1eULirYLEiSafSI6egk 7GpA== X-Forwarded-Encrypted: i=1; AJvYcCVsbU7fGbwoI0+oHelcX8pnKVavmhOhVzgIPyGOUEEb8bI6P8LMwgp6vE6Q9yPtFa2HJZ2dB22mAA==@nongnu.org X-Gm-Message-State: AOJu0YxYRavG/BFb6TDhj6GBT9uC7Er8EkdWeopJFPQCPdVVA6vnoKpF rbNtxyWEXymVLZtKa44T3DrBa/g8U0MKN7+JG0yHjc4F++NpUvsLd6cJ/hJe X-Gm-Gg: ASbGncuzxxZnau1+V/QQpRKITb0mWkACD7hZKBDbm2dAeT/YsrwL3QSIQ8SCjv0nkAb cqW4x62syqFXYMPlcesWygV5bZSCIAnjsNMScRRcI8CoPgP37LmPEZtQVZqVdyz+NHhdX/x/4p/ QHs+qgy8Jci9ueLvsEYpMmFYIuJkSQVDkrSqkbIzDlU/wiS6opQ00VXlIkVNLhd9l+KzbZ/YXW0 vhYQWRXpZ751xf5h3kwqjAT+Jp4kfV+ZZXyqaxFgQk189rw2xG6hC1UFZz+7MxSLyAFctMGojly SElBR9EPR9JpzEKNXG3SF3iNE66q+aVr1TfloLXKT1NDkXdaX7gx/EegUh8evg7wMVk= X-Google-Smtp-Source: AGHT+IHUto3hASebI0ih7GIScn07BWDKs+1MsLnPSfAv/i4vvmVCgQ0ZCM7sCnVcGga+InEB3EV1+Q== X-Received: by 2002:a17:906:6a0b:b0:ac3:4489:7910 with SMTP id a640c23a62f3a-ac344897c1fmr1423080466b.49.1742303400739; Tue, 18 Mar 2025 06:10:00 -0700 (PDT) From: =?UTF-8?q?Corvin=20K=C3=B6hne?= To: qemu-devel@nongnu.org, qemu-arm@nongnu.org Cc: =?UTF-8?q?Yannick=20Vo=C3=9Fen?= , "Edgar E. Iglesias" , Peter Maydell , Alistair Francis , =?UTF-8?q?Corvin=20K=C3=B6hne?= , Paolo Bonzini , YannickV Subject: [PATCH 04/21] hw/arm/zynq-devcfg: Prevent unintended unlock during initialization Date: Tue, 18 Mar 2025 14:07:55 +0100 Message-ID: <20250318130817.119636-5-corvin.koehne@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250318130817.119636-1-corvin.koehne@gmail.com> References: <20250318130817.119636-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=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::636; envelope-from=corvin.koehne@gmail.com; helo=mail-ej1-x636.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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: 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: 1742306942265019000 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. To address this, a property 'is_initialized' is introduced. It is set to false during reset and updated to true once the initialization is complete. The unlock function is simply ignored while 'is_initialized' is false. I have no idea how this ever worked. Nevertheless, this restores the correct behavior. Signed-off-by: Yannick Vo=C3=9Fen --- hw/dma/xlnx-zynq-devcfg.c | 6 +++++- include/hw/dma/xlnx-zynq-devcfg.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/dma/xlnx-zynq-devcfg.c b/hw/dma/xlnx-zynq-devcfg.c index b838c1c0d0..03b5280228 100644 --- a/hw/dma/xlnx-zynq-devcfg.c +++ b/hw/dma/xlnx-zynq-devcfg.c @@ -143,9 +143,11 @@ static void xlnx_zynq_devcfg_reset(DeviceState *dev) XlnxZynqDevcfg *s =3D XLNX_ZYNQ_DEVCFG(dev); int i; =20 + s->is_initialized =3D false; for (i =3D 0; i < XLNX_ZYNQ_DEVCFG_R_MAX; ++i) { register_reset(&s->regs_info[i]); } + s->is_initialized =3D true; } =20 static void xlnx_zynq_devcfg_dma_go(XlnxZynqDevcfg *s) @@ -221,7 +223,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 (!s->is_initialized) { + return; + } if (val =3D=3D R_UNLOCK_MAGIC) { DB_PRINT("successful unlock\n"); s->regs[R_CTRL] |=3D R_CTRL_PCAP_PR_MASK; diff --git a/include/hw/dma/xlnx-zynq-devcfg.h b/include/hw/dma/xlnx-zynq-d= evcfg.h index e4cf085d70..2ab054e598 100644 --- a/include/hw/dma/xlnx-zynq-devcfg.h +++ b/include/hw/dma/xlnx-zynq-devcfg.h @@ -55,6 +55,8 @@ struct XlnxZynqDevcfg { XlnxZynqDevcfgDMACmd dma_cmd_fifo[XLNX_ZYNQ_DEVCFG_DMA_CMD_FIFO_LEN]; uint8_t dma_cmd_fifo_num; =20 + bool is_initialized; + uint32_t regs[XLNX_ZYNQ_DEVCFG_R_MAX]; RegisterInfo regs_info[XLNX_ZYNQ_DEVCFG_R_MAX]; }; --=20 2.49.0 From nobody Thu Apr 3 11:35:53 2025 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=1742303658; cv=none; d=zohomail.com; s=zohoarc; b=c0l5y5qgBG0QYPdPYZTbWHeRzty+7y+SM6yM16BYGvHN1jJeUwelOyMqqB1f1xSBeazmSI8Tpq8LZS95cvN+1qsRCwcEAHqk8VeCAkSkYrMC8H0X6LX9oVnW28008e9FPpd2VC3WhWYb7xcZdQStBoWpnXU0DzY4I8pGAmPm13o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742303658; 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=SozXszkG31YRNwyf2TrQDfv+7hb5ByzoAPkFEtmPEVA=; b=PwRt+tJVACpKopi79PEVAG29DBsvHjjd+c5VDTCKoEFm7KYGsJT5k+T9whF3OppThL63X6AfqCeHmMQye9jU1/nhrN0JoqTYdGV/KWmEWjkJf3kVTH80OGxOTMfd3J1S4G72bhDgxrfg60ccLIF2/6gAQ3nG/G0LDgSJLrV9xlk= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1742303658515883.0297363747568; Tue, 18 Mar 2025 06:14:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tuWia-0000Kj-RK; Tue, 18 Mar 2025 09:10:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tuWi7-00081M-2B; Tue, 18 Mar 2025 09:10:30 -0400 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tuWi4-0003e1-Iz; Tue, 18 Mar 2025 09:10:22 -0400 Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-ac25d2b2354so956510866b.1; Tue, 18 Mar 2025 06:10:19 -0700 (PDT) Received: from corvink-nb.beckhoff.com ([195.226.174.194]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ac3147f3101sm850678066b.69.2025.03.18.06.10.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Mar 2025 06:10:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742303418; x=1742908218; 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=SozXszkG31YRNwyf2TrQDfv+7hb5ByzoAPkFEtmPEVA=; b=Ki3i7akrX7Os+sHwPf7hIrZvBjXarg+dYvowIMkpdG866zLCfQhFqzJtk85PE3Zt3q v4bXHGBh7qilquy8K7bgYiXZSq31zWLvrmg3BRlVFzKuOXlHVCHzMR4KtP9iY0nePzZU nDbM3/Bfnyg7wG1cPDLSwN/votqsFkcTmYc+h6mZAuZoRuRt3FIyYf6yTMtFSJg7C0PU R0D5KzNuoOToSEMIsy6ZJPGz1Y65thwwY28fnZqwtIQvxXh17U9RlqxHDuqh7GY+0iv5 HR1H/vGn0ChGpivsI48sFVSaU8MibESlFvja2Vxk49FenhMILTzITpxR/8x16n/Cu0Zr rhjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742303418; x=1742908218; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SozXszkG31YRNwyf2TrQDfv+7hb5ByzoAPkFEtmPEVA=; b=ibS6fictacpLKXf9ANoRbzUl8mAr0nw7a1CdhBB3DzGmA5zeUYQOYbC6IHC1xmHk4B gnoeBS5eqNp8K5/dNNWlBq5VwWDA3W4z3hrXPApD3QgfbpXkVMiZvXhT1T+sxlDLHdsK xTJJtWD3+cboOnhdVERwcQjCwtVymGoDlHgfsQbrIHaP/yGyfvM11ju7TQaDYk2nGvrg 1Ulhg+wT+KXaJCqU3Bb9pr2e1JHM3I0GN0yuBK5Nj58ftNiUcL+tAs2TMm2VbY2IRaJm K5Q5nZYpaHAjT9VGKIv35TbkqcYcMXQ+z5GM1Q2hPfm3g6MUnD7KJtJ6UkyC2gI1My8f JkdA== X-Forwarded-Encrypted: i=1; AJvYcCU284TvZorRllxx/gfk0KfjHdocxNOy9LjRz9WIHuYQ+fm1bfw2l4CFD0JPZggfZ1T/pZznIx/NxA==@nongnu.org X-Gm-Message-State: AOJu0Yxp08slqXq0Rn1AiBz0fU9IKwRfb4di9rA0+iLzBlMHcyLbEzA0 EZO4C+NDmekfU1GCHkrgxX1syiXZCgxDJZCgzUC1+4LFhpNBsdsQuc119tDI X-Gm-Gg: ASbGncslFs081OuhQN5jvRlV3Np+OSAcOAfRXI/x7sWNMfXblyiHGGOjm8YApZDeLg9 dIZOBlQInoFb+33aeHRDo4Pd6oQafgAAStKqsEOP8oMvwAD9yFGONVM1RJ9EqYx6QCzbwQ8n9nb NcLgmJGxU1nP5jenZLTu4e22nZI2ZF9PlqGnjxkDbbFrceEhcfm+sEN7kXgfL9ZGHqCuerOkoG7 CupWFRG2icK2aBe81AQE78ra4aAEx9k60aREgmtZqyhAUDHh9rte7luCVM8wfu7hG6hmU+Z1CDl qEWXR0jQiTlZbT3lnteOTeR5yvr35i3JoVsb6uRam4bLTBouGWzN1X1winBCtOGiQYo= X-Google-Smtp-Source: AGHT+IGmZzSU37v1cJSEPDwzraMCy7qKeCYt1s/NiEPp4sykw39xgGCTQyycokvd6NKvByWJ6zNJgA== X-Received: by 2002:a17:907:d9f:b0:ac3:8d37:b33b with SMTP id a640c23a62f3a-ac38d37b37emr358706766b.13.1742303411992; Tue, 18 Mar 2025 06:10:11 -0700 (PDT) From: =?UTF-8?q?Corvin=20K=C3=B6hne?= To: qemu-devel@nongnu.org, qemu-arm@nongnu.org Cc: =?UTF-8?q?Yannick=20Vo=C3=9Fen?= , "Edgar E. Iglesias" , Peter Maydell , Alistair Francis , =?UTF-8?q?Corvin=20K=C3=B6hne?= , Paolo Bonzini , YannickV Subject: [PATCH 05/21] hw/dma/zynq: Notify devcfg on FPGA reset via SLCR control Date: Tue, 18 Mar 2025 14:07:56 +0100 Message-ID: <20250318130817.119636-6-corvin.koehne@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250318130817.119636-1-corvin.koehne@gmail.com> References: <20250318130817.119636-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=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::635; envelope-from=corvin.koehne@gmail.com; helo=mail-ej1-x635.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: 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: 1742303660496019000 From: YannickV When the FPGA_RST_CTRL register in the SLCR (System Level Control Register) is written to, the devcfg (Device Configuration) should indicate the finished reset. Problems occure when Loaders trigger a reset via SLCR and poll for the done flag in devcfg. Since the flag will never be set, this can result in an endless loop. A callback function `slcr_reset_handler` is added to the `XlnxZynqDevcfg` structure. The `slcr_reset` function sets the `PCFG_DONE` flag when triggered by an FPGA reset in the SLCR. The SLCR write handler calls the `slcr_reset` function when the FPGA reset control register (`R_FPGA_RST_CTRL`) is written with the reset value. Signed-off-by: Yannick Vo=C3=9Fen --- hw/dma/xlnx-zynq-devcfg.c | 7 +++++++ hw/misc/zynq_slcr.c | 16 ++++++++++++++++ include/hw/dma/xlnx-zynq-devcfg.h | 1 + 3 files changed, 24 insertions(+) diff --git a/hw/dma/xlnx-zynq-devcfg.c b/hw/dma/xlnx-zynq-devcfg.c index 03b5280228..611a57b4d4 100644 --- a/hw/dma/xlnx-zynq-devcfg.c +++ b/hw/dma/xlnx-zynq-devcfg.c @@ -138,6 +138,11 @@ static void xlnx_zynq_devcfg_update_ixr(XlnxZynqDevcfg= *s) qemu_set_irq(s->irq, ~s->regs[R_INT_MASK] & s->regs[R_INT_STS]); } =20 +static void slcr_reset (DeviceState *dev) { + XlnxZynqDevcfg *s =3D XLNX_ZYNQ_DEVCFG(dev); + s->regs[R_INT_STS] |=3D R_INT_STS_PCFG_DONE_MASK; +} + static void xlnx_zynq_devcfg_reset(DeviceState *dev) { XlnxZynqDevcfg *s =3D XLNX_ZYNQ_DEVCFG(dev); @@ -374,6 +379,8 @@ static void xlnx_zynq_devcfg_init(Object *obj) XlnxZynqDevcfg *s =3D XLNX_ZYNQ_DEVCFG(obj); RegisterInfoArray *reg_array; =20 + s->slcr_reset_handler =3D slcr_reset; + sysbus_init_irq(sbd, &s->irq); =20 memory_region_init(&s->iomem, obj, "devcfg", XLNX_ZYNQ_DEVCFG_R_MAX * = 4); diff --git a/hw/misc/zynq_slcr.c b/hw/misc/zynq_slcr.c index a766bab182..9b3220f354 100644 --- a/hw/misc/zynq_slcr.c +++ b/hw/misc/zynq_slcr.c @@ -26,6 +26,7 @@ #include "qom/object.h" #include "hw/qdev-properties.h" #include "qapi/error.h" +#include "hw/dma/xlnx-zynq-devcfg.h" =20 #ifndef ZYNQ_SLCR_ERR_DEBUG #define ZYNQ_SLCR_ERR_DEBUG 0 @@ -576,6 +577,21 @@ static void zynq_slcr_write(void *opaque, hwaddr offse= t, zynq_slcr_compute_clocks(s); zynq_slcr_propagate_clocks(s); break; + case R_FPGA_RST_CTRL: + if (val =3D=3D 0) { + Object *devcfgObject =3D + object_resolve_type_unambiguous("xlnx.ps7-dev-cfg", NU= LL); + if (!devcfgObject) { + break; + } + DeviceState *devcfg =3D OBJECT_CHECK(DeviceState, devcfgObject, + "xlnx.ps7-dev-cfg"); + XlnxZynqDevcfg *zynqdevcfg =3D XLNX_ZYNQ_DEVCFG(devcfg); + if (zynqdevcfg) { + zynqdevcfg->slcr_reset_handler(devcfg); + } + } + break; } } =20 diff --git a/include/hw/dma/xlnx-zynq-devcfg.h b/include/hw/dma/xlnx-zynq-d= evcfg.h index 2ab054e598..f48a630c5a 100644 --- a/include/hw/dma/xlnx-zynq-devcfg.h +++ b/include/hw/dma/xlnx-zynq-devcfg.h @@ -56,6 +56,7 @@ struct XlnxZynqDevcfg { uint8_t dma_cmd_fifo_num; =20 bool is_initialized; + void (*slcr_reset_handler) (DeviceState *dev); =20 uint32_t regs[XLNX_ZYNQ_DEVCFG_R_MAX]; RegisterInfo regs_info[XLNX_ZYNQ_DEVCFG_R_MAX]; --=20 2.49.0 From nobody Thu Apr 3 11:35:53 2025 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=1742303779; cv=none; d=zohomail.com; s=zohoarc; b=D0TiVsW4bG6+plr085efqcRBkt3wqOdyEpHshCEO6paZ2ADBVoHT4xLsB+F74DShhtLECSf57WbtUNAY7qTxGbNwzZ9I3Cv+pAwAPoYaGxlze52Shq5ch+EGxWXUYfKfhuT2gGOmBlbJ2OW2UKS/uMKrXw6EHKU4wLP7T/ZxGFo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742303779; 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=1G7hSFteNb8Ei9umQoeYx+vzWa3qyKqrpQiR8QrHJCs=; b=hnk9Uk8l36OCjkmrRLoHSiY1+vauTWeXY6s6oIGDhtuV9x0U8dNDLKhbWu393hyaZHzc4Cj/X/WdYuaxLD8ukTeUIlCX21apXPHFT0jTO+yrUMSVU0nVh/2Pou5SbMJDZ3LM5jTZZAe2IWBhqJGI6aVl4DZzX/9dN7MdNVnJG0g= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1742303779433774.1676289802368; Tue, 18 Mar 2025 06:16:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tuWib-0000Oy-Tx; Tue, 18 Mar 2025 09:10:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tuWiJ-00084M-Nh; Tue, 18 Mar 2025 09:10:42 -0400 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tuWiH-0003g0-Pg; Tue, 18 Mar 2025 09:10:35 -0400 Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-ac298c8fa50so1046306866b.1; Tue, 18 Mar 2025 06:10:31 -0700 (PDT) Received: from corvink-nb.beckhoff.com ([195.226.174.194]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ac3147f3101sm850678066b.69.2025.03.18.06.10.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Mar 2025 06:10:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742303430; x=1742908230; 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=1G7hSFteNb8Ei9umQoeYx+vzWa3qyKqrpQiR8QrHJCs=; b=duHA4i6Jn/MaNjF/a6zZNKSTcXYcQ8vIGTPIxkrNkXvt54FixtUyKxF9LgVmNSRet/ TVZ4ln6PmdJG2IKLP7WcSIhZeKpqIl3Y7d/xiHMG3XiqNmvk3u52uVBZz7UcaPQUSHEs aZ21BviM+98+Y3JpXrqV9wihsIvbw75TYrOUh+vRQAZkpW9GUmJCmAlE4hNBFZ9hTZSn +xV/C551WRJKg2NhSBuSvNM9VQqg6EMDm0yzq0tDFFEqR25EiRhws7Q2fLwJFdbIl+HB WO9te9O2tr9mraLg8y9wE0RROQyg1gYQGoXYGbwEs61F3wL+P0mf8nwkI49H0DARrnF6 tjNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742303430; x=1742908230; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1G7hSFteNb8Ei9umQoeYx+vzWa3qyKqrpQiR8QrHJCs=; b=FlyyNAkSHufQfwcTRd+jYMeYT2yz7J0+vUsd+vLuOgGWASm46n+H9+8Y8v09P1aR+a i2vrAhwBYCQq6G2RV0I7levX/irgTosYveY9SoTgJXHDn1jF/c3EzPrUz5EcLCmkkyqt jcJBs44/woP+1XvXmqXgaI2RfR22lYAEJbJAyBZLLyGuivHBmoLVIUlnHyKnffjIFdjn ftKxB8OJeGsVRLnco1VrGFENDvlneubgmlSyekNrisWFB/yR08RIh+Ey1XQO6+7vP7cp iLn2tp9Xyhbt9DIsXV7BrlpB9laZHV+nEH9SSBNQDuvrGCPiklSbldrQFhHPUsvJgMeX udyQ== X-Forwarded-Encrypted: i=1; AJvYcCWFT80MLp6MegScCrTA9QcfVdR8lZs8EOXzX94sJOT6txODUcchrirDtzvzPatCNsAVPxFwy5TT9Q==@nongnu.org X-Gm-Message-State: AOJu0YzcUTgA3L4+BPYb9zbmAFnDuemwNRambKIw4Yhp9Kf6I14g5Cy6 jNlQhFKe55O3eVlBdQc9byz98T/8NrtiMUVlhnawdEB6mu10W0oC+jv/syog X-Gm-Gg: ASbGncvb2UDAts3GiJIOj8B5qHenSjXT/bDaZP4HyhGIBgG/X8CSYALGFa25Gw2O2OQ S/BZHSaMfPD5bRTw21bHPWbTmR7HOX8aPLRpBBqXw08OHd1X6O9e3EM9kv+pWV9rJhXW0rBiE8W z/7Zx7ZKXgSvbw6sCevuYKQ8rYYnou/W9X88KOTFSKAPxkmaYfVs2feywkESdj1Smh6HR1BECmf Es8N0hX5e3G74xmCzl6U+FcMicXJzrgxZAYgRweuwLUYeFjKRiLRsAiFWf74vJaNyxGyT02SK4b /WjFffAHPLEr0YYezaSLPOBkZtO6dvFTB1bw20gUSXStQR1AylMoZ+WffyzvYfm/Aoo= X-Google-Smtp-Source: AGHT+IHfFobVjvuuug6M3ImzyoJ7UeMyS3NRx2uUbsMvRum4kfiIaMbCen3uCkRrcGqJCw88XHPG7w== X-Received: by 2002:a17:906:6a0a:b0:ac2:9c7d:e144 with SMTP id a640c23a62f3a-ac3303f770amr1898767966b.40.1742303419230; Tue, 18 Mar 2025 06:10:19 -0700 (PDT) From: =?UTF-8?q?Corvin=20K=C3=B6hne?= To: qemu-devel@nongnu.org, qemu-arm@nongnu.org Cc: =?UTF-8?q?Yannick=20Vo=C3=9Fen?= , "Edgar E. Iglesias" , Peter Maydell , Alistair Francis , =?UTF-8?q?Corvin=20K=C3=B6hne?= , Paolo Bonzini , YannickV Subject: [PATCH 06/21] hw/dma/zynq-devcfg: Simulate dummy PL reset Date: Tue, 18 Mar 2025 14:07:57 +0100 Message-ID: <20250318130817.119636-7-corvin.koehne@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250318130817.119636-1-corvin.koehne@gmail.com> References: <20250318130817.119636-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=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::630; envelope-from=corvin.koehne@gmail.com; helo=mail-ej1-x630.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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: 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: 1742303781236019100 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: Yannick Vo=C3=9Fen --- hw/dma/xlnx-zynq-devcfg.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hw/dma/xlnx-zynq-devcfg.c b/hw/dma/xlnx-zynq-devcfg.c index 611a57b4d4..c44b802b22 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) @@ -209,6 +211,14 @@ static uint64_t r_ctrl_pre_write(RegisterInfo *reg, ui= nt64_t val) val |=3D lock_ctrl_map[i] & s->regs[R_CTRL]; } } + + uint32_t pcfg_prog_b =3D FIELD_EX32(val, CTRL, PCFG_PROG_B); + if (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.49.0 From nobody Thu Apr 3 11:35:53 2025 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=1742303663; cv=none; d=zohomail.com; s=zohoarc; b=fV7xYsIqjUl0FPvauOcDiQoB1Kni+18LYeldKu2h6Iw2LyMr23gn9k9NIz5vsYP9f9CUykpzGQXTOtgLIiEjRAFO4y2BwncLglsvWRsjU17ySSysu1BJObkMdoZE49ZQoqp4FW7IYX847RubANOnZIqMW94OWTmufbQs/Qi45SE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742303663; 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=wAclm7ArIW59Xy/Sq2KiOGinq6EwwyMSaziuoXbOUS4=; b=ZhzUzF2KjVAOAm69pxKK53VR50jFdbW5F1DV+msQndGGShVshCWRTS3lbFz3j7ZvxDrkzj9t4UWa1LqjqQH4NxPbpdmQFHdG3omTdSrekvQjuxk4Euk2m18gZDuAfTKwsYN9QPcO1jlvcmj+KFpApKf8KZF+RrFsl08iyqE1Y58= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1742303663673763.4479290661282; Tue, 18 Mar 2025 06:14:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tuWil-0001Ns-98; Tue, 18 Mar 2025 09:11:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tuWiY-0000Ar-D1; Tue, 18 Mar 2025 09:10:50 -0400 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tuWiW-0003ho-Fs; Tue, 18 Mar 2025 09:10:49 -0400 Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-5e5b572e45cso10726380a12.0; Tue, 18 Mar 2025 06:10:47 -0700 (PDT) Received: from corvink-nb.beckhoff.com ([195.226.174.194]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ac3147f3101sm850678066b.69.2025.03.18.06.10.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Mar 2025 06:10:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742303445; x=1742908245; 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=wAclm7ArIW59Xy/Sq2KiOGinq6EwwyMSaziuoXbOUS4=; b=aMoolKBGETVk2owJzWNIg6mFLZ9ppED7QK+4Cvrmpai16o2WprXEuZNqapp3OLiMig jxZP6AMBUttPnReLvFPHGFO95UwYxmZ2CEUyrLk4ugMoigMkvvnCvsQrjQ2nWLYkOgu/ T0aJAmAn1joxIeWL7ig9s+2GZnYaYNlqKPCWAJ5AforIl/DE+SSxVbMDoQdFeOMRkzXU VlKDfqPXRb18EsuXJ6AbVGOk22lKzerrw+NWIkbIyjzAP/ch1GhiPf/kFfEUUzxGC90E qB8xVazrtvMYaldN++hX+lPGoGGg34ITTpfk5TH6ntDmPaKbH672Dlb4+rfgwwvNdFUY kM/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742303445; x=1742908245; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wAclm7ArIW59Xy/Sq2KiOGinq6EwwyMSaziuoXbOUS4=; b=r1pEcMCTHWchQ5/sh/xTXA2rQZjK98J5nEJfLlgChhCrDh+IzDAm+lDS0yzSNizD7T icDOoBsiKhzYQYypGMzOxZ0jsDZCwybaLo/u338vmTGMH2uBrQEZfyb5PEUt+cNSPOB4 Ao1X04HM//HUxtNZbU9OCFMr1TKdhYQHNyja1Bk72gLkj1XaYiqUeWiGyDZKwIR2TECK uIZexFNESHJmfG0WEli0h1femrxHqA58XxOH1PruyaJeKZ776+9DCnXo6kX9DgiFJYUp PHnbwqprOhM9ZDc5IFxlXtG2Cy0vJvmyhuWDJfAhHCHK5w98aV/4Aw7gpE3IxO21Nh9P Bm4Q== X-Forwarded-Encrypted: i=1; AJvYcCWqG4oUJIglqDLyyf6WcjRInw08qN9afBcJ2lqHLB7QCBZrCEXw+uoMW7ZWh4xcVyiqUFykx2sOcg==@nongnu.org X-Gm-Message-State: AOJu0Yxo+V2iR8QX3PMXlqTM/aFghfBmWD3EOAjG24JvN2Wu1w6qq3Gw BRug2cr2ZiD3I5oFcGm2BuRFQg6QDN6VW/7ONmcRoX4IrpUqwaLHH/mPmGHj X-Gm-Gg: ASbGncsC1iITHJipGNXkqbEqJHOAWMbGOiLy1kc/VZdjk3OVckFhOtp2AvYDzQZEdgU tHgxqLTnRtV1mPV7N2urSwAISFQc8kSCjuz1QNTsMhuufIXH11L7H1Xdxlt5pWc2x3AFyjaZHeo sr0a6EM55lGzt/IgtdNX4EBqQq6EU421T6KjmXQ3OOUWjqBmsVHY3z8qiLwdvmM0Efq/M8K9VEa 8LsSq09RZPvdA+QAOVqVTy1Mzw3NsPqt8XPEveaG6R0ih+hKVjfliAOMilEpgsI85uzI9OcOHak 1TzHtM47EUywmQYujPZu5tqtg2XEHCtoCWiGC4GGEdIohA9//dw+aEFy5C16cYUz5VI= X-Google-Smtp-Source: AGHT+IEurEGe5xm5apxv19GIinDvN0XWKNZYuodTsHhOeJ0W9fyNWY1zJm0wgZquoe44UHYaqKwSNQ== X-Received: by 2002:a17:906:6a0a:b0:ac1:dc6d:af30 with SMTP id a640c23a62f3a-ac330397d6emr1953535666b.39.1742303431629; Tue, 18 Mar 2025 06:10:31 -0700 (PDT) From: =?UTF-8?q?Corvin=20K=C3=B6hne?= To: qemu-devel@nongnu.org, qemu-arm@nongnu.org Cc: =?UTF-8?q?Yannick=20Vo=C3=9Fen?= , "Edgar E. Iglesias" , Peter Maydell , Alistair Francis , =?UTF-8?q?Corvin=20K=C3=B6hne?= , Paolo Bonzini , YannickV Subject: [PATCH 07/21] hw/dma/zynq-devcfg: Indicate power-up status of PL Date: Tue, 18 Mar 2025 14:07:58 +0100 Message-ID: <20250318130817.119636-8-corvin.koehne@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250318130817.119636-1-corvin.koehne@gmail.com> References: <20250318130817.119636-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=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::52d; envelope-from=corvin.koehne@gmail.com; helo=mail-ed1-x52d.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: 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: 1742303664394019000 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. This commit is necessary for the Beckhoff CX7200 board emulation that has a FPGA implemented in the PL. Signed-off-by: Yannick Vo=C3=9Fen --- hw/dma/xlnx-zynq-devcfg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/dma/xlnx-zynq-devcfg.c b/hw/dma/xlnx-zynq-devcfg.c index c44b802b22..c595d090fa 100644 --- a/hw/dma/xlnx-zynq-devcfg.c +++ b/hw/dma/xlnx-zynq-devcfg.c @@ -339,7 +339,7 @@ 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 | 1 << R_MCTRL= _PCFG_POR_B_SHIFT | R_MCTRL_QEMU_MASK, .ro =3D ~R_MCTRL_INT_PCAP_LPBK_MASK, .rsvd =3D 0x00f00303, }, --=20 2.49.0 From nobody Thu Apr 3 11:35:53 2025 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=1742303651; cv=none; d=zohomail.com; s=zohoarc; b=AGgI8b/cJhN+i/RMoJMF2MkVgIVsLoxI1BfF91+LSGJshx3UWtl781wNnGhJuI1qotuWI1t6F2/AGabPbIqK7ywpCLLz5l6fxhhLsU3I2pVCkGzElozq+lZmIgh8MVFSjyEgjMNgdaV3kVBNbkRS2LjF3WCeI1OfVdyNjbpKvrE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742303651; 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=0cc1uZY19mfyr0bTj71wtNtnhiaEWQlAkAZt8nIkpWE=; b=avAONbI8Q4x0O7KOd3rxUoqmX4c5hnOz1y4zshFRLGbmCJQP575PeFlbSxGB7nsu5LJCeWwu2zeWBiHrOpGiVwml41AhJhJ9H8ZzakwURyGYsAwdL2BlZN0K3wCRNEX3LK8gRQgJFh8H2d7B70wFJdpQ4zf624Mc4S+u+9wI1K4= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1742303651529447.0426970196272; Tue, 18 Mar 2025 06:14:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tuWjo-0002Xk-Sf; Tue, 18 Mar 2025 09:12:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tuWiq-0001ts-J1; Tue, 18 Mar 2025 09:11:09 -0400 Received: from mail-lj1-x229.google.com ([2a00:1450:4864:20::229]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tuWio-0003la-Fc; Tue, 18 Mar 2025 09:11:08 -0400 Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-30bae572157so56630771fa.3; Tue, 18 Mar 2025 06:11:04 -0700 (PDT) Received: from corvink-nb.beckhoff.com ([195.226.174.194]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ac3147f3101sm850678066b.69.2025.03.18.06.10.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Mar 2025 06:10:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742303463; x=1742908263; 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=0cc1uZY19mfyr0bTj71wtNtnhiaEWQlAkAZt8nIkpWE=; b=jVIBAN+urq1B3opUxjK+RiS0Mw84yZSlhTkeH21Dt8JljuVUGDc8dtpnArGHhDg/xF hWQfpueJD1SBN2tdvwAiLZzHKFwEwTg4VV8v2wGWaH2brneLCnEJ5aSxq41s8Bgj11Hv DTgkbMG8tE+3pvNdnSHYGKM1PZze6woKeE0obMWGN2lRRkSxulrFcNs7ABOEq812vznE rX1QgZqZ3m94zY6KoJZyVNmKeAITfwRhTXNMD0Xq0rXN8bDi6jMF/84lS87NJ0mEvBqx j9cBB+JvY+3fI8/AjAR758w3uT6anW01VnB1ZFU1rzcPbhMkU8NN3qdhBqaSy6nnCjko bdJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742303463; x=1742908263; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0cc1uZY19mfyr0bTj71wtNtnhiaEWQlAkAZt8nIkpWE=; b=rP0DLie17Q/nrlaF4Jg8Bod2uNEcnzUFUIt4GUebEaSEArkTiZ+CnzbzsSFnTlsgep AvLfQT2QlfFZYnTKGjFKSshfsVyVkSZ/PrPfQBibkJeIE06/4zH/hwXKkQUtac2l0YCb GNaggENddXOC+WQmrtnD66X6G4SJmjgtOq3hBtmSSU0Ms0svG6oBxPKU/ZLQC4ACNdnL IKLcSzTNbYB8Gn4s9WlOuBm4TFiCghYZWlC9PB4KcKZXT5QyNxkAuga48G4eH9KCKwxV VBuNDliakErM9BKL03EzywOIZL5usz3kCwT4bdtiut8ycVPgR8qwpDULI9jgj4VBaW7D 2fvA== X-Forwarded-Encrypted: i=1; AJvYcCWDgxnWT26+ppWU0iy0/kAalcuYnKZXnuz++sMPJ/fkKyiXtbRf8db6+ujBypUPrTuFQWFAEUtqtg==@nongnu.org X-Gm-Message-State: AOJu0Yxy9hjnmL6lVKqTGdxotiANjZQ2u9uGTuybCsNn83/Jo4RadX7a WAwoFfFMhaXVo5sPwLk0bDv3KsHI6zwl0orH7IDKJ4nk4DoZc5f8ArAeaCdL X-Gm-Gg: ASbGnctjCwuFLjPSpwWK7VRljXOLlb6+uy0BdeBoMByYfPWz+hronSfc8Nbj1OxRqvW +Ux6MupfcPloOMRkirlhzcJ9ShD3OBrdiAPDOJQelM4lrXFWQfn158eaBw7+4dPPNHSQLSZ47b9 oATZJfXfMQmRWzIWaJUR8i3/YxghJ1dKH5iCvCveR24QQUx7b4kO9ShW3e0EfX6WFW3nDLGk8zO e7FXhpREOjZ5IiZwecmUvtvRqZSUsoKnFzdCQ1vDGx1d+mYm40n2hveJU+iSir6Ikh7lQfQcjVy j+EMI9cGRMg3AZ3PcgvvEbX3zegzVg2/wXRmU6WB5mglKRnjEeB+NjgVpJ+0xPGXex0= X-Google-Smtp-Source: AGHT+IHwT1XLLORMDllqjLTe01RDYTLtyhmLqkNxCh58gk3HHiNRNQAqN7J99vv+LnWYu2+dINHGgw== X-Received: by 2002:a17:907:97d3:b0:ac3:cff:80f1 with SMTP id a640c23a62f3a-ac3303e70e3mr1680550766b.54.1742303442070; Tue, 18 Mar 2025 06:10:42 -0700 (PDT) From: =?UTF-8?q?Corvin=20K=C3=B6hne?= To: qemu-devel@nongnu.org, qemu-arm@nongnu.org Cc: =?UTF-8?q?Yannick=20Vo=C3=9Fen?= , "Edgar E. Iglesias" , Peter Maydell , Alistair Francis , =?UTF-8?q?Corvin=20K=C3=B6hne?= , Paolo Bonzini , YannickV Subject: [PATCH 08/21] hw/dma/zynq-devcfg: Fix register memory Date: Tue, 18 Mar 2025 14:07:59 +0100 Message-ID: <20250318130817.119636-9-corvin.koehne@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250318130817.119636-1-corvin.koehne@gmail.com> References: <20250318130817.119636-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=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::229; envelope-from=corvin.koehne@gmail.com; helo=mail-lj1-x229.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: 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: 1742303652318019000 From: YannickV Registers are always 32 bit aligned. R_MAX is not the maximum register address, it is the maximum register number. The memory size can be determined by 4 * R_MAX. Currently every register with an offset bigger than 0x40 will be ignored, because the memory size is set wrong. This effects the MCTRL register and makes it useless. This commit restores the correct behaviour. Signed-off-by: Yannick Vo=C3=9Fen --- hw/dma/xlnx-zynq-devcfg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/dma/xlnx-zynq-devcfg.c b/hw/dma/xlnx-zynq-devcfg.c index c595d090fa..24461677ef 100644 --- a/hw/dma/xlnx-zynq-devcfg.c +++ b/hw/dma/xlnx-zynq-devcfg.c @@ -400,7 +400,7 @@ static void xlnx_zynq_devcfg_init(Object *obj) s->regs_info, s->regs, &xlnx_zynq_devcfg_reg_ops, XLNX_ZYNQ_DEVCFG_ERR_DEBUG, - XLNX_ZYNQ_DEVCFG_R_MAX); + XLNX_ZYNQ_DEVCFG_R_MAX * 4); memory_region_add_subregion(&s->iomem, A_CTRL, ®_array->mem); --=20 2.49.0 From nobody Thu Apr 3 11:35:53 2025 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=1742303841; cv=none; d=zohomail.com; s=zohoarc; b=cLblyBBt4UjziZWPmfbma4xj389OO03AK3x48IsQ+d04NNcUBAkhRegbDLSbNrnsJ9BrTgdvRlVw77EWhY4B5rQhQVu457L1tFYSRuNHJxOuUosgxEEltvAo1XO8M+RF+xntJNnf5Zz/ctwyfBqj6w7p8vz0ilaJOkDr4GHsxwA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742303841; 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=8z+PHMNfzA0XW1PBgVhogbq+RReNZeV3FJfN4W1yf98=; b=ZsselANjBYM5Dr+23dG9gXCtP8zP5VEM3OqhBNCzpvelf0FlvzKSwrgdGXfDB0XCiGtzOBLF6SBL5FAE+zZufP9oxY7yvCn1Wm+6uaSm1zux+2GAkw53fHw61AYFJ7NDiTqxscDz91syKgYP4wR17dU2vEzGccIHhqShVAB/9Bs= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1742303840988543.5216099393199; Tue, 18 Mar 2025 06:17:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tuWir-0001r4-Cx; Tue, 18 Mar 2025 09:11:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tuWik-0001Lr-Ds; Tue, 18 Mar 2025 09:11:02 -0400 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tuWih-0003l4-DK; Tue, 18 Mar 2025 09:11:01 -0400 Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-ac2ab99e16eso185092766b.0; Tue, 18 Mar 2025 06:10:58 -0700 (PDT) Received: from corvink-nb.beckhoff.com ([195.226.174.194]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ac3147f3101sm850678066b.69.2025.03.18.06.10.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Mar 2025 06:10:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742303457; x=1742908257; 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=8z+PHMNfzA0XW1PBgVhogbq+RReNZeV3FJfN4W1yf98=; b=bJg2A4sebX/6VWcyZbFM9bfqE8BhQzCdwL2PI1HcfeoohJuk946xulXgUzf42xvsVE pb6V7ZH/JTRW4KEViLxItRjlwRD+seYjBMCASWdsD7HDHOnUnGLBEiFVwLmMdDY2Ho+H Sj34SYVnkB081FmH4OTDmhfb+j+7G2gAqYo4suPq7gU1kNTI1f2iXPuHkDBQACu7OhK5 41oyNrsIgjv41yxKXTN8ozObxeAjxoJ69u8dAiQ+Ust4pqIndXTxOr9XrpCNbigPIfuO haVuUcSCsV02kuSjP4D9kmDmywbKWoe8CVCpxwrgjtq4aM1F9cXEjkUuJsVU/HrETfqX za3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742303457; x=1742908257; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8z+PHMNfzA0XW1PBgVhogbq+RReNZeV3FJfN4W1yf98=; b=YGyeUr0Ti8+xvMugsZxBsAHKcgkGMAlpHom3m5PB3O6nCzZUg4kU4nDI0cxAI/Q6em jX4p5yI2pWOvK6gpUbPoGYmAeCHKKaIolISecXh8Pyy7BLDq1oaInvVUok/8Bq6O7xlG mqMhiF4WCSpg74rgZO5hm+btUaahLbo/xyL3/pgUDkhtiRb5o3DGx2uP/0E5Ir6TxLom DPP7BSMv1SOQcHgE/5KpDWhZ/Zdje9ZL57lvAIgehG55qE1sYVF5lMUl0OIWwy2VbKxm F9N/6YDC75yavEXaFq9OTFDMfM/VLqV6vZrOWHvjyjq829JF9ld1gVO1mdX8V2xJa+VU rn8w== X-Forwarded-Encrypted: i=1; AJvYcCUcaJhVdwWd+dHaA7+Vx8+MhH65Zg6b9DX0lNZ7wYYK0yhx5OzsXdtn4iIEPRjCuZqPYAC7XWYN4A==@nongnu.org X-Gm-Message-State: AOJu0Yzhr1+Y/ngCEtAsycNgyLMEzAyGtWsoj4eMqgCl8mN9RBWep2/P krP3tn2YrmYs89+P4q85+CGlZuJWG0jxTdrmy5Fkq8BTBUBPyU3sYGps56be X-Gm-Gg: ASbGncsAdmiHD3KqRt5WLAb7dgmISbxoZ1aiX8vpc9+6IQHL/9qRRppABy0tQdTqpIi xV3xLnlSnqQu0U17AFw8/INrt2Q0hzgZEi6q8I22DAVeHghA7OIZaklNlK8qOpT9BRePUEtlvmA q75PEo8N8ythcvrRZ+6kYCQU46ETstgpfQMy7cgjKl20bgCle+5ZkxDJZpH1/JD8MGSBDRLbPph NaysRHe6vht4OiK06gLIoX5NwemAbbe9Op0UysvBTi0zsywm1dkVOfhr0H7DROrhS5AaJhh947a XuGRkVA4Cgm3LLYgN+rS7rnBfEwelsEv8r+C9GtG2kxttq/T7pu71H7SmabRtdYZVJo= X-Google-Smtp-Source: AGHT+IGY9c4APGKBp+xm0KfRaH0oxOof2+Jwm8vsWPIt+arlYfsaJlLTDrl4RgF+nBwnbdOyenjTkA== X-Received: by 2002:a17:907:2ce3:b0:ac2:c397:2b36 with SMTP id a640c23a62f3a-ac3302c92cfmr1630146266b.22.1742303453859; Tue, 18 Mar 2025 06:10:53 -0700 (PDT) From: =?UTF-8?q?Corvin=20K=C3=B6hne?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Yannick=20Vo=C3=9Fen?= , "Edgar E. Iglesias" , qemu-arm@nongnu.org, Peter Maydell , Alistair Francis , =?UTF-8?q?Corvin=20K=C3=B6hne?= , Paolo Bonzini , YannickV Subject: [PATCH 09/21] hw/misc: Add dummy ZYNQ DDR controller Date: Tue, 18 Mar 2025 14:08:00 +0100 Message-ID: <20250318130817.119636-10-corvin.koehne@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250318130817.119636-1-corvin.koehne@gmail.com> References: <20250318130817.119636-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=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::62a; envelope-from=corvin.koehne@gmail.com; helo=mail-ej1-x62a.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: 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: 1742303843005019100 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: Yannick Vo=C3=9Fen --- hw/misc/Kconfig | 3 + hw/misc/meson.build | 1 + hw/misc/zynq_ddr-ctrl.c | 331 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 335 insertions(+) create mode 100644 hw/misc/zynq_ddr-ctrl.c diff --git a/hw/misc/Kconfig b/hw/misc/Kconfig index ec0fa5aa9f..1bc4228572 100644 --- a/hw/misc/Kconfig +++ b/hw/misc/Kconfig @@ -222,4 +222,7 @@ config IOSB config XLNX_VERSAL_TRNG bool =20 +config DDR_CTRLR + bool + source macio/Kconfig diff --git a/hw/misc/meson.build b/hw/misc/meson.build index 6d47de482c..8d4c4279c4 100644 --- a/hw/misc/meson.build +++ b/hw/misc/meson.build @@ -91,6 +91,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('zynq_ddr-ctrl.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/zynq_ddr-ctrl.c b/hw/misc/zynq_ddr-ctrl.c new file mode 100644 index 0000000000..8cdf8be743 --- /dev/null +++ b/hw/misc/zynq_ddr-ctrl.c @@ -0,0 +1,331 @@ +#include "qemu/osdep.h" +#include "hw/sysbus.h" +#include "hw/register.h" +#include "qemu/bitops.h" +#include "qemu/log.h" +#include "qapi/error.h" +#include "hw/registerfields.h" +#include "system/block-backend.h" +#include "exec/address-spaces.h" +#include "exec/memory.h" +#include "system/dma.h" + +#ifndef DDRCTRL_ERR_DEBUG +#define DDRCTRL_ERR_DEBUG 0 +#endif + +#define DB_PRINT_L(level, ...) do { \ + if (DDRCTRL_ERR_DEBUG > (level)) { \ + fprintf(stderr, ": %s: ", __func__); \ + fprintf(stderr, ## __VA_ARGS__); \ + } \ +} while (0) + +#define DB_PRINT(...) DB_PRINT_L(0, ## __VA_ARGS__) + +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_RDDA, 0x50) +REG32(TA_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) + +#define TYPE_DDRCTRL "zynq.ddr-ctlr" +#define DDRCTRL(obj) \ + OBJECT_CHECK(DDRCTRLState, (obj), TYPE_DDRCTRL) + +typedef struct DDRCTRLState { + SysBusDevice parent_obj; + + MemoryRegion iomem; + + uint32_t reg[ZYNQ_DDRCTRL_NUM_REG]; +} DDRCTRLState; + + +static bool zynq_ddrctrl_check_addr(hwaddr addr, bool rnw) +{ + switch (addr) { + case R_PHY_DBG_REG: + case R_MODE_STS_REG: + case R_CHE_CORR_ECC_LOG_REG_OFFSET ... + R_CHE_CORR_ECC_DATA_71_64_REG_OFFSET: + case R_CHE_UNCORR_ECC_ADDR_REG_OFFSET ... + R_CHE_UNCORR_ECC_DATA_71_64_REG_OFFSET: + case R_CHE_ECC_CORR_BIT_MASK_31_0_REG_OFFSET: + case R_CHE_ECC_CORR_BIT_MASK_63_32_REG_OFFSET: + case R_REG69_6A0 ... R_AXI_ID: + case R_MODE_REG_READ: + return rnw; + default: + return true; + } +} + +static void zynq_ddrctrl_reset_init(Object *obj, ResetType type) +{ + DDRCTRLState *s =3D DDRCTRL(obj); + + DB_PRINT("RESET"); + + s->reg[R_DDRC_CTRL] =3D 0x00000200; + s->reg[R_TWO_RANK_CFG] =3D 0x000C1076; + s->reg[R_HPR_REG] =3D 0x03C0780F; + s->reg[R_LPR_REG] =3D 0x03C0780F; + s->reg[R_WR_REG] =3D 0x0007F80F; + s->reg[R_DRAM_PARAM_REG0] =3D 0x00041016; + s->reg[R_DRAM_PARAM_REG1] =3D 0x351B48D9; + s->reg[R_DRAM_PARAM_REG2] =3D 0x83015904; + s->reg[R_DRAM_PARAM_REG3] =3D 0x250882D0; + s->reg[R_DRAM_PARAM_REG4] =3D 0x0000003C; + s->reg[R_DRAM_INIT_PARAM] =3D 0x00002007; + s->reg[R_DRAM_EMR_REG] =3D 0x00000008; + s->reg[R_DRAM_EMR_MR_REG] =3D 0x00000940; + s->reg[R_DRAM_BURST8_RDWR] =3D 0x00020034; + s->reg[R_DRAM_ADDR_MAP_BANK] =3D 0x00000F77; + s->reg[R_DRAM_ADDR_MAP_COL] =3D 0xFFF00000; + s->reg[R_DRAM_ADDR_MAP_ROW] =3D 0x0FF55555; + s->reg[R_DRAM_ODT_REG] =3D 0x00000249; + s->reg[R_PHY_CMD_TIMEOUT_RDDA] =3D 0x00010200; + s->reg[R_DLL_CALIB] =3D 0x00000101; + s->reg[R_ODT_DELAY_HOLD] =3D 0x00000023; + s->reg[R_CTRL_REG1] =3D 0x0000003E; + s->reg[R_CTRL_REG2] =3D 0x00020000; + s->reg[R_CTRL_REG3] =3D 0x00284027; + s->reg[R_CTRL_REG4] =3D 0x00001610; + s->reg[R_CTRL_REG5] =3D 0x00455111; + s->reg[R_CTRL_REG6] =3D 0x00032222; + s->reg[R_CHE_REFRESH_TIMER0] =3D 0x00008000; + s->reg[R_CHE_T_ZQ] =3D 0x10300802; + s->reg[R_CHE_T_ZQ_SHORT_INTERVAL_REG] =3D 0x0020003A; + s->reg[R_REG_2D] =3D 0x00000200; + s->reg[R_DFI_TIMING] =3D 0x00200067; + s->reg[R_ECC_SCRUB] =3D 0x00000008; + s->reg[R_PHY_CONFIG0] =3D 0x40000001; + s->reg[R_PHY_CONFIG1] =3D 0x40000001; + s->reg[R_PHY_CONFIG2] =3D 0x40000001; + s->reg[R_PHY_CONFIG3] =3D 0x40000001; + s->reg[R_PHY_RD_DQS_CFG0] =3D 0x00000040; + s->reg[R_PHY_RD_DQS_CFG1] =3D 0x00000040; + s->reg[R_PHY_RD_DQS_CFG2] =3D 0x00000040; + s->reg[R_PHY_RD_DQS_CFG3] =3D 0x00000040; + s->reg[R_PHY_WE_CFG0] =3D 0x00000040; + s->reg[R_PHY_WE_CFG1] =3D 0x00000040; + s->reg[R_PHY_WE_CFG2] =3D 0x00000040; + s->reg[R_PHY_WE_CFG3] =3D 0x00000040; + s->reg[R_WR_DATA_SLV0] =3D 0x00000080; + s->reg[R_WR_DATA_SLV1] =3D 0x00000080; + s->reg[R_WR_DATA_SLV2] =3D 0x00000080; + s->reg[R_WR_DATA_SLV3] =3D 0x00000080; + s->reg[R_REG_64] =3D 0x10020000; + s->reg[R_AXI_PRIORITY_WR_PORT0] =3D 0x000803FF; + s->reg[R_AXI_PRIORITY_WR_PORT1] =3D 0x000803FF; + s->reg[R_AXI_PRIORITY_WR_PORT2] =3D 0x000803FF; + s->reg[R_AXI_PRIORITY_WR_PORT3] =3D 0x000803FF; + s->reg[R_AXI_PRIORITY_RD_PORT0] =3D 0x000003FF; + s->reg[R_AXI_PRIORITY_RD_PORT1] =3D 0x000003FF; + s->reg[R_AXI_PRIORITY_RD_PORT2] =3D 0x000003FF; + s->reg[R_AXI_PRIORITY_RD_PORT3] =3D 0x000003FF; + s->reg[R_LPDDR_CTRL2] =3D 0x003C0015; + s->reg[R_LPDDR_CTRL3] =3D 0x00000601; +} + +static uint64_t zynq_ddrctrl_read(void *opaque, hwaddr addr, unsigned size) +{ + DDRCTRLState *s =3D opaque; + addr /=3D 4; + uint32_t ret =3D s->reg[addr]; + + if (!zynq_ddrctrl_check_addr(addr, true)) { + qemu_log_mask(LOG_GUEST_ERROR, "zynq_slcr: Invalid read access to " + " addr %" HWADDR_PRIx "\n", addr * 4); + return 0; + } + + DB_PRINT("addr: %08" HWADDR_PRIx " data: %08" PRIx32 "\n", addr * 4, r= et); + return ret; +} + +static void zynq_ddrctrl_write(void *opaque, hwaddr addr, uint64_t val, + unsigned size) +{ + DDRCTRLState *s =3D opaque; + addr /=3D 4; + + if (!zynq_ddrctrl_check_addr(addr, false)) { + qemu_log_mask(LOG_GUEST_ERROR, "zynq_slcr: Invalid read access to " + " addr %" HWADDR_PRIx "\n", addr * 4); + return; + } + + DB_PRINT("addr: %08" HWADDR_PRIx " data: %08" PRIx64 "\n", addr * 4, v= al); + + switch (addr) { + case R_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; + } + break; + } + + s->reg[addr] =3D val; +} + +static const MemoryRegionOps ddrctrl_ops =3D { + .read =3D zynq_ddrctrl_read, + .write =3D zynq_ddrctrl_write, + .endianness =3D DEVICE_LITTLE_ENDIAN, +}; + +static void zynq_ddrctrl_init(Object *obj) +{ + DB_PRINT("Init\n"); + + DDRCTRLState *s =3D DDRCTRL(obj); + + memory_region_init_io(&s->iomem, obj, &ddrctrl_ops, s, "ddrctrl", + ZYNQ_DDRCTRL_MMIO_SIZE); + sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->iomem); +} + +static void zynq_ddrctrl_class_init(ObjectClass *klass, void *data) +{ + DB_PRINT("Class init\n"); + + ResettableClass *rc =3D RESETTABLE_CLASS(klass); + + rc->phases.enter =3D zynq_ddrctrl_reset_init; +} + +static const TypeInfo ddrctrl_info =3D { + .name =3D TYPE_DDRCTRL, + .parent =3D TYPE_SYS_BUS_DEVICE, + .instance_size =3D sizeof(DDRCTRLState), + .class_init =3D zynq_ddrctrl_class_init, + .instance_init =3D zynq_ddrctrl_init, +}; + +static void ddrctrl_register_types(void) +{ + type_register_static(&ddrctrl_info); +} + +type_init(ddrctrl_register_types) --=20 2.49.0 From nobody Thu Apr 3 11:35:53 2025 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=1742303729; cv=none; d=zohomail.com; s=zohoarc; b=jOfw5jgj5aNnuVte9HwQTsP1bRtj1gskdxP7Kezd6zpc9pErP+CHonfLSB/PzFJKNvtjszilO+zS5KvmxnnYSKK6K0lt5hl2y81ytIGGN0lwl8BaGYHc99ykdx7e5p5fOOHSY+kf3Pqi6Z9pVgEtiLnXIlXIxW0ej+fkAIY89kQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742303729; 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=oN7dAT9g7/fjnpZ+M8hoExjMTodoQm0LPLrEZ/BgbuM=; b=EHw7W5M/LiuSQp5el6aFNJG2k7xwMsdv4DfH+kL4WtLagIvAHhcgaciZCicWO192ZWpj9W9zJMjHyCrTpIsIBNgDpXFdFfg0Qeppp+8aM6DcGY3Xx7epDoKr/FkTx1A2YcDRxjW4Pz+RsdFSicsFl2RvPBga1e0YB3wco6t3oqk= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1742303729573939.2047363504236; Tue, 18 Mar 2025 06:15:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tuWlh-0004o8-8j; Tue, 18 Mar 2025 09:14:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tuWiz-0002GK-99; Tue, 18 Mar 2025 09:11:31 -0400 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tuWit-0003n2-Uj; Tue, 18 Mar 2025 09:11:14 -0400 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-ac25520a289so979857566b.3; Tue, 18 Mar 2025 06:11:10 -0700 (PDT) Received: from corvink-nb.beckhoff.com ([195.226.174.194]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ac3147f3101sm850678066b.69.2025.03.18.06.10.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Mar 2025 06:10:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742303470; x=1742908270; 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=oN7dAT9g7/fjnpZ+M8hoExjMTodoQm0LPLrEZ/BgbuM=; b=Jn/s4hDtZWndGif2mN8saYn51ToCIx10DQVmiqhasVlWbltrpBhkP9JS+QsAa76rwB pf/hNodQ63h876fmtGaJWuxWk+/EO0BNeeX+2ctyvlnEeytE7sTDgsg+bskg/PcToUnr H4S4LaCO2MCV1ztpS5sKals2ozadYfG3sZEAZmfUDt/IAOyYh9ABFt2u8szps5XD5xoF QytvdUL+NDOYxDHSvTxxkTY2zVFvtmFDLxu/K+Fer/DtVQU3cmQtpDO8jrgmP+Cbc2X+ gpyTW2TZKtlpdnDhB5eS+I+daKlvQKFIHhMG0qr88eNTVGpRhp9YmQxc5hkAjjPo8Tyx yHog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742303470; x=1742908270; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oN7dAT9g7/fjnpZ+M8hoExjMTodoQm0LPLrEZ/BgbuM=; b=GHCNkScFLEdhJnwxQ5i1bV9KCfWkwMtt6HgS5VvoQxbFMh2ZZTpb55zHKo2gHvXXwP d3qGUPqVU9r/ixDlalcesBskNtah/KLJsVvPMWGZ1KON/QoqyKm9ZTXUAuEVddc0n25w Zx/k27K+2I2brYRetVgadM0jVIHHwI2TRTzwzzJnMae4nva0Eod3lmp58iGiHNPKnn6d kTzxRA1OJfBdwlxNb100+VU2/RVfhGG5ADScYNqS7N9umAnihcYzqe0kiVSPEJ474EkW H6zUZ4rlZidTwtchjJreiqmROROVfFo+cfOCit3vKfk0eo+Xc1jQ4TuGSBc/dEw4euLs U29g== X-Forwarded-Encrypted: i=1; AJvYcCUdOhmKmDezOVu9JdyTfcOjCkKV7BaNpy0Hg4hiu9JTNFQbkOPk6WjhJcs0Br6eTynjQhbxrPDuIA==@nongnu.org X-Gm-Message-State: AOJu0YzGdEAzyUb1zrtcW9LxURhA/PZYnuZR/QA99GXamyRaTvwdOmxY 51uU6EDZkfVJQPg4r/P+sUFhwP506Q9kK54xb4OYm4WVDacW7cJ0mX4KI1Vo X-Gm-Gg: ASbGncuBJpwFZZ3PpRraMTF7KF9wSQanfmtlj1qrRhQaMg5WqCnwtxiyp0lOHDB6dF3 77BkpiEbs4V7LcaGroX8D6Z7MwOmHi7HfeaFIKIf7hBvyEHOFxBkLQJAImGfMvsLceIU8CtpoCD fiSx8vG3U6VASQL+UElXvnObec15uDm/xfn0ft22IH8dsDIiY80N1CwWCuAVX9KKH6uybCyQm2l JGJpxAWcoOT3mBY8N6kjwz6ChQiLtUz7bgG0fL+l9dcexn3fmAEE4bi9uUOAcHI2m26ltw1WjRT mi9qCJ4Llfnq5EcQ0/Ox9P3jN3F/RNkOoTX/93Gc6rVU1Iq+W59rJ77J1QDjHdmtjaE= X-Google-Smtp-Source: AGHT+IE9KGjSXVMDL2rb5wCtFiOM7CRH5JAehLW+Dg+AAWE6R7k1Mzib7sqp8DpXLZ+4Ny1IH0Y+jg== X-Received: by 2002:a17:906:c10d:b0:ac2:cae8:e153 with SMTP id a640c23a62f3a-ac3301dd86bmr1955854366b.4.1742303457867; Tue, 18 Mar 2025 06:10:57 -0700 (PDT) From: =?UTF-8?q?Corvin=20K=C3=B6hne?= To: qemu-devel@nongnu.org, qemu-arm@nongnu.org Cc: =?UTF-8?q?Yannick=20Vo=C3=9Fen?= , "Edgar E. Iglesias" , Peter Maydell , Alistair Francis , =?UTF-8?q?Corvin=20K=C3=B6hne?= , Paolo Bonzini , YannickV Subject: [PATCH 10/21] hw/misc/zynq_slcr: Add logic for DCI configuration Date: Tue, 18 Mar 2025 14:08:01 +0100 Message-ID: <20250318130817.119636-11-corvin.koehne@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250318130817.119636-1-corvin.koehne@gmail.com> References: <20250318130817.119636-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=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::636; envelope-from=corvin.koehne@gmail.com; helo=mail-ej1-x636.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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: 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: 1742303730767019100 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: Yannick Vo=C3=9Fen --- 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 9b3220f354..10ef8ecee8 100644 --- a/hw/misc/zynq_slcr.c +++ b/hw/misc/zynq_slcr.c @@ -181,6 +181,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 @@ -194,6 +200,8 @@ struct ZynqSLCRState { =20 MemoryRegion iomem; =20 + bool ddriob_dci_ctrl_reset_toggled; + uint32_t regs[ZYNQ_SLCR_NUM_REGS]; =20 Clock *ps_clk; @@ -332,6 +340,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; @@ -419,6 +429,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) @@ -555,6 +567,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) &&=20 + 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.49.0 From nobody Thu Apr 3 11:35:53 2025 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=1742303651; cv=none; d=zohomail.com; s=zohoarc; b=S8eysG5Y9ALBdCAIOlOgGOpaTSeyBdNjm71lOOt+P30ep8tMiFYMawDCmJWuKppZo8X8WvVzvETxsVyUH7JPP0/ikryoiUg7OvqM9T55UXs+03z7v3Gegr/42dzw9h5+fQfEwa1XP3k0AJSLccHJiGdmxgIFsKObJmEwOVaAwEQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742303651; 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=s2z3osT8h7ewZgx/qICYbX5hRMSuhv1wkR46Mb73ULA=; b=E+GDhNEf7bQI2WmQkJS+Korey6WHYs8dtag70I/v4CXLHA+2I3Tbxi/Z7Q6PHjQwomkqlMcWxEwWMjNnU72NNVxHwNNaGGip/qHsGkFN61GJD2DkQb67u2OgOlrOHT2YqM8w65N4c9t7HwOYuWhIuiQ5cMfmdPvyUmuD0k4H3j0= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1742303651368199.0975391484444; Tue, 18 Mar 2025 06:14:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tuWkq-0003YX-1S; Tue, 18 Mar 2025 09:13:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tuWiz-0002Ht-Cn; Tue, 18 Mar 2025 09:11:32 -0400 Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tuWiu-0003n4-GL; Tue, 18 Mar 2025 09:11:15 -0400 Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-ab78e6edb99so866016466b.2; Tue, 18 Mar 2025 06:11:11 -0700 (PDT) Received: from corvink-nb.beckhoff.com ([195.226.174.194]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ac3147f3101sm850678066b.69.2025.03.18.06.11.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Mar 2025 06:11:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742303470; x=1742908270; 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=s2z3osT8h7ewZgx/qICYbX5hRMSuhv1wkR46Mb73ULA=; b=aHTipcpsd6hjgFl3OpkYUtG1Vd8A7z4G3EDg8wHOKhnRsrZFNVH/iPttBn6zOoocL4 uYBxLpeRb9YBp5qS9VY1ya+pXpZrJLQ9hgvmMJ2WCCIEIvAgDgwVCJusCsGJUDz4JSah evmCRTsy6ptllNcWaI6xOegU7NV7DPM0L1Pg92HgoHBDNnrYXNCexFHig8vwFwH3j+5v 6lsCm3DMEH4KfdVRx2u+3MvFgniy4Cvaeh8qCSdi3AK8ZnQzAS/8c14wOLWXtOVZZgN5 QL/RMbVsTEUZzTkmRnkLT7PmrbdNfzqwzBO3GwQd2YVScIl5aC3vk3jjsbqHkj0SMsEL 8LRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742303470; x=1742908270; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=s2z3osT8h7ewZgx/qICYbX5hRMSuhv1wkR46Mb73ULA=; b=JGW9ICg48VCwsbeYX9LZ0x5FMZaqdhDKIh3X3YScRPhyy6SLxbc1VB7YyfYJRrUqDm 0DUffpAdiaJ70iKLhhwSS3QaknI+03kqcYSnm03+qUQR7p28I94Fk4iaGkUrrC7zmtS4 /5gVJ1EH+eLnxmFUZb3JrryWq8O6rlb9czBkXOLmeNzGr+0FsmbGaGKWKMPMym/cpxPJ Dv+6BylMtYoO3OHi62Qx2Hutxg+EEMXhu7PHHKjKgtGP13j3YR5hLfA75VkyvxfXXY5+ ZN+2wjP0TNHz+aV3Vf4MHvQ98JGhLmn9pnE7anx54rJUBV09j4d71aneOQo1HPzWXyGV XarQ== X-Forwarded-Encrypted: i=1; AJvYcCVnTNRUmKhd56RpADgm/JkdfMCUKrxVLMebHI9/e+f5dgUbnj2LzHFvwKGYXBCUHaeJe8oW6c1l1A==@nongnu.org X-Gm-Message-State: AOJu0YyupDucp/h4LbDJwncxtIzKzpnOaGJfmCloxJVhj6YS4tPgVleS 6tQbN6aZxrNSTQwypHFCCUymuFkX3pKGcT7x0p+AgcjhnWhKY4wHX71uELlS X-Gm-Gg: ASbGncsT4sCcoXVzbWZ/4zgiXrY9P3sbFzCf8DeTt89vTE1ajh+k41eX0RG1w+sA4By STr0xt56pmK6EZNEKiwFDilA9IZYpypvHKBrESFeQz9Ye+RZv5Fz+nQv1Xpu1KA9y80O4aY859I KdzBLwr1vHSjtnL02Vi3VySSPvf32eFuogVkx/OK1uQ4jcheYrCuTScj9LcSk8Ox4JAILeOgCBQ dYQY0cr4waOSjmZ0fYOdyi1sVp4u/fTAXqJRKV9PTtZtyabUNg9KiHfe6qj2QIwoZLT7AE2H20o CwKyM1O6SVgg5vP+1MP0V7AEdsOxa4UwO9IppZE7rd+YaKfKxjq4LM8o56mihs7B/MY= X-Google-Smtp-Source: AGHT+IHrBv7vxPgrrtJ0Kcv9NhG6+27FIaBrXmgVMG76k0HKdpuiE4hPDMzjTBPN3jJWeMTNG1gg6w== X-Received: by 2002:a17:907:7241:b0:ac0:527c:9cd5 with SMTP id a640c23a62f3a-ac330441df6mr1828641766b.42.1742303468234; Tue, 18 Mar 2025 06:11:08 -0700 (PDT) From: =?UTF-8?q?Corvin=20K=C3=B6hne?= To: qemu-devel@nongnu.org, =?UTF-8?q?Corvin=20K=C3=B6hne?= , qemu-arm@nongnu.org Cc: =?UTF-8?q?Yannick=20Vo=C3=9Fen?= , "Edgar E. Iglesias" , Peter Maydell , Alistair Francis , Paolo Bonzini , YannickV Subject: [PATCH 11/21] hw/misc: Add Beckhoff CCAT device Date: Tue, 18 Mar 2025 14:08:02 +0100 Message-ID: <20250318130817.119636-12-corvin.koehne@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250318130817.119636-1-corvin.koehne@gmail.com> References: <20250318130817.119636-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=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::632; envelope-from=corvin.koehne@gmail.com; helo=mail-ej1-x632.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: 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: 1742303654631019100 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: Yannick Vo=C3=9Fen --- hw/misc/Kconfig | 3 + hw/misc/beckhoff_ccat.c | 365 ++++++++++++++++++++++++++++++++++++++++ hw/misc/meson.build | 1 + 3 files changed, 369 insertions(+) create mode 100644 hw/misc/beckhoff_ccat.c diff --git a/hw/misc/Kconfig b/hw/misc/Kconfig index 1bc4228572..c264862046 100644 --- a/hw/misc/Kconfig +++ b/hw/misc/Kconfig @@ -225,4 +225,7 @@ config XLNX_VERSAL_TRNG config DDR_CTRLR 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..3ab1259702 --- /dev/null +++ b/hw/misc/beckhoff_ccat.c @@ -0,0 +1,365 @@ +/* + * Beckhoff Communication Controller Emulation + * + * Copyright (c) Beckhoff Automation GmbH. & Co. KG + * + * 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. + * + * This program is distributed in the hope that it will be useful, but WIT= HOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, see . + */ + +#include "qemu/osdep.h" +#include "hw/sysbus.h" +#include "hw/register.h" +#include "qemu/bitops.h" +#include "qemu/log.h" +#include "qapi/error.h" +#include "system/block-backend.h" +#include "exec/address-spaces.h" +#include "exec/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" + +#ifndef CCAT_ERR_DEBUG +#define CCAT_ERR_DEBUG 0 +#endif + +#define DB_PRINT_L(level, ...) do { \ + if (CCAT_ERR_DEBUG > (level)) { \ + fprintf(stderr, ": %s: ", __func__); \ + fprintf(stderr, ## __VA_ARGS__); \ + } \ +} while (0) + +#define DB_PRINT(...) DB_PRINT_L(0, ## __VA_ARGS__) + +#define TYPE_BECKHOFF_CCAT "beckhoff-ccat" +#define BECKHOFF_CCAT(obj) \ + OBJECT_CHECK(BeckhoffCcat, (obj), TYPE_BECKHOFF_CCAT) + +#define MAX_NUM_SLOTS 32 + +#define CCAT_EEPROM_OFFSET 0x100 +#define CCAT_DMA_OFFSET 0x8000 + +#define CCAT_MEM_SIZE 0xFFFF +#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; + int64_t eeprom_size; +} BeckhoffCcat; + +typedef struct __attribute__((packed)) CcatFunctionBlock { + uint16_t type; + uint16_t revision; + uint32_t parameter; + uint32_t address_offset; + uint32_t size; +} CcatFunctionBlock; + +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; + uint64_t val =3D 0; + memcpy(&val, &s->mem[addr], size); + return val; +} + +static void beckhoff_ccat_eeprom_write(void *opaque, hwaddr addr, uint64_t= val, + unsigned size) +{ + BeckhoffCcat *s =3D opaque; + uint64_t eeprom_adr; + switch (addr) { + case EEPROM_CMD_OFFSET: + eeprom_adr =3D *(uint32_t *)&s->mem[EEPROM_ADR_OFFSET]; + eeprom_adr =3D (eeprom_adr * 2) % s->eeprom_size; + if (val & EEPROM_CMD_READ_MASK) { + uint64_t buf =3D 0; + uint32_t bytes_to_read =3D 8; + if (eeprom_adr > s->eeprom_size - 8) { + bytes_to_read =3D s->eeprom_size - eeprom_adr; + } + memcpy(&buf, s->eeprom_storage + eeprom_adr, bytes_to_read); + *(uint64_t *)&s->mem[EEPROM_DATA_OFFSET] =3D buf; + + } else if (val & EEPROM_CMD_WRITE_MASK) { + uint32_t buf =3D *(uint32_t *)&s->mem[EEPROM_DATA_OFFSET]; + memcpy(s->eeprom_storage + eeprom_adr, &buf, 2); + sync_eeprom(s); + } + break; + default: + memcpy(&s->mem[addr], &val, size); + } +} + +static uint64_t beckhoff_ccat_dma_read(void *opaque, hwaddr addr, unsigned= size) +{ + BeckhoffCcat *s =3D opaque; + uint64_t val =3D 0; + + switch (addr) { + case DMA_TRANSFER_OFFSET: + if (s->mem[DMA_TRANSFER_OFFSET] & 0x1) { + DB_PRINT("DMA transfer finished\n"); + s->mem[DMA_TRANSFER_OFFSET] =3D 0; + } + break; + } + memcpy(&val, &s->mem[addr], size); + return val; +} + +static void beckhoff_ccat_dma_write(void *opaque, hwaddr addr, uint64_t va= l, + unsigned size) +{ + BeckhoffCcat *s =3D opaque; + switch (addr) { + case DMA_TRANSFER_OFFSET: + uint8_t len =3D s->mem[DMA_TRANSFER_LENGTH_OFFSET]; + uint8_t *mem_buf =3D &s->mem[DMA_BUFFER_OFFSET]; + + if (s->mem[DMA_DIRECTION_OFFSET] & DMA_DIRECTION_MASK) { + dma_addr_t dmaAddr =3D *(uint32_t *)&s->mem[DMA_HOST_ADR_OFFSE= T]; + dma_memory_read(&address_space_memory, dmaAddr, + mem_buf, len * 8, MEMTXATTRS_UNSPECIFIED); + } else { + dma_addr_t dmaAddr =3D *(uint32_t *)&s->mem[DMA_HOST_ADR_OFFSE= T]; + dma_memory_write(&address_space_memory, dmaAddr + 8, + mem_buf, len * 8, MEMTXATTRS_UNSPECIFIED); + } + break; + } + memcpy(&s->mem[addr], &val, size); +} +static uint64_t beckhoff_ccat_read(void *opaque, hwaddr addr, unsigned siz= e) +{ + DB_PRINT("CCAT_READ addr=3D0x%lx size=3D%u\n", addr, size); + + BeckhoffCcat *s =3D opaque; + uint64_t val =3D 0; + + if (addr > CCAT_MEM_SIZE - size) { + error_report("Overflow. Address or size is too large.\n"); + exit(1); + } + + 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 { + memcpy(&val, &s->mem[addr], size); + } + + return val; +} + +static void beckhoff_ccat_write(void *opaque, hwaddr addr, uint64_t val, + unsigned size) +{ + DB_PRINT("CCAT_WRITE addr=3D0x%lx size=3D%u val=3D0x%lx\n", addr, size= , val); + + BeckhoffCcat *s =3D opaque; + + if (addr > CCAT_MEM_SIZE - size) { + error_report("Overflow. Address or size is too large.\n"); + exit(1); + } + + 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 { + memcpy(&s->mem[addr], &val, size); + } +} + +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); + + CcatFunctionBlock function_blocks[MAX_NUM_SLOTS] =3D {0}; + + CcatFunctionBlock info_block =3D { + .type =3D CCAT_FUN_TYPE_ENTRY, + .revision =3D 0x0001, + .parameter =3D CCAT_INFO_BLOCK_PARAMS, + .address_offset =3D CCAT_ID_1, + .size =3D CCAT_ID_2 + }; + CcatFunctionBlock eeprom_block =3D { + .type =3D CCAT_FUN_TYPE_EEPROM, + .revision =3D 0x0001, + .parameter =3D 0, + .address_offset =3D CCAT_EEPROM_OFFSET, + .size =3D CCAT_EEPROM_SIZE + }; + CcatFunctionBlock dma_block =3D { + .type =3D CCAT_FUN_TYPE_DMA, + .revision =3D 0x0000, + .parameter =3D 0, + .address_offset =3D CCAT_DMA_OFFSET, + .size =3D CCAT_DMA_SIZE + }; + + /* + * The EEPROM interface is usually at function slot 11. + * The DMA controller is usually at function slot 15. + */ + function_blocks[0] =3D info_block; + function_blocks[11] =3D eeprom_block; + function_blocks[15] =3D dma_block; + + memcpy(&s->mem[0], function_blocks, sizeof(function_blocks)); +} + +static void beckhoff_ccat_realize(DeviceState *dev, Error **errp) +{ + BeckhoffCcat *s =3D BECKHOFF_CCAT(dev); + BlockBackend *blk; + + blk =3D blk_by_name("ccat-eeprom"); + + if (blk) { + uint64_t blk_size =3D blk_getlength(blk); + if (!is_power_of_2(blk_size)) { + error_report("Blockend size is not a power of two."); + } + + if (blk_size < 512) { + error_report("Blockend size is too small. Using backup."); + 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); + } else { + DB_PRINT("EEPROM block backend found\n"); + 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)) { + exit(1); + } + } + } 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); + } + + beckhoff_ccat_reset(dev); +} + +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 void beckhoff_ccat_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + dc->realize =3D beckhoff_ccat_realize; +} + +static const TypeInfo beckhoff_ccat_info =3D { + .name =3D TYPE_BECKHOFF_CCAT, + .parent =3D TYPE_SYS_BUS_DEVICE, + .instance_size =3D sizeof(BeckhoffCcat), + .class_init =3D beckhoff_ccat_class_init, + .instance_init =3D beckhoff_ccat_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 8d4c4279c4..ca0b261715 100644 --- a/hw/misc/meson.build +++ b/hw/misc/meson.build @@ -14,6 +14,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.49.0 From nobody Thu Apr 3 11:35:53 2025 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=1742303651; cv=none; d=zohomail.com; s=zohoarc; b=ZCk5i0ARUVPrMPU/zy+STDqjb9t/Mp2ZOmJnK3ppXnWJkGqCJLM0314bjsoTvKolVxwbV1AKB/AnWrz6EqzGzqQY0xU15xOizo9mHdyVsEpN4luMk9NYc/+fdt+s7ot4/CEmP5AzKxjpeKX59iTUl9fievWVyVimXVn+oP0JP3M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742303651; 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=httd73l5LjYVuSPlvII/RNKPP4D/+MRG7pSLtstB4g8=; b=mL6+04hAy6d30k32f9ii/rlIgtsDewyu5360L0Y7YMf0wJoXFZvBfGnR1+xSPLVtSHjeO05jSXWtOqxsns10KlrnJXgZpS/2hE4cVkq2dmRAPnr9HifSv0DDLExqPebP81iN6YGwG6Zj8niV64fcUR4lBUH1kJKXRdWb9+Z0hMk= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1742303651923534.8749500325824; Tue, 18 Mar 2025 06:14:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tuWkA-0002l0-FD; Tue, 18 Mar 2025 09:12:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tuWiz-0002JI-Qn; Tue, 18 Mar 2025 09:11:28 -0400 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tuWiv-0003nP-Ln; Tue, 18 Mar 2025 09:11:17 -0400 Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-5e56b229d60so12210749a12.0; Tue, 18 Mar 2025 06:11:12 -0700 (PDT) Received: from corvink-nb.beckhoff.com ([195.226.174.194]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ac3147f3101sm850678066b.69.2025.03.18.06.11.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Mar 2025 06:11:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742303471; x=1742908271; 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=httd73l5LjYVuSPlvII/RNKPP4D/+MRG7pSLtstB4g8=; b=ekgkHat11AV4IBHtcYYh/YcMjwHWjjOCVS3vyD8u51flrAZbjwd6C3oU1TXl1TgaHQ P1o6YF0XB5jtvkiheu26Jzkies72fJ+VdYld588m4Ojm+MVtTxzN65suA1TPRDTy/lgY /1KtHsHeO2v8nOg4YosObIKJyYiVa8AZKQnyFCMfJjA7ApcfbeZCeV+72my4aykQsw8v lW3WK8UbXZg8fFDcCIgEe0FSt6ALa6qpPr3ZZyYuTm0WP74vG8q6Kgy19HrdZKbsA8+o FpCaZWbGBm5Q9gg61JXLL5nsWvQqYV/0G9Y6WZDn27pOXAU7eOhMK1xbYEZX5BkyDKKp dFrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742303471; x=1742908271; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=httd73l5LjYVuSPlvII/RNKPP4D/+MRG7pSLtstB4g8=; b=cBUoc27JGbuyEdsbUg7czYKGhrz8Srea34sGnt5OMMtUe0gx2mBALuOy6B0uLKMUin LPg7YdTokB4ZMQTC4MtB6H40zSrc52cauKzG5euDFcMWL/d+OSFLHumpohtWdcQ0otm0 QFJK5qiaRncVltTIiRAHmvB6TMoRM5s99w4U8kVGJvegOC18tQ6s2nTpdbhDmLbkJacx Bfu87P9sMWoNk6ByCasXbBdIp3VEGvrBd3LvxUZ1MP5iEtpWuOtS0w8/sV4VrTvoCQq8 rIdRI6WZgKbHnWZv7BV9afj6UoEHWybsQ7ty3fD4QAE/CsqnGx/ChxwQkTZWsiVrx6ie vEBw== X-Forwarded-Encrypted: i=1; AJvYcCVXMT6+jNydDT7hj1oKWNlrWtDDVGtA6YNazhBGPQTw/Njh6X/rfgng3zL0FoDuq9/TB8f6KLiEsw==@nongnu.org X-Gm-Message-State: AOJu0YyBy+L7hc627V9HQLKNR3c67jksV+x+vTzzqms49pqqPoGAmAfT BsccZA5vFXVel+7ohSplxTVcZtFDB700YEJJaB9wgld4Z1L+N3UKiJUhU6r5 X-Gm-Gg: ASbGncuvTKaSdAJj2dD4atfrG8KbU/hTgj+/INZu7rW4/B7xqcy+kLoMAt3AkjEhk/A Md6oJfm9JDIdYCN1shg3vPqrM/vQTrOTIJLXS03sEQUk537z38ov+MuzGjWeoXyoJOIHN9kzKiC HrIImNBSC9EoroXIDgiyZYWB6HXmUw3MTyBhQCG4Qz9U4jvuyFLO92j1gus6t5tdkaTHeLMJ/Iq eqVyWOhkCIpMcRxMrcuiZKu0ASF1Nk77hbsLMSwzOKWAkHqcDlgdqSI1Sb/J7irkA8IAkXKkvlK u1vpL0okey2Na5CyyMpsQQ66E2Ar4WQ2Pm4uuuu8qy1NIfH3tmxQW9KC3ddFWuRXtGQ= X-Google-Smtp-Source: AGHT+IEDKYZYeafecTnDmSel6sXjJtf4ID1L4nzftbVsUkuo2GDc4X7LEBYRpCia9E8Mmxbq0o9pgg== X-Received: by 2002:a17:907:1c89:b0:abf:68b5:f78b with SMTP id a640c23a62f3a-ac38f95e9f5mr309230266b.24.1742303470903; Tue, 18 Mar 2025 06:11:10 -0700 (PDT) From: =?UTF-8?q?Corvin=20K=C3=B6hne?= To: qemu-devel@nongnu.org, =?UTF-8?q?Corvin=20K=C3=B6hne?= , qemu-arm@nongnu.org Cc: =?UTF-8?q?Yannick=20Vo=C3=9Fen?= , "Edgar E. Iglesias" , Peter Maydell , Alistair Francis , Paolo Bonzini , YannickV Subject: [PATCH 12/21] hw/arm: Add new machine based on xilinx-zynq-a9 for Beckhoff CX7200 Date: Tue, 18 Mar 2025 14:08:03 +0100 Message-ID: <20250318130817.119636-13-corvin.koehne@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250318130817.119636-1-corvin.koehne@gmail.com> References: <20250318130817.119636-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=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::52d; envelope-from=corvin.koehne@gmail.com; helo=mail-ed1-x52d.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: 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: 1742303656305019100 From: YannickV This commit introduces a new machine, derived from xilinx-zynq-a9, as a starting point for the Beckhoff CX7200 integration. Functions and structs are renamed to delimit the CX7200 board emulation from the existing Zynq emulation. At this stage, the new machine is a direct copy of hw/arm/xilinx_zynq.c. Future commits will adapt it to match the CX7200 hardware requirements. Signed-off-by: Yannick Vo=C3=9Fen --- hw/arm/Kconfig | 18 ++ hw/arm/beckhoff_CX7200.c | 496 +++++++++++++++++++++++++++++++++++++++ hw/arm/meson.build | 1 + 3 files changed, 515 insertions(+) create mode 100644 hw/arm/beckhoff_CX7200.c diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig index 15200a2d7e..8727b3e837 100644 --- a/hw/arm/Kconfig +++ b/hw/arm/Kconfig @@ -311,6 +311,24 @@ config ZYNQ select XILINX_SPIPS select ZYNQ_DEVCFG =20 +config BECK_CX7200 + bool + default y + depends on TCG && ARM + select A9MPCORE + select CADENCE # UART + select PFLASH_CFI02 + select PL310 # cache controller + select PL330 + select SDHCI + select SSI_M25P80 + select USB_EHCI_SYSBUS + select XILINX # UART + select XILINX_AXI + select XILINX_SPI + select XILINX_SPIPS + select ZYNQ_DEVCFG + 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..89466cfdd8 --- /dev/null +++ b/hw/arm/beckhoff_CX7200.c @@ -0,0 +1,496 @@ +/* + * Modified Xilinx Zynq Baseboard System emulation for Beckhoff CX7200. + * + * 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. + * + * 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 F= ree + * Software Foundation; either version 2 of the License, or (at your optio= n) + * any later version. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, see . + */ + +#include "qemu/osdep.h" +#include "qemu/units.h" +#include "qapi/error.h" +#include "hw/sysbus.h" +#include "hw/arm/boot.h" +#include "net/net.h" +#include "system/system.h" +#include "hw/boards.h" +#include "hw/block/flash.h" +#include "hw/loader.h" +#include "hw/adc/zynq-xadc.h" +#include "hw/ssi/ssi.h" +#include "hw/usb/chipidea.h" +#include "qemu/error-report.h" +#include "hw/sd/sdhci.h" +#include "hw/char/cadence_uart.h" +#include "hw/net/cadence_gem.h" +#include "hw/cpu/a9mpcore.h" +#include "hw/qdev-clock.h" +#include "hw/misc/unimp.h" +#include "system/reset.h" +#include "qom/object.h" +#include "exec/tswap.h" +#include "target/arm/cpu-qom.h" +#include "qapi/visitor.h" + +#define TYPE_CX7200_MACHINE MACHINE_TYPE_NAME("beckhoff-cx7200") +OBJECT_DECLARE_SIMPLE_TYPE(CX7200MachineState, CX7200_MACHINE) + +/* board base frequency: 33.333333 MHz */ +#define PS_CLK_FREQUENCY (100 * 1000 * 1000 / 3) + +#define NUM_SPI_FLASHES 4 +#define NUM_QSPI_FLASHES 2 +#define NUM_QSPI_BUSSES 2 + +#define FLASH_SIZE (64 * 1024 * 1024) +#define FLASH_SECTOR_SIZE (128 * 1024) + +#define IRQ_OFFSET 32 /* pic interrupts start from index 32 */ + +#define MPCORE_PERIPHBASE 0xF8F00000 +#define ZYNQ_BOARD_MIDR 0x413FC090 + +static const int dma_irqs[8] =3D { + 46, 47, 48, 49, 72, 73, 74, 75 +}; + +#define BOARD_SETUP_ADDR 0x100 + +#define SLCR_LOCK_OFFSET 0x004 +#define SLCR_UNLOCK_OFFSET 0x008 +#define SLCR_ARM_PLL_OFFSET 0x100 + +#define SLCR_XILINX_UNLOCK_KEY 0xdf0d +#define SLCR_XILINX_LOCK_KEY 0x767b + +#define ZYNQ_SDHCI_CAPABILITIES 0x69ec0080 /* Datasheet: UG585 (v1.12.1) = */ + +#define ARMV7_IMM16(x) (extract32((x), 0, 12) | \ + extract32((x), 12, 4) << 16) + +/* + * Write immediate val to address r0 + addr. r0 should contain base offset + * of the SLCR block. Clobbers r1. + */ + +#define SLCR_WRITE(addr, val) \ + 0xe3001000 + ARMV7_IMM16(extract32((val), 0, 16)), /* movw r1 ... */ \ + 0xe3401000 + ARMV7_IMM16(extract32((val), 16, 16)), /* movt r1 ... */ \ + 0xe5801000 + (addr) + +#define ZYNQ_MAX_CPUS 2 + +struct CX7200MachineState { + MachineState parent; + Clock *ps_clk; + ARMCPU *cpu[ZYNQ_MAX_CPUS]; + uint8_t boot_mode; +}; + +static void beckhoff_cx7200_write_board_setup(ARMCPU *cpu, + const struct arm_boot_info *info) +{ + int n; + uint32_t board_setup_blob[] =3D { + 0xe3a004f8, /* mov r0, #0xf8000000 */ + SLCR_WRITE(SLCR_UNLOCK_OFFSET, SLCR_XILINX_UNLOCK_KEY), + SLCR_WRITE(SLCR_ARM_PLL_OFFSET, 0x00014008), + SLCR_WRITE(SLCR_LOCK_OFFSET, SLCR_XILINX_LOCK_KEY), + 0xe12fff1e, /* bx lr */ + }; + for (n =3D 0; n < ARRAY_SIZE(board_setup_blob); n++) { + board_setup_blob[n] =3D tswap32(board_setup_blob[n]); + } + rom_add_blob_fixed("board-setup", board_setup_blob, + sizeof(board_setup_blob), BOARD_SETUP_ADDR); +} + +static struct arm_boot_info beckhoff_cx7200_binfo =3D {}; + +static void gem_init(uint32_t base, qemu_irq irq) +{ + DeviceState *dev; + SysBusDevice *s; + + dev =3D qdev_new(TYPE_CADENCE_GEM); + qemu_configure_nic_device(dev, true, NULL); + object_property_set_int(OBJECT(dev), "phy-addr", 7, &error_abort); + s =3D SYS_BUS_DEVICE(dev); + sysbus_realize_and_unref(s, &error_fatal); + sysbus_mmio_map(s, 0, base); + sysbus_connect_irq(s, 0, irq); +} + +static inline int beckhoff_cx7200_init_spi_flashes(uint32_t base_addr, + qemu_irq irq, bool is_qspi, int un= it0) +{ + int unit =3D unit0; + DeviceState *dev; + SysBusDevice *busdev; + SSIBus *spi; + DeviceState *flash_dev; + int i, j; + int num_busses =3D is_qspi ? NUM_QSPI_BUSSES : 1; + int num_ss =3D is_qspi ? NUM_QSPI_FLASHES : NUM_SPI_FLASHES; + + dev =3D qdev_new(is_qspi ? "xlnx.ps7-qspi" : "xlnx.ps7-spi"); + qdev_prop_set_uint8(dev, "num-txrx-bytes", is_qspi ? 4 : 1); + qdev_prop_set_uint8(dev, "num-ss-bits", num_ss); + qdev_prop_set_uint8(dev, "num-busses", num_busses); + busdev =3D SYS_BUS_DEVICE(dev); + sysbus_realize_and_unref(busdev, &error_fatal); + sysbus_mmio_map(busdev, 0, base_addr); + if (is_qspi) { + sysbus_mmio_map(busdev, 1, 0xFC000000); + } + sysbus_connect_irq(busdev, 0, irq); + + for (i =3D 0; i < num_busses; ++i) { + char bus_name[16]; + qemu_irq cs_line; + + snprintf(bus_name, 16, "spi%d", i); + spi =3D (SSIBus *)qdev_get_child_bus(dev, bus_name); + + for (j =3D 0; j < num_ss; ++j) { + DriveInfo *dinfo =3D drive_get(IF_MTD, 0, unit++); + flash_dev =3D qdev_new("n25q128"); + if (dinfo) { + qdev_prop_set_drive_err(flash_dev, "drive", + blk_by_legacy_dinfo(dinfo), + &error_fatal); + } + qdev_prop_set_uint8(flash_dev, "cs", j); + qdev_realize_and_unref(flash_dev, BUS(spi), &error_fatal); + + cs_line =3D qdev_get_gpio_in_named(flash_dev, SSI_GPIO_CS, 0); + sysbus_connect_irq(busdev, i * num_ss + j + 1, cs_line); + } + } + + return unit; +} + +static void beckhoff_cx7200_set_boot_mode(Object *obj, const char *str, + Error **errp) +{ + CX7200MachineState *m =3D CX7200_MACHINE(obj); + uint8_t mode =3D 0; + + if (!strncasecmp(str, "qspi", 4)) { + mode =3D 1; + } else if (!strncasecmp(str, "sd", 2)) { + mode =3D 5; + } else if (!strncasecmp(str, "nor", 3)) { + mode =3D 2; + } else if (!strncasecmp(str, "jtag", 4)) { + mode =3D 0; + } else { + error_setg(errp, "%s boot mode not supported", str); + return; + } + m->boot_mode =3D mode; +} + +static void beckhoff_cx7200_init(MachineState *machine) +{ + CX7200MachineState *cx7200_machine =3D CX7200_MACHINE(machine); + MemoryRegion *address_space_mem =3D get_system_memory(); + MemoryRegion *ocm_ram =3D g_new(MemoryRegion, 1); + DeviceState *dev, *slcr; + SysBusDevice *busdev; + qemu_irq pic[64]; + int n; + unsigned int smp_cpus =3D machine->smp.cpus; + + /* max 2GB ram */ + if (machine->ram_size > 2 * GiB) { + error_report("RAM size more than 2 GiB is not supported"); + exit(EXIT_FAILURE); + } + + for (n =3D 0; n < smp_cpus; n++) { + Object *cpuobj =3D object_new(machine->cpu_type); + + object_property_set_int(cpuobj, "midr", ZYNQ_BOARD_MIDR, + &error_fatal); + object_property_set_int(cpuobj, "reset-cbar", MPCORE_PERIPHBASE, + &error_fatal); + + qdev_realize(DEVICE(cpuobj), NULL, &error_fatal); + + cx7200_machine->cpu[n] =3D ARM_CPU(cpuobj); + } + + /* DDR remapped to address zero. */ + memory_region_add_subregion(address_space_mem, 0, machine->ram); + + /* 256K of on-chip memory */ + memory_region_init_ram(ocm_ram, NULL, "zynq.ocm_ram", 256 * KiB, + &error_fatal); + memory_region_add_subregion(address_space_mem, 0xFFFC0000, ocm_ram); + + DriveInfo *dinfo =3D drive_get(IF_PFLASH, 0, 0); + + /* AMD */ + pflash_cfi02_register(0xe2000000, "zynq.pflash", FLASH_SIZE, + dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, + FLASH_SECTOR_SIZE, 1, + 1, 0x0066, 0x0022, 0x0000, 0x0000, 0x0555, 0x2aa, + 0); + + /* Create the main clock source, and feed slcr with it */ + cx7200_machine->ps_clk =3D CLOCK(object_new(TYPE_CLOCK)); + object_property_add_child(OBJECT(cx7200_machine), "ps_clk", + OBJECT(cx7200_machine->ps_clk)); + object_unref(OBJECT(cx7200_machine->ps_clk)); + clock_set_hz(cx7200_machine->ps_clk, PS_CLK_FREQUENCY); + + /* Create slcr, keep a pointer to connect clocks */ + slcr =3D qdev_new("xilinx-zynq_slcr"); + qdev_connect_clock_in(slcr, "ps_clk", cx7200_machine->ps_clk); + qdev_prop_set_uint8(slcr, "boot-mode", cx7200_machine->boot_mode); + sysbus_realize_and_unref(SYS_BUS_DEVICE(slcr), &error_fatal); + sysbus_mmio_map(SYS_BUS_DEVICE(slcr), 0, 0xF8000000); + + dev =3D qdev_new(TYPE_A9MPCORE_PRIV); + qdev_prop_set_uint32(dev, "num-cpu", smp_cpus); + busdev =3D SYS_BUS_DEVICE(dev); + sysbus_realize_and_unref(busdev, &error_fatal); + sysbus_mmio_map(busdev, 0, MPCORE_PERIPHBASE); + beckhoff_cx7200_binfo.gic_cpu_if_addr =3D MPCORE_PERIPHBASE + 0x100; + sysbus_create_varargs("l2x0", MPCORE_PERIPHBASE + 0x2000, NULL); + for (n =3D 0; n < smp_cpus; n++) { + /* See "hw/intc/arm_gic.h" for the IRQ line association */ + DeviceState *cpudev =3D DEVICE(cx7200_machine->cpu[n]); + sysbus_connect_irq(busdev, n, + qdev_get_gpio_in(cpudev, ARM_CPU_IRQ)); + sysbus_connect_irq(busdev, smp_cpus + n, + qdev_get_gpio_in(cpudev, ARM_CPU_FIQ)); + } + + for (n =3D 0; n < 64; n++) { + pic[n] =3D qdev_get_gpio_in(dev, n); + } + + n =3D beckhoff_cx7200_init_spi_flashes(0xE0006000, pic[58 - IRQ_OFFSET= ], + false, 0); + n =3D beckhoff_cx7200_init_spi_flashes(0xE0007000, pic[81 - IRQ_OFFSET= ], + false, n); + n =3D beckhoff_cx7200_init_spi_flashes(0xE000D000, pic[51 - IRQ_OFFSET= ], + true, n); + + sysbus_create_simple(TYPE_CHIPIDEA, 0xE0002000, pic[53 - IRQ_OFFSET]); + sysbus_create_simple(TYPE_CHIPIDEA, 0xE0003000, pic[76 - IRQ_OFFSET]); + + dev =3D qdev_new(TYPE_CADENCE_UART); + busdev =3D SYS_BUS_DEVICE(dev); + qdev_prop_set_chr(dev, "chardev", serial_hd(0)); + qdev_connect_clock_in(dev, "refclk", + qdev_get_clock_out(slcr, "uart0_ref_clk")); + sysbus_realize_and_unref(busdev, &error_fatal); + sysbus_mmio_map(busdev, 0, 0xE0000000); + sysbus_connect_irq(busdev, 0, pic[59 - IRQ_OFFSET]); + dev =3D qdev_new(TYPE_CADENCE_UART); + busdev =3D SYS_BUS_DEVICE(dev); + qdev_prop_set_chr(dev, "chardev", serial_hd(1)); + qdev_connect_clock_in(dev, "refclk", + qdev_get_clock_out(slcr, "uart1_ref_clk")); + sysbus_realize_and_unref(busdev, &error_fatal); + sysbus_mmio_map(busdev, 0, 0xE0001000); + sysbus_connect_irq(busdev, 0, pic[82 - IRQ_OFFSET]); + + sysbus_create_varargs("cadence_ttc", 0xF8001000, pic[42 - IRQ_OFFSET], + pic[43 - IRQ_OFFSET], pic[44 - IRQ_OFFSET], NULL= ); + sysbus_create_varargs("cadence_ttc", 0xF8002000, pic[69 - IRQ_OFFSET], + pic[70 - IRQ_OFFSET], pic[71 - IRQ_OFFSET], NULL= ); + + gem_init(0xE000B000, pic[54 - IRQ_OFFSET]); + gem_init(0xE000C000, pic[77 - IRQ_OFFSET]); + + for (n =3D 0; n < 2; n++) { + int hci_irq =3D n ? 79 : 56; + hwaddr hci_addr =3D n ? 0xE0101000 : 0xE0100000; + DriveInfo *di; + BlockBackend *blk; + DeviceState *carddev; + + /* + * Compatible with: + * - SD Host Controller Specification Version 2.0 Part A2 + * - SDIO Specification Version 2.0 + * - MMC Specification Version 3.31 + */ + dev =3D qdev_new(TYPE_SYSBUS_SDHCI); + qdev_prop_set_uint8(dev, "sd-spec-version", 2); + qdev_prop_set_uint64(dev, "capareg", ZYNQ_SDHCI_CAPABILITIES); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, hci_addr); + sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[hci_irq - IRQ_OFFSE= T]); + + di =3D drive_get(IF_SD, 0, n); + blk =3D di ? blk_by_legacy_dinfo(di) : NULL; + carddev =3D qdev_new(TYPE_SD_CARD); + qdev_prop_set_drive_err(carddev, "drive", blk, &error_fatal); + qdev_realize_and_unref(carddev, qdev_get_child_bus(dev, "sd-bus"), + &error_fatal); + } + + dev =3D qdev_new(TYPE_ZYNQ_XADC); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0xF8007100); + sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[39 - IRQ_OFFSET]); + + dev =3D qdev_new("pl330"); + object_property_set_link(OBJECT(dev), "memory", + OBJECT(address_space_mem), + &error_fatal); + qdev_prop_set_uint8(dev, "num_chnls", 8); + qdev_prop_set_uint8(dev, "num_periph_req", 4); + qdev_prop_set_uint8(dev, "num_events", 16); + + qdev_prop_set_uint8(dev, "data_width", 64); + qdev_prop_set_uint8(dev, "wr_cap", 8); + qdev_prop_set_uint8(dev, "wr_q_dep", 16); + qdev_prop_set_uint8(dev, "rd_cap", 8); + qdev_prop_set_uint8(dev, "rd_q_dep", 16); + qdev_prop_set_uint16(dev, "data_buffer_dep", 256); + + busdev =3D SYS_BUS_DEVICE(dev); + sysbus_realize_and_unref(busdev, &error_fatal); + sysbus_mmio_map(busdev, 0, 0xF8003000); + sysbus_connect_irq(busdev, 0, pic[45 - IRQ_OFFSET]); /* abort irq line= */ + for (n =3D 0; n < ARRAY_SIZE(dma_irqs); ++n) { /* event irqs */ + sysbus_connect_irq(busdev, n + 1, pic[dma_irqs[n] - IRQ_OFFSET]); + } + + dev =3D qdev_new("xlnx.ps7-dev-cfg"); + busdev =3D SYS_BUS_DEVICE(dev); + sysbus_realize_and_unref(busdev, &error_fatal); + sysbus_connect_irq(busdev, 0, pic[40 - IRQ_OFFSET]); + sysbus_mmio_map(busdev, 0, 0xF8007000); + + /* + * Refer to the ug585-Zynq-7000-TRM manual B.3 (Module Summary) and + * the zynq-7000.dtsi. Add placeholders for unimplemented devices. + */ + create_unimplemented_device("zynq.i2c0", 0xE0004000, 4 * KiB); + create_unimplemented_device("zynq.i2c1", 0xE0005000, 4 * KiB); + create_unimplemented_device("zynq.can0", 0xE0008000, 4 * KiB); + create_unimplemented_device("zynq.can1", 0xE0009000, 4 * KiB); + create_unimplemented_device("zynq.gpio", 0xE000A000, 4 * KiB); + create_unimplemented_device("zynq.smcc", 0xE000E000, 4 * KiB); + + /* Direct Memory Access Controller, PL330, Non-Secure Mode */ + create_unimplemented_device("zynq.dma_ns", 0xF8004000, 4 * KiB); + + /* System Watchdog Timer Registers */ + create_unimplemented_device("zynq.swdt", 0xF8005000, 4 * KiB); + + /* 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); + create_unimplemented_device("zynq.axi_hp2", 0xF800A000, 0x28); + create_unimplemented_device("zynq.axi_hp3", 0xF800B000, 0x28); + + create_unimplemented_device("zynq.efuse", 0xF800d000, 0x20); + + /* Embedded Trace Buffer */ + create_unimplemented_device("zynq.etb", 0xF8801000, 4 * KiB); + + /* Cross Trigger Interface, ETB and TPIU */ + create_unimplemented_device("zynq.cti_etb_tpiu", 0xF8802000, 4 * KiB); + + /* Trace Port Interface Unit */ + create_unimplemented_device("zynq.tpiu", 0xF8803000, 4 * KiB); + + /* CoreSight Trace Funnel */ + create_unimplemented_device("zynq.funnel", 0xF8804000, 4 * KiB); + + /* Instrumentation Trace Macrocell */ + create_unimplemented_device("zynq.itm", 0xF8805000, 4 * KiB); + + /* Cross Trigger Interface, FTM */ + create_unimplemented_device("zynq.cti_ftm", 0xF8809000, 4 * KiB); + + /* Fabric Trace Macrocell */ + create_unimplemented_device("zynq.ftm", 0xF880B000, 4 * KiB); + + /* Cortex A9 Performance Monitoring Unit, CPU */ + create_unimplemented_device("cortex-a9.pmu0", 0xF8891000, 4 * KiB); + create_unimplemented_device("cortex-a9.pmu1", 0xF8893000, 4 * KiB); + + /* Cross Trigger Interface, CPU */ + create_unimplemented_device("zynq.cpu_cti0", 0xF8898000, 4 * KiB); + create_unimplemented_device("zynq.cpu_cti1", 0xF8899000, 4 * KiB); + + /* CoreSight PTM-A9, CPU */ + create_unimplemented_device("cortex-a9.ptm0", 0xF889c000, 4 * KiB); + create_unimplemented_device("cortex-a9.ptm1", 0xF889d000, 4 * KiB); + + /* AMBA NIC301 TrustZone */ + create_unimplemented_device("zynq.trustZone", 0xF8900000, 0x20); + + /* AMBA Network Interconnect Advanced Quality of Service (QoS-301) */ + create_unimplemented_device("zynq.qos301_cpu", 0xF8946000, 0x130); + create_unimplemented_device("zynq.qos301_dmac", 0xF8947000, 0x130); + create_unimplemented_device("zynq.qos301_iou", 0xF8948000, 0x130); + + beckhoff_cx7200_binfo.ram_size =3D machine->ram_size; + beckhoff_cx7200_binfo.board_id =3D 0xd32; + beckhoff_cx7200_binfo.loader_start =3D 0; + beckhoff_cx7200_binfo.board_setup_addr =3D BOARD_SETUP_ADDR; + beckhoff_cx7200_binfo.write_board_setup =3D beckhoff_cx7200_write_boar= d_setup; + + arm_load_kernel(cx7200_machine->cpu[0], machine, &beckhoff_cx7200_binf= o); +} + +static void beckhoff_cx7200_machine_class_init(ObjectClass *oc, void *data) +{ + static const char * const valid_cpu_types[] =3D { + ARM_CPU_TYPE_NAME("cortex-a9"), + NULL + }; + MachineClass *mc =3D MACHINE_CLASS(oc); + ObjectProperty *prop; + mc->desc =3D "Xilinx Zynq Platform Baseboard for Cortex-A9"; + mc->init =3D beckhoff_cx7200_init; + mc->max_cpus =3D ZYNQ_MAX_CPUS; + mc->no_sdcard =3D 1; + mc->ignore_memory_transaction_failures =3D true; + mc->valid_cpu_types =3D valid_cpu_types; + mc->default_ram_id =3D "zynq.ext_ram"; + prop =3D object_class_property_add_str(oc, "boot-mode", NULL, + beckhoff_cx7200_set_boot_mode); + object_class_property_set_description(oc, "boot-mode", + "Supported boot modes:" + " jtag qspi sd nor"); + object_property_set_default_str(prop, "qspi"); +} + +static const TypeInfo beckhoff_cx7200_machine_type =3D { + .name =3D TYPE_CX7200_MACHINE, + .parent =3D TYPE_MACHINE, + .class_init =3D beckhoff_cx7200_machine_class_init, + .instance_size =3D sizeof(CX7200MachineState), +}; + +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 ac473ce7cd..c862e9c88e 100644 --- a/hw/arm/meson.build +++ b/hw/arm/meson.build @@ -18,6 +18,7 @@ arm_ss.add(when: 'CONFIG_SBSA_REF', if_true: files('sbsa-= ref.c')) arm_ss.add(when: 'CONFIG_STELLARIS', if_true: files('stellaris.c')) arm_ss.add(when: 'CONFIG_STM32VLDISCOVERY', if_true: files('stm32vldiscove= ry.c')) arm_ss.add(when: 'CONFIG_ZYNQ', if_true: files('xilinx_zynq.c')) +arm_ss.add(when: 'CONFIG_BECK_CX7200', if_true: files('beckhoff_CX7200.c')) arm_ss.add(when: 'CONFIG_SABRELITE', if_true: files('sabrelite.c')) =20 arm_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('armv7m.c')) --=20 2.49.0 From nobody Thu Apr 3 11:35:53 2025 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=1742303778; cv=none; d=zohomail.com; s=zohoarc; b=SU6m+65YzdqOu5vefrNR9yulaE3edvLnd3+9jP6k58cyQLBeKn0z5J2B8v8rYLVP38QlpnorTygRQM/D3I+k8Bt49P+3CoPhdhoZ+KCYqehaGfY+sWmQfNVOlsdDD1gPVL+EU+/HueIiOporVOOhBTLSXqxff6D6cGNhSTCLDOs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742303778; 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=SXfXuqOifdkruB2nrZjTD84VGmjUDrLwEA4V1suXy7k=; b=g1PZdoqX+CCH1mZmN7NJacM+cDc2Jl8WsdSMGp7BXrRudXty8wHcF3i3A1kTe6w/jcSWCMc2MoOpSLuMjjWjxhA3weFHJauIofidqrAOAA1IslkyadW5AqzyhYFlXWT7qJvTQ8S1zBRDhe+4IAxsp4v/rJ0Q17I2FWFlxgmTCHE= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1742303778435174.52115756202056; Tue, 18 Mar 2025 06:16:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tuWkh-00034b-7m; Tue, 18 Mar 2025 09:13:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tuWj1-0002Kf-85; Tue, 18 Mar 2025 09:11:32 -0400 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tuWix-0003nr-K4; Tue, 18 Mar 2025 09:11:18 -0400 Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-ac2a81e41e3so1252847966b.1; Tue, 18 Mar 2025 06:11:14 -0700 (PDT) Received: from corvink-nb.beckhoff.com ([195.226.174.194]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ac3147f3101sm850678066b.69.2025.03.18.06.11.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Mar 2025 06:11:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742303473; x=1742908273; 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=SXfXuqOifdkruB2nrZjTD84VGmjUDrLwEA4V1suXy7k=; b=CIMHkLSu/Yy0FMVkSVD5Dr2lt0AZBVj7sCluDCPDFCpaPjANYWE/W/QriHZKeCia/U aldn+IEN3WU8kDNhbGZ2MPOjRo93jgjv7LdJLlTtfg5+8qO3f3pcHAEyR/3EDLo1Q2lB 0EphX2Wl/OzhUOvxgCdGY0j84Jr2w9dyTeXR1c/QQwfR/cy1FST92+VTkss2dgfezqpL xURIcYh8uXGf7iy0TcNpTiNrmAjdh0Pj8aOh10MnKDH/Ff9BqLPHzB8cDdX66cL3yaxP 77hOO4rpPk7S4nJQpoGsK89abAgESVKOaiWCO/IzoUTdeslRiTIrKX5am8kS0ed2zoSj bRAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742303473; x=1742908273; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SXfXuqOifdkruB2nrZjTD84VGmjUDrLwEA4V1suXy7k=; b=UwkshT8kiwRbig/iDGB7xSjOB59Hw/wqBMeB5IV+3P9cL+4327LRrQH4X4+f5CXJ3e P13GLYtfAaqjYwTjH2YtsIe1+RpsmdWj21gyJdU/qd0pbvm2vPyxMCaiVPCBCirrMNUs aVjyIGC0z71byeVbHUpxsZbE6jWgKGOcyuIpHEYt3G3+Hg+vsOQNKtpT72j6vd554cM4 f8rnhh8C92IogcWhCDHA01Zc2SS7nSbYyY0Fj+o4Kma7D399TWBmIkcfn3/egR+zyyT0 shLwJNIV58o5zltS3LjvW/SYUhIik43RX1BQKzMCvTud20RZcMc3+rlubHGlRKXP4cld rL3g== X-Forwarded-Encrypted: i=1; AJvYcCX3ZgrgyATkrnvBRwIrY7d8VMh8Gssh3lnkdJzHElHn169nBDc50D40YSY9hu8irKencxdjFaRrtw==@nongnu.org X-Gm-Message-State: AOJu0YzUUVgMuV9Q17Rdlux8CN8xgwK3dD4mjgLg8IXgxZj9qkzIRFaN kwb4Avn4d2em8osOK88gG+Ar5jmdprnmlpw/2nug2u2ctLzkw1Gf3CWigdSs X-Gm-Gg: ASbGncuVzwBqgaF8sOBiAmMs20rGNLSZQnULO9XHOPsvF2zRUfwrF1SnkQ29768iMUZ /qMj/W59CoJfpW8BxtafzgHiZYjInMAhfjipfYa/Jpmjxns5mXAuvhq+cFEHE03fpj3AbqPkNZS DP2XGvsjJ2BuvTYIITjvnMwlIYY8WA+gfXCM2uJip4gVo8cwPZf6Q5+apvrQ/S298GA7UL6Owxg EyNRdwlQotv1PDdGTnPjsfedZqhFi70eegz+LLbNI13aPM23K5RLKO281ckxilNV45wVVS5KQ66 XN78JJtIAN18bV9RgpdAzOe5eDGek/lgqEX5WFng8zCFg//exHjq2i6RR1zwNsyWtrw= X-Google-Smtp-Source: AGHT+IE0lcnpuFUZ8J1Qns90x+egNbeWfvr7x8ntwDgqy1y/rmgNeRNsiXeKCAzMqwHHv6Kl704dQg== X-Received: by 2002:a17:906:ee85:b0:ac3:4489:790f with SMTP id a640c23a62f3a-ac38d407bf4mr414434366b.24.1742303471954; Tue, 18 Mar 2025 06:11:11 -0700 (PDT) From: =?UTF-8?q?Corvin=20K=C3=B6hne?= To: qemu-devel@nongnu.org, =?UTF-8?q?Corvin=20K=C3=B6hne?= , qemu-arm@nongnu.org Cc: =?UTF-8?q?Yannick=20Vo=C3=9Fen?= , "Edgar E. Iglesias" , Peter Maydell , Alistair Francis , Paolo Bonzini , YannickV Subject: [PATCH 13/21] hw/arm/beckhoff_CX7200: Remove second SD controller Date: Tue, 18 Mar 2025 14:08:04 +0100 Message-ID: <20250318130817.119636-14-corvin.koehne@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250318130817.119636-1-corvin.koehne@gmail.com> References: <20250318130817.119636-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=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::62b; envelope-from=corvin.koehne@gmail.com; helo=mail-ej1-x62b.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: 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: 1742303781627019100 From: YannickV The CX7200 has one SD controller connected to address 0xE0101000. The controller connected to address 0xE0100000 can be removed. Signed-off-by: Yannick Vo=C3=9Fen --- hw/arm/beckhoff_CX7200.c | 48 ++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 27 deletions(-) diff --git a/hw/arm/beckhoff_CX7200.c b/hw/arm/beckhoff_CX7200.c index 89466cfdd8..bf3c66e5a4 100644 --- a/hw/arm/beckhoff_CX7200.c +++ b/hw/arm/beckhoff_CX7200.c @@ -207,11 +207,13 @@ static void beckhoff_cx7200_init(MachineState *machin= e) CX7200MachineState *cx7200_machine =3D CX7200_MACHINE(machine); MemoryRegion *address_space_mem =3D get_system_memory(); MemoryRegion *ocm_ram =3D g_new(MemoryRegion, 1); - DeviceState *dev, *slcr; + DeviceState *carddev, *dev, *slcr; SysBusDevice *busdev; qemu_irq pic[64]; int n; unsigned int smp_cpus =3D machine->smp.cpus; + DriveInfo *di; + BlockBackend *blk; =20 /* max 2GB ram */ if (machine->ram_size > 2 * GiB) { @@ -318,33 +320,25 @@ static void beckhoff_cx7200_init(MachineState *machin= e) gem_init(0xE000B000, pic[54 - IRQ_OFFSET]); gem_init(0xE000C000, pic[77 - IRQ_OFFSET]); =20 - for (n =3D 0; n < 2; n++) { - int hci_irq =3D n ? 79 : 56; - hwaddr hci_addr =3D n ? 0xE0101000 : 0xE0100000; - DriveInfo *di; - BlockBackend *blk; - DeviceState *carddev; + /* + * Compatible with: + * - SD Host Controller Specification Version 2.0 Part A2 + * - SDIO Specification Version 2.0 + * - MMC Specification Version 3.31 + */ + dev =3D qdev_new(TYPE_SYSBUS_SDHCI); + qdev_prop_set_uint8(dev, "sd-spec-version", 2); + qdev_prop_set_uint64(dev, "capareg", ZYNQ_SDHCI_CAPABILITIES); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0xE0101000); + sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[79 - IRQ_OFFSET]); =20 - /* - * Compatible with: - * - SD Host Controller Specification Version 2.0 Part A2 - * - SDIO Specification Version 2.0 - * - MMC Specification Version 3.31 - */ - dev =3D qdev_new(TYPE_SYSBUS_SDHCI); - qdev_prop_set_uint8(dev, "sd-spec-version", 2); - qdev_prop_set_uint64(dev, "capareg", ZYNQ_SDHCI_CAPABILITIES); - sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); - sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, hci_addr); - sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[hci_irq - IRQ_OFFSE= T]); - - di =3D drive_get(IF_SD, 0, n); - blk =3D di ? blk_by_legacy_dinfo(di) : NULL; - carddev =3D qdev_new(TYPE_SD_CARD); - qdev_prop_set_drive_err(carddev, "drive", blk, &error_fatal); - qdev_realize_and_unref(carddev, qdev_get_child_bus(dev, "sd-bus"), - &error_fatal); - } + di =3D drive_get(IF_SD, 0, 0); + blk =3D di ? blk_by_legacy_dinfo(di) : NULL; + carddev =3D qdev_new(TYPE_SD_CARD); + qdev_prop_set_drive_err(carddev, "drive", blk, &error_fatal); + qdev_realize_and_unref(carddev, qdev_get_child_bus(dev, "sd-bus"), + &error_fatal); =20 dev =3D qdev_new(TYPE_ZYNQ_XADC); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); --=20 2.49.0 From nobody Thu Apr 3 11:35:53 2025 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=1742303695; cv=none; d=zohomail.com; s=zohoarc; b=O5NbyIZUejLGNJhfAfNr/8dmlozUyWCcS7NzLV+WPb7iUA8RNHCheWf62HMSyONXgfFG4wTM7TPpCxJjEPj1aHNqF8jfkC9hB3/JscuYHMCZrvTK8fMD9Tmpa+/2XXYq6hmQcZ7T3v5zxtRvx8MpzDatzU7ylZvUuGmm0PVHhVg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742303695; 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=dLy6aE/EeuI5uid3VlN7jU07cW6eNahLR7Xv7H+Vk24=; b=O+jc4mFs0Tc2XNkhsbjSqWqBQAnycgQfWq24drXenWgyoHT2K6daqgV7/vd6mz6VFKSKixUu4BVr9JUZwGb9QvVrEpzxmgRS2Vf+/fdaAC9aQZMjiTX7ZKVL8fCiQcI81TzgB/IGAD5W+HbOdrdJD2jFtmz0xty38FgA6ZYQ5Sw= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1742303695091378.45177766627785; Tue, 18 Mar 2025 06:14:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tuWkq-0003b0-PK; Tue, 18 Mar 2025 09:13:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tuWjR-0002Q6-U5; Tue, 18 Mar 2025 09:11:52 -0400 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tuWjI-0003rf-4S; Tue, 18 Mar 2025 09:11:41 -0400 Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-5dccaaca646so9911224a12.0; Tue, 18 Mar 2025 06:11:34 -0700 (PDT) Received: from corvink-nb.beckhoff.com ([195.226.174.194]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ac3147f3101sm850678066b.69.2025.03.18.06.11.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Mar 2025 06:11:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742303493; x=1742908293; 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=dLy6aE/EeuI5uid3VlN7jU07cW6eNahLR7Xv7H+Vk24=; b=FDzFZywHonNvFweKH/Fv/YuaLT1ujiZlttpSjAFtLf6hHc2QxgosbjYKimjUGl4wzf FH49JA5mCZkjR+3L4JRfG/uWU+1ehLdxVlgGH3me+8jKrYaD2Qoc0dE6nErFcwODuR49 PCE91EkcUBXYdSq38RFPiZ4URd3TeYipo9h6i/1RvqPcBUL5plbM+B2/CBrA9N688cK+ jKmu3HJ76017dbsSM04Uz4c5DWOLxmtq1MMrGHzOD9LpNFQMxleKN4buC65LMKjmSrJD uWyzhL1HOmDkaMHtNmHRjV9D4w4bzzjzZLNMdTrIe0uv2Z44j3z4JvQctsmKQAGRLU6C Zkaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742303493; x=1742908293; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dLy6aE/EeuI5uid3VlN7jU07cW6eNahLR7Xv7H+Vk24=; b=Aoa4HI7gG/HZcb2SChgTJdwGE3lLOuLtMwMtbHM6WguaJVOtGFkqPdYfRFB/zdY1Of /umucnBA9HCB6mwpn0OtpTuRIBdlNRHN/ugzccRlHfQDxcQ5kwkvU0KKeNLUeOInMhD8 rJwfHUF8gt2ZU0+Lwm0moS1/hNjAO9cJ+7yLy2OdqRdErny8Trh/UH+yaerY9LyaczhH 3YK11VexfAZsb4DLMMX3YCyie5y7+W6sdkyjAggIfD2d5ELX8hNROn1uHXrPisTfnM4Y nV7j9ht4wCWSBefgMVIcBC3fi6mnvSNLZMNaDB3jgZQqbe4wfEoF5vJi/eZwovelNQu2 7utg== X-Forwarded-Encrypted: i=1; AJvYcCXLOb3R+d/pE8NzDRoUJSxe8SFJ38glJl0LkD3qx2bSWM0APJSJ6saNBLtmVNphMCYXVUDUMKX0xw==@nongnu.org X-Gm-Message-State: AOJu0YyRJCfXKxOtRLi25XOcyjh2jZBK2iKRkuN+76371cbK+DKsB/br FZiQ1Y9IYTDKTSWTXcmNawGz7bF2wY0mw/tf0mxg/QFPWiF3qMoFZejrIU0w X-Gm-Gg: ASbGncu7fn7Z1gEq1/O/j9gKwIBTyKv5edQIAQFDSaSp1rxQSSUP95KkEYgYbifrtUU d7eBhZrjwb/UGtHdfJaWGbP9C20c0aKlNETQqZRdEDD1jojfK2VIiZY86KiFjOKD0Vp8/ypL6wE qnLTwezcTEqjVUx4/0kOVcbMRZOrquac0KQQ8Jr5v7PoDtiMmX5Arb7C8eqAyx5xdW6drCZh++3 JD9kesWgfbpzSlXOHpJCjigKgxyS7JfrP0XK1Czk79YFmlC4E4IyJlNNhT+Tahh5lp1fB/30YRN z3eMug2up/C9BjvjaXuUBBXnOwnprhnvE7413TzVz7fGghgDDkP21VNJ2oN8o5bUyX8= X-Google-Smtp-Source: AGHT+IHihL/Cq7L9zV5OfwuOJhib7AxVnNMS6ebIe+UaM5k0LsmMuiZJaCfpgQKR2TAzlqzZ/1zlvQ== X-Received: by 2002:a05:6402:3491:b0:5e6:102a:c30 with SMTP id 4fb4d7f45d1cf-5eb1efcbee0mr3955471a12.2.1742303482100; Tue, 18 Mar 2025 06:11:22 -0700 (PDT) From: =?UTF-8?q?Corvin=20K=C3=B6hne?= To: qemu-devel@nongnu.org, =?UTF-8?q?Corvin=20K=C3=B6hne?= , qemu-arm@nongnu.org Cc: =?UTF-8?q?Yannick=20Vo=C3=9Fen?= , "Edgar E. Iglesias" , Peter Maydell , Alistair Francis , Paolo Bonzini , YannickV Subject: [PATCH 14/21] hw/arm/beckhoff_CX7200: Remove second GEM Date: Tue, 18 Mar 2025 14:08:05 +0100 Message-ID: <20250318130817.119636-15-corvin.koehne@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250318130817.119636-1-corvin.koehne@gmail.com> References: <20250318130817.119636-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=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::534; envelope-from=corvin.koehne@gmail.com; helo=mail-ed1-x534.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: 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: 1742303708068019100 From: YannickV The CX7200 has one Gigabit Ethernet MAC connected to address 0xE000C000. The one connected to address 0xE000B000 can be removed. Signed-off-by: Yannick Vo=C3=9Fen --- hw/arm/beckhoff_CX7200.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/arm/beckhoff_CX7200.c b/hw/arm/beckhoff_CX7200.c index bf3c66e5a4..3ceccaa9e6 100644 --- a/hw/arm/beckhoff_CX7200.c +++ b/hw/arm/beckhoff_CX7200.c @@ -317,7 +317,6 @@ static void beckhoff_cx7200_init(MachineState *machine) sysbus_create_varargs("cadence_ttc", 0xF8002000, pic[69 - IRQ_OFFSET], pic[70 - IRQ_OFFSET], pic[71 - IRQ_OFFSET], NULL= ); =20 - gem_init(0xE000B000, pic[54 - IRQ_OFFSET]); gem_init(0xE000C000, pic[77 - IRQ_OFFSET]); =20 /* --=20 2.49.0 From nobody Thu Apr 3 11:35:53 2025 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=1742303925; cv=none; d=zohomail.com; s=zohoarc; b=XaeWQxBVwoNmvgWXWZ9SYwm4ggBjzMrinoQjfEU55TOcRwulsxilAN8mQFcYRoRXcdxqk3vsOFBos3n1VJK+o6v0ai9vgD2vh6dZTPWT+A2lJnn6ksCG1MJ9R7BOQ6NbPZOJIzJXZwmC0ky1YB4oSCQ9Pp+07a2IfbB4KFi3oH8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742303925; 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=+EVxpnQ8AEBa+S4Znun5esfO9UMpfrf7hVR1yYjzFCA=; b=RWx3krgD7FBXKO4/qRqHrsFD8y4KhrZ1kUt9ivZhtBhUzGi/CEd3ybOCi1LBxuvHELJNd3PQh44aTUOFEnNVlSpHcKSNRNtGiUkZ7VLKKVkTIKG1maE6RqXpklpBINUceKnHhsa18koZGwu4UO7tDMdGEm+zIfnKLc4bjkCgu+I= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1742303925761691.3196116398859; Tue, 18 Mar 2025 06:18:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tuWlo-0005KU-Ez; Tue, 18 Mar 2025 09:14:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tuWjY-0002Qp-Bw; Tue, 18 Mar 2025 09:12:02 -0400 Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tuWjT-0003tr-4D; Tue, 18 Mar 2025 09:11:48 -0400 Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-ac2dfdf3c38so1037392666b.3; Tue, 18 Mar 2025 06:11:45 -0700 (PDT) Received: from corvink-nb.beckhoff.com ([195.226.174.194]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ac3147f3101sm850678066b.69.2025.03.18.06.11.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Mar 2025 06:11:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742303504; x=1742908304; 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=+EVxpnQ8AEBa+S4Znun5esfO9UMpfrf7hVR1yYjzFCA=; b=ZaNYSc/Gs4+gIVGoF/QVMsJ+AKUH0kyDaJcU5w1tyCixvto78znvhWZUIxJG+hFGRm Y+5FavMRFTjT1SRqfcvVMatUzu1YDiT2HqStIBCuXFcfcHH6e6rzNUv6hmOs3gQ1wiyy DBAyzuqcioP/brsR5W0+94B3ivZlBTakktQmyy0OBkr3Dsvcq9hasMdBoBAy+WHLGr3+ YxvLy9m6kg7fnGHSJsD6snCSiXB2Yz/VakTfYO9bF5yHEicE5vYGFEG8ilxtk8ry8wsK Xim/V9Vcw7uei0uAc2iRAis1XaXRmCKnP/705j/IMuhatTVYhNd4l6xcRchhyi3GvSaw m/AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742303504; x=1742908304; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+EVxpnQ8AEBa+S4Znun5esfO9UMpfrf7hVR1yYjzFCA=; b=qw1Y7KqobI94kDPaa+kk9DZEJ3Bstzpwny9igvJd6mG1zzXRxZ+wfALwpbkrHXZgX5 3zClFQSVTTx4wjWqSlnpZzb9foyh7+rzXe61jqa0Edgf/2/gJzgYhu6BsfHe52atSmRp CqR7VN3DSfjFkTfvauXzeauKr3yRd19SP82vCxW9g5Jdbfjd6TZArmLWUZ3TYJiMB5SU V9zGgeGGs8YnuLvDgNZKQM8nTf3ABIBa5zE+bHjSI/rlvlBtTQOkOnegU+m0rsX5Sd3p T4vkJWE/c7VFi0ns535XaP8o1dDOushRl3ue70PpAuGxwII7ADAJraPIQFYZrTktnK1P NQwA== X-Forwarded-Encrypted: i=1; AJvYcCVnqs/eVlKZZdVj3zYEJ/11HpuenpGjLTu8d+5FVxJmAnzFdXcyPt5EHyWhqdFKEgTkx5qdGyBLWQ==@nongnu.org X-Gm-Message-State: AOJu0Yz5EDnSA4ZvqUh0iC8j7m3nGrSwjm6ultlr5MeIzPl+khpbOKbh sCVKNYb06UMJxE1GXSufHK00/m6XFTt+G2U/Y9Z9ZZ6U9BwP0GiiH5isJDhf X-Gm-Gg: ASbGncs6XPEHEXjIisRrceLrcRQ+wlsDV/zpBYwQJlEwiVUPTs5IKop+2yaZXvggUsb VIF4x5Tw8OAMRTcDB2sq9IAgbDcHFOCVT860XECrcHe4HAlzWqcHnJiNvAsCF/pm+o6ZJdsXQik B3uSIRjS5fqd7QJEHo9bBLiFbCEyEB4qXJjtDK/QKjiXfzBL57C6taZAlLdDKPLKRey/bqG69Wi zREXlzHnCsuyc61d8GOp8MoMY5NJD5BoIPigY898LXGXylGloGnnYk+VfMfgma+qVl8SwVAyNZ1 rv4cuGtM00J1oMaGVNzSBXKt8QoCQglcdC0348caXDVWpWXKFWmJGLpokAcsPLUc3ZU= X-Google-Smtp-Source: AGHT+IGFhtkm/+/tOjIpZakKVZobpqBEwhKeG6Z3oV3g9BYhBDX9dQQpDK42p0TrasQIF6j69a1y2g== X-Received: by 2002:a17:906:1117:b0:ac3:3f11:b49d with SMTP id a640c23a62f3a-ac33f1203dbmr1302062666b.0.1742303493022; Tue, 18 Mar 2025 06:11:33 -0700 (PDT) From: =?UTF-8?q?Corvin=20K=C3=B6hne?= To: qemu-devel@nongnu.org, =?UTF-8?q?Corvin=20K=C3=B6hne?= , qemu-arm@nongnu.org Cc: =?UTF-8?q?Yannick=20Vo=C3=9Fen?= , "Edgar E. Iglesias" , Peter Maydell , Alistair Francis , Paolo Bonzini , YannickV Subject: [PATCH 15/21] hw/arm/beckhoff_CX7200: Adjust Flashes and Busses Date: Tue, 18 Mar 2025 14:08:06 +0100 Message-ID: <20250318130817.119636-16-corvin.koehne@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250318130817.119636-1-corvin.koehne@gmail.com> References: <20250318130817.119636-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=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::629; envelope-from=corvin.koehne@gmail.com; helo=mail-ej1-x629.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: 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: 1742303928645019100 From: YannickV The CX7200 has one QSPI flash connected to the QSPI bus. The defines are adjusted accordingly. The QSPI flash is a is25lp016d. There is no parallel flash. Signed-off-by: Yannick Vo=C3=9Fen --- hw/arm/beckhoff_CX7200.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/hw/arm/beckhoff_CX7200.c b/hw/arm/beckhoff_CX7200.c index 3ceccaa9e6..1e7152e871 100644 --- a/hw/arm/beckhoff_CX7200.c +++ b/hw/arm/beckhoff_CX7200.c @@ -48,12 +48,9 @@ OBJECT_DECLARE_SIMPLE_TYPE(CX7200MachineState, CX7200_MA= CHINE) /* board base frequency: 33.333333 MHz */ #define PS_CLK_FREQUENCY (100 * 1000 * 1000 / 3) =20 -#define NUM_SPI_FLASHES 4 -#define NUM_QSPI_FLASHES 2 -#define NUM_QSPI_BUSSES 2 - -#define FLASH_SIZE (64 * 1024 * 1024) -#define FLASH_SECTOR_SIZE (128 * 1024) +#define NUM_SPI_FLASHES 0 +#define NUM_QSPI_FLASHES 1 +#define NUM_QSPI_BUSSES 1 =20 #define IRQ_OFFSET 32 /* pic interrupts start from index 32 */ =20 @@ -164,7 +161,7 @@ static inline int beckhoff_cx7200_init_spi_flashes(uint= 32_t base_addr, =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("is25lp016d"); if (dinfo) { qdev_prop_set_drive_err(flash_dev, "drive", blk_by_legacy_dinfo(dinfo), @@ -242,15 +239,6 @@ static void beckhoff_cx7200_init(MachineState *machine) &error_fatal); memory_region_add_subregion(address_space_mem, 0xFFFC0000, ocm_ram); =20 - DriveInfo *dinfo =3D drive_get(IF_PFLASH, 0, 0); - - /* AMD */ - pflash_cfi02_register(0xe2000000, "zynq.pflash", FLASH_SIZE, - dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, - FLASH_SECTOR_SIZE, 1, - 1, 0x0066, 0x0022, 0x0000, 0x0000, 0x0555, 0x2aa, - 0); - /* Create the main clock source, and feed slcr with it */ cx7200_machine->ps_clk =3D CLOCK(object_new(TYPE_CLOCK)); object_property_add_child(OBJECT(cx7200_machine), "ps_clk", --=20 2.49.0 From nobody Thu Apr 3 11:35:53 2025 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=1742303716; cv=none; d=zohomail.com; s=zohoarc; b=e38Trs1lIKNXXMXmf/DYG5cnT6WdQfXtDkiRB9Ak/zcKAVlm6NNFt07slEtVR1f4+xXBuD9PUEsdZ9PE2LEbgpxvTqNqUFBubGr6fiffh9/Xw0nAJTx+i6mQsWEUHIW3bOfWf5iry9Ydf2gohjSGWMsvdAB5xuHdyDqvM/u7YIQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742303716; 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=j23N8vOYcpKi67Cqo7/zZHv4kG2whHLTAlH6+ZbQMt4=; b=TPkD/L0MFbK8r5w53UgRT4CZ2Xe1gEoK9n9MoxMiUCyFCwhpqS1RbXJWy3TrZhRO8srviz2Oxl7BlP+8Rmi0wgNf02Hdgw2kBWGEr4W4bd1IfyYLzs6f7Xl+jmoWCYfi1zBiW7l9u7rkxdLuBFXRYORnQ3OK/oc0y/QmESyk8NI= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1742303716758726.5176138183963; Tue, 18 Mar 2025 06:15:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tuWkk-00034y-Vp; Tue, 18 Mar 2025 09:13:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tuWji-0002Rw-NZ; Tue, 18 Mar 2025 09:12:04 -0400 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tuWje-0003wE-SC; Tue, 18 Mar 2025 09:12:00 -0400 Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-ac2b10bea16so488193166b.0; Tue, 18 Mar 2025 06:11:57 -0700 (PDT) Received: from corvink-nb.beckhoff.com ([195.226.174.194]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ac3147f3101sm850678066b.69.2025.03.18.06.11.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Mar 2025 06:11:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742303516; x=1742908316; 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=j23N8vOYcpKi67Cqo7/zZHv4kG2whHLTAlH6+ZbQMt4=; b=OHyI+t1Z1z6qmjTOVhElGWF1DdNhKsWTYn55QGpZ8wWCnXr+0i8wfKdrdJo5uPPBHW eowWM2MgP3l0fiLEDS91cI0Bo1F7spSdyGUCnRv4z53S3TE3/yTTOYGdX9/IMoLJQYCT mcn+GROXhSka3NVc4+W15adFcSmJLu8MdPmSPSS+OvN0VfeN6PqEI9RXDBkRXUtUYRqO QQIon+2kmOI3h7+JgeeDVN+RltcTIseNL+97ji1PpXkZS/AuZjvvbvOUEdvgqL0ypatB pqxs0ASFcc8t3wPtGVSwMeEzdVFo8Kqpt1N4S8dY+HYzFI/AZ5y03Esl7UXNn+rmoBMY nktA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742303516; x=1742908316; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=j23N8vOYcpKi67Cqo7/zZHv4kG2whHLTAlH6+ZbQMt4=; b=hOsTXYOOG1N4tWU0oyZ8728Qg/XsVEvWgp7fuqBR302GTvcwr9mlWuKvQxYMTGGU4G qWcjPGzIHTSrtRc/cn2FDQl9GOb8p4Xio06h4yNzHFdcZBF+uzAatfHyC/UVF1CMeRtm vqaUzuC5P1SYH0pzMnjHGTaKZFI5c2GsSv+gBdjTB168rFnbVMTB76WyHmN7N70z5W0k 4j1wPrLZfGjLEFzNP1pJbAh3Sk69dbkKUG6nCvNCa258KEoTfDmYr/FdFpmdcmKOivCL qk0WVXJT0CzpCQSl64bFfjpu74Ii13OvBVYOcYmRUqjh7p4C/EWRVOw/zFE1VZYF9Psj dyEw== X-Forwarded-Encrypted: i=1; AJvYcCU2Yt/c7a8r0nk+9McJgx0Bp2AjJz2vA92xnsKXYN5j6i35cI7JBIFYJ1gp7OtZolm0eppct2Efgg==@nongnu.org X-Gm-Message-State: AOJu0Yw/nlYkAU1l6dTglQtKgIhY0TIQStUHpBABbBF2zYtbQMuLzFXw 8x7cD+4fSjr4sMCRe9cu7oCKL/S+zoCrt0zYTJbU/JQGcHbd1daRj0/7qKDT X-Gm-Gg: ASbGncv6dfX0icDAfTanyr05/T8tWaYLj4hp2iNJ59s4BQP7hfyJfghkYYuw/D/PHCS QxJAjlpW0GDQr0DZ6bnZHKeQwddeZyvqE8Og9EE2qmOBD9ynAqrbKEifahNHcBmI4Q4gTgc7AuX t9zB6frdV01W3G76v/H68VK0DIy/VCIWjSX0bCIaLAUIFORVBpNFErgJXG/tCbhzufPE1m6lStQ t7DO+TmVkZFc/lTNQiUYUT4XsabOJXZotBWnPjTZibu3Vbck9lsQ3dtBCtBFkALzU2zk4TgDLCS f1Bhn9gTgGEXh5Y6YDLj3arwnHKOxVIg38Pd93lHAj6mEq1UBO3XAuSp4QUOFQxpZxQ= X-Google-Smtp-Source: AGHT+IGGPWxnh0QlL4IU2qsLSPRZbfU8RQ7chA6yMQvIMv4KyCTLXafg6SP2b5xW3TltQ86sf0DFLg== X-Received: by 2002:a17:906:d554:b0:ac1:def4:ce20 with SMTP id a640c23a62f3a-ac330188c47mr1531992666b.18.1742303505310; Tue, 18 Mar 2025 06:11:45 -0700 (PDT) From: =?UTF-8?q?Corvin=20K=C3=B6hne?= To: qemu-devel@nongnu.org, =?UTF-8?q?Corvin=20K=C3=B6hne?= , qemu-arm@nongnu.org Cc: =?UTF-8?q?Yannick=20Vo=C3=9Fen?= , "Edgar E. Iglesias" , Peter Maydell , Alistair Francis , Paolo Bonzini , YannickV Subject: [PATCH 16/21] hw/arm/beckhoff_CX7200: Remove usb interfaces Date: Tue, 18 Mar 2025 14:08:07 +0100 Message-ID: <20250318130817.119636-17-corvin.koehne@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250318130817.119636-1-corvin.koehne@gmail.com> References: <20250318130817.119636-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=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::62a; envelope-from=corvin.koehne@gmail.com; helo=mail-ej1-x62a.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: 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: 1742303718784019000 From: YannickV The CX7200 does not support usb interfaces. That is why they are removed. Signed-off-by: Yannick Vo=C3=9Fen --- hw/arm/Kconfig | 1 - hw/arm/beckhoff_CX7200.c | 4 ---- 2 files changed, 5 deletions(-) diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig index 8727b3e837..a8648b9edf 100644 --- a/hw/arm/Kconfig +++ b/hw/arm/Kconfig @@ -322,7 +322,6 @@ config BECK_CX7200 select PL330 select SDHCI select SSI_M25P80 - select USB_EHCI_SYSBUS select XILINX # UART select XILINX_AXI select XILINX_SPI diff --git a/hw/arm/beckhoff_CX7200.c b/hw/arm/beckhoff_CX7200.c index 1e7152e871..efce3be395 100644 --- a/hw/arm/beckhoff_CX7200.c +++ b/hw/arm/beckhoff_CX7200.c @@ -28,7 +28,6 @@ #include "hw/loader.h" #include "hw/adc/zynq-xadc.h" #include "hw/ssi/ssi.h" -#include "hw/usb/chipidea.h" #include "qemu/error-report.h" #include "hw/sd/sdhci.h" #include "hw/char/cadence_uart.h" @@ -280,9 +279,6 @@ static void beckhoff_cx7200_init(MachineState *machine) n =3D beckhoff_cx7200_init_spi_flashes(0xE000D000, pic[51 - IRQ_OFFSET= ], true, n); =20 - sysbus_create_simple(TYPE_CHIPIDEA, 0xE0002000, pic[53 - IRQ_OFFSET]); - sysbus_create_simple(TYPE_CHIPIDEA, 0xE0003000, pic[76 - IRQ_OFFSET]); - dev =3D qdev_new(TYPE_CADENCE_UART); busdev =3D SYS_BUS_DEVICE(dev); qdev_prop_set_chr(dev, "chardev", serial_hd(0)); --=20 2.49.0 From nobody Thu Apr 3 11:35:53 2025 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=1742303666; cv=none; d=zohomail.com; s=zohoarc; b=Kxqi7NoHYq9Txfhau2ZzF60yM26ToRrL6w2vy3c5JUUENv2JOxHJZrYlfsomedC3pTwL/b9iAIVQXFjq/14jzoP6ngCV4lGcCSpxQqOZkdl8eI8OF3sCXn/QrYMRcGxnZ8gyGm315O1UCwQQLPBTVDmER5l6CFhEiUNR37OkGyM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742303666; 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=ufr+Ojap1d/6dhqxl/dlT+APPSOlWATmZs8iR5dzTzY=; b=ewaMUgnIovaJLwqlnoqscZEX7GGnW2Uo4YjjbRCx5M2oHu/E6DL8IaHoBkDi5HRQizQxREp/TVT1ng6Mpc+efAF8e0gOERW6l/eUMoUSKg6kh2EkRz8yNaJ00TBfkY6gaGK+qGDckdHnk3hckv55x1ToyX4cUtdgn56FuKKMdbg= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1742303666204719.7508112273991; Tue, 18 Mar 2025 06:14:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tuWlv-0005ux-CK; Tue, 18 Mar 2025 09:14:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tuWjl-0002VA-B0; Tue, 18 Mar 2025 09:12:05 -0400 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tuWjh-0003x0-PO; Tue, 18 Mar 2025 09:12:03 -0400 Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-ac29fd22163so988631466b.3; Tue, 18 Mar 2025 06:12:00 -0700 (PDT) Received: from corvink-nb.beckhoff.com ([195.226.174.194]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ac3147f3101sm850678066b.69.2025.03.18.06.11.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Mar 2025 06:11:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742303519; x=1742908319; 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=ufr+Ojap1d/6dhqxl/dlT+APPSOlWATmZs8iR5dzTzY=; b=OzWRk/7/O2o781aCa9rj0eDHeghw1PRDR/wEbv4YwG2X3NqrHTEV634qJwZgi6J6KF 8Uo0UKZqgZ4JFLZIEwnBNc8Mk3WaxyEWxSoGdC0S71YUueu786kaxlXBUccrcBoTtlGG 50PcQtqG8rIgqcyw1oPwMLFe9ZtHovp1BCEPQiy1KlIYD5LHk09ZQ6ZFJaSm6iSSmZ6r rPW87bwSu3ndTGjAvzQa1VCsTkkN29ud6+THSEUl15Jc7lrES69q/0B643mOJAkHGnyb nSCTsZ5Us+pBJH/DIK+UQYhxcRk6Ly3CeTiVvcFtDIzNJfyTCnLKKLrdG52fmN/qb7uP iUZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742303519; x=1742908319; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ufr+Ojap1d/6dhqxl/dlT+APPSOlWATmZs8iR5dzTzY=; b=aA0+h8/vhkiPnqF+d44Ii4jjyCl5J+JjMRJ6T9p3hCGN4R+kMjALMsP9BU8xzM6+gc /yGUvvVtb6NOJ8k2xmGFSQ1jWKyUbHEvhWJ94FCpA3nQUdZ7s0PZLrf2D0ukWjPGWH21 pu4B1ZlHTy0drhutSomyUYzJ9E08v5DJWp+iEQdroXkz0QUPeHHH3tR/DkHtWo8MZc4j 9Enhf6Fgsoil7f/RCAJ35MIeeSsOR3GL6m7aJlRvCpuhZQXM1qxHycQaubmTdC5JDzoN p9AX4wPy8ROhd2HMytMCTlW46jaOtNVfgG+zcM7bv4rSuZT76DKXv5ng7DRgNVxk8HT+ dswA== X-Forwarded-Encrypted: i=1; AJvYcCUJhVC7bkhxuIu2eJCxfMK/aaBU/nZucpcR1wArzotpincOwG0qHCBggh0bTGGYdfaBjPlFucuFUg==@nongnu.org X-Gm-Message-State: AOJu0YxBlW3bOgnBd6upNmwgcFVz3jQsYxOCMV0Aj6ZkaPuNwDhfo3wf EqsLKSOvLv0aQ4BjDiqF9URdehnFJhYEWVetEtJHvcOCQFJnw7qINTwcOh35 X-Gm-Gg: ASbGncuvRsYPwvsQ9fKWnHdCTfGBqGXrdM6Ejp1wZSvwPub31wl7RuQXHIz13zDBM6H HBoFdfVj4yEvjoY/IGKXTrksn5L9S5SmjZYQvXpLHOFZC1Yu6bYEfVXRxDmp1xexDIR3ookA4nl xoHgbIqz0ZZi5Tv4xhjlXO6d1v0meSUTC6mYi4eN4ijZvx9OVbMgitU+j4KZuLqrxNwreLd1Rz2 vQObtXfwFGajv523LwZct8jgtWLUf3ZcfSlpscdrqegYUmpw4gGSokj++o0copYdSVS8O5ql+rs 9dkBmkIcGu+Vn2XU6eBwYvoIz/Stb6VF2blRO6BSovREpQ+foh+S1rAT/+A++bnrb9U= X-Google-Smtp-Source: AGHT+IELz1TJGTUEpUm+D0f9KQFhnwz6W7BK3gJ9L8xaGrpyZ/JSL1mZK1kpWzpgJef+yrdyULmUQg== X-Received: by 2002:a17:906:6a0a:b0:ac1:ed96:56d9 with SMTP id a640c23a62f3a-ac330445091mr1695805166b.40.1742303517481; Tue, 18 Mar 2025 06:11:57 -0700 (PDT) From: =?UTF-8?q?Corvin=20K=C3=B6hne?= To: qemu-devel@nongnu.org, =?UTF-8?q?Corvin=20K=C3=B6hne?= , qemu-arm@nongnu.org Cc: =?UTF-8?q?Yannick=20Vo=C3=9Fen?= , "Edgar E. Iglesias" , Peter Maydell , Alistair Francis , Paolo Bonzini , YannickV Subject: [PATCH 17/21] hw/arm/beckhoff_CX7200: Remove unimplemented devices Date: Tue, 18 Mar 2025 14:08:08 +0100 Message-ID: <20250318130817.119636-18-corvin.koehne@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250318130817.119636-1-corvin.koehne@gmail.com> References: <20250318130817.119636-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=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::633; envelope-from=corvin.koehne@gmail.com; helo=mail-ej1-x633.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: 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: 1742303669091019100 From: YannickV Some unimplemented devices do not exist for the CX7200. All unimplemented devices have been removed for better overview and the fact that they are not necessary for a CX7200 emulation. Signed-off-by: Yannick Vo=C3=9Fen --- hw/arm/beckhoff_CX7200.c | 69 ---------------------------------------- 1 file changed, 69 deletions(-) diff --git a/hw/arm/beckhoff_CX7200.c b/hw/arm/beckhoff_CX7200.c index efce3be395..a3f4045560 100644 --- a/hw/arm/beckhoff_CX7200.c +++ b/hw/arm/beckhoff_CX7200.c @@ -357,75 +357,6 @@ static void beckhoff_cx7200_init(MachineState *machine) sysbus_connect_irq(busdev, 0, pic[40 - IRQ_OFFSET]); sysbus_mmio_map(busdev, 0, 0xF8007000); =20 - /* - * Refer to the ug585-Zynq-7000-TRM manual B.3 (Module Summary) and - * the zynq-7000.dtsi. Add placeholders for unimplemented devices. - */ - create_unimplemented_device("zynq.i2c0", 0xE0004000, 4 * KiB); - create_unimplemented_device("zynq.i2c1", 0xE0005000, 4 * KiB); - create_unimplemented_device("zynq.can0", 0xE0008000, 4 * KiB); - create_unimplemented_device("zynq.can1", 0xE0009000, 4 * KiB); - create_unimplemented_device("zynq.gpio", 0xE000A000, 4 * KiB); - create_unimplemented_device("zynq.smcc", 0xE000E000, 4 * KiB); - - /* Direct Memory Access Controller, PL330, Non-Secure Mode */ - create_unimplemented_device("zynq.dma_ns", 0xF8004000, 4 * KiB); - - /* System Watchdog Timer Registers */ - create_unimplemented_device("zynq.swdt", 0xF8005000, 4 * KiB); - - /* 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); - create_unimplemented_device("zynq.axi_hp2", 0xF800A000, 0x28); - create_unimplemented_device("zynq.axi_hp3", 0xF800B000, 0x28); - - create_unimplemented_device("zynq.efuse", 0xF800d000, 0x20); - - /* Embedded Trace Buffer */ - create_unimplemented_device("zynq.etb", 0xF8801000, 4 * KiB); - - /* Cross Trigger Interface, ETB and TPIU */ - create_unimplemented_device("zynq.cti_etb_tpiu", 0xF8802000, 4 * KiB); - - /* Trace Port Interface Unit */ - create_unimplemented_device("zynq.tpiu", 0xF8803000, 4 * KiB); - - /* CoreSight Trace Funnel */ - create_unimplemented_device("zynq.funnel", 0xF8804000, 4 * KiB); - - /* Instrumentation Trace Macrocell */ - create_unimplemented_device("zynq.itm", 0xF8805000, 4 * KiB); - - /* Cross Trigger Interface, FTM */ - create_unimplemented_device("zynq.cti_ftm", 0xF8809000, 4 * KiB); - - /* Fabric Trace Macrocell */ - create_unimplemented_device("zynq.ftm", 0xF880B000, 4 * KiB); - - /* Cortex A9 Performance Monitoring Unit, CPU */ - create_unimplemented_device("cortex-a9.pmu0", 0xF8891000, 4 * KiB); - create_unimplemented_device("cortex-a9.pmu1", 0xF8893000, 4 * KiB); - - /* Cross Trigger Interface, CPU */ - create_unimplemented_device("zynq.cpu_cti0", 0xF8898000, 4 * KiB); - create_unimplemented_device("zynq.cpu_cti1", 0xF8899000, 4 * KiB); - - /* CoreSight PTM-A9, CPU */ - create_unimplemented_device("cortex-a9.ptm0", 0xF889c000, 4 * KiB); - create_unimplemented_device("cortex-a9.ptm1", 0xF889d000, 4 * KiB); - - /* AMBA NIC301 TrustZone */ - create_unimplemented_device("zynq.trustZone", 0xF8900000, 0x20); - - /* AMBA Network Interconnect Advanced Quality of Service (QoS-301) */ - create_unimplemented_device("zynq.qos301_cpu", 0xF8946000, 0x130); - create_unimplemented_device("zynq.qos301_dmac", 0xF8947000, 0x130); - create_unimplemented_device("zynq.qos301_iou", 0xF8948000, 0x130); - beckhoff_cx7200_binfo.ram_size =3D machine->ram_size; beckhoff_cx7200_binfo.board_id =3D 0xd32; beckhoff_cx7200_binfo.loader_start =3D 0; --=20 2.49.0 From nobody Thu Apr 3 11:35:53 2025 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=1742303658; cv=none; d=zohomail.com; s=zohoarc; b=kwhQd0kNEo0FSB9M7qfsAeO4gjB3a8kV6Uq3QZLehE1w7sLuhcT0VWj7NKZH/rJxbzCL5bzoyxOBXVc9WFTNlpBqxFyYz1TPH22N+gHr/toTsY1SVYS1jFX9t/PIlTa+h5qUuZiQlkBIL1qfeOHk//3kBX+4kKpwdiMe6Xd/bqc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742303658; 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=T+tDlwyJFEbqxfK75xzMM9/mAoGlGGtJAk6xVwXL1q0=; b=NBqlM/HRn8tQpP0cUWJnMVzHAl+r/ujc+EXfEm+XYShuSxVz1tDoNFJ7MiNQXUO1GXKLM/kVVB/pYJ0etBTxyBpq4Hq1u0SIy/hCuhg7dMUQfE+NLGKGGn9gIyOZNJt6flOk4LoppYvmtnSKWD0lYQLFQw6Ay03D6kZh87JDVgo= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1742303658584666.9755201509676; Tue, 18 Mar 2025 06:14:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tuWlf-0004Wb-Er; Tue, 18 Mar 2025 09:14:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tuWjl-0002XK-QM; Tue, 18 Mar 2025 09:12:06 -0400 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tuWjj-0003xc-9x; Tue, 18 Mar 2025 09:12:05 -0400 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-ac34257295dso185621066b.2; Tue, 18 Mar 2025 06:12:02 -0700 (PDT) Received: from corvink-nb.beckhoff.com ([195.226.174.194]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ac3147f3101sm850678066b.69.2025.03.18.06.11.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Mar 2025 06:11:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742303520; x=1742908320; 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=T+tDlwyJFEbqxfK75xzMM9/mAoGlGGtJAk6xVwXL1q0=; b=I6iaX4HiuxTb1I/nTl9stZHwEuUQHCDSAm15uL+dld8VmDMXgZd1lg72MH6BpgcpFC cGND4EZcMVFn7zKQaRKrVG470+HFBAh3L73SBMWc/O5nXaaffwCOPrJzY/zysUYJfBuX Vj5MAmThRPyHU26DeZWXm+lX5bujvVQMHy2pqBLt7/4jfFXM8n5xlYlTSLLh+zvnstsH OU45Ix/7wv4g/pX/2BdunkUK4Fx+oscRG1kEJICArb13M+91dA/LJWkrtxuYbCKDdfu3 +ld4jOZqcOoBoYHY1WxE3gnIUV7iRyh0BXN4pqmPitG4cQyf+4DWTh/0G0Rsk+JqGrqm bj9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742303520; x=1742908320; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=T+tDlwyJFEbqxfK75xzMM9/mAoGlGGtJAk6xVwXL1q0=; b=rHgC1goaDLQh+tAqmmInB8E7uRbuAyqZDEdfbi9r0940fbBhOIcAOZmNNFcmiy240V B0C/TnfxIMFLQAG0z5v0uERS4Bfcy+EBW+g3q3MXgPXC4HTRad2mwi7ezNIeiol0lQ3a 8JBi+IC7I41wUhSRN6HRPiXbe9V+ZShvJW7qoSyohlWywKCgciZQAD0lyA1LkyvdsUk0 E2DtWdY/uwcbjJYe0PRZVL298EsTjb3HJrsYq9RE/Eztgss3JikKtyR053B06Qh0sNwH caFvT1eOTugT2Ch052xgNRPpmK6uoZvZEyco5K/CFucibj56Fxx+N/Yt4KYNdKv4H+rD ZCFQ== X-Forwarded-Encrypted: i=1; AJvYcCW4OGtWJDo+gGpnl62rzrdvtywippvErb/FEqK+Km8qqCzXdxjEVXvvlaClT0m3+ZukM5SyKmmYCg==@nongnu.org X-Gm-Message-State: AOJu0Yx/eGBF0Zr710EBIsRHD17kEsxSqM/4zR89MHKAtlI2R0Q01KNb cOfHF3dkIDYrzj+ictvl/xQOvwJPpvKZ8r+PAV7iUcIaaNbE5csThZhbEYfe X-Gm-Gg: ASbGncul/cx5HRbStw7og0Zv8zrc29T/efPycDnDfTS/NuoXK+HmJLyEsAQWRVlPT1M OOErXAeWM5GJZ2kAiuNGkuJoGS8FIxOpvkMjRX3edwjlwBBDsAfsrJ1OWvLrX8f4ELdt7TdyIsl EEKH2EmsZ2cKqo1pzvDOWuuu/1eU5Ir0Kye5TlAe7MpMiNsWec/UAWPNFTMSi6CXlqfXT0HuOez dj9IQZ4dOMDKaibnjAT4tQBH4imX7lQVa0YTmIBuPmXQnvDGw+jwA7oCQ1ImVkC/A6B+jO75fKo bvcVLyFKu+oupn16zxcJ6DGCNsQuSgKp7w6/EGgaUTzB8EQ/6HvX9ty0OoxC1viLakawH2rNW44 KXQ== X-Google-Smtp-Source: AGHT+IEY7u6OTvhW2V7FFeYjo6xgg7GibW+G21Kdhp5ZE5mvBgnFWw/YSvsyKPGpgf+M22TGazndzw== X-Received: by 2002:a17:907:c02:b0:ac3:4227:139c with SMTP id a640c23a62f3a-ac342271ebdmr1525780566b.24.1742303520261; Tue, 18 Mar 2025 06:12:00 -0700 (PDT) From: =?UTF-8?q?Corvin=20K=C3=B6hne?= To: qemu-devel@nongnu.org, =?UTF-8?q?Corvin=20K=C3=B6hne?= , qemu-arm@nongnu.org Cc: =?UTF-8?q?Yannick=20Vo=C3=9Fen?= , "Edgar E. Iglesias" , Peter Maydell , Alistair Francis , Paolo Bonzini , YannickV Subject: [PATCH 18/21] hw/arm/beckhoff_CX7200: Set CPU frequency and PERIPHCLK period Date: Tue, 18 Mar 2025 14:08:09 +0100 Message-ID: <20250318130817.119636-19-corvin.koehne@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250318130817.119636-1-corvin.koehne@gmail.com> References: <20250318130817.119636-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=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::636; envelope-from=corvin.koehne@gmail.com; helo=mail-ej1-x636.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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: 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: 1742303660056019100 From: YannickV The CPU frequency for the CX7200 is set to 720 MHz, with the peripheral clock running at half of the CPU frequency. That is why the PERIPHCLK_PERIOD is set to two. These values are forwarded to the A9 global timer, watchdog timer and MP Timer. Signed-off-by: Yannick Vo=C3=9Fen --- hw/arm/beckhoff_CX7200.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hw/arm/beckhoff_CX7200.c b/hw/arm/beckhoff_CX7200.c index a3f4045560..0f99cbf554 100644 --- a/hw/arm/beckhoff_CX7200.c +++ b/hw/arm/beckhoff_CX7200.c @@ -47,6 +47,9 @@ OBJECT_DECLARE_SIMPLE_TYPE(CX7200MachineState, CX7200_MAC= HINE) /* board base frequency: 33.333333 MHz */ #define PS_CLK_FREQUENCY (100 * 1000 * 1000 / 3) =20 +#define PERIPHCLK_PERIOD 2 +#define PS7_CPU_CLK_FREQUENCY 720000000 + #define NUM_SPI_FLASHES 0 #define NUM_QSPI_FLASHES 1 #define NUM_QSPI_BUSSES 1 @@ -254,6 +257,13 @@ static void beckhoff_cx7200_init(MachineState *machine) =20 dev =3D qdev_new(TYPE_A9MPCORE_PRIV); qdev_prop_set_uint32(dev, "num-cpu", smp_cpus); + A9MPPrivState *a9mp_priv_state =3D A9MPCORE_PRIV(dev); + a9mp_priv_state->gtimer.cpu_clk_freq_hz =3D PS7_CPU_CLK_FREQUENCY; + a9mp_priv_state->gtimer.periphclk_period =3D PERIPHCLK_PERIOD; + a9mp_priv_state->mptimer.clk_freq_hz =3D PS7_CPU_CLK_FREQUENCY; + a9mp_priv_state->mptimer.periphclk_period =3D PERIPHCLK_PERIOD; + a9mp_priv_state->wdt.clk_freq_hz =3D PS7_CPU_CLK_FREQUENCY; + a9mp_priv_state->wdt.periphclk_period =3D PERIPHCLK_PERIOD; busdev =3D SYS_BUS_DEVICE(dev); sysbus_realize_and_unref(busdev, &error_fatal); sysbus_mmio_map(busdev, 0, MPCORE_PERIPHBASE); --=20 2.49.0 From nobody Thu Apr 3 11:35:53 2025 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=1742303770; cv=none; d=zohomail.com; s=zohoarc; b=gdMi380S8lYAyGmb8CkXtF9LX6yqW3gxyx/Rz1Wq1mByYGKNcAJkqk9CHWfmFld39T8+br8xVUPGztPlZFdDnv0O+V+Itk+iALmwNz/2HxjZB0HQC+jTA0PqQT6arQIb6U/HadFb3zM8ABKcV+SQTsDgwgkQEuS8hvVhHantLLk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742303770; 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=6UXGlbIZhHPzWOxHT3393dj5S24d5ZRozakrW4r6Pfw=; b=GBRq0HUyuEVNLdzM6AQF7I0EoZw7eJ/jCArUm+j/xZ9rJmCjAL8VuPoLPkygOlE8CW/lxdWVuHGM74MMvcxza97YKRS+vSsIiXUj3qdALxlB2V+s0p6DLsANrgTFQizT7ScNZImnnTf9ZWS41Uxf1o1UIXjqMN0hno2Tb9hoUkI= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1742303770753875.0776924145686; Tue, 18 Mar 2025 06:16:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tuWlk-0004yl-Ay; Tue, 18 Mar 2025 09:14:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tuWkJ-0002ny-Lb; Tue, 18 Mar 2025 09:12:40 -0400 Received: from mail-ej1-x62e.google.com ([2a00:1450:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tuWjk-0003yM-Gp; Tue, 18 Mar 2025 09:12:10 -0400 Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-ac2bfcd2a70so774331966b.0; Tue, 18 Mar 2025 06:12:03 -0700 (PDT) Received: from corvink-nb.beckhoff.com ([195.226.174.194]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ac3147f3101sm850678066b.69.2025.03.18.06.12.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Mar 2025 06:12:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742303522; x=1742908322; 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=6UXGlbIZhHPzWOxHT3393dj5S24d5ZRozakrW4r6Pfw=; b=fPgeE1Og8RDTltNPmsdxR6J5Z9UY+s7ySu3te7s8Za6b7r7/QlBk3PKDQdACvYxdhn DpRiRO0UCzGph/1WMy1fiAal+C0E5ilWr2SGUacRXPpDDYzC/rCOBONPYc5PXQvh8HMw qYSgc8S2fGMfmyz15/Sha1Y/mEmGuY5Lhs03b/x+RFesL0h6wopuiidF0b71kJ4NDUuQ QxNWVqmRCks1HC6FM2QzQuyosYYGP+JGUCetjA9XAOA1P9rEonlOQ8Uym7aaVPSB7GL7 v8M6QgTX1LXsktuoaNIj7xBElf1xQAM7Ax0ErNIB9+JWuW5NRfRobXBvfyLxdyULU/Wx pDrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742303522; x=1742908322; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6UXGlbIZhHPzWOxHT3393dj5S24d5ZRozakrW4r6Pfw=; b=ZeK5LIY78haT249skBbyIyizTQLpkxm/Ep/qL6VphPHay83ADZ7wWf7PAuGofqAXY/ kp0a7BkHeHaO/YKhhT9oWMhryHdp466Ylix2x/LwEn3o5VqK2TSA2NGqYjt6RmAk+xMk RepxWx4FSPD2NehUegNrmh7LtpmVI75j8HBf22qHQbD1SQY7ZkknjCsceUcI6Uu3I0G+ g91kd5dONm3soXb/IZ/hgf2H42ZKAuNttMnY2GVLF3bqkN6fOyJaN0pEcLViYqff2DBE NMTsa7hbX8Gy16kFrnAJ9ESScgtyzUVxUzMzfTjY8zdpAIYQ6FNZxNnonQwKT8SG0+Rc lwGw== X-Forwarded-Encrypted: i=1; AJvYcCUGnfF2aOWNwFEhASmNuojkN0w12CJxbHDZzGV6gRIhC4UxY+3gf4h9QnP6lbdsGg2FoWzZgzlZhg==@nongnu.org X-Gm-Message-State: AOJu0Yxf24RZqtIu9fab8j8myoqtqe8dm789KcXEL5Juomqkd7gJ4RP4 R/wexanel9uqrKNc/JcutYftJpaBc4Rqywu3+mnjTagKdTHBzhl/XHVnSCQC X-Gm-Gg: ASbGncsiUs+HAjLj0Ppa6oq3zAUvhDnzTpNqtdQt13lQKLeLlQ6OJV3emBR2oV4f8VZ WFg3z4OpEtRIzIw8QCN0TOjoNkNtO8hTYdEY08x4kMQe/5zRsu42IRL4a89GR/MJ56RSwxDLD1u Ou/cfYIfMfOwFtL/4gwVXMs5gg3UmxvxLRNJY75IFXxBoBPfY/OVeibHmQq+uaWHk0kPlIxNbxs W8fWmIaWMI2u6o/WZrXpIkeHJM+PX/N1TsTRwUOQfHcJOurMTaH/IrkseqBdy0VLZPninwEYJBG f87PO7/OfhAtXvOd5Rp+VZePQV8IihAwKQozdRHoewIRUA2Unhttd77ZoQe8Q6QAhTg= X-Google-Smtp-Source: AGHT+IEEe6BEm8fwJ9kJVNEsUel1fGMglcmYM0sO/6G+h1kC5l8jLg7t138XNRLJslpExlgkwytbEQ== X-Received: by 2002:a17:907:9712:b0:aae:e52f:3d36 with SMTP id a640c23a62f3a-ac3301e4c08mr1675086166b.6.1742303521946; Tue, 18 Mar 2025 06:12:01 -0700 (PDT) From: =?UTF-8?q?Corvin=20K=C3=B6hne?= To: qemu-devel@nongnu.org, =?UTF-8?q?Corvin=20K=C3=B6hne?= , qemu-arm@nongnu.org Cc: =?UTF-8?q?Yannick=20Vo=C3=9Fen?= , "Edgar E. Iglesias" , Peter Maydell , Alistair Francis , Paolo Bonzini , YannickV Subject: [PATCH 19/21] hw/arm/beckhoff_CX7200: Add CCAT to CX7200 Date: Tue, 18 Mar 2025 14:08:10 +0100 Message-ID: <20250318130817.119636-20-corvin.koehne@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250318130817.119636-1-corvin.koehne@gmail.com> References: <20250318130817.119636-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=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::62e; envelope-from=corvin.koehne@gmail.com; helo=mail-ej1-x62e.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: 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: 1742303772862019000 From: YannickV The Beckhoff CX7200 is based on the Xilinx Zynq-7000 SoC. It integrates the Beckhoff Communication Controller (CCAT), which is implemented as an FPGA within the Zynq's programmable logic (PL). This commit adds the CCAT as an MMIO device to the CX7200 machine in QEMU, enabling its emulation and interaction with the system. Signed-off-by: Yannick Vo=C3=9Fen --- hw/arm/Kconfig | 1 + hw/arm/beckhoff_CX7200.c | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig index a8648b9edf..782da4c22a 100644 --- a/hw/arm/Kconfig +++ b/hw/arm/Kconfig @@ -327,6 +327,7 @@ config BECK_CX7200 select XILINX_SPI select XILINX_SPIPS select ZYNQ_DEVCFG + select BECKHOFF_CCAT =20 config ARM_V7M bool diff --git a/hw/arm/beckhoff_CX7200.c b/hw/arm/beckhoff_CX7200.c index 0f99cbf554..0fe03f570f 100644 --- a/hw/arm/beckhoff_CX7200.c +++ b/hw/arm/beckhoff_CX7200.c @@ -130,6 +130,17 @@ static void gem_init(uint32_t base, qemu_irq irq) sysbus_connect_irq(s, 0, irq); } =20 +static void ccat_init(uint32_t base) +{ + DeviceState *dev; + SysBusDevice *busdev; + + dev =3D qdev_new("beckhoff-ccat"); + busdev =3D SYS_BUS_DEVICE(dev); + sysbus_realize_and_unref(busdev, &error_fatal); + sysbus_mmio_map(busdev, 0, base); +} + static inline int beckhoff_cx7200_init_spi_flashes(uint32_t base_addr, qemu_irq irq, bool is_qspi, int un= it0) { @@ -313,6 +324,8 @@ static void beckhoff_cx7200_init(MachineState *machine) =20 gem_init(0xE000C000, pic[77 - IRQ_OFFSET]); =20 + ccat_init(0x40000000); + /* * Compatible with: * - SD Host Controller Specification Version 2.0 Part A2 --=20 2.49.0 From nobody Thu Apr 3 11:35:53 2025 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=1742303930; cv=none; d=zohomail.com; s=zohoarc; b=LbliCw3EHpVdaOfK3zURwOFBikRojASRJG1HJrNYi2rVt4EcWcCTFB/NSGmHW2lY6XyAyShca6Uq2qll+WN81a5mODmWz13InRBsBg7rk49T8IXAhj6jkfG2Ma1oGo/zgXlrCJK1GPpDHprUmFMA2jWrCGLvGmQ4GqlVKWKViN4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742303930; 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=uSRHLk0R9GXiHfoVjL1DK6CsPsvWkZBDEdWUC+o27+M=; b=SknD/ce/7Is/J6IA5VWGWnP8vITzdXVOAdp2LCa8Ofti6y4aSl8IgJiD91ASJ++De82VUXY3h6XFi3UxQwMX5JJobulwQpNjogl1fafTIMmzd+T+cssn5bMHgFcqX8kFQ9ZJu34DN0aZ8O71MJcd5sEG10cXyF5K1gcoAZjy8SE= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 174230393014634.89821736354418; Tue, 18 Mar 2025 06:18:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tuWm0-0006Mz-WA; Tue, 18 Mar 2025 09:14:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tuWkK-0002oi-Hz; Tue, 18 Mar 2025 09:12:41 -0400 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tuWjv-00041B-Dl; Tue, 18 Mar 2025 09:12:17 -0400 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-ac25d2b2354so956880666b.1; Tue, 18 Mar 2025 06:12:14 -0700 (PDT) Received: from corvink-nb.beckhoff.com ([195.226.174.194]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ac3147f3101sm850678066b.69.2025.03.18.06.12.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Mar 2025 06:12:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742303533; x=1742908333; 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=uSRHLk0R9GXiHfoVjL1DK6CsPsvWkZBDEdWUC+o27+M=; b=NtjiIbl4iLRZX6MDXeOSSTL6M5YuU5iKaWd4n7eqjfbAQct2LsXWRV9LAVtdfEq0LV pEZ7YWfLYdV++8OK+XV3S3m1vF1TmH1WFxubZ0NlIN5QvoHVt/uHShyuVommoduHNp9l E8vQP6puVMH978ju2QAV6uIwwi6IPLZ8W/v6FJLhaaMYQ56VFOD9vMlzKLtYyVbGmRo1 DDm871QUOCNt60PiJdbUsLXXO2kOzxjK7Ac2KcYYF1u5Wme3HOFuol4egw0lvSI415Ps LxNDl4YBc8skMXVhERGHnWebY8vWz1egioGzIm+iQUm5+SJwZBGQOBXWq96ls1xNNCgJ 9ESA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742303533; x=1742908333; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uSRHLk0R9GXiHfoVjL1DK6CsPsvWkZBDEdWUC+o27+M=; b=dcCKpUw+lAnHVUWPESzB4VhhnPjsI8w2L19kE97Rj3H15s5TTE4lqMl9xY7JBzjYDr ac4j8SNI+4EVEnOATxSpyR8VSMabQ83/DgkOWW1JSAMkEhZHIqUbV1/uHeK6SPKnxSwN Y+P5Kkqa4c3t4loMx5zSL2YzDyYXDsUzcvvvwGKnY8o0Sa2/RSP4pU/Xq3DsCUOrg3t2 83gx9wWsQKgCZNpg2LbktaDc0M2cg1HgRV60BnMaQi5xroZQ/eKe1kYzEnjYm7ec8Epe Yoi88ibOceGc5J9ENVJFeAuvheXQ5IT7WcA0A0Ry0fuqrdS2KG7sPfnf5MuJ9jh40Ac+ Frag== X-Forwarded-Encrypted: i=1; AJvYcCWjH9DiN9bneY2iVoPJqmirKyJS6fxVDXjisul6yF6k17+Zn/P0amkBPkY2yc5FEm15s5nUB8PN/g==@nongnu.org X-Gm-Message-State: AOJu0YymqBChaQnHupqNb39Ok0jlHSdbLeAn67kOyCjz8UF3fFaONkZY 3x7oLOBsR1SgP2DikA4LbawTub2FDAjdJZaafw9rgJyjfLv0TBinl70K6R1y X-Gm-Gg: ASbGncursttJHPm127FIywWsT2hAmRLCNpFwqtNR0qj+psNFKu6V0fWtiW/hW9M8uk9 74H2rAUo1RN05GYe6yV1hYXPIpcA0b0Nc/YK5CJC0HxBNhcih6JHQ5Ci/fsWhZEB2x9xLOC6x3H PZulzrgwJlAYLkFpjiBqAG936TX6D7xeybE0tO7DJHlXs42XxHKj2qt2F7OzmwIMyih8xiO0fYm v9H3989Sz6dzHHumqFnTPTh6rZ1w1iS2R1bcs5tYvj0EddxRX7cmum0+Xx/YwbMLe9s6U3w/X6q ibfQWFdISLJQFcd+eZ1Xqgw7Zf721P+CX5qHhOz0V0NjVOxZenmQW5fTYZc95JGlI1s= X-Google-Smtp-Source: AGHT+IHbHSM9/eDTy6KTx6nQhcN7grYEwNg5n62I7IDr9T4nnse0jfwO6SAZqcZhCE6HiSIJRsqqNg== X-Received: by 2002:a17:907:6d0f:b0:abf:457e:cef1 with SMTP id a640c23a62f3a-ac330442e09mr1846487266b.40.1742303523249; Tue, 18 Mar 2025 06:12:03 -0700 (PDT) From: =?UTF-8?q?Corvin=20K=C3=B6hne?= To: qemu-devel@nongnu.org, =?UTF-8?q?Corvin=20K=C3=B6hne?= , qemu-arm@nongnu.org Cc: =?UTF-8?q?Yannick=20Vo=C3=9Fen?= , "Edgar E. Iglesias" , Peter Maydell , Alistair Francis , Paolo Bonzini , YannickV Subject: [PATCH 20/21] hw/arm/beckhoff_CX7200: Add dummy DDR CTRL to CX7200 Date: Tue, 18 Mar 2025 14:08:11 +0100 Message-ID: <20250318130817.119636-21-corvin.koehne@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250318130817.119636-1-corvin.koehne@gmail.com> References: <20250318130817.119636-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=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::62f; envelope-from=corvin.koehne@gmail.com; helo=mail-ej1-x62f.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: 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: 1742303937182019100 From: YannickV The CX7200 polls for statusregisters in the DDR Controller. To avaid endless polling loops, a dummy DDR Controller is added. Signed-off-by: Yannick Vo=C3=9Fen --- hw/arm/beckhoff_CX7200.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/hw/arm/beckhoff_CX7200.c b/hw/arm/beckhoff_CX7200.c index 0fe03f570f..8c1379aab4 100644 --- a/hw/arm/beckhoff_CX7200.c +++ b/hw/arm/beckhoff_CX7200.c @@ -141,6 +141,17 @@ static void ccat_init(uint32_t base) sysbus_mmio_map(busdev, 0, base); } =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 inline int beckhoff_cx7200_init_spi_flashes(uint32_t base_addr, qemu_irq irq, bool is_qspi, int un= it0) { @@ -326,6 +337,8 @@ static void beckhoff_cx7200_init(MachineState *machine) =20 ccat_init(0x40000000); =20 + ddr_ctrl_init(0xF8006000); + /* * Compatible with: * - SD Host Controller Specification Version 2.0 Part A2 --=20 2.49.0 From nobody Thu Apr 3 11:35:53 2025 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=1742303785; cv=none; d=zohomail.com; s=zohoarc; b=meZ/FgGqvH6sY6VbHDA6egBB5GG+LN8KYoGMHhtsXgQagOr/MZBWYexirXdLmrNhN5Zz1ju3QAceczMM5HR8Qcz9Ayc9yypve3kggVDowwVbusHQDTg2mLlLoIun1yzvgIP8ne22OWUVjIPuC4iLWRNyGfyNpQF4R6eZCJeSXQ4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742303785; 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=thjTRy17yqeXC7hJLQ3q6JhWsNnlTRLfGO55CMsgDr8=; b=jlA+9zeGBGDZmyo2nAW61/R+33jd3sKca99Nwbn/Yk2jbEmpQ5IfozfRNYfIJhMD7efitozqqjHgUQ1CCgWQtUgNNxAu1/n9lRm5b1Udu81Xf47zzf/mnnqd/zED1uQwizxnr/yAJvGMQPm1DmBkZV1LaOupJiEYJLkxn7Jwplk= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1742303785298411.54781125443105; Tue, 18 Mar 2025 06:16:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tuWlo-0005M9-Ra; Tue, 18 Mar 2025 09:14:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tuWkL-0002qF-LU; Tue, 18 Mar 2025 09:12:42 -0400 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tuWjw-00041J-Ur; Tue, 18 Mar 2025 09:12:18 -0400 Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-ac2aeada833so1094994766b.0; Tue, 18 Mar 2025 06:12:15 -0700 (PDT) Received: from corvink-nb.beckhoff.com ([195.226.174.194]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ac3147f3101sm850678066b.69.2025.03.18.06.12.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Mar 2025 06:12:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742303534; x=1742908334; 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=thjTRy17yqeXC7hJLQ3q6JhWsNnlTRLfGO55CMsgDr8=; b=c16QddkDenQayHHAkLf4oa/Ls3DNBZ5JfApZeHj/V2E0Y2J8eD9sGFdq1Z3OTi8pDI gfO8mv0Q1bEm940+KnuoJqFUa+CNnsEyi7V7zj5CDJBLdlWBM2p64ppTlAS9KQG9+P77 Y9Opm82OFHCCTcxOyOhWdLg+5WWG/diU6TI6IXj7iAZHehYE2/KW5+VmNlQUodxjtmPt ttMzliMelk9ToqoFzD0H2eQ0qul/d8yD92oRcYGZcSxnASe0a0YOj5EhOl6VQhWniWwI zu2Ku3+cnfWUFaceoIqvywl3DYcZ3OzSnG2lS1/rFs0Iz4A7MiImlyWBqdTFIRhHzctL 4C4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742303534; x=1742908334; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=thjTRy17yqeXC7hJLQ3q6JhWsNnlTRLfGO55CMsgDr8=; b=ihZGBnKh0RY+FlkcP/jWabFC+tRTxv9vX+m03OcY7AfbvO/7MVHXECvbYEsZDNkifr MQXOomyp6fGIx3DNyOSCUXL5rX3dx4URMR3IjRa7JkMrlv8jlXoiHzChnySUPlm8yYTW X0uBUL0g9GgXN6Jg67OiUIQgrqlmRgHAURNx79HM7ewrm+iV2G2R93l0878Z3zO2FTP0 xSbuScajiN+KnXrLgSmWi+0ClAQp+syc8TrILyX1kxoS0wTGtFWY46byWxh8tDeioDTe nWJkg7ewtyLmXmwDMvuvO23fuV8Vs84kCiG1Cqz7/6M4CPRxLpVA3SRQKl5dmev7wIhK +JPQ== X-Forwarded-Encrypted: i=1; AJvYcCXCcFoDcauZwi0PMZs+9gNH+H3FlZFTEZGwfnxa96IJ4UBUwTFkSi91rsq4qhqnUygM20rjmuqu+g==@nongnu.org X-Gm-Message-State: AOJu0Yw81DENe321HmPsbfiwijq4kth0S7Nas+NtY0+XHNl3P2vx5tt4 vFIA01ACxtljrvpyccrbu3GxpMw+TcNYjTdgC9EDz1cR8YMsgz6ddE1fvlgN X-Gm-Gg: ASbGncu7SrXm9MgM27VWX5Xol04E0yNqO6bKAZD3wodMU47ULqBYANYzFWpO+/MRrW1 7Zw/3F0txkPdO+2HHjuN7sgvdnF96MgslTBdsbYRz6mVZwmRMX3VDoLlQKu0lE68coyvzF9h9w4 PNkD8iuXlYj2VVSLD+PezzZwRk1tcf6HpWHSVoqmUJJCjaeXptlam2a3OY/oJUJ+2bABgN2H3sc xuR4PonFAvzZE0e4BAGxNCvemuiTlxPl63mLVxM71DO7THOziWHH5RS3OsSEi3KSMMB1vRoN4o5 6UzacxHc8BOT/W90k0gN4SpI4lWkZREAzsFbyyUK3T6Y5zXY47nw1weuOE6z10QB9/OCwK2m65D Ibg== X-Google-Smtp-Source: AGHT+IFWh7K6FTJ9EfxAuzqL9izAfxIeFOjUOlr/N83G9SMhg8w+wNRbH0z8Y/VRza/Mx24k2k00ZA== X-Received: by 2002:a17:907:2da6:b0:ac1:e45f:9c71 with SMTP id a640c23a62f3a-ac38f709234mr314946466b.1.1742303533896; Tue, 18 Mar 2025 06:12:13 -0700 (PDT) From: =?UTF-8?q?Corvin=20K=C3=B6hne?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Yannick=20Vo=C3=9Fen?= , "Edgar E. Iglesias" , qemu-arm@nongnu.org, Peter Maydell , Alistair Francis , =?UTF-8?q?Corvin=20K=C3=B6hne?= , Paolo Bonzini Subject: [PATCH 21/21] MAINTAINERS: add myself as reviewer for Beckhoff devices Date: Tue, 18 Mar 2025 14:08:12 +0100 Message-ID: <20250318130817.119636-22-corvin.koehne@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250318130817.119636-1-corvin.koehne@gmail.com> References: <20250318130817.119636-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=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::62d; envelope-from=corvin.koehne@gmail.com; helo=mail-ej1-x62d.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: 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: 1742303789299019000 From: Corvin K=C3=B6hne I don't have commit privileges, so I can't merge any changes. However, some= one from Beckhoff should review changes made to their board emulations. Signed-off-by: Corvin K=C3=B6hne --- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 8f470a1c9b..88d1d51e2a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -720,6 +720,13 @@ F: hw/arm/b-l475e-iot01a.c F: hw/display/dm163.c F: tests/qtest/dm163-test.c =20 +Beckhoff CX7200 +R: Corvin K=C3=B6hne +L: qemu-arm@nongnu.org +S: Supported +F: hw/arm/beckhoff_CX7200.c +F: hw/misc/beckhoff_ccat.c + Exynos M: Igor Mitsyanko M: Peter Maydell --=20 2.49.0