From patchwork Wed May 10 14:03:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Tyshchenko X-Patchwork-Id: 9719911 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 5F4346035D for ; Wed, 10 May 2017 14:06:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 50FC828602 for ; Wed, 10 May 2017 14:06:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 45D1528608; Wed, 10 May 2017 14:06:05 +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 DF2A928602 for ; Wed, 10 May 2017 14:06:04 +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 1d8SDP-0007An-VS; Wed, 10 May 2017 14:03:43 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d8SDO-00076v-RA for xen-devel@lists.xenproject.org; Wed, 10 May 2017 14:03:42 +0000 Received: from [85.158.137.68] by server-4.bemta-3.messagelabs.com id 59/17-02192-EBD13195; Wed, 10 May 2017 14:03:42 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrKIsWRWlGSWpSXmKPExsVyMbThoO4+WeF Ig+3NzBbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8aL14dZCq7yVxw6uJm9gfEVTxcjJ4eQwAxG iTvXDLsYuThYBF6ySKyb28gI4kgI9LNK7PjQyg5SJSEQJ9H97TWUXSUx9fMPZohuJYnXOzczg TQICcxikuhvfs4IkmATMJDY/+4JWIMIUNG9VZOZQGxmgXKJnpnL2LoYOTiEBbwlnnxMAwmzCK hKLJq0BayVV8BZYu/kJhaIXXISN891gu3iFHCR2PH6DgvEXmeJ/x+/s05gFFjAyLCKUaM4tag stUjX2EAvqSgzPaMkNzEzR9fQwFgvN7W4ODE9NScxqVgvOT93EyMwsOoZGBh3MHae8DvEKMnB pCTKq7tLKFKILyk/pTIjsTgjvqg0J7X4EKMMB4eSBO8FGeFIIcGi1PTUirTMHGCIw6QlOHiUR HiPSgCleYsLEnOLM9MhUqcYjTleXH7/nonjycof75mEWPLy81KlxHm7QCYJgJRmlObBDYLF3i VGWSlhXkYGBgYhnoLUotzMElT5V4ziHIxKwrwXQabwZOaVwO17BXQKE9ApgQwCIKeUJCKkpBo YWU5dPTv58eWrcaYXq7dZy1/YzJB7007MYVPq2+uJhffm1q7patq8482148k3crmnpttlLv98 dfWVFR5NXv3B/3+td/5XUGbaoCNW0vK8/Fpl8U17rleTfz4y6d3Z0OLw5tPPc9EpPt77PHJFd ilf7X36eGuS/8U572c9r40Ima8WfFtITPO4mhJLcUaioRZzUXEiAOXY/tu4AgAA X-Env-Sender: olekstysh@gmail.com X-Msg-Ref: server-9.tower-31.messagelabs.com!1494425021!44212944!1 X-Originating-IP: [209.85.128.193] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG X-StarScan-Received: X-StarScan-Version: 9.4.12; banners=-,-,- X-VirusChecked: Checked Received: (qmail 44368 invoked from network); 10 May 2017 14:03:42 -0000 Received: from mail-wr0-f193.google.com (HELO mail-wr0-f193.google.com) (209.85.128.193) by server-9.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 10 May 2017 14:03:42 -0000 Received: by mail-wr0-f193.google.com with SMTP id v42so8709985wrc.3 for ; Wed, 10 May 2017 07:03:41 -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=KznhvinkNK7Ny3JouladScdQNMC9bnjC+tb94P/DhSI=; b=Y6zDLOvrNQftcqLcO8P/02vk835ciSUYMfRuJqwz4GF2yb9F0bGs4AHt12PS/LYUdy ASQ6HoB6//p5G/P8ka2KBJ8joZR0QtZA7VaOhIxetxWFX3rx8dLT6JRGCr4dv+gRZ8RP TcM4e76wn98SegpG3sqC41cg57PZYXA0b4CchRRiglQmBjfYfeNDm/AK/eRZdwmQwbA5 tzup3mRcriPLfOePHRMgwm1iHONWH8IztGRvMm7tNXTlzRh4HppGCLGcU9Wrc5VBlKfk zzgiR6L4WyHRUIr0lu3Wk4C6NpyMKTO6uZOorGlcBxrlcZh9edK/gfIs3bJajM2CDOaJ 3kPg== 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=KznhvinkNK7Ny3JouladScdQNMC9bnjC+tb94P/DhSI=; b=hAsKPos1xVfiWg6+eT4bn22jkuWWUJA3f+uRgkjd0X61S0gi+GXq8bjk+rPqNN0CQm coxVWzdq9vb2TipLS1hs59tFjRRJL7ViFk9e2HcDCoBvUf1rqj5DypWwx/bWE5IT8DpK EKsa+91F52ay8v3gosHRq3CgiYdIDVVIFhdzoMzb2HkoKyLDn8PVJmbhWoPu95EnJPYP El9nmy4sVk5S+qyBRFECbduRTGyYyVpQTQggnF5Ejc7CFlXHoGF+IoQYQVY6SxuKxGhd c4qCHH9N8rBJemn4pKROM+f6oDhoIun4tneuzqcc2ooyNJA3PNe804DX83CZFMhcTGap s5Bg== X-Gm-Message-State: AODbwcBzP7tHvQAqlcV/AKao595xkNHbFOj9oPbhQQ4ZQSO7nLCSeXva 7kg3UZ3Yz7Futw== X-Received: by 10.223.135.42 with SMTP id a39mr3598713wra.113.1494425021640; Wed, 10 May 2017 07:03:41 -0700 (PDT) Received: from otyshchenko.kyiv.epam.com (ll-54.209.223.85.sovam.net.ua. [85.223.209.54]) by smtp.gmail.com with ESMTPSA id c34sm3378304wrc.7.2017.05.10.07.03.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 10 May 2017 07:03:40 -0700 (PDT) From: Oleksandr Tyshchenko To: xen-devel@lists.xenproject.org Date: Wed, 10 May 2017 17:03:11 +0300 Message-Id: <1494424994-26232-8-git-send-email-olekstysh@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1494424994-26232-1-git-send-email-olekstysh@gmail.com> References: <1494424994-26232-1-git-send-email-olekstysh@gmail.com> Cc: wei.liu2@citrix.com, julien.grall@arm.com, sstabellini@kernel.org, ian.jackson@eu.citrix.com, jbeulich@suse.com Subject: [Xen-devel] [PATCH v1 07/10] 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 non-shared 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 non-shared IOMMUs always return error if the callback wasn't implemented. Signed-off-by: Oleksandr Tyshchenko CC: Jan Beulich --- Changes in V1: - Wrap callback in #ifdef CONFIG_ARM. --- xen/drivers/passthrough/arm/iommu.c | 5 +++-- xen/include/xen/iommu.h | 3 +++ 2 files changed, 6 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 3afbc3b..f5914db 100644 --- a/xen/include/xen/iommu.h +++ b/xen/include/xen/iommu.h @@ -175,6 +175,9 @@ struct iommu_ops { unsigned int flags); int __must_check (*unmap_pages)(struct domain *d, unsigned long gfn, unsigned int order); +#ifdef CONFIG_ARM + int (*alloc_page_table)(struct domain *d); +#endif /* CONFIG_ARM */ void (*free_page_table)(struct page_info *); #ifdef CONFIG_X86 void (*update_ire_from_apic)(unsigned int apic, unsigned int reg, unsigned int value);