From patchwork Mon Oct 5 21:09:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 303655 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E6EFC4363A for ; Mon, 5 Oct 2020 21:11:50 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id B5D0C2078E for ; Mon, 5 Oct 2020 21:11:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="YCApkoGE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B5D0C2078E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:46614 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPXls-0001UL-PR for qemu-devel@archiver.kernel.org; Mon, 05 Oct 2020 17:11:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43104) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPXkJ-00088W-I4 for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:41435) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPXkH-0007Ku-AR for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601932207; 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=GfFoCaY7u2a8bedI085FZLdj/V/rVAXLYLm4VQS+GFk=; b=YCApkoGECmUl9eIFBqB3Uldoro40zCKHDKaAqp1F2MDudWfT5otvUssYonScq7g+qJTiCd VMdpVpkarAgiUIk66Rt+KM22HOF6LsDTmEl79kc3vkMpxG1kYGDzeqoziOxEj77bRYJflh DIRBr9Y4vBG9r7nZx0DAFZhZUKlDAUk= 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-MeIn9L3bOCKyYWW2ljK5qg-1; Mon, 05 Oct 2020 17:10:05 -0400 X-MC-Unique: MeIn9L3bOCKyYWW2ljK5qg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8E892104D3E6; Mon, 5 Oct 2020 21:10:04 +0000 (UTC) Received: from localhost (ovpn-119-102.rdu2.redhat.com [10.10.119.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 51BF07368A; Mon, 5 Oct 2020 21:10:04 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 01/21] numa: hmat: require parent cache description before the next level one Date: Mon, 5 Oct 2020 17:09:40 -0400 Message-Id: <20201005211000.710404-2-ehabkost@redhat.com> In-Reply-To: <20201005211000.710404-1-ehabkost@redhat.com> References: <20201005211000.710404-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/05 02:11:31 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.733, 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: Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang?= =?utf-8?b?w6k=?= , Eduardo Habkost , Igor Mammedov Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Igor Mammedov Spec[1] defines 0 - 3 level memory side cache, however QEMU CLI allows to specify an intermediate cache level without specifying previous level. Such option(s) silently ignored when building HMAT table, which leads to incomplete cache information. Make sure that previous level exists and error out if it hasn't been provided. 1) ACPI 6.2A 5.2.27.5 Memory Side Cache Information Structure Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1842877 Signed-off-by: Igor Mammedov Message-Id: <20200924091406.1321012-1-imammedo@redhat.com> Reviewed-by: Eduardo Habkost Signed-off-by: Eduardo Habkost --- hw/core/numa.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/core/numa.c b/hw/core/numa.c index 7d5d4130016..6dc3d19d282 100644 --- a/hw/core/numa.c +++ b/hw/core/numa.c @@ -424,7 +424,13 @@ void parse_numa_hmat_cache(MachineState *ms, NumaHmatCacheOptions *node, } if ((node->level > 1) && - ms->numa_state->hmat_cache[node->node_id][node->level - 1] && + ms->numa_state->hmat_cache[node->node_id][node->level - 1] == NULL) { + error_setg(errp, "Cache level=%" PRIu8 " shall be defined first", + node->level - 1); + return; + } + + if ((node->level > 1) && (node->size <= ms->numa_state->hmat_cache[node->node_id][node->level - 1]->size)) { error_setg(errp, "Invalid size=%" PRIu64 ", the size of level=%" PRIu8 From patchwork Mon Oct 5 21:09:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 272013 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60297C4727D for ; Mon, 5 Oct 2020 21:11:51 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id C1522207EA for ; Mon, 5 Oct 2020 21:11:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="QRqJGote" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C1522207EA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:46744 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPXlt-0001Yp-Vb for qemu-devel@archiver.kernel.org; Mon, 05 Oct 2020 17:11:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43130) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPXkN-00089A-E2 for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:49506) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPXkJ-0007L6-H2 for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601932210; 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=E6S0MWYuU82hEOhb8xdp9gpDqCKdgJ7Ff29hgqzdvNI=; b=QRqJGotehhIT97XI6RLZb9kTLb34yuPjofNcxWUv3Vi4bPtFmW4JrnLhwyQjIdkxZrPx5U eTqNmByn1jb2AcxTGMyW+6E3cFXW0+Hcl/29Zy5d/aIbY43MSqXw+V2sEXrvcYZaTMObDC Z3YnHJUay2p5xWpxDFugQ5lNsKSBGSU= 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-403-Pf8jDKjINPKX6jxG-4emzw-1; Mon, 05 Oct 2020 17:10:07 -0400 X-MC-Unique: Pf8jDKjINPKX6jxG-4emzw-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 A7ACD18A8220; Mon, 5 Oct 2020 21:10:06 +0000 (UTC) Received: from localhost (ovpn-119-102.rdu2.redhat.com [10.10.119.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3E4EF55770; Mon, 5 Oct 2020 21:10:06 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 02/21] hw/core/qdev-properties: Use qemu_strtol() in set_mac() handler Date: Mon, 5 Oct 2020 17:09:41 -0400 Message-Id: <20201005211000.710404-3-ehabkost@redhat.com> In-Reply-To: <20201005211000.710404-1-ehabkost@redhat.com> References: <20201005211000.710404-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/05 02:11:31 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.733, 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: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , Richard Henderson , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?b?w6k=?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé The MACAddr structure contains an array of uint8_t. Previously if a value was out of the [0..255] range, it was silently casted and no input validation was done. Replace strtol() by qemu_strtol() -- so checkpatch.pl won't complain if we move this code later -- and return EINVAL if the input is invalid. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20200930164949.1425294-3-philmd@redhat.com> Signed-off-by: Eduardo Habkost --- hw/core/qdev-properties.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 343c824da04..080ba319a1f 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -1,4 +1,5 @@ #include "qemu/osdep.h" +#include "qemu/cutils.h" #include "net/net.h" #include "hw/qdev-properties.h" #include "qapi/error.h" @@ -524,7 +525,8 @@ static void set_mac(Object *obj, Visitor *v, const char *name, void *opaque, Property *prop = opaque; MACAddr *mac = qdev_get_prop_ptr(dev, prop); int i, pos; - char *str, *p; + char *str; + const char *p; if (dev->realized) { qdev_prop_set_after_realize(dev, name, errp); @@ -536,6 +538,8 @@ static void set_mac(Object *obj, Visitor *v, const char *name, void *opaque, } for (i = 0, pos = 0; i < 6; i++, pos += 3) { + long val; + if (!qemu_isxdigit(str[pos])) { goto inval; } @@ -551,7 +555,10 @@ static void set_mac(Object *obj, Visitor *v, const char *name, void *opaque, goto inval; } } - mac->a[i] = strtol(str+pos, &p, 16); + if (qemu_strtol(str + pos, &p, 16, &val) < 0 || val > 0xff) { + goto inval; + } + mac->a[i] = val; } g_free(str); return; From patchwork Mon Oct 5 21:09:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 272012 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75405C4363A for ; Mon, 5 Oct 2020 21:13:59 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 07758207EA for ; Mon, 5 Oct 2020 21:13:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Ul2XZwSl" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 07758207EA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:54978 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPXny-0004sD-63 for qemu-devel@archiver.kernel.org; Mon, 05 Oct 2020 17:13:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43144) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPXkO-00089X-Ul for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:57940) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPXkL-0007LM-AK for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601932212; 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=VKVHOfnczXhyBWhAP6cPmuP/ZmSpUD+aWjzBUKL3yS8=; b=Ul2XZwSlt7jRXLaLkcmmpdklUrtoFSx7y+jqzB0XkQoPtD1Xt1zKNfo52Rb7SKgmQdO05X g0RRjhTKDX33binorFAhslaE0tpZW2wOtPcMvfQzgyegUIehQeynMoDvTPNqtKm6UqMoUl b2q8nSBEh57a+u6PE3QWVG0B5tcRNFI= 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-402-NL9VSY6vN5uKq8jytm-I5A-1; Mon, 05 Oct 2020 17:10:10 -0400 X-MC-Unique: NL9VSY6vN5uKq8jytm-I5A-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 44D3E107ACF9; Mon, 5 Oct 2020 21:10:08 +0000 (UTC) Received: from localhost (ovpn-119-102.rdu2.redhat.com [10.10.119.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0D06E5D9CD; Mon, 5 Oct 2020 21:10:07 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 03/21] hw/core/qdev-properties: Use qemu_strtoul() in set_pci_host_devaddr() Date: Mon, 5 Oct 2020 17:09:42 -0400 Message-Id: <20201005211000.710404-4-ehabkost@redhat.com> In-Reply-To: <20201005211000.710404-1-ehabkost@redhat.com> References: <20201005211000.710404-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/05 01:25:11 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.733, 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_H5=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: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , Richard Henderson , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?b?w6k=?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Replace strtoul() by qemu_strtoul() so checkpatch.pl won't complain if we move this code later. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20200930164949.1425294-4-philmd@redhat.com> Signed-off-by: Eduardo Habkost --- hw/core/qdev-properties.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 080ba319a1f..a1190a5db9e 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -951,7 +951,7 @@ static void set_pci_host_devaddr(Object *obj, Visitor *v, const char *name, Property *prop = opaque; PCIHostDeviceAddress *addr = qdev_get_prop_ptr(dev, prop); char *str, *p; - char *e; + const char *e; unsigned long val; unsigned long dom = 0, bus = 0; unsigned int slot = 0, func = 0; @@ -966,23 +966,23 @@ static void set_pci_host_devaddr(Object *obj, Visitor *v, const char *name, } p = str; - val = strtoul(p, &e, 16); - if (e == p || *e != ':') { + if (qemu_strtoul(p, &e, 16, &val) < 0 || val > 0xffff || e == p) { + goto inval; + } + if (*e != ':') { goto inval; } bus = val; - p = e + 1; - val = strtoul(p, &e, 16); - if (e == p) { + p = (char *)e + 1; + if (qemu_strtoul(p, &e, 16, &val) < 0 || val > 0x1f || e == p) { goto inval; } if (*e == ':') { dom = bus; bus = val; - p = e + 1; - val = strtoul(p, &e, 16); - if (e == p) { + p = (char *)e + 1; + if (qemu_strtoul(p, &e, 16, &val) < 0 || val > 0x1f || e == p) { goto inval; } } @@ -991,14 +991,13 @@ static void set_pci_host_devaddr(Object *obj, Visitor *v, const char *name, if (*e != '.') { goto inval; } - p = e + 1; - val = strtoul(p, &e, 10); - if (e == p) { + p = (char *)e + 1; + if (qemu_strtoul(p, &e, 10, &val) < 0 || val > 7 || e == p) { goto inval; } func = val; - if (dom > 0xffff || bus > 0xff || slot > 0x1f || func > 7) { + if (bus > 0xff) { goto inval; } From patchwork Mon Oct 5 21:09:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 303653 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7CD3FC47095 for ; Mon, 5 Oct 2020 21:13:59 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 0465C2078E for ; Mon, 5 Oct 2020 21:13:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Ys7qpfnB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0465C2078E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:54930 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPXny-0004r8-5o for qemu-devel@archiver.kernel.org; Mon, 05 Oct 2020 17:13:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43162) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPXkQ-0008A5-A8 for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:37539) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPXkO-0007NS-I2 for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601932215; 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=387ny3+sRKBHYTy13TXt40bJDATXI6sqbRKvGbTh/FE=; b=Ys7qpfnBlfXR5AZlNtgPBek8jFdSTD4vNnw7zw5eSwUWoqxsokjbnpe2lurNifQPU/2jzX xKeRgvT0uW+anh1VR31P2HGdztOF/7XbxisTagFYzU0ALplN+MkdBDf9xWwN9yeeXopmad gDdatW4tYr+yBbAxHlXxgq/nzuMs6H4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-246-ddJml-cNMFW0wQ_puOAW3w-1; Mon, 05 Oct 2020 17:10:11 -0400 X-MC-Unique: ddJml-cNMFW0wQ_puOAW3w-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 88C051015C9D; Mon, 5 Oct 2020 21:10:10 +0000 (UTC) Received: from localhost (ovpn-119-102.rdu2.redhat.com [10.10.119.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1788F61177; Mon, 5 Oct 2020 21:10:08 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 04/21] hw/core/qdev-properties: Fix code style Date: Mon, 5 Oct 2020 17:09:43 -0400 Message-Id: <20201005211000.710404-5-ehabkost@redhat.com> In-Reply-To: <20201005211000.710404-1-ehabkost@redhat.com> References: <20201005211000.710404-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=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/05 01:25:11 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.733, 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_H5=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: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , Richard Henderson , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?b?w6k=?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé We will soon move this code, fix its style to avoid checkpatch.pl to complain. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20200930164949.1425294-5-philmd@redhat.com> Signed-off-by: Eduardo Habkost --- hw/core/qdev-properties.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index a1190a5db9e..071fd5864ae 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -543,15 +543,15 @@ static void set_mac(Object *obj, Visitor *v, const char *name, void *opaque, if (!qemu_isxdigit(str[pos])) { goto inval; } - if (!qemu_isxdigit(str[pos+1])) { + if (!qemu_isxdigit(str[pos + 1])) { goto inval; } if (i == 5) { - if (str[pos+2] != '\0') { + if (str[pos + 2] != '\0') { goto inval; } } else { - if (str[pos+2] != ':' && str[pos+2] != '-') { + if (str[pos + 2] != ':' && str[pos + 2] != '-') { goto inval; } } @@ -898,8 +898,8 @@ static void set_blocksize(Object *obj, Visitor *v, const char *name, /* We rely on power-of-2 blocksizes for bitmasks */ if ((value & (value - 1)) != 0) { error_setg(errp, - "Property %s.%s doesn't take value '%" PRId64 "', it's not a power of 2", - dev->id ?: "", name, (int64_t)value); + "Property %s.%s doesn't take value '%" PRId64 "', " + "it's not a power of 2", dev->id ?: "", name, (int64_t)value); return; } From patchwork Mon Oct 5 21:09:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 303652 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93D63C4727E for ; Mon, 5 Oct 2020 21:14:00 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 41936207EA for ; Mon, 5 Oct 2020 21:14:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="T3UufQF5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 41936207EA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:55098 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPXnz-0004v4-DD for qemu-devel@archiver.kernel.org; Mon, 05 Oct 2020 17:13:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43168) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPXkQ-0008AC-Lt for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:54765) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPXkO-0007N9-Hb for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601932215; 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=XEoq9EbX6/fzzvW2lNcxW2NPkT5KG2SSUNmANtD/K24=; b=T3UufQF5eVZCyoNW8fg37cYF2dQEx3WoNmqDvYget0j/Gg9HAT6++xttw/sf2/lv1mfXro fhRxlmxt9PERaUghPDA8n5DmVv55G1M3K6hU21nOHrzxbLOjnOeQV/LUumkBtFvCrMJKtk 37RIdf6sArfN8mF5t7Gg6CRuvGYIX3M= 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-lszAYZKkM9SAbNvZZ7bJVQ-1; Mon, 05 Oct 2020 17:10:12 -0400 X-MC-Unique: lszAYZKkM9SAbNvZZ7bJVQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9227E1DDED; Mon, 5 Oct 2020 21:10:11 +0000 (UTC) Received: from localhost (ovpn-119-102.rdu2.redhat.com [10.10.119.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 56C8173674; Mon, 5 Oct 2020 21:10:11 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 05/21] hw/core/qdev-properties: Export enum-related functions Date: Mon, 5 Oct 2020 17:09:44 -0400 Message-Id: <20201005211000.710404-6-ehabkost@redhat.com> In-Reply-To: <20201005211000.710404-1-ehabkost@redhat.com> References: <20201005211000.710404-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/05 02:11:31 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.733, 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: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , Richard Henderson , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?b?w6k=?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé We are going to split this file and reuse these static functions. Add the local "qdev-prop-internal.h" header declaring them. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20200930164949.1425294-6-philmd@redhat.com> Signed-off-by: Eduardo Habkost --- hw/core/qdev-prop-internal.h | 19 ++++++++++++ hw/core/qdev-properties.c | 58 +++++++++++++++++++----------------- 2 files changed, 49 insertions(+), 28 deletions(-) create mode 100644 hw/core/qdev-prop-internal.h diff --git a/hw/core/qdev-prop-internal.h b/hw/core/qdev-prop-internal.h new file mode 100644 index 00000000000..2a8c9a306a5 --- /dev/null +++ b/hw/core/qdev-prop-internal.h @@ -0,0 +1,19 @@ +/* + * qdev property parsing + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#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 qdev_propinfo_set_default_value_enum(ObjectProperty *op, + const Property *prop); + +#endif diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 071fd5864ae..76417d09365 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -18,6 +18,7 @@ #include "qemu/uuid.h" #include "qemu/units.h" #include "qemu/cutils.h" +#include "qdev-prop-internal.h" void qdev_prop_set_after_realize(DeviceState *dev, const char *name, Error **errp) @@ -53,8 +54,8 @@ void *qdev_get_prop_ptr(DeviceState *dev, Property *prop) return ptr; } -static void get_enum(Object *obj, Visitor *v, const char *name, void *opaque, - Error **errp) +void qdev_propinfo_get_enum(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) { DeviceState *dev = DEVICE(obj); Property *prop = opaque; @@ -63,8 +64,8 @@ static void get_enum(Object *obj, Visitor *v, const char *name, void *opaque, visit_type_enum(v, prop->name, ptr, prop->info->enum_table, errp); } -static void set_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) { DeviceState *dev = DEVICE(obj); Property *prop = opaque; @@ -78,7 +79,8 @@ static void set_enum(Object *obj, Visitor *v, const char *name, void *opaque, visit_type_enum(v, prop->name, ptr, prop->info->enum_table, errp); } -static void set_default_value_enum(ObjectProperty *op, const Property *prop) +void qdev_propinfo_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)); @@ -669,9 +671,9 @@ const PropertyInfo qdev_prop_on_off_auto = { .name = "OnOffAuto", .description = "on/off/auto", .enum_table = &OnOffAuto_lookup, - .get = get_enum, - .set = set_enum, - .set_default_value = set_default_value_enum, + .get = qdev_propinfo_get_enum, + .set = qdev_propinfo_set_enum, + .set_default_value = qdev_propinfo_set_default_value_enum, }; /* --- lost tick policy --- */ @@ -681,9 +683,9 @@ QEMU_BUILD_BUG_ON(sizeof(LostTickPolicy) != sizeof(int)); const PropertyInfo qdev_prop_losttickpolicy = { .name = "LostTickPolicy", .enum_table = &LostTickPolicy_lookup, - .get = get_enum, - .set = set_enum, - .set_default_value = set_default_value_enum, + .get = qdev_propinfo_get_enum, + .set = qdev_propinfo_set_enum, + .set_default_value = qdev_propinfo_set_default_value_enum, }; /* --- Block device error handling policy --- */ @@ -695,9 +697,9 @@ const PropertyInfo qdev_prop_blockdev_on_error = { .description = "Error handling policy, " "report/ignore/enospc/stop/auto", .enum_table = &BlockdevOnError_lookup, - .get = get_enum, - .set = set_enum, - .set_default_value = set_default_value_enum, + .get = qdev_propinfo_get_enum, + .set = qdev_propinfo_set_enum, + .set_default_value = qdev_propinfo_set_default_value_enum, }; /* --- BIOS CHS translation */ @@ -709,9 +711,9 @@ const PropertyInfo qdev_prop_bios_chs_trans = { .description = "Logical CHS translation algorithm, " "auto/none/lba/large/rechs", .enum_table = &BiosAtaTranslation_lookup, - .get = get_enum, - .set = set_enum, - .set_default_value = set_default_value_enum, + .get = qdev_propinfo_get_enum, + .set = qdev_propinfo_set_enum, + .set_default_value = qdev_propinfo_set_default_value_enum, }; /* --- FDC default drive types */ @@ -721,9 +723,9 @@ const PropertyInfo qdev_prop_fdc_drive_type = { .description = "FDC drive type, " "144/288/120/none/auto", .enum_table = &FloppyDriveType_lookup, - .get = get_enum, - .set = set_enum, - .set_default_value = set_default_value_enum, + .get = qdev_propinfo_get_enum, + .set = qdev_propinfo_set_enum, + .set_default_value = qdev_propinfo_set_default_value_enum, }; /* --- MultiFDCompression --- */ @@ -733,9 +735,9 @@ const PropertyInfo qdev_prop_multifd_compression = { .description = "multifd_compression values, " "none/zlib/zstd", .enum_table = &MultiFDCompression_lookup, - .get = get_enum, - .set = set_enum, - .set_default_value = set_default_value_enum, + .get = qdev_propinfo_get_enum, + .set = qdev_propinfo_set_enum, + .set_default_value = qdev_propinfo_set_default_value_enum, }; /* --- pci address --- */ @@ -1416,9 +1418,9 @@ const PropertyInfo qdev_prop_off_auto_pcibar = { .name = "OffAutoPCIBAR", .description = "off/auto/bar0/bar1/bar2/bar3/bar4/bar5", .enum_table = &OffAutoPCIBAR_lookup, - .get = get_enum, - .set = set_enum, - .set_default_value = set_default_value_enum, + .get = qdev_propinfo_get_enum, + .set = qdev_propinfo_set_enum, + .set_default_value = qdev_propinfo_set_default_value_enum, }; /* --- PCIELinkSpeed 2_5/5/8/16 -- */ @@ -1495,7 +1497,7 @@ const PropertyInfo qdev_prop_pcie_link_speed = { .enum_table = &PCIELinkSpeed_lookup, .get = get_prop_pcielinkspeed, .set = set_prop_pcielinkspeed, - .set_default_value = set_default_value_enum, + .set_default_value = qdev_propinfo_set_default_value_enum, }; /* --- PCIELinkWidth 1/2/4/8/12/16/32 -- */ @@ -1590,5 +1592,5 @@ const PropertyInfo qdev_prop_pcie_link_width = { .enum_table = &PCIELinkWidth_lookup, .get = get_prop_pcielinkwidth, .set = set_prop_pcielinkwidth, - .set_default_value = set_default_value_enum, + .set_default_value = qdev_propinfo_set_default_value_enum, }; From patchwork Mon Oct 5 21:09:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 303650 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C27C4C4727E for ; Mon, 5 Oct 2020 21:16:48 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 4614F2078E for ; Mon, 5 Oct 2020 21:16:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Y4JmzGGD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4614F2078E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:35180 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPXqh-0008RZ-0d for qemu-devel@archiver.kernel.org; Mon, 05 Oct 2020 17:16:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43186) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPXkS-0008Al-55 for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:38856) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPXkQ-0007O6-2B for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601932217; 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=/pSRTyw/I2c45NOIrr18mZNAWjiTUlL2Mrsv2hSjPbw=; b=Y4JmzGGDf1PBGlzI9oIs5klS9lCq92c7Svr6RGgLBJ/LlKgldC7Aj6qFXHEm5HRFrnWh7l bbNSTq1uWm+ROOZsrx+dp+m/jqR83p7GG3O/VpW9udAh/ztZwDF/pDm89h3krkOKIyOkY6 2b1mGrcNfdJ46fX5cnFkbNSWp90tAVc= 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-82-sUNiBgfVMTCJef8HuQ_xyg-1; Mon, 05 Oct 2020 17:10:15 -0400 X-MC-Unique: sUNiBgfVMTCJef8HuQ_xyg-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 23AB787308D; Mon, 5 Oct 2020 21:10:13 +0000 (UTC) Received: from localhost (ovpn-119-102.rdu2.redhat.com [10.10.119.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id ABC6655770; Mon, 5 Oct 2020 21:10:12 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 06/21] hw/core/qdev-properties: Export qdev_prop_enum Date: Mon, 5 Oct 2020 17:09:45 -0400 Message-Id: <20201005211000.710404-7-ehabkost@redhat.com> In-Reply-To: <20201005211000.710404-1-ehabkost@redhat.com> References: <20201005211000.710404-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/05 01:25:11 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.733, 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_H5=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: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , Richard Henderson , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?b?w6k=?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20200930164949.1425294-7-philmd@redhat.com> Signed-off-by: Eduardo Habkost --- include/hw/qdev-properties.h | 1 + hw/core/qdev-properties.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 528310bb22f..44374500659 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -8,6 +8,7 @@ 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; diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 76417d09365..31dfe441e2e 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -86,6 +86,13 @@ void qdev_propinfo_set_default_value_enum(ObjectProperty *op, qapi_enum_lookup(prop->info->enum_table, prop->defval.i)); } +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, +}; + /* Bit */ static uint32_t qdev_get_prop_mask(Property *prop) From patchwork Mon Oct 5 21:09:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 303648 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6FF28C4363A for ; Mon, 5 Oct 2020 21:20:21 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id DB51A208C3 for ; Mon, 5 Oct 2020 21:20:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="LZuF9NhC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DB51A208C3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:43644 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPXu7-0003bP-UR for qemu-devel@archiver.kernel.org; Mon, 05 Oct 2020 17:20:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43244) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPXkW-0008Dp-FA for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:29176) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPXkS-0007PJ-Gr for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601932219; 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=vSZU8LutC2AZ+Vt0lQlqAk6xxkGLLoRLLfQshp5cRs4=; b=LZuF9NhCrwXBJqztUZdcafTLZ5Uo/sumhbomEp8LRmPLv1cUq5e/IevHOvrm/mRzds+gx5 KSWzJRheJJ0q51kEL8vTrY2VZcfuvHhldTl0T13YHqotTCSAL1+yshKtdhYIk3mIk+2rVM lREOJrjKUXvO0FoMWA6a9FkBQgj+fJI= 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-245-0YRpkEqHN2mRYMPZBP57fg-1; Mon, 05 Oct 2020 17:10:15 -0400 X-MC-Unique: 0YRpkEqHN2mRYMPZBP57fg-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 64DA918A8222; Mon, 5 Oct 2020 21:10:14 +0000 (UTC) Received: from localhost (ovpn-119-102.rdu2.redhat.com [10.10.119.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2DB445C1BD; Mon, 5 Oct 2020 21:10:14 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 07/21] hw/core/qdev-properties: Export some integer-related functions Date: Mon, 5 Oct 2020 17:09:46 -0400 Message-Id: <20201005211000.710404-8-ehabkost@redhat.com> In-Reply-To: <20201005211000.710404-1-ehabkost@redhat.com> References: <20201005211000.710404-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/05 02:11:31 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.733, 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: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , Richard Henderson , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?b?w6k=?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé We are going to split this file and reuse these static functions. Declare them in the local "qdev-prop-internal.h" header. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20200930164949.1425294-8-philmd@redhat.com> Signed-off-by: Eduardo Habkost --- hw/core/qdev-prop-internal.h | 11 +++++++++ hw/core/qdev-properties.c | 46 +++++++++++++++++++----------------- 2 files changed, 35 insertions(+), 22 deletions(-) diff --git a/hw/core/qdev-prop-internal.h b/hw/core/qdev-prop-internal.h index 2a8c9a306a5..9cf5cc1d519 100644 --- a/hw/core/qdev-prop-internal.h +++ b/hw/core/qdev-prop-internal.h @@ -15,5 +15,16 @@ void qdev_propinfo_set_enum(Object *obj, Visitor *v, const char *name, 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 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, + void *opaque, Error **errp); #endif diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 31dfe441e2e..37e309077a1 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -271,12 +271,14 @@ static void set_uint8(Object *obj, Visitor *v, const char *name, void *opaque, visit_type_uint8(v, name, ptr, errp); } -static void set_default_value_int(ObjectProperty *op, const Property *prop) +void qdev_propinfo_set_default_value_int(ObjectProperty *op, + const Property *prop) { object_property_set_default_int(op, prop->defval.i); } -static void set_default_value_uint(ObjectProperty *op, const Property *prop) +void qdev_propinfo_set_default_value_uint(ObjectProperty *op, + const Property *prop) { object_property_set_default_uint(op, prop->defval.u); } @@ -285,13 +287,13 @@ const PropertyInfo qdev_prop_uint8 = { .name = "uint8", .get = get_uint8, .set = set_uint8, - .set_default_value = set_default_value_uint, + .set_default_value = qdev_propinfo_set_default_value_uint, }; /* --- 16bit integer --- */ -static void get_uint16(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +void qdev_propinfo_get_uint16(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) { DeviceState *dev = DEVICE(obj); Property *prop = opaque; @@ -317,9 +319,9 @@ static void set_uint16(Object *obj, Visitor *v, const char *name, const PropertyInfo qdev_prop_uint16 = { .name = "uint16", - .get = get_uint16, + .get = qdev_propinfo_get_uint16, .set = set_uint16, - .set_default_value = set_default_value_uint, + .set_default_value = qdev_propinfo_set_default_value_uint, }; /* --- 32bit integer --- */ @@ -349,8 +351,8 @@ static void set_uint32(Object *obj, Visitor *v, const char *name, visit_type_uint32(v, name, ptr, errp); } -static void get_int32(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) { DeviceState *dev = DEVICE(obj); Property *prop = opaque; @@ -378,14 +380,14 @@ const PropertyInfo qdev_prop_uint32 = { .name = "uint32", .get = get_uint32, .set = set_uint32, - .set_default_value = set_default_value_uint, + .set_default_value = qdev_propinfo_set_default_value_uint, }; const PropertyInfo qdev_prop_int32 = { .name = "int32", - .get = get_int32, + .get = qdev_propinfo_get_int32, .set = set_int32, - .set_default_value = set_default_value_int, + .set_default_value = qdev_propinfo_set_default_value_int, }; /* --- 64bit integer --- */ @@ -444,14 +446,14 @@ const PropertyInfo qdev_prop_uint64 = { .name = "uint64", .get = get_uint64, .set = set_uint64, - .set_default_value = set_default_value_uint, + .set_default_value = qdev_propinfo_set_default_value_uint, }; const PropertyInfo qdev_prop_int64 = { .name = "int64", .get = get_int64, .set = set_int64, - .set_default_value = set_default_value_int, + .set_default_value = qdev_propinfo_set_default_value_int, }; /* --- string --- */ @@ -820,8 +822,8 @@ const PropertyInfo qdev_prop_pci_devfn = { /* --- 32bit unsigned int 'size' type --- */ -static void get_size32(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) { DeviceState *dev = DEVICE(obj); Property *prop = opaque; @@ -861,9 +863,9 @@ static void set_size32(Object *obj, Visitor *v, const char *name, void *opaque, const PropertyInfo qdev_prop_size32 = { .name = "size", - .get = get_size32, + .get = qdev_propinfo_get_size32, .set = set_size32, - .set_default_value = set_default_value_uint, + .set_default_value = qdev_propinfo_set_default_value_uint, }; /* --- blocksize --- */ @@ -919,9 +921,9 @@ const PropertyInfo qdev_prop_blocksize = { .name = "size", .description = "A power of two between " MIN_BLOCK_SIZE_STR " and " MAX_BLOCK_SIZE_STR, - .get = get_size32, + .get = qdev_propinfo_get_size32, .set = set_blocksize, - .set_default_value = set_default_value_uint, + .set_default_value = qdev_propinfo_set_default_value_uint, }; /* --- pci host address --- */ @@ -1190,7 +1192,7 @@ const PropertyInfo qdev_prop_arraylen = { .name = "uint32", .get = get_uint32, .set = set_prop_arraylen, - .set_default_value = set_default_value_uint, + .set_default_value = qdev_propinfo_set_default_value_uint, }; /* --- public helpers --- */ @@ -1401,7 +1403,7 @@ const PropertyInfo qdev_prop_size = { .name = "size", .get = get_size, .set = set_size, - .set_default_value = set_default_value_uint, + .set_default_value = qdev_propinfo_set_default_value_uint, }; /* --- object link property --- */ From patchwork Mon Oct 5 21:09:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 272011 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A1D9C4363A for ; Mon, 5 Oct 2020 21:14:19 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id F1E012078E for ; Mon, 5 Oct 2020 21:14:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="cfrXVQsw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F1E012078E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:55712 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPXoI-0005Cs-4D for qemu-devel@archiver.kernel.org; Mon, 05 Oct 2020 17:14:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43300) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPXka-0008MC-Ed for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:33541) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPXkU-0007Rz-Ex for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601932221; 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=F+oqK1yVa0ZrmLtXyvUuiDLdrW9fJlqMB9LZdI4KCeI=; b=cfrXVQsw1AfUfAn6m+/fzbaluZZtbU/+YKeku4Ig9H9Lpscnlw5jaqDrMylOCEK+FGWESB dGTcy7fVihUtwa6xv4WVDgIf2zhDkQSADDqmJgmqEkKtwR7Tm6qDyupNpoGGExbl2AT4q7 p16DQF/ReqE+EhhnLfSqoDiMH0nzfuk= 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-444-FgLnmn8RNi6Nw4psMu9SFw-1; Mon, 05 Oct 2020 17:10:17 -0400 X-MC-Unique: FgLnmn8RNi6Nw4psMu9SFw-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 094D518A8220; Mon, 5 Oct 2020 21:10:16 +0000 (UTC) Received: from localhost (ovpn-119-102.rdu2.redhat.com [10.10.119.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5DDA75C1BD; Mon, 5 Oct 2020 21:10:15 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 08/21] hw/core/qdev-properties: Extract system-mode specific properties Date: Mon, 5 Oct 2020 17:09:47 -0400 Message-Id: <20201005211000.710404-9-ehabkost@redhat.com> In-Reply-To: <20201005211000.710404-1-ehabkost@redhat.com> References: <20201005211000.710404-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/05 01:25:11 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.733, 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_H5=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: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , Richard Henderson , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?b?w6k=?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Move properties specific to machines into a separate file. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20200930164949.1425294-9-philmd@redhat.com> Signed-off-by: Eduardo Habkost --- hw/core/qdev-properties-system.c | 687 ++++++++++++++++++++++++++++++- hw/core/qdev-properties.c | 674 ------------------------------ 2 files changed, 679 insertions(+), 682 deletions(-) diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c index b29daf4fb51..49bdd125814 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -11,19 +11,25 @@ */ #include "qemu/osdep.h" -#include "audio/audio.h" -#include "net/net.h" #include "hw/qdev-properties.h" #include "qapi/error.h" +#include "qapi/visitor.h" +#include "qapi/qapi-types-block.h" +#include "qapi/qapi-types-machine.h" +#include "qapi/qapi-types-migration.h" #include "qapi/qmp/qerror.h" +#include "qemu/ctype.h" +#include "qemu/cutils.h" +#include "qemu/units.h" +#include "qemu/error-report.h" +#include "qdev-prop-internal.h" + +#include "audio/audio.h" +#include "chardev/char-fe.h" #include "sysemu/block-backend.h" #include "sysemu/blockdev.h" -#include "hw/block/block.h" -#include "net/hub.h" -#include "qapi/visitor.h" -#include "chardev/char-fe.h" -#include "sysemu/iothread.h" -#include "sysemu/tpm_backend.h" +#include "net/net.h" +#include "hw/pci/pci.h" static bool check_prop_still_unset(DeviceState *dev, const char *name, const void *old_val, const char *new_val, @@ -280,6 +286,96 @@ const PropertyInfo qdev_prop_chr = { .release = release_chr, }; +/* --- mac address --- */ + +/* + * accepted syntax versions: + * 01:02:03:04:05:06 + * 01-02-03-04-05-06 + */ +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); + char buffer[2 * 6 + 5 + 1]; + char *p = buffer; + + snprintf(buffer, sizeof(buffer), "%02x:%02x:%02x:%02x:%02x:%02x", + mac->a[0], mac->a[1], mac->a[2], + mac->a[3], mac->a[4], mac->a[5]); + + visit_type_str(v, name, &p, errp); +} + +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(dev, 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; + } + + for (i = 0, pos = 0; i < 6; i++, pos += 3) { + long val; + + if (!qemu_isxdigit(str[pos])) { + goto inval; + } + if (!qemu_isxdigit(str[pos + 1])) { + goto inval; + } + if (i == 5) { + if (str[pos + 2] != '\0') { + goto inval; + } + } else { + if (str[pos + 2] != ':' && str[pos + 2] != '-') { + goto inval; + } + } + if (qemu_strtol(str + pos, &p, 16, &val) < 0 || val > 0xff) { + goto inval; + } + mac->a[i] = val; + } + g_free(str); + return; + +inval: + error_set_from_qdev_prop_error(errp, EINVAL, dev, prop, str); + g_free(str); +} + +const PropertyInfo qdev_prop_macaddr = { + .name = "str", + .description = "Ethernet 6-byte MAC Address, example: 52:54:00:12:34:56", + .get = get_mac, + .set = set_mac, +}; + +void qdev_prop_set_macaddr(DeviceState *dev, const char *name, + const uint8_t *value) +{ + char str[2 * 6 + 5 + 1]; + snprintf(str, sizeof(str), "%02x:%02x:%02x:%02x:%02x:%02x", + value[0], value[1], value[2], value[3], value[4], value[5]); + + object_property_set_str(OBJECT(dev), name, str, &error_abort); +} + /* --- netdev device --- */ static void get_netdev(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) @@ -465,3 +561,578 @@ void qdev_set_nic_properties(DeviceState *dev, NICInfo *nd) } nd->instantiated = 1; } + +/* --- lost tick policy --- */ + +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, +}; + +/* --- blocksize --- */ + +/* lower limit is sector size */ +#define MIN_BLOCK_SIZE 512 +#define MIN_BLOCK_SIZE_STR "512 B" +/* + * upper limit is arbitrary, 2 MiB looks sufficient for all sensible uses, and + * matches qcow2 cluster size limit + */ +#define MAX_BLOCK_SIZE (2 * MiB) +#define MAX_BLOCK_SIZE_STR "2 MiB" + +static void set_blocksize(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); + uint64_t value; + + if (dev->realized) { + qdev_prop_set_after_realize(dev, name, errp); + return; + } + + if (!visit_type_size(v, name, &value, errp)) { + return; + } + /* value of 0 means "unset" */ + if (value && (value < MIN_BLOCK_SIZE || value > MAX_BLOCK_SIZE)) { + error_setg(errp, + "Property %s.%s doesn't take value %" PRIu64 + " (minimum: " MIN_BLOCK_SIZE_STR + ", maximum: " MAX_BLOCK_SIZE_STR ")", + dev->id ? : "", name, value); + return; + } + + /* We rely on power-of-2 blocksizes for bitmasks */ + if ((value & (value - 1)) != 0) { + error_setg(errp, + "Property %s.%s doesn't take value '%" PRId64 "', " + "it's not a power of 2", dev->id ?: "", name, (int64_t)value); + return; + } + + *ptr = value; +} + +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, + .set = set_blocksize, + .set_default_value = qdev_propinfo_set_default_value_uint, +}; + +/* --- Block device error handling policy --- */ + +QEMU_BUILD_BUG_ON(sizeof(BlockdevOnError) != sizeof(int)); + +const PropertyInfo qdev_prop_blockdev_on_error = { + .name = "BlockdevOnError", + .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, +}; + +/* --- BIOS CHS translation */ + +QEMU_BUILD_BUG_ON(sizeof(BiosAtaTranslation) != sizeof(int)); + +const PropertyInfo qdev_prop_bios_chs_trans = { + .name = "BiosAtaTranslation", + .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, +}; + +/* --- FDC default drive types */ + +const PropertyInfo qdev_prop_fdc_drive_type = { + .name = "FdcDriveType", + .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, +}; + +/* --- MultiFDCompression --- */ + +const PropertyInfo qdev_prop_multifd_compression = { + .name = "MultiFDCompression", + .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, +}; + +/* --- Reserved Region --- */ + +/* + * Accepted syntax: + * :: + * where low/high addresses are uint64_t in hexadecimal + * and type is a non-negative decimal integer + */ +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); + char buffer[64]; + char *p = buffer; + int rc; + + rc = snprintf(buffer, sizeof(buffer), "0x%"PRIx64":0x%"PRIx64":%u", + rr->low, rr->high, rr->type); + assert(rc < sizeof(buffer)); + + visit_type_str(v, name, &p, errp); +} + +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(dev, prop); + Error *local_err = NULL; + const char *endptr; + 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); + return; + } + + ret = qemu_strtou64(str, &endptr, 16, &rr->low); + if (ret) { + error_setg(errp, "start address of '%s'" + " must be a hexadecimal integer", name); + goto out; + } + if (*endptr != ':') { + goto separator_error; + } + + ret = qemu_strtou64(endptr + 1, &endptr, 16, &rr->high); + if (ret) { + error_setg(errp, "end address of '%s'" + " must be a hexadecimal integer", name); + goto out; + } + if (*endptr != ':') { + goto separator_error; + } + + ret = qemu_strtoui(endptr + 1, &endptr, 10, &rr->type); + if (ret) { + error_setg(errp, "type of '%s'" + " must be a non-negative decimal integer", name); + } + goto out; + +separator_error: + error_setg(errp, "reserved region fields must be separated with ':'"); +out: + g_free(str); + return; +} + +const PropertyInfo qdev_prop_reserved_region = { + .name = "reserved_region", + .description = "Reserved Region, example: 0xFEE00000:0xFEEFFFFF:0", + .get = get_reserved_region, + .set = set_reserved_region, +}; + +/* --- pci address --- */ + +/* + * bus-local address, i.e. "$slot" or "$slot.$fn" + */ +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(dev, 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; + } + if (value < -1 || value > 255) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + name ? name : "null", "pci_devfn"); + return; + } + *ptr = value; + return; + } + + if (sscanf(str, "%x.%x%n", &slot, &fn, &n) != 2) { + fn = 0; + if (sscanf(str, "%x%n", &slot, &n) != 1) { + goto invalid; + } + } + if (str[n] != '\0' || fn > 7 || slot > 31) { + goto invalid; + } + *ptr = slot << 3 | fn; + g_free(str); + return; + +invalid: + error_set_from_qdev_prop_error(errp, EINVAL, dev, prop, str); + g_free(str); +} + +static int print_pci_devfn(DeviceState *dev, Property *prop, char *dest, + size_t len) +{ + int32_t *ptr = qdev_get_prop_ptr(dev, prop); + + if (*ptr == -1) { + return snprintf(dest, len, ""); + } else { + return snprintf(dest, len, "%02x.%x", *ptr >> 3, *ptr & 7); + } +} + +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, + .set = set_pci_devfn, + .set_default_value = qdev_propinfo_set_default_value_int, +}; + +/* --- pci host address --- */ + +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); + char buffer[] = "ffff:ff:ff.f"; + char *p = buffer; + int rc = 0; + + /* + * Catch "invalid" device reference from vfio-pci and allow the + * default buffer representing the non-existent device to be used. + */ + if (~addr->domain || ~addr->bus || ~addr->slot || ~addr->function) { + rc = snprintf(buffer, sizeof(buffer), "%04x:%02x:%02x.%0d", + addr->domain, addr->bus, addr->slot, addr->function); + assert(rc == sizeof(buffer) - 1); + } + + visit_type_str(v, name, &p, errp); +} + +/* + * Parse [:]:. + * if is not supplied, it's assumed to be 0. + */ +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(dev, prop); + char *str, *p; + const char *e; + unsigned long val; + 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; + } + + p = str; + if (qemu_strtoul(p, &e, 16, &val) < 0 || val > 0xffff || e == p) { + goto inval; + } + if (*e != ':') { + goto inval; + } + bus = val; + + p = (char *)e + 1; + if (qemu_strtoul(p, &e, 16, &val) < 0 || val > 0x1f || e == p) { + goto inval; + } + if (*e == ':') { + dom = bus; + bus = val; + p = (char *)e + 1; + if (qemu_strtoul(p, &e, 16, &val) < 0 || val > 0x1f || e == p) { + goto inval; + } + } + slot = val; + + if (*e != '.') { + goto inval; + } + p = (char *)e + 1; + if (qemu_strtoul(p, &e, 10, &val) < 0 || val > 7 || e == p) { + goto inval; + } + func = val; + + if (bus > 0xff) { + goto inval; + } + + if (*e) { + goto inval; + } + + addr->domain = dom; + addr->bus = bus; + addr->slot = slot; + addr->function = func; + + g_free(str); + return; + +inval: + error_set_from_qdev_prop_error(errp, EINVAL, dev, prop, str); + g_free(str); +} + +const PropertyInfo qdev_prop_pci_host_devaddr = { + .name = "str", + .description = "Address (bus/device/function) of " + "the host device, example: 04:10.0", + .get = get_pci_host_devaddr, + .set = set_pci_host_devaddr, +}; + +/* --- OffAutoPCIBAR off/auto/bar0/bar1/bar2/bar3/bar4/bar5 --- */ + +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, +}; + +/* --- PCIELinkSpeed 2_5/5/8/16 -- */ + +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); + int speed; + + switch (*p) { + case QEMU_PCI_EXP_LNK_2_5GT: + speed = PCIE_LINK_SPEED_2_5; + break; + case QEMU_PCI_EXP_LNK_5GT: + speed = PCIE_LINK_SPEED_5; + break; + case QEMU_PCI_EXP_LNK_8GT: + speed = PCIE_LINK_SPEED_8; + break; + case QEMU_PCI_EXP_LNK_16GT: + speed = PCIE_LINK_SPEED_16; + break; + default: + /* Unreachable */ + abort(); + } + + visit_type_enum(v, prop->name, &speed, prop->info->enum_table, errp); +} + +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(dev, prop); + int speed; + + if (dev->realized) { + qdev_prop_set_after_realize(dev, name, errp); + return; + } + + if (!visit_type_enum(v, prop->name, &speed, prop->info->enum_table, + errp)) { + return; + } + + switch (speed) { + case PCIE_LINK_SPEED_2_5: + *p = QEMU_PCI_EXP_LNK_2_5GT; + break; + case PCIE_LINK_SPEED_5: + *p = QEMU_PCI_EXP_LNK_5GT; + break; + case PCIE_LINK_SPEED_8: + *p = QEMU_PCI_EXP_LNK_8GT; + break; + case PCIE_LINK_SPEED_16: + *p = QEMU_PCI_EXP_LNK_16GT; + break; + default: + /* Unreachable */ + abort(); + } +} + +const PropertyInfo qdev_prop_pcie_link_speed = { + .name = "PCIELinkSpeed", + .description = "2_5/5/8/16", + .enum_table = &PCIELinkSpeed_lookup, + .get = get_prop_pcielinkspeed, + .set = set_prop_pcielinkspeed, + .set_default_value = qdev_propinfo_set_default_value_enum, +}; + +/* --- PCIELinkWidth 1/2/4/8/12/16/32 -- */ + +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); + int width; + + switch (*p) { + case QEMU_PCI_EXP_LNK_X1: + width = PCIE_LINK_WIDTH_1; + break; + case QEMU_PCI_EXP_LNK_X2: + width = PCIE_LINK_WIDTH_2; + break; + case QEMU_PCI_EXP_LNK_X4: + width = PCIE_LINK_WIDTH_4; + break; + case QEMU_PCI_EXP_LNK_X8: + width = PCIE_LINK_WIDTH_8; + break; + case QEMU_PCI_EXP_LNK_X12: + width = PCIE_LINK_WIDTH_12; + break; + case QEMU_PCI_EXP_LNK_X16: + width = PCIE_LINK_WIDTH_16; + break; + case QEMU_PCI_EXP_LNK_X32: + width = PCIE_LINK_WIDTH_32; + break; + default: + /* Unreachable */ + abort(); + } + + visit_type_enum(v, prop->name, &width, prop->info->enum_table, errp); +} + +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(dev, prop); + int width; + + if (dev->realized) { + qdev_prop_set_after_realize(dev, name, errp); + return; + } + + if (!visit_type_enum(v, prop->name, &width, prop->info->enum_table, + errp)) { + return; + } + + switch (width) { + case PCIE_LINK_WIDTH_1: + *p = QEMU_PCI_EXP_LNK_X1; + break; + case PCIE_LINK_WIDTH_2: + *p = QEMU_PCI_EXP_LNK_X2; + break; + case PCIE_LINK_WIDTH_4: + *p = QEMU_PCI_EXP_LNK_X4; + break; + case PCIE_LINK_WIDTH_8: + *p = QEMU_PCI_EXP_LNK_X8; + break; + case PCIE_LINK_WIDTH_12: + *p = QEMU_PCI_EXP_LNK_X12; + break; + case PCIE_LINK_WIDTH_16: + *p = QEMU_PCI_EXP_LNK_X16; + break; + case PCIE_LINK_WIDTH_32: + *p = QEMU_PCI_EXP_LNK_X32; + break; + default: + /* Unreachable */ + abort(); + } +} + +const PropertyInfo qdev_prop_pcie_link_width = { + .name = "PCIELinkWidth", + .description = "1/2/4/8/12/16/32", + .enum_table = &PCIELinkWidth_lookup, + .get = get_prop_pcielinkwidth, + .set = set_prop_pcielinkwidth, + .set_default_value = qdev_propinfo_set_default_value_enum, +}; diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 37e309077a1..509cbf155d2 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -1,20 +1,11 @@ #include "qemu/osdep.h" -#include "qemu/cutils.h" -#include "net/net.h" #include "hw/qdev-properties.h" #include "qapi/error.h" -#include "hw/pci/pci.h" -#include "qapi/qapi-types-block.h" -#include "qapi/qapi-types-machine.h" #include "qapi/qapi-types-misc.h" #include "qapi/qmp/qerror.h" #include "qemu/ctype.h" #include "qemu/error-report.h" -#include "qapi/qapi-types-migration.h" -#include "hw/block/block.h" -#include "net/hub.h" #include "qapi/visitor.h" -#include "chardev/char.h" #include "qemu/uuid.h" #include "qemu/units.h" #include "qemu/cutils.h" @@ -506,174 +497,6 @@ const PropertyInfo qdev_prop_string = { .set = set_string, }; -/* --- mac address --- */ - -/* - * accepted syntax versions: - * 01:02:03:04:05:06 - * 01-02-03-04-05-06 - */ -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); - char buffer[2 * 6 + 5 + 1]; - char *p = buffer; - - snprintf(buffer, sizeof(buffer), "%02x:%02x:%02x:%02x:%02x:%02x", - mac->a[0], mac->a[1], mac->a[2], - mac->a[3], mac->a[4], mac->a[5]); - - visit_type_str(v, name, &p, errp); -} - -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(dev, 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; - } - - for (i = 0, pos = 0; i < 6; i++, pos += 3) { - long val; - - if (!qemu_isxdigit(str[pos])) { - goto inval; - } - if (!qemu_isxdigit(str[pos + 1])) { - goto inval; - } - if (i == 5) { - if (str[pos + 2] != '\0') { - goto inval; - } - } else { - if (str[pos + 2] != ':' && str[pos + 2] != '-') { - goto inval; - } - } - if (qemu_strtol(str + pos, &p, 16, &val) < 0 || val > 0xff) { - goto inval; - } - mac->a[i] = val; - } - g_free(str); - return; - -inval: - error_set_from_qdev_prop_error(errp, EINVAL, dev, prop, str); - g_free(str); -} - -const PropertyInfo qdev_prop_macaddr = { - .name = "str", - .description = "Ethernet 6-byte MAC Address, example: 52:54:00:12:34:56", - .get = get_mac, - .set = set_mac, -}; - -/* --- Reserved Region --- */ - -/* - * Accepted syntax: - * :: - * where low/high addresses are uint64_t in hexadecimal - * and type is a non-negative decimal integer - */ -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); - char buffer[64]; - char *p = buffer; - int rc; - - rc = snprintf(buffer, sizeof(buffer), "0x%"PRIx64":0x%"PRIx64":%u", - rr->low, rr->high, rr->type); - assert(rc < sizeof(buffer)); - - visit_type_str(v, name, &p, errp); -} - -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(dev, prop); - Error *local_err = NULL; - const char *endptr; - 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); - return; - } - - ret = qemu_strtou64(str, &endptr, 16, &rr->low); - if (ret) { - error_setg(errp, "start address of '%s'" - " must be a hexadecimal integer", name); - goto out; - } - if (*endptr != ':') { - goto separator_error; - } - - ret = qemu_strtou64(endptr + 1, &endptr, 16, &rr->high); - if (ret) { - error_setg(errp, "end address of '%s'" - " must be a hexadecimal integer", name); - goto out; - } - if (*endptr != ':') { - goto separator_error; - } - - ret = qemu_strtoui(endptr + 1, &endptr, 10, &rr->type); - if (ret) { - error_setg(errp, "type of '%s'" - " must be a non-negative decimal integer", name); - } - goto out; - -separator_error: - error_setg(errp, "reserved region fields must be separated with ':'"); -out: - g_free(str); - return; -} - -const PropertyInfo qdev_prop_reserved_region = { - .name = "reserved_region", - .description = "Reserved Region, example: 0xFEE00000:0xFEEFFFFF:0", - .get = get_reserved_region, - .set = set_reserved_region, -}; - /* --- on/off/auto --- */ const PropertyInfo qdev_prop_on_off_auto = { @@ -685,141 +508,6 @@ const PropertyInfo qdev_prop_on_off_auto = { .set_default_value = qdev_propinfo_set_default_value_enum, }; -/* --- lost tick policy --- */ - -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, -}; - -/* --- Block device error handling policy --- */ - -QEMU_BUILD_BUG_ON(sizeof(BlockdevOnError) != sizeof(int)); - -const PropertyInfo qdev_prop_blockdev_on_error = { - .name = "BlockdevOnError", - .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, -}; - -/* --- BIOS CHS translation */ - -QEMU_BUILD_BUG_ON(sizeof(BiosAtaTranslation) != sizeof(int)); - -const PropertyInfo qdev_prop_bios_chs_trans = { - .name = "BiosAtaTranslation", - .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, -}; - -/* --- FDC default drive types */ - -const PropertyInfo qdev_prop_fdc_drive_type = { - .name = "FdcDriveType", - .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, -}; - -/* --- MultiFDCompression --- */ - -const PropertyInfo qdev_prop_multifd_compression = { - .name = "MultiFDCompression", - .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, -}; - -/* --- pci address --- */ - -/* - * bus-local address, i.e. "$slot" or "$slot.$fn" - */ -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(dev, 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; - } - if (value < -1 || value > 255) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - name ? name : "null", "pci_devfn"); - return; - } - *ptr = value; - return; - } - - if (sscanf(str, "%x.%x%n", &slot, &fn, &n) != 2) { - fn = 0; - if (sscanf(str, "%x%n", &slot, &n) != 1) { - goto invalid; - } - } - if (str[n] != '\0' || fn > 7 || slot > 31) { - goto invalid; - } - *ptr = slot << 3 | fn; - g_free(str); - return; - -invalid: - error_set_from_qdev_prop_error(errp, EINVAL, dev, prop, str); - g_free(str); -} - -static int print_pci_devfn(DeviceState *dev, Property *prop, char *dest, - size_t len) -{ - int32_t *ptr = qdev_get_prop_ptr(dev, prop); - - if (*ptr == -1) { - return snprintf(dest, len, ""); - } else { - return snprintf(dest, len, "%02x.%x", *ptr >> 3, *ptr & 7); - } -} - -const PropertyInfo qdev_prop_pci_devfn = { - .name = "int32", - .description = "Slot and optional function number, example: 06.0 or 06", - .print = print_pci_devfn, - .get = get_int32, - .set = set_pci_devfn, - .set_default_value = set_default_value_int, -}; - /* --- 32bit unsigned int 'size' type --- */ void qdev_propinfo_get_size32(Object *obj, Visitor *v, const char *name, @@ -868,175 +556,6 @@ const PropertyInfo qdev_prop_size32 = { .set_default_value = qdev_propinfo_set_default_value_uint, }; -/* --- blocksize --- */ - -/* lower limit is sector size */ -#define MIN_BLOCK_SIZE 512 -#define MIN_BLOCK_SIZE_STR "512 B" -/* - * upper limit is arbitrary, 2 MiB looks sufficient for all sensible uses, and - * matches qcow2 cluster size limit - */ -#define MAX_BLOCK_SIZE (2 * MiB) -#define MAX_BLOCK_SIZE_STR "2 MiB" - -static void set_blocksize(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); - uint64_t value; - - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - - if (!visit_type_size(v, name, &value, errp)) { - return; - } - /* value of 0 means "unset" */ - if (value && (value < MIN_BLOCK_SIZE || value > MAX_BLOCK_SIZE)) { - error_setg(errp, - "Property %s.%s doesn't take value %" PRIu64 - " (minimum: " MIN_BLOCK_SIZE_STR - ", maximum: " MAX_BLOCK_SIZE_STR ")", - dev->id ? : "", name, value); - return; - } - - /* We rely on power-of-2 blocksizes for bitmasks */ - if ((value & (value - 1)) != 0) { - error_setg(errp, - "Property %s.%s doesn't take value '%" PRId64 "', " - "it's not a power of 2", dev->id ?: "", name, (int64_t)value); - return; - } - - *ptr = value; -} - -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, - .set = set_blocksize, - .set_default_value = qdev_propinfo_set_default_value_uint, -}; - -/* --- pci host address --- */ - -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); - char buffer[] = "ffff:ff:ff.f"; - char *p = buffer; - int rc = 0; - - /* - * Catch "invalid" device reference from vfio-pci and allow the - * default buffer representing the non-existent device to be used. - */ - if (~addr->domain || ~addr->bus || ~addr->slot || ~addr->function) { - rc = snprintf(buffer, sizeof(buffer), "%04x:%02x:%02x.%0d", - addr->domain, addr->bus, addr->slot, addr->function); - assert(rc == sizeof(buffer) - 1); - } - - visit_type_str(v, name, &p, errp); -} - -/* - * Parse [:]:. - * if is not supplied, it's assumed to be 0. - */ -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(dev, prop); - char *str, *p; - const char *e; - unsigned long val; - 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; - } - - p = str; - if (qemu_strtoul(p, &e, 16, &val) < 0 || val > 0xffff || e == p) { - goto inval; - } - if (*e != ':') { - goto inval; - } - bus = val; - - p = (char *)e + 1; - if (qemu_strtoul(p, &e, 16, &val) < 0 || val > 0x1f || e == p) { - goto inval; - } - if (*e == ':') { - dom = bus; - bus = val; - p = (char *)e + 1; - if (qemu_strtoul(p, &e, 16, &val) < 0 || val > 0x1f || e == p) { - goto inval; - } - } - slot = val; - - if (*e != '.') { - goto inval; - } - p = (char *)e + 1; - if (qemu_strtoul(p, &e, 10, &val) < 0 || val > 7 || e == p) { - goto inval; - } - func = val; - - if (bus > 0xff) { - goto inval; - } - - if (*e) { - goto inval; - } - - addr->domain = dom; - addr->bus = bus; - addr->slot = slot; - addr->function = func; - - g_free(str); - return; - -inval: - error_set_from_qdev_prop_error(errp, EINVAL, dev, prop, str); - g_free(str); -} - -const PropertyInfo qdev_prop_pci_host_devaddr = { - .name = "str", - .description = "Address (bus/device/function) of " - "the host device, example: 04:10.0", - .get = get_pci_host_devaddr, - .set = set_pci_host_devaddr, -}; - /* --- UUID --- */ static void get_uuid(Object *obj, Visitor *v, const char *name, void *opaque, @@ -1286,16 +805,6 @@ void qdev_prop_set_string(DeviceState *dev, const char *name, const char *value) object_property_set_str(OBJECT(dev), name, value, &error_abort); } -void qdev_prop_set_macaddr(DeviceState *dev, const char *name, - const uint8_t *value) -{ - char str[2 * 6 + 5 + 1]; - snprintf(str, sizeof(str), "%02x:%02x:%02x:%02x:%02x:%02x", - value[0], value[1], value[2], value[3], value[4], value[5]); - - object_property_set_str(OBJECT(dev), name, str, &error_abort); -} - void qdev_prop_set_enum(DeviceState *dev, const char *name, int value) { Property *prop; @@ -1420,186 +929,3 @@ const PropertyInfo qdev_prop_link = { .name = "link", .create = create_link_property, }; - -/* --- OffAutoPCIBAR off/auto/bar0/bar1/bar2/bar3/bar4/bar5 --- */ - -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, -}; - -/* --- PCIELinkSpeed 2_5/5/8/16 -- */ - -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); - int speed; - - switch (*p) { - case QEMU_PCI_EXP_LNK_2_5GT: - speed = PCIE_LINK_SPEED_2_5; - break; - case QEMU_PCI_EXP_LNK_5GT: - speed = PCIE_LINK_SPEED_5; - break; - case QEMU_PCI_EXP_LNK_8GT: - speed = PCIE_LINK_SPEED_8; - break; - case QEMU_PCI_EXP_LNK_16GT: - speed = PCIE_LINK_SPEED_16; - break; - default: - /* Unreachable */ - abort(); - } - - visit_type_enum(v, prop->name, &speed, prop->info->enum_table, errp); -} - -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(dev, prop); - int speed; - - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - - if (!visit_type_enum(v, prop->name, &speed, prop->info->enum_table, - errp)) { - return; - } - - switch (speed) { - case PCIE_LINK_SPEED_2_5: - *p = QEMU_PCI_EXP_LNK_2_5GT; - break; - case PCIE_LINK_SPEED_5: - *p = QEMU_PCI_EXP_LNK_5GT; - break; - case PCIE_LINK_SPEED_8: - *p = QEMU_PCI_EXP_LNK_8GT; - break; - case PCIE_LINK_SPEED_16: - *p = QEMU_PCI_EXP_LNK_16GT; - break; - default: - /* Unreachable */ - abort(); - } -} - -const PropertyInfo qdev_prop_pcie_link_speed = { - .name = "PCIELinkSpeed", - .description = "2_5/5/8/16", - .enum_table = &PCIELinkSpeed_lookup, - .get = get_prop_pcielinkspeed, - .set = set_prop_pcielinkspeed, - .set_default_value = qdev_propinfo_set_default_value_enum, -}; - -/* --- PCIELinkWidth 1/2/4/8/12/16/32 -- */ - -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); - int width; - - switch (*p) { - case QEMU_PCI_EXP_LNK_X1: - width = PCIE_LINK_WIDTH_1; - break; - case QEMU_PCI_EXP_LNK_X2: - width = PCIE_LINK_WIDTH_2; - break; - case QEMU_PCI_EXP_LNK_X4: - width = PCIE_LINK_WIDTH_4; - break; - case QEMU_PCI_EXP_LNK_X8: - width = PCIE_LINK_WIDTH_8; - break; - case QEMU_PCI_EXP_LNK_X12: - width = PCIE_LINK_WIDTH_12; - break; - case QEMU_PCI_EXP_LNK_X16: - width = PCIE_LINK_WIDTH_16; - break; - case QEMU_PCI_EXP_LNK_X32: - width = PCIE_LINK_WIDTH_32; - break; - default: - /* Unreachable */ - abort(); - } - - visit_type_enum(v, prop->name, &width, prop->info->enum_table, errp); -} - -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(dev, prop); - int width; - - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - - if (!visit_type_enum(v, prop->name, &width, prop->info->enum_table, - errp)) { - return; - } - - switch (width) { - case PCIE_LINK_WIDTH_1: - *p = QEMU_PCI_EXP_LNK_X1; - break; - case PCIE_LINK_WIDTH_2: - *p = QEMU_PCI_EXP_LNK_X2; - break; - case PCIE_LINK_WIDTH_4: - *p = QEMU_PCI_EXP_LNK_X4; - break; - case PCIE_LINK_WIDTH_8: - *p = QEMU_PCI_EXP_LNK_X8; - break; - case PCIE_LINK_WIDTH_12: - *p = QEMU_PCI_EXP_LNK_X12; - break; - case PCIE_LINK_WIDTH_16: - *p = QEMU_PCI_EXP_LNK_X16; - break; - case PCIE_LINK_WIDTH_32: - *p = QEMU_PCI_EXP_LNK_X32; - break; - default: - /* Unreachable */ - abort(); - } -} - -const PropertyInfo qdev_prop_pcie_link_width = { - .name = "PCIELinkWidth", - .description = "1/2/4/8/12/16/32", - .enum_table = &PCIELinkWidth_lookup, - .get = get_prop_pcielinkwidth, - .set = set_prop_pcielinkwidth, - .set_default_value = qdev_propinfo_set_default_value_enum, -}; From patchwork Mon Oct 5 21:09:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 303654 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6397BC4363A for ; Mon, 5 Oct 2020 21:11:54 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id E900F2078E for ; Mon, 5 Oct 2020 21:11:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="IRtVC8o0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E900F2078E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:47048 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPXlw-0001ge-UW for qemu-devel@archiver.kernel.org; Mon, 05 Oct 2020 17:11:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43264) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPXkX-0008Fn-Bu for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:53228) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPXkU-0007Ru-9V for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601932221; 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=GTor5GPI9oq27QRafwNM8TB2ZTmF47ZN+uwA9IOBGMg=; b=IRtVC8o0HqbbxvsuXKbqMDwKA37/qVnVEKXbbvYOs4lO3fiHbptjD5ZTKcSNNJr2bVtMy2 tHYcQmNv6JYLpaWYA6qsLazBY4kfkv1mbKCCaytuFFdsTYuPRtjkzDA0+igwQTSEi9HINj jJisyMOuG8kNgl6Vx9SRSHZNYi3cdqc= 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-253-aoN-qZgfNdS6YBgBnGRNsA-1; Mon, 05 Oct 2020 17:10:18 -0400 X-MC-Unique: aoN-qZgfNdS6YBgBnGRNsA-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 7551B925C27; Mon, 5 Oct 2020 21:10:17 +0000 (UTC) Received: from localhost (ovpn-119-102.rdu2.redhat.com [10.10.119.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2E5635C1BD; Mon, 5 Oct 2020 21:10:17 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 09/21] hw/core/cpu: Add missing 'exec/cpu-common.h' include Date: Mon, 5 Oct 2020 17:09:48 -0400 Message-Id: <20201005211000.710404-10-ehabkost@redhat.com> In-Reply-To: <20201005211000.710404-1-ehabkost@redhat.com> References: <20201005211000.710404-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/05 02:11:31 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.733, 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: Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang?= =?utf-8?b?w6k=?= , Eduardo Habkost , =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?b?ZMOp?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé cpu_common_reset() uses tcg_flush_softmmu_tlb() which is declared in "exec/cpu-common.h". Add the missing header to avoid when refactoring other headers: hw/core/cpu.c: In function ‘cpu_common_reset’: hw/core/cpu.c:273:9: error: implicit declaration of function ‘tcg_flush_softmmu_tlb’ [-Werror=implicit-function-declaration] 273 | tcg_flush_softmmu_tlb(cpu); | ^~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20200908123433.105706-1-philmd@redhat.com> Signed-off-by: Eduardo Habkost --- hw/core/cpu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/core/cpu.c b/hw/core/cpu.c index c55c09f734c..b06eb38ecca 100644 --- a/hw/core/cpu.c +++ b/hw/core/cpu.c @@ -26,6 +26,7 @@ #include "qemu/log.h" #include "qemu/main-loop.h" #include "exec/log.h" +#include "exec/cpu-common.h" #include "qemu/error-report.h" #include "qemu/qemu-print.h" #include "sysemu/tcg.h" From patchwork Mon Oct 5 21:09:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 303651 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3DACC4363A for ; Mon, 5 Oct 2020 21:16:46 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id D286A20756 for ; Mon, 5 Oct 2020 21:16:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="OOI0Cp4V" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D286A20756 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:34998 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPXqe-0008N1-Qn for qemu-devel@archiver.kernel.org; Mon, 05 Oct 2020 17:16:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43274) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPXkX-0008HG-Uq for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:26 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:44762) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPXkW-0007S4-3P for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601932222; 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=7iQEv3zt3p82NBPGH5arb7e91tJI4oUtytLb1EkHJy4=; b=OOI0Cp4VFL/kRAYH3U+whtser6XXfufkIXvyZxj5SycY14AOmn+DaxJci1HpRlVKEdeCB1 7E4T8ECBYnDIA3wboHGTbdD2ShMru2EBodSFfX/L3cSKqF5ewSSxtyxfHoVrT1WIpAKtwY 4owowVXyhiEbofo07n226S09Xcs1elI= 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-519-HHsBiQw6M_qaHk8d8fq6gA-1; Mon, 05 Oct 2020 17:10:20 -0400 X-MC-Unique: HHsBiQw6M_qaHk8d8fq6gA-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 C0CFB1015C9D; Mon, 5 Oct 2020 21:10:18 +0000 (UTC) Received: from localhost (ovpn-119-102.rdu2.redhat.com [10.10.119.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7C8305C1BD; Mon, 5 Oct 2020 21:10:18 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 10/21] qom: Improve error message displayed with missing object properties Date: Mon, 5 Oct 2020 17:09:49 -0400 Message-Id: <20201005211000.710404-11-ehabkost@redhat.com> In-Reply-To: <20201005211000.710404-1-ehabkost@redhat.com> References: <20201005211000.710404-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/05 02:11:31 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.733, 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: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , Li Qiang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Paolo Bonzini Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Instead of only displaying the property missing, also display the object name. This help developer to quickly figure out the mistake without opening a debugger. Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Eduardo Habkost Reviewed-by: Li Qiang Acked-by: Paolo Bonzini Message-Id: <20200920155340.401482-1-f4bug@amsat.org> Signed-off-by: Eduardo Habkost --- qom/object.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qom/object.c b/qom/object.c index c335dce7e4a..10653552334 100644 --- a/qom/object.c +++ b/qom/object.c @@ -1291,7 +1291,8 @@ ObjectProperty *object_property_find_err(Object *obj, const char *name, { ObjectProperty *prop = object_property_find(obj, name); if (!prop) { - error_setg(errp, "Property '.%s' not found", name); + error_setg(errp, "Property '%s.%s' not found", + object_get_typename(obj), name); } return prop; } From patchwork Mon Oct 5 21:09:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 303646 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C96DC4363A for ; Mon, 5 Oct 2020 21:22:46 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id B33AC212CC for ; Mon, 5 Oct 2020 21:22:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="BE7Zb2JG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B33AC212CC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:53370 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPXwS-0007fV-C1 for qemu-devel@archiver.kernel.org; Mon, 05 Oct 2020 17:22:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43288) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPXkZ-0008JB-31 for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:27 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:25174) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPXkW-0007SB-3F for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601932223; 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=CFkRUXqjKf/4IKRjJGRwHfEVy0pxseiDrE05rRerkyI=; b=BE7Zb2JGRECBEtpCrmQv3+useOCUetgL80GOgciLDpbSuvHyx927xs18MyS2l8g5FzXzP2 NJHiNJN8GBZaIDC8PQGHzsET/eP7jHMeLv5rwIEd+wcYcNLmXWR3V2sYi4rh9gHgIXI/dW v3HHe42NkSnDa0IkeFSQRTEnBoyWzOk= 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-468-zlX4B4HENLe869JEvgd6JQ-1; Mon, 05 Oct 2020 17:10:21 -0400 X-MC-Unique: zlX4B4HENLe869JEvgd6JQ-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 42CA41015C9E; Mon, 5 Oct 2020 21:10:20 +0000 (UTC) Received: from localhost (ovpn-119-102.rdu2.redhat.com [10.10.119.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 022695C1BD; Mon, 5 Oct 2020 21:10:19 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 11/21] qom: Fix DECLARE_*CHECKER documentation Date: Mon, 5 Oct 2020 17:09:50 -0400 Message-Id: <20201005211000.710404-12-ehabkost@redhat.com> In-Reply-To: <20201005211000.710404-1-ehabkost@redhat.com> References: <20201005211000.710404-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/05 01:25:11 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.733, 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_H5=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: Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang?= =?utf-8?b?w6k=?= , Eduardo Habkost , =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?b?ZMOp?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Correct copy/paste mistake in the DECLARE_INSTANCE_CHECKER and DECLARE_CLASS_CHECKERS documentation. Signed-off-by: Eduardo Habkost Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Paolo Bonzini Message-Id: <20201003025424.199291-2-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost --- include/qom/object.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/qom/object.h b/include/qom/object.h index 27aaa67e63f..de121d8d8e8 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -170,7 +170,7 @@ struct Object * Direct usage of this macro should be avoided, and the complete * OBJECT_DECLARE_TYPE macro is recommended instead. * - * This macro will provide the three standard type cast functions for a + * This macro will provide the instance type cast functions for a * QOM type. */ #define DECLARE_INSTANCE_CHECKER(InstanceType, OBJ_NAME, TYPENAME) \ @@ -187,7 +187,7 @@ struct Object * Direct usage of this macro should be avoided, and the complete * OBJECT_DECLARE_TYPE macro is recommended instead. * - * This macro will provide the three standard type cast functions for a + * This macro will provide the class type cast functions for a * QOM type. */ #define DECLARE_CLASS_CHECKERS(ClassType, OBJ_NAME, TYPENAME) \ From patchwork Mon Oct 5 21:09:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 272009 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F47DC4727F for ; Mon, 5 Oct 2020 21:17:49 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id D113F208C3 for ; Mon, 5 Oct 2020 21:17:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="U6YsqPWS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D113F208C3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:36118 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPXrf-0000Q6-Qw for qemu-devel@archiver.kernel.org; Mon, 05 Oct 2020 17:17:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43306) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPXkb-0008PN-MQ for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:51086) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPXkX-0007SM-BX for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601932224; 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=yIOlXrv/RBvf5BoM2U2VFlFly8atKbalLltlNkph3bc=; b=U6YsqPWS1ilxcborrfDUsubvigl9UZVDwirC2imv3yLMBgQAEDPcq6KI3snETh8ToofrNy n12iVtvxvQgS+z7q2/FuT7T4OZTnhiltRGm6MBhDaUNbGk0lkrU6vHTqclQ1b2GFLFw7Iw 2ST4rdq8Qeyaup5ATmO7sZNFYhtL2u0= 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-591-I25DKRAaM-uxi_FD4S6lIg-1; Mon, 05 Oct 2020 17:10:22 -0400 X-MC-Unique: I25DKRAaM-uxi_FD4S6lIg-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 85D98873084; Mon, 5 Oct 2020 21:10:21 +0000 (UTC) Received: from localhost (ovpn-119-102.rdu2.redhat.com [10.10.119.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 438DC5D9CD; Mon, 5 Oct 2020 21:10:21 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 12/21] docs/devel/qom: Fix indentation of bulleted list Date: Mon, 5 Oct 2020 17:09:51 -0400 Message-Id: <20201005211000.710404-13-ehabkost@redhat.com> In-Reply-To: <20201005211000.710404-1-ehabkost@redhat.com> References: <20201005211000.710404-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/05 02:11:31 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.733, 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: Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang?= =?utf-8?b?w6k=?= , Eduardo Habkost Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The list was incorrectly parsed as a literal block due to indentation. Signed-off-by: Eduardo Habkost Reviewed-by: Paolo Bonzini Message-Id: <20201003025424.199291-3-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost --- docs/devel/qom.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/devel/qom.rst b/docs/devel/qom.rst index 0b943b2a1a8..c4857d95c8e 100644 --- a/docs/devel/qom.rst +++ b/docs/devel/qom.rst @@ -8,9 +8,9 @@ The QEMU Object Model provides a framework for registering user creatable types and instantiating objects from those types. QOM provides the following features: - - System for dynamically registering types - - Support for single-inheritance of types - - Multiple inheritance of stateless interfaces +- System for dynamically registering types +- Support for single-inheritance of types +- Multiple inheritance of stateless interfaces .. code-block:: c :caption: Creating a minimal type From patchwork Mon Oct 5 21:09:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 303649 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84C4CC4363A for ; Mon, 5 Oct 2020 21:20:18 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id DCB3F208C3 for ; Mon, 5 Oct 2020 21:20:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="W4f7YBfO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DCB3F208C3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:43460 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPXu4-0003VP-T3 for qemu-devel@archiver.kernel.org; Mon, 05 Oct 2020 17:20:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43304) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPXkb-0008OJ-E5 for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:30936) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPXkZ-0007Sa-5S for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601932226; 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=W+yWMzr7we7iUkfgz+kLkjKlVO4iF5CR5vCYlbGAjXM=; b=W4f7YBfOAkZL1pwBGmjK7kbbGB3e2q7oK5KA6Ye7TGMMbgSDn6P/Mx+JxstlS26FfBAh2S y2cwdcSR0jE5phLfw8Zlc1wUbgLqyyK9ECrGkLcXspZpviN5jfRmWYVf599o9rMRPs2VBy H7yccILMO6thfrxkJNl8WAaYG561Ick= 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-60-6n565AwYO3mNHhBpxhkKoA-1; Mon, 05 Oct 2020 17:10:24 -0400 X-MC-Unique: 6n565AwYO3mNHhBpxhkKoA-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 625071DDED; Mon, 5 Oct 2020 21:10:23 +0000 (UTC) Received: from localhost (ovpn-119-102.rdu2.redhat.com [10.10.119.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id ECE3160BFA; Mon, 5 Oct 2020 21:10:22 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 13/21] docs/devel/qom: Fix indentation of code blocks Date: Mon, 5 Oct 2020 17:09:52 -0400 Message-Id: <20201005211000.710404-14-ehabkost@redhat.com> In-Reply-To: <20201005211000.710404-1-ehabkost@redhat.com> References: <20201005211000.710404-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=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/05 01:25:11 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.733, 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_H5=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: Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang?= =?utf-8?b?w6k=?= , Eduardo Habkost Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Some code blocks had one extra space, fix that. Signed-off-by: Eduardo Habkost Reviewed-by: Paolo Bonzini Message-Id: <20201003025424.199291-4-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost --- docs/devel/qom.rst | 76 +++++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/docs/devel/qom.rst b/docs/devel/qom.rst index c4857d95c8e..a47e1b9a239 100644 --- a/docs/devel/qom.rst +++ b/docs/devel/qom.rst @@ -284,28 +284,28 @@ in the header file: .. code-block:: c :caption: Declaring a simple type - OBJECT_DECLARE_SIMPLE_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE) + OBJECT_DECLARE_SIMPLE_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE) This is equivalent to the following: .. code-block:: c :caption: Expansion from declaring a simple type - typedef struct MyDevice MyDevice; - typedef struct MyDeviceClass MyDeviceClass; + typedef struct MyDevice MyDevice; + typedef struct MyDeviceClass MyDeviceClass; - G_DEFINE_AUTOPTR_CLEANUP_FUNC(MyDeviceClass, object_unref) + G_DEFINE_AUTOPTR_CLEANUP_FUNC(MyDeviceClass, object_unref) - #define MY_DEVICE_GET_CLASS(void *obj) \ - OBJECT_GET_CLASS(MyDeviceClass, obj, TYPE_MY_DEVICE) - #define MY_DEVICE_CLASS(void *klass) \ - OBJECT_CLASS_CHECK(MyDeviceClass, klass, TYPE_MY_DEVICE) - #define MY_DEVICE(void *obj) - OBJECT_CHECK(MyDevice, obj, TYPE_MY_DEVICE) + #define MY_DEVICE_GET_CLASS(void *obj) \ + OBJECT_GET_CLASS(MyDeviceClass, obj, TYPE_MY_DEVICE) + #define MY_DEVICE_CLASS(void *klass) \ + OBJECT_CLASS_CHECK(MyDeviceClass, klass, TYPE_MY_DEVICE) + #define MY_DEVICE(void *obj) + OBJECT_CHECK(MyDevice, obj, TYPE_MY_DEVICE) - struct MyDeviceClass { - DeviceClass parent_class; - }; + struct MyDeviceClass { + DeviceClass parent_class; + }; The 'struct MyDevice' needs to be declared separately. If the type requires virtual functions to be declared in the class @@ -319,33 +319,33 @@ In the simple case the OBJECT_DEFINE_TYPE macro is suitable: .. code-block:: c :caption: Defining a simple type - OBJECT_DEFINE_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE) + OBJECT_DEFINE_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE) This is equivalent to the following: .. code-block:: c :caption: Expansion from defining a simple type - static void my_device_finalize(Object *obj); - static void my_device_class_init(ObjectClass *oc, void *data); - static void my_device_init(Object *obj); - - static const TypeInfo my_device_info = { - .parent = TYPE_DEVICE, - .name = TYPE_MY_DEVICE, - .instance_size = sizeof(MyDevice), - .instance_init = my_device_init, - .instance_finalize = my_device_finalize, - .class_size = sizeof(MyDeviceClass), - .class_init = my_device_class_init, - }; - - static void - my_device_register_types(void) - { - type_register_static(&my_device_info); - } - type_init(my_device_register_types); + static void my_device_finalize(Object *obj); + static void my_device_class_init(ObjectClass *oc, void *data); + static void my_device_init(Object *obj); + + static const TypeInfo my_device_info = { + .parent = TYPE_DEVICE, + .name = TYPE_MY_DEVICE, + .instance_size = sizeof(MyDevice), + .instance_init = my_device_init, + .instance_finalize = my_device_finalize, + .class_size = sizeof(MyDeviceClass), + .class_init = my_device_class_init, + }; + + static void + my_device_register_types(void) + { + type_register_static(&my_device_info); + } + type_init(my_device_register_types); This is sufficient to get the type registered with the type system, and the three standard methods now need to be implemented @@ -358,9 +358,9 @@ This accepts an array of interface type names. .. code-block:: c :caption: Defining a simple type implementing interfaces - OBJECT_DEFINE_TYPE_WITH_INTERFACES(MyDevice, my_device, - MY_DEVICE, DEVICE, - { TYPE_USER_CREATABLE }, { NULL }) + OBJECT_DEFINE_TYPE_WITH_INTERFACES(MyDevice, my_device, + MY_DEVICE, DEVICE, + { TYPE_USER_CREATABLE }, { NULL }) If the type is not intended to be instantiated, then then the OBJECT_DEFINE_ABSTRACT_TYPE() macro can be used instead: @@ -368,7 +368,7 @@ the OBJECT_DEFINE_ABSTRACT_TYPE() macro can be used instead: .. code-block:: c :caption: Defining a simple abstract type - OBJECT_DEFINE_ABSTRACT_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE) + OBJECT_DEFINE_ABSTRACT_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE) From patchwork Mon Oct 5 21:09:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 303647 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58AA9C4363A for ; Mon, 5 Oct 2020 21:22:14 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id DFD8E208C3 for ; Mon, 5 Oct 2020 21:22:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="FIYEtLdp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DFD8E208C3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:50910 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPXvw-0006fs-QN for qemu-devel@archiver.kernel.org; Mon, 05 Oct 2020 17:22:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43382) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPXkn-0000Bz-G2 for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:52419) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPXkj-0007US-8V for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601932235; 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=uEyhLN+7XslyBoI0Db6s1CZEYZyW8MgA6FMtj5f7PIE=; b=FIYEtLdpcJtrL/Yv8z3FgTGfDXmStCogiF6p/LIpCLGwG6dlsVCZ78RZtsh8OW72O5sAQA /Tn2IJ9PVSZT/hIdoA2L1YfL50EMAZ6qUR2NJI98u70Nogn53vpvKi+oBmhDJA5rUXiPuZ 84ozNjRphD2r8eQujpTseAZ/aNM+qoc= 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-65-ON17W0wNOPO7TeyY14uwJg-1; Mon, 05 Oct 2020 17:10:31 -0400 X-MC-Unique: ON17W0wNOPO7TeyY14uwJg-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 0E7EF18A8220; Mon, 5 Oct 2020 21:10:30 +0000 (UTC) Received: from localhost (ovpn-119-102.rdu2.redhat.com [10.10.119.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id C123660BFA; Mon, 5 Oct 2020 21:10:29 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 14/21] docs/devel/qom: Use *emphasis* for emphasis Date: Mon, 5 Oct 2020 17:09:53 -0400 Message-Id: <20201005211000.710404-15-ehabkost@redhat.com> In-Reply-To: <20201005211000.710404-1-ehabkost@redhat.com> References: <20201005211000.710404-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/05 02:11:31 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.733, 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: Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang?= =?utf-8?b?w6k=?= , Eduardo Habkost , =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?b?ZMOp?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" is not valid reST syntax. Signed-off-by: Eduardo Habkost Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Paolo Bonzini Message-Id: <20201003025424.199291-5-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost --- docs/devel/qom.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/devel/qom.rst b/docs/devel/qom.rst index a47e1b9a239..0c610e20d62 100644 --- a/docs/devel/qom.rst +++ b/docs/devel/qom.rst @@ -174,17 +174,17 @@ dynamically cast it to an object that implements the interface. Methods ======= -A method is a function within the namespace scope of +A *method* is a function within the namespace scope of a class. It usually operates on the object instance by passing it as a strongly-typed first argument. If it does not operate on an object instance, it is dubbed -class method. +*class method*. Methods cannot be overloaded. That is, the #ObjectClass and method name uniquely identity the function to be called; the signature does not vary except for trailing varargs. -Methods are always virtual. Overriding a method in +Methods are always *virtual*. Overriding a method in #TypeInfo.class_init of a subclass leads to any user of the class obtained via OBJECT_GET_CLASS() accessing the overridden function. The original function is not automatically invoked. It is the responsibility From patchwork Mon Oct 5 21:09:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 303645 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F804C4363A for ; Mon, 5 Oct 2020 21:25:30 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 7CE77208C3 for ; Mon, 5 Oct 2020 21:25:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="JIafn13e" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7CE77208C3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:58928 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPXz6-0001bq-KJ for qemu-devel@archiver.kernel.org; Mon, 05 Oct 2020 17:25:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43370) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPXkm-0000Ae-BV for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:53727) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPXki-0007UP-UR for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601932235; 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=oOBeLpeIEpL/TxoU2ObY2AqnifWcBURZsaekTSVcawE=; b=JIafn13eB8SW3hYeUlsTCN1OleHiIpTT41hOupGkALUjfNCjIe63wz7xsDUtBzQ79C1SIa I/64XuiTOZ8duqCMDLcq7enhZHrU2klG//xbPoKRIzQok+Lp5E1ACFnIZ5fxTylys4Bnup Tmne1Cr6BAsTXHwQr5udeih9dSAsIpI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-61-SKSFeW3kPC2_uK7b5ns2RA-1; Mon, 05 Oct 2020 17:10:33 -0400 X-MC-Unique: SKSFeW3kPC2_uK7b5ns2RA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 34CBC873114; Mon, 5 Oct 2020 21:10:32 +0000 (UTC) Received: from localhost (ovpn-119-102.rdu2.redhat.com [10.10.119.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id E9F0378807; Mon, 5 Oct 2020 21:10:31 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 15/21] docs/devel/qom: Remove usage of Date: Mon, 5 Oct 2020 17:09:54 -0400 Message-Id: <20201005211000.710404-16-ehabkost@redhat.com> In-Reply-To: <20201005211000.710404-1-ehabkost@redhat.com> References: <20201005211000.710404-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/05 02:11:31 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.733, 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: Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang?= =?utf-8?b?w6k=?= , Eduardo Habkost Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" is not valid reST syntax. Function @argument references don't need additional markup, so just remove . Constants were changed to use reST ``code`` syntax Signed-off-by: Eduardo Habkost Reviewed-by: Paolo Bonzini Message-Id: <20201003025424.199291-6-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost --- include/qom/object.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/qom/object.h b/include/qom/object.h index de121d8d8e8..e80092f349a 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -1256,7 +1256,7 @@ char *object_property_get_str(Object *obj, const char *name, * Writes an object's canonical path to a property. * * If the link property was created with - * OBJ_PROP_LINK_STRONG bit, the old target object is + * %OBJ_PROP_LINK_STRONG bit, the old target object is * unreferenced, and a reference is added to the new target object. * * Returns: %true on success, %false on failure. @@ -1603,16 +1603,16 @@ void object_property_allow_set_link(const Object *obj, const char *name, * * Links form the graph in the object model. * - * The @check() callback is invoked when + * The @check() callback is invoked when * object_property_set_link() is called and can raise an error to prevent the - * link being set. If @check is NULL, the property is read-only + * link being set. If @check is NULL, the property is read-only * and cannot be set. * * Ownership of the pointer that @child points to is transferred to the - * link property. The reference count for *@child is + * link property. The reference count for *@child is * managed by the property from after the function returns till the * property is deleted with object_property_del(). If the - * @flags OBJ_PROP_LINK_STRONG bit is set, + * @flags %OBJ_PROP_LINK_STRONG bit is set, * the reference count is decremented when the property is deleted or * modified. * @@ -1823,7 +1823,7 @@ ObjectProperty *object_class_property_add_uint64_ptr(ObjectClass *klass, * Add an alias for a property on an object. This function will add a property * of the same type as the forwarded property. * - * The caller must ensure that @target_obj stays alive as long as + * The caller must ensure that @target_obj stays alive as long as * this property exists. In the case of a child object or an alias on the same * object this will be the case. For aliases to other objects the caller is * responsible for taking a reference. From patchwork Mon Oct 5 21:09:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 272005 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0DCC7C4363A for ; Mon, 5 Oct 2020 21:24:51 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 4DE3E208C3 for ; Mon, 5 Oct 2020 21:24:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="HKbPINPD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4DE3E208C3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:57182 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPXyT-0000py-Ag for qemu-devel@archiver.kernel.org; Mon, 05 Oct 2020 17:24:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43416) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPXkp-0000EP-5a for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:44 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:32866) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPXkj-0007UY-92 for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601932236; 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=qrGBXwYPvVUK3Z/wlHGaca4o9hAswgl9cl/WwDh4d1E=; b=HKbPINPDOLrhwS0CY83kPFbvSOi6NG0lB728rJz3YKo9tX1MadKDxO42f5rAmrwKtoNRqO WGxmrT3ptgPqJm5YQJTMGRDhOX+3Ug3vmmzMT4UT9odFG2q7fegKtCRj2k3tUnTP7Sv9JO FLgOsaQK41lrVmci9T78R9tosWvbsdE= 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-JDsxe8qwMRKxmgx5NgpD0w-1; Mon, 05 Oct 2020 17:10:34 -0400 X-MC-Unique: JDsxe8qwMRKxmgx5NgpD0w-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 42F7D18A8223; Mon, 5 Oct 2020 21:10:33 +0000 (UTC) Received: from localhost (ovpn-119-102.rdu2.redhat.com [10.10.119.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0936B78807; Mon, 5 Oct 2020 21:10:32 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 16/21] docs/devel/qom: Avoid long lines Date: Mon, 5 Oct 2020 17:09:55 -0400 Message-Id: <20201005211000.710404-17-ehabkost@redhat.com> In-Reply-To: <20201005211000.710404-1-ehabkost@redhat.com> References: <20201005211000.710404-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/05 01:25:11 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.733, 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_H5=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: Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang?= =?utf-8?b?w6k=?= , Eduardo Habkost , =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?b?ZMOp?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Long code lines don't look good in the rendered documents, make them shorter. Signed-off-by: Eduardo Habkost Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Paolo Bonzini Message-Id: <20201003025424.199291-7-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost --- docs/devel/qom.rst | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/devel/qom.rst b/docs/devel/qom.rst index 0c610e20d62..42d0dc4f4da 100644 --- a/docs/devel/qom.rst +++ b/docs/devel/qom.rst @@ -284,7 +284,8 @@ in the header file: .. code-block:: c :caption: Declaring a simple type - OBJECT_DECLARE_SIMPLE_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE) + OBJECT_DECLARE_SIMPLE_TYPE(MyDevice, my_device, + MY_DEVICE, DEVICE) This is equivalent to the following: @@ -360,7 +361,8 @@ This accepts an array of interface type names. OBJECT_DEFINE_TYPE_WITH_INTERFACES(MyDevice, my_device, MY_DEVICE, DEVICE, - { TYPE_USER_CREATABLE }, { NULL }) + { TYPE_USER_CREATABLE }, + { NULL }) If the type is not intended to be instantiated, then then the OBJECT_DEFINE_ABSTRACT_TYPE() macro can be used instead: @@ -368,7 +370,8 @@ the OBJECT_DEFINE_ABSTRACT_TYPE() macro can be used instead: .. code-block:: c :caption: Defining a simple abstract type - OBJECT_DEFINE_ABSTRACT_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE) + OBJECT_DEFINE_ABSTRACT_TYPE(MyDevice, my_device, + MY_DEVICE, DEVICE) From patchwork Mon Oct 5 21:09:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 272007 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0B38C4363A for ; Mon, 5 Oct 2020 21:20:29 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 61E9A208C3 for ; Mon, 5 Oct 2020 21:20:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ZPFUtSoH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 61E9A208C3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:44420 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPXuG-0003vH-D7 for qemu-devel@archiver.kernel.org; Mon, 05 Oct 2020 17:20:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43388) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPXko-0000CC-11 for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:42 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:22097) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPXkl-0007Ue-0N for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601932237; 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=367k11b3zf85sB9S3cGnMHOkTfp1Umm4WdkTED0mfWc=; b=ZPFUtSoHVbTrvSNDHJ04cqzYFZAigxzntZhox74R1RZboqoyJoWUZdKGo+lf1bcVtkx/Yz 5y+JNO43sknl2hwivzICdkEYvbeMoKQ/9SHXyWAtH64BMkBsbSpDFufUHQf0ExBmztSjhm ki495v39GY6oKDF3jeNCZn+QC1p2rlk= 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-221-ZYv6mUTpNmGawxD6y1PG-g-1; Mon, 05 Oct 2020 17:10:35 -0400 X-MC-Unique: ZYv6mUTpNmGawxD6y1PG-g-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 554701015C9D; Mon, 5 Oct 2020 21:10:34 +0000 (UTC) Received: from localhost (ovpn-119-102.rdu2.redhat.com [10.10.119.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id EE40F55764; Mon, 5 Oct 2020 21:10:33 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 17/21] kernel-doc: Handle function typedefs that return pointers Date: Mon, 5 Oct 2020 17:09:56 -0400 Message-Id: <20201005211000.710404-18-ehabkost@redhat.com> In-Reply-To: <20201005211000.710404-1-ehabkost@redhat.com> References: <20201005211000.710404-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/05 02:11:31 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.733, 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: Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang?= =?utf-8?b?w6k=?= , Eduardo Habkost Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" One example that was not being parsed correctly by kernel-doc is: typedef Object *(ObjectPropertyResolve)(Object *obj, void *opaque, const char *part); Signed-off-by: Eduardo Habkost Reviewed-by: Paolo Bonzini Message-Id: <20201003024123.193840-2-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost --- scripts/kernel-doc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 40ad782e342..57a4a72970f 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc @@ -1318,8 +1318,8 @@ sub dump_typedef($$) { $x =~ s@/\*.*?\*/@@gos; # strip comments. # Parse function prototypes - if ($x =~ /typedef\s+(\w+)\s*\(\*\s*(\w\S+)\s*\)\s*\((.*)\);/ || - $x =~ /typedef\s+(\w+)\s*(\w\S+)\s*\s*\((.*)\);/) { + if ($x =~ /typedef\s+(\w+\s*\**)\s*\(\*\s*(\w\S+)\s*\)\s*\((.*)\);/ || + $x =~ /typedef\s+(\w+\s*\**)\s*(\w\S+)\s*\s*\((.*)\);/) { # Function typedefs $return_type = $1; From patchwork Mon Oct 5 21:09:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 272010 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D428C47095 for ; Mon, 5 Oct 2020 21:16:47 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 0FC0B2075A for ; Mon, 5 Oct 2020 21:16:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="DbWYt1TS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0FC0B2075A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:35150 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPXqf-0008Qs-T8 for qemu-devel@archiver.kernel.org; Mon, 05 Oct 2020 17:16:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43390) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPXko-0000CE-5c for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:42 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:40556) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPXkm-0007Ul-2M for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601932239; 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=V/DIhyhvEtrkwNuf6rQ6jEyrj/vxKuw1OcuQxCV9B4o=; b=DbWYt1TS4BYyXQHu5tFoZT6a7fYGJCysdj0rwhd/da/owFOuImpaFhGsMm7hK6ci2gAd4t 0cBS1vvqIJJIaQ708HjSz2Ej7BALe2fquMV+Vj6YJCfOihxm5eyKTmflyKG+csLa1dPnte rbqoccffoMLskSUOu4XHKTeToAkqUAI= 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-423-K4gQbGmtPwa98O2of_imcA-1; Mon, 05 Oct 2020 17:10:37 -0400 X-MC-Unique: K4gQbGmtPwa98O2of_imcA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 42270925C27; Mon, 5 Oct 2020 21:10:36 +0000 (UTC) Received: from localhost (ovpn-119-102.rdu2.redhat.com [10.10.119.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id D6D0578800; Mon, 5 Oct 2020 21:10:35 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 18/21] kernel-doc: Handle function typedefs without asterisks Date: Mon, 5 Oct 2020 17:09:57 -0400 Message-Id: <20201005211000.710404-19-ehabkost@redhat.com> In-Reply-To: <20201005211000.710404-1-ehabkost@redhat.com> References: <20201005211000.710404-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/05 02:11:31 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.733, 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: Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang?= =?utf-8?b?w6k=?= , Eduardo Habkost Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Example of typedef that was not parsed by kernel-doc: typedef void (ObjectUnparent)(Object *obj); Signed-off-by: Eduardo Habkost Reviewed-by: Paolo Bonzini Message-Id: <20201003024123.193840-3-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost --- scripts/kernel-doc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 57a4a72970f..57b911ff174 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc @@ -1318,7 +1318,7 @@ sub dump_typedef($$) { $x =~ s@/\*.*?\*/@@gos; # strip comments. # Parse function prototypes - if ($x =~ /typedef\s+(\w+\s*\**)\s*\(\*\s*(\w\S+)\s*\)\s*\((.*)\);/ || + if ($x =~ /typedef\s+(\w+\s*\**)\s*\(\*?\s*(\w\S+)\s*\)\s*\((.*)\);/ || $x =~ /typedef\s+(\w+\s*\**)\s*(\w\S+)\s*\s*\((.*)\);/) { # Function typedefs From patchwork Mon Oct 5 21:09:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 272006 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57D1BC4363A for ; Mon, 5 Oct 2020 21:22:30 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id B4E07208C3 for ; Mon, 5 Oct 2020 21:22:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="bMpY+jVu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B4E07208C3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:52156 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPXwC-0007A9-Oo for qemu-devel@archiver.kernel.org; Mon, 05 Oct 2020 17:22:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43438) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPXks-0000Io-40 for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:38688) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPXkn-0007Uv-N4 for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601932240; 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=td30pR2ic3PP+wNUfwn0QC1kXRtCDJrHhwN3ScMRbng=; b=bMpY+jVuyxtxAdugC6nOf+ruBMBUfJ8ZQxiQcXrNHwtpxPTntjB/ZZq3aoWzbE3SBXqPBk zpUumdLmZf+XXtDE9y+KgBWMTdk9C2tr2c3zFcd7vRLHZssxcmWJP7FAJoUvspdv3P418x RH+vrRD2yBAqevmLj7jOAYz5nLMXRi0= 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-321-flPsGMcPOk20uqX502UJQw-1; Mon, 05 Oct 2020 17:10:38 -0400 X-MC-Unique: flPsGMcPOk20uqX502UJQw-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 1CA0D1DDF6; Mon, 5 Oct 2020 21:10:37 +0000 (UTC) Received: from localhost (ovpn-119-102.rdu2.redhat.com [10.10.119.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id D901310013C0; Mon, 5 Oct 2020 21:10:36 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 19/21] qom: Explicitly tag doc comments for typedefs and structs Date: Mon, 5 Oct 2020 17:09:58 -0400 Message-Id: <20201005211000.710404-20-ehabkost@redhat.com> In-Reply-To: <20201005211000.710404-1-ehabkost@redhat.com> References: <20201005211000.710404-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/05 02:11:31 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.733, 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: Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang?= =?utf-8?b?w6k=?= , Eduardo Habkost Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" If we explicitly indicate we are documenting a typedef or a struct, we'll be able to remove the $decl_type='type name' hack from kernel-doc. Signed-off-by: Eduardo Habkost Reviewed-by: Paolo Bonzini Message-Id: <20201003024123.193840-4-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost --- include/qom/object.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/include/qom/object.h b/include/qom/object.h index e80092f349a..d378f13a116 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -31,7 +31,7 @@ typedef struct InterfaceInfo InterfaceInfo; typedef struct ObjectProperty ObjectProperty; /** - * ObjectPropertyAccessor: + * typedef ObjectPropertyAccessor: * @obj: the object that owns the property * @v: the visitor that contains the property data * @name: the name of the property @@ -47,7 +47,7 @@ typedef void (ObjectPropertyAccessor)(Object *obj, Error **errp); /** - * ObjectPropertyResolve: + * typedef ObjectPropertyResolve: * @obj: the object that owns the property * @opaque: the opaque registered with the property * @part: the name of the property @@ -66,7 +66,7 @@ typedef Object *(ObjectPropertyResolve)(Object *obj, const char *part); /** - * ObjectPropertyRelease: + * typedef ObjectPropertyRelease: * @obj: the object that owns the property * @name: the name of the property * @opaque: the opaque registered with the property @@ -78,7 +78,7 @@ typedef void (ObjectPropertyRelease)(Object *obj, void *opaque); /** - * ObjectPropertyInit: + * typedef ObjectPropertyInit: * @obj: the object that owns the property * @prop: the property to set * @@ -101,7 +101,7 @@ struct ObjectProperty }; /** - * ObjectUnparent: + * typedef ObjectUnparent: * @obj: the object that is being removed from the composition tree * * Called when an object is being removed from the QOM composition tree. @@ -110,7 +110,7 @@ struct ObjectProperty typedef void (ObjectUnparent)(Object *obj); /** - * ObjectFree: + * typedef ObjectFree: * @obj: the object being freed * * Called when an object's last reference is removed. @@ -120,7 +120,7 @@ typedef void (ObjectFree)(void *obj); #define OBJECT_CLASS_CAST_CACHE 4 /** - * ObjectClass: + * struct ObjectClass: * * The base for all classes. The only thing that #ObjectClass contains is an * integer type handle. @@ -140,7 +140,7 @@ struct ObjectClass }; /** - * Object: + * struct Object: * * The base for all objects. The first member of this object is a pointer to * a #ObjectClass. Since C guarantees that the first member of a structure @@ -370,7 +370,7 @@ struct Object true, { NULL }) /** - * TypeInfo: + * struct TypeInfo: * @name: The name of the type. * @parent: The name of the parent type. * @instance_size: The size of the object (derivative of #Object). If @@ -496,7 +496,7 @@ struct TypeInfo OBJECT_CLASS_CHECK(class, object_get_class(OBJECT(obj)), name) /** - * InterfaceInfo: + * struct InterfaceInfo: * @type: The name of the interface. * * The information associated with an interface. @@ -506,7 +506,7 @@ struct InterfaceInfo { }; /** - * InterfaceClass: + * struct InterfaceClass: * @parent_class: the base class * * The class for all interfaces. Subclasses of this class should only add From patchwork Mon Oct 5 21:09:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 272008 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E5D5C4727D for ; Mon, 5 Oct 2020 21:20:19 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id A58F5208C3 for ; Mon, 5 Oct 2020 21:20:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="C7IQ4N43" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A58F5208C3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:43510 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPXu5-0003X6-Fk for qemu-devel@archiver.kernel.org; Mon, 05 Oct 2020 17:20:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43424) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPXkr-0000G9-7C for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:51304) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPXkn-0007VB-Nx for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601932241; 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=g6mjwRssty9u8VVE9TYy5V6D+c+F3D0e09kwIT5voW4=; b=C7IQ4N43+mmmEsZaRKPuXgH2DsrQkOlBNF5AjocGAWaN61k8No4SJFUWOE3WRZD7tmUfKO 30y1q3F5i5k6Xm7CezzBZNouU3Xg1d8khaKGSPGDVg5xNwPH1zzbFw7OGdIys9KDkKY3aQ x719QrSiENrcN4QcZad1tgPlTyajlDg= 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-498-rhZiGEXEPIKZWgkOsOKOWw-1; Mon, 05 Oct 2020 17:10:39 -0400 X-MC-Unique: rhZiGEXEPIKZWgkOsOKOWw-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 2B244925C47; Mon, 5 Oct 2020 21:10:38 +0000 (UTC) Received: from localhost (ovpn-119-102.rdu2.redhat.com [10.10.119.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id CD77160C84; Mon, 5 Oct 2020 21:10:37 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 20/21] memory: Explicitly tag doc comments for structs Date: Mon, 5 Oct 2020 17:09:59 -0400 Message-Id: <20201005211000.710404-21-ehabkost@redhat.com> In-Reply-To: <20201005211000.710404-1-ehabkost@redhat.com> References: <20201005211000.710404-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=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/05 01:25:11 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.733, 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_H5=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: Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang?= =?utf-8?b?w6k=?= , Eduardo Habkost Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This will allow us to remove the QEMU-specific $decl_type='type name' hack from the kernel-doc script. Signed-off-by: Eduardo Habkost Reviewed-by: Paolo Bonzini Message-Id: <20201003024123.193840-5-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost --- include/exec/memory.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/exec/memory.h b/include/exec/memory.h index dee09851622..622207bde12 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -443,7 +443,7 @@ struct IOMMUMemoryRegion { QLIST_FOREACH((n), &(mr)->iommu_notify, node) /** - * MemoryListener: callbacks structure for updates to the physical memory map + * struct MemoryListener: callbacks structure for updates to the physical memory map * * Allows a component to adjust to changes in the guest-visible memory map. * Use with memory_listener_register() and memory_listener_unregister(). @@ -681,7 +681,7 @@ struct MemoryListener { }; /** - * AddressSpace: describes a mapping of addresses to #MemoryRegion objects + * struct AddressSpace: describes a mapping of addresses to #MemoryRegion objects */ struct AddressSpace { /* private: */ @@ -721,7 +721,7 @@ static inline FlatView *address_space_to_flatview(AddressSpace *as) /** - * MemoryRegionSection: describes a fragment of a #MemoryRegion + * struct MemoryRegionSection: describes a fragment of a #MemoryRegion * * @mr: the region, or %NULL if empty * @fv: the flat view of the address space the region is mapped in From patchwork Mon Oct 5 21:10:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 272004 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0A22C4363A for ; Mon, 5 Oct 2020 21:26:47 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 0640F20FC3 for ; Mon, 5 Oct 2020 21:26:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="VUwR3JLR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0640F20FC3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:33424 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPY0M-0002t5-5d for qemu-devel@archiver.kernel.org; Mon, 05 Oct 2020 17:26:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43452) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPXks-0000Ky-HW for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:39773) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPXkq-0007Vm-RS for qemu-devel@nongnu.org; Mon, 05 Oct 2020 17:10:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601932243; 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=RwYCiXdAmTXHfZXidBeGhTZZfr5GhsciCqhJzbwtFTQ=; b=VUwR3JLR0l0D+t4yQj3C4psI9OmH43CaLZQdBZcXTncnW0eJnN54MHPDZZKvfdluYqpBc0 4Ko/fi3txhYrzjxZsf5qnjN1XuIKKEbWT+CxJy8YUcyGTO+iUAE4W6fspfTYdqtmTWRg3q bSAcvfFBV7UVMjNBS7yAIDWZLQ6Du1M= 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-347-EeCNH76cMZWk_qRxYZYTlg-1; Mon, 05 Oct 2020 17:10:41 -0400 X-MC-Unique: EeCNH76cMZWk_qRxYZYTlg-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 7E4D6107ACF5; Mon, 5 Oct 2020 21:10:39 +0000 (UTC) Received: from localhost (ovpn-119-102.rdu2.redhat.com [10.10.119.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3D46755770; Mon, 5 Oct 2020 21:10:39 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 21/21] kernel-doc: Remove $decl_type='type name' hack Date: Mon, 5 Oct 2020 17:10:00 -0400 Message-Id: <20201005211000.710404-22-ehabkost@redhat.com> In-Reply-To: <20201005211000.710404-1-ehabkost@redhat.com> References: <20201005211000.710404-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/05 02:11:31 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.733, 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: Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang?= =?utf-8?b?w6k=?= , Eduardo Habkost Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The $decl_type='type name' hack makes it impossible to document macros with uppercase names (e.g. most of the macros in object.h). Now that we have explicitly tagged the struct and typedef doc comments in memory.h and object.h, we don't need that hack anymore. This will make the documentation for the macros in object.h finally be rendered as expected. Signed-off-by: Eduardo Habkost Reviewed-by: Paolo Bonzini Message-Id: <20201003024123.193840-6-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost --- scripts/kernel-doc | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 57b911ff174..0ff62bb6a2d 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc @@ -1064,14 +1064,6 @@ sub output_blockhead { sub dump_declaration($$) { no strict 'refs'; my ($prototype, $file) = @_; - if ($decl_type eq 'type name') { - if ($prototype =~ /^(enum|struct|union)\s+/) { - $decl_type = $1; - } else { - return; - } - } - my $func = "dump_" . $decl_type; &$func(@_); } @@ -1928,9 +1920,7 @@ sub process_name($$) { ++$warnings; } - if ($identifier =~ m/^[A-Z]/) { - $decl_type = 'type name'; - } elsif ($identifier =~ m/^struct\b/) { + if ($identifier =~ m/^struct\b/) { $decl_type = 'struct'; } elsif ($identifier =~ m/^union\b/) { $decl_type = 'union';