From patchwork Fri Jan 29 10:59:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 373318 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp2102815jam; Fri, 29 Jan 2021 03:23:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJw+ZKPtfxNNKAyXk+JtkssetrJ11zKkJMHj+l8cIAbF2merf5rytZC+zo80L3MpSgkEs/pC X-Received: by 2002:a25:45c3:: with SMTP id s186mr5088096yba.435.1611919430690; Fri, 29 Jan 2021 03:23:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611919430; cv=none; d=google.com; s=arc-20160816; b=rQArQitVl8wkbLbsWDMXNvXLTi2SqfaD/h5dViZjvmdmVPlv+eya0u5MYI0tY0Gqk2 wNsIzEWlSAYtO8g4A7mnbWWt5neBlCvKqedtbaYUKEwki4k15RkeFUPcdoPIY1regUYG gCyqFA/p45mDqeJEx98u+IzlEwuXM7yRuHbyQU+6XPAXLuPYCLXn5dDdNU8Bq6SdT0HC XyGNxV/gYK5Cd3nt2TB47cle1617TOKXsSQIFf3gB3XVjZgymeFXaqn8SkLDZd3pr/bF e2C3qRcp9dLcCqBMa7YZuS7NR/GY0CVj7zBwYuULWsOPZKVO1oPNokyUjxRWOAid3JcK xoJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=kUOp22EsTKgUuurZMNtwMQiMUdVfM/wWPoj1JapbOFU=; b=abWZRu3qZTFAVZmo8dyfZ6semrG472Q0OCgxBYlNnVS7OGjGkr0ccWCoukELTC8kC0 VRiWpT6tUJFJ9f97A2ynsVFuOzUftEGe+JgVgrlFUA8HokNt1IpJskmZIlU2zLTjDKma hFAmVtwmvU+MsQwDmRmFh/rTRJ24f9J/5SK7lHsc2ZC7qIfln+CtAOthbun62MTMPfp+ 0snsZgTCmEcUXY5myzMsf8RdDiqOjVUoJgw3WSJH+0oocsLdYFWFTHK4UE8RcBNYEiQZ 1WxjX9rTLFrmk0g2+1F11589yHlOXeOPfwEDhJFqr/EKw4z9Lx18od7m80kXXbD7pXIb r9+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NYQn1FCr; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a11si7265602ybs.320.2021.01.29.03.23.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 29 Jan 2021 03:23:50 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NYQn1FCr; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:50794 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5RsU-0002GZ-3V for patch@linaro.org; Fri, 29 Jan 2021 06:23:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60006) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RWJ-0004zZ-Bg for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:55 -0500 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:37922) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RW5-00074n-Tc for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:55 -0500 Received: by mail-wr1-x430.google.com with SMTP id s7so5398309wru.5 for ; Fri, 29 Jan 2021 03:00:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=kUOp22EsTKgUuurZMNtwMQiMUdVfM/wWPoj1JapbOFU=; b=NYQn1FCr+JgqJYUVuqhqRx6Lslvl6jwgVblJ6U/ycAixOJkp4Zce3qFZeumt+JNUWQ Pa8bbIWf6m24OFuqJys7VnlSIlgoS+G2dM3/mexIzFo0Y1V2aU96ZGcM5vPYMM/gZspO H4cX6ZY9AG4c5XgLXk6GsmNIiS43jYJZB5bF9jOvWtrwRZo3GM4SExZikpOLZJhWolMb UPYXt1TKU/Zntx92bmuUmGzUETOGxge3U+epPNIw0rfaA61JzwA8sh/jQR+pephhfa1Q +t9M9RQyAhIoFiI401RWpAofz8YyPHOW+wPyoesdVvrR751nadLbEg91mH13ytEhBnLQ I/zQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kUOp22EsTKgUuurZMNtwMQiMUdVfM/wWPoj1JapbOFU=; b=Zklqx1FRN1mRZDW6lJ3JD8KplTFCLeNMWc8YlXpNfdRvie2CIFDT7eIJTz35Tyyc+9 zfpFIEUelZ7W572gHmMbQu3Xo0zmbFtG/gfSgXIa5gkeIAEw7UxkaDwg350l9ZUP5asn DP+SI34MGoAyGTvsOKEYZTy+DLQhFzQWWDQYUK6NFMgzk0W+Hnvtgq7963poo/KqhIiP KsOoNL1QLXPaaD8jBGvEYYjmDfofX8mc64OxQzvaY4K7UOJym6HPZZfjALdpB6I+42K/ Uz3Cruu8bxiCOGNiS5+GntKSjuZdFV0Az0a2j6VQL/oSPvnI+hO/N+8+RSAwc+YlkytQ JNmw== X-Gm-Message-State: AOAM533xf/cz8hBuDxczMAuy28h5Bu6HR+VnF4ZMSi6S2WZg0GXXEFz6 Wr4ScEg5XoVMfDuZJcIRFKGF4LSXomlZEA== X-Received: by 2002:a5d:4211:: with SMTP id n17mr3897967wrq.37.1611918040467; Fri, 29 Jan 2021 03:00:40 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:39 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 28/46] hw/timer/cmsdk-apb-timer: Add Clock input Date: Fri, 29 Jan 2021 10:59:54 +0000 Message-Id: <20210129110012.8660-29-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x430.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" As the first step in converting the CMSDK_APB_TIMER device to the Clock framework, add a Clock input. For the moment we do nothing with this clock; we will change the behaviour from using the pclk-frq property to using the Clock once all the users of this device have been converted to wire up the Clock. Since the device doesn't already have a doc comment for its "QEMU interface", we add one including the new Clock. This is a migration compatibility break for machines mps2-an505, mps2-an521, musca-a, musca-b1. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Luc Michel Tested-by: Philippe Mathieu-Daudé Message-id: 20210128114145.20536-8-peter.maydell@linaro.org Message-id: 20210121190622.22000-8-peter.maydell@linaro.org --- include/hw/timer/cmsdk-apb-timer.h | 9 +++++++++ hw/timer/cmsdk-apb-timer.c | 7 +++++-- 2 files changed, 14 insertions(+), 2 deletions(-) -- 2.20.1 diff --git a/include/hw/timer/cmsdk-apb-timer.h b/include/hw/timer/cmsdk-apb-timer.h index baa009bb2da..fc2aa97acac 100644 --- a/include/hw/timer/cmsdk-apb-timer.h +++ b/include/hw/timer/cmsdk-apb-timer.h @@ -15,11 +15,19 @@ #include "hw/qdev-properties.h" #include "hw/sysbus.h" #include "hw/ptimer.h" +#include "hw/clock.h" #include "qom/object.h" #define TYPE_CMSDK_APB_TIMER "cmsdk-apb-timer" OBJECT_DECLARE_SIMPLE_TYPE(CMSDKAPBTimer, CMSDK_APB_TIMER) +/* + * QEMU interface: + * + QOM property "pclk-frq": frequency at which the timer is clocked + * + Clock input "pclk": clock for the timer + * + sysbus MMIO region 0: the register bank + * + sysbus IRQ 0: timer interrupt TIMERINT + */ struct CMSDKAPBTimer { /*< private >*/ SysBusDevice parent_obj; @@ -29,6 +37,7 @@ struct CMSDKAPBTimer { qemu_irq timerint; uint32_t pclk_frq; struct ptimer_state *timer; + Clock *pclk; uint32_t ctrl; uint32_t value; diff --git a/hw/timer/cmsdk-apb-timer.c b/hw/timer/cmsdk-apb-timer.c index ae9c5422540..c63145ff553 100644 --- a/hw/timer/cmsdk-apb-timer.c +++ b/hw/timer/cmsdk-apb-timer.c @@ -35,6 +35,7 @@ #include "hw/sysbus.h" #include "hw/irq.h" #include "hw/registerfields.h" +#include "hw/qdev-clock.h" #include "hw/timer/cmsdk-apb-timer.h" #include "migration/vmstate.h" @@ -212,6 +213,7 @@ static void cmsdk_apb_timer_init(Object *obj) s, "cmsdk-apb-timer", 0x1000); sysbus_init_mmio(sbd, &s->iomem); sysbus_init_irq(sbd, &s->timerint); + s->pclk = qdev_init_clock_in(DEVICE(s), "pclk", NULL, NULL); } static void cmsdk_apb_timer_realize(DeviceState *dev, Error **errp) @@ -236,10 +238,11 @@ static void cmsdk_apb_timer_realize(DeviceState *dev, Error **errp) static const VMStateDescription cmsdk_apb_timer_vmstate = { .name = "cmsdk-apb-timer", - .version_id = 1, - .minimum_version_id = 1, + .version_id = 2, + .minimum_version_id = 2, .fields = (VMStateField[]) { VMSTATE_PTIMER(timer, CMSDKAPBTimer), + VMSTATE_CLOCK(pclk, CMSDKAPBTimer), VMSTATE_UINT32(ctrl, CMSDKAPBTimer), VMSTATE_UINT32(value, CMSDKAPBTimer), VMSTATE_UINT32(reload, CMSDKAPBTimer),