qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: liang yan <liangy@hpe.com>
Cc: "James, Andrew" <andrew.james@hpe.com>,
	edk2-devel@ml01.01.org, qemu-devel@nongnu.org,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: Re: [Qemu-devel] Could not add PCI device with big memory to aarch64 VMs
Date: Thu, 5 Nov 2015 01:53:13 +0100	[thread overview]
Message-ID: <563AA879.2030301@redhat.com> (raw)
In-Reply-To: <563A8509.4010102@hpe.com>

On 11/04/15 23:22, liang yan wrote:
> Hello, Laszlo,
> 
> (1)I am trying to add ivshmem device(PCI device with big memory) to my
> aarch64 vm.
> So far, I could find device information from vm. But it seems vm did not
> create
> correct resource file for this device. Do you have any idea that this
> happens?
> 
> I used the upstream EDK2 to build my UEFI firmware.
> 
> There are three BARs for this device, and memory map is assigned too,
> but only one
> resource file is created.
> 
> My qemu supports ACPI 5.1 and the command line is :
> 
>   -device ivshmem,size=256M,chardev=ivshmem,msi=on,ioeventfd=on \
>   -chardev socket,path=/tmp/ivshmem_socket,id=ivshmem \
> 
> The lspci information:
> 
> 00:00.0 Host bridge: Red Hat, Inc. Device 0008
>     Subsystem: Red Hat, Inc Device 1100
>     Control: I/O- Mem- BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr-
> Stepping- SERR- FastB2B- DisINTx-
>     Status: Cap- 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort-
> <TAbort- <MAbort- >SERR- <PERR- INTx-
> 
> 00:01.0 RAM memory: Red Hat, Inc Inter-VM shared memory
>     Subsystem: Red Hat, Inc QEMU Virtual Machine
>     Control: I/O- Mem- BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr-
> Stepping- SERR- FastB2B- DisINTx-
>     Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort-
> <TAbort- <MAbort- >SERR- <PERR- INTx-
>     Interrupt: pin A routed to IRQ 255
>     Region 0: Memory at 20001000 (32-bit, non-prefetchable) [disabled]
> [size=256]
>     Region 1: Memory at 20000000 (32-bit, non-prefetchable) [disabled]
> [size=4K]
>     Region 2: Memory at 10000000 (64-bit, prefetchable) [disabled]
> [size=256M]
>     Capabilities: [40] MSI-X: Enable- Count=1 Masked-
>         Vector table: BAR=1 offset=00000000
>         PBA: BAR=1 offset=00000800
> 
> Boot information:
> 
> [    2.380924] pci 0000:00:01.0: BAR 2: assigned [mem
> 0x10000000-0x1fffffff 64bit pref]
> [    2.382836] pci 0000:00:01.0: BAR 1: assigned [mem
> 0x20000000-0x20000fff]
> [    2.383557] pci 0000:00:01.0: BAR 0: assigned [mem
> 0x20001000-0x200010ff]
> 
> 
> Files under /sys/devices/pci0000:00/0000:00:01.0
> 
> broken_parity_status      devspec       local_cpus  resource
> class              dma_mask_bits    modalias    subsystem
> config              driver_override  msi_bus     subsystem_device
> consistent_dma_mask_bits  enable       power       subsystem_vendor
> d3cold_allowed          irq           remove      uevent
> device              local_cpulist    rescan      vendor
> 
> Information for resource:
> 
> 0x0000000020001000 0x00000000200010ff 0x0000000000040200
> 0x0000000020000000 0x0000000020000fff 0x0000000000040200
> 0x0000000010000000 0x000000001fffffff 0x000000000014220c
> 0x0000000000000000 0x0000000000000000 0x0000000000000000
> 0x0000000000000000 0x0000000000000000 0x0000000000000000
> 0x0000000000000000 0x0000000000000000 0x0000000000000000
> 0x0000000000000000 0x0000000000000000 0x0000000000000000
> 
> 
> 
> 
> (2)It also has a problem that once I use a memory bigger than 256M for
> ivshmem, it could not get through UEFI,
> the error message is
> 
> PciBus: Discovered PCI @ [00|01|00]
>    BAR[0]: Type =  Mem32; Alignment = 0xFFF;    Length = 0x100; Offset =
> 0x10
>    BAR[1]: Type =  Mem32; Alignment = 0xFFF;    Length = 0x1000; Offset
> = 0x14
>    BAR[2]: Type = PMem64; Alignment = 0x3FFFFFFF;    Length =
> 0x40000000;    Offset = 0x18
> 
> PciBus: HostBridge->SubmitResources() - Success
> ASSERT
> /home/liang/studio/edk2/ArmVirtPkg/PciHostBridgeDxe/PciHostBridge.c(449): ((BOOLEAN)(0==1))
> 
> 
> I am wandering if there are memory limitation for pcie devices under
> Qemu environment?
> 
> 
> Just thank you in advance and any information would be appreciated.

(CC'ing Ard.)

"Apparently", the firmware-side counterpart of QEMU commit 5125f9cd2532
has never been contributed to edk2.

Therefore the the ProcessPciHost() function in
"ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c" ignores the
DTB_PCI_HOST_RANGE_MMIO64 type range from the DTB. (Thus only
DTB_PCI_HOST_RANGE_MMIO32 is recognized as PCI MMIO aperture.)

However, even if said driver was extended to parse the new 64-bit
aperture into PCDs (which wouldn't be hard), the
ArmVirtPkg/PciHostBridgeDxe driver would still have to be taught to look
at that aperture (from the PCDs) and to serve MMIO BAR allocation
requests from it. That could be hard.

Please check edk2 commits e48f1f15b0e2^..e5ceb6c9d390, approximately,
for the background on the current code. See also chapter 13 "Protocols -
PCI Bus Support" in the UEFI spec.

Patches welcome. :)

(A separate note on ACPI vs. DT: the firmware forwards *both* from QEMU
to the runtime guest OS. However, the firmware parses only the DT for
its own purposes.)

Thanks
Laszlo

  reply	other threads:[~2015-11-05  0:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-04 22:22 [Qemu-devel] Could not add PCI device with big memory to aarch64 VMs liang yan
2015-11-05  0:53 ` Laszlo Ersek [this message]
2015-11-30 18:45   ` liang yan
2015-11-30 22:05     ` [Qemu-devel] [edk2] " Laszlo Ersek
2015-12-01  0:46       ` liang yan
2015-12-01  1:45         ` Laszlo Ersek
2015-12-02 17:28           ` liang yan
2015-12-02 18:29             ` Laszlo Ersek
2016-09-02 21:18 ` Laszlo Ersek

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=563AA879.2030301@redhat.com \
    --to=lersek@redhat.com \
    --cc=andrew.james@hpe.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=edk2-devel@ml01.01.org \
    --cc=liangy@hpe.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).