All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH v2 0/1] Add pci_hole_min_size
@ 2014-03-11 19:27 Don Slutz
  2014-03-11 19:27 ` [RFC PATCH v2 1/1] " Don Slutz
  0 siblings, 1 reply; 7+ messages in thread
From: Don Slutz @ 2014-03-11 19:27 UTC (permalink / raw)
  To: xen-devel
  Cc: Boris Ostrovsky, Ian Jackson, Ian Campbell, Don Slutz,
	Stefano Stabellini

This time with v2 in the subject.

Changes from v1 to v2:
  Boris Ostrovsky:
    Need to init pci_hole_min_size

  Changed the qemu name from pci_hole_min_size to
  pc-memory-layout.max-ram-below-4g.

  Did not change the Xen version for now.

  Added quick note to xl.cfg.pod.5

  Added a check for a too big value. (Most likely in the wrong place.)

If you add enough PCI devices then all mmio may not fit below 4G
which may not be the layout the user wanted. This allows you to
increase the below 4G address space that PCI devices can use and
therefore in more cases not have any mmio that is above 4G.

There are real PCI cards that do not support mmio over 4G, so if you
want to emulate them precisely, you may also need to increase the
space below 4G for them.  There are drivers for these cards that
also do not work if they have their mmio space mapped above 4G.

This is posted as an RFC because you need the upstream version of
qemu with all 4 patches:

http://marc.info/?l=qemu-devel&m=139455360016654&w=2

This allows growing the pci_hole to the size needed.

This may help with using pci passthru and HVM.

Don Slutz (1):
  Add pci_hole_min_size

 docs/man/xl.cfg.pod.5          | 10 ++++++++++
 tools/firmware/hvmloader/pci.c | 12 ++++++++++++
 tools/libxc/xc_hvm_build_x86.c | 22 ++++++++++++++++++++++
 tools/libxc/xenguest.h         | 11 +++++++++++
 tools/libxl/libxl_create.c     |  4 +++-
 tools/libxl/libxl_dm.c         | 15 +++++++++++++++
 tools/libxl/libxl_dom.c        |  3 ++-
 tools/libxl/libxl_types.idl    |  1 +
 tools/libxl/xl_cmdimpl.c       |  6 ++++++
 9 files changed, 82 insertions(+), 2 deletions(-)

-- 
1.8.4

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [RFC PATCH v2 1/1] Add pci_hole_min_size
  2014-03-11 19:27 [RFC PATCH v2 0/1] Add pci_hole_min_size Don Slutz
@ 2014-03-11 19:27 ` Don Slutz
  2014-03-11 19:54   ` Boris Ostrovsky
  0 siblings, 1 reply; 7+ messages in thread
From: Don Slutz @ 2014-03-11 19:27 UTC (permalink / raw)
  To: xen-devel
  Cc: Boris Ostrovsky, Ian Jackson, Ian Campbell, Don Slutz,
	Stefano Stabellini

Add logging of max_ram_below_4g too big.

Signed-off-by: Don Slutz <dslutz@verizon.com>
---
 docs/man/xl.cfg.pod.5          | 10 ++++++++++
 tools/firmware/hvmloader/pci.c | 12 ++++++++++++
 tools/libxc/xc_hvm_build_x86.c | 22 ++++++++++++++++++++++
 tools/libxc/xenguest.h         | 11 +++++++++++
 tools/libxl/libxl_create.c     |  4 +++-
 tools/libxl/libxl_dm.c         | 15 +++++++++++++++
 tools/libxl/libxl_dom.c        |  3 ++-
 tools/libxl/libxl_types.idl    |  1 +
 tools/libxl/xl_cmdimpl.c       |  6 ++++++
 9 files changed, 82 insertions(+), 2 deletions(-)

diff --git a/docs/man/xl.cfg.pod.5 b/docs/man/xl.cfg.pod.5
index c02ad55..7ef7b10 100644
--- a/docs/man/xl.cfg.pod.5
+++ b/docs/man/xl.cfg.pod.5
@@ -1022,6 +1022,16 @@ wallclock (i.e., real) time.
 
 =back
 
+=head3 Memory layout
+
+=over 4
+
+=item B<pci_hole_min_size=BYTES>
+
+Specifies the minimum size the PCI MMIO hole below 4GiB will be.
+
+=back
+
 =head3 Support for Paravirtualisation of HVM Guests
 
 The following options allow Paravirtualised features (such as devices)
diff --git a/tools/firmware/hvmloader/pci.c b/tools/firmware/hvmloader/pci.c
index 627e8cb..4115929 100644
--- a/tools/firmware/hvmloader/pci.c
+++ b/tools/firmware/hvmloader/pci.c
@@ -58,6 +58,7 @@ void pci_setup(void)
         uint64_t bar_sz;
     } *bars = (struct bars *)scratch_start;
     unsigned int i, nr_bars = 0;
+    uint64_t pci_hole_min_size = 0;
 
     const char *s;
     /*
@@ -85,6 +86,10 @@ void pci_setup(void)
     printf("Relocating guest memory for lowmem MMIO space %s\n",
            allow_memory_relocate?"enabled":"disabled");
 
+    s = xenstore_read("platform/pci_hole_min_size", NULL);
+    if ( s )
+        pci_hole_min_size = strtoll(s, NULL, 0);
+
     /* Program PCI-ISA bridge with appropriate link routes. */
     isa_irq = 0;
     for ( link = 0; link < 4; link++ )
@@ -236,6 +241,13 @@ void pci_setup(void)
         pci_writew(devfn, PCI_COMMAND, cmd);
     }
 
+    if (pci_hole_min_size)
+    {
+        pci_mem_start = (1ULL << 32) - pci_hole_min_size;
+        printf("pci_mem_start=0x%lx (was 0x%x) for pci_hole_min_size=%lu\n",
+               pci_mem_start, PCI_MEM_START, (long)pci_hole_min_size);
+    }
+
     /*
      * At the moment qemu-xen can't deal with relocated memory regions.
      * It's too close to the release to make a proper fix; for now,
diff --git a/tools/libxc/xc_hvm_build_x86.c b/tools/libxc/xc_hvm_build_x86.c
index dd3b522..4752d58 100644
--- a/tools/libxc/xc_hvm_build_x86.c
+++ b/tools/libxc/xc_hvm_build_x86.c
@@ -603,16 +603,38 @@ int xc_hvm_build_target_mem(xc_interface *xch,
                            int target,
                            const char *image_name)
 {
+    return xc_hvm_build_target_mem_with_hole(xch, domid, memsize, target, image_name, 0);
+}
+
+int xc_hvm_build_target_mem_with_hole(xc_interface *xch,
+                                      uint32_t domid,
+                                      int memsize,
+                                      int target,
+                                      const char *image_name,
+                                      uint64_t pci_hole_min_size)
+{
     struct xc_hvm_build_args args = {};
 
     memset(&args, 0, sizeof(struct xc_hvm_build_args));
     args.mem_size = (uint64_t)memsize << 20;
     args.mem_target = (uint64_t)target << 20;
     args.image_file_name = image_name;
+    if (pci_hole_min_size > HVM_BELOW_4G_MMIO_LENGTH)
+        args.mmio_size = pci_hole_min_size;
 
     return xc_hvm_build(xch, domid, &args);
 }
 
+int xc_hvm_build_with_hole(xc_interface *xch, uint32_t domid,
+                           struct xc_hvm_build_args *args,
+                           uint64_t pci_hole_min_size)
+{
+    if (pci_hole_min_size > HVM_BELOW_4G_MMIO_LENGTH)
+        args->mmio_size = pci_hole_min_size;
+
+    return xc_hvm_build(xch, domid, args);
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/tools/libxc/xenguest.h b/tools/libxc/xenguest.h
index a0e30e1..44290bd 100644
--- a/tools/libxc/xenguest.h
+++ b/tools/libxc/xenguest.h
@@ -248,12 +248,23 @@ struct xc_hvm_build_args {
 int xc_hvm_build(xc_interface *xch, uint32_t domid,
                  struct xc_hvm_build_args *hvm_args);
 
+int xc_hvm_build_with_hole(xc_interface *xch, uint32_t domid,
+                           struct xc_hvm_build_args *args,
+                           uint64_t pci_hole_min_size);
+
 int xc_hvm_build_target_mem(xc_interface *xch,
                             uint32_t domid,
                             int memsize,
                             int target,
                             const char *image_name);
 
+int xc_hvm_build_target_mem_with_hole(xc_interface *xch,
+                                      uint32_t domid,
+                                      int memsize,
+                                      int target,
+                                      const char *image_name,
+                                      uint64_t pci_hole_min_size);
+
 int xc_suspend_evtchn_release(xc_interface *xch, xc_evtchn *xce, int domid, int suspend_evtchn);
 
 int xc_suspend_evtchn_init(xc_interface *xch, xc_evtchn *xce, int domid, int port);
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index 53e7cb6..4de8260 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -388,13 +388,15 @@ int libxl__domain_build(libxl__gc *gc,
         vments[4] = "start_time";
         vments[5] = libxl__sprintf(gc, "%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
 
-        localents = libxl__calloc(gc, 7, sizeof(char *));
+        localents = libxl__calloc(gc, 9, sizeof(char *));
         localents[0] = "platform/acpi";
         localents[1] = libxl_defbool_val(info->u.hvm.acpi) ? "1" : "0";
         localents[2] = "platform/acpi_s3";
         localents[3] = libxl_defbool_val(info->u.hvm.acpi_s3) ? "1" : "0";
         localents[4] = "platform/acpi_s4";
         localents[5] = libxl_defbool_val(info->u.hvm.acpi_s4) ? "1" : "0";
+        localents[6] = "platform/pci_hole_min_size";
+        localents[7] = libxl__sprintf(gc, "%llu", (unsigned long long)info->u.hvm.pci_hole_min_size);
 
         break;
     case LIBXL_DOMAIN_TYPE_PV:
diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index 5c06dfa..72842aa 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -656,6 +656,21 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
         } else {
             flexarray_append(dm_args, "xenfv");
         }
+        if (b_info->u.hvm.pci_hole_min_size) {
+            unsigned long long max_ram_below_4g = (1ULL << 32) -
+                b_info->u.hvm.pci_hole_min_size;
+
+            if (max_ram_below_4g > 0xF0000000ULL)
+            {
+                LIBXL__LOG(ctx, LIBXL__LOG_WARNING,
+                           "pci_hole_min_size too big => max_ram_below_4g=%llu > %llu (new adjusted value)\n",
+                           max_ram_below_4g, 0xF0000000ULL);
+                max_ram_below_4g = 0xF0000000ULL;
+            }
+            flexarray_append_pair(dm_args, "-global",
+                           GCSPRINTF("pc-memory-layout.max-ram-below-4g=%llu",
+                                     max_ram_below_4g));
+        }
         for (i = 0; b_info->extra_hvm && b_info->extra_hvm[i] != NULL; i++)
             flexarray_append(dm_args, b_info->extra_hvm[i]);
         break;
diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
index 55f74b2..6ebc606 100644
--- a/tools/libxl/libxl_dom.c
+++ b/tools/libxl/libxl_dom.c
@@ -642,7 +642,8 @@ int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
         goto out;
     }
 
-    ret = xc_hvm_build(ctx->xch, domid, &args);
+    ret = xc_hvm_build_with_hole(ctx->xch, domid, &args,
+                                 info->u.hvm.pci_hole_min_size);
     if (ret) {
         LOGEV(ERROR, ret, "hvm building failed");
         goto out;
diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
index 7d3a62b..bba7076 100644
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -346,6 +346,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
                                        ("timeoffset",       string),
                                        ("hpet",             libxl_defbool),
                                        ("vpt_align",        libxl_defbool),
+                                       ("pci_hole_min_size",UInt(64, init_val = 0)),
                                        ("timer_mode",       libxl_timer_mode),
                                        ("nested_hvm",       libxl_defbool),
                                        ("smbios_firmware",  string),
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 5f59bbc..8391824 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -1026,6 +1026,12 @@ static void parse_config_data(const char *config_source,
         xlu_cfg_get_defbool(config, "hpet", &b_info->u.hvm.hpet, 0);
         xlu_cfg_get_defbool(config, "vpt_align", &b_info->u.hvm.vpt_align, 0);
 
+        if (!xlu_cfg_get_long(config, "pci_hole_min_size", &l, 0)) {
+            b_info->u.hvm.pci_hole_min_size = (uint64_t) l;
+            if (dom_info->debug)
+                fprintf(stderr, "pci_hole_min_size: %llu\n", (unsigned long long) b_info->u.hvm.pci_hole_min_size);
+        }
+
         if (!xlu_cfg_get_long(config, "timer_mode", &l, 1)) {
             const char *s = libxl_timer_mode_to_string(l);
             fprintf(stderr, "WARNING: specifying \"timer_mode\" as an integer is deprecated. "
-- 
1.8.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [RFC PATCH v2 1/1] Add pci_hole_min_size
  2014-03-11 19:27 ` [RFC PATCH v2 1/1] " Don Slutz
@ 2014-03-11 19:54   ` Boris Ostrovsky
  2014-03-12 15:07     ` Slutz, Donald Christopher
  0 siblings, 1 reply; 7+ messages in thread
From: Boris Ostrovsky @ 2014-03-11 19:54 UTC (permalink / raw)
  To: Don Slutz; +Cc: Stefano Stabellini, Ian Jackson, Ian Campbell, xen-devel

On 03/11/2014 03:27 PM, Don Slutz wrote:
> Add logging of max_ram_below_4g too big.

Is this the whole commit message? This looks more like v2 vs. v1 diff 
description.

I think you need to put most of the text from your 0/1 message here.

>
> Signed-off-by: Don Slutz <dslutz@verizon.com>
> ---

...

> diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
> index 5c06dfa..72842aa 100644
> --- a/tools/libxl/libxl_dm.c
> +++ b/tools/libxl/libxl_dm.c
> @@ -656,6 +656,21 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
>           } else {
>               flexarray_append(dm_args, "xenfv");
>           }
> +        if (b_info->u.hvm.pci_hole_min_size) {
> +            unsigned long long max_ram_below_4g = (1ULL << 32) -
> +                b_info->u.hvm.pci_hole_min_size;
> +
> +            if (max_ram_below_4g > 0xF0000000ULL)

Is this '>' or '<'?

> +            {
> +                LIBXL__LOG(ctx, LIBXL__LOG_WARNING,
> +                           "pci_hole_min_size too big => max_ram_below_4g=%llu > %llu (new adjusted value)\n",
> +                           max_ram_below_4g, 0xF0000000ULL);
> +                max_ram_below_4g = 0xF0000000ULL;

Do you need to adjust pci_hole_min_size as well?


-boris

> +            }
> +            flexarray_append_pair(dm_args, "-global",
> +                           GCSPRINTF("pc-memory-layout.max-ram-below-4g=%llu",
> +                                     max_ram_below_4g));
> +        }
>           for (i = 0; b_info->extra_hvm && b_info->extra_hvm[i] != NULL; i++)
>               flexarray_append(dm_args, b_info->extra_hvm[i]);
>           break;
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC PATCH v2 1/1] Add pci_hole_min_size
  2014-03-11 19:54   ` Boris Ostrovsky
@ 2014-03-12 15:07     ` Slutz, Donald Christopher
  2014-03-12 15:29       ` Boris Ostrovsky
  0 siblings, 1 reply; 7+ messages in thread
From: Slutz, Donald Christopher @ 2014-03-12 15:07 UTC (permalink / raw)
  To: Boris Ostrovsky; +Cc: Stefano Stabellini, Ian Jackson, Ian Campbell, xen-devel


________________________________________
From: Boris Ostrovsky [boris.ostrovsky@oracle.com]
Sent: Tuesday, March 11, 2014 3:54 PM
To: Slutz, Donald Christopher
Cc: xen-devel@lists.xen.org; Ian Campbell; Ian Jackson; Stefano Stabellini
Subject: Re: [RFC PATCH v2 1/1] Add pci_hole_min_size

On 03/11/2014 03:27 PM, Don Slutz wrote:
> Add logging of max_ram_below_4g too big.

Is this the whole commit message? This looks more like v2 vs. v1 diff
description.

I think you need to put most of the text from your 0/1 message here.

Will do for next version.

>
> Signed-off-by: Don Slutz <dslutz@verizon.com>
> ---

...

> diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
> index 5c06dfa..72842aa 100644
> --- a/tools/libxl/libxl_dm.c
> +++ b/tools/libxl/libxl_dm.c
> @@ -656,6 +656,21 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
>           } else {
>               flexarray_append(dm_args, "xenfv");
>           }
> +        if (b_info->u.hvm.pci_hole_min_size) {
> +            unsigned long long max_ram_below_4g = (1ULL << 32) -
> +                b_info->u.hvm.pci_hole_min_size;
> +
> +            if (max_ram_below_4g > 0xF0000000ULL)

Is this '>' or '<'?

'>' is right.  This is the current value (I had issues getting the inculde file that defined this and so hard coded it.)

> +            {
> +                LIBXL__LOG(ctx, LIBXL__LOG_WARNING,
> +                           "pci_hole_min_size too big => max_ram_below_4g=%llu > %llu (new adjusted value)\n",
> +                           max_ram_below_4g, 0xF0000000ULL);
> +                max_ram_below_4g = 0xF0000000ULL;

Do you need to adjust pci_hole_min_size as well?

The limiting in hvmloader/pci.c looks to be missing.  I think that the auto correction of bad values needs to be done where they are used.  

Will add more in next version.

    -Don Slutz


-boris

> +            }
> +            flexarray_append_pair(dm_args, "-global",
> +                           GCSPRINTF("pc-memory-layout.max-ram-below-4g=%llu",
> +                                     max_ram_below_4g));
> +        }
>           for (i = 0; b_info->extra_hvm && b_info->extra_hvm[i] != NULL; i++)
>               flexarray_append(dm_args, b_info->extra_hvm[i]);
>           break;
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC PATCH v2 1/1] Add pci_hole_min_size
  2014-03-12 15:07     ` Slutz, Donald Christopher
@ 2014-03-12 15:29       ` Boris Ostrovsky
  2014-03-12 17:15         ` Don Slutz
  0 siblings, 1 reply; 7+ messages in thread
From: Boris Ostrovsky @ 2014-03-12 15:29 UTC (permalink / raw)
  To: Slutz, Donald Christopher
  Cc: Stefano Stabellini, Ian Jackson, Ian Campbell, xen-devel

On 03/12/2014 11:07 AM, Slutz, Donald Christopher wrote:
>
>> diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
>> index 5c06dfa..72842aa 100644
>> --- a/tools/libxl/libxl_dm.c
>> +++ b/tools/libxl/libxl_dm.c
>> @@ -656,6 +656,21 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
>>            } else {
>>                flexarray_append(dm_args, "xenfv");
>>            }
>> +        if (b_info->u.hvm.pci_hole_min_size) {
>> +            unsigned long long max_ram_below_4g = (1ULL << 32) -
>> +                b_info->u.hvm.pci_hole_min_size;
>> +
>> +            if (max_ram_below_4g > 0xF0000000ULL)
> Is this '>' or '<'?
>
> '>' is right.  This is the current value (I had issues getting the inculde file that defined this and so hard coded it.)


Then pci_hole_min_size is too small, not too big, isn't it?

-boris


>
>> +            {
>> +                LIBXL__LOG(ctx, LIBXL__LOG_WARNING,
>> +                           "pci_hole_min_size too big => max_ram_below_4g=%llu > %llu (new adjusted value)\n",
>> +                           max_ram_below_4g, 0xF0000000ULL);
>> +                max_ram_below_4g = 0xF0000000ULL;
> Do you need to adjust pci_hole_min_size as well?
>
> The limiting in hvmloader/pci.c looks to be missing.  I think that the auto correction of bad values needs to be done where they are used.
>
> Will add more in next version.
>
>      -Don Slutz
>
>
> -boris
>
>> +            }
>> +            flexarray_append_pair(dm_args, "-global",
>> +                           GCSPRINTF("pc-memory-layout.max-ram-below-4g=%llu",
>> +                                     max_ram_below_4g));
>> +        }
>>            for (i = 0; b_info->extra_hvm && b_info->extra_hvm[i] != NULL; i++)
>>                flexarray_append(dm_args, b_info->extra_hvm[i]);
>>            break;
>>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC PATCH v2 1/1] Add pci_hole_min_size
  2014-03-12 15:29       ` Boris Ostrovsky
@ 2014-03-12 17:15         ` Don Slutz
  2014-03-12 18:50           ` Boris Ostrovsky
  0 siblings, 1 reply; 7+ messages in thread
From: Don Slutz @ 2014-03-12 17:15 UTC (permalink / raw)
  To: Boris Ostrovsky, Slutz, Donald Christopher
  Cc: Stefano Stabellini, Ian Jackson, Ian Campbell, xen-devel

On 03/12/14 11:29, Boris Ostrovsky wrote:
> On 03/12/2014 11:07 AM, Slutz, Donald Christopher wrote:
>>
>>> diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
>>> index 5c06dfa..72842aa 100644
>>> --- a/tools/libxl/libxl_dm.c
>>> +++ b/tools/libxl/libxl_dm.c
>>> @@ -656,6 +656,21 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
>>>            } else {
>>>                flexarray_append(dm_args, "xenfv");
>>>            }
>>> +        if (b_info->u.hvm.pci_hole_min_size) {
>>> +            unsigned long long max_ram_below_4g = (1ULL << 32) -
>>> +                b_info->u.hvm.pci_hole_min_size;
>>> +
>>> +            if (max_ram_below_4g > 0xF0000000ULL)
>> Is this '>' or '<'?
>>
>> '>' is right.  This is the current value (I had issues getting the inculde file that defined this and so hard coded it.)
>
>
> Then pci_hole_min_size is too small, not too big, isn't it?
>
> -boris
>

No, but in unsigned, 4G - pci_hole_min_size will never be negative. This currently only handles pci_hole_min_size that are > 4G. Note: 4G is the same as 0.  What to do about 3.75G to 4.0G is not clear.  At one time I had code that limited max_ram_below_4g to be either 0 or >= 16M (real mode max) in addition, but was not 100% sure it is needed. (Or in pci_hole_min_size terms either 0 or < 16M.)  16M has some goodness in that seabios (and grub) can run, but linux does not like the memory layout.  Below 16M seabios (and hvmloader, etc) most likely will not be able to run.

    -Don Slutz

>
>>
>>> +            {
>>> +                LIBXL__LOG(ctx, LIBXL__LOG_WARNING,
>>> +                           "pci_hole_min_size too big => max_ram_below_4g=%llu > %llu (new adjusted value)\n",
>>> +                           max_ram_below_4g, 0xF0000000ULL);
>>> +                max_ram_below_4g = 0xF0000000ULL;
>> Do you need to adjust pci_hole_min_size as well?
>>
>> The limiting in hvmloader/pci.c looks to be missing.  I think that the auto correction of bad values needs to be done where they are used.
>>
>> Will add more in next version.
>>
>>      -Don Slutz
>>
>>
>> -boris
>>
>>> +            }
>>> +            flexarray_append_pair(dm_args, "-global",
>>> + GCSPRINTF("pc-memory-layout.max-ram-below-4g=%llu",
>>> +                                     max_ram_below_4g));
>>> +        }
>>>            for (i = 0; b_info->extra_hvm && b_info->extra_hvm[i] != NULL; i++)
>>>                flexarray_append(dm_args, b_info->extra_hvm[i]);
>>>            break;
>>>
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC PATCH v2 1/1] Add pci_hole_min_size
  2014-03-12 17:15         ` Don Slutz
@ 2014-03-12 18:50           ` Boris Ostrovsky
  0 siblings, 0 replies; 7+ messages in thread
From: Boris Ostrovsky @ 2014-03-12 18:50 UTC (permalink / raw)
  To: Don Slutz; +Cc: Stefano Stabellini, Ian Jackson, Ian Campbell, xen-devel

On 03/12/2014 01:15 PM, Don Slutz wrote:
> On 03/12/14 11:29, Boris Ostrovsky wrote:
>> On 03/12/2014 11:07 AM, Slutz, Donald Christopher wrote:
>>>
>>>> diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
>>>> index 5c06dfa..72842aa 100644
>>>> --- a/tools/libxl/libxl_dm.c
>>>> +++ b/tools/libxl/libxl_dm.c
>>>> @@ -656,6 +656,21 @@ static char ** 
>>>> libxl__build_device_model_args_new(libxl__gc *gc,
>>>>            } else {
>>>>                flexarray_append(dm_args, "xenfv");
>>>>            }
>>>> +        if (b_info->u.hvm.pci_hole_min_size) {
>>>> +            unsigned long long max_ram_below_4g = (1ULL << 32) -
>>>> +                b_info->u.hvm.pci_hole_min_size;
>>>> +
>>>> +            if (max_ram_below_4g > 0xF0000000ULL)
>>> Is this '>' or '<'?
>>>
>>> '>' is right.  This is the current value (I had issues getting the 
>>> inculde file that defined this and so hard coded it.)
>>
>>
>> Then pci_hole_min_size is too small, not too big, isn't it?
>>
>> -boris
>>
>
> No, but in unsigned, 4G - pci_hole_min_size will never be negative. 
> This currently only handles pci_hole_min_size that are > 4G. Note: 4G 
> is the same as 0.  What to do about 3.75G to 4.0G is not clear.  At 
> one time I had code that limited max_ram_below_4g to be either 0 or >= 
> 16M (real mode max) in addition, but was not 100% sure it is needed. 
> (Or in pci_hole_min_size terms either 0 or < 16M.)  16M has some 
> goodness in that seabios (and grub) can run, but linux does not like 
> the memory layout.  Below 16M seabios (and hvmloader, etc) most likely 
> will not be able to run.

I didn't realize this was guarding for pci_hole_min_size > 4G, I was 
thinking that if, say, pci_hole_min_size is 128M then you will get the 
warning that it is too big, which is presumably not what you want to see.

-boris


>
>    -Don Slutz
>
>>
>>>
>>>> +            {
>>>> +                LIBXL__LOG(ctx, LIBXL__LOG_WARNING,
>>>> +                           "pci_hole_min_size too big => 
>>>> max_ram_below_4g=%llu > %llu (new adjusted value)\n",
>>>> +                           max_ram_below_4g, 0xF0000000ULL);
>>>> +                max_ram_below_4g = 0xF0000000ULL;
>>> Do you need to adjust pci_hole_min_size as well?
>>>
>>> The limiting in hvmloader/pci.c looks to be missing.  I think that 
>>> the auto correction of bad values needs to be done where they are used.
>>>
>>> Will add more in next version.
>>>
>>>      -Don Slutz
>>>
>>>
>>> -boris
>>>
>>>> +            }
>>>> +            flexarray_append_pair(dm_args, "-global",
>>>> + GCSPRINTF("pc-memory-layout.max-ram-below-4g=%llu",
>>>> +                                     max_ram_below_4g));
>>>> +        }
>>>>            for (i = 0; b_info->extra_hvm && b_info->extra_hvm[i] != 
>>>> NULL; i++)
>>>>                flexarray_append(dm_args, b_info->extra_hvm[i]);
>>>>            break;
>>>>
>>
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-03-12 18:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-11 19:27 [RFC PATCH v2 0/1] Add pci_hole_min_size Don Slutz
2014-03-11 19:27 ` [RFC PATCH v2 1/1] " Don Slutz
2014-03-11 19:54   ` Boris Ostrovsky
2014-03-12 15:07     ` Slutz, Donald Christopher
2014-03-12 15:29       ` Boris Ostrovsky
2014-03-12 17:15         ` Don Slutz
2014-03-12 18:50           ` Boris Ostrovsky

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.