From patchwork Tue Aug 20 14:29:38 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: 13770195 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 A6ADDC3DA4A for ; Tue, 20 Aug 2024 14:30:11 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.780529.1190163 (Exim 4.92) (envelope-from ) id 1sgPrz-0000ot-8T; Tue, 20 Aug 2024 14:29:59 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 780529.1190163; Tue, 20 Aug 2024 14:29:59 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sgPrz-0000om-3y; Tue, 20 Aug 2024 14:29:59 +0000 Received: by outflank-mailman (input) for mailman id 780529; Tue, 20 Aug 2024 14:29:57 +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 1sgPrx-0000aG-HF for xen-devel@lists.xenproject.org; Tue, 20 Aug 2024 14:29:57 +0000 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [2a00:1450:4864:20::12b]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id ab6092fd-5f00-11ef-8776-851b0ebba9a2; Tue, 20 Aug 2024 16:29:55 +0200 (CEST) Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-52f042c15e3so5074670e87.0 for ; Tue, 20 Aug 2024 07:29:55 -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-5330d3afa66sm1772714e87.7.2024.08.20.07.29.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2024 07:29:53 -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: ab6092fd-5f00-11ef-8776-851b0ebba9a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724164195; x=1724768995; 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=Pv+9M6vVEbSwAJuAlkobDMMPJtHMCYxzhqrOAsgnyJIf1ThWa4pvvoiFgxWqEsDJPC sASGLUjxrLp51zxWLTSjXUFyVqUHVQYIBY/RBl3eYpxl0lbuOWAeTYB6QIPKUyh+dBuP 6itpLGM3+968I25iJTrwMRm27MvG6qQLVnsTHPkPNUU1LlB5BoyM/DynSxrHnWha3xOJ A6yPChTQ594IqsBJbUDaghSyv5wkr8svAdPHpIP+7al0FlizdpVjcidmXPW016nEmzpL CF+Da9RUxtngVgg25M26xzPbxqNuHfcJObPK1VMQiC+fC9wOdlO0h2prtDL4Sbdb8ZIW tcXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724164195; x=1724768995; 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=uQ5/B7pkbgFfGVPfx4TKZYdWKz2CzD4gkuyRbky2iBkDMjAUbnIP4ysL1mYcM3lUpC aXZ1WrG6GAJ7/b46FClMWuqrqRDGon1bsTPKbX2QHIo9Ltq8zbKSmGTumBjHdlNFYgbt Y9p1925vjXxiJjbL4gUn4tRHITum/NnNybf1OGHDTHvgLTN3yMCYImMFdWpapZakUlPC BuiVM8IsxWLIJ5Y9hc4qPf4jxDN/lshHc3dJTWTv+EV+K97neCR4daJEU3CNBHS5yo85 /J1qKVDTPs+EvtNX509RyOv72wr3Ekrdrp6Q0G38BK/Uu+kMF/Nq7FUo1+WwHMVe5Tof vSuA== X-Forwarded-Encrypted: i=1; AJvYcCUm4GsCKPeMs8N3oX2nvrIfI8q+OPwoA/gt4nRXERYwK2zpCmGENVoJN8hAIeneFvHMd2H2N5QWGxnYXy+Y7HWVKaLgnZmvTHb9HIz4nyQ= X-Gm-Message-State: AOJu0YyZUw8srg1J4YxqpW62dTK8gqykQckxiL1r4Mu/MPDD1OiroRtl syKmruSuBm3pU3gitH4oXE0I7ICFlzpZCZKUPtFBU5AUeVxZ+GTG X-Google-Smtp-Source: AGHT+IFrPcDRBYvfqjcvKbmWjLtw+0FlYqh8Z0iVHC/dcsRC/BqjVUCiAdvRhyukGAYN9Iw59X5/Ew== X-Received: by 2002:a05:6512:2824:b0:533:415e:cd9a with SMTP id 2adb3069b0e04-533415ee2demr694896e87.23.1724164194086; Tue, 20 Aug 2024 07:29:54 -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 v2 01/12] MAINTAINERS: Add docs/system/arm/xenpvh.rst Date: Tue, 20 Aug 2024 16:29:38 +0200 Message-ID: <20240820142949.533381-2-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240820142949.533381-1-edgar.iglesias@gmail.com> References: <20240820142949.533381-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 Tue Aug 20 14:29:39 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: 13770197 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 3C03BC5472C for ; Tue, 20 Aug 2024 14:30:12 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.780530.1190166 (Exim 4.92) (envelope-from ) id 1sgPrz-0000sJ-Fp; Tue, 20 Aug 2024 14:29:59 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 780530.1190166; Tue, 20 Aug 2024 14:29:59 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sgPrz-0000qk-Ai; Tue, 20 Aug 2024 14:29:59 +0000 Received: by outflank-mailman (input) for mailman id 780530; Tue, 20 Aug 2024 14:29:58 +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 1sgPry-0000aG-JA for xen-devel@lists.xenproject.org; Tue, 20 Aug 2024 14:29:58 +0000 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [2a00:1450:4864:20::136]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id ac1a9b63-5f00-11ef-8776-851b0ebba9a2; Tue, 20 Aug 2024 16:29:56 +0200 (CEST) Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-530e2287825so5819145e87.1 for ; Tue, 20 Aug 2024 07:29:57 -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-53345d17c33sm53420e87.128.2024.08.20.07.29.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2024 07:29: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: ac1a9b63-5f00-11ef-8776-851b0ebba9a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724164196; x=1724768996; 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=VtWFmFwg0ULcOSK3l5oQscnt/p7BOR9F23GTwqr5oe6xD00h9LE/HgMxjOw/HrUIud X0mjOX0wonn28o9fmexWkKs7CJ6GDWLkjKG3RV0nW9IfrTrT8IpoveuoiP7Nxqpl2LUR iLz4K4Z452DpHtq2iDX+d3c+kRrkzMLOBk3wy0ZjnNA+bppfQYgWQBk5vQbuLwYndARJ BwHRJulZKWIDOd1VPdDECzi57cPjaRLgHoTtiPpXq3AeINl/9HUJR9/vHI+oQzofmwN1 J9m7DL9DZUPB6vhu+/zRWzPZ0LgLz2BYEz4QF7MztJPAuYoN5l2ZTsO0gmk3S4E7toIb 9hqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724164196; x=1724768996; 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=hiMYZlsJJbjYqHE44Gx87T4dhf3Ngf3+skJe24lJzyEXOWoWqNQoN7B5bQzSL4TtZF qJM7KSStaYiBbhRBVOQ98MvHjfImND3TtFijOX5YtURi8YCnIDLUFrsrePt3PNeHVfuz DubSAE8lRpuzfrCJp69QCb5PPQ5/kKD+XlwwZkmBmFZX1gnaox9LDvUweuXODetr52He U3rvnSekyjQx8VD+2OO33eBBGn/sAhd1Uxgx1miyfKNQj+0Fw7PtVrZUxv39jAq17/Wt sjiNikYmb5nM+Idxx4bCtygx2e2VfFitJ+nbbtgY3Vw9IZyawO4eAVKCgj/ja1S9a+Cm Kp5Q== X-Forwarded-Encrypted: i=1; AJvYcCU67OjIDC1AtjU2IFfHhQn3YYyDoRvtpFgIHegjewOTjV9xaFKw/hhSXgYqpohfwk0B3fLak7uFYYqEufc5YoQmnCeapiAdF1cm6WGnmrM= X-Gm-Message-State: AOJu0YwZ8+NbgHjLiEXIZ7VSML1KhFLigLxY7nM17UKfMAa6mJwXxzHP 57oB1H0V+43PhNkuk0uevEzWu22j8hQmRuH5LA+mBbW/D4g64TO0 X-Google-Smtp-Source: AGHT+IERWznLEeJJPBmVGgbqZsGGHpjiqbNNsmHg/7CXZqA1iSzt7K9nFEzoO0ph3Q9aeI604W1JJQ== X-Received: by 2002:a05:6512:138b:b0:52c:e3bd:c70b with SMTP id 2adb3069b0e04-5331c690c37mr9543219e87.1.1724164195374; Tue, 20 Aug 2024 07:29: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, qemu-arm@nongnu.org Subject: [PATCH v2 02/12] hw/arm: xenpvh: Update file header to use SPDX Date: Tue, 20 Aug 2024 16:29:39 +0200 Message-ID: <20240820142949.533381-3-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240820142949.533381-1-edgar.iglesias@gmail.com> References: <20240820142949.533381-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 Tue Aug 20 14:29:40 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: 13770198 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 490DFC5321E for ; Tue, 20 Aug 2024 14:30:12 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.780531.1190173 (Exim 4.92) (envelope-from ) id 1sgPrz-0000yG-Po; Tue, 20 Aug 2024 14:29:59 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 780531.1190173; Tue, 20 Aug 2024 14:29:59 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sgPrz-0000w8-Jk; Tue, 20 Aug 2024 14:29:59 +0000 Received: by outflank-mailman (input) for mailman id 780531; Tue, 20 Aug 2024 14:29: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 1sgPrz-0000m9-13 for xen-devel@lists.xenproject.org; Tue, 20 Aug 2024 14:29:59 +0000 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [2a00:1450:4864:20::12c]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id ad1e8d9c-5f00-11ef-a507-bb4a2ccca743; Tue, 20 Aug 2024 16:29:58 +0200 (CEST) Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-53301d46c54so7426939e87.2 for ; Tue, 20 Aug 2024 07:29: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-5330d3b8f77sm1773996e87.72.2024.08.20.07.29.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2024 07:29:55 -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: ad1e8d9c-5f00-11ef-a507-bb4a2ccca743 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724164198; x=1724768998; 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=Nu2N2XY+WF9tUCwXYCgru11G/xtCPKfp9GjgwSFLKsJnRFwqYDFmZxDkkGcq5aEXus fiP3xnQHxxz2fphTEaS4tNrCVgGF0amQvUQvOV1g40jEfeLVjh34gKMWTKyFUMVqBvt+ FRIdAr5uixjHlRlyDnUGZWzx8vdcHxtyfZzJuwBAkQvEBhzRbGS6cgc9JbVknD1//leD f8LeH5/t133CGiN9dtYFR4IvPL+D37d6JMjRhQwJgPOAqAbaeu1vf4xIJJCsEj4GU38r ODSBLxQcKi+A1trYdbqQFAA8RhfKRMXliDjFNA8iOHMZVyyT7sR9c/6Ee4VYGYdOCRTn PXoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724164198; x=1724768998; 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=nCBil1vaOn6nqn7qcGkjcvG+2x/yf7qU2VAfpQzibzQQUNfb71G3nP5zJq64KMXYfi kR4JtrINqI5/Y0Et1MuA6GRekyRD10sCbyH+ymXoyBAb3wIZVvEC93Ta5MrCW6SD9dEL OcJ5nkYwB7yb1ddk7SdIK1NsLU1GRB2j1sJwdqaJE+nPVcLgPa0cpp/uasIJFpjc4Jv/ w4EFO17DRbzEsjsXK9B2QL8q/6NR1dpflNuxE/Lhz9D4o94D72kRDRhUe9j5ReUFSZ2b NUYIGAlFELZGMMT7OYWxsq+T5wv9C5JzUJsAqScnaR80XIKcw9ukgEaKY9BuQic0kJmr LRNQ== X-Forwarded-Encrypted: i=1; AJvYcCVJ+8PQWYExI2srxGPRGov+UJWM7djqcuMhJyHtPMWbnCgd+tLuUY++6gaBh9gM44irkpIV+ssQBP4=@lists.xenproject.org X-Gm-Message-State: AOJu0Yx7DX4VQpww7nelu6dK7YKd67/loUo+wyxmhYiFjtI8BCRPE2LA J2K5EyHgmxgnFurNbtx+kiGxu4i8IZLwd8HiUxjYAIvfEoi1xY8ZHJ+MCl2H X-Google-Smtp-Source: AGHT+IEUHrJ/SYDaIj+10HjdHpBx8iCW0Ws8VM3nxx/08/Kowr+gNMxcGQJYD8Ll+OK5SPcAIO861w== X-Received: by 2002:a05:6512:1085:b0:52f:413:7e8c with SMTP id 2adb3069b0e04-5331c6a2a5bmr10786717e87.14.1724164196933; Tue, 20 Aug 2024 07:29:56 -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 v2 03/12] hw/arm: xenpvh: Tweak machine description Date: Tue, 20 Aug 2024 16:29:40 +0200 Message-ID: <20240820142949.533381-4-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240820142949.533381-1-edgar.iglesias@gmail.com> References: <20240820142949.533381-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 Tue Aug 20 14:29:41 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: 13770199 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 4A9ABC5472E for ; Tue, 20 Aug 2024 14:30:12 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.780532.1190192 (Exim 4.92) (envelope-from ) id 1sgPs2-0001Y0-0l; Tue, 20 Aug 2024 14:30:02 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 780532.1190192; Tue, 20 Aug 2024 14:30:01 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sgPs1-0001Xr-TV; Tue, 20 Aug 2024 14:30:01 +0000 Received: by outflank-mailman (input) for mailman id 780532; Tue, 20 Aug 2024 14:30:00 +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 1sgPs0-0000aG-SY for xen-devel@lists.xenproject.org; Tue, 20 Aug 2024 14:30:00 +0000 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [2a00:1450:4864:20::130]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id adb5a1ec-5f00-11ef-8776-851b0ebba9a2; Tue, 20 Aug 2024 16:29:59 +0200 (CEST) Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-5333b2fbedaso2793478e87.0 for ; Tue, 20 Aug 2024 07:29: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 2adb3069b0e04-5330d41e1a0sm1782218e87.196.2024.08.20.07.29.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2024 07:29:57 -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: adb5a1ec-5f00-11ef-8776-851b0ebba9a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724164199; x=1724768999; 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=j3FilNtR3ylHjSgCwXgc1/4kLFqGR/asrW9olruIp6U=; b=OSJ5Q5IR63wVFpGW3Qi0fgH573k29Nk5TPTriToFD0Yje2sMPNREql/e3dLt4dYJXn YKvZJKyGjudUEgiNzWg+USU07QfvwcQ2xRcXlxzoufElt6678fUPEZ78vCkMvbkAkNrs MWim7cRFIHoAGMezoz398ofWx7Mw4JSWsWOhvyvsC5Tp8DIbQtVe4aNJPo8ZYhV+okwQ 4IpZ8rcOlxOePgi71hJao6TJMDf8n2yqCjOOd6x0zqAUgZVKE+Z2Lb5sJqKmM8TFwKp9 4OWVjT/FQM2wyKDPlNOvcwbugNqM4rY3G9/rosbUg1LMfoNa/4hWds3xhCiyqnAD/W0C IAMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724164199; x=1724768999; 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=j3FilNtR3ylHjSgCwXgc1/4kLFqGR/asrW9olruIp6U=; b=gqydiQ8eVJqm6AKTBAiE91gsXiaAheroMz6h+HL0raiI6pftHqjXqqDnJdKFwbEqfT qVT2UIuQ3jEN1fUhtiFXpJ93rnK0ki5+RXC7Yt6RmUMF3DaK0lLqlw9IHi2VzYSkNKf7 8L5RuGRqrVlGOV83y9OnThTTJqNkf4RsWTmkrI9VwQCIXmTaH3dXpbdT5J8G3SIs293R 9lE5jPDUNSKAOzb+szlQdzsqkJfhCeTcM5kDxXfitlV0dTiQxrSsnsYi/g4wo9ta7YdT +xsv7x2aF9UvfjRmuGyVRHGprX4J/TqUyLkCACNG2OF8Da4jKSqUoBsJq60bhrwhpX2G Qiag== X-Forwarded-Encrypted: i=1; AJvYcCVRv2L1ScquuuanJW9RfHCJIURQhO3I8qmgxEbAsGAw6v2b74SgBBhYNJuR+uMEC0DiOf30n+ZDaNg=@lists.xenproject.org X-Gm-Message-State: AOJu0YyLT/4zD7nY9kZT0KEVUj/Ab7fDF6KLXjlfPkB9bzAmZkzma59m uKNEqH+8qC1LGKvNrf2/VRteyxdTiNE9W1Ahs6ZlqwxSsR6gXiWF X-Google-Smtp-Source: AGHT+IGQzw9towbWt3esYv6BylqAAAmG7i8maUZip7BzOASpnZ5frQ70BGwkwxAacACbTLNukHjFrw== X-Received: by 2002:a05:6512:224c:b0:52e:a008:8f55 with SMTP id 2adb3069b0e04-5331c6dcd38mr9613532e87.41.1724164198100; Tue, 20 Aug 2024 07:29: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, qemu-arm@nongnu.org Subject: [PATCH v2 04/12] hw/arm: xenpvh: Add support for SMP guests Date: Tue, 20 Aug 2024 16:29:41 +0200 Message-ID: <20240820142949.533381-5-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240820142949.533381-1-edgar.iglesias@gmail.com> References: <20240820142949.533381-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 Tue Aug 20 14:29:42 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: 13770193 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 6A9E0C531DF for ; Tue, 20 Aug 2024 14:30:11 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.780533.1190202 (Exim 4.92) (envelope-from ) id 1sgPs5-0002Er-8b; Tue, 20 Aug 2024 14:30:05 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 780533.1190202; Tue, 20 Aug 2024 14:30:05 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sgPs5-0002EG-59; Tue, 20 Aug 2024 14:30:05 +0000 Received: by outflank-mailman (input) for mailman id 780533; Tue, 20 Aug 2024 14:30:03 +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 1sgPs3-0000m9-CS for xen-devel@lists.xenproject.org; Tue, 20 Aug 2024 14:30:03 +0000 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [2a00:1450:4864:20::230]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id b0023ad1-5f00-11ef-a507-bb4a2ccca743; Tue, 20 Aug 2024 16:30:03 +0200 (CEST) Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-2f3f0a31ab2so6154331fa.0 for ; Tue, 20 Aug 2024 07:30:02 -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-2f3b771ebe5sm17418331fa.116.2024.08.20.07.30.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2024 07:30:01 -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: b0023ad1-5f00-11ef-a507-bb4a2ccca743 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724164202; x=1724769002; 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=C2BvZYxCNM329YOtugIJJq27AP0DG+3t72psalP89h8=; b=FYrF7/vhsEKJ6H4dnL4yvAklO2+Rw2U3uNut8BE132QS5ibwGMROvazQmepFDMlOZ+ ulMD1QsetLv847o2rTMjD8mbMckxy4bcVUtCmRG8xxTLrbNajrmR2OakJttkRDNiY8dN rHXCBRRGQxnTKCVn09aU28svtU34UoVAg2ZLkudl3walhFarkjzY1NvwdEYZKcLPAVyI bVCFao2+YTkD9swyapNlGeW242WWKHRi2TfbVHhR5rhF/8LcJ2rvB8+pQYU8n8VohLC7 61su2svDoZr4AOkrnq1mffMOY4yOkkMSbbvWvcmEuvFEFMbuVk7PExsF1bHe4Cm7IoZC s5Fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724164202; x=1724769002; 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=C2BvZYxCNM329YOtugIJJq27AP0DG+3t72psalP89h8=; b=PMYOEhFq8a/yUa1nbOVjj48rvsVPvyvbIonUfQ5HjSmNPR/0n6ZYDAjAB67xOx72V2 D7Dy4sQLbvia+BKggGbruhDhPts5Xtw3uc8CJYWI8sVplDGUxOm42sAW+/NDIgRerzZu +s4RMNXcJwXCxWM8fREqBcdH2YFdpOnSpiUCgbvNDCwzZPU6e0XddwndFbjbnzqyR1gl 7h+/C9c+rBulV2gSlBHGHIU7dnBttCOR9ypHCj8FKNd2tzg9hE0fX5ntA3OZwrSz+uyX 1fh7u2KZLzYPujyy2iaT2kI/7rX2U71SYcIlN7Fp9hmiQ6ufJcfvJvHNJY5zbIY6ccMA 8pQg== X-Forwarded-Encrypted: i=1; AJvYcCW6Gkha8tgZFgmUuZqOhutoRhJElwAl3OAXDKH6XhlZVE83ILYDmXi3+TZpxyRWKwFZUehZAiKeZPk=@lists.xenproject.org X-Gm-Message-State: AOJu0Yxm1i12+UZe9E4Suk/BvCKDLVusdbeTjrENtiRaHj7K+MxeaLLM tumjNqJieyY5plXyhw8YkQZKA1NClo/YlOK64TtdpNykp3qXzzTG X-Google-Smtp-Source: AGHT+IHrRwz7HWObwUTGagmH+INCDwhlgY6mEOdY8uIF9sicK4D/lPSZOM/URWXKGfy0q0Gg5vOZAg== X-Received: by 2002:a2e:9119:0:b0:2ef:2b45:b71d with SMTP id 38308e7fff4ca-2f3be5afc99mr87868481fa.24.1724164201963; Tue, 20 Aug 2024 07:30: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, qemu-arm@nongnu.org Subject: [PATCH v2 05/12] hw/arm: xenpvh: Remove double-negation in warning Date: Tue, 20 Aug 2024 16:29:42 +0200 Message-ID: <20240820142949.533381-6-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240820142949.533381-1-edgar.iglesias@gmail.com> References: <20240820142949.533381-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 Tue Aug 20 14:29:43 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: 13770196 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 2390AC54722 for ; Tue, 20 Aug 2024 14:30:12 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.780534.1190209 (Exim 4.92) (envelope-from ) id 1sgPs5-0002LG-PQ; Tue, 20 Aug 2024 14:30:05 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 780534.1190209; Tue, 20 Aug 2024 14:30:05 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sgPs5-0002J6-Gn; Tue, 20 Aug 2024 14:30:05 +0000 Received: by outflank-mailman (input) for mailman id 780534; Tue, 20 Aug 2024 14:30:04 +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 1sgPs4-0000m9-PW for xen-devel@lists.xenproject.org; Tue, 20 Aug 2024 14:30:04 +0000 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [2a00:1450:4864:20::134]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id b0c6c0d1-5f00-11ef-a507-bb4a2ccca743; Tue, 20 Aug 2024 16:30:04 +0200 (CEST) Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-530c2e5f4feso5684198e87.0 for ; Tue, 20 Aug 2024 07:30:04 -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-5330d424725sm1790433e87.249.2024.08.20.07.30.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2024 07:30:02 -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: b0c6c0d1-5f00-11ef-a507-bb4a2ccca743 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724164204; x=1724769004; 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=P0gf4AWHulAzAV2HaIyUy+fKTdCex9KA7D9+c05rick=; b=mA5c6WzaQYSWFWO4VuzjBbPf1hQ5+gVKIH2/ZIYLfQmCgdi5ZrWwzrNGJ0wf69eguX 2XDFi5My8xneOOd4asTm8PEnK7Kp1H8Pp9jWzAFxOKXuIFZPPlU2MlwsIqJt3oqpPpKw 2NNhsgYXei+Rr0JukQQjjUfS9UfvatQUguN6SHwEivWZLyFnpGzmNf3XaxGYvVS8cgdB s0iobJyyBlkAF3YzPO5oveM+88amQrTrCCxq3KuIW/tB/Y+f6gfYp2VkeazRADKAfqcH PqFXcTrl66btGfAHWwwlmqadZBKKP9Sw5mDJwCXMgStmkc62lGCEaQag4e8NckfRal4g UXtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724164204; x=1724769004; 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=P0gf4AWHulAzAV2HaIyUy+fKTdCex9KA7D9+c05rick=; b=FMJB4GeezNTE+L3pV38XT6MpWMZkd9Ru14ViPj2zbUApkWPcX24tLHSg3SsViy1WIV GBJeShvkUIS0uMvc+kL2eKMaB9xa+OfhJuoyksWyjxRmf3ZCMT4JxGTXHm4AZQfMaMTx 5BXCbDObmwMKtynRd3Z39Yv51+zu1/jXNYnDNwSWkadBqwN/wsAfCfLueVzaFm2cP/B+ 4zcTFd8iWAV5yZ7goKLUWEFP4wa+dWJn2MFK6RIsIvH6O9UhsuXQaRGUDnbyHR30mHVN ZIjKSB4OKE0QyHldU3IwDzuqL6UlsHHLGB6QaE0M1+lO1MVhGZl4YlyW4PFIDQTtE7Ba 55Lw== X-Forwarded-Encrypted: i=1; AJvYcCWSFg2P5q0Ti2wIXyFSvmDMo+c9PbF+whj3VstUActugjZC5UUFjPKzdr1gs4eouFJJe8xF+2jcyIQ=@lists.xenproject.org X-Gm-Message-State: AOJu0Yzz+uIqXy7Y/F19vwGvRHuHK9WUw0vokY5+GLXaM94gSpSaK1I8 0oWo8yw5mca3EipJDLWvKVXAofJOG8mZnHZXg5VmX0Upfq5hxXK6 X-Google-Smtp-Source: AGHT+IES1gNwxhhoBVLe4AixtVypdxMBk0O0dKwZ1tDvA9tVYLXBSnaAgHk6+BIt+ttxuzPWUzelPw== X-Received: by 2002:a05:6512:2c98:b0:533:4191:fa47 with SMTP id 2adb3069b0e04-5334191fc44mr1624238e87.47.1724164203068; Tue, 20 Aug 2024 07:30:03 -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 v2 06/12] hw/arm: xenpvh: Move stubbed functions to xen-stubs.c Date: Tue, 20 Aug 2024 16:29:43 +0200 Message-ID: <20240820142949.533381-7-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240820142949.533381-1-edgar.iglesias@gmail.com> References: <20240820142949.533381-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 Tue Aug 20 14:29:44 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: 13770201 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 02086C3DA4A for ; Tue, 20 Aug 2024 14:30:19 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.780535.1190222 (Exim 4.92) (envelope-from ) id 1sgPs9-0003Dp-53; Tue, 20 Aug 2024 14:30:09 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 780535.1190222; Tue, 20 Aug 2024 14:30:09 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sgPs8-0003D4-Va; Tue, 20 Aug 2024 14:30:08 +0000 Received: by outflank-mailman (input) for mailman id 780535; Tue, 20 Aug 2024 14:30:08 +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 1sgPs7-0000m9-Rt for xen-devel@lists.xenproject.org; Tue, 20 Aug 2024 14:30:07 +0000 Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [2a00:1450:4864:20::233]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id b24d87a9-5f00-11ef-a507-bb4a2ccca743; Tue, 20 Aug 2024 16:30:06 +0200 (CEST) Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2f025b94e07so61565441fa.0 for ; Tue, 20 Aug 2024 07:30:06 -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-2f3f1d2b43bsm938911fa.95.2024.08.20.07.30.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2024 07:30:04 -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: b24d87a9-5f00-11ef-a507-bb4a2ccca743 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724164206; x=1724769006; 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=La4bzOi9ro9f5XHQO0tTS2EJNdEqne2pZ5yj4kL9zGQ=; b=TWHDwzoB5iNagTsqqxZAaGa5zC7hRO5fQBWsYYTiLRe63DALnMRP0IrvlZe8uXdvyD ttEw6V8QZLcqvBclvNBFkMzJaAJMqrFK5zo6ty+KfWErsS5/tmlYF17zt+QZ62d6ZuMa V+hdeH62hSR1Z9+bJCIjr7zB8zybsaMUJR/zTZUW6dm1T1wB4Z9UkhgjgSmzhi6B81b8 1cXm85JPIlEitsL81zti9/Z9vO9dK94uolZav0+OviNJsFPRH5VXJs8WyBARoDCiltZ8 YmaDHbenzqEaV5EDsEC709gW+6xX/bRCyP0SzKZ9tqXw7S57eLCnXvl2ECQtz2fWIM3E 1ESQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724164206; x=1724769006; 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=La4bzOi9ro9f5XHQO0tTS2EJNdEqne2pZ5yj4kL9zGQ=; b=arAvkZTN+QnkOOUs+whU2xQnF7WRErSRBntaYOq+pAyVyYipBEyPRQSIwaUJsipPpH D1fBJnxUoKbNAMunmTNxZ6W315Ohp/ds8y6OWDzT/QhBqJo9IhbYirce9kNBtAGbENdR bo4OyyTDBkUfFoRDgGKQreF7yB6ww3TlJoMix0B+gyrYRsdAWYHSuZC0i+U0e6D2U18Z fr+KyxzAM2t6Z7C27GW2G3vYfJ284/GicbqUdrVgKejWnDY2d/DbJP1CINpNNKrTwXdJ V7b1XBj4sPxYn24MMQXc3sfIqP5+0cxCk5n1BSccIOYeq1PmTxgHAQF40ssHniXq2HMw oIKg== X-Forwarded-Encrypted: i=1; AJvYcCWkdCVMNfCivZU6WgB3JFcGBHTfmwWZerlgbls0vQNCbk858lAlKMkw1B+AYj1wE8XgkkbpfC4gwYpvAERPt34UuZMl0uA0Utw49YSiTbU= X-Gm-Message-State: AOJu0Yx4weNPBoI5mHJv4CfXJv56OSRovTJIYYrBd5BZhDfm10qiXwnL dAXod5J1Df2QG4lyJdaSwyTjbxWNLng4dxgbcpFU+S02xiIumvpM/ximcA02 X-Google-Smtp-Source: AGHT+IGd+6DaCDah465GFLHr+cvbOd8y3IHEHjhNmbfoVq2Sn24FbI50r9QhwbrpmK3ehA83NVB+2A== X-Received: by 2002:a2e:4c12:0:b0:2f1:563d:ec8a with SMTP id 38308e7fff4ca-2f3be60c0cbmr87157561fa.41.1724164205499; Tue, 20 Aug 2024 07:30:05 -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 v2 07/12] hw/arm: xenpvh: Break out a common PVH machine Date: Tue, 20 Aug 2024 16:29:44 +0200 Message-ID: <20240820142949.533381-8-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240820142949.533381-1-edgar.iglesias@gmail.com> References: <20240820142949.533381-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 Tue Aug 20 14:29:45 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: 13770200 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 058B5C531DF for ; Tue, 20 Aug 2024 14:30:20 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.780536.1190232 (Exim 4.92) (envelope-from ) id 1sgPsB-0003gu-MW; Tue, 20 Aug 2024 14:30:11 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 780536.1190232; Tue, 20 Aug 2024 14:30:11 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sgPsB-0003gc-GL; Tue, 20 Aug 2024 14:30:11 +0000 Received: by outflank-mailman (input) for mailman id 780536; Tue, 20 Aug 2024 14:30:09 +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 1sgPs9-0000m9-Ay for xen-devel@lists.xenproject.org; Tue, 20 Aug 2024 14:30:09 +0000 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [2a00:1450:4864:20::22a]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id b3806914-5f00-11ef-a507-bb4a2ccca743; Tue, 20 Aug 2024 16:30:08 +0200 (CEST) Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2ef2d96164aso64441481fa.3 for ; Tue, 20 Aug 2024 07:30:08 -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-2f3b7729ca3sm17564031fa.124.2024.08.20.07.30.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2024 07:30:06 -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: b3806914-5f00-11ef-a507-bb4a2ccca743 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724164208; x=1724769008; 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=YYTK3sEbVSmHEhPrn2VXA2RyVEV88RXdnwDULLdptgIgdGnf7GWP3FGDp/lMKZQkhC O8tQySTLUxofq1N3msTcTjjXW7nMz2vSCYycygX7ru+BBV+etBHY9PnAJGkB8XvcCqdf p87izn6np1P3qOK/+yCz7Za71QPPxpLjuhHpBLe77F72qdPyX7hvkV+9qgGDdsuRwk0o suSiDJeLgIPJpDta7it6Xbdyqszc4Ix5GLunFkiJUhofKEt0OW5I1XSxvH8jHwRPbbn3 E96KobmOV9tZ8z8i/D+WaLP8aREJda79zn4I6D65mPQZ8RJB7lRGP9PlFK8U06d+mlAw Sc7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724164208; x=1724769008; 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=oN2a8N4oUfJmBi3RRedniKsURYeuu0xsrBpLGuf06HDbi5cMHgO67ihBkd6vYr51Uh +ow6EK5o8Zu/bXBS54crM+i3nb/XESnstU58hH8+bBvJL8BZcqXPDlTBor8qzYacPtKv smTVEpMj039er6sKA+rhWyS5MaAbpCptoBZ0zFmc92s5Tum/rMUA+ksHjBqWBYJ1OsAE QrBxWkQS0uabjPkZ0kbw1wlDsFQ6eYoDPmy/0hfZnOnG6XIsGyDuXjvh26rOUdyKXq40 x0oylAXfVamh+k5G46GijaoxbKjGSlJrjNPuDhCWcdqS2BfRhbLh+YntdH4BGuTqDWAc a0yQ== X-Forwarded-Encrypted: i=1; AJvYcCWf5WUHDJq28Y3K4JgtFltgS34iioaxLZqvl84d7fcPSbQNxY7sf54Y3q+9ueCJXKTQKQuIeF1om6Yu+MP6zmbc7Ifogws0M755TuCuWyI= X-Gm-Message-State: AOJu0YwZit246yw8Ak/9T2xgOCq0XMUs9ttRN23Si7OJp7U3HPZicf+z h7GgdTS/HQLffAK8Aqgvp3j3AmAu1mdZOJRR1Ro1eS+S7k3t64eK X-Google-Smtp-Source: AGHT+IGvYq0XUQaDgo2b1zhaMjoLQlam8cibWHn5GgbCoSKj72iq1ZAvahi0NkyE48N8bfPt4YQ3Fg== X-Received: by 2002:a05:651c:b10:b0:2ef:26f2:d3e2 with SMTP id 38308e7fff4ca-2f3be574b20mr115566071fa.2.1724164207760; Tue, 20 Aug 2024 07:30:07 -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 v2 08/12] hw/arm: xenpvh: Rename xen_arm.c -> xen-pvh.c Date: Tue, 20 Aug 2024 16:29:45 +0200 Message-ID: <20240820142949.533381-9-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240820142949.533381-1-edgar.iglesias@gmail.com> References: <20240820142949.533381-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 Tue Aug 20 14:29:46 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: 13770202 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 4F95CC5321E for ; Tue, 20 Aug 2024 14:30:20 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.780538.1190241 (Exim 4.92) (envelope-from ) id 1sgPsC-00041q-Vf; Tue, 20 Aug 2024 14:30:12 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 780538.1190241; Tue, 20 Aug 2024 14:30:12 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sgPsC-00040n-Pi; Tue, 20 Aug 2024 14:30:12 +0000 Received: by outflank-mailman (input) for mailman id 780538; Tue, 20 Aug 2024 14:30:12 +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 1sgPsC-0000m9-24 for xen-devel@lists.xenproject.org; Tue, 20 Aug 2024 14:30:12 +0000 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [2a00:1450:4864:20::12e]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id b51dbfee-5f00-11ef-a507-bb4a2ccca743; Tue, 20 Aug 2024 16:30:11 +0200 (CEST) Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-53346132365so347421e87.1 for ; Tue, 20 Aug 2024 07:30:11 -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-5330d420bc6sm1791128e87.241.2024.08.20.07.30.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2024 07:30:09 -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: b51dbfee-5f00-11ef-a507-bb4a2ccca743 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724164211; x=1724769011; 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=E4eNChmDOSB3t3Dl53CQtsKq8Matjrpyo2dVwb4BzVLMzZGNv1GKCAZDb5gj8q2Enf RnSGCf1jTzsJ0GtHMPkKOZOTphPgUCW6mWfQS81QydV3tJeMCy4ab1LyougUoWJ74L3+ pS9+1b2UbKRz+1eQ0zS+UCocbmlJDuR4ydu4Q2c+MsPdxMunm8WmrPXChfMktDuhnKCV O+8NmNDEKMCBA+YVJLspv9XTT9ziH+DCzSOFcMcQcWzPk0LRh8ssJGWjtwB6RPyH+BHo +8gDW3bmDVnOTPx86oJzBCb5PCwNQh0YzsBHz+yKWfD80GMpNABt8e2zbWSflD59Djj4 Z7lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724164211; x=1724769011; 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=rHaaS5v0NX63AhTdMKlV2XKgDU7Mo0/Vc/fjZZzBQTFBFzmBW5GcdAn7VyJmOSb2Uo 4bjjviXCpG8vTX56RiBE/sNxs0OCkIHHoZLi3GrFN8gVbv2//OzrHO5GG+oL47YtebI+ GSqqMjeyr6n+ZRDEEUjndyRpyyBdohrS2q58Bg9aWkTUku16rpjObHgwgKoHEJ3mQGrx G950kOOhsoKFUu5NbQNFsBv3LarwL3T0Uq3+8Kgetam6GesvFXLSF0yCRYb7VeKNT5vN UHqVGHCZ9pTzc5QasOsdeJEXo7OhAcXgVoHLcQpntecTac04bIFTFcp4qLhZsVyDL5i4 mg0g== X-Forwarded-Encrypted: i=1; AJvYcCXuwLYF1eafKEqXePjutpSnPSaNP9cJaCFL9XU7Rm6EHKST6OTtJRzkJJycXPe2+LcCcrM1P10+YZ8=@lists.xenproject.org X-Gm-Message-State: AOJu0YzRcom7TwLxKRMEcYlw7YPSGRa9hH9PRJUHxPXjQims61C95Fb6 DOTPpSVHBMPhYbum+jiRac91/o08AeDhK0dQV3Vs4gQKuZ6sQ/Ps X-Google-Smtp-Source: AGHT+IFotZ4Ec+2t7CYxqYEsIJgRWw4/u9z0FOKI55M7uGGokh/ts3s1WXBedzrQkXbLGgZ+ZDCasA== X-Received: by 2002:a05:6512:3a90:b0:52f:d15f:d46b with SMTP id 2adb3069b0e04-5331c696aefmr9419582e87.14.1724164210397; Tue, 20 Aug 2024 07:30:10 -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 v2 09/12] hw/arm: xenpvh: Reverse virtio-mmio creation order Date: Tue, 20 Aug 2024 16:29:46 +0200 Message-ID: <20240820142949.533381-10-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240820142949.533381-1-edgar.iglesias@gmail.com> References: <20240820142949.533381-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 Tue Aug 20 14:29:47 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: 13770203 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 8DB8DC3DA4A for ; Tue, 20 Aug 2024 14:30:24 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.780541.1190252 (Exim 4.92) (envelope-from ) id 1sgPsG-0004ZF-7C; Tue, 20 Aug 2024 14:30:16 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 780541.1190252; Tue, 20 Aug 2024 14:30:16 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sgPsG-0004Yy-2A; Tue, 20 Aug 2024 14:30:16 +0000 Received: by outflank-mailman (input) for mailman id 780541; Tue, 20 Aug 2024 14:30:14 +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 1sgPsE-0000aG-IG for xen-devel@lists.xenproject.org; Tue, 20 Aug 2024 14:30:14 +0000 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [2a00:1450:4864:20::12e]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id b5db0026-5f00-11ef-8776-851b0ebba9a2; Tue, 20 Aug 2024 16:30:12 +0200 (CEST) Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-53345604960so398918e87.3 for ; Tue, 20 Aug 2024 07:30:12 -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-5330d3ff322sm1784334e87.173.2024.08.20.07.30.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2024 07:30:11 -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: b5db0026-5f00-11ef-8776-851b0ebba9a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724164212; x=1724769012; 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=ppMyZS+5FMSiffs9dgCYzOxXzoRKybQSEG9AEVh/uZI=; b=PPpxZ6fhcImssvAkF6urUpuV5RmMz8X98PEdlIFMCenrniNC+o7qDkZdthXqKF7wW+ S5rDEJWaiHo8lqX7yBo+p6Ywh/IvW5wJEOsZmtmx4z2drDkStMERvG5bzjoYKZ58RsRr ZkBS9gp81lYNDZmKnvB01LlYBSPRS4okrCLxtzmILWNZhw7xhDX6ISneJGlJexuDQGLP 9VNeJfOIOJdS6xeuKb4/cnKn3APi2lr2e8rtx3X5sBCfH58B5wiTWafJuZ+kJs1PJcFm i/k8mQ0FPrehG8EmHHeNoRblr04JgXZevA60zGSHddoIeUGwo/pYmFETIiK6XXfUayWA haIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724164212; x=1724769012; 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=ppMyZS+5FMSiffs9dgCYzOxXzoRKybQSEG9AEVh/uZI=; b=IFwvP1H7bRhRBQwkma7st0NnT+3s2SZ72xEZizPUZygGHdnm5Ok+2PyrtomhhTJxJ2 cpawtjuBgP2ol9Blsi3W33ApcyK1/5BgccqL0x1tasKEiMNsSbbultBBHtrZd0uajklO CzA2YoJyNCiPsUVQ/++MfQJsiAhPaVfg9x883xZLWt1HRPOspTOtRwkyAqbLxmKa3b31 GUOyCmN88C35Id3bfybp2EDe7RyhxvaPqJ61zV2uClMevgDoJ4515nJPbo7/Og/JSvfW n4Acn1elB14EBobZSnAQ/WdH2T0WYYe3J9vPUhWhIpzgHfNrrbeRmFTql2x61iwwKzUN 8jPQ== X-Forwarded-Encrypted: i=1; AJvYcCXdZuvAOdTzARxwCmQnIqrbnJ/j5NCog3nQ+XMxkZXCSeWOpudU8Lu0QEkWFOvwh7yWgWBvAbocaLtnCtHy/gpVsN9vCHwqeIVeVoy/+b0= X-Gm-Message-State: AOJu0YxA4M8h9y3h9xN9OETdTpptIyr+UMJUxga9h+g2JziH6ilLLIjA Wrh4d2trn0CFa4GjSL8E6uFOKbY68+6OmIoy0+5dOMXWdqTROJpB X-Google-Smtp-Source: AGHT+IHLMp6nmn/tVarHCHwk6XpO2ARIoKfTKlovZdAfYoHj1NTbn6sxh5nlUUvp3A1yWjCmxQMsJg== X-Received: by 2002:a05:6512:ba7:b0:52e:a68a:6076 with SMTP id 2adb3069b0e04-5331c6e4eefmr9192819e87.49.1724164211636; Tue, 20 Aug 2024 07:30:11 -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 v2 10/12] hw/xen: pvh-common: Add support for creating PCIe/GPEX Date: Tue, 20 Aug 2024 16:29:47 +0200 Message-ID: <20240820142949.533381-11-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240820142949.533381-1-edgar.iglesias@gmail.com> References: <20240820142949.533381-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 Tue Aug 20 14:29:48 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: 13770204 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 B5F74C531DC for ; Tue, 20 Aug 2024 14:30:25 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.780542.1190256 (Exim 4.92) (envelope-from ) id 1sgPsG-0004fD-NS; Tue, 20 Aug 2024 14:30:16 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 780542.1190256; Tue, 20 Aug 2024 14:30:16 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sgPsG-0004cx-EG; Tue, 20 Aug 2024 14:30:16 +0000 Received: by outflank-mailman (input) for mailman id 780542; Tue, 20 Aug 2024 14:30:14 +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 1sgPsE-0000m9-NM for xen-devel@lists.xenproject.org; Tue, 20 Aug 2024 14:30:14 +0000 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [2a00:1450:4864:20::129]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id b6a0bd42-5f00-11ef-a507-bb4a2ccca743; Tue, 20 Aug 2024 16:30:14 +0200 (CEST) Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-52efc60a6e6so8080533e87.1 for ; Tue, 20 Aug 2024 07:30:14 -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-533449f5fdasm118978e87.284.2024.08.20.07.30.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2024 07:30:12 -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: b6a0bd42-5f00-11ef-a507-bb4a2ccca743 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724164213; x=1724769013; 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=qb70tZhf6O0rqG3q2lg1Kgw4jrd26x22YIO9764ldGo=; b=jc/8/A4rHGCO692fgEx6TruDitoNfXvLzCOzpfNVA/iJQA1p0vUhINfBmBo7JMORMz S1Ydq53Q72Bvp3Vr1nqltZGZ3uPCy2DO2GwzJJII1KSpySA/yWf9AmwR1KMuuKet0UeQ 6qhzCtovZH/mrPv2WnqmUhBuXOGAJShy0p8+0bmkvnob1T5mWtYiLSdN/j8ag62dwWHx 0kOIMs46O/QHGwG0Dyd4ZJNTKIduXV8S4xq/otTpN+lZ0xXZJcGuPMPuo5aZl1/MFUkt c96ciIowyZLy+VSzROVbTYeoCUSI/4qCPdEq3XOOYq3m2Q9QwkWq4W689rkCw9mdH9Q8 SZow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724164213; x=1724769013; 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=qb70tZhf6O0rqG3q2lg1Kgw4jrd26x22YIO9764ldGo=; b=o4p3dbZMC1lPbcw1ugVbkhjGLRT67ZqEwSK9HrxeHHAwuqjsvOOI6LwCQzwC93A5vz u0XQclXZ0iqUT4P9u078FrUknExRYnngFw0sTOVdKuEnHXimzNKvb/jhRXGpMlxZWvvu ol4fDQiLX2VJYPI1t5+DWcIlkPEedIgfI7RBsVwUQXPMR6TUiAXsLETE0mHoQj6V0msX jgomG5mCQ0Kg2+1C9N8hLorlwMVNNL1RHQxRec1qHTvI0xUiNzux5FRAv0J59XmTdt2Q ET8Rgjv/lSb+pqfL/ifiE0jrVLnaE+K0iuYCk11W/khvOxBEVA1IUGcu4durDRK+NBJV PVtw== X-Forwarded-Encrypted: i=1; AJvYcCXHR52t0wziCvrjNvMi+hQBWLWaQiRJe+PEPiKde8rcf7xVV9mtdcZBNvI6SUBNFlo4J3qruysD3snczemp9aEaFHOeAkeEB9Yjzjiaff8= X-Gm-Message-State: AOJu0YyF6cBw5Ijx4NgCIB6dQvzsklPFS7JlmIP8aoxFAKII+0R+orG6 RVsOkx8a9gl7Hh1VOOmeYtS92/72gVNUjbZILFI9dEoPMott/jgy X-Google-Smtp-Source: AGHT+IFoXhrlxg3cNGb0+DSA5Qu76KzL7+3HHVZt7gmKWNEWr1BFmaIm+WYR3dUl/tDDDSx61bB+zA== X-Received: by 2002:a05:6512:641a:b0:533:4477:28a2 with SMTP id 2adb3069b0e04-53344772a8emr1193165e87.16.1724164212866; Tue, 20 Aug 2024 07:30:12 -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 v2 11/12] hw/i386/xen: Add a Xen PVH x86 machine Date: Tue, 20 Aug 2024 16:29:48 +0200 Message-ID: <20240820142949.533381-12-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240820142949.533381-1-edgar.iglesias@gmail.com> References: <20240820142949.533381-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 Tue Aug 20 14:29:49 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: 13770205 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 51FADC3DA4A for ; Tue, 20 Aug 2024 14:30:29 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.780546.1190262 (Exim 4.92) (envelope-from ) id 1sgPsH-0004rz-Jz; Tue, 20 Aug 2024 14:30:17 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 780546.1190262; Tue, 20 Aug 2024 14:30:17 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sgPsH-0004nI-BU; Tue, 20 Aug 2024 14:30:17 +0000 Received: by outflank-mailman (input) for mailman id 780546; Tue, 20 Aug 2024 14:30:15 +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 1sgPsF-0000m9-NU for xen-devel@lists.xenproject.org; Tue, 20 Aug 2024 14:30:15 +0000 Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [2a00:1450:4864:20::231]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id b7471464-5f00-11ef-a507-bb4a2ccca743; Tue, 20 Aug 2024 16:30:15 +0200 (CEST) Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2f3b8eb3df5so56463381fa.1 for ; Tue, 20 Aug 2024 07:30:15 -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-5330d41ec8bsm1774535e87.217.2024.08.20.07.30.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2024 07:30:13 -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: b7471464-5f00-11ef-a507-bb4a2ccca743 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724164215; x=1724769015; 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=g8Jdsy4MGpXTpFcHubkj5du1GIXuzn9nL6875ttmnqv61vHVO1JFBkLA5KvyBdsFgl emoeJFapBRz4p8EWc5D6fNZbIlaSAkFutd3wyKeDYQtLwBPjnhjzfxxvWcHmcyfvrmfH Z+GZ3q20MBefnORRu0lZKS/CwYT2a83p45qO5TxyQXJBf1zQxEMReFYRLVx8YWtP4NeS kIbwsO2CS2P3+K5CPex+LkZ3NYv7IVdYwjWW4WygVqj2zdZNVVwnyYcOIth8TCFXBQji ufmT0hHHkmYu9iVg6WAo2gqH1lS7rgmFoQDtYUY86EhXOfGrkapfYgj93TeZagOehwYv 8yog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724164215; x=1724769015; 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=daXCqnafLLpOKFjnX+E7P4NLHwADTKs1DF6XULE6ZJXhQ3DNMSLhC1U05vY/ghXbtS nq0pq95lgHQaApQERlz819zGnu84N0aUMzgQxoOUN444lgBPTgCPBVV5UkDIhms9Tags vHhT49P1ij4QgCFBL8BfuI7OziVNwaj/Q/SzchX+yxPYxsinxgFe6rodYRw4e+FLluyg elb9VNYO99LmD6L891OWQQM04UI6H2cyXwB+gImc1t/eZHUq/T7+6nscFO+vG+X8v5jF f1mLdIMiW/JjPWjdjhxaB6/kNJBMJGlaeApn5L7JouRswc9IelDDhFmXTx3ldHEI+Gc8 lZLA== X-Forwarded-Encrypted: i=1; AJvYcCWGss+yL5j3PngGW905udKFc7MwO7r5eMZ7uvyM+Fp3hP27s86P8M/r/gGPE/b1mt9A7cMYAK62YSniub3/osRdLkzSu+Mq6/dHVSpz2JE= X-Gm-Message-State: AOJu0Yw8EaENEhR2x70G/qwbWiQp97hdof3hYlE6ygDJLlUt/gMqbWdt eGb4+tJr5fp3mHI31w/5ciUHpPr/sln4bvxAOo/51bMZAzl+S+4ySduLNOK1 X-Google-Smtp-Source: AGHT+IH2aSjaMdTU2w0L6jdfmyJXJpGAlgjDdskYkq7lMNexOEvEkzPUF5ILk79x6nw61ZRcBw/gvA== X-Received: by 2002:a05:6512:3195:b0:530:d088:233f with SMTP id 2adb3069b0e04-5331c6d99c0mr9799180e87.40.1724164213973; Tue, 20 Aug 2024 07:30:13 -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 v2 12/12] docs/system/i386: xenpvh: Add a basic description Date: Tue, 20 Aug 2024 16:29:49 +0200 Message-ID: <20240820142949.533381-13-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240820142949.533381-1-edgar.iglesias@gmail.com> References: <20240820142949.533381-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