From: Avi Kivity <avi@redhat.com>
To: Fede <slashack@gmail.com>
Cc: kvm <kvm@vger.kernel.org>
Subject: Re: PCI device passthrough / memory mapping issue
Date: Wed, 24 Mar 2010 14:26:53 +0200 [thread overview]
Message-ID: <4BAA050D.7040704@redhat.com> (raw)
In-Reply-To: <3b47c0dd1003181546k40eb91betd48cf8e3e561862d@mail.gmail.com>
On 03/19/2010 12:46 AM, Fede wrote:
> I'm currently working to enable vga passthrough in kvm.
>
> assigned_dev_iomem_map: e_phys=10000000 r_virt=0x7fa64af0e000 type=0
> len=02000000 region_num=3
> kvm_register_phys_mem:580 memory: gpa: 10000000, size: 2000000, uaddr:
> 7fa64af0e000, slot: 7,flags: 0
> create_userspace_phys_mem: File exists
> assigned_dev_iomem_map: Error: create new mapping failed
>
>
> This worked a month ago. But after some git updates there's a problem.
>
> When the real device regions are mapped from real virtual memory to
> guest physical addresses in kvm, it overlaps region 3 with the guest
> physical memory assigned to kernel space (0x10000000 to 0x10200000)
>
> I've been trying to look for the answer to this question: Why is gpa
> 0x10000000 chosen and not any other free memory space?
>
The BIOS generally assigns addresses, then the OS updates them if it
wants to. Is the crash before or after the OS has started loading?
If before, suggest you add some printfs to seabios to explain its decisions.
> It seems that this addresses are being chosen here (for example, for region 3):
> assigned_dev_pci_read_config: (4.0): address=001c val=0x00000000 len=4
> assigned_dev_pci_write_config: (4.0): address=001c val=0xffffffff len=4
> assigned_dev_pci_read_config: (4.0): address=001c val=0xfe000000 len=4
>
The above sequence is how the bios determines the BAR size. (0x2000000
in this case).
> assigned_dev_pci_write_config: (4.0): address=001c val=0x00000000 len=4
>
Now it clears the mess from the previous step.
> assigned_dev_pci_read_config: (4.0): address=001c val=0x00000000 len=4
> assigned_dev_pci_write_config: (4.0): address=001c val=0x10000000 len=4
>
Here it assigns a new address. It's clearly wrong. A log in seabios
will explain this.
> What does this mean? Why PCI BARs are being written and read?
> Why the
> values that are written differs from the ones that are read after?
>
BARs are not RAM cells. the least significant address bits are
hardwired to zero, that's how the BIOS detects the BAR size (and
required alignment).
> The last write is the gpa that is used.
>
> Is this a bug? I can't find the source of this gpa addresses. I need
> to change them.
>
Looks like a bug in seabios.
--
error compiling committee.c: too many arguments to function
prev parent reply other threads:[~2010-03-24 12:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-18 22:46 PCI device passthrough / memory mapping issue Fede
2010-03-24 12:26 ` Avi Kivity [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=4BAA050D.7040704@redhat.com \
--to=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=slashack@gmail.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox