From patchwork Thu Dec 19 18:02:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Felipe Franciosi X-Patchwork-Id: 11304193 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 8F6E66C1 for ; Thu, 19 Dec 2019 18:06: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 64159227BF for ; Thu, 19 Dec 2019 18:06:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nutanix.com header.i=@nutanix.com header.b="z57kcDvK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 64159227BF 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]:46026 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ii0C4-0000dl-HA for patchwork-qemu-devel@patchwork.kernel.org; Thu, 19 Dec 2019 13:06:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39035) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ii08E-00042N-S4 for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:02:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ii08C-0002NM-Ij for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:02:37 -0500 Received: from mx0a-002c1b01.pphosted.com ([148.163.151.68]:18224) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ii08C-0002IM-74 for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:02:36 -0500 Received: from pps.filterd (m0127838.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xBJHx8QK020335; Thu, 19 Dec 2019 10:02:33 -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=uJ0QaDZGqgCnR/RxrQdjYjk2mH9M4h92LqEhItEj/f0=; b=z57kcDvKD0OlyEJRXaKCFDufyPy/4LIJ3OJPtylGvunz10moeWfsG9QTuuJQTbZmAPt+ yvK2Ldi58WFWxiKSzbfStw0hft7OKW6Kdt1pD56jRZJ/VKt+drsQADrHpKtzmI+96BT/ oH48O5rkyIc75d70fk4G0Xqdika0pTVkMUkqF7K37/0TsUIqLSW5oZkaolmsFgZZ9Iny LlkxyiYh1vhtaDMpQPqyi9fktOo6lrrKB0LHnd3m6FUeKrqmJ/pHiwQZQ2mt/ierzGS7 7KR+nGn8EX2TQuBc+aPDPqnDL1UQrHND+74KWNL+QTrpOBtKX/NNKgOqj+9SAjRV4Vku 7w== Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2177.outbound.protection.outlook.com [104.47.57.177]) by mx0a-002c1b01.pphosted.com with ESMTP id 2ww0643bw4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 19 Dec 2019 10:02:32 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bHT5pNkftctn27Y+1Snia4dCLO0azctToLBurQDOPYJtJES/IU2oAhAY4Pi5fCiNZYFjSP4o/I0TaJG5CcSKVMuWt37QZ8I5a+Q6z2t5WFhWVxKtQ1+hxDmWt3qt3YHoBVrBxDLtLhufrewRI4siRvuiK2ITGUCyU5iMoJm5UWO53tsu/TvoZQguQ7ajRZtDQOnWfltDWE4TA5efGFtAI+22j5n5jqZlk0s+nE47rR60WBZ/jt6j1pj69YvsEOAODCyDhsl50dSWOl7SxyHkc+HnUUMrUTaOGXNKrmr3geJJIU3fbmjSTjPyymymbiXAcCA1Vq20LJnEcLp1hj3dYA== 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=uJ0QaDZGqgCnR/RxrQdjYjk2mH9M4h92LqEhItEj/f0=; b=INdrBOuXZXBBndnQsoy834b7pDn2M6I2GA2nVTQb07Ux2qXsLzC7Xpg3upR9FRSQmuhZDSJWotTOxsTueLypNG2rVxV6SE62yE7aWnAJ2ZuU1YDPGSFDzAKzXYa0rAgKRq7pDwanAhbFl3leBwZCMYXHPfCwHsdLFsRbA+GK1WCzaUmTiEV1Lm4B8Ve/Z2dnF/417z3k6zZ9gqhiyByR6ilRklxj0TmZtpVac2xMukXOwdu5MsRVa07M1Pn+ChvQLmtgUHO1dWfXpPfkgz6DR5Z1QUhMisxVrSzrgsJD68Ovl9wqcrsURHK4XpyxVNJxOy24i61pw3H/NZiuke2zNA== 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 MWHPR02MB3166.namprd02.prod.outlook.com (10.164.204.39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2559.14; Thu, 19 Dec 2019 18:02:28 +0000 Received: from MWHPR02MB2656.namprd02.prod.outlook.com ([fe80::c8f8:4820:a24c:3029]) by MWHPR02MB2656.namprd02.prod.outlook.com ([fe80::c8f8:4820:a24c:3029%10]) with mapi id 15.20.2559.012; Thu, 19 Dec 2019 18:02:28 +0000 Received: from nutanix.com (82.9.225.166) by AM4PR07CA0004.eurprd07.prod.outlook.com (2603:10a6:205:1::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2581.4 via Frontend Transport; Thu, 19 Dec 2019 18:02:26 +0000 From: Felipe Franciosi To: Marc-Andre Lureau , Phillipe Mathieu-Daude , Stefan Hajnoczi , Eduardo Habkost , Markus Armbruster , Alexey Kardashevskiy Subject: [PATCH v4 0/4] Improve default object property_add uint helpers Thread-Topic: [PATCH v4 0/4] Improve default object property_add uint helpers Thread-Index: AQHVtpZ6lIuRGF0HJ0OIoqz7XKz+ug== Date: Thu, 19 Dec 2019 18:02:28 +0000 Message-ID: <20191219180205.25191-1-felipe@nutanix.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM4PR07CA0004.eurprd07.prod.outlook.com (2603:10a6:205:1::17) 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: [82.9.225.166] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 818d5a0b-a8c7-4b6e-453c-08d784ad9c5d x-ms-traffictypediagnostic: MWHPR02MB3166: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-proofpoint-crosstenant: true x-ms-oob-tlc-oobclassifiers: OLM:9508; x-forefront-prvs: 0256C18696 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(376002)(136003)(366004)(396003)(39860400002)(54534003)(199004)(189003)(956004)(2616005)(86362001)(5660300002)(52116002)(26005)(64756008)(66446008)(7696005)(36756003)(4326008)(107886003)(8886007)(478600001)(55016002)(316002)(186003)(16526019)(8936002)(1076003)(66476007)(66946007)(81156014)(66556008)(54906003)(81166006)(8676002)(71200400001)(2906002)(110136005)(64030200001); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR02MB3166; 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: 8ZPmNnEQNawpAJtFeRRresHsHom1x51cTsh9g23LvKdReTJogCBY/quFDhdOfke5EJ03fXX3PzqfETkug23fcQ/yqinrgU+5zTAsUTybpWh6PIMxuWBbQedj+/wDwOG//0srkZVqEd8WHSZKMSUG5bykLKXmWTT/4uOG4kvEoFJan/ApThpoMxXULCfx1Ek282ZLGjyEi2X6v4UfVYp02hqgxJECxId3Vi1uzFBQdcqaSY+QC990NAgRy1YOyThdHDxn/i6mQG8dXbYpmNeWkQHiWWofmxNvOad87RZB/w2n0B9tD8M++1m5JyPQCxZMAUzWaPpaxzyP1hLYdPe7LJ5Gq54/QGExwYaM82/GdzIfzuBlROqpRF7sxKahZ56oFiDJqWZAA+WDQX/ZBijYY2BktrM46tH0hAGpiQjyEbiieqLXX7CXZ8VsNl/CZovopC065LR9GfzNnM49a7FhZAEQGESGXcFZI5T3BhsNCa4VE12IN4OZ3aGqqCuIbDPkpi3TsTSIjCyeGxB2TiVq7g== MIME-Version: 1.0 X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 818d5a0b-a8c7-4b6e-453c-08d784ad9c5d X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Dec 2019 18:02:28.7519 (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: 4rq44hgpYST+lkrt/Tz8bhX7nbAn+sKELEpIx0r9qZ7ALbRjVUVIYwfhSxoo5+9G7zw+U34CBJPZTgjW5LV4/u23uTsBnaVik4Y+vyo55nA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR02MB3166 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-12-19_06:2019-12-17,2019-12-19 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 +- 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 +- 14 files changed, 282 insertions(+), 318 deletions(-) Reviewed-by: Stefan Hajnoczi Reviewed-by: Marc-André Lureau