Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp558481lqh; Tue, 7 May 2024 07:26:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWm+q0OwYTQ6VJYVcdNkIJw+FWSGdG6xT/n+ngtl6MZXA/tQvy/op/ZNoEIpSoQZXd5J5ah29twfoSs5OOTiohBVEfhqMdUNQ+BpfDwAw== X-Google-Smtp-Source: AGHT+IGpjSo9zZHt9s22nsLI/uzGYMRpIn2Mc9N2Bm8mNLIZduislMNqU97pOgmgtxK2ApbJpRFM X-Received: by 2002:a17:906:bcda:b0:a52:65bd:a19a with SMTP id lw26-20020a170906bcda00b00a5265bda19amr9027231ejb.57.1715091974333; Tue, 07 May 2024 07:26:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715091974; cv=pass; d=google.com; s=arc-20160816; b=YI7LK3V/6B0oeEy5rs9mKrKlhLJC35WHM+j3xtON+x/cgzR0sGnTWVeuiESjJLqH9Y grbAiE9mfl2dkwdDF3kBmuYDW4R4b5brP1uhBDkp13Ex+oSA7ds2rg6wouc23DOUSshz 1uByZwlocIV0/ZAge6yaq54kb/t7SRlYOunq8P/OSNiqWiy2YxLvIXkFNq+Jq7jaWlI2 8P45GNgyztCGzPeswnwhUaWa7xt4zGUyNZ2hvb8h6vLUk3/Ff4lYol2U0UlgegOFUcAc kJGfZFJ9II9ppW7XYbe7mj39hrN65mDXhm7EQw6aFgCZ6RcUVbNdDccbA3FeW6wZEx16 Y82g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:message-id:date :subject:cc:to:from:dkim-signature; bh=BkGvtX4jUwYRJLbDOy4RLI6M69O2g7lMQEi2Kh6V+XU=; fh=7oQ0oh1DFDKdyVGTceIMjz4x7Vn90Ne3AL4DyD69+as=; b=dAY6OeOtBc2lEmHtl/6krXk7XCGI12aN8OmSiOKrX/4wOkxEHLsm7SWg5sO5BIIyGH boUoH2xkZQMX5BJkKIl+hpd1HJtVcA0jNMeFaFKCpNn/DsKkbqyjLNOzgnqqrJpMbQcy EmVJDG4ARHQ9PTdPiXQbZpUxnezWGdwljPDNYLLD04ALReFPLod+PTj6g/rZfEZwiBxu Doy53KG+ZVdDdm0dZ26pb+GUkO+IYD7n0N6vwO+L+RhAi4/BZdJVSwvU9q3KFUwByv4e A4LMMAx0Gd6RPWO7IhnYXeL6Eq7AH7JWa9eVAXqwSO7IdylJL/wLzu8tN1A5gFehgHww cPyw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=UodZUXOM; arc=pass (i=1 spf=pass spfdomain=sifive.com dkim=pass dkdomain=sifive.com dmarc=pass fromdomain=sifive.com); spf=pass (google.com: domain of linux-kernel+bounces-171570-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171570-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id c24-20020a170906529800b00a599c041fd8si4592869ejm.607.2024.05.07.07.26.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 07:26:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-171570-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=UodZUXOM; arc=pass (i=1 spf=pass spfdomain=sifive.com dkim=pass dkdomain=sifive.com dmarc=pass fromdomain=sifive.com); spf=pass (google.com: domain of linux-kernel+bounces-171570-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171570-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 153CA1F238C0 for ; Tue, 7 May 2024 14:26:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5A0F4156678; Tue, 7 May 2024 14:26:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b="UodZUXOM" Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 385B115ECFB for ; Tue, 7 May 2024 14:26:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715091967; cv=none; b=erMzXhBR1AUEkXazxo6xnqukUXXKIkhcNQJw3wBmI8xE4Dqd80XVOpYpyBglfdt4VrwtVuF0YKO+nxJUpThcllw/NH6lAiKNbovsDmKm/onXLldy1xIJHxnC/YXD/ulKlXt28IDK3yZvKpaoZDpnZ5UNBfTskKUggju1gUqMXvs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715091967; c=relaxed/simple; bh=3kMEdbIdgG0v4HUHY9kiHl86gb8P0atzgdn4djrB8b0=; h=From:To:Cc:Subject:Date:Message-Id; b=BsLIlrqmJgTrcZezp4jz2AGThurq9lwTAOY+Xee9mbRenwljDrn2H6pESoBuoz1WYwcSh8QdkJkGNdFvh/wMk+nH7oh0ba3WkwGg7sL4BvSmvyjYEPCE1FzYHEBBnDRDDMHHKD+oGM4wfgdA+FzXcb7lKoEkNwhrT/Yx97mRAz0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=sifive.com; spf=pass smtp.mailfrom=sifive.com; dkim=pass (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b=UodZUXOM; arc=none smtp.client-ip=209.85.210.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=sifive.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sifive.com Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-6f44a2d1e3dso2701031b3a.3 for ; Tue, 07 May 2024 07:26:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1715091965; x=1715696765; darn=vger.kernel.org; h=message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BkGvtX4jUwYRJLbDOy4RLI6M69O2g7lMQEi2Kh6V+XU=; b=UodZUXOMFO8Tzx585sLLDoMJmpWXv/UA2FRisAFWjdotupFDshimAUzTONYNpxLW0f OnnqkMTqDgswlQBI1QBn74Qc0SDApByIYTkhNv2fQXA1i9RupJ7MFHTlMvFyhlH++p26 6F+Qp11voRNb71b15dnw8EpAN9xJ3KHwE5w7nQpGcUSk8cDLsrKaCaqj8zIV98PbM68q kYwq1ti0snHquwGBsbIjObR9OS6pry+BXIwOZWAnf9GY58TEHvFRKkXlxnECSGhmsc1D y+mFglQ65tq+d/AcnXhDovmwvcc4SUrw/5YdQ+V9JikwA7A0XL4GGOtQCPR7fgsJpEDY EMQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715091965; x=1715696765; h=message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BkGvtX4jUwYRJLbDOy4RLI6M69O2g7lMQEi2Kh6V+XU=; b=sYK8Tw3wdP4MOQVHkd9KafdDtalxjbheZxDgdBRbUbFTHh5g6zy4bhYr5SdsLeIyXm aoE2sXJ0jIjSytu9sA7GKloTJD0jxhfCXs5BYd1+xDr4+DtydrYDy5QmWIMClOrTAtVs Cv5NvKL6O7nud/Sf2AZS7+Yapj0XVcfy/sjx+ZLIsQXRVnxKAPhMLEo8ttagZY8tVnTn HFwmMZX9WNUJzhk2Y4KHvkgR3htvO0/2M99EBgyYriJ2Ryt6B8APq6Q3AUlWxR3n18mY K+SaC4X0Di+BC2XHQpZT/wqH5phufhopZJWjiIuVpIoMt3Eb4Q5YwV6p+TpAa9WmwzDP JfZw== X-Forwarded-Encrypted: i=1; AJvYcCXsuowL0hSIqgNgmgFqZisNwhuqQNm/DDQcmn2UUTVi22qRZ2x3ELBdAyg3SM0sAMu8+AwF+Pt6d42GTDPkEfDwgf086p6N6Bj1sy27 X-Gm-Message-State: AOJu0Ywfa9HrUN3PG9ESUBNJiL63rB9tNX8NstGEj0/58MBjmBOZJB0b CxV1bnto66CCzm1C/5iWZuXrbkqI+OrPzwkYQNPCICR6eBHRKHFE0JTkycRiTMw= X-Received: by 2002:a05:6a20:914c:b0:1af:a4d0:1614 with SMTP id x12-20020a056a20914c00b001afa4d01614mr7766162pzc.6.1715091965553; Tue, 07 May 2024 07:26:05 -0700 (PDT) Received: from hsinchu26.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id i22-20020aa79096000000b006f44bcbe7e3sm7687554pfa.201.2024.05.07.07.26.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 07:26:05 -0700 (PDT) From: Zong Li To: joro@8bytes.org, will@kernel.org, robin.murphy@arm.com, tjeznach@rivosinc.com, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, jgg@ziepe.ca, kevin.tian@intel.com, linux-kernel@vger.kernel.org, iommu@lists.linux.dev, linux-riscv@lists.infradead.org Cc: Zong Li Subject: [PATCH RFC RESEND 0/6] RISC-V IOMMU HPM and nested IOMMU support Date: Tue, 7 May 2024 22:25:54 +0800 Message-Id: <20240507142600.23844-1-zong.li@sifive.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: This series includes RISC-V IOMMU hardware performance monitor and nested IOMMU support. It also introduces operations for the g-stage table, which are required for nested IOMMU. This patch set is implemented on top of the RISC-V IOMMU v4 series [1], and it will be submitted as an RFC until the RISC-V IOMMU has been merged. Additionally, it will be updated as needed when a new version of the RISC-V IOMMU series is posted. [1] link: https://lists.infradead.org/pipermail/linux-riscv/2024-May/053708.html Zong Li (6): iommu/riscv: Add RISC-V IOMMU PMU support iommu/riscv: Support HPM and interrupt handling iommu/riscv: support GSCID iommu/riscv: support nested iommu for getting iommu hardware information iommu/riscv: support nested iommu for creating domains owned by userspace iommu/riscv: support nested iommu for flushing cache drivers/iommu/riscv/Makefile | 4 +- drivers/iommu/riscv/iommu-bits.h | 22 ++ drivers/iommu/riscv/iommu-pmu.c | 477 ++++++++++++++++++++++++++++++ drivers/iommu/riscv/iommu.c | 481 +++++++++++++++++++++++++++++-- drivers/iommu/riscv/iommu.h | 8 + include/uapi/linux/iommufd.h | 39 +++ 6 files changed, 1002 insertions(+), 29 deletions(-) create mode 100644 drivers/iommu/riscv/iommu-pmu.c -- 2.17.1