From nobody Sun May 19 16:31:30 2024 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=1589185139; cv=none; d=zohomail.com; s=zohoarc; b=Lzto0Vt7ZBegEleoJG5yj4uEhUSjh0zVG8JYz2tWsM8js1+bwtezyjlDFelh0HRzfy5SCL6zxcrBNCip0iXvV6cdRJNfEGEfDD/MgTIZvaokakLpavAXpgupMXsyJFoMi2f4EY8lU2NoVFNDCV0dqa5WyTrDjR0oofhFKyTtEsg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589185139; 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=+fMs+TwjNvZEraJaaspwuJO6dVzcXbnuMZr1UsCS+CM=; b=eWJJ7DT+Bl/cYJu8IMPAXdmEUzewCBpg4CWvE/mLiKYo315vkJdtMa/AG+AM0jbLVTds4v6LNmXpKs65gRjVrnC9IEeRKf2qsgIaBtlfqZgNOj3MmHCQJnZIg88Tz7jIx6rO/9OvHgD+1kmT1o34hA+q+XWhTHi/W1PDshhjHXc= 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 1589185139141671.4609895562504; Mon, 11 May 2020 01:18:59 -0700 (PDT) Received: from localhost ([::1]:57810 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jY3eL-00056S-TW for importer@patchew.org; Mon, 11 May 2020 04:18:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56838) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jY3cy-0002qD-R9 for qemu-devel@nongnu.org; Mon, 11 May 2020 04:17:32 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:21645 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 1jY3cy-0002mY-5b for qemu-devel@nongnu.org; Mon, 11 May 2020 04:17:32 -0400 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-100-WXtdgJhPMZa9QtaQ1Vjn-Q-1; Mon, 11 May 2020 04:17:28 -0400 Received: by mail-wm1-f69.google.com with SMTP id h6so7952602wmi.7 for ; Mon, 11 May 2020 01:17:27 -0700 (PDT) Received: from x1w.redhat.com (17.red-88-21-202.staticip.rima-tde.net. [88.21.202.17]) by smtp.gmail.com with ESMTPSA id z22sm24828742wma.20.2020.05.11.01.17.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 May 2020 01:17:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589185051; 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=+fMs+TwjNvZEraJaaspwuJO6dVzcXbnuMZr1UsCS+CM=; b=SFwVbt/7W8k1CkwCfEd022vC9Q1laoyFsqwkkLPsE05SqbIuN7ZtpDgs1tvXOkPIYV6C3d 6APtYzErHQlvUIDxpEjFA3VOlAkb7VZ+E+IDb8A0cbFCZQPtKh/uS75kLoAoCRDcbLRY/M Fn42K3p+k75/40HsuImt8MPhXixm6aE= X-MC-Unique: WXtdgJhPMZa9QtaQ1Vjn-Q-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=+fMs+TwjNvZEraJaaspwuJO6dVzcXbnuMZr1UsCS+CM=; b=MR0mOdoh1M9jbQe5/Qebofd8b0Rwz9Z5Jic75EiQZFc1sWFTKKIz//lm7mSBSIqFzq MDWFEQ1VVxxtHhZr0xUh/N52B5eTAzIleFrNumT8GX/LNur4mqDNGauZKGtBuCe45x/J BtczJst2bobnni02DHMEXleStJYg/9DnS393VaggqcAOVCqJ4fVH+Zi7u6BF5dNT91OT L8x8m8Di/e4xS0KM+ALIDFxU9ANo+JkA9v7eFFUPEd2yYrVIHbNw5v9Np8RM2t7wNzxX Yc8+cKYzjPfiqdPY2IbwlJYWYDEFjVgMcovmMeu6hxH5qXkK4k8OFk9AJ93DT/XXreaC 6reg== X-Gm-Message-State: AGi0PubVF513QosbejmgojfzME4dOXvD+AT6fL5reBdIaiuNe2QGHCUn VYFLKE/Zppsgoe0meZMdDO2CSJ5EsRn1F7lumjwAhgZxwhCchLhyLLCOUawr3pv+ZzGedrTOdzu aQ7qp+dGYeRaAtXU= X-Received: by 2002:a1c:4b0e:: with SMTP id y14mr2991810wma.170.1589185046525; Mon, 11 May 2020 01:17:26 -0700 (PDT) X-Google-Smtp-Source: APiQypIn0Y/28d5DxPAhNDphSVBi5qhiHQW7Kx7b9TJdKXTsNzqKUVijBVzE0idKRUD9nudyAmwxaQ== X-Received: by 2002:a1c:4b0e:: with SMTP id y14mr2991788wma.170.1589185046328; Mon, 11 May 2020 01:17:26 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 1/4] memory: Simplify memory_region_do_writeback() Date: Mon, 11 May 2020 10:17:16 +0200 Message-Id: <20200511081719.31641-2-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200511081719.31641-1-philmd@redhat.com> References: <20200511081719.31641-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" 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/11 00:05:06 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 , 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) mr->dirty_log_mask tells if dirty tracking has been enabled, not if the page is dirty. It would always be true during live migration and when running on TCG, but otherwise it would always be false. As the value of mr->dirty_log_mask does not matter, remove the check. Cc: Beata Michalska Suggested-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/memory.c b/memory.c index 601b749906..fd5c3af535 100644 --- a/memory.c +++ b/memory.c @@ -2204,7 +2204,7 @@ void memory_region_do_writeback(MemoryRegion *mr, hwa= ddr addr, hwaddr size) * Might be extended case needed to cover * different types of memory regions */ - if (mr->ram_block && mr->dirty_log_mask) { + if (mr->ram_block) { qemu_ram_writeback(mr->ram_block, addr, size); } } --=20 2.21.3 From nobody Sun May 19 16:31:30 2024 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=1589185211; cv=none; d=zohomail.com; s=zohoarc; b=NTXw59znVnWySChKb7tEjTXNORpPPBHPlcADot6LRnGyAOLW08DEqStZLlWPYqHtT6Ext4PZzuTD3JAhKu0rEAChZuE8BWEMoMu0DQC8RXFVnbUN5zvNqTe2Axpis42GZw+wb1+QxNEI7KTNNfZAjuIj6SgEpUi2DIku1mTcaR8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589185211; 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=l8Kgyc/BsfqlAUuKAX2iSr9cLPvOmA/twzAvloj+tAk=; b=bHprjQgLXZTHkSd2zk9C6XjXNo6Yy2F6Xgct/UtO2SLKdLsd/zIjQSC81CjbOU9ug2sjGHDaSGmcs14ih6lgPfboFUBrawOgYhhcrWqdEETarnX9QWkDSH8nnBMsh43ZTsR7CSO89yodopD4pE18H48YUDvVQHlCmQyQ44yvmlM= 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 1589185211831430.4329721425264; Mon, 11 May 2020 01:20:11 -0700 (PDT) Received: from localhost ([::1]:34120 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jY3fW-00078Q-Kf for importer@patchew.org; Mon, 11 May 2020 04:20:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56858) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jY3d2-0002zh-8X for qemu-devel@nongnu.org; Mon, 11 May 2020 04:17:36 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:54001 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 1jY3d1-0002nH-7w for qemu-devel@nongnu.org; Mon, 11 May 2020 04:17:35 -0400 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-379-GaY_mNsFNXuwV-BNqvG0uw-1; Mon, 11 May 2020 04:17:32 -0400 Received: by mail-wm1-f72.google.com with SMTP id g10so1001100wme.0 for ; Mon, 11 May 2020 01:17:32 -0700 (PDT) Received: from x1w.redhat.com (17.red-88-21-202.staticip.rima-tde.net. [88.21.202.17]) by smtp.gmail.com with ESMTPSA id y10sm13269382wrd.95.2020.05.11.01.17.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 May 2020 01:17:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589185054; 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=l8Kgyc/BsfqlAUuKAX2iSr9cLPvOmA/twzAvloj+tAk=; b=MMpqRCtw05XaYIud2avoFP6oNkhcAJYsAQ34woSmETJ9+6jb9cd8RMb8zlE361uI+OxWGw w26Zxwl8GRcRfb5g/4HKF1zfnP/HE/G9zwzVhKNKmg38F99cynpUrHsEm99MmAdc7DgxgY 7v/RLK9Xd0K4MoYW4i3w6SdO3rQOuTM= X-MC-Unique: GaY_mNsFNXuwV-BNqvG0uw-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=l8Kgyc/BsfqlAUuKAX2iSr9cLPvOmA/twzAvloj+tAk=; b=qPyncWo7UafWJM+EmyovO7hytwlJRGe//iTK1sSNctOricPqkYM+fKN2qohtkbbLzD CwJhfdxz1+S5O9nSLQVh/DysaFKd1NZzseM8ukC0voctpwRBku6kR/bw6JMpm2m350Jb jrEQs9edKig1GXGDwAfYbMNHSqwuqUORnDrt3WPC27K6V61/nRa3fYbUaFRdw2KjHkcq 1vjxHcN2/qXWdnlr8EfjyulkKGp157Z72PUnwlSZdikbZRSfgeHvuVTKqBkY707g2gVF EH2Tm7v7Ou83tA2fLu6PDRLwM1d1ek1FQM66cxdtpV7LoApa/5Tprj34qfaON4LwHqLK v1Pg== X-Gm-Message-State: AGi0PubFouSCAmSmGBAUCBkYwLjYQbDUxRiU2YQ/Do+N/7xg56b3fo28 fe9vdAVrYXWJl+c4Ru3IdZKQoeHoMRlxTCh8lLdIAFL14LJ4lPf7yXn4QhTBwL6XJhj+yUp/oUP Tk7Z8UUSn6Y83V2U= X-Received: by 2002:a7b:c38b:: with SMTP id s11mr30234407wmj.55.1589185051371; Mon, 11 May 2020 01:17:31 -0700 (PDT) X-Google-Smtp-Source: APiQypLOtobW+2rmDeuexY+i3NwOfjNt9c/EqSVlRq+EWmcLSLTlrX6i/8xKmcck5cjM2smYJpATuw== X-Received: by 2002:a7b:c38b:: with SMTP id s11mr30234388wmj.55.1589185051202; Mon, 11 May 2020 01:17:31 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 2/4] memory: Rename memory_region_do_writeback() -> memory_region_sync() Date: Mon, 11 May 2020 10:17:17 +0200 Message-Id: <20200511081719.31641-3-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200511081719.31641-1-philmd@redhat.com> References: <20200511081719.31641-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" 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/11 01:43:51 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, 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 , Peter Maydell , Beata Michalska , qemu-block@nongnu.org, Richard Henderson , 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) We usually use '_do_' for internal functions. Rename memory_region_do_writeback() as memory_region_sync() to better reflect what it does. Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/exec/memory.h | 13 +++++++------ memory.c | 2 +- target/arm/helper.c | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/include/exec/memory.h b/include/exec/memory.h index e000bd2f97..4fc1d85b99 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -1474,14 +1474,15 @@ 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 - * selected address range + * memory_region_sync: Synchronize 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 + * It is only meaningful for RAM regions, otherwise it is no-op. + * + * @mr: the memory region to be synchronized + * @addr: the initial address of the range to be sync + * @size: the size of the range to be sync */ -void memory_region_do_writeback(MemoryRegion *mr, hwaddr addr, hwaddr size= ); +void memory_region_sync(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 fd5c3af535..73534b26f4 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_sync(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..c2697ed7c0 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_sync(mr, offset, dline_size); } } } --=20 2.21.3 From nobody Sun May 19 16:31:30 2024 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=1589185139; cv=none; d=zohomail.com; s=zohoarc; b=KyHw1hI6Pa3ImK21heMpWi8G9SOtdnpoHJU8H2kcbchUkqZSQ9PQmkQCk8Zq7oFfh8EeUIJM4oqdnb71213B29J0AHKjLo8HP52RvnWVxq4wbVwc/i1NZq8b9QxNutIn//6CnWGQ0onVX21NhbE16gU1hM6iQenicn1kEtW8tRg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589185139; 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=xHMlh8UQrz25BuiKwyV6jlHVokAyOsVkk8MOKqnQOCE=; b=WWXmKBQV/b3P9Iu8cPignyJOb4Z9MjZ0tf9pHjY4IVGBFaDU5qYiTdNdCgqljjaIH3FTDhzWvgbGOx+pROEprDCyyIZE6JFJ0uPFY4uMVjPT/NYA7BNKK9LXc8aGXiW/h7oOV5O1ZSKbZnW7WzftB4aYyiBG3pc1Teb3JXJuBZc= 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 1589185139133280.99298054046176; Mon, 11 May 2020 01:18:59 -0700 (PDT) Received: from localhost ([::1]:57776 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jY3eL-00055h-Ko for importer@patchew.org; Mon, 11 May 2020 04:18:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56898) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jY3d9-0003MG-TI for qemu-devel@nongnu.org; Mon, 11 May 2020 04:17:43 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:27016 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 1jY3d9-0002oX-3J for qemu-devel@nongnu.org; Mon, 11 May 2020 04:17:43 -0400 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-104-aW5X9QA0MTyQBS_Nfpvb3Q-1; Mon, 11 May 2020 04:17:37 -0400 Received: by mail-wr1-f70.google.com with SMTP id 37so1637214wrc.4 for ; Mon, 11 May 2020 01:17:37 -0700 (PDT) Received: from x1w.redhat.com (17.red-88-21-202.staticip.rima-tde.net. [88.21.202.17]) by smtp.gmail.com with ESMTPSA id 2sm16244217wre.25.2020.05.11.01.17.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 May 2020 01:17:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589185062; 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=xHMlh8UQrz25BuiKwyV6jlHVokAyOsVkk8MOKqnQOCE=; b=MPWhu4pxGDyVXc4/5heCEKihqh83z5Rhfjs7vdDoA0f7QMM/Q8t6AyvqEkFIJndwjo2gaU LgVIWLLRjl3mw8/2o6248LncnJbZc9nzMD4NTGhklJFPOIItKP9vXY7XE4/6fp4/C+X5Yv 1b17sRjhd4yiki1OD8BH30QgMCJoaGc= X-MC-Unique: aW5X9QA0MTyQBS_Nfpvb3Q-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=xHMlh8UQrz25BuiKwyV6jlHVokAyOsVkk8MOKqnQOCE=; b=iS2x5JcsOdJ7ypN7N1goFapZNg5IZxwbzK1OheaouXqk4FEOI8TqqwEsSC2NE/YzqK EHhxXI37jztGPKwnvxzH7NPqpyrZq6DHxp5oar5ZWOMxar8Pz/tyncr56273aNMUHCgn v4HQAaIjxazgzPeW+55d+6FbVhj51UeU8dO4YCcx3E3Xdz9vzkzVS0atPmszLa9M3ZAr YdizQPUEiL6quj6yW/64OsGMmqT1p7X1NcSi1bzSubvOTzlBdhFa3d06JM9RVbnMgT5i xfop0q7ggZc0POFbVKwsfU9yAuCm6WW/HsrQGxKV6+5NbJQn7vVO6Flv5/f512GsO5Mc btjg== X-Gm-Message-State: AGi0PuZq6DtdEypxr69zWE2x/J9Bv4OL5tWSaf5M9xIehoe98pJoSlex OSaALmQvRJSwu0csieh7ytoRX3kIzlhxEffbCLkPfdWdovyyjYHk9zIdTkKhfmqpjZ1utxdCYMt a4OMUcj7kv48YifE= X-Received: by 2002:a7b:c1c4:: with SMTP id a4mr30861084wmj.86.1589185056015; Mon, 11 May 2020 01:17:36 -0700 (PDT) X-Google-Smtp-Source: APiQypKBS9b8mmGCVTif3m3Bton6W+ruHEXycRuxkhQn0Ve7yrerHc/tSG7p1SbOGL16irGOO4/5wA== X-Received: by 2002:a7b:c1c4:: with SMTP id a4mr30861073wmj.86.1589185055867; Mon, 11 May 2020 01:17:35 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 3/4] hw/block: Let the NVMe emulated device be target-agnostic Date: Mon, 11 May 2020 10:17:18 +0200 Message-Id: <20200511081719.31641-4-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200511081719.31641-1-philmd@redhat.com> References: <20200511081719.31641-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" 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.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/11 03:10:56 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 , Peter Maydell , Beata Michalska , qemu-block@nongnu.org, Richard Henderson , 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) Now than the non-target specific memory_region_sync() function is available, use it to make this device target-agnostic. Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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..d9d0649540 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_sync(&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 Sun May 19 16:31:30 2024 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=1589185291; cv=none; d=zohomail.com; s=zohoarc; b=l4Na+l9vswSE5KCPyJLNYCSLvBcp4RhkL6wJa5Um7B4dwYBN47BtS35/w9W52GR2bLutBk1JFlMOyr6Butg3AIcbXP5cZ0qQjwpfRoBweW+ze+XCPirmm0V7Q4OdlLVMqr9KBW/+s4CPjpuD4nbHsZOHjzyQrYyHWEtEhyqC59M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589185291; 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=tSfIOqlIt2t/ygoZKZ0BPDhjsEwlu4jVN7jfPQltXnc=; b=PB2bAyCZYfXbHtEiyBPKPEPJD7n0Er81IwHzSL9XQhpLR2bPNnfzA2POXHjOOUAUaODfCwlcsSun9BAPbCL/2Q0zOFSpTf2viQTs83bS76a0Z6Cuv2F5Dzuh0+sgYDNraOYRsR06qwl/pp0uoHccr0G1SLT19rN4gh2x3DN7KJM= 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 1589185291176590.7765248405146; Mon, 11 May 2020 01:21:31 -0700 (PDT) Received: from localhost ([::1]:37118 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jY3gn-0008WJ-Vk for importer@patchew.org; Mon, 11 May 2020 04:21:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56906) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jY3dB-0003QJ-Bz for qemu-devel@nongnu.org; Mon, 11 May 2020 04:17:45 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:59872 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 1jY3dA-0002or-M1 for qemu-devel@nongnu.org; Mon, 11 May 2020 04:17:45 -0400 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-414-O3LEHLewMhmSy0bHXH57xg-1; Mon, 11 May 2020 04:17:42 -0400 Received: by mail-wm1-f71.google.com with SMTP id v23so5005554wmj.0 for ; Mon, 11 May 2020 01:17:42 -0700 (PDT) Received: from x1w.redhat.com (17.red-88-21-202.staticip.rima-tde.net. [88.21.202.17]) by smtp.gmail.com with ESMTPSA id o26sm14683656wro.83.2020.05.11.01.17.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 May 2020 01:17:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589185064; 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=tSfIOqlIt2t/ygoZKZ0BPDhjsEwlu4jVN7jfPQltXnc=; b=bgIqepewjKoKtB/l2ThdN0f9VKuExP1oZS0JaSyogxBAQQoHrhY62P4aWaxO9J4wlGQwbS Qujw8BC+JPIAKl5Ib1bQ7F1f7TlUbxDmRl8jqBS0q14KwOtpcfYQkSELy0X9Eyb1E9vUfj ikLtaiFCMhx1wyxwpmw/E6gWWR8Ls8I= X-MC-Unique: O3LEHLewMhmSy0bHXH57xg-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=tSfIOqlIt2t/ygoZKZ0BPDhjsEwlu4jVN7jfPQltXnc=; b=qrgfvR7Osz4I+OIcwxwAMVA4mWZ7V1ouRgu8Qi2UlpaDOQSlQU+J7sjlZj11q/b8RI oVYTO1K2hv1nhpBzKNwFRod15Cf9N/WK7IyAoPDSStwd6WLNhg6KESFDFFHuKa9A7kll TivMTRfHllhu03HAwB5bwUDtgzK2ooZbFqMjLT2A3tt+RNYyuB51tYVOxaeWMLQRGnfZ fwOAlRowu0bksbg4/8LAcuXONacEf9oOKfP6QqFePFpwV4Vn/i/kkZGCly+pU5/uBSjn oqP8qeyJPkwjrs01u1On7qqIUXDp+5eAg6ljJg2GKY9jnFB2mkb8rip1FiOxEovfxC/r OFTQ== X-Gm-Message-State: AGi0PuaN/DNBgd3jVKQZsPVlqUXnsu954GJ0SiyEN0iiJ4Qqu3Lon/pU yYcoM5boXxn6++h+3/xNFp73i6Be53WUwIQBL8+JmU3mLqQZGLdGH7pYF2cfUc6LhP/sULQ2Zj7 CMBhKjf0o3ZzPBVQ= X-Received: by 2002:a1c:4d17:: with SMTP id o23mr28919818wmh.47.1589185060982; Mon, 11 May 2020 01:17:40 -0700 (PDT) X-Google-Smtp-Source: APiQypLvrSVcCxsl5UqPYYZ+FqM70FTTVIzUWz3eyvyepS6ativy6YX0/sHoR4uJdH1WXxMBye/fUA== X-Received: by 2002:a1c:4d17:: with SMTP id o23mr28919798wmh.47.1589185060762; Mon, 11 May 2020 01:17:40 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 4/4] exec: Rename qemu_ram_writeback() as qemu_ram_msync() Date: Mon, 11 May 2020 10:17:19 +0200 Message-Id: <20200511081719.31641-5-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200511081719.31641-1-philmd@redhat.com> References: <20200511081719.31641-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" 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.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/11 03:10:56 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) 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 --- include/exec/ram_addr.h | 4 ++-- exec.c | 2 +- memory.c | 3 +-- 3 files changed, 4 insertions(+), 5 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 73534b26f4..5bfa1429df 100644 --- a/memory.c +++ b/memory.c @@ -2197,7 +2197,6 @@ void memory_region_ram_resize(MemoryRegion *mr, ram_a= ddr_t newsize, Error **errp qemu_ram_resize(mr->ram_block, newsize, errp); } =20 - void memory_region_sync(MemoryRegion *mr, hwaddr addr, hwaddr size) { /* @@ -2205,7 +2204,7 @@ void memory_region_sync(MemoryRegion *mr, hwaddr addr= , hwaddr size) * different types of memory regions */ 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