Skip to contentSkip to conversation

s390/ap: Fix MAPML computation

PATCH Applied Finn Callies 4 participants 4 messages Aug 5

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 s390/ap: Fix MAPML computation

When the TAPQ subfunction of PQAP returns a value between 0 and 3 in the ml field, the Principles of Operation states that the Maximum AP Message Length (MAPML) must be 12 KB.

The previous code incorrectly calculated smaller sizes for ml values 1-2:
- ml=1: 4 KB instead of 12 KB
- ml=2: 8 KB instead of 12 KB

While no current hardware reports ml=1 or ml=2, this fix ensures correct behavior for specification compliance and future-proofing.

The fix ensures all ml values 0-3 correctly use the 12 KB default, with only values 4+ using the formula ml * 4096.

---
 drivers/s390/crypto/ap_card.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/s390/crypto/ap_card.c +1 -1
index e827fbeb76fb..c86397f4ddcd 100644
@@ -241,7 +241,7 @@ struct ap_card *ap_card_create(int id, struct ap_tapq_hwinfo hwinfo,
 	ac->ap_dev.device_type = comp_type;
 	ac->hwinfo = hwinfo;
 	ac->id = id;
-	ac->maxmsgsize = hwinfo.ml > 0 ?
+	ac->maxmsgsize = hwinfo.ml > 3 ?
 		hwinfo.ml * AP_TAPQ_ML_FIELD_CHUNK_SIZE : AP_DEFAULT_MAX_MSG_SIZE;
 
 	return ac;
Signature · 2 lines
Finn Callies <[email protected]>
Linux on Z - crypto
#1 lore raw
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 8 lines

When the TAPQ subfunction of PQAP returns a value between 0 and 3 in the ml field, the Principles of Operation states that the Maximum AP Message Length (MAPML) must be 12 KB.

The previous code incorrectly calculated smaller sizes for ml values 1-2:
- ml=1: 4 KB instead of 12 KB
- ml=2: 8 KB instead of 12 KB

Quoted 8 lines

While no current hardware reports ml=1 or ml=2, this fix ensures correct behavior for specification compliance and future-proofing.

The fix ensures all ml values 0-3 correctly use the 12 KB default, with only values 4+ using the formula ml * 4096.

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
maintainer Acked-by on v2 1/1
#2 lore raw
In reply to Finn Callies
Quoted 11 lines · Finn Callies

When the TAPQ subfunction of PQAP returns a value between 0 and 3 in the ml field, the Principles of Operation states that the Maximum AP Message Length (MAPML) must be 12 KB.

The previous code incorrectly calculated smaller sizes for ml values 1-2:
- ml=1: 4 KB instead of 12 KB
- ml=2: 8 KB instead of 12 KB

While no current hardware reports ml=1 or ml=2, this fix ensures correct behavior for specification compliance and future-proofing.

Quoted 8 lines

The fix ensures all ml values 0-3 correctly use the 12 KB default, with only values 4+ using the formula ml * 4096.

---
 drivers/s390/crypto/ap_card.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
maintainer Applied
#3 lore raw
In reply to Finn Callies
Quoted 11 lines · Finn Callies

When the TAPQ subfunction of PQAP returns a value between 0 and 3 in the ml field, the Principles of Operation states that the Maximum AP Message Length (MAPML) must be 12 KB.

The previous code incorrectly calculated smaller sizes for ml values 1-2:
- ml=1: 4 KB instead of 12 KB
- ml=2: 8 KB instead of 12 KB

While no current hardware reports ml=1 or ml=2, this fix ensures correct behavior for specification compliance and future-proofing.

Quoted 8 lines

The fix ensures all ml values 0-3 correctly use the 12 KB default, with only values 4+ using the formula ml * 4096.

---
 drivers/s390/crypto/ap_card.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thank you!