From patchwork Wed Oct 22 16:40:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 39324 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 34A64202DB for ; Wed, 22 Oct 2014 16:45:07 +0000 (UTC) Received: by mail-la0-f71.google.com with SMTP id gi9sf2274387lab.6 for ; Wed, 22 Oct 2014 09:45:06 -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=EhAlBnZp+4X7rn5E9PR1bACGNN0D+wRO6yjyPhIOoN6U+5hg7jUrL+phRy430hXuJ+ F217I9ymQtQHScLmE0PTTokzuCvH3GayjPJBHV6ZfLW60cdOiv2HtuqAhLFOVEz99nkI gJ8iRRq544apdIqsvTUGcbKR/NgRg7GBJ7cmJGnRCzEHXQyMULsUUkg1FNnH2KO18FeR jpH2di0WSQR4PhOrtQ5heLnVcDILZ9oY84Be/+GLJ6gTiphAHuBPoPG5z+jomG8eeWf8 QyRV3+1r6uOGrPVvtculAVD9+Qe54bb37FGvH+iqeFZH9fIFTJkFdW7E72Pr7+bfXunM se7Q== X-Gm-Message-State: ALoCoQnkoWRnZnAu9UCWXL6x1yDEmfWcKgdBOoDfbtIaXQuqtC1K+BJPfxnoHPZCWJ6uuykbVdve X-Received: by 10.112.97.35 with SMTP id dx3mr321520lbb.20.1413996305838; Wed, 22 Oct 2014 09:45:05 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.19.131 with SMTP id f3ls192918lae.38.gmail; Wed, 22 Oct 2014 09:45:05 -0700 (PDT) X-Received: by 10.112.142.200 with SMTP id ry8mr43288631lbb.26.1413996305648; Wed, 22 Oct 2014 09:45:05 -0700 (PDT) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id na4si24032004lbb.65.2014.10.22.09.45.05 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 22 Oct 2014 09:45:05 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by mail-la0-f50.google.com with SMTP id s18so3285190lam.23 for ; Wed, 22 Oct 2014 09:45:05 -0700 (PDT) X-Received: by 10.112.97.135 with SMTP id ea7mr43128443lbb.46.1413996305303; Wed, 22 Oct 2014 09:45:05 -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 c5csp110826lbz; Wed, 22 Oct 2014 09:45:04 -0700 (PDT) X-Received: by 10.220.124.4 with SMTP id s4mr9625669vcr.38.1413996303347; Wed, 22 Oct 2014 09:45:03 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id r1si10561166vdc.57.2014.10.22.09.45.02 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 22 Oct 2014 09:45:03 -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 1Xgz0L-00048z-1a; Wed, 22 Oct 2014 16:43:21 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Xgz0J-00048M-7y for xen-devel@lists.xensource.com; Wed, 22 Oct 2014 16:43:19 +0000 Received: from [85.158.143.35] by server-2.bemta-4.messagelabs.com id D2/D2-10419-6AED7445; Wed, 22 Oct 2014 16:43:18 +0000 X-Env-Sender: Stefano.Stabellini@citrix.com X-Msg-Ref: server-10.tower-21.messagelabs.com!1413996193!12015823!4 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 28648 invoked from network); 22 Oct 2014 16:43:17 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-10.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 22 Oct 2014 16:43:17 -0000 X-IronPort-AV: E=Sophos;i="5.04,769,1406592000"; d="scan'208";a="185164554" 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, 22 Oct 2014 12:43: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 1Xgz05-0001kp-CL; Wed, 22 Oct 2014 17:43:05 +0100 From: Stefano Stabellini To: Date: Wed, 22 Oct 2014 17:40:34 +0100 Message-ID: <1413996037-2747-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: MIA1 Cc: julien.grall@citrix.com, Ian.Campbell@citrix.com, JBeulich@suse.com, Stefano Stabellini Subject: [Xen-devel] [PATCH v11 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.215.50 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)