Re: [PATCH v2 05/29] LoongArch: KVM: Add vcpu related header files

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

 



On 2/21/23 07:46, maobibo wrote:
+       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.

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

I agree, just add a comment with what would be the assembly code, i.e. something like

	/* Instructions only available in binutils v.... or later */
	asm volatile (
               "parse_r __reg, %[val]\n\t"
	       /* instrname %[val], %[reg] */
               ".word 0x5 << 24 | %[reg] << 10 | 0 << 5 | __reg\n\t"

Paolo




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux