From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 368295A0082 for ; Wed, 22 Feb 2023 23:27:30 +0100 (CET) Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4PMW4G3pNcz4x7y; Thu, 23 Feb 2023 09:27:26 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1677104846; bh=QwUQDJfQZxW6DQtqea/8WpDwD58xX/YXYVkcpnoFwqA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=TlivLYrMlt1YNcowuaKXvIrkWBRZ5uqfkzns7wJximf75FFt9/+t01eeKRdscp5fk SL/s4I1xmLljSvKQxkE7GQwuocmfA9K22eBe1ZtgFjA2iafpGZOx7cQYrAQhCagXvC ASchiEDDOws9RvchN01JN3c4P3eELIGmQqGqhtFU= Date: Thu, 23 Feb 2023 09:27:14 +1100 From: David Gibson To: Andrea Bolognani Subject: Re: [PATCH] qrap: Pass PCI device numbers to qemu in base 10, not in base 16 Message-ID: References: <20230221192425.3745394-1-sbrivio@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="qxUa9PGvb1Qq7MDr" Content-Disposition: inline In-Reply-To: Message-ID-Hash: SLJPQHJCSJM7ASRSR2FPQSXVVRH7Q62T X-Message-ID-Hash: SLJPQHJCSJM7ASRSR2FPQSXVVRH7Q62T X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Stefano Brivio , passt-dev@passt.top, Alona Paz X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --qxUa9PGvb1Qq7MDr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Feb 22, 2023 at 02:40:32AM -0800, Andrea Bolognani wrote: > On Tue, Feb 21, 2023 at 08:24:25PM +0100, Stefano Brivio wrote: > > if (!has_json) { > > snprintf(dev_str, ARG_MAX, > > - "%s,%s%x%s,netdev=3Dhostnet0,x-txburst=3D4096", > > + "%s,%s%i%s,netdev=3Dhostnet0,x-txburst=3D4096", > > dev->name, dev->template, i, dev->template_post); > > } else { > > snprintf(dev_str, ARG_MAX, > > - "{\"driver\":\"%s\",%s%x\"%s,\"netdev\":\"hostnet0\",\"x-t= xburst\":4096}", > > + "{\"driver\":\"%s\",%s%i\"%s,\"netdev\":\"hostnet0\",\"x-t= xburst\":4096}", > > dev->name, dev->template_json, i, dev->template_json_post); > > } >=20 > I don't think this is going to work. >=20 > The problem is that, while PCI buses are indeed named with increasing > numbers in integer format (pci.9, pci.10 and so on), PCI slots are > addressed using hexadecimal format (0x9, 0xa and so on). libvirt uses > this naming convention because it matches QEMU's. Actually, I think we're ok. PCI slots are addressed in hex by convention, but AFAICT if you *just* give a slot number, it will accept either decimal or hex (so addr=3D10 and addr=3D0xa are equivalent). That's *not* true if you use SS.F format to include the function number - then it expects hex only. But we're not doing that, so so always using decimal should be ok here. Source: set_pci_devfn() in the qemu source Obviously that's a pretty fragile hack, but that's 'qrap' for you. --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --qxUa9PGvb1Qq7MDr Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmP2lpgACgkQzQJF27ox 2GcNpQ//Vf4iG+SBdbVNY62RhPsmP2N+dJ+YMdA/blTxZLQZjg1KusIsn8TUy8Xc Q24THyTfYLMzNh+Qm0Q9Vrd4D3bRrtm5RTB+zAyqG54+11VoBHFHnX3zboOirTB/ TYVOV9f0Li/4ixykPo4rb6cXMo065ck6oqPv9ekBzBGkXvL4XCbDR9V0pRbz7EgP fk+lDh84oPiwOk4DqisfYiXLLHd5up7R0kNK3AlZxgSDj9Yvn/X3qHmyH1tCZ9Q6 yEcJ/3zBq79OIzZ/4zQq9Mwm6oOZFwGOuNLlhAjeNaByzhdk64/BmdjhZI9hdfAy CI8944GdBP2BBWMq5PTSG2UueEXkZJDS6i1N1ErFEXRIo9eeOwLRra36eLdwBNie pAljUcSH3WYzCRRTkxENxX1TNqBaSqRrpePfigOVHL+2qQml5GNT9lYfEnhURK9K jhSpr9IFPrwIJK3sV8mgjsLy/DRALZT4gN0ZKcdTyc2gcgJjUSzkmPPNMKbVUH3h Puzel735+8cuo4HoVfSm52CZ/sIKrC0/xrPef69CwKgZmTM3LaVm4QhwDg7OmbEy 19MI7ITaCL7MN4EYDp118/Tyr/QDzaFhwopPAxA/yfGqHbsG3VPxZ8bF5V9567Np JdbM8vyrFzzcHB88O+LJaw3/n/VpqdO9PbnRgfoto7IcDztUyac= =T+KC -----END PGP SIGNATURE----- --qxUa9PGvb1Qq7MDr--