Skip to contentSkip to conversation

x86/mm: Fix typo in comment on top of page_lock

PATCH In review Julien Grall 2 participants 5 messages Mar 19, 2019 – Mar 21, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/mm: Fix typo in comment on top of page_lock

---
 xen/arch/x86/mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/x86/mm.c +1 -1
index dbec130da0..94b82e8e5e 100644
@@ -2003,7 +2003,7 @@ static int free_l4_table(struct page_info *page)
  * 2. We never call _put_page_type() on a page while holding its page lock.
  *
  * Add a check to debug builds to catch any violations of these
- * assumpitons.
+ * assumptions.
  *
  * NB that if we find valid, safe reasons to hold two page locks at
  * once, these checks will need to be adjusted.
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw

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
index 96175bb9ac..dbb7526025 100644
@@ -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
index c5697565d6..0129ffe5a9 100644
@@ -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
#2 lore raw

Re: [PATCH] xen: passthrough/amd: Remove unused function guest_iommu_set_base

Hi,

Hmmm, I mistakenly resent this patch. Please ignore this version and review <[email protected]>

Sorry for the noise.

Cheers,

Quoted 59 lines · Julien Grall

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
index 96175bb9ac..dbb7526025 100644
@@ -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
index c5697565d6..0129ffe5a9 100644
@@ -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 · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v1 1/1
#3 lore raw
In reply to Julien Grall
Quoted 2 lines
Quoted 1 line
Quoted 1 line

Julien Grall <[email protected]> 03/20/19 12:21 AM >>>

xen/arch/x86/mm.c static int free_l4_table(struct page_info *page) · line 2006

Quoted 8 lines
xen/arch/x86/mm.c +1 -1
@@ -2003,7 +2003,7 @@ static int free_l4_table(struct page_info *page)
 * 2. We never call _put_page_type() on a page while holding its page lock.
 *
 * Add a check to debug builds to catch any violations of these
- * assumpitons.
+ * assumptions.

Would you mind also doing away with the unnecessary line split at the same time? The sentence fits on a single line without going to or beyond 80 characters.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#4 lore raw

Hi,

Quoted 5 lines · Jan Beulich
Quoted 2 lines
Quoted 1 line
Quoted 1 line

Julien Grall <[email protected]> 03/20/19 12:21 AM >>>

Quoted 11 lines

xen/arch/x86/mm.c static int free_l4_table(struct page_info *page) · line 2006

Quoted 8 lines
xen/arch/x86/mm.c +1 -1
@@ -2003,7 +2003,7 @@ static int free_l4_table(struct page_info *page)
 * 2. We never call _put_page_type() on a page while holding its page lock.
 *
 * Add a check to debug builds to catch any violations of these
- * assumpitons.
+ * assumptions.

Would you mind also doing away with the unnecessary line split at the same time? The sentence fits on a single line without going to or beyond 80 characters.

Sure. I have removed the line split and committed the patch.

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel