From patchwork Mon Mar 13 12:12:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 13172415 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BCBD5C6FD19 for ; Mon, 13 Mar 2023 12:13:33 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.509247.784656 (Exim 4.92) (envelope-from ) id 1pbh36-0000wx-Fd; Mon, 13 Mar 2023 12:13:08 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 509247.784656; Mon, 13 Mar 2023 12:13:08 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pbh36-0000wq-Cj; Mon, 13 Mar 2023 12:13:08 +0000 Received: by outflank-mailman (input) for mailman id 509247; Mon, 13 Mar 2023 12:13:07 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pbh35-0000wk-12 for xen-devel@lists.xenproject.org; Mon, 13 Mar 2023 12:13:07 +0000 Received: from esa2.hc3370-68.iphmx.com (esa2.hc3370-68.iphmx.com [216.71.145.153]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 66c7d0db-c198-11ed-87f5-c1b5be75604c; Mon, 13 Mar 2023 13:13:04 +0100 (CET) Received: from mail-bn7nam10lp2105.outbound.protection.outlook.com (HELO NAM10-BN7-obe.outbound.protection.outlook.com) ([104.47.70.105]) by ob1.hc3370-68.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 13 Mar 2023 08:12:37 -0400 Received: from SJ0PR03MB6360.namprd03.prod.outlook.com (2603:10b6:a03:395::11) by BN9PR03MB6203.namprd03.prod.outlook.com (2603:10b6:408:100::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.25; Mon, 13 Mar 2023 12:12:35 +0000 Received: from SJ0PR03MB6360.namprd03.prod.outlook.com ([fe80::48a7:d1ab:897:acda]) by SJ0PR03MB6360.namprd03.prod.outlook.com ([fe80::48a7:d1ab:897:acda%3]) with mapi id 15.20.6178.019; Mon, 13 Mar 2023 12:12:33 +0000 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: 66c7d0db-c198-11ed-87f5-c1b5be75604c DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1678709584; h=from:to:cc:subject:date:message-id: content-transfer-encoding:mime-version; bh=hmQcKWst1FY86OGi2e2q+9opEVen7q4pY6RTkjeHqg4=; b=Jz1ejDePJ5mSvUfmMm6RBWVg0vFvb9HvZuMJ/dhLr8sx4tma6XmHtfB8 Voeqye9KJSuQf2L0jMyS2h2JzuYk4gOF9zYZtSzhHAxF9nVK8Ng7Bcu6c fqD1b23QrJcsM/DbvDjHcV/2ymHTrJpLI8JsOrgmIQXIOSiMfBlvC+Shz 8=; X-IronPort-RemoteIP: 104.47.70.105 X-IronPort-MID: 100503823 X-IronPort-Reputation: None X-IronPort-Listener: OutboundMail X-IronPort-SenderGroup: RELAY_O365 X-IronPort-MailFlowPolicy: $RELAYED IronPort-Data: A9a23:FgCUe6LCOplDhHV6FE+RzJQlxSXFcZb7ZxGr2PjKsXjdYENSgjQDn GUfCm6BbP+NZ2Gm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GBkc8cLxTrk0KNaJ56U7OPkTgpqKWE6Uoskv PLvxA8Vv4Do0/5TyWQm1/AygPg2DEh5zvLzkKZu2LqpYjcSCghA8RMqIpFel+BgnBQ9e1U4e Zu5Sa0ppBXBRTPkGDU4MXJbQhjkg6RrWA5meAeonRDWc81aaNXr6YY4ERJea1wah7S2cQCKq 1DHcvc7PFZfRezaG3YhHBmxJiWUnE6Dn69Mzo/k/3Q9wITsGFyzkMeysBatGwH7ogBR55N4P mBGrh0lZlVJ/VmIp5VNaMke4+aG2bNSRXDPCa5OlL8DpwKPHrLttre/Kg13ue3Y5YFpaFC1K gpaGko9FLaRnieSfFnhPZwg1PwqSSGLHnQI/hlltZEUuaWfsuoDcWBIGpe4PdI7c9vR/EzYM zDRq6+M8WTUVcGJrw5oDEWI6MiT0X2cPdlz+rTCGj+1v7jG8nNitHxVsr1Cf7ELQsEM1mPck frGgKDbvl90g== X-IronPort-AV: E=Sophos;i="5.98,256,1673931600"; d="scan'208";a="100503823" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Cjl+0RpSNKQ6rMU7ygiImHgzdavMnoaavfeXgfomyXumC8FnPNcqvhUYn6XMaMoNguVmHREOH2vwOI8QneNWK4V8FM0hH4kzqYL0wYwqLWvwhOlUPKk75LzeeNStE7sBhP0mcihpDgBIzF9Q4ndagzwes2MdG5/cqdrO5ZpgOJuAQJWnHklykCrRTCUphWIqs6EO31JiSQKoORDvlNu7IQakgRb8jODl8g5pVnRNjs1qbHkpoO3hllPFyRSUwxBl+iEqPyIZbYsE64YX7gdtvZAM80ixjcSePkY/DPzPgNCYDCEV79/QetxXljqg1jaEng0LwnqEyHasq1n6TOqilg== 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=snNv+meeJ8VUCO7BN1YFfaJap+t/BpYIEUVH9+RrQO8=; b=jUGcVQUKwh7DXnGzge+ProaN9JKXRo4fNnGoil8yGqW8snI1yFyofF66y+k37mamzIsXGRasMkla3MCXiq+qWEvOIRxahREstz3kmUt3nC92cyXzt7ql7ZuAft34DCE98q6MhN2TKadgEXDhu94ktsSHqn9Sat0YpPQLbQ9IaqfCEPjEnWHd/dUz5xehSKsZwMVn87RPnrx7kYqHvklb1fkOt0eIsbKmBEEfrqeWTadcHW59jtQZ614kf6kUaxZYpQftm6x9JPnoVMDA0F1dCHWxvTE6CE4KlVqZ3bfZ2X4kMK2Op1lCh2g25xDsbLbBrHjHwX4NzwVSUNtZrhjw1g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.onmicrosoft.com; s=selector2-citrix-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=snNv+meeJ8VUCO7BN1YFfaJap+t/BpYIEUVH9+RrQO8=; b=aUAjiwiDuJDfMfWy8k+uJf/966TWXAituvimadqNMYrSRdXVQRKMaRG38hcGyOVQrDcunshvC+i2MtktCdiijtGlyuN+VgJf5VKRRBeux5jxbWepJsBaE4dlyttmVL/7+Fht6DhUyE6lU1RqTSDEs6NFgP/u10fj2x+AZxb6khc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com; From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: andrew.cooper3@citrix.com, JBeulich@suse.com, Roger Pau Monne Subject: [PATCH v2] tests/vpci: install test Date: Mon, 13 Mar 2023 13:12:26 +0100 Message-Id: <20230313121226.86557-1-roger.pau@citrix.com> X-Mailer: git-send-email 2.39.0 X-ClientProxiedBy: BN8PR12CA0023.namprd12.prod.outlook.com (2603:10b6:408:60::36) To SJ0PR03MB6360.namprd03.prod.outlook.com (2603:10b6:a03:395::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR03MB6360:EE_|BN9PR03MB6203:EE_ X-MS-Office365-Filtering-Correlation-Id: 4c270ea1-337b-4f9d-75ed-08db23bc39cc X-LD-Processed: 335836de-42ef-43a2-b145-348c2ee9ca5b,ExtAddr,ExtFwd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5YSlNHkLgbTmzIEaZJrJd1yWCF/a2s0TMoCmSBVclSY7W0fE1v4iXhSG7fwAfCdsAN3Z2hbUWp3WvUf8SiQAhJvivAY5TFpS/g2JbBYYFecRK3gPPi85QcDVNFnGrMyz7Y2BzceItyIag697OgaEw0teICt/0zesgzIuVH3mVkcfhZIMniV5cv1GBJOLvo1A9LZBLHe1l5qDWyBSjQyYPRI0tRzsjqw2K2zjHT/Y80qhYOyM2SZUhXEeyYs9GJ5+v3ShWZJ2gk9kPzuqud4wvYWCjcCY6FubJKC+JY7cO8PT5VG+L4+zx9UwpVJfrTr1muMWHGYXQ4PIDYYnY2TvJmgdaFe9QObePuieYBIpZaTzmzvjyRefWalC/pyL0nP/GdlefPNMlb1WhxLY195zEYb8sZ2e6oXmNYAN4pBFeD0NVvNLcphIrKt+smMWEshY6tN498pqjU05hl1VfWD1azZUx2HpPOppgwP5BbcLjeYt7//NC0AKd8jePDbU/TfBLtgZBMi7NoFKnhd1XoLSEmXymlSvXzIDd8y9xLN6+xIPg2uufuJT7C9LGnIzbqQbYgd7tWov9MM97H4InI3Dn1U2hQhw1uPFGouV6nX9sCU+JwW5NvqpaXsbGyh/CasuNWzkVQcYLvYaE3WOAQ3g2g== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ0PR03MB6360.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(39860400002)(396003)(366004)(346002)(136003)(376002)(451199018)(36756003)(86362001)(6916009)(41300700001)(186003)(26005)(6506007)(1076003)(6512007)(5660300002)(4326008)(2616005)(8936002)(316002)(478600001)(8676002)(107886003)(66476007)(6666004)(66556008)(66946007)(6486002)(82960400001)(38100700002)(2906002)(83380400001)(66899018);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?U+MK46lvXVQtPNhA6Epirg8Uh8oC?= =?utf-8?q?aaZuNInrQ+9AEGzEW5FV6jF6NOyEGU9F1ryv+PBfVWRGGSPBBi2HJTO0iGhDb2DA9?= =?utf-8?q?JUDwy36FebxTwkhaD08yMeEAAVtBnou19hYyLL8vCh7JXvToMM12bTxiwzKN8zaBW?= =?utf-8?q?t9JXiw6b5qXuGJtaeOITuH1rsHnfMbAkQxZwJ/W9h9cwjP8e5sFq2Acq1ShiHB4Ny?= =?utf-8?q?IFBnEewBA4As5/hx4qB+EtuX4rH/rPhjxydBumF9umwoqWge/bPIUA4vw4svDyrWm?= =?utf-8?q?IdqIVMmcD0c7EZXhhbkg8K1BTBGkxYcEUrbXfGfQ/DQC6o3m9e2vQb8Rf4YF3A9wJ?= =?utf-8?q?KORHY7fJzCDZ4J4fA7D30zMWebixiFRHHPwpCHwctZkC6Wp/uctC6zP5U2F64+DrO?= =?utf-8?q?9DwJqo5WxnIEhjA+7qOirmOLkTirZ4SxkkHuqf8lSafwqjDAvNnKJ23Az8fjY8G9e?= =?utf-8?q?IuRhilmXEFIdbAm5+F8O5z/CdFH754GL54n3PEBnmHPZctHfBzR2kI0pC7BYq7RSw?= =?utf-8?q?SUi5DQn0d06mepdFhHzcsZn+mkr7ZwhFvEci4rcUsiS/nznjkcBRf2L5Wgu8RSMNS?= =?utf-8?q?ecESojck0weV2FEpA4lTKZ6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b0iJzd4GGsrFLD7/UVI1yf15iCjoB/NTbhL0WsZ?= =?utf-8?q?hBBOZBOJEQ8KhK7SgNYuw+ZT7ecXipBMow=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: yV+CpMihrWmLsCXyPu0Sob6uC6KB5zZcN46LKY1PnRylYOdnObU5248BnTLxSpennTs/Of0O+14T8ZdbRm/wRI4b29zyMecNNMj2fNXDsUkFxj70Nfdw25PgM6eRAQIsNxqNhRlDxukH+4e2j7aVQPpcpTxNUryQTfGzvdaXYlrCcBPYTPhW14Grsuqx9euvbWVWqQOX9KaTRacVf3j2yVFv1cEEhRi7QtW8xJU1bDe2SrsJgKEsue2bhCvdnvFxvOhW6yodvoWnqn4q7kclViEn4AkQ47Qlfw7OW+F/fdiWXNINUyVD8sNlXWglDakLW4KIlGLfH5nGUqlVUUVQiBA2xBfJle1Dgs6PdvuPYCXsyr2JUC9D0ahBTp5p+GvAZ83gUzms3i305IYYaif3wE2doXJty9pnRSpSbZGzA+uqCQGUk3ZSlk4L9iUQSyFv2og9FwIhxn5c2xNwnIxwtJSaOozadn4E/nHNkAd7pXRxa8Pm7H4lRYHFmq0IBvxLi4lx+/hXLwQaB5wYhnlixojecuCPd+nKTFa/4D0v89Wh+i71Z8KwU3b3seY9V1ftfk+Lr0aKzIBmWz0JENfmG7cPY6xa7GCKjv27h4TZlxUUh30S/6DTQfwDZEtLTbPSbsC4iirSj1yPU2q//xNaS4eGzIoMp5K9h24uVVBSVVjchb5bA4Xtdfj7nOehi99AOF09cTqjTgC44SfbcEVqTXQE7H0qZSHSWVgSTkgv5wEjAHV44Qf1/oMCDQh07ruaaY0IwA3Hsnq/8Al/o67EmsiXzi5e9f5dImEmWc17yjsmHi9aBKhi3JVjSwhnqwQY X-OriginatorOrg: citrix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4c270ea1-337b-4f9d-75ed-08db23bc39cc X-MS-Exchange-CrossTenant-AuthSource: SJ0PR03MB6360.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2023 12:12:33.7643 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335836de-42ef-43a2-b145-348c2ee9ca5b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: IK0xQCP6if5YDX3rh2nHayVbnPUN/rvZQ+97aPA6Cis+4j3nDAiFDeUasT6OB4pzyp9hUVE7okL23yHoAdTNFw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR03MB6203 Introduce an install target, like it's used by other tests. This allows running the test on the installed systems, which is easier than running it during the build phase when dealing with automated testing. Strictly speaking the vpci test doesn't require to be run on a Xen host currently, but that allows easier integration with logic that runs the rest of the tests. While there also adjust the makefile to use $(RM), and rename the resulting binary to use a dash instead of an underscore (again to match the rest of the tests). Since the resulting test binary is now part of the distribution CC must be used instead of HOSTCC, together with CFLAGS. The usage of CFLAGS requires removing two local unused variables and converting pci_get_pdev() into a function in order for the 'd' local variable in vpci_{read,write} to be used, or else the build of the test fails. Finally adjust the `run` target to only run the test if HOSTCC is CC, else print a warning message. Signed-off-by: Roger Pau Monné --- XenRT has recently gained the ability to run the tests in tools/tests that are installed, so the install target is needed for that use-case. --- Changes since v1: - Adjust run target to take HOSTCC vs CC into account. - Use CFLAGS. - Remove two unused variables. - Convert pci_get_pdev() into a function. --- tools/tests/vpci/Makefile | 18 ++++++++++++++---- tools/tests/vpci/emul.h | 7 ++++++- tools/tests/vpci/main.c | 2 -- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/tools/tests/vpci/Makefile b/tools/tests/vpci/Makefile index 5075bc2be2..11f1ee7126 100644 --- a/tools/tests/vpci/Makefile +++ b/tools/tests/vpci/Makefile @@ -1,27 +1,37 @@ XEN_ROOT=$(CURDIR)/../../.. include $(XEN_ROOT)/tools/Rules.mk -TARGET := test_vpci +TARGET := test-vpci .PHONY: all all: $(TARGET) .PHONY: run run: $(TARGET) +ifeq ($(CC),$(HOSTCC)) ./$(TARGET) +else + $(warning HOSTCC != CC, cannot run test) +endif $(TARGET): vpci.c vpci.h list.h main.c emul.h - $(HOSTCC) -g -o $@ vpci.c main.c + $(CC) $(CFLAGS) -o $@ vpci.c main.c .PHONY: clean clean: - rm -rf $(TARGET) *.o *~ vpci.h vpci.c list.h + $(RM) -- $(TARGET) *.o *~ vpci.h vpci.c list.h .PHONY: distclean distclean: clean .PHONY: install -install: +install: all + $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN) + $(INSTALL_PROG) $(TARGET) $(DESTDIR)$(LIBEXEC_BIN) + +.PHONY: uninstall +uninstall: + $(RM) -- $(DESTDIR)$(LIBEXEC_BIN)/$(TARGET) vpci.c: $(XEN_ROOT)/xen/drivers/vpci/vpci.c # Remove includes and add the test harness header diff --git a/tools/tests/vpci/emul.h b/tools/tests/vpci/emul.h index f03e3a56d1..6baab20de5 100644 --- a/tools/tests/vpci/emul.h +++ b/tools/tests/vpci/emul.h @@ -92,7 +92,12 @@ typedef union { #define xmalloc(type) ((type *)malloc(sizeof(type))) #define xfree(p) free(p) -#define pci_get_pdev(...) (&test_pdev) +const static inline struct pci_dev *pci_get_pdev(const struct domain *d, + pci_sbdf_t sbdf) +{ + return &test_pdev; +} + #define pci_get_ro_map(...) NULL #define test_bit(...) false diff --git a/tools/tests/vpci/main.c b/tools/tests/vpci/main.c index b9a0a6006b..e3335a0962 100644 --- a/tools/tests/vpci/main.c +++ b/tools/tests/vpci/main.c @@ -154,8 +154,6 @@ main(int argc, char **argv) uint16_t r20[2] = { }; uint32_t r24 = 0; uint8_t r28, r30; - unsigned int i; - int rc; INIT_LIST_HEAD(&vpci.handlers); spin_lock_init(&vpci.lock);