From nobody Thu Jan 8 12:40:00 2026 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; 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=1766421651; cv=none; d=zohomail.com; s=zohoarc; b=Qehof7GhDX93Tt/sURNTqIYi8iMl8z4PCXQnPdXINklM/oIQk4fE9HKk3hWVz2WW+x1ticyayNJwex3Db62J3QjtObYRDQRjQ+iDFjASImnlXoXOMx9oE0ALoC7ERGuwHt3cWjvSLIMoAJ3Pa5ihzGzAAMnHBP+0HdOPFPLW78k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766421651; 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=8Uw503SKx0GgyGrebm3SW5jx5cutNlixWzT0/a43dm0=; b=DeojU58K5vz04Sfpab3Iu5SwCOzv4bBPYsKh0rsy2q1mwyVkoUyhsoQhh2XEXZTRGKE+4j7h9xxTmvYzk1MJ7zHX0YrgWrpxPPKbno3Q/Ka6FWVViDav7euPK3OCZHb+p0k6lwlVw4XiuNiY5h4WukOflywEbv3XyksrBI5wmKo= 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 176642165192986.5455734814708; Mon, 22 Dec 2025 08:40:51 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1192198.1511546 (Exim 4.92) (envelope-from ) id 1vXixS-0004nL-Rv; Mon, 22 Dec 2025 16:40:30 +0000 Received: by outflank-mailman (output) from mailman id 1192198.1511546; Mon, 22 Dec 2025 16:40:30 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vXixS-0004mc-NH; Mon, 22 Dec 2025 16:40:30 +0000 Received: by outflank-mailman (input) for mailman id 1192198; Mon, 22 Dec 2025 16:40:29 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vXixR-0004kh-6w for xen-devel@lists.xenproject.org; Mon, 22 Dec 2025 16:40:29 +0000 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [2a00:1450:4864:20::634]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id eba00fb9-df54-11f0-9cce-f158ae23cfc8; Mon, 22 Dec 2025 17:40:27 +0100 (CET) Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-b7a6e56193cso695590166b.3 for ; Mon, 22 Dec 2025 08:40:27 -0800 (PST) Received: from fedora (user-109-243-71-38.play-internet.pl. [109.243.71.38]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b8037f3e271sm1137038366b.60.2025.12.22.08.40.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Dec 2025 08:40:26 -0800 (PST) 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: eba00fb9-df54-11f0-9cce-f158ae23cfc8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1766421626; x=1767026426; 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=8Uw503SKx0GgyGrebm3SW5jx5cutNlixWzT0/a43dm0=; b=QHUvu/DCaS8rIq73wqnlo/4Qf4c1/6DKsOp3fNXhmDN/FVQpmrxYQUa50Xq6V2vSjp jYyiie+DsOOVD019HvZGGlPvekxPdiXKIdribS2+9TJ/Tx0qCVEaAtC0DqG3WqGMeTt+ Ixkbh4A6ASxyJFADLhb/KOj05tQQe48fztdI/oQ1J/wLkkglDoQdxPt4YvyGcQb7NdZD QFwOzlgzbHAv27MLDYDPsWr/Z+z1xpcRk2SPMAdp0u1tsYRc0ArfFBBx2EDI0C0618Ej Oemrg4BTY9kn4UH8CVmswgBdO2ieACXCPyTaeDt/K1jLFOGzkbM35i0nhPKWunBeVHNt yZ/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766421626; x=1767026426; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=8Uw503SKx0GgyGrebm3SW5jx5cutNlixWzT0/a43dm0=; b=bBwEpT7GY/tqUISHp3i/Cku774PPHawYAkpAFVUX/R4SJin49xmgOG4zMQawg+WYsl 7ZLPr59aO8iFCImqIkrGx2ykk8lb8Vduqdzl4GzF1uvJjUJMMS9Ge0YGWpQWzJZ9yreH WaBRjLnMRKnPOnECm86pMO0YN+zZZDmibJZ6qErCkDVvPiTsNSAbcjrvlb0tEaOBz2el 3abL4ZG5sfUDtL/Jbob2OUqNo5qPy7AkTM/AzocbR/WCB/5zQxRXJJp+9sKbosDBQt7v QuhBEBMAfxnIhbJ825rO6buiMBF6x2ZnH3yvyfegl2BLeMqKx+AuiGUNdTaqAoeWV0h6 Pv3Q== X-Gm-Message-State: AOJu0YzIhypUYFA5NlNk6fvep09e0xbW6be93iJg5TfkhvlORADOxggz ITxzB+gCZRRv/m2unlaxO3AmKPCBVMZ2IPoQYRj9se+kqPt01GS6ZVN0bSHz0w== X-Gm-Gg: AY/fxX7eVUYoabiLWfsu+jHnaHDuACLfpSc0Vg/tZFMtytJFI8nWr5vti8EN2r54Mep LR/HputqAP9B15OIJEcXs5625E3SC4H2dNuqjbJPc6MYwE2Ev9wcagwKIWvg2+9s96/jTaa5HPm zm8yuQpUtL7phZ8Jdj0r6RF/EX/ivE8xXcvGme2TlEc9PBOr6n4Ep8rwH5c1K1uM/mrBXFDMnCy MrnDanP7I3tCiEk6obJpiqynZQqTahkpGEOYhILoPrvAxBRwWkHO7A7L3D8S2lxACoz57+atx3L 3opFfT6BfLfTx44kFD62FriZBCy8vG81EvOTbUa3vJWCcEtTun30GORb4t2OfJdGIiRo0vvwlnP yY8pppWUKQQHXbw8HsA8OGhH7NXlVWiTl6Vq7Gg3lQDTo+fFpMhQFdDRrWyTCgM/v+2UHBEfAqG 5SU1Wqcs4Y/gHHuLHmpqRVXh5jXY/m/axXMJujLhVXxfCDCqU2RhVy8LU= X-Google-Smtp-Source: AGHT+IFEnHW9OAYQ2/mOFIgK9/TTsAUnC/JliLxNXdFrAoRjE/ApHK5mBIfb4XfU5V8HIvPJmkoSlA== X-Received: by 2002:a17:907:97c2:b0:b73:4b22:19c5 with SMTP id a640c23a62f3a-b803722a7f4mr1126204666b.44.1766421626416; Mon, 22 Dec 2025 08:40:26 -0800 (PST) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Oleksii Kurochko , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Andrew Cooper Subject: [PATCH v3 1/4] xen/arm: vcpu_vgic_free() updates Date: Mon, 22 Dec 2025 17:40:11 +0100 Message-ID: <17d04a2ba8211408cd188891a301bc521cac3bd5.1766404618.git.oleksii.kurochko@gmail.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1766421652084158501 Content-Type: text/plain; charset="utf-8" Use XFREE() instead of xfree() so that vcpu_vgic_free() can be idempotent. With XFREE(), vgic_vcpu->private_irqs is set to NULL, so calling vcpu_vgic_free() a second time is not an issue. Update the prototype of vcpu_vgic_free() to return void to satisfy MISRA Rule 17.7, since the return value of vcpu_vgic_free() is not used by any callers. Suggested-by: Andrew Cooper Signed-off-by: Oleksii Kurochko Reviewed-by: Andrew Cooper --- Change in v3: - New patch. --- xen/arch/arm/include/asm/vgic.h | 2 +- xen/arch/arm/vgic.c | 5 ++--- xen/arch/arm/vgic/vgic-init.c | 4 +--- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/xen/arch/arm/include/asm/vgic.h b/xen/arch/arm/include/asm/vgi= c.h index 31b3d3e5ec5d..6f9ab1c98c1c 100644 --- a/xen/arch/arm/include/asm/vgic.h +++ b/xen/arch/arm/include/asm/vgic.h @@ -418,7 +418,7 @@ int domain_vgic_register(struct domain *d, unsigned int= *mmio_count); int domain_vgic_init(struct domain *d, unsigned int nr_spis); void domain_vgic_free(struct domain *d); int vcpu_vgic_init(struct vcpu *v); -int vcpu_vgic_free(struct vcpu *v); +void vcpu_vgic_free(struct vcpu *v); =20 void vgic_inject_irq(struct domain *d, struct vcpu *v, unsigned int virq, bool level); diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c index 3ebdf9953f07..6647071ad4d7 100644 --- a/xen/arch/arm/vgic.c +++ b/xen/arch/arm/vgic.c @@ -390,10 +390,9 @@ int vcpu_vgic_init(struct vcpu *v) return 0; } =20 -int vcpu_vgic_free(struct vcpu *v) +void vcpu_vgic_free(struct vcpu *v) { - xfree(v->arch.vgic.private_irqs); - return 0; + XFREE(v->arch.vgic.private_irqs); } =20 struct vcpu *vgic_get_target_vcpu(struct vcpu *v, unsigned int virq) diff --git a/xen/arch/arm/vgic/vgic-init.c b/xen/arch/arm/vgic/vgic-init.c index f8d7d3a226d0..aef526f2e717 100644 --- a/xen/arch/arm/vgic/vgic-init.c +++ b/xen/arch/arm/vgic/vgic-init.c @@ -239,13 +239,11 @@ void domain_vgic_free(struct domain *d) dist->nr_spis =3D 0; } =20 -int vcpu_vgic_free(struct vcpu *v) +void vcpu_vgic_free(struct vcpu *v) { struct vgic_cpu *vgic_cpu =3D &v->arch.vgic; =20 INIT_LIST_HEAD(&vgic_cpu->ap_list_head); - - return 0; } =20 /* --=20 2.52.0 From nobody Thu Jan 8 12:40:00 2026 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; 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=1766421649; cv=none; d=zohomail.com; s=zohoarc; b=BlD+iu0pP5E9fHVwLyhPXpuFPzhVvvlBliOdHWYnf7bfVpM1d0HxsLlxWbHiwYMVeumQ+xNZXTIWzWE1KCxFKmG+YYxVjLhf3Jv6c0E+MoKwFCTv91o8yTGoTDwXZXjQOZno9e4WyonXaMzAHdDYFOZihZ9bxyCW03yPcZYhgHE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766421649; 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=WBzbL79dzEewzumfeW1aHAle0AWKV3qUQkn9X5gzvdw=; b=jUvh2yAvU0McuIdTENHYw74/HLoZ7rDpMR+766p3MowUNWEOC5Xo4wVo6bYk1JpOJBCNRR8xPdELczYOhL1OPz3MbZMkvou3v58AooIF6Q/fmgZngP8C5R6Iyxy+BOJW2LaLyTnGROdX2K9nGei2/Oj7y8WX5ifsx0H6YL53mbc= 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 1766421648831565.1876905862114; Mon, 22 Dec 2025 08:40:48 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1192197.1511540 (Exim 4.92) (envelope-from ) id 1vXixS-0004l8-KD; Mon, 22 Dec 2025 16:40:30 +0000 Received: by outflank-mailman (output) from mailman id 1192197.1511540; Mon, 22 Dec 2025 16:40:30 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vXixS-0004l0-H1; Mon, 22 Dec 2025 16:40:30 +0000 Received: by outflank-mailman (input) for mailman id 1192197; Mon, 22 Dec 2025 16:40:29 +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 1vXixR-0004ka-2s for xen-devel@lists.xenproject.org; Mon, 22 Dec 2025 16:40:29 +0000 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [2a00:1450:4864:20::62c]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id ec247116-df54-11f0-b15b-2bf370ae4941; Mon, 22 Dec 2025 17:40:28 +0100 (CET) Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-b7355f6ef12so743609566b.3 for ; Mon, 22 Dec 2025 08:40:28 -0800 (PST) Received: from fedora (user-109-243-71-38.play-internet.pl. [109.243.71.38]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b8037f3e271sm1137038366b.60.2025.12.22.08.40.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Dec 2025 08:40:26 -0800 (PST) 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: ec247116-df54-11f0-b15b-2bf370ae4941 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1766421627; x=1767026427; 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=WBzbL79dzEewzumfeW1aHAle0AWKV3qUQkn9X5gzvdw=; b=EMBIou2n5XbjU2BDfVCAxAKBREjsIkAQQK+9fzbe8O+RQ7QCqnzKwUw+2bOwsU1V+Z DTBPoRvLjmpGy8yaQ3grV4Z2J1fi6q45QaGndOeMTKrBoZZ8Ulz6c7b51ky6QHj5vsoI pzuM7MOjoHNcCz3Xw2oJ4nwwk81+2vVywaUvE93PQT0hpxJuZIfiw242VVunwzlXMlAn y9jE505LtMoAVPyyIKkAgt6zunlo9PgujNm56usT70JfUWh8I/ZKuKp7nD9QPs/4qnHb YI51m9He+bSJqFe01VpJrsh5DFafy8g3CCmbeyEzVJZtlZZ2ZXDzd4FPazfydcgk/aNL RAUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766421627; x=1767026427; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=WBzbL79dzEewzumfeW1aHAle0AWKV3qUQkn9X5gzvdw=; b=CCq/6TMsfS10xnxE1KJZKYE7yvAPGgwrJkpKLiXcR/j3yTdS6FyAeFibywuW/I/jzj zl+hIhRc/2Pq/dafbc/fqBbQfjljwdHro73sO0eiLqOrwGMhiIKQq7+vj7u7BCG7ecE4 rf2CZ7lLM4czUm8tdJU++1TjI0RJ1qx9/eO3DpA309wjGD/DDXZRZyDU2zaoxPco3U9q 12q8EcYu0FhIlLGykxzA9QFHqf1Kxd3jS1f0qFm17Fz05xJtpk3tPWE2GugCYNUA1FK3 P4nh8WNqkKwtLJgkJbUk0X2+yXYR77U/umTb0qLqCp8+CUnDqLkQpYn63gHaweIwqlKN Tv0Q== X-Gm-Message-State: AOJu0YwiBCvkJ/z7br0eXliPNbnz1rzzpFtyfptRgxXg3xwoTLkm7pBC fJw4J/TdBn7HsSKZeMuTXCKoAy2UYLYyj2OVwMnIYazY5NIeoX00IGv8WnCf4w== X-Gm-Gg: AY/fxX4ejjBaTEAlxBQ7V6w78MmAdmE58Vmm+ocOLnWfwwN+jIQtisRFbbNYlf49RoJ lfn34HSC40RP/9vxeox7SG9YafrXhwpId/U6Q31njIA6OoN4dBrP73TbqKOWERIZzLPpr0aGdUF RrEI+T4AYupRjB6E4H3CRf0J02n8eeZaSih0mKS8llLm/3FX/5KhshK/hDQKG9VJqZkK0OYsBT9 jIRuuVpRGDQJLoELAn9tEi4J8EENHHfSQjtzHBwYTkuv/Ez1gYVt9EfTomM33skLDv12WwQ4mk8 cGLWBC36LnllX98YSibeHKxgoJIAN0VLMDyjJVgumXQruabuJQWDqNCPXgZ9/wHrmxJ2KhYTOAn nPPQm7do6PJYuPFFI+M2G4ZLFq8wDEx+PKCTTXVAO3PwilZOKlMCN3wiAfoCJ+tb0yA8YFfsOMV 2/1dwz0pRuuQx/aSiaXXJuuQKAq+/el3b11afnRqVEnOBxmzhBscNriGq9WbtzTf1ywQ== X-Google-Smtp-Source: AGHT+IFEzGPLG1+jRiEN6PRfsExU8DVuAmTIc9Y2B/6ZnI/dQWkqj88d9A4vO26H3fYF7+wTXmK1EA== X-Received: by 2002:a17:906:730f:b0:b73:9937:e96b with SMTP id a640c23a62f3a-b8037183903mr1276035266b.52.1766421627295; Mon, 22 Dec 2025 08:40:27 -0800 (PST) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Oleksii Kurochko , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Andrew Cooper Subject: [PATCH v3 2/4] xen/arm: optimize the size of struct vcpu Date: Mon, 22 Dec 2025 17:40:12 +0100 Message-ID: <7cad22bb0aa95eed7f9710024356110b4443f554.1766404618.git.oleksii.kurochko@gmail.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1766421650124158500 Content-Type: text/plain; charset="utf-8" When CONFIG_NEW_VGIC=3Dy and CONFIG_ARM_64=3Dy, the size of struct vcpu exceeds one page, which requires allocating two pages and led to the introduction of MAX_PAGES_PER_VCPU. To remove the need for MAX_PAGES_PER_VCPU in a follow-up patch, the vgic member of NEW_VGIC's struct vgic_vcpu member private_irq is changed to a pointer to struct vgic_irq. As a result, the size of struct vcpu for Arm64 is reduced to 2176 bytes, compared to 3840 bytes (without these changes and with CONFIG_ARM_64=3Dy) and 4736 bytes (without these changes and with both CONFIG_ARM_64=3Dy and CONFIG_NEW_VGIC=3Dy). Since the private_irqs member is now a pointer, vcpu_vgic_init() and vcpu_vgic_free() are updated to allocate and free private_irqs instance. Suggested-by: Andrew Cooper Signed-off-by: Oleksii Kurochko Reviewed-by: Andrew Cooper --- Changes in v3: - Make private_irqs member as pointer to vgic_irq in struct vgic_cpu of new_vgic instead of vgic member of arch_vcpu. --- Changes in v2: - New patch. --- xen/arch/arm/include/asm/new_vgic.h | 2 +- xen/arch/arm/vgic/vgic-init.c | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/include/asm/new_vgic.h b/xen/arch/arm/include/asm= /new_vgic.h index 1e762138939f..6f7af0e02b2b 100644 --- a/xen/arch/arm/include/asm/new_vgic.h +++ b/xen/arch/arm/include/asm/new_vgic.h @@ -155,7 +155,7 @@ struct vgic_dist { }; =20 struct vgic_cpu { - struct vgic_irq private_irqs[VGIC_NR_PRIVATE_IRQS]; + struct vgic_irq *private_irqs; =20 struct list_head ap_list_head; spinlock_t ap_list_lock; /* Protects the ap_list */ diff --git a/xen/arch/arm/vgic/vgic-init.c b/xen/arch/arm/vgic/vgic-init.c index aef526f2e717..4eb49d922492 100644 --- a/xen/arch/arm/vgic/vgic-init.c +++ b/xen/arch/arm/vgic/vgic-init.c @@ -202,6 +202,11 @@ int vcpu_vgic_init(struct vcpu *v) { int ret =3D 0; =20 + v->arch.vgic.private_irqs =3D + xzalloc_array(struct vgic_irq, VGIC_NR_PRIVATE_IRQS); + if ( !v->arch.vgic.private_irqs ) + return -ENOMEM; + vgic_vcpu_early_init(v); =20 if ( gic_hw_version() =3D=3D GIC_V2 ) @@ -244,6 +249,8 @@ void vcpu_vgic_free(struct vcpu *v) struct vgic_cpu *vgic_cpu =3D &v->arch.vgic; =20 INIT_LIST_HEAD(&vgic_cpu->ap_list_head); + + XFREE(v->arch.vgic.private_irqs); } =20 /* --=20 2.52.0 From nobody Thu Jan 8 12:40:00 2026 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; 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=1766421651; cv=none; d=zohomail.com; s=zohoarc; b=cjO3RCAWSA1Idagxi8fBVHVsEPOhs9rQPgwOXRv2FB39Tujd2wXZ3UX5jfxwUIfhsT3kVefqlfPa1F6aAunv+UNNB2b3Aj165FJ3meZTqxSIp25AZGQX0Rianj0SNF96zoO5clbSJLK/iMAix8eOQYygL1IcqNOe/1lgiofmbMQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766421651; 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=MiuT8oSvj+MLPsSg+EzFKiW/rD8qP9UmSvVnyWvKe2s=; b=ZZXSh54Z304nyVaHqZIfdAxJFFwTP9J24DFBj+X/OpjL5KgXOfhFu4c/ukwRz1PFLrSTj+S9jVIJUzVdWBcLK2J2KFqcEtC5UJdqmZmCkC2NQ+8LCvsOBgKCxPM2eXj902KWZ/AqLtEaB+tnwZrBsOoOIt8ae0Ad+FOxG2FkAzo= 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 1766421651735792.9420357164759; Mon, 22 Dec 2025 08:40:51 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1192199.1511560 (Exim 4.92) (envelope-from ) id 1vXixU-0005CQ-1K; Mon, 22 Dec 2025 16:40:32 +0000 Received: by outflank-mailman (output) from mailman id 1192199.1511560; Mon, 22 Dec 2025 16:40:32 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vXixT-0005CJ-V2; Mon, 22 Dec 2025 16:40:31 +0000 Received: by outflank-mailman (input) for mailman id 1192199; Mon, 22 Dec 2025 16:40:30 +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 1vXixS-0004ka-BI for xen-devel@lists.xenproject.org; Mon, 22 Dec 2025 16:40:30 +0000 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [2a00:1450:4864:20::632]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id ece3a45d-df54-11f0-b15b-2bf370ae4941; Mon, 22 Dec 2025 17:40:29 +0100 (CET) Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-b728a43e410so757206666b.1 for ; Mon, 22 Dec 2025 08:40:29 -0800 (PST) Received: from fedora (user-109-243-71-38.play-internet.pl. [109.243.71.38]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b8037f3e271sm1137038366b.60.2025.12.22.08.40.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Dec 2025 08:40:28 -0800 (PST) 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: ece3a45d-df54-11f0-b15b-2bf370ae4941 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1766421629; x=1767026429; 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=MiuT8oSvj+MLPsSg+EzFKiW/rD8qP9UmSvVnyWvKe2s=; b=WMKtMquiehDvuDQzGKDhqMiqm8Ryy6tTJR4A3C4R4Syn2cq6DRg9O2YazmIYdQtAQn Kdi1fekK3zN+ZY9eoFxRmGYkZGIbQR6vwzobloqGun50TxMCDiC/ayov3t+eUMGrsHIL ugkvuM9JW/LUDGCUnuyHO2vVkIw4w78USsT+SFNOhiM9h+IoV85L6GyUCd4pJVXaN1G9 tOg4rZau+3RYL5PoXnM390dnFMRHKle6zgzqFTD7j3YhXnTbRY0zHzvGMJgof057I9wY aB0NDjZxJnDLTPgJ2SnqRHGU9xDSB9cLfmnXDMaKsx2X3CTnaTeinxWwF+mmwcvV46m8 FDnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766421629; x=1767026429; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=MiuT8oSvj+MLPsSg+EzFKiW/rD8qP9UmSvVnyWvKe2s=; b=g7BfraWBcpeG3QsDKSTwETezZpwi7xk7okNIhjEC0341ptQwzNFNT+hpeHOwPNc2Px YnA+Ctz7IDPEJhqnr5FMaco6D1dxNns3u9GS4hXE4Q6z7J3qRDioiJ/6aSoWurrAvEWJ u8j/eq98fDggC4sdidkXZ4nKc0fK+RitwEWirqAc65wnc5c7MtHwK7fo9bcOzq5MC1G1 rUm7k8Q9V4ZEkFWsJyK8hJutxJSmmWZ5XWP/FEfaZnyFoDYEN5xP3y9mpvjkWGzRniXy 5wU+6e8sDYJUvJz5tJo65ej40/tVJPHkiyFCchIpk3af0o3vsMYmoYe/sb7fFo0BYoOs pPew== X-Gm-Message-State: AOJu0Yyx1dolLSQSo2sNYtht008lzMtpEj+Fp6eD+RSp4AP1PVnLy9hF OiXsqxoUh6BJ7KMJ50Ro3ljbsdVlvwQJkSbl1Rjn32I1Ed5zA2mlhVkNhCkiEQ== X-Gm-Gg: AY/fxX5/bPPFVV4THEZWbI3C8dsxmQtmA6GqizKR9Rz8RTriM1sBvpLc9gr4j6hbzEt AevS5vgDNi5wf76fFMkKZLZZ22fksAWJpp89Zk1bk/O6AXFJRHEQIQEeDEr1wPMizvmxnj1/WqH f54Vywv76K02LiGPt7xLoo8KhsbZbBls3QN5X7gv+MCga/WYeiCtlXPdFeYQSUFGrxYHdRI0BFU Efs96NMkDRUsBVu40AoQFlOfgjo8tFtGiX43Vfi//gmnTU9aae+jl9glULdY0YAe7YCYaRGZah8 Yxywhtdwq4T3vOR7O1hju0dpn7kbWos4MejZQmmSC26lXGGPNY4sPdAAQmBzPjie5TxcRGV3KFL excxJxp0L+g8kH9VULHXBIVPW36IvpGcgiCE7hEswI3wuOy+z5XS9Mdc9q0gYQymLOtrL1c/dOu YLOmNLhGrhYzhe4Y5I4ltg0mhO4ZOqWfD/YJJWM4kz/2PSMoHt2FYTuZBpjfOWdQpVwg== X-Google-Smtp-Source: AGHT+IEW+mCBAx+0gzYpyaeUbRqBMcJTDfKmg9Trf84GxY3NBWOhFrcLZM1qo+piUXdJh3lrvdzIUQ== X-Received: by 2002:a17:906:2081:b0:b80:411f:aa50 with SMTP id a640c23a62f3a-b80411faa6emr825114466b.48.1766421628360; Mon, 22 Dec 2025 08:40:28 -0800 (PST) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Oleksii Kurochko , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Andrew Cooper , Anthony PERARD , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Timothy Pearson , Alistair Francis , Bob Eshleman , Connor Davis Subject: [PATCH v3 3/4] xen: move alloc/free_vcpu_struct() to common code Date: Mon, 22 Dec 2025 17:40:13 +0100 Message-ID: <31208135cc61a8c8e593a286d450c2ec7757d118.1766404618.git.oleksii.kurochko@gmail.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1766421652167158500 Content-Type: text/plain; charset="utf-8" alloc_vcpu_struct() and free_vcpu_struct() contain little architecture-specific logic and are suitable for sharing across architectures. Move both helpers to common code. To support the remaining architectural differences, introduce arch_vcpu_struct_memflags(), allowing architectures to override the memory flags passed to alloc_xenheap_pages(). This is currently needed by x86, which may require MEMF_bits(32) for HVM guests using shadow paging. The ARM implementation of alloc/free_vcpu_struct() is removed and replaced by the common version. Stub implementations are also dropped from PPC and RISC-V. Now that the size of struct vcpu for Arm64 is smaller than PAGE_SIZE, MAX_PAGES_PER_VCPU is no longer needed and is removed. Finally, make alloc_vcpu_struct() and free_vcpu_struct() static to common/domain.c, as they are no longer used outside common code. No functional changes. Signed-off-by: Oleksii Kurochko Acked-by: Jan Beulich Reviewed-by: Andrew Cooper with the --- Changes in v3: - Make from function arch_vcpu_struct_memflags() a macros in asm/domain.h. - Drop forward declaration of arch_vcpu_struct_memflags() in asm/domain.h. - Update defintion of arch_vcpu_stuct_memflags() in alloc_vcpu_struct(). --- Changes in v2: - Rework alloc/free_vcpu_struct() to work with only one page. - Return back the comment about the restriction inside x86's arch_vcpu_struct_memflags(). - Drop MAX_PAGES_PER_VCPU. --- xen/arch/arm/domain.c | 32 ------------------------------- xen/arch/ppc/stubs.c | 10 ---------- xen/arch/riscv/stubs.c | 10 ---------- xen/arch/x86/domain.c | 24 ----------------------- xen/arch/x86/include/asm/domain.h | 12 ++++++++++++ xen/common/domain.c | 20 +++++++++++++++++++ xen/include/xen/domain.h | 4 ---- 7 files changed, 32 insertions(+), 80 deletions(-) diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 47973f99d935..507df807edb8 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -473,38 +473,6 @@ void dump_pageframe_info(struct domain *d) =20 } =20 -/* - * The new VGIC has a bigger per-IRQ structure, so we need more than one - * page on ARM64. Cowardly increase the limit in this case. - */ -#if defined(CONFIG_NEW_VGIC) && defined(CONFIG_ARM_64) -#define MAX_PAGES_PER_VCPU 2 -#else -#define MAX_PAGES_PER_VCPU 1 -#endif - -struct vcpu *alloc_vcpu_struct(const struct domain *d) -{ - struct vcpu *v; - - BUILD_BUG_ON(sizeof(*v) > MAX_PAGES_PER_VCPU * PAGE_SIZE); - v =3D alloc_xenheap_pages(get_order_from_bytes(sizeof(*v)), 0); - if ( v !=3D NULL ) - { - unsigned int i; - - for ( i =3D 0; i < DIV_ROUND_UP(sizeof(*v), PAGE_SIZE); i++ ) - clear_page((void *)v + i * PAGE_SIZE); - } - - return v; -} - -void free_vcpu_struct(struct vcpu *v) -{ - free_xenheap_pages(v, get_order_from_bytes(sizeof(*v))); -} - int arch_vcpu_create(struct vcpu *v) { int rc =3D 0; diff --git a/xen/arch/ppc/stubs.c b/xen/arch/ppc/stubs.c index 9953ea1c6c08..f7f6e7ed97af 100644 --- a/xen/arch/ppc/stubs.c +++ b/xen/arch/ppc/stubs.c @@ -152,11 +152,6 @@ void dump_pageframe_info(struct domain *d) BUG_ON("unimplemented"); } =20 -void free_vcpu_struct(struct vcpu *v) -{ - BUG_ON("unimplemented"); -} - int arch_vcpu_create(struct vcpu *v) { BUG_ON("unimplemented"); @@ -264,11 +259,6 @@ void vcpu_kick(struct vcpu *v) BUG_ON("unimplemented"); } =20 -struct vcpu *alloc_vcpu_struct(const struct domain *d) -{ - BUG_ON("unimplemented"); -} - unsigned long hypercall_create_continuation(unsigned int op, const char *format, ...) { diff --git a/xen/arch/riscv/stubs.c b/xen/arch/riscv/stubs.c index 164fc091b28a..29bdb65afbdf 100644 --- a/xen/arch/riscv/stubs.c +++ b/xen/arch/riscv/stubs.c @@ -121,11 +121,6 @@ void dump_pageframe_info(struct domain *d) BUG_ON("unimplemented"); } =20 -void free_vcpu_struct(struct vcpu *v) -{ - BUG_ON("unimplemented"); -} - int arch_vcpu_create(struct vcpu *v) { BUG_ON("unimplemented"); @@ -233,11 +228,6 @@ void vcpu_kick(struct vcpu *v) BUG_ON("unimplemented"); } =20 -struct vcpu *alloc_vcpu_struct(const struct domain *d) -{ - BUG_ON("unimplemented"); -} - unsigned long hypercall_create_continuation(unsigned int op, const char *format, ...) { diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 7632d5e2d62d..c29a6b0decee 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -493,30 +493,6 @@ unsigned int arch_domain_struct_memflags(void) return MEMF_bits(bits); } =20 -struct vcpu *alloc_vcpu_struct(const struct domain *d) -{ - struct vcpu *v; - /* - * This structure contains embedded PAE PDPTEs, used when an HVM guest - * runs on shadow pagetables outside of 64-bit mode. In this case the = CPU - * may require that the shadow CR3 points below 4GB, and hence the who= le - * structure must satisfy this restriction. Thus we specify MEMF_bits(= 32). - */ - unsigned int memflags =3D - (is_hvm_domain(d) && paging_mode_shadow(d)) ? MEMF_bits(32) : 0; - - BUILD_BUG_ON(sizeof(*v) > PAGE_SIZE); - v =3D alloc_xenheap_pages(0, memflags); - if ( v !=3D NULL ) - clear_page(v); - return v; -} - -void free_vcpu_struct(struct vcpu *v) -{ - free_xenheap_page(v); -} - /* Initialise various registers to their architectural INIT/RESET state. */ void arch_vcpu_regs_init(struct vcpu *v) { diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/d= omain.h index 16cd45cc32c0..effb23a23416 100644 --- a/xen/arch/x86/include/asm/domain.h +++ b/xen/arch/x86/include/asm/domain.h @@ -15,6 +15,18 @@ unsigned int arch_domain_struct_memflags(void); #define arch_domain_struct_memflags arch_domain_struct_memflags =20 +/* + * This structure contains embedded PAE PDPTEs, used when an HVM guest + * runs on shadow pagetables outside of 64-bit mode. In this case the CPU + * may require that the shadow CR3 points below 4GB, and hence the whole + * structure must satisfy this restriction. Thus we specify MEMF_bits(32). + */ +#define arch_vcpu_struct_memflags(d) ({ \ + const struct domain *d_ =3D (d); \ + \ + (is_hvm_domain(d_) && paging_mode_shadow(d_) ? MEMF_bits(32) : 0); \ +}) + #define has_32bit_shinfo(d) ((d)->arch.has_32bit_shinfo) =20 /* diff --git a/xen/common/domain.c b/xen/common/domain.c index 93c71bc766b0..568a63b7c6a2 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -392,6 +392,26 @@ static int vcpu_teardown(struct vcpu *v) return 0; } =20 +static struct vcpu *alloc_vcpu_struct(const struct domain *d) +{ +#ifndef arch_vcpu_struct_memflags +# define arch_vcpu_struct_memflags(d) ((void)(d), 0) +#endif + struct vcpu *v; + + BUILD_BUG_ON(sizeof(*v) > PAGE_SIZE); + v =3D alloc_xenheap_pages(0, arch_vcpu_struct_memflags(d)); + if ( v ) + clear_page(v); + + return v; +} + +static void free_vcpu_struct(struct vcpu *v) +{ + free_xenheap_page(v); +} + /* * Destoy a vcpu once all references to it have been dropped. Used either * from domain_destroy()'s RCU path, or from the vcpu_create() error path diff --git a/xen/include/xen/domain.h b/xen/include/xen/domain.h index 8aab05ae93c8..644f5ac3f293 100644 --- a/xen/include/xen/domain.h +++ b/xen/include/xen/domain.h @@ -70,10 +70,6 @@ void domid_free(domid_t domid); struct domain *alloc_domain_struct(void); void free_domain_struct(struct domain *d); =20 -/* Allocate/free a VCPU structure. */ -struct vcpu *alloc_vcpu_struct(const struct domain *d); -void free_vcpu_struct(struct vcpu *v); - /* Allocate/free a PIRQ structure. */ #ifndef alloc_pirq_struct struct pirq *alloc_pirq_struct(struct domain *d); --=20 2.52.0 From nobody Thu Jan 8 12:40:00 2026 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; 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=1766421654; cv=none; d=zohomail.com; s=zohoarc; b=MWh2xyigOp7un+ekdcMLxzIJX7LLjtAGfwmJ+5bKqx9GWIHquI6EMltgv+B0YyOhtgd2qDgIQQA/zLzTC05TQDlvZ/cpAXgp5I9fq4NNyfyxhy7eFfTczvDwlpHEXH2p6vgm0/eDjgY6uRkS+nK7QpGktiUGle4eSqWOcXDLlm0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766421654; 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=BNwjdy5MtRkLCdiw0Mfj0t/kIGmvAi3hjA2xW/bh4o4=; b=Q/o3rXLNijCC8gh4DIzu87ZrRygAYE2R01Nr25CBPa3qqoepSSuwLG8vrpl8IcFiFlipUT9ZU+DplpP1eydU+4f3Rs3Jqp7hSIXI1nQS1gHkD51Y6QTq+u6kMxX7GF5zGdM793aKpoYDF7E12weEHr1okbRmAccCV9YAc8g3xN8= 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 1766421654290348.8267812678148; Mon, 22 Dec 2025 08:40:54 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1192201.1511576 (Exim 4.92) (envelope-from ) id 1vXixV-0005VM-PM; Mon, 22 Dec 2025 16:40:33 +0000 Received: by outflank-mailman (output) from mailman id 1192201.1511576; Mon, 22 Dec 2025 16:40:33 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vXixV-0005Ur-Eq; Mon, 22 Dec 2025 16:40:33 +0000 Received: by outflank-mailman (input) for mailman id 1192201; Mon, 22 Dec 2025 16:40:32 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vXixU-0004kh-3W for xen-devel@lists.xenproject.org; Mon, 22 Dec 2025 16:40:32 +0000 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [2a00:1450:4864:20::52a]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id ed780244-df54-11f0-9cce-f158ae23cfc8; Mon, 22 Dec 2025 17:40:30 +0100 (CET) Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-64b8e5d1611so4640919a12.3 for ; Mon, 22 Dec 2025 08:40:30 -0800 (PST) Received: from fedora (user-109-243-71-38.play-internet.pl. [109.243.71.38]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b8037f3e271sm1137038366b.60.2025.12.22.08.40.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Dec 2025 08:40:29 -0800 (PST) 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: ed780244-df54-11f0-9cce-f158ae23cfc8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1766421630; x=1767026430; 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=BNwjdy5MtRkLCdiw0Mfj0t/kIGmvAi3hjA2xW/bh4o4=; b=YSs8qS+VncWC9dzXbFkUwGEzjIldo/uflzsOMlavn+ivaPArqKKRwKTXckB/iVOuuC 6ymM79VpIfIW60rqLUjPSnQoylLJpxc9ZTqvfxHoCN7Ng5EsE525nSWmT4IE3q+lyZaT zhFqpJZFoeDIhH4CmDSx8YXz3MbEdFTB5XmNX43M5mgsiTpeI2xXewcAjg3wipNnTGI0 1n1SioIibhoHJP7tX2XP+uJ1eb9uAwTKFF414mh31N1TCpnDpBdH8mMMOtbglAM4CKRR nYynshCubjlHaqvy4DT/SZdKLGHaikeyhgsjpZg8/Sifufn89h+JtiAPkPiQaHxIg7sB S7kQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766421630; x=1767026430; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=BNwjdy5MtRkLCdiw0Mfj0t/kIGmvAi3hjA2xW/bh4o4=; b=WHKvmZ2Fv+vlAprnkq0dcUvPqS9OhtgdNeoZWtcvVcvO43TQY/qOrvD+6u7O432fSL B5fj41pnbbihjTdaHJoUnaxLb3DLVx1qutwD3J2CxRtV653aRSRc0PiEJbK8I50yLPv+ vGUvU8DTKHf1exZpmDhQ2iKUMz4LSNVsg3Uw8x4k/1omOFkUTKOtf8fiNT5jXxfqQgj2 n5RIdr+K3x/wr4RwO3nX0KG0dPE8AwSwUaXbWiQ4W2Ad832f6VWmcaFXMUv4Dh7k/+gp Pp4mSSHVWUl5p3HojDo+h5uAFj9DdnN14B3iYTHsptN19DWTFlIvE20Pu9ILQen6L1Uf I1pA== X-Gm-Message-State: AOJu0YzMXRBSWijgrOUSeJhtpEem1JEc16vlHQZZhtL1DMmh6hZKmFQD OaaH2tmL7a4G/8SkkEv31qrjomTbhMli9qjV2cQTmwCnW/dbNDwE3ACQR3/LWQ== X-Gm-Gg: AY/fxX71McsQKAAYTdTf9pgqxBsFW5EFtz7tS1VGpA3n8QRrtq9PKkcutVKJdZtoJ79 iq6S7BkB9uOOyPgbp/YRnofakJCal2dnKN12dXl0odp3Dc7swHH2m9+MjVfjP6g4AKUHEWqR6Hq HgPk0pP+SOaHufaKoGTpYPgpkqL6i+0JYYISuMy7jHNH81K68yE7te70nuU9sMrn3Fy0QOsy2wp VE9ibFhtRTYuFaId1X2ayT4lmzTO7cJKgP95NQ+iGTZv71Ys9q0VrdvORovgiaLi6P4KsINwJvc NaAsHNpwQPtW9A2hKds6hnswz9QA+seJCUH+4Fds+nBmwUtjdeULgDI7X609KD7xpxzONBdV522 GMBR7N+h/BmbiDjqRuGWNbbV51xTQ1vulG0Ag1hDz69j9v/Gjvv8AxNkvy42SXhH+o2OCE0k0yd fMUqe37ag9Z+cU2YW5KVZoa9/kkp4jOJqVCCNWnFy4xNwING46z9BZgp0= X-Google-Smtp-Source: AGHT+IFHbT58UFSAVUgtzRFhJKpDVbA/0v4hEH5GInvzZ4YJae2oeQe5zduQcBln5eMzXtvd4JIFsA== X-Received: by 2002:a17:907:7fa8:b0:b73:572d:3b07 with SMTP id a640c23a62f3a-b8036fac50amr1281809566b.28.1766421629522; Mon, 22 Dec 2025 08:40:29 -0800 (PST) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Oleksii Kurochko , Andrew Cooper , Anthony PERARD , Michal Orzel , Jan Beulich , Julien Grall , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Stefano Stabellini Subject: [PATCH v3 4/4] xen/common: make {alloc,free}_domain_struct() static Date: Mon, 22 Dec 2025 17:40:14 +0100 Message-ID: <07e8305e7d9730f65822f43ecefb7543b08f764b.1766404618.git.oleksii.kurochko@gmail.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1766421656115158500 Content-Type: text/plain; charset="utf-8" As {alloc,free}_domain_struct() are used only within domain.c, they can be declared static and their declarations removed from xen/domain.h. Signed-off-by: Oleksii Kurochko Acked-by: Andrew Cooper --- Changes in v3: - Move alloc_domain_struct() and free_domain_struct() to not have forward declaration. - Add Acked-by: Andrew Cooper . --- Changes in v2: - New patch. --- xen/common/domain.c | 42 ++++++++++++++++++++-------------------- xen/include/xen/domain.h | 4 ---- 2 files changed, 21 insertions(+), 25 deletions(-) diff --git a/xen/common/domain.c b/xen/common/domain.c index 568a63b7c6a2..7a3e5ce6593f 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -690,6 +690,27 @@ static int domain_teardown(struct domain *d) return 0; } =20 +static struct domain *alloc_domain_struct(void) +{ +#ifndef arch_domain_struct_memflags +# define arch_domain_struct_memflags() 0 +#endif + + struct domain *d =3D alloc_xenheap_pages(0, arch_domain_struct_memflag= s()); + + BUILD_BUG_ON(sizeof(*d) > PAGE_SIZE); + + if ( d ) + clear_page(d); + + return d; +} + +static void free_domain_struct(struct domain *d) +{ + free_xenheap_page(d); +} + /* * Destroy a domain once all references to it have been dropped. Used eit= her * from the RCU path, or from the domain_create() error path before the do= main @@ -819,27 +840,6 @@ static int sanitise_domain_config(struct xen_domctl_cr= eatedomain *config) return arch_sanitise_domain_config(config); } =20 -struct domain *alloc_domain_struct(void) -{ -#ifndef arch_domain_struct_memflags -# define arch_domain_struct_memflags() 0 -#endif - - struct domain *d =3D alloc_xenheap_pages(0, arch_domain_struct_memflag= s()); - - BUILD_BUG_ON(sizeof(*d) > PAGE_SIZE); - - if ( d ) - clear_page(d); - - return d; -} - -void free_domain_struct(struct domain *d) -{ - free_xenheap_page(d); -} - struct domain *domain_create(domid_t domid, struct xen_domctl_createdomain *config, unsigned int flags) diff --git a/xen/include/xen/domain.h b/xen/include/xen/domain.h index 644f5ac3f293..273717c31b3f 100644 --- a/xen/include/xen/domain.h +++ b/xen/include/xen/domain.h @@ -66,10 +66,6 @@ void domid_free(domid_t domid); * Arch-specifics. */ =20 -/* Allocate/free a domain structure. */ -struct domain *alloc_domain_struct(void); -void free_domain_struct(struct domain *d); - /* Allocate/free a PIRQ structure. */ #ifndef alloc_pirq_struct struct pirq *alloc_pirq_struct(struct domain *d); --=20 2.52.0