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

[PATCH v9 15/16] xen/arm: vpci: check guest range


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Date: Tue, 29 Aug 2023 23:19:47 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.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=yi13S8hn57H9+SZArk4saLc0rRHuoOULjXT1oxZYZRk=; b=moR5GxUVlhOgAP5lHmGfUM2ihkIhSTVWebcDAvvxgrsDHQGia/sMr/unYTTnpqcEZn6esviCuw+c7x3Pv3lzvfurVADpXaxXWTp+ouaBILzx1hSmwY2A14Jnz1RAaQKZCGVn3IIKlEpW9eOJMFE3w+SFkWlBd/gzIoe2i40LzY1zywSwA2dvI7Lut4HPEq2RvqP4p3uyOHkwVag2lmKY6N0gqOC7J4yKDq4EZ1X2xTA6Cn/YWNALWWXRtjmPtbFhJhzD4MHszRLK5Q0jSPSFE1AQQevaIdDmCsp82BwJb0oGL66gLoDuqV7JkaoRW6KGs93TPIJf1dDgyUcZIAz80A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m+E0+htBOuRqUkOXEOH0PhRZYcgmKQUqttJGKIJRnaonfSlB02lCzplD+ZVXLVVL6442sA88tyBwDqB8OZZvD4wgT5TO3TGh9dLiTXqX5mEgYQ2/U76z9NDfuGavqGNXlEzxa8S0DVT3wETa/fhWAZOenuf776bGcVu9nCHGxjcgjzqLhfzezm9A88DlViR14zIaS0sJAk3hYyaZQ2JI5pg+ifS1negLstRxRMEh7471ye6biLql1UOkbPTXZINFy6v9zeXfJ+ZoAyCivOVoyK668iTuE7CzgRQKqC7VceYFovtBuQl6epUHRCjPWnFYJ42MuZFddX2ZRVJhSBAvQA==
  • Cc: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Tue, 29 Aug 2023 23:20:05 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHZ2s9NAWcA6L4O6U+PqFV61kFyWA==
  • Thread-topic: [PATCH v9 15/16] xen/arm: vpci: check guest range

From: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>

Skip mapping the BAR if it is not in a valid range.

Signed-off-by: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
---
 xen/drivers/vpci/header.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c
index 1d243eeaf9..dbabdcbed2 100644
--- a/xen/drivers/vpci/header.c
+++ b/xen/drivers/vpci/header.c
@@ -345,6 +345,15 @@ static int modify_bars(const struct pci_dev *pdev, 
uint16_t cmd, bool rom_only)
              bar->enabled == !!(cmd & PCI_COMMAND_MEMORY) )
             continue;
 
+#ifdef CONFIG_ARM
+        if ( !is_hardware_domain(pdev->domain) )
+        {
+            if ( (start_guest < PFN_DOWN(GUEST_VPCI_MEM_ADDR)) ||
+                 (end_guest >= PFN_DOWN(GUEST_VPCI_MEM_ADDR + 
GUEST_VPCI_MEM_SIZE)) )
+                continue;
+        }
+#endif
+
         if ( !pci_check_bar(pdev, _mfn(start), _mfn(end)) )
         {
             printk(XENLOG_G_WARNING
-- 
2.41.0



 


Rackspace

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