arm: Make sure not to shift off of the end of a uint32_t in KVM.

The methods which set or get an attribute from the virtual GIC use a
shift constant which is 32, but they store their result in a 32 bit
variable and, according to clang, are used to shift 32 bit inputs. This
is undefined behavior in terms of the shift, and will truncate off the
value regardless.

Change-Id: Ie9543ab9e6e1d5f86317a9210d220928b23ffaf8
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23129
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Ciro Santilli <ciro.santilli@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
diff --git a/src/arch/arm/kvm/gic.cc b/src/arch/arm/kvm/gic.cc
index afb0f07..12f9db5 100644
--- a/src/arch/arm/kvm/gic.cc
+++ b/src/arch/arm/kvm/gic.cc
@@ -115,8 +115,8 @@
     uint64_t reg;
 
     assert(vcpu <= KVM_ARM_IRQ_VCPU_MASK);
-    const uint32_t attr(
-        (vcpu << KVM_DEV_ARM_VGIC_CPUID_SHIFT) |
+    const uint64_t attr(
+        ((uint64_t)vcpu << KVM_DEV_ARM_VGIC_CPUID_SHIFT) |
         (offset << KVM_DEV_ARM_VGIC_OFFSET_SHIFT));
 
     kdev.getAttrPtr(group, attr, &reg);
@@ -130,8 +130,8 @@
     uint64_t reg = value;
 
     assert(vcpu <= KVM_ARM_IRQ_VCPU_MASK);
-    const uint32_t attr(
-        (vcpu << KVM_DEV_ARM_VGIC_CPUID_SHIFT) |
+    const uint64_t attr(
+        ((uint64_t)vcpu << KVM_DEV_ARM_VGIC_CPUID_SHIFT) |
         (offset << KVM_DEV_ARM_VGIC_OFFSET_SHIFT));
 
     kdev.setAttrPtr(group, attr, &reg);