lkml.org 
[lkml]   [2018]   [May]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v8 09/13] KVM: arm/arm64: Check vcpu redist base before registering an iodev
    Date
    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_init().

    Signed-off-by: Eric Auger <eric.auger@redhat.com>
    Acked-by: Christoffer Dall <christoffer.dall@arm.com>

    ---

    v4 -> v5:
    - added Christoffer's A-b
    ---
    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 272af97..2673efc 100644
    --- a/virt/kvm/arm/vgic/vgic-init.c
    +++ b/virt/kvm/arm/vgic/vgic-init.c
    @@ -199,6 +199,9 @@ int kvm_vgic_vcpu_init(struct kvm_vcpu *vcpu)
    int ret = 0;
    int i;

    + vgic_cpu->rd_iodev.base_addr = VGIC_ADDR_UNDEF;
    + vgic_cpu->sgi_iodev.base_addr = VGIC_ADDR_UNDEF;
    +
    INIT_LIST_HEAD(&vgic_cpu->ap_list_head);
    spin_lock_init(&vgic_cpu->ap_list_lock);

    diff --git a/virt/kvm/arm/vgic/vgic-mmio-v3.c b/virt/kvm/arm/vgic/vgic-mmio-v3.c
    index 3dbc057..1c6c535 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
    \
     
     \ /
      Last update: 2018-05-22 09:58    [W:3.210 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site