All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/mm: Fix typo in comment on top of page_lock
@ 2019-03-19 23:21 Julien Grall
  2019-03-19 23:21 ` [PATCH] xen: passthrough/amd: Remove unused function guest_iommu_set_base Julien Grall
  2019-03-20  7:08 ` [PATCH] x86/mm: Fix typo in comment on top of page_lock Jan Beulich
  0 siblings, 2 replies; 5+ messages in thread
From: Julien Grall @ 2019-03-19 23:21 UTC (permalink / raw)
  To: xen-devel
  Cc: Andrew Cooper, Julien Grall, Wei Liu, Jan Beulich, Roger Pau Monné

Signed-off-by: Julien Grall <julien.grall@arm.com>
---
 xen/arch/x86/mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index dbec130da0..94b82e8e5e 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -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.
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] xen: passthrough/amd: Remove unused function guest_iommu_set_base
  2019-03-19 23:21 [PATCH] x86/mm: Fix typo in comment on top of page_lock Julien Grall
@ 2019-03-19 23:21 ` Julien Grall
  2019-03-19 23:23   ` Julien Grall
  2019-03-20  7:08 ` [PATCH] x86/mm: Fix typo in comment on top of page_lock Jan Beulich
  1 sibling, 1 reply; 5+ messages in thread
From: Julien Grall @ 2019-03-19 23:21 UTC (permalink / raw)
  To: xen-devel
  Cc: Wei Liu, Suravee Suthikulpanit, Andrew Cooper, Julien Grall,
	Jan Beulich, Brian Woods, Roger Pau Monné

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.

Signed-off-by: Julien Grall <julien.grall@arm.com>
---
 xen/drivers/passthrough/amd/iommu_guest.c     | 23 -----------------------
 xen/include/asm-x86/hvm/svm/amd-iommu-proto.h |  1 -
 2 files changed, 24 deletions(-)

diff --git a/xen/drivers/passthrough/amd/iommu_guest.c b/xen/drivers/passthrough/amd/iommu_guest.c
index 96175bb9ac..dbb7526025 100644
--- a/xen/drivers/passthrough/amd/iommu_guest.c
+++ b/xen/drivers/passthrough/amd/iommu_guest.c
@@ -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)
 {
diff --git a/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h b/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h
index c5697565d6..0129ffe5a9 100644
--- a/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h
+++ b/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h
@@ -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)
 {
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] xen: passthrough/amd: Remove unused function guest_iommu_set_base
  2019-03-19 23:21 ` [PATCH] xen: passthrough/amd: Remove unused function guest_iommu_set_base Julien Grall
@ 2019-03-19 23:23   ` Julien Grall
  0 siblings, 0 replies; 5+ messages in thread
From: Julien Grall @ 2019-03-19 23:23 UTC (permalink / raw)
  To: xen-devel
  Cc: Wei Liu, Suravee Suthikulpanit, Andrew Cooper, Jan Beulich,
	Brian Woods, Roger Pau Monné

Hi,

Hmmm, I mistakenly resent this patch. Please ignore this version and 
review <20190319232055.23993-1-julien.grall@arm.com>

Sorry for the noise.

Cheers,

On 3/19/19 11:21 PM, Julien Grall wrote:
> 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.
> 
> Signed-off-by: Julien Grall <julien.grall@arm.com>
> ---
>   xen/drivers/passthrough/amd/iommu_guest.c     | 23 -----------------------
>   xen/include/asm-x86/hvm/svm/amd-iommu-proto.h |  1 -
>   2 files changed, 24 deletions(-)
> 
> diff --git a/xen/drivers/passthrough/amd/iommu_guest.c b/xen/drivers/passthrough/amd/iommu_guest.c
> index 96175bb9ac..dbb7526025 100644
> --- a/xen/drivers/passthrough/amd/iommu_guest.c
> +++ b/xen/drivers/passthrough/amd/iommu_guest.c
> @@ -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)
>   {
> diff --git a/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h b/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h
> index c5697565d6..0129ffe5a9 100644
> --- a/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h
> +++ b/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h
> @@ -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)
>   {
> 

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] x86/mm: Fix typo in comment on top of page_lock
  2019-03-19 23:21 [PATCH] x86/mm: Fix typo in comment on top of page_lock Julien Grall
  2019-03-19 23:21 ` [PATCH] xen: passthrough/amd: Remove unused function guest_iommu_set_base Julien Grall
@ 2019-03-20  7:08 ` Jan Beulich
  2019-03-21 18:37   ` Julien Grall
  1 sibling, 1 reply; 5+ messages in thread
From: Jan Beulich @ 2019-03-20  7:08 UTC (permalink / raw)
  To: julien.grall; +Cc: andrew.cooper3, wei.liu2, xen-devel, roger.pau

>>> Julien Grall <julien.grall@arm.com> 03/20/19 12:21 AM >>>
>Signed-off-by: Julien Grall <julien.grall@arm.com>

Acked-by: Jan Beulich <jbeulich@suse.com>

>--- a/xen/arch/x86/mm.c
>+++ b/xen/arch/x86/mm.c
>@@ -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
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] x86/mm: Fix typo in comment on top of page_lock
  2019-03-20  7:08 ` [PATCH] x86/mm: Fix typo in comment on top of page_lock Jan Beulich
@ 2019-03-21 18:37   ` Julien Grall
  0 siblings, 0 replies; 5+ messages in thread
From: Julien Grall @ 2019-03-21 18:37 UTC (permalink / raw)
  To: Jan Beulich; +Cc: andrew.cooper3, wei.liu2, xen-devel, roger.pau

Hi,

On 3/20/19 7:08 AM, Jan Beulich wrote:
>>>> Julien Grall <julien.grall@arm.com> 03/20/19 12:21 AM >>>
>> Signed-off-by: Julien Grall <julien.grall@arm.com>
> 
> Acked-by: Jan Beulich <jbeulich@suse.com>
> 
>> --- a/xen/arch/x86/mm.c
>> +++ b/xen/arch/x86/mm.c
>> @@ -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,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-03-21 18:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-19 23:21 [PATCH] x86/mm: Fix typo in comment on top of page_lock Julien Grall
2019-03-19 23:21 ` [PATCH] xen: passthrough/amd: Remove unused function guest_iommu_set_base Julien Grall
2019-03-19 23:23   ` Julien Grall
2019-03-20  7:08 ` [PATCH] x86/mm: Fix typo in comment on top of page_lock Jan Beulich
2019-03-21 18:37   ` Julien Grall

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.