From patchwork Sat Oct 29 06:53:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: chenglulu X-Patchwork-Id: 12650 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1218726wru; Fri, 28 Oct 2022 23:56:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ESMQRy9/iliDnlXAgT3HXWmgfysu2ADsZBDB2I4zsxi7Lw4KRrWx79ZrebqBctkkOQmo3 X-Received: by 2002:a17:907:a42a:b0:78d:3ade:a543 with SMTP id sg42-20020a170907a42a00b0078d3adea543mr2806166ejc.400.1667026585595; Fri, 28 Oct 2022 23:56:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667026585; cv=none; d=google.com; s=arc-20160816; b=gTdh6YfL5D+KsquY8NplXuTKiN51uWdN/z0e6/izsS9yVL3NZSgeYJ32z56x4B4S3g 3H6blY47AQAuuXPiOa4OqO0TvFyHx60MaUXWVC3Z9hYvfaaEXdyRuD4OtEn55FPXtQTY QjhvGqSh2XT7j5PHiOu30Xdl5icm3fndDO6GSH3Nh0MBWt17ioD0VO0s+Bsxbnw94gT5 f5vZS/Bwzdf4/aEefYKQmbcThvBcT1IlFV7+ITX/vvDSSzDo5cKbingQnjjNUHvg8K+w W/meR8O/4DY+AzFLbwu5B4tX6UeiOMY4p6+8MAsMBC0/KanBaFOtmXXT2OBqJxHqzQOY Bp/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:dmarc-filter :delivered-to; bh=RpFBv1z6e0B5+9HA0DKkHbbqhX9byrCXw2KbCViD7y4=; b=0w3y//zEj8Z1GMdwrJjk1MiSTk5nso/57OYChyAGG+yXVHKYZvvqLkcHrpQgxVJR60 KQ1cgZp/6tJ2RrshbvBIzcehb8Al1F/czYA42EwREop0Uxxf6pwd5OOOOMJ0WqbpRcxG 8YZ8WeqHGjAMxngZnUgkL27KydjZd6joFl3ndt/m79LGZWGjeobHp3/qoTpQX4l/cJnS GakmdXbt+199B3a1LbTi3L/wZdDzDrRwuqNrA6lX3BWXvN67cnRIMC1VYZ72p+5tDJup ZsNFdB+Vj22DJCt+kW7onylaGwiZSTqaMhcC1JAdyS//Yg1rIZzl4u266Sspycjo75KP Of5w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id nb36-20020a1709071ca400b00782539a0286si1255764ejc.142.2022.10.28.23.56.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Oct 2022 23:56:25 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3C45A38582A7 for ; Sat, 29 Oct 2022 06:56:23 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by sourceware.org (Postfix) with ESMTP id E2EB83858C83 for ; Sat, 29 Oct 2022 06:55:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E2EB83858C83 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [10.2.5.5]) by gateway (Coremail) with SMTP id _____8BxWth0zlxjETwDAA--.10277S3; Sat, 29 Oct 2022 14:55:50 +0800 (CST) Received: from 5.5.5 (unknown [10.2.5.5]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Cxn+BwzlxjtzIHAA--.24402S2; Sat, 29 Oct 2022 14:55:48 +0800 (CST) From: Lulu Cheng To: gcc-patches@gcc.gnu.org, cmtice@google.com Subject: [PATCH v4] Libvtv: Add loongarch support. Date: Sat, 29 Oct 2022 14:53:22 +0800 Message-Id: <20221029065320.2561317-1-chenglulu@loongson.cn> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-CM-TRANSID: AQAAf8Cxn+BwzlxjtzIHAA--.24402S2 X-CM-SenderInfo: xfkh0wpoxo3qxorr0wxvrqhubq/ X-Coremail-Antispam: 1Uk129KBjvJXoW7ZFyrXw1kAFW5WF18Jw18Zrb_yoW8Cry5pF W3ArnFvr1kGF1fCa95ta43Xw1xXanrGr4xKay2grW8CF4UCa4kWr97trZ5Jay7t3yxZFWY gr4aq34Uua15ZrJanT9S1TB71UUUUUJqnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU b3AYFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20xvaj40_Wr0E3s 1l1IIY67AEw4v_Jr0_Jr4l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVW7JVWDJwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVWxJVW8Jr1l84 ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AKxVW8Jr0_Cr1U M2kKe7AKxVWUXVWUAwAS0I0E0xvYzxvE52x082IY62kv0487Mc804VCY07AIYIkI8VC2zV CFFI0UMc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUXVWUAwAv7VC2 z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI48JMxAIw2 8IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMxCIbckI1I0E14v26r1Y6r17MI8I 3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxV WUAVWUtwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8I cVCY1x0267AKxVWUJVW8JwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aV AFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVWUJVW8JbIYCTnIWIevJa73UjIFyTuY vjxU74lkDUUUU X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_SBL_CSS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qijingwen , xuchenghua@loongson.cn, Lulu Cheng , i@xen0n.name Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748004068709706533?= X-GMAIL-MSGID: =?utf-8?q?1748004068709706533?= v1 - > v2: 1. When the macro __loongarch_lp64 is defined, the VTV_PAGE_SIZE is set to 64K. 2. In the vtv_malloc.cc file __vtv_malloc_init function, it does not check whether VTV_PAGE_SIZE is equal to the system page size, if the macro __loongarch_lp64 is defined. v2 -> v3: Set VTV_PAGE_SIZE to 16KiB for loongarch64. v3 -> v4: Modifying the description. --------------------------------------- The loongarch64 specification permits page sizes of 4KiB, 16KiB and 64KiB, but only 16KiB pages are supported for now. Co-Authored-By: qijingwen include/ChangeLog: * vtv-change-permission.h (defined): (VTV_PAGE_SIZE): Set VTV_PAGE_SIZE to 16KiB for loongarch64. libvtv/ChangeLog: * configure.tgt: Add loongarch support. --- include/vtv-change-permission.h | 4 ++++ libvtv/configure.tgt | 3 +++ 2 files changed, 7 insertions(+) diff --git a/include/vtv-change-permission.h b/include/vtv-change-permission.h index 70bdad92bca..e7b9294a081 100644 --- a/include/vtv-change-permission.h +++ b/include/vtv-change-permission.h @@ -48,6 +48,10 @@ extern void __VLTChangePermission (int); #else #if defined(__sun__) && defined(__svr4__) && defined(__sparc__) #define VTV_PAGE_SIZE 8192 +#elif defined(__loongarch_lp64) +/* The page size is configurable by the kernel to be 4, 16 or 64 KiB. + For now, only the default page size of 16KiB is supported. */ +#define VTV_PAGE_SIZE 16384 #else #define VTV_PAGE_SIZE 4096 #endif diff --git a/libvtv/configure.tgt b/libvtv/configure.tgt index aa2a3f675b8..6cdd1e97ab1 100644 --- a/libvtv/configure.tgt +++ b/libvtv/configure.tgt @@ -50,6 +50,9 @@ case "${target}" in ;; x86_64-*-darwin[1]* | i?86-*-darwin[1]*) ;; + loongarch*-*-linux*) + VTV_SUPPORTED=yes + ;; *) ;; esac