From patchwork Wed Mar 15 20:05:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Tyshchenko X-Patchwork-Id: 9626577 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 A1823604A9 for ; Wed, 15 Mar 2017 20:10:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8FBAA28674 for ; Wed, 15 Mar 2017 20:10:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 849C628676; Wed, 15 Mar 2017 20:10:26 +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 0761428674 for ; Wed, 15 Mar 2017 20:10:26 +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 1coFBG-0008Vv-A7; Wed, 15 Mar 2017 20:05:58 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1coFBF-0008VK-ID for xen-devel@lists.xenproject.org; Wed, 15 Mar 2017 20:05:57 +0000 Received: from [85.158.139.211] by server-9.bemta-5.messagelabs.com id 1A/2E-32461-4AE99C85; Wed, 15 Mar 2017 20:05:56 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrEIsWRWlGSWpSXmKPExsXiVRvkrLtk3sk Ig8PLWSy+b5nM5MDocfjDFZYAxijWzLyk/IoE1oyVZzYyFjzhrVj0rJ+xgfEhdxcjF4eQwHRG iQfzz7GBOCwCL1kkVh+ZBuZICPSzSlz9uYqxi5ETyImRuD/tHRuEXSFx+9NRZhBbSEBJ4vXOz UwQo+YwSXw62wRWxCZgILH/3RN2EFsEqOjeqslgRcwCZxglPi8CcTg5hAXCJW62PQRrYBFQlf ixYz9YA6+Ak8TfRYtYILbJSdw81wm2jVPAWeLF0xZWiM1OEtMWnGSewCiwgJFhFaNGcWpRWWq RrpGlXlJRZnpGSW5iZo6uoYGpXm5qcXFiempOYlKxXnJ+7iZGYHjVMzAw7mC8vMXvEKMkB5OS KK9K7skIIb6k/JTKjMTijPii0pzU4kOMMhwcShK8vHOBcoJFqempFWmZOcBAh0lLcPAoifD6g KR5iwsSc4sz0yFSpxh1OT70H37DJMSSl5+XKiXOaw9SJABSlFGaBzcCFnWXGGWlhHkZGRgYhH gKUotyM0tQ5V8xinMwKgnzFoJM4cnMK4Hb9AroCCagI95+OAFyREkiQkqqgTE2U+1Q7qz6uqa a2GbN1VsVthyMSG/4/GHV0YOLfMzXtrm/WxifpL/K5PLruxW7p78+9myZy5MPJmJp9/SvFpu5 Br/5NOmcRtYJuf9hkSv/TH+gznWV1b7U9UvJrxO5kSv9eNQkazZWBk19v5hR6FKfzRbTKJm15 WxbS6azr72z327LVeHjwieVWIozEg21mIuKEwGFmDyltQIAAA== X-Env-Sender: olekstysh@gmail.com X-Msg-Ref: server-15.tower-206.messagelabs.com!1489608355!75649492!1 X-Originating-IP: [74.125.82.67] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.2.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 61311 invoked from network); 15 Mar 2017 20:05:56 -0000 Received: from mail-wm0-f67.google.com (HELO mail-wm0-f67.google.com) (74.125.82.67) by server-15.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 15 Mar 2017 20:05:56 -0000 Received: by mail-wm0-f67.google.com with SMTP id x124so809821wmf.3 for ; Wed, 15 Mar 2017 13:05:56 -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=OSNuvRL8QEEk4s3VcWLRlxi15XNjSjhD4tAOAZlTMs8=; b=iX16qLpwUSihM5VQHYSOvVq8y3+hxUlvhUrIjZ1hR6R/OjlzVQm3g1j1Gt3l5SfZ1N 1Qp4NdIQPRA4feR7XiyV3ulnQ77bgf0yToNojwtqr4XDOEMdNa3+EGlBjo/IQX+Jhevx vemGcE/mqTGCsH4pHIqyGvL8wPwhRs8JhbTilQnMJEzfkqyZ/zCPB//2G61ILqGUOsZt yXO8dXwV6PyFtF+/+WPldZA48tm6yX7/st6aYD3TI4d8f8SGrRa/v6JDjZ+kkxxMviTl Exwb1Y8o7vIo/ewpKlAIW9JdJJWq6rV7e4u15EWUDe7ipfxlaupqBUfXYJgvt526izWy v1bw== 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=OSNuvRL8QEEk4s3VcWLRlxi15XNjSjhD4tAOAZlTMs8=; b=giZRQX9zYXxb0GvJgdpqmYVcSDuqflimvL3j9KFuSKsEnt8tjGIvYxzhqREHY4W4U5 xv3nBFeigfC0ogAdzpJx1h2phAzmKZSOtltq97fawaJ0CcDWq5ywVubFa/d1IDES0/d7 AScEXlsoEB6Nv2KGbLE90/OF5zbvJx9TdzyKLdYoKtr/MdW+sQKz49Wy4DxHu2GkUxyK uwGT2RLCYZ4xUW1ahVzwzd1vdHyBjr+xLQ15VQWHZovjKAp8phcNQSTjrPYrXZ6KBExk z2j1J2Xav2+gV/UbbY6ZdEt8kUbmgEEp7QqRHptnJ+Ky/HrzdVsQsuURcwGSzhyXhT49 BuAA== X-Gm-Message-State: AFeK/H0Q15pCsY8BtbHKWcJN+rxt7VZdJrnWACRHlxOJmBAE7nOP7/AGxyyWHQYIMTqNtw== X-Received: by 10.28.183.4 with SMTP id h4mr22606302wmf.140.1489608355724; Wed, 15 Mar 2017 13:05:55 -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.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 15 Mar 2017 13:05:55 -0700 (PDT) From: Oleksandr Tyshchenko To: xen-devel@lists.xenproject.org Date: Wed, 15 Mar 2017 22:05:25 +0200 Message-Id: <1489608329-7275-6-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 5/9] iommu/arm: Re-define iommu_use_hap_pt(d) as iommu_hap_pt_share 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 Not every integrated into ARM SoCs IOMMU can share page tables with the CPU and as result the iommu_use_hap_pt(d) is not always true. Reuse x86's iommu_hap_pt_share flag to indicate whether the IOMMU page table is shared or not. Now all IOMMU drivers on ARM are able to change this flag according to their possibilities like x86-variants do. Therefore set iommu_hap_pt_share flag for SMMU because it always shares page table with the CPU. Signed-off-by: Oleksandr Tyshchenko --- xen/drivers/passthrough/arm/smmu.c | 3 +++ xen/include/asm-arm/iommu.h | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c index 1082fcf..b2bb41f 100644 --- a/xen/drivers/passthrough/arm/smmu.c +++ b/xen/drivers/passthrough/arm/smmu.c @@ -2833,6 +2833,9 @@ static __init int arm_smmu_dt_init(struct dt_device_node *dev, platform_features &= smmu->features; + /* Always share P2M table between the CPU and the SMMU */ + iommu_hap_pt_share = true; + return 0; } diff --git a/xen/include/asm-arm/iommu.h b/xen/include/asm-arm/iommu.h index 57d9b1e..10a6f23 100644 --- a/xen/include/asm-arm/iommu.h +++ b/xen/include/asm-arm/iommu.h @@ -20,8 +20,11 @@ struct arch_iommu void *priv; }; -/* Always share P2M Table between the CPU and the IOMMU */ -#define iommu_use_hap_pt(d) (1) +/* + * The ARM domain always has a P2M table, but not every integrated into + * ARM SoCs IOMMU can use it as page table. + */ +#define iommu_use_hap_pt(d) (iommu_hap_pt_share) const struct iommu_ops *iommu_get_ops(void); void __init iommu_set_ops(const struct iommu_ops *ops);