All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: Jordan Niethe <jniethe5@gmail.com>, linuxppc-dev@lists.ozlabs.org
Cc: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, npiggin@gmail.com,
	mikey@neuling.org, paulus@ozlabs.org, vaibhav@linux.ibm.com,
	sbhat@linux.ibm.com, gautam@linux.ibm.com,
	kconsul@linux.vnet.ibm.com, amachhiw@linux.vnet.ibm.com,
	Jordan Niethe <jniethe5@gmail.com>
Subject: Re: [PATCH v3 1/6] KVM: PPC: Use getters and setters for vcpu register state
Date: Thu, 17 Aug 2023 03:25:58 +0000	[thread overview]
Message-ID: <87cyzm73jt.fsf@mail.lhotse> (raw)
In-Reply-To: <20230807014553.1168699-2-jniethe5@gmail.com>

Jordan Niethe <jniethe5@gmail.com> writes:
> There are already some getter and setter functions used for accessing
> vcpu register state, e.g. kvmppc_get_pc(). There are also more
> complicated examples that are generated by macros like
> kvmppc_get_sprg0() which are generated by the SHARED_SPRNG_WRAPPER()
> macro.
>

...
> diff --git a/arch/powerpc/include/asm/kvm_book3s.h b/arch/powerpc/include/asm/kvm_book3s.h
> index bbf5e2c5fe09..1a7e837ea2d5 100644
> --- a/arch/powerpc/include/asm/kvm_book3s.h
> +++ b/arch/powerpc/include/asm/kvm_book3s.h
> @@ -403,10 +413,121 @@ static inline ulong kvmppc_get_fault_dar(struct kvm_vcpu *vcpu)
...
> +
> +#ifdef CONFIG_VSX
> +static inline void kvmppc_get_vsx_vr(struct kvm_vcpu *vcpu, int i, vector128 *v)
> +{
> +	*v =  vcpu->arch.vr.vr[i];
> +}

This is causing build errors if VSX is disabled.

I'm using g5_defconfig plus:

  CONFIG_VIRTUALIZATION=y
  CONFIG_KVM_BOOK3S_64=y
  CONFIG_KVM_BOOK3S_64_PR=y

Which gives me:

  ../arch/powerpc/kvm/powerpc.c: In function ‘kvmppc_set_vmx_dword’:
  ../arch/powerpc/kvm/powerpc.c:1061:9: error: implicit declaration of function ‘kvmppc_get_vsx_vr’; did you mean ‘kvmppc_get_vsx_fpr’? [-Werror=implicit-function-declaration]
   1061 |         kvmppc_get_vsx_vr(vcpu, index, &val.vval);
        |         ^~~~~~~~~~~~~~~~~
        |         kvmppc_get_vsx_fpr
  ../arch/powerpc/kvm/powerpc.c:1063:9: error: implicit declaration of function ‘kvmppc_set_vsx_vr’; did you mean ‘kvmppc_set_vsx_fpr’? [-Werror=implicit-function-declaration]
   1063 |         kvmppc_set_vsx_vr(vcpu, index, &val.vval);
        |         ^~~~~~~~~~~~~~~~~
        |         kvmppc_set_vsx_fpr
  In file included from ../arch/powerpc/kvm/powerpc.c:25:
  ../arch/powerpc/kvm/powerpc.c: In function ‘kvm_vcpu_ioctl_get_one_reg’:
  ../arch/powerpc/kvm/powerpc.c:1729:52: error: implicit declaration of function ‘kvmppc_get_vscr’; did you mean ‘kvmppc_get_sr’? [-Werror=implicit-function-declaration]
   1729 |                         val = get_reg_val(reg->id, kvmppc_get_vscr(vcpu));
        |                                                    ^~~~~~~~~~~~~~~
  ../arch/powerpc/include/asm/kvm_ppc.h:412:29: note: in definition of macro ‘get_reg_val’
    412 |         case 4: __u.wval = (reg); break;        \
        |                             ^~~
  ../arch/powerpc/kvm/powerpc.c: In function ‘kvm_vcpu_ioctl_set_one_reg’:
  ../arch/powerpc/kvm/powerpc.c:1780:25: error: implicit declaration of function ‘kvmppc_set_vscr’; did you mean ‘kvmppc_set_fscr’? [-Werror=implicit-function-declaration]
   1780 |                         kvmppc_set_vscr(vcpu, set_reg_val(reg->id, val));
        |                         ^~~~~~~~~~~~~~~
        |                         kvmppc_set_fscr


Looking at kvm_vcpu_arch, the thread_vr_state and members are guarded by
CONFIG_ALTIVEC, not CONFIG_VSX.

Switching to that fixes the build.

Whether it makes sense to be getting/setting those registers when VSX=n
is not immediately clear, but is a separate problem.

cheers

WARNING: multiple messages have this Message-ID (diff)
From: Michael Ellerman <mpe@ellerman.id.au>
To: Jordan Niethe <jniethe5@gmail.com>, linuxppc-dev@lists.ozlabs.org
Cc: mikey@neuling.org, sbhat@linux.ibm.com, kvm@vger.kernel.org,
	amachhiw@linux.vnet.ibm.com, Jordan Niethe <jniethe5@gmail.com>,
	gautam@linux.ibm.com, npiggin@gmail.com, kvm-ppc@vger.kernel.org,
	vaibhav@linux.ibm.com, kconsul@linux.vnet.ibm.com
Subject: Re: [PATCH v3 1/6] KVM: PPC: Use getters and setters for vcpu register state
Date: Thu, 17 Aug 2023 13:25:58 +1000	[thread overview]
Message-ID: <87cyzm73jt.fsf@mail.lhotse> (raw)
In-Reply-To: <20230807014553.1168699-2-jniethe5@gmail.com>

Jordan Niethe <jniethe5@gmail.com> writes:
> There are already some getter and setter functions used for accessing
> vcpu register state, e.g. kvmppc_get_pc(). There are also more
> complicated examples that are generated by macros like
> kvmppc_get_sprg0() which are generated by the SHARED_SPRNG_WRAPPER()
> macro.
>

...
> diff --git a/arch/powerpc/include/asm/kvm_book3s.h b/arch/powerpc/include/asm/kvm_book3s.h
> index bbf5e2c5fe09..1a7e837ea2d5 100644
> --- a/arch/powerpc/include/asm/kvm_book3s.h
> +++ b/arch/powerpc/include/asm/kvm_book3s.h
> @@ -403,10 +413,121 @@ static inline ulong kvmppc_get_fault_dar(struct kvm_vcpu *vcpu)
...
> +
> +#ifdef CONFIG_VSX
> +static inline void kvmppc_get_vsx_vr(struct kvm_vcpu *vcpu, int i, vector128 *v)
> +{
> +	*v =  vcpu->arch.vr.vr[i];
> +}

This is causing build errors if VSX is disabled.

I'm using g5_defconfig plus:

  CONFIG_VIRTUALIZATION=y
  CONFIG_KVM_BOOK3S_64=y
  CONFIG_KVM_BOOK3S_64_PR=y

Which gives me:

  ../arch/powerpc/kvm/powerpc.c: In function ‘kvmppc_set_vmx_dword’:
  ../arch/powerpc/kvm/powerpc.c:1061:9: error: implicit declaration of function ‘kvmppc_get_vsx_vr’; did you mean ‘kvmppc_get_vsx_fpr’? [-Werror=implicit-function-declaration]
   1061 |         kvmppc_get_vsx_vr(vcpu, index, &val.vval);
        |         ^~~~~~~~~~~~~~~~~
        |         kvmppc_get_vsx_fpr
  ../arch/powerpc/kvm/powerpc.c:1063:9: error: implicit declaration of function ‘kvmppc_set_vsx_vr’; did you mean ‘kvmppc_set_vsx_fpr’? [-Werror=implicit-function-declaration]
   1063 |         kvmppc_set_vsx_vr(vcpu, index, &val.vval);
        |         ^~~~~~~~~~~~~~~~~
        |         kvmppc_set_vsx_fpr
  In file included from ../arch/powerpc/kvm/powerpc.c:25:
  ../arch/powerpc/kvm/powerpc.c: In function ‘kvm_vcpu_ioctl_get_one_reg’:
  ../arch/powerpc/kvm/powerpc.c:1729:52: error: implicit declaration of function ‘kvmppc_get_vscr’; did you mean ‘kvmppc_get_sr’? [-Werror=implicit-function-declaration]
   1729 |                         val = get_reg_val(reg->id, kvmppc_get_vscr(vcpu));
        |                                                    ^~~~~~~~~~~~~~~
  ../arch/powerpc/include/asm/kvm_ppc.h:412:29: note: in definition of macro ‘get_reg_val’
    412 |         case 4: __u.wval = (reg); break;        \
        |                             ^~~
  ../arch/powerpc/kvm/powerpc.c: In function ‘kvm_vcpu_ioctl_set_one_reg’:
  ../arch/powerpc/kvm/powerpc.c:1780:25: error: implicit declaration of function ‘kvmppc_set_vscr’; did you mean ‘kvmppc_set_fscr’? [-Werror=implicit-function-declaration]
   1780 |                         kvmppc_set_vscr(vcpu, set_reg_val(reg->id, val));
        |                         ^~~~~~~~~~~~~~~
        |                         kvmppc_set_fscr


Looking at kvm_vcpu_arch, the thread_vr_state and members are guarded by
CONFIG_ALTIVEC, not CONFIG_VSX.

Switching to that fixes the build.

Whether it makes sense to be getting/setting those registers when VSX=n
is not immediately clear, but is a separate problem.

cheers

WARNING: multiple messages have this Message-ID (diff)
From: Michael Ellerman <mpe@ellerman.id.au>
To: Jordan Niethe <jniethe5@gmail.com>, linuxppc-dev@lists.ozlabs.org
Cc: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, npiggin@gmail.com,
	mikey@neuling.org, paulus@ozlabs.org, vaibhav@linux.ibm.com,
	sbhat@linux.ibm.com, gautam@linux.ibm.com,
	kconsul@linux.vnet.ibm.com, amachhiw@linux.vnet.ibm.com,
	Jordan Niethe <jniethe5@gmail.com>
Subject: Re: [PATCH v3 1/6] KVM: PPC: Use getters and setters for vcpu register state
Date: Thu, 17 Aug 2023 13:25:58 +1000	[thread overview]
Message-ID: <87cyzm73jt.fsf@mail.lhotse> (raw)
In-Reply-To: <20230807014553.1168699-2-jniethe5@gmail.com>

Jordan Niethe <jniethe5@gmail.com> writes:
> There are already some getter and setter functions used for accessing
> vcpu register state, e.g. kvmppc_get_pc(). There are also more
> complicated examples that are generated by macros like
> kvmppc_get_sprg0() which are generated by the SHARED_SPRNG_WRAPPER()
> macro.
>

...
> diff --git a/arch/powerpc/include/asm/kvm_book3s.h b/arch/powerpc/include/asm/kvm_book3s.h
> index bbf5e2c5fe09..1a7e837ea2d5 100644
> --- a/arch/powerpc/include/asm/kvm_book3s.h
> +++ b/arch/powerpc/include/asm/kvm_book3s.h
> @@ -403,10 +413,121 @@ static inline ulong kvmppc_get_fault_dar(struct kvm_vcpu *vcpu)
...
> +
> +#ifdef CONFIG_VSX
> +static inline void kvmppc_get_vsx_vr(struct kvm_vcpu *vcpu, int i, vector128 *v)
> +{
> +	*v =  vcpu->arch.vr.vr[i];
> +}

This is causing build errors if VSX is disabled.

I'm using g5_defconfig plus:

  CONFIG_VIRTUALIZATION=y
  CONFIG_KVM_BOOK3S_64=y
  CONFIG_KVM_BOOK3S_64_PR=y

Which gives me:

  ../arch/powerpc/kvm/powerpc.c: In function ‘kvmppc_set_vmx_dword’:
  ../arch/powerpc/kvm/powerpc.c:1061:9: error: implicit declaration of function ‘kvmppc_get_vsx_vr’; did you mean ‘kvmppc_get_vsx_fpr’? [-Werror=implicit-function-declaration]
   1061 |         kvmppc_get_vsx_vr(vcpu, index, &val.vval);
        |         ^~~~~~~~~~~~~~~~~
        |         kvmppc_get_vsx_fpr
  ../arch/powerpc/kvm/powerpc.c:1063:9: error: implicit declaration of function ‘kvmppc_set_vsx_vr’; did you mean ‘kvmppc_set_vsx_fpr’? [-Werror=implicit-function-declaration]
   1063 |         kvmppc_set_vsx_vr(vcpu, index, &val.vval);
        |         ^~~~~~~~~~~~~~~~~
        |         kvmppc_set_vsx_fpr
  In file included from ../arch/powerpc/kvm/powerpc.c:25:
  ../arch/powerpc/kvm/powerpc.c: In function ‘kvm_vcpu_ioctl_get_one_reg’:
  ../arch/powerpc/kvm/powerpc.c:1729:52: error: implicit declaration of function ‘kvmppc_get_vscr’; did you mean ‘kvmppc_get_sr’? [-Werror=implicit-function-declaration]
   1729 |                         val = get_reg_val(reg->id, kvmppc_get_vscr(vcpu));
        |                                                    ^~~~~~~~~~~~~~~
  ../arch/powerpc/include/asm/kvm_ppc.h:412:29: note: in definition of macro ‘get_reg_val’
    412 |         case 4: __u.wval = (reg); break;        \
        |                             ^~~
  ../arch/powerpc/kvm/powerpc.c: In function ‘kvm_vcpu_ioctl_set_one_reg’:
  ../arch/powerpc/kvm/powerpc.c:1780:25: error: implicit declaration of function ‘kvmppc_set_vscr’; did you mean ‘kvmppc_set_fscr’? [-Werror=implicit-function-declaration]
   1780 |                         kvmppc_set_vscr(vcpu, set_reg_val(reg->id, val));
        |                         ^~~~~~~~~~~~~~~
        |                         kvmppc_set_fscr


Looking at kvm_vcpu_arch, the thread_vr_state and members are guarded by
CONFIG_ALTIVEC, not CONFIG_VSX.

Switching to that fixes the build.

Whether it makes sense to be getting/setting those registers when VSX=n
is not immediately clear, but is a separate problem.

cheers

  parent reply	other threads:[~2023-08-17  3:25 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-07  1:45 [PATCH v3 0/6] KVM: PPC: Nested APIv2 guest support Jordan Niethe
2023-08-07  1:45 ` Jordan Niethe
2023-08-07  1:45 ` Jordan Niethe
2023-08-07  1:45 ` [PATCH v3 1/6] KVM: PPC: Use getters and setters for vcpu register state Jordan Niethe
2023-08-07  1:45   ` Jordan Niethe
2023-08-07  1:45   ` Jordan Niethe
2023-08-14  8:08   ` Nicholas Piggin
2023-08-14  8:08     ` Nicholas Piggin
2023-08-14  8:08     ` Nicholas Piggin
2023-08-16  3:11     ` Jordan Niethe
2023-08-16  3:11       ` Jordan Niethe
2023-08-16  3:11       ` Jordan Niethe
2023-08-17  3:25   ` Michael Ellerman [this message]
2023-08-17  3:25     ` Michael Ellerman
2023-08-17  3:25     ` Michael Ellerman
2023-08-07  1:45 ` [PATCH v3 2/6] KVM: PPC: Rename accessor generator macros Jordan Niethe
2023-08-07  1:45   ` Jordan Niethe
2023-08-07  1:45   ` Jordan Niethe
2023-08-14  8:27   ` Nicholas Piggin
2023-08-14  8:27     ` Nicholas Piggin
2023-08-14  8:27     ` Nicholas Piggin
2023-08-16  3:20     ` Jordan Niethe
2023-08-16  3:20       ` Jordan Niethe
2023-08-16  3:20       ` Jordan Niethe
2023-08-07  1:45 ` [PATCH v3 3/6] KVM: PPC: Add helper library for Guest State Buffers Jordan Niethe
2023-08-07  1:45   ` Jordan Niethe
2023-08-07  1:45   ` Jordan Niethe
2023-08-07  1:45 ` [PATCH v3 4/6] KVM: PPC: Book3s HV: Hold LPIDs in an unsigned long Jordan Niethe
2023-08-07  1:45   ` Jordan Niethe
2023-08-07  1:45   ` Jordan Niethe
2023-08-14  8:12   ` Nicholas Piggin
2023-08-14  8:12     ` Nicholas Piggin
2023-08-14  8:12     ` Nicholas Piggin
2023-08-15 10:45     ` Michael Ellerman
2023-08-15 10:45       ` Michael Ellerman
2023-08-15 10:45       ` Michael Ellerman
2023-08-16  3:21       ` Jordan Niethe
2023-08-16  3:21         ` Jordan Niethe
2023-08-16  3:21         ` Jordan Niethe
2023-08-16  3:14     ` Jordan Niethe
2023-08-16  3:14       ` Jordan Niethe
2023-08-16  3:14       ` Jordan Niethe
2023-08-14  8:15   ` David Laight
2023-08-16  3:19     ` Jordan Niethe
2023-08-16  3:19       ` Jordan Niethe
2023-08-17 12:21   ` Michael Ellerman
2023-08-17 12:21     ` Michael Ellerman
2023-08-17 12:21     ` Michael Ellerman
2023-08-07  1:45 ` [PATCH v3 5/6] KVM: PPC: Add support for nestedv2 guests Jordan Niethe
2023-08-07  1:45   ` Jordan Niethe
2023-08-07  1:45   ` Jordan Niethe
2023-08-17  4:19   ` Michael Ellerman
2023-08-17  4:19     ` Michael Ellerman
2023-08-17  4:19     ` Michael Ellerman
2023-08-17 12:23   ` Michael Ellerman
2023-08-17 12:23     ` Michael Ellerman
2023-08-17 12:23     ` Michael Ellerman
2023-08-07  1:45 ` [PATCH v3 6/6] docs: powerpc: Document nested KVM on POWER Jordan Niethe
2023-08-07  1:45   ` Jordan Niethe
2023-08-07  1:45   ` Jordan Niethe

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=87cyzm73jt.fsf@mail.lhotse \
    --to=mpe@ellerman.id.au \
    --cc=amachhiw@linux.vnet.ibm.com \
    --cc=gautam@linux.ibm.com \
    --cc=jniethe5@gmail.com \
    --cc=kconsul@linux.vnet.ibm.com \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mikey@neuling.org \
    --cc=npiggin@gmail.com \
    --cc=paulus@ozlabs.org \
    --cc=sbhat@linux.ibm.com \
    --cc=vaibhav@linux.ibm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.