From patchwork Tue Dec 10 16:25:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stewart Hildebrand X-Patchwork-Id: 13901703 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 58E7FE7717F for ; Tue, 10 Dec 2024 16:26:20 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.852857.1266528 (Exim 4.92) (envelope-from ) id 1tL33m-0007Ti-2w; Tue, 10 Dec 2024 16:26:06 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 852857.1266528; Tue, 10 Dec 2024 16:26:06 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tL33m-0007Tb-05; Tue, 10 Dec 2024 16:26:06 +0000 Received: by outflank-mailman (input) for mailman id 852857; Tue, 10 Dec 2024 16:26:04 +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 1tL33k-0007TV-Kc for xen-devel@lists.xenproject.org; Tue, 10 Dec 2024 16:26:04 +0000 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2061c.outbound.protection.outlook.com [2a01:111:f403:2415::61c]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 6f2123ec-b713-11ef-99a3-01e77a169b0f; Tue, 10 Dec 2024 17:25:58 +0100 (CET) Received: from DM6PR03CA0061.namprd03.prod.outlook.com (2603:10b6:5:100::38) by SJ2PR12MB8134.namprd12.prod.outlook.com (2603:10b6:a03:4fa::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.11; Tue, 10 Dec 2024 16:25:53 +0000 Received: from CY4PEPF0000EE3E.namprd03.prod.outlook.com (2603:10b6:5:100:cafe::8e) by DM6PR03CA0061.outlook.office365.com (2603:10b6:5:100::38) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.21 via Frontend Transport; Tue, 10 Dec 2024 16:25:52 +0000 Received: from SATLEXMB03.amd.com (165.204.84.17) by CY4PEPF0000EE3E.mail.protection.outlook.com (10.167.242.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8230.7 via Frontend Transport; Tue, 10 Dec 2024 16:25:52 +0000 Received: from SATLEXMB03.amd.com (10.181.40.144) 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; Tue, 10 Dec 2024 10:25:51 -0600 Received: from ubuntu.mshome.net (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Tue, 10 Dec 2024 10:25:50 -0600 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: 6f2123ec-b713-11ef-99a3-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dpg8UA8H54lDTM5Kvk8Sp/AVG+uxiWqjIafLNnyQXCrAdaboVNU7hC9+ZZ5yij8ZSOBambIE+mWQhnwJvpPfIUtUVQZKwufPz6273DikiCFNfxoha5yBeLpnEOqh3Gyd7+d1D424ThfPPmcxliy2gO6P851gJrEQaEhqEVgzlgjA4kqfgnlTNv2BDw9KuMYmfgcy1S2CkPIsZyK6ow+r9v8+1YFpcDhNegnTR7N5GX58mYuPn9pY8JFh+gRmJbB4db9r+WpG9IV6S+lzzuGjmh9N8ZowNLH4I3TiDWTUSw97Zoag7+C5S/IU6NjSebHnv7IirO7czjAUJKQ+NRJkPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=kONbcCgZKsO4TiqNQq87LzjeGcYkS85qkaJxmB0oPi0=; b=b2QPZFhqg0fFu44c2hn0zXPiXh9uQ8/5bEMKwKygdx1TvjkB7GYRj9Cjakau53vzOcZlLhL8xttIYh6e3TiYx4vWyCBcvVkqyrM/DyPvucTTt7L2L906gt5GWL0FtgmWq6jpIO67vFK6HvSsBf5BCJOk/erzhSyXNsf2IekI21DgbAV6bnI/+wz6s0YMruKxcYDCNpPOML1yW5CYGH4dzuPERXUxMe2EOyzuxFVRZ5oHGWhQs/2ug1vFottsL4E4b/mt6aVN25k8L5kCneGpF75MTkwSRz/LQtQAP8y5NlK686ptuHZLrEwIa34/d2ePCkwOKNpcIyhmSwZZ3y3LJw== 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=kONbcCgZKsO4TiqNQq87LzjeGcYkS85qkaJxmB0oPi0=; b=5obwKfiV5CT81J4dxepM94w1TQMWJxCPUweGLht5rzuFkKrsZJ3U1oE2aWxM8Y9beKUdt3za+llfnIydyDx9XubRC47v/WQIszRFdh+8Dqnb6cH374jaWEkthz/E68YX0onsoLYAFs/WPI7A/xlB+VfcOnmnWBogNRtXurzXgxo= 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: Stewart Hildebrand To: CC: Stewart Hildebrand , =?utf-8?q?Roger_Pau_Mon?= =?utf-8?q?n=C3=A9?= Subject: [PATCH] xen/vpci: fix memory type in guest_mem_bar_read() Date: Tue, 10 Dec 2024 11:25:44 -0500 Message-ID: <20241210162546.403882-1-stewart.hildebrand@amd.com> X-Mailer: git-send-email 2.47.1 MIME-Version: 1.0 Received-SPF: None (SATLEXMB03.amd.com: stewart.hildebrand@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE3E:EE_|SJ2PR12MB8134:EE_ X-MS-Office365-Filtering-Correlation-Id: 6f5fcdc2-dd1b-49cb-d6fd-08dd193750ae X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: W0S1nDz+Nudm3xlEH4rT1yVfPHkTgCiwDREjkJtWga6NhFCPHL83JHlPahJtDIn+bcP7vjcGzPpEi3SWO66ybuKx0sVPrT4fOI58iA89SoR030v/KYbjf8RAx4UneeF6vUQJqxZNQCmLe+5cBCffJBx67UtUVEpV6Nym26ujD7bUqPWLdASny8r5/Lai2f06sIqaBbPSStk9YB7A7zAgTHJ9vqc5CbAiE0R4MHou1rzey7xfeDAHh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jq18YluxfIMm7EnscoWoN7ow/LyZOw3Bc6pYrABF7a8sFP6BJpnKlExYBfI0xTb4O/k/CS7FyKS4yZvW6G5eaHiW4AxJLV4HalNsHlwmkHJqGXr5Ie28ZYRI5iK5NZyZuFgrV1HwwDYod 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:(13230040)(376014)(1800799024)(36860700013)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Dec 2024 16:25:52.2290 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6f5fcdc2-dd1b-49cb-d6fd-08dd193750ae 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: CY4PEPF0000EE3E.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8134 Currently, if bar->type is anything other than VPCI_BAR_MEM32, the memory type bits get set to PCI_BASE_ADDRESS_MEM_TYPE_64 in the returned value. This leads to the wrong memory type for, e.g. VPCI_BAR_EMPTY. Only set PCI_BASE_ADDRESS_MEM_TYPE_64 when the bar type is VPCI_BAR_MEM64_LO. Fixes: 8c5bca70742c ("vpci/header: implement guest BAR register handlers") Signed-off-by: Stewart Hildebrand --- xen/drivers/vpci/header.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) base-commit: 1645bb7997cb1eccb45235ab350872733c74b305 diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c index ef6c965c081c..493ca5de032d 100644 --- a/xen/drivers/vpci/header.c +++ b/xen/drivers/vpci/header.c @@ -668,8 +668,10 @@ static uint32_t cf_check guest_mem_bar_read(const struct pci_dev *pdev, } reg_val = bar->guest_addr; - reg_val |= bar->type == VPCI_BAR_MEM32 ? PCI_BASE_ADDRESS_MEM_TYPE_32 : - PCI_BASE_ADDRESS_MEM_TYPE_64; + if ( bar->type == VPCI_BAR_MEM32 ) + reg_val |= PCI_BASE_ADDRESS_MEM_TYPE_32; + else if ( bar->type == VPCI_BAR_MEM64_LO ) + reg_val |= PCI_BASE_ADDRESS_MEM_TYPE_64; reg_val |= bar->prefetchable ? PCI_BASE_ADDRESS_MEM_PREFETCH : 0; return reg_val;