[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <497693ca2cbc443c1d9f796c3aace6c9987bec72.camel@xry111.site>
Date: Tue, 21 Feb 2023 12:44:52 +0800
From: Xi Ruoyao <xry111@...111.site>
To: Tianrui Zhao <zhaotianrui@...ngson.cn>,
Paolo Bonzini <pbonzini@...hat.com>
Cc: Huacai Chen <chenhuacai@...nel.org>,
WANG Xuerui <kernel@...0n.name>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
loongarch@...ts.linux.dev, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org, Jens Axboe <axboe@...nel.dk>,
Mark Brown <broonie@...nel.org>,
Alex Deucher <alexander.deucher@....com>,
Oliver Upton <oliver.upton@...ux.dev>, maobibo@...ngson.cn
Subject: Re: [PATCH v2 05/29] LoongArch: KVM: Add vcpu related header files
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@...111.site>
School of Aerospace Science and Technology, Xidian University
Powered by blists - more mailing lists