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 8FD49C38A2D for ; Tue, 25 Oct 2022 15:01:18 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.429912.681251 (Exim 4.92) (envelope-from ) id 1onLQO-0001o0-Vr; Tue, 25 Oct 2022 15:01:04 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 429912.681251; Tue, 25 Oct 2022 15:01:04 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1onLQO-0001nt-Sv; Tue, 25 Oct 2022 15:01:04 +0000 Received: by outflank-mailman (input) for mailman id 429912; Tue, 25 Oct 2022 15:01:03 +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 1onLQN-0001nn-Ar for xen-devel@lists.xenproject.org; Tue, 25 Oct 2022 15:01:03 +0000 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2079.outbound.protection.outlook.com [40.107.105.79]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id d77b7d81-5475-11ed-8fd0-01056ac49cbb; Tue, 25 Oct 2022 17:01:02 +0200 (CEST) Received: from VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) by AM9PR04MB8602.eurprd04.prod.outlook.com (2603:10a6:20b:439::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.21; Tue, 25 Oct 2022 15:01:01 +0000 Received: from VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::4da2:ea8b:e71e:b8d8]) by VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::4da2:ea8b:e71e:b8d8%4]) with mapi id 15.20.5746.021; Tue, 25 Oct 2022 15:01:01 +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: d77b7d81-5475-11ed-8fd0-01056ac49cbb ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=imcGzbroxK+xi92ssHWMbffZEtI0J87e//k7155LYZr5h87N5F/tq9Q+mS0qnALNQwhn4rbTxcFk5PcitIOjpikNCqUYjZfaG4qEkNax7O4ROwFEczGrudzf6cuXl0xGopNL5t1vC38jL2D0pumJv6vQukkKdNoG9M54PNRNQB5N9m980ZIO8ofpVdsxvtuArfAi5gmj/pJtiKg0CFnvCgYoiiuebUTVeNAtAN0cF15cRcIwn5U7CnhFPhs23QhplJ+1Rka/O7j2zgk8tbCnwB1F9VlcgRqn1zwH6zOFfnkWLLPb0qsFW39IpFREEh/8UHCL9B7OlaaLbEOjqDvZ2Q== 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=Kt41+vpkLFHaiCgHytIXFHsNCAAi8d9QQTEDw3EnB7k=; b=HHLzo+/1aiL+aJ2qtaNCpovlF3awQzqN9iFLFHquSKnD2YeWOGOeb4gArgdGn12p2bXzgWPFtkJ+OkdSZ7fVLQIXshJG9t+/q3TuUs0h80vZmeUybI1/VzlukxS8qMRyAUAoHfETvxETZnOlAB833LutPGAfS0bzYiv+p1YjliZresOhB8Hb545lTzJ79t1XYjqiYTgdvIiAxnXB3lDDhZrZMCtPvlBT37bldAEqb0G2zzF9B0PyfjkbUb2JGlW+9DYgIMm5yhh1q3R83GhCmLvSWnH81cQNazj15hutq/9rOzhgaTfxf4tLfWZEMc+Utfzs668ADR3H4ueDi16MrQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Kt41+vpkLFHaiCgHytIXFHsNCAAi8d9QQTEDw3EnB7k=; b=VYQhN/6LBgkVR+l6KeRwB/RvOGcZdqtU9BLfCt/bvSxC6S5wAJzmkN7QutpPtz8mxXwXhqJBnQdGb7POHLox9Oms5UcsFH8NqHzvQALxm/VLH3YfrTNzJKmG2Hut3BJZOGas62Ojw187wY9Jv75a1nrs4kZmOvwkp/JZ0bKDd0SoJrk6gxn0lxtN/U0/HBXsmKnKu0q1W61qpHAnMxnx7eUP/28SqkZDxJTdmCcqXpPOd/ENYfpoK4gkIXgeLghu9iPSkWHT+LzhrIa0Shkp2p7ugQQOo4vWZVoIj1wn6lmCabMx5IcMUlTkFQmwQFdHIwYzx4Vmw65OCPy+Y3YJ9Q== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Message-ID: <05920ede-87b5-7b93-a115-27751c94d437@suse.com> Date: Tue, 25 Oct 2022 17:00:59 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: Re: [PATCH for-4.17 v2 4/5] pci: do not disable memory decoding for devices Content-Language: en-US To: Andrew Cooper Cc: "Henry.Wang@arm.com" , Paul Durrant , Roger Pau Monne , "xen-devel@lists.xenproject.org" References: <20221025144418.66800-1-roger.pau@citrix.com> <20221025144418.66800-5-roger.pau@citrix.com> <46a361ba-121e-a054-da59-512e0fb6eb70@citrix.com> From: Jan Beulich In-Reply-To: <46a361ba-121e-a054-da59-512e0fb6eb70@citrix.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: FR0P281CA0071.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:49::10) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|AM9PR04MB8602:EE_ X-MS-Office365-Filtering-Correlation-Id: 808cf51a-848e-4747-d53f-08dab699baf2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tDAVLNDFiFMatQQyUtbASxnr8ZJLIMJXzUZMvKSPaLNHbOA+9SjtOvTwAYiQMq3nNBtw5L9sVCrd2Wnok0PdiE+zCk9QpEE4ZDvQIXkSbIE0dyQmwlZw4P137CT7GdjfTOAKQv//6NgEi2dosOEvyH4BXMIdFDagZkXG8tNeN8JEirsVnfeNcdaO5CVcI6ay0bJ/f/3kKcLBpbD1QblbSa5HeQ9CAGwTCgUwXFWxjp01/eUgFEKw9jhNult86Ea3AJYRzx3KvuJJB7Qbs6d7S3b788uA0oql32nffwzAVb8Zq6F8lLaR7g/EkYQMsatDNFzyyT9ktEsQRmpthjdc0UvMO4zr+741dW62c35QLRwCBpAIRcOJPffsJyWGLA95RyP/ldAzDzscVnyY5KTOMR/1JeQ4DYYEF4g1HMxeLpp5IfWtaJ++/68V2roITX3Lpn5tS6xfjXUSOfPnyyRJh4VKDl9NB34roYt0YTA1Y11l/XWkLZiNCexwElyYIWGUBsWGWRSD7Vxt2xlY0AmaSAPUYHMYuz4dcfhzLYWGMYWwh4mNUrPvqaEccCTt8gwoUgOGXyix1DLi/bxOIdijLmGaTXiYv4y1lU0bYTFFlGuOsSpR1WYVfmGBGh1/85BWg7wjiXtUJxtoi4UteGPtJG5EPNvmVkYYbf7IC1ynZ1t9vmIyq03COuw3DSZ90VUQ2Oo0aIaLdJPVNL2QdNDTXA+hQxNvbJaQ0RHCU19Xgvt8W/dW76ujYDEW3IxS/+uv3h+/ZgZF/1uI+jelO4Ii15p2vc4AZu6LAX+ZJUNIixY= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR04MB6560.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(376002)(136003)(39860400002)(346002)(366004)(396003)(451199015)(478600001)(6486002)(41300700001)(8936002)(4326008)(5660300002)(6916009)(54906003)(66556008)(316002)(8676002)(66946007)(36756003)(66476007)(83380400001)(38100700002)(86362001)(6506007)(53546011)(31696002)(26005)(2616005)(6512007)(186003)(31686004)(2906002)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?QmRWTUp0elIrbzdPSjJXdVAxaFJEYW4reWw4Nk95N3RhaTJOQzhlTkt0bjd4?= =?utf-8?B?VXMxNWtZK3BONUdYWnhGaUpMMHo1VGY2bG1DZ2dkU2YyM1J3SlJHTFpEMVU5?= =?utf-8?B?STQzT3d5Y0N2dFNFV0FOeUNRNnNWclEyQzB4cW5BSzlIMU44RHdQT2FkRjFL?= =?utf-8?B?VlRvM2tLSHBxaEs2THovN090ZkxSU3dKMkNvQWFWcU1uc1ZBT0g3a2U4RGg4?= =?utf-8?B?bCtMYUorc3IrNnJBT2VkUUhMZHROcXVJM3hZWnFWSEo2NVVLWllkWDlFWThJ?= =?utf-8?B?NmJWazVWQXZTL3A0MHI4RXhiU0gyOWE3cGlzbml6UUR2cWZGMTRUMkZ2S3VW?= =?utf-8?B?Rk5BNCtKU1J3UC84RzZRdXorUXpWWDhBR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-Id: 808cf51a-848e-4747-d53f-08dab699baf2 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2022 15:01:01.0168 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: jhrN6rsJtxiRHmDqoz5PFZh+Nx1cj77y+vlAOIGRbdgAXtbAx63Fu7VGqZRPMXUQw3DJX+WwC7DsbX7VQ2hMDA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8602 On 25.10.2022 16:57, Andrew Cooper wrote: > On 25/10/2022 15:44, Roger Pau Monne wrote: >> Commit 75cc460a1b added checks to ensure the position of the BARs from >> PCI devices don't overlap with regions defined on the memory map. >> When there's a collision memory decoding is left disabled for the >> device, assuming that dom0 will reposition the BAR if necessary and >> enable memory decoding. >> >> While this would be the case for devices being used by dom0, devices >> being used by the firmware itself that have no driver would usually be >> left with memory decoding disabled by dom0 if that's the state dom0 >> found them in, and thus firmware trying to make use of them will not >> function correctly. >> >> The initial intent of 75cc460a1b was to prevent vPCI from creating >> MMIO mappings on the dom0 p2m over regions that would otherwise >> already have mappings established. It's my view now that we likely >> went too far with 75cc460a1b, and Xen disabling memory decoding of >> devices (as buggy as they might be) is harmful, and reduces the set of >> hardware on which Xen works. >> >> This commits reverts most of 75cc460a1b, and instead adds checks to >> vPCI in order to prevent misplaced BARs from being added to the >> hardware domain p2m. Signaling on whether BARs are mapped is tracked >> in the vpci structure, so that misplaced BARs are not mapped, and thus >> Xen won't attempt to unmap them when memory decoding is disabled. >> >> This restores the behavior of Xen for PV dom0 to the state it was >> previous to 75cc460a1b, while also introducing a more contained fix >> for the vPCI BAR mapping issues. >> >> Fixes: 75cc460a1b ('xen/pci: detect when BARs are not suitably positioned') >> Signed-off-by: Roger Pau Monné >> --- >> AT Citrix we have a system with a device with the following BARs: >> >> BAR [0xfe010, 0xfe010] -> in a EfiMemoryMappedIO region >> BAR [0, 0x1fff] -> not positioned, outside host bridge window > > This needs a bit more explanation (even if only in the email thread).  > The first item here is permitted under the UEFI spec, and exists on > production systems.  We've got several examples. Afaict it is at best unclear whether this is really permitted. Generally BARs are not supposed to be covered by memory map entries, be it E820 or EFI. Jan > The second has only been seen on an SDP, and is hopefully a firmware bug > that doesn't get out to production, but we should boot nevertheless. > > ~Andrew