Skip to content

Commit

Permalink
x86/shadow: Fix build with no PG_log_dirty
Browse files Browse the repository at this point in the history
Gitlab Randconfig found:

  arch/x86/mm/shadow/common.c: In function 'shadow_prealloc':
  arch/x86/mm/shadow/common.c:1023:18: error: implicit declaration of function
      'paging_logdirty_levels'; did you mean 'paging_log_dirty_init'? [-Werror=implicit-function-declaration]
   1023 |         count += paging_logdirty_levels();
        |                  ^~~~~~~~~~~~~~~~~~~~~~
        |                  paging_log_dirty_init
  arch/x86/mm/shadow/common.c:1023:18: error: nested extern declaration of 'paging_logdirty_levels' [-Werror=nested-externs]

The '#if PG_log_dirty' expression is currently SHADOW_PAGING && !HVM &&
PV_SHIM_EXCLUSIVE.  Move the declaration outside.

Fixes: 33fb3a6 ("x86/shadow: account for log-dirty mode when pre-allocating")
Signed-off-by: Andrew Cooper <[email protected]>
Reviewed-by: Jan Beulich <[email protected]>
  • Loading branch information
andyhhp committed Mar 24, 2023
1 parent 136f69d commit 6d14cb1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions xen/arch/x86/include/asm/paging.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ struct paging_mode {
/*****************************************************************************
* Log dirty code */

#define paging_logdirty_levels() \
(DIV_ROUND_UP(PADDR_BITS - PAGE_SHIFT - (PAGE_SHIFT + 3), \
PAGE_SHIFT - ilog2(sizeof(mfn_t))) + 1)

#if PG_log_dirty

/* get the dirty bitmap for a specific range of pfns */
Expand Down Expand Up @@ -180,10 +184,6 @@ bool paging_mfn_is_dirty(const struct domain *d, mfn_t gmfn);
#define L4_LOGDIRTY_IDX(pfn) ((pfn_x(pfn) >> (PAGE_SHIFT + 3 + PAGETABLE_ORDER * 2)) & \
(LOGDIRTY_NODE_ENTRIES-1))

#define paging_logdirty_levels() \
(DIV_ROUND_UP(PADDR_BITS - PAGE_SHIFT - (PAGE_SHIFT + 3), \
PAGE_SHIFT - ilog2(sizeof(mfn_t))) + 1)

#ifdef CONFIG_HVM
/* VRAM dirty tracking support */
struct sh_dirty_vram {
Expand Down

0 comments on commit 6d14cb1

Please sign in to comment.