Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp155044imm; Thu, 2 Aug 2018 16:00:16 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcTx+6+Vt+g+RxsthJElWAwZf6fbfi4Krb41NYqMdUoDMyx2GWtcSgvEeIkv8DXgYWT+SvS X-Received: by 2002:a63:f14d:: with SMTP id o13-v6mr1294322pgk.236.1533250816169; Thu, 02 Aug 2018 16:00:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533250816; cv=none; d=google.com; s=arc-20160816; b=WErVrFI5koDn5IZG7CG4NtVIQWZyErcFOlU1AH8mdpyZ1SbkktqSURoXzozSG70AyV cj3folfzAwH6kEppQr4ZiGkviuJLUdvUaXQADOQZEiu85JFfGtpomTl17tu7jM7WgpE4 Yf5COEgYw72BNaCVYCyaIR/xBPkMW0fkq0PuN9Ssd3dqvNqfCgljcJFP8Fayfuo1XV9q 1mtxvaE5QjfASgJBGIQ0JooJcZSTVsMAGZ6Ja4B0CVvNHbQrgADkrlI+hLJ/eM1iNlB9 x2d5gm5NVTg1qy5X6aJ3KlfS+i9gZ4ehrmSCEwKZIT9txnAnFQF4pn0d0MZPvJkGEa42 1hog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:in-reply-to:references:date :from:cc:to:subject:arc-authentication-results; bh=ciKwSGoYfYMtS4r8doyGd/xzXh9xInTWZJCmRUkyUvI=; b=arUqIPvXGU/VfrMH/bZDgyHZX3v4BiA4VWrr+EUTobjLvBqE8iExY4bBgkqqz+ebuL wX2FcdJoq7ylYvwhntVcZeflb2Td+7jSA6rFmMyVxYwDm801Zal310oVcOMFKd0uFnUD 4KxOCBmyOLrRafVlP7M478hwMabVcnIKhr7ickZt125GIsfOdSkmo+NdfkjK0cZRsTD6 ChJ0vyKSVTK7VTYIjE35065Om4RYZ1faq1sz2Kntb0faiNd3yi/p4W1gAI9rsQOdL26A Dkh8Mh4uy3Xw1KCD/EhlngRg/UEiTDlewmLToIX5d+wCxNmKV+8yXlA6urKnU+Zwl9u4 xdoQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a20-v6si3503232pgb.600.2018.08.02.16.00.01; Thu, 02 Aug 2018 16:00:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732391AbeHCAwB (ORCPT + 99 others); Thu, 2 Aug 2018 20:52:01 -0400 Received: from mga11.intel.com ([192.55.52.93]:40743 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732357AbeHCAwA (ORCPT ); Thu, 2 Aug 2018 20:52:00 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Aug 2018 15:58:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,437,1526367600"; d="scan'208";a="72912983" Received: from viggo.jf.intel.com (HELO localhost.localdomain) ([10.54.77.144]) by fmsmga002.fm.intel.com with ESMTP; 02 Aug 2018 15:58:41 -0700 Subject: [PATCH 6/7] x86/mm/pageattr: pass named flag instead of 0/1 To: linux-kernel@vger.kernel.org Cc: Dave Hansen , keescook@google.com, tglx@linutronix.de, mingo@kernel.org, aarcange@redhat.com, jgross@suse.com, jpoimboe@redhat.com, gregkh@linuxfoundation.org, peterz@infradead.org, hughd@google.com, torvalds@linux-foundation.org, bp@alien8.de, luto@kernel.org, ak@linux.intel.com From: Dave Hansen Date: Thu, 02 Aug 2018 15:58:33 -0700 References: <20180802225823.4711C55B@viggo.jf.intel.com> In-Reply-To: <20180802225823.4711C55B@viggo.jf.intel.com> Message-Id: <20180802225833.58861DAF@viggo.jf.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dave Hansen This is a cleanup. There should be functional changes in this patch. change_page_attr_set/clear() take an 0/1 argument to indicate whether CPA_ARRAY should be passed down to change_page_attr_set/clear(). Rather than having a 0/1 argument to turn a single flag on/off, just pass down the flag itself. Signed-off-by: Dave Hansen --- b/arch/x86/mm/pageattr.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff -puN arch/x86/mm/pageattr.c~x86-pageattr-pass-flags arch/x86/mm/pageattr.c --- a/arch/x86/mm/pageattr.c~x86-pageattr-pass-flags 2018-08-02 14:14:50.037483273 -0700 +++ b/arch/x86/mm/pageattr.c 2018-08-02 14:14:50.041483273 -0700 @@ -1525,17 +1525,17 @@ out: } static inline int change_page_attr_set(unsigned long *addr, int numpages, - pgprot_t mask, int array) + pgprot_t mask, int flags) { return change_page_attr_set_clr(addr, numpages, mask, __pgprot(0), 0, - (array ? CPA_ARRAY : 0), NULL); + flags, NULL); } static inline int change_page_attr_clear(unsigned long *addr, int numpages, - pgprot_t mask, int array) + pgprot_t mask, int flags) { return change_page_attr_set_clr(addr, numpages, __pgprot(0), mask, 0, - (array ? CPA_ARRAY : 0), NULL); + flags, NULL); } static inline int cpa_set_pages_array(struct page **pages, int numpages, @@ -1609,7 +1609,8 @@ static int _set_memory_array(unsigned lo _PAGE_CACHE_MODE_UC_MINUS : new_type; ret = change_page_attr_set(addr, addrinarray, - cachemode2pgprot(set_type), 1); + cachemode2pgprot(set_type), + CPA_ARRAY); if (!ret && new_type == _PAGE_CACHE_MODE_WC) ret = change_page_attr_set_clr(addr, addrinarray, @@ -1732,7 +1733,8 @@ int set_memory_array_wb(unsigned long *a /* WB cache mode is hard wired to all cache attribute bits being 0 */ ret = change_page_attr_clear(addr, addrinarray, - __pgprot(_PAGE_CACHE_MASK), 1); + __pgprot(_PAGE_CACHE_MASK), + CPA_ARRAY); if (ret) return ret; _