From nobody Thu May 2 22:13:26 2024 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576849699; cv=none; d=zohomail.com; s=zohoarc; b=hfzWOF/dDbvsJqyXecDSw1RQBhpkwQssjKr7xChZpp0Kf6aDRTg1Wp5awOrtrb+GLJ3lMaZxP5MHV/o84AbO/hyO8N27No8l8VkKdgkvX/yrbXQiI974ZJPQF2RoMcCQxFG6bBFSKz7R0PDx0IMSmWxePoXdJi3gRbsbwUU0k4g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576849699; 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=LdCyFYn/HsfbvSgtbOBMQszsFSG9g0+uWPfNrJnmnsY=; b=VA8PbtK/XAAuy8/rt8zR0PuKOrS8iRaMeXXC8WOqpyWb/F0MZHP+4J1Bct+sUkoduoO3p1PxIpl5umlDGoyjDUb71v1zUXapcDM6cV+lL+e9TKDOHB8mPmsxd3n5QoVheORZitARUmCYVD3adnxs7YcAqV+SAWBwTabejCxH1bg= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576849699355747.4630106290782; Fri, 20 Dec 2019 05:48:19 -0800 (PST) Received: from localhost ([::1]:56082 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIdd-0003tU-9h for importer@patchew.org; Fri, 20 Dec 2019 08:48:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53868) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIbm-0002HD-8g for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:46:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiIbl-00048O-3S for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:46:22 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:31719 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iiIbk-00045x-TQ for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:46:20 -0500 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-142-MiRixK9POUOdEb2YRfSA2w-1; Fri, 20 Dec 2019 08:46:16 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EB489911B1; Fri, 20 Dec 2019 13:46:15 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id EAF9B26FB2; Fri, 20 Dec 2019 13:46:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576849580; 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=LdCyFYn/HsfbvSgtbOBMQszsFSG9g0+uWPfNrJnmnsY=; b=Ew7qOE8jy4ferDZdONIwWsbD+vd+gnqmm6dXrPnfhbKNPGsBNQhJO7XkC7X6qbZuG9E4pp MswdNZzyNy8xQqddGakhSFyIAfU6CgCaee9DzXZnfJYKWvDN7wcs0K/+cEDjdlwWaNZhOz RKzR4fnjxFyLWZON3FPImQFJBV6Uk1k= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH v5 01/37] hw/display/sm501: Always map the UART0 Date: Fri, 20 Dec 2019 17:45:25 +0400 Message-Id: <20191220134601.571905-2-marcandre.lureau@redhat.com> In-Reply-To: <20191220134601.571905-1-marcandre.lureau@redhat.com> References: <20191220134601.571905-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: MiRixK9POUOdEb2YRfSA2w-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.120 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: peter.maydell@linaro.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 The SM501 is a Mobile Multimedia Companion Chip with 2 UARTs. This model only implements the first UART. Being part of the chipset, the UART block is always mapped in memory, regardless of whether we provide a chardev backend. Since commit 12051d82f, qemu_chr_fe_init() accepts a NULL chardev. Let's remove the chardev check and always map the UART in the chipset memory. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20191122133623.13004-1-philmd@redhat.com> Reviewed-by: Peter Maydell --- hw/display/sm501.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/hw/display/sm501.c b/hw/display/sm501.c index 1f33c87e65..79bd7bc2d1 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -1958,11 +1958,9 @@ static void sm501_realize_sysbus(DeviceState *dev, E= rror **errp) sysbus_pass_irq(sbd, SYS_BUS_DEVICE(usb_dev)); =20 /* bridge to serial emulation module */ - if (s->chr_state) { - serial_mm_init(&s->state.mmio_region, SM501_UART0, 2, - NULL, /* TODO : chain irq to IRL */ - 115200, s->chr_state, DEVICE_LITTLE_ENDIAN); - } + serial_mm_init(&s->state.mmio_region, SM501_UART0, 2, + NULL, /* TODO : chain irq to IRL */ + 115200, s->chr_state, DEVICE_LITTLE_ENDIAN); } =20 static Property sm501_sysbus_properties[] =3D { --=20 2.24.0.308.g228f53135a From nobody Thu May 2 22:13:26 2024 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576849844; cv=none; d=zohomail.com; s=zohoarc; b=KBB43uO4BkYnDLiKWKQjFdqmi+XQcbQbX9UBk9Xy0C9djTjRy/wHpSgJbhtv0XVLdd286aUNJwdmf9ba3kCHBSfjHPqgK/imL4C61byabBNOglmiQ8HXPsbMUBolmX0cRMMOf8LWzC/npObHy1h6oS1RWpaxIQvorpuE/N+r9Kk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576849844; 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=WIyw2oPbq6TeMBF+9vJKPv0bzo11CTOb3s6Rch9UlmQ=; b=E6AvJg8ivIkuy/AgrulueohhSaSx1BH+DhapE/1owq5fWDFnKlqhlNtVRwuK68Y8Q1uPiTvo0on4O+PSIXUQ/S+VuDoLstIkmR9LCHbiIj5gh5+AV+Qik6SPebWPEGvU51I08wK7R900+/tXVe2f8B45+YYbbgU3s5Ad/mdrfBY= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576849844921231.29860979601153; Fri, 20 Dec 2019 05:50:44 -0800 (PST) Received: from localhost ([::1]:56144 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIfz-00080g-6e for importer@patchew.org; Fri, 20 Dec 2019 08:50:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55357) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIbu-0002SC-Uk for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:46:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiIbt-0004iJ-Ku for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:46:30 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:57399 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iiIbt-0004dr-Df for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:46:29 -0500 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-251-yDq5u3kDP3i4dbfCypjUuQ-1; Fri, 20 Dec 2019 08:46:24 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 97D7F8C0C6D; Fri, 20 Dec 2019 13:46:23 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id DC58E1A8E4; Fri, 20 Dec 2019 13:46:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576849588; 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=WIyw2oPbq6TeMBF+9vJKPv0bzo11CTOb3s6Rch9UlmQ=; b=LvmzVsh2ZhIIr/xk/lIapqkjbaGxiPf0MKYoH54PUPLJKuYUqKIrD5/KwbKSuwu8KUYxxA RBQX7FBpwkdZEOawJtc9Ou7lYrzacTHaIOqcij7frxeIJG3O8ek52PtorjrcEXzURx7lfz vyOaioiUOtd6L942DShSbkA3I9JVsJE= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH v5 02/37] sysbus: remove unused sysbus_try_create* Date: Fri, 20 Dec 2019 17:45:26 +0400 Message-Id: <20191220134601.571905-3-marcandre.lureau@redhat.com> In-Reply-To: <20191220134601.571905-1-marcandre.lureau@redhat.com> References: <20191220134601.571905-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: yDq5u3kDP3i4dbfCypjUuQ-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: 207.211.31.120 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: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Peter Maydell --- hw/core/sysbus.c | 32 -------------------------------- hw/i386/pc.c | 1 - include/hw/sysbus.h | 9 +-------- 3 files changed, 1 insertion(+), 41 deletions(-) diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c index 9e69c83aed..08b0311c5f 100644 --- a/hw/core/sysbus.c +++ b/hw/core/sysbus.c @@ -250,38 +250,6 @@ DeviceState *sysbus_create_varargs(const char *name, return dev; } =20 -DeviceState *sysbus_try_create_varargs(const char *name, - hwaddr addr, ...) -{ - DeviceState *dev; - SysBusDevice *s; - va_list va; - qemu_irq irq; - int n; - - dev =3D qdev_try_create(NULL, name); - if (!dev) { - return NULL; - } - s =3D SYS_BUS_DEVICE(dev); - qdev_init_nofail(dev); - if (addr !=3D (hwaddr)-1) { - sysbus_mmio_map(s, 0, addr); - } - va_start(va, addr); - n =3D 0; - while (1) { - irq =3D va_arg(va, qemu_irq); - if (!irq) { - break; - } - sysbus_connect_irq(s, n, irq); - n++; - } - va_end(va); - return dev; -} - static void sysbus_dev_print(Monitor *mon, DeviceState *dev, int indent) { SysBusDevice *s =3D SYS_BUS_DEVICE(dev); diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 42014b06de..a4fda69b49 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1198,7 +1198,6 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *= gsi, * when the HPET wants to take over. Thus we have to disable the latte= r. */ if (!no_hpet && (!kvm_irqchip_in_kernel() || kvm_has_pit_state2())) { - /* In order to set property, here not using sysbus_try_create_simp= le */ hpet =3D qdev_try_create(NULL, TYPE_HPET); if (hpet) { /* For pc-piix-*, hpet's intcap is always IRQ2. For pc-q35-1.7 diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h index 27e80881da..2eb0484388 100644 --- a/include/hw/sysbus.h +++ b/include/hw/sysbus.h @@ -117,8 +117,7 @@ void foreach_dynamic_sysbus_device(FindSysbusDeviceFunc= *func, void *opaque); /* Legacy helper function for creating devices. */ DeviceState *sysbus_create_varargs(const char *name, hwaddr addr, ...); -DeviceState *sysbus_try_create_varargs(const char *name, - hwaddr addr, ...); + static inline DeviceState *sysbus_create_simple(const char *name, hwaddr addr, qemu_irq irq) @@ -126,11 +125,5 @@ static inline DeviceState *sysbus_create_simple(const = char *name, return sysbus_create_varargs(name, addr, irq, NULL); } =20 -static inline DeviceState *sysbus_try_create_simple(const char *name, - hwaddr addr, - qemu_irq irq) -{ - return sysbus_try_create_varargs(name, addr, irq, NULL); -} =20 #endif /* HW_SYSBUS_H */ --=20 2.24.0.308.g228f53135a From nobody Thu May 2 22:13:26 2024 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576849725; cv=none; d=zohomail.com; s=zohoarc; b=iMeFh2T4XG15ubSX7yhF75FRo6xU1f1IuLMGjDXBM9wpuYKQcQtc4YQ+91MQSG1WgUIyn5yRG+o2Ib5wQP3p/P0QPqjisUaq/kaem0fcUpGK8n/RiolX459D9CtT4l3le5vE7T+1qaGvUn0M7kctpsisDTl6a2PDbBvSYqzOCqQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576849725; 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=JU9WSm/Ebtg+kGcnii2zxW3xshOKUTAzloix/p4/H98=; b=FD/iUd9GmiF32S5ZYyWe/UF56jx1jvVCvHW5GjwNNc7gsSkP18Qh/XhED1MiS/Y5vkP3BXYDKlrqmogC4pluRPbyxl/d8CjK2/dJ6XQBVwnVisfpDVtrhtZot5g+/ZxMuoSha1d3vlKJxjfrXpYV9T551uPO9iDPG01ZdtXODGs= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576849725952536.47150746505; Fri, 20 Dec 2019 05:48:45 -0800 (PST) Received: from localhost ([::1]:56090 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIe4-0004Xv-IX for importer@patchew.org; Fri, 20 Dec 2019 08:48:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56634) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIc2-0002dX-CU for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:46:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiIc0-0005AZ-3u for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:46:38 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:42591 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iiIbz-00058e-TA for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:46:36 -0500 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-103-nz5lnsxYNeylCbJWRxwNPQ-1; Fri, 20 Dec 2019 08:46:32 -0500 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 2F841109C121; Fri, 20 Dec 2019 13:46:31 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 772C65DA70; Fri, 20 Dec 2019 13:46:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576849595; 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=JU9WSm/Ebtg+kGcnii2zxW3xshOKUTAzloix/p4/H98=; b=fmS0GOiYAv7XcLmKtXLH96ajIBvAvpadgwYJD/2eUa47ras7v2Osp7KH/S/esHRaQGvC9M O5h8nkvfZGn7K78PgHblb4vvfqMa2cOfxaJvOhnHqpi52iyZugYPmg5HVq7mlc7HK580KH +He6qKnaFSDzds6NMfqmRyWO7P4N8ug= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH v5 03/37] sysbus: remove outdated comment Date: Fri, 20 Dec 2019 17:45:27 +0400 Message-Id: <20191220134601.571905-4-marcandre.lureau@redhat.com> In-Reply-To: <20191220134601.571905-1-marcandre.lureau@redhat.com> References: <20191220134601.571905-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: nz5lnsxYNeylCbJWRxwNPQ-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: 207.211.31.120 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: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The init callback is no more since commit 817a17fc60f44e29a1944b60d32f45ea127f0cf9 ("core/sysbus: remove the SysBusDeviceClass::init path") Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/sysbus.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h index 2eb0484388..c4a1c0adfa 100644 --- a/include/hw/sysbus.h +++ b/include/hw/sysbus.h @@ -24,10 +24,6 @@ typedef struct SysBusDevice SysBusDevice; =20 /** * SysBusDeviceClass: - * @init: Callback function invoked when the #DeviceState.realized property - * is changed to %true. Deprecated, new types inheriting directly from - * TYPE_SYS_BUS_DEVICE should use #DeviceClass.realize instead, new leaf - * types should consult their respective parent type. * * SysBusDeviceClass is not overriding #DeviceClass.realize, so derived * classes overriding it are not required to invoke its implementation. --=20 2.24.0.308.g228f53135a From nobody Thu May 2 22:13:26 2024 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576849855; cv=none; d=zohomail.com; s=zohoarc; b=OIyTlaiqsyw84SE/nXQzGsaW5lx88N9+nKQva706I9mrE39MDX1PY42erioLG+i1fpUa6NQIaxdODdemltfb3RYQXpMB+/V0Aiwx2ht2fvBaLLznMV0BgcwOGT7QKhT5boCcEaSh2pH8+NsaGeSBOQgAHh5N3jobTW5PP7Ka38U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576849855; 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=BRFY1VkkPB2r+9GUFBRiM+ygTc7inJj6x2CysBHWHLw=; b=nxTWyNQeLvVgGLaOJIWoWyOZmnYk+aYE9698s7V9kCIp7blWH0zJd5r0GQTXXxjSrkOZk0XKcSqR4MaTHI4NqqMYG73gZaZmaNUvQJ2gA/IgJaFsLfGd3Ca0GsYKU1H4WZ/3lE6vCr49t+ZA8+D4oiuhBOTtt63dGA9JlKLBb8Q= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576849855511631.8678186268129; Fri, 20 Dec 2019 05:50:55 -0800 (PST) Received: from localhost ([::1]:56150 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIgA-0008GB-7w for importer@patchew.org; Fri, 20 Dec 2019 08:50:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57756) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIc8-0002oI-F3 for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:46:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiIc7-0005hp-2d for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:46:44 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:24334 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 1iiIc6-0005dk-Sh for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:46:42 -0500 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-228-Uay24QYPMzibKBKl2JUmHw-1; Fri, 20 Dec 2019 08:46:39 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DD9AF109D368; Fri, 20 Dec 2019 13:46:38 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2A80926FB3; Fri, 20 Dec 2019 13:46:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576849602; 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=BRFY1VkkPB2r+9GUFBRiM+ygTc7inJj6x2CysBHWHLw=; b=dtdnZgjPK07lym2trUFBEYUwSWMwyJux3SYJsmOpkO4F4T2EgfJYAxuNDJGPc0Ppnnl8sF 45qgxDwegPrxtdr1evVAiHIeYB/nC9AQ5NlZai523YWb1ypcNpcemuOClToywI9YmjEBGt igQ87x5Q5sUI7SYlNNTGSkn0yzYTKMI= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH v5 04/37] chardev: generate an internal id when none given Date: Fri, 20 Dec 2019 17:45:28 +0400 Message-Id: <20191220134601.571905-5-marcandre.lureau@redhat.com> In-Reply-To: <20191220134601.571905-1-marcandre.lureau@redhat.com> References: <20191220134601.571905-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: Uay24QYPMzibKBKl2JUmHw-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: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Internally, qemu may create chardev without ID. Those will not be looked up with qemu_chr_find(), which prevents using qdev_prop_set_chr(). Use id_generate(), to generate an internal name (prefixed with #), so no conflict exist with user-named chardev. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: xiaoqiang zhao --- chardev/char.c | 32 ++++++++++++++++++++++++-------- include/qemu/id.h | 1 + util/id.c | 1 + 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/chardev/char.c b/chardev/char.c index 7b6b2cb123..e7e7492b0e 100644 --- a/chardev/char.c +++ b/chardev/char.c @@ -37,6 +37,7 @@ #include "qemu/help_option.h" #include "qemu/module.h" #include "qemu/option.h" +#include "qemu/id.h" =20 #include "chardev/char-mux.h" =20 @@ -944,10 +945,10 @@ void qemu_chr_set_feature(Chardev *chr, return set_bit(feature, chr->features); } =20 -Chardev *qemu_chardev_new(const char *id, const char *typename, - ChardevBackend *backend, - GMainContext *gcontext, - Error **errp) +static Chardev *chardev_new(const char *id, const char *typename, + ChardevBackend *backend, + GMainContext *gcontext, + Error **errp) { Object *obj; Chardev *chr =3D NULL; @@ -991,6 +992,21 @@ end: return chr; } =20 +Chardev *qemu_chardev_new(const char *id, const char *typename, + ChardevBackend *backend, + GMainContext *gcontext, + Error **errp) +{ + g_autofree char *genid =3D NULL; + + if (!id) { + genid =3D id_generate(ID_CHR); + id =3D genid; + } + + return chardev_new(id, typename, backend, gcontext, errp); +} + ChardevReturn *qmp_chardev_add(const char *id, ChardevBackend *backend, Error **errp) { @@ -1003,8 +1019,8 @@ ChardevReturn *qmp_chardev_add(const char *id, Charde= vBackend *backend, return NULL; } =20 - chr =3D qemu_chardev_new(id, object_class_get_name(OBJECT_CLASS(cc)), - backend, NULL, errp); + chr =3D chardev_new(id, object_class_get_name(OBJECT_CLASS(cc)), + backend, NULL, errp); if (!chr) { return NULL; } @@ -1061,8 +1077,8 @@ ChardevReturn *qmp_chardev_change(const char *id, Cha= rdevBackend *backend, return NULL; } =20 - chr_new =3D qemu_chardev_new(NULL, object_class_get_name(OBJECT_CLASS(= cc)), - backend, chr->gcontext, errp); + chr_new =3D chardev_new(NULL, object_class_get_name(OBJECT_CLASS(cc)), + backend, chr->gcontext, errp); if (!chr_new) { return NULL; } diff --git a/include/qemu/id.h b/include/qemu/id.h index 40c70103e4..b55c406e69 100644 --- a/include/qemu/id.h +++ b/include/qemu/id.h @@ -4,6 +4,7 @@ typedef enum IdSubSystems { ID_QDEV, ID_BLOCK, + ID_CHR, ID_MAX /* last element, used as array size */ } IdSubSystems; =20 diff --git a/util/id.c b/util/id.c index af1c5f1b81..5addb4460e 100644 --- a/util/id.c +++ b/util/id.c @@ -34,6 +34,7 @@ bool id_wellformed(const char *id) static const char *const id_subsys_str[ID_MAX] =3D { [ID_QDEV] =3D "qdev", [ID_BLOCK] =3D "block", + [ID_CHR] =3D "chr", }; =20 /* --=20 2.24.0.308.g228f53135a From nobody Thu May 2 22:13:26 2024 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576849997; cv=none; d=zohomail.com; s=zohoarc; b=mgPw6Wztf7qAw+KAc4nxbZ74+c95q8cbs0+S/Eg1ad/wYoIs2umypyBFD4c/MDs2OwbK5L5urJsoCq/Y7SStR06dCD32grPOMGOJ63DzAf+OR6KuVTQ8c1QQjpvegJN5leRhqblfpxssPPqpeoq6WQ7MzBFSAB0+LEwvapyXwMo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576849997; 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=VBZVozOGLmhK3L4aUpldUk74QqpmWSp6rMd22Q/SOA0=; b=Log7QMXWUKmLbdPCRRDk19757F69infrZO/PIxiIHvyTeUcLGWvork0BC3l+rMiNTm5kAAKN6YGekptlTMBlRi4Ky4ZsjdOOCLW5GsJiGHoWWIxHHh09uVnS1eFaVJqe1/rp0reuALcEiyPcnsWwDifTvgms+bmgXTLVJ1YzbzA= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576849997094258.6094979812026; Fri, 20 Dec 2019 05:53:17 -0800 (PST) Received: from localhost ([::1]:56218 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIiR-0004fI-I7 for importer@patchew.org; Fri, 20 Dec 2019 08:53:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59614) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIcJ-00036g-3e for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:46:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiIcH-0006WX-UB for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:46:54 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:40478 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iiIcH-0006U1-LO for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:46:53 -0500 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-261-Ws4jhbqYMvSgsBQzjflWoQ-1; Fri, 20 Dec 2019 08:46:49 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C176BDBFD; Fri, 20 Dec 2019 13:46:48 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id F2ABE26FB3; Fri, 20 Dec 2019 13:46:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576849613; 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=VBZVozOGLmhK3L4aUpldUk74QqpmWSp6rMd22Q/SOA0=; b=CUcE5I4uZYWAgYn8vZmJ1Y5XqYwwQqGgA/bt3DM3dyu6XZ+Eb/LaeDX2GuPjDYVmNnJEX+ bzOu8gicSexnDUQQMXkDaexNly/3Fb8ld+sNhP2KOE0TVULqZnV6bPZqHitYF17PK0tBpk IXBLPzp85kqB8xAdr/SJbWVUH1/mXLk= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH v5 05/37] serial-pci-multi: factor out multi_serial_get_port_count() Date: Fri, 20 Dec 2019 17:45:29 +0400 Message-Id: <20191220134601.571905-6-marcandre.lureau@redhat.com> In-Reply-To: <20191220134601.571905-1-marcandre.lureau@redhat.com> References: <20191220134601.571905-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: Ws4jhbqYMvSgsBQzjflWoQ-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: 207.211.31.120 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: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Common function to be reused in next patch. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/char/serial-pci-multi.c | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/hw/char/serial-pci-multi.c b/hw/char/serial-pci-multi.c index 5f13b5663b..5c553c30d0 100644 --- a/hw/char/serial-pci-multi.c +++ b/hw/char/serial-pci-multi.c @@ -77,33 +77,34 @@ static void multi_serial_irq_mux(void *opaque, int n, i= nt level) pci_set_irq(&pci->dev, pending); } =20 +static size_t multi_serial_get_port_count(PCIDeviceClass *pc) +{ + switch (pc->device_id) { + case 0x0003: + return 2; + case 0x0004: + return 4; + } + + g_assert_not_reached(); +} + + static void multi_serial_pci_realize(PCIDevice *dev, Error **errp) { PCIDeviceClass *pc =3D PCI_DEVICE_GET_CLASS(dev); PCIMultiSerialState *pci =3D DO_UPCAST(PCIMultiSerialState, dev, dev); SerialState *s; Error *err =3D NULL; - int i, nr_ports =3D 0; - - switch (pc->device_id) { - case 0x0003: - nr_ports =3D 2; - break; - case 0x0004: - nr_ports =3D 4; - break; - } - assert(nr_ports > 0); - assert(nr_ports <=3D PCI_SERIAL_MAX_PORTS); + size_t i, nports =3D multi_serial_get_port_count(pc); =20 pci->dev.config[PCI_CLASS_PROG] =3D pci->prog_if; pci->dev.config[PCI_INTERRUPT_PIN] =3D 0x01; - memory_region_init(&pci->iobar, OBJECT(pci), "multiserial", 8 * nr_por= ts); + memory_region_init(&pci->iobar, OBJECT(pci), "multiserial", 8 * nports= ); pci_register_bar(&pci->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &pci->iobar); - pci->irqs =3D qemu_allocate_irqs(multi_serial_irq_mux, pci, - nr_ports); + pci->irqs =3D qemu_allocate_irqs(multi_serial_irq_mux, pci, nports); =20 - for (i =3D 0; i < nr_ports; i++) { + for (i =3D 0; i < nports; i++) { s =3D pci->state + i; s->baudbase =3D 115200; serial_realize_core(s, &err); @@ -113,7 +114,7 @@ static void multi_serial_pci_realize(PCIDevice *dev, Er= ror **errp) return; } s->irq =3D pci->irqs[i]; - pci->name[i] =3D g_strdup_printf("uart #%d", i + 1); + pci->name[i] =3D g_strdup_printf("uart #%zu", i + 1); memory_region_init_io(&s->io, OBJECT(pci), &serial_io_ops, s, pci->name[i], 8); memory_region_add_subregion(&pci->iobar, 8 * i, &s->io); --=20 2.24.0.308.g228f53135a From nobody Thu May 2 22:13:26 2024 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576849748; cv=none; d=zohomail.com; s=zohoarc; b=Xo3S13eo+4Pf2qKvuZwVgSMHf6lY+37d1uSRJL9JmnOq7+75mnanxsPs+KNLa7/vYEF6sFNRapZvSFlg6ZgffVMoLaHSqtyNBPWd4t4tGmGizvoV+CbLh1kak1XyIoCgiFz81+tzXEZPtt7jx2VLOB1vAEI34/we/42USPnVi0c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576849748; 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=QMYnJ1ggGC0fj9dkgXzHaqJtWTkISsuDb4wEGUvvKzQ=; b=IfmBguwHPVFp4ssosHjsBpO424aT6Ks6iuXFvkHpLT10ZsqIe+LJdfQ2V4dgqJug4+oGM8232xXjfOWad1/BWwH6Pd3953ydefmgH9BC9hKhaze/my770f+7R1jTgv5OdqmZQ57Nm9BRoImHombzbtgbou9PBrxIIKeyG6w+yRY= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576849748948688.4365142539436; Fri, 20 Dec 2019 05:49:08 -0800 (PST) Received: from localhost ([::1]:56106 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIeR-0005Cf-Kk for importer@patchew.org; Fri, 20 Dec 2019 08:49:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59892) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIcY-0003Ed-KA for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:47:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiIcV-0006j3-4N for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:47:10 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:32232 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 1iiIcP-0006fz-BP for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:47:01 -0500 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-299-IEJMgnUnMIGLaCy4a9tFhw-1; Fri, 20 Dec 2019 08:46:58 -0500 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 7C521801E6C; Fri, 20 Dec 2019 13:46:57 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7C5D25DA32; Fri, 20 Dec 2019 13:46:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576849619; 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=QMYnJ1ggGC0fj9dkgXzHaqJtWTkISsuDb4wEGUvvKzQ=; b=FfsY2Vd0naBlmWqcIKehst/uXN0hFzrVXNjbrG88ZU0oDUFNFmvL8f8LLczSNrqykfCUgC 3OSSWhLwS7DnqOGF4LtCulHamEl2L7hFp9PfFfCeW2E+Db+t0QD3akrfaw8/itySmLB0io 88WEQql9eZYZ5+U0E1MChRQoWbqeN/U= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH v5 06/37] serial: initial qom-ification Date: Fri, 20 Dec 2019 17:45:30 +0400 Message-Id: <20191220134601.571905-7-marcandre.lureau@redhat.com> In-Reply-To: <20191220134601.571905-1-marcandre.lureau@redhat.com> References: <20191220134601.571905-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: IEJMgnUnMIGLaCy4a9tFhw-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: 207.211.31.81 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: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Make SerialState a device (the following patches will introduce IO/MM sysbus serial devices) None of the serial_{,mm}_init() callers actually free the returned value (even if they did, it would be quite harmless), so we can change the object allocation at will. However, the devices that embed SerialState must now have their field QOM-initialized manually (isa, pci, pci-multi). Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Peter Maydell --- hw/char/serial-isa.c | 9 +++++++++ hw/char/serial-pci-multi.c | 15 +++++++++++++++ hw/char/serial-pci.c | 13 ++++++++++++- hw/char/serial.c | 34 ++++++++++++++++++++++++++++------ include/hw/char/serial.h | 7 ++++++- 5 files changed, 70 insertions(+), 8 deletions(-) diff --git a/hw/char/serial-isa.c b/hw/char/serial-isa.c index 9e31c51bb6..9a5928b3ee 100644 --- a/hw/char/serial-isa.c +++ b/hw/char/serial-isa.c @@ -111,10 +111,19 @@ static void serial_isa_class_initfn(ObjectClass *klas= s, void *data) set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } =20 +static void serial_isa_initfn(Object *o) +{ + ISASerialState *self =3D ISA_SERIAL(o); + + object_initialize_child(o, "serial", &self->state, sizeof(self->state), + TYPE_SERIAL, &error_abort, NULL); +} + static const TypeInfo serial_isa_info =3D { .name =3D TYPE_ISA_SERIAL, .parent =3D TYPE_ISA_DEVICE, .instance_size =3D sizeof(ISASerialState), + .instance_init =3D serial_isa_initfn, .class_init =3D serial_isa_class_initfn, }; =20 diff --git a/hw/char/serial-pci-multi.c b/hw/char/serial-pci-multi.c index 5c553c30d0..edfbfdca9e 100644 --- a/hw/char/serial-pci-multi.c +++ b/hw/char/serial-pci-multi.c @@ -181,10 +181,24 @@ static void multi_4x_serial_pci_class_initfn(ObjectCl= ass *klass, void *data) set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } =20 +static void multi_serial_init(Object *o) +{ + PCIDevice *dev =3D PCI_DEVICE(o); + PCIMultiSerialState *pms =3D DO_UPCAST(PCIMultiSerialState, dev, dev); + size_t i, nports =3D multi_serial_get_port_count(PCI_DEVICE_GET_CLASS(= dev)); + + for (i =3D 0; i < nports; i++) { + object_initialize_child(o, "serial[*]", &pms->state[i], + sizeof(pms->state[i]), + TYPE_SERIAL, &error_abort, NULL); + } +} + static const TypeInfo multi_2x_serial_pci_info =3D { .name =3D "pci-serial-2x", .parent =3D TYPE_PCI_DEVICE, .instance_size =3D sizeof(PCIMultiSerialState), + .instance_init =3D multi_serial_init, .class_init =3D multi_2x_serial_pci_class_initfn, .interfaces =3D (InterfaceInfo[]) { { INTERFACE_CONVENTIONAL_PCI_DEVICE }, @@ -196,6 +210,7 @@ static const TypeInfo multi_4x_serial_pci_info =3D { .name =3D "pci-serial-4x", .parent =3D TYPE_PCI_DEVICE, .instance_size =3D sizeof(PCIMultiSerialState), + .instance_init =3D multi_serial_init, .class_init =3D multi_4x_serial_pci_class_initfn, .interfaces =3D (InterfaceInfo[]) { { INTERFACE_CONVENTIONAL_PCI_DEVICE }, diff --git a/hw/char/serial-pci.c b/hw/char/serial-pci.c index cb9b76e22b..f99b6c19e0 100644 --- a/hw/char/serial-pci.c +++ b/hw/char/serial-pci.c @@ -40,6 +40,8 @@ typedef struct PCISerialState { uint8_t prog_if; } PCISerialState; =20 +#define TYPE_PCI_SERIAL "pci-serial" +#define PCI_SERIAL(s) OBJECT_CHECK(PCISerialState, (s), TYPE_PCI_SERIAL) =20 static void serial_pci_realize(PCIDevice *dev, Error **errp) { @@ -103,10 +105,19 @@ static void serial_pci_class_initfn(ObjectClass *klas= s, void *data) set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } =20 +static void serial_pci_init(Object *o) +{ + PCISerialState *ps =3D PCI_SERIAL(o); + + object_initialize_child(o, "serial", &ps->state, sizeof(ps->state), + TYPE_SERIAL, &error_abort, NULL); +} + static const TypeInfo serial_pci_info =3D { - .name =3D "pci-serial", + .name =3D TYPE_PCI_SERIAL, .parent =3D TYPE_PCI_DEVICE, .instance_size =3D sizeof(PCISerialState), + .instance_init =3D serial_pci_init, .class_init =3D serial_pci_class_initfn, .interfaces =3D (InterfaceInfo[]) { { INTERFACE_CONVENTIONAL_PCI_DEVICE }, diff --git a/hw/char/serial.c b/hw/char/serial.c index b4aa250950..233a9e2076 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -983,9 +983,8 @@ const MemoryRegionOps serial_io_ops =3D { SerialState *serial_init(int base, qemu_irq irq, int baudbase, Chardev *chr, MemoryRegion *system_io) { - SerialState *s; - - s =3D g_malloc0(sizeof(SerialState)); + DeviceState *dev =3D DEVICE(object_new(TYPE_SERIAL)); + SerialState *s =3D SERIAL(dev); =20 s->irq =3D irq; s->baudbase =3D baudbase; @@ -993,6 +992,7 @@ SerialState *serial_init(int base, qemu_irq irq, int ba= udbase, serial_realize_core(s, &error_fatal); =20 vmstate_register(NULL, base, &vmstate_serial, s); + qdev_init_nofail(dev); =20 memory_region_init_io(&s->io, NULL, &serial_io_ops, s, "serial", 8); memory_region_add_subregion(system_io, base, &s->io); @@ -1000,6 +1000,21 @@ SerialState *serial_init(int base, qemu_irq irq, int= baudbase, return s; } =20 +static void serial_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + + /* internal device for serialio/serialmm, not user-creatable */ + dc->user_creatable =3D false; +} + +static const TypeInfo serial_info =3D { + .name =3D TYPE_SERIAL, + .parent =3D TYPE_DEVICE, + .instance_size =3D sizeof(SerialState), + .class_init =3D serial_class_init, +}; + /* Memory mapped interface */ static uint64_t serial_mm_read(void *opaque, hwaddr addr, unsigned size) @@ -1045,9 +1060,8 @@ SerialState *serial_mm_init(MemoryRegion *address_spa= ce, qemu_irq irq, int baudbase, Chardev *chr, enum device_endian end) { - SerialState *s; - - s =3D g_malloc0(sizeof(SerialState)); + DeviceState *dev =3D DEVICE(object_new(TYPE_SERIAL)); + SerialState *s =3D SERIAL(dev); =20 s->it_shift =3D it_shift; s->irq =3D irq; @@ -1056,9 +1070,17 @@ SerialState *serial_mm_init(MemoryRegion *address_sp= ace, =20 serial_realize_core(s, &error_fatal); vmstate_register(NULL, base, &vmstate_serial, s); + qdev_init_nofail(dev); =20 memory_region_init_io(&s->io, NULL, &serial_mm_ops[end], s, "serial", 8 << it_shift); memory_region_add_subregion(address_space, base, &s->io); return s; } + +static void serial_register_types(void) +{ + type_register_static(&serial_info); +} + +type_init(serial_register_types) diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h index 8be3d8a4f9..180cc7c24e 100644 --- a/include/hw/char/serial.h +++ b/include/hw/char/serial.h @@ -30,10 +30,13 @@ #include "exec/memory.h" #include "qemu/fifo8.h" #include "chardev/char.h" +#include "hw/sysbus.h" =20 #define UART_FIFO_LENGTH 16 /* 16550A Fifo Length */ =20 typedef struct SerialState { + DeviceState parent; + uint16_t divider; uint8_t rbr; /* receive register */ uint8_t thr; /* transmit holding register */ @@ -84,7 +87,9 @@ void serial_realize_core(SerialState *s, Error **errp); void serial_exit_core(SerialState *s); void serial_set_frequency(SerialState *s, uint32_t frequency); =20 -/* legacy pre qom */ +#define TYPE_SERIAL "serial" +#define SERIAL(s) OBJECT_CHECK(SerialState, (s), TYPE_SERIAL) + SerialState *serial_init(int base, qemu_irq irq, int baudbase, Chardev *chr, MemoryRegion *system_io); SerialState *serial_mm_init(MemoryRegion *address_space, --=20 2.24.0.308.g228f53135a From nobody Thu May 2 22:13:26 2024 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576850144; cv=none; d=zohomail.com; s=zohoarc; b=ghf9CsRRUY/dUMefdgxRJM5tejneUB4Ix7n4Vlv3xhX6anwVwJJdqFC8h9+UDsRlQAUbLgO7xy/diBbBKYKmTwpgwfKbjpgRvBRlgbA2RAxPLqlGiK8WSpYhffPONy/hh5nby81qFc+e6G/ohXv56/a1g0B0xAVYI/OhQuSL6ss= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576850144; 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=9PQoHRH13/SC8yXSoSVhEmwn/sgJvGoh4IdGtcXaSlA=; b=k7+bYONehXUDCkSFesCNmmHXby5LehKboDuHEbX+IvoQ8whcO2TdHECdInMYB1fZLPnmZAM66abc2Az5kbzdeRulwi6k0W0bHUWxPBvXAoVZL9C+EGsaMO6l0kwcXdH0svN10b+kPoKqVMN211wL+np0/RR0OIMGvNIfZqZmskA= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576850144459683.103746938747; Fri, 20 Dec 2019 05:55:44 -0800 (PST) Received: from localhost ([::1]:56256 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIko-0000Aa-Vr for importer@patchew.org; Fri, 20 Dec 2019 08:55:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60101) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIca-0003I4-CG for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:47:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiIcY-0006lg-Qt for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:47:12 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:54727 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 1iiIcY-0006kM-IT for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:47:10 -0500 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-287-NVhIv37BMFOgVIoBsG0N6g-1; Fri, 20 Dec 2019 08:47:07 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D225E107ACE6; Fri, 20 Dec 2019 13:47:06 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id D0FB46046B; Fri, 20 Dec 2019 13:47:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576849629; 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=9PQoHRH13/SC8yXSoSVhEmwn/sgJvGoh4IdGtcXaSlA=; b=hJp/a5tUmeJPSRUAi0XZMmiisK7zVrFz6RyVlH6QYCvWPBlL8WLjaUDTbpKZruoA0ck1aq Nk+PbrRwNywcgTjiHm2rwu7j87PGZ6XxUeue1FU8avpL8AmGCaWqI3OrQojEyv3IiW854Y AQSQGS3WuKPnXm9xviUn2eRdMQfB0LI= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH v5 07/37] serial: register vmsd with DeviceClass Date: Fri, 20 Dec 2019 17:45:31 +0400 Message-Id: <20191220134601.571905-8-marcandre.lureau@redhat.com> In-Reply-To: <20191220134601.571905-1-marcandre.lureau@redhat.com> References: <20191220134601.571905-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: NVhIv37BMFOgVIoBsG0N6g-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: 207.211.31.81 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: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Migration from old to new code works, however the other way fails for devices that use serial_init/serial_mm_init with "base", used as instance_id previously. (with qdev_set_legacy_instance_id, the alias_id is only used in savevm.c:find_se(), and thus can only be used to match against "legacy" instance id values. On new code, instance_id is generated incrementally from 0 with calculate_new_instance_id(), based on "qdev-path/vmsd-name") Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: xiaoqiang zhao --- hw/char/serial.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/char/serial.c b/hw/char/serial.c index 233a9e2076..e926845843 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -990,8 +990,7 @@ SerialState *serial_init(int base, qemu_irq irq, int ba= udbase, s->baudbase =3D baudbase; qemu_chr_fe_init(&s->chr, chr, &error_abort); serial_realize_core(s, &error_fatal); - - vmstate_register(NULL, base, &vmstate_serial, s); + qdev_set_legacy_instance_id(dev, base, 2); qdev_init_nofail(dev); =20 memory_region_init_io(&s->io, NULL, &serial_io_ops, s, "serial", 8); @@ -1006,6 +1005,7 @@ static void serial_class_init(ObjectClass *klass, voi= d *data) =20 /* internal device for serialio/serialmm, not user-creatable */ dc->user_creatable =3D false; + dc->vmsd =3D &vmstate_serial; } =20 static const TypeInfo serial_info =3D { @@ -1069,7 +1069,7 @@ SerialState *serial_mm_init(MemoryRegion *address_spa= ce, qemu_chr_fe_init(&s->chr, chr, &error_abort); =20 serial_realize_core(s, &error_fatal); - vmstate_register(NULL, base, &vmstate_serial, s); + qdev_set_legacy_instance_id(dev, base, 2); qdev_init_nofail(dev); =20 memory_region_init_io(&s->io, NULL, &serial_mm_ops[end], s, --=20 2.24.0.308.g228f53135a From nobody Thu May 2 22:13:26 2024 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576849875; cv=none; d=zohomail.com; s=zohoarc; b=GVPzE+eZiBZfitrdOAhlPDA/3i6e5SQS6ZjONB7/Wi1ZrvBRnPmftDxjjiLaWiXg7SKI1qYghY0bg0sIW+M4EBt1nGpGaj7JXmUT542hquYCxPP8/FMx82fhFOZ+t6GamDnibQpawRRWZUlyoruCir9pmXyhiJSCSJovvOv4+E0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576849875; 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=gyyWvGR+GvvHu/sbP3P/QKLAAOlLdjfRxOC3rmC7Nwo=; b=EqofUyyZYmKZSfxBLlIvA5+ZCb+UnmIGuKp/nG1UBe9pWUlGoKJ/Km8mhQwHz80Lc14BQg8e01Un3tCydyGeiqgy2aIeaVl7F/gXqkE0P61LvIUE+OByjZuquvGMOAl9MqvvM0P/V5XgDLZNR6+6NPubCpJZGx1VO2b+hFg0lzI= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576849875411687.9479607214624; Fri, 20 Dec 2019 05:51:15 -0800 (PST) Received: from localhost ([::1]:56162 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIgU-0000ff-5Z for importer@patchew.org; Fri, 20 Dec 2019 08:51:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33736) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIcl-0003Xg-6z for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:47:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiIcj-0007Xb-TQ for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:47:22 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:27269 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 1iiIcj-0007Ul-Hf for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:47:21 -0500 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-388-h4LYw3HtOm6zJ9BvKy1p2A-1; Fri, 20 Dec 2019 08:47:17 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B8F46802B8D; Fri, 20 Dec 2019 13:47:16 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id A6BCF1A8E4; Fri, 20 Dec 2019 13:47:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576849641; 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=gyyWvGR+GvvHu/sbP3P/QKLAAOlLdjfRxOC3rmC7Nwo=; b=a/71wrXM+xG6lT+ao6YPdsHdZVhxtaPjxREnMy3lhZQ5S3XPNBwvKUCPJdjcy2jR9pmOeU sW4J39pN+081QbuouMlPL44L1XONd2j79lZmO+mKTD0w33pZTIzwi1mmyegXC5yJm5yJmL 3zbNSsO5qfqPhdHbh0xblsFJOVOXOFw= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH v5 08/37] serial: add "chardev" property Date: Fri, 20 Dec 2019 17:45:32 +0400 Message-Id: <20191220134601.571905-9-marcandre.lureau@redhat.com> In-Reply-To: <20191220134601.571905-1-marcandre.lureau@redhat.com> References: <20191220134601.571905-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: h4LYw3HtOm6zJ9BvKy1p2A-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: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This is more QOM-friendly, callers may set/get the property themself. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Peter Maydell --- hw/char/serial.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/hw/char/serial.c b/hw/char/serial.c index e926845843..1746dbc1c4 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -34,6 +34,7 @@ #include "sysemu/runstate.h" #include "qemu/error-report.h" #include "trace.h" +#include "hw/qdev-properties.h" =20 //#define DEBUG_SERIAL =20 @@ -988,7 +989,7 @@ SerialState *serial_init(int base, qemu_irq irq, int ba= udbase, =20 s->irq =3D irq; s->baudbase =3D baudbase; - qemu_chr_fe_init(&s->chr, chr, &error_abort); + qdev_prop_set_chr(dev, "chardev", chr); serial_realize_core(s, &error_fatal); qdev_set_legacy_instance_id(dev, base, 2); qdev_init_nofail(dev); @@ -999,13 +1000,19 @@ SerialState *serial_init(int base, qemu_irq irq, int= baudbase, return s; } =20 -static void serial_class_init(ObjectClass *klass, void *data) +static Property serial_properties[] =3D { + DEFINE_PROP_CHR("chardev", SerialState, chr), + DEFINE_PROP_END_OF_LIST(), +}; + +static void serial_class_init(ObjectClass *klass, void* data) { DeviceClass *dc =3D DEVICE_CLASS(klass); =20 /* internal device for serialio/serialmm, not user-creatable */ dc->user_creatable =3D false; dc->vmsd =3D &vmstate_serial; + dc->props =3D serial_properties; } =20 static const TypeInfo serial_info =3D { @@ -1066,7 +1073,7 @@ SerialState *serial_mm_init(MemoryRegion *address_spa= ce, s->it_shift =3D it_shift; s->irq =3D irq; s->baudbase =3D baudbase; - qemu_chr_fe_init(&s->chr, chr, &error_abort); + qdev_prop_set_chr(dev, "chardev", chr); =20 serial_realize_core(s, &error_fatal); qdev_set_legacy_instance_id(dev, base, 2); --=20 2.24.0.308.g228f53135a From nobody Thu May 2 22:13:26 2024 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576849906; cv=none; d=zohomail.com; s=zohoarc; b=ZTKDX+KXBKiXd8RRievZu0XbYNRqb/Xz20DvMLMnuNXchJSJyw/7Z9AbLmS4QsLWIWgerjISL5bD5Mx7wIHRJtW1UeKe66N/PBDxy5XVwFYHmN9sw9MEir69mULWUCVdsdLRq5KxUySdvoOI0Z5Q6AQrXXmzH6ZoENeDxBQoVe4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576849906; 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=KWApD+MoVfizB1m2oIgeNnBtB1RvoZDLcn0Ssg0XEfE=; b=RlII+PwmHVp0gHw8eh7U0ElCsdzH/0NIh89M+4mmDF2CTXtEKqmMsWCUqDohncTQ+Me0AI+k3I3g8nZk3hQpXCRuuDoklgfpNOI8lLpnVYN1oOQPYlOH1LyhdH1v9WDhtMSy0RKh1rjNoAK9V8YqQinyUeP5D4W5+eSW++fmzw8= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576849906992624.6952376154773; Fri, 20 Dec 2019 05:51:46 -0800 (PST) Received: from localhost ([::1]:56174 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIgz-0001UD-Lq for importer@patchew.org; Fri, 20 Dec 2019 08:51:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35011) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIcs-0003iE-Iu for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:47:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiIcr-00081O-19 for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:47:30 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:32506 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 1iiIcq-0007z8-OD for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:47:28 -0500 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-278-ZhTXS8L1P7a5KUkEJnmPUA-1; Fri, 20 Dec 2019 08:47:26 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CD10F8059AE; Fri, 20 Dec 2019 13:47:25 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 627296046B; Fri, 20 Dec 2019 13:47:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576849648; 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=KWApD+MoVfizB1m2oIgeNnBtB1RvoZDLcn0Ssg0XEfE=; b=CxXXaPyUh8mC5oZTLsFDBw/JzB0MbmN5vkE3CgfkSyXeHnHcRzxELeet4KJFs9OOAdVK+X Wb8p334YUU6x9Yhp32Zk03m1rI54EUFXrpAHt3IPAhN/fzhs2EDSPA7xZEslZyrATDFNzg SmTBIteMNFG4GhGV2aEd/JOgW6g7nSI= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH v5 09/37] serial: add "baudbase" property Date: Fri, 20 Dec 2019 17:45:33 +0400 Message-Id: <20191220134601.571905-10-marcandre.lureau@redhat.com> In-Reply-To: <20191220134601.571905-1-marcandre.lureau@redhat.com> References: <20191220134601.571905-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: ZhTXS8L1P7a5KUkEJnmPUA-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: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Peter Maydell --- hw/char/serial-isa.c | 1 - hw/char/serial-pci-multi.c | 1 - hw/char/serial-pci.c | 1 - hw/char/serial.c | 5 +++-- include/hw/char/serial.h | 2 +- 5 files changed, 4 insertions(+), 6 deletions(-) diff --git a/hw/char/serial-isa.c b/hw/char/serial-isa.c index 9a5928b3ee..2a4c8de1bf 100644 --- a/hw/char/serial-isa.c +++ b/hw/char/serial-isa.c @@ -73,7 +73,6 @@ static void serial_isa_realizefn(DeviceState *dev, Error = **errp) } index++; =20 - s->baudbase =3D 115200; isa_init_irq(isadev, &s->irq, isa->isairq); serial_realize_core(s, errp); qdev_set_legacy_instance_id(dev, isa->iobase, 3); diff --git a/hw/char/serial-pci-multi.c b/hw/char/serial-pci-multi.c index edfbfdca9e..4891f32230 100644 --- a/hw/char/serial-pci-multi.c +++ b/hw/char/serial-pci-multi.c @@ -106,7 +106,6 @@ static void multi_serial_pci_realize(PCIDevice *dev, Er= ror **errp) =20 for (i =3D 0; i < nports; i++) { s =3D pci->state + i; - s->baudbase =3D 115200; serial_realize_core(s, &err); if (err !=3D NULL) { error_propagate(errp, err); diff --git a/hw/char/serial-pci.c b/hw/char/serial-pci.c index f99b6c19e0..db2c17aafd 100644 --- a/hw/char/serial-pci.c +++ b/hw/char/serial-pci.c @@ -49,7 +49,6 @@ static void serial_pci_realize(PCIDevice *dev, Error **er= rp) SerialState *s =3D &pci->state; Error *err =3D NULL; =20 - s->baudbase =3D 115200; serial_realize_core(s, &err); if (err !=3D NULL) { error_propagate(errp, err); diff --git a/hw/char/serial.c b/hw/char/serial.c index 1746dbc1c4..a4f0566865 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -988,7 +988,7 @@ SerialState *serial_init(int base, qemu_irq irq, int ba= udbase, SerialState *s =3D SERIAL(dev); =20 s->irq =3D irq; - s->baudbase =3D baudbase; + qdev_prop_set_uint32(dev, "baudbase", baudbase); qdev_prop_set_chr(dev, "chardev", chr); serial_realize_core(s, &error_fatal); qdev_set_legacy_instance_id(dev, base, 2); @@ -1002,6 +1002,7 @@ SerialState *serial_init(int base, qemu_irq irq, int = baudbase, =20 static Property serial_properties[] =3D { DEFINE_PROP_CHR("chardev", SerialState, chr), + DEFINE_PROP_UINT32("baudbase", SerialState, baudbase, 115200), DEFINE_PROP_END_OF_LIST(), }; =20 @@ -1072,7 +1073,7 @@ SerialState *serial_mm_init(MemoryRegion *address_spa= ce, =20 s->it_shift =3D it_shift; s->irq =3D irq; - s->baudbase =3D baudbase; + qdev_prop_set_uint32(dev, "baudbase", baudbase); qdev_prop_set_chr(dev, "chardev", chr); =20 serial_realize_core(s, &error_fatal); diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h index 180cc7c24e..3dc618598e 100644 --- a/include/hw/char/serial.h +++ b/include/hw/char/serial.h @@ -58,7 +58,7 @@ typedef struct SerialState { CharBackend chr; int last_break_enable; int it_shift; - int baudbase; + uint32_t baudbase; uint32_t tsr_retry; guint watch_tag; uint32_t wakeup; --=20 2.24.0.308.g228f53135a From nobody Thu May 2 22:13:26 2024 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576850025; cv=none; d=zohomail.com; s=zohoarc; b=jaj0FQucNhhhFUcsSG4ls9jJhPVLWG3xbQaQgEvtJjR/rcyBAq9ZwW2TRfZYHXSn78QmfaF1wiq4CbCdRmL/swJExC80SXFeUc8CKuJG2TqflWul9zpeHhJ9YH/JeBJYRDNyPEybnzjimqcCnFVk7FI5ie4i45phpCvOUCqLFw4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576850025; 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=trohubcB+l/ZA+9i9PZqlz4RM2grBdGpv/nN0C6XYvs=; b=FjvSTPiddoZ+bLdEeaoP/5cxGa7ixAOLyNeqRgiXm2dStmMyGXPS4E3Sk48q7Nv54DAE5ZQBbX8O/ZGFlvw3I8ZH0Iz43xZASuTNlFNOGVM2kjGMMuLfPzjqH1uX89tWJKUA29W7ef94viLlF71WO1V3bYq+G/Msp9+MM+zeEbc= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576850025646521.7067498913143; Fri, 20 Dec 2019 05:53:45 -0800 (PST) Received: from localhost ([::1]:56222 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIit-0005Lc-W9 for importer@patchew.org; Fri, 20 Dec 2019 08:53:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36212) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIcz-0003tC-IJ for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:47:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiIcy-0008W3-5E for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:47:37 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:39664 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 1iiIcx-0008U4-Uq for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:47:36 -0500 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-351-IqVr2KTjM1G7M5YI3NhS-Q-1; Fri, 20 Dec 2019 08:47:34 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 56901800D5C; Fri, 20 Dec 2019 13:47:33 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6687310027AE; Fri, 20 Dec 2019 13:47:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576849655; 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=trohubcB+l/ZA+9i9PZqlz4RM2grBdGpv/nN0C6XYvs=; b=eJkvOG5TDgyYbYTs9wOM6jYzlL94go7zBfpuNzh3HpgcRPBoMdr/kJocSAqRIkkwOBI5W1 lAKXtAMF6SnFkJI/dR+HGKMsPf4EE3i85YCNN29qSTvUhpWPHo9BlTSWDjehi2bywpCUb7 eKFckjKjx8i3vtK+ZyUSbqwH2ybP6GA= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH v5 10/37] serial: realize the serial device Date: Fri, 20 Dec 2019 17:45:34 +0400 Message-Id: <20191220134601.571905-11-marcandre.lureau@redhat.com> In-Reply-To: <20191220134601.571905-1-marcandre.lureau@redhat.com> References: <20191220134601.571905-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: IqVr2KTjM1G7M5YI3NhS-Q-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: 207.211.31.81 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: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Instead of calling serial_realize_core(), use the QDev realize callback. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/char/serial-isa.c | 2 +- hw/char/serial-pci-multi.c | 2 +- hw/char/serial-pci.c | 2 +- hw/char/serial.c | 8 ++++---- include/hw/char/serial.h | 1 - 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/hw/char/serial-isa.c b/hw/char/serial-isa.c index 2a4c8de1bf..db8644551e 100644 --- a/hw/char/serial-isa.c +++ b/hw/char/serial-isa.c @@ -74,7 +74,7 @@ static void serial_isa_realizefn(DeviceState *dev, Error = **errp) index++; =20 isa_init_irq(isadev, &s->irq, isa->isairq); - serial_realize_core(s, errp); + object_property_set_bool(OBJECT(s), true, "realized", errp); qdev_set_legacy_instance_id(dev, isa->iobase, 3); =20 memory_region_init_io(&s->io, OBJECT(isa), &serial_io_ops, s, "serial"= , 8); diff --git a/hw/char/serial-pci-multi.c b/hw/char/serial-pci-multi.c index 4891f32230..0e1fdb75d2 100644 --- a/hw/char/serial-pci-multi.c +++ b/hw/char/serial-pci-multi.c @@ -106,7 +106,7 @@ static void multi_serial_pci_realize(PCIDevice *dev, Er= ror **errp) =20 for (i =3D 0; i < nports; i++) { s =3D pci->state + i; - serial_realize_core(s, &err); + object_property_set_bool(OBJECT(s), true, "realized", &err); if (err !=3D NULL) { error_propagate(errp, err); multi_serial_pci_exit(dev); diff --git a/hw/char/serial-pci.c b/hw/char/serial-pci.c index db2c17aafd..4b6a217365 100644 --- a/hw/char/serial-pci.c +++ b/hw/char/serial-pci.c @@ -49,7 +49,7 @@ static void serial_pci_realize(PCIDevice *dev, Error **er= rp) SerialState *s =3D &pci->state; Error *err =3D NULL; =20 - serial_realize_core(s, &err); + object_property_set_bool(OBJECT(s), true, "realized", &err); if (err !=3D NULL) { error_propagate(errp, err); return; diff --git a/hw/char/serial.c b/hw/char/serial.c index a4f0566865..8328cc62c3 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -934,8 +934,10 @@ static int serial_be_change(void *opaque) return 0; } =20 -void serial_realize_core(SerialState *s, Error **errp) +static void serial_realize(DeviceState *dev, Error **errp) { + SerialState *s =3D SERIAL(dev); + s->modem_status_poll =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, (QEMUTimerCB= *) serial_update_msl, s); =20 s->fifo_timeout_timer =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, (QEMUTimerC= B *) fifo_timeout_int, s); @@ -990,7 +992,6 @@ SerialState *serial_init(int base, qemu_irq irq, int ba= udbase, s->irq =3D irq; qdev_prop_set_uint32(dev, "baudbase", baudbase); qdev_prop_set_chr(dev, "chardev", chr); - serial_realize_core(s, &error_fatal); qdev_set_legacy_instance_id(dev, base, 2); qdev_init_nofail(dev); =20 @@ -1012,6 +1013,7 @@ static void serial_class_init(ObjectClass *klass, voi= d* data) =20 /* internal device for serialio/serialmm, not user-creatable */ dc->user_creatable =3D false; + dc->realize =3D serial_realize; dc->vmsd =3D &vmstate_serial; dc->props =3D serial_properties; } @@ -1075,8 +1077,6 @@ SerialState *serial_mm_init(MemoryRegion *address_spa= ce, s->irq =3D irq; qdev_prop_set_uint32(dev, "baudbase", baudbase); qdev_prop_set_chr(dev, "chardev", chr); - - serial_realize_core(s, &error_fatal); qdev_set_legacy_instance_id(dev, base, 2); qdev_init_nofail(dev); =20 diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h index 3dc618598e..571aab97c8 100644 --- a/include/hw/char/serial.h +++ b/include/hw/char/serial.h @@ -83,7 +83,6 @@ typedef struct SerialState { extern const VMStateDescription vmstate_serial; extern const MemoryRegionOps serial_io_ops; =20 -void serial_realize_core(SerialState *s, Error **errp); void serial_exit_core(SerialState *s); void serial_set_frequency(SerialState *s, uint32_t frequency); =20 --=20 2.24.0.308.g228f53135a From nobody Thu May 2 22:13:26 2024 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576850178; cv=none; d=zohomail.com; s=zohoarc; b=NDohcjz5wSU65RZoaPpxQ+E+VlMdZLDkRInM5B4NGGhjIbEEkzXYKsUPc83fuiO6lV/0c6T69GpYp+Z47plLaPgMCNIQsO8OmiKTGURqaOlx/60wpZSldnsL5biN65IBJ8PZH/y/TzwfYXeia54Q1RM901cJpgXvFYwE2B/Aqvk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576850178; 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=OozN9IdXbzYikbY0vcB6F7rZ/9QvMwXvXxBYIqWfGgc=; b=MSoDHD83o/LJQrSIXsFgPHtYwSdHk5OQEwpM4AJnToGxXpKle4QkfvSjhsAFkaxD+9Mlkfo1P1isFUROcvUr4wJrSbGaaDOZrOgB3L7Ga9MlVaGeA37lLfDqctnTVwyV1f8q+uZxiq/h3Oi3f1GatA1S6hg/zmFLdnvQbzRedEI= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576850178856770.940050297264; Fri, 20 Dec 2019 05:56:18 -0800 (PST) Received: from localhost ([::1]:56270 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIlN-00014b-3W for importer@patchew.org; Fri, 20 Dec 2019 08:56:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37617) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIdC-00048J-9O for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:47:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiIdA-0000gI-Gu for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:47:49 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:34784 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iiIdA-0000em-B9 for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:47:48 -0500 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-149--RUF5h0oMx-I4hYFl1Bipg-1; Fri, 20 Dec 2019 08:47:44 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 363508024D4; Fri, 20 Dec 2019 13:47:43 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id A27A726FC8; Fri, 20 Dec 2019 13:47:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576849666; 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=OozN9IdXbzYikbY0vcB6F7rZ/9QvMwXvXxBYIqWfGgc=; b=ggpTSAtayGBCpXEnPJOhbVFBMbNA0sxtgSfhHT7GGK/2M3gtZ0ohQG8vjz2x5vaIu4h0N5 qOGqmngtpn/fv0yGolp+fqc2/qJMannKwm36ATXkIJhl1EbHH4qqtxrBPDW4OUa0pCYqdA cn8DaxDzrQJ6waYFFmt9YW+1lqPOhGE= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH v5 11/37] serial: replace serial_exit_core() with unrealize Date: Fri, 20 Dec 2019 17:45:35 +0400 Message-Id: <20191220134601.571905-12-marcandre.lureau@redhat.com> In-Reply-To: <20191220134601.571905-1-marcandre.lureau@redhat.com> References: <20191220134601.571905-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: -RUF5h0oMx-I4hYFl1Bipg-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: 207.211.31.120 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: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Instead of calling serial_exit_core() directly, use the QDev unrealize callback. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/char/serial-pci-multi.c | 2 +- hw/char/serial-pci.c | 2 +- hw/char/serial.c | 5 ++++- include/hw/char/serial.h | 1 - 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/char/serial-pci-multi.c b/hw/char/serial-pci-multi.c index 0e1fdb75d2..e343a1235c 100644 --- a/hw/char/serial-pci-multi.c +++ b/hw/char/serial-pci-multi.c @@ -56,7 +56,7 @@ static void multi_serial_pci_exit(PCIDevice *dev) =20 for (i =3D 0; i < pci->ports; i++) { s =3D pci->state + i; - serial_exit_core(s); + object_property_set_bool(OBJECT(s), false, "realized", NULL); memory_region_del_subregion(&pci->iobar, &s->io); g_free(pci->name[i]); } diff --git a/hw/char/serial-pci.c b/hw/char/serial-pci.c index 4b6a217365..b6a73c65a9 100644 --- a/hw/char/serial-pci.c +++ b/hw/char/serial-pci.c @@ -68,7 +68,7 @@ static void serial_pci_exit(PCIDevice *dev) PCISerialState *pci =3D DO_UPCAST(PCISerialState, dev, dev); SerialState *s =3D &pci->state; =20 - serial_exit_core(s); + object_property_set_bool(OBJECT(s), false, "realized", NULL); qemu_free_irq(s->irq); } =20 diff --git a/hw/char/serial.c b/hw/char/serial.c index 8328cc62c3..ec388f3876 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -950,8 +950,10 @@ static void serial_realize(DeviceState *dev, Error **e= rrp) serial_reset(s); } =20 -void serial_exit_core(SerialState *s) +static void serial_unrealize(DeviceState *dev, Error **errp) { + SerialState *s =3D SERIAL(dev); + qemu_chr_fe_deinit(&s->chr, false); =20 timer_del(s->modem_status_poll); @@ -1014,6 +1016,7 @@ static void serial_class_init(ObjectClass *klass, voi= d* data) /* internal device for serialio/serialmm, not user-creatable */ dc->user_creatable =3D false; dc->realize =3D serial_realize; + dc->unrealize =3D serial_unrealize; dc->vmsd =3D &vmstate_serial; dc->props =3D serial_properties; } diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h index 571aab97c8..548944b06a 100644 --- a/include/hw/char/serial.h +++ b/include/hw/char/serial.h @@ -83,7 +83,6 @@ typedef struct SerialState { extern const VMStateDescription vmstate_serial; extern const MemoryRegionOps serial_io_ops; =20 -void serial_exit_core(SerialState *s); void serial_set_frequency(SerialState *s, uint32_t frequency); =20 #define TYPE_SERIAL "serial" --=20 2.24.0.308.g228f53135a From nobody Thu May 2 22:13:26 2024 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576850320; cv=none; d=zohomail.com; s=zohoarc; b=Q1wbEho9NEwsNbza+40Hb9ofJ1tbhw/2FDaa8rf9GpcYZbcYKEomN92qrk6Np4AXtca28s7Et4nvlJNr6oqE+D9ZkjVtq1XJvH/MT6kfh9ee5mbQEVaKBrLYxoSf2B0ktM8WfFxRcyD2VZiYIFHaPBH1ojGUpPj+te57uwDSNCM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576850320; 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=DHoS7ObTMLtGDuS1N2UqzH92+MIYX+mn6YjT3hnC5aY=; b=F/lHXN+vKKTUBQ8Yu9hbfKSm6RIIOWRRl2LAC0F9c8tugR5+TPzgLZWPo1HTazFO22anvfVsLeBWLU0jlm/d+3X/pHfbGuCztud4b3pc9Sc4S5kOthYKBMIzelXJRySEUC+p3k+qNCSnLhPfTZr8cuRaAYD9cEFmrx1183grRg0= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576850320310820.5902422811628; Fri, 20 Dec 2019 05:58:40 -0800 (PST) Received: from localhost ([::1]:56298 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIne-0004dr-VS for importer@patchew.org; Fri, 20 Dec 2019 08:58:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38433) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIdO-0004Lp-Fl for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:48:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiIdM-0000x6-OU for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:48:02 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:27618 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iiIdM-0000uj-Fb for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:48:00 -0500 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-240-rX_9fkdkNKWIV40dA5yqoA-1; Fri, 20 Dec 2019 08:47:56 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5ADBC8045F6; Fri, 20 Dec 2019 13:47:55 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 939E16B56A; Fri, 20 Dec 2019 13:47:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576849679; 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=DHoS7ObTMLtGDuS1N2UqzH92+MIYX+mn6YjT3hnC5aY=; b=hURpOdfVZxyAD8qpMK4+vz2+LQ9PtvGlWKfMmAPYsq+nd5yhMkAS9lPNiasOR92MBods+v ljyvoqqeksT+uLmRPPQJ0D8k3NoTLG6trdtS2+E4QVO0atexq5F9ZzELBYmZ6fMYlLRZtu 2VmHOq3zn8umY+fbCxRAFrMCkSNBFYk= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH v5 12/37] serial: start making SerialMM a sysbus device Date: Fri, 20 Dec 2019 17:45:36 +0400 Message-Id: <20191220134601.571905-13-marcandre.lureau@redhat.com> In-Reply-To: <20191220134601.571905-1-marcandre.lureau@redhat.com> References: <20191220134601.571905-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: rX_9fkdkNKWIV40dA5yqoA-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.120 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: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Memory mapped serial device is in fact a sysbus device. The following patches will make use of sysbus facilities for resource and registration. In particular, "serial-mm: use sysbus facilities" will move internal serial realization to serial_mm_realize callback to follow qdev best practices. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Peter Maydell --- hw/char/omap_uart.c | 2 +- hw/char/serial.c | 66 +++++++++++++++++++++++++++++++--------- hw/mips/boston.c | 2 +- hw/mips/mips_malta.c | 2 +- include/hw/char/serial.h | 20 +++++++++--- 5 files changed, 70 insertions(+), 22 deletions(-) diff --git a/hw/char/omap_uart.c b/hw/char/omap_uart.c index 13e4f43c4c..e8da933378 100644 --- a/hw/char/omap_uart.c +++ b/hw/char/omap_uart.c @@ -27,7 +27,7 @@ struct omap_uart_s { MemoryRegion iomem; hwaddr base; - SerialState *serial; /* TODO */ + SerialMM *serial; /* TODO */ struct omap_target_agent_s *ta; omap_clk fclk; qemu_irq irq; diff --git a/hw/char/serial.c b/hw/char/serial.c index ec388f3876..905b84c25f 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -1032,16 +1032,28 @@ static const TypeInfo serial_info =3D { static uint64_t serial_mm_read(void *opaque, hwaddr addr, unsigned size) { - SerialState *s =3D opaque; - return serial_ioport_read(s, addr >> s->it_shift, 1); + SerialMM *s =3D SERIAL_MM(opaque); + return serial_ioport_read(&s->serial, addr >> s->it_shift, 1); } =20 static void serial_mm_write(void *opaque, hwaddr addr, uint64_t value, unsigned size) { - SerialState *s =3D opaque; + SerialMM *s =3D SERIAL_MM(opaque); value &=3D 255; - serial_ioport_write(s, addr >> s->it_shift, value, 1); + serial_ioport_write(&s->serial, addr >> s->it_shift, value, 1); +} + +static void serial_mm_realize(DeviceState *dev, Error **errp) +{ + SerialMM *s =3D SERIAL_MM(dev); + Error *local_err =3D NULL; + + object_property_set_bool(OBJECT(&s->serial), true, "realized", &local_= err); + if (local_err) { + error_propagate(errp, local_err); + return; + } } =20 static const MemoryRegionOps serial_mm_ops[3] =3D { @@ -1068,30 +1080,56 @@ static const MemoryRegionOps serial_mm_ops[3] =3D { }, }; =20 -SerialState *serial_mm_init(MemoryRegion *address_space, +SerialMM *serial_mm_init(MemoryRegion *address_space, hwaddr base, int it_shift, qemu_irq irq, int baudbase, Chardev *chr, enum device_endian end) { - DeviceState *dev =3D DEVICE(object_new(TYPE_SERIAL)); - SerialState *s =3D SERIAL(dev); + SerialMM *smm =3D SERIAL_MM(qdev_create(NULL, TYPE_SERIAL_MM)); + SerialState *s =3D &smm->serial; =20 - s->it_shift =3D it_shift; + smm->it_shift =3D it_shift; s->irq =3D irq; - qdev_prop_set_uint32(dev, "baudbase", baudbase); - qdev_prop_set_chr(dev, "chardev", chr); - qdev_set_legacy_instance_id(dev, base, 2); - qdev_init_nofail(dev); + qdev_prop_set_uint32(DEVICE(s), "baudbase", baudbase); + qdev_prop_set_chr(DEVICE(s), "chardev", chr); + qdev_set_legacy_instance_id(DEVICE(s), base, 2); =20 - memory_region_init_io(&s->io, NULL, &serial_mm_ops[end], s, + qdev_init_nofail(DEVICE(smm)); + + memory_region_init_io(&s->io, NULL, &serial_mm_ops[end], smm, "serial", 8 << it_shift); memory_region_add_subregion(address_space, base, &s->io); - return s; + + return smm; +} + +static void serial_mm_instance_init(Object *o) +{ + SerialMM *smm =3D SERIAL_MM(o); + + object_initialize_child(o, "serial", &smm->serial, sizeof(smm->serial), + TYPE_SERIAL, &error_abort, NULL); } =20 +static void serial_mm_class_init(ObjectClass *oc, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(oc); + + dc->realize =3D serial_mm_realize; +} + +static const TypeInfo serial_mm_info =3D { + .name =3D TYPE_SERIAL_MM, + .parent =3D TYPE_SYS_BUS_DEVICE, + .class_init =3D serial_mm_class_init, + .instance_init =3D serial_mm_instance_init, + .instance_size =3D sizeof(SerialMM), +}; + static void serial_register_types(void) { type_register_static(&serial_info); + type_register_static(&serial_mm_info); } =20 type_init(serial_register_types) diff --git a/hw/mips/boston.c b/hw/mips/boston.c index ca7d813a52..23fdd5ec6a 100644 --- a/hw/mips/boston.c +++ b/hw/mips/boston.c @@ -50,7 +50,7 @@ typedef struct { =20 MachineState *mach; MIPSCPSState cps; - SerialState *uart; + SerialMM *uart; =20 CharBackend lcd_display; char lcd_content[8]; diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 783cd99848..ea92e5e27d 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -83,7 +83,7 @@ typedef struct { uint32_t i2csel; CharBackend display; char display_text[9]; - SerialState *uart; + SerialMM *uart; bool display_inited; } MaltaFPGAState; =20 diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h index 548944b06a..730165347c 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; uint32_t baudbase; uint32_t tsr_retry; guint watch_tag; @@ -80,6 +79,14 @@ typedef struct SerialState { MemoryRegion io; } SerialState; =20 +typedef struct SerialMM { + SysBusDevice parent; + + SerialState serial; + + int it_shift; +} SerialMM; + extern const VMStateDescription vmstate_serial; extern const MemoryRegionOps serial_io_ops; =20 @@ -88,12 +95,15 @@ void serial_set_frequency(SerialState *s, uint32_t freq= uency); #define TYPE_SERIAL "serial" #define SERIAL(s) OBJECT_CHECK(SerialState, (s), TYPE_SERIAL) =20 +#define TYPE_SERIAL_MM "serial-mm" +#define SERIAL_MM(s) OBJECT_CHECK(SerialMM, (s), TYPE_SERIAL_MM) + SerialState *serial_init(int base, qemu_irq irq, int baudbase, Chardev *chr, MemoryRegion *system_io); -SerialState *serial_mm_init(MemoryRegion *address_space, - hwaddr base, int it_shift, - qemu_irq irq, int baudbase, - Chardev *chr, enum device_endian end); +SerialMM *serial_mm_init(MemoryRegion *address_space, + hwaddr base, int it_shift, + qemu_irq irq, int baudbase, + Chardev *chr, enum device_endian end); =20 /* serial-isa.c */ =20 --=20 2.24.0.308.g228f53135a From nobody Thu May 2 22:13:26 2024 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576850025; cv=none; d=zohomail.com; s=zohoarc; b=G3P1RwghyoHYTa+OyrHlxRkB1iV4FmTEwN8D1wIA1Z2WWX8X/l9jESovxEXiG6hdIq9UxjTNeln0kWLzpWXbj+10goMjno8ZGhMPTs/5ChjBVbPkknB9fL1ivEkkf1D4IbYCGVxySz5E8FqRyyOA4xlKmBySbAxtuYII0Gq1sss= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576850025; 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=ssRYgZVk3HAHaa17z+VNAnV4jkpIBVdChd5cAW8AlF0=; b=eMqe0haMY9qoZIF7bjl9rPPmWoPdyO4jwgKSkqLqNmfQv1q6hv2mKIDVbprfTZUT1EHDM2PKzjGnWBL29xI0cWm31uxSf15swNgaXdAXVJoHpjzCbSHf05ZER1XqiAmeb1g+I+7XDgP9eHpEXu8Eby7NcryWdP1c2g2S+yd+B/k= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576850025723423.41460433230384; Fri, 20 Dec 2019 05:53:45 -0800 (PST) Received: from localhost ([::1]:56220 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIiu-0005H7-4C for importer@patchew.org; Fri, 20 Dec 2019 08:53:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47551) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIeQ-0005wc-Aw for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:49:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiIeO-0004kZ-O0 for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:49:06 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:34024 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iiIeN-0004e3-Fr for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:49:04 -0500 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-371-lizQjrtgOuOZwodTuigSyQ-1; Fri, 20 Dec 2019 08:48:09 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0CCC8805725; Fri, 20 Dec 2019 13:48:08 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id C942426FC8; Fri, 20 Dec 2019 13:48:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576849743; 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=ssRYgZVk3HAHaa17z+VNAnV4jkpIBVdChd5cAW8AlF0=; b=WrIJQFBsYhNMjzxLx79MQzA+/Jd1NYcZ5wzKxkQAqiSziNbxoMq3GhS0N8qKLsru0fChxh YH1iTmcf6PwQU7jZYitvY+n6YwK5Vnc7IBM4Xo7A53g5/lF36xKuAw6WyRoqvcf7v5Q0C6 3l5aK7pUBjQx0/aGJlQ5jIZu3Yuuswc= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH v5 13/37] serial-mm: add "regshift" property Date: Fri, 20 Dec 2019 17:45:37 +0400 Message-Id: <20191220134601.571905-14-marcandre.lureau@redhat.com> In-Reply-To: <20191220134601.571905-1-marcandre.lureau@redhat.com> References: <20191220134601.571905-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: lizQjrtgOuOZwodTuigSyQ-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: 207.211.31.120 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: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" And a property and rename "it_shift" field to "regshift", as it seems to be more popular (and I don't know what "it" stands for). Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Peter Maydell --- hw/char/serial.c | 22 +++++++++++++++++----- include/hw/char/serial.h | 4 ++-- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/hw/char/serial.c b/hw/char/serial.c index 905b84c25f..f60fc98efc 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -1033,7 +1033,7 @@ static uint64_t serial_mm_read(void *opaque, hwaddr a= ddr, unsigned size) { SerialMM *s =3D SERIAL_MM(opaque); - return serial_ioport_read(&s->serial, addr >> s->it_shift, 1); + return serial_ioport_read(&s->serial, addr >> s->regshift, 1); } =20 static void serial_mm_write(void *opaque, hwaddr addr, @@ -1041,7 +1041,7 @@ static void serial_mm_write(void *opaque, hwaddr addr, { SerialMM *s =3D SERIAL_MM(opaque); value &=3D 255; - serial_ioport_write(&s->serial, addr >> s->it_shift, value, 1); + serial_ioport_write(&s->serial, addr >> s->regshift, value, 1); } =20 static void serial_mm_realize(DeviceState *dev, Error **errp) @@ -1081,14 +1081,14 @@ static const MemoryRegionOps serial_mm_ops[3] =3D { }; =20 SerialMM *serial_mm_init(MemoryRegion *address_space, - hwaddr base, int it_shift, + hwaddr base, int regshift, qemu_irq irq, int baudbase, Chardev *chr, enum device_endian end) { SerialMM *smm =3D SERIAL_MM(qdev_create(NULL, TYPE_SERIAL_MM)); SerialState *s =3D &smm->serial; =20 - smm->it_shift =3D it_shift; + qdev_prop_set_uint8(DEVICE(smm), "regshift", regshift); s->irq =3D irq; qdev_prop_set_uint32(DEVICE(s), "baudbase", baudbase); qdev_prop_set_chr(DEVICE(s), "chardev", chr); @@ -1097,7 +1097,7 @@ SerialMM *serial_mm_init(MemoryRegion *address_space, qdev_init_nofail(DEVICE(smm)); =20 memory_region_init_io(&s->io, NULL, &serial_mm_ops[end], smm, - "serial", 8 << it_shift); + "serial", 8 << regshift); memory_region_add_subregion(address_space, base, &s->io); =20 return smm; @@ -1111,10 +1111,21 @@ static void serial_mm_instance_init(Object *o) TYPE_SERIAL, &error_abort, NULL); } =20 +static Property serial_mm_properties[] =3D { + /* + * Set the spacing between adjacent memory-mapped UART registers. + * Each register will be at (1 << regshift) bytes after the + * previous one. + */ + DEFINE_PROP_UINT8("regshift", SerialMM, regshift, 0), + DEFINE_PROP_END_OF_LIST(), +}; + static void serial_mm_class_init(ObjectClass *oc, void *data) { DeviceClass *dc =3D DEVICE_CLASS(oc); =20 + dc->props =3D serial_mm_properties; dc->realize =3D serial_mm_realize; } =20 @@ -1124,6 +1135,7 @@ static const TypeInfo serial_mm_info =3D { .class_init =3D serial_mm_class_init, .instance_init =3D serial_mm_instance_init, .instance_size =3D sizeof(SerialMM), + .class_init =3D serial_mm_class_init, }; =20 static void serial_register_types(void) diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h index 730165347c..eaeda62698 100644 --- a/include/hw/char/serial.h +++ b/include/hw/char/serial.h @@ -84,7 +84,7 @@ typedef struct SerialMM { =20 SerialState serial; =20 - int it_shift; + uint8_t regshift; } SerialMM; =20 extern const VMStateDescription vmstate_serial; @@ -101,7 +101,7 @@ void serial_set_frequency(SerialState *s, uint32_t freq= uency); SerialState *serial_init(int base, qemu_irq irq, int baudbase, Chardev *chr, MemoryRegion *system_io); SerialMM *serial_mm_init(MemoryRegion *address_space, - hwaddr base, int it_shift, + hwaddr base, int regshift, qemu_irq irq, int baudbase, Chardev *chr, enum device_endian end); =20 --=20 2.24.0.308.g228f53135a From nobody Thu May 2 22:13:26 2024 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576850048; cv=none; d=zohomail.com; s=zohoarc; b=YwrlTTKGhH6ZtGvg6iOsTxTdaA4qgoYPRncUkuXLTEYRHvtqYRxFIdGP2vZMcLZlN4Nmv7EHiBU94e6ZZGuqXLlxnT4D+RS9vWQQWqUObGzN9OYaQodOk2gaRARxz7rFaN2mj0fjSctRDsQ9M9BORQ38ROgtxewntb1PhFlAK5o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576850048; 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=YyDHOkO66OyiWdqE223XfCcrMV5/wrBK092ep3EMTMk=; b=htfw8Ff5U0CslH/umR16Cu/Sly3sPiuvwGoiKO5AqLA5lRxNj6pbm3Hrfu4j7ZfarhU4AD8pleL43GivKgGxkwdqjch2bBx/nuLOySdXUkQ6tKsXaQu4ntuHyIuvLv0S9dOyIpXFhYeUyXU8LR7ZRaC+DQmWA05pJ4FTlUuZRnQ= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576850048241621.205505258615; Fri, 20 Dec 2019 05:54:08 -0800 (PST) Received: from localhost ([::1]:56224 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIjD-0005qV-UP for importer@patchew.org; Fri, 20 Dec 2019 08:54:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42509) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIdo-0004xk-6S for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:48:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiIdk-0002UD-Cl for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:48:27 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:59643 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iiIdk-0002RX-6N for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:48:24 -0500 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-302-vWAYFWVLM9izaLcHtXkFxA-1; Fri, 20 Dec 2019 08:48:22 -0500 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 74C7E8048F7; Fri, 20 Dec 2019 13:48:21 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 587265DA32; Fri, 20 Dec 2019 13:48:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576849703; 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=YyDHOkO66OyiWdqE223XfCcrMV5/wrBK092ep3EMTMk=; b=KzEHAQneGT8ebbuxchxFatS2PA7VQT9uxpB+KyJKiKMCkvJWptDw3MRACLy5kFoYpQJO+0 9y5siaJrOIKnxnSOf+UTRkQfi/ZtdlDAYggrFnFpuwkDaYHLhKEyEHt2hnlbRfDw6V/N8A z0FykfdCp2ACXO/JKoQPIqqMAN4vexQ= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH v5 14/37] serial-mm: add endianness property Date: Fri, 20 Dec 2019 17:45:38 +0400 Message-Id: <20191220134601.571905-15-marcandre.lureau@redhat.com> In-Reply-To: <20191220134601.571905-1-marcandre.lureau@redhat.com> References: <20191220134601.571905-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: vWAYFWVLM9izaLcHtXkFxA-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.120 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: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Add a qdev property for endianness, so memory region setup can be done in realize. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/char/serial.c | 2 ++ include/hw/char/serial.h | 1 + 2 files changed, 3 insertions(+) diff --git a/hw/char/serial.c b/hw/char/serial.c index f60fc98efc..e8306a803a 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -1093,6 +1093,7 @@ SerialMM *serial_mm_init(MemoryRegion *address_space, qdev_prop_set_uint32(DEVICE(s), "baudbase", baudbase); qdev_prop_set_chr(DEVICE(s), "chardev", chr); qdev_set_legacy_instance_id(DEVICE(s), base, 2); + qdev_prop_set_uint8(DEVICE(self), "endianness", end); =20 qdev_init_nofail(DEVICE(smm)); =20 @@ -1118,6 +1119,7 @@ static Property serial_mm_properties[] =3D { * previous one. */ DEFINE_PROP_UINT8("regshift", SerialMM, regshift, 0), + DEFINE_PROP_UINT8("endianness", SerialMM, endianness, DEVICE_NATIVE_EN= DIAN), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h index eaeda62698..d586924937 100644 --- a/include/hw/char/serial.h +++ b/include/hw/char/serial.h @@ -85,6 +85,7 @@ typedef struct SerialMM { SerialState serial; =20 uint8_t regshift; + uint8_t endianness; } SerialMM; =20 extern const VMStateDescription vmstate_serial; --=20 2.24.0.308.g228f53135a From nobody Thu May 2 22:13:26 2024 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576850497; cv=none; d=zohomail.com; s=zohoarc; b=Anjp2Ci5WnK+xtutaye6HR/JQ/dJD93C9UufIb/JOwDVUMt5FbFMLrGqWYXt/pgGtTKBTqv9IYj03OeRmDF940gL6DKW+lb/U04MRO1A8q2PqE3jAtinHUavmdo6+jlO4tl2Mgq1I3VoY7A8dNRG1zLvvRSPo3h/Iq2KEYZa6mY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576850497; 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=YVKjYAUv3XHPaE0rjsLuyLcgITuOpWJlhlrCF37XM+s=; b=e/vEiuuke0llAS+4DJl3Iqi4VQYW2Un0yLeIXfPg2iOHyMWaUsIzTfHHXhvjpD3Y2KFaayUo9/eXdt5zN5fn49qQ7M1E3y8VnMdu7maGXkIalQ8d0b/aYSxSwP0M9rS582dtt2PIUq8RyHcdvxIM9VW+/2tqsptrcnni+fj7Ogc= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 157685049769252.702613895515015; Fri, 20 Dec 2019 06:01:37 -0800 (PST) Received: from localhost ([::1]:56368 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIqV-0000Xy-Vh for importer@patchew.org; Fri, 20 Dec 2019 09:01:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43864) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIe2-0005HV-JW for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:48:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiIe0-0003FX-LN for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:48:42 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:37962 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iiIdy-0003Ec-P4 for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:48:38 -0500 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-207-FedH1qAAOdijs3pZ2Tiadg-1; Fri, 20 Dec 2019 08:48:35 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1491C8D6746; Fri, 20 Dec 2019 13:48:34 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6F1FE26FB3; Fri, 20 Dec 2019 13:48:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576849718; 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=YVKjYAUv3XHPaE0rjsLuyLcgITuOpWJlhlrCF37XM+s=; b=fEDFszS7TbTD/j6uuivoSugPoQ/CdMirMA4rbifn6fOgBh1eInd33WvaE3S6X8Q6Ta9q8p ebbtywcen7vkySAesrAcgCsHBU3eDM0gtts0HN6Hq0WKdQ+7vJj/9aqjJo7hPEbsoJDr08 sVPUVz2xp6mOBcpXDbdjdIRsKsjAL9k= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH v5 15/37] serial-mm: use sysbus facilities Date: Fri, 20 Dec 2019 17:45:39 +0400 Message-Id: <20191220134601.571905-16-marcandre.lureau@redhat.com> In-Reply-To: <20191220134601.571905-1-marcandre.lureau@redhat.com> References: <20191220134601.571905-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: FedH1qAAOdijs3pZ2Tiadg-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: 207.211.31.120 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: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Make SerialMM a regular sysbus device, by registering the irq, and the mmio region. Reexport the internal serial properties. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Peter Maydell --- hw/char/serial.c | 50 +++++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/hw/char/serial.c b/hw/char/serial.c index e8306a803a..4899c0454a 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -1044,18 +1044,6 @@ static void serial_mm_write(void *opaque, hwaddr add= r, serial_ioport_write(&s->serial, addr >> s->regshift, value, 1); } =20 -static void serial_mm_realize(DeviceState *dev, Error **errp) -{ - SerialMM *s =3D SERIAL_MM(dev); - Error *local_err =3D NULL; - - object_property_set_bool(OBJECT(&s->serial), true, "realized", &local_= err); - if (local_err) { - error_propagate(errp, local_err); - return; - } -} - static const MemoryRegionOps serial_mm_ops[3] =3D { [DEVICE_NATIVE_ENDIAN] =3D { .read =3D serial_mm_read, @@ -1080,26 +1068,42 @@ static const MemoryRegionOps serial_mm_ops[3] =3D { }, }; =20 +static void serial_mm_realize(DeviceState *dev, Error **errp) +{ + SerialMM *smm =3D SERIAL_MM(dev); + SerialState *s =3D &smm->serial; + Error *local_err =3D NULL; + + object_property_set_bool(OBJECT(s), true, "realized", &local_err); + if (local_err) { + error_propagate(errp, local_err); + return; + } + + memory_region_init_io(&s->io, NULL, &serial_mm_ops[smm->endianness], s= mm, + "serial", 8 << smm->regshift); + sysbus_init_mmio(SYS_BUS_DEVICE(smm), &s->io); + sysbus_init_irq(SYS_BUS_DEVICE(smm), &smm->serial.irq); +} + SerialMM *serial_mm_init(MemoryRegion *address_space, hwaddr base, int regshift, qemu_irq irq, int baudbase, Chardev *chr, enum device_endian end) { SerialMM *smm =3D SERIAL_MM(qdev_create(NULL, TYPE_SERIAL_MM)); - SerialState *s =3D &smm->serial; + MemoryRegion *mr; =20 qdev_prop_set_uint8(DEVICE(smm), "regshift", regshift); - s->irq =3D irq; - qdev_prop_set_uint32(DEVICE(s), "baudbase", baudbase); - qdev_prop_set_chr(DEVICE(s), "chardev", chr); - qdev_set_legacy_instance_id(DEVICE(s), base, 2); - qdev_prop_set_uint8(DEVICE(self), "endianness", end); - + qdev_prop_set_uint32(DEVICE(smm), "baudbase", baudbase); + qdev_prop_set_chr(DEVICE(smm), "chardev", chr); + qdev_set_legacy_instance_id(DEVICE(smm), base, 2); + qdev_prop_set_uint8(DEVICE(smm), "endianness", end); qdev_init_nofail(DEVICE(smm)); =20 - memory_region_init_io(&s->io, NULL, &serial_mm_ops[end], smm, - "serial", 8 << regshift); - memory_region_add_subregion(address_space, base, &s->io); + sysbus_connect_irq(SYS_BUS_DEVICE(smm), 0, irq); + mr =3D sysbus_mmio_get_region(SYS_BUS_DEVICE(smm), 0); + memory_region_add_subregion(address_space, base, mr); =20 return smm; } @@ -1110,6 +1114,8 @@ static void serial_mm_instance_init(Object *o) =20 object_initialize_child(o, "serial", &smm->serial, sizeof(smm->serial), TYPE_SERIAL, &error_abort, NULL); + + qdev_alias_all_properties(DEVICE(&smm->serial), o); } =20 static Property serial_mm_properties[] =3D { --=20 2.24.0.308.g228f53135a From nobody Thu May 2 22:13:26 2024 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576850520; cv=none; d=zohomail.com; s=zohoarc; b=nJWk7+HE0jRPRbdG595jvDVnfPcC8Xe0dKEAFa/1oHjfvzshbJuFXPb7NkJKxy/V+sPeQLCBk2GZry/PiQ3aVXPnPy7Jys6pH1GsELk1LQNJ+sEZXhmKAbKIDOQVgF3UUw2iitfGlBoFJeRm6lgVCVQsRaIMyxjNM4Y+ErRvGTA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576850520; 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=ErEusLMkFXXYvU1bgrkOZYaAHQWrglTdAbdT6UhLbQQ=; b=itst2ueVifQf2TmhwDK+PbVE2Ku+y+VOKcHYEHaT9/R1BkCAYPhOk1TeO6s5WfIx9VL0GuDQ4/twvNPQsQieUfA61pEDJ5qSS6FI7p4CeHt6UWTZBYqEC7tDq2nTIuxDHvT6xHMMW6IEznz8hpLlcHqUGjpSTgFeBWF/ZxJjluY= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576850520219322.085748020114; Fri, 20 Dec 2019 06:02:00 -0800 (PST) Received: from localhost ([::1]:56372 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIqs-00016D-No for importer@patchew.org; Fri, 20 Dec 2019 09:01:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44959) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIe9-0005VO-SX for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:48:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiIe8-0003f6-ES for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:48:49 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:58111 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 1iiIe7-0003ci-V6 for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:48:48 -0500 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-267-9e0Dv2GDP16b0inkhVBBVQ-1; Fri, 20 Dec 2019 08:48:44 -0500 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 32C54107ACCC; Fri, 20 Dec 2019 13:48:43 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id E340F5C54A; Fri, 20 Dec 2019 13:48:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576849727; 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=ErEusLMkFXXYvU1bgrkOZYaAHQWrglTdAbdT6UhLbQQ=; b=KvmFeFan7nO0EfNU/rWsip8xt46AcPvm65XtdTuSXvCSptGSCwTibmMM0TdPuwzs8+4iWT L7YQvZAgql2JPjR109s5GiHAHCHfMgR4OkyeaJKAkb66b7xi7gXm2Ya1L4hJdU6rdb9SGZ Ndy13iJQnvznG37J1BiDDl92m8fsA40= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH v5 16/37] serial: make SerialIO a sysbus device Date: Fri, 20 Dec 2019 17:45:40 +0400 Message-Id: <20191220134601.571905-17-marcandre.lureau@redhat.com> In-Reply-To: <20191220134601.571905-1-marcandre.lureau@redhat.com> References: <20191220134601.571905-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: 9e0Dv2GDP16b0inkhVBBVQ-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: 207.211.31.81 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: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Make serial IO a proper sysbus device, similar to serial MM. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/char/serial.c | 64 +++++++++++++++++++++++++++++++++------- include/hw/char/serial.h | 13 ++++++-- 2 files changed, 64 insertions(+), 13 deletions(-) diff --git a/hw/char/serial.c b/hw/char/serial.c index 4899c0454a..84b4267ce6 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -985,22 +985,63 @@ const MemoryRegionOps serial_io_ops =3D { .endianness =3D DEVICE_LITTLE_ENDIAN, }; =20 -SerialState *serial_init(int base, qemu_irq irq, int baudbase, - Chardev *chr, MemoryRegion *system_io) +static void serial_io_realize(DeviceState *dev, Error **errp) { - DeviceState *dev =3D DEVICE(object_new(TYPE_SERIAL)); - SerialState *s =3D SERIAL(dev); + SerialIO *sio =3D SERIAL_IO(dev); + SerialState *s =3D &sio->serial; + Error *local_err =3D NULL; =20 - s->irq =3D irq; - qdev_prop_set_uint32(dev, "baudbase", baudbase); - qdev_prop_set_chr(dev, "chardev", chr); - qdev_set_legacy_instance_id(dev, base, 2); - qdev_init_nofail(dev); + object_property_set_bool(OBJECT(s), true, "realized", &local_err); + if (local_err) { + error_propagate(errp, local_err); + return; + } =20 memory_region_init_io(&s->io, NULL, &serial_io_ops, s, "serial", 8); - memory_region_add_subregion(system_io, base, &s->io); + sysbus_init_irq(SYS_BUS_DEVICE(sio), &s->irq); +} + +static void serial_io_class_init(ObjectClass *klass, void* data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + + dc->realize =3D serial_io_realize; + /* No dc->vmsd: class has no migratable state */ +} + +static void serial_io_instance_init(Object *o) +{ + SerialIO *sio =3D SERIAL_IO(o); + + object_initialize_child(o, "serial", &sio->serial, sizeof(sio->serial), + TYPE_SERIAL, &error_abort, NULL); + + qdev_alias_all_properties(DEVICE(&sio->serial), o); +} + + +static const TypeInfo serial_io_info =3D { + .name =3D TYPE_SERIAL_IO, + .parent =3D TYPE_SYS_BUS_DEVICE, + .instance_size =3D sizeof(SerialIO), + .instance_init =3D serial_io_instance_init, + .class_init =3D serial_io_class_init, +}; + +SerialIO *serial_init(int base, qemu_irq irq, int baudbase, + Chardev *chr, MemoryRegion *system_io) +{ + SerialIO *sio =3D SERIAL_IO(qdev_create(NULL, TYPE_SERIAL_IO)); + + qdev_prop_set_uint32(DEVICE(sio), "baudbase", baudbase); + qdev_prop_set_chr(DEVICE(sio), "chardev", chr); + qdev_set_legacy_instance_id(DEVICE(sio), base, 2); + qdev_init_nofail(DEVICE(sio)); + + sysbus_connect_irq(SYS_BUS_DEVICE(sio), 0, irq); + memory_region_add_subregion(system_io, base, &sio->serial.io); =20 - return s; + return sio; } =20 static Property serial_properties[] =3D { @@ -1149,6 +1190,7 @@ static const TypeInfo serial_mm_info =3D { static void serial_register_types(void) { type_register_static(&serial_info); + type_register_static(&serial_io_info); type_register_static(&serial_mm_info); } =20 diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h index d586924937..d356ba838c 100644 --- a/include/hw/char/serial.h +++ b/include/hw/char/serial.h @@ -88,6 +88,12 @@ typedef struct SerialMM { uint8_t endianness; } SerialMM; =20 +typedef struct SerialIO { + SysBusDevice parent; + + SerialState serial; +} SerialIO; + extern const VMStateDescription vmstate_serial; extern const MemoryRegionOps serial_io_ops; =20 @@ -99,8 +105,11 @@ void serial_set_frequency(SerialState *s, uint32_t freq= uency); #define TYPE_SERIAL_MM "serial-mm" #define SERIAL_MM(s) OBJECT_CHECK(SerialMM, (s), TYPE_SERIAL_MM) =20 -SerialState *serial_init(int base, qemu_irq irq, int baudbase, - Chardev *chr, MemoryRegion *system_io); +#define TYPE_SERIAL_IO "serial-io" +#define SERIAL_IO(s) OBJECT_CHECK(SerialIO, (s), TYPE_SERIAL_IO) + +SerialIO *serial_init(int base, qemu_irq irq, int baudbase, + Chardev *chr, MemoryRegion *system_io); SerialMM *serial_mm_init(MemoryRegion *address_space, hwaddr base, int regshift, qemu_irq irq, int baudbase, --=20 2.24.0.308.g228f53135a From nobody Thu May 2 22:13:26 2024 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576850685; cv=none; d=zohomail.com; s=zohoarc; b=FIRNdWojQi+7hi5O4QbAWNx5EVDwc6TTCIWrTUL62+YCyy2xMcZUrhuGvECh0jXe5VTHhOO6RviwexSshHsPgzr/PFe6BHfkGd89IyKGIiFKrwxKbI42+Qrni0+VwgW7BglvBPAi6kWzIhg505i6e2m/2+7zu1uLjlZPtRxvnKY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576850685; 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=VJFI0s8ox07qoJE1UDX4mtILVP9oq6ke2Z20xFAN4vI=; b=Ttl7wjlhaRTWBsOky0AeYX7pqBHK801WAKR0OlIrnA44OCJTtylIC10dRr2wkTUVBc/xKi4J40EtnScQsNe3eBotVyNRMXbdAAUrJ5UC/APg1ZH/f4J8r4HQSY9GROAtTKcoI9Nr620l5yDI0AVL8JnDXsWnyAI1l4yPMXp5rvo= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576850685175430.80680662497116; Fri, 20 Dec 2019 06:04:45 -0800 (PST) Received: from localhost ([::1]:56402 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiItW-0004Hn-NZ for importer@patchew.org; Fri, 20 Dec 2019 09:04:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46797) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIeK-0005o9-Rc for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:49:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiIeJ-0004PS-Gl for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:49:00 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:22910 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iiIeJ-0004Nh-Bi for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:48:59 -0500 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-172-TbDvIuK8NvKfnooJCb7I_w-1; Fri, 20 Dec 2019 08:48:56 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 889FD81CE31; Fri, 20 Dec 2019 13:48:55 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0A70B48; Fri, 20 Dec 2019 13:48:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576849738; 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=VJFI0s8ox07qoJE1UDX4mtILVP9oq6ke2Z20xFAN4vI=; b=JbKJxqn3uwwl9InIKLeAMsaZAxvOGpa0aOgNTPKsmfEpC+RzNx+SxRV7fE/Pt7qMNl1H4/ vl13yJ1mLUdEvQdnXDiaUaU52SW+K/Bqaq5S31yDpF7M1M1QngnBBGdW9oiuUcjM82etNJ M1q/Hk0a7TjFYOR9NVWAXTgEvKwKZbo= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH v5 17/37] mips: inline serial_init() Date: Fri, 20 Dec 2019 17:45:41 +0400 Message-Id: <20191220134601.571905-18-marcandre.lureau@redhat.com> In-Reply-To: <20191220134601.571905-1-marcandre.lureau@redhat.com> References: <20191220134601.571905-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: TbDvIuK8NvKfnooJCb7I_w-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.120 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: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The function is specific to mipssim, let's inline it. (when inlining, we use a DeviceState variable instead of SerialIO, as it is the most common type used, and avoids having too many casts) Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Aleksandar Markovic --- hw/char/serial.c | 16 ---------------- hw/mips/mips_mipssim.c | 15 ++++++++++++--- include/hw/char/serial.h | 2 -- 3 files changed, 12 insertions(+), 21 deletions(-) diff --git a/hw/char/serial.c b/hw/char/serial.c index 84b4267ce6..f0f81b34ec 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -1028,22 +1028,6 @@ static const TypeInfo serial_io_info =3D { .class_init =3D serial_io_class_init, }; =20 -SerialIO *serial_init(int base, qemu_irq irq, int baudbase, - Chardev *chr, MemoryRegion *system_io) -{ - SerialIO *sio =3D SERIAL_IO(qdev_create(NULL, TYPE_SERIAL_IO)); - - qdev_prop_set_uint32(DEVICE(sio), "baudbase", baudbase); - qdev_prop_set_chr(DEVICE(sio), "chardev", chr); - qdev_set_legacy_instance_id(DEVICE(sio), base, 2); - qdev_init_nofail(DEVICE(sio)); - - sysbus_connect_irq(SYS_BUS_DEVICE(sio), 0, irq); - memory_region_add_subregion(system_io, base, &sio->serial.io); - - return sio; -} - static Property serial_properties[] =3D { DEFINE_PROP_CHR("chardev", SerialState, chr), DEFINE_PROP_UINT32("baudbase", SerialState, baudbase, 115200), diff --git a/hw/mips/mips_mipssim.c b/hw/mips/mips_mipssim.c index 282bbecb24..5ee26108f5 100644 --- a/hw/mips/mips_mipssim.c +++ b/hw/mips/mips_mipssim.c @@ -40,6 +40,7 @@ #include "hw/loader.h" #include "elf.h" #include "hw/sysbus.h" +#include "hw/qdev-properties.h" #include "exec/address-spaces.h" #include "qemu/error-report.h" #include "sysemu/qtest.h" @@ -219,9 +220,17 @@ mips_mipssim_init(MachineState *machine) * A single 16450 sits at offset 0x3f8. It is attached to * MIPS CPU INT2, which is interrupt 4. */ - if (serial_hd(0)) - serial_init(0x3f8, env->irq[4], 115200, serial_hd(0), - get_system_io()); + if (serial_hd(0)) { + DeviceState *dev =3D qdev_create(NULL, TYPE_SERIAL_IO); + + qdev_prop_set_uint32(dev, "baudbase", 115200); + qdev_prop_set_chr(dev, "chardev", serial_hd(0)); + qdev_set_legacy_instance_id(dev, 0x3f8, 2); + qdev_init_nofail(dev); + sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, env->irq[4]); + memory_region_add_subregion(get_system_io(), 0x3f8, + &SERIAL_IO(dev)->serial.io); + } =20 if (nd_table[0].used) /* MIPSnet uses the MIPS CPU INT0, which is interrupt 2. */ diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h index d356ba838c..535fa23a2b 100644 --- a/include/hw/char/serial.h +++ b/include/hw/char/serial.h @@ -108,8 +108,6 @@ void serial_set_frequency(SerialState *s, uint32_t freq= uency); #define TYPE_SERIAL_IO "serial-io" #define SERIAL_IO(s) OBJECT_CHECK(SerialIO, (s), TYPE_SERIAL_IO) =20 -SerialIO *serial_init(int base, qemu_irq irq, int baudbase, - Chardev *chr, MemoryRegion *system_io); SerialMM *serial_mm_init(MemoryRegion *address_space, hwaddr base, int regshift, qemu_irq irq, int baudbase, --=20 2.24.0.308.g228f53135a From nobody Thu May 2 22:13:26 2024 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576851012; cv=none; d=zohomail.com; s=zohoarc; b=FyCiB3nIi1pIWB4QC60kfAN0QFfxsJoKux7YslMBLzMfQZwUTxJa3gYb8s0PrpZJNRiVRStuYu/uNfEzlXvZTkmSaVD2EAlwkUaxCDbV2jpyrvgebYxij7/btSFSs23O7C2S3dUjAAGgkli8yaPVj9tmbpX23Q67HngndlWRYzU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576851012; 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=jz7FM9d++rLKpXEPo+ycYdkEZnKY0xtumNnSuPHxPIY=; b=Q0knzxNb3YqKkH1A2AkqtQW9Kt0l5ZdQ34P3/6EmAjnfKNEzhMcBtvVmXyB90Aw1LdhLeQifS2gWQxNgu7OiiZB8EqBnQuVx0+AU1dtZ9i4Kmo5Nu2MxCL/sqHAiLZ3jX1Jk5IeXaJvRQV/G82dIFmlCmYWd7JI7SwrxarKlJDo= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576851012578404.48179109796763; Fri, 20 Dec 2019 06:10:12 -0800 (PST) Received: from localhost ([::1]:56528 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIyo-000567-Te for importer@patchew.org; Fri, 20 Dec 2019 09:10:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48614) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIea-0006D7-NM for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:49:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiIeZ-0005Ag-Dk for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:49:16 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:26975 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 1iiIeZ-00059G-6o for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:49:15 -0500 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-339-Fe3LxP0yOYOPFs_GwrGlHA-1; Fri, 20 Dec 2019 08:49:11 -0500 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 8200380306D; Fri, 20 Dec 2019 13:49:10 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 31A9A5DA76; Fri, 20 Dec 2019 13:49:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576849754; 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=jz7FM9d++rLKpXEPo+ycYdkEZnKY0xtumNnSuPHxPIY=; b=PhXvezDyIBP7DV8FlwRdpO9ln9oUdGc77egdcjNMNKofgmBtXGuTBSQ9efUiP6G+S56rC9 urRmeRB69z6Fm6TLgrY/c2Ie/GhOJFy0RmdZtRXT9zlpQudEL7dGs97WgT3T67tV8Hy9Kv a42OaNSLUpApAx/maBUcqfVF3U8icEw= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH v5 18/37] mips: baudbase is 115200 by default Date: Fri, 20 Dec 2019 17:45:42 +0400 Message-Id: <20191220134601.571905-19-marcandre.lureau@redhat.com> In-Reply-To: <20191220134601.571905-1-marcandre.lureau@redhat.com> References: <20191220134601.571905-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: Fe3LxP0yOYOPFs_GwrGlHA-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: 207.211.31.81 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: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" (The default value is set for TYPE_SERIAL in serial_properties) Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Peter Maydell Reviewed-by: Aleksandar Markovic --- hw/mips/mips_mipssim.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/mips/mips_mipssim.c b/hw/mips/mips_mipssim.c index 5ee26108f5..3cd0e6eb33 100644 --- a/hw/mips/mips_mipssim.c +++ b/hw/mips/mips_mipssim.c @@ -223,7 +223,6 @@ mips_mipssim_init(MachineState *machine) if (serial_hd(0)) { DeviceState *dev =3D qdev_create(NULL, TYPE_SERIAL_IO); =20 - qdev_prop_set_uint32(dev, "baudbase", 115200); qdev_prop_set_chr(dev, "chardev", serial_hd(0)); qdev_set_legacy_instance_id(dev, 0x3f8, 2); qdev_init_nofail(dev); --=20 2.24.0.308.g228f53135a From nobody Thu May 2 22:13:26 2024 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576850184; cv=none; d=zohomail.com; s=zohoarc; b=mfDr3tj+RkvkVWvA0HyP4p73AKk+tFtzlGGgA+piUwdYvMFaAmW/JFcMht6fEZjK1ziAbPeURHaHQWjX7xf6M0sJyhI/Qe3Mg7KpFGUyHV13b3xzOKbQwNOveUqO2/5U8XWxUXivLID8hQ/u4UcpO64ZtUFWdpSD5yd5gSN4c6I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576850184; 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=osaqJ3M/BMMVcUs231lV6YDuyZCKmWiJvoxROLmaamI=; b=WC/JCc79IbGOzudnCTyEn7IqKqPw8CzWdkLZ/aeVjcp+M+V5xyu50189pTYu08hM5EjBTcjfT69eblrMNXsK8lPW2qV26wLfVk9YePLKYFoZZRhixAhb+8l2GbDlT+d6pWopHfRHCcPQKbmvKqfXbLYvgvv7/QEjBqvomOySRzE= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576850184504438.2335609180943; Fri, 20 Dec 2019 05:56:24 -0800 (PST) Received: from localhost ([::1]:56272 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIlS-0001Bv-Qb for importer@patchew.org; Fri, 20 Dec 2019 08:56:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50810) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIeo-0006bs-GL for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:49:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiIen-00064k-CP for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:49:30 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:33060 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 1iiIen-00062K-61 for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:49:29 -0500 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-120-gz9Y7CjWPv-l4-n5lUH_UQ-1; Fri, 20 Dec 2019 08:49:23 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 63F361086708; Fri, 20 Dec 2019 13:49:22 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id E988027061; Fri, 20 Dec 2019 13:49:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576849768; 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=osaqJ3M/BMMVcUs231lV6YDuyZCKmWiJvoxROLmaamI=; b=fSLKu3x0Xjwtt3x+sITT9PuB+o5f6hb956Tqkxj5H3InK5DLOkdBlVni1hsqiOTqnZFFxS kpGY7RjXdez1Iqv18tIyY2l7lbB9GwpJb/VXspGHqy4ughPlaDBBauQOzbADU8o5hIs2w5 BWNJOLF0gMHKW+dUMD5ANBcIsIKE7UQ= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH v5 19/37] mips: use sysbus_add_io() Date: Fri, 20 Dec 2019 17:45:43 +0400 Message-Id: <20191220134601.571905-20-marcandre.lureau@redhat.com> In-Reply-To: <20191220134601.571905-1-marcandre.lureau@redhat.com> References: <20191220134601.571905-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: gz9Y7CjWPv-l4-n5lUH_UQ-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: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" sysbus devices should use the associated helper function instead of calling memory_region_add_subregion() manually. This simplifies slightly the code. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Peter Maydell Reviewed-by: Aleksandar Markovic Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/mips/mips_mipssim.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/mips/mips_mipssim.c b/hw/mips/mips_mipssim.c index 3cd0e6eb33..2c2c7f25b2 100644 --- a/hw/mips/mips_mipssim.c +++ b/hw/mips/mips_mipssim.c @@ -227,8 +227,7 @@ mips_mipssim_init(MachineState *machine) qdev_set_legacy_instance_id(dev, 0x3f8, 2); qdev_init_nofail(dev); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, env->irq[4]); - memory_region_add_subregion(get_system_io(), 0x3f8, - &SERIAL_IO(dev)->serial.io); + sysbus_add_io(SYS_BUS_DEVICE(dev), 0x3f8, &SERIAL_IO(dev)->serial.= io); } =20 if (nd_table[0].used) --=20 2.24.0.308.g228f53135a From nobody Thu May 2 22:13:26 2024 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576850898; cv=none; d=zohomail.com; s=zohoarc; b=BkSUfrQIv/k2kfBtqJMQO132FMdSBbrwx84x0JzGdFdE7Y+TVhBc/iN/HC9D6k1KdHXbD0OGFl3lHhFNELsxB3CpmkRBryHdCnJhPbr4vF7IE9NA4K23o7o77FdUcPceW7xTsFHfce6D/Wu8z1OoQmuqb0uqpV4ljTAFQSIlbnw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576850898; 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=O3R47qQwXCqJrWkcxhppveAle9mVn7YI4kgpvwpz38Q=; b=DcSi1BhbcTK+8loxJwR3B4ggOBk5pO1aDRU0m0xgDIEmh/U7MUe43awCsI7nGYoK4aI6D8fqMWvkh/gF04Ju659IEwgkrVxBO3a6UGlr6sMjUzXN57x0rLmo+x/hxwipkboPU3iIfoKCqPp+In/B+P1sDcGo2alXPR/hcduulK4= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 157685089834196.23587154628206; Fri, 20 Dec 2019 06:08:18 -0800 (PST) Received: from localhost ([::1]:56488 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIwy-0002Ho-OW for importer@patchew.org; Fri, 20 Dec 2019 09:08:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51802) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIeu-0006nZ-Ov for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:49:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiIet-0006TO-Ix for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:49:36 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:42956 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iiIet-0006Qy-CU for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:49:35 -0500 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-61-Fwk9LfuuM-qI4sz5bXKhKA-1; Fri, 20 Dec 2019 08:49:33 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 837C5593A5; Fri, 20 Dec 2019 13:49:32 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id DC8FE541FC; Fri, 20 Dec 2019 13:49:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576849775; 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=O3R47qQwXCqJrWkcxhppveAle9mVn7YI4kgpvwpz38Q=; b=SE40P4icgoXNsBcT9RxGJtO61WHESEkoYliW0m1sPXwXh2otSUBBxRkUEqjHF+siatM5Li H7ynVesJhbKoZHlJ1ljfKWa5kJR2OCfdDRvgN5sa9H6J33fmDOPnfkvNAjxkQGF7p8xoyE BVmy1Lb9LKFrmWo7giDAoU4Z96M4s3E= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH v5 20/37] mips: use sysbus_mmio_get_region() instead of internal fields Date: Fri, 20 Dec 2019 17:45:44 +0400 Message-Id: <20191220134601.571905-21-marcandre.lureau@redhat.com> In-Reply-To: <20191220134601.571905-1-marcandre.lureau@redhat.com> References: <20191220134601.571905-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: Fwk9LfuuM-qI4sz5bXKhKA-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: 207.211.31.120 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: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Register the memory region with sysbus_init_mmio() and look it up with sysbus_mmio_get_region() to avoid accessing internal device fields. Suggested-by: Peter Maydell Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Peter Maydell Reviewed-by: Aleksandar Markovic Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/char/serial.c | 1 + hw/mips/mips_mipssim.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/char/serial.c b/hw/char/serial.c index f0f81b34ec..36f70f16de 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -998,6 +998,7 @@ static void serial_io_realize(DeviceState *dev, Error *= *errp) } =20 memory_region_init_io(&s->io, NULL, &serial_io_ops, s, "serial", 8); + sysbus_init_mmio(SYS_BUS_DEVICE(sio), &s->io); sysbus_init_irq(SYS_BUS_DEVICE(sio), &s->irq); } =20 diff --git a/hw/mips/mips_mipssim.c b/hw/mips/mips_mipssim.c index 2c2c7f25b2..84c03dd035 100644 --- a/hw/mips/mips_mipssim.c +++ b/hw/mips/mips_mipssim.c @@ -227,7 +227,8 @@ mips_mipssim_init(MachineState *machine) qdev_set_legacy_instance_id(dev, 0x3f8, 2); qdev_init_nofail(dev); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, env->irq[4]); - sysbus_add_io(SYS_BUS_DEVICE(dev), 0x3f8, &SERIAL_IO(dev)->serial.= io); + sysbus_add_io(SYS_BUS_DEVICE(dev), 0x3f8, + sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0)); } =20 if (nd_table[0].used) --=20 2.24.0.308.g228f53135a From nobody Thu May 2 22:13:26 2024 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576850205; cv=none; d=zohomail.com; s=zohoarc; b=FTVejY1XxvmHV9emu+t4bIvUr8HGcGtvGNupQu4FU45bLwYoxIAVkaFMS1KHX4jOhzpa7Iyn2UI4YJaml2Tr+aJspIit9AaSN1AJ89K9e//q1ZX4o3xh4zul5UiQDX8p6HQ7rYfxIBz+HCdLmLjzExeT0JikVOmaTJ0KJAcpwTM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576850205; 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=CAcsZWUKwMhWdniMWvfwgFVvBAcGa6uh4615zUNOliE=; b=avGVwUK/BEJJIw6wmojZmz+G+h+jlHr3E1ziD9LpL5WC3MRM5O0rvL4gFElZhUOm2nr+tK0/RXgXY4VVQesUdDpyNCZt20x41gBvcNyO81SkjkJSVRAFCokz2Vu2b5igaZ7ZHKPWbxQoYWQRbXu593HvahE3gMPyoAvAQLSrjHg= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576850205228413.195333010952; Fri, 20 Dec 2019 05:56:45 -0800 (PST) Received: from localhost ([::1]:56274 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIln-0001y3-N7 for importer@patchew.org; Fri, 20 Dec 2019 08:56:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54081) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIf8-0007IG-E5 for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:49:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiIf6-0007NH-Ro for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:49:50 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:52710 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iiIf6-0007KJ-Jd for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:49:48 -0500 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-367-lJpZOt5LP6mcEaAbkMT1Bw-1; Fri, 20 Dec 2019 08:49:44 -0500 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 0E55F108BC2E; Fri, 20 Dec 2019 13:49:43 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3B3865F700; Fri, 20 Dec 2019 13:49:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576849788; 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=CAcsZWUKwMhWdniMWvfwgFVvBAcGa6uh4615zUNOliE=; b=hRp5um9zwmFR4+bA8IZ9k4DQA7MsQwgG2E9xLqA8hXH/WROxGRBwAyOBn/6U+4g+e1lFMm wC90hUbxo33vI6NuSodEDEtKaFRdSV9/i6/i+xCnU4gqbB9cDF5BJkpN9qR20dQgMredNi AkzGAgc5ld3Ybb/I7zmTx0CzX/Iye5w= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH v5 21/37] sm501: make SerialMM a child, export chardev property Date: Fri, 20 Dec 2019 17:45:45 +0400 Message-Id: <20191220134601.571905-22-marcandre.lureau@redhat.com> In-Reply-To: <20191220134601.571905-1-marcandre.lureau@redhat.com> References: <20191220134601.571905-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: lJpZOt5LP6mcEaAbkMT1Bw-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: 207.211.31.120 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: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Embed the SerialMM sybus device, and re-export its "chardev" property. That way, we can get rid of PROP_PTR "chr-state" and better track devices relationship. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Peter Maydell --- hw/display/sm501.c | 29 +++++++++++++++++++++-------- hw/sh4/r2d.c | 2 +- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/hw/display/sm501.c b/hw/display/sm501.c index 79bd7bc2d1..66a1bfbe60 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -1930,7 +1930,7 @@ typedef struct { SM501State state; uint32_t vram_size; uint32_t base; - void *chr_state; + SerialMM serial; } SM501SysBusState; =20 static void sm501_realize_sysbus(DeviceState *dev, Error **errp) @@ -1938,6 +1938,7 @@ static void sm501_realize_sysbus(DeviceState *dev, Er= ror **errp) SM501SysBusState *s =3D SYSBUS_SM501(dev); SysBusDevice *sbd =3D SYS_BUS_DEVICE(dev); DeviceState *usb_dev; + MemoryRegion *mr; =20 sm501_init(&s->state, dev, s->vram_size); if (get_local_mem_size(&s->state) !=3D s->vram_size) { @@ -1958,15 +1959,15 @@ static void sm501_realize_sysbus(DeviceState *dev, = Error **errp) sysbus_pass_irq(sbd, SYS_BUS_DEVICE(usb_dev)); =20 /* bridge to serial emulation module */ - serial_mm_init(&s->state.mmio_region, SM501_UART0, 2, - NULL, /* TODO : chain irq to IRL */ - 115200, s->chr_state, DEVICE_LITTLE_ENDIAN); + qdev_init_nofail(DEVICE(&s->serial)); + mr =3D sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->serial), 0); + memory_region_add_subregion(&s->state.mmio_region, SM501_UART0, mr); + /* TODO : chain irq to IRL */ } =20 static Property sm501_sysbus_properties[] =3D { DEFINE_PROP_UINT32("vram-size", SM501SysBusState, vram_size, 0), DEFINE_PROP_UINT32("base", SM501SysBusState, base, 0), - DEFINE_PROP_PTR("chr-state", SM501SysBusState, chr_state), DEFINE_PROP_END_OF_LIST(), }; =20 @@ -1997,9 +1998,20 @@ static void sm501_sysbus_class_init(ObjectClass *kla= ss, void *data) dc->props =3D sm501_sysbus_properties; dc->reset =3D sm501_reset_sysbus; dc->vmsd =3D &vmstate_sm501_sysbus; - /* Note: pointer property "chr-state" may remain null, thus - * no need for dc->user_creatable =3D false; - */ +} + +static void sm501_sysbus_init(Object *o) +{ + SM501SysBusState *sm501 =3D SYSBUS_SM501(o); + SerialMM *smm =3D &sm501->serial; + + sysbus_init_child_obj(o, "serial", smm, sizeof(SerialMM), TYPE_SERIAL_= MM); + qdev_set_legacy_instance_id(DEVICE(smm), SM501_UART0, 2); + qdev_prop_set_uint8(DEVICE(smm), "regshift", 2); + qdev_prop_set_uint8(DEVICE(smm), "endianness", DEVICE_LITTLE_ENDIAN); + + object_property_add_alias(o, "chardev", + OBJECT(smm), "chardev", &error_abort); } =20 static const TypeInfo sm501_sysbus_info =3D { @@ -2007,6 +2019,7 @@ static const TypeInfo sm501_sysbus_info =3D { .parent =3D TYPE_SYS_BUS_DEVICE, .instance_size =3D sizeof(SM501SysBusState), .class_init =3D sm501_sysbus_class_init, + .instance_init =3D sm501_sysbus_init, }; =20 #define TYPE_PCI_SM501 "sm501" diff --git a/hw/sh4/r2d.c b/hw/sh4/r2d.c index ee0840f380..72bb5285cc 100644 --- a/hw/sh4/r2d.c +++ b/hw/sh4/r2d.c @@ -272,7 +272,7 @@ static void r2d_init(MachineState *machine) busdev =3D SYS_BUS_DEVICE(dev); qdev_prop_set_uint32(dev, "vram-size", SM501_VRAM_SIZE); qdev_prop_set_uint32(dev, "base", 0x10000000); - qdev_prop_set_ptr(dev, "chr-state", serial_hd(2)); + qdev_prop_set_chr(dev, "chardev", serial_hd(2)); qdev_init_nofail(dev); sysbus_mmio_map(busdev, 0, 0x10000000); sysbus_mmio_map(busdev, 1, 0x13e00000); --=20 2.24.0.308.g228f53135a From nobody Thu May 2 22:13:26 2024 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576850352; cv=none; d=zohomail.com; s=zohoarc; b=TB85wp97Aj89isP6nHwhb3WRNP6ZtcXyE3WqY1V1zjyKV/jtgVXbZYe7ONi3w1joGyY6ksXReLpsEY+UxD4SGU31IvjowUImnG8HvQV2JMuAiVoFvL0aQObdAdUI5zNKM1ksgJn+JENS6En6pWlJtdx2qKOjpfeSLG07y4X+WSM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576850352; 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=e8K/FLULfXHTN5ZAN9Exbeupoe9LUHxcOqfCTxUQKNg=; b=QIc12129Aqz8QoYP8hxSER4nRai3mmKYZNbYGxxY5/7i2wvZKvXFC6oS/0W7k64AKdDs5JlTXpGvdVANXB3scIehTOxQmURANfutVWeGSsH0AqOy2TlellOuSfgK8xWjcfphUFEnTjV7k3/SImJ85C8WG5Dp+fpO9Iwlmli7+9w= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576850352185567.8924168746913; Fri, 20 Dec 2019 05:59:12 -0800 (PST) Received: from localhost ([::1]:56302 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIoA-0005cc-Fz for importer@patchew.org; Fri, 20 Dec 2019 08:59:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55511) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIfH-0007ab-HJ for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:50:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiIfG-0007z0-0u for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:49:59 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:59484 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 1iiIfF-0007we-Ql for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:49:57 -0500 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-68-vI5AOhaXM2m4gEJhL_n7Qg-1; Fri, 20 Dec 2019 08:49:55 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E8B31107B7F4; Fri, 20 Dec 2019 13:49:54 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0A0776B56C; Fri, 20 Dec 2019 13:49:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576849797; 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=e8K/FLULfXHTN5ZAN9Exbeupoe9LUHxcOqfCTxUQKNg=; b=eas/QRLPJDoIeB0EUo6uQ6/J0Ggqw2K0Q6nLHMhKKns5OX3GZVVvSHVGHI8U/VXIUL+B3L tAePNsNn8P/cC7DBNpycHBdLxv0T4gADKCpV8CcjnRmg51OxhCRGjb23oNgl1k3+VYwB3l ilEBPpa4Fz6K+UezBwNgOuk98ilkFVA= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH v5 22/37] vmmouse: replace PROP_PTR with PROP_LINK Date: Fri, 20 Dec 2019 17:45:46 +0400 Message-Id: <20191220134601.571905-23-marcandre.lureau@redhat.com> In-Reply-To: <20191220134601.571905-1-marcandre.lureau@redhat.com> References: <20191220134601.571905-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: vI5AOhaXM2m4gEJhL_n7Qg-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: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" While at it, use the expected type. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/pc.c | 6 +++--- hw/i386/vmmouse.c | 8 +++----- hw/input/pckbd.c | 8 +++----- include/hw/input/i8042.h | 4 +++- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index a4fda69b49..8054bc4147 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1156,9 +1156,9 @@ static void pc_superio_init(ISABus *isa_bus, bool cre= ate_fdctrl, bool no_vmport) vmmouse =3D NULL; } if (vmmouse) { - DeviceState *dev =3D DEVICE(vmmouse); - qdev_prop_set_ptr(dev, "ps2_mouse", i8042); - qdev_init_nofail(dev); + object_property_set_link(OBJECT(vmmouse), OBJECT(i8042), + "i8042", &error_abort); + qdev_init_nofail(DEVICE(vmmouse)); } port92 =3D isa_create_simple(isa_bus, TYPE_PORT92); =20 diff --git a/hw/i386/vmmouse.c b/hw/i386/vmmouse.c index 41ad91ad53..c0c329f817 100644 --- a/hw/i386/vmmouse.c +++ b/hw/i386/vmmouse.c @@ -66,7 +66,7 @@ typedef struct VMMouseState uint16_t status; uint8_t absolute; QEMUPutMouseEntry *entry; - void *ps2_mouse; + ISAKBDState *i8042; } VMMouseState; =20 static uint32_t vmmouse_get_status(VMMouseState *s) @@ -105,7 +105,7 @@ static void vmmouse_mouse_event(void *opaque, int x, in= t y, int dz, int buttons_ =20 /* need to still generate PS2 events to notify driver to read from queue */ - i8042_isa_mouse_fake_event(s->ps2_mouse); + i8042_isa_mouse_fake_event(s->i8042); } =20 static void vmmouse_remove_handler(VMMouseState *s) @@ -275,7 +275,7 @@ static void vmmouse_realizefn(DeviceState *dev, Error *= *errp) } =20 static Property vmmouse_properties[] =3D { - DEFINE_PROP_PTR("ps2_mouse", VMMouseState, ps2_mouse), + DEFINE_PROP_LINK("i8042", VMMouseState, i8042, TYPE_I8042, ISAKBDState= *), DEFINE_PROP_END_OF_LIST(), }; =20 @@ -287,8 +287,6 @@ static void vmmouse_class_initfn(ObjectClass *klass, vo= id *data) dc->reset =3D vmmouse_reset; dc->vmsd =3D &vmstate_vmmouse; dc->props =3D vmmouse_properties; - /* Reason: pointer property "ps2_mouse" */ - dc->user_creatable =3D false; } =20 static const TypeInfo vmmouse_info =3D { diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index 2f09f780ba..60a4130320 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -482,17 +482,15 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_i= rq, =20 #define I8042(obj) OBJECT_CHECK(ISAKBDState, (obj), TYPE_I8042) =20 -typedef struct ISAKBDState { +struct ISAKBDState { ISADevice parent_obj; =20 KBDState kbd; MemoryRegion io[2]; -} ISAKBDState; +}; =20 -void i8042_isa_mouse_fake_event(void *opaque) +void i8042_isa_mouse_fake_event(ISAKBDState *isa) { - ISADevice *dev =3D opaque; - ISAKBDState *isa =3D I8042(dev); KBDState *s =3D &isa->kbd; =20 ps2_mouse_fake_event(s->mouse); diff --git a/include/hw/input/i8042.h b/include/hw/input/i8042.h index 246e6f3335..8eaebf50ce 100644 --- a/include/hw/input/i8042.h +++ b/include/hw/input/i8042.h @@ -14,10 +14,12 @@ =20 #define I8042_A20_LINE "a20" =20 +typedef struct ISAKBDState ISAKBDState; + void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, MemoryRegion *region, ram_addr_t size, hwaddr mask); -void i8042_isa_mouse_fake_event(void *opaque); +void i8042_isa_mouse_fake_event(ISAKBDState *isa); void i8042_setup_a20_line(ISADevice *dev, qemu_irq a20_out); =20 #endif /* HW_INPUT_I8042_H */ --=20 2.24.0.308.g228f53135a From nobody Thu May 2 22:13:26 2024 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576850333; cv=none; d=zohomail.com; s=zohoarc; b=eqoT7WZ28L8zhdjRSaiKHMincAu40X2w8XH4m02Tk+PaopukeZf79Zp+KMycBBKTc0ux4GMfb/psp/a7kp4k/jsVlmPcIWTYEZAAorTx7vHvDwImJDv31CPEO/KmSzWjqEjp9lVLahKuPH0CVo15KPzq1fm5+IiuvTbNsx0bzCA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576850333; 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=2yGtEFvHZyPhxjV2eitHNZAvo2erIGYNh8Mdr4PSirk=; b=E8gC62kEobn/Y9RQFAVRAYOhhsuCQ7IsvpUJ0J3KTmsHthgjUblcY7irDNB/35ps+pGkZUm19u8I4gDgvD64YUnHgqexyM5unU4mH2WiRndKaLKxAyadRC4fKzptCSTQyP+r0xWSTLabRUSqfvEP+QKkh8912Q6445+CDo9eV0c= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576850333089812.8940353846139; Fri, 20 Dec 2019 05:58:53 -0800 (PST) Received: from localhost ([::1]:56300 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiInr-0004tY-0s for importer@patchew.org; Fri, 20 Dec 2019 08:58:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57006) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIfQ-0007s2-Ui for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:50:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiIfP-0000Bm-G0 for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:50:08 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:21172 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 1iiIfP-00009d-AU for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:50:07 -0500 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-25-K6UJg4DHMauidMAs-HEthA-1; Fri, 20 Dec 2019 08:50:03 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 55D07802CB6; Fri, 20 Dec 2019 13:50:02 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id A747E6B566; Fri, 20 Dec 2019 13:50:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576849806; 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=2yGtEFvHZyPhxjV2eitHNZAvo2erIGYNh8Mdr4PSirk=; b=B9bR/gra63/mhJoYrrOIiO/uKewbr86HVC9hN3Sq7ucTQon8nk98cBG20yUsgLRLShl9Hr VuuvNi3WT6TIN5whgXOH9gXrXXUJNUQpBqdo6WT0SPh/gZozBFRdQzZOYtnXDtNzJthFYT Xaki0sq59CoSPpUl3qyVzMvO7EmgSuI= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH v5 23/37] lance: replace PROP_PTR with PROP_LINK Date: Fri, 20 Dec 2019 17:45:47 +0400 Message-Id: <20191220134601.571905-24-marcandre.lureau@redhat.com> In-Reply-To: <20191220134601.571905-1-marcandre.lureau@redhat.com> References: <20191220134601.571905-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: K6UJg4DHMauidMAs-HEthA-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: 207.211.31.81 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: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The device remains non-user creatable since it is a sysbus device. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/dma/sparc32_dma.c | 2 +- hw/net/lance.c | 5 ++--- hw/net/pcnet-pci.c | 2 +- hw/net/pcnet.h | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/hw/dma/sparc32_dma.c b/hw/dma/sparc32_dma.c index 0e5bbcdc7f..3e4da0c47f 100644 --- a/hw/dma/sparc32_dma.c +++ b/hw/dma/sparc32_dma.c @@ -346,7 +346,7 @@ static void sparc32_ledma_device_realize(DeviceState *d= ev, Error **errp) d =3D qdev_create(NULL, TYPE_LANCE); object_property_add_child(OBJECT(dev), "lance", OBJECT(d), errp); qdev_set_nic_properties(d, nd); - qdev_prop_set_ptr(d, "dma", dev); + object_property_set_link(OBJECT(d), OBJECT(dev), "dma", errp); qdev_init_nofail(d); } =20 diff --git a/hw/net/lance.c b/hw/net/lance.c index 6631e2a4e0..4d96299041 100644 --- a/hw/net/lance.c +++ b/hw/net/lance.c @@ -138,7 +138,8 @@ static void lance_instance_init(Object *obj) } =20 static Property lance_properties[] =3D { - DEFINE_PROP_PTR("dma", SysBusPCNetState, state.dma_opaque), + DEFINE_PROP_LINK("dma", SysBusPCNetState, state.dma_opaque, + TYPE_DEVICE, DeviceState *), DEFINE_NIC_PROPERTIES(SysBusPCNetState, state.conf), DEFINE_PROP_END_OF_LIST(), }; @@ -153,8 +154,6 @@ static void lance_class_init(ObjectClass *klass, void *= data) dc->reset =3D lance_reset; dc->vmsd =3D &vmstate_lance; dc->props =3D lance_properties; - /* Reason: pointer property "dma" */ - dc->user_creatable =3D false; } =20 static const TypeInfo lance_info =3D { diff --git a/hw/net/pcnet-pci.c b/hw/net/pcnet-pci.c index 4723c30c79..d067d21e2c 100644 --- a/hw/net/pcnet-pci.c +++ b/hw/net/pcnet-pci.c @@ -231,7 +231,7 @@ static void pci_pcnet_realize(PCIDevice *pci_dev, Error= **errp) s->irq =3D pci_allocate_irq(pci_dev); s->phys_mem_read =3D pci_physical_memory_read; s->phys_mem_write =3D pci_physical_memory_write; - s->dma_opaque =3D pci_dev; + s->dma_opaque =3D DEVICE(pci_dev); =20 pcnet_common_init(DEVICE(pci_dev), s, &net_pci_pcnet_info); } diff --git a/hw/net/pcnet.h b/hw/net/pcnet.h index 28d19a5c6f..f49b213c57 100644 --- a/hw/net/pcnet.h +++ b/hw/net/pcnet.h @@ -50,7 +50,7 @@ struct PCNetState_st { uint8_t *buf, int len, int do_bswap); void (*phys_mem_write)(void *dma_opaque, hwaddr addr, uint8_t *buf, int len, int do_bswap); - void *dma_opaque; + DeviceState *dma_opaque; int tx_busy; int looptest; }; --=20 2.24.0.308.g228f53135a From nobody Thu May 2 22:13:26 2024 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576850503; cv=none; d=zohomail.com; s=zohoarc; b=BtkKW1YRJdGNSkYY7BN7H0+Fty7ffEqWMpWRSgECtZfK+uNJaEtrhP8QkJAzyvpVEktr7Y3511e3xsXhzjA9pl1gGWr0mlP8/cROJaXxG0A8A1d0U+kONQBHxlAlp9Cqe7OcTlxEiUlEjo67QSbozPbEctd3NhWosR0I7YIaCsY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576850503; 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=GbZiKS+blW7WVyngDpM1z/KZAtzSaRqDcOpp9FbODkY=; b=ZqvrkM5M9pbpTSpYMOzIUiB+nOMydLHg7PapWzUm76KCJTkJIxTyokVo5jCpSjLt7n0y5z12o2+1g+WznpgTLyRM6GVxMtmotK6D1DxfslMQlul8NUDHJClrErZ61QLBYXVcXy/uLlw/E/D6yUS204TSdWOgn3CN61kV2Fy7pYw= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576850503660386.37158474577234; Fri, 20 Dec 2019 06:01:43 -0800 (PST) Received: from localhost ([::1]:56370 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIqc-0000fQ-4N for importer@patchew.org; Fri, 20 Dec 2019 09:01:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58740) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIfb-0008Er-LW for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:50:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiIfZ-0000tk-Rt for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:50:19 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:22259 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 1iiIfZ-0000qo-Bu for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:50:17 -0500 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-238-O6WYJMZXNR-mx0Ki7hR6XA-1; Fri, 20 Dec 2019 08:50:15 -0500 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 3389A1B18BF3; Fri, 20 Dec 2019 13:50:14 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id E2C155C54A; Fri, 20 Dec 2019 13:50:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576849816; 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=GbZiKS+blW7WVyngDpM1z/KZAtzSaRqDcOpp9FbODkY=; b=EGf+i3gxJuFH0dKe0d95NxCO5zh7U2V18a8L8JjKjUQwhcBxFSTjdc/xiBkwcy8A4gKyGE R1K8Vx8XfErRqzjQ7RKPFj7FOATu7oOowR6njwiBPl3Drupl79rc0ClQccVrFnSfmmzcTA jCJnFnKC5vQ2HKrJxpBgTp7lfwvJjQQ= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH v5 24/37] etraxfs: remove PROP_PTR usage Date: Fri, 20 Dec 2019 17:45:48 +0400 Message-Id: <20191220134601.571905-25-marcandre.lureau@redhat.com> In-Reply-To: <20191220134601.571905-1-marcandre.lureau@redhat.com> References: <20191220134601.571905-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: O6WYJMZXNR-mx0Ki7hR6XA-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: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" etraxfs_dma_client are not Object, so can't be exposed to user with QOM path. Let's remove property usage and move the constructor to the .c unit, simplifying some code on the way. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Peter Maydell --- hw/net/etraxfs_eth.c | 44 +++++++++++++++++++++++++++++---------- include/hw/cris/etraxfs.h | 20 +++--------------- 2 files changed, 36 insertions(+), 28 deletions(-) diff --git a/hw/net/etraxfs_eth.c b/hw/net/etraxfs_eth.c index 4cfbf1135a..f30d963487 100644 --- a/hw/net/etraxfs_eth.c +++ b/hw/net/etraxfs_eth.c @@ -338,14 +338,8 @@ typedef struct ETRAXFSEthState uint8_t macaddr[2][6]; uint32_t regs[FS_ETH_MAX_REGS]; =20 - union { - void *vdma_out; - struct etraxfs_dma_client *dma_out; - }; - union { - void *vdma_in; - struct etraxfs_dma_client *dma_in; - }; + struct etraxfs_dma_client *dma_out; + struct etraxfs_dma_client *dma_in; =20 /* MDIO bus. */ struct qemu_mdio mdio_bus; @@ -635,8 +629,6 @@ static void etraxfs_eth_realize(DeviceState *dev, Error= **errp) =20 static Property etraxfs_eth_properties[] =3D { DEFINE_PROP_UINT32("phyaddr", ETRAXFSEthState, phyaddr, 1), - DEFINE_PROP_PTR("dma_out", ETRAXFSEthState, vdma_out), - DEFINE_PROP_PTR("dma_in", ETRAXFSEthState, vdma_in), DEFINE_NIC_PROPERTIES(ETRAXFSEthState, conf), DEFINE_PROP_END_OF_LIST(), }; @@ -648,10 +640,40 @@ static void etraxfs_eth_class_init(ObjectClass *klass= , void *data) dc->realize =3D etraxfs_eth_realize; dc->reset =3D etraxfs_eth_reset; dc->props =3D etraxfs_eth_properties; - /* Reason: pointer properties "dma_out", "dma_in" */ + /* Reason: dma_out, dma_in are not user settable */ dc->user_creatable =3D false; } =20 + +/* Instantiate an ETRAXFS Ethernet MAC. */ +DeviceState * +etraxfs_eth_init(NICInfo *nd, hwaddr base, int phyaddr, + struct etraxfs_dma_client *dma_out, + struct etraxfs_dma_client *dma_in) +{ + DeviceState *dev; + qemu_check_nic_model(nd, "fseth"); + + dev =3D qdev_create(NULL, "etraxfs-eth"); + qdev_set_nic_properties(dev, nd); + qdev_prop_set_uint32(dev, "phyaddr", phyaddr); + + /* + * TODO: QOM design, define a QOM interface for "I am an etraxfs + * DMA client" (which replaces the current 'struct + * etraxfs_dma_client' ad-hoc interface), implement it on the + * ethernet device, and then have QOM link properties on the DMA + * controller device so that you can pass the interface + * implementations to it. + */ + ETRAX_FS_ETH(dev)->dma_out =3D dma_out; + ETRAX_FS_ETH(dev)->dma_in =3D dma_in; + qdev_init_nofail(dev); + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); + + return dev; +} + static const TypeInfo etraxfs_eth_info =3D { .name =3D TYPE_ETRAX_FS_ETH, .parent =3D TYPE_SYS_BUS_DEVICE, diff --git a/include/hw/cris/etraxfs.h b/include/hw/cris/etraxfs.h index aa146a2cd8..403e7f95e6 100644 --- a/include/hw/cris/etraxfs.h +++ b/include/hw/cris/etraxfs.h @@ -30,23 +30,9 @@ #include "hw/qdev-properties.h" #include "hw/sysbus.h" =20 -/* Instantiate an ETRAXFS Ethernet MAC. */ -static inline DeviceState * -etraxfs_eth_init(NICInfo *nd, hwaddr base, int phyaddr, - void *dma_out, void *dma_in) -{ - DeviceState *dev; - qemu_check_nic_model(nd, "fseth"); - - dev =3D qdev_create(NULL, "etraxfs-eth"); - qdev_set_nic_properties(dev, nd); - qdev_prop_set_uint32(dev, "phyaddr", phyaddr); - qdev_prop_set_ptr(dev, "dma_out", dma_out); - qdev_prop_set_ptr(dev, "dma_in", dma_in); - qdev_init_nofail(dev); - sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); - return dev; -} +DeviceState *etraxfs_eth_init(NICInfo *nd, hwaddr base, int phyaddr, + struct etraxfs_dma_client *dma_out, + struct etraxfs_dma_client *dma_in); =20 static inline DeviceState *etraxfs_ser_create(hwaddr addr, qemu_irq irq, --=20 2.24.0.308.g228f53135a From nobody Thu May 2 22:13:26 2024 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576850693; cv=none; d=zohomail.com; s=zohoarc; b=IUv3FnyuXdwf7VWoun4AkmJNjGxqpnBr//MT6uLsZFKlSo7PZFUxnpgITFIqJ91AWyJJBMRq0u0joJ9J5b0M4myNRUzxwFbMlSn7d6mwuDgt7npTfKnT5oDB7uEjhFmBODdVkhdkLCrV5HRq583JTOxqxAVZ0brFfCIw6Mvu66c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576850693; 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=HcOyfcUqsCprWlVg9+bDmmZWO5FQ8DKCzgD+fdRLd7Y=; b=D3qiB16KiA3I9q6pqajiFohChgFUYnOPZ+Qiv6zCXaZ8j23UaNcOa9zXxRfM27EJ2uIRtSBROE812Vb/ZAobsf45ZnaWbyTQuLYZ994VS3AIcSrONxZvA7omyjqJ9LWtCzb8e9xvxWqtHFm6v0lGbCDuZ6b6xxMAl/46Eqpd1HA= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576850693957529.1918028620769; Fri, 20 Dec 2019 06:04:53 -0800 (PST) Received: from localhost ([::1]:56404 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiItg-0004Oe-37 for importer@patchew.org; Fri, 20 Dec 2019 09:04:52 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60685) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIfo-0000Ll-8Z for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:50:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiIfm-0001eE-TJ for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:50:32 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:20707 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iiIfm-0001bz-N8 for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:50:30 -0500 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-13-IaulqokZNJCrGoR80hXQ7g-1; Fri, 20 Dec 2019 08:50:25 -0500 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 5A0501083E96; Fri, 20 Dec 2019 13:50:24 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id B07285DA70; Fri, 20 Dec 2019 13:50:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576849830; 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=HcOyfcUqsCprWlVg9+bDmmZWO5FQ8DKCzgD+fdRLd7Y=; b=DKfT4ImgmbhmVV3slrQ+u3SCdfN+SWEXbpcOGlgYXb3v0Y8wtU2wzJ5uS9su3agZZFyqK5 pJDbW8t+morqaHn3kwheZ3mu5SvAwMGbYrZzm16gKnHNpp/hlNLETfA7STae0O+MRL7u+r WTbAbbhCVNTJrBNan75+EdcDv6jY8t8= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH v5 25/37] dp8393x: replace PROP_PTR with PROP_LINK Date: Fri, 20 Dec 2019 17:45:49 +0400 Message-Id: <20191220134601.571905-26-marcandre.lureau@redhat.com> In-Reply-To: <20191220134601.571905-1-marcandre.lureau@redhat.com> References: <20191220134601.571905-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: IaulqokZNJCrGoR80hXQ7g-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: 207.211.31.120 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: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Link property is the correct way to pass a MemoryRegion to a device for DMA purposes. Sidenote: as a sysbus device, this remains non-usercreatable even though we can drop the specific flag here. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Laurent Vivier Tested-by: Laurent Vivier --- hw/m68k/q800.c | 3 ++- hw/mips/mips_jazz.c | 3 ++- hw/net/dp8393x.c | 7 +++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index 4ca8678007..8f3eb6bfe7 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -239,7 +239,8 @@ static void q800_init(MachineState *machine) qdev_set_nic_properties(dev, &nd_table[0]); qdev_prop_set_uint8(dev, "it_shift", 2); qdev_prop_set_bit(dev, "big_endian", true); - qdev_prop_set_ptr(dev, "dma_mr", get_system_memory()); + object_property_set_link(OBJECT(dev), OBJECT(get_system_memory()), + "dma_mr", &error_abort); qdev_init_nofail(dev); sysbus =3D SYS_BUS_DEVICE(dev); sysbus_mmio_map(sysbus, 0, SONIC_BASE); diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c index 291fd6c1b8..66fd4d867d 100644 --- a/hw/mips/mips_jazz.c +++ b/hw/mips/mips_jazz.c @@ -290,7 +290,8 @@ static void mips_jazz_init(MachineState *machine, dev =3D qdev_create(NULL, "dp8393x"); qdev_set_nic_properties(dev, nd); qdev_prop_set_uint8(dev, "it_shift", 2); - qdev_prop_set_ptr(dev, "dma_mr", rc4030_dma_mr); + object_property_set_link(OBJECT(dev), OBJECT(rc4030_dma_mr), + "dma_mr", &error_abort); qdev_init_nofail(dev); sysbus =3D SYS_BUS_DEVICE(dev); sysbus_mmio_map(sysbus, 0, 0x80001000); diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c index 3d991af163..cdc2631c0c 100644 --- a/hw/net/dp8393x.c +++ b/hw/net/dp8393x.c @@ -175,7 +175,7 @@ typedef struct dp8393xState { int loopback_packet; =20 /* Memory access */ - void *dma_mr; + MemoryRegion *dma_mr; AddressSpace as; } dp8393xState; =20 @@ -948,7 +948,8 @@ static const VMStateDescription vmstate_dp8393x =3D { =20 static Property dp8393x_properties[] =3D { DEFINE_NIC_PROPERTIES(dp8393xState, conf), - DEFINE_PROP_PTR("dma_mr", dp8393xState, dma_mr), + DEFINE_PROP_LINK("dma_mr", dp8393xState, dma_mr, + TYPE_MEMORY_REGION, MemoryRegion *), DEFINE_PROP_UINT8("it_shift", dp8393xState, it_shift, 0), DEFINE_PROP_BOOL("big_endian", dp8393xState, big_endian, false), DEFINE_PROP_END_OF_LIST(), @@ -963,8 +964,6 @@ static void dp8393x_class_init(ObjectClass *klass, void= *data) dc->reset =3D dp8393x_reset; dc->vmsd =3D &vmstate_dp8393x; dc->props =3D dp8393x_properties; - /* Reason: dma_mr property can't be set */ - dc->user_creatable =3D false; } =20 static const TypeInfo dp8393x_info =3D { --=20 2.24.0.308.g228f53135a From nobody Thu May 2 22:13:26 2024 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576850842; cv=none; d=zohomail.com; s=zohoarc; b=gERsL8L2vlZh0MVkXGvOYlfnoaDOw5ZpSg0WKno8WtBHest0CKBM0emsTlIjRpRPJvwcNKVqzEe66McjddcmTTJ0s47PY8lbMdSiltTe/6E7uYknoDRsCEHGDsbFubtrQrJ2JZD4ldxFdlGy2/pM0gS9Z5lkPOFTkSqsJEQOCSk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576850842; 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=yOgEXzzc0gfTR2eW1V/aDqaiBliZrQ+0WpifukCAXSE=; b=L5hr91rO5kPPlq2N5Q/7z2KuIXrAxMFKtWNI5YNa63T2inXHXXGGFbVjX2nPa5H8r5Z0VooTkL+pbGdT41bKP6owrGdht//czfjtBuO3PlJu1usqSK9t8ffAxBI3QPXTpUCtnw2Di6S4EHWdRqTre8HV6+r9aGsv6ULxZ36cLAA= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576850842683658.1479929331613; Fri, 20 Dec 2019 06:07:22 -0800 (PST) Received: from localhost ([::1]:56478 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIw5-0000SV-Cj for importer@patchew.org; Fri, 20 Dec 2019 09:07:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33795) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIfx-0000hV-4Z for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:50:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiIfv-0002A4-Bp for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:50:40 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:43796 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 1iiIfv-000281-1n for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:50:39 -0500 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-108-HJYhG_ZYNDGX32OI0hRWnA-1; Fri, 20 Dec 2019 08:50:35 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 072C2107ACC5; Fri, 20 Dec 2019 13:50:35 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id C3DBB63BAC; Fri, 20 Dec 2019 13:50:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576849838; 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=yOgEXzzc0gfTR2eW1V/aDqaiBliZrQ+0WpifukCAXSE=; b=J2xamdzIUpQ6DQAJM9KNR6ZaN3SsqJyUXBduirKPi4kiHaksrJYOuuZCN3x0tK0N2933Ar NEQgUMZtWhgUUd/qCixABCYpCTuaRV+408pDVF1sNc+33F/0spg6tIF/qzA3V5v3ddW9oW +KrARMzky3ld3WW36UI10rpuj5o2odM= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH v5 26/37] leon3: use qemu_irq framework instead of callback as property Date: Fri, 20 Dec 2019 17:45:50 +0400 Message-Id: <20191220134601.571905-27-marcandre.lureau@redhat.com> In-Reply-To: <20191220134601.571905-1-marcandre.lureau@redhat.com> References: <20191220134601.571905-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: HJYhG_ZYNDGX32OI0hRWnA-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: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" "set_pin_in" property is used to define a callback mechanism where the device says "call the callback function, passing it an opaque cookie and a 32-bit value". We already have a generic mechanism for doing that, which is the qemu_irq. So we should just use that. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Peter Maydell Reviewed-by: KONRAD Frederic --- hw/intc/grlib_irqmp.c | 35 ++++------------------------------- hw/sparc/leon3.c | 13 +++++++++---- target/sparc/cpu.h | 1 + 3 files changed, 14 insertions(+), 35 deletions(-) diff --git a/hw/intc/grlib_irqmp.c b/hw/intc/grlib_irqmp.c index bc78e1a14f..794c643af2 100644 --- a/hw/intc/grlib_irqmp.c +++ b/hw/intc/grlib_irqmp.c @@ -25,6 +25,7 @@ */ =20 #include "qemu/osdep.h" +#include "hw/irq.h" #include "hw/sysbus.h" #include "cpu.h" =20 @@ -58,10 +59,8 @@ typedef struct IRQMP { =20 MemoryRegion iomem; =20 - void *set_pil_in; - void *set_pil_in_opaque; - IRQMPState *state; + qemu_irq irq; } IRQMP; =20 struct IRQMPState { @@ -82,7 +81,6 @@ static void grlib_irqmp_check_irqs(IRQMPState *state) uint32_t pend =3D 0; uint32_t level0 =3D 0; uint32_t level1 =3D 0; - set_pil_in_fn set_pil_in; =20 assert(state !=3D NULL); assert(state->parent !=3D NULL); @@ -97,14 +95,8 @@ static void grlib_irqmp_check_irqs(IRQMPState *state) trace_grlib_irqmp_check_irqs(state->pending, state->force[0], state->mask[0], level1, level0); =20 - set_pil_in =3D (set_pil_in_fn)state->parent->set_pil_in; - /* Trigger level1 interrupt first and level0 if there is no level1 */ - if (level1 !=3D 0) { - set_pil_in(state->parent->set_pil_in_opaque, level1); - } else { - set_pil_in(state->parent->set_pil_in_opaque, level0); - } + qemu_set_irq(state->parent->irq, level1 ?: level0); } =20 static void grlib_irqmp_ack_mask(IRQMPState *state, uint32_t mask) @@ -335,6 +327,7 @@ static void grlib_irqmp_init(Object *obj) IRQMP *irqmp =3D GRLIB_IRQMP(obj); SysBusDevice *dev =3D SYS_BUS_DEVICE(obj); =20 + qdev_init_gpio_out_named(DEVICE(obj), &irqmp->irq, "grlib-irq", 1); memory_region_init_io(&irqmp->iomem, obj, &grlib_irqmp_ops, irqmp, "irqmp", IRQMP_REG_SIZE); =20 @@ -343,31 +336,11 @@ static void grlib_irqmp_init(Object *obj) sysbus_init_mmio(dev, &irqmp->iomem); } =20 -static void grlib_irqmp_realize(DeviceState *dev, Error **errp) -{ - IRQMP *irqmp =3D GRLIB_IRQMP(dev); - - /* Check parameters */ - if (irqmp->set_pil_in =3D=3D NULL) { - error_setg(errp, "set_pil_in cannot be NULL."); - } -} - -static Property grlib_irqmp_properties[] =3D { - DEFINE_PROP_PTR("set_pil_in", IRQMP, set_pil_in), - DEFINE_PROP_PTR("set_pil_in_opaque", IRQMP, set_pil_in_opaque), - DEFINE_PROP_END_OF_LIST(), -}; - static void grlib_irqmp_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); =20 dc->reset =3D grlib_irqmp_reset; - dc->props =3D grlib_irqmp_properties; - /* Reason: pointer properties "set_pil_in", "set_pil_in_opaque" */ - dc->user_creatable =3D false; - dc->realize =3D grlib_irqmp_realize; } =20 static const TypeInfo grlib_irqmp_info =3D { diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c index c5f1b1ee72..cac987373e 100644 --- a/hw/sparc/leon3.c +++ b/hw/sparc/leon3.c @@ -143,9 +143,14 @@ void leon3_irq_ack(void *irq_manager, int intno) grlib_irqmp_ack((DeviceState *)irq_manager, intno); } =20 -static void leon3_set_pil_in(void *opaque, uint32_t pil_in) +/* + * This device assumes that the incoming 'level' value on the + * qemu_irq is the interrupt number, not just a simple 0/1 level. + */ +static void leon3_set_pil_in(void *opaque, int n, int level) { - CPUSPARCState *env =3D (CPUSPARCState *)opaque; + CPUSPARCState *env =3D opaque; + uint32_t pil_in =3D level; CPUState *cs; =20 assert(env !=3D NULL); @@ -225,8 +230,8 @@ static void leon3_generic_hw_init(MachineState *machine) =20 /* Allocate IRQ manager */ dev =3D qdev_create(NULL, TYPE_GRLIB_IRQMP); - qdev_prop_set_ptr(dev, "set_pil_in", leon3_set_pil_in); - qdev_prop_set_ptr(dev, "set_pil_in_opaque", env); + env->pil_irq =3D qemu_allocate_irq(leon3_set_pil_in, env, 0); + qdev_connect_gpio_out_named(dev, "grlib-irq", 0, env->pil_irq); qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, LEON3_IRQMP_OFFSET); env->irq_manager =3D dev; diff --git a/target/sparc/cpu.h b/target/sparc/cpu.h index ae97c7d9f7..e70fec0133 100644 --- a/target/sparc/cpu.h +++ b/target/sparc/cpu.h @@ -541,6 +541,7 @@ struct CPUSPARCState { #endif sparc_def_t def; =20 + qemu_irq pil_irq; void *irq_manager; void (*qemu_irq_ack)(CPUSPARCState *env, void *irq_manager, int intno); =20 --=20 2.24.0.308.g228f53135a From nobody Thu May 2 22:13:26 2024 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576851188; cv=none; d=zohomail.com; s=zohoarc; b=J5bA+f4pLYaURAe4XtCYtJwkNUZJ+eMhLFJc/xivPG62a0dge/f+CSntevFY5tWnNKfaRVUbm1JGGaj5I/eS9kRSBVTFbUI9wY52gaMwpuj8zwGY648Bw/+oM/f3Bdd8vsDrmL+6tEn8ptwF2MdltFn2NZTu31cBPeTqrnc9fuY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576851188; 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=VwvQJnqZ7sA5Ycmaivwhe/h8pqHvFfz4F/J89x2f6/Y=; b=Y38l+owB5G775kl7KLGnctZTfn8PjEtkYffh9GwsPApol6XHWH+F6Z/tf8T4xgoBqZ8rFeD+6Ox9Xgd3QYTl1CyXzHxieXGDnxivQENoEcb3GAT+r+n47GkhinI6TwgjFpJLcDxMiuh0GhvtIWlmUDyVA4/OL2Re2yBe8yUcnd4= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576851188529860.5999447509821; Fri, 20 Dec 2019 06:13:08 -0800 (PST) Received: from localhost ([::1]:56580 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiJ1e-0000dO-Ji for importer@patchew.org; Fri, 20 Dec 2019 09:13:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34651) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIg8-00016b-1z for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:50:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiIg6-0002ZC-5m for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:50:51 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:46733 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 1iiIg4-0002Wh-2V for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:50:48 -0500 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-298-TD0hldnjMkKgFkMpSCoRIw-1; Fri, 20 Dec 2019 08:50:46 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0FB948DBDBD; Fri, 20 Dec 2019 13:50:45 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6C46926FB3; Fri, 20 Dec 2019 13:50:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576849847; 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=VwvQJnqZ7sA5Ycmaivwhe/h8pqHvFfz4F/J89x2f6/Y=; b=SrxJMA35cddJ/0oX32X0zMxTlIzYge5bAr9Bo28D36wTUZiaEiP3sfaAWxb/sz+kMYygo9 lFkaYCdeOAPTsPgiCQyisvSMvLlsXaikj7goIUvG0kpJbMhFC8B36FGWoVodvnpGzHIoOU P67RYRiwQD7/PSRvCUIl560e4TX3sNI= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH v5 27/37] leon3: use qdev gpio facilities for the PIL Date: Fri, 20 Dec 2019 17:45:51 +0400 Message-Id: <20191220134601.571905-28-marcandre.lureau@redhat.com> In-Reply-To: <20191220134601.571905-1-marcandre.lureau@redhat.com> References: <20191220134601.571905-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: TD0hldnjMkKgFkMpSCoRIw-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: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" As Peter Maydell once said: "Creating a gpio pin on some object that isn't yourself looks a bit odd, but all this leon3 code is modifying the CPU object from the outside anyway. Someday we might tidy it up, but not today." Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/sparc/leon3.c | 6 ++++-- target/sparc/cpu.h | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c index cac987373e..8038887ff7 100644 --- a/hw/sparc/leon3.c +++ b/hw/sparc/leon3.c @@ -230,8 +230,10 @@ static void leon3_generic_hw_init(MachineState *machin= e) =20 /* Allocate IRQ manager */ dev =3D qdev_create(NULL, TYPE_GRLIB_IRQMP); - env->pil_irq =3D qemu_allocate_irq(leon3_set_pil_in, env, 0); - qdev_connect_gpio_out_named(dev, "grlib-irq", 0, env->pil_irq); + qdev_init_gpio_in_named_with_opaque(DEVICE(cpu), leon3_set_pil_in, + env, "pil", 1); + qdev_connect_gpio_out_named(dev, "grlib-irq", 0, + qdev_get_gpio_in_named(DEVICE(cpu), "pil",= 0)); qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, LEON3_IRQMP_OFFSET); env->irq_manager =3D dev; diff --git a/target/sparc/cpu.h b/target/sparc/cpu.h index e70fec0133..ae97c7d9f7 100644 --- a/target/sparc/cpu.h +++ b/target/sparc/cpu.h @@ -541,7 +541,6 @@ struct CPUSPARCState { #endif sparc_def_t def; =20 - qemu_irq pil_irq; void *irq_manager; void (*qemu_irq_ack)(CPUSPARCState *env, void *irq_manager, int intno); =20 --=20 2.24.0.308.g228f53135a From nobody Thu May 2 22:13:26 2024 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576850528; cv=none; d=zohomail.com; s=zohoarc; b=hvPUo32EKvnfmYUbfdEMC8gHp1iSdeH3GWdyAxSHS7SRfjn2AnMHrYbpSRnxEBMg4jJAwkAlHV3cuMxk3RdNnBLJokFhnr519FiGgBbupKhwM3lDdyFAxDfcsRCQjgv9sUstHtuRaarYUv0V/x3bhgMUnhkoTxRnVxrU0HsWCfQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576850528; 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=dfuYN8YWmN5oz0foLzHhOai8L2U2g3A3C5ZN+e389jI=; b=KGockff8zPWlfC2ydpRuJoo28a9lmUN/m2aQYWhFxvW246SfnjtmJJDPx7AgkJLoHdREmBzD2S7miXU/lzGCLvQPpAopsBsgxW6InXuBqpBjlb+fPcnLD2tiLJIRne7TLggwHohHeZUQvAzexscOYYuPQIsk8Z5BkY9JYaX46uQ= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 157685052802187.57803901713294; Fri, 20 Dec 2019 06:02:08 -0800 (PST) Received: from localhost ([::1]:56374 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIr0-0001JG-CQ for importer@patchew.org; Fri, 20 Dec 2019 09:02:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35183) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIgH-0001JZ-If for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:51:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiIgG-0002oR-F5 for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:51:01 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:20374 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iiIgG-0002m8-57 for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:51:00 -0500 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-248-nc_6oMnWNSKUdnTHjFVr8g-1; Fri, 20 Dec 2019 08:50:55 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 258C9113787B; Fri, 20 Dec 2019 13:50:54 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6C5C16B566; Fri, 20 Dec 2019 13:50:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576849858; 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=dfuYN8YWmN5oz0foLzHhOai8L2U2g3A3C5ZN+e389jI=; b=PYP1iREkNgLQDDEtyNZ44sZXo3PZUnkuDLOIULBsl5uGyxC8oFdnMOFhow3cWFOgJuu2aR c6M0GPQA4LDaFRDLlW1kz2DPwASuQORihXTti9QnF34/UJKY/nv4M4+0Ga0Zb1uEOEcGai AaJmUR13/S21eCxnqIrB4jvsldYxtqQ= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH v5 28/37] qdev: use g_strcmp0() instead of open-coding it Date: Fri, 20 Dec 2019 17:45:52 +0400 Message-Id: <20191220134601.571905-29-marcandre.lureau@redhat.com> In-Reply-To: <20191220134601.571905-1-marcandre.lureau@redhat.com> References: <20191220134601.571905-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: nc_6oMnWNSKUdnTHjFVr8g-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.120 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: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Minor code simplification. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/core/qdev.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 82d3ee590a..98e786c50f 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -394,11 +394,8 @@ static NamedGPIOList *qdev_get_named_gpio_list(DeviceS= tate *dev, NamedGPIOList *ngl; =20 QLIST_FOREACH(ngl, &dev->gpios, node) { - /* NULL is a valid and matchable name, otherwise do a normal - * strcmp match. - */ - if ((!ngl->name && !name) || - (name && ngl->name && strcmp(name, ngl->name) =3D=3D 0)) { + /* NULL is a valid and matchable name. */ + if (g_strcmp0(name, ngl->name) =3D=3D 0) { return ngl; } } --=20 2.24.0.308.g228f53135a From nobody Thu May 2 22:13:26 2024 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576850724; cv=none; d=zohomail.com; s=zohoarc; b=EpyPdFeUG4I7atOkIXCZETJ/UK+wgIXhzwfLFvph6iq9lULqESiorNoNna52J/IvQ2tdc6yxlqtqd2h4+lebpOwtZuUutVaPYAbf8rBAvM24KiLPekwJcGDO+nhkqsbDeFMOIYF9cc/3ZJOdohVugGKemy0hpRxwtsvBDXdNI2g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576850724; 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=Ev3yRDnlWklD0FJ+yQdjg+lQqzvkUOOvzQLOYoYtmMk=; b=mOfZQxh1bgqwp9KbSkrJE8j56r4GVmLAPo15DlqErF3EyQHQ1JfE8c3wKSA9naNNhd11MjABTrNOLEGgkoIMFO+5igOQUFFkclYd9YaX60GuRGb1VZuyHrH5yug8/y8hClfUJ5jtd7ZtZgqj2p4G/cmlAFOuED9skyAlEljdMGY= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576850724117252.79799457858724; Fri, 20 Dec 2019 06:05:24 -0800 (PST) Received: from localhost ([::1]:56410 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIuA-0004sM-5N for importer@patchew.org; Fri, 20 Dec 2019 09:05:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36502) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIgP-0001WT-5X for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:51:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiIgO-0003Jp-3K for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:51:09 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:22892 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 1iiIgN-0003HZ-Pi for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:51:07 -0500 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-410-gJ7GMJ2RPSKpdypzDDvrqA-1; Fri, 20 Dec 2019 08:51:06 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5351B800D48; Fri, 20 Dec 2019 13:51:05 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7B07D6046B; Fri, 20 Dec 2019 13:51:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576849867; 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=Ev3yRDnlWklD0FJ+yQdjg+lQqzvkUOOvzQLOYoYtmMk=; b=BZB/ASZWxx2rftGWbKVoUKkPDi+lZJUMzRAWtsEoGPJvx2UV/BimG5yD4IVnEMis3fVueA dMl1icZeRsLS3myi7buzl0yo5JLx/3B7zVQHZiZsM4Zh0wwxK3EXapQCxyYfkTVn3nxFdF dWPy0q0b0w4wAPnpW0PtQMrSeP1svvo= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH v5 29/37] mips/cps: fix setting saar property Date: Fri, 20 Dec 2019 17:45:53 +0400 Message-Id: <20191220134601.571905-30-marcandre.lureau@redhat.com> In-Reply-To: <20191220134601.571905-1-marcandre.lureau@redhat.com> References: <20191220134601.571905-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: gJ7GMJ2RPSKpdypzDDvrqA-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: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" There is no "saar" property. Note: I haven't been able to test this code. Help welcome. May fix commit 043715d1e0fbb3e3411be3f898c5b77b7f90327a ("target/mips: Update ITU to utilize SAARI and SAAR CP0 registers") Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Aleksandar Markovic --- hw/mips/cps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/mips/cps.c b/hw/mips/cps.c index 1660f86908..c49868d5da 100644 --- a/hw/mips/cps.c +++ b/hw/mips/cps.c @@ -106,7 +106,7 @@ static void mips_cps_realize(DeviceState *dev, Error **= errp) object_property_set_bool(OBJECT(&s->itu), saar_present, "saar-pres= ent", &err); if (saar_present) { - qdev_prop_set_ptr(DEVICE(&s->itu), "saar", (void *)&env->CP0_S= AAR); + s->itu.saar =3D &env->CP0_SAAR; } object_property_set_bool(OBJECT(&s->itu), true, "realized", &err); if (err !=3D NULL) { --=20 2.24.0.308.g228f53135a From nobody Thu May 2 22:13:26 2024 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576850860; cv=none; d=zohomail.com; s=zohoarc; b=Oi60rkQL3wqDOndCjRKmn+B5bj+AE07tNvZUo+KcWKBNakpcxqzO55wHFxMEwTsA7trmyZTa0KCBlPmpFPb9dULPY/4Hk4lMGG25E0X8nIvIOTMmjxQHkv5M0VHLED2TdBNw4rvjVBs6IXTxbffvihSRILxkw4Kj5q7nQSpvmUE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576850860; 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=PPx08BopiHXZa7B3PA/Z39xri88cttLR72DVl8lC5xQ=; b=YiQOJ6xGDs2qXNDCtRSDZdQPS0yGa6JrNbm6Mc6X7eHi5OVosafNntUF8l9bWadktKDG6XEPDPsJZ7NCk3S+dUyMhKeVrFFiwPiq9Lsjgl9r1nYNmMvXuDPc1ITATE5lUZwcDCC2lR+0AvOM3lS5Vb2dqTRp2//UG64dItba5so= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576850860949975.3783035627868; Fri, 20 Dec 2019 06:07:40 -0800 (PST) Received: from localhost ([::1]:56482 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIwN-0000zA-7q for importer@patchew.org; Fri, 20 Dec 2019 09:07:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38976) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIgd-0001vd-5n for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:51:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiIgb-0004GZ-Lh for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:51:23 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:59592 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 1iiIgb-0004ER-Gt for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:51:21 -0500 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-140-ThTFYdbVPSe-3rTVoYCyvw-1; Fri, 20 Dec 2019 08:51:18 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9D442800053; Fri, 20 Dec 2019 13:51:17 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id AEDF06E41F; Fri, 20 Dec 2019 13:51:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576849881; 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=PPx08BopiHXZa7B3PA/Z39xri88cttLR72DVl8lC5xQ=; b=R8sQNeLNwdO7kDemnFsRDO/x+Qlj9FbJHCGpdbq/E9ooiWGsjazrDhT/I6GbjarxnDjxCv iCwAFu9KCw9A9lWj28nSBNo0d60lRS+QidZdP2qSYA3gHQigAKKo+sp7hB9SmikFAnhDy0 KCvk+a8wlvZIG/w/eaFr4KxqIpczMzs= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH v5 30/37] cris: improve passing PIC interrupt vector to the CPU Date: Fri, 20 Dec 2019 17:45:54 +0400 Message-Id: <20191220134601.571905-31-marcandre.lureau@redhat.com> In-Reply-To: <20191220134601.571905-1-marcandre.lureau@redhat.com> References: <20191220134601.571905-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: ThTFYdbVPSe-3rTVoYCyvw-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: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Instead of accessing cpu interrupt vector directly from PIC, send the vector value over the qemu_irq. Suggested-by: Peter Maydell Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/cris/axis_dev88.c | 4 ---- hw/intc/etraxfs_pic.c | 26 +------------------------- target/cris/cpu.c | 8 ++++++++ target/cris/cpu.h | 1 + 4 files changed, 10 insertions(+), 29 deletions(-) diff --git a/hw/cris/axis_dev88.c b/hw/cris/axis_dev88.c index 940c7dd122..be7760476a 100644 --- a/hw/cris/axis_dev88.c +++ b/hw/cris/axis_dev88.c @@ -253,7 +253,6 @@ void axisdev88_init(MachineState *machine) const char *kernel_filename =3D machine->kernel_filename; const char *kernel_cmdline =3D machine->kernel_cmdline; CRISCPU *cpu; - CPUCRISState *env; DeviceState *dev; SysBusDevice *s; DriveInfo *nand; @@ -267,7 +266,6 @@ void axisdev88_init(MachineState *machine) =20 /* init CPUs */ cpu =3D CRIS_CPU(cpu_create(machine->cpu_type)); - env =3D &cpu->env; =20 /* allocate RAM */ memory_region_allocate_system_memory(phys_ram, NULL, "axisdev88.ram", @@ -297,8 +295,6 @@ void axisdev88_init(MachineState *machine) =20 =20 dev =3D qdev_create(NULL, "etraxfs,pic"); - /* FIXME: Is there a proper way to signal vectors to the CPU core? */ - qdev_prop_set_ptr(dev, "interrupt_vector", &env->interrupt_vector); qdev_init_nofail(dev); s =3D SYS_BUS_DEVICE(dev); sysbus_mmio_map(s, 0, 0x3001c000); diff --git a/hw/intc/etraxfs_pic.c b/hw/intc/etraxfs_pic.c index 77f652acec..12988c7aa9 100644 --- a/hw/intc/etraxfs_pic.c +++ b/hw/intc/etraxfs_pic.c @@ -27,8 +27,6 @@ #include "qemu/module.h" #include "hw/irq.h" #include "hw/qdev-properties.h" -//#include "pc.h" -//#include "etraxfs.h" =20 #define D(x) =20 @@ -48,7 +46,6 @@ struct etrax_pic SysBusDevice parent_obj; =20 MemoryRegion mmio; - void *interrupt_vector; qemu_irq parent_irq; qemu_irq parent_nmi; uint32_t regs[R_MAX]; @@ -79,11 +76,7 @@ static void pic_update(struct etrax_pic *fs) } } =20 - if (fs->interrupt_vector) { - /* hack alert: ptr property */ - *(uint32_t*)(fs->interrupt_vector) =3D vector; - } - qemu_set_irq(fs->parent_irq, !!vector); + qemu_set_irq(fs->parent_irq, vector); } =20 static uint64_t @@ -163,28 +156,11 @@ static void etraxfs_pic_init(Object *obj) sysbus_init_mmio(sbd, &s->mmio); } =20 -static Property etraxfs_pic_properties[] =3D { - DEFINE_PROP_PTR("interrupt_vector", struct etrax_pic, interrupt_vector= ), - DEFINE_PROP_END_OF_LIST(), -}; - -static void etraxfs_pic_class_init(ObjectClass *klass, void *data) -{ - DeviceClass *dc =3D DEVICE_CLASS(klass); - - dc->props =3D etraxfs_pic_properties; - /* - * Note: pointer property "interrupt_vector" may remain null, thus - * no need for dc->user_creatable =3D false; - */ -} - static const TypeInfo etraxfs_pic_info =3D { .name =3D TYPE_ETRAX_FS_PIC, .parent =3D TYPE_SYS_BUS_DEVICE, .instance_size =3D sizeof(struct etrax_pic), .instance_init =3D etraxfs_pic_init, - .class_init =3D etraxfs_pic_class_init, }; =20 static void etraxfs_pic_register_types(void) diff --git a/target/cris/cpu.c b/target/cris/cpu.c index 7adfd6caf4..6a857f548d 100644 --- a/target/cris/cpu.c +++ b/target/cris/cpu.c @@ -147,6 +147,14 @@ static void cris_cpu_set_irq(void *opaque, int irq, in= t level) CPUState *cs =3D CPU(cpu); int type =3D irq =3D=3D CRIS_CPU_IRQ ? CPU_INTERRUPT_HARD : CPU_INTERR= UPT_NMI; =20 + if (irq =3D=3D CRIS_CPU_IRQ) { + /* + * The PIC passes us the vector for the IRQ as the value it sends + * over the qemu_irq line + */ + cpu->env.interrupt_vector =3D level; + } + if (level) { cpu_interrupt(cs, type); } else { diff --git a/target/cris/cpu.h b/target/cris/cpu.h index aba0a66474..a7c2a8e15b 100644 --- a/target/cris/cpu.h +++ b/target/cris/cpu.h @@ -34,6 +34,7 @@ #define CPU_INTERRUPT_NMI CPU_INTERRUPT_TGT_EXT_3 =20 /* CRUS CPU device objects interrupt lines. */ +/* PIC passes the vector for the IRQ as the value of it sends over qemu_ir= q */ #define CRIS_CPU_IRQ 0 #define CRIS_CPU_NMI 1 =20 --=20 2.24.0.308.g228f53135a From nobody Thu May 2 22:13:26 2024 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576851108; cv=none; d=zohomail.com; s=zohoarc; b=ItsZ1h2D29+CLLr/JLB6wTemPIkMSaY+D23e3wLjnfa6oOd73VFf+C2pG+AEnoD2QNSbhF3OEhLyC/IjiLc7YORXGDr6EgM/7JKY3hozAogQn65BtIEOMwikCBFrKTkFxYwBeXUI6q3hBdKAtuQqOcWQvYD1hk9Yhk+c+byvD2A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576851108; 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=seUv81PPqDXJefiGlBZFQYkFmzBhDZ7nbB04X8mdrrU=; b=fsxgUnJ6rjNS+9fPaoOMCcq98DXqndJGsAKKQas9Cyb9biFVA3IVzm4w3KrMoJtKz+6h88eOcxJqVXafOESqNxfPYpnckm4/8t2+hh1n7V+Z1ZPQtEi1xfwYOLaHdC7DM5IWh8rVhsFEF8gGMzDfE6ynBRp8SPHm8QIZXJRi9OU= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576851108389868.5375992220108; Fri, 20 Dec 2019 06:11:48 -0800 (PST) Received: from localhost ([::1]:56562 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiJ0N-0007Ur-5u for importer@patchew.org; Fri, 20 Dec 2019 09:11:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40289) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIgp-0002LI-7F for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:51:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiIgn-0004oR-4h for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:51:35 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:44867 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iiIgl-0004mx-Gf for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:51:31 -0500 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-440-A9V5SP1HMKytGFf4W7QhGA-1; Fri, 20 Dec 2019 08:51:29 -0500 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 8254391232; Fri, 20 Dec 2019 13:51:28 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0B4D95DA32; Fri, 20 Dec 2019 13:51:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576849891; 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=seUv81PPqDXJefiGlBZFQYkFmzBhDZ7nbB04X8mdrrU=; b=JioO+cyrpSaWA64rZ0f48diZj+z00SO7Vx9SwGjTJUnwM4DNbQNLnbyB9laoqru4jt/y+D F58DcOOwJe48maqIDUKu87c7JE3yYKBck2CQ4g2XxSxPvA0E+DwDCeRYg0ciyZY7UMuEwm Y3YRE+bpsXDPlLeerg7iYzq0o6NTHzg= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH v5 31/37] smbus-eeprom: remove PROP_PTR Date: Fri, 20 Dec 2019 17:45:55 +0400 Message-Id: <20191220134601.571905-32-marcandre.lureau@redhat.com> In-Reply-To: <20191220134601.571905-1-marcandre.lureau@redhat.com> References: <20191220134601.571905-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: A9V5SP1HMKytGFf4W7QhGA-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.120 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: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Instead, set the initial data field directly. (the initial data is an array of 256 bytes. As I don't know if it may change over time, I keep the pointer to original buffer as is, but it might be worth to consider to copy it instead) Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Corey Minyard --- hw/i2c/smbus_eeprom.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/hw/i2c/smbus_eeprom.c b/hw/i2c/smbus_eeprom.c index 54c86a0112..5adf3b15b5 100644 --- a/hw/i2c/smbus_eeprom.c +++ b/hw/i2c/smbus_eeprom.c @@ -44,7 +44,7 @@ typedef struct SMBusEEPROMDevice { SMBusDevice smbusdev; uint8_t data[SMBUS_EEPROM_SIZE]; - void *init_data; + uint8_t *init_data; uint8_t offset; bool accessed; } SMBusEEPROMDevice; @@ -129,14 +129,14 @@ static void smbus_eeprom_reset(DeviceState *dev) =20 static void smbus_eeprom_realize(DeviceState *dev, Error **errp) { + SMBusEEPROMDevice *eeprom =3D SMBUS_EEPROM(dev); + smbus_eeprom_reset(dev); + if (eeprom->init_data =3D=3D NULL) { + error_setg(errp, "init_data cannot be NULL"); + } } =20 -static Property smbus_eeprom_properties[] =3D { - DEFINE_PROP_PTR("data", SMBusEEPROMDevice, init_data), - DEFINE_PROP_END_OF_LIST(), -}; - static void smbus_eeprom_class_initfn(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); @@ -146,9 +146,8 @@ static void smbus_eeprom_class_initfn(ObjectClass *klas= s, void *data) dc->reset =3D smbus_eeprom_reset; sc->receive_byte =3D eeprom_receive_byte; sc->write_data =3D eeprom_write_data; - dc->props =3D smbus_eeprom_properties; dc->vmsd =3D &vmstate_smbus_eeprom; - /* Reason: pointer property "data" */ + /* Reason: init_data */ dc->user_creatable =3D false; } =20 @@ -172,7 +171,8 @@ void smbus_eeprom_init_one(I2CBus *smbus, uint8_t addre= ss, uint8_t *eeprom_buf) =20 dev =3D qdev_create((BusState *) smbus, TYPE_SMBUS_EEPROM); qdev_prop_set_uint8(dev, "address", address); - qdev_prop_set_ptr(dev, "data", eeprom_buf); + /* FIXME: use an array of byte or block backend property? */ + SMBUS_EEPROM(dev)->init_data =3D eeprom_buf; qdev_init_nofail(dev); } =20 --=20 2.24.0.308.g228f53135a From nobody Thu May 2 22:13:26 2024 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576850982; cv=none; d=zohomail.com; s=zohoarc; b=FEqJuL3oyqMNcjry6nQVso4bKT+f3yduo3+GZdGC3KMRTB9NGjQ1AE/nDwia6laVo52kCkLMj0CeQ8Pv2dS8/YzK5Xwa87UCHOp6P7PM4UiluZNbNvtkLPTdrI/OsHIKsp4HpDjqtFfSZMcDHRdh3xuEOyJmRm8RUazIxI7ZsKc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576850982; 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=gm3pPe9kJKXbgbMduC+s+fPdcaSSBqfEaV54R3uzB2s=; b=Zpzd0WSDj7wOrZDcHdrz1S0szERwugKcWaBbUw4r1cVinLFg2GPAQnWU2/l9a4LRhHlpgVLhkk232oAjTMKhMkObgRt6ZoPyz5TH6T+vfHNT5qOptJ/oWlYmQQ+bG2SGRnud2SQg5QDBCS87jPZwCHbTS//Lj35h+59l6bf4Js8= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576850982145866.8807277601576; Fri, 20 Dec 2019 06:09:42 -0800 (PST) Received: from localhost ([::1]:56516 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIyK-0004VO-NB for importer@patchew.org; Fri, 20 Dec 2019 09:09:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40475) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIgz-0002kV-PA for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:51:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiIgx-0004tZ-6g for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:51:45 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:46096 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 1iiIgw-0004s7-Ef for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:51:42 -0500 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-248-bAeovYU4OLuC_YX4O8ygyw-1; Fri, 20 Dec 2019 08:51:39 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7903C800053; Fri, 20 Dec 2019 13:51:38 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5FCFC63BB7; Fri, 20 Dec 2019 13:51:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576849900; 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=gm3pPe9kJKXbgbMduC+s+fPdcaSSBqfEaV54R3uzB2s=; b=GymEHY4LzAL6nRU8nefpH47qbNg5qZekDPCzwHd7AHQzg81Oa6Rsh7TH0+EKt3WUyEEIz0 8RzvA9935P0a71rkJ8B6MfsaQ06rs8qF5db6WukOXdQc3u1X3s6HfxuFgcQtRy4E8sWIQn yOLjsGZ4jgCWGZSrUMKPAH/7k6JzpNo= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH v5 32/37] omap-intc: remove PROP_PTR Date: Fri, 20 Dec 2019 17:45:56 +0400 Message-Id: <20191220134601.571905-33-marcandre.lureau@redhat.com> In-Reply-To: <20191220134601.571905-1-marcandre.lureau@redhat.com> References: <20191220134601.571905-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: bAeovYU4OLuC_YX4O8ygyw-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: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Since clocks are not QOM objects, replace PROP_PTR of clocks with setters methods. (in theory there should probably be different methods for omap1 & omap2 intc, but this is left as a future improvement) Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/omap1.c | 4 ++-- hw/arm/omap2.c | 4 ++-- hw/intc/omap_intc.c | 17 ++++++++++------- include/hw/arm/omap.h | 14 ++++++++++++++ 4 files changed, 28 insertions(+), 11 deletions(-) diff --git a/hw/arm/omap1.c b/hw/arm/omap1.c index 6ce038a453..1afd1d3d7f 100644 --- a/hw/arm/omap1.c +++ b/hw/arm/omap1.c @@ -3889,7 +3889,7 @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegio= n *dram, =20 s->ih[0] =3D qdev_create(NULL, "omap-intc"); qdev_prop_set_uint32(s->ih[0], "size", 0x100); - qdev_prop_set_ptr(s->ih[0], "clk", omap_findclk(s, "arminth_ck")); + omap_intc_set_iclk(OMAP_INTC(s->ih[0]), omap_findclk(s, "arminth_ck")); qdev_init_nofail(s->ih[0]); busdev =3D SYS_BUS_DEVICE(s->ih[0]); sysbus_connect_irq(busdev, 0, @@ -3899,7 +3899,7 @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegio= n *dram, sysbus_mmio_map(busdev, 0, 0xfffecb00); s->ih[1] =3D qdev_create(NULL, "omap-intc"); qdev_prop_set_uint32(s->ih[1], "size", 0x800); - qdev_prop_set_ptr(s->ih[1], "clk", omap_findclk(s, "arminth_ck")); + omap_intc_set_iclk(OMAP_INTC(s->ih[1]), omap_findclk(s, "arminth_ck")); qdev_init_nofail(s->ih[1]); busdev =3D SYS_BUS_DEVICE(s->ih[1]); sysbus_connect_irq(busdev, 0, diff --git a/hw/arm/omap2.c b/hw/arm/omap2.c index 457f152bac..1d7cc435ef 100644 --- a/hw/arm/omap2.c +++ b/hw/arm/omap2.c @@ -2308,8 +2308,8 @@ struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegi= on *sdram, /* Actually mapped at any 2K boundary in the ARM11 private-peripheral = if */ s->ih[0] =3D qdev_create(NULL, "omap2-intc"); qdev_prop_set_uint8(s->ih[0], "revision", 0x21); - qdev_prop_set_ptr(s->ih[0], "fclk", omap_findclk(s, "mpu_intc_fclk")); - qdev_prop_set_ptr(s->ih[0], "iclk", omap_findclk(s, "mpu_intc_iclk")); + omap_intc_set_fclk(OMAP_INTC(s->ih[0]), omap_findclk(s, "mpu_intc_fclk= ")); + omap_intc_set_iclk(OMAP_INTC(s->ih[0]), omap_findclk(s, "mpu_intc_iclk= ")); qdev_init_nofail(s->ih[0]); busdev =3D SYS_BUS_DEVICE(s->ih[0]); sysbus_connect_irq(busdev, 0, diff --git a/hw/intc/omap_intc.c b/hw/intc/omap_intc.c index 854b709ca0..73bb1c2af4 100644 --- a/hw/intc/omap_intc.c +++ b/hw/intc/omap_intc.c @@ -38,10 +38,6 @@ struct omap_intr_handler_bank_s { unsigned char priority[32]; }; =20 -#define TYPE_OMAP_INTC "common-omap-intc" -#define OMAP_INTC(obj) \ - OBJECT_CHECK(struct omap_intr_handler_s, (obj), TYPE_OMAP_INTC) - struct omap_intr_handler_s { SysBusDevice parent_obj; =20 @@ -391,9 +387,18 @@ static void omap_intc_realize(DeviceState *dev, Error = **errp) } } =20 +void omap_intc_set_iclk(omap_intr_handler *intc, omap_clk clk) +{ + intc->iclk =3D clk; +} + +void omap_intc_set_fclk(omap_intr_handler *intc, omap_clk clk) +{ + intc->fclk =3D clk; +} + static Property omap_intc_properties[] =3D { DEFINE_PROP_UINT32("size", struct omap_intr_handler_s, size, 0x100), - DEFINE_PROP_PTR("clk", struct omap_intr_handler_s, iclk), DEFINE_PROP_END_OF_LIST(), }; =20 @@ -647,8 +652,6 @@ static void omap2_intc_realize(DeviceState *dev, Error = **errp) static Property omap2_intc_properties[] =3D { DEFINE_PROP_UINT8("revision", struct omap_intr_handler_s, revision, 0x21), - DEFINE_PROP_PTR("iclk", struct omap_intr_handler_s, iclk), - DEFINE_PROP_PTR("fclk", struct omap_intr_handler_s, fclk), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/include/hw/arm/omap.h b/include/hw/arm/omap.h index f3aa670036..bcecf19f89 100644 --- a/include/hw/arm/omap.h +++ b/include/hw/arm/omap.h @@ -67,6 +67,20 @@ void omap_clk_setrate(omap_clk clk, int divide, int mult= iply); int64_t omap_clk_getrate(omap_clk clk); void omap_clk_reparent(omap_clk clk, omap_clk parent); =20 +/* omap_intc.c */ +#define TYPE_OMAP_INTC "common-omap-intc" +#define OMAP_INTC(obj) \ + OBJECT_CHECK(omap_intr_handler, (obj), TYPE_OMAP_INTC) + +typedef struct omap_intr_handler_s omap_intr_handler; + +/* + * TODO: Ideally we should have a clock framework that + * let us wire these clocks up with QOM properties or links. + */ +void omap_intc_set_iclk(omap_intr_handler *intc, omap_clk clk); +void omap_intc_set_fclk(omap_intr_handler *intc, omap_clk clk); + /* OMAP2 l4 Interconnect */ struct omap_l4_s; struct omap_l4_region_s { --=20 2.24.0.308.g228f53135a From nobody Thu May 2 22:13:26 2024 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576850999; cv=none; d=zohomail.com; s=zohoarc; b=J3U4EBJcMQ+t5R2ESj8kcLoYwKVb1/Yex4M+lntvWoFhYUoQyS4iKwWDyvMdT67Ww6vq7MCXHLbd8uhLYGbsZ9tPuLKRKRdJi2+j+2950iKifY0Qqqf1X7vqLlslvI7V4UtKNK7iMFpVLy4fryze+/xil6v2q6cacNQQn+QOc80= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576850999; 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=LTLGGZTG/MbrCo09iXWWajxYfTfsjukrIuoneCAyU6I=; b=en0hOJplAA1EZWc6eR4an5CAi5ruV7EIJG/Gu6zbHdrvfF1L9eDE8w+BDSzbJzifgSLPq9jPV/qtOsZDMbOTCfftK61DarewuqYOQrX+BqTC9sIwK47drouTeMXb+/Ti9mHJqP2br+0AqlH/+Kue6+c4Sz+XX8PWdUxaXTyYIDA= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576850999158797.8772940586791; Fri, 20 Dec 2019 06:09:59 -0800 (PST) Received: from localhost ([::1]:56524 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIyc-0004r1-12 for importer@patchew.org; Fri, 20 Dec 2019 09:09:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41157) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIh3-0002uI-Om for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:51:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiIh2-00056Z-Az for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:51:49 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:36827 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 1iiIh2-00053s-2X for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:51:48 -0500 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-363-JMxB_jG_PLilbXDZjG22EA-1; Fri, 20 Dec 2019 08:51:46 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 610CC91221; Fri, 20 Dec 2019 13:51:45 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id E4DFD63BB5; Fri, 20 Dec 2019 13:51:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576849907; 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=LTLGGZTG/MbrCo09iXWWajxYfTfsjukrIuoneCAyU6I=; b=WDZXVSunZB2082Y5Vw+VCWe4cBPeSRO+TBQU35kg6ZFIvaNExfwAae7vvqJG+QtKEnLQTo FXa11yFgH7xy+DeWu5of0oDa0zCKY5eO2oO1/OiWEEh2aORdcxRF0v/jafXuYfYpkgbux+ O0rR6cXOl3VUB3IhPgL4+2prk0q8x6A= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH v5 33/37] omap-i2c: remove PROP_PTR Date: Fri, 20 Dec 2019 17:45:57 +0400 Message-Id: <20191220134601.571905-34-marcandre.lureau@redhat.com> In-Reply-To: <20191220134601.571905-1-marcandre.lureau@redhat.com> References: <20191220134601.571905-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: JMxB_jG_PLilbXDZjG22EA-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: 207.211.31.81 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: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Since clocks are not QOM objects, replace PROP_PTR of clocks with setters methods. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Peter Maydell Reviewed-by: Corey Minyard Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/omap1.c | 2 +- hw/arm/omap2.c | 8 ++++---- hw/i2c/omap_i2c.c | 19 ++++++++++++------- include/hw/arm/omap.h | 13 +++++++++++++ 4 files changed, 30 insertions(+), 12 deletions(-) diff --git a/hw/arm/omap1.c b/hw/arm/omap1.c index 1afd1d3d7f..807e5f70d1 100644 --- a/hw/arm/omap1.c +++ b/hw/arm/omap1.c @@ -4030,7 +4030,7 @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegio= n *dram, =20 s->i2c[0] =3D qdev_create(NULL, "omap_i2c"); qdev_prop_set_uint8(s->i2c[0], "revision", 0x11); - qdev_prop_set_ptr(s->i2c[0], "fclk", omap_findclk(s, "mpuper_ck")); + omap_i2c_set_fclk(OMAP_I2C(s->i2c[0]), omap_findclk(s, "mpuper_ck")); qdev_init_nofail(s->i2c[0]); busdev =3D SYS_BUS_DEVICE(s->i2c[0]); sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(s->ih[1], OMAP_INT_I2C)= ); diff --git a/hw/arm/omap2.c b/hw/arm/omap2.c index 1d7cc435ef..171e2d0472 100644 --- a/hw/arm/omap2.c +++ b/hw/arm/omap2.c @@ -2425,8 +2425,8 @@ struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegi= on *sdram, =20 s->i2c[0] =3D qdev_create(NULL, "omap_i2c"); qdev_prop_set_uint8(s->i2c[0], "revision", 0x34); - qdev_prop_set_ptr(s->i2c[0], "iclk", omap_findclk(s, "i2c1.iclk")); - qdev_prop_set_ptr(s->i2c[0], "fclk", omap_findclk(s, "i2c1.fclk")); + omap_i2c_set_iclk(OMAP_I2C(s->i2c[0]), omap_findclk(s, "i2c1.iclk")); + omap_i2c_set_fclk(OMAP_I2C(s->i2c[0]), omap_findclk(s, "i2c1.fclk")); qdev_init_nofail(s->i2c[0]); busdev =3D SYS_BUS_DEVICE(s->i2c[0]); sysbus_connect_irq(busdev, 0, @@ -2437,8 +2437,8 @@ struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegi= on *sdram, =20 s->i2c[1] =3D qdev_create(NULL, "omap_i2c"); qdev_prop_set_uint8(s->i2c[1], "revision", 0x34); - qdev_prop_set_ptr(s->i2c[1], "iclk", omap_findclk(s, "i2c2.iclk")); - qdev_prop_set_ptr(s->i2c[1], "fclk", omap_findclk(s, "i2c2.fclk")); + omap_i2c_set_iclk(OMAP_I2C(s->i2c[1]), omap_findclk(s, "i2c2.iclk")); + omap_i2c_set_fclk(OMAP_I2C(s->i2c[1]), omap_findclk(s, "i2c2.fclk")); qdev_init_nofail(s->i2c[1]); busdev =3D SYS_BUS_DEVICE(s->i2c[1]); sysbus_connect_irq(busdev, 0, diff --git a/hw/i2c/omap_i2c.c b/hw/i2c/omap_i2c.c index 3ba965a58f..3ccbd5cc2c 100644 --- a/hw/i2c/omap_i2c.c +++ b/hw/i2c/omap_i2c.c @@ -28,10 +28,7 @@ #include "qemu/error-report.h" #include "qapi/error.h" =20 -#define TYPE_OMAP_I2C "omap_i2c" -#define OMAP_I2C(obj) OBJECT_CHECK(OMAPI2CState, (obj), TYPE_OMAP_I2C) - -typedef struct OMAPI2CState { +struct OMAPI2CState { SysBusDevice parent_obj; =20 MemoryRegion iomem; @@ -56,7 +53,7 @@ typedef struct OMAPI2CState { uint8_t divider; uint8_t times[2]; uint16_t test; -} OMAPI2CState; +}; =20 #define OMAP2_INTR_REV 0x34 #define OMAP2_GC_REV 0x34 @@ -504,10 +501,18 @@ static void omap_i2c_realize(DeviceState *dev, Error = **errp) } } =20 +void omap_i2c_set_iclk(OMAPI2CState *i2c, omap_clk clk) +{ + i2c->iclk =3D clk; +} + +void omap_i2c_set_fclk(OMAPI2CState *i2c, omap_clk clk) +{ + i2c->fclk =3D clk; +} + static Property omap_i2c_properties[] =3D { DEFINE_PROP_UINT8("revision", OMAPI2CState, revision, 0), - DEFINE_PROP_PTR("iclk", OMAPI2CState, iclk), - DEFINE_PROP_PTR("fclk", OMAPI2CState, fclk), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/include/hw/arm/omap.h b/include/hw/arm/omap.h index bcecf19f89..39a295ba20 100644 --- a/include/hw/arm/omap.h +++ b/include/hw/arm/omap.h @@ -81,6 +81,19 @@ typedef struct omap_intr_handler_s omap_intr_handler; void omap_intc_set_iclk(omap_intr_handler *intc, omap_clk clk); void omap_intc_set_fclk(omap_intr_handler *intc, omap_clk clk); =20 +/* omap_i2c.c */ +#define TYPE_OMAP_I2C "omap_i2c" +#define OMAP_I2C(obj) OBJECT_CHECK(OMAPI2CState, (obj), TYPE_OMAP_I2C) + +typedef struct OMAPI2CState OMAPI2CState; + +/* + * TODO: Ideally we should have a clock framework that + * let us wire these clocks up with QOM properties or links. + */ +void omap_i2c_set_iclk(OMAPI2CState *i2c, omap_clk clk); +void omap_i2c_set_fclk(OMAPI2CState *i2c, omap_clk clk); + /* OMAP2 l4 Interconnect */ struct omap_l4_s; struct omap_l4_region_s { --=20 2.24.0.308.g228f53135a From nobody Thu May 2 22:13:26 2024 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576851371; cv=none; d=zohomail.com; s=zohoarc; b=HFmXyp3fr7iGzPs/ssRFpCAZyDFvsU2KKgDTz4aqGOLDtR/LGwKfmC4H9xR8Vv1QubAlwWZL9aYUbfjY1etICIlCOmSG2z6jCNf7AEAI1W02Sf/HPCye0N5YEYT5ai2k4iJjsnySMUSHQ2A10YQ3q0RVSAjTI7cAcGE6Tq0n6Bk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576851371; 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=e4W4X4+9AdAlHF3b2Sxm8ObzZZxgQQzMXZQ7w8NBZXM=; b=I+2x2lUyqXJ3KFSf0U51VQpQEmi2tGg5x3n/JHZ3XhS8sB0CiHuPZqw3AHcq0wiY2ooMxmHBhcO7RXnUNmkIU6nCeDgsok+hLzX30UYCfWmWviGDRFosJ0GkDmUrcALvJzxIEw9LHZscfTcnSV36y6ASIslJQYbkvk9q7EItQAs= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576851371779128.31591291510858; Fri, 20 Dec 2019 06:16:11 -0800 (PST) Received: from localhost ([::1]:56690 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiJ4c-0005QX-DI for importer@patchew.org; Fri, 20 Dec 2019 09:16:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43533) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIhH-0003MC-0d for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:52:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiIhF-00060j-9t for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:52:02 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:40106 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 1iiIhE-0005yC-UF for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:52:01 -0500 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-400-iXYb1xXLPbqYBr1jczLRhA-1; Fri, 20 Dec 2019 08:51:59 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 130AF1005510; Fri, 20 Dec 2019 13:51:58 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 92CBA70380; Fri, 20 Dec 2019 13:51:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576849920; 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=e4W4X4+9AdAlHF3b2Sxm8ObzZZxgQQzMXZQ7w8NBZXM=; b=aJ34E/PE4QMrW5PrjxOV3ybfXRLVnNYs3hwwPVWdUUi7irSN9DHsFFIS4Q33dXAR/sL6WX nz1jDB0JnO7u9BgbQmQKngzHZUksO/XJooj5T7p42Jit5MB1h6/m27YoVeRweqcRwJ8K34 UOa5TtHi71kqWTfEUfWGsaJkpZjCB68= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH v5 34/37] omap-gpio: remove PROP_PTR Date: Fri, 20 Dec 2019 17:45:58 +0400 Message-Id: <20191220134601.571905-35-marcandre.lureau@redhat.com> In-Reply-To: <20191220134601.571905-1-marcandre.lureau@redhat.com> References: <20191220134601.571905-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: iXYb1xXLPbqYBr1jczLRhA-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: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Since clocks are not QOM objects, replace PROP_PTR of clocks with setters methods. Move/adapt the existing TODO comment about a clock framework. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/omap1.c | 2 +- hw/arm/omap2.c | 13 +++++++------ hw/gpio/omap_gpio.c | 42 +++++++++++++++--------------------------- include/hw/arm/omap.h | 33 +++++++++++++++++++++++++++++---- 4 files changed, 52 insertions(+), 38 deletions(-) diff --git a/hw/arm/omap1.c b/hw/arm/omap1.c index 807e5f70d1..761cc17ea9 100644 --- a/hw/arm/omap1.c +++ b/hw/arm/omap1.c @@ -4012,7 +4012,7 @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegio= n *dram, =20 s->gpio =3D qdev_create(NULL, "omap-gpio"); qdev_prop_set_int32(s->gpio, "mpu_model", s->mpu_model); - qdev_prop_set_ptr(s->gpio, "clk", omap_findclk(s, "arm_gpio_ck")); + omap_gpio_set_clk(OMAP1_GPIO(s->gpio), omap_findclk(s, "arm_gpio_ck")); qdev_init_nofail(s->gpio); sysbus_connect_irq(SYS_BUS_DEVICE(s->gpio), 0, qdev_get_gpio_in(s->ih[0], OMAP_INT_GPIO_BANK1)); diff --git a/hw/arm/omap2.c b/hw/arm/omap2.c index 171e2d0472..e1c11de5ce 100644 --- a/hw/arm/omap2.c +++ b/hw/arm/omap2.c @@ -2449,13 +2449,14 @@ struct omap_mpu_state_s *omap2420_mpu_init(MemoryRe= gion *sdram, =20 s->gpio =3D qdev_create(NULL, "omap2-gpio"); qdev_prop_set_int32(s->gpio, "mpu_model", s->mpu_model); - qdev_prop_set_ptr(s->gpio, "iclk", omap_findclk(s, "gpio_iclk")); - qdev_prop_set_ptr(s->gpio, "fclk0", omap_findclk(s, "gpio1_dbclk")); - qdev_prop_set_ptr(s->gpio, "fclk1", omap_findclk(s, "gpio2_dbclk")); - qdev_prop_set_ptr(s->gpio, "fclk2", omap_findclk(s, "gpio3_dbclk")); - qdev_prop_set_ptr(s->gpio, "fclk3", omap_findclk(s, "gpio4_dbclk")); + omap2_gpio_set_iclk(OMAP2_GPIO(s->gpio), omap_findclk(s, "gpio_iclk")); + omap2_gpio_set_fclk(OMAP2_GPIO(s->gpio), 0, omap_findclk(s, "gpio1_dbc= lk")); + omap2_gpio_set_fclk(OMAP2_GPIO(s->gpio), 1, omap_findclk(s, "gpio2_dbc= lk")); + omap2_gpio_set_fclk(OMAP2_GPIO(s->gpio), 2, omap_findclk(s, "gpio3_dbc= lk")); + omap2_gpio_set_fclk(OMAP2_GPIO(s->gpio), 3, omap_findclk(s, "gpio4_dbc= lk")); if (s->mpu_model =3D=3D omap2430) { - qdev_prop_set_ptr(s->gpio, "fclk4", omap_findclk(s, "gpio5_dbclk")= ); + omap2_gpio_set_fclk(OMAP2_GPIO(s->gpio), 4, + omap_findclk(s, "gpio5_dbclk")); } qdev_init_nofail(s->gpio); busdev =3D SYS_BUS_DEVICE(s->gpio); diff --git a/hw/gpio/omap_gpio.c b/hw/gpio/omap_gpio.c index 41e1aa798c..85c16897ae 100644 --- a/hw/gpio/omap_gpio.c +++ b/hw/gpio/omap_gpio.c @@ -40,10 +40,6 @@ struct omap_gpio_s { uint16_t pins; }; =20 -#define TYPE_OMAP1_GPIO "omap-gpio" -#define OMAP1_GPIO(obj) \ - OBJECT_CHECK(struct omap_gpif_s, (obj), TYPE_OMAP1_GPIO) - struct omap_gpif_s { SysBusDevice parent_obj; =20 @@ -212,10 +208,6 @@ struct omap2_gpio_s { uint8_t delay; }; =20 -#define TYPE_OMAP2_GPIO "omap2-gpio" -#define OMAP2_GPIO(obj) \ - OBJECT_CHECK(struct omap2_gpif_s, (obj), TYPE_OMAP2_GPIO) - struct omap2_gpif_s { SysBusDevice parent_obj; =20 @@ -747,21 +739,13 @@ static void omap2_gpio_realize(DeviceState *dev, Erro= r **errp) } } =20 -/* Using qdev pointer properties for the clocks is not ideal. - * qdev should support a generic means of defining a 'port' with - * an arbitrary interface for connecting two devices. Then we - * could reframe the omap clock API in terms of clock ports, - * and get some type safety. For now the best qdev provides is - * passing an arbitrary pointer. - * (It's not possible to pass in the string which is the clock - * name, because this device does not have the necessary information - * (ie the struct omap_mpu_state_s*) to do the clockname to pointer - * translation.) - */ +void omap_gpio_set_clk(omap_gpif *gpio, omap_clk clk) +{ + gpio->clk =3D clk; +} =20 static Property omap_gpio_properties[] =3D { DEFINE_PROP_INT32("mpu_model", struct omap_gpif_s, mpu_model, 0), - DEFINE_PROP_PTR("clk", struct omap_gpif_s, clk), DEFINE_PROP_END_OF_LIST(), }; =20 @@ -784,15 +768,19 @@ static const TypeInfo omap_gpio_info =3D { .class_init =3D omap_gpio_class_init, }; =20 +void omap2_gpio_set_iclk(omap2_gpif *gpio, omap_clk clk) +{ + gpio->iclk =3D clk; +} + +void omap2_gpio_set_fclk(omap2_gpif *gpio, uint8_t i, omap_clk clk) +{ + assert(i <=3D 5); + gpio->fclk[i] =3D clk; +} + static Property omap2_gpio_properties[] =3D { DEFINE_PROP_INT32("mpu_model", struct omap2_gpif_s, mpu_model, 0), - DEFINE_PROP_PTR("iclk", struct omap2_gpif_s, iclk), - DEFINE_PROP_PTR("fclk0", struct omap2_gpif_s, fclk[0]), - DEFINE_PROP_PTR("fclk1", struct omap2_gpif_s, fclk[1]), - DEFINE_PROP_PTR("fclk2", struct omap2_gpif_s, fclk[2]), - DEFINE_PROP_PTR("fclk3", struct omap2_gpif_s, fclk[3]), - DEFINE_PROP_PTR("fclk4", struct omap2_gpif_s, fclk[4]), - DEFINE_PROP_PTR("fclk5", struct omap2_gpif_s, fclk[5]), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/include/hw/arm/omap.h b/include/hw/arm/omap.h index 39a295ba20..6be386d0e2 100644 --- a/include/hw/arm/omap.h +++ b/include/hw/arm/omap.h @@ -77,6 +77,16 @@ typedef struct omap_intr_handler_s omap_intr_handler; /* * TODO: Ideally we should have a clock framework that * let us wire these clocks up with QOM properties or links. + * + * qdev should support a generic means of defining a 'port' with + * an arbitrary interface for connecting two devices. Then we + * could reframe the omap clock API in terms of clock ports, + * and get some type safety. For now the best qdev provides is + * passing an arbitrary pointer. + * (It's not possible to pass in the string which is the clock + * name, because this device does not have the necessary information + * (ie the struct omap_mpu_state_s*) to do the clockname to pointer + * translation.) */ void omap_intc_set_iclk(omap_intr_handler *intc, omap_clk clk); void omap_intc_set_fclk(omap_intr_handler *intc, omap_clk clk); @@ -87,13 +97,28 @@ void omap_intc_set_fclk(omap_intr_handler *intc, omap_c= lk clk); =20 typedef struct OMAPI2CState OMAPI2CState; =20 -/* - * TODO: Ideally we should have a clock framework that - * let us wire these clocks up with QOM properties or links. - */ +/* TODO: clock framework (see above) */ void omap_i2c_set_iclk(OMAPI2CState *i2c, omap_clk clk); void omap_i2c_set_fclk(OMAPI2CState *i2c, omap_clk clk); =20 +/* omap_gpio.c */ +#define TYPE_OMAP1_GPIO "omap-gpio" +#define OMAP1_GPIO(obj) \ + OBJECT_CHECK(struct omap_gpif_s, (obj), TYPE_OMAP1_GPIO) + +#define TYPE_OMAP2_GPIO "omap2-gpio" +#define OMAP2_GPIO(obj) \ + OBJECT_CHECK(struct omap2_gpif_s, (obj), TYPE_OMAP2_GPIO) + +typedef struct omap_gpif_s omap_gpif; +typedef struct omap2_gpif_s omap2_gpif; + +/* TODO: clock framework (see above) */ +void omap_gpio_set_clk(omap_gpif *gpio, omap_clk clk); + +void omap2_gpio_set_iclk(omap2_gpif *gpio, omap_clk clk); +void omap2_gpio_set_fclk(omap2_gpif *gpio, uint8_t i, omap_clk clk); + /* OMAP2 l4 Interconnect */ struct omap_l4_s; struct omap_l4_region_s { --=20 2.24.0.308.g228f53135a From nobody Thu May 2 22:13:26 2024 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576851517; cv=none; d=zohomail.com; s=zohoarc; b=eaGbd2nAfyX/XVk8NODhJhgjPoHUDuTyzvx/48SIfFTKzJIZbOGEyXfWy1JXztaJJ1ej67QfgwRjDLBJzku2sntL7k98BkE65JRMyQ3YamXU81F9e6iW8wu5bfw2Xu0dR4JIG2OkFO7Uc5TKeYqvd+4WaPWpoqa3kGIfjRFhPbE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576851517; 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=p5yQ3TNHYGcnrLFbmS6E34pj84qolmFgygglbWuPZyQ=; b=FM6r+/hMDCofanYMgwfWPbBrfqcDO0yrOgki/VSbiBFj4o0DATK+1IctAV6X12OzMIeQXGKlwn8qwNQkKSlL1kNLHZvGfQmZoEPSacVAPT6BlHLaE4I3SV3L+glxks0TNTvNEaf/2QjQeSuqzXcdBTt20hsuyurUZVm7HMV0fcs= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576851517624679.7187019687362; Fri, 20 Dec 2019 06:18:37 -0800 (PST) Received: from localhost ([::1]:56786 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiJ6y-0000Mm-7K for importer@patchew.org; Fri, 20 Dec 2019 09:18:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45656) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIhT-0003mG-K0 for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:52:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiIhS-0006sL-5b for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:52:15 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:44856 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 1iiIhR-0006qE-VA for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:52:14 -0500 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-69-tySA5C7UNL2hRX2BBKQZXg-1; Fri, 20 Dec 2019 08:52:10 -0500 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 71FD58014CD; Fri, 20 Dec 2019 13:52:09 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9B5A35C554; Fri, 20 Dec 2019 13:52:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576849933; 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=p5yQ3TNHYGcnrLFbmS6E34pj84qolmFgygglbWuPZyQ=; b=GtUr02UQQNLKvsT6O0q5MeMkUNOAVltrrLg+/ozKHEfy75INxDu5QAMw+RfVvGbiggEzaK EZbXuZS+6JHD2wOG9H1ULpHHLAVu9c2O9VN6g4Olfve28vypXT7uLL7gWuWovQ7KYfyiQc n9mGwh9i7GH7KxVn+PEW0mT5YjN4Y+I= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH v5 35/37] qdev: remove PROP_MEMORY_REGION Date: Fri, 20 Dec 2019 17:45:59 +0400 Message-Id: <20191220134601.571905-36-marcandre.lureau@redhat.com> In-Reply-To: <20191220134601.571905-1-marcandre.lureau@redhat.com> References: <20191220134601.571905-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: tySA5C7UNL2hRX2BBKQZXg-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: 207.211.31.81 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: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" PROP_MEMORY_REGION was a derivative of PROP_PTR, added in commit ed03d749f3f513b8fb0287757cfda2cb6825f063 (qdev: add MemoryRegion property) and thankfully no longer needed since commit 3eff40dbf44896a8180c86c84dbdefb2eb173fbe (hw/misc: Remove mmio_interface device). Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/qdev-properties.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index c6a8cb5516..16837ab5dd 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -216,8 +216,6 @@ extern const PropertyInfo qdev_prop_pcie_link_width; DEFINE_PROP_UNSIGNED(_n, _s, _f, 0, qdev_prop_blocksize, uint16_t) #define DEFINE_PROP_PCI_HOST_DEVADDR(_n, _s, _f) \ DEFINE_PROP(_n, _s, _f, qdev_prop_pci_host_devaddr, PCIHostDeviceAddre= ss) -#define DEFINE_PROP_MEMORY_REGION(_n, _s, _f) \ - DEFINE_PROP(_n, _s, _f, qdev_prop_ptr, MemoryRegion *) #define DEFINE_PROP_OFF_AUTO_PCIBAR(_n, _s, _f, _d) \ DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_off_auto_pcibar, \ OffAutoPCIBAR) --=20 2.24.0.308.g228f53135a From nobody Thu May 2 22:13:26 2024 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576851631; cv=none; d=zohomail.com; s=zohoarc; b=eUaeDrDf3rvzpkPxcBe5IRcOK3CvdyPaXdF83mGjjrfq9ayjr1FFgMRt3syvj6iHyN45hv/IJUfF/YLgZKVRq98vLMjnXeiTCNujeQVIZuanuNp9mO2vxjR9LVw6NkuGbuGkhixgCf5euaLro3b8BQxQYU2vdYnaevOERPBjjfc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576851631; 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=3MdcmcIGRBu7yC0nFlRdq11GjU0cBWKn+3toxrMtEyY=; b=ZEKmxb30oHHc/+sSH/E+s56DiLB2eGDJi2vx9rhpzMizb6nAwOcakFb6+YZgYe6XY+PLMIDAHuwruonC9dMKAlxOXk2PD6nQCpORrt0Sj+qe9/GiggObbh3Y1h7NRWTcRiX6bA4cDl9tmTo3Va8W1ZA6lsuH9Kj7gIzGf1xgGFQ= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576851631894396.259006795986; Fri, 20 Dec 2019 06:20:31 -0800 (PST) Received: from localhost ([::1]:56812 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiJ8o-0003a3-Go for importer@patchew.org; Fri, 20 Dec 2019 09:20:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47419) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIhd-00044m-Ik for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:52:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiIhc-0007ZJ-3u for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:52:25 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:48967 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iiIhb-0007X2-TY for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:52:24 -0500 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-15-Xv_ajuvEPH61b6iqCVbndw-1; Fri, 20 Dec 2019 08:52:20 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4BE68185432D; Fri, 20 Dec 2019 13:52:19 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 87D5A26FB9; Fri, 20 Dec 2019 13:52:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576849943; 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=3MdcmcIGRBu7yC0nFlRdq11GjU0cBWKn+3toxrMtEyY=; b=OQWQI+jzWwQqu1fHqW1pGOECbKBzLB3BwjHT3mJaTtB2rBYEf54rnYMYvCv29O0Cl2wB/H /hgM/v3IKQtC3IZFXuV1QKnuIJsxvDnA/DDQIyQT6ChXAxz6g97svxWonPcSgq3zm6YYuk uguv0QMw3Hny0zr1yptCM3XhddlzlZA= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH v5 36/37] qdev: remove QDEV_PROP_PTR Date: Fri, 20 Dec 2019 17:46:00 +0400 Message-Id: <20191220134601.571905-37-marcandre.lureau@redhat.com> In-Reply-To: <20191220134601.571905-1-marcandre.lureau@redhat.com> References: <20191220134601.571905-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: Xv_ajuvEPH61b6iqCVbndw-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: 207.211.31.81 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: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" No longer used in the tree. The comment about user_creatable is still quite relevant, but there is already a similar comment in qdev-core.h. Reviewed-by: Peter Maydell Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/core/qdev-properties.c | 18 ------------------ include/hw/qdev-properties.h | 22 ---------------------- 2 files changed, 40 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index ac28890e5a..6ca7697599 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -501,13 +501,6 @@ const PropertyInfo qdev_prop_string =3D { .set =3D set_string, }; =20 -/* --- pointer --- */ - -/* Not a proper property, just for dirty hacks. TODO Remove it! */ -const PropertyInfo qdev_prop_ptr =3D { - .name =3D "ptr", -}; - /* --- mac address --- */ =20 /* @@ -1165,17 +1158,6 @@ void qdev_prop_set_enum(DeviceState *dev, const char= *name, int value) name, &error_abort); } =20 -void qdev_prop_set_ptr(DeviceState *dev, const char *name, void *value) -{ - Property *prop; - void **ptr; - - prop =3D qdev_prop_find(dev, name); - assert(prop && prop->info =3D=3D &qdev_prop_ptr); - ptr =3D qdev_get_prop_ptr(dev, prop); - *ptr =3D value; -} - static GPtrArray *global_props(void) { static GPtrArray *gp; diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 16837ab5dd..a90a9cec80 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -18,7 +18,6 @@ extern const PropertyInfo qdev_prop_size; extern const PropertyInfo qdev_prop_string; extern const PropertyInfo qdev_prop_chr; extern const PropertyInfo qdev_prop_tpm; -extern const PropertyInfo qdev_prop_ptr; extern const PropertyInfo qdev_prop_macaddr; extern const PropertyInfo qdev_prop_on_off_auto; extern const PropertyInfo qdev_prop_losttickpolicy; @@ -171,25 +170,6 @@ extern const PropertyInfo qdev_prop_pcie_link_width; #define DEFINE_PROP_PCI_DEVFN(_n, _s, _f, _d) \ DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_pci_devfn, int32_t) =20 -/* - * Please avoid pointer properties. If you must use them, you must - * cover them in their device's class init function as follows: - * - * - If the property must be set, the device cannot be used with - * device_add, so add code like this: - * |* Reason: pointer property "NAME-OF-YOUR-PROP" *| - * DeviceClass *dc =3D DEVICE_CLASS(class); - * dc->user_creatable =3D false; - * - * - If the property may safely remain null, document it like this: - * |* - * * Note: pointer property "interrupt_vector" may remain null, thus - * * no need for dc->user_creatable =3D false; - * *| - */ -#define DEFINE_PROP_PTR(_n, _s, _f) \ - DEFINE_PROP(_n, _s, _f, qdev_prop_ptr, void*) - #define DEFINE_PROP_CHR(_n, _s, _f) \ DEFINE_PROP(_n, _s, _f, qdev_prop_chr, CharBackend) #define DEFINE_PROP_STRING(_n, _s, _f) \ @@ -262,8 +242,6 @@ void qdev_prop_set_drive(DeviceState *dev, const char *= name, void qdev_prop_set_macaddr(DeviceState *dev, const char *name, const uint8_t *value); void qdev_prop_set_enum(DeviceState *dev, const char *name, int value); -/* FIXME: Remove opaque pointer properties. */ -void qdev_prop_set_ptr(DeviceState *dev, const char *name, void *value); =20 void qdev_prop_register_global(GlobalProperty *prop); int qdev_prop_check_globals(void); --=20 2.24.0.308.g228f53135a From nobody Thu May 2 22:13:26 2024 Delivered-To: importer@patchew.org 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; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576851269; cv=none; d=zohomail.com; s=zohoarc; b=Yv3vc4YMBqZlJjrZ5qXGVy6pJe6YAtM0VmYP4I9ZoLHcQSiIcK3hZuV76N1EN+7u6TJj+yz+v9lAeQpZ8BDkSczh2wNHNZ7YtMIYRdoZ8/3IdenjAuERjrX9ZLbQqk2KxjC1LatBhnE2+QF4eWPou5Zh/9yrTpDyDLlelHsGhnk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576851269; 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=OkycvjxGlSDX/OH6Ca4R80SQm4GKcDVxy/0qITwmuWk=; b=cZikbKX1m5Y21927lJYd17YU8GhzSymdNIQMMiufcjCKj/Tb8t4U/f0yzD+wPyYZPLARLWAvqwETX7RQ3oWViFShsGtFL80LPI7tAUqinIgLRx54Uar/vWp720VzIOrARODhrnqAf/dpEvrQcNZwUtUnCo6TYVo53P2rWbgi/lE= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576851269683999.0555329434512; Fri, 20 Dec 2019 06:14:29 -0800 (PST) Received: from localhost ([::1]:56614 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiJ2y-00032k-2X for importer@patchew.org; Fri, 20 Dec 2019 09:14:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48782) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiIhm-0004J1-19 for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:52:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiIhk-0008AL-R1 for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:52:33 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:26390 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 1iiIhk-000885-IH for qemu-devel@nongnu.org; Fri, 20 Dec 2019 08:52:32 -0500 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-186-xJmBZagBOAKrnIrGiyDx5Q-1; Fri, 20 Dec 2019 08:52:28 -0500 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 D7C505EB; Fri, 20 Dec 2019 13:52:27 +0000 (UTC) Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7F4035C54A; Fri, 20 Dec 2019 13:52:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576849952; 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=OkycvjxGlSDX/OH6Ca4R80SQm4GKcDVxy/0qITwmuWk=; b=Q/8TXgUMNFQFrOH4PTcvV/GEmdKUkK/CqRHtVm/Pe/xFCiagEajLhu0Uj8HnW6YuRMUVrT /t5lucwmKbC7h815/tWc7de/OJ5tZPgetOBj3ACHclHVa9dVItzio4P9M7oSiyvmOPahfq Ur4Ql/swe4o/Ox6VPBEUokNE0Sdy3oI= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH v5 37/37] qdev/qom: remove some TODO limitations now that PROP_PTR is gone Date: Fri, 20 Dec 2019 17:46:01 +0400 Message-Id: <20191220134601.571905-38-marcandre.lureau@redhat.com> In-Reply-To: <20191220134601.571905-1-marcandre.lureau@redhat.com> References: <20191220134601.571905-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: xJmBZagBOAKrnIrGiyDx5Q-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: peter.maydell@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Markus Armbruster --- hw/core/qdev.c | 8 -------- qom/qom-qmp-cmds.c | 10 ---------- 2 files changed, 18 deletions(-) diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 98e786c50f..9feb81cff2 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -736,14 +736,6 @@ void qdev_property_add_static(DeviceState *dev, Proper= ty *prop, if (prop->info->create) { prop->info->create(obj, prop, &local_err); } else { - /* - * TODO qdev_prop_ptr does not have getters or setters. It must - * go now that it can be replaced with links. The test should be - * removed along with it: all static properties are read/write. - */ - if (!prop->info->get && !prop->info->set) { - return; - } object_property_add(obj, prop->name, prop->info->name, prop->info->get, prop->info->set, prop->info->release, diff --git a/qom/qom-qmp-cmds.c b/qom/qom-qmp-cmds.c index 236e8e41dd..f4494f98ac 100644 --- a/qom/qom-qmp-cmds.c +++ b/qom/qom-qmp-cmds.c @@ -142,16 +142,6 @@ static ObjectPropertyInfo *make_device_property_info(O= bjectClass *klass, continue; } =20 - /* - * TODO Properties without a parser are just for dirty hacks. - * qdev_prop_ptr is the only such PropertyInfo. It's marked - * for removal. This conditional should be removed along with - * it. - */ - if (!prop->info->set && !prop->info->create) { - return NULL; /* no way to set it, don't show */ - } - info =3D g_malloc0(sizeof(*info)); info->name =3D g_strdup(prop->name); info->type =3D default_type ? g_strdup(default_type) --=20 2.24.0.308.g228f53135a