[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210429162906.32742-1-sdonthineni@nvidia.com>
Date: Thu, 29 Apr 2021 11:29:04 -0500
From: Shanker Donthineni <sdonthineni@...dia.com>
To: Marc Zyngier <maz@...nel.org>,
Alex Williamson <alex.williamson@...hat.com>
CC: Will Deacon <will@...nel.org>,
Catalin Marinas <catalin.marinas@....com>,
Christoffer Dall <christoffer.dall@....com>,
<linux-arm-kernel@...ts.infradead.org>,
<kvmarm@...ts.cs.columbia.edu>, <linux-kernel@...r.kernel.org>,
<kvm@...r.kernel.org>, Vikram Sethi <vsethi@...dia.com>,
Shanker Donthineni <sdonthineni@...dia.com>,
"Jason Sequeira" <jsequeira@...dia.com>
Subject: [RFC 0/2] [RFC] Honor PCI prefetchable attributes for a virtual machine on ARM64
Problem statement: Virtual machine crashes when NVIDIA GPU driver access a prefetchable BAR space due to the unaligned reads/writes for pass-through devices. The same binary works fine as expected in the host kernel. Only one BAR has control & status registers (CSR) and other PCI BARs are marked as prefetchable. NVIDIA GPU driver uses the write-combine feature for mapping the prefetchable BARs to improve performance. This problem applies to all other drivers which want to enable WC.
Solution: Honor PCI prefetchable attributes for the guest operating systems.
Proposal: ARM64-KVM uses VMA struct for the needed information e.g. region physical address, size, and memory-type (struct page backed mapping or anonymous memory) for setting up a stage-2 page table. Right now memory region either can be mapped as DEVICE (strongly ordered) or NORMAL (write-back cache) depends on the flag VM_PFNMAP in VMA. VFIO-PCI will keep the prefetchable (write-combine) information in vma->vm_page_prot similar to other fields, and KVM will prepare stage-2 entries based on the memory-type attribute that was set in VMA.
Shanker Donthineni (2):
vfio/pci: keep the prefetchable attribute of a BAR region in VMA
KVM: arm64: Add write-combine support for stage-2 entries
arch/arm64/include/asm/kvm_mmu.h | 3 ++-
arch/arm64/include/asm/kvm_pgtable.h | 2 ++
arch/arm64/include/asm/memory.h | 4 +++-
arch/arm64/kvm/hyp/pgtable.c | 9 +++++++--
arch/arm64/kvm/mmu.c | 22 +++++++++++++++++++---
arch/arm64/kvm/vgic/vgic-v2.c | 2 +-
drivers/vfio/pci/vfio_pci.c | 6 +++++-
7 files changed, 39 insertions(+), 9 deletions(-)
--
2.17.1
Powered by blists - more mailing lists