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 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.

> +               : [val] "+r" (val)
> +               : [reg] "i" (reg)
> +               : "memory");
> +
> +       return val;
> +}

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




[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