diff mbox

[6/8] gnttab: move GNTPIN_* out of header file

Message ID 5993243D020000780016FED5@prv-mh.provo.novell.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Beulich Aug. 15, 2017, 2:41 p.m. UTC
They're private to grant_table.c.

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

Comments

Andrew Cooper Aug. 15, 2017, 5:14 p.m. UTC | #1
On 15/08/17 15:41, Jan Beulich wrote:
> They're private to grant_table.c.
>
> Signed-by: Jan Beulich <jbeulich@suse.com>
>
> --- a/xen/common/grant_table.c
> +++ b/xen/common/grant_table.c
> @@ -158,7 +158,24 @@ shared_entry_header(struct grant_table *
>  
>  /* Active grant entry - used for shadowing GTF_permit_access grants. */
>  struct active_grant_entry {
> -    uint32_t      pin;    /* Reference count information.             */
> +    uint32_t      pin;    /* Reference count information:             */
> +                          /* Count of writable host-CPU mappings.     */
> +#define GNTPIN_hstw_shift    (0)
> +#define GNTPIN_hstw_inc      (1 << GNTPIN_hstw_shift)
> +#define GNTPIN_hstw_mask     (0xFFU << GNTPIN_hstw_shift)
> +                          /* Count of read-only host-CPU mappings.    */
> +#define GNTPIN_hstr_shift    (8)
> +#define GNTPIN_hstr_inc      (1 << GNTPIN_hstr_shift)
> +#define GNTPIN_hstr_mask     (0xFFU << GNTPIN_hstr_shift)
> +                          /* Count of writable device-bus mappings.   */
> +#define GNTPIN_devw_shift    (16)
> +#define GNTPIN_devw_inc      (1 << GNTPIN_devw_shift)
> +#define GNTPIN_devw_mask     (0xFFU << GNTPIN_devw_shift)
> +                          /* Count of read-only device-bus mappings.  */
> +#define GNTPIN_devr_shift    (24)
> +#define GNTPIN_devr_inc      (1 << GNTPIN_devr_shift)
> +#define GNTPIN_devr_mask     (0xFFU << GNTPIN_devr_shift)

I would recommend taking the opportunity to switch these definitions to
1u << GNTPIN_*, as they are always used with unsigned types.

Either way, Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Jan Beulich Aug. 16, 2017, 6:54 a.m. UTC | #2
>>> On 15.08.17 at 19:14, <andrew.cooper3@citrix.com> wrote:
> On 15/08/17 15:41, Jan Beulich wrote:
>> --- a/xen/common/grant_table.c
>> +++ b/xen/common/grant_table.c
>> @@ -158,7 +158,24 @@ shared_entry_header(struct grant_table *
>>  
>>  /* Active grant entry - used for shadowing GTF_permit_access grants. */
>>  struct active_grant_entry {
>> -    uint32_t      pin;    /* Reference count information.             */
>> +    uint32_t      pin;    /* Reference count information:             */
>> +                          /* Count of writable host-CPU mappings.     */
>> +#define GNTPIN_hstw_shift    (0)
>> +#define GNTPIN_hstw_inc      (1 << GNTPIN_hstw_shift)
>> +#define GNTPIN_hstw_mask     (0xFFU << GNTPIN_hstw_shift)
>> +                          /* Count of read-only host-CPU mappings.    */
>> +#define GNTPIN_hstr_shift    (8)
>> +#define GNTPIN_hstr_inc      (1 << GNTPIN_hstr_shift)
>> +#define GNTPIN_hstr_mask     (0xFFU << GNTPIN_hstr_shift)
>> +                          /* Count of writable device-bus mappings.   */
>> +#define GNTPIN_devw_shift    (16)
>> +#define GNTPIN_devw_inc      (1 << GNTPIN_devw_shift)
>> +#define GNTPIN_devw_mask     (0xFFU << GNTPIN_devw_shift)
>> +                          /* Count of read-only device-bus mappings.  */
>> +#define GNTPIN_devr_shift    (24)
>> +#define GNTPIN_devr_inc      (1 << GNTPIN_devr_shift)
>> +#define GNTPIN_devr_mask     (0xFFU << GNTPIN_devr_shift)
> 
> I would recommend taking the opportunity to switch these definitions to
> 1u << GNTPIN_*, as they are always used with unsigned types.

Oh, indeed. I've mechanically moved it without looking at the
actual pieces. I've done as you suggest plus dropped the stray
parentheses from the GNTPIN_*_shift definitions.

> Either way, Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

Thanks.

Jan
diff mbox

Patch

--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -158,7 +158,24 @@  shared_entry_header(struct grant_table *
 
 /* Active grant entry - used for shadowing GTF_permit_access grants. */
 struct active_grant_entry {
-    uint32_t      pin;    /* Reference count information.             */
+    uint32_t      pin;    /* Reference count information:             */
+                          /* Count of writable host-CPU mappings.     */
+#define GNTPIN_hstw_shift    (0)
+#define GNTPIN_hstw_inc      (1 << GNTPIN_hstw_shift)
+#define GNTPIN_hstw_mask     (0xFFU << GNTPIN_hstw_shift)
+                          /* Count of read-only host-CPU mappings.    */
+#define GNTPIN_hstr_shift    (8)
+#define GNTPIN_hstr_inc      (1 << GNTPIN_hstr_shift)
+#define GNTPIN_hstr_mask     (0xFFU << GNTPIN_hstr_shift)
+                          /* Count of writable device-bus mappings.   */
+#define GNTPIN_devw_shift    (16)
+#define GNTPIN_devw_inc      (1 << GNTPIN_devw_shift)
+#define GNTPIN_devw_mask     (0xFFU << GNTPIN_devw_shift)
+                          /* Count of read-only device-bus mappings.  */
+#define GNTPIN_devr_shift    (24)
+#define GNTPIN_devr_inc      (1 << GNTPIN_devr_shift)
+#define GNTPIN_devr_mask     (0xFFU << GNTPIN_devr_shift)
+
     domid_t       domid;  /* Domain being granted access.             */
     unsigned int  start:15; /* For sub-page grants, the start offset
                                in the page.                           */
--- a/xen/include/xen/grant_table.h
+++ b/xen/include/xen/grant_table.h
@@ -28,23 +28,6 @@ 
 #include <asm/page.h>
 #include <asm/grant_table.h>
 
- /* Count of writable host-CPU mappings. */
-#define GNTPIN_hstw_shift    (0)
-#define GNTPIN_hstw_inc      (1 << GNTPIN_hstw_shift)
-#define GNTPIN_hstw_mask     (0xFFU << GNTPIN_hstw_shift)
- /* Count of read-only host-CPU mappings. */
-#define GNTPIN_hstr_shift    (8)
-#define GNTPIN_hstr_inc      (1 << GNTPIN_hstr_shift)
-#define GNTPIN_hstr_mask     (0xFFU << GNTPIN_hstr_shift)
- /* Count of writable device-bus mappings. */
-#define GNTPIN_devw_shift    (16)
-#define GNTPIN_devw_inc      (1 << GNTPIN_devw_shift)
-#define GNTPIN_devw_mask     (0xFFU << GNTPIN_devw_shift)
- /* Count of read-only device-bus mappings. */
-#define GNTPIN_devr_shift    (24)
-#define GNTPIN_devr_inc      (1 << GNTPIN_devr_shift)
-#define GNTPIN_devr_mask     (0xFFU << GNTPIN_devr_shift)
-
 #ifndef DEFAULT_MAX_NR_GRANT_FRAMES /* to allow arch to override */
 /* Default maximum size of a grant table. [POLICY] */
 #define DEFAULT_MAX_NR_GRANT_FRAMES   32