All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <iwj@xenproject.org>, Wei Liu <wl@xen.org>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Julien Grall <julien@xen.org>
Subject: [PATCH v1.1 03/10] tools/libxg: Drop stale p2m logic from ARM's meminit()
Date: Fri, 12 Feb 2021 20:01:39 +0000	[thread overview]
Message-ID: <20210212200139.26911-1-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <20210212153953.4582-4-andrew.cooper3@citrix.com>

Various version of gcc, when compiling with -Og, complain:

  xg_dom_arm.c: In function 'meminit':
  xg_dom_arm.c:420:19: error: 'p2m_size' may be used uninitialized in this function [-Werror=maybe-uninitialized]
    420 |     dom->p2m_size = p2m_size;
        |     ~~~~~~~~~~~~~~^~~~~~~~~~

This is actually entirely stale code since ee21f10d70^..97e34ad22d which
removed the 1:1 identity p2m for translated domains.

Drop the write of d->p2m_size, and the p2m_size local variable.  Reposition
the p2m_size field in struct xc_dom_image and correct some stale
documentation.

This change really ought to have been part of the original cleanup series.

No actual change to how ARM domains are constructed.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Ian Jackson <iwj@xenproject.org>
CC: Wei Liu <wl@xen.org>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Julien Grall <julien@xen.org>

v2:
 * Delete stale p2m_size infrastructure.
---
 tools/include/xenguest.h      | 5 ++---
 tools/libs/guest/xg_dom_arm.c | 5 -----
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/tools/include/xenguest.h b/tools/include/xenguest.h
index 775cf34c04..217022b6e7 100644
--- a/tools/include/xenguest.h
+++ b/tools/include/xenguest.h
@@ -145,6 +145,7 @@ struct xc_dom_image {
      * eventually copied into guest context.
      */
     xen_pfn_t *pv_p2m;
+    xen_pfn_t p2m_size;         /* number of pfns covered by pv_p2m */
 
     /* physical memory
      *
@@ -154,12 +155,10 @@ struct xc_dom_image {
      *
      * An ARM guest has GUEST_RAM_BANKS regions of RAM, with
      * rambank_size[i] pages in each. The lowest RAM address
-     * (corresponding to the base of the p2m arrays above) is stored
-     * in rambase_pfn.
+     * is stored in rambase_pfn.
      */
     xen_pfn_t rambase_pfn;
     xen_pfn_t total_pages;
-    xen_pfn_t p2m_size;         /* number of pfns covered by p2m */
     struct xc_dom_phys *phys_pages;
 #if defined (__arm__) || defined(__aarch64__)
     xen_pfn_t rambank_size[GUEST_RAM_BANKS];
diff --git a/tools/libs/guest/xg_dom_arm.c b/tools/libs/guest/xg_dom_arm.c
index 94948d2b20..b4c24f15fb 100644
--- a/tools/libs/guest/xg_dom_arm.c
+++ b/tools/libs/guest/xg_dom_arm.c
@@ -373,7 +373,6 @@ static int meminit(struct xc_dom_image *dom)
     const uint64_t modsize = dtb_size + ramdisk_size;
     const uint64_t ram128mb = bankbase[0] + (128<<20);
 
-    xen_pfn_t p2m_size;
     uint64_t bank0end;
 
     assert(dom->rambase_pfn << XC_PAGE_SHIFT == bankbase[0]);
@@ -409,16 +408,12 @@ static int meminit(struct xc_dom_image *dom)
 
         ramsize -= banksize;
 
-        p2m_size = ( bankbase[i] + banksize - bankbase[0] ) >> XC_PAGE_SHIFT;
-
         dom->rambank_size[i] = banksize >> XC_PAGE_SHIFT;
     }
 
     assert(dom->rambank_size[0] != 0);
     assert(ramsize == 0); /* Too much RAM is rejected above */
 
-    dom->p2m_size = p2m_size;
-
     /* setup initial p2m and allocate guest memory */
     for ( i = 0; i < GUEST_RAM_BANKS && dom->rambank_size[i]; i++ )
     {
-- 
2.11.0



  parent reply	other threads:[~2021-02-12 20:02 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-12 15:39 [PATCH for-4.15 00/10] tools: Support to use abi-dumper on libraries Andrew Cooper
2021-02-12 15:39 ` [PATCH 01/10] tools/xl: Fix exit code for `xl vkbattach` Andrew Cooper
2021-02-16 15:57   ` Ian Jackson
2021-02-16 16:25   ` Ian Jackson
2021-02-12 15:39 ` [PATCH 02/10] tools/libxg: Fix uninitialised variable in write_x86_cpu_policy_records() Andrew Cooper
2021-02-12 15:54   ` Jan Beulich
2021-02-16 15:57   ` Ian Jackson
2021-02-12 15:39 ` [PATCH 03/10] tools/libxg: Fix uninitialised variable in meminit() Andrew Cooper
2021-02-12 15:55   ` Julien Grall
2021-02-12 19:35     ` Andrew Cooper
2021-02-12 20:01   ` Andrew Cooper [this message]
2021-02-16 16:00     ` [PATCH v1.1 03/10] tools/libxg: Drop stale p2m logic from ARM's meminit() Ian Jackson
2021-02-16 16:27     ` Julien Grall
2021-02-12 15:39 ` [PATCH 04/10] tools/libxl: Fix uninitialised variable in libxl__domain_get_device_model_uid() Andrew Cooper
2021-02-16 16:07   ` Ian Jackson
2021-02-16 17:43   ` [PATCH v2 " Andrew Cooper
2021-02-16 17:57     ` Ian Jackson
2021-02-16 18:05       ` Ian Jackson
2021-02-12 15:39 ` [PATCH 05/10] tools/libxl: Fix uninitialised variable in libxl__write_stub_dmargs() Andrew Cooper
2021-02-16 16:07   ` Ian Jackson
2021-02-16 16:26   ` Ian Jackson
2021-02-12 15:39 ` [PATCH 06/10] stubdom/xenstored: Fix uninitialised variables in lu_read_state() Andrew Cooper
2021-02-12 16:08   ` Jürgen Groß
2021-02-12 17:01     ` Andrew Cooper
2021-02-13  9:36       ` Jürgen Groß
2021-02-15 14:12         ` Andrew Cooper
2021-02-15 15:36   ` [PATCH v1.1 " Andrew Cooper
2021-02-16 16:10   ` [PATCH " Ian Jackson
2021-02-12 15:39 ` [PATCH 07/10] tools: Use -Og for debug builds when available Andrew Cooper
2021-02-12 16:04   ` Jan Beulich
2021-02-12 16:09     ` Andrew Cooper
2021-02-12 16:14       ` Jan Beulich
2021-02-16 16:26     ` Ian Jackson
2021-02-16 16:11   ` Ian Jackson
2021-02-12 15:39 ` [PATCH 08/10] tools: Check for abi-dumper in ./configure Andrew Cooper
2021-02-16 16:11   ` Ian Jackson
2021-02-16 16:27   ` Ian Jackson
2021-02-12 15:39 ` [PATCH 09/10] tools/libs: Add rule to generate headers.lst Andrew Cooper
2021-02-16 16:13   ` Ian Jackson
2021-02-16 16:48   ` [PATCH v2 " Andrew Cooper
2021-02-16 17:32     ` Ian Jackson
2021-02-12 15:39 ` [PATCH 10/10] tools/libs: Write out an ABI analysis when abi-dumper is available Andrew Cooper
2021-02-12 16:12   ` Jan Beulich
2021-02-12 17:03     ` Andrew Cooper
2021-02-12 18:01   ` [PATCH v1.1 " Andrew Cooper
2021-02-16 16:15   ` [PATCH " Ian Jackson
2021-02-16 16:30   ` Ian Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210212200139.26911-1-andrew.cooper3@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=iwj@xenproject.org \
    --cc=julien@xen.org \
    --cc=sstabellini@kernel.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.