From patchwork Fri Nov 29 17:46:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Franciosi X-Patchwork-Id: 11267453 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9B931930 for ; Fri, 29 Nov 2019 17:54:22 +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 2A3882158A for ; Fri, 29 Nov 2019 17:54:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=nutanix.com header.i=@nutanix.com header.b="Shfyj6xm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2A3882158A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nutanix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:33280 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iakTF-0006QH-11 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 29 Nov 2019 12:54:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33267) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iakM7-0001sB-8V for qemu-devel@nongnu.org; Fri, 29 Nov 2019 12:47:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iakM3-00006l-HN for qemu-devel@nongnu.org; Fri, 29 Nov 2019 12:46:56 -0500 Received: from mx0a-002c1b01.pphosted.com ([148.163.151.68]:52214) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iakM3-0008QL-5R for qemu-devel@nongnu.org; Fri, 29 Nov 2019 12:46:55 -0500 Received: from pps.filterd (m0127840.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xATHfgPo014251; Fri, 29 Nov 2019 09:46:51 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; h=from : to : cc : subject : date : message-id : content-type : content-transfer-encoding : mime-version; s=proofpoint20171006; bh=9pCAEP83Kq5qR/IQmBdSypK1yhBUiE3yE+vc2+m3QQ0=; b=Shfyj6xmksu88M5CAVqIqI6b4+01MZnd5yVrtZlraxbddPWNxYkvZm7cxpqUgFW4IqEa 2PuKwYSDFswbnb7W4rxKMfzF/lzk9hzbtmafQmi98A2UldhW0OCHt2rGPmb+FK+lqbyC 6LBF/2hFs7Ynd6YDduf8Q7hmMNMVJtpVHlMt1yeAX169Tkjqlk/cO0GzIk5FASVSC1GA 2Gyj/JBz6di2ui4P9arnauUdMFWJfMlkAtXHHa/Jta3SNCzBOE7glX0KRKqEnGcs/6m0 f1HnbLOzPpp0CSkeV8zyZv4FhmG0lZ0Jha2b7+g8TY+RZ/3OzHTfn4hU6ISfKDtVTG5O mg== Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1nam02lp2056.outbound.protection.outlook.com [104.47.36.56]) by mx0a-002c1b01.pphosted.com with ESMTP id 2whjspd8t3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 29 Nov 2019 09:46:51 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JomzIyaYS5jnT/gnrRXZlsDdSRNQzBxJr8cyCaK9gV4H1/M4J4IYC5DAhc2vy+UFhwDeHyzdg581g7/MgtFDNR32213+DtJUPqsDaB4VaxXthC9u2ppt+bkbWis4fv9OYy5NVfWe9hWybo3hqAv2XAwR2IDTYGUao942pljYb07P66JAz8XQbH7ohqGqgoemOnHW62GnQxqSA5McCzdDanjBt0goQalqTBQ0I09RobQAheUVQtR2JQ2lMYhgtoCNoWSJWtsXtzLrGijSaKiWfC/C7Ea8oYIpgdQrHKrtvg5U2tR8NGXa5ajbw2L9veiqAo3l6JHpC07VZ+t7XT0u6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9pCAEP83Kq5qR/IQmBdSypK1yhBUiE3yE+vc2+m3QQ0=; b=QSpi1Fd1tYkRvNgAZouiz8iEHj7bEZ/VCYoL7znZd6b/phbCgd2kp79KOc800HuIl7dnq+Pdui/YIGiT8+lNLEWVdMQ9I7WTD0azAt0Ol/uhyvWF49QO+KMqTGnklMPz1xcgARdZruNs1zqD1HRP+NFkbfGXDCTc4vHAiOuYgNhyZQ7ae681tcJU6HpOQ5cOKitrbPCityJSIODOHNAw23ahHTiLYHoX3i0EjHQMQvfdcpgfPRFRiBwg7kCu0up+glxosykeXgUZ+flT6J8T6qJhsGoiGZwIu6kt1oPqBKemqQT3GYIwbkyrGcshuhClmK2ehE2Uc+axK9Hvo6ToIw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nutanix.com; dmarc=pass action=none header.from=nutanix.com; dkim=pass header.d=nutanix.com; arc=none Received: from MWHPR02MB2656.namprd02.prod.outlook.com (10.168.206.142) by MWHPR02MB2239.namprd02.prod.outlook.com (10.168.244.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.17; Fri, 29 Nov 2019 17:46:48 +0000 Received: from MWHPR02MB2656.namprd02.prod.outlook.com ([fe80::f801:763d:e7fc:6bf]) by MWHPR02MB2656.namprd02.prod.outlook.com ([fe80::f801:763d:e7fc:6bf%7]) with mapi id 15.20.2474.023; Fri, 29 Nov 2019 17:46:47 +0000 From: Felipe Franciosi To: Marc-Andre Lureau , Philippe Mathieu-Daude , Stefan Hajnoczi , Eduardo Habkost , Markus Armbruster , Alexey Kardashevskiy Subject: [PATCH v3 0/4] Improve default object property_add uint helpers Thread-Topic: [PATCH v3 0/4] Improve default object property_add uint helpers Thread-Index: AQHVptz4rBlibBI7cEa+Iv11MbbnrA== Date: Fri, 29 Nov 2019 17:46:47 +0000 Message-ID: <20191129174630.6922-1-felipe@nutanix.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: LO2P265CA0394.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:f::22) To MWHPR02MB2656.namprd02.prod.outlook.com (2603:10b6:300:45::14) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-originating-ip: [62.254.189.133] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: edb4553f-eed7-4397-6171-08d774f41b3b x-ms-traffictypediagnostic: MWHPR02MB2239: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-proofpoint-crosstenant: true x-ms-oob-tlc-oobclassifiers: OLM:9508; x-forefront-prvs: 0236114672 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(396003)(39860400002)(136003)(376002)(346002)(366004)(54534003)(199004)(189003)(386003)(66946007)(66476007)(305945005)(64756008)(6506007)(66556008)(6486002)(5660300002)(14444005)(6512007)(25786009)(7736002)(66446008)(1076003)(36756003)(52116002)(66066001)(256004)(6436002)(71190400001)(186003)(26005)(86362001)(8936002)(110136005)(4326008)(54906003)(14454004)(102836004)(71200400001)(99286004)(81166006)(50226002)(6116002)(316002)(2906002)(478600001)(2616005)(81156014)(3846002)(8676002)(64030200001); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR02MB2239; H:MWHPR02MB2656.namprd02.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: nutanix.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: QmFnnj5aIR07E3YQP1wDpmDFACgjOD8Nn9FImWvzAIUBUKojAvttxUHHP0zTanxSnfMZA91KDbXR3EqbfRDidfLOsiGhpHbpxaehy9J5/z0ACS88ZWl0eYSaT7ANe6wJdPZjPxTrC+rcKo2A05/tT6bBjYF+UyTFMxtQrc3nKV31cazp6rIbnBtN0769REyRO2Jcxxka1n265U7ioNRGNqfLLd7BDE9egui7D9jXoTRqz6/AjZJxQ8lQ1C978PXOyesx+/CzcdINvzj1sLIwroGASCcBpngnm5KLf5Fz+9Mqd8ZXapfpAKBl4RGHkQ0l+IpDMJp+4/ci5USplhQlUdbSmZMYTr9qdv3qwUBUBT68ZxwaiinSVud19701F/xmMK9g7DyAP+SnPxyYfxrf8v6eUMhQVPyo/QPFaCuSSdflmP56h6ZQe5SCX5VSFKKs MIME-Version: 1.0 X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: edb4553f-eed7-4397-6171-08d774f41b3b X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Nov 2019 17:46:47.7251 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: bb047546-786f-4de1-bd75-24e5b6f79043 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: gjCLiitNBAVT+vluJ1wudQV8qMaOMPope4pZZuYF8zZsVimghYx9VBlWHlq8Fu/KVp6zmJoNcGGys3EiT4jKvFi09a1qb6qX0AtVPCO6DMw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR02MB2239 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-29_05:2019-11-29,2019-11-29 signatures=0 X-Proofpoint-Spam-Reason: safe X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.151.68 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: "qemu-devel@nongnu.org" , Felipe Franciosi Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" This improves the family of object_property_add_uintXX_ptr helpers by enabling a default getter/setter only when desired. To prevent an API behavioural change (from clients that already used these helpers and did not want a setter), we add a OBJ_PROP_FLAG_READ flag that allow clients to only have a getter. Patch 1 enhances the API and modify current users. While modifying the clients of the API, a couple of improvement opportunities were observed in ich9. These were added in separate patches (2 and 3). Patch 3 cleans up a lot of existing code by moving various objects to the enhanced API. Previously, those objects had their own getters/setters that only updated the values without further checks. Some of them actually lacked a check for setting overflows, which could have resulted in undesired values being set. The new default setters include a check for that, not updating the values in case of errors (and propagating them). If they did not provide an error pointer, then that behaviour was maintained. Felipe Franciosi (4): qom/object: enable setter for uint types ich9: fix getter type for sci_int property ich9: Simplify ich9_lpc_initfn qom/object: Use common get/set uint helpers hw/acpi/ich9.c | 99 ++------------------ hw/acpi/pcihp.c | 7 +- hw/acpi/piix4.c | 12 +-- hw/isa/lpc_ich9.c | 27 ++---- hw/misc/edu.c | 13 +-- hw/pci-host/q35.c | 14 +-- hw/ppc/spapr.c | 18 +--- hw/ppc/spapr_drc.c | 3 +- hw/vfio/pci-quirks.c | 20 ++-- include/qom/object.h | 44 +++++++-- memory.c | 15 +-- qom/object.c | 216 ++++++++++++++++++++++++++++++++++++++----- target/arm/cpu.c | 22 +---- target/i386/sev.c | 106 ++------------------- ui/console.c | 4 +- 15 files changed, 288 insertions(+), 332 deletions(-) Reviewed-by: Stefan Hajnoczi