[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4] xen/pci: detect when BARs are not suitably positioned
- To: Roger Pau Monne <roger.pau@xxxxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Wed, 2 Feb 2022 16:03:57 +0100
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
- 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=hBRyNp+ZlYONfsxjoAJA1EX+KoUvSPBAcmhaPQR8834=; b=hDrtR06dQ1dBzZ2HUPEKEJAXnGXyDkZtjdEKh2XcUqKSOCnTy5Whnc2NKtVSubXZyRpuiLDqjlQlbpksUjZMTZ0TfScxekEm62uQMittUoHXu6anntPFQEZw0xzCir1/HRnITLC/fQR/DBQLmVAFy/6EB8zGQY/mfMUQ45AJ241fX0eUKXAORDwBVYkcUrtK/Rb2UqzhZpukSXULB6TBXnvKKZVlEwcXf4f1CtWxe9TOdw2iamF1qEVfYXD/7VZvRien1z++Y8T7hgz6VkuA3hZl6HacPOnyJiBCuOxZKC661iX+elj9gLopwxKmFHSnE4SYxjJYSBYeERuJAOnc5A==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oIsfJvmOAsWrl6u79wNwf5pVm74vX+OXE7L6JrVwESNNFqSgR8ekoJpHXBLJNKFuYeWIZ07cxYa7OH55xvboY8956CVqaUikjXxO0kjC7hZbqeOOUmgCqqAuIrJvCv6Ms65qtRJh1uQi9ughwi4wbBW0c6OArF7j29ju3QY7gbZz3OhCh1oRhCoWwb4OFxxCs2/Nr0EWebIyo4uhGMXrBwTORjjFJy5jSMjyHyTUOQ/v7L6fmm+n+Qt+M8v7YQxQ0hdLGaLURl15VDcZ4IuiCFI7xzAAuwkasi4kLFmc7Z1trOUS9SdpCodgwPAk1tMo1WhmnbmfQcfnc0IY2DH2PA==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
- Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- Delivery-date: Wed, 02 Feb 2022 15:04:17 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 02.02.2022 15:45, Roger Pau Monne wrote:
> One of the boxes where I was attempting to boot Xen in PVH dom0 mode
> has quirky firmware, as it will handover with a PCI device with memory
> decoding enabled and a BAR of size 4K at address 0. Such BAR overlaps
> with a RAM range on the e820.
>
> This interacts badly with the dom0 PVH build, as BARs will be setup on
> the p2m before RAM, so if there's a BAR positioned over a RAM region
> it will trigger a domain crash when the dom0 builder attempts to
> populate that region with a regular RAM page.
>
> It's in general a very bad idea to have a BAR overlapping with any
> memory region defined in the memory map, so add some sanity checks for
> devices that are added with memory decoding enabled in order to assure
> that BARs are not placed on top of memory regions defined in the
> memory map. If overlaps are detected just disable the memory decoding
> bit for the device and expect the hardware domain to properly position
> the BAR.
>
> Note apply_quirks must be called before check_pdev so that ignore_bars
> is set when calling the later. PCI_HEADER_{NORMAL,BRIDGE}_NR_BARS
> needs to be moved into pci_regs.h so it's defined even in the absence
> of vPCI.
>
> Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
|