From patchwork Thu Oct 2 10:06:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 38289 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AE76120549 for ; Thu, 2 Oct 2014 10:10:27 +0000 (UTC) Received: by mail-wi0-f199.google.com with SMTP id d1sf971591wiv.2 for ; Thu, 02 Oct 2014 03:10:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=PefAqNBiq8CTS1xXLJRq3SLfcsWsw+FcJsOJHnAGaYU=; b=YiOk9Siw5SLmPFolSRPDX7U9aa8JAn7kib4EKw+x611StTsNZUax/eMbzrb1B3bcND cP24eRchSjYjIE8560Y+c4GKv97T/ySE3B5ADOO+5CWYbWzv5ho+6Sl1Yd9jDKlUdRAg Z2LMKwmXrt185duhwk6UVyXEK6uoW3r6eQ/6ihaXcUl8F/4dr67136yABRqVmNwAWnoy NNs/JAZ39SfzIqn2NeQaDIiKpk7ivqyg+E9NLC6VsztspsrbPjnbR4Qr3iQN4p+vUCMq f8WMIV8v3xct1lnWfXW5cueJOD5Kw6BVj5d7bDYYw9nuO0GQUvpWYBeY3IP9ewcLjaB/ WlOA== X-Gm-Message-State: ALoCoQnz0S+xw8yT2LqLBSprSoN9TdXUe0/NwZ7yhUz8GU0WjrUg0r86FHQnSJcQA5F2sAWnmdEg X-Received: by 10.112.52.165 with SMTP id u5mr436528lbo.12.1412244626870; Thu, 02 Oct 2014 03:10:26 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.197 with SMTP id l5ls217717laa.58.gmail; Thu, 02 Oct 2014 03:10:26 -0700 (PDT) X-Received: by 10.152.21.42 with SMTP id s10mr62714549lae.61.1412244626538; Thu, 02 Oct 2014 03:10:26 -0700 (PDT) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com [209.85.215.51]) by mx.google.com with ESMTPS id rt5si5925241lbb.2.2014.10.02.03.10.26 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 02 Oct 2014 03:10:26 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by mail-la0-f51.google.com with SMTP id ge10so1977894lab.24 for ; Thu, 02 Oct 2014 03:10:26 -0700 (PDT) X-Received: by 10.112.62.200 with SMTP id a8mr57666006lbs.34.1412244626459; Thu, 02 Oct 2014 03:10:26 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.130.169 with SMTP id of9csp26126lbb; Thu, 2 Oct 2014 03:10:24 -0700 (PDT) X-Received: by 10.68.132.105 with SMTP id ot9mr82481632pbb.76.1412244623866; Thu, 02 Oct 2014 03:10:23 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v9si3366880pdp.136.2014.10.02.03.10.22 for ; Thu, 02 Oct 2014 03:10:23 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751907AbaJBKJO (ORCPT + 27 others); Thu, 2 Oct 2014 06:09:14 -0400 Received: from smtp.citrix.com ([66.165.176.89]:19603 "EHLO SMTP.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751734AbaJBKJM (ORCPT ); Thu, 2 Oct 2014 06:09:12 -0400 X-IronPort-AV: E=Sophos;i="5.04,638,1406592000"; d="scan'208";a="177413607" Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.79) with Microsoft SMTP Server id 14.3.181.6; Thu, 2 Oct 2014 06:09:10 -0400 Received: from kaball.uk.xensource.com ([10.80.2.59]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1XZdJp-00021J-6L; Thu, 02 Oct 2014 11:09:05 +0100 From: Stefano Stabellini To: CC: , , , , , , Stefano Stabellini Subject: [PATCH 1/2] xen/arm: remove handling of XENFEAT_grant_map_identity Date: Thu, 2 Oct 2014 11:06:56 +0100 Message-ID: <1412244417-12251-1-git-send-email-stefano.stabellini@eu.citrix.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: MIME-Version: 1.0 X-DLP: MIA2 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: stefano.stabellini@eu.citrix.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Keep the definition of the flag. Signed-off-by: Stefano Stabellini --- arch/arm/xen/enlighten.c | 5 --- arch/arm/xen/mm32.c | 85 +--------------------------------------------- 2 files changed, 1 insertion(+), 89 deletions(-) diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c index 0e15f01..c7ca936 100644 --- a/arch/arm/xen/enlighten.c +++ b/arch/arm/xen/enlighten.c @@ -261,11 +261,6 @@ static int __init xen_guest_init(void) xen_setup_features(); - if (!xen_feature(XENFEAT_grant_map_identity)) { - pr_warn("Please upgrade your Xen.\n" - "If your platform has any non-coherent DMA devices, they won't work properly.\n"); - } - if (xen_feature(XENFEAT_dom0)) xen_start_info->flags |= SIF_INITDOMAIN|SIF_PRIVILEGED; else diff --git a/arch/arm/xen/mm32.c b/arch/arm/xen/mm32.c index 3b99860..a5a93fc 100644 --- a/arch/arm/xen/mm32.c +++ b/arch/arm/xen/mm32.c @@ -5,70 +5,6 @@ #include -static DEFINE_PER_CPU(unsigned long, xen_mm32_scratch_virt); -static DEFINE_PER_CPU(pte_t *, xen_mm32_scratch_ptep); - -static int alloc_xen_mm32_scratch_page(int cpu) -{ - struct page *page; - unsigned long virt; - pmd_t *pmdp; - pte_t *ptep; - - if (per_cpu(xen_mm32_scratch_ptep, cpu) != NULL) - return 0; - - page = alloc_page(GFP_KERNEL); - if (page == NULL) { - pr_warn("Failed to allocate xen_mm32_scratch_page for cpu %d\n", cpu); - return -ENOMEM; - } - - virt = (unsigned long)__va(page_to_phys(page)); - pmdp = pmd_offset(pud_offset(pgd_offset_k(virt), virt), virt); - ptep = pte_offset_kernel(pmdp, virt); - - per_cpu(xen_mm32_scratch_virt, cpu) = virt; - per_cpu(xen_mm32_scratch_ptep, cpu) = ptep; - - return 0; -} - -static int xen_mm32_cpu_notify(struct notifier_block *self, - unsigned long action, void *hcpu) -{ - int cpu = (long)hcpu; - switch (action) { - case CPU_UP_PREPARE: - if (alloc_xen_mm32_scratch_page(cpu)) - return NOTIFY_BAD; - break; - default: - break; - } - return NOTIFY_OK; -} - -static struct notifier_block xen_mm32_cpu_notifier = { - .notifier_call = xen_mm32_cpu_notify, -}; - -static void* xen_mm32_remap_page(dma_addr_t handle) -{ - unsigned long virt = get_cpu_var(xen_mm32_scratch_virt); - pte_t *ptep = __get_cpu_var(xen_mm32_scratch_ptep); - - *ptep = pfn_pte(handle >> PAGE_SHIFT, PAGE_KERNEL); - local_flush_tlb_kernel_page(virt); - - return (void*)virt; -} - -static void xen_mm32_unmap(void *vaddr) -{ - put_cpu_var(xen_mm32_scratch_virt); -} - /* functions called by SWIOTLB */ @@ -88,13 +24,7 @@ static void dma_cache_maint(dma_addr_t handle, unsigned long offset, if (!pfn_valid(pfn)) { - /* Cannot map the page, we don't know its physical address. - * Return and hope for the best */ - if (!xen_feature(XENFEAT_grant_map_identity)) - return; - vaddr = xen_mm32_remap_page(handle) + offset; - op(vaddr, len, dir); - xen_mm32_unmap(vaddr - offset); + /* TODO: cache flush */ } else { struct page *page = pfn_to_page(pfn); @@ -181,22 +111,9 @@ void xen_dma_sync_single_for_device(struct device *hwdev, int __init xen_mm32_init(void) { - int cpu; - if (!xen_initial_domain()) return 0; - register_cpu_notifier(&xen_mm32_cpu_notifier); - get_online_cpus(); - for_each_online_cpu(cpu) { - if (alloc_xen_mm32_scratch_page(cpu)) { - put_online_cpus(); - unregister_cpu_notifier(&xen_mm32_cpu_notifier); - return -ENOMEM; - } - } - put_online_cpus(); - return 0; } arch_initcall(xen_mm32_init);