From patchwork Wed Jun 4 12:44:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 355926 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id A5D43140094 for ; Wed, 4 Jun 2014 22:59:41 +1000 (EST) Received: from localhost ([::1]:60845 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsAn5-0004kx-JO for incoming@patchwork.ozlabs.org; Wed, 04 Jun 2014 08:59:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52990) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsAZL-0007sm-IQ for qemu-devel@nongnu.org; Wed, 04 Jun 2014 08:45:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WsAYx-0008LM-Mp for qemu-devel@nongnu.org; Wed, 04 Jun 2014 08:45:27 -0400 Received: from cantor2.suse.de ([195.135.220.15]:45085 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsAYx-0008Fc-EF; Wed, 04 Jun 2014 08:45:03 -0400 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 39538AD75; Wed, 4 Jun 2014 12:45:02 +0000 (UTC) From: Alexander Graf To: qemu-ppc@nongnu.org Date: Wed, 4 Jun 2014 14:44:00 +0200 Message-Id: <1401885899-16524-60-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1401885899-16524-1-git-send-email-agraf@suse.de> References: <1401885899-16524-1-git-send-email-agraf@suse.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 195.135.220.15 Cc: qemu-devel@nongnu.org Subject: [Qemu-devel] [PULL 059/118] KVM: PPC: Don't secretly add 1T segment feature to CPU X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org When we select a CPU type that does not support 1TB segments, we should not expose 1TB just because KVM supports 1TB segments. User configuration always wins over feature availability. Signed-off-by: Alexander Graf --- target-ppc/kvm.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c index 3569367..0744f51 100644 --- a/target-ppc/kvm.c +++ b/target-ppc/kvm.c @@ -356,6 +356,10 @@ static void kvm_fixup_page_sizes(PowerPCCPU *cpu) /* Convert to QEMU form */ memset(&env->sps, 0, sizeof(env->sps)); + /* + * XXX This loop should be an entry wide AND of the capabilities that + * the selected CPU has with the capabilities that KVM supports. + */ for (ik = iq = 0; ik < KVM_PPC_PAGE_SIZES_MAX_SZ; ik++) { struct ppc_one_seg_page_size *qsps = &env->sps.sps[iq]; struct kvm_ppc_one_seg_page_size *ksps = &smmu_info.sps[ik]; @@ -382,9 +386,7 @@ static void kvm_fixup_page_sizes(PowerPCCPU *cpu) } } env->slb_nr = smmu_info.slb_size; - if (smmu_info.flags & KVM_PPC_1T_SEGMENTS) { - env->mmu_model |= POWERPC_MMU_1TSEG; - } else { + if (!(smmu_info.flags & KVM_PPC_1T_SEGMENTS)) { env->mmu_model &= ~POWERPC_MMU_1TSEG; } }