From patchwork Mon Nov 25 15:36:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Franciosi X-Patchwork-Id: 11260551 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 69FD61390 for ; Mon, 25 Nov 2019 15:38:05 +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 3FBE9207FD for ; Mon, 25 Nov 2019 15:38:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nutanix.com header.i=@nutanix.com header.b="Ye/x4atV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3FBE9207FD 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]:45436 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZGRA-00063x-5W for patchwork-qemu-devel@patchwork.kernel.org; Mon, 25 Nov 2019 10:38:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33285) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZGPp-0004PO-LY for qemu-devel@nongnu.org; Mon, 25 Nov 2019 10:36:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iZGPn-0007ot-SJ for qemu-devel@nongnu.org; Mon, 25 Nov 2019 10:36:40 -0500 Received: from mx0b-002c1b01.pphosted.com ([148.163.155.12]:11474) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iZGPn-0007ma-Le for qemu-devel@nongnu.org; Mon, 25 Nov 2019 10:36:39 -0500 Received: from pps.filterd (m0127842.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xAPFVZQm009323; Mon, 25 Nov 2019 07:36:36 -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=zCyD9kV+lvGUqlwQnxGo6W7BjOD17bvbwHPFHFIU9fs=; b=Ye/x4atVTA/cxBv53Gif6xX2Nf7TaMmA/jhFSicrr6RuUAuBHCB62govky0m4uLo6Z+6 Xv6AekXjyHCA7AtgL+JH0G9CCXvxzYAFkp2KExq1hXRAfzUl6bgThwKV+ZX4EhnSBENl o5AjIP3dnZ/Ai7e0rGrV/OnWJuqPL26GxlCBK6ZchXdA0NP4Nd79+DAlxjwhfM/Yf1z8 MCJEJ0hYIfYCWQpvrcKDqGIyr9RVn/rK4qBEHYEjuOesnFaVPwDB04JAvUiF8ex8Wmv/ aT9lv0CWCqOFMUL7GjRXwTSdq/EdVRA4HPE+WQmbC938Lc3eWhwLfL5doQ2hj+rLzMUP bA== Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1nam02lp2055.outbound.protection.outlook.com [104.47.36.55]) by mx0b-002c1b01.pphosted.com with ESMTP id 2wf4yn3unm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 25 Nov 2019 07:36:36 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oIh6/pAN7e/MN96miOyx/GLyIiig6YG1On6Sv+4uATZLJERXAkP55FiVT8UMaWN+sU1cANdacXMdgyGTrKlmrCsmpPid+dpi1ZoEYGheVZzCIJrMp0QxRasWVIpwpGvhz1L3rZTfwwLnv0ckHfMXI183u7HSExHrYgqeGjPa8Av0gz+5i3gdKfKHQ7xVZUZmwJg0ozS5oqwc0BOVrmCkemH/CEMzUNW+GuYqnnVPaWvh/iobUl0y3NbOQMTlEsAY4Fv1q0m7KozJRXN0J6/s/LknnQ4J5vMrgTtdwC3LAbUXiuI2wtNu/gWiNVLyZ0fYN6MqIiXLP9r1fpfn2Mx6ZQ== 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=zCyD9kV+lvGUqlwQnxGo6W7BjOD17bvbwHPFHFIU9fs=; b=KCoxmm1OwG5XIT/b4MjxZ77Phg5Ls2+Av4DdLgahqtZUClCst6hzXHNJG7lFaL/Pb/PhfuEpXTbinhtsYzuFavKKH6p6p50MjvcynknpY6cr24UoPtusVHbTsIcGrSebgQoDQYZ4ANhX7866j2v4oEHZN66FwcP80BzkIQYFCtzoeENhTJ7joqzfpW9cIEQ3+qEZh9XXjxgtmdorgWtBRyCwnE0hoTbKZJGJuYEWgPEyqRxmA65VulHbYyCUTkhvUQe4TCKGzZCqxgOicXVyajizqiTAOYbb8Z4Nf4xOvLWrKM1W5/n6b+j1xz2kh90plpk1hN8bVBUh28qvG7PsBA== 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 MWHPR02MB3183.namprd02.prod.outlook.com (10.164.133.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.19; Mon, 25 Nov 2019 15:36:34 +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; Mon, 25 Nov 2019 15:36:34 +0000 From: Felipe Franciosi To: Eduardo Habkost , Markus Armbruster , Stefan Hajnoczi Subject: [PATCH 0/4] Improve default object property_add uint helpers Thread-Topic: [PATCH 0/4] Improve default object property_add uint helpers Thread-Index: AQHVo6YefpPRqMssQki98wdtNKpYLw== Date: Mon, 25 Nov 2019 15:36:34 +0000 Message-ID: <20191125153619.39893-1-felipe@nutanix.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM0PR02CA0087.eurprd02.prod.outlook.com (2603:10a6:208:154::28) 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: 4b68fa64-8574-403d-b723-08d771bd40a3 x-ms-traffictypediagnostic: MWHPR02MB3183: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-proofpoint-crosstenant: true x-ms-oob-tlc-oobclassifiers: OLM:8882; x-forefront-prvs: 0232B30BBC x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(136003)(376002)(396003)(39860400002)(366004)(189003)(199004)(4326008)(6512007)(86362001)(1076003)(3846002)(6116002)(386003)(6506007)(7736002)(305945005)(6436002)(6486002)(478600001)(54906003)(26005)(102836004)(110136005)(2906002)(36756003)(25786009)(14454004)(316002)(99286004)(256004)(107886003)(66066001)(66446008)(64756008)(66556008)(66476007)(2616005)(5660300002)(66946007)(186003)(52116002)(50226002)(81166006)(81156014)(8676002)(71200400001)(8936002)(71190400001)(64030200001); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR02MB3183; H:MWHPR02MB2656.namprd02.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A: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: 9hrMfeqKwqBLZwC8juc0Dc25zdZvx0X1Zl4tCL5ByqJsb4qPCpfH3Yo/CYATAZUfurw+U733f30MmCm5YugvF/GdXoAukkuLp3ueqpxB8md2RUTKf7jHwAKrC/QUxa76iCTEEVcBiLRhwcZrwUv0kpdkQUUOdd7dvLNasrUL6Dn6xIqW4uCxn0XgNKtxnAy3COw5fUH5qOLVoc3Kw9NeChkh//71T7gf8i69fuzKPXTLqmL4jylTagbuhHllDIuqKXLShGo3p4FM8NqR/4+OGDpkUAGMZAKORBQ292WRNHTY3DiYvHdBv/5aaUmE+TlIqTjmjWB6g0dEFLsz2y7jR6c+v/KGDGVcI0vqXkC5D17UTybUQIMs7gB+LvaeDerwaJTNdUI6Gb70E21dmvHdanVbwFAydpIEnn0sFH06mZ/zQEn8kuiwlwtLROIqb6VS MIME-Version: 1.0 X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4b68fa64-8574-403d-b723-08d771bd40a3 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Nov 2019 15:36:34.4732 (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: ryeytVi3l1Ug8x+vj8kNeVds4RQceS+YohFpAvlhZye3CP699N2QueUloIHp7HUS+zNegJHuuzSO4uORV6V32GyWXVgEbgV6uZEk6QwdZws= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR02MB3183 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-25_03:2019-11-21,2019-11-25 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.155.12 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 setter when desired. To prevent an API behavioural change (from clients that already used these helpers and did not want a setter), we add a "readonly" parameter 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). 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 | 97 +++------------------------ hw/acpi/pcihp.c | 6 +- hw/acpi/piix4.c | 12 ++-- hw/isa/lpc_ich9.c | 31 +++------ hw/misc/edu.c | 12 +--- hw/pci-host/q35.c | 14 +--- hw/ppc/spapr.c | 17 +---- hw/ppc/spapr_drc.c | 2 +- hw/vfio/pci-quirks.c | 18 ++--- include/qom/object.h | 28 +++++--- memory.c | 15 +---- qom/object.c | 152 ++++++++++++++++++++++++++++++++++++------- target/arm/cpu.c | 21 +----- target/i386/sev.c | 102 ++--------------------------- ui/console.c | 3 +- 15 files changed, 196 insertions(+), 334 deletions(-)