From nobody Sat Feb 7 07:12:10 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588919309; cv=none; d=zohomail.com; s=zohoarc; b=bvwZEyxA+DNuGjJmw+W6uInjmFTr3MoTdhXMyqGB9bUIqm/gCBU78MNxeNoqDNkUnkiBF+4v/idu6FoU4tksj1IqAO/Rr5X/e0z88+wuI7CQ2sB0jUwvoKjPT/yi25miMXZlRPDNC16BcRlE0078wIUFKb+THiMmaMDkjVm0qvQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588919309; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=qfS14LJEpOzY6PX3UrAqMHPU323E/PoXkpCr/b9ynrI=; b=CG86XTWN3D8Jnz4xPsCdqeON++77qSzNhFZrvKYDxSKi1JrsNcrrnxzzVzs8Fmdu0P4YdSsYLvDYn+isjtCO41v6j4FN8aPzKZpxsEdN8MVF/z1X+wFkmt0fl171rtlKwDi6gC+h4ap6gUdhJhdlA66uWIgEYNIhHyNXVg5bNPM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1588919309177633.4472366252564; Thu, 7 May 2020 23:28:29 -0700 (PDT) Received: from localhost ([::1]:46556 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jWwUk-0002Gv-VV for importer@patchew.org; Fri, 08 May 2020 02:28:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45846) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWwRb-0006JU-Cv for qemu-devel@nongnu.org; Fri, 08 May 2020 02:25:11 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:49247 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 1jWwRa-0001M3-98 for qemu-devel@nongnu.org; Fri, 08 May 2020 02:25:11 -0400 Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-1-PHToQnYdNHCo4tSrH2Rfcw-1; Fri, 08 May 2020 02:25:08 -0400 Received: by mail-wr1-f69.google.com with SMTP id f15so402544wrj.2 for ; Thu, 07 May 2020 23:25: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 w18sm1304743wro.33.2020.05.07.23.25.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 May 2020 23:25:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588919109; 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=qfS14LJEpOzY6PX3UrAqMHPU323E/PoXkpCr/b9ynrI=; b=RwtSieZvzaVn1yN88Y6wDfHoBwh+etUpgg7qa0/HjT4eNdCl26zuUS6rLuCQOmgFxANa7j khyJGhJKJ08sWfkjM5Yq1+21jbqGCCcsGL76KcyXYfD0LWy27nC1YGVSQT2c6wPnksYHMJ 5K0upoSMj4qVg61aH9g1qAaMSz9/C5Y= X-MC-Unique: PHToQnYdNHCo4tSrH2Rfcw-1 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=QtFWs4BxQJZYmga34DJ69kEprWz+1I1FCi2dNjcpyyQ=; b=YOa/JoYPwAEOoHJw+JwwbIkYQ/9fPEfabF0fN766CzHaSFLGsp8eqo39AfOlQDccps VYTwE+qlzMQIDFY5OOSctoBdqIsz4yCf1wAdv02mvzsplwRZCOjtnitAy9KOXJx6M0v8 C+qgPDsZh74UC0l7jtrHxFF0c8Sv2n66TsAPOjH03qKCniY8ymmF2gf/jjbZfRoC9MOB 3ASR+QVq/KaTXZFirWnZmrbu7NUO46X6a7i1LnEnX24wWPcTzIeKYk+Gf4Mmvs4RTTeB BMxfwcakN6dE5q8inAG1lijJwYLNPZJTJQVfb4oDzpuNJeFYiGANR0xLwuVfHpAUeAfu IPgQ== X-Gm-Message-State: AGi0PuY97oGz4uBZ+K6FflHuOd9qAdPrEYUCp5UZeSVi5EJ1QE4EhjuY nyfZFI+fx8Qa5PsHmhfpBjxV7b8SNh8ExBCBUckH0PTqoxfUulBoitHQkVbDJ4i5SQM09mB5k0u b4hGj2KQKiuqYMKw= X-Received: by 2002:a1c:8094:: with SMTP id b142mr1182404wmd.61.1588919105848; Thu, 07 May 2020 23:25:05 -0700 (PDT) X-Google-Smtp-Source: APiQypIqeXAJW3AWL3zXCLwWFgpEGhKvp4glTtjV0jZlpsYrscbMVm/0s36scgQzMwv6oEgiNDOYiw== X-Received: by 2002:a1c:8094:: with SMTP id b142mr1182374wmd.61.1588919105605; Thu, 07 May 2020 23:25:05 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 1/4] memory: Rename memory_region_do_writeback -> memory_region_writeback Date: Fri, 8 May 2020 08:24:53 +0200 Message-Id: <20200508062456.23344-2-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200508062456.23344-1-philmd@redhat.com> References: <20200508062456.23344-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=philmd@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/08 01:34:54 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 , Peter Maydell , Beata Michalska , qemu-block@nongnu.org, Max Reitz , qemu-arm@nongnu.org, Keith Busch , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" We usually use '_do_' for internal functions. Rename memory_region_do_writeback() as memory_region_writeback(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Paolo Bonzini Reviewed-by: Richard Henderson Reviewed-by: Stefan Hajnoczi --- include/exec/memory.h | 4 ++-- memory.c | 2 +- target/arm/helper.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/exec/memory.h b/include/exec/memory.h index e000bd2f97..1b7cfdd5b6 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -1474,14 +1474,14 @@ void *memory_region_get_ram_ptr(MemoryRegion *mr); void memory_region_ram_resize(MemoryRegion *mr, ram_addr_t newsize, Error **errp); /** - * memory_region_do_writeback: Trigger cache writeback or msync for + * memory_region_writeback: Trigger cache writeback or msync for * selected address range * * @mr: the memory region to be updated * @addr: the initial address of the range to be written back * @size: the size of the range to be written back */ -void memory_region_do_writeback(MemoryRegion *mr, hwaddr addr, hwaddr size= ); +void memory_region_writeback(MemoryRegion *mr, hwaddr addr, hwaddr size); =20 /** * memory_region_set_log: Turn dirty logging on or off for a region. diff --git a/memory.c b/memory.c index 601b749906..aa1f807392 100644 --- a/memory.c +++ b/memory.c @@ -2198,7 +2198,7 @@ void memory_region_ram_resize(MemoryRegion *mr, ram_a= ddr_t newsize, Error **errp } =20 =20 -void memory_region_do_writeback(MemoryRegion *mr, hwaddr addr, hwaddr size) +void memory_region_writeback(MemoryRegion *mr, hwaddr addr, hwaddr size) { /* * Might be extended case needed to cover diff --git a/target/arm/helper.c b/target/arm/helper.c index a94f650795..c4710b7371 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -6829,7 +6829,7 @@ static void dccvap_writefn(CPUARMState *env, const AR= MCPRegInfo *opaque, mr =3D memory_region_from_host(haddr, &offset); =20 if (mr) { - memory_region_do_writeback(mr, offset, dline_size); + memory_region_writeback(mr, offset, dline_size); } } } --=20 2.21.3 From nobody Sat Feb 7 07:12:10 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588919415; cv=none; d=zohomail.com; s=zohoarc; b=ROwBCTFaC4SgholiJdZwQZyW8ArCpfasf+DFTaFIDIjPEuA+Zf2UJrrOygMx0FKnJGHc+G15WIrXr2/4m8sZZEHkIJL9LxeCsVVmxvgKT8xdR3zH3hTLzQt6Cqu7BHuKEH1fNRt8qbHnQB9xWxdOT2uHYd9pbHsSHAPOGtuRoWk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588919415; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=mGx/dTXfQHoDJmnNnl9rdEL+ySusKrZpYaooZdERTQg=; b=k65ZyfDBk/xKisJZ9dBilN11ghnXF147pXPKYmmOJqX+f5v5tZ+q0WSuRNYGnzmn7jy4s8siqHnStvJ7Ha2IBQVZT4S20/vQigQ47v9a+mo4rYT0sravCN0xCPjnl1UTgtz7o9wCyroLi8c9DES+quXU7A2urEn0nWFTj5iZ8hQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1588919415632357.0387794041028; Thu, 7 May 2020 23:30:15 -0700 (PDT) Received: from localhost ([::1]:51670 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jWwWU-0004k3-Cn for importer@patchew.org; Fri, 08 May 2020 02:30:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45906) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWwRg-0006SM-Mb for qemu-devel@nongnu.org; Fri, 08 May 2020 02:25:16 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:58564 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 1jWwRe-0001h9-QE for qemu-devel@nongnu.org; Fri, 08 May 2020 02:25:16 -0400 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-263-NhC79XY4OyW93NE3AQnDKw-1; Fri, 08 May 2020 02:25:12 -0400 Received: by mail-wr1-f71.google.com with SMTP id f15so402643wrj.2 for ; Thu, 07 May 2020 23:25:12 -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 d133sm12809537wmc.27.2020.05.07.23.25.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 May 2020 23:25:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588919114; 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=mGx/dTXfQHoDJmnNnl9rdEL+ySusKrZpYaooZdERTQg=; b=BKIisuaKYe0PYc+XvzEbVYiUqybncWaUOhKQh6zjPSScFnSb4xgzBrDofYuUIKzOzIWMiw zzfqv+zXY8mcNVtiP7ndsOocUb9pEz+I2pinM+IcYek+vhp49985J2l8W2bfo3ItCMs78W LHmAg6QzcBakMwaWmHBDALqAPwN0xww= X-MC-Unique: NhC79XY4OyW93NE3AQnDKw-1 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=s/X92jlC3Vu/v6alIjmmIBaqm0/vlTOTw1XjNVQ1CnQ=; b=m6riHbtLX/Z9+ujcHpFBtMpCB2tKvJR6xbsHrBgD75Dwm3jFV398jizAwc5R4FMyXe scoCkoroeJ7jEFQBR8KHlJXLJ8GsdXIY5ieEVa7FTP7VcpRu8KaIH3ZrbFPgHveUFZUK rR34sQtTI32GisIAFQVx6npUFCPinNPLqDLDeRxj+mpSlE7GXjzaNAxL1xiiuVkudms/ BFuJFQRwmqRVXo6twdmC0Tl847sLFfuty4p+tyqcAI0RFhzn3BexFEo6EadGKLq0A2hv JvL2DLXJnAxN/3pWyIUYIdgw5KrLUlpyX40sMWCO7BRcm0INd8aWETPyWRfTKa3ygxV8 FgnA== X-Gm-Message-State: AGi0PubBHBedBAMznqsC97qoQOdLUuMiUVubRTwlsbk2vx+CE+7bI4l2 KHPsDLljfPyBAik9DIalWSNU0R+SaeX30SMzZ2J34UEwUMJKFsA+gjFB9shBinZUL9ozDtB06vr 3GVBrTyQIdThbjaU= X-Received: by 2002:a1c:f20f:: with SMTP id s15mr13518165wmc.114.1588919111425; Thu, 07 May 2020 23:25:11 -0700 (PDT) X-Google-Smtp-Source: APiQypKG+jByhoJa2rNmgaiOzpS2j8i/K0jzYHYuLh89Xei6Bq3IR/j+HlAueJ3oIAVYd02tC9eSfA== X-Received: by 2002:a1c:f20f:: with SMTP id s15mr13518139wmc.114.1588919111241; Thu, 07 May 2020 23:25:11 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 2/4] memory: Extract memory_region_msync() from memory_region_writeback() Date: Fri, 8 May 2020 08:24:54 +0200 Message-Id: <20200508062456.23344-3-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200508062456.23344-1-philmd@redhat.com> References: <20200508062456.23344-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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/08 01:34:54 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 , Peter Maydell , Beata Michalska , qemu-block@nongnu.org, Max Reitz , qemu-arm@nongnu.org, Keith Busch , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" Suggested-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Paolo Bonzini Reviewed-by: Stefan Hajnoczi --- include/exec/memory.h | 13 ++++++++++++- memory.c | 10 ++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/include/exec/memory.h b/include/exec/memory.h index 1b7cfdd5b6..3e00cdbbfa 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -1473,8 +1473,19 @@ void *memory_region_get_ram_ptr(MemoryRegion *mr); */ void memory_region_ram_resize(MemoryRegion *mr, ram_addr_t newsize, Error **errp); + /** - * memory_region_writeback: Trigger cache writeback or msync for + * memory_region_msync: Synchronize selected address range of + * a memory mapped region + * + * @mr: the memory region to be msync + * @addr: the initial address of the range to be sync + * @size: the size of the range to be sync + */ +void memory_region_msync(MemoryRegion *mr, hwaddr addr, hwaddr size); + +/** + * memory_region_writeback: Trigger cache writeback for * selected address range * * @mr: the memory region to be updated diff --git a/memory.c b/memory.c index aa1f807392..ed26514c89 100644 --- a/memory.c +++ b/memory.c @@ -2197,6 +2197,12 @@ void memory_region_ram_resize(MemoryRegion *mr, ram_= addr_t newsize, Error **errp qemu_ram_resize(mr->ram_block, newsize, errp); } =20 +void memory_region_msync(MemoryRegion *mr, hwaddr addr, hwaddr size) +{ + if (mr->ram_block) { + qemu_ram_writeback(mr->ram_block, addr, size); + } +} =20 void memory_region_writeback(MemoryRegion *mr, hwaddr addr, hwaddr size) { @@ -2204,8 +2210,8 @@ void memory_region_writeback(MemoryRegion *mr, hwaddr= addr, hwaddr size) * Might be extended case needed to cover * different types of memory regions */ - if (mr->ram_block && mr->dirty_log_mask) { - qemu_ram_writeback(mr->ram_block, addr, size); + if (mr->dirty_log_mask) { + memory_region_msync(mr, addr, size); } } =20 --=20 2.21.3 From nobody Sat Feb 7 07:12:10 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588919194; cv=none; d=zohomail.com; s=zohoarc; b=PMJ2bUwni2Rd9n19n5x2JPmfC2LyWNWC9YhPs8fB/eLxHKKc8vGlYKTUjcJtaD6npz9IYj/Dk5lIS3yDgGL53KsHhbzn+kftn8jOuQnzv0/MIRS98AHVtTrGygDZUjUDd+RX/iGbOcR2oQp+BJaPdmdO6kwv6Re1Xp7vuRQkyiA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588919194; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=87P32Kl/23kk0D1p3Mn+1uBjkyslr+Glpw+ZqggV/4k=; b=VQ613+VKHqJOEHlXDuFkvbnjYd/rawFX8pZ2EP1LUTi3SdKy1PNJurKlE8yAD9p108xQVQfsC42hUYi/EJCO3CqF7NNkpjzzvhtVfdwHQKjQTDD+ng3iVaewjnI3P+tKjhP2y6/pBEYhsI8RxR81meyjmBKAXqRoymwut/wLHsQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1588919194282893.6950024393951; Thu, 7 May 2020 23:26:34 -0700 (PDT) Received: from localhost ([::1]:40574 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jWwSu-0008Fc-WC for importer@patchew.org; Fri, 08 May 2020 02:26:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45972) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWwRl-0006ci-Qm for qemu-devel@nongnu.org; Fri, 08 May 2020 02:25:21 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:44607 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 1jWwRl-0002Cx-1D for qemu-devel@nongnu.org; Fri, 08 May 2020 02:25:21 -0400 Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-494-Aski_cZ8NaGOZtokLAxvvA-1; Fri, 08 May 2020 02:25:18 -0400 Received: by mail-wr1-f72.google.com with SMTP id a12so404385wrv.3 for ; Thu, 07 May 2020 23:25:18 -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 a8sm1241280wrg.85.2020.05.07.23.25.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 May 2020 23:25:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588919120; 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=87P32Kl/23kk0D1p3Mn+1uBjkyslr+Glpw+ZqggV/4k=; b=fG33HLfx+uldlo6dO5WMOGEAUFN2/MxBFgBTjmY1rh7aZIA51s+mNl8qeczWwvXlKBOKzM pB9wuiKT+UmUxG0shfJSSxF7iy7Dt69afxT1LdwhPdIMsxRxNDOlIvW7tBUr/PXSn5NMvY XGiW35KjlPs91WoEJUNL7jrhMPWOWMg= X-MC-Unique: Aski_cZ8NaGOZtokLAxvvA-1 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=msg2yf/FEYiTLrt9QncWwUsE+vw2haTQYPoKbGwSl1Y=; b=aA5+LMGK/Z2z2u8CgkBCFe98lRSju24ePuPCyQpKt0zXJwjqtfrlSl6bdZjtX8wfpv x356vQEpupfgZL3wbakSesrzJXH8bmaZu9Xn0r00bhIiJbAncTE8FCKMc+/M4KXE1vj0 xEHrv7v6GxnwDl665I81RF5LjuYEdT75qUlk9ySorSXLRNQkFwPUW4D9HsGjgtpdUFCF kVsB443MoUCta0O1koa8NbLcNbpmhuGxxow1sTra1J46KWwkfjYmNeuQL2L9gta3vQKJ hPSHqHKjAtX9LaPiDs1MZr8c96g0Y3tITtVKsbdMVFoT3IQoJ5nFVomgHeTFKuochOF6 4O5Q== X-Gm-Message-State: AGi0PuZvPidmzJvIAMb6Tcf5XZb3m4aIS74SxXWyyC/RNo2LXXhP74+9 Zy68Rx4m7ZRecAqW9QDr1174l4rKgifG3Zx1KgbAyZxRonCiVv+S8zcoZ/+FO3t6LU1GhBcWcN0 qVXgm0y5RnxipFWQ= X-Received: by 2002:a1c:b684:: with SMTP id g126mr13615161wmf.163.1588919116995; Thu, 07 May 2020 23:25:16 -0700 (PDT) X-Google-Smtp-Source: APiQypI0Fdhu6oSUk9BPDVZ+GA/sMq60b8qUgC2N/TaNDzcyZU4XbdbPHWVc9XayCa43CM0Jb2uCIA== X-Received: by 2002:a1c:b684:: with SMTP id g126mr13615147wmf.163.1588919116818; Thu, 07 May 2020 23:25:16 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 3/4] hw/block: Let the NVMe emulated device be target-agnostic Date: Fri, 8 May 2020 08:24:55 +0200 Message-Id: <20200508062456.23344-4-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200508062456.23344-1-philmd@redhat.com> References: <20200508062456.23344-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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/08 02:25:09 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 , Peter Maydell , Beata Michalska , qemu-block@nongnu.org, Max Reitz , qemu-arm@nongnu.org, Keith Busch , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" Now than the non-target specific memory_region_msync() function is available, use it to make this device target-agnostic. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Paolo Bonzini Reviewed-by: Richard Henderson Reviewed-by: Stefan Hajnoczi --- hw/block/nvme.c | 6 ++---- hw/block/Makefile.objs | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 9b453423cf..8a72dce0e6 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -46,8 +46,7 @@ #include "qapi/visitor.h" #include "sysemu/hostmem.h" #include "sysemu/block-backend.h" -#include "exec/ram_addr.h" - +#include "exec/memory.h" #include "qemu/log.h" #include "qemu/module.h" #include "qemu/cutils.h" @@ -1207,8 +1206,7 @@ static uint64_t nvme_mmio_read(void *opaque, hwaddr a= ddr, unsigned size) */ if (addr =3D=3D 0xE08 && (NVME_PMRCAP_PMRWBM(n->bar.pmrcap) & 0x02)) { - qemu_ram_writeback(n->pmrdev->mr.ram_block, - 0, n->pmrdev->size); + memory_region_msync(&n->pmrdev->mr, 0, n->pmrdev->size); } memcpy(&val, ptr + addr, size); } else { 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) +=3D tc58128.o =20 obj-$(CONFIG_VIRTIO_BLK) +=3D virtio-blk.o obj-$(CONFIG_VHOST_USER_BLK) +=3D vhost-user-blk.o -obj-$(CONFIG_NVME_PCI) +=3D nvme.o +common-obj-$(CONFIG_NVME_PCI) +=3D nvme.o =20 obj-y +=3D dataplane/ --=20 2.21.3 From nobody Sat Feb 7 07:12:10 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588919218; cv=none; d=zohomail.com; s=zohoarc; b=R10cS8aw0gTFeXXKOGJDFD5gD4vEPjSVlYXuAOyhfaUUiDbO6ZyVNq7PGg8qDokCg9ODpVgViHA8xxbeRsTh3mSG7D1V2yp6H8YpetTcdgHnNF9/b7FxBpLYyPDM9p0ASd30D8pqwHSFxaEAfFpACiYFIjLlXEeHoL5HoQ9Btjw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588919218; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jABb93jnf06aFYSZrFeMKGq+pUGDAbmy7wJOT/FLnWI=; b=GqW7SmFqPN9ZfmNT0fm2JU7uaE85u1X4S7znPEnDkoENXXTrCb0yJd3OW3haEY6Z/jkbj+Z6min8jobgiCA6vqcsDeifwihO3VK4uUrtEUeHIP3xdC7PJMuRibHNNtPH/pF9szK2DUTwyFGmj0OcAtziJi69Sif4+17fmgJfrJA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1588919218241963.3394838416102; Thu, 7 May 2020 23:26:58 -0700 (PDT) Received: from localhost ([::1]:41070 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jWwTG-0008SF-QN for importer@patchew.org; Fri, 08 May 2020 02:26:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46042) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWwRs-0006uS-6Q for qemu-devel@nongnu.org; Fri, 08 May 2020 02:25:28 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:47657 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 1jWwRr-00037U-At for qemu-devel@nongnu.org; Fri, 08 May 2020 02:25:27 -0400 Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-68-5lSuAZzfPb6u8V5YQyt7Ww-1; Fri, 08 May 2020 02:25:24 -0400 Received: by mail-wr1-f69.google.com with SMTP id z8so397078wrp.7 for ; Thu, 07 May 2020 23:25:24 -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 2sm1285382wre.25.2020.05.07.23.25.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 May 2020 23:25:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588919126; 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=jABb93jnf06aFYSZrFeMKGq+pUGDAbmy7wJOT/FLnWI=; b=D5grgjS6g36SkUJtrhxeOKBhvSCVyqj1TXnOS/yZwwW/l8TIgljzZ7mqknWF/VdKV1pbAg hUBPR8t3kzT7qIZpQ45AcxnvF0u8EAjHugd9ygANb79sS+Yy3KGsY3ljX0yge/kvZIOKNI RikZo/LeL/2LSUf2lu4ixg/sKHzJ704= X-MC-Unique: 5lSuAZzfPb6u8V5YQyt7Ww-1 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=TSdVo+LU87TLn9AYvDXpWQkhTwEUTRlE7YuWCo3SWO4=; b=SH+Pf6CvkXPFxID99ru1Z+19bbyenaBV2Pnle+yEy4ILVvnAEFfANxT/gd2NQyWips H6nWgqV+lOzXR6KIq0dK5ulrrVQXc0AT21u+WjnzHI/LoeotsgQsV5pgTIVLUUuAXbB/ LT5c6oGWyQ1pEgOB+YSJRJUB3fB2JHb0M9NY6RW9xpradEEkj/IUKCJMo9XpZMlehpLm tyXA7RsfQqFQaUX34/b/X71vT0nJ/PPf0W5lC/eVqwBrxp+JURg0p2BmZZMbVk8lcdhd GelVy5wjr8HsTE6UY7c97zL/uIHscVNzqUTMsvjMaiw27QQAuZ4tfBTKUeKI/tCWF/jN Dtsw== X-Gm-Message-State: AGi0PuY8gQmP60wLBmIcvJ1HgTLYd4WK1hV/NNv25mCvxffuFCgQY+kY 7wVgvRn48/soZ1xqCAWv4PWMnPLj0sVfEeA2cmuSvW0s/HfNwCBQ6lPNTdnP7Rzp/edMOd5yzjW YbUaIZtI/fQzfUs8= X-Received: by 2002:a7b:cdf7:: with SMTP id p23mr14560639wmj.33.1588919122781; Thu, 07 May 2020 23:25:22 -0700 (PDT) X-Google-Smtp-Source: APiQypLqCvwe/spb2EYWgnfHW42djTTYSHr7lHYmF+couh1fbP85RPJEalR/uCw/69KQrWxfdJM1SA== X-Received: by 2002:a7b:cdf7:: with SMTP id p23mr14560612wmj.33.1588919122559; Thu, 07 May 2020 23:25:22 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 4/4] exec: Rename qemu_ram_writeback() as qemu_ram_msync() Date: Fri, 8 May 2020 08:24:56 +0200 Message-Id: <20200508062456.23344-5-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200508062456.23344-1-philmd@redhat.com> References: <20200508062456.23344-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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/08 02:25:09 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 , Peter Maydell , Beata Michalska , qemu-block@nongnu.org, Max Reitz , qemu-arm@nongnu.org, Stefan Hajnoczi , Keith Busch , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" Rename qemu_ram_writeback() as qemu_ram_msync() to better match what it does. Suggested-by: Stefan Hajnoczi Signed-off-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Paolo Bonzini Reviewed-by: Richard Henderson Reviewed-by: Stefan Hajnoczi --- include/exec/ram_addr.h | 4 ++-- exec.c | 2 +- memory.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h index a94809f89b..84817e19fa 100644 --- a/include/exec/ram_addr.h +++ b/include/exec/ram_addr.h @@ -136,12 +136,12 @@ void qemu_ram_free(RAMBlock *block); =20 int qemu_ram_resize(RAMBlock *block, ram_addr_t newsize, Error **errp); =20 -void qemu_ram_writeback(RAMBlock *block, ram_addr_t start, ram_addr_t leng= th); +void qemu_ram_msync(RAMBlock *block, ram_addr_t start, ram_addr_t length); =20 /* 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); } =20 #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 newsi= ze, 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 leng= th) +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) <=3D block->used_length); diff --git a/memory.c b/memory.c index ed26514c89..352b0a3aa8 100644 --- a/memory.c +++ b/memory.c @@ -2200,7 +2200,7 @@ void memory_region_ram_resize(MemoryRegion *mr, ram_a= ddr_t newsize, Error **errp void memory_region_msync(MemoryRegion *mr, hwaddr addr, hwaddr size) { if (mr->ram_block) { - qemu_ram_writeback(mr->ram_block, addr, size); + qemu_ram_msync(mr->ram_block, addr, size); } } =20 --=20 2.21.3