From: Michael Mueller <mimu@linux.ibm.com>
To: Steffen Eiden <seiden@linux.ibm.com>,
qemu-s390x@nongnu.org, qemu-devel@nongnu.org
Cc: Janosch Frank <frankja@linux.ibm.com>,
Thomas Huth <thuth@redhat.com>,
David Hildenbrand <david@redhat.com>,
Michael Mueller <mimu@linux.vnet.ibm.com>,
Marc Hartmayer <mhartmay@linux.ibm.com>,
Christian Borntraeger <borntraeger@linux.ibm.com>
Subject: Re: [PATCH v2 2/3] target/s390x/kvm: Refactor AP functionalities
Date: Thu, 17 Aug 2023 14:43:59 +0200 [thread overview]
Message-ID: <e8320e83-0b5d-f397-6a32-a48ecb8be5b0@linux.ibm.com> (raw)
In-Reply-To: <20230810124719.2167260-3-seiden@linux.ibm.com>
On 10.08.23 14:47, Steffen Eiden wrote:
> kvm_s390_set_attr() is a misleading name as it only sets attributes for
> the KVM_S390_VM_CRYPTO group. Therefore, rename it to
> kvm_s390_set_crypto_attr().
>
> Add new functions ap_available() and ap_enabled() to avoid code
> duplication later.
>
> Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
Reviewed-by: Michael Mueller <mimu@linux.ibm.com>
> ---
> target/s390x/kvm/kvm.c | 24 +++++++++++++++++-------
> 1 file changed, 17 insertions(+), 7 deletions(-)
>
> diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c
> index a9e5880349..a7e2cdf668 100644
> --- a/target/s390x/kvm/kvm.c
> +++ b/target/s390x/kvm/kvm.c
> @@ -250,7 +250,7 @@ static void kvm_s390_enable_cmma(void)
> trace_kvm_enable_cmma(rc);
> }
>
> -static void kvm_s390_set_attr(uint64_t attr)
> +static void kvm_s390_set_crypto_attr(uint64_t attr)
> {
> struct kvm_device_attr attribute = {
> .group = KVM_S390_VM_CRYPTO,
> @@ -275,7 +275,7 @@ static void kvm_s390_init_aes_kw(void)
> }
>
> if (kvm_vm_check_attr(kvm_state, KVM_S390_VM_CRYPTO, attr)) {
> - kvm_s390_set_attr(attr);
> + kvm_s390_set_crypto_attr(attr);
> }
> }
>
> @@ -289,7 +289,7 @@ static void kvm_s390_init_dea_kw(void)
> }
>
> if (kvm_vm_check_attr(kvm_state, KVM_S390_VM_CRYPTO, attr)) {
> - kvm_s390_set_attr(attr);
> + kvm_s390_set_crypto_attr(attr);
> }
> }
>
> @@ -2296,6 +2296,17 @@ static int configure_cpu_subfunc(const S390FeatBitmap features)
> return kvm_vm_ioctl(kvm_state, KVM_SET_DEVICE_ATTR, &attr);
> }
>
> +static bool ap_available(void)
> +{
> + return kvm_vm_check_attr(kvm_state, KVM_S390_VM_CRYPTO,
> + KVM_S390_VM_CRYPTO_ENABLE_APIE);
> +}
> +
> +static bool ap_enabled(const S390FeatBitmap features)
> +{
> + return test_bit(S390_FEAT_AP, features);
> +}
> +
> static int kvm_to_feat[][2] = {
> { KVM_S390_VM_CPU_FEAT_ESOP, S390_FEAT_ESOP },
> { KVM_S390_VM_CPU_FEAT_SIEF2, S390_FEAT_SIE_F2 },
> @@ -2475,8 +2486,7 @@ void kvm_s390_get_host_cpu_model(S390CPUModel *model, Error **errp)
> return;
> }
> /* for now, we can only provide the AP feature with HW support */
> - if (kvm_vm_check_attr(kvm_state, KVM_S390_VM_CRYPTO,
> - KVM_S390_VM_CRYPTO_ENABLE_APIE)) {
> + if (ap_available()) {
> set_bit(S390_FEAT_AP, model->features);
> }
>
> @@ -2502,7 +2512,7 @@ static void kvm_s390_configure_apie(bool interpret)
> KVM_S390_VM_CRYPTO_DISABLE_APIE;
>
> if (kvm_vm_check_attr(kvm_state, KVM_S390_VM_CRYPTO, attr)) {
> - kvm_s390_set_attr(attr);
> + kvm_s390_set_crypto_attr(attr);
> }
> }
>
> @@ -2556,7 +2566,7 @@ void kvm_s390_apply_cpu_model(const S390CPUModel *model, Error **errp)
> kvm_s390_enable_cmma();
> }
>
> - if (test_bit(S390_FEAT_AP, model->features)) {
> + if (ap_enabled(model->features)) {
> kvm_s390_configure_apie(true);
> }
> }
next prev parent reply other threads:[~2023-08-17 12:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-10 12:47 [PATCH v2 0/3] KVM: s390: Enable AP instructions for pv-guests Steffen Eiden
2023-08-10 12:47 ` [PATCH v2 1/3] linux-headers: update asm-s390/kvm.h Steffen Eiden
2023-08-14 14:25 ` Thomas Huth
2023-08-10 12:47 ` [PATCH v2 2/3] target/s390x/kvm: Refactor AP functionalities Steffen Eiden
2023-08-17 12:43 ` Michael Mueller [this message]
2023-08-10 12:47 ` [PATCH v2 3/3] target/s390x: AP-passthrough for PV guests Steffen Eiden
2023-08-17 11:56 ` Janosch Frank
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=e8320e83-0b5d-f397-6a32-a48ecb8be5b0@linux.ibm.com \
--to=mimu@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=david@redhat.com \
--cc=frankja@linux.ibm.com \
--cc=mhartmay@linux.ibm.com \
--cc=mimu@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=seiden@linux.ibm.com \
--cc=thuth@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).