From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CFF5C46467 for ; Mon, 21 Nov 2022 21:42:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231967AbiKUVmB (ORCPT ); Mon, 21 Nov 2022 16:42:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231174AbiKUVlX (ORCPT ); Mon, 21 Nov 2022 16:41:23 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 729D0DB852; Mon, 21 Nov 2022 13:41:08 -0800 (PST) Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2ALLPWH4011432; Mon, 21 Nov 2022 21:41:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=kTOeYPXxnMmC4iBgsev0zD2BArZ16sigBrYmCQBE3O4=; b=UYmhDGQkZZLRQKwClzkA+esUo61h6pNRym6ho7nibZ7PzzhK1f3pHYKrVgA/s1L2cYEn KcDsIpXS3+5H4zU5dDKtB+Ri3VEkO6vovYi5/ecYhjwqwpXqiqgK2VZgdvzdrn3HTyEC 5wo83N4yEjBLGIagmkzmuymqxL7ee5TFxg2VOB1URO8cVmGwSDxzMvEpt/M8q97akb76 WrzYxaH82mpmBJ1n5Ulg3Evh7txRlhsio74orPYFUtfGv4+0OTDiDBmDQmqr7x+LO5V3 M275yXJTlbyrTtp4cBLEawXK2kdAGmfqmYzvhEH8y1sAeYFJo4QmqlxRaUd3mbfGHV8O 4w== Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3m0d3g6mtt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 21 Nov 2022 21:41:07 +0000 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 2ALLap6k025283; Mon, 21 Nov 2022 21:41:05 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma04fra.de.ibm.com with ESMTP id 3kxps8tcxy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 21 Nov 2022 21:41:05 +0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 2ALLf2TV33358094 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 21 Nov 2022 21:41:02 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1406DA405B; Mon, 21 Nov 2022 21:41:02 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 00185A4054; Mon, 21 Nov 2022 21:41:01 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Mon, 21 Nov 2022 21:41:01 +0000 (GMT) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 4958) id 857D3E08AB; Mon, 21 Nov 2022 22:41:01 +0100 (CET) From: Eric Farman To: Matthew Rosato , Halil Pasic Cc: Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Vineeth Vijayan , Peter Oberparleiter , linux-s390@vger.kernel.org, kvm@vger.kernel.org, Eric Farman Subject: [PATCH v1 11/16] vfio/ccw: discard second fmt-1 IDAW Date: Mon, 21 Nov 2022 22:40:51 +0100 Message-Id: <20221121214056.1187700-12-farman@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221121214056.1187700-1-farman@linux.ibm.com> References: <20221121214056.1187700-1-farman@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 7XWV0vJwu_Pq31MRqlqXKoJ75yj3iFY9 X-Proofpoint-GUID: 7XWV0vJwu_Pq31MRqlqXKoJ75yj3iFY9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-21_18,2022-11-18_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 lowpriorityscore=0 phishscore=0 mlxlogscore=999 clxscore=1015 malwarescore=0 suspectscore=0 spamscore=0 impostorscore=0 priorityscore=1501 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211210162 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org The intention is to read the first IDAW to determine the starting location of an I/O operation, knowing that the second and any/all subsequent IDAWs will be aligned per architecture. But, this read receives 64-bits of data, which is the size of a format-2 IDAW. In the event that Format-1 IDAWs are presented, discard the lower 32 bits as they contain the second IDAW in such a list. Signed-off-by: Eric Farman --- drivers/s390/cio/vfio_ccw_cp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/s390/cio/vfio_ccw_cp.c b/drivers/s390/cio/vfio_ccw_cp.c index 34a133d962d1..53246f4f95f7 100644 --- a/drivers/s390/cio/vfio_ccw_cp.c +++ b/drivers/s390/cio/vfio_ccw_cp.c @@ -516,11 +516,15 @@ static int ccw_count_idaws(struct ccw1 *ccw, bytes = ccw->count; if (ccw_is_idal(ccw)) { - /* Read first IDAW to see if it's 4K-aligned or not. */ - /* All subsequent IDAws will be 4K-aligned. */ + /* Read first IDAW to check its starting address. */ + /* All subsequent IDAWs will be 2K- or 4K-aligned. */ ret = vfio_dma_rw(vdev, ccw->cda, &iova, sizeof(iova), false); if (ret) return ret; + + /* Format-1 IDAWs only occupy the first int */ + if (!cp->orb.cmd.c64) + iova = iova >> 32; } else { iova = ccw->cda; } -- 2.34.1