From patchwork Fri Jan 27 11:40:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Gouly X-Patchwork-Id: 13118629 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 9EE90C38142 for ; Fri, 27 Jan 2023 12:31:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=74B5EALP09aHTcdvpqByPX751EQUGqt9OdtJx39sRXA=; b=xQ23Mmce7oH7ac ukMhUcRe+Tupdy+d1JN7IbWtsnYguDRkUkFD0GxpYrqJ01BxV0RKA+WOOtk/Iyp0I6ITvstb8EPJE fJoPupRjztOb9DZi7QC2rKnCRwqj7L5CfpSwH1AJwmJVSgHWLAcu6sEAtlG5P1alACw1Fp3c5k96/ slMZSGRzk5WjysMlzm0SGN+1fdKM9as2djujhP9ykBb7bJyCLD8mxKx9jACWJ22vXkBrsqvJxoTcu KAX7o0z9bVMp+FZ0D9QTmzukU2R02GU7cGEQVWF0003QYU2R4w5/KzziPFZqIFh4c5yzCN/f1+e4q 6FhsnNVZ2zreCrMRLuaw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pLNrj-00EYxV-TI; Fri, 27 Jan 2023 12:30:03 +0000 Received: from mail-am6eur05on2070.outbound.protection.outlook.com ([40.107.22.70] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pLN8W-00EEOE-GE for linux-arm-kernel@lists.infradead.org; Fri, 27 Jan 2023 11:43:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=x8JZG4jpM76HS5UgQpwVl4pSBZ5biDY9z3RHHccl+24=; b=eEm99mno32dYqI3hpPf2PrxE6B8TAhBUiPK2lrWFp2YfFFHG4JJWMQlumDw+ctLtbDM1kwQ+yTlpZLhjV3qpyIhSuqw+m19dVa3hL8UnzY4W6pS0d+Pic5ZdhpOojgbUpjkAfzE3o5zpmIgn6jfdq7DgLPSOhtKRWP1SKft/ug8= Received: from DB6PR0202CA0036.eurprd02.prod.outlook.com (2603:10a6:4:a5::22) by GV2PR08MB8486.eurprd08.prod.outlook.com (2603:10a6:150:bc::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.23; Fri, 27 Jan 2023 11:42:48 +0000 Received: from DBAEUR03FT007.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:a5:cafe::e1) by DB6PR0202CA0036.outlook.office365.com (2603:10a6:4:a5::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.34 via Frontend Transport; Fri, 27 Jan 2023 11:42:48 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DBAEUR03FT007.mail.protection.outlook.com (100.127.142.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.21 via Frontend Transport; Fri, 27 Jan 2023 11:42:48 +0000 Received: ("Tessian outbound baf1b7a96f25:v132"); Fri, 27 Jan 2023 11:42:48 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 80bc510a8692540b X-CR-MTA-TID: 64aa7808 Received: from 1241152e4df0.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id D608B248-C25F-4634-B0B6-0C794EB6F09D.1; Fri, 27 Jan 2023 11:42:41 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 1241152e4df0.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 27 Jan 2023 11:42:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WzHrXoU49HA4o+nc9qVkOVVzKPf0hiuPWeIgf0uC4dec4sWBwobCfZGf0Fa0XwgvFoA5Im4DP9GKbIj75f/gHmXSmUQ7JANAt5iZaNIWcy1yaV8xGlq9ccuk6K0jqIfeCcL1qg8fum3/TloB1rDZtlkEGG+yfK9llgvCLNuKfA+aJPHLr5R02zsl2kf5sCnX4EUYp2OaCpEfFSPRrpYI6nt+GoHMvoPosLqFOVJ5aas6WIE35tIRv2Jc9WM18cJJfhSOfMJsrYE81ulNNIB9ISWQLCVUIAXI6cQUc32UghBc/XJI2G47wYeyEr2Ovv+aKEnesSjOTZ5VbddGf5kCPA== 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=x8JZG4jpM76HS5UgQpwVl4pSBZ5biDY9z3RHHccl+24=; b=UImYHWiroexKQOwiUHvF8LkBFze1K+PYBHF9LCBra1rYwh6Bvt/kQjux6ShQKjcF75NYX7cHvLakrO1asYF+OScVFa1nhh4Rgn8kD8nDPLCNSZjMhjGK6K1RT9qsFR409FbBUBkwyTjy2WrDuDFUHhHQC7JTYaF/1k1KHUgWIwZzw73x2gPNvyw4uYQRN0jItLng0vBBvkh//u4uSRnUEYMtHn6xON6DNCSwAr+Mly/OOzhyhJ6F19XbHP/mpMQOKN/IvI/y7rt/rElKKJ1aqBrZHPSiCslTx/ZGlT86Rwb7NGy0JnIWqMfasxuXGNgziXu1RROI2cR7JL7dg+tZ3w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=linux.dev smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=x8JZG4jpM76HS5UgQpwVl4pSBZ5biDY9z3RHHccl+24=; b=eEm99mno32dYqI3hpPf2PrxE6B8TAhBUiPK2lrWFp2YfFFHG4JJWMQlumDw+ctLtbDM1kwQ+yTlpZLhjV3qpyIhSuqw+m19dVa3hL8UnzY4W6pS0d+Pic5ZdhpOojgbUpjkAfzE3o5zpmIgn6jfdq7DgLPSOhtKRWP1SKft/ug8= Received: from AS9PR06CA0513.eurprd06.prod.outlook.com (2603:10a6:20b:49d::8) by GV1PR08MB8692.eurprd08.prod.outlook.com (2603:10a6:150:86::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.22; Fri, 27 Jan 2023 11:42:37 +0000 Received: from AM7EUR03FT013.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:49d:cafe::63) by AS9PR06CA0513.outlook.office365.com (2603:10a6:20b:49d::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.22 via Frontend Transport; Fri, 27 Jan 2023 11:42:36 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (40.67.248.234) by AM7EUR03FT013.mail.protection.outlook.com (100.127.140.191) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6043.22 via Frontend Transport; Fri, 27 Jan 2023 11:42:36 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Fri, 27 Jan 2023 11:42:35 +0000 Received: from e124191.cambridge.arm.com (10.1.197.45) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Fri, 27 Jan 2023 11:42:29 +0000 From: Joey Gouly To: Andrew Jones , , CC: , Alexandru Elisei , Christoffer Dall , Fuad Tabba , Jean-Philippe Brucker , Joey Gouly , Marc Zyngier , Mark Rutland , Oliver Upton , Paolo Bonzini , Quentin Perret , Steven Price , Suzuki K Poulose , "Thomas Huth" , Will Deacon , Zenghui Yu , , , , , Gareth Stockwell Subject: [RFC kvm-unit-tests 14/27] arm: realm: add hvc and RSI_HOST_CALL tests Date: Fri, 27 Jan 2023 11:40:55 +0000 Message-ID: <20230127114108.10025-15-joey.gouly@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230127114108.10025-1-joey.gouly@arm.com> References: <20230127112248.136810-1-suzuki.poulose@arm.com> <20230127114108.10025-1-joey.gouly@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM7EUR03FT013:EE_|GV1PR08MB8692:EE_|DBAEUR03FT007:EE_|GV2PR08MB8486:EE_ X-MS-Office365-Filtering-Correlation-Id: f96b66b9-bb92-4bd2-81bc-08db005b9d79 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: LrrhC1LRwd7d9J67bWM/6pEwNPN1mwgg7HTt7Mo2eV8JUZkNJDd3VURcxYbCKSoikmjeJj17pAk93tFC6SG2+ujK0pEDUVGg32kNxMusiXfnV+fN11isNC6/oRiTZ+4FhqTTLzc0TsmpPMCIlJVWKrn4mbbmnhXTY2yVepWoPrWh5SqzZ95gzh9mRpBcGuXxuTvgKnw9CJLTRVyaxqiq5CdYfSm2TeDjfUPDjpNxwtOge0qe8QtxYVL/q9w8PMPCQ+ey3SKoenlgrxfNShpXmJzGeIAbjZGVgRMx44+o94XYxkcSr0E2Ob0qgHlFz0OWH6xWCp0New1nnjDqXk52dYiO+4mR+OYiHDQQILCjsV7nb0RxWmFF4pyhfzg8QYkNycXXvfsOfhV9UFbKQsM15v8oGBI+0v35xyrmy8+GRna1dqrcJiJpUnvqPedla7iaLb84XaAaJzEtAlP2sd43rCYS1yR+6zL/mKh6iia+X1v1cV/pTpsYNmUC4FXCKy7LyYRi/QUmr3ZpXTOwmEd3I2PkyQ73OhR15KPrbDYUZDGe0FsYIlapBJQpBEAwqD3MPf9QuDHsR4pl2S87yx4d8cTneNtYtSlCaCl+X9m4OUINkv4xj8qmY8vvGFTxxokM5137+UhjoxkAnklc4qJeLMri2tH5Tb563GNEihseyZ883m6lgt0FcanyynnMn/D9uWLQi94jJQcMzpYwW2btJOnU5n9+3bWCzKbGlPykQn0MOKX8hDbX0btTjhON3XSS X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230025)(4636009)(396003)(136003)(39860400002)(346002)(376002)(451199018)(46966006)(40470700004)(36840700001)(5660300002)(70206006)(7416002)(8936002)(44832011)(2906002)(41300700001)(4326008)(70586007)(8676002)(6666004)(82310400005)(316002)(54906003)(110136005)(186003)(26005)(36756003)(7696005)(1076003)(478600001)(2616005)(336012)(40460700003)(81166007)(83380400001)(47076005)(426003)(36860700001)(40480700001)(82740400003)(86362001)(356005)(36900700001)(2101003);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR08MB8692 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT007.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 55ea7516-98d0-44f5-ab2c-08db005b966c X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nWDxrow5hXDm2fU2pREtZzt7Vm3N+IdQkxOJ75U01MvFz8BkexDwg6LROY074x63VqNQtt80QSz4O4IcMkzerbbnIhYZ9B3J7ayKozmZIOsoB/e5m5Bxe1oQSsM4MURZsMdRec94lyUeAjwi4hhou2gDLl2Y9wjhuprishfjQTDNQbXn2tu07dpQKKB+/YVga8ya/yd+PQfKc9U/RWDkyU6tUMAPVVJgpgLmzNRGbWSptLIE3mOdozAo+rd7L3paeXkfULcolVV27IgnnMPzyjOeLcaVqXwvaD2iFQ91Z5fFAoteU7CVqn/Z4xdYQK2CTll+a1ZjCeCptEWD6OTdck/WmIpYp+XnhwtDFAP4h3Eio1aKHddd3PX0VN1RRcO5nrLDOM4tjNnr7UvVoHJl++XBWr4lPGIzidd8EyRHzovmYR5SUMgpbgy8nf6VRxo5VrSyeeh4uP1UCQ1IPHYYy24UTgpL9uWYudBrF0WT+W9+ZQbsUp18p53BbbM3cC87gYIk5+FrYb6zcG19QncBTjfsmRyouS+wwBKF3q+hCwVHlOcHENo9A62AMp0zP1/5On/OtB6Mr69oD/H2p3OxZYG33lObwHIAABgSaynTsWQ32r4wpyF+w0OlOb9Tz3HypVADacuOKsF/SVcYlgVEmjtjzfP9CktMNDA8f+090i650UIQNdI0dmMuuxIpfRcKEKHSqTJAsqXC6ksoYqZTueNUpml+EHEVF0g1SqkL0Gc= X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230025)(4636009)(376002)(346002)(136003)(39860400002)(396003)(451199018)(40470700004)(36840700001)(46966006)(8676002)(4326008)(26005)(44832011)(186003)(1076003)(316002)(40460700003)(5660300002)(82740400003)(36860700001)(41300700001)(86362001)(40480700001)(82310400005)(81166007)(8936002)(47076005)(54906003)(83380400001)(36756003)(2616005)(426003)(70586007)(110136005)(70206006)(478600001)(7696005)(336012)(2906002)(6666004)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2023 11:42:48.7067 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f96b66b9-bb92-4bd2-81bc-08db005b9d79 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DBAEUR03FT007.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR08MB8486 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230127_034316_771987_2BB4E21E X-CRM114-Status: GOOD ( 16.17 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Gareth Stockwell Test that a HVC instruction in a Realm is turned into an undefined exception. Test that RSI_HOST_CALL passes through to the Hypervisor. Signed-off-by: Gareth Stockwell Signed-off-by: Suzuki K Poulose Signed-off-by: Joey Gouly --- arm/realm-rsi.c | 110 +++++++++++++++++++++++++++++++++++++++++++++- arm/unittests.cfg | 15 +++++++ 2 files changed, 124 insertions(+), 1 deletion(-) diff --git a/arm/realm-rsi.c b/arm/realm-rsi.c index d793f305..8a7e9622 100644 --- a/arm/realm-rsi.c +++ b/arm/realm-rsi.c @@ -14,6 +14,96 @@ #include #include +#define FID_SMCCC_VERSION 0x80000000 +#define FID_INVALID 0xc5000041 + +#define SMCCC_VERSION_1_1 0x10001 +#define SMCCC_SUCCESS 0 +#define SMCCC_NOT_SUPPORTED -1 + +static bool unknown_taken; + +static void unknown_handler(struct pt_regs *regs, unsigned int esr) +{ + report_info("unknown_handler: esr=0x%x", esr); + unknown_taken = true; +} + +static void hvc_call(unsigned int fid) +{ + struct smccc_result res; + + unknown_taken = false; + arm_smccc_hvc(fid, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, &res); + + if (unknown_taken) { + report(true, "FID=0x%x caused Unknown exception", fid); + } else { + report(false, "FID=0x%x did not cause Unknown exception", fid); + report_info("x0: 0x%lx", res.r0); + report_info("x1: 0x%lx", res.r1); + report_info("x2: 0x%lx", res.r2); + report_info("x3: 0x%lx", res.r3); + report_info("x4: 0x%lx", res.r4); + report_info("x5: 0x%lx", res.r5); + report_info("x6: 0x%lx", res.r6); + report_info("x7: 0x%lx", res.r7); + } +} + +static void rsi_test_hvc(void) +{ + report_prefix_push("hvc"); + + /* Test that HVC causes Undefined exception, regardless of FID */ + install_exception_handler(EL1H_SYNC, ESR_EL1_EC_UNKNOWN, unknown_handler); + hvc_call(FID_SMCCC_VERSION); + hvc_call(FID_INVALID); + install_exception_handler(EL1H_SYNC, ESR_EL1_EC_UNKNOWN, NULL); + + report_prefix_pop(); +} + +static void host_call(unsigned int fid, unsigned long expected_x0) +{ + struct smccc_result res; + struct rsi_host_call __attribute__((aligned(256))) host_call_data = { 0 }; + + host_call_data.gprs[0] = fid; + + arm_smccc_smc(SMC_RSI_HOST_CALL, virt_to_phys(&host_call_data), + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, &res); + + if (res.r0) { + report(false, "RSI_HOST_CALL returned 0x%lx", res.r0); + } else { + if (host_call_data.gprs[0] == expected_x0) { + report(true, "FID=0x%x x0=0x%lx", + fid, host_call_data.gprs[0]); + } else { + report(false, "FID=0x%x x0=0x%lx expected=0x%lx", + fid, host_call_data.gprs[0], expected_x0); + report_info("x1: 0x%lx", host_call_data.gprs[1]); + report_info("x2: 0x%lx", host_call_data.gprs[2]); + report_info("x3: 0x%lx", host_call_data.gprs[3]); + report_info("x4: 0x%lx", host_call_data.gprs[4]); + report_info("x5: 0x%lx", host_call_data.gprs[5]); + report_info("x6: 0x%lx", host_call_data.gprs[6]); + } + } +} + +static void rsi_test_host_call(void) +{ + report_prefix_push("host_call"); + + /* Test that host calls return expected values */ + host_call(FID_SMCCC_VERSION, SMCCC_VERSION_1_1); + host_call(FID_INVALID, SMCCC_NOT_SUPPORTED); + + report_prefix_pop(); +} + static void rsi_test_version(void) { int version; @@ -36,6 +126,8 @@ static void rsi_test_version(void) int main(int argc, char **argv) { + int i; + report_prefix_push("rsi"); if (!is_realm()) { @@ -43,7 +135,23 @@ int main(int argc, char **argv) goto exit; } - rsi_test_version(); + if (argc < 2) { + rsi_test_version(); + rsi_test_host_call(); + rsi_test_hvc(); + } else { + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "version") == 0) { + rsi_test_version(); + } else if (strcmp(argv[i], "hvc") == 0) { + rsi_test_hvc(); + } else if (strcmp(argv[i], "host_call") == 0) { + rsi_test_host_call(); + } else { + report_abort("Unknown subtest '%s'", argv[1]); + } + } + } exit: return report_summary(); } diff --git a/arm/unittests.cfg b/arm/unittests.cfg index ce1b5ad9..3cdb1a98 100644 --- a/arm/unittests.cfg +++ b/arm/unittests.cfg @@ -280,5 +280,20 @@ groups = debug migration [realm-rsi] file = realm-rsi.flat groups = nodefault realms +extra_params = -append 'version' +accel = kvm +arch = arm64 + +[realm-host-call] +file = realm-rsi.flat +groups = nodefault realms +extra_params = -append 'host_call' +accel = kvm +arch = arm64 + +[realm-hvc] +file = realm-rsi.flat +groups = nodefault realms +extra_params = -append 'hvc' accel = kvm arch = arm64