|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v3 06/39] xen/riscv: introduce device-agnostic MMIO emulation dispatch
On 10/5/26 12:01 PM, Baptiste Le Duc wrote: [...] diff --git a/xen/arch/riscv/include/asm/mmio.h b/xen/arch/riscv/include/asm/mmio.h new file mode 100644 index 0000000000..1bf48571a9 --- /dev/null +++ b/xen/arch/riscv/include/asm/mmio.h @@ -0,0 +1,63 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#ifndef RISCV_MMIO_HShould be ASM__RISCV_MMIO_H instead to be consistant with other header files in riscv/include/asm. According to the coding style document it should be <arch>_<something>_H. I understand that some headers in RISC-V looks in the way ASM__arch_something_H only becuase they were introduced before the header guard recommendations have been updated. I think I could suggest a separate patch to rename all header guards, at least, for RISC-V to avoid such type of confusion in future.
I will fix that. + IO_ABORT, /* The IO was handled and led to an abort. */ + IO_HANDLED, /* The IO was successfully handled. */ + IO_UNHANDLED, /* No handler found for the IO. */ +}; + [...]
Sure, I'll drop the else and go with the first variant in the next version.I am not too much into MISRA stuff and just for my education could you please specify what MISRA rule has been violdated here? I suppose it is because of Rule 2.2 (or 2.1?). I don't think Rule 2.2 applies here. MISRA C:2012 defines dead code as "any operation that is executed but whose removal would not affect program behaviour" (as quoted in [1], Section IV). The else doesn't introduce any such operation: both forms have the same semantics, and the read() call under the else is executed whenever is_write is false, so it is neither dead nor unreachable (Rule 2.1). FWIW, I also compared what gcc 16 generates for RISC-V: at -O0 and -Os the variants with and without the else are byte-identical, and at -O1/-O2 the only difference is which of the two calls is laid out as thefall-through path; the instructions are otherwise the same. But probably this is not the best way to verify things... Also, R2.2 is disapplied project-wide for Xen anyway (see docs/misra/deviations.rst). [1] https://arxiv.org/abs/2212.13933 If I am not confused something above then why thos option doesn't violate MISRA rule abouve 'dead code' isn't ternary operation just an equivalent to if/else? Thanks for review! ~ Oleksii
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |