From patchwork Wed Jan 16 08:10:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Yi" X-Patchwork-Id: 10765477 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 182BA13A4 for ; Wed, 16 Jan 2019 08:12:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0BFD42D0B6 for ; Wed, 16 Jan 2019 08:12:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 005212D164; Wed, 16 Jan 2019 08:12:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 941E82D155 for ; Wed, 16 Jan 2019 08:12:10 +0000 (UTC) Received: from localhost ([127.0.0.1]:43933 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjgIz-0005wm-L5 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 16 Jan 2019 03:12:09 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48057) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjgHW-0004qM-H5 for qemu-devel@nongnu.org; Wed, 16 Jan 2019 03:10:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjgHQ-000707-WF for qemu-devel@nongnu.org; Wed, 16 Jan 2019 03:10:34 -0500 Received: from mga17.intel.com ([192.55.52.151]:47090) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjgHC-0006s0-Un for qemu-devel@nongnu.org; Wed, 16 Jan 2019 03:10:23 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Jan 2019 00:10:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,485,1539673200"; d="scan'208";a="267507828" Received: from linux.intel.com ([10.54.29.200]) by orsmga004.jf.intel.com with ESMTP; 16 Jan 2019 00:10:13 -0800 Received: from dazhang1-ssd.sh.intel.com (dazhang1-ssd.sh.intel.com [10.239.48.128]) by linux.intel.com (Postfix) with ESMTP id 4EB265800C6; Wed, 16 Jan 2019 00:10:11 -0800 (PST) From: Zhang Yi To: xiaoguangrong.eric@gmail.com, stefanha@redhat.com, pbonzini@redhat.com, pagupta@redhat.com, yu.c.zhang@linux.intel.com, mst@redhat.com, ehabkost@redhat.com Date: Wed, 16 Jan 2019 16:10:29 +0800 Message-Id: X-Mailer: git-send-email 2.7.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 192.55.52.151 Subject: [Qemu-devel] [PATCH V9 2/6] memory: use sparse feature define RAM_FLAG. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: imammedo@redhat.com, dan.j.williams@intel.com, qemu-devel@nongnu.org, Zhang Yi Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Zhang Yi Signed-off-by: Michael S. Tsirkin --- include/exec/memory.h | 12 ++++++------ include/qemu/osdep.h | 9 +++++++++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/include/exec/memory.h b/include/exec/memory.h index 667466b..03824d9 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -104,27 +104,27 @@ struct IOMMUNotifier { typedef struct IOMMUNotifier IOMMUNotifier; /* RAM is pre-allocated and passed into qemu_ram_alloc_from_ptr */ -#define RAM_PREALLOC (1 << 0) +#define RAM_PREALLOC ((QEMU_FORCE QemuMmapFlags) (1 << 0)) /* RAM is mmap-ed with MAP_SHARED */ -#define RAM_SHARED (1 << 1) +#define RAM_SHARED ((QEMU_FORCE QemuMmapFlags) (1 << 1)) /* Only a portion of RAM (used_length) is actually used, and migrated. * This used_length size can change across reboots. */ -#define RAM_RESIZEABLE (1 << 2) +#define RAM_RESIZEABLE ((QEMU_FORCE QemuMmapFlags) (1 << 2)) /* UFFDIO_ZEROPAGE is available on this RAMBlock to atomically * zero the page and wake waiting processes. * (Set during postcopy) */ -#define RAM_UF_ZEROPAGE (1 << 3) +#define RAM_UF_ZEROPAGE ((QEMU_FORCE QemuMmapFlags) (1 << 3)) /* RAM can be migrated */ -#define RAM_MIGRATABLE (1 << 4) +#define RAM_MIGRATABLE ((QEMU_FORCE QemuMmapFlags) (1 << 4)) /* RAM is a persistent kind memory */ -#define RAM_PMEM (1 << 5) +#define RAM_PMEM ((QEMU_FORCE QemuMmapFlags) (1 << 5)) static inline void iommu_notifier_init(IOMMUNotifier *n, IOMMUNotify fn, IOMMUNotifierFlag flags, diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 3bf48bc..457d24e 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -185,6 +185,15 @@ extern int daemon(int, int); #define ESHUTDOWN 4099 #endif +#ifdef __CHECKER__ +#define QEMU_BITWISE __attribute__((bitwise)) +#define QEMU_FORCE __attribute__((force)) +#else +#define QEMU_BITWISE +#define QEMU_FORCE +#endif + +typedef unsigned QEMU_BITWISE QemuMmapFlags; /* time_t may be either 32 or 64 bits depending on the host OS, and * can be either signed or unsigned, so we can't just hardcode a * specific maximum value. This is not a C preprocessor constant,