Skip to contentSkip to conversation

q35: Remove unused mch_mcfg_base

PATCH In review [email protected] 3 participants 4 messages Sep 18, 2024 – Oct 2, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 q35: Remove unused mch_mcfg_base

From: "Dr. David Alan Gilbert" <[email protected]>

mch_mcfg_base has been unused since it was added by
6f1426ab0f ("ich9: APIs for pc guest info")
back in 2013.

Remove it.

---
 hw/pci-host/q35.c         | 10 ----------
 include/hw/pci-host/q35.h |  2 --
 2 files changed, 12 deletions(-)
hw/pci-host/q35.c +0 -10
index d5a657a02a..f3e713318e 100644
@@ -662,16 +662,6 @@ static void mch_realize(PCIDevice *d, Error **errp)
                                    OBJECT(&mch->smram));
 }
 
-uint64_t mch_mcfg_base(void)
-{
-    bool ambiguous;
-    Object *o = object_resolve_path_type("", TYPE_MCH_PCI_DEVICE, &ambiguous);
-    if (!o) {
-        return 0;
-    }
-    return MCH_HOST_BRIDGE_PCIEXBAR_DEFAULT;
-}
-
 static Property mch_props[] = {
     DEFINE_PROP_UINT16("extended-tseg-mbytes", MCHPCIState, ext_tseg_mbytes,
                        16),
include/hw/pci-host/q35.h +0 -2
index 22fadfa3ed..ddafc3f2e3 100644
@@ -181,8 +181,6 @@ struct Q35PCIHost {
 #define MCH_PCIE_DEV                           1
 #define MCH_PCIE_FUNC                          0
 
-uint64_t mch_mcfg_base(void);
-
 /*
  * Arbitrary but unique BNF number for IOAPIC device.
  *
Signature · 1 line
2.46.0
Reviewed-by on v1 1/1
#1 lore raw

Am 18. September 2024 00:51:32 UTC schrieb [email protected]:

Quoted 5 lines

From: "Dr. David Alan Gilbert" <[email protected]>

mch_mcfg_base has been unused since it was added by
6f1426ab0f ("ich9: APIs for pc guest info")
back in 2013.

Indeed.

Quoted 4 lines

Remove it.

I'm curious: How do you detect such unused code?

Quoted 39 lines

---
hw/pci-host/q35.c | 10 ----------
include/hw/pci-host/q35.h | 2 --

2 files changed, 12 deletions(-)
hw/pci-host/q35.c +0 -10
index d5a657a02a..f3e713318e 100644
@@ -662,16 +662,6 @@ static void mch_realize(PCIDevice *d, Error **errp)
                                   OBJECT(&mch->smram));
 }
 
-uint64_t mch_mcfg_base(void)
-{
-    bool ambiguous;
-    Object *o = object_resolve_path_type("", TYPE_MCH_PCI_DEVICE, &ambiguous);
-    if (!o) {
-        return 0;
-    }
-    return MCH_HOST_BRIDGE_PCIEXBAR_DEFAULT;
-}
-
 static Property mch_props[] = {
    DEFINE_PROP_UINT16("extended-tseg-mbytes", MCHPCIState, ext_tseg_mbytes,
                       16),
include/hw/pci-host/q35.h +0 -2
index 22fadfa3ed..ddafc3f2e3 100644
@@ -181,8 +181,6 @@ struct Q35PCIHost {
 #define MCH_PCIE_DEV                           1
 #define MCH_PCIE_FUNC                          0
 
-uint64_t mch_mcfg_base(void);
-
 /*
 * Arbitrary but unique BNF number for IOAPIC device.
 *
#2 lore raw
Quoted 9 lines · * Bernhard Beschow ([email protected]) wrote:

Am 18. September 2024 00:51:32 UTC schrieb [email protected]:

Quoted 5 lines

From: "Dr. David Alan Gilbert" <[email protected]>

mch_mcfg_base has been unused since it was added by
6f1426ab0f ("ich9: APIs for pc guest info")
back in 2013.

Quoted 8 lines

Indeed.

Quoted 4 lines

Remove it.

Thanks!

Quoted 1 line

I'm curious: How do you detect such unused code?

I've got a very hacky script that looks for symbols that are defined but nothing else uses; it generates a lot of false positives so takes a lot of handholding to find real cases.
See: https://lore.kernel.org/lkml/ZugliLgw5VFb9yau@gallifrey/

Dave

Quoted 39 lines
Quoted 39 lines

---
hw/pci-host/q35.c | 10 ----------
include/hw/pci-host/q35.h | 2 --

2 files changed, 12 deletions(-)
hw/pci-host/q35.c +0 -10
index d5a657a02a..f3e713318e 100644
@@ -662,16 +662,6 @@ static void mch_realize(PCIDevice *d, Error **errp)
                                   OBJECT(&mch->smram));
 }
 
-uint64_t mch_mcfg_base(void)
-{
-    bool ambiguous;
-    Object *o = object_resolve_path_type("", TYPE_MCH_PCI_DEVICE, &ambiguous);
-    if (!o) {
-        return 0;
-    }
-    return MCH_HOST_BRIDGE_PCIEXBAR_DEFAULT;
-}
-
 static Property mch_props[] = {
    DEFINE_PROP_UINT16("extended-tseg-mbytes", MCHPCIState, ext_tseg_mbytes,
                       16),
include/hw/pci-host/q35.h +0 -2
index 22fadfa3ed..ddafc3f2e3 100644
@@ -181,8 +181,6 @@ struct Q35PCIHost {
 #define MCH_PCIE_DEV                           1
 #define MCH_PCIE_FUNC                          0
 
-uint64_t mch_mcfg_base(void);
-
 /*
 * Arbitrary but unique BNF number for IOAPIC device.
 *
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   |_______/
Reviewed-by on v1 1/1
#3 lore raw
In reply to [email protected]
Quoted 40 lines · On 18/09/2024 02.51, [email protected] wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

mch_mcfg_base has been unused since it was added by
6f1426ab0f ("ich9: APIs for pc guest info")
back in 2013.

Remove it.

---
  hw/pci-host/q35.c         | 10 ----------
  include/hw/pci-host/q35.h |  2 --
  2 files changed, 12 deletions(-)
hw/pci-host/q35.c +0 -10
index d5a657a02a..f3e713318e 100644
@@ -662,16 +662,6 @@ static void mch_realize(PCIDevice *d, Error **errp)
                                     OBJECT(&mch->smram));
  }
 
-uint64_t mch_mcfg_base(void)
-{
-    bool ambiguous;
-    Object *o = object_resolve_path_type("", TYPE_MCH_PCI_DEVICE, &ambiguous);
-    if (!o) {
-        return 0;
-    }
-    return MCH_HOST_BRIDGE_PCIEXBAR_DEFAULT;
-}
-
  static Property mch_props[] = {
      DEFINE_PROP_UINT16("extended-tseg-mbytes", MCHPCIState, ext_tseg_mbytes,
                         16),
include/hw/pci-host/q35.h +0 -0
index 22fadfa3ed..ddafc3f2e3 100644

include/hw/pci-host/q35.h struct Q35PCIHost { · line 186

Quoted 8 lines
include/hw/pci-host/q35.h +0 -2
@@ -181,8 +181,6 @@ struct Q35PCIHost {
  #define MCH_PCIE_DEV                           1
  #define MCH_PCIE_FUNC                          0
 
-uint64_t mch_mcfg_base(void);
-
  /*
   * Arbitrary but unique BNF number for IOAPIC device.
   *