From nobody Sat Nov 15 22:31:38 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; 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=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1747737029; cv=none; d=zohomail.com; s=zohoarc; b=F2yClSjc90rO619JWQbLF9xqDFC23aD/IGJP4qnuu1Kg1mP38zV/O3RlB/LoGf+5domfAKkwrFkm/AuoK95bIngyaTTFa8vUBAP/xwnjMb0JzTDksRzbLrTyN7eIR+MHTa0qUCse1GlBvT/RnHrnCk5/DihlywXJikmiXCUFy1Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1747737029; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Fxn3ciiAnXGKExAIk1dESgiMFUyTmgo2M7wa5Rye64U=; b=ZvtQ/mUngjVk4CD4wB8kdOoHM2gqxDl0XpMW52dOVjt2SP1K98FFyfaRJB37DolF+4R9fPP5x44boTt1ZTOSSeT7oeH2nTx++JA4ZHvLZnAXUbT/UeNWOYlTOonicS52b9lt2pw5ULvPUoxVDurlo8gAOSVF94hIKFqfW/nUYfQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1747737029987173.13123493534454; Tue, 20 May 2025 03:30:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uHKE5-0004mx-G3; Tue, 20 May 2025 06:29:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uHKE3-0004mk-Sm for qemu-devel@nongnu.org; Tue, 20 May 2025 06:29:35 -0400 Received: from mgamail.intel.com ([198.175.65.21]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uHKE1-0004gB-US for qemu-devel@nongnu.org; Tue, 20 May 2025 06:29:35 -0400 Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 May 2025 03:29:34 -0700 Received: from emr-bkc.sh.intel.com ([10.112.230.82]) by fmviesa004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 May 2025 03:29:30 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1747736974; x=1779272974; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OTa0g2q+m0xONAZ985oRQ8DaRJiUFsfwCwbWIOiPDSE=; b=io881stpj2+Cy1W8gnutmmBl3XYWq4Ato45kSPl68AtVEzeJCFv2zEh5 kZQHmWcv0idcOOsQ4DOCydbeEr+QrCgPv0YuW5P1xPMmyKzJd+7PESw76 1OGItSc34l1Lp2lpjBIs8zNhBSTgdKmDNh+KEf9oZ2TQE+96SONknRSoR uM23QwVbEWhWhWwNLmLJ5GRIqg5E0WM0wsOB0UZWFboFS/ikcvdzciYUc Jko15nRP9GQvuIEXft5y8AHH0WiKOk1nb6+XHlLBaMfR3+u82GTYupKaP dVyDY24nccKqa6FQSLy1xrYubvPMV6f+Lo9COrTlOiO4jvRtTR9kdfydo A==; X-CSE-ConnectionGUID: lcx5nT/+RoOlCK93G0AcxA== X-CSE-MsgGUID: nwDYdWHrQiOIUK+BmlQjPA== X-IronPort-AV: E=McAfee;i="6700,10204,11438"; a="49566681" X-IronPort-AV: E=Sophos;i="6.15,302,1739865600"; d="scan'208";a="49566681" X-CSE-ConnectionGUID: j9eFD9hUQnubW4cm6fpS2Q== X-CSE-MsgGUID: Vyb9SCSARHefsgMJnbyKSg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.15,302,1739865600"; d="scan'208";a="144905299" From: Chenyi Qiang To: David Hildenbrand , Alexey Kardashevskiy , Peter Xu , Gupta Pankaj , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Michael Roth Cc: Chenyi Qiang , qemu-devel@nongnu.org, kvm@vger.kernel.org, Williams Dan J , Zhao Liu , Baolu Lu , Gao Chao , Xu Yilun , Li Xiaoyao Subject: [PATCH v5 08/10] memory: Change NotifyRamDiscard() definition to return the result Date: Tue, 20 May 2025 18:28:48 +0800 Message-ID: <20250520102856.132417-9-chenyi.qiang@intel.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20250520102856.132417-1-chenyi.qiang@intel.com> References: <20250520102856.132417-1-chenyi.qiang@intel.com> MIME-Version: 1.0 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=198.175.65.21; envelope-from=chenyi.qiang@intel.com; helo=mgamail.intel.com X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.13, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1747737034409116600 Content-Type: text/plain; charset="utf-8" So that the caller can check the result of NotifyRamDiscard() handler if the operation fails. Signed-off-by: Chenyi Qiang --- Changes in v5: - Revert to use of NotifyRamDiscard() Changes in v4: - Newly added. --- hw/vfio/listener.c | 6 ++++-- include/system/memory.h | 4 ++-- system/ram-block-attribute.c | 3 +-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/hw/vfio/listener.c b/hw/vfio/listener.c index bfacb3d8d9..06454e0584 100644 --- a/hw/vfio/listener.c +++ b/hw/vfio/listener.c @@ -190,8 +190,8 @@ out: rcu_read_unlock(); } =20 -static void vfio_ram_discard_notify_discard(RamDiscardListener *rdl, - MemoryRegionSection *section) +static int vfio_ram_discard_notify_discard(RamDiscardListener *rdl, + MemoryRegionSection *section) { VFIORamDiscardListener *vrdl =3D container_of(rdl, VFIORamDiscardListe= ner, listener); @@ -206,6 +206,8 @@ static void vfio_ram_discard_notify_discard(RamDiscardL= istener *rdl, error_report("%s: vfio_container_dma_unmap() failed: %s", __func__, strerror(-ret)); } + + return ret; } =20 static int vfio_ram_discard_notify_populate(RamDiscardListener *rdl, diff --git a/include/system/memory.h b/include/system/memory.h index 83b28551c4..e5155120d9 100644 --- a/include/system/memory.h +++ b/include/system/memory.h @@ -518,8 +518,8 @@ struct IOMMUMemoryRegionClass { typedef struct RamDiscardListener RamDiscardListener; typedef int (*NotifyRamPopulate)(RamDiscardListener *rdl, MemoryRegionSection *section); -typedef void (*NotifyRamDiscard)(RamDiscardListener *rdl, - MemoryRegionSection *section); +typedef int (*NotifyRamDiscard)(RamDiscardListener *rdl, + MemoryRegionSection *section); =20 struct RamDiscardListener { /* diff --git a/system/ram-block-attribute.c b/system/ram-block-attribute.c index f12dd4b881..896c3d7543 100644 --- a/system/ram-block-attribute.c +++ b/system/ram-block-attribute.c @@ -66,8 +66,7 @@ static int ram_block_attribute_notify_discard_cb(MemoryRe= gionSection *section, { RamDiscardListener *rdl =3D arg; =20 - rdl->notify_discard(rdl, section); - return 0; + return rdl->notify_discard(rdl, section); } =20 static int --=20 2.43.5