Skip to contentSkip to conversation

Remove some unused structures

PATCH Applied Dr. David Alan Gilbert 5 participants 20 messages May 5, 2024 – Jun 17, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Remove some unused structures

A bunch of structs that are currently unused, found with a simple script and a bit of eyeballing.

The only one I'm that suspicious of is the SPARC one, where the patch which removed the use is a bit confusing to me.

Tested with a
--target-list=ppc-softmmu,m68k-softmmu,x86_64-softmmu,arm-softmmu,aarch64-softmmu,cris-linux-user,i386-linux-user,sparc-linux-user
and 'make check' on x86 linux.

Dave

Dr. David Alan Gilbert (7):
linux-user: cris: Remove unused struct 'rt_signal_frame'
linux-user: i386/signal: Remove unused fp structs
linux-user: sparc: Remove unused struct 'target_mc_fq' hw/usb/dev-network: Remove unused struct 'rndis_config_parameter' hw/arm/bcm2836: Remove unusued struct 'BCM283XClass' target/ppc: Remove unused struct 'mmu_ctx_hash32' net/can: Remove unused struct 'CanBusState'

 hw/arm/bcm2836.c          | 12 ------------
 hw/usb/dev-network.c      |  8 --------
 linux-user/cris/signal.c  |  8 --------
 linux-user/i386/signal.c  | 10 ----------
 linux-user/sparc/signal.c |  5 -----
 net/can/can_host.c        |  6 ------
 target/ppc/mmu-hash32.c   |  6 ------
 7 files changed, 55 deletions(-)
Signature · 1 line
2.45.0
#1 lore raw

PATCH 1/7 linux-user: cris: Remove unused struct 'rt_signal_frame'

Since 'setup_rt_frame' has never been implemented, this struct is unused.

---
 linux-user/cris/signal.c | 8 --------
 1 file changed, 8 deletions(-)
linux-user/cris/signal.c +0 -8
index 4f532b2903..10948bcf30 100644
@@ -35,14 +35,6 @@ struct target_signal_frame {
     uint16_t retcode[4];      /* Trampoline code. */
 };
 
-struct rt_signal_frame {
-    siginfo_t *pinfo;
-    void *puc;
-    siginfo_t info;
-    ucontext_t uc;
-    uint16_t retcode[4];      /* Trampoline code. */
-};
-
 static void setup_sigcontext(struct target_sigcontext *sc, CPUCRISState *env)
 {
     __put_user(env->regs[0], &sc->regs.r0);
Signature · 1 line
2.45.0
Reviewed-by on v1 1/7
#2 lore raw

Re: [PATCH 1/7] linux-user: cris: Remove unused struct 'rt_signal_frame'

Quoted 7 lines · Dr. David Alan Gilbert

Since 'setup_rt_frame' has never been implemented, this struct is unused.

---
  linux-user/cris/signal.c | 8 --------
  1 file changed, 8 deletions(-)

Cris is scheduled for removal in 9.2.
We could ignore this until then.

But either way,

r~

Quoted 20 lines
linux-user/cris/signal.c +0 -8
index 4f532b2903..10948bcf30 100644
@@ -35,14 +35,6 @@ struct target_signal_frame {
      uint16_t retcode[4];      /* Trampoline code. */
  };
 
-struct rt_signal_frame {
-    siginfo_t *pinfo;
-    void *puc;
-    siginfo_t info;
-    ucontext_t uc;
-    uint16_t retcode[4];      /* Trampoline code. */
-};
-
  static void setup_sigcontext(struct target_sigcontext *sc, CPUCRISState *env)
  {
      __put_user(env->regs[0], &sc->regs.r0);
#3 lore raw

PATCH 2/7 linux-user: i386/signal: Remove unused fp structs

In reply to Dr. David Alan Gilbert

The structs 'target_fpxreg' and 'target_xmmreg' are unused since Paolo's:

Commit 2796f290b546 ("linux-user: i386/signal: support FXSAVE fpstate on 32-bit emulation")

---
 linux-user/i386/signal.c | 10 ----------
 1 file changed, 10 deletions(-)
linux-user/i386/signal.c +0 -10
index 990048f42a..9bf602b388 100644
@@ -34,16 +34,6 @@ struct target_fpreg {
     uint16_t exponent;
 };
 
-struct target_fpxreg {
-    uint16_t significand[4];
-    uint16_t exponent;
-    uint16_t padding[3];
-};
-
-struct target_xmmreg {
-    uint32_t element[4];
-};
-
 struct target_fpx_sw_bytes {
     uint32_t magic1;
     uint32_t extended_size;
Signature · 1 line
2.45.0
#4 lore raw

Re: [PATCH 2/7] linux-user: i386/signal: Remove unused fp structs

Quoted 10 lines · Dr. David Alan Gilbert

The structs 'target_fpxreg' and 'target_xmmreg' are unused since Paolo's:

Commit 2796f290b546 ("linux-user: i386/signal: support FXSAVE fpstate on 32-bit emulation")

---
  linux-user/i386/signal.c | 10 ----------
  1 file changed, 10 deletions(-)

I have

https://lore.kernel.org/qemu-devel/[email protected]/

which cleans this up. I need to refresh and resubmit.

r~

Quoted 22 lines
linux-user/i386/signal.c +0 -10
index 990048f42a..9bf602b388 100644
@@ -34,16 +34,6 @@ struct target_fpreg {
      uint16_t exponent;
  };
 
-struct target_fpxreg {
-    uint16_t significand[4];
-    uint16_t exponent;
-    uint16_t padding[3];
-};
-
-struct target_xmmreg {
-    uint32_t element[4];
-};
-
  struct target_fpx_sw_bytes {
      uint32_t magic1;
      uint32_t extended_size;
#5 lore raw

Re: [PATCH 2/7] linux-user: i386/signal: Remove unused fp structs

Quoted 12 lines · * Richard Henderson ([email protected]) wrote:
Quoted 10 lines · Dr. David Alan Gilbert

The structs 'target_fpxreg' and 'target_xmmreg' are unused since Paolo's:

Commit 2796f290b546 ("linux-user: i386/signal: support FXSAVE fpstate on 32-bit emulation")

---
  linux-user/i386/signal.c | 10 ----------
  1 file changed, 10 deletions(-)
Quoted 5 lines

I have

https://lore.kernel.org/qemu-devel/[email protected]/

which cleans this up. I need to refresh and resubmit.

Ah yes, that's fine.

Dave

Quoted 26 lines

r~

Quoted 21 lines
linux-user/i386/signal.c +0 -10
index 990048f42a..9bf602b388 100644
@@ -34,16 +34,6 @@ struct target_fpreg {
      uint16_t exponent;
  };
-struct target_fpxreg {
-    uint16_t significand[4];
-    uint16_t exponent;
-    uint16_t padding[3];
-};
-
-struct target_xmmreg {
-    uint32_t element[4];
-};
-
  struct target_fpx_sw_bytes {
      uint32_t magic1;
      uint32_t extended_size;
Signature · 4 lines
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/
#6 lore raw

PATCH 3/7 linux-user: sparc: Remove unused struct 'target_mc_fq'

In reply to Dr. David Alan Gilbert

This struct is unused since Peter's
Commit b8ae597f0e6d ("linux-user/sparc: Fix errors in target_ucontext structures")

However, hmm, I'm a bit confused since that commit modifies the structure and then removes it, was that intentional?

---
 linux-user/sparc/signal.c | 5 -----
 1 file changed, 5 deletions(-)
linux-user/sparc/signal.c +0 -5
index f164b74032..8181b8b92c 100644
@@ -546,11 +546,6 @@ void setup_sigtramp(abi_ulong sigtramp_page)
 typedef abi_ulong target_mc_greg_t;
 typedef target_mc_greg_t target_mc_gregset_t[SPARC_MC_NGREG];
 
-struct target_mc_fq {
-    abi_ulong mcfq_addr;
-    uint32_t mcfq_insn;
-};
-
 /*
  * Note the manual 16-alignment; the kernel gets this because it
  * includes a "long double qregs[16]" in the mcpu_fregs union,
Signature · 1 line
2.45.0
#7 lore raw

Re: [PATCH 3/7] linux-user: sparc: Remove unused struct 'target_mc_fq'

Quoted 6 lines · * Dr. David Alan Gilbert ([email protected]) wrote:

This struct is unused since Peter's
Commit b8ae597f0e6d ("linux-user/sparc: Fix errors in target_ucontext structures")

However, hmm, I'm a bit confused since that commit modifies the structure and then removes it, was that intentional?

Ping on this.
(I think the others in the set have been reviewed and one picked up).

Dave

Quoted 25 lines
---
 linux-user/sparc/signal.c | 5 -----
 1 file changed, 5 deletions(-)
linux-user/sparc/signal.c +0 -5
index f164b74032..8181b8b92c 100644
@@ -546,11 +546,6 @@ void setup_sigtramp(abi_ulong sigtramp_page)
 typedef abi_ulong target_mc_greg_t;
 typedef target_mc_greg_t target_mc_gregset_t[SPARC_MC_NGREG];
 
-struct target_mc_fq {
-    abi_ulong mcfq_addr;
-    uint32_t mcfq_insn;
-};
-
 /*
  * Note the manual 16-alignment; the kernel gets this because it
  * includes a "long double qregs[16]" in the mcpu_fregs union,
Signature · 1 line
2.45.0
Signature · 4 lines
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/
#8 lore raw

PATCH 4/7 hw/usb/dev-network: Remove unused struct 'rndis_config_parameter'

In reply to Dr. David Alan Gilbert

As far as I can tell it was never used.

---
 hw/usb/dev-network.c | 8 --------
 1 file changed, 8 deletions(-)
hw/usb/dev-network.c +0 -8
index 2c33e36cad..d00d68b21d 100644
@@ -475,14 +475,6 @@ struct rndis_packet_msg_type {
     le32 Reserved;
 };
 
-struct rndis_config_parameter {
-    le32 ParameterNameOffset;
-    le32 ParameterNameLength;
-    le32 ParameterType;
-    le32 ParameterValueOffset;
-    le32 ParameterValueLength;
-};
-
 /* implementation specific */
 enum rndis_state
 {
Signature · 1 line
2.45.0
#10 lore raw

PATCH 5/7 hw/arm/bcm2836: Remove unusued struct 'BCM283XClass'

In reply to Dr. David Alan Gilbert

This struct has been unused since
Commit f932093ae165 ("hw/arm/bcm2836: Split out common part of BCM283X classes")

---
 hw/arm/bcm2836.c | 12 ------------
 1 file changed, 12 deletions(-)
hw/arm/bcm2836.c +0 -12
index db191661f2..40a379bc36 100644
@@ -18,18 +18,6 @@
 #include "target/arm/cpu-qom.h"
 #include "target/arm/gtimer.h"
 
-struct BCM283XClass {
-    /*< private >*/
-    DeviceClass parent_class;
-    /*< public >*/
-    const char *name;
-    const char *cpu_type;
-    unsigned core_count;
-    hwaddr peri_base; /* Peripheral base address seen by the CPU */
-    hwaddr ctrl_base; /* Interrupt controller and mailboxes etc. */
-    int clusterid;
-};
-
 static Property bcm2836_enabled_cores_property =
     DEFINE_PROP_UINT32("enabled-cpus", BCM283XBaseState, enabled_cpus, 0);
 
Signature · 1 line
2.45.0
Reviewed-by on v1 5/7
#11 lore raw

Re: [PATCH 5/7] hw/arm/bcm2836: Remove unusued struct 'BCM283XClass'

Quoted 3 lines · Dr. David Alan Gilbert

This struct has been unused since
Commit f932093ae165 ("hw/arm/bcm2836: Split out common part of BCM283X classes")

Rather than "splitting out", commit f932093ae165 duplicated BCM283XClass as BCM283XBaseClass and left it unmodified.

Quoted 28 lines
---
  hw/arm/bcm2836.c | 12 ------------
  1 file changed, 12 deletions(-)
hw/arm/bcm2836.c +0 -12
index db191661f2..40a379bc36 100644
@@ -18,18 +18,6 @@
  #include "target/arm/cpu-qom.h"
  #include "target/arm/gtimer.h"
 
-struct BCM283XClass {
-    /*< private >*/
-    DeviceClass parent_class;
-    /*< public >*/
-    const char *name;
-    const char *cpu_type;
-    unsigned core_count;
-    hwaddr peri_base; /* Peripheral base address seen by the CPU */
-    hwaddr ctrl_base; /* Interrupt controller and mailboxes etc. */
-    int clusterid;
-};
-
  static Property bcm2836_enabled_cores_property =
      DEFINE_PROP_UINT32("enabled-cpus", BCM283XBaseState, enabled_cpus, 0);
 
#12 lore raw

PATCH 6/7 target/ppc: Remove unused struct 'mmu_ctx_hash32'

In reply to Dr. David Alan Gilbert

I think it's use was removed by
Commit 5883d8b296 ("mmu-hash*: Don't use full ppc_hash{32, 64}_translate() path for get_phys_page_debug()")

---
 target/ppc/mmu-hash32.c | 6 ------
 1 file changed, 6 deletions(-)
target/ppc/mmu-hash32.c +0 -6
index 3976416840..746321329c 100644
@@ -36,12 +36,6 @@
 #  define LOG_BATS(...) do { } while (0)
 #endif
 
-struct mmu_ctx_hash32 {
-    hwaddr raddr;      /* Real address              */
-    int prot;                      /* Protection bits           */
-    int key;                       /* Access key                */
-};
-
 static int ppc_hash32_pp_prot(int key, int pp, int nx)
 {
     int prot;
Signature · 1 line
2.45.0
Reviewed-by on v1 6/7
#13 lore raw

Re: [PATCH 6/7] target/ppc: Remove unused struct 'mmu_ctx_hash32'

Quoted 5 lines · Dr. David Alan Gilbert

I think it's use was removed by
Commit 5883d8b296 ("mmu-hash*: Don't use full ppc_hash{32, 64}_translate() path for get_phys_page_debug()")

Quoted 22 lines

---
target/ppc/mmu-hash32.c | 6 ------

1 file changed, 6 deletions(-)
target/ppc/mmu-hash32.c +0 -6
index 3976416840..746321329c 100644
@@ -36,12 +36,6 @@
 #  define LOG_BATS(...) do { } while (0)
 #endif
 
-struct mmu_ctx_hash32 {
-    hwaddr raddr;      /* Real address              */
-    int prot;                      /* Protection bits           */
-    int key;                       /* Access key                */
-};
-
 static int ppc_hash32_pp_prot(int key, int pp, int nx)
 {
    int prot;
#14 lore raw

Re: [PATCH 6/7] target/ppc: Remove unused struct 'mmu_ctx_hash32'

Quoted 8 lines · BALATON Zoltan
Quoted 5 lines · Dr. David Alan Gilbert

I think it's use was removed by
Commit 5883d8b296 ("mmu-hash*: Don't use full ppc_hash{32, 64}_translate() path for get_phys_page_debug()")

I've picked this patch up and will send with my series that changes the same place to avoid needing to rebase.

Regards,
BALATON Zoltan

Quoted 24 lines
Quoted 22 lines

---
target/ppc/mmu-hash32.c | 6 ------

1 file changed, 6 deletions(-)
target/ppc/mmu-hash32.c +0 -6
index 3976416840..746321329c 100644
@@ -36,12 +36,6 @@
 #  define LOG_BATS(...) do { } while (0)
 #endif
 
-struct mmu_ctx_hash32 {
-    hwaddr raddr;      /* Real address              */
-    int prot;                      /* Protection bits           */
-    int key;                       /* Access key                */
-};
-
 static int ppc_hash32_pp_prot(int key, int pp, int nx)
 {
    int prot;
#15 lore raw

Re: [PATCH 6/7] target/ppc: Remove unused struct 'mmu_ctx_hash32'

Quoted 6 lines · * BALATON Zoltan ([email protected]) wrote:
Quoted 5 lines · BALATON Zoltan
Quoted 4 lines · Dr. David Alan Gilbert

I think it's use was removed by
Commit 5883d8b296 ("mmu-hash*: Don't use full ppc_hash{32, 64}_translate() path for get_phys_page_debug()")

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

I've picked this patch up and will send with my series that changes the same place to avoid needing to rebase.

Thanks!

Dave

Quoted 27 lines

Regards,
BALATON Zoltan

Quoted 24 lines
Quoted 22 lines

---
target/ppc/mmu-hash32.c | 6 ------

1 file changed, 6 deletions(-)
target/ppc/mmu-hash32.c +0 -6
index 3976416840..746321329c 100644
@@ -36,12 +36,6 @@
 #  define LOG_BATS(...) do { } while (0)
 #endif
 
-struct mmu_ctx_hash32 {
-    hwaddr raddr;      /* Real address              */
-    int prot;                      /* Protection bits           */
-    int key;                       /* Access key                */
-};
-
 static int ppc_hash32_pp_prot(int key, int pp, int nx)
 {
    int prot;
Signature · 4 lines
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/
#16 lore raw

PATCH 7/7 net/can: Remove unused struct 'CanBusState'

In reply to Dr. David Alan Gilbert

As far as I can tell this struct has never been used in this file (it is used in can_core.c).

---
 net/can/can_host.c | 6 ------
 1 file changed, 6 deletions(-)
net/can/can_host.c +0 -6
index a3c84028c6..b2fe553f91 100644
@@ -34,12 +34,6 @@
 #include "net/can_emu.h"
 #include "net/can_host.h"
 
-struct CanBusState {
-    Object object;
-
-    QTAILQ_HEAD(, CanBusClientState) clients;
-};
-
 static void can_host_disconnect(CanHostState *ch)
 {
     CanHostClass *chc = CAN_HOST_GET_CLASS(ch);
Signature · 1 line
2.45.0
#18 lore raw
In reply to Dr. David Alan Gilbert
Quoted 6 lines · * Dr. David Alan Gilbert ([email protected]) wrote:

A bunch of structs that are currently unused, found with a simple script and a bit of eyeballing.

The only one I'm that suspicious of is the SPARC one, where the patch which removed the use is a bit confusing to me.

Copying in Trivial; I think there are 4 of these that are still outstanding:

[PATCH 1/7] linux-user: cris: Remove unused struct 'rt_signal_frame'
(Although cris is going)
[PATCH 3/7] linux-user: sparc: Remove unused struct 'target_mc_fq' [PATCH 5/7] hw/arm/bcm2836: Remove unusued struct 'BCM283XClass' [PATCH 7/7] net/can: Remove unused struct 'CanBusState'

Can Trivial pick these up please?

Dave

Quoted 28 lines

Tested with a
--target-list=ppc-softmmu,m68k-softmmu,x86_64-softmmu,arm-softmmu,aarch64-softmmu,cris-linux-user,i386-linux-user,sparc-linux-user
and 'make check' on x86 linux.

Dave

Dr. David Alan Gilbert (7):
linux-user: cris: Remove unused struct 'rt_signal_frame'
linux-user: i386/signal: Remove unused fp structs
linux-user: sparc: Remove unused struct 'target_mc_fq' hw/usb/dev-network: Remove unused struct 'rndis_config_parameter' hw/arm/bcm2836: Remove unusued struct 'BCM283XClass' target/ppc: Remove unused struct 'mmu_ctx_hash32' net/can: Remove unused struct 'CanBusState'

 hw/arm/bcm2836.c          | 12 ------------
 hw/usb/dev-network.c      |  8 --------
 linux-user/cris/signal.c  |  8 --------
 linux-user/i386/signal.c  | 10 ----------
 linux-user/sparc/signal.c |  5 -----
 net/can/can_host.c        |  6 ------
 target/ppc/mmu-hash32.c   |  6 ------
 7 files changed, 55 deletions(-)
Signature · 1 line
2.45.0
Signature · 4 lines
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/
#19 lore raw

07.06.2024 17:04, Dr. David Alan Gilbert пишет:

Quoted 11 lines · * Dr. David Alan Gilbert ([email protected]) wrote:
Quoted 6 lines

A bunch of structs that are currently unused, found with a simple script and a bit of eyeballing.

The only one I'm that suspicious of is the SPARC one, where the patch which removed the use is a bit confusing to me.

Copying in Trivial; I think there are 4 of these that are still outstanding:

Quoted 7 lines

[PATCH 1/7] linux-user: cris: Remove unused struct 'rt_signal_frame'
(Although cris is going)
[PATCH 3/7] linux-user: sparc: Remove unused struct 'target_mc_fq' [PATCH 5/7] hw/arm/bcm2836: Remove unusued struct 'BCM283XClass' [PATCH 7/7] net/can: Remove unused struct 'CanBusState'

Can Trivial pick these up please?

Applied to qemu-trivial, thanks!

/mjt

Signature · 4 lines
GPG Key transition (from rsa2048 to rsa4096) since 2024-04-24.
New key: rsa4096/61AD3D98ECDF2C8E  9D8B E14E 3F2A 9DD7 9199  28F1 61AD 3D98 ECDF 2C8E
Old key: rsa2048/457CE0A0804465C5  6EE1 95D1 886E 8FFB 810D  4324 457C E0A0 8044 65C5
Transition statement: http://www.corpit.ru/mjt/gpg-transition-2024.txt