From nobody Fri Oct 31 09:32:49 2025 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=1749830219; cv=none; d=zohomail.com; s=zohoarc; b=oE/Q1ZqrqFAMbcZFrh+2psUUUr6s+UCytw8A1c6SnUHHUBuNHiHWGhP93hyVv49UKzJIP3ZLolnACrj9QTz1xOnZJTDJTg3vKp+n3ypyp73wPXNDB+h4PmOTQpLh/a5E6KMY+hGpoqxG8//PMKoQ6Tdeiz5B+pemYqdZvvySv18= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749830219; h=Content-Type: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=tBkHTslrkdQm/XhjgO6ug1lELXFf148eDSnYyMvV87A=; b=JTU/zubz+i/EG5v+wwzOhqoWTEls2Ee2TLUTICgAPu0DI1rmWDwf7XzE87AS9isyUEfrAmxgtgStqnhYiQvPOhXnZwjRrIsoQ9YGL82Tx+nDwzibxFrn0eCVCYTQhyj4A7QvfSK0M4cu37lTFFAkRUWITXKSgsFSxBqJv4CP9AQ= 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 1749830219933554.3508008982316; Fri, 13 Jun 2025 08:56:59 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1014704.1392846 (Exim 4.92) (envelope-from ) id 1uQ6lr-0006IS-5f; Fri, 13 Jun 2025 15:56:47 +0000 Received: by outflank-mailman (output) from mailman id 1014704.1392846; Fri, 13 Jun 2025 15:56:47 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uQ6lr-0006IL-2r; Fri, 13 Jun 2025 15:56:47 +0000 Received: by outflank-mailman (input) for mailman id 1014704; Fri, 13 Jun 2025 15:56:45 +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 1uQ6lp-0006Ge-Kq for xen-devel@lists.xenproject.org; Fri, 13 Jun 2025 15:56:45 +0000 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [2a00:1450:4864:20::532]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 008a3eab-486f-11f0-b894-0df219b8e170; Fri, 13 Jun 2025 17:56:43 +0200 (CEST) Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-607ec30df2bso4227443a12.1 for ; Fri, 13 Jun 2025 08:56:43 -0700 (PDT) Received: from fedora.. (user-109-243-64-38.play-internet.pl. [109.243.64.38]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-608b4a93b03sm1357883a12.54.2025.06.13.08.56.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jun 2025 08:56:42 -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: 008a3eab-486f-11f0-b894-0df219b8e170 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1749830203; x=1750435003; 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=tBkHTslrkdQm/XhjgO6ug1lELXFf148eDSnYyMvV87A=; b=XvFGKq4hQFNfH2ERKQ/n6wKCv0tI23/f39vtPWWMEvFI1oouE9o1ANFSe2zTVusGv3 eEtEKLaaRPVWxooHNECO8EORUlscIing/JDUso/WN0HR1z9yT/ycDCVeuuJZqbiqm0zq GUZn4VM1nFJLPpC3p5QvvLGnJrO/Hqm7k+ZEnrKU4pbR/Q/yxl+y1MtgrkhVQ4up+D6y oyL7JF/pMPw8Eeqk4jEhyU4hfo4J7NXZxvYSOu2ldMJL6cAevUYlhLhhAXKz1MzxRJ72 oKnW70A0yXPUcr+1y68GQm60EsaohN6iRLbVNs8R5qlURigMep6usX6XSJpP7EzOfOdi rXUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749830203; x=1750435003; 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=tBkHTslrkdQm/XhjgO6ug1lELXFf148eDSnYyMvV87A=; b=M9+vEbldGzvXouvA35EWiUYULjipcZvdKtEe9yymJMPenJJqKULJ4Fh++1SCA1gH9x hhxDZK0ImdOLxB3tCmDrpdrxfWdHKebW4NtruR084044esh08E/z9xDO8esh9aWyWSxv ACpyL/uYuslDCn4/H9Z9QzAJyjENGRX+Gy6cIqunqsS95HkOh3exVyr4z26RJ74kvTd7 K+Uj10pzKA9E/DHHNjF6jDoCjog9EMU1xomWV3TxzzB9LUiOgW11vw0Ak3icpXqegJtU MkY0nq4QQ9ThD1xI8p1e23ygJUMp40871ESh1sdXXeEKpxaF3gpqjyii90xnz2Ex47Nf QDXQ== X-Gm-Message-State: AOJu0YxkbvvChJCsh9kZpj90TlCLbN2UgTfATU5opcGpT9bHO8deP7Jp nvElBEzuj5DL7GxVmijtR88cGfTKyn906SOX731X/g/fQedM8nKFPl7o65F5Xw== X-Gm-Gg: ASbGncsgYsDNKysDJHLe4ACUtnfmuWGoqycafKbm8FlL/AQndEELK8p3LihRlmuUL19 9kfRC8cT31qIFMcBOIQulPNgqf1gxs7Efwlg93ywjbIvMbDGxZf8kuos+aqFhqylR0V0f/ExwdF E6QrqoWE3QBpX0gnYd2HJ5ThgL1Fy02kfddVE62y3ixWBskN7tjdMOAktkOouiKVqTRwmOVaFrS KlSaUMehTLR8llL8e2LwEgGqSP6dp/H8CRcn0d1orPRI9dgC9s0JXLnz+g2bMxeFbXu4mlAfRwt emOzE8AJUr+Hoca19saWZMk2nf2AYBsZ8wDEik9x61MMJMVMyajDrsmOfzlMTE0csoo+2LKf8sy onI0Fwhpk52MrV60hVZ9hJ2OWIcZt X-Google-Smtp-Source: AGHT+IFc/KLR1BzJIRacmaOsU4mrBKrO7Fs3Y8ikB2f0saA3ZsckBb22OGO4cGnpnPlrkqrMJxQHFw== X-Received: by 2002:a05:6402:270d:b0:607:7aed:feef with SMTP id 4fb4d7f45d1cf-608b49fc0aamr3189540a12.34.1749830202560; Fri, 13 Jun 2025 08:56:42 -0700 (PDT) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Roger Pau Monne , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Andrew Cooper , Anthony PERARD , Jan Beulich , Shawn Anastasio , Alistair Francis , Bob Eshleman , Connor Davis , Oleksii Kurochko Subject: [PATCH v1 2/2] xen/domain: introduce generic weak function for domain struct allocation Date: Fri, 13 Jun 2025 17:56:36 +0200 Message-ID: X-Mailer: git-send-email 2.49.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1749830220789116600 From: Roger Pau Monne x86 has specific requirements about the allocation of the domain structure, but that's not the case for ARM or likely other architectures. Introduce a generic weak function that can be overwritten with an architecture specific implementation if required. No functional change intended. Signed-off-by: Roger Pau Monn=C3=A9 Reviewed-by: Oleksii Kurochko --- Changes: - Add Reviewed-by: Oleksii Kurochko . - Add empty line before last return in alloc_domain_struct(). --- xen/arch/arm/domain.c | 12 ------------ xen/arch/ppc/stubs.c | 5 ----- xen/arch/riscv/stubs.c | 5 ----- xen/common/domain.c | 14 ++++++++++++++ 4 files changed, 14 insertions(+), 22 deletions(-) diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 45aeb8bddc..29588f869c 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -479,18 +479,6 @@ void startup_cpu_idle_loop(void) reset_stack_and_jump(idle_loop); } =20 -struct domain *alloc_domain_struct(void) -{ - struct domain *d; - BUILD_BUG_ON(sizeof(*d) > PAGE_SIZE); - d =3D alloc_xenheap_pages(0, 0); - if ( d =3D=3D NULL ) - return NULL; - - clear_page(d); - return d; -} - void free_domain_struct(struct domain *d) { free_xenheap_page(d); diff --git a/xen/arch/ppc/stubs.c b/xen/arch/ppc/stubs.c index 671e71aa0a..d999d22718 100644 --- a/xen/arch/ppc/stubs.c +++ b/xen/arch/ppc/stubs.c @@ -294,11 +294,6 @@ void vcpu_kick(struct vcpu *v) BUG_ON("unimplemented"); } =20 -struct domain *alloc_domain_struct(void) -{ - BUG_ON("unimplemented"); -} - struct vcpu *alloc_vcpu_struct(const struct domain *d) { BUG_ON("unimplemented"); diff --git a/xen/arch/riscv/stubs.c b/xen/arch/riscv/stubs.c index e396b67cd3..155e5a7f58 100644 --- a/xen/arch/riscv/stubs.c +++ b/xen/arch/riscv/stubs.c @@ -268,11 +268,6 @@ void vcpu_kick(struct vcpu *v) BUG_ON("unimplemented"); } =20 -struct domain *alloc_domain_struct(void) -{ - BUG_ON("unimplemented"); -} - struct vcpu *alloc_vcpu_struct(const struct domain *d) { BUG_ON("unimplemented"); diff --git a/xen/common/domain.c b/xen/common/domain.c index e566a18747..c134868e95 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -785,6 +785,20 @@ static int sanitise_domain_config(struct xen_domctl_cr= eatedomain *config) return arch_sanitise_domain_config(config); } =20 +struct domain *__weak alloc_domain_struct(void) +{ + struct domain *d =3D alloc_xenheap_pages(0, 0); + + BUILD_BUG_ON(sizeof(*d) > PAGE_SIZE); + + if ( !d ) + return NULL; + + clear_page(d); + + return d; +} + struct domain *domain_create(domid_t domid, struct xen_domctl_createdomain *config, unsigned int flags) --=20 2.49.0