From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Dmitry Fleytman" <dmitry.fleytman@gmail.com>,
qemu-trivial@nongnu.org, "Jason Wang" <jasowang@redhat.com>,
"Christian Schoenebeck" <qemu_oss@crudebyte.com>,
"Greg Kurz" <groug@kaod.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: [PATCH 2/3] hw/net/e1000: Move macreg[] arrays to .rodata to save 1MiB of .data
Date: Thu, 5 Mar 2020 02:04:45 +0100 [thread overview]
Message-ID: <20200305010446.17029-3-philmd@redhat.com> (raw)
In-Reply-To: <20200305010446.17029-1-philmd@redhat.com>
Each array consumes 256KiB of .data. As we do not reassign entries,
we can move it to the .rodata section, and save a total of 1MiB of
.data (size reported on x86_64 host).
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
hw/net/e1000.c | 4 ++--
hw/net/e1000e_core.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/hw/net/e1000.c b/hw/net/e1000.c
index 972d9b5083..9233248c9a 100644
--- a/hw/net/e1000.c
+++ b/hw/net/e1000.c
@@ -1151,7 +1151,7 @@ set_ims(E1000State *s, int index, uint32_t val)
#define getreg(x) [x] = mac_readreg
typedef uint32_t (*readops)(E1000State *, int);
-static readops macreg_readops[] = {
+static const readops macreg_readops[] = {
getreg(PBA), getreg(RCTL), getreg(TDH), getreg(TXDCTL),
getreg(WUFC), getreg(TDT), getreg(CTRL), getreg(LEDCTL),
getreg(MANC), getreg(MDIC), getreg(SWSM), getreg(STATUS),
@@ -1207,7 +1207,7 @@ enum { NREADOPS = ARRAY_SIZE(macreg_readops) };
#define putreg(x) [x] = mac_writereg
typedef void (*writeops)(E1000State *, int, uint32_t);
-static writeops macreg_writeops[] = {
+static const writeops macreg_writeops[] = {
putreg(PBA), putreg(EERD), putreg(SWSM), putreg(WUFC),
putreg(TDBAL), putreg(TDBAH), putreg(TXDCTL), putreg(RDBAH),
putreg(RDBAL), putreg(LEDCTL), putreg(VET), putreg(FCRUC),
diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c
index 38bdb90114..df957e0c1a 100644
--- a/hw/net/e1000e_core.c
+++ b/hw/net/e1000e_core.c
@@ -2856,7 +2856,7 @@ e1000e_set_gcr(E1000ECore *core, int index, uint32_t val)
#define e1000e_getreg(x) [x] = e1000e_mac_readreg
typedef uint32_t (*readops)(E1000ECore *, int);
-static readops e1000e_macreg_readops[] = {
+static const readops e1000e_macreg_readops[] = {
e1000e_getreg(PBA),
e1000e_getreg(WUFC),
e1000e_getreg(MANC),
@@ -3063,7 +3063,7 @@ enum { E1000E_NREADOPS = ARRAY_SIZE(e1000e_macreg_readops) };
#define e1000e_putreg(x) [x] = e1000e_mac_writereg
typedef void (*writeops)(E1000ECore *, int, uint32_t);
-static writeops e1000e_macreg_writeops[] = {
+static const writeops e1000e_macreg_writeops[] = {
e1000e_putreg(PBA),
e1000e_putreg(SWSM),
e1000e_putreg(WUFC),
--
2.21.1
next prev parent reply other threads:[~2020-03-05 1:07 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-05 1:04 [PATCH 0/3] hw/net,virtfs-proxy-helper: Reduce .data footprint Philippe Mathieu-Daudé
2020-03-05 1:04 ` [PATCH 1/3] hw/net/e1000: Add readops/writeops typedefs Philippe Mathieu-Daudé
2020-03-05 9:16 ` Dmitry Fleytman
2020-03-05 1:04 ` Philippe Mathieu-Daudé [this message]
2020-03-05 9:16 ` [PATCH 2/3] hw/net/e1000: Move macreg[] arrays to .rodata to save 1MiB of .data Dmitry Fleytman
2020-03-05 1:04 ` [PATCH 3/3] virtfs-proxy-helper: Make the helper_opts[] array const Philippe Mathieu-Daudé
2020-03-05 10:10 ` Greg Kurz
2020-03-05 9:53 ` [PATCH 0/3] hw/net,virtfs-proxy-helper: Reduce .data footprint Stefano Garzarella
2020-03-05 10:37 ` Philippe Mathieu-Daudé
2020-03-05 10:41 ` Stefano Garzarella
2020-03-06 9:25 ` Paolo Bonzini
2020-03-09 11:44 ` Laurent Vivier
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=20200305010446.17029-3-philmd@redhat.com \
--to=philmd@redhat.com \
--cc=dmitry.fleytman@gmail.com \
--cc=groug@kaod.org \
--cc=jasowang@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=qemu_oss@crudebyte.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).