diff mbox series

[v2,2/3] VT-d: PCI segments are up to 16 bits wide

Message ID ee538608-4be8-b277-099a-fa82e0b59a9c@suse.com (mailing list archive)
State New, archived
Headers show
Series IOMMU/PCI: respect device specifics | expand

Commit Message

Jan Beulich Sept. 17, 2021, 11 a.m. UTC
We shouldn't silently truncate respective values.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
Strictly speaking we shouldn't use uint<N>_t here at all. I wasn't sure
though whether going straight to unsigned int wouldn't be viewed as
introducing inconsistencies.
---
v2: New.

Comments

Tian, Kevin Sept. 18, 2021, 12:49 a.m. UTC | #1
> From: Jan Beulich <jbeulich@suse.com>
> Sent: Friday, September 17, 2021 7:00 PM
> 
> We shouldn't silently truncate respective values.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Kevin Tian <kevin.tian@intel.com>

> ---
> Strictly speaking we shouldn't use uint<N>_t here at all. I wasn't sure
> though whether going straight to unsigned int wouldn't be viewed as
> introducing inconsistencies.
> ---
> v2: New.
> 
> --- a/xen/drivers/passthrough/vtd/iommu.c
> +++ b/xen/drivers/passthrough/vtd/iommu.c
> @@ -1462,7 +1462,8 @@ static int domain_context_mapping(struct
>  {
>      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 d
>      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 )
diff mbox series

Patch

--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1462,7 +1462,8 @@  static int domain_context_mapping(struct
 {
     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 d
     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 )