Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754680AbbDUKnP (ORCPT ); Tue, 21 Apr 2015 06:43:15 -0400 Received: from cantor2.suse.de ([195.135.220.15]:34235 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751990AbbDUKnM (ORCPT ); Tue, 21 Apr 2015 06:43:12 -0400 Message-ID: <55362951.6090001@suse.de> Date: Tue, 21 Apr 2015 12:41:21 +0200 From: Alexander Graf User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: David Gibson , michael@ellerman.id.au, benh@kernel.crashing.org CC: aik@ozlabs.ru, kvm-ppc@vger.kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, "paulus@samba.org" Subject: Re: [PATCHv4] kvmppc: Implement H_LOGICAL_CI_{LOAD,STORE} in KVM References: <1429576911-6076-1-git-send-email-david@gibson.dropbear.id.au> In-Reply-To: <1429576911-6076-1-git-send-email-david@gibson.dropbear.id.au> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2658 Lines: 56 On 04/21/2015 02:41 AM, David Gibson wrote: > On POWER, storage caching is usually configured via the MMU - attributes > such as cache-inhibited are stored in the TLB and the hashed page table. > > This makes correctly performing cache inhibited IO accesses awkward when > the MMU is turned off (real mode). Some CPU models provide special > registers to control the cache attributes of real mode load and stores but > this is not at all consistent. This is a problem in particular for SLOF, > the firmware used on KVM guests, which runs entirely in real mode, but > which needs to do IO to load the kernel. > > To simplify this qemu implements two special hypercalls, H_LOGICAL_CI_LOAD > and H_LOGICAL_CI_STORE which simulate a cache-inhibited load or store to > a logical address (aka guest physical address). SLOF uses these for IO. > > However, because these are implemented within qemu, not the host kernel, > these bypass any IO devices emulated within KVM itself. The simplest way > to see this problem is to attempt to boot a KVM guest from a virtio-blk > device with iothread / dataplane enabled. The iothread code relies on an > in kernel implementation of the virtio queue notification, which is not > triggered by the IO hcalls, and so the guest will stall in SLOF unable to > load the guest OS. > > This patch addresses this by providing in-kernel implementations of the > 2 hypercalls, which correctly scan the KVM IO bus. Any access to an > address not handled by the KVM IO bus will cause a VM exit, hitting the > qemu implementation as before. > > Note that a userspace change is also required, in order to enable these > new hcall implementations with KVM_CAP_PPC_ENABLE_HCALL. > > Signed-off-by: David Gibson > --- > arch/powerpc/include/asm/kvm_book3s.h | 3 ++ > arch/powerpc/kvm/book3s.c | 76 +++++++++++++++++++++++++++++++++++ > arch/powerpc/kvm/book3s_hv.c | 12 ++++++ > arch/powerpc/kvm/book3s_pr_papr.c | 28 +++++++++++++ > 4 files changed, 119 insertions(+) > > Changes in v4: > * Rebase onto 4.0+, correct for changed signature of kvm_io_bus_{read,write} > > Alex, I saw from some build system notifications that you seemed to > hit some troubles compiling the last version of this patch. This > should fix it - hope it's not too late to get into 4.1. Oh, I already fixed it up in my tree, no worries. Alex -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/