Re: [PATCH 1/7] ARM: KVM: make sure the VTTBR field can be accessed from asm code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 17, 2012 at 10:12 AM, Marc Zyngier <marc.zyngier@xxxxxxx> wrote:
> Anton Romanov reports the following:
>
>   AS      arch/arm/kvm/interrupts.o
> /tmp/ccw2DnTo.s: Assembler messages:
> /tmp/ccw2DnTo.s: Error: bad immediate value for 8-bit offset (256)
>
> which is due to the vttbr field being out of reach from an ldrd
> instruction for some random configuration.
>
> Two workaround are implemented in this patch:
> - move the fields accessed by the assembly code towards the beginning
>   of the structure,
> - use an add instead of an immediate indexing to load vttbr.
>
> Reported-by: Anton Romanov <theli.ua@xxxxxxxxx>
> Signed-off-by: Marc Zyngier <marc.zyngier@xxxxxxx>
> ---
>  arch/arm/include/asm/kvm_host.h | 17 +++++++++++------
>  arch/arm/kvm/interrupts.S       |  3 ++-
>  2 files changed, 13 insertions(+), 7 deletions(-)
>
> diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h
> index 4e2cd67..149c92a 100644
> --- a/arch/arm/include/asm/kvm_host.h
> +++ b/arch/arm/include/asm/kvm_host.h
> @@ -45,6 +45,17 @@ int kvm_reset_vcpu(struct kvm_vcpu *vcpu);
>  void kvm_reset_coprocs(struct kvm_vcpu *vcpu);
>
>  struct kvm_arch {
> +       /* VTTBR value associated with below pgd and vmid */
> +       u64    vttbr;
> +
> +       /* Timer */
> +       struct arch_timer_kvm   timer;
> +
> +       /*
> +        * Anything that is not used directly from assembly code goes
> +        * here.
> +        */
> +
>         /* The VMID generation used for the virt. memory system */
>         u64    vmid_gen;
>         u32    vmid;
> @@ -52,14 +63,8 @@ struct kvm_arch {
>         /* Stage-2 page table */
>         pgd_t *pgd;
>
> -       /* VTTBR value associated with above pgd and vmid */
> -       u64    vttbr;
> -
>         /* Interrupt controller */
>         struct vgic_dist        vgic;
> -
> -       /* Timer */
> -       struct arch_timer_kvm   timer;
>  };
>
>  #define KVM_NR_MEM_OBJS     40
> diff --git a/arch/arm/kvm/interrupts.S b/arch/arm/kvm/interrupts.S
> index 775b29d..e08a985 100644
> --- a/arch/arm/kvm/interrupts.S
> +++ b/arch/arm/kvm/interrupts.S
> @@ -126,7 +126,8 @@ ENTRY(__kvm_vcpu_run)
>
>         @ Set up guest memory translation
>         ldr     r1, [r0, #VCPU_KVM]
> -       ldrd    r2, r3, [r1, #KVM_VTTBR]
> +       add     r1, r1, #KVM_VTTBR
> +       ldrd    r2, r3, [r1]
>         mcrr    p15, 6, r2, r3, c2      @ Write VTTBR
>
>         @ At this point, r0 must contain the pointer to the VCPU
> --
> 1.7.12
>
looks good, thanks.
_______________________________________________
kvmarm mailing list
kvmarm@xxxxxxxxxxxxxxxxxxxxx
https://lists.cs.columbia.edu/cucslists/listinfo/kvmarm


[Index of Archives]     [Linux KVM]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux