[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN PATCH 1/7] xen: add declarations for variables where needed


  • To: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Mon, 2 Oct 2023 13:07:25 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kNCd0y7BtYdmbA8kTcy0EHbJEzWCKpTuLLtFCzKUtME=; b=i4nYVwYvdmIHQahoaWC6PIs3fwhmRfWQ4hHEAvA81kiDVMYT4Swg4C0Y7dksoPcfKOxm3Ei6ZQIAZsxWqts8HtkiVfQ125vZdzhI5MQxJPSbPltCGw7y+HQZjwBP/K4igKyRYEF5ChWKo/kD5RP9vOe6DDg99i4cbXOsFOWM0UxIFX7W5K7+WWhiztDF5mWioOccaxy2Bfu1yP136pvJ1tmMj9y3wqnVl1XqtbtXWxHdpXeM/OJxtCdW8OQJ92TXIrkVh34d7EqXR8zOwdh4d9x81nNZ2aLulm9k6bpaZ3ZVrijv/qeX8pCW3G+Sh06H8Qyv5Lw556rMu1t+Ua3gHw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RJYnxVrZoKkSoA8vpiECBA4P0y2p/4BgDb4ZZh8y+xR7+XNU+PhTSZiGSJLym1icW+RHpIYsXI/deYrHNCJlqVDX6vte0ZLYcH2bJLAJsKk3AJ9Ho2Sah7MHgC0bxtkbkYlqPFDp7mxdb34EnwCXnGPcsEEFa9S9+Au+SY6B1adKQBYyWrDhpHYxHCbojcrWLLC298LUo669iCOl3XSp4UPJ61p+M/fuGIRC+KYvJi+PiRekvJlvB0Ce96mEGchZO7i1a29Jq0asc3qKoL1ir9vsZPVctprWAHhXmRphnbbbcyfiMIwa6zpl2FC3XYfmVobcnYHm/od5QJEVfkcWtA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, sstabellini@xxxxxxxxxx, michal.orzel@xxxxxxx, xenia.ragiadakou@xxxxxxx, ayan.kumar.halder@xxxxxxx, consulting@xxxxxxxxxxx, jbeulich@xxxxxxxx, andrew.cooper3@xxxxxxxxxx, Henry.Wang@xxxxxxx, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Mon, 02 Oct 2023 11:08:02 +0000
  • Ironport-data: A9a23:F2kYHamlmGAotF9cVukXjTno5gyQJkRdPkR7XQ2eYbSJt1+Wr1Gzt xJJCmyHOv7ZZ2H0KNlzbNy2/UIFuJXSx4I3QAJr/Ck1QiMWpZLJC+rCIxarNUt+DCFhoGFPt JxCN4aafKjYaleG+39B55C49SEUOZmgH+e6UKicfHkpGWeIcQ954Tp7gek1n4V0ttawBgKJq LvartbWfVSowFaYCEpNg064gE0p5K+aVA8w5ARkPqkT5AWGzhH5MbpETU2PByqgKmVrNrbSq 9brlNmR4m7f9hExPdKp+p6TnpoiG+O60aCm0xK6aoD66vRwjnVaPpUTbZLwXXx/mTSR9+2d/ f0W3XCGpaXFCYWX8AgVe0Ew/yiTpsSq8pefSZS0mZT7I0Er7xIAahihZa07FdRwxwp5PY1B3 dgbN2oSbUC8vaG7yfW9SutToJ09cfC+aevzulk4pd3YJdAPZMmaBonvu5pf1jp2gd1SF/HDY cZfcSBocBnLfxxIPBEQFY46m+CrwHL4dlW0qnrM/fZxvzeVkVM3iee3WDbWUoXiqcF9hEGXq 3iA523kKhobKMae2XyO9XfEaurnxHmnA91NTODknhJsqGaf62c0ND0ybASypMO40WObQdYAc 1NBr0LCqoB3riRHVOLVWRyzp3qN+AARR8BRFewS4hyC0afS7ECSAW1sZi5MbpkqudE7QRQu1 0SVhJX5CDp3qrqXRHmBsLCOoluaIjMJJGUPYSsFSwot4NT5pow3yBXVQb5LFa++jtTxXzbq0 T2OhCE7i/MYistj/7W2+1HOxSilqZnAQgc24Rj/V2epqAh+YeaNbp2h7x7Y8PNJNsCZR12Ns WIsks2SqusJCPmlnyuLW/gJALCv6N6PLTLHjFhgWZIm8lyF+XSuYIRR6zFWP1pyP4APfjqBS G/evxlAoqBaOnSCZLVyJYm2DqwCz7XkFNnjfuDZaJxJeJcZXAWK5j10bEicmWXkilExkLoXM I2eN82rCB4yN6NjyzanQvYH5pUizCs+2GD7SIjyylKs1r/2TGGRYacINh2JdO9R0U+fiADc8 tIaO87UzRxaCbT6enOOrtRVKk0WJ38mA5yws9ZQauOIPgthHicmFuPVxrQiPYdimsy5i9v1w 510YWcAoHKXuJENAVzihqxLAF83YatCkA==
  • Ironport-hdrordr: A9a23:d90SGKhlGx6MTnCJD1ZR0xRlkXBQXiwji2hC6mlwRA09TyX5ra 2TdTogtSMc6QxhPk3I/OrrBEDuexzhHPJOj7X5eI3SPjUO21HYS72Kj7GSoAEIcheWnoJgPO VbAs1D4bXLZmSS5vyKhDVQfexA/DGGmprY+ts3zR1WPH9Xg3cL1XYJNu6ZeHcGNDWvHfACZe OhDlIsnUvcRZwQBP7LfkUtbqz4iPDgsonpWhICDw5P0njzsdv5gISKaCRxx30lIkly/Ys=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Mon, Oct 02, 2023 at 09:49:44AM +0200, Nicola Vetrini wrote:
> Some variables with external linkage used in C code do not have
> a visible declaration where they are defined. Providing such
> declaration also resolves violations of MISRA C:2012 Rule 8.4.
> 
> Signed-off-by: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
> ---
>  xen/arch/arm/include/asm/setup.h  |  3 +++
>  xen/arch/arm/include/asm/smp.h    |  3 +++
>  xen/arch/x86/cpu/mcheck/mce.c     |  6 +++---
>  xen/arch/x86/include/asm/setup.h  |  3 +++
>  xen/arch/x86/irq.c                |  2 +-
>  xen/arch/x86/platform_hypercall.c |  3 ---
>  xen/common/symbols.c              | 17 -----------------
>  xen/include/xen/hypercall.h       |  3 +++
>  xen/include/xen/symbols.h         | 18 ++++++++++++++++++
>  9 files changed, 34 insertions(+), 24 deletions(-)
> 
> diff --git a/xen/arch/arm/include/asm/setup.h 
> b/xen/arch/arm/include/asm/setup.h
> index b8866c20f462..8806a74b216d 100644
> --- a/xen/arch/arm/include/asm/setup.h
> +++ b/xen/arch/arm/include/asm/setup.h
> @@ -183,9 +183,12 @@ int map_range_to_domain(const struct dt_device_node *dev,
>  extern lpae_t boot_pgtable[XEN_PT_LPAE_ENTRIES];
>  
>  #ifdef CONFIG_ARM_64
> +extern lpae_t boot_first[XEN_PT_LPAE_ENTRIES];
>  extern lpae_t boot_first_id[XEN_PT_LPAE_ENTRIES];
>  #endif
> +extern lpae_t boot_second[XEN_PT_LPAE_ENTRIES];
>  extern lpae_t boot_second_id[XEN_PT_LPAE_ENTRIES];
> +extern lpae_t boot_third[XEN_PT_LPAE_ENTRIES * XEN_NR_ENTRIES(2)];
>  extern lpae_t boot_third_id[XEN_PT_LPAE_ENTRIES];
>  
>  /* Find where Xen will be residing at runtime and return a PT entry */
> diff --git a/xen/arch/arm/include/asm/smp.h b/xen/arch/arm/include/asm/smp.h
> index 4fabdf5310d8..28bf24a01d95 100644
> --- a/xen/arch/arm/include/asm/smp.h
> +++ b/xen/arch/arm/include/asm/smp.h
> @@ -6,6 +6,9 @@
>  #include <asm/current.h>
>  #endif
>  
> +extern struct init_info init_data;
> +extern unsigned long smp_up_cpu;
> +
>  DECLARE_PER_CPU(cpumask_var_t, cpu_sibling_mask);
>  DECLARE_PER_CPU(cpumask_var_t, cpu_core_mask);
>  
> diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
> index 6141b7eb9cf1..e855f958030d 100644
> --- a/xen/arch/x86/cpu/mcheck/mce.c
> +++ b/xen/arch/x86/cpu/mcheck/mce.c
> @@ -1682,13 +1682,13 @@ long do_mca(XEN_GUEST_HANDLE_PARAM(xen_mc_t) u_xen_mc)
>      return ret;
>  }
>  
> -int mcinfo_dumpped;
> +static int mcinfo_dumped;
>  static int cf_check x86_mcinfo_dump_panic(mctelem_cookie_t mctc)
>  {
>      struct mc_info *mcip = mctelem_dataptr(mctc);
>  
>      x86_mcinfo_dump(mcip);
> -    mcinfo_dumpped++;
> +    mcinfo_dumped++;
>  
>      return 0;
>  }
> @@ -1702,7 +1702,7 @@ static void mc_panic_dump(void)
>      for_each_online_cpu(cpu)
>          mctelem_process_deferred(cpu, x86_mcinfo_dump_panic,
>                                   mctelem_has_deferred_lmce(cpu));
> -    dprintk(XENLOG_ERR, "End dump mc_info, %x mcinfo dumped\n", 
> mcinfo_dumpped);
> +    dprintk(XENLOG_ERR, "End dump mc_info, %x mcinfo dumped\n", 
> mcinfo_dumped);
>  }
>  
>  void mc_panic(const char *s)
> diff --git a/xen/arch/x86/include/asm/setup.h 
> b/xen/arch/x86/include/asm/setup.h
> index dfdd9e555149..3c27fe915ed4 100644
> --- a/xen/arch/x86/include/asm/setup.h
> +++ b/xen/arch/x86/include/asm/setup.h
> @@ -13,8 +13,11 @@ extern char __2M_rwdata_start[], __2M_rwdata_end[];
>  extern unsigned long xenheap_initial_phys_start;
>  extern uint64_t boot_tsc_stamp;
>  
> +extern char cpu0_stack[STACK_SIZE];
>  extern void *stack_start;
>  
> +extern unsigned long cr4_pv32_mask;

This one might better go in compat.h, albeit that would require it's
setting to be gated to CONFIG_PV32.  setup.h is IMO for init time
stuff.

> +
>  void early_cpu_init(void);
>  void early_time_init(void);
>  
> diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
> index 6abfd8162120..604dba94b052 100644
> --- a/xen/arch/x86/irq.c
> +++ b/xen/arch/x86/irq.c
> @@ -43,7 +43,7 @@ int __read_mostly opt_irq_vector_map = 
> OPT_IRQ_VECTOR_MAP_DEFAULT;
>  static unsigned char __read_mostly irq_max_guests;
>  integer_param("irq-max-guests", irq_max_guests);
>  
> -vmask_t global_used_vector_map;
> +static vmask_t global_used_vector_map;
>  
>  struct irq_desc __read_mostly *irq_desc = NULL;
>  
> diff --git a/xen/arch/x86/platform_hypercall.c 
> b/xen/arch/x86/platform_hypercall.c
> index 9469de9045c7..e4dbec73d784 100644
> --- a/xen/arch/x86/platform_hypercall.c
> +++ b/xen/arch/x86/platform_hypercall.c
> @@ -36,9 +36,6 @@
>  #include "cpu/mtrr/mtrr.h"
>  #include <xsm/xsm.h>
>  
> -/* Declarations for items shared with the compat mode handler. */
> -extern spinlock_t xenpf_lock;
> -
>  #define RESOURCE_ACCESS_MAX_ENTRIES 3
>  struct resource_access {
>      unsigned int nr_done;
> diff --git a/xen/common/symbols.c b/xen/common/symbols.c
> index 691e61792506..7c3514c65f2e 100644
> --- a/xen/common/symbols.c
> +++ b/xen/common/symbols.c
> @@ -21,23 +21,6 @@
>  #include <xen/guest_access.h>
>  #include <xen/errno.h>
>  
> -#ifdef SYMBOLS_ORIGIN
> -extern const unsigned int symbols_offsets[];
> -#define symbols_address(n) (SYMBOLS_ORIGIN + symbols_offsets[n])
> -#else
> -extern const unsigned long symbols_addresses[];
> -#define symbols_address(n) symbols_addresses[n]
> -#endif
> -extern const unsigned int symbols_num_syms;
> -extern const u8 symbols_names[];
> -
> -extern const struct symbol_offset symbols_sorted_offsets[];
> -
> -extern const u8 symbols_token_table[];
> -extern const u16 symbols_token_index[];
> -
> -extern const unsigned int symbols_markers[];
> -
>  /* expand a compressed symbol data into the resulting uncompressed string,
>     given the offset to where the symbol is in the compressed stream */
>  static unsigned int symbols_expand_symbol(unsigned int off, char *result)
> diff --git a/xen/include/xen/hypercall.h b/xen/include/xen/hypercall.h
> index f307dfb59760..12de5a69b5b1 100644
> --- a/xen/include/xen/hypercall.h
> +++ b/xen/include/xen/hypercall.h
> @@ -24,6 +24,9 @@
>  /* Needs to be after asm/hypercall.h. */
>  #include <xen/hypercall-defs.h>
>  
> +/* Declarations for items shared with the compat mode handler. */
> +extern spinlock_t xenpf_lock;

I'm confused about why this needs to be moved, AFAICT xenpf_lock is
only used in platform_hypercall.c, and the declaration is
unconditional, so there's no definition without declaration issue.

> +
>  extern long
>  arch_do_domctl(
>      struct xen_domctl *domctl, struct domain *d,
> diff --git a/xen/include/xen/symbols.h b/xen/include/xen/symbols.h
> index 20bbb28ef226..92540409265e 100644
> --- a/xen/include/xen/symbols.h
> +++ b/xen/include/xen/symbols.h
> @@ -33,4 +33,22 @@ struct symbol_offset {
>      uint32_t stream; /* .. in the compressed stream.*/
>      uint32_t addr;   /* .. and in the fixed size address array. */
>  };
> +
> +#ifdef SYMBOLS_ORIGIN
> +extern const unsigned int symbols_offsets[];
> +#define symbols_address(n) (SYMBOLS_ORIGIN + symbols_offsets[n])
> +#else
> +extern const unsigned long symbols_addresses[];
> +#define symbols_address(n) symbols_addresses[n]
> +#endif
> +extern const unsigned int symbols_num_syms;
> +extern const u8 symbols_names[];
> +
> +extern const struct symbol_offset symbols_sorted_offsets[];
> +
> +extern const u8 symbols_token_table[];
> +extern const u16 symbols_token_index[];
> +
> +extern const unsigned int symbols_markers[];
> +
>  #endif /*_XEN_SYMBOLS_H*/

This one is ugly, but I can't see a better way immediately.

Thanks, Roger.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.