Received: by 10.192.165.148 with SMTP id m20csp772827imm; Fri, 27 Apr 2018 07:18:06 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoTFscK94NGDjvj1VNOzpDeQ/V6cjx+tNiuTsSLzXxoHcynbOtFKXDkYRsQmcoMrV+A05GN X-Received: by 2002:a17:902:591e:: with SMTP id o30-v6mr2438033pli.309.1524838686309; Fri, 27 Apr 2018 07:18:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524838686; cv=none; d=google.com; s=arc-20160816; b=R8ezsTqmMDYcFKq7npaYL5+12xzKImZyFRONGnvgbOuB3KG8HyQK9OLj+pv+EfZXoW pHrLKsIQnT6Zrqvoqs3/9k5HHtbXVrkgaLtJVXeUa1OFw683x2KLu0PcnjHXQWdeSeGR ab7tdEXjFiPHurs4QzDTe0aNc017B9h+2r/Nvi3FD6aRR72fMesPQzktBtdVcTwdExOx XSMODrj4Ie868jXRfusBwcD1P9HKL8pOXnoPTPtqZSu4GYnknkNmP2t1TdnMY3eYj1Fn w9XKOSLAuLNoql5qiDRsG3QA1WUiaj7bmCf4r3S0ZqH4qz+W1ycfOmm2dLlSivYLP2dS cwlw== 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=cyUNMpDzfLM1CHqw1E2Fz1hwasYDfpDb+VWpMiU9q3g=; b=R4Ta3w1QpG/4/HCu3eQ3O/aMX0FnI1sEF67H169bqRH0x4haYvfMS6rWMJRKLJZ5Oy C7mamEZmJgoJSjAEXIFDMQA+gxWSSh+gOwlI60xvBa042CHpkzg+Sl94VF3kb5Fa6yHJ VNbas7UnVWxqgnnMG+euzo/d3xn3pQsLaGnsEd/nChQNCZ1ng2fjVE9m0g/EJlSrKILc U6SURkJ6CTEWFDFb4JzwKuQ+leA3YzgywhQZxKBUJj+O/oHAa/iM2UqOwo+9909SXwCD kP1tImdVQ/AoMrr1ToXPMYN0QpXSbPRzaDDxDE00rrtJkP9fXoN8qX5OFMrK2s5wHIBh TRdA== 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 p3si1299510pff.356.2018.04.27.07.17.52; Fri, 27 Apr 2018 07:18:06 -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 S935484AbeD0OPm (ORCPT + 99 others); Fri, 27 Apr 2018 10:15:42 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:36406 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S935470AbeD0OPh (ORCPT ); Fri, 27 Apr 2018 10:15:37 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 680537C6B0; Fri, 27 Apr 2018 14:15:36 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-57.ams2.redhat.com [10.36.116.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id B9284AB3FF; Fri, 27 Apr 2018 14:15:34 +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 v4 09/12] KVM: arm/arm64: Check all vcpu redistributors are set on map_resources Date: Fri, 27 Apr 2018 16:15:02 +0200 Message-Id: <1524838505-3823-10-git-send-email-eric.auger@redhat.com> In-Reply-To: <1524838505-3823-1-git-send-email-eric.auger@redhat.com> References: <1524838505-3823-1-git-send-email-eric.auger@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 27 Apr 2018 14:15:36 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 27 Apr 2018 14:15:36 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.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 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 --- v3 -> v4: - use kvm_debug --- 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 c4a2a46..5563671 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_free_slot(struct list_head *rd_regions) 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_debug("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