diff mbox series

[XEN,4/7] x86/grant: switch included header to make declarations visible

Message ID ec3179df569d3e2b392360539bddfb3adc726a5e.1696232393.git.nicola.vetrini@bugseng.com (mailing list archive)
State Superseded
Headers show
Series Fix or deviate various instances of missing declarations | expand

Commit Message

Nicola Vetrini Oct. 2, 2023, 7:49 a.m. UTC
The declarations for {create,replace}_grant_p2m_mapping are
not visible when these functions are defined, therefore the right
header needs to be included to allow them to be visible.

Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
---
 xen/arch/x86/hvm/grant_table.c             | 3 +--
 xen/arch/x86/include/asm/hvm/grant_table.h | 2 ++
 2 files changed, 3 insertions(+), 2 deletions(-)

Comments

Stefano Stabellini Oct. 2, 2023, 10:42 p.m. UTC | #1
On Mon, 2 Oct 2023, Nicola Vetrini wrote:
> The declarations for {create,replace}_grant_p2m_mapping are
> not visible when these functions are defined, therefore the right
> header needs to be included to allow them to be visible.
> 
> Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
> ---
>  xen/arch/x86/hvm/grant_table.c             | 3 +--
>  xen/arch/x86/include/asm/hvm/grant_table.h | 2 ++
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/arch/x86/hvm/grant_table.c b/xen/arch/x86/hvm/grant_table.c
> index 30d51d54a949..afe449d8882c 100644
> --- a/xen/arch/x86/hvm/grant_table.c
> +++ b/xen/arch/x86/hvm/grant_table.c
> @@ -9,8 +9,7 @@
>  
>  #include <xen/types.h>
>  
> -#include <public/grant_table.h>
> -
> +#include <asm/hvm/grant_table.h>
>  #include <asm/p2m.h>

This makes sense...


>  int create_grant_p2m_mapping(uint64_t addr, mfn_t frame,
> diff --git a/xen/arch/x86/include/asm/hvm/grant_table.h b/xen/arch/x86/include/asm/hvm/grant_table.h
> index 33c1da1a25f3..576aeb50adf4 100644
> --- a/xen/arch/x86/include/asm/hvm/grant_table.h
> +++ b/xen/arch/x86/include/asm/hvm/grant_table.h
> @@ -10,6 +10,8 @@
>  #ifndef __X86_HVM_GRANT_TABLE_H__
>  #define __X86_HVM_GRANT_TABLE_H__
>  
> +#include <asm/paging.h>

... but I don't understand this one. It doesn't look like
asm/hvm/grant_table.h actually needs asm/paging.h ? Maybe it should be
included in xen/arch/x86/hvm/grant_table.c instead ?


>  #ifdef CONFIG_HVM
>  
>  int create_grant_p2m_mapping(uint64_t addr, mfn_t frame,
> -- 
> 2.34.1
>
Nicola Vetrini Oct. 3, 2023, 7 a.m. UTC | #2
On 03/10/2023 00:42, Stefano Stabellini wrote:
> On Mon, 2 Oct 2023, Nicola Vetrini wrote:
>> The declarations for {create,replace}_grant_p2m_mapping are
>> not visible when these functions are defined, therefore the right
>> header needs to be included to allow them to be visible.
>> 
>> Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
>> ---
>>  xen/arch/x86/hvm/grant_table.c             | 3 +--
>>  xen/arch/x86/include/asm/hvm/grant_table.h | 2 ++
>>  2 files changed, 3 insertions(+), 2 deletions(-)
>> 
>> diff --git a/xen/arch/x86/hvm/grant_table.c 
>> b/xen/arch/x86/hvm/grant_table.c
>> index 30d51d54a949..afe449d8882c 100644
>> --- a/xen/arch/x86/hvm/grant_table.c
>> +++ b/xen/arch/x86/hvm/grant_table.c
>> @@ -9,8 +9,7 @@
>> 
>>  #include <xen/types.h>
>> 
>> -#include <public/grant_table.h>
>> -
>> +#include <asm/hvm/grant_table.h>
>>  #include <asm/p2m.h>
> 
> This makes sense...
> 
> 
>>  int create_grant_p2m_mapping(uint64_t addr, mfn_t frame,
>> diff --git a/xen/arch/x86/include/asm/hvm/grant_table.h 
>> b/xen/arch/x86/include/asm/hvm/grant_table.h
>> index 33c1da1a25f3..576aeb50adf4 100644
>> --- a/xen/arch/x86/include/asm/hvm/grant_table.h
>> +++ b/xen/arch/x86/include/asm/hvm/grant_table.h
>> @@ -10,6 +10,8 @@
>>  #ifndef __X86_HVM_GRANT_TABLE_H__
>>  #define __X86_HVM_GRANT_TABLE_H__
>> 
>> +#include <asm/paging.h>
> 
> ... but I don't understand this one. It doesn't look like
> asm/hvm/grant_table.h actually needs asm/paging.h ? Maybe it should be
> included in xen/arch/x86/hvm/grant_table.c instead ?
> 
> 
>>  #ifdef CONFIG_HVM
>> 
>>  int create_grant_p2m_mapping(uint64_t addr, mfn_t frame,
>> --
>> 2.34.1
>> 

See this thread [1] for more context. There was no response, so I went 
for the route that
made more sense to me. I guess you could say that only <xen/mm-frame.h> 
is actually needed
to get a definition of mfn_t, but I put <asm/paging.h> as in the 
<asm/grant_table.h> header.

[1] 
https://lore.kernel.org/xen-devel/a4b6710b66ed05292388ac6882b940ec@bugseng.com/
Stefano Stabellini Oct. 3, 2023, 8:41 p.m. UTC | #3
On Tue, 3 Oct 2023, Nicola Vetrini wrote:
> On 03/10/2023 00:42, Stefano Stabellini wrote:
> > On Mon, 2 Oct 2023, Nicola Vetrini wrote:
> > > The declarations for {create,replace}_grant_p2m_mapping are
> > > not visible when these functions are defined, therefore the right
> > > header needs to be included to allow them to be visible.
> > > 
> > > Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
> > > ---
> > >  xen/arch/x86/hvm/grant_table.c             | 3 +--
> > >  xen/arch/x86/include/asm/hvm/grant_table.h | 2 ++
> > >  2 files changed, 3 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/xen/arch/x86/hvm/grant_table.c
> > > b/xen/arch/x86/hvm/grant_table.c
> > > index 30d51d54a949..afe449d8882c 100644
> > > --- a/xen/arch/x86/hvm/grant_table.c
> > > +++ b/xen/arch/x86/hvm/grant_table.c
> > > @@ -9,8 +9,7 @@
> > > 
> > >  #include <xen/types.h>
> > > 
> > > -#include <public/grant_table.h>
> > > -
> > > +#include <asm/hvm/grant_table.h>
> > >  #include <asm/p2m.h>
> > 
> > This makes sense...
> > 
> > 
> > >  int create_grant_p2m_mapping(uint64_t addr, mfn_t frame,
> > > diff --git a/xen/arch/x86/include/asm/hvm/grant_table.h
> > > b/xen/arch/x86/include/asm/hvm/grant_table.h
> > > index 33c1da1a25f3..576aeb50adf4 100644
> > > --- a/xen/arch/x86/include/asm/hvm/grant_table.h
> > > +++ b/xen/arch/x86/include/asm/hvm/grant_table.h
> > > @@ -10,6 +10,8 @@
> > >  #ifndef __X86_HVM_GRANT_TABLE_H__
> > >  #define __X86_HVM_GRANT_TABLE_H__
> > > 
> > > +#include <asm/paging.h>
> > 
> > ... but I don't understand this one. It doesn't look like
> > asm/hvm/grant_table.h actually needs asm/paging.h ? Maybe it should be
> > included in xen/arch/x86/hvm/grant_table.c instead ?
> > 
> > 
> > >  #ifdef CONFIG_HVM
> > > 
> > >  int create_grant_p2m_mapping(uint64_t addr, mfn_t frame,
> > > --
> > > 2.34.1
> > > 
> 
> See this thread [1] for more context. There was no response, so I went for the
> route that
> made more sense to me. I guess you could say that only <xen/mm-frame.h> is
> actually needed
> to get a definition of mfn_t, but I put <asm/paging.h> as in the
> <asm/grant_table.h> header.
> 
> [1]
> https://lore.kernel.org/xen-devel/a4b6710b66ed05292388ac6882b940ec@bugseng.com/

I didn't realize it was for mfn_t. In that case it makes sense.

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
diff mbox series

Patch

diff --git a/xen/arch/x86/hvm/grant_table.c b/xen/arch/x86/hvm/grant_table.c
index 30d51d54a949..afe449d8882c 100644
--- a/xen/arch/x86/hvm/grant_table.c
+++ b/xen/arch/x86/hvm/grant_table.c
@@ -9,8 +9,7 @@ 
 
 #include <xen/types.h>
 
-#include <public/grant_table.h>
-
+#include <asm/hvm/grant_table.h>
 #include <asm/p2m.h>
 
 int create_grant_p2m_mapping(uint64_t addr, mfn_t frame,
diff --git a/xen/arch/x86/include/asm/hvm/grant_table.h b/xen/arch/x86/include/asm/hvm/grant_table.h
index 33c1da1a25f3..576aeb50adf4 100644
--- a/xen/arch/x86/include/asm/hvm/grant_table.h
+++ b/xen/arch/x86/include/asm/hvm/grant_table.h
@@ -10,6 +10,8 @@ 
 #ifndef __X86_HVM_GRANT_TABLE_H__
 #define __X86_HVM_GRANT_TABLE_H__
 
+#include <asm/paging.h>
+
 #ifdef CONFIG_HVM
 
 int create_grant_p2m_mapping(uint64_t addr, mfn_t frame,