From nobody Thu Nov 28 12:55:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=RiversideResearch.org); dmarc=pass(p=none dis=none) header.from=RiversideResearch.org ARC-Seal: i=2; a=rsa-sha256; t=1670961211; cv=pass; d=zohomail.com; s=zohoarc; b=mDsl/ln+AnlD1gZkjnM5xQOfA/fyFhaGSiPMgSY5SCJCkEEbNTLCq5AHmuJ2PGjqvX/X74PJo4Ks8P/9EPcXDPCyZizsD2Gfc+bx5x/tSD2baUt746EoTKmrke/AWHg8v8Oonpo0dA11TNefXXYke1qG3Pq3VAVA+2tb1Mfk0zE= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1670961211; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=pHSvZrTZQtWFI7F16rrfG3KOpPlzn9NPjYA2g0/qmS8=; b=G1M7znCgWHDyLMGonAkzSh6/fyrnEBHfTrKtfKjD8Ni4C9BZEGAEmld04lEX9mhJvqgHY/6ZwZccZ85SuqGS0mShVa0Naf4FshQfKxPKTvaUFLrClgc/y0OnWycd/eJbbFYLt+xFwFmerGdn/KK7W4Avw7OGQHcyK0eI6BU7hbU= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=RiversideResearch.org); dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1670961211248543.2009262599595; Tue, 13 Dec 2022 11:53:31 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.461126.719165 (Exim 4.92) (envelope-from ) id 1p5BKv-0002zZ-8z; Tue, 13 Dec 2022 19:53:09 +0000 Received: by outflank-mailman (output) from mailman id 461126.719165; Tue, 13 Dec 2022 19:53:09 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1p5BKv-0002zS-65; Tue, 13 Dec 2022 19:53:09 +0000 Received: by outflank-mailman (input) for mailman id 461126; Tue, 13 Dec 2022 19:53:07 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1p5BKt-0002zI-J2 for xen-devel@lists.xenproject.org; Tue, 13 Dec 2022 19:53:07 +0000 Received: from USG02-BN3-obe.outbound.protection.office365.us (mail-bn3usg02on0124.outbound.protection.office365.us [23.103.208.124]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id c268770a-7b1f-11ed-8fd2-01056ac49cbb; Tue, 13 Dec 2022 20:53:06 +0100 (CET) Received: from BN0P110MB1642.NAMP110.PROD.OUTLOOK.COM (2001:489a:200:185::22) by BN0P110MB1692.NAMP110.PROD.OUTLOOK.COM (2001:489a:200:186::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.19; Tue, 13 Dec 2022 19:53:02 +0000 Received: from BN0P110MB1642.NAMP110.PROD.OUTLOOK.COM ([fe80::81df:6431:7a2d:4610]) by BN0P110MB1642.NAMP110.PROD.OUTLOOK.COM ([fe80::81df:6431:7a2d:4610%5]) with mapi id 15.20.5880.019; Tue, 13 Dec 2022 19:53:02 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c268770a-7b1f-11ed-8fd2-01056ac49cbb ARC-Seal: i=1; a=rsa-sha256; s=arcselector5401; d=microsoft.com; cv=none; b=tnvgy/xTAJuKoLYyk/KSQLpuol8U3VjmsSAGbzsOfNnUX9eafwae9MP279xtvki9zBzrbLMQSUAmQ7nggyOKM1omI7pc6Z8CLYy5Q3VwV7V2+Jlm5pVQJG/FmeUZ3mlsYfWfftN9P9sbgfFnzrPiLFJoWRmUgcutDsbO77gQYtNee4bxdoYyicVev91fJCKz3BSf8O7fvUjFTLWAbpfSeR9Y8ZpE80/Jd1RJsEEL4rZTSPqys84F+huIS8rBkaKm9+jaR7L/hY4UaXNkkp/1jcPKZtxQcJd6f3su+JKIqlsCjmajSpf9tY7kjMMBprcsyaQ4DY8OxwrRhj6a18oZeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector5401; 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=pHSvZrTZQtWFI7F16rrfG3KOpPlzn9NPjYA2g0/qmS8=; b=CppTCcgYWyROidHWmbHX75/ZWNdmGln7ZHwteVuSvmIC6ZnGFDPl1tIB6u/MUQTAa17FzHVs+DEZjUz1AGLgyhKfSvjYnFV+780cqoOh44skiWN3vQdM4ryhulKKn8MgSOYiMJN7DX5Fd+++AYRl0Rd90GwurmSdIgv1r/mQclFGOcaozNw1jDjp5EZARff9TgQDTHgGNQ+XQHpybPCOI2sZZZeF2V6lAZoMzjyYwWFcVLx9/IHsFUns809jh606GpHNDTo4vj1ThlrIThYXidvd+ReQSjsIe5xdZQsT8eeM1CTHzPafgSz2nlV2u5k5NlBaaSzkXliQ0JgFKe/xMg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=riversideresearch.org; dmarc=pass action=none header.from=riversideresearch.org; dkim=pass header.d=riversideresearch.org; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=riversideresearch.org; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pHSvZrTZQtWFI7F16rrfG3KOpPlzn9NPjYA2g0/qmS8=; b=rFBqmPhFr44D3GoNKdcl16bBZqxZwpRjDJtvrxytPbZdVZNqxjMcM87Yw3ZWp6YzjvQmYsHia7kile9+wdhUdRdyzRSCDNslTFWZslllTfRL8T157iKlEceyMJa3m8OYggMq3ZBuS55i3vnsKRCXe3wshq/jk4BfBiaA/l3VMkODlqTZWG2utKEE3KXfFInhB8vNqLOrtIrS/65i8mLCSTdUwKkYfPOgvtL2BLCZQ4iGzq5Y14zVWB/HuGzAzDNQe3iTiz1dOOA6dEm6Q8OlOEfSCZP0V26KBorxXKlS7bwF9E6ZcuSvfm7K/vOU7DYTA+1WN6O82tE4Il7qDHay2Q== From: "Smith, Jackson" To: "Smith, Jackson" CC: "Brookes, Scott" , Xen-devel , Stefano Stabellini , Julien Grall , "bertrand.marquis@arm.com" , "jbeulich@suse.com" , Andrew Cooper , =?iso-8859-1?Q?Roger_Pau_Monn=E9?= , George Dunlap , "demi@invisiblethingslab.com" , "Daniel P. Smith" , "christopher.w.clark@gmail.com" Subject: [RFC 2/4] Add VMF tool Thread-Topic: [RFC 2/4] Add VMF tool Thread-Index: AQHZDyyCZmiYxt72lUSeSdNxVMCy4A== Date: Tue, 13 Dec 2022 19:53:02 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: suggested_attachment_session_id: 909825dd-f06a-34b3-d508-9ecb7894b4f7 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=RiversideResearch.org; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BN0P110MB1642:EE_|BN0P110MB1692:EE_ x-ms-office365-filtering-correlation-id: 9891cc48-a4b6-4cbb-3e06-08dadd43a518 x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: nCakgadVebztqIerCv/2u6rfRGwe9XHMdLSO6WfssGvXzOPSU1za6JNXH6P33cRLZeKs5C2jRt094hZL1VFvpiJThW5zImmY+ww26SCTmUnjYdxjVvtk5lC8tFMnF0v9Gv/MXXvBKfinisVRWTCSby9FywhAcf5D0z4HRrRlnUj2/cXP0OuSxXMj5KSnQQkabjbL8uW4pKnDiytTjeRwhAsj0USIVWNBCyLkiiwA6yt7HAC+Dt2vazEKlASb6l3waYQc9Zk9j1ISiM0parASKeR1FFnYNDQVER5MTXZ2oINqOcdbWBM9cXmyWNXMowxTQkWOuBgUiPWy6ahWJ66wK0JQLWX9jRywH3D759xL5U9LNLq/RlicZjdUfe0zAsRB4iqWZgScP9QJ49d9Z01xG996uJumYKT+GVx6MQmaCz2Hy/dotjTUiv9geEUENZutjW6oX3Nb8HyYmbADuvwFMntXi8H7awQYIqtj6adhmVnyctFZ9tEM9wSSvjmsZ/9a2gBqWjJ/jh9e4aJqrdhA00RVZJYxSYUWkvKOlSobUWh9zJTn/NKMCSLb2mgxMGlzKgVexF5XKazsTDiRxmquQ4wXsYqQbokTG+Z0J9TFzZAS6DX+L9v5wA0skMucCw5HeKq+Up+vpxrGba1rdsaHBg== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN0P110MB1642.NAMP110.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230022)(366004)(451199015)(33656002)(5660300002)(7416002)(8936002)(83380400001)(6200100001)(6862004)(52536014)(38070700005)(2906002)(38100700002)(508600001)(71200400001)(8676002)(66556008)(6506007)(9686003)(186003)(26005)(2940100002)(66476007)(122000001)(7696005)(4326008)(76116006)(64756008)(82960400001)(54906003)(66446008)(86362001)(55016003)(66946007)(85282002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: SPxrhJKb3NQixgyTO97nAykM34le54EgEMKzDTlqZfhSN6Pq/AV/6/KCpP0N1JAYquJxPHjslVXYBxg2VLPDpb39NvfhTHrgiq6eBVL9rj08HDXNl9+4pmuqFWGjO7/EnB/PEu5nyZ+1uX6b3PB2CMcK092FvSWSR3VccbN0ZRJqXv80vKIdP8R+OhOYTxJJvGRk9HO5eolvo3J0coEx/wcH3beykKZnzbIus8Cx2paz2j3hdZtHUCCaS17Nr2xCiE0KS1VNBPNsmJENUM3d9Ox5wxIcRdzvcSyOmChFSQ97HIuTBRFHJ3FA6Bi0uBBRclKcP9WW6LmU608KwNlUcYHZFywJG/KAyk7pvvdRBPrnDmBVjS9nYAJFI4Ii5mBa6B/qlLp0Wv6QoyRVQA37RwTBvHNxjjEQQztUbGefwBc= Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: riversideresearch.org X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN0P110MB1642.NAMP110.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 9891cc48-a4b6-4cbb-3e06-08dadd43a518 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Dec 2022 19:53:02.8566 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: bfc64a8d-9064-4c64-91c3-9d10b44c1cb6 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0P110MB1692 X-ZohoMail-DKIM: pass (identity @riversideresearch.org) X-ZM-MESSAGEID: 1670961213143100001 Content-Type: text/plain; charset="utf-8" VMF tool for calling vmf_op hypercall. Eventually should be merged into xl = and related libraries. --- tools/Makefile | 1 + tools/vmf/Makefile | 32 +++++++++++++++++++++++++++ tools/vmf/vmf.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++= ++++ 3 files changed, 98 insertions(+) create mode 100644 tools/vmf/Makefile create mode 100644 tools/vmf/vmf.c diff --git a/tools/Makefile b/tools/Makefile index 7997535..ccf36a1 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -9,6 +9,7 @@ SUBDIRS-y +=3D libs SUBDIRS-y +=3D flask SUBDIRS-y +=3D fuzz SUBDIRS-y +=3D xenstore +SUBDIRS-y +=3D vmf SUBDIRS-y +=3D misc SUBDIRS-y +=3D examples SUBDIRS-y +=3D hotplug diff --git a/tools/vmf/Makefile b/tools/vmf/Makefile new file mode 100644 index 0000000..ac5073b --- /dev/null +++ b/tools/vmf/Makefile @@ -0,0 +1,32 @@ +XEN_ROOT=3D$(CURDIR)/../.. +include $(XEN_ROOT)/tools/Rules.mk + +CFLAGS +=3D $(CFLAGS_libxenctrl) +LDLIBS +=3D $(LDLIBS_libxenctrl) + +.PHONY: all +all: build + +.PHONY: build +build: vmf + +.PHONY: install +install: build + $(INSTALL_DIR) $(DESTDIR)$(bindir) + $(INSTALL_PROG) vmf $(DESTDIR)$(bindir)/vmf + +.PHONY: uninstall +uninstall: + rm -f $(DESTDIR)$(bindir)/vmf + +.PHONY: clean +clean: + $(RM) -f $(DEPS_RM) vmf vmf.o + +.PHONY: distclean +distclean: clean + +vmf: vmf.o Makefile + $(CC) $(LDFLAGS) $< -o $@ $(LDLIBS) $(APPEND_LDFLAGS) + +-include $(DEPS_INCLUDE) diff --git a/tools/vmf/vmf.c b/tools/vmf/vmf.c new file mode 100644 index 0000000..8b7b293 --- /dev/null +++ b/tools/vmf/vmf.c @@ -0,0 +1,65 @@ +#include +#include +#include +#include + +#include +#include + +int call(unsigned int cmd, unsigned int domid) +{ + int ret; + + xc_interface *xch =3D xc_interface_open(NULL, NULL, 0); + ret =3D xc_vmf_op(xch, cmd, domid); + xc_interface_close(xch); + + return ret; +} + +void help(const char *arg0) +{ + printf("Usage:\n"); + printf(" %s dump\n", arg0); + printf(" %s info \n", arg0); + printf(" %s tables \n", arg0); + printf(" %s unmap \n", arg0); + printf(" %s lock\n", arg0); +} + +int get_domid(const char *str) { + char *endptr; + long domid =3D strtol(str, &endptr, 10); + if (domid >=3D 0) + return (int)domid; + + printf("Invalid domid (%ld)\n", domid); + exit(1); +} + +int main(int argc, const char* argv[]) +{ + int domid; + if (argc =3D=3D 2) { + domid =3D DOMID_IDLE; + } else if (argc =3D=3D 3) { + domid =3D get_domid(argv[2]); + } else { + help(argv[0]); + return 0; + } + +#define ARG(cmd) ((strcmp(cmd, argv[1]) =3D=3D 0)) + + if (ARG("info")) + return call(XENVMF_dump_info, domid); + else if (ARG("tables")) + return call(XENVMF_dump_tables, domid); + else if (ARG("unmap")) + return call(XENVMF_unmap, domid); + else if (ARG("lock") && (argc =3D=3D 2)) + return call(XENVMF_unmap, DOMID_IDLE); + + help(argv[0]); + return 0; +} --=20 2.7.4