Guest memory backed by PCI BAR (x86)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I have an unusual goal of presenting SDRAM located on a real PCIe device
(exposed via BAR) to a guest as normal memory.  Eventually I'd like to
split up guest memory between PCI memory and host memory as different
NUMA nodes to optimize performance;  but for now I'm focusing on just
getting the guest to use memory over PCIe entirely, ignoring the
awful performance.

My first attempt was to modify qemu's "-mem-path" parameter to also
support mmap()able files in addition to hugetlbfs paths.  This was
fairly straightforward, and using a tmpfs file (backed by host SDRAM)
as guest RAM appears to work fine.

I was hoping I could then use a PCI sysfs resource file instead of a
tmpfs file (i.e., /sys/bus/pci/devices/dddd:bb:ss.f/resourceN) to
achieve the desired effect.  But I haven't been able to get Linux or
memtest86+ to boot with this arrangement.  It only boots when KVM
acceleration is disabled.

When KVM acceleration is enabled, SeaBIOS seems to function fine
running out of PCI memory space, but booting the OS resets.
Specifically, the following happens (I'll stick with the memtest86+
5.01 test case for simplicity):

setup.S of memtest:

---[snip]---
  /*
   * Note that the short jump isn't strictly needed, althought there are
   * reasons why it might be a good idea. It won't hurt in any case.
   */
          movw    $0x0001, %ax    # protected mode (PE) bit
          lmsw    %ax             # This is it#
          jmp     flush_instr
  flush_instr:
          movw    $KERNEL_DS, %ax
          movw    %ax, %ds
          movw    %ax, %es
          movw    %ax, %ss    <---- broken here
          movw    %ax, %fs
          movw    %ax, %gs
---[snip]---

In this portion that's attempting to enter protected mode, the
"movw %ax, %ss" instruction execution results in the guest resetting.
gdb shows that after stepping through this instruction, CS:IP points
to F000:E05B (entry_post within SeaBIOS).

I'm new to KVM, so I'm hoping someone could provide some guidance on
what might be wrong, what you'd recommend to get this working, or how
I might debug this better.

I'm using qemu 2.2.0 and an EL6 kernel (2.6.32-358.23.2.el6.x86_64).

Thanks,

Nate
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux