|
@@ -632,21 +632,22 @@ static bool vgic_its_check_id(struct vgic_its *its, u64 baser, int id)
|
|
|
int index;
|
|
|
u64 indirect_ptr;
|
|
|
gfn_t gfn;
|
|
|
+ int esz = GITS_BASER_ENTRY_SIZE(baser);
|
|
|
|
|
|
if (!(baser & GITS_BASER_INDIRECT)) {
|
|
|
phys_addr_t addr;
|
|
|
|
|
|
- if (id >= (l1_tbl_size / GITS_BASER_ENTRY_SIZE(baser)))
|
|
|
+ if (id >= (l1_tbl_size / esz))
|
|
|
return false;
|
|
|
|
|
|
- addr = BASER_ADDRESS(baser) + id * GITS_BASER_ENTRY_SIZE(baser);
|
|
|
+ addr = BASER_ADDRESS(baser) + id * esz;
|
|
|
gfn = addr >> PAGE_SHIFT;
|
|
|
|
|
|
return kvm_is_visible_gfn(its->dev->kvm, gfn);
|
|
|
}
|
|
|
|
|
|
/* calculate and check the index into the 1st level */
|
|
|
- index = id / (SZ_64K / GITS_BASER_ENTRY_SIZE(baser));
|
|
|
+ index = id / (SZ_64K / esz);
|
|
|
if (index >= (l1_tbl_size / sizeof(u64)))
|
|
|
return false;
|
|
|
|
|
@@ -670,8 +671,8 @@ static bool vgic_its_check_id(struct vgic_its *its, u64 baser, int id)
|
|
|
indirect_ptr &= GENMASK_ULL(51, 16);
|
|
|
|
|
|
/* Find the address of the actual entry */
|
|
|
- index = id % (SZ_64K / GITS_BASER_ENTRY_SIZE(baser));
|
|
|
- indirect_ptr += index * GITS_BASER_ENTRY_SIZE(baser);
|
|
|
+ index = id % (SZ_64K / esz);
|
|
|
+ indirect_ptr += index * esz;
|
|
|
gfn = indirect_ptr >> PAGE_SHIFT;
|
|
|
|
|
|
return kvm_is_visible_gfn(its->dev->kvm, gfn);
|