Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp7404340rwl; Thu, 23 Mar 2023 04:01:33 -0700 (PDT) X-Google-Smtp-Source: AK7set/HvY5qfirX7h7elsovyaHJklsVINqmxg08KeHmjS/QNiaSgkdUhn/Yo43tJeW5BPN0Ye+4 X-Received: by 2002:a17:907:7629:b0:878:72d0:2817 with SMTP id jy9-20020a170907762900b0087872d02817mr9311550ejc.29.1679569293115; Thu, 23 Mar 2023 04:01:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679569293; cv=none; d=google.com; s=arc-20160816; b=JWApkoMUxf6Od+/h4m18oOrDAsJncTj1qhxmmAcPa3P8y/Qpd4sD6kQEWOkscFAmkK L8dRsstghIILzQLDMHnzBa1pcsvBULKobJ82mu+h8BZwjqG9dVCBFIBLypw38enw9/W/ lnPqUpShghW8ncaWY9nUG6OU3caWEe/57fBm+fGzdUMRtlvp2Im+7YAagJG2TgdQTPbg hoCa1NmO2os7fwT76TlWlj9ZBmHsPiMhTI5U1TC9KI8vkNnLUNKZThPFsVKx2S6orHqI FsEEN/AeZPxC7yjz3crT2c/EH5bXZIub0YeDwDVUDqwpMUeUTZVA9FeVCk5TIfYAkCD6 Bj/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=r/ISCCsIqrePl8Kn4ucosG1PVhqt3avVWO+jFSTSvgs=; b=A+CyZH7pHFqFYpwwQa076xCWgvM4emjzAtmD2OJN7KmxSQ8hbdlLGDtxDwI19RNr9I 7eC1TM0xi9MsOFoGM0oMaknU/lI+j+qjKA+2dD3BKYspV8Nu4KbXq5kdBKZ1dARVgqJy VjYjcpR3LYqFG9bvJlnHWEIaC3lfaTh8gYid/jTOdl9X85BvLIbAosgA9ppGrIxao8pv RKk+Fr0iHlvL8tQLsB7VuUrU+o6aGifKo6fPlAF7mpyfGRs8BOb6SHuxPPVQwKjQEseu pLRIXSJxU5Q+7SMSTOxyHyDM1V7Griq2+uoBXv/pdtvuss9IOPyYYxwDgwqQMZU8Mf3J 3TvQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x26-20020a1709060a5a00b009314c7ae06csi18410183ejf.191.2023.03.23.04.01.07; Thu, 23 Mar 2023 04:01:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231705AbjCWKx5 (ORCPT + 99 others); Thu, 23 Mar 2023 06:53:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231552AbjCWKxb (ORCPT ); Thu, 23 Mar 2023 06:53:31 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A340F30CB; Thu, 23 Mar 2023 03:52:59 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E85ECAD7; Thu, 23 Mar 2023 03:53:42 -0700 (PDT) Received: from a077209.blr.arm.com (a077209.arm.com [10.162.40.145]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 6323E3F766; Thu, 23 Mar 2023 03:52:56 -0700 (PDT) From: Chaitanya S Prakash To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Chaitanya S Prakash , Andrew Morton , "Aneesh Kumar K . V" , "Kirill A . Shutemov" , Shuah Khan , linux-kselftest@vger.kernel.org Subject: [PATCH 1/5] selftests/mm: Add support for arm64 platform on va switch Date: Thu, 23 Mar 2023 16:22:39 +0530 Message-Id: <20230323105243.2807166-2-chaitanyas.prakash@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230323105243.2807166-1-chaitanyas.prakash@arm.com> References: <20230323105243.2807166-1-chaitanyas.prakash@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Arm64 platforms have the ability to support 64kb pagesize, 512MB default hugepage size and up to 4PB of virtual address space. The address switch occurs at 256TB as opposed to 128TB. Hence, the necessary support has been added. Cc: Andrew Morton Cc: Aneesh Kumar K.V Cc: Kirill A. Shutemov Cc: Shuah Khan Cc: linux-mm@kvack.org Cc: linux-kselftest@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Chaitanya S Prakash --- tools/testing/selftests/mm/va_128TBswitch.c | 26 +++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/mm/va_128TBswitch.c b/tools/testing/selftests/mm/va_128TBswitch.c index 1d2068989883..6679213effed 100644 --- a/tools/testing/selftests/mm/va_128TBswitch.c +++ b/tools/testing/selftests/mm/va_128TBswitch.c @@ -17,6 +17,13 @@ * This will work with 16M and 2M hugepage size */ #define HUGETLB_SIZE (16 << 20) +#elif __aarch64__ +/* + * The default hugepage size for 64k base pagesize + * is 512MB. + */ +#define PAGE_SIZE (64 << 10) +#define HUGETLB_SIZE (512 << 20) #else #define PAGE_SIZE (4 << 10) #define HUGETLB_SIZE (2 << 20) @@ -26,9 +33,22 @@ * >= 128TB is the hint addr value we used to select * large address space. */ -#define ADDR_SWITCH_HINT (1UL << 47) + +#define ADDR_MARK_128TB (1UL << 47) +#define ADDR_MARK_256TB (1UL << 48) + +#define HIGH_ADDR_128TB ((void *) (1UL << 48)) +#define HIGH_ADDR_256TB ((void *) (1UL << 49)) + #define LOW_ADDR ((void *) (1UL << 30)) -#define HIGH_ADDR ((void *) (1UL << 48)) + +#ifdef __aarch64__ +#define ADDR_SWITCH_HINT ADDR_MARK_256TB +#define HIGH_ADDR HIGH_ADDR_256TB +#else +#define ADDR_SWITCH_HINT ADDR_MARK_128TB +#define HIGH_ADDR HIGH_ADDR_128TB +#endif struct testcase { void *addr; @@ -270,6 +290,8 @@ static int supported_arch(void) return 1; #elif defined(__x86_64__) return 1; +#elif defined(__aarch64__) + return 1; #else return 0; #endif -- 2.30.2