diff mbox

[v2] iommu: Elaborate the usage of RMRR specification on the command line

Message ID 1487869435-1661-1-git-send-email-venu.busireddy@oracle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Venu Busireddy Feb. 23, 2017, 5:03 p.m. UTC
As some users have suggested, elaborate the usage of RMRR specification
on the command line, and provide a usage example.

Also, always treat the specified page numbers as hexadecimal values.

Signed-off-by: Venu Busireddy <venu.busireddy@oracle.com>
---

 Changes in v2:
   - Provide a better usage example.
   - Treat input page numbers as hexadecimal values.

 docs/misc/xen-command-line.markdown | 10 ++++++++++
 xen/drivers/passthrough/vtd/dmar.c  |  4 ++--
 2 files changed, 12 insertions(+), 2 deletions(-)

Comments

Roger Pau Monné Feb. 23, 2017, 5:11 p.m. UTC | #1
On Thu, Feb 23, 2017 at 11:03:55AM -0600, Venu Busireddy wrote:
> As some users have suggested, elaborate the usage of RMRR specification
> on the command line, and provide a usage example.
> 
> Also, always treat the specified page numbers as hexadecimal values.
> 
> Signed-off-by: Venu Busireddy <venu.busireddy@oracle.com>

Thanks! Just a minor comment, apart from that:

Acked-by: Roger Pau Monné <roger.pau@citrix.com>

> ---
> 
>  Changes in v2:
>    - Provide a better usage example.
>    - Treat input page numbers as hexadecimal values.
> 
>  docs/misc/xen-command-line.markdown | 10 ++++++++++
>  xen/drivers/passthrough/vtd/dmar.c  |  4 ++--
>  2 files changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown
> index 3acbb33..a035c3f 100644
> --- a/docs/misc/xen-command-line.markdown
> +++ b/docs/misc/xen-command-line.markdown
> @@ -1406,6 +1406,16 @@ 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.
> +
> +'start' and 'end' values are page numbers (not full physical addresses),
> +in hexadecimal format (can optionally be preceded by "0x").
> +
> +Usage example: If device 0:0:1d.0 requires one page (0xd5d45) to be
> +reserved, and device 0:0:1a.0 requires three pages (0xd5d46 thru 0xd5d48)
> +to be reserved, one usage would be:
> +
> +rmrr=d5d45=0:0:1d.0;0xd5d46-0xd5d48=0:0:1a.0

An example with multiple devices would also be nice, maybe something like:

rmrr=d5d45=0:0:1d.0,0:0:1f.0;0xd5d46-0xd5d48=0:0:1a.0

Roger.
Jan Beulich Feb. 24, 2017, 8:55 a.m. UTC | #2
>>> On 23.02.17 at 18:03, <venu.busireddy@oracle.com> wrote:
> As some users have suggested, elaborate the usage of RMRR specification
> on the command line, and provide a usage example.
> 
> Also, always treat the specified page numbers as hexadecimal values.
> 
> Signed-off-by: Venu Busireddy <venu.busireddy@oracle.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>

> ---
> 
>  Changes in v2:
>    - Provide a better usage example.
>    - Treat input page numbers as hexadecimal values.

For this second aspect you should have Cc-ed the VT-d maintainer
(now added to Cc).

Jan

>  docs/misc/xen-command-line.markdown | 10 ++++++++++
>  xen/drivers/passthrough/vtd/dmar.c  |  4 ++--
>  2 files changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/docs/misc/xen-command-line.markdown 
> b/docs/misc/xen-command-line.markdown
> index 3acbb33..a035c3f 100644
> --- a/docs/misc/xen-command-line.markdown
> +++ b/docs/misc/xen-command-line.markdown
> @@ -1406,6 +1406,16 @@ 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.
> +
> +'start' and 'end' values are page numbers (not full physical addresses),
> +in hexadecimal format (can optionally be preceded by "0x").
> +
> +Usage example: If device 0:0:1d.0 requires one page (0xd5d45) to be
> +reserved, and device 0:0:1a.0 requires three pages (0xd5d46 thru 0xd5d48)
> +to be reserved, one usage would be:
> +
> +rmrr=d5d45=0:0:1d.0;0xd5d46-0xd5d48=0:0:1a.0
> +
>  Note: grub2 requires to escape or use quotations if special characters are 
> used,
>  namely ';', refer to the grub2 documentation if multiple ranges are 
> specified.
>  
> diff --git a/xen/drivers/passthrough/vtd/dmar.c 
> b/xen/drivers/passthrough/vtd/dmar.c
> index 9484f3b..436a533 100644
> --- a/xen/drivers/passthrough/vtd/dmar.c
> +++ b/xen/drivers/passthrough/vtd/dmar.c
> @@ -1097,13 +1097,13 @@ static void __init parse_rmrr_param(const char *str)
>      unsigned long start, end;
>  
>      do {
> -        start = simple_strtoul(cur = s, &s, 0);
> +        start = simple_strtoul(cur = s, &s, 16);
>          if ( cur == s )
>              break;
>  
>          if ( *s == '-' )
>          {
> -            end = simple_strtoul(cur = s + 1, &s, 0);
> +            end = simple_strtoul(cur = s + 1, &s, 16);
>              if ( cur == s )
>                  break;
>          }
Tian, Kevin Feb. 27, 2017, 1:40 a.m. UTC | #3
> From: Jan Beulich [mailto:JBeulich@suse.com]
> Sent: Friday, February 24, 2017 4:56 PM
> 
> >>> On 23.02.17 at 18:03, <venu.busireddy@oracle.com> wrote:
> > As some users have suggested, elaborate the usage of RMRR specification
> > on the command line, and provide a usage example.
> >
> > Also, always treat the specified page numbers as hexadecimal values.
> >
> > Signed-off-by: Venu Busireddy <venu.busireddy@oracle.com>
> 
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
> 

Acked-by: Kevin Tian <kevin.tian@intel.com>
diff mbox

Patch

diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown
index 3acbb33..a035c3f 100644
--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -1406,6 +1406,16 @@  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.
+
+'start' and 'end' values are page numbers (not full physical addresses),
+in hexadecimal format (can optionally be preceded by "0x").
+
+Usage example: If device 0:0:1d.0 requires one page (0xd5d45) to be
+reserved, and device 0:0:1a.0 requires three pages (0xd5d46 thru 0xd5d48)
+to be reserved, one usage would be:
+
+rmrr=d5d45=0:0:1d.0;0xd5d46-0xd5d48=0:0:1a.0
+
 Note: grub2 requires to escape or use quotations if special characters are used,
 namely ';', refer to the grub2 documentation if multiple ranges are specified.
 
diff --git a/xen/drivers/passthrough/vtd/dmar.c b/xen/drivers/passthrough/vtd/dmar.c
index 9484f3b..436a533 100644
--- a/xen/drivers/passthrough/vtd/dmar.c
+++ b/xen/drivers/passthrough/vtd/dmar.c
@@ -1097,13 +1097,13 @@  static void __init parse_rmrr_param(const char *str)
     unsigned long start, end;
 
     do {
-        start = simple_strtoul(cur = s, &s, 0);
+        start = simple_strtoul(cur = s, &s, 16);
         if ( cur == s )
             break;
 
         if ( *s == '-' )
         {
-            end = simple_strtoul(cur = s + 1, &s, 0);
+            end = simple_strtoul(cur = s + 1, &s, 16);
             if ( cur == s )
                 break;
         }