[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3] xen/arm: pci: fix check in pci_check_bar()


  • To: Stewart Hildebrand <Stewart.Hildebrand@xxxxxxx>
  • From: Rahul Singh <Rahul.Singh@xxxxxxx>
  • Date: Wed, 12 Jul 2023 17:03:26 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; 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=Ba6Mja8EZteepbYdAvxgOHhUTyOaOw3eVOGNs7AF7b4=; b=WosnRvut5qTaTFxrgWCvswNfbxmEi2zWwKtRShMb9mnr2F3V2tzQla57RFAmjpb51hQhTN4Gu7DwIicXZRh8Ce4K4AKJajf9R/K1PK9mUHHBVJJtNefwwHneIB+8CWnL/HhXgntttS/A6kg0d7rD3PQD0X5YJ2LFLISiNUYTBk7VyMRvk4sBQtSByfaZ96DjQnDMrnmF3Ee3WOEGz1nsBDU4tR4VBNwgxYZxmqnQI5q4/qlLCBv7uQeAOtj3alkX10aCQP2rts0iMh4X9zGhxk7AeIaFtQTThNarhYWeRdkE2SVr0lXBMCp/EW0S2X57A0SbQEUS5xohO6N7/9A5Vw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DE8GgiHFLTuuN/wT3rf9TO0YtEI/Kh4V3PU2zoiaGtutYKgYACTefjtVrEa+j5uUZWvn6GQ7hit6tkOSTeK5wHUnNl+EQdmKc7o8R9qidk833dVvGplt8hn/YofLAgw+6+Zn0t7H7pdC24vmhVHaf+G1zt4zxD0wPihqskIITIOXVPQQi2+fc3fIdnA1u+n1n1OUDNfrQkgz7fyUNOcZfPxy//dVenOvoQxb9P5veey3CLej92S64oaZatna/v4deAklwFpw5QuWXa0AQ+2Te6Xc8pO3VDYDK0BMt/HmcH3SnPJ66lMgKP6VnvzOqWxgYm+Cgl/26lmKaNvlq007Ew==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Wed, 12 Jul 2023 17:03:48 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHZtMggOVMN7Efb4EuWVUiRObIz7a+2W9aA
  • Thread-topic: [PATCH v3] xen/arm: pci: fix check in pci_check_bar()

Hi Stewart,

> On 12 Jul 2023, at 2:52 pm, Stewart Hildebrand <Stewart.Hildebrand@xxxxxxx> 
> wrote:
> 
> When mapping BARs for vPCI, it's valid for a BAR mfn_t start to equal the BAR
> mfn_t end (i.e. start == end) since end is inclusive. However, pci_check_bar()
> currently returns false in this case, which results in Xen not mapping the BAR
> in the guest 2nd stage page tables. In this example boot log, Linux has mapped
> the BARs in the 1st stage, but since Xen did not map them in the 2nd stage,
> Linux encounters a data abort and panics:
> 
> [    2.593300] pci 0000:00:00.0: BAR 0: assigned [mem 0x50008000-0x50008fff]
> [    2.593682] pci 0000:00:00.0: BAR 2: assigned [mem 0x50009000-0x50009fff]
> [    2.594066] pci 0000:00:00.0: BAR 4: assigned [mem 0x5000a000-0x5000afff]
> ...
> [    2.810502] virtio-pci 0000:00:00.0: enabling device (0000 -> 0002)
> (XEN) 0000:00:00.0: not mapping BAR [50008, 50008] invalid position
> (XEN) 0000:00:00.0: not mapping BAR [50009, 50009] invalid position
> (XEN) 0000:00:00.0: not mapping BAR [5000a, 5000a] invalid position
> [    2.817502] virtio-pci 0000:00:00.0: virtio_pci: leaving for legacy driver
> [    2.817853] virtio-pci 0000:00:00.0: enabling bus mastering
> (XEN) arch/arm/traps.c:1992:d0v0 HSR=0x00000093010045 pc=0xffff8000089507d4 
> gva=0xffff80000c46d012 gpa=0x00000050008012
> [    2.818397] Unable to handle kernel ttbr address size fault at virtual 
> address ffff80000c46d012
> ...
> 
> Adjust the end physical address e to account for the full page when converting
> from mfn, at which point s and e cannot be equal, so drop the equality check 
> in
> the condition.
> 
> Note that adjusting e to account for the full page also increases the accuracy
> of the subsequent is_bar_valid check.
> 
> Fixes: cc80e2bab0d0 ("xen/pci: replace call to is_memory_hole to 
> pci_check_bar")
> Signed-off-by: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
> Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>

I tested the patch on N1SDP board everything works.

Reviewed-by: Rahul Singh <rahul.singh@xxxxxxx>
Tested-by: Rahul Singh <rahul.singh@xxxxxxx>

Regards,
Rahul

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.