From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757016AbdJKCii (ORCPT ); Tue, 10 Oct 2017 22:38:38 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:39096 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756916AbdJKCif (ORCPT ); Tue, 10 Oct 2017 22:38:35 -0400 From: Dong Jia Shi To: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, kvm@vger.kernel.org Cc: cohuck@redhat.com, borntraeger@de.ibm.com, bjsdjshi@linux.vnet.ibm.com, pasic@linux.vnet.ibm.com, pmorel@linux.vnet.ibm.com Subject: [PATCH 1/2] vfio: ccw: bypass bad idaw address when fetching IDAL ccws Date: Wed, 11 Oct 2017 04:38:21 +0200 X-Mailer: git-send-email 2.13.5 In-Reply-To: <20171011023822.42948-1-bjsdjshi@linux.vnet.ibm.com> References: <20171011023822.42948-1-bjsdjshi@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17101102-0012-0000-0000-00001520D83F X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007876; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000235; SDB=6.00929382; UDB=6.00467762; IPR=6.00709653; BA=6.00005632; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017484; XFM=3.00000015; UTC=2017-10-11 02:38:31 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17101102-0013-0000-0000-00004FD2AE88 Message-Id: <20171011023822.42948-2-bjsdjshi@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-10-10_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1710110036 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We currently returns the same error code (-EFAULT) to indicate two different error cases: 1. a bug in vfio-ccw implementation has been found. 2. a buggy channel program has been detected. This brings difficulty for userland program (specifically Qemu) to handle. Let's use -EFAULT to only indicate the first case. For the second case, we simply hand over the ccws to lower level for further handling. Notice: Once a bad idaw address is detected, the current behavior is to suppress the ssch. With this fix, the channel program will be accepted, and partial of the channel program (the part ahead of the bad idaw) could possibly be executed by the device before I/O conclusion. Suggested-by: Halil Pasic Reviewed-by: Pierre Morel Signed-off-by: Dong Jia Shi --- drivers/s390/cio/vfio_ccw_cp.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/s390/cio/vfio_ccw_cp.c b/drivers/s390/cio/vfio_ccw_cp.c index 5ccfdc80d0ec..722f8b8c7273 100644 --- a/drivers/s390/cio/vfio_ccw_cp.c +++ b/drivers/s390/cio/vfio_ccw_cp.c @@ -569,10 +569,6 @@ static int ccwchain_fetch_idal(struct ccwchain *chain, for (i = 0; i < idaw_nr; i++) { idaw_iova = *(idaws + i); - if (IS_ERR_VALUE(idaw_iova)) { - ret = -EFAULT; - goto out_free_idaws; - } ret = pfn_array_alloc_pin(pat->pat_pa + i, cp->mdev, idaw_iova, 1); -- 2.13.5