From: Gary R Hook <ghook@redhat.com> To: rhvirt-patches@redhat.com Cc: ghook@redhat.com, "Danilo C. L. de Paula" <ddepaula@redhat.com>, Eduardo Habkost <ehabkost@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org, Richard Henderson <rth@twiddle.net> Subject: [Qemu-devel] [RHEL-8.1 virt 0/2] Enable SEV VM to boot with assigned PCI device Date: Tue, 9 Apr 2019 20:08:01 -0400 [thread overview] Message-ID: <20190410000803.1744-1-ghook@redhat.com> (raw) Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1667249 On an AMD SEV enabled host with an SEV enabled guest, attaching an assigned device to the VM results in a failure to start the VM: qemu-kvm: -device vfio-pci,host=01:00.0,id=hostdev0,bus=pci.2,addr=0x0: sev_ram_block_added: failed to register region (0x7fd96e6bb000+0x20000) error 'Cannot allocate memory' In this example the assigned device is a simple Intel 82574L NIC: 01:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection Subsystem: Intel Corporation Gigabit CT Desktop Adapter Flags: bus master, fast devsel, latency 0, IRQ 89, NUMA node 0 Memory at fb9c0000 (32-bit, non-prefetchable) [size=128K] Memory at fb900000 (32-bit, non-prefetchable) [size=512K] Note that the error indicates the region as (base+size) where a size of 0x20000 is 128K, which matches that of BAR0 for the device. dmesg on the host also reports: SVM: SEV: Failure locking 32 pages. SEV guests make use of the RAMBlock notifier in QEMU to add page pinnings for SEV; the kernel side of the call only knows how to pin pages with get_user_pages(), and this currently faults on non-page backed mappings (e.g. the mmap of an MMIO BAR). To resolve this failure, change the order of the memory region type assignment and avoid pinning device memory regions. Cc: "Danilo C. L. de Paula" <ddepaula@redhat.com> Cc: Eduardo Habkost <ehabkost@redhat.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: qemu-devel@nongnu.org Cc: Richard Henderson <rth@twiddle.net> Danilo C. L. de Paula (2): redhat: branching qemu-kvm to rhel-8.1.0 redhat: renaming branch to rhel-8.1.0 Gary R Hook (2): Subject: memory: Fix the memory region type assignment order Subject: target/i386: sev: Do not pin the ram device memory region .gitpublish | 6 +++--- memory.c | 9 ++++++++- target/i386/sev.c | 11 +++++++++++ 3 files changed, 22 insertions(+), 4 deletions(-) -- 2.18.1
WARNING: multiple messages have this Message-ID (diff)
From: Gary R Hook <ghook@redhat.com> To: rhvirt-patches@redhat.com Cc: ghook@redhat.com, Eduardo Habkost <ehabkost@redhat.com>, qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>, "Danilo C. L. de Paula" <ddepaula@redhat.com>, Richard Henderson <rth@twiddle.net> Subject: [Qemu-devel] [RHEL-8.1 virt 0/2] Enable SEV VM to boot with assigned PCI device Date: Tue, 9 Apr 2019 20:08:01 -0400 [thread overview] Message-ID: <20190410000803.1744-1-ghook@redhat.com> (raw) Message-ID: <20190410000801.eEQr0OR9gqlkfkeQK9SMCk4_8XabpdNKvTNCNb65wO0@z> (raw) Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1667249 On an AMD SEV enabled host with an SEV enabled guest, attaching an assigned device to the VM results in a failure to start the VM: qemu-kvm: -device vfio-pci,host=01:00.0,id=hostdev0,bus=pci.2,addr=0x0: sev_ram_block_added: failed to register region (0x7fd96e6bb000+0x20000) error 'Cannot allocate memory' In this example the assigned device is a simple Intel 82574L NIC: 01:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection Subsystem: Intel Corporation Gigabit CT Desktop Adapter Flags: bus master, fast devsel, latency 0, IRQ 89, NUMA node 0 Memory at fb9c0000 (32-bit, non-prefetchable) [size=128K] Memory at fb900000 (32-bit, non-prefetchable) [size=512K] Note that the error indicates the region as (base+size) where a size of 0x20000 is 128K, which matches that of BAR0 for the device. dmesg on the host also reports: SVM: SEV: Failure locking 32 pages. SEV guests make use of the RAMBlock notifier in QEMU to add page pinnings for SEV; the kernel side of the call only knows how to pin pages with get_user_pages(), and this currently faults on non-page backed mappings (e.g. the mmap of an MMIO BAR). To resolve this failure, change the order of the memory region type assignment and avoid pinning device memory regions. Cc: "Danilo C. L. de Paula" <ddepaula@redhat.com> Cc: Eduardo Habkost <ehabkost@redhat.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: qemu-devel@nongnu.org Cc: Richard Henderson <rth@twiddle.net> Danilo C. L. de Paula (2): redhat: branching qemu-kvm to rhel-8.1.0 redhat: renaming branch to rhel-8.1.0 Gary R Hook (2): Subject: memory: Fix the memory region type assignment order Subject: target/i386: sev: Do not pin the ram device memory region .gitpublish | 6 +++--- memory.c | 9 ++++++++- target/i386/sev.c | 11 +++++++++++ 3 files changed, 22 insertions(+), 4 deletions(-) -- 2.18.1
next reply other threads:[~2019-04-10 0:14 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-04-10 0:08 Gary R Hook [this message] 2019-04-10 0:08 ` [Qemu-devel] [RHEL-8.1 virt 0/2] Enable SEV VM to boot with assigned PCI device Gary R Hook 2019-04-10 0:08 ` [Qemu-devel] [RHEL-8.1 virt 1/2] memory: Fix the memory region type assignment order Gary R Hook 2019-04-10 0:08 ` Gary R Hook 2019-04-22 21:26 ` Eduardo Habkost 2019-04-22 21:26 ` Eduardo Habkost 2019-04-10 0:08 ` [Qemu-devel] [RHEL-8.1 virt 2/2] target/i386: sev: Do not pin the ram device memory region Gary R Hook 2019-04-10 0:08 ` Gary R Hook 2019-04-22 21:29 ` Eduardo Habkost 2019-04-22 21:29 ` Eduardo Habkost 2019-11-06 20:04 ` Gary R Hook 2019-04-26 8:10 ` [Qemu-devel] [RHEL-8.1 virt 0/2] Enable SEV VM to boot with assigned PCI device Paolo Bonzini 2019-04-26 8:10 ` Paolo Bonzini
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=20190410000803.1744-1-ghook@redhat.com \ --to=ghook@redhat.com \ --cc=ddepaula@redhat.com \ --cc=ehabkost@redhat.com \ --cc=pbonzini@redhat.com \ --cc=qemu-devel@nongnu.org \ --cc=rhvirt-patches@redhat.com \ --cc=rth@twiddle.net \ /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: linkBe 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).