From patchwork Mon Oct 20 16:58:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 39060 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E0F55203C5 for ; Mon, 20 Oct 2014 17:02:12 +0000 (UTC) Received: by mail-lb0-f199.google.com with SMTP id w7sf2777130lbi.2 for ; Mon, 20 Oct 2014 10:02:11 -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=DWyn3jxnOz7wZZAiQb86Zc9C3UmC+ea4Al7xHB+qsoj+6nJAXmkYiEdirY2xl3vOS3 lIGBICFxEM78pL1K4823Ze/2YY6Tya8goK6xQBm8xi50uVGYBWON4dDLMCWXECPDLJ9S +i/cZXNJNVF+3CMuKNzADtCGwLv3DeHWEeTXB+nVdjEH2JMGK7HWVw5oUJaXcx70cuZA 3dV67i/X+EgeI/SqHNaZv05mzBRIsAyYfV9qLFLowMnPVmMCc73EOt6Cs8PXr0LqwX15 k2H50NQ3QFSxfM10LSV2mROgQOORa5hgjjLAHJ6o4r1su8wtBJBuHPuQFEr3Dvq+GFck mkGQ== X-Gm-Message-State: ALoCoQljiTf3oIZUKDN2jgVtTNMpQ6A2CAej9Qcu3aHzW+qsAlQDmJsV+hGkmNQTfKBj0en1xXrN X-Received: by 10.112.140.132 with SMTP id rg4mr685664lbb.12.1413824530718; Mon, 20 Oct 2014 10:02:10 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.199 with SMTP id u7ls459300lau.10.gmail; Mon, 20 Oct 2014 10:02:10 -0700 (PDT) X-Received: by 10.152.204.103 with SMTP id kx7mr28999514lac.7.1413824530449; Mon, 20 Oct 2014 10:02:10 -0700 (PDT) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id tl10si15163853lbb.131.2014.10.20.10.02.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 20 Oct 2014 10:02:10 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by mail-lb0-f177.google.com with SMTP id w7so4130114lbi.8 for ; Mon, 20 Oct 2014 10:02:09 -0700 (PDT) X-Received: by 10.112.97.135 with SMTP id ea7mr29073147lbb.46.1413824529703; Mon, 20 Oct 2014 10:02:09 -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 c5csp346339lbz; Mon, 20 Oct 2014 10:02:08 -0700 (PDT) X-Received: by 10.52.110.134 with SMTP id ia6mr2224332vdb.69.1413824528001; Mon, 20 Oct 2014 10:02:08 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id sq20si5758270vcb.97.2014.10.20.10.02.07 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 20 Oct 2014 10:02:07 -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 1XgGKH-0001Um-Nw; Mon, 20 Oct 2014 17:00:57 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XgGKF-0001U6-Ke for xen-devel@lists.xensource.com; Mon, 20 Oct 2014 17:00:55 +0000 Received: from [193.109.254.147:43281] by server-15.bemta-14.messagelabs.com id DA/C4-30948-6CF35445; Mon, 20 Oct 2014 17:00:54 +0000 X-Env-Sender: Stefano.Stabellini@citrix.com X-Msg-Ref: server-11.tower-27.messagelabs.com!1413824450!8544882!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.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 3170 invoked from network); 20 Oct 2014 17:00:54 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-11.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 20 Oct 2014 17:00:54 -0000 X-IronPort-AV: E=Sophos;i="5.04,757,1406592000"; d="scan'208";a="184250871" 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 13:00:48 -0400 Received: from kaball.uk.xensource.com ([10.80.2.59]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1XgGK2-0002Wv-Ti; Mon, 20 Oct 2014 18:00:42 +0100 From: Stefano Stabellini To: Date: Mon, 20 Oct 2014 17:58:14 +0100 Message-ID: <1413824297-2805-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 v9 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.177 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)