Mailing List Archive

[xen staging] VT-d: PCI segment numbers are up to 16 bits wide
commit a3dd33e63c2c8c51102f223e6efe2e3d3bdcbec1
Author: Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Sep 20 10:25:03 2021 +0200
Commit: Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 20 10:25:03 2021 +0200

VT-d: PCI segment numbers are up to 16 bits wide

We shouldn't silently truncate respective values.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
xen/drivers/passthrough/vtd/iommu.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 859e6ddf62..611c22fd52 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1462,7 +1462,8 @@ static int domain_context_mapping(struct domain *domain, u8 devfn,
{
const struct acpi_drhd_unit *drhd = acpi_find_matched_drhd_unit(pdev);
int ret = 0;
- u8 seg = pdev->seg, bus = pdev->bus, secbus;
+ uint16_t seg = pdev->seg;
+ uint8_t bus = pdev->bus, secbus;

/*
* Generally we assume only devices from one node to get assigned to a
@@ -1677,7 +1678,8 @@ static int domain_context_unmap(struct domain *domain, u8 devfn,
const struct acpi_drhd_unit *drhd = acpi_find_matched_drhd_unit(pdev);
struct vtd_iommu *iommu = drhd ? drhd->iommu : NULL;
int ret;
- u8 seg = pdev->seg, bus = pdev->bus, tmp_bus, tmp_devfn, secbus;
+ uint16_t seg = pdev->seg;
+ uint8_t bus = pdev->bus, tmp_bus, tmp_devfn, secbus;
bool found;

switch ( pdev->type )
--
generated by git-patchbot for /home/xen/git/xen.git#staging