From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793171647; b=pFfwt1JfQTLIAZBJqsZ+W9x43coglw7kIgoTpD2GU335cBHXTxqWoIh75QqU47xphmq+ pPND932KKGFsM/+uF6hyLJK+WB34ezEyaKnLfotoUPkg/ggUlJWJws3jChJvGY/J/4qWO ZwQ7/hU/bxSEI5/5Gdg0txVQMR3gYqA9Czdat6orWaz2GRj3nPjuUgrgSlBypCPwYxHK4 9xZvoGVzbpNMJ4BCwNU6VTrA+jEo+itr9EwjBCgEKR5NneoThVGxxW+HXw5NASyxzYGhS H6ycmMtEV1Hx1D62a1XwtLJBny3c/6D/zPynNJmI/MU5GIW07MfZDpgZuMEAw1XnGEg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793171647; h=DMARC-Filter:DKIM-Signature:Received:X-MC-Unique: X-Mimecast-MFC-AGG-ID:Received:Received:Received:From:To:Cc:Subject: In-Reply-To:References:Date:Message-ID:User-Agent:MIME-Version: Content-Type:Content-Transfer-Encoding:X-Scanned-By; bh=QxmQ5AxN89rC1HiyefFy0FHMMxtlG6Y/Map2WM9XKmw=; b=SAYlWBEAKdNLWJnqUEUMTowK6/UMGMMjnH5Cf3HC56nzyRLK74t4okqyIsdG5XGXCeLc arKTLIAXvlX8NtegM82Suj4aJ8gC/cJyjnbwY2G5q6EKAyWZQ60JcriQMy1uz8LKDFmmM 8cOOP259BP2OVR6xnbTbVS6AferKAYj06UvpQw12cTIofsWse2agW2E4PX9ASNyLWx+Ug 5u7zE/DO6DFc0nZXOPNb6Iye7PrenXtHyt0hDLupkpKLQNFEBMCVCzVx1fkWjv1vcQCUn KFAvrBTzClUUI4zay6sULTSx0H2Y182/LDye+/XzQYfY72GFIyo35gUXiwB4rZi/9xw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Kj8rqiQg; arc=none smtp.remote-ip=170.10.133.124 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F203606A31D for ; Wed, 28 Oct 2026 07:14:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 5F203606A31D Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Kj8rqiQg DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1793171646; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QxmQ5AxN89rC1HiyefFy0FHMMxtlG6Y/Map2WM9XKmw=; b=Kj8rqiQgXInB5MESDsA+2KTrGy89kosKe4U37flKN5NA8VT6scQcInSQraPlpZrNtBScJM WBhzJLFoKMEB3tNvFP9kSI46ziasagnqiD/aQGy3hy+3fPKUyjDXNt7nVDP2QrgeS/Qmxk FPNUTTmtRysuJsvmHoKDXgvlH+k7RhI= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-544-aPtTQLUAOnmRkcQac9q43w-1; Wed, 28 Oct 2026 03:14:01 -0400 X-MC-Unique: aPtTQLUAOnmRkcQac9q43w-1 X-Mimecast-MFC-AGG-ID: aPtTQLUAOnmRkcQac9q43w_1793171635 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9EEAC1955EA3; Wed, 28 Oct 2026 07:13:51 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.44.22.2]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 11B5A1800257; Wed, 28 Oct 2026 07:13:47 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 8C76D21E6A04; Wed, 28 Oct 2026 08:13:44 +0100 (CET) From: Markus Armbruster To: Daniel P. =?utf-8?Q?Berrang=C3=A9?= Cc: =?utf-8?Q?Marc-Andr=C3=A9?= Lureau , qemu-devel@nongnu.org, Michael Roth , John Snow , Peter Maydell , Mauro Carvalho Chehab , Pierrick Bouvier , Paolo Bonzini , Kostiantyn Kostiuk , Eric Blake , David Hildenbrand , Igor Mammedov , "Edgar E. Iglesias" , Jason Wang , Marcelo Tosatti , kvm@vger.kernel.org, Alberto Garcia , Kevin Wolf , Hanna Reitz , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Zhao Liu , Jonathan Cameron , Junjie Cao , Anisa Su , Elena Ufimtseva , Jagannathan Raman , John Levon , Thanos Makatos , =?utf-8?Q?C=C3=A9dric?= Le Goater , Cornelia Huck , Eric Farman , Matthew Rosato , Richard Henderson , Ilya Leoshkevich , qemu-block@nongnu.org, linux-cxl@vger.kernel.org, qemu-s390x@nongnu.org, "Michael S. Tsirkin" , Sergio Lopez , qemu-arm@nongnu.org, Palmer Dabbelt , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Chao Liu , qemu-riscv@nongnu.org, Song Gao <17746591750@163.com>, Bibo Mao , Xianglai Li , Jiaxun Yang , Pedro Barbuda , Mohamed Mediouni , Nicholas Piggin , Harsh Prateek Bora , Amit Machhiwal , qemu-ppc@nongnu.org, Zhang Chen , Li Zhijian , Alistair Francis , Alexander Graf , "Gonglei (Arei)" , zhenwei pi , Ani Sinha , Luc Michel , =?utf-8?Q?C=C3=A9dric?= Le Goater , Jamin Lin , Kane Chen , Samuel Tardieu , "Denis V. Lunev" , FangSheng Huang , Tyrone Ting , Hao Wu , Keith Busch , Klaus Jensen , Jesper Devantier , Aditya Gupta , Glenn Miles , Conor Dooley , Sebastian Huber , Halil Pasic , Christian Borntraeger , Jason Herne , Titus Rwantare , Stefano Stabellini , Anthony PERARD , Peter Xu , Chinmay Rath , Hendrik Brueckner , xen-devel@lists.xenproject.org, Roman Bolshakov , Phil Dennis-Jordan , Fam Zheng , Farhan Ali , Alex Williamson , Tao Tang , Stefan Berger , Fabiano Rosas , Mark Cave-Ayland , Artyom Tarasenko , Yoshinori Sato , Jiri Pirko , Eric Auger , Laurent Vivier Subject: Re: [PATCH v7 54/65] qdev: adjust PciDevfn declared type In-Reply-To: ("Daniel P. =?utf-8?Q?Berrang?= =?utf-8?Q?=C3=A9=22's?= message of "Tue, 27 Oct 2026 15:08:58 +0000") References: <20261020-qom-qapi-v7-0-431a86b02b58@redhat.com> <20261020-qom-qapi-v7-54-431a86b02b58@redhat.com> <87zevz5h4k.fsf@pond.sub.org> Date: Wed, 28 Oct 2026 08:13:44 +0100 Message-ID: <87o6ce47rr.fsf@pond.sub.org> User-Agent: Gnus/5.13 (Gnus v5.13) X-Mailing-List: kvm@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Daniel P. Berrang=C3=A9 writes: > On Tue, Oct 27, 2026 at 03:54:03PM +0100, Markus Armbruster wrote: >> Marc-Andr=C3=A9 Lureau writes: >>=20 >> > Hi >> > >> > On Fri, Oct 23, 2026 at 2:04=E2=80=AFPM Daniel P. Berrang=C3=A9 wrote: >> >> >> >> On Tue, Oct 20, 2026 at 02:46:11PM +0400, Marc-Andr=C3=A9 Lureau wrot= e: >> >> > PciDevfn is a bit special, since it accepts integer and string as >> >> > setter, but only output integer as getter. > > snip > >> > But I agree we >> > could do better. >> > >> > There are multiple options. We could keep declaring the property as >> > str instead. In this case, the getter should probably return a string >> > for consistency and correctness. This might surprise some existing >> > users though. >>=20 >> I.e. ditch numeric suppport for numeric addresses, right? >>=20 >> Incompatible change. Do we care? >>=20 >> If we don't, we should be honest about it and mark qom-get unstable. >>=20 >> > We could introduce new properties like `devfn-str` and `devfn-int` >> > that alias the same value. >>=20 >> Compatibility break. If breaking compatibility is okay, I'd rather use >> the opportunity to get rid of cleverness, and go with your first option. >>=20 >> > We could also introduce a new structured QAPI type. >>=20 >> What kind of type do you have in mind? > > IMHO the root cause design flaw here was to overload 'addr' as a > way to set both the slot number and function number, as using > one property for two pieces of data is a well known anti-pattern > we caution against. > > IOW, we should have had 'slot' and 'function' as separate properties > from the start. Fair. Our modeling of PCI is old and weird. What we call "pci-device" isn't a device, it's a function, where function 0 sort of stands in for the device. Its "addr" isn't a PCI address, it's the address of the function on its PCI bus, i.e. the tail of a PCI address. > From a CLI POV, we could easily change 'addr' to mean only the slot > number, since it is always parsed in string format without the > magic (slot << 4) | function encoding. Then add a 'function' prop In CLI, HMP and QMP string (not integer), value "5" is shorthand for "5.0", and means device 5, function 0. We could deprecate the .FN part in favor of a new property "function". Once we drop support for .FN from "addr", its name becomes even more misleading than it always was. > The challenge is the impact on QMP with strict typing, as ideally > int format would soley represent the slot number, but today the > int format is encoded (slot << 4) | function. So anyone relying > on int format in QMP would silently have a semantic change if we > altered what 'addr' means.=20 That's a no-go. > Deprecating 'addr' entirely and adding brand new 'slot' and > 'function' properties would be a significant disruption to > a syntax which has been documented for years (decades). What about this: * No change to PCIDevice member @devfn: encodes slot and function as an integer. * New "pci-device" properties "slot" and "function". "slot" sets just the slot bits of @devfn, and "function" sets just the function bits. Both default to zero, so specifying just "slot" gives you PCI_DEVFN(slot, 0), which makes sense. * Deprecate "pci-device" property "addr" for QMP. We can keep it around for longer than the required grace period if that helps. * Declare it legacy for CLI and HMP, with no intent to remove it.