qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Alexander Graf <agraf@suse.de>
Cc: Blue Swirl <blauwirbel@gmail.com>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Aurelien Jarno <aurelien@aurel32.net>,
	"Michael S. Tsirkin" <mst@redhat.com>
Subject: [Qemu-devel] Re: [PATCH 1/6] Make config space accessor host bus trapable
Date: Mon, 04 Jan 2010 07:50:22 +1100	[thread overview]
Message-ID: <1262551822.2173.267.camel@pasglop> (raw)
In-Reply-To: <472F306A-0699-401C-8E6A-8E79B86E4C95@suse.de>

On Sun, 2010-01-03 at 21:27 +0100, Alexander Graf wrote:

> I think if unin_pci is the only user, it'd be better to do it hacky
> inside unin_pci.c. But if there's a chance there's another user, it'd
> be better to make it generic.
> 
> Since this is the first time I ever stumbled across type 0 and type 1
> PCI config space addresses, I simply don't know if there are any. Blue
> Swirls comment indicated that there are. Ben also sounded as if it's
> rather common to not use the x86 format. On the other hand, it looks
> like nobody in qemu needed it so far - and we're implementing ARM,
> MIPS and all other sorts of platforms.
> 
> So if anyone with knowledge in PCI could shed some light here, please
> do so.

My feeling is that what you're better off doing is to have the qemu core
take an abstract struct to identify a device config space location, that
consists of separate fields for:

 - The PCI domain (which is what host bridge it hangs off since bus
numbers are not unique between domains)

 - The bus number

 - The device number (aka slot ID)

 - The function number

Now, you can then provide a "helper" that translate the standard x86
type 0 and type 1 cf8/cfc accesses into the above for most bridges to
use, and uninorth or other non-x86 that use different scheme can do
their own decoding.

The reason you want the above is to be more future proof, ie, you'll
probably want to deal with PCIe extended function numbers for example,
or implement different methods of MMCONFIG etc... and it's better to
disconnect the low level decoding of the config space access from the
internal representation in qemu.

Cheers,
Ben.

  reply	other threads:[~2010-01-03 20:50 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-03  1:50 [Qemu-devel] [PATCH 0/6] PPC NewWorld fixery Alexander Graf
2010-01-03  1:50 ` [Qemu-devel] [PATCH 1/6] Make config space accessor host bus trapable Alexander Graf
2010-01-03 15:45   ` [Qemu-devel] " Michael S. Tsirkin
2010-01-03 16:09     ` Alexander Graf
2010-01-03 17:29       ` Michael S. Tsirkin
2010-01-03 17:40         ` Alexander Graf
2010-01-03 17:44           ` Michael S. Tsirkin
2010-01-03 17:50             ` Alexander Graf
2010-01-03 18:06               ` Michael S. Tsirkin
2010-01-03 19:18                 ` Blue Swirl
2010-01-10 18:41                   ` Blue Swirl
2010-01-11 21:29                     ` Blue Swirl
2010-01-11 22:33                       ` Igor Kovalenko
2010-01-12 19:29                         ` Blue Swirl
2010-01-18 19:47                           ` Blue Swirl
2010-01-03 20:27                 ` Alexander Graf
2010-01-03 20:50                   ` Benjamin Herrenschmidt [this message]
2010-01-04  3:26                     ` Alexander Graf
2010-01-04 10:45                       ` Isaku Yamahata
2010-01-04 10:55                         ` Alexander Graf
2010-01-04 11:08                           ` Isaku Yamahata
2010-01-04 11:07                         ` Michael S. Tsirkin
2010-01-04 11:13                           ` Alexander Graf
2010-01-04 20:10                           ` Benjamin Herrenschmidt
2010-01-04 21:12                             ` Michael S. Tsirkin
2010-01-04 21:25                               ` Benjamin Herrenschmidt
2010-01-04 21:30                                 ` Michael S. Tsirkin
2010-01-04 21:53                                   ` Benjamin Herrenschmidt
2010-01-04 22:25                                     ` Michael S. Tsirkin
2010-01-04 22:51                                       ` Benjamin Herrenschmidt
2010-01-04 22:59                                         ` Michael S. Tsirkin
2010-01-04 23:08                                           ` Alexander Graf
2010-01-04 23:12                                             ` Michael S. Tsirkin
2010-01-04 23:39                                             ` Benjamin Herrenschmidt
2010-01-04 23:33                                           ` Benjamin Herrenschmidt
2010-01-03  1:50 ` [Qemu-devel] [PATCH 2/6] Add config space conversion function for uni_north Alexander Graf
2010-01-03 15:32   ` [Qemu-devel] " Michael S. Tsirkin
2010-01-03 15:40     ` Alexander Graf
2010-01-03 15:47       ` Michael S. Tsirkin
2010-01-03 16:13         ` Alexander Graf
2010-01-03 16:20           ` Michael S. Tsirkin
2010-01-03 16:35             ` Alexander Graf
2010-01-03 17:23               ` Michael S. Tsirkin
2010-01-03 15:48       ` Michael S. Tsirkin
2010-01-03  1:50 ` [Qemu-devel] [PATCH 3/6] Use Mac99_U3 type on ppc64 Alexander Graf
2010-01-03  1:50 ` [Qemu-devel] [PATCH 4/6] Include dump of lspci -nn on real G5 Alexander Graf
2010-01-03  1:50 ` [Qemu-devel] [PATCH 5/6] Make interrupts work Alexander Graf
2010-01-03  1:50 ` [Qemu-devel] [PATCH 6/6] Enable secondary cmd64x Alexander Graf

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=1262551822.2173.267.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=agraf@suse.de \
    --cc=aurelien@aurel32.net \
    --cc=blauwirbel@gmail.com \
    --cc=mst@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).