Skip to contentSkip to conversation

iommu: add rmrr Xen command line option

PATCH In review Venu Busireddy 3 participants 13 messages Jan 23, 2017 – Jan 25, 2017

lore
Share & tools
lore
#0 lore raw

v14 cover iommu: add rmrr Xen command line option

Add Xen command line option rmrr to specify RMRR regions that are not defined in ACPI thus causing IO Page Faults and prevent dom0 from booting if "iommu=dom0-strict" option is specified on the Xen command line. These additional regions will be added to the list of RMRR regions parsed from ACPI.

Changes in v14:
- Implement Jan's feedback.
Rename some #defines and take care of boundary conditions.

Changes in v13:
- Implement feedback from Kevin Tian.
https://lists.xenproject.org/archives/html/xen-devel/2015-10/msg03169.html
https://lists.xenproject.org/archives/html/xen-devel/2015-10/msg03170.html
https://lists.xenproject.org/archives/html/xen-devel/2015-10/msg03171.html
- Limit all source lines and comments to 80 characters per line.
- Implement coding style suggestions from Konrad Wilk.
- Changed the Author to Elena Ufimtseva <[email protected]>

Changes in v12:
- Mostly cosmetic fixes from Jan's review on v11.

Changes in v11:
- changed macro to print extra RMRR ranges and added argument macro;
- fixed the overlapping check if condition error;
- fixed the loop exit condition when checking pfn in RMRR region;

Elena Ufimtseva (3):
iommu VT-d: separate rmrr addition function.
pci: add wrapper for parse_pci.
iommu: add rmrr Xen command line option for extra rmrrs

 docs/misc/xen-command-line.markdown |  13 ++
 xen/drivers/passthrough/vtd/dmar.c  | 326 +++++++++++++++++++++++++++++-------
 xen/drivers/pci/pci.c               |  11 ++
 xen/include/xen/pci.h               |   3 +
 4 files changed, 294 insertions(+), 59 deletions(-)

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#1 lore raw

PATCH v14 1/3 iommu VT-d: separate rmrr addition function.

In preparation for auxiliary RMRR data provided on Xen command line, make RMRR adding a separate function.
Also free memery for rmrr device scope in error path.

---
 xen/drivers/passthrough/vtd/dmar.c | 123 ++++++++++++++++++++-----------------
 1 file changed, 65 insertions(+), 58 deletions(-)

Changes in v14:
- Capture the return value from register_one_rmrr() and use it.

xen/drivers/passthrough/vtd/dmar.c +65 -58
index 08c1d2d..3c7c9b2 100644
@@ -579,6 +579,68 @@ out:
     return ret;
 }
 
+static int register_one_rmrr(struct acpi_rmrr_unit *rmrru)
+{
+    bool ignore = false;
+    unsigned int i = 0;
+    int ret = 0;
+
+    /* Skip checking if segment is not accessible yet. */
+    if ( !pci_known_segment(rmrru->segment) )
+        i = UINT_MAX;
+
+    for ( ; i < rmrru->scope.devices_cnt; i++ )
+    {
+        u8 b = PCI_BUS(rmrru->scope.devices[i]);
+        u8 d = PCI_SLOT(rmrru->scope.devices[i]);
+        u8 f = PCI_FUNC(rmrru->scope.devices[i]);
+
+        if ( pci_device_detect(rmrru->segment, b, d, f) == 0 )
+        {
+            dprintk(XENLOG_WARNING VTDPREFIX,
+                    " Non-existent device (%04x:%02x:%02x.%u) is reported"
+                    " in RMRR (%"PRIx64", %"PRIx64")'s scope!\n",
+                    rmrru->segment, b, d, f,
+                    rmrru->base_address, rmrru->end_address);
+            ignore = true;
+        }
+        else
+        {
+            ignore = false;
+            break;
+        }
+    }
+
+    if ( ignore )
+    {
+        dprintk(XENLOG_WARNING VTDPREFIX,
+                "  Ignore the RMRR (%"PRIx64", %"PRIx64") due to "
+                "devices under its scope are not PCI discoverable!\n",
+                rmrru->base_address, rmrru->end_address);
+        scope_devices_free(&rmrru->scope);
+        xfree(rmrru);
+    }
+    else if ( rmrru->base_address > rmrru->end_address )
+    {
+        dprintk(XENLOG_WARNING VTDPREFIX,
+                "  The RMRR (%"PRIx64", %"PRIx64") is incorrect!\n",
+                rmrru->base_address, rmrru->end_address);
+        scope_devices_free(&rmrru->scope);
+        xfree(rmrru);
+        ret = -EFAULT;
+    }
+    else
+    {
+        if ( iommu_verbose )
+            dprintk(VTDPREFIX,
+                    "  RMRR region: base_addr %"PRIx64" end_addr %"PRIx64"\n",
+                    rmrru->base_address, rmrru->end_address);
+        acpi_register_rmrr_unit(rmrru);
+    }
+
+    return ret;
+}
+
 static int __init
 acpi_parse_one_rmrr(struct acpi_dmar_header *header)
 {
@@ -628,65 +690,10 @@ acpi_parse_one_rmrr(struct acpi_dmar_header *header)
     ret = acpi_parse_dev_scope(dev_scope_start, dev_scope_end,
                                &rmrru->scope, RMRR_TYPE, rmrr->segment);
 
-    if ( ret || (rmrru->scope.devices_cnt == 0) )
-        xfree(rmrru);
+    if ( !ret && (rmrru->scope.devices_cnt != 0) )
+        ret = register_one_rmrr(rmrru);
     else
-    {
-        u8 b, d, f;
-        bool_t ignore = 0;
-        unsigned int i = 0;
-
-        /* Skip checking if segment is not accessible yet. */
-        if ( !pci_known_segment(rmrr->segment) )
-            i = UINT_MAX;
-
-        for ( ; i < rmrru->scope.devices_cnt; i++ )
-        {
-            b = PCI_BUS(rmrru->scope.devices[i]);
-            d = PCI_SLOT(rmrru->scope.devices[i]);
-            f = PCI_FUNC(rmrru->scope.devices[i]);
-
-            if ( !pci_device_detect(rmrr->segment, b, d, f) )
-            {
-                printk(XENLOG_WARNING VTDPREFIX
-                       " Non-existent device (%04x:%02x:%02x.%u) reported in RMRR (%"PRIx64", %"PRIx64")'s scope!\n",
-                       rmrr->segment, b, d, f,
-                       rmrru->base_address, rmrru->end_address);
-                ignore = 1;
-            }
-            else
-            {
-                ignore = 0;
-                break;
-            }
-        }
-
-        if ( ignore )
-        {
-            printk(XENLOG_WARNING VTDPREFIX
-                   "  Ignore RMRR (%"PRIx64", %"PRIx64") (some devices in its scope are not PCI discoverable)\n",
-                   rmrru->base_address, rmrru->end_address);
-            scope_devices_free(&rmrru->scope);
-            xfree(rmrru);
-        }
-        else if ( base_addr > end_addr )
-        {
-            printk(XENLOG_WARNING VTDPREFIX
-                   "  RMRR (%"PRIx64", %"PRIx64") is incorrect\n",
-                   rmrru->base_address, rmrru->end_address);
-            scope_devices_free(&rmrru->scope);
-            xfree(rmrru);
-            ret = -EFAULT;
-        }
-        else
-        {
-            if ( iommu_verbose )
-                printk(VTDPREFIX
-                       "  RMRR region: base_addr %"PRIx64" end_address %"PRIx64"\n",
-                       rmrru->base_address, rmrru->end_address);
-            acpi_register_rmrr_unit(rmrru);
-        }
-    }
+        xfree(rmrru);
 
     return ret;
 }

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Reviewed-by on v14 1/3
#2 lore raw

Re: [PATCH v14 1/3] iommu VT-d: separate rmrr addition function.

Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 23.01.17 at 19:20, <[email protected]> wrote:

In preparation for auxiliary RMRR data provided on Xen command line, make RMRR adding a separate function.
Also free memery for rmrr device scope in error path.

Quoted 2 lines

Changes in v14:
- Capture the return value from register_one_rmrr() and use it.

When you fix bugs in areas earlier offered tags apply to, I think you should strictly drop any such tags. I'm pretty convinced Kevin would re-offer his one in the case here, but you shouldn't take this for given.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Acked-by
#3 lore raw

Re: [PATCH v14 1/3] iommu VT-d: separate rmrr addition function.

Quoted 17 lines

From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, January 24, 2017 4:34 PM

Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 23.01.17 at 19:20, <[email protected]> wrote:

In preparation for auxiliary RMRR data provided on Xen command line, make RMRR adding a separate function.
Also free memery for rmrr device scope in error path.

Quoted 2 lines

Changes in v14:
- Capture the return value from register_one_rmrr() and use it.

Quoted 6 lines

When you fix bugs in areas earlier offered tags apply to, I think you should strictly drop any such tags. I'm pretty convinced Kevin would re-offer his one in the case here, but you shouldn't take this for given.

Jan

Thanks for remind.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#4 lore raw

PATCH v14 2/3 pci: add wrapper for parse_pci.

In reply to Venu Busireddy

For sbdf's parsing in RMRR command line, add parse_pci_seg with additional parameter def_seg. parse_pci_seg will help to identify if segment was found in string being parsed or default segment was used.
Make a wrapper parse_pci so the rest of the callers are not affected.

---
 xen/drivers/pci/pci.c | 11 +++++++++++
 xen/include/xen/pci.h |  3 +++
 2 files changed, 14 insertions(+)

Changes in v14:
- No new changes. Included this patch file for the sake of completeness.

xen/drivers/pci/pci.c +11 -0
index ca07ed0..13d3309 100644
@@ -119,11 +119,21 @@ const char *__init parse_pci(const char *s, unsigned int *seg_p,
                              unsigned int *bus_p, unsigned int *dev_p,
                              unsigned int *func_p)
 {
+    bool def_seg;
+
+    return parse_pci_seg(s, seg_p, bus_p, dev_p, func_p, &def_seg);
+}
+
+const char *__init parse_pci_seg(const char *s, unsigned int *seg_p,
+                                 unsigned int *bus_p, unsigned int *dev_p,
+                                 unsigned int *func_p, bool *def_seg)
+{
     unsigned long seg = simple_strtoul(s, &s, 16), bus, dev, func;
 
     if ( *s != ':' )
         return NULL;
     bus = simple_strtoul(s + 1, &s, 16);
+    *def_seg = false;
     if ( *s == ':' )
         dev = simple_strtoul(s + 1, &s, 16);
     else
@@ -131,6 +141,7 @@ const char *__init parse_pci(const char *s, unsigned int *seg_p,
         dev = bus;
         bus = seg;
         seg = 0;
+        *def_seg = true;
     }
     if ( func_p )
     {
xen/include/xen/pci.h +3 -0
index 0872401..59b6e8a 100644
@@ -159,6 +159,9 @@ int pci_find_ext_capability(int seg, int bus, int devfn, int cap);
 int pci_find_next_ext_capability(int seg, int bus, int devfn, int pos, int cap);
 const char *parse_pci(const char *, unsigned int *seg, unsigned int *bus,
                       unsigned int *dev, unsigned int *func);
+const char *parse_pci_seg(const char *, unsigned int *seg, unsigned int *bus,
+                          unsigned int *dev, unsigned int *func, bool *def_seg);
+
 
 bool_t pcie_aer_get_firmware_first(const struct pci_dev *);
 

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#5 lore raw

PATCH v14 3/3 iommu: add rmrr Xen command line option for extra rmrrs

In reply to Venu Busireddy

On some platforms firmware fails to specify RMRR regions in ACPI tables and thus those regions will not be mapped in dom0 or guests and may cause IO Page Faults and prevent dom0 from booting if "iommu=dom0-strict" option is specified on the Xen command line.

New Xen command line option rmrr allows to specify such devices and memory regions. These regions are added to the list of RMRR defined in ACPI if the device is present in system. As a result, additional RMRRs will be mapped 1:1 in dom0 with correct permissions.

The above mentioned problems were discovered during the PVH work with ThinkCentre M and Dell 5600T. No official documentation was found so far in regards to what devices and why cause this. Experiments show that ThinkCentre M USB devices with enabled debug port generate DMA read transactions to the regions of memory marked reserved in host e820 map.

For Dell 5600T the device and faulting addresses are not found yet. For detailed history of the discussion please check following threads:

    http://lists.Xen.org/archives/html/xen-devel/2015-02/msg01724.html
    http://lists.Xen.org/archives/html/xen-devel/2015-01/msg02513.html

Format for rmrr Xen command line option:
rmrr=start<-end>=[s1]bdf1[,[s1]bdf2[,...]];start<-end>=[s2]bdf1[,[s2]bdf2[,...]] For example, for Lenovo ThinkCentre M, use:
rmrr=0xd5d45=0:0:1d.0;0xd5d46=0:0:1a.0
If grub2 used and multiple ranges are specified, ';' should be quoted/escaped, refer to grub2 manual for more information.

---
 docs/misc/xen-command-line.markdown |  13 +++
 xen/drivers/passthrough/vtd/dmar.c  | 203 +++++++++++++++++++++++++++++++++++-
 2 files changed, 215 insertions(+), 1 deletion(-)

Changes in v14:
- Implement Jan's feedback.
Rename some #defines and take care of boundary conditions.

docs/misc/xen-command-line.markdown +13 -0
index 0138978..a11fdf9 100644
@@ -1377,6 +1377,19 @@ Specify the host reboot method.
 'efi' instructs Xen to reboot using the EFI reboot call (in EFI mode by
  default it will use that method first).
 
+### rmrr
+> '= start<-end>=[s1]bdf1[,[s1]bdf2[,...]];start<-end>=[s2]bdf1[,[s2]bdf2[,...]]
+
+Define RMRR units that are missing from ACPI table along with device they
+belong to and use them for 1:1 mapping. End addresses can be omitted and one
+page will be mapped. The ranges are inclusive when start and end are specified.
+If segment of the first device is not specified, segment zero will be used.
+If other segments are not specified, first device segment will be used.
+If a segment is specified for other than the first device and it does not match
+the one specified for the first one, an error will be reported.
+Note: grub2 requires to escape or use quotations if special characters are used,
+namely ';', refer to the grub2 documentation if multiple ranges are specified.
+
 ### ro-hpet
 > `= <boolean>`
 
xen/drivers/passthrough/vtd/dmar.c +202 -1

224 lines not on this page · raw message

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Reviewed-by on v14 3/3
#6 lore raw

Re: [PATCH v14 3/3] iommu: add rmrr Xen command line option for extra rmrrs

xen/drivers/passthrough/vtd/dmar.c out: · line 914

Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 23.01.17 at 19:20, <[email protected]> wrote:
xen/drivers/passthrough/vtd/dmar.c +5 -0
+        overlap = false;
+        list_for_each_entry(rmrru, &acpi_rmrr_units, list)
+        {
+            if ( pfn_to_paddr(base) <= rmrru->end_address &&
+                 rmrru->base_address <= pfn_to_paddr(end) )

So this now looks correct as long as rmrru->base_address is page aligned (as required by the spec), which should be good enough for now (considering that we make this assumption elsewhere). Nevertheless it would have been nice if you had, following the subsequent discussion with Elena, accounted for spec violations here.

xen/drivers/passthrough/vtd/dmar.c out: · line 974

Quoted 4 lines
xen/drivers/passthrough/vtd/dmar.c +4 -0
+        rmrr->segment = seg;
+        rmrr->base_address = pfn_to_paddr(user_rmrrs[i].base_pfn);
+        /* Align the end_address to the end of the page */
+        rmrr->end_address = pfn_to_paddr(user_rmrrs[i].end_pfn) | ~PAGE_MASK_4K;

Hmm, Ive just checked - in my reply to Elena I had intentionally used PAGE_MASK here (and I recall correcting it from PAGE_MASK_4K). What has led you to use PAGE_MASK_4K here, when pfn_to_paddr() uses PAGE_SHIFT?

With this corrected (which can be done upon commit, but I'd first like to understand your reasoning):

And despite Kevin's ack being present here, in light of what I've said on the other patch - Kevin, please confirm your ack.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#7 lore raw

Re: [PATCH v14 3/3] iommu: add rmrr Xen command line option for extra rmrrs

Quoted 19 lines · Jan Beulich

xen/drivers/passthrough/vtd/dmar.c out: · line 914

Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 23.01.17 at 19:20, <[email protected]> wrote:
xen/drivers/passthrough/vtd/dmar.c +5 -0
+        overlap = false;
+        list_for_each_entry(rmrru, &acpi_rmrr_units, list)
+        {
+            if ( pfn_to_paddr(base) <= rmrru->end_address &&
+                 rmrru->base_address <= pfn_to_paddr(end) )

So this now looks correct as long as rmrru->base_address is page aligned (as required by the spec), which should be good enough for now (considering that we make this assumption elsewhere). Nevertheless it would have been nice if you had, following the subsequent discussion with Elena, accounted for spec violations here.

xen/drivers/passthrough/vtd/dmar.c out: · line 974

Quoted 4 lines
xen/drivers/passthrough/vtd/dmar.c +4 -0
+        rmrr->segment = seg;
+        rmrr->base_address = pfn_to_paddr(user_rmrrs[i].base_pfn);
+        /* Align the end_address to the end of the page */
+        rmrr->end_address = pfn_to_paddr(user_rmrrs[i].end_pfn) | ~PAGE_MASK_4K;
Quoted 4 lines

Hmm, Ive just checked - in my reply to Elena I had intentionally used PAGE_MASK here (and I recall correcting it from PAGE_MASK_4K). What has led you to use PAGE_MASK_4K here, when pfn_to_paddr() uses PAGE_SHIFT?

Elena suggested to use PAGE_MASK_4K because the functions in drivers/passthrough/vtd/iommu.c (including rmrr_identity_mapping()) use the _4K. With the current assumptions, both will work.

If you would like me to change this to PAGE_MASK, I will do so before committing. Please let me know.

Quoted 9 lines

With this corrected (which can be done upon commit, but I'd first like to understand your reasoning):

And despite Kevin's ack being present here, in light of what I've said on the other patch - Kevin, please confirm your ack.

Jan

Regards,

Venu

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#8 lore raw

Re: [PATCH v14 3/3] iommu: add rmrr Xen command line option for extra rmrrs

Quoted 22 lines
Quoted 1 line
Quoted 1 line · On 24.01.17 at 16:35, <[email protected]> wrote:
Quoted 7 lines · Jan Beulich

xen/drivers/passthrough/vtd/dmar.c out: · line 914

Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 23.01.17 at 19:20, <[email protected]> wrote:
xen/drivers/passthrough/vtd/dmar.c +5 -0
+        overlap = false;
+        list_for_each_entry(rmrru, &acpi_rmrr_units, list)
+        {
+            if ( pfn_to_paddr(base) <= rmrru->end_address &&
+                 rmrru->base_address <= pfn_to_paddr(end) )
Quoted 11 lines

So this now looks correct as long as rmrru->base_address is page aligned (as required by the spec), which should be good enough for now (considering that we make this assumption elsewhere). Nevertheless it would have been nice if you had, following the subsequent discussion with Elena, accounted for spec violations here.

Quoted 4 lines
xen/drivers/passthrough/vtd/dmar.c +4 -0
+        rmrr->segment = seg;
+        rmrr->base_address = pfn_to_paddr(user_rmrrs[i].base_pfn);
+        /* Align the end_address to the end of the page */
+        rmrr->end_address = pfn_to_paddr(user_rmrrs[i].end_pfn) | 

~PAGE_MASK_4K;

Quoted 1 line
Quoted 8 lines
Quoted 4 lines

Hmm, Ive just checked - in my reply to Elena I had intentionally used PAGE_MASK here (and I recall correcting it from PAGE_MASK_4K). What has led you to use PAGE_MASK_4K here, when pfn_to_paddr() uses PAGE_SHIFT?

Elena suggested to use PAGE_MASK_4K because the functions in drivers/passthrough/vtd/iommu.c (including rmrr_identity_mapping()) use the _4K. With the current assumptions, both will work.

Granted this is somewhat of a mess, but I'd prefer if at least within a single statement things would be consistent in which page size is being meant.

Quoted 2 lines

If you would like me to change this to PAGE_MASK, I will do so before committing. Please let me know.

As said, I don't see a need for you to re-submit, unless there are other issues in need of taking care of.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#9 lore raw

Re: [PATCH v14 3/3] iommu: add rmrr Xen command line option for extra rmrrs

Quoted 35 lines · Jan Beulich
Quoted 22 lines
Quoted 1 line
Quoted 1 line · On 24.01.17 at 16:35, <[email protected]> wrote:
Quoted 7 lines · Jan Beulich

xen/drivers/passthrough/vtd/dmar.c out: · line 914

Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 23.01.17 at 19:20, <[email protected]> wrote:
xen/drivers/passthrough/vtd/dmar.c +5 -0
+        overlap = false;
+        list_for_each_entry(rmrru, &acpi_rmrr_units, list)
+        {
+            if ( pfn_to_paddr(base) <= rmrru->end_address &&
+                 rmrru->base_address <= pfn_to_paddr(end) )
Quoted 11 lines

So this now looks correct as long as rmrru->base_address is page aligned (as required by the spec), which should be good enough for now (considering that we make this assumption elsewhere). Nevertheless it would have been nice if you had, following the subsequent discussion with Elena, accounted for spec violations here.

Quoted 4 lines
xen/drivers/passthrough/vtd/dmar.c +4 -0
+        rmrr->segment = seg;
+        rmrr->base_address = pfn_to_paddr(user_rmrrs[i].base_pfn);
+        /* Align the end_address to the end of the page */
+        rmrr->end_address = pfn_to_paddr(user_rmrrs[i].end_pfn) | 

~PAGE_MASK_4K;

Quoted 1 line
Quoted 8 lines
Quoted 4 lines

Hmm, Ive just checked - in my reply to Elena I had intentionally used PAGE_MASK here (and I recall correcting it from PAGE_MASK_4K). What has led you to use PAGE_MASK_4K here, when pfn_to_paddr() uses PAGE_SHIFT?

Elena suggested to use PAGE_MASK_4K because the functions in drivers/passthrough/vtd/iommu.c (including rmrr_identity_mapping()) use the _4K. With the current assumptions, both will work.

Granted this is somewhat of a mess, but I'd prefer if at least within a single statement things would be consistent in which page size is being meant.

Quoted 5 lines
Quoted 2 lines

If you would like me to change this to PAGE_MASK, I will do so before committing. Please let me know.

As said, I don't see a need for you to re-submit, unless there are other issues in need of taking care of.

Sure. I will change it to PAGE_MASK, but I will not resubmit the patches. I will change it and commit it. Of course, assuming that there are no other changes suggested by others.

Do I understand that I have your Ack?

Quoted 3 lines

Jan

Venu

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#10 lore raw

Re: [PATCH v14 3/3] iommu: add rmrr Xen command line option for extra rmrrs

Quoted 40 lines
Quoted 1 line
Quoted 1 line · On 24.01.17 at 16:58, <[email protected]> wrote:
Quoted 38 lines · Jan Beulich
Quoted 22 lines
Quoted 1 line
Quoted 1 line · On 24.01.17 at 16:35, <[email protected]> wrote:
Quoted 7 lines · Jan Beulich

xen/drivers/passthrough/vtd/dmar.c out: · line 914

Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 23.01.17 at 19:20, <[email protected]> wrote:
xen/drivers/passthrough/vtd/dmar.c +5 -0
+        overlap = false;
+        list_for_each_entry(rmrru, &acpi_rmrr_units, list)
+        {
+            if ( pfn_to_paddr(base) <= rmrru->end_address &&
+                 rmrru->base_address <= pfn_to_paddr(end) )
Quoted 11 lines

So this now looks correct as long as rmrru->base_address is page aligned (as required by the spec), which should be good enough for now (considering that we make this assumption elsewhere). Nevertheless it would have been nice if you had, following the subsequent discussion with Elena, accounted for spec violations here.

Quoted 4 lines
xen/drivers/passthrough/vtd/dmar.c +4 -0
+        rmrr->segment = seg;
+        rmrr->base_address = pfn_to_paddr(user_rmrrs[i].base_pfn);
+        /* Align the end_address to the end of the page */
+        rmrr->end_address = pfn_to_paddr(user_rmrrs[i].end_pfn) | 

~PAGE_MASK_4K;

Quoted 1 line
Quoted 8 lines
Quoted 4 lines

Hmm, Ive just checked - in my reply to Elena I had intentionally used PAGE_MASK here (and I recall correcting it from PAGE_MASK_4K). What has led you to use PAGE_MASK_4K here, when pfn_to_paddr() uses PAGE_SHIFT?

Elena suggested to use PAGE_MASK_4K because the functions in drivers/passthrough/vtd/iommu.c (including rmrr_identity_mapping()) use the _4K. With the current assumptions, both will work.

Granted this is somewhat of a mess, but I'd prefer if at least within a single statement things would be consistent in which page size is being meant.

Quoted 2 lines

If you would like me to change this to PAGE_MASK, I will do so before committing. Please let me know.

Quoted 6 lines
Quoted 2 lines

As said, I don't see a need for you to re-submit, unless there are other issues in need of taking care of.

Sure. I will change it to PAGE_MASK, but I will not resubmit the patches. I will change it and commit it. Of course, assuming that there are no other changes suggested by others.

I don't follow this repeated mentioning of "commit" by you. I don't think you can commit to our staging tree. And actually committing the series depends on - as also stated before - Kevin confirming his acks, which you had wrongly left in place.

Quoted 1 line

Do I understand that I have your Ack?

Well, I had given you my (conditional) R-b in the (my) morning.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#11 lore raw

Re: [PATCH v14 3/3] iommu: add rmrr Xen command line option for extra rmrrs

Quoted 56 lines

-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, January 24, 2017 10:08 AM
To: Venu Busireddy
Cc: Feng Wu; Kevin Tian; [email protected]; Elena Ufimtseva; Konrad Rzeszutek Wilk
Subject: Re: [PATCH v14 3/3] iommu: add rmrr Xen command line option for extra rmrrs

Quoted 18 lines
Quoted 1 line
Quoted 1 line · On 24.01.17 at 16:58, <[email protected]> wrote:
Quoted 16 lines · Jan Beulich
Quoted 16 lines
Quoted 1 line
Quoted 1 line · On 24.01.17 at 16:35, <[email protected]> wrote:
Quoted 14 lines · Jan Beulich

xen/drivers/passthrough/vtd/dmar.c out: · line 914

Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 23.01.17 at 19:20, <[email protected]> wrote:
xen/drivers/passthrough/vtd/dmar.c +5 -0
+        overlap = false;
+        list_for_each_entry(rmrru, &acpi_rmrr_units, list)
+        {
+            if ( pfn_to_paddr(base) <= rmrru->end_address &&
+                 rmrru->base_address <= pfn_to_paddr(end) )

So this now looks correct as long as rmrru->base_address is page aligned (as required by the spec), which should be good enough for now (considering that we make this assumption elsewhere). Nevertheless it would have been nice if you had, following the subsequent discussion with Elena, accounted for spec violations here.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+        rmrr->segment = seg;
+        rmrr->base_address =

pfn_to_paddr(user_rmrrs[i].base_pfn);

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+        /* Align the end_address to the end of the page */
+        rmrr->end_address = pfn_to_paddr(user_rmrrs[i].end_pfn) |

~PAGE_MASK_4K;

Quoted 2 lines

Hmm, Ive just checked - in my reply to Elena I had intentionally

used

Quoted 18 lines
Quoted 17 lines
Quoted 7 lines
Quoted 3 lines

PAGE_MASK here (and I recall correcting it from PAGE_MASK_4K). What has led you to use PAGE_MASK_4K here, when pfn_to_paddr() uses PAGE_SHIFT?

Elena suggested to use PAGE_MASK_4K because the functions in drivers/passthrough/vtd/iommu.c (including rmrr_identity_mapping()) use the _4K. With the current assumptions, both will work.

Granted this is somewhat of a mess, but I'd prefer if at least within a single statement things would be consistent in which page size is being meant.

Quoted 2 lines

If you would like me to change this to PAGE_MASK, I will do so before committing. Please let me know.

As said, I don't see a need for you to re-submit, unless there are other issues in need of taking care of.

Quoted 8 lines
Quoted 3 lines

Sure. I will change it to PAGE_MASK, but I will not resubmit the patches. I will change it and commit it. Of course, assuming that there are no other changes suggested by others.

I don't follow this repeated mentioning of "commit" by you. I don't think you can commit to our staging tree. And actually committing the series depends on - as also stated before - Kevin confirming his acks, which you had wrongly left in place.

Sorry Jan! I was confused. I thought that once I have the Ack's from the Maintainers, I can push the changes myself. Hence I was saying commit - meaning, commit to my local tree, with the intent to push them upstream once Ack'ed. I am told that I cannot push the changes.

Therefore, once we have Kevin's Ack, please change PAGE_MASK_4K to PAGE_MASK and commit.

Thanks,

Venu

Quoted 7 lines
Quoted 2 lines

Do I understand that I have your Ack?

Well, I had given you my (conditional) R-b in the (my) morning.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Acked-by
#12 lore raw

Re: [PATCH v14 3/3] iommu: add rmrr Xen command line option for extra rmrrs

In reply to Jan Beulich
Quoted 28 lines

From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, January 24, 2017 4:47 PM

xen/drivers/passthrough/vtd/dmar.c out: · line 914

Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 23.01.17 at 19:20, <[email protected]> wrote:
xen/drivers/passthrough/vtd/dmar.c +5 -0
+        overlap = false;
+        list_for_each_entry(rmrru, &acpi_rmrr_units, list)
+        {
+            if ( pfn_to_paddr(base) <= rmrru->end_address &&
+                 rmrru->base_address <= pfn_to_paddr(end) )

So this now looks correct as long as rmrru->base_address is page aligned (as required by the spec), which should be good enough for now (considering that we make this assumption elsewhere). Nevertheless it would have been nice if you had, following the subsequent discussion with Elena, accounted for spec violations here.

xen/drivers/passthrough/vtd/dmar.c out:

Quoted 4 lines
xen/drivers/passthrough/vtd/dmar.c +4 -0
+        rmrr->segment = seg;
+        rmrr->base_address = pfn_to_paddr(user_rmrrs[i].base_pfn);
+        /* Align the end_address to the end of the page */
+        rmrr->end_address = pfn_to_paddr(user_rmrrs[i].end_pfn) |

~PAGE_MASK_4K;

Hmm, Ive just checked - in my reply to Elena I had intentionally used PAGE_MASK here (and I recall correcting it from PAGE_MASK_4K). What has led you to use PAGE_MASK_4K here, when pfn_to_paddr() uses PAGE_SHIFT?

Quoted 7 lines

With this corrected (which can be done upon commit, but I'd first like to understand your reasoning):

And despite Kevin's ack being present here, in light of what I've said on the other patch - Kevin, please confirm your ack.

Sure, here is my confirm:

btw good to catch it right before my vacation to not block check-in. :-)

Thanks
Kevin

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel