From patchwork Thu Jun 10 07:51:27 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: 457827 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp165781jae; Thu, 10 Jun 2021 01:04:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJweFYDgDJXnNHeDuZLga+m66Jhcy2/YxzHWKcMMRqxuV0NdUXxX9cQzpUwtQMkMZxyZX9dX X-Received: by 2002:a17:907:330d:: with SMTP id ym13mr1876637ejb.160.1623312259751; Thu, 10 Jun 2021 01:04:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623312259; cv=none; d=google.com; s=arc-20160816; b=DaljT3yi1ucajQhjJSqdp1jNfRd5T8uG+ClyFO7Y4eBM2BpTaoliE97xXplBpuTo9T QShRwnVTin0JR0P34JJUQ6Zlf1lBPRuL41eJ36ZXBtqdcF6cWkG5ydpJ4u5Fa6jv4kVs w/Bsf1wDrrjsKT39LPFv1vyWhLlkOjxXgepwNcxeop8TSUz8/eGeFHymC0iCEQBfbPM1 TW3BreTh1ldfd88bJ9X1HAu01ExYh3MBkqJidv4N95tG46/fkhjxJKEbH4XnirGMlKTl k6+M4OmAS4unOwcH2uWErgGYcjtkP0BNWbnk3/k03WkJJh/SlhgaL7RamZ7Dpzy+JUqH 3SBg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=6d64EfMmKjBsLXuufmWEUBLj9XWA4YjPbU9Y/1wt2B8=; b=tFXHOEILU5zflEWWV9MxtTxVzA/yMVsv2Tb1CzOOqIBSwsUkDSAkVRgz20s0qrlQoE A9DZHZTnFthBzTG1nG2smtDVs0E1ALX1b0k1jVX9wwCm5wGlP1GKhfOt07h/s7YET2x9 2URwlgHX0QNgcHTS20m6kGe2B0xPvRnlwbf97ifGeM1MxnOqkt1CR4lgeadnCOzUvpn0 nrzfw8k5kLJ6ylCakayFtLT08Xf2dnYwzqP5Ze18O2Ef60J8Fp5ERXRbFd/Ozov9WMIw Vo/Rj8EASQ16kM14/M/powIl4PaF+K7C0TBSsTSQI1OpMTsM2lK6A7pfS3+YQpvVeE3L bK8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="ObI/IzUu"; spf=pass (google.com: domain of linux-acpi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u11si1794275edx.42.2021.06.10.01.04.19; Thu, 10 Jun 2021 01:04:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-acpi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="ObI/IzUu"; spf=pass (google.com: domain of linux-acpi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229980AbhFJIFn (ORCPT + 4 others); Thu, 10 Jun 2021 04:05:43 -0400 Received: from mail-wr1-f46.google.com ([209.85.221.46]:42761 "EHLO mail-wr1-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229914AbhFJIFm (ORCPT ); Thu, 10 Jun 2021 04:05:42 -0400 Received: by mail-wr1-f46.google.com with SMTP id c5so1134014wrq.9 for ; Thu, 10 Jun 2021 01:03:46 -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=6d64EfMmKjBsLXuufmWEUBLj9XWA4YjPbU9Y/1wt2B8=; b=ObI/IzUukEYxx+7H8+Qf0c5GsgYSNdbZSErulQp+S5M095cDQ63LAs4nqiCOr4OSe0 i/FNuhtV6CsQXPFO7XOQ6EM/eQxQDqwiYBae+RKq3EOIgwxnwJUnU7d09ygRpJh0rbiS WmfD13dPCc27InjhoUw07zaBwR0qqlRJMZrskGrqVpjWJEuhLHcy7PnYvSBzEkMk7Y4C X/nPyuSTqbaIwiPMZbeIP5zs4ELOKDWw4c7/dWuPyF1U172DTBtgjmadVm4nASZWRfbM M0tjl+lcuIZQH59VeO5Eb0JfSz8aylyM0XkCrZmSE6BhddflN5ZkTX1nTFcqksk8IJHb gIbQ== 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=6d64EfMmKjBsLXuufmWEUBLj9XWA4YjPbU9Y/1wt2B8=; b=PavOPCSPo/v+yHHZiS7mWwWMwIO4Dd58FBwwtduNSkMtrcnuVgUkjYwOx7d6UkZFEp qUtwBHO2b/IKLz4IunFtNgzbJnMcY5ZYrUjMVQNxBus1Niuc5rcjV+0U2C8YakzAJ+eZ NabSRxCfurLaGEXXOoEcv4Rc5dqj2+eqHI4IAYRqfFFWmpZYywsD0HM9rqRc/Axwrdjm kBHWAuSeoGU9wEV2gmM2bxoijJteciu5crnunBt2XCiOapbDXutegcfpE4bg7WUOPtmi Qxru5xp/JiMdm4z032jUEMslLVav1MJG6V1tCMy8M1PndKEuLze67PPf1bm0c/Z20Ixb yE9A== X-Gm-Message-State: AOAM533DUxhMcPm0QT2DefCVIBw+Ms640OHRvqJtQ12dgewMZ7X4k6pt kHOHU8Wb4tNdleRzl+w+wEv53A== X-Received: by 2002:a5d:6b81:: with SMTP id n1mr3885872wrx.144.1623312166388; Thu, 10 Jun 2021 01:02:46 -0700 (PDT) Received: from localhost.localdomain (adsl-84-226-111-173.adslplus.ch. [84.226.111.173]) by smtp.gmail.com with ESMTPSA id o3sm2715059wrm.78.2021.06.10.01.02.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Jun 2021 01:02:45 -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 v4 0/6] Add support for ACPI VIOT Date: Thu, 10 Jun 2021 09:51:27 +0200 Message-Id: <20210610075130.67517-1-jean-philippe@linaro.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.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 v3 [1] I fixed a build bug for !CONFIG_IOMMU_API. Joerg offered to take this series through the IOMMU tree, which requires Acks for patches 1-3. 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/20210602154444.1077006-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 | 78 +++++++- drivers/acpi/viot.c | 364 +++++++++++++++++++++++++++++++++++ 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, 580 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 -- 2.31.1 Tested-by: Eric Auger