lkml.org 
[lkml]   [2023]   [Feb]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2 05/29] LoongArch: KVM: Add vcpu related header files
From
Date
On Tue, 2023-02-21 at 14:46 +0800, maobibo wrote:
> > On Mon, 2023-02-20 at 14:57 +0800, Tianrui Zhao wrote:
> > > +/* GCSR */
> > > +static inline u64 gcsr_read(u32 reg)
> > > +{
> > > +       u64 val = 0;
> > > +
> > > +       asm volatile (
> > > +               "parse_r __reg, %[val]\n\t"
> > > +               ".word 0x5 << 24 | %[reg] << 10 | 0 << 5 | __reg\n\t"
> >
> > Don't do this.  You should add the instruction to binutils first, then
> > make CONFIG_KVM depend on the assembler supporting this instruction.
> > This is completely unreadable and only fine for an internal PoC.
>
> We are preparing to submit these instruction support for binutils,
> however it is still necessary. Supposing that it is supported in future
> gcc version, we can not drop existing gcc 12/13 supporting to compiling
> kernel with LoongArch architecture.

You can drop the support for KVM with less capable Binutils versions,
like:

config AS_HAS_LVZ
def_bool $(as-instr some_gcsr_insn \$r0, \$gcsr0)

config KVM
depends on AS_HAS_LVZ

>
> Maybe there will be human readable code like this:
> #if GCC_SUPPORT_KVM_INSTR
>   ...
> #else
>   asm volatile (".word   "
>   ...
> #endif
>
> Regards
> Bibo, Mao

--
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University

\
 
 \ /
  Last update: 2023-03-27 00:29    [W:0.088 / U:0.332 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site