From nobody Sun Nov 24 10:35:36 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=1725466583; cv=none; d=zohomail.com; s=zohoarc; b=TnXLUvJ95f0CRL57CCa4rzniCXMZ8k31+cOCualP8KYkRhX33jK15TD0Obnr1/GhNvYwcYDPFrRSiAzaZQElmuzMnYkOQGhb2iQecmyoxB2oYPE/viEMfhLIijCJT4Mql52rpEe7Dm3OSvFcbbuggOtbUgsRU0dCwxuZVdzd1hE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725466583; 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=+QaVLnXt0IgeqG1OF+UMCmmf0V+2Gd+nNBZAoCF8K30=; b=XhLRMc+WBV+BUupIpWq42IsvOYCcguHDxkhIT+FEbbA1f9niD1GynCDW9Lzy/3Bjz3HSJ9NdhIgy/86zIKlki0TvxvDsBxJHbhLpp5jueL43F3+53QEiBMV/jqh4pzR4BtbLEDd/B7+MnyNt+TSY1+9/GhQI+bFXjKfP/2z+FPE= 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 1725466583427369.43127543878984; Wed, 4 Sep 2024 09:16:23 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.790549.1200363 (Exim 4.92) (envelope-from ) id 1slsfc-00011N-Cw; Wed, 04 Sep 2024 16:15:48 +0000 Received: by outflank-mailman (output) from mailman id 790549.1200363; Wed, 04 Sep 2024 16:15:48 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1slsfc-00011A-7t; Wed, 04 Sep 2024 16:15:48 +0000 Received: by outflank-mailman (input) for mailman id 790549; Wed, 04 Sep 2024 16:15:47 +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 1slsfb-0000I6-G0 for xen-devel@lists.xenproject.org; Wed, 04 Sep 2024 16:15:47 +0000 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [2a00:1450:4864:20::132]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id f18eee98-6ad8-11ef-a0b3-8be0dac302b0; Wed, 04 Sep 2024 18:15:47 +0200 (CEST) Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-5356bb55224so348894e87.0 for ; Wed, 04 Sep 2024 09:15:47 -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 2adb3069b0e04-535408286b2sm2393762e87.172.2024.09.04.09.15.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2024 09:15:45 -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: f18eee98-6ad8-11ef-a0b3-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725466546; x=1726071346; 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=+QaVLnXt0IgeqG1OF+UMCmmf0V+2Gd+nNBZAoCF8K30=; b=YuJMezjreqR8JhAYxFCLERe+hktzK7miBRt/IdZsf/8pkz+uQBxbGdcvhiSftmG2KA oC5Rtm1YSt4bA8LPD6Uoi88lLOSwVhK6YKSp5wVRANCNHCGM5DwLduw/WfHFYU98caT2 50xLCe7KgCYUemIbpKrYlgTbduwG2pyM/zw2JxtWnlNuPUL4grZ34YAhgi0sg6j1vENj /LyJDlmjwVe861GvS3afPSgGxWmMcizzNzyAlWw/Ct0HZM2/5yij3pnSr52Jb/1iMwmo AbXzmHJPD7tNKZ75ei6PkYXjBkaOx0j4wXY4bQMSj2ZjIJT8c5Hsm84dTvrUvqum2O5B XmFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725466546; x=1726071346; 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=+QaVLnXt0IgeqG1OF+UMCmmf0V+2Gd+nNBZAoCF8K30=; b=jaD3Vd+57MGqaT7U6PdAUa8IpjXV8D9bweedJrXk8qClqCRgkm0uxMzLWhUZPnxhGS M2eAsfs/n6LkORS1ke6T2b0Hzwq10CBLN2i0yljUgz8asNtoGA8hO9WD/F9kf78QXMsr mzI+Z9wcyqUqxEQ1whNyMkU0/lBYJIaj+PuMvLLJhHedgVIh1frdYMj7eLQLDUu4GJn5 +VgP/LqayARO/KLCCtywuUe90WKZOZrGJGqNCyQkITj9bBQl+WKbMO2UNKa50IrdYnK0 dL7j8uaJLAyue52G9NgKMPwQ3B0VJt8Y27c9c6AuUjjgjWKme1B7rXo5Q0dy/MkvDm7T Hv3g== X-Forwarded-Encrypted: i=1; AJvYcCW9R1w1IpqN3Ve+aJ5kBzUlSEwREXI0Cm97JOMiufEuGgbLynm02W3m3YmdvVfL1EYJHpNHF1S8YSM=@lists.xenproject.org X-Gm-Message-State: AOJu0YzPUVXV62bYsAGsGSRscWZD/Twg4ZKZgB72NxcFfkGKM8usjNmo L4AJuXIEONjmlKFLXvJMpc0Ef5j4emc47CL47tOu55dtKjlRrc/v X-Google-Smtp-Source: AGHT+IEVrMi7SUj3gDc4PnljMDbfUGQS9M6WFx0DSiUFiYCkcinXMFPRnZOAOrty7uworisOgwpFVQ== X-Received: by 2002:a05:6512:3e08:b0:52f:2ea:499f with SMTP id 2adb3069b0e04-53546b3b1d7mr12943686e87.24.1725466546316; Wed, 04 Sep 2024 09:15:46 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Cc: sstabellini@kernel.org, anthony@xenproject.org, paul@xen.org, peter.maydell@linaro.org, alex.bennee@linaro.org, xenia.ragiadakou@amd.com, jason.andryuk@amd.com, edgar.iglesias@amd.com, xen-devel@lists.xenproject.org, qemu-arm@nongnu.org Subject: [PULL v1 04/12] hw/arm: xenpvh: Add support for SMP guests Date: Wed, 4 Sep 2024 18:15:28 +0200 Message-ID: <20240904161537.664189-5-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240904161537.664189-1-edgar.iglesias@gmail.com> References: <20240904161537.664189-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1725466584700116600 Content-Type: text/plain; charset="utf-8" From: "Edgar E. Iglesias" Add SMP support for Xen PVH ARM guests. Create ms->smp.max_cpus ioreq servers to handle hotplug. Note that ms->smp.max_cpus will be passed to us by the user (Xen tools) set to the guests maxvcpus. The value in mc->max_cpus is an absolute maximum for the -smp option and won't be used to setup ioreq servers unless the user explicitly specifies it with -smp. If the user doesn't pass -smp on the command-line, smp.cpus and smp.max_cpus will default to 1. Signed-off-by: Edgar E. Iglesias Reviewed-by: Stefano Stabellini --- hw/arm/xen_arm.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/hw/arm/xen_arm.c b/hw/arm/xen_arm.c index 5f75cc3779..fda65d0d8d 100644 --- a/hw/arm/xen_arm.c +++ b/hw/arm/xen_arm.c @@ -173,7 +173,7 @@ static void xen_arm_init(MachineState *machine) =20 xen_init_ram(machine); =20 - xen_register_ioreq(xam->state, machine->smp.cpus, &xen_memory_listener= ); + xen_register_ioreq(xam->state, machine->smp.max_cpus, &xen_memory_list= ener); =20 xen_create_virtio_mmio_devices(xam); =20 @@ -218,7 +218,26 @@ static void xen_arm_machine_class_init(ObjectClass *oc= , void *data) MachineClass *mc =3D MACHINE_CLASS(oc); mc->desc =3D "Xen PVH ARM machine"; mc->init =3D xen_arm_init; - mc->max_cpus =3D 1; + + /* + * mc->max_cpus holds the MAX value allowed in the -smp command-line o= pts. + * + * 1. If users don't pass any -smp option: + * ms->smp.cpus will default to 1. + * ms->smp.max_cpus will default to 1. + * + * 2. If users pass -smp X: + * ms->smp.cpus will be set to X. + * ms->smp.max_cpus will also be set to X. + * + * 3. If users pass -smp X,maxcpus=3DY: + * ms->smp.cpus will be set to X. + * ms->smp.max_cpus will be set to Y. + * + * In scenarios 2 and 3, if X or Y are set to something larger than + * mc->max_cpus, QEMU will bail out with an error message. + */ + mc->max_cpus =3D GUEST_MAX_VCPUS; mc->default_machine_opts =3D "accel=3Dxen"; /* Set explicitly here to make sure that real ram_size is passed */ mc->default_ram_size =3D 0; --=20 2.43.0