From patchwork Mon Aug 12 13:05:56 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: 13760549 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.gnu.org (lists.gnu.org [209.51.188.17]) (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 BBA68C52D7C for ; Mon, 12 Aug 2024 13:07:16 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sdUkj-0003rU-9B; Mon, 12 Aug 2024 09:06:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sdUkg-0003py-JV for qemu-devel@nongnu.org; Mon, 12 Aug 2024 09:06:22 -0400 Received: from mail-lj1-x236.google.com ([2a00:1450:4864:20::236]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sdUke-00045r-TZ for qemu-devel@nongnu.org; Mon, 12 Aug 2024 09:06:22 -0400 Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-2f035ae0fd1so46982211fa.2 for ; Mon, 12 Aug 2024 06:06:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723467978; x=1724072778; darn=nongnu.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=FnvsVFgAwwQYqvVPxF+lYxfpYXdBbERxwoGEJpJUJUI=; b=E3ZkjDrq2BqsR83/DJJcwnb85eiv7xKGN6xN5OicuK3nKNrSK/MRUpShpZng40BwO1 1SG73c9c+1VMuzCfIx8MerlCVLv5Ci8SW9AVF8USeFhNiB8FcAyZNRv22C+YLCQnqa4k Z+1WI5Fhkiauc2io4nVoKDF/Kdpst2Wq9iT1PVPGuqWfXMxj0QqnL53StE+5WnMrWelq v/7gnSKeBmAty92sCgh11C550UIwEtiJPgQR4vGyYHDgw67BJaCUc/38FTgd0dPFOCtJ oCYQiV3jcyqslkLd6T/0YJVcxL+ga1D2dPrBnL6K1WFbpa831gu6VrJE6hPqGE3HYyX5 ru1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723467978; x=1724072778; 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=FnvsVFgAwwQYqvVPxF+lYxfpYXdBbERxwoGEJpJUJUI=; b=bnExakmswpuAiIyxOW//WYPbv4zFh9H8RQXuFxrWHmIiipwKIrR8xLp+59/3FQYMJR 7YmA0z5EqG7bC+GxnmF7PyzmM9TdCh8Rj41DT2vBxj8MglxITm5+JvnJqTqpRNMA4Bd1 RnG5iCg+HXHXYFfu79a/1OYUt171gBoKHopT9ofpG3d6o3QcWdae7RStD0ygs7DFbi24 lGeMV39gbc58k/Gr/bJUkq2/QMW3/kuTf+MzGFZpkr8NzLdvDCW9gJkMv1ooY18iWIa+ O65GM6QUxhLx4nibEKGRcLZ5gIOWKbjNT735jP3GCTl0f8go0akjgZXqzW+9XZcKbbNp CEhA== X-Gm-Message-State: AOJu0Yyt1Tmb5vG2rb4Rn8uCfioNBTmWm8jSLqR6WUzf6HStTcvp0rxk nZFV6G6CWFvYXeucWWdRZ0Zi5dO9+/pMtLjEs/4kpqS33y3XR2ieJ2KAxf+c X-Google-Smtp-Source: AGHT+IEH+rt8R3wDG+QKY36k4z1epabtE0qsH5Q2v+VF3qRP2OiK5eGbpOcoKlfiNpSaMtmPoTatVw== X-Received: by 2002:a2e:721a:0:b0:2ef:1d79:cae7 with SMTP id 38308e7fff4ca-2f2b714cfddmr1523661fa.14.1723467977110; Mon, 12 Aug 2024 06:06:17 -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-2f29203d817sm8573481fa.99.2024.08.12.06.06.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 06:06:16 -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: [PATCH v1 01/10] MAINTAINERS: Add docs/system/arm/xenpvh.rst Date: Mon, 12 Aug 2024 15:05:56 +0200 Message-ID: <20240812130606.90410-2-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240812130606.90410-1-edgar.iglesias@gmail.com> References: <20240812130606.90410-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::236; envelope-from=edgar.iglesias@gmail.com; helo=mail-lj1-x236.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 10af212632..a24c2e14d9 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 Mon Aug 12 13:05:57 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: 13760554 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.gnu.org (lists.gnu.org [209.51.188.17]) (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 C5FFFC3DA7F for ; Mon, 12 Aug 2024 13:08:07 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sdUkl-0003s2-2R; Mon, 12 Aug 2024 09:06:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sdUki-0003qT-2L; Mon, 12 Aug 2024 09:06:24 -0400 Received: from mail-lj1-x235.google.com ([2a00:1450:4864:20::235]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sdUkg-00045u-2o; Mon, 12 Aug 2024 09:06:23 -0400 Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-2f189a2a7f8so44355201fa.2; Mon, 12 Aug 2024 06:06:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723467979; x=1724072779; darn=nongnu.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=q0MBRxvJH0y/bIJK1xHx6k1kVCY+2jxCQ2h5fP5Rdc8=; b=GC1Fa9CLRQTiJR7TxBqPA1ioj6d9KlQTjmH5B+8hf6Pfzz+75i6vguK1PzXHDubp30 kBscQ1la7hb1R0xln6n0+EncRYnY/Tn9H/plIzbM0oVhvcpA6M6+SLwDfNu6yo6Gxyzs AxJdjEeopNiham173tI3C72t5ARcT8+GovPqMIhSNiNeZTzjJl6Nsm4t7Gnmqo69RaMK zFelu1R2g+H6G0nLYpKSZ4UZqZagmPBBb6giSFrUyt2LC1jOZiiUtCiT9jkxgKDBqVKV kza5xVk6tGQnKP9q/AlBD72srPohx2rH+3IkfTbhKfYRRov4P+hX93wr1gxg+eSWCCdb ppNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723467979; x=1724072779; 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=q0MBRxvJH0y/bIJK1xHx6k1kVCY+2jxCQ2h5fP5Rdc8=; b=kl4LX4lrMvW8v+oUdYhnvbGDV7iuopre2i0ouy9K1YYXaFmhwnMh2bfRmyLI7VBWcz M1N6gwJ/6VdsMHiNMlvxB2jOBFgw5mEw2EF7LiMRt7E/MpCm7ZCEOsUpwauuyH0hTcZS F+ay3jWAyzyEvsdYdidb1GytXwnSgwQ1jV6HY7jWrEys1GDFlNtHZX9jzzvB0hJsIv2H h1o0d9CbjvTK7ykaFnP+6O+5VCYheiIxfz04PBWhaG0jVAp+ochtB2vOwek3i+I3aO48 zb0lEjIYfoczFq148ZlJfvUY+qqZ7SktXzHt2hxW5qt7XX8BRO4rOFuPMD4KT0n1vOux kTBw== X-Forwarded-Encrypted: i=1; AJvYcCXkMchgDMcNwifw3SynlCHqIlo5QRwvcAiDKwMDxyo3fV5CpqHCEjaN3WtlBjo7HlM3P6Em+WeY54CMKzC60yZBN7ZI X-Gm-Message-State: AOJu0Yzd/RdXEX6Hy6Dk1kVlfmcI6Ve/EJdXCfnUb/oj8zhG3hZDClFL +DeFz6vVVlHIGBKu4Ovop1RlMkar3xDkizNHQVqdoY4fZfWhRnGMgXvtbO3e X-Google-Smtp-Source: AGHT+IFl4ehD3FYz4UFHWYeyrWigmFf76jU/CdxDFMCU8WOzXI0nnlPyTlTXorwYYcOTf9CmvnlIAA== X-Received: by 2002:a2e:8e6e:0:b0:2ef:2b45:b71d with SMTP id 38308e7fff4ca-2f2b7154f70mr1527581fa.24.1723467978593; Mon, 12 Aug 2024 06:06:18 -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-2f291df57cbsm8687111fa.52.2024.08.12.06.06.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 06:06:17 -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: [PATCH v1 02/10] hw/arm: xenpvh: Update file header to use SPDX Date: Mon, 12 Aug 2024 15:05:57 +0200 Message-ID: <20240812130606.90410-3-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240812130606.90410-1-edgar.iglesias@gmail.com> References: <20240812130606.90410-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::235; envelope-from=edgar.iglesias@gmail.com; helo=mail-lj1-x235.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 Mon Aug 12 13:05:58 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: 13760550 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.gnu.org (lists.gnu.org [209.51.188.17]) (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 D9A85C3DA7F for ; Mon, 12 Aug 2024 13:07:38 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sdUks-0004GS-T5; Mon, 12 Aug 2024 09:06:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sdUkk-0003sE-KG; Mon, 12 Aug 2024 09:06:26 -0400 Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sdUki-00046J-Np; Mon, 12 Aug 2024 09:06:26 -0400 Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-52f01613acbso5890016e87.1; Mon, 12 Aug 2024 06:06:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723467981; x=1724072781; darn=nongnu.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=kOLz6jSGUU8Xiq4wmRd5lgikGGH6JiIyvQ0oMaht6JA=; b=WX1kArF3QfH+VhbBB9xwWiXRVJCoTWxVJK8LOYG+9v57f1WqKxSFiR7FESGQbqoYC+ bGy2QtwgW+NJgCD2zlSU4wwHJecWVjtB3VNBPgu9q1JVgwFLJLpNR5szdqbDfx6dgm0P obutMNrncGZmoa54zg3o5gw/qZ0NN1wSfl5Zb60xWy1yJ3uoMp69akydCuuSQcuyaYLS bHxV6awYILWSk5mmTpw9jiH9ktOSqaK3sxeACG29/08QZmD1lhnp49QXJvK5sENv2T2H DYGO1mrOUBYmEXy9dSzmtpD+xmKigudg7CohRs8qgtzHaxHHtOEE0mR4ue+WJFMzSI4Y 0OdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723467981; x=1724072781; 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=kOLz6jSGUU8Xiq4wmRd5lgikGGH6JiIyvQ0oMaht6JA=; b=rDRRMnMy5rFYO/KFoN/Q9knSrSdd8WFiA5Y8Rtt1cyZc8IX3qkbCPRmYxZvDxELWsB 0GxjQinkEOtujKFXVXj0AB5j6qxQqqZqw2hhp3zgSmkoueURIelRXru6jriGfUXYxNp3 LsfQjRUFspGUm8YQmQ24Q/W5Stc15Dvg7sMYBE040wf8rmQ2aYaV+PuJlj/ofEacgWSh oJEW1r0pyIL8LtLKgskRVMdllbPMEuxySofjn3O6DVa5HGZRLlnjIWrNb4BNP494udO1 cuXPuWdIM4xHR+hatpN0Hn2dmM4H2EuwPdUgOdYPbJD8GIjLv58ooFTbzVna5hUBULsT GyPQ== X-Forwarded-Encrypted: i=1; AJvYcCVYYDWii4OvoKgSs7Zt/DmIAv/hnKEVuhO1SZVjJf1X437V0BssBbLTWjvPt6/v6KLhrMV0ljKNtA==@nongnu.org X-Gm-Message-State: AOJu0Yx65yjNRXOfvLSIZ5zlybvWky+Y4p4aI2QPhWZME+a8Of2lGCpZ gUKYV0mEFRZxZm2bAKS6SdvK0pcEJaY0su3hmRhv8CVkKrZTScQ2fhQ/AXOl X-Google-Smtp-Source: AGHT+IFVFpgUsSJvoRktx9P5RahE3NL+hK1oSSRb0VxLTivi6mQbcvmAYVxkizJenzqOQTjrR9idAw== X-Received: by 2002:a05:6512:4020:b0:531:5b03:b1f7 with SMTP id 2adb3069b0e04-5321367c4ecmr11696e87.10.1723467980688; Mon, 12 Aug 2024 06:06:20 -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-53200f4227csm730447e87.279.2024.08.12.06.06.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 06:06:19 -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: [PATCH v1 03/10] hw/arm: xenpvh: Tweak machine description Date: Mon, 12 Aug 2024 15:05:58 +0200 Message-ID: <20240812130606.90410-4-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240812130606.90410-1-edgar.iglesias@gmail.com> References: <20240812130606.90410-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12c; envelope-from=edgar.iglesias@gmail.com; helo=mail-lf1-x12c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 Mon Aug 12 13:05:59 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: 13760559 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.gnu.org (lists.gnu.org [209.51.188.17]) (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 82906C3DA7F for ; Mon, 12 Aug 2024 13:09:07 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sdUku-0004LD-4f; Mon, 12 Aug 2024 09:06:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sdUkm-0003zz-Mx; Mon, 12 Aug 2024 09:06:30 -0400 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sdUkj-00046P-EL; Mon, 12 Aug 2024 09:06:26 -0400 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-52f025bc147so4940358e87.3; Mon, 12 Aug 2024 06:06:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723467982; x=1724072782; darn=nongnu.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=xwk/c9fy7uMLWpwC3gxJL5qXeUXnd09Co6O9sN+JUhY=; b=Do70/WIyKcQqsaxL/jNIVm1OfMzzar5gGlHqD3KsT7Pp5u8125TLDVZ67peKOwO8Yk fdoB8rEv9BjeGs8dufHT2EPW9gnmtcH8TAx3/q+6YiTAgSnS3BF1pqSgg/UMYUUAMeU4 50QWEAiammNoyPjim8YXfZmRh/B0lCsWN4NtUwgbJTzNfp+uQ5UCM20x6i5GIrxfzJCw JRkGlxel4FOd4EtF76+gZNpO/0fI1jfZL4/gxY3rWvJOOMmoE+t46215CdBlFlJBZ557 OCGlztg43d5E67/CNPgaoISba/kCr5uS3ppiaiDJ47PHsDn4G0p6s355mgR7KXyXHYfB 3mSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723467982; x=1724072782; 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=xwk/c9fy7uMLWpwC3gxJL5qXeUXnd09Co6O9sN+JUhY=; b=mfWvbX9qff5XJpyMip0+dd4/ph4XU6sAv3fpddgotQzQPYnGEB+Y7zquUyZitUvoMn JvXs4/i7K7UYc1y4FfxIvB9ueWCxflc0ErlwAXFiAYZ1TWTGNNekMpdNIh2XzCXQsRcz 2x+KaX0fGXLsZYiDKtVQhhT7MwiiEy7UztriXF89jhuSFxuptcos9lr6nrkhuiAznHyW /ExGGjwTErCcjDFlRUUV7UlTEi0f7PD4MidO2OsDkAWD21MfMgumsBuGgMrk/Xds3myR WWs8GtH9BBLSPInKX9846eEbvLDQtcoUke7OiRNFyxNnFFTMFGyGXHPmhNVwwmmvzIcI N19A== X-Forwarded-Encrypted: i=1; AJvYcCXHdmCqO/WW7TcZF3kL+dWhcDy97X/1f/oektHLnlH2rYHkR36OIQ2jF0krKVbutGTtZAMi4ZaJ0W5yFl5qcuxf5ao8 X-Gm-Message-State: AOJu0YyE3wUCN3k62Skbj1Cl6tRa86WOA5Eo3BzCupmtna3ZF5qO2kNW pmKlYY07FAy+Exkm25VJcpDM4z9FyAdor+/vDsmjWexGVTfKccPlJKwrKBJ7 X-Google-Smtp-Source: AGHT+IFqodcbXvvGQbYAmgjAlCjjHyzPPhL/5h6u/IlGoF6PnqI7PI9+Ax4L4kxnxBVCA+PqtUfB/w== X-Received: by 2002:a05:6512:10d1:b0:52e:76e8:e18e with SMTP id 2adb3069b0e04-5321364a598mr46079e87.7.1723467981708; Mon, 12 Aug 2024 06:06:21 -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-53200f42164sm727333e87.256.2024.08.12.06.06.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 06:06:21 -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: [PATCH v1 04/10] hw/arm: xenpvh: Add support for SMP guests Date: Mon, 12 Aug 2024 15:05:59 +0200 Message-ID: <20240812130606.90410-5-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240812130606.90410-1-edgar.iglesias@gmail.com> References: <20240812130606.90410-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12b; envelope-from=edgar.iglesias@gmail.com; helo=mail-lf1-x12b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: "Edgar E. Iglesias" Add SMP support for Xen PVH ARM guests. Create max_cpus ioreq servers to handle hotplug. Signed-off-by: Edgar E. Iglesias --- hw/arm/xen_arm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/arm/xen_arm.c b/hw/arm/xen_arm.c index 5f75cc3779..ef8315969c 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,8 @@ 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; + /* MAX number of vcpus supported by Xen. */ + 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 Mon Aug 12 13:06:00 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: 13760552 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.gnu.org (lists.gnu.org [209.51.188.17]) (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 35466C3DA7F for ; Mon, 12 Aug 2024 13:07:57 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sdUkz-0004cM-MY; Mon, 12 Aug 2024 09:06:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sdUkw-0004UP-27; Mon, 12 Aug 2024 09:06:38 -0400 Received: from mail-lj1-x231.google.com ([2a00:1450:4864:20::231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sdUkm-00046t-Qh; Mon, 12 Aug 2024 09:06:34 -0400 Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2f1a7faa4d5so32028361fa.3; Mon, 12 Aug 2024 06:06:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723467985; x=1724072785; darn=nongnu.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=W/NQ+bDoiLffxrtbB/M0A1sRyjsF9bgHvteaiAPMvqQ=; b=dLyFeQaxiv5eIGofk6GpSTQhTbx+pwMDEXINea5JGsBGQi0DI3TQGjh1NtpgH8cRGQ 0bitOuL0H1l+lWcOzRr/BtTPxaKfu4c65x4TmJJ0A5TwBLBzfBAN3LmeRKMVJB650Kfu PUc65KeAglHNA2k1Y9qnidNyjmfkMzlcawRuaZ2DyUtXquC88/tW6v9a2L6WVU0DODVd vwz4MhBX21E1UZyqWH7KnBp5DycYbgVjxUYdvRoXb2uuyOmqG3P1JqKS/OhABiTaaUGH +HA5vcfN5mOkVKb4dDH8802l0tMvltqq0/VKQQyR7Lo2+OIiDLmAiZ5ufb+uMU6fEbBr xBTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723467985; x=1724072785; 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=W/NQ+bDoiLffxrtbB/M0A1sRyjsF9bgHvteaiAPMvqQ=; b=UzTJs+hOfKBvT2TgbGRC2yYimMlhKlUJyoCwZKrypOphtk4lExSv/IKjeojN1FLuJ5 p1mG0KaEwZyCO61xRivA76Ik5P/5VaSZGwonxfUhgVj/HIg22q5ZYtA9EWhmVp56foSP ngo3a2/M+y1gu4FbdZ4SKf9uGVhjMUHO6CzPAePV2ZK672JYUKncazw+WOQvoGfD6/t4 4VMWje3TijbC30nkCTLgQPx38ytLS1XoeD8U5QuscL8185/ycb9o4rAJe6W/FmlAabft KEi2J2LaUHuNxyvxMTT2k/k5aPuWhUxTgAfiFBA4pA8pt6sArvGm5ZS985LZdmpwDodb fUZQ== X-Forwarded-Encrypted: i=1; AJvYcCVI790s9l8+JY4kdzqHGvDS6mYLl5yleVZxNIhx1nOIOU7AZiIZqypzmrarkdWiy0veTFYxj0KVOSBDh2pZO+i1bmCI X-Gm-Message-State: AOJu0YwGwj5uTPQZrff+mS7zAQV5mm7CllcKP9u+hSW9gxSfGbiJawSx kFDsMEQpflV6k9aA+NW+aUxIgGaSCVG/mFXQgBAuhaJZlaqbAwvSgDjQPvjq X-Google-Smtp-Source: AGHT+IF2RieUtGeR/iW9cWw+e/zdEKnbAONAmWuXU7OU5a81gT0ntNkasljwsAml/ALKofCfEA9e5A== X-Received: by 2002:a2e:b1d2:0:b0:2f1:5561:4b4a with SMTP id 38308e7fff4ca-2f2b7155335mr1355051fa.25.1723467984300; Mon, 12 Aug 2024 06:06:24 -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-2f291dff990sm8301261fa.64.2024.08.12.06.06.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 06:06:22 -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: [PATCH v1 05/10] hw/arm: xenpvh: Break out a common PVH module Date: Mon, 12 Aug 2024 15:06:00 +0200 Message-ID: <20240812130606.90410-6-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240812130606.90410-1-edgar.iglesias@gmail.com> References: <20240812130606.90410-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::231; envelope-from=edgar.iglesias@gmail.com; helo=mail-lj1-x231.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: "Edgar E. Iglesias" Break out a common Xen PVH module in preparation for adding a x86 Xen PVH Machine. Signed-off-by: Edgar E. Iglesias --- hw/arm/trace-events | 5 - hw/arm/xen_arm.c | 154 ++++++-------------------- hw/xen/meson.build | 1 + hw/xen/trace-events | 4 + hw/xen/xen-pvh-common.c | 185 ++++++++++++++++++++++++++++++++ include/hw/xen/xen-pvh-common.h | 45 ++++++++ 6 files changed, 269 insertions(+), 125 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 ef8315969c..b8a5c09bdf 100644 --- a/hw/arm/xen_arm.c +++ b/hw/arm/xen_arm.c @@ -12,40 +12,25 @@ #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 "hw/xen/xen-pvh-common.h" #include "sysemu/tpm.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; + XenPVHCommonState pvh; 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 * repository. @@ -57,64 +42,6 @@ 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) -{ - 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]; - } - - memory_region_init_ram(&xen_memory, NULL, "xen.ram", block_len, - &error_fatal); - - 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); -} - void arch_handle_ioreq(XenIOState *state, ioreq_t *req) { hw_error("Invalid ioreq type 0x%x\n", req->type); @@ -135,55 +62,42 @@ void qmp_xen_set_global_dirty_log(bool enable, Error **errp) { } -#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) +static void xen_arm_init(MachineState *ms) { - XenArmState *xam = XEN_ARM(machine); - - xam->state = g_new0(XenIOState, 1); + XenArmState *xam = XEN_ARM(ms); + const struct { + const char *name; + MemMapEntry map; + } map[] = { + { "ram-low", { GUEST_RAM0_BASE, GUEST_RAM0_SIZE } }, + { "ram-high", { GUEST_RAM1_BASE, GUEST_RAM1_SIZE } }, + { "virtio-mmio", { GUEST_VIRTIO_MMIO_BASE, VIRTIO_MMIO_DEV_SIZE } }, + { "tpm", { xam->cfg.tpm_base_addr, 0x1000 } }, + }; + int i; - if (machine->ram_size == 0) { - warn_report("%s non-zero ram size not specified. QEMU machine started" - " without IOREQ (no emulated devices including virtio)", - MACHINE_CLASS(object_get_class(OBJECT(machine)))->desc); - return; + object_initialize_child(OBJECT(ms), "pvh", &xam->pvh, TYPE_XEN_PVH_COMMON); + + object_property_set_int(OBJECT(&xam->pvh), "max-cpus", ms->smp.max_cpus, + &error_abort); + object_property_set_int(OBJECT(&xam->pvh), "ram-size", ms->ram_size, + &error_abort); + object_property_set_int(OBJECT(&xam->pvh), "virtio-mmio-num", + NR_VIRTIO_MMIO_DEVICES, &error_abort); + object_property_set_int(OBJECT(&xam->pvh), "virtio-mmio-irq-base", + GUEST_VIRTIO_MMIO_SPI_FIRST, &error_abort); + + for (i = 0; i < ARRAY_SIZE(map); i++) { + g_autofree char *base_name = g_strdup_printf("%s-base", map[i].name); + g_autofree char *size_name = g_strdup_printf("%s-size", map[i].name); + + object_property_set_int(OBJECT(&xam->pvh), base_name, map[i].map.base, + &error_abort); + object_property_set_int(OBJECT(&xam->pvh), size_name, map[i].map.size, + &error_abort); } - 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 + sysbus_realize(SYS_BUS_DEVICE(&xam->pvh), &error_abort); } #ifdef CONFIG_TPM 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..0d368398d0 --- /dev/null +++ b/hw/xen/xen-pvh-common.c @@ -0,0 +1,185 @@ +/* + * Common Xen PVH 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 "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(XenPVHCommonState *s, + MemoryRegion *sysmem) +{ + ram_addr_t block_len, ram_size[2]; + + if (s->cfg.ram_size <= s->cfg.ram_low.size) { + ram_size[0] = s->cfg.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] = s->cfg.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(XenPVHCommonState *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(XenPVHCommonState *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_realize(DeviceState *dev, Error **errp) +{ + XenPVHCommonState *s = XEN_PVH_COMMON(dev); + MemoryRegion *sysmem = get_system_memory(); + + if (s->cfg.ram_size == 0) { + /* FIXME: Prefix with object path and consider bailing out. */ + warn_report("non-zero ram size not specified. QEMU machine started" + " without IOREQ (no emulated devices including virtio)"); + return; + } + + if (s->cfg.max_cpus == 0) { + /* FIXME: Prefix with object path and bail out. */ + warn_report("max-cpus not specified. QEMU machine started"); + return; + } + + xen_pvh_init_ram(s, sysmem); + xen_register_ioreq(&s->ioreq, s->cfg.max_cpus, &xen_memory_listener); + + if (s->cfg.virtio_mmio_num) { + xen_create_virtio_mmio_devices(s); + } + +#ifdef CONFIG_TPM + if (s->cfg.tpm.base) { + xen_enable_tpm(s); + } else { + warn_report("tpm-base-addr is not provided. TPM will not be enabled"); + } +#endif +} + +#define DEFINE_PROP_MEMMAP(n, f) \ + DEFINE_PROP_UINT64(n "-base", XenPVHCommonState, cfg.f.base, 0), \ + DEFINE_PROP_UINT64(n "-size", XenPVHCommonState, cfg.f.size, 0) + +static Property xen_pvh_properties[] = { + DEFINE_PROP_UINT32("max-cpus", XenPVHCommonState, cfg.max_cpus, 0), + DEFINE_PROP_UINT64("ram-size", XenPVHCommonState, cfg.ram_size, 0), + DEFINE_PROP_MEMMAP("ram-low", ram_low), + DEFINE_PROP_MEMMAP("ram-high", ram_high), + DEFINE_PROP_MEMMAP("virtio-mmio", virtio_mmio), + DEFINE_PROP_MEMMAP("tpm", tpm), + DEFINE_PROP_UINT32("virtio-mmio-num", XenPVHCommonState, + cfg.virtio_mmio_num, 0), + DEFINE_PROP_UINT32("virtio-mmio-irq-base", XenPVHCommonState, + cfg.virtio_mmio_irq_base, 0), + DEFINE_PROP_END_OF_LIST() +}; + +static void xen_pvh_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + + dc->realize = xen_pvh_realize; + device_class_set_props(dc, xen_pvh_properties); + /* No VMSD since we haven't got any top-level SoC state to save. */ +} + +static const TypeInfo xen_pvh_info = { + .name = TYPE_XEN_PVH_COMMON, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(XenPVHCommonState), + .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..e958b441fd --- /dev/null +++ b/include/hw/xen/xen-pvh-common.h @@ -0,0 +1,45 @@ +/* + * 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_COMMON "xen-pvh-common" +OBJECT_DECLARE_SIMPLE_TYPE(XenPVHCommonState, XEN_PVH_COMMON) + +typedef struct XenPVHCommonState { + /*< private >*/ + SysBusDevice parent_obj; + + XenIOState ioreq; + + struct { + MemoryRegion low; + MemoryRegion high; + } ram; + + struct { + uint64_t ram_size; + uint32_t max_cpus; + uint32_t virtio_mmio_num; + uint32_t virtio_mmio_irq_base; + struct { + uint64_t base; + uint64_t size; + } ram_low, ram_high, + virtio_mmio, + tpm; + } cfg; +} XenPVHCommonState; +#endif From patchwork Mon Aug 12 13:06:01 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: 13760556 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.gnu.org (lists.gnu.org [209.51.188.17]) (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 72A69C52D7F for ; Mon, 12 Aug 2024 13:08:17 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sdUku-0004MW-D8; Mon, 12 Aug 2024 09:06:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sdUks-0004EU-Au; Mon, 12 Aug 2024 09:06:34 -0400 Received: from mail-lj1-x22f.google.com ([2a00:1450:4864:20::22f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sdUko-00046y-W1; Mon, 12 Aug 2024 09:06:33 -0400 Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2f136e23229so45106261fa.1; Mon, 12 Aug 2024 06:06:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723467986; x=1724072786; darn=nongnu.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=KTEAe/pOjkrnvyxDHYihrpK7ln2+IQNSmZ/kBKccldI=; b=Ftrn+2ExZQkHYqwooiueNwAuRA4GXGvJrDaxoErPSYIhjezvcF+l0tvyL3oNgwpCYh 4BGlmMwRavg76xExoF9Zb/7gs0gXIUSglnFYxNQC55JvlCPXkESBGLxbAyAid/8aGXla W1Q2PEaJ3XiHTJcEu+a17H9fulWc40uiEV4dadDdUXEBb//Gm7HId5fx6GtfYOHJyaOk x9MBfbj7E8s6S5Nwvp2J5Q1bsLRxSh/wuaXU4M3Q2ZY5BrGTZDDVHf0+AQT5uY2UG6lU GXiQzV0wi9F2JychJcejN7lMxB2WEVjFl7ht6sQHsRJRW6AIuQiEI3hWUxJTuwvrQwHw vBOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723467986; x=1724072786; 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=KTEAe/pOjkrnvyxDHYihrpK7ln2+IQNSmZ/kBKccldI=; b=BVVHNt5daK1DnbV6pCapXN9Ze1h1fvVBKp/KfFp1sADDc4OmvnSPCbNmfSHiLfeobz tKyrX74S5Frc8jSxo6Ov05tSosR1IhU98xt8RsYMtqmx7HiCsPCFznintj9GL+kkR8WZ qEAGV8xjf/BdUYyOfow5ksw7qY86s3YrjD9E7EG6SeupfZN6VkXzJtXDAy2zYo8Li7pi xfv7C/DY6ncLhQDbjD5j1w2zHFc0XbIm5FQdvu3jyB8uTiyikZqFF9eZc+udlZeG582b MMqkzC5bqZIyzBWZ7A3sgNcoe5DLFikfGy4q68AcGqsfCFpoqIcAAWFogI6Z0LUHNkzA 71Ow== X-Forwarded-Encrypted: i=1; AJvYcCWOQWZcm7Op7of7EuKUxGWlK8etF8oh0FS/AWtsIX2VGdSiXzOP3+i9UkXDFM6EKYjaf8qeKCgJ8/CS9cZaP9tig3ke X-Gm-Message-State: AOJu0YzEqgh8Jx2iW6HFU9LywkjkyaKqThzOLTx5IWoTNxFbRH437IiA E5t3b10qR1/q8TASedeyR/SfHYvxh3C84oMvTaUPtrmQLs9QYRt9PmezfFpb X-Google-Smtp-Source: AGHT+IH0EXdKyQvoxf37ygreO5y2jLBKuw9Hze8ISbhMj2e1iAgBShVHSABDPv6QJ/gpCgSqjwyxEQ== X-Received: by 2002:a05:651c:507:b0:2ef:2c86:4d43 with SMTP id 38308e7fff4ca-2f2b714656amr1654731fa.3.1723467985346; Mon, 12 Aug 2024 06:06:25 -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-2f2920525b7sm8607681fa.121.2024.08.12.06.06.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 06:06:24 -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: [PATCH v1 06/10] hw/arm: xenpvh: Rename xen_arm.c -> xen-pvh.c Date: Mon, 12 Aug 2024 15:06:01 +0200 Message-ID: <20240812130606.90410-7-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240812130606.90410-1-edgar.iglesias@gmail.com> References: <20240812130606.90410-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22f; envelope-from=edgar.iglesias@gmail.com; helo=mail-lj1-x22f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 0c07ab522f..769fe9ec1a 100644 --- a/hw/arm/meson.build +++ b/hw/arm/meson.build @@ -59,7 +59,7 @@ 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-pvh.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_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 Mon Aug 12 13:06:02 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: 13760558 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.gnu.org (lists.gnu.org [209.51.188.17]) (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 0F48AC52D7C for ; Mon, 12 Aug 2024 13:08:53 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sdUl3-0004v2-2N; Mon, 12 Aug 2024 09:06:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sdUkw-0004UW-2q for qemu-devel@nongnu.org; Mon, 12 Aug 2024 09:06:38 -0400 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sdUkq-00047L-6B for qemu-devel@nongnu.org; Mon, 12 Aug 2024 09:06:34 -0400 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-52f04b4abdcso6139668e87.2 for ; Mon, 12 Aug 2024 06:06:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723467989; x=1724072789; darn=nongnu.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=Nhh0TpUXfvKDYo1bINWU88Yt0WNYvGv2suBFZ023AEo=; b=G2lbuzbam7tX6vYa+0ZCX/4EvfB5G5PgZCkTBGXJHTxx0ozA0LpOvzD34uokSxtNuc K3ZlUzLVM8kb2/16fGACw9H/v4lHA50sr5liGWDKEpaI2SomL92YePVSboN4eCuYLzAD qqNYgzFLmbU9ZRQLia7IfLf5SGmIbiIvBG14ph/O1Zf4WrXFh4y+KRJd8HqUiZFrs7gP Y+Cz0tqzOv5wxvaVD7iwFROwlcNoF6yRS/H/OQrW1zjObbpICdR2dWiNyL7jeXjNrZAR Q3pCNq+7HUTQHwDcWXEb9T2AWaqqPpvbDeZ50Fs60wDeOXYO4AXcbuxNxfd4rXYpZVKX cYLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723467989; x=1724072789; 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=Nhh0TpUXfvKDYo1bINWU88Yt0WNYvGv2suBFZ023AEo=; b=L/bV3WrqzSZp+sCaf4q/POqfIA6XYDrJZ9QbKHyFecTJBmc7YafSiEs+uDtGJl2qEZ R9b7doPJxR1wYewjDggRLSace25bq+sfdoHZsCqcgCviGpSylGbcwJZOBn7Icfo00hJd cF3IJ/+l+Nxet9EFQRlU6pn6SZJxIDT9MiAZ3Yotecg0ju2YXc4sPwkti5e1W2ZkjJTO Xsx/2RgftRydfBged3/+gJHfhJAaMsL09wyJRuepivyupcYNgXGE5t/dLHUS3b2kL4i9 Z4Gb6c6lsJj6Sea8T1zK9vD9hUPBKL8e+SzdMKWQRa/l+UEnI5okrepKadU2Di7rvIi2 XXnQ== X-Gm-Message-State: AOJu0Yxsoej8uYM+DZcL7dPyQpViT5ATpevyh755OGMC68UQT7V2Tuqm DCxMLKpf42BREU8t4foYx5F7UNlR5upYVbrVv4bMvOxAn+vCUgn5eKu+CP+u X-Google-Smtp-Source: AGHT+IHSkZQghDr6Glb8JEvdreF6qFC+N2jFtbTRBNglrKRLKqDk7xPj3u/onfFEY6yEqggs5c2vsg== X-Received: by 2002:a05:6512:1296:b0:52c:dfa0:dca0 with SMTP id 2adb3069b0e04-53213693c31mr31960e87.43.1723467988154; Mon, 12 Aug 2024 06:06:28 -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-53200f1ac89sm734534e87.184.2024.08.12.06.06.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 06:06:25 -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: [PATCH v1 07/10] hw/arm: xenpvh: Reverse virtio-mmio creation order Date: Mon, 12 Aug 2024 15:06:02 +0200 Message-ID: <20240812130606.90410-8-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240812130606.90410-1-edgar.iglesias@gmail.com> References: <20240812130606.90410-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::134; envelope-from=edgar.iglesias@gmail.com; helo=mail-lf1-x134.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 0d368398d0..69a2dbdb6d 100644 --- a/hw/xen/xen-pvh-common.c +++ b/hw/xen/xen-pvh-common.c @@ -73,7 +73,18 @@ static void xen_create_virtio_mmio_devices(XenPVHCommonState *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 Mon Aug 12 13:06:03 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: 13760553 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.gnu.org (lists.gnu.org [209.51.188.17]) (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 BF667C52D7C for ; Mon, 12 Aug 2024 13:08:01 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sdUl2-0004uc-Uj; Mon, 12 Aug 2024 09:06:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sdUkx-0004bw-W0 for qemu-devel@nongnu.org; Mon, 12 Aug 2024 09:06:40 -0400 Received: from mail-lj1-x22b.google.com ([2a00:1450:4864:20::22b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sdUks-00047X-2g for qemu-devel@nongnu.org; Mon, 12 Aug 2024 09:06:38 -0400 Received: by mail-lj1-x22b.google.com with SMTP id 38308e7fff4ca-2ef2d96164aso46453331fa.3 for ; Mon, 12 Aug 2024 06:06:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723467990; x=1724072790; darn=nongnu.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=fsU79nmQ1AQVXUbNSxYwoeBBAkcfnxSMEvBp2lKDwWA=; b=C87fvWOXYf04yLU59xfYVHEZw8f14FGvbveQn4em1wZBV59rNuloyXvpIlLi282w/3 jqVnZ8hTuAgzxte64Yc5hNBGXuPtdJSQN2UvJ2Sk9nB1BJDxEI6ZlZ9xqNTtwnpgtBV3 W4XY8dM1i0rfZuQ5gHDVVvbHJODrQ6vYSQgyHvru+LQ8r+yQAVF07c9dYUKeCDqBwSel UYbNjAz+tCZm+UmNZIgef5tFuhMzueFUV3pegND7O/BsEWQWRmxamfbvCZhyyIwzlWAM ojdb9YdMahk2upauCL6Ncl0g4HvsHWMN2FRIFfMNkqb4XfoZlEnjUd3s0p30qBuWybJ4 il4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723467990; x=1724072790; 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=fsU79nmQ1AQVXUbNSxYwoeBBAkcfnxSMEvBp2lKDwWA=; b=WmuQufmz66Pc3jJuiwvIq+Wb1vvSmU8hC6+OnrhPcv0eAUznK9n11SJdGAtoOSrHrj b4jqEJgixuAfutJoB6MeqJlZsQIi7/JsP7GLRuzyd/jac1wHLoMvMH63RFu6l8pw1AzW k2cCmQoUCVMKySG6cW1UpYNmqH8dLsx1E6x0Zan55JhyK2TBilNvumggWT6PkNiwkg7i k/epS13gqJhhF0JP4lRY7g0InWGhXb3SZDMHxKQFqJcEeDnTYtClMk/HFhQ4TlqRYx6z buQN4cJTSQD752titje212SyBoPI8eqNbouao6Eg4g0VwuzSvbiq0JtORX0qlpQKgei0 TKmA== X-Gm-Message-State: AOJu0YxdKxxBYjT5w/La3oCp8glrBSrgYUBvxtKR/iqi7vX3N1ed8ErF 17KRJu2cO/r+cybvbwYAC2lHxdsR79XZADMbgOuOHOvLHEiH2lsxn8vJfBLS X-Google-Smtp-Source: AGHT+IExi6OAtMSH2lj/PgBrg+LlxDZERUpkwQQHEWkaEtSD3XJV0ILUPZ6rtXYIo0sScSOwNbS7/Q== X-Received: by 2002:a05:6512:6d1:b0:52e:941d:7039 with SMTP id 2adb3069b0e04-532136a4e69mr29594e87.59.1723467989238; Mon, 12 Aug 2024 06:06:29 -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-53200f42667sm739978e87.294.2024.08.12.06.06.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 06:06:28 -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: [PATCH v1 08/10] hw/xen: pvh-common: Add support for creating PCIe/GPEX Date: Mon, 12 Aug 2024 15:06:03 +0200 Message-ID: <20240812130606.90410-9-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240812130606.90410-1-edgar.iglesias@gmail.com> References: <20240812130606.90410-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22b; envelope-from=edgar.iglesias@gmail.com; helo=mail-lj1-x22b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: "Edgar E. Iglesias" Add support for optionally creating a PCIe/GPEX controller. Signed-off-by: Edgar E. Iglesias --- hw/xen/xen-pvh-common.c | 66 +++++++++++++++++++++++++++++++++ include/hw/xen/xen-pvh-common.h | 10 ++++- 2 files changed, 75 insertions(+), 1 deletion(-) diff --git a/hw/xen/xen-pvh-common.c b/hw/xen/xen-pvh-common.c index 69a2dbdb6d..b1432e4bd9 100644 --- a/hw/xen/xen-pvh-common.c +++ b/hw/xen/xen-pvh-common.c @@ -120,6 +120,59 @@ static void xen_enable_tpm(XenPVHCommonState *s) } #endif +static void xen_set_pci_intx_irq(void *opaque, int irq, int level) +{ + if (xen_set_pci_intx_level(xen_domid, 0, 0, 0, irq, level)) { + error_report("xendevicemodel_set_pci_intx_level failed"); + } +} + +static inline void xenpvh_gpex_init(XenPVHCommonState *s, + MemoryRegion *sysmem, + hwaddr ecam_base, hwaddr ecam_size, + hwaddr mmio_base, hwaddr mmio_size, + hwaddr mmio_high_base, + hwaddr mmio_high_size, + int intx_irq_base) +{ + 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, ecam_base, ecam_reg); + + mmio_reg = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 1); + + if (mmio_size) { + memory_region_init_alias(&s->pci.mmio_alias, OBJECT(dev), "pcie-mmio", + mmio_reg, mmio_base, mmio_size); + memory_region_add_subregion(sysmem, mmio_base, &s->pci.mmio_alias); + } + + if (mmio_high_size) { + memory_region_init_alias(&s->pci.mmio_high_alias, OBJECT(dev), + "pcie-mmio-high", + mmio_reg, mmio_high_base, mmio_high_size); + memory_region_add_subregion(sysmem, mmio_high_base, + &s->pci.mmio_high_alias); + } + + for (i = 0; i < GPEX_NUM_IRQS; i++) { + qemu_irq irq = qemu_allocate_irq(xen_set_pci_intx_irq, s, i); + + sysbus_connect_irq(SYS_BUS_DEVICE(dev), i, irq); + gpex_set_irq_num(GPEX_HOST(dev), i, intx_irq_base + i); + xen_set_pci_link_route(i, intx_irq_base + i); + } +} + static void xen_pvh_realize(DeviceState *dev, Error **errp) { XenPVHCommonState *s = XEN_PVH_COMMON(dev); @@ -152,6 +205,14 @@ static void xen_pvh_realize(DeviceState *dev, Error **errp) warn_report("tpm-base-addr is not provided. TPM will not be enabled"); } #endif + + if (s->cfg.ecam.size) { + xenpvh_gpex_init(s, sysmem, + s->cfg.ecam.base, s->cfg.ecam.size, + s->cfg.mmio.base, s->cfg.mmio.size, + s->cfg.mmio_high.base, s->cfg.mmio_high.size, + s->cfg.pci_intx_irq_base); + } } #define DEFINE_PROP_MEMMAP(n, f) \ @@ -165,10 +226,15 @@ static Property xen_pvh_properties[] = { DEFINE_PROP_MEMMAP("ram-high", ram_high), DEFINE_PROP_MEMMAP("virtio-mmio", virtio_mmio), DEFINE_PROP_MEMMAP("tpm", tpm), + DEFINE_PROP_MEMMAP("pci-ecam", ecam), + DEFINE_PROP_MEMMAP("pci-mmio", mmio), + DEFINE_PROP_MEMMAP("pci-mmio-high", mmio_high), DEFINE_PROP_UINT32("virtio-mmio-num", XenPVHCommonState, cfg.virtio_mmio_num, 0), DEFINE_PROP_UINT32("virtio-mmio-irq-base", XenPVHCommonState, cfg.virtio_mmio_irq_base, 0), + DEFINE_PROP_UINT32("pci-intx-irq-base", XenPVHCommonState, + cfg.pci_intx_irq_base, 0), DEFINE_PROP_END_OF_LIST() }; diff --git a/include/hw/xen/xen-pvh-common.h b/include/hw/xen/xen-pvh-common.h index e958b441fd..faacfca70e 100644 --- a/include/hw/xen/xen-pvh-common.h +++ b/include/hw/xen/xen-pvh-common.h @@ -29,17 +29,25 @@ typedef struct XenPVHCommonState { MemoryRegion high; } ram; + struct { + GPEXHost gpex; + MemoryRegion mmio_alias; + MemoryRegion mmio_high_alias; + } pci; + struct { uint64_t ram_size; uint32_t max_cpus; uint32_t virtio_mmio_num; uint32_t virtio_mmio_irq_base; + uint32_t pci_intx_irq_base; struct { uint64_t base; uint64_t size; } ram_low, ram_high, virtio_mmio, - tpm; + tpm, + ecam, mmio, mmio_high; } cfg; } XenPVHCommonState; #endif From patchwork Mon Aug 12 13:06:04 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: 13760557 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.gnu.org (lists.gnu.org [209.51.188.17]) (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 82FDAC52D7C for ; Mon, 12 Aug 2024 13:08:24 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sdUl3-0004xu-OC; Mon, 12 Aug 2024 09:06:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sdUkx-0004bp-VY for qemu-devel@nongnu.org; Mon, 12 Aug 2024 09:06:39 -0400 Received: from mail-lj1-x22b.google.com ([2a00:1450:4864:20::22b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sdUks-00047h-2t for qemu-devel@nongnu.org; Mon, 12 Aug 2024 09:06:38 -0400 Received: by mail-lj1-x22b.google.com with SMTP id 38308e7fff4ca-2eeb1ba040aso58548011fa.1 for ; Mon, 12 Aug 2024 06:06:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723467991; x=1724072791; darn=nongnu.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=zpYqNKXAVuA0a+6/wfjyGjtY9ZeW5tCWM6T6raDN/Y4=; b=cDo3WM7s3MFu9evk1VPKsYOuJ3dpm1VqxP4I7tju3/S8owEWbPJ1uJUxVe+CPS/dPG dj+d8iegAke0cP7eSypPnCNJY5Dqcb8ZSs+rCfT4xlVhRdZGDxIRyoottTShAj0qB9Hw fvpQi8RyjocUkovwbFK7g6MIM6BDjD850N64cms3BfkAe6MwLirtBNyweSpI2cAnnQGk B1hrl+CYm1Hm2krkruzoT9a0zNdepXrsKNGQbaYedaOh9hriyq8uXE5sylV6SHtedk1l MPabXaUN7N/gb+Xw0a6akoKaYjEpK8B/RXPh04nt3CRRUk+FNAYnoIOYpUUtlwySbLNd Yc3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723467991; x=1724072791; 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=zpYqNKXAVuA0a+6/wfjyGjtY9ZeW5tCWM6T6raDN/Y4=; b=iq+gT1njCDBvLzcRmzhR/6FSDc5YNmeCxnegUwTPeY3m87XebBWqmSqSq/sFEQujer 81ZTzJ1NPxH6sWePjpu+zh9T3AT6OsPUkKsbSB0gRCRG89uvtWt0aGKTEBGg97u6cEvu khkGI6mnH+A3PHckzIm6c8lyQUxDjKj2TeQIHlo07OuHwTqJu+q9ahF5PSvagvMUbCJm 0/dQeoH0CMqFWf6Ri4XimXWD6lUxyDLj5GIskb8PnaDO9IasALEQZBo04EBUKMEnmDRJ eth2sLmObkpEaa4qg2RnKGJqt+yrfJxX7mCwEOoFnarUurPzPdHNRmdFZsp59vFdgi7u tfgA== X-Gm-Message-State: AOJu0YxP3PLpfUWakdmrBMaqtsOqH8XiUAlKUM8muV1eZFB4SpLVT4O0 a+1abunn8rGPCtiQ3Lu4wpaAx7C2Enmp0gQ4xaV9R8A209zqk99pFWKlFIVz X-Google-Smtp-Source: AGHT+IFbDkFVn4nHNTgp2rSK1ep8EB3W/CnGnNoziWsVxIa3hCXemD+rWCA6eJi3qacG+boCLJdOoQ== X-Received: by 2002:a2e:2414:0:b0:2ef:1808:7523 with SMTP id 38308e7fff4ca-2f2b714d294mr1493031fa.18.1723467990279; Mon, 12 Aug 2024 06:06:30 -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-2f291df3c4esm8503311fa.40.2024.08.12.06.06.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 06:06:29 -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" , "Michael S. Tsirkin" , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [PATCH v1 09/10] hw/i386/xen: Add a Xen PVH x86 machine Date: Mon, 12 Aug 2024 15:06:04 +0200 Message-ID: <20240812130606.90410-10-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240812130606.90410-1-edgar.iglesias@gmail.com> References: <20240812130606.90410-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22b; envelope-from=edgar.iglesias@gmail.com; helo=mail-lj1-x22b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: "Edgar E. Iglesias" This adds a Xen PVH x86 machine based on the PVH Common module used by the ARM PVH machine. Signed-off-by: Edgar E. Iglesias --- hw/i386/xen/meson.build | 1 + hw/i386/xen/xen-pvh.c | 196 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 197 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..9c3d3fc58d --- /dev/null +++ b/hw/i386/xen/xen-pvh.c @@ -0,0 +1,196 @@ +/* + * 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 "qapi/error.h" +#include "qapi/visitor.h" +#include "qemu/error-report.h" +#include "hw/boards.h" +#include "sysemu/sysemu.h" +#include "hw/xen/arch_hvm.h" +#include "hw/xen/xen.h" +#include "hw/xen/xen-pvh-common.h" + +#define TYPE_XEN_PVH_X86 MACHINE_TYPE_NAME("xenpvh") +OBJECT_DECLARE_SIMPLE_TYPE(XenPVHx86State, XEN_PVH_X86) + +#define PVH_MAX_CPUS 128 + +struct XenPVHx86State { + /*< private >*/ + MachineState parent; + + DeviceState *cpu[PVH_MAX_CPUS]; + XenPVHCommonState pvh; + + /* + * We provide these 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. + */ + struct { + MemMapEntry ram_low, ram_high; + MemMapEntry pci_ecam, pci_mmio, pci_mmio_high; + } cfg; +}; + +static void xenpvh_cpu_new(MachineState *ms, + XenPVHx86State *xp, + int cpu_idx, + 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); + + xp->cpu[cpu_idx] = DEVICE(cpu); +} + +static void xenpvh_init(MachineState *ms) +{ + XenPVHx86State *xp = XEN_PVH_X86(ms); + const struct { + const char *name; + MemMapEntry *map; + } map[] = { + { "ram-low", &xp->cfg.ram_low }, + { "ram-high", &xp->cfg.ram_high }, + { "pci-ecam", &xp->cfg.pci_ecam }, + { "pci-mmio", &xp->cfg.pci_mmio }, + { "pci-mmio-high", &xp->cfg.pci_mmio_high }, + }; + int i; + + object_initialize_child(OBJECT(ms), "pvh", &xp->pvh, TYPE_XEN_PVH_COMMON); + object_property_set_int(OBJECT(&xp->pvh), "max-cpus", ms->smp.max_cpus, + &error_abort); + object_property_set_int(OBJECT(&xp->pvh), "ram-size", ms->ram_size, + &error_abort); + + for (i = 0; i < ARRAY_SIZE(map); i++) { + g_autofree char *base_name = g_strdup_printf("%s-base", map[i].name); + g_autofree char *size_name = g_strdup_printf("%s-size", map[i].name); + + object_property_set_int(OBJECT(&xp->pvh), base_name, map[i].map->base, + &error_abort); + object_property_set_int(OBJECT(&xp->pvh), size_name, map[i].map->size, + &error_abort); + } + + /* GSI's 16 - 20 are used for legacy PCIe INTX IRQs. */ + object_property_set_int(OBJECT(&xp->pvh), "pci-intx-irq-base", 16, + &error_abort); + + sysbus_realize(SYS_BUS_DEVICE(&xp->pvh), &error_abort); + + /* Create dummy cores. This will indirectly create the APIC MSI window. */ + for (i = 0; i < ms->smp.cpus; i++) { + xenpvh_cpu_new(ms, xp, i, i); + } +} + +#define XENPVH_PROP_MEMMAP_SETTER(n, f) \ +static void xenpvh_set_ ## n ## _ ## f(Object *obj, Visitor *v, \ + const char *name, void *opaque, \ + Error **errp) \ +{ \ + XenPVHx86State *xp = XEN_PVH_X86(obj); \ + uint64_t value; \ + \ + if (!visit_type_size(v, name, &value, errp)) { \ + return; \ + } \ + xp->cfg.n.f = value; \ +} + +#define XENPVH_PROP_MEMMAP_GETTER(n, f) \ +static void xenpvh_get_ ## n ## _ ## f(Object *obj, Visitor *v, \ + const char *name, void *opaque, \ + Error **errp) \ +{ \ + XenPVHx86State *xp = XEN_PVH_X86(obj); \ + uint64_t value = xp->cfg.n.f; \ + \ + visit_type_uint64(v, name, &value, errp); \ +} + +#define XENPVH_PROP_MEMMAP(n) \ + XENPVH_PROP_MEMMAP_SETTER(n, base) \ + XENPVH_PROP_MEMMAP_SETTER(n, size) \ + XENPVH_PROP_MEMMAP_GETTER(n, base) \ + XENPVH_PROP_MEMMAP_GETTER(n, size) + + +XENPVH_PROP_MEMMAP(ram_low) +XENPVH_PROP_MEMMAP(ram_high) +XENPVH_PROP_MEMMAP(pci_ecam) +XENPVH_PROP_MEMMAP(pci_mmio) +XENPVH_PROP_MEMMAP(pci_mmio_high) + +static void xenpvh_instance_init(Object *obj) +{ + XenPVHx86State *xp = XEN_PVH_X86(obj); + + /* Default memmap. */ + xp->cfg.ram_low.base = 0x0; + xp->cfg.ram_low.size = 0x80000000U; + xp->cfg.ram_high.base = 0xC000000000ULL; + xp->cfg.ram_high.size = 0x4000000000ULL; +} + +static void xenpvh_machine_class_init(ObjectClass *oc, void *data) +{ + MachineClass *mc = MACHINE_CLASS(oc); + + mc->desc = "Xen PVH x86 machine"; + mc->init = xenpvh_init; + mc->max_cpus = PVH_MAX_CPUS; + mc->default_cpu_type = TARGET_DEFAULT_CPU_TYPE; + mc->default_machine_opts = "accel=xen"; + /* Set explicitly here to make sure that real ram_size is passed */ + mc->default_ram_size = 0; + +#define OC_MEMMAP_PROP(c, prop_name, name) \ +do { \ + object_class_property_add(c, prop_name "-base", "uint64_t", \ + xenpvh_get_ ## name ## _base, \ + xenpvh_set_ ## name ## _base, NULL, NULL); \ + object_class_property_set_description(oc, prop_name "-base", \ + prop_name " base address"); \ + object_class_property_add(c, prop_name "-size", "uint64_t", \ + xenpvh_get_ ## name ## _size, \ + xenpvh_set_ ## name ## _size, NULL, NULL); \ + object_class_property_set_description(oc, prop_name "-size", \ + prop_name " size of memory region"); \ +} while (0) + + OC_MEMMAP_PROP(oc, "ram-low", ram_low); + OC_MEMMAP_PROP(oc, "ram-high", ram_high); + 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); +} + +static const TypeInfo xenpvh_machine_type = { + .name = TYPE_XEN_PVH_X86, + .parent = TYPE_MACHINE, + .class_init = xenpvh_machine_class_init, + .instance_init = xenpvh_instance_init, + .instance_size = sizeof(XenPVHx86State), +}; + +static void xenpvh_machine_register_types(void) +{ + type_register_static(&xenpvh_machine_type); +} + +type_init(xenpvh_machine_register_types) From patchwork Mon Aug 12 13:06:05 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: 13760555 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.gnu.org (lists.gnu.org [209.51.188.17]) (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 59EF3C52D7C for ; Mon, 12 Aug 2024 13:08:17 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sdUl2-0004s6-8T; Mon, 12 Aug 2024 09:06:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sdUkz-0004jC-Re for qemu-devel@nongnu.org; Mon, 12 Aug 2024 09:06:41 -0400 Received: from mail-lj1-x233.google.com ([2a00:1450:4864:20::233]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sdUku-00047w-Jh for qemu-devel@nongnu.org; Mon, 12 Aug 2024 09:06:39 -0400 Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2ef2cce8be8so46637901fa.1 for ; Mon, 12 Aug 2024 06:06:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723467993; x=1724072793; darn=nongnu.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=mKBi8KqYhGDFlqsXHx9Zw2bI17GecQkQjZL9UWM7DqA=; b=ENr8ymcmNgj1khfmppTxJ2xywUieaXcm6qSao96G9KwRrQ4jKI6cqKrO6ms2ayRRFb 2BrTV9bKn2yKs7PDyk92IEHwKW9xK2DWxI+d1GfriZDBN7R/f7b6BipQbkM1YXXxLw0O /V5PuTJ3fN6jcLh+NEETrQ4ObHDJd0JRgWES+8Y3r53JbFR/xMx392EpeY65ZsXcX/a1 ofuo1n6AeDa3gD4eCk53oi+n5L0uhn2Yo8AZn0mnjV8Q49Eyyy1BTdChDQsAzSXbTP8T Rmnq9ZXpwKFO8LaneS5ajl4ahap5vU3pylV+cGTGXHpEIP822oov6fxAK8iWGq7ZFct8 6e3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723467993; x=1724072793; 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=mKBi8KqYhGDFlqsXHx9Zw2bI17GecQkQjZL9UWM7DqA=; b=jGBHEbyujCl3LmvheFqja89dKhMXPCnTbuguPlSX/XEUFDfiowt4tZ+XvQBpwvhtGP 4nPPTaDVJaFzBQrLJaU5/sHTWDuWOVhOp8R5AOEYK3bYi4nr30pPycirB1zES9u+2ObW ca1oAa6N8QLmWPbZglzW39sGEoxUdmEhSbYfEFb3a6kIvFMS7v/MyASvYTu3UrT+zH0u 5ozdNYAVy038LCQ2ey9Sy57X1tqOi1u/bLZomKxKI3VnFdKbgTjg83LA0PCI4zTbz1mX fXP6sHQ2401Fxokc6uTK1oVbEpp5c+Kb+WpA7EFs/epl5BtVnCfRLl2M2IxXIk2WnGoh w5Lw== X-Gm-Message-State: AOJu0YyoohgtFC6NBBXA9edRFx8IMlKydsPHcubOMsxa3xd3rJt750n8 vnX14A7UGWoXLe2ceimG7jrsAf4vgOPKG/Cxlmk7N9jsfPAGBtPDveEcaf11 X-Google-Smtp-Source: AGHT+IFc8uBG8fAqe8QiFu7qL5vOSuGxpFRzQNhkfUh2olLgNFB3zwVq8FCW9cJURrXcMaKyPvPWuQ== X-Received: by 2002:a2e:9c10:0:b0:2ef:22bc:6fb0 with SMTP id 38308e7fff4ca-2f2b7179ecbmr1400471fa.34.1723467992891; Mon, 12 Aug 2024 06:06:32 -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-2f29203d7ebsm8631921fa.83.2024.08.12.06.06.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 06:06:31 -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: [PATCH v1 10/10] docs/system/i386: xenpvh: Add a basic description Date: Mon, 12 Aug 2024 15:06:05 +0200 Message-ID: <20240812130606.90410-11-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240812130606.90410-1-edgar.iglesias@gmail.com> References: <20240812130606.90410-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::233; envelope-from=edgar.iglesias@gmail.com; helo=mail-lj1-x233.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 a24c2e14d9..da4c9d4d46 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