From patchwork Tue Oct 21 18:10:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 39219 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f71.google.com (mail-ee0-f71.google.com [74.125.83.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0E9C42039B for ; Tue, 21 Oct 2014 18:14:23 +0000 (UTC) Received: by mail-ee0-f71.google.com with SMTP id e51sf732707eek.2 for ; Tue, 21 Oct 2014 11:14:23 -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: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=OyYdNNLa9DmpcoJzUodsQLwrMUcidupG4YjrQGaocpU=; b=OQ9bPs0dVXxiQBl7SlnJ1rv7Vm4vtZzqFynYmi6zPpTCMeFaDD0E/BzEBfewB2zkKL VV8UsXBHEY0oUQE2HBLK+tpUknbhUYS9w3+oJA4ZjHc5EKEamGIdfQYoZqo0VG1LCVDy 78hll4XWQa1SNlIHXCv4qnhgLjEJeEYCPFcQddeYRvm0iKnzGiAa8T43kAjTCPySxPnH ur98qpXg2kd+Yd9eOwPMfAZmF/ng5VpyZTGBAdNcik6aY1yNATGKhiyns6aaH9swnyYA V4B1UTKB/BaFrtv6lGarhD9H1K4b+TAScqk04haI3SvQr2KUMX9KDzoRJNLkBZEubPwq W05Q== X-Gm-Message-State: ALoCoQm3N+xaZkVC5OaSwQYjrLxPiAiKUQ4ZMBwIkaZF7+qSCE11ceQnJJ5fttUUega6jtsVWPtJ X-Received: by 10.180.76.42 with SMTP id h10mr3839619wiw.6.1413915263150; Tue, 21 Oct 2014 11:14:23 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.88.13 with SMTP id bc13ls87234lab.21.gmail; Tue, 21 Oct 2014 11:14:22 -0700 (PDT) X-Received: by 10.112.162.41 with SMTP id xx9mr26077275lbb.21.1413915262953; Tue, 21 Oct 2014 11:14:22 -0700 (PDT) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id x1si8207331lbw.43.2014.10.21.11.14.22 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 21 Oct 2014 11:14:22 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by mail-lb0-f176.google.com with SMTP id p9so1469025lbv.7 for ; Tue, 21 Oct 2014 11:14:22 -0700 (PDT) X-Received: by 10.152.116.102 with SMTP id jv6mr25369812lab.40.1413915262818; Tue, 21 Oct 2014 11:14:22 -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.84.229 with SMTP id c5csp556019lbz; Tue, 21 Oct 2014 11:14:22 -0700 (PDT) X-Received: by 10.220.14.194 with SMTP id h2mr31623754vca.9.1413915260954; Tue, 21 Oct 2014 11:14:20 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id n2si8976156vdn.1.2014.10.21.11.14.20 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 21 Oct 2014 11:14:20 -0700 (PDT) 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 1Xgdvr-000267-Dk; Tue, 21 Oct 2014 18:13:19 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Xgdvp-00025v-Jd for xen-devel@lists.xensource.com; Tue, 21 Oct 2014 18:13:17 +0000 Received: from [85.158.139.211] by server-6.bemta-5.messagelabs.com id 7A/17-13389-C32A6445; Tue, 21 Oct 2014 18:13:16 +0000 X-Env-Sender: Stefano.Stabellini@citrix.com X-Msg-Ref: server-10.tower-206.messagelabs.com!1413915194!5642026!1 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.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 10388 invoked from network); 21 Oct 2014 18:13:16 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-10.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 21 Oct 2014 18:13:16 -0000 X-IronPort-AV: E=Sophos;i="5.04,763,1406592000"; d="scan'208";a="184785993" 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; Tue, 21 Oct 2014 14:13:13 -0400 Received: from kaball.uk.xensource.com ([10.80.2.59]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1Xgdvg-0001jK-CD; Tue, 21 Oct 2014 19:13:08 +0100 From: Stefano Stabellini To: Date: Tue, 21 Oct 2014 19:10:35 +0100 Message-ID: <1413915038-17490-5-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 Cc: julien.grall@citrix.com, Ian.Campbell@citrix.com, JBeulich@suse.com, Stefano Stabellini Subject: [Xen-devel] [PATCH v10 5/8] xen/x86: introduce more cache maintenance operations 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.176 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: Move the existing flush_page_to_ram flushtlb.h. Signed-off-by: Stefano Stabellini Acked-by: Jan Beulich --- Changes in v7: - return the called function's return value from clean_dcache_va_range. Changes in v5: - make order an unsigned int; - add a comment on sub-page granularity support; - cache operations return error; - move the functions to xen/include/asm-x86/flushtlb.h. Changes in v4: - remove _xen in the function names; - implement the functions using existing x86 flushing functions. --- xen/include/asm-x86/flushtlb.h | 15 +++++++++++++++ xen/include/asm-x86/page.h | 3 --- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/xen/include/asm-x86/flushtlb.h b/xen/include/asm-x86/flushtlb.h index 7f46632..85e260a 100644 --- a/xen/include/asm-x86/flushtlb.h +++ b/xen/include/asm-x86/flushtlb.h @@ -11,6 +11,7 @@ #define __FLUSHTLB_H__ #include +#include #include #include #include @@ -115,4 +116,18 @@ void flush_area_mask(const cpumask_t *, const void *va, unsigned int flags); #define flush_tlb_one_all(v) \ flush_tlb_one_mask(&cpu_online_map, v) +static inline void flush_page_to_ram(unsigned long mfn) {} +static inline int invalidate_dcache_va_range(const void *p, unsigned long size) { return -EOPNOTSUPP; } +static inline int clean_and_invalidate_dcache_va_range(const void *p, unsigned long size) +{ + unsigned int order = get_order_from_bytes(size); + /* sub-page granularity support needs to be added if necessary */ + flush_area_local(p, FLUSH_CACHE|FLUSH_ORDER(order)); + return 0; +} +static inline int clean_dcache_va_range(const void *p, unsigned long size) +{ + return clean_and_invalidate_dcache_va_range(p, size); +} + #endif /* __FLUSHTLB_H__ */ diff --git a/xen/include/asm-x86/page.h b/xen/include/asm-x86/page.h index 9aa780e..a8bc999 100644 --- a/xen/include/asm-x86/page.h +++ b/xen/include/asm-x86/page.h @@ -344,9 +344,6 @@ static inline uint32_t cacheattr_to_pte_flags(uint32_t cacheattr) return ((cacheattr & 4) << 5) | ((cacheattr & 3) << 3); } -/* No cache maintenance required on x86 architecture. */ -static inline void flush_page_to_ram(unsigned long mfn) {} - /* return true if permission increased */ static inline bool_t perms_strictly_increased(uint32_t old_flags, uint32_t new_flags)