From patchwork Fri Dec 11 22:04:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1415296 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=LTW8EASn; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Ct4f32J7Sz9sVl for ; Sat, 12 Dec 2020 09:07:36 +1100 (AEDT) Received: from localhost ([::1]:37050 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knqZZ-0001d8-EU for incoming@patchwork.ozlabs.org; Fri, 11 Dec 2020 17:07:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59278) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqXx-0001bU-3B for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:05:54 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:42346) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqXr-0006DI-9U for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:05:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724345; 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=/Phk3lo4bzx8IV8gpStB5TCCGVdAThN5k/nbEt7JmcM=; b=LTW8EASnFBLyjVP2KnxnDX0M47o7lxfUz/0z038lwYuqo1LRGIZeThHDsrSddC4oLDvSI+ duV46FEMdV5g6JZrTChicr3Q87YdNEnOB1MMrZdKF+zqDbSETIft1wh9jFLGiJ2/GEtzgY e4yjQyX2zt0PKV9AwvGN7Q9JqBNRS4w= 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-314-EMkkuT45PkGP4-JpngWD8Q-1; Fri, 11 Dec 2020 17:05:43 -0500 X-MC-Unique: EMkkuT45PkGP4-JpngWD8Q-1 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 99B6319251A0; Fri, 11 Dec 2020 22:05:42 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9715C19C78; Fri, 11 Dec 2020 22:05:35 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 01/32] cs4231: Get rid of empty property array Date: Fri, 11 Dec 2020 17:04:58 -0500 Message-Id: <20201211220529.2290218-2-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , Gerd Hoffmann , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" An empty props array is unnecessary, we can just not call device_class_set_props(). Reviewed-by: Marc-André Lureau Signed-off-by: Eduardo Habkost --- Cc: Gerd Hoffmann Cc: qemu-devel@nongnu.org --- hw/audio/cs4231.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/hw/audio/cs4231.c b/hw/audio/cs4231.c index 8e9554ce9b..209c05a0a0 100644 --- a/hw/audio/cs4231.c +++ b/hw/audio/cs4231.c @@ -160,17 +160,12 @@ static void cs4231_init(Object *obj) sysbus_init_irq(dev, &s->irq); } -static Property cs4231_properties[] = { - {.name = NULL}, -}; - static void cs4231_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); dc->reset = cs_reset; dc->vmsd = &vmstate_cs4231; - device_class_set_props(dc, cs4231_properties); } static const TypeInfo cs4231_info = { From patchwork Fri Dec 11 22:04:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1415298 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=eaUHazA4; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Ct4gw6skPz9sVJ for ; Sat, 12 Dec 2020 09:09:16 +1100 (AEDT) Received: from localhost ([::1]:39628 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knqbB-0002vm-NN for incoming@patchwork.ozlabs.org; Fri, 11 Dec 2020 17:09:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59282) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqXw-0001bY-LY for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:05:53 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:39052) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqXs-0006Dv-3c for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:05:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724346; 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=rc36MnKM7EYTaZ8lMBRn2cvGDZYW3v3kepUjkeKaXDs=; b=eaUHazA4JBoQ23sRuKmaDFUjujbmYE6ywKT5d1A3Z0WC+X9CFU/UxMo7PPa+sCz9vZCn6Z G2rNfAjbH6q0Pgbdfjws6aXPy+r3InPFL6HEJNoHUxLIkM+gKCS8z+7eTZgOvvwcKFuu9k KYKKzVm/u1mWsgsfwHHnLcSaZ7vY8UA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-272-hts_MbbONOaPddm7kfLU1g-1; Fri, 11 Dec 2020 17:05:45 -0500 X-MC-Unique: hts_MbbONOaPddm7kfLU1g-1 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 0D3DDC296; Fri, 11 Dec 2020 22:05:44 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 98C735C8AA; Fri, 11 Dec 2020 22:05:43 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 02/32] cpu: Move cpu_common_props to hw/core/cpu.c Date: Fri, 11 Dec 2020 17:04:59 -0500 Message-Id: <20201211220529.2290218-3-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" There's no reason to keep the property list separate from the CPU class code. Move the variable to hw/core/cpu.c and make it static. Reviewed-by: Marc-André Lureau Signed-off-by: Eduardo Habkost --- Cc: Eduardo Habkost Cc: Marcel Apfelbaum Cc: qemu-devel@nongnu.org --- include/hw/core/cpu.h | 1 - cpu.c | 15 --------------- hw/core/cpu.c | 15 +++++++++++++++ 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 3d92c967ff..8e7552910d 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -1111,7 +1111,6 @@ AddressSpace *cpu_get_address_space(CPUState *cpu, int asidx); void QEMU_NORETURN cpu_abort(CPUState *cpu, const char *fmt, ...) GCC_FMT_ATTR(2, 3); -extern Property cpu_common_props[]; void cpu_exec_initfn(CPUState *cpu); void cpu_exec_realizefn(CPUState *cpu, Error **errp); void cpu_exec_unrealizefn(CPUState *cpu); diff --git a/cpu.c b/cpu.c index 0be5dcb6f3..0c485cdf2d 100644 --- a/cpu.c +++ b/cpu.c @@ -144,21 +144,6 @@ void cpu_exec_unrealizefn(CPUState *cpu) #endif } -Property cpu_common_props[] = { -#ifndef CONFIG_USER_ONLY - /* Create a memory property for softmmu CPU object, - * so users can wire up its memory. (This can't go in hw/core/cpu.c - * because that file is compiled only once for both user-mode - * and system builds.) The default if no link is set up is to use - * the system address space. - */ - DEFINE_PROP_LINK("memory", CPUState, memory, TYPE_MEMORY_REGION, - MemoryRegion *), -#endif - DEFINE_PROP_BOOL("start-powered-off", CPUState, start_powered_off, false), - DEFINE_PROP_END_OF_LIST(), -}; - void cpu_exec_initfn(CPUState *cpu) { cpu->as = NULL; diff --git a/hw/core/cpu.c b/hw/core/cpu.c index 576fa1d7ba..5c89c858aa 100644 --- a/hw/core/cpu.c +++ b/hw/core/cpu.c @@ -393,6 +393,21 @@ static vaddr cpu_adjust_watchpoint_address(CPUState *cpu, vaddr addr, int len) return addr; } +static Property cpu_common_props[] = { +#ifndef CONFIG_USER_ONLY + /* Create a memory property for softmmu CPU object, + * so users can wire up its memory. (This can't go in hw/core/cpu.c + * because that file is compiled only once for both user-mode + * and system builds.) The default if no link is set up is to use + * the system address space. + */ + DEFINE_PROP_LINK("memory", CPUState, memory, TYPE_MEMORY_REGION, + MemoryRegion *), +#endif + DEFINE_PROP_BOOL("start-powered-off", CPUState, start_powered_off, false), + DEFINE_PROP_END_OF_LIST(), +}; + static void cpu_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); From patchwork Fri Dec 11 22:05:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1415302 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=CTjY4toh; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Ct4lw1B5Rz9sSf for ; Sat, 12 Dec 2020 09:12:41 +1100 (AEDT) Received: from localhost ([::1]:44808 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knqeT-0005TG-PR for incoming@patchwork.ozlabs.org; Fri, 11 Dec 2020 17:12:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59326) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqXz-0001cz-PI for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:05:56 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:45883) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqXw-0006F8-HJ for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:05:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724351; 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=6VgW1WJzNx3ziSLIiqjF5nUJXSkAS2F3VOXub7WDYto=; b=CTjY4toh4p+csuEbtQqARf401YFvkcGwZjK2UW38rpJwqRZLwatHm/QXzVbJO1mejyUv/+ Xtzdb+0PA6kkF2V+lHUrt/dQVR+13MiMjXvdowgJgel7fkf4pm+wtG3oMc7pk6AJ0Xkejy /0qW7VEkrEW8qGscjGoyYMUbE9qZykI= 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-275-F9eXSwzCMUus9MNoPr-ICQ-1; Fri, 11 Dec 2020 17:05:49 -0500 X-MC-Unique: F9eXSwzCMUus9MNoPr-ICQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6C531107ACE3; Fri, 11 Dec 2020 22:05:48 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id E5E875D9E2; Fri, 11 Dec 2020 22:05:44 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 03/32] qdev: Move property code to qdev-properties.[ch] Date: Fri, 11 Dec 2020 17:05:00 -0500 Message-Id: <20201211220529.2290218-4-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Move everything related to Property and PropertyInfo to qdev-properties.[ch] to make it easier to refactor that code. Reviewed-by: Marc-André Lureau Signed-off-by: Eduardo Habkost --- Cc: Paolo Bonzini Cc: "Daniel P. Berrangé" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- include/hw/qdev-core.h | 37 ----------- include/hw/qdev-properties.h | 38 +++++++++++ hw/core/qdev-properties.c | 120 +++++++++++++++++++++++++++++++++++ hw/core/qdev.c | 120 ----------------------------------- softmmu/qdev-monitor.c | 1 + 5 files changed, 159 insertions(+), 157 deletions(-) diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index 9fbb22a48d..8f91faebc3 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -276,43 +276,6 @@ struct BusState { ResettableState reset; }; -/** - * Property: - * @set_default: true if the default value should be set from @defval, - * in which case @info->set_default_value must not be NULL - * (if false then no default value is set by the property system - * and the field retains whatever value it was given by instance_init). - * @defval: default value for the property. This is used only if @set_default - * is true. - */ -struct Property { - const char *name; - const PropertyInfo *info; - ptrdiff_t offset; - uint8_t bitnr; - bool set_default; - union { - int64_t i; - uint64_t u; - } defval; - int arrayoffset; - const PropertyInfo *arrayinfo; - int arrayfieldsize; - const char *link_type; -}; - -struct PropertyInfo { - const char *name; - const char *description; - const QEnumLookup *enum_table; - int (*print)(DeviceState *dev, Property *prop, char *dest, size_t len); - void (*set_default_value)(ObjectProperty *op, const Property *prop); - void (*create)(ObjectClass *oc, Property *prop); - ObjectPropertyAccessor *get; - ObjectPropertyAccessor *set; - ObjectPropertyRelease *release; -}; - /** * GlobalProperty: * @used: Set to true if property was used when initializing a device. diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 4437450065..db7ce51dd5 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -3,6 +3,44 @@ #include "hw/qdev-core.h" +/** + * Property: + * @set_default: true if the default value should be set from @defval, + * in which case @info->set_default_value must not be NULL + * (if false then no default value is set by the property system + * and the field retains whatever value it was given by instance_init). + * @defval: default value for the property. This is used only if @set_default + * is true. + */ +struct Property { + const char *name; + const PropertyInfo *info; + ptrdiff_t offset; + uint8_t bitnr; + bool set_default; + union { + int64_t i; + uint64_t u; + } defval; + int arrayoffset; + const PropertyInfo *arrayinfo; + int arrayfieldsize; + const char *link_type; +}; + +struct PropertyInfo { + const char *name; + const char *description; + const QEnumLookup *enum_table; + int (*print)(DeviceState *dev, Property *prop, char *dest, size_t len); + void (*set_default_value)(ObjectProperty *op, const Property *prop); + void (*create)(ObjectClass *oc, Property *prop); + ObjectPropertyAccessor *get; + ObjectPropertyAccessor *set; + ObjectPropertyRelease *release; +}; + + /*** qdev-properties.c ***/ extern const PropertyInfo qdev_prop_bit; diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 509cbf155d..12a053e732 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -929,3 +929,123 @@ const PropertyInfo qdev_prop_link = { .name = "link", .create = create_link_property, }; + +void qdev_property_add_static(DeviceState *dev, Property *prop) +{ + Object *obj = OBJECT(dev); + ObjectProperty *op; + + assert(!prop->info->create); + + op = object_property_add(obj, prop->name, prop->info->name, + prop->info->get, prop->info->set, + prop->info->release, + prop); + + object_property_set_description(obj, prop->name, + prop->info->description); + + if (prop->set_default) { + prop->info->set_default_value(op, prop); + if (op->init) { + op->init(obj, op); + } + } +} + +static void qdev_class_add_property(DeviceClass *klass, Property *prop) +{ + ObjectClass *oc = OBJECT_CLASS(klass); + + if (prop->info->create) { + prop->info->create(oc, prop); + } else { + ObjectProperty *op; + + op = object_class_property_add(oc, + prop->name, prop->info->name, + prop->info->get, prop->info->set, + prop->info->release, + prop); + if (prop->set_default) { + prop->info->set_default_value(op, prop); + } + } + object_class_property_set_description(oc, prop->name, + prop->info->description); +} + +/** + * Legacy property handling + */ + +static void qdev_get_legacy_property(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) +{ + DeviceState *dev = DEVICE(obj); + Property *prop = opaque; + + char buffer[1024]; + char *ptr = buffer; + + prop->info->print(dev, prop, buffer, sizeof(buffer)); + visit_type_str(v, name, &ptr, errp); +} + +/** + * qdev_class_add_legacy_property: + * @dev: Device to add the property to. + * @prop: The qdev property definition. + * + * Add a legacy QOM property to @dev for qdev property @prop. + * + * Legacy properties are string versions of QOM properties. The format of + * the string depends on the property type. Legacy properties are only + * needed for "info qtree". + * + * Do not use this in new code! QOM Properties added through this interface + * will be given names in the "legacy" namespace. + */ +static void qdev_class_add_legacy_property(DeviceClass *dc, Property *prop) +{ + g_autofree char *name = NULL; + + /* Register pointer properties as legacy properties */ + if (!prop->info->print && prop->info->get) { + return; + } + + name = g_strdup_printf("legacy-%s", prop->name); + object_class_property_add(OBJECT_CLASS(dc), name, "str", + prop->info->print ? qdev_get_legacy_property : prop->info->get, + NULL, NULL, prop); +} + +void device_class_set_props(DeviceClass *dc, Property *props) +{ + Property *prop; + + dc->props_ = props; + for (prop = props; prop && prop->name; prop++) { + qdev_class_add_legacy_property(dc, prop); + qdev_class_add_property(dc, prop); + } +} + +void qdev_alias_all_properties(DeviceState *target, Object *source) +{ + ObjectClass *class; + Property *prop; + + class = object_get_class(OBJECT(target)); + do { + DeviceClass *dc = DEVICE_CLASS(class); + + for (prop = dc->props_; prop && prop->name; prop++) { + object_property_add_alias(source, prop->name, + OBJECT(target), prop->name); + } + class = object_class_get_parent(class); + } while (class != object_class_by_name(TYPE_DEVICE)); +} diff --git a/hw/core/qdev.c b/hw/core/qdev.c index cbdff0b6c6..d3611e7c03 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -705,115 +705,6 @@ char *qdev_get_dev_path(DeviceState *dev) return NULL; } -/** - * Legacy property handling - */ - -static void qdev_get_legacy_property(Object *obj, Visitor *v, - const char *name, void *opaque, - Error **errp) -{ - DeviceState *dev = DEVICE(obj); - Property *prop = opaque; - - char buffer[1024]; - char *ptr = buffer; - - prop->info->print(dev, prop, buffer, sizeof(buffer)); - visit_type_str(v, name, &ptr, errp); -} - -/** - * qdev_class_add_legacy_property: - * @dev: Device to add the property to. - * @prop: The qdev property definition. - * - * Add a legacy QOM property to @dev for qdev property @prop. - * - * Legacy properties are string versions of QOM properties. The format of - * the string depends on the property type. Legacy properties are only - * needed for "info qtree". - * - * Do not use this in new code! QOM Properties added through this interface - * will be given names in the "legacy" namespace. - */ -static void qdev_class_add_legacy_property(DeviceClass *dc, Property *prop) -{ - g_autofree char *name = NULL; - - /* Register pointer properties as legacy properties */ - if (!prop->info->print && prop->info->get) { - return; - } - - name = g_strdup_printf("legacy-%s", prop->name); - object_class_property_add(OBJECT_CLASS(dc), name, "str", - prop->info->print ? qdev_get_legacy_property : prop->info->get, - NULL, NULL, prop); -} - -void qdev_property_add_static(DeviceState *dev, Property *prop) -{ - Object *obj = OBJECT(dev); - ObjectProperty *op; - - assert(!prop->info->create); - - op = object_property_add(obj, prop->name, prop->info->name, - prop->info->get, prop->info->set, - prop->info->release, - prop); - - object_property_set_description(obj, prop->name, - prop->info->description); - - if (prop->set_default) { - prop->info->set_default_value(op, prop); - if (op->init) { - op->init(obj, op); - } - } -} - -static void qdev_class_add_property(DeviceClass *klass, Property *prop) -{ - ObjectClass *oc = OBJECT_CLASS(klass); - - if (prop->info->create) { - prop->info->create(oc, prop); - } else { - ObjectProperty *op; - - op = object_class_property_add(oc, - prop->name, prop->info->name, - prop->info->get, prop->info->set, - prop->info->release, - prop); - if (prop->set_default) { - prop->info->set_default_value(op, prop); - } - } - object_class_property_set_description(oc, prop->name, - prop->info->description); -} - -void qdev_alias_all_properties(DeviceState *target, Object *source) -{ - ObjectClass *class; - Property *prop; - - class = object_get_class(OBJECT(target)); - do { - DeviceClass *dc = DEVICE_CLASS(class); - - for (prop = dc->props_; prop && prop->name; prop++) { - object_property_add_alias(source, prop->name, - OBJECT(target), prop->name); - } - class = object_class_get_parent(class); - } while (class != object_class_by_name(TYPE_DEVICE)); -} - static bool device_get_realized(Object *obj, Error **errp) { DeviceState *dev = DEVICE(obj); @@ -1208,17 +1099,6 @@ static void device_class_init(ObjectClass *class, void *data) offsetof(DeviceState, parent_bus), NULL, 0); } -void device_class_set_props(DeviceClass *dc, Property *props) -{ - Property *prop; - - dc->props_ = props; - for (prop = props; prop && prop->name; prop++) { - qdev_class_add_legacy_property(dc, prop); - qdev_class_add_property(dc, prop); - } -} - void device_class_set_parent_reset(DeviceClass *dc, DeviceReset dev_reset, DeviceReset *parent_reset) diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c index 832e254842..8c072e3efc 100644 --- a/softmmu/qdev-monitor.c +++ b/softmmu/qdev-monitor.c @@ -38,6 +38,7 @@ #include "migration/misc.h" #include "migration/migration.h" #include "qemu/cutils.h" +#include "hw/qdev-properties.h" #include "hw/clock.h" /* From patchwork Fri Dec 11 22:05:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1415305 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=gFkV4eGh; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Ct4pH1XKbz9sVk for ; Sat, 12 Dec 2020 09:14:47 +1100 (AEDT) Received: from localhost ([::1]:48040 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knqgX-0006up-5D for incoming@patchwork.ozlabs.org; Fri, 11 Dec 2020 17:14:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59354) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqY3-0001en-A3 for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:05:59 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:31379) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqY0-0006G9-5U for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:05:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724355; 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=vEjTnFSP6RWWnn7yq/e5wvK10BECB3NOm0e4zn5Aqds=; b=gFkV4eGhxLgogTIHYO9lNqSv0su6BEgvLFJULH4rOwQ760L2iTzA3l41uMf5UvYjafMTIA bVsY9m2G0yCSpmdG+9EwjrfxqR65OVB1M+QtoQKF4hzpGIx8ULwhEU7ll0uCnnu6Hgsibu qY88x0grw7q9VQzA6BXEahyTrNQzoxU= 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-557-uj4neX3iMYqnewQD6xGI6Q-1; Fri, 11 Dec 2020 17:05:54 -0500 X-MC-Unique: uj4neX3iMYqnewQD6xGI6Q-1 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 EE548107ACE4; Fri, 11 Dec 2020 22:05:52 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8E15560BE5; Fri, 11 Dec 2020 22:05:49 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 04/32] qdev: Check dev->realized at set_size() Date: Fri, 11 Dec 2020 17:05:01 -0500 Message-Id: <20201211220529.2290218-5-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This setter is one of the very few property setters that don't check dev->realized, and there's no reason to make size properties different from the rest. Add the missing check. Fixes: e8cd45c78f53 ("qdev: Add SIZE type to qdev properties") Reviewed-by: Marc-André Lureau Signed-off-by: Eduardo Habkost --- Cc: Paolo Bonzini Cc: "Daniel P. Berrangé" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- hw/core/qdev-properties.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 12a053e732..67ae19df05 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -905,6 +905,11 @@ static void set_size(Object *obj, Visitor *v, const char *name, void *opaque, Property *prop = opaque; uint64_t *ptr = qdev_get_prop_ptr(dev, prop); + if (dev->realized) { + qdev_prop_set_after_realize(dev, name, errp); + return; + } + visit_type_size(v, name, ptr, errp); } From patchwork Fri Dec 11 22:05:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1415308 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=iAIGfC/R; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Ct4t16l8zz9sSf for ; Sat, 12 Dec 2020 09:18:01 +1100 (AEDT) Received: from localhost ([::1]:53858 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knqje-00017b-2q for incoming@patchwork.ozlabs.org; Fri, 11 Dec 2020 17:17:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59430) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqYC-0001lW-9N for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:08 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:30973) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqY5-0006Ho-RN for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724360; 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=r5SUdFI3N6wVVjpbnCaYFUtRE+pQyNNogHtPpD9mdfE=; b=iAIGfC/RBOrLuhRJ5piawKjtiUGLJ/ZA7f8el1h31sZYaVoMSDBXLG8Cpz6VsBpWHpVI+j lZMZjKAG0pFNXmTQ8ylJhEHPGZ07uoNhsesNorrQWsCOf6irIKXcHTNl5t/NWLtkZ208Ch R8NJTf5PZm32I2IF2zA/sSAcdINZX0g= 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-566-xWM088oIMx2IAZNNm1rh3A-1; Fri, 11 Dec 2020 17:05:59 -0500 X-MC-Unique: xWM088oIMx2IAZNNm1rh3A-1 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 D87D3800D55; Fri, 11 Dec 2020 22:05:57 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 155E85C8AA; Fri, 11 Dec 2020 22:05:53 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 05/32] sparc: Check dev->realized at sparc_set_nwindows() Date: Fri, 11 Dec 2020 17:05:02 -0500 Message-Id: <20201211220529.2290218-6-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Mark Cave-Ayland , Markus Armbruster , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Artyom Tarasenko , Stefan Berger Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" sparc_set_nwindows() is one of the very few property setters that don't check dev->realized, and there's no reason for it to be special. Check dev->realized like the other setters. Reviewed-by: Marc-André Lureau Signed-off-by: Eduardo Habkost Acked-by: Mark Cave-Ayland --- Cc: Mark Cave-Ayland Cc: Artyom Tarasenko Cc: qemu-devel@nongnu.org --- target/sparc/cpu.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index 701e794eac..6a3299041f 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -798,11 +798,17 @@ static void sparc_get_nwindows(Object *obj, Visitor *v, const char *name, static void sparc_set_nwindows(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { + DeviceState *dev = DEVICE(obj); const int64_t min = MIN_NWINDOWS; const int64_t max = MAX_NWINDOWS; SPARCCPU *cpu = SPARC_CPU(obj); int64_t value; + if (dev->realized) { + qdev_prop_set_after_realize(dev, name, errp); + return; + } + if (!visit_type_int(v, name, &value, errp)) { return; } From patchwork Fri Dec 11 22:05:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1415309 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=N7Z5PoAz; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Ct4tM0hdKz9sSf for ; Sat, 12 Dec 2020 09:18:19 +1100 (AEDT) Received: from localhost ([::1]:54756 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knqjx-0001bF-2g for incoming@patchwork.ozlabs.org; Fri, 11 Dec 2020 17:18:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59420) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqYB-0001lA-IB for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:07 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:51359) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqYA-0006J0-0b for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724365; 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=bjbAAGsu3eif6zWUP3OWVxWI0koAqnB2AtUWbzN1whY=; b=N7Z5PoAzp+fyY41VzVKRbb+7TRso5dBeSaq9E3RZTC1w+sL1E5xlv7oMBjO/o3jO1AuqBz 3OTomZm5H7XO1peHbmx0TEzvBtVJFKEHsIs+seYNXfrgcYbDVAk1fsg/P43SRWXKhKOU2A wbftCdX5xMTn64w6cNz9SDMFyETKSTc= 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-106-D8KVOaMNNxmCQra5LRWZow-1; Fri, 11 Dec 2020 17:06:03 -0500 X-MC-Unique: D8KVOaMNNxmCQra5LRWZow-1 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 C35FB800D53; Fri, 11 Dec 2020 22:06:02 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 187E41002391; Fri, 11 Dec 2020 22:05:59 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 06/32] qdev: Don't use dev->id on set_size32() error message Date: Fri, 11 Dec 2020 17:05:03 -0500 Message-Id: <20201211220529.2290218-7-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" All other qdev property error messages use "." instead of ".". Change set_size32() for consistency, and to make the code not specific to TYPE_DEVICE. Reviewed-by: Marc-André Lureau Signed-off-by: Eduardo Habkost --- Cc: Paolo Bonzini Cc: "Daniel P. Berrangé" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- hw/core/qdev-properties.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 67ae19df05..daf844c2d3 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -542,7 +542,7 @@ static void set_size32(Object *obj, Visitor *v, const char *name, void *opaque, error_setg(errp, "Property %s.%s doesn't take value %" PRIu64 " (maximum: %u)", - dev->id ? : "", name, value, UINT32_MAX); + object_get_typename(obj), name, value, UINT32_MAX); return; } From patchwork Fri Dec 11 22:05:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1415314 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=TfUmMktv; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Ct5003d7kz9sVJ for ; Sat, 12 Dec 2020 09:23:09 +1100 (AEDT) Received: from localhost ([::1]:34052 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knqoc-00053V-0n for incoming@patchwork.ozlabs.org; Fri, 11 Dec 2020 17:23:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59436) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqYD-0001le-6B for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:09 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:25646) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqYB-0006Jt-H1 for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724366; 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=tPhZ+siQcEyC1V/WCxGzx09M1O2LwyOYj1QAvC19Upw=; b=TfUmMktvMNQcKnqHuitaYwxPEVXzfqI2dbscsixKJfqi3aEQXeHBZrDyretzFu63jhcML9 emtqT5Uz1P4uARf0Z0uFWTz9+f3/YGEGQeGiRYS7A7B1Its47NrJZqdyH28V5gZPesDvcN v8w2xFvkdswN4rHol68HH2XO/V2yYyY= 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-274-sQhZw21CO_iZBmPXhBoq-Q-1; Fri, 11 Dec 2020 17:06:05 -0500 X-MC-Unique: sQhZw21CO_iZBmPXhBoq-Q-1 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 3D520801817; Fri, 11 Dec 2020 22:06:04 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id E27EB10023AD; Fri, 11 Dec 2020 22:06:03 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 07/32] qdev: Make PropertyInfo.print method get Object* argument Date: Fri, 11 Dec 2020 17:05:04 -0500 Message-Id: <20201211220529.2290218-8-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Make the code more generic and not specific to TYPE_DEVICE. Reviewed-by: Marc-André Lureau Signed-off-by: Eduardo Habkost --- Cc: Paolo Bonzini Cc: "Daniel P. Berrangé" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- include/hw/qdev-properties.h | 2 +- hw/core/qdev-properties-system.c | 3 ++- hw/core/qdev-properties.c | 3 +-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index db7ce51dd5..0ea822e6a7 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -32,7 +32,7 @@ struct PropertyInfo { const char *name; const char *description; const QEnumLookup *enum_table; - int (*print)(DeviceState *dev, Property *prop, char *dest, size_t len); + int (*print)(Object *obj, Property *prop, char *dest, size_t len); void (*set_default_value)(ObjectProperty *op, const Property *prop); void (*create)(ObjectClass *oc, Property *prop); ObjectPropertyAccessor *get; diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c index 8912fb4e9c..77b31eb9dc 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -801,9 +801,10 @@ invalid: g_free(str); } -static int print_pci_devfn(DeviceState *dev, Property *prop, char *dest, +static int print_pci_devfn(Object *obj, Property *prop, char *dest, size_t len) { + DeviceState *dev = DEVICE(obj); int32_t *ptr = qdev_get_prop_ptr(dev, prop); if (*ptr == -1) { diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index daf844c2d3..b6cf53e929 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -988,13 +988,12 @@ static void qdev_get_legacy_property(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; char buffer[1024]; char *ptr = buffer; - prop->info->print(dev, prop, buffer, sizeof(buffer)); + prop->info->print(obj, prop, buffer, sizeof(buffer)); visit_type_str(v, name, &ptr, errp); } From patchwork Fri Dec 11 22:05:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1415297 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=YrMcMo/d; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Ct4fY5Wk6z9sRK for ; Sat, 12 Dec 2020 09:08:05 +1100 (AEDT) Received: from localhost ([::1]:37562 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knqa2-0001up-Py for incoming@patchwork.ozlabs.org; Fri, 11 Dec 2020 17:08:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59494) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqYM-0001rq-Ky for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:18 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:42616) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqYG-0006L5-OA for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724371; 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=gdMyOjPEyHa8ld0hjAoBSsicMflgaQnNdGClhjzau5k=; b=YrMcMo/dVoTTGr23eKna8ZKI3rJfIhh9jBeeWp+492uE6dW+k86sNUJrYw5GMDrQckqzVs g8kg6HzAti9VCMZuf+hypqn6ZPUajeFQYJTMbArmRPaTOX1ZppvYf/Yr221VhI/LAewocI OjX92BDxzOfWRO+8DiTc+7Mx+4zF1/Q= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-15-t6dkPKtnNuOO1rUtpvwMYQ-1; Fri, 11 Dec 2020 17:06:07 -0500 X-MC-Unique: t6dkPKtnNuOO1rUtpvwMYQ-1 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 45CE319251A1; Fri, 11 Dec 2020 22:06:06 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id BC2D171C80; Fri, 11 Dec 2020 22:06:05 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 08/32] qdev: Make bit_prop_set() get Object* argument Date: Fri, 11 Dec 2020 17:05:05 -0500 Message-Id: <20201211220529.2290218-9-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Make the code more generic and not specific to TYPE_DEVICE. Reviewed-by: Marc-André Lureau Signed-off-by: Eduardo Habkost --- Cc: Paolo Bonzini Cc: "Daniel P. Berrangé" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- hw/core/qdev-properties.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index b6cf53e929..3a4638f4de 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -92,8 +92,9 @@ static uint32_t qdev_get_prop_mask(Property *prop) return 0x1 << prop->bitnr; } -static void bit_prop_set(DeviceState *dev, Property *props, bool val) +static void bit_prop_set(Object *obj, Property *props, bool val) { + DeviceState *dev = DEVICE(obj); uint32_t *p = qdev_get_prop_ptr(dev, props); uint32_t mask = qdev_get_prop_mask(props); if (val) { @@ -129,7 +130,7 @@ static void prop_set_bit(Object *obj, Visitor *v, const char *name, if (!visit_type_bool(v, name, &value, errp)) { return; } - bit_prop_set(dev, prop, value); + bit_prop_set(obj, prop, value); } static void set_default_value_bool(ObjectProperty *op, const Property *prop) @@ -153,8 +154,9 @@ static uint64_t qdev_get_prop_mask64(Property *prop) return 0x1ull << prop->bitnr; } -static void bit64_prop_set(DeviceState *dev, Property *props, bool val) +static void bit64_prop_set(Object *obj, Property *props, bool val) { + DeviceState *dev = DEVICE(obj); uint64_t *p = qdev_get_prop_ptr(dev, props); uint64_t mask = qdev_get_prop_mask64(props); if (val) { @@ -190,7 +192,7 @@ static void prop_set_bit64(Object *obj, Visitor *v, const char *name, if (!visit_type_bool(v, name, &value, errp)) { return; } - bit64_prop_set(dev, prop, value); + bit64_prop_set(obj, prop, value); } const PropertyInfo qdev_prop_bit64 = { From patchwork Fri Dec 11 22:05:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1415303 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=MoaxH5iX; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Ct4mS1RPRz9sSf for ; Sat, 12 Dec 2020 09:13:12 +1100 (AEDT) Received: from localhost ([::1]:46064 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knqf0-000634-3O for incoming@patchwork.ozlabs.org; Fri, 11 Dec 2020 17:13:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59584) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqYS-0001zC-V0 for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:24 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:54579) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqYN-0006Nv-EQ for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724378; 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=ZJe/QLookReovEWCweH6zzebkyNL6c/FJv8O55OglUc=; b=MoaxH5iX+Bu8BkYmJlhmk7VuB2ZGjFtrYilecMwHMUJ71ftVp8ZuvHKyvq01Bk6mdvXxXa fGZ4WrJssB6vPbKhXuaqoWMuirg11Kwa+DXkfVYXJ+jFITuzf3hvlBncopXAddST+rCBUm 93uzUskPRo3y6eIJfMoE5QFUW3iEpZ4= 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-250-SvvGBz7CO8qmThcdqBMh3g-1; Fri, 11 Dec 2020 17:06:17 -0500 X-MC-Unique: SvvGBz7CO8qmThcdqBMh3g-1 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 9442119251A1; Fri, 11 Dec 2020 22:06:14 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id D346B19C78; Fri, 11 Dec 2020 22:06:06 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 09/32] qdev: Make qdev_get_prop_ptr() get Object* arg Date: Fri, 11 Dec 2020 17:05:06 -0500 Message-Id: <20201211220529.2290218-10-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matthew Rosato , David Hildenbrand , Stefano Stabellini , xen-devel@lists.xenproject.org, qemu-block@nongnu.org, Stefan Berger , Paul Durrant , Markus Armbruster , Halil Pasic , Christian Borntraeger , Anthony Perard , =?utf-8?q?Marc-Andr=C3=A9_Lurea?= =?utf-8?q?u?= , =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= , Thomas Huth , Alex Williamson , Igor Mammedov , John Snow , Richard Henderson , Kevin Wolf , "Daniel P. Berrange" , Cornelia Huck , qemu-s390x@nongnu.org, Max Reitz , Paolo Bonzini , Stefan Berger Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Make the code more generic and not specific to TYPE_DEVICE. Reviewed-by: Marc-André Lureau Reviewed-by: Cornelia Huck #s390 parts Signed-off-by: Eduardo Habkost Acked-by: Paul Durrant --- Changes v1 -> v2: - Fix build error with CONFIG_XEN I took the liberty of keeping the Reviewed-by line from Marc-André as the build fix is a trivial one line change --- Cc: Stefan Berger Cc: Stefano Stabellini Cc: Anthony Perard Cc: Paul Durrant Cc: Kevin Wolf Cc: Max Reitz Cc: Paolo Bonzini Cc: "Daniel P. Berrangé" Cc: Eduardo Habkost Cc: Cornelia Huck Cc: Thomas Huth Cc: Richard Henderson Cc: David Hildenbrand Cc: Halil Pasic Cc: Christian Borntraeger Cc: Matthew Rosato Cc: Alex Williamson Cc: qemu-devel@nongnu.org Cc: xen-devel@lists.xenproject.org Cc: qemu-block@nongnu.org Cc: qemu-s390x@nongnu.org --- include/hw/qdev-properties.h | 2 +- backends/tpm/tpm_util.c | 8 ++-- hw/block/xen-block.c | 5 +- hw/core/qdev-properties-system.c | 57 +++++++++------------- hw/core/qdev-properties.c | 82 +++++++++++++------------------- hw/s390x/css.c | 5 +- hw/s390x/s390-pci-bus.c | 4 +- hw/vfio/pci-quirks.c | 5 +- 8 files changed, 68 insertions(+), 100 deletions(-) diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 0ea822e6a7..0b92cfc761 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -302,7 +302,7 @@ 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); -void *qdev_get_prop_ptr(DeviceState *dev, Property *prop); +void *qdev_get_prop_ptr(Object *obj, Property *prop); void qdev_prop_register_global(GlobalProperty *prop); const GlobalProperty *qdev_find_global_prop(DeviceState *dev, diff --git a/backends/tpm/tpm_util.c b/backends/tpm/tpm_util.c index e6aeb63587..3973105658 100644 --- a/backends/tpm/tpm_util.c +++ b/backends/tpm/tpm_util.c @@ -35,8 +35,7 @@ static void get_tpm(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); - TPMBackend **be = qdev_get_prop_ptr(dev, opaque); + TPMBackend **be = qdev_get_prop_ptr(obj, opaque); char *p; p = g_strdup(*be ? (*be)->id : ""); @@ -49,7 +48,7 @@ static void set_tpm(Object *obj, Visitor *v, const char *name, void *opaque, { DeviceState *dev = DEVICE(obj); Property *prop = opaque; - TPMBackend *s, **be = qdev_get_prop_ptr(dev, prop); + TPMBackend *s, **be = qdev_get_prop_ptr(obj, prop); char *str; if (dev->realized) { @@ -73,9 +72,8 @@ static void set_tpm(Object *obj, Visitor *v, const char *name, void *opaque, static void release_tpm(Object *obj, const char *name, void *opaque) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; - TPMBackend **be = qdev_get_prop_ptr(dev, prop); + TPMBackend **be = qdev_get_prop_ptr(obj, prop); if (*be) { tpm_backend_reset(*be); diff --git a/hw/block/xen-block.c b/hw/block/xen-block.c index 8a7a3f5452..905e4acd97 100644 --- a/hw/block/xen-block.c +++ b/hw/block/xen-block.c @@ -335,9 +335,8 @@ static char *disk_to_vbd_name(unsigned int disk) static void xen_block_get_vdev(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; - XenBlockVdev *vdev = qdev_get_prop_ptr(dev, prop); + XenBlockVdev *vdev = qdev_get_prop_ptr(obj, prop); char *str; switch (vdev->type) { @@ -398,7 +397,7 @@ static void xen_block_set_vdev(Object *obj, Visitor *v, const char *name, { DeviceState *dev = DEVICE(obj); Property *prop = opaque; - XenBlockVdev *vdev = qdev_get_prop_ptr(dev, prop); + XenBlockVdev *vdev = qdev_get_prop_ptr(obj, prop); char *str, *p; const char *end; diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c index 77b31eb9dc..9ac9b95852 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -59,9 +59,8 @@ static bool check_prop_still_unset(DeviceState *dev, const char *name, static void get_drive(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; - void **ptr = qdev_get_prop_ptr(dev, prop); + void **ptr = qdev_get_prop_ptr(obj, prop); const char *value; char *p; @@ -87,7 +86,7 @@ static void set_drive_helper(Object *obj, Visitor *v, const char *name, { DeviceState *dev = DEVICE(obj); Property *prop = opaque; - void **ptr = qdev_get_prop_ptr(dev, prop); + void **ptr = qdev_get_prop_ptr(obj, prop); char *str; BlockBackend *blk; bool blk_created = false; @@ -185,7 +184,7 @@ static void release_drive(Object *obj, const char *name, void *opaque) { DeviceState *dev = DEVICE(obj); Property *prop = opaque; - BlockBackend **ptr = qdev_get_prop_ptr(dev, prop); + BlockBackend **ptr = qdev_get_prop_ptr(obj, prop); if (*ptr) { AioContext *ctx = blk_get_aio_context(*ptr); @@ -218,8 +217,7 @@ const PropertyInfo qdev_prop_drive_iothread = { static void get_chr(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); - CharBackend *be = qdev_get_prop_ptr(dev, opaque); + CharBackend *be = qdev_get_prop_ptr(obj, opaque); char *p; p = g_strdup(be->chr && be->chr->label ? be->chr->label : ""); @@ -232,7 +230,7 @@ static void set_chr(Object *obj, Visitor *v, const char *name, void *opaque, { DeviceState *dev = DEVICE(obj); Property *prop = opaque; - CharBackend *be = qdev_get_prop_ptr(dev, prop); + CharBackend *be = qdev_get_prop_ptr(obj, prop); Chardev *s; char *str; @@ -272,9 +270,8 @@ static void set_chr(Object *obj, Visitor *v, const char *name, void *opaque, static void release_chr(Object *obj, const char *name, void *opaque) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; - CharBackend *be = qdev_get_prop_ptr(dev, prop); + CharBackend *be = qdev_get_prop_ptr(obj, prop); qemu_chr_fe_deinit(be, false); } @@ -297,9 +294,8 @@ const PropertyInfo qdev_prop_chr = { static void get_mac(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; - MACAddr *mac = qdev_get_prop_ptr(dev, prop); + MACAddr *mac = qdev_get_prop_ptr(obj, prop); char buffer[2 * 6 + 5 + 1]; char *p = buffer; @@ -315,7 +311,7 @@ static void set_mac(Object *obj, Visitor *v, const char *name, void *opaque, { DeviceState *dev = DEVICE(obj); Property *prop = opaque; - MACAddr *mac = qdev_get_prop_ptr(dev, prop); + MACAddr *mac = qdev_get_prop_ptr(obj, prop); int i, pos; char *str; const char *p; @@ -381,9 +377,8 @@ void qdev_prop_set_macaddr(DeviceState *dev, const char *name, static void get_netdev(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; - NICPeers *peers_ptr = qdev_get_prop_ptr(dev, prop); + NICPeers *peers_ptr = qdev_get_prop_ptr(obj, prop); char *p = g_strdup(peers_ptr->ncs[0] ? peers_ptr->ncs[0]->name : ""); visit_type_str(v, name, &p, errp); @@ -395,7 +390,7 @@ static void set_netdev(Object *obj, Visitor *v, const char *name, { DeviceState *dev = DEVICE(obj); Property *prop = opaque; - NICPeers *peers_ptr = qdev_get_prop_ptr(dev, prop); + NICPeers *peers_ptr = qdev_get_prop_ptr(obj, prop); NetClientState **ncs = peers_ptr->ncs; NetClientState *peers[MAX_QUEUE_NUM]; int queues, err = 0, i = 0; @@ -461,9 +456,8 @@ const PropertyInfo qdev_prop_netdev = { static void get_audiodev(Object *obj, Visitor *v, const char* name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; - QEMUSoundCard *card = qdev_get_prop_ptr(dev, prop); + QEMUSoundCard *card = qdev_get_prop_ptr(obj, prop); char *p = g_strdup(audio_get_id(card)); visit_type_str(v, name, &p, errp); @@ -475,7 +469,7 @@ static void set_audiodev(Object *obj, Visitor *v, const char* name, { DeviceState *dev = DEVICE(obj); Property *prop = opaque; - QEMUSoundCard *card = qdev_get_prop_ptr(dev, prop); + QEMUSoundCard *card = qdev_get_prop_ptr(obj, prop); AudioState *state; int err = 0; char *str; @@ -582,7 +576,7 @@ static void set_blocksize(Object *obj, Visitor *v, const char *name, { DeviceState *dev = DEVICE(obj); Property *prop = opaque; - uint32_t *ptr = qdev_get_prop_ptr(dev, prop); + uint32_t *ptr = qdev_get_prop_ptr(obj, prop); uint64_t value; Error *local_err = NULL; @@ -674,9 +668,8 @@ const PropertyInfo qdev_prop_multifd_compression = { static void get_reserved_region(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; - ReservedRegion *rr = qdev_get_prop_ptr(dev, prop); + ReservedRegion *rr = qdev_get_prop_ptr(obj, prop); char buffer[64]; char *p = buffer; int rc; @@ -693,7 +686,7 @@ static void set_reserved_region(Object *obj, Visitor *v, const char *name, { DeviceState *dev = DEVICE(obj); Property *prop = opaque; - ReservedRegion *rr = qdev_get_prop_ptr(dev, prop); + ReservedRegion *rr = qdev_get_prop_ptr(obj, prop); Error *local_err = NULL; const char *endptr; char *str; @@ -761,7 +754,7 @@ static void set_pci_devfn(Object *obj, Visitor *v, const char *name, { DeviceState *dev = DEVICE(obj); Property *prop = opaque; - int32_t value, *ptr = qdev_get_prop_ptr(dev, prop); + int32_t value, *ptr = qdev_get_prop_ptr(obj, prop); unsigned int slot, fn, n; char *str; @@ -804,8 +797,7 @@ invalid: static int print_pci_devfn(Object *obj, Property *prop, char *dest, size_t len) { - DeviceState *dev = DEVICE(obj); - int32_t *ptr = qdev_get_prop_ptr(dev, prop); + int32_t *ptr = qdev_get_prop_ptr(obj, prop); if (*ptr == -1) { return snprintf(dest, len, ""); @@ -828,9 +820,8 @@ const PropertyInfo qdev_prop_pci_devfn = { static void get_pci_host_devaddr(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; - PCIHostDeviceAddress *addr = qdev_get_prop_ptr(dev, prop); + PCIHostDeviceAddress *addr = qdev_get_prop_ptr(obj, prop); char buffer[] = "ffff:ff:ff.f"; char *p = buffer; int rc = 0; @@ -857,7 +848,7 @@ static void set_pci_host_devaddr(Object *obj, Visitor *v, const char *name, { DeviceState *dev = DEVICE(obj); Property *prop = opaque; - PCIHostDeviceAddress *addr = qdev_get_prop_ptr(dev, prop); + PCIHostDeviceAddress *addr = qdev_get_prop_ptr(obj, prop); char *str, *p; char *e; unsigned long val; @@ -951,9 +942,8 @@ const PropertyInfo qdev_prop_off_auto_pcibar = { static void get_prop_pcielinkspeed(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; - PCIExpLinkSpeed *p = qdev_get_prop_ptr(dev, prop); + PCIExpLinkSpeed *p = qdev_get_prop_ptr(obj, prop); int speed; switch (*p) { @@ -982,7 +972,7 @@ static void set_prop_pcielinkspeed(Object *obj, Visitor *v, const char *name, { DeviceState *dev = DEVICE(obj); Property *prop = opaque; - PCIExpLinkSpeed *p = qdev_get_prop_ptr(dev, prop); + PCIExpLinkSpeed *p = qdev_get_prop_ptr(obj, prop); int speed; if (dev->realized) { @@ -1028,9 +1018,8 @@ const PropertyInfo qdev_prop_pcie_link_speed = { static void get_prop_pcielinkwidth(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; - PCIExpLinkWidth *p = qdev_get_prop_ptr(dev, prop); + PCIExpLinkWidth *p = qdev_get_prop_ptr(obj, prop); int width; switch (*p) { @@ -1068,7 +1057,7 @@ static void set_prop_pcielinkwidth(Object *obj, Visitor *v, const char *name, { DeviceState *dev = DEVICE(obj); Property *prop = opaque; - PCIExpLinkWidth *p = qdev_get_prop_ptr(dev, prop); + PCIExpLinkWidth *p = qdev_get_prop_ptr(obj, prop); int width; if (dev->realized) { diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 3a4638f4de..0a54a922c8 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -38,9 +38,9 @@ void qdev_prop_allow_set_link_before_realize(const Object *obj, } } -void *qdev_get_prop_ptr(DeviceState *dev, Property *prop) +void *qdev_get_prop_ptr(Object *obj, Property *prop) { - void *ptr = dev; + void *ptr = obj; ptr += prop->offset; return ptr; } @@ -48,9 +48,8 @@ void *qdev_get_prop_ptr(DeviceState *dev, Property *prop) void qdev_propinfo_get_enum(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; - int *ptr = qdev_get_prop_ptr(dev, prop); + int *ptr = qdev_get_prop_ptr(obj, prop); visit_type_enum(v, prop->name, ptr, prop->info->enum_table, errp); } @@ -60,7 +59,7 @@ void qdev_propinfo_set_enum(Object *obj, Visitor *v, const char *name, { DeviceState *dev = DEVICE(obj); Property *prop = opaque; - int *ptr = qdev_get_prop_ptr(dev, prop); + int *ptr = qdev_get_prop_ptr(obj, prop); if (dev->realized) { qdev_prop_set_after_realize(dev, name, errp); @@ -94,8 +93,7 @@ static uint32_t qdev_get_prop_mask(Property *prop) static void bit_prop_set(Object *obj, Property *props, bool val) { - DeviceState *dev = DEVICE(obj); - uint32_t *p = qdev_get_prop_ptr(dev, props); + uint32_t *p = qdev_get_prop_ptr(obj, props); uint32_t mask = qdev_get_prop_mask(props); if (val) { *p |= mask; @@ -107,9 +105,8 @@ static void bit_prop_set(Object *obj, Property *props, bool val) static void prop_get_bit(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; - uint32_t *p = qdev_get_prop_ptr(dev, prop); + uint32_t *p = qdev_get_prop_ptr(obj, prop); bool value = (*p & qdev_get_prop_mask(prop)) != 0; visit_type_bool(v, name, &value, errp); @@ -156,8 +153,7 @@ static uint64_t qdev_get_prop_mask64(Property *prop) static void bit64_prop_set(Object *obj, Property *props, bool val) { - DeviceState *dev = DEVICE(obj); - uint64_t *p = qdev_get_prop_ptr(dev, props); + uint64_t *p = qdev_get_prop_ptr(obj, props); uint64_t mask = qdev_get_prop_mask64(props); if (val) { *p |= mask; @@ -169,9 +165,8 @@ static void bit64_prop_set(Object *obj, Property *props, bool val) static void prop_get_bit64(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; - uint64_t *p = qdev_get_prop_ptr(dev, prop); + uint64_t *p = qdev_get_prop_ptr(obj, prop); bool value = (*p & qdev_get_prop_mask64(prop)) != 0; visit_type_bool(v, name, &value, errp); @@ -208,9 +203,8 @@ const PropertyInfo qdev_prop_bit64 = { static void get_bool(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; - bool *ptr = qdev_get_prop_ptr(dev, prop); + bool *ptr = qdev_get_prop_ptr(obj, prop); visit_type_bool(v, name, ptr, errp); } @@ -220,7 +214,7 @@ static void set_bool(Object *obj, Visitor *v, const char *name, void *opaque, { DeviceState *dev = DEVICE(obj); Property *prop = opaque; - bool *ptr = qdev_get_prop_ptr(dev, prop); + bool *ptr = qdev_get_prop_ptr(obj, prop); if (dev->realized) { qdev_prop_set_after_realize(dev, name, errp); @@ -242,9 +236,8 @@ const PropertyInfo qdev_prop_bool = { static void get_uint8(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; - uint8_t *ptr = qdev_get_prop_ptr(dev, prop); + uint8_t *ptr = qdev_get_prop_ptr(obj, prop); visit_type_uint8(v, name, ptr, errp); } @@ -254,7 +247,7 @@ static void set_uint8(Object *obj, Visitor *v, const char *name, void *opaque, { DeviceState *dev = DEVICE(obj); Property *prop = opaque; - uint8_t *ptr = qdev_get_prop_ptr(dev, prop); + uint8_t *ptr = qdev_get_prop_ptr(obj, prop); if (dev->realized) { qdev_prop_set_after_realize(dev, name, errp); @@ -288,9 +281,8 @@ const PropertyInfo qdev_prop_uint8 = { void qdev_propinfo_get_uint16(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; - uint16_t *ptr = qdev_get_prop_ptr(dev, prop); + uint16_t *ptr = qdev_get_prop_ptr(obj, prop); visit_type_uint16(v, name, ptr, errp); } @@ -300,7 +292,7 @@ static void set_uint16(Object *obj, Visitor *v, const char *name, { DeviceState *dev = DEVICE(obj); Property *prop = opaque; - uint16_t *ptr = qdev_get_prop_ptr(dev, prop); + uint16_t *ptr = qdev_get_prop_ptr(obj, prop); if (dev->realized) { qdev_prop_set_after_realize(dev, name, errp); @@ -322,9 +314,8 @@ const PropertyInfo qdev_prop_uint16 = { static void get_uint32(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; - uint32_t *ptr = qdev_get_prop_ptr(dev, prop); + uint32_t *ptr = qdev_get_prop_ptr(obj, prop); visit_type_uint32(v, name, ptr, errp); } @@ -334,7 +325,7 @@ static void set_uint32(Object *obj, Visitor *v, const char *name, { DeviceState *dev = DEVICE(obj); Property *prop = opaque; - uint32_t *ptr = qdev_get_prop_ptr(dev, prop); + uint32_t *ptr = qdev_get_prop_ptr(obj, prop); if (dev->realized) { qdev_prop_set_after_realize(dev, name, errp); @@ -347,9 +338,8 @@ static void set_uint32(Object *obj, Visitor *v, const char *name, void qdev_propinfo_get_int32(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; - int32_t *ptr = qdev_get_prop_ptr(dev, prop); + int32_t *ptr = qdev_get_prop_ptr(obj, prop); visit_type_int32(v, name, ptr, errp); } @@ -359,7 +349,7 @@ static void set_int32(Object *obj, Visitor *v, const char *name, void *opaque, { DeviceState *dev = DEVICE(obj); Property *prop = opaque; - int32_t *ptr = qdev_get_prop_ptr(dev, prop); + int32_t *ptr = qdev_get_prop_ptr(obj, prop); if (dev->realized) { qdev_prop_set_after_realize(dev, name, errp); @@ -388,9 +378,8 @@ const PropertyInfo qdev_prop_int32 = { static void get_uint64(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; - uint64_t *ptr = qdev_get_prop_ptr(dev, prop); + uint64_t *ptr = qdev_get_prop_ptr(obj, prop); visit_type_uint64(v, name, ptr, errp); } @@ -400,7 +389,7 @@ static void set_uint64(Object *obj, Visitor *v, const char *name, { DeviceState *dev = DEVICE(obj); Property *prop = opaque; - uint64_t *ptr = qdev_get_prop_ptr(dev, prop); + uint64_t *ptr = qdev_get_prop_ptr(obj, prop); if (dev->realized) { qdev_prop_set_after_realize(dev, name, errp); @@ -413,9 +402,8 @@ static void set_uint64(Object *obj, Visitor *v, const char *name, static void get_int64(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; - int64_t *ptr = qdev_get_prop_ptr(dev, prop); + int64_t *ptr = qdev_get_prop_ptr(obj, prop); visit_type_int64(v, name, ptr, errp); } @@ -425,7 +413,7 @@ static void set_int64(Object *obj, Visitor *v, const char *name, { DeviceState *dev = DEVICE(obj); Property *prop = opaque; - int64_t *ptr = qdev_get_prop_ptr(dev, prop); + int64_t *ptr = qdev_get_prop_ptr(obj, prop); if (dev->realized) { qdev_prop_set_after_realize(dev, name, errp); @@ -454,15 +442,14 @@ const PropertyInfo qdev_prop_int64 = { static void release_string(Object *obj, const char *name, void *opaque) { Property *prop = opaque; - g_free(*(char **)qdev_get_prop_ptr(DEVICE(obj), prop)); + g_free(*(char **)qdev_get_prop_ptr(obj, prop)); } static void get_string(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; - char **ptr = qdev_get_prop_ptr(dev, prop); + char **ptr = qdev_get_prop_ptr(obj, prop); if (!*ptr) { char *str = (char *)""; @@ -477,7 +464,7 @@ static void set_string(Object *obj, Visitor *v, const char *name, { DeviceState *dev = DEVICE(obj); Property *prop = opaque; - char **ptr = qdev_get_prop_ptr(dev, prop); + char **ptr = qdev_get_prop_ptr(obj, prop); char *str; if (dev->realized) { @@ -515,9 +502,8 @@ const PropertyInfo qdev_prop_on_off_auto = { void qdev_propinfo_get_size32(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; - uint32_t *ptr = qdev_get_prop_ptr(dev, prop); + uint32_t *ptr = qdev_get_prop_ptr(obj, prop); uint64_t value = *ptr; visit_type_size(v, name, &value, errp); @@ -528,7 +514,7 @@ static void set_size32(Object *obj, Visitor *v, const char *name, void *opaque, { DeviceState *dev = DEVICE(obj); Property *prop = opaque; - uint32_t *ptr = qdev_get_prop_ptr(dev, prop); + uint32_t *ptr = qdev_get_prop_ptr(obj, prop); uint64_t value; if (dev->realized) { @@ -563,9 +549,8 @@ const PropertyInfo qdev_prop_size32 = { static void get_uuid(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; - QemuUUID *uuid = qdev_get_prop_ptr(dev, prop); + QemuUUID *uuid = qdev_get_prop_ptr(obj, prop); char buffer[UUID_FMT_LEN + 1]; char *p = buffer; @@ -581,7 +566,7 @@ static void set_uuid(Object *obj, Visitor *v, const char *name, void *opaque, { DeviceState *dev = DEVICE(obj); Property *prop = opaque; - QemuUUID *uuid = qdev_get_prop_ptr(dev, prop); + QemuUUID *uuid = qdev_get_prop_ptr(obj, prop); char *str; if (dev->realized) { @@ -653,7 +638,7 @@ static void set_prop_arraylen(Object *obj, Visitor *v, const char *name, */ DeviceState *dev = DEVICE(obj); Property *prop = opaque; - uint32_t *alenptr = qdev_get_prop_ptr(dev, prop); + uint32_t *alenptr = qdev_get_prop_ptr(obj, prop); void **arrayptr = (void *)dev + prop->arrayoffset; void *eltptr; const char *arrayname; @@ -699,7 +684,7 @@ static void set_prop_arraylen(Object *obj, Visitor *v, const char *name, * being inside the device struct. */ arrayprop->prop.offset = eltptr - (void *)dev; - assert(qdev_get_prop_ptr(dev, &arrayprop->prop) == eltptr); + assert(qdev_get_prop_ptr(obj, &arrayprop->prop) == eltptr); object_property_add(obj, propname, arrayprop->prop.info->name, arrayprop->prop.info->get, @@ -893,9 +878,8 @@ void qdev_prop_set_globals(DeviceState *dev) static void get_size(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; - uint64_t *ptr = qdev_get_prop_ptr(dev, prop); + uint64_t *ptr = qdev_get_prop_ptr(obj, prop); visit_type_size(v, name, ptr, errp); } @@ -905,7 +889,7 @@ static void set_size(Object *obj, Visitor *v, const char *name, void *opaque, { DeviceState *dev = DEVICE(obj); Property *prop = opaque; - uint64_t *ptr = qdev_get_prop_ptr(dev, prop); + uint64_t *ptr = qdev_get_prop_ptr(obj, prop); if (dev->realized) { qdev_prop_set_after_realize(dev, name, errp); diff --git a/hw/s390x/css.c b/hw/s390x/css.c index 9961cfe7bf..2b8f33fec2 100644 --- a/hw/s390x/css.c +++ b/hw/s390x/css.c @@ -2343,9 +2343,8 @@ void css_reset(void) static void get_css_devid(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; - CssDevId *dev_id = qdev_get_prop_ptr(dev, prop); + CssDevId *dev_id = qdev_get_prop_ptr(obj, prop); char buffer[] = "xx.x.xxxx"; char *p = buffer; int r; @@ -2375,7 +2374,7 @@ static void set_css_devid(Object *obj, Visitor *v, const char *name, { DeviceState *dev = DEVICE(obj); Property *prop = opaque; - CssDevId *dev_id = qdev_get_prop_ptr(dev, prop); + CssDevId *dev_id = qdev_get_prop_ptr(obj, prop); char *str; int num, n1, n2; unsigned int cssid, ssid, devid; diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index 05f7460aec..8b6be1197b 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -1330,7 +1330,7 @@ static void s390_pci_get_fid(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - uint32_t *ptr = qdev_get_prop_ptr(DEVICE(obj), prop); + uint32_t *ptr = qdev_get_prop_ptr(obj, prop); visit_type_uint32(v, name, ptr, errp); } @@ -1341,7 +1341,7 @@ static void s390_pci_set_fid(Object *obj, Visitor *v, const char *name, DeviceState *dev = DEVICE(obj); S390PCIBusDevice *zpci = S390_PCI_DEVICE(obj); Property *prop = opaque; - uint32_t *ptr = qdev_get_prop_ptr(dev, prop); + uint32_t *ptr = qdev_get_prop_ptr(obj, prop); if (dev->realized) { qdev_prop_set_after_realize(dev, name, errp); diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c index 57150913b7..53569925a2 100644 --- a/hw/vfio/pci-quirks.c +++ b/hw/vfio/pci-quirks.c @@ -1488,9 +1488,8 @@ static void get_nv_gpudirect_clique_id(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; - uint8_t *ptr = qdev_get_prop_ptr(dev, prop); + uint8_t *ptr = qdev_get_prop_ptr(obj, prop); visit_type_uint8(v, name, ptr, errp); } @@ -1501,7 +1500,7 @@ static void set_nv_gpudirect_clique_id(Object *obj, Visitor *v, { DeviceState *dev = DEVICE(obj); Property *prop = opaque; - uint8_t value, *ptr = qdev_get_prop_ptr(dev, prop); + uint8_t value, *ptr = qdev_get_prop_ptr(obj, prop); if (dev->realized) { qdev_prop_set_after_realize(dev, name, errp); From patchwork Fri Dec 11 22:05:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1415326 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=L1M3AERi; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Ct5Bw3Zkhz9sVY for ; Sat, 12 Dec 2020 09:32:40 +1100 (AEDT) Received: from localhost ([::1]:51468 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knqxq-0004Vv-Do for incoming@patchwork.ozlabs.org; Fri, 11 Dec 2020 17:32:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59686) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqYX-00025h-As for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:29 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:57153) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqYS-0006QZ-P9 for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724384; 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=se/CSfFnnsEjx4A0VjeSVdWKnhZ06lA5owfIsLbeW28=; b=L1M3AERikAYyYG0ptE2Nb3OkE94ZIlyskla3bN1jZmpxTSst68uy3V2H39l5np+6wumgwS OngFXe+Nd6AkLcavRuADuJszPtojMI8/FJ0ywEaIYbs5G8JvmNUryh33SRYWB0qSMQ/XhG Etg9lKU6kFznAkQslWuKqwQQ4Ho0yp0= 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-515-vEE2xpGdOwaj9ZL2M93S_w-1; Fri, 11 Dec 2020 17:06:20 -0500 X-MC-Unique: vEE2xpGdOwaj9ZL2M93S_w-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 33036801817; Fri, 11 Dec 2020 22:06:19 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id A591D5D9E2; Fri, 11 Dec 2020 22:06:15 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 10/32] qdev: Make qdev_find_global_prop() get Object* argument Date: Fri, 11 Dec 2020 17:05:07 -0500 Message-Id: <20201211220529.2290218-11-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Make the code more generic and not specific to TYPE_DEVICE. Reviewed-by: Marc-André Lureau Signed-off-by: Eduardo Habkost --- Cc: Paolo Bonzini Cc: "Daniel P. Berrangé" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- include/hw/qdev-properties.h | 2 +- hw/core/qdev-properties-system.c | 2 +- hw/core/qdev-properties.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 0b92cfc761..7620095fed 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -305,7 +305,7 @@ void qdev_prop_set_enum(DeviceState *dev, const char *name, int value); void *qdev_get_prop_ptr(Object *obj, Property *prop); void qdev_prop_register_global(GlobalProperty *prop); -const GlobalProperty *qdev_find_global_prop(DeviceState *dev, +const GlobalProperty *qdev_find_global_prop(Object *obj, const char *name); int qdev_prop_check_globals(void); void qdev_prop_set_globals(DeviceState *dev); diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c index 9ac9b95852..57e63c6949 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -36,7 +36,7 @@ static bool check_prop_still_unset(DeviceState *dev, const char *name, const void *old_val, const char *new_val, Error **errp) { - const GlobalProperty *prop = qdev_find_global_prop(dev, name); + const GlobalProperty *prop = qdev_find_global_prop(OBJECT(dev), name); if (!old_val) { return true; diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 0a54a922c8..41482d83d1 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -818,7 +818,7 @@ void qdev_prop_register_global(GlobalProperty *prop) g_ptr_array_add(global_props(), prop); } -const GlobalProperty *qdev_find_global_prop(DeviceState *dev, +const GlobalProperty *qdev_find_global_prop(Object *obj, const char *name) { GPtrArray *props = global_props(); @@ -827,7 +827,7 @@ const GlobalProperty *qdev_find_global_prop(DeviceState *dev, for (i = 0; i < props->len; i++) { p = g_ptr_array_index(props, i); - if (object_dynamic_cast(OBJECT(dev), p->driver) + if (object_dynamic_cast(obj, p->driver) && !strcmp(p->property, name)) { return p; } From patchwork Fri Dec 11 22:05:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1415322 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=BDWQsfar; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Ct5555f9Vz9sVJ for ; Sat, 12 Dec 2020 09:27:37 +1100 (AEDT) Received: from localhost ([::1]:43340 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knqsx-0000pY-OT for incoming@patchwork.ozlabs.org; Fri, 11 Dec 2020 17:27:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59678) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqYW-00024U-Pl for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:28 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:32888) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqYS-0006Pc-Dn for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724383; 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=NNwDZxam41mBFYC0/kSKCZ9uKdCTsOHrGa/hT2A5NEc=; b=BDWQsfar56xG8jlkFFAwnDyfeP5+rrRbTzC5u6FlOc7fCPzHWqZ1AQew3Zmp2rSPN1kjZz 4r6T3jN6eEdbok/Jn9GwatFgwE5IWW37DDM2cjnZBRe3aPNcHm8uRo1Y8nTEPF9nNtNJmy IBntR6G2aJ3U1E84KWUbtDXCm4cMmvg= 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-548-ER2PqIGHNYeSl_kj0GJ5dQ-1; Fri, 11 Dec 2020 17:06:21 -0500 X-MC-Unique: ER2PqIGHNYeSl_kj0GJ5dQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1F473C295; Fri, 11 Dec 2020 22:06:20 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id C900E5D9E2; Fri, 11 Dec 2020 22:06:19 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 11/32] qdev: Make check_prop_still_unset() get Object* argument Date: Fri, 11 Dec 2020 17:05:08 -0500 Message-Id: <20201211220529.2290218-12-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Make the code more generic and not specific to TYPE_DEVICE. Reviewed-by: Marc-André Lureau Signed-off-by: Eduardo Habkost --- Cc: Paolo Bonzini Cc: "Daniel P. Berrangé" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- hw/core/qdev-properties-system.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c index 57e63c6949..58bb129bbe 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -32,11 +32,11 @@ #include "hw/pci/pci.h" #include "util/block-helpers.h" -static bool check_prop_still_unset(DeviceState *dev, const char *name, +static bool check_prop_still_unset(Object *obj, const char *name, const void *old_val, const char *new_val, Error **errp) { - const GlobalProperty *prop = qdev_find_global_prop(OBJECT(dev), name); + const GlobalProperty *prop = qdev_find_global_prop(obj, name); if (!old_val) { return true; @@ -105,7 +105,7 @@ static void set_drive_helper(Object *obj, Visitor *v, const char *name, * TODO Should this really be an error? If no, the old value * needs to be released before we store the new one. */ - if (!check_prop_still_unset(dev, name, *ptr, str, errp)) { + if (!check_prop_still_unset(obj, name, *ptr, str, errp)) { return; } @@ -247,7 +247,7 @@ static void set_chr(Object *obj, Visitor *v, const char *name, void *opaque, * TODO Should this really be an error? If no, the old value * needs to be released before we store the new one. */ - if (!check_prop_still_unset(dev, name, be->chr, str, errp)) { + if (!check_prop_still_unset(obj, name, be->chr, str, errp)) { return; } @@ -429,7 +429,7 @@ static void set_netdev(Object *obj, Visitor *v, const char *name, * TODO Should this really be an error? If no, the old value * needs to be released before we store the new one. */ - if (!check_prop_still_unset(dev, name, ncs[i], str, errp)) { + if (!check_prop_still_unset(obj, name, ncs[i], str, errp)) { goto out; } From patchwork Fri Dec 11 22:05:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1415310 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=gp29x2EC; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Ct4tS2Nrnz9sSf for ; Sat, 12 Dec 2020 09:18:24 +1100 (AEDT) Received: from localhost ([::1]:55112 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knqk2-0001kj-7p for incoming@patchwork.ozlabs.org; Fri, 11 Dec 2020 17:18:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59710) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqYY-00027a-MK for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:30 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:35117) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqYW-0006SE-JR for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724387; 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=XX27a+pKt9cyw75ahkBxQx2IPWE0Zr334zcWJyfbtRA=; b=gp29x2EC+UDyqvduYKIEkrjJYjVhhI0QHmlfvAedTeMSqigdCcsmlolpqPOlHQMxrvgdzC rrpgQrgreKUBbo54ze/j1gmvFzVw8sNwbu5tAVP6xdZyIWVx/J0zCJbZ4f28aFAe6vYUu7 P+HpVf+AeL9/U062PnGg+QcHYMMcl00= 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-128-psjbeefpNbqps8wD62Sagg-1; Fri, 11 Dec 2020 17:06:26 -0500 X-MC-Unique: psjbeefpNbqps8wD62Sagg-1 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 BB29D1005504; Fri, 11 Dec 2020 22:06:24 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4F72E19C78; Fri, 11 Dec 2020 22:06:21 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 12/32] qdev: Make error_set_from_qdev_prop_error() get Object* argument Date: Fri, 11 Dec 2020 17:05:09 -0500 Message-Id: <20201211220529.2290218-13-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Thomas Huth , "Daniel P. Berrange" , David Hildenbrand , John Snow , Cornelia Huck , Markus Armbruster , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Igor Mammedov , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Make the code more generic and not specific to TYPE_DEVICE. Reviewed-by: Marc-André Lureau Reviewed-by: Cornelia Huck #s390 parts Signed-off-by: Eduardo Habkost --- Cc: Paolo Bonzini Cc: "Daniel P. Berrangé" Cc: Eduardo Habkost Cc: Cornelia Huck Cc: Thomas Huth Cc: Richard Henderson Cc: David Hildenbrand Cc: Halil Pasic Cc: Christian Borntraeger Cc: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org --- include/hw/qdev-properties.h | 2 +- hw/core/qdev-properties-system.c | 10 +++++----- hw/core/qdev-properties.c | 10 +++++----- hw/s390x/css.c | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 7620095fed..530286e869 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -309,7 +309,7 @@ const GlobalProperty *qdev_find_global_prop(Object *obj, const char *name); int qdev_prop_check_globals(void); void qdev_prop_set_globals(DeviceState *dev); -void error_set_from_qdev_prop_error(Error **errp, int ret, DeviceState *dev, +void error_set_from_qdev_prop_error(Error **errp, int ret, Object *obj, Property *prop, const char *value); /** diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c index 58bb129bbe..5796ed2619 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -352,7 +352,7 @@ static void set_mac(Object *obj, Visitor *v, const char *name, void *opaque, return; inval: - error_set_from_qdev_prop_error(errp, EINVAL, dev, prop, str); + error_set_from_qdev_prop_error(errp, EINVAL, obj, prop, str); g_free(str); } @@ -440,7 +440,7 @@ static void set_netdev(Object *obj, Visitor *v, const char *name, peers_ptr->queues = queues; out: - error_set_from_qdev_prop_error(errp, err, dev, prop, str); + error_set_from_qdev_prop_error(errp, err, obj, prop, str); g_free(str); } @@ -492,7 +492,7 @@ static void set_audiodev(Object *obj, Visitor *v, const char* name, card->state = state; out: - error_set_from_qdev_prop_error(errp, err, dev, prop, str); + error_set_from_qdev_prop_error(errp, err, obj, prop, str); g_free(str); } @@ -790,7 +790,7 @@ static void set_pci_devfn(Object *obj, Visitor *v, const char *name, return; invalid: - error_set_from_qdev_prop_error(errp, EINVAL, dev, prop, str); + error_set_from_qdev_prop_error(errp, EINVAL, obj, prop, str); g_free(str); } @@ -914,7 +914,7 @@ static void set_pci_host_devaddr(Object *obj, Visitor *v, const char *name, return; inval: - error_set_from_qdev_prop_error(errp, EINVAL, dev, prop, str); + error_set_from_qdev_prop_error(errp, EINVAL, obj, prop, str); g_free(str); } diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 41482d83d1..5e010afdb8 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -581,7 +581,7 @@ static void set_uuid(Object *obj, Visitor *v, const char *name, void *opaque, if (!strcmp(str, UUID_VALUE_AUTO)) { qemu_uuid_generate(uuid); } else if (qemu_uuid_parse(str, uuid) < 0) { - error_set_from_qdev_prop_error(errp, EINVAL, dev, prop, str); + error_set_from_qdev_prop_error(errp, EINVAL, obj, prop, str); } g_free(str); } @@ -735,22 +735,22 @@ static Property *qdev_prop_find(DeviceState *dev, const char *name) return NULL; } -void error_set_from_qdev_prop_error(Error **errp, int ret, DeviceState *dev, +void error_set_from_qdev_prop_error(Error **errp, int ret, Object *obj, Property *prop, const char *value) { switch (ret) { case -EEXIST: error_setg(errp, "Property '%s.%s' can't take value '%s', it's in use", - object_get_typename(OBJECT(dev)), prop->name, value); + object_get_typename(obj), prop->name, value); break; default: case -EINVAL: error_setg(errp, QERR_PROPERTY_VALUE_BAD, - object_get_typename(OBJECT(dev)), prop->name, value); + object_get_typename(obj), prop->name, value); break; case -ENOENT: error_setg(errp, "Property '%s.%s' can't find value '%s'", - object_get_typename(OBJECT(dev)), prop->name, value); + object_get_typename(obj), prop->name, value); break; case 0: break; diff --git a/hw/s390x/css.c b/hw/s390x/css.c index 2b8f33fec2..38fd46b9a9 100644 --- a/hw/s390x/css.c +++ b/hw/s390x/css.c @@ -2390,7 +2390,7 @@ static void set_css_devid(Object *obj, Visitor *v, const char *name, num = sscanf(str, "%2x.%1x%n.%4x%n", &cssid, &ssid, &n1, &devid, &n2); if (num != 3 || (n2 - n1) != 5 || strlen(str) != n2) { - error_set_from_qdev_prop_error(errp, EINVAL, dev, prop, str); + error_set_from_qdev_prop_error(errp, EINVAL, obj, prop, str); goto out; } if ((cssid > MAX_CSSID) || (ssid > MAX_SSID)) { From patchwork Fri Dec 11 22:05:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1415313 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=XwV/U4R5; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Ct4yD1z6Mz9sVJ for ; Sat, 12 Dec 2020 09:21:40 +1100 (AEDT) Received: from localhost ([::1]:59536 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knqnB-0003eX-7U for incoming@patchwork.ozlabs.org; Fri, 11 Dec 2020 17:21:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59810) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqYg-0002Fn-DA for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:38 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:51420) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqYb-0006Tu-Py for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724393; 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=IjXLNzryal4KWXA/thVCt00XPDIwSnxo4OtC/UV3xq4=; b=XwV/U4R5TyHPsc8IdPH+YXCfUEXvq7bT71VD/mtbs6WRQpuFyBMXB6BvwgG7fPxDV/Yzm8 /pcQ4NEsgaZ3YXBfxJmWBw6zDxWj0lKacXDap7XqTM7idO6IzWzfwxHghUL8eGMV/yYLvX 9NSoTNCfEFq3Lp5pP0SSPd05WArX0rw= 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-249-Tq2Q4CmoOI6D7a9BzbvFyA-1; Fri, 11 Dec 2020 17:06:30 -0500 X-MC-Unique: Tq2Q4CmoOI6D7a9BzbvFyA-1 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 F3C598799E0; Fri, 11 Dec 2020 22:06:28 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id CAFF41002391; Fri, 11 Dec 2020 22:06:25 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 13/32] qdev: Make qdev_propinfo_get_uint16() static Date: Fri, 11 Dec 2020 17:05:10 -0500 Message-Id: <20201211220529.2290218-14-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" There are no users of the function outside qdev-properties.c. Make function static and rename it to get_uint16(). Reviewed-by: Marc-André Lureau Signed-off-by: Eduardo Habkost --- Cc: Paolo Bonzini Cc: "Daniel P. Berrangé" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- hw/core/qdev-prop-internal.h | 2 -- hw/core/qdev-properties.c | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/hw/core/qdev-prop-internal.h b/hw/core/qdev-prop-internal.h index 9cf5cc1d51..d7b77844fe 100644 --- a/hw/core/qdev-prop-internal.h +++ b/hw/core/qdev-prop-internal.h @@ -20,8 +20,6 @@ void qdev_propinfo_set_default_value_int(ObjectProperty *op, void qdev_propinfo_set_default_value_uint(ObjectProperty *op, const Property *prop); -void qdev_propinfo_get_uint16(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp); void qdev_propinfo_get_int32(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp); void qdev_propinfo_get_size32(Object *obj, Visitor *v, const char *name, diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 5e010afdb8..765e916c23 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -278,8 +278,8 @@ const PropertyInfo qdev_prop_uint8 = { /* --- 16bit integer --- */ -void qdev_propinfo_get_uint16(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +static void get_uint16(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) { Property *prop = opaque; uint16_t *ptr = qdev_get_prop_ptr(obj, prop); @@ -304,7 +304,7 @@ static void set_uint16(Object *obj, Visitor *v, const char *name, const PropertyInfo qdev_prop_uint16 = { .name = "uint16", - .get = qdev_propinfo_get_uint16, + .get = get_uint16, .set = set_uint16, .set_default_value = qdev_propinfo_set_default_value_uint, }; From patchwork Fri Dec 11 22:05:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1415317 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=PM7wekEw; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Ct5104kqFz9sVY for ; Sat, 12 Dec 2020 09:24:04 +1100 (AEDT) Received: from localhost ([::1]:35108 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knqpW-0005Yh-GC for incoming@patchwork.ozlabs.org; Fri, 11 Dec 2020 17:24:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59946) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqYs-0002IK-4h for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:52 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:57922) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqYf-0006VP-Sz for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724396; 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=c1cowUAPhboaK6MM4IV3XTYMcZw0/4iYoiElx5gir9M=; b=PM7wekEwv/WQTK5h3lyRJ7Mvr0sxsaxx5GqUbD2gi1LsJRMOnlB8WZarCVkmW/8W5GH2ef TSGgeL0MZNeEoPWS7FKkLuJsoyDJkXQTnunZrsUxJnEA3E6dkzf9j1jqS2Vbg3HlOP0qft n9ptN24rltFYNjzEdM96rci2zEWoHN4= 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-549-rUPbKMa0PHWDickY0WZHMw-1; Fri, 11 Dec 2020 17:06:34 -0500 X-MC-Unique: rUPbKMa0PHWDickY0WZHMw-1 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 AC8D2801817; Fri, 11 Dec 2020 22:06:33 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 536705F9C2; Fri, 11 Dec 2020 22:06:30 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 14/32] qdev: Move UUID property to qdev-properties-system.c Date: Fri, 11 Dec 2020 17:05:11 -0500 Message-Id: <20201211220529.2290218-15-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Only softmmu code uses DEFINE_PROP_UUID, and it currently depends on error_set_from_qdev_prop_error(). Move it to qdev-properties-system.c to get out of our way when refactoring the qdev property system. We can eventually move it back to the core property system later, after removing usage of error_set_from_qdev_prop_error(). Signed-off-by: Eduardo Habkost Reviewed-by: Igor Mammedov --- This is a new patch added in series v2 --- Cc: Paolo Bonzini Cc: "Daniel P. Berrangé" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- hw/core/qdev-properties-system.c | 57 ++++++++++++++++++++++++++++++++ hw/core/qdev-properties.c | 57 -------------------------------- 2 files changed, 57 insertions(+), 57 deletions(-) diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c index 5796ed2619..7a9a1d6404 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -21,6 +21,7 @@ #include "qemu/ctype.h" #include "qemu/cutils.h" #include "qemu/units.h" +#include "qemu/uuid.h" #include "qemu/error-report.h" #include "qdev-prop-internal.h" @@ -1106,3 +1107,59 @@ const PropertyInfo qdev_prop_pcie_link_width = { .set = set_prop_pcielinkwidth, .set_default_value = qdev_propinfo_set_default_value_enum, }; + +/* --- UUID --- */ + +static void get_uuid(Object *obj, Visitor *v, const char *name, void *opaque, + Error **errp) +{ + Property *prop = opaque; + QemuUUID *uuid = qdev_get_prop_ptr(obj, prop); + char buffer[UUID_FMT_LEN + 1]; + char *p = buffer; + + qemu_uuid_unparse(uuid, buffer); + + visit_type_str(v, name, &p, errp); +} + +#define UUID_VALUE_AUTO "auto" + +static void set_uuid(Object *obj, Visitor *v, const char *name, void *opaque, + Error **errp) +{ + DeviceState *dev = DEVICE(obj); + Property *prop = opaque; + QemuUUID *uuid = qdev_get_prop_ptr(obj, prop); + char *str; + + if (dev->realized) { + qdev_prop_set_after_realize(dev, name, errp); + return; + } + + if (!visit_type_str(v, name, &str, errp)) { + return; + } + + if (!strcmp(str, UUID_VALUE_AUTO)) { + qemu_uuid_generate(uuid); + } else if (qemu_uuid_parse(str, uuid) < 0) { + error_set_from_qdev_prop_error(errp, EINVAL, obj, prop, str); + } + g_free(str); +} + +static void set_default_uuid_auto(ObjectProperty *op, const Property *prop) +{ + object_property_set_default_str(op, UUID_VALUE_AUTO); +} + +const PropertyInfo qdev_prop_uuid = { + .name = "str", + .description = "UUID (aka GUID) or \"" UUID_VALUE_AUTO + "\" for random value (default)", + .get = get_uuid, + .set = set_uuid, + .set_default_value = set_default_uuid_auto, +}; diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 765e916c23..a2eaa43831 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -6,7 +6,6 @@ #include "qemu/ctype.h" #include "qemu/error-report.h" #include "qapi/visitor.h" -#include "qemu/uuid.h" #include "qemu/units.h" #include "qemu/cutils.h" #include "qdev-prop-internal.h" @@ -544,62 +543,6 @@ const PropertyInfo qdev_prop_size32 = { .set_default_value = qdev_propinfo_set_default_value_uint, }; -/* --- UUID --- */ - -static void get_uuid(Object *obj, Visitor *v, const char *name, void *opaque, - Error **errp) -{ - Property *prop = opaque; - QemuUUID *uuid = qdev_get_prop_ptr(obj, prop); - char buffer[UUID_FMT_LEN + 1]; - char *p = buffer; - - qemu_uuid_unparse(uuid, buffer); - - visit_type_str(v, name, &p, errp); -} - -#define UUID_VALUE_AUTO "auto" - -static void set_uuid(Object *obj, Visitor *v, const char *name, void *opaque, - Error **errp) -{ - DeviceState *dev = DEVICE(obj); - Property *prop = opaque; - QemuUUID *uuid = qdev_get_prop_ptr(obj, prop); - char *str; - - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - - if (!visit_type_str(v, name, &str, errp)) { - return; - } - - if (!strcmp(str, UUID_VALUE_AUTO)) { - qemu_uuid_generate(uuid); - } else if (qemu_uuid_parse(str, uuid) < 0) { - error_set_from_qdev_prop_error(errp, EINVAL, obj, prop, str); - } - g_free(str); -} - -static void set_default_uuid_auto(ObjectProperty *op, const Property *prop) -{ - object_property_set_default_str(op, UUID_VALUE_AUTO); -} - -const PropertyInfo qdev_prop_uuid = { - .name = "str", - .description = "UUID (aka GUID) or \"" UUID_VALUE_AUTO - "\" for random value (default)", - .get = get_uuid, - .set = set_uuid, - .set_default_value = set_default_uuid_auto, -}; - /* --- support for array properties --- */ /* Used as an opaque for the object properties we add for each From patchwork Fri Dec 11 22:05:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1415323 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=UNDcw37G; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Ct55G6nXzz9sVJ for ; Sat, 12 Dec 2020 09:27:46 +1100 (AEDT) Received: from localhost ([::1]:43482 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knqt5-0000su-GW for incoming@patchwork.ozlabs.org; Fri, 11 Dec 2020 17:27:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60042) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqZ2-0002N1-TP for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:00 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:60336) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqYh-0006W4-4b for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724398; 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=SmTnXbbsE7bXPXl8+Sy2td+9ofxvYjafgykmwnstWWk=; b=UNDcw37GeRJXx7pkgT+iLVzeGfLfXhcDvLi/T1ntFcdpxX4HZy5D1hbvDW6KZ3cMbkhs0l uszH3OU0a2U/EjGShSc5m1aLa9q+OJ2Q5nX8601JqsgIsRlZZs5FaU58P5X/zs+lCNCJQ1 yx40/K+xUpv4KFWvOPeKskd+2aFhoMY= 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-70-kKlAl5RhMRqsrQ2HJHeT_Q-1; Fri, 11 Dec 2020 17:06:36 -0500 X-MC-Unique: kKlAl5RhMRqsrQ2HJHeT_Q-1 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 5DDF1858182; Fri, 11 Dec 2020 22:06:35 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 941261002391; Fri, 11 Dec 2020 22:06:34 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 15/32] qdev: Move softmmu properties to qdev-properties-system.h Date: Fri, 11 Dec 2020 17:05:12 -0500 Message-Id: <20201211220529.2290218-16-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Move the property types and property macros implemented in qdev-properties-system.c to a new qdev-properties-system.h header. Signed-off-by: Eduardo Habkost Reviewed-by: Igor Mammedov --- Changes v1 -> v2: * Move UUID property type too, as it was moved to qdev-properties-system.c in the previous patch --- audio/audio.h | 1 + include/hw/block/block.h | 1 + include/hw/qdev-properties-system.h | 84 +++++++++++++++++++++++++++++ include/hw/qdev-properties.h | 75 -------------------------- include/net/net.h | 1 + hw/acpi/vmgenid.c | 1 + hw/arm/pxa2xx.c | 1 + hw/arm/strongarm.c | 1 + hw/block/fdc.c | 1 + hw/block/m25p80.c | 1 + hw/block/nand.c | 1 + hw/block/onenand.c | 1 + hw/block/pflash_cfi01.c | 1 + hw/block/pflash_cfi02.c | 1 + hw/block/vhost-user-blk.c | 1 + hw/char/avr_usart.c | 1 + hw/char/bcm2835_aux.c | 1 + hw/char/cadence_uart.c | 1 + hw/char/cmsdk-apb-uart.c | 1 + hw/char/debugcon.c | 1 + hw/char/digic-uart.c | 1 + hw/char/escc.c | 1 + hw/char/etraxfs_ser.c | 1 + hw/char/exynos4210_uart.c | 1 + hw/char/grlib_apbuart.c | 1 + hw/char/ibex_uart.c | 1 + hw/char/imx_serial.c | 1 + hw/char/ipoctal232.c | 1 + hw/char/lm32_juart.c | 1 + hw/char/lm32_uart.c | 1 + hw/char/mcf_uart.c | 1 + hw/char/milkymist-uart.c | 1 + hw/char/nrf51_uart.c | 1 + hw/char/parallel.c | 1 + hw/char/pl011.c | 1 + hw/char/renesas_sci.c | 1 + hw/char/sclpconsole-lm.c | 1 + hw/char/sclpconsole.c | 1 + hw/char/serial-pci-multi.c | 1 + hw/char/serial.c | 1 + hw/char/spapr_vty.c | 1 + hw/char/stm32f2xx_usart.c | 1 + hw/char/terminal3270.c | 1 + hw/char/virtio-console.c | 1 + hw/char/xilinx_uartlite.c | 1 + hw/core/qdev-properties-system.c | 1 + hw/hyperv/vmbus.c | 1 + hw/i386/kvm/i8254.c | 1 + hw/ide/qdev.c | 1 + hw/ipmi/ipmi_bmc_extern.c | 1 + hw/ipmi/ipmi_bmc_sim.c | 1 + hw/misc/allwinner-sid.c | 1 + hw/misc/ivshmem.c | 1 + hw/misc/mac_via.c | 1 + hw/misc/sifive_u_otp.c | 1 + hw/net/rocker/rocker.c | 1 + hw/nvram/eeprom_at24c.c | 1 + hw/nvram/spapr_nvram.c | 1 + hw/pci-bridge/gen_pcie_root_port.c | 1 + hw/pci/pci.c | 1 + hw/ppc/pnv_pnor.c | 1 + hw/rdma/vmw/pvrdma_main.c | 1 + hw/rtc/mc146818rtc.c | 1 + hw/scsi/scsi-disk.c | 1 + hw/scsi/scsi-generic.c | 1 + hw/scsi/vhost-user-scsi.c | 1 + hw/sd/sd.c | 1 + hw/usb/ccid-card-passthru.c | 1 + hw/usb/dev-serial.c | 1 + hw/usb/redirect.c | 1 + hw/vfio/pci.c | 1 + hw/virtio/vhost-user-fs.c | 1 + hw/virtio/vhost-user-vsock.c | 1 + hw/virtio/virtio-iommu-pci.c | 1 + hw/xen/xen_pt.c | 1 + migration/migration.c | 1 + 76 files changed, 158 insertions(+), 75 deletions(-) create mode 100644 include/hw/qdev-properties-system.h diff --git a/audio/audio.h b/audio/audio.h index b883ebfb1f..21fe3226ae 100644 --- a/audio/audio.h +++ b/audio/audio.h @@ -28,6 +28,7 @@ #include "qemu/queue.h" #include "qapi/qapi-types-audio.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" typedef void (*audio_callback_fn) (void *opaque, int avail); diff --git a/include/hw/block/block.h b/include/hw/block/block.h index 1e8b6253dd..c172cbe65f 100644 --- a/include/hw/block/block.h +++ b/include/hw/block/block.h @@ -13,6 +13,7 @@ #include "exec/hwaddr.h" #include "qapi/qapi-types-block-core.h" +#include "hw/qdev-properties-system.h" /* Configuration */ diff --git a/include/hw/qdev-properties-system.h b/include/hw/qdev-properties-system.h new file mode 100644 index 0000000000..29529dc999 --- /dev/null +++ b/include/hw/qdev-properties-system.h @@ -0,0 +1,84 @@ +#ifndef HW_QDEV_PROPERTIES_SYSTEM_H +#define HW_QDEV_PROPERTIES_SYSTEM_H + +#include "hw/qdev-properties.h" + +extern const PropertyInfo qdev_prop_chr; +extern const PropertyInfo qdev_prop_macaddr; +extern const PropertyInfo qdev_prop_reserved_region; +extern const PropertyInfo qdev_prop_multifd_compression; +extern const PropertyInfo qdev_prop_losttickpolicy; +extern const PropertyInfo qdev_prop_blockdev_on_error; +extern const PropertyInfo qdev_prop_bios_chs_trans; +extern const PropertyInfo qdev_prop_fdc_drive_type; +extern const PropertyInfo qdev_prop_drive; +extern const PropertyInfo qdev_prop_drive_iothread; +extern const PropertyInfo qdev_prop_netdev; +extern const PropertyInfo qdev_prop_pci_devfn; +extern const PropertyInfo qdev_prop_blocksize; +extern const PropertyInfo qdev_prop_pci_host_devaddr; +extern const PropertyInfo qdev_prop_uuid; +extern const PropertyInfo qdev_prop_audiodev; +extern const PropertyInfo qdev_prop_off_auto_pcibar; +extern const PropertyInfo qdev_prop_pcie_link_speed; +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) + +#define DEFINE_PROP_CHR(_n, _s, _f) \ + DEFINE_PROP(_n, _s, _f, qdev_prop_chr, CharBackend) +#define DEFINE_PROP_NETDEV(_n, _s, _f) \ + DEFINE_PROP(_n, _s, _f, qdev_prop_netdev, NICPeers) +#define DEFINE_PROP_DRIVE(_n, _s, _f) \ + DEFINE_PROP(_n, _s, _f, qdev_prop_drive, BlockBackend *) +#define DEFINE_PROP_DRIVE_IOTHREAD(_n, _s, _f) \ + DEFINE_PROP(_n, _s, _f, qdev_prop_drive_iothread, BlockBackend *) +#define DEFINE_PROP_MACADDR(_n, _s, _f) \ + DEFINE_PROP(_n, _s, _f, qdev_prop_macaddr, MACAddr) +#define DEFINE_PROP_RESERVED_REGION(_n, _s, _f) \ + DEFINE_PROP(_n, _s, _f, qdev_prop_reserved_region, ReservedRegion) +#define DEFINE_PROP_MULTIFD_COMPRESSION(_n, _s, _f, _d) \ + DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_multifd_compression, \ + MultiFDCompression) +#define DEFINE_PROP_LOSTTICKPOLICY(_n, _s, _f, _d) \ + DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_losttickpolicy, \ + LostTickPolicy) +#define DEFINE_PROP_BLOCKDEV_ON_ERROR(_n, _s, _f, _d) \ + DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_blockdev_on_error, \ + BlockdevOnError) +#define DEFINE_PROP_BIOS_CHS_TRANS(_n, _s, _f, _d) \ + DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_bios_chs_trans, int) +#define DEFINE_PROP_BLOCKSIZE(_n, _s, _f) \ + DEFINE_PROP_UNSIGNED(_n, _s, _f, 0, qdev_prop_blocksize, uint32_t) +#define DEFINE_PROP_PCI_HOST_DEVADDR(_n, _s, _f) \ + DEFINE_PROP(_n, _s, _f, qdev_prop_pci_host_devaddr, PCIHostDeviceAddress) +#define DEFINE_PROP_OFF_AUTO_PCIBAR(_n, _s, _f, _d) \ + DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_off_auto_pcibar, \ + OffAutoPCIBAR) +#define DEFINE_PROP_PCIE_LINK_SPEED(_n, _s, _f, _d) \ + DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_pcie_link_speed, \ + PCIExpLinkSpeed) +#define DEFINE_PROP_PCIE_LINK_WIDTH(_n, _s, _f, _d) \ + DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_pcie_link_width, \ + PCIExpLinkWidth) + +#define DEFINE_PROP_UUID(_name, _state, _field) { \ + .name = (_name), \ + .info = &qdev_prop_uuid, \ + .offset = offsetof(_state, _field) \ + + type_check(QemuUUID, typeof_field(_state, _field)), \ + .set_default = true, \ + } +#define DEFINE_PROP_AUDIODEV(_n, _s, _f) \ + DEFINE_PROP(_n, _s, _f, qdev_prop_audiodev, QEMUSoundCard) + +#define DEFINE_PROP_UUID_NODEFAULT(_name, _state, _field) { \ + .name = (_name), \ + .info = &qdev_prop_uuid, \ + .offset = offsetof(_state, _field) \ + + type_check(QemuUUID, typeof_field(_state, _field)), \ + } + + +#endif diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 530286e869..d35d4aae84 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -55,30 +55,11 @@ extern const PropertyInfo qdev_prop_uint64; extern const PropertyInfo qdev_prop_int64; 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_macaddr; -extern const PropertyInfo qdev_prop_reserved_region; extern const PropertyInfo qdev_prop_on_off_auto; -extern const PropertyInfo qdev_prop_multifd_compression; -extern const PropertyInfo qdev_prop_losttickpolicy; -extern const PropertyInfo qdev_prop_blockdev_on_error; -extern const PropertyInfo qdev_prop_bios_chs_trans; -extern const PropertyInfo qdev_prop_fdc_drive_type; -extern const PropertyInfo qdev_prop_drive; -extern const PropertyInfo qdev_prop_drive_iothread; -extern const PropertyInfo qdev_prop_netdev; -extern const PropertyInfo qdev_prop_pci_devfn; extern const PropertyInfo qdev_prop_size32; -extern const PropertyInfo qdev_prop_blocksize; -extern const PropertyInfo qdev_prop_pci_host_devaddr; -extern const PropertyInfo qdev_prop_uuid; extern const PropertyInfo qdev_prop_arraylen; -extern const PropertyInfo qdev_prop_audiodev; extern const PropertyInfo qdev_prop_link; -extern const PropertyInfo qdev_prop_off_auto_pcibar; -extern const PropertyInfo qdev_prop_pcie_link_speed; -extern const PropertyInfo qdev_prop_pcie_link_width; #define DEFINE_PROP(_name, _state, _field, _prop, _type) { \ .name = (_name), \ @@ -209,68 +190,12 @@ extern const PropertyInfo qdev_prop_pcie_link_width; DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_int64, int64_t) #define DEFINE_PROP_SIZE(_n, _s, _f, _d) \ DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_size, uint64_t) -#define DEFINE_PROP_PCI_DEVFN(_n, _s, _f, _d) \ - DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_pci_devfn, int32_t) - -#define DEFINE_PROP_CHR(_n, _s, _f) \ - DEFINE_PROP(_n, _s, _f, qdev_prop_chr, CharBackend) #define DEFINE_PROP_STRING(_n, _s, _f) \ DEFINE_PROP(_n, _s, _f, qdev_prop_string, char*) -#define DEFINE_PROP_NETDEV(_n, _s, _f) \ - DEFINE_PROP(_n, _s, _f, qdev_prop_netdev, NICPeers) -#define DEFINE_PROP_DRIVE(_n, _s, _f) \ - DEFINE_PROP(_n, _s, _f, qdev_prop_drive, BlockBackend *) -#define DEFINE_PROP_DRIVE_IOTHREAD(_n, _s, _f) \ - DEFINE_PROP(_n, _s, _f, qdev_prop_drive_iothread, BlockBackend *) -#define DEFINE_PROP_MACADDR(_n, _s, _f) \ - DEFINE_PROP(_n, _s, _f, qdev_prop_macaddr, MACAddr) -#define DEFINE_PROP_RESERVED_REGION(_n, _s, _f) \ - DEFINE_PROP(_n, _s, _f, qdev_prop_reserved_region, ReservedRegion) #define DEFINE_PROP_ON_OFF_AUTO(_n, _s, _f, _d) \ DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_on_off_auto, OnOffAuto) -#define DEFINE_PROP_MULTIFD_COMPRESSION(_n, _s, _f, _d) \ - DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_multifd_compression, \ - MultiFDCompression) -#define DEFINE_PROP_LOSTTICKPOLICY(_n, _s, _f, _d) \ - DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_losttickpolicy, \ - LostTickPolicy) -#define DEFINE_PROP_BLOCKDEV_ON_ERROR(_n, _s, _f, _d) \ - DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_blockdev_on_error, \ - BlockdevOnError) -#define DEFINE_PROP_BIOS_CHS_TRANS(_n, _s, _f, _d) \ - DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_bios_chs_trans, int) #define DEFINE_PROP_SIZE32(_n, _s, _f, _d) \ DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_size32, uint32_t) -#define DEFINE_PROP_BLOCKSIZE(_n, _s, _f) \ - DEFINE_PROP_UNSIGNED(_n, _s, _f, 0, qdev_prop_blocksize, uint32_t) -#define DEFINE_PROP_PCI_HOST_DEVADDR(_n, _s, _f) \ - DEFINE_PROP(_n, _s, _f, qdev_prop_pci_host_devaddr, PCIHostDeviceAddress) -#define DEFINE_PROP_OFF_AUTO_PCIBAR(_n, _s, _f, _d) \ - DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_off_auto_pcibar, \ - OffAutoPCIBAR) -#define DEFINE_PROP_PCIE_LINK_SPEED(_n, _s, _f, _d) \ - DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_pcie_link_speed, \ - PCIExpLinkSpeed) -#define DEFINE_PROP_PCIE_LINK_WIDTH(_n, _s, _f, _d) \ - DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_pcie_link_width, \ - PCIExpLinkWidth) - -#define DEFINE_PROP_UUID(_name, _state, _field) { \ - .name = (_name), \ - .info = &qdev_prop_uuid, \ - .offset = offsetof(_state, _field) \ - + type_check(QemuUUID, typeof_field(_state, _field)), \ - .set_default = true, \ - } -#define DEFINE_PROP_AUDIODEV(_n, _s, _f) \ - DEFINE_PROP(_n, _s, _f, qdev_prop_audiodev, QEMUSoundCard) - -#define DEFINE_PROP_UUID_NODEFAULT(_name, _state, _field) { \ - .name = (_name), \ - .info = &qdev_prop_uuid, \ - .offset = offsetof(_state, _field) \ - + type_check(QemuUUID, typeof_field(_state, _field)), \ - } #define DEFINE_PROP_END_OF_LIST() \ {} diff --git a/include/net/net.h b/include/net/net.h index 778fc787ca..919facaad2 100644 --- a/include/net/net.h +++ b/include/net/net.h @@ -4,6 +4,7 @@ #include "qemu/queue.h" #include "qapi/qapi-types-net.h" #include "net/queue.h" +#include "hw/qdev-properties-system.h" #define MAC_FMT "%02X:%02X:%02X:%02X:%02X:%02X" #define MAC_ARG(x) ((uint8_t *)(x))[0], ((uint8_t *)(x))[1], \ diff --git a/hw/acpi/vmgenid.c b/hw/acpi/vmgenid.c index 2c8152d508..6c92fdae49 100644 --- a/hw/acpi/vmgenid.c +++ b/hw/acpi/vmgenid.c @@ -19,6 +19,7 @@ #include "hw/acpi/vmgenid.h" #include "hw/nvram/fw_cfg.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #include "sysemu/reset.h" diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c index 1a98f3bd5c..fdc4955e95 100644 --- a/hw/arm/pxa2xx.c +++ b/hw/arm/pxa2xx.c @@ -21,6 +21,7 @@ #include "hw/i2c/i2c.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/ssi/ssi.h" #include "hw/sd/sd.h" #include "chardev/char-fe.h" diff --git a/hw/arm/strongarm.c b/hw/arm/strongarm.c index ca7c385f31..c7ca54bcea 100644 --- a/hw/arm/strongarm.c +++ b/hw/arm/strongarm.c @@ -33,6 +33,7 @@ #include "hw/boards.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/sysbus.h" #include "migration/vmstate.h" #include "strongarm.h" diff --git a/hw/block/fdc.c b/hw/block/fdc.c index 4c2c35e223..3636874432 100644 --- a/hw/block/fdc.c +++ b/hw/block/fdc.c @@ -36,6 +36,7 @@ #include "hw/irq.h" #include "hw/isa/isa.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/sysbus.h" #include "migration/vmstate.h" #include "hw/block/block.h" diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c index d09a811767..93bd1821ff 100644 --- a/hw/block/m25p80.c +++ b/hw/block/m25p80.c @@ -25,6 +25,7 @@ #include "qemu/units.h" #include "sysemu/block-backend.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/ssi/ssi.h" #include "migration/vmstate.h" #include "qemu/bitops.h" diff --git a/hw/block/nand.c b/hw/block/nand.c index 1d7a48a2ec..1c098db897 100644 --- a/hw/block/nand.c +++ b/hw/block/nand.c @@ -21,6 +21,7 @@ #include "qemu/osdep.h" #include "hw/hw.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/block/flash.h" #include "sysemu/block-backend.h" #include "migration/vmstate.h" diff --git a/hw/block/onenand.c b/hw/block/onenand.c index 5ff7be86bb..579a73d7f7 100644 --- a/hw/block/onenand.c +++ b/hw/block/onenand.c @@ -24,6 +24,7 @@ #include "hw/block/flash.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "sysemu/block-backend.h" #include "exec/memory.h" #include "hw/sysbus.h" diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c index daae965860..ccf326793d 100644 --- a/hw/block/pflash_cfi01.c +++ b/hw/block/pflash_cfi01.c @@ -40,6 +40,7 @@ #include "hw/block/block.h" #include "hw/block/flash.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "sysemu/block-backend.h" #include "qapi/error.h" #include "qemu/error-report.h" diff --git a/hw/block/pflash_cfi02.c b/hw/block/pflash_cfi02.c index 1b3d94e047..2ad2f6baea 100644 --- a/hw/block/pflash_cfi02.c +++ b/hw/block/pflash_cfi02.c @@ -36,6 +36,7 @@ #include "hw/block/block.h" #include "hw/block/flash.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "qapi/error.h" #include "qemu/error-report.h" #include "qemu/bitmap.h" diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c index 2dd3d93ca0..da4fbf9084 100644 --- a/hw/block/vhost-user-blk.c +++ b/hw/block/vhost-user-blk.c @@ -22,6 +22,7 @@ #include "qemu/cutils.h" #include "hw/qdev-core.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/virtio/vhost.h" #include "hw/virtio/vhost-user-blk.h" #include "hw/virtio/virtio.h" diff --git a/hw/char/avr_usart.c b/hw/char/avr_usart.c index fbe2a112b7..5bcf9db0b7 100644 --- a/hw/char/avr_usart.c +++ b/hw/char/avr_usart.c @@ -24,6 +24,7 @@ #include "qemu/log.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" static int avr_usart_can_receive(void *opaque) { diff --git a/hw/char/bcm2835_aux.c b/hw/char/bcm2835_aux.c index dade2ab5fd..96410b1ff8 100644 --- a/hw/char/bcm2835_aux.c +++ b/hw/char/bcm2835_aux.c @@ -24,6 +24,7 @@ #include "hw/char/bcm2835_aux.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #include "qemu/log.h" #include "qemu/module.h" diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c index e196906c92..c603e14012 100644 --- a/hw/char/cadence_uart.c +++ b/hw/char/cadence_uart.c @@ -32,6 +32,7 @@ #include "hw/char/cadence_uart.h" #include "hw/irq.h" #include "hw/qdev-clock.h" +#include "hw/qdev-properties-system.h" #include "trace.h" #ifdef CADENCE_UART_ERR_DEBUG diff --git a/hw/char/cmsdk-apb-uart.c b/hw/char/cmsdk-apb-uart.c index 626b68f2ec..ba2cbbee3d 100644 --- a/hw/char/cmsdk-apb-uart.c +++ b/hw/char/cmsdk-apb-uart.c @@ -27,6 +27,7 @@ #include "chardev/char-serial.h" #include "hw/char/cmsdk-apb-uart.h" #include "hw/irq.h" +#include "hw/qdev-properties-system.h" REG32(DATA, 0) REG32(STATE, 4) diff --git a/hw/char/debugcon.c b/hw/char/debugcon.c index 2a063ad72c..fdb04fee09 100644 --- a/hw/char/debugcon.c +++ b/hw/char/debugcon.c @@ -30,6 +30,7 @@ #include "chardev/char-fe.h" #include "hw/isa/isa.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "qom/object.h" #define TYPE_ISA_DEBUGCON_DEVICE "isa-debugcon" diff --git a/hw/char/digic-uart.c b/hw/char/digic-uart.c index e130cb4692..00e5df5517 100644 --- a/hw/char/digic-uart.c +++ b/hw/char/digic-uart.c @@ -35,6 +35,7 @@ #include "hw/char/digic-uart.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" enum { ST_RX_RDY = (1 << 0), diff --git a/hw/char/escc.c b/hw/char/escc.c index 7d16ee8688..52e7978287 100644 --- a/hw/char/escc.c +++ b/hw/char/escc.c @@ -25,6 +25,7 @@ #include "qemu/osdep.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/sysbus.h" #include "migration/vmstate.h" #include "qemu/module.h" diff --git a/hw/char/etraxfs_ser.c b/hw/char/etraxfs_ser.c index d9fba2ae6c..6bee3ee18e 100644 --- a/hw/char/etraxfs_ser.c +++ b/hw/char/etraxfs_ser.c @@ -25,6 +25,7 @@ #include "qemu/osdep.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/sysbus.h" #include "chardev/char-fe.h" #include "qemu/log.h" diff --git a/hw/char/exynos4210_uart.c b/hw/char/exynos4210_uart.c index 96afe3580f..6361df2ad3 100644 --- a/hw/char/exynos4210_uart.c +++ b/hw/char/exynos4210_uart.c @@ -32,6 +32,7 @@ #include "hw/arm/exynos4210.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "trace.h" #include "qom/object.h" diff --git a/hw/char/grlib_apbuart.c b/hw/char/grlib_apbuart.c index 3f80f6824e..82ff40a530 100644 --- a/hw/char/grlib_apbuart.c +++ b/hw/char/grlib_apbuart.c @@ -25,6 +25,7 @@ #include "qemu/osdep.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/sparc/grlib.h" #include "hw/sysbus.h" #include "qemu/module.h" diff --git a/hw/char/ibex_uart.c b/hw/char/ibex_uart.c index cc49a35013..89f1182c9b 100644 --- a/hw/char/ibex_uart.c +++ b/hw/char/ibex_uart.c @@ -30,6 +30,7 @@ #include "hw/irq.h" #include "hw/qdev-clock.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #include "qemu/log.h" #include "qemu/module.h" diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c index 731b8fc64c..ee1375e26d 100644 --- a/hw/char/imx_serial.c +++ b/hw/char/imx_serial.c @@ -22,6 +22,7 @@ #include "hw/char/imx_serial.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #include "qemu/log.h" #include "qemu/module.h" diff --git a/hw/char/ipoctal232.c b/hw/char/ipoctal232.c index ad000a39b9..3311e0872c 100644 --- a/hw/char/ipoctal232.c +++ b/hw/char/ipoctal232.c @@ -12,6 +12,7 @@ #include "hw/ipack/ipack.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #include "qemu/bitops.h" #include "qemu/module.h" diff --git a/hw/char/lm32_juart.c b/hw/char/lm32_juart.c index aced357011..ce30279650 100644 --- a/hw/char/lm32_juart.c +++ b/hw/char/lm32_juart.c @@ -26,6 +26,7 @@ #include "hw/char/lm32_juart.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "qom/object.h" enum { diff --git a/hw/char/lm32_uart.c b/hw/char/lm32_uart.c index 2f58e2943b..d8e0331311 100644 --- a/hw/char/lm32_uart.c +++ b/hw/char/lm32_uart.c @@ -25,6 +25,7 @@ #include "qemu/osdep.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/sysbus.h" #include "migration/vmstate.h" #include "trace.h" diff --git a/hw/char/mcf_uart.c b/hw/char/mcf_uart.c index e6814faffb..6fa4ac502c 100644 --- a/hw/char/mcf_uart.c +++ b/hw/char/mcf_uart.c @@ -13,6 +13,7 @@ #include "qapi/error.h" #include "hw/m68k/mcf.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "chardev/char-fe.h" #include "qom/object.h" diff --git a/hw/char/milkymist-uart.c b/hw/char/milkymist-uart.c index a817c51eb5..cb1b3470ad 100644 --- a/hw/char/milkymist-uart.c +++ b/hw/char/milkymist-uart.c @@ -24,6 +24,7 @@ #include "qemu/osdep.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/sysbus.h" #include "migration/vmstate.h" #include "trace.h" diff --git a/hw/char/nrf51_uart.c b/hw/char/nrf51_uart.c index d1fef77acd..045ca5fa40 100644 --- a/hw/char/nrf51_uart.c +++ b/hw/char/nrf51_uart.c @@ -18,6 +18,7 @@ #include "hw/char/nrf51_uart.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #include "trace.h" diff --git a/hw/char/parallel.c b/hw/char/parallel.c index 8b418abf71..b45e67bfbb 100644 --- a/hw/char/parallel.c +++ b/hw/char/parallel.c @@ -32,6 +32,7 @@ #include "hw/irq.h" #include "hw/isa/isa.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #include "hw/char/parallel.h" #include "sysemu/reset.h" diff --git a/hw/char/pl011.c b/hw/char/pl011.c index ede16c781c..ea4a4e5235 100644 --- a/hw/char/pl011.c +++ b/hw/char/pl011.c @@ -23,6 +23,7 @@ #include "hw/irq.h" #include "hw/sysbus.h" #include "hw/qdev-clock.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #include "chardev/char-fe.h" #include "qemu/log.h" diff --git a/hw/char/renesas_sci.c b/hw/char/renesas_sci.c index 5d7c6e6523..1c63467290 100644 --- a/hw/char/renesas_sci.c +++ b/hw/char/renesas_sci.c @@ -26,6 +26,7 @@ #include "hw/irq.h" #include "hw/registerfields.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/char/renesas_sci.h" #include "migration/vmstate.h" diff --git a/hw/char/sclpconsole-lm.c b/hw/char/sclpconsole-lm.c index 81f6d0ed4f..b9e9b2d453 100644 --- a/hw/char/sclpconsole-lm.c +++ b/hw/char/sclpconsole-lm.c @@ -23,6 +23,7 @@ #include "migration/vmstate.h" #include "hw/s390x/event-facility.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/s390x/ebcdic.h" #include "qom/object.h" diff --git a/hw/char/sclpconsole.c b/hw/char/sclpconsole.c index aa72ab40b9..c36b572222 100644 --- a/hw/char/sclpconsole.c +++ b/hw/char/sclpconsole.c @@ -20,6 +20,7 @@ #include "hw/s390x/sclp.h" #include "migration/vmstate.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/s390x/event-facility.h" #include "chardev/char-fe.h" #include "qom/object.h" diff --git a/hw/char/serial-pci-multi.c b/hw/char/serial-pci-multi.c index 2cf3e44177..3a9f96c2d1 100644 --- a/hw/char/serial-pci-multi.c +++ b/hw/char/serial-pci-multi.c @@ -33,6 +33,7 @@ #include "hw/irq.h" #include "hw/pci/pci.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #define PCI_SERIAL_MAX_PORTS 4 diff --git a/hw/char/serial.c b/hw/char/serial.c index 62c627f486..6e52539648 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -36,6 +36,7 @@ #include "qemu/error-report.h" #include "trace.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #define UART_LCR_DLAB 0x80 /* Divisor latch access bit */ diff --git a/hw/char/spapr_vty.c b/hw/char/spapr_vty.c index e726d4d915..79eaa2fa52 100644 --- a/hw/char/spapr_vty.c +++ b/hw/char/spapr_vty.c @@ -8,6 +8,7 @@ #include "hw/ppc/spapr.h" #include "hw/ppc/spapr_vio.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "qom/object.h" #define VTERM_BUFSIZE 16 diff --git a/hw/char/stm32f2xx_usart.c b/hw/char/stm32f2xx_usart.c index 0d661be6d3..8df0832424 100644 --- a/hw/char/stm32f2xx_usart.c +++ b/hw/char/stm32f2xx_usart.c @@ -26,6 +26,7 @@ #include "hw/char/stm32f2xx_usart.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "qemu/log.h" #include "qemu/module.h" diff --git a/hw/char/terminal3270.c b/hw/char/terminal3270.c index d77981bb6d..a9a46c8ed3 100644 --- a/hw/char/terminal3270.c +++ b/hw/char/terminal3270.c @@ -16,6 +16,7 @@ #include "qemu/module.h" #include "chardev/char-fe.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/s390x/3270-ccw.h" #include "qom/object.h" diff --git a/hw/char/virtio-console.c b/hw/char/virtio-console.c index bc752cf90f..6b132caa29 100644 --- a/hw/char/virtio-console.c +++ b/hw/char/virtio-console.c @@ -16,6 +16,7 @@ #include "qemu/module.h" #include "trace.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/virtio/virtio-serial.h" #include "qapi/error.h" #include "qapi/qapi-events-char.h" diff --git a/hw/char/xilinx_uartlite.c b/hw/char/xilinx_uartlite.c index 2e773ec4c4..99b9a6f851 100644 --- a/hw/char/xilinx_uartlite.c +++ b/hw/char/xilinx_uartlite.c @@ -26,6 +26,7 @@ #include "qemu/log.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/sysbus.h" #include "qemu/module.h" #include "chardev/char-fe.h" diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c index 7a9a1d6404..e2d523b27a 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -12,6 +12,7 @@ #include "qemu/osdep.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "qapi/error.h" #include "qapi/visitor.h" #include "qapi/qapi-types-block.h" diff --git a/hw/hyperv/vmbus.c b/hw/hyperv/vmbus.c index 896e981f85..984caf898d 100644 --- a/hw/hyperv/vmbus.c +++ b/hw/hyperv/vmbus.c @@ -13,6 +13,7 @@ #include "qapi/error.h" #include "migration/vmstate.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/hyperv/hyperv.h" #include "hw/hyperv/vmbus.h" #include "hw/hyperv/vmbus-bridge.h" diff --git a/hw/i386/kvm/i8254.c b/hw/i386/kvm/i8254.c index 40d84734e7..c73254e886 100644 --- a/hw/i386/kvm/i8254.c +++ b/hw/i386/kvm/i8254.c @@ -32,6 +32,7 @@ #include "sysemu/runstate.h" #include "hw/timer/i8254.h" #include "hw/timer/i8254_internal.h" +#include "hw/qdev-properties-system.h" #include "sysemu/kvm.h" #include "qom/object.h" diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index 1086b7a327..8cd19fa5e9 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -26,6 +26,7 @@ #include "qemu/module.h" #include "hw/ide/internal.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "sysemu/block-backend.h" #include "sysemu/blockdev.h" #include "hw/block/block.h" diff --git a/hw/ipmi/ipmi_bmc_extern.c b/hw/ipmi/ipmi_bmc_extern.c index c3f3306e66..e141a5cd45 100644 --- a/hw/ipmi/ipmi_bmc_extern.c +++ b/hw/ipmi/ipmi_bmc_extern.c @@ -35,6 +35,7 @@ #include "chardev/char-fe.h" #include "hw/ipmi/ipmi.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #include "qom/object.h" diff --git a/hw/ipmi/ipmi_bmc_sim.c b/hw/ipmi/ipmi_bmc_sim.c index f78e92d3d5..55fb81fa5a 100644 --- a/hw/ipmi/ipmi_bmc_sim.c +++ b/hw/ipmi/ipmi_bmc_sim.c @@ -30,6 +30,7 @@ #include "qemu/module.h" #include "hw/loader.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #define IPMI_NETFN_CHASSIS 0x00 diff --git a/hw/misc/allwinner-sid.c b/hw/misc/allwinner-sid.c index 196380c33a..6d61f55b1d 100644 --- a/hw/misc/allwinner-sid.c +++ b/hw/misc/allwinner-sid.c @@ -26,6 +26,7 @@ #include "qemu/guest-random.h" #include "qapi/error.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/misc/allwinner-sid.h" #include "trace.h" diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index e321e5cb69..0505b52c98 100644 --- a/hw/misc/ivshmem.c +++ b/hw/misc/ivshmem.c @@ -23,6 +23,7 @@ #include "qemu/cutils.h" #include "hw/pci/pci.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/pci/msi.h" #include "hw/pci/msix.h" #include "sysemu/kvm.h" diff --git a/hw/misc/mac_via.c b/hw/misc/mac_via.c index 6db62dab7d..488d086a17 100644 --- a/hw/misc/mac_via.c +++ b/hw/misc/mac_via.c @@ -28,6 +28,7 @@ #include "qapi/error.h" #include "qemu/cutils.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "sysemu/block-backend.h" #include "trace.h" #include "qemu/log.h" diff --git a/hw/misc/sifive_u_otp.c b/hw/misc/sifive_u_otp.c index 60066375ab..4401787a5c 100644 --- a/hw/misc/sifive_u_otp.c +++ b/hw/misc/sifive_u_otp.c @@ -21,6 +21,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/sysbus.h" #include "qemu/log.h" #include "qemu/module.h" diff --git a/hw/net/rocker/rocker.c b/hw/net/rocker/rocker.c index 1af1e6fa2f..0fb8db1dee 100644 --- a/hw/net/rocker/rocker.c +++ b/hw/net/rocker/rocker.c @@ -18,6 +18,7 @@ #include "qemu/osdep.h" #include "hw/pci/pci.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #include "hw/pci/msix.h" #include "net/net.h" diff --git a/hw/nvram/eeprom_at24c.c b/hw/nvram/eeprom_at24c.c index 3e93dbbffb..af6f5dbb99 100644 --- a/hw/nvram/eeprom_at24c.c +++ b/hw/nvram/eeprom_at24c.c @@ -13,6 +13,7 @@ #include "qemu/module.h" #include "hw/i2c/i2c.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "sysemu/block-backend.h" #include "qom/object.h" diff --git a/hw/nvram/spapr_nvram.c b/hw/nvram/spapr_nvram.c index fc53a42572..9e51bc82ae 100644 --- a/hw/nvram/spapr_nvram.c +++ b/hw/nvram/spapr_nvram.c @@ -39,6 +39,7 @@ #include "hw/ppc/spapr.h" #include "hw/ppc/spapr_vio.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "qom/object.h" struct SpaprNvram { diff --git a/hw/pci-bridge/gen_pcie_root_port.c b/hw/pci-bridge/gen_pcie_root_port.c index 8931afc049..ec9907917e 100644 --- a/hw/pci-bridge/gen_pcie_root_port.c +++ b/hw/pci-bridge/gen_pcie_root_port.c @@ -16,6 +16,7 @@ #include "hw/pci/msix.h" #include "hw/pci/pcie_port.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #include "qom/object.h" diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 9424231542..b09208f562 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -31,6 +31,7 @@ #include "hw/pci/pci_bus.h" #include "hw/pci/pci_host.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/qemu-file-types.h" #include "migration/vmstate.h" #include "monitor/monitor.h" diff --git a/hw/ppc/pnv_pnor.c b/hw/ppc/pnv_pnor.c index c365ee58b8..ef8dff03e0 100644 --- a/hw/ppc/pnv_pnor.c +++ b/hw/ppc/pnv_pnor.c @@ -17,6 +17,7 @@ #include "hw/loader.h" #include "hw/ppc/pnv_pnor.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" static uint64_t pnv_pnor_read(void *opaque, hwaddr addr, unsigned size) { diff --git a/hw/rdma/vmw/pvrdma_main.c b/hw/rdma/vmw/pvrdma_main.c index 77b1235a3f..8593570332 100644 --- a/hw/rdma/vmw/pvrdma_main.c +++ b/hw/rdma/vmw/pvrdma_main.c @@ -21,6 +21,7 @@ #include "hw/pci/msi.h" #include "hw/pci/msix.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "cpu.h" #include "trace.h" #include "monitor/monitor.h" diff --git a/hw/rtc/mc146818rtc.c b/hw/rtc/mc146818rtc.c index 7a38540cb9..5d0fcacd0c 100644 --- a/hw/rtc/mc146818rtc.c +++ b/hw/rtc/mc146818rtc.c @@ -30,6 +30,7 @@ #include "hw/acpi/aml-build.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "qemu/timer.h" #include "sysemu/sysemu.h" #include "sysemu/replay.h" diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 90841ad791..29504ea081 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -34,6 +34,7 @@ #include "sysemu/blockdev.h" #include "hw/block/block.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "sysemu/dma.h" #include "sysemu/sysemu.h" #include "qemu/cutils.h" diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c index 2cb23ca891..9740f7e36a 100644 --- a/hw/scsi/scsi-generic.c +++ b/hw/scsi/scsi-generic.c @@ -19,6 +19,7 @@ #include "hw/scsi/scsi.h" #include "migration/qemu-file-types.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/scsi/emulation.h" #include "sysemu/block-backend.h" #include "trace.h" diff --git a/hw/scsi/vhost-user-scsi.c b/hw/scsi/vhost-user-scsi.c index 7c0631656c..4666019442 100644 --- a/hw/scsi/vhost-user-scsi.c +++ b/hw/scsi/vhost-user-scsi.c @@ -21,6 +21,7 @@ #include "hw/fw-path-provider.h" #include "hw/qdev-core.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/virtio/vhost.h" #include "hw/virtio/vhost-backend.h" #include "hw/virtio/vhost-user-scsi.h" diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 1842c03797..2aeab39c3f 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -42,6 +42,7 @@ #include "qapi/error.h" #include "qemu/bitmap.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "qemu/error-report.h" #include "qemu/timer.h" #include "qemu/log.h" diff --git a/hw/usb/ccid-card-passthru.c b/hw/usb/ccid-card-passthru.c index e8e9d37e88..c27c602697 100644 --- a/hw/usb/ccid-card-passthru.c +++ b/hw/usb/ccid-card-passthru.c @@ -14,6 +14,7 @@ #include #include "chardev/char-fe.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #include "qemu/error-report.h" #include "qemu/module.h" diff --git a/hw/usb/dev-serial.c b/hw/usb/dev-serial.c index 19e1933f04..b58c4eb908 100644 --- a/hw/usb/dev-serial.c +++ b/hw/usb/dev-serial.c @@ -14,6 +14,7 @@ #include "qemu/error-report.h" #include "qemu/module.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/usb.h" #include "migration/vmstate.h" #include "desc.h" diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c index 3238de6bb8..0b7e0e15f4 100644 --- a/hw/usb/redirect.c +++ b/hw/usb/redirect.c @@ -42,6 +42,7 @@ #include #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/usb.h" #include "migration/qemu-file-types.h" #include "migration/vmstate.h" diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 51dc373695..f74be78209 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -27,6 +27,7 @@ #include "hw/pci/msix.h" #include "hw/pci/pci_bridge.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "migration/vmstate.h" #include "qemu/error-report.h" #include "qemu/main-loop.h" diff --git a/hw/virtio/vhost-user-fs.c b/hw/virtio/vhost-user-fs.c index 1bc5d03a00..ed036ad9c1 100644 --- a/hw/virtio/vhost-user-fs.c +++ b/hw/virtio/vhost-user-fs.c @@ -16,6 +16,7 @@ #include "standard-headers/linux/virtio_fs.h" #include "qapi/error.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/virtio/virtio-bus.h" #include "hw/virtio/virtio-access.h" #include "qemu/error-report.h" diff --git a/hw/virtio/vhost-user-vsock.c b/hw/virtio/vhost-user-vsock.c index 3534a39d62..a6f08c26b9 100644 --- a/hw/virtio/vhost-user-vsock.c +++ b/hw/virtio/vhost-user-vsock.c @@ -13,6 +13,7 @@ #include "qapi/error.h" #include "qemu/error-report.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/virtio/vhost-user-vsock.h" static const int user_feature_bits[] = { diff --git a/hw/virtio/virtio-iommu-pci.c b/hw/virtio/virtio-iommu-pci.c index 378f63b210..770c286be7 100644 --- a/hw/virtio/virtio-iommu-pci.c +++ b/hw/virtio/virtio-iommu-pci.c @@ -14,6 +14,7 @@ #include "virtio-pci.h" #include "hw/virtio/virtio-iommu.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "qapi/error.h" #include "hw/boards.h" #include "qom/object.h" diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c index 6d359ee486..3cbd08b10e 100644 --- a/hw/xen/xen_pt.c +++ b/hw/xen/xen_pt.c @@ -58,6 +58,7 @@ #include "hw/pci/pci.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "hw/xen/xen.h" #include "hw/i386/pc.h" #include "hw/xen/xen-legacy-backend.h" diff --git a/migration/migration.c b/migration/migration.c index e0dbde4091..cfbf46b77d 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -52,6 +52,7 @@ #include "migration/colo.h" #include "hw/boards.h" #include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" #include "monitor/monitor.h" #include "net/announce.h" #include "qemu/queue.h" From patchwork Fri Dec 11 22:05:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1415325 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ZCQR6iYF; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Ct59S3R7Sz9sVJ for ; Sat, 12 Dec 2020 09:31:24 +1100 (AEDT) Received: from localhost ([::1]:48964 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knqwc-0003IM-9o for incoming@patchwork.ozlabs.org; Fri, 11 Dec 2020 17:31:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59986) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqYx-0002Jd-Tw for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:57 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:24366) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqYi-0006WL-AD for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724399; 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=42qmy84WjZoUzL6hvj8BR/4hg53C3KSeiLhnNSHXnjQ=; b=ZCQR6iYFlSZhhOa2c0vxdNqv9dW/GuBE5+kLRNHzcd2Izp+qqKFXjJnF5Dfnq2UX6m4m1I vE1O9MYhPAa2gelPR7rCHyoqFWqH8UwpZ7Z6+dj6gJfxyeSMqLdKsL0EOfSTyCt3SpqgYX h0GlK8A0gxE2DqFdJmgmYxRYIgSoK3Q= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-287-8GB1pLf6OAi4hbqvvXw2xg-1; Fri, 11 Dec 2020 17:06:37 -0500 X-MC-Unique: 8GB1pLf6OAi4hbqvvXw2xg-1 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 AEE5D800D53; Fri, 11 Dec 2020 22:06:36 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 441CC1992D; Fri, 11 Dec 2020 22:06:36 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 16/32] qdev: Reuse DEFINE_PROP in all DEFINE_PROP_* macros Date: Fri, 11 Dec 2020 17:05:13 -0500 Message-Id: <20201211220529.2290218-17-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Instead of duplicating the code that sets name, info, offset, and does type checking, make DEFINE_PROP accept a variable number of arguments and reuse it in all DEFINE_PROP_* macros. Signed-off-by: Eduardo Habkost Reviewed-by: Igor Mammedov --- Changes v1 -> v2: * Redone after UUID property was moved --- Cc: Paolo Bonzini Cc: "Daniel P. Berrangé" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- include/hw/qdev-properties-system.h | 19 ++--- include/hw/qdev-properties.h | 114 ++++++++++------------------ 2 files changed, 46 insertions(+), 87 deletions(-) diff --git a/include/hw/qdev-properties-system.h b/include/hw/qdev-properties-system.h index 29529dc999..0ac327ae60 100644 --- a/include/hw/qdev-properties-system.h +++ b/include/hw/qdev-properties-system.h @@ -63,22 +63,15 @@ extern const PropertyInfo qdev_prop_pcie_link_width; DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_pcie_link_width, \ PCIExpLinkWidth) -#define DEFINE_PROP_UUID(_name, _state, _field) { \ - .name = (_name), \ - .info = &qdev_prop_uuid, \ - .offset = offsetof(_state, _field) \ - + type_check(QemuUUID, typeof_field(_state, _field)), \ - .set_default = true, \ - } +#define DEFINE_PROP_UUID(_name, _state, _field) \ + DEFINE_PROP(_name, _state, _field, qdev_prop_uuid, QemuUUID, \ + .set_default = true) + #define DEFINE_PROP_AUDIODEV(_n, _s, _f) \ DEFINE_PROP(_n, _s, _f, qdev_prop_audiodev, QEMUSoundCard) -#define DEFINE_PROP_UUID_NODEFAULT(_name, _state, _field) { \ - .name = (_name), \ - .info = &qdev_prop_uuid, \ - .offset = offsetof(_state, _field) \ - + type_check(QemuUUID, typeof_field(_state, _field)), \ - } +#define DEFINE_PROP_UUID_NODEFAULT(_name, _state, _field) \ + DEFINE_PROP(_name, _state, _field, qdev_prop_uuid, QemuUUID) #endif diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index d35d4aae84..1b58e4f922 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -61,73 +61,46 @@ extern const PropertyInfo qdev_prop_size32; extern const PropertyInfo qdev_prop_arraylen; extern const PropertyInfo qdev_prop_link; -#define DEFINE_PROP(_name, _state, _field, _prop, _type) { \ +#define DEFINE_PROP(_name, _state, _field, _prop, _type, ...) { \ .name = (_name), \ .info = &(_prop), \ .offset = offsetof(_state, _field) \ + type_check(_type, typeof_field(_state, _field)), \ + __VA_ARGS__ \ } -#define DEFINE_PROP_SIGNED(_name, _state, _field, _defval, _prop, _type) { \ - .name = (_name), \ - .info = &(_prop), \ - .offset = offsetof(_state, _field) \ - + type_check(_type,typeof_field(_state, _field)), \ - .set_default = true, \ - .defval.i = (_type)_defval, \ - } +#define DEFINE_PROP_SIGNED(_name, _state, _field, _defval, _prop, _type) \ + DEFINE_PROP(_name, _state, _field, _prop, _type, \ + .set_default = true, \ + .defval.i = (_type)_defval) -#define DEFINE_PROP_SIGNED_NODEFAULT(_name, _state, _field, _prop, _type) { \ - .name = (_name), \ - .info = &(_prop), \ - .offset = offsetof(_state, _field) \ - + type_check(_type, typeof_field(_state, _field)), \ - } +#define DEFINE_PROP_SIGNED_NODEFAULT(_name, _state, _field, _prop, _type) \ + DEFINE_PROP(_name, _state, _field, _prop, _type) -#define DEFINE_PROP_BIT(_name, _state, _field, _bit, _defval) { \ - .name = (_name), \ - .info = &(qdev_prop_bit), \ - .bitnr = (_bit), \ - .offset = offsetof(_state, _field) \ - + type_check(uint32_t,typeof_field(_state, _field)), \ - .set_default = true, \ - .defval.u = (bool)_defval, \ - } +#define DEFINE_PROP_BIT(_name, _state, _field, _bit, _defval) \ + DEFINE_PROP(_name, _state, _field, qdev_prop_bit, uint32_t, \ + .bitnr = (_bit), \ + .set_default = true, \ + .defval.u = (bool)_defval) -#define DEFINE_PROP_UNSIGNED(_name, _state, _field, _defval, _prop, _type) { \ - .name = (_name), \ - .info = &(_prop), \ - .offset = offsetof(_state, _field) \ - + type_check(_type, typeof_field(_state, _field)), \ - .set_default = true, \ - .defval.u = (_type)_defval, \ - } +#define DEFINE_PROP_UNSIGNED(_name, _state, _field, _defval, _prop, _type) \ + DEFINE_PROP(_name, _state, _field, _prop, _type, \ + .set_default = true, \ + .defval.u = (_type)_defval) -#define DEFINE_PROP_UNSIGNED_NODEFAULT(_name, _state, _field, _prop, _type) { \ - .name = (_name), \ - .info = &(_prop), \ - .offset = offsetof(_state, _field) \ - + type_check(_type, typeof_field(_state, _field)), \ - } +#define DEFINE_PROP_UNSIGNED_NODEFAULT(_name, _state, _field, _prop, _type) \ + DEFINE_PROP(_name, _state, _field, _prop, _type) -#define DEFINE_PROP_BIT64(_name, _state, _field, _bit, _defval) { \ - .name = (_name), \ - .info = &(qdev_prop_bit64), \ - .bitnr = (_bit), \ - .offset = offsetof(_state, _field) \ - + type_check(uint64_t, typeof_field(_state, _field)), \ - .set_default = true, \ - .defval.u = (bool)_defval, \ - } +#define DEFINE_PROP_BIT64(_name, _state, _field, _bit, _defval) \ + DEFINE_PROP(_name, _state, _field, qdev_prop_bit64, uint64_t, \ + .bitnr = (_bit), \ + .set_default = true, \ + .defval.u = (bool)_defval) -#define DEFINE_PROP_BOOL(_name, _state, _field, _defval) { \ - .name = (_name), \ - .info = &(qdev_prop_bool), \ - .offset = offsetof(_state, _field) \ - + type_check(bool, typeof_field(_state, _field)), \ - .set_default = true, \ - .defval.u = (bool)_defval, \ - } +#define DEFINE_PROP_BOOL(_name, _state, _field, _defval) \ + DEFINE_PROP(_name, _state, _field, qdev_prop_bool, bool, \ + .set_default = true, \ + .defval.u = (bool)_defval) #define PROP_ARRAY_LEN_PREFIX "len-" @@ -155,26 +128,19 @@ extern const PropertyInfo qdev_prop_link; * It is the responsibility of the device deinit code to free the * @_arrayfield memory. */ -#define DEFINE_PROP_ARRAY(_name, _state, _field, \ - _arrayfield, _arrayprop, _arraytype) { \ - .name = (PROP_ARRAY_LEN_PREFIX _name), \ - .info = &(qdev_prop_arraylen), \ - .set_default = true, \ - .defval.u = 0, \ - .offset = offsetof(_state, _field) \ - + type_check(uint32_t, typeof_field(_state, _field)), \ - .arrayinfo = &(_arrayprop), \ - .arrayfieldsize = sizeof(_arraytype), \ - .arrayoffset = offsetof(_state, _arrayfield), \ - } +#define DEFINE_PROP_ARRAY(_name, _state, _field, \ + _arrayfield, _arrayprop, _arraytype) \ + DEFINE_PROP((PROP_ARRAY_LEN_PREFIX _name), \ + _state, _field, qdev_prop_arraylen, uint32_t, \ + .set_default = true, \ + .defval.u = 0, \ + .arrayinfo = &(_arrayprop), \ + .arrayfieldsize = sizeof(_arraytype), \ + .arrayoffset = offsetof(_state, _arrayfield)) -#define DEFINE_PROP_LINK(_name, _state, _field, _type, _ptr_type) { \ - .name = (_name), \ - .info = &(qdev_prop_link), \ - .offset = offsetof(_state, _field) \ - + type_check(_ptr_type, typeof_field(_state, _field)), \ - .link_type = _type, \ - } +#define DEFINE_PROP_LINK(_name, _state, _field, _type, _ptr_type) \ + DEFINE_PROP(_name, _state, _field, qdev_prop_link, _ptr_type, \ + .link_type = _type) #define DEFINE_PROP_UINT8(_n, _s, _f, _d) \ DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_uint8, uint8_t) From patchwork Fri Dec 11 22:05:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1415319 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=AbdSTF+K; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Ct53P2xK3z9sVJ for ; Sat, 12 Dec 2020 09:26:09 +1100 (AEDT) Received: from localhost ([::1]:40208 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knqrX-0007t8-Bo for incoming@patchwork.ozlabs.org; Fri, 11 Dec 2020 17:26:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59990) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqYy-0002Jf-0N for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:57 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:43617) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqYo-0006YY-6j for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:06:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724404; 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=v0OYcJD8ULew1lFLtVeyVk5+wXUJ4NVXpBHlG34GMlI=; b=AbdSTF+KFgK+U9cTvcEYCiAyETChv2dI1VcsjQJSTe+bc35a51gJFBDngASZXibr1bxAIp 08L3fRO92D4bhq16z2QthuGbAOnOWl/CA6bjzQqPkVKsG91+8rh45ZZnltyz7dgGv4wlJW RLyaGoaukhtHhgWJAEwrtHcnae7cRL0= 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-155-h8JmbpGrP_WjR9rrTIy3-g-1; Fri, 11 Dec 2020 17:06:40 -0500 X-MC-Unique: h8JmbpGrP_WjR9rrTIy3-g-1 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 2F3DCC292; Fri, 11 Dec 2020 22:06:39 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id C899119C78; Fri, 11 Dec 2020 22:06:38 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 17/32] sparc: Use DEFINE_PROP for nwindows property Date: Fri, 11 Dec 2020 17:05:14 -0500 Message-Id: <20201211220529.2290218-18-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Mark Cave-Ayland , Markus Armbruster , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Artyom Tarasenko , Stefan Berger Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Use the DEFINE_PROP macro (which will set extra fields in the struct) instead of initializing a Property struct manually. Signed-off-by: Eduardo Habkost Acked-by: Mark Cave-Ayland Reviewed-by: Igor Mammedov --- This is a new patch added in v2 of the series --- Cc: Mark Cave-Ayland Cc: Artyom Tarasenko Cc: qemu-devel@nongnu.org --- target/sparc/cpu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index 6a3299041f..92534bcd18 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -848,7 +848,8 @@ static Property sparc_cpu_properties[] = { qdev_prop_uint64, target_ulong), DEFINE_PROP_UINT32("fpu-version", SPARCCPU, env.def.fpu_version, 0), DEFINE_PROP_UINT32("mmu-version", SPARCCPU, env.def.mmu_version, 0), - { .name = "nwindows", .info = &qdev_prop_nwindows }, + DEFINE_PROP("nwindows", SPARCCPU, env.def.nwindows, + qdev_prop_nwindows, uint32_t), DEFINE_PROP_END_OF_LIST() }; From patchwork Fri Dec 11 22:05:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1415316 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=XvSADjZL; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Ct50z3VCzz9sVJ for ; Sat, 12 Dec 2020 09:24:03 +1100 (AEDT) Received: from localhost ([::1]:35646 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knqpV-0005m8-CC for incoming@patchwork.ozlabs.org; Fri, 11 Dec 2020 17:24:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60064) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqZ2-0002Nd-PE for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:00 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:28479) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqYv-0006Yg-7V for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724406; 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=7mauuiBzwc4imnwBuzDLwKVVcVa+v3UBaGy4quUlinA=; b=XvSADjZLoOASdLGxTBuI4veiXnwhrKm4x2hPJcfEp3eUMWPSc4rhmdwB7HBdKwLsAUYI6E w0kylAt/rE5iUO5ZdF0xHdHUjVfP7Zpt9Fj4VW0QH2lXKpt6jxelRMWok3o9uVT0onn00L bDEt3GTjH5ubdSDU5tJsSJnd83h6dUw= 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-523-MJbOsA0LPw2-P_GgyAd-dw-1; Fri, 11 Dec 2020 17:06:45 -0500 X-MC-Unique: MJbOsA0LPw2-P_GgyAd-dw-1 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 A3CFB19251A3; Fri, 11 Dec 2020 22:06:43 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 453EF100AE31; Fri, 11 Dec 2020 22:06:40 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 18/32] qdev: Get just property name at error_set_from_qdev_prop_error() Date: Fri, 11 Dec 2020 17:05:15 -0500 Message-Id: <20201211220529.2290218-19-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Thomas Huth , "Daniel P. Berrange" , David Hildenbrand , John Snow , Cornelia Huck , Markus Armbruster , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Igor Mammedov , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Replace `Property *prop` parameter with `char *name`, to reduce dependency of getter and setter functions on the Property struct (which will be changed in following patches). Signed-off-by: Eduardo Habkost Reviewed-by: Cornelia Huck Reviewed-by: Igor Mammedov --- This is a new patch added in series v2 --- Cc: Paolo Bonzini Cc: "Daniel P. Berrangé" Cc: Eduardo Habkost Cc: Cornelia Huck Cc: Halil Pasic Cc: Christian Borntraeger Cc: Thomas Huth Cc: Richard Henderson Cc: David Hildenbrand Cc: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org --- include/hw/qdev-properties.h | 2 +- hw/core/qdev-properties-system.c | 12 ++++++------ hw/core/qdev-properties.c | 8 ++++---- hw/s390x/css.c | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 1b58e4f922..476737b9da 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -201,7 +201,7 @@ const GlobalProperty *qdev_find_global_prop(Object *obj, int qdev_prop_check_globals(void); void qdev_prop_set_globals(DeviceState *dev); void error_set_from_qdev_prop_error(Error **errp, int ret, Object *obj, - Property *prop, const char *value); + const char *name, const char *value); /** * qdev_property_add_static: diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c index e2d523b27a..9cf9bcb39d 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -354,7 +354,7 @@ static void set_mac(Object *obj, Visitor *v, const char *name, void *opaque, return; inval: - error_set_from_qdev_prop_error(errp, EINVAL, obj, prop, str); + error_set_from_qdev_prop_error(errp, EINVAL, obj, name, str); g_free(str); } @@ -442,7 +442,7 @@ static void set_netdev(Object *obj, Visitor *v, const char *name, peers_ptr->queues = queues; out: - error_set_from_qdev_prop_error(errp, err, obj, prop, str); + error_set_from_qdev_prop_error(errp, err, obj, name, str); g_free(str); } @@ -494,7 +494,7 @@ static void set_audiodev(Object *obj, Visitor *v, const char* name, card->state = state; out: - error_set_from_qdev_prop_error(errp, err, obj, prop, str); + error_set_from_qdev_prop_error(errp, err, obj, name, str); g_free(str); } @@ -792,7 +792,7 @@ static void set_pci_devfn(Object *obj, Visitor *v, const char *name, return; invalid: - error_set_from_qdev_prop_error(errp, EINVAL, obj, prop, str); + error_set_from_qdev_prop_error(errp, EINVAL, obj, name, str); g_free(str); } @@ -916,7 +916,7 @@ static void set_pci_host_devaddr(Object *obj, Visitor *v, const char *name, return; inval: - error_set_from_qdev_prop_error(errp, EINVAL, obj, prop, str); + error_set_from_qdev_prop_error(errp, EINVAL, obj, name, str); g_free(str); } @@ -1146,7 +1146,7 @@ static void set_uuid(Object *obj, Visitor *v, const char *name, void *opaque, if (!strcmp(str, UUID_VALUE_AUTO)) { qemu_uuid_generate(uuid); } else if (qemu_uuid_parse(str, uuid) < 0) { - error_set_from_qdev_prop_error(errp, EINVAL, obj, prop, str); + error_set_from_qdev_prop_error(errp, EINVAL, obj, name, str); } g_free(str); } diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index a2eaa43831..7495798a66 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -679,21 +679,21 @@ static Property *qdev_prop_find(DeviceState *dev, const char *name) } void error_set_from_qdev_prop_error(Error **errp, int ret, Object *obj, - Property *prop, const char *value) + const char *name, const char *value) { switch (ret) { case -EEXIST: error_setg(errp, "Property '%s.%s' can't take value '%s', it's in use", - object_get_typename(obj), prop->name, value); + object_get_typename(obj), name, value); break; default: case -EINVAL: error_setg(errp, QERR_PROPERTY_VALUE_BAD, - object_get_typename(obj), prop->name, value); + object_get_typename(obj), name, value); break; case -ENOENT: error_setg(errp, "Property '%s.%s' can't find value '%s'", - object_get_typename(obj), prop->name, value); + object_get_typename(obj), name, value); break; case 0: break; diff --git a/hw/s390x/css.c b/hw/s390x/css.c index 38fd46b9a9..7a44320d12 100644 --- a/hw/s390x/css.c +++ b/hw/s390x/css.c @@ -2390,7 +2390,7 @@ static void set_css_devid(Object *obj, Visitor *v, const char *name, num = sscanf(str, "%2x.%1x%n.%4x%n", &cssid, &ssid, &n1, &devid, &n2); if (num != 3 || (n2 - n1) != 5 || strlen(str) != n2) { - error_set_from_qdev_prop_error(errp, EINVAL, obj, prop, str); + error_set_from_qdev_prop_error(errp, EINVAL, obj, name, str); goto out; } if ((cssid > MAX_CSSID) || (ssid > MAX_SSID)) { From patchwork Fri Dec 11 22:05:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1415327 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=gOm+I8b6; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Ct5Cc3Z9Mz9sVJ for ; Sat, 12 Dec 2020 09:33:16 +1100 (AEDT) Received: from localhost ([::1]:52464 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knqyQ-0004vF-DU for incoming@patchwork.ozlabs.org; Fri, 11 Dec 2020 17:33:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60086) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqZ3-0002Or-D6 for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:01 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:60604) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqYx-0006ZK-M4 for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724413; 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=SwohITxyFWU/J3+ZNl1FjYGd75UOCRPuk88VupGgQOg=; b=gOm+I8b6GV8a3V8gGEhQZuTgn/GULktXa1PgqD7987zYDWOZjRrXlW/pqe3SCgHDUkPL5E m0zj05gkpXgPgUVmaUCgyHW8/orPGcZHTx6WOWxuQdnLf9Ekg2cMU4YxIygxfIM/jQqpgw CLaVJU03IpJv7cM+a8U/UdZRN66UCjY= 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-213-jkLnWQVeOCWdAC8ES600QA-1; Fri, 11 Dec 2020 17:06:49 -0500 X-MC-Unique: jkLnWQVeOCWdAC8ES600QA-1 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 9428E19251A1; Fri, 11 Dec 2020 22:06:48 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 48B785D71D; Fri, 11 Dec 2020 22:06:45 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 19/32] qdev: Avoid using prop->name unnecessarily Date: Fri, 11 Dec 2020 17:05:16 -0500 Message-Id: <20201211220529.2290218-20-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , Stefan Berger , John Snow , Markus Armbruster , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" We already get the property name as argument to the property getter and setters, we don't need to use prop->name. This will make it easier to remove the Property.name field in the future. Reviewed-by: Stefan Berger Signed-off-by: Eduardo Habkost Reviewed-by: Igor Mammedov --- This is a new patch added in series v2 --- Cc: Stefan Berger Cc: Paolo Bonzini Cc: "Daniel P. Berrangé" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- backends/tpm/tpm_util.c | 2 +- hw/core/qdev-properties-system.c | 14 +++++++------- hw/core/qdev-properties.c | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/backends/tpm/tpm_util.c b/backends/tpm/tpm_util.c index 3973105658..a5d997e7dc 100644 --- a/backends/tpm/tpm_util.c +++ b/backends/tpm/tpm_util.c @@ -63,7 +63,7 @@ static void set_tpm(Object *obj, Visitor *v, const char *name, void *opaque, s = qemu_find_tpm_be(str); if (s == NULL) { error_setg(errp, "Property '%s.%s' can't find value '%s'", - object_get_typename(obj), prop->name, str); + object_get_typename(obj), name, str); } else if (tpm_backend_init(s, TPM_IF(obj), errp) == 0) { *be = s; /* weak reference, avoid cyclic ref */ } diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c index 9cf9bcb39d..42529c3b65 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -141,7 +141,7 @@ static void set_drive_helper(Object *obj, Visitor *v, const char *name, } if (!blk) { error_setg(errp, "Property '%s.%s' can't find value '%s'", - object_get_typename(OBJECT(dev)), prop->name, str); + object_get_typename(OBJECT(dev)), name, str); goto fail; } if (blk_attach_dev(blk, dev) < 0) { @@ -262,10 +262,10 @@ static void set_chr(Object *obj, Visitor *v, const char *name, void *opaque, s = qemu_chr_find(str); if (s == NULL) { error_setg(errp, "Property '%s.%s' can't find value '%s'", - object_get_typename(obj), prop->name, str); + object_get_typename(obj), name, str); } else if (!qemu_chr_fe_init(be, s, errp)) { error_prepend(errp, "Property '%s.%s' can't take value '%s': ", - object_get_typename(obj), prop->name, str); + object_get_typename(obj), name, str); } g_free(str); } @@ -966,7 +966,7 @@ static void get_prop_pcielinkspeed(Object *obj, Visitor *v, const char *name, abort(); } - visit_type_enum(v, prop->name, &speed, prop->info->enum_table, errp); + visit_type_enum(v, name, &speed, prop->info->enum_table, errp); } static void set_prop_pcielinkspeed(Object *obj, Visitor *v, const char *name, @@ -982,7 +982,7 @@ static void set_prop_pcielinkspeed(Object *obj, Visitor *v, const char *name, return; } - if (!visit_type_enum(v, prop->name, &speed, prop->info->enum_table, + if (!visit_type_enum(v, name, &speed, prop->info->enum_table, errp)) { return; } @@ -1051,7 +1051,7 @@ static void get_prop_pcielinkwidth(Object *obj, Visitor *v, const char *name, abort(); } - visit_type_enum(v, prop->name, &width, prop->info->enum_table, errp); + visit_type_enum(v, name, &width, prop->info->enum_table, errp); } static void set_prop_pcielinkwidth(Object *obj, Visitor *v, const char *name, @@ -1067,7 +1067,7 @@ static void set_prop_pcielinkwidth(Object *obj, Visitor *v, const char *name, return; } - if (!visit_type_enum(v, prop->name, &width, prop->info->enum_table, + if (!visit_type_enum(v, name, &width, prop->info->enum_table, errp)) { return; } diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 7495798a66..50734a1cd4 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -50,7 +50,7 @@ void qdev_propinfo_get_enum(Object *obj, Visitor *v, const char *name, Property *prop = opaque; int *ptr = qdev_get_prop_ptr(obj, prop); - visit_type_enum(v, prop->name, ptr, prop->info->enum_table, errp); + visit_type_enum(v, name, ptr, prop->info->enum_table, errp); } void qdev_propinfo_set_enum(Object *obj, Visitor *v, const char *name, @@ -65,7 +65,7 @@ void qdev_propinfo_set_enum(Object *obj, Visitor *v, const char *name, return; } - visit_type_enum(v, prop->name, ptr, prop->info->enum_table, errp); + visit_type_enum(v, name, ptr, prop->info->enum_table, errp); } void qdev_propinfo_set_default_value_enum(ObjectProperty *op, From patchwork Fri Dec 11 22:05:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1415331 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=FfDlP2OW; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Ct5Kg4pbtz9sVm for ; Sat, 12 Dec 2020 09:38:31 +1100 (AEDT) Received: from localhost ([::1]:33042 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knr3V-0000Mh-Ls for incoming@patchwork.ozlabs.org; Fri, 11 Dec 2020 17:38:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60122) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqZ5-0002RS-Fs for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:03 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:27980) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqYz-0006aT-M5 for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724416; 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=Lwaqf6oM5LFK2GgKtzI8ya9E8BvjKAWP4Qv1l6xx0NE=; b=FfDlP2OWx3XPh2s7hFmKl8mgMzVnFZdPKJbdbytpT+X72cgwLHaZqc7pwZPIjLW61sJkZp 7J1JdyHmBvxNLApicRBjbmReQPUgeSovvfV6PL1aETMDSwFw6D5Yl9G6digdTfOI7U5gEc SBgSsth1PxARInXAunrrKnDtKtS3BfI= 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-409-VCIEEqJfOMuOVgDzR5Fpcg-1; Fri, 11 Dec 2020 17:06:54 -0500 X-MC-Unique: VCIEEqJfOMuOVgDzR5Fpcg-1 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 492AE100F340; Fri, 11 Dec 2020 22:06:53 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8C80219C78; Fri, 11 Dec 2020 22:06:49 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 20/32] qdev: Add name parameter to qdev_class_add_property() Date: Fri, 11 Dec 2020 17:05:17 -0500 Message-Id: <20201211220529.2290218-21-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This will make it easier to remove Property.name in the future. Signed-off-by: Eduardo Habkost --- This is a new patch added in series v2 --- Cc: Paolo Bonzini Cc: "Daniel P. Berrangé" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- hw/core/qdev-properties.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 50734a1cd4..457c7fe4ba 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -887,7 +887,8 @@ void qdev_property_add_static(DeviceState *dev, Property *prop) } } -static void qdev_class_add_property(DeviceClass *klass, Property *prop) +static void qdev_class_add_property(DeviceClass *klass, const char *name, + Property *prop) { ObjectClass *oc = OBJECT_CLASS(klass); @@ -897,7 +898,7 @@ static void qdev_class_add_property(DeviceClass *klass, Property *prop) ObjectProperty *op; op = object_class_property_add(oc, - prop->name, prop->info->name, + name, prop->info->name, prop->info->get, prop->info->set, prop->info->release, prop); @@ -905,7 +906,7 @@ static void qdev_class_add_property(DeviceClass *klass, Property *prop) prop->info->set_default_value(op, prop); } } - object_class_property_set_description(oc, prop->name, + object_class_property_set_description(oc, name, prop->info->description); } @@ -962,7 +963,7 @@ void device_class_set_props(DeviceClass *dc, Property *props) dc->props_ = props; for (prop = props; prop && prop->name; prop++) { qdev_class_add_legacy_property(dc, prop); - qdev_class_add_property(dc, prop); + qdev_class_add_property(dc, prop->name, prop); } } From patchwork Fri Dec 11 22:05:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1415334 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=BXfb++tI; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Ct5Sk0zV3z9sVJ for ; Sat, 12 Dec 2020 09:44:37 +1100 (AEDT) Received: from localhost ([::1]:41478 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knr9P-00045o-So for incoming@patchwork.ozlabs.org; Fri, 11 Dec 2020 17:44:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60204) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqZE-0002bP-HC for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:13 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:57988) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqZ4-0006bz-OM for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724421; 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=rb9UJYi+UKMATl2563f+p9C77Lv2uescfU3uEmkQXTg=; b=BXfb++tIpKaPFDYLsRVQtb31zA9yb7SIG37m5qhvR5H+Gvx7UsJOnRd22VfDAlXa8jKEjx xITtVN5+r8iI0vhO2iu+n63B4bSBQS2dzmkChl8s4p6WVC9nul4JvQx5U5gu0m179MDD8X ipdgGKj2P2mXtQaRcLtH4nOzXbvaZsc= 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-239-VK8YkakuP0i-HLKWJzJPpQ-1; Fri, 11 Dec 2020 17:06:59 -0500 X-MC-Unique: VK8YkakuP0i-HLKWJzJPpQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0209C801817; Fri, 11 Dec 2020 22:06:58 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8B5055D9E2; Fri, 11 Dec 2020 22:06:54 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 21/32] qdev: Add name argument to PropertyInfo.create method Date: Fri, 11 Dec 2020 17:05:18 -0500 Message-Id: <20201211220529.2290218-22-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This will make it easier to remove the Property.name field in the future. Signed-off-by: Eduardo Habkost Reviewed-by: Igor Mammedov --- This is a new patch added in series v2 --- Cc: Paolo Bonzini Cc: "Daniel P. Berrangé" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- include/hw/qdev-properties.h | 2 +- hw/core/qdev-properties.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 476737b9da..ab9c538ba4 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -34,7 +34,7 @@ struct PropertyInfo { const QEnumLookup *enum_table; int (*print)(Object *obj, Property *prop, char *dest, size_t len); void (*set_default_value)(ObjectProperty *op, const Property *prop); - void (*create)(ObjectClass *oc, Property *prop); + void (*create)(ObjectClass *oc, const char *name, Property *prop); ObjectPropertyAccessor *get; ObjectPropertyAccessor *set; ObjectPropertyRelease *release; diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 457c7fe4ba..c68a20695d 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -851,9 +851,10 @@ const PropertyInfo qdev_prop_size = { /* --- object link property --- */ -static void create_link_property(ObjectClass *oc, Property *prop) +static void create_link_property(ObjectClass *oc, const char *name, + Property *prop) { - object_class_property_add_link(oc, prop->name, prop->link_type, + object_class_property_add_link(oc, name, prop->link_type, prop->offset, qdev_prop_allow_set_link_before_realize, OBJ_PROP_LINK_STRONG); @@ -893,7 +894,7 @@ static void qdev_class_add_property(DeviceClass *klass, const char *name, ObjectClass *oc = OBJECT_CLASS(klass); if (prop->info->create) { - prop->info->create(oc, prop); + prop->info->create(oc, name, prop); } else { ObjectProperty *op; From patchwork Fri Dec 11 22:05:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1415324 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=YAN6fr7l; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Ct577106dz9sVJ for ; Sat, 12 Dec 2020 09:29:23 +1100 (AEDT) Received: from localhost ([::1]:45718 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knque-0001ro-3u for incoming@patchwork.ozlabs.org; Fri, 11 Dec 2020 17:29:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60350) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqZT-0002fL-QP for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:27 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:32121) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqZB-0006fD-FS for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724428; 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=IYld01Z63IvWlKMUi8NoC+O1zrbx+yCYFq9I1YV7iWs=; b=YAN6fr7lRbU/9KdTHyKfrjQjsPbDlinF2an8c53zVVorry+6brMUNpG6i2udxJp6ZvtfR1 LHTUeIRaLZlE++8rCDzEonUSpvHaLT9rtlmy6G+0F28K9xl8svR5RGqhzbkzg+3GFs8Mfd ODQNc+oQZeZiWxbEzVWW4wB7P7w/S6w= 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-503-DFff8zPUNsaeumx0SNe9jg-1; Fri, 11 Dec 2020 17:07:04 -0500 X-MC-Unique: DFff8zPUNsaeumx0SNe9jg-1 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 C991610054FF; Fri, 11 Dec 2020 22:07:03 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 34F7260BE5; Fri, 11 Dec 2020 22:06:59 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 22/32] qdev: Wrap getters and setters in separate helpers Date: Fri, 11 Dec 2020 17:05:19 -0500 Message-Id: <20201211220529.2290218-23-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" We'll add extra code to the qdev property getters and setters, so add wrapper functions where additional actions can be performed. The new functions have a "field_prop_" prefix instead of "qdev_" because the code will eventually be moved outside qdev-properties.c, to common QOM code. Signed-off-by: Eduardo Habkost Reviewed-by: Igor Mammedov --- Changes v1 -> v2: * Redone after changes in previous patches in the series * Renamed functions from static_prop_* to field_prop_* --- Cc: Paolo Bonzini Cc: "Daniel P. Berrangé" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- hw/core/qdev-properties.c | 44 +++++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index c68a20695d..b924f13d58 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -44,6 +44,40 @@ void *qdev_get_prop_ptr(Object *obj, Property *prop) return ptr; } +static void field_prop_get(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + Property *prop = opaque; + return prop->info->get(obj, v, name, opaque, errp); +} + +/** + * field_prop_getter: Return getter function to be used for property + * + * Return value can be NULL if @info has no getter function. + */ +static ObjectPropertyAccessor *field_prop_getter(const PropertyInfo *info) +{ + return info->get ? field_prop_get : NULL; +} + +static void field_prop_set(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + Property *prop = opaque; + return prop->info->set(obj, v, name, opaque, errp); +} + +/** + * field_prop_setter: Return setter function to be used for property + * + * Return value can be NULL if @info has not setter function. + */ +static ObjectPropertyAccessor *field_prop_setter(const PropertyInfo *info) +{ + return info->set ? field_prop_set : NULL; +} + void qdev_propinfo_get_enum(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { @@ -630,8 +664,8 @@ static void set_prop_arraylen(Object *obj, Visitor *v, const char *name, assert(qdev_get_prop_ptr(obj, &arrayprop->prop) == eltptr); object_property_add(obj, propname, arrayprop->prop.info->name, - arrayprop->prop.info->get, - arrayprop->prop.info->set, + field_prop_getter(arrayprop->prop.info), + field_prop_setter(arrayprop->prop.info), array_element_release, arrayprop); } @@ -873,7 +907,8 @@ void qdev_property_add_static(DeviceState *dev, Property *prop) assert(!prop->info->create); op = object_property_add(obj, prop->name, prop->info->name, - prop->info->get, prop->info->set, + field_prop_getter(prop->info), + field_prop_setter(prop->info), prop->info->release, prop); @@ -900,7 +935,8 @@ static void qdev_class_add_property(DeviceClass *klass, const char *name, op = object_class_property_add(oc, name, prop->info->name, - prop->info->get, prop->info->set, + field_prop_getter(prop->info), + field_prop_setter(prop->info), prop->info->release, prop); if (prop->set_default) { From patchwork Fri Dec 11 22:05:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1415328 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=eg1tAX/G; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Ct5D13XY7z9sVJ for ; Sat, 12 Dec 2020 09:33:37 +1100 (AEDT) Received: from localhost ([::1]:53798 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knqyl-0005Tz-Ej for incoming@patchwork.ozlabs.org; Fri, 11 Dec 2020 17:33:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60578) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqZp-0002y5-1P for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:49 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:24043) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqZQ-0006hQ-Bi for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724439; 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=liR73qHgx91bdEvSe0pRJgUhS7neRyLuX3mOz/BU+gI=; b=eg1tAX/G2AAy/coUwyuoVaHmJ4QWjK+OCIsXL2HEzBwN/WBmRBRO4VqxiTiQReCWDi1Ss+ kQjMExMTfoJLXRqX/wtrkceiht6Ik3h7bxKzuRRTkg/MH1HNvsxWMtUg/MgTcwNJdfLAb5 Clkdj/9Q5KZhQn7Zda1Ijjn3C4OCB8s= 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-513-UpP2mNjkPBywjRPvEBuG2A-1; Fri, 11 Dec 2020 17:07:15 -0500 X-MC-Unique: UpP2mNjkPBywjRPvEBuG2A-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B9232C292; Fri, 11 Dec 2020 22:07:12 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id EB9BF5D9E2; Fri, 11 Dec 2020 22:07:04 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 23/32] qdev: Move dev->realized check to qdev_property_set() Date: Fri, 11 Dec 2020 17:05:20 -0500 Message-Id: <20201211220529.2290218-24-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matthew Rosato , Paul Durrant , Mark Cave-Ayland , Stefano Stabellini , xen-devel@lists.xenproject.org, qemu-block@nongnu.org, Stefan Berger , David Hildenbrand , Markus Armbruster , Halil Pasic , Christian Borntraeger , Anthony Perard , =?utf-8?q?Marc-Andr=C3=A9_Lurea?= =?utf-8?q?u?= , =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= , Artyom Tarasenko , Thomas Huth , Alex Williamson , Igor Mammedov , John Snow , Richard Henderson , Kevin Wolf , "Daniel P. Berrange" , Cornelia Huck , qemu-s390x@nongnu.org, Max Reitz , Paolo Bonzini , Stefan Berger Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Every single qdev property setter function manually checks dev->realized. We can just check dev->realized inside qdev_property_set() instead. The check is being added as a separate function (qdev_prop_allow_set()) because it will become a callback later. Reviewed-by: Stefan Berger Signed-off-by: Eduardo Habkost Acked-by: Paul Durrant Reviewed-by: Cornelia Huck Reviewed-by: Igor Mammedov --- Changes v1 -> v2: * Removed unused variable at xen_block_set_vdev() * Redone patch after changes in the previous patches in the series --- Cc: Stefan Berger Cc: Stefano Stabellini Cc: Anthony Perard Cc: Paul Durrant Cc: Kevin Wolf Cc: Max Reitz Cc: Paolo Bonzini Cc: "Daniel P. Berrangé" Cc: Eduardo Habkost Cc: Cornelia Huck Cc: Halil Pasic Cc: Christian Borntraeger Cc: Richard Henderson Cc: David Hildenbrand Cc: Thomas Huth Cc: Matthew Rosato Cc: Alex Williamson Cc: Mark Cave-Ayland Cc: Artyom Tarasenko Cc: qemu-devel@nongnu.org Cc: xen-devel@lists.xenproject.org Cc: qemu-block@nongnu.org Cc: qemu-s390x@nongnu.org --- backends/tpm/tpm_util.c | 6 -- hw/block/xen-block.c | 6 -- hw/core/qdev-properties-system.c | 70 ---------------------- hw/core/qdev-properties.c | 100 ++++++------------------------- hw/s390x/css.c | 6 -- hw/s390x/s390-pci-bus.c | 6 -- hw/vfio/pci-quirks.c | 6 -- target/sparc/cpu.c | 6 -- 8 files changed, 18 insertions(+), 188 deletions(-) diff --git a/backends/tpm/tpm_util.c b/backends/tpm/tpm_util.c index a5d997e7dc..39b45fa46d 100644 --- a/backends/tpm/tpm_util.c +++ b/backends/tpm/tpm_util.c @@ -46,16 +46,10 @@ static void get_tpm(Object *obj, Visitor *v, const char *name, void *opaque, static void set_tpm(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; TPMBackend *s, **be = qdev_get_prop_ptr(obj, prop); char *str; - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_str(v, name, &str, errp)) { return; } diff --git a/hw/block/xen-block.c b/hw/block/xen-block.c index 905e4acd97..bd1aef63a7 100644 --- a/hw/block/xen-block.c +++ b/hw/block/xen-block.c @@ -395,17 +395,11 @@ static int vbd_name_to_disk(const char *name, const char **endp, static void xen_block_set_vdev(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; XenBlockVdev *vdev = qdev_get_prop_ptr(obj, prop); char *str, *p; const char *end; - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_str(v, name, &str, errp)) { return; } diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c index 42529c3b65..f31aea3de1 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -94,11 +94,6 @@ static void set_drive_helper(Object *obj, Visitor *v, const char *name, bool blk_created = false; int ret; - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_str(v, name, &str, errp)) { return; } @@ -230,17 +225,11 @@ static void get_chr(Object *obj, Visitor *v, const char *name, void *opaque, static void set_chr(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; CharBackend *be = qdev_get_prop_ptr(obj, prop); Chardev *s; char *str; - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_str(v, name, &str, errp)) { return; } @@ -311,18 +300,12 @@ static void get_mac(Object *obj, Visitor *v, const char *name, void *opaque, static void set_mac(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; MACAddr *mac = qdev_get_prop_ptr(obj, prop); int i, pos; char *str; const char *p; - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_str(v, name, &str, errp)) { return; } @@ -390,7 +373,6 @@ static void get_netdev(Object *obj, Visitor *v, const char *name, static void set_netdev(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; NICPeers *peers_ptr = qdev_get_prop_ptr(obj, prop); NetClientState **ncs = peers_ptr->ncs; @@ -398,11 +380,6 @@ static void set_netdev(Object *obj, Visitor *v, const char *name, int queues, err = 0, i = 0; char *str; - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_str(v, name, &str, errp)) { return; } @@ -469,18 +446,12 @@ static void get_audiodev(Object *obj, Visitor *v, const char* name, static void set_audiodev(Object *obj, Visitor *v, const char* name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; QEMUSoundCard *card = qdev_get_prop_ptr(obj, prop); AudioState *state; int err = 0; char *str; - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_str(v, name, &str, errp)) { return; } @@ -582,11 +553,6 @@ static void set_blocksize(Object *obj, Visitor *v, const char *name, uint64_t value; Error *local_err = NULL; - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_size(v, name, &value, errp)) { return; } @@ -686,7 +652,6 @@ static void get_reserved_region(Object *obj, Visitor *v, const char *name, static void set_reserved_region(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; ReservedRegion *rr = qdev_get_prop_ptr(obj, prop); Error *local_err = NULL; @@ -694,11 +659,6 @@ static void set_reserved_region(Object *obj, Visitor *v, const char *name, char *str; int ret; - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - visit_type_str(v, name, &str, &local_err); if (local_err) { error_propagate(errp, local_err); @@ -754,17 +714,11 @@ const PropertyInfo qdev_prop_reserved_region = { static void set_pci_devfn(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; int32_t value, *ptr = qdev_get_prop_ptr(obj, prop); unsigned int slot, fn, n; char *str; - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_str(v, name, &str, NULL)) { if (!visit_type_int32(v, name, &value, errp)) { return; @@ -848,7 +802,6 @@ static void get_pci_host_devaddr(Object *obj, Visitor *v, const char *name, static void set_pci_host_devaddr(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; PCIHostDeviceAddress *addr = qdev_get_prop_ptr(obj, prop); char *str, *p; @@ -857,11 +810,6 @@ static void set_pci_host_devaddr(Object *obj, Visitor *v, const char *name, unsigned long dom = 0, bus = 0; unsigned int slot = 0, func = 0; - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_str(v, name, &str, errp)) { return; } @@ -972,16 +920,10 @@ static void get_prop_pcielinkspeed(Object *obj, Visitor *v, const char *name, static void set_prop_pcielinkspeed(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; PCIExpLinkSpeed *p = qdev_get_prop_ptr(obj, prop); int speed; - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_enum(v, name, &speed, prop->info->enum_table, errp)) { return; @@ -1057,16 +999,10 @@ static void get_prop_pcielinkwidth(Object *obj, Visitor *v, const char *name, static void set_prop_pcielinkwidth(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; PCIExpLinkWidth *p = qdev_get_prop_ptr(obj, prop); int width; - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_enum(v, name, &width, prop->info->enum_table, errp)) { return; @@ -1129,16 +1065,10 @@ static void get_uuid(Object *obj, Visitor *v, const char *name, void *opaque, static void set_uuid(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; QemuUUID *uuid = qdev_get_prop_ptr(obj, prop); char *str; - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_str(v, name, &str, errp)) { return; } diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index b924f13d58..92f48ecbf2 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -24,6 +24,19 @@ void qdev_prop_set_after_realize(DeviceState *dev, const char *name, } } +/* returns: true if property is allowed to be set, false otherwise */ +static bool qdev_prop_allow_set(Object *obj, const char *name, + Error **errp) +{ + DeviceState *dev = DEVICE(obj); + + if (dev->realized) { + qdev_prop_set_after_realize(dev, name, errp); + return false; + } + return true; +} + void qdev_prop_allow_set_link_before_realize(const Object *obj, const char *name, Object *val, Error **errp) @@ -65,6 +78,11 @@ static void field_prop_set(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; + + if (!qdev_prop_allow_set(obj, name, errp)) { + return; + } + return prop->info->set(obj, v, name, opaque, errp); } @@ -90,15 +108,9 @@ void qdev_propinfo_get_enum(Object *obj, Visitor *v, const char *name, void qdev_propinfo_set_enum(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; int *ptr = qdev_get_prop_ptr(obj, prop); - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - visit_type_enum(v, name, ptr, prop->info->enum_table, errp); } @@ -148,15 +160,9 @@ static void prop_get_bit(Object *obj, Visitor *v, const char *name, static void prop_set_bit(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; bool value; - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_bool(v, name, &value, errp)) { return; } @@ -208,15 +214,9 @@ static void prop_get_bit64(Object *obj, Visitor *v, const char *name, static void prop_set_bit64(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; bool value; - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_bool(v, name, &value, errp)) { return; } @@ -245,15 +245,9 @@ static void get_bool(Object *obj, Visitor *v, const char *name, void *opaque, static void set_bool(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; bool *ptr = qdev_get_prop_ptr(obj, prop); - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - visit_type_bool(v, name, ptr, errp); } @@ -278,15 +272,9 @@ static void get_uint8(Object *obj, Visitor *v, const char *name, void *opaque, static void set_uint8(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; uint8_t *ptr = qdev_get_prop_ptr(obj, prop); - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - visit_type_uint8(v, name, ptr, errp); } @@ -323,15 +311,9 @@ static void get_uint16(Object *obj, Visitor *v, const char *name, static void set_uint16(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; uint16_t *ptr = qdev_get_prop_ptr(obj, prop); - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - visit_type_uint16(v, name, ptr, errp); } @@ -356,15 +338,9 @@ static void get_uint32(Object *obj, Visitor *v, const char *name, static void set_uint32(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; uint32_t *ptr = qdev_get_prop_ptr(obj, prop); - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - visit_type_uint32(v, name, ptr, errp); } @@ -380,15 +356,9 @@ void qdev_propinfo_get_int32(Object *obj, Visitor *v, const char *name, static void set_int32(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; int32_t *ptr = qdev_get_prop_ptr(obj, prop); - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - visit_type_int32(v, name, ptr, errp); } @@ -420,15 +390,9 @@ static void get_uint64(Object *obj, Visitor *v, const char *name, static void set_uint64(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; uint64_t *ptr = qdev_get_prop_ptr(obj, prop); - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - visit_type_uint64(v, name, ptr, errp); } @@ -444,15 +408,9 @@ static void get_int64(Object *obj, Visitor *v, const char *name, static void set_int64(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; int64_t *ptr = qdev_get_prop_ptr(obj, prop); - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - visit_type_int64(v, name, ptr, errp); } @@ -495,16 +453,10 @@ static void get_string(Object *obj, Visitor *v, const char *name, static void set_string(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; char **ptr = qdev_get_prop_ptr(obj, prop); char *str; - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_str(v, name, &str, errp)) { return; } @@ -545,16 +497,10 @@ void qdev_propinfo_get_size32(Object *obj, Visitor *v, const char *name, static void set_size32(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; uint32_t *ptr = qdev_get_prop_ptr(obj, prop); uint64_t value; - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_size(v, name, &value, errp)) { return; } @@ -621,10 +567,6 @@ static void set_prop_arraylen(Object *obj, Visitor *v, const char *name, const char *arrayname; int i; - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } if (*alenptr) { error_setg(errp, "array size property %s may not be set more than once", name); @@ -864,15 +806,9 @@ static void get_size(Object *obj, Visitor *v, const char *name, void *opaque, static void set_size(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; uint64_t *ptr = qdev_get_prop_ptr(obj, prop); - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - visit_type_size(v, name, ptr, errp); } diff --git a/hw/s390x/css.c b/hw/s390x/css.c index 7a44320d12..496e2c5801 100644 --- a/hw/s390x/css.c +++ b/hw/s390x/css.c @@ -2372,18 +2372,12 @@ static void get_css_devid(Object *obj, Visitor *v, const char *name, static void set_css_devid(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; CssDevId *dev_id = qdev_get_prop_ptr(obj, prop); char *str; int num, n1, n2; unsigned int cssid, ssid, devid; - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_str(v, name, &str, errp)) { return; } diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index 8b6be1197b..30511f620e 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -1338,16 +1338,10 @@ static void s390_pci_get_fid(Object *obj, Visitor *v, const char *name, static void s390_pci_set_fid(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); S390PCIBusDevice *zpci = S390_PCI_DEVICE(obj); Property *prop = opaque; uint32_t *ptr = qdev_get_prop_ptr(obj, prop); - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_uint32(v, name, ptr, errp)) { return; } diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c index 53569925a2..802979635c 100644 --- a/hw/vfio/pci-quirks.c +++ b/hw/vfio/pci-quirks.c @@ -1498,15 +1498,9 @@ static void set_nv_gpudirect_clique_id(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); Property *prop = opaque; uint8_t value, *ptr = qdev_get_prop_ptr(obj, prop); - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_uint8(v, name, &value, errp)) { return; } diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index 92534bcd18..b730146bbe 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -798,17 +798,11 @@ static void sparc_get_nwindows(Object *obj, Visitor *v, const char *name, static void sparc_set_nwindows(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - DeviceState *dev = DEVICE(obj); const int64_t min = MIN_NWINDOWS; const int64_t max = MAX_NWINDOWS; SPARCCPU *cpu = SPARC_CPU(obj); int64_t value; - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - if (!visit_type_int(v, name, &value, errp)) { return; } From patchwork Fri Dec 11 22:05:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1415330 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=hkQO43Id; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Ct5Jd5kRDz9sVJ for ; Sat, 12 Dec 2020 09:37:37 +1100 (AEDT) Received: from localhost ([::1]:60406 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knr2d-0008S9-Qj for incoming@patchwork.ozlabs.org; Fri, 11 Dec 2020 17:37:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60402) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqZY-0002jF-Ux for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:32 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:38496) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqZM-0006hZ-9F for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724439; 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=rT65BfAeuTWOVsUE/qQWyErSfi+P/zpLj+r5Yp7uEns=; b=hkQO43Id7GjgUI5De6+P+4Mke223bpCnadotxgetsyofkXiBOumc2ppR86VC57J016t3wK Bjn8d7L8LhcyOTZ3t1KPAQDL6/bC79Ytp64AKFf/opZH7/wNAOiPV4uhdk2zoIy33fGCr7 gAkcpg+BjbWdgiP7xbsHrCJ3GilvSJ0= 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-486-GT_3cIBmN5SEHX5hnXfNFw-1; Fri, 11 Dec 2020 17:07:18 -0500 X-MC-Unique: GT_3cIBmN5SEHX5hnXfNFw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2666D800D53; Fri, 11 Dec 2020 22:07:17 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id B25AE5D9E2; Fri, 11 Dec 2020 22:07:13 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 24/32] qdev: Make PropertyInfo.create return ObjectProperty* Date: Fri, 11 Dec 2020 17:05:21 -0500 Message-Id: <20201211220529.2290218-25-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Returning ObjectProperty* will be useful for new property registration code that will add additional callbacks to ObjectProperty after registering it. Signed-off-by: Eduardo Habkost Reviewed-by: Igor Mammedov --- Changes v1 -> v2: * Redone patch on top of additional changes in series v2 * Commit message reword --- Cc: Paolo Bonzini Cc: "Daniel P. Berrangé" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- include/hw/qdev-properties.h | 3 ++- hw/core/qdev-properties.c | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index ab9c538ba4..aae882317a 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -34,7 +34,8 @@ struct PropertyInfo { const QEnumLookup *enum_table; int (*print)(Object *obj, Property *prop, char *dest, size_t len); void (*set_default_value)(ObjectProperty *op, const Property *prop); - void (*create)(ObjectClass *oc, const char *name, Property *prop); + ObjectProperty *(*create)(ObjectClass *oc, const char *name, + Property *prop); ObjectPropertyAccessor *get; ObjectPropertyAccessor *set; ObjectPropertyRelease *release; diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 92f48ecbf2..3bb05e7d0d 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -821,13 +821,13 @@ const PropertyInfo qdev_prop_size = { /* --- object link property --- */ -static void create_link_property(ObjectClass *oc, const char *name, - Property *prop) +static ObjectProperty *create_link_property(ObjectClass *oc, const char *name, + Property *prop) { - object_class_property_add_link(oc, name, prop->link_type, - prop->offset, - qdev_prop_allow_set_link_before_realize, - OBJ_PROP_LINK_STRONG); + return object_class_property_add_link(oc, name, prop->link_type, + prop->offset, + qdev_prop_allow_set_link_before_realize, + OBJ_PROP_LINK_STRONG); } const PropertyInfo qdev_prop_link = { From patchwork Fri Dec 11 22:05:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1415333 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=e8cKrgvU; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Ct5Ry10X4z9sVY for ; Sat, 12 Dec 2020 09:43:58 +1100 (AEDT) Received: from localhost ([::1]:40470 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knr8l-0003eu-S8 for incoming@patchwork.ozlabs.org; Fri, 11 Dec 2020 17:43:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60558) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqZo-0002xs-Fa for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:49 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:38832) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqZQ-0006iV-S0 for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724444; 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=46G22GlkPuQJFez3Xsh6hsmFiwSaREpIvSp2hp7j0nU=; b=e8cKrgvUTE3FZXfJsM8QuHz33cXlQt/dVyTu9mCogELuuyFRHtLzBnnKMQCwHdD/RlcGFa Zp5UKdITG7lSL3zkQxPBnXq9brqN3Zn4AD6hIcN+4CClUjPEkT+5ZPnB/UMKCYfnlfegf4 KIIyUfog6dg8aI9IwtKLOlt9UKKT/o0= 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-324-0R-PQ6R9OrymGeyVO4IBUg-1; Fri, 11 Dec 2020 17:07:22 -0500 X-MC-Unique: 0R-PQ6R9OrymGeyVO4IBUg-1 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 2B922C292; Fri, 11 Dec 2020 22:07:21 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id CCF025C8AA; Fri, 11 Dec 2020 22:07:17 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 25/32] qdev: Make qdev_class_add_property() more flexible Date: Fri, 11 Dec 2020 17:05:22 -0500 Message-Id: <20201211220529.2290218-26-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Support Property.set_default and PropertyInfo.description even if PropertyInfo.create is set. Signed-off-by: Eduardo Habkost Reviewed-by: Igor Mammedov --- Changes v1 -> v2: * Patch redone after changes in the previous patches in the series --- Cc: Paolo Bonzini Cc: "Daniel P. Berrangé" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- hw/core/qdev-properties.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 3bb05e7d0d..fcda0c8f4b 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -863,24 +863,25 @@ static void qdev_class_add_property(DeviceClass *klass, const char *name, Property *prop) { ObjectClass *oc = OBJECT_CLASS(klass); + ObjectProperty *op; if (prop->info->create) { - prop->info->create(oc, name, prop); + op = prop->info->create(oc, name, prop); } else { - ObjectProperty *op; - op = object_class_property_add(oc, name, prop->info->name, field_prop_getter(prop->info), field_prop_setter(prop->info), prop->info->release, prop); - if (prop->set_default) { - prop->info->set_default_value(op, prop); - } } - object_class_property_set_description(oc, name, - prop->info->description); + if (prop->set_default) { + prop->info->set_default_value(op, prop); + } + if (prop->info->description) { + object_class_property_set_description(oc, name, + prop->info->description); + } } /** From patchwork Fri Dec 11 22:05:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1415329 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=H48o4IAP; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Ct5JY6zD4z9sVJ for ; Sat, 12 Dec 2020 09:37:33 +1100 (AEDT) Received: from localhost ([::1]:60372 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knr2Z-0008RC-Ui for incoming@patchwork.ozlabs.org; Fri, 11 Dec 2020 17:37:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60626) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqZu-00031u-Dk for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:54 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:36330) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqZV-0006kz-TQ for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724449; 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=pRVeBJC73oB1ZWLMle2oyb31+GPywq6tYIYiTT22tXA=; b=H48o4IAPb0Et8FKL4PbTQ61RUJd2sYG0sRNsKZ3EPn3berwtlMcuL3wLEgdxgTz1PPO40U W2uvDpZE46Lms073560KvwCZ/XADZez9qIfcAXT7KRyUP+89CO9uQxAOUXI40XnWH3MgwF z5mzzEix4IMIZdDjpUdOiRQnCghrjVU= 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-62-1SMZKi9sNR2EGNmTtTLeDA-1; Fri, 11 Dec 2020 17:07:27 -0500 X-MC-Unique: 1SMZKi9sNR2EGNmTtTLeDA-1 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 71607800D62; Fri, 11 Dec 2020 22:07:25 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0215B19C78; Fri, 11 Dec 2020 22:07:21 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 26/32] qdev: Separate generic and device-specific property registration Date: Fri, 11 Dec 2020 17:05:23 -0500 Message-Id: <20201211220529.2290218-27-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" qdev_class_add_property() and qdev_property_add_static() will have code that's specific for device types. object_class_property_add_field_static() and object_property_add_field() will be generic and part of the QOM field property API. Note that the new functions have a `name` parameter because the plan is to eventually get rid of the Property.name field. The declarations for the new functions are being added to qdev-properties-internal.h, but they will be moved to a QOM header later. Signed-off-by: Eduardo Habkost --- Changes v2 -> v3: * Re-added array-based array registration function, named as object_class_add_field_properties() * Renamed object_class_property_add_field() to object_class_property_add_field_static(), to indicate that the function expect the Property argument to have static life time. * Keep all new functions as internal API by now, until we decide what's going to be the preferred API for registering class field properties. Changes v1 -> v2: * Patch redone after changes in previous patches in the series * Rename new functions to object*_property_add_field() --- Cc: Paolo Bonzini Cc: "Daniel P. Berrangé" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- hw/core/qdev-prop-internal.h | 42 ++++++++++++++++++++++++++++++++++++ hw/core/qdev-properties.c | 37 ++++++++++++++++++++++++------- 2 files changed, 71 insertions(+), 8 deletions(-) diff --git a/hw/core/qdev-prop-internal.h b/hw/core/qdev-prop-internal.h index d7b77844fe..6f17ddf271 100644 --- a/hw/core/qdev-prop-internal.h +++ b/hw/core/qdev-prop-internal.h @@ -25,4 +25,46 @@ void qdev_propinfo_get_int32(Object *obj, Visitor *v, const char *name, void qdev_propinfo_get_size32(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp); +/** + * object_property_add_field: Add a field property to an object instance + * @obj: object instance + * @name: property name + * @prop: property definition + * + * This function should not be used in new code. Please add class properties + * instead, using object_class_add_field(). + */ +ObjectProperty * +object_property_add_field(Object *obj, const char *name, + Property *prop); + +/** + * object_class_property_add_field_static: Add a field property to object class + * @oc: object class + * @name: property name + * @prop: property definition + * + * Add a field property to an object class. A field property is + * a property that will change a field at a specific offset of the + * object instance struct. + * + * *@prop must have static life time. + */ +ObjectProperty * +object_class_property_add_field_static(ObjectClass *oc, const char *name, + Property *prop); + +/** + * object_class_add_field_properties: Add field properties from array to a class + * @oc: object class + * @props: array of property definitions + * + * Register an array of field properties to a class, using + * object_class_property_add_field_static() for each array element. + * + * The array at @props must end with DEFINE_PROP_END_OF_LIST(), and + * must have static life time. + */ +void object_class_add_field_properties(ObjectClass *oc, Property *props); + #endif diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index fcda0c8f4b..8436b60ec4 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -835,20 +835,21 @@ const PropertyInfo qdev_prop_link = { .create = create_link_property, }; -void qdev_property_add_static(DeviceState *dev, Property *prop) +ObjectProperty * +object_property_add_field(Object *obj, const char *name, + Property *prop) { - Object *obj = OBJECT(dev); ObjectProperty *op; assert(!prop->info->create); - op = object_property_add(obj, prop->name, prop->info->name, + op = object_property_add(obj, name, prop->info->name, field_prop_getter(prop->info), field_prop_setter(prop->info), prop->info->release, prop); - object_property_set_description(obj, prop->name, + object_property_set_description(obj, name, prop->info->description); if (prop->set_default) { @@ -857,12 +858,14 @@ void qdev_property_add_static(DeviceState *dev, Property *prop) op->init(obj, op); } } + + return op; } -static void qdev_class_add_property(DeviceClass *klass, const char *name, - Property *prop) +ObjectProperty * +object_class_property_add_field_static(ObjectClass *oc, const char *name, + Property *prop) { - ObjectClass *oc = OBJECT_CLASS(klass); ObjectProperty *op; if (prop->info->create) { @@ -882,6 +885,22 @@ static void qdev_class_add_property(DeviceClass *klass, const char *name, object_class_property_set_description(oc, name, prop->info->description); } + return op; +} + +void object_class_add_field_properties(ObjectClass *oc, Property *props) +{ + Property *prop; + + for (prop = props; prop && prop->name; prop++) { + object_class_property_add_field_static(oc, prop->name, prop); + } +} + + +void qdev_property_add_static(DeviceState *dev, Property *prop) +{ + object_property_add_field(OBJECT(dev), prop->name, prop); } /** @@ -932,13 +951,15 @@ static void qdev_class_add_legacy_property(DeviceClass *dc, Property *prop) void device_class_set_props(DeviceClass *dc, Property *props) { + ObjectClass *oc = OBJECT_CLASS(dc); Property *prop; dc->props_ = props; for (prop = props; prop && prop->name; prop++) { qdev_class_add_legacy_property(dc, prop); - qdev_class_add_property(dc, prop->name, prop); } + + object_class_add_field_properties(oc, props); } void qdev_alias_all_properties(DeviceState *target, Object *source) From patchwork Fri Dec 11 22:05:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1415337 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Bcm1FGme; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Ct5Zj1tsCz9sVJ for ; Sat, 12 Dec 2020 09:49:49 +1100 (AEDT) Received: from localhost ([::1]:49124 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knrER-0007QL-56 for incoming@patchwork.ozlabs.org; Fri, 11 Dec 2020 17:49:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60618) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqZt-00031d-2M for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:53 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:48391) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqZZ-0006lv-59 for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724452; 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=5dxPgHP3OIor/uPnVuxSeiC5dUE6Uw3EIYpLXIAe42Q=; b=Bcm1FGmeZcV36HiTKA+c2n+zZP10KDvK2aGWwtCt0gmm2sicLmguAWfb3K8sEaXwlZkT5H hMuMOEPyzQnVk9dhH5SYiS3AwkLZTmqLzV5ZvTRwWq8R5K3VtsLBgtujNCY1dIdCjkRLHG sbJbLE3UQpS1WG7qINC2zgGsWzvhEyA= 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-515-7vfgh4jGNF2t5B_B1qZ29Q-1; Fri, 11 Dec 2020 17:07:30 -0500 X-MC-Unique: 7vfgh4jGNF2t5B_B1qZ29Q-1 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 CC91919251A0; Fri, 11 Dec 2020 22:07:29 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 84FDB5D71D; Fri, 11 Dec 2020 22:07:26 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 27/32] qdev: Rename qdev_propinfo_* to field_prop_* Date: Fri, 11 Dec 2020 17:05:24 -0500 Message-Id: <20201211220529.2290218-28-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" These functions will be moved to be part of QOM, so rename them. Signed-off-by: Eduardo Habkost Reviewed-by: Igor Mammedov --- Changes v2: * Rename to field_prop_* instead of object_propinfo_* --- Cc: Paolo Bonzini Cc: "Daniel P. Berrangé" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- hw/core/qdev-prop-internal.h | 28 +++++++-------- hw/core/qdev-properties-system.c | 48 ++++++++++++------------- hw/core/qdev-properties.c | 62 ++++++++++++++++---------------- 3 files changed, 69 insertions(+), 69 deletions(-) diff --git a/hw/core/qdev-prop-internal.h b/hw/core/qdev-prop-internal.h index 6f17ddf271..740a5e530b 100644 --- a/hw/core/qdev-prop-internal.h +++ b/hw/core/qdev-prop-internal.h @@ -8,22 +8,22 @@ #ifndef HW_CORE_QDEV_PROP_INTERNAL_H #define HW_CORE_QDEV_PROP_INTERNAL_H -void qdev_propinfo_get_enum(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp); -void qdev_propinfo_set_enum(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp); +void field_prop_get_enum(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp); +void field_prop_set_enum(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp); -void qdev_propinfo_set_default_value_enum(ObjectProperty *op, - const Property *prop); -void qdev_propinfo_set_default_value_int(ObjectProperty *op, - const Property *prop); -void qdev_propinfo_set_default_value_uint(ObjectProperty *op, - const Property *prop); +void field_prop_set_default_value_enum(ObjectProperty *op, + const Property *prop); +void field_prop_set_default_value_int(ObjectProperty *op, + const Property *prop); +void field_prop_set_default_value_uint(ObjectProperty *op, + const Property *prop); -void qdev_propinfo_get_int32(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp); -void qdev_propinfo_get_size32(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp); +void field_prop_get_int32(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp); +void field_prop_get_size32(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp); /** * object_property_add_field: Add a field property to an object instance diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c index f31aea3de1..590c5f3d97 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -537,9 +537,9 @@ QEMU_BUILD_BUG_ON(sizeof(LostTickPolicy) != sizeof(int)); const PropertyInfo qdev_prop_losttickpolicy = { .name = "LostTickPolicy", .enum_table = &LostTickPolicy_lookup, - .get = qdev_propinfo_get_enum, - .set = qdev_propinfo_set_enum, - .set_default_value = qdev_propinfo_set_default_value_enum, + .get = field_prop_get_enum, + .set = field_prop_set_enum, + .set_default_value = field_prop_set_default_value_enum, }; /* --- blocksize --- */ @@ -568,9 +568,9 @@ const PropertyInfo qdev_prop_blocksize = { .name = "size", .description = "A power of two between " MIN_BLOCK_SIZE_STR " and " MAX_BLOCK_SIZE_STR, - .get = qdev_propinfo_get_size32, + .get = field_prop_get_size32, .set = set_blocksize, - .set_default_value = qdev_propinfo_set_default_value_uint, + .set_default_value = field_prop_set_default_value_uint, }; /* --- Block device error handling policy --- */ @@ -582,9 +582,9 @@ const PropertyInfo qdev_prop_blockdev_on_error = { .description = "Error handling policy, " "report/ignore/enospc/stop/auto", .enum_table = &BlockdevOnError_lookup, - .get = qdev_propinfo_get_enum, - .set = qdev_propinfo_set_enum, - .set_default_value = qdev_propinfo_set_default_value_enum, + .get = field_prop_get_enum, + .set = field_prop_set_enum, + .set_default_value = field_prop_set_default_value_enum, }; /* --- BIOS CHS translation */ @@ -596,9 +596,9 @@ const PropertyInfo qdev_prop_bios_chs_trans = { .description = "Logical CHS translation algorithm, " "auto/none/lba/large/rechs", .enum_table = &BiosAtaTranslation_lookup, - .get = qdev_propinfo_get_enum, - .set = qdev_propinfo_set_enum, - .set_default_value = qdev_propinfo_set_default_value_enum, + .get = field_prop_get_enum, + .set = field_prop_set_enum, + .set_default_value = field_prop_set_default_value_enum, }; /* --- FDC default drive types */ @@ -608,9 +608,9 @@ const PropertyInfo qdev_prop_fdc_drive_type = { .description = "FDC drive type, " "144/288/120/none/auto", .enum_table = &FloppyDriveType_lookup, - .get = qdev_propinfo_get_enum, - .set = qdev_propinfo_set_enum, - .set_default_value = qdev_propinfo_set_default_value_enum, + .get = field_prop_get_enum, + .set = field_prop_set_enum, + .set_default_value = field_prop_set_default_value_enum, }; /* --- MultiFDCompression --- */ @@ -620,9 +620,9 @@ const PropertyInfo qdev_prop_multifd_compression = { .description = "multifd_compression values, " "none/zlib/zstd", .enum_table = &MultiFDCompression_lookup, - .get = qdev_propinfo_get_enum, - .set = qdev_propinfo_set_enum, - .set_default_value = qdev_propinfo_set_default_value_enum, + .get = field_prop_get_enum, + .set = field_prop_set_enum, + .set_default_value = field_prop_set_default_value_enum, }; /* --- Reserved Region --- */ @@ -766,9 +766,9 @@ const PropertyInfo qdev_prop_pci_devfn = { .name = "int32", .description = "Slot and optional function number, example: 06.0 or 06", .print = print_pci_devfn, - .get = qdev_propinfo_get_int32, + .get = field_prop_get_int32, .set = set_pci_devfn, - .set_default_value = qdev_propinfo_set_default_value_int, + .set_default_value = field_prop_set_default_value_int, }; /* --- pci host address --- */ @@ -882,9 +882,9 @@ const PropertyInfo qdev_prop_off_auto_pcibar = { .name = "OffAutoPCIBAR", .description = "off/auto/bar0/bar1/bar2/bar3/bar4/bar5", .enum_table = &OffAutoPCIBAR_lookup, - .get = qdev_propinfo_get_enum, - .set = qdev_propinfo_set_enum, - .set_default_value = qdev_propinfo_set_default_value_enum, + .get = field_prop_get_enum, + .set = field_prop_set_enum, + .set_default_value = field_prop_set_default_value_enum, }; /* --- PCIELinkSpeed 2_5/5/8/16 -- */ @@ -954,7 +954,7 @@ const PropertyInfo qdev_prop_pcie_link_speed = { .enum_table = &PCIELinkSpeed_lookup, .get = get_prop_pcielinkspeed, .set = set_prop_pcielinkspeed, - .set_default_value = qdev_propinfo_set_default_value_enum, + .set_default_value = field_prop_set_default_value_enum, }; /* --- PCIELinkWidth 1/2/4/8/12/16/32 -- */ @@ -1042,7 +1042,7 @@ const PropertyInfo qdev_prop_pcie_link_width = { .enum_table = &PCIELinkWidth_lookup, .get = get_prop_pcielinkwidth, .set = set_prop_pcielinkwidth, - .set_default_value = qdev_propinfo_set_default_value_enum, + .set_default_value = field_prop_set_default_value_enum, }; /* --- UUID --- */ diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 8436b60ec4..d2f565f552 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -96,8 +96,8 @@ static ObjectPropertyAccessor *field_prop_setter(const PropertyInfo *info) return info->set ? field_prop_set : NULL; } -void qdev_propinfo_get_enum(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +void field_prop_get_enum(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) { Property *prop = opaque; int *ptr = qdev_get_prop_ptr(obj, prop); @@ -105,8 +105,8 @@ void qdev_propinfo_get_enum(Object *obj, Visitor *v, const char *name, visit_type_enum(v, name, ptr, prop->info->enum_table, errp); } -void qdev_propinfo_set_enum(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +void field_prop_set_enum(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) { Property *prop = opaque; int *ptr = qdev_get_prop_ptr(obj, prop); @@ -114,8 +114,8 @@ void qdev_propinfo_set_enum(Object *obj, Visitor *v, const char *name, visit_type_enum(v, name, ptr, prop->info->enum_table, errp); } -void qdev_propinfo_set_default_value_enum(ObjectProperty *op, - const Property *prop) +void field_prop_set_default_value_enum(ObjectProperty *op, + const Property *prop) { object_property_set_default_str(op, qapi_enum_lookup(prop->info->enum_table, prop->defval.i)); @@ -123,9 +123,9 @@ void qdev_propinfo_set_default_value_enum(ObjectProperty *op, const PropertyInfo qdev_prop_enum = { .name = "enum", - .get = qdev_propinfo_get_enum, - .set = qdev_propinfo_set_enum, - .set_default_value = qdev_propinfo_set_default_value_enum, + .get = field_prop_get_enum, + .set = field_prop_set_enum, + .set_default_value = field_prop_set_default_value_enum, }; /* Bit */ @@ -278,14 +278,14 @@ static void set_uint8(Object *obj, Visitor *v, const char *name, void *opaque, visit_type_uint8(v, name, ptr, errp); } -void qdev_propinfo_set_default_value_int(ObjectProperty *op, - const Property *prop) +void field_prop_set_default_value_int(ObjectProperty *op, + const Property *prop) { object_property_set_default_int(op, prop->defval.i); } -void qdev_propinfo_set_default_value_uint(ObjectProperty *op, - const Property *prop) +void field_prop_set_default_value_uint(ObjectProperty *op, + const Property *prop) { object_property_set_default_uint(op, prop->defval.u); } @@ -294,7 +294,7 @@ const PropertyInfo qdev_prop_uint8 = { .name = "uint8", .get = get_uint8, .set = set_uint8, - .set_default_value = qdev_propinfo_set_default_value_uint, + .set_default_value = field_prop_set_default_value_uint, }; /* --- 16bit integer --- */ @@ -321,7 +321,7 @@ const PropertyInfo qdev_prop_uint16 = { .name = "uint16", .get = get_uint16, .set = set_uint16, - .set_default_value = qdev_propinfo_set_default_value_uint, + .set_default_value = field_prop_set_default_value_uint, }; /* --- 32bit integer --- */ @@ -344,8 +344,8 @@ static void set_uint32(Object *obj, Visitor *v, const char *name, visit_type_uint32(v, name, ptr, errp); } -void qdev_propinfo_get_int32(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +void field_prop_get_int32(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) { Property *prop = opaque; int32_t *ptr = qdev_get_prop_ptr(obj, prop); @@ -366,14 +366,14 @@ const PropertyInfo qdev_prop_uint32 = { .name = "uint32", .get = get_uint32, .set = set_uint32, - .set_default_value = qdev_propinfo_set_default_value_uint, + .set_default_value = field_prop_set_default_value_uint, }; const PropertyInfo qdev_prop_int32 = { .name = "int32", - .get = qdev_propinfo_get_int32, + .get = field_prop_get_int32, .set = set_int32, - .set_default_value = qdev_propinfo_set_default_value_int, + .set_default_value = field_prop_set_default_value_int, }; /* --- 64bit integer --- */ @@ -418,14 +418,14 @@ const PropertyInfo qdev_prop_uint64 = { .name = "uint64", .get = get_uint64, .set = set_uint64, - .set_default_value = qdev_propinfo_set_default_value_uint, + .set_default_value = field_prop_set_default_value_uint, }; const PropertyInfo qdev_prop_int64 = { .name = "int64", .get = get_int64, .set = set_int64, - .set_default_value = qdev_propinfo_set_default_value_int, + .set_default_value = field_prop_set_default_value_int, }; /* --- string --- */ @@ -477,15 +477,15 @@ const PropertyInfo qdev_prop_on_off_auto = { .name = "OnOffAuto", .description = "on/off/auto", .enum_table = &OnOffAuto_lookup, - .get = qdev_propinfo_get_enum, - .set = qdev_propinfo_set_enum, - .set_default_value = qdev_propinfo_set_default_value_enum, + .get = field_prop_get_enum, + .set = field_prop_set_enum, + .set_default_value = field_prop_set_default_value_enum, }; /* --- 32bit unsigned int 'size' type --- */ -void qdev_propinfo_get_size32(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +void field_prop_get_size32(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) { Property *prop = opaque; uint32_t *ptr = qdev_get_prop_ptr(obj, prop); @@ -518,9 +518,9 @@ static void set_size32(Object *obj, Visitor *v, const char *name, void *opaque, const PropertyInfo qdev_prop_size32 = { .name = "size", - .get = qdev_propinfo_get_size32, + .get = field_prop_get_size32, .set = set_size32, - .set_default_value = qdev_propinfo_set_default_value_uint, + .set_default_value = field_prop_set_default_value_uint, }; /* --- support for array properties --- */ @@ -617,7 +617,7 @@ const PropertyInfo qdev_prop_arraylen = { .name = "uint32", .get = get_uint32, .set = set_prop_arraylen, - .set_default_value = qdev_propinfo_set_default_value_uint, + .set_default_value = field_prop_set_default_value_uint, }; /* --- public helpers --- */ @@ -816,7 +816,7 @@ const PropertyInfo qdev_prop_size = { .name = "size", .get = get_size, .set = set_size, - .set_default_value = qdev_propinfo_set_default_value_uint, + .set_default_value = field_prop_set_default_value_uint, }; /* --- object link property --- */ From patchwork Fri Dec 11 22:05:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1415332 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=IECfTz0S; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Ct5Rx5m0Fz9sVJ for ; Sat, 12 Dec 2020 09:43:57 +1100 (AEDT) Received: from localhost ([::1]:40468 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knr8l-0003es-0r for incoming@patchwork.ozlabs.org; Fri, 11 Dec 2020 17:43:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60678) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqZx-00034S-0i for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:57 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:44766) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqZb-0006mB-RZ for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:07:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724454; 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=ssVB4ZKQeXjPj0kPwgwgUjyGM2Mm4Eg/AnpASc9lPTE=; b=IECfTz0SRIfSexdc4QIbjDDYkKpvoF4UHoT9qlXZ08aZCovuquOeH19IzlQgQI/7/0aAkZ ec+vXrLNno917XsmjWrcckI//bClQz9xSoMj6tybsiH2e8X5QirAsdWgnodf1Y/owkQpGK WMIx8vBtoxT0lwASuHYWyBTZ0HL5oYE= 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-594-7yXpOObOOnmEZBiyUgsWtg-1; Fri, 11 Dec 2020 17:07:32 -0500 X-MC-Unique: 7yXpOObOOnmEZBiyUgsWtg-1 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 2807C100F343; Fri, 11 Dec 2020 22:07:31 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id D8D7A5D742; Fri, 11 Dec 2020 22:07:30 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 28/32] qdev: Move qdev_prop_tpm declaration to tpm_prop.h Date: Fri, 11 Dec 2020 17:05:25 -0500 Message-Id: <20201211220529.2290218-29-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , Stefan Berger , John Snow , Markus Armbruster , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Move the variable declaration close to the macro that uses it. Reviewed-by: Marc-André Lureau Reviewed-by: Stefan Berger Signed-off-by: Eduardo Habkost Reviewed-by: Igor Mammedov --- Cc: Stefan Berger Cc: Paolo Bonzini Cc: "Daniel P. Berrangé" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- hw/tpm/tpm_prop.h | 2 ++ include/hw/qdev-properties.h | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/tpm/tpm_prop.h b/hw/tpm/tpm_prop.h index d19e40c112..bbd4225d66 100644 --- a/hw/tpm/tpm_prop.h +++ b/hw/tpm/tpm_prop.h @@ -25,6 +25,8 @@ #include "sysemu/tpm_backend.h" #include "hw/qdev-properties.h" +extern const PropertyInfo qdev_prop_tpm; + #define DEFINE_PROP_TPMBE(_n, _s, _f) \ DEFINE_PROP(_n, _s, _f, qdev_prop_tpm, TPMBackend *) diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index aae882317a..68e544708b 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -56,7 +56,6 @@ extern const PropertyInfo qdev_prop_uint64; extern const PropertyInfo qdev_prop_int64; extern const PropertyInfo qdev_prop_size; extern const PropertyInfo qdev_prop_string; -extern const PropertyInfo qdev_prop_tpm; extern const PropertyInfo qdev_prop_on_off_auto; extern const PropertyInfo qdev_prop_size32; extern const PropertyInfo qdev_prop_arraylen; From patchwork Fri Dec 11 22:05:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1415336 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=GCZbKPwd; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Ct5Zf5Dk5z9sVJ for ; Sat, 12 Dec 2020 09:49:46 +1100 (AEDT) Received: from localhost ([::1]:48894 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knrEN-0007K3-LN for incoming@patchwork.ozlabs.org; Fri, 11 Dec 2020 17:49:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60792) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqa9-0003Ds-IA for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:08:10 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:34210) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqZk-0006pY-Qv for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:08:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724463; 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=qEmjy/8vk3/5tVoHt3DAuCGhxai+lJk/GoA2h1anmJA=; b=GCZbKPwdA+cBPAaMC1t+/3w02KdZs64NIxvPdz3xGgTZcQFAYjmJMJmAGo3oDPxWkyPOO6 cYmzafYzPpK58RYaX84KzVUj4nG+Sdh334cbXpry8aTj44T0XmAHKARFjzd7ZkVMlILmG7 /hKY/3MPssMvlI48aWyfdIqN2GENBiU= 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-455-6ojzbqprPIum9yEA41rcSg-1; Fri, 11 Dec 2020 17:07:39 -0500 X-MC-Unique: 6ojzbqprPIum9yEA41rcSg-1 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 1DDD419251A0; Fri, 11 Dec 2020 22:07:38 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id EB94460BE5; Fri, 11 Dec 2020 22:07:31 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 29/32] qdev: Rename qdev_prop_* to prop_info_* Date: Fri, 11 Dec 2020 17:05:26 -0500 Message-Id: <20201211220529.2290218-30-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , Dmitry Fleytman , "Daniel P. Berrange" , Yoshinori Sato , John Snow , Jason Wang , Mark Cave-Ayland , Markus Armbruster , Paolo Bonzini , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Artyom Tarasenko , Stefan Berger Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The basic property types in qdev-properties.c are not going to be qdev-specific anymore. Rename the variables to prop_info_*. Signed-off-by: Eduardo Habkost --- Changes v1 -> v2: * Redone patch after moving UUID property to qdev-properties-system.c --- Cc: Paolo Bonzini Cc: "Daniel P. Berrangé" Cc: Eduardo Habkost Cc: Peter Maydell Cc: Yoshinori Sato Cc: Dmitry Fleytman Cc: Jason Wang Cc: Mark Cave-Ayland Cc: Artyom Tarasenko Cc: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org --- include/hw/qdev-properties.h | 62 ++++++++++++++++++------------------ hw/core/qdev-properties.c | 36 ++++++++++----------- hw/intc/arm_gicv3_common.c | 2 +- hw/intc/rx_icu.c | 4 +-- hw/misc/arm_sysctl.c | 4 +-- hw/net/e1000e.c | 6 ++-- target/arm/cpu.c | 2 +- target/sparc/cpu.c | 2 +- 8 files changed, 59 insertions(+), 59 deletions(-) diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 68e544708b..90222822f1 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -44,22 +44,22 @@ struct PropertyInfo { /*** qdev-properties.c ***/ -extern const PropertyInfo qdev_prop_bit; -extern const PropertyInfo qdev_prop_bit64; -extern const PropertyInfo qdev_prop_bool; -extern const PropertyInfo qdev_prop_enum; -extern const PropertyInfo qdev_prop_uint8; -extern const PropertyInfo qdev_prop_uint16; -extern const PropertyInfo qdev_prop_uint32; -extern const PropertyInfo qdev_prop_int32; -extern const PropertyInfo qdev_prop_uint64; -extern const PropertyInfo qdev_prop_int64; -extern const PropertyInfo qdev_prop_size; -extern const PropertyInfo qdev_prop_string; -extern const PropertyInfo qdev_prop_on_off_auto; -extern const PropertyInfo qdev_prop_size32; -extern const PropertyInfo qdev_prop_arraylen; -extern const PropertyInfo qdev_prop_link; +extern const PropertyInfo prop_info_bit; +extern const PropertyInfo prop_info_bit64; +extern const PropertyInfo prop_info_bool; +extern const PropertyInfo prop_info_enum; +extern const PropertyInfo prop_info_uint8; +extern const PropertyInfo prop_info_uint16; +extern const PropertyInfo prop_info_uint32; +extern const PropertyInfo prop_info_int32; +extern const PropertyInfo prop_info_uint64; +extern const PropertyInfo prop_info_int64; +extern const PropertyInfo prop_info_size; +extern const PropertyInfo prop_info_string; +extern const PropertyInfo prop_info_on_off_auto; +extern const PropertyInfo prop_info_size32; +extern const PropertyInfo prop_info_arraylen; +extern const PropertyInfo prop_info_link; #define DEFINE_PROP(_name, _state, _field, _prop, _type, ...) { \ .name = (_name), \ @@ -78,7 +78,7 @@ extern const PropertyInfo qdev_prop_link; DEFINE_PROP(_name, _state, _field, _prop, _type) #define DEFINE_PROP_BIT(_name, _state, _field, _bit, _defval) \ - DEFINE_PROP(_name, _state, _field, qdev_prop_bit, uint32_t, \ + DEFINE_PROP(_name, _state, _field, prop_info_bit, uint32_t, \ .bitnr = (_bit), \ .set_default = true, \ .defval.u = (bool)_defval) @@ -92,13 +92,13 @@ extern const PropertyInfo qdev_prop_link; DEFINE_PROP(_name, _state, _field, _prop, _type) #define DEFINE_PROP_BIT64(_name, _state, _field, _bit, _defval) \ - DEFINE_PROP(_name, _state, _field, qdev_prop_bit64, uint64_t, \ + DEFINE_PROP(_name, _state, _field, prop_info_bit64, uint64_t, \ .bitnr = (_bit), \ .set_default = true, \ .defval.u = (bool)_defval) #define DEFINE_PROP_BOOL(_name, _state, _field, _defval) \ - DEFINE_PROP(_name, _state, _field, qdev_prop_bool, bool, \ + DEFINE_PROP(_name, _state, _field, prop_info_bool, bool, \ .set_default = true, \ .defval.u = (bool)_defval) @@ -131,7 +131,7 @@ extern const PropertyInfo qdev_prop_link; #define DEFINE_PROP_ARRAY(_name, _state, _field, \ _arrayfield, _arrayprop, _arraytype) \ DEFINE_PROP((PROP_ARRAY_LEN_PREFIX _name), \ - _state, _field, qdev_prop_arraylen, uint32_t, \ + _state, _field, prop_info_arraylen, uint32_t, \ .set_default = true, \ .defval.u = 0, \ .arrayinfo = &(_arrayprop), \ @@ -139,29 +139,29 @@ extern const PropertyInfo qdev_prop_link; .arrayoffset = offsetof(_state, _arrayfield)) #define DEFINE_PROP_LINK(_name, _state, _field, _type, _ptr_type) \ - DEFINE_PROP(_name, _state, _field, qdev_prop_link, _ptr_type, \ + DEFINE_PROP(_name, _state, _field, prop_info_link, _ptr_type, \ .link_type = _type) #define DEFINE_PROP_UINT8(_n, _s, _f, _d) \ - DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_uint8, uint8_t) + DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, prop_info_uint8, uint8_t) #define DEFINE_PROP_UINT16(_n, _s, _f, _d) \ - DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_uint16, uint16_t) + DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, prop_info_uint16, uint16_t) #define DEFINE_PROP_UINT32(_n, _s, _f, _d) \ - DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_uint32, uint32_t) + DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, prop_info_uint32, uint32_t) #define DEFINE_PROP_INT32(_n, _s, _f, _d) \ - DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_int32, int32_t) + DEFINE_PROP_SIGNED(_n, _s, _f, _d, prop_info_int32, int32_t) #define DEFINE_PROP_UINT64(_n, _s, _f, _d) \ - DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_uint64, uint64_t) + DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, prop_info_uint64, uint64_t) #define DEFINE_PROP_INT64(_n, _s, _f, _d) \ - DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_int64, int64_t) + DEFINE_PROP_SIGNED(_n, _s, _f, _d, prop_info_int64, int64_t) #define DEFINE_PROP_SIZE(_n, _s, _f, _d) \ - DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_size, uint64_t) + DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, prop_info_size, uint64_t) #define DEFINE_PROP_STRING(_n, _s, _f) \ - DEFINE_PROP(_n, _s, _f, qdev_prop_string, char*) + DEFINE_PROP(_n, _s, _f, prop_info_string, char*) #define DEFINE_PROP_ON_OFF_AUTO(_n, _s, _f, _d) \ - DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_on_off_auto, OnOffAuto) + DEFINE_PROP_SIGNED(_n, _s, _f, _d, prop_info_on_off_auto, OnOffAuto) #define DEFINE_PROP_SIZE32(_n, _s, _f, _d) \ - DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_size32, uint32_t) + DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, prop_info_size32, uint32_t) #define DEFINE_PROP_END_OF_LIST() \ {} diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index d2f565f552..c1dd4ae71b 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -121,7 +121,7 @@ void field_prop_set_default_value_enum(ObjectProperty *op, qapi_enum_lookup(prop->info->enum_table, prop->defval.i)); } -const PropertyInfo qdev_prop_enum = { +const PropertyInfo prop_info_enum = { .name = "enum", .get = field_prop_get_enum, .set = field_prop_set_enum, @@ -132,7 +132,7 @@ const PropertyInfo qdev_prop_enum = { static uint32_t qdev_get_prop_mask(Property *prop) { - assert(prop->info == &qdev_prop_bit); + assert(prop->info == &prop_info_bit); return 0x1 << prop->bitnr; } @@ -174,7 +174,7 @@ static void set_default_value_bool(ObjectProperty *op, const Property *prop) object_property_set_default_bool(op, prop->defval.u); } -const PropertyInfo qdev_prop_bit = { +const PropertyInfo prop_info_bit = { .name = "bool", .description = "on/off", .get = prop_get_bit, @@ -186,7 +186,7 @@ const PropertyInfo qdev_prop_bit = { static uint64_t qdev_get_prop_mask64(Property *prop) { - assert(prop->info == &qdev_prop_bit64); + assert(prop->info == &prop_info_bit64); return 0x1ull << prop->bitnr; } @@ -223,7 +223,7 @@ static void prop_set_bit64(Object *obj, Visitor *v, const char *name, bit64_prop_set(obj, prop, value); } -const PropertyInfo qdev_prop_bit64 = { +const PropertyInfo prop_info_bit64 = { .name = "bool", .description = "on/off", .get = prop_get_bit64, @@ -251,7 +251,7 @@ static void set_bool(Object *obj, Visitor *v, const char *name, void *opaque, visit_type_bool(v, name, ptr, errp); } -const PropertyInfo qdev_prop_bool = { +const PropertyInfo prop_info_bool = { .name = "bool", .get = get_bool, .set = set_bool, @@ -290,7 +290,7 @@ void field_prop_set_default_value_uint(ObjectProperty *op, object_property_set_default_uint(op, prop->defval.u); } -const PropertyInfo qdev_prop_uint8 = { +const PropertyInfo prop_info_uint8 = { .name = "uint8", .get = get_uint8, .set = set_uint8, @@ -317,7 +317,7 @@ static void set_uint16(Object *obj, Visitor *v, const char *name, visit_type_uint16(v, name, ptr, errp); } -const PropertyInfo qdev_prop_uint16 = { +const PropertyInfo prop_info_uint16 = { .name = "uint16", .get = get_uint16, .set = set_uint16, @@ -362,14 +362,14 @@ static void set_int32(Object *obj, Visitor *v, const char *name, void *opaque, visit_type_int32(v, name, ptr, errp); } -const PropertyInfo qdev_prop_uint32 = { +const PropertyInfo prop_info_uint32 = { .name = "uint32", .get = get_uint32, .set = set_uint32, .set_default_value = field_prop_set_default_value_uint, }; -const PropertyInfo qdev_prop_int32 = { +const PropertyInfo prop_info_int32 = { .name = "int32", .get = field_prop_get_int32, .set = set_int32, @@ -414,14 +414,14 @@ static void set_int64(Object *obj, Visitor *v, const char *name, visit_type_int64(v, name, ptr, errp); } -const PropertyInfo qdev_prop_uint64 = { +const PropertyInfo prop_info_uint64 = { .name = "uint64", .get = get_uint64, .set = set_uint64, .set_default_value = field_prop_set_default_value_uint, }; -const PropertyInfo qdev_prop_int64 = { +const PropertyInfo prop_info_int64 = { .name = "int64", .get = get_int64, .set = set_int64, @@ -464,7 +464,7 @@ static void set_string(Object *obj, Visitor *v, const char *name, *ptr = str; } -const PropertyInfo qdev_prop_string = { +const PropertyInfo prop_info_string = { .name = "str", .release = release_string, .get = get_string, @@ -473,7 +473,7 @@ const PropertyInfo qdev_prop_string = { /* --- on/off/auto --- */ -const PropertyInfo qdev_prop_on_off_auto = { +const PropertyInfo prop_info_on_off_auto = { .name = "OnOffAuto", .description = "on/off/auto", .enum_table = &OnOffAuto_lookup, @@ -516,7 +516,7 @@ static void set_size32(Object *obj, Visitor *v, const char *name, void *opaque, *ptr = value; } -const PropertyInfo qdev_prop_size32 = { +const PropertyInfo prop_info_size32 = { .name = "size", .get = field_prop_get_size32, .set = set_size32, @@ -613,7 +613,7 @@ static void set_prop_arraylen(Object *obj, Visitor *v, const char *name, } } -const PropertyInfo qdev_prop_arraylen = { +const PropertyInfo prop_info_arraylen = { .name = "uint32", .get = get_uint32, .set = set_prop_arraylen, @@ -812,7 +812,7 @@ static void set_size(Object *obj, Visitor *v, const char *name, void *opaque, visit_type_size(v, name, ptr, errp); } -const PropertyInfo qdev_prop_size = { +const PropertyInfo prop_info_size = { .name = "size", .get = get_size, .set = set_size, @@ -830,7 +830,7 @@ static ObjectProperty *create_link_property(ObjectClass *oc, const char *name, OBJ_PROP_LINK_STRONG); } -const PropertyInfo qdev_prop_link = { +const PropertyInfo prop_info_link = { .name = "link", .create = create_link_property, }; diff --git a/hw/intc/arm_gicv3_common.c b/hw/intc/arm_gicv3_common.c index 58ef65f589..6d06b4d4c5 100644 --- a/hw/intc/arm_gicv3_common.c +++ b/hw/intc/arm_gicv3_common.c @@ -496,7 +496,7 @@ static Property arm_gicv3_common_properties[] = { DEFINE_PROP_UINT32("revision", GICv3State, revision, 3), DEFINE_PROP_BOOL("has-security-extensions", GICv3State, security_extn, 0), DEFINE_PROP_ARRAY("redist-region-count", GICv3State, nb_redist_regions, - redist_region_count, qdev_prop_uint32, uint32_t), + redist_region_count, prop_info_uint32, uint32_t), DEFINE_PROP_END_OF_LIST(), }; diff --git a/hw/intc/rx_icu.c b/hw/intc/rx_icu.c index e5c01807b9..dde05eaf8b 100644 --- a/hw/intc/rx_icu.c +++ b/hw/intc/rx_icu.c @@ -363,9 +363,9 @@ static const VMStateDescription vmstate_rxicu = { static Property rxicu_properties[] = { DEFINE_PROP_ARRAY("ipr-map", RXICUState, nr_irqs, map, - qdev_prop_uint8, uint8_t), + prop_info_uint8, uint8_t), DEFINE_PROP_ARRAY("trigger-level", RXICUState, nr_sense, init_sense, - qdev_prop_uint8, uint8_t), + prop_info_uint8, uint8_t), DEFINE_PROP_END_OF_LIST(), }; diff --git a/hw/misc/arm_sysctl.c b/hw/misc/arm_sysctl.c index 42d4693854..634f3d916f 100644 --- a/hw/misc/arm_sysctl.c +++ b/hw/misc/arm_sysctl.c @@ -628,10 +628,10 @@ static Property arm_sysctl_properties[] = { DEFINE_PROP_UINT32("proc_id", arm_sysctl_state, proc_id, 0), /* Daughterboard power supply voltages (as reported via SYS_CFG) */ DEFINE_PROP_ARRAY("db-voltage", arm_sysctl_state, db_num_vsensors, - db_voltage, qdev_prop_uint32, uint32_t), + db_voltage, prop_info_uint32, uint32_t), /* Daughterboard clock reset values (as reported via SYS_CFG) */ DEFINE_PROP_ARRAY("db-clock", arm_sysctl_state, db_num_clocks, - db_clock_reset, qdev_prop_uint32, uint32_t), + db_clock_reset, prop_info_uint32, uint32_t), DEFINE_PROP_END_OF_LIST(), }; diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c index a8a77eca95..9d2f471c7c 100644 --- a/hw/net/e1000e.c +++ b/hw/net/e1000e.c @@ -686,15 +686,15 @@ static void e1000e_class_init(ObjectClass *class, void *data) dc->reset = e1000e_qdev_reset; dc->vmsd = &e1000e_vmstate; - e1000e_prop_disable_vnet = qdev_prop_uint8; + e1000e_prop_disable_vnet = prop_info_uint8; e1000e_prop_disable_vnet.description = "Do not use virtio headers, " "perform SW offloads emulation " "instead"; - e1000e_prop_subsys_ven = qdev_prop_uint16; + e1000e_prop_subsys_ven = prop_info_uint16; e1000e_prop_subsys_ven.description = "PCI device Subsystem Vendor ID"; - e1000e_prop_subsys = qdev_prop_uint16; + e1000e_prop_subsys = prop_info_uint16; e1000e_prop_subsys.description = "PCI device Subsystem ID"; device_class_set_props(dc, e1000e_properties); diff --git a/target/arm/cpu.c b/target/arm/cpu.c index d6188f6566..bb34ff1aab 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1111,7 +1111,7 @@ static Property arm_cpu_has_mpu_property = static Property arm_cpu_pmsav7_dregion_property = DEFINE_PROP_UNSIGNED_NODEFAULT("pmsav7-dregion", ARMCPU, pmsav7_dregion, - qdev_prop_uint32, uint32_t); + prop_info_uint32, uint32_t); static bool arm_get_pmu(Object *obj, Error **errp) { diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index b730146bbe..0da2190cac 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -839,7 +839,7 @@ static Property sparc_cpu_properties[] = { DEFINE_PROP_BIT("cmt", SPARCCPU, env.def.features, 12, false), DEFINE_PROP_BIT("gl", SPARCCPU, env.def.features, 13, false), DEFINE_PROP_UNSIGNED("iu-version", SPARCCPU, env.def.iu_version, 0, - qdev_prop_uint64, target_ulong), + prop_info_uint64, target_ulong), DEFINE_PROP_UINT32("fpu-version", SPARCCPU, env.def.fpu_version, 0), DEFINE_PROP_UINT32("mmu-version", SPARCCPU, env.def.mmu_version, 0), DEFINE_PROP("nwindows", SPARCCPU, env.def.nwindows, From patchwork Fri Dec 11 22:05:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1415339 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=edl7Bemg; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Ct5hq1D2Mz9sVJ for ; Sat, 12 Dec 2020 09:55:07 +1100 (AEDT) Received: from localhost ([::1]:58482 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knrJZ-0003Ot-46 for incoming@patchwork.ozlabs.org; Fri, 11 Dec 2020 17:55:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60914) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqaH-0003Jk-LY for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:08:17 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:47350) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqZs-0006rH-Fi for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:08:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724470; 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=/5ZoGD/Z4aeOrYeqXoenztMGPJ1MAS8OAd9A0/6z3M4=; b=edl7Bemg9YD6rXwsfja9KIW/5uDnZNY3cl45WYOyhEQv/bz21greTGX/68N8wFOWB/8uIO hpu05pd5Xnk2sNiNldHlQiZTvU0NR1K1hN0P08C37ZPdaJe5XgL8W5t2zBzGSti710w2Vm vEP6KQLFDLzwiRe/9LCKukYtCiPUJSU= 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-536-YzaAqyL8PFaykowR_ziKuw-1; Fri, 11 Dec 2020 17:07:49 -0500 X-MC-Unique: YzaAqyL8PFaykowR_ziKuw-1 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 20688C294; Fri, 11 Dec 2020 22:07:47 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id CFBD25C8AA; Fri, 11 Dec 2020 22:07:38 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 30/32] qdev: Rename qdev_get_prop_ptr() to object_field_prop_ptr() Date: Fri, 11 Dec 2020 17:05:27 -0500 Message-Id: <20201211220529.2290218-31-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matthew Rosato , Paul Durrant , Stefano Stabellini , xen-devel@lists.xenproject.org, qemu-block@nongnu.org, Stefan Berger , David Hildenbrand , Markus Armbruster , Halil Pasic , Christian Borntraeger , Anthony Perard , =?utf-8?q?Marc-Andr=C3=A9_Lurea?= =?utf-8?q?u?= , =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= , Thomas Huth , Alex Williamson , Igor Mammedov , John Snow , Richard Henderson , Kevin Wolf , "Daniel P. Berrange" , Cornelia Huck , qemu-s390x@nongnu.org, Max Reitz , Paolo Bonzini , Stefan Berger Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The function will be moved to common QOM code, as it is not specific to TYPE_DEVICE anymore. Reviewed-by: Stefan Berger Signed-off-by: Eduardo Habkost Acked-by: Paul Durrant Reviewed-by: Cornelia Huck Reviewed-by: Igor Mammedov --- Changes v1 -> v2: * Rename to object_field_prop_ptr() instead of object_static_prop_ptr() --- Cc: Stefan Berger Cc: Stefano Stabellini Cc: Anthony Perard Cc: Paul Durrant Cc: Kevin Wolf Cc: Max Reitz Cc: Paolo Bonzini Cc: "Daniel P. Berrangé" Cc: Eduardo Habkost Cc: Cornelia Huck Cc: Halil Pasic Cc: Christian Borntraeger Cc: Richard Henderson Cc: David Hildenbrand Cc: Thomas Huth Cc: Matthew Rosato Cc: Alex Williamson Cc: qemu-devel@nongnu.org Cc: xen-devel@lists.xenproject.org Cc: qemu-block@nongnu.org Cc: qemu-s390x@nongnu.org --- include/hw/qdev-properties.h | 2 +- backends/tpm/tpm_util.c | 6 ++-- hw/block/xen-block.c | 4 +-- hw/core/qdev-properties-system.c | 50 +++++++++++++------------- hw/core/qdev-properties.c | 60 ++++++++++++++++---------------- hw/s390x/css.c | 4 +-- hw/s390x/s390-pci-bus.c | 4 +-- hw/vfio/pci-quirks.c | 4 +-- 8 files changed, 67 insertions(+), 67 deletions(-) diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 90222822f1..97bb9494ae 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -193,7 +193,7 @@ 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); -void *qdev_get_prop_ptr(Object *obj, Property *prop); +void *object_field_prop_ptr(Object *obj, Property *prop); void qdev_prop_register_global(GlobalProperty *prop); const GlobalProperty *qdev_find_global_prop(Object *obj, diff --git a/backends/tpm/tpm_util.c b/backends/tpm/tpm_util.c index 39b45fa46d..a6e6d3e72f 100644 --- a/backends/tpm/tpm_util.c +++ b/backends/tpm/tpm_util.c @@ -35,7 +35,7 @@ static void get_tpm(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - TPMBackend **be = qdev_get_prop_ptr(obj, opaque); + TPMBackend **be = object_field_prop_ptr(obj, opaque); char *p; p = g_strdup(*be ? (*be)->id : ""); @@ -47,7 +47,7 @@ static void set_tpm(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - TPMBackend *s, **be = qdev_get_prop_ptr(obj, prop); + TPMBackend *s, **be = object_field_prop_ptr(obj, prop); char *str; if (!visit_type_str(v, name, &str, errp)) { @@ -67,7 +67,7 @@ static void set_tpm(Object *obj, Visitor *v, const char *name, void *opaque, static void release_tpm(Object *obj, const char *name, void *opaque) { Property *prop = opaque; - TPMBackend **be = qdev_get_prop_ptr(obj, prop); + TPMBackend **be = object_field_prop_ptr(obj, prop); if (*be) { tpm_backend_reset(*be); diff --git a/hw/block/xen-block.c b/hw/block/xen-block.c index bd1aef63a7..718d886e5c 100644 --- a/hw/block/xen-block.c +++ b/hw/block/xen-block.c @@ -336,7 +336,7 @@ static void xen_block_get_vdev(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - XenBlockVdev *vdev = qdev_get_prop_ptr(obj, prop); + XenBlockVdev *vdev = object_field_prop_ptr(obj, prop); char *str; switch (vdev->type) { @@ -396,7 +396,7 @@ static void xen_block_set_vdev(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - XenBlockVdev *vdev = qdev_get_prop_ptr(obj, prop); + XenBlockVdev *vdev = object_field_prop_ptr(obj, prop); char *str, *p; const char *end; diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c index 590c5f3d97..e6d378a34e 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -62,7 +62,7 @@ static void get_drive(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - void **ptr = qdev_get_prop_ptr(obj, prop); + void **ptr = object_field_prop_ptr(obj, prop); const char *value; char *p; @@ -88,7 +88,7 @@ static void set_drive_helper(Object *obj, Visitor *v, const char *name, { DeviceState *dev = DEVICE(obj); Property *prop = opaque; - void **ptr = qdev_get_prop_ptr(obj, prop); + void **ptr = object_field_prop_ptr(obj, prop); char *str; BlockBackend *blk; bool blk_created = false; @@ -181,7 +181,7 @@ static void release_drive(Object *obj, const char *name, void *opaque) { DeviceState *dev = DEVICE(obj); Property *prop = opaque; - BlockBackend **ptr = qdev_get_prop_ptr(obj, prop); + BlockBackend **ptr = object_field_prop_ptr(obj, prop); if (*ptr) { AioContext *ctx = blk_get_aio_context(*ptr); @@ -214,7 +214,7 @@ const PropertyInfo qdev_prop_drive_iothread = { static void get_chr(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - CharBackend *be = qdev_get_prop_ptr(obj, opaque); + CharBackend *be = object_field_prop_ptr(obj, opaque); char *p; p = g_strdup(be->chr && be->chr->label ? be->chr->label : ""); @@ -226,7 +226,7 @@ static void set_chr(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - CharBackend *be = qdev_get_prop_ptr(obj, prop); + CharBackend *be = object_field_prop_ptr(obj, prop); Chardev *s; char *str; @@ -262,7 +262,7 @@ static void set_chr(Object *obj, Visitor *v, const char *name, void *opaque, static void release_chr(Object *obj, const char *name, void *opaque) { Property *prop = opaque; - CharBackend *be = qdev_get_prop_ptr(obj, prop); + CharBackend *be = object_field_prop_ptr(obj, prop); qemu_chr_fe_deinit(be, false); } @@ -286,7 +286,7 @@ static void get_mac(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - MACAddr *mac = qdev_get_prop_ptr(obj, prop); + MACAddr *mac = object_field_prop_ptr(obj, prop); char buffer[2 * 6 + 5 + 1]; char *p = buffer; @@ -301,7 +301,7 @@ static void set_mac(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - MACAddr *mac = qdev_get_prop_ptr(obj, prop); + MACAddr *mac = object_field_prop_ptr(obj, prop); int i, pos; char *str; const char *p; @@ -363,7 +363,7 @@ static void get_netdev(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - NICPeers *peers_ptr = qdev_get_prop_ptr(obj, prop); + NICPeers *peers_ptr = object_field_prop_ptr(obj, prop); char *p = g_strdup(peers_ptr->ncs[0] ? peers_ptr->ncs[0]->name : ""); visit_type_str(v, name, &p, errp); @@ -374,7 +374,7 @@ static void set_netdev(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - NICPeers *peers_ptr = qdev_get_prop_ptr(obj, prop); + NICPeers *peers_ptr = object_field_prop_ptr(obj, prop); NetClientState **ncs = peers_ptr->ncs; NetClientState *peers[MAX_QUEUE_NUM]; int queues, err = 0, i = 0; @@ -436,7 +436,7 @@ static void get_audiodev(Object *obj, Visitor *v, const char* name, void *opaque, Error **errp) { Property *prop = opaque; - QEMUSoundCard *card = qdev_get_prop_ptr(obj, prop); + QEMUSoundCard *card = object_field_prop_ptr(obj, prop); char *p = g_strdup(audio_get_id(card)); visit_type_str(v, name, &p, errp); @@ -447,7 +447,7 @@ static void set_audiodev(Object *obj, Visitor *v, const char* name, void *opaque, Error **errp) { Property *prop = opaque; - QEMUSoundCard *card = qdev_get_prop_ptr(obj, prop); + QEMUSoundCard *card = object_field_prop_ptr(obj, prop); AudioState *state; int err = 0; char *str; @@ -549,7 +549,7 @@ static void set_blocksize(Object *obj, Visitor *v, const char *name, { DeviceState *dev = DEVICE(obj); Property *prop = opaque; - uint32_t *ptr = qdev_get_prop_ptr(obj, prop); + uint32_t *ptr = object_field_prop_ptr(obj, prop); uint64_t value; Error *local_err = NULL; @@ -637,7 +637,7 @@ static void get_reserved_region(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - ReservedRegion *rr = qdev_get_prop_ptr(obj, prop); + ReservedRegion *rr = object_field_prop_ptr(obj, prop); char buffer[64]; char *p = buffer; int rc; @@ -653,7 +653,7 @@ static void set_reserved_region(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - ReservedRegion *rr = qdev_get_prop_ptr(obj, prop); + ReservedRegion *rr = object_field_prop_ptr(obj, prop); Error *local_err = NULL; const char *endptr; char *str; @@ -715,7 +715,7 @@ static void set_pci_devfn(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - int32_t value, *ptr = qdev_get_prop_ptr(obj, prop); + int32_t value, *ptr = object_field_prop_ptr(obj, prop); unsigned int slot, fn, n; char *str; @@ -753,7 +753,7 @@ invalid: static int print_pci_devfn(Object *obj, Property *prop, char *dest, size_t len) { - int32_t *ptr = qdev_get_prop_ptr(obj, prop); + int32_t *ptr = object_field_prop_ptr(obj, prop); if (*ptr == -1) { return snprintf(dest, len, ""); @@ -777,7 +777,7 @@ static void get_pci_host_devaddr(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - PCIHostDeviceAddress *addr = qdev_get_prop_ptr(obj, prop); + PCIHostDeviceAddress *addr = object_field_prop_ptr(obj, prop); char buffer[] = "ffff:ff:ff.f"; char *p = buffer; int rc = 0; @@ -803,7 +803,7 @@ static void set_pci_host_devaddr(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - PCIHostDeviceAddress *addr = qdev_get_prop_ptr(obj, prop); + PCIHostDeviceAddress *addr = object_field_prop_ptr(obj, prop); char *str, *p; char *e; unsigned long val; @@ -893,7 +893,7 @@ static void get_prop_pcielinkspeed(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - PCIExpLinkSpeed *p = qdev_get_prop_ptr(obj, prop); + PCIExpLinkSpeed *p = object_field_prop_ptr(obj, prop); int speed; switch (*p) { @@ -921,7 +921,7 @@ static void set_prop_pcielinkspeed(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - PCIExpLinkSpeed *p = qdev_get_prop_ptr(obj, prop); + PCIExpLinkSpeed *p = object_field_prop_ptr(obj, prop); int speed; if (!visit_type_enum(v, name, &speed, prop->info->enum_table, @@ -963,7 +963,7 @@ static void get_prop_pcielinkwidth(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - PCIExpLinkWidth *p = qdev_get_prop_ptr(obj, prop); + PCIExpLinkWidth *p = object_field_prop_ptr(obj, prop); int width; switch (*p) { @@ -1000,7 +1000,7 @@ static void set_prop_pcielinkwidth(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - PCIExpLinkWidth *p = qdev_get_prop_ptr(obj, prop); + PCIExpLinkWidth *p = object_field_prop_ptr(obj, prop); int width; if (!visit_type_enum(v, name, &width, prop->info->enum_table, @@ -1051,7 +1051,7 @@ static void get_uuid(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - QemuUUID *uuid = qdev_get_prop_ptr(obj, prop); + QemuUUID *uuid = object_field_prop_ptr(obj, prop); char buffer[UUID_FMT_LEN + 1]; char *p = buffer; @@ -1066,7 +1066,7 @@ static void set_uuid(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - QemuUUID *uuid = qdev_get_prop_ptr(obj, prop); + QemuUUID *uuid = object_field_prop_ptr(obj, prop); char *str; if (!visit_type_str(v, name, &str, errp)) { diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index c1dd4ae71b..3d648b088d 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -50,7 +50,7 @@ void qdev_prop_allow_set_link_before_realize(const Object *obj, } } -void *qdev_get_prop_ptr(Object *obj, Property *prop) +void *object_field_prop_ptr(Object *obj, Property *prop) { void *ptr = obj; ptr += prop->offset; @@ -100,7 +100,7 @@ void field_prop_get_enum(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - int *ptr = qdev_get_prop_ptr(obj, prop); + int *ptr = object_field_prop_ptr(obj, prop); visit_type_enum(v, name, ptr, prop->info->enum_table, errp); } @@ -109,7 +109,7 @@ void field_prop_set_enum(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - int *ptr = qdev_get_prop_ptr(obj, prop); + int *ptr = object_field_prop_ptr(obj, prop); visit_type_enum(v, name, ptr, prop->info->enum_table, errp); } @@ -138,7 +138,7 @@ static uint32_t qdev_get_prop_mask(Property *prop) static void bit_prop_set(Object *obj, Property *props, bool val) { - uint32_t *p = qdev_get_prop_ptr(obj, props); + uint32_t *p = object_field_prop_ptr(obj, props); uint32_t mask = qdev_get_prop_mask(props); if (val) { *p |= mask; @@ -151,7 +151,7 @@ static void prop_get_bit(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - uint32_t *p = qdev_get_prop_ptr(obj, prop); + uint32_t *p = object_field_prop_ptr(obj, prop); bool value = (*p & qdev_get_prop_mask(prop)) != 0; visit_type_bool(v, name, &value, errp); @@ -192,7 +192,7 @@ static uint64_t qdev_get_prop_mask64(Property *prop) static void bit64_prop_set(Object *obj, Property *props, bool val) { - uint64_t *p = qdev_get_prop_ptr(obj, props); + uint64_t *p = object_field_prop_ptr(obj, props); uint64_t mask = qdev_get_prop_mask64(props); if (val) { *p |= mask; @@ -205,7 +205,7 @@ static void prop_get_bit64(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - uint64_t *p = qdev_get_prop_ptr(obj, prop); + uint64_t *p = object_field_prop_ptr(obj, prop); bool value = (*p & qdev_get_prop_mask64(prop)) != 0; visit_type_bool(v, name, &value, errp); @@ -237,7 +237,7 @@ static void get_bool(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - bool *ptr = qdev_get_prop_ptr(obj, prop); + bool *ptr = object_field_prop_ptr(obj, prop); visit_type_bool(v, name, ptr, errp); } @@ -246,7 +246,7 @@ static void set_bool(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - bool *ptr = qdev_get_prop_ptr(obj, prop); + bool *ptr = object_field_prop_ptr(obj, prop); visit_type_bool(v, name, ptr, errp); } @@ -264,7 +264,7 @@ static void get_uint8(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - uint8_t *ptr = qdev_get_prop_ptr(obj, prop); + uint8_t *ptr = object_field_prop_ptr(obj, prop); visit_type_uint8(v, name, ptr, errp); } @@ -273,7 +273,7 @@ static void set_uint8(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - uint8_t *ptr = qdev_get_prop_ptr(obj, prop); + uint8_t *ptr = object_field_prop_ptr(obj, prop); visit_type_uint8(v, name, ptr, errp); } @@ -303,7 +303,7 @@ static void get_uint16(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - uint16_t *ptr = qdev_get_prop_ptr(obj, prop); + uint16_t *ptr = object_field_prop_ptr(obj, prop); visit_type_uint16(v, name, ptr, errp); } @@ -312,7 +312,7 @@ static void set_uint16(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - uint16_t *ptr = qdev_get_prop_ptr(obj, prop); + uint16_t *ptr = object_field_prop_ptr(obj, prop); visit_type_uint16(v, name, ptr, errp); } @@ -330,7 +330,7 @@ static void get_uint32(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - uint32_t *ptr = qdev_get_prop_ptr(obj, prop); + uint32_t *ptr = object_field_prop_ptr(obj, prop); visit_type_uint32(v, name, ptr, errp); } @@ -339,7 +339,7 @@ static void set_uint32(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - uint32_t *ptr = qdev_get_prop_ptr(obj, prop); + uint32_t *ptr = object_field_prop_ptr(obj, prop); visit_type_uint32(v, name, ptr, errp); } @@ -348,7 +348,7 @@ void field_prop_get_int32(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - int32_t *ptr = qdev_get_prop_ptr(obj, prop); + int32_t *ptr = object_field_prop_ptr(obj, prop); visit_type_int32(v, name, ptr, errp); } @@ -357,7 +357,7 @@ static void set_int32(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - int32_t *ptr = qdev_get_prop_ptr(obj, prop); + int32_t *ptr = object_field_prop_ptr(obj, prop); visit_type_int32(v, name, ptr, errp); } @@ -382,7 +382,7 @@ static void get_uint64(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - uint64_t *ptr = qdev_get_prop_ptr(obj, prop); + uint64_t *ptr = object_field_prop_ptr(obj, prop); visit_type_uint64(v, name, ptr, errp); } @@ -391,7 +391,7 @@ static void set_uint64(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - uint64_t *ptr = qdev_get_prop_ptr(obj, prop); + uint64_t *ptr = object_field_prop_ptr(obj, prop); visit_type_uint64(v, name, ptr, errp); } @@ -400,7 +400,7 @@ static void get_int64(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - int64_t *ptr = qdev_get_prop_ptr(obj, prop); + int64_t *ptr = object_field_prop_ptr(obj, prop); visit_type_int64(v, name, ptr, errp); } @@ -409,7 +409,7 @@ static void set_int64(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - int64_t *ptr = qdev_get_prop_ptr(obj, prop); + int64_t *ptr = object_field_prop_ptr(obj, prop); visit_type_int64(v, name, ptr, errp); } @@ -433,14 +433,14 @@ const PropertyInfo prop_info_int64 = { static void release_string(Object *obj, const char *name, void *opaque) { Property *prop = opaque; - g_free(*(char **)qdev_get_prop_ptr(obj, prop)); + g_free(*(char **)object_field_prop_ptr(obj, prop)); } static void get_string(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - char **ptr = qdev_get_prop_ptr(obj, prop); + char **ptr = object_field_prop_ptr(obj, prop); if (!*ptr) { char *str = (char *)""; @@ -454,7 +454,7 @@ static void set_string(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - char **ptr = qdev_get_prop_ptr(obj, prop); + char **ptr = object_field_prop_ptr(obj, prop); char *str; if (!visit_type_str(v, name, &str, errp)) { @@ -488,7 +488,7 @@ void field_prop_get_size32(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - uint32_t *ptr = qdev_get_prop_ptr(obj, prop); + uint32_t *ptr = object_field_prop_ptr(obj, prop); uint64_t value = *ptr; visit_type_size(v, name, &value, errp); @@ -498,7 +498,7 @@ static void set_size32(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - uint32_t *ptr = qdev_get_prop_ptr(obj, prop); + uint32_t *ptr = object_field_prop_ptr(obj, prop); uint64_t value; if (!visit_type_size(v, name, &value, errp)) { @@ -561,7 +561,7 @@ static void set_prop_arraylen(Object *obj, Visitor *v, const char *name, */ DeviceState *dev = DEVICE(obj); Property *prop = opaque; - uint32_t *alenptr = qdev_get_prop_ptr(obj, prop); + uint32_t *alenptr = object_field_prop_ptr(obj, prop); void **arrayptr = (void *)dev + prop->arrayoffset; void *eltptr; const char *arrayname; @@ -603,7 +603,7 @@ static void set_prop_arraylen(Object *obj, Visitor *v, const char *name, * being inside the device struct. */ arrayprop->prop.offset = eltptr - (void *)dev; - assert(qdev_get_prop_ptr(obj, &arrayprop->prop) == eltptr); + assert(object_field_prop_ptr(obj, &arrayprop->prop) == eltptr); object_property_add(obj, propname, arrayprop->prop.info->name, field_prop_getter(arrayprop->prop.info), @@ -798,7 +798,7 @@ static void get_size(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - uint64_t *ptr = qdev_get_prop_ptr(obj, prop); + uint64_t *ptr = object_field_prop_ptr(obj, prop); visit_type_size(v, name, ptr, errp); } @@ -807,7 +807,7 @@ static void set_size(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - uint64_t *ptr = qdev_get_prop_ptr(obj, prop); + uint64_t *ptr = object_field_prop_ptr(obj, prop); visit_type_size(v, name, ptr, errp); } diff --git a/hw/s390x/css.c b/hw/s390x/css.c index 496e2c5801..fe47751df4 100644 --- a/hw/s390x/css.c +++ b/hw/s390x/css.c @@ -2344,7 +2344,7 @@ static void get_css_devid(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - CssDevId *dev_id = qdev_get_prop_ptr(obj, prop); + CssDevId *dev_id = object_field_prop_ptr(obj, prop); char buffer[] = "xx.x.xxxx"; char *p = buffer; int r; @@ -2373,7 +2373,7 @@ static void set_css_devid(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - CssDevId *dev_id = qdev_get_prop_ptr(obj, prop); + CssDevId *dev_id = object_field_prop_ptr(obj, prop); char *str; int num, n1, n2; unsigned int cssid, ssid, devid; diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index 30511f620e..dd138dae94 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -1330,7 +1330,7 @@ static void s390_pci_get_fid(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { Property *prop = opaque; - uint32_t *ptr = qdev_get_prop_ptr(obj, prop); + uint32_t *ptr = object_field_prop_ptr(obj, prop); visit_type_uint32(v, name, ptr, errp); } @@ -1340,7 +1340,7 @@ static void s390_pci_set_fid(Object *obj, Visitor *v, const char *name, { S390PCIBusDevice *zpci = S390_PCI_DEVICE(obj); Property *prop = opaque; - uint32_t *ptr = qdev_get_prop_ptr(obj, prop); + uint32_t *ptr = object_field_prop_ptr(obj, prop); if (!visit_type_uint32(v, name, ptr, errp)) { return; diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c index 802979635c..fc8d63c850 100644 --- a/hw/vfio/pci-quirks.c +++ b/hw/vfio/pci-quirks.c @@ -1489,7 +1489,7 @@ static void get_nv_gpudirect_clique_id(Object *obj, Visitor *v, Error **errp) { Property *prop = opaque; - uint8_t *ptr = qdev_get_prop_ptr(obj, prop); + uint8_t *ptr = object_field_prop_ptr(obj, prop); visit_type_uint8(v, name, ptr, errp); } @@ -1499,7 +1499,7 @@ static void set_nv_gpudirect_clique_id(Object *obj, Visitor *v, Error **errp) { Property *prop = opaque; - uint8_t value, *ptr = qdev_get_prop_ptr(obj, prop); + uint8_t value, *ptr = object_field_prop_ptr(obj, prop); if (!visit_type_uint8(v, name, &value, errp)) { return; From patchwork Fri Dec 11 22:05:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1415338 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=PRgcoQoD; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Ct5h747nxz9sVJ for ; Sat, 12 Dec 2020 09:54:31 +1100 (AEDT) Received: from localhost ([::1]:57228 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knrIz-0002pr-II for incoming@patchwork.ozlabs.org; Fri, 11 Dec 2020 17:54:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60886) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqaG-0003IV-DY for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:08:16 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:24090) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqZv-0006sa-6k for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:08:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724474; 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=aKfie8HDs4Bj5KUMmmQqgBylUh0kwLqLFFOC3bbKRvM=; b=PRgcoQoD6wsVXqM44d6LXXcAjdoKRGN/AFZ0XpiUY8/zd7aMXG1llu0kst0IIvxthPWELi AajpRTCIK1RiByeHGfliLt15ALO4qu47P7QKqSfyX1Y/AcNIa0CXoeY/ZHJtE2mX7DfBWh yP50F6AkRqCgiXbChW4VQrm12hNq/fg= 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-162-iKOqZwxBMPmdpSl-0f-5Iw-1; Fri, 11 Dec 2020 17:07:52 -0500 X-MC-Unique: iKOqZwxBMPmdpSl-0f-5Iw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E556A107ACE3; Fri, 11 Dec 2020 22:07:51 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 08E3C5D9E2; Fri, 11 Dec 2020 22:07:47 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 31/32] qdev: Avoid unnecessary DeviceState* variable at set_prop_arraylen() Date: Fri, 11 Dec 2020 17:05:28 -0500 Message-Id: <20201211220529.2290218-32-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" We're just doing pointer math with the device pointer, we can simply use obj instead. Reviewed-by: Marc-André Lureau Signed-off-by: Eduardo Habkost Reviewed-by: Igor Mammedov --- Cc: Paolo Bonzini Cc: "Daniel P. Berrangé" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- hw/core/qdev-properties.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 3d648b088d..9d25b49fc1 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -559,10 +559,9 @@ static void set_prop_arraylen(Object *obj, Visitor *v, const char *name, * array-length field in the device struct, we have to create the * array itself and dynamically add the corresponding properties. */ - DeviceState *dev = DEVICE(obj); Property *prop = opaque; uint32_t *alenptr = object_field_prop_ptr(obj, prop); - void **arrayptr = (void *)dev + prop->arrayoffset; + void **arrayptr = (void *)obj + prop->arrayoffset; void *eltptr; const char *arrayname; int i; @@ -602,7 +601,7 @@ static void set_prop_arraylen(Object *obj, Visitor *v, const char *name, * they get the right answer despite the array element not actually * being inside the device struct. */ - arrayprop->prop.offset = eltptr - (void *)dev; + arrayprop->prop.offset = eltptr - (void *)obj; assert(object_field_prop_ptr(obj, &arrayprop->prop) == eltptr); object_property_add(obj, propname, arrayprop->prop.info->name, From patchwork Fri Dec 11 22:05:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1415340 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=LAW1QQBj; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Ct5nD6k8xz9sVJ for ; Sat, 12 Dec 2020 09:58:56 +1100 (AEDT) Received: from localhost ([::1]:37448 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knrNG-0006gd-6G for incoming@patchwork.ozlabs.org; Fri, 11 Dec 2020 17:58:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60890) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knqaH-0003JK-UX for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:08:17 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:58037) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1knqZz-0006tS-BC for qemu-devel@nongnu.org; Fri, 11 Dec 2020 17:08:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607724476; 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=9SbFl2yOXu+0VCiayKzhvj7M0fCoKeZLWqJHQW7JehU=; b=LAW1QQBju0AnA7kth/PNrPDncbCEwWDNJmy7Zb5GNm1hj1FV0CoC+1jHdyXDPPhUdjedqK WUZOoNTXmp1Jzwx4v2VSuSi8IlUtrjRs779lCYgBOnz2eX6B5bZZqsOMx95UCp3+ajjU0m jnqJ6axCgCYqOflEeqmiBLjcs0//Dlg= 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-579-50drsqLdPNi5bBf5lkDtQw-1; Fri, 11 Dec 2020 17:07:54 -0500 X-MC-Unique: 50drsqLdPNi5bBf5lkDtQw-1 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 2AADFC29F; Fri, 11 Dec 2020 22:07:53 +0000 (UTC) Received: from localhost (ovpn-116-160.rdu2.redhat.com [10.10.116.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id E2A0771C80; Fri, 11 Dec 2020 22:07:52 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH v4 32/32] tests: Add unit test for qdev array properties Date: Fri, 11 Dec 2020 17:05:29 -0500 Message-Id: <20201211220529.2290218-33-ehabkost@redhat.com> In-Reply-To: <20201211220529.2290218-1-ehabkost@redhat.com> References: <20201211220529.2290218-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Daniel P. Berrange" , John Snow , Markus Armbruster , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Stefan Berger Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Add a test case to ensure array properties are behaving as expected. Signed-off-by: Eduardo Habkost --- This is a new patch added in v3 of this series. --- Cc: Paolo Bonzini Cc: "Daniel P. Berrangé" Cc: Eduardo Habkost Cc: qemu-devel@nongnu.org --- tests/test-qdev-global-props.c | 61 ++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/tests/test-qdev-global-props.c b/tests/test-qdev-global-props.c index c8862cac5f..9426ce2a72 100644 --- a/tests/test-qdev-global-props.c +++ b/tests/test-qdev-global-props.c @@ -44,11 +44,16 @@ struct MyType { uint32_t prop1; uint32_t prop2; + + char **myarray; + uint32_t myarray_len; }; static Property static_props[] = { DEFINE_PROP_UINT32("prop1", MyType, prop1, PROP_DEFAULT), DEFINE_PROP_UINT32("prop2", MyType, prop2, PROP_DEFAULT), + DEFINE_PROP_ARRAY("myarray", MyType, myarray_len, myarray, + prop_info_string, char *), DEFINE_PROP_END_OF_LIST() }; @@ -60,11 +65,19 @@ static void static_prop_class_init(ObjectClass *oc, void *data) device_class_set_props(dc, static_props); } +static void static_props_finalize(Object *obj) +{ + MyType *mt = STATIC_TYPE(obj); + + g_free(mt->myarray); +} + static const TypeInfo static_prop_type = { .name = TYPE_STATIC_PROPS, .parent = TYPE_DEVICE, .instance_size = sizeof(MyType), .class_init = static_prop_class_init, + .instance_finalize = static_props_finalize, }; static const TypeInfo subclass_type = { @@ -91,6 +104,52 @@ static void test_static_prop(void) g_test_trap_assert_stdout(""); } +static void test_static_prop_array(void) +{ + Error *err = NULL; + ObjectClass *oc = object_class_by_name(TYPE_STATIC_PROPS); + Object *obj = object_new(TYPE_STATIC_PROPS); + char *s = NULL; + + g_assert_nonnull(object_class_property_find(oc, "len-myarray")); + g_assert_null(object_class_property_find(oc, "myarray[0]")); + + g_assert_nonnull(object_property_find(obj, "len-myarray")); + g_assert_null(object_property_find(obj, "myarray[0]")); + + g_assert_cmpint(object_property_get_int(obj, "len-myarray", &error_abort), ==, 0); + object_property_set_int(obj, "len-myarray", 3, &error_abort); + g_assert_cmpint(object_property_get_int(obj, "len-myarray", &error_abort), ==, 3); + + g_assert_nonnull(object_property_find(obj, "myarray[0]")); + g_assert_nonnull(object_property_find(obj, "myarray[1]")); + g_assert_nonnull(object_property_find(obj, "myarray[2]")); + g_assert_null(object_property_find(obj, "myarray[3]")); + + /* Setting length a second time must fail */ + object_property_set_int(obj, "len-myarray", 42, &err); + error_free_or_abort(&err); + + g_assert_nonnull(object_property_find(obj, "myarray[2]")); + g_assert_null(object_property_find(obj, "myarray[3]")); + + s = object_property_get_str(obj, "myarray[2]", &error_abort); + g_assert_cmpstr(s, ==, ""); + g_free(s); + + object_property_set_str(obj, "myarray[1]", "value", &error_abort); + + s = object_property_get_str(obj, "myarray[1]", &error_abort); + g_assert_cmpstr(s, ==, "value"); + g_free(s); + + s = object_property_get_str(obj, "myarray[2]", &error_abort); + g_assert_cmpstr(s, ==, ""); + g_free(s); + + object_unref(obj); +} + static void register_global_properties(GlobalProperty *props) { int i; @@ -299,6 +358,8 @@ int main(int argc, char **argv) test_static_prop_subprocess); g_test_add_func("/qdev/properties/static/default", test_static_prop); + g_test_add_func("/qdev/properties/static/array", + test_static_prop_array); g_test_add_func("/qdev/properties/static/global/subprocess", test_static_globalprop_subprocess);