xen: passthrough/amd: Remove unused function guest_iommu_set_base
PATCH 1/1 xen: passthrough/amd: Remove unused function guest_iommu_set_base
The function is unused and could potentially lead a to trigger the BUG_ON() in p2m_change_type_one if misused as the p2m type is not sanitized.
So remove it.
--- xen/drivers/passthrough/amd/iommu_guest.c | 23 ----------------------- xen/include/asm-x86/hvm/svm/amd-iommu-proto.h | 1 - 2 files changed, 24 deletions(-)
xen/drivers/passthrough/amd/iommu_guest.c +0 -23
@@ -805,29 +805,6 @@ static int guest_iommu_mmio_write(struct vcpu *v, unsigned long addr,return X86EMUL_OKAY ; } -int guest_iommu_set_base (struct domain *d,uint64_t base) -{ -p2m_type_t t; -struct guest_iommu *iommu =domain_iommu (d); - -if ( !iommu ) -return -EACCES ; - - iommu->mmio_base = base; - base >>=PAGE_SHIFT ; - -for (int i =0 ; i <IOMMU_MMIO_PAGE_NR ; i++ ) - { -unsigned long gfn = base + i; - -get_gfn_query (d, gfn, &t); -p2m_change_type_one (d, gfn, t, p2m_mmio_dm); -put_gfn (d, gfn); - } - -return 0 ; -} -/* Initialize mmio read only bits */ static void guest_iommu_reg_init (struct guest_iommu *iommu) {
xen/include/asm-x86/hvm/svm/amd-iommu-proto.h +0 -1
@@ -142,7 +142,6 @@ void guest_iommu_add_ppr_log(struct domain *d, u32 entry[]);void guest_iommu_add_event_log (struct domain *d,u32 entry[]);int guest_iommu_init (struct domain * d);void guest_iommu_destroy (struct domain *d); -int guest_iommu_set_base (struct domain *d,uint64_t base);static inline u32 get_field_from_reg_u32 (u32 reg_value,u32 mask,u32 shift) {
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Julien Grall <[email protected]> 03/20/19 12:21 AM >>>
The function is unused and could potentially lead a to trigger the
BUG_ON()inp2m_change_type_oneif misused as the p2m type is not sanitized.So remove it.
I don't think I agree - the entire file is effectively unused, and hence removal should perhaps be an all-or-nothing action. But let's see what the maintainers say.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Hi,
Quoted 9 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Julien Grall <[email protected]> 03/20/19 12:21 AM >>>
The function is unused and could potentially lead a to trigger the
BUG_ON()inp2m_change_type_oneif misused as the p2m type is not sanitized.So remove it.
I don't think I agree - the entire file is effectively unused, and hence removal should perhaps be an all-or-nothing action. But let's see what the maintainers say.
Based on Andrew comments, I will dropped the patch for now.
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 7 lines · Julien Grall
The function is unused and could potentially lead a to trigger the
BUG_ON()inp2m_change_type_oneif misused as the p2m type is not sanitized.So remove it.
Signed-off-by Julien Grall <[email protected]>
Either the entire file goes, or this function stays. It definitely isn't production ready yet, as noted in my post-commit notes in
https://lists.xenproject.org/archives/html/xen-devel/2018-11/msg02356.html
However, this functionality is going to be necessary in the future. It is probably easier just to leave it as-is.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Hi Andrew,
Quoted 5 lines · Andrew Cooper
Quoted 4 lines · Julien Grall
The function is unused and could potentially lead a to trigger the
BUG_ON()inp2m_change_type_oneif misused as the p2m type is not sanitized.
Quoted 7 lines
Quoted 3 lines
So remove it.
Signed-off-by Julien Grall <[email protected]>Either the entire file goes, or this function stays. It definitely isn't production ready yet, as noted in my post-commit notes in
https://lists.xenproject.org/archives/html/xen-devel/2018-11/msg02356.html
I should have probably looked at the commit logs first :). I found it while looking whether we can re-use p2m_change_type_one on Arm too.
Quoted 3 lines
However, this functionality is going to be necessary in the future. It is probably easier just to leave it as-is.
I will drop the patch then.
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel