lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ee3b287c78d9fbbbc996a787053b4c37fe365c2c.camel@xry111.site>
Date:   Thu, 13 Apr 2023 16:33:10 +0800
From:   Xi Ruoyao <xry111@...111.site>
To:     kernel test robot <lkp@...el.com>,
        Tianrui Zhao <zhaotianrui@...ngson.cn>,
        Paolo Bonzini <pbonzini@...hat.com>
Cc:     oe-kbuild-all@...ts.linux.dev, 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 v6 29/30] LoongArch: KVM: Enable kvm config and add the
 makefile

On Thu, 2023-04-13 at 15:32 +0800, kernel test robot wrote:

> vim +/asm +244 arch/loongarch/include/asm/loongarch.h
> 
> f2ac457a61389b Huacai Chen  2022-05-31  238  
> 2c87b678639d25 Tianrui Zhao 2023-04-12  239  /* GCSR */
> 2c87b678639d25 Tianrui Zhao 2023-04-12  240  static inline u64 gcsr_read(u32 reg)

Try __always_inline instead of inline because this "function" will
definitely break up if it's not inlined.

And I guess we should have something like:

extern u64 __compiletime_error("gcsr_read parameter is not a constant") 
__gcsr_read_non_const(void);

static __always_inline u64 gcsr_read(u32 reg)
{
	u64 val = 0;

	if (!__builtin_constant_p(reg))
		return __gcsr_read_non_const();

	asm volatile (
... ...

Or perhaps we should just rewrite gcsr_read to a macro.

> 2c87b678639d25 Tianrui Zhao 2023-04-12  241  {
> 2c87b678639d25 Tianrui Zhao 2023-04-12  242     u64 val = 0;
> 2c87b678639d25 Tianrui Zhao 2023-04-12  243     /* Instructions will be available in binutils later */
> 2c87b678639d25 Tianrui Zhao 2023-04-12 @244     asm volatile (
> 2c87b678639d25 Tianrui Zhao 2023-04-12  245             "parse_r __reg, %[val]\n\t"
> 2c87b678639d25 Tianrui Zhao 2023-04-12  246             /*
> 2c87b678639d25 Tianrui Zhao 2023-04-12  247              * read val from guest csr register %[reg]
> 2c87b678639d25 Tianrui Zhao 2023-04-12  248              * gcsrrd %[val], %[reg]
> 2c87b678639d25 Tianrui Zhao 2023-04-12  249              */
> 2c87b678639d25 Tianrui Zhao 2023-04-12  250             ".word 0x5 << 24 | %[reg] << 10 | 0 << 5 | __reg\n\t"
> 2c87b678639d25 Tianrui Zhao 2023-04-12  251             : [val] "+r" (val)
> 2c87b678639d25 Tianrui Zhao 2023-04-12  252             : [reg] "i" (reg)
> 2c87b678639d25 Tianrui Zhao 2023-04-12  253             : "memory");
> 2c87b678639d25 Tianrui Zhao 2023-04-12  254  
> 2c87b678639d25 Tianrui Zhao 2023-04-12  255     return val;
> 2c87b678639d25 Tianrui Zhao 2023-04-12  256  }
> 2c87b678639d25 Tianrui Zhao 2023-04-12  257  
> 

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ