From patchwork Wed Sep 4 16:15:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 13791172 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D827FCD4857 for ; Wed, 4 Sep 2024 16:16:01 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.790547.1200342 (Exim 4.92) (envelope-from ) id 1slsfY-0000Wf-Ta; Wed, 04 Sep 2024 16:15:44 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 790547.1200342; Wed, 04 Sep 2024 16:15:44 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1slsfY-0000WY-R2; Wed, 04 Sep 2024 16:15:44 +0000 Received: by outflank-mailman (input) for mailman id 790547; Wed, 04 Sep 2024 16:15:44 +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 1slsfY-0000LO-5q for xen-devel@lists.xenproject.org; Wed, 04 Sep 2024 16:15:44 +0000 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [2a00:1450:4864:20::131]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id eeb42cf3-6ad8-11ef-99a1-01e77a169b0f; Wed, 04 Sep 2024 18:15:42 +0200 (CEST) Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-5344ab30508so878074e87.0 for ; Wed, 04 Sep 2024 09:15:42 -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-5356827b716sm205130e87.240.2024.09.04.09.15.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2024 09:15:41 -0700 (PDT) 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: eeb42cf3-6ad8-11ef-99a1-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725466542; x=1726071342; 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=0FTAVDz3Cw1uxIbhjmeqEYJqdjw34VbylOmDWLTwvx4=; b=kE56FOHGkJ2f/+QmFlXIQrb3P2CBidY+hb9fFrkJYtDs4VemXdRhEJqNaOwUYG+u3n QdfUZC6JtM+jpu7+RoG0/zDSSXPDuFRlmHNqkl2Lvbydsln4LICMUzX0PZQLtJvLmx3F 6aDUaHxsgJyTGPk4EZtblOgYDheKq+cPDof/CMOiUyYIfoNdFXYHhpzJ/yR5QjyUjxtJ 00eE87JnDscG7WGzq9dplK6n53xrRPz9xxYu8X2huHdQiLpRa12ohG1iCUHX3s2wr1NH 0tTJvEWMMNkhS60Rhr2dpngtIqmAVwnKg3hPUbeOV8sYfoSgMhDSrepbAuiD/YiIQANT YnTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725466542; x=1726071342; 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=0FTAVDz3Cw1uxIbhjmeqEYJqdjw34VbylOmDWLTwvx4=; b=JByuEM3wSYJJo5CQmgx7O1gLBTw/P8bGTxdYguw3jwhFanHRv3l+Ymuvf2oZtpQlmv 2XmOs84fAXKs7kf9WkQAtGHInNc9JuNs7aEQouagAWpjQFjKNANDWL98fyJGWRFy4ibQ 95Bha24Yf7hOCkfxfwuk+1JTgeY/uUi8AHMtcEh28TZ2OQZiHB+1o3VSiU7wVXLrivn5 IbmHTZIL/q8HyTDBgc8gHWCu+OLtAn7flT0rz3tSmwCOGU4SFqRynhmLQJXgy37yLV4T 10eatEYER6ISfr8+3AwDXLwcpLOh2GEBRLzjA10dRDy5Od594O2bL9nSkcSjI4/l060b BI1A== X-Forwarded-Encrypted: i=1; AJvYcCUHuxd+wNr+a5X/rIm+twW6RiDLYfmyzE0IadWR0U4lo9N4uFgpqXe7ihjGFDKZ74wHVfYzf6c04IU=@lists.xenproject.org X-Gm-Message-State: AOJu0Yyan0GUj/kMNcTxhg39+KQvSzYu/D1VqY5gIeKkEbno/JRUOgq3 dWzNoB18BjQvsyeIXAsz+gDD7yAUgAYbo0SJyOeQeIUI1PYA0szg X-Google-Smtp-Source: AGHT+IHC0J9+zgjr7h0VEYt97jGSExgSr1FAsQqqdgyp0zbhmgvQIcgxO+eUjmYELzyzyL1eJMTb6Q== X-Received: by 2002:a05:6512:4004:b0:52f:336:e846 with SMTP id 2adb3069b0e04-53567790120mr922274e87.14.1725466541521; Wed, 04 Sep 2024 09:15:41 -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 Subject: [PULL v1 01/12] MAINTAINERS: Add docs/system/arm/xenpvh.rst Date: Wed, 4 Sep 2024 18:15:25 +0200 Message-ID: <20240904161537.664189-2-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 From: "Edgar E. Iglesias" Signed-off-by: Edgar E. Iglesias Acked-by: Stefano Stabellini --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 3584d6a6c6..c2fb0c2f42 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -559,6 +559,7 @@ F: include/hw/xen/ F: include/sysemu/xen.h F: include/sysemu/xen-mapcache.h F: stubs/xen-hw-stub.c +F: docs/system/arm/xenpvh.rst Guest CPU Cores (NVMM) ---------------------- From patchwork Wed Sep 4 16:15:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 13791176 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 51725CD4853 for ; Wed, 4 Sep 2024 16:16:02 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.790548.1200353 (Exim 4.92) (envelope-from ) id 1slsfb-0000la-4w; Wed, 04 Sep 2024 16:15:47 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 790548.1200353; Wed, 04 Sep 2024 16:15: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 1slsfb-0000lR-19; Wed, 04 Sep 2024 16:15:47 +0000 Received: by outflank-mailman (input) for mailman id 790548; Wed, 04 Sep 2024 16:15: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 1slsfZ-0000LO-Mo for xen-devel@lists.xenproject.org; Wed, 04 Sep 2024 16:15:45 +0000 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [2a00:1450:4864:20::12d]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id efd333fb-6ad8-11ef-99a1-01e77a169b0f; Wed, 04 Sep 2024 18:15:44 +0200 (CEST) Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-5353d0b7463so11546062e87.3 for ; Wed, 04 Sep 2024 09:15:44 -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-535692d9bf6sm176315e87.41.2024.09.04.09.15.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2024 09:15:42 -0700 (PDT) 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: efd333fb-6ad8-11ef-99a1-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725466544; x=1726071344; 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=N6K1JnQDB3GxWbgLc2L3O0RRJjZo+EVTDK5d5nCO5jo=; b=Z6wqDmyUEzSyQYixezUdsWRzlKrCaKy3O1eMZsPNw1hDFN8rK2IVVLD98R2CaK/Rix zn+0NmRMDJW2CHh2b4s3HeXtDWSHo9AThZomxo2jf2pAVD3whkTToSAbza28jYbLHBil YF6tnInaRFUE6aZvwCOlUBwW59TMTXYziaG3tULtyoKev+2JBrgBykfjebHhS0VyMTfJ 14lTqGo8lSzMV2SffGEBtdfDKhPojvMayyEuuZDgBZ+0I5zffbic4/vre383IyuR/jc7 qZWjN/+ikoDRllpxfrQv2QFyBnc1qlr70E88kFO4gHUQz3+hIlNqewBoFEG0D7qpyzbS k54A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725466544; x=1726071344; 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=N6K1JnQDB3GxWbgLc2L3O0RRJjZo+EVTDK5d5nCO5jo=; b=cpthDARy5ojCu4doRFOBKYo/K+P2XpQoZ06JBn6LpGiydtY6qEir6Nz/MvIqngLa2L Va7YvTXAKVq+zpRCDmSRBsG+fia8ddhPQfd2lDjFbkT618BwLFDJ3Bh4cxB77Vb5MaWF BQOLlT48DpGVqfd8+wzv2/MFiySMl19bu09nXR82WlC5oMkgJ7Fk9SnvjSy6nei3JMLI 7OLKc4IPga9lqmZIQCJPdncnr/w4mxIGDWBLoep+iXHA0Tto52mzJSqWfpLq/gmwVJCh +GmQK+ZMJl5PVnbfBl/NuqctC33SUyANHLudjKzP90qRptDD7DWAm/R8Pz/D64oePfct 9ptg== X-Forwarded-Encrypted: i=1; AJvYcCWLD4jypQsH8lPKVdnh9kleW/EBEOpJy81VT5XC6uOiOim2C5Ng0+b8vWycxP8dgLf6ZPuWFkg4TIc=@lists.xenproject.org X-Gm-Message-State: AOJu0Ywtv06lU5rX/gQY9S/WseuCHiS/nN7apYhziQofT/Uzxd8fpm0y Rb2sotp3Qu0ACBUFwB0BrRSnSLjL9U5G/nMvDSf/RDxBsubzWUwePXgD4g+k X-Google-Smtp-Source: AGHT+IFom4VEXuZYnoDrA4HGURvL615ZNQmYPSqV45hP6uADwmwNAHyfJ2jP5ftIt03oSUiu6NVu1A== X-Received: by 2002:ac2:4e06:0:b0:533:483f:9562 with SMTP id 2adb3069b0e04-53546bde03emr15776888e87.42.1725466543416; Wed, 04 Sep 2024 09:15:43 -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 02/12] hw/arm: xenpvh: Update file header to use SPDX Date: Wed, 4 Sep 2024 18:15:26 +0200 Message-ID: <20240904161537.664189-3-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 From: "Edgar E. Iglesias" Update file header to use SPDX and remove stray empty comment line. No functional changes. Signed-off-by: Edgar E. Iglesias Acked-by: Stefano Stabellini --- hw/arm/xen_arm.c | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/hw/arm/xen_arm.c b/hw/arm/xen_arm.c index 6fad829ede..766a194fa1 100644 --- a/hw/arm/xen_arm.c +++ b/hw/arm/xen_arm.c @@ -1,24 +1,7 @@ /* * QEMU ARM Xen PVH Machine * - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. + * SPDX-License-Identifier: MIT */ #include "qemu/osdep.h" From patchwork Wed Sep 4 16:15:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 13791177 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2878FCD4F25 for ; Wed, 4 Sep 2024 16:16:03 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.790550.1200373 (Exim 4.92) (envelope-from ) id 1slsfd-0001HX-JE; Wed, 04 Sep 2024 16:15:49 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 790550.1200373; Wed, 04 Sep 2024 16:15:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1slsfd-0001HK-Fa; Wed, 04 Sep 2024 16:15:49 +0000 Received: by outflank-mailman (input) for mailman id 790550; Wed, 04 Sep 2024 16:15:48 +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 1slsfc-0000LO-7f for xen-devel@lists.xenproject.org; Wed, 04 Sep 2024 16:15:48 +0000 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [2a00:1450:4864:20::229]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id f154288c-6ad8-11ef-99a1-01e77a169b0f; Wed, 04 Sep 2024 18:15:46 +0200 (CEST) Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2f64cc05564so22260011fa.2 for ; Wed, 04 Sep 2024 09:15:46 -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-2f614f0079fsm25852041fa.37.2024.09.04.09.15.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2024 09:15:44 -0700 (PDT) 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: f154288c-6ad8-11ef-99a1-01e77a169b0f 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=cXrv0E3MFlFU+ItFyAOjyjeGygFPyj9i38Ckg44wQ0M=; b=Wwlle8RaUHbngUqlRcuZdxOglGOywJ2vTEfbgbadSewuQu0dVRN2CKXD2kEV5oSsG6 Os7OlgTwAybOEaOascU3M3KpL83DbkeuXWMpb5zyuPl/WoteJIzvBRbhXAo1vDpJVCg6 DGT2kJjCIzKglgZZvBvt2J3xADawPsMBGsPZknaP9k5TifP61Z2CcGmxPY8FOdGImypu YpP/tih3SeQKaDY2+0u7L+EBSVx4l1WFgDYavb2wxB3xSmTS20IvejFZ0mvjK2uXWTbk SYAyq7inJnmg0keUrs53L0c5wm5y53DlTblxbRBKUjBhxrvcvEj8vHeV7M7kmvZm0MO9 F7WQ== 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=cXrv0E3MFlFU+ItFyAOjyjeGygFPyj9i38Ckg44wQ0M=; b=E5YTP/2EpQjI1n9oBO5GU+bZaa6QyEJGYlsB935rxdStMYakzHCW875Ed42E6ej9/W +9JAgFp8Vgeq4Tnr7WDwSAYJIaMbky7rEUasjamMhQ0Rw6a2ikicvFkJD4CTCm04HnEq YyzEEIMffNyzWXAqUeBFW8mQhIGcz9cR7CLI14r9g99O/BTqpuTG9tnwNrDjjuHPzJsh x1fuagywVpXPUfxTmsU8Pl7XLf0QAquUpTuog0+DswGfX3xmb7hBeETFQkHF07NMJeix wh5HEXX0vq41yV5B7L+0HpTnYgZF8HpnntFrCxaDT9/XB53exUxzbBTvWVWMjF+cTx6p sNOw== X-Forwarded-Encrypted: i=1; AJvYcCV8UcbnrP+Uk68Ii89FESNebzEMXU3eXNHEVHZpX3dJZxL0owl+JEfqOraa+jYPoT5iyTxEv5Zbegs=@lists.xenproject.org X-Gm-Message-State: AOJu0Yz15F2laXayjrBY5g62Pa+GmMd/rsQI/sATGe2Yzk2xmX4h1mv+ IClg2ot+afaXesogvZBm1YmIwXyyY0vIeoyLBpSFTMg9VeCWq4iF X-Google-Smtp-Source: AGHT+IGAyh4WUxY9AfkVPMwTqyaGKO5sye5d21g+iPTe1bXZL4tYnRRSXSRVmyNk0vZJE9XGQJOMBA== X-Received: by 2002:a2e:a586:0:b0:2f3:f4e2:869c with SMTP id 38308e7fff4ca-2f64d570e98mr37440521fa.44.1725466545191; Wed, 04 Sep 2024 09:15:45 -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 03/12] hw/arm: xenpvh: Tweak machine description Date: Wed, 4 Sep 2024 18:15:27 +0200 Message-ID: <20240904161537.664189-4-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 From: "Edgar E. Iglesias" Tweak machine description to better express that this is a Xen PVH machine for ARM. Signed-off-by: Edgar E. Iglesias Reviewed-by: Stefano Stabellini --- hw/arm/xen_arm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/arm/xen_arm.c b/hw/arm/xen_arm.c index 766a194fa1..5f75cc3779 100644 --- a/hw/arm/xen_arm.c +++ b/hw/arm/xen_arm.c @@ -216,7 +216,7 @@ static void xen_arm_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); - mc->desc = "Xen Para-virtualized PC"; + mc->desc = "Xen PVH ARM machine"; mc->init = xen_arm_init; mc->max_cpus = 1; mc->default_machine_opts = "accel=xen"; From patchwork Wed Sep 4 16:15:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 13791173 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 552D0CD4F22 for ; Wed, 4 Sep 2024 16:16:02 +0000 (UTC) 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 X-Outflank-Mailman: Message body and most headers restored to incoming version 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-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 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) xen_init_ram(machine); - xen_register_ioreq(xam->state, machine->smp.cpus, &xen_memory_listener); + xen_register_ioreq(xam->state, machine->smp.max_cpus, &xen_memory_listener); xen_create_virtio_mmio_devices(xam); @@ -218,7 +218,26 @@ static void xen_arm_machine_class_init(ObjectClass *oc, void *data) MachineClass *mc = MACHINE_CLASS(oc); mc->desc = "Xen PVH ARM machine"; mc->init = xen_arm_init; - mc->max_cpus = 1; + + /* + * mc->max_cpus holds the MAX value allowed in the -smp command-line opts. + * + * 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=Y: + * 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 = GUEST_MAX_VCPUS; mc->default_machine_opts = "accel=xen"; /* Set explicitly here to make sure that real ram_size is passed */ mc->default_ram_size = 0; From patchwork Wed Sep 4 16:15:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 13791174 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 02C3ACD4F21 for ; Wed, 4 Sep 2024 16:16:02 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.790551.1200383 (Exim 4.92) (envelope-from ) id 1slsfe-0001Xe-Sb; Wed, 04 Sep 2024 16:15:50 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 790551.1200383; Wed, 04 Sep 2024 16:15:50 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1slsfe-0001XX-Ns; Wed, 04 Sep 2024 16:15:50 +0000 Received: by outflank-mailman (input) for mailman id 790551; Wed, 04 Sep 2024 16:15:49 +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 1slsfd-0000I6-7r for xen-devel@lists.xenproject.org; Wed, 04 Sep 2024 16:15:49 +0000 Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [2a00:1450:4864:20::22d]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id f291fd57-6ad8-11ef-a0b3-8be0dac302b0; Wed, 04 Sep 2024 18:15:48 +0200 (CEST) Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2f4f2868783so69438201fa.2 for ; Wed, 04 Sep 2024 09:15:48 -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-2f614ed192dsm26313971fa.7.2024.09.04.09.15.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2024 09:15:46 -0700 (PDT) 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: f291fd57-6ad8-11ef-a0b3-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725466548; x=1726071348; 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=4UdvH3BfQ7ZFjeKvJ3vJphtRrv7BJb81oMyMgddOC7g=; b=OuT9OzrVnA0g3JjJ7PdpOQz/I/2/Xp04KexsWBAGPE836iwgpntCVeTbHv/UJ1/gfj 12Iz7YdgnQ9v82jkWc7k23sWv0HCX5onXMBC0dle7XsGaD2Q7Ntti5ulQqvkbBTEYO0C m3+MG6JgWW1O6aXJKwke8PoxqnII82LTS5PPnjNX+WKoTuSrJ0WWP07Sb78oflgCv8kD WTD3hMixkE/BnieX1PvGz5btESPVoy4UDwUmJQppnIQgeWL1B/7WPHAX/KcZbDPyuf1Z Z9TzKxQEc3eWGq5YDjIrqwY23iOqQuqRyHHwWJwVgc20jGDxw4w5Ve7d3X3l27UTB+wQ 0wwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725466548; x=1726071348; 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=4UdvH3BfQ7ZFjeKvJ3vJphtRrv7BJb81oMyMgddOC7g=; b=s5j9n0K4D5cRWiPPksmClS/ra/4KPJUBmnXNTj5Zi8MJCURvBXOxiv8CGN96NaqAu6 8gwwCKpHiFj4ew0SdSIfjIvFkwhO/fMSNX29SW5F3xnIPSmRdwq8XtMBJi1o2203kRn2 tH4G81ZyHDbAWivXEOD027uh4nvfSzAtobhf0twJPyXMC2JQ6Ocv5aGBWMjeTFBLZ2F/ L2QngFkOSYFc/wSZ9enNl0owF92s4SpwFoI+yWcpQBnYAJj4dCKB4muuQ+XBIYrvb+cM jB+DZ4d9qKVnFK+Kpqf3h8k3+o/wm4injZo1Onm47RCyqpodLAfwYESkQZmhoS5zr9IL bgVQ== X-Forwarded-Encrypted: i=1; AJvYcCUbc71d70o+pikxvtIRyuMq0QgKW1bUxbcFiIr2C0wVkNiBsFT7VNIftPV3svvuQMKXfiABOaf+VNQ=@lists.xenproject.org X-Gm-Message-State: AOJu0Ywbrd0bVlt/aS1UAwlkVBokV4Brwgndv9Shv5fYkq40V10/VTbu 9uI/XxHM1r7Icp1TYeE3zxKAPqKHv0MFOFOAoc6vo17myy8+PL5c X-Google-Smtp-Source: AGHT+IE45vRxHAq5eEpoyZwDxuEOBpO1l1yUi0y7mTpVkk1pHSrAlDEkmoWFTNi0vvfiboSA/TFkcA== X-Received: by 2002:a05:651c:1507:b0:2f5:104b:f2c with SMTP id 38308e7fff4ca-2f61e0b27f4mr114070401fa.39.1725466548140; Wed, 04 Sep 2024 09:15:48 -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 05/12] hw/arm: xenpvh: Remove double-negation in warning Date: Wed, 4 Sep 2024 18:15:29 +0200 Message-ID: <20240904161537.664189-6-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 From: "Edgar E. Iglesias" Signed-off-by: Edgar E. Iglesias Reviewed-by: Stefano Stabellini --- hw/arm/xen_arm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/arm/xen_arm.c b/hw/arm/xen_arm.c index fda65d0d8d..16b3f00992 100644 --- a/hw/arm/xen_arm.c +++ b/hw/arm/xen_arm.c @@ -165,7 +165,7 @@ static void xen_arm_init(MachineState *machine) xam->state = g_new0(XenIOState, 1); if (machine->ram_size == 0) { - warn_report("%s non-zero ram size not specified. QEMU machine started" + warn_report("%s: ram size not specified. QEMU machine started" " without IOREQ (no emulated devices including virtio)", MACHINE_CLASS(object_get_class(OBJECT(machine)))->desc); return; From patchwork Wed Sep 4 16:15:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 13791175 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 58598CD4F23 for ; Wed, 4 Sep 2024 16:16:02 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.790552.1200393 (Exim 4.92) (envelope-from ) id 1slsfg-0001ow-9F; Wed, 04 Sep 2024 16:15:52 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 790552.1200393; Wed, 04 Sep 2024 16:15:52 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1slsfg-0001ol-61; Wed, 04 Sep 2024 16:15:52 +0000 Received: by outflank-mailman (input) for mailman id 790552; Wed, 04 Sep 2024 16:15:51 +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 1slsfe-0000I6-UX for xen-devel@lists.xenproject.org; Wed, 04 Sep 2024 16:15:50 +0000 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [2a00:1450:4864:20::133]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id f3a0c0a1-6ad8-11ef-a0b3-8be0dac302b0; Wed, 04 Sep 2024 18:15:50 +0200 (CEST) Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-53345604960so7817184e87.3 for ; Wed, 04 Sep 2024 09:15:50 -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-535407ac380sm2378135e87.83.2024.09.04.09.15.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2024 09:15:48 -0700 (PDT) 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: f3a0c0a1-6ad8-11ef-a0b3-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725466550; x=1726071350; 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=Je23wvBBopidSll9UpAaH5rZwvVBAj7ARc0Pm2/k3kk=; b=PLIgvx8xkjyzpMeTWrLPRss3/JIQNRCRCH6fBxvjwBEJkSw4nGd9x7pdzYOeCWfJMO YLcvOtKIolbEwgUaswlP6RvuUPa1U8+KyJmv3ScGmwmv6/4AXa8XfF13Cmm/gMKuYmDK yXwy7QteLMqjGDJjY/51KLh4JBPrZuXYfnxwDRnUgFqcSa8xWo9LK9gy4o2lLjifolTf LT23ftGq5MpLTnzwE9PlpJUgkKZrb060EYNEyv3AAQHVaXi2hoMY8ig7DVy3F0wW9MKz 4FZgGDl7jQAT8WfRzL1eHHLH8RD217QQH/QEd7AUtg1KYd/as07kkRQcCe98z6B6r3Pj j1Kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725466550; x=1726071350; 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=Je23wvBBopidSll9UpAaH5rZwvVBAj7ARc0Pm2/k3kk=; b=Z215FaZf7sqW1flI6rlI/XBQzVSOzu5qAYvs27EAc8P/PV6hkH+nOmeEq5iFMRfQY7 lWsFF+vQQ9d5Yv92sXN1f8f8GgYUmdcBQ8sTJy8C77lepPAsAXffy7T+uWlt/iOyPoV7 M7PAOJLiUtcHDB6gfHASNjgleQct4tP/eQksFXDF4Q0uNyUqCfwTucUyDZG4Po92dV9l IKdIBflt9QrUUoq1HiryDpVX2zr6iEBYClEZKwmBChPjeUAkKNrxFM+NAlQdUkf/tXTa Jek4a/VPL8A0ePtK8gvagXyRh8D2x5qAIU1jKQcpreNV9Sr+EtGDygW5RhSLxgxww8Z1 ogBQ== X-Forwarded-Encrypted: i=1; AJvYcCXnWTPcYuvoHnSNzP/xnm0h72C1HrvWuoFbFeccwFEzYLjMFWY6csgxVCpSnFEaAuKh5beBMxEW8U4=@lists.xenproject.org X-Gm-Message-State: AOJu0YzZfXvOpMTH0lcbPsmLDxRrNfGSSN9asaZHQWEoKnASShxdDMXf W6IF/KiDXT9suhpN//Gkyvcl9GOrPvmcW+UjC1SvyRZyFXM+xK2s X-Google-Smtp-Source: AGHT+IFDpz1IZD0Qtgo2lbwg04ZmmoJdx9qSrR477CRxTjdjnUIVorw3NCNELME4Ae86vdZ9W6Lr1A== X-Received: by 2002:a05:6512:3da9:b0:530:ae4a:58d0 with SMTP id 2adb3069b0e04-53546af3605mr12601930e87.8.1725466549784; Wed, 04 Sep 2024 09:15:49 -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 06/12] hw/arm: xenpvh: Move stubbed functions to xen-stubs.c Date: Wed, 4 Sep 2024 18:15:30 +0200 Message-ID: <20240904161537.664189-7-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 From: "Edgar E. Iglesias" Signed-off-by: Edgar E. Iglesias Reviewed-by: Stefano Stabellini --- hw/arm/meson.build | 5 ++++- hw/arm/xen-stubs.c | 32 ++++++++++++++++++++++++++++++++ hw/arm/xen_arm.c | 20 -------------------- 3 files changed, 36 insertions(+), 21 deletions(-) create mode 100644 hw/arm/xen-stubs.c diff --git a/hw/arm/meson.build b/hw/arm/meson.build index 0c07ab522f..074612b40c 100644 --- a/hw/arm/meson.build +++ b/hw/arm/meson.build @@ -59,7 +59,10 @@ arm_ss.add(when: 'CONFIG_FSL_IMX7', if_true: files('fsl-imx7.c', 'mcimx7d-sabre. arm_ss.add(when: 'CONFIG_ARM_SMMUV3', if_true: files('smmuv3.c')) arm_ss.add(when: 'CONFIG_FSL_IMX6UL', if_true: files('fsl-imx6ul.c', 'mcimx6ul-evk.c')) arm_ss.add(when: 'CONFIG_NRF51_SOC', if_true: files('nrf51_soc.c')) -arm_ss.add(when: 'CONFIG_XEN', if_true: files('xen_arm.c')) +arm_ss.add(when: 'CONFIG_XEN', if_true: files( + 'xen-stubs.c', + 'xen_arm.c', +)) system_ss.add(when: 'CONFIG_ARM_SMMUV3', if_true: files('smmu-common.c')) system_ss.add(when: 'CONFIG_CHEETAH', if_true: files('palm.c')) diff --git a/hw/arm/xen-stubs.c b/hw/arm/xen-stubs.c new file mode 100644 index 0000000000..4ac6a56a96 --- /dev/null +++ b/hw/arm/xen-stubs.c @@ -0,0 +1,32 @@ +/* + * Stubs for unimplemented Xen functions for ARM. + * + * SPDX-License-Identifier: MIT + */ + +#include "qemu/osdep.h" +#include "qemu/error-report.h" +#include "qapi/qapi-commands-migration.h" +#include "hw/boards.h" +#include "sysemu/sysemu.h" +#include "hw/xen/xen-hvm-common.h" +#include "hw/xen/arch_hvm.h" + +void arch_handle_ioreq(XenIOState *state, ioreq_t *req) +{ + hw_error("Invalid ioreq type 0x%x\n", req->type); + return; +} + +void arch_xen_set_memory(XenIOState *state, MemoryRegionSection *section, + bool add) +{ +} + +void xen_hvm_modified_memory(ram_addr_t start, ram_addr_t length) +{ +} + +void qmp_xen_set_global_dirty_log(bool enable, Error **errp) +{ +} diff --git a/hw/arm/xen_arm.c b/hw/arm/xen_arm.c index 16b3f00992..f0868e7be5 100644 --- a/hw/arm/xen_arm.c +++ b/hw/arm/xen_arm.c @@ -115,26 +115,6 @@ static void xen_init_ram(MachineState *machine) memory_region_add_subregion(sysmem, XEN_GRANT_ADDR_OFF, &xen_grants); } -void arch_handle_ioreq(XenIOState *state, ioreq_t *req) -{ - hw_error("Invalid ioreq type 0x%x\n", req->type); - - return; -} - -void arch_xen_set_memory(XenIOState *state, MemoryRegionSection *section, - bool add) -{ -} - -void xen_hvm_modified_memory(ram_addr_t start, ram_addr_t length) -{ -} - -void qmp_xen_set_global_dirty_log(bool enable, Error **errp) -{ -} - #ifdef CONFIG_TPM static void xen_enable_tpm(XenArmState *xam) { From patchwork Wed Sep 4 16:15:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 13791179 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 74D69CD4F24 for ; Wed, 4 Sep 2024 16:16:04 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.790553.1200402 (Exim 4.92) (envelope-from ) id 1slsfj-0002E6-Jo; Wed, 04 Sep 2024 16:15:55 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 790553.1200402; Wed, 04 Sep 2024 16:15:55 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1slsfj-0002Do-FY; Wed, 04 Sep 2024 16:15:55 +0000 Received: by outflank-mailman (input) for mailman id 790553; Wed, 04 Sep 2024 16:15:54 +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 1slsfh-0000I6-R1 for xen-devel@lists.xenproject.org; Wed, 04 Sep 2024 16:15:53 +0000 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [2a00:1450:4864:20::131]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id f4b1ceb9-6ad8-11ef-a0b3-8be0dac302b0; Wed, 04 Sep 2024 18:15:52 +0200 (CEST) Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-5334c4cc17fso9467078e87.2 for ; Wed, 04 Sep 2024 09:15:52 -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-535692d9bf6sm176341e87.41.2024.09.04.09.15.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2024 09:15:50 -0700 (PDT) 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: f4b1ceb9-6ad8-11ef-a0b3-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725466552; x=1726071352; 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=9ixH95d7Al9xFTOStqh6VLaEXX0BKF8+hj7xVV9eDrA=; b=jJrQStlKOeVzmXYbM6mGwdz4d+V87woDlqRvN3MJv8UqWMqnO1xVUp1W/jtfUOJqgE nVnnoMFhaZT4t1Lq1Khu6/0ckvIo1iaWn2O2JCeq0BUdu2ju+7YSYbUkaU3nGoApKGhq EC2i6kcOt2u+wAItdSYFNHcMWsrUHTrDJL4LhjDgtHoZwXXeoIbMzy3At4n+QQ/lwS6U kzc60/UePTjqrzLDYXDW0wtVqxnrk4O8Y5QfWWh95jBLsifmO84gWfZ0psbLGzGz/uyC DcAApqw90K1C5aY039et7VScsgI8zl3UIlfE7vfHIIdODr7wbc0ncjg0u8l/6qXVOUHE 1KJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725466552; x=1726071352; 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=9ixH95d7Al9xFTOStqh6VLaEXX0BKF8+hj7xVV9eDrA=; b=fuF666Q4Fdo7cUNv72ZYi4vEqsDLb/MdkD0Le9hlrUZvrjPXFUkGl8JdmY1fsgylgy euir4lMJSqlo3cj4WIMDfNcG/7M1WU18kigdOGKIs8X9tUiaZJXQFB1STZ3c/bv41i2h ccqg1flxNjqhNcIt6bTjb6mGCmoLtV0W3FqmlCf6r+s3pJ7+UIq14PIixTLPzzHjeWra 8YDtXlQqagim/UN/GeXKsvIfDmmvRK8PT7wGB2n5a+A/DEAEelB7bfotRjAov25IzDyv UU5/E1TFV6Og8ddf9jvOCFwLJJzp7Xk6VKSYYj8ahSba40VE2XwOlbulZUDXq3GO/PO6 xSaQ== X-Forwarded-Encrypted: i=1; AJvYcCWnYNWzFL6YRCuUPhGVUOmhf8HiCxkQ0pxZXMW7VvBL2GCG67DRpCiUqqJVvDgcb8lCVlTlbSRVgF4=@lists.xenproject.org X-Gm-Message-State: AOJu0YxaOPEOD0kaetc2BFM1Y110FwuuPAMjGkvGxW9i5fmdf0oTF2Dd NIxUFhl0D/FDO++dU6wYN71rgLKiFzau88uYTHLMvrBLUwHvEuJJ X-Google-Smtp-Source: AGHT+IG1JgHcK/HSPjvz/v7e/HA3h7W7yVxrlLa32XoSdRwuQdNw8Nv6kbTy/cV1UOn6hD+yiZ1CvQ== X-Received: by 2002:a05:6512:159e:b0:52e:7542:f469 with SMTP id 2adb3069b0e04-53546a56629mr12273709e87.0.1725466551489; Wed, 04 Sep 2024 09:15:51 -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, "Edgar E. Iglesias" , qemu-arm@nongnu.org Subject: [PULL v1 07/12] hw/arm: xenpvh: Break out a common PVH machine Date: Wed, 4 Sep 2024 18:15:31 +0200 Message-ID: <20240904161537.664189-8-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 From: "Edgar E. Iglesias" Break out a common Xen PVH machine in preparation for adding a x86 Xen PVH machine. Signed-off-by: Edgar E. Iglesias Reviewed-by: Stefano Stabellini --- hw/arm/trace-events | 5 - hw/arm/xen_arm.c | 198 +++-------------------- hw/xen/meson.build | 1 + hw/xen/trace-events | 4 + hw/xen/xen-pvh-common.c | 275 ++++++++++++++++++++++++++++++++ include/hw/xen/xen-pvh-common.h | 59 +++++++ 6 files changed, 358 insertions(+), 184 deletions(-) create mode 100644 hw/xen/xen-pvh-common.c create mode 100644 include/hw/xen/xen-pvh-common.h diff --git a/hw/arm/trace-events b/hw/arm/trace-events index be6c8f720b..c64ad344bd 100644 --- a/hw/arm/trace-events +++ b/hw/arm/trace-events @@ -68,10 +68,5 @@ z2_aer915_send_too_long(int8_t msg) "message too long (%i bytes)" z2_aer915_send(uint8_t reg, uint8_t value) "reg %d value 0x%02x" z2_aer915_event(int8_t event, int8_t len) "i2c event =0x%x len=%d bytes" -# xen_arm.c -xen_create_virtio_mmio_devices(int i, int irq, uint64_t base) "Created virtio-mmio device %d: irq %d base 0x%"PRIx64 -xen_init_ram(uint64_t machine_ram_size) "Initialized xen ram with size 0x%"PRIx64 -xen_enable_tpm(uint64_t addr) "Connected tpmdev at address 0x%"PRIx64 - # bcm2838.c bcm2838_gic_set_irq(int irq, int level) "gic irq:%d lvl:%d" diff --git a/hw/arm/xen_arm.c b/hw/arm/xen_arm.c index f0868e7be5..04cb9855af 100644 --- a/hw/arm/xen_arm.c +++ b/hw/arm/xen_arm.c @@ -7,44 +7,12 @@ #include "qemu/osdep.h" #include "qemu/error-report.h" #include "qapi/qapi-commands-migration.h" -#include "qapi/visitor.h" #include "hw/boards.h" -#include "hw/irq.h" -#include "hw/sysbus.h" -#include "sysemu/block-backend.h" -#include "sysemu/tpm_backend.h" #include "sysemu/sysemu.h" -#include "hw/xen/xen-hvm-common.h" -#include "sysemu/tpm.h" +#include "hw/xen/xen-pvh-common.h" #include "hw/xen/arch_hvm.h" -#include "trace.h" #define TYPE_XEN_ARM MACHINE_TYPE_NAME("xenpvh") -OBJECT_DECLARE_SIMPLE_TYPE(XenArmState, XEN_ARM) - -static const MemoryListener xen_memory_listener = { - .region_add = xen_region_add, - .region_del = xen_region_del, - .log_start = NULL, - .log_stop = NULL, - .log_sync = NULL, - .log_global_start = NULL, - .log_global_stop = NULL, - .priority = MEMORY_LISTENER_PRIORITY_ACCEL, -}; - -struct XenArmState { - /*< private >*/ - MachineState parent; - - XenIOState *state; - - struct { - uint64_t tpm_base_addr; - } cfg; -}; - -static MemoryRegion ram_lo, ram_hi; /* * VIRTIO_MMIO_DEV_SIZE is imported from tools/libs/light/libxl_arm.c under Xen @@ -57,147 +25,26 @@ static MemoryRegion ram_lo, ram_hi; #define NR_VIRTIO_MMIO_DEVICES \ (GUEST_VIRTIO_MMIO_SPI_LAST - GUEST_VIRTIO_MMIO_SPI_FIRST) -static void xen_set_irq(void *opaque, int irq, int level) -{ - if (xendevicemodel_set_irq_level(xen_dmod, xen_domid, irq, level)) { - error_report("xendevicemodel_set_irq_level failed"); - } -} - -static void xen_create_virtio_mmio_devices(XenArmState *xam) -{ - int i; - - for (i = 0; i < NR_VIRTIO_MMIO_DEVICES; i++) { - hwaddr base = GUEST_VIRTIO_MMIO_BASE + i * VIRTIO_MMIO_DEV_SIZE; - qemu_irq irq = qemu_allocate_irq(xen_set_irq, NULL, - GUEST_VIRTIO_MMIO_SPI_FIRST + i); - - sysbus_create_simple("virtio-mmio", base, irq); - - trace_xen_create_virtio_mmio_devices(i, - GUEST_VIRTIO_MMIO_SPI_FIRST + i, - base); - } -} - -static void xen_init_ram(MachineState *machine) +static void xen_arm_instance_init(Object *obj) { - MemoryRegion *sysmem = get_system_memory(); - ram_addr_t block_len, ram_size[GUEST_RAM_BANKS]; - - trace_xen_init_ram(machine->ram_size); - if (machine->ram_size <= GUEST_RAM0_SIZE) { - ram_size[0] = machine->ram_size; - ram_size[1] = 0; - block_len = GUEST_RAM0_BASE + ram_size[0]; - } else { - ram_size[0] = GUEST_RAM0_SIZE; - ram_size[1] = machine->ram_size - GUEST_RAM0_SIZE; - block_len = GUEST_RAM1_BASE + ram_size[1]; - } + XenPVHMachineState *s = XEN_PVH_MACHINE(obj); - memory_region_init_ram(&xen_memory, NULL, "xen.ram", block_len, - &error_fatal); + /* Default values. */ + s->cfg.ram_low = (MemMapEntry) { GUEST_RAM0_BASE, GUEST_RAM0_SIZE }; + s->cfg.ram_high = (MemMapEntry) { GUEST_RAM1_BASE, GUEST_RAM1_SIZE }; - memory_region_init_alias(&ram_lo, NULL, "xen.ram.lo", &xen_memory, - GUEST_RAM0_BASE, ram_size[0]); - memory_region_add_subregion(sysmem, GUEST_RAM0_BASE, &ram_lo); - if (ram_size[1] > 0) { - memory_region_init_alias(&ram_hi, NULL, "xen.ram.hi", &xen_memory, - GUEST_RAM1_BASE, ram_size[1]); - memory_region_add_subregion(sysmem, GUEST_RAM1_BASE, &ram_hi); - } - - /* Setup support for grants. */ - memory_region_init_ram(&xen_grants, NULL, "xen.grants", block_len, - &error_fatal); - memory_region_add_subregion(sysmem, XEN_GRANT_ADDR_OFF, &xen_grants); + s->cfg.virtio_mmio_num = NR_VIRTIO_MMIO_DEVICES; + s->cfg.virtio_mmio_irq_base = GUEST_VIRTIO_MMIO_SPI_FIRST; + s->cfg.virtio_mmio = (MemMapEntry) { GUEST_VIRTIO_MMIO_BASE, + VIRTIO_MMIO_DEV_SIZE }; } -#ifdef CONFIG_TPM -static void xen_enable_tpm(XenArmState *xam) -{ - Error *errp = NULL; - DeviceState *dev; - SysBusDevice *busdev; - - TPMBackend *be = qemu_find_tpm_be("tpm0"); - if (be == NULL) { - error_report("Couldn't find tmp0 backend"); - return; - } - dev = qdev_new(TYPE_TPM_TIS_SYSBUS); - object_property_set_link(OBJECT(dev), "tpmdev", OBJECT(be), &errp); - object_property_set_str(OBJECT(dev), "tpmdev", be->id, &errp); - busdev = SYS_BUS_DEVICE(dev); - sysbus_realize_and_unref(busdev, &error_fatal); - sysbus_mmio_map(busdev, 0, xam->cfg.tpm_base_addr); - - trace_xen_enable_tpm(xam->cfg.tpm_base_addr); -} -#endif - -static void xen_arm_init(MachineState *machine) -{ - XenArmState *xam = XEN_ARM(machine); - - xam->state = g_new0(XenIOState, 1); - - if (machine->ram_size == 0) { - warn_report("%s: ram size not specified. QEMU machine started" - " without IOREQ (no emulated devices including virtio)", - MACHINE_CLASS(object_get_class(OBJECT(machine)))->desc); - return; - } - - xen_init_ram(machine); - - xen_register_ioreq(xam->state, machine->smp.max_cpus, &xen_memory_listener); - - xen_create_virtio_mmio_devices(xam); - -#ifdef CONFIG_TPM - if (xam->cfg.tpm_base_addr) { - xen_enable_tpm(xam); - } else { - warn_report("tpm-base-addr is not provided. TPM will not be enabled"); - } -#endif -} - -#ifdef CONFIG_TPM -static void xen_arm_get_tpm_base_addr(Object *obj, Visitor *v, - const char *name, void *opaque, - Error **errp) -{ - XenArmState *xam = XEN_ARM(obj); - uint64_t value = xam->cfg.tpm_base_addr; - - visit_type_uint64(v, name, &value, errp); -} - -static void xen_arm_set_tpm_base_addr(Object *obj, Visitor *v, - const char *name, void *opaque, - Error **errp) -{ - XenArmState *xam = XEN_ARM(obj); - uint64_t value; - - if (!visit_type_uint64(v, name, &value, errp)) { - return; - } - - xam->cfg.tpm_base_addr = value; -} -#endif - static void xen_arm_machine_class_init(ObjectClass *oc, void *data) { - + XenPVHMachineClass *xpc = XEN_PVH_MACHINE_CLASS(oc); MachineClass *mc = MACHINE_CLASS(oc); + mc->desc = "Xen PVH ARM machine"; - mc->init = xen_arm_init; /* * mc->max_cpus holds the MAX value allowed in the -smp command-line opts. @@ -218,27 +65,20 @@ static void xen_arm_machine_class_init(ObjectClass *oc, void *data) * mc->max_cpus, QEMU will bail out with an error message. */ mc->max_cpus = GUEST_MAX_VCPUS; - mc->default_machine_opts = "accel=xen"; - /* Set explicitly here to make sure that real ram_size is passed */ - mc->default_ram_size = 0; -#ifdef CONFIG_TPM - object_class_property_add(oc, "tpm-base-addr", "uint64_t", - xen_arm_get_tpm_base_addr, - xen_arm_set_tpm_base_addr, - NULL, NULL); - object_class_property_set_description(oc, "tpm-base-addr", - "Set Base address for TPM device."); + /* List of supported features known to work on PVH ARM. */ + xpc->has_tpm = true; + xpc->has_virtio_mmio = true; - machine_class_allow_dynamic_sysbus_dev(mc, TYPE_TPM_TIS_SYSBUS); -#endif + xen_pvh_class_setup_common_props(xpc); } static const TypeInfo xen_arm_machine_type = { .name = TYPE_XEN_ARM, - .parent = TYPE_MACHINE, + .parent = TYPE_XEN_PVH_MACHINE, .class_init = xen_arm_machine_class_init, - .instance_size = sizeof(XenArmState), + .instance_size = sizeof(XenPVHMachineState), + .instance_init = xen_arm_instance_init, }; static void xen_arm_machine_register_types(void) diff --git a/hw/xen/meson.build b/hw/xen/meson.build index d887fa9ba4..4a486e3673 100644 --- a/hw/xen/meson.build +++ b/hw/xen/meson.build @@ -15,6 +15,7 @@ xen_specific_ss = ss.source_set() xen_specific_ss.add(files( 'xen-mapcache.c', 'xen-hvm-common.c', + 'xen-pvh-common.c', )) if have_xen_pci_passthrough xen_specific_ss.add(files( diff --git a/hw/xen/trace-events b/hw/xen/trace-events index d1b27f6c11..a07fe41c6d 100644 --- a/hw/xen/trace-events +++ b/hw/xen/trace-events @@ -64,6 +64,10 @@ destroy_hvm_domain_cannot_acquire_handle(void) "Cannot acquire xenctrl handle" destroy_hvm_domain_failed_action(const char *action, int sts, char *errno_s) "xc_domain_shutdown failed to issue %s, sts %d, %s" destroy_hvm_domain_action(int xen_domid, const char *action) "Issued domain %d %s" +# xen-pvh-common.c +xen_create_virtio_mmio_devices(int i, int irq, uint64_t base) "Created virtio-mmio device %d: irq %d base 0x%"PRIx64 +xen_enable_tpm(uint64_t addr) "Connected tpmdev at address 0x%"PRIx64 + # xen-mapcache.c xen_map_cache(uint64_t phys_addr) "want 0x%"PRIx64 xen_remap_bucket(uint64_t index) "index 0x%"PRIx64 diff --git a/hw/xen/xen-pvh-common.c b/hw/xen/xen-pvh-common.c new file mode 100644 index 0000000000..880e8143d7 --- /dev/null +++ b/hw/xen/xen-pvh-common.c @@ -0,0 +1,275 @@ +/* + * QEMU Xen PVH machine - common code. + * + * Copyright (c) 2024 Advanced Micro Devices, Inc. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "qemu/error-report.h" +#include "qapi/error.h" +#include "qapi/visitor.h" +#include "hw/boards.h" +#include "hw/irq.h" +#include "hw/sysbus.h" +#include "sysemu/sysemu.h" +#include "sysemu/tpm.h" +#include "sysemu/tpm_backend.h" +#include "hw/xen/xen-pvh-common.h" +#include "trace.h" + +static const MemoryListener xen_memory_listener = { + .region_add = xen_region_add, + .region_del = xen_region_del, + .log_start = NULL, + .log_stop = NULL, + .log_sync = NULL, + .log_global_start = NULL, + .log_global_stop = NULL, + .priority = MEMORY_LISTENER_PRIORITY_ACCEL, +}; + +static void xen_pvh_init_ram(XenPVHMachineState *s, + MemoryRegion *sysmem) +{ + MachineState *ms = MACHINE(s); + ram_addr_t block_len, ram_size[2]; + + if (ms->ram_size <= s->cfg.ram_low.size) { + ram_size[0] = ms->ram_size; + ram_size[1] = 0; + block_len = s->cfg.ram_low.base + ram_size[0]; + } else { + ram_size[0] = s->cfg.ram_low.size; + ram_size[1] = ms->ram_size - s->cfg.ram_low.size; + block_len = s->cfg.ram_high.base + ram_size[1]; + } + + memory_region_init_ram(&xen_memory, NULL, "xen.ram", block_len, + &error_fatal); + + memory_region_init_alias(&s->ram.low, NULL, "xen.ram.lo", &xen_memory, + s->cfg.ram_low.base, ram_size[0]); + memory_region_add_subregion(sysmem, s->cfg.ram_low.base, &s->ram.low); + if (ram_size[1] > 0) { + memory_region_init_alias(&s->ram.high, NULL, "xen.ram.hi", &xen_memory, + s->cfg.ram_high.base, ram_size[1]); + memory_region_add_subregion(sysmem, s->cfg.ram_high.base, &s->ram.high); + } + + /* Setup support for grants. */ + memory_region_init_ram(&xen_grants, NULL, "xen.grants", block_len, + &error_fatal); + memory_region_add_subregion(sysmem, XEN_GRANT_ADDR_OFF, &xen_grants); +} + +static void xen_set_irq(void *opaque, int irq, int level) +{ + if (xendevicemodel_set_irq_level(xen_dmod, xen_domid, irq, level)) { + error_report("xendevicemodel_set_irq_level failed"); + } +} + +static void xen_create_virtio_mmio_devices(XenPVHMachineState *s) +{ + int i; + + for (i = 0; i < s->cfg.virtio_mmio_num; i++) { + hwaddr base = s->cfg.virtio_mmio.base + i * s->cfg.virtio_mmio.size; + qemu_irq irq = qemu_allocate_irq(xen_set_irq, NULL, + s->cfg.virtio_mmio_irq_base + i); + + sysbus_create_simple("virtio-mmio", base, irq); + + trace_xen_create_virtio_mmio_devices(i, + s->cfg.virtio_mmio_irq_base + i, + base); + } +} + +#ifdef CONFIG_TPM +static void xen_enable_tpm(XenPVHMachineState *s) +{ + Error *errp = NULL; + DeviceState *dev; + SysBusDevice *busdev; + + TPMBackend *be = qemu_find_tpm_be("tpm0"); + if (be == NULL) { + error_report("Couldn't find tmp0 backend"); + return; + } + dev = qdev_new(TYPE_TPM_TIS_SYSBUS); + object_property_set_link(OBJECT(dev), "tpmdev", OBJECT(be), &errp); + object_property_set_str(OBJECT(dev), "tpmdev", be->id, &errp); + busdev = SYS_BUS_DEVICE(dev); + sysbus_realize_and_unref(busdev, &error_fatal); + sysbus_mmio_map(busdev, 0, s->cfg.tpm.base); + + trace_xen_enable_tpm(s->cfg.tpm.base); +} +#endif + +static void xen_pvh_init(MachineState *ms) +{ + XenPVHMachineState *s = XEN_PVH_MACHINE(ms); + XenPVHMachineClass *xpc = XEN_PVH_MACHINE_GET_CLASS(s); + MemoryRegion *sysmem = get_system_memory(); + + if (ms->ram_size == 0) { + warn_report("%s: ram size not specified. QEMU machine started" + " without IOREQ (no emulated devices including virtio)", + MACHINE_CLASS(object_get_class(OBJECT(ms)))->desc); + return; + } + + xen_pvh_init_ram(s, sysmem); + xen_register_ioreq(&s->ioreq, ms->smp.max_cpus, &xen_memory_listener); + + if (s->cfg.virtio_mmio_num) { + xen_create_virtio_mmio_devices(s); + } + +#ifdef CONFIG_TPM + if (xpc->has_tpm) { + if (s->cfg.tpm.base) { + xen_enable_tpm(s); + } else { + warn_report("tpm-base-addr is not set. TPM will not be enabled"); + } + } +#endif + + /* Call the implementation specific init. */ + if (xpc->init) { + xpc->init(ms); + } +} + +#define XEN_PVH_PROP_MEMMAP_SETTER(n, f) \ +static void xen_pvh_set_ ## n ## _ ## f(Object *obj, Visitor *v, \ + const char *name, void *opaque, \ + Error **errp) \ +{ \ + XenPVHMachineState *xp = XEN_PVH_MACHINE(obj); \ + uint64_t value; \ + \ + if (!visit_type_size(v, name, &value, errp)) { \ + return; \ + } \ + xp->cfg.n.f = value; \ +} + +#define XEN_PVH_PROP_MEMMAP_GETTER(n, f) \ +static void xen_pvh_get_ ## n ## _ ## f(Object *obj, Visitor *v, \ + const char *name, void *opaque, \ + Error **errp) \ +{ \ + XenPVHMachineState *xp = XEN_PVH_MACHINE(obj); \ + uint64_t value = xp->cfg.n.f; \ + \ + visit_type_uint64(v, name, &value, errp); \ +} + +#define XEN_PVH_PROP_MEMMAP_BASE(n) \ + XEN_PVH_PROP_MEMMAP_SETTER(n, base) \ + XEN_PVH_PROP_MEMMAP_GETTER(n, base) \ + +#define XEN_PVH_PROP_MEMMAP_SIZE(n) \ + XEN_PVH_PROP_MEMMAP_SETTER(n, size) \ + XEN_PVH_PROP_MEMMAP_GETTER(n, size) + +#define XEN_PVH_PROP_MEMMAP(n) \ + XEN_PVH_PROP_MEMMAP_BASE(n) \ + XEN_PVH_PROP_MEMMAP_SIZE(n) + +XEN_PVH_PROP_MEMMAP(ram_low) +XEN_PVH_PROP_MEMMAP(ram_high) +/* TPM only has a base-addr option. */ +XEN_PVH_PROP_MEMMAP_BASE(tpm) +XEN_PVH_PROP_MEMMAP(virtio_mmio) + +void xen_pvh_class_setup_common_props(XenPVHMachineClass *xpc) +{ + ObjectClass *oc = OBJECT_CLASS(xpc); + MachineClass *mc = MACHINE_CLASS(xpc); + +#define OC_MEMMAP_PROP_BASE(c, prop_name, name) \ +do { \ + object_class_property_add(c, prop_name "-base", "uint64_t", \ + xen_pvh_get_ ## name ## _base, \ + xen_pvh_set_ ## name ## _base, NULL, NULL); \ + object_class_property_set_description(oc, prop_name "-base", \ + "Set base address for " prop_name); \ +} while (0) + +#define OC_MEMMAP_PROP_SIZE(c, prop_name, name) \ +do { \ + object_class_property_add(c, prop_name "-size", "uint64_t", \ + xen_pvh_get_ ## name ## _size, \ + xen_pvh_set_ ## name ## _size, NULL, NULL); \ + object_class_property_set_description(oc, prop_name "-size", \ + "Set memory range size for " prop_name); \ +} while (0) + +#define OC_MEMMAP_PROP(c, prop_name, name) \ +do { \ + OC_MEMMAP_PROP_BASE(c, prop_name, name); \ + OC_MEMMAP_PROP_SIZE(c, prop_name, name); \ +} while (0) + + /* + * We provide memmap properties to allow Xen to move things to other + * addresses for example when users need to accomodate the memory-map + * for 1:1 mapped devices/memory. + */ + OC_MEMMAP_PROP(oc, "ram-low", ram_low); + OC_MEMMAP_PROP(oc, "ram-high", ram_high); + + if (xpc->has_virtio_mmio) { + OC_MEMMAP_PROP(oc, "virtio-mmio", virtio_mmio); + } + +#ifdef CONFIG_TPM + if (xpc->has_tpm) { + object_class_property_add(oc, "tpm-base-addr", "uint64_t", + xen_pvh_get_tpm_base, + xen_pvh_set_tpm_base, + NULL, NULL); + object_class_property_set_description(oc, "tpm-base-addr", + "Set Base address for TPM device."); + + machine_class_allow_dynamic_sysbus_dev(mc, TYPE_TPM_TIS_SYSBUS); + } +#endif +} + +static void xen_pvh_class_init(ObjectClass *oc, void *data) +{ + MachineClass *mc = MACHINE_CLASS(oc); + + mc->init = xen_pvh_init; + + mc->desc = "Xen PVH machine"; + mc->max_cpus = 1; + mc->default_machine_opts = "accel=xen"; + /* Set to zero to make sure that the real ram size is passed. */ + mc->default_ram_size = 0; +} + +static const TypeInfo xen_pvh_info = { + .name = TYPE_XEN_PVH_MACHINE, + .parent = TYPE_MACHINE, + .abstract = true, + .instance_size = sizeof(XenPVHMachineState), + .class_size = sizeof(XenPVHMachineClass), + .class_init = xen_pvh_class_init, +}; + +static void xen_pvh_register_types(void) +{ + type_register_static(&xen_pvh_info); +} + +type_init(xen_pvh_register_types); diff --git a/include/hw/xen/xen-pvh-common.h b/include/hw/xen/xen-pvh-common.h new file mode 100644 index 0000000000..77fd98b9fe --- /dev/null +++ b/include/hw/xen/xen-pvh-common.h @@ -0,0 +1,59 @@ +/* + * QEMU Xen PVH machine - common code. + * + * Copyright (c) 2024 Advanced Micro Devices, Inc. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef XEN_PVH_COMMON_H__ +#define XEN_PVH_COMMON_H__ + +#include +#include "hw/sysbus.h" +#include "hw/hw.h" +#include "hw/xen/xen-hvm-common.h" +#include "hw/pci-host/gpex.h" + +#define TYPE_XEN_PVH_MACHINE MACHINE_TYPE_NAME("xen-pvh-base") +OBJECT_DECLARE_TYPE(XenPVHMachineState, XenPVHMachineClass, + XEN_PVH_MACHINE) + +struct XenPVHMachineClass { + MachineClass parent; + + /* PVH implementation specific init. */ + void (*init)(MachineState *state); + + /* + * Each implementation can optionally enable features that it + * supports and are known to work. + */ + bool has_tpm; + bool has_virtio_mmio; +}; + +struct XenPVHMachineState { + /*< private >*/ + MachineState parent; + + XenIOState ioreq; + + struct { + MemoryRegion low; + MemoryRegion high; + } ram; + + struct { + MemMapEntry ram_low, ram_high; + MemMapEntry tpm; + + /* Virtio-mmio */ + MemMapEntry virtio_mmio; + uint32_t virtio_mmio_num; + uint32_t virtio_mmio_irq_base; + } cfg; +}; + +void xen_pvh_class_setup_common_props(XenPVHMachineClass *xpc); +#endif From patchwork Wed Sep 4 16:15:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 13791180 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 89906CD4F27 for ; Wed, 4 Sep 2024 16:16:06 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.790554.1200413 (Exim 4.92) (envelope-from ) id 1slsfm-0002dh-5e; Wed, 04 Sep 2024 16:15:58 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 790554.1200413; Wed, 04 Sep 2024 16:15:58 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1slsfm-0002dT-1F; Wed, 04 Sep 2024 16:15:58 +0000 Received: by outflank-mailman (input) for mailman id 790554; Wed, 04 Sep 2024 16:15:56 +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 1slsfk-0000LO-16 for xen-devel@lists.xenproject.org; Wed, 04 Sep 2024 16:15:56 +0000 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [2a00:1450:4864:20::131]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id f605ec91-6ad8-11ef-99a1-01e77a169b0f; Wed, 04 Sep 2024 18:15:54 +0200 (CEST) Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-5334b0e1a8eso8739576e87.0 for ; Wed, 04 Sep 2024 09:15:54 -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-53569eeb4d9sm143326e87.65.2024.09.04.09.15.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2024 09:15:52 -0700 (PDT) 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: f605ec91-6ad8-11ef-99a1-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725466554; x=1726071354; 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=nym7Vpc1+HcpD0fJwqv749eMWZaaEovUQaBKn9/MOQM=; b=dR6ILUOPoqO/aIFjvSHqaTRq3ssEFkxZlY9yjvZXpjM2yLtan9Xua3XyfHsZxspH1M SH0IyJqxO0l5cTihGwiJR2vPYS95ftVNN8CRfOzzlss7/NI5InOMFvOSVKop0H7Gk29T 7gqh8sz6HCt7ju+jFsIUQCp+CRCkoNenyH2iijJyEvI7tAt90NcY5LOIcFFw6Kpq7Ofm xb5+lb/S8qm/C2hPxj3slhHlf2BcE/ETkWSWL1JLYBNmtuWMhuNMJTGEpv0UM1meoOEt C4+dpSbGq/qP7gHcnHf1eheMrcXQ2pqsQYNaljZKvfoMr6j8lTe+MJDYkRamWRQyWxkh ElIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725466554; x=1726071354; 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=nym7Vpc1+HcpD0fJwqv749eMWZaaEovUQaBKn9/MOQM=; b=lrEzqAfkvoY2B0oKeMRR3WWR5Z0JLemHlPB229+3fL8OYbcArj0PPz3UPy/714vUs0 FGhAYBdW447G/eUMhLk+hmlDa8v7LKzE38G2ZFiYx3a2c2oeND5L/qxKgOeHw3y+Qs/B S4Xibv0PLI+Qvi5X5zpzvmKYr/iVSOK5Br5Q6UMNCuomNdUQcZAOlNTAyK6+mWQYXLta IkVzk+tt/ML0P3gyNDSfo6v2O44cfd50G7k8L+Xl0CEUA91rJO47wRzPKBK/rySCixJ/ ggmZx/16f0GI2Uruoa95+Itwnm+TskrJJ5x6mD20ZPPUMjqEoYl0H8L0XJz1W07LelWz Uy3A== X-Forwarded-Encrypted: i=1; AJvYcCX0udJWNpcuWV0ZEWLdkXqNjeStT7pxPtPDBIVsjlhQelvDdGFRvkM2Bxadg7n3Lk8Niu91XnR64LA=@lists.xenproject.org X-Gm-Message-State: AOJu0YwRDVjQw9hk52ss5RgMdRJRo7lvR1e8gG26aVssjzFAmm5V/Pys yF4w8dyuvOjojLVpRvI75zzPbeiNhVtD2Isw+V1ur5UM7roEGCX8 X-Google-Smtp-Source: AGHT+IHdK+MGVaxZaTPG5mtVrOpYHs1uliw2A+U9Y8zDTRSlyKp4eJOx4pA7txuXly/nIFn97leCnQ== X-Received: by 2002:a05:6512:39d4:b0:530:e228:7799 with SMTP id 2adb3069b0e04-53546bab2e9mr14075298e87.58.1725466553759; Wed, 04 Sep 2024 09:15:53 -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 08/12] hw/arm: xenpvh: Rename xen_arm.c -> xen-pvh.c Date: Wed, 4 Sep 2024 18:15:32 +0200 Message-ID: <20240904161537.664189-9-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 From: "Edgar E. Iglesias" Rename xen_arm.c -> xen-pvh.c to better express that this is a PVH machine and to align with x86 HVM and future PVH machine filenames: hw/i386/xen/xen-hvm.c hw/i386/xen/xen-pvh.c (in preparation) No functional changes. Signed-off-by: Edgar E. Iglesias Reviewed-by: Stefano Stabellini --- hw/arm/meson.build | 2 +- hw/arm/{xen_arm.c => xen-pvh.c} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename hw/arm/{xen_arm.c => xen-pvh.c} (100%) diff --git a/hw/arm/meson.build b/hw/arm/meson.build index 074612b40c..4059d0be2e 100644 --- a/hw/arm/meson.build +++ b/hw/arm/meson.build @@ -61,7 +61,7 @@ arm_ss.add(when: 'CONFIG_FSL_IMX6UL', if_true: files('fsl-imx6ul.c', 'mcimx6ul-e arm_ss.add(when: 'CONFIG_NRF51_SOC', if_true: files('nrf51_soc.c')) arm_ss.add(when: 'CONFIG_XEN', if_true: files( 'xen-stubs.c', - 'xen_arm.c', + 'xen-pvh.c', )) system_ss.add(when: 'CONFIG_ARM_SMMUV3', if_true: files('smmu-common.c')) diff --git a/hw/arm/xen_arm.c b/hw/arm/xen-pvh.c similarity index 100% rename from hw/arm/xen_arm.c rename to hw/arm/xen-pvh.c From patchwork Wed Sep 4 16:15:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 13791181 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 897FBCD4F26 for ; Wed, 4 Sep 2024 16:16:06 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.790555.1200419 (Exim 4.92) (envelope-from ) id 1slsfm-0002gl-MI; Wed, 04 Sep 2024 16:15:58 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 790555.1200419; Wed, 04 Sep 2024 16:15:58 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1slsfm-0002fi-AO; Wed, 04 Sep 2024 16:15:58 +0000 Received: by outflank-mailman (input) for mailman id 790555; Wed, 04 Sep 2024 16:15:56 +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 1slsfk-0000I6-R3 for xen-devel@lists.xenproject.org; Wed, 04 Sep 2024 16:15:56 +0000 Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [2a00:1450:4864:20::234]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id f6feaa82-6ad8-11ef-a0b3-8be0dac302b0; Wed, 04 Sep 2024 18:15:56 +0200 (CEST) Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2f6514f23b6so19840491fa.1 for ; Wed, 04 Sep 2024 09:15:56 -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-2f6151881dcsm26217611fa.124.2024.09.04.09.15.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2024 09:15:54 -0700 (PDT) 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: f6feaa82-6ad8-11ef-a0b3-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725466556; x=1726071356; 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=nn/Mzsj0J8g/Mphb+PXQ5WHUtYUEk9GjObY40SBe48s=; b=aAnh+FEeyrd1mo7qxAuBWBCnrbCHW/amr4H/pwcwAxJUHxwVCNyvcSnZE+cPJ9naMS +Kovigp1eGbNUIr+JyO75Jchku1dx0jY5OQ3SyRRLofyALoPrZ/KFmEMdwD3y3bhqAzf MAkuZXE4qhSnMHqJ15DfPtaisM0fLYC49Ox42TZadZ3HM+FGMWOiexPqtB3h5v6N1YOe IV0cDW19onLs3vO8/njo7nkhTIYUy9RqjsFCW5sQBCvUXdYB4a/azMMAQdpuRIG3Sb4T 2xA4w6rdl11wPsOeuax/ai0d/Lc2vwdrHxCNHO6Dpcuyk96fc7fcAoDNMm1CVzHFvlW4 W53g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725466556; x=1726071356; 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=nn/Mzsj0J8g/Mphb+PXQ5WHUtYUEk9GjObY40SBe48s=; b=W33nRkkZgL7J5crBB1fbayoCRKXYx5VEzK8QHGVgy1h253C8lNCXjfMEcU4iVEnGfE WNGooLnXJyGJS5pT4j3C3L4gCzRoH9trAzblc4yK8bOUcci2HMBh1oiAU+VZTucxopFs r0FfsTO5WnIOxfoV0hkjdfABLQXNJVYeZ/x7jnfnUT++viFHkcO2O4pBBujqKXuGVF1l K8vbcwOkhYew0mWwMfb8HR8RAoDTglBPutxukGhwwPydVKt2pnWZQNmcZsC3sp0+QMLv kMVHh5rYkQFu7HReBf8+CqTP8bTVVAV1kJJjBhth87RM964Q5kyutQgmk1aiuu63mjus 5ZaA== X-Forwarded-Encrypted: i=1; AJvYcCUr96729X/VTjoX/YJM2petLpyZEQZcWCwXxqcz6I0iQt7dlrsZ81dH8HL6e5TiS1yLS874Pohv19A=@lists.xenproject.org X-Gm-Message-State: AOJu0YyDftWFjOeKDeq8wbrSB4bJ69/Ssq8jV5IM/+XXoaNvtCn93PRs VHT6CVrPML9gtx9+DchZ+9snlufyfLJDKLTnzM0D5U7DCwAo5Weu X-Google-Smtp-Source: AGHT+IF6S1OoJeZCF42GJKo/qiy2ZeZ6a9HHHlUxboixNuGEbZq+dI0mGFAzSTpOvJ4LlUMQwdzjQw== X-Received: by 2002:a2e:bc19:0:b0:2f5:966:c22e with SMTP id 38308e7fff4ca-2f6105d74e3mr207636241fa.11.1725466555495; Wed, 04 Sep 2024 09:15:55 -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, "Edgar E. Iglesias" Subject: [PULL v1 09/12] hw/arm: xenpvh: Reverse virtio-mmio creation order Date: Wed, 4 Sep 2024 18:15:33 +0200 Message-ID: <20240904161537.664189-10-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 From: "Edgar E. Iglesias" We've been creating the virtio-mmio devices in forwards order but since the qbus lists prepend (rather than append) entries, the virtio busses end up with decreasing base address order. Xen enables virtio-mmio nodes in forwards order so there's been a missmatch. So far, we've been working around this with an out-of-tree patch to Xen. This reverses the order making sure the virtio busses end up ordered with increasing base addresses avoiding the need to patch Xen. Signed-off-by: Edgar E. Iglesias Acked-by: Stefano Stabellini --- hw/xen/xen-pvh-common.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/hw/xen/xen-pvh-common.c b/hw/xen/xen-pvh-common.c index 880e8143d7..295f920442 100644 --- a/hw/xen/xen-pvh-common.c +++ b/hw/xen/xen-pvh-common.c @@ -75,7 +75,18 @@ static void xen_create_virtio_mmio_devices(XenPVHMachineState *s) { int i; - for (i = 0; i < s->cfg.virtio_mmio_num; i++) { + /* + * We create the transports in reverse order. Since qbus_realize() + * prepends (not appends) new child buses, the decrementing loop below will + * create a list of virtio-mmio buses with increasing base addresses. + * + * When a -device option is processed from the command line, + * qbus_find_recursive() picks the next free virtio-mmio bus in forwards + * order. + * + * This is what the Xen tools expect. + */ + for (i = s->cfg.virtio_mmio_num - 1; i >= 0; i--) { hwaddr base = s->cfg.virtio_mmio.base + i * s->cfg.virtio_mmio.size; qemu_irq irq = qemu_allocate_irq(xen_set_irq, NULL, s->cfg.virtio_mmio_irq_base + i); From patchwork Wed Sep 4 16:15:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 13791182 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2833FCD4853 for ; Wed, 4 Sep 2024 16:16:09 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.790556.1200434 (Exim 4.92) (envelope-from ) id 1slsfp-0003Ot-06; Wed, 04 Sep 2024 16:16:01 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 790556.1200434; Wed, 04 Sep 2024 16:16:00 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1slsfo-0003OZ-Ow; Wed, 04 Sep 2024 16:16:00 +0000 Received: by outflank-mailman (input) for mailman id 790556; Wed, 04 Sep 2024 16:15:59 +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 1slsfn-0000I6-Fu for xen-devel@lists.xenproject.org; Wed, 04 Sep 2024 16:15:59 +0000 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [2a00:1450:4864:20::131]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id f87def00-6ad8-11ef-a0b3-8be0dac302b0; Wed, 04 Sep 2024 18:15:58 +0200 (CEST) Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-533463f6b16so1384139e87.1 for ; Wed, 04 Sep 2024 09:15:58 -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-53540841326sm2387308e87.197.2024.09.04.09.15.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2024 09:15:56 -0700 (PDT) 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: f87def00-6ad8-11ef-a0b3-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725466558; x=1726071358; 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=AhHuSPxpBNKwAgr3pqcWE8F4qfu6xeqGgbqjKgqrTwo=; b=PZo2ZVQtyAJzZPCroq0czgVOh6Sf9InaY0/Dq94KvWD7L3ONtu57hA4Vka5wVsea2h 0PKDaP80gBTGfTpMr8ilReU2AZnQur/mJ9O1ALFZGNViwCjmmMQ8PLdko+JMw8Q2hbU0 ZuL34OCQt9Zik6pC7k0Hpby4x/MYguBi+mK3ywABfzeuOMvIX+h7rMAMHzUW7gH4RZYc 1wLe5EywNh/nVHjNl9AT+Q2lW50G0+VF0UT343UfE3x4umQobQ80mN+rHFPE3LX63Zby JSwNUA5lhQ+qHoxLBKpJokJ3gRLU2GAKV7XTnFy30bKP+dZer1AVjv094myFAIp07nIW +4lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725466558; x=1726071358; 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=AhHuSPxpBNKwAgr3pqcWE8F4qfu6xeqGgbqjKgqrTwo=; b=nI3sd5XvWgF4ja09sLxz9n0xrVOds939tY/LcVFr1SO4Vi2J2YS66ZIuOrbydG8DPz SMmIRW6AWNFheKswRN1gq+BtiEnsUtmjG/hIpmEEH3WcSRdLEcI3Vo5am8AMxcT3gdKh /GiMTFw1zNzyr7TaRbUX3Hjzol4kZcCoXwGWsjTDRdpw9xtxNuGhT78Heotr8YZ0SMal Mwp8Zyn8uqjyJ6G6srWAXrPHuefje/qX2W+tiVc5r5eB6nUNeA4kcxP13Gww2jsaj8zM 1CDkw03vQHFSHD774shEeGVXmKQDWva08W7Oa+6ER4c6AdJ8gN8n2HSCk1CsaWaF1z4k Sbbw== X-Forwarded-Encrypted: i=1; AJvYcCU25D+AykhEAFFfuqpxcBqO9bbg4s3tWy7nljISzFZVpyGm2CVScpnfnBR461VtdPm2FhPrqgOsYQ8=@lists.xenproject.org X-Gm-Message-State: AOJu0Yxf0CRWczIWTSYo1PfP0tNmgbJuSO2VQ4A+x0n16b8iaTVpa+3L nFUPTL1hADIfdlywtBtQpdUh+jyZ8bnWUj1cpOJmhNAJoII/S5jg X-Google-Smtp-Source: AGHT+IF1GFmSMfUcd/mUHwagfqt5mpNvfaEt+oYlqwsbk12notXPjCro2OfzhCpiGNq2eIcwaUFOhQ== X-Received: by 2002:a05:6512:1192:b0:52f:eb:aaca with SMTP id 2adb3069b0e04-53565f22906mr2195749e87.32.1725466557827; Wed, 04 Sep 2024 09:15:57 -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, "Edgar E. Iglesias" Subject: [PULL v1 10/12] hw/xen: pvh-common: Add support for creating PCIe/GPEX Date: Wed, 4 Sep 2024 18:15:34 +0200 Message-ID: <20240904161537.664189-11-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 From: "Edgar E. Iglesias" Add support for optionally creating a PCIe/GPEX controller. Signed-off-by: Edgar E. Iglesias Reviewed-by: Stefano Stabellini --- hw/xen/xen-pvh-common.c | 76 +++++++++++++++++++++++++++++++++ include/hw/xen/xen-pvh-common.h | 29 +++++++++++++ 2 files changed, 105 insertions(+) diff --git a/hw/xen/xen-pvh-common.c b/hw/xen/xen-pvh-common.c index 295f920442..28d7168446 100644 --- a/hw/xen/xen-pvh-common.c +++ b/hw/xen/xen-pvh-common.c @@ -122,6 +122,64 @@ static void xen_enable_tpm(XenPVHMachineState *s) } #endif +/* + * We use the GPEX PCIe controller with its internal INTX PCI interrupt + * swizzling. This swizzling is emulated in QEMU and routes all INTX + * interrupts from endpoints down to only 4 INTX interrupts. + * See include/hw/pci/pci.h : pci_swizzle() + */ +static inline void xenpvh_gpex_init(XenPVHMachineState *s, + XenPVHMachineClass *xpc, + MemoryRegion *sysmem) +{ + MemoryRegion *ecam_reg; + MemoryRegion *mmio_reg; + DeviceState *dev; + int i; + + object_initialize_child(OBJECT(s), "gpex", &s->pci.gpex, + TYPE_GPEX_HOST); + dev = DEVICE(&s->pci.gpex); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + + ecam_reg = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0); + memory_region_add_subregion(sysmem, s->cfg.pci_ecam.base, ecam_reg); + + mmio_reg = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 1); + + if (s->cfg.pci_mmio.size) { + memory_region_init_alias(&s->pci.mmio_alias, OBJECT(dev), "pcie-mmio", + mmio_reg, + s->cfg.pci_mmio.base, s->cfg.pci_mmio.size); + memory_region_add_subregion(sysmem, s->cfg.pci_mmio.base, + &s->pci.mmio_alias); + } + + if (s->cfg.pci_mmio_high.size) { + memory_region_init_alias(&s->pci.mmio_high_alias, OBJECT(dev), + "pcie-mmio-high", + mmio_reg, s->cfg.pci_mmio_high.base, s->cfg.pci_mmio_high.size); + memory_region_add_subregion(sysmem, s->cfg.pci_mmio_high.base, + &s->pci.mmio_high_alias); + } + + /* + * PVH implementations with PCI enabled must provide set_pci_intx_irq() + * and optionally an implementation of set_pci_link_route(). + */ + assert(xpc->set_pci_intx_irq); + + for (i = 0; i < GPEX_NUM_IRQS; i++) { + qemu_irq irq = qemu_allocate_irq(xpc->set_pci_intx_irq, s, i); + + sysbus_connect_irq(SYS_BUS_DEVICE(dev), i, irq); + gpex_set_irq_num(GPEX_HOST(dev), i, s->cfg.pci_intx_irq_base + i); + if (xpc->set_pci_link_route) { + xpc->set_pci_link_route(i, s->cfg.pci_intx_irq_base + i); + } + } +} + static void xen_pvh_init(MachineState *ms) { XenPVHMachineState *s = XEN_PVH_MACHINE(ms); @@ -152,6 +210,15 @@ static void xen_pvh_init(MachineState *ms) } #endif + /* Non-zero pci-ecam-size enables PCI. */ + if (s->cfg.pci_ecam.size) { + if (s->cfg.pci_ecam.size != 256 * MiB) { + error_report("pci-ecam-size only supports values 0 or 0x10000000"); + exit(EXIT_FAILURE); + } + xenpvh_gpex_init(s, xpc, sysmem); + } + /* Call the implementation specific init. */ if (xpc->init) { xpc->init(ms); @@ -200,6 +267,9 @@ XEN_PVH_PROP_MEMMAP(ram_high) /* TPM only has a base-addr option. */ XEN_PVH_PROP_MEMMAP_BASE(tpm) XEN_PVH_PROP_MEMMAP(virtio_mmio) +XEN_PVH_PROP_MEMMAP(pci_ecam) +XEN_PVH_PROP_MEMMAP(pci_mmio) +XEN_PVH_PROP_MEMMAP(pci_mmio_high) void xen_pvh_class_setup_common_props(XenPVHMachineClass *xpc) { @@ -242,6 +312,12 @@ do { \ OC_MEMMAP_PROP(oc, "virtio-mmio", virtio_mmio); } + if (xpc->has_pci) { + OC_MEMMAP_PROP(oc, "pci-ecam", pci_ecam); + OC_MEMMAP_PROP(oc, "pci-mmio", pci_mmio); + OC_MEMMAP_PROP(oc, "pci-mmio-high", pci_mmio_high); + } + #ifdef CONFIG_TPM if (xpc->has_tpm) { object_class_property_add(oc, "tpm-base-addr", "uint64_t", diff --git a/include/hw/xen/xen-pvh-common.h b/include/hw/xen/xen-pvh-common.h index 77fd98b9fe..bc09eea936 100644 --- a/include/hw/xen/xen-pvh-common.h +++ b/include/hw/xen/xen-pvh-common.h @@ -25,10 +25,29 @@ struct XenPVHMachineClass { /* PVH implementation specific init. */ void (*init)(MachineState *state); + /* + * set_pci_intx_irq - Deliver INTX irqs to the guest. + * + * @opaque: pointer to XenPVHMachineState. + * @irq: IRQ after swizzling, between 0-3. + * @level: IRQ level. + */ + void (*set_pci_intx_irq)(void *opaque, int irq, int level); + + /* + * set_pci_link_route: - optional implementation call to setup + * routing between INTX IRQ (0 - 3) and GSI's. + * + * @line: line the INTx line (0 => A .. 3 => B) + * @irq: GSI + */ + int (*set_pci_link_route)(uint8_t line, uint8_t irq); + /* * Each implementation can optionally enable features that it * supports and are known to work. */ + bool has_pci; bool has_tpm; bool has_virtio_mmio; }; @@ -44,6 +63,12 @@ struct XenPVHMachineState { MemoryRegion high; } ram; + struct { + GPEXHost gpex; + MemoryRegion mmio_alias; + MemoryRegion mmio_high_alias; + } pci; + struct { MemMapEntry ram_low, ram_high; MemMapEntry tpm; @@ -52,6 +77,10 @@ struct XenPVHMachineState { MemMapEntry virtio_mmio; uint32_t virtio_mmio_num; uint32_t virtio_mmio_irq_base; + + /* PCI */ + MemMapEntry pci_ecam, pci_mmio, pci_mmio_high; + uint32_t pci_intx_irq_base; } cfg; }; From patchwork Wed Sep 4 16:15:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 13791183 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EB29CCD4857 for ; Wed, 4 Sep 2024 16:16:12 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.790558.1200443 (Exim 4.92) (envelope-from ) id 1slsfr-0003sm-91; Wed, 04 Sep 2024 16:16:03 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 790558.1200443; Wed, 04 Sep 2024 16:16: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 1slsfr-0003sK-3K; Wed, 04 Sep 2024 16:16:03 +0000 Received: by outflank-mailman (input) for mailman id 790558; Wed, 04 Sep 2024 16:16:01 +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 1slsfp-0000LO-S9 for xen-devel@lists.xenproject.org; Wed, 04 Sep 2024 16:16:01 +0000 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [2a00:1450:4864:20::22e]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id f910da40-6ad8-11ef-99a1-01e77a169b0f; Wed, 04 Sep 2024 18:15:59 +0200 (CEST) Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2f3f0a31ab2so77904341fa.0 for ; Wed, 04 Sep 2024 09:15:59 -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-2f614f384eesm24841131fa.62.2024.09.04.09.15.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2024 09:15:58 -0700 (PDT) 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: f910da40-6ad8-11ef-99a1-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725466559; x=1726071359; 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=JNAX37zDCliJxTzZOV0veuq7ySJeesgiUypThOWliKg=; b=S4Vl5x6mvohebCnHgUWtAdmMF2wfgSt0fiY7GnlvWFN6G6ekRawLvuGyRIK1lzBqhP 3XGoEodURgWpZHGFb9aMIo1VyVQMwwxZGB/faZi96oICFYg93cx1Dss/me+02TiGxFxG Ai83UP1z8mR0uSz0TntH44S2GpqUJ/mHSNwjZ5Vpcrf/a6j3EqK0rjM8MUK3jyIhY9o1 uc0Pgb2995KJ6UT3IZGDg0vLYWsfeiOb4EorlptTOKQUHsLL9POIKw+SkuIpyIyfb0MX Murjrd+1tJbq6a/MSflCibD3kZ8buCbfydOazxw7Ahkv94cI6VEEMsUFYF6Qq8LJpP1e KHrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725466559; x=1726071359; 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=JNAX37zDCliJxTzZOV0veuq7ySJeesgiUypThOWliKg=; b=L2PKrlKGzH3Aiebxw9TtOhOfHbclR4QDc7+0yHHhX9+nS75GolYbbswetfMPM8ycX+ ymDmyL3St7wfEZM06cio4zWfd/yESKdSCHOoSAmGf5qbCsu1EvrPdRqdOgi94oSojbAU 5t+ChkwEwUU3l9FjHiKRgpgM4UAEkUDiOstXneSBfP1XNc3qd7PK2xrYAk6O1x+09Tkb PAUMFX8moMZSEkCWAkhhDRKQm9SIj6RefIPDNXXbzuHxMBwgag4J0zF3pkNHWt90byDj +2DDYG3s1/QY79JJX+wgyDvyEmmcTq+Ju0gl0X3suXQ9U1YDSGmaJSA7Wp70YJkTwJEf rnmQ== X-Forwarded-Encrypted: i=1; AJvYcCVqEbnKManI77SCrXOXIS9YM8XEYmyr1T20Hq+h2UC3duqWevn9jtG174CBnG0bnnM5fmRZwuSrnJ0=@lists.xenproject.org X-Gm-Message-State: AOJu0YyRZr4t5AgsLGe0RmFOTt08zmN3kYDzzuzOkUX7fneayD9QmOp7 zYKvXAPnmYHwi5Qa7VfU2rhlbtnjs3kmkHd3WCKsCtGXy2DWoY5s X-Google-Smtp-Source: AGHT+IEAwPaVJCHA49+7M5oevfh+eYRN2zuFYPqyzy6yv+vvfKCbQ+16M9Wi0x4p76qr+HpI/LDCcw== X-Received: by 2002:a2e:be03:0:b0:2ef:2b45:b71d with SMTP id 38308e7fff4ca-2f6103c83ccmr138143261fa.24.1725466558973; Wed, 04 Sep 2024 09:15:58 -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, "Edgar E. Iglesias" , Paolo Bonzini , Richard Henderson , Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum Subject: [PULL v1 11/12] hw/i386/xen: Add a Xen PVH x86 machine Date: Wed, 4 Sep 2024 18:15:35 +0200 Message-ID: <20240904161537.664189-12-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 From: "Edgar E. Iglesias" Add a Xen PVH x86 machine based on the abstract PVH Machine. Signed-off-by: Edgar E. Iglesias Reviewed-by: Stefano Stabellini --- hw/i386/xen/meson.build | 1 + hw/i386/xen/xen-pvh.c | 121 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 122 insertions(+) create mode 100644 hw/i386/xen/xen-pvh.c diff --git a/hw/i386/xen/meson.build b/hw/i386/xen/meson.build index 3f0df8bc07..c73c62b8e3 100644 --- a/hw/i386/xen/meson.build +++ b/hw/i386/xen/meson.build @@ -4,6 +4,7 @@ i386_ss.add(when: 'CONFIG_XEN', if_true: files( )) i386_ss.add(when: ['CONFIG_XEN', xen], if_true: files( 'xen-hvm.c', + 'xen-pvh.c', )) i386_ss.add(when: 'CONFIG_XEN_BUS', if_true: files( diff --git a/hw/i386/xen/xen-pvh.c b/hw/i386/xen/xen-pvh.c new file mode 100644 index 0000000000..45645667e9 --- /dev/null +++ b/hw/i386/xen/xen-pvh.c @@ -0,0 +1,121 @@ +/* + * QEMU Xen PVH x86 Machine + * + * Copyright (c) 2024 Advanced Micro Devices, Inc. + * Written by Edgar E. Iglesias + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "qemu/error-report.h" +#include "hw/boards.h" +#include "sysemu/sysemu.h" +#include "hw/xen/arch_hvm.h" +#include +#include "hw/xen/xen-pvh-common.h" + +#define TYPE_XEN_PVH_X86 MACHINE_TYPE_NAME("xenpvh") +OBJECT_DECLARE_SIMPLE_TYPE(XenPVHx86State, XEN_PVH_X86) + +struct XenPVHx86State { + /*< private >*/ + XenPVHMachineState parent; + + DeviceState **cpu; +}; + +static DeviceState *xen_pvh_cpu_new(MachineState *ms, + int64_t apic_id) +{ + Object *cpu = object_new(ms->cpu_type); + + object_property_add_child(OBJECT(ms), "cpu[*]", cpu); + object_property_set_uint(cpu, "apic-id", apic_id, &error_fatal); + qdev_realize(DEVICE(cpu), NULL, &error_fatal); + object_unref(cpu); + + return DEVICE(cpu); +} + +static void xen_pvh_init(MachineState *ms) +{ + XenPVHx86State *xp = XEN_PVH_X86(ms); + int i; + + /* Create dummy cores. This will indirectly create the APIC MSI window. */ + xp->cpu = g_malloc(sizeof xp->cpu[0] * ms->smp.max_cpus); + for (i = 0; i < ms->smp.max_cpus; i++) { + xp->cpu[i] = xen_pvh_cpu_new(ms, i); + } +} + +static void xen_pvh_instance_init(Object *obj) +{ + XenPVHMachineState *s = XEN_PVH_MACHINE(obj); + + /* Default values. */ + s->cfg.ram_low = (MemMapEntry) { 0x0, 0x80000000U }; + s->cfg.ram_high = (MemMapEntry) { 0xC000000000ULL, 0x4000000000ULL }; + s->cfg.pci_intx_irq_base = 16; +} + +/* + * Deliver INTX interrupts to Xen guest. + */ +static void xen_pvh_set_pci_intx_irq(void *opaque, int irq, int level) +{ + /* + * Since QEMU emulates all of the swizziling + * We don't want Xen to do any additional swizzling in + * xen_set_pci_intx_level() so we always set device to 0. + */ + if (xen_set_pci_intx_level(xen_domid, 0, 0, 0, irq, level)) { + error_report("xendevicemodel_set_pci_intx_level failed"); + } +} + +static void xen_pvh_machine_class_init(ObjectClass *oc, void *data) +{ + XenPVHMachineClass *xpc = XEN_PVH_MACHINE_CLASS(oc); + MachineClass *mc = MACHINE_CLASS(oc); + + mc->desc = "Xen PVH x86 machine"; + mc->default_cpu_type = TARGET_DEFAULT_CPU_TYPE; + + /* mc->max_cpus holds the MAX value allowed in the -smp cmd-line opts. */ + mc->max_cpus = HVM_MAX_VCPUS; + + /* We have an implementation specific init to create CPU objects. */ + xpc->init = xen_pvh_init; + + /* + * PCI INTX routing. + * + * We describe the mapping between the 4 INTX interrupt and GSIs + * using xen_set_pci_link_route(). xen_pvh_set_pci_intx_irq is + * used to deliver the interrupt. + */ + xpc->set_pci_intx_irq = xen_pvh_set_pci_intx_irq; + xpc->set_pci_link_route = xen_set_pci_link_route; + + /* List of supported features known to work on PVH x86. */ + xpc->has_pci = true; + + xen_pvh_class_setup_common_props(xpc); +} + +static const TypeInfo xen_pvh_x86_machine_type = { + .name = TYPE_XEN_PVH_X86, + .parent = TYPE_XEN_PVH_MACHINE, + .class_init = xen_pvh_machine_class_init, + .instance_init = xen_pvh_instance_init, + .instance_size = sizeof(XenPVHx86State), +}; + +static void xen_pvh_machine_register_types(void) +{ + type_register_static(&xen_pvh_x86_machine_type); +} + +type_init(xen_pvh_machine_register_types) From patchwork Wed Sep 4 16:15:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 13791184 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7B2CFCD4853 for ; Wed, 4 Sep 2024 16:16:13 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.790559.1200449 (Exim 4.92) (envelope-from ) id 1slsfs-00044E-5t; Wed, 04 Sep 2024 16:16:04 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 790559.1200449; Wed, 04 Sep 2024 16:16:04 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1slsfr-00041M-Sg; Wed, 04 Sep 2024 16:16:03 +0000 Received: by outflank-mailman (input) for mailman id 790559; Wed, 04 Sep 2024 16:16: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 1slsfq-0000I6-5u for xen-devel@lists.xenproject.org; Wed, 04 Sep 2024 16:16:02 +0000 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [2a00:1450:4864:20::22f]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id fa4c4541-6ad8-11ef-a0b3-8be0dac302b0; Wed, 04 Sep 2024 18:16:01 +0200 (CEST) Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2f50966c448so78902591fa.2 for ; Wed, 04 Sep 2024 09:16: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-2f66362f6ecsm321501fa.67.2024.09.04.09.15.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2024 09:15:59 -0700 (PDT) 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: fa4c4541-6ad8-11ef-a0b3-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725466561; x=1726071361; 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=KdxPAmDEdUAtpsJzqv9PT9FKB3N+OoRAOYXGitcO7RQ=; b=mZqr1AUuprYV4st4YKuixFqCftbL1dRsHIQQrkRQijs37s4W3BZtl1/PGhsHlmnsJt Awb0QjNY/BT+KItiWrPYIEVVHXHLo/6oRkgV19IorctcEqkFk37ZnJN+TxmcLg7FdYc6 t9fMTMe1YevdZp+TrWa4aLT1SfJHVlrI5Jm2l9S3fDmUcB08hzS2MpzlF3MIdjqr61jm V/jMbLJOiEp1SvqEKxP3jkSy02wWZjcJuKlpLhwRHEkF3ODkKZ0fEys1oZRbUvzRsP8l ZuIbIKLhSgVLUyFBgxGA6ryhoZ54OAYF6PSQqfS9ZGk60WIjgmu0HP1rBior9cBKds+B UPyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725466561; x=1726071361; 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=KdxPAmDEdUAtpsJzqv9PT9FKB3N+OoRAOYXGitcO7RQ=; b=IVEiYS8WximjzFeG+O87Hgap66H5YZVoIzngI+QiJpNzl5GeQ40qCS2thv+t3PW8FD 93/etNC9nB5cz3TWcseWNtmeYMUWMycenr2qKWOy8kYBmsnqeyGiv7iLOGLvuXV04GgW +3TP6S7Jym5LM+oJ6APwaKTV0jJf1Zs26SlmvLCBvAUWoAth6L1TmyHG0nq8ZU50sikp 8iEJuqZ7+AOiwPet0CvvwVq8Zx3KFJEEomfYBN6jBQYTjnGToHYkEF2Sg8MtLsrHnGQ2 CK/ex8FNcXMmvTY2sfiaKqB3tMNRbbFrTm3knoEKOr6Tb69lx/URA7kOZ87ET4E4+EEX 9PGA== X-Forwarded-Encrypted: i=1; AJvYcCWVxNb1MhjU2dwz9/Wzd6fAVyEoUVkaFgJP4mOfZcXOP2sHWPOy93DloKFOy/MJJ6bEzxsmX3oQ0kM=@lists.xenproject.org X-Gm-Message-State: AOJu0YzZ0hAYw9AGlbT8R6pnfDpEJP9DDqGf4SZH0HXjG7iYS1CeAEsI iDug2fYBHNxsvrLDpNAy2x6UUEWqoHvpjGsMo7D+DZTuNYeRl0mQ X-Google-Smtp-Source: AGHT+IFAdjefLP0GVVZKIUrpFKMNdvV3ASjqYkfelwsocfjh9WpkL3JieubicWsRTNAejwGyS1Ovnw== X-Received: by 2002:a2e:460a:0:b0:2f6:4bed:9b44 with SMTP id 38308e7fff4ca-2f64bed9bf0mr27782561fa.47.1725466561028; Wed, 04 Sep 2024 09:16:01 -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, "Edgar E. Iglesias" , Paolo Bonzini Subject: [PULL v1 12/12] docs/system/i386: xenpvh: Add a basic description Date: Wed, 4 Sep 2024 18:15:36 +0200 Message-ID: <20240904161537.664189-13-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 From: "Edgar E. Iglesias" Signed-off-by: Edgar E. Iglesias Reviewed-by: Stefano Stabellini --- MAINTAINERS | 1 + docs/system/i386/xenpvh.rst | 49 +++++++++++++++++++++++++++++++++++++ docs/system/target-i386.rst | 1 + 3 files changed, 51 insertions(+) create mode 100644 docs/system/i386/xenpvh.rst diff --git a/MAINTAINERS b/MAINTAINERS index c2fb0c2f42..c14ac014e2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -560,6 +560,7 @@ F: include/sysemu/xen.h F: include/sysemu/xen-mapcache.h F: stubs/xen-hw-stub.c F: docs/system/arm/xenpvh.rst +F: docs/system/i386/xenpvh.rst Guest CPU Cores (NVMM) ---------------------- diff --git a/docs/system/i386/xenpvh.rst b/docs/system/i386/xenpvh.rst new file mode 100644 index 0000000000..354250f073 --- /dev/null +++ b/docs/system/i386/xenpvh.rst @@ -0,0 +1,49 @@ +Xen PVH machine (``xenpvh``) +========================================= + +Xen supports a spectrum of types of guests that vary in how they depend +on HW virtualization features, emulation models and paravirtualization. +PVH is a mode that uses HW virtualization features (like HVM) but tries +to avoid emulation models and instead use passthrough or +paravirtualized devices. + +QEMU can be used to provide PV virtio devices on an emulated PCIe controller. +That is the purpose of this minimal machine. + +Supported devices +----------------- + +The x86 Xen PVH QEMU machine provide the following devices: + +- RAM +- GPEX host bridge +- virtio-pci devices + +The idea is to only connect virtio-pci devices but in theory any compatible +PCI device model will work depending on Xen and guest support. + +Running +------- + +The Xen tools will typically construct a command-line and launch QEMU +for you when needed. But here's an example of what it can look like in +case you need to construct one manually: + +.. code-block:: console + + qemu-system-i386 -xen-domid 3 -no-shutdown \ + -chardev socket,id=libxl-cmd,path=/var/run/xen/qmp-libxl-3,server=on,wait=off \ + -mon chardev=libxl-cmd,mode=control \ + -chardev socket,id=libxenstat-cmd,path=/var/run/xen/qmp-libxenstat-3,server=on,wait=off \ + -mon chardev=libxenstat-cmd,mode=control \ + -nodefaults \ + -no-user-config \ + -xen-attach -name g0 \ + -vnc none \ + -display none \ + -device virtio-net-pci,id=nic0,netdev=net0,mac=00:16:3e:5c:81:78 \ + -netdev type=tap,id=net0,ifname=vif3.0-emu,br=xenbr0,script=no,downscript=no \ + -smp 4,maxcpus=4 \ + -nographic \ + -machine xenpvh,ram-low-base=0,ram-low-size=2147483648,ram-high-base=4294967296,ram-high-size=2147483648,pci-ecam-base=824633720832,pci-ecam-size=268435456,pci-mmio-base=4026531840,pci-mmio-size=33554432,pci-mmio-high-base=824902156288,pci-mmio-high-size=68719476736 \ + -m 4096 diff --git a/docs/system/target-i386.rst b/docs/system/target-i386.rst index 1b8a1f248a..23e84e3ba7 100644 --- a/docs/system/target-i386.rst +++ b/docs/system/target-i386.rst @@ -26,6 +26,7 @@ Architectural features i386/cpu i386/hyperv i386/xen + i386/xenpvh i386/kvm-pv i386/sgx i386/amd-memory-encryption