From patchwork Fri Jun 18 15:20:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Philippe Brucker X-Patchwork-Id: 12331675 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=-11.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 2F07FC48BDF for ; Fri, 18 Jun 2021 15:32:39 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F319861205 for ; Fri, 18 Jun 2021 15:32:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F319861205 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=XnkD3DtKpDnrj3vwSHn8ic+mSCkuLMWWsBjaMto76EY=; b=izE3uIUOYWnVzW SUVyKN7yMzmqrPS/Hgh7M3w6A4bz5xLwBw8TLfe8+9zBM3DTjpkvJO3GVKixp16L7TtU3tXRurGjA XWDFAFpwxV7qktAhro7LYUymd9Nnioo88KOKZpxy4bOmle4CrhTuiIILLOc2aiDOCGRxh8prow2Ae S/H2c3NWu3vTXuWO6SCloxeDAZCsj3W41BtRvI08QR3vMtGIxxIbIGyP+NPydmU6RqPse4xPF3A38 TjC3kQQckOoDX/RulsEhnYO/60JJXN/814RT7CVmTLnC9p6isfVKf6H1QoGBRzd77WDR4qhbStF+V CW6ZLdZg7RhcJw3du+gg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1luGRs-00Ejne-PZ; Fri, 18 Jun 2021 15:30:24 +0000 Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1luGRn-00Ejm4-Pj for linux-arm-kernel@lists.infradead.org; Fri, 18 Jun 2021 15:30:21 +0000 Received: by mail-ej1-x634.google.com with SMTP id hv20so10523425ejc.12 for ; Fri, 18 Jun 2021 08:30:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=eVK2Vu+gdkSV5LfHLO/okFsTWTEsOSEgfh/fTAc+ysQ=; b=Uv8r73Tua8U4KIGVT0tadYn9JokQ3OI3UF40iCRRH8Qvy+JxNw6WWAESXCcrpkMZD5 J9OqykH5gEpxXAEhSSHTNdSIYjDCvQfC/QG8Qn8WOqpOk/qeQwqcYl60Y0zNoDJ5dK9j vFVf3RcWUverAnEDhV8qhCSXORG1mEGHmaozp15j3vnM+1mkdqmBUJYcyKYaXKZ8/wX6 DKVu6y5PKk/i85GATFRvHw3B3h6wkjYcKi++Q057tw7ivkm+LVe+yIYv2dbD8kDGryB8 pCYO+t5K98NRFj1alr60VtctA8wlN3ilmyWo1HfKQowP1OpJjD8zQHLInL7HqZXFq5Dz zsYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=eVK2Vu+gdkSV5LfHLO/okFsTWTEsOSEgfh/fTAc+ysQ=; b=sCVnjRVPOKqDED/8c1qHUW6gioE6x6oZa8d3DugVdcl6jB1m9aDq/zXwOtPY9BhClV TG2PFh2lqddN5mOU97I6fVvOruJiYzkEt5Ji+wsXUTWLSD5u4akHsOetPtFg+3bFoLcP HNO1dt9hvHbhdYGM7pcRqI/hlVzWSzJtY2tqsTx9nAzNLA83gC/r6TuQzDQJT1XCp1As TUg/pHtl3qL2ajKRCwNjyJEKFhx+ZEtmwCf0y4f0ElIYDt8dOX6Itfch2bb9D+wffJ1I plLw9disB+MWof8ZtE+2jYLdnct5bS2+pdODbi9dsIvzoyrerDnSq6sEr9JdM1LeLG18 zEaQ== X-Gm-Message-State: AOAM530deCbZWFJ1eFzqQOknjOIVQql1GF8sgQFmFqAGqLQti8Q45Chk 7AKqK11kKVxGHCMJQIyyBt7Cug== X-Google-Smtp-Source: ABdhPJwqDmkoCnPG0QnncSmTulnYyA+q0tsJhnaPN0fg6rei1NJ1LtMquAgOeQDHr4MnGh/8I10l5Q== X-Received: by 2002:a17:906:fcaa:: with SMTP id qw10mr11511312ejb.233.1624030218335; Fri, 18 Jun 2021 08:30:18 -0700 (PDT) Received: from localhost.localdomain (adsl-84-226-111-173.adslplus.ch. [84.226.111.173]) by smtp.gmail.com with ESMTPSA id bn7sm1197613ejb.111.2021.06.18.08.30.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Jun 2021 08:30:17 -0700 (PDT) From: Jean-Philippe Brucker To: rjw@rjwysocki.net, lenb@kernel.org, joro@8bytes.org, mst@redhat.com Cc: will@kernel.org, catalin.marinas@arm.com, baolu.lu@linux.intel.com, dwmw2@infradead.org, linux-acpi@vger.kernel.org, iommu@lists.linux-foundation.org, virtualization@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, eric.auger@redhat.com, sebastien.boeuf@intel.com, robin.murphy@arm.com, kevin.tian@intel.com, lorenzo.pieralisi@arm.com, guohanjun@huawei.com, sudeep.holla@arm.com, jean-philippe@linaro.org Subject: [PATCH v5 0/5] Add support for ACPI VIOT Date: Fri, 18 Jun 2021 17:20:55 +0200 Message-Id: <20210618152059.1194210-1-jean-philippe@linaro.org> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210618_083020_022999_74A9896A X-CRM114-Status: GOOD ( 12.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add a driver for the ACPI VIOT table, which provides topology information for para-virtual IOMMUs. Enable virtio-iommu on non-devicetree platforms, including x86. Since v4 [1]: * Fixes (comments, wrong argument, unused variable) * Removed patch 5 that wrongly moved set_dma_ops(dev, NULL) into dma-iommu. The simplification of limit parameters for x86 callers is now in patch 4. * Release ACPI table after parsing * Added review and tested tags, thanks for all the feedback! You can find a QEMU implementation at [2], with extra support for testing all VIOT nodes including MMIO-based endpoints and IOMMU. This series is at [3]. [1] https://lore.kernel.org/linux-iommu/20210610075130.67517-1-jean-philippe@linaro.org/ [2] https://jpbrucker.net/git/qemu/log/?h=virtio-iommu/acpi [3] https://jpbrucker.net/git/linux/log/?h=virtio-iommu/acpi Jean-Philippe Brucker (5): ACPI: arm64: Move DMA setup operations out of IORT ACPI: Move IOMMU setup code out of IORT ACPI: Add driver for the VIOT table iommu/dma: Pass address limit rather than size to iommu_setup_dma_ops() iommu/virtio: Enable x86 support drivers/acpi/Kconfig | 3 + drivers/iommu/Kconfig | 4 +- drivers/acpi/Makefile | 2 + drivers/acpi/arm64/Makefile | 1 + include/acpi/acpi_bus.h | 3 + include/linux/acpi.h | 3 + include/linux/acpi_iort.h | 14 +- include/linux/acpi_viot.h | 19 ++ include/linux/dma-iommu.h | 4 +- arch/arm64/mm/dma-mapping.c | 2 +- drivers/acpi/arm64/dma.c | 50 +++++ drivers/acpi/arm64/iort.c | 128 ++---------- drivers/acpi/bus.c | 2 + drivers/acpi/scan.c | 78 +++++++- drivers/acpi/viot.c | 366 +++++++++++++++++++++++++++++++++++ drivers/iommu/amd/iommu.c | 2 +- drivers/iommu/dma-iommu.c | 13 +- drivers/iommu/intel/iommu.c | 5 +- drivers/iommu/virtio-iommu.c | 11 ++ MAINTAINERS | 8 + 20 files changed, 581 insertions(+), 137 deletions(-) create mode 100644 include/linux/acpi_viot.h create mode 100644 drivers/acpi/arm64/dma.c create mode 100644 drivers/acpi/viot.c