public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Janosch Frank <frankja@linux.ibm.com>
To: Christoph Schlameuss <schlameuss@linux.ibm.com>,
	linux-s390@vger.kernel.org
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>,
	Claudio Imbrenda <imbrenda@linux.ibm.com>,
	Heiko Carstens <hca@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	Sven Schnelle <svens@linux.ibm.com>,
	Hendrik Brueckner <brueckner@linux.ibm.com>,
	Nina Schoetterl-Glausch <nsg@linux.ibm.com>,
	kvm@vger.kernel.org
Subject: Re: [PATCH 4/4] KVM: s390: vsie: Implement ASTFLEIE facility 2
Date: Fri, 20 Feb 2026 11:07:18 +0100	[thread overview]
Message-ID: <ee72e730-87f2-439e-b6a6-2f153ec055af@linux.ibm.com> (raw)
In-Reply-To: <20260212-vsie-alter-stfle-fac-v1-4-d772be74a4da@linux.ibm.com>

On 2/12/26 10:24, Christoph Schlameuss wrote:
> From: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
> 
> Implement shadowing of format-2 facility list when running in VSIE.
> 
> ASTFLEIE2 is available since IBM z16.
> To function G1 has to run this KVM code and G1 and G2 have to run QEMU
> with ASTFLEIE2 support.
> 
> Signed-off-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
> Co-developed-by: Christoph Schlameuss <schlameuss@linux.ibm.com>
> Signed-off-by: Christoph Schlameuss <schlameuss@linux.ibm.com>
> ---

[...]

> +static int handle_stfle_2(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page,
> +			  u32 fac_list_origin)
> +{
> +	struct kvm_s390_sie_block *scb_s = &vsie_page->scb_s;
> +	u8 *shadow_fac = &vsie_page->fac[0];
> +	u64 len;
> +
> +	if (read_guest_real(vcpu, fac_list_origin, &len, sizeof(len)))
> +		return set_validity_icpt(scb_s, 0x1090U);
> +	fac_list_origin += sizeof(len);
> +	len = (len & 0xff);
> +	memcpy(shadow_fac, &len, sizeof(len)); /* discard reserved bits */
> +	shadow_fac += sizeof(len);

You can choose between adding a struct for the new format and what you 
did here. Is this really the better option?


Add the struct and add a constant for the format 2 format control used 
in the second to last line of this function while you're at it.

> +	len += 1;
> +	/* assert no overflow with maximum len */
> +	BUILD_BUG_ON(sizeof(vsie_page->fac) < 257 * sizeof(u64));> +	if (read_guest_real(vcpu, fac_list_origin, shadow_fac, len * 
sizeof(u64)))
> +		return set_validity_icpt(scb_s, 0x1090U);

Sprinkle in some \n between the build bugs and code or just move them to 
the top as one block.
I'd much rather have build bugs at the top of the function than inside 
the code.

> +	BUILD_BUG_ON(!IS_ALIGNED(offsetof(struct vsie_page, fac), 8));

That was already added last patch, no?

> +	scb_s->fac = (u32)virt_to_phys(&vsie_page->fac) | 2;
> +	return 0;
> +}
> +
>   /*
>    * Try to shadow + enable the guest 2 provided facility list.
>    * Retry instruction execution if enabled for and provided by guest 2.
> @@ -1057,9 +1080,11 @@ static int handle_stfle(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
>   		case 0:
>   			return handle_stfle_0(vcpu, vsie_page, fac_list_origin);
>   		case 1:
> +			return set_validity_icpt(&vsie_page->scb_s, 0x1330U);
>   		case 2:
> +			return handle_stfle_2(vcpu, vsie_page, fac_list_origin);
>   		case 3:
> -			unreachable();
> +			return set_validity_icpt(&vsie_page->scb_s, 0x1330U);
>   		}
>   	}
>   	return 0;
> 


  reply	other threads:[~2026-02-20 10:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-12  9:24 [PATCH 0/4] KVM: s390: vsie: Implement ASTFLEIE facility 2 Christoph Schlameuss
2026-02-12  9:24 ` [PATCH 1/4] KVM: s390: Minor refactor of base/ext facility lists Christoph Schlameuss
2026-02-12  9:24 ` [PATCH 2/4] s390/sclp: Detect ASTFLEIE 2 facility Christoph Schlameuss
2026-02-18 12:12   ` Janosch Frank
2026-02-26 10:52   ` Hendrik Brueckner
2026-02-12  9:24 ` [PATCH 3/4] KVM: s390: vsie: Refactor handle_stfle Christoph Schlameuss
2026-02-20  9:19   ` Janosch Frank
2026-02-12  9:24 ` [PATCH 4/4] KVM: s390: vsie: Implement ASTFLEIE facility 2 Christoph Schlameuss
2026-02-20 10:07   ` Janosch Frank [this message]
2026-02-24  9:59     ` Christoph Schlameuss

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=ee72e730-87f2-439e-b6a6-2f153ec055af@linux.ibm.com \
    --to=frankja@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=brueckner@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=nsg@linux.ibm.com \
    --cc=schlameuss@linux.ibm.com \
    --cc=svens@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox