From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ard Biesheuvel Subject: Re: issues with emulated PCI MMIO backed by host memory under KVM Date: Tue, 28 Jun 2016 15:19:14 +0200 Message-ID: References: <20160627091619.GB26498@cbox> <20160627103421.GC26498@cbox> <20160627133508.GI26498@cbox> <20160628100405.GK26498@cbox> <9fbfb578-2235-2f2a-4502-a285e9ba22e6@redhat.com> <20160628122043.GO26498@cbox> <20160628131026.GB4585@e104818-lin.cambridge.arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 638FB49B46 for ; Tue, 28 Jun 2016 09:14:07 -0400 (EDT) Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GCllnBZsu+yD for ; Tue, 28 Jun 2016 09:14:05 -0400 (EDT) Received: from mail-io0-f173.google.com (mail-io0-f173.google.com [209.85.223.173]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 803D749B32 for ; Tue, 28 Jun 2016 09:14:05 -0400 (EDT) Received: by mail-io0-f173.google.com with SMTP id t74so16342116ioi.0 for ; Tue, 28 Jun 2016 06:19:16 -0700 (PDT) In-Reply-To: <20160628131026.GB4585@e104818-lin.cambridge.arm.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu To: Catalin Marinas Cc: Marc Zyngier , Laszlo Ersek , "kvmarm@lists.cs.columbia.edu" List-Id: kvmarm@lists.cs.columbia.edu On 28 June 2016 at 15:10, Catalin Marinas wrote: > On Tue, Jun 28, 2016 at 02:20:43PM +0200, Christoffer Dall wrote: >> On Tue, Jun 28, 2016 at 01:06:36PM +0200, Laszlo Ersek wrote: >> > On 06/28/16 12:04, Christoffer Dall wrote: >> > > On Mon, Jun 27, 2016 at 03:57:28PM +0200, Ard Biesheuvel wrote: >> > >> So if vga-pci.c is the only problematic device, for which a reasonable >> > >> alternative exists (virtio-gpu), I think the only feasible solution is >> > >> to educate QEMU not to allow RAM memslots being exposed via PCI BARs >> > >> when running under KVM/ARM. >> > > >> > > It would be good if we could support vga-pci under KVM/ARM, but if >> > > there's no other way than rewriting the arm64 kernel's memory mappings >> > > completely, then probably we're stuck there, unfortunately. > > Just to be clear, the behaviour of mismatched memory attributes is > defined in the ARM ARM and so far Linux worked fine with such cacheable > vs non-cacheable (as long as only one of them is accessed *or* cache > maintenance is performed accordingly). I don't think the arm64 kernel > memory map needs to be rewritten. > That would suggest that having an uncached userland mapping in QEMU and an uncached kernel mapping in the guest would be ok as long as we don't access the host kernel's cacheable alias? In that case, Drew's approach would be feasible, and the pci_register_bar() function in QEMU could be modified to force the userland mapping and the stage2 mapping to 'device' [when running under KVM/ARM] if it refers to a memslot that is backed by host memory. -- Ard.