Received: by 10.192.165.148 with SMTP id m20csp5122790imm; Tue, 24 Apr 2018 14:11:35 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+jdED54NoylUlkcHfCXwtF8xdWUnfORs9eUtf/WI3BuDgTkMHTo3b39on/d/a05zGs0EQx X-Received: by 2002:a17:902:462:: with SMTP id 89-v6mr20666169ple.300.1524604295870; Tue, 24 Apr 2018 14:11:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524604295; cv=none; d=google.com; s=arc-20160816; b=euviqU8NYNUmKsT2+Un/ohluuomJz0ERkLQ0ABgegy2pDkQPHby/cZh7HM7vVHqaLr z8tIASZDlqYvtZJAMArvQeNnXOc2Yxs2oOJdgilDRdRr4tgc02s3o56ohNJNjNes7J4r qxIS2FJo4DQJzITRCiOIwkGcR6r1p4vTwTJiVwvX/OBkoJXK9IBybYNIE5z+0GsroA8c HsdCp/shoxvJmOGCAc6DmTEX6lYNoCGliavYlspFeDeHgGJttTtQz5kcBD9NvGuUolLb BFAr11/A4DlT0HsfI3bFB1uE3Yule+aHA5Lh2QQGXtKizrfhCax/rBu2jiqBED1GImp/ ZQTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=Si8ehpjGHFiq5Bq/MGttDiuBJLi9B9ge7Mccs6om+EI=; b=fEXPgt9bo5xlrEVwBrCE+k+vjtUx1R6W99XRJ7eY3Q8UayYkJwteKF8A4QCfCPtUcI pW0CjbxayjsvbU02heXWbdK2ajh2imUy+nNHOxmjy9Vhh+hJIOJTPblMEQ4TFhZwEpGl Lh6fw2EtiWh5E79w/npoRMhE1vp/R40wBXf47lIQg2w7gqdZJ22aNc4CIQo47Du8Esf1 zYRQLfKg2fq5QVq9QlaoarEF8g5z1FuqMyNtD6SapS7PuXdqTNI9i/BF4hTtLW2fbIMe ZVEmJyBn6BxQnZ9bpJg78oY2sFmc7maTf7tlTY4J46yN64zFDzJ+k748XTafiipUS/MR 6Abw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y6si11813374pgv.520.2018.04.24.14.11.21; Tue, 24 Apr 2018 14:11:35 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752164AbeDXVIM (ORCPT + 99 others); Tue, 24 Apr 2018 17:08:12 -0400 Received: from foss.arm.com ([217.140.101.70]:59972 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750786AbeDXVID (ORCPT ); Tue, 24 Apr 2018 17:08:03 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B953080D; Tue, 24 Apr 2018 14:08:02 -0700 (PDT) Received: from localhost (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 18CE53F25D; Tue, 24 Apr 2018 14:08:01 -0700 (PDT) Date: Tue, 24 Apr 2018 23:07:59 +0200 From: Christoffer Dall To: Eric Auger Cc: eric.auger.pro@gmail.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, andre.przywara@arm.com, drjones@redhat.com, wei@redhat.com Subject: Re: [PATCH v3 08/12] KVM: arm/arm64: Check vcpu redist base before registering an iodev Message-ID: <20180424210759.GI4533@C02W217FHV2R.local> References: <1523607658-9166-1-git-send-email-eric.auger@redhat.com> <1523607658-9166-9-git-send-email-eric.auger@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1523607658-9166-9-git-send-email-eric.auger@redhat.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 13, 2018 at 10:20:54AM +0200, Eric Auger wrote: > As we are going to register several redist regions, > vgic_register_all_redist_iodevs() may be called several times. We need > to register a redist_iodev for a given vcpu only once. Wouldn't it be more natural to change that caller to only register the iodevs for that region? Thanks, -Christoffer > So let's > check if the base address has already been set. Initialize this latter > in kvm_vgic_vcpu_early_init(). > > Signed-off-by: Eric Auger > --- > virt/kvm/arm/vgic/vgic-init.c | 3 +++ > virt/kvm/arm/vgic/vgic-mmio-v3.c | 3 +++ > 2 files changed, 6 insertions(+) > > diff --git a/virt/kvm/arm/vgic/vgic-init.c b/virt/kvm/arm/vgic/vgic-init.c > index 6456371..7e040e7 100644 > --- a/virt/kvm/arm/vgic/vgic-init.c > +++ b/virt/kvm/arm/vgic/vgic-init.c > @@ -82,6 +82,9 @@ void kvm_vgic_vcpu_early_init(struct kvm_vcpu *vcpu) > INIT_LIST_HEAD(&vgic_cpu->ap_list_head); > spin_lock_init(&vgic_cpu->ap_list_lock); > > + vgic_cpu->rd_iodev.base_addr = VGIC_ADDR_UNDEF; > + vgic_cpu->sgi_iodev.base_addr = VGIC_ADDR_UNDEF; > + > /* > * Enable and configure all SGIs to be edge-triggered and > * configure all PPIs as level-triggered. > diff --git a/virt/kvm/arm/vgic/vgic-mmio-v3.c b/virt/kvm/arm/vgic/vgic-mmio-v3.c > index 5273fb8..df23e66 100644 > --- a/virt/kvm/arm/vgic/vgic-mmio-v3.c > +++ b/virt/kvm/arm/vgic/vgic-mmio-v3.c > @@ -592,6 +592,9 @@ int vgic_register_redist_iodev(struct kvm_vcpu *vcpu) > gpa_t rd_base, sgi_base; > int ret; > > + if (!IS_VGIC_ADDR_UNDEF(vgic_cpu->rd_iodev.base_addr)) > + return 0; > + > /* > * We may be creating VCPUs before having set the base address for the > * redistributor region, in which case we will come back to this > -- > 2.5.5 >