* [Qemu-devel] PCI address question
@ 2009-10-21 9:51 Màrius Montón
2009-10-27 15:05 ` [Qemu-devel] " Màrius Montón
0 siblings, 1 reply; 6+ messages in thread
From: Màrius Montón @ 2009-10-21 9:51 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 367 bytes --]
Hello,
For my PCI device to QEMU, I need the real address the PCI bus is using
to access my device. For a IO BAR (PCI_ADDRESS_SPACE_IO), I receive the
real address (like 0xc200 or similar), but when registering a
PCI_ADDRESS_SPACE_MEM I only receive the offset to the BAR.
How I can receive or obtaint the real address on each access to my device?
Cjeers,
Màrius
[-- Attachment #2: marius_monton.vcf --]
[-- Type: text/x-vcard, Size: 200 bytes --]
begin:vcard
fn;quoted-printable:M=C3=A0rius Mont=C3=B3n
n;quoted-printable;quoted-printable:Mont=C3=B3n;M=C3=A0rius
email;internet:marius.monton@gmail.com
tel;cell:+34617738203
version:2.1
end:vcard
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] Re: PCI address question
2009-10-21 9:51 [Qemu-devel] PCI address question Màrius Montón
@ 2009-10-27 15:05 ` Màrius Montón
2009-10-27 15:16 ` Lennart Sorensen
0 siblings, 1 reply; 6+ messages in thread
From: Màrius Montón @ 2009-10-27 15:05 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 453 bytes --]
Màrius Montón wrote:
> Hello,
>
> For my PCI device to QEMU, I need the real address the PCI bus is using
> to access my device. For a IO BAR (PCI_ADDRESS_SPACE_IO), I receive the
> real address (like 0xc200 or similar), but when registering a
> PCI_ADDRESS_SPACE_MEM I only receive the offset to the BAR.
>
> How I can receive or obtaint the real address on each access to my device?
>
> Cjeers,
>
> Màrius
>
nobody can tell me anything? :(
Marius
[-- Attachment #2: marius_monton.vcf --]
[-- Type: text/x-vcard, Size: 200 bytes --]
begin:vcard
fn;quoted-printable:M=C3=A0rius Mont=C3=B3n
n;quoted-printable;quoted-printable:Mont=C3=B3n;M=C3=A0rius
email;internet:marius.monton@gmail.com
tel;cell:+34617738203
version:2.1
end:vcard
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] Re: PCI address question
2009-10-27 15:05 ` [Qemu-devel] " Màrius Montón
@ 2009-10-27 15:16 ` Lennart Sorensen
2009-10-29 11:30 ` Màrius Montón
0 siblings, 1 reply; 6+ messages in thread
From: Lennart Sorensen @ 2009-10-27 15:16 UTC (permalink / raw)
To: Màrius Montón; +Cc: qemu-devel
On Tue, Oct 27, 2009 at 04:05:25PM +0100, Màrius Montón wrote:
> Màrius Montón wrote:
> > Hello,
> >
> > For my PCI device to QEMU, I need the real address the PCI bus is using
> > to access my device. For a IO BAR (PCI_ADDRESS_SPACE_IO), I receive the
> > real address (like 0xc200 or similar), but when registering a
> > PCI_ADDRESS_SPACE_MEM I only receive the offset to the BAR.
> >
> > How I can receive or obtaint the real address on each access to my device?
> >
> > Cjeers,
> >
> > Màrius
> >
> nobody can tell me anything? :(
Add the offset to the address in the bar?
After all the OS is allowed to change your BAR if it wants to.
So internally the only thing that makes sense to a PCI device is the
offset from it's base address.
You listen to addresses at your IO range, and at your memory BAR range.
What you do when you see a request for your range then depends on the
offset that address had from the current base. This would also be true
for the IO.
--
Len Sorensen
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] Re: PCI address question
2009-10-27 15:16 ` Lennart Sorensen
@ 2009-10-29 11:30 ` Màrius Montón
2009-10-29 12:12 ` [Qemu-devel] " Michael S. Tsirkin
0 siblings, 1 reply; 6+ messages in thread
From: Màrius Montón @ 2009-10-29 11:30 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/html, Size: 1869 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] Re: Re: PCI address question
2009-10-29 11:30 ` Màrius Montón
@ 2009-10-29 12:12 ` Michael S. Tsirkin
2009-10-29 13:05 ` [Qemu-devel] " Màrius Montón
0 siblings, 1 reply; 6+ messages in thread
From: Michael S. Tsirkin @ 2009-10-29 12:12 UTC (permalink / raw)
To: Màrius Montón; +Cc: qemu-devel
On Thu, Oct 29, 2009 at 12:30:02PM +0100, Màrius Montón wrote:
> Lennart Sorensen wrote:
>
> On Tue, Oct 27, 2009 at 04:05:25PM +0100, Màrius Montón wrote:
>
>
> Màrius Montón wrote:
>
>
> Hello,
>
> For my PCI device to QEMU, I need the real address the PCI bus is using
> to access my device. For a IO BAR (PCI_ADDRESS_SPACE_IO), I receive the
> real address (like 0xc200 or similar), but when registering a
> PCI_ADDRESS_SPACE_MEM I only receive the offset to the BAR.
>
> How I can receive or obtaint the real address on each access to my device?
>
> Cjeers,
>
> Màrius
>
>
>
> nobody can tell me anything? :(
>
>
> Add the offset to the address in the bar?
>
> The problem is how to know what bar is accessing in case I have only one
> function for all BARs.
I expect that's unusual: different BARs usually have different
functionality. Just implement different functions and pass
calls on to a shared helper?
> After all the OS is allowed to change your BAR if it wants to.
> So internally the only thing that makes sense to a PCI device is the
> offset from it's base address.
>
> You listen to addresses at your IO range, and at your memory BAR range.
> What you do when you see a request for your range then depends on the
> offset that address had from the current base. This would also be true
> for the IO.
>
> I know all PCI internals, but I don't understand why for IO I receive all
> address and only the offset for MEM BARs (or I'm wrong?)
>
> Màrius
PCI only calls a map method. I think this gets a 32 bit address, not BAR offset:
r->addr = new_addr;
if (r->addr != -1) {
r->map_func(d, i, r->addr, r->size, r->type);
}
--
MST
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] Re: PCI address question
2009-10-29 12:12 ` [Qemu-devel] " Michael S. Tsirkin
@ 2009-10-29 13:05 ` Màrius Montón
0 siblings, 0 replies; 6+ messages in thread
From: Màrius Montón @ 2009-10-29 13:05 UTC (permalink / raw)
Cc: qemu-devel
Michael S. Tsirkin wrote:
> On Thu, Oct 29, 2009 at 12:30:02PM +0100, Màrius Montón wrote:
>
>> Lennart Sorensen wrote:
>>
>> On Tue, Oct 27, 2009 at 04:05:25PM +0100, Màrius Montón wrote:
>>
>>
>> Màrius Montón wrote:
>>
>>
>> Hello,
>>
>> For my PCI device to QEMU, I need the real address the PCI bus is using
>> to access my device. For a IO BAR (PCI_ADDRESS_SPACE_IO), I receive the
>> real address (like 0xc200 or similar), but when registering a
>> PCI_ADDRESS_SPACE_MEM I only receive the offset to the BAR.
>>
>> How I can receive or obtaint the real address on each access to my device?
>>
>> Cjeers,
>>
>> Màrius
>>
>>
>>
>> nobody can tell me anything? :(
>>
>>
>> Add the offset to the address in the bar?
>>
>> The problem is how to know what bar is accessing in case I have only one
>> function for all BARs.
>>
>
> I expect that's unusual: different BARs usually have different
> functionality. Just implement different functions and pass
> calls on to a shared helper?
>
>
It is because I'm trying to add PCI devices from a configuration file
(no hot-plug), and this way was the easies way I found... any idea?
>> After all the OS is allowed to change your BAR if it wants to.
>> So internally the only thing that makes sense to a PCI device is the
>> offset from it's base address.
>>
>> You listen to addresses at your IO range, and at your memory BAR range.
>> What you do when you see a request for your range then depends on the
>> offset that address had from the current base. This would also be true
>> for the IO.
>>
>> I know all PCI internals, but I don't understand why for IO I receive all
>> address and only the offset for MEM BARs (or I'm wrong?)
>>
>> Màrius
>>
>
> PCI only calls a map method. I think this gets a 32 bit address, not BAR offset:
>
> r->addr = new_addr;
> if (r->addr != -1) {
> r->map_func(d, i, r->addr, r->size, r->type);
> }
>
>
>
I may study that functions
Màrius
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-10-29 13:03 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-21 9:51 [Qemu-devel] PCI address question Màrius Montón
2009-10-27 15:05 ` [Qemu-devel] " Màrius Montón
2009-10-27 15:16 ` Lennart Sorensen
2009-10-29 11:30 ` Màrius Montón
2009-10-29 12:12 ` [Qemu-devel] " Michael S. Tsirkin
2009-10-29 13:05 ` [Qemu-devel] " Màrius Montón
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).