From nobody Sat May 4 03:02:49 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=1578409703; cv=none; d=zohomail.com; s=zohoarc; b=MFnQfxYuj1Mw5YNR0DWf+tuumbRn5mOEVv1zcf0zMKNq2uHd1ISGeMjY3fttokXy6H8vdMlBA/ccPvQyTI8hLkOoPwm/7h3z+a+tOpzRFF6ZqduDuwkxNWNTsKY5HkH2E3JQjNtnU7NcCV47PE+8O7JD0b33E9CV9rTF2V3oCZA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578409703; 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=EJrrTjRO7qkKTjto+Cu0IJJo24QPBMxltA3d3tq4Ry4=; b=ISydbEkJD2zhOF4YhcvVZisTuYMw5CWcTikb3u1wlY4EMUwCDd27CAX8Pp1rUzRmm6o70WLnGSRFBjVttHFgRBEttJJwmpXs/TTJLw8ysq+pvdpZYJMb4PhQ8O/ytqD/Qru359e3HxnfKHRQsZtIkXZJ6bWbaIz08VC0zkpy1h8= 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 1578409703728621.4280911343358; Tue, 7 Jan 2020 07:08:23 -0800 (PST) Received: from localhost ([::1]:51014 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqSz-0003MT-Qz for importer@patchew.org; Tue, 07 Jan 2020 10:08:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54212) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqPr-0006ux-HD for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:05:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioqPq-0002eF-E7 for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:05:07 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:55567 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 1ioqPq-0002dQ-9o for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:05:06 -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-296-ploy__zANKiJNveAzVu3Og-1; Tue, 07 Jan 2020 10:05:02 -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 DE0D8802CAF; Tue, 7 Jan 2020 15:05:00 +0000 (UTC) Received: from localhost (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id F3B9A5D9CA; Tue, 7 Jan 2020 15:04:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578409505; 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=EJrrTjRO7qkKTjto+Cu0IJJo24QPBMxltA3d3tq4Ry4=; b=S4RvYdsH+XSt5iPg6SgQPWYxzcf1MKFh/baEOVwBhBtWhz70QBWqUKHprvgF1JZv9ckKPv mXiEpqeUoq2elwkTmew3MrISLi4bHwPLAnnqldNdhBVW3tfNwPUyIz5XX/xEQoeas3yR1M Q4pZmJzvGa+vxITApmYJPOp46f8Jio0= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 01/37] hw/display/sm501: Always map the UART0 Date: Tue, 7 Jan 2020 19:04:06 +0400 Message-Id: <20200107150442.1727958-2-marcandre.lureau@redhat.com> In-Reply-To: <20200107150442.1727958-1-marcandre.lureau@redhat.com> References: <20200107150442.1727958-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: ploy__zANKiJNveAzVu3Og-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 , =?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.25.0.rc1.20.g2443f3f80d From nobody Sat May 4 03:02:49 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=1578410825; cv=none; d=zohomail.com; s=zohoarc; b=nWITq/OYM68nRWpId9KDhHWAVo8RiEcI+3b79DgwXycyoEyIBZaO3v+zT7N0Iok+BZqEpYXl4biXkHfcYL4hRPtDvvQvfOgJFlNd7EPHWwMbzMXa3DE5Gy4hiSHhdVax60+517vLdg6E4zZuCQm3Bdq/DtAVKiRkOWNFDJ4dm8w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578410825; 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=7RDOIe3RbZADXNwFyjV9iT1aWurrowSSw8ZiHM2QHRs=; b=ng4ndOb4HO+qWbNTu/6upHeom7F8F4gzsjR7PGmAXWkxEFQd3/59VbFXhnO7KIl+dEXsZ4ghWNf2oSdviAJ4w+rmN5yT2HCbf/JX9fSaOCGwzBYSvr1xEuu+SBw2o8ayhND7ynoEU0NU0Lz3aT2g/ZEm+W4OAw//VtwRIUfWtOw= 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 157841082551333.31744807247355; Tue, 7 Jan 2020 07:27:05 -0800 (PST) Received: from localhost ([::1]:51444 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioql5-0001zr-W8 for importer@patchew.org; Tue, 07 Jan 2020 10:27:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54296) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqQ1-0007Be-T2 for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:05:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioqQ0-0002le-Kd for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:05:17 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:51632 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 1ioqQ0-0002lM-GU for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:05:16 -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-378-UeZkUt_RN26tmdPZUgZ4Dg-1; Tue, 07 Jan 2020 10:05:14 -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 556AD805AA4; Tue, 7 Jan 2020 15:05:13 +0000 (UTC) Received: from localhost (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id DA6647C82C; Tue, 7 Jan 2020 15:05:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578409516; 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=7RDOIe3RbZADXNwFyjV9iT1aWurrowSSw8ZiHM2QHRs=; b=jMtukKSVOnE0izDu3iM/VuufgrhUg4BnkWF7ZouPKY4mH42ZJTYGqJeaf0xOkNRADR4lz5 7Jox1Mhn6Pc/NvrJbDL8M/u9zxfCpN7f7zm5ukuZzXHhnfI7RUIt/kTfzjkBovkKGhQpW+ symu0J9zZPtS8w5t46AJcZEvczvrzbg= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 02/37] sysbus: remove unused sysbus_try_create* Date: Tue, 7 Jan 2020 19:04:07 +0400 Message-Id: <20200107150442.1727958-3-marcandre.lureau@redhat.com> In-Reply-To: <20200107150442.1727958-1-marcandre.lureau@redhat.com> References: <20200107150442.1727958-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: UeZkUt_RN26tmdPZUgZ4Dg-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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?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 --- include/hw/sysbus.h | 9 +-------- hw/core/sysbus.c | 32 -------------------------------- hw/i386/pc.c | 1 - 3 files changed, 1 insertion(+), 41 deletions(-) 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 */ 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 --=20 2.25.0.rc1.20.g2443f3f80d From nobody Sat May 4 03:02:49 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=1578410986; cv=none; d=zohomail.com; s=zohoarc; b=oAd/xmovs4cvkFcgDHoFgs6ktKPtWb/rpoIZIWL1i4ekpiQqm/t45T5wo6oFF/mN34aBRRenEh2t0SEdd69YYbMqWM+mZie/1VH8SeMq5ikCKUsUjRThoGlEZssTLBEs1FHb8mfdGqAcXLLLsilZ8Mwc43ZV0q7f6LVZg7SJqgg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578410986; 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=1T99di2IH2/vbn9AMCu/pMMe8QNGfDUZ90m/us0q21g=; b=lAFbBfyvdLDSMqrRnN1PN9V7aIhlBIapX7tVN6x7LB6bJgo0WubeCyCN17YGxAjeueeP/QA1omJKkFLXC1qtCMBTtmJjctrXYISdpOKjakBdES2Tkr6PQHe0DDjZpEvEbL5LK0ePZ0Ec1D/QEncrSY4qD18J5L2FfPOCjSOfX5M= 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 1578410986720874.4566444440815; Tue, 7 Jan 2020 07:29:46 -0800 (PST) Received: from localhost ([::1]:51472 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqne-0005n6-Np for importer@patchew.org; Tue, 07 Jan 2020 10:29:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54361) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqQA-0007QY-DS for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:05:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioqQ9-0002r5-DP for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:05:26 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:41885 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 1ioqQ9-0002qn-A0 for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:05:25 -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-219-G3XTrMMQMFu4W5H9aWPNYA-1; Tue, 07 Jan 2020 10:05:21 -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 4388E100551A; Tue, 7 Jan 2020 15:05:20 +0000 (UTC) Received: from localhost (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id D00677C82C; Tue, 7 Jan 2020 15:05:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578409524; 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=1T99di2IH2/vbn9AMCu/pMMe8QNGfDUZ90m/us0q21g=; b=hIXz0SYASjqmU0+o9zTzc8wncKwgrgvSb2P3Pv9WA05znuMRg9k+3f4FNf3ChKD4PNtyy1 TagMQ1YZLRx12F6/8CJiL6+TvofgD69zgg3gtQ0s8i5h1ZBAmbQisW6YdjoPWB/CT/DpZc HwzJOkBTkA2dOK2SdnZxxm0UMpXpeGY= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 03/37] sysbus: remove outdated comment Date: Tue, 7 Jan 2020 19:04:08 +0400 Message-Id: <20200107150442.1727958-4-marcandre.lureau@redhat.com> In-Reply-To: <20200107150442.1727958-1-marcandre.lureau@redhat.com> References: <20200107150442.1727958-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: G3XTrMMQMFu4W5H9aWPNYA-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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?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.25.0.rc1.20.g2443f3f80d From nobody Sat May 4 03:02:49 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=1578409922; cv=none; d=zohomail.com; s=zohoarc; b=KChNTBRVERPhAA+A+qHovhrFMSbr0Wz7UCnacmCa4BKMzfjAUlscoLkxnCnvoR8cCZvQUhNMJQPfBOtHQQSSvXENuwbO8DqadnqHhzIUTBcaKnFA9GdGWfqH5JPokJtVEGBat+HsOFyVkT4inV1LupL2aieDnGEj2ZPbBO2X/dQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578409922; 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=RHghU0aneLrLKKgo8gqJlYHyBBlY8Ey8JTdiie0ybJA=; b=VyUZoC0rRAGpEeoh3s0eVXz/4mi6VZ31sW6/xkC3Tw9YnudGbL6pFliDMpU2XPjfvvObP1nKLHEojeO1A0qr0W1F2WzgOtynnyuiwm5+T6uAj2SQoJkIyJsOBPECCTXl3zF87qiNDvu8VlLX/uUsgCYtu9vODXmkFxhpKVmXGlQ= 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 1578409922246684.38335555314; Tue, 7 Jan 2020 07:12:02 -0800 (PST) Received: from localhost ([::1]:51096 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqWW-0002UR-JB for importer@patchew.org; Tue, 07 Jan 2020 10:12:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54523) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqQR-0007v6-Oy for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:05:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioqQQ-00034x-F4 for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:05:43 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:56260 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 1ioqQQ-00034P-As for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:05: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-416-IZfS3FdrPqGypwN7ELTJzw-1; Tue, 07 Jan 2020 10:05:35 -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 CC69E801F74; Tue, 7 Jan 2020 15:05:34 +0000 (UTC) Received: from localhost (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 81BC25D9CA; Tue, 7 Jan 2020 15:05:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578409541; 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=RHghU0aneLrLKKgo8gqJlYHyBBlY8Ey8JTdiie0ybJA=; b=TPx4fGXBmoXJDufF0Hbf71m7Cnv/GXHNmvsEzn4iYndHkAP+Cc5fA0qF5GLg53o2JJpixZ yjgfgnatSsbin7O0l/ihWdM8zqkBaLGSPZVP48N2TV+7zEhojqQb8JNgJjUoNHUcdrB9ZQ EvDFsM9Ay6YyWlUO1p5i23epq+xpvNY= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 04/37] chardev: generate an internal id when none given Date: Tue, 7 Jan 2020 19:04:09 +0400 Message-Id: <20200107150442.1727958-5-marcandre.lureau@redhat.com> In-Reply-To: <20200107150442.1727958-1-marcandre.lureau@redhat.com> References: <20200107150442.1727958-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: IZfS3FdrPqGypwN7ELTJzw-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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?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 --- include/qemu/id.h | 1 + chardev/char.c | 32 ++++++++++++++++++++++++-------- util/id.c | 1 + 3 files changed, 26 insertions(+), 8 deletions(-) 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/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/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.25.0.rc1.20.g2443f3f80d From nobody Sat May 4 03:02:49 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=1578409648; cv=none; d=zohomail.com; s=zohoarc; b=XPTzvNj+u+47nfMQcp5K//mmufoyi2GjyhHORyewJp2avG2lCAxsY9WO1pBSaoLOycV7fgo73HidU7sbHC49GXas5oaTtCW3TY0NrK6V+e4k5u8M60kJ5fnbLkvX7XKzqHNG0quwR2wF4T8VgipENphtDUhO646Czhorx1ozuxI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578409648; 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=iD53sfvHuOz9aFZ7VD08cf3w+xOVtsXXVcJul0CUx0E=; b=iZKfC+Sc85V2m/7W0sRj60WRyjcHV8v6EpVJcns/QApcMfjN8d5FiMT/7XOZ+T7Ok/Fon3pHjcYJVvmHSAc2++yJJBWoCYpiPmqrYxaQuO9SYphmx+LdQYFGme2GULMxoSZabe2oBZjdwEyaHai7r87lcDHbnf6OMyh6LIuJL3c= 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 157840964892770.56049159969518; Tue, 7 Jan 2020 07:07:28 -0800 (PST) Received: from localhost ([::1]:50964 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqS7-0001Pe-8H for importer@patchew.org; Tue, 07 Jan 2020 10:07:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54570) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqQY-000859-9W for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:05:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioqQX-00038N-5K for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:05:50 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:38579 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 1ioqQX-00037u-13 for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:05:49 -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-419-NEUFo1JpORiK7seuIODVNw-1; Tue, 07 Jan 2020 10:05:47 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5752519586C4; Tue, 7 Jan 2020 15:05:46 +0000 (UTC) Received: from localhost (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 099BA60C88; Tue, 7 Jan 2020 15:05:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578409548; 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=iD53sfvHuOz9aFZ7VD08cf3w+xOVtsXXVcJul0CUx0E=; b=ZNJaZiMbXiVpWYZbRw2pfEQn6soDu29a38bHdtu80ST8eOW82iYeCSAOBOO61Jit5LuEhD qHIjbjYB0cOYcG3cCaL/0n+3IMgGhLJd3ljf+fUEy7ot9iHF9fhmTduYn33POYs+0SQ6l8 72xr5TAwR+YSwFpTCoLfW0QhGdX3lSc= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 05/37] serial-pci-multi: factor out multi_serial_get_port_count() Date: Tue, 7 Jan 2020 19:04:10 +0400 Message-Id: <20200107150442.1727958-6-marcandre.lureau@redhat.com> In-Reply-To: <20200107150442.1727958-1-marcandre.lureau@redhat.com> References: <20200107150442.1727958-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: NEUFo1JpORiK7seuIODVNw-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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?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.25.0.rc1.20.g2443f3f80d From nobody Sat May 4 03:02:49 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=1578410612; cv=none; d=zohomail.com; s=zohoarc; b=WFVB6U1JV039r9D+2XU+41FmIdBi12NyP0enQsNLwLfra9JMSwH0+C6pjP2FVwiTCIxsxZqPXn08eEjpH6i4zALnvT4pnThvNrKoVkjyP/0SctZn81qN9JVVNmsWCO/Mf38tT0p5pU5N6ah4es0liqCs/KrOkNeiujWSfELo1VY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578410612; 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=DgN5lRhjIyB+e2DV8yR/PNfaWFviepDRwfpq6QzTgCc=; b=lc6QFVsfDvlH/lVS9WTl9vxki4+ymHR2b/BwSdAtpAYccKn+/8heR0oPApVKUIJM/t/6tNOjGebJkjiZirzhOm3rn7K5/ItDxY2u289v0WgcItYgu8lAGhfwqMqhdRXx8qFg1YUNi/j1Dl/qUZZWtWbqk2ERH44kFZeMdI0qjpY= 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 157841061268654.460368221406156; Tue, 7 Jan 2020 07:23:32 -0800 (PST) Received: from localhost ([::1]:51366 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqhe-0004vC-TU for importer@patchew.org; Tue, 07 Jan 2020 10:23:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54655) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqQo-0008Vw-2y for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:06:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioqQm-0003G2-Gb for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:06:06 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:56077 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 1ioqQm-0003FN-Cq for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:06: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-407-8IPXjuyhMRCBIxwpRE3f6A-1; Tue, 07 Jan 2020 10:05:59 -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 64FF7800D5A; Tue, 7 Jan 2020 15:05:58 +0000 (UTC) Received: from localhost (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id D6E3A10018FF; Tue, 7 Jan 2020 15:05:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578409563; 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=DgN5lRhjIyB+e2DV8yR/PNfaWFviepDRwfpq6QzTgCc=; b=YP5yoPRVZQ01NMAA0VrmlMHwQWmqtpoq6h/5dzZVWhm9zTgpEBP6DcW36sYtPGUu5LNZCE LqThc08NukAeSpUaUCCFdFkyJM2BB9v9PZx+CuDH8aLVEZdMFZ5C8XgQ4A/0WCvcpgclT/ BW6eUQt8LcI41SpHU+zmCglTV72VSOQ= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 06/37] serial: initial qom-ification Date: Tue, 7 Jan 2020 19:04:11 +0400 Message-Id: <20200107150442.1727958-7-marcandre.lureau@redhat.com> In-Reply-To: <20200107150442.1727958-1-marcandre.lureau@redhat.com> References: <20200107150442.1727958-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: 8IPXjuyhMRCBIxwpRE3f6A-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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?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 --- include/hw/char/serial.h | 7 ++++++- hw/char/serial-isa.c | 9 +++++++++ hw/char/serial-pci-multi.c | 15 +++++++++++++++ hw/char/serial-pci.c | 13 ++++++++++++- hw/char/serial.c | 34 ++++++++++++++++++++++++++++------ 5 files changed, 70 insertions(+), 8 deletions(-) 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, 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) --=20 2.25.0.rc1.20.g2443f3f80d From nobody Sat May 4 03:02:49 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=1578410768; cv=none; d=zohomail.com; s=zohoarc; b=hQjvbnXbYvA5WE7toZ2zYLkfVs+E6c8eJNQmNkS26cO4vd2P6cJ6w91ogNd4/PTBIOzyFF/iTTermYxUaLd14rITbZ5ZyUpK9qW+n+eRCe2sArfNbiIhP9N+F2A2LzV8fpVQlp8xbXHR+uEqqSNdnCeEImk8lAwVN227BR7aUbo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578410768; 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=Sy498CCSZFG73WzTylAVMt95zMKPnxFBTVB1SeHxZ1Q=; b=Cr0U19kTGdNnPWXE5tUOPSD3eccDF4HFs8SVU9WZKE8SqnofCL4e+soclnLuweGWk+lyJ/JE/b/lim2lm9DTKzZVb+9wWAzOs/1ZmXluGJS7++VU4+r6g62jJYcEIexA7QyZpvSrgwXlXeb+Zg2ak2tgRpB40yVtdAhamoiahEE= 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 1578410768110309.46046045149455; Tue, 7 Jan 2020 07:26:08 -0800 (PST) Received: from localhost ([::1]:51435 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqkA-0000Vc-8C for importer@patchew.org; Tue, 07 Jan 2020 10:26:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54785) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqR0-0000PM-BP for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:06:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioqQz-0003PQ-6p for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:06:18 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:25308 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 1ioqQz-0003Ou-3G for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:06: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-273-3sq-UK34PhmyTOikkB3ENQ-1; Tue, 07 Jan 2020 10:06:13 -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 6B0CF10054E3; Tue, 7 Jan 2020 15:06:12 +0000 (UTC) Received: from localhost (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0001A85F13; Tue, 7 Jan 2020 15:06:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578409576; 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=Sy498CCSZFG73WzTylAVMt95zMKPnxFBTVB1SeHxZ1Q=; b=S79wJ5tVILKkmo78AqyXRoOUtpMeUWLqzsqo/Bjjxu6yaMykaiBHlBOPTITA+n1l5V23rp jL9YFwMVREAk3Q2kKXIAWhLN9+83nc5fmYL1Aqay21MSqIeLgDsawlVrtbL0I8kT+HEYF+ hPaPveK8VoJFO6nkRUZfDe9aBRLYZzI= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 07/37] serial: register vmsd with DeviceClass Date: Tue, 7 Jan 2020 19:04:12 +0400 Message-Id: <20200107150442.1727958-8-marcandre.lureau@redhat.com> In-Reply-To: <20200107150442.1727958-1-marcandre.lureau@redhat.com> References: <20200107150442.1727958-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: 3sq-UK34PhmyTOikkB3ENQ-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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?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.25.0.rc1.20.g2443f3f80d From nobody Sat May 4 03:02:49 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=1578410074; cv=none; d=zohomail.com; s=zohoarc; b=l8QpqjzhxWRsVQ5D81sqOWOjBsXtUSrWn3zPjMbpkHYSkabj2mtDcisS6Pxai89Gyn/hhR9cSImvRXcqHQOHwQTxobfbvgu9Tj1rEN808SGiU9eDkVJNZ4XoxGqf9HQxbHP0mJ+Kj7N8x16EEee9KP9xI18Vh9GGlJ8RwCizxWQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578410074; 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=wtmH3UhnopF/IAZiWuE64UqbjVl4g8ua2epfl/msss0=; b=Ll5MDAIifIWteX7qht15Epj6vlI1rDXMqVZQZsfRQVbMTGRsyqvNsdur+MRpnrF1CeIErbmJlTA7AUGkaYBiI/pKTqcSzlkD4Zxej4OZWku4aDwfgc1ZRyJC5wNflzLZx08Jdrx8bqyDXvdkjNbTQT+HWprZ5iL3ebBeUNVicaI= 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 1578410074484715.413895482095; Tue, 7 Jan 2020 07:14:34 -0800 (PST) Received: from localhost ([::1]:51144 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqYy-0007C7-S1 for importer@patchew.org; Tue, 07 Jan 2020 10:14:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54913) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqRC-0000jc-C2 for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:06:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioqRB-0003XH-7R for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:06:30 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:32680 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 1ioqRB-0003X4-3f for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:06: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-394-a9tCNLZvPH2GguuZxdg9qg-1; Tue, 07 Jan 2020 10:06: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 60945800D54; Tue, 7 Jan 2020 15:06:24 +0000 (UTC) Received: from localhost (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id A46565D9CA; Tue, 7 Jan 2020 15:06:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578409588; 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=wtmH3UhnopF/IAZiWuE64UqbjVl4g8ua2epfl/msss0=; b=cA6v+17w2YPKnBy7QObpBenuPfmoCpa2yNQPngXtQ8dUtRXCeocoYyEsF5Do5tLz84xwjs vTp3iqh8XyapUvrVDNP90MX9l4i65gWkQ20mQAhCc1ylmwfVLo73npcmSqVmtWH7wpxJp3 jBvwLesZC9TCfIbuTOhjhg6Bs1Ze25I= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 08/37] serial: add "chardev" property Date: Tue, 7 Jan 2020 19:04:13 +0400 Message-Id: <20200107150442.1727958-9-marcandre.lureau@redhat.com> In-Reply-To: <20200107150442.1727958-1-marcandre.lureau@redhat.com> References: <20200107150442.1727958-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: a9tCNLZvPH2GguuZxdg9qg-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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?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.25.0.rc1.20.g2443f3f80d From nobody Sat May 4 03:02:49 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=1578409852; cv=none; d=zohomail.com; s=zohoarc; b=NdFOBFeAEgkstzarBFuZkQuDgzscHpW09VRihtgIMuCJMd9GXIYqlr9uoteE5g9e9Gl9/D3132awxq1spTim+KiyMQtMjU2eRLWZEb/SuApKRJbkl34g+M/4rtKc/E4S7QFVS+gmfjaAxx9lH8oIlNxd8W0zjISMuluXhYTSUi4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578409852; 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=dbd077mADMq3Qk1T2Bphiylzf67SiuodTtJ34Vp4XAc=; b=PtNFwr+ouLBgFWxYUi9InSi438KL/YgowMrH9WkZpWiqfZ23s8ikv4f84o2cOWw8O6xBvgevDuKWdX/pQvIpu7LhMdce9T4+9tzNrs5bgYFMAxkNkfEmQCj8Or2ShlI9l2uwaFHA1uIjgCnJQT9CMVzMWc0/axrOyHwd6W7j1tk= 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 1578409852569517.6828407428709; Tue, 7 Jan 2020 07:10:52 -0800 (PST) Received: from localhost ([::1]:51062 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqVP-0007el-EE for importer@patchew.org; Tue, 07 Jan 2020 10:10:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55030) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqRO-00013f-7E for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:06:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioqRN-0003fd-1v for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:06:42 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:57491 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 1ioqRM-0003fS-UU for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:06:41 -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-194-E9DKOHozPRu_vUOmjmJFpg-1; Tue, 07 Jan 2020 10:06:37 -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 7D5E7477; Tue, 7 Jan 2020 15:06:36 +0000 (UTC) Received: from localhost (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 35E28858B9; Tue, 7 Jan 2020 15:06:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578409600; 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=dbd077mADMq3Qk1T2Bphiylzf67SiuodTtJ34Vp4XAc=; b=imE+V8tr2ghPuZFvmHEqVoghyLNYBTPbv0J7Za9hMSniIPK9F63eDuTkU0trtUiSQGjHS4 B94SeAebGd8C6ErD+a8e12Wiasr9I+a2dacaCdJORftQwMug2KiIgNgGLus8SKXI/CkmwB Mz+S45RTl3xfnycZ8K1rdGY5s/CP/ok= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 09/37] serial: add "baudbase" property Date: Tue, 7 Jan 2020 19:04:14 +0400 Message-Id: <20200107150442.1727958-10-marcandre.lureau@redhat.com> In-Reply-To: <20200107150442.1727958-1-marcandre.lureau@redhat.com> References: <20200107150442.1727958-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: E9DKOHozPRu_vUOmjmJFpg-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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?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 --- include/hw/char/serial.h | 2 +- hw/char/serial-isa.c | 1 - hw/char/serial-pci-multi.c | 1 - hw/char/serial-pci.c | 1 - hw/char/serial.c | 5 +++-- 5 files changed, 4 insertions(+), 6 deletions(-) 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; 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); --=20 2.25.0.rc1.20.g2443f3f80d From nobody Sat May 4 03:02:49 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=1578410027; cv=none; d=zohomail.com; s=zohoarc; b=WvEr3xEApp8M5SHaNKg2YwN9UXauPBz63ezKrVHyC8cX+Pa48NixJOl/wMAS3b0j2XHxUooXPFU2hzL0mmGegbASAEaAqnezVQd8Yr1ByQrr3TJX3aFkn2vBpfGgfnheJ2yxlWaz+QzW8vTxHEFNWWjKORoMJLUqFmwEApWDMGk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578410027; 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=Talw5jUzgWq5l2ANbvrILPkF71xAdiMZAf+68WB+BBE=; b=JqL+quUhnYrC936qWr8Yvd6PYV5PSO7KiNeOciFBxBwma0VCe5fz7Md8u/90FzGoQUszkrDThFwrE5V1CHbSveGrLiRudRIFoKDnoASlhJ0INbnip568whAci4pjwvOnWPRlpYe8yHY0sLX42rD+eHzMlFiSLK8siv5tZ/WtGhA= 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 1578410027956814.9881236817155; Tue, 7 Jan 2020 07:13:47 -0800 (PST) Received: from localhost ([::1]:51134 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqYE-0005ub-Gy for importer@patchew.org; Tue, 07 Jan 2020 10:13:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55138) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqRY-0001Na-Ds for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:06:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioqRX-0003m7-3U for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:06:52 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:43057 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 1ioqRX-0003lt-05 for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:06:51 -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-185-X34d2h7qMIOzdSFlzNbofw-1; Tue, 07 Jan 2020 10:06:49 -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 96374107ACFA; Tue, 7 Jan 2020 15:06:48 +0000 (UTC) Received: from localhost (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6E2EB7DB56; Tue, 7 Jan 2020 15:06:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578409610; 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=Talw5jUzgWq5l2ANbvrILPkF71xAdiMZAf+68WB+BBE=; b=bwlnY4Lkm5rLH3+oKNnzQTnFQXBxsbTpg5xNuY+J/i4oNBZ2xqL7IGrc2FgmlNqOT2pOgW 6eLQ8PwqjyFvDXY7zivWZcgzAPW97Ih2P6OokMLHoO1JQAA+xdiFGTSBee8Z66Pdut98YG zB0h8g1gRjn21UIewCPFEDId0U/KHT8= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 10/37] serial: realize the serial device Date: Tue, 7 Jan 2020 19:04:15 +0400 Message-Id: <20200107150442.1727958-11-marcandre.lureau@redhat.com> In-Reply-To: <20200107150442.1727958-1-marcandre.lureau@redhat.com> References: <20200107150442.1727958-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: X34d2h7qMIOzdSFlzNbofw-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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?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 --- include/hw/char/serial.h | 1 - hw/char/serial-isa.c | 2 +- hw/char/serial-pci-multi.c | 2 +- hw/char/serial-pci.c | 2 +- hw/char/serial.c | 8 ++++---- 5 files changed, 7 insertions(+), 8 deletions(-) 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 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 --=20 2.25.0.rc1.20.g2443f3f80d From nobody Sat May 4 03:02:49 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=1578410251; cv=none; d=zohomail.com; s=zohoarc; b=Q8H6/wHASxYtYvBs0pkGjf6ikrQ9FTZToTIjuTnIYI3rP36XFXHuuVyGX79bHrtYrABeIsq6nS/lX4doYM88MoaEB627LCNGawgPUzomA3yUQRZ0zji4KIzS9s/ShdBJUU2U8xJgg3DMNLSgsN0acrNqdmHyCRWt0xPyJlHnIPk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578410251; 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=8Wm5JXV26MNfLSJnGEn56duOnvwT7wbzw95nAqK6jGg=; b=evlyzPDHILuaDakUCu8Ndlom2BWmK7Ya4c9mAeZyomfCCvLgpbCnMEFvPOoN/eMTy71wW2gOzg//kFu40PQbrbm0eAIHrkbN46NmYn0tobEPB1vVmNWeNYX3XHhV8l1K9y6owQ0ok6ulAzVLqVNfpM0ro6zCxHrjmh65QBesWnQ= 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 1578410251566701.6168464998044; Tue, 7 Jan 2020 07:17:31 -0800 (PST) Received: from localhost ([::1]:51234 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqbq-00039E-02 for importer@patchew.org; Tue, 07 Jan 2020 10:17:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55234) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqRk-0001oo-6i for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:07:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioqRi-0003tc-TB for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:07:04 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:35251 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 1ioqRi-0003tR-PD for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:07:02 -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-297-xlnsNtazPd6M9PqONbbDow-1; Tue, 07 Jan 2020 10:07:01 -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 45CB61800D4E; Tue, 7 Jan 2020 15:07:00 +0000 (UTC) Received: from localhost (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id E0B105C1B0; Tue, 7 Jan 2020 15:06:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578409622; 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=8Wm5JXV26MNfLSJnGEn56duOnvwT7wbzw95nAqK6jGg=; b=YexHKWocuut+2Lp9mvmLLxBQZZMjITVwR8k45GLhlvcY2crDb6eNGB7SNWkVRndl6nHX17 d7KymNs3LVCl8sM04kCOsAcfTGyHVfApIaX1RS0yUN1BdeRyDojYlVw7ch/hgW/ABVsUaU d9OyylZ5u9Lc2IJGn2dIV42jKEByODk= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 11/37] serial: replace serial_exit_core() with unrealize Date: Tue, 7 Jan 2020 19:04:16 +0400 Message-Id: <20200107150442.1727958-12-marcandre.lureau@redhat.com> In-Reply-To: <20200107150442.1727958-1-marcandre.lureau@redhat.com> References: <20200107150442.1727958-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: xlnsNtazPd6M9PqONbbDow-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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?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 --- include/hw/char/serial.h | 1 - hw/char/serial-pci-multi.c | 2 +- hw/char/serial-pci.c | 2 +- hw/char/serial.c | 5 ++++- 4 files changed, 6 insertions(+), 4 deletions(-) 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" 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; } --=20 2.25.0.rc1.20.g2443f3f80d From nobody Sat May 4 03:02:49 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=1578410982; cv=none; d=zohomail.com; s=zohoarc; b=M4Y2F/y9cr6zmGRsCGm6n1qZNYyD+k8CR/TGlruWQbUaL4Y608wugyP0X2I5FsPscZZLN51yYNXCBGl6x2TztSbXBsIroCgrIoEUcLLdRbRYIOSUAYDUonDvs6BEN6xdzJ5OnYWm5q8+w6lndr6UG0v4mhwRLNMcolvlg1ieeFQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578410982; 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=c7cGot02nRRi0ZPDjFe9KWGgNNA0vm+nIgmhLwmAjqk=; b=AGo7ulTT4qu+OftK6ts14m4fVBWZhqzqOVDccOVq6Ey1q75UQAOZFrRcBVRNza2xrwnlMqla1XWX659/IJK4bCfApJtPvJVfWLQhPSh7P7rx157uQAsGVeG69cZ4avS2Le6SW1WYRpmiH95rliwAhKwmm9OKFHNm/jwp2N6wxeQ= 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 1578410982944940.9945668001443; Tue, 7 Jan 2020 07:29:42 -0800 (PST) Received: from localhost ([::1]:51470 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqnd-0005ky-9Q for importer@patchew.org; Tue, 07 Jan 2020 10:29:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55317) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqRt-00024O-MU for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:07:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioqRs-00040y-1C for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:07:13 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:55074 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 1ioqRr-00040V-Qe for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:07:11 -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-317-hP629AO3OJKZh0ERJEh0pw-1; Tue, 07 Jan 2020 10:07: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 2D5B2107ACC4; Tue, 7 Jan 2020 15:07:09 +0000 (UTC) Received: from localhost (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id C10185C1B0; Tue, 7 Jan 2020 15:07:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578409631; 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=c7cGot02nRRi0ZPDjFe9KWGgNNA0vm+nIgmhLwmAjqk=; b=CgeE8h1lL9HcdnvbFVlik0EyJxXnWxQaIJNHrILGF5MqmjM1oDnPGcsqF4N3igpSKNYC/k 4eQV/D48+CryWg3kDHAHFCp9aoME/Xkjy9ECArRMAqDSAxoHgeVoYh+Lk8mXxaUOHVOjmu qQhn8PPrdnWCquL+s+/RpS349l7L1pg= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 12/37] serial: start making SerialMM a sysbus device Date: Tue, 7 Jan 2020 19:04:17 +0400 Message-Id: <20200107150442.1727958-13-marcandre.lureau@redhat.com> In-Reply-To: <20200107150442.1727958-1-marcandre.lureau@redhat.com> References: <20200107150442.1727958-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: hP629AO3OJKZh0ERJEh0pw-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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?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 --- include/hw/char/serial.h | 20 ++++++++--- hw/char/omap_uart.c | 2 +- hw/char/serial.c | 72 ++++++++++++++++++++++++++++++---------- hw/mips/boston.c | 2 +- hw/mips/mips_malta.c | 2 +- 5 files changed, 73 insertions(+), 25 deletions(-) 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 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..824390817c 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, - 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) { - 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 --=20 2.25.0.rc1.20.g2443f3f80d From nobody Sat May 4 03:02:49 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=1578410423; cv=none; d=zohomail.com; s=zohoarc; b=hgEfuRdQD4WN7GC1h1wM01PIsdWvhclUPIa7Sqx4v+V+qiu9l8h4T9iWhbVafp/bxLAm1I+tU3qodHnc06PBA26VaCpXelmFihk7kJD7sgn7XEr+gIBQenX60oMTUvyqM/qHh284HdUikedLIRaEhDT3N0DrQ3kuapq4QdI5AnM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578410423; 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=cbqc7641qRon/YAggegGogGXKXemES7eWyGAzo0ag/Q=; b=kO4lyy42hsEb/dqrO3ygl+BWj1Ffm8gI+bbW+Da9YzGgFHhwVlwpDRo98pRjJMy7Bmk9140/iYCxOS7YzjCfq4AaSI2keK178az0WMCn09IhpgGqojsJliXkP9ImNlfzPaiBt/uS3LU/fq9Z63D9rMjGgqR1JdLOFdb5Cf7I7WQ= 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 157841042330193.2202203631789; Tue, 7 Jan 2020 07:20:23 -0800 (PST) Received: from localhost ([::1]:51270 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqeb-00088B-QN for importer@patchew.org; Tue, 07 Jan 2020 10:20:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55430) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqS7-0002SV-0k for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:07:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioqS5-000490-KJ for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:07:26 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:21488 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 1ioqS5-00048k-GU for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:07:25 -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-288-pcx_mz80Plm5GhGTlrJMqQ-1; Tue, 07 Jan 2020 10:07:22 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 18FC8801E72; Tue, 7 Jan 2020 15:07:21 +0000 (UTC) Received: from localhost (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8BC6060BE2; Tue, 7 Jan 2020 15:07:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578409645; 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=cbqc7641qRon/YAggegGogGXKXemES7eWyGAzo0ag/Q=; b=Hvpf5dx/dmSgsB81odYYHvAk3tszZSDJth4YzkC4VoEiXZDB4yUHT4Rm5luPbFL+WSy8Xt UG4cMIh/UBgA0AT954Vl/K7ZqlFEuuyNTPEofUrLKN1JQ/joKTRGHBJUTlYZBdEbA2AzFR fnfA56lY6YVD0EvhVpOwUBvBkTTxg/8= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 13/37] serial-mm: add "regshift" property Date: Tue, 7 Jan 2020 19:04:18 +0400 Message-Id: <20200107150442.1727958-14-marcandre.lureau@redhat.com> In-Reply-To: <20200107150442.1727958-1-marcandre.lureau@redhat.com> References: <20200107150442.1727958-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: pcx_mz80Plm5GhGTlrJMqQ-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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?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 --- include/hw/char/serial.h | 4 ++-- hw/char/serial.c | 22 +++++++++++++++++----- 2 files changed, 19 insertions(+), 7 deletions(-) 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 diff --git a/hw/char/serial.c b/hw/char/serial.c index 824390817c..f11f2cdbf3 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) --=20 2.25.0.rc1.20.g2443f3f80d From nobody Sat May 4 03:02:49 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=1578411221; cv=none; d=zohomail.com; s=zohoarc; b=lXfa+7C7TZOkT7JGde7TdscXj3tsFr52dtBdylVLzFjE5WHnZ2ath5KfYWDqWmqV+mkh/4pYK87E0hjUE4T42DTKMwWHRzSQEtf1+wLZsBdVRGVMHHD+Zaf5GF5soD+ogGserpS/sCau/qsugmBHhX/VO6AgkB1EgSF00KrI550= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578411221; 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=kI6pSG6OmGlXrGRWRpbBi0BytZEs4j0QsGrVxt/RDGI=; b=AmEIFFc8tx63NJaziee326UDzU+nfQ00hxMjr3q+gUnUOahDcmt3SZk2mvize/m1gZK1mmPRH1ZOcmix1n1oDa6UepTFskrP42Ms7u9FFMOR2za1hLGIdIdm8X+JT7IJ8zcm7k80NtzgS7L4eNrlvcWekp/tVqqTTWfiJL/pRjY= 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 1578411221634481.25436239171836; Tue, 7 Jan 2020 07:33:41 -0800 (PST) Received: from localhost ([::1]:51598 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqrT-0003mJ-Fc for importer@patchew.org; Tue, 07 Jan 2020 10:33:39 -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 1ioqSE-0002gp-2P for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:07:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioqSC-0004EQ-Vd for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:07:33 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:50003 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 1ioqSC-0004DF-Rp for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:07: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-130-xEegNNJKOayaXX_iBsTnQA-1; Tue, 07 Jan 2020 10:07:29 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1EA4D8024CD; Tue, 7 Jan 2020 15:07:28 +0000 (UTC) Received: from localhost (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id B8C1960BFB; Tue, 7 Jan 2020 15:07:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578409651; 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=kI6pSG6OmGlXrGRWRpbBi0BytZEs4j0QsGrVxt/RDGI=; b=Wwg4y2bSv1squ1AxK8BrE0vvNj7Q0kLrv7/EZO61EPj4L5eaj1XAw4AElk0Key3M5pWZ5o Zdg4nhbOV1xEbXme3b5awwwd7xlINhd8BX421i/wW7qKk4faVTcm6eQV5IJHk0hHLHSUzF jB9XOj1MnMFcdJjwm4aWWvjFoB2r5mc= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 14/37] serial-mm: add endianness property Date: Tue, 7 Jan 2020 19:04:19 +0400 Message-Id: <20200107150442.1727958-15-marcandre.lureau@redhat.com> In-Reply-To: <20200107150442.1727958-1-marcandre.lureau@redhat.com> References: <20200107150442.1727958-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: xEegNNJKOayaXX_iBsTnQA-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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?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 --- include/hw/char/serial.h | 1 + hw/char/serial.c | 2 ++ 2 files changed, 3 insertions(+) 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; diff --git a/hw/char/serial.c b/hw/char/serial.c index f11f2cdbf3..1d350a851b 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 --=20 2.25.0.rc1.20.g2443f3f80d From nobody Sat May 4 03:02:49 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=1578411225; cv=none; d=zohomail.com; s=zohoarc; b=lzqdfBlV3ZuLywrpjh7fBSB4giZzWd7FU32VgCD6H1AOOfWW71mTwme7ENT1tojN9UfY7x4XkZBdzs9u4EgjIUA+RV1Zb2h+n3rqYw7GGi82ijmQXk74MP0AhZQqGyKCZJsl2izZsFny73aRy0XcqZOfgUQtqCTbO8RK6O/p1is= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578411225; 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=ppDKqzfEKKIG7Qx/VnzMAXmwrM9QBgkLvpbuCCdqIC8=; b=E8knLBL6Hv1T5vosBLlFGRbasya0WnsWIUFWJ3nbcMDwB1kiosZOX8T6m0JRtXhRt3ig6JScEbxEJodHNp9LhkS9tQ64X0pc/aQ9Vjd6XVoXMO2tGRrzAc7itLhASrusNjf7EQuppXvE/KD+SZepRS5SFMBvGtkG6D2pBquzb90= 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 1578411225516314.1347932699025; Tue, 7 Jan 2020 07:33:45 -0800 (PST) Received: from localhost ([::1]:51600 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqrW-0003ou-Vt for importer@patchew.org; Tue, 07 Jan 2020 10:33:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55658) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqSQ-00039x-EP for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:07:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioqSP-0004NA-4J for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:07:46 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:60113 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 1ioqSP-0004Mr-0L for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:07:45 -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-217-5kqHPY8nN_COJ5cHpd_zeQ-1; Tue, 07 Jan 2020 10:07:43 -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 6C2C0107ACCC; Tue, 7 Jan 2020 15:07:42 +0000 (UTC) Received: from localhost (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 106BC86C40; Tue, 7 Jan 2020 15:07:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578409664; 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=ppDKqzfEKKIG7Qx/VnzMAXmwrM9QBgkLvpbuCCdqIC8=; b=VvK5mnjV8lTRQatT6m5exNpxLCluSU/C78BpZusCvYtI1wkOB1zVGJtfdphS0NR5WJO/kn fgF9gZwv1oe24e3ZuJG+8KZ+cZStmkOOag/78KPstjXN8vlMk6UsyS8PTbeYwU/NHc2nba YZRkXKAs4UT+fhE9M2D2o2PyX6ZZNPI= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 15/37] serial-mm: use sysbus facilities Date: Tue, 7 Jan 2020 19:04:20 +0400 Message-Id: <20200107150442.1727958-16-marcandre.lureau@redhat.com> In-Reply-To: <20200107150442.1727958-1-marcandre.lureau@redhat.com> References: <20200107150442.1727958-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: 5kqHPY8nN_COJ5cHpd_zeQ-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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?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 1d350a851b..b3927c7198 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.25.0.rc1.20.g2443f3f80d From nobody Sat May 4 03:02:49 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=1578410568; cv=none; d=zohomail.com; s=zohoarc; b=XSqhuiUAcuU4gR41owaxFX2o7JRkVDaMKu8xYjw8dEJhEQwKRsk4XMxusJZDvjIBfADhl8BQKi9Rvr3MZEBNUXbGoaAUE2C7uoHeVEa9ngeWdNmenpRAPiXbJNnxE5EnsNsFmOt9whhIwUo6gk3IhMFIpZ64n5wpI0nOOuo09xE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578410568; 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=EoQ7Kgta/Dk3zL+p080x+mPZq8RRlKUz0LtppMW11Sg=; b=jho5NDrUeq/tSKhchR5Wp2ZDuP2RoWsfOUs8YBoRQDFtUyMqnSTae8gLdUgLCTuOoahNmskzpwe1nOYK9nsA29i1Pc1oVFttrDdUlpeYmUje6fQ4fRCBK05f8EcmA4LAnhSCEbll2ntqDU4KRbfuy9H14J8XbrJaiJETFS9KQOM= 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 1578410568887197.1873602552953; Tue, 7 Jan 2020 07:22:48 -0800 (PST) Received: from localhost ([::1]:51356 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqgx-0003oL-4M for importer@patchew.org; Tue, 07 Jan 2020 10:22:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56003) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqSq-0004Bw-5y for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:08:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioqSo-0004go-Vv for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:08:12 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:57252 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 1ioqSo-0004gG-S6 for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:08: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-103-rgG-TFwHNyaQG-I4NlTt4w-1; Tue, 07 Jan 2020 10:07:55 -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 0621A801E7E; Tue, 7 Jan 2020 15:07:54 +0000 (UTC) Received: from localhost (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9522D10018FF; Tue, 7 Jan 2020 15:07:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578409690; 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=EoQ7Kgta/Dk3zL+p080x+mPZq8RRlKUz0LtppMW11Sg=; b=iXf/p66qhYp5NW3kVDQGJiOyIV3L9oguGhxeC32rQUwUnyLpMlMsQvbWALncoZAQdwrdZ7 JmYxlcjKF94RCw+xLc2GpMEa0TVo8PRtHXiaIrfhhTpBMqhSW+QAwa0O0G3wkovHJXB/GD z33CmVxf9Kdfbaxi8KgigdfjYU6Y1+c= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 16/37] serial: make SerialIO a sysbus device Date: Tue, 7 Jan 2020 19:04:21 +0400 Message-Id: <20200107150442.1727958-17-marcandre.lureau@redhat.com> In-Reply-To: <20200107150442.1727958-1-marcandre.lureau@redhat.com> References: <20200107150442.1727958-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: rgG-TFwHNyaQG-I4NlTt4w-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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?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 --- include/hw/char/serial.h | 13 ++++++-- hw/char/serial.c | 64 +++++++++++++++++++++++++++++++++------- 2 files changed, 64 insertions(+), 13 deletions(-) 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, diff --git a/hw/char/serial.c b/hw/char/serial.c index b3927c7198..3bcb7a6268 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 --=20 2.25.0.rc1.20.g2443f3f80d From nobody Sat May 4 03:02:49 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=1578411408; cv=none; d=zohomail.com; s=zohoarc; b=nOiYWm/IHv8E+kRZCP9qZ+X/PiA2+zAdPap0Vw6r3qG1NbO5vk7MzY/b32UAk17nSnxZmcN64ClBRqKDHtkfC6L2h/eTDXE/orK+9Tx235EkGnAbNPkK54yEs19iLh+uBpNZPnSHDX74jWQak0qXu+247Zyp90xivGsuEOInnX8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578411408; 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=xzTtrwPBUO3ZOQDiQCQoKIsWvB6AIY1hpawn1DUdOoU=; b=EeVN6ap/Z/Zpmo3GhKgFsc6wRTqJ6xCZkHI70nRI9xVK2VLRj2nRV+LMzgzAouyzIHFXAD4+CM6rCa0jWezUIeghrAv9wCzQGaOrTdTkIRg76LkqjyVhSV2EkK2cN+bayxZb5gSlW/JIgfxDgpIj0VsBaIueXkTKtNQ0bOXa9d4= 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 1578411408084443.92098480000607; Tue, 7 Jan 2020 07:36:48 -0800 (PST) Received: from localhost ([::1]:51656 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioquU-0000my-IV for importer@patchew.org; Tue, 07 Jan 2020 10:36:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55979) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqSo-00047I-Fi for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:08:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioqSn-0004fH-5k for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:08:10 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:29384 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 1ioqSn-0004ei-2B for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:08:09 -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-311-3x0A3W4zP7SChYJuzCVO8g-1; Tue, 07 Jan 2020 10:08:07 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 84678801E6C; Tue, 7 Jan 2020 15:08:06 +0000 (UTC) Received: from localhost (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id D466360BFB; Tue, 7 Jan 2020 15:07:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578409688; 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=xzTtrwPBUO3ZOQDiQCQoKIsWvB6AIY1hpawn1DUdOoU=; b=OR8rLhqq2Gh6PXbdZQAXlnP2xbKASTYbEOTjzWbI6BkgCaU3VMGSM4RlecVJ3Vyu1iCHYc ZLabzRupl+loPbUr5kYAay8FnC9RvSIyc0w0xMdlj1apO4HAe8IsRoelSMPMPAnfeH9OaX RTLLimDW69qH9dgOdJQmpbRu6VWKtdY= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 17/37] mips: inline serial_init() Date: Tue, 7 Jan 2020 19:04:22 +0400 Message-Id: <20200107150442.1727958-18-marcandre.lureau@redhat.com> In-Reply-To: <20200107150442.1727958-1-marcandre.lureau@redhat.com> References: <20200107150442.1727958-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: 3x0A3W4zP7SChYJuzCVO8g-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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?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 --- include/hw/char/serial.h | 2 -- hw/char/serial.c | 16 ---------------- hw/mips/mips_mipssim.c | 15 ++++++++++++--- 3 files changed, 12 insertions(+), 21 deletions(-) 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, diff --git a/hw/char/serial.c b/hw/char/serial.c index 3bcb7a6268..7746dfcee8 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. */ --=20 2.25.0.rc1.20.g2443f3f80d From nobody Sat May 4 03:02:49 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=1578411396; cv=none; d=zohomail.com; s=zohoarc; b=bUaKqdMFe/RaO1L5K9cVZOixuBEngSPfbZ2lF/OsoYLqDk9R/fw4ir/whNXa5RoyU18aenXpIyUq+OVDkl064USEVBECMdxd1yiAtV9japZCd1BsnhysBLt16M08EmhxFFNnVcNouH424rLjIrT+c5V5fTszYLqYWbSHCzEmft0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578411396; 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=BOdzojM+GpgPhoiQETD7c4Xg96ayK0KHATO9/8tmr94=; b=Bytjhch2BgilMddx7NnPRqBS4GtjHGzNn3ZuW+3IK7TJDDujjUc3g549DP7QvMDqg7NCerzSpUsqgFd6DjLPW1eDD+m3gF+Fo1Q8dPuggvuBccZOa4z1VaxCJXzISLWrltAV8AEffS7ZgiPHRvNZHG9TOPbrMDYDNhJuPeCpaK8= 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 1578411396440335.49493303417887; Tue, 7 Jan 2020 07:36:36 -0800 (PST) Received: from localhost ([::1]:51644 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioquI-0000TU-W4 for importer@patchew.org; Tue, 07 Jan 2020 10:36:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56176) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqT4-0004pS-5S for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:08:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioqT3-0004q4-4U for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:08:26 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:49692 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 1ioqT3-0004pR-0y for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:08:25 -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-359-QuP8-4epO7G2v2ReyyThBw-1; Tue, 07 Jan 2020 10:08:21 -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 A3DAA800592; Tue, 7 Jan 2020 15:08:20 +0000 (UTC) Received: from localhost (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id B4CD95D9CA; Tue, 7 Jan 2020 15:08:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578409704; 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=BOdzojM+GpgPhoiQETD7c4Xg96ayK0KHATO9/8tmr94=; b=KCuPPvptdJSvZz5A2Sm7YGyT9azG167v1WKSHM5H4ZyBbj8BYu7Cm5x35rM0tTPkNuAN1C 5JtD6OmMWp/V01MPrGVzcAaMe5x+qlI4z+vAclF+vAmjL2cVfge6LUNiwWyk8jmVmPbScL 8ZIldR5mxJUt3LHt+nps2f3ICWODakE= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 18/37] mips: baudbase is 115200 by default Date: Tue, 7 Jan 2020 19:04:23 +0400 Message-Id: <20200107150442.1727958-19-marcandre.lureau@redhat.com> In-Reply-To: <20200107150442.1727958-1-marcandre.lureau@redhat.com> References: <20200107150442.1727958-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: QuP8-4epO7G2v2ReyyThBw-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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?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.25.0.rc1.20.g2443f3f80d From nobody Sat May 4 03:02:49 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=1578410720; cv=none; d=zohomail.com; s=zohoarc; b=UTocm0IabkpLFugCGtJRj+HMS3nJUo0SWWUSK26ejUC/CCX9lfce7xu377QUlvOOmQ0fud9AjTef4qfw9PoUhqKY7UzCqFtM7vhiu6swhAOHbB2N1BGyqF7jTUyiDRe9gawfavXIoOCmJL5CJI6YlkyDszKZdPTGxf2xPlBMVOs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578410720; 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=oKTV1GWDNyd1B33P8RLG1jvM7IO9biN04q66oucReX4=; b=mCttAOJYb1Bb8HkA/Fn1OJFKNnxQJqwDXwdDwI2Ykl6Qhd/a9Fbb87hQ7O+ho48mZie+pDo64qBoadHXPPOJUt3zrIg+RF4pcVJXwBRlUnFgSvbKfLucHK6+pMV20iZnrlpLZyXKaYAG17u6n8/At7qRTkPymS6nHLB3KWkL0+I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1578410720822441.6144116875205; Tue, 7 Jan 2020 07:25:20 -0800 (PST) Received: from localhost ([::1]:51404 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqjP-0007gy-Aw for importer@patchew.org; Tue, 07 Jan 2020 10:25:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56285) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqTF-0005GA-3o for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:08:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioqTE-0004wZ-1h for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:08:36 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:23905 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 1ioqTD-0004wJ-UI for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:08: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-24-d795MoZcN_aP-P8cqudPdQ-1; Tue, 07 Jan 2020 10:08:34 -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 410F11005502; Tue, 7 Jan 2020 15:08:33 +0000 (UTC) Received: from localhost (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id E25E07C82C; Tue, 7 Jan 2020 15:08:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578409715; 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=oKTV1GWDNyd1B33P8RLG1jvM7IO9biN04q66oucReX4=; b=d5+ROMOeLckWnQY16FNyKNiDM5EyUuATGgAxvvYGR/YVKiIkitOucK90SQkHCtZWXYzzVo iHwXEGGVr8z6icLjlGzncYti5tMUf3RozGzhOzNMXFZLvOwiqWWfyPlrw6ddyYQ1vqXh4X qPIjizmNA7VMXP2NsUQHty+T8HQ8elA= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 19/37] mips: use sysbus_add_io() Date: Tue, 7 Jan 2020 19:04:24 +0400 Message-Id: <20200107150442.1727958-20-marcandre.lureau@redhat.com> In-Reply-To: <20200107150442.1727958-1-marcandre.lureau@redhat.com> References: <20200107150442.1727958-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: d795MoZcN_aP-P8cqudPdQ-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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?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.25.0.rc1.20.g2443f3f80d From nobody Sat May 4 03:02:49 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=1578410211; cv=none; d=zohomail.com; s=zohoarc; b=n0pHMLSVr4CmVJqpxfl/UW/REm4mmIh7HbY/3aCoPjsPR/XxJt0az9E+qOIUk0gj+M8AzrE0HP6XpJmccKdQGzJwdmxHA4xaR21i6wGTeBevJjx/z6eDI3YAbdco5llf55LquRTFJ5oRZegiCViRqls0vSIAkklZ6jHiwDONDZo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578410211; 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=+k9m31JXISacHhMNs6aatbQWb8ObMJVtwFYVXXhkj0A=; b=XC3mrqHiB66ffEBNiYj9hYcJ/WTR6Hur2L6JhCX8XaA+zuwoXRjdTTG0UhlzUrUfvsIwEKPIFwVF8D/cL8nfIvbuZ/mho7ga7LdUpbtyCUIjtZmtaGXNtLNwkOiGl6gWTAfLM2MIJiUjHVAGd0fxggb6JqNcB80JlqakgDu9ARk= 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 1578410211701563.2155347955477; Tue, 7 Jan 2020 07:16:51 -0800 (PST) Received: from localhost ([::1]:51202 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqbB-0002Br-RC for importer@patchew.org; Tue, 07 Jan 2020 10:16:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56424) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqTd-0005dR-Ct for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:09:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioqTc-00058Z-AL for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:09:01 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:43274 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 1ioqTc-00056A-7D for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:09: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-227-k1H53Pa-Mb-fvdqzLkyM2A-1; Tue, 07 Jan 2020 10:08:53 -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 E89E4801E6C; Tue, 7 Jan 2020 15:08:51 +0000 (UTC) Received: from localhost (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id E01EA7DB56; Tue, 7 Jan 2020 15:08:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578409734; 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=+k9m31JXISacHhMNs6aatbQWb8ObMJVtwFYVXXhkj0A=; b=fmPVcdW5tLZTv654wYoCzejtL7lktw/cgaAktkyHmauX0ofKcolfH8iv+LFZfzHk07D0hc FMY8XHfVOv+bx5OOcGTLuVtlIn3nn4lGO7L6JPNkPtCJsZkfbm5HMsoU57KJ6arKWj0f2N pwFP53tMfE6kK5cvFykU7hUgTY77Dqo= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 20/37] mips: use sysbus_mmio_get_region() instead of internal fields Date: Tue, 7 Jan 2020 19:04:25 +0400 Message-Id: <20200107150442.1727958-21-marcandre.lureau@redhat.com> In-Reply-To: <20200107150442.1727958-1-marcandre.lureau@redhat.com> References: <20200107150442.1727958-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: k1H53Pa-Mb-fvdqzLkyM2A-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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?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 7746dfcee8..6c327183c7 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.25.0.rc1.20.g2443f3f80d From nobody Sat May 4 03:02:49 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=1578411553; cv=none; d=zohomail.com; s=zohoarc; b=VYjUUH46IrFATiZMq270Qj38cjitAQpAMkE5wq57W6nyyb9iP62Y0G3b7RtjAZAcsUsLUAHX56Kp3kXCeZr6t2X/Vw2wWdwCrosnx1/dIer02Xd6pDy0//XD/m2DBcVS3BaHdjS4w8yklSXpvJMXuee/rOqyZhA2r3gQLOWxvMA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578411553; 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=qWU06SAb2lQ4co3U/MTSi0noVCyj/2NfrdawA6tKgIk=; b=GBe7hJECXdcjBM08I6d/QSsHPNchQTKExRx+gUCZu2d6ZWeB3a7VtSWGSwfKRCN61WBpEFb5uhD8FaU4ZM90okmZKoCEtG1xi/QtPDb0VjjdFi/lgu0jchAbvJwbYhet1J/sA/l7vfPV8cqqIJg1d7JOw1+imnD1t6n+Yf2LTyc= 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 1578411553434901.2677949187648; Tue, 7 Jan 2020 07:39:13 -0800 (PST) Received: from localhost ([::1]:51704 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqwp-00055z-Ph for importer@patchew.org; Tue, 07 Jan 2020 10:39:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56650) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqTq-00066s-Nv for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:09:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioqTp-0005PK-Di for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:09:14 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:55854 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 1ioqTp-0005Oa-A3 for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:09:13 -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-63-FWLcTUPUNbeLdjWWG_KppQ-1; Tue, 07 Jan 2020 10:09:05 -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 585F3800D41; Tue, 7 Jan 2020 15:09:04 +0000 (UTC) Received: from localhost (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id F41CE7C82C; Tue, 7 Jan 2020 15:08:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578409752; 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=qWU06SAb2lQ4co3U/MTSi0noVCyj/2NfrdawA6tKgIk=; b=F+CKXFecLxCKhbBhOV/+d8FFj6usa18SxzIHdjQ/MtcDCN8RYONzsp/Aed6Ldw8NcRdQXH 77UI3mSFHNgmxErlvwn1ASF3HU01dZ0bWr+rE1594U1zz9hMiFh/obuS9GYFHYIbejH4om kWUnAK5c4Qcfk4XwEC7xutJxy9vjits= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 21/37] sm501: make SerialMM a child, export chardev property Date: Tue, 7 Jan 2020 19:04:26 +0400 Message-Id: <20200107150442.1727958-22-marcandre.lureau@redhat.com> In-Reply-To: <20200107150442.1727958-1-marcandre.lureau@redhat.com> References: <20200107150442.1727958-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: FWLcTUPUNbeLdjWWG_KppQ-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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?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.25.0.rc1.20.g2443f3f80d From nobody Sat May 4 03:02:49 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=1578410385; cv=none; d=zohomail.com; s=zohoarc; b=fY58KOsM0L021WLaLU6ftHCmeC1uSgsmd+rxRyPHh264DQkdysA3Qdn9miNkB2vVxvd1rQ0NAAGlhhWVxRJS5OWsdayhbxopgstsUnu9mTeWxW0hRlT1R5OhgqnVC0TN38iBb+DyOlOtkTud2uI5lH2DHuMlqsf0GN/uxcnZYr8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578410385; 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=KzZquunIWkcFxIp6xrNXd5CyX26rzDuiaRhlVh+ittg=; b=FI8RL2kaWrA/6MblKQ07t9Ix1we3f+4o9whPuVLKUvUR5bgrBgQuCHk3FtYpAUDvWS0BkUo6qqz/kdjMA4tpJI8m2mPfBbCUmS6rP3bYAdL1hKDDphkngAuUN7S9c869PLIvObBRf+KIQy+OnchrJRmetDNASmXFlC2xSLWO7ZY= 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 1578410385430641.8633156091837; Tue, 7 Jan 2020 07:19:45 -0800 (PST) Received: from localhost ([::1]:51256 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqdy-00075R-LA for importer@patchew.org; Tue, 07 Jan 2020 10:19:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56749) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqTy-0006PJ-Lo for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:09:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioqTx-0005ZJ-60 for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:09:22 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:58554 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 1ioqTx-0005Yn-28 for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:09: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-166-7G22zW-mOe2QoMaNYGPnZQ-1; Tue, 07 Jan 2020 10:09:17 -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 B1A36107ACC5; Tue, 7 Jan 2020 15:09:16 +0000 (UTC) Received: from localhost (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id B37E110018FF; Tue, 7 Jan 2020 15:09:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578409760; 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=KzZquunIWkcFxIp6xrNXd5CyX26rzDuiaRhlVh+ittg=; b=Wuh456UY7SJHQXfnkTjl2j7M7z0vYSSCFiGYBNDjT7wpyG6r0tzI0THZVsyMobK8jpXrWt ZfA//DAYtv6JlVkMJnmaRZg49iUyVfE578GOSDsvD4kF70V7ZF4vsII7UrOUVCFo7S9MF9 qRnqTlVbVf9tarAONS74Usb206PttKc= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 22/37] vmmouse: replace PROP_PTR with PROP_LINK Date: Tue, 7 Jan 2020 19:04:27 +0400 Message-Id: <20200107150442.1727958-23-marcandre.lureau@redhat.com> In-Reply-To: <20200107150442.1727958-1-marcandre.lureau@redhat.com> References: <20200107150442.1727958-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: 7G22zW-mOe2QoMaNYGPnZQ-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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?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 --- include/hw/input/i8042.h | 4 +++- hw/i386/pc.c | 6 +++--- hw/i386/vmmouse.c | 8 +++----- hw/input/pckbd.c | 8 +++----- 4 files changed, 12 insertions(+), 14 deletions(-) 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 */ 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); --=20 2.25.0.rc1.20.g2443f3f80d From nobody Sat May 4 03:02:49 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=1578410884; cv=none; d=zohomail.com; s=zohoarc; b=Jjux7CFkXoz5CFJcCuZjJ89cR83n7J4aSftOQ98tTnNG5qqOn1B5FPiPNwL3sAW3PKy3j7Ovw3UcBiyEbQdnyLHM0ItWamhODBUxU7RinWt2kAeGnEUIf1m5R8vhfq3cnBHLd9OXvEE7k11yKyzfVXlLzxU/TWwxXTImbB2Bq94= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578410884; 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=j8fewjeKg+zncBThUi9yhZeQUuxokLL3S6GoRnZbbtM=; b=P9c6hoJI/H9/5ihrqfxHShTmHJQpciHqgnFxXpJi0YDnrl04OEVjGVSY92/vE3wRQfuA7hDDgR141AEmhHrwBrgwXBFZZE01497GoFGix7M3QjN+w+Lm5+lsCm7u93/oaGHrWZIZThmjOc04K5AfNdJeHyjV7KrlJjL9961bstE= 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 1578410884879557.3440970094161; Tue, 7 Jan 2020 07:28:04 -0800 (PST) Received: from localhost ([::1]:51450 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqm3-00039X-6M for importer@patchew.org; Tue, 07 Jan 2020 10:28:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56877) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqUF-0006iY-Cb for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:09:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioqUA-0005lQ-9m for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:09:39 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:53054 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 1ioqU9-0005gH-1H for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:09:33 -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-o8T9gjszPounq9Kqa2_3ZA-1; Tue, 07 Jan 2020 10:09:24 -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 0D4021005502; Tue, 7 Jan 2020 15:09:24 +0000 (UTC) Received: from localhost (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4223B1001925; Tue, 7 Jan 2020 15:09:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578409768; 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=j8fewjeKg+zncBThUi9yhZeQUuxokLL3S6GoRnZbbtM=; b=GNoPZeGLXVdtfsANThS83Of3w3QuEdZ0pAxMIjRa9Un9XklLpBrszwP0O3uMI1jvjvkhCp NM/IlL4qZasU7hw3b8RMZKEUK+fVa2uXNeyjdQ74OZbW30Aw7szxIoNtw2C3Hso7gGpjWB qmd/pEyNdtONRmHSo5YLGt17u/IgR4c= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 23/37] lance: replace PROP_PTR with PROP_LINK Date: Tue, 7 Jan 2020 19:04:28 +0400 Message-Id: <20200107150442.1727958-24-marcandre.lureau@redhat.com> In-Reply-To: <20200107150442.1727958-1-marcandre.lureau@redhat.com> References: <20200107150442.1727958-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: o8T9gjszPounq9Kqa2_3ZA-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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?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/net/pcnet.h | 2 +- hw/dma/sparc32_dma.c | 2 +- hw/net/lance.c | 5 ++--- hw/net/pcnet-pci.c | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) 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; }; 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); } --=20 2.25.0.rc1.20.g2443f3f80d From nobody Sat May 4 03:02:49 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=1578411571; cv=none; d=zohomail.com; s=zohoarc; b=b4+ShCR/4YkZnFVZHkgbW+flpGssGwnbZ/DBAFe8xEnIgwqJX5+W/scXQFv3uyoYiLrUxSd4zQNLjsqRwv14TWNAUro1wN6mlJRPTk1SPlpotJcyTtnD4EmE+HxTRVphklmJWK8m/VJZOOFel5uSUpUYJC7tkTaW6lEEvJiWAmY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578411571; 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=G5o3BZFfXOYMxsGVfHABUVa3/NLQ378y2wjX3/MhgO8=; b=GeTw03/KH/eMAv4rzAeYuvkCisuJrEmqBN42VAvCooxP7HMQGn0X+nmw2UdY8Q3gkDIiFKV4wOMLvOuQNTOKUI10l8KKdFgI+nxCNc8r/NA6ehNrpBk7GWZi+MTsrZYOtbrXGo7w53DIIL0LAjLBckmO2JYac3Jb/F/E0ixIwEI= 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 1578411571581368.3854830590153; Tue, 7 Jan 2020 07:39:31 -0800 (PST) Received: from localhost ([::1]:51714 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqx8-0005fq-0A for importer@patchew.org; Tue, 07 Jan 2020 10:39:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56907) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqUH-0006kf-7u for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:09:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioqUE-0005oo-UA for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:09:41 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:45821 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 1ioqUE-0005nq-Pw for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:09: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-280-iksGxIo4P1yvzCZdR_BEAA-1; Tue, 07 Jan 2020 10:09:37 -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 2214A107ACC5; Tue, 7 Jan 2020 15:09:36 +0000 (UTC) Received: from localhost (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 963877C82C; Tue, 7 Jan 2020 15:09:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578409778; 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=G5o3BZFfXOYMxsGVfHABUVa3/NLQ378y2wjX3/MhgO8=; b=GGMGpTJuUvgkMdDNoLrsYDPrTng2SG4wAJdt+P7F2x6s6vrP2E0AgoRwOKp+62LKw623B7 gD9jHG70Gt6oC5cq1NRwsCuLzxvYrGo8PFd5a6r9fj9anWonjI6d9SnTmTreVDbbDhD+Am sLdjWtO3JNjU/OlRv0msHH2ciMjMZn8= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 24/37] etraxfs: remove PROP_PTR usage Date: Tue, 7 Jan 2020 19:04:29 +0400 Message-Id: <20200107150442.1727958-25-marcandre.lureau@redhat.com> In-Reply-To: <20200107150442.1727958-1-marcandre.lureau@redhat.com> References: <20200107150442.1727958-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: iksGxIo4P1yvzCZdR_BEAA-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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?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 --- include/hw/cris/etraxfs.h | 20 +++--------------- hw/net/etraxfs_eth.c | 44 +++++++++++++++++++++++++++++---------- 2 files changed, 36 insertions(+), 28 deletions(-) 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, 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, --=20 2.25.0.rc1.20.g2443f3f80d From nobody Sat May 4 03:02:49 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=1578411727; cv=none; d=zohomail.com; s=zohoarc; b=Nq7IXjHOD3tMbrEvoZYCpxHi2w7OXyoR5iS/68L+rYDFbbHfJ8LN5B1SoYi8NTdXT5HqfdQYB6nxGoTRWr+Wyx6sjQ4s1mG/ISi9OuDa5u4P802X5yQSmOkN4+E58netW2gSaMjQ20ADoJga2jDODWNSRzXTq44EKTQRp9OUCqw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578411727; 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=IuDUTL8sKfVL8YiysWAUm2XIrVkGt414sgEIf3Q3Blo=; b=ESJUFouYvPQMrwOJj9hC28+VlGPBk7k/UYPUEVi6AlAOgmSYsS79nPfejUvfssHmpbY2u/tPQDkfAn2zs88z22ZzR+/cDL1mOHABcfyHO2PHKuWKcZXbWLCqIyVH/GjlZDJLNM0QXr1HTeBz+rjJMHmVNLmqcMBa/iLcSdbozZc= 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 1578411727645847.6875639631555; Tue, 7 Jan 2020 07:42:07 -0800 (PST) Received: from localhost ([::1]:51762 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqze-0002K0-5d for importer@patchew.org; Tue, 07 Jan 2020 10:42:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56999) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqUN-0006xy-Ku for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:09:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioqUM-0005vT-Ba for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:09:47 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:47628 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 1ioqUM-0005uX-8A for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:09:46 -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-199-3CtiVAvUPgmyhfXknmHArw-1; Tue, 07 Jan 2020 10:09:44 -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 407431B18BC1; Tue, 7 Jan 2020 15:09:43 +0000 (UTC) Received: from localhost (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id DF6C985F13; Tue, 7 Jan 2020 15:09:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578409785; 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=IuDUTL8sKfVL8YiysWAUm2XIrVkGt414sgEIf3Q3Blo=; b=V2Os2q33FbLt6noUq6ZA+5E9uTf8eoY1mMVnIokw4wHGCeqR2G+lBSPEz/YwIwr/MU3BLj yZHUf2dQOdrI+ad3KFGUhBRj6r2hYEVl2dqnWsWZktgr4WBSJ7bINXBJPgGbnFnXX4rsCk UrCGCJ/nYy26T9r/3S86vJh3KIEtDxg= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 25/37] dp8393x: replace PROP_PTR with PROP_LINK Date: Tue, 7 Jan 2020 19:04:30 +0400 Message-Id: <20200107150442.1727958-26-marcandre.lureau@redhat.com> In-Reply-To: <20200107150442.1727958-1-marcandre.lureau@redhat.com> References: <20200107150442.1727958-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: 3CtiVAvUPgmyhfXknmHArw-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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?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.25.0.rc1.20.g2443f3f80d From nobody Sat May 4 03:02:49 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=1578411109; cv=none; d=zohomail.com; s=zohoarc; b=BLYS7EQ3mJMKLdIK3M3VdW0FP8p/Ud3t1iHiswd8tis8urtUF96YdGz8iVsf+dvq+G97bgosD/bg3EQfUJpPd0uDdd58uRsrvyMv+OCcfD66VaTl8+sQVbl0mo9DUqK4OE77I9IGe+suYJM3mja+WOMM0qm3SAPTW/vNvN/S+48= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578411109; 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=OSdXE6aO3COPgwUN67tSzIWaJRCE/hrcXuhXBWHXzNQ=; b=gAF+vIUtIlUj6rdxOBqmnLdrHTKMQT6HIUnqAZDr3o2rwiP0dlI+vKpegk3Gsu+AtXhlBgQoW2peSA07eyssQDOKby6kr04oqhi9QxiCWEOIiUB/yMU8r6mmIFSYmTawHZUO4BOtS8bcaH7Rsd4EGqB3cf82vRqch0MihtaWpmI= 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 1578411109782411.685219179672; Tue, 7 Jan 2020 07:31:49 -0800 (PST) Received: from localhost ([::1]:51508 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqpf-0000dd-UQ for importer@patchew.org; Tue, 07 Jan 2020 10:31:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57138) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqUZ-0007V3-Lb for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:10:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioqUY-00066W-6q for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:09:59 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:24584 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 1ioqUY-000661-3B for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:09:58 -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-242-xtuOLDRcNkOQtzFNCZ1Sgg-1; Tue, 07 Jan 2020 10:09:56 -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 8BD6910054E3; Tue, 7 Jan 2020 15:09:55 +0000 (UTC) Received: from localhost (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 87AB35D9E1; Tue, 7 Jan 2020 15:09:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578409797; 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=OSdXE6aO3COPgwUN67tSzIWaJRCE/hrcXuhXBWHXzNQ=; b=AnR801WrXhzUQO1oTesTRMiZJ7S1NZ6K1mOZMAIxdOygWIqT6GmSUC67rkHQZGmVKAsgXB H2jBK6BYGKAsT0B3okvvNYQpRYRfKIRYcL99TjBRYVp4w5zThVn/FQSyfqoVRHIbfXvkmQ vG2lrxYvaxbkXBUnK2rtLVvIy1qVSiU= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 26/37] leon3: use qemu_irq framework instead of callback as property Date: Tue, 7 Jan 2020 19:04:31 +0400 Message-Id: <20200107150442.1727958-27-marcandre.lureau@redhat.com> In-Reply-To: <20200107150442.1727958-1-marcandre.lureau@redhat.com> References: <20200107150442.1727958-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: xtuOLDRcNkOQtzFNCZ1Sgg-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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?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 --- target/sparc/cpu.h | 1 + hw/intc/grlib_irqmp.c | 35 ++++------------------------------- hw/sparc/leon3.c | 13 +++++++++---- 3 files changed, 14 insertions(+), 35 deletions(-) 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 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; --=20 2.25.0.rc1.20.g2443f3f80d From nobody Sat May 4 03:02:49 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=1578411834; cv=none; d=zohomail.com; s=zohoarc; b=oDY5+fkudDV5IqKF6rNbhTD7nzqL9KutywnFVYDbGEsGix+oliONeGi2tpib+VDWGcWiwpkmnUtYl35ciIl6i320zvA37we0K6Nd9uvREh6M5N2ssYHMuRSma7pRPqpPEwVOU7txcf8iZTt8HRXj+UAGkhiLjuHFjbqStZy6sTQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578411834; 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=f56hg+4CIOIgZPwvUQ/VUr9C2iln/UDGdvGir/aOEKA=; b=JClK3kFdE4cXfE4zUNuHhIa2B42l8zOwALgIDNjVU1L21tB7rmTRWGAhHetsqiuNsRyyidhlM7Q6fCM90veIUMsMjnGOMK0C+UJZlCv8hecUkQgXskAAq/iqYTGdnHCEOh1ewZo5EnJDMJBOJyRhkhMY8NVF2NKZYWdrtM+SIMM= 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 1578411834822493.24106004706516; Tue, 7 Jan 2020 07:43:54 -0800 (PST) Received: from localhost ([::1]:51786 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ior1N-0005F6-CG for importer@patchew.org; Tue, 07 Jan 2020 10:43:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57311) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqUq-00086Z-Qh for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:10:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioqUo-0006My-Vw for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:10:16 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:42135 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 1ioqUo-0006LQ-S7 for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:10: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-122-g01x3LsEPZ2z-230PoNFNA-1; Tue, 07 Jan 2020 10:10:10 -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 2B097800D41; Tue, 7 Jan 2020 15:10:09 +0000 (UTC) Received: from localhost (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 010D17C33C; Tue, 7 Jan 2020 15:10:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578409813; 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=f56hg+4CIOIgZPwvUQ/VUr9C2iln/UDGdvGir/aOEKA=; b=Be608k0gRN2cXmLTN7zAi9VyFBug08sspsCdRwkErw/K78GYcgQlPT/IFeEaPbJS4mjr5S UwngWPf7PcoMH04XuNr6sQGJRvCyLqSr33XTM5KKwQb2udbqiV+tsLEqbIR+hMFcR1YO2T TuypmRd1BSUcxD9ttJ7I9cp0ozShhBg= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 27/37] leon3: use qdev gpio facilities for the PIL Date: Tue, 7 Jan 2020 19:04:32 +0400 Message-Id: <20200107150442.1727958-28-marcandre.lureau@redhat.com> In-Reply-To: <20200107150442.1727958-1-marcandre.lureau@redhat.com> References: <20200107150442.1727958-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: g01x3LsEPZ2z-230PoNFNA-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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?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 --- target/sparc/cpu.h | 1 - hw/sparc/leon3.c | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) 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 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; --=20 2.25.0.rc1.20.g2443f3f80d From nobody Sat May 4 03:02:49 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=1578410587; cv=none; d=zohomail.com; s=zohoarc; b=RcR5RmXpZxircGhHlMn8qhyk+hjgJADUrxYZlXJgxZJUk8jkpE0JpuMzmofbB0d1n/esO1y5sMZnXaioaEwA7ubTp8ma1krnO4WdRA3LDWCTasALqzr38paA1x3188Gla1A18mKXbeZheX5NjJjJs5jxHWKRNDKpVra2flyq9IA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578410587; 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=8VKEc8VlnQnG8/4SFTl8P15OlmXM6phP4gj0P6bqgC0=; b=eQ+xsZa4Y0avNSqDY2hGBx2kYLML45WCHTCjykMARoWUuTRItbGEiBDfC/v6V/eVjbKIrbMVkjpv86goinGVvhaAsXF+bpC3NWErqelGHoNLQLunCKc/nG56p//uG6I/LdYZImT2uIWdmhAtsrnhCkYEaD986mt2ZpikacGvnUs= 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 1578410587834728.8769293051296; Tue, 7 Jan 2020 07:23:07 -0800 (PST) Received: from localhost ([::1]:51361 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqhF-0004HB-Tg for importer@patchew.org; Tue, 07 Jan 2020 10:23:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57448) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqV0-0000C3-HD for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:10:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioqUy-0006TK-CV for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:10:26 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:46366 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 1ioqUy-0006Sx-8P for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:10: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-434-rG0gYIYxOvGRX80rqUAMhw-1; Tue, 07 Jan 2020 10:10:21 -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 8C8C98024D1; Tue, 7 Jan 2020 15:10:20 +0000 (UTC) Received: from localhost (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2E1B31001925; Tue, 7 Jan 2020 15:10:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578409823; 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=8VKEc8VlnQnG8/4SFTl8P15OlmXM6phP4gj0P6bqgC0=; b=fpTsuEEu21Bxjvw+2qLWlbpOSAvuh3C7wtP/ReMjzTPmcXT7NO8Nb2kb7OmBw/Med3I4ty QQ9RPCQeVDR9bDs0c2JaMaUl8zlebsDrr9G02cfEX7p9iAu7zm33IKfZerzlMm2T2lkCPa 8KXjesFA1MoNVa6VBxU5f0vVaU+g6lA= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 28/37] qdev: use g_strcmp0() instead of open-coding it Date: Tue, 7 Jan 2020 19:04:33 +0400 Message-Id: <20200107150442.1727958-29-marcandre.lureau@redhat.com> In-Reply-To: <20200107150442.1727958-1-marcandre.lureau@redhat.com> References: <20200107150442.1727958-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: rG0gYIYxOvGRX80rqUAMhw-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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?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 501228ba08..aa3ccbf2ec 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.25.0.rc1.20.g2443f3f80d From nobody Sat May 4 03:02:49 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=1578410744; cv=none; d=zohomail.com; s=zohoarc; b=a3AuiEryAZNkCWxME2nWmo9hls8CX/u0gVAlpv4V15D/5/kOy+yCdtNQDAiSM1s/oVmrltUP5PQbfhZPm9uhg58AjqZIw3B9hMM9mSPOkVLgXV4DO+TitRVZwWf6+M1x8el7DjFtCSPC6MvFwwkF6Yxq+KHHuN4hbKi7FBPMais= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578410744; 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=U3QVwEMauewj5UNLItNA1yrc04E1MF3yTFfAWyYkVY0=; b=EkHHosXFa/uC9RBnRJhWQ9tVrI8eH/4NYhp5LJ1SjXo0+LfZwkvJGbcl3KZe+EIgjKK46ssARpY8erScG+/eRFGBPP8taOGAYo7tZHhx9u1hkyxPa8o8YukEayreFmG/IqeYl3buQlD6yxrPDEqooNox7NvcA+eRbkHuoW8tEYA= 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 1578410744980120.0414610965995; Tue, 7 Jan 2020 07:25:44 -0800 (PST) Received: from localhost ([::1]:51414 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqjn-0008AO-IS for importer@patchew.org; Tue, 07 Jan 2020 10:25:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57638) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqVF-0000pB-Bw for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:10:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioqVD-0006dl-Fg for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:10:40 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:41677 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 1ioqVD-0006dM-Bo for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:10: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-5-0muL2gLFMK6qVCl-pv8cmA-1; Tue, 07 Jan 2020 10:10:37 -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 C03AE1005516; Tue, 7 Jan 2020 15:10:33 +0000 (UTC) Received: from localhost (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id C52D35D9E1; Tue, 7 Jan 2020 15:10:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578409839; 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=U3QVwEMauewj5UNLItNA1yrc04E1MF3yTFfAWyYkVY0=; b=QQ70dCCf4tvlFyanY9lx21rIhOZH+Ju2GS/uVBILMJNphsScgd8ONJfWGP2ak9HvE627ks uefm5RfBzJeqsfzhidbZpu4t6Y3a0zVNY603wBfkS6QlJVLHaQyIZHGtuXKOElLEeKtC9Q S2l6mSx8RtQYycBrdzAlUxA14QrLtAo= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 29/37] mips/cps: fix setting saar property Date: Tue, 7 Jan 2020 19:04:34 +0400 Message-Id: <20200107150442.1727958-30-marcandre.lureau@redhat.com> In-Reply-To: <20200107150442.1727958-1-marcandre.lureau@redhat.com> References: <20200107150442.1727958-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: 0muL2gLFMK6qVCl-pv8cmA-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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?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.25.0.rc1.20.g2443f3f80d From nobody Sat May 4 03:02:49 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=1578411987; cv=none; d=zohomail.com; s=zohoarc; b=nwjnTEuaWwsfpNvvB0Oif8uG0zDwekTQXLLkTpeU0vyMnndf5VktLtrXFqVg+I38dfyNSucpvq3ka2CPUv3Gwg94jIhtcHCPMHWR1t1J5UgEyHmDlNDnDA4IU1/bWvGBEAZn/dKqKW7wN7VecE3S/C2FcMZkwJMLVUG2JLvZtHM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578411987; 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=itN2B1dUGWlA9+XbspC50tVMkwPylcwF4oYhuobuPyE=; b=lYn6X73RVGqj87vrUWc4927ejbVt4hmrRnpNy66s+JaNe5J7uLVdWdk7hKNKL6UtHcwzDH2hvKjbIUhUpPNusR/uJxKCfV4H3Lh1ACbqpBxcAiQLjF61zmUwHlAHCPi5Pk5ExI5ujod4lyy4nY5ougM/xHHXZHXu+lyN1K1goRw= 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 1578411987682105.33111840724382; Tue, 7 Jan 2020 07:46:27 -0800 (PST) Received: from localhost ([::1]:51828 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ior3p-00082m-V1 for importer@patchew.org; Tue, 07 Jan 2020 10:46:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57749) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqVR-0001Xo-5p for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:10:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioqVP-0006lo-R6 for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:10:53 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:37714 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 1ioqVP-0006ka-DG for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:10:51 -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-89-1u5feQARNk-9WA3FztAT4g-1; Tue, 07 Jan 2020 10:10:48 -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 F236A477; Tue, 7 Jan 2020 15:10:46 +0000 (UTC) Received: from localhost (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 40B425C1BB; Tue, 7 Jan 2020 15:10:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578409849; 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=itN2B1dUGWlA9+XbspC50tVMkwPylcwF4oYhuobuPyE=; b=Q/bm+61o7nK4TsdfGxcri4TMNoREdYj8dD4pg3oSa3b7OA0KDVqGkQ1xYcj6gN9n3i7UeH 8lsFOd15W4Oe+ORLSDqH7HA8COWKCLsooZPF11WLOzYmKHMOENvMh3jzImT9fslKGty/qG wYQ0M2gajCUG2Pg3g9Fu6PhZiYdAAnw= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 30/37] cris: improve passing PIC interrupt vector to the CPU Date: Tue, 7 Jan 2020 19:04:35 +0400 Message-Id: <20200107150442.1727958-31-marcandre.lureau@redhat.com> In-Reply-To: <20200107150442.1727958-1-marcandre.lureau@redhat.com> References: <20200107150442.1727958-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: 1u5feQARNk-9WA3FztAT4g-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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?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 --- target/cris/cpu.h | 1 + hw/cris/axis_dev88.c | 4 ---- hw/intc/etraxfs_pic.c | 26 +------------------------- target/cris/cpu.c | 8 ++++++++ 4 files changed, 10 insertions(+), 29 deletions(-) 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 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 { --=20 2.25.0.rc1.20.g2443f3f80d From nobody Sat May 4 03:02:49 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=1578410901; cv=none; d=zohomail.com; s=zohoarc; b=FLo/KCZKcOTgHCjuDWWKOAf86FSSP4Mge/gwTW/ByhyWqQYPmAU7Pk7sxSgjX2XXm4DydhgOzbyHPFg9yfbzSH7mXqhq6OHLliA4Ray7TpYH2ydNZDYFFqgIouhfp3llkRS5RXR9iNn2R6zzbWhzR62sSUu+ivsoy8HgaZ5u+Ac= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578410901; 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=JI6010Zba0jR7V5oioUNd1W8ZIeOPboPlX4JjxIfyT0=; b=nJYepBX4rZ54utTqO9EaV4NrVb9uRYPGOZjgtTQVpwB1OlW1+9hW6iZYzthGRifwMzcVDwGLnp+KA1g69AK+FfgmtuMevH3cZEgDEbWAZL8Xb/tUjDPG+lcvRTpQOquhudGnUM6v9WKK9vP1SQaQrTBxsiXtR/AzNfN6MKh80IE= 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 1578410901603452.3085462887815; Tue, 7 Jan 2020 07:28:21 -0800 (PST) Received: from localhost ([::1]:51452 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqmJ-0003ba-Su for importer@patchew.org; Tue, 07 Jan 2020 10:28:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57830) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqVW-0001kW-Ut for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:11:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioqVV-0006q1-S9 for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:10:58 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:48269 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 1ioqVV-0006pl-Oc for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:10: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-265-2vBbqoMgMm26WphpBmj_OA-1; Tue, 07 Jan 2020 10:10:55 -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 3E5981B18BCA; Tue, 7 Jan 2020 15:10:54 +0000 (UTC) Received: from localhost (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id BA6E05C1BB; Tue, 7 Jan 2020 15:10:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578409857; 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=JI6010Zba0jR7V5oioUNd1W8ZIeOPboPlX4JjxIfyT0=; b=JtnCA/IKf+BAdnyl78unPVrKGKAEUvmE5M1+r3bhqiS0uovVTR230k2LPecBxrRAdRaEoR hxXZ+mYpp3bEoXl2G85+KHNKKGf2OM+e48riydcbw80K5ktQ89TXzrvyw8UUre79D27uNb wUgQgBTCE1FsFFQ6F8zX9cGZ0DA9yEM= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 31/37] smbus-eeprom: remove PROP_PTR Date: Tue, 7 Jan 2020 19:04:36 +0400 Message-Id: <20200107150442.1727958-32-marcandre.lureau@redhat.com> In-Reply-To: <20200107150442.1727958-1-marcandre.lureau@redhat.com> References: <20200107150442.1727958-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: 2vBbqoMgMm26WphpBmj_OA-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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?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.25.0.rc1.20.g2443f3f80d From nobody Sat May 4 03:02:49 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=1578411727; cv=none; d=zohomail.com; s=zohoarc; b=bMUp9Skga8RZ6sLXfMcVjhYVjW/OvgXVDYmWkFCKSSf9S0b6R0lU1LdGvK5KnYTVS/z1SOSEvVwZoreO7qR5xxfvxWxQPZ9nJ/oWSb8cbS1D86L4CLCYBRY4mICbE0d7dIyEjvgjbPb2WyU/+70wZhvj7JyqEpNQ3za1lwl1m2s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578411727; 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=isfVn2JzsknfNhjbx0kZuYd/aW8dizaCHSyV4aJMPEU=; b=O9tV/202+HS2Z0Xa5Q4pjmErr+8xSQIO1nSdC+iAiiFr0ISKIQnSZ+BtP0uhrnAIFeQ8lwPhAJaMH/vi0uYj232znwWRPe+RljJ2v2Mo5JM73z4JN16ryvNmtOGqKwie+JjPvMX4YXuVMTr99FwOl3edcUPcInh4DIrjoExgdIY= 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 1578411727262190.95181218563312; Tue, 7 Jan 2020 07:42:07 -0800 (PST) Received: from localhost ([::1]:51760 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqze-0002HU-03 for importer@patchew.org; Tue, 07 Jan 2020 10:42:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58010) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqVp-0002IW-LJ for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:11:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioqVj-00070T-A0 for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:11:17 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:20363 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 1ioqVj-00070C-64 for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:11:11 -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-196-Or-CKJD5OvCZMc85q6XLIw-1; Tue, 07 Jan 2020 10:11:07 -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 AB885593A1; Tue, 7 Jan 2020 15:11:06 +0000 (UTC) Received: from localhost (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id B5D907C82C; Tue, 7 Jan 2020 15:10:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578409870; 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=isfVn2JzsknfNhjbx0kZuYd/aW8dizaCHSyV4aJMPEU=; b=CxuBnqpemjJa+vWb8/GokD3A9RcfdUsRKS8YkT1A5DKp6uSWd+hkQRbpmkCyO11LSg2Wq+ lznu/7sNmNQsi5Ff1Gik1nVWuNc5wmLMOQylf9960AvCCYDVHTsgY4SejOYB1ARvWSBhPY Ios97SRxKqhaUMS08x+ik3+yNRc8aN8= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 32/37] omap-intc: remove PROP_PTR Date: Tue, 7 Jan 2020 19:04:37 +0400 Message-Id: <20200107150442.1727958-33-marcandre.lureau@redhat.com> In-Reply-To: <20200107150442.1727958-1-marcandre.lureau@redhat.com> References: <20200107150442.1727958-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: Or-CKJD5OvCZMc85q6XLIw-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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?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 --- include/hw/arm/omap.h | 14 ++++++++++++++ hw/arm/omap1.c | 4 ++-- hw/arm/omap2.c | 4 ++-- hw/intc/omap_intc.c | 17 ++++++++++------- 4 files changed, 28 insertions(+), 11 deletions(-) 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 { 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 --=20 2.25.0.rc1.20.g2443f3f80d From nobody Sat May 4 03:02:49 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=1578411834; cv=none; d=zohomail.com; s=zohoarc; b=YDDCuYntuR0ClAWDieHJCpTDP7pe1MKBJj/XYPKxbUpPUzo3JdLhUtdpuJnGLQChR3DJO3XK9CV+H0PbeIoThsl89KiS48zcObf+RS62V/7ePjLG/460e1X0y/+XIYY38Xohm8qxaz+DIQjwv04Ip7uAUFykNGPavOil2TwUUBI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578411834; 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=DqceyMqd2uvvSzYv6snj5s7OKUZlxIFSqgq0blE3mxE=; b=I3M2SXmp4kjVarwW+sBzvleFjdXnNSzKwPWSBxB4qujOcxK5UymPd0YNWAXzKjpDRx8xeIokHJkZw87k1bJs4f9h/0YhG5dIJ/xnS5A0pA59z7ai8zW6xi/tS77OmlnUwcEDD4EQfrFUth2AYn/tjCiPTWmrNssgEC9wCBFt+4Q= 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 1578411834456184.64906014146447; Tue, 7 Jan 2020 07:43:54 -0800 (PST) Received: from localhost ([::1]:51789 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ior1N-0005GR-27 for importer@patchew.org; Tue, 07 Jan 2020 10:43:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58088) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqVv-0002Ly-I5 for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:11:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioqVt-00075m-7i for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:11:22 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:28613 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 1ioqVt-000754-3y for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:11: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-11-CreEn2TOMj-wcYxOUl1yfw-1; Tue, 07 Jan 2020 10:11:19 -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 AC1F8801E72; Tue, 7 Jan 2020 15:11:18 +0000 (UTC) Received: from localhost (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id BAD681001925; Tue, 7 Jan 2020 15:11:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578409880; 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=DqceyMqd2uvvSzYv6snj5s7OKUZlxIFSqgq0blE3mxE=; b=PfXfGLpbz3R5OTv/GJnGkNPrk6AfDxtHibmilF4zIzjEBD5ff4Ah6j3sUhqWgRZjQjTABK QN2LCdTBErNJuDjITtx9OHp14k5W0EAU7A3brMOF5txPEcLcWfyZVtODpnJKv7ZIZ4uhiR mBKFRVKngS2Q23f1eiXAANmakNZUu64= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 33/37] omap-i2c: remove PROP_PTR Date: Tue, 7 Jan 2020 19:04:38 +0400 Message-Id: <20200107150442.1727958-34-marcandre.lureau@redhat.com> In-Reply-To: <20200107150442.1727958-1-marcandre.lureau@redhat.com> References: <20200107150442.1727958-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: CreEn2TOMj-wcYxOUl1yfw-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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?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 --- include/hw/arm/omap.h | 13 +++++++++++++ hw/arm/omap1.c | 2 +- hw/arm/omap2.c | 8 ++++---- hw/i2c/omap_i2c.c | 19 ++++++++++++------- 4 files changed, 30 insertions(+), 12 deletions(-) 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 { 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 --=20 2.25.0.rc1.20.g2443f3f80d From nobody Sat May 4 03:02:49 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=1578411328; cv=none; d=zohomail.com; s=zohoarc; b=HfU/mdj7A7CDWcLA6AE1Cyy27fJZsXM3ZTZGQL3dKWajpcxuCPAHEywuNf6V/gkYU0I6ntf6D2YjdP0sdam/72ht8ZX7J8+vh5FeLlIckkxiDTnBoIzAVwP98JE01IugIA6JDV0x/S3tuTb5jP+p7R9RDaVnPF4dOF6the7BsI0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578411328; 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=T57Gr0VcUmBL9GiXGA2VDCEgwG0f5qLGbZwaTcOHrLc=; b=fSqudBJyCHFADZ/WuHY4oePhn1PAJrKRnb/NSTGxhrBTTctm8NYy8Q9htVrTtTFcAPhYLKTcNeFiWnGWddJn5NYPO0GK4fIWczAwHkoKQoOdrKJoKFweNrbOm5ohoA4EmC98xvC7oeezNDOc2beOtd2zWynN3abuvniIQD7pjcE= 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 1578411328018504.68764558255134; Tue, 7 Jan 2020 07:35:28 -0800 (PST) Received: from localhost ([::1]:51614 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqtC-0006YR-8O for importer@patchew.org; Tue, 07 Jan 2020 10:35:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58270) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqW8-0002eu-6t for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:11:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioqW6-0007Fm-KI for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:11:36 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:45797 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 1ioqW6-0007Fe-GZ for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:11:34 -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-241-Kpw013QSNnSi375Lw0pzSQ-1; Tue, 07 Jan 2020 10:11:33 -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 0D4C2477; Tue, 7 Jan 2020 15:11:32 +0000 (UTC) Received: from localhost (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0AC2A5C1BB; Tue, 7 Jan 2020 15:11:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578409894; 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=T57Gr0VcUmBL9GiXGA2VDCEgwG0f5qLGbZwaTcOHrLc=; b=gJ8o0DHOxcA2xqF2MivVhzEYwP7NceUEXV/EumjZR7VPAIF60xFXsOAjFLy9dsxzkSXV3F aB5CCGbv7p3/zsMmfBBPlI6roCLLTZG0tpkGQry3jHEJ68lAtMhoo4cC43C1HfxScz8OXP KRzXbsL5qODc9cJ3eU9X7jRPcnvfBec= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 34/37] omap-gpio: remove PROP_PTR Date: Tue, 7 Jan 2020 19:04:39 +0400 Message-Id: <20200107150442.1727958-35-marcandre.lureau@redhat.com> In-Reply-To: <20200107150442.1727958-1-marcandre.lureau@redhat.com> References: <20200107150442.1727958-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: Kpw013QSNnSi375Lw0pzSQ-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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?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 --- include/hw/arm/omap.h | 33 +++++++++++++++++++++++++++++---- hw/arm/omap1.c | 2 +- hw/arm/omap2.c | 13 +++++++------ hw/gpio/omap_gpio.c | 42 +++++++++++++++--------------------------- 4 files changed, 52 insertions(+), 38 deletions(-) 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 { 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 --=20 2.25.0.rc1.20.g2443f3f80d From nobody Sat May 4 03:02:49 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=1578412133; cv=none; d=zohomail.com; s=zohoarc; b=D1PF2Vz6Q6vpYQDmPnd/Rap/kvAyGwS3FskQ9uCi1UnsSV/LKAx1o9X0u7SlylmzrwjdJYgHkEdQpjBeKQALqzz+8vxbLYGyiAtiuyI9SZa0OsJlLn2mSOV0tekZi5dM3tP/GE1L+BLdeUuhwLuFtApf+FYnO5eyLvitdjNflM0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578412133; 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=fWPsYdSzDBv8GmgrXGGg04pvHjkMqD1rvCCSCkM0Qyw=; b=kNeYgr5onI9v4vmODsv6ArQeItOwzRhRdt+H+rXHJ8K9Em0ALe/elMcrrhv1qstG6oSw8qNUgQAnhOuSO5H5k3+jQiML9KPjxqUQurgehGxoOPeXbrfvqts2dKfA6ZZ++dOcKb89NMo6PFiolVPodM3HCLsrvEYhX1DXwpo6ryo= 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 1578412133256924.7572457966177; Tue, 7 Jan 2020 07:48:53 -0800 (PST) Received: from localhost ([::1]:51872 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ior6B-0002kA-KY for importer@patchew.org; Tue, 07 Jan 2020 10:48:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58553) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqWP-000368-T3 for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:11:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioqWO-0007TQ-PF for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:11:53 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:53721 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 1ioqWO-0007T8-Lq for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:11:52 -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-167-AkcEOiMWPgiTJYEeXVP06A-1; Tue, 07 Jan 2020 10:11:45 -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 3D512107B7D4; Tue, 7 Jan 2020 15:11:44 +0000 (UTC) Received: from localhost (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8F311272A3; Tue, 7 Jan 2020 15:11:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578409912; 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=fWPsYdSzDBv8GmgrXGGg04pvHjkMqD1rvCCSCkM0Qyw=; b=fLpHRpqlEjBIV8Rm4xKX+1hf6uMjAOVBbbqkqwFearO/9qDDJlKXzDl0LAe66HGF3LwQjl JhyLQvn4io0TiAuvA/+rJr7IgIDR8is2MR87eB/6uV6veniCxJvqQ8/rzBXIIIrqFCmo2A GcYE7cj3QpQp4pZIUjqEm0HNBFCBELQ= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 35/37] qdev: remove PROP_MEMORY_REGION Date: Tue, 7 Jan 2020 19:04:40 +0400 Message-Id: <20200107150442.1727958-36-marcandre.lureau@redhat.com> In-Reply-To: <20200107150442.1727958-1-marcandre.lureau@redhat.com> References: <20200107150442.1727958-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: AkcEOiMWPgiTJYEeXVP06A-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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?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.25.0.rc1.20.g2443f3f80d From nobody Sat May 4 03:02:49 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=1578411986; cv=none; d=zohomail.com; s=zohoarc; b=k40wUXkuhaurypwMJSylpTFYXJ3nz3oCIvg/djv49a6RiKhRSOmgN9VGw6SPAuUYBv0OdoMApKgbCZZ6PhMgjeXppAbCStuwpFNzjwcZvahljEjnmpQaYP22LY/SeQU3JNbfneNsQdU2awWQlNPtAJTUOzOrzL83rH6FpwZkRC4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578411986; 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=H/QvtK2CiQZlq8lgTgMn7ZJmf0P3QNyvGQprAp1cUdA=; b=gcc0ks0TZ9z/KvEGEtuQB/DQtM1vExrR8aQbsPEg/M1GK2TC9k8djyQVHmymY0UaSQCWES6hlwU+MzGiCS9C5IO0F+U1tkxTRyTBjEMfs1HRqvNlDF8qA09XVIpujCyxkBGjh2VOKSZakdqiNAKJINglkI2TCOFi7B+qJGllxfU= 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 1578411986641264.92090370364997; Tue, 7 Jan 2020 07:46:26 -0800 (PST) Received: from localhost ([::1]:51826 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ior3o-0007ze-Ku for importer@patchew.org; Tue, 07 Jan 2020 10:46:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58686) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqWY-0003PT-Nx for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:12:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioqWX-0007aU-9l for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:12:02 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:50029 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 1ioqWX-0007aB-5z for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:12: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-246-cotBiprONCmiaXyzSM6xGw-1; Tue, 07 Jan 2020 10:11:57 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E41911B18BCF; Tue, 7 Jan 2020 15:11:56 +0000 (UTC) Received: from localhost (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8107860BE2; Tue, 7 Jan 2020 15:11:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578409920; 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=H/QvtK2CiQZlq8lgTgMn7ZJmf0P3QNyvGQprAp1cUdA=; b=FWmqtExld3ysHB6+XcGfQKAbkP7Huzq+L2o7WIfmz+Jfr49Jo5Gu2IInag0OiDCB8hBo/v Lc5tX4sHwZOixoOZOcKgb+Xp8m2LtqW13XM9/WYm6BDNWsQjGnC+ZIalVaQ4sikbYwrddJ 1LgbYPKkZqa5osenQVoWQPbWScBmvBg= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 36/37] qdev: remove QDEV_PROP_PTR Date: Tue, 7 Jan 2020 19:04:41 +0400 Message-Id: <20200107150442.1727958-37-marcandre.lureau@redhat.com> In-Reply-To: <20200107150442.1727958-1-marcandre.lureau@redhat.com> References: <20200107150442.1727958-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: cotBiprONCmiaXyzSM6xGw-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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?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 --- include/hw/qdev-properties.h | 22 ---------------------- hw/core/qdev-properties.c | 18 ------------------ 2 files changed, 40 deletions(-) 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); 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; --=20 2.25.0.rc1.20.g2443f3f80d From nobody Sat May 4 03:02:49 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=1578411098; cv=none; d=zohomail.com; s=zohoarc; b=K2tNCkEudCGUJ1Z0RnXTeW2qjwzvxi9v5A/KcslGpjWbJw+XNJVCutmnMyoEqzBGwEg1zwjqG/+9i4dIkNVuxrAtdg2IRMdm3Hpt3K44nGYQtHolgB5obhhSXQcKpfVppwHXl2ugMR98J70+e1xu/TdnmR3EgWWW45nOkwzog54= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578411098; 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=HKxGboEQw8rX4Bu1SJN9bW2dTLrjcTuRtkmxQkjWds4=; b=hkzvHkIhWjsf9irnSvJkwROMCMLsCtWUjKUAriCEm8e0z8sxWKdpI74eOhaHY7kZ5Um0y5JcgARc22QOBLRpsS4BlY45C6PMRH9NcEsq+xsSrf0NKIZocfaDCNppv458EXwWgP+YSdsWA8TK8widencPnRFH743eupNBmg4ol4c= 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 15784110988531013.1171955302599; Tue, 7 Jan 2020 07:31:38 -0800 (PST) Received: from localhost ([::1]:51494 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqpU-0000Em-Hj for importer@patchew.org; Tue, 07 Jan 2020 10:31:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58834) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioqWl-0003pw-Hb for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:12:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioqWk-0007nT-EW for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:12:15 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:45754 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 1ioqWk-0007nC-Ak for qemu-devel@nongnu.org; Tue, 07 Jan 2020 10:12: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-59-kG85XcLxPjeWfyEquOIYqA-1; Tue, 07 Jan 2020 10:12:12 -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 1E635593A0; Tue, 7 Jan 2020 15:12:11 +0000 (UTC) Received: from localhost (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7542C5D9CA; Tue, 7 Jan 2020 15:12:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578409934; 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=HKxGboEQw8rX4Bu1SJN9bW2dTLrjcTuRtkmxQkjWds4=; b=XnYXh3O8bPOCYdFubceynjCbe14rKQjjQu5VotEMlftGJfG4BqHHcfL2WuukBm7vpwUU0W JAF/0kDZ+rVIz4JdGgz5g/q8/TtZDdoEjqru6RkEh2dDQZBG5WOj9nnd7LzH2lUBTEUZUv bwgHIqjQmS6nu2Ab9G676kEBRfmxMn4= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 37/37] qdev/qom: remove some TODO limitations now that PROP_PTR is gone Date: Tue, 7 Jan 2020 19:04:42 +0400 Message-Id: <20200107150442.1727958-38-marcandre.lureau@redhat.com> In-Reply-To: <20200107150442.1727958-1-marcandre.lureau@redhat.com> References: <20200107150442.1727958-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: kG85XcLxPjeWfyEquOIYqA-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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?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 aa3ccbf2ec..9f1753f5cf 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.25.0.rc1.20.g2443f3f80d