Received: by 2002:a19:6d5:0:0:0:0:0 with SMTP id 204csp956947lfg; Wed, 17 Mar 2021 19:38:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx72vO8dv9s+uINi9yO4GFTbcekOuIqyypQclDg1y8b7jgdSE+odZPfwrRS+BXMCaJyOhB+ X-Received: by 2002:a25:37d7:: with SMTP id e206mr8327834yba.241.1616035109082; Wed, 17 Mar 2021 19:38:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616035109; cv=none; d=google.com; s=arc-20160816; b=kGgn0qxut0G9PXzHx8kXgGUrvWai5/4BF66/W8gDnYzCJE00PD9nI4KzkHHaKqZ1zy A21OLXRNUlKFJhuxm4GK+2vXk5PgpmW03OvcnPxT8+RLsplC6rPLTFPQiB3B1gEwMLfp oaICzkPVhaiGXzYCzQBhFDTabYrqKq5OsNHE+oyT+2DnLenkUbt+u74XQkhSIzvBxGBg a1s9hvULX+eVlBM9wKf7lSCO738vdsE8H3kzwtcDjym+VdxZb0qsKdO8Ag6VInuaFprr w6H12PYXOo8WJ1FQY+/F+0WnqmGKu9rREhaqg7ikHIweCZ0RYCLAVTWCkbB67bFn0J8i GjNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:dkim-signature; bh=nhX9VdYigl43+pLGOk2y8Ded0VMBF7IzbzxBqIOaHHI=; b=ANog6yMcgEQJJDtKja+kPUuBC8ljf5YV+zHp6JzBtrGlh/EMY1TtLc3e0g66Z6/wir GYhfssztXoCanq7KU2bK2ufYIsSIiN6dvauK1XAdZ+0i9TEeO8wVCYHddSK0hjP/KlqL mf9+NA+y5nbo6xCwdkZCcnJ63pZ6FuuWpdRIi0BUrINVTne0Hpu6EHTkrj0NRAEsHQZe eacRfOUZbNqJZ0Q0i0wk7FAeIwPcxPxyAyP3Bu8F+55Y2KyoAPxb4Pe8vx4O8v5Zqy0E EshvhccTqj5nC1pCWNJto/UO+Nle9y+Wvhs0xs5osi0OyvEXzvnCNNy2zhpxiWxFAHHe 0t/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@redhat.com header.s=mimecast20190719 header.b=L5h93k1W; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b9si956029ybr.491.2021.03.17.19.38.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Mar 2021 19:38:29 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@redhat.com header.s=mimecast20190719 header.b=L5h93k1W; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:41792 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lMiYO-00081Y-Fl for alex.bennee@linaro.org; Wed, 17 Mar 2021 22:38:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51246) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMiYG-000816-VN for qemu-arm@nongnu.org; Wed, 17 Mar 2021 22:38:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:34857) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMiYE-0002iJ-8K for qemu-arm@nongnu.org; Wed, 17 Mar 2021 22:38:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616035097; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nhX9VdYigl43+pLGOk2y8Ded0VMBF7IzbzxBqIOaHHI=; b=L5h93k1WdwAfujZlDprzcYanqbLgTxX/G1TgD4wEDamWKUd40za+YsQZ0HAmsXUnPM0zlj QVQPbrhpoeBHG+geOQuI5vnYIHbtqp6kME+E9xkpG6hgI9zzHhR/fxuS5SJx9Nk/xBOQ66 y2lRc1M0r9YCQGlb4oeAa69CK47KfMs= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-174-e7hs4fFdPxeflaQw7WZ27w-1; Wed, 17 Mar 2021 22:38:13 -0400 X-MC-Unique: e7hs4fFdPxeflaQw7WZ27w-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 792F05B362; Thu, 18 Mar 2021 02:38:12 +0000 (UTC) Received: from gshan.redhat.com (vpn2-54-49.bne.redhat.com [10.64.54.49]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7541D5D9C0; Thu, 18 Mar 2021 02:38:05 +0000 (UTC) From: Gavin Shan To: qemu-arm@nongnu.org Subject: [PATCH] hw/arm/virt: Disable pl011 clock migration if needed Date: Thu, 18 Mar 2021 10:38:01 +0800 Message-Id: <20210318023801.18287-1-gshan@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=gshan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=170.10.133.124; envelope-from=gshan@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.251, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-arm@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, drjones@redhat.com, luc@lmichel.fr, ehabkost@redhat.com, qemu-devel@nongnu.org, shan.gavin@gmail.com, marcel.apfelbaum@gmail.com, marcandre.lureau@redhat.com, pbonzini@redhat.com Errors-To: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org Sender: "Qemu-arm" X-TUID: Pp7+ymjovePd A clock is added by commit aac63e0e6ea3 ("hw/char/pl011: add a clock input") since v5.2.0 which corresponds to virt-5.2 machine type. It causes backwards migration failure from upstream to downstream (v5.1.0) when the machine type is specified with virt-5.1. This fixes the issue by following instructions from section "Connecting subsections to properties" in docs/devel/migration.rst. With this applied, the PL011 clock is migrated based on the machine type. virt-5.2 or newer: migration virt-5.1 or older: non-migration Cc: qemu-stable@nongnu.org # v5.2.0+ Fixes: aac63e0e6ea3 ("hw/char/pl011: add a clock input") Suggested-by: Andrew Jones Signed-off-by: Gavin Shan --- hw/char/pl011.c | 9 +++++++++ hw/core/machine.c | 1 + include/hw/char/pl011.h | 1 + 3 files changed, 11 insertions(+) diff --git a/hw/char/pl011.c b/hw/char/pl011.c index c5621a195f..dc85527a5f 100644 --- a/hw/char/pl011.c +++ b/hw/char/pl011.c @@ -322,10 +322,18 @@ static const MemoryRegionOps pl011_ops = { .endianness = DEVICE_NATIVE_ENDIAN, }; +static bool pl011_clock_needed(void *opaque) +{ + PL011State *s = PL011(opaque); + + return s->migrate_clk; +} + static const VMStateDescription vmstate_pl011_clock = { .name = "pl011/clock", .version_id = 1, .minimum_version_id = 1, + .needed = pl011_clock_needed, .fields = (VMStateField[]) { VMSTATE_CLOCK(clk, PL011State), VMSTATE_END_OF_LIST() @@ -363,6 +371,7 @@ static const VMStateDescription vmstate_pl011 = { static Property pl011_properties[] = { DEFINE_PROP_CHR("chardev", PL011State, chr), + DEFINE_PROP_BOOL("migrate-clk", PL011State, migrate_clk, true), DEFINE_PROP_END_OF_LIST(), }; diff --git a/hw/core/machine.c b/hw/core/machine.c index 257a664ea2..9935c6ddd5 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -52,6 +52,7 @@ GlobalProperty hw_compat_5_1[] = { { "virtio-scsi-device", "num_queues", "1"}, { "nvme", "use-intel-id", "on"}, { "pvpanic", "events", "1"}, /* PVPANIC_PANICKED */ + { "pl011", "migrate-clk", "off" }, }; const size_t hw_compat_5_1_len = G_N_ELEMENTS(hw_compat_5_1); diff --git a/include/hw/char/pl011.h b/include/hw/char/pl011.h index 33e5e5317b..dc2c90eedc 100644 --- a/include/hw/char/pl011.h +++ b/include/hw/char/pl011.h @@ -50,6 +50,7 @@ struct PL011State { CharBackend chr; qemu_irq irq[6]; Clock *clk; + bool migrate_clk; const unsigned char *id; }; -- 2.23.0