From patchwork Thu May 7 17:39:49 2020 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: 1285532 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=2001:470:142::17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=K0fESeVf; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:470:142::17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49J12r1gjVz9sSc for ; Fri, 8 May 2020 03:40:52 +1000 (AEST) Received: from localhost ([::1]:35614 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jWkVu-00049a-0P for incoming@patchwork.ozlabs.org; Thu, 07 May 2020 13:40:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58636) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWkVJ-000428-Ps for qemu-devel@nongnu.org; Thu, 07 May 2020 13:40:13 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:60268 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jWkVI-0001pp-UX for qemu-devel@nongnu.org; Thu, 07 May 2020 13:40:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588873211; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HfPvUKlpTOVQLFy8BwTSc/DXLFLUF3kj7Agr3qTHJq8=; b=K0fESeVfYgPq10qfkJo+KGddCzZubOHjAkG+NG8+irVr/ECFDJoCfAhvx5lOuR2oxwUBYG aPBUgx1D1jInIcZFPgyfZHNvewqJqUZKS1eUW2L1m9evdoQlIiiICNXhNNSzUvrbyn/+kU zA4c/cFr7TUq26wMFPCpw2Fg7CeP/y8= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-98-J646-Ki_MuqQG3feSsJ6uw-1; Thu, 07 May 2020 13:40:10 -0400 X-MC-Unique: J646-Ki_MuqQG3feSsJ6uw-1 Received: by mail-wm1-f70.google.com with SMTP id h6so3816541wmi.7 for ; Thu, 07 May 2020 10:40:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kxvXFPE6UHybEFXPcbW7yUzdfwvwhz8UFSm+7XHIpoE=; b=Pm99cz+oC4SPnthII1gWlcCaGAF77xZAsg0scSkJfCJ6z72muN4mRGIzLvBPoTZjHQ 3tF/3TyAA18YUNtmBaOitYq5LQ+DJcLH8M/Am+qCFB+pH6XneGzzrQT/y5pIV6yfz83J OMvRf0roJ9xKL9H6wN1+CMR1Z+zI3bUXY4H1TJN2ueI1iMXEXPyKvolAvD5HhTdFfemI V3Z+4fTHhDSSWvAqGW8ITmwEnDd/lQTtsDEUMHkhKRiBgtAuEQTFaZvFFZMhIBvfkDOd 9ZzYiVTtPPe6w8esyVhYvlAlxaCyLXsQXvsnO1Dr0mDUfaBQRud0JoGIzNvkF65wnw2H Ds5A== X-Gm-Message-State: AGi0PuYK5uMxZu9q3mWBY3C7kbPTUeMJbemYc94tgMmgxrEUInDrEZfA xGM6bSMoMa/5ZwFDfpRNzj1qr6WAl1x8DKvrKy1rRARzeFlWmy6ERaUl/tNrTokz0ZHSuILVDP0 Z9DBy2IBGIBu080Y= X-Received: by 2002:adf:e8c4:: with SMTP id k4mr16056753wrn.209.1588873209110; Thu, 07 May 2020 10:40:09 -0700 (PDT) X-Google-Smtp-Source: APiQypKlrGEn0Sc/1RPDvoGn3rAxgVJuKzc8w2GXUIsYM+I8hINTpoVRTGPr4A3JRU1Chjb4djvbRA== X-Received: by 2002:adf:e8c4:: with SMTP id k4mr16056726wrn.209.1588873208935; Thu, 07 May 2020 10:40:08 -0700 (PDT) Received: from localhost.localdomain (17.red-88-21-202.staticip.rima-tde.net. [88.21.202.17]) by smtp.gmail.com with ESMTPSA id t16sm9133352wrm.26.2020.05.07.10.40.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 May 2020 10:40:08 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Peter Maydell , Paolo Bonzini , qemu-devel@nongnu.org Subject: [PATCH 01/10] exec: Rename qemu_ram_writeback() as qemu_ram_msync() Date: Thu, 7 May 2020 19:39:49 +0200 Message-Id: <20200507173958.25894-2-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200507173958.25894-1-philmd@redhat.com> References: <20200507173958.25894-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=205.139.110.120; envelope-from=philmd@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/07 03:15:48 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN 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: Kevin Wolf , Cornelia Huck , Alex Williamson , "Michael S. Tsirkin" , qemu-block@nongnu.org, David Hildenbrand , Juan Quintela , "Dr. David Alan Gilbert" , Max Reitz , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, Stefan Hajnoczi , Keith Busch , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Rename qemu_ram_writeback() as qemu_ram_msync() to better match what it does. Suggested-by: Stefan Hajnoczi Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Juan Quintela --- include/exec/ram_addr.h | 4 ++-- exec.c | 2 +- hw/block/nvme.c | 3 +-- memory.c | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h index 4e05292f91..7b5c24e928 100644 --- a/include/exec/ram_addr.h +++ b/include/exec/ram_addr.h @@ -136,12 +136,12 @@ void qemu_ram_free(RAMBlock *block); int qemu_ram_resize(RAMBlock *block, ram_addr_t newsize, Error **errp); -void qemu_ram_writeback(RAMBlock *block, ram_addr_t start, ram_addr_t length); +void qemu_ram_msync(RAMBlock *block, ram_addr_t start, ram_addr_t length); /* Clear whole block of mem */ static inline void qemu_ram_block_writeback(RAMBlock *block) { - qemu_ram_writeback(block, 0, block->used_length); + qemu_ram_msync(block, 0, block->used_length); } #define DIRTY_CLIENTS_ALL ((1 << DIRTY_MEMORY_NUM) - 1) diff --git a/exec.c b/exec.c index 2874bb5088..f5a8cdf370 100644 --- a/exec.c +++ b/exec.c @@ -2127,7 +2127,7 @@ int qemu_ram_resize(RAMBlock *block, ram_addr_t newsize, Error **errp) * Otherwise no-op. * @Note: this is supposed to be a synchronous op. */ -void qemu_ram_writeback(RAMBlock *block, ram_addr_t start, ram_addr_t length) +void qemu_ram_msync(RAMBlock *block, ram_addr_t start, ram_addr_t length) { /* The requested range should fit in within the block range */ g_assert((start + length) <= block->used_length); diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 9b453423cf..21a199e53b 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -1207,8 +1207,7 @@ static uint64_t nvme_mmio_read(void *opaque, hwaddr addr, unsigned size) */ if (addr == 0xE08 && (NVME_PMRCAP_PMRWBM(n->bar.pmrcap) & 0x02)) { - qemu_ram_writeback(n->pmrdev->mr.ram_block, - 0, n->pmrdev->size); + qemu_ram_msync(n->pmrdev->mr.ram_block, 0, n->pmrdev->size); } memcpy(&val, ptr + addr, size); } else { diff --git a/memory.c b/memory.c index 601b749906..3e65e33ac4 100644 --- a/memory.c +++ b/memory.c @@ -2205,7 +2205,7 @@ void memory_region_do_writeback(MemoryRegion *mr, hwaddr addr, hwaddr size) * different types of memory regions */ if (mr->ram_block && mr->dirty_log_mask) { - qemu_ram_writeback(mr->ram_block, addr, size); + qemu_ram_msync(mr->ram_block, addr, size); } } From patchwork Thu May 7 17:39:50 2020 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: 1285535 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=2001:470:142::17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=IrxhOifP; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:470:142::17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49J15T1vJNz9sNH for ; Fri, 8 May 2020 03:43:09 +1000 (AEST) Received: from localhost ([::1]:44644 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jWkY6-0008Mi-VR for incoming@patchwork.ozlabs.org; Thu, 07 May 2020 13:43:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58674) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWkVQ-0004HS-LK for qemu-devel@nongnu.org; Thu, 07 May 2020 13:40:20 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:43238 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jWkVP-0001tV-Mr for qemu-devel@nongnu.org; Thu, 07 May 2020 13:40:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588873219; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lxO/QfhV7TdK4OIX7B7RR3nAolSQ5KL0SwXgbuIknFc=; b=IrxhOifPTe+j91upsc2c2OXBdBQEeurm9UBtG8tRknIOExAzd0sa11R987aydcVQ9UJ5eH U6aBVutYIqH/ZXSH/rCF0RpviK2nqiOTweuCNc9Qs/MTgn+PO6fzqXQjF2ZTQHZHtqxVy4 ffrCBPPNFi4CDF/hw6uYNO3dDG02BM4= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-231-vDE5JFgDPJOIxdrQJLu2sQ-1; Thu, 07 May 2020 13:40:16 -0400 X-MC-Unique: vDE5JFgDPJOIxdrQJLu2sQ-1 Received: by mail-wm1-f69.google.com with SMTP id o74so1358353wme.2 for ; Thu, 07 May 2020 10:40:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AYsaK9GNOXZIFUV300k/n6Vn/uB0ELw2OsZ7tcgl1LI=; b=KCxjFb4Mvf0PWMi114i882UVszO7MebtyJh9fJvW9FimXet4tFz5dK3EyHnnu/qDta FO5sH01SZ38vpfiD4sYCIFzKX0lk6bpLGCf1fYAgwVnUyWKHm1FBhk0UBcI9R4z2ATSx GiUi539r2O47hXArtRtaK7Oglw8fhD4bQfcVsb8RAVrw9Uc29UMcgYczNMIELKLxKrbd W8hgK9UarOYezHcDkLilgGUACl1iisiIDK7Oj8KVCNiP7TlXcZoihAnM+01gd/biQDtZ kOdJYbIKdRO0VyRfdpoNRYr5+6gzBcMGYaO4NPwPWvEO9rZnIFtqrxZbp6rjXKZ1upvd BnrA== X-Gm-Message-State: AGi0PubnphL7TDaBpHAfh0u3a7KRc1B8oxz+RT4gcawiMPr21BnqvdIK ALHKb2PuVRAyBNB/Z6BLPfYl2u8enZsV3zbY/vjiwGeioWpD+XT8uS2lwFe6g7EhtVp6lCUZ+7c Rvnj7Cg4wVUwb5+E= X-Received: by 2002:a7b:c3d2:: with SMTP id t18mr3291881wmj.100.1588873215514; Thu, 07 May 2020 10:40:15 -0700 (PDT) X-Google-Smtp-Source: APiQypJ/AaUMzxN6c9AoFV7na/bw7wTqjkWo0VEqXrFVogrggBfyPF77EaBvs4PKan+/nsLzTJ6QVQ== X-Received: by 2002:a7b:c3d2:: with SMTP id t18mr3291851wmj.100.1588873215269; Thu, 07 May 2020 10:40:15 -0700 (PDT) Received: from localhost.localdomain (17.red-88-21-202.staticip.rima-tde.net. [88.21.202.17]) by smtp.gmail.com with ESMTPSA id k23sm8431664wmi.46.2020.05.07.10.40.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 May 2020 10:40:14 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Peter Maydell , Paolo Bonzini , qemu-devel@nongnu.org Subject: [PATCH 02/10] exec/ramblock: Add missing 'qemu/rcu.h' include Date: Thu, 7 May 2020 19:39:50 +0200 Message-Id: <20200507173958.25894-3-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200507173958.25894-1-philmd@redhat.com> References: <20200507173958.25894-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=207.211.31.81; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/07 00:55:34 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN 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: Kevin Wolf , Cornelia Huck , Alex Williamson , "Michael S. Tsirkin" , qemu-block@nongnu.org, David Hildenbrand , Juan Quintela , "Dr. David Alan Gilbert" , Max Reitz , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, Keith Busch , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The first field of RAMBlock is a rcu_head structure. We need to include the "qemu/rcu.h" to avoid errors when including "exec/ramblock.h" without "qemu/rcu.h": include/exec/ramblock.h:27:21: error: field ‘rcu’ has incomplete type 27 | struct rcu_head rcu; | ^~~ include/exec/ramblock.h:39:5: error: expected specifier-qualifier-list before ‘QLIST_ENTRY’ 39 | QLIST_ENTRY(RAMBlock) next; | ^~~~~~~~~~~ Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Juan Quintela --- include/exec/ramblock.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/exec/ramblock.h b/include/exec/ramblock.h index 07d50864d8..6ac0aa7a89 100644 --- a/include/exec/ramblock.h +++ b/include/exec/ramblock.h @@ -21,6 +21,7 @@ #ifndef CONFIG_USER_ONLY #include "cpu-common.h" +#include "qemu/rcu.h" struct RAMBlock { struct rcu_head rcu; From patchwork Thu May 7 17:39:51 2020 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: 1285536 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=2001:470:142::17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=dzrru/7f; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:470:142::17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49J15l6w9Dz9sNH for ; Fri, 8 May 2020 03:43:23 +1000 (AEST) Received: from localhost ([::1]:45926 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jWkYL-0000Xs-FK for incoming@patchwork.ozlabs.org; Thu, 07 May 2020 13:43:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58704) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWkVY-0004SL-Ay for qemu-devel@nongnu.org; Thu, 07 May 2020 13:40:28 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:34820 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jWkVX-00020v-Fw for qemu-devel@nongnu.org; Thu, 07 May 2020 13:40:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588873226; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZIo/ym+GwChrjVctsSvXHZCFHOcswzIaMYFLtwhZ4lE=; b=dzrru/7fz/mklnskO3+tTD7YiOLp6j/uEV3iRgqg8if48FKApN0SIHBjinWraYOfUDefMU 2QVbWCzBgjMfrltEUOFVQ/v86nrXEq9oueoGAiU7XBRglC3GoADl1s0GAJ3yqq7Kigd/zP E2eHZgTZmo5y6T3cLXDI9QT9iC9AGq4= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-439-FmDPm5V4PCOmGm1V3jHKFw-1; Thu, 07 May 2020 13:40:22 -0400 X-MC-Unique: FmDPm5V4PCOmGm1V3jHKFw-1 Received: by mail-wr1-f70.google.com with SMTP id u4so3869705wrm.13 for ; Thu, 07 May 2020 10:40:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=i0MZMfJVODlK5BEAJP5UwDYJxQ9slk7d2GJvo0cW21A=; b=cSabAA1Zr7ui2QAjubogGow4xWJYlL8KSVvIBqspuwZRGdWYN+tWaBX1Fum+o9cShK Ls2/lgDAQsguUtQcaqyBndg+lp9UtAtm2ZVVHwA+rnsc4CP5Dxy/2SjrA/AUDUEpQCIQ PrIMdkTKRU77QSmFqQbLvehQq3KEOVRjL9qrLUe0uduzprvlfnpXc3daoKXBZcbFBKvk JFP7qZ+/xsTXlPAemOKtsvHT2cD0FLM4ieVjMeY++z2awpBRhepKi2tRTHTZYtWK+ziQ 2BqwJt0uLrzhIwGsA75Wb16Q+yoI+4ygvVmKMRjgLjXsGJMGgCXyUQ9MT/tO5ASOZpYG X98Q== X-Gm-Message-State: AGi0PuYpt1ENq0oHvfuTbmf8RfuSe5gAUsWFJ2CVI3EpP1M6MNU38vlQ 0VsJlXQLHqx6fW0hV2Bf5eIdGlANr60dcSNMaOb1h0j+zJbi0Z301G8K6C+qXcp/VTZp1G2e7UZ k6TArMQKLvbeNNv4= X-Received: by 2002:a1c:2e91:: with SMTP id u139mr11194544wmu.18.1588873221696; Thu, 07 May 2020 10:40:21 -0700 (PDT) X-Google-Smtp-Source: APiQypLjd6hp7wq7mFKudq18rc8BGau0g28R6juxYKJghEkCTOt96u7gXk2f7QLvYsavtxvXfsaWtw== X-Received: by 2002:a1c:2e91:: with SMTP id u139mr11194521wmu.18.1588873221496; Thu, 07 May 2020 10:40:21 -0700 (PDT) Received: from localhost.localdomain (17.red-88-21-202.staticip.rima-tde.net. [88.21.202.17]) by smtp.gmail.com with ESMTPSA id v131sm9445838wmb.19.2020.05.07.10.40.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 May 2020 10:40:20 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Peter Maydell , Paolo Bonzini , qemu-devel@nongnu.org Subject: [PATCH 03/10] exec: Move tb_invalidate_phys_range() to 'exec/exec-all.h' Date: Thu, 7 May 2020 19:39:51 +0200 Message-Id: <20200507173958.25894-4-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200507173958.25894-1-philmd@redhat.com> References: <20200507173958.25894-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=207.211.31.81; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/07 00:55:34 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN 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: Kevin Wolf , Cornelia Huck , Alex Williamson , "Michael S. Tsirkin" , qemu-block@nongnu.org, David Hildenbrand , Juan Quintela , "Dr. David Alan Gilbert" , Max Reitz , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, Keith Busch , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Move tb_invalidate_phys_range() to "exec/exec-all.h" with the other TranslationBlock invalidate functions. Move all these functions altogether. Check for the CONFIG_SOFTMMU definition which is more explicit than CONFIG_USER_ONLY. Signed-off-by: Philippe Mathieu-Daudé --- include/exec/exec-all.h | 14 ++++++++------ include/exec/ram_addr.h | 2 -- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index 350c4b451b..f1a9b8a576 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -454,12 +454,15 @@ static inline uint32_t curr_cflags(void) } /* TranslationBlock invalidate API */ -#if defined(CONFIG_USER_ONLY) +#ifdef CONFIG_SOFTMMU +void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr, MemTxAttrs attrs); +void tb_invalidate_phys_range(ram_addr_t start, ram_addr_t end); +void tb_flush_jmp_cache(CPUState *cpu, target_ulong addr); +#else void tb_invalidate_phys_addr(target_ulong addr); void tb_invalidate_phys_range(target_ulong start, target_ulong end); -#else -void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr, MemTxAttrs attrs); -#endif +#endif /* CONFIG_SOFTMMU */ + void tb_flush(CPUState *cpu); void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr); TranslationBlock *tb_htable_lookup(CPUState *cpu, target_ulong pc, @@ -583,7 +586,6 @@ void tlb_reset_dirty(CPUState *cpu, ram_addr_t start1, ram_addr_t length); void tlb_set_dirty(CPUState *cpu, target_ulong vaddr); /* exec.c */ -void tb_flush_jmp_cache(CPUState *cpu, target_ulong addr); MemoryRegionSection * address_space_translate_for_iotlb(CPUState *cpu, int asidx, hwaddr addr, @@ -591,7 +593,7 @@ address_space_translate_for_iotlb(CPUState *cpu, int asidx, hwaddr addr, MemTxAttrs attrs, int *prot); hwaddr memory_region_section_get_iotlb(CPUState *cpu, MemoryRegionSection *section); -#endif +#endif /* CONFIG_USER_ONLY */ /* vl.c */ extern int singlestep; diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h index 7b5c24e928..06096e8c6a 100644 --- a/include/exec/ram_addr.h +++ b/include/exec/ram_addr.h @@ -147,8 +147,6 @@ static inline void qemu_ram_block_writeback(RAMBlock *block) #define DIRTY_CLIENTS_ALL ((1 << DIRTY_MEMORY_NUM) - 1) #define DIRTY_CLIENTS_NOCODE (DIRTY_CLIENTS_ALL & ~(1 << DIRTY_MEMORY_CODE)) -void tb_invalidate_phys_range(ram_addr_t start, ram_addr_t end); - static inline bool cpu_physical_memory_get_dirty(ram_addr_t start, ram_addr_t length, unsigned client) From patchwork Thu May 7 17:39:52 2020 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: 1285538 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=2001:470:142::17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=dilP+YDo; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:470:142::17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49J17H304Qz9sPF for ; Fri, 8 May 2020 03:44:43 +1000 (AEST) Received: from localhost ([::1]:52932 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jWkZd-0003QI-6I for incoming@patchwork.ozlabs.org; Thu, 07 May 2020 13:44:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58722) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWkVd-0004cw-1J for qemu-devel@nongnu.org; Thu, 07 May 2020 13:40:33 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:55916 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jWkVb-000238-OY for qemu-devel@nongnu.org; Thu, 07 May 2020 13:40:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588873230; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DTInzwfX63p1qih9M+Dgx3t+UyJi8t1Fm5i0KyZ44dI=; b=dilP+YDoYFV0p+PcNr3yDD9pVVV/giapUSXUxxCa20OjyyoUpbpTrx1sndwwKF8mcDzvpK hrLnhOlXfWMSq6NL5M6h/Ez1R3EFtB36hbY7gwIVBWTbq1/Pikz1nLhfDgZ7XuqChDnNwx Ltu/aSPETncIYlJzhAiEoTiwSwv5C80= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-308-Td0NmQ9GMdKRYqYPmoGBsQ-1; Thu, 07 May 2020 13:40:29 -0400 X-MC-Unique: Td0NmQ9GMdKRYqYPmoGBsQ-1 Received: by mail-wm1-f69.google.com with SMTP id o26so3019873wmh.1 for ; Thu, 07 May 2020 10:40:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cufZfBHIUwQzCgzD4HBPhihgc0XcJ+ZYlhn0GKj8V9k=; b=ZT2tHtA5uhE52AdZADDY6WKcVUAdZYvKFZW95XUvDCiNLZBx9zZiHC0ggYhPNQvCsA G4m79pRAbHmajkSaecqPyiPTtkDmE3yPtlC+mKfp67oCHYRpmVJOzrAFgG1GevvW2m44 bpRVHOyz1t6g5563+0HF0EKzTz2t15jTyYWathbIp4KHMm6kbmSejB55URS1uPAVw7Cp 44tuHf5fo/4UG5+gPjj+KdOlrTUlbwpIxE8R5KlJHhtclPBcb55StYn4WLAsSBxWFvXb 5XO9pvPT3A3O6fdVzniKrgSDbaURPF5jZCKSiPTS5WiGpkkS29e6he0mBx73+ByVHROa 5tRg== X-Gm-Message-State: AGi0PubA2nr5v2aJDweZJmaCTMUdSDze5ts/NHSdRpG88liBbGYISfud bDP8Oyd9Dq8gS3n3hybQ+ctJ+7yVCawCaisVz4wbRaTWkMaVTOckOmyMipm5CG+lHuiGtY6zeHY v1237+CTzywUQhj4= X-Received: by 2002:a1c:5642:: with SMTP id k63mr11361487wmb.188.1588873228044; Thu, 07 May 2020 10:40:28 -0700 (PDT) X-Google-Smtp-Source: APiQypJbDQPmlpA5L5mUbNL57avc7o0U8xeDyRm/PDLK7AdA2hywNGuD6taYQC/vj9FG7kxQww3kOw== X-Received: by 2002:a1c:5642:: with SMTP id k63mr11361466wmb.188.1588873227814; Thu, 07 May 2020 10:40:27 -0700 (PDT) Received: from localhost.localdomain (17.red-88-21-202.staticip.rima-tde.net. [88.21.202.17]) by smtp.gmail.com with ESMTPSA id x5sm8941896wro.12.2020.05.07.10.40.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 May 2020 10:40:27 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Peter Maydell , Paolo Bonzini , qemu-devel@nongnu.org Subject: [PATCH 04/10] exec/memory-internal: Check CONFIG_SOFTMMU instead of CONFIG_USER_ONLY Date: Thu, 7 May 2020 19:39:52 +0200 Message-Id: <20200507173958.25894-5-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200507173958.25894-1-philmd@redhat.com> References: <20200507173958.25894-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=205.139.110.61; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/07 02:00:54 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN 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: Kevin Wolf , Cornelia Huck , Alex Williamson , "Michael S. Tsirkin" , qemu-block@nongnu.org, David Hildenbrand , Juan Quintela , "Dr. David Alan Gilbert" , Max Reitz , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, Keith Busch , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The CONFIG_SOFTMMU definition is poisoned in "exec/poison.h". As this header is internal, check for poisoned CONFIG_SOFTMMU instead of CONFIG_USER_ONLY to make this include harder to use. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Juan Quintela --- include/exec/memory-internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/exec/memory-internal.h b/include/exec/memory-internal.h index 9fcc2af25c..b2b7c1e78a 100644 --- a/include/exec/memory-internal.h +++ b/include/exec/memory-internal.h @@ -22,7 +22,7 @@ #include "cpu.h" -#ifndef CONFIG_USER_ONLY +#ifdef CONFIG_SOFTMMU static inline AddressSpaceDispatch *flatview_to_dispatch(FlatView *fv) { return fv->dispatch; From patchwork Thu May 7 17:39:53 2020 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: 1285533 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=2001:470:142::17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=fqs3NY0M; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:470:142::17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49J13S2KR3z9sNH for ; Fri, 8 May 2020 03:41:24 +1000 (AEST) Received: from localhost ([::1]:38280 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jWkWQ-0005V4-0y for incoming@patchwork.ozlabs.org; Thu, 07 May 2020 13:41:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58740) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWkVj-0004ty-Fc for qemu-devel@nongnu.org; Thu, 07 May 2020 13:40:39 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:24304 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jWkVh-000243-Vp for qemu-devel@nongnu.org; Thu, 07 May 2020 13:40:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588873237; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZdFZ0OjE1DpAAVLNEZIjDa8uv1PWgwWozsvTfYsCYTw=; b=fqs3NY0MwEsFXhtfJZVQcYghaYguR6/N/SVruP9SufuA2o/YO+MkzX/1CsEc6+2wcFCChy qxO7yCzlK/9GwPq2UopMK7xw3tErMECxM1hzc0XZ5fkwrMmo2MOkGhrkQJ5PpzdAs2kStI hLc7G3vtQHU7FNjpcB8jk8JZl6qsOt4= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-495-kddcGn7pNz6SBaZFLnbpHw-1; Thu, 07 May 2020 13:40:35 -0400 X-MC-Unique: kddcGn7pNz6SBaZFLnbpHw-1 Received: by mail-wm1-f71.google.com with SMTP id w189so134751wmg.1 for ; Thu, 07 May 2020 10:40:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DuSlgYQW6m0eg/30d5EZD9dD1Dk0rLysx3QIzLKclSo=; b=k/CNdeo/yrfjbUl9ArfQASE6veMhP///cHGEqWYF+TEoJ0Mw1B/uJxree8mMHjdD6E LO5hAgqsie81EoEyNFAPUxXFNRWCCyHVzVj3cIsYQchjVbdkQlqIHETKZH34E7sXKPaX 04pD4EhWX8e/1vB53J68drJv/oL2fg21KhSiAX1sMWF3nFuM6ufvH+55mZPUaPiw7I6v rqeAZIic0yJygoYHcl2AoFf6sguYU4QKMSM/XYaMT2F4YRn0QSTN5Ww7d7n0ntxN6TWk S1vQy0rxfvRECsSeJsFMo3FNgi0c6zYKlpipl4uX2zQ9sSwH4JhWg2Y30VCyKlxQFcPi ihXg== X-Gm-Message-State: AGi0Pua8IYafI3NjS1YmTozer/m1DdZKLQsJx6ootJlJjX25H+5ujmya WTqgjJTiPRYJOLrAsKHC8ivHJZeBmQ0Ru4tahhxCOPn7qd93Pq0RXvxEWG4/CL5stN9Tpohihi0 jkbjeJBfmQJmvi2k= X-Received: by 2002:a1c:7e82:: with SMTP id z124mr4412726wmc.53.1588873234572; Thu, 07 May 2020 10:40:34 -0700 (PDT) X-Google-Smtp-Source: APiQypIUjywJdc7qvMuEX/G7gKNbNfCgRlvC+A643ONE2kdTVge32hF2c0AYqiGKGwl93xhWiL4H5g== X-Received: by 2002:a1c:7e82:: with SMTP id z124mr4412705wmc.53.1588873234244; Thu, 07 May 2020 10:40:34 -0700 (PDT) Received: from localhost.localdomain (17.red-88-21-202.staticip.rima-tde.net. [88.21.202.17]) by smtp.gmail.com with ESMTPSA id c190sm9535898wme.10.2020.05.07.10.40.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 May 2020 10:40:33 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Peter Maydell , Paolo Bonzini , qemu-devel@nongnu.org Subject: [PATCH 05/10] exec: Move qemu_minrampagesize/qemu_maxrampagesize to 'qemu-common.h' Date: Thu, 7 May 2020 19:39:53 +0200 Message-Id: <20200507173958.25894-6-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200507173958.25894-1-philmd@redhat.com> References: <20200507173958.25894-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=207.211.31.81; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/07 00:55:34 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: Kevin Wolf , Cornelia Huck , Alex Williamson , "Michael S. Tsirkin" , qemu-block@nongnu.org, David Hildenbrand , Alexey Kardashevskiy , Juan Quintela , "Dr. David Alan Gilbert" , Max Reitz , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, Keith Busch , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Move these generic functions to a more common place, with other functions related to host page size. Document a little. Cc: Alexey Kardashevskiy Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Juan Quintela Acked-by: Cornelia Huck Acked-by: David Gibson --- include/exec/ram_addr.h | 3 --- include/qemu-common.h | 10 ++++++++++ hw/ppc/spapr_caps.c | 2 +- hw/s390x/s390-virtio-ccw.c | 1 + hw/vfio/spapr.c | 2 +- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h index 06096e8c6a..195b67d3c8 100644 --- a/include/exec/ram_addr.h +++ b/include/exec/ram_addr.h @@ -93,9 +93,6 @@ static inline unsigned long int ramblock_recv_bitmap_offset(void *host_addr, bool ramblock_is_pmem(RAMBlock *rb); -long qemu_minrampagesize(void); -long qemu_maxrampagesize(void); - /** * qemu_ram_alloc_from_file, * qemu_ram_alloc_from_fd: Allocate a ram block from the specified backing diff --git a/include/qemu-common.h b/include/qemu-common.h index d0142f29ac..2821a6ef76 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -80,6 +80,16 @@ bool set_preferred_target_page_bits(int bits); */ void finalize_target_page_bits(void); +/** + * qemu_minrampagesize: + * qemu_maxrampagesize: + * + * If backed via -memdev, return the device page size, + * else return the host kernel page size. + */ +long qemu_minrampagesize(void); +long qemu_maxrampagesize(void); + /** * Sends a (part of) iovec down a socket, yielding when the socket is full, or * Receives data into a (part of) iovec from a socket, diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c index eb54f94227..33a802a103 100644 --- a/hw/ppc/spapr_caps.c +++ b/hw/ppc/spapr_caps.c @@ -23,11 +23,11 @@ */ #include "qemu/osdep.h" +#include "qemu-common.h" #include "qemu/error-report.h" #include "qapi/error.h" #include "qapi/visitor.h" #include "sysemu/hw_accel.h" -#include "exec/ram_addr.h" #include "target/ppc/cpu.h" #include "target/ppc/mmu-hash64.h" #include "cpu-models.h" diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index f660070d22..c009384505 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -12,6 +12,7 @@ */ #include "qemu/osdep.h" +#include "qemu-common.h" #include "qapi/error.h" #include "cpu.h" #include "hw/boards.h" diff --git a/hw/vfio/spapr.c b/hw/vfio/spapr.c index 2900bd1941..c64db940a7 100644 --- a/hw/vfio/spapr.c +++ b/hw/vfio/spapr.c @@ -9,13 +9,13 @@ */ #include "qemu/osdep.h" +#include "qemu-common.h" #include "cpu.h" #include #include #include "hw/vfio/vfio-common.h" #include "hw/hw.h" -#include "exec/ram_addr.h" #include "qemu/error-report.h" #include "qapi/error.h" #include "trace.h" From patchwork Thu May 7 17:39:54 2020 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: 1285539 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=2001:470:142::17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=BW6xINBA; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:470:142::17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49J1996Rwqz9sSc for ; Fri, 8 May 2020 03:46:21 +1000 (AEST) Received: from localhost ([::1]:58406 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jWkbD-00069d-6O for incoming@patchwork.ozlabs.org; Thu, 07 May 2020 13:46:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58770) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWkVr-0005C3-DK for qemu-devel@nongnu.org; Thu, 07 May 2020 13:40:47 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:31724 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jWkVq-00025I-Gd for qemu-devel@nongnu.org; Thu, 07 May 2020 13:40:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588873245; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UfGg3kD91LblaJiUxEahY+a0L+gOksKbyNf7iAAUl/w=; b=BW6xINBArEs/SSbzyDHZR1SOvWbuFY/PwNqxKCsViT3BmDjj/LeEHm8osAIkrjK1Jk6liA fVDNwCVMYjJQlqlcGstUXe5v3qvTENyKtHT9D5XY58qngF9CZVJ3QhKYJjDznVslV+PNiW FBttF1ZbrqqPyrs+p4zyCqwlYX/av4s= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-469-_YpH8kkLP1WXAotjkdH5TQ-1; Thu, 07 May 2020 13:40:41 -0400 X-MC-Unique: _YpH8kkLP1WXAotjkdH5TQ-1 Received: by mail-wm1-f69.google.com with SMTP id h184so3819863wmf.5 for ; Thu, 07 May 2020 10:40:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8GZ9evEjqSbQp71zi/MCbGrxdqesaAm1q8b0adEaVIA=; b=ETHgveNAY3BmbF/Qd9YweuevFaQmBOmfe9Da3/1HjxSnqW5Nd4Q+KFgkOubT5kpT8q azWH8J7iN4rQwBJxC4SyqgrfkoWYd8xJFlYjcIAkjAocNXVx9fh2XY1H4KD1mBmq7rxr x59FYH3i3NaRGWAKj/95F3OS2ZdLHj/3TWHkIzpFu3RBasFia6ss4ho8nvaROAa6YPQE AxvhNRZfyo2e/xB2WOzfghH/iTQ+V/hJDRDV2zODr2jjXH/Pcwf9vFBeZvWyHWIS0k9+ BomSXOoQTxK9SDWBonGY6EhJIAbJqHaaDKpjKBV01yJWf8mi6Dqn/buAi0BZDb+B6vaF VDIA== X-Gm-Message-State: AGi0PuZVDRZnqyvNZcLbz9oJKQqreW4KcwlXtgQVGNKfxTAjDFh2Rv9C eJzg/JyiE8JFy9Vv35qnRfDAEPFG/drGh4pXDoiVtYanmR1kGc5abiZHbbJn2S36Wmnn1oE43B8 ZvvD2bBNWIQ9pXD4= X-Received: by 2002:a05:600c:210:: with SMTP id 16mr4544925wmi.15.1588873240732; Thu, 07 May 2020 10:40:40 -0700 (PDT) X-Google-Smtp-Source: APiQypLSBpY37naOL9t4hrxGVypcm4L6awh25/jHiKIkWfDIJaw3sqjnYKe/o6M9skN5Zo6pP3sGYg== X-Received: by 2002:a05:600c:210:: with SMTP id 16mr4544910wmi.15.1588873240502; Thu, 07 May 2020 10:40:40 -0700 (PDT) Received: from localhost.localdomain (17.red-88-21-202.staticip.rima-tde.net. [88.21.202.17]) by smtp.gmail.com with ESMTPSA id z132sm6553880wmc.29.2020.05.07.10.40.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 May 2020 10:40:39 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Peter Maydell , Paolo Bonzini , qemu-devel@nongnu.org Subject: [PATCH 06/10] exec: Move ramblock_recv_bitmap_offset() to migration/ram.c Date: Thu, 7 May 2020 19:39:54 +0200 Message-Id: <20200507173958.25894-7-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200507173958.25894-1-philmd@redhat.com> References: <20200507173958.25894-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=207.211.31.120; envelope-from=philmd@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/07 03:56:18 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN 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: Kevin Wolf , Cornelia Huck , Alex Williamson , "Michael S. Tsirkin" , qemu-block@nongnu.org, David Hildenbrand , Juan Quintela , "Dr. David Alan Gilbert" , Max Reitz , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, Keith Busch , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The ramblock_recv_bitmap_offset() function is only used once in migration/ram.c, move it there. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Juan Quintela --- include/exec/ram_addr.h | 8 -------- migration/ram.c | 8 ++++++++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h index 195b67d3c8..c61d5188f7 100644 --- a/include/exec/ram_addr.h +++ b/include/exec/ram_addr.h @@ -83,14 +83,6 @@ static inline void *ramblock_ptr(RAMBlock *block, ram_addr_t offset) return (char *)block->host + offset; } -static inline unsigned long int ramblock_recv_bitmap_offset(void *host_addr, - RAMBlock *rb) -{ - uint64_t host_addr_offset = - (uint64_t)(uintptr_t)(host_addr - (void *)rb->host); - return host_addr_offset >> TARGET_PAGE_BITS; -} - bool ramblock_is_pmem(RAMBlock *rb); /** diff --git a/migration/ram.c b/migration/ram.c index 53166fc279..0cd16d0519 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -190,6 +190,14 @@ int foreach_not_ignored_block(RAMBlockIterFunc func, void *opaque) return ret; } +static inline unsigned long int ramblock_recv_bitmap_offset(void *host_addr, + RAMBlock *rb) +{ + uint64_t host_addr_offset = + (uint64_t)(uintptr_t)(host_addr - (void *)rb->host); + return host_addr_offset >> TARGET_PAGE_BITS; +} + static void ramblock_recv_map_init(void) { RAMBlock *rb; From patchwork Thu May 7 17:39:55 2020 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: 1285534 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=2001:470:142::17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=VMzWfpUx; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:470:142::17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49J13s70RGz9sNH for ; Fri, 8 May 2020 03:41:45 +1000 (AEST) Received: from localhost ([::1]:40456 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jWkWl-0006Su-Ki for incoming@patchwork.ozlabs.org; Thu, 07 May 2020 13:41:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58800) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWkVy-0005NW-Nc for qemu-devel@nongnu.org; Thu, 07 May 2020 13:40:55 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:21343 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jWkVv-00025j-VF for qemu-devel@nongnu.org; Thu, 07 May 2020 13:40:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588873251; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2wMVmnscOvXdUUKc8eZhTz1l5c5iydmPQgIyf73d85o=; b=VMzWfpUxGPGgKvAaHy5Rl3Zb+NT9JGAfv0asxK6uSgggXmeHruvI6mqRVHj+FY6G2Bs/BW /KXjnCkUSee3488IO3zjrYDpIng8ftnI1qABfVBb+ltdxwz42nxpTt5m2xba/YUOF6GrWJ juLSlcSTqlh22cwSHfzLtojLNchbYrg= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-390-Tplu9WkLNQe-NrQ4jZZGwA-1; Thu, 07 May 2020 13:40:49 -0400 X-MC-Unique: Tplu9WkLNQe-NrQ4jZZGwA-1 Received: by mail-wm1-f70.google.com with SMTP id n127so2906780wme.4 for ; Thu, 07 May 2020 10:40:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EK0YTs2WjJpJ9cKioyfjmY5eFGfI2/p3egFVIS7vlDc=; b=jZCAZiks2Gp7ZgeUBaZS/t/PIWVxhXC4tLgJ33iQqHBmS65VR046O1p1I771wfWWhR xOMjUqIpJkq4EHxk3nmLT3h2MdQCthez3s+HB9ESJY8Ig9nYoOfhEGlBa0g5sml7+q1i 1BgjpB56wL73qJ4CmUrcZGe0gBgwCRziubEM+GK5nEiuitYzOtCz1YjzLFGDAeVivYZ5 Cmb1xo4pA3jb3Te6X8Z/iQS+rQ9/Q8heNJhKIVds9lCp7wGT9Uhxx7XAmbFU2ldi6jT+ M3esT0BzdVOxxt3Wuhr8UCmphaa4FxQiLAW1NwGXfqm4/xcA2fEEYja2PaTWw9q4qjVA vh1w== X-Gm-Message-State: AGi0Pubeh6CkOAZmePdchsQg1MSJzeZS4zepWV8cHHYEyqstPkLGkMyK iy7FW65Tx/tzutxMNrgGuR/W1G6Vj3phoOInSIUiXeBAqoRIc470Au7JUvSEoqvJl4AESoK5Zy9 5R4Kto7FhACuSE9M= X-Received: by 2002:a1c:e408:: with SMTP id b8mr11791887wmh.68.1588873247515; Thu, 07 May 2020 10:40:47 -0700 (PDT) X-Google-Smtp-Source: APiQypJNKCeLscbewHfqirCOlj1I+UwuOJ8UpyEKyRlcaEo8CwdFPVGogykaX35DBFg0PXn7Ag3RFA== X-Received: by 2002:a1c:e408:: with SMTP id b8mr11791844wmh.68.1588873246946; Thu, 07 May 2020 10:40:46 -0700 (PDT) Received: from localhost.localdomain (17.red-88-21-202.staticip.rima-tde.net. [88.21.202.17]) by smtp.gmail.com with ESMTPSA id m6sm2858835wrq.5.2020.05.07.10.40.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 May 2020 10:40:46 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Peter Maydell , Paolo Bonzini , qemu-devel@nongnu.org Subject: [PATCH 07/10] exec: Move all RAMBlock functions to 'exec/ramblock.h' Date: Thu, 7 May 2020 19:39:55 +0200 Message-Id: <20200507173958.25894-8-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200507173958.25894-1-philmd@redhat.com> References: <20200507173958.25894-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=205.139.110.120; envelope-from=philmd@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/07 03:15:48 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN 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: Kevin Wolf , Cornelia Huck , Alex Williamson , "Michael S. Tsirkin" , qemu-block@nongnu.org, David Hildenbrand , Juan Quintela , "Dr. David Alan Gilbert" , Max Reitz , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, Keith Busch , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The RAMBlock API was dispersed in 3 different headers. One of these headers, "exec/ram_addr.h", is restricted to target dependent code. However these functions are not target specific. Move all functions into a single place. Now all these functions can be accessed by target-agnostic code. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Juan Quintela Acked-by: Cornelia Huck Acked-by: David Gibson --- include/exec/cpu-common.h | 24 ------- include/exec/ram_addr.h | 105 --------------------------- include/exec/ramblock.h | 134 +++++++++++++++++++++++++++++++++++ migration/migration.h | 1 + accel/tcg/translate-all.c | 2 - hw/block/nvme.c | 2 +- hw/s390x/s390-stattrib-kvm.c | 1 - hw/s390x/s390-stattrib.c | 1 - hw/s390x/s390-virtio-ccw.c | 1 - hw/virtio/vhost-user.c | 1 + hw/virtio/vhost.c | 1 + hw/virtio/virtio-balloon.c | 1 + memory.c | 1 + migration/migration.c | 1 + migration/postcopy-ram.c | 1 + migration/savevm.c | 1 + stubs/ram-block.c | 2 +- target/ppc/kvm.c | 1 - target/s390x/kvm.c | 1 - util/vfio-helpers.c | 2 +- 20 files changed, 145 insertions(+), 139 deletions(-) diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h index b47e5630e7..347ceb603b 100644 --- a/include/exec/cpu-common.h +++ b/include/exec/cpu-common.h @@ -49,25 +49,6 @@ typedef uint32_t CPUReadMemoryFunc(void *opaque, hwaddr addr); void qemu_ram_remap(ram_addr_t addr, ram_addr_t length); /* This should not be used by devices. */ ram_addr_t qemu_ram_addr_from_host(void *ptr); -RAMBlock *qemu_ram_block_by_name(const char *name); -RAMBlock *qemu_ram_block_from_host(void *ptr, bool round_offset, - ram_addr_t *offset); -ram_addr_t qemu_ram_block_host_offset(RAMBlock *rb, void *host); -void qemu_ram_set_idstr(RAMBlock *block, const char *name, DeviceState *dev); -void qemu_ram_unset_idstr(RAMBlock *block); -const char *qemu_ram_get_idstr(RAMBlock *rb); -void *qemu_ram_get_host_addr(RAMBlock *rb); -ram_addr_t qemu_ram_get_offset(RAMBlock *rb); -ram_addr_t qemu_ram_get_used_length(RAMBlock *rb); -bool qemu_ram_is_shared(RAMBlock *rb); -bool qemu_ram_is_uf_zeroable(RAMBlock *rb); -void qemu_ram_set_uf_zeroable(RAMBlock *rb); -bool qemu_ram_is_migratable(RAMBlock *rb); -void qemu_ram_set_migratable(RAMBlock *rb); -void qemu_ram_unset_migratable(RAMBlock *rb); - -size_t qemu_ram_pagesize(RAMBlock *block); -size_t qemu_ram_pagesize_largest(void); void cpu_physical_memory_rw(hwaddr addr, void *buf, hwaddr len, bool is_write); @@ -100,11 +81,6 @@ void qemu_flush_coalesced_mmio_buffer(void); void cpu_flush_icache_range(hwaddr start, hwaddr len); -typedef int (RAMBlockIterFunc)(RAMBlock *rb, void *opaque); - -int qemu_ram_foreach_block(RAMBlockIterFunc func, void *opaque); -int ram_block_discard_range(RAMBlock *rb, uint64_t start, size_t length); - #endif #endif /* CPU_COMMON_H */ diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h index c61d5188f7..0deffad66f 100644 --- a/include/exec/ram_addr.h +++ b/include/exec/ram_addr.h @@ -26,112 +26,7 @@ #include "exec/ramlist.h" #include "exec/ramblock.h" -/** - * clear_bmap_size: calculate clear bitmap size - * - * @pages: number of guest pages - * @shift: guest page number shift - * - * Returns: number of bits for the clear bitmap - */ -static inline long clear_bmap_size(uint64_t pages, uint8_t shift) -{ - return DIV_ROUND_UP(pages, 1UL << shift); -} -/** - * clear_bmap_set: set clear bitmap for the page range - * - * @rb: the ramblock to operate on - * @start: the start page number - * @size: number of pages to set in the bitmap - * - * Returns: None - */ -static inline void clear_bmap_set(RAMBlock *rb, uint64_t start, - uint64_t npages) -{ - uint8_t shift = rb->clear_bmap_shift; - - bitmap_set_atomic(rb->clear_bmap, start >> shift, - clear_bmap_size(npages, shift)); -} - -/** - * clear_bmap_test_and_clear: test clear bitmap for the page, clear if set - * - * @rb: the ramblock to operate on - * @page: the page number to check - * - * Returns: true if the bit was set, false otherwise - */ -static inline bool clear_bmap_test_and_clear(RAMBlock *rb, uint64_t page) -{ - uint8_t shift = rb->clear_bmap_shift; - - return bitmap_test_and_clear_atomic(rb->clear_bmap, page >> shift, 1); -} - -static inline bool offset_in_ramblock(RAMBlock *b, ram_addr_t offset) -{ - return (b && b->host && offset < b->used_length) ? true : false; -} - -static inline void *ramblock_ptr(RAMBlock *block, ram_addr_t offset) -{ - assert(offset_in_ramblock(block, offset)); - return (char *)block->host + offset; -} - -bool ramblock_is_pmem(RAMBlock *rb); - -/** - * qemu_ram_alloc_from_file, - * qemu_ram_alloc_from_fd: Allocate a ram block from the specified backing - * file or device - * - * Parameters: - * @size: the size in bytes of the ram block - * @mr: the memory region where the ram block is - * @ram_flags: specify the properties of the ram block, which can be one - * or bit-or of following values - * - RAM_SHARED: mmap the backing file or device with MAP_SHARED - * - RAM_PMEM: the backend @mem_path or @fd is persistent memory - * Other bits are ignored. - * @mem_path or @fd: specify the backing file or device - * @errp: pointer to Error*, to store an error if it happens - * - * Return: - * On success, return a pointer to the ram block. - * On failure, return NULL. - */ -RAMBlock *qemu_ram_alloc_from_file(ram_addr_t size, MemoryRegion *mr, - uint32_t ram_flags, const char *mem_path, - Error **errp); -RAMBlock *qemu_ram_alloc_from_fd(ram_addr_t size, MemoryRegion *mr, - uint32_t ram_flags, int fd, - Error **errp); - -RAMBlock *qemu_ram_alloc_from_ptr(ram_addr_t size, void *host, - MemoryRegion *mr, Error **errp); -RAMBlock *qemu_ram_alloc(ram_addr_t size, bool share, MemoryRegion *mr, - Error **errp); -RAMBlock *qemu_ram_alloc_resizeable(ram_addr_t size, ram_addr_t max_size, - void (*resized)(const char*, - uint64_t length, - void *host), - MemoryRegion *mr, Error **errp); -void qemu_ram_free(RAMBlock *block); - -int qemu_ram_resize(RAMBlock *block, ram_addr_t newsize, Error **errp); - -void qemu_ram_msync(RAMBlock *block, ram_addr_t start, ram_addr_t length); - -/* Clear whole block of mem */ -static inline void qemu_ram_block_writeback(RAMBlock *block) -{ - qemu_ram_msync(block, 0, block->used_length); -} #define DIRTY_CLIENTS_ALL ((1 << DIRTY_MEMORY_NUM) - 1) #define DIRTY_CLIENTS_NOCODE (DIRTY_CLIENTS_ALL & ~(1 << DIRTY_MEMORY_CODE)) diff --git a/include/exec/ramblock.h b/include/exec/ramblock.h index 6ac0aa7a89..b6b34141fc 100644 --- a/include/exec/ramblock.h +++ b/include/exec/ramblock.h @@ -22,6 +22,7 @@ #ifndef CONFIG_USER_ONLY #include "cpu-common.h" #include "qemu/rcu.h" +#include "qemu/bitmap.h" struct RAMBlock { struct rcu_head rcu; @@ -61,5 +62,138 @@ struct RAMBlock { unsigned long *clear_bmap; uint8_t clear_bmap_shift; }; + +RAMBlock *qemu_ram_block_by_name(const char *name); +RAMBlock *qemu_ram_block_from_host(void *ptr, bool round_offset, + ram_addr_t *offset); +ram_addr_t qemu_ram_block_host_offset(RAMBlock *rb, void *host); +void qemu_ram_set_idstr(RAMBlock *block, const char *name, DeviceState *dev); +void qemu_ram_unset_idstr(RAMBlock *block); +const char *qemu_ram_get_idstr(RAMBlock *rb); +void *qemu_ram_get_host_addr(RAMBlock *rb); +ram_addr_t qemu_ram_get_offset(RAMBlock *rb); +ram_addr_t qemu_ram_get_used_length(RAMBlock *rb); +bool qemu_ram_is_shared(RAMBlock *rb); +bool qemu_ram_is_uf_zeroable(RAMBlock *rb); +void qemu_ram_set_uf_zeroable(RAMBlock *rb); +bool qemu_ram_is_migratable(RAMBlock *rb); +void qemu_ram_set_migratable(RAMBlock *rb); +void qemu_ram_unset_migratable(RAMBlock *rb); + +size_t qemu_ram_pagesize(RAMBlock *block); +size_t qemu_ram_pagesize_largest(void); + +/** + * clear_bmap_size: calculate clear bitmap size + * + * @pages: number of guest pages + * @shift: guest page number shift + * + * Returns: number of bits for the clear bitmap + */ +static inline long clear_bmap_size(uint64_t pages, uint8_t shift) +{ + return DIV_ROUND_UP(pages, 1UL << shift); +} + +/** + * clear_bmap_set: set clear bitmap for the page range + * + * @rb: the ramblock to operate on + * @start: the start page number + * @size: number of pages to set in the bitmap + * + * Returns: None + */ +static inline void clear_bmap_set(RAMBlock *rb, uint64_t start, + uint64_t npages) +{ + uint8_t shift = rb->clear_bmap_shift; + + bitmap_set_atomic(rb->clear_bmap, start >> shift, + clear_bmap_size(npages, shift)); +} + +/** + * clear_bmap_test_and_clear: test clear bitmap for the page, clear if set + * + * @rb: the ramblock to operate on + * @page: the page number to check + * + * Returns: true if the bit was set, false otherwise + */ +static inline bool clear_bmap_test_and_clear(RAMBlock *rb, uint64_t page) +{ + uint8_t shift = rb->clear_bmap_shift; + + return bitmap_test_and_clear_atomic(rb->clear_bmap, page >> shift, 1); +} + +static inline bool offset_in_ramblock(RAMBlock *b, ram_addr_t offset) +{ + return (b && b->host && offset < b->used_length) ? true : false; +} + +static inline void *ramblock_ptr(RAMBlock *block, ram_addr_t offset) +{ + assert(offset_in_ramblock(block, offset)); + return (char *)block->host + offset; +} + +bool ramblock_is_pmem(RAMBlock *rb); + +/** + * qemu_ram_alloc_from_file, + * qemu_ram_alloc_from_fd: Allocate a ram block from the specified backing + * file or device + * + * Parameters: + * @size: the size in bytes of the ram block + * @mr: the memory region where the ram block is + * @ram_flags: specify the properties of the ram block, which can be one + * or bit-or of following values + * - RAM_SHARED: mmap the backing file or device with MAP_SHARED + * - RAM_PMEM: the backend @mem_path or @fd is persistent memory + * Other bits are ignored. + * @mem_path or @fd: specify the backing file or device + * @errp: pointer to Error*, to store an error if it happens + * + * Return: + * On success, return a pointer to the ram block. + * On failure, return NULL. + */ +RAMBlock *qemu_ram_alloc_from_file(ram_addr_t size, MemoryRegion *mr, + uint32_t ram_flags, const char *mem_path, + Error **errp); +RAMBlock *qemu_ram_alloc_from_fd(ram_addr_t size, MemoryRegion *mr, + uint32_t ram_flags, int fd, + Error **errp); + +RAMBlock *qemu_ram_alloc_from_ptr(ram_addr_t size, void *host, + MemoryRegion *mr, Error **errp); +RAMBlock *qemu_ram_alloc(ram_addr_t size, bool share, MemoryRegion *mr, + Error **errp); +RAMBlock *qemu_ram_alloc_resizeable(ram_addr_t size, ram_addr_t max_size, + void (*resized)(const char*, + uint64_t length, + void *host), + MemoryRegion *mr, Error **errp); +void qemu_ram_free(RAMBlock *block); + +int qemu_ram_resize(RAMBlock *block, ram_addr_t newsize, Error **errp); + +void qemu_ram_msync(RAMBlock *block, ram_addr_t start, ram_addr_t length); + +/* Clear whole block of mem */ +static inline void qemu_ram_block_writeback(RAMBlock *block) +{ + qemu_ram_msync(block, 0, block->used_length); +} + +typedef int (RAMBlockIterFunc)(RAMBlock *rb, void *opaque); + +int qemu_ram_foreach_block(RAMBlockIterFunc func, void *opaque); +int ram_block_discard_range(RAMBlock *rb, uint64_t start, size_t length); + #endif #endif diff --git a/migration/migration.h b/migration/migration.h index 507284e563..73eb210ef5 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -21,6 +21,7 @@ #include "qemu/coroutine_int.h" #include "io/channel.h" #include "net/announce.h" +#include "exec/ramblock.h" struct PostcopyBlocktimeContext; diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 9924e66d1f..15c8ee9110 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -43,8 +43,6 @@ #include #endif #endif -#else -#include "exec/ram_addr.h" #endif #include "exec/cputlb.h" diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 21a199e53b..8d8dd7ce80 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -46,7 +46,7 @@ #include "qapi/visitor.h" #include "sysemu/hostmem.h" #include "sysemu/block-backend.h" -#include "exec/ram_addr.h" +#include "exec/ramblock.h" #include "qemu/log.h" #include "qemu/module.h" diff --git a/hw/s390x/s390-stattrib-kvm.c b/hw/s390x/s390-stattrib-kvm.c index f89d8d9d16..46ca7e7d1f 100644 --- a/hw/s390x/s390-stattrib-kvm.c +++ b/hw/s390x/s390-stattrib-kvm.c @@ -15,7 +15,6 @@ #include "hw/s390x/storage-attributes.h" #include "qemu/error-report.h" #include "sysemu/kvm.h" -#include "exec/ram_addr.h" #include "cpu.h" #include "kvm_s390x.h" diff --git a/hw/s390x/s390-stattrib.c b/hw/s390x/s390-stattrib.c index 58121b9f68..9785d51577 100644 --- a/hw/s390x/s390-stattrib.c +++ b/hw/s390x/s390-stattrib.c @@ -16,7 +16,6 @@ #include "migration/register.h" #include "hw/s390x/storage-attributes.h" #include "qemu/error-report.h" -#include "exec/ram_addr.h" #include "qapi/error.h" #include "qapi/qmp/qdict.h" diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index c009384505..ade36eda5e 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -17,7 +17,6 @@ #include "cpu.h" #include "hw/boards.h" #include "exec/address-spaces.h" -#include "exec/ram_addr.h" #include "hw/s390x/s390-virtio-hcall.h" #include "hw/s390x/sclp.h" #include "hw/s390x/s390_flic.h" diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index ec21e8fbe8..12764d6254 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -23,6 +23,7 @@ #include "sysemu/cryptodev.h" #include "migration/migration.h" #include "migration/postcopy-ram.h" +#include "exec/ramblock.h" #include "trace.h" #include diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index aff98a0ede..7da8d95a43 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -22,6 +22,7 @@ #include "qemu/memfd.h" #include "standard-headers/linux/vhost_types.h" #include "exec/address-spaces.h" +#include "exec/ramblock.h" #include "hw/virtio/virtio-bus.h" #include "hw/virtio/virtio-access.h" #include "migration/blocker.h" diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index a4729f7fc9..ea112e9403 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -23,6 +23,7 @@ #include "sysemu/balloon.h" #include "hw/virtio/virtio-balloon.h" #include "exec/address-spaces.h" +#include "exec/ramblock.h" #include "qapi/error.h" #include "qapi/qapi-events-misc.h" #include "qapi/visitor.h" diff --git a/memory.c b/memory.c index 3e65e33ac4..e8e7bcd6c7 100644 --- a/memory.c +++ b/memory.c @@ -28,6 +28,7 @@ #include "exec/memory-internal.h" #include "exec/ram_addr.h" +#include "exec/ramblock.h" #include "sysemu/kvm.h" #include "sysemu/runstate.h" #include "sysemu/tcg.h" diff --git a/migration/migration.c b/migration/migration.c index 177cce9e95..8c7ed8cc79 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -46,6 +46,7 @@ #include "qemu/thread.h" #include "trace.h" #include "exec/target_page.h" +#include "exec/ramblock.h" #include "io/channel-buffer.h" #include "migration/colo.h" #include "hw/boards.h" diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index a36402722b..78646abf7a 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -18,6 +18,7 @@ #include "qemu/osdep.h" #include "exec/target_page.h" +#include "exec/ramblock.h" #include "migration.h" #include "qemu-file.h" #include "savevm.h" diff --git a/migration/savevm.c b/migration/savevm.c index b979ea6e7f..714b5b4591 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -48,6 +48,7 @@ #include "sysemu/cpus.h" #include "exec/memory.h" #include "exec/target_page.h" +#include "exec/ramblock.h" #include "trace.h" #include "qemu/iov.h" #include "qemu/main-loop.h" diff --git a/stubs/ram-block.c b/stubs/ram-block.c index 73c0a3ee08..9e73543598 100644 --- a/stubs/ram-block.c +++ b/stubs/ram-block.c @@ -1,6 +1,6 @@ #include "qemu/osdep.h" #include "exec/ramlist.h" -#include "exec/cpu-common.h" +#include "exec/ramblock.h" void *qemu_ram_get_host_addr(RAMBlock *rb) { diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 2692f76130..1f3db517db 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -43,7 +43,6 @@ #include "trace.h" #include "exec/gdbstub.h" #include "exec/memattrs.h" -#include "exec/ram_addr.h" #include "sysemu/hostmem.h" #include "qemu/cutils.h" #include "qemu/main-loop.h" diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index 69881a0da0..42657bc0a5 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -41,7 +41,6 @@ #include "sysemu/runstate.h" #include "sysemu/device_tree.h" #include "exec/gdbstub.h" -#include "exec/ram_addr.h" #include "trace.h" #include "hw/s390x/s390-pci-inst.h" #include "hw/s390x/s390-pci-bus.h" diff --git a/util/vfio-helpers.c b/util/vfio-helpers.c index e399e330e2..2ee169da58 100644 --- a/util/vfio-helpers.c +++ b/util/vfio-helpers.c @@ -15,7 +15,7 @@ #include #include "qapi/error.h" #include "exec/ramlist.h" -#include "exec/cpu-common.h" +#include "exec/ramblock.h" #include "trace.h" #include "qemu/error-report.h" #include "standard-headers/linux/pci_regs.h" From patchwork Thu May 7 17:39:56 2020 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: 1285537 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=2001:470:142::17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=PqJIIipW; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:470:142::17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49J16V5KNLz9sNH for ; Fri, 8 May 2020 03:44:02 +1000 (AEST) Received: from localhost ([::1]:49632 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jWkYx-00024m-P4 for incoming@patchwork.ozlabs.org; Thu, 07 May 2020 13:43:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58844) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWkW3-0005Zu-Cj for qemu-devel@nongnu.org; Thu, 07 May 2020 13:40:59 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:35884 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jWkW1-0002AH-Ir for qemu-devel@nongnu.org; Thu, 07 May 2020 13:40:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588873256; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kPdxVicu969je/HHuYmc96kgT2/Tmz0/2S+LklATjmE=; b=PqJIIipWGWf/7EJ+L/UHrZjVFsu8lxM8x7ZXqSDsiHF0e+Wpda7KjljHaP55yAhS54xYK2 lmt9jc+hSjKhxxilTULdN9OQV68VaFW0DPppQ7WuhI92VdlCPv8ICj8xQUse+7Xgi4Mgrm rtkVepbvgi2+BH2WrR2LbU/0yOgzZ6o= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-254-lrKowiSqOd6NBV7cvaz--w-1; Thu, 07 May 2020 13:40:55 -0400 X-MC-Unique: lrKowiSqOd6NBV7cvaz--w-1 Received: by mail-ej1-f69.google.com with SMTP id jp4so3191733ejb.20 for ; Thu, 07 May 2020 10:40:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GU+pb8s4KCPhcsiRUlvVEDRxp1DqtYppL7zwVgzuzEQ=; b=f3mPDOdQJ50rQOHGlLSIcF5KkaNhehB7oaueuS3eRWPnnalyWCPAgYDnzXwgnGFoR8 ydm8Wd1Thr8fAUPLH6HB0cRT5A3Q1GfoL7P9XTASyu1kFsfzlPO84pxIh2C33BVw3WHX YXtoOSzVE6PrqSOl56G513jXsC2hKCO4S5xYNdVSluwBCvWQvGCErGWw4XGNPONfNC2+ 94Kd/IY/hiRB/hc0xDvlxTDf3Z7QsyBZaV1v2N2xcCZR2QBGnp7h4+moqZlxqjDlIn/N AbufFONaQ8TKkWJnxsVFXErXZ7eR7rddWgxVKJT4xIr5PGf2DsJF+pqCu0j3gjIUOAPA Q2Sw== X-Gm-Message-State: AGi0PuauHb6Mz2fXuZP+541E8cZK+hcYqDofhVCN8hWMKnGWMTbSp8yj jua+HeG1rmCUu36YtTTLHGP2hGD707HzN4Lh+TI4CHrcs3fg/M+DgAC4hPpGjyx3+yB9H4U6qRe SH0cODgcP2Qvdzuw= X-Received: by 2002:a17:906:2d4a:: with SMTP id e10mr13560855eji.222.1588873253598; Thu, 07 May 2020 10:40:53 -0700 (PDT) X-Google-Smtp-Source: APiQypJSzp8FrllgoD8AfFcqANwT/r92S58QUd+F/AuoUVq6Oym4Bc4+UQvyW+kuojt0+IflWUrAUw== X-Received: by 2002:a17:906:2d4a:: with SMTP id e10mr13560841eji.222.1588873253422; Thu, 07 May 2020 10:40:53 -0700 (PDT) Received: from localhost.localdomain (17.red-88-21-202.staticip.rima-tde.net. [88.21.202.17]) by smtp.gmail.com with ESMTPSA id bu4sm606672edb.90.2020.05.07.10.40.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 May 2020 10:40:52 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Peter Maydell , Paolo Bonzini , qemu-devel@nongnu.org Subject: [PATCH 08/10] hw/block: Let the NVMe emulated device be target-agnostic Date: Thu, 7 May 2020 19:39:56 +0200 Message-Id: <20200507173958.25894-9-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200507173958.25894-1-philmd@redhat.com> References: <20200507173958.25894-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=205.139.110.120; envelope-from=philmd@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/07 03:15:48 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN 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: Kevin Wolf , Cornelia Huck , Alex Williamson , "Michael S. Tsirkin" , qemu-block@nongnu.org, David Hildenbrand , Juan Quintela , "Dr. David Alan Gilbert" , Max Reitz , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, Keith Busch , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Now than qemu_ram_msync() has been ... Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Juan Quintela --- hw/block/Makefile.objs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/block/Makefile.objs b/hw/block/Makefile.objs index 47960b5f0d..8855c22656 100644 --- a/hw/block/Makefile.objs +++ b/hw/block/Makefile.objs @@ -13,6 +13,6 @@ common-obj-$(CONFIG_SH4) += tc58128.o obj-$(CONFIG_VIRTIO_BLK) += virtio-blk.o obj-$(CONFIG_VHOST_USER_BLK) += vhost-user-blk.o -obj-$(CONFIG_NVME_PCI) += nvme.o +common-obj-$(CONFIG_NVME_PCI) += nvme.o obj-y += dataplane/ From patchwork Thu May 7 17:39:57 2020 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: 1285540 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=2001:470:142::17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=SqfzoUyB; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:470:142::17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49J1B14dpgz9sPF for ; Fri, 8 May 2020 03:47:05 +1000 (AEST) Received: from localhost ([::1]:60446 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jWkbv-00070H-Az for incoming@patchwork.ozlabs.org; Thu, 07 May 2020 13:47:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59116) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWkX7-0008O5-UK for qemu-devel@nongnu.org; Thu, 07 May 2020 13:42:05 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:33561 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jWkX6-0002iC-TX for qemu-devel@nongnu.org; Thu, 07 May 2020 13:42:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588873324; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=a0F6ldTOd8VBTvynMaD5KXJRN63vFzeEfQeG4bxiOT0=; b=SqfzoUyB8uSoXuB79zskW9FqokzilEIcSWyElXmqM+IPIZVjhmn5ka7KgI0lspQ85bvHtO GosvvbgAj3cnhoN7cmHXHXvG7oEoC5ZvR2D7oRI2zOxcJVvoVWhXuF05Vt3Dt6ODc9HJLc SuY48HvhHtEbOhJ0xJ6Mk9e1z5N77Gs= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-474-OOhdLuMnN6i88QPVjipWjA-1; Thu, 07 May 2020 13:42:02 -0400 X-MC-Unique: OOhdLuMnN6i88QPVjipWjA-1 Received: by mail-wr1-f71.google.com with SMTP id p8so3865036wrj.5 for ; Thu, 07 May 2020 10:42:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=L2IryXDavM4F6hNiL5uGphYz9XWPkFL2dN/mkNIfy2I=; b=B93oqm1z0UrWy68iiJh5c+SECepkW2uYHAd/9m2E0mDS+g9AlM3zVAPjuY8hAWVVa1 XQ4Di73JLapHkmEEjNVhmEYmdjOseAkBSKnCLBXOd/vpMAcFGHjfij5VAuUX5eh541FV i8ZvliXICWyG10kTxolmfWqMU4ZmHpFLtOJVhmMbORwlHzDSTwyOBAQbrXf2L1KIkNbL Tky3GsWJ+OuWwxQndTbx5fmE5K0LwMaGHSeYWNRQ9rct04vhKht8HehxlqsppEeD7diB RGSuS/RenBDR+ajDCYWjtodFRcIQ7EYQhePelK6GofAOOYUVFka2yCml3yPDigh6BivI bhow== X-Gm-Message-State: AGi0PuY/utM/qxaYxWc+lZppKM6cUdGQxBZBlH/+nLtUDBrXN/sWvINh J1G/gctAJfljGD4sM44Fyrvz3K9cvw1LTK4dsHzUAxMTd6pLlSKH+57OD3+0jO+uWgdsf5+5OAM NHx7O5dUVLoXnmYc= X-Received: by 2002:adf:e8c4:: with SMTP id k4mr16063870wrn.209.1588873320737; Thu, 07 May 2020 10:42:00 -0700 (PDT) X-Google-Smtp-Source: APiQypJIHd5xsiLMMK2BzwSmY5On55OLx9kYf3R0jmh8d4ZLvAY3P/ejD7CzHKZ3d5OGk5MyJ2W+0A== X-Received: by 2002:adf:e8c4:: with SMTP id k4mr16063857wrn.209.1588873320555; Thu, 07 May 2020 10:42:00 -0700 (PDT) Received: from localhost.localdomain (17.red-88-21-202.staticip.rima-tde.net. [88.21.202.17]) by smtp.gmail.com with ESMTPSA id q14sm9428007wrc.66.2020.05.07.10.41.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 May 2020 10:42:00 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Peter Maydell , Paolo Bonzini , qemu-devel@nongnu.org Subject: [PATCH 09/10] exec: Update coding style to make checkpatch.pl happy Date: Thu, 7 May 2020 19:39:57 +0200 Message-Id: <20200507173958.25894-10-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200507173958.25894-1-philmd@redhat.com> References: <20200507173958.25894-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=205.139.110.61; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/07 02:00:54 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: Kevin Wolf , Cornelia Huck , Alex Williamson , "Michael S. Tsirkin" , qemu-block@nongnu.org, David Hildenbrand , Juan Quintela , "Dr. David Alan Gilbert" , Max Reitz , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, Keith Busch , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" We will move this code in the next commit. Clean it up first to avoid checkpatch.pl errors. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Juan Quintela --- include/exec/ram_addr.h | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h index 0deffad66f..6acde47a0f 100644 --- a/include/exec/ram_addr.h +++ b/include/exec/ram_addr.h @@ -95,7 +95,8 @@ static inline bool cpu_physical_memory_all_dirty(ram_addr_t start, while (page < end) { unsigned long next = MIN(end, base + DIRTY_MEMORY_BLOCK_SIZE); unsigned long num = next - base; - unsigned long found = find_next_zero_bit(blocks->blocks[idx], num, offset); + unsigned long found = find_next_zero_bit(blocks->blocks[idx], + num, offset); if (found < num) { dirty = false; break; @@ -120,14 +121,14 @@ static inline bool cpu_physical_memory_is_clean(ram_addr_t addr) { bool vga = cpu_physical_memory_get_dirty_flag(addr, DIRTY_MEMORY_VGA); bool code = cpu_physical_memory_get_dirty_flag(addr, DIRTY_MEMORY_CODE); - bool migration = - cpu_physical_memory_get_dirty_flag(addr, DIRTY_MEMORY_MIGRATION); + bool migration = cpu_physical_memory_get_dirty_flag(addr, + DIRTY_MEMORY_MIGRATION); return !(vga && code && migration); } static inline uint8_t cpu_physical_memory_range_includes_clean(ram_addr_t start, - ram_addr_t length, - uint8_t mask) + ram_addr_t length, + uint8_t mask) { uint8_t ret = 0; @@ -272,7 +273,8 @@ static inline void cpu_physical_memory_set_dirty_lebitmap(unsigned long *bitmap, xen_hvm_modified_memory(start, pages << TARGET_PAGE_BITS); } else { - uint8_t clients = tcg_enabled() ? DIRTY_CLIENTS_ALL : DIRTY_CLIENTS_NOCODE; + uint8_t clients = tcg_enabled() + ? DIRTY_CLIENTS_ALL : DIRTY_CLIENTS_NOCODE; if (!global_dirty_log) { clients &= ~(1 << DIRTY_MEMORY_MIGRATION); @@ -304,8 +306,11 @@ bool cpu_physical_memory_test_and_clear_dirty(ram_addr_t start, ram_addr_t length, unsigned client); -DirtyBitmapSnapshot *cpu_physical_memory_snapshot_and_clear_dirty - (MemoryRegion *mr, hwaddr offset, hwaddr length, unsigned client); +DirtyBitmapSnapshot *cpu_physical_memory_snapshot_and_clear_dirty( + MemoryRegion *mr, + hwaddr offset, + hwaddr length, + unsigned client); bool cpu_physical_memory_snapshot_get_dirty(DirtyBitmapSnapshot *snap, ram_addr_t start, @@ -314,7 +319,8 @@ bool cpu_physical_memory_snapshot_get_dirty(DirtyBitmapSnapshot *snap, static inline void cpu_physical_memory_clear_dirty_range(ram_addr_t start, ram_addr_t length) { - cpu_physical_memory_test_and_clear_dirty(start, length, DIRTY_MEMORY_MIGRATION); + cpu_physical_memory_test_and_clear_dirty(start, length, + DIRTY_MEMORY_MIGRATION); cpu_physical_memory_test_and_clear_dirty(start, length, DIRTY_MEMORY_VGA); cpu_physical_memory_test_and_clear_dirty(start, length, DIRTY_MEMORY_CODE); } From patchwork Thu May 7 17:39:58 2020 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: 1285543 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=2001:470:142::17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=C9VFsVns; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:470:142::17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49J1GH6yYTz9sNH for ; Fri, 8 May 2020 03:50:47 +1000 (AEST) Received: from localhost ([::1]:39336 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jWkfW-0001fg-1S for incoming@patchwork.ozlabs.org; Thu, 07 May 2020 13:50:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59200) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWkXm-0000Kq-1E for qemu-devel@nongnu.org; Thu, 07 May 2020 13:42:46 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:56840 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jWkXi-0002rT-L6 for qemu-devel@nongnu.org; Thu, 07 May 2020 13:42:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588873341; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=70NlWPfiuzNDwJ1WClI9QnQALFzv92OS+bgBk12LGJk=; b=C9VFsVnsBNsIzKpiquQ/7dzAdorYRRu52ICjJ4C31fYITZ3wzsQ4eqcEvxyowqeo7ETqIx m/E/+VgxigPJNuuPyHbikU+pzKKuY16suGpbrTPFWrpiWfPmYT1rf/l5rzpzZX0ZZ4Prv2 VNBusBYECbx73fYys+N4osqOOW7ugI0= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-330-8s4yPCVWOCKFTffhx9qYJw-1; Thu, 07 May 2020 13:42:09 -0400 X-MC-Unique: 8s4yPCVWOCKFTffhx9qYJw-1 Received: by mail-wm1-f71.google.com with SMTP id 71so2915657wmb.8 for ; Thu, 07 May 2020 10:42:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3iNLy+87ImRK1vCCpmPAQkeNS9aRnVSHDrrD8jMf/sk=; b=rQiXPmYKG7YMhDLX9w2oH5CavaEtk1VnogUzjjtWrWUUdxGidNumbSYT60BLFNtDsA sd9ZKesoeP7/Goaqf/ot0QDkvxFy/h6VGz2DjkihmsPeiHgqSgKPLJ6EoB/xpZMFT6sk dtUYkF8wKHtA0dxnrqFJxMlUu26iRMGwqF6DH2YR2SA/xyXCPexnHSWp/5CkM2HyTa3V 4Gd56mw7svykS2ySUSyl8qNEDvuHtP+62L1/BjS03SA0xGT6RIM9PW2WT5kM6oFF8Ea2 WmtMIav6sKPqAYWzu3szoEMF6Qm3X7Yl4x2ffMhbwfRTTmqmJjaxbThU8v+1gXISwJNn knrg== X-Gm-Message-State: AGi0PuZt+Kla4ZQljAzVSHt0ysuu5Rm4f/w+I1DdAgC4A3NdPmpoIhnG PTYSaURGy5sTuii3HSxx8CSzx6yGAgxiYlO9BT+Q2LGD5RSUY9omcwu/RxzoRiWJSNf250knoWU DpqQPdusNBLUjT4k= X-Received: by 2002:a05:600c:210b:: with SMTP id u11mr12291402wml.133.1588873327448; Thu, 07 May 2020 10:42:07 -0700 (PDT) X-Google-Smtp-Source: APiQypLbBY+ERloxY8NihCRunMVoMUh90zAydeWklGiK1gIKek9UL4Kq17oOgjkSawmvFr+8N9WaVw== X-Received: by 2002:a05:600c:210b:: with SMTP id u11mr12291349wml.133.1588873326876; Thu, 07 May 2020 10:42:06 -0700 (PDT) Received: from localhost.localdomain (17.red-88-21-202.staticip.rima-tde.net. [88.21.202.17]) by smtp.gmail.com with ESMTPSA id t16sm9142379wrm.26.2020.05.07.10.42.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 May 2020 10:42:06 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Peter Maydell , Paolo Bonzini , qemu-devel@nongnu.org Subject: [PATCH 10/10] exec: Move cpu_physical_memory_* functions to 'exec/memory-internal.h' Date: Thu, 7 May 2020 19:39:58 +0200 Message-Id: <20200507173958.25894-11-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200507173958.25894-1-philmd@redhat.com> References: <20200507173958.25894-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=205.139.110.120; envelope-from=philmd@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/07 03:15:48 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN 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: Kevin Wolf , Cornelia Huck , Alex Williamson , "Michael S. Tsirkin" , qemu-block@nongnu.org, David Hildenbrand , Juan Quintela , "Dr. David Alan Gilbert" , Max Reitz , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, Keith Busch , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Philippe Mathieu-Daudé Acked-by: David Gibson --- include/exec/memory-internal.h | 305 ++++++++++++++++++++++++++++++++- include/exec/ram_addr.h | 303 +------------------------------- accel/tcg/cputlb.c | 1 - hw/ppc/spapr.c | 1 - hw/ppc/spapr_pci.c | 1 - memory.c | 1 - 6 files changed, 305 insertions(+), 307 deletions(-) diff --git a/include/exec/memory-internal.h b/include/exec/memory-internal.h index b2b7c1e78a..4abb3bbd85 100644 --- a/include/exec/memory-internal.h +++ b/include/exec/memory-internal.h @@ -21,8 +21,13 @@ #define MEMORY_INTERNAL_H #include "cpu.h" +#include "sysemu/tcg.h" +#include "sysemu/xen.h" +#include "exec/ramlist.h" +#include "exec/ramblock.h" #ifdef CONFIG_SOFTMMU + static inline AddressSpaceDispatch *flatview_to_dispatch(FlatView *fv) { return fv->dispatch; @@ -49,5 +54,303 @@ void address_space_dispatch_free(AddressSpaceDispatch *d); void mtree_print_dispatch(struct AddressSpaceDispatch *d, MemoryRegion *root); -#endif + +#define DIRTY_CLIENTS_ALL ((1 << DIRTY_MEMORY_NUM) - 1) +#define DIRTY_CLIENTS_NOCODE (DIRTY_CLIENTS_ALL & ~(1 << DIRTY_MEMORY_CODE)) + +static inline bool cpu_physical_memory_get_dirty(ram_addr_t start, + ram_addr_t length, + unsigned client) +{ + DirtyMemoryBlocks *blocks; + unsigned long end, page; + unsigned long idx, offset, base; + bool dirty = false; + + assert(client < DIRTY_MEMORY_NUM); + + end = TARGET_PAGE_ALIGN(start + length) >> TARGET_PAGE_BITS; + page = start >> TARGET_PAGE_BITS; + + WITH_RCU_READ_LOCK_GUARD() { + blocks = atomic_rcu_read(&ram_list.dirty_memory[client]); + + idx = page / DIRTY_MEMORY_BLOCK_SIZE; + offset = page % DIRTY_MEMORY_BLOCK_SIZE; + base = page - offset; + while (page < end) { + unsigned long next = MIN(end, base + DIRTY_MEMORY_BLOCK_SIZE); + unsigned long num = next - base; + unsigned long found = find_next_bit(blocks->blocks[idx], + num, offset); + if (found < num) { + dirty = true; + break; + } + + page = next; + idx++; + offset = 0; + base += DIRTY_MEMORY_BLOCK_SIZE; + } + } + + return dirty; +} + +static inline bool cpu_physical_memory_all_dirty(ram_addr_t start, + ram_addr_t length, + unsigned client) +{ + DirtyMemoryBlocks *blocks; + unsigned long end, page; + unsigned long idx, offset, base; + bool dirty = true; + + assert(client < DIRTY_MEMORY_NUM); + + end = TARGET_PAGE_ALIGN(start + length) >> TARGET_PAGE_BITS; + page = start >> TARGET_PAGE_BITS; + + RCU_READ_LOCK_GUARD(); + + blocks = atomic_rcu_read(&ram_list.dirty_memory[client]); + + idx = page / DIRTY_MEMORY_BLOCK_SIZE; + offset = page % DIRTY_MEMORY_BLOCK_SIZE; + base = page - offset; + while (page < end) { + unsigned long next = MIN(end, base + DIRTY_MEMORY_BLOCK_SIZE); + unsigned long num = next - base; + unsigned long found = find_next_zero_bit(blocks->blocks[idx], + num, offset); + if (found < num) { + dirty = false; + break; + } + + page = next; + idx++; + offset = 0; + base += DIRTY_MEMORY_BLOCK_SIZE; + } + + return dirty; +} + +static inline bool cpu_physical_memory_get_dirty_flag(ram_addr_t addr, + unsigned client) +{ + return cpu_physical_memory_get_dirty(addr, 1, client); +} + +static inline bool cpu_physical_memory_is_clean(ram_addr_t addr) +{ + bool vga = cpu_physical_memory_get_dirty_flag(addr, DIRTY_MEMORY_VGA); + bool code = cpu_physical_memory_get_dirty_flag(addr, DIRTY_MEMORY_CODE); + bool migration = cpu_physical_memory_get_dirty_flag(addr, + DIRTY_MEMORY_MIGRATION); + return !(vga && code && migration); +} + +static inline uint8_t cpu_physical_memory_range_includes_clean(ram_addr_t start, + ram_addr_t length, + uint8_t mask) +{ + uint8_t ret = 0; + + if (mask & (1 << DIRTY_MEMORY_VGA) && + !cpu_physical_memory_all_dirty(start, length, DIRTY_MEMORY_VGA)) { + ret |= (1 << DIRTY_MEMORY_VGA); + } + if (mask & (1 << DIRTY_MEMORY_CODE) && + !cpu_physical_memory_all_dirty(start, length, DIRTY_MEMORY_CODE)) { + ret |= (1 << DIRTY_MEMORY_CODE); + } + if (mask & (1 << DIRTY_MEMORY_MIGRATION) && + !cpu_physical_memory_all_dirty(start, length, DIRTY_MEMORY_MIGRATION)) { + ret |= (1 << DIRTY_MEMORY_MIGRATION); + } + return ret; +} + +static inline void cpu_physical_memory_set_dirty_flag(ram_addr_t addr, + unsigned client) +{ + unsigned long page, idx, offset; + DirtyMemoryBlocks *blocks; + + assert(client < DIRTY_MEMORY_NUM); + + page = addr >> TARGET_PAGE_BITS; + idx = page / DIRTY_MEMORY_BLOCK_SIZE; + offset = page % DIRTY_MEMORY_BLOCK_SIZE; + + RCU_READ_LOCK_GUARD(); + + blocks = atomic_rcu_read(&ram_list.dirty_memory[client]); + + set_bit_atomic(offset, blocks->blocks[idx]); +} + +static inline void cpu_physical_memory_set_dirty_range(ram_addr_t start, + ram_addr_t length, + uint8_t mask) +{ + DirtyMemoryBlocks *blocks[DIRTY_MEMORY_NUM]; + unsigned long end, page; + unsigned long idx, offset, base; + int i; + + if (!mask && !xen_enabled()) { + return; + } + + end = TARGET_PAGE_ALIGN(start + length) >> TARGET_PAGE_BITS; + page = start >> TARGET_PAGE_BITS; + + WITH_RCU_READ_LOCK_GUARD() { + for (i = 0; i < DIRTY_MEMORY_NUM; i++) { + blocks[i] = atomic_rcu_read(&ram_list.dirty_memory[i]); + } + + idx = page / DIRTY_MEMORY_BLOCK_SIZE; + offset = page % DIRTY_MEMORY_BLOCK_SIZE; + base = page - offset; + while (page < end) { + unsigned long next = MIN(end, base + DIRTY_MEMORY_BLOCK_SIZE); + + if (likely(mask & (1 << DIRTY_MEMORY_MIGRATION))) { + bitmap_set_atomic(blocks[DIRTY_MEMORY_MIGRATION]->blocks[idx], + offset, next - page); + } + if (unlikely(mask & (1 << DIRTY_MEMORY_VGA))) { + bitmap_set_atomic(blocks[DIRTY_MEMORY_VGA]->blocks[idx], + offset, next - page); + } + if (unlikely(mask & (1 << DIRTY_MEMORY_CODE))) { + bitmap_set_atomic(blocks[DIRTY_MEMORY_CODE]->blocks[idx], + offset, next - page); + } + + page = next; + idx++; + offset = 0; + base += DIRTY_MEMORY_BLOCK_SIZE; + } + } + + xen_hvm_modified_memory(start, length); +} + +#if !defined(_WIN32) +static inline void cpu_physical_memory_set_dirty_lebitmap(unsigned long *bitmap, + ram_addr_t start, + ram_addr_t pages) +{ + unsigned long i, j; + unsigned long page_number, c; + hwaddr addr; + ram_addr_t ram_addr; + unsigned long len = (pages + HOST_LONG_BITS - 1) / HOST_LONG_BITS; + unsigned long hpratio = qemu_real_host_page_size / TARGET_PAGE_SIZE; + unsigned long page = BIT_WORD(start >> TARGET_PAGE_BITS); + + /* start address is aligned at the start of a word? */ + if ((((page * BITS_PER_LONG) << TARGET_PAGE_BITS) == start) && + (hpratio == 1)) { + unsigned long **blocks[DIRTY_MEMORY_NUM]; + unsigned long idx; + unsigned long offset; + long k; + long nr = BITS_TO_LONGS(pages); + + idx = (start >> TARGET_PAGE_BITS) / DIRTY_MEMORY_BLOCK_SIZE; + offset = BIT_WORD((start >> TARGET_PAGE_BITS) % + DIRTY_MEMORY_BLOCK_SIZE); + + WITH_RCU_READ_LOCK_GUARD() { + for (i = 0; i < DIRTY_MEMORY_NUM; i++) { + blocks[i] = atomic_rcu_read(&ram_list.dirty_memory[i])->blocks; + } + + for (k = 0; k < nr; k++) { + if (bitmap[k]) { + unsigned long temp = leul_to_cpu(bitmap[k]); + + atomic_or(&blocks[DIRTY_MEMORY_VGA][idx][offset], temp); + + if (global_dirty_log) { + atomic_or(&blocks[DIRTY_MEMORY_MIGRATION][idx][offset], + temp); + } + + if (tcg_enabled()) { + atomic_or(&blocks[DIRTY_MEMORY_CODE][idx][offset], + temp); + } + } + + if (++offset >= BITS_TO_LONGS(DIRTY_MEMORY_BLOCK_SIZE)) { + offset = 0; + idx++; + } + } + } + + xen_hvm_modified_memory(start, pages << TARGET_PAGE_BITS); + } else { + uint8_t clients = tcg_enabled() ? DIRTY_CLIENTS_ALL + : DIRTY_CLIENTS_NOCODE; + + if (!global_dirty_log) { + clients &= ~(1 << DIRTY_MEMORY_MIGRATION); + } + + /* + * bitmap-traveling is faster than memory-traveling (for addr...) + * especially when most of the memory is not dirty. + */ + for (i = 0; i < len; i++) { + if (bitmap[i] != 0) { + c = leul_to_cpu(bitmap[i]); + do { + j = ctzl(c); + c &= ~(1ul << j); + page_number = (i * HOST_LONG_BITS + j) * hpratio; + addr = page_number * TARGET_PAGE_SIZE; + ram_addr = start + addr; + cpu_physical_memory_set_dirty_range(ram_addr, + TARGET_PAGE_SIZE * hpratio, clients); + } while (c != 0); + } + } + } +} +#endif /* not _WIN32 */ + +bool cpu_physical_memory_test_and_clear_dirty(ram_addr_t start, + ram_addr_t length, + unsigned client); + +DirtyBitmapSnapshot *cpu_physical_memory_snapshot_and_clear_dirty( + MemoryRegion *mr, + hwaddr offset, + hwaddr length, + unsigned client); + +bool cpu_physical_memory_snapshot_get_dirty(DirtyBitmapSnapshot *snap, + ram_addr_t start, + ram_addr_t length); + +static inline void cpu_physical_memory_clear_dirty_range(ram_addr_t start, + ram_addr_t length) +{ + cpu_physical_memory_test_and_clear_dirty(start, length, + DIRTY_MEMORY_MIGRATION); + cpu_physical_memory_test_and_clear_dirty(start, length, DIRTY_MEMORY_VGA); + cpu_physical_memory_test_and_clear_dirty(start, length, DIRTY_MEMORY_CODE); +} + +#endif /* CONFIG_SOFTMMU */ #endif diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h index 6acde47a0f..64bf28a332 100644 --- a/include/exec/ram_addr.h +++ b/include/exec/ram_addr.h @@ -21,310 +21,9 @@ #ifndef CONFIG_USER_ONLY #include "cpu.h" -#include "sysemu/xen.h" -#include "sysemu/tcg.h" #include "exec/ramlist.h" #include "exec/ramblock.h" - - - -#define DIRTY_CLIENTS_ALL ((1 << DIRTY_MEMORY_NUM) - 1) -#define DIRTY_CLIENTS_NOCODE (DIRTY_CLIENTS_ALL & ~(1 << DIRTY_MEMORY_CODE)) - -static inline bool cpu_physical_memory_get_dirty(ram_addr_t start, - ram_addr_t length, - unsigned client) -{ - DirtyMemoryBlocks *blocks; - unsigned long end, page; - unsigned long idx, offset, base; - bool dirty = false; - - assert(client < DIRTY_MEMORY_NUM); - - end = TARGET_PAGE_ALIGN(start + length) >> TARGET_PAGE_BITS; - page = start >> TARGET_PAGE_BITS; - - WITH_RCU_READ_LOCK_GUARD() { - blocks = atomic_rcu_read(&ram_list.dirty_memory[client]); - - idx = page / DIRTY_MEMORY_BLOCK_SIZE; - offset = page % DIRTY_MEMORY_BLOCK_SIZE; - base = page - offset; - while (page < end) { - unsigned long next = MIN(end, base + DIRTY_MEMORY_BLOCK_SIZE); - unsigned long num = next - base; - unsigned long found = find_next_bit(blocks->blocks[idx], - num, offset); - if (found < num) { - dirty = true; - break; - } - - page = next; - idx++; - offset = 0; - base += DIRTY_MEMORY_BLOCK_SIZE; - } - } - - return dirty; -} - -static inline bool cpu_physical_memory_all_dirty(ram_addr_t start, - ram_addr_t length, - unsigned client) -{ - DirtyMemoryBlocks *blocks; - unsigned long end, page; - unsigned long idx, offset, base; - bool dirty = true; - - assert(client < DIRTY_MEMORY_NUM); - - end = TARGET_PAGE_ALIGN(start + length) >> TARGET_PAGE_BITS; - page = start >> TARGET_PAGE_BITS; - - RCU_READ_LOCK_GUARD(); - - blocks = atomic_rcu_read(&ram_list.dirty_memory[client]); - - idx = page / DIRTY_MEMORY_BLOCK_SIZE; - offset = page % DIRTY_MEMORY_BLOCK_SIZE; - base = page - offset; - while (page < end) { - unsigned long next = MIN(end, base + DIRTY_MEMORY_BLOCK_SIZE); - unsigned long num = next - base; - unsigned long found = find_next_zero_bit(blocks->blocks[idx], - num, offset); - if (found < num) { - dirty = false; - break; - } - - page = next; - idx++; - offset = 0; - base += DIRTY_MEMORY_BLOCK_SIZE; - } - - return dirty; -} - -static inline bool cpu_physical_memory_get_dirty_flag(ram_addr_t addr, - unsigned client) -{ - return cpu_physical_memory_get_dirty(addr, 1, client); -} - -static inline bool cpu_physical_memory_is_clean(ram_addr_t addr) -{ - bool vga = cpu_physical_memory_get_dirty_flag(addr, DIRTY_MEMORY_VGA); - bool code = cpu_physical_memory_get_dirty_flag(addr, DIRTY_MEMORY_CODE); - bool migration = cpu_physical_memory_get_dirty_flag(addr, - DIRTY_MEMORY_MIGRATION); - return !(vga && code && migration); -} - -static inline uint8_t cpu_physical_memory_range_includes_clean(ram_addr_t start, - ram_addr_t length, - uint8_t mask) -{ - uint8_t ret = 0; - - if (mask & (1 << DIRTY_MEMORY_VGA) && - !cpu_physical_memory_all_dirty(start, length, DIRTY_MEMORY_VGA)) { - ret |= (1 << DIRTY_MEMORY_VGA); - } - if (mask & (1 << DIRTY_MEMORY_CODE) && - !cpu_physical_memory_all_dirty(start, length, DIRTY_MEMORY_CODE)) { - ret |= (1 << DIRTY_MEMORY_CODE); - } - if (mask & (1 << DIRTY_MEMORY_MIGRATION) && - !cpu_physical_memory_all_dirty(start, length, DIRTY_MEMORY_MIGRATION)) { - ret |= (1 << DIRTY_MEMORY_MIGRATION); - } - return ret; -} - -static inline void cpu_physical_memory_set_dirty_flag(ram_addr_t addr, - unsigned client) -{ - unsigned long page, idx, offset; - DirtyMemoryBlocks *blocks; - - assert(client < DIRTY_MEMORY_NUM); - - page = addr >> TARGET_PAGE_BITS; - idx = page / DIRTY_MEMORY_BLOCK_SIZE; - offset = page % DIRTY_MEMORY_BLOCK_SIZE; - - RCU_READ_LOCK_GUARD(); - - blocks = atomic_rcu_read(&ram_list.dirty_memory[client]); - - set_bit_atomic(offset, blocks->blocks[idx]); -} - -static inline void cpu_physical_memory_set_dirty_range(ram_addr_t start, - ram_addr_t length, - uint8_t mask) -{ - DirtyMemoryBlocks *blocks[DIRTY_MEMORY_NUM]; - unsigned long end, page; - unsigned long idx, offset, base; - int i; - - if (!mask && !xen_enabled()) { - return; - } - - end = TARGET_PAGE_ALIGN(start + length) >> TARGET_PAGE_BITS; - page = start >> TARGET_PAGE_BITS; - - WITH_RCU_READ_LOCK_GUARD() { - for (i = 0; i < DIRTY_MEMORY_NUM; i++) { - blocks[i] = atomic_rcu_read(&ram_list.dirty_memory[i]); - } - - idx = page / DIRTY_MEMORY_BLOCK_SIZE; - offset = page % DIRTY_MEMORY_BLOCK_SIZE; - base = page - offset; - while (page < end) { - unsigned long next = MIN(end, base + DIRTY_MEMORY_BLOCK_SIZE); - - if (likely(mask & (1 << DIRTY_MEMORY_MIGRATION))) { - bitmap_set_atomic(blocks[DIRTY_MEMORY_MIGRATION]->blocks[idx], - offset, next - page); - } - if (unlikely(mask & (1 << DIRTY_MEMORY_VGA))) { - bitmap_set_atomic(blocks[DIRTY_MEMORY_VGA]->blocks[idx], - offset, next - page); - } - if (unlikely(mask & (1 << DIRTY_MEMORY_CODE))) { - bitmap_set_atomic(blocks[DIRTY_MEMORY_CODE]->blocks[idx], - offset, next - page); - } - - page = next; - idx++; - offset = 0; - base += DIRTY_MEMORY_BLOCK_SIZE; - } - } - - xen_hvm_modified_memory(start, length); -} - -#if !defined(_WIN32) -static inline void cpu_physical_memory_set_dirty_lebitmap(unsigned long *bitmap, - ram_addr_t start, - ram_addr_t pages) -{ - unsigned long i, j; - unsigned long page_number, c; - hwaddr addr; - ram_addr_t ram_addr; - unsigned long len = (pages + HOST_LONG_BITS - 1) / HOST_LONG_BITS; - unsigned long hpratio = qemu_real_host_page_size / TARGET_PAGE_SIZE; - unsigned long page = BIT_WORD(start >> TARGET_PAGE_BITS); - - /* start address is aligned at the start of a word? */ - if ((((page * BITS_PER_LONG) << TARGET_PAGE_BITS) == start) && - (hpratio == 1)) { - unsigned long **blocks[DIRTY_MEMORY_NUM]; - unsigned long idx; - unsigned long offset; - long k; - long nr = BITS_TO_LONGS(pages); - - idx = (start >> TARGET_PAGE_BITS) / DIRTY_MEMORY_BLOCK_SIZE; - offset = BIT_WORD((start >> TARGET_PAGE_BITS) % - DIRTY_MEMORY_BLOCK_SIZE); - - WITH_RCU_READ_LOCK_GUARD() { - for (i = 0; i < DIRTY_MEMORY_NUM; i++) { - blocks[i] = atomic_rcu_read(&ram_list.dirty_memory[i])->blocks; - } - - for (k = 0; k < nr; k++) { - if (bitmap[k]) { - unsigned long temp = leul_to_cpu(bitmap[k]); - - atomic_or(&blocks[DIRTY_MEMORY_VGA][idx][offset], temp); - - if (global_dirty_log) { - atomic_or(&blocks[DIRTY_MEMORY_MIGRATION][idx][offset], - temp); - } - - if (tcg_enabled()) { - atomic_or(&blocks[DIRTY_MEMORY_CODE][idx][offset], - temp); - } - } - - if (++offset >= BITS_TO_LONGS(DIRTY_MEMORY_BLOCK_SIZE)) { - offset = 0; - idx++; - } - } - } - - xen_hvm_modified_memory(start, pages << TARGET_PAGE_BITS); - } else { - uint8_t clients = tcg_enabled() - ? DIRTY_CLIENTS_ALL : DIRTY_CLIENTS_NOCODE; - - if (!global_dirty_log) { - clients &= ~(1 << DIRTY_MEMORY_MIGRATION); - } - - /* - * bitmap-traveling is faster than memory-traveling (for addr...) - * especially when most of the memory is not dirty. - */ - for (i = 0; i < len; i++) { - if (bitmap[i] != 0) { - c = leul_to_cpu(bitmap[i]); - do { - j = ctzl(c); - c &= ~(1ul << j); - page_number = (i * HOST_LONG_BITS + j) * hpratio; - addr = page_number * TARGET_PAGE_SIZE; - ram_addr = start + addr; - cpu_physical_memory_set_dirty_range(ram_addr, - TARGET_PAGE_SIZE * hpratio, clients); - } while (c != 0); - } - } - } -} -#endif /* not _WIN32 */ - -bool cpu_physical_memory_test_and_clear_dirty(ram_addr_t start, - ram_addr_t length, - unsigned client); - -DirtyBitmapSnapshot *cpu_physical_memory_snapshot_and_clear_dirty( - MemoryRegion *mr, - hwaddr offset, - hwaddr length, - unsigned client); - -bool cpu_physical_memory_snapshot_get_dirty(DirtyBitmapSnapshot *snap, - ram_addr_t start, - ram_addr_t length); - -static inline void cpu_physical_memory_clear_dirty_range(ram_addr_t start, - ram_addr_t length) -{ - cpu_physical_memory_test_and_clear_dirty(start, length, - DIRTY_MEMORY_MIGRATION); - cpu_physical_memory_test_and_clear_dirty(start, length, DIRTY_MEMORY_VGA); - cpu_physical_memory_test_and_clear_dirty(start, length, DIRTY_MEMORY_CODE); -} - +#include "exec/memory-internal.h" /* Called with RCU critical section */ static inline diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index e3b5750c3b..922671f246 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -26,7 +26,6 @@ #include "exec/cpu_ldst.h" #include "exec/cputlb.h" #include "exec/memory-internal.h" -#include "exec/ram_addr.h" #include "tcg/tcg.h" #include "qemu/error-report.h" #include "exec/log.h" diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index c18eab0a23..d7c3bf3932 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -69,7 +69,6 @@ #include "hw/virtio/vhost-scsi-common.h" #include "exec/address-spaces.h" -#include "exec/ram_addr.h" #include "hw/usb.h" #include "qemu/config-file.h" #include "qemu/error-report.h" diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index 61b84a392d..8d9aeba6e6 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -36,7 +36,6 @@ #include "hw/ppc/spapr.h" #include "hw/pci-host/spapr.h" #include "exec/address-spaces.h" -#include "exec/ram_addr.h" #include #include "trace.h" #include "qemu/error-report.h" diff --git a/memory.c b/memory.c index e8e7bcd6c7..4e1d19c5fc 100644 --- a/memory.c +++ b/memory.c @@ -27,7 +27,6 @@ #include "trace-root.h" #include "exec/memory-internal.h" -#include "exec/ram_addr.h" #include "exec/ramblock.h" #include "sysemu/kvm.h" #include "sysemu/runstate.h"