Fix or deviate various instances of missing declarations
v4 cover Fix or deviate various instances of missing declarations
The patches in this series aim to fix or deviate various instances where a function or variable do not have a declaration visible when such entity is defined (in violation of MISRA C:2012 Rule 8.4).
An exception listed under docs/misra/rules.rst allows asm-only functions and variables to be exempted, while the other instances are either changed (e.g., making them static) or a missing header inclusion is added.
Nicola Vetrini (8):
xen: modify or add declarations for variables where needed
x86: add deviations for variables only used in asm code
x86: add deviation comments for asm-only functions x86/grant: switch included header to make declarations visible x86/vm_event: add missing include for hvm_vm_event_do_resume xen/console: remove stub definition in consoled.h x86/mem_access: make function static
docs/misra: exclude three more files
docs/misra/exclude-list.json | 12 ++++++++++++ xen/arch/arm/include/asm/setup.h | 3 +++ xen/arch/arm/include/asm/smp.h | 3 +++ xen/arch/arm/platform_hypercall.c | 2 +- xen/arch/x86/cpu/mcheck/mce.c | 7 ++++--- xen/arch/x86/hvm/grant_table.c | 3 +-- xen/arch/x86/hvm/svm/intr.c | 1 + xen/arch/x86/hvm/svm/nestedsvm.c | 1 + xen/arch/x86/hvm/svm/svm.c | 2 ++ xen/arch/x86/hvm/vm_event.c | 1 + xen/arch/x86/hvm/vmx/intr.c | 1 + xen/arch/x86/hvm/vmx/vmx.c | 2 ++ xen/arch/x86/hvm/vmx/vvmx.c | 1 + xen/arch/x86/include/asm/asm_defns.h | 1 + xen/arch/x86/include/asm/hvm/grant_table.h | 2 ++ xen/arch/x86/irq.c | 2 +- xen/arch/x86/mm/mem_access.c | 6 +++--- xen/arch/x86/setup.c | 4 +++- xen/arch/x86/traps.c | 1 + xen/arch/x86/x86_64/traps.c | 1 + xen/include/xen/consoled.h | 7 ------- xen/include/xen/symbols.h | 1 + 22 files changed, 46 insertions(+), 18 deletions(-)
--
2.34.1
PATCH v4 1/8 xen: modify or add declarations for variables where needed
Some variables with external linkage used in C code do not have a visible declaration where they are defined. Other variables can become static, thereby eliminating the need for a declaration. Doing so also resolves violations of MISRA C:2012 Rule 8.4.
Fix typo s/mcinfo_dumpped/mcinfo_dumped/ while making the variable static.
---
Changes in v2:
- make xenpf_lock static on ARM
Changes in v3:
- moved back code from symbols.h to symbols.c
- dropped two declarations, now deviated
Changes in v4:
- revise commit message
--- xen/arch/arm/include/asm/setup.h | 3 +++ xen/arch/arm/include/asm/smp.h | 3 +++ xen/arch/arm/platform_hypercall.c | 2 +- xen/arch/x86/cpu/mcheck/mce.c | 7 ++++--- xen/arch/x86/irq.c | 2 +- xen/include/xen/symbols.h | 1 + 6 files changed, 13 insertions(+), 5 deletions(-)
xen/arch/arm/include/asm/setup.h +3 -0
@@ -184,9 +184,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 */
xen/arch/arm/include/asm/smp.h +3 -0
@@ -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);
xen/arch/arm/platform_hypercall.c +1 -1
@@ -17,7 +17,7 @@#include <asm/current.h> #include <asm/event.h> -DEFINE_SPINLOCK (xenpf_lock); +static DEFINE_SPINLOCK (xenpf_lock);long do_platform_op (XEN_GUEST_HANDLE_PARAM (xen_platform_op_t) u_xenpf_op) {
xen/arch/x86/cpu/mcheck/mce.c +4 -3
@@ -1682,13 +1682,14 @@ 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 +1703,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)
xen/arch/x86/irq.c +1 -1
@@ -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 ;
xen/include/xen/symbols.h +1 -0
@@ -33,4 +33,5 @@ struct symbol_offset {uint32_t stream;/* .. in the compressed stream.*/ uint32_t addr; /* .. and in the fixed size address array. */ }; +#endif /*_XEN_SYMBOLS_H*/
--
2.34.1
PATCH v4 4/8 x86/grant: switch included header to make declarations visible
In reply to Nicola VetriniThe 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.
---
Changes in v3:
- asm/paging.h can be replaced with mm-frame.h, because just the definition of mfn_t is needed.
--- 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(-)
xen/arch/x86/hvm/grant_table.c +1 -2
@@ -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,
xen/arch/x86/include/asm/hvm/grant_table.h +2 -0
@@ -10,6 +10,8 @@#ifndef __X86_HVM_GRANT_TABLE_H__#define __X86_HVM_GRANT_TABLE_H__ +#include <xen/mm-frame.h> +#ifdef CONFIG_HVM int create_grant_p2m_mapping(uint64_t addr, mfn_t frame,
Signature · 1 line
2.34.1
PATCH v4 6/8 xen/console: remove stub definition in consoled.h
In reply to Nicola VetriniThe stub definition of 'consoled_guest_tx' can be removed, since its its single caller uses the implementation built with PV_SHIM enabled.
--- xen/include/xen/consoled.h | 7 ------- 1 file changed, 7 deletions(-)
xen/include/xen/consoled.h +0 -7
@@ -3,18 +3,11 @@#include <public/io/console.h> -#ifdef CONFIG_PV_SHIM -void consoled_set_ring_addr (struct xencons_interface *ring);struct xencons_interface *consoled_get_ring_addr (void );size_t consoled_guest_rx (void );size_t consoled_guest_tx (char c); -#else - -size_t consoled_guest_tx (char c) {return 0 ; } - -#endif /* !CONFIG_PV_SHIM */ #endif /* __XEN_CONSOLED_H__ */ /* * Local variables:
Signature · 1 line
2.34.1
PATCH v4 7/8 x86/mem_access: make function static
In reply to Nicola VetriniThe function is used only within this file, and therefore can be static.
No functional change.
---
Changes in v3:
- style fix
--- xen/arch/x86/mm/mem_access.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
xen/arch/x86/mm/mem_access.c +3 -3
@@ -249,9 +249,9 @@ bool p2m_mem_access_check(paddr_t gpa, unsigned long gla,return (p2ma != p2m_access_n2rwx); } -int p2m_set_altp2m_mem_access (struct domain *d,struct p2m_domain *hp2m, -struct p2m_domain *ap2m,p2m_access_t a, -gfn_t gfn) +static int p2m_set_altp2m_mem_access (struct domain *d,struct p2m_domain *hp2m, +struct p2m_domain *ap2m,p2m_access_t a, +gfn_t gfn) {mfn_t mfn;p2m_type_t t;
Signature · 1 line
2.34.1
PATCH v4 5/8 x86/vm_event: add missing include for hvm_vm_event_do_resume
In reply to Nicola VetriniThe missing header makes the declaration visible when the function is defined, thereby fixing a violation of MISRA C:2012 Rule 8.4.
--- xen/arch/x86/hvm/vm_event.c | 1 + 1 file changed, 1 insertion(+)
xen/arch/x86/hvm/vm_event.c +1 -0
@@ -24,6 +24,7 @@#include <xen/vm_event.h> #include <asm/hvm/emulate.h> #include <asm/hvm/support.h> +#include <asm/hvm/vm_event.h> #include <asm/vm_event.h> static void hvm_vm_event_set_registers (const struct vcpu *v)
Signature · 1 line
2.34.1
PATCH v4 2/8 x86: add deviations for variables only used in asm code
In reply to Nicola VetriniTo avoid a violation of MISRA C:2012 Rule 8.4, as permitted by docs/misra/rules.rst.
---
Changes in v3:
- Edited commit message
- Add two new variables
--- xen/arch/x86/include/asm/asm_defns.h | 1 + xen/arch/x86/setup.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-)
xen/arch/x86/include/asm/asm_defns.h +1 -0
@@ -31,6 +31,7 @@ asm ( "\t.equ CONFIG_INDIRECT_THUNK, "* gets set up by the containing function. */ #ifdef CONFIG_FRAME_POINTER +/* SAF-1-safe */ registerunsigned long current_stack_pointer asm("rsp" );# define ASM_CALL_CONSTRAINT , "+r" (current_stack_pointer)#else
xen/arch/x86/setup.c +3 -1
@@ -75,6 +75,7 @@ static bool __initdata opt_invpcid = true;boolean_param ("invpcid" , opt_invpcid);bool __read_mostly use_invpcid; +/* SAF-1-safe Only used in asm code and within this source file */ unsigned long __read_mostly cr4_pv32_mask;/* **** Linux config option: propagated to domain0. */
@@ -147,12 +148,13 @@ cpumask_t __read_mostly cpu_present_map;unsigned long __read_mostly xen_phys_start; char __section(".init.bss.stack_aligned") __aligned(STACK_SIZE) - cpu0_stack[STACK_SIZE ]; + cpu0_stack[STACK_SIZE ];/* SAF-1-safe Only used in asm code and below */ /* Used by the BSP/AP paths to find the higher half stack mapping to use. */ void *stack_start = cpu0_stack +STACK_SIZE -sizeof (struct cpu_info );/* Used by the boot asm to stash the relocated multiboot info pointer. */ +/* SAF-1-safe */ unsigned int __initdata multiboot_ptr;struct cpuinfo_x86 __read_mostly boot_cpu_data = {0 ,0 ,0 ,0 ,-1 };
Signature · 1 line
2.34.1
PATCH v4 3/8 x86: add deviation comments for asm-only functions
In reply to Nicola VetriniAs stated in rules.rst, functions used only in asm code are allowed to have no prior declaration visible when being defined, hence these functions are deviated.
This also fixes violations of MISRA C:2012 Rule 8.4.
---
Changes in v3:
- added SAF deviations for vmx counterparts to svm functions.
--- xen/arch/x86/hvm/svm/intr.c | 1 + xen/arch/x86/hvm/svm/nestedsvm.c | 1 + xen/arch/x86/hvm/svm/svm.c | 2 ++ xen/arch/x86/hvm/vmx/intr.c | 1 + xen/arch/x86/hvm/vmx/vmx.c | 2 ++ xen/arch/x86/hvm/vmx/vvmx.c | 1 + xen/arch/x86/traps.c | 1 + xen/arch/x86/x86_64/traps.c | 1 + 8 files changed, 10 insertions(+)
xen/arch/x86/hvm/svm/intr.c +1 -0
@@ -123,6 +123,7 @@ static void svm_enable_intr_window(struct vcpu *v, struct hvm_intack intack) vmcb, general1_intercepts | GENERAL1_INTERCEPT_VINTR); } +/* SAF-1-safe */ void svm_intr_assist (void ) {struct vcpu *v = current;
xen/arch/x86/hvm/svm/nestedsvm.c +1 -0
@@ -1441,6 +1441,7 @@ nestedsvm_vcpu_vmexit(struct vcpu *v, struct cpu_user_regs *regs, }/* VCPU switch */ +/* SAF-1-safe */ void nsvm_vcpu_switch (void ) {struct cpu_user_regs *regs =guest_cpu_user_regs ();
xen/arch/x86/hvm/svm/svm.c +2 -0
@@ -1056,6 +1056,7 @@ static void noreturn cf_check svm_do_resume(void)reset_stack_and_jump (svm_asm_do_resume); } +/* SAF-1-safe */ void svm_vmenter_helper (void ) {const struct cpu_user_regs *regs =guest_cpu_user_regs ();
@@ -2586,6 +2587,7 @@ const struct hvm_function_table * __init start_svm(void)return &svm_function_table; } +/* SAF-1-safe */ void svm_vmexit_handler (void ) {struct cpu_user_regs *regs =guest_cpu_user_regs ();
xen/arch/x86/hvm/vmx/intr.c +1 -0
@@ -224,6 +224,7 @@ void vmx_sync_exit_bitmap(struct vcpu *v) } } +/* SAF-1-safe */ void vmx_intr_assist (void ) {struct hvm_intack intack;
xen/arch/x86/hvm/vmx/vmx.c +2 -0
@@ -4035,6 +4035,7 @@ static void undo_nmis_unblocked_by_iret(void) guest_info | VMX_INTR_SHADOW_NMI); } +/* SAF-1-safe */ void vmx_vmexit_handler (struct cpu_user_regs *regs) {unsigned long exit_qualification, exit_reason, idtv_info, intr_info =0 ;
@@ -4787,6 +4788,7 @@ static void lbr_fixup(void) }/* Returns false if the vmentry has to be restarted */ +/* SAF-1-safe */ bool vmx_vmenter_helper (const struct cpu_user_regs *regs) {struct vcpu *curr = current;
xen/arch/x86/hvm/vmx/vvmx.c +1 -0
@@ -1490,6 +1490,7 @@ static void nvmx_eptp_update(void)__vmwrite (EPT_POINTER ,get_shadow_eptp (curr)); } +/* SAF-1-safe */ void nvmx_switch_guest (void ) {struct vcpu *v = current;
xen/arch/x86/traps.c +1 -0
@@ -2265,6 +2265,7 @@ void asm_domain_crash_synchronous(unsigned long addr) }#ifdef CONFIG_DEBUG +/* SAF-1-safe */ void check_ist_exit (const struct cpu_user_regs *regs,bool ist_exit) { const unsigned int ist_mask =
xen/arch/x86/x86_64/traps.c +1 -0
@@ -266,6 +266,7 @@ void show_page_walk(unsigned long addr) l1_table_offset(addr), l1e_get_intpte(l1e), pfn); } +/* SAF-1-safe */ void do_double_fault (struct cpu_user_regs *regs) {unsigned int cpu;
Signature · 1 line
2.34.1
PATCH v4 8/8 docs/misra: exclude three more files
In reply to Nicola VetriniThese files should not conform to MISRA guidelines at the moment, therefore they are added to the exclusion list.
---
These exclusions are automatically picked up by ECLAIR's automation to hide reports originating from these files.
Changes in v4:
- Fixed typo
--- docs/misra/exclude-list.json | 12 ++++++++++++ 1 file changed, 12 insertions(+)
docs/misra/exclude-list.json +12 -0
@@ -145,6 +145,10 @@ "rel_path": "common/zstd/*", "comment": "Imported from Linux, ignore for now" }, + { + "rel_path": "common/symbols-dummy.c", + "comment": "The resulting code is not included in the final Xen binary, ignore for now" + }, { "rel_path": "crypto/*", "comment": "Origin is external and documented in crypto/README.source"
@@ -189,6 +193,14 @@ "rel_path": "include/acpi/acpixf.h", "comment": "Imported from Linux, ignore for now" }, + { + "rel_path": "include/acpi/acexcep.h", + "comment": "Imported from Linux, ignore for now" + }, + { + "rel_path": "include/acpi/acglobal.h", + "comment": "Imported from Linux, ignore for now" + }, { "rel_path": "include/xen/acpi.h", "comment": "Imported from Linux, ignore for now"
Signature · 1 line
2.34.1
Re: [XEN PATCH][for-4.19 v4 6/8] xen/console: remove stub definition in consoled.h
In reply to Nicola VetriniQuoted 5 lines · Nicola Vetrini
The stub definition of '
consoled_guest_tx' can be removed, since its its single caller uses the implementation built withPV_SHIMenabled.Fixes 5ef49f185c2d ("x86/pv-shim: shadow PV console's page for L2 DomU")Signed-off-by Nicola Vetrini <[email protected]>
Where did Stefano's R-b go?
Jan
Re: [XEN PATCH][for-4.19 v4 8/8] docs/misra: exclude three more files
In reply to Nicola VetriniQuoted 10 lines · Nicola Vetrini
These files should not conform to MISRA guidelines at the moment, therefore they are added to the exclusion list.
Signed-off-by Nicola Vetrini <[email protected]>---
These exclusions are automatically picked up by ECLAIR's automation to hide reports originating from these files.Changes in v4:
- Fixed typo
While there was an adjustment here, I don't think it invalidated Stefano's R-b?
Jan
Re: [XEN PATCH][for-4.19 v4 6/8] xen/console: remove stub definition in consoled.h
In reply to Jan BeulichQuoted 10 lines · Jan Beulich
Quoted 5 lines · Nicola Vetrini
The stub definition of '
consoled_guest_tx' can be removed, since its its single caller uses the implementation built withPV_SHIMenabled.Fixes 5ef49f185c2d ("x86/pv-shim: shadow PV console's page for L2 DomU")Signed-off-by Nicola Vetrini <[email protected]>Where did Stefano's R-b go?
Jan
I didn't notice it. Nothing has changed since, so it should be included
Signature · 2 lines
Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)
Re: [XEN PATCH][for-4.19 v4 8/8] docs/misra: exclude three more files
In reply to Jan BeulichQuoted 9 lines · Jan Beulich
Quoted 8 lines · Nicola Vetrini
These files should not conform to MISRA guidelines at the moment, therefore they are added to the exclusion list.
Signed-off-by Nicola Vetrini <[email protected]>---
These exclusions are automatically picked up by ECLAIR's automation to hide reports originating from these files.
Quoted 7 lines
Quoted 2 lines
Changes in v4:
- Fixed typoWhile there was an adjustment here, I don't think it invalidated Stefano's R-b?
Jan
Yes
Signature · 2 lines
Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)
Re: [XEN PATCH][for-4.19 v4 1/8] xen: modify or add declarations for variables where needed
In reply to Nicola VetriniQuoted 9 lines · Nicola Vetrini
Some variables with external linkage used in C code do not have a visible declaration where they are defined. Other variables can become static, thereby eliminating the need for a declaration. Doing so also resolves violations of MISRA C:2012 Rule 8.4.
Fix typo s/mcinfo_dumpped/mcinfo_dumped/ while making the variable static.
Signed-off-by Nicola Vetrini <[email protected]>
Jan Beulich
Acked-byRe: [XEN PATCH][for-4.19 v4 1/8] xen: modify or add declarations for variables where needed
Quoted 6 lines · Stefano Stabellini
Quoted 5 lines · Nicola Vetrini
Some variables with external linkage used in C code do not have a visible declaration where they are defined. Other variables can become static, thereby eliminating the need for a declaration. Doing so also resolves violations of MISRA C:2012 Rule 8.4.
Quoted 6 lines
Quoted 4 lines
Fix typo s/mcinfo_dumpped/mcinfo_dumped/ while making the variable static.
Signed-off-by Nicola Vetrini <[email protected]>Reviewed-by Stefano Stabellini <[email protected]>
(for x86)
Re: [XEN PATCH][for-4.19 v4 2/8] x86: add deviations for variables only used in asm code
In reply to Nicola Vetrinixen/arch/x86/include/asm/asm_defns.h asm ( "\t.equ CONFIG_INDIRECT_THUNK, " · line 37
Quoted 10 lines · Nicola Vetrini
xen/arch/x86/include/asm/asm_defns.h +1
-0@@ -31,6 +31,7 @@ asm ( "\t.equ CONFIG_INDIRECT_THUNK, "* gets set up by the containing function. */ #ifdef CONFIG_FRAME_POINTER +/* SAF-1-safe */ registerunsigned long current_stack_pointer asm("rsp" );# define ASM_CALL_CONSTRAINT , "+r" (current_stack_pointer)#else
SAF-1-safe is about symbols "used only by asm modules". This doesn't apply to the declaration here.
Quoted 11 lines
xen/arch/x86/setup.c +1
-0@@ -75,6 +75,7 @@ static bool __initdata opt_invpcid = true;boolean_param ("invpcid" , opt_invpcid);bool __read_mostly use_invpcid; +/* SAF-1-safe Only used in asm code and within this source file */ unsigned long __read_mostly cr4_pv32_mask;/* **** Linux config option: propagated to domain0. */
xen/arch/x86/setup.c cpumask_t __read_mostly cpu_present_map; · line 151
Quoted 5 lines
xen/arch/x86/setup.c +1
-1@@ -147,12 +148,13 @@ cpumask_t __read_mostly cpu_present_map;unsigned long __read_mostly xen_phys_start; char __section(".init.bss.stack_aligned") __aligned(STACK_SIZE) - cpu0_stack[STACK_SIZE ]; + cpu0_stack[STACK_SIZE ];/* SAF-1-safe Only used in asm code and below */
Wasn't it that such comments need to live on the earlier line?
Jan
Re: [XEN PATCH][for-4.19 v4 2/8] x86: add deviations for variables only used in asm code
In reply to Nicola VetriniQuoted 9 lines · Nicola Vetrini
To avoid a violation of MISRA C:2012 Rule 8.4, as permitted by
docs/misra/rules.rst.Signed-off-by Nicola Vetrini <[email protected]>Reviewed-by Stefano Stabellini <[email protected]>---
Changes in v3:
- Edited commit message
- Add two new variables
Oh, also: The R-b dates back to v1. Imo any addition invalidates prior R-b, unless indicated otherwise by the person offering it (which isn't the case here afaict).
Jan
Re: [XEN PATCH][for-4.19 v4 3/8] x86: add deviation comments for asm-only functions
In reply to Nicola VetriniQuoted 10 lines · Nicola Vetrini
As stated in
rules.rst, functions used only in asm code are allowed to have no prior declaration visible when being defined, hence these functions are deviated.
This also fixes violations of MISRA C:2012 Rule 8.4.Signed-off-by Nicola Vetrini <[email protected]>Reviewed-by Stefano Stabellini <[email protected]>---
Changes in v3:
- added SAF deviations for vmx counterparts to svm functions.
Same comment regarding the R-b here as for patch 2.
xen/arch/x86/hvm/svm/intr.c static void svm_enable_intr_window(struct vcpu *v, struct hvm_intack intack) · line 129
Quoted 10 lines
xen/arch/x86/hvm/svm/intr.c +1
-0@@ -123,6 +123,7 @@ static void svm_enable_intr_window(struct vcpu *v, struct hvm_intack intack) vmcb, general1_intercepts | GENERAL1_INTERCEPT_VINTR); } +/* SAF-1-safe */ void svm_intr_assist (void ) {struct vcpu *v = current;
Linux has the concept of "asmlinkage" for functions interfacing C and assembly. Was it considered to use that - even if expanding to nothing for all present architectures - as a way to annotate affected definitions in place of the SAF-*-safe comments?
Jan
Re: [XEN PATCH][for-4.19 v4 4/8] x86/grant: switch included header to make declarations visible
In reply to Nicola VetriniQuoted 6 lines · Nicola Vetrini
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 <[email protected]>Reviewed-by Stefano Stabellini <[email protected]>
Re: [XEN PATCH][for-4.19 v4 2/8] x86: add deviations for variables only used in asm code
In reply to Jan BeulichQuoted 15 lines · Jan Beulich
xen/arch/x86/include/asm/asm_defns.h asm ( "\t.equ CONFIG_INDIRECT_THUNK, " · line 37
Quoted 10 lines · Nicola Vetrini
xen/arch/x86/include/asm/asm_defns.h +1
-0@@ -31,6 +31,7 @@ asm ( "\t.equ CONFIG_INDIRECT_THUNK, "* gets set up by the containing function. */ #ifdef CONFIG_FRAME_POINTER +/* SAF-1-safe */ registerunsigned long current_stack_pointer asm("rsp" );# define ASM_CALL_CONSTRAINT , "+r" (current_stack_pointer)#else SAF-1-safe is about symbols "used only by asm modules". This doesn't apply to the declaration here.
The wording could change to "asm code" if that is deemed clearer.
Quoted 13 lines
Quoted 13 lines
xen/arch/x86/setup.c +1
-0@@ -75,6 +75,7 @@ static bool __initdata opt_invpcid = true;boolean_param ("invpcid" , opt_invpcid);bool __read_mostly use_invpcid; +/* SAF-1-safe Only used in asm code and within this source file */ unsigned long __read_mostly cr4_pv32_mask;/* **** Linux config option: propagated to domain0. */ @@ -147,12 +148,13 @@ cpumask_t __read_mostly cpu_present_map;unsigned long __read_mostly xen_phys_start;
Quoted 8 lines
Quoted 4 lines
xen/arch/x86/setup.c +1
-1char __section(".init.bss.stack_aligned") __aligned(STACK_SIZE) - cpu0_stack[STACK_SIZE ]; + cpu0_stack[STACK_SIZE ];/* SAF-1-safe Only used in asm code and below */
Wasn't it that such comments need to live on the earlier line?
Jan
On the same line is fine as well. I personally found it less clear putting that in the line above.
Signature · 2 lines
Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)
Re: [XEN PATCH][for-4.19 v4 3/8] x86: add deviation comments for asm-only functions
In reply to Jan BeulichQuoted 31 lines · Jan Beulich
Quoted 10 lines · Nicola Vetrini
As stated in
rules.rst, functions used only in asm code are allowed to have no prior declaration visible when being defined, hence these functions are deviated.
This also fixes violations of MISRA C:2012 Rule 8.4.Signed-off-by Nicola Vetrini <[email protected]>Reviewed-by Stefano Stabellini <[email protected]>---
Changes in v3:
- added SAF deviations for vmx counterparts to svm functions.Same comment regarding the R-b here as for patch 2.
Quoted 11 lines
xen/arch/x86/hvm/svm/intr.c +1
-0@@ -123,6 +123,7 @@ static void svm_enable_intr_window(struct vcpu *v, struct hvm_intack intack) vmcb, general1_intercepts | GENERAL1_INTERCEPT_VINTR); } +/* SAF-1-safe */ void svm_intr_assist (void ) {struct vcpu *v = current;Linux has the concept of "asmlinkage" for functions interfacing C and assembly. Was it considered to use that - even if expanding to nothing for all present architectures - as a way to annotate affected definitions in place of the SAF-*-safe comments?
Quoted 1 line
Jan
It was proposed by Julien a while ago (I think it the thread on deviations.rst) to define a macro asmcall that expands to nothing, to mark all such functions. Right now, it's not strictly necessary (given that there are already some uses of SAF in Stefano's for-4.19 branch.
Signature · 2 lines
Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)
Re: [XEN PATCH][for-4.19 v4 2/8] x86: add deviations for variables only used in asm code
In reply to Nicola VetriniQuoted 18 lines · Nicola Vetrini
Quoted 16 lines · Jan Beulich
xen/arch/x86/include/asm/asm_defns.h asm ( "\t.equ CONFIG_INDIRECT_THUNK, " · line 37
Quoted 10 lines · Nicola Vetrini
xen/arch/x86/include/asm/asm_defns.h +1
-0@@ -31,6 +31,7 @@ asm ( "\t.equ CONFIG_INDIRECT_THUNK, "* gets set up by the containing function. */ #ifdef CONFIG_FRAME_POINTER +/* SAF-1-safe */ registerunsigned long current_stack_pointer asm("rsp" );# define ASM_CALL_CONSTRAINT , "+r" (current_stack_pointer)#else SAF-1-safe is about symbols "used only by asm modules". This doesn't apply
to the declaration here.
Quoted 1 line
The wording could change to "asm code" if that is deemed clearer.
Question is what would be meant by "asm code"; "asm modules" is quite clear.
Quoted 20 lines
Quoted 13 lines
Quoted 13 lines
xen/arch/x86/setup.c +1
-0@@ -75,6 +75,7 @@ static bool __initdata opt_invpcid = true;boolean_param ("invpcid" , opt_invpcid);bool __read_mostly use_invpcid; +/* SAF-1-safe Only used in asm code and within this source file */ unsigned long __read_mostly cr4_pv32_mask;/* **** Linux config option: propagated to domain0. */ @@ -147,12 +148,13 @@ cpumask_t __read_mostly cpu_present_map;unsigned long __read_mostly xen_phys_start;Quoted 6 lines
Quoted 4 lines
xen/arch/x86/setup.c +1
-1char __section(".init.bss.stack_aligned") __aligned(STACK_SIZE) - cpu0_stack[STACK_SIZE ]; + cpu0_stack[STACK_SIZE ];/* SAF-1-safe Only used in asm code and below */
Wasn't it that such comments need to live on the earlier line?
Quoted 3 lines
On the same line is fine as well. I personally found it less clear putting that in the
line above.
But please recall that these comments are intended to cover other scanners as well. Iirc only Eclair accepts comments on the same line. Nevertheless I realize that putting the comment on the earlier line is problematic (and maybe also scanner dependent) when that ends up in the middle of a declaration / definition.
Jan
Re: [XEN PATCH][for-4.19 v4 3/8] x86: add deviation comments for asm-only functions
In reply to Nicola VetriniQuoted 33 lines · Nicola Vetrini
Quoted 21 lines · Jan Beulich
Quoted 10 lines · Nicola Vetrini
As stated in
rules.rst, functions used only in asm code are allowed to have no prior declaration visible when being defined, hence these functions are deviated.
This also fixes violations of MISRA C:2012 Rule 8.4.Signed-off-by Nicola Vetrini <[email protected]>Reviewed-by Stefano Stabellini <[email protected]>---
Changes in v3:
- added SAF deviations for vmx counterparts to svm functions.Same comment regarding the R-b here as for patch 2.
Quoted 7 lines
xen/arch/x86/hvm/svm/intr.c +0
-0@@ -123,6 +123,7 @@ static void svm_enable_intr_window(struct vcpu *v, struct hvm_intack intack) vmcb, general1_intercepts | GENERAL1_INTERCEPT_VINTR); }Quoted 10 lines
Quoted 4 lines
xen/arch/x86/hvm/svm/intr.c +1
-0+/* SAF-1-safe */ void svm_intr_assist (void ) {struct vcpu *v = current;Linux has the concept of "asmlinkage" for functions interfacing C and assembly. Was it considered to use that - even if expanding to nothing for all present architectures - as a way to annotate affected definitions
in place of the SAF-*-safe comments?
Quoted 6 lines
It was proposed by Julien a while ago (I think it the thread on
deviations.rst) to define
a macro asmcall that expands to nothing, to mark all such functions. Right now, it's not
strictly necessary (given that there are already some uses of SAF in Stefano's for-4.19 branch.
Can this then be revisited please before any such reaches staging?
Jan
Re: [XEN PATCH][for-4.19 v4 2/8] x86: add deviations for variables only used in asm code
In reply to Jan BeulichQuoted 19 lines · Jan Beulich
Quoted 18 lines · Nicola Vetrini
Quoted 16 lines · Jan Beulich
xen/arch/x86/include/asm/asm_defns.h asm ( "\t.equ CONFIG_INDIRECT_THUNK, " · line 37
Quoted 10 lines · Nicola Vetrini
xen/arch/x86/include/asm/asm_defns.h +1
-0@@ -31,6 +31,7 @@ asm ( "\t.equ CONFIG_INDIRECT_THUNK, "* gets set up by the containing function. */ #ifdef CONFIG_FRAME_POINTER +/* SAF-1-safe */ registerunsigned long current_stack_pointer asm("rsp" );# define ASM_CALL_CONSTRAINT , "+r" (current_stack_pointer)#else SAF-1-safe is about symbols "used only by asm modules". This doesn't apply
to the declaration here.
Quoted 5 lines
Quoted 1 line
The wording could change to "asm code" if that is deemed clearer.
Question is what would be meant by "asm code"; "asm modules" is quite clear.
Well, I don't know. It's up to the community to decide that. It can be an ad-hoc justification, but I don't see much value in doing so. What do you propose to get this patch approved (at least on your account)?.
Quoted 31 lines
Quoted 20 lines
Quoted 13 lines
Quoted 13 lines
xen/arch/x86/setup.c +1
-0@@ -75,6 +75,7 @@ static bool __initdata opt_invpcid = true;boolean_param ("invpcid" , opt_invpcid);bool __read_mostly use_invpcid; +/* SAF-1-safe Only used in asm code and within this source file */ unsigned long __read_mostly cr4_pv32_mask;/* **** Linux config option: propagated to domain0. */ @@ -147,12 +148,13 @@ cpumask_t __read_mostly cpu_present_map;unsigned long __read_mostly xen_phys_start;Quoted 6 lines
Quoted 4 lines
xen/arch/x86/setup.c +1
-1char __section(".init.bss.stack_aligned") __aligned(STACK_SIZE) - cpu0_stack[STACK_SIZE ]; + cpu0_stack[STACK_SIZE ];/* SAF-1-safe Only used in asm code and below */
Wasn't it that such comments need to live on the earlier line?
Quoted 3 lines
On the same line is fine as well. I personally found it less clear putting that in the
line above.But please recall that these comments are intended to cover other scanners as well. Iirc only Eclair accepts comments on the same line. Nevertheless I realize that putting the comment on the earlier line is problematic (and maybe also scanner dependent) when that ends up in the middle of a declaration / definition.
Jan
Signature · 2 lines
Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)
Re: [XEN PATCH][for-4.19 v4 3/8] x86: add deviation comments for asm-only functions
In reply to Jan BeulichQuoted 42 lines · Jan Beulich
Quoted 34 lines · Nicola Vetrini
Quoted 22 lines · Jan Beulich
Quoted 10 lines · Nicola Vetrini
As stated in
rules.rst, functions used only in asm code are allowed to have no prior declaration visible when being defined, hence these functions are deviated.
This also fixes violations of MISRA C:2012 Rule 8.4.Signed-off-by Nicola Vetrini <[email protected]>Reviewed-by Stefano Stabellini <[email protected]>---
Changes in v3:
- added SAF deviations for vmx counterparts to svm functions.Same comment regarding the R-b here as for patch 2.
Quoted 8 lines
xen/arch/x86/hvm/svm/intr.c +0
-0@@ -123,6 +123,7 @@ static void svm_enable_intr_window(struct vcpu *v, struct hvm_intack intack) vmcb, general1_intercepts | GENERAL1_INTERCEPT_VINTR); }Quoted 10 lines
Quoted 4 lines
xen/arch/x86/hvm/svm/intr.c +1
-0+/* SAF-1-safe */ void svm_intr_assist (void ){ struct vcpu *v = current;Linux has the concept of "asmlinkage" for functions interfacing C and assembly. Was it considered to use that - even if expanding to nothing for all present architectures - as a way to annotate affected definitions
in place of the SAF-*-safe comments?Quoted 6 lines
It was proposed by Julien a while ago (I think it the thread on
deviations.rst) to define
a macro asmcall that expands to nothing, to mark all such functions. Right now, it's not
strictly necessary (given that there are already some uses of SAF in Stefano's for-4.19 branch.
Quoted 3 lines
Can this then be revisited please before any such reaches staging?
Jan
I'll let Stefano answer this one.
Signature · 2 lines
Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)
Re: [XEN PATCH][for-4.19 v4 2/8] x86: add deviations for variables only used in asm code
In reply to Nicola VetriniQuoted 26 lines · Nicola Vetrini
Quoted 19 lines · Jan Beulich
Quoted 18 lines · Nicola Vetrini
Quoted 16 lines · Jan Beulich
xen/arch/x86/include/asm/asm_defns.h asm ( "\t.equ CONFIG_INDIRECT_THUNK, " · line 37
Quoted 10 lines · Nicola Vetrini
xen/arch/x86/include/asm/asm_defns.h +1
-0@@ -31,6 +31,7 @@ asm ( "\t.equ CONFIG_INDIRECT_THUNK, "* gets set up by the containing function. */ #ifdef CONFIG_FRAME_POINTER +/* SAF-1-safe */ registerunsigned long current_stack_pointer asm("rsp" );# define ASM_CALL_CONSTRAINT , "+r" (current_stack_pointer)#else SAF-1-safe is about symbols "used only by asm modules". This doesn't apply
to the declaration here.Quoted 5 lines
Quoted 1 line
The wording could change to "asm code" if that is deemed clearer.
Question is what would be meant by "asm code"; "asm modules" is quite clear.
Quoted 5 lines
Well, I don't know. It's up to the community to decide that. It can be an ad-hoc
justification, but I don't see much value in doing so. What do you propose to get this patch
approved (at least on your account)?.
Drop this change and have Eclair recognize that what we're talking about here is just a declaration, not a definition.
Jan
Re: [XEN PATCH][for-4.19 v4 3/8] x86: add deviation comments for asm-only functions
In reply to Nicola VetriniQuoted 42 lines · Nicola Vetrini
Quoted 41 lines · Jan Beulich
Quoted 39 lines · Nicola Vetrini
Quoted 21 lines · Jan Beulich
Quoted 10 lines · Nicola Vetrini
As stated in
rules.rst, functions used only in asm code are allowed to have no prior declaration visible when being defined, hence these functions are deviated.
This also fixes violations of MISRA C:2012 Rule 8.4.Signed-off-by Nicola Vetrini <[email protected]>Reviewed-by Stefano Stabellini <[email protected]>---
Changes in v3:
- added SAF deviations for vmx counterparts to svm functions.Same comment regarding the R-b here as for patch 2.
Quoted 7 lines
xen/arch/x86/hvm/svm/intr.c +0
-0@@ -123,6 +123,7 @@ static void svm_enable_intr_window(struct vcpu *v, struct hvm_intack intack) vmcb, general1_intercepts | GENERAL1_INTERCEPT_VINTR); }Quoted 10 lines
Quoted 4 lines
xen/arch/x86/hvm/svm/intr.c +1
-0+/* SAF-1-safe */ void svm_intr_assist (void ) {struct vcpu *v = current;Linux has the concept of "asmlinkage" for functions interfacing C and assembly. Was it considered to use that - even if expanding to nothing for all present architectures - as a way to annotate affected definitions
in place of the SAF-*-safe comments?It was proposed by Julien a while ago (I think it the thread on
deviations.rst) to define
a macro asmcall that expands to nothing, to mark all such functions. Right now, it's not
strictly necessary (given that there are already some uses of SAF in Stefano's for-4.19 branch.
Quoted 5 lines
Quoted 3 lines
Can this then be revisited please before any such reaches staging?
Jan
I'll let Stefano answer this one.
Yes it can. If Nicola sends new patches I'll make sure to remove the corresponding ones from for-4.19.
Nicola, you might want to send me privately the list of commits to take out from for-4.19.
Re: [XEN PATCH][for-4.19 v4 3/8] x86: add deviation comments for asm-only functions
Quoted 47 lines · Stefano Stabellini
Quoted 46 lines · Nicola Vetrini
Quoted 44 lines · Jan Beulich
Quoted 33 lines · Nicola Vetrini
Quoted 21 lines · Jan Beulich
Quoted 10 lines · Nicola Vetrini
As stated in
rules.rst, functions used only in asm code are allowed to have no prior declaration visible when being defined, hence these functions are deviated.
This also fixes violations of MISRA C:2012 Rule 8.4.Signed-off-by Nicola Vetrini <[email protected]>Reviewed-by Stefano Stabellini <[email protected]>---
Changes in v3:
- added SAF deviations for vmx counterparts to svm functions.Same comment regarding the R-b here as for patch 2.
Quoted 7 lines
xen/arch/x86/hvm/svm/intr.c +0
-0@@ -123,6 +123,7 @@ static void svm_enable_intr_window(struct vcpu *v, struct hvm_intack intack) vmcb, general1_intercepts | GENERAL1_INTERCEPT_VINTR); }Quoted 10 lines
Quoted 4 lines
xen/arch/x86/hvm/svm/intr.c +1
-0+/* SAF-1-safe */ void svm_intr_assist (void ) {struct vcpu *v = current;Linux has the concept of "asmlinkage" for functions interfacing C and assembly. Was it considered to use that - even if expanding to nothing for all present architectures - as a way to annotate affected definitions
in place of the SAF-*-safe comments?Quoted 6 lines
It was proposed by Julien a while ago (I think it the thread on
deviations.rst) to define
a macro asmcall that expands to nothing, to mark all such functions. Right now, it's not
strictly necessary (given that there are already some uses of SAF in Stefano's for-4.19 branch.Can this then be revisited please before any such reaches staging?
Jan
Quoted 7 lines
Quoted 1 line
I'll let Stefano answer this one.
Yes it can. If Nicola sends new patches I'll make sure to remove the corresponding ones from for-4.19.
Nicola, you might want to send me privately the list of commits to take out from for-4.19.
Actually I checked: the involved SAF comments are already in staging, specifically all were part of commit 5a415ef2b24d578d29479e38abda3d5285b9afed
Signature · 2 lines
Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)
Re: [XEN PATCH][for-4.19 v4 3/8] x86: add deviation comments for asm-only functions
Quoted 56 lines · Nicola Vetrini
Quoted 55 lines · Stefano Stabellini
Quoted 45 lines · Nicola Vetrini
Quoted 14 lines · Jan Beulich
Quoted 13 lines · Nicola Vetrini
Quoted 12 lines · Jan Beulich
Quoted 10 lines · Nicola Vetrini
As stated in
rules.rst, functions used only in asm code are allowed to have no prior declaration visible when being defined, hence these functions are deviated.
This also fixes violations of MISRA C:2012 Rule 8.4.Signed-off-by Nicola Vetrini <[email protected]>Reviewed-by Stefano Stabellini <[email protected]>---
Changes in v3:
- added SAF deviations for vmx counterparts to svm functions.Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Same comment regarding the R-b here as for patch 2.
xen/arch/x86/hvm/svm/intr.c static void svm_enable_intr_window(struct vcpu
Quoted 3 lines
xen/arch/x86/hvm/svm/intr.c +0
-0@@ -123,6 +123,7 @@ static void svm_enable_intr_window(struct vcpu*v,
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 8 lines
xen/arch/x86/hvm/svm/intr.c +1
-0struct hvm_intack intack) vmcb, general1_intercepts | GENERAL1_INTERCEPT_VINTR); } +/* SAF-1-safe */ void svm_intr_assist (void ) {struct vcpu *v = current;Linux has the concept of "asmlinkage" for functions interfacing C
and
Quoted 1 line
Quoted 1 line
Quoted 1 line
assembly. Was it considered to use that - even if expanding to
nothing
Quoted 11 lines
Quoted 10 lines
Quoted 3 lines
for all present architectures - as a way to annotate affected definitions
in place of the SAF-*-safe comments?It was proposed by Julien a while ago (I think it the thread on
deviations.rst) to define
a macro asmcall that expands to nothing, to mark all such functions. Right now, it's not
strictly necessary (given that there are already some uses of SAF in Stefano's for-4.19 branch.Quoted 5 lines
Quoted 3 lines
Can this then be revisited please before any such reaches staging?
Jan
I'll let Stefano answer this one.
Yes it can. If Nicola sends new patches I'll make sure to remove the corresponding ones from for-4.19.
Quoted 6 lines
Quoted 2 lines
Nicola, you might want to send me privately the list of commits to take out from for-4.19.
Actually I checked: the involved SAF comments are already in staging, specifically all
were part of commit5a415ef2b24d578d29479e38abda3d5285b9afed
OK. In that case we can still use the asmcall macro to deviate/fix new violations. I suggest we do that. At some point anyone can go ahead and replace those SAF comments with asmcall macros.
Re: [XEN PATCH][for-4.19 v4 3/8] x86: add deviation comments for asm-only functions
Quoted 60 lines · Stefano Stabellini
Quoted 59 lines · Nicola Vetrini
Quoted 57 lines · Stefano Stabellini
Quoted 45 lines · Nicola Vetrini
Quoted 14 lines · Jan Beulich
Quoted 13 lines · Nicola Vetrini
Quoted 12 lines · Jan Beulich
Quoted 10 lines · Nicola Vetrini
As stated in
rules.rst, functions used only in asm code are allowed to have no prior declaration visible when being defined, hence these functions are deviated.
This also fixes violations of MISRA C:2012 Rule 8.4.Signed-off-by Nicola Vetrini <[email protected]>Reviewed-by Stefano Stabellini <[email protected]>---
Changes in v3:
- added SAF deviations for vmx counterparts to svm functions.Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Same comment regarding the R-b here as for patch 2.
xen/arch/x86/hvm/svm/intr.c static void svm_enable_intr_window(struct vcpu
Quoted 3 lines
xen/arch/x86/hvm/svm/intr.c +0
-0@@ -123,6 +123,7 @@ static void svm_enable_intr_window(struct vcpu*v,
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 8 lines
xen/arch/x86/hvm/svm/intr.c +1
-0struct hvm_intack intack) vmcb, general1_intercepts | GENERAL1_INTERCEPT_VINTR); } +/* SAF-1-safe */ void svm_intr_assist (void ) {struct vcpu *v = current;Linux has the concept of "asmlinkage" for functions interfacing C
and
Quoted 1 line
Quoted 1 line
Quoted 1 line
assembly. Was it considered to use that - even if expanding to
nothing
Quoted 11 lines
Quoted 10 lines
Quoted 3 lines
for all present architectures - as a way to annotate affected definitions
in place of the SAF-*-safe comments?It was proposed by Julien a while ago (I think it the thread on
deviations.rst) to define
a macro asmcall that expands to nothing, to mark all such functions. Right now, it's not
strictly necessary (given that there are already some uses of SAF in Stefano's for-4.19 branch.Quoted 5 lines
Quoted 3 lines
Can this then be revisited please before any such reaches staging?
Jan
I'll let Stefano answer this one.
Yes it can. If Nicola sends new patches I'll make sure to remove the corresponding ones from for-4.19.
Nicola, you might want to send me privately the list of commits to take out from for-4.19.
Quoted 7 lines
Quoted 3 lines
Actually I checked: the involved SAF comments are already in staging, specifically all
were part of commit5a415ef2b24d578d29479e38abda3d5285b9afedOK. In that case we can still use the asmcall macro to deviate/fix new violations. I suggest we do that. At some point anyone can go ahead and replace those SAF comments with asmcall macros.
Perhaps asmlinkage is a better fit, so that it wouldn't sound strange applying it to variables.
Signature · 2 lines
Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)
Re: [XEN PATCH][for-4.19 v4 3/8] x86: add deviation comments for asm-only functions
Quoted 70 lines · Nicola Vetrini
Quoted 69 lines · Stefano Stabellini
Quoted 67 lines · Nicola Vetrini
Quoted 16 lines · Stefano Stabellini
Quoted 15 lines · Nicola Vetrini
Quoted 14 lines · Jan Beulich
Quoted 13 lines · Nicola Vetrini
Quoted 12 lines · Jan Beulich
Quoted 10 lines · Nicola Vetrini
As stated in
rules.rst, functions used only in asm code are allowed to have no prior declaration visible when being defined, hence these functions are deviated.
This also fixes violations of MISRA C:2012 Rule 8.4.Signed-off-by Nicola Vetrini <[email protected]>Reviewed-by Stefano Stabellini <[email protected]>---
Changes in v3:
- added SAF deviations for vmx counterparts to svm functions.Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Same comment regarding the R-b here as for patch 2.
xen/arch/x86/hvm/svm/intr.c static void svm_enable_intr_window(struct
Quoted 3 lines
xen/arch/x86/hvm/svm/intr.c +0
-0@@ -123,6 +123,7 @@ static void svm_enable_intr_window(structvcpu
Quoted 3 lines
Quoted 3 lines
*v,
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
xen/arch/x86/hvm/svm/intr.c +0
-0struct hvm_intack intack) vmcb, general1_intercepts |
GENERAL1_INTERCEPT_VINTR);Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
xen/arch/x86/hvm/svm/intr.c +1
-0} +/* SAF-1-safe */ void svm_intr_assist (void ) {struct vcpu *v = current;Linux has the concept of "asmlinkage" for functions interfacing
C
Quoted 10 lines
Quoted 10 lines
and
Quoted 1 line
Quoted 1 line
Quoted 1 line
assembly. Was it considered to use that - even if expanding to
nothing
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
for all present architectures - as a way to annotate affected definitions
in place of the SAF-*-safe comments?It was proposed by Julien a while ago (I think it the thread on
deviations.rst) to define
a macro asmcall that expands to nothing, to mark all suchfunctions.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Right now, it's not
strictly necessary (given that there are already some uses of SAFin
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 1 line
Stefano's for-4.19 branch.
Can this then be revisited please before any such reaches staging?
Jan
Quoted 7 lines
Quoted 1 line
I'll let Stefano answer this one.
Yes it can. If Nicola sends new patches I'll make sure to remove the corresponding ones from for-4.19.
Nicola, you might want to send me privately the list of commits to take out from for-4.19.
Actually I checked: the involved SAF comments are already in staging, specifically all
were part of commit5a415ef2b24d578d29479e38abda3d5285b9afed
Quoted 7 lines
Quoted 3 lines
OK. In that case we can still use the asmcall macro to deviate/fix new violations. I suggest we do that. At some point anyone can go ahead and replace those SAF comments with asmcall macros.
Perhaps asmlinkage is a better fit, so that it wouldn't sound strange applying it to
variables.
asmlinkage is good