From patchwork Mon Oct 20 09:48:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 39028 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 090DA203C5 for ; Mon, 20 Oct 2014 09:51:57 +0000 (UTC) Received: by mail-la0-f71.google.com with SMTP id gi9sf2261311lab.10 for ; Mon, 20 Oct 2014 02:51:56 -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=NoOWWN8lknDi0Khh1X0Umz0NTG3UiKITt4gG9R0KFUIzAarKlyFGC1qjHhtpgwFunQ ZdrMTi0em7wjyyVNZPjF4GbqUQFhPPEzQmb0semZtawBvhN7/Wc3lDm/DAOk+Dy8Nj4b XqWct47PXjsz1k9HL/v+No+gXtzyYEMbERcnNdFkP9flQ3jTy8OQZ58jezxT0tHwD0NR NZ38NF957xyK8YT3qHbBcLMgSFW77sKsIOXEOfASwm14KkwlEHgl10tauAv/IM3t/KVK F63M6tZwTrfbslnXctevBv++Ti5uMowC6X0SRsgVYR4762fT7G1Nnxni7AdJkcPVwhYD 9IGg== X-Gm-Message-State: ALoCoQntF7nXb2zvwQt3vv8c0HwVgl9n3Y6JfTc5PmNXKqxOBw1OZ6w9Rltns8WaMRfFkswvdSM5 X-Received: by 10.112.166.2 with SMTP id zc2mr949lbb.24.1413798716677; Mon, 20 Oct 2014 02:51:56 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.30.40 with SMTP id p8ls361683lah.106.gmail; Mon, 20 Oct 2014 02:51:56 -0700 (PDT) X-Received: by 10.112.166.1 with SMTP id zc1mr1853366lbb.90.1413798716493; Mon, 20 Oct 2014 02:51:56 -0700 (PDT) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com. [209.85.215.52]) by mx.google.com with ESMTPS id ud4si13485041lac.101.2014.10.20.02.51.56 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 20 Oct 2014 02:51:56 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) client-ip=209.85.215.52; Received: by mail-la0-f52.google.com with SMTP id hz20so3632446lab.11 for ; Mon, 20 Oct 2014 02:51:56 -0700 (PDT) X-Received: by 10.152.6.228 with SMTP id e4mr26160596laa.71.1413798716367; Mon, 20 Oct 2014 02:51:56 -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 c5csp271996lbz; Mon, 20 Oct 2014 02:51:55 -0700 (PDT) X-Received: by 10.52.252.172 with SMTP id zt12mr655700vdc.7.1413798714926; Mon, 20 Oct 2014 02:51:54 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id z9si4516128vda.43.2014.10.20.02.51.54 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 20 Oct 2014 02:51:54 -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 1Xg9cB-00041U-Rl; Mon, 20 Oct 2014 09:50:59 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Xg9c8-0003xO-Vb for xen-devel@lists.xensource.com; Mon, 20 Oct 2014 09:50:57 +0000 Received: from [85.158.139.211:47790] by server-5.bemta-5.messagelabs.com id C4/2B-11546-00BD4445; Mon, 20 Oct 2014 09:50:56 +0000 X-Env-Sender: Stefano.Stabellini@citrix.com X-Msg-Ref: server-2.tower-206.messagelabs.com!1413798650!10793666!3 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 21446 invoked from network); 20 Oct 2014 09:50:54 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-2.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 20 Oct 2014 09:50:54 -0000 X-IronPort-AV: E=Sophos;i="5.04,755,1406592000"; d="scan'208";a="184078596" 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; Mon, 20 Oct 2014 05:50:49 -0400 Received: from kaball.uk.xensource.com ([10.80.2.59]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1Xg9bw-0002Y1-HE; Mon, 20 Oct 2014 10:50:44 +0100 From: Stefano Stabellini To: Date: Mon, 20 Oct 2014 10:48:16 +0100 Message-ID: <1413798499-28314-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 v8 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.52 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)