diff options
author | Eric Auger <eric.auger@redhat.com> | 2017-01-31 08:36:14 -0500 |
---|---|---|
committer | Christoffer Dall <cdall@linaro.org> | 2017-05-08 08:38:34 -0400 |
commit | dceff7025851405412e1a180ddd0cf79c7cbc1d8 (patch) | |
tree | 9faade2d226f785cb4382ab7f290d2a5b34624a9 | |
parent | ea1ad53e1e31a32dcbeae61b8d3d01cccedcffc5 (diff) |
KVM: arm64: vgic-its: vgic_its_check_id returns the entry's GPA
As vgic_its_check_id() computes the device/collection entry's
GPA, let's return it so that new callers can retrieve it easily.
Signed-off-by: Eric Auger <eric.auger@redhat.com>
Acked-by: Christoffer Dall <cdall@linaro.org>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
-rw-r--r-- | virt/kvm/arm/vgic/vgic-its.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/virt/kvm/arm/vgic/vgic-its.c b/virt/kvm/arm/vgic/vgic-its.c index 5523f0a1cddc..90afc838f138 100644 --- a/virt/kvm/arm/vgic/vgic-its.c +++ b/virt/kvm/arm/vgic/vgic-its.c | |||
@@ -694,7 +694,8 @@ static int vgic_its_cmd_handle_movi(struct kvm *kvm, struct vgic_its *its, | |||
694 | * is actually valid (covered by a memslot and guest accessible). | 694 | * is actually valid (covered by a memslot and guest accessible). |
695 | * For this we have to read the respective first level entry. | 695 | * For this we have to read the respective first level entry. |
696 | */ | 696 | */ |
697 | static bool vgic_its_check_id(struct vgic_its *its, u64 baser, u32 id) | 697 | static bool vgic_its_check_id(struct vgic_its *its, u64 baser, u32 id, |
698 | gpa_t *eaddr) | ||
698 | { | 699 | { |
699 | int l1_tbl_size = GITS_BASER_NR_PAGES(baser) * SZ_64K; | 700 | int l1_tbl_size = GITS_BASER_NR_PAGES(baser) * SZ_64K; |
700 | u64 indirect_ptr, type = GITS_BASER_TYPE(baser); | 701 | u64 indirect_ptr, type = GITS_BASER_TYPE(baser); |
@@ -725,6 +726,8 @@ static bool vgic_its_check_id(struct vgic_its *its, u64 baser, u32 id) | |||
725 | addr = BASER_ADDRESS(baser) + id * esz; | 726 | addr = BASER_ADDRESS(baser) + id * esz; |
726 | gfn = addr >> PAGE_SHIFT; | 727 | gfn = addr >> PAGE_SHIFT; |
727 | 728 | ||
729 | if (eaddr) | ||
730 | *eaddr = addr; | ||
728 | return kvm_is_visible_gfn(its->dev->kvm, gfn); | 731 | return kvm_is_visible_gfn(its->dev->kvm, gfn); |
729 | } | 732 | } |
730 | 733 | ||
@@ -757,6 +760,8 @@ static bool vgic_its_check_id(struct vgic_its *its, u64 baser, u32 id) | |||
757 | indirect_ptr += index * esz; | 760 | indirect_ptr += index * esz; |
758 | gfn = indirect_ptr >> PAGE_SHIFT; | 761 | gfn = indirect_ptr >> PAGE_SHIFT; |
759 | 762 | ||
763 | if (eaddr) | ||
764 | *eaddr = indirect_ptr; | ||
760 | return kvm_is_visible_gfn(its->dev->kvm, gfn); | 765 | return kvm_is_visible_gfn(its->dev->kvm, gfn); |
761 | } | 766 | } |
762 | 767 | ||
@@ -766,7 +771,7 @@ static int vgic_its_alloc_collection(struct vgic_its *its, | |||
766 | { | 771 | { |
767 | struct its_collection *collection; | 772 | struct its_collection *collection; |
768 | 773 | ||
769 | if (!vgic_its_check_id(its, its->baser_coll_table, coll_id)) | 774 | if (!vgic_its_check_id(its, its->baser_coll_table, coll_id, NULL)) |
770 | return E_ITS_MAPC_COLLECTION_OOR; | 775 | return E_ITS_MAPC_COLLECTION_OOR; |
771 | 776 | ||
772 | collection = kzalloc(sizeof(*collection), GFP_KERNEL); | 777 | collection = kzalloc(sizeof(*collection), GFP_KERNEL); |
@@ -939,7 +944,7 @@ static int vgic_its_cmd_handle_mapd(struct kvm *kvm, struct vgic_its *its, | |||
939 | gpa_t itt_addr = its_cmd_get_ittaddr(its_cmd); | 944 | gpa_t itt_addr = its_cmd_get_ittaddr(its_cmd); |
940 | struct its_device *device; | 945 | struct its_device *device; |
941 | 946 | ||
942 | if (!vgic_its_check_id(its, its->baser_device_table, device_id)) | 947 | if (!vgic_its_check_id(its, its->baser_device_table, device_id, NULL)) |
943 | return E_ITS_MAPD_DEVICE_OOR; | 948 | return E_ITS_MAPD_DEVICE_OOR; |
944 | 949 | ||
945 | if (valid && num_eventid_bits > VITS_TYPER_IDBITS) | 950 | if (valid && num_eventid_bits > VITS_TYPER_IDBITS) |