From patchwork Wed Mar 15 20:05:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Tyshchenko X-Patchwork-Id: 9626569 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 69B4E60522 for ; Wed, 15 Mar 2017 20:08:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 58D992856F for ; Wed, 15 Mar 2017 20:08:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4CF6F28676; Wed, 15 Mar 2017 20:08:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8470C28675 for ; Wed, 15 Mar 2017 20:08:38 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1coFBI-00005O-Pl; Wed, 15 Mar 2017 20:06:00 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1coFBH-0008WJ-MR for xen-devel@lists.xenproject.org; Wed, 15 Mar 2017 20:05:59 +0000 Received: from [85.158.139.211] by server-2.bemta-5.messagelabs.com id 63/A3-20080-6AE99C85; Wed, 15 Mar 2017 20:05:58 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrGIsWRWlGSWpSXmKPExsVyMbThkO6yeSc jDPavl7T4vmUykwOjx+EPV1gCGKNYM/OS8isSWDPOPbMquMJX0f66kbWBcQFPFyMXh5DADEaJ N3OvsII4LAIvWSRm3F3ODOJICPSzSlxd9Jixi5ETyImR2H39NJRdLbH58Fd2EFtIQEni9c7NT BD2HCaJ9m3hIDabgIHE/ndPwGpEgGrurZrMBDKUWeAMo8TnRZPBGoQFvCS2N6wEs1kEVCX+dS xgBrF5BZwkpm+bwQSxTE7i5rlOsDingLPEi6ctrBDLnCSmLTjJPIFRYAEjwypGjeLUorLUIl1 Dc72kosz0jJLcxMwcXUMDU73c1OLixPTUnMSkYr3k/NxNjMDQYgCCHYwXT3seYpTkYFIS5VUR PBEhxJeUn1KZkVicEV9UmpNafIhRhoNDSYL3dBdQTrAoNT21Ii0zBxjkMGkJDh4lEd6GbqA0b 3FBYm5xZjpE6hSjMceDU7veMHF86j/8hkmIJS8/L1VKnNcWpFQApDSjNA9uECz6LjHKSgnzMg KdJsRTkFqUm1mCKv+KUZyDUUmY1wlkCk9mXgncvldApzABnZL48wjIKSWJCCmpBsYd0gF5fl8 nmrWUHlBtYvuSudCN7dieizrz7ZbLFnz58NnOKckr3FqnZv45fYfsO3Mrr07rmyh6qj0xSkXI 6Wehv9Qm68+xcTfSL6zizZKYLJv58ey9Y5zH17yL4/13tztSunHD+8u7+tteb/NKCVsu3bJh+ aP9zrnMFefvLfS/KLRVYF8D73QlluKMREMt5qLiRADW1sFAuQIAAA== X-Env-Sender: olekstysh@gmail.com X-Msg-Ref: server-13.tower-206.messagelabs.com!1489608358!74146783!1 X-Originating-IP: [209.85.128.194] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG X-StarScan-Received: X-StarScan-Version: 9.2.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 64827 invoked from network); 15 Mar 2017 20:05:58 -0000 Received: from mail-wr0-f194.google.com (HELO mail-wr0-f194.google.com) (209.85.128.194) by server-13.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 15 Mar 2017 20:05:58 -0000 Received: by mail-wr0-f194.google.com with SMTP id u48so3367350wrc.1 for ; Wed, 15 Mar 2017 13:05:58 -0700 (PDT) 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; bh=vXNRzIK6KTGE9/j5hW7iqjN4uAf6jkwqys5cQB1yDQk=; b=G5vIzaYJ3vx0ky1Br6i6XIghnt2m97hLV74bqQ4JwUq38HKAXvoyxWMfl1fdXWYEIc w8OR8qdQMXh82+pFAOkINqX6/JA7sO4kwzI1nI7AprSYW9rnuwrkuw3g7XyEDycIgCQY rtHffL6N6OkF3s2ssjESL4x+laX+LQVac0qOatgY97oKM8QWazhBQAtXdMqfS69T1Wdg BtDIPGP2VlSxXrgdzPGxS2AKfDYxEaBAehKA6abpKW6GWipJYMAau05xPVosK+1pfwDO YqPA6Ax7vPeSrg9aB6cz4I/lNlR4yuhxkq6Jfv4eEG/6l+s7GKri7v4jIzbuq7wbMUTM 3SrQ== 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; bh=vXNRzIK6KTGE9/j5hW7iqjN4uAf6jkwqys5cQB1yDQk=; b=g+4Uoc2C5ABf9KvIaczEIFPSdrR8nyag9oWg8gV0JQFhXnahhiNg/MHvUI/b9Qoj5L 4L/9YkCMWCSZ6k7Hdk48BvBAqb+rNKjqVXtIJSMXIAGASihzmB5Ao6ipfGK3dMv1zS4r QGRpl7jtLFndx9kXr6RzxxG+jwIs0RPQSctyk+Mz/RgVNP+45Yz/OAQvDTFQ90Q2Z9HN XlvZ++BgK3QYV6AOFuU2YBJelnE6o/c7YLx8DuNcKhyc8sCLBZMIuu5pqo8Rikt6bg6a jA4TwcAyURsktWueVSRn+t18SNzkTra6FyC6n7adq3JS6tBwGYYyYCljr9O3vXOfg6p2 jYiA== X-Gm-Message-State: AFeK/H2wzowDzH86x0THvaclF/gvMKm9mAJrZ7xPONgLQbIivt8Mmk4WmNPKKijhP6pL9Q== X-Received: by 10.223.160.231 with SMTP id n36mr5296450wrn.167.1489608358105; Wed, 15 Mar 2017 13:05:58 -0700 (PDT) Received: from otyshchenko.kyiv.epam.com (ll-74.141.223.85.sovam.net.ua. [85.223.141.74]) by smtp.gmail.com with ESMTPSA id b130sm1651516wma.17.2017.03.15.13.05.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 15 Mar 2017 13:05:57 -0700 (PDT) From: Oleksandr Tyshchenko To: xen-devel@lists.xenproject.org Date: Wed, 15 Mar 2017 22:05:27 +0200 Message-Id: <1489608329-7275-8-git-send-email-olekstysh@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1489608329-7275-1-git-send-email-olekstysh@gmail.com> References: <1489608329-7275-1-git-send-email-olekstysh@gmail.com> Cc: sstabellini@kernel.org, vlad.babchuk@gmail.com, al1img@gmail.com, andrii.anisov@gmail.com, olekstysh@gmail.com, andr2000@gmail.com, julien.grall@arm.com, JBeulich@suse.com, joculator@gmail.com Subject: [Xen-devel] [RFC PATCH 7/9] iommu/arm: Add alloc_page_table platform callback X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Oleksandr Tyshchenko The alloc_page_table callback is a mandatory thing for the IOMMUs that don't share page table with the CPU on ARM. The unshared IOMMUs have to perform all required actions here to be ready to handle IOMMU mapping updates right after completing it. The arch_iommu_populate_page_table() seems an appropriate place to call newly created callback. Since we will only be here for the unshared IOMMUs always return error if the callback wasn't implemented. Signed-off-by: Oleksandr Tyshchenko --- xen/drivers/passthrough/arm/iommu.c | 5 +++-- xen/include/xen/iommu.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/xen/drivers/passthrough/arm/iommu.c b/xen/drivers/passthrough/arm/iommu.c index 95b1abb..f132032 100644 --- a/xen/drivers/passthrough/arm/iommu.c +++ b/xen/drivers/passthrough/arm/iommu.c @@ -70,6 +70,7 @@ void arch_iommu_domain_destroy(struct domain *d) int arch_iommu_populate_page_table(struct domain *d) { - /* The IOMMU shares the p2m with the CPU */ - return -ENOSYS; + const struct iommu_ops *ops = iommu_get_ops(); + + return ops->alloc_page_table ? ops->alloc_page_table(d) : -ENOSYS; } diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h index ab68ae2..3150d7b 100644 --- a/xen/include/xen/iommu.h +++ b/xen/include/xen/iommu.h @@ -181,6 +181,7 @@ struct iommu_ops { int __must_check (*unmap_page)(struct domain *d, unsigned long gfn); int __must_check (*unmap_pages)(struct domain *d, unsigned long gfn, unsigned long page_count); + int (*alloc_page_table)(struct domain *d); void (*free_page_table)(struct page_info *); #ifdef CONFIG_X86 void (*update_ire_from_apic)(unsigned int apic, unsigned int reg, unsigned int value);