From patchwork Wed Jan 22 01:59:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bobby Eshleman X-Patchwork-Id: 11344977 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1A042159A for ; Wed, 22 Jan 2020 05:14:51 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 E8E0E24656 for ; Wed, 22 Jan 2020 05:14:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UPy7+4Ej" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E8E0E24656 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iu8LI-0005Oz-21; Wed, 22 Jan 2020 05:14:16 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iu5Lb-0006Co-72 for xen-devel@lists.xenproject.org; Wed, 22 Jan 2020 02:02:23 +0000 X-Inumbo-ID: 0d189d18-3cbb-11ea-aecd-bc764e2007e4 Received: from mail-yw1-xc44.google.com (unknown [2607:f8b0:4864:20::c44]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 0d189d18-3cbb-11ea-aecd-bc764e2007e4; Wed, 22 Jan 2020 02:01:06 +0000 (UTC) Received: by mail-yw1-xc44.google.com with SMTP id i126so2495080ywe.7 for ; Tue, 21 Jan 2020 18:01:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=W/Qj314nUGRdjbntBZbYQP1MhXRJYFfaG0a5TIgJ0SE=; b=UPy7+4EjqTWccbmyyVRpXxIXJDYmd7uUGpqVPvLOwhLBAM38YgjYv+NmIMF1wiC2sv UuVk3gSnszs3QvZyHK4QmOC2RTzBafjLiIOVR2XOfKzxqDaBr3hlKrqmrSqDZhq5zi6/ 79VjlPsocbP3bUld0bWlqT+7bEdNqv3dAxs+bObV3ezMgmEN1xm1by24sljtseI+ln0G bNwYj31E7XisxGmnt2D1jsD4oBDvm8ZYuo6i7TwZHaq40/5GslqVNJTFLr3yOp4j624m ISv2wrW5NIPIXhgCoQTOxESlO83K02KG6U9t/OCqNyZkDKhkzvBxJ0biw62wbg9vKYS4 xxzw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=W/Qj314nUGRdjbntBZbYQP1MhXRJYFfaG0a5TIgJ0SE=; b=GcZFGwSrNFyrFDbRZ8DqMQRLd1OzG8dPNSmeCqozK2WqKYnjm9BLKiKPLgEJoeliUf VVHjjKDTYIcsz8Jm2eSU655ODLW+NPyJpT6M7IrxTlCHPihNYUCHcfYN4XhpD2VP9YPp YKtIIA67IvO9HRGzZIpbxpymvKCLWokLJDEeDY+27LCVOtGqR2oHECh3ptk6/Be2mbhp vgJNQLT5tSDQr3/BKg4bpZYUap9gFT7FlJm5ISJ8RZ3zmiRaHBPypQHst7rgQ54TezDV ihYLemJn5Sg1Q5pQSJeA48mPfdU7S/YHzI16tI8MYawRK43NAXWkzf4gOyFGfwPrWxOz moIA== X-Gm-Message-State: APjAAAXNZaUP78S4aDnEFd/UalbpQNmIZfniPmfHZC96PQu8m45EnU+a dOJSemq4qCjSepC8qFa7soD6iV37Aa6hOQ== X-Google-Smtp-Source: APXvYqypHKIk5UUrw8rF3FWiaK/rQhG3UZUfVJiEceqrSNmqzopVrv/cc+A4YsKPUfjgQE2In11pRw== X-Received: by 2002:a81:294c:: with SMTP id p73mr802039ywp.477.1579658465813; Tue, 21 Jan 2020 18:01:05 -0800 (PST) Received: from bobbye-pc.knology.net ([216.186.244.35]) by smtp.gmail.com with ESMTPSA id q185sm17504248ywh.61.2020.01.21.18.01.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jan 2020 18:01:05 -0800 (PST) From: Bobby Eshleman To: xen-devel@lists.xenproject.org Date: Tue, 21 Jan 2020 19:59:02 -0600 Message-Id: <387e30c429bca2ca976a6fa76b601dacf3ca9e1e.1579615303.git.bobbyeshleman@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: References: MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 22 Jan 2020 05:14:01 +0000 Subject: [Xen-devel] [RFC XEN PATCH 23/23] riscv: Add iommu.c X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Bobby Eshleman , Stefano Stabellini , Julien Grall , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Bobby Eshleman , Dan Robertson , Alistair Francis Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Signed-off-by: Bobby Eshleman --- xen/drivers/passthrough/riscv/iommu.c | 74 +++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 xen/drivers/passthrough/riscv/iommu.c diff --git a/xen/drivers/passthrough/riscv/iommu.c b/xen/drivers/passthrough/riscv/iommu.c new file mode 100644 index 0000000000..81db4958b2 --- /dev/null +++ b/xen/drivers/passthrough/riscv/iommu.c @@ -0,0 +1,74 @@ +/* + * IOMMU framework for RISC-V + * + * Based off passthrough/arm/iommu.c + * + * Bobby Eshleman + * Copyright (c) 2019 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include + +static const struct iommu_ops *iommu_ops; + +const struct iommu_ops *iommu_get_ops(void) +{ + return iommu_ops; +} + +void __init iommu_set_ops(const struct iommu_ops *ops) +{ + BUG_ON(ops == NULL); + + if ( iommu_ops && iommu_ops != ops ) + { + printk("WARNING: Cannot set IOMMU ops, already set to a different value\n"); + return; + } + + iommu_ops = ops; +} + +int __init iommu_hardware_setup(void) +{ + /* TODO */ + return 0; +} + +void __hwdom_init arch_iommu_check_autotranslated_hwdom(struct domain *d) +{ + /* TODO */ + return; +} + +int arch_iommu_domain_init(struct domain *d) +{ + /* TODO */ + return 0; +} + +void arch_iommu_domain_destroy(struct domain *d) +{ + /* TODO */ +} + +int arch_iommu_populate_page_table(struct domain *d) +{ + /* TODO */ + return -ENOSYS; +} + +void __hwdom_init arch_iommu_hwdom_init(struct domain *d) +{ + /* TODO */ +}