diff mbox

[v4,05/16] xen/mm: Introduce INVALID_GFN_T and INVALID_MFN_T

Message ID 1467046452-1261-6-git-send-email-julien.grall@arm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Julien Grall June 27, 2016, 4:54 p.m. UTC
The two new defines will be a typesafe version of resp. INVALID_GFN and
INVALID_MFN.

Signed-off-by: Julien Grall <julien.grall@arm.com>

---
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: George Dunlap <George.Dunlap@eu.citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Tim Deegan <tim@xen.org>
Cc: Wei Liu <wei.liu2@citrix.com>

    Changes in v4:
        - Patch added
---
 xen/include/xen/mm.h | 2 ++
 1 file changed, 2 insertions(+)

Comments

Jan Beulich June 28, 2016, 7:16 a.m. UTC | #1
>>> On 27.06.16 at 18:54, <julien.grall@arm.com> wrote:
> The two new defines will be a typesafe version of resp. INVALID_GFN and
> INVALID_MFN.
> 
> Signed-off-by: Julien Grall <julien.grall@arm.com>

Ultimately we'll likely want it the other way around naming-wise,
but I understand that's far beyond what this series can and should
do.

Acked-by: Jan Beulich <jbeulich@suse.com>
Andrew Cooper June 28, 2016, 7:29 a.m. UTC | #2
On 28/06/2016 08:16, Jan Beulich wrote:
>>>> On 27.06.16 at 18:54, <julien.grall@arm.com> wrote:
>> The two new defines will be a typesafe version of resp. INVALID_GFN and
>> INVALID_MFN.
>>
>> Signed-off-by: Julien Grall <julien.grall@arm.com>
> Ultimately we'll likely want it the other way around naming-wise,
> but I understand that's far beyond what this series can and should
> do.

There are plenty of uses of INVALID_{M,G}FN which are not part of
{m,g}fn_t, such as in the hypercall API.  I am not sure that it is
realistic to change INVALID_{M,G}FN to be boxed types.

~Andrew
Jan Beulich June 28, 2016, 7:54 a.m. UTC | #3
>>> On 28.06.16 at 09:29, <andrew.cooper3@citrix.com> wrote:
> On 28/06/2016 08:16, Jan Beulich wrote:
>>>>> On 27.06.16 at 18:54, <julien.grall@arm.com> wrote:
>>> The two new defines will be a typesafe version of resp. INVALID_GFN and
>>> INVALID_MFN.
>>>
>>> Signed-off-by: Julien Grall <julien.grall@arm.com>
>> Ultimately we'll likely want it the other way around naming-wise,
>> but I understand that's far beyond what this series can and should
>> do.
> 
> There are plenty of uses of INVALID_{M,G}FN which are not part of
> {m,g}fn_t, such as in the hypercall API.  I am not sure that it is
> realistic to change INVALID_{M,G}FN to be boxed types.

I can't spot any such use in the public interface. And I also can't
see anything wrong with perhaps a few instances of e.g.
mfn_x(INVALID_MFN) remaining long term.

Jan
diff mbox

Patch

diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h
index afbb1a1..978a62e 100644
--- a/xen/include/xen/mm.h
+++ b/xen/include/xen/mm.h
@@ -56,6 +56,7 @@ 
 TYPE_SAFE(unsigned long, mfn);
 #define PRI_mfn          "05lx"
 #define INVALID_MFN      (~0UL)
+#define INVALID_MFN_T    _mfn(INVALID_MFN)
 
 #ifndef mfn_t
 #define mfn_t /* Grep fodder: mfn_t, _mfn() and mfn_x() are defined above */
@@ -85,6 +86,7 @@  static inline bool_t mfn_eq(mfn_t x, mfn_t y)
 TYPE_SAFE(unsigned long, gfn);
 #define PRI_gfn          "05lx"
 #define INVALID_GFN      (~0UL)
+#define INVALID_GFN_T    _gfn(INVALID_GFN)
 
 #ifndef gfn_t
 #define gfn_t /* Grep fodder: gfn_t, _gfn() and gfn_x() are defined above */