From patchwork Thu Nov 28 16:48:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Franciosi X-Patchwork-Id: 11266511 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 53D9B13B6 for ; Thu, 28 Nov 2019 18:22:46 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D999821741 for ; Thu, 28 Nov 2019 18:22:45 +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="2ukjRON2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D999821741 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]:51662 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iaOR9-0006eA-Mj for patchwork-qemu-devel@patchwork.kernel.org; Thu, 28 Nov 2019 13:22:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49967) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iaMyA-0002bk-VQ for qemu-devel@nongnu.org; Thu, 28 Nov 2019 11:48:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iaMy8-0002BR-0a for qemu-devel@nongnu.org; Thu, 28 Nov 2019 11:48:41 -0500 Received: from mx0a-002c1b01.pphosted.com ([148.163.151.68]:35042) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iaMxy-00025f-Su for qemu-devel@nongnu.org; Thu, 28 Nov 2019 11:48:33 -0500 Received: from pps.filterd (m0127839.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xASGd55C019889; Thu, 28 Nov 2019 08:48:27 -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=9/y86O0fcib9u/3XfLFuPCy111agbrDNp4oh2CTm8h8=; b=2ukjRON2Lwj0JCvW5SJBzkxbUdtK3uY8YNzDc79lzzHiJ3oUqIQ8jyiLE9UFA53codDe OHRdrU+LkOPpBuLRVMh9djdFwwe2S/Fsmwy5cMZcSstuV4tXkj2ilKwC7Hyx77QjctKT HPrnZzIbZmkTfcjdAY9XOotG4xZe9kVZ8HkIQQ8UYj/6qs3RZOZm8h8ivW8ZCuyfuIZr HdNez679vC/qW30qEmks4BdagjS8xdX6YkRsijcoG0n0bR5smuCAIAh7GqRC4t0ts/2N 4Dy/eKFd2IPMxxnUmc8xgL7Z0MWaqA0/wqErhUnuv0H2zFxyYHo677s6X1mYop87G2gN bw== Received: from nam03-dm3-obe.outbound.protection.outlook.com (mail-dm3nam03lp2059.outbound.protection.outlook.com [104.47.41.59]) by mx0a-002c1b01.pphosted.com with ESMTP id 2whnfju44h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 28 Nov 2019 08:48:27 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JArq1is3NeGsT1OUQvsWZ53yBkQ3bToWG65NXxZcCJjqtC44fnUdMe4yDdITgQXh92Batosall0CGqgJdM9y274ct9rcOwg4DajAJhPrUIdq4bw2sf7bYpOXn7/5WiqVNhvv6fw4uhmOkYnpWM//Trw5y8+Qif+Oqfjfa/0DVqOMPyFY/cDcRWbfdVDVk6LDID/AI0KoqAvrwm3K/DTfVtLBCCEq6WDNF2iXxvePmxuPXpDnL3zwUAq0h7J/QgPsQP8MlcI32ho55eFIRQTo98/J5rDiHHQNV8300FkblgAZAkCCus4UIi8qJybqRQOyQuvFhxfkf4s6QU1OXhsCYA== 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=9/y86O0fcib9u/3XfLFuPCy111agbrDNp4oh2CTm8h8=; b=HzllTd7jIDRavjrZtHKz35hALoj5oV/mqIkUUxx2EyDZLXgsvRPnjMdN1TB/7i2QQoZwDjDcB1RKVr67R7zNxVY48x5RfyYbB5cYImR3bHuN3tQWmYPqsQkZr/UC3E7x/XeD3rfImafOvw1NPf5HVq7gUVfh7OpKouwfk2ReHhb2nljlENUqy395hRHmcLhHb2ge4JoVzHG4g5XylOW/rfjaNAN6dSz2qftkqjOe05NSLzKPHfLpIW/8f1IvJY6A7JoxbJ3c+xiE180vkHPI0TdXn5GDbnyXkhGYLFz3samxNWL3Cm1RMdXRbPqFMkD4Hy+x22HeQDZ2MZLhxgmITQ== 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 MWHPR02MB2398.namprd02.prod.outlook.com (10.168.243.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2495.20; Thu, 28 Nov 2019 16:48:25 +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; Thu, 28 Nov 2019 16:48:25 +0000 From: Felipe Franciosi To: Marc-Andre Lureau , Philippe Mathieu-Daude , Stefan Hajnoczi , Eduardo Habkost , Markus Armbruster , Alexey Kardashevskiy Subject: [PATCH v2 0/4] Improve default object property_add uint helpers Thread-Topic: [PATCH v2 0/4] Improve default object property_add uint helpers Thread-Index: AQHVpgumwd/y95y1Kk69/TuE/fVBnA== Date: Thu, 28 Nov 2019 16:48:25 +0000 Message-ID: <20191128164810.54279-1-felipe@nutanix.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM3PR05CA0154.eurprd05.prod.outlook.com (2603:10a6:207:3::32) 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: fb4b719e-5890-40f8-dd4d-08d77422c95b x-ms-traffictypediagnostic: MWHPR02MB2398: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-proofpoint-crosstenant: true x-ms-oob-tlc-oobclassifiers: OLM:9508; x-forefront-prvs: 0235CBE7D0 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(396003)(346002)(366004)(376002)(39860400002)(136003)(54534003)(189003)(199004)(102836004)(110136005)(256004)(14444005)(36756003)(14454004)(2616005)(6436002)(66066001)(4326008)(386003)(6506007)(186003)(26005)(52116002)(66556008)(64756008)(1076003)(71190400001)(66946007)(5660300002)(71200400001)(6486002)(66446008)(66476007)(86362001)(6512007)(478600001)(54906003)(8936002)(50226002)(316002)(81166006)(2906002)(8676002)(7736002)(305945005)(81156014)(99286004)(25786009)(6116002)(3846002)(64030200001); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR02MB2398; 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: /aJmYHOK7SlYd4n7P0+EGavDAcVJ6WY/e/BJrPUqDjmzRtXnH1xqfM2B3Zm9qjyviYgYqpta4zYOFIzAJUUBOp3IygX7wVPLPAekzCochTYutO09qWLMO0zBRm6Sc70WGarV7c3nFZxQpJoMO3ef5OCYD6HPTgSFJrDE4MUoSUq/pIMody5oMZvKVN/g1GGk2rgLyubGKJ3KhJNyqs16VEY2hQWxU5pRI0Z8RJPO63IaQDOqe7tXqb3zxwjqaaGk30j2qHOCefoOa6iiEY2P4z0NWdLKErLfkXMnFC1kAcFI3E3zpzVswRwOFBUCHGg/2BXiVGJZVy2YxEW3fYSwI2Jf9C30uZXSz/4aLxjAcuTuAvwQGprClbgiVE23U33fLr2q/cOmPgjHi17bZmUpiLpVL8AGezFHChpLUtG/l3CLBvPDzOMfSDBu779B9tR6 MIME-Version: 1.0 X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: fb4b719e-5890-40f8-dd4d-08d77422c95b X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Nov 2019 16:48:25.3744 (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: wluDqy6a4toX3BK+XR4cH1YoUmiCQ5KR+2Xy/ALx0w4VKpZC1WlANcRFOJqn0YtcBtzb9vb1k5nqioo5Xi1WWdPLgzKAkhIkvznXkYZe1Yw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR02MB2398 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-28_05:2019-11-28,2019-11-28 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_RD 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 | 103 +++------------------ hw/acpi/pcihp.c | 7 +- hw/acpi/piix4.c | 12 +-- hw/isa/lpc_ich9.c | 28 ++---- hw/misc/edu.c | 14 +-- hw/pci-host/q35.c | 14 +-- hw/ppc/spapr.c | 19 +--- hw/ppc/spapr_drc.c | 2 +- hw/vfio/pci-quirks.c | 20 ++-- include/qom/object.h | 42 +++++++-- memory.c | 15 +-- qom/object.c | 216 ++++++++++++++++++++++++++++++++++++++----- target/arm/cpu.c | 23 +---- target/i386/sev.c | 106 ++------------------- ui/console.c | 4 +- 15 files changed, 293 insertions(+), 332 deletions(-)