From patchwork Tue Oct 6 22:09:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 303574 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 5FA51C4363D for ; Tue, 6 Oct 2020 22:11: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 C81CA206F4 for ; Tue, 6 Oct 2020 22:11: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="Gse+Z0LF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C81CA206F4 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]:46350 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPvBS-0008Oy-Lh for qemu-devel@archiver.kernel.org; Tue, 06 Oct 2020 18:11:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45190) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPv9U-0006Xp-Mg for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:09:44 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:47828) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPv9S-0006Ne-TM for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:09:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602022182; 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=B6cF7lQvkk+FkcOqj6DRLMk1v+/6oqu6ycHyF+8k1zE=; b=Gse+Z0LFujvXrbFxIKxKHZ3UxswGalAVAoJJGXbzUO4HZSnCuOvjZa9ItB7iDrjsYYDSXe DlMBUW6eYjvX/RF7mDR2wdz1xxXOHmVtch1cM7LcCdHOEUozrYVOLTy6gCFNOyolUj//jX jKuSirfAzuH+ZA1Nq8zPhcFiXIJpahA= 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-55-IKqgTpFsOCeIIL_l6o6NYA-1; Tue, 06 Oct 2020 18:09:39 -0400 X-MC-Unique: IKqgTpFsOCeIIL_l6o6NYA-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 1E2068015A4; Tue, 6 Oct 2020 22:09: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 6F34755770; Tue, 6 Oct 2020 22:09:35 +0000 (UTC) From: Eduardo Habkost To: Peter Maydell , qemu-devel@nongnu.org Subject: [PULL 01/21] hw/core/qdev-properties: Use qemu_strtol() in set_mac() handler Date: Tue, 6 Oct 2020 18:09:10 -0400 Message-Id: <20201006220930.908275-2-ehabkost@redhat.com> In-Reply-To: <20201006220930.908275-1-ehabkost@redhat.com> References: <20201006220930.908275-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/06 00:55:20 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 343c824da0..080ba319a1 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 Tue Oct 6 22:09:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 271934 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 CBAA7C4363D for ; Tue, 6 Oct 2020 22:15:09 +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 2D84F208C7 for ; Tue, 6 Oct 2020 22:15:09 +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="SVyrGzXb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2D84F208C7 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]:53688 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPvEi-00032N-0U for qemu-devel@archiver.kernel.org; Tue, 06 Oct 2020 18:15:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45234) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPv9X-0006dH-CD for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:09:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:53417) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPv9V-0006Nw-6B for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:09:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602022184; 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=TQrJR/6dMGOXDTDBtU3yQvNtbCLkiFO0qMnbgwdKuNQ=; b=SVyrGzXb0L0hf4gIISAneLlzPb+gflk9NL8AkQVFsRYo5ELhOggSszqfxl7A9zSc4DtWJy c0hyCdveu8c3OTqqMHpZq7Z9LUJHJawuCJsHRDMTi9/U933tfBKdY0Ex26uOOXxPb0Ej0K Lg1xQTeGuC/m4GwaJBfDwqSo9PHrKjc= 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-38-mpwyeuacO7OeOVp3ydzRXQ-1; Tue, 06 Oct 2020 18:09:40 -0400 X-MC-Unique: mpwyeuacO7OeOVp3ydzRXQ-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 3D13B1007472; Tue, 6 Oct 2020 22:09: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 0089B55770; Tue, 6 Oct 2020 22:09:38 +0000 (UTC) From: Eduardo Habkost To: Peter Maydell , qemu-devel@nongnu.org Subject: [PULL 02/21] hw/core/qdev-properties: Use qemu_strtoul() in set_pci_host_devaddr() Date: Tue, 6 Oct 2020 18:09:11 -0400 Message-Id: <20201006220930.908275-3-ehabkost@redhat.com> In-Reply-To: <20201006220930.908275-1-ehabkost@redhat.com> References: <20201006220930.908275-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/06 01:55:55 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 080ba319a1..a1190a5db9 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 Tue Oct 6 22:09:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 271935 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 EBEB5C41604 for ; Tue, 6 Oct 2020 22:11: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 58382206F4 for ; Tue, 6 Oct 2020 22: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="KUBiJBYm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 58382206F4 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]:46526 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPvBU-0008TK-9s for qemu-devel@archiver.kernel.org; Tue, 06 Oct 2020 18:11:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45214) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPv9W-0006aI-2Q for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:09:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:43897) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPv9U-0006Np-Dz for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:09:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602022183; 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=Tob52WJXbRQTgBbAGe3gjemoLfoU6QvcwdYp5p4ZS+c=; b=KUBiJBYmPek7+Z1SMSJCpO8nC17yLZIj9xz165L8s9DNyZpBvJlkGiLFhVszYytTQcFtKy uChM+PuCHuHn7mr0nVEslWRB36PX01BdbjVzI40d/dzh5dWIpcM9DXWchiLxMv44KDDjCg TAObOPlV9+vQ1dT2fvChOS7wEIxTmvo= 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-493-EMHPQUpKM6KyZD61LhpHmQ-1; Tue, 06 Oct 2020 18:09:41 -0400 X-MC-Unique: EMHPQUpKM6KyZD61LhpHmQ-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 6D9A8804015; Tue, 6 Oct 2020 22:09:40 +0000 (UTC) Received: from localhost (ovpn-119-102.rdu2.redhat.com [10.10.119.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 25ED76115F; Tue, 6 Oct 2020 22:09:39 +0000 (UTC) From: Eduardo Habkost To: Peter Maydell , qemu-devel@nongnu.org Subject: [PULL 03/21] hw/core/qdev-properties: Fix code style Date: Tue, 6 Oct 2020 18:09:12 -0400 Message-Id: <20201006220930.908275-4-ehabkost@redhat.com> In-Reply-To: <20201006220930.908275-1-ehabkost@redhat.com> References: <20201006220930.908275-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/06 00:55:20 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 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 a1190a5db9..071fd5864a 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 Tue Oct 6 22:09:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 271932 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 65804C4363D for ; Tue, 6 Oct 2020 22:18:17 +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 99559208C7 for ; Tue, 6 Oct 2020 22:18:16 +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="hiyqSu2F" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 99559208C7 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]:33888 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPvHj-0006eo-Hx for qemu-devel@archiver.kernel.org; Tue, 06 Oct 2020 18:18:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45250) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPv9Y-0006ep-2L for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:09:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:39603) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPv9V-0006O1-T7 for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:09:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602022185; 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=pQPKxH+xyKblM5N24NT1ykX8A0kYnSIEW2cQbV0qbko=; b=hiyqSu2FFA16PNfoNE9WXPlokq2olb/jUAbWu2/0LFY1itXWvZyGDrwdgXkxLN3mhozZDM gAIseGZ4jv/p7/Jyd6BQbyuOobgRGegCJwlexm5tIbRcjI770T1HQH66wyNuJYifNnMr3K +e7rnfVbNqzOXAVuqWqmhkVdebcGE2o= 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-182-csjWj25vMQesuXSafKVjLA-1; Tue, 06 Oct 2020 18:09:43 -0400 X-MC-Unique: csjWj25vMQesuXSafKVjLA-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 D31BD393B4; Tue, 6 Oct 2020 22:09:41 +0000 (UTC) Received: from localhost (ovpn-119-102.rdu2.redhat.com [10.10.119.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9B9436EF44; Tue, 6 Oct 2020 22:09:41 +0000 (UTC) From: Eduardo Habkost To: Peter Maydell , qemu-devel@nongnu.org Subject: [PULL 04/21] hw/core/qdev-properties: Export enum-related functions Date: Tue, 6 Oct 2020 18:09:13 -0400 Message-Id: <20201006220930.908275-5-ehabkost@redhat.com> In-Reply-To: <20201006220930.908275-1-ehabkost@redhat.com> References: <20201006220930.908275-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=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/06 01:55:55 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 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 0000000000..2a8c9a306a --- /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 071fd5864a..76417d0936 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 Tue Oct 6 22:09:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 303573 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 E2B73C4363D for ; Tue, 6 Oct 2020 22:11:52 +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 4AE67206F4 for ; Tue, 6 Oct 2020 22:11:52 +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="HiFrj8/b" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4AE67206F4 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]:46844 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPvBX-00009P-79 for qemu-devel@archiver.kernel.org; Tue, 06 Oct 2020 18:11:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45260) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPv9Y-0006gr-TZ for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:09:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:43613) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPv9W-0006OE-Rb for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:09:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602022186; 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=0gJxsvwebiBR0X3LwAWoFDimHE1dHMJfymqECue56co=; b=HiFrj8/bo+ddgqwbn48HP3TdYsIaRN2FjbL5aWXh3ieJo0Yd0qylZ9vDqPXLwrxlpjoO+F nY8iIxdtrusS6cHuoQTtN8rRL+trPVlxjRufmcKYZPWuPYxJAMhLRybppzuOmApSi19yDd 16VrhVP02k3HvMRl0GW5g1dyqbcEWws= 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-542-_BcP59-fOBeKfAzgbdh8CA-1; Tue, 06 Oct 2020 18:09:44 -0400 X-MC-Unique: _BcP59-fOBeKfAzgbdh8CA-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 CABCE80400D; Tue, 6 Oct 2020 22:09:42 +0000 (UTC) Received: from localhost (ovpn-119-102.rdu2.redhat.com [10.10.119.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9091E6EF44; Tue, 6 Oct 2020 22:09:42 +0000 (UTC) From: Eduardo Habkost To: Peter Maydell , qemu-devel@nongnu.org Subject: [PULL 05/21] hw/core/qdev-properties: Export qdev_prop_enum Date: Tue, 6 Oct 2020 18:09:14 -0400 Message-Id: <20201006220930.908275-6-ehabkost@redhat.com> In-Reply-To: <20201006220930.908275-1-ehabkost@redhat.com> References: <20201006220930.908275-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=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/06 01:55:55 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 528310bb22..4437450065 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 76417d0936..31dfe441e2 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 Tue Oct 6 22:09:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 303571 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 0A286C4363D for ; Tue, 6 Oct 2020 22:16:39 +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 606E1208C3 for ; Tue, 6 Oct 2020 22:16:38 +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="hDbZB/g4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 606E1208C3 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]:57786 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPvG9-0004ph-3Y for qemu-devel@archiver.kernel.org; Tue, 06 Oct 2020 18:16:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45272) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPv9a-0006k7-Bn for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:09:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:40637) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPv9Y-0006OZ-9e for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:09:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602022187; 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=yjvdzkE+xZm75SW25GId3gVQ78ZG6AlqaQK4IFwHnU4=; b=hDbZB/g4pMyLtPzaeSXARL9ISX5A4vy0awJG88Fv2za5mZVyGbNxraohpAjc+4ceVmbR87 a0PDe9RJiywz2bzwO5YSZTFt0sa3GbAeRRrskoLnjRkAQjwQ4HwY3+6hGmR6mkqtn43/WC OgnEPYbSAuDXczx7xBFSAP2inyiRpl8= 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-354-A_gp8Z0SOkec0uk-cXxJ9A-1; Tue, 06 Oct 2020 18:09:45 -0400 X-MC-Unique: A_gp8Z0SOkec0uk-cXxJ9A-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 E86C6393B1; Tue, 6 Oct 2020 22:09:43 +0000 (UTC) Received: from localhost (ovpn-119-102.rdu2.redhat.com [10.10.119.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id A9C9E610F3; Tue, 6 Oct 2020 22:09:43 +0000 (UTC) From: Eduardo Habkost To: Peter Maydell , qemu-devel@nongnu.org Subject: [PULL 06/21] hw/core/qdev-properties: Export some integer-related functions Date: Tue, 6 Oct 2020 18:09:15 -0400 Message-Id: <20201006220930.908275-7-ehabkost@redhat.com> In-Reply-To: <20201006220930.908275-1-ehabkost@redhat.com> References: <20201006220930.908275-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/06 01:55:55 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 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 2a8c9a306a..9cf5cc1d51 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 31dfe441e2..37e309077a 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 Tue Oct 6 22:09:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 303569 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 695C9C4363D for ; Tue, 6 Oct 2020 22:19: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 747E4208C7 for ; Tue, 6 Oct 2020 22:19: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="bdvszxR0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 747E4208C7 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]:38224 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPvJI-0008Rd-F4 for qemu-devel@archiver.kernel.org; Tue, 06 Oct 2020 18:19:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45344) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPv9g-0006vQ-RK for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:09:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:22948) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPv9Z-0006Ol-Hc for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:09:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602022188; 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=I14GSdy/IMSQlkp4atg7Lb0MA+2BVhMkUUIKIeAUFqk=; b=bdvszxR0ynRSY2524i1cwFgx6QLAcuHGO8u24pTBb9yjLQQW/1l7AvWz7BNUobyGaNDOEW C10yN0UdBXopNwNfVNQKvRk7ZhpV6f3931rVXlPnh9ZBYFiEOgBJAV3CY8on+g0smz5vIh 2Zi0zvHhnK/AG+oWHaXXauhnb8F8lG4= 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-422-vLB2w9bdP4uPQ_WAnuNDwA-1; Tue, 06 Oct 2020 18:09:46 -0400 X-MC-Unique: vLB2w9bdP4uPQ_WAnuNDwA-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 46690186DD28; Tue, 6 Oct 2020 22:09:45 +0000 (UTC) Received: from localhost (ovpn-119-102.rdu2.redhat.com [10.10.119.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id C9E595C1C4; Tue, 6 Oct 2020 22:09:44 +0000 (UTC) From: Eduardo Habkost To: Peter Maydell , qemu-devel@nongnu.org Subject: [PULL 07/21] hw/core/qdev-properties: Extract system-mode specific properties Date: Tue, 6 Oct 2020 18:09:16 -0400 Message-Id: <20201006220930.908275-8-ehabkost@redhat.com> In-Reply-To: <20201006220930.908275-1-ehabkost@redhat.com> References: <20201006220930.908275-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/06 01:55:55 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 b29daf4fb5..49bdd12581 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 37e309077a..509cbf155d 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 Tue Oct 6 22:09:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 271933 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 39503C4363D for ; Tue, 6 Oct 2020 22:15:37 +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 8DAF3208C7 for ; Tue, 6 Oct 2020 22:15:36 +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="QeUFxDYY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8DAF3208C7 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]:55240 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPvF9-0003gF-HH for qemu-devel@archiver.kernel.org; Tue, 06 Oct 2020 18:15:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45320) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPv9d-0006sA-Ng for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:09:53 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:25215) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPv9c-0006P1-1G for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:09:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602022191; 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=YKCkiaBWgmXwTIOi3dm1ldBMIOifsVSdk8OwCSTSmCk=; b=QeUFxDYYCrSN3AWsG/RJt72l2uI6rDAVTnV3mPOs79y7Z9f/o/jeCfgak4KcY4jFm4I2uC 66W1pgWLH1OPpkKtb0EiVNaPvfKqvmfMG+lY4Wcj/PuCn/wCeVTTHGqo+1UxWd7Cidjk4z JmxPUm7XH6sMnQBZX9WxooLo5gpyfMA= 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-353-jeenq5M9NkSBuyojzb25ng-1; Tue, 06 Oct 2020 18:09:47 -0400 X-MC-Unique: jeenq5M9NkSBuyojzb25ng-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 4639C804011; Tue, 6 Oct 2020 22:09:46 +0000 (UTC) Received: from localhost (ovpn-119-102.rdu2.redhat.com [10.10.119.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id EFE0B5D9D2; Tue, 6 Oct 2020 22:09:45 +0000 (UTC) From: Eduardo Habkost To: Peter Maydell , qemu-devel@nongnu.org Subject: [PULL 08/21] hw/core/cpu: Add missing 'exec/cpu-common.h' include Date: Tue, 6 Oct 2020 18:09:17 -0400 Message-Id: <20201006220930.908275-9-ehabkost@redhat.com> In-Reply-To: <20201006220930.908275-1-ehabkost@redhat.com> References: <20201006220930.908275-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/06 00:55:20 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 c55c09f734..b06eb38ecc 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 Tue Oct 6 22:09:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 271930 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 14900C4363D for ; Tue, 6 Oct 2020 22:20:58 +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 68915208C7 for ; Tue, 6 Oct 2020 22:20:57 +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="cWXsHGpG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 68915208C7 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]:41550 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPvKK-0001Qj-8u for qemu-devel@archiver.kernel.org; Tue, 06 Oct 2020 18:20:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45312) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPv9d-0006rB-DP for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:09:53 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:24599) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPv9b-0006Ow-FI for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:09:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602022190; 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=msMKr4jy4cvV0aBat9MPAID6/pVxztok8ewRpD09LUY=; b=cWXsHGpG4+YvjQtffHD4X312S3Oq/r9In0gZdPPNVbzNJE38Nh2XCxf6gGoTZwRfBgbHBs 6FmxWa4ZINmPo1qCm7WIiuOJesNsQ+urTGuxqaasj1vEulv/3nTliWNQ56FC1GwIO8WHNf 3eI3E3l7wLF2SNX/Fx4IVCSM6mTV+tc= 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-102-MdLodyApO9WpkLfuom-Olg-1; Tue, 06 Oct 2020 18:09:48 -0400 X-MC-Unique: MdLodyApO9WpkLfuom-Olg-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 521BE1091069; Tue, 6 Oct 2020 22:09:47 +0000 (UTC) Received: from localhost (ovpn-119-102.rdu2.redhat.com [10.10.119.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 04FFB6EF44; Tue, 6 Oct 2020 22:09:46 +0000 (UTC) From: Eduardo Habkost To: Peter Maydell , qemu-devel@nongnu.org Subject: [PULL 09/21] qom: Improve error message displayed with missing object properties Date: Tue, 6 Oct 2020 18:09:18 -0400 Message-Id: <20201006220930.908275-10-ehabkost@redhat.com> In-Reply-To: <20201006220930.908275-1-ehabkost@redhat.com> References: <20201006220930.908275-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=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/06 01:55:55 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 , 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 c335dce7e4..1065355233 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 Tue Oct 6 22:09:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 271931 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 1A164C4363D for ; Tue, 6 Oct 2020 22:18:58 +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 7E09C208C7 for ; Tue, 6 Oct 2020 22:18:57 +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="WbO+jqhS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7E09C208C7 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]:35426 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPvIO-0007Hp-ER for qemu-devel@archiver.kernel.org; Tue, 06 Oct 2020 18:18:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45336) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPv9e-0006uX-LX for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:09:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:38297) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPv9c-0006PO-MC for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:09:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602022191; 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=OsOiiuvqOs2Dd30cGtUozQ7z6HBtUUrHJem2QryIQsk=; b=WbO+jqhS1A7xsDr6jLI22lD19Je/vOaLoWltNzRfqCWNJe/Zg2QqB8obnphWflqCqahJZC rklklmWXYpw5PNPK1ak4h4P0QYAuyqz9d8QS9U246+I3+TrQPCCx//orHBeskp1+gVEyF5 HByrohu4yXlWGyvB4D9oE8gDQ9q6Y5s= 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-148-TFUQ_w45OcK76NjybXH3DA-1; Tue, 06 Oct 2020 18:09:49 -0400 X-MC-Unique: TFUQ_w45OcK76NjybXH3DA-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 6F54180400C; Tue, 6 Oct 2020 22:09:48 +0000 (UTC) Received: from localhost (ovpn-119-102.rdu2.redhat.com [10.10.119.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 366299F54; Tue, 6 Oct 2020 22:09:48 +0000 (UTC) From: Eduardo Habkost To: Peter Maydell , qemu-devel@nongnu.org Subject: [PULL 10/21] qom: Fix DECLARE_*CHECKER documentation Date: Tue, 6 Oct 2020 18:09:19 -0400 Message-Id: <20201006220930.908275-11-ehabkost@redhat.com> In-Reply-To: <20201006220930.908275-1-ehabkost@redhat.com> References: <20201006220930.908275-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/06 01:55:55 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 27aaa67e63..de121d8d8e 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 Tue Oct 6 22:09:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 303568 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 B54F4C4363D for ; Tue, 6 Oct 2020 22:21: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 2E32A208C7 for ; Tue, 6 Oct 2020 22:21:14 +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="G2udnyJ5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2E32A208C7 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]:42588 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPvKa-0001sB-Tx for qemu-devel@archiver.kernel.org; Tue, 06 Oct 2020 18:21:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45350) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPv9h-0006vu-0M for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:10:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:42678) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPv9d-0006Pu-KH for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:09:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602022192; 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=6j4I3T1AQxgWNexEUqKVfn14dDoHgmXBvUQWwTTcuq4=; b=G2udnyJ5qc+nJUtR7Os8zr7HwnZG9hFIMhY0afIHjncUuEgjGUAlpNofeF+l90TwLBItnr Zz2BbfAtbM1ru+M5URqsWt+mCt62aYmafsCf7Mh1ZHz7pb243JNXP/CAELMP991KVbHDmG H3rlI174mURBFEnw1urIpcNPdA71hCM= 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-309-1HVqyq8EM9igAnVVgrSDGQ-1; Tue, 06 Oct 2020 18:09:50 -0400 X-MC-Unique: 1HVqyq8EM9igAnVVgrSDGQ-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 ADD218064B1; Tue, 6 Oct 2020 22:09:49 +0000 (UTC) Received: from localhost (ovpn-119-102.rdu2.redhat.com [10.10.119.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 70C936EF47; Tue, 6 Oct 2020 22:09:49 +0000 (UTC) From: Eduardo Habkost To: Peter Maydell , qemu-devel@nongnu.org Subject: [PULL 11/21] docs/devel/qom: Fix indentation of bulleted list Date: Tue, 6 Oct 2020 18:09:20 -0400 Message-Id: <20201006220930.908275-12-ehabkost@redhat.com> In-Reply-To: <20201006220930.908275-1-ehabkost@redhat.com> References: <20201006220930.908275-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/06 00:55:20 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 0b943b2a1a..c4857d95c8 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 Tue Oct 6 22:09:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 303567 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 BD8F0C4363D for ; Tue, 6 Oct 2020 22:23:13 +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 362F6208C7 for ; Tue, 6 Oct 2020 22:23: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="X/jqJPfY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 362F6208C7 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]:47832 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPvMW-00041W-1f for qemu-devel@archiver.kernel.org; Tue, 06 Oct 2020 18:23:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45402) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPv9r-0006xP-LU for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:10:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:46214) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPv9k-0006QR-2d for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:10:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602022196; 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=tnsjj9C5RQu2WRx13/fI7VawgK6FrgrAigOLfZASKdU=; b=X/jqJPfYQfpOvQEhIY0+3Abe2v8BTIDUq5q/9j1G7yW/rw24ZeZu16rEIzpnflecFDDu7s D8Xu+jcs91aPuM0CN6usVPulOXjQ51FI6oYCwU5jm/pmkMGbS10mbgCFoBxwd6ymnAHX2Y KUD+pdsKEiikjBXenktR17fbeECzz5A= 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-44-lLaNHBF5OlWOMPReeAFICA-1; Tue, 06 Oct 2020 18:09:52 -0400 X-MC-Unique: lLaNHBF5OlWOMPReeAFICA-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 5773B8064DD; Tue, 6 Oct 2020 22:09:51 +0000 (UTC) Received: from localhost (ovpn-119-102.rdu2.redhat.com [10.10.119.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1AEFF10013BD; Tue, 6 Oct 2020 22:09:51 +0000 (UTC) From: Eduardo Habkost To: Peter Maydell , qemu-devel@nongnu.org Subject: [PULL 12/21] docs/devel/qom: Fix indentation of code blocks Date: Tue, 6 Oct 2020 18:09:21 -0400 Message-Id: <20201006220930.908275-13-ehabkost@redhat.com> In-Reply-To: <20201006220930.908275-1-ehabkost@redhat.com> References: <20201006220930.908275-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/06 01:55:55 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 c4857d95c8..a47e1b9a23 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 Tue Oct 6 22:09:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 271928 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 6D2C8C4363D for ; Tue, 6 Oct 2020 22:23: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 9842F208C7 for ; Tue, 6 Oct 2020 22:23: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="ReRCt/lz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9842F208C7 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]:48960 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPvN5-0004Uk-Jw for qemu-devel@archiver.kernel.org; Tue, 06 Oct 2020 18:23:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45390) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPv9p-0006x9-9G for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:10:06 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:33894) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPv9g-0006QK-IH for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:10:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602022195; 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=0/DM8LdvkAX3OKo9k6OAPh30L61ayGkkr7+pmXORRKQ=; b=ReRCt/lz55Ke98ol9aD+3ZtZbaK3SQy4//wyjduMd5lvfgK/+V4XXBd3SG4YWvl5z43ER7 qVs9VddwyjcuYyfyTq5uzaoSsXNhTWvEj3uYqELEfQXBQlI7uIL3ZeoUyZhCN7NpBT1PDP 2QahbfXvFZA0xPqKQWeE5OP/b0FT01M= 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-505-NUA-zrhyNSG48PNjeFtcRA-1; Tue, 06 Oct 2020 18:09:53 -0400 X-MC-Unique: NUA-zrhyNSG48PNjeFtcRA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8CBD180400D; Tue, 6 Oct 2020 22:09:52 +0000 (UTC) Received: from localhost (ovpn-119-102.rdu2.redhat.com [10.10.119.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 43A8038A; Tue, 6 Oct 2020 22:09:52 +0000 (UTC) From: Eduardo Habkost To: Peter Maydell , qemu-devel@nongnu.org Subject: [PULL 13/21] docs/devel/qom: Use *emphasis* for emphasis Date: Tue, 6 Oct 2020 18:09:22 -0400 Message-Id: <20201006220930.908275-14-ehabkost@redhat.com> In-Reply-To: <20201006220930.908275-1-ehabkost@redhat.com> References: <20201006220930.908275-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/06 00:55:20 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 a47e1b9a23..0c610e20d6 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 Tue Oct 6 22:09:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 303565 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 C318BC4363D for ; Tue, 6 Oct 2020 22:26:24 +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 22DBC208C7 for ; Tue, 6 Oct 2020 22:26:24 +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="HXET2XzU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 22DBC208C7 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]:55374 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPvPa-0007Dt-W7 for qemu-devel@archiver.kernel.org; Tue, 06 Oct 2020 18:26:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45436) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPv9w-0006yu-A6 for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:10:12 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:36310) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPv9k-0006Qb-DO for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:10:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602022197; 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=TxzBiWyZbfg1Cf7kyIFDKW2qT3du2mroxbtRPNPBeLQ=; b=HXET2XzU6TjfHDit1VWjV+UErFMiC1U8v20J6W9BZRQKalrQomAASz1zMKl1VQHC31xdmN q56bSJtY7zdOk429DS3l81uTr0prszzY9zIks0UGJQc9M9noKK7tiYO9nW3xPHXRZLkodA mnx8AoDQ6Zee6Q0cCHKpAa8HRNWXCFg= 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-285-_YMKmGEHMlu6-I5vOGuJRw-1; Tue, 06 Oct 2020 18:09:54 -0400 X-MC-Unique: _YMKmGEHMlu6-I5vOGuJRw-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 98BB510082E6; Tue, 6 Oct 2020 22:09:53 +0000 (UTC) Received: from localhost (ovpn-119-102.rdu2.redhat.com [10.10.119.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5C98C76641; Tue, 6 Oct 2020 22:09:53 +0000 (UTC) From: Eduardo Habkost To: Peter Maydell , qemu-devel@nongnu.org Subject: [PULL 14/21] docs/devel/qom: Remove usage of Date: Tue, 6 Oct 2020 18:09:23 -0400 Message-Id: <20201006220930.908275-15-ehabkost@redhat.com> In-Reply-To: <20201006220930.908275-1-ehabkost@redhat.com> References: <20201006220930.908275-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/06 00:55:20 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 de121d8d8e..e80092f349 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 Tue Oct 6 22:09:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 271929 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 011FDC4363D for ; Tue, 6 Oct 2020 22:22:24 +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 4FB5A208C7 for ; Tue, 6 Oct 2020 22:22:23 +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="Yt9c0XLX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4FB5A208C7 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]:45042 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPvLi-0002tC-8p for qemu-devel@archiver.kernel.org; Tue, 06 Oct 2020 18:22:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45420) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPv9u-0006xj-5F for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:10:10 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:28061) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPv9m-0006Qh-U4 for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:10:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602022198; 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=0NiMn8tMJFfC7+1aj5pWZLH/OfpiYwNGWD61hCDLyTs=; b=Yt9c0XLXBhATpeZ/ywE4OlRCai8f3vnZzQ2xBSInVcT3lClg0vvrNfRDkR9WqFRNkK53Do 0AovbLZoRE2sHGqDtdwKhBI15ksMFlZ0qDH8Fajs1ySrpGtkbP8Pau2Ckf8tC+/Z0j94yn KEUR5tkCFVVD1VyilOTX+OcX3wSfNfg= 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-456-DIUq7Bt2PQucZ7h8nmNUSA-1; Tue, 06 Oct 2020 18:09:56 -0400 X-MC-Unique: DIUq7Bt2PQucZ7h8nmNUSA-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 A257410082EA; Tue, 6 Oct 2020 22:09:54 +0000 (UTC) Received: from localhost (ovpn-119-102.rdu2.redhat.com [10.10.119.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6815755770; Tue, 6 Oct 2020 22:09:54 +0000 (UTC) From: Eduardo Habkost To: Peter Maydell , qemu-devel@nongnu.org Subject: [PULL 15/21] docs/devel/qom: Avoid long lines Date: Tue, 6 Oct 2020 18:09:24 -0400 Message-Id: <20201006220930.908275-16-ehabkost@redhat.com> In-Reply-To: <20201006220930.908275-1-ehabkost@redhat.com> References: <20201006220930.908275-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/06 01:55:55 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 0c610e20d6..42d0dc4f4d 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 Tue Oct 6 22:09:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 303572 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 50B95C4363D for ; Tue, 6 Oct 2020 22:15:32 +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 A0E97208C7 for ; Tue, 6 Oct 2020 22:15:31 +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="Om1Q5cg1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A0E97208C7 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]:55026 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPvF4-0003b6-JX for qemu-devel@archiver.kernel.org; Tue, 06 Oct 2020 18:15:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45478) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPv9x-00072L-OD for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:10:13 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:23002) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPv9t-0006R3-Ts for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:10:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602022204; 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=oPydp3bkYwR6GH+LZESlXGy3MqkTdWCORJFCS9/vfSs=; b=Om1Q5cg1P7WEvEYa20BQSqBvo5q6gXMOy3v6PPjGxR8I9J7i6u8RM+HOE2cw9xSZnVUqg+ Pu2d9xpf62TqNiBVNqaimARDzTaKOOaBAo1EM3Hs6ke1bOWiWHrE/oSzHkm/i43IGoDvsi TE3UUPbqnaasPTK4aGdwYjEBW0ZMhic= 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-32-3h1kuw24Pv6iXN1KLTJH0g-1; Tue, 06 Oct 2020 18:09:57 -0400 X-MC-Unique: 3h1kuw24Pv6iXN1KLTJH0g-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CD246804018; Tue, 6 Oct 2020 22:09:55 +0000 (UTC) Received: from localhost (ovpn-119-102.rdu2.redhat.com [10.10.119.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 840761A835; Tue, 6 Oct 2020 22:09:55 +0000 (UTC) From: Eduardo Habkost To: Peter Maydell , qemu-devel@nongnu.org Subject: [PULL 16/21] kernel-doc: Handle function typedefs that return pointers Date: Tue, 6 Oct 2020 18:09:25 -0400 Message-Id: <20201006220930.908275-17-ehabkost@redhat.com> In-Reply-To: <20201006220930.908275-1-ehabkost@redhat.com> References: <20201006220930.908275-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/06 01:55:55 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" 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 40ad782e34..57a4a72970 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 Tue Oct 6 22:09:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 303570 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 41D56C4363D for ; Tue, 6 Oct 2020 22:18: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 9093D208C7 for ; Tue, 6 Oct 2020 22:18: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="CCmba1nP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9093D208C7 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]:35162 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPvIF-0007BM-Gr for qemu-devel@archiver.kernel.org; Tue, 06 Oct 2020 18:18:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45482) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPv9z-00076q-4P for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:10:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:23024) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPv9t-0006Qs-Tm for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:10:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602022202; 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=UYwFN2wkjmvGZMKWCU1JjrjkGzTCLANtS6KjRc+D2pI=; b=CCmba1nPKVBMYDFVg2CABMofSMgr7LCygdWnMS3bPg2itq3qlh4eh8pwt0iIMBQO4RTw0O zT1mLBS/upzaPI6siM4DEVloJHnlUJTOi8hEK8vNQhHvDGmDDsiujEB8cKWz4ZFk/3TLlq bNKD1U5sfp6TzOGVbED5Nr3F4ZmhJYs= 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-110-hw4yifdOOHu7MkWkiJlXFQ-1; Tue, 06 Oct 2020 18:09:58 -0400 X-MC-Unique: hw4yifdOOHu7MkWkiJlXFQ-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 836D980400D; Tue, 6 Oct 2020 22:09:57 +0000 (UTC) Received: from localhost (ovpn-119-102.rdu2.redhat.com [10.10.119.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 42D591002C25; Tue, 6 Oct 2020 22:09:57 +0000 (UTC) From: Eduardo Habkost To: Peter Maydell , qemu-devel@nongnu.org Subject: [PULL 17/21] kernel-doc: Handle function typedefs without asterisks Date: Tue, 6 Oct 2020 18:09:26 -0400 Message-Id: <20201006220930.908275-18-ehabkost@redhat.com> In-Reply-To: <20201006220930.908275-1-ehabkost@redhat.com> References: <20201006220930.908275-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/06 01:55:55 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" 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 57a4a72970..57b911ff17 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 Tue Oct 6 22:09:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 303566 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 EDC23C4363D for ; Tue, 6 Oct 2020 22:24:41 +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 66252208C7 for ; Tue, 6 Oct 2020 22:24:41 +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="MpxqLW9Z" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 66252208C7 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]:51220 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPvNw-0005Ra-C8 for qemu-devel@archiver.kernel.org; Tue, 06 Oct 2020 18:24:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45434) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPv9w-0006yi-8o for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:10:12 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:33338) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPv9o-0006Qo-C8 for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:10:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602022202; 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=33Q2Vi1AhdpNi+URew9hE9hNBXhtoc0//Oh0Xh/8tIo=; b=MpxqLW9Z67jsUNVKSwIO/Kj4mES9PWeg59OGOu46bB2PgAKxSb3X4K49xvGONMtvPsI4/i 31bQgM7HvotTtEn1P26SG9nTIsKeFOD1QKzGWJe/UDiO7XE4LbKF/CnT0pB4OzJ9CdR4Wn Cp3jpbyAT6WbmrD6y0njynwdD+jTUvE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-261-8c4qQTj4OVyUknBhmVpIaQ-1; Tue, 06 Oct 2020 18:09:59 -0400 X-MC-Unique: 8c4qQTj4OVyUknBhmVpIaQ-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 A008B18829D4; Tue, 6 Oct 2020 22:09:58 +0000 (UTC) Received: from localhost (ovpn-119-102.rdu2.redhat.com [10.10.119.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 62C3E6EF47; Tue, 6 Oct 2020 22:09:58 +0000 (UTC) From: Eduardo Habkost To: Peter Maydell , qemu-devel@nongnu.org Subject: [PULL 18/21] qom: Explicitly tag doc comments for typedefs and structs Date: Tue, 6 Oct 2020 18:09:27 -0400 Message-Id: <20201006220930.908275-19-ehabkost@redhat.com> In-Reply-To: <20201006220930.908275-1-ehabkost@redhat.com> References: <20201006220930.908275-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/06 00:55:20 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 e80092f349..d378f13a11 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 Tue Oct 6 22:09:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 303564 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 47091C4363D for ; Tue, 6 Oct 2020 22:29:33 +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 8CCDF206FC for ; Tue, 6 Oct 2020 22:29:32 +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="Cl8jtulw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8CCDF206FC 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]:33264 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPvSd-0001NQ-C1 for qemu-devel@archiver.kernel.org; Tue, 06 Oct 2020 18:29:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45484) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPv9z-00077y-IG for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:10:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:50793) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPv9v-0006Qv-SD for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:10:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602022202; 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=h4ogneDYBvVq18dZ2y7hPL4IVvfOmaXh9FYWhRrlJag=; b=Cl8jtulw2AHaYJrm7fzEDj7+//SC0OFCJQmCbwZnrNH+MfFaCHAmej45AmozH/HPbOskIQ VRHzNjKjhlO1GLBrOp1jlyuMewR2kVIZYvrECJjkdlR5VqLzbfSifgyWbx4GjuF7tWNKtv F7Cm8g+iVZpBzHnNduYrb/tV3NOIVLI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-486-z43qWC_RPwi3-kC542yyXg-1; Tue, 06 Oct 2020 18:10:00 -0400 X-MC-Unique: z43qWC_RPwi3-kC542yyXg-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 BAF4C1091060; Tue, 6 Oct 2020 22:09:59 +0000 (UTC) Received: from localhost (ovpn-119-102.rdu2.redhat.com [10.10.119.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7EE5010013BD; Tue, 6 Oct 2020 22:09:59 +0000 (UTC) From: Eduardo Habkost To: Peter Maydell , qemu-devel@nongnu.org Subject: [PULL 19/21] memory: Explicitly tag doc comments for structs Date: Tue, 6 Oct 2020 18:09:28 -0400 Message-Id: <20201006220930.908275-20-ehabkost@redhat.com> In-Reply-To: <20201006220930.908275-1-ehabkost@redhat.com> References: <20201006220930.908275-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/06 01:55:55 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 dee0985162..622207bde1 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 Tue Oct 6 22:09:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 271927 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 1C6D8C4363D for ; Tue, 6 Oct 2020 22:25:58 +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 730DE208C7 for ; Tue, 6 Oct 2020 22:25:57 +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="XjH0piKS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 730DE208C7 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]:54292 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPvPA-0006nQ-CM for qemu-devel@archiver.kernel.org; Tue, 06 Oct 2020 18:25:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45486) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPvA0-00079O-5S for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:10:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:23577) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPv9v-0006RA-Qv for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:10:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602022204; 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=Wabzeqjx4gl9MHSoxV5ky7HBWx939+T9xiX3U/dgbwI=; b=XjH0piKSixdASl90jFcQU5OSAp5CAu+g+9z9duDpHhRPA2lJ19Dkcu/ynU6DC9TDk68J09 s+3KfU3rQu3Justtk6DstrGChNimQFGSekqaZKHR3xWf9eJ2UyQV2lB167Vr9Wjf6Y+h5Q z2ioo+umZjbB0dqwg75wUwFVDayLvT0= 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-73-zGoc1BbMMFmmseS-qe6DSA-1; Tue, 06 Oct 2020 18:10:01 -0400 X-MC-Unique: zGoc1BbMMFmmseS-qe6DSA-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 B501580400C; Tue, 6 Oct 2020 22:10:00 +0000 (UTC) Received: from localhost (ovpn-119-102.rdu2.redhat.com [10.10.119.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 770406EF43; Tue, 6 Oct 2020 22:10:00 +0000 (UTC) From: Eduardo Habkost To: Peter Maydell , qemu-devel@nongnu.org Subject: [PULL 20/21] kernel-doc: Remove $decl_type='type name' hack Date: Tue, 6 Oct 2020 18:09:29 -0400 Message-Id: <20201006220930.908275-21-ehabkost@redhat.com> In-Reply-To: <20201006220930.908275-1-ehabkost@redhat.com> References: <20201006220930.908275-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/06 00:55:20 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 57b911ff17..0ff62bb6a2 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'; From patchwork Tue Oct 6 22:09:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 271926 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 8ED10C4363D for ; Tue, 6 Oct 2020 22:27:23 +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 AF547206FC for ; Tue, 6 Oct 2020 22:27:22 +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="RXFfSw7H" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AF547206FC 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]:57606 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPvQX-00088i-Jn for qemu-devel@archiver.kernel.org; Tue, 06 Oct 2020 18:27:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45480) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPv9y-00074M-6C for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:10:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:39379) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPv9v-0006RV-Sv for qemu-devel@nongnu.org; Tue, 06 Oct 2020 18:10:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602022207; 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=adKz+t15Ay7dYk3xI2XJtbX9dWYumdGT/9CD6sJlYlk=; b=RXFfSw7HXDs1wFTZzQ9VCPnOv3MkeoViPFR3CQuiz5UnsvYUdE0twmjKjXuiqhi5YzfwOW n87w+I1K2Pr8yB6BgoPx2tJ+QdsXEJ9mci6ETbEU/AJYvVgyeIO+ITIFGzVdCDOkQl8iZG yZTh5NDuhpfDL0lOY9hzZqhuMaG0CHc= 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-527-JWsNrgsnNOatUJOe7hCnZw-1; Tue, 06 Oct 2020 18:10:02 -0400 X-MC-Unique: JWsNrgsnNOatUJOe7hCnZw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CB85310082EC; Tue, 6 Oct 2020 22:10:01 +0000 (UTC) Received: from localhost (ovpn-119-102.rdu2.redhat.com [10.10.119.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 88CAE1A835; Tue, 6 Oct 2020 22:10:01 +0000 (UTC) From: Eduardo Habkost To: Peter Maydell , qemu-devel@nongnu.org Subject: [PULL 21/21] numa: hmat: require parent cache description before the next level one Date: Tue, 6 Oct 2020 18:09:30 -0400 Message-Id: <20201006220930.908275-22-ehabkost@redhat.com> In-Reply-To: <20201006220930.908275-1-ehabkost@redhat.com> References: <20201006220930.908275-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/06 00:55:20 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 Signed-off-by: Eduardo Habkost Message-Id: <20201006150002.1601845-1-imammedo@redhat.com> 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 7d5d413001..7c4dd4e68e 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=%u 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