From nobody Wed May 1 19:49:04 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1686158140; cv=pass; d=zohomail.com; s=zohoarc; b=dNhL+9EXf9BaHXmbvVKsZPW1+wJ+lYrXr0Pext4VHLCG9+L5dd2fK1Ybnlp1bctiSgeGuC9lupCoJIU+SFS0fnYlMh+9h3ZpjG59DkEp9SZayNyxzHOYINBWbmknkof9F1AsiNivc0goaNpgQzWBhKubUD1UbwqkaBgNR8fBRoc= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686158140; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FR4BawIl2nyLOoaRXHWpiEutGsBER4awTYitO3dxACs=; b=QzfsfNswefGhFAJxafY8/1EYUVok5ypFHBicsRw2LAs3o4fdvOKzCO0floZ5p6Q+vGxRSRxPeGdlRg2YJOK0Q515uynhdu9A5JkBMGTemhF1BPsPtMUGA/nxFE8PfIpSgdrW2A91IfJ7k5E6futPhYWNGxdQltWlbYVG2kPI/2U= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686158140152238.7842352174672; Wed, 7 Jun 2023 10:15:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6wkR-0008Q9-Uy; Wed, 07 Jun 2023 13:15:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6wkO-0008OQ-Ch for qemu-devel@nongnu.org; Wed, 07 Jun 2023 13:15:01 -0400 Received: from mail-dm6nam10on20629.outbound.protection.outlook.com ([2a01:111:f400:7e88::629] helo=NAM10-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6wkE-0005sc-PK for qemu-devel@nongnu.org; Wed, 07 Jun 2023 13:15:00 -0400 Received: from DM6PR13CA0070.namprd13.prod.outlook.com (2603:10b6:5:134::47) by MW6PR12MB8997.namprd12.prod.outlook.com (2603:10b6:303:23e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32; Wed, 7 Jun 2023 17:14:46 +0000 Received: from CY4PEPF0000EE3B.namprd03.prod.outlook.com (2603:10b6:5:134:cafe::b4) by DM6PR13CA0070.outlook.office365.com (2603:10b6:5:134::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.19 via Frontend Transport; Wed, 7 Jun 2023 17:14:46 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000EE3B.mail.protection.outlook.com (10.167.242.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6477.13 via Frontend Transport; Wed, 7 Jun 2023 17:14:46 +0000 Received: from SATLEXMB07.amd.com (10.181.41.45) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 7 Jun 2023 12:14:45 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB07.amd.com (10.181.41.45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 7 Jun 2023 10:14:45 -0700 Received: from xsjfnuv50.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Wed, 7 Jun 2023 12:14:44 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PrZbPEOrbH5DQD2dU3JIdpReBAZmLidCrBOVeRD7kn5CQIWwcXKfB8Txwtry5h8CV94ifXR6HZdBZ44m25JWsoMpHZBOzehZdzB+oLICTzqJNByJc4EafO/7OrMffPULjsuNV4PyQNu6tiixOAuDcEtZeRUIcuq9NaREre8vNaG8DC8OfG44rKUIi3qP7Cm5mopeVyQKdOOsnRdEY/WYerdvK4toP0PN+DE7ggpDXMxdJz/PvS1d1ET3OtJTM7s5ZjOlFuOuv54FE8qlGc3d+Y85YcTWuAxdjSj+kUs9UH3/WmwV9B2Mnfza+ZWcaCoQ5n++YAxhUJLAm0YKbFxOZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FR4BawIl2nyLOoaRXHWpiEutGsBER4awTYitO3dxACs=; b=aKha+X8MslBwKkAWYZY1sAWu0wCz0ohtAhIeZ9DQYFCYEZeVnineku2dfy5mb9De4ztQa6ZePRZDfPM2P5cizx+O++XaHZ5iXysrUpcWwaE0M1+Kb0fQ5UlKKfX5e9OwYYFEDYshHFlx+S4lvpn5DFxSF5rDYWwmG3QdpcSBcufdVrGF4mnc1Ic/TZaZMbzsaLMvjs2KO7V6fYrisi0HEZsebEW1krxOtnExBo4HUNPKp/pyoPIWTi1yWRulTc1JHrz0OFykBCPhllv55Z+H4eNH/VaIFIfTqugeFY8veL7NTCMi+dDgZpUYd09kI+3rgsDKnv/e12bDB9j2wgHu2A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FR4BawIl2nyLOoaRXHWpiEutGsBER4awTYitO3dxACs=; b=jbRfSTFV1s+em9N2Ml/UoYgxV01Ibgl6OkJ5ll+Kil9LTpRePGVvUXpIHoZJR6JnL/eqgnu7ArZ+KbGxgF1OF3tVb75QP+Kd7HapdGlcDSH7ZffiYQSNLSSfcjR//kYr7x83adKGeNxrQhng7NhwAyqFKv9P6d9dQriUTgRVMxk= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C From: Vikram Garhwal To: CC: , , Stefano Stabellini Subject: [QEMU][PATCH v7 01/10] hw/i386/xen/: move xen-mapcache.c to hw/xen/ Date: Wed, 7 Jun 2023 10:04:50 -0700 Message-ID: <20230607170459.14722-2-vikram.garhwal@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230607170459.14722-1-vikram.garhwal@amd.com> References: <20230607170459.14722-1-vikram.garhwal@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE3B:EE_|MW6PR12MB8997:EE_ X-MS-Office365-Filtering-Correlation-Id: 78ea844a-b730-4fa7-2b5b-08db677ab155 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ccdJsf7XKyG6COBO0MxgDR1BjfPB6ewfCXjeHVw5k4VrOo59pIEekJOe14OCAa/2L+PTYJHZK5jFHAtSEkTM0KJvmq6cw5dXOwu7Z4Jd+CcKek3yhm7s+RAVMr9Ne+KuYQvEz5tVFxayGOmRZAoGIhQeIUvg/6JEu3+idylEiGs4MuwyVZ+u3fVXojEdvCu2nNnqCmF/Ue03SCbiacl3grqvQD6QRZ/ebPoRp+EOIV5gW8OA6kKWUB0hCo/ZViggT2mZeB2KRWGB7V7rGe/RJJsAEDUu3mbQESEJ9DD5Ar7rHV1hR/Ky6xKc96uTIrYHbYneV+HAjOLhkE1vxER4D466PcHuw1i/7ZetXg0LKoueY39UQX+Fh1RjgbXqsG030mhsP73m3Nd3gFsUtqQlx5YNHXX7AW/j4l0No/mCk/FwUYR9jDhtgdPal47GpDlrdgd4+CjheWuAlLhDK50fkPBl0x5LuF8NFjj4ph6IW7uFZpj6yJ8Enjh+PQ6U8bXnr5L2a8jEBtkPYFDhWu6xuaZuWLVQhSGtGApjhMqg8vwia4/0F0SRP3qWWV94KWkgguIFPGhQpjCLVODpBjMJ8sfiZZuDyd+3lt4Wu6cMgMtWyZR8RsDBhRzEmJCmoIHaYtmAdeKGqF33ba9OcniLzQTSpGLJz0GgE9qKggwYBHw8K4cfws//G5kBwHbAoRFZRgatZqqpSu8018WOC4IxEkMPI/86MhJ06EvUaJ/p4fX5KgxzHkY7ms6uVK1vaLEWcbqoBhO6M7FMUnIjJtxKIg== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(396003)(346002)(39860400002)(136003)(376002)(451199021)(36840700001)(46966006)(40470700004)(26005)(70206006)(54906003)(4326008)(70586007)(356005)(81166007)(6916009)(82740400003)(36860700001)(47076005)(336012)(426003)(83380400001)(82310400005)(478600001)(1076003)(36756003)(44832011)(2906002)(40460700003)(41300700001)(8936002)(40480700001)(316002)(8676002)(86362001)(6666004)(2616005)(186003)(5660300002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2023 17:14:46.0939 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 78ea844a-b730-4fa7-2b5b-08db677ab155 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000EE3B.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB8997 Received-SPF: softfail client-ip=2a01:111:f400:7e88::629; envelope-from=vikram.garhwal@amd.com; helo=NAM10-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FORGED_SPF_HELO=1, SPF_HELO_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1686158142488100005 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" xen-mapcache.c contains common functions which can be used for enabling Xen= on aarch64 with IOREQ handling. Moving it out from hw/i386/xen to hw/xen to ma= ke it accessible for both aarch64 and x86. Signed-off-by: Vikram Garhwal Signed-off-by: Stefano Stabellini Reviewed-by: Paul Durrant --- hw/i386/meson.build | 1 + hw/i386/xen/meson.build | 1 - hw/i386/xen/trace-events | 5 ----- hw/xen/meson.build | 4 ++++ hw/xen/trace-events | 5 +++++ hw/{i386 =3D> }/xen/xen-mapcache.c | 0 6 files changed, 10 insertions(+), 6 deletions(-) rename hw/{i386 =3D> }/xen/xen-mapcache.c (100%) diff --git a/hw/i386/meson.build b/hw/i386/meson.build index 213e2e82b3..cfdbfdcbcb 100644 --- a/hw/i386/meson.build +++ b/hw/i386/meson.build @@ -33,5 +33,6 @@ subdir('kvm') subdir('xen') =20 i386_ss.add_all(xenpv_ss) +i386_ss.add_all(xen_ss) =20 hw_arch +=3D {'i386': i386_ss} diff --git a/hw/i386/xen/meson.build b/hw/i386/xen/meson.build index 2e64a34e16..3dc4c4f106 100644 --- a/hw/i386/xen/meson.build +++ b/hw/i386/xen/meson.build @@ -1,6 +1,5 @@ i386_ss.add(when: 'CONFIG_XEN', if_true: files( 'xen-hvm.c', - 'xen-mapcache.c', 'xen_apic.c', 'xen_pvdevice.c', )) diff --git a/hw/i386/xen/trace-events b/hw/i386/xen/trace-events index 5d6be61090..a0c89d91c4 100644 --- a/hw/i386/xen/trace-events +++ b/hw/i386/xen/trace-events @@ -21,8 +21,3 @@ xen_map_resource_ioreq(uint32_t id, void *addr) "id: %u a= ddr: %p" cpu_ioreq_config_read(void *req, uint32_t sbdf, uint32_t reg, uint32_t siz= e, uint32_t data) "I/O=3D%p sbdf=3D0x%x reg=3D%u size=3D%u data=3D0x%x" cpu_ioreq_config_write(void *req, uint32_t sbdf, uint32_t reg, uint32_t si= ze, uint32_t data) "I/O=3D%p sbdf=3D0x%x reg=3D%u size=3D%u data=3D0x%x" =20 -# xen-mapcache.c -xen_map_cache(uint64_t phys_addr) "want 0x%"PRIx64 -xen_remap_bucket(uint64_t index) "index 0x%"PRIx64 -xen_map_cache_return(void* ptr) "%p" - diff --git a/hw/xen/meson.build b/hw/xen/meson.build index 19c6aabc7c..202752e557 100644 --- a/hw/xen/meson.build +++ b/hw/xen/meson.build @@ -26,3 +26,7 @@ else endif =20 specific_ss.add_all(when: ['CONFIG_XEN', xen], if_true: xen_specific_ss) + +xen_ss =3D ss.source_set() + +xen_ss.add(when: 'CONFIG_XEN', if_true: files('xen-mapcache.c')) diff --git a/hw/xen/trace-events b/hw/xen/trace-events index 55c9e1df68..f977c7c8c6 100644 --- a/hw/xen/trace-events +++ b/hw/xen/trace-events @@ -41,3 +41,8 @@ xs_node_vprintf(char *path, char *value) "%s %s" xs_node_vscanf(char *path, char *value) "%s %s" xs_node_watch(char *path) "%s" xs_node_unwatch(char *path) "%s" + +# xen-mapcache.c +xen_map_cache(uint64_t phys_addr) "want 0x%"PRIx64 +xen_remap_bucket(uint64_t index) "index 0x%"PRIx64 +xen_map_cache_return(void* ptr) "%p" diff --git a/hw/i386/xen/xen-mapcache.c b/hw/xen/xen-mapcache.c similarity index 100% rename from hw/i386/xen/xen-mapcache.c rename to hw/xen/xen-mapcache.c --=20 2.17.1 From nobody Wed May 1 19:49:04 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1686158183; cv=pass; d=zohomail.com; s=zohoarc; b=N/tLwgJQYUNbbA4t/4WVaRFpqHITnxHgvCFdsqGMCcXtRFkS6lOqGUVBEmQ4Pd4OSEFMSTDbws/C3YOUYyAdJz/1lyyVgJvWq/dmKGUZryVJTyswrkbplz2i49kCggFZnmEXGBqJrAzY835o+izhOmp+Liqyzb8FfqcnlU7q0cg= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686158183; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=TIZ9Kqy8YjbQSlG154dbv8xge2cMSr2whayKUQPoX5U=; b=mHoZkwzWnK3u5V42cVxIKM22pi1lXdGleK65RtUCwuRdMCQRgDcUqC5R9G2q8sqkNOpgXLsGxIi7R+nt1DNmFcxdKns4O1F96xxMHs9w0ERyMoS/YyEuakmIOl+y0nNXbeKC6I/AbHv1/Mitrag/jQ6Jso7RMAggC+aWQUiydx4= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686158183806918.7945473932277; Wed, 7 Jun 2023 10:16:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6wkM-0008O8-OZ; Wed, 07 Jun 2023 13:14:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6wkL-0008Nt-IA for qemu-devel@nongnu.org; Wed, 07 Jun 2023 13:14:57 -0400 Received: from mail-dm3nam02on20625.outbound.protection.outlook.com ([2a01:111:f400:7e83::625] helo=NAM02-DM3-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6wkJ-0005tH-I3 for qemu-devel@nongnu.org; Wed, 07 Jun 2023 13:14:57 -0400 Received: from DM6PR14CA0062.namprd14.prod.outlook.com (2603:10b6:5:18f::39) by SJ2PR12MB8033.namprd12.prod.outlook.com (2603:10b6:a03:4c7::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32; Wed, 7 Jun 2023 17:14:52 +0000 Received: from CY4PEPF0000EE3D.namprd03.prod.outlook.com (2603:10b6:5:18f:cafe::75) by DM6PR14CA0062.outlook.office365.com (2603:10b6:5:18f::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.19 via Frontend Transport; Wed, 7 Jun 2023 17:14:51 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000EE3D.mail.protection.outlook.com (10.167.242.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6477.13 via Frontend Transport; Wed, 7 Jun 2023 17:14:51 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 7 Jun 2023 12:14:51 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 7 Jun 2023 12:14:50 -0500 Received: from xsjfnuv50.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Wed, 7 Jun 2023 12:14:50 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Aa2q8v3/vX8+XCnOcLhqs8dqIARgfvD8CM+KcZudHC0asylBAlRnKvw/taNlXxTHgPa5LDahgImGcwKfw0CHeE83PWueT7dawekEAOctdXCcKkMxt9NXmejjI3c8WoJdJU5JAu5UNmz/fgZEcnxEVihd8QjzewSMHV3hhX6Igrr/z+ZcCGxeBsNMfWw4SQFwrMpRq6J3foa5vpZt3PHqT3Y9b98eqJbE+xx3Q9i59c/7vYFk1GUcpYxmvvojvnVovN5EJa2qVvvSK06AAPsY1LeV1s3pRGWwUCBMdAHbzmOvMdck126r4+2pPsveEAAOFhYMPFp2g3lQV07cdjYPXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=TIZ9Kqy8YjbQSlG154dbv8xge2cMSr2whayKUQPoX5U=; b=XQIrKpx94v1YoNLeFKDivI4drqGdFU/WPyE+BFZLoqjAhOe15TWxio9qaJGTGQNIO9EW8glJcXn1wkGcRwiO0Yf5p/kdrmGJhi0+IEWwC3EiojrNt3bnDbpPsYW3iTy7kzHhUvquabUJ+KhquLNZ+yPSRjU6BXAkiTIDQbx0QvAK7FMXMArZA3ypsy4zEYKS5e/X5Aeuk3WVkqtFaSsFWAc562NSo9DWduLANdd7Fyog+bzEJXFnEtR2PyI9SFwz1Fb/LwqRsFY0sIM/j1C33GRKtrtmgXjfkHDa5zmP/9g099q8T4AdOa/GYk+ehBawnD1mDNiUjk37+l6CqkYSZw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TIZ9Kqy8YjbQSlG154dbv8xge2cMSr2whayKUQPoX5U=; b=4Du4P69VS1oJiyVQO7giGTBQCBNRFVPfWmFynrwAf3BjFT2Eoe6m4Oftz9X+GyVwPQi+o+UPMdDl7/ZuA+DnqXdhrSLa8AIgEij+jv4DY3PxFftx5knqx9bnRoo4dgBaVrKtpzzfG3euLycJKevbRdndOVylXUeuzEmea1Y5Qzw= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C From: Vikram Garhwal To: CC: , , Stefano Stabellini Subject: [QEMU][PATCH v7 02/10] hw/i386/xen: rearrange xen_hvm_init_pc Date: Wed, 7 Jun 2023 10:04:51 -0700 Message-ID: <20230607170459.14722-3-vikram.garhwal@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230607170459.14722-1-vikram.garhwal@amd.com> References: <20230607170459.14722-1-vikram.garhwal@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE3D:EE_|SJ2PR12MB8033:EE_ X-MS-Office365-Filtering-Correlation-Id: 09aa8e4c-2ff5-4e06-c5c1-08db677ab48a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LrwonVaF+Z+EfBp6MmZWPBHksKUAJF+zlf2B1blhfn19r9btywL5xwSbtkjR+ddFc+lhu5QtDX7SsHgfLub2QKLqOPjT6L5a6WiiuIBF+iJv4BCctgBwabbrLsAoLOIGmHRnjc+OHYZolGf3EHmSYU/LqisnaPAxPvShxcBdywaDNlMO/7zEzgOj2X5l4C7sEFX1IdWt0GQ3r+uwlhlusSi9lvL9mR3EzUNdvmep9kLcDQpOEfhz5NBhYVdR2uIrG7eehFhMVsYJAvD/CdkzM9wBf7+Ou2LE1dmCbk0nbrI+hkZYn/3yI0kYE0NXzAek8zoS9zmfSEiq5VIrH25dtZfYI6KsDKdeBkBuoOHXROdnK13CM50DZT8fKjPcgzuyuYam4cV3d+2ViU+XIIiz1Tz6pVd4JikjpAFW4d8Jm0kt7x5Ok2n8wORPnLZzbsqUkB/zuQg7eyYBugCgwdc3aZEtxubuVgpXuEMD1IVWiUAilxTQrYLWdD/gjIYlAf3BebkqURwm7D9Rg4Ooq6XfHoIflIKcy/I7BdETTR8X64PdOa7nf15gfCKoCaKpHOySjvYEQMgTrmHRCLw/yuyCtbsBKe/ZFwUoZMfYzkxrx9OaxFXOj4lojWxDsLADdc4GVkT4W05BhxM0+Ubyc85jpIRwsNjnI/NhkNuKq0xSOvfmGOO7S7KZghlKUMNfDl8F7fVaQQiWNdTA/igLwsfFE9kQ34QM+wdJ5rKh81f67/HjS5qAEvaSi3BGKgMLkRSq6XS9Xvui0nSPUe2byR/3fA== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(136003)(396003)(346002)(376002)(451199021)(36840700001)(46966006)(40470700004)(82310400005)(40460700003)(40480700001)(26005)(1076003)(83380400001)(47076005)(336012)(426003)(36860700001)(2616005)(186003)(36756003)(86362001)(356005)(82740400003)(81166007)(54906003)(5660300002)(44832011)(316002)(41300700001)(8676002)(8936002)(70586007)(4326008)(70206006)(6916009)(478600001)(2906002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2023 17:14:51.4627 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 09aa8e4c-2ff5-4e06-c5c1-08db677ab48a X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000EE3D.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8033 Received-SPF: softfail client-ip=2a01:111:f400:7e83::625; envelope-from=vikram.garhwal@amd.com; helo=NAM02-DM3-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1686158184616100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" In preparation to moving most of xen-hvm code to an arch-neutral location, move non IOREQ references to: - xen_get_vmport_regs_pfn - xen_suspend_notifier - xen_wakeup_notifier - xen_ram_init towards the end of the xen_hvm_init_pc() function. This is done to keep the common ioreq functions in one place which will be moved to new function in next patch in order to make it common to both x86 = and aarch64 machines. Signed-off-by: Vikram Garhwal Signed-off-by: Stefano Stabellini Reviewed-by: Paul Durrant --- hw/i386/xen/xen-hvm.c | 49 ++++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c index 56641a550e..5403ac4b89 100644 --- a/hw/i386/xen/xen-hvm.c +++ b/hw/i386/xen/xen-hvm.c @@ -1419,12 +1419,6 @@ void xen_hvm_init_pc(PCMachineState *pcms, MemoryReg= ion **ram_memory) state->exit.notify =3D xen_exit_notifier; qemu_add_exit_notifier(&state->exit); =20 - state->suspend.notify =3D xen_suspend_notifier; - qemu_register_suspend_notifier(&state->suspend); - - state->wakeup.notify =3D xen_wakeup_notifier; - qemu_register_wakeup_notifier(&state->wakeup); - /* * Register wake-up support in QMP query-current-machine API */ @@ -1435,23 +1429,6 @@ void xen_hvm_init_pc(PCMachineState *pcms, MemoryReg= ion **ram_memory) goto err; } =20 - rc =3D xen_get_vmport_regs_pfn(xen_xc, xen_domid, &ioreq_pfn); - if (!rc) { - DPRINTF("shared vmport page at pfn %lx\n", ioreq_pfn); - state->shared_vmport_page =3D - xenforeignmemory_map(xen_fmem, xen_domid, PROT_READ|PROT_WRITE, - 1, &ioreq_pfn, NULL); - if (state->shared_vmport_page =3D=3D NULL) { - error_report("map shared vmport IO page returned error %d hand= le=3D%p", - errno, xen_xc); - goto err; - } - } else if (rc !=3D -ENOSYS) { - error_report("get vmport regs pfn returned error %d, rc=3D%d", - errno, rc); - goto err; - } - /* Note: cpus is empty at this point in init */ state->cpu_by_vcpu_id =3D g_new0(CPUState *, max_cpus); =20 @@ -1490,7 +1467,6 @@ void xen_hvm_init_pc(PCMachineState *pcms, MemoryRegi= on **ram_memory) #else xen_map_cache_init(NULL, state); #endif - xen_ram_init(pcms, ms->ram_size, ram_memory); =20 qemu_add_vm_change_state_handler(xen_hvm_change_state_handler, state); =20 @@ -1511,6 +1487,31 @@ void xen_hvm_init_pc(PCMachineState *pcms, MemoryReg= ion **ram_memory) QLIST_INIT(&xen_physmap); xen_read_physmap(state); =20 + state->suspend.notify =3D xen_suspend_notifier; + qemu_register_suspend_notifier(&state->suspend); + + state->wakeup.notify =3D xen_wakeup_notifier; + qemu_register_wakeup_notifier(&state->wakeup); + + rc =3D xen_get_vmport_regs_pfn(xen_xc, xen_domid, &ioreq_pfn); + if (!rc) { + DPRINTF("shared vmport page at pfn %lx\n", ioreq_pfn); + state->shared_vmport_page =3D + xenforeignmemory_map(xen_fmem, xen_domid, PROT_READ|PROT_WRITE, + 1, &ioreq_pfn, NULL); + if (state->shared_vmport_page =3D=3D NULL) { + error_report("map shared vmport IO page returned error %d hand= le=3D%p", + errno, xen_xc); + goto err; + } + } else if (rc !=3D -ENOSYS) { + error_report("get vmport regs pfn returned error %d, rc=3D%d", + errno, rc); + goto err; + } + + xen_ram_init(pcms, ms->ram_size, ram_memory); + /* Disable ACPI build because Xen handles it */ pcms->acpi_build_enabled =3D false; =20 --=20 2.17.1 From nobody Wed May 1 19:49:04 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1686158247; cv=pass; d=zohomail.com; s=zohoarc; b=GgNSzCGGikckiMYixVNniyirSrM2KydnuK2pgp037bOiMtTzJvAF2QSMfwJQuCmWM61F0X5+DXyt3lO6RbXhQH2RMVATqZoh9fJeloDHNxjFBotD10BzBjvXcmliIdP7d5jhLPllQmWIXWx5MaSoM9xe7tdm6w/3bQY3amAa8oA= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686158247; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=z6032t0hz4fZMPB+mCAew+18CXM2wr4W6VqILRDexMc=; b=ksJMh12vdGw74I7MSSDPcSySGhd0Q+uSqNkEDw1wfuBffiQJG5gsVbEW0b58fLvRCiBraWwn/9LONxCGFIfpCH0O4G4Cv5gwRyiWmtoSyqVQhuXc1lYL270uw6RKmxget+FxjSL+K9CeOS4omTdhAKTPpq41T5QLp/kmrSGGj/s= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686158247930271.29917214398847; Wed, 7 Jun 2023 10:17:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6wkT-0008Ql-U6; Wed, 07 Jun 2023 13:15:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6wkQ-0008PS-B2 for qemu-devel@nongnu.org; Wed, 07 Jun 2023 13:15:02 -0400 Received: from mail-bn7nam10on2060e.outbound.protection.outlook.com ([2a01:111:f400:7e8a::60e] helo=NAM10-BN7-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6wkM-0005tj-N1 for qemu-devel@nongnu.org; Wed, 07 Jun 2023 13:15:01 -0400 Received: from DM6PR07CA0112.namprd07.prod.outlook.com (2603:10b6:5:330::27) by LV2PR12MB5893.namprd12.prod.outlook.com (2603:10b6:408:175::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.28; Wed, 7 Jun 2023 17:14:55 +0000 Received: from CY4PEPF0000E9CF.namprd03.prod.outlook.com (2603:10b6:5:330:cafe::cf) by DM6PR07CA0112.outlook.office365.com (2603:10b6:5:330::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33 via Frontend Transport; Wed, 7 Jun 2023 17:14:55 +0000 Received: from SATLEXMB03.amd.com (165.204.84.17) by CY4PEPF0000E9CF.mail.protection.outlook.com (10.167.241.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6477.13 via Frontend Transport; Wed, 7 Jun 2023 17:14:55 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 7 Jun 2023 12:14:51 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 7 Jun 2023 12:14:51 -0500 Received: from xsjfnuv50.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Wed, 7 Jun 2023 12:14:51 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K4oBES4jc0YaSnims81PkMRpmhqymzB2eYhO00av3IbPQ9+3oknFJiV7B1nHG9GqbK31DeYCr6XUhLJ9/Xnm1UA0VVIExJzpR2UvXuAVOvi7E+U9ZG+/pBPD3siZm90TonlZ5VP57db5OwCeKTLWYjhF1kqQ1slUnXKIlmIirilBasjYTBk87K7mZZoJT/2YgqLxY/cYQQfbeA2Jq9zYQgew+7qPVrlXrFhsLHFk5XwcYHWfEeQFEWo4zw8zBjB1jWSJrG3XNuHCcDoRPt9V4ds/rWDCDP2EBadoCkmSEIs3oMXCfbqWgn82o+4l+5g2D32xWRMQRE597AcrUU5m4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=z6032t0hz4fZMPB+mCAew+18CXM2wr4W6VqILRDexMc=; b=WTaIjFfTy4BcKSBbYbj26Edy7CY+794tPtJaLDMRyNUHLugoCLkowtlKlibF56itzjxbxjtcy2E3MAXHkxqemDBAtUgguPWlrGFFEZ8Y45GWrV6Mu1oE1wal/R0sdIsSmTfMg/qGL37e+80JroiE+6mFC8xy8R41Y+tRbBlKx7S8MCDCqGkPFhmMBGfsVCHXXeOCBKGvVTNBlw5b+ayyvOGsUm75LDdbHmHR5pvGZ1YDwvCyHHnrj6bYdXvE9Oj2N92JVfXwKqDZu7xRcmQU2SELs+giOmfM5tEsfBTc7wHz5mhBKpDLq24xzWRWap2n+e1wWnM45JDMT969yDXvZw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=z6032t0hz4fZMPB+mCAew+18CXM2wr4W6VqILRDexMc=; b=z8ZSFS7rkrq660L7JsNBBbHS6j2G4gWREyNvfMj7rTSkz/ZzgPzIGHSzk0hDm0U3bonhpl75s5cDMT5xAi6ln1mhOLuZupCKK2t+9eLwV7v+qpbxmna2jIj63aF/udwVAGzvfMgKGgyJEfz92xpbNZmsoFL8lDCDD7GUL8xTgkA= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C From: Vikram Garhwal To: CC: , , Stefano Stabellini Subject: [QEMU][PATCH v7 03/10] hw/i386/xen/xen-hvm: move x86-specific fields out of XenIOState Date: Wed, 7 Jun 2023 10:04:52 -0700 Message-ID: <20230607170459.14722-4-vikram.garhwal@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230607170459.14722-1-vikram.garhwal@amd.com> References: <20230607170459.14722-1-vikram.garhwal@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9CF:EE_|LV2PR12MB5893:EE_ X-MS-Office365-Filtering-Correlation-Id: 2baa278e-0977-445c-7faa-08db677ab6c4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HBA2G+sf5/MRW33cn21f3nQWHgKlyJuYygFPUtjiyyqQ6rdye/Ga/8dPXbah55mN+7D6y7z549Vl7P7K98RZsrQYo6kJWLqCul7LPRUSHlJZ2qKopSBG0Osk8yl9fsnEaNYD9fEHrSKbj9nTjs8MhPQgnREUu/tyaAM5X+E7PXZpOkaTEOr2Lewa9wpck02z60UuB0smorBJuVSIgiXEjrf6FOFnoRJ+7PGhXDlKC3zMe4kpVo2I45mGyjmQzX0JEgBMHC+5pSjAA2thZJ/OsSfOHkX6/O6tAzVkxTDvuaPsAgf5o88wOmr3ntqCihkwwYjefSvGF44SfNCiDwYAx9dbt2EfG/M4EaF086pybKX5vHEfwsu9nvsrqXcymrpiGaYiQHAZUq9d8d6IDlirCoVZPMo50ueEOhGaLYgYxIRGxwzFDVC+9/rveTXQBdgjH4ORRIY7X/2z5SAsKI0EVCk2o94WLP9/J/MVn4vSXNX/NunptSbpbQd/ZDyfL2q0LsuPMfsA1JYzN7HerJVpte6YoB0RzZhr0k69UZLAklF/ht2jhcQ+1EM/OZQiEjbRNng6bbPtutChA8eKX+cZUpTpB/o5c5rE1yg0Va8ugkDvaXYx+/7Dwz7zyrcn4BKuFQSw7Y+Df9mJb5P33s6uD2AyjGocDogsemFQN5cLaYN41i6hNuNYlgNLQzsloRkOuOtqnQrgG9J7TiZy8Fz8WFuE4+Wc2/Xc9bYWrXUk3BuXbBLm1u5mpiRLF+5QvlqKifKTngLxK+kBoLcrNV4F2g== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(136003)(39860400002)(346002)(396003)(376002)(451199021)(40470700004)(36840700001)(46966006)(54906003)(40460700003)(478600001)(8936002)(8676002)(44832011)(86362001)(5660300002)(36756003)(2906002)(82310400005)(40480700001)(70206006)(356005)(70586007)(316002)(81166007)(6916009)(82740400003)(4326008)(83380400001)(47076005)(66574015)(2616005)(41300700001)(26005)(1076003)(186003)(426003)(336012)(36860700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2023 17:14:55.1965 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2baa278e-0977-445c-7faa-08db677ab6c4 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000E9CF.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR12MB5893 Received-SPF: softfail client-ip=2a01:111:f400:7e8a::60e; envelope-from=vikram.garhwal@amd.com; helo=NAM10-BN7-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1686158248353100002 From: Stefano Stabellini In preparation to moving most of xen-hvm code to an arch-neutral location, = move: - shared_vmport_page - log_for_dirtybit - dirty_bitmap - suspend - wakeup out of XenIOState struct as these are only used on x86, especially the ones related to dirty logging. Updated XenIOState can be used for both aarch64 and x86. Also, remove free_phys_offset as it was unused. Signed-off-by: Stefano Stabellini Signed-off-by: Vikram Garhwal Reviewed-by: Paul Durrant Reviewed-by: Alex Benn=C3=A9e --- hw/i386/xen/xen-hvm.c | 58 ++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 31 deletions(-) diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c index 5403ac4b89..6be5a250a8 100644 --- a/hw/i386/xen/xen-hvm.c +++ b/hw/i386/xen/xen-hvm.c @@ -74,6 +74,7 @@ struct shared_vmport_iopage { }; typedef struct shared_vmport_iopage shared_vmport_iopage_t; #endif +static shared_vmport_iopage_t *shared_vmport_page; =20 static inline uint32_t xen_vcpu_eport(shared_iopage_t *shared_page, int i) { @@ -96,6 +97,11 @@ typedef struct XenPhysmap { } XenPhysmap; =20 static QLIST_HEAD(, XenPhysmap) xen_physmap; +static const XenPhysmap *log_for_dirtybit; +/* Buffer used by xen_sync_dirty_bitmap */ +static unsigned long *dirty_bitmap; +static Notifier suspend; +static Notifier wakeup; =20 typedef struct XenPciDevice { PCIDevice *pci_dev; @@ -106,7 +112,6 @@ typedef struct XenPciDevice { typedef struct XenIOState { ioservid_t ioservid; shared_iopage_t *shared_page; - shared_vmport_iopage_t *shared_vmport_page; buffered_iopage_t *buffered_io_page; xenforeignmemory_resource_handle *fres; QEMUTimer *buffered_io_timer; @@ -126,14 +131,8 @@ typedef struct XenIOState { MemoryListener io_listener; QLIST_HEAD(, XenPciDevice) dev_list; DeviceListener device_listener; - hwaddr free_phys_offset; - const XenPhysmap *log_for_dirtybit; - /* Buffer used by xen_sync_dirty_bitmap */ - unsigned long *dirty_bitmap; =20 Notifier exit; - Notifier suspend; - Notifier wakeup; } XenIOState; =20 /* Xen specific function for piix pci */ @@ -463,10 +462,10 @@ static int xen_remove_from_physmap(XenIOState *state, } =20 QLIST_REMOVE(physmap, list); - if (state->log_for_dirtybit =3D=3D physmap) { - state->log_for_dirtybit =3D NULL; - g_free(state->dirty_bitmap); - state->dirty_bitmap =3D NULL; + if (log_for_dirtybit =3D=3D physmap) { + log_for_dirtybit =3D NULL; + g_free(dirty_bitmap); + dirty_bitmap =3D NULL; } g_free(physmap); =20 @@ -627,16 +626,16 @@ static void xen_sync_dirty_bitmap(XenIOState *state, return; } =20 - if (state->log_for_dirtybit =3D=3D NULL) { - state->log_for_dirtybit =3D physmap; - state->dirty_bitmap =3D g_new(unsigned long, bitmap_size); - } else if (state->log_for_dirtybit !=3D physmap) { + if (log_for_dirtybit =3D=3D NULL) { + log_for_dirtybit =3D physmap; + dirty_bitmap =3D g_new(unsigned long, bitmap_size); + } else if (log_for_dirtybit !=3D physmap) { /* Only one range for dirty bitmap can be tracked. */ return; } =20 rc =3D xen_track_dirty_vram(xen_domid, start_addr >> TARGET_PAGE_BITS, - npages, state->dirty_bitmap); + npages, dirty_bitmap); if (rc < 0) { #ifndef ENODATA #define ENODATA ENOENT @@ -651,7 +650,7 @@ static void xen_sync_dirty_bitmap(XenIOState *state, } =20 for (i =3D 0; i < bitmap_size; i++) { - unsigned long map =3D state->dirty_bitmap[i]; + unsigned long map =3D dirty_bitmap[i]; while (map !=3D 0) { j =3D ctzl(map); map &=3D ~(1ul << j); @@ -677,12 +676,10 @@ static void xen_log_start(MemoryListener *listener, static void xen_log_stop(MemoryListener *listener, MemoryRegionSection *se= ction, int old, int new) { - XenIOState *state =3D container_of(listener, XenIOState, memory_listen= er); - if (old & ~new & (1 << DIRTY_MEMORY_VGA)) { - state->log_for_dirtybit =3D NULL; - g_free(state->dirty_bitmap); - state->dirty_bitmap =3D NULL; + log_for_dirtybit =3D NULL; + g_free(dirty_bitmap); + dirty_bitmap =3D NULL; /* Disable dirty bit tracking */ xen_track_dirty_vram(xen_domid, 0, 0, NULL); } @@ -1022,9 +1019,9 @@ static void handle_vmport_ioreq(XenIOState *state, io= req_t *req) { vmware_regs_t *vmport_regs; =20 - assert(state->shared_vmport_page); + assert(shared_vmport_page); vmport_regs =3D - &state->shared_vmport_page->vcpu_vmport_regs[state->send_vcpu]; + &shared_vmport_page->vcpu_vmport_regs[state->send_vcpu]; QEMU_BUILD_BUG_ON(sizeof(*req) < sizeof(*vmport_regs)); =20 current_cpu =3D state->cpu_by_vcpu_id[state->send_vcpu]; @@ -1472,7 +1469,6 @@ void xen_hvm_init_pc(PCMachineState *pcms, MemoryRegi= on **ram_memory) =20 state->memory_listener =3D xen_memory_listener; memory_listener_register(&state->memory_listener, &address_space_memor= y); - state->log_for_dirtybit =3D NULL; =20 state->io_listener =3D xen_io_listener; memory_listener_register(&state->io_listener, &address_space_io); @@ -1487,19 +1483,19 @@ void xen_hvm_init_pc(PCMachineState *pcms, MemoryRe= gion **ram_memory) QLIST_INIT(&xen_physmap); xen_read_physmap(state); =20 - state->suspend.notify =3D xen_suspend_notifier; - qemu_register_suspend_notifier(&state->suspend); + suspend.notify =3D xen_suspend_notifier; + qemu_register_suspend_notifier(&suspend); =20 - state->wakeup.notify =3D xen_wakeup_notifier; - qemu_register_wakeup_notifier(&state->wakeup); + wakeup.notify =3D xen_wakeup_notifier; + qemu_register_wakeup_notifier(&wakeup); =20 rc =3D xen_get_vmport_regs_pfn(xen_xc, xen_domid, &ioreq_pfn); if (!rc) { DPRINTF("shared vmport page at pfn %lx\n", ioreq_pfn); - state->shared_vmport_page =3D + shared_vmport_page =3D xenforeignmemory_map(xen_fmem, xen_domid, PROT_READ|PROT_WRITE, 1, &ioreq_pfn, NULL); - if (state->shared_vmport_page =3D=3D NULL) { + if (shared_vmport_page =3D=3D NULL) { error_report("map shared vmport IO page returned error %d hand= le=3D%p", errno, xen_xc); goto err; --=20 2.17.1 From nobody Wed May 1 19:49:04 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1686158284; cv=pass; d=zohomail.com; s=zohoarc; b=g2mr+pAXnB9R/4MmoFJWy75GFR+wUJHr8Pf4SQ8uBFPSrjFYAnOrLiH+5j8Xa7TFiWyL5p49vEpDb1CRFnb4f1HuugAmLRybY8y8ReZCyOXN303r2R7RYj4wvB9vp84MLY426GTl4ybwWe/xTpgfIpxfwRQQLyTDwAjwh5sWBho= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686158284; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FGDgSR8DWoYW38MFryklT5/aoUjRUXECmptCj+9wK1w=; b=RT3yN8Rvr2vo1UEXKA8xi8m4YGdvRfB2uR5HUy014H6/Gt+yWM10XkRN4zgFVQ1ThLZqtF/hDkTwvfvpu39wrrRN1Hu/lBG1MLoFgrqvze9U5GqOdAWtNvEUEo9mQYOiODicHD3WfDsOlxUv0ky3LBEaBXucDX5AMnfk9vgfAtM= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686158284341781.5075432221555; Wed, 7 Jun 2023 10:18:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6wkU-0008Qm-GE; Wed, 07 Jun 2023 13:15:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6wkS-0008QD-Ey for qemu-devel@nongnu.org; Wed, 07 Jun 2023 13:15:04 -0400 Received: from mail-bn8nam12on20629.outbound.protection.outlook.com ([2a01:111:f400:fe5b::629] helo=NAM12-BN8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6wkM-0005th-JW for qemu-devel@nongnu.org; Wed, 07 Jun 2023 13:15:04 -0400 Received: from CY5PR19CA0069.namprd19.prod.outlook.com (2603:10b6:930:69::15) by SJ1PR12MB6220.namprd12.prod.outlook.com (2603:10b6:a03:455::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.36; Wed, 7 Jun 2023 17:14:53 +0000 Received: from CY4PEPF0000EE39.namprd03.prod.outlook.com (2603:10b6:930:69:cafe::59) by CY5PR19CA0069.outlook.office365.com (2603:10b6:930:69::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.19 via Frontend Transport; Wed, 7 Jun 2023 17:14:53 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000EE39.mail.protection.outlook.com (10.167.242.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6477.13 via Frontend Transport; Wed, 7 Jun 2023 17:14:53 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 7 Jun 2023 12:14:52 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 7 Jun 2023 12:14:52 -0500 Received: from xsjfnuv50.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Wed, 7 Jun 2023 12:14:51 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gjijEv1bCg5CNs2BcFn83/8YSyDE7+hmukUQ2WpnZ1suKo3f9MqViSurDTj/hZJjxNVFOE4i7PySVsGMEZoeyAhCISWOvciOxPzpK9t+UNVAKLMADHN2DTIB29DWVVLX00vvsQjujsOPcEHDz5IDurlHrCg61FEhbwGj3SsQP2UdZDT9UhD4qPO2bGgJDQtjmmxJY8BJZ5YbSj36XVdeyRZoP/14oXrztrcgHjcn6Wzmwojfnc1zCyAW5AlILzvna1WzFEK2a4TlImElZ001P0VcF5xzgwRcTZ3ATYK+h9kk/fsm+QKj3/Z7BXnqVlSowwW77H4U46lgt4pWtODFfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FGDgSR8DWoYW38MFryklT5/aoUjRUXECmptCj+9wK1w=; b=Hwut3gJwMEkhBreRlkzRjEmvqDWQQdNJWHADKaAP9dEF1x9yDnjvibMMbw7/V3o0I0D/stZFB+m48kLUaQHzZO5UnqTEbItPJ9YeNKDfxN6OXD53tECQBS1zzaDJOhY29gCRZE9B7JsnoF1aZlR0WgiNXtV6gDBIQOazLiCaZlj1d8+yGa1/AiN60gQmrIuSJ5s9/FXbjU0XAa8YHkYOg/6qGoKdwa23aFrjbBa+qQXnnHggz9kCkOMUSySuhqmQbFVS6ZQZ7+Wpvon57JlIPQauXIsdsChuaJRWHVe5B2xiZg075FMP9N6xmoh2sZmvRhrh6Yt/HV4k2sqwho4stw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FGDgSR8DWoYW38MFryklT5/aoUjRUXECmptCj+9wK1w=; b=MB1vGl/z7a5os1bvjQ6z1z3HM4Gu+2o4KivceqQ7ksS7M9c5jWalYdFapwPJ7jyRHDz3GSNDi7MtDDVGKjOGPBUlw1x7rj4IvA5YUljg4URw70MqwEAprK4Zk7Udb0BASHKSz9teilKOWrrJ7Ubr4UoG3xJhXzu7PT2zE1BMG8o= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C From: Vikram Garhwal To: CC: , , Stefano Stabellini Subject: [QEMU][PATCH v7 04/10] xen-hvm: reorganize xen-hvm and move common function to xen-hvm-common Date: Wed, 7 Jun 2023 10:04:53 -0700 Message-ID: <20230607170459.14722-5-vikram.garhwal@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230607170459.14722-1-vikram.garhwal@amd.com> References: <20230607170459.14722-1-vikram.garhwal@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE39:EE_|SJ1PR12MB6220:EE_ X-MS-Office365-Filtering-Correlation-Id: dbe987cd-5536-4a72-0f2a-08db677ab58f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oE7AHP81nuqW9ibiPfJ3K1CfU914l4EFA/19XfZ14/ojd5Cw4sNf4iuwX2CrQ1F37JUe3gUtP6mHuPsMrPPLI9cxPwykFoe3mxUXYMZP/+kty3kN6s2gWjFgqfeQxzCwG3yfMMgIp6JPrvtcklCugHzGbgo4rz0UXwTrEbqKrZPQYOvCT50aUrOEZKamWnCSe0v8Ki5L9WqQcn43CcYrCggDElcrgorrZK/1taWtLVDQbCBmtwZb689mMKrQzBNIebfJzLE3/7a43MBPCjC36hC6NpwK66jQkPRGV1yhcCr8OOVwGokXFSVfCZe/E9hldyQZnlx/w3mRvhuoA9z6SCm13EwMmB5pSi7igM54Os30CPQY1vc5T4B8O7LKakDCF+fKiWY4Mh7mmn7r0QkB0qzCqJ8tiNXrUCmol7CGlXVm7kjMEXkmgn2W1X4etFmu4qpMWkrnTzMI+jvuOx2VGT3aqtCKXDbh+JQ6L0evcG1UefbbXlStaeVAVqBMG8/NG6/fOmr5Y2K+MdobNnWRqfAmlCk+vas+X/nyQm9mJDuqsjAZWHUGVHQ4e6mz2uyIcHTmQanyy1hjEYWpIGuvVB+WXX255OupoXHzwtYOfLmHRmca16/pUXVhFSrfgN3iii0eIMddsu0MIlPhw8TTnfdwL6MqkTP/hhDroJ0xoO+p7h4ARMFb79JVaDK40iXup6gw11hOIyAvD4nni/RR0/emlX24hzb3FD+gtHoULAXntvtWvylfnZvGbKG7hNtSv+Vb1KZrb5hxk2xcPfhYjQ== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(396003)(39860400002)(376002)(346002)(136003)(451199021)(40470700004)(36840700001)(46966006)(41300700001)(36756003)(40480700001)(8936002)(8676002)(5660300002)(44832011)(54906003)(6916009)(70586007)(70206006)(4326008)(316002)(30864003)(478600001)(40460700003)(2906002)(82310400005)(1076003)(26005)(186003)(83380400001)(47076005)(36860700001)(336012)(426003)(2616005)(356005)(81166007)(86362001)(82740400003)(36900700001)(559001)(579004); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2023 17:14:53.1686 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dbe987cd-5536-4a72-0f2a-08db677ab58f X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000EE39.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR12MB6220 Received-SPF: softfail client-ip=2a01:111:f400:fe5b::629; envelope-from=vikram.garhwal@amd.com; helo=NAM12-BN8-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1686158285964100003 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Stefano Stabellini This patch does following: 1. creates arch_handle_ioreq() and arch_xen_set_memory(). This is done in preparation for moving most of xen-hvm code to an arch-neutral location, move the x86-specific portion of xen_set_memory to arch_xen_set_memory. Also, move handle_vmport_ioreq to arch_handle_ioreq. 2. Pure code movement: move common functions to hw/xen/xen-hvm-common.c Extract common functionalities from hw/i386/xen/xen-hvm.c and move them= to hw/xen/xen-hvm-common.c. These common functions are useful for creating an IOREQ server. xen_hvm_init_pc() contains the architecture independent code for creati= ng and mapping a IOREQ server, connecting memory and IO listeners, initial= izing a xen bus and registering backends. Moved this common xen code to a new function xen_register_ioreq() which can be used by both x86 and ARM mac= hines. Following functions are moved to hw/xen/xen-hvm-common.c: xen_vcpu_eport(), xen_vcpu_ioreq(), xen_ram_alloc(), xen_set_memory= (), xen_region_add(), xen_region_del(), xen_io_add(), xen_io_del(), xen_device_realize(), xen_device_unrealize(), cpu_get_ioreq_from_shared_memory(), cpu_get_ioreq(), do_inp(), do_outp(), rw_phys_req_item(), read_phys_req_item(), write_phys_req_item(), cpu_ioreq_pio(), cpu_ioreq_move(), cpu_ioreq_config(), handle_ioreq(), handle_buffered_iopage(), handle_buffered_io(), cpu_handle_ioreq(), xen_main_loop_prepare(), xen_hvm_change_state_handler(), xen_exit_notifier(), xen_map_ioreq_server(), destroy_hvm_domain() and xen_shutdown_fatal_error() 3. Removed static type from below functions: 1. xen_region_add() 2. xen_region_del() 3. xen_io_add() 4. xen_io_del() 5. xen_device_realize() 6. xen_device_unrealize() 7. xen_hvm_change_state_handler() 8. cpu_ioreq_pio() 9. xen_exit_notifier() 4. Replace TARGET_PAGE_SIZE with XC_PAGE_SIZE to match the page side with X= en. Signed-off-by: Vikram Garhwal Signed-off-by: Stefano Stabellini --- hw/i386/xen/trace-events | 14 - hw/i386/xen/xen-hvm.c | 1016 ++----------------------------- hw/xen/meson.build | 5 +- hw/xen/trace-events | 14 + hw/xen/xen-hvm-common.c | 860 ++++++++++++++++++++++++++ include/hw/i386/xen_arch_hvm.h | 11 + include/hw/xen/arch_hvm.h | 3 + include/hw/xen/xen-hvm-common.h | 99 +++ 8 files changed, 1054 insertions(+), 968 deletions(-) create mode 100644 hw/xen/xen-hvm-common.c create mode 100644 include/hw/i386/xen_arch_hvm.h create mode 100644 include/hw/xen/arch_hvm.h create mode 100644 include/hw/xen/xen-hvm-common.h diff --git a/hw/i386/xen/trace-events b/hw/i386/xen/trace-events index a0c89d91c4..5d0a8d6dcf 100644 --- a/hw/i386/xen/trace-events +++ b/hw/i386/xen/trace-events @@ -7,17 +7,3 @@ xen_platform_log(char *s) "xen platform: %s" xen_pv_mmio_read(uint64_t addr) "WARNING: read from Xen PV Device MMIO spa= ce (address 0x%"PRIx64")" xen_pv_mmio_write(uint64_t addr) "WARNING: write to Xen PV Device MMIO spa= ce (address 0x%"PRIx64")" =20 -# xen-hvm.c -xen_ram_alloc(unsigned long ram_addr, unsigned long size) "requested: 0x%l= x, size 0x%lx" -xen_client_set_memory(uint64_t start_addr, unsigned long size, bool log_di= rty) "0x%"PRIx64" size 0x%lx, log_dirty %i" -handle_ioreq(void *req, uint32_t type, uint32_t dir, uint32_t df, uint32_t= data_is_ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) = "I/O=3D%p type=3D%d dir=3D%d df=3D%d ptr=3D%d port=3D0x%"PRIx64" data=3D0x%= "PRIx64" count=3D%d size=3D%d" -handle_ioreq_read(void *req, uint32_t type, uint32_t df, uint32_t data_is_= ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O=3D%p= read type=3D%d df=3D%d ptr=3D%d port=3D0x%"PRIx64" data=3D0x%"PRIx64" coun= t=3D%d size=3D%d" -handle_ioreq_write(void *req, uint32_t type, uint32_t df, uint32_t data_is= _ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O=3D%= p write type=3D%d df=3D%d ptr=3D%d port=3D0x%"PRIx64" data=3D0x%"PRIx64" co= unt=3D%d size=3D%d" -cpu_ioreq_pio(void *req, uint32_t dir, uint32_t df, uint32_t data_is_ptr, = uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O=3D%p pio = dir=3D%d df=3D%d ptr=3D%d port=3D0x%"PRIx64" data=3D0x%"PRIx64" count=3D%d = size=3D%d" -cpu_ioreq_pio_read_reg(void *req, uint64_t data, uint64_t addr, uint32_t s= ize) "I/O=3D%p pio read reg data=3D0x%"PRIx64" port=3D0x%"PRIx64" size=3D%d" -cpu_ioreq_pio_write_reg(void *req, uint64_t data, uint64_t addr, uint32_t = size) "I/O=3D%p pio write reg data=3D0x%"PRIx64" port=3D0x%"PRIx64" size=3D= %d" -cpu_ioreq_move(void *req, uint32_t dir, uint32_t df, uint32_t data_is_ptr,= uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O=3D%p cop= y dir=3D%d df=3D%d ptr=3D%d port=3D0x%"PRIx64" data=3D0x%"PRIx64" count=3D%= d size=3D%d" -xen_map_resource_ioreq(uint32_t id, void *addr) "id: %u addr: %p" -cpu_ioreq_config_read(void *req, uint32_t sbdf, uint32_t reg, uint32_t siz= e, uint32_t data) "I/O=3D%p sbdf=3D0x%x reg=3D%u size=3D%u data=3D0x%x" -cpu_ioreq_config_write(void *req, uint32_t sbdf, uint32_t reg, uint32_t si= ze, uint32_t data) "I/O=3D%p sbdf=3D0x%x reg=3D%u size=3D%u data=3D0x%x" - diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c index 6be5a250a8..a1ff5be4e1 100644 --- a/hw/i386/xen/xen-hvm.c +++ b/hw/i386/xen/xen-hvm.c @@ -10,43 +10,21 @@ =20 #include "qemu/osdep.h" #include "qemu/units.h" +#include "qapi/error.h" +#include "qapi/qapi-commands-migration.h" +#include "trace.h" =20 -#include "cpu.h" -#include "hw/pci/pci.h" -#include "hw/pci/pci_host.h" #include "hw/i386/pc.h" #include "hw/irq.h" -#include "hw/hw.h" #include "hw/i386/apic-msidef.h" -#include "hw/xen/xen_native.h" -#include "hw/xen/xen-legacy-backend.h" -#include "hw/xen/xen-bus.h" #include "hw/xen/xen-x86.h" -#include "qapi/error.h" -#include "qapi/qapi-commands-migration.h" -#include "qemu/error-report.h" -#include "qemu/main-loop.h" #include "qemu/range.h" -#include "sysemu/runstate.h" -#include "sysemu/sysemu.h" -#include "sysemu/xen.h" -#include "sysemu/xen-mapcache.h" -#include "trace.h" =20 -#include +#include "hw/xen/xen-hvm-common.h" +#include "hw/xen/arch_hvm.h" #include =20 -//#define DEBUG_XEN_HVM - -#ifdef DEBUG_XEN_HVM -#define DPRINTF(fmt, ...) \ - do { fprintf(stderr, "xen: " fmt, ## __VA_ARGS__); } while (0) -#else -#define DPRINTF(fmt, ...) \ - do { } while (0) -#endif - -static MemoryRegion ram_memory, ram_640k, ram_lo, ram_hi; +static MemoryRegion ram_640k, ram_lo, ram_hi; static MemoryRegion *framebuffer; static bool xen_in_migration; =20 @@ -74,27 +52,8 @@ struct shared_vmport_iopage { }; typedef struct shared_vmport_iopage shared_vmport_iopage_t; #endif -static shared_vmport_iopage_t *shared_vmport_page; =20 -static inline uint32_t xen_vcpu_eport(shared_iopage_t *shared_page, int i) -{ - return shared_page->vcpu_ioreq[i].vp_eport; -} -static inline ioreq_t *xen_vcpu_ioreq(shared_iopage_t *shared_page, int vc= pu) -{ - return &shared_page->vcpu_ioreq[vcpu]; -} - -#define BUFFER_IO_MAX_DELAY 100 - -typedef struct XenPhysmap { - hwaddr start_addr; - ram_addr_t size; - const char *name; - hwaddr phys_offset; - - QLIST_ENTRY(XenPhysmap) list; -} XenPhysmap; +static shared_vmport_iopage_t *shared_vmport_page; =20 static QLIST_HEAD(, XenPhysmap) xen_physmap; static const XenPhysmap *log_for_dirtybit; @@ -103,38 +62,6 @@ static unsigned long *dirty_bitmap; static Notifier suspend; static Notifier wakeup; =20 -typedef struct XenPciDevice { - PCIDevice *pci_dev; - uint32_t sbdf; - QLIST_ENTRY(XenPciDevice) entry; -} XenPciDevice; - -typedef struct XenIOState { - ioservid_t ioservid; - shared_iopage_t *shared_page; - buffered_iopage_t *buffered_io_page; - xenforeignmemory_resource_handle *fres; - QEMUTimer *buffered_io_timer; - CPUState **cpu_by_vcpu_id; - /* the evtchn port for polling the notification, */ - evtchn_port_t *ioreq_local_port; - /* evtchn remote and local ports for buffered io */ - evtchn_port_t bufioreq_remote_port; - evtchn_port_t bufioreq_local_port; - /* the evtchn fd for polling */ - xenevtchn_handle *xce_handle; - /* which vcpu we are serving */ - int send_vcpu; - - struct xs_handle *xenstore; - MemoryListener memory_listener; - MemoryListener io_listener; - QLIST_HEAD(, XenPciDevice) dev_list; - DeviceListener device_listener; - - Notifier exit; -} XenIOState; - /* Xen specific function for piix pci */ =20 int xen_pci_slot_get_pirq(PCIDevice *pci_dev, int irq_num) @@ -247,42 +174,6 @@ static void xen_ram_init(PCMachineState *pcms, } } =20 -void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size, MemoryRegion *mr, - Error **errp) -{ - unsigned long nr_pfn; - xen_pfn_t *pfn_list; - int i; - - if (runstate_check(RUN_STATE_INMIGRATE)) { - /* RAM already populated in Xen */ - fprintf(stderr, "%s: do not alloc "RAM_ADDR_FMT - " bytes of ram at "RAM_ADDR_FMT" when runstate is INMIGRAT= E\n", - __func__, size, ram_addr); - return; - } - - if (mr =3D=3D &ram_memory) { - return; - } - - trace_xen_ram_alloc(ram_addr, size); - - nr_pfn =3D size >> TARGET_PAGE_BITS; - pfn_list =3D g_malloc(sizeof (*pfn_list) * nr_pfn); - - for (i =3D 0; i < nr_pfn; i++) { - pfn_list[i] =3D (ram_addr >> TARGET_PAGE_BITS) + i; - } - - if (xc_domain_populate_physmap_exact(xen_xc, xen_domid, nr_pfn, 0, 0, = pfn_list)) { - error_setg(errp, "xen: failed to populate ram at " RAM_ADDR_FMT, - ram_addr); - } - - g_free(pfn_list); -} - static XenPhysmap *get_physmapping(hwaddr start_addr, ram_addr_t size) { XenPhysmap *physmap =3D NULL; @@ -472,144 +363,6 @@ static int xen_remove_from_physmap(XenIOState *state, return 0; } =20 -static void xen_set_memory(struct MemoryListener *listener, - MemoryRegionSection *section, - bool add) -{ - XenIOState *state =3D container_of(listener, XenIOState, memory_listen= er); - hwaddr start_addr =3D section->offset_within_address_space; - ram_addr_t size =3D int128_get64(section->size); - bool log_dirty =3D memory_region_is_logging(section->mr, DIRTY_MEMORY_= VGA); - hvmmem_type_t mem_type; - - if (section->mr =3D=3D &ram_memory) { - return; - } else { - if (add) { - xen_map_memory_section(xen_domid, state->ioservid, - section); - } else { - xen_unmap_memory_section(xen_domid, state->ioservid, - section); - } - } - - if (!memory_region_is_ram(section->mr)) { - return; - } - - if (log_dirty !=3D add) { - return; - } - - trace_xen_client_set_memory(start_addr, size, log_dirty); - - start_addr &=3D TARGET_PAGE_MASK; - size =3D TARGET_PAGE_ALIGN(size); - - if (add) { - if (!memory_region_is_rom(section->mr)) { - xen_add_to_physmap(state, start_addr, size, - section->mr, section->offset_within_region); - } else { - mem_type =3D HVMMEM_ram_ro; - if (xen_set_mem_type(xen_domid, mem_type, - start_addr >> TARGET_PAGE_BITS, - size >> TARGET_PAGE_BITS)) { - DPRINTF("xen_set_mem_type error, addr: "HWADDR_FMT_plx"\n", - start_addr); - } - } - } else { - if (xen_remove_from_physmap(state, start_addr, size) < 0) { - DPRINTF("physmapping does not exist at "HWADDR_FMT_plx"\n", st= art_addr); - } - } -} - -static void xen_region_add(MemoryListener *listener, - MemoryRegionSection *section) -{ - memory_region_ref(section->mr); - xen_set_memory(listener, section, true); -} - -static void xen_region_del(MemoryListener *listener, - MemoryRegionSection *section) -{ - xen_set_memory(listener, section, false); - memory_region_unref(section->mr); -} - -static void xen_io_add(MemoryListener *listener, - MemoryRegionSection *section) -{ - XenIOState *state =3D container_of(listener, XenIOState, io_listener); - MemoryRegion *mr =3D section->mr; - - if (mr->ops =3D=3D &unassigned_io_ops) { - return; - } - - memory_region_ref(mr); - - xen_map_io_section(xen_domid, state->ioservid, section); -} - -static void xen_io_del(MemoryListener *listener, - MemoryRegionSection *section) -{ - XenIOState *state =3D container_of(listener, XenIOState, io_listener); - MemoryRegion *mr =3D section->mr; - - if (mr->ops =3D=3D &unassigned_io_ops) { - return; - } - - xen_unmap_io_section(xen_domid, state->ioservid, section); - - memory_region_unref(mr); -} - -static void xen_device_realize(DeviceListener *listener, - DeviceState *dev) -{ - XenIOState *state =3D container_of(listener, XenIOState, device_listen= er); - - if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) { - PCIDevice *pci_dev =3D PCI_DEVICE(dev); - XenPciDevice *xendev =3D g_new(XenPciDevice, 1); - - xendev->pci_dev =3D pci_dev; - xendev->sbdf =3D PCI_BUILD_BDF(pci_dev_bus_num(pci_dev), - pci_dev->devfn); - QLIST_INSERT_HEAD(&state->dev_list, xendev, entry); - - xen_map_pcidev(xen_domid, state->ioservid, pci_dev); - } -} - -static void xen_device_unrealize(DeviceListener *listener, - DeviceState *dev) -{ - XenIOState *state =3D container_of(listener, XenIOState, device_listen= er); - - if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) { - PCIDevice *pci_dev =3D PCI_DEVICE(dev); - XenPciDevice *xendev, *next; - - xen_unmap_pcidev(xen_domid, state->ioservid, pci_dev); - - QLIST_FOREACH_SAFE(xendev, &state->dev_list, entry, next) { - if (xendev->pci_dev =3D=3D pci_dev) { - QLIST_REMOVE(xendev, entry); - g_free(xendev); - break; - } - } - } -} - static void xen_sync_dirty_bitmap(XenIOState *state, hwaddr start_addr, ram_addr_t size) @@ -717,277 +470,6 @@ static MemoryListener xen_memory_listener =3D { .priority =3D 10, }; =20 -static MemoryListener xen_io_listener =3D { - .name =3D "xen-io", - .region_add =3D xen_io_add, - .region_del =3D xen_io_del, - .priority =3D 10, -}; - -static DeviceListener xen_device_listener =3D { - .realize =3D xen_device_realize, - .unrealize =3D xen_device_unrealize, -}; - -/* get the ioreq packets from share mem */ -static ioreq_t *cpu_get_ioreq_from_shared_memory(XenIOState *state, int vc= pu) -{ - ioreq_t *req =3D xen_vcpu_ioreq(state->shared_page, vcpu); - - if (req->state !=3D STATE_IOREQ_READY) { - DPRINTF("I/O request not ready: " - "%x, ptr: %x, port: %"PRIx64", " - "data: %"PRIx64", count: %u, size: %u\n", - req->state, req->data_is_ptr, req->addr, - req->data, req->count, req->size); - return NULL; - } - - xen_rmb(); /* see IOREQ_READY /then/ read contents of ioreq */ - - req->state =3D STATE_IOREQ_INPROCESS; - return req; -} - -/* use poll to get the port notification */ -/* ioreq_vec--out,the */ -/* retval--the number of ioreq packet */ -static ioreq_t *cpu_get_ioreq(XenIOState *state) -{ - MachineState *ms =3D MACHINE(qdev_get_machine()); - unsigned int max_cpus =3D ms->smp.max_cpus; - int i; - evtchn_port_t port; - - port =3D qemu_xen_evtchn_pending(state->xce_handle); - if (port =3D=3D state->bufioreq_local_port) { - timer_mod(state->buffered_io_timer, - BUFFER_IO_MAX_DELAY + qemu_clock_get_ms(QEMU_CLOCK_REALTIM= E)); - return NULL; - } - - if (port !=3D -1) { - for (i =3D 0; i < max_cpus; i++) { - if (state->ioreq_local_port[i] =3D=3D port) { - break; - } - } - - if (i =3D=3D max_cpus) { - hw_error("Fatal error while trying to get io event!\n"); - } - - /* unmask the wanted port again */ - qemu_xen_evtchn_unmask(state->xce_handle, port); - - /* get the io packet from shared memory */ - state->send_vcpu =3D i; - return cpu_get_ioreq_from_shared_memory(state, i); - } - - /* read error or read nothing */ - return NULL; -} - -static uint32_t do_inp(uint32_t addr, unsigned long size) -{ - switch (size) { - case 1: - return cpu_inb(addr); - case 2: - return cpu_inw(addr); - case 4: - return cpu_inl(addr); - default: - hw_error("inp: bad size: %04x %lx", addr, size); - } -} - -static void do_outp(uint32_t addr, - unsigned long size, uint32_t val) -{ - switch (size) { - case 1: - return cpu_outb(addr, val); - case 2: - return cpu_outw(addr, val); - case 4: - return cpu_outl(addr, val); - default: - hw_error("outp: bad size: %04x %lx", addr, size); - } -} - -/* - * Helper functions which read/write an object from/to physical guest - * memory, as part of the implementation of an ioreq. - * - * Equivalent to - * cpu_physical_memory_rw(addr + (req->df ? -1 : +1) * req->size * i, - * val, req->size, 0/1) - * except without the integer overflow problems. - */ -static void rw_phys_req_item(hwaddr addr, - ioreq_t *req, uint32_t i, void *val, int rw) -{ - /* Do everything unsigned so overflow just results in a truncated resu= lt - * and accesses to undesired parts of guest memory, which is up - * to the guest */ - hwaddr offset =3D (hwaddr)req->size * i; - if (req->df) { - addr -=3D offset; - } else { - addr +=3D offset; - } - cpu_physical_memory_rw(addr, val, req->size, rw); -} - -static inline void read_phys_req_item(hwaddr addr, - ioreq_t *req, uint32_t i, void *val) -{ - rw_phys_req_item(addr, req, i, val, 0); -} -static inline void write_phys_req_item(hwaddr addr, - ioreq_t *req, uint32_t i, void *val) -{ - rw_phys_req_item(addr, req, i, val, 1); -} - - -static void cpu_ioreq_pio(ioreq_t *req) -{ - uint32_t i; - - trace_cpu_ioreq_pio(req, req->dir, req->df, req->data_is_ptr, req->add= r, - req->data, req->count, req->size); - - if (req->size > sizeof(uint32_t)) { - hw_error("PIO: bad size (%u)", req->size); - } - - if (req->dir =3D=3D IOREQ_READ) { - if (!req->data_is_ptr) { - req->data =3D do_inp(req->addr, req->size); - trace_cpu_ioreq_pio_read_reg(req, req->data, req->addr, - req->size); - } else { - uint32_t tmp; - - for (i =3D 0; i < req->count; i++) { - tmp =3D do_inp(req->addr, req->size); - write_phys_req_item(req->data, req, i, &tmp); - } - } - } else if (req->dir =3D=3D IOREQ_WRITE) { - if (!req->data_is_ptr) { - trace_cpu_ioreq_pio_write_reg(req, req->data, req->addr, - req->size); - do_outp(req->addr, req->size, req->data); - } else { - for (i =3D 0; i < req->count; i++) { - uint32_t tmp =3D 0; - - read_phys_req_item(req->data, req, i, &tmp); - do_outp(req->addr, req->size, tmp); - } - } - } -} - -static void cpu_ioreq_move(ioreq_t *req) -{ - uint32_t i; - - trace_cpu_ioreq_move(req, req->dir, req->df, req->data_is_ptr, req->ad= dr, - req->data, req->count, req->size); - - if (req->size > sizeof(req->data)) { - hw_error("MMIO: bad size (%u)", req->size); - } - - if (!req->data_is_ptr) { - if (req->dir =3D=3D IOREQ_READ) { - for (i =3D 0; i < req->count; i++) { - read_phys_req_item(req->addr, req, i, &req->data); - } - } else if (req->dir =3D=3D IOREQ_WRITE) { - for (i =3D 0; i < req->count; i++) { - write_phys_req_item(req->addr, req, i, &req->data); - } - } - } else { - uint64_t tmp; - - if (req->dir =3D=3D IOREQ_READ) { - for (i =3D 0; i < req->count; i++) { - read_phys_req_item(req->addr, req, i, &tmp); - write_phys_req_item(req->data, req, i, &tmp); - } - } else if (req->dir =3D=3D IOREQ_WRITE) { - for (i =3D 0; i < req->count; i++) { - read_phys_req_item(req->data, req, i, &tmp); - write_phys_req_item(req->addr, req, i, &tmp); - } - } - } -} - -static void cpu_ioreq_config(XenIOState *state, ioreq_t *req) -{ - uint32_t sbdf =3D req->addr >> 32; - uint32_t reg =3D req->addr; - XenPciDevice *xendev; - - if (req->size !=3D sizeof(uint8_t) && req->size !=3D sizeof(uint16_t) = && - req->size !=3D sizeof(uint32_t)) { - hw_error("PCI config access: bad size (%u)", req->size); - } - - if (req->count !=3D 1) { - hw_error("PCI config access: bad count (%u)", req->count); - } - - QLIST_FOREACH(xendev, &state->dev_list, entry) { - if (xendev->sbdf !=3D sbdf) { - continue; - } - - if (!req->data_is_ptr) { - if (req->dir =3D=3D IOREQ_READ) { - req->data =3D pci_host_config_read_common( - xendev->pci_dev, reg, PCI_CONFIG_SPACE_SIZE, - req->size); - trace_cpu_ioreq_config_read(req, xendev->sbdf, reg, - req->size, req->data); - } else if (req->dir =3D=3D IOREQ_WRITE) { - trace_cpu_ioreq_config_write(req, xendev->sbdf, reg, - req->size, req->data); - pci_host_config_write_common( - xendev->pci_dev, reg, PCI_CONFIG_SPACE_SIZE, - req->data, req->size); - } - } else { - uint32_t tmp; - - if (req->dir =3D=3D IOREQ_READ) { - tmp =3D pci_host_config_read_common( - xendev->pci_dev, reg, PCI_CONFIG_SPACE_SIZE, - req->size); - trace_cpu_ioreq_config_read(req, xendev->sbdf, reg, - req->size, tmp); - write_phys_req_item(req->data, req, 0, &tmp); - } else if (req->dir =3D=3D IOREQ_WRITE) { - read_phys_req_item(req->data, req, 0, &tmp); - trace_cpu_ioreq_config_write(req, xendev->sbdf, reg, - req->size, tmp); - pci_host_config_write_common( - xendev->pci_dev, reg, PCI_CONFIG_SPACE_SIZE, - tmp, req->size); - } - } - } -} - static void regs_to_cpu(vmware_regs_t *vmport_regs, ioreq_t *req) { X86CPU *cpu; @@ -1031,226 +513,6 @@ static void handle_vmport_ioreq(XenIOState *state, i= oreq_t *req) current_cpu =3D NULL; } =20 -static void handle_ioreq(XenIOState *state, ioreq_t *req) -{ - trace_handle_ioreq(req, req->type, req->dir, req->df, req->data_is_ptr, - req->addr, req->data, req->count, req->size); - - if (!req->data_is_ptr && (req->dir =3D=3D IOREQ_WRITE) && - (req->size < sizeof (target_ulong))) { - req->data &=3D ((target_ulong) 1 << (8 * req->size)) - 1; - } - - if (req->dir =3D=3D IOREQ_WRITE) - trace_handle_ioreq_write(req, req->type, req->df, req->data_is_ptr, - req->addr, req->data, req->count, req->si= ze); - - switch (req->type) { - case IOREQ_TYPE_PIO: - cpu_ioreq_pio(req); - break; - case IOREQ_TYPE_COPY: - cpu_ioreq_move(req); - break; - case IOREQ_TYPE_VMWARE_PORT: - handle_vmport_ioreq(state, req); - break; - case IOREQ_TYPE_TIMEOFFSET: - break; - case IOREQ_TYPE_INVALIDATE: - xen_invalidate_map_cache(); - break; - case IOREQ_TYPE_PCI_CONFIG: - cpu_ioreq_config(state, req); - break; - default: - hw_error("Invalid ioreq type 0x%x\n", req->type); - } - if (req->dir =3D=3D IOREQ_READ) { - trace_handle_ioreq_read(req, req->type, req->df, req->data_is_ptr, - req->addr, req->data, req->count, req->siz= e); - } -} - -static bool handle_buffered_iopage(XenIOState *state) -{ - buffered_iopage_t *buf_page =3D state->buffered_io_page; - buf_ioreq_t *buf_req =3D NULL; - bool handled_ioreq =3D false; - ioreq_t req; - int qw; - - if (!buf_page) { - return 0; - } - - memset(&req, 0x00, sizeof(req)); - req.state =3D STATE_IOREQ_READY; - req.count =3D 1; - req.dir =3D IOREQ_WRITE; - - for (;;) { - uint32_t rdptr =3D buf_page->read_pointer, wrptr; - - xen_rmb(); - wrptr =3D buf_page->write_pointer; - xen_rmb(); - if (rdptr !=3D buf_page->read_pointer) { - continue; - } - if (rdptr =3D=3D wrptr) { - break; - } - buf_req =3D &buf_page->buf_ioreq[rdptr % IOREQ_BUFFER_SLOT_NUM]; - req.size =3D 1U << buf_req->size; - req.addr =3D buf_req->addr; - req.data =3D buf_req->data; - req.type =3D buf_req->type; - xen_rmb(); - qw =3D (req.size =3D=3D 8); - if (qw) { - if (rdptr + 1 =3D=3D wrptr) { - hw_error("Incomplete quad word buffered ioreq"); - } - buf_req =3D &buf_page->buf_ioreq[(rdptr + 1) % - IOREQ_BUFFER_SLOT_NUM]; - req.data |=3D ((uint64_t)buf_req->data) << 32; - xen_rmb(); - } - - handle_ioreq(state, &req); - - /* Only req.data may get updated by handle_ioreq(), albeit even th= at - * should not happen as such data would never make it to the guest= (we - * can only usefully see writes here after all). - */ - assert(req.state =3D=3D STATE_IOREQ_READY); - assert(req.count =3D=3D 1); - assert(req.dir =3D=3D IOREQ_WRITE); - assert(!req.data_is_ptr); - - qatomic_add(&buf_page->read_pointer, qw + 1); - handled_ioreq =3D true; - } - - return handled_ioreq; -} - -static void handle_buffered_io(void *opaque) -{ - XenIOState *state =3D opaque; - - if (handle_buffered_iopage(state)) { - timer_mod(state->buffered_io_timer, - BUFFER_IO_MAX_DELAY + qemu_clock_get_ms(QEMU_CLOCK_REALTIM= E)); - } else { - timer_del(state->buffered_io_timer); - qemu_xen_evtchn_unmask(state->xce_handle, state->bufioreq_local_po= rt); - } -} - -static void cpu_handle_ioreq(void *opaque) -{ - XenIOState *state =3D opaque; - ioreq_t *req =3D cpu_get_ioreq(state); - - handle_buffered_iopage(state); - if (req) { - ioreq_t copy =3D *req; - - xen_rmb(); - handle_ioreq(state, ©); - req->data =3D copy.data; - - if (req->state !=3D STATE_IOREQ_INPROCESS) { - fprintf(stderr, "Badness in I/O request ... not in service?!: " - "%x, ptr: %x, port: %"PRIx64", " - "data: %"PRIx64", count: %u, size: %u, type: %u\n", - req->state, req->data_is_ptr, req->addr, - req->data, req->count, req->size, req->type); - destroy_hvm_domain(false); - return; - } - - xen_wmb(); /* Update ioreq contents /then/ update state. */ - - /* - * We do this before we send the response so that the tools - * have the opportunity to pick up on the reset before the - * guest resumes and does a hlt with interrupts disabled which - * causes Xen to powerdown the domain. - */ - if (runstate_is_running()) { - ShutdownCause request; - - if (qemu_shutdown_requested_get()) { - destroy_hvm_domain(false); - } - request =3D qemu_reset_requested_get(); - if (request) { - qemu_system_reset(request); - destroy_hvm_domain(true); - } - } - - req->state =3D STATE_IORESP_READY; - qemu_xen_evtchn_notify(state->xce_handle, - state->ioreq_local_port[state->send_vcpu]); - } -} - -static void xen_main_loop_prepare(XenIOState *state) -{ - int evtchn_fd =3D -1; - - if (state->xce_handle !=3D NULL) { - evtchn_fd =3D qemu_xen_evtchn_fd(state->xce_handle); - } - - state->buffered_io_timer =3D timer_new_ms(QEMU_CLOCK_REALTIME, handle_= buffered_io, - state); - - if (evtchn_fd !=3D -1) { - CPUState *cpu_state; - - DPRINTF("%s: Init cpu_by_vcpu_id\n", __func__); - CPU_FOREACH(cpu_state) { - DPRINTF("%s: cpu_by_vcpu_id[%d]=3D%p\n", - __func__, cpu_state->cpu_index, cpu_state); - state->cpu_by_vcpu_id[cpu_state->cpu_index] =3D cpu_state; - } - qemu_set_fd_handler(evtchn_fd, cpu_handle_ioreq, NULL, state); - } -} - - -static void xen_hvm_change_state_handler(void *opaque, bool running, - RunState rstate) -{ - XenIOState *state =3D opaque; - - if (running) { - xen_main_loop_prepare(state); - } - - xen_set_ioreq_server_state(xen_domid, - state->ioservid, - (rstate =3D=3D RUN_STATE_RUNNING)); -} - -static void xen_exit_notifier(Notifier *n, void *data) -{ - XenIOState *state =3D container_of(n, XenIOState, exit); - - xen_destroy_ioreq_server(xen_domid, state->ioservid); - if (state->fres !=3D NULL) { - xenforeignmemory_unmap_resource(xen_fmem, state->fres); - } - - qemu_xen_evtchn_close(state->xce_handle); - xs_daemon_close(state->xenstore); -} - #ifdef XEN_COMPAT_PHYSMAP static void xen_read_physmap(XenIOState *state) { @@ -1310,175 +572,17 @@ static void xen_wakeup_notifier(Notifier *notifier,= void *data) xc_set_hvm_param(xen_xc, xen_domid, HVM_PARAM_ACPI_S_STATE, 0); } =20 -static int xen_map_ioreq_server(XenIOState *state) -{ - void *addr =3D NULL; - xen_pfn_t ioreq_pfn; - xen_pfn_t bufioreq_pfn; - evtchn_port_t bufioreq_evtchn; - int rc; - - /* - * Attempt to map using the resource API and fall back to normal - * foreign mapping if this is not supported. - */ - QEMU_BUILD_BUG_ON(XENMEM_resource_ioreq_server_frame_bufioreq !=3D 0); - QEMU_BUILD_BUG_ON(XENMEM_resource_ioreq_server_frame_ioreq(0) !=3D 1); - state->fres =3D xenforeignmemory_map_resource(xen_fmem, xen_domid, - XENMEM_resource_ioreq_server, - state->ioservid, 0, 2, - &addr, - PROT_READ | PROT_WRITE, 0); - if (state->fres !=3D NULL) { - trace_xen_map_resource_ioreq(state->ioservid, addr); - state->buffered_io_page =3D addr; - state->shared_page =3D addr + TARGET_PAGE_SIZE; - } else if (errno !=3D EOPNOTSUPP) { - error_report("failed to map ioreq server resources: error %d handl= e=3D%p", - errno, xen_xc); - return -1; - } - - rc =3D xen_get_ioreq_server_info(xen_domid, state->ioservid, - (state->shared_page =3D=3D NULL) ? - &ioreq_pfn : NULL, - (state->buffered_io_page =3D=3D NULL) ? - &bufioreq_pfn : NULL, - &bufioreq_evtchn); - if (rc < 0) { - error_report("failed to get ioreq server info: error %d handle=3D%= p", - errno, xen_xc); - return rc; - } - - if (state->shared_page =3D=3D NULL) { - DPRINTF("shared page at pfn %lx\n", ioreq_pfn); - - state->shared_page =3D xenforeignmemory_map(xen_fmem, xen_domid, - PROT_READ | PROT_WRITE, - 1, &ioreq_pfn, NULL); - if (state->shared_page =3D=3D NULL) { - error_report("map shared IO page returned error %d handle=3D%p= ", - errno, xen_xc); - } - } - - if (state->buffered_io_page =3D=3D NULL) { - DPRINTF("buffered io page at pfn %lx\n", bufioreq_pfn); - - state->buffered_io_page =3D xenforeignmemory_map(xen_fmem, xen_dom= id, - PROT_READ | PROT_WR= ITE, - 1, &bufioreq_pfn, - NULL); - if (state->buffered_io_page =3D=3D NULL) { - error_report("map buffered IO page returned error %d", errno); - return -1; - } - } - - if (state->shared_page =3D=3D NULL || state->buffered_io_page =3D=3D N= ULL) { - return -1; - } - - DPRINTF("buffered io evtchn is %x\n", bufioreq_evtchn); - - state->bufioreq_remote_port =3D bufioreq_evtchn; - - return 0; -} - void xen_hvm_init_pc(PCMachineState *pcms, MemoryRegion **ram_memory) { MachineState *ms =3D MACHINE(pcms); unsigned int max_cpus =3D ms->smp.max_cpus; - int i, rc; + int rc; xen_pfn_t ioreq_pfn; XenIOState *state; =20 - setup_xen_backend_ops(); - state =3D g_new0(XenIOState, 1); =20 - state->xce_handle =3D qemu_xen_evtchn_open(); - if (state->xce_handle =3D=3D NULL) { - perror("xen: event channel open"); - goto err; - } - - state->xenstore =3D xs_daemon_open(); - if (state->xenstore =3D=3D NULL) { - perror("xen: xenstore open"); - goto err; - } - - xen_create_ioreq_server(xen_domid, &state->ioservid); - - state->exit.notify =3D xen_exit_notifier; - qemu_add_exit_notifier(&state->exit); - - /* - * Register wake-up support in QMP query-current-machine API - */ - qemu_register_wakeup_support(); - - rc =3D xen_map_ioreq_server(state); - if (rc < 0) { - goto err; - } - - /* Note: cpus is empty at this point in init */ - state->cpu_by_vcpu_id =3D g_new0(CPUState *, max_cpus); - - rc =3D xen_set_ioreq_server_state(xen_domid, state->ioservid, true); - if (rc < 0) { - error_report("failed to enable ioreq server info: error %d handle= =3D%p", - errno, xen_xc); - goto err; - } - - state->ioreq_local_port =3D g_new0(evtchn_port_t, max_cpus); - - /* FIXME: how about if we overflow the page here? */ - for (i =3D 0; i < max_cpus; i++) { - rc =3D qemu_xen_evtchn_bind_interdomain(state->xce_handle, xen_dom= id, - xen_vcpu_eport(state->shared= _page, - i)); - if (rc =3D=3D -1) { - error_report("shared evtchn %d bind error %d", i, errno); - goto err; - } - state->ioreq_local_port[i] =3D rc; - } - - rc =3D qemu_xen_evtchn_bind_interdomain(state->xce_handle, xen_domid, - state->bufioreq_remote_port); - if (rc =3D=3D -1) { - error_report("buffered evtchn bind error %d", errno); - goto err; - } - state->bufioreq_local_port =3D rc; - - /* Init RAM management */ -#ifdef XEN_COMPAT_PHYSMAP - xen_map_cache_init(xen_phys_offset_to_gaddr, state); -#else - xen_map_cache_init(NULL, state); -#endif - - qemu_add_vm_change_state_handler(xen_hvm_change_state_handler, state); - - state->memory_listener =3D xen_memory_listener; - memory_listener_register(&state->memory_listener, &address_space_memor= y); - - state->io_listener =3D xen_io_listener; - memory_listener_register(&state->io_listener, &address_space_io); - - state->device_listener =3D xen_device_listener; - QLIST_INIT(&state->dev_list); - device_listener_register(&state->device_listener); - - xen_bus_init(); - xen_be_init(); + xen_register_ioreq(state, max_cpus, xen_memory_listener); =20 QLIST_INIT(&xen_physmap); xen_read_physmap(state); @@ -1518,59 +622,11 @@ err: exit(1); } =20 -void destroy_hvm_domain(bool reboot) -{ - xc_interface *xc_handle; - int sts; - int rc; - - unsigned int reason =3D reboot ? SHUTDOWN_reboot : SHUTDOWN_poweroff; - - if (xen_dmod) { - rc =3D xendevicemodel_shutdown(xen_dmod, xen_domid, reason); - if (!rc) { - return; - } - if (errno !=3D ENOTTY /* old Xen */) { - perror("xendevicemodel_shutdown failed"); - } - /* well, try the old thing then */ - } - - xc_handle =3D xc_interface_open(0, 0, 0); - if (xc_handle =3D=3D NULL) { - fprintf(stderr, "Cannot acquire xenctrl handle\n"); - } else { - sts =3D xc_domain_shutdown(xc_handle, xen_domid, reason); - if (sts !=3D 0) { - fprintf(stderr, "xc_domain_shutdown failed to issue %s, " - "sts %d, %s\n", reboot ? "reboot" : "poweroff", - sts, strerror(errno)); - } else { - fprintf(stderr, "Issued domain %d %s\n", xen_domid, - reboot ? "reboot" : "poweroff"); - } - xc_interface_close(xc_handle); - } -} - void xen_register_framebuffer(MemoryRegion *mr) { framebuffer =3D mr; } =20 -void xen_shutdown_fatal_error(const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); - fprintf(stderr, "Will destroy the domain.\n"); - /* destroy the domain */ - qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_ERROR); -} - void xen_hvm_modified_memory(ram_addr_t start, ram_addr_t length) { if (unlikely(xen_in_migration)) { @@ -1602,3 +658,57 @@ void qmp_xen_set_global_dirty_log(bool enable, Error = **errp) memory_global_dirty_log_stop(GLOBAL_DIRTY_MIGRATION); } } + +void arch_xen_set_memory(XenIOState *state, MemoryRegionSection *section, + bool add) +{ + hwaddr start_addr =3D section->offset_within_address_space; + ram_addr_t size =3D int128_get64(section->size); + bool log_dirty =3D memory_region_is_logging(section->mr, DIRTY_MEMORY_= VGA); + hvmmem_type_t mem_type; + + if (!memory_region_is_ram(section->mr)) { + return; + } + + if (log_dirty !=3D add) { + return; + } + + trace_xen_client_set_memory(start_addr, size, log_dirty); + + start_addr &=3D TARGET_PAGE_MASK; + size =3D TARGET_PAGE_ALIGN(size); + + if (add) { + if (!memory_region_is_rom(section->mr)) { + xen_add_to_physmap(state, start_addr, size, + section->mr, section->offset_within_region); + } else { + mem_type =3D HVMMEM_ram_ro; + if (xen_set_mem_type(xen_domid, mem_type, + start_addr >> TARGET_PAGE_BITS, + size >> TARGET_PAGE_BITS)) { + DPRINTF("xen_set_mem_type error, addr: "HWADDR_FMT_plx"\n", + start_addr); + } + } + } else { + if (xen_remove_from_physmap(state, start_addr, size) < 0) { + DPRINTF("physmapping does not exist at "HWADDR_FMT_plx"\n", st= art_addr); + } + } +} + +void arch_handle_ioreq(XenIOState *state, ioreq_t *req) +{ + switch (req->type) { + case IOREQ_TYPE_VMWARE_PORT: + handle_vmport_ioreq(state, req); + break; + default: + hw_error("Invalid ioreq type 0x%x\n", req->type); + } + + return; +} diff --git a/hw/xen/meson.build b/hw/xen/meson.build index 202752e557..afd20754a1 100644 --- a/hw/xen/meson.build +++ b/hw/xen/meson.build @@ -29,4 +29,7 @@ specific_ss.add_all(when: ['CONFIG_XEN', xen], if_true: x= en_specific_ss) =20 xen_ss =3D ss.source_set() =20 -xen_ss.add(when: 'CONFIG_XEN', if_true: files('xen-mapcache.c')) +xen_ss.add(when: 'CONFIG_XEN', if_true: files( + 'xen-mapcache.c', + 'xen-hvm-common.c', +)) diff --git a/hw/xen/trace-events b/hw/xen/trace-events index f977c7c8c6..67a6c41926 100644 --- a/hw/xen/trace-events +++ b/hw/xen/trace-events @@ -42,6 +42,20 @@ xs_node_vscanf(char *path, char *value) "%s %s" xs_node_watch(char *path) "%s" xs_node_unwatch(char *path) "%s" =20 +# xen-hvm.c +xen_ram_alloc(unsigned long ram_addr, unsigned long size) "requested: 0x%l= x, size 0x%lx" +xen_client_set_memory(uint64_t start_addr, unsigned long size, bool log_di= rty) "0x%"PRIx64" size 0x%lx, log_dirty %i" +handle_ioreq(void *req, uint32_t type, uint32_t dir, uint32_t df, uint32_t= data_is_ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) = "I/O=3D%p type=3D%d dir=3D%d df=3D%d ptr=3D%d port=3D0x%"PRIx64" data=3D0x%= "PRIx64" count=3D%d size=3D%d" +handle_ioreq_read(void *req, uint32_t type, uint32_t df, uint32_t data_is_= ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O=3D%p= read type=3D%d df=3D%d ptr=3D%d port=3D0x%"PRIx64" data=3D0x%"PRIx64" coun= t=3D%d size=3D%d" +handle_ioreq_write(void *req, uint32_t type, uint32_t df, uint32_t data_is= _ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O=3D%= p write type=3D%d df=3D%d ptr=3D%d port=3D0x%"PRIx64" data=3D0x%"PRIx64" co= unt=3D%d size=3D%d" +cpu_ioreq_pio(void *req, uint32_t dir, uint32_t df, uint32_t data_is_ptr, = uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O=3D%p pio = dir=3D%d df=3D%d ptr=3D%d port=3D0x%"PRIx64" data=3D0x%"PRIx64" count=3D%d = size=3D%d" +cpu_ioreq_pio_read_reg(void *req, uint64_t data, uint64_t addr, uint32_t s= ize) "I/O=3D%p pio read reg data=3D0x%"PRIx64" port=3D0x%"PRIx64" size=3D%d" +cpu_ioreq_pio_write_reg(void *req, uint64_t data, uint64_t addr, uint32_t = size) "I/O=3D%p pio write reg data=3D0x%"PRIx64" port=3D0x%"PRIx64" size=3D= %d" +cpu_ioreq_move(void *req, uint32_t dir, uint32_t df, uint32_t data_is_ptr,= uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O=3D%p cop= y dir=3D%d df=3D%d ptr=3D%d port=3D0x%"PRIx64" data=3D0x%"PRIx64" count=3D%= d size=3D%d" +xen_map_resource_ioreq(uint32_t id, void *addr) "id: %u addr: %p" +cpu_ioreq_config_read(void *req, uint32_t sbdf, uint32_t reg, uint32_t siz= e, uint32_t data) "I/O=3D%p sbdf=3D0x%x reg=3D%u size=3D%u data=3D0x%x" +cpu_ioreq_config_write(void *req, uint32_t sbdf, uint32_t reg, uint32_t si= ze, uint32_t data) "I/O=3D%p sbdf=3D0x%x reg=3D%u size=3D%u data=3D0x%x" + # 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-hvm-common.c b/hw/xen/xen-hvm-common.c new file mode 100644 index 0000000000..a31b067404 --- /dev/null +++ b/hw/xen/xen-hvm-common.c @@ -0,0 +1,860 @@ +#include "qemu/osdep.h" +#include "qemu/units.h" +#include "qapi/error.h" +#include "trace.h" + +#include "hw/pci/pci_host.h" +#include "hw/xen/xen-hvm-common.h" +#include "hw/xen/xen-bus.h" +#include "hw/boards.h" +#include "hw/xen/arch_hvm.h" + +MemoryRegion ram_memory; + +void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size, MemoryRegion *mr, + Error **errp) +{ + unsigned long nr_pfn; + xen_pfn_t *pfn_list; + int i; + + if (runstate_check(RUN_STATE_INMIGRATE)) { + /* RAM already populated in Xen */ + fprintf(stderr, "%s: do not alloc "RAM_ADDR_FMT + " bytes of ram at "RAM_ADDR_FMT" when runstate is INMIGRAT= E\n", + __func__, size, ram_addr); + return; + } + + if (mr =3D=3D &ram_memory) { + return; + } + + trace_xen_ram_alloc(ram_addr, size); + + nr_pfn =3D size >> TARGET_PAGE_BITS; + pfn_list =3D g_malloc(sizeof (*pfn_list) * nr_pfn); + + for (i =3D 0; i < nr_pfn; i++) { + pfn_list[i] =3D (ram_addr >> TARGET_PAGE_BITS) + i; + } + + if (xc_domain_populate_physmap_exact(xen_xc, xen_domid, nr_pfn, 0, 0, = pfn_list)) { + error_setg(errp, "xen: failed to populate ram at " RAM_ADDR_FMT, + ram_addr); + } + + g_free(pfn_list); +} + +static void xen_set_memory(struct MemoryListener *listener, + MemoryRegionSection *section, + bool add) +{ + XenIOState *state =3D container_of(listener, XenIOState, memory_listen= er); + + if (section->mr =3D=3D &ram_memory) { + return; + } else { + if (add) { + xen_map_memory_section(xen_domid, state->ioservid, + section); + } else { + xen_unmap_memory_section(xen_domid, state->ioservid, + section); + } + } + + arch_xen_set_memory(state, section, add); +} + +void xen_region_add(MemoryListener *listener, + MemoryRegionSection *section) +{ + memory_region_ref(section->mr); + xen_set_memory(listener, section, true); +} + +void xen_region_del(MemoryListener *listener, + MemoryRegionSection *section) +{ + xen_set_memory(listener, section, false); + memory_region_unref(section->mr); +} + +void xen_io_add(MemoryListener *listener, + MemoryRegionSection *section) +{ + XenIOState *state =3D container_of(listener, XenIOState, io_listener); + MemoryRegion *mr =3D section->mr; + + if (mr->ops =3D=3D &unassigned_io_ops) { + return; + } + + memory_region_ref(mr); + + xen_map_io_section(xen_domid, state->ioservid, section); +} + +void xen_io_del(MemoryListener *listener, + MemoryRegionSection *section) +{ + XenIOState *state =3D container_of(listener, XenIOState, io_listener); + MemoryRegion *mr =3D section->mr; + + if (mr->ops =3D=3D &unassigned_io_ops) { + return; + } + + xen_unmap_io_section(xen_domid, state->ioservid, section); + + memory_region_unref(mr); +} + +void xen_device_realize(DeviceListener *listener, + DeviceState *dev) +{ + XenIOState *state =3D container_of(listener, XenIOState, device_listen= er); + + if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) { + PCIDevice *pci_dev =3D PCI_DEVICE(dev); + XenPciDevice *xendev =3D g_new(XenPciDevice, 1); + + xendev->pci_dev =3D pci_dev; + xendev->sbdf =3D PCI_BUILD_BDF(pci_dev_bus_num(pci_dev), + pci_dev->devfn); + QLIST_INSERT_HEAD(&state->dev_list, xendev, entry); + + xen_map_pcidev(xen_domid, state->ioservid, pci_dev); + } +} + +void xen_device_unrealize(DeviceListener *listener, + DeviceState *dev) +{ + XenIOState *state =3D container_of(listener, XenIOState, device_listen= er); + + if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) { + PCIDevice *pci_dev =3D PCI_DEVICE(dev); + XenPciDevice *xendev, *next; + + xen_unmap_pcidev(xen_domid, state->ioservid, pci_dev); + + QLIST_FOREACH_SAFE(xendev, &state->dev_list, entry, next) { + if (xendev->pci_dev =3D=3D pci_dev) { + QLIST_REMOVE(xendev, entry); + g_free(xendev); + break; + } + } + } +} + +MemoryListener xen_io_listener =3D { + .name =3D "xen-io", + .region_add =3D xen_io_add, + .region_del =3D xen_io_del, + .priority =3D 10, +}; + +DeviceListener xen_device_listener =3D { + .realize =3D xen_device_realize, + .unrealize =3D xen_device_unrealize, +}; + +/* get the ioreq packets from share mem */ +static ioreq_t *cpu_get_ioreq_from_shared_memory(XenIOState *state, int vc= pu) +{ + ioreq_t *req =3D xen_vcpu_ioreq(state->shared_page, vcpu); + + if (req->state !=3D STATE_IOREQ_READY) { + DPRINTF("I/O request not ready: " + "%x, ptr: %x, port: %"PRIx64", " + "data: %"PRIx64", count: %u, size: %u\n", + req->state, req->data_is_ptr, req->addr, + req->data, req->count, req->size); + return NULL; + } + + xen_rmb(); /* see IOREQ_READY /then/ read contents of ioreq */ + + req->state =3D STATE_IOREQ_INPROCESS; + return req; +} + +/* use poll to get the port notification */ +/* ioreq_vec--out,the */ +/* retval--the number of ioreq packet */ +static ioreq_t *cpu_get_ioreq(XenIOState *state) +{ + MachineState *ms =3D MACHINE(qdev_get_machine()); + unsigned int max_cpus =3D ms->smp.max_cpus; + int i; + evtchn_port_t port; + + port =3D qemu_xen_evtchn_pending(state->xce_handle); + if (port =3D=3D state->bufioreq_local_port) { + timer_mod(state->buffered_io_timer, + BUFFER_IO_MAX_DELAY + qemu_clock_get_ms(QEMU_CLOCK_REALTIM= E)); + return NULL; + } + + if (port !=3D -1) { + for (i =3D 0; i < max_cpus; i++) { + if (state->ioreq_local_port[i] =3D=3D port) { + break; + } + } + + if (i =3D=3D max_cpus) { + hw_error("Fatal error while trying to get io event!\n"); + } + + /* unmask the wanted port again */ + qemu_xen_evtchn_unmask(state->xce_handle, port); + + /* get the io packet from shared memory */ + state->send_vcpu =3D i; + return cpu_get_ioreq_from_shared_memory(state, i); + } + + /* read error or read nothing */ + return NULL; +} + +static uint32_t do_inp(uint32_t addr, unsigned long size) +{ + switch (size) { + case 1: + return cpu_inb(addr); + case 2: + return cpu_inw(addr); + case 4: + return cpu_inl(addr); + default: + hw_error("inp: bad size: %04x %lx", addr, size); + } +} + +static void do_outp(uint32_t addr, + unsigned long size, uint32_t val) +{ + switch (size) { + case 1: + return cpu_outb(addr, val); + case 2: + return cpu_outw(addr, val); + case 4: + return cpu_outl(addr, val); + default: + hw_error("outp: bad size: %04x %lx", addr, size); + } +} + +/* + * Helper functions which read/write an object from/to physical guest + * memory, as part of the implementation of an ioreq. + * + * Equivalent to + * cpu_physical_memory_rw(addr + (req->df ? -1 : +1) * req->size * i, + * val, req->size, 0/1) + * except without the integer overflow problems. + */ +static void rw_phys_req_item(hwaddr addr, + ioreq_t *req, uint32_t i, void *val, int rw) +{ + /* Do everything unsigned so overflow just results in a truncated resu= lt + * and accesses to undesired parts of guest memory, which is up + * to the guest */ + hwaddr offset =3D (hwaddr)req->size * i; + if (req->df) { + addr -=3D offset; + } else { + addr +=3D offset; + } + cpu_physical_memory_rw(addr, val, req->size, rw); +} + +static inline void read_phys_req_item(hwaddr addr, + ioreq_t *req, uint32_t i, void *val) +{ + rw_phys_req_item(addr, req, i, val, 0); +} +static inline void write_phys_req_item(hwaddr addr, + ioreq_t *req, uint32_t i, void *val) +{ + rw_phys_req_item(addr, req, i, val, 1); +} + + +void cpu_ioreq_pio(ioreq_t *req) +{ + uint32_t i; + + trace_cpu_ioreq_pio(req, req->dir, req->df, req->data_is_ptr, req->add= r, + req->data, req->count, req->size); + + if (req->size > sizeof(uint32_t)) { + hw_error("PIO: bad size (%u)", req->size); + } + + if (req->dir =3D=3D IOREQ_READ) { + if (!req->data_is_ptr) { + req->data =3D do_inp(req->addr, req->size); + trace_cpu_ioreq_pio_read_reg(req, req->data, req->addr, + req->size); + } else { + uint32_t tmp; + + for (i =3D 0; i < req->count; i++) { + tmp =3D do_inp(req->addr, req->size); + write_phys_req_item(req->data, req, i, &tmp); + } + } + } else if (req->dir =3D=3D IOREQ_WRITE) { + if (!req->data_is_ptr) { + trace_cpu_ioreq_pio_write_reg(req, req->data, req->addr, + req->size); + do_outp(req->addr, req->size, req->data); + } else { + for (i =3D 0; i < req->count; i++) { + uint32_t tmp =3D 0; + + read_phys_req_item(req->data, req, i, &tmp); + do_outp(req->addr, req->size, tmp); + } + } + } +} + +static void cpu_ioreq_move(ioreq_t *req) +{ + uint32_t i; + + trace_cpu_ioreq_move(req, req->dir, req->df, req->data_is_ptr, req->ad= dr, + req->data, req->count, req->size); + + if (req->size > sizeof(req->data)) { + hw_error("MMIO: bad size (%u)", req->size); + } + + if (!req->data_is_ptr) { + if (req->dir =3D=3D IOREQ_READ) { + for (i =3D 0; i < req->count; i++) { + read_phys_req_item(req->addr, req, i, &req->data); + } + } else if (req->dir =3D=3D IOREQ_WRITE) { + for (i =3D 0; i < req->count; i++) { + write_phys_req_item(req->addr, req, i, &req->data); + } + } + } else { + uint64_t tmp; + + if (req->dir =3D=3D IOREQ_READ) { + for (i =3D 0; i < req->count; i++) { + read_phys_req_item(req->addr, req, i, &tmp); + write_phys_req_item(req->data, req, i, &tmp); + } + } else if (req->dir =3D=3D IOREQ_WRITE) { + for (i =3D 0; i < req->count; i++) { + read_phys_req_item(req->data, req, i, &tmp); + write_phys_req_item(req->addr, req, i, &tmp); + } + } + } +} + +static void cpu_ioreq_config(XenIOState *state, ioreq_t *req) +{ + uint32_t sbdf =3D req->addr >> 32; + uint32_t reg =3D req->addr; + XenPciDevice *xendev; + + if (req->size !=3D sizeof(uint8_t) && req->size !=3D sizeof(uint16_t) = && + req->size !=3D sizeof(uint32_t)) { + hw_error("PCI config access: bad size (%u)", req->size); + } + + if (req->count !=3D 1) { + hw_error("PCI config access: bad count (%u)", req->count); + } + + QLIST_FOREACH(xendev, &state->dev_list, entry) { + if (xendev->sbdf !=3D sbdf) { + continue; + } + + if (!req->data_is_ptr) { + if (req->dir =3D=3D IOREQ_READ) { + req->data =3D pci_host_config_read_common( + xendev->pci_dev, reg, PCI_CONFIG_SPACE_SIZE, + req->size); + trace_cpu_ioreq_config_read(req, xendev->sbdf, reg, + req->size, req->data); + } else if (req->dir =3D=3D IOREQ_WRITE) { + trace_cpu_ioreq_config_write(req, xendev->sbdf, reg, + req->size, req->data); + pci_host_config_write_common( + xendev->pci_dev, reg, PCI_CONFIG_SPACE_SIZE, + req->data, req->size); + } + } else { + uint32_t tmp; + + if (req->dir =3D=3D IOREQ_READ) { + tmp =3D pci_host_config_read_common( + xendev->pci_dev, reg, PCI_CONFIG_SPACE_SIZE, + req->size); + trace_cpu_ioreq_config_read(req, xendev->sbdf, reg, + req->size, tmp); + write_phys_req_item(req->data, req, 0, &tmp); + } else if (req->dir =3D=3D IOREQ_WRITE) { + read_phys_req_item(req->data, req, 0, &tmp); + trace_cpu_ioreq_config_write(req, xendev->sbdf, reg, + req->size, tmp); + pci_host_config_write_common( + xendev->pci_dev, reg, PCI_CONFIG_SPACE_SIZE, + tmp, req->size); + } + } + } +} + +static void handle_ioreq(XenIOState *state, ioreq_t *req) +{ + trace_handle_ioreq(req, req->type, req->dir, req->df, req->data_is_ptr, + req->addr, req->data, req->count, req->size); + + if (!req->data_is_ptr && (req->dir =3D=3D IOREQ_WRITE) && + (req->size < sizeof (target_ulong))) { + req->data &=3D ((target_ulong) 1 << (8 * req->size)) - 1; + } + + if (req->dir =3D=3D IOREQ_WRITE) + trace_handle_ioreq_write(req, req->type, req->df, req->data_is_ptr, + req->addr, req->data, req->count, req->si= ze); + + switch (req->type) { + case IOREQ_TYPE_PIO: + cpu_ioreq_pio(req); + break; + case IOREQ_TYPE_COPY: + cpu_ioreq_move(req); + break; + case IOREQ_TYPE_TIMEOFFSET: + break; + case IOREQ_TYPE_INVALIDATE: + xen_invalidate_map_cache(); + break; + case IOREQ_TYPE_PCI_CONFIG: + cpu_ioreq_config(state, req); + break; + default: + arch_handle_ioreq(state, req); + } + if (req->dir =3D=3D IOREQ_READ) { + trace_handle_ioreq_read(req, req->type, req->df, req->data_is_ptr, + req->addr, req->data, req->count, req->siz= e); + } +} + +static bool handle_buffered_iopage(XenIOState *state) +{ + buffered_iopage_t *buf_page =3D state->buffered_io_page; + buf_ioreq_t *buf_req =3D NULL; + bool handled_ioreq =3D false; + ioreq_t req; + int qw; + + if (!buf_page) { + return 0; + } + + memset(&req, 0x00, sizeof(req)); + req.state =3D STATE_IOREQ_READY; + req.count =3D 1; + req.dir =3D IOREQ_WRITE; + + for (;;) { + uint32_t rdptr =3D buf_page->read_pointer, wrptr; + + xen_rmb(); + wrptr =3D buf_page->write_pointer; + xen_rmb(); + if (rdptr !=3D buf_page->read_pointer) { + continue; + } + if (rdptr =3D=3D wrptr) { + break; + } + buf_req =3D &buf_page->buf_ioreq[rdptr % IOREQ_BUFFER_SLOT_NUM]; + req.size =3D 1U << buf_req->size; + req.addr =3D buf_req->addr; + req.data =3D buf_req->data; + req.type =3D buf_req->type; + xen_rmb(); + qw =3D (req.size =3D=3D 8); + if (qw) { + if (rdptr + 1 =3D=3D wrptr) { + hw_error("Incomplete quad word buffered ioreq"); + } + buf_req =3D &buf_page->buf_ioreq[(rdptr + 1) % + IOREQ_BUFFER_SLOT_NUM]; + req.data |=3D ((uint64_t)buf_req->data) << 32; + xen_rmb(); + } + + handle_ioreq(state, &req); + + /* Only req.data may get updated by handle_ioreq(), albeit even th= at + * should not happen as such data would never make it to the guest= (we + * can only usefully see writes here after all). + */ + assert(req.state =3D=3D STATE_IOREQ_READY); + assert(req.count =3D=3D 1); + assert(req.dir =3D=3D IOREQ_WRITE); + assert(!req.data_is_ptr); + + qatomic_add(&buf_page->read_pointer, qw + 1); + handled_ioreq =3D true; + } + + return handled_ioreq; +} + +static void handle_buffered_io(void *opaque) +{ + XenIOState *state =3D opaque; + + if (handle_buffered_iopage(state)) { + timer_mod(state->buffered_io_timer, + BUFFER_IO_MAX_DELAY + qemu_clock_get_ms(QEMU_CLOCK_REALTIM= E)); + } else { + timer_del(state->buffered_io_timer); + qemu_xen_evtchn_unmask(state->xce_handle, state->bufioreq_local_po= rt); + } +} + +static void cpu_handle_ioreq(void *opaque) +{ + XenIOState *state =3D opaque; + ioreq_t *req =3D cpu_get_ioreq(state); + + handle_buffered_iopage(state); + if (req) { + ioreq_t copy =3D *req; + + xen_rmb(); + handle_ioreq(state, ©); + req->data =3D copy.data; + + if (req->state !=3D STATE_IOREQ_INPROCESS) { + fprintf(stderr, "Badness in I/O request ... not in service?!: " + "%x, ptr: %x, port: %"PRIx64", " + "data: %"PRIx64", count: %u, size: %u, type: %u\n", + req->state, req->data_is_ptr, req->addr, + req->data, req->count, req->size, req->type); + destroy_hvm_domain(false); + return; + } + + xen_wmb(); /* Update ioreq contents /then/ update state. */ + + /* + * We do this before we send the response so that the tools + * have the opportunity to pick up on the reset before the + * guest resumes and does a hlt with interrupts disabled which + * causes Xen to powerdown the domain. + */ + if (runstate_is_running()) { + ShutdownCause request; + + if (qemu_shutdown_requested_get()) { + destroy_hvm_domain(false); + } + request =3D qemu_reset_requested_get(); + if (request) { + qemu_system_reset(request); + destroy_hvm_domain(true); + } + } + + req->state =3D STATE_IORESP_READY; + qemu_xen_evtchn_notify(state->xce_handle, + state->ioreq_local_port[state->send_vcpu]); + } +} + +static void xen_main_loop_prepare(XenIOState *state) +{ + int evtchn_fd =3D -1; + + if (state->xce_handle !=3D NULL) { + evtchn_fd =3D qemu_xen_evtchn_fd(state->xce_handle); + } + + state->buffered_io_timer =3D timer_new_ms(QEMU_CLOCK_REALTIME, handle_= buffered_io, + state); + + if (evtchn_fd !=3D -1) { + CPUState *cpu_state; + + DPRINTF("%s: Init cpu_by_vcpu_id\n", __func__); + CPU_FOREACH(cpu_state) { + DPRINTF("%s: cpu_by_vcpu_id[%d]=3D%p\n", + __func__, cpu_state->cpu_index, cpu_state); + state->cpu_by_vcpu_id[cpu_state->cpu_index] =3D cpu_state; + } + qemu_set_fd_handler(evtchn_fd, cpu_handle_ioreq, NULL, state); + } +} + + +void xen_hvm_change_state_handler(void *opaque, bool running, + RunState rstate) +{ + XenIOState *state =3D opaque; + + if (running) { + xen_main_loop_prepare(state); + } + + xen_set_ioreq_server_state(xen_domid, + state->ioservid, + (rstate =3D=3D RUN_STATE_RUNNING)); +} + +void xen_exit_notifier(Notifier *n, void *data) +{ + XenIOState *state =3D container_of(n, XenIOState, exit); + + xen_destroy_ioreq_server(xen_domid, state->ioservid); + if (state->fres !=3D NULL) { + xenforeignmemory_unmap_resource(xen_fmem, state->fres); + } + + qemu_xen_evtchn_close(state->xce_handle); + xs_daemon_close(state->xenstore); +} + +static int xen_map_ioreq_server(XenIOState *state) +{ + void *addr =3D NULL; + xen_pfn_t ioreq_pfn; + xen_pfn_t bufioreq_pfn; + evtchn_port_t bufioreq_evtchn; + int rc; + + /* + * Attempt to map using the resource API and fall back to normal + * foreign mapping if this is not supported. + */ + QEMU_BUILD_BUG_ON(XENMEM_resource_ioreq_server_frame_bufioreq !=3D 0); + QEMU_BUILD_BUG_ON(XENMEM_resource_ioreq_server_frame_ioreq(0) !=3D 1); + state->fres =3D xenforeignmemory_map_resource(xen_fmem, xen_domid, + XENMEM_resource_ioreq_server, + state->ioservid, 0, 2, + &addr, + PROT_READ | PROT_WRITE, 0); + if (state->fres !=3D NULL) { + trace_xen_map_resource_ioreq(state->ioservid, addr); + state->buffered_io_page =3D addr; + state->shared_page =3D addr + XC_PAGE_SIZE; + } else if (errno !=3D EOPNOTSUPP) { + error_report("failed to map ioreq server resources: error %d handl= e=3D%p", + errno, xen_xc); + return -1; + } + + rc =3D xen_get_ioreq_server_info(xen_domid, state->ioservid, + (state->shared_page =3D=3D NULL) ? + &ioreq_pfn : NULL, + (state->buffered_io_page =3D=3D NULL) ? + &bufioreq_pfn : NULL, + &bufioreq_evtchn); + if (rc < 0) { + error_report("failed to get ioreq server info: error %d handle=3D%= p", + errno, xen_xc); + return rc; + } + + if (state->shared_page =3D=3D NULL) { + DPRINTF("shared page at pfn %lx\n", ioreq_pfn); + + state->shared_page =3D xenforeignmemory_map(xen_fmem, xen_domid, + PROT_READ | PROT_WRITE, + 1, &ioreq_pfn, NULL); + if (state->shared_page =3D=3D NULL) { + error_report("map shared IO page returned error %d handle=3D%p= ", + errno, xen_xc); + } + } + + if (state->buffered_io_page =3D=3D NULL) { + DPRINTF("buffered io page at pfn %lx\n", bufioreq_pfn); + + state->buffered_io_page =3D xenforeignmemory_map(xen_fmem, xen_dom= id, + PROT_READ | PROT_WR= ITE, + 1, &bufioreq_pfn, + NULL); + if (state->buffered_io_page =3D=3D NULL) { + error_report("map buffered IO page returned error %d", errno); + return -1; + } + } + + if (state->shared_page =3D=3D NULL || state->buffered_io_page =3D=3D N= ULL) { + return -1; + } + + DPRINTF("buffered io evtchn is %x\n", bufioreq_evtchn); + + state->bufioreq_remote_port =3D bufioreq_evtchn; + + return 0; +} + +void destroy_hvm_domain(bool reboot) +{ + xc_interface *xc_handle; + int sts; + int rc; + + unsigned int reason =3D reboot ? SHUTDOWN_reboot : SHUTDOWN_poweroff; + + if (xen_dmod) { + rc =3D xendevicemodel_shutdown(xen_dmod, xen_domid, reason); + if (!rc) { + return; + } + if (errno !=3D ENOTTY /* old Xen */) { + perror("xendevicemodel_shutdown failed"); + } + /* well, try the old thing then */ + } + + xc_handle =3D xc_interface_open(0, 0, 0); + if (xc_handle =3D=3D NULL) { + fprintf(stderr, "Cannot acquire xenctrl handle\n"); + } else { + sts =3D xc_domain_shutdown(xc_handle, xen_domid, reason); + if (sts !=3D 0) { + fprintf(stderr, "xc_domain_shutdown failed to issue %s, " + "sts %d, %s\n", reboot ? "reboot" : "poweroff", + sts, strerror(errno)); + } else { + fprintf(stderr, "Issued domain %d %s\n", xen_domid, + reboot ? "reboot" : "poweroff"); + } + xc_interface_close(xc_handle); + } +} + +void xen_shutdown_fatal_error(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + fprintf(stderr, "Will destroy the domain.\n"); + /* destroy the domain */ + qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_ERROR); +} + +void xen_register_ioreq(XenIOState *state, unsigned int max_cpus, + MemoryListener xen_memory_listener) +{ + int i, rc; + + setup_xen_backend_ops(); + + state->xce_handle =3D qemu_xen_evtchn_open(); + if (state->xce_handle =3D=3D NULL) { + perror("xen: event channel open"); + goto err; + } + + state->xenstore =3D xs_daemon_open(); + if (state->xenstore =3D=3D NULL) { + perror("xen: xenstore open"); + goto err; + } + + xen_create_ioreq_server(xen_domid, &state->ioservid); + + state->exit.notify =3D xen_exit_notifier; + qemu_add_exit_notifier(&state->exit); + + /* + * Register wake-up support in QMP query-current-machine API + */ + qemu_register_wakeup_support(); + + rc =3D xen_map_ioreq_server(state); + if (rc < 0) { + goto err; + } + + /* Note: cpus is empty at this point in init */ + state->cpu_by_vcpu_id =3D g_malloc0(max_cpus * sizeof(CPUState *)); + + rc =3D xen_set_ioreq_server_state(xen_domid, state->ioservid, true); + if (rc < 0) { + error_report("failed to enable ioreq server info: error %d handle= =3D%p", + errno, xen_xc); + goto err; + } + + state->ioreq_local_port =3D g_malloc0(max_cpus * sizeof (evtchn_port_t= )); + + /* FIXME: how about if we overflow the page here? */ + for (i =3D 0; i < max_cpus; i++) { + rc =3D qemu_xen_evtchn_bind_interdomain(state->xce_handle, xen_dom= id, + xen_vcpu_eport(state->shared= _page, + i)); + if (rc =3D=3D -1) { + error_report("shared evtchn %d bind error %d", i, errno); + goto err; + } + state->ioreq_local_port[i] =3D rc; + } + + rc =3D qemu_xen_evtchn_bind_interdomain(state->xce_handle, xen_domid, + state->bufioreq_remote_port); + if (rc =3D=3D -1) { + error_report("buffered evtchn bind error %d", errno); + goto err; + } + state->bufioreq_local_port =3D rc; + + /* Init RAM management */ +#ifdef XEN_COMPAT_PHYSMAP + xen_map_cache_init(xen_phys_offset_to_gaddr, state); +#else + xen_map_cache_init(NULL, state); +#endif + + qemu_add_vm_change_state_handler(xen_hvm_change_state_handler, state); + + state->memory_listener =3D xen_memory_listener; + memory_listener_register(&state->memory_listener, &address_space_memor= y); + + state->io_listener =3D xen_io_listener; + memory_listener_register(&state->io_listener, &address_space_io); + + state->device_listener =3D xen_device_listener; + QLIST_INIT(&state->dev_list); + device_listener_register(&state->device_listener); + + xen_bus_init(); + + xen_be_init(); + + return; +err: + error_report("xen hardware virtual machine initialisation failed"); + exit(1); +} diff --git a/include/hw/i386/xen_arch_hvm.h b/include/hw/i386/xen_arch_hvm.h new file mode 100644 index 0000000000..1000f8f543 --- /dev/null +++ b/include/hw/i386/xen_arch_hvm.h @@ -0,0 +1,11 @@ +#ifndef HW_XEN_ARCH_I386_HVM_H +#define HW_XEN_ARCH_I386_HVM_H + +#include +#include "hw/xen/xen-hvm-common.h" + +void arch_handle_ioreq(XenIOState *state, ioreq_t *req); +void arch_xen_set_memory(XenIOState *state, + MemoryRegionSection *section, + bool add); +#endif diff --git a/include/hw/xen/arch_hvm.h b/include/hw/xen/arch_hvm.h new file mode 100644 index 0000000000..26674648d8 --- /dev/null +++ b/include/hw/xen/arch_hvm.h @@ -0,0 +1,3 @@ +#if defined(TARGET_I386) || defined(TARGET_X86_64) +#include "hw/i386/xen_arch_hvm.h" +#endif diff --git a/include/hw/xen/xen-hvm-common.h b/include/hw/xen/xen-hvm-commo= n.h new file mode 100644 index 0000000000..f9559e2885 --- /dev/null +++ b/include/hw/xen/xen-hvm-common.h @@ -0,0 +1,99 @@ +#ifndef HW_XEN_HVM_COMMON_H +#define HW_XEN_HVM_COMMON_H + +#include "qemu/osdep.h" +#include "qemu/units.h" + +#include "cpu.h" +#include "hw/pci/pci.h" +#include "hw/hw.h" +#include "hw/xen/xen_native.h" +#include "hw/xen/xen-legacy-backend.h" +#include "sysemu/runstate.h" +#include "sysemu/sysemu.h" +#include "sysemu/xen.h" +#include "sysemu/xen-mapcache.h" +#include "qemu/error-report.h" +#include + +extern MemoryRegion ram_memory; +extern MemoryListener xen_io_listener; +extern DeviceListener xen_device_listener; + +//#define DEBUG_XEN_HVM + +#ifdef DEBUG_XEN_HVM +#define DPRINTF(fmt, ...) \ + do { fprintf(stderr, "xen: " fmt, ## __VA_ARGS__); } while (0) +#else +#define DPRINTF(fmt, ...) \ + do { } while (0) +#endif + +static inline uint32_t xen_vcpu_eport(shared_iopage_t *shared_page, int i) +{ + return shared_page->vcpu_ioreq[i].vp_eport; +} +static inline ioreq_t *xen_vcpu_ioreq(shared_iopage_t *shared_page, int vc= pu) +{ + return &shared_page->vcpu_ioreq[vcpu]; +} + +#define BUFFER_IO_MAX_DELAY 100 + +typedef struct XenPhysmap { + hwaddr start_addr; + ram_addr_t size; + const char *name; + hwaddr phys_offset; + + QLIST_ENTRY(XenPhysmap) list; +} XenPhysmap; + +typedef struct XenPciDevice { + PCIDevice *pci_dev; + uint32_t sbdf; + QLIST_ENTRY(XenPciDevice) entry; +} XenPciDevice; + +typedef struct XenIOState { + ioservid_t ioservid; + shared_iopage_t *shared_page; + buffered_iopage_t *buffered_io_page; + xenforeignmemory_resource_handle *fres; + QEMUTimer *buffered_io_timer; + CPUState **cpu_by_vcpu_id; + /* the evtchn port for polling the notification, */ + evtchn_port_t *ioreq_local_port; + /* evtchn remote and local ports for buffered io */ + evtchn_port_t bufioreq_remote_port; + evtchn_port_t bufioreq_local_port; + /* the evtchn fd for polling */ + xenevtchn_handle *xce_handle; + /* which vcpu we are serving */ + int send_vcpu; + + struct xs_handle *xenstore; + MemoryListener memory_listener; + MemoryListener io_listener; + QLIST_HEAD(, XenPciDevice) dev_list; + DeviceListener device_listener; + + Notifier exit; +} XenIOState; + +void xen_exit_notifier(Notifier *n, void *data); + +void xen_region_add(MemoryListener *listener, MemoryRegionSection *section= ); +void xen_region_del(MemoryListener *listener, MemoryRegionSection *section= ); +void xen_io_add(MemoryListener *listener, MemoryRegionSection *section); +void xen_io_del(MemoryListener *listener, MemoryRegionSection *section); +void xen_device_realize(DeviceListener *listener, DeviceState *dev); +void xen_device_unrealize(DeviceListener *listener, DeviceState *dev); + +void xen_hvm_change_state_handler(void *opaque, bool running, RunState rst= ate); +void xen_register_ioreq(XenIOState *state, unsigned int max_cpus, + MemoryListener xen_memory_listener); + +void cpu_ioreq_pio(ioreq_t *req); +#endif /* HW_XEN_HVM_COMMON_H */ --=20 2.17.1 From nobody Wed May 1 19:49:04 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1686158140; cv=pass; d=zohomail.com; s=zohoarc; b=g4kHivlV2C9oY30018ha8gaIcF+hTkeKb9luhARZDFwCZxIWd090WQAthkyCBQJMG+kz2aZpEVBabAP1a7+3rPSzsxCdeXumYa0mZ6nYucQxLc9zFh3FtlNj3gZs6Wdbrpa/0PRIRyM/6tb33ppwRO3SBc+SWhs4N90R7Hj+78w= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686158140; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/+MsXx2C2vfZr2Qm3zKi15wdouNswZ682yQUmM+5jY4=; b=er+TVgB5GNkFdCMkVfsh8CKNoKf1+B2dHWoxwM386ssja3SAu5OQXG6fRkHPz2m8CFnpeOIi9Btg6mvfERyOuGlCgYDogsmAlJ2B2ugF6Xwe69SgN0FE3Fan288B+bi5rEarcu8FtetRndnb1dCJvpqu/dq+iRukmKoIzW6z3P4= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686158140866549.4245910002983; Wed, 7 Jun 2023 10:15:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6wkQ-0008Pd-Rq; Wed, 07 Jun 2023 13:15:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6wkO-0008OP-Bm for qemu-devel@nongnu.org; Wed, 07 Jun 2023 13:15:01 -0400 Received: from mail-mw2nam12on20604.outbound.protection.outlook.com ([2a01:111:f400:fe5a::604] helo=NAM12-MW2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6wkM-0005tZ-HF for qemu-devel@nongnu.org; Wed, 07 Jun 2023 13:15:00 -0400 Received: from CY5PR19CA0082.namprd19.prod.outlook.com (2603:10b6:930:69::28) by PH7PR12MB9201.namprd12.prod.outlook.com (2603:10b6:510:2e8::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32; Wed, 7 Jun 2023 17:14:54 +0000 Received: from CY4PEPF0000EE39.namprd03.prod.outlook.com (2603:10b6:930:69:cafe::ae) by CY5PR19CA0082.outlook.office365.com (2603:10b6:930:69::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.19 via Frontend Transport; Wed, 7 Jun 2023 17:14:53 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000EE39.mail.protection.outlook.com (10.167.242.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6477.13 via Frontend Transport; Wed, 7 Jun 2023 17:14:53 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 7 Jun 2023 12:14:53 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 7 Jun 2023 10:14:52 -0700 Received: from xsjfnuv50.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Wed, 7 Jun 2023 12:14:52 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QjSOqNAIySM4JAPBaHPXfAw1sF8Rtjvb0jC0l/B6VLszaIpWk9cz5Uv8iWxagnVHqMlvuAboIlcuJ3oegfSxAopnXwBNi75gSj6/m2FebdfYjPSn/gtIt+C0NzNN5+PxDWILiJLVdw/Dbdu/gLMAX/DBgnhbqUPPR2/5Ov3Mv4KprZZdqkSOr+SFIvPo8LYS4eyVA2N3909/ziTAe5SUIxymxSjKBF2czB+lFRwTDxmdaq0KPwSuB1zXpF7CgZ1ohFJ0C4ojxPGr+K2fVsXnuHqMxg/8oCb/M4upllXs3kaTnEoPNW/jg01GP6dn2oi3vt9EPiSsu9Zk19ewepUgQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/+MsXx2C2vfZr2Qm3zKi15wdouNswZ682yQUmM+5jY4=; b=ZLktXNNJuKnQnTg501Xl1sQVFBMnUZoIMYQUKZsXeMu11zMv1sqwouWIDKrssOxudRBTpSh24B6P//SmPAMzaxacfpK62lHGwBTlRq9mCJ+zVJY7qlE1I4dwMJ6KnUAD1OtCrSx9zhjyez83QgrQDgLdIqDTgtvWu8ey3klf7oL/tPahLhXzUv+HHgftVtwfWaUaO8jZmTt+PbddxA7Gp6RdHlPRJ99pFPSVOS29hytjmZO2RzkWZx27S74gry2hJRKdZbwisVUV92TunffzJeivBwiBgt/XssXfFSyVBIX+HhmPqiOTj8hw9yT73dA/kmMyg/gjbBKXFfCe6cwAYA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/+MsXx2C2vfZr2Qm3zKi15wdouNswZ682yQUmM+5jY4=; b=b7AM66erG4YHmncKXvyDPoo0AAncQdt+CmBqjD0+ptzm3qbzrM5wligXWJO0v6ue77rnr4UaSFwAEBP1p9/4teSds+LFZU3RsKhsNiN7/6LDAw8RYVLOEeyD3oFQoD1EVeUMUJqlpwphiDJ78qHaecknSjAvZCrjGaanTQcFjhE= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C From: Vikram Garhwal To: CC: , , Stefano Stabellini Subject: [QEMU][PATCH v7 05/10] include/hw/xen/xen_common: return error from xen_create_ioreq_server Date: Wed, 7 Jun 2023 10:04:54 -0700 Message-ID: <20230607170459.14722-6-vikram.garhwal@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230607170459.14722-1-vikram.garhwal@amd.com> References: <20230607170459.14722-1-vikram.garhwal@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE39:EE_|PH7PR12MB9201:EE_ X-MS-Office365-Filtering-Correlation-Id: 00ba29e7-3b52-4ac6-5902-08db677ab5fa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aQLeP520E1Szze00HTcT7aDdrCR/LoumiPfQkzZ5O2pNaIVbq/sHa16RJx1bw9Zu3ujkB6xnju+BZ3caVistO+9+WrTTJxuuOOSS9NRbxUgWmZZcPlywx4e1rFaHeXgz71IrdwTWt0/vWTIxpiS4c//JCnrRd6XnGWNrhqIJNc5i7pFJj3XGHhK1NmHV3pH54TuQBg7BTdCaxUpf9Y8UpokuH0/EQQ89ufmePt3tY73Pqx2MCsvB592h+mNXDXmQ9b5kX2FgemSe0hSCYuV8tMw/42yVwvIrRlfPTQSJVcAP5iW2GlU0pHNFfHMGk2/Jp8ENEU2yWrf22HOTGoYUZLeJNVaPkH0u8qObp1TT/gdQuG0rDR1AMlWS7vBKDpDwvcUN4VD173BvywnKudTECXcTOY0XyHJJedESIJ3TKtgTi0IfvDFGw62omX32kyNn6NzefG4JjzwPfAqfI+8WHcOMwKmxQcN/zILGetoRMl6JraZ5ld9zQ/wbkddBmBDJ72nwDBH4knJAsutYtVfB17sqaVawnW/fP1b7V9BRY6HfmErmQJvkAzjZZlnzXjq/V8qMP1uucyMETkwYRkCFjpFVqRerNmoSTuD8qYtbABCwlkG0oV3L4wx+nBXtLuVKadQD/oXy1yDeRt7iLUxVnbuJ9EREytSoHDzZw2hIitvDOXT1zdqJtEIHAxxlE+/yIbKhjMbhHHvFsunnpKTUc1U8IxtfNYqU/Kzn47ePM/vH+OuC9O+wN9WIhRs6yfifGPQMk8FfxUm1yZRw4+U83w== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(376002)(396003)(39860400002)(136003)(346002)(451199021)(36840700001)(46966006)(40470700004)(47076005)(83380400001)(426003)(336012)(82740400003)(478600001)(44832011)(40480700001)(40460700003)(8676002)(8936002)(41300700001)(70206006)(70586007)(81166007)(356005)(316002)(6916009)(5660300002)(4326008)(86362001)(36756003)(2906002)(82310400005)(54906003)(36860700001)(26005)(186003)(1076003)(2616005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2023 17:14:53.8717 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 00ba29e7-3b52-4ac6-5902-08db677ab5fa X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000EE39.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB9201 Received-SPF: softfail client-ip=2a01:111:f400:fe5a::604; envelope-from=vikram.garhwal@amd.com; helo=NAM12-MW2-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1686158143054100009 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Stefano Stabellini This is done to prepare for enabling xenpv support for ARM architecture. On ARM it is possible to have a functioning xenpv machine with only the PV backends and no IOREQ server. If the IOREQ server creation fails, continue to the PV backends initialization. Signed-off-by: Stefano Stabellini Signed-off-by: Vikram Garhwal Reviewed-by: Stefano Stabellini Reviewed-by: Paul Durrant --- include/hw/xen/xen_native.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/include/hw/xen/xen_native.h b/include/hw/xen/xen_native.h index 6bcc83baf9..8b01b071e5 100644 --- a/include/hw/xen/xen_native.h +++ b/include/hw/xen/xen_native.h @@ -433,9 +433,10 @@ static inline void xen_unmap_pcidev(domid_t dom, { } =20 -static inline void xen_create_ioreq_server(domid_t dom, - ioservid_t *ioservid) +static inline int xen_create_ioreq_server(domid_t dom, + ioservid_t *ioservid) { + return 0; } =20 static inline void xen_destroy_ioreq_server(domid_t dom, @@ -566,8 +567,8 @@ static inline void xen_unmap_pcidev(domid_t dom, PCI_FUNC(pci_dev->devfn)= ); } =20 -static inline void xen_create_ioreq_server(domid_t dom, - ioservid_t *ioservid) +static inline int xen_create_ioreq_server(domid_t dom, + ioservid_t *ioservid) { int rc =3D xendevicemodel_create_ioreq_server(xen_dmod, dom, HVM_IOREQSRV_BUFIOREQ_ATOM= IC, @@ -575,12 +576,14 @@ static inline void xen_create_ioreq_server(domid_t do= m, =20 if (rc =3D=3D 0) { trace_xen_ioreq_server_create(*ioservid); - return; + return rc; } =20 *ioservid =3D 0; use_default_ioreq_server =3D true; trace_xen_default_ioreq_server(); + + return rc; } =20 static inline void xen_destroy_ioreq_server(domid_t dom, --=20 2.17.1 From nobody Wed May 1 19:49:04 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1686158141; cv=pass; d=zohomail.com; s=zohoarc; b=W4R49kN67jRQ40XlQCfaLhCOEXKS2u/eyUscAV4xTTuRY+sZWDFXKW7dkuyc/0irl4OtQWxm4aPvSNzNXMrsv9vGDC/9Z7LG1QqMHWkzILriJjJlZsZ3ac9ZxCGNahWqoRGhkUvm6k064DOgsUD2TVvvPhuhT36bmH9ltqjQiVo= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686158141; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ZW0E+n9RRUnGndVzyavBgx17Uvpm/5a+kbmKjIpu9A4=; b=GATFxOsHqjCn24ObAy5iXYj8FQCZJ7m97FMKzWJ4HCACYCQ59sII3MPqJoKZKiSNGwx/hfltbKZxRXKqX4FIqj5eftsDRHpeaNo/mI1VXwhCmzIWnl8nQysv4RrPw4Xu+dZkXSGBnc5XYG0h7UZWhNxHod3OyX4MwHO+WFBwZT0= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686158141761946.0985879076082; Wed, 7 Jun 2023 10:15:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6wkS-0008QU-Rg; Wed, 07 Jun 2023 13:15:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6wkP-0008PJ-Vy for qemu-devel@nongnu.org; Wed, 07 Jun 2023 13:15:02 -0400 Received: from mail-bn1nam02on20614.outbound.protection.outlook.com ([2a01:111:f400:7eb2::614] helo=NAM02-BN1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6wkN-0005vJ-Gd for qemu-devel@nongnu.org; Wed, 07 Jun 2023 13:15:01 -0400 Received: from DM6PR07CA0105.namprd07.prod.outlook.com (2603:10b6:5:330::8) by SJ2PR12MB8739.namprd12.prod.outlook.com (2603:10b6:a03:549::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Wed, 7 Jun 2023 17:14:56 +0000 Received: from CY4PEPF0000E9CF.namprd03.prod.outlook.com (2603:10b6:5:330:cafe::af) by DM6PR07CA0105.outlook.office365.com (2603:10b6:5:330::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33 via Frontend Transport; Wed, 7 Jun 2023 17:14:56 +0000 Received: from SATLEXMB03.amd.com (165.204.84.17) by CY4PEPF0000E9CF.mail.protection.outlook.com (10.167.241.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6477.13 via Frontend Transport; Wed, 7 Jun 2023 17:14:55 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 7 Jun 2023 12:14:53 -0500 Received: from xsjfnuv50.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Wed, 7 Jun 2023 12:14:53 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jAjhGAavfWMI7TbYgXANG2u7Dkm9D+eYjSeNUeaSyoTZjPV9cHtMzHYVCS+zJhKhW5/FOOa22m2ISa/lan9njFZbgM7r6sz84sstbHTlq1CXoD8akMeugh/+d2QqhUSXgg80Kf574KQqiesZdudQtYPXvYwjv8NmX8N4HTMvBmP164BG3dZTJPBJQhqCfCfyRCdiSiZqCLCi6VBb7+r0Qd6SO+4gfebKSu8GbuzCsqmfQ4OQizqRs+RIlkJE/v347ltonePho+h5ZNyXvmlSD1dOglayWP4tE8lEF9dqamAc/lkUDtWJ2Yo8RDx+VBwSGwht8qW92H3GKIwFD0q+2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZW0E+n9RRUnGndVzyavBgx17Uvpm/5a+kbmKjIpu9A4=; b=d4BQRnHCrF+UtGRdWO77flCs3u4y5Dx2da37V3jbGH6ZwQ2sGzrcY+ruGdfCvFLMjMvBlMv+q/t8FbiN+N4PYjfATTTHFQqP1G5bIX9tqZm9I6YpO5ZophELNGa8Mg9qjTXSNKNyukxKRLf6qUIUTf9I19X8GgVbcrXg14O3j2RRU0DYje9fGaWpkLojSV2eH6uhUOrqOMAu2y6oa4SaEnRLEO9ZckTvYQAOcbcYi6bwUBcgqPyeKHR5b8WHX2AYF0ZaJwsQ8+thDKTNHaYxK1kPILhk+D6mBRqaOyPSWB8C2y6C9uVcXlzPu2jzK0RDYKUniiFSzwnUmTXNt/gxqA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZW0E+n9RRUnGndVzyavBgx17Uvpm/5a+kbmKjIpu9A4=; b=13hi/thcGrcsWeAgrNdJeVpYs4BWuhRCL/XZq6r2rolkv9rgAKvq+Xb02cPkB6ZzgXH2TOa4lLfylmC/iycau4zJeS6V824m0VRQOmrjgLbRQImwOaBgLXIu1IS4WVtiCg+OhIwCfAlpg5HMo24jnqQ+X+zsqJvOefyE7VbIECU= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C From: Vikram Garhwal To: CC: , , Stefano Stabellini Subject: [QEMU][PATCH v7 06/10] hw/xen/xen-hvm-common: skip ioreq creation on ioreq registration failure Date: Wed, 7 Jun 2023 10:04:55 -0700 Message-ID: <20230607170459.14722-7-vikram.garhwal@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230607170459.14722-1-vikram.garhwal@amd.com> References: <20230607170459.14722-1-vikram.garhwal@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9CF:EE_|SJ2PR12MB8739:EE_ X-MS-Office365-Filtering-Correlation-Id: 076eba23-d7ca-4392-18eb-08db677ab71f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Opyz7fjPwpLWUXGUUuOBIjmNeo3fQ0VkchHwoRl2SmFWXPaghu7AqJuf7/a1QTL08CCU+m6W3JjDyuvzASEEHjQB3jhQoHlglMnlOM0arHRJN8u1E4/3WmBiq7SatiImaXrC5T7jLdZRZQYOAlaTYsCQeboeG53BX5Yp3qmIp3fvigK9rBTM7ckuUyiUcndoobCmBQJ7j4NahFO76udhd4H1RdTg/U1VuGyyZ2RpOe4yS5EfMdhO51o1qOIPJNnjmNGFkhL4IK0Y1KNH1tdMv8U4RgqGn8mHO9xhwf0jLVniP0MH8YCmym0QaFMYrH+AwKGaH9pyn53nbOo7gN5+1M4oe9H/xko2mvOEZEMICpCxaz3+FO17SGzAR3fDuJ8YakmS+L/Pg3WZaHDYA5gzy4K+khiYT4BTP1a1uJ/gGDH3tyh8ZMI5Wi9dUnYaQoc8/94tYyZXa4GUIQ4WMu4klaCo4GfUxmAvKHdYf6ij+hma/LX/S7e3/pt7JHXM5NSWkKNr5E/5L02AoylfhLtZVxSuB6yeqg3n6Bstz8Xs+0H88MRV44m/8Wf+bAJ18S0VOOO818m2Yt4RD58HaKIegFpuCkeNztFHtP7+HCFLLAnDdw1waY3w0wBgF6gpF4oScf23sj+H8sW7XmE3uJNMy7LyLeVfC5md1PxMUwL9iAVaUjF1V810EXY7tPEWVwhzyAYfYonaydI4Aq6mc/EdKKBUP6JDn0V3xzLx/HmOvoYOKllqlKNxje42vgZ3i7nKbCqE2WY4Y1CjByurrlK/5g== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(396003)(39860400002)(376002)(136003)(346002)(451199021)(40470700004)(36840700001)(46966006)(40460700003)(2906002)(478600001)(47076005)(36860700001)(426003)(1076003)(186003)(82310400005)(83380400001)(2616005)(26005)(86362001)(82740400003)(81166007)(356005)(336012)(36756003)(70206006)(40480700001)(4326008)(6916009)(70586007)(5660300002)(44832011)(8936002)(8676002)(316002)(54906003)(41300700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2023 17:14:55.7902 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 076eba23-d7ca-4392-18eb-08db677ab71f X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000E9CF.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8739 Received-SPF: softfail client-ip=2a01:111:f400:7eb2::614; envelope-from=vikram.garhwal@amd.com; helo=NAM02-BN1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1686158142852100007 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Stefano Stabellini On ARM it is possible to have a functioning xenpv machine with only the PV backends and no IOREQ server. If the IOREQ server creation fails continue to the PV backends initialization. Also, moved the IOREQ registration and mapping subroutine to new function xen_do_ioreq_register(). Signed-off-by: Stefano Stabellini Signed-off-by: Vikram Garhwal Reviewed-by: Stefano Stabellini Reviewed-by: Paul Durrant --- hw/xen/xen-hvm-common.c | 57 +++++++++++++++++++++++++++-------------- 1 file changed, 38 insertions(+), 19 deletions(-) diff --git a/hw/xen/xen-hvm-common.c b/hw/xen/xen-hvm-common.c index a31b067404..cb82f4b83d 100644 --- a/hw/xen/xen-hvm-common.c +++ b/hw/xen/xen-hvm-common.c @@ -764,27 +764,12 @@ void xen_shutdown_fatal_error(const char *fmt, ...) qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_ERROR); } =20 -void xen_register_ioreq(XenIOState *state, unsigned int max_cpus, - MemoryListener xen_memory_listener) +static void xen_do_ioreq_register(XenIOState *state, + unsigned int max_cpus, + MemoryListener xen_memory_liste= ner) { int i, rc; =20 - setup_xen_backend_ops(); - - state->xce_handle =3D qemu_xen_evtchn_open(); - if (state->xce_handle =3D=3D NULL) { - perror("xen: event channel open"); - goto err; - } - - state->xenstore =3D xs_daemon_open(); - if (state->xenstore =3D=3D NULL) { - perror("xen: xenstore open"); - goto err; - } - - xen_create_ioreq_server(xen_domid, &state->ioservid); - state->exit.notify =3D xen_exit_notifier; qemu_add_exit_notifier(&state->exit); =20 @@ -849,12 +834,46 @@ void xen_register_ioreq(XenIOState *state, unsigned i= nt max_cpus, QLIST_INIT(&state->dev_list); device_listener_register(&state->device_listener); =20 + return; + +err: + error_report("xen hardware virtual machine initialisation failed"); + exit(1); +} + +void xen_register_ioreq(XenIOState *state, unsigned int max_cpus, + MemoryListener xen_memory_listener) +{ + int rc; + + setup_xen_backend_ops(); + + state->xce_handle =3D qemu_xen_evtchn_open(); + if (state->xce_handle =3D=3D NULL) { + perror("xen: event channel open"); + goto err; + } + + state->xenstore =3D xs_daemon_open(); + if (state->xenstore =3D=3D NULL) { + perror("xen: xenstore open"); + goto err; + } + + rc =3D xen_create_ioreq_server(xen_domid, &state->ioservid); + if (!rc) { + xen_do_ioreq_register(state, max_cpus, xen_memory_listener); + } else { + warn_report("xen: failed to create ioreq server"); + } + xen_bus_init(); =20 xen_be_init(); =20 return; + err: - error_report("xen hardware virtual machine initialisation failed"); + error_report("xen hardware virtual machine backend registration failed= "); exit(1); } --=20 2.17.1 From nobody Wed May 1 19:49:04 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1686158168; cv=pass; d=zohomail.com; s=zohoarc; b=YmeuD7qsVG/wb6NiJYo9sNFzuV/tGPt81HEJQ9q+afqfUkLNsP13vq5u2JNZQ5tiuiA3lBTRBPq/RGt/tKvEUN5ij4MuMO3PdQikj7+LsxEdLp05b9vf/2aYogMLdAGuWkVbvvdhWbSuu32RTkOcqlQuLok8AkRyEitheEO9/cc= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686158168; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=mOsqWHq5VHxUgGsBfaYThNjh0r5g1aFE14BtltHtrOE=; b=bBw0thiI9VySlvUVIUTvCTUqw5wzUT0AkfLGf9L/VV6Nv8eyPbxhGPh94gIeMGXYc55fnlQ7X4yM2Lt8P7K7p9EWYPGKQEvfhxrbZayUy/Mt4r+xc5ss4FABeYi+BBuS5wFFbYUP00OQ1F42TulsPtz0bEuA+QnQ5HKSy+Ok3Ao= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686158168015869.4819236497883; Wed, 7 Jun 2023 10:16:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6wkP-0008OY-Hq; Wed, 07 Jun 2023 13:15:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6wkO-0008ON-4n for qemu-devel@nongnu.org; Wed, 07 Jun 2023 13:15:00 -0400 Received: from mail-dm6nam10on20627.outbound.protection.outlook.com ([2a01:111:f400:7e88::627] helo=NAM10-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6wkM-0005tb-8k for qemu-devel@nongnu.org; Wed, 07 Jun 2023 13:14:59 -0400 Received: from CY5PR19CA0061.namprd19.prod.outlook.com (2603:10b6:930:69::7) by BN9PR12MB5339.namprd12.prod.outlook.com (2603:10b6:408:104::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Wed, 7 Jun 2023 17:14:55 +0000 Received: from CY4PEPF0000EE39.namprd03.prod.outlook.com (2603:10b6:930:69:cafe::28) by CY5PR19CA0061.outlook.office365.com (2603:10b6:930:69::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.19 via Frontend Transport; Wed, 7 Jun 2023 17:14:54 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000EE39.mail.protection.outlook.com (10.167.242.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6477.13 via Frontend Transport; Wed, 7 Jun 2023 17:14:54 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 7 Jun 2023 12:14:54 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB06.amd.com (10.181.40.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 7 Jun 2023 12:14:53 -0500 Received: from xsjfnuv50.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Wed, 7 Jun 2023 12:14:53 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Aq9WMLmcRK00LIJFwl12ZivOOiZ3orsgXd+kILEdApkSaV07O2DRkLvHGe+Z6Ay4Iz8CN2RQqTkbKtVo8V8ZCN4S+cDZcfl0gk89oL2qEIyxYEjjS/jgwLRy8ibxAVAM9T5pM7RXRd3CJG3ihDafF5GEwAJsskqquTHtwQFZnFZCrenmT/vd4YIIkRTejJFP12Xl4yiZs0zGC2dZviRQ5342xJq4T3GDEhto43uiXln1hF/kC+jeMjPet530icvhGbNqellqiTg3ee9H6NLRXT6Hu0FlzPUcZWhB8yc2121tUbu9eVpKOl5NjhQWltLwDWnjRXoL17pNwuv/HZkgHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mOsqWHq5VHxUgGsBfaYThNjh0r5g1aFE14BtltHtrOE=; b=dHXgS6Fxh8wWe5vzaKcyOWMkw2tOEq/NAt2WLnOj9qyhXLCsl5OvGGtKMecsPDKPZS/fK3Zr1/fII3U5SIIDC2Nb04S/nga43DcLwJts5X6hIEuZvttaXFoilllhy1naaA02rQ0P015Lv+SgylK5CvAPtMnLqyYBLD5DREV8GDQspaiAhVIAXQSX4atkC5wLVT8GLDsExduCUGoNlTTSc+XcjyGMLHNe2KW1SEZUViVgOssgpvF2ij1CwCTmRr7TV8qe4FpwkdgljwNrke1TTcoJ70l5ry7jY7HgHh82aA2x2HcUcYfXqFhNGAtLqq6deWXbktgSu0ftA8cHkI1v/Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mOsqWHq5VHxUgGsBfaYThNjh0r5g1aFE14BtltHtrOE=; b=swfgr2rET17B2I26ocJL2sTnUJAn00UTe4KHuChz5s5QNfccOe7Rbq/Z8aZ+euF/kA3aDgPHqI0XlTvFyG89o2owBowASGyj/MQIFoi+DXmhbEn0AKxQ3i8KMlt/LnmRA21YHFTrdx54rgpySMS7IoPt4Fwd4V2B9P7j9ZRM+HM= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C From: Vikram Garhwal To: CC: , Subject: [QEMU][PATCH v7 07/10] hw/xen/xen-hvm-common: Use g_new and error_report Date: Wed, 7 Jun 2023 10:04:56 -0700 Message-ID: <20230607170459.14722-8-vikram.garhwal@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230607170459.14722-1-vikram.garhwal@amd.com> References: <20230607170459.14722-1-vikram.garhwal@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE39:EE_|BN9PR12MB5339:EE_ X-MS-Office365-Filtering-Correlation-Id: f09cbfd8-b7cd-41a5-cb61-08db677ab64d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: U+hViedXyJhjp8IDO7GLNAbC05RfppP0fIiLGZMHV/iCFL2PiYmfrKryiRKpRbElsz7tvYp3p5BzqOceTpFhw5INLl0wJ+X06PuITr+XAwAWT//g0DilOH6tW94lpA5U3chLlkLK1ZNCycIc5t01WRgYPXiDj8G3K8iOJfv0eyOjfyMoXdzV9Gp3riZ08MnRg4mrUxhoyB30yHLF1XUvvCimVOX4C+S8wYqe9DAtjFJU6uhHnSdoGDVX1a2igsFejQYY/+p7XxxlwT4Yj8ARMEaIcCMqUxfUUJzKoZbBFSEVg0VeYnyef2A0QPOYKeWJIW74jVd65QXq8QuzWceMyZGf9eQlz/VTiC5CDCWILlwVE3F81xnXdYOSrLCBn/XrfVjIotM/bZPB+SGrWCsA3ikRNlxrh94IbZV8GQQALb4hFCgdogONzE4ME7/7qhg6Zs93kKr2Wf5LL9Obc1iTdcsyroyqPLqWh/XNBAzaF9i+d0kbVZqVwt6eK4lYN8S44FU2R2jlr0Qsp9HyPCAqSiYugkQzuJ2AJhjP0fx0t7FJCFGbNdKCfuZl6Tf1OqX13teolrUbUmTKYlL+s6L3/HZGyWdOOJg1ACU+HbF688my1Qnfk68T5GhEUjLcb49bVwxGssHh5KEFhkEWWmQp7QY5hMKB8I0X2Ykv9a3Rfd0Oq4mGE3I0HrAXWw0F3TaPeDw0CnAmc55htsQ8DFH1BM9a74CNRxb4ZPJOquPfu38tmy28LZPrBHLwoGQTMcz3MIQyi+oNG1y7qyAK1hBOtQ== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(396003)(136003)(346002)(376002)(39860400002)(451199021)(40470700004)(46966006)(36840700001)(8936002)(8676002)(4326008)(478600001)(54906003)(41300700001)(316002)(5660300002)(1076003)(186003)(44832011)(70206006)(70586007)(26005)(6916009)(2616005)(47076005)(336012)(426003)(83380400001)(2906002)(40460700003)(81166007)(356005)(82740400003)(40480700001)(36860700001)(86362001)(82310400005)(36756003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2023 17:14:54.4186 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f09cbfd8-b7cd-41a5-cb61-08db677ab64d X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000EE39.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5339 Received-SPF: softfail client-ip=2a01:111:f400:7e88::627; envelope-from=vikram.garhwal@amd.com; helo=NAM10-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1686158169230100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Replace g_malloc with g_new and perror with error_report. Signed-off-by: Vikram Garhwal Reviewed-by: Stefano Stabellini Reviewed-by: Paul Durrant --- hw/xen/xen-hvm-common.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/xen/xen-hvm-common.c b/hw/xen/xen-hvm-common.c index cb82f4b83d..42339c96bd 100644 --- a/hw/xen/xen-hvm-common.c +++ b/hw/xen/xen-hvm-common.c @@ -33,7 +33,7 @@ void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size, = MemoryRegion *mr, trace_xen_ram_alloc(ram_addr, size); =20 nr_pfn =3D size >> TARGET_PAGE_BITS; - pfn_list =3D g_malloc(sizeof (*pfn_list) * nr_pfn); + pfn_list =3D g_new(xen_pfn_t, nr_pfn); =20 for (i =3D 0; i < nr_pfn; i++) { pfn_list[i] =3D (ram_addr >> TARGET_PAGE_BITS) + i; @@ -730,7 +730,7 @@ void destroy_hvm_domain(bool reboot) return; } if (errno !=3D ENOTTY /* old Xen */) { - perror("xendevicemodel_shutdown failed"); + error_report("xendevicemodel_shutdown failed with error %d", e= rrno); } /* well, try the old thing then */ } @@ -784,7 +784,7 @@ static void xen_do_ioreq_register(XenIOState *state, } =20 /* Note: cpus is empty at this point in init */ - state->cpu_by_vcpu_id =3D g_malloc0(max_cpus * sizeof(CPUState *)); + state->cpu_by_vcpu_id =3D g_new0(CPUState *, max_cpus); =20 rc =3D xen_set_ioreq_server_state(xen_domid, state->ioservid, true); if (rc < 0) { @@ -793,7 +793,7 @@ static void xen_do_ioreq_register(XenIOState *state, goto err; } =20 - state->ioreq_local_port =3D g_malloc0(max_cpus * sizeof (evtchn_port_t= )); + state->ioreq_local_port =3D g_new0(evtchn_port_t, max_cpus); =20 /* FIXME: how about if we overflow the page here? */ for (i =3D 0; i < max_cpus; i++) { @@ -850,13 +850,13 @@ void xen_register_ioreq(XenIOState *state, unsigned i= nt max_cpus, =20 state->xce_handle =3D qemu_xen_evtchn_open(); if (state->xce_handle =3D=3D NULL) { - perror("xen: event channel open"); + error_report("xen: event channel open failed with error %d", errno= ); goto err; } =20 state->xenstore =3D xs_daemon_open(); if (state->xenstore =3D=3D NULL) { - perror("xen: xenstore open"); + error_report("xen: xenstore open failed with error %d", errno); goto err; } =20 --=20 2.17.1 From nobody Wed May 1 19:49:04 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1686158299; cv=pass; d=zohomail.com; s=zohoarc; b=ASoRRIfK3yoMx8UQAjy7payT33BeMDz2VNzfpEFYO1SK04S9IHjkiLEBnL6f4Dh+J534AORGKYSEx2sH7QpV1g53g5Swyj1D/BnEwi0Lc8/x02avsthXCOfGD7RRarlVFMaTIQIyvKF5R+1A9dK++4gPV76mO2Tb8+lE7VGVhys= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686158299; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=R1s7hiqeZJSWKMtzOXD71YKZXs3yYFRh5uwgvUfLYPI=; b=QU+SNod5USvNM3BaXj7Tpmfr1IS8nMFOakAdMDEX81M4E8KHYPVyxd39pQFwn87go2rHaGO0Witoh/2S18SAmIlVYkGwCFFRUosRhv1TTrNHCGlgEv3pWM4oOaq1Bw24seZ6aiJyQNJTXTBjlrIWbJPHoXGCHTVInxkjv1wAO/w= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686158299326927.5361806222787; Wed, 7 Jun 2023 10:18:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6wkl-0008UA-KP; Wed, 07 Jun 2023 13:15:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6wkY-0008SV-VQ for qemu-devel@nongnu.org; Wed, 07 Jun 2023 13:15:11 -0400 Received: from mail-dm6nam12on20622.outbound.protection.outlook.com ([2a01:111:f400:fe59::622] helo=NAM12-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6wkW-00067N-7c for qemu-devel@nongnu.org; Wed, 07 Jun 2023 13:15:10 -0400 Received: from DM6PR07CA0113.namprd07.prod.outlook.com (2603:10b6:5:330::16) by LV3PR12MB9216.namprd12.prod.outlook.com (2603:10b6:408:1a5::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Wed, 7 Jun 2023 17:15:04 +0000 Received: from CY4PEPF0000E9CF.namprd03.prod.outlook.com (2603:10b6:5:330:cafe::c8) by DM6PR07CA0113.outlook.office365.com (2603:10b6:5:330::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33 via Frontend Transport; Wed, 7 Jun 2023 17:15:04 +0000 Received: from SATLEXMB03.amd.com (165.204.84.17) by CY4PEPF0000E9CF.mail.protection.outlook.com (10.167.241.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6477.13 via Frontend Transport; Wed, 7 Jun 2023 17:15:04 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 7 Jun 2023 12:14:54 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB06.amd.com (10.181.40.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 7 Jun 2023 12:14:54 -0500 Received: from xsjfnuv50.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Wed, 7 Jun 2023 12:14:54 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VsHUTX9G7echIG59c5OSkHH8nblncsRjCu1Vo+MZUXjZQAvRD6JihN0E1iNXJd9cE8H40/bCFKUH4ZizL1MBQRdxSTk+mxg46FWDaoYXBdS6C2hiXn4FhZHEnrPoApKy7mmjD9VFhxYgXXHUqU+r3oKhA5TW0fU0+XdpxrOrs9VA+xCpuc2oTJt0gDg0+hj5lnztccO08FL0YT194L99nPoqbxYNrjW4HisYE8ra24rtVHaCBh7KAtFw/Re3DrIn1o4eaTmtWQAXhdU3J2AHiyIBJrMD6FyF06UDf2dRng8dfyNAk695qhtK95loVze+C/zrSojiRd4dCpFLyK9g9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=R1s7hiqeZJSWKMtzOXD71YKZXs3yYFRh5uwgvUfLYPI=; b=OsTYuMRlGKvKnToVolTTfsL3W+QgG55FmZJbPP2jDYlRH+H1b5PPmRC1rLRYL5rx+zvXp7HLe61MyXGuNU5Qq6LPZhvenvMtzhLePO/uqOmiyKj+p04ZO5ICp4JUgpWLzSPx/5nSFNWXD1lDMKP/h5ihwkToEYJsPmOwMVeg79owtYD+xvOtRtB7vDGT46+/Iovw3Gk5XZBIdOVY7Oq19nMA5AAnCVm2FoynvMfJeqAox37HcGKUoNYj7lD6bU0Qnq7bMndj+46thGyuK+f9xAF74zKBaFCiHGqQH7QjPd1l4ApfVIO3LBMg2TcgwFiofiN/7ryS6l8CSp+PDSmD4w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R1s7hiqeZJSWKMtzOXD71YKZXs3yYFRh5uwgvUfLYPI=; b=T5l9Fw+Dq5aLQIwo07PTNGD/nfVa+WfF3hYpDcEoAP9RYCfPwCByymZNqnAYzu2RVPyL4CXhst9A9blGWkfmFkZn1gwtwafGNu+D8lhu1ueS3EzlRpIiQiLnWs7gJEyP52z5BytDnWctVC0TI7YzXvX5s2LhC68QSLEi9PZrVpE= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C From: Vikram Garhwal To: CC: , , Stefano Stabellini Subject: [QEMU][PATCH v7 08/10] meson.build: do not set have_xen_pci_passthrough for aarch64 targets Date: Wed, 7 Jun 2023 10:04:57 -0700 Message-ID: <20230607170459.14722-9-vikram.garhwal@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230607170459.14722-1-vikram.garhwal@amd.com> References: <20230607170459.14722-1-vikram.garhwal@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9CF:EE_|LV3PR12MB9216:EE_ X-MS-Office365-Filtering-Correlation-Id: 46391a56-5a61-48c3-deda-08db677abc15 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +4ecFERvs6aQNrX1PTXLLSt3iFVt/l3YnLsgS2rpp9fZ8uu82/IFYCnyfDn6z9b+hwuPEPCGjg1Q5e0hJeOa8DF6XAFM6SAWkUEkkXv0rUHY/I1WsjTq22lnEx2ai5d2L3Mv0UjWbdu5Lv3IjLJwL5pS8gehfQhA+noRLLyE6nTeXF37srqUFwpU/hVZCPlW4Sx/JmoMV7l/PxoB32QbDaR79SFGdeMHbNZ7YrtuuXrPztp9njSP5v4RJy9ZoIkdUpBFStcD3HMItMu1XwZxqjFbRfrYNsRDcRF+qBZwwSpwGmCi50sYmMbEc+AGvs98r6tmH8sttjBTFN3s5IveVNBjeKFC7Q5DBZshl0jiBXb036jZ9JLKPvEWigRYiuUdrCTsq/Wjlg46NankMjRwhn8x2ZWLRpA4QLcFSnsqqrJgvmdtlwybWAbIXkKhUjH/kBUbnz2elgInyYQoy7YH/v1rKhAWlbelck3xKWvEK8/bf5IOssqRhNqEeEkb8F/v0yb0B/Rg0I9DNqFkbLUQIplIhjrnvXoN9qm9M7s5EXi1e+LeC+VDDpRYyCqXWz1udbOTNWWaYEKhbGDjXRA2q3F4Xd8rAeeakVXg+wY69UksmQxX1jh/fX+/bFJsp0rhh4ptl/WxS4fkbMlDHKkdihvE4K5rg3l7UPw6wBioG+QQxD8iz9ELkkEpWr2pK1H6dhtAK9+UdvvfZAFhP02oEfMeW8AMwtol2Y0fmADzr4vJz6pSZ9fqwFfXR3yzaaklXvWDAgWhq7a78UiAJA3Jhw== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(136003)(39860400002)(396003)(346002)(376002)(451199021)(46966006)(40470700004)(36840700001)(47076005)(26005)(2616005)(1076003)(356005)(81166007)(44832011)(316002)(6916009)(40480700001)(83380400001)(4326008)(70586007)(70206006)(186003)(36860700001)(336012)(426003)(478600001)(82310400005)(36756003)(54906003)(40460700003)(4744005)(2906002)(5660300002)(8936002)(8676002)(82740400003)(86362001)(41300700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2023 17:15:04.1184 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 46391a56-5a61-48c3-deda-08db677abc15 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000E9CF.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR12MB9216 Received-SPF: softfail client-ip=2a01:111:f400:fe59::622; envelope-from=vikram.garhwal@amd.com; helo=NAM12-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1686158301173100003 From: Stefano Stabellini have_xen_pci_passthrough is only used for Xen x86 VMs. Signed-off-by: Stefano Stabellini Reviewed-by: Alex Benn=C3=A9e --- meson.build | 2 ++ 1 file changed, 2 insertions(+) diff --git a/meson.build b/meson.build index a61d3e9b06..786c69b06d 100644 --- a/meson.build +++ b/meson.build @@ -1737,6 +1737,8 @@ have_xen_pci_passthrough =3D get_option('xen_pci_pass= through') \ error_message: 'Xen PCI passthrough requested but Xen not enabl= ed') \ .require(targetos =3D=3D 'linux', error_message: 'Xen PCI passthrough not available on this platf= orm') \ + .require(cpu =3D=3D 'x86' or cpu =3D=3D 'x86_64', + error_message: 'Xen PCI passthrough not available on this platf= orm') \ .allowed() =20 =20 --=20 2.17.1 From nobody Wed May 1 19:49:04 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1686158307; cv=pass; d=zohomail.com; s=zohoarc; b=JNNJZn/GqZyBmhZptaKR5GVIb2DzsF/MusLUuYRYUDPo2rFP1JTMc+88Fx6LCzcJ1kOYQdImHqLIzUgX6RKxyCzXsjZb7pP+wC7q7tJNrTCQkj28qJ2Z0Y6n4mADkK4X3nlRIJ50mgzG9vLhAKV9vsFX7Sx8zncJLZgxVKkYVvk= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686158307; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=tKaAhwINxkVQqfLmEllqCojUFuZ3LxEZr2HdRfieuqo=; b=ijZ5ufJw5DPZmBOWlvDAtSREM0fO0vAJlbOWuVhDRvbfURfMiSeGdOQBq+d1efy7agpX0LiDFhMpyDTERl5AfxDXHlGyiNDalpysliIdAxMHkg2wQpPy6tCXL0bLbjUTpcOYwxULa9j16/58kH9CrTagP47YwzlB6g41AxH08+E= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686158307481338.6471881368419; Wed, 7 Jun 2023 10:18:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6wkU-0008R3-OL; Wed, 07 Jun 2023 13:15:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6wkS-0008Qc-Um for qemu-devel@nongnu.org; Wed, 07 Jun 2023 13:15:04 -0400 Received: from mail-dm6nam12on2062a.outbound.protection.outlook.com ([2a01:111:f400:fe59::62a] helo=NAM12-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6wkQ-0005vj-6t for qemu-devel@nongnu.org; Wed, 07 Jun 2023 13:15:04 -0400 Received: from CY8PR12CA0033.namprd12.prod.outlook.com (2603:10b6:930:49::12) by SJ2PR12MB8830.namprd12.prod.outlook.com (2603:10b6:a03:4d0::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32; Wed, 7 Jun 2023 17:14:57 +0000 Received: from CY4PEPF0000EE3C.namprd03.prod.outlook.com (2603:10b6:930:49:cafe::79) by CY8PR12CA0033.outlook.office365.com (2603:10b6:930:49::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.36 via Frontend Transport; Wed, 7 Jun 2023 17:14:57 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000EE3C.mail.protection.outlook.com (10.167.242.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6477.13 via Frontend Transport; Wed, 7 Jun 2023 17:14:57 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 7 Jun 2023 12:14:56 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB06.amd.com (10.181.40.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 7 Jun 2023 12:14:55 -0500 Received: from xsjfnuv50.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Wed, 7 Jun 2023 12:14:54 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MjOKoPPQ5r4Dy5o1D01JTDLNkHaqtuSOUN0+Hel9ydDsbri4syEXbqpAFplWy887fS1j3ULRW5oz5ZfSxPyYEa24fW/42/CnrMsK/jdYvRYNe4xjIvwJzA+w1YmU9qWVDF3MqzOQyas21EmbWdHqLKhONwMdgY6aQ1+Lmawj7M6Z6BER42Kb05npEbXSQZn/hIjnS/KVPsyAsb4LtSRd/9gdR/YEZNC/VnWG7Kir91L+H/A9VdCpf1h2Y6Umw+YOKdBTTS+I5uOn9VyZND8tzGTY68fHEsaYwwCq0TZL4jN5Sm2ZQ8JFK6xHpWTzo/tJiUzEfeM/zQjYMGJonA4alA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tKaAhwINxkVQqfLmEllqCojUFuZ3LxEZr2HdRfieuqo=; b=isgJ2uGAbjQ9PecmQHmenSRgQs5HbpVyJgl9c8sGYLOeMJnUrD96na7t0zmCMNNMEiZLugkxMYsUZNScGt37PVmuL2Wdw6f6aCHjhkdYoWcyvyYhylwkHUAHkLnCNvviLdIxnEILcQvwOAHXAWS04McNUqBFEMPkmjh2SKj61ahnitIm9ZhUDCoFdiVT5oKyfAKZPhZRrghnmlxZND/l6EZJB/DpJ7RNTnT0enrkOUD9bnTgO8c8BhwlOsyXHY1KHP6ylVv8LzwvogKuDbFFiun0pHvKopAwlBz+1z0RRFmU6mkQ4HhCzwEd1FaxJynUYNQDdFOjMpZgvTNDZZ5HYA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tKaAhwINxkVQqfLmEllqCojUFuZ3LxEZr2HdRfieuqo=; b=cq9Bkj74KQ7ge9TQMcdZN02zD7Vgp9kDgFhji1vliZudJfmFalDmFjrpDxNM0fukz/udicpxHIqVgPRXbOwyR0SM5EF9E8Tj12jHz218T0wENzlIO5CAe0ImL0jQUZJRrFVH8hnaOq3ZzzT3YtG0/z1J8GFm641x2cyev9cV39w= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C From: Vikram Garhwal To: CC: , , Stefano Stabellini Subject: [QEMU][PATCH v7 09/10] hw/arm: introduce xenpvh machine Date: Wed, 7 Jun 2023 10:04:58 -0700 Message-ID: <20230607170459.14722-10-vikram.garhwal@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230607170459.14722-1-vikram.garhwal@amd.com> References: <20230607170459.14722-1-vikram.garhwal@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE3C:EE_|SJ2PR12MB8830:EE_ X-MS-Office365-Filtering-Correlation-Id: 6c5775ad-aae6-44f2-0c19-08db677ab805 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PtqMVuTkkQS/C4GTJud/bh18Fni8Ybpn1RGsFlzkIAKjbB9kqycuBsiGC8LYOPXDMod0WRh4nV0L12bVADRiUVIEdM6H1gypQKvOteIrvd5xx/xMf32uABGcidHUop0ffy9oWgM66DMY3sVxqLwfEhscmmmHtiNu3Lo5Q4CGls6JyXBQ5nS4Cevc1lNoZaGhwHr9wVo65gRZXN2J9+uAicq+kNZL7Krym//22ubo6wAG2t/ljRBGfzVl4NHBunooJUu7v/kGS2RNHrdv1AQaO7+o3v5HZTdIWutLUMae/BpHYRz4ZdPJsSKZUoqMz3XL7atn+hj5vQpgYYuTKNPDYbpn8LGYnaORd9QGGLeqwZf467tEYimUmetUD/EDGDMNIeWB34gXZnOfK+lgROraT0eg/gKln3v4wFZm5cGqDH4XYxC95qSzk1QEfLgmeb1hE6wNRw1Ka+A+FcfLX2jNdNbxqqs26bptrOPjIg67AUFFK0RTwV97qR2bgQVP8Ymet0x8ZkxIVmjFPtf5KOZQPdeYB2Hm05O+hajhW8cOzjL1aeQ9noEyeiJK/UZfsrPMF2B6g2fAW6ODZ3bpzcZzERwWd/kxNtDhx6mi9Aii0FTIpGJhdtW7IKEyyFnQ/X9V9INiXrno86mbMVEsPvF476YGSQ/X6/0YGtidK7vDHXUVISciHzvPbdT588kKu6I5CbXL3BGfEp6CQM2anMXHYhbj2lEGQuztXrWbzw0DUIT4ZJXZqqdPJ0YpsJ44zrWc X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(346002)(376002)(136003)(39860400002)(396003)(451199021)(36840700001)(46966006)(40470700004)(41300700001)(316002)(54906003)(44832011)(356005)(82740400003)(81166007)(5660300002)(2906002)(66899021)(4326008)(6916009)(70586007)(8936002)(8676002)(70206006)(478600001)(82310400005)(40460700003)(966005)(86362001)(36756003)(2616005)(186003)(26005)(426003)(336012)(36860700001)(1076003)(40480700001)(47076005)(83380400001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2023 17:14:57.2816 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6c5775ad-aae6-44f2-0c19-08db677ab805 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000EE3C.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8830 Received-SPF: softfail client-ip=2a01:111:f400:fe59::62a; envelope-from=vikram.garhwal@amd.com; helo=NAM12-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1686158307893100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add a new machine xenpvh which creates a IOREQ server to register/connect w= ith Xen Hypervisor. Optional: When CONFIG_TPM is enabled, it also creates a tpm-tis-device, add= s a TPM emulator and connects to swtpm running on host machine via chardev sock= et and support TPM functionalities for a guest domain. Extra command line for aarch64 xenpvh QEMU to connect to swtpm: -chardev socket,id=3Dchrtpm,path=3D/tmp/myvtpm2/swtpm-sock \ -tpmdev emulator,id=3Dtpm0,chardev=3Dchrtpm \ -machine tpm-base-addr=3D0x0c000000 \ swtpm implements a TPM software emulator(TPM 1.2 & TPM 2) built on libtpms = and provides access to TPM functionality over socket, chardev and CUSE interfac= e. Github repo: https://github.com/stefanberger/swtpm Example for starting swtpm on host machine: mkdir /tmp/vtpm2 swtpm socket --tpmstate dir=3D/tmp/vtpm2 \ --ctrl type=3Dunixio,path=3D/tmp/vtpm2/swtpm-sock & Signed-off-by: Vikram Garhwal Signed-off-by: Stefano Stabellini Reviewed-by: Stefano Stabellini --- docs/system/arm/xenpvh.rst | 34 +++++++ docs/system/target-arm.rst | 1 + hw/arm/meson.build | 2 + hw/arm/xen_arm.c | 181 ++++++++++++++++++++++++++++++++++ include/hw/arm/xen_arch_hvm.h | 9 ++ include/hw/xen/arch_hvm.h | 2 + 6 files changed, 229 insertions(+) create mode 100644 docs/system/arm/xenpvh.rst create mode 100644 hw/arm/xen_arm.c create mode 100644 include/hw/arm/xen_arch_hvm.h diff --git a/docs/system/arm/xenpvh.rst b/docs/system/arm/xenpvh.rst new file mode 100644 index 0000000000..e1655c7ab8 --- /dev/null +++ b/docs/system/arm/xenpvh.rst @@ -0,0 +1,34 @@ +XENPVH (``xenpvh``) +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +This machine creates a IOREQ server to register/connect with Xen Hyperviso= r. + +When TPM is enabled, this machine also creates a tpm-tis-device at a user = input +tpm base address, adds a TPM emulator and connects to a swtpm application +running on host machine via chardev socket. This enables xenpvh to support= TPM +functionalities for a guest domain. + +More information about TPM use and installing swtpm linux application can = be +found at: docs/specs/tpm.rst. + +Example for starting swtpm on host machine: +.. code-block:: console + + mkdir /tmp/vtpm2 + swtpm socket --tpmstate dir=3D/tmp/vtpm2 \ + --ctrl type=3Dunixio,path=3D/tmp/vtpm2/swtpm-sock & + +Sample QEMU xenpvh commands for running and connecting with Xen: +.. code-block:: console + + qemu-system-aarch64 -xen-domid 1 \ + -chardev socket,id=3Dlibxl-cmd,path=3Dqmp-libxl-1,server=3Don,wait=3Do= ff \ + -mon chardev=3Dlibxl-cmd,mode=3Dcontrol \ + -chardev socket,id=3Dlibxenstat-cmd,path=3Dqmp-libxenstat-1,server=3Do= n,wait=3Doff \ + -mon chardev=3Dlibxenstat-cmd,mode=3Dcontrol \ + -xen-attach -name guest0 -vnc none -display none -nographic \ + -machine xenpvh -m 1301 \ + -chardev socket,id=3Dchrtpm,path=3Dtmp/vtpm2/swtpm-sock \ + -tpmdev emulator,id=3Dtpm0,chardev=3Dchrtpm -machine tpm-base-addr=3D0= x0C000000 + +In above QEMU command, last two lines are for connecting xenpvh QEMU to sw= tpm +via chardev socket. diff --git a/docs/system/target-arm.rst b/docs/system/target-arm.rst index 91ebc26c6d..af8d7c77d6 100644 --- a/docs/system/target-arm.rst +++ b/docs/system/target-arm.rst @@ -106,6 +106,7 @@ undocumented; you can get a complete list by running arm/stm32 arm/virt arm/xlnx-versal-virt + arm/xenpvh =20 Emulated CPU architecture support =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D diff --git a/hw/arm/meson.build b/hw/arm/meson.build index b545ba0e4f..1b2a01a005 100644 --- a/hw/arm/meson.build +++ b/hw/arm/meson.build @@ -62,6 +62,8 @@ arm_ss.add(when: 'CONFIG_FSL_IMX7', if_true: files('fsl-i= mx7.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', 'mcim= x6ul-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_all(xen_ss) =20 softmmu_ss.add(when: 'CONFIG_ARM_SMMUV3', if_true: files('smmu-common.c')) softmmu_ss.add(when: 'CONFIG_EXYNOS4', if_true: files('exynos4_boards.c')) diff --git a/hw/arm/xen_arm.c b/hw/arm/xen_arm.c new file mode 100644 index 0000000000..19b1cb81ad --- /dev/null +++ b/hw/arm/xen_arm.c @@ -0,0 +1,181 @@ +/* + * 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"), t= o deal + * in the Software without restriction, including without limitation the r= ights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or se= ll + * 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 OT= HER + * 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. + */ + +#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/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/arch_hvm.h" + +#define TYPE_XEN_ARM MACHINE_TYPE_NAME("xenpvh") +OBJECT_DECLARE_SIMPLE_TYPE(XenArmState, XEN_ARM) + +static MemoryListener xen_memory_listener =3D { + .region_add =3D xen_region_add, + .region_del =3D xen_region_del, + .log_start =3D NULL, + .log_stop =3D NULL, + .log_sync =3D NULL, + .log_global_start =3D NULL, + .log_global_stop =3D NULL, + .priority =3D 10, +}; + +struct XenArmState { + /*< private >*/ + MachineState parent; + + XenIOState *state; + + struct { + uint64_t tpm_base_addr; + } cfg; +}; + +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) +{ + Error *errp =3D NULL; + DeviceState *dev; + SysBusDevice *busdev; + + TPMBackend *be =3D qemu_find_tpm_be("tpm0"); + if (be =3D=3D NULL) { + DPRINTF("Couldn't fine the backend for tpm0\n"); + return; + } + dev =3D 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 =3D SYS_BUS_DEVICE(dev); + sysbus_realize_and_unref(busdev, &error_fatal); + sysbus_mmio_map(busdev, 0, xam->cfg.tpm_base_addr); + + DPRINTF("Connected tpmdev at address 0x%lx\n", xam->cfg.tpm_base_addr); +} +#endif + +static void xen_arm_init(MachineState *machine) +{ + XenArmState *xam =3D XEN_ARM(machine); + + xam->state =3D g_new0(XenIOState, 1); + + xen_register_ioreq(xam->state, machine->smp.cpus, xen_memory_listener); + +#ifdef CONFIG_TPM + if (xam->cfg.tpm_base_addr) { + xen_enable_tpm(xam); + } else { + DPRINTF("tpm-base-addr is not provided. TPM will not be enabled\n"= ); + } +#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 =3D XEN_ARM(obj); + uint64_t value =3D 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 =3D XEN_ARM(obj); + uint64_t value; + + if (!visit_type_uint64(v, name, &value, errp)) { + return; + } + + xam->cfg.tpm_base_addr =3D value; +} +#endif + +static void xen_arm_machine_class_init(ObjectClass *oc, void *data) +{ + + MachineClass *mc =3D MACHINE_CLASS(oc); + mc->desc =3D "Xen Para-virtualized PC"; + mc->init =3D xen_arm_init; + mc->max_cpus =3D 1; + mc->default_machine_opts =3D "accel=3Dxen"; + +#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= ."); + + machine_class_allow_dynamic_sysbus_dev(mc, TYPE_TPM_TIS_SYSBUS); +#endif +} + +static const TypeInfo xen_arm_machine_type =3D { + .name =3D TYPE_XEN_ARM, + .parent =3D TYPE_MACHINE, + .class_init =3D xen_arm_machine_class_init, + .instance_size =3D sizeof(XenArmState), +}; + +static void xen_arm_machine_register_types(void) +{ + type_register_static(&xen_arm_machine_type); +} + +type_init(xen_arm_machine_register_types) diff --git a/include/hw/arm/xen_arch_hvm.h b/include/hw/arm/xen_arch_hvm.h new file mode 100644 index 0000000000..8fd645e723 --- /dev/null +++ b/include/hw/arm/xen_arch_hvm.h @@ -0,0 +1,9 @@ +#ifndef HW_XEN_ARCH_ARM_HVM_H +#define HW_XEN_ARCH_ARM_HVM_H + +#include +void arch_handle_ioreq(XenIOState *state, ioreq_t *req); +void arch_xen_set_memory(XenIOState *state, + MemoryRegionSection *section, + bool add); +#endif diff --git a/include/hw/xen/arch_hvm.h b/include/hw/xen/arch_hvm.h index 26674648d8..c7c515220d 100644 --- a/include/hw/xen/arch_hvm.h +++ b/include/hw/xen/arch_hvm.h @@ -1,3 +1,5 @@ #if defined(TARGET_I386) || defined(TARGET_X86_64) #include "hw/i386/xen_arch_hvm.h" +#elif defined(TARGET_ARM) || defined(TARGET_ARM_64) +#include "hw/arm/xen_arch_hvm.h" #endif --=20 2.17.1 From nobody Wed May 1 19:49:04 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1686158201; cv=pass; d=zohomail.com; s=zohoarc; b=F1xbn/RX743lS3rsRejN5JYqnymntRfotFxZfJiE5s82smE7oEJ2gKbjtAjhthGb26RHyxPG/68uj4De7DK1RwxHQU/2d2pllwrVI4yUogpl7rwEgaQe/QPrihoONejH4fmhByYAhRkxQOjdS5SOByi3kCwUKPlHa6NlF2VB8j0= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686158201; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=A1bg7owrcg+uv5hoA3tdC2YoQhdAsxcDcCsQocCuPE8=; b=MCkp/BHoz+NpETlJHFkTg6xdnh6MDDZJGMrAqvdZsx4rh07N7d3wzj/u05psxwD2djooHAItih0QpwUzilafXOdjbsN6k4e1F4TVy4pTwyamu5gU5ZKZKPEhOsZ824FUIS6qiLJxfj6DiY4QH8cP0xKUDEVddmRG/tXIrkmzhKc= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686158201053476.70189334515146; Wed, 7 Jun 2023 10:16:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6wkd-0008Tf-VY; Wed, 07 Jun 2023 13:15:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6wkZ-0008TM-Fo for qemu-devel@nongnu.org; Wed, 07 Jun 2023 13:15:11 -0400 Received: from mail-sn1nam02on2062b.outbound.protection.outlook.com ([2a01:111:f400:7ea9::62b] helo=NAM02-SN1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6wkX-00067b-Mc for qemu-devel@nongnu.org; Wed, 07 Jun 2023 13:15:11 -0400 Received: from DM6PR07CA0121.namprd07.prod.outlook.com (2603:10b6:5:330::33) by BN9PR12MB5052.namprd12.prod.outlook.com (2603:10b6:408:135::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Wed, 7 Jun 2023 17:15:05 +0000 Received: from CY4PEPF0000E9CF.namprd03.prod.outlook.com (2603:10b6:5:330:cafe::a) by DM6PR07CA0121.outlook.office365.com (2603:10b6:5:330::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.19 via Frontend Transport; Wed, 7 Jun 2023 17:15:05 +0000 Received: from SATLEXMB03.amd.com (165.204.84.17) by CY4PEPF0000E9CF.mail.protection.outlook.com (10.167.241.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6477.13 via Frontend Transport; Wed, 7 Jun 2023 17:15:05 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 7 Jun 2023 12:14:55 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 7 Jun 2023 12:14:55 -0500 Received: from xsjfnuv50.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Wed, 7 Jun 2023 12:14:55 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Zr+l09XxV3ZOqW0edYtGc52dhsBHJF9pJL9S6577YstsEncD7BIRYWN/tMNfKXz0jUDq02Y9u11JeaowiHKc+xtErGOAU8/RNcz/B2/LkjFpVFXIqC6kVtYeqXLE4cnkSyYxyaMh57+L9Txk8jUQjGCAhFRSWGyOX3a8SmhOsBfud6DjLo6Zr1nE8zO1HL2AFEzyy71yD4+UEjmtN5ExQF2Q+W/Hxx7wKULaVXamo1iUaUiYtT0SDjdndsBEp2xlhN5NXbMTMANHDp8zD6U8F/KuNKVns7oN4UBN4J+9YUO/pX1OsCkdiN63c341TB6U1jTR+pTTVFRAtK1d+sJtSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=A1bg7owrcg+uv5hoA3tdC2YoQhdAsxcDcCsQocCuPE8=; b=nRhSkSfEIAWfTC21fL9x+jkczCgV19j+UGW1tK4zb+JdtRwe6vM0cTB76aQSh0tPJ4R87OoJacGPZTgAuUUsQl94mHVe+hZ0b3IbA2+BBjK8wiMuWvWPQOjYOtaAQtV9PPS2XjTcebVmr1W/KDrPmZwgz28NJDVxmbU+gY/vm4uqYrJ8DbSd5CUZg6OOVjdbP+2j7ELpDPkaSpA0FUBEA0V2CoX4jWeVWkDB5MpVG/tSeSnYdHPZ8JNxAq2gO/8i4PTkifFx9bUbDyf7SWBtzXn25l439fEnkTVtx603h0W91bKhBb2RP52Asb+r2Bxx7GrxDwEyGiVjIuW8EmJtWA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=A1bg7owrcg+uv5hoA3tdC2YoQhdAsxcDcCsQocCuPE8=; b=kuqpADa5FnYwI5Ygthbvm2HSV59wNXsKk+CCRiN7o11C25yHEUqIVBRq4bnaC2z0sFaOkakQP4ttLaEHUoQqsEJlkTBW7SRKU9o6jg0CJZYYtUOGIenH8450mmFV4bzNDEEbud+R4uuvVqUNwLgca9oZgKTIhMo8C23clyQ5jZI= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C From: Vikram Garhwal To: CC: , , Stefano Stabellini Subject: [QEMU][PATCH v7 10/10] meson.build: enable xenpv machine build for ARM Date: Wed, 7 Jun 2023 10:04:59 -0700 Message-ID: <20230607170459.14722-11-vikram.garhwal@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230607170459.14722-1-vikram.garhwal@amd.com> References: <20230607170459.14722-1-vikram.garhwal@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9CF:EE_|BN9PR12MB5052:EE_ X-MS-Office365-Filtering-Correlation-Id: 9c581ad1-1b01-4c8a-c4ed-08db677abc9d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WjBtkQL/V9y8QWv1Ww71BDTV134X9xyno/ISwJmfrxaE7hId/45lwj3IbOwDmj56GBPJ2hByekVSkLBvciLBP1MbS8jHwHxZ+menaUbtsSWAZYql00PgMy85LO9ECL5bMEPp865vPrGMHPDGmz2FCJeNRwdG7dExGV1lVpED3npcBspob1A600R8OQ7U+b1NcH8WWktC1gm8h2FDp7eZ/JHFiQquCa5WJZibnrfLwejhU+7TMciHWULTXidp1s1IYcMUyw2Tud/CIqsfYrPGggb4ZvFmHwrk8kNDGWnony89rApYHPVTScYY5WFBYOSUuV3tDo9R6leIdnSAbyqIb9gtceEggd05kvoRruKjXA52gkrqGZG3d4rJ1eHAUU/tCZskTEmBtThYn7pGAMBTUCRnsBEPT8sqQWElXQ0PXLrxybrPzNW8VFnGtVckOVNuq1zq4lR3wr6dghUch7sMtXOCgtgn+cWi3M6xt8pdew6lYI4Q8IbgAdKl8MsghJ/GFZzfhdKDze0RIjTt5y4RJB6859watjy1WArFoUZOcLJTUpcShdAu9eHEUThi6tCu7Mki73h1F325wtbIkqgB+oAfHIvzAXnkpDgk3aSWCY3lj5q9ryIkLLMpYCsmanSsMy17G/CFqgnMgxIF63zq6PIZUt1bqFJM9tbfMi+NAea09hxdL9mosuYYM+Gzmnlwi8l4xKI0gqW1dsyoc1Vuh5CUhbyvEOD6OuhAnwQzSvRCpM6tuQdpCRyY4kjNgAtV1UfWDqqSApsEgs7/L0SnfA== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(346002)(376002)(136003)(396003)(39860400002)(451199021)(46966006)(40470700004)(36840700001)(1076003)(2616005)(41300700001)(336012)(426003)(36860700001)(26005)(47076005)(66574015)(83380400001)(186003)(40460700003)(40480700001)(478600001)(54906003)(81166007)(82310400005)(4326008)(356005)(82740400003)(316002)(70206006)(70586007)(8676002)(6916009)(8936002)(44832011)(5660300002)(4744005)(86362001)(36756003)(2906002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2023 17:15:05.0246 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9c581ad1-1b01-4c8a-c4ed-08db677abc9d X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000E9CF.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5052 Received-SPF: softfail client-ip=2a01:111:f400:7ea9::62b; envelope-from=vikram.garhwal@amd.com; helo=NAM02-SN1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1686158204864100001 Add CONFIG_XEN for aarch64 device to support build for ARM targets. Signed-off-by: Vikram Garhwal Signed-off-by: Stefano Stabellini Reviewed-by: Alex Benn=C3=A9e --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 786c69b06d..afba3b6441 100644 --- a/meson.build +++ b/meson.build @@ -136,7 +136,7 @@ endif if cpu in ['x86', 'x86_64', 'arm', 'aarch64'] # i386 emulator provides xenpv machine type for multiple architectures accelerator_targets +=3D { - 'CONFIG_XEN': ['i386-softmmu', 'x86_64-softmmu'], + 'CONFIG_XEN': ['i386-softmmu', 'x86_64-softmmu', 'aarch64-softmmu'], } endif if cpu in ['x86', 'x86_64'] --=20 2.17.1