public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Andrea Bolognani <abologna@redhat.com>
Cc: Stefano Brivio <sbrivio@redhat.com>,
	passt-dev@passt.top, Alona Paz <alkaplan@redhat.com>
Subject: Re: [PATCH] qrap: Pass PCI device numbers to qemu in base 10, not in base 16
Date: Thu, 23 Feb 2023 09:27:14 +1100	[thread overview]
Message-ID: <Y/aWwqUN5GX+mbK2@yekko> (raw)
In-Reply-To: <CABJz62Op3xZyh9Gbqw9J7b-F7SpY3ziW33B8g4M00BU7z-4C7g@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1723 bytes --]

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=hostnet0,x-txburst=4096",
> > +			         "%s,%s%i%s,netdev=hostnet0,x-txburst=4096",
> >  			         dev->name, dev->template, i, dev->template_post);
> >  		} else {
> >  			snprintf(dev_str, ARG_MAX,
> > -			         "{\"driver\":\"%s\",%s%x\"%s,\"netdev\":\"hostnet0\",\"x-txburst\":4096}",
> > +			         "{\"driver\":\"%s\",%s%i\"%s,\"netdev\":\"hostnet0\",\"x-txburst\":4096}",
> >  			         dev->name, dev->template_json, i, dev->template_json_post);
> >  		}
> 
> I don't think this is going to work.
> 
> 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=10 and addr=0xa 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.

-- 
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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2023-02-22 22:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-21 19:24 [PATCH] qrap: Pass PCI device numbers to qemu in base 10, not in base 16 Stefano Brivio
2023-02-22  0:27 ` David Gibson
2023-02-22 10:40 ` Andrea Bolognani
2023-02-22 10:45   ` Stefano Brivio
2023-02-22 12:47     ` Andrea Bolognani
2023-02-22 13:02       ` Stefano Brivio
2023-02-22 22:27   ` David Gibson [this message]
2023-02-23 14:06     ` Andrea Bolognani
2023-02-24  7:14       ` Stefano Brivio
2023-02-24 19:05         ` Andrea Bolognani
2023-02-24 19:32           ` Stefano Brivio
2023-02-25  1:44             ` David Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y/aWwqUN5GX+mbK2@yekko \
    --to=david@gibson.dropbear.id.au \
    --cc=abologna@redhat.com \
    --cc=alkaplan@redhat.com \
    --cc=passt-dev@passt.top \
    --cc=sbrivio@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).