From: "Wu, Fei" <fei2.wu@intel.com>
To: eric.auger@redhat.com,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Andrew Jones" <ajones@ventanamicro.com>
Cc: palmer@dabbelt.com, alistair.francis@wdc.com,
bin.meng@windriver.com, liweiwei@iscas.ac.cn,
dbarboza@ventanamicro.com, zhiwei_liu@linux.alibaba.com,
qemu-riscv@nongnu.org, qemu-devel@nongnu.org,
"Andrei Warkentin" <andrei.warkentin@intel.com>,
qemu-arm <qemu-arm@nongnu.org>,
"Alex Williamson" <alex.williamson@redhat.com>,
"Cédric Le Goater" <clg@redhat.com>
Subject: Re: [PATCH] hw/riscv: split RAM into low and high memory
Date: Thu, 7 Sep 2023 18:04:46 +0800 [thread overview]
Message-ID: <57b4ae4f-ea55-e17c-bb58-2f878c121038@intel.com> (raw)
In-Reply-To: <2916216f-39a0-1a27-ad4e-6c664bf4a04e@redhat.com>
On 9/7/2023 5:10 PM, Eric Auger wrote:
> Hi,
>
> On 9/7/23 09:16, Philippe Mathieu-Daudé wrote:
>> Widening Cc to ARM/VFIO.
>>
>> On 4/8/23 11:15, Wu, Fei wrote:
>>> On 8/3/2023 11:07 PM, Andrew Jones wrote:
>>>> On Mon, Jul 31, 2023 at 09:53:17AM +0800, Fei Wu wrote:
>>>>> riscv virt platform's memory started at 0x80000000 and
>>>>> straddled the 4GiB boundary. Curiously enough, this choice
>>>>> of a memory layout will prevent from launching a VM with
>>>>> a bit more than 2000MiB and PCIe pass-thru on an x86 host, due
>>>>> to identity mapping requirements for the MSI doorbell on x86,
>>>>> and these (APIC/IOAPIC) live right below 4GiB.
>>>>>
>>>>> So just split the RAM range into two portions:
>>>>> - 1 GiB range from 0x80000000 to 0xc0000000.
>>>>> - The remainder at 0x100000000
>>>>>
>>>>> ...leaving a hole between the ranges.
>>>>
>>>> Can you elaborate on the use case? Maybe provide details of the host
>>>> system and the QEMU command line? I'm wondering why we didn't have
>>>> any problems with the arm virt machine type. Has nobody tried this
>>>> use case with that? Is the use case something valid for riscv, but
>>>> not arm?
>>>>
>>> Firstly we have to enable pcie passthru on host, find the device groups,
>>> e.g. the vga card, and add their pci ids to host kernel cmdline:
>>> vfio-pci.ids=10de:0f02,10de:0e08
>>>
>>> then start vm through qemu as follows:
>>> $Q -machine virt -m 4G -smp 4 -nographic \
>>> -bios /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.elf \
>>> -kernel ./vmlinuz -initrd initrd.img -append "root=/dev/vda1 rw" \
>>> -drive
>>> file=ubuntu-22.04.1-preinstalled-server-riscv64+unmatched.img,if=virtio,format=raw
>>>
>>> \
>>> -device vfio-pci,host=01:00.0 -device vfio-pci,host=01:00.1 \
>>> -netdev user,id=vnet,hostfwd=:127.0.0.1:2223-:22 -device
>>> virtio-net-pci,netdev=vnet
>>>
>>> Without this patch, qemu exits immediately instead of boots up.
>>>
>>> Just tried pcie passthru on arm, it cannot handle 4G memory either.
>>> $Q -m 4G -smp 4 -cpu max -M virt -nographic \
>>> -pflash /usr/share/AAVMF/AAVMF_CODE.fd -pflash flash1.img \
>>> -drive if=none,file=ubuntu-22.04-server-cloudimg-arm64.img,id=hd0 \
>>> -device virtio-blk-device,drive=hd0 \
>>> -device vfio-pci,host=01:00.0 -device vfio-pci,host=01:00.1
>>>
>>> qemu-system-aarch64: -device vfio-pci,host=01:00.0: VFIO_MAP_DMA failed:
>>> Invalid argument
>>> qemu-system-aarch64: -device vfio-pci,host=01:00.0: vfio 0000:01:00.0:
>>> failed to setup container for group 11: memory listener initialization
>>> failed: Region mach-virt.ram: vfio_dma_map(0x55de3c2a97f0, 0x40000000,
>>> 0x100000000, 0x7f8fcbe00000) = -22 (Invalid argument)
>
> The collision between the x86 host MSI reserved region [0xfee00000,
> 0xfeefffff] and the ARM guest RAM starting at 1GB has also always
> existed. But now this collision is properly detected instead of being
> silenced. People have not really complained about this so far. Since the
> existing guest RAM layout couldn't be changed, I am afraid we couldn't
> do much.
>
Just as what this patch does for riscv, arm guest on x86 could do the
same thing to adjust the guest RAM layout if necessary? This looks like
a nice-to-have feature for arm if there still is a requirement to run
arm guest on x86.
Thanks,
Fei.
> Eric
>>>
>>> Thanks,
>>> Fei.
>>>
>>>> Thanks,
>>>> drew
>>>
>>>
>>
>
next prev parent reply other threads:[~2023-09-07 10:06 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-31 1:53 [PATCH] hw/riscv: split RAM into low and high memory Fei Wu
2023-07-31 22:46 ` Daniel Henrique Barboza
2023-08-01 2:34 ` Wu, Fei
2023-08-03 0:45 ` Wu, Fei
2023-09-07 3:17 ` Alistair Francis
2023-09-07 15:57 ` Anup Patel
2023-09-07 15:46 ` Anup Patel
2023-09-08 0:16 ` Wu, Fei
2023-08-03 15:07 ` Andrew Jones
2023-08-04 9:15 ` Wu, Fei
2023-09-07 7:16 ` Philippe Mathieu-Daudé
2023-09-07 9:10 ` Eric Auger
2023-09-07 10:04 ` Wu, Fei [this message]
2023-09-07 13:49 ` Eric Auger
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=57b4ae4f-ea55-e17c-bb58-2f878c121038@intel.com \
--to=fei2.wu@intel.com \
--cc=ajones@ventanamicro.com \
--cc=alex.williamson@redhat.com \
--cc=alistair.francis@wdc.com \
--cc=andrei.warkentin@intel.com \
--cc=bin.meng@windriver.com \
--cc=clg@redhat.com \
--cc=dbarboza@ventanamicro.com \
--cc=eric.auger@redhat.com \
--cc=liweiwei@iscas.ac.cn \
--cc=palmer@dabbelt.com \
--cc=philmd@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=zhiwei_liu@linux.alibaba.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;
as well as URLs for NNTP newsgroup(s).