[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] xen/vpci: fix memory type in guest_mem_bar_read()
- To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
- Date: Tue, 10 Dec 2024 11:25:44 -0500
- 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)
- 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-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==
- Cc: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Delivery-date: Tue, 10 Dec 2024 16:26:10 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
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 <stewart.hildebrand@xxxxxxx>
---
xen/drivers/vpci/header.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
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;
base-commit: 1645bb7997cb1eccb45235ab350872733c74b305
--
2.47.1
|