From: Marcelo Tosatti <mtosatti@redhat.com>
To: qemu-devel@nongnu.org
Cc: Markus Armbruster <armbru@redhat.com>
Subject: Re: [Qemu-devel] [6609] Parse full PCI device addresses (Markus Armbruster)
Date: Thu, 12 Feb 2009 16:27:26 -0200 [thread overview]
Message-ID: <20090212182726.GA19553@amt.cnet> (raw)
In-Reply-To: <200902121618.17411.paul@codesourcery.com>
On Thu, Feb 12, 2009 at 04:18:16PM +0000, Paul Brook wrote:
> > > If we're rejecting nonzero domains then having the parse routine return a
> > > domain value seems wrong. It's just going to make it harder to verify
> > > correct operation when domains are implemented.
> >
> > + /* Note: QEMU doesn't implement domains other than 0 */
> > + if (dom != 0 || pci_find_bus(bus) == NULL) {
> > + fprintf(stderr, "PCI device address %s not supported", addr);
> > + return -1;
> > + }
> >
> > + if (!strcmp(devaddr, "auto")) {
> > + *domp = *busp = 0;
> > + *slotp = -1;
> > + /* want to support dom/bus auto-assign at some point */
> > + return 0;
> > + }
> >
> > We return domain 0. I considered domain 0 as implicit at the moment, is
> > that wrong?
> >
> > I can't see where you're getting at.
>
> You're returning a value that's always known to be zero. IMHO That's worse
> than not returning a value at all.
>
> This implies users of this function will either ignore the value or have
> redundant, untested (i.e. probably bitrotten) code to handle nonzero domains.
> Either way, it's liable the break horribly at runtime as soon as we start
> trying to support multiple domains.
>
> If pci_parse_devaddr is defined to only handle zero domains, then it should
> not be returning a domain value. If/when we implement multiple PCI domains we
> can change the interface, and get nice compiler errors in all the other code
> we forgot to update.
That makes sense.
> Alternatively, have the parse routine return the full tuple, and enforce
> domain == 0 elsewhere.
OK, i'll submit something later in the week so you can ACK/NACK. We want
to pass <dom,bus,slot> all the way down to pci_register_device, and kill
the "-1" parameter that drivers use today (so one can statically assign
bus/slot and eventually domain).
But OK, will drop domain from the API for now.
prev parent reply other threads:[~2009-02-12 18:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-11 15:21 [Qemu-devel] [6609] Parse full PCI device addresses (Markus Armbruster) Anthony Liguori
2009-02-12 15:39 ` Paul Brook
2009-02-12 15:56 ` Marcelo Tosatti
2009-02-12 16:18 ` Paul Brook
2009-02-12 18:27 ` Marcelo Tosatti [this message]
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=20090212182726.GA19553@amt.cnet \
--to=mtosatti@redhat.com \
--cc=armbru@redhat.com \
--cc=qemu-devel@nongnu.org \
/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.
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 NNTP newsgroup(s).