From patchwork Fri Jun 21 09:22:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Orzel X-Patchwork-Id: 13707144 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 86894C27C4F for ; Fri, 21 Jun 2024 09:22:32 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.745156.1152309 (Exim 4.92) (envelope-from ) id 1sKaTK-0004oh-1c; Fri, 21 Jun 2024 09:22:18 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 745156.1152309; Fri, 21 Jun 2024 09:22:18 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sKaTJ-0004oa-VB; Fri, 21 Jun 2024 09:22:17 +0000 Received: by outflank-mailman (input) for mailman id 745156; Fri, 21 Jun 2024 09:22:16 +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 1sKaTI-0004oU-HR for xen-devel@lists.xenproject.org; Fri, 21 Jun 2024 09:22:16 +0000 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2062f.outbound.protection.outlook.com [2a01:111:f400:7e88::62f]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id bed154dc-2faf-11ef-90a3-e314d9c70b13; Fri, 21 Jun 2024 11:22:15 +0200 (CEST) Received: from DM6PR18CA0006.namprd18.prod.outlook.com (2603:10b6:5:15b::19) by LV3PR12MB9330.namprd12.prod.outlook.com (2603:10b6:408:217::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31; Fri, 21 Jun 2024 09:22:10 +0000 Received: from CY4PEPF0000EDD5.namprd03.prod.outlook.com (2603:10b6:5:15b:cafe::d3) by DM6PR18CA0006.outlook.office365.com (2603:10b6:5:15b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.36 via Frontend Transport; Fri, 21 Jun 2024 09:22:10 +0000 Received: from SATLEXMB03.amd.com (165.204.84.17) by CY4PEPF0000EDD5.mail.protection.outlook.com (10.167.241.201) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Fri, 21 Jun 2024 09:22:09 +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.2507.39; Fri, 21 Jun 2024 04:22:08 -0500 Received: from XIR-MICHALO-L1.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Fri, 21 Jun 2024 04:22:07 -0500 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: bed154dc-2faf-11ef-90a3-e314d9c70b13 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ekI0HVci+7RptkZlYVNA+nv2QV3OfB5sIst+1hcYvJxJOlD+v2CF65ZeSA7/fLNb8EVlukXYJdK+M0rvRhFfSp0aA+cLJDwBltiEk8G2B1fIZFkmFX7VenMyA1Zgl5XpFQsOoWNWLWbKOMHmlaFuAIaVXHBjSQsXcDjaogXZq9NJH0cx7L+dlfAihO2Sy1i+vEDKx2f0Jf1mMxUeMSJbF1crJpbWco07onNNxHfAJnOjuzgjYTgi9CopW6lF5RPtiSD6Jf0NPkW0oeZZ5PvydPd1DBUChDewn6TGx9cdkZbGhEIvXFe12kMj8mf9Ha/LyWeUkKK8sem7kTx3b5nIkA== 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=FraBI1i4Bnal+sGdEA8zJKnwWAqHj5QXtcKpWhWQ7Yw=; b=MJDFT+Nj6arwkKaQqIfuYbToBjLJ0CBhFuRdehxoBe3nxFuqfPuUjaAFjixUkg9puLfy9ZNYNC0e+TxiuMg9G9WELfl+3Bg7zGUZe1puxFxFgn0ZuL4ui5ZwEU9nuZUhPP50csmhQn6mJFQcvaNSNSCsv+yaktuoFVsBP7HRsIIi+aTIul6SITNLFVMFZV0iBmt5yqhVrKQVmPt1keUJfHpDjA4B/Kr6UMafBiMv/mfNne2lQF7MHr1t6hEXB3Dbr7pipmwblF4CvXG6D6NxMDDPOVKvp9/75hNJbyq4+bv+fRWqVrjNsbGxVUyLsGqgQd54DR4iyvczSgRLIJKjmA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.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 (0) 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=FraBI1i4Bnal+sGdEA8zJKnwWAqHj5QXtcKpWhWQ7Yw=; b=il/dM67VQu7FDe6WZH93MSrDJApQqcZafMvO5W8JkJcsNoxXagmqJmw6pxe0uamFstGUUjOHX5Rii+YMCqqkVExW2moxemuAArr5LwXA713mRw1sGWuTKfWBKLHnOy/7bbCzRDYq2WgXQPeYFcQyyUcXybfS0+TBsveNjQoX5fs= 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 (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: Michal Orzel To: CC: Michal Orzel , Stefano Stabellini , Julien Grall , Bertrand Marquis , Volodymyr Babchuk , Subject: [PATCH for-4.19] xen/arm: static-shmem: request host address to be specified for 1:1 domains Date: Fri, 21 Jun 2024 11:22:05 +0200 Message-ID: <20240621092205.30602-1-michal.orzel@amd.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Received-SPF: None (SATLEXMB03.amd.com: michal.orzel@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EDD5:EE_|LV3PR12MB9330:EE_ X-MS-Office365-Filtering-Correlation-Id: 1bde3ba6-5869-4b26-8169-08dc91d3a08c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|36860700010|376011|1800799021|82310400023; X-Microsoft-Antispam-Message-Info: Sw22mpammKbOO9Kl9Pjopt3v5xbFhrSX0hmHweGI99FbiE8JTYI7ZAceJDQ5jS2LXSBJqwDowDHGMFk4uoLzqPou40Zk6sDbvgSzUMrkD64YQksLfGMq7zMWR1lit1pAkiEt8kaOJFUpasCbbO0oKzFHViiNphla8LX5/BFzVQTitOIWTzOj/scY+3ucsSHICQztYaEyiK2bSaPpPY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CxXCfiHDHrMKFl88b86NLhqyZBp9496ZZeZk5LXLfScn0/jjlxtMEbqA7txm/Q3Jn/egKVdpnd69C5k7jqWtyzGh4RyFfM7nh+VlntKaomLsEWe0stJG6fKSgXK9CPB7sr0Q== 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:(13230037)(36860700010)(376011)(1800799021)(82310400023);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jun 2024 09:22:09.6207 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1bde3ba6-5869-4b26-8169-08dc91d3a08c 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: CY4PEPF0000EDD5.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR12MB9330 As a follow up to commit cb1ddafdc573 ("xen/arm/static-shmem: Static-shmem should be direct-mapped for direct-mapped domains") add a check to request that both host and guest physical address must be supplied for direct mapped domains. Otherwise return an error to prevent unwanted behavior. Signed-off-by: Michal Orzel Reviewed-by: Julien Grall --- Reasoning for 4.19: this is hardening the code to prevent a feature misuse and unwanted behavior. --- xen/arch/arm/static-shmem.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/xen/arch/arm/static-shmem.c b/xen/arch/arm/static-shmem.c index cd48d2896b7e..aa80756c3ca5 100644 --- a/xen/arch/arm/static-shmem.c +++ b/xen/arch/arm/static-shmem.c @@ -378,6 +378,13 @@ int __init process_shm(struct domain *d, struct kernel_info *kinfo, const struct membank *alloc_bank = find_shm_bank_by_id(get_shmem_heap_banks(), shm_id); + if ( is_domain_direct_mapped(d) ) + { + printk("%pd: host and guest physical address must be supplied for direct-mapped domains\n", + d); + return -EINVAL; + } + /* guest phys address is right at the beginning */ gbase = dt_read_paddr(cells, addr_cells);