From patchwork Mon Mar 22 11:24:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 406102 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp3479806jai; Mon, 22 Mar 2021 04:27:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNnaS6TqlPlu4eTdFP4F+rZSl1wTWV67tHpl+3U9zw7DMebmba3rIiX3DX6AlvNlbnbNsI X-Received: by 2002:a92:6e0e:: with SMTP id j14mr10696365ilc.90.1616412462748; Mon, 22 Mar 2021 04:27:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616412462; cv=none; d=google.com; s=arc-20160816; b=HqFJMyHq4gjnelVK2dynb5woZA5FoqWTdOuNtf+3G2H41dU9M4rGxek+yYhmuyTpzY LX69lxuVKOHuCYIl7mUdYIqhBlKic5OC0qUw2HsF84d8X/IqLbJtuIPHDMiX2HpuT3GI rLXoSUDZ45rOa5qD2pIfwVuUKfBeg37A3N9lphN0SRO0CPxyAg/H4HhnaIiyugEpR3Gl hhhuYBCxBP56bB71VXafKdNmc6JeLkdq6pmnC5rnL1Otxm2FSvcwnMIRYztkxgviKTRo +qreRp/h/Gfe3VqfGzK8GT4uKcS72q/8LHDcRGqEJnL64P39j/bvd8RcXYioDbiR1PNT /2yg== 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:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=cDSXceljWqcXDx04k32YsIurC/KdJcDt8gGgRtwSfiY=; b=hRmo+Xh7W6NeIgsS6Fwd9uZyRBUwULfkYDFOEm+0G4mV4j5zzrKnZ4YLP/y56No4ZM GE4ODv9QWBSa37FfAuYhljqCbGgY0NMpmxvG8lGVA8sli5kdRs6u1PRLbSO64E7CsZBO jhwwyPF2S9xvF9ENZikWqkGKUa/pks6RYQfy//t3ug5m/efLcb4MhtYXdVKXFYMQUDsr GYAxtpNixWhfIZT8kh0H6FTAzirownTIHpU6wlLz/F7aC/mNPH7IF3O/jG/UDAeQJyEL txoesfgYi3MrU6WpXcESU5V79XiphbEOsjUfEGH/xqRvHWOMj8JZHkuAJvmofvLKuUgx HswA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="Gornl2f/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=amsat.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m7si3835304ilh.26.2021.03.22.04.27.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Mar 2021 04:27:42 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="Gornl2f/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=amsat.org Received: from localhost ([::1]:47798 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lOIik-0000aF-7Y for patch@linaro.org; Mon, 22 Mar 2021 07:27:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49506) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lOIfq-0006Zi-FY for qemu-devel@nongnu.org; Mon, 22 Mar 2021 07:24:42 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:42838) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lOIfo-0005Fi-FL for qemu-devel@nongnu.org; Mon, 22 Mar 2021 07:24:42 -0400 Received: by mail-wr1-x42c.google.com with SMTP id x13so16264351wrs.9 for ; Mon, 22 Mar 2021 04:24:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cDSXceljWqcXDx04k32YsIurC/KdJcDt8gGgRtwSfiY=; b=Gornl2f/h+Pp18smoGCzIQJsGW+mnBR7NalkLcGdIa3V9pZZ9fIATwCtkFJrLL01ZW D8/C5Zp2Dnk7qfbinotedDKe5QQBoKUldtKlqYqqBJkZFo1NvrG19riHKz9/Kv/AM48W ydXZPBGh7DlSbe/C2D/tFnpriwEzvBLgy72Om+VJjnSp+hjLtZXRvi4DSVHAxWZ2w9hX m4tofyMiprES0Z+mQhN3+gk/z8o47xKGRGNNmSyPHkhfuFSp5tKMMloPpJyXXwLy/DXP ZZWh3AIbum4lJeUZv6RW95oUKnQPCqteinNu0ZHa0iTp1QfV3TADU8fTgFbrRyNx9VwL LuZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=cDSXceljWqcXDx04k32YsIurC/KdJcDt8gGgRtwSfiY=; b=ZYwZp2+0QWhJexguxp3bSJ7O2PImRxQMm3DDckN+eHWBcbZ5meoUTtLYgSabguOJ3v 6mIpY37lIOCcx7K0COWH4becGBqwXZea9/onJruv/2ApOoyKFVyLSFK589CGcen18mi/ tWORGLFKCtfHu+IG9RASiELpb0xljGthwqXMwNpQG4Luz6/V8kH231KL9c5GPYGxAPvw ATKRaHQ50nfdA5ugYTibBTva0UIseJmKAKBTDpooj9YlaRMVI0dSNymswADlWgMN7z1p OnsqTERdtCpadG6kK/vILntNRNB4qhcqjzrfp39aZai1L6HZuP33MuHySmU11RWZ/8Kr j5bg== X-Gm-Message-State: AOAM530gEXV7YvZdQWSjYoBPGT8uyse1zxedBGERRp8UiFIBRVShDT9Z a+9zVs+RQS1lxF0lChqJ5yfMB8p7mfBJTw== X-Received: by 2002:adf:ab52:: with SMTP id r18mr17611488wrc.65.1616412278516; Mon, 22 Mar 2021 04:24:38 -0700 (PDT) Received: from localhost.localdomain (17.red-88-21-201.staticip.rima-tde.net. [88.21.201.17]) by smtp.gmail.com with ESMTPSA id q15sm19239794wrx.56.2021.03.22.04.24.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Mar 2021 04:24:38 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 2/3] exec: Extract 'page-vary.h' header Date: Mon, 22 Mar 2021 12:24:25 +0100 Message-Id: <20210322112427.4045204-3-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210322112427.4045204-1-f4bug@amsat.org> References: <20210322112427.4045204-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x42c.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gavin Shan , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Paolo Bonzini Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson In the next commit we will extract the generic code out of page-vary.c, only keeping the target specific code. Both files will use the same TargetPageBits structure, so make its declaration in a shared header. As the common header can not use target specific types, use a uint64_t to hold the page mask value, and add a cast back to target_long in the TARGET_PAGE_MASK definitions. Signed-off-by: Philippe Mathieu-Daudé --- include/exec/cpu-all.h | 11 ++++------- include/exec/page-vary.h | 29 +++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 7 deletions(-) create mode 100644 include/exec/page-vary.h -- 2.26.2 diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index 76443eb11d5..b0a422c7b62 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -215,11 +215,7 @@ static inline void stl_phys_notdirty(AddressSpace *as, hwaddr addr, uint32_t val /* page related stuff */ #ifdef TARGET_PAGE_BITS_VARY -typedef struct { - bool decided; - int bits; - target_long mask; -} TargetPageBits; +# include "exec/page-vary.h" #if defined(CONFIG_ATTRIBUTE_ALIAS) || !defined(IN_EXEC_VARY) extern const TargetPageBits target_page; #else @@ -227,10 +223,11 @@ extern TargetPageBits target_page; #endif #ifdef CONFIG_DEBUG_TCG #define TARGET_PAGE_BITS ({ assert(target_page.decided); target_page.bits; }) -#define TARGET_PAGE_MASK ({ assert(target_page.decided); target_page.mask; }) +#define TARGET_PAGE_MASK ({ assert(target_page.decided); \ + (target_long)target_page.mask; }) #else #define TARGET_PAGE_BITS target_page.bits -#define TARGET_PAGE_MASK target_page.mask +#define TARGET_PAGE_MASK ((target_long)target_page.mask) #endif #define TARGET_PAGE_SIZE (-(int)TARGET_PAGE_MASK) #else diff --git a/include/exec/page-vary.h b/include/exec/page-vary.h new file mode 100644 index 00000000000..799d6310d6c --- /dev/null +++ b/include/exec/page-vary.h @@ -0,0 +1,29 @@ +/* + * Definitions for cpus with variable page sizes. + * + * Copyright (c) 2003 Fabrice Bellard + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#ifndef EXEC_PAGE_VARY_H +#define EXEC_PAGE_VARY_H + +typedef struct { + bool decided; + int bits; + uint64_t mask; +} TargetPageBits; + +#endif /* EXEC_PAGE_VARY_H */