Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp929254rwb; Wed, 16 Nov 2022 09:28:15 -0800 (PST) X-Google-Smtp-Source: AA0mqf4DFciS0H+sHNV/H7RNRkwKkBozRZbp0VaMlLPESB0t40GoF1DdhciuoL0nNoVPAL1x1r8e X-Received: by 2002:a17:90a:bd7:b0:213:30b2:4e4e with SMTP id x23-20020a17090a0bd700b0021330b24e4emr4834350pjd.193.1668619695603; Wed, 16 Nov 2022 09:28:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668619695; cv=none; d=google.com; s=arc-20160816; b=M4hMTiqHDBlVXOlZTjVbNKnpWygAFyYXJtBupFdhpXIyWutxPOdzGmvuEID7R2vZD6 jTQWiCeHeuOm+TaA0rcNQ8exa1OPodlC8ztyOcWh1mqxTUu4HhxmAb/eT0VGJyJGWUXO TmWKrk0jMsEoF8YSYv/qYyESNRUDk1gzwUR83aS40sQ4EE82IG79ySuY/6QYoRSvm3gY aO4QeSQIdMHJDH9go239bnY5VokfiZwLzC33+vx2o9L6MpXWmQGGl+4gn2pBtoqtgYCr v+BlZRVVcASvQT/Vk5Zkoc7Zz2px+3amJILh1RYwusV1SEyPWqKW9kKeaiftEK0qC+RB IwbQ== 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=DesZm6hVauGJ5jEKwYVVgM1CsFnIzR6FUV6dd8h3oPU=; b=BFmi6kFgKnW8kGeIckzRdWTteFxFgHK1fy7G3qzhhFZ7bfInRLdJE7iQ+Q78Tw62wB lb/wAehN2Ao1tPzwagCzt5Ccncdemnhvy+zMKqF70Kf1bIqbUnQbr6YwEQqy95Hp5iXd Feeq95WWcos8Ry7RqTgAGsLoG3B2ag8hkTDerd5Z+sLFXE0lJW7SUQwHZFmvI22JU1jT 1WapwQrkDjactMkrW99hCVaAjisHZeDoeWWW3/zOgygCW+IYKisc5LPfOkCbLJnkkOEZ 60OpJj7UtKnBskhKILGs0nuQ8aJv2SpOOcVod0YzlBko52Fx5pefNXubfTkj7BTsO2gS n05A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="Opmw8G/V"; 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 q19-20020a056a00089300b00562331a3562si16917936pfj.130.2022.11.16.09.28.03; Wed, 16 Nov 2022 09:28:15 -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="Opmw8G/V"; 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 S233605AbiKPRRU (ORCPT + 90 others); Wed, 16 Nov 2022 12:17:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230377AbiKPRRT (ORCPT ); Wed, 16 Nov 2022 12:17:19 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE50E4731C; Wed, 16 Nov 2022 09:17:18 -0800 (PST) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AGHDJHH005207; Wed, 16 Nov 2022 17:17:05 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=DesZm6hVauGJ5jEKwYVVgM1CsFnIzR6FUV6dd8h3oPU=; b=Opmw8G/V3dRoyOOSGVdh+czxS74TKiVkIlbiAvymk1v5SGU2j7vxqY9dw7z8eA5cEo/l LFJXRolPGu46ib3tkLFCCAhkjCghXY7YryLjWADW4te3jHsOme0M9Y1hxEV7BGXtIQ2l N91Qs6PqvlYi2bLUud6/3HufTLz9crz+rJ9FMnePH5QIwI/N2VF0qeu5I79h8Fyd9Rnt JJTnGAjotrOcuCPcQ8IJ2n/1zc17QWHimsFEtqjigSVjzcu+Y/MXKOXQVrRfJ2rluM53 5to8DBwGv4zJXk7FoKRcFhG3eW5/DqbC4sk/YfyT+QUJUv9xPd6lTRmTmiYOP/kbw1XJ XQ== Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3kw3qe8say-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Nov 2022 17:17:04 +0000 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 2AGH5llf024480; Wed, 16 Nov 2022 17:17:02 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma04ams.nl.ibm.com with ESMTP id 3kt348x9jy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Nov 2022 17:17:02 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 2AGHGxwi38928914 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 16 Nov 2022 17:16:59 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 41D3F5204F; Wed, 16 Nov 2022 17:16:59 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id AC39452054; Wed, 16 Nov 2022 17:16:58 +0000 (GMT) From: Niklas Schnelle To: Matthew Rosato , Gerd Bayer , iommu@lists.linux.dev, Joerg Roedel , Will Deacon , Robin Murphy , Jason Gunthorpe , Wenjia Zhang Cc: Pierre Morel , 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 v2 4/7] iommu: Let iommu.strict override ops->def_domain_type Date: Wed, 16 Nov 2022 18:16:53 +0100 Message-Id: <20221116171656.4128212-5-schnelle@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221116171656.4128212-1-schnelle@linux.ibm.com> References: <20221116171656.4128212-1-schnelle@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: Gop84IsW_vCOuB5QmJucy4dagLgXcyIS X-Proofpoint-GUID: Gop84IsW_vCOuB5QmJucy4dagLgXcyIS 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-16_03,2022-11-16_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 spamscore=0 malwarescore=0 bulkscore=0 lowpriorityscore=0 adultscore=0 priorityscore=1501 impostorscore=0 phishscore=0 clxscore=1015 mlxscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211160119 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 When iommu.strict=1 is set or iommu_set_dma_strict() was called we should use IOMMU_DOMAIN_DMA irrespective of ops->def_domain_type. Signed-off-by: Niklas Schnelle --- drivers/iommu/iommu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 65a3b3d886dc..d9bf94d198df 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -1562,6 +1562,9 @@ static int iommu_get_def_domain_type(struct device *dev) { const struct iommu_ops *ops = dev_iommu_ops(dev); + if (iommu_dma_strict) + return IOMMU_DOMAIN_DMA; + if (dev_is_pci(dev) && to_pci_dev(dev)->untrusted) return IOMMU_DOMAIN_DMA; -- 2.34.1