From patchwork Wed Aug 11 15:14:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12431453 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52CF0C4338F for ; Wed, 11 Aug 2021 15:28:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1661C60EB2 for ; Wed, 11 Aug 2021 15:28:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233049AbhHKP2g (ORCPT ); Wed, 11 Aug 2021 11:28:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232946AbhHKP2d (ORCPT ); Wed, 11 Aug 2021 11:28:33 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7877C061765 for ; Wed, 11 Aug 2021 08:28:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=H6bc2DFw+iQkXXMDFqXtOFID3yuBeRaW+aZik5kBSoU=; b=e9uOvqRcohPMoLNs22aGI3SMYv XsHVIHUj7zlfzlrWwPucSv1790X8hCT5eRioa5Ke6/yGgIM0f/BBNd1Me0j6IXOEmEh2/jxMUkXEY 8bpKVdP1nxtb1pslyhebn3Gfjgy1Zj1vgRL/2dGEkOZ0zlYWKl+qzZREDHcgp5/HH2akEaLBmLunl ZV81hCxarDPFoZRe83GgnNjIcB3F39UFaV90g+nYwa6mAXcYOXtGVFnfRAEqWjKjL0YdxDDNXgsix AfnQPi2PBFLn3lzKDBHO+Pt8Nc8SbCtRi5gL5bKYVg6H2gF4e2kwzpn92DTAvZW/q5VvSc53P+Bll om2PQKKA==; Received: from [2001:4bb8:184:6215:ac7b:970b:bd9c:c36c] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mDq7K-00DYp2-1B; Wed, 11 Aug 2021 15:26:24 +0000 From: Christoph Hellwig To: Alex Williamson Cc: Diana Craciun , Cornelia Huck , Kirti Wankhede , Eric Auger , Jason Gunthorpe , kvm@vger.kernel.org Subject: [PATCH 12/14] vfio/spapr_tce: reject mediated devices Date: Wed, 11 Aug 2021 17:14:58 +0200 Message-Id: <20210811151500.2744-13-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210811151500.2744-1-hch@lst.de> References: <20210811151500.2744-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Unlike the the type1 IOMMU backend, the SPAPR one does not contain any support for the magic non-IOMMU backed iommu_group used by mediated devices, so reject them in ->attach_group. Signed-off-by: Christoph Hellwig --- drivers/vfio/vfio_iommu_spapr_tce.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/vfio/vfio_iommu_spapr_tce.c b/drivers/vfio/vfio_iommu_spapr_tce.c index 7567328d347d25..779d4e985d825f 100644 --- a/drivers/vfio/vfio_iommu_spapr_tce.c +++ b/drivers/vfio/vfio_iommu_spapr_tce.c @@ -1246,6 +1246,9 @@ static int tce_iommu_attach_group(void *iommu_data, struct iommu_table_group *table_group; struct tce_iommu_group *tcegrp = NULL; + if (flags & VFIO_MEDIATED) + return -EINVAL; + mutex_lock(&container->lock); /* pr_debug("tce_vfio: Attaching group #%u to iommu %p\n",