Linux s390 Architecture development
 help / color / mirror / Atom feed
From: Finn Callies <fcallies@linux.ibm.com>
To: Harald Freudenberger <freude@linux.ibm.com>, dengler@linux.ibm.com
Cc: linux-s390@vger.kernel.org, Heiko Carstens <hca@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Alexander Gordeev <agordeev@linux.ibm.com>
Subject: Re: [PATCH v2] s390/ap: Support new APMLM field with PQAP/TAPQ instruction
Date: Wed, 7 Oct 2026 16:05:17 +0200	[thread overview]
Message-ID: <214462b0-6ea1-4153-951e-8d583224a79e@linux.ibm.com> (raw)
In-Reply-To: <20261006145823.8421-1-freude@linux.ibm.com>



On 06.10.26 16:58, Harald Freudenberger wrote:
> There is a new field APMLM (AP message limit multiplier) defined
> within the GR2 register on successful invocation of the TAPQ
> subfunction for the PQAP instruction.
> 
> So the new formula to calculate the AP max message limit is now:
> 
>    if ml field <= 3
>      AP max message limit is 12KB
>    else
>      AP max message limit = apml * (apmlm + 1) * 4KB

As per architecture it is more like:

if apml < 3 && apmlm == 0
	mapml = 12k
else if apmlm == 0
	mapml = apml * 4k
else if apml > 0
	mapml = apml * (apmlm + 1) * 4k
else
	// undefined

But yours is effectively the same.

> 
> Also adapt the HWINFO mask to have this new apmlm field shine
> through this bit filter mask.
> 
> Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
> ---
>   arch/s390/include/asm/ap.h    | 4 ++--
>   drivers/s390/crypto/ap_bus.h  | 2 +-
>   drivers/s390/crypto/ap_card.c | 3 ++-
>   3 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/s390/include/asm/ap.h b/arch/s390/include/asm/ap.h
> index c91b6ace199d..01d575c35887 100644
> --- a/arch/s390/include/asm/ap.h
> +++ b/arch/s390/include/asm/ap.h
> @@ -123,8 +123,8 @@ struct ap_tapq_hwinfo {
>   			unsigned int	   : 14;
>   			unsigned int at	   :  8; /* ap type */
>   			unsigned int nd	   :  8; /* nr of domains */
> -			unsigned int	   :  4;
> -			unsigned int ml	   :  4; /* apxl ml */
> +			unsigned int mlm   :  4; /* AP msg limit multiplier */
> +			unsigned int ml	   :  4; /* AP msg limit */
>   			unsigned int	   :  3;
>   			unsigned int qd	   :  5; /* queue depth */
>   		};
> diff --git a/drivers/s390/crypto/ap_bus.h b/drivers/s390/crypto/ap_bus.h
> index fb4d678336e4..34f9dcd96bc7 100644
> --- a/drivers/s390/crypto/ap_bus.h
> +++ b/drivers/s390/crypto/ap_bus.h
> @@ -181,7 +181,7 @@ struct ap_card {
>   	bool chkstop;			/* checkstop state */
>   };
>   
> -#define TAPQ_CARD_HWINFO_MASK 0xFFFF0000FFFF0F1FUL
> +#define TAPQ_CARD_HWINFO_MASK 0xFFFF0000FFFFFF1FUL
>   #define ASSOC_IDX_INVALID 0x10000
>   
>   #define to_ap_card(x) container_of((x), struct ap_card, ap_dev.device)
> diff --git a/drivers/s390/crypto/ap_card.c b/drivers/s390/crypto/ap_card.c
> index c86397f4ddcd..e9a8180f08c2 100644
> --- a/drivers/s390/crypto/ap_card.c
> +++ b/drivers/s390/crypto/ap_card.c
> @@ -242,7 +242,8 @@ struct ap_card *ap_card_create(int id, struct ap_tapq_hwinfo hwinfo,
>   	ac->hwinfo = hwinfo;
>   	ac->id = id;
>   	ac->maxmsgsize = hwinfo.ml > 3 ?
> -		hwinfo.ml * AP_TAPQ_ML_FIELD_CHUNK_SIZE : AP_DEFAULT_MAX_MSG_SIZE;
> +		hwinfo.ml * (hwinfo.mlm + 1) * AP_TAPQ_ML_FIELD_CHUNK_SIZE :
> +		AP_DEFAULT_MAX_MSG_SIZE;
>   
>   	return ac;
>   }

Reviewed-by: Finn Callies <fcallies@linux.ibm.com>

Have you tested it with your qemu support or my mocking?

  parent reply	other threads:[~2026-10-07 14:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-06 14:58 [PATCH v2] s390/ap: Support new APMLM field with PQAP/TAPQ instruction Harald Freudenberger
2026-10-06 15:09 ` sashiko-bot
2026-10-06 15:53   ` Harald Freudenberger
2026-10-07 14:07     ` Finn Callies
2026-10-07 14:05 ` Finn Callies [this message]
2026-10-08  7:20   ` Harald Freudenberger

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=214462b0-6ea1-4153-951e-8d583224a79e@linux.ibm.com \
    --to=fcallies@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=dengler@linux.ibm.com \
    --cc=freude@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    /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