From patchwork Sun Jul 18 13:46:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Reinoud Zandijk X-Patchwork-Id: 12384365 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18D27C636CA for ; Sun, 18 Jul 2021 13:58:02 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B4AF361183 for ; Sun, 18 Jul 2021 13:58:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B4AF361183 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=NetBSD.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:49278 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m57Is-0001CJ-96 for qemu-devel@archiver.kernel.org; Sun, 18 Jul 2021 09:57:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51462) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m578X-0004D2-MA for qemu-devel@nongnu.org; Sun, 18 Jul 2021 09:47:17 -0400 Received: from 13thmonkey.org ([80.100.255.32]:65364 helo=gorilla.13thmonkey.org) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m578V-0007fx-IA for qemu-devel@nongnu.org; Sun, 18 Jul 2021 09:47:17 -0400 Received: by gorilla.13thmonkey.org (Postfix, from userid 103) id 6EE012FF0934; Sun, 18 Jul 2021 15:47:11 +0200 (CEST) From: Reinoud Zandijk To: qemu-devel@nongnu.org Subject: [PATCH v1 1/2] Only check CONFIG_NVMM when NEED_CPU_H is defined Date: Sun, 18 Jul 2021 15:46:49 +0200 Message-Id: <20210718134650.1191-2-reinoud@NetBSD.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210718134650.1191-1-reinoud@NetBSD.org> References: <20210718134650.1191-1-reinoud@NetBSD.org> MIME-Version: 1.0 Received-SPF: none client-ip=80.100.255.32; envelope-from=reinoud@gorilla.13thmonkey.org; helo=gorilla.13thmonkey.org X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_NONE=0.001, SPF_NONE=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: Reinoud Zandijk Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Userland targers will otherwise use a poisoned CONFIG_NVMM Signed-off-by: Reinoud Zandijk --- include/sysemu/nvmm.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/sysemu/nvmm.h b/include/sysemu/nvmm.h index 6d216599b0..833670fccb 100644 --- a/include/sysemu/nvmm.h +++ b/include/sysemu/nvmm.h @@ -10,8 +10,7 @@ #ifndef QEMU_NVMM_H #define QEMU_NVMM_H -#include "config-host.h" -#include "qemu-common.h" +#ifdef NEED_CPU_H #ifdef CONFIG_NVMM @@ -23,4 +22,6 @@ int nvmm_enabled(void); #endif /* CONFIG_NVMM */ -#endif /* CONFIG_NVMM */ +#endif /* NEED_CPU_H */ + +#endif /* QEMU_NVMM_H */ From patchwork Sun Jul 18 13:46:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Reinoud Zandijk X-Patchwork-Id: 12384359 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7665C636CA for ; Sun, 18 Jul 2021 13:52:57 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5DB476117A for ; Sun, 18 Jul 2021 13:52:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5DB476117A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=NetBSD.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:45150 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m57Dz-0006RP-CR for qemu-devel@archiver.kernel.org; Sun, 18 Jul 2021 09:52:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51442) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m578W-0004Ck-Mp for qemu-devel@nongnu.org; Sun, 18 Jul 2021 09:47:16 -0400 Received: from 13thmonkey.org ([80.100.255.32]:65365 helo=gorilla.13thmonkey.org) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m578V-0007fr-85 for qemu-devel@nongnu.org; Sun, 18 Jul 2021 09:47:16 -0400 Received: by gorilla.13thmonkey.org (Postfix, from userid 103) id 70C6D2FF093B; Sun, 18 Jul 2021 15:47:11 +0200 (CEST) From: Reinoud Zandijk To: qemu-devel@nongnu.org Subject: [PATCH v1 2/2] Fix nvmm_ram_block_added() function arguments Date: Sun, 18 Jul 2021 15:46:50 +0200 Message-Id: <20210718134650.1191-3-reinoud@NetBSD.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210718134650.1191-1-reinoud@NetBSD.org> References: <20210718134650.1191-1-reinoud@NetBSD.org> MIME-Version: 1.0 Received-SPF: none client-ip=80.100.255.32; envelope-from=reinoud@gorilla.13thmonkey.org; helo=gorilla.13thmonkey.org X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_NONE=0.001, SPF_NONE=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: Reinoud Zandijk Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" A parameter max_size was added to the RAMBlockNotifier ram_block_added function. Use the max_size for pre allocation of hva space. Signed-off-by: Reinoud Zandijk --- target/i386/nvmm/nvmm-all.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/target/i386/nvmm/nvmm-all.c b/target/i386/nvmm/nvmm-all.c index dfa690d65d..fdcd37ed3e 100644 --- a/target/i386/nvmm/nvmm-all.c +++ b/target/i386/nvmm/nvmm-all.c @@ -1134,13 +1134,14 @@ static MemoryListener nvmm_memory_listener = { }; static void -nvmm_ram_block_added(RAMBlockNotifier *n, void *host, size_t size) +nvmm_ram_block_added(RAMBlockNotifier *n, void *host, size_t size, + size_t max_size) { struct nvmm_machine *mach = get_nvmm_mach(); uintptr_t hva = (uintptr_t)host; int ret; - ret = nvmm_hva_map(mach, hva, size); + ret = nvmm_hva_map(mach, hva, max_size); if (ret == -1) { error_report("NVMM: Failed to map HVA, HostVA:%p "