From nobody Thu Mar 28 19:59: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=1674636907; cv=pass; d=zohomail.com; s=zohoarc; b=LlMtIaN0Ebg0S6QpRTTsZ2FppD7TMeQiIiZz9rsuSn4k8C0O4zvnrP0dIN1paGZF9B8nWSkokKCUcnggHD6IFbAzwh2FV+7tPg8/aG6PIpeq2ZOiUdwTmvbxZ4xujpyZt3FAG8AKoy6FYyzGsXwJWxjikUPNTrNfSwtFQpWBHsE= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674636907; 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=z7qBBSFtT16dKo24xhhVW2fFUFVUWqNupyxQmZ/Rxf8=; b=RqXpmUr+UGNOsY5iU2IvR3rHFSEJmxrShDYFitTLEWfjLli1VvocH5/CucY7VzcQ+t2jRUd18gPztjMbj+y6S80qwMKywS16uMfQ8OqQ5nHqSseqDEzYaKTlOssU3W/SYqjtbpWF8eU3VpyeWQ+ib8e7jbsR4H3l9lFi8hk1UYM= 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 1674636907228837.6163151895887; Wed, 25 Jan 2023 00:55:07 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pKbYB-0003j9-8a; Wed, 25 Jan 2023 03:54:35 -0500 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 1pKbY8-0003ic-W9 for qemu-devel@nongnu.org; Wed, 25 Jan 2023 03:54:33 -0500 Received: from mail-dm6nam11on2071.outbound.protection.outlook.com ([40.107.223.71] helo=NAM11-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 1pKbY4-0000yt-Kj for qemu-devel@nongnu.org; Wed, 25 Jan 2023 03:54:32 -0500 Received: from DM6PR03CA0016.namprd03.prod.outlook.com (2603:10b6:5:40::29) by IA1PR12MB6329.namprd12.prod.outlook.com (2603:10b6:208:3e5::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.33; Wed, 25 Jan 2023 08:54:25 +0000 Received: from DM6NAM11FT078.eop-nam11.prod.protection.outlook.com (2603:10b6:5:40:cafe::ef) by DM6PR03CA0016.outlook.office365.com (2603:10b6:5:40::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.33 via Frontend Transport; Wed, 25 Jan 2023 08:54:25 +0000 Received: from SATLEXMB03.amd.com (165.204.84.17) by DM6NAM11FT078.mail.protection.outlook.com (10.13.173.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6043.17 via Frontend Transport; Wed, 25 Jan 2023 08:54:24 +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, 25 Jan 2023 02:54:23 -0600 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, 25 Jan 2023 02:54:22 -0600 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AgV50fT1m/j3iQ4CYF+16+F+pUcFGY/i24169WJ2xmreMYrggyhyPYqaUWyngZsKgOAev912mR59bonx5Tq+ISuMuKDFVYJ59aULzyHLMhcTK2nYhyAIJvQwgsBRmBByy46nlx4jlBwIwM9M3sQN/1cmzWPlwBsjwICuJP8hfbbdMQSp9IITjP3e8JODJApdsC2tQ3aw/eShzyOXAy0BlHEvfEfzkJpAQlE76f1xwkC6O2HSmtXugDIYeWROal7/Nxgetcjx9RuV2WSmw8p9C2yFjn1OxT6v5yAniEflkR7SxYs0jskikxXgNHNMqQQzt0ha5SDKD7NxoIvJwlWi+A== 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=z7qBBSFtT16dKo24xhhVW2fFUFVUWqNupyxQmZ/Rxf8=; b=nObe/ObNQ0St78OeVXgMcWXShbX7KsAG+V5dLpyNcuIXrVHOFewLGGIQ0oG3VZS0NB4jTbyxDH8wf/GVy7Dz6YD7UEhO3OpO6se4RYjHGYXqxec4DJ8u38HtMqcIeS/IyrKxO6mkdFc3hH3IjmS1U//t0rYamzWntaNHE1x5AnjkJ99nq5wGzamZzFxBqLUuQ8+hCBjiqh1kD/EIgtRLNOyvlgif1hzxntMXidchg08FQdm+CdRAi3VfP5Z0zw6B6z2v1OIN1rPu1EODgi/1q2J/Xhac3TNGlwmY0BZqDoCWPFyDDV5n1tgd/wUXva0l9sWAZO6MHUmRDB8DbgZj2w== 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=z7qBBSFtT16dKo24xhhVW2fFUFVUWqNupyxQmZ/Rxf8=; b=izip4ENKNevPyyqu5gkt87AXgE0Jj5ZazEJTypsMcDLCs3ffrWOCLK3zxK8kqKi6enZj9yfTWKwKLjBWgPK7ihuLqTtsDjJM65ZW8wtpw0Y8tGxLbDfNZIw/EJYJP6ZxSY4LR/hmaTdazLzsVi3gwOg/85FYguorojVJCL0PgF8= 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: , , , , "Michael S. Tsirkin" , Marcel Apfelbaum , "Paolo Bonzini" , Richard Henderson , Eduardo Habkost , Stefano Stabellini , Anthony Perard , Paul Durrant Subject: [QEMU][PATCH v4 01/10] hw/i386/xen/: move xen-mapcache.c to hw/xen/ Date: Wed, 25 Jan 2023 00:53:58 -0800 Message-ID: <20230125085407.7144-2-vikram.garhwal@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230125085407.7144-1-vikram.garhwal@amd.com> References: <20230125085407.7144-1-vikram.garhwal@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT078:EE_|IA1PR12MB6329:EE_ X-MS-Office365-Filtering-Correlation-Id: e095d815-3abf-4042-6778-08dafeb1c220 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WOpLBQnMfwGAg0Y1y5ZtTt0aUgrDIh7Fe1/5bETPnHOPRHlbTwljkAEdFUejfYmBLYz01w2VifAqXIgyoRmssiQRJH1EwyZkAZ3EwzHKeiygI3ojVPpitDP5E4H4wjUNQBtqxX0Tam7JTb22U6VbYB+UuZ+s393BHiq4X0NR4eL7R1FsT+DWtYEsEonvFN1bUMLwGP/cklt1GhptjMsT7CfbP+axFRBelFmQnBis/JFxAdeJ1KZITYnMqHl0Rsp1OADyzCztC0VHdt1QDySLH9jA4Bu+qyKTgdFP6t+kQkoLo3Ko/va76CjnuEa8zSLtsfO45sXFk9rESlWDhDWErZc7xMiIyJXP5t4JJqGf1azTYwQSHTmVLFFDMgDjXIZA+40GUj6PIhJrm0ngLonV/g2lLVE307TVsYZc76laZb7e2i44C4ob94+eMvWXVCW/wWHkOZIfXgzTq3tbvyYOJhtLM6qEMSNyjv9t4ofd25yyMf1RTTBVh1NKJYa5+5Y913HjBYKils1HBNyg0g2/miKiwz5Qb/bB/4k5wu2FAqmsHVJ3vYBkUKxPiuR8DBP5grhFcEvA6POnPobSNsU3z8jRKb+bSVTplvo7W+/BxiA8Kdz2Cv5rulmrais64saZfh07rzT+1X7tZQvc5j/tUI0fiUwE20l5FShWZF7TjqN3YOjZ2S8UJcKWBIzi4bkgZ4o8BqqRbI0Mwso5EjbRt3HqUzTotHEsrZnJLDREtQU= 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:(13230025)(4636009)(39860400002)(136003)(376002)(346002)(396003)(451199018)(36840700001)(46966006)(40470700004)(36860700001)(40460700003)(36756003)(6666004)(2616005)(2906002)(54906003)(26005)(1076003)(336012)(186003)(41300700001)(7416002)(81166007)(4326008)(70206006)(8936002)(44832011)(70586007)(6916009)(8676002)(316002)(86362001)(82740400003)(82310400005)(356005)(478600001)(40480700001)(426003)(5660300002)(83380400001)(47076005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2023 08:54:24.5135 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e095d815-3abf-4042-6778-08dafeb1c220 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: DM6NAM11FT078.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6329 Received-SPF: softfail client-ip=40.107.223.71; envelope-from=vikram.garhwal@amd.com; helo=NAM11-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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: 1674636907689100001 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 --- 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 be84130300..2fcc46e6ca 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_platform.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 ae0ace3046..19d0637c46 100644 --- a/hw/xen/meson.build +++ b/hw/xen/meson.build @@ -22,3 +22,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 3da3fd8348..2c8f238f42 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.0 From nobody Thu Mar 28 19:59: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=1674636884; cv=pass; d=zohomail.com; s=zohoarc; b=fow/nfRbPfk2MwrFtGGGIM0oTAliNdVweiiEinPTzn70hWAEym4sEQ7e1H09IJvHXqsBBk+P4edBlrXc3OPDTKB6bphOjvqtTwJezsquF8fvUgnKKep580PCzPSI1TM0qIZ3CjXe2afn0FVJzoZDiU0LExJpq7n7Hf5CLVG+Wmo= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674636884; 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=xQRygdwVbnDYBJcZUcE7RFsjWA1hPALnId6WXnaDoUU=; b=bX0DkTs5mKrrGyQd8+w9A+rrvNRM75b4YBFs0DZAQY/qXGt6fhhtMqry7H1ec9FK0M5txN15WZHmo6g4azDhD3czMScWWTtxXfJPoCadRMj1qUe4A0lNCaV9qc3GMCeYM57HSz4tAAgrrbDjvd1FqKepwN4Rc9txRy9Su6Icbik= 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 1674636884130326.7052709898335; Wed, 25 Jan 2023 00:54:44 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pKbYC-0003jJ-DM; Wed, 25 Jan 2023 03:54:36 -0500 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 1pKbYB-0003jA-76 for qemu-devel@nongnu.org; Wed, 25 Jan 2023 03:54:35 -0500 Received: from mail-bn8nam12on2059.outbound.protection.outlook.com ([40.107.237.59] 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 1pKbY9-0000zI-7S for qemu-devel@nongnu.org; Wed, 25 Jan 2023 03:54:34 -0500 Received: from DM6PR08CA0036.namprd08.prod.outlook.com (2603:10b6:5:80::49) by MN2PR12MB4111.namprd12.prod.outlook.com (2603:10b6:208:1de::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.33; Wed, 25 Jan 2023 08:54:29 +0000 Received: from DM6NAM11FT016.eop-nam11.prod.protection.outlook.com (2603:10b6:5:80:cafe::4a) by DM6PR08CA0036.outlook.office365.com (2603:10b6:5:80::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.33 via Frontend Transport; Wed, 25 Jan 2023 08:54:29 +0000 Received: from SATLEXMB03.amd.com (165.204.84.17) by DM6NAM11FT016.mail.protection.outlook.com (10.13.173.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6023.16 via Frontend Transport; Wed, 25 Jan 2023 08:54:28 +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, 25 Jan 2023 02:54:27 -0600 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, 25 Jan 2023 02:54:26 -0600 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JQ/YrdxXbBAwraVU9uU5qScpbPMmTfefIKg3RaAS/k0Q1tjvLnIhyeex3eJRUzGjBtELaVLGX5doUqYpF7m9fTwEa2B8YGitLmJA5ch/jHSclbmPlTkQgY62ebViJ6OzkVlNW13DipfGxgDjcluphGqgmFxe7GadPqhdChlMVVzdeq4GhvpD9azkWCisnuimfwKUiNB6oIIp6HxeD64YBTJoeWbkMkh2YSHGrpj+PoLdfjXvQaeNd1SOhCQpF9tW4Wwe3ojhjcJbtw7JFWlIWOYCp1T1JERX6veNT/u+4vAfP9hjZqRgT/drPiqsNmxe+n+TtT6bbMjdCqFLvjrKzg== 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=xQRygdwVbnDYBJcZUcE7RFsjWA1hPALnId6WXnaDoUU=; b=hq2+A92pf5JiH/kPCKdTdCq6Eb+huETOJgJzldmtDkg9+Q3KNuYO54I98CacnOvbmySA5vZEcN9Yj1t0rsQmob0lTOM/oUqaO4E3h1N0SVjowQjT4KaObl7ovhfduUMLh/HB3FXFwUFXIyZwQmCdjXBgxcg20nPiEyuc8W+LOTefbXVvqfg1TsZfeVfVOGAcjni3pAGroBqIXbBGbG6o9/0Kh7Cii0AeoMPixdSn8ZMpWJqGmgJkpnYccbfhhkXIfTa/pJrLkR5AtZVKuVrA8dFxc27iJ3kOAoiQhgnCH2lGbscrExaU4Noc7XVImmiwiTGqVxbFNHgFHVEP5LU7Kw== 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=xQRygdwVbnDYBJcZUcE7RFsjWA1hPALnId6WXnaDoUU=; b=ibrq85+4pNNvO0lO2iNeJy43rqs3yV8Z/DeLrhaFQRApIJ8IDTpYZlrBMvQ6XBKaJTByN3ygbfcmP5UefnmyO3ESTvvta0CFuV7z/X3KYkplHnxXk2NNYYLBtLcWjPmVMSbMiLVGKNlKq5mhYpzFlRzcmCOYTGdqP6/EG3j10f0= 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 , Anthony Perard , "Paul Durrant" , "Michael S. Tsirkin" , "Marcel Apfelbaum" , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [QEMU][PATCH v4 02/10] hw/i386/xen: rearrange xen_hvm_init_pc Date: Wed, 25 Jan 2023 00:53:59 -0800 Message-ID: <20230125085407.7144-3-vikram.garhwal@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230125085407.7144-1-vikram.garhwal@amd.com> References: <20230125085407.7144-1-vikram.garhwal@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT016:EE_|MN2PR12MB4111:EE_ X-MS-Office365-Filtering-Correlation-Id: 91a567b6-f4cd-441a-df48-08dafeb1c48a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: olvmbCUD/rGjlgOvMdbQOW61JeNYXVjoNjTN0g+fcWLXzEMCOViwvhRBknhEiMg1TAC/tirgPm88rrtR1dT62eXX1fybfUfUtIGbqFlfin/h5F2/xRiVuR1QQYSl/KRqTMVbnmsUX8+01b4V7HK+a5OKkN+ERLA+y0+QETDbv+qkccByylm0+jP7DnzBEe854yeTP1b/prDEUi51B5NlwkELvzyN5LK7bN/6up4woLIy5aWeNLuEKs6/0uE3wwppShUuf2qtUA1G9TaBKnPe4YgcMMVbCkZrvNIs374pIwpSLteB7qU4zOBPkoCUzS5wJBwelhg/gmCOqbHblVKDzjsdZ9/w2lNykoOpkzYNuir3AegdF9/AzPFiyltnTdlbPMPOXandm6j92qowyg4SEOwSAs9rFapLT4azXHoXFdr88aw3HMQ7dsfdGQ9j6JeiUx+RC+vTcdqk4GOVU2yDi8w9K/BeRQ5yUSQVKrV8sGhCaZBPXcZ7sx2r4RJT0i7TSA7esdinYlbqZEJKDT5Dg5aaYxE+BqsrsfYi+gG9x/2Yvqw9eVIJF1dYuzqQXTfer/9AMfstvEZH98bddclpWsv9HRPRx46Pi4rsvrslY9XImlqgsF4WbfB/1F9enf8Ir0itQqibc7tqN1nDwrmmaqCk7y20FFFdGh+QlLCOkMgtMXE/S+eqo902GMBSZYiKlxd0hPwXDDN/AvHEOhNZlr5DHWHzuRDuQpPAeVJglxc= 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:(13230025)(4636009)(136003)(39860400002)(376002)(396003)(346002)(451199018)(40470700004)(36840700001)(46966006)(82310400005)(82740400003)(4326008)(86362001)(2906002)(36756003)(356005)(40460700003)(70586007)(8676002)(186003)(26005)(6916009)(81166007)(6666004)(47076005)(41300700001)(426003)(54906003)(336012)(40480700001)(1076003)(5660300002)(36860700001)(2616005)(83380400001)(44832011)(8936002)(478600001)(7416002)(70206006)(316002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2023 08:54:28.5667 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 91a567b6-f4cd-441a-df48-08dafeb1c48a 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: DM6NAM11FT016.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4111 Received-SPF: softfail client-ip=40.107.237.59; 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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: 1674636885556100007 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 b9a6f7f538..1fba0e0ae1 100644 --- a/hw/i386/xen/xen-hvm.c +++ b/hw/i386/xen/xen-hvm.c @@ -1416,12 +1416,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 */ @@ -1432,23 +1426,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 @@ -1486,7 +1463,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 @@ -1513,6 +1489,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.0 From nobody Thu Mar 28 19:59: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=1674636895; cv=pass; d=zohomail.com; s=zohoarc; b=klIQxt+d/8ED4/VhYu5uXsVJN/lnX0+PYPq1J8NHcrvM5OOiXAv6AtVcsBMf2DswyQr+RXaV1FVmDaMEUfGAbfXfNqXnxHGn56Trx65Yue9QOqwDLkHMitEtqBv3KW5cONQ4pmKYrqjnX4MInhiGIGvJ9sLV/iDlVzkO08/fqQU= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674636895; 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=/pArBdHE6pupZI0iEmfLZok1fiWO0kN2Oo56dAzFs5Q=; b=Hz649kXWt080QVZwPrIe609IhUubyCaifmdewW44KbtkSYS4K70OCQ7gRIXh8es8Ac4c4TPztRoEnIqRYWwleJF8kgt7qq0A2vEf4uD2kX9gtvITrHZDXcdlTi80OkKWYU+axL5K1G4FDE1+I4cI0J3NrCvHc/gmnBGfg89k1Jk= 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 1674636895219271.6659686997017; Wed, 25 Jan 2023 00:54:55 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pKbYG-0003jo-Pw; Wed, 25 Jan 2023 03:54:40 -0500 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 1pKbYF-0003jg-Op for qemu-devel@nongnu.org; Wed, 25 Jan 2023 03:54:39 -0500 Received: from mail-mw2nam12on2041.outbound.protection.outlook.com ([40.107.244.41] 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 1pKbYD-0000zZ-Pw for qemu-devel@nongnu.org; Wed, 25 Jan 2023 03:54:39 -0500 Received: from DM6PR12CA0015.namprd12.prod.outlook.com (2603:10b6:5:1c0::28) by DM6PR12MB4172.namprd12.prod.outlook.com (2603:10b6:5:212::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.33; Wed, 25 Jan 2023 08:54:33 +0000 Received: from DM6NAM11FT044.eop-nam11.prod.protection.outlook.com (2603:10b6:5:1c0:cafe::93) by DM6PR12CA0015.outlook.office365.com (2603:10b6:5:1c0::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.33 via Frontend Transport; Wed, 25 Jan 2023 08:54:33 +0000 Received: from SATLEXMB03.amd.com (165.204.84.17) by DM6NAM11FT044.mail.protection.outlook.com (10.13.173.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6002.13 via Frontend Transport; Wed, 25 Jan 2023 08:54:32 +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, 25 Jan 2023 02:54:31 -0600 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, 25 Jan 2023 02:54:30 -0600 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AMpDNAxixgJL7512FqAuSfWr6ha1jFX+Jrf9SRlMN5OwVKXdi+gNte58535aiV8E/Nip98ICJThV/PYQRk7TR/O94ArzIbd6h19v5D9IsbKKIb3S09XpmNQ1L91BsnQ7UnKE6LjQb6vBmfvV5qYzAewliENfQ99ZDGivO7qJCPIQH2zUSueDXTCIZRvUXN2snJ4RAi2l08hGTe82v/4QMPbQKDFidbpJEj2V90WTmkRsig+UD8GAKK5dqxXs4vzV26RY8FGYpX3EB68ZSEEP212Uy1Vbr2jsyxykKsi8Ny5mLoGg6TSLNL9kLQ85QRL8A+0jrvbujSLHW3RG3KSIXg== 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=/pArBdHE6pupZI0iEmfLZok1fiWO0kN2Oo56dAzFs5Q=; b=nDdmZhDUiMPmMkApAcDIA1P9OpFtF+nrRPCxo91SOQf2pZ2xCtCbAJ6VhaiNeGDZFIVJwylVyCsAp4pwPEDw5nec+iPjPBV94J5lYJ45DIDPMjJgPCp1SvYfUCFUyxCd6QIMYDsj9IdoOJE2CJji5FXXCnIpGHMTDd4WzMas5cv8Jngoqnh0ArkoIZ7A4gjUTRp6fBdcawXOmiA5XlzKXaWOt+DQCA1VOZ+OcmnRzLepkaLsl8RzGG5KttOYCFb2/LLAzj/NLlSs18m3MVPPnZaSTpYk6VWMEBNSXQAlI4bg9ttq6SQ7UONLl/WV7vMaxQ4XKTYS4AxQFNuaurdBJw== 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=/pArBdHE6pupZI0iEmfLZok1fiWO0kN2Oo56dAzFs5Q=; b=HLU+BFcBNXAaVd/z2syJEG3/8eHOJEL1fx1xcNS8OO2S0oG4Dm670ImZ2ez3X2LU7HA+uboXWquxPLx37gs2cTieH2OT0XKLB+CGCbisZzSPvX8xgj64ZpKCK16wk7cVWa8JKoIIU/gv76UzB/j+wZCDPps8xKNpb3+kvyMxB6w= 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 , Anthony Perard , "Paul Durrant" , "Michael S. Tsirkin" , "Marcel Apfelbaum" , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [QEMU][PATCH v4 03/10] hw/i386/xen/xen-hvm: move x86-specific fields out of XenIOState Date: Wed, 25 Jan 2023 00:54:00 -0800 Message-ID: <20230125085407.7144-4-vikram.garhwal@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230125085407.7144-1-vikram.garhwal@amd.com> References: <20230125085407.7144-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: DM6NAM11FT044:EE_|DM6PR12MB4172:EE_ X-MS-Office365-Filtering-Correlation-Id: 15f73fff-e87f-4a7a-48e5-08dafeb1c70a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FOEAkFDXi7pJkF58Kre3tRU/P22AG5ViCXj3+wrloQEu6c0z12dWU+oKYwg8O+eo74CiDAFfubQmKaaHi1ufzNrfp0uxpDaPxV39y05H1qkkU6LZNVG3WLO/fLddTsPvwmKgRLUehI/DIEL1Y9od2lgE4whjA7D7gbR1JmMgXPFVAO3UseMpbqBTrRzaJfqmpkr9IpmmjqevUWEgkAxsK6yK8N9KestO/CkYGmG5Uc/RevH3lr+iheyqvZDtMFLhoKyXG2+9iRCDTHTAkbyK+9DmC5kJ5/777iD42uYp6DlDFmrpNl5AL8VCvWAr0kjyMctzSaeR32IvqqOqmaQcRTo/sSkQ+Sd039J2A6Ch85dfWkW6ykNUJSrq/NkNdiyV+9bxxmYA5LHex4ZHD/P6Mt9SHMv0tnFYIgRkGf8IEHnG8uIN8kxgQTJ/GGd7wnntogMln4QDQ8vohZNLq73E29pVYuhgSBhUPg8lgWa4gFFwNWkOpUz2ARxFgALLv4aZYclu79LGrGlto/A1gAXsNcVnJE+b8xQwBwrAq/UlpM1UCdZpZ6VUPX0YAwRsqnxAA281tLyGGsRqcFTqoc+6rWIpHSYMHdSynbh5eTIiKeEzplVKi+GKILMhcPoPfwnR2a+/zhiIt+MMfO7itsZNBQAC5Sww4ny0auHPzPX6BfVJXyssl1P6Cw/do9xRUTxSb/xCvTa1ihTec1u5bC9mzE5mtUDHD18jVS310ge2VFI= 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:(13230025)(4636009)(136003)(376002)(396003)(346002)(39860400002)(451199018)(46966006)(36840700001)(40470700004)(2906002)(8936002)(356005)(5660300002)(7416002)(81166007)(86362001)(44832011)(478600001)(41300700001)(40480700001)(70206006)(8676002)(70586007)(426003)(1076003)(26005)(6666004)(47076005)(82310400005)(336012)(4326008)(6916009)(66574015)(82740400003)(40460700003)(2616005)(36756003)(83380400001)(316002)(54906003)(36860700001)(186003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2023 08:54:32.7415 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 15f73fff-e87f-4a7a-48e5-08dafeb1c70a 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: DM6NAM11FT044.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4172 Received-SPF: softfail client-ip=40.107.244.41; 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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: 1674636895839100001 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 1fba0e0ae1..06c446e7be 100644 --- a/hw/i386/xen/xen-hvm.c +++ b/hw/i386/xen/xen-hvm.c @@ -73,6 +73,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) { @@ -95,6 +96,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; @@ -105,7 +111,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; @@ -125,14 +130,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 */ @@ -462,10 +461,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 @@ -626,16 +625,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 @@ -650,7 +649,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); @@ -676,12 +675,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); } @@ -1021,9 +1018,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]; @@ -1468,7 +1465,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); @@ -1489,19 +1485,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.0 From nobody Thu Mar 28 19:59: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=1674636982; cv=pass; d=zohomail.com; s=zohoarc; b=cUcmtEho/ggcmuajsWSawHMnymzYB1CW4ajbVgPRBSHUZHMZGf+ujcKvWlih2mnOqS6LIs2PKUhS8p38kSoncC5rVu8Ac1IKx3D+bK49FONMpuMViIyRsSVkHhNk8XlE4RsdWQJIlY7RjnzmLrs7Jd1dq7jOkuEq2X3flWYwrRs= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674636982; 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=2UWlGpUn0+7jB5T2dKo2cLBSjhMlAcViRVxgAVG74GI=; b=SCFfTVepUuOPCbbpNbnqTAbvgAVNX0pDC/o4hYvoPPteFvmecuKJWuG26lWZtGDNDZipJGGMGmIPOpTtbop35676tLcT3StTiTArHSNK96CpcpZH1daUeFfhw9qBLx6zhVpVU2f+45SHOMM0aUCGsteolomgrUiakr/xy8CjjcE= 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 1674636982586303.7727988482669; Wed, 25 Jan 2023 00:56:22 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pKbYU-0003ul-Ta; Wed, 25 Jan 2023 03:54:54 -0500 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 1pKbYT-0003s9-F2 for qemu-devel@nongnu.org; Wed, 25 Jan 2023 03:54:53 -0500 Received: from mail-bn1nam02on2081.outbound.protection.outlook.com ([40.107.212.81] 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 1pKbYP-00011U-10 for qemu-devel@nongnu.org; Wed, 25 Jan 2023 03:54:53 -0500 Received: from DM6PR03CA0075.namprd03.prod.outlook.com (2603:10b6:5:333::8) by CH0PR12MB5074.namprd12.prod.outlook.com (2603:10b6:610:e1::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.33; Wed, 25 Jan 2023 08:54:41 +0000 Received: from DM6NAM11FT035.eop-nam11.prod.protection.outlook.com (2603:10b6:5:333:cafe::7a) by DM6PR03CA0075.outlook.office365.com (2603:10b6:5:333::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.33 via Frontend Transport; Wed, 25 Jan 2023 08:54:40 +0000 Received: from SATLEXMB03.amd.com (165.204.84.17) by DM6NAM11FT035.mail.protection.outlook.com (10.13.172.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6023.16 via Frontend Transport; Wed, 25 Jan 2023 08:54:39 +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, 25 Jan 2023 02:54:38 -0600 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, 25 Jan 2023 02:54:37 -0600 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IgyGjhjdrdzMPM4Ob484YPuoZb3ejC8mDXpj2VQho0vnAWZZyJd4A2HFqdea7mLlt4ds6ysF8JqQ6tW5hm+eB/ORwrDn8dzjBJFw+OQCL9773TEC7sMjlEdD51vCO4OTvEdJFp/wasm/skRPPmru1V+cXNfbVFnjM+p1/oDVf694IkuuocgoIPnHGfYMaKpnEuYf2Nj39ba9f6wHNbum3gxl8jMcBTDQ1354gjFj3k4H8L2lvxb2PrivA+5bG5JJqCdvxu9FgNfl/HpTqDCtRQI5hlbgeY2s++cFHvhz3ur+M5YDLDfeAqi34KcQU2dvenloT2jeRl/YfZzcQc6IxQ== 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=2UWlGpUn0+7jB5T2dKo2cLBSjhMlAcViRVxgAVG74GI=; b=Mdp5peaPI0YlzowULIIOxxNPA3x2sfkEYRPsMHfjz9EPQNoJ6UPJekobTpkcyrB/Ur4bfuGZi1ZRrCvmFyckJPgWxgDYc0zWvnWzvLy0cYSwEnNvCVkP4LAYVFqzm2cXNIoeGOHKVHsb45Wf64mYz1R5nMpcLQK2y2+xnjoT7hrXwG/lCyyLOr2LzEVg69t2jXXxkZ70eofiyjJAO9HDeAmVFcbof9qecVWIVSa8GfttXKWrZqJ4Q5KXXamR/ysa1Pz0fRhx4cieIRljOcO4hGVwW7WIzhnsUBIrecgslgE/tRmq0uq2K2Dk7b6SEkJo/aaQhEeJ30vkJQfrD3dQYQ== 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=2UWlGpUn0+7jB5T2dKo2cLBSjhMlAcViRVxgAVG74GI=; b=Ao19m+wwwy7UZJ7f5tEt8XzKVG5Km0IzBSjT+X69QAwiAgMt7B4wyON+9dYp7YY0H+gdltd/UXpEX7ZtgxKsN0uFEIJDpVPIsssz2FZKPjNIWoj5l8WQcw1TksJZDvtxSXgG6a14/fBWarmHXup2D+GtlwYjomesIjIyZ0P+3oE= 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 , Anthony Perard , "Paul Durrant" , Paolo Bonzini , "Richard Henderson" , Eduardo Habkost , "Michael S. Tsirkin" , "Marcel Apfelbaum" Subject: [QEMU][PATCH v4 04/10] xen-hvm: reorganize xen-hvm and move common function to xen-hvm-common Date: Wed, 25 Jan 2023 00:54:01 -0800 Message-ID: <20230125085407.7144-5-vikram.garhwal@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230125085407.7144-1-vikram.garhwal@amd.com> References: <20230125085407.7144-1-vikram.garhwal@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT035:EE_|CH0PR12MB5074:EE_ X-MS-Office365-Filtering-Correlation-Id: 94d43469-c869-4de5-e3f4-08dafeb1cb05 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ewN5nMgv2N0soicivvsbrL70pzym+O+xIap2c+6NmRJJjxQsEp+kj/Ju5EmNl2n/R5o3EHhbfEfYEF+mYskNOK6IJQ9p5KdIEZ5mhcw8/WN9HlGrssB2jvWBewXj05BK8ra3GTxg+fKAir/ntQKvmGdeGWmxy4S8x+TC5wmM2hGUdVXUQxe2blHcUS0emGRx+1XDluN/EyUiTwciiQqsGn6UA6PmoAEmKfFnKgPvA7xp6QtcjMfiFj0uQstUfD3GIZHGsq0ZLbupTEezqvQikhY2B21nK93LEv3la5cX7/cTbqzIVT3gHZWDZKsZWlh9YtF/y4GMPXbMH/HpCrWDKW+wHD+HtONMsKqdLCKNjPwERKSbQX5NabbCnlbvJPqdZ5ZmY4JE1NEgbvHEPeH1NNPNlZWDNHVIzjgWZtcuwnQctPZU0xRhg61vY1u8YjLeiqFv6bCDm9lWOEdt0uYWmpfnH155WiLhF4lJ/YZ1J/nXXSfTgoMVqh0ZxNcnI0b8rwh20BDg7agHXl7JJzKIrnfeu9XKVfS8ijqpMERX+PHY3Jq8KaTKz3JokgUIe8ZJ2bNUHMSbOM/9AXPVqDsHkpIIJJObqO6racln5CW11xIJfuvHKrRSAhgIwPQMehW4pzxzNhqMI3ZUd9kriqwlrFuTfYH1GlqNn+7yq5BYVzHx5GDffwme5Cs4zwprtHrJHsDBLAz7WjU/WkcrEnBVpKHZA7UFIRdRUaz1bJW5qH8= 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:(13230025)(4636009)(346002)(376002)(136003)(396003)(39860400002)(451199018)(46966006)(36840700001)(40470700004)(82740400003)(81166007)(36860700001)(83380400001)(426003)(186003)(47076005)(316002)(1076003)(2616005)(26005)(82310400005)(478600001)(86362001)(40460700003)(36756003)(54906003)(8936002)(70586007)(6916009)(8676002)(5660300002)(40480700001)(6666004)(7416002)(356005)(30864003)(4326008)(41300700001)(70206006)(336012)(44832011)(2906002)(36900700001)(559001)(579004); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2023 08:54:39.4392 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 94d43469-c869-4de5-e3f4-08dafeb1cb05 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: DM6NAM11FT035.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5074 Received-SPF: softfail client-ip=40.107.212.81; 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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: 1674636984338100011 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 | 1023 ++----------------------------- hw/xen/meson.build | 5 +- hw/xen/trace-events | 14 + hw/xen/xen-hvm-common.c | 870 ++++++++++++++++++++++++++ include/hw/i386/xen_arch_hvm.h | 11 + include/hw/xen/arch_hvm.h | 3 + include/hw/xen/xen-hvm-common.h | 97 +++ 8 files changed, 1063 insertions(+), 974 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 06c446e7be..b81c671598 100644 --- a/hw/i386/xen/xen-hvm.c +++ b/hw/i386/xen/xen-hvm.c @@ -10,46 +10,20 @@ =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_common.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 *framebuffer; -static bool xen_in_migration; - /* Compatibility with older version */ =20 /* This allows QEMU to build on a system that has Xen 4.5 or earlier @@ -75,26 +49,9 @@ 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 MemoryRegion ram_640k, ram_lo, ram_hi; +static MemoryRegion *framebuffer; +static bool xen_in_migration; static QLIST_HEAD(, XenPhysmap) xen_physmap; static const XenPhysmap *log_for_dirtybit; /* Buffer used by xen_sync_dirty_bitmap */ @@ -102,38 +59,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) @@ -246,42 +171,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; @@ -471,144 +360,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) @@ -716,277 +467,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 xenevtchn_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 */ - xenevtchn_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; @@ -1030,226 +510,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); - xenevtchn_unmask(state->xce_handle, state->bufioreq_local_port); - } -} - -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; - xenevtchn_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 xenevtchn_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); - } - - xenevtchn_close(state->xce_handle); - xs_daemon_close(state->xenstore); -} - #ifdef XEN_COMPAT_PHYSMAP static void xen_read_physmap(XenIOState *state) { @@ -1309,178 +569,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 state =3D g_new0(XenIOState, 1); =20 - state->xce_handle =3D xenevtchn_open(NULL, 0); - 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 xenevtchn_bind_interdomain(state->xce_handle, xen_domid, - 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 xenevtchn_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(); - - /* Initialize backend core & drivers */ - if (xen_be_init() !=3D 0) { - error_report("xen backend core setup failed"); - goto err; - } - xen_be_register_common(); + xen_register_ioreq(state, max_cpus, xen_memory_listener); =20 QLIST_INIT(&xen_physmap); xen_read_physmap(state); @@ -1520,59 +619,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)) { @@ -1604,3 +655,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: "TARGET_FMT_plx"\n", + start_addr); + } + } + } else { + if (xen_remove_from_physmap(state, start_addr, size) < 0) { + DPRINTF("physmapping does not exist at "TARGET_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 19d0637c46..008e036d63 100644 --- a/hw/xen/meson.build +++ b/hw/xen/meson.build @@ -25,4 +25,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 2c8f238f42..02ca1183da 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..e748d8d423 --- /dev/null +++ b/hw/xen/xen-hvm-common.c @@ -0,0 +1,870 @@ +#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-legacy-backend.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 { + .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 xenevtchn_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 */ + xenevtchn_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 int handle_buffered_iopage(XenIOState *state) +{ + buffered_iopage_t *buf_page =3D state->buffered_io_page; + buf_ioreq_t *buf_req =3D NULL; + 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); + } + + return req.count; +} + +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); + xenevtchn_unmask(state->xce_handle, state->bufioreq_local_port); + } +} + +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; + xenevtchn_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 xenevtchn_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); + + xenevtchn_close(state->xce_handle); + xs_daemon_close(state->xenstore); +} + +static int xen_map_ioreq_server(XenIOState *state) +{ + void *addr =3D NULL; + xenforeignmemory_resource_handle *fres; + 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); + fres =3D xenforeignmemory_map_resource(xen_fmem, xen_domid, + XENMEM_resource_ioreq_server, + state->ioservid, 0, 2, + &addr, + PROT_READ | PROT_WRITE, 0); + if (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); +} + +static void xen_register_backend(XenIOState *state) +{ + /* Initialize backend core & drivers */ + if (xen_be_init() !=3D 0) { + error_report("xen backend core setup failed"); + goto err; + } + + xen_be_register_common(); + + return; + +err: + error_report("xen hardware virtual machine backend registration failed= "); + exit(1); +} + +void xen_register_ioreq(XenIOState *state, unsigned int max_cpus, + MemoryListener xen_memory_listener) +{ + int i, rc; + + state->xce_handle =3D xenevtchn_open(NULL, 0); + 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 xenevtchn_bind_interdomain(state->xce_handle, xen_domid, + 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 xenevtchn_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_register_backend(state); + + 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..c16057835f --- /dev/null +++ b/include/hw/xen/xen-hvm-common.h @@ -0,0 +1,97 @@ +#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_common.h" +#include "sysemu/runstate.h" +#include "sysemu/sysemu.h" +#include "sysemu/xen.h" +#include "sysemu/xen-mapcache.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; + 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.0 From nobody Thu Mar 28 19:59: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=1674636997; cv=pass; d=zohomail.com; s=zohoarc; b=XT/lfBwLT5/K7ZbjtzrKP+aMwuOUojbiaQMk4/IvoL1w+ZHn+/wr3bidQBjJiwdjNk4ZIJKs422j7hlZ2+3yxjAiw1RNGF/KdI/nrfUWAYjnn13fEyLY7YS7EmuPrvs6bW0r/sSC0tHL0LBVLh/WVNvgqgL6rJuYRSTvh2WYF2c= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674636997; 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=HpZAZyFrLxyZiJ9zE+SxaljhwMZQFl/Jyy62XvsgXdo=; b=E7td9ZxE/MsyjIYVg0CGsw7hYhc5JQ40CsNz9BS5ftnIO+3pjwcctiyYwTQfFyBmHTLu5lbWTbXQm/a2YYVNlTPjDboUq5h9f9mq/Q0Cwck04ndqXnS3I9yIZ97z8bwINRXasa6qz5Rkhe3gQSZkoIjo0Vm7xXC6KGD3XaEBI5I= 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 1674636996904799.0983205673525; Wed, 25 Jan 2023 00:56:36 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pKbYU-0003sd-2M; Wed, 25 Jan 2023 03:54:54 -0500 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 1pKbYS-0003ro-Fh for qemu-devel@nongnu.org; Wed, 25 Jan 2023 03:54:52 -0500 Received: from mail-mw2nam12on2045.outbound.protection.outlook.com ([40.107.244.45] 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 1pKbYP-00011T-Uz for qemu-devel@nongnu.org; Wed, 25 Jan 2023 03:54:52 -0500 Received: from DM6PR03CA0039.namprd03.prod.outlook.com (2603:10b6:5:100::16) by DS0PR12MB8573.namprd12.prod.outlook.com (2603:10b6:8:162::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.33; Wed, 25 Jan 2023 08:54:43 +0000 Received: from DM6NAM11FT012.eop-nam11.prod.protection.outlook.com (2603:10b6:5:100:cafe::b6) by DM6PR03CA0039.outlook.office365.com (2603:10b6:5:100::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.21 via Frontend Transport; Wed, 25 Jan 2023 08:54:43 +0000 Received: from SATLEXMB03.amd.com (165.204.84.17) by DM6NAM11FT012.mail.protection.outlook.com (10.13.173.109) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6023.16 via Frontend Transport; Wed, 25 Jan 2023 08:54:42 +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, 25 Jan 2023 02:54:41 -0600 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, 25 Jan 2023 02:54:40 -0600 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W2gE/67T9fTJ1cEkhDxG5gATfKNecs7kxqzcMDdzBpwc41+N5hEJqTowHUXPQOLbGvE8jka+NiQBCQnDV/r5zrvDgGn0jhLhQq7fnppRwPbGqllyMrEsajoJXafc9OR80sZGCEBcMlqLmu/eEeSkPZyYT5sUxCC+/iePrEwvKWvNZ2bncMcXMJIhZqAS9/wyVog6soGV1OjBtA47xkllFzq0UHJ01m0zVwxG+XliecPKIDQnwI71aylVW3GLKrBsKzniFyggdCNbHJ6ESA8T6pTXRrlXf0z2p5xEpg5khysd+3KCWs4bFGtUjiiYFJc8gaw8D2L7vJaYUr8jxF8CpA== 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=HpZAZyFrLxyZiJ9zE+SxaljhwMZQFl/Jyy62XvsgXdo=; b=CG14mV1q7sGZmZuPMZ9TvNQ/d7Ta0ljhIFmZVpfAMRjDcaKmWXmSQJmbH+p9p4d/6So7GYi3VsIBPaSQQ57MUT0hpe0e4eqh6hoimhFY3ZwvIe/DLybYGGYaZhpFj63xo5qritGnNLh54fif09iBOBTEdQEIgcPuCgG1AcS4J9cYZbqCudg38H9eKF9Wvae81T5FzOh/SzKc8hE3MnkR2+htGDbyt3c7NJWFCt17JbMPEFrctjQ56s9g1t4RRkdjG7ua8l8TjWM69k6KmLEFhpO6kalGWZ72pRZymrdIeYcaUWfE/DBqM6mla8EuG3fbzQwLothXAIj2wUWjLNYdLg== 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=HpZAZyFrLxyZiJ9zE+SxaljhwMZQFl/Jyy62XvsgXdo=; b=L3FKMqOVPcHZSXue9H/8xKIAm8ferRL25jkgj29YN76TH8QskBNEZaUdtUJAAPm01hW2WrmbzcEgLY1PSU3w2uCzbfO1z1IV0s7Q71r52DT7HAFGbZb+4eZmgqRsQf9aPF8FmlontKBtCaFXTzovJUyH8tgze0B2y3LvbmucEUs= 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 , Anthony Perard , "Paul Durrant" Subject: [QEMU][PATCH v4 05/10] include/hw/xen/xen_common: return error from xen_create_ioreq_server Date: Wed, 25 Jan 2023 00:54:02 -0800 Message-ID: <20230125085407.7144-6-vikram.garhwal@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230125085407.7144-1-vikram.garhwal@amd.com> References: <20230125085407.7144-1-vikram.garhwal@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT012:EE_|DS0PR12MB8573:EE_ X-MS-Office365-Filtering-Correlation-Id: 3c1a4c42-ae34-4c40-956d-08dafeb1ccdb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RJSy8LqXs5hc5dPAm+Bi+j2GGmtE5eY+BRLAHGAkWPCzjbmoSMKGMyUBUlP1AjJkTOrT+xTQ5qLY/i3m/ZQJhoA7t5NNYmX4zzFi06K1TbInjN9TAUFxcMTYqllKpUwBwaHNKWLI1ln5wiEMFjVmBIHQtNUBJ1wJYHE8HXqfLeS0iG2ZI2X/5Hj95pDFbtihMr/caDJbPsBsnD69mgi2AaIlow6xPdkGzEISuFN3PB5hPYP+kS0Ld2nUv0qhdNPMUzexEEALbVVZz/IiToGkiGQHogGQGFg5fdNhD9I6euvZogPS25NVjfpFcQKIckhf+bBNAdgoBFM03ABAtYsaAGzro3hkpVr/WajRsZLDEZCxwvae9kDCMgL1Vo+zmP6POZiACWP4rLpRBGAV+cUpC84XYWMsQQLtrZyV/lHEaZcDeRvwcX0S7y+fLIFjAXsKlQsp34mi2SX9GCG52LU6LCXJmcPEqw8eCJGwz++W/V2P0KKQEu5YdQMm0qRnuyKqcWO18WBtAx1zJdmMqeieCIXQVRrD/GyG03eMBONh/QnqRDfNelNTKNFmiPf+sF1rOjoCQcfm5Ux52cNs1ExjyeMl8TkPd3ymKvPO8pXUanNtX7E95GIJaa4nDjozr3f9V8+rkdZ5Tz9ze6yDrdMQQp+t/Og/YGk6D9r42DSH5ge5qvijfvRfBlOwKcyoVYqzwYoYoG6Wd+d4lO1HNNe9MZ4+aw117VJPqkbi2r5JOLE= 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:(13230025)(4636009)(396003)(346002)(136003)(376002)(39860400002)(451199018)(46966006)(40470700004)(36840700001)(36860700001)(81166007)(82740400003)(83380400001)(26005)(426003)(47076005)(40460700003)(186003)(336012)(2616005)(356005)(478600001)(316002)(54906003)(36756003)(6666004)(6916009)(70586007)(4326008)(44832011)(70206006)(8676002)(86362001)(5660300002)(8936002)(40480700001)(2906002)(1076003)(41300700001)(82310400005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2023 08:54:42.5174 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3c1a4c42-ae34-4c40-956d-08dafeb1ccdb 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: DM6NAM11FT012.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8573 Received-SPF: softfail client-ip=40.107.244.45; 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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: 1674636998402100005 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 --- include/hw/xen/xen_common.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/include/hw/xen/xen_common.h b/include/hw/xen/xen_common.h index 9a13a756ae..9ec69582b3 100644 --- a/include/hw/xen/xen_common.h +++ b/include/hw/xen/xen_common.h @@ -467,9 +467,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, @@ -600,8 +601,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, @@ -609,12 +610,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.0 From nobody Thu Mar 28 19:59: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=1674636931; cv=pass; d=zohomail.com; s=zohoarc; b=dvQLxhtL25GgarlXkhhdOoA1cri5dJd75its62SaD91OpeZaelF7uUfpibPHCF81THmQZ4cq0zJx03AUh3koc/wvejAzNrIwq1k/LkQa3nnunT8VaAj/pnTr6S6T9roxSjtfdzQCyu+PRNgb68Vhj5NRQc2dJyRgCiJg/bxgYDY= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674636931; 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=URxTp3Cj5zWl6imZ6G51I5Cd2LY5Q6C4OO3dPqmmi+4=; b=DPYOPb8HMGnq67Os/t8SY+Q5s5E8XgXCnycve/oQ59Z8iHk1v+W6ARnGJPBOgkmF/hxhsL6ebQIUpsdRNAb+CcwzO5uiFO2SX6LDxg2xUDlWZJW0XLWukA7EqE8iHm/IAf1nJ1CcWI8S61yGKR/WFR43MG9TgwwtLRx4gO+Mv14= 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 1674636931226285.80720339559434; Wed, 25 Jan 2023 00:55:31 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pKbYS-0003rn-H0; Wed, 25 Jan 2023 03:54:52 -0500 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 1pKbYR-0003rY-5A for qemu-devel@nongnu.org; Wed, 25 Jan 2023 03:54:51 -0500 Received: from mail-dm6nam10on2060.outbound.protection.outlook.com ([40.107.93.60] 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 1pKbYP-00011S-0W for qemu-devel@nongnu.org; Wed, 25 Jan 2023 03:54:50 -0500 Received: from DM6PR02CA0098.namprd02.prod.outlook.com (2603:10b6:5:1f4::39) by IA1PR12MB8312.namprd12.prod.outlook.com (2603:10b6:208:3fc::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.33; Wed, 25 Jan 2023 08:54:45 +0000 Received: from DM6NAM11FT019.eop-nam11.prod.protection.outlook.com (2603:10b6:5:1f4:cafe::bd) by DM6PR02CA0098.outlook.office365.com (2603:10b6:5:1f4::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.21 via Frontend Transport; Wed, 25 Jan 2023 08:54:45 +0000 Received: from SATLEXMB03.amd.com (165.204.84.17) by DM6NAM11FT019.mail.protection.outlook.com (10.13.172.172) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6023.16 via Frontend Transport; Wed, 25 Jan 2023 08:54:45 +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, 25 Jan 2023 02:54:44 -0600 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, 25 Jan 2023 02:54:43 -0600 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c3x/o+4D0sGp88pcO1gKkDC1dYpkc8lXDZyi/Jpuavg/QFOcay8K4GWLg0aEYousnVIV6Y0BMcH+oPYLEEOlQNKdkEY0VHXNHpfk0uNDt7+DX6hgHC1NnCbC7jC+yUvWeirOEFWMmWXx66h4uSoSpFr6FNtUmb/ds+sFTrcHn1wRFnh/mz7Ce1MLH0yV6/vKEiM8ZGqaHnQXCziTuNvqDrgSeHqIZh+XzaOwJYOzmj+kV/godniKIk3JaCWLrJJ4KBWMoEAPH+SyAeJFRyCWEDivoUmXOQbBUyDREYLEdkbFudTELcIlhy8zYvYal2iTQtOHNgK4/OtkgEjUihjAxA== 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=URxTp3Cj5zWl6imZ6G51I5Cd2LY5Q6C4OO3dPqmmi+4=; b=C16Q07x/usFkzOGhugD9BMLkxA78/VLthsz70L0fb1vBaHmkY038W7lMS0aFc+jNBuRDiwtZ9bNecTFkLC4WbQkJZoNG5W7Y0Y5pcLDmlX+uH2/952fVL/TOdNGZNXXwCr3Mv506ckOLC/s1bntx7t4zG7uUnGE0BDwWC1qd0aGPSWWx5L9b23bFj7I6GFD4K/OFIqjbjNaqEfbQxP/6gx+3Iq1IrwmEI4EtfVUeKIp9pqyAAP2LcJAA3V/xJcfhEO5nnCcGsdGgBUffLKfxun4BIePcqvzz/YG8rPt7Vvch2oQTep+4EqyWaqzA/xPVf3miOQA2DRGq/HzzcHxUKg== 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=URxTp3Cj5zWl6imZ6G51I5Cd2LY5Q6C4OO3dPqmmi+4=; b=d6jq8Y7r1TRgnT8lPajuS2J4PaZpnpyo3I8YTBfrP5H/pV4+DFDXUqYDdioSbj9HlXrVjH6VrK7d40Cv9YDW/vWcsr6sHWVCRzbUD49Vhu59doJTR25efWA+24Q2COsbhYk0p1JH750N2Nca4GPim5qZOKeA2vW36d1uZLL1IAU= 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 , Anthony Perard , "Paul Durrant" Subject: [QEMU][PATCH v4 06/10] hw/xen/xen-hvm-common: skip ioreq creation on ioreq registration failure Date: Wed, 25 Jan 2023 00:54:03 -0800 Message-ID: <20230125085407.7144-7-vikram.garhwal@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230125085407.7144-1-vikram.garhwal@amd.com> References: <20230125085407.7144-1-vikram.garhwal@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT019:EE_|IA1PR12MB8312:EE_ X-MS-Office365-Filtering-Correlation-Id: 31b10660-926b-4149-e40c-08dafeb1ce6b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: buVTwfv4QgoGRQlDDpuL3e5HpCFuDCYoHoHdNCKljxxFM5WAzSpcDUSM+Nn5Yh3NCIxqYu8PkkFnEauYb9k+nwl5sGSGZZLbIo5bn8X/P4qJ9llbbtVxaDxzysu1NZO9h1wi/Lka7hq3jqbWpFct2Z39VioPWlrp8Ok8lCaNr0HgqQeSRjMGqdiwtLIxVgKh5QwfClhDTyuWhf9Y3gV3us6gNMPPdUcsDvqLYfttp9gTofAUCiDU2T4OX5JYrmbsbXaciuSLEO/6+9DzZkH3tQwAX33oB0JRsheQcyFeudqB6BsJkISgvYFDMCNJqMX5tPM6LwrfhmDntZGDwvXhgFuG0/64SKj4JnpvtnYe+/2dib+TyAScqelfqwfg9PFiDX+ysVQEfjdOHRNK9oKZarJ/rtIVrUMoAZSdNMEA7z7wYNHj+KVt2pzx++oIeP2kCOp/pzGCKwc9LjCQeBo2PLLnirvVtz3wfiXNF0906Io1xe35vgtedQYYuTYCiAgurp/GEtBzg1gZxyAsLnRTfaCTQx27/fMZ5pGOQgptLi2HlxJh6bpa5S3JT6lWZAzGeEiX9uUt4l5NvlzkYlhnLeLu0q6wIaweRMfQIWw3whjpUuuk5K9W19e77zxjVFRJPTJp4gim4ypvj9KLWrcNAaejZ6WXYyK8zEy3tlOzBq/1q01e5ah+jMUb9hV9JC622TNobmjE9nTl1byyeiipH0J1QtUUeoBScuAemORZQXE= 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:(13230025)(4636009)(376002)(39860400002)(136003)(346002)(396003)(451199018)(46966006)(40470700004)(36840700001)(36860700001)(83380400001)(426003)(336012)(54906003)(47076005)(6916009)(2616005)(478600001)(8676002)(186003)(36756003)(1076003)(70206006)(70586007)(356005)(2906002)(86362001)(82310400005)(82740400003)(41300700001)(81166007)(26005)(5660300002)(316002)(40480700001)(40460700003)(6666004)(44832011)(4326008)(8936002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2023 08:54:45.1409 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 31b10660-926b-4149-e40c-08dafeb1ce6b 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: DM6NAM11FT019.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB8312 Received-SPF: softfail client-ip=40.107.93.60; 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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: 1674636931777100001 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 --- hw/xen/xen-hvm-common.c | 53 ++++++++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/hw/xen/xen-hvm-common.c b/hw/xen/xen-hvm-common.c index e748d8d423..94dbbe97ed 100644 --- a/hw/xen/xen-hvm-common.c +++ b/hw/xen/xen-hvm-common.c @@ -777,25 +777,12 @@ err: exit(1); } =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 - state->xce_handle =3D xenevtchn_open(NULL, 0); - 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 @@ -859,12 +846,44 @@ 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; + + state->xce_handle =3D xenevtchn_open(NULL, 0); + 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_register_backend(state); =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.0 From nobody Thu Mar 28 19:59: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=1674636981; cv=pass; d=zohomail.com; s=zohoarc; b=Ov5C/WvYqPNUZPDNaYs32EXpd+2wXaip8Le3JIPIrHD5+mEWv4yD8BSs2Zgb4WIff5bg/UtEQbgGVkxPdBNa0fr5oP6N1J73oyQtAFGtd4Ed9FE84BsiOtbASRdOOkS5AjAo2wxttlMHXhCgaXTMJXAR15YF9cXH9GXjMTsWZyA= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674636981; 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=mqy76BJj/3k0CZFIEfqRDFKvHIQ6y9gkszdQF5vGxqY=; b=Vi+RMfRA4qLXWR6BdpsdTwu3noXhu39HwsY8JkXu96WFAhMGnTjG5DgkEz6qHVU+UVfWlHLb96K/i6AqZ32q/GuQi9QyGpQ8cf6skK+VCh0h4eAqwHkJXi6r87I8lPTykOk8RyojQfXdGJOnoZrh62ASXz87YhrWuw8qq4TYsxM= 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 1674636981970269.74279792395987; Wed, 25 Jan 2023 00:56:21 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pKbYZ-0003xe-Hk; Wed, 25 Jan 2023 03:54:59 -0500 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 1pKbYW-0003wc-Iw for qemu-devel@nongnu.org; Wed, 25 Jan 2023 03:54:56 -0500 Received: from mail-co1nam11on2047.outbound.protection.outlook.com ([40.107.220.47] helo=NAM11-CO1-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 1pKbYU-00011r-Pm for qemu-devel@nongnu.org; Wed, 25 Jan 2023 03:54:56 -0500 Received: from DM6PR06CA0038.namprd06.prod.outlook.com (2603:10b6:5:54::15) by PH7PR12MB6490.namprd12.prod.outlook.com (2603:10b6:510:1f5::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.33; Wed, 25 Jan 2023 08:54:48 +0000 Received: from DM6NAM11FT063.eop-nam11.prod.protection.outlook.com (2603:10b6:5:54:cafe::c2) by DM6PR06CA0038.outlook.office365.com (2603:10b6:5:54::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.20 via Frontend Transport; Wed, 25 Jan 2023 08:54:48 +0000 Received: from SATLEXMB03.amd.com (165.204.84.17) by DM6NAM11FT063.mail.protection.outlook.com (10.13.172.219) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6043.21 via Frontend Transport; Wed, 25 Jan 2023 08:54:47 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) 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, 25 Jan 2023 02:54:46 -0600 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, 25 Jan 2023 00:54:46 -0800 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, 25 Jan 2023 02:54:45 -0600 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZXVp6JaPtuzxwlY5i3IJ6BbSnIk1EtKOnrrHHvoMe52VdlFVddVIIniaBIkjUeBFblD21vzuRien8hi/IuV2EM2HjvtwVGPRh5Pbi6zWcyCH3XztHD2rW3LaeicskGf2eX4V5QbT/QdLCnPyTS/i8YqLrKq5PJfw7P/A/+/iUTbNyuPhIth2/1oL7eiuVFGJc2aPwMFaEyeNOmRmHJWOdyovLculRi3i2zeqboQIZPC/ur//EIn3+kz+mg3aGUnTCHlRBq2tXTsRWOEm04xeuwiIL6lwSf877MKFv2V48d4cy86lm5ZSnckVFShYeR/IXY5LaLNdyeDA8EWUyRGDrA== 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=mqy76BJj/3k0CZFIEfqRDFKvHIQ6y9gkszdQF5vGxqY=; b=LreCuP1shWsGCxizkNtaNRqUQ0YHJVq+l4udbzMvY1za0SA2b7tGY67GDYhVntS1rGWRbje7l5l1oagU5h9r+bYYGqUfmU9XWXIfx6Z9fWayM3AOTHGNrBRzk2GBKjrf0vMCPC4HXaVCST4Ht1q1gmoRgjSzBcmHjulht2cH6dHXNwSBc2VrffAcbHF3G84FrSduwMAWG12Hy/VlePThqmst4ZV/4p2aTOaZdZ/C3tD3hOAFIWvOkyoamIAaBdNa/cIvybmuSldUEg1B0imbkeSI8fmie2JoaMl8GxUg/XRPpOQoaItriaro5pMLWBxYnZrGvc+STkip2TT4RTob2g== 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=mqy76BJj/3k0CZFIEfqRDFKvHIQ6y9gkszdQF5vGxqY=; b=g3EUzN8vS+ZJOA/ATNFCIKQ5BTMy12NwUJkebUN4eahBXO5NU0GCtN3aJiTR3lhmkUMIcslO/eX+bnCblN7Zz9zrNO/LeSi793Pw9rXE22Fj8t/8x7B9ydrKcbW5IdzNV3aBALsALSND8WIKIlpGAiHRDHkGvieoN78ayDkGi2A= 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 , Anthony Perard , "Paul Durrant" Subject: [QEMU][PATCH v4 07/10] hw/xen/xen-hvm-common: Use g_new and error_setg_errno Date: Wed, 25 Jan 2023 00:54:04 -0800 Message-ID: <20230125085407.7144-8-vikram.garhwal@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230125085407.7144-1-vikram.garhwal@amd.com> References: <20230125085407.7144-1-vikram.garhwal@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT063:EE_|PH7PR12MB6490:EE_ X-MS-Office365-Filtering-Correlation-Id: a3428d60-6b23-40c5-d9c3-08dafeb1cf87 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Zc8C8J07RmauMRfAH9gxUSWIHSJI7GhDjuy5OaYKOqPUcuuqN6oZO+6/L870NfIGonmMjM+x8Md1Reiq/GuUcwUU5B6yoznsckcWmGkCmuOViMO1bqWwNcmc90I5K5n4r+ueun686FRjEhg6vdHK13GXs8+G3cubecHVANpoTSBDpW50VuielDKxIYdN/EMH2OyL49Hh2fJFlBE+MMy7vyNnJtWSivmnGWg2cNWChnG+2+lmyfPIuINSoNfGUCl+7HFUw3L+9sUm1tgqXT4KPfPJ9o/6Bmhre7Tbm3oWFplhCHTFqFXqElhAJo/HDCYE5DrOCuP+EyQm+muHDJNmxBwrXaGc5aRpLBpo6jcI6Mkz5eQOQaWK55IoYrZKEJuqcNEE6dgnm8EsSBvyymNxZWI3KnkED12i250ZpW4CUv1c7wONA47DyshYrgcZkrhtFwJzeeSRfZXnSj74M8671U/ajcYm5uUBrTucNYvY+zF4uNUABrI6xlsgz05wXc2/n/Xd74upFrUbwvB7QnV035FvulZankslT8c6xCG7uPH2An7EUXvv3SwIXASqkSFrgTq84kJxLf8Zku/eHeDj+/gyB7a3eo5d1I3sByKaWb/KyYVGXJU7EGnYnm6XVVPemqD/GPYUMAuOuhL+NckRQAKIDmGskYUVncxQ8vgnx8zmRwh8HYXeMhZwLJrloC/BlFn4Wvnft/5kloOyUUrHC5BuC4V3AiSy/itrsMyoPWk= 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:(13230025)(4636009)(376002)(346002)(136003)(396003)(39860400002)(451199018)(46966006)(36840700001)(40470700004)(4326008)(36860700001)(70586007)(86362001)(54906003)(70206006)(6916009)(36756003)(1076003)(44832011)(8936002)(5660300002)(426003)(2906002)(82740400003)(41300700001)(82310400005)(40460700003)(47076005)(6666004)(26005)(83380400001)(40480700001)(186003)(8676002)(2616005)(316002)(336012)(81166007)(478600001)(356005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2023 08:54:47.0018 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a3428d60-6b23-40c5-d9c3-08dafeb1cf87 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: DM6NAM11FT063.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6490 Received-SPF: softfail client-ip=40.107.220.47; envelope-from=vikram.garhwal@amd.com; helo=NAM11-CO1-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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: 1674636982269100004 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Replace g_malloc with g_new and perror with error_setg_errno. Signed-off-by: Vikram Garhwal Reviewed-by: Stefano Stabellini --- 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 94dbbe97ed..01c8ec1956 100644 --- a/hw/xen/xen-hvm-common.c +++ b/hw/xen/xen-hvm-common.c @@ -34,7 +34,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; @@ -726,7 +726,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 */ } @@ -797,7 +797,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) { @@ -806,7 +806,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++) { @@ -860,13 +860,13 @@ void xen_register_ioreq(XenIOState *state, unsigned i= nt max_cpus, =20 state->xce_handle =3D xenevtchn_open(NULL, 0); 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.0 From nobody Thu Mar 28 19:59: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=1674636981; cv=pass; d=zohomail.com; s=zohoarc; b=Edfa+WaykP3rKDzd+/K6USwZkZ7dXn/XyOZKC27kKjR6C/gc6hl6O+ik61p3PBi14oLW1rGGipU+8b0VZ96TjSSi54VvU32D3G2obGairBhRACPV6TKwGC4n8l6wn0f44heCHLIdSMu5kuGXJVfBagsVZElT4CghW8DM+loBgko= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674636981; 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=hmpuP41Ztn/lKlMcuw44+3sOiW4TYVQ+KI34gBksLz8=; b=Q/WcbxO6rLVS6KT/hpdh0JbhJLpe8+iHlzq4vjaNF1iNy7SRBJ/SCzw50rPdxxebpU+r2iUFxrgjcvGUu+YQOwDMMyhqlW5JwWEo8kFCPQ773qEHGVKhuKnCWJ1TGrtflSwqr6mRp77mDg5PkEeO2KYLlQIQx/ImiGWR2I8rINA= 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 1674636981327887.0445045644224; Wed, 25 Jan 2023 00:56:21 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pKbYY-0003xE-2B; Wed, 25 Jan 2023 03:54:58 -0500 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 1pKbYW-0003w1-1X for qemu-devel@nongnu.org; Wed, 25 Jan 2023 03:54:56 -0500 Received: from mail-dm6nam11on2049.outbound.protection.outlook.com ([40.107.223.49] helo=NAM11-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 1pKbYU-000129-Cb for qemu-devel@nongnu.org; Wed, 25 Jan 2023 03:54:55 -0500 Received: from MW4P223CA0021.NAMP223.PROD.OUTLOOK.COM (2603:10b6:303:80::26) by MN0PR12MB5836.namprd12.prod.outlook.com (2603:10b6:208:37b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.20; Wed, 25 Jan 2023 08:54:50 +0000 Received: from CO1NAM11FT011.eop-nam11.prod.protection.outlook.com (2603:10b6:303:80:cafe::da) by MW4P223CA0021.outlook.office365.com (2603:10b6:303:80::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.33 via Frontend Transport; Wed, 25 Jan 2023 08:54:50 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT011.mail.protection.outlook.com (10.13.175.186) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6043.21 via Frontend Transport; Wed, 25 Jan 2023 08:54:49 +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, 25 Jan 2023 02:54:48 -0600 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, 25 Jan 2023 00:54:48 -0800 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, 25 Jan 2023 02:54:47 -0600 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kBr7wPoI9gyrbG/Lls5evEW14t00tRtwoX2TDDfOxEzCLOtGXQihdXSTeq3cgwiHNdGz9rPb4RHYMAqJ6SEArSUBo3908fXz53DYJTqUrSu+ZghrJbASeGI+7h64nBC1A3czsVTlegfNCDxAaiS36ZbO/cH+3FKSLPc6GHaNNPbtJivHmsPcsaQINQfYjZ0Od9Fd2PkgE4Xrjs8bvUgSgYeXEgkARskt9GJjPKBsZVgURcDMCtrnS1VMjWBpTCFyGvCOtszJVD7obAoOgM4nW1qbc1pI2482gPOVVNgPf26QQRqvR9szm6CaQ0Pt3VoewjWHksWaExvva6qSfxQwSw== 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=hmpuP41Ztn/lKlMcuw44+3sOiW4TYVQ+KI34gBksLz8=; b=TBld6471/HQGm7V0G/POxlUjS9XAXjpca2gLogIJ/1C4iIJRZrxzQ6K6DNOup2GaSLCE0KjN7LWqKlWTHT2ub33SWqbKus11bp1tjNlt4XmGnfMzKrOg58UbSALALPP8ixSrQraYWCa8v/33P1o2W0b8gvbJXMjGz+5WB/0v0QwTp6cbuamdhQETBKcwya9EmRv+P2yvz3yI4ZoIVcHfR343kdOi+m+b0iUc1p5G49AMit+8xB7IhxBeUqL4jl9IJ5r/Imq77yIrjNABFRYvkqk2+JtZ97Rv/ilplIz3spKKO+QPMjnYm7Nt3Ri/E3Sb7hZ1YNvp5GS6ZizkeYtrnQ== 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=hmpuP41Ztn/lKlMcuw44+3sOiW4TYVQ+KI34gBksLz8=; b=xMW7ZuxoqDm7ruV8kMuNoAwdLg4q9yMzU4S0PUpd1mPzrxABlzgt/e/ElDUDeYNdct0jiJcpnntG3Ae8a1ZBHY6SWzlmQJ9CzlriJ+3P2FFXa9UFk6WWgClYO4lFud8jYE1e7PjTxdFFXoRzzXeqjwTPBJ8snzhIhoG41jL1sbk= 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: , , , , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [QEMU][PATCH v4 08/10] meson.build: do not set have_xen_pci_passthrough for aarch64 targets Date: Wed, 25 Jan 2023 00:54:05 -0800 Message-ID: <20230125085407.7144-9-vikram.garhwal@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230125085407.7144-1-vikram.garhwal@amd.com> References: <20230125085407.7144-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: CO1NAM11FT011:EE_|MN0PR12MB5836:EE_ X-MS-Office365-Filtering-Correlation-Id: f3e33193-298d-4928-0a9b-08dafeb1d136 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JrU+L8fHBezUmbiy8yLf6TqoYHDBgtn2b8vkCyyZy6Cw7RyRyOj1eynGgBhTiJXoHZExtTbeCH4DW5DMM2l/8C20VVlsoh9SKysux2HmfHwq9pwDbBO1OqbJoaIwg0HXxNvCWJAb4W5OgCt/4Uzjv0hNKCzSFXODa1zLmOMc6WtSeNkGYRdAFEpLY9L1IhPUxRXQIL8Dm7JFO7vZanKQG3VhZLZgQwfpeH3Eo5NcwJ+JsIs0Veb2uj6+Xa6y2SOx+h5KYMuo/EUFB7INnb3Anx+s4V0PyVBwiRyHPUAhVmvM7FkAWy5TcBQovaWvHD4P8TLEqribioPtdeqqm9dMUK0iJPd/zGxNOd0Ytz110aIKlyEcpGsM1Tl5LpuoQykOOJeAS+yf5SYSMehkn5U/9WG1DQw1NOymkQa4JFN1FqqF1Md9N51pfC+GVwlKKn9HJ7pj4zN1ZjGVkL7SdNp9epGWwoHxg7RFvR64GTN48ZmPlAACbb5dZF0YY+BxVXTcvoDHJei8bVVYu57V1kItxZLc983OaqG227guANXDrRlp6tBfg2F1vm7jBwEEZqAyboA9nEHmBnbsDiKPEiMKLgbdhhsGyfncKF/91I7HUIwg8g9W0UJbiSKbaFsCsWr/TbMShen5Je1/yN2MdLuHRbTO3MUc/uJI8i/DOhyyBFwIHo7+Lr6S+lcmGl6h3zDwnajPDVwtJpvAVkYt3SHNQoPhSOTYFafa8CpSKGZbtFA= 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:(13230025)(4636009)(396003)(346002)(376002)(136003)(39860400002)(451199018)(46966006)(36840700001)(40470700004)(5660300002)(8936002)(2906002)(70206006)(6916009)(70586007)(4326008)(8676002)(41300700001)(478600001)(1076003)(6666004)(186003)(26005)(2616005)(336012)(426003)(83380400001)(82310400005)(47076005)(82740400003)(316002)(44832011)(54906003)(4744005)(81166007)(356005)(86362001)(36756003)(40480700001)(40460700003)(36860700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2023 08:54:49.7274 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f3e33193-298d-4928-0a9b-08dafeb1d136 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: CO1NAM11FT011.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB5836 Received-SPF: softfail client-ip=40.107.223.49; envelope-from=vikram.garhwal@amd.com; helo=NAM11-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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: 1674636982241100003 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 6d3b665629..693802adb2 100644 --- a/meson.build +++ b/meson.build @@ -1471,6 +1471,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.0 From nobody Thu Mar 28 19:59: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=1674637011; cv=pass; d=zohomail.com; s=zohoarc; b=CyWG9vYTw6XBRNN2mmMop1TO2UIJ9jPOxIs6rtx97jkrwoltVIx2B/rOoyqOfO6tAK01WBgcWsMqEirnEqNSw3qSmm2Q/xUNHIDd0h9KR1W7PRdyY+kH5rAIdXTBAvdDS9iQ2ExgALZnz+Nmma72QFjscHcTj5LO9Bxr5IL+4eQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674637011; 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=A+E4BfA2jNdGJLu/KOY6Tiy/3hPOgzwaMVA9okKy1Xk=; b=Xy7jHey+HCJsaT1mmcfRq4/cu4f21397P92GQeV7/oOObMVE+vFYZXio0ykob8A42PIdRhkobkFcQGOSy2rLWtLSGcEGw7d6QhCcpZ4nMHi/91CvOu5duLK5Ims8C9W0l+G9vM687ogJ+UAPzc3YQFx3GzeplmOWyWCOtDlVMhA= 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 1674637011724295.0614296000779; Wed, 25 Jan 2023 00:56:51 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pKbYd-0003yS-8E; Wed, 25 Jan 2023 03:55:03 -0500 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 1pKbYb-0003yD-Rs; Wed, 25 Jan 2023 03:55:01 -0500 Received: from mail-bn1nam02on2069.outbound.protection.outlook.com ([40.107.212.69] 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 1pKbYZ-00012s-DI; Wed, 25 Jan 2023 03:55:01 -0500 Received: from DM6PR05CA0060.namprd05.prod.outlook.com (2603:10b6:5:335::29) by DM4PR12MB8449.namprd12.prod.outlook.com (2603:10b6:8:17f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.27; Wed, 25 Jan 2023 08:54:53 +0000 Received: from DM6NAM11FT023.eop-nam11.prod.protection.outlook.com (2603:10b6:5:335:cafe::75) by DM6PR05CA0060.outlook.office365.com (2603:10b6:5:335::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.21 via Frontend Transport; Wed, 25 Jan 2023 08:54:53 +0000 Received: from SATLEXMB03.amd.com (165.204.84.17) by DM6NAM11FT023.mail.protection.outlook.com (10.13.173.96) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6023.16 via Frontend Transport; Wed, 25 Jan 2023 08:54:53 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) 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, 25 Jan 2023 02:54:52 -0600 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, 25 Jan 2023 00:54:51 -0800 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, 25 Jan 2023 02:54:51 -0600 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oGopsUYhhHnYRJDCP/FiCXesns1Bq2PZcXNpP/03+CX2sPshXW7cPuFrO6KMy77kLVB+wVYmvM4dA+rCfj5KYw+W0Uj/G8mQ5bvfAGCeSTqxiRg8tlCRSK59DqTcxZ9aRI2wXhAlAXIIWik4J5WZAM52GpyBaWOdmSRzv8lNnnVWv81fAnWhi2BB52B6eFtfXjYEMFqcv+xLn6BBsTPrFh19ZLrSjkAy4IlztevVAl9Kvx2/HccJIfHARAI7ZHFKcih0wOGp5m24dtsbQyyAzOzoUlaXydr+Tuwi5Nlq3tVqVJbYyPmRHTpM+e/5OcYL/cWCGT3j4paleoEQjCxt0w== 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=A+E4BfA2jNdGJLu/KOY6Tiy/3hPOgzwaMVA9okKy1Xk=; b=L/zQzX0TroeeF0E1ELRyHNYPImy8BOPolMX2IUrbbOrMTbR5zQBUz7bXGfQoey8kWqiZuTmuu6xdWXkCfObaUpVd84/raXUs/Y7qZBnsnP4YJIevEOF+xWEcV36Jh4Q1IB8Vh3glflu5Wn364b8z/xzY/O3mjHtnssN2UZgj4zFvd6wQrbd5fC860qJQ5Vn1eY/E93Ei0/w4rZe4TQRqdV44E8dVE7vhGOnUOuLXz56Syg7u6ZxoBa+YoheyS/MirB4H6yTL+F3mfrYCpwA2rExIpwcKE3+Jcla+T0gju/ShMueFZ7APruODEtR83aGWGTqRiW1s94nZGbiSS7wRpg== 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=A+E4BfA2jNdGJLu/KOY6Tiy/3hPOgzwaMVA9okKy1Xk=; b=TtuPwwtLq+2QytKpmlBdCei0wMZTmTBPumausEOJzQDX8flkSQe05cFOVThzVjIC+FwE6ykioijOvyvai1ayAtgGz5/KbXPo06wgmw/5qKdn2Gjrkln/3RqBzmoQn5Q94MpyFORXUpD1nqfkWFTvUrkqOTGfhmDF/yPN3Wek8Mk= 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: , , , , Peter Maydell , Stefano Stabellini , Anthony Perard , Paul Durrant , "open list:ARM TCG CPUs" Subject: [QEMU][PATCH v4 09/10] hw/arm: introduce xenpvh machine Date: Wed, 25 Jan 2023 00:54:06 -0800 Message-ID: <20230125085407.7144-10-vikram.garhwal@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230125085407.7144-1-vikram.garhwal@amd.com> References: <20230125085407.7144-1-vikram.garhwal@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT023:EE_|DM4PR12MB8449:EE_ X-MS-Office365-Filtering-Correlation-Id: f8222557-8e9b-4499-8928-08dafeb1d321 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UESb5+TkqkWIwH0Fk09Gz/AONNGLrpxZctozO5EQTfFd15E3K/lMrH+akIosfkTfzdCCLiMATGxz30lN2LoSpVbycYIAS8TsoeNUBeXFhHvUGrl1XNOJwA6WArE2KH0W9JMKhiaD00lIH2QFLZuVUJbktGmQgdiBjGfuRkXS2xDsh+iTkwlfG4aYuJ0HYORkpslUNJOR2g17clAKZq7YUr3W1oLQTBh8etkZiimaEYiC6QACGnnMaNk/3RFz9qGASuWTea0X+5AyqwEqr+nT0VQ2JbrnTBOGfAKvfUtNykdsUAsA+YVlKnXypEYCi45Fbccj44aV+gWBa8tqz/PmaYw2thYlNRU5wo97gQeCA+jz2xM1lOFuU+n2NCLuRY0ZX7eBAlKduknkev/PXqUxbH8mxpoI3JQhrM8kCO1ar/jOAUyrJV33yEU18tnm1WdgCo+i15LWEe5wK9Bg8oOtn0SW/qo1Ozl0pPsJHRtsqIH8Z4HIO3Z4aJk5foPlGnhsFs7bbZGFxdSv5reusifeA6kub2NAdpiHosT5LV71G6/Q4/9ygqWjhG5ezR5lhltGt9gsqfvB4RbBGIgkb3ca+3fRP5z/wNfUHxq1bbze9/ozbSMRITX8OMs5O8ZbTFkJUqmQeWPyqYijxjEQNGOUmPWv3y5/FuSa9g3AgWo0vOLbvSmJPBiBx3E3zw5nkmfiEt0TnkQa+oQ+GqAq26TxR7fRX5x6objEQQtA9cjJl6oOksaFaFVh64YX8fD8r3wYHrB3HAuy+5O9rpR5KVQcrQ== 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:(13230025)(4636009)(396003)(136003)(376002)(346002)(39860400002)(451199018)(40470700004)(46966006)(36840700001)(82310400005)(966005)(1076003)(86362001)(186003)(26005)(478600001)(70206006)(44832011)(41300700001)(82740400003)(336012)(8676002)(426003)(4326008)(47076005)(70586007)(8936002)(5660300002)(40460700003)(40480700001)(36860700001)(2616005)(83380400001)(6916009)(36756003)(6666004)(356005)(81166007)(54906003)(316002)(2906002)(66899018)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2023 08:54:53.0422 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f8222557-8e9b-4499-8928-08dafeb1d321 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: DM6NAM11FT023.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB8449 Received-SPF: softfail client-ip=40.107.212.69; 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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: 1674637012443100005 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 --- docs/system/arm/xenpvh.rst | 34 +++++++ docs/system/target-arm.rst | 1 + hw/arm/meson.build | 2 + hw/arm/xen_arm.c | 184 ++++++++++++++++++++++++++++++++++ include/hw/arm/xen_arch_hvm.h | 9 ++ include/hw/xen/arch_hvm.h | 2 + 6 files changed, 232 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 b036045603..06bddbfbb8 100644 --- a/hw/arm/meson.build +++ b/hw/arm/meson.build @@ -61,6 +61,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..12b19e3609 --- /dev/null +++ b/hw/arm/xen_arm.c @@ -0,0 +1,184 @@ +/* + * QEMU ARM Xen PV 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-legacy-backend.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 + + return; +} + +#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.0 From nobody Thu Mar 28 19:59: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=1674637006; cv=pass; d=zohomail.com; s=zohoarc; b=CYYnuAC9J9iWFYtsI6dZiB7Ucfyz2U4e4HDvvNFrPyOT8lhZ85tMSpJpHWBYMH9gpEQWdCeu9aYvaURNv7056HXl1GR3i5wPHLidDVKTZ9eJeNZEugzR0rHqsMNLoKd68etluKLE+Uwv9JCLq2V4uLfZAxQLuOfttv67uq/gyvc= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674637006; 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=5c1IzY0YQxuTPTSwy7UvS0mMbpPve8RkE4gupE88sNQ=; b=aSGod0ILL5+pNuCOs5W0HMU/kVCTQODocwtpbi3qTTSsqJCenpBl4erwQZ7mpYP9MPsJsv+dT+LhGbqXr33xJIpeahdXRs5MeQTgmFBGduU98g9ugxFV/hgAX8OSMzqJHlG1SOsVyBtF9c6cs1gK+5ejbGMGg80ofKHjYCrHfUo= 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 167463700690580.95095739935186; Wed, 25 Jan 2023 00:56:46 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pKbYn-00043j-Ct; Wed, 25 Jan 2023 03:55:14 -0500 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 1pKbYk-000431-T0 for qemu-devel@nongnu.org; Wed, 25 Jan 2023 03:55:10 -0500 Received: from mail-mw2nam04on2042.outbound.protection.outlook.com ([40.107.101.42] helo=NAM04-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 1pKbYj-0001EC-1S for qemu-devel@nongnu.org; Wed, 25 Jan 2023 03:55:10 -0500 Received: from MW4P220CA0011.NAMP220.PROD.OUTLOOK.COM (2603:10b6:303:115::16) by BY5PR12MB4097.namprd12.prod.outlook.com (2603:10b6:a03:213::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.33; Wed, 25 Jan 2023 08:55:00 +0000 Received: from CO1NAM11FT102.eop-nam11.prod.protection.outlook.com (2603:10b6:303:115:cafe::9d) by MW4P220CA0011.outlook.office365.com (2603:10b6:303:115::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.33 via Frontend Transport; Wed, 25 Jan 2023 08:55:00 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT102.mail.protection.outlook.com (10.13.175.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6043.17 via Frontend Transport; Wed, 25 Jan 2023 08:54:58 +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, 25 Jan 2023 02:54:57 -0600 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, 25 Jan 2023 00:54:57 -0800 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, 25 Jan 2023 02:54:56 -0600 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kxWAVTOBVOUjL5UYlCO84yiyrkTvRDA4n7XtfxX7eKRC8MRclmE72TUiQ89XDARHwfu6JOPXdbX6tJX8HDGcgXTczweqLEQMbQ8nX6YoakDdA75UmAb+Bg30WurKLvcUFESnb0b+1A1bmZTdw0HX5iCuYv492sohT6MZ1j7njzyjgxrChKD9WI+GH/iUaRHF4UDTwRNNcdbPQL0e1ZJuDkj01kNDs1pYKhdj9DQgvSseyhQO2KoEh5BH8aUvPkKpBcYsdZ4uN540yN7u4Qg//W3++7fpS3JYnmYxb0jZSSRCO+cEOfIjf6CtqDFU/k2n9uP9/tJu2r2cHc6yidOIxw== 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=5c1IzY0YQxuTPTSwy7UvS0mMbpPve8RkE4gupE88sNQ=; b=jWjVVchFI7l5w6SpbKbyeHS6mytJWIg0DDoNnEVQQC9zpufPeYIHXUuNhUn1j4JkcAIIZYUZOsBzrUjt08VQSfgf26zZQkAozDX9as/3msijr5h7uooxShFra8i8mGaonREP/V2+oGIQw+mprs5NEmO7p0l6pTewCHswbqPmsOVqWR4qeEVVxT1gRZ8F3+TAJeiRRF8MEZaVVEODXnqpgNVA/T1VWDiSNi2lMWXIg3iTD7QAJjGVMFvhSSyhWSAGXlZujN7at6jvkAdadIEqf/geTt9HC8o/4/amiBmm5pEsAHFLI1HI/Pk/1riPyJxDWmYPpu0WlosHqORTnytQ9Q== 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=5c1IzY0YQxuTPTSwy7UvS0mMbpPve8RkE4gupE88sNQ=; b=hlARu3HTkF23xk9tSeTT9xRxQfkJSimxcFiFQEte+F8SNvnUAEQspE8SuV6KvePw3BdgR47pQaBGTMsWy/zZfV0E3JioxFpxN70LvU5ZnLdc9kU/45ZryIujTGzi+CGmjGPnl/jDu7OGIsamavfPEbFdUlPjjhYJ/H4CSzqXf+Y= 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: , , , , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [QEMU][PATCH v4 10/10] meson.build: enable xenpv machine build for ARM Date: Wed, 25 Jan 2023 00:54:07 -0800 Message-ID: <20230125085407.7144-11-vikram.garhwal@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230125085407.7144-1-vikram.garhwal@amd.com> References: <20230125085407.7144-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: CO1NAM11FT102:EE_|BY5PR12MB4097:EE_ X-MS-Office365-Filtering-Correlation-Id: 781d4595-95aa-49c5-90cc-08dafeb1d692 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: X8BA/G5jP91Ma0luh2+A2kdn49JOEazXISIIsHSdexkIRnaHxdVRTDfJH9iNXtJIaR0nZjBZjLliBn2SB2sFCekNvcqiLgQO6eVmlNzagJ/BHbVu3NsPbX5OWx7s31mPgwbZQpkid6EJfpPrILcnawNAM9J+3wqKc+UVQRq3uHDvyWfcyH+C2ARWEGONZ5sUi3l83vGItQQbqjTv37EVfAIjXzs9mr95+HiCD7p60pw/WYChj+LSdQpl3/CbUbqkc61pfYNQ42EMinhwSD4Izbl1JFPyqW2Lvaf4hf7/a6jmkgqh4BYPkJyQnqU2vOP1KH1jGWLBhfe+cQC0qApsXsVfZk7BE5nEzN+Rs3CVITzSXhdhIU7/Ct1WUfbGrqsS6ByvJX9eNkgYRyCdgjEeNJsYvidyv1gMFXJ6JpKNJ8cb1lC8SsWcKazBvSQNW85YAOTVmiMT+j9f4W/eYHPWw2rnAeT/gMrhiLtqJiXChdZon9obqEfW/XGOZoZqLObKnC6jWkEFjpwfw2LR4RJm/YK/EBWPy+Biv/MadKKsJtEAPfmwh1lXgyfHEaa/o4QB1Hc60GOw/tz4RIoT9uO7MyMDyqLDfL7o+uqZhAJEL+UVPreZ+A3IFAVcRXN/xUzg9Cttkoxjj5ROduik9EjYT2CQj8ki5+b4uy211qIwaCzEZh8E5kzdpBxZoA2wfA6md3nlWvEf5Y68tyfe+jkO2I8u6ZzFKt2ULlIwf4GoIwk= 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:(13230025)(4636009)(136003)(396003)(376002)(39860400002)(346002)(451199018)(36840700001)(46966006)(40470700004)(82310400005)(336012)(86362001)(356005)(5660300002)(8676002)(81166007)(426003)(40480700001)(6916009)(36860700001)(36756003)(47076005)(2906002)(4744005)(66574015)(8936002)(83380400001)(44832011)(26005)(70206006)(316002)(6666004)(186003)(1076003)(478600001)(41300700001)(2616005)(40460700003)(54906003)(82740400003)(70586007)(4326008)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2023 08:54:58.7223 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 781d4595-95aa-49c5-90cc-08dafeb1d692 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: CO1NAM11FT102.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4097 Received-SPF: softfail client-ip=40.107.101.42; envelope-from=vikram.garhwal@amd.com; helo=NAM04-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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: 1674637008405100003 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 693802adb2..13c4ad1017 100644 --- a/meson.build +++ b/meson.build @@ -135,7 +135,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.0