From nobody Tue Feb 10 06:43:56 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1571761649; cv=none; d=zoho.com; s=zohoarc; b=dZCCRiiyg8rRGL6/pLcqEYq4gh2tkkfrh9pdWdZwBBq+OA8erScme6M1XPCMIjDCoTn0FVR1WB76pDSTy8cpZjgAR6JkPd2e+XZ3Yl2BEPjWfyE3kEiN3AMp9scWgC0oBQHNA/Q7SiiPq0ixnB3cDZb0xr452wLuLER+2x/pQEk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571761649; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+i8OgFBD4A2/05+byWS5j2CMFVOYhYSUDPGflIqzto4=; b=BDeJ9ze8pCfJUXb1lMV/S2coZU9ePPf8v0JCNBcEqQnoZg6GwxrL7hzrpQjjgNCjssbiniKDHhiB6ieTJ7sEoTmYNu5uYEMYytC2fk8/h5p5Gaoyr+VeGU76z8UE7pKtwGB/t1CSmWZiT8O/Ix75Yo8ex+RuK6pgGg2/5ynzyJs= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1571761649646420.1310959427685; Tue, 22 Oct 2019 09:27:29 -0700 (PDT) Received: from localhost ([::1]:35686 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMx0K-0003q4-62 for importer@patchew.org; Tue, 22 Oct 2019 12:27:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38084) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMwvo-0006tW-H7 for qemu-devel@nongnu.org; Tue, 22 Oct 2019 12:22:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iMwvn-0007Hk-AM for qemu-devel@nongnu.org; Tue, 22 Oct 2019 12:22:48 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:44451 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iMwvn-0007HM-6s for qemu-devel@nongnu.org; Tue, 22 Oct 2019 12:22:47 -0400 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-272-UALn1juJNHqMvpv0GxeWVQ-1; Tue, 22 Oct 2019 12:22:42 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9F6A6476; Tue, 22 Oct 2019 16:22:40 +0000 (UTC) Received: from localhost (ovpn-112-21.ams2.redhat.com [10.36.112.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8F0575C1D4; Tue, 22 Oct 2019 16:22:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571761366; 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: in-reply-to:in-reply-to:references:references; bh=+i8OgFBD4A2/05+byWS5j2CMFVOYhYSUDPGflIqzto4=; b=WjGvFGJ1OOKiQHmL7yFp/1C/ljuYqZD4zuD6WJUPRvI8/NhYFMNdMFl21I+QINQC4nyhwf 3sa4h2lBM2GmSY4rUakvD/E2Q+wjk/eMr6XZGl3Xhxwm97VEoWvIJN498vVsfehIqQmZwE uC/GvO/xhRGks03Y5fllUUVwKia9ULo= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH v2 06/28] serial: make SerialMMState actually a different type Date: Tue, 22 Oct 2019 18:21:15 +0200 Message-Id: <20191022162137.27161-7-marcandre.lureau@redhat.com> In-Reply-To: <20191022162137.27161-1-marcandre.lureau@redhat.com> References: <20191022162137.27161-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: UALn1juJNHqMvpv0GxeWVQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 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: , Cc: Corey Minyard , Peter Maydell , "Michael S. Tsirkin" , Jason Wang , Mark Cave-Ayland , KONRAD Frederic , "Edgar E. Iglesias" , Aleksandar Rikalo , Magnus Damm , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Artyom Tarasenko , Eduardo Habkost , Fabien Chouteau , qemu-arm@nongnu.org, Richard Henderson , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , qemu-ppc@nongnu.org, Aleksandar Markovic , Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" And move the "it_shift" field there, since it's specific. Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/char/serial.c | 10 ++++++---- include/hw/char/serial.h | 9 +++++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/hw/char/serial.c b/hw/char/serial.c index b623c4e79f..4fc2bcedf1 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -1025,14 +1025,14 @@ static const TypeInfo serial_info =3D { static uint64_t serial_mm_read(void *opaque, hwaddr addr, unsigned size) { - SerialState *s =3D opaque; + SerialMMState *s =3D SERIAL_MM(opaque); return serial_ioport_read(s, addr >> s->it_shift, 1); } =20 static void serial_mm_write(void *opaque, hwaddr addr, uint64_t value, unsigned size) { - SerialState *s =3D opaque; + SerialMMState *s =3D SERIAL_MM(opaque); value &=3D 255; serial_ioport_write(s, addr >> s->it_shift, value, 1); } @@ -1066,10 +1066,11 @@ SerialState *serial_mm_init(MemoryRegion *address_s= pace, qemu_irq irq, int baudbase, Chardev *chr, enum device_endian end) { - DeviceState *dev =3D DEVICE(object_new(TYPE_SERIAL)); + DeviceState *dev =3D DEVICE(object_new(TYPE_SERIAL_MM)); + SerialMMState *m =3D SERIAL_MM(dev); SerialState *s =3D SERIAL(dev); =20 - s->it_shift =3D it_shift; + m->it_shift =3D it_shift; s->irq =3D irq; s->baudbase =3D baudbase; qdev_prop_set_chr(dev, "chardev", chr); @@ -1088,6 +1089,7 @@ SerialState *serial_mm_init(MemoryRegion *address_spa= ce, static const TypeInfo serial_mm_info =3D { .name =3D TYPE_SERIAL_MM, .parent =3D TYPE_SERIAL, + .instance_size =3D sizeof(SerialMMState), }; =20 static void serial_register_types(void) diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h index 2b8dbd88f1..62962e3c5a 100644 --- a/include/hw/char/serial.h +++ b/include/hw/char/serial.h @@ -57,7 +57,6 @@ typedef struct SerialState { qemu_irq irq; CharBackend chr; int last_break_enable; - int it_shift; int baudbase; uint32_t tsr_retry; guint watch_tag; @@ -80,6 +79,12 @@ typedef struct SerialState { MemoryRegion io; } SerialState; =20 +typedef struct SerialMMState { + SerialState parent; + + int it_shift; +} SerialMMState; + extern const VMStateDescription vmstate_serial; extern const MemoryRegionOps serial_io_ops; =20 @@ -91,7 +96,7 @@ void serial_set_frequency(SerialState *s, uint32_t freque= ncy); #define SERIAL(s) OBJECT_CHECK(SerialState, (s), TYPE_SERIAL) =20 #define TYPE_SERIAL_MM "serial-mm" -#define SERIAL_MM(s) OBJECT_CHECK(SerialState, (s), TYPE_SERIAL_MM) +#define SERIAL_MM(s) OBJECT_CHECK(SerialMMState, (s), TYPE_SERIAL_MM) =20 SerialState *serial_init(int base, qemu_irq irq, int baudbase, Chardev *chr, MemoryRegion *system_io); --=20 2.23.0.606.g08da6496b6