Received: by 10.192.165.148 with SMTP id m20csp2720598imm; Sun, 29 Apr 2018 05:36:02 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrtZEBx+LQA3BHO1zvdD4ifDWKgp8pzjKg3WcH6y/Idvtdjl3JPzIXTvOSIqv93zJ8CvrgK X-Received: by 10.98.205.69 with SMTP id o66mr8774239pfg.250.1525005362936; Sun, 29 Apr 2018 05:36:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525005362; cv=none; d=google.com; s=arc-20160816; b=kLwugZ9tYCh3aUZs0maf2/eHjKEYv9znE5QHfviMw8F1VktK8nr4KFJDbiAxHEfFWY UUZAxjCcBhS1hpmv/mZmGOnq69PlHpfCEqyzqkolaQj5sGHEgWPbgiDEXbJYkSZzJtni hWybc8HWQgnYLop83EbRPLovXsfQjLaSVmQkPBGMgRu2kzvohDsWYrNlaAbu+G/ZXKpi nAEDLqpesJkbqxaB7boVjveVmnW/iB5+L8bXhrbmK5C1ZTSBZ5QbKGC3nywfoTVoLa7h SJf11Wm+JGr9ZdxlI/Wod0Dfa4xCdqaWmJjvZeuGszE5of6HHB8klibyjYE1oYWQgzu/ oknw== 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=DeKz7J4BXn6BK9xQsYbw6O8CR3njtksLQ4Teb+u5Dxw=; b=zOelb6fC0hqje3/B2y0Wf+kmjzQcGIZMtCyv3+QbwryLXHMKBi+uCGObNlkwlzzpv4 jexn1h5Nmgm8eM4b14RLqwZreJIHGDahtzmMGFXZSXI0iYY7RVzVQh+ZU95moOHIjNqz HEw+Wrm7XfWO/vdFjSbgA0cmEzy+dv35g6pjTt6bG2r/CcKrf7DTYfdQoLm6/1w7BGUV HfRvHuPWj4Gu9oCH9myQ9r8asRH5fjr0ZPLaDeySf5QJ8L9kgA0iEHJagFRb4S1c//KD CFGc7lBtl2Rpefvu4uCWJyrE1riMOQN+JAZ0muRG+exfOTArAnMvPQHWYg8BiL5cLywd KTlA== 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 m26si5577861pfk.56.2018.04.29.05.35.49; Sun, 29 Apr 2018 05:36:02 -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 S1753496AbeD2MfW (ORCPT + 99 others); Sun, 29 Apr 2018 08:35:22 -0400 Received: from foss.arm.com ([217.140.101.70]:52442 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753221AbeD2MfU (ORCPT ); Sun, 29 Apr 2018 08:35:20 -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 9D51F1529; Sun, 29 Apr 2018 05:35:20 -0700 (PDT) Received: from localhost (unknown [10.37.8.121]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0C4D73F25D; Sun, 29 Apr 2018 05:35:20 -0700 (PDT) Date: Sun, 29 Apr 2018 14:35:16 +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, peter.maydell@linaro.org, andre.przywara@arm.com Subject: Re: [PATCH v4 08/12] KVM: arm/arm64: Check vcpu redist base before registering an iodev Message-ID: <20180429123516.GD7512@C02W217FHV2R.local> References: <1524838505-3823-1-git-send-email-eric.auger@redhat.com> <1524838505-3823-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: <1524838505-3823-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 27, 2018 at 04:15:01PM +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. 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 Acked-by: Christoffer Dall > --- > 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 cbf8f4e..1b1e07f 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 > > _______________________________________________ > kvmarm mailing list > kvmarm@lists.cs.columbia.edu > https://lists.cs.columbia.edu/mailman/listinfo/kvmarm