Received: by 10.192.165.156 with SMTP id m28csp439810imm; Fri, 13 Apr 2018 01:43:42 -0700 (PDT) X-Google-Smtp-Source: AIpwx49wc7wcm6xLTM6F/B9oXXZVju8Fg60mZ9/UEdhbUCh8DOA0EosIBm62ZjPkkUrVTTPknpjF X-Received: by 2002:a17:902:47aa:: with SMTP id r39-v6mr4338367pld.59.1523609022039; Fri, 13 Apr 2018 01:43:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523609021; cv=none; d=google.com; s=arc-20160816; b=u3aoDRYx4TRkWc0kvwGpRQgxcQjBzktmZZaJpDwOseMzP7T1eVqX4VJoojk2CL0pSu 7BLygN0DkwdFHJUxBfswVFy+ZnV9wMd0y+GlAsoljppgyhzgIwSC0m99kHqpYe+Pwxur 0StrQUn5HZBf7rvAC6daDeGSmu75Kg9Y+5R1SJzpVXD9w2l/XorBKml6+pIBWSXi15yb y/TKu00zIWE1nNpoRp55FnvQ+jvKdwuHah2mf63FXEQUGQuVmSdAWHYmNPeFLG2lwG2i 3Cc+jFr1c6vakufujubtESoRCE9Asw2YSuT6dX6PmTL22Ag2pru8ewC3OMxtuM+w3whW bpew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=7P0PJ56b2lNrGQhz/KbkT4MABKz4ppBSOwl9l4PHOyE=; b=DlRWcAioruEdB6wNrtsyJ23hEGqMeXTfgK8AEXjT9WDwbwe5/MZ+S2hBoets5PjOdf 8XfsnP70BjGoiA6SaPq+hevNqjUueU3vNcBdgUOl73REWM6t1m1iTqwaU6GW+n7ES+vL koMErAiJ/uUm5S+roQabC2eGUmN/rS2Xx17M73WzV+8qxQQlek55w8PcgRjlfMvGsgKr 1jkUCda/zvPJCZrFIumaqzcefgp3hspwl3NduDP8hJ4Wnp8Vm+H+j1Kx1G3m0U4Q0MNl NnDCzwyDQOpdMIMMPabUYsF6XhZmU98AStU52l/Djt8pXuT/2b1wkbGEyjiI3KxGnsrs mpYg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l9si4266501pff.270.2018.04.13.01.43.28; Fri, 13 Apr 2018 01:43:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753958AbeDMIVj (ORCPT + 99 others); Fri, 13 Apr 2018 04:21:39 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:44972 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753727AbeDMIVZ (ORCPT ); Fri, 13 Apr 2018 04:21:25 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 67F204074450; Fri, 13 Apr 2018 08:21:24 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-192.ams2.redhat.com [10.36.116.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6904D215CDC8; Fri, 13 Apr 2018 08:21:22 +0000 (UTC) From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, marc.zyngier@arm.com, cdall@kernel.org, peter.maydell@linaro.org Cc: andre.przywara@arm.com, drjones@redhat.com, wei@redhat.com Subject: [PATCH v3 09/12] KVM: arm/arm64: Check all vcpu redistributors are set on map_resources Date: Fri, 13 Apr 2018 10:20:55 +0200 Message-Id: <1523607658-9166-10-git-send-email-eric.auger@redhat.com> In-Reply-To: <1523607658-9166-1-git-send-email-eric.auger@redhat.com> References: <1523607658-9166-1-git-send-email-eric.auger@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Fri, 13 Apr 2018 08:21:24 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Fri, 13 Apr 2018 08:21:24 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'eric.auger@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On vcpu first run, we eventually know the actual number of vcpus. This is a synchronization point to check all redistributors regions were assigned. On kvm_vgic_map_resources() we check both dist and redist were set, eventually check potential base address inconsistencies. Signed-off-by: Eric Auger --- virt/kvm/arm/vgic/vgic-v3.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/virt/kvm/arm/vgic/vgic-v3.c b/virt/kvm/arm/vgic/vgic-v3.c index b80f650..feabc24 100644 --- a/virt/kvm/arm/vgic/vgic-v3.c +++ b/virt/kvm/arm/vgic/vgic-v3.c @@ -484,16 +484,25 @@ struct vgic_redist_region *vgic_v3_rdist_region_from_index(struct kvm *kvm, int vgic_v3_map_resources(struct kvm *kvm) { - int ret = 0; struct vgic_dist *dist = &kvm->arch.vgic; - struct vgic_redist_region *rdreg = - list_first_entry(&dist->rd_regions, - struct vgic_redist_region, list); + struct kvm_vcpu *vcpu; + int ret = 0; + int c; if (vgic_ready(kvm)) goto out; - if (IS_VGIC_ADDR_UNDEF(dist->vgic_dist_base) || !rdreg) { + kvm_for_each_vcpu(c, vcpu, kvm) { + struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu; + + if (IS_VGIC_ADDR_UNDEF(vgic_cpu->rd_iodev.base_addr)) { + kvm_err("vcpu %d redistributor base not set\n", c); + ret = -ENXIO; + goto out; + } + } + + if (IS_VGIC_ADDR_UNDEF(dist->vgic_dist_base)) { kvm_err("Need to set vgic distributor addresses first\n"); ret = -ENXIO; goto out; -- 2.5.5