public inbox for kvmarm@lists.cs.columbia.edu
 help / color / mirror / Atom feed
From: Auger Eric <eric.auger@redhat.com>
To: Christoffer Dall <cdall@linaro.org>,
	kvmarm@lists.cs.columbia.edu,
	linux-arm-kernel@lists.infradead.org
Cc: Marc Zyngier <marc.zyngier@arm.com>, kvm@vger.kernel.org
Subject: Re: [PATCH 5/8] KVM: arm/arm64: Slightly rework kvm_vgic_addr
Date: Mon, 8 May 2017 18:19:05 +0200	[thread overview]
Message-ID: <1b0d1242-a4af-dc2e-5e87-dca0ddc2300e@redhat.com> (raw)
In-Reply-To: <20170508115454.5075-6-cdall@linaro.org>

Hi Christoffer,

On 08/05/2017 13:54, Christoffer Dall wrote:
> As we are about to handle setting the address for the redistributor base
> region separately from some of the other base addresses, let's rework
> this function to leave a little more room for being flexible in what
> each type of base address does.
> 
> Signed-off-by: Christoffer Dall <cdall@linaro.org>
Reviewed-by: Eric Auger <eric.auger@redhat.com>

Thanks

Eric

> ---
>  virt/kvm/arm/vgic/vgic-kvm-device.c | 22 +++++++++++++---------
>  1 file changed, 13 insertions(+), 9 deletions(-)
> 
> diff --git a/virt/kvm/arm/vgic/vgic-kvm-device.c b/virt/kvm/arm/vgic/vgic-kvm-device.c
> index d48743c..69ccfd5 100644
> --- a/virt/kvm/arm/vgic/vgic-kvm-device.c
> +++ b/virt/kvm/arm/vgic/vgic-kvm-device.c
> @@ -37,6 +37,14 @@ int vgic_check_ioaddr(struct kvm *kvm, phys_addr_t *ioaddr,
>  	return 0;
>  }
>  
> +static int vgic_check_type(struct kvm *kvm, int type_needed)
> +{
> +	if (kvm->arch.vgic.vgic_model != type_needed)
> +		return -ENODEV;
> +	else
> +		return 0;
> +}
> +
>  /**
>   * kvm_vgic_addr - set or get vgic VM base addresses
>   * @kvm:   pointer to the vm struct
> @@ -57,40 +65,36 @@ int kvm_vgic_addr(struct kvm *kvm, unsigned long type, u64 *addr, bool write)
>  {
>  	int r = 0;
>  	struct vgic_dist *vgic = &kvm->arch.vgic;
> -	int type_needed;
>  	phys_addr_t *addr_ptr, alignment;
>  
>  	mutex_lock(&kvm->lock);
>  	switch (type) {
>  	case KVM_VGIC_V2_ADDR_TYPE_DIST:
> -		type_needed = KVM_DEV_TYPE_ARM_VGIC_V2;
> +		r = vgic_check_type(kvm, KVM_DEV_TYPE_ARM_VGIC_V2);
>  		addr_ptr = &vgic->vgic_dist_base;
>  		alignment = SZ_4K;
>  		break;
>  	case KVM_VGIC_V2_ADDR_TYPE_CPU:
> -		type_needed = KVM_DEV_TYPE_ARM_VGIC_V2;
> +		r = vgic_check_type(kvm, KVM_DEV_TYPE_ARM_VGIC_V2);
>  		addr_ptr = &vgic->vgic_cpu_base;
>  		alignment = SZ_4K;
>  		break;
>  	case KVM_VGIC_V3_ADDR_TYPE_DIST:
> -		type_needed = KVM_DEV_TYPE_ARM_VGIC_V3;
> +		r = vgic_check_type(kvm, KVM_DEV_TYPE_ARM_VGIC_V3);
>  		addr_ptr = &vgic->vgic_dist_base;
>  		alignment = SZ_64K;
>  		break;
>  	case KVM_VGIC_V3_ADDR_TYPE_REDIST:
> -		type_needed = KVM_DEV_TYPE_ARM_VGIC_V3;
> +		r = vgic_check_type(kvm, KVM_DEV_TYPE_ARM_VGIC_V3);
>  		addr_ptr = &vgic->vgic_redist_base;
>  		alignment = SZ_64K;
>  		break;
>  	default:
>  		r = -ENODEV;
> -		goto out;
>  	}
>  
> -	if (vgic->vgic_model != type_needed) {
> -		r = -ENODEV;
> +	if (r)
>  		goto out;
> -	}
>  
>  	if (write) {
>  		r = vgic_check_ioaddr(kvm, addr_ptr, *addr, alignment);
> 

  reply	other threads:[~2017-05-08 16:19 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-08 11:54 [PATCH 0/8] Fixes to v7 of the vITS save/restore series Christoffer Dall
2017-05-08 11:54 ` [PATCH 1/8] KVM: arm/arm64: Clarification and relaxation to ITS save/restore ABI Christoffer Dall
2017-05-08 16:03   ` Auger Eric
2017-05-08 11:54 ` [PATCH 2/8] KVM: arm/arm64: vgic: Rename kvm_vgic_vcpu_init to kvm_vgic_vcpu_enable Christoffer Dall
2017-05-08 16:03   ` Auger Eric
2017-05-08 11:54 ` [PATCH 3/8] KVM: arm/arm64: Refactor vgic_register_redist_iodevs Christoffer Dall
2017-05-08 16:03   ` Auger Eric
2017-05-08 18:38     ` Christoffer Dall
2017-05-08 11:54 ` [PATCH 4/8] KVM: arm/arm64: Make vgic_v3_check_base more broadly usable Christoffer Dall
2017-05-08 16:13   ` Auger Eric
2017-05-08 17:18     ` Christoffer Dall
2017-05-08 17:39       ` Auger Eric
2017-05-08 19:10         ` Christoffer Dall
2017-05-08 11:54 ` [PATCH 5/8] KVM: arm/arm64: Slightly rework kvm_vgic_addr Christoffer Dall
2017-05-08 16:19   ` Auger Eric [this message]
2017-05-08 11:54 ` [PATCH 6/8] KVM: arm/arm64: Register iodevs when setting redist base and creating VCPUs Christoffer Dall
2017-05-08 17:09   ` Auger Eric
2017-05-08 17:20     ` Christoffer Dall
2017-05-08 11:54 ` [PATCH 7/8] KVM: arm/arm64: Register ITS iodev when setting base address Christoffer Dall
2017-05-08 17:12   ` Auger Eric
2017-05-08 17:41   ` Marc Zyngier
2017-05-08 19:21     ` Christoffer Dall
2017-05-08 11:54 ` [PATCH 8/8] KVM: arm/arm64: vgic-its: Cleanup after failed ITT restore Christoffer Dall
2017-05-08 17:20   ` Auger Eric
2017-05-08 12:49 ` [PATCH 9/8] KVM: arm/arm64: Don't call map_resources when restoring ITS tables Christoffer Dall
2017-05-08 17:22   ` Auger Eric

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1b0d1242-a4af-dc2e-5e87-dca0ddc2300e@redhat.com \
    --to=eric.auger@redhat.com \
    --cc=cdall@linaro.org \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=marc.zyngier@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox