From patchwork Fri Oct 17 15:31:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 38890 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 7E7252054E for ; Fri, 17 Oct 2014 15:35:49 +0000 (UTC) Received: by mail-wi0-f197.google.com with SMTP id n3sf698580wiv.4 for ; Fri, 17 Oct 2014 08:35:48 -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=KwQhHvjCN1uSwADF3DdF8B+ZMCdKYxG80s+4vcdOf2xobeKHjblIrcIkZW3aPhNGof 1gxXQlrh11e1S7a9PYUez+cwDGGZChYpPmncpeN193LnvhZKfmb2KuVeBMIiSvzyO79J WsKhbfljAiHohzi8HClFnv1YAIyqIRCFvuzq+1di6m5kRvi5rKJI1dgJtQYCBHRIUWkF 4EgCfegrFnmx+F8kBaaP2tJsqbml4GpQYqXk0wPd5uMWLtpIw4E94SKmKtnWeAUEyTdD /j7jvHnHBAaaLrjk6k8GEmeql4RXtUJqgmPC88ZzXNWdZCShIiRV1mBBcfXAczpWPNsS cIxA== X-Gm-Message-State: ALoCoQnEJRE1TlXsGQWiZdH7jpqldCCXW2dRBHDbiFW/71AplNN/8duZIdmSnT3yJCED/0VNCp5H X-Received: by 10.194.206.10 with SMTP id lk10mr1494897wjc.3.1413560148722; Fri, 17 Oct 2014 08:35:48 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.8.133 with SMTP id r5ls248431laa.65.gmail; Fri, 17 Oct 2014 08:35:48 -0700 (PDT) X-Received: by 10.112.35.229 with SMTP id l5mr9676346lbj.60.1413560148524; Fri, 17 Oct 2014 08:35:48 -0700 (PDT) Received: from mail-lb0-f172.google.com (mail-lb0-f172.google.com. [209.85.217.172]) by mx.google.com with ESMTPS id wx5si2528739lbb.123.2014.10.17.08.35.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 17 Oct 2014 08:35:48 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.172 as permitted sender) client-ip=209.85.217.172; Received: by mail-lb0-f172.google.com with SMTP id b6so888581lbj.31 for ; Fri, 17 Oct 2014 08:35:48 -0700 (PDT) X-Received: by 10.152.6.228 with SMTP id e4mr9546836laa.71.1413560148448; Fri, 17 Oct 2014 08:35:48 -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 c5csp250398lbz; Fri, 17 Oct 2014 08:35:47 -0700 (PDT) X-Received: by 10.221.4.73 with SMTP id ob9mr7994188vcb.13.1413560146817; Fri, 17 Oct 2014 08:35:46 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id r1si915331vdc.57.2014.10.17.08.35.46 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 17 Oct 2014 08:35:46 -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 1Xf9XX-0000Ea-Lj; Fri, 17 Oct 2014 15:34:03 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Xf9XU-0000Cx-Rd for xen-devel@lists.xensource.com; Fri, 17 Oct 2014 15:34:00 +0000 Received: from [193.109.254.147:2689] by server-5.bemta-14.messagelabs.com id 83/9D-28255-8E631445; Fri, 17 Oct 2014 15:34:00 +0000 X-Env-Sender: Stefano.Stabellini@citrix.com X-Msg-Ref: server-16.tower-27.messagelabs.com!1413560035!8051167!4 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n X-StarScan-Received: X-StarScan-Version: 6.12.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 30633 invoked from network); 17 Oct 2014 15:33:59 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-16.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 17 Oct 2014 15:33:59 -0000 X-IronPort-AV: E=Sophos;i="5.04,739,1406592000"; d="scan'208";a="182384243" 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; Fri, 17 Oct 2014 11:33:55 -0400 Received: from kaball.uk.xensource.com ([10.80.2.59]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1Xf9XJ-0008GX-ED; Fri, 17 Oct 2014 16:33:49 +0100 From: Stefano Stabellini To: Date: Fri, 17 Oct 2014 16:31:23 +0100 Message-ID: <1413559886-11516-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, Stefano Stabellini Subject: [Xen-devel] [PATCH v7 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.172 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)