From patchwork Wed Nov 12 11:40:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 40654 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F39F5206A5 for ; Wed, 12 Nov 2014 11:42:19 +0000 (UTC) Received: by mail-wi0-f197.google.com with SMTP id bs8sf266037wib.4 for ; Wed, 12 Nov 2014 03:42:19 -0800 (PST) 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:date:message-id:in-reply-to :references:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-post:list-help:list-subscribe:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:list-archive:content-type:content-transfer-encoding; bh=zVmo/2hGQDNJNxtiVk0AuR1f2ULuC+0wu++haOVPYuQ=; b=ja3UzbUK6Rmu1TRL8Sk9GdP1YbBzNnUuAfcgW7ELYXuqW+P+gtate1dA+Wwo+YEX4r CLSkerYujoVKp3OjCR6Do9XDhsTDxbiBK2SQmLCBOSJY8ddIG/8OGrbFXwdBcwvWCnc+ 8oaxsEiMm1IkY7b40lDbMqk1S6YpjNpxEtckpLqed1eArFKcs3QwVvY7C/2JVm0ho4KO GiKDLJwl9MQprOy8XztyLCLOZ2LDtKfKlkkdbN3mi7THMjkRW7PfPa9ZIrciwsx61aMs s/2IWPZ+NddTVCgiFjXstDn3yLW5Vyl+Mm7wYh89waXFCfGZu59aONsovJCGzMiGGKqS KJcg== X-Gm-Message-State: ALoCoQkV06pjPDlc9Mcwum+q8FUUTuuFssIp2KfIwdKsmYT9eQxRyj/kkdTaq9wCU28+a0lifICo X-Received: by 10.112.147.131 with SMTP id tk3mr1597154lbb.2.1415792539278; Wed, 12 Nov 2014 03:42:19 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.138 with SMTP id q10ls711821laj.83.gmail; Wed, 12 Nov 2014 03:42:18 -0800 (PST) X-Received: by 10.152.37.231 with SMTP id b7mr41977870lak.72.1415792538862; Wed, 12 Nov 2014 03:42:18 -0800 (PST) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com. [209.85.217.170]) by mx.google.com with ESMTPS id uc5si34705473lbb.31.2014.11.12.03.42.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 12 Nov 2014 03:42:18 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.170 as permitted sender) client-ip=209.85.217.170; Received: by mail-lb0-f170.google.com with SMTP id w7so494091lbi.15 for ; Wed, 12 Nov 2014 03:42:18 -0800 (PST) X-Received: by 10.112.52.37 with SMTP id q5mr41313418lbo.32.1415792538753; Wed, 12 Nov 2014 03:42:18 -0800 (PST) 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.184.201 with SMTP id ew9csp408164lbc; Wed, 12 Nov 2014 03:42:17 -0800 (PST) X-Received: by 10.52.170.176 with SMTP id an16mr28055228vdc.32.1415792534072; Wed, 12 Nov 2014 03:42:14 -0800 (PST) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id ek5si14919025vdb.23.2014.11.12.03.42.13 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 12 Nov 2014 03:42:14 -0800 (PST) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XoWIc-0006nz-L5; Wed, 12 Nov 2014 11:41:22 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XoWIa-0006lR-DA for xen-devel@lists.xensource.com; Wed, 12 Nov 2014 11:41:20 +0000 Received: from [85.158.137.68] by server-15.bemta-3.messagelabs.com id 71/28-17735-F5743645; Wed, 12 Nov 2014 11:41:19 +0000 X-Env-Sender: Stefano.Stabellini@citrix.com X-Msg-Ref: server-3.tower-31.messagelabs.com!1415792477!10881519!2 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n X-StarScan-Received: X-StarScan-Version: 6.12.4; banners=-,-,- X-VirusChecked: Checked Received: (qmail 7629 invoked from network); 12 Nov 2014 11:41:19 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-3.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 12 Nov 2014 11:41:19 -0000 X-IronPort-AV: E=Sophos;i="5.07,368,1413244800"; d="scan'208";a="191920928" Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.78) with Microsoft SMTP Server id 14.3.181.6; Wed, 12 Nov 2014 06:41:14 -0500 Received: from kaball.uk.xensource.com ([10.80.2.59]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1XoWIO-0003Gl-SG; Wed, 12 Nov 2014 11:41:08 +0000 From: Stefano Stabellini To: Date: Wed, 12 Nov 2014 11:40:42 +0000 Message-ID: <1415792454-23161-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: MIA1 Cc: Ian.Campbell@citrix.com, Stefano Stabellini , catalin.marinas@arm.com, linux-kernel@vger.kernel.org, david.vrabel@citrix.com, linux-arm-kernel@lists.infradead.org Subject: [Xen-devel] [PATCH v9 01/13] xen/arm: remove handling of XENFEAT_grant_map_identity X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.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.217.170 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-Archive: The feature has been removed from Xen. Also Linux cannot use it on ARM32 without CONFIG_ARM_LPAE. Signed-off-by: Stefano Stabellini Acked-by: Ian Campbell Reviewed-by: David Vrabel Reviewed-by: Catalin Marinas --- Changes in v2: - remove the definition of XENFEAT_grant_map_identity. --- arch/arm/xen/enlighten.c | 5 --- arch/arm/xen/mm32.c | 85 +------------------------------------- include/xen/interface/features.h | 3 -- 3 files changed, 1 insertion(+), 92 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); diff --git a/include/xen/interface/features.h b/include/xen/interface/features.h index 14334d0..131a6cc 100644 --- a/include/xen/interface/features.h +++ b/include/xen/interface/features.h @@ -53,9 +53,6 @@ /* operation as Dom0 is supported */ #define XENFEAT_dom0 11 -/* Xen also maps grant references at pfn = mfn */ -#define XENFEAT_grant_map_identity 12 - #define XENFEAT_NR_SUBMAPS 1 #endif /* __XEN_PUBLIC_FEATURES_H__ */