mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Xi Ruoyao <xry111@xry111.site>
To: kernel test robot <lkp@intel.com>,
	Tianrui Zhao <zhaotianrui@loongson.cn>,
	Paolo Bonzini <pbonzini@redhat.com>
Cc: oe-kbuild-all@lists.linux.dev,
	Huacai Chen <chenhuacai@kernel.org>,
	WANG Xuerui <kernel@xen0n.name>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	loongarch@lists.linux.dev, linux-kernel@vger.kernel.org,
	kvm@vger.kernel.org, Jens Axboe <axboe@kernel.dk>,
	Mark Brown <broonie@kernel.org>,
	Alex Deucher <alexander.deucher@amd.com>,
	Oliver Upton <oliver.upton@linux.dev>,
	maobibo@loongson.cn
Subject: Re: [PATCH v6 29/30] LoongArch: KVM: Enable kvm config and add the makefile
Date: Thu, 13 Apr 2023 16:33:10 +0800	[thread overview]
Message-ID: <ee3b287c78d9fbbbc996a787053b4c37fe365c2c.camel@xry111.site> (raw)
In-Reply-To: <202304131526.iXfLaVZc-lkp@intel.com>

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@xry111.site>
School of Aerospace Science and Technology, Xidian University

  reply	other threads:[~2023-04-13  8:33 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-12  8:29 [PATCH v6 00/30] Add KVM LoongArch support Tianrui Zhao
2023-04-12  8:29 ` [PATCH v6 01/30] LoongArch: KVM: Add kvm related header files Tianrui Zhao
2023-04-12  8:29 ` [PATCH v6 02/30] LoongArch: KVM: Implement kvm module related interface Tianrui Zhao
2023-04-12  8:29 ` [PATCH v6 03/30] LoongArch: KVM: Implement kvm hardware enable, disable interface Tianrui Zhao
2023-04-12  8:29 ` [PATCH v6 04/30] LoongArch: KVM: Implement VM related functions Tianrui Zhao
2023-04-12  8:29 ` [PATCH v6 05/30] LoongArch: KVM: Add vcpu related header files Tianrui Zhao
2023-04-12  8:29 ` [PATCH v6 06/30] LoongArch: KVM: Implement vcpu create and destroy interface Tianrui Zhao
2023-04-12  8:30 ` [PATCH v6 07/30] LoongArch: KVM: Implement vcpu run interface Tianrui Zhao
2023-04-12  8:30 ` [PATCH v6 08/30] LoongArch: KVM: Implement vcpu handle exit interface Tianrui Zhao
2023-04-12  8:30 ` [PATCH v6 09/30] LoongArch: KVM: Implement vcpu get, vcpu set registers Tianrui Zhao
2023-04-12  8:30 ` [PATCH v6 10/30] LoongArch: KVM: Implement vcpu ENABLE_CAP ioctl interface Tianrui Zhao
2023-04-12  8:30 ` [PATCH v6 11/30] LoongArch: KVM: Implement fpu related operations for vcpu Tianrui Zhao
2023-04-12  8:30 ` [PATCH v6 12/30] LoongArch: KVM: Implement vcpu interrupt operations Tianrui Zhao
2023-04-12  8:30 ` [PATCH v6 13/30] LoongArch: KVM: Implement misc vcpu related interfaces Tianrui Zhao
2023-04-12  8:30 ` [PATCH v6 14/30] LoongArch: KVM: Implement vcpu load and vcpu put operations Tianrui Zhao
2023-04-12  8:30 ` [PATCH v6 15/30] LoongArch: KVM: Implement vcpu status description Tianrui Zhao
2023-04-12  8:30 ` [PATCH v6 16/30] LoongArch: KVM: Implement update VM id function Tianrui Zhao
2023-04-12  8:30 ` [PATCH v6 17/30] LoongArch: KVM: Implement virtual machine tlb operations Tianrui Zhao
2023-04-12  8:30 ` [PATCH v6 18/30] LoongArch: KVM: Implement vcpu timer operations Tianrui Zhao
2023-04-12  8:30 ` [PATCH v6 19/30] LoongArch: KVM: Implement kvm mmu operations Tianrui Zhao
2023-04-12  8:30 ` [PATCH v6 20/30] LoongArch: KVM: Implement handle csr excption Tianrui Zhao
2023-04-12  8:30 ` [PATCH v6 21/30] LoongArch: KVM: Implement handle iocsr exception Tianrui Zhao
2023-04-12  8:30 ` [PATCH v6 22/30] LoongArch: KVM: Implement handle idle exception Tianrui Zhao
2023-04-12  8:30 ` [PATCH v6 23/30] LoongArch: KVM: Implement handle gspr exception Tianrui Zhao
2023-04-12  8:30 ` [PATCH v6 24/30] LoongArch: KVM: Implement handle mmio exception Tianrui Zhao
2023-04-12  8:30 ` [PATCH v6 25/30] LoongArch: KVM: Implement handle fpu exception Tianrui Zhao
2023-04-12  8:30 ` [PATCH v6 26/30] LoongArch: KVM: Implement kvm exception vector Tianrui Zhao
2023-04-12  8:30 ` [PATCH v6 27/30] LoongArch: KVM: Implement vcpu world switch Tianrui Zhao
2023-04-12  8:30 ` [PATCH v6 28/30] LoongArch: KVM: Implement probe virtualization when loongarch cpu init Tianrui Zhao
2023-04-12  8:30 ` [PATCH v6 29/30] LoongArch: KVM: Enable kvm config and add the makefile Tianrui Zhao
2023-04-13  7:32   ` kernel test robot
2023-04-13  8:33     ` Xi Ruoyao [this message]
2023-04-13 11:52       ` Tianrui Zhao
2023-04-12  8:30 ` [PATCH v6 30/30] LoongArch: KVM: Supplement kvm document about loongarch-specific part Tianrui Zhao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ee3b287c78d9fbbbc996a787053b4c37fe365c2c.camel@xry111.site \
    --to=xry111@xry111.site \
    --cc=alexander.deucher@amd.com \
    --cc=axboe@kernel.dk \
    --cc=broonie@kernel.org \
    --cc=chenhuacai@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@xen0n.name \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=loongarch@lists.linux.dev \
    --cc=maobibo@loongson.cn \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=oliver.upton@linux.dev \
    --cc=pbonzini@redhat.com \
    --cc=zhaotianrui@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®