From patchwork Fri Apr 23 11:38:31 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: 12220269 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.8 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 0F72DC433ED for ; Fri, 23 Apr 2021 11:59:34 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 5F807613AD for ; Fri, 23 Apr 2021 11:59:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5F807613AD 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=desiato.20200630; 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=crzBZKS4FkOsgBQ0t8sPuQxvjlskbTalylPMV9ZM9sk=; b=ibCEvjfHKvxe52gOi4YIkv6MKI SOGVYbZtyPlwkCFIeS2yrb38TMIWxcSLa2p217Wzhh4vo1Nm1LNUFcllz2RiBnlbC4DH25jsXgQqO unSxCMjn8y1cWINdOL9dNTTbd84TTgB7L6jHSpijO5Ptu/0TpVNF6DqojoV2FD6Uy3K6lEAqV0evS TaNQ3AszPVeaBkNiAiq4UxjKJTSip4qjA+SY4HnNpSi6jYTWG6RptMWHBhqk9bqYJdXZZzA4Kt0V1 1JkXzlHb2zdtBNwJckYusdKJJO4CXQk8JkRy58y6xz5hayNFJY7MJiQKaI1mYf6OXaqMXQwnAxTZi 4rhAczQA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lZuQz-001P91-2W; Fri, 23 Apr 2021 11:57:21 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lZuQe-001P7j-1a for linux-arm-kernel@desiato.infradead.org; Fri, 23 Apr 2021 11:57:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=8OCtTdC5nBJa7AZmDlmzklJ0KIvQRoRufXj59YXg9RM=; b=aaY3LmC4r6nWJmdQJO2a7SIBUO 4WsATdqZ0EteQf3zm1HzxluiPmbgxrGN+bCLKctH/nd4GjCshuu70reTJRI8FI2Lv3zrAO3pNTCb+ b06jQA6OqIo+KkOK1+NT9myGDpiq0NPK2QQ4rwLntRmqOpErVf8tB5jZyT6zOgKp/n/H7bYAvB6S8 /gaPyJeCLUkxI7+pknEBVkT5q7y8na8fpT4K7Q5iCklS9HFHmiGyj1LcgV8gLEPPEGULzOV8N3nZq dNPu+OrWmwEG+XdC+kbyY80TrrN2DtlzuthDxoQpgIV9qmFyvOy/j5nL6+Xze5VRS2zdPsM6+lofL mAC0ekEw==; Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lZuQa-00ENQ4-Np for linux-arm-kernel@lists.infradead.org; Fri, 23 Apr 2021 11:56:58 +0000 Received: by mail-wr1-x429.google.com with SMTP id r7so36119483wrm.1 for ; Fri, 23 Apr 2021 04:56:55 -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=8OCtTdC5nBJa7AZmDlmzklJ0KIvQRoRufXj59YXg9RM=; b=xxpjzNJRvJDMbMoE0tNn6IDo2ICmCTLmNrSFUy+DyLjclCsJ50hEk67FvEk9pf255W 46kYA9cB+trAycZz8VQ52YcEBz1JuKw9L0As/Us439uqUy+lhb6ugdX6gQzVrEEbqKSB 3/3F/MUMk1RFaiCzi3joPgc4cdcoDV2Kv/cP13xT/VN+2nd7GJJf6VZQ77lMknn5Jvx/ nAqYXlV8EnOuwrN3BrGgd2/btDTxVd1OLXGJXVl40lIBiowFxSC9ZrWQgYTlzjOr8rvy OmsM0uV5OJoaOuWp4izzgx4yX9URzryVAyAwd4UduiR+q/cZJzQKGz4Xwrw6KzMG/14I NXZw== 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=8OCtTdC5nBJa7AZmDlmzklJ0KIvQRoRufXj59YXg9RM=; b=Fc9V0Wul0GCYLHVWQT6D+ghIkUDgzrLHhubx3IOVRGtDjnTJ1Bn+E9JEX6s6jgrZLX viOzXYtUhOpckaP/ErTzyFIQOLtqqbHML/pgIO2Fo2cD+GO8pqplwuvDqJnzojieInWc HUhz4IbuGsb9cbnWOwHeI2wxSRpLZUDMm3Piycxpzq2LnT2/l2sub+0gdOqdzBb3+a7b yFYlC6g4yro73hbw4pdWL3iCmak4ISN5m/dM2B7Tli/rfWULwTe971FoqiizF/0m2ND7 mU9LEHrUzA3iIbWj2Rw2STLq9eAO71EgpUY1B421CiB151K5CqF5yC8B4eMa5VD9bEKx Lsrw== X-Gm-Message-State: AOAM5318Tl9qtcSXmonTLqMaHS2lCUVKQdXpLvFMQREfTQ8hkI76a+WU RE9cYrevfv4EBJLOo0AcVNFStKp2k+KYgTzh X-Google-Smtp-Source: ABdhPJyPpRSQxeHrMpv6L9ZEKawoGl7i7qyluCOrnXzXwS5te0ECEeIqx0XP2UAqECduDHkazD4q7A== X-Received: by 2002:adf:f88f:: with SMTP id u15mr4264902wrp.368.1619179013954; Fri, 23 Apr 2021 04:56:53 -0700 (PDT) Received: from localhost.localdomain ([2001:1715:4e26:a7e0:116c:c27a:3e7f:5eaf]) by smtp.gmail.com with ESMTPSA id g9sm7485195wmh.21.2021.04.23.04.56.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Apr 2021 04:56:53 -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 v2 0/6] Add support for ACPI VIOT Date: Fri, 23 Apr 2021 13:38:31 +0200 Message-Id: <20210423113836.3974972-1-jean-philippe@linaro.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210423_045656_862397_323E6BCC X-CRM114-Status: GOOD ( 14.30 ) 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 platforms. Enable virtio-iommu on non-devicetree platforms, including x86. Since v1 [1]: * The VIOT header definitions have been picked for v5.13 * Share more code with IORT. Patches 1 and 2 extract the common code from IORT. * Simplify the VIOT driver. Use the existing fwnode infrastructure instead of adding hooks to the IOMMU driver. You can find a QEMU implementation at [2], with extra support for testing all VIOT nodes including MMIO-based endpoints and IOMMU. This series, based on linux-next, is at [3] [1] https://lore.kernel.org/linux-iommu/20210316191652.3401335-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 (6): 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/dma: Simplify calls 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 | 129 ++----------- drivers/acpi/bus.c | 2 + drivers/acpi/scan.c | 60 +++++- drivers/acpi/viot.c | 350 +++++++++++++++++++++++++++++++++++ drivers/iommu/amd/iommu.c | 9 +- drivers/iommu/dma-iommu.c | 17 +- drivers/iommu/intel/iommu.c | 10 +- drivers/iommu/virtio-iommu.c | 8 + MAINTAINERS | 8 + 20 files changed, 548 insertions(+), 150 deletions(-) create mode 100644 include/linux/acpi_viot.h create mode 100644 drivers/acpi/arm64/dma.c create mode 100644 drivers/acpi/viot.c Acked-by: Michael S. Tsirkin