On vgic_dist_destroy(), the addresses are not reset. However for
kvm selftest purpose this would allow to continue the test execution
even after a failure when running KVM_RUN. So let's reset the
base addresses.
Signed-off-by: Eric Auger <[email protected]>
---
arch/arm64/kvm/vgic/vgic-init.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/kvm/vgic/vgic-init.c b/arch/arm64/kvm/vgic/vgic-init.c
index 32e32d67a127..6147bed56b1b 100644
--- a/arch/arm64/kvm/vgic/vgic-init.c
+++ b/arch/arm64/kvm/vgic/vgic-init.c
@@ -335,14 +335,16 @@ static void kvm_vgic_dist_destroy(struct kvm *kvm)
kfree(dist->spis);
dist->spis = NULL;
dist->nr_spis = 0;
+ dist->vgic_dist_base = VGIC_ADDR_UNDEF;
- if (kvm->arch.vgic.vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3) {
+ if (dist->vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3) {
list_for_each_entry_safe(rdreg, next, &dist->rd_regions, list) {
list_del(&rdreg->list);
kfree(rdreg);
}
INIT_LIST_HEAD(&dist->rd_regions);
- }
+ } else
+ kvm->arch.vgic.vgic_cpu_base = VGIC_ADDR_UNDEF;
if (vgic_has_its(kvm))
vgic_lpi_translation_cache_destroy(kvm);
@@ -362,6 +364,7 @@ void kvm_vgic_vcpu_destroy(struct kvm_vcpu *vcpu)
vgic_flush_pending_lpis(vcpu);
INIT_LIST_HEAD(&vgic_cpu->ap_list_head);
+ vgic_cpu->rd_iodev.base_addr = VGIC_ADDR_UNDEF;
}
/* To be called with kvm->lock held */
--
2.21.3
On Sat, 12 Dec 2020 18:50:05 +0000,
Eric Auger <[email protected]> wrote:
>
> On vgic_dist_destroy(), the addresses are not reset. However for
> kvm selftest purpose this would allow to continue the test execution
> even after a failure when running KVM_RUN. So let's reset the
> base addresses.
>
> Signed-off-by: Eric Auger <[email protected]>
> ---
> arch/arm64/kvm/vgic/vgic-init.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm64/kvm/vgic/vgic-init.c b/arch/arm64/kvm/vgic/vgic-init.c
> index 32e32d67a127..6147bed56b1b 100644
> --- a/arch/arm64/kvm/vgic/vgic-init.c
> +++ b/arch/arm64/kvm/vgic/vgic-init.c
> @@ -335,14 +335,16 @@ static void kvm_vgic_dist_destroy(struct kvm *kvm)
> kfree(dist->spis);
> dist->spis = NULL;
> dist->nr_spis = 0;
> + dist->vgic_dist_base = VGIC_ADDR_UNDEF;
>
> - if (kvm->arch.vgic.vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3) {
> + if (dist->vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3) {
> list_for_each_entry_safe(rdreg, next, &dist->rd_regions, list) {
> list_del(&rdreg->list);
> kfree(rdreg);
> }
> INIT_LIST_HEAD(&dist->rd_regions);
> - }
> + } else
> + kvm->arch.vgic.vgic_cpu_base = VGIC_ADDR_UNDEF;
Since you have converted the hunk above to use dist->, you could do
the same thing here. And the coding style dictates that you need {} on
the else side as well.
>
> if (vgic_has_its(kvm))
> vgic_lpi_translation_cache_destroy(kvm);
> @@ -362,6 +364,7 @@ void kvm_vgic_vcpu_destroy(struct kvm_vcpu *vcpu)
> vgic_flush_pending_lpis(vcpu);
>
> INIT_LIST_HEAD(&vgic_cpu->ap_list_head);
> + vgic_cpu->rd_iodev.base_addr = VGIC_ADDR_UNDEF;
> }
>
> /* To be called with kvm->lock held */
> --
> 2.21.3
>
>
Thanks,
M.
--
Without deviation from the norm, progress is not possible.
Hi Marc,
On 12/28/20 4:41 PM, Marc Zyngier wrote:
> On Sat, 12 Dec 2020 18:50:05 +0000,
> Eric Auger <[email protected]> wrote:
>>
>> On vgic_dist_destroy(), the addresses are not reset. However for
>> kvm selftest purpose this would allow to continue the test execution
>> even after a failure when running KVM_RUN. So let's reset the
>> base addresses.
>>
>> Signed-off-by: Eric Auger <[email protected]>
>> ---
>> arch/arm64/kvm/vgic/vgic-init.c | 7 +++++--
>> 1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/arm64/kvm/vgic/vgic-init.c b/arch/arm64/kvm/vgic/vgic-init.c
>> index 32e32d67a127..6147bed56b1b 100644
>> --- a/arch/arm64/kvm/vgic/vgic-init.c
>> +++ b/arch/arm64/kvm/vgic/vgic-init.c
>> @@ -335,14 +335,16 @@ static void kvm_vgic_dist_destroy(struct kvm *kvm)
>> kfree(dist->spis);
>> dist->spis = NULL;
>> dist->nr_spis = 0;
>> + dist->vgic_dist_base = VGIC_ADDR_UNDEF;
>>
>> - if (kvm->arch.vgic.vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3) {
>> + if (dist->vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3) {
>> list_for_each_entry_safe(rdreg, next, &dist->rd_regions, list) {
>> list_del(&rdreg->list);
>> kfree(rdreg);
>> }
>> INIT_LIST_HEAD(&dist->rd_regions);
>> - }
>> + } else
>> + kvm->arch.vgic.vgic_cpu_base = VGIC_ADDR_UNDEF;
>
> Since you have converted the hunk above to use dist->, you could do
> the same thing here. And the coding style dictates that you need {} on
> the else side as well.
sure
Thanks
Eric
>
>>
>> if (vgic_has_its(kvm))
>> vgic_lpi_translation_cache_destroy(kvm);
>> @@ -362,6 +364,7 @@ void kvm_vgic_vcpu_destroy(struct kvm_vcpu *vcpu)
>> vgic_flush_pending_lpis(vcpu);
>>
>> INIT_LIST_HEAD(&vgic_cpu->ap_list_head);
>> + vgic_cpu->rd_iodev.base_addr = VGIC_ADDR_UNDEF;
>> }
>>
>> /* To be called with kvm->lock held */
>> --
>> 2.21.3
>>
>>
>
> Thanks,
>
> M.
>