Received: by 10.213.65.68 with SMTP id h4csp695028imn; Tue, 27 Mar 2018 07:08:29 -0700 (PDT) X-Google-Smtp-Source: AG47ELt1GKBhhzzV0ypHBdFS4s/MhRk/kJ+wK8IW79I3vcRyivjO8dM5wYTBWvXcvnmFQdVAWNoi X-Received: by 10.98.220.86 with SMTP id t83mr25563735pfg.60.1522159709865; Tue, 27 Mar 2018 07:08:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522159709; cv=none; d=google.com; s=arc-20160816; b=1AUd+WZgYpg4FvL26+OsPgxcTkNdzShwqrbqdkIEak2teiQeQvYxahcMAaKqVT77Hi i0kST3inO72lXwcHOm1q1Xlp96E+viNbMEwb/Qv2fN3i6C+zqBRbgXkWkRfsnHvRwNyE h/1Hoy0k/8atyjeS8LbAz8fdosKasdF/9ClSbXVB4CFZ/Hj4tV0eZZlVVlAcmlpyI2xy AUREZcBxiZNKr9ITDiG85uAqDyXfGJw/bSd2jXj+GX4/Yfh1GpRmeHVL/wR4prK/YEP6 JLzstBgijcsyxNFNLPNlQvV9lhA9qBUyjYnRvgG6XDYq+Vf8pXnNoPy3zIikJwQh9SD5 6czA== 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=1rwi43Uz0a8AHfId4WbixVz0AzEkBCEbc5yO5+4eRp0=; b=AjXpPMwiAsyPcdN5piT4lsRIfULcWgz8IEs1yZ+5KqbYh/qTECJTGktP/rScqmMVam ekT+SUZcHMURYs9rupluMSxepN323hqTFIFpUH5oBWBkhHXu4nOPLQEXtrmPbKy3rPXc 1UcutI+o6xw+OJGMvoQBZ+lCz5bgWeDPUFFpexZt3aYKcSDLINpXcfKxzxZoeWazrkOd axT/I2adP87bJpN/9X4awyr9eIwkZGn5cQjl2u7kQVd/J0b7G4sLd9hcb7MeSjitp09+ vaA3p2Mv991psOqRfIXbX1FzTqVj9MO3pJwbUEc/Cg9kC8Gxm/0hfnbXFI+k7Cwc6I5W zrqA== 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 v76si1094561pfa.96.2018.03.27.07.08.15; Tue, 27 Mar 2018 07:08:29 -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 S1752966AbeC0OG0 (ORCPT + 99 others); Tue, 27 Mar 2018 10:06:26 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:53016 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753003AbeC0OEp (ORCPT ); Tue, 27 Mar 2018 10:04:45 -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 8CB65406E946; Tue, 27 Mar 2018 14:04:44 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-135.ams2.redhat.com [10.36.116.135]) by smtp.corp.redhat.com (Postfix) with ESMTP id 910DA215CDB5; Tue, 27 Mar 2018 14:04:42 +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: [RFC v2 09/12] KVM: arm/arm64: Check all vcpu redistributors are set on map_resources Date: Tue, 27 Mar 2018 16:04:13 +0200 Message-Id: <1522159456-10419-10-git-send-email-eric.auger@redhat.com> In-Reply-To: <1522159456-10419-1-git-send-email-eric.auger@redhat.com> References: <1522159456-10419-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]); Tue, 27 Mar 2018 14:04:44 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 27 Mar 2018 14:04:44 +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 993939d..855fc19 100644 --- a/virt/kvm/arm/vgic/vgic-v3.c +++ b/virt/kvm/arm/vgic/vgic-v3.c @@ -478,16 +478,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