From nobody Tue Nov 11 01:39:40 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1560856088; cv=none; d=zoho.com; s=zohoarc; b=nTrGhq5hHxw4sbfh02yp7puPS1b4v5lakSxgg7g+tVOsjFzNGcM26eOkiM9g0m/I8SbompL1f6KLRRgSBp+1iaqpRTf0zWucmoz9TmAnn7MjqDTFvA1zHZfs3x4mBB/M6VJyCQ/GB7fvyLyMFe0sbHeO7XfnHQjW5MbdOZFwPbY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560856088; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=gH9Pg8uABzh/niC4rK4D79DO68RV94nuNvXGlP4cuS0=; b=j2IZnAf+OTmfVP/tXehBGOUvN9gPM4MPcwEhsNyNgaOcBMigm4/PUjoySPgscp8HeX2QrkXf9xUXyp9gOXow4yJY232HG4UqF0V1GhE6ziGxbh3KQXKha91UsHU+yeDGBk1GEUJUPWuS+K2PwRvYDLK++To3sL3his5wi/UNBhI= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1560856087956986.9633752759222; Tue, 18 Jun 2019 04:08:07 -0700 (PDT) Received: from localhost ([::1]:55596 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdBy9-0004VD-03 for importer@patchew.org; Tue, 18 Jun 2019 07:08:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40732) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdBxH-0003yO-KS for qemu-devel@nongnu.org; Tue, 18 Jun 2019 07:07:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hdBxG-0007ba-FG for qemu-devel@nongnu.org; Tue, 18 Jun 2019 07:07:11 -0400 Received: from mail-db3eur04on0728.outbound.protection.outlook.com ([2a01:111:f400:fe0c::728]:20053 helo=EUR04-DB3-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hdBxF-0007Xo-Ic for qemu-devel@nongnu.org; Tue, 18 Jun 2019 07:07:10 -0400 Received: from DB8PR08MB3977.eurprd08.prod.outlook.com (20.179.11.95) by DB8PR08MB5146.eurprd08.prod.outlook.com (10.255.17.220) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1987.11; Tue, 18 Jun 2019 11:07:07 +0000 Received: from DB8PR08MB3977.eurprd08.prod.outlook.com ([fe80::3530:3b13:be7f:2944]) by DB8PR08MB3977.eurprd08.prod.outlook.com ([fe80::3530:3b13:be7f:2944%4]) with mapi id 15.20.1987.014; Tue, 18 Jun 2019 11:07:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gH9Pg8uABzh/niC4rK4D79DO68RV94nuNvXGlP4cuS0=; b=SHp7Jr740nb2EwBQgSSzyIwrPM57GCEVZP5dMJhasT23cyhSnbnkgU4cX6KSKXtRDkbq0JKN+jTYlJBdRiuZIWWICri0NR37m/zDcAMNWD/LKTpFKThai9bqY69FTKEi53eAtVIOh2s/SzeFofLHN11nfwYtpdlej35xXiwjpV0= From: Roman Kagan To: Eduardo Habkost , "qemu-devel@nongnu.org" , Vadim Rozenfeld Thread-Topic: [PATCH] i386: make 'hv-spinlocks' a regular uint32 property Thread-Index: AQHVJcX3+KQutj1BX0CzGldPDul1lA== Date: Tue, 18 Jun 2019 11:07:06 +0000 Message-ID: <20190618110659.14744-1-rkagan@virtuozzo.com> Accept-Language: en-US, ru-RU Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [185.231.240.5] x-clientproxiedby: HE1PR02CA0109.eurprd02.prod.outlook.com (2603:10a6:7:29::38) To DB8PR08MB3977.eurprd08.prod.outlook.com (2603:10a6:10:ad::31) authentication-results: spf=none (sender IP is ) smtp.mailfrom=rkagan@virtuozzo.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.21.0 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 16f85302-6cc4-4e78-2ea9-08d6f3dd19ba x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:DB8PR08MB5146; x-ms-traffictypediagnostic: DB8PR08MB5146: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2000; x-forefront-prvs: 007271867D x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(396003)(136003)(366004)(376002)(39850400004)(346002)(189003)(199004)(66556008)(6486002)(68736007)(25786009)(6436002)(86362001)(2616005)(305945005)(3846002)(7736002)(54906003)(4326008)(26005)(486006)(52116002)(110136005)(386003)(99286004)(1076003)(2501003)(256004)(102836004)(6506007)(53936002)(66446008)(5660300002)(6512007)(8676002)(81166006)(50226002)(81156014)(66066001)(316002)(14454004)(6116002)(186003)(66946007)(478600001)(71200400001)(73956011)(476003)(36756003)(71190400001)(2906002)(66476007)(8936002)(64756008); DIR:OUT; SFP:1102; SCL:1; SRVR:DB8PR08MB5146; H:DB8PR08MB3977.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; received-spf: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 6jrw6DhLxBDT2jzPKiLlk6+TDAhGuzhg0un5NmwolqTVMfjC6nZqPevzSLZ3vhHGTWvr7SpmTH/cGoWcs1zD7SqoTHf61pOavdVL2x3NNGQYhVH7BxGbc89AcjyCwSFSWYiF6lqshhkHmNYZpPzF6LOGQ1BW0s3SXk7abhdTuN2CzyLugAX4ljncBImnHrhJdpU+IvpnU+eTyK90k8ZRFev7ycQHILW1IX0A7RGXvWbHanUCpbDoDVElkMW4CmIE9L/c73cQoaui6GjmYrfjFR+7jNVbhNYC1ds2RsIBpgMy9wsYzE32eJO1yq5IXJLJAeJe8Mbz6f1Lf1bM5M4ANYHvFe02GQNrjYUecdFt4KOg2nrPff9gRchd3w0ColquW1thl4iKP8DLyUw+6PKd9r4Vl0idcWpvEM1k/T2U0NY= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 16f85302-6cc4-4e78-2ea9-08d6f3dd19ba X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Jun 2019 11:07:06.9235 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: rkagan@virtuozzo.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB5146 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe0c::728 Subject: [Qemu-devel] [PATCH] i386: make 'hv-spinlocks' a regular uint32 property 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 , Vitaly Kuznetsov , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X86CPU.hv-spinlocks is a uint32 property that has a special setter validating the value to be no less than 0xFFF and no bigger than UINT_MAX. The latter check is redundant; as for the former, there appears to be no reason to prohibit the user from setting it to a lower value. So nuke the dedicated getter/setter pair and convert 'hv-spinlocks' to a regular uint32 property. Signed-off-by: Roman Kagan Reviewed-by: Eduardo Habkost --- Based-on: <20190615200505.31348-1-ehabkost@redhat.com> ([PATCH] i386: Fix signedness of hyperv_spinlock_attempts) target/i386/cpu.c | 45 ++------------------------------------------- 1 file changed, 2 insertions(+), 43 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index fbed2eb804..843d45262e 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -3497,46 +3497,6 @@ static void x86_cpu_get_feature_words(Object *obj, V= isitor *v, visit_type_X86CPUFeatureWordInfoList(v, "feature-words", &list, errp); } =20 -static void x86_get_hv_spinlocks(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - X86CPU *cpu =3D X86_CPU(obj); - int64_t value =3D cpu->hyperv_spinlock_attempts; - - visit_type_int(v, name, &value, errp); -} - -static void x86_set_hv_spinlocks(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - const int64_t min =3D 0xFFF; - const int64_t max =3D UINT_MAX; - X86CPU *cpu =3D X86_CPU(obj); - Error *err =3D NULL; - int64_t value; - - visit_type_int(v, name, &value, &err); - if (err) { - error_propagate(errp, err); - return; - } - - if (value < min || value > max) { - error_setg(errp, "Property %s.%s doesn't take value %" PRId64 - " (minimum: %" PRId64 ", maximum: %" PRId64 ")", - object_get_typename(obj), name ? name : "null", - value, min, max); - return; - } - cpu->hyperv_spinlock_attempts =3D value; -} - -static const PropertyInfo qdev_prop_spinlocks =3D { - .name =3D "int", - .get =3D x86_get_hv_spinlocks, - .set =3D x86_set_hv_spinlocks, -}; - /* Convert all '_' in a feature string option name to '-', to make feature * name conform to QOM property naming rule, which uses '-' instead of '_'. */ @@ -5658,8 +5618,6 @@ static void x86_cpu_initfn(Object *obj) object_property_add(obj, "crash-information", "GuestPanicInformation", x86_cpu_get_crash_info_qom, NULL, NULL, NULL, NULL= ); =20 - cpu->hyperv_spinlock_attempts =3D HYPERV_SPINLOCK_NEVER_RETRY; - for (w =3D 0; w < FEATURE_WORDS; w++) { int bitnr; =20 @@ -5853,7 +5811,8 @@ static Property x86_cpu_properties[] =3D { #endif DEFINE_PROP_INT32("node-id", X86CPU, node_id, CPU_UNSET_NUMA_NODE_ID), DEFINE_PROP_BOOL("pmu", X86CPU, enable_pmu, false), - { .name =3D "hv-spinlocks", .info =3D &qdev_prop_spinlocks }, + DEFINE_PROP_UINT32("hv-spinlocks", X86CPU, hyperv_spinlock_attempts, + HYPERV_SPINLOCK_NEVER_RETRY), DEFINE_PROP_BOOL("hv-relaxed", X86CPU, hyperv_relaxed_timing, false), DEFINE_PROP_BOOL("hv-vapic", X86CPU, hyperv_vapic, false), DEFINE_PROP_BOOL("hv-time", X86CPU, hyperv_time, false), --=20 2.21.0