Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp10520618rwl; Mon, 2 Jan 2023 04:07:35 -0800 (PST) X-Google-Smtp-Source: AMrXdXuzAgBE/+m7viXBvp2+qWBuxULV4mMJe5T+dSSfLi654OXW0FcuTTaVTq17vmLXcEg/abpo X-Received: by 2002:a05:6402:2890:b0:47e:eaae:9a56 with SMTP id eg16-20020a056402289000b0047eeaae9a56mr41192566edb.5.1672661255430; Mon, 02 Jan 2023 04:07:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672661255; cv=none; d=google.com; s=arc-20160816; b=e97GpCZEsiRJZkgGNqc0MjogULpaqHc9w3RvTyGbfjMrKFGw11X33ReoCyT5r9tNrF VUQ2cyyuht1z3HF4/nN5gwpCcNzHOZLtewDjnPdgPm1B1Cf8dSFKZqTp4xDirFdhcb7M onZLbSYbsE6SZyIWM+8mDgxfxXE3cLXyQMEE5aM22l+eGvC8/bKgx965Wq9dTley11r0 zApBShU0VCK0vC/MaDyaBA1iRdtmkHGNG3XZeZ4kmsz/8Anx3bsurxJfEmkl/Y7SmSVf R+lHZo8krs+CW1oQ8f2fC6S6PXMxrGikSfcn4QV4nr4JB51DFLWJ4bym8NgwtKa6ydTH xzMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hP0kCovPbWmZTSy7tSN9XNIJQRipnc5HWdbuDbVN2YU=; b=j92cLv/ogQoPoLP19j0HIbQ/izQwzaDngKjOgWwl5lXCLI6EzA1/0duBUYgiArr2uE S8Q9N2re4wJD2+mBuc5351cyuKM4TMJsWYZRmeKIE1duSI1ygm7Y/AaYK5WS8NGRxy3H EuZrBwbbYJKvqgBGMEaDEKM0UerTKPO05rQPZ9n2NJlkvKlLG062UeQouEcFW8gyvwsk H0tRTJ+DIKlC7oOQBPRl39W6dwLPCu6I+JaO7rqHCmfZpZhMLrT6sElDCqxL/YFMXbvl QZowFjfsciXwydMVvPAD0atZXwJaBUT1rMjKJmn8YQ+RcWpXaRCx3X6vjaJDR3AXkEZL SbrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="tA/wgabh"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z15-20020a056402274f00b00488d1fcdae3si13436406edd.65.2023.01.02.04.07.20; Mon, 02 Jan 2023 04:07:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="tA/wgabh"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232573AbjABL5C (ORCPT + 61 others); Mon, 2 Jan 2023 06:57:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232590AbjABL4n (ORCPT ); Mon, 2 Jan 2023 06:56:43 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F1DB5FDB; Mon, 2 Jan 2023 03:56:41 -0800 (PST) Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30281V92022861; Mon, 2 Jan 2023 11:56:27 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=hP0kCovPbWmZTSy7tSN9XNIJQRipnc5HWdbuDbVN2YU=; b=tA/wgabhQlEhr6oHy+BFRNS2/SuaKV5l3XQTF/iODHpC5n52t1AaN47Izh+RTI+UEP9S cuC+/yqORcIqhOg0RyWFoqdcphZo8wtHp/HKg+7TkGTA26CU8E/zyEKVPDW4d57yvoQI AVoGcmimagQVh/BLQX5/wu2H2lBNfEpRGK8ohl7lSvMW2o1KTXIU54nYjH0/z3wlZWcB LxGFnsddivvNiBiANRogDLRmFyLoJFHCuDWgHQB7R1LX+eo2R3DFLHg9cNfxfmyBQ92R huiip16+EFMv0xgbF00C00gpKBKDS5RW42YEn5mKpAxdhJFwp/gGeRfLKh8Anit/L+qO rw== Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3mtxnqyvmk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 02 Jan 2023 11:56:26 +0000 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 301ICGHF005328; Mon, 2 Jan 2023 11:56:25 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma03fra.de.ibm.com (PPS) with ESMTPS id 3mtcq6hrb8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 02 Jan 2023 11:56:24 +0000 Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 302BuLT021823748 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 2 Jan 2023 11:56:21 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5A28220049; Mon, 2 Jan 2023 11:56:21 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 044A620043; Mon, 2 Jan 2023 11:56:21 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 2 Jan 2023 11:56:20 +0000 (GMT) From: Niklas Schnelle To: Joerg Roedel , Will Deacon , Robin Murphy , Jason Gunthorpe , Wenjia Zhang Cc: Matthew Rosato , Gerd Bayer , Pierre Morel , iommu@lists.linux.dev, linux-s390@vger.kernel.org, borntraeger@linux.ibm.com, hca@linux.ibm.com, gor@linux.ibm.com, gerald.schaefer@linux.ibm.com, agordeev@linux.ibm.com, svens@linux.ibm.com, linux-kernel@vger.kernel.org, Julian Ruess Subject: [PATCH v3 3/7] s390/pci: prepare is_passed_through() for dma-iommu Date: Mon, 2 Jan 2023 12:56:15 +0100 Message-Id: <20230102115619.2088685-4-schnelle@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230102115619.2088685-1-schnelle@linux.ibm.com> References: <20230102115619.2088685-1-schnelle@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: MrudiwXjF98WYuDGE5EOFwxcBTrHGOKV X-Proofpoint-GUID: MrudiwXjF98WYuDGE5EOFwxcBTrHGOKV X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-02_06,2022-12-30_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=975 phishscore=0 adultscore=0 bulkscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 lowpriorityscore=0 spamscore=0 clxscore=1015 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301020105 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With the IOMMU always controlled through the IOMMU driver testing for zdev->s390_domain is not a valid indication of the device being passed-through. Instead test if zdev->kzdev is set. Reviewed-by: Pierre Morel Signed-off-by: Niklas Schnelle --- arch/s390/pci/pci_event.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/arch/s390/pci/pci_event.c b/arch/s390/pci/pci_event.c index b9324ca2eb94..4ef5a6a1d618 100644 --- a/arch/s390/pci/pci_event.c +++ b/arch/s390/pci/pci_event.c @@ -59,9 +59,16 @@ static inline bool ers_result_indicates_abort(pci_ers_result_t ers_res) } } -static bool is_passed_through(struct zpci_dev *zdev) +static bool is_passed_through(struct pci_dev *pdev) { - return zdev->s390_domain; + struct zpci_dev *zdev = to_zpci(pdev); + bool ret; + + mutex_lock(&zdev->kzdev_lock); + ret = !!zdev->kzdev; + mutex_unlock(&zdev->kzdev_lock); + + return ret; } static bool is_driver_supported(struct pci_driver *driver) @@ -176,7 +183,7 @@ static pci_ers_result_t zpci_event_attempt_error_recovery(struct pci_dev *pdev) } pdev->error_state = pci_channel_io_frozen; - if (is_passed_through(to_zpci(pdev))) { + if (is_passed_through(pdev)) { pr_info("%s: Cannot be recovered in the host because it is a pass-through device\n", pci_name(pdev)); goto out_unlock; @@ -239,7 +246,7 @@ static void zpci_event_io_failure(struct pci_dev *pdev, pci_channel_state_t es) * we will inject the error event and let the guest recover the device * itself. */ - if (is_passed_through(to_zpci(pdev))) + if (is_passed_through(pdev)) goto out; driver = to_pci_driver(pdev->dev.driver); if (driver && driver->err_handler && driver->err_handler->error_detected) -- 2.34.1