From nobody Mon Nov 25 10:31:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1716547939; cv=none; d=zohomail.com; s=zohoarc; b=VyjvORRsFbUDEsxue0YVyldxifmgrQ9xs044OUU95hpoZ+tWDXM9T5LDPlDz6xhhscHaGtsezxdD8ULFeeiDyfcMtBOwQMrdgBoqmTZb7xRFtd1Tax7J0Z1fQCwwKl9Q7AS3Bsrf++qYWt3TVKafc0TcesNqpktCYc8hFarKXyY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716547939; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=YP28Iks2aCd2MOvUAbQc4yYuz/leCz2VtuKFu0fMfns=; b=keAU5I7MSlvc7xuRf/uwTwRsNMIj/L/j+tXnxq9RpjuoLbyQI9tr9YQomY0pHA63U32E0m47SOt8pbhPu3j1xWtSOCwc8hEyUmGOa1YyF/RIyItWrNfrZkSJ/fUkPYG+tBktWqiN2CyqTXA90vy3x+LH5B1UngbUvkA04mk28vM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1716547939735976.432016899346; Fri, 24 May 2024 03:52:19 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.729312.1134437 (Exim 4.92) (envelope-from ) id 1sASWp-0006A7-6v; Fri, 24 May 2024 10:52:03 +0000 Received: by outflank-mailman (output) from mailman id 729312.1134437; Fri, 24 May 2024 10:52:03 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sASWp-0006A0-42; Fri, 24 May 2024 10:52:03 +0000 Received: by outflank-mailman (input) for mailman id 729312; Fri, 24 May 2024 10:52:02 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sASWo-0005va-7b for xen-devel@lists.xenproject.org; Fri, 24 May 2024 10:52:02 +0000 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [2a00:1450:4864:20::229]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id a6794cf7-19bb-11ef-90a1-e314d9c70b13; Fri, 24 May 2024 12:52:01 +0200 (CEST) Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2e95a7545bdso8103881fa.2 for ; Fri, 24 May 2024 03:52:01 -0700 (PDT) Received: from gmail.com (213-67-3-247-no600.tbcn.telia.com. [213.67.3.247]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2e95be00a9esm1417431fa.103.2024.05.24.03.51.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 03:51:59 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: a6794cf7-19bb-11ef-90a1-e314d9c70b13 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716547921; x=1717152721; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YP28Iks2aCd2MOvUAbQc4yYuz/leCz2VtuKFu0fMfns=; b=Wl4j6IP6/aHZ0ifQHdheTEn2PWngmtcVEywDgaBYPaEqm+g8RSgs2o0BC0A2bWNOnZ tlysKLtQA7gFr+scuWAYicl5i1AVFnUDiW7hS+0EJVHSB8PqqRTsyfRP++BvVQPYwZ67 33VVXtFJX81rnzXeVZ4xoPch0ZedFMw+9ngfqi9UyITAq792g1k/+YTjXRdp6wEwKEBi xsh9PnesERgcpz/FK/kwm18ZZH3VPQbCI1xp/RkdFlfHcApaGJowGAd5r5kNy9NyE/Vy 4wDTYOzEXOzOJPCxIDxYQymHTpqMHyHO42RvY3fGzFqL+eafUBIs13EMZPKGTwgLFrvd Pz4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716547921; x=1717152721; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YP28Iks2aCd2MOvUAbQc4yYuz/leCz2VtuKFu0fMfns=; b=fZXfhN4GP1MxoipY23lKgTSI5BENqQDpCA/MYD5jIG3UsOtlZ910HninnRIf9egpOs qrVuk1q1Vtp0oKuBzqLJoAxM+mTtj1nFfhCePNbNnqdb2f4SVTgCt5bIldXwOL0McMQ0 yGePB0Yn1GFAenSBVfRjx/x/Ae8BMpi18Mf9gCDmL8vCzyWmCLrxMzavl0+awx512Gj/ XK5rFvNpClBIfzrlZyIvaWof5oGObdx+CMfT7gLN321gocGOdDu3WttzK4upJT9Z23H9 UXN+hh3m27VIefosxPIp2UEKOc69WRo/6VXr4B6KP5z+7tbRGt8/tzwB4sYkNpWptcJK l4Nw== X-Forwarded-Encrypted: i=1; AJvYcCWuFZpVxQ1iBZjP1In0AB9zOsAWF/dyhla6K0Td2QkzakQq0zYVBHGrwhZdy0MJKj6+NV/+4IU+rseL1Vcru3U4zpXkuUTJUHM3/HQ4S4U= X-Gm-Message-State: AOJu0YyiPTWZA5p7adDfqva5KCdWX44rzf67ewSOqgKHYn2Y0TgLpIwD 6NoiIgBRgHSIulmpOp6d81IpLnHep8HLBUt80JDE5UlGvbpqg0gf X-Google-Smtp-Source: AGHT+IHxf48OGn9vlQXF6Pl1G+8i2NXaRVtBjeCMc7C8+mcWr77Zr/it24OxvWZYA9xQzmTZ7G5dGA== X-Received: by 2002:a2e:6802:0:b0:2e5:67a8:2e6b with SMTP id 38308e7fff4ca-2e95b04115amr13608211fa.8.1716547920962; Fri, 24 May 2024 03:52:00 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Cc: edgar.iglesias@gmail.com, sstabellini@kernel.org, jgross@suse.com, "Edgar E. Iglesias" , David Hildenbrand , Anthony PERARD , Paul Durrant , xen-devel@lists.xenproject.org Subject: [PATCH v7 3/8] xen: Add xen_mr_is_memory() Date: Fri, 24 May 2024 12:51:47 +0200 Message-Id: <20240524105152.1301842-4-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240524105152.1301842-1-edgar.iglesias@gmail.com> References: <20240524105152.1301842-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1716547941035100003 Content-Type: text/plain; charset="utf-8" From: "Edgar E. Iglesias" Add xen_mr_is_memory() to abstract away tests for the xen_memory MR. No functional changes. Signed-off-by: Edgar E. Iglesias Reviewed-by: Stefano Stabellini Acked-by: David Hildenbrand Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/xen/xen-hvm-common.c | 10 ++++++++-- include/sysemu/xen.h | 8 ++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/hw/xen/xen-hvm-common.c b/hw/xen/xen-hvm-common.c index 2d1b032121..a0a0252da0 100644 --- a/hw/xen/xen-hvm-common.c +++ b/hw/xen/xen-hvm-common.c @@ -12,6 +12,12 @@ =20 MemoryRegion xen_memory; =20 +/* Check for xen memory. */ +bool xen_mr_is_memory(MemoryRegion *mr) +{ + return mr =3D=3D &xen_memory; +} + void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size, MemoryRegion *mr, Error **errp) { @@ -28,7 +34,7 @@ void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size, = MemoryRegion *mr, return; } =20 - if (mr =3D=3D &xen_memory) { + if (xen_mr_is_memory(mr)) { return; } =20 @@ -55,7 +61,7 @@ static void xen_set_memory(struct MemoryListener *listene= r, { XenIOState *state =3D container_of(listener, XenIOState, memory_listen= er); =20 - if (section->mr =3D=3D &xen_memory) { + if (xen_mr_is_memory(section->mr)) { return; } else { if (add) { diff --git a/include/sysemu/xen.h b/include/sysemu/xen.h index 754ec2e6cb..dc72f83bcb 100644 --- a/include/sysemu/xen.h +++ b/include/sysemu/xen.h @@ -34,6 +34,8 @@ void xen_hvm_modified_memory(ram_addr_t start, ram_addr_t= length); void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size, struct MemoryRegion *mr, Error **errp); =20 +bool xen_mr_is_memory(MemoryRegion *mr); + #else /* !CONFIG_XEN_IS_POSSIBLE */ =20 #define xen_enabled() 0 @@ -47,6 +49,12 @@ static inline void xen_ram_alloc(ram_addr_t ram_addr, ra= m_addr_t size, g_assert_not_reached(); } =20 +static inline bool xen_mr_is_memory(MemoryRegion *mr) +{ + g_assert_not_reached(); + return false; +} + #endif /* CONFIG_XEN_IS_POSSIBLE */ =20 #endif --=20 2.40.1